angular-datatables-v20 20.0.2 → 22.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.
|
@@ -1,189 +1,203 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { CommonModule } from
|
|
5
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Directive, Input, NgModule } from "@angular/core";
|
|
3
|
+
import "rxjs";
|
|
4
|
+
import { CommonModule } from "@angular/common";
|
|
6
5
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class DataTableDirective {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}]
|
|
139
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i0.Renderer2 }], propDecorators: { dtOptions: [{
|
|
140
|
-
type: Input
|
|
141
|
-
}], dtTrigger: [{
|
|
142
|
-
type: Input
|
|
143
|
-
}] } });
|
|
144
|
-
|
|
6
|
+
* @license
|
|
7
|
+
*
|
|
8
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
9
|
+
* found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE
|
|
10
|
+
*/
|
|
11
|
+
var DataTableDirective = class DataTableDirective {
|
|
12
|
+
constructor(el, vcr, renderer) {
|
|
13
|
+
this.el = el;
|
|
14
|
+
this.vcr = vcr;
|
|
15
|
+
this.renderer = renderer;
|
|
16
|
+
this.dtOptions = {};
|
|
17
|
+
}
|
|
18
|
+
ngOnInit() {
|
|
19
|
+
if (this.dtTrigger) this.dtTrigger.subscribe((options) => {
|
|
20
|
+
this.displayTable(options);
|
|
21
|
+
});
|
|
22
|
+
else this.displayTable(null);
|
|
23
|
+
}
|
|
24
|
+
ngOnDestroy() {
|
|
25
|
+
if (this.dtTrigger) this.dtTrigger.unsubscribe();
|
|
26
|
+
if (this.dt) this.dt.destroy(true);
|
|
27
|
+
}
|
|
28
|
+
displayTable(dtOptions) {
|
|
29
|
+
if (dtOptions) this.dtOptions = dtOptions;
|
|
30
|
+
this.dtInstance = new Promise((resolve, reject) => {
|
|
31
|
+
Promise.resolve(this.dtOptions).then((resolvedDTOptions) => {
|
|
32
|
+
if (Object.keys(resolvedDTOptions).length === 0 && $("tbody tr", this.el.nativeElement).length === 0) {
|
|
33
|
+
reject("Both the table and dtOptions cannot be empty");
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (resolvedDTOptions.columns) resolvedDTOptions.columns.forEach((col) => {
|
|
37
|
+
if ((col.id ?? "").trim() === "") col.id = this.getColumnUniqueId();
|
|
38
|
+
});
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
let options = { rowCallback: (row, data, index) => {
|
|
41
|
+
if (resolvedDTOptions.columns) {
|
|
42
|
+
const columns = resolvedDTOptions.columns;
|
|
43
|
+
this.applyNgPipeTransform(row, columns);
|
|
44
|
+
this.applyNgRefTemplate(row, columns, data);
|
|
45
|
+
}
|
|
46
|
+
if (resolvedDTOptions.rowCallback) resolvedDTOptions.rowCallback(row, data, index);
|
|
47
|
+
} };
|
|
48
|
+
options = Object.assign({}, resolvedDTOptions, options);
|
|
49
|
+
this.dt = $(this.el.nativeElement).DataTable(options);
|
|
50
|
+
resolve(this.dt);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
applyNgPipeTransform(row, columns) {
|
|
56
|
+
columns.filter((x) => x.ngPipeInstance && !x.ngTemplateRef).forEach((el) => {
|
|
57
|
+
const pipe = el.ngPipeInstance;
|
|
58
|
+
const pipeArgs = el.ngPipeArgs || [];
|
|
59
|
+
const i = columns.filter((c) => c.visible !== false).findIndex((e) => e.id === el.id);
|
|
60
|
+
const rowFromCol = row.childNodes.item(i);
|
|
61
|
+
const rowVal = $(rowFromCol).text();
|
|
62
|
+
const rowValAfter = pipe.transform(rowVal, ...pipeArgs);
|
|
63
|
+
$(rowFromCol).text(rowValAfter);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
applyNgRefTemplate(row, columns, data) {
|
|
67
|
+
columns.filter((x) => x.ngTemplateRef && !x.ngPipeInstance).forEach((el) => {
|
|
68
|
+
const { ref, context } = el.ngTemplateRef;
|
|
69
|
+
const i = columns.filter((c) => c.visible !== false).findIndex((e) => e.id === el.id);
|
|
70
|
+
const cellFromIndex = row.childNodes.item(i);
|
|
71
|
+
$(cellFromIndex).html("");
|
|
72
|
+
const _context = Object.assign({}, context, context?.userData, { adtData: data });
|
|
73
|
+
const instance = this.vcr.createEmbeddedView(ref, _context);
|
|
74
|
+
this.renderer.appendChild(cellFromIndex, instance.rootNodes[0]);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
getColumnUniqueId() {
|
|
78
|
+
let result = "";
|
|
79
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
80
|
+
for (let i = 0; i < 6; i++) {
|
|
81
|
+
const randomIndex = Math.floor(Math.random() * 62);
|
|
82
|
+
result += characters.charAt(randomIndex);
|
|
83
|
+
}
|
|
84
|
+
return result.trim();
|
|
85
|
+
}
|
|
86
|
+
static {
|
|
87
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
88
|
+
minVersion: "12.0.0",
|
|
89
|
+
version: "22.3.0",
|
|
90
|
+
ngImport: i0,
|
|
91
|
+
type: DataTableDirective,
|
|
92
|
+
deps: [
|
|
93
|
+
{ token: i0.ElementRef },
|
|
94
|
+
{ token: i0.ViewContainerRef },
|
|
95
|
+
{ token: i0.Renderer2 }
|
|
96
|
+
],
|
|
97
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
static {
|
|
101
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
102
|
+
minVersion: "14.0.0",
|
|
103
|
+
version: "22.3.0",
|
|
104
|
+
type: DataTableDirective,
|
|
105
|
+
isStandalone: false,
|
|
106
|
+
selector: "[datatable]",
|
|
107
|
+
inputs: {
|
|
108
|
+
dtOptions: "dtOptions",
|
|
109
|
+
dtTrigger: "dtTrigger"
|
|
110
|
+
},
|
|
111
|
+
ngImport: i0
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
116
|
+
minVersion: "12.0.0",
|
|
117
|
+
version: "22.3.0",
|
|
118
|
+
ngImport: i0,
|
|
119
|
+
type: DataTableDirective,
|
|
120
|
+
decorators: [{
|
|
121
|
+
type: Directive,
|
|
122
|
+
args: [{
|
|
123
|
+
selector: "[datatable]",
|
|
124
|
+
standalone: false
|
|
125
|
+
}]
|
|
126
|
+
}],
|
|
127
|
+
ctorParameters: () => [
|
|
128
|
+
{ type: i0.ElementRef },
|
|
129
|
+
{ type: i0.ViewContainerRef },
|
|
130
|
+
{ type: i0.Renderer2 }
|
|
131
|
+
],
|
|
132
|
+
propDecorators: {
|
|
133
|
+
dtOptions: [{ type: Input }],
|
|
134
|
+
dtTrigger: [{ type: Input }]
|
|
135
|
+
}
|
|
136
|
+
});
|
|
145
137
|
/**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
class DataTablesModule {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
138
|
+
* @license
|
|
139
|
+
*
|
|
140
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
141
|
+
* found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE
|
|
142
|
+
*/
|
|
143
|
+
var DataTablesModule = class DataTablesModule {
|
|
144
|
+
static {
|
|
145
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
146
|
+
minVersion: "12.0.0",
|
|
147
|
+
version: "22.3.0",
|
|
148
|
+
ngImport: i0,
|
|
149
|
+
type: DataTablesModule,
|
|
150
|
+
deps: [],
|
|
151
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
static {
|
|
155
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
156
|
+
minVersion: "14.0.0",
|
|
157
|
+
version: "22.3.0",
|
|
158
|
+
ngImport: i0,
|
|
159
|
+
type: DataTablesModule,
|
|
160
|
+
declarations: [DataTableDirective],
|
|
161
|
+
imports: [CommonModule],
|
|
162
|
+
exports: [DataTableDirective]
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
static {
|
|
166
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
167
|
+
minVersion: "12.0.0",
|
|
168
|
+
version: "22.3.0",
|
|
169
|
+
ngImport: i0,
|
|
170
|
+
type: DataTablesModule,
|
|
171
|
+
imports: [CommonModule]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
176
|
+
minVersion: "12.0.0",
|
|
177
|
+
version: "22.3.0",
|
|
178
|
+
ngImport: i0,
|
|
179
|
+
type: DataTablesModule,
|
|
180
|
+
decorators: [{
|
|
181
|
+
type: NgModule,
|
|
182
|
+
args: [{
|
|
183
|
+
imports: [CommonModule],
|
|
184
|
+
declarations: [DataTableDirective],
|
|
185
|
+
exports: [DataTableDirective]
|
|
186
|
+
}]
|
|
187
|
+
}]
|
|
188
|
+
});
|
|
165
189
|
/**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* @module
|
|
173
|
-
* @description
|
|
174
|
-
* Entry point from which you should import all public library APIs.
|
|
175
|
-
*/
|
|
176
|
-
|
|
190
|
+
* @license
|
|
191
|
+
*
|
|
192
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
193
|
+
* found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE
|
|
194
|
+
*/
|
|
177
195
|
/**
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Generated bundle index. Do not edit.
|
|
186
|
-
*/
|
|
187
|
-
|
|
196
|
+
* @license
|
|
197
|
+
*
|
|
198
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
199
|
+
* found in the LICENSE file at https://raw.githubusercontent.com/l-lin/angular-datatables/master/LICENSE
|
|
200
|
+
*/
|
|
188
201
|
export { DataTableDirective, DataTablesModule };
|
|
189
|
-
|
|
202
|
+
|
|
203
|
+
//# sourceMappingURL=angular-datatables-v20.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-datatables-v20.mjs","sources":["../../../lib/src/angular-datatables.directive.ts","../../../lib/src/angular-datatables.module.ts","../../../lib/public_api.ts","../../../lib/index.ts","../../../lib/angular-datatables-v20.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 let options: ADTSettings = {\n rowCallback: (row, data, index) => {\n if (resolvedDTOptions.columns) {\n const columns = resolvedDTOptions.columns;\n this.applyNgPipeTransform(row, columns);\n this.applyNgRefTemplate(row, columns, data);\n }\n\n // run user specified row callback if provided.\n if (resolvedDTOptions.rowCallback) {\n (resolvedDTOptions as any).rowCallback(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';\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,CAAC,YAAY,CAAC,IAAI,CAAC;QACzB;IACF;IAEA,WAAW,GAAA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AAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,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,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YAJhB,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAIZ,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;;;;"}
|
|
1
|
+
{"version":3,"file":"angular-datatables-v20.mjs","names":[],"sources":["../../../lib/src/angular-datatables.directive.ts","../../../lib/src/angular-datatables.module.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 let options: ADTSettings = {\n rowCallback: (row, data, index) => {\n if (resolvedDTOptions.columns) {\n const columns = resolvedDTOptions.columns;\n this.applyNgPipeTransform(row, columns);\n this.applyNgRefTemplate(row, columns, data);\n }\n\n // run user specified row callback if provided.\n if (resolvedDTOptions.rowCallback) {\n (resolvedDTOptions as any).rowCallback(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"],"mappings":";;;;;;;;;;AAgBA,IAAa,qBAAb,MAAa,mBAAkB;CAyB7B,YACU,IACA,KACA,UAAmB;EAFnB,KAAA,KAAA;EACA,KAAA,MAAA;EACA,KAAA,WAAA;EAvBV,KAAA,YAAyB,CAAA;CAwBrB;CAEJ,WAAQ;EACN,IAAI,KAAK,WACP,KAAK,UAAU,WAAW,YAAW;GACnC,KAAK,aAAa,OAAO;EAC3B,CAAC;OAED,KAAK,aAAa,IAAI;CAE1B;CAEA,cAAW;EACT,IAAI,KAAK,WACP,KAAK,UAAU,YAAW;EAE5B,IAAI,KAAK,IACP,KAAK,GAAG,QAAQ,IAAI;CAExB;CAEQ,aAAa,WAA6B;EAEhD,IAAI,WACF,KAAK,YAAY;EAEnB,KAAK,aAAa,IAAI,SAAS,SAAS,WAAU;GAChD,QAAQ,QAAQ,KAAK,SAAS,CAAC,CAAC,MAAK,sBAAoB;IAGvD,IADqB,OAAO,KAAK,iBAAiB,CAAC,CAAC,WAAW,KAAK,EAAE,YAAY,KAAK,GAAG,aAAa,CAAC,CAAC,WAAW,GAClG;KAChB,OAAO,8CAA8C;KACrD;IACF;IAGA,IAAI,kBAAkB,SACpB,kBAAkB,QAAQ,SAAQ,QAAM;KACtC,KAAK,IAAI,MAAM,GAAA,CAAI,KAAI,MAAO,IAC5B,IAAI,KAAK,KAAK,kBAAiB;IAEnC,CAAC;IAIH,iBAAgB;KAEd,IAAI,UAAuB,EACzB,cAAc,KAAK,MAAM,UAAS;MAChC,IAAI,kBAAkB,SAAS;OAC7B,MAAM,UAAU,kBAAkB;OAClC,KAAK,qBAAqB,KAAK,OAAO;OACtC,KAAK,mBAAmB,KAAK,SAAS,IAAI;MAC5C;MAGA,IAAI,kBAAkB,aACnB,kBAA0B,YAAY,K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;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgB,SAAA,CAJhB,YAAY;EAAA,CAAA;CAAA;;AAIZ,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAL5B,MAAA;EAAS,MAAA,CAAA;GACR,SAAS,CAAE,YAAY;GACvB,cAAc,CAAE,kBAAkB;GAClC,SAAS,CAAE,kBAAkB;EAC9B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "angular-datatables-v20",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "22.0.0",
|
|
4
4
|
"description": "Angular directive for DataTables",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Angular",
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
"schematics": "./schematics/src/collection.json",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@angular/common": "^
|
|
19
|
-
"@angular/core": "^
|
|
20
|
-
"@angular/platform-browser": "^
|
|
18
|
+
"@angular/common": "^22.0.0",
|
|
19
|
+
"@angular/core": "^22.0.0",
|
|
20
|
+
"@angular/platform-browser": "^22.0.0",
|
|
21
21
|
"datatables.net": "^2.0.3",
|
|
22
22
|
"datatables.net-dt": "^2.0.3",
|
|
23
23
|
"jquery": "^3.6.0",
|
|
24
24
|
"rxjs": "^7.4.0",
|
|
25
|
-
"zone.js": "~0.15.0"
|
|
25
|
+
"zone.js": "~0.15.0 || ~0.16.0"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
@@ -33,17 +33,18 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/l-lin/angular-datatables#readme",
|
|
35
35
|
"module": "fesm2022/angular-datatables-v20.mjs",
|
|
36
|
-
"typings": "
|
|
36
|
+
"typings": "types/angular-datatables-v20.d.ts",
|
|
37
37
|
"exports": {
|
|
38
38
|
"./package.json": {
|
|
39
39
|
"default": "./package.json"
|
|
40
40
|
},
|
|
41
41
|
".": {
|
|
42
|
-
"types": "./
|
|
42
|
+
"types": "./types/angular-datatables-v20.d.ts",
|
|
43
43
|
"default": "./fesm2022/angular-datatables-v20.mjs"
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"sideEffects": false,
|
|
47
|
+
"type": "module",
|
|
47
48
|
"dependencies": {
|
|
48
49
|
"tslib": "^2.3.0"
|
|
49
50
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { ElementRef, OnDestroy, OnInit, PipeTransform, Renderer2, TemplateRef, ViewContainerRef } from "@angular/core";
|
|
6
|
+
import { Subject } from "rxjs";
|
|
7
|
+
import { Api, Config, ConfigColumns } from "datatables.net";
|
|
8
|
+
import * as i2 from "@angular/common";
|
|
9
|
+
interface ADTSettings extends Config {
|
|
10
|
+
columns?: ADTColumns[];
|
|
11
|
+
}
|
|
12
|
+
interface ADTColumns extends ConfigColumns {
|
|
13
|
+
/** Define the column's unique identifier */
|
|
14
|
+
id?: string;
|
|
15
|
+
/** Set instance of Angular pipe to transform the data of particular column */
|
|
16
|
+
ngPipeInstance?: PipeTransform;
|
|
17
|
+
/** Define the arguments for the tranform method of the pipe, to change its behavior */
|
|
18
|
+
ngPipeArgs?: any[];
|
|
19
|
+
/** Set `TemplateRef` to transform the data of this column */
|
|
20
|
+
ngTemplateRef?: ADTTemplateRef;
|
|
21
|
+
}
|
|
22
|
+
interface ADTTemplateRef {
|
|
23
|
+
/** `TemplateRef` to work with */
|
|
24
|
+
ref: TemplateRef<any>;
|
|
25
|
+
/** */
|
|
26
|
+
context?: ADTTemplateRefContext;
|
|
27
|
+
}
|
|
28
|
+
interface ADTTemplateRefContext {
|
|
29
|
+
captureEvents: Function;
|
|
30
|
+
userData?: any;
|
|
31
|
+
}
|
|
32
|
+
export declare class DataTableDirective implements OnDestroy, OnInit {
|
|
33
|
+
private el;
|
|
34
|
+
private vcr;
|
|
35
|
+
private renderer;
|
|
36
|
+
/**
|
|
37
|
+
* The DataTable option you pass to configure your table.
|
|
38
|
+
*/
|
|
39
|
+
dtOptions: ADTSettings;
|
|
40
|
+
/**
|
|
41
|
+
* This trigger is used if one wants to trigger manually the DT rendering
|
|
42
|
+
* Useful when rendering angular rendered DOM
|
|
43
|
+
*/
|
|
44
|
+
dtTrigger: Subject<ADTSettings>;
|
|
45
|
+
/**
|
|
46
|
+
* The DataTable instance built by the jQuery library [DataTables](datatables.net).
|
|
47
|
+
*
|
|
48
|
+
* It's possible to execute the [DataTables APIs](https://datatables.net/reference/api/) with
|
|
49
|
+
* this variable.
|
|
50
|
+
*/
|
|
51
|
+
dtInstance: Promise<Api>;
|
|
52
|
+
private dt;
|
|
53
|
+
constructor(el: ElementRef, vcr: ViewContainerRef, renderer: Renderer2);
|
|
54
|
+
ngOnInit(): void;
|
|
55
|
+
ngOnDestroy(): void;
|
|
56
|
+
private displayTable;
|
|
57
|
+
private applyNgPipeTransform;
|
|
58
|
+
private applyNgRefTemplate;
|
|
59
|
+
private getColumnUniqueId;
|
|
60
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DataTableDirective, never>;
|
|
61
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DataTableDirective, "[datatable]", never, {
|
|
62
|
+
"dtOptions": {
|
|
63
|
+
"alias": "dtOptions";
|
|
64
|
+
"required": false;
|
|
65
|
+
};
|
|
66
|
+
"dtTrigger": {
|
|
67
|
+
"alias": "dtTrigger";
|
|
68
|
+
"required": false;
|
|
69
|
+
};
|
|
70
|
+
}, {}, never, never, false, never>;
|
|
71
|
+
}
|
|
72
|
+
export declare class DataTablesModule {
|
|
73
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DataTablesModule, never>;
|
|
74
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DataTablesModule, [typeof DataTableDirective], [typeof i2.CommonModule], [typeof DataTableDirective]>;
|
|
75
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DataTablesModule>;
|
|
76
|
+
}
|
|
77
|
+
export {};
|
package/index.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
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 };
|