angular-generate 2.2.1
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 +149 -0
- package/explication_conception.md +119 -0
- package/package.json +28 -0
- package/src/api/index.d.ts +2 -0
- package/src/api/index.js +18 -0
- package/src/api/index.js.map +1 -0
- package/src/api/index_spec.d.ts +1 -0
- package/src/api/index_spec.js +23 -0
- package/src/api/index_spec.js.map +1 -0
- package/src/api/schema.json +17 -0
- package/src/collection.json +88 -0
- package/src/component/add/index.d.ts +2 -0
- package/src/component/add/index.js +64 -0
- package/src/component/add/index.js.map +1 -0
- package/src/component/add/index_spec.d.ts +1 -0
- package/src/component/add/index_spec.js +23 -0
- package/src/component/add/index_spec.js.map +1 -0
- package/src/component/deconnexion/index.d.ts +2 -0
- package/src/component/deconnexion/index.js +88 -0
- package/src/component/deconnexion/index.js.map +1 -0
- package/src/component/deconnexion/index_spec.d.ts +1 -0
- package/src/component/deconnexion/index_spec.js +23 -0
- package/src/component/deconnexion/index_spec.js.map +1 -0
- package/src/component/details/index.d.ts +2 -0
- package/src/component/details/index.js +12 -0
- package/src/component/details/index.js.map +1 -0
- package/src/component/details/index_spec.d.ts +1 -0
- package/src/component/details/index_spec.js +23 -0
- package/src/component/details/index_spec.js.map +1 -0
- package/src/component/edit/index.d.ts +2 -0
- package/src/component/edit/index.js +63 -0
- package/src/component/edit/index.js.map +1 -0
- package/src/component/edit/index_spec.d.ts +1 -0
- package/src/component/edit/index_spec.js +23 -0
- package/src/component/edit/index_spec.js.map +1 -0
- package/src/component/header/index.d.ts +2 -0
- package/src/component/header/index.js +311 -0
- package/src/component/header/index.js.map +1 -0
- package/src/component/list/index.d.ts +2 -0
- package/src/component/list/index.js +64 -0
- package/src/component/list/index.js.map +1 -0
- package/src/component/list/index_spec.d.ts +1 -0
- package/src/component/list/index_spec.js +23 -0
- package/src/component/list/index_spec.js.map +1 -0
- package/src/component/login/index.d.ts +2 -0
- package/src/component/login/index.js +314 -0
- package/src/component/login/index.js.map +1 -0
- package/src/component/login/index_spec.d.ts +1 -0
- package/src/component/login/index_spec.js +23 -0
- package/src/component/login/index_spec.js.map +1 -0
- package/src/component/not-found/index.d.ts +2 -0
- package/src/component/not-found/index.js +68 -0
- package/src/component/not-found/index.js.map +1 -0
- package/src/component/not-found/index_spec.d.ts +1 -0
- package/src/component/not-found/index_spec.js +23 -0
- package/src/component/not-found/index_spec.js.map +1 -0
- package/src/component/sidebar/index.d.ts +2 -0
- package/src/component/sidebar/index.js +247 -0
- package/src/component/sidebar/index.js.map +1 -0
- package/src/component/test/index.d.ts +2 -0
- package/src/component/test/index.js +20 -0
- package/src/component/test/index.js.map +1 -0
- package/src/component/test/index_spec.d.ts +1 -0
- package/src/component/test/index_spec.js +23 -0
- package/src/component/test/index_spec.js.map +1 -0
- package/src/component/type/index.d.ts +2 -0
- package/src/component/type/index.js +45 -0
- package/src/component/type/index.js.map +1 -0
- package/src/component/type/index_spec.d.ts +1 -0
- package/src/component/type/index_spec.js +23 -0
- package/src/component/type/index_spec.js.map +1 -0
- package/src/component/wrapper/index.d.ts +2 -0
- package/src/component/wrapper/index.js +175 -0
- package/src/component/wrapper/index.js.map +1 -0
- package/src/component/wrapper/index_spec.d.ts +1 -0
- package/src/component/wrapper/index_spec.js +23 -0
- package/src/component/wrapper/index_spec.js.map +1 -0
- package/src/config/index.d.ts +2 -0
- package/src/config/index.js +166 -0
- package/src/config/index.js.map +1 -0
- package/src/config/index_spec.d.ts +1 -0
- package/src/config/index_spec.js +23 -0
- package/src/config/index_spec.js.map +1 -0
- package/src/config/schema.json +31 -0
- package/src/guard/auth/index.d.ts +2 -0
- package/src/guard/auth/index.js +60 -0
- package/src/guard/auth/index.js.map +1 -0
- package/src/guard/auth/index_spec.d.ts +1 -0
- package/src/guard/auth/index_spec.js +23 -0
- package/src/guard/auth/index_spec.js.map +1 -0
- package/src/guard/permissions/index.d.ts +2 -0
- package/src/guard/permissions/index.js +51 -0
- package/src/guard/permissions/index.js.map +1 -0
- package/src/guard/permissions/index_spec.d.ts +1 -0
- package/src/guard/permissions/index_spec.js +23 -0
- package/src/guard/permissions/index_spec.js.map +1 -0
- package/src/module/index.d.ts +2 -0
- package/src/module/index.js +94 -0
- package/src/module/index.js.map +1 -0
- package/src/module/index_spec.d.ts +1 -0
- package/src/module/index_spec.js +23 -0
- package/src/module/index_spec.js.map +1 -0
- package/src/module/schema.json +17 -0
- package/src/other/taf-add-import-to-module/index.d.ts +2 -0
- package/src/other/taf-add-import-to-module/index.js +20 -0
- package/src/other/taf-add-import-to-module/index.js.map +1 -0
- package/src/other/taf-add-import-to-module/index_spec.d.ts +1 -0
- package/src/other/taf-add-import-to-module/index_spec.js +23 -0
- package/src/other/taf-add-import-to-module/index_spec.js.map +1 -0
- package/src/service/api/index.d.ts +2 -0
- package/src/service/api/index.js +508 -0
- package/src/service/api/index.js.map +1 -0
- package/src/service/api/index_spec.d.ts +1 -0
- package/src/service/api/index_spec.js +23 -0
- package/src/service/api/index_spec.js.map +1 -0
- package/src/templates/add/add.html.d.ts +1 -0
- package/src/templates/add/add.html.js +124 -0
- package/src/templates/add/add.html.js.map +1 -0
- package/src/templates/add/add.ts.d.ts +1 -0
- package/src/templates/add/add.ts.js +112 -0
- package/src/templates/add/add.ts.js.map +1 -0
- package/src/templates/edit/edit.html.d.ts +1 -0
- package/src/templates/edit/edit.html.js +121 -0
- package/src/templates/edit/edit.html.js.map +1 -0
- package/src/templates/edit/edit.ts.d.ts +1 -0
- package/src/templates/edit/edit.ts.js +117 -0
- package/src/templates/edit/edit.ts.js.map +1 -0
- package/src/templates/list/list.html.d.ts +1 -0
- package/src/templates/list/list.html.js +98 -0
- package/src/templates/list/list.html.js.map +1 -0
- package/src/templates/list/list.ts.d.ts +2 -0
- package/src/templates/list/list.ts.js +144 -0
- package/src/templates/list/list.ts.js.map +1 -0
- package/src/templates/test/test.ts.d.ts +4 -0
- package/src/templates/test/test.ts.js +145 -0
- package/src/templates/test/test.ts.js.map +1 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.login = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
6
|
+
// You don't have to export the function as default. You can also have more than one rule factory
|
|
7
|
+
// per file.
|
|
8
|
+
function login(options) {
|
|
9
|
+
const { table, projectName, parent, Config, style = 'scss' } = options;
|
|
10
|
+
//console.log("table = ", table)
|
|
11
|
+
const componentType = "list";
|
|
12
|
+
const componentName_class = (0, strings_1.classify)(componentType) + (0, strings_1.classify)(table.table); //"Login"
|
|
13
|
+
const componentName = (0, strings_1.dasherize)(componentName_class);
|
|
14
|
+
const fullComponentName = parent + (0, strings_1.dasherize)(table.table) + "/" + componentName; // home/auteur/list-auteur
|
|
15
|
+
return (tree) => {
|
|
16
|
+
// Le composant existe dèja
|
|
17
|
+
let c_path = `/src/app/${fullComponentName}/${componentName}.component.ts`;
|
|
18
|
+
if (tree.exists(c_path)) {
|
|
19
|
+
console.warn(`Le composant ${componentName} existe dèja dans le module ${parent} : ${c_path}`);
|
|
20
|
+
if (Config === null || Config === void 0 ? void 0 : Config.forcer) {
|
|
21
|
+
console.warn("Forcer la Mise à jour du composant ...");
|
|
22
|
+
return (0, schematics_1.chain)([
|
|
23
|
+
(tree, _context) => {
|
|
24
|
+
// modifier le fichier HTML
|
|
25
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.html`, // home/auteur/lis-auteur/list-auteur.component.html
|
|
26
|
+
get_html_content());
|
|
27
|
+
// modifier le fichier CSS
|
|
28
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.${style}`, // home/auteur/lis-auteur/list-auteur.component.html
|
|
29
|
+
get_css_content());
|
|
30
|
+
// modifier le fichier TS
|
|
31
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.ts`, // home/auteur/lis-auteur/list-auteur.component.ts
|
|
32
|
+
get_ts_content(componentName_class, componentName, Config));
|
|
33
|
+
}
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
return tree;
|
|
37
|
+
}
|
|
38
|
+
// le composant n'existe pas encore
|
|
39
|
+
return (0, schematics_1.chain)([
|
|
40
|
+
// création du composant
|
|
41
|
+
(0, schematics_1.externalSchematic)("@schematics/angular", "component", { project: projectName, name: fullComponentName, style: Config.style, standalone: true }),
|
|
42
|
+
// modification des fichiers
|
|
43
|
+
(tree, _context) => {
|
|
44
|
+
// modifier le fichier HTML
|
|
45
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.html`, // home/auteur/lis-auteur/list-auteur.component.html
|
|
46
|
+
get_html_content());
|
|
47
|
+
// modifier le fichier CSS
|
|
48
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.${style}`, // home/auteur/lis-auteur/list-auteur.component.html
|
|
49
|
+
get_css_content());
|
|
50
|
+
// modifier le fichier TS
|
|
51
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.ts`, // home/auteur/lis-auteur/list-auteur.component.ts
|
|
52
|
+
get_ts_content(componentName_class, componentName, Config));
|
|
53
|
+
}
|
|
54
|
+
]);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
exports.login = login;
|
|
58
|
+
function get_ts_content(componentName_class, componentName, Config) {
|
|
59
|
+
return `import { Component ,OnDestroy, OnInit, signal} from '@angular/core';
|
|
60
|
+
import { FormGroup, FormBuilder, Validators,ReactiveFormsModule } from '@angular/forms';
|
|
61
|
+
import { Router } from '@angular/router';
|
|
62
|
+
import { ApiService } from '../../../service/api/api.service';
|
|
63
|
+
import { CommonModule } from '@angular/common';
|
|
64
|
+
@Component({
|
|
65
|
+
selector: 'app-${componentName}',
|
|
66
|
+
standalone: true, // Composant autonome
|
|
67
|
+
imports: [CommonModule, ReactiveFormsModule],
|
|
68
|
+
templateUrl: './${componentName}.component.html',
|
|
69
|
+
styleUrls: ['./${componentName}.component.${Config.style}']
|
|
70
|
+
})
|
|
71
|
+
export class ${componentName_class}Component implements OnInit, OnDestroy {
|
|
72
|
+
reactiveForm_login_login !: FormGroup;
|
|
73
|
+
submitted = signal(false);
|
|
74
|
+
loading_login_login = signal(false);
|
|
75
|
+
showPassword: boolean = false;
|
|
76
|
+
constructor(private formBuilder: FormBuilder, public api: ApiService, private router: Router) { }
|
|
77
|
+
ngOnDestroy(): void {
|
|
78
|
+
throw new Error('Method not implemented.');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
ngOnInit(): void {
|
|
82
|
+
this.init_form();
|
|
83
|
+
}
|
|
84
|
+
init_form() {
|
|
85
|
+
this.reactiveForm_login_login = this.formBuilder.group({
|
|
86
|
+
email: ["", Validators.required],
|
|
87
|
+
password: ["", Validators.required]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// acces facile au champs de votre formulaire
|
|
92
|
+
get f(): any { return this.reactiveForm_login_login.controls; }
|
|
93
|
+
// validation du formulaire
|
|
94
|
+
onSubmit_login_login() {
|
|
95
|
+
this.submitted.set(true);
|
|
96
|
+
console.log(this.reactiveForm_login_login.value)
|
|
97
|
+
// stop here if form is invalid
|
|
98
|
+
if (this.reactiveForm_login_login.invalid) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
var login = this.reactiveForm_login_login.value
|
|
102
|
+
this.login_login(login)
|
|
103
|
+
}
|
|
104
|
+
// vider le formulaire
|
|
105
|
+
onReset_login_login() {
|
|
106
|
+
this.submitted.set(false);
|
|
107
|
+
this.reactiveForm_login_login.reset();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async login_login(login: any) {
|
|
111
|
+
this.loading_login_login.set(true);
|
|
112
|
+
try {
|
|
113
|
+
const reponse = await this.api.api_post("login", login);
|
|
114
|
+
if (reponse && reponse.success) {
|
|
115
|
+
console.log("Opération effectuée avec succés sur la table login. Réponse= ", reponse);
|
|
116
|
+
this.onReset_login_login();
|
|
117
|
+
await this.api.save_on_local_storage("token", reponse);
|
|
118
|
+
|
|
119
|
+
await this.api.update_data_from_token();
|
|
120
|
+
this.api.Swal_success(reponse.message || "Opération éffectuée avec succés");
|
|
121
|
+
|
|
122
|
+
const page = document.querySelector('.login-page');
|
|
123
|
+
page?.classList.add('zooming');
|
|
124
|
+
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
this.router.navigate(['/home']);
|
|
127
|
+
}, 1000);
|
|
128
|
+
} else {
|
|
129
|
+
console.log("L'opération sur la table login a échoué. Réponse= ", reponse);
|
|
130
|
+
this.api.Swal_error(reponse?.message || "L'opération a echoué");
|
|
131
|
+
}
|
|
132
|
+
} catch (error: any) {
|
|
133
|
+
console.error(error);
|
|
134
|
+
this.api.Swal_error(error?.error?.message || "L'opération a echoué");
|
|
135
|
+
} finally {
|
|
136
|
+
this.loading_login_login.set(false);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
togglePasswordVisibility() {
|
|
141
|
+
this.showPassword = !this.showPassword;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
`;
|
|
145
|
+
}
|
|
146
|
+
function get_html_content() {
|
|
147
|
+
return `
|
|
148
|
+
<div class="login-page d-flex align-items-center justify-content-center vh-100">
|
|
149
|
+
<div class="overlay"></div>
|
|
150
|
+
|
|
151
|
+
<div class="login-card p-4 rounded-4 shadow-lg">
|
|
152
|
+
<div class="text-center">
|
|
153
|
+
<img src="https://chitari.tech/logo.png" alt="Logo" class="rounded-3" style="width: 140px;">
|
|
154
|
+
<h3 class="fw-bold text-white">Bienvenue</h3>
|
|
155
|
+
<p class="text-light small">Connectez-vous pour continuer</p>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<form [formGroup]="reactiveForm_login_login" (ngSubmit)="onSubmit_login_login()">
|
|
159
|
+
<!-- Email -->
|
|
160
|
+
<div class="form-floating mb-3 position-relative">
|
|
161
|
+
<input type="text" class="form-control glass-input rounded-pill ps-5" id="emailInput" placeholder="Email"
|
|
162
|
+
formControlName="email" [ngClass]="{ 'is-invalid': submitted() && f.email.errors }">
|
|
163
|
+
<label [ngClass]="{ 'error-label': submitted() && f.email.errors }" for="emailInput">
|
|
164
|
+
<i class="bi bi-envelope-fill me-2"></i>
|
|
165
|
+
@if (submitted() && f.email.errors) {
|
|
166
|
+
Email requis
|
|
167
|
+
} @else {
|
|
168
|
+
Email
|
|
169
|
+
}
|
|
170
|
+
</label>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<!-- Password -->
|
|
174
|
+
<div class="form-floating mb-3 position-relative">
|
|
175
|
+
<input [type]="showPassword ? 'text' : 'password'" class="form-control glass-input rounded-pill ps-5"
|
|
176
|
+
id="passwordInput" placeholder="Mot de passe" formControlName="password"
|
|
177
|
+
[ngClass]="{ 'is-invalid': submitted() && f.password.errors }">
|
|
178
|
+
|
|
179
|
+
<label [ngClass]="{ 'error-label': submitted() && f.password.errors }" for="passwordInput">
|
|
180
|
+
<i class="bi bi-lock-fill me-2"></i>
|
|
181
|
+
@if (submitted() && f.password.errors) {
|
|
182
|
+
Mot de passe requis
|
|
183
|
+
} @else {
|
|
184
|
+
Mot de passe
|
|
185
|
+
}
|
|
186
|
+
</label>
|
|
187
|
+
|
|
188
|
+
<button type="button" class="btn-password" (click)="togglePasswordVisibility()">
|
|
189
|
+
<i class="bi" [ngClass]="showPassword ? 'bi-eye-slash' : 'bi-eye'"></i>
|
|
190
|
+
</button>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
<!-- Forgot password -->
|
|
195
|
+
<div class="text-end mb-3">
|
|
196
|
+
<a type="button" class="text-decoration-none small text-light"
|
|
197
|
+
(click)="api.Swal_success('Pas disponible pour le moment, Bientôt 💻')">Mot de passe oublié ?</a>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<!-- Submit -->
|
|
201
|
+
<button type="submit" class="btn btn-primary w-100 rounded-pill py-2 fw-semibold">
|
|
202
|
+
{{ loading_login_login() ? 'En cours...' : 'Connexion' }}
|
|
203
|
+
</button>
|
|
204
|
+
</form>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
`;
|
|
208
|
+
}
|
|
209
|
+
function get_css_content() {
|
|
210
|
+
return `
|
|
211
|
+
.login-page {
|
|
212
|
+
background: url('https://chitari.tech/logo.png') no-repeat center center;
|
|
213
|
+
background-size: cover;
|
|
214
|
+
position: relative;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.overlay {
|
|
218
|
+
position: absolute;
|
|
219
|
+
width: 100%;
|
|
220
|
+
height: 100%;
|
|
221
|
+
background: rgba(0,0,0,0.5); /* Overlay sombre */
|
|
222
|
+
top: 0;
|
|
223
|
+
left: 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.login-card {
|
|
227
|
+
position: relative;
|
|
228
|
+
z-index: 2;
|
|
229
|
+
background: rgba(255, 255, 255, 0.15);
|
|
230
|
+
border-radius: 20px;
|
|
231
|
+
backdrop-filter: blur(12px);
|
|
232
|
+
-webkit-backdrop-filter: blur(12px);
|
|
233
|
+
max-width: 400px;
|
|
234
|
+
width: 100%;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.form-floating > label {
|
|
238
|
+
display: flex;
|
|
239
|
+
align-items: center;
|
|
240
|
+
gap: 5px;
|
|
241
|
+
color: #fff !important;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.glass-input {
|
|
245
|
+
background: rgba(255,255,255,0.2);
|
|
246
|
+
color: #fff;
|
|
247
|
+
border: none;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.glass-input::placeholder {
|
|
251
|
+
color: transparent;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.btn-password {
|
|
255
|
+
position: absolute;
|
|
256
|
+
right: 15px;
|
|
257
|
+
top: 50%;
|
|
258
|
+
transform: translateY(-50%);
|
|
259
|
+
background: none;
|
|
260
|
+
border: none;
|
|
261
|
+
cursor: pointer;
|
|
262
|
+
color: #fff;
|
|
263
|
+
font-size: 1.2rem;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.btn-primary {
|
|
267
|
+
background: linear-gradient(135deg, #233C6C, #093991);
|
|
268
|
+
border: none;
|
|
269
|
+
transition: 0.3s;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.btn-primary:hover {
|
|
273
|
+
background: linear-gradient(135deg, #093991, #233C6C);
|
|
274
|
+
transform: translateY(-2px);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.invalid-feedback {
|
|
278
|
+
color: #ffd6d6;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
// effect zoom
|
|
283
|
+
/* Animation zoom */
|
|
284
|
+
.login-page.zooming {
|
|
285
|
+
animation: bgZoom 0.8s forwards;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.login-page.zooming .login-card {
|
|
289
|
+
animation: cardFadeOut 0.8s forwards;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
@keyframes bgZoom {
|
|
293
|
+
0% {
|
|
294
|
+
transform: scale(1);
|
|
295
|
+
}
|
|
296
|
+
100% {
|
|
297
|
+
transform: scale(1.6); /* zoom vers le background */
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
@keyframes cardFadeOut {
|
|
302
|
+
0% {
|
|
303
|
+
opacity: 1;
|
|
304
|
+
transform: scale(1);
|
|
305
|
+
}
|
|
306
|
+
100% {
|
|
307
|
+
opacity: 0;
|
|
308
|
+
transform: scale(0.6); /* le form disparaît */
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
`;
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"m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,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyEjC,CAAA;AACD,CAAC;AACD,SAAS,gBAAgB;IACvB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DN,CAAC;AACJ,CAAC;AACD,SAAS,eAAe;IACtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsGN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
14
|
+
const path = require("path");
|
|
15
|
+
const collectionPath = path.join(__dirname, '../collection.json');
|
|
16
|
+
describe('login', () => {
|
|
17
|
+
it('works', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
19
|
+
const tree = yield runner.runSchematic('login', {}, schematics_1.Tree.empty());
|
|
20
|
+
expect(tree.files).toEqual([]);
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index_spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkD;AAClD,gEAAyE;AACzE,6BAA6B;AAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAElE,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,EAAE,CAAC,OAAO,EAAE,GAAS,EAAE;QACrB,MAAM,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAElE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notFound = void 0;
|
|
4
|
+
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
// You don't have to export the function as default. You can also have more than one rule factory
|
|
7
|
+
// per file.
|
|
8
|
+
function notFound(_options) {
|
|
9
|
+
const { table, projectName, parent, Config } = _options;
|
|
10
|
+
//console.log("table = ", table)
|
|
11
|
+
const componentType = "list";
|
|
12
|
+
const componentName_class = (0, strings_1.classify)(componentType) + (0, strings_1.classify)(table.table); //"Login"
|
|
13
|
+
const componentName = (0, strings_1.dasherize)(componentName_class);
|
|
14
|
+
const fullComponentName = parent + (0, strings_1.dasherize)(table.table) + "/" + componentName; // home/auteur/list-auteur
|
|
15
|
+
return (tree) => {
|
|
16
|
+
// Le composant existe dèja
|
|
17
|
+
let c_path = `/src/app/${fullComponentName}/${componentName}.component.ts`;
|
|
18
|
+
if (tree.exists(c_path)) {
|
|
19
|
+
console.warn(`Le composant ${componentName} existe dèja dans le module ${parent} : ${c_path}`);
|
|
20
|
+
return tree;
|
|
21
|
+
}
|
|
22
|
+
// le composant n'existe pas encore
|
|
23
|
+
return (0, schematics_1.chain)([
|
|
24
|
+
// création du composant
|
|
25
|
+
(0, schematics_1.externalSchematic)("@schematics/angular", "component", { project: projectName, name: fullComponentName, style: Config.style, standalone: true }),
|
|
26
|
+
// modification des fichiers
|
|
27
|
+
(tree, _context) => {
|
|
28
|
+
// modifier le fichier HTML
|
|
29
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.html`, // home/auteur/lis-auteur/list-auteur.component.html
|
|
30
|
+
get_html_content()),
|
|
31
|
+
// modifier le fichier TS
|
|
32
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.ts`, // home/auteur/lis-auteur/list-auteur.component.ts
|
|
33
|
+
get_ts_content(componentName, componentName_class, Config));
|
|
34
|
+
}
|
|
35
|
+
]);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
exports.notFound = notFound;
|
|
39
|
+
function get_html_content() {
|
|
40
|
+
return `<div class="d-flex align-items-center text-center vh-100">
|
|
41
|
+
<div class="container">
|
|
42
|
+
<h1>Page introuvable</h1>
|
|
43
|
+
<button class="btn btn-outline-secondary" (click)="backClicked()">Retourner à la page pécédente</button>
|
|
44
|
+
<br>
|
|
45
|
+
<a [routerLink]="['/']">Retourner à la page d'accueil</a>
|
|
46
|
+
</div>
|
|
47
|
+
</div>`;
|
|
48
|
+
}
|
|
49
|
+
function get_ts_content(componentName, componentName_class, Config) {
|
|
50
|
+
return `import { Component } from '@angular/core';
|
|
51
|
+
import {Location} from '@angular/common';
|
|
52
|
+
|
|
53
|
+
@Component({
|
|
54
|
+
selector: 'app-${componentName}',
|
|
55
|
+
templateUrl: './${componentName}.component.html',
|
|
56
|
+
styleUrls: ['./${componentName}.component.${Config.style}']
|
|
57
|
+
})
|
|
58
|
+
export class ${componentName_class}Component {
|
|
59
|
+
constructor(private _location: Location){
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
backClicked() {
|
|
64
|
+
this._location.back();
|
|
65
|
+
}
|
|
66
|
+
}`;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,oEAA6E;AAC7E,2DAAoG;AAGpG,iGAAiG;AACjG,YAAY;AACZ,SAAgB,QAAQ,CAAC,QAAa;IACpC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAA;IACvD,gCAAgC;IAChC,MAAM,aAAa,GAAG,MAAM,CAAA;IAC5B,MAAM,mBAAmB,GAAG,IAAA,kBAAQ,EAAC,aAAa,CAAC,GAAG,IAAA,kBAAQ,EAAC,KAAK,CAAC,KAAK,CAAC,CAAA,CAAA,SAAS;IACpF,MAAM,aAAa,GAAG,IAAA,mBAAS,EAAC,mBAAmB,CAAC,CAAA;IACpD,MAAM,iBAAiB,GAAG,MAAM,GAAG,IAAA,mBAAS,EAAC,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,aAAa,CAAA,CAAC,0BAA0B;IAC1G,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,2BAA2B;QAC3B,IAAI,MAAM,GAAG,YAAY,iBAAiB,IAAI,aAAa,eAAe,CAAA;QAC1E,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;YACvB,OAAO,CAAC,IAAI,CAAC,gBAAgB,aAAa,+BAA+B,MAAM,MAAM,MAAM,EAAE,CAAC,CAAA;YAC9F,OAAO,IAAI,CAAA;SACZ;QAED,mCAAmC;QACnC,OAAO,IAAA,kBAAK,EAAC;YACX,wBAAwB;YACxB,IAAA,8BAAiB,EAAC,qBAAqB,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;YAC/I,4BAA4B;YAC5B,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;gBACzC,2BAA2B;gBAC3B,IAAI,CAAC,SAAS,CACZ,WAAW,iBAAiB,IAAI,aAAa,iBAAiB,EAAE,oDAAoD;gBACpH,gBAAgB,EAAE,CACnB;oBACC,yBAAyB;oBACzB,IAAI,CAAC,SAAS,CACZ,WAAW,iBAAiB,IAAI,aAAa,eAAe,EAAE,kDAAkD;oBAChH,cAAc,CAAC,aAAa,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAC3D,CAAA;YACL,CAAC;SACF,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC;AAlCD,4BAkCC;AACD,SAAS,gBAAgB;IACvB,OAAO;;;;;;;OAOF,CAAA;AACP,CAAC;AACD,SAAS,cAAc,CAAC,aAAqB,EAAE,mBAA2B,EAAE,MAAW;IACrF,OAAO;;;;mBAIU,aAAa;oBACZ,aAAa;mBACd,aAAa,cAAc,MAAM,CAAC,KAAK;;eAE3C,mBAAmB;;;;;;;;EAQhC,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
14
|
+
const path = require("path");
|
|
15
|
+
const collectionPath = path.join(__dirname, '../collection.json');
|
|
16
|
+
describe('component/not-found', () => {
|
|
17
|
+
it('works', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
19
|
+
const tree = yield runner.runSchematic('component/not-found', {}, schematics_1.Tree.empty());
|
|
20
|
+
expect(tree.files).toEqual([]);
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index_spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkD;AAClD,gEAAyE;AACzE,6BAA6B;AAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAElE,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,OAAO,EAAE,GAAS,EAAE;QACrB,MAAM,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,qBAAqB,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAEhF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|