@stherrienaspnet/angular-datatables 0.0.0-stage → 21.0.0

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.
Files changed (31) hide show
  1. package/fesm2022/stherrienaspnet-angular-datatables.mjs +190 -0
  2. package/fesm2022/stherrienaspnet-angular-datatables.mjs.map +1 -0
  3. package/package.json +48 -3
  4. package/schematics/src/collection.json +11 -0
  5. package/schematics/src/ng-add/index.d.ts +3 -0
  6. package/schematics/src/ng-add/index.js +69 -0
  7. package/schematics/src/ng-add/index.js.map +1 -0
  8. package/schematics/src/ng-add/models/schematics-options.d.ts +5 -0
  9. package/schematics/src/ng-add/models/schematics-options.js +3 -0
  10. package/schematics/src/ng-add/models/schematics-options.js.map +1 -0
  11. package/schematics/src/ng-add/models/style-options.d.ts +19 -0
  12. package/schematics/src/ng-add/models/style-options.js +52 -0
  13. package/schematics/src/ng-add/models/style-options.js.map +1 -0
  14. package/schematics/src/ng-add/schema.json +41 -0
  15. package/schematics/src/ng-add/utils/get-file-content.d.ts +2 -0
  16. package/schematics/src/ng-add/utils/get-file-content.js +12 -0
  17. package/schematics/src/ng-add/utils/get-file-content.js.map +1 -0
  18. package/schematics/src/ng-add/utils/index.d.ts +17 -0
  19. package/schematics/src/ng-add/utils/index.js +71 -0
  20. package/schematics/src/ng-add/utils/index.js.map +1 -0
  21. package/schematics/src/ng-add/utils/ng-module-imports.d.ts +12 -0
  22. package/schematics/src/ng-add/utils/ng-module-imports.js +70 -0
  23. package/schematics/src/ng-add/utils/ng-module-imports.js.map +1 -0
  24. package/schematics/src/ng-add/utils/project-main-file.d.ts +10 -0
  25. package/schematics/src/ng-add/utils/project-main-file.js +22 -0
  26. package/schematics/src/ng-add/utils/project-main-file.js.map +1 -0
  27. package/schematics/src/ng-add/utils/project-targets.d.ts +10 -0
  28. package/schematics/src/ng-add/utils/project-targets.js +25 -0
  29. package/schematics/src/ng-add/utils/project-targets.js.map +1 -0
  30. package/types/stherrienaspnet-angular-datatables.d.ts +77 -0
  31. package/README.md +0 -3
@@ -0,0 +1,190 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Input, Directive, NgModule } from '@angular/core';
3
+ import 'rxjs';
4
+ import { CommonModule } from '@angular/common';
5
+
6
+ /**
7
+ * @license
8
+ *
9
+ * Use of this source code is governed by an MIT-style license that can be
10
+ * found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE
11
+ */
12
+ class DataTableDirective {
13
+ constructor(el, vcr, renderer) {
14
+ this.el = el;
15
+ this.vcr = vcr;
16
+ this.renderer = renderer;
17
+ /**
18
+ * The DataTable option you pass to configure your table.
19
+ */
20
+ this.dtOptions = {};
21
+ }
22
+ ngOnInit() {
23
+ if (this.dtTrigger) {
24
+ this.dtTrigger.subscribe((options) => {
25
+ this.displayTable(options);
26
+ });
27
+ }
28
+ else {
29
+ this.displayTable(null);
30
+ }
31
+ }
32
+ ngOnDestroy() {
33
+ if (this.dtTrigger) {
34
+ this.dtTrigger.unsubscribe();
35
+ }
36
+ if (this.dt) {
37
+ this.dt.destroy(true);
38
+ }
39
+ }
40
+ displayTable(dtOptions) {
41
+ // assign new options if provided
42
+ if (dtOptions) {
43
+ this.dtOptions = dtOptions;
44
+ }
45
+ this.dtInstance = new Promise((resolve, reject) => {
46
+ Promise.resolve(this.dtOptions).then(resolvedDTOptions => {
47
+ // validate object
48
+ const isTableEmpty = Object.keys(resolvedDTOptions).length === 0 && $('tbody tr', this.el.nativeElement).length === 0;
49
+ if (isTableEmpty) {
50
+ reject('Both the table and dtOptions cannot be empty');
51
+ return;
52
+ }
53
+ // Set a column unique
54
+ if (resolvedDTOptions.columns) {
55
+ resolvedDTOptions.columns.forEach(col => {
56
+ if ((col.id ?? '').trim() === '') {
57
+ col.id = this.getColumnUniqueId();
58
+ }
59
+ });
60
+ }
61
+ // Using setTimeout as a "hack" to be "part" of NgZone
62
+ setTimeout(() => {
63
+ // Assign DT properties here
64
+ const directive = this;
65
+ let options = {
66
+ rowCallback: function (row, data, index) {
67
+ if (resolvedDTOptions.columns) {
68
+ const columns = resolvedDTOptions.columns;
69
+ directive.applyNgPipeTransform(row, columns);
70
+ directive.applyNgRefTemplate(row, columns, data);
71
+ }
72
+ // run user specified row callback if provided.
73
+ if (resolvedDTOptions.rowCallback) {
74
+ resolvedDTOptions.rowCallback.call(this, row, data, index);
75
+ }
76
+ }
77
+ };
78
+ // merge user's config with ours
79
+ options = Object.assign({}, resolvedDTOptions, options);
80
+ this.dt = $(this.el.nativeElement).DataTable(options);
81
+ resolve(this.dt);
82
+ });
83
+ });
84
+ });
85
+ }
86
+ applyNgPipeTransform(row, columns) {
87
+ // Filter columns with pipe declared
88
+ const colsWithPipe = columns.filter(x => x.ngPipeInstance && !x.ngTemplateRef);
89
+ colsWithPipe.forEach(el => {
90
+ const pipe = el.ngPipeInstance;
91
+ const pipeArgs = el.ngPipeArgs || [];
92
+ // find index of column using `data` attr
93
+ const i = columns.filter(c => c.visible !== false).findIndex(e => e.id === el.id);
94
+ // get <td> element which holds data using index
95
+ const rowFromCol = row.childNodes.item(i);
96
+ // Transform data with Pipe and PipeArgs
97
+ const rowVal = $(rowFromCol).text();
98
+ const rowValAfter = pipe.transform(rowVal, ...pipeArgs);
99
+ // Apply transformed string to <td>
100
+ $(rowFromCol).text(rowValAfter);
101
+ });
102
+ }
103
+ applyNgRefTemplate(row, columns, data) {
104
+ // Filter columns using `ngTemplateRef`
105
+ const colsWithTemplate = columns.filter(x => x.ngTemplateRef && !x.ngPipeInstance);
106
+ colsWithTemplate.forEach(el => {
107
+ const { ref, context } = el.ngTemplateRef;
108
+ // get <td> element which holds data using index
109
+ const i = columns.filter(c => c.visible !== false).findIndex(e => e.id === el.id);
110
+ const cellFromIndex = row.childNodes.item(i);
111
+ // reset cell before applying transform
112
+ $(cellFromIndex).html('');
113
+ // render onto DOM
114
+ // finalize context to be sent to user
115
+ const _context = Object.assign({}, context, context?.userData, {
116
+ adtData: data
117
+ });
118
+ const instance = this.vcr.createEmbeddedView(ref, _context);
119
+ this.renderer.appendChild(cellFromIndex, instance.rootNodes[0]);
120
+ });
121
+ }
122
+ getColumnUniqueId() {
123
+ let result = '';
124
+ const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
125
+ for (let i = 0; i < 6; i++) {
126
+ const randomIndex = Math.floor(Math.random() * characters.length);
127
+ result += characters.charAt(randomIndex);
128
+ }
129
+ return result.trim();
130
+ }
131
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.27", ngImport: i0, type: DataTableDirective, deps: [{ token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
132
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.27", type: DataTableDirective, isStandalone: false, selector: "[datatable]", inputs: { dtOptions: "dtOptions", dtTrigger: "dtTrigger" }, ngImport: i0 }); }
133
+ }
134
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.27", ngImport: i0, type: DataTableDirective, decorators: [{
135
+ type: Directive,
136
+ args: [{
137
+ selector: '[datatable]',
138
+ standalone: false
139
+ }]
140
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i0.Renderer2 }], propDecorators: { dtOptions: [{
141
+ type: Input
142
+ }], dtTrigger: [{
143
+ type: Input
144
+ }] } });
145
+
146
+ /**
147
+ * @license
148
+ *
149
+ * Use of this source code is governed by an MIT-style license that can be
150
+ * found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE
151
+ */
152
+ class DataTablesModule {
153
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.27", ngImport: i0, type: DataTablesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
154
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.27", ngImport: i0, type: DataTablesModule, declarations: [DataTableDirective], imports: [CommonModule], exports: [DataTableDirective] }); }
155
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.27", ngImport: i0, type: DataTablesModule, imports: [CommonModule] }); }
156
+ }
157
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.27", ngImport: i0, type: DataTablesModule, decorators: [{
158
+ type: NgModule,
159
+ args: [{
160
+ imports: [CommonModule],
161
+ declarations: [DataTableDirective],
162
+ exports: [DataTableDirective]
163
+ }]
164
+ }] });
165
+
166
+ /**
167
+ * @license
168
+ *
169
+ * Use of this source code is governed by an MIT-style license that can be
170
+ * found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE
171
+ */
172
+ /**
173
+ * @module
174
+ * @description
175
+ * Entry point from which you should import all public library APIs.
176
+ */
177
+
178
+ /**
179
+ * @license
180
+ *
181
+ * Use of this source code is governed by an MIT-style license that can be
182
+ * found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE
183
+ */
184
+
185
+ /**
186
+ * Generated bundle index. Do not edit.
187
+ */
188
+
189
+ export { DataTableDirective, DataTablesModule };
190
+ //# sourceMappingURL=stherrienaspnet-angular-datatables.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stherrienaspnet-angular-datatables.mjs","sources":["../../../lib/src/angular-datatables.directive.ts","../../../lib/src/angular-datatables.module.ts","../../../lib/public_api.ts","../../../lib/index.ts","../../../lib/stherrienaspnet-angular-datatables.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE\n */\n\nimport { Directive, ElementRef, Input, OnDestroy, OnInit, Renderer2, ViewContainerRef } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { ADTSettings, ADTColumns } from './models/settings';\nimport { Api } from 'datatables.net';\n\n@Directive({\n selector: '[datatable]',\n standalone: false\n})\nexport class DataTableDirective implements OnDestroy, OnInit {\n /**\n * The DataTable option you pass to configure your table.\n */\n @Input()\n dtOptions: ADTSettings = {};\n\n /**\n * This trigger is used if one wants to trigger manually the DT rendering\n * Useful when rendering angular rendered DOM\n */\n @Input()\n dtTrigger!: Subject<ADTSettings>;\n\n /**\n * The DataTable instance built by the jQuery library [DataTables](datatables.net).\n *\n * It's possible to execute the [DataTables APIs](https://datatables.net/reference/api/) with\n * this variable.\n */\n dtInstance!: Promise<Api>;\n\n // Only used for destroying the table when destroying this directive\n private dt!: Api;\n\n constructor(\n private el: ElementRef,\n private vcr: ViewContainerRef,\n private renderer: Renderer2\n ) { }\n\n ngOnInit(): void {\n if (this.dtTrigger) {\n this.dtTrigger.subscribe((options) => {\n this.displayTable(options);\n });\n } else {\n this.displayTable(null);\n }\n }\n\n ngOnDestroy(): void {\n if (this.dtTrigger) {\n this.dtTrigger.unsubscribe();\n }\n if (this.dt) {\n this.dt.destroy(true);\n }\n }\n\n private displayTable(dtOptions: ADTSettings | null): void {\n // assign new options if provided\n if (dtOptions) {\n this.dtOptions = dtOptions;\n }\n this.dtInstance = new Promise((resolve, reject) => {\n Promise.resolve(this.dtOptions).then(resolvedDTOptions => {\n // validate object\n const isTableEmpty = Object.keys(resolvedDTOptions).length === 0 && $('tbody tr', this.el.nativeElement).length === 0;\n if (isTableEmpty) {\n reject('Both the table and dtOptions cannot be empty');\n return;\n }\n\n // Set a column unique\n if (resolvedDTOptions.columns) {\n resolvedDTOptions.columns.forEach(col => {\n if ((col.id ?? '').trim() === '') {\n col.id = this.getColumnUniqueId();\n }\n });\n }\n\n // Using setTimeout as a \"hack\" to be \"part\" of NgZone\n setTimeout(() => {\n // Assign DT properties here\n const directive = this;\n let options: ADTSettings = {\n rowCallback: function (row, data, index) {\n if (resolvedDTOptions.columns) {\n const columns = resolvedDTOptions.columns;\n directive.applyNgPipeTransform(row, columns);\n directive.applyNgRefTemplate(row, columns, data);\n }\n\n // run user specified row callback if provided.\n if (resolvedDTOptions.rowCallback) {\n resolvedDTOptions.rowCallback.call(this, row, data, index);\n }\n }\n };\n // merge user's config with ours\n options = Object.assign({}, resolvedDTOptions, options);\n this.dt = $(this.el.nativeElement).DataTable(options);\n resolve(this.dt);\n });\n });\n });\n }\n\n private applyNgPipeTransform(row: Node, columns: ADTColumns[]): void {\n // Filter columns with pipe declared\n const colsWithPipe = columns.filter(x => x.ngPipeInstance && !x.ngTemplateRef);\n colsWithPipe.forEach(el => {\n const pipe = el.ngPipeInstance!;\n const pipeArgs = el.ngPipeArgs || [];\n // find index of column using `data` attr\n const i = columns.filter(c => c.visible !== false).findIndex(e => e.id === el.id);\n // get <td> element which holds data using index\n const rowFromCol = row.childNodes.item(i);\n // Transform data with Pipe and PipeArgs\n const rowVal = $(rowFromCol).text();\n const rowValAfter = pipe.transform(rowVal, ...pipeArgs);\n // Apply transformed string to <td>\n $(rowFromCol).text(rowValAfter);\n });\n }\n\n private applyNgRefTemplate(row: Node, columns: ADTColumns[], data: Object): void {\n // Filter columns using `ngTemplateRef`\n const colsWithTemplate = columns.filter(x => x.ngTemplateRef && !x.ngPipeInstance);\n colsWithTemplate.forEach(el => {\n const { ref, context } = el.ngTemplateRef!;\n // get <td> element which holds data using index\n const i = columns.filter(c => c.visible !== false).findIndex(e => e.id === el.id);\n const cellFromIndex = row.childNodes.item(i);\n // reset cell before applying transform\n $(cellFromIndex).html('');\n // render onto DOM\n // finalize context to be sent to user\n const _context = Object.assign({}, context, context?.userData, {\n adtData: data\n });\n const instance = this.vcr.createEmbeddedView(ref, _context);\n this.renderer.appendChild(cellFromIndex, instance.rootNodes[0]);\n });\n }\n\n private getColumnUniqueId(): string {\n let result = '';\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n\n for (let i = 0; i < 6; i++) {\n const randomIndex = Math.floor(Math.random() * characters.length);\n result += characters.charAt(randomIndex);\n }\n\n return result.trim();\n }\n\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE\n */\n\nimport { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { DataTableDirective } from './angular-datatables.directive';\n\n@NgModule({\n imports: [ CommonModule ],\n declarations: [ DataTableDirective ],\n exports: [ DataTableDirective ]\n})\nexport class DataTablesModule {}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE\n */\n\n/**\n * @module\n * @description\n * Entry point from which you should import all public library APIs.\n */\nexport { DataTableDirective } from './src/angular-datatables.directive';\nexport { DataTablesModule } from './src/angular-datatables.module';\nexport type { ADTSettings } from './src/models/settings';\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE\n */\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;AAKG;MAWU,kBAAkB,CAAA;AAyB7B,IAAA,WAAA,CACU,EAAc,EACd,GAAqB,EACrB,QAAmB,EAAA;QAFnB,IAAA,CAAA,EAAE,GAAF,EAAE;QACF,IAAA,CAAA,GAAG,GAAH,GAAG;QACH,IAAA,CAAA,QAAQ,GAAR,QAAQ;AA3BlB;;AAEG;QAEH,IAAA,CAAA,SAAS,GAAgB,EAAE;IAwBvB;IAEJ,QAAQ,GAAA;AACN,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,OAAO,KAAI;AACnC,gBAAA,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;AAC5B,YAAA,CAAC,CAAC;QACJ;aAAO;AACL,YAAA,IAAI,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AA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,EAAA,YAAA,EAAA,CAHX,kBAAkB,CAAA,EAAA,OAAA,EAAA,CADvB,YAAY,aAEZ,kBAAkB,CAAA,EAAA,CAAA,CAAA;AAElB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YAJhB,YAAY,CAAA,EAAA,CAAA,CAAA;;4FAIZ,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAL5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAE,YAAY,CAAE;oBACzB,YAAY,EAAE,CAAE,kBAAkB,CAAE;oBACpC,OAAO,EAAE,CAAE,kBAAkB;AAC9B,iBAAA;;;ACfD;;;;;AAKG;AAEH;;;;AAIG;;ACXH;;;;;AAKG;;ACLH;;AAEG;;"}
package/package.json CHANGED
@@ -1,6 +1,51 @@
1
1
  {
2
2
  "name": "@stherrienaspnet/angular-datatables",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "21.0.0",
4
+ "description": "Angular directive for DataTables",
5
+ "keywords": [
6
+ "Angular",
7
+ "DataTables"
8
+ ],
9
+ "author": "Louis LIN <lin.louis@pm.me> (https://l-lin.github.io/)",
10
+ "contributors": [
11
+ "Michael Bennett <michael@strukt.org>",
12
+ "Steven Masala <me@smasalai.com>",
13
+ "Surya Teja K <shanmukhateja@gmail.com>"
14
+ ],
15
+ "schematics": "./schematics/src/collection.json",
16
+ "license": "MIT",
17
+ "peerDependencies": {
18
+ "@angular/common": "^21.0.0",
19
+ "@angular/core": "^21.0.0",
20
+ "@angular/platform-browser": "^21.0.0",
21
+ "datatables.net": "^2.0.3",
22
+ "datatables.net-dt": "^2.0.3",
23
+ "jquery": "^3.6.0",
24
+ "rxjs": "^7.4.0",
25
+ "zone.js": "~0.16.0"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/stherrienaspnet/angular-datatables.git"
30
+ },
31
+ "bugs": {
32
+ "url": "https://github.com/stherrienaspnet/angular-datatables/issues"
33
+ },
34
+ "homepage": "https://github.com/stherrienaspnet/angular-datatables#readme",
35
+ "module": "fesm2022/stherrienaspnet-angular-datatables.mjs",
36
+ "typings": "types/stherrienaspnet-angular-datatables.d.ts",
37
+ "exports": {
38
+ "./package.json": {
39
+ "default": "./package.json"
40
+ },
41
+ ".": {
42
+ "types": "./types/stherrienaspnet-angular-datatables.d.ts",
43
+ "default": "./fesm2022/stherrienaspnet-angular-datatables.mjs"
44
+ }
45
+ },
46
+ "sideEffects": false,
47
+ "type": "module",
48
+ "dependencies": {
49
+ "tslib": "^2.3.0"
50
+ }
6
51
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "ng-add": {
5
+ "description": "Adds Angular Datatables to the application without affecting any templates",
6
+ "factory": "./ng-add/index",
7
+ "schema": "./ng-add/schema.json",
8
+ "aliases": ["install"]
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { IADTSchematicsOptions } from './models/schematics-options';
3
+ export default function (_options: IADTSchematicsOptions): Rule;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
4
+ var schematics_1 = require("@angular-devkit/schematics");
5
+ var utils_1 = require("./utils");
6
+ var tasks_1 = require("@angular-devkit/schematics/tasks");
7
+ var style_options_1 = require("./models/style-options");
8
+ function default_1(_options) {
9
+ return (0, schematics_1.chain)([
10
+ addPackageJsonDependencies(_options),
11
+ installPackageJsonDependencies(),
12
+ updateAngularJsonFile(_options)
13
+ ]);
14
+ }
15
+ function addPackageJsonDependencies(options) {
16
+ return function (tree, context) {
17
+ // Update package.json
18
+ var styleDeps = style_options_1.ADT_SUPPORTED_STYLES.find(function (e) { return e.style == options.style; });
19
+ var dependencies = [
20
+ { version: '^3.6.0', name: 'jquery', isDev: false },
21
+ { version: '^2.0.3', name: 'datatables.net', fancyName: 'datatables.net (v2)', isDev: false },
22
+ { version: '^3.5.9', name: '@types/jquery', isDev: true }
23
+ ];
24
+ if (styleDeps) {
25
+ if (styleDeps.style != style_options_1.ADTStyleOptions.DT)
26
+ context.logger.log('warn', 'Your project needs Bootstrap CSS installed and configured for changes to take affect.');
27
+ styleDeps.packageJson.forEach(function (e) { return dependencies.push(e); });
28
+ }
29
+ dependencies.forEach(function (dependency) {
30
+ var result = (0, utils_1.addPackageToPackageJson)(tree, dependency.name, dependency.version, dependency.isDev);
31
+ if (result) {
32
+ context.logger.log('info', "\u2705\uFE0F Added \"".concat(dependency.fancyName || dependency.name, "\" into \"").concat(dependency.isDev ? 'devDependencies' : 'dependencies', "\""));
33
+ }
34
+ else {
35
+ context.logger.log('info', "\u2139\uFE0F Skipped adding \"".concat(dependency.name, "\" into package.json"));
36
+ }
37
+ });
38
+ return tree;
39
+ };
40
+ }
41
+ function installPackageJsonDependencies() {
42
+ return function (host, context) {
43
+ context.addTask(new tasks_1.NodePackageInstallTask());
44
+ context.logger.log('info', "\uD83D\uDD0D Installing packages...");
45
+ return host;
46
+ };
47
+ }
48
+ function updateAngularJsonFile(options) {
49
+ return function (tree, context) {
50
+ var styleDeps = style_options_1.ADT_SUPPORTED_STYLES.find(function (e) { return e.style == options.style; });
51
+ var assets = [
52
+ { path: 'node_modules/jquery/dist/jquery.min.js', target: 'scripts', fancyName: 'jQuery Core' },
53
+ { path: 'node_modules/datatables.net/js/dataTables.min.js', target: 'scripts', fancyName: 'DataTables.net Core JS' },
54
+ ];
55
+ if (styleDeps) {
56
+ styleDeps.angularJson.forEach(function (e) { return assets.push(e); });
57
+ }
58
+ assets.forEach(function (asset) {
59
+ var result = (0, utils_1.addAssetToAngularJson)(tree, asset.target, asset.path);
60
+ if (result) {
61
+ context.logger.log('info', "\u2705\uFE0F Added \"".concat(asset.fancyName, "\" into angular.json"));
62
+ }
63
+ else {
64
+ context.logger.log('info', "\u2139\uFE0F Skipped adding \"".concat(asset.fancyName, "\" into angular.json"));
65
+ }
66
+ });
67
+ };
68
+ }
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lib/schematics/src/ng-add/index.ts"],"names":[],"mappings":";;AAMA,4BAMC;AAZD,yDAAiF;AACjF,iCAAyE;AACzE,0DAA0E;AAE1E,wDAA+E;AAE/E,mBAAyB,QAA+B;IACtD,OAAO,IAAA,kBAAK,EAAC;QACX,0BAA0B,CAAC,QAAQ,CAAC;QACpC,8BAA8B,EAAE;QAChC,qBAAqB,CAAC,QAAQ,CAAC;KAChC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,0BAA0B,CAAC,OAA8B;IAChE,OAAO,UAAC,IAAU,EAAE,OAAyB;QAC3C,sBAAsB;QACtB,IAAM,SAAS,GAAG,oCAAoB,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,EAAxB,CAAwB,CAAC,CAAC;QAE3E,IAAM,YAAY,GAAG;YACnB,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE;YACnD,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,qBAAqB,EAAE,KAAK,EAAE,KAAK,E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0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schematics-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schematics-options.js","sourceRoot":"","sources":["../../../../../../lib/schematics/src/ng-add/models/schematics-options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ export declare enum ADTStyleOptions {
2
+ DT = "dt",
3
+ BS3 = "bs3",
4
+ BS4 = "bs4",
5
+ BS5 = "bs5"
6
+ }
7
+ export declare const ADT_SUPPORTED_STYLES: {
8
+ style: ADTStyleOptions;
9
+ packageJson: {
10
+ version: string;
11
+ name: string;
12
+ isDev: boolean;
13
+ }[];
14
+ angularJson: {
15
+ path: string;
16
+ target: string;
17
+ fancyName: string;
18
+ }[];
19
+ }[];
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ADT_SUPPORTED_STYLES = exports.ADTStyleOptions = void 0;
4
+ var ADTStyleOptions;
5
+ (function (ADTStyleOptions) {
6
+ ADTStyleOptions["DT"] = "dt";
7
+ ADTStyleOptions["BS3"] = "bs3";
8
+ ADTStyleOptions["BS4"] = "bs4";
9
+ ADTStyleOptions["BS5"] = "bs5";
10
+ })(ADTStyleOptions || (exports.ADTStyleOptions = ADTStyleOptions = {}));
11
+ exports.ADT_SUPPORTED_STYLES = [
12
+ {
13
+ style: ADTStyleOptions.DT,
14
+ packageJson: [
15
+ { version: '^2.0.3', name: 'datatables.net-dt', isDev: false },
16
+ ],
17
+ angularJson: [
18
+ { path: 'node_modules/datatables.net-dt/css/jquery.dataTables.min.css', target: 'styles', fancyName: 'DataTables.net Core CSS' },
19
+ ]
20
+ },
21
+ {
22
+ style: ADTStyleOptions.BS3,
23
+ packageJson: [
24
+ { version: '^2.0.3', name: 'datatables.net-bs', isDev: false },
25
+ ],
26
+ angularJson: [
27
+ { path: 'node_modules/datatables.net-bs/css/dataTables.bootstrap.min.css', target: 'styles', fancyName: 'DataTables.net Bootstrap 3 CSS' },
28
+ { path: 'node_modules/datatables.net-bs/js/dataTables.bootstrap.min.js', target: 'scripts', fancyName: 'DataTables.net Bootstrap 3 JS' },
29
+ ]
30
+ },
31
+ {
32
+ style: ADTStyleOptions.BS4,
33
+ packageJson: [
34
+ { version: '^2.0.3', name: 'datatables.net-bs4', isDev: false },
35
+ ],
36
+ angularJson: [
37
+ { path: 'node_modules/datatables.net-bs4/css/dataTables.bootstrap4.min.css', target: 'styles', fancyName: 'DataTables.net Bootstrap 4 CSS' },
38
+ { path: 'node_modules/datatables.net-bs4/js/dataTables.bootstrap4.min.js', target: 'scripts', fancyName: 'DataTables.net Bootstrap 4 JS' },
39
+ ]
40
+ },
41
+ {
42
+ style: ADTStyleOptions.BS5,
43
+ packageJson: [
44
+ { version: '^2.0.3', name: 'datatables.net-bs5', isDev: false },
45
+ ],
46
+ angularJson: [
47
+ { path: 'node_modules/datatables.net-bs5/css/dataTables.bootstrap5.min.css', target: 'styles', fancyName: 'DataTables.net Bootstrap 5 CSS' },
48
+ { path: 'node_modules/datatables.net-bs5/js/dataTables.bootstrap5.min.js', target: 'scripts', fancyName: 'DataTables.net Bootstrap 5 JS' },
49
+ ]
50
+ },
51
+ ];
52
+ //# sourceMappingURL=style-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-options.js","sourceRoot":"","sources":["../../../../../../lib/schematics/src/ng-add/models/style-options.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,4BAAO,CAAA;IACP,8BAAS,CAAA;IACT,8BAAS,CAAA;IACT,8BAAS,CAAA;AACX,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAEY,QAAA,oBAAoB,GAAG;IAClC;QACE,KAAK,EAAE,eAAe,CAAC,EAAE;QACzB,WAAW,EAAE;YACX,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,KAAK,EAAE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 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "angular-datatables-schematic-angular-datatables",
4
+ "title": "Angular DataTables angular-datatables schematic",
5
+ "type": "object",
6
+ "properties": {
7
+ "project": {
8
+ "title": "angular-datatables",
9
+ "type": "string",
10
+ "description": "The name of the project.",
11
+ "$default": {
12
+ "$source": "projectName"
13
+ }
14
+ },
15
+ "style": {
16
+ "description": "The styling library to use for Datatables.",
17
+ "type": "string",
18
+ "default": "dt",
19
+ "enum": ["dt", "bs3", "bs4", "bs5"],
20
+ "x-prompt": {
21
+ "message": "Which styling library would you like to use for DataTables?",
22
+ "type": "list",
23
+ "items": [
24
+ { "value": "dt", "label": "DataTables (Default)" },
25
+ {
26
+ "value": "bs3",
27
+ "label": "Bootstrap 3"
28
+ },
29
+ {
30
+ "value": "bs4",
31
+ "label": "Bootstrap 4"
32
+ },
33
+ {
34
+ "value": "bs5",
35
+ "label": "Bootstrap 5"
36
+ }
37
+ ]
38
+ }
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,2 @@
1
+ import { Tree } from "@angular-devkit/schematics";
2
+ export declare function getFileContent(tree: Tree, path: string): string;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFileContent = getFileContent;
4
+ // https://github.com/angular/angular-cli/blob/16.1.x/packages/schematics/angular/utility/test/get-file-content.ts
5
+ function getFileContent(tree, path) {
6
+ var fileEntry = tree.get(path);
7
+ if (!fileEntry) {
8
+ throw new Error("The file (".concat(path, ") does not exist."));
9
+ }
10
+ return fileEntry.content.toString();
11
+ }
12
+ //# sourceMappingURL=get-file-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-file-content.js","sourceRoot":"","sources":["../../../../../../lib/schematics/src/ng-add/utils/get-file-content.ts"],"names":[],"mappings":";;AAGA,wCAQC;AATD,kHAAkH;AAClH,SAAgB,cAAc,CAAC,IAAU,EAAE,IAAY;IACrD,IAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEjC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,oBAAa,IAAI,sBAAmB,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Tree } from '@angular-devkit/schematics';
9
+ /**
10
+ * This function has been borrowed from:
11
+ * https://github.com/valor-software/ngx-bootstrap/tree/development/schematics/src/utils/index.ts
12
+ *
13
+ * Note: This function accepts an additional parameter `isDevDependency` so we
14
+ * can place a given dependency in the correct dependencies array inside package.json
15
+ */
16
+ export declare function addPackageToPackageJson(host: Tree, pkg: string, version: string, isDevDependency?: boolean): boolean;
17
+ export declare function addAssetToAngularJson(host: Tree, assetType: string, assetPath: string): boolean;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.addPackageToPackageJson = addPackageToPackageJson;
11
+ exports.addAssetToAngularJson = addAssetToAngularJson;
12
+ function sortObjectByKeys(obj) {
13
+ return Object
14
+ .keys(obj)
15
+ .sort()
16
+ /* tslint:disable-next-line: no-any */
17
+ .reduce(function (result, key) { return (result[key] = obj[key]) && result; }, {});
18
+ }
19
+ /**
20
+ * This function has been borrowed from:
21
+ * https://github.com/valor-software/ngx-bootstrap/tree/development/schematics/src/utils/index.ts
22
+ *
23
+ * Note: This function accepts an additional parameter `isDevDependency` so we
24
+ * can place a given dependency in the correct dependencies array inside package.json
25
+ */
26
+ function addPackageToPackageJson(host, pkg, version, isDevDependency) {
27
+ if (isDevDependency === void 0) { isDevDependency = false; }
28
+ if (host.exists('package.json')) {
29
+ /* tslint:disable-next-line: no-non-null-assertion */
30
+ var sourceText = host.read('package.json').toString('utf-8');
31
+ var json = JSON.parse(sourceText);
32
+ if (!json.dependencies) {
33
+ json.dependencies = {};
34
+ }
35
+ if (!json.devDependencies) {
36
+ json.dependencies = {};
37
+ }
38
+ // update UI that `pkg` wasn't re-added to package.json
39
+ if (json.dependencies[pkg] || json.devDependencies[pkg])
40
+ return false;
41
+ if (!json.dependencies[pkg] && !isDevDependency) {
42
+ json.dependencies[pkg] = version;
43
+ json.dependencies = sortObjectByKeys(json.dependencies);
44
+ }
45
+ if (!json.devDependencies[pkg] && isDevDependency) {
46
+ json.devDependencies[pkg] = version;
47
+ json.devDependencies = sortObjectByKeys(json.devDependencies);
48
+ }
49
+ host.overwrite('package.json', JSON.stringify(json, null, 2));
50
+ return true;
51
+ }
52
+ return false;
53
+ }
54
+ function addAssetToAngularJson(host, assetType, assetPath) {
55
+ /* tslint:disable-next-line: no-non-null-assertion */
56
+ var sourceText = host.read('angular.json').toString('utf-8');
57
+ var json = JSON.parse(sourceText);
58
+ if (!json)
59
+ return false;
60
+ var projectName = Object.keys(json['projects'])[0];
61
+ var projectObject = json.projects[projectName];
62
+ var targets = projectObject.targets || projectObject.architect;
63
+ var targetLocation = targets.build.options[assetType];
64
+ // update UI that `assetPath` wasn't re-added to angular.json
65
+ if (targetLocation.indexOf(assetPath) != -1)
66
+ return false;
67
+ targetLocation.push(assetPath);
68
+ host.overwrite('angular.json', JSON.stringify(json, null, 2));
69
+ return true;
70
+ }
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lib/schematics/src/ng-add/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAqBH,0DAiCC;AAED,sDAsBC;AA1ED,SAA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E,CAAC,CAAC,CAAC,CAAC;IAE9D,OAAO,IAAI,CAAC;AAEd,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Tree } from '@angular-devkit/schematics';
9
+ /**
10
+ * Whether the Angular module in the given path imports the specifed module class name.
11
+ */
12
+ export declare function hasNgModuleImport(tree: Tree, modulePath: string, className: string): boolean;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.hasNgModuleImport = hasNgModuleImport;
11
+ var ts = require("typescript");
12
+ /**
13
+ * Whether the Angular module in the given path imports the specifed module class name.
14
+ */
15
+ function hasNgModuleImport(tree, modulePath, className) {
16
+ var moduleFileContent = tree.read(modulePath);
17
+ if (!moduleFileContent) {
18
+ throw new Error("Could not read Angular module file: ".concat(modulePath));
19
+ }
20
+ var parsedFile = ts.createSourceFile(modulePath, moduleFileContent.toString(), ts.ScriptTarget.Latest, true);
21
+ var ngModuleMetadata = null;
22
+ var findModuleDecorator = function (node) {
23
+ if (ts.isDecorator(node) && ts.isCallExpression(node.expression) &&
24
+ isNgModuleCallExpression(node.expression)) {
25
+ ngModuleMetadata = node.expression.arguments[0];
26
+ return;
27
+ }
28
+ ts.forEachChild(node, findModuleDecorator);
29
+ };
30
+ ts.forEachChild(parsedFile, findModuleDecorator);
31
+ if (!ngModuleMetadata) {
32
+ throw new Error("Could not find NgModule declaration inside: \"".concat(modulePath, "\""));
33
+ }
34
+ /* tslint:disable-next-line: no-non-null-assertion */
35
+ for (var _i = 0, _a = ngModuleMetadata.properties; _i < _a.length; _i++) {
36
+ var property = _a[_i];
37
+ if (!ts.isPropertyAssignment(property) || property.name.getText() !== 'imports' ||
38
+ !ts.isArrayLiteralExpression(property.initializer)) {
39
+ continue;
40
+ }
41
+ /* tslint:disable-next-line: no-any */
42
+ if (property.initializer.elements.some(function (element) { return element.getText() === className; })) {
43
+ return true;
44
+ }
45
+ }
46
+ return false;
47
+ }
48
+ /**
49
+ * Resolves the last identifier that is part of the given expression. This helps resolving
50
+ * identifiers of nested property access expressions (e.g. myNamespace.core.NgModule).
51
+ */
52
+ function resolveIdentifierOfExpression(expression) {
53
+ if (ts.isIdentifier(expression)) {
54
+ return expression;
55
+ }
56
+ else if (ts.isPropertyAccessExpression(expression)) {
57
+ return resolveIdentifierOfExpression(expression.expression);
58
+ }
59
+ return null;
60
+ }
61
+ /** Whether the specified call expression is referring to a NgModule definition. */
62
+ function isNgModuleCallExpression(callExpression) {
63
+ if (!callExpression.arguments.length ||
64
+ !ts.isObjectLiteralExpression(callExpression.arguments[0])) {
65
+ return false;
66
+ }
67
+ var decoratorIdentifier = resolveIdentifierOfExpression(callExpression.expression);
68
+ return decoratorIdentifier ? decoratorIdentifier.text === 'NgModule' : false;
69
+ }
70
+ //# sourceMappingURL=ng-module-imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-module-imports.js","sourceRoot":"","sources":["../../../../../../lib/schematics/src/ng-add/utils/ng-module-imports.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAQH,8CA0CC;AA/CD,+BAAiC;AAEjC;;GAEG;AACH,SAAgB,iBAAiB,CAAC,IAAU,EAAE,UAAkB,EAAE,SAAiB;IACjF,IAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAEhD,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,8CAAuC,UAAU,CAAE,CAAC,CAAC;IACvE,CAAC;IAED,IAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,i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d,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,SAAS,6BAA6B,CAAC,UAAyB;IAC9D,IAAI,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,OAAO,UAAU,CAAC;IACpB,CAAC;SAAM,IAAI,EAAE,CAAC,0BAA0B,CAAC,UAAU,CAAC,EAAE,CAAC;QACrD,OAAO,6BAA6B,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,mFAAmF;AACnF,SAAS,wBAAwB,CAAC,cAAiC;IACjE,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM;QAChC,CAAC,EAAE,CAAC,yBAAyB,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAM,mBAAmB,GAAG,6BAA6B,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAErF,OAAO,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/E,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { WorkspaceProject } from '@schematics/angular/utility/workspace-models';
9
+ /** Looks for the main TypeScript file in the given project and returns its path. */
10
+ export declare function getProjectMainFile(project: WorkspaceProject): string;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.getProjectMainFile = getProjectMainFile;
11
+ var schematics_1 = require("@angular-devkit/schematics");
12
+ var project_targets_1 = require("./project-targets");
13
+ /** Looks for the main TypeScript file in the given project and returns its path. */
14
+ function getProjectMainFile(project) {
15
+ var buildOptions = (0, project_targets_1.getProjectTargetOptions)(project, 'build');
16
+ if (!buildOptions.main) {
17
+ throw new schematics_1.SchematicsException("Could not find the project main file inside of the " +
18
+ "workspace config (".concat(project.sourceRoot, ")"));
19
+ }
20
+ return buildOptions.main;
21
+ }
22
+ //# sourceMappingURL=project-main-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-main-file.js","sourceRoot":"","sources":["../../../../../../lib/schematics/src/ng-add/utils/project-main-file.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAOH,gDASC;AAbD,yDAAiE;AACjE,qDAA4D;AAE5D,oFAAoF;AACpF,SAAgB,kBAAkB,CAAC,OAAyB;IAC1D,IAAM,YAAY,GAAG,IAAA,yCAAuB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAE/D,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QACvB,MAAM,IAAI,gCAAmB,CAAC,qDAAqD;YACjF,4BAAqB,OAAO,CAAC,UAAU,MAAG,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { WorkspaceProject } from '@schematics/angular/utility/workspace-models';
9
+ /** Resolves the architect options for the build target of the given project. */
10
+ export declare function getProjectTargetOptions(project: WorkspaceProject, buildTarget: string): any;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.getProjectTargetOptions = getProjectTargetOptions;
11
+ /** Resolves the architect options for the build target of the given project. */
12
+ function getProjectTargetOptions(project, buildTarget) {
13
+ if (project.targets &&
14
+ project.targets[buildTarget] &&
15
+ project.targets[buildTarget].options) {
16
+ return project.targets[buildTarget].options;
17
+ }
18
+ if (project.architect &&
19
+ project.architect[buildTarget] &&
20
+ project.architect[buildTarget].options) {
21
+ return project.architect[buildTarget].options;
22
+ }
23
+ throw new Error("Cannot determine project target configuration for: ".concat(buildTarget, "."));
24
+ }
25
+ //# sourceMappingURL=project-targets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-targets.js","sourceRoot":"","sources":["../../../../../../lib/schematics/src/ng-add/utils/project-targets.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAKH,0DAgBC;AAjBD,gFAAgF;AAChF,SAAgB,uBAAuB,CAAC,OAAyB,EAAE,WAAmB;IACpF,IAAI,OAAO,CAAC,OAAO;QACjB,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;QAC5B,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAC;QAEvC,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC;IAC9C,CAAC;IAED,IAAI,OAAO,CAAC,SAAS;QACnB,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC;QAC9B,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAC;QAEzC,OAAO,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC;IAChD,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,6DAAsD,WAAW,MAAG,CAAC,CAAC;AACxF,CAAC"}
@@ -0,0 +1,77 @@
1
+ import * as i0 from '@angular/core';
2
+ import { PipeTransform, TemplateRef, OnDestroy, OnInit, ElementRef, ViewContainerRef, Renderer2 } from '@angular/core';
3
+ import { Subject } from 'rxjs';
4
+ import { Config, ConfigColumns, Api } from 'datatables.net';
5
+ import * as i2 from '@angular/common';
6
+
7
+ interface ADTSettings extends Config {
8
+ columns?: ADTColumns[];
9
+ }
10
+ interface ADTColumns extends ConfigColumns {
11
+ /** Define the column's unique identifier */
12
+ id?: string;
13
+ /** Set instance of Angular pipe to transform the data of particular column */
14
+ ngPipeInstance?: PipeTransform;
15
+ /** Define the arguments for the tranform method of the pipe, to change its behavior */
16
+ ngPipeArgs?: any[];
17
+ /** Set `TemplateRef` to transform the data of this column */
18
+ ngTemplateRef?: ADTTemplateRef;
19
+ }
20
+ interface ADTTemplateRef {
21
+ /** `TemplateRef` to work with */
22
+ ref: TemplateRef<any>;
23
+ /** */
24
+ context?: ADTTemplateRefContext;
25
+ }
26
+ interface ADTTemplateRefContext {
27
+ captureEvents: Function;
28
+ userData?: any;
29
+ }
30
+
31
+ /**
32
+ * @license
33
+ *
34
+ * Use of this source code is governed by an MIT-style license that can be
35
+ * found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE
36
+ */
37
+
38
+ declare class DataTableDirective implements OnDestroy, OnInit {
39
+ private el;
40
+ private vcr;
41
+ private renderer;
42
+ /**
43
+ * The DataTable option you pass to configure your table.
44
+ */
45
+ dtOptions: ADTSettings;
46
+ /**
47
+ * This trigger is used if one wants to trigger manually the DT rendering
48
+ * Useful when rendering angular rendered DOM
49
+ */
50
+ dtTrigger: Subject<ADTSettings>;
51
+ /**
52
+ * The DataTable instance built by the jQuery library [DataTables](datatables.net).
53
+ *
54
+ * It's possible to execute the [DataTables APIs](https://datatables.net/reference/api/) with
55
+ * this variable.
56
+ */
57
+ dtInstance: Promise<Api>;
58
+ private dt;
59
+ constructor(el: ElementRef, vcr: ViewContainerRef, renderer: Renderer2);
60
+ ngOnInit(): void;
61
+ ngOnDestroy(): void;
62
+ private displayTable;
63
+ private applyNgPipeTransform;
64
+ private applyNgRefTemplate;
65
+ private getColumnUniqueId;
66
+ static ɵfac: i0.ɵɵFactoryDeclaration<DataTableDirective, never>;
67
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DataTableDirective, "[datatable]", never, { "dtOptions": { "alias": "dtOptions"; "required": false; }; "dtTrigger": { "alias": "dtTrigger"; "required": false; }; }, {}, never, never, false, never>;
68
+ }
69
+
70
+ declare class DataTablesModule {
71
+ static ɵfac: i0.ɵɵFactoryDeclaration<DataTablesModule, never>;
72
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DataTablesModule, [typeof DataTableDirective], [typeof i2.CommonModule], [typeof DataTableDirective]>;
73
+ static ɵinj: i0.ɵɵInjectorDeclaration<DataTablesModule>;
74
+ }
75
+
76
+ export { DataTableDirective, DataTablesModule };
77
+ export type { ADTSettings };
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.