@mckit/schematics 0.0.8 → 0.0.10

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.8",
3
+ "version": "0.0.10",
4
4
  "description": "A blank schematics",
5
5
  "scripts": {
6
6
  "build": "tsc -p tsconfig.json",
@@ -0,0 +1,14 @@
1
+ <mc-odata-page
2
+ [breadcrumb]="breadcrumb"
3
+ [title]="'Title page'"
4
+ [subtitle]="'Description of page'"
5
+ [key]="'{{className}}'"
6
+ [httpService]="httpService"
7
+ [columns]="columns"
8
+ [searchFieldsKey]="searchFieldsKey" >
9
+
10
+ <ng-template mcTdTemplate="actions" let-row>
11
+ <mc-actions-column [item]="row" (onEdit)="onClickEdit($event)" (onRemove)="onClickRemove($event)"></mc-actions-column>
12
+ </ng-template>
13
+
14
+ </mc-odata-page>
@@ -0,0 +1,39 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, inject, OnInit, viewChild } from '@angular/core';
3
+ import { MCOdataPage } from '@mckit/odata';
4
+ import { MenuItem } from 'primeng/api';
5
+ import { Observable, of } from 'rxjs';
6
+ import { ButtonModule } from 'primeng/button';
7
+ import { MCActionsColumn, MCTdTemplateDirective, MCThTemplateDirective } from '@mckit/table';
8
+
9
+ @Component({
10
+ selector: 'app-{{className}}',
11
+ imports: [CommonModule, MCOdataPage, ButtonModule, MCThTemplateDirective, MCTdTemplateDirective, MCActionsColumn],
12
+ templateUrl: './{{className}}.component.html',
13
+ styleUrl: './{{className}}.component.scss'
14
+ })
15
+ export class {{classNameCamel}} implements OnInit {
16
+
17
+ odataPage = viewChild(MCOdataPage);
18
+
19
+ breadcrumb: MenuItem[] = [
20
+ { label: 'Home', routerLink: '/' },
21
+ { label: '{{classNameCamel}}' }
22
+ ];
23
+
24
+ httpService = inject(TestService);
25
+
26
+ columns = [
27
+ {{columns}}
28
+ ];
29
+
30
+ searchFieldsKey = ['title'];
31
+
32
+ onClickEdit(item: any) {
33
+ // this.router.navigate(['edit', item.id], { relativeTo: this.route });
34
+ }
35
+
36
+ onClickRemove(item: any) {
37
+ this.odataPage()?.onClickRemove(item);
38
+ }
39
+ }
@@ -0,0 +1,7 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ interface SchemaOptions {
3
+ name: string;
4
+ component?: string;
5
+ }
6
+ export declare function addTable(_options: SchemaOptions): Rule;
7
+ export {};
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addTable = addTable;
4
+ const run_command_1 = require("../core/run-command");
5
+ const create_file_with_template_1 = require("../core/create-file-with-template");
6
+ const get_properties_by_class_1 = require("../core/get-properties-by-class");
7
+ function addTable(_options) {
8
+ return (tree, _context) => {
9
+ if (!_options.name) {
10
+ throw new Error('El parámetro "name" es obligatorio.');
11
+ }
12
+ if (!_options.component) {
13
+ throw new Error('El parámetro "component" es obligatorio.');
14
+ }
15
+ // Install the required dependencies
16
+ (0, run_command_1.runCommand)('npm install --save @mckit/table @mckit/odata @mckit/filter @mckit/layout-core', _context);
17
+ // Obtener path y nombre del component
18
+ let pathComponent = _options.component.split('/');
19
+ let nameComponent = pathComponent.pop();
20
+ let path = pathComponent.join('/');
21
+ // Convertir nombre de la clase CamelCase a PascalCase
22
+ let classNameCamel = nameComponent;
23
+ // Convertir nombre de la clase CamelCase a kebab-case
24
+ let classNameKebab = classNameCamel.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();
25
+ // Convertir nombre de la clase CamelCase a snake_case
26
+ //let classNameSnake = classNameCamel.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1_$2').toLowerCase();
27
+ // Get properties by class
28
+ let classProperty = (0, get_properties_by_class_1.getPropertiesByClass)(tree, _options.name);
29
+ // Create HTML file
30
+ (0, create_file_with_template_1.createFileWithTemplate)(tree, __dirname, `${path}/${classNameKebab}.component.html`, '__class__.component.html.template', {
31
+ 'className': classNameKebab
32
+ });
33
+ // Create SCSS file
34
+ (0, create_file_with_template_1.createFileWithTemplate)(tree, __dirname, `${path}/${classNameKebab}.component.scss`, '__class__.component.scss.template', {
35
+ 'className': classNameKebab
36
+ });
37
+ // Generate content for columns variable
38
+ let columns = '';
39
+ classProperty.properties.forEach((property) => {
40
+ columns += `{ field: '${property}', title: '${property}' },`;
41
+ });
42
+ columns += "{ field: 'actions', title: 'Actions' }";
43
+ // Create TS file
44
+ (0, create_file_with_template_1.createFileWithTemplate)(tree, __dirname, `${path}/${classNameKebab}.component.ts`, '__class__.component.ts.template', {
45
+ 'className': classNameKebab,
46
+ 'classNameCamel': classNameCamel,
47
+ 'columns': columns
48
+ });
49
+ return tree;
50
+ };
51
+ }
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAUA,4BAuDC;AAhED,qDAAiD;AACjD,iFAA2E;AAC3E,6EAAkF;AAOlF,SAAgB,QAAQ,CAAC,QAAuB;IAC9C,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAEhD,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QAED,oCAAoC;QACpC,IAAA,wBAAU,EAAC,+EAA+E,EAAE,QAAQ,CAAC,CAAC;QAEtG,sCAAsC;QACtC,IAAI,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,aAAa,GAAG,aAAa,CAAC,GAAG,EAAE,CAAC;QACxC,IAAI,IAAI,GAAG,aAA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"title": "Add Table",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "Nombre de la entidad",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ }
14
+ },
15
+ "component": {
16
+ "type": "string",
17
+ "description": "Ruta donde se creara el component",
18
+ "$default": {
19
+ "$source": "argv",
20
+ "index": 1
21
+ }
22
+ }
23
+ },
24
+ "required": ["name", "component"]
25
+ }
26
+
@@ -12,6 +12,15 @@
12
12
  "add-login-page": {
13
13
  "description": "Config and create login page",
14
14
  "factory": "./add-login-page/index#addLoginPage"
15
+ },
16
+ "install-layout-fuse": {
17
+ "description": "Install layout fuse",
18
+ "factory": "./install-layout-fuse/index#install"
19
+ },
20
+ "addTable": {
21
+ "description": "Add Table",
22
+ "factory": "./add-table/index#addTable",
23
+ "schema": "./add-table/schema.json"
15
24
  }
16
25
  }
17
26
  }
@@ -1,2 +1,2 @@
1
1
  import { SchematicContext, Tree } from '@angular-devkit/schematics';
2
- export declare function addRoute(routeText: string, tree: Tree, context: SchematicContext): import("@angular-devkit/schematics/src/tree/interface").Tree | undefined;
2
+ export declare function addRoute(routeText: string, tree: Tree, context: SchematicContext, importsText?: string | undefined): import("@angular-devkit/schematics/src/tree/interface").Tree | undefined;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addRoute = addRoute;
4
- function addRoute(routeText, tree, context) {
4
+ function addRoute(routeText, tree, context, importsText = undefined) {
5
5
  var _a;
6
6
  const filePath = 'src/app/app.routes.ts';
7
7
  if (!tree.exists(filePath)) {
@@ -9,10 +9,12 @@ function addRoute(routeText, tree, context) {
9
9
  return tree;
10
10
  }
11
11
  const content = ((_a = tree.read(filePath)) === null || _a === void 0 ? void 0 : _a.toString('utf-8')) || '';
12
- const updatedContent = content.replace(/\[\s*([\s\S]*?)\s*\]/, (_, routes) => {
12
+ let updatedContent = content.replace(/\[\s*([\s\S]*?)\s*\]/, (_, routes) => {
13
13
  return `[${routes.trim() ? routes.trim() + ', ' : ''}${routeText}]`;
14
14
  });
15
+ if (importsText != undefined) {
16
+ updatedContent = importsText + '\n' + updatedContent;
17
+ }
15
18
  tree.overwrite(filePath, updatedContent);
16
- context.logger.info(`✅ Ruta añadida correctamente`);
17
19
  }
18
20
  //# sourceMappingURL=add-route.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"add-route.js","sourceRoot":"","sources":["add-route.ts"],"names":[],"mappings":";;AAEA,4BAiBC;AAjBD,SAAgB,QAAQ,CAAC,SAAiB,EAAE,IAAU,EAAE,OAAyB;;IAC7E,MAAM,QAAQ,GAAG,uBAAuB,CAAC;IAEzC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,QAAQ,EAAE,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,OAAO,GAAG,CAAA,MAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAAE,QAAQ,CAAC,OAAO,CAAC,KAAI,EAAE,CAAC;IAE7D,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QACzE,OAAO,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,GAAG,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IAEzC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;AACxD,CAAC"}
1
+ {"version":3,"file":"add-route.js","sourceRoot":"","sources":["add-route.ts"],"names":[],"mappings":";;AAEA,4BAmBC;AAnBD,SAAgB,QAAQ,CAAC,SAAiB,EAAE,IAAU,EAAE,OAAyB,EAAE,cAAgC,SAAS;;IACxH,MAAM,QAAQ,GAAG,uBAAuB,CAAC;IAEzC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,QAAQ,EAAE,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,OAAO,GAAG,CAAA,MAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAAE,QAAQ,CAAC,OAAO,CAAC,KAAI,EAAE,CAAC;IAE7D,IAAI,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QACvE,OAAO,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,GAAG,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,IAAG,WAAW,IAAI,SAAS,EAAC,CAAC;QACzB,cAAc,GAAG,WAAW,GAAG,IAAI,GAAG,cAAc,CAAC;IACzD,CAAC;IAED,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ export declare function addSourceInStyles(tree: Tree, sourceText: string): void;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addSourceInStyles = addSourceInStyles;
4
+ const insert_string_at_1 = require("./insert-string-at");
5
+ function addSourceInStyles(tree, sourceText) {
6
+ const filePath = 'src/styles.scss';
7
+ if (!tree.exists(filePath)) {
8
+ return;
9
+ }
10
+ const fileBuffer = tree.read(filePath);
11
+ const content = fileBuffer ? fileBuffer.toString() : '';
12
+ if (!content.includes('@use "tailwindcss";')) {
13
+ return;
14
+ }
15
+ // Search last @source
16
+ const sourcePosition = content.lastIndexOf('@source');
17
+ // Search last ;
18
+ const sourceEndPosition = content.indexOf(';', sourcePosition);
19
+ // Add the new @source after the last @source
20
+ const updatedContent = (0, insert_string_at_1.insertStringAt)(content, sourceText, sourceEndPosition + 1);
21
+ tree.overwrite(filePath, updatedContent);
22
+ }
23
+ //# sourceMappingURL=add-source-in-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-source-in-styles.js","sourceRoot":"","sources":["add-source-in-styles.ts"],"names":[],"mappings":";;AAGA,8CAsBC;AAxBD,yDAAoD;AAEpD,SAAgB,iBAAiB,CAAC,IAAU,EAAE,UAAkB;IAC5D,MAAM,QAAQ,GAAG,iBAAiB,CAAC;IAEnC,IAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAC,CAAC;QACvB,OAAO;IACX,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAExD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAAC;QAC3C,OAAO;IACX,CAAC;IAED,sBAAsB;IACtB,MAAM,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACtD,gBAAgB;IAChB,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAC/D,6CAA6C;IAC7C,MAAM,cAAc,GAAG,IAAA,iCAAc,EAAC,OAAO,EAAE,UAAU,EAAE,iBAAiB,GAAG,CAAC,CAAC,CAAC;IAElF,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ export declare function createFileWithTemplate(tree: Tree, dirname: string, fileName: string, template: string, vars: {
3
+ [key: string]: string;
4
+ }): void;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createFileWithTemplate = createFileWithTemplate;
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ function createFileWithTemplate(tree, dirname, fileName, template, vars) {
7
+ // Verify if exist the file
8
+ if (tree.exists(fileName)) {
9
+ return;
10
+ }
11
+ const filePath = path.join(dirname, 'files/' + template);
12
+ if (fs.existsSync(filePath)) {
13
+ let content = fs.readFileSync(filePath, 'utf8');
14
+ // Replace vars
15
+ Object.keys(vars).forEach(key => {
16
+ content = content.replace(new RegExp(`{{${key}}}`, 'g'), vars[key]);
17
+ });
18
+ tree.create(fileName, content);
19
+ }
20
+ }
21
+ //# sourceMappingURL=create-file-with-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-file-with-template.js","sourceRoot":"","sources":["create-file-with-template.ts"],"names":[],"mappings":";;AAIA,wDAgBC;AAnBD,yBAAyB;AACzB,6BAA6B;AAE7B,SAAgB,sBAAsB,CAAC,IAAU,EAAE,OAAe,EAAE,QAAgB,EAAE,QAAgB,EAAE,IAA+B;IACrI,2BAA2B;IAC3B,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAAC,CAAC;IACzD,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,IAAI,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAChD,eAAe;QACf,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC9B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ export interface ClassData {
3
+ name: string;
4
+ properties: string[];
5
+ }
6
+ export declare function getPropertiesByClass(tree: Tree, filePath: string): ClassData;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPropertiesByClass = getPropertiesByClass;
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
+ }
24
+ });
25
+ if (firstClass == undefined || firstClass == null) {
26
+ throw new Error(`No se encontró ninguna clase en el archivo ${filePath}`);
27
+ }
28
+ return firstClass;
29
+ }
30
+ //# sourceMappingURL=get-properties-by-class.js.map
@@ -0,0 +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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AAC;AACtB,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function insertStringAt(originalString: string, stringToInsert: string, position: number): string;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertStringAt = insertStringAt;
4
+ function insertStringAt(originalString, stringToInsert, position) {
5
+ if (position > originalString.length) {
6
+ // Si la posición está fuera del rango, simplemente agrega el string al final
7
+ return originalString + stringToInsert;
8
+ }
9
+ // Dividir el original en dos partes: antes y después de la posición
10
+ const before = originalString.slice(0, position);
11
+ const after = originalString.slice(position);
12
+ // Insertar el string en la posición deseada
13
+ return before + stringToInsert + after;
14
+ }
15
+ //# sourceMappingURL=insert-string-at.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert-string-at.js","sourceRoot":"","sources":["insert-string-at.ts"],"names":[],"mappings":";;AAAA,wCAYC;AAZD,SAAgB,cAAc,CAAC,cAAsB,EAAE,cAAsB,EAAE,QAAgB;IAC3F,IAAI,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;QACnC,6EAA6E;QAC7E,OAAO,cAAc,GAAG,cAAc,CAAC;IAC3C,CAAC;IAED,oEAAoE;IACpE,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAE7C,4CAA4C;IAC5C,OAAO,MAAM,GAAG,cAAc,GAAG,KAAK,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { Component, inject } from '@angular/core';
2
+ import { RouterOutlet } from '@angular/router';
3
+ import { MCFooterService, MCSidebarService, MCTopbarService } from '@mckit/layout-core';
4
+ import { MCIconToggleSidebarButton } from '@mckit/layout';
5
+ import { MCImage, MCMenu, MCSubtitle } from '@mckit/core';
6
+ import { FooterComponent } from './layout/footer/footer.component';
7
+ import { MCAvatarWithMenu } from '@mckit/auth';
8
+ import { MenuItem } from 'primeng/api';
9
+
10
+ @Component({
11
+ selector: 'app-root',
12
+ imports: [RouterOutlet],
13
+ templateUrl: './app.component.html',
14
+ styleUrl: './app.component.scss'
15
+ })
16
+ export class AppComponent {
17
+ sidebarService = inject(MCSidebarService);
18
+ topbarService = inject(MCTopbarService);
19
+ footerService = inject(MCFooterService);
20
+
21
+ items: Array<MenuItem> = [
22
+ {
23
+ label: 'Hi Matias',
24
+ items: [
25
+ {
26
+ label: 'Integrations ',
27
+ icon: 'pi pi-link',
28
+ routerLink: '/integrations'
29
+ },
30
+ {
31
+ label: 'Logout ',
32
+ icon: 'pi pi-window-maximize',
33
+ command: () => this.onLogout()
34
+ }
35
+ ]
36
+ }
37
+ ];
38
+
39
+ ngOnInit(): void {
40
+ this.loadSidebar();
41
+ this.loadTopbar();
42
+ this.loadFooter();
43
+ }
44
+
45
+ onLogout() {
46
+ /*this.authService.removeUser()
47
+ .subscribe(res => window.location.reload());*/
48
+ }
49
+
50
+ loadTopbar() {
51
+ this.topbarService.addComponentToLeft(new MCIconToggleSidebarButton());
52
+
53
+ this.topbarService.addComponentToRight(new DarkModeButton());
54
+ this.topbarService.addComponentToRight(new MCAvatarWithMenu(this.items));
55
+ }
56
+
57
+ loadSidebar() {
58
+ /**
59
+ * Add components in sidebar all at once
60
+ */
61
+ this.sidebarService.setComponents([
62
+ new MCImage('https://tots.agency/assets/img/logos/logo-horiz-black-color.svg', 150),
63
+ new MCSubtitle('MENU'),
64
+ new MCMenu([
65
+ { label: 'Accounts', link: '/accounts', icon: 'pi pi-building-columns' },
66
+ { label: 'Records', link: '/records', icon: 'pi pi-building-columns' },
67
+ ])
68
+ ]);
69
+ }
70
+
71
+ loadFooter() {
72
+ this.footerService.addComponent({ component: FooterComponent, config: { } });
73
+ }
74
+ }
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare function install(_options: any): Rule;
@@ -0,0 +1,35 @@
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
+ // You don't have to export the function as default. You can also have more than one rule factory
9
+ // per file.
10
+ function install(_options) {
11
+ return (tree, _context) => {
12
+ // Install the required dependencies
13
+ (0, run_command_1.runCommand)('npm install --save @mckit/layout-core @mckit/layout @mckit/layout-fuse', _context);
14
+ // Config SCSS
15
+ (0, add_source_in_styles_1.addSourceInStyles)(tree, `
16
+ @source "../node_modules/@mckit/layout-core";
17
+ @source "../node_modules/@mckit/layout";
18
+ @source "../node_modules/@mckit/layout-fuse";
19
+ `);
20
+ // Add Route
21
+ (0, add_route_1.addRoute)(`{
22
+ path: '',
23
+ component: MCFuseLayoutComponent,
24
+ //canActivate: [mcAuthGuard],
25
+ children: []
26
+ },`, tree, _context, `import { MCFuseLayoutComponent } from '@mckit/layout-fuse';`);
27
+ // Generate Footer component
28
+ (0, run_command_1.runCommand)('ng g c layout/footer', _context);
29
+ // Replace App Component
30
+ const component = (0, get_content_by_file_1.getContentByFile)(__dirname, 'app.component.ts.template');
31
+ tree.overwrite('src/app/app.component.ts', component !== null && component !== void 0 ? component : '');
32
+ return tree;
33
+ };
34
+ }
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAQA,0BA6BC;AApCD,qDAAiD;AACjD,iDAA6C;AAC7C,qEAA+D;AAC/D,uEAAiE;AAEjE,iGAAiG;AACjG,YAAY;AACZ,SAAgB,OAAO,CAAC,QAAa;IACnC,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,oCAAoC;QACpC,IAAA,wBAAU,EAAC,wEAAwE,EAAE,QAAQ,CAAC,CAAC;QAE/F,cAAc;QACd,IAAA,wCAAiB,EAAC,IAAI,EAAE;;;;CAI3B,CAAC,CAAC;QAEC,YAAY;QACZ,IAAA,oBAAQ,EAAC;;;;;KAKR,EAAE,IAAI,EAAE,QAAQ,EAAE,6DAA6D,CAAC,CAAC;QAElF,4BAA4B;QAC5B,IAAA,wBAAU,EAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC;QAE7C,wBAAwB;QACxB,MAAM,SAAS,GAAG,IAAA,sCAAgB,EAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;QAC3E,IAAI,CAAC,SAAS,CAAC,0BAA0B,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC,CAAC;QAE5D,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}