@kws3/ui 1.7.1 → 1.7.2
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 +5 -2
- package/datagrid/Pagination/Pagination.svelte +12 -8
- package/forms/actions.js +10 -8
- package/package.json +2 -2
package/CHANGELOG.mdx
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 1.7.2
|
|
2
|
+
- `DatePicker` component: fix initialisation bug on mobile
|
|
3
|
+
- `Pagination` component: rename property `breakThreshold` -> `maxVisiblePages` plus bugfix and documentation update
|
|
4
|
+
|
|
1
5
|
## 1.7.1
|
|
2
6
|
- `Skeleton` component: Illustrate in example the use of empty string for `color` prop.
|
|
3
7
|
- `Pagination` component: Deprecate `meta` prop. And use separate props for `offset`, `limit`, `count` and `total` instead.
|
|
@@ -6,9 +10,8 @@
|
|
|
6
10
|
- `Modal` component can now be opened and closed programatically via `open()` and `close()` methods.
|
|
7
11
|
- Added linting rules for ESLint. And corrected all resulting issues.
|
|
8
12
|
|
|
9
|
-
|
|
10
13
|
## 1.7.0
|
|
11
|
-
- Ensure uniform usage of
|
|
14
|
+
- 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
15
|
- `DataSearch` component: Expand filters to fill area when main search input is not present.
|
|
13
16
|
- `DataSort` component: Increase click area for activating dropdown, and provide visual segementation between label and dropdown.
|
|
14
17
|
- New `Skeleton` component.
|
|
@@ -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.2",
|
|
4
4
|
"description": "UI components for use with Svelte v3 applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"text-mask-core": "^5.1.2",
|
|
30
30
|
"tippy.js": "^6.3.1"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "227e2a0e081adad79a4a46096d1f846bd307d6e3"
|
|
33
33
|
}
|