@neovici/cosmoz-bottom-bar 7.5.0 → 8.0.0
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/cosmoz-bottom-bar.js +18 -13
- package/package.json +5 -4
package/cosmoz-bottom-bar.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable max-lines */
|
|
2
1
|
import {
|
|
3
2
|
PolymerElement,
|
|
4
3
|
html as polymerHtml,
|
|
@@ -7,10 +6,9 @@ import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nod
|
|
|
7
6
|
import { Debouncer } from '@polymer/polymer/lib/utils/debounce.js';
|
|
8
7
|
import { timeOut } from '@polymer/polymer/lib/utils/async';
|
|
9
8
|
import { html } from 'lit-html';
|
|
9
|
+
import { hauntedPolymer } from '@neovici/cosmoz-utils';
|
|
10
10
|
import { useActivity } from '@neovici/cosmoz-utils/keybindings/use-activity';
|
|
11
|
-
import { defaultPlacement } from '@neovici/cosmoz-dropdown';
|
|
12
11
|
import template from './cosmoz-bottom-bar.html.js';
|
|
13
|
-
import { hauntedPolymer } from '@neovici/cosmoz-utils';
|
|
14
12
|
|
|
15
13
|
const BOTTOM_BAR_TOOLBAR_SLOT = 'bottom-bar-toolbar',
|
|
16
14
|
BOTTOM_BAR_MENU_SLOT = 'bottom-bar-menu',
|
|
@@ -63,11 +61,9 @@ const openActionsMenu = (host) => {
|
|
|
63
61
|
*/
|
|
64
62
|
class CosmozBottomBar extends hauntedPolymer(useBottomBar)(PolymerElement) {
|
|
65
63
|
static get template() {
|
|
66
|
-
// eslint-disable-line max-lines-per-function
|
|
67
64
|
return template;
|
|
68
65
|
}
|
|
69
66
|
|
|
70
|
-
// eslint-disable-next-line max-lines-per-function
|
|
71
67
|
static get properties() {
|
|
72
68
|
return {
|
|
73
69
|
/**
|
|
@@ -191,7 +187,8 @@ class CosmozBottomBar extends hauntedPolymer(useBottomBar)(PolymerElement) {
|
|
|
191
187
|
},
|
|
192
188
|
|
|
193
189
|
topPlacement: {
|
|
194
|
-
value:
|
|
190
|
+
value: 'top-end',
|
|
191
|
+
type: String,
|
|
195
192
|
},
|
|
196
193
|
};
|
|
197
194
|
}
|
|
@@ -241,7 +238,7 @@ class CosmozBottomBar extends hauntedPolymer(useBottomBar)(PolymerElement) {
|
|
|
241
238
|
[...this._nodeObservers, this._hiddenMutationObserver].forEach((e) =>
|
|
242
239
|
e.disconnect(e),
|
|
243
240
|
);
|
|
244
|
-
this._layoutDebouncer?.cancel();
|
|
241
|
+
this._layoutDebouncer?.cancel();
|
|
245
242
|
this._resizeObserver.unobserve(this);
|
|
246
243
|
}
|
|
247
244
|
|
|
@@ -336,6 +333,18 @@ class CosmozBottomBar extends hauntedPolymer(useBottomBar)(PolymerElement) {
|
|
|
336
333
|
...elements.filter((e) => e !== topPriorityAction),
|
|
337
334
|
];
|
|
338
335
|
}
|
|
336
|
+
|
|
337
|
+
_distribute(hostWidth) {
|
|
338
|
+
const elements = this._getElements();
|
|
339
|
+
|
|
340
|
+
const tooNarrow = hostWidth <= 480,
|
|
341
|
+
toolbarElements = elements.slice(0, tooNarrow ? 0 : this.maxToolbarItems),
|
|
342
|
+
menuElements = elements.slice(toolbarElements.length);
|
|
343
|
+
toolbarElements.forEach((el) => this._moveElement(el, true));
|
|
344
|
+
menuElements.forEach((el) => this._moveElement(el));
|
|
345
|
+
this._setHasMenuItems(menuElements.length > 0);
|
|
346
|
+
}
|
|
347
|
+
|
|
339
348
|
/**
|
|
340
349
|
* Layout the actions available as buttons or menu items
|
|
341
350
|
*
|
|
@@ -357,7 +366,6 @@ class CosmozBottomBar extends hauntedPolymer(useBottomBar)(PolymerElement) {
|
|
|
357
366
|
* @returns {void}
|
|
358
367
|
*/
|
|
359
368
|
_layoutActions() {
|
|
360
|
-
// eslint-disable-line max-statements
|
|
361
369
|
const elements = this._getElements(),
|
|
362
370
|
hasActions = elements.length > 0 || this.hasExtraItems;
|
|
363
371
|
this._setHasActions(hasActions);
|
|
@@ -367,11 +375,7 @@ class CosmozBottomBar extends hauntedPolymer(useBottomBar)(PolymerElement) {
|
|
|
367
375
|
return this._setHasMenuItems(false);
|
|
368
376
|
}
|
|
369
377
|
|
|
370
|
-
|
|
371
|
-
menuElements = elements.slice(toolbarElements.length);
|
|
372
|
-
toolbarElements.forEach((el) => this._moveElement(el, true));
|
|
373
|
-
menuElements.forEach((el) => this._moveElement(el));
|
|
374
|
-
this._setHasMenuItems(menuElements.length > 0);
|
|
378
|
+
this._distribute(this.getBoundingClientRect().width);
|
|
375
379
|
}
|
|
376
380
|
|
|
377
381
|
_moveElement(element, toToolbar) {
|
|
@@ -395,6 +399,7 @@ class CosmozBottomBar extends hauntedPolymer(useBottomBar)(PolymerElement) {
|
|
|
395
399
|
this._matchHeightElement,
|
|
396
400
|
this.barHeight,
|
|
397
401
|
);
|
|
402
|
+
this._distribute(entry.contentRect?.width);
|
|
398
403
|
}
|
|
399
404
|
|
|
400
405
|
_showHideBottomBar(visible) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neovici/cosmoz-bottom-bar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "A responsive bottom-bar that can house buttons/actions and a menu for the buttons that won't fit the available width.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"polymer",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@neovici/cosmoz-collapse": "^1.5.0",
|
|
63
|
-
"@neovici/cosmoz-dropdown": "^4.0.0",
|
|
63
|
+
"@neovici/cosmoz-dropdown": "^4.0.0 || ^5.0.0",
|
|
64
64
|
"@neovici/cosmoz-utils": "^6.13.1",
|
|
65
65
|
"@pionjs/pion": "^2.5.2",
|
|
66
66
|
"@polymer/polymer": "^3.3.0",
|
|
@@ -86,12 +86,13 @@
|
|
|
86
86
|
"@web/storybook-builder": "^0.1.9",
|
|
87
87
|
"@web/storybook-framework-web-components": "^0.1.1",
|
|
88
88
|
"@webcomponents/webcomponentsjs": "^2.5.0",
|
|
89
|
-
"esbuild": "^0.
|
|
89
|
+
"esbuild": "^0.24.0",
|
|
90
|
+
"eslint": "^8.57.1",
|
|
90
91
|
"http-server": "^14.1.1",
|
|
91
92
|
"husky": "^9.1.1",
|
|
92
93
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
93
94
|
"semantic-release": "^24.0.0",
|
|
94
|
-
"sinon": "^
|
|
95
|
+
"sinon": "^19.0.0",
|
|
95
96
|
"storybook": "^7.6.17",
|
|
96
97
|
"typescript": "^5.0.0"
|
|
97
98
|
}
|