@kws3/ui 1.7.1 → 1.7.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/CHANGELOG.mdx +15 -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/datagrid/Pagination/Pagination.svelte +12 -8
- package/forms/actions.js +10 -8
- package/package.json +3 -3
- package/sliding-panes/SlidingPane.svelte +68 -36
package/CHANGELOG.mdx
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 1.7.4
|
|
2
|
+
- Update ApexCharts to version 3.33.2
|
|
3
|
+
- Added support for subscribing to chart events
|
|
4
|
+
- Added support for distributed bar charts using new `distributed` prop on `BarChart` component
|
|
5
|
+
- Added examples for leveraging advanced chart features
|
|
6
|
+
|
|
7
|
+
## 1.7.3
|
|
8
|
+
- Fix docs for `Popover`
|
|
9
|
+
- Increase performance for `SlidingPane` by using ResizeObserver when available
|
|
10
|
+
|
|
11
|
+
## 1.7.2
|
|
12
|
+
- `DatePicker` component: fix initialisation bug on mobile
|
|
13
|
+
- `Pagination` component: rename property `breakThreshold` -> `maxVisiblePages` plus bugfix and documentation update
|
|
14
|
+
|
|
1
15
|
## 1.7.1
|
|
2
16
|
- `Skeleton` component: Illustrate in example the use of empty string for `color` prop.
|
|
3
17
|
- `Pagination` component: Deprecate `meta` prop. And use separate props for `offset`, `limit`, `count` and `total` instead.
|
|
@@ -6,9 +20,8 @@
|
|
|
6
20
|
- `Modal` component can now be opened and closed programatically via `open()` and `close()` methods.
|
|
7
21
|
- Added linting rules for ESLint. And corrected all resulting issues.
|
|
8
22
|
|
|
9
|
-
|
|
10
23
|
## 1.7.0
|
|
11
|
-
- Ensure uniform usage of
|
|
24
|
+
- Ensure uniform usage of `$kws-theme-colors` across all components, this means `$kws-theme-colors` can be independent of the global `$colors` SCSS variable.
|
|
12
25
|
- `DataSearch` component: Expand filters to fill area when main search input is not present.
|
|
13
26
|
- `DataSort` component: Increase click area for activating dropdown, and provide visual segementation between label and dropdown.
|
|
14
27
|
- New `Skeleton` component.
|
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
|
|
package/charts/PieChart.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="pie"
|
|
24
67
|
{height}
|
|
25
|
-
{width}
|
|
68
|
+
{width}
|
|
69
|
+
{captured_events} />
|
|
26
70
|
|
|
27
71
|
<script>
|
|
28
72
|
import { Chart } from "@kws3/ui";
|
|
@@ -61,7 +105,12 @@ 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 = [];
|
|
65
114
|
|
|
66
115
|
/**
|
|
67
116
|
* CSS classes for container
|
|
@@ -69,6 +118,14 @@ Send an array of colors to override the default colors, or do not send anything
|
|
|
69
118
|
let klass = "";
|
|
70
119
|
export { klass as class };
|
|
71
120
|
|
|
121
|
+
let chart;
|
|
122
|
+
/**
|
|
123
|
+
* Returns the ApexCharts instance
|
|
124
|
+
*/
|
|
125
|
+
export function getInstance() {
|
|
126
|
+
return chart.getInstance();
|
|
127
|
+
}
|
|
128
|
+
|
|
72
129
|
$: __class =
|
|
73
130
|
"kws-pie-chart " + `${sparklines ? "kws-sparklines" : ""} ` + klass;
|
|
74
131
|
|
|
@@ -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="radialBar"
|
|
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
|
let _data = [],
|
|
83
140
|
_labels = [];
|
|
84
141
|
|
package/charts/utils.js
CHANGED
|
@@ -99,6 +99,9 @@ export function mixedChartOptions(xAxis, yAxis, is_sparkline) {
|
|
|
99
99
|
sparkline: {
|
|
100
100
|
enabled: is_sparkline ? true : false,
|
|
101
101
|
},
|
|
102
|
+
zoom: {
|
|
103
|
+
enabled: false,
|
|
104
|
+
},
|
|
102
105
|
},
|
|
103
106
|
colors: themeColors,
|
|
104
107
|
fill: {
|
|
@@ -189,6 +192,7 @@ export function barChartOptions(
|
|
|
189
192
|
yAxis,
|
|
190
193
|
is_sparkline,
|
|
191
194
|
is_horizontal,
|
|
195
|
+
is_distributed,
|
|
192
196
|
is_stacked,
|
|
193
197
|
is_stacked_full
|
|
194
198
|
) {
|
|
@@ -197,6 +201,7 @@ export function barChartOptions(
|
|
|
197
201
|
opts.chart.stacked = is_stacked ? true : false;
|
|
198
202
|
opts.chart.stackType = is_stacked_full ? "100%" : false;
|
|
199
203
|
opts.plotOptions.bar.horizontal = is_horizontal ? true : false;
|
|
204
|
+
opts.plotOptions.bar.distributed = is_distributed ? true : false;
|
|
200
205
|
return opts;
|
|
201
206
|
}
|
|
202
207
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
@param {boolean} [showTotal=true] - Determines whether to show total or not, Default: `true`
|
|
13
13
|
@param {boolean} [showCurrent=true] - Determines whether to show current page details, Default: `true`
|
|
14
14
|
@param {boolean} [showPerPage=true] - Determines whether to show per page options, Default: `true`
|
|
15
|
-
@param {number} [
|
|
15
|
+
@param {number} [maxVisiblePages=10] - Maximum number of consecutive pages to show in pagination after which a break is introduced in between them, Default: `10`
|
|
16
16
|
@param {string} [entityName="entries"] - String to display total entries, Default: `"entries"`
|
|
17
17
|
@param {''|'small'|'medium'|'large'} [size="small"] - Size of the pagination elements, Default: `"small"`
|
|
18
18
|
@param {boolean} [frame=false] - Determines whether to show pagination frame or not, Default: `false`
|
|
@@ -180,9 +180,9 @@
|
|
|
180
180
|
*/
|
|
181
181
|
showPerPage = true,
|
|
182
182
|
/**
|
|
183
|
-
*
|
|
183
|
+
* Maximum number of consecutive pages to show in pagination after which a break is introduced in between them
|
|
184
184
|
*/
|
|
185
|
-
|
|
185
|
+
maxVisiblePages = 10,
|
|
186
186
|
/**
|
|
187
187
|
* String to display total entries
|
|
188
188
|
*/
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
$: totalItems = meta && _total ? _total : 0;
|
|
243
243
|
$: currentPage = Math.floor(_offset / _limit);
|
|
244
244
|
$: totalPages = Math.ceil(_total / (_limit || 1));
|
|
245
|
-
$: totalPages, currentPage,
|
|
245
|
+
$: totalPages, currentPage, maxVisiblePages, calculatePages();
|
|
246
246
|
|
|
247
247
|
function calculatePages() {
|
|
248
248
|
pages = new Array(totalPages || 0);
|
|
@@ -251,10 +251,14 @@
|
|
|
251
251
|
ret = [];
|
|
252
252
|
|
|
253
253
|
for (var i = 0; i < total; i++) {
|
|
254
|
-
if (total >
|
|
255
|
-
|
|
254
|
+
if (total > maxVisiblePages) {
|
|
255
|
+
let threshold = Math.max(
|
|
256
|
+
Math.floor(maxVisiblePages / 3),
|
|
257
|
+
Math.min(3, maxVisiblePages - 3)
|
|
258
|
+
);
|
|
259
|
+
if (i < threshold) {
|
|
256
260
|
ret.push({ p: i });
|
|
257
|
-
} else if (i
|
|
261
|
+
} else if (i >= total - threshold) {
|
|
258
262
|
ret.push({ p: i });
|
|
259
263
|
} else if (i === Math.floor(total / 2)) {
|
|
260
264
|
ret.push({ p: i });
|
|
@@ -272,7 +276,7 @@
|
|
|
272
276
|
|
|
273
277
|
let _prev = 0,
|
|
274
278
|
items = []; // _prev was prev
|
|
275
|
-
if (total >
|
|
279
|
+
if (total > maxVisiblePages) {
|
|
276
280
|
for (var j = 0; j < ret.length; j++) {
|
|
277
281
|
var page = ret[j].p;
|
|
278
282
|
if (page !== _prev + 1 && page !== 0) {
|
package/forms/actions.js
CHANGED
|
@@ -50,17 +50,19 @@ function createFlatpickrAction(defaultOpts, hooks) {
|
|
|
50
50
|
|
|
51
51
|
function applyColorClass(instance, color) {
|
|
52
52
|
let contains = false;
|
|
53
|
-
instance.calendarContainer
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
if (instance && instance.calendarContainer) {
|
|
54
|
+
instance.calendarContainer.classList.forEach((c) => {
|
|
55
|
+
if (c.charAt(3).toLowerCase() === "is-") {
|
|
56
|
+
contains = c;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (contains) {
|
|
61
|
+
instance.calendarContainer.classList.remove(contains);
|
|
56
62
|
}
|
|
57
|
-
});
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
instance.calendarContainer.classList.remove(contains);
|
|
64
|
+
instance.calendarContainer.classList.add("is-" + color);
|
|
61
65
|
}
|
|
62
|
-
|
|
63
|
-
instance.calendarContainer.classList.add("is-" + color);
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
function applyInitialInputAttributes(instance, { style }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kws3/ui",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.4",
|
|
4
4
|
"description": "UI components for use with Svelte v3 applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"apexcharts": "
|
|
26
|
+
"apexcharts": "3.33.2",
|
|
27
27
|
"flatpickr": "^4.5.2",
|
|
28
28
|
"svelte-portal": "^2.1.2",
|
|
29
29
|
"text-mask-core": "^5.1.2",
|
|
30
30
|
"tippy.js": "^6.3.1"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "fefd40197784db6665d8f74c358931cc5e8becaf"
|
|
33
33
|
}
|
|
@@ -18,24 +18,40 @@ This will work only when `track_height` is set to `true`
|
|
|
18
18
|
- `<slot name="default" />` - Used to display content
|
|
19
19
|
|
|
20
20
|
-->
|
|
21
|
-
|
|
22
|
-
bind:clientHeight={_height}
|
|
23
|
-
class="sliding-pane {v_center ? 'v-centered' : ''} {h_center
|
|
24
|
-
? 'h-centered'
|
|
25
|
-
: ''} {active ? 'is-active' : ''} {klass}"
|
|
26
|
-
{style}>
|
|
21
|
+
{#if hasResizeObserver}
|
|
27
22
|
<div
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
? 'h-centered'
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
class="sliding-pane with-resize-observer {v_center
|
|
24
|
+
? 'v-centered'
|
|
25
|
+
: ''} {h_center ? 'h-centered' : ''} {active ? 'is-active' : ''} {klass}"
|
|
26
|
+
{style}>
|
|
27
|
+
<div
|
|
28
|
+
bind:this={slideInner}
|
|
29
|
+
class="sliding-pane-inner {v_center ? 'v-centered' : ''} {h_center
|
|
30
|
+
? 'h-centered'
|
|
31
|
+
: ''}">
|
|
32
|
+
<!--Used to display content--><slot />
|
|
33
|
+
</div>
|
|
33
34
|
</div>
|
|
34
|
-
|
|
35
|
+
{:else}
|
|
36
|
+
<div
|
|
37
|
+
bind:clientHeight={_height}
|
|
38
|
+
class="sliding-pane with-legacy-observer {v_center
|
|
39
|
+
? 'v-centered'
|
|
40
|
+
: ''} {h_center ? 'h-centered' : ''} {active ? 'is-active' : ''} {klass}"
|
|
41
|
+
{style}>
|
|
42
|
+
<div
|
|
43
|
+
bind:this={slideInner}
|
|
44
|
+
class="sliding-pane-inner {v_center ? 'v-centered' : ''} {h_center
|
|
45
|
+
? 'h-centered'
|
|
46
|
+
: ''}">
|
|
47
|
+
<!--Used to display content--><slot />
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
{/if}
|
|
35
51
|
|
|
36
52
|
<script>
|
|
37
53
|
import { onMount, createEventDispatcher } from "svelte";
|
|
38
|
-
import {
|
|
54
|
+
import { debounce } from "@kws3/ui/utils";
|
|
39
55
|
|
|
40
56
|
const fire = createEventDispatcher();
|
|
41
57
|
|
|
@@ -60,7 +76,8 @@ This will work only when `track_height` is set to `true`
|
|
|
60
76
|
*/
|
|
61
77
|
track_height = true;
|
|
62
78
|
|
|
63
|
-
|
|
79
|
+
const hasResizeObserver = typeof window.ResizeObserver != "undefined";
|
|
80
|
+
let _height, slideInner, Observer;
|
|
64
81
|
|
|
65
82
|
/**
|
|
66
83
|
* CSS classes for the panel
|
|
@@ -68,15 +85,9 @@ This will work only when `track_height` is set to `true`
|
|
|
68
85
|
let klass = "";
|
|
69
86
|
export { klass as class };
|
|
70
87
|
|
|
71
|
-
onMount(() => {
|
|
72
|
-
pollForRender();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
88
|
$: {
|
|
76
89
|
if (active && track_height && (active || _height)) {
|
|
77
|
-
|
|
78
|
-
fireSizeChange();
|
|
79
|
-
});
|
|
90
|
+
fireSizeChange();
|
|
80
91
|
}
|
|
81
92
|
}
|
|
82
93
|
|
|
@@ -86,11 +97,12 @@ This will work only when `track_height` is set to `true`
|
|
|
86
97
|
} else {
|
|
87
98
|
setTimeout(() => {
|
|
88
99
|
pollForRender();
|
|
89
|
-
},
|
|
100
|
+
}, 50);
|
|
90
101
|
}
|
|
91
102
|
}
|
|
92
103
|
|
|
93
104
|
function init() {
|
|
105
|
+
setupResizeObserver();
|
|
94
106
|
fireSizeChange();
|
|
95
107
|
}
|
|
96
108
|
|
|
@@ -99,21 +111,41 @@ This will work only when `track_height` is set to `true`
|
|
|
99
111
|
if (!slideInner || typeof slideInner == "undefined") {
|
|
100
112
|
pollForRender();
|
|
101
113
|
} else {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
fire("heightChange", { height: new_height });
|
|
115
|
-
});
|
|
114
|
+
if (!slideInner || typeof slideInner == "undefined") {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
var h1 = slideInner.scrollHeight,
|
|
118
|
+
h2 = slideInner.clientHeight;
|
|
119
|
+
var new_height = Math.max(h1, h2);
|
|
120
|
+
/**
|
|
121
|
+
* Event fired when the height of the pane changes
|
|
122
|
+
*
|
|
123
|
+
* This will work only when `track_height` is set to `true`
|
|
124
|
+
*/
|
|
125
|
+
fire("heightChange", { height: new_height });
|
|
116
126
|
}
|
|
117
127
|
}
|
|
118
128
|
}
|
|
129
|
+
|
|
130
|
+
const debouncedFireSizeChange = debounce(fireSizeChange, 150, false);
|
|
131
|
+
|
|
132
|
+
const setupResizeObserver = () => {
|
|
133
|
+
if (hasResizeObserver) {
|
|
134
|
+
if (!slideInner || typeof slideInner == "undefined") {
|
|
135
|
+
pollForRender();
|
|
136
|
+
} else {
|
|
137
|
+
Observer = new ResizeObserver(() => {
|
|
138
|
+
debouncedFireSizeChange();
|
|
139
|
+
});
|
|
140
|
+
Observer.observe(slideInner);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
onMount(() => {
|
|
146
|
+
pollForRender();
|
|
147
|
+
return () => {
|
|
148
|
+
Observer && Observer.disconnect();
|
|
149
|
+
};
|
|
150
|
+
});
|
|
119
151
|
</script>
|