@memberjunction/ng-tabstrip 2.42.1 → 2.44.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/README.md +112 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ A lightweight and flexible Angular tab strip component for MemberJunction applic
|
|
|
14
14
|
- **Dynamic Content**: Support for dynamically changing tab content
|
|
15
15
|
- **Customizable**: Configure tab appearance and behavior
|
|
16
16
|
- **Lightweight**: Minimal dependencies and overhead
|
|
17
|
+
- **Tab Visibility**: Hide/show tabs dynamically
|
|
18
|
+
- **Fill Container**: Optional width/height fill of parent container
|
|
17
19
|
|
|
18
20
|
## Installation
|
|
19
21
|
|
|
@@ -223,13 +225,13 @@ The main component that contains and manages the tabs.
|
|
|
223
225
|
|
|
224
226
|
#### Methods
|
|
225
227
|
|
|
226
|
-
- `SelectTabByName(tabName: string)
|
|
227
|
-
- `GetTabByName(tabName: string)
|
|
228
|
-
- `CloseTab(tabIndex: number)
|
|
229
|
-
- `scrollLeft()
|
|
230
|
-
- `scrollRight()
|
|
231
|
-
- `scrollIntoView(tabIndex: number)
|
|
232
|
-
- `RefreshTabs()
|
|
228
|
+
- `SelectTabByName(tabName: string): MJTabComponent | undefined` - Selects a tab by its name and returns the tab if found
|
|
229
|
+
- `GetTabByName(tabName: string): MJTabComponent | undefined` - Gets a tab component by its name
|
|
230
|
+
- `CloseTab(tabIndex: number): Promise<void>` - Closes a tab by its index (async)
|
|
231
|
+
- `scrollLeft(): void` - Scrolls the tab strip to the left by 150 pixels (note: currently ignores ScrollAmount input)
|
|
232
|
+
- `scrollRight(): void` - Scrolls the tab strip to the right by 150 pixels (note: currently ignores ScrollAmount input)
|
|
233
|
+
- `scrollIntoView(tabIndex: number): void` - Scrolls to make a specific tab visible
|
|
234
|
+
- `RefreshTabs(): void` - Refreshes the tab strip after dynamic changes
|
|
233
235
|
|
|
234
236
|
#### Properties
|
|
235
237
|
|
|
@@ -251,8 +253,13 @@ Represents a tab header in the tab strip.
|
|
|
251
253
|
|
|
252
254
|
#### Methods
|
|
253
255
|
|
|
254
|
-
- `selectTab()
|
|
255
|
-
- `closeTab(event: MouseEvent)
|
|
256
|
+
- `selectTab(): void` - Selects this tab
|
|
257
|
+
- `closeTab(event: MouseEvent): void` - Closes this tab
|
|
258
|
+
- `handleContextMenu(event: MouseEvent): void` - Handles context menu events
|
|
259
|
+
|
|
260
|
+
#### Properties
|
|
261
|
+
|
|
262
|
+
- `TabStrip`: MJTabStripComponent - Reference to the parent tab strip component
|
|
256
263
|
|
|
257
264
|
### MJTabBodyComponent
|
|
258
265
|
|
|
@@ -296,10 +303,104 @@ Event type for context menu events.
|
|
|
296
303
|
- All properties from TabEvent
|
|
297
304
|
- `mouseEvent`: MouseEvent - The original mouse event
|
|
298
305
|
|
|
306
|
+
## Advanced Usage
|
|
307
|
+
|
|
308
|
+
### Tab Visibility Management
|
|
309
|
+
|
|
310
|
+
You can dynamically hide/show tabs while maintaining their state:
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
// Hide a tab
|
|
314
|
+
const tab = this.tabStrip.GetTabByName('settings');
|
|
315
|
+
if (tab) {
|
|
316
|
+
tab.Visible = false; // Tab will be hidden but not removed
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Show it again
|
|
320
|
+
tab.Visible = true;
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Note: Hidden tabs cannot be selected. If a selected tab is hidden, the tab strip will automatically select the first visible tab.
|
|
324
|
+
|
|
325
|
+
### Programmatic Tab Management
|
|
326
|
+
|
|
327
|
+
```typescript
|
|
328
|
+
@ViewChild('tabStrip') tabStrip!: MJTabStripComponent;
|
|
329
|
+
|
|
330
|
+
// Select a specific tab
|
|
331
|
+
this.tabStrip.SelectedTabIndex = 2;
|
|
332
|
+
|
|
333
|
+
// Or by name
|
|
334
|
+
this.tabStrip.SelectTabByName('reports');
|
|
335
|
+
|
|
336
|
+
// Close a tab programmatically
|
|
337
|
+
await this.tabStrip.CloseTab(1);
|
|
338
|
+
|
|
339
|
+
// Ensure a tab is visible in the viewport
|
|
340
|
+
this.tabStrip.scrollIntoView(5);
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Error Handling
|
|
344
|
+
|
|
345
|
+
The component throws errors in these scenarios:
|
|
346
|
+
|
|
347
|
+
- Attempting to select a non-visible tab
|
|
348
|
+
- Invalid tab index in CloseTab method
|
|
349
|
+
- Selecting a tab by name that doesn't exist (returns undefined)
|
|
350
|
+
|
|
351
|
+
Always check for tab existence when working with dynamic tabs:
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
const tab = this.tabStrip.SelectTabByName('dynamicTab');
|
|
355
|
+
if (!tab) {
|
|
356
|
+
console.error('Tab not found');
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
299
360
|
## Styling
|
|
300
361
|
|
|
301
|
-
The component includes basic CSS that can be customized to match your application's design.
|
|
362
|
+
The component includes basic CSS that can be customized to match your application's design. The tab strip uses Font Awesome icons for the scroll buttons (fa-caret-left and fa-caret-right).
|
|
363
|
+
|
|
364
|
+
### CSS Classes
|
|
365
|
+
|
|
366
|
+
- `.tabstrip-container` - Main container element
|
|
367
|
+
- `.tab-header-outer` - Outer container for tab headers
|
|
368
|
+
- `.tab-header-inner` - Inner scrollable container for tabs
|
|
369
|
+
- `.tab-scroll-button` - Base class for scroll buttons
|
|
370
|
+
- `.tab-scroll-button-left` - Left scroll button
|
|
371
|
+
- `.tab-scroll-button-right` - Right scroll button
|
|
372
|
+
- `.tab-bodies` - Container for tab content
|
|
302
373
|
|
|
303
374
|
## Dependencies
|
|
304
375
|
|
|
305
|
-
- `@
|
|
376
|
+
- `@angular/common`: ^18.0.2
|
|
377
|
+
- `@angular/core`: ^18.0.2
|
|
378
|
+
- `@memberjunction/ng-container-directives`: For container directives
|
|
379
|
+
- `tslib`: ^2.3.0
|
|
380
|
+
|
|
381
|
+
## Build and Development
|
|
382
|
+
|
|
383
|
+
This package uses Angular CLI for building:
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
npm run build
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
The package is configured with:
|
|
390
|
+
- TypeScript compilation via `ngc`
|
|
391
|
+
- No side effects for better tree-shaking
|
|
392
|
+
- Proper peer dependencies for Angular 18.x
|
|
393
|
+
|
|
394
|
+
## Integration with MemberJunction
|
|
395
|
+
|
|
396
|
+
This tab strip component is designed to work seamlessly with other MemberJunction packages and follows the same patterns and conventions used throughout the MJ ecosystem. It's particularly useful in:
|
|
397
|
+
|
|
398
|
+
- MJ Explorer application
|
|
399
|
+
- Dashboard interfaces
|
|
400
|
+
- Multi-view forms
|
|
401
|
+
- Configuration screens
|
|
402
|
+
- Any interface requiring tabbed navigation
|
|
403
|
+
|
|
404
|
+
## License
|
|
405
|
+
|
|
406
|
+
ISC
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-tabstrip",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.44.0",
|
|
4
4
|
"description": "MemberJunction: Very simple tab strip component used in the MJ Explorer app and reusable anywhere else in an Angular project.",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@angular/core": "18.0.2"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@memberjunction/ng-container-directives": "2.
|
|
26
|
+
"@memberjunction/ng-container-directives": "2.44.0",
|
|
27
27
|
"tslib": "^2.3.0"
|
|
28
28
|
},
|
|
29
29
|
"sideEffects": false
|