@mckit/schematics 0.0.14 → 0.0.18

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": "@mckit/schematics",
3
- "version": "0.0.14",
3
+ "version": "0.0.18",
4
4
  "description": "A blank schematics",
5
5
  "scripts": {
6
6
  "build": "tsc -p tsconfig.json",
@@ -13,8 +13,8 @@
13
13
  "license": "MIT",
14
14
  "schematics": "./src/collection.json",
15
15
  "dependencies": {
16
- "@angular-devkit/core": "^18.2.6",
17
- "@angular-devkit/schematics": "^18.2.6",
16
+ "@angular-devkit/core": "^20.0.0",
17
+ "@angular-devkit/schematics": "^20.0.0",
18
18
  "typescript": "~5.5.2"
19
19
  },
20
20
  "devDependencies": {
@@ -22,4 +22,4 @@
22
22
  "@types/jasmine": "~5.1.0",
23
23
  "jasmine": "^5.0.0"
24
24
  }
25
- }
25
+ }
@@ -68,7 +68,7 @@ import { environment } from '../environments/environment';`, importEndPosition +
68
68
  function addLoginPage(_options) {
69
69
  return (tree, _context) => {
70
70
  // Install the required dependencies
71
- (0, run_command_1.runCommand)('npm install --save @ngx-pwa/local-storage@19 @mckit/auth', _context);
71
+ (0, run_command_1.runCommand)('npm install --save @ngx-pwa/local-storage@20 @mckit/auth', _context);
72
72
  // Generate environments
73
73
  (0, run_command_1.runCommand)('ng g environments', _context);
74
74
  // Config SCSS
@@ -7,6 +7,8 @@
7
7
  [columns]="columns"
8
8
  [searchFieldsKey]="searchFieldsKey" >
9
9
 
10
+ <ng-template mcThTemplate="actions"></ng-template>
11
+
10
12
  <ng-template mcTdTemplate="actions" let-row>
11
13
  <mc-actions-column [item]="row" (onEdit)="onClickEdit($event)" (onRemove)="onClickRemove($event)"></mc-actions-column>
12
14
  </ng-template>
@@ -11,7 +11,7 @@ import { MCActionsColumn, MCTdTemplateDirective, MCThTemplateDirective } from '@
11
11
  templateUrl: './{{className}}.component.html',
12
12
  styleUrl: './{{className}}.component.scss'
13
13
  })
14
- export class {{classNameCamel}} implements OnInit {
14
+ export class {{classNameCamel}} {
15
15
 
16
16
  odataPage = viewChild(MCOdataPage);
17
17
 
@@ -21,6 +21,10 @@
21
21
  "description": "Add Table",
22
22
  "factory": "./add-table/index#addTable",
23
23
  "schema": "./add-table/schema.json"
24
+ },
25
+ "set-tenant-backend": {
26
+ "description": "Set multi tenant backend",
27
+ "factory": "./set-tenant-backend/index#install"
24
28
  }
25
29
  }
26
30
  }
@@ -1,6 +1,7 @@
1
1
  import { Tree } from '@angular-devkit/schematics';
2
2
  export interface ClassData {
3
3
  name: string;
4
+ path: string;
4
5
  properties: string[];
5
6
  }
6
- export declare function getPropertiesByClass(tree: Tree, filePath: string): ClassData;
7
+ export declare function getPropertiesByClass(tree: Tree, className: string): ClassData;
@@ -2,29 +2,36 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPropertiesByClass = getPropertiesByClass;
4
4
  const ts = require("typescript");
5
- function getPropertiesByClass(tree, filePath) {
6
- const file = tree.read(filePath);
7
- if (!file) {
8
- throw new Error(`El archivo ${filePath} no existe.`);
9
- }
10
- const fileContent = file.toString('utf-8');
11
- const sourceFile = ts.createSourceFile(filePath, fileContent, ts.ScriptTarget.Latest, true);
12
- let firstClass = null;
13
- ts.forEachChild(sourceFile, (node) => {
14
- if (!firstClass && ts.isClassDeclaration(node) && node.name) {
15
- const className = node.name.text;
16
- const properties = [];
17
- node.members.forEach((member) => {
18
- if (ts.isPropertyDeclaration(member) && member.name) {
19
- properties.push(member.name.getText());
20
- }
21
- });
22
- firstClass = { name: className, properties };
23
- }
5
+ function getPropertiesByClass(tree, className) {
6
+ let classFilePath;
7
+ let properties = [];
8
+ tree.visit((filePath) => {
9
+ if (!filePath.endsWith('.ts'))
10
+ return;
11
+ const file = tree.read(filePath);
12
+ if (!file)
13
+ return;
14
+ const fileContent = file.toString('utf-8');
15
+ const sourceFile = ts.createSourceFile(filePath, fileContent, ts.ScriptTarget.Latest, true);
16
+ ts.forEachChild(sourceFile, (node) => {
17
+ var _a;
18
+ if (ts.isClassDeclaration(node) && ((_a = node.name) === null || _a === void 0 ? void 0 : _a.text) === className) {
19
+ classFilePath = filePath;
20
+ node.members.forEach((member) => {
21
+ if (ts.isPropertyDeclaration(member) && member.name) {
22
+ properties.push(member.name.getText());
23
+ }
24
+ });
25
+ }
26
+ });
24
27
  });
25
- if (firstClass == undefined || firstClass == null) {
26
- throw new Error(`No se encontró ninguna clase en el archivo ${filePath}`);
28
+ if (classFilePath == undefined) {
29
+ throw new Error(`No se encontró la clase ${className} en ningún archivo.`);
27
30
  }
28
- return firstClass;
31
+ return {
32
+ name: className,
33
+ path: classFilePath,
34
+ properties
35
+ };
29
36
  }
30
37
  //# sourceMappingURL=get-properties-by-class.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-properties-by-class.js","sourceRoot":"","sources":["get-properties-by-class.ts"],"names":[],"mappings":";;AAQA,oDAiCC;AAxCD,iCAAiC;AAOjC,SAAgB,oBAAoB,CAAC,IAAU,EAAE,QAAgB;IAE7D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,cAAc,QAAQ,aAAa,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAE3C,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAE5F,IAAI,UAAU,GAAqB,IAAI,CAAC;IAExC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE;QACjC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,I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CAAC,gBAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAE5F,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE;;YACjC,IAAI,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,IAAI,MAAK,SAAS,EAAE,CAAC;gBAC/D,aAAa,GAAG,QAAQ,CAAC;gBAEzB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;oBAC5B,IAAI,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;wBAClD,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;oBAC3C,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,IAAG,aAAa,IAAI,SAAS,EAAC,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,2BAA2B,SAAS,qBAAqB,CAAC,CAAC;IAC/E,CAAC;IAED,OAAO;QACH,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,aAAa;QACnB,UAAU;KACb,CAAC;AACN,CAAC"}
package/src/init/index.js CHANGED
@@ -51,6 +51,7 @@ function processStyles(tree, _context) {
51
51
  // Create string variable with the new content
52
52
  const newContent = `@use "tailwindcss";
53
53
  @use "primeicons/primeicons.css";
54
+ @plugin "tailwindcss-primeui";
54
55
 
55
56
  @source "../node_modules/@mckit/core";
56
57
 
@@ -81,7 +82,7 @@ function processAppConfig(tree, _context) {
81
82
 
82
83
  import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
83
84
  import { providePrimeNG } from 'primeng/config';
84
- import Aura from '@primeng/themes/aura';`, importEndPosition + 1);
85
+ import Aura from '@primeuix/themes/aura';`, importEndPosition + 1);
85
86
  // Search position of the last ]
86
87
  const providerPosition = content.lastIndexOf(']');
87
88
  // Add the new provider after the last provider
@@ -104,7 +105,7 @@ import Aura from '@primeng/themes/aura';`, importEndPosition + 1);
104
105
  function init(_options) {
105
106
  return (tree, _context) => {
106
107
  // Install the required dependencies
107
- runCommand('npm install --save @mckit/core primeng @primeng/themes primeicons @ngx-pwa/local-storage@19', _context);
108
+ runCommand('npm install --save @mckit/core primeng @primeuix/themes primeicons @ngx-pwa/local-storage@20', _context);
108
109
  runCommand('npm install tailwindcss @tailwindcss/postcss postcss --force', _context);
109
110
  runCommand('npm i tailwindcss-primeui --save', _context);
110
111
  // Create .postcssrc.json file from template
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAwHA,oBAsBC;AA7ID,iDAAqC;AACrC,yBAAyB;AACzB,6BAA6B;AAE7B,SAAS,UAAU,CAAC,OAAe,EAAE,QAA0B;IAC7D,IAAA,oBAAI,EAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;QACtC,IAAI,KAAK,EAAE,CAAC;YACV,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACnD,OAAO;QACT,CAAC;QACD,IAAI,MAAM,EAAE,CAAC;YACX,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,MAAM,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,MAAM,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,sBAAsB,CAAC,IAAU,EAAE,QAAgB,EAAE,QAAgB;IAC5E,2BAA2B;IAC3B,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;I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,CAAC,CAAC;QAEzD,4CAA4C;QAC5C,sBAAsB,CAAC,IAAI,EAAE,iBAAiB,EAAE,0BAA0B,CAAC,CAAC;QAE5E,cAAc;QACd,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAE9B,4CAA4C;QAC5C,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,EAAE,6BAA6B,CAAC,CAAC;QAElF,uBAAuB;QACvB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEjC,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,133 @@
1
+ import { Component, DestroyRef, inject } from '@angular/core';
2
+ import { RouterOutlet, Router } from '@angular/router';
3
+ import { MCAuthenticationService, MCAvatarWithMenu } from '@mckit/auth';
4
+ import { MCImage, MCMenu, MCSubtitle } from '@mckit/core';
5
+ import { MCTenant, MCTenantMenu, MCTenantService } from '@mckit/tenant';
6
+ import { MenuItem } from 'primeng/api';
7
+ import { MCFooterService, MCSidebarService, MCTopbarService } from '@mckit/layout-core';
8
+ import { MCIconToggleSidebarButton } from '@mckit/layout';
9
+ import { FooterLayoutComponent } from './shared/components/footer-layout/footer-layout.component';
10
+ import { switchMap, takeWhile, tap } from 'rxjs';
11
+ import { TenantCreateForm } from './features/tenant/modals/tenant-create-form.service';
12
+ import { DialogService } from 'primeng/dynamicdialog';
13
+ import { mcEventFormOperator, MCEventModalForm, MCHttpFormModalService } from '@mckit/form';
14
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
15
+
16
+ @Component({
17
+ selector: 'app-root',
18
+ imports: [RouterOutlet],
19
+ providers: [DialogService, MCHttpFormModalService, TenantCreateForm],
20
+ templateUrl: './app.component.html',
21
+ styleUrl: './app.component.scss'
22
+ })
23
+ export class AppComponent {
24
+ sidebarService = inject(MCSidebarService);
25
+ topbarService = inject(MCTopbarService);
26
+ footerService = inject(MCFooterService);
27
+ mcAuthService = inject(MCAuthenticationService);
28
+
29
+ tenantCreateForm = inject(TenantCreateForm);
30
+
31
+ destroyRef = inject(DestroyRef);
32
+
33
+ tenantService = inject(MCTenantService);
34
+
35
+ router = inject(Router);
36
+
37
+ items: Array<MenuItem> = [
38
+ {
39
+ label: 'Hi!',
40
+ items: [
41
+ {
42
+ label: 'Logout ',
43
+ icon: 'pi pi-window-maximize',
44
+ command: () => this.onLogout()
45
+ }
46
+ ]
47
+ }
48
+ ];
49
+
50
+ ngOnInit(): void {
51
+ this.loadSidebar();
52
+ this.loadTopbar();
53
+ this.loadFooter();
54
+ this.loadTenantMenu();
55
+ }
56
+
57
+ onLogout() {
58
+ this.mcAuthService.removeUser()
59
+ .pipe(
60
+ tap(() => window.location.reload())
61
+ )
62
+ .subscribe();
63
+ }
64
+
65
+ loadTopbar() {
66
+ this.topbarService.addComponentToLeft(new MCIconToggleSidebarButton());
67
+
68
+ //this.topbarService.addComponentToRight(new DarkModeButton());
69
+ this.topbarService.addComponentToRight(new MCAvatarWithMenu(this.items));
70
+ }
71
+
72
+ loadSidebar() {
73
+ /**
74
+ * Add components in sidebar all at once
75
+ */
76
+ this.sidebarService.setComponents([
77
+ new MCImage('https://tots.agency/assets/img/logos/logo-horiz-black-color.svg', 150),
78
+ new MCTenantMenu(true),
79
+ //new MCSubtitle('MENU'),
80
+ new MCMenu([
81
+ { label: 'Dashboard', link: '/dashboard', icon: 'pi pi-objects-column' },
82
+ { label: 'Team', link: '/team', icon: 'pi pi-users' },
83
+ { label: 'Settings', link: '/settings', icon: 'pi pi-cog' }
84
+ ])
85
+ ]);
86
+ }
87
+
88
+ loadFooter() {
89
+ this.footerService.addComponent({ component: FooterLayoutComponent, config: {} });
90
+ }
91
+
92
+ onClickAddTenant() {
93
+ this.tenantCreateForm.open()
94
+ .pipe(
95
+ takeUntilDestroyed(this.destroyRef),
96
+ mcEventFormOperator('saved', (result: MCEventModalForm) => this.afterNew(result))
97
+ )
98
+ .subscribe();
99
+ }
100
+
101
+ afterNew(result: MCEventModalForm) {
102
+ this.tenantService.setCurrent(result.content);
103
+ window.location.reload();
104
+ }
105
+
106
+ onClickTenant(tenant: MCTenant) {
107
+ this.tenantService.setCurrent(tenant)
108
+ window.location.reload();
109
+ }
110
+
111
+ loadTenantMenu() {
112
+ this.tenantService.onEvent.pipe(
113
+ takeUntilDestroyed(this.destroyRef),
114
+ takeWhile((event: {
115
+ type: string;
116
+ tenant: MCTenant | undefined;
117
+ }) => event.type == 'click' || event.type == 'click-new'),
118
+ tap((event: {
119
+ type: string;
120
+ tenant: MCTenant | undefined;
121
+ }) => {
122
+
123
+ if (event.type == 'click') {
124
+ this.onClickTenant(event.tenant!);
125
+ } else if (event.type == 'click-new') {
126
+ this.onClickAddTenant();
127
+ }
128
+
129
+
130
+ })
131
+ ).subscribe();
132
+ }
133
+ }
@@ -0,0 +1,5 @@
1
+ <div class="footer w-full flex justify-center items-center mt-3 mb-3">
2
+ <p>All rights reserved © Platfrom</p>
3
+ <span class="ml-2 mr-2">|</span>
4
+ <p>Powered by <a href="https://matiascamiletti.com.ar" class="font-bold text-orange-500">MC</a></p>
5
+ </div>
@@ -0,0 +1,11 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'app-footer-layout',
5
+ imports: [],
6
+ templateUrl: './footer-layout.component.html',
7
+ styleUrl: './footer-layout.component.scss'
8
+ })
9
+ export class FooterLayoutComponent {
10
+
11
+ }
@@ -0,0 +1,35 @@
1
+ <div class="min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900 p-4">
2
+ <p-card styleClass="max-w-md w-full shadow-lg">
3
+ <ng-template pTemplate="header">
4
+ <div class="h-2 bg-primary-500 rounded-t-lg"></div>
5
+ </ng-template>
6
+
7
+ <div class="text-center pt-8 pb-4">
8
+ <div
9
+ class="mb-4 inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary-100 text-primary-600 dark:bg-primary-900/30 dark:text-primary-400">
10
+ <i class="pi pi-building text-3xl"></i>
11
+ </div>
12
+ <h1 class="text-2xl font-bold text-gray-900 dark:text-white mb-2">No Tenant Found</h1>
13
+ <p class="text-gray-600 dark:text-gray-300 mb-6 px-4">
14
+ You are not associated with any organization yet. You can create a new one or ask an administrator to
15
+ invite you.
16
+ </p>
17
+ </div>
18
+
19
+ <ng-template pTemplate="footer">
20
+ <div class="flex flex-col gap-3">
21
+ <p-button label="Create New Tenant" icon="pi pi-plus" styleClass="w-full"
22
+ (onClick)="onClickAdd()"></p-button>
23
+
24
+ <p-button label="Logout" icon="pi pi-sign-out" styleClass="w-full p-button-secondary p-button-outlined"
25
+ (onClick)="onLogout()"></p-button>
26
+
27
+ <!-- TODO: Add routerLink when create page exists -->
28
+ <div class="text-center text-sm text-gray-500 mt-2">
29
+ Waiting for an invite? <a
30
+ class="text-primary-600 hover:text-primary-700 cursor-pointer font-medium">Check your email</a>
31
+ </div>
32
+ </div>
33
+ </ng-template>
34
+ </p-card>
35
+ </div>
@@ -0,0 +1,54 @@
1
+ import { Component, DestroyRef, inject } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { ButtonModule } from 'primeng/button';
4
+ import { CardModule } from 'primeng/card';
5
+ import { DialogService } from 'primeng/dynamicdialog';
6
+ import { mcEventFormOperator, MCEventModalForm, MCHttpFormModalService } from '@mckit/form';
7
+ import { TenantCreateForm } from '../../modals/tenant-create-form.service';
8
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
9
+ import { MCTenantService } from '@mckit/tenant';
10
+ import { Router } from '@angular/router';
11
+ import { MCAuthenticationService } from '@mckit/auth';
12
+ import { tap } from 'rxjs';
13
+
14
+ @Component({
15
+ selector: 'app-no-tenant-page',
16
+ standalone: true,
17
+ imports: [CommonModule, ButtonModule, CardModule],
18
+ providers: [DialogService, MCHttpFormModalService, TenantCreateForm],
19
+ templateUrl: './no-tenant-page.component.html',
20
+ styles: []
21
+ })
22
+ export class NoTenantPageComponent {
23
+ tenantCreateForm = inject(TenantCreateForm);
24
+
25
+ destroyRef = inject(DestroyRef);
26
+
27
+ tenantService = inject(MCTenantService);
28
+ authService = inject(MCAuthenticationService);
29
+
30
+
31
+ router = inject(Router);
32
+
33
+ afterNew(result: MCEventModalForm) {
34
+ this.tenantService.setCurrent(result.content);
35
+ this.router.navigate(['/']);
36
+ }
37
+
38
+ onClickAdd() {
39
+ this.tenantCreateForm.open()
40
+ .pipe(
41
+ takeUntilDestroyed(this.destroyRef),
42
+ mcEventFormOperator('saved', (result: MCEventModalForm) => this.afterNew(result))
43
+ )
44
+ .subscribe();
45
+ }
46
+
47
+ onLogout() {
48
+ this.authService.removeUser()
49
+ .pipe(
50
+ tap(() => window.location.reload())
51
+ )
52
+ .subscribe();
53
+ }
54
+ }
@@ -0,0 +1,63 @@
1
+ <div class="background-container">
2
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 800" preserveAspectRatio="none"
3
+ class="fixed left-0 top-0 min-h-screen min-w-screen">
4
+ <rect width="1600" height="800" fill="var(--primary-500)"></rect>
5
+ <path
6
+ d="M478.4 581c3.2 0.8 6.4 1.7 9.5 2.5c196.2 52.5 388.7 133.5 593.5 176.6c174.2 36.6 349.5 29.2 518.6-10.2V0H0v574.9c52.3-17.6 106.5-27.7 161.1-30.9C268.4 537.4 375.7 554.2 478.4 581z"
7
+ fill="var(--primary-400)"></path>
8
+ <path
9
+ d="M181.8 259.4c98.2 6 191.9 35.2 281.3 72.1c2.8 1.1 5.5 2.3 8.3 3.4c171 71.6 342.7 158.5 531.3 207.7c198.8 51.8 403.4 40.8 597.3-14.8V0H0v283.2C59 263.6 120.6 255.7 181.8 259.4z"
10
+ fill="var(--primary-300)"></path>
11
+ <path
12
+ d="M454.9 86.3C600.7 177 751.6 269.3 924.1 325c208.6 67.4 431.3 60.8 637.9-5.3c12.8-4.1 25.4-8.4 38.1-12.9V0H288.1c56 21.3 108.7 50.6 159.7 82C450.2 83.4 452.5 84.9 454.9 86.3z"
13
+ fill="var(--primary-200)"></path>
14
+ <path
15
+ d="M1397.5 154.8c47.2-10.6 93.6-25.3 138.6-43.8c21.7-8.9 43-18.8 63.9-29.5V0H643.4c62.9 41.7 129.7 78.2 202.1 107.4C1020.4 178.1 1214.2 196.1 1397.5 154.8z"
16
+ fill="var(--primary-100)"></path>
17
+ </svg>
18
+ </div>
19
+ <div class="mc-auth-basic-container">
20
+ <p-card [header]="'Register in Project'" subheader="Let's get started">
21
+
22
+ <form class="" [formGroup]="group" (ngSubmit)="onClickSubmit()">
23
+ <p-iconField iconPosition="left" class="mb-3 w-full">
24
+ <p-inputIcon styleClass="pi pi-user" />
25
+ <input type="text" pInputText [placeholder]="'Firstname'" formControlName="firstname" name="firstname"
26
+ class="w-full" />
27
+ </p-iconField>
28
+
29
+ <p-iconField iconPosition="left" class="mb-3 w-full">
30
+ <p-inputIcon styleClass="pi pi-envelope" />
31
+ <input type="text" pInputText [placeholder]="'Email'" formControlName="email" name="email"
32
+ (keyup.enter)="onClickSubmit()" class="w-full" />
33
+ </p-iconField>
34
+
35
+ <p-iconField iconPosition="left" class="mb-3 w-full">
36
+ <p-inputIcon styleClass="pi pi-key" />
37
+ <p-password [placeholder]="'Password'" [feedback]="false" [toggleMask]="true" formControlName="password"
38
+ name="password" (keyup.enter)="onClickSubmit()" inputStyleClass="w-full" styleClass="w-full" />
39
+ </p-iconField>
40
+
41
+ <p-iconField iconPosition="left" class="mb-3 w-full">
42
+ <p-inputIcon styleClass="pi pi-box" />
43
+ <input type="text" pInputText [placeholder]="'Project Name'" formControlName="project_name" name="project_name"
44
+ class="w-full" />
45
+ </p-iconField>
46
+
47
+ @for (message of messages(); track message; let first = $first) {
48
+ <p-message [severity]="message.severity" [text]="message.text" [ngClass]="{ 'mt-4': !first }" />
49
+ }
50
+ </form>
51
+
52
+ <ng-template pTemplate="footer">
53
+ <div class="mt-1 w-full">
54
+ <p-button [label]="'Sign Up'" [loading]="isSending()" (click)="onClickSubmit()"
55
+ [disabled]="group.invalid || isSending()" styleClass="w-full" />
56
+ </div>
57
+
58
+ <div class="more-actions-footer mt-3">
59
+ <p-button [routerLink]="'/login'" [label]="'Already have an account? Login'" [link]="true" />
60
+ </div>
61
+ </ng-template>
62
+ </p-card>
63
+ </div>
@@ -0,0 +1,87 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, inject, signal } from '@angular/core';
3
+ import { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
4
+ import { ButtonModule } from 'primeng/button';
5
+ import { CardModule } from 'primeng/card';
6
+ import { IconFieldModule } from 'primeng/iconfield';
7
+ import { InputIconModule } from 'primeng/inputicon';
8
+ import { InputTextModule } from 'primeng/inputtext';
9
+ import { PasswordModule } from 'primeng/password';
10
+ import { MessageModule } from 'primeng/message';
11
+ import { Router, RouterModule } from '@angular/router';
12
+ import { MCMessage } from '@mckit/core';
13
+ import { catchError, switchMap, take, tap } from 'rxjs';
14
+ import { MCAuthenticationService } from '@mckit/auth';
15
+ import { MCTenantService } from '@mckit/tenant';
16
+
17
+
18
+ @Component({
19
+ selector: 'app-register-page',
20
+ imports: [CommonModule, FormsModule, ReactiveFormsModule, ButtonModule, CardModule, IconFieldModule, InputIconModule, InputTextModule, PasswordModule, MessageModule, RouterModule],
21
+ templateUrl: './register-page.component.html',
22
+ styleUrl: './register-page.component.scss'
23
+ })
24
+ export class RegisterPage {
25
+ group = new FormGroup({
26
+ firstname: new FormControl<string>(''),
27
+ project_name: new FormControl<string>('', Validators.required),
28
+ email: new FormControl<string>('', [Validators.required, Validators.email]),
29
+ password: new FormControl<string>('', Validators.required),
30
+ grant_type: new FormControl<string>('password'),
31
+ });
32
+
33
+ isSending = signal(false);
34
+
35
+ messages = signal<Array<MCMessage>>([]);
36
+
37
+ authService = inject(MCAuthenticationService);
38
+ tenantService = inject(MCTenantService);
39
+
40
+ router = inject(Router);
41
+
42
+ onClickSubmit() {
43
+ if (this.group.invalid) {
44
+ return;
45
+ }
46
+
47
+ if (this.isSending()) {
48
+ return;
49
+ }
50
+
51
+ this.clearMessages();
52
+ this.showLoading();
53
+
54
+ this.authService.register(this.group.getRawValue())
55
+ .pipe(
56
+ switchMap(() => this.tenantService.create({ name: this.group.controls.project_name.value ?? 'Empty' })),
57
+ switchMap(() => this.tenantService.list().pipe(take(1))),
58
+ tap(tenants => this.tenantService.setCurrent(tenants.data[0])),
59
+ catchError(err => {
60
+ this.hideLoading();
61
+ this.showErrorMessage(err.error?.message || 'Error desconocido');
62
+ throw err;
63
+ }),
64
+ )
65
+ .subscribe(user => this.router.navigateByUrl('/dashboard'));
66
+ }
67
+
68
+ showSuccessMessage(message: string) {
69
+ this.messages.set([{ severity: 'success', text: message }]);
70
+ }
71
+
72
+ showErrorMessage(message: string) {
73
+ this.messages.set([{ severity: 'error', text: message }]);
74
+ }
75
+
76
+ clearMessages() {
77
+ this.messages.set([]);
78
+ }
79
+
80
+ showLoading() {
81
+ this.isSending.set(true);
82
+ }
83
+
84
+ hideLoading() {
85
+ this.isSending.set(false);
86
+ }
87
+ }
@@ -0,0 +1 @@
1
+ <mc-auth-basic #authComp [config]="config" (submit)="onLogin($event)" />
@@ -0,0 +1,100 @@
1
+ import { afterNextRender, Component, DestroyRef, inject, viewChild } from '@angular/core';
2
+ import { ActivatedRoute, Router } from '@angular/router';
3
+ import { MCAuthSakaiConfig, MCAuthenticationService, MCAuthModel, MCUser, MCAuthBasicComponent } from '@mckit/auth';
4
+ import { MCTenantService } from '@mckit/tenant';
5
+ import { catchError, switchMap, take, takeUntil, tap } from 'rxjs';
6
+
7
+ @Component({
8
+ selector: 'app-login-page',
9
+ imports: [MCAuthBasicComponent],
10
+ templateUrl: './login-page.component.html',
11
+ styleUrl: './login-page.component.scss'
12
+ })
13
+ export class LoginPage {
14
+ authComp = viewChild.required(MCAuthBasicComponent);
15
+
16
+ mcAuthService = inject(MCAuthenticationService);
17
+ router = inject(Router);
18
+ route = inject(ActivatedRoute);
19
+
20
+ onDestroy = inject(DestroyRef);
21
+
22
+ config!: MCAuthSakaiConfig;
23
+
24
+ routeToMain = '/dashboard';
25
+
26
+ tenantService = inject(MCTenantService);
27
+
28
+ constructor() {
29
+ afterNextRender(() => {
30
+ this.configLoader();
31
+ });
32
+ }
33
+
34
+ ngOnInit(): void {
35
+ this.loadConfig();
36
+ }
37
+
38
+ onAction(type: string) {
39
+ if (type === 'forgot-password') {
40
+ //this.dialogService.open(ForgotPasswordDialogComponent, { header: 'Recover Pass' });
41
+ }
42
+ }
43
+
44
+ onLogin(data: MCAuthModel) {
45
+ this.mcAuthService.signIn({ ...data, grant_type: 'password' })
46
+ .pipe(
47
+ switchMap(() => this.tenantService.list().pipe(take(1))),
48
+ tap(tenants => this.tenantService.setCurrent(tenants.data[0])),
49
+ catchError(err => {
50
+ this.authComp().hideLoading();
51
+ this.authComp().showErrorMessage(err.error?.message || 'Error desconocido');
52
+ throw err;
53
+ }),
54
+ )
55
+ .subscribe(user => this.router.navigateByUrl(this.routeToMain));
56
+ }
57
+
58
+ loadConfig() {
59
+ this.config = new MCAuthSakaiConfig();
60
+ this.config.title = 'Project - Login';
61
+ this.config.subtitle = 'Please enter your credentials to access your account';
62
+ this.config.emailPlaceholder = 'Email';
63
+ this.config.passwordPlaceholder = 'Password';
64
+ this.config.submitButton = 'Login';
65
+ this.config.registerLink = '/register';
66
+ }
67
+
68
+ configLoader() {
69
+ this.route.queryParams
70
+ .pipe(
71
+ take(1),
72
+ tap(params => this.processRedirectUrl(params['redirect'])),
73
+ switchMap(() => this.mcAuthService.getUser()),
74
+ tap(user => this.processIfLogged(user))
75
+ )
76
+ .subscribe();
77
+ }
78
+
79
+ processIfLogged(user?: MCUser) {
80
+ if (user != undefined) {
81
+ this.router.navigateByUrl(this.routeToMain);
82
+ }
83
+ }
84
+
85
+ processRedirectUrl(redirect?: string) {
86
+ if (redirect == undefined) {
87
+ // this.loaderService.hide();
88
+ } else if (
89
+ redirect !== '/login' &&
90
+ redirect !== '/' &&
91
+ redirect !== '' &&
92
+ redirect !== null &&
93
+ redirect !== undefined &&
94
+ redirect !== '%2F' &&
95
+ redirect !== '/login;redirect=%2F'
96
+ ) {
97
+ this.routeToMain = redirect;
98
+ }
99
+ }
100
+ }
@@ -0,0 +1,30 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { IftaTextareaField, IftaTextField, MCBaseHttpFormModalService } from '@mckit/form';
3
+ import { MCTenant, MCTenantService } from '@mckit/tenant';
4
+ import { inject } from '@angular/core';
5
+ import { Observable } from 'rxjs';
6
+ import { MCEventModalForm } from '@mckit/form';
7
+ import { Validators } from '@angular/forms';
8
+
9
+ @Injectable({
10
+ providedIn: 'root'
11
+ })
12
+ export class TenantCreateForm extends MCBaseHttpFormModalService<MCTenant> {
13
+
14
+ tenantService = inject(MCTenantService);
15
+
16
+ override open(): Observable<MCEventModalForm> {
17
+ return super.open({
18
+ title: 'Create new tenant',
19
+ httpService: this.tenantService,
20
+ identifierField: 'id'
21
+ });
22
+ }
23
+
24
+ getFields() {
25
+ return [
26
+ IftaTextField.init('name', 'Name', { validators: [Validators.required] }),
27
+ IftaTextareaField.init('description', 'Description')
28
+ ];
29
+ }
30
+ }
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare function install(_options: any): Rule;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.install = install;
4
+ const run_command_1 = require("../core/run-command");
5
+ const add_route_1 = require("../core/add-route");
6
+ const get_content_by_file_1 = require("../core/get-content-by-file");
7
+ const add_source_in_styles_1 = require("../core/add-source-in-styles");
8
+ const insert_string_at_1 = require("../core/insert-string-at");
9
+ function processAppConfig(tree, _context) {
10
+ const filePath = 'src/app/app.config.ts';
11
+ if (!tree.exists(filePath)) {
12
+ return;
13
+ }
14
+ const fileBuffer = tree.read(filePath);
15
+ let content = fileBuffer ? fileBuffer.toString() : '';
16
+ // Search position of the last import
17
+ const importPosition = content.lastIndexOf('import');
18
+ // Search position of the last ; after import position
19
+ const importEndPosition = content.indexOf(';', importPosition);
20
+ // Add the new import after the last import
21
+ content = (0, insert_string_at_1.insertStringAt)(content, `
22
+ import { provideHttpClient, withFetch, withInterceptors } from '@angular/common/http';
23
+
24
+ import { authInterceptor, provideMCAuth } from '@mckit/auth';
25
+
26
+ import { tenantInterceptor } from '@mckit/tenant';
27
+
28
+ import { environment } from '../environments/environment';`, importEndPosition + 1);
29
+ // Replace the zoneChangeDetectionStrategy
30
+ content = content.replace('provideZoneChangeDetection({ eventCoalescing: true }),', `provideZoneChangeDetection({ eventCoalescing: true }),
31
+ provideMCAuth({
32
+ baseUrl: environment.baseUrl
33
+ }),
34
+ provideHttpClient(
35
+ withFetch(),
36
+ withInterceptors([authInterceptor, tenantInterceptor])
37
+ ),,`);
38
+ tree.overwrite(filePath, content);
39
+ }
40
+ // You don't have to export the function as default. You can also have more than one rule factory
41
+ // per file.
42
+ function install(_options) {
43
+ return (tree, _context) => {
44
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
45
+ // Install the required dependencies
46
+ (0, run_command_1.runCommand)('npm install --save @mckit/auth @mckit/filter @mckit/form @mckit/odata @mckit/table @mckit/tenant', _context);
47
+ // Config SCSS
48
+ (0, add_source_in_styles_1.addSourceInStyles)(tree, `
49
+ @source "../node_modules/@mckit/auth";
50
+ @source "../node_modules/@mckit/table";
51
+ @source "../node_modules/@mckit/odata";
52
+ @source "../node_modules/@mckit/table";
53
+ @source "../node_modules/@mckit/tenant";
54
+ `);
55
+ // Replace App Component
56
+ tree.overwrite('src/app/app.component.ts', (_a = (0, get_content_by_file_1.getContentByFile)(__dirname, 'app.component.ts.template')) !== null && _a !== void 0 ? _a : '');
57
+ // Create Footer Layout
58
+ tree.overwrite('src/app/shared/components/footer-layout/footer-layout.component.scss', '');
59
+ tree.overwrite('src/app/shared/components/footer-layout/footer-layout.component.html', (_b = (0, get_content_by_file_1.getContentByFile)(__dirname, 'footer-layout.component.html.template')) !== null && _b !== void 0 ? _b : '');
60
+ tree.overwrite('src/app/shared/components/footer-layout/footer-layout.component.ts', (_c = (0, get_content_by_file_1.getContentByFile)(__dirname, 'footer-layout.component.ts.template')) !== null && _c !== void 0 ? _c : '');
61
+ // Create Tenant form modal
62
+ tree.overwrite('src/app/features/tenant/modals/tenant-create-form.service.ts', (_d = (0, get_content_by_file_1.getContentByFile)(__dirname, 'tenant-create-form.service.ts.template')) !== null && _d !== void 0 ? _d : '');
63
+ // Create No tenant page
64
+ tree.overwrite('src/app/features/tenant/pages/no-tenant-page/no-tenant-page.component.html', (_e = (0, get_content_by_file_1.getContentByFile)(__dirname, 'no-tenant-page.component.html.template')) !== null && _e !== void 0 ? _e : '');
65
+ tree.overwrite('src/app/features/tenant/pages/no-tenant-page/no-tenant-page.component.ts', (_f = (0, get_content_by_file_1.getContentByFile)(__dirname, 'no-tenant-page.component.ts.template')) !== null && _f !== void 0 ? _f : '');
66
+ // Create Login page
67
+ tree.overwrite('src/app/features/auth/pages/sign-in-page/sign-in-page.component.scss', '');
68
+ tree.overwrite('src/app/features/auth/pages/sign-in-page/sign-in-page.component.html', (_g = (0, get_content_by_file_1.getContentByFile)(__dirname, 'sign-in-page.component.html.template')) !== null && _g !== void 0 ? _g : '');
69
+ tree.overwrite('src/app/features/auth/pages/sign-in-page/sign-in-page.component.ts', (_h = (0, get_content_by_file_1.getContentByFile)(__dirname, 'sign-in-page.component.ts.template')) !== null && _h !== void 0 ? _h : '');
70
+ // Create Register page
71
+ tree.overwrite('src/app/features/auth/pages/sign-up-page/sign-up-page.component.scss', '');
72
+ tree.overwrite('src/app/features/auth/pages/sign-up-page/sign-up-page.component.html', (_j = (0, get_content_by_file_1.getContentByFile)(__dirname, 'register-page.component.html.template')) !== null && _j !== void 0 ? _j : '');
73
+ tree.overwrite('src/app/features/auth/pages/sign-up-page/sign-up-page.component.ts', (_k = (0, get_content_by_file_1.getContentByFile)(__dirname, 'register-page.component.ts.template')) !== null && _k !== void 0 ? _k : '');
74
+ // Add Route
75
+ (0, add_route_1.addRoute)(`{
76
+ path: 'login',
77
+ loadComponent: () => import('./features/auth/pages/sign-in-page/sign-in-page.component').then(m => m.SignInPage)
78
+ },
79
+ {
80
+ path: 'register',
81
+ loadComponent: () => import('./features/auth/pages/sign-up-page/sign-up-page.component').then(m => m.SignUpPage)
82
+ },
83
+ {
84
+ path: 'no-tenant',
85
+ canActivate: [mcAuthGuard],
86
+ loadComponent: () => import('./features/tenant/pages/no-tenant-page/no-tenant-page.component').then(m => m.NoTenantPageComponent)
87
+ },
88
+ {
89
+ path: '',
90
+ component: MCFuseLayoutComponent,
91
+ canActivate: [mcAuthGuard, tenantListGuard],
92
+ children: []
93
+ },`, tree, _context, `import { tenantListGuard } from '@mckit/tenant';
94
+ import { mcAuthGuard } from '@mckit/auth';
95
+ import { MCFuseLayoutComponent } from '@mckit/layout-fuse';`);
96
+ // Config app.config.ts
97
+ processAppConfig(tree, _context);
98
+ return tree;
99
+ };
100
+ }
101
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AA8CA,0BAoEC;AAjHD,qDAAiD;AACjD,iDAA6C;AAC7C,qEAA+D;AAC/D,uEAAiE;AACjE,+DAA0D;AAE1D,SAAS,gBAAgB,CAAC,IAAU,EAAE,QAA0B;IAC9D,MAAM,QAAQ,GAAG,uBAAuB,CAAC;IAEzC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtD,qCAAqC;IACrC,MAAM,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACrD,sDAAsD;IACtD,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,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