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.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0B,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,kCAkCC;AACD,SAAS,gBAAgB;IACvB,OAAO;;;;;;;;;OASF,CAAA;AACP,CAAC;AACD,SAAS,cAAc,CAAC,aAAqB,EAAE,mBAA2B,EAAE,MAAW;IACrF,OAAO;;;;;;mBAMU,aAAa;;;oBAGZ,aAAa;mBACd,aAAa,cAAc,MAAM,CAAC,KAAK;;eAE3C,mBAAmB;;;;;;;;;;;;;;;;;;;;;;EAsBhC,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/deconnexion', () => {
|
|
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/deconnexion', {}, 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,uBAAuB,EAAE,GAAG,EAAE;IACrC,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,uBAAuB,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAElF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.details = void 0;
|
|
4
|
+
// You don't have to export the function as default. You can also have more than one rule factory
|
|
5
|
+
// per file.
|
|
6
|
+
function details(_options) {
|
|
7
|
+
return (tree, _context) => {
|
|
8
|
+
return tree;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
exports.details = details;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAGA,iGAAiG;AACjG,YAAY;AACZ,SAAgB,OAAO,CAAC,QAAa;IACnC,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAJD,0BAIC"}
|
|
@@ -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('details', () => {
|
|
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('details', {}, 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,SAAS,EAAE,GAAG,EAAE;IACvB,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,SAAS,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAEpE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.edit = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
6
|
+
const edit_ts_1 = require("../../templates/edit/edit.ts");
|
|
7
|
+
const edit_html_1 = require("../../templates/edit/edit.html");
|
|
8
|
+
const test_ts_js_1 = require("../../templates/test/test.ts.js");
|
|
9
|
+
// You don't have to export the function as default. You can also have more than one rule factory
|
|
10
|
+
// per file.
|
|
11
|
+
function edit(options) {
|
|
12
|
+
const { table, projectName, parent, Config } = options;
|
|
13
|
+
const componentType = "edit";
|
|
14
|
+
const componentName_class = (0, strings_1.classify)(componentType) + (0, strings_1.classify)(table.table); //"ListLivre"
|
|
15
|
+
const componentName = (0, strings_1.dasherize)(componentName_class);
|
|
16
|
+
const fullComponentName = parent + (0, strings_1.dasherize)(table.table) + "/" + componentName; // /home/auteur/list-auteur
|
|
17
|
+
return (tree) => {
|
|
18
|
+
// Le composant existe dèja
|
|
19
|
+
let c_path = `/src/app/${fullComponentName}/${componentName}.component.ts`;
|
|
20
|
+
if (tree.exists(c_path)) {
|
|
21
|
+
console.warn(`Le composant ${componentName} existe dèja dans le module ${parent} : ${c_path}`);
|
|
22
|
+
if (Config.forcer) {
|
|
23
|
+
console.warn("Forcer la Mise à jour du composant ...");
|
|
24
|
+
return (0, schematics_1.chain)([
|
|
25
|
+
// modification des fichiers
|
|
26
|
+
(tree, _context) => {
|
|
27
|
+
// modifier le fichier HTML
|
|
28
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.html`, // home/auteur/lis-auteur/list-auteur.component.html
|
|
29
|
+
(0, edit_html_1.get_html_content)(table));
|
|
30
|
+
// modifier le fichier TS
|
|
31
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.ts`, // home/auteur/lis-auteur/list-auteur.component.ts
|
|
32
|
+
(0, edit_ts_1.get_ts_content)(table, componentName_class, componentName, Config));
|
|
33
|
+
// modifier le fichier TS de test
|
|
34
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.spec.ts`, // home/auteur/lis-auteur/list-auteur.component.spec.ts
|
|
35
|
+
(0, test_ts_js_1.get_ts_test_edit_content)(componentName_class));
|
|
36
|
+
}
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return tree;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// le composant n'existe pas encore
|
|
44
|
+
return (0, schematics_1.chain)([
|
|
45
|
+
// création du composant
|
|
46
|
+
(0, schematics_1.externalSchematic)("@schematics/angular", "component", { project: projectName, name: fullComponentName, style: Config.style, standalone: true }),
|
|
47
|
+
// modification des fichiers
|
|
48
|
+
(tree, _context) => {
|
|
49
|
+
// modifier le fichier HTML
|
|
50
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.html`, // home/auteur/lis-auteur/list-auteur.component.html
|
|
51
|
+
(0, edit_html_1.get_html_content)(table));
|
|
52
|
+
// modifier le fichier TS
|
|
53
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.ts`, // home/auteur/lis-auteur/list-auteur.component.ts
|
|
54
|
+
(0, edit_ts_1.get_ts_content)(table, componentName_class, componentName, Config));
|
|
55
|
+
// modifier le fichier TS de test
|
|
56
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.spec.ts`, // home/auteur/lis-auteur/list-auteur.component.spec.ts
|
|
57
|
+
(0, test_ts_js_1.get_ts_test_edit_content)(componentName_class));
|
|
58
|
+
}
|
|
59
|
+
]);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
exports.edit = edit;
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,2DAAoG;AACpG,oEAA6E;AAC7E,0DAA8D;AAC9D,8DAAkE;AAClE,gEAA2E;AAG3E,iGAAiG;AACjG,YAAY;AACZ,SAAgB,IAAI,CAAC,OAAY;IAC/B,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;IACtD,MAAM,aAAa,GAAG,MAAM,CAAA;IAC5B,MAAM,mBAAmB,GAAG,IAAA,kBAAQ,EAAC,aAAa,CAAC,GAAG,IAAA,kBAAQ,EAAC,KAAK,CAAC,KAAK,CAAC,CAAA,CAAA,aAAa;IACxF,MAAM,aAAa,GAAG,IAAA,mBAAS,EAAC,mBAAmB,CAAC,CAAA;IACpD,MAAM,iBAAiB,GAAG,MAAM,GAAG,IAAA,mBAAS,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AiB,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,IAAA,4BAAgB,EAAC,KAAK,CAAC,CACxB,CAAA;gBACD,yBAAyB;gBACzB,IAAI,CAAC,SAAS,CACZ,WAAW,iBAAiB,IAAI,aAAa,eAAe,EAAE,kDAAkD;gBAChH,IAAA,wBAAc,EAAC,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,CAAC,CAClE,CAAA;gBACD,iCAAiC;gBACjC,IAAI,CAAC,SAAS,CACZ,WAAW,iBAAiB,IAAI,aAAa,oBAAoB,EAAE,uDAAuD;gBAC1H,IAAA,qCAAwB,EAAC,mBAAmB,CAAC,CAC9C,CAAA;YACH,CAAC;SACF,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC;AA9DD,oBA8DC"}
|
|
@@ -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('edit', () => {
|
|
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('edit', {}, 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,MAAM,EAAE,GAAG,EAAE;IACpB,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,MAAM,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAEjE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.header = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
6
|
+
function header(options) {
|
|
7
|
+
const { projectName, style = 'scss' } = options;
|
|
8
|
+
const name = 'header';
|
|
9
|
+
const componentName = (0, strings_1.dasherize)(name);
|
|
10
|
+
const fullComponentName = "home/home/" + componentName; // src/app/header
|
|
11
|
+
// const componentClass = classify(componentName);
|
|
12
|
+
return (tree) => {
|
|
13
|
+
const c_path = `/src/app/${fullComponentName}/${componentName}.component.ts`;
|
|
14
|
+
if (tree.exists(c_path)) {
|
|
15
|
+
console.warn(`⚠️ Le composant ${componentName} existe déjà : ${c_path}`);
|
|
16
|
+
return tree;
|
|
17
|
+
}
|
|
18
|
+
return (0, schematics_1.chain)([
|
|
19
|
+
// 1️⃣ Création du composant Angular
|
|
20
|
+
(0, schematics_1.externalSchematic)('@schematics/angular', 'component', {
|
|
21
|
+
name: fullComponentName,
|
|
22
|
+
project: projectName,
|
|
23
|
+
style,
|
|
24
|
+
standalone: true
|
|
25
|
+
}),
|
|
26
|
+
// 2️⃣ Écrasement du contenu avec ton template personnalisé
|
|
27
|
+
(tree) => {
|
|
28
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.html`, get_html_content());
|
|
29
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.${style}`, get_css_content());
|
|
30
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.ts`, get_ts_content(style));
|
|
31
|
+
}
|
|
32
|
+
]);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
exports.header = header;
|
|
36
|
+
// 🧩 --- Templates ---
|
|
37
|
+
function get_html_content() {
|
|
38
|
+
return `<!-- header.component.html -->
|
|
39
|
+
<header class="top-header">
|
|
40
|
+
<div class="header-left">
|
|
41
|
+
<button class="burger-menu d-lg-none" (click)="isMobileMenuOpen = true">
|
|
42
|
+
<i class="bi bi-list"></i>
|
|
43
|
+
</button>
|
|
44
|
+
<span class="badge bg-light text-dark border">
|
|
45
|
+
<i class="bi bi-box-seam me-1 text-primary"></i>
|
|
46
|
+
V{{ "1.2.0" }}
|
|
47
|
+
</span>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="header-right">
|
|
51
|
+
<div class="dropdown">
|
|
52
|
+
<div class="icon-btn" data-bs-toggle="dropdown" aria-expanded="false">
|
|
53
|
+
<i class="bi bi-bell">
|
|
54
|
+
<sup>{{"44"}}</sup>
|
|
55
|
+
</i>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="dropdown-menu dropdown-menu-end shadow-lg notification-panel border-0">
|
|
58
|
+
<div class="p-3 border-bottom">
|
|
59
|
+
<h6 class="m-0">Notifications</h6>
|
|
60
|
+
</div>
|
|
61
|
+
<div class="notification-list" style="max-height: 300px;overflow: auto;">
|
|
62
|
+
@for (one_notification of
|
|
63
|
+
[{titre:"Alert",lu:false,id:1,created_at:""},{titre:"Chitari",lu:false,id:1,created_at:""}]; track
|
|
64
|
+
one_notification) {
|
|
65
|
+
@if (one_notification?.lu == false) {
|
|
66
|
+
<div class="d-flex gap-3 p-3 border-bottom align-items-center"
|
|
67
|
+
style="cursor: pointer;">
|
|
68
|
+
<div class="notif-avatar">
|
|
69
|
+
<i class="bi fs-5 bi-chat-dots"></i>
|
|
70
|
+
</div>
|
|
71
|
+
<div class="notif-content">
|
|
72
|
+
<p class="m-0 small fw-bold">{{ one_notification.titre }}</p>
|
|
73
|
+
<!-- <small class="text-muted">{{ api.format_date(one_notification?.created_at).time_from_now }}</small> -->
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
</div>
|
|
79
|
+
<div class="text-center py-2 " style="cursor: pointer;">
|
|
80
|
+
<a class="">Voire tout</a>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div class="dropdown">
|
|
86
|
+
<div class="user-pill d-flex align-items-center gap-2" data-bs-toggle="dropdown" aria-expanded="false">
|
|
87
|
+
<span class="user-name d-none d-md-block">{{api.token?.user_connected?.prenom+"
|
|
88
|
+
"+api.token?.user_connected?.nom}}</span>
|
|
89
|
+
<div class="avatar">
|
|
90
|
+
<img [src]="'https://i.pravatar.cc/300'" />
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
<ul class="dropdown-menu dropdown-menu-end profile-dropdown shadow-lg border-0 mt-2">
|
|
94
|
+
<li><a class="dropdown-item py-2" routerLink="/home/profil"><i class="bi bi-person me-2"></i> Profil</a>
|
|
95
|
+
</li>
|
|
96
|
+
<li>
|
|
97
|
+
<a class="dropdown-item py-2 d-flex justify-content-between align-items-center" type="button">
|
|
98
|
+
<span><i class="bi bi-bell-fill me-2"></i> Notifications</span>
|
|
99
|
+
<div class="form-check form-switch ms-2">
|
|
100
|
+
<input class="form-check-input" type="checkbox" role="switch" checked>
|
|
101
|
+
</div>
|
|
102
|
+
</a>
|
|
103
|
+
</li>
|
|
104
|
+
<li>
|
|
105
|
+
<hr class="dropdown-divider">
|
|
106
|
+
</li>
|
|
107
|
+
<li (click)="logout()"><a class="dropdown-item py-2 text-danger btn"><i class="bi bi-box-arrow-right me-2"></i> Déconnexion</a>
|
|
108
|
+
</li>
|
|
109
|
+
</ul>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</header>
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
function get_css_content() {
|
|
116
|
+
return `/* header.component.scss */
|
|
117
|
+
$header-height: 70px;
|
|
118
|
+
$header-width: 94vw;
|
|
119
|
+
$primary: #233c6c; // Nouvelle couleur primaire
|
|
120
|
+
|
|
121
|
+
:host {
|
|
122
|
+
--bg-main: #fcfcfc;
|
|
123
|
+
--bg-sidebar: #ffffff;
|
|
124
|
+
--text-main: #333333;
|
|
125
|
+
--border-color: #ececec;
|
|
126
|
+
--bg-elements: #f5f5f5;
|
|
127
|
+
display: block;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:host-context(body.dark-mode) {
|
|
131
|
+
--bg-main: #121212;
|
|
132
|
+
--bg-sidebar: #1a1a1a;
|
|
133
|
+
--text-main: #e0e0e0;
|
|
134
|
+
--border-color: #2d2d2d;
|
|
135
|
+
--bg-elements: #2d2d2d;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
.top-header {
|
|
142
|
+
height: $header-height;
|
|
143
|
+
padding: 0 1rem;
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
justify-content: space-between;
|
|
147
|
+
background: var(--bg-main);
|
|
148
|
+
border-bottom: 1px solid var(--border-color);
|
|
149
|
+
flex-shrink: 0;
|
|
150
|
+
|
|
151
|
+
.badge-version {
|
|
152
|
+
font-size: 0.7rem;
|
|
153
|
+
font-family: monospace;
|
|
154
|
+
background: var(--bg-elements);
|
|
155
|
+
color: #888;
|
|
156
|
+
padding: 4px 10px;
|
|
157
|
+
border-radius: 6px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.header-right {
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
gap: 15px;
|
|
164
|
+
|
|
165
|
+
.icon-btn {
|
|
166
|
+
position: relative;
|
|
167
|
+
font-size: 1.3rem;
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
width: auto;
|
|
170
|
+
padding: 4px;
|
|
171
|
+
height: 42px;
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: center;
|
|
175
|
+
border-radius: 12px;
|
|
176
|
+
border: 1px solid var(--border-color);
|
|
177
|
+
background: var(--bg-sidebar);
|
|
178
|
+
|
|
179
|
+
.dot {
|
|
180
|
+
position: absolute;
|
|
181
|
+
top: 10px;
|
|
182
|
+
right: 10px;
|
|
183
|
+
width: 8px;
|
|
184
|
+
height: 8px;
|
|
185
|
+
background: $primary;
|
|
186
|
+
border-radius: 50%;
|
|
187
|
+
border: 2px solid var(--bg-sidebar);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.user-pill {
|
|
192
|
+
cursor: pointer;
|
|
193
|
+
display: flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
gap: 12px;
|
|
196
|
+
padding: 6px 12px;
|
|
197
|
+
background: var(--bg-sidebar);
|
|
198
|
+
border-radius: 12px;
|
|
199
|
+
border: 1px solid var(--border-color);
|
|
200
|
+
|
|
201
|
+
.user-name {
|
|
202
|
+
font-weight: 600;
|
|
203
|
+
font-size: 0.9rem;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.avatar {
|
|
207
|
+
width: 32px;
|
|
208
|
+
height: 32px;
|
|
209
|
+
border-radius: 8px;
|
|
210
|
+
overflow: hidden;
|
|
211
|
+
|
|
212
|
+
img {
|
|
213
|
+
width: 100%;
|
|
214
|
+
height: 100%;
|
|
215
|
+
object-fit: cover;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
/* DROPDOWNS */
|
|
225
|
+
.dropdown-menu {
|
|
226
|
+
background: var(--bg-sidebar) !important;
|
|
227
|
+
border: 1px solid var(--border-color) !important;
|
|
228
|
+
border-radius: 14px !important;
|
|
229
|
+
padding: 8px !important;
|
|
230
|
+
z-index: 1200;
|
|
231
|
+
|
|
232
|
+
.dropdown-item {
|
|
233
|
+
color: var(--text-main) !important;
|
|
234
|
+
border-radius: 8px;
|
|
235
|
+
|
|
236
|
+
&:hover {
|
|
237
|
+
background: var(--bg-elements) !important;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.dropdown-divider {
|
|
242
|
+
border-color: var(--border-color);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.notification-panel {
|
|
247
|
+
width: 300px;
|
|
248
|
+
padding: 0 !important;
|
|
249
|
+
|
|
250
|
+
.notif-avatar {
|
|
251
|
+
width: 35px;
|
|
252
|
+
height: 35px;
|
|
253
|
+
background: rgba($primary, 0.1);
|
|
254
|
+
border-radius: 8px;
|
|
255
|
+
display: flex;
|
|
256
|
+
align-items: center;
|
|
257
|
+
justify-content: center;
|
|
258
|
+
font-weight: bold;
|
|
259
|
+
color: $primary;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
`;
|
|
263
|
+
}
|
|
264
|
+
function get_ts_content(style) {
|
|
265
|
+
return `import { Component, signal } from '@angular/core';
|
|
266
|
+
import { RouterLink,Router } from '@angular/router';
|
|
267
|
+
import { ApiService } from '../../../service/api/api.service';
|
|
268
|
+
|
|
269
|
+
@Component({
|
|
270
|
+
selector: 'app-header',
|
|
271
|
+
standalone: true,
|
|
272
|
+
imports: [RouterLink],
|
|
273
|
+
templateUrl: './header.component.html',
|
|
274
|
+
styleUrl: './header.component.${style}'
|
|
275
|
+
})
|
|
276
|
+
export class Header {
|
|
277
|
+
navCollapsed!: boolean;
|
|
278
|
+
navCollapsedMob!: boolean;
|
|
279
|
+
isDarkMode = false;
|
|
280
|
+
isMobileMenuOpen = false;
|
|
281
|
+
loading_logout_logout = signal(false)
|
|
282
|
+
|
|
283
|
+
constructor(public api:ApiService,private route:Router) {
|
|
284
|
+
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
async logout() {
|
|
288
|
+
this.loading_logout_logout.set(true);
|
|
289
|
+
try {
|
|
290
|
+
const reponse = await this.api.api_post("logout", {});
|
|
291
|
+
if (reponse && reponse.success) {
|
|
292
|
+
console.log("Opération effectuée avec succés sur la table logout. Réponse= ", reponse);
|
|
293
|
+
this.api.delete_from_local_storage("token");
|
|
294
|
+
this.api.Swal_success(reponse.message || "Déconnexion éffectuée avec succés");
|
|
295
|
+
this.route.navigate(['/public']);
|
|
296
|
+
} else {
|
|
297
|
+
console.log("L'opération sur la table logout a échoué. Réponse= ", reponse);
|
|
298
|
+
this.api.Swal_error(reponse?.message || "L'opération a echoué");
|
|
299
|
+
}
|
|
300
|
+
} catch (error: any) {
|
|
301
|
+
console.error(error);
|
|
302
|
+
this.api.Swal_error(error?.error?.message || "L'opération a echoué");
|
|
303
|
+
} finally {
|
|
304
|
+
this.loading_logout_logout.set(false);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
`;
|
|
310
|
+
}
|
|
311
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,2DAAkF;AAClF,oEAAoE;AAEpE,SAAgB,MAAM,CAAC,OAAY;IACjC,MAAM,EAAE,WAAW,EAAE,KAAK,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;IAChD,MAAM,IAAI,GAAG,QAAQ,CAAC;IACtB,MAAM,aAAa,GAAG,IAAA,mBAAS,EAAC,IAAI,CAAC,CAAC;IACtC,MAAM,iBAAiB,GAAG,YAAY,GAAC,aAAa,CAAC,CAAC,iBAAiB;IACzE,oDAAoD;IAElD,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,MAAM,MAAM,GAAG,YAAY,iBAAiB,IAAI,aAAa,eAAe,CAAC;QAE7E,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;YACvB,OAAO,CAAC,IAAI,CAAC,mBAAmB,aAAa,kBAAkB,MAAM,EAAE,CAAC,CAAC;YACzE,OAAO,IAAI,CAAC;SACb;QAED,OAAO,IAAA,kBAAK,EAAC;YACX,oCAAoC;YACpC,IAAA,8BAAiB,EAAC,qBAAqB,EAAE,WAAW,EAAE;gBACpD,IAAI,EAAE,iBAAiB;gBACvB,OAAO,EAAE,WAAW;gBACpB,KAAK;gBACL,UAAU,EAAE,IAAI;aACjB,CAAC;YAEF,2DAA2D;YAC3D,CAAC,IAAU,EAAE,EAAE;gBACb,IAAI,CAAC,SAAS,CACZ,WAAW,iBAAiB,IAAI,aAAa,iBAAiB,EAC9D,gBAAgB,EAAE,CACnB,CAAC;gBAEF,IAAI,CAAC,SAAS,CACZ,WAAW,iBAAiB,IAAI,aAAa,cAAc,KAAK,EAAE,EAClE,eAAe,EAAE,CAClB,CAAC;gBAEF,IAAI,CAAC,SAAS,CACZ,WAAW,iBAAiB,IAAI,aAAa,eAAe,EAC5D,cAAc,CAAC,KAAK,CAAC,CACtB,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AA3CD,wBA2CC;AAED,uBAAuB;AAEvB,SAAS,gBAAgB;IACvB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ER,CAAC;AACF,CAAC;AAED,SAAS,eAAe;IACtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkJR,CAAC;AACF,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO;;;;;;;;;kCASyB,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCtC,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.list = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
6
|
+
const list_html_1 = require("../../templates/list/list.html");
|
|
7
|
+
const list_ts_1 = require("../../templates/list/list.ts");
|
|
8
|
+
const test_ts_1 = require("../../templates/test/test.ts");
|
|
9
|
+
// You don't have to export the function as default. You can also have more than one rule factory
|
|
10
|
+
// per file.
|
|
11
|
+
function list(options) {
|
|
12
|
+
const { table, projectName, parent, Config } = options;
|
|
13
|
+
//console.log("table = ", table)
|
|
14
|
+
const componentType = "list";
|
|
15
|
+
const componentName_class = (0, strings_1.classify)(componentType) + (0, strings_1.classify)(table.table); //"ListLivre"
|
|
16
|
+
const componentName = (0, strings_1.dasherize)(componentName_class);
|
|
17
|
+
const fullComponentName = parent + (0, strings_1.dasherize)(table.table) + "/" + componentName; // /home/auteur/list-auteur
|
|
18
|
+
return (tree) => {
|
|
19
|
+
// Le composant existe dèja
|
|
20
|
+
let c_path = `/src/app/${fullComponentName}/${componentName}.component.ts`;
|
|
21
|
+
if (tree.exists(c_path)) {
|
|
22
|
+
console.warn(`Le composant ${componentName} existe dèja dans le module ${parent} : ${c_path}`);
|
|
23
|
+
if (Config.forcer) {
|
|
24
|
+
console.warn("Forcer la Mise à jour du composant ...");
|
|
25
|
+
return (0, schematics_1.chain)([
|
|
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
|
+
(0, list_html_1.get_html_content)(table));
|
|
31
|
+
// modifier le fichier TS
|
|
32
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.ts`, // home/auteur/lis-auteur/list-auteur.component.ts
|
|
33
|
+
(0, list_ts_1.get_ts_content)(table, componentName_class, componentName, Config));
|
|
34
|
+
// modifier le fichier TS de test
|
|
35
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.spec.ts`, // home/auteur/lis-auteur/list-auteur.component.spec.ts
|
|
36
|
+
(0, test_ts_1.get_ts_test_list_content)(componentName_class));
|
|
37
|
+
}
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return tree;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// le composant n'existe pas encore
|
|
45
|
+
return (0, schematics_1.chain)([
|
|
46
|
+
// création du composant
|
|
47
|
+
(0, schematics_1.externalSchematic)("@schematics/angular", "component", { project: projectName, name: fullComponentName, style: Config.style, standalone: true }),
|
|
48
|
+
// modification des fichiers
|
|
49
|
+
(tree, _context) => {
|
|
50
|
+
// modifier le fichier HTML
|
|
51
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.html`, // home/auteur/lis-auteur/list-auteur.component.html
|
|
52
|
+
(0, list_html_1.get_html_content)(table));
|
|
53
|
+
// modifier le fichier TS
|
|
54
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.ts`, // home/auteur/lis-auteur/list-auteur.component.ts
|
|
55
|
+
(0, list_ts_1.get_ts_content)(table, componentName_class, componentName, Config));
|
|
56
|
+
// modifier le fichier TS de test
|
|
57
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.spec.ts`, // home/auteur/lis-auteur/list-auteur.component.spec.ts
|
|
58
|
+
(0, test_ts_1.get_ts_test_list_content)(componentName_class));
|
|
59
|
+
}
|
|
60
|
+
]);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
exports.list = list;
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,2DAAoG;AACpG,oEAA6E;AAC7E,8DAAkE;AAClE,0DAA8D;AAC9D,0DAAwE;AAGxE,iGAAiG;AACjG,YAAY;AACZ,SAAgB,IAAI,CAAC,OAAY;IAC/B,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;IACtD,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,aAAa;IAC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;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,IAAA,4BAAgB,EAAC,KAAK,CAAC,CACxB,CAAA;gBACD,yBAAyB;gBACzB,IAAI,CAAC,SAAS,CACZ,WAAW,iBAAiB,IAAI,aAAa,eAAe,EAAE,kDAAkD;gBAChH,IAAA,wBAAc,EAAC,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,CAAC,CAClE,CAAA;gBACD,iCAAiC;gBACjC,IAAI,CAAC,SAAS,CACZ,WAAW,iBAAiB,IAAI,aAAa,oBAAoB,EAAE,uDAAuD;gBAC1H,IAAA,kCAAwB,EAAC,mBAAmB,CAAC,CAC9C,CAAA;YACH,CAAC;SACF,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC;AA/DD,oBA+DC"}
|
|
@@ -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('list', () => {
|
|
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('list', {}, 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,MAAM,EAAE,GAAG,EAAE;IACpB,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,MAAM,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAEjE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|