@open-rlb/ng-bootstrap 3.3.19 → 3.3.21

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,14 +1,30 @@
1
1
  {
2
2
  "name": "@open-rlb/ng-bootstrap",
3
- "version": "3.3.19",
3
+ "version": "3.3.21",
4
4
  "peerDependencies": {
5
+ "@angular/cdk": "^21.0.0",
6
+ "@angular/common": "^21.0.0",
7
+ "@angular/core": "^21.0.0",
8
+ "@angular/forms": "^21.0.0",
9
+ "@angular/router": "^21.0.0",
10
+ "@ngx-translate/core": "^16.0.0",
11
+ "@open-rlb/date-tz": ">=2.1.1",
5
12
  "bootstrap": ">=5.3.0",
6
- "@types/bootstrap": ">5.2.0",
7
- "@open-rlb/date-tz": ">=2.1.1"
13
+ "@types/bootstrap": ">=5.2.0",
14
+ "rxjs": "^7.8.0"
15
+ },
16
+ "peerDependenciesMeta": {
17
+ "@types/bootstrap": {
18
+ "optional": true
19
+ }
8
20
  },
9
21
  "dependencies": {
10
22
  "tslib": ">=2.3.0"
11
23
  },
24
+ "schematics": "./schematics/collection.json",
25
+ "ng-add": {
26
+ "save": "dependencies"
27
+ },
12
28
  "sideEffects": false,
13
29
  "module": "fesm2022/open-rlb-ng-bootstrap.mjs",
14
30
  "typings": "types/open-rlb-ng-bootstrap.d.ts",
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "../../../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "ng-add": {
5
+ "description": "Add @open-rlb/ng-bootstrap to an Angular project: install peer dependencies, register Bootstrap styles, wire up provideRlbBootstrap(), and scaffold a starter component.",
6
+ "factory": "./ng-add/index#ngAdd",
7
+ "schema": "./ng-add/schema.json"
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,7 @@
1
+ <rlb-card>
2
+ <rlb-card-header>@open-rlb/ng-bootstrap is ready 🎉</rlb-card-header>
3
+ <rlb-card-body>
4
+ <p class="mb-3">You clicked the button {{ clicks() }} times.</p>
5
+ <button rlb-button color="primary" (click)="increment()">Click me</button>
6
+ </rlb-card-body>
7
+ </rlb-card>
@@ -0,0 +1,25 @@
1
+ import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
2
+ import {
3
+ ButtonComponent,
4
+ CardBodyComponent,
5
+ CardComponent,
6
+ CardHeaderComponent,
7
+ } from '@open-rlb/ng-bootstrap';
8
+
9
+ /**
10
+ * Starter component generated by `ng add @open-rlb/ng-bootstrap`.
11
+ * Render `<app-rlb-starter />` (or route to it) to confirm the library works.
12
+ */
13
+ @Component({
14
+ selector: 'app-rlb-starter',
15
+ changeDetection: ChangeDetectionStrategy.OnPush,
16
+ imports: [CardComponent, CardHeaderComponent, CardBodyComponent, ButtonComponent],
17
+ templateUrl: './rlb-starter.component.html',
18
+ })
19
+ export class RlbStarterComponent {
20
+ clicks = signal(0);
21
+
22
+ increment(): void {
23
+ this.clicks.update(n => n + 1);
24
+ }
25
+ }
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngAdd = ngAdd;
4
+ const core_1 = require("@angular-devkit/core");
5
+ const schematics_1 = require("@angular-devkit/schematics");
6
+ const utility_1 = require("@schematics/angular/utility");
7
+ /**
8
+ * Dependencies the library needs at the consumer side. `@angular/{core,common,forms,router}`
9
+ * and `rxjs` are intentionally omitted: every Angular app already provides them.
10
+ */
11
+ const DEPENDENCIES = [
12
+ { name: '@open-rlb/date-tz', version: '^2.1.1', type: utility_1.DependencyType.Default },
13
+ { name: '@ngx-translate/core', version: '^16.0.0', type: utility_1.DependencyType.Default },
14
+ { name: '@angular/cdk', version: '^21.0.0', type: utility_1.DependencyType.Default },
15
+ { name: 'bootstrap', version: '^5.3.0', type: utility_1.DependencyType.Default },
16
+ { name: 'bootstrap-icons', version: '^1.11.0', type: utility_1.DependencyType.Default },
17
+ { name: '@types/bootstrap', version: '^5.2.0', type: utility_1.DependencyType.Dev },
18
+ ];
19
+ /** Global styles required for the Bootstrap look & feel. */
20
+ const STYLE_PATHS = [
21
+ 'node_modules/bootstrap/dist/css/bootstrap.min.css',
22
+ 'node_modules/bootstrap-icons/font/bootstrap-icons.css',
23
+ ];
24
+ function ngAdd(options) {
25
+ return async (tree, _context) => {
26
+ const project = await resolveProject(tree, options.project);
27
+ return (0, schematics_1.chain)([
28
+ // 1. Install dependencies (a single npm install is scheduled automatically).
29
+ ...DEPENDENCIES.map(dep => (0, utility_1.addDependency)(dep.name, dep.version, { type: dep.type })),
30
+ // 2. Register Bootstrap + Bootstrap Icons global styles in angular.json.
31
+ addBootstrapStyles(project),
32
+ // 3. Wire up the library providers (modals/toasts registry, etc.).
33
+ (0, utility_1.addRootProvider)(project, ({ code, external }) => code `${external('provideRlbBootstrap', '@open-rlb/ng-bootstrap')}()`),
34
+ // 4. Optionally scaffold a starter component.
35
+ options.skipStarter ? noop : scaffoldStarter(tree, project),
36
+ // 5. Print next steps.
37
+ logNextSteps(project, options.skipStarter),
38
+ ]);
39
+ };
40
+ }
41
+ /** Resolves the target project: the provided name, else the first application, else the first project. */
42
+ async function resolveProject(tree, name) {
43
+ const workspace = await (0, utility_1.readWorkspace)(tree);
44
+ if (name) {
45
+ if (!workspace.projects.has(name)) {
46
+ throw new schematics_1.SchematicsException(`Project "${name}" was not found in the workspace.`);
47
+ }
48
+ return name;
49
+ }
50
+ for (const [projectName, project] of workspace.projects) {
51
+ if (project.extensions['projectType'] === 'application') {
52
+ return projectName;
53
+ }
54
+ }
55
+ const first = workspace.projects.keys().next().value;
56
+ if (!first) {
57
+ throw new schematics_1.SchematicsException('No project found in the workspace to add @open-rlb/ng-bootstrap to.');
58
+ }
59
+ return first;
60
+ }
61
+ function addBootstrapStyles(project) {
62
+ return (0, utility_1.updateWorkspace)(workspace => {
63
+ const target = workspace.projects.get(project)?.targets.get('build');
64
+ if (!target) {
65
+ return;
66
+ }
67
+ target.options ??= {};
68
+ const styles = target.options['styles'] ?? [];
69
+ for (const style of STYLE_PATHS) {
70
+ const present = styles.some(s => (typeof s === 'string' ? s : s.input) === style);
71
+ if (!present) {
72
+ styles.unshift(style);
73
+ }
74
+ }
75
+ target.options['styles'] = styles;
76
+ });
77
+ }
78
+ function scaffoldStarter(tree, project) {
79
+ return async () => {
80
+ const workspace = await (0, utility_1.readWorkspace)(tree);
81
+ const def = workspace.projects.get(project);
82
+ const sourceRoot = def?.sourceRoot ?? (def ? `${def.root}/src` : 'src');
83
+ const templates = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
84
+ (0, schematics_1.applyTemplates)({ ...core_1.strings }),
85
+ (0, schematics_1.move)(`${sourceRoot}/app/rlb-starter`),
86
+ ]);
87
+ // Skip silently if the files already exist (idempotent re-runs).
88
+ return (0, schematics_1.mergeWith)(templates, schematics_1.MergeStrategy.Default);
89
+ };
90
+ }
91
+ function logNextSteps(project, skipStarter) {
92
+ return (_tree, context) => {
93
+ const log = context.logger;
94
+ log.info('');
95
+ log.info('✅ @open-rlb/ng-bootstrap added successfully.');
96
+ log.info(` • Dependencies installed and added to package.json`);
97
+ log.info(` • Bootstrap + Bootstrap Icons styles registered in angular.json`);
98
+ log.info(` • provideRlbBootstrap() wired into the "${project}" app providers`);
99
+ if (!skipStarter) {
100
+ log.info(' • Starter component generated at src/app/rlb-starter/');
101
+ log.info(' Render it to verify the setup, e.g. add <app-rlb-starter /> to a template.');
102
+ }
103
+ log.info('');
104
+ };
105
+ }
106
+ /** A no-op rule. */
107
+ const noop = tree => tree;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "OpenRlbNgBootstrapNgAdd",
4
+ "title": "@open-rlb/ng-bootstrap ng-add schematic",
5
+ "type": "object",
6
+ "properties": {
7
+ "project": {
8
+ "type": "string",
9
+ "description": "The name of the project to add the library to.",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ }
13
+ },
14
+ "skipStarter": {
15
+ "type": "boolean",
16
+ "default": false,
17
+ "description": "Do not scaffold the RlbStarterComponent example."
18
+ }
19
+ },
20
+ "required": []
21
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -196,10 +196,13 @@ declare class PaginationItemComponent implements OnInit {
196
196
  disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
197
197
  active: _angular_core.InputSignalWithTransform<boolean, unknown>;
198
198
  cssClass: _angular_core.InputSignal<string>;
199
+ itemClick: _angular_core.OutputEmitterRef<void>;
199
200
  constructor(viewContainerRef: ViewContainerRef);
201
+ onActivate(event: Event): void;
202
+ onKeydown(event: KeyboardEvent): void;
200
203
  ngOnInit(): void;
201
204
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<PaginationItemComponent, never>;
202
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<PaginationItemComponent, "rlb-pagination-item", never, { "isIcon": { "alias": "isIcon"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "active": { "alias": "active"; "required": false; "isSignal": true; }; "cssClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
205
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<PaginationItemComponent, "rlb-pagination-item", never, { "isIcon": { "alias": "isIcon"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "active": { "alias": "active"; "required": false; "isSignal": true; }; "cssClass": { "alias": "class"; "required": false; "isSignal": true; }; }, { "itemClick": "itemClick"; }, never, ["*"], true, never>;
203
206
  }
204
207
 
205
208
  declare class PaginationComponent implements OnInit {