x4js 2.2.69 → 2.2.70

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "2.2.69",
3
+ "version": "2.2.70",
4
4
  "type": "module",
5
5
  "main": "src/x4.ts",
6
6
  "module": "src/x4.ts",
@@ -17,7 +17,7 @@
17
17
  @use "../shared.scss";
18
18
 
19
19
  :root {
20
- --menu-background: var( --background-ternary );
20
+ --menu-background: white;
21
21
  --menu-border: var( --border-hover );
22
22
 
23
23
  --menuitem-color: var( --text-ternary );;
@@ -172,22 +172,35 @@ export class Menu extends Popup {
172
172
 
173
173
  this.addClass( "x4vbox" );
174
174
 
175
- const children = props.items?.map( itm => {
176
- if( itm==="-" ) {
177
- return new CMenuSep( );
178
- }
179
- else if( isString(itm) ) {
180
- return new CMenuItem( { text: itm, click: null, cls: 'title' } );
181
- }
182
- else if( itm instanceof Component ) {
183
- return itm;
175
+ if( props.items ) {
176
+ let children = props.items.filter( x=> !!x);
177
+
178
+ // trim separators
179
+ while( children.at(0)=='-' ) {
180
+ children.shift( );
184
181
  }
185
- else {
186
- return new CMenuItem( itm );
182
+
183
+ while( children.at(-1)=='-' ) {
184
+ children.pop( );
187
185
  }
188
- });
189
186
 
190
- this.setContent( children );
187
+ const items = children.map( itm => {
188
+ if( itm==="-" ) {
189
+ return new CMenuSep( );
190
+ }
191
+ else if( isString(itm) ) {
192
+ return new CMenuItem( { text: itm, click: null, cls: 'title' } );
193
+ }
194
+ else if( itm instanceof Component ) {
195
+ return itm;
196
+ }
197
+ else {
198
+ return new CMenuItem( itm );
199
+ }
200
+ });
201
+
202
+ this.setContent( items );
203
+ }
191
204
  }
192
205
  }
193
206