@mndw/ui-angular 0.0.0-stage → 0.1.2
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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Eralde
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { reflectComponentType, createComponent, inject, TemplateRef, ViewContainerRef, Input, Directive, ElementRef, ContentChildren } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
const CELL_INPUT_NAMES = ['row', 'value', 'colId'];
|
|
5
|
+
function reflectCellInputs(Component) {
|
|
6
|
+
const metadata = reflectComponentType(Component);
|
|
7
|
+
if (metadata === null) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
const reflected = [];
|
|
11
|
+
for (const input of metadata.inputs) {
|
|
12
|
+
if (CELL_INPUT_NAMES.includes(input.propName)) {
|
|
13
|
+
reflected.push([input.propName, input.templateName]);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return reflected;
|
|
17
|
+
}
|
|
18
|
+
function angularCell() {
|
|
19
|
+
return (Component, env) => {
|
|
20
|
+
const reflected = reflectCellInputs(Component);
|
|
21
|
+
if (reflected.length === 0) {
|
|
22
|
+
throw new Error('angularCell component must declare at least one of row, value, or colId as an input');
|
|
23
|
+
}
|
|
24
|
+
return () => {
|
|
25
|
+
let componentRef;
|
|
26
|
+
const apply = (context) => {
|
|
27
|
+
if (componentRef === undefined) {
|
|
28
|
+
throw new Error('Cannot update a cell renderer before mount');
|
|
29
|
+
}
|
|
30
|
+
for (const [propName, templateName] of reflected) {
|
|
31
|
+
componentRef.setInput(templateName, context[propName]);
|
|
32
|
+
}
|
|
33
|
+
componentRef.changeDetectorRef.detectChanges();
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
mount(context) {
|
|
37
|
+
componentRef = createComponent(Component, {
|
|
38
|
+
environmentInjector: env.environmentInjector,
|
|
39
|
+
hostElement: context.node,
|
|
40
|
+
});
|
|
41
|
+
env.applicationRef.attachView(componentRef.hostView);
|
|
42
|
+
apply(context);
|
|
43
|
+
},
|
|
44
|
+
update(context) {
|
|
45
|
+
apply(context);
|
|
46
|
+
},
|
|
47
|
+
destroy() {
|
|
48
|
+
if (componentRef !== undefined) {
|
|
49
|
+
env.applicationRef.detachView(componentRef.hostView);
|
|
50
|
+
componentRef.destroy();
|
|
51
|
+
componentRef = undefined;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
class MndwCellDirective {
|
|
60
|
+
constructor() {
|
|
61
|
+
this.id = '';
|
|
62
|
+
this.templateRef = inject((TemplateRef));
|
|
63
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
|
64
|
+
}
|
|
65
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
createRendererFactory() {
|
|
69
|
+
const templateRef = this.templateRef;
|
|
70
|
+
const viewContainerRef = this.viewContainerRef;
|
|
71
|
+
return () => {
|
|
72
|
+
const context = {
|
|
73
|
+
$implicit: undefined,
|
|
74
|
+
row: undefined,
|
|
75
|
+
value: undefined,
|
|
76
|
+
colId: '',
|
|
77
|
+
};
|
|
78
|
+
let view;
|
|
79
|
+
const assign = (cellContext) => {
|
|
80
|
+
context.$implicit = cellContext.row;
|
|
81
|
+
context.row = cellContext.row;
|
|
82
|
+
context.value = cellContext.value;
|
|
83
|
+
context.colId = cellContext.colId;
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
mount(cellContext) {
|
|
87
|
+
assign(cellContext);
|
|
88
|
+
view = viewContainerRef.createEmbeddedView(templateRef, context);
|
|
89
|
+
for (const node of view.rootNodes) {
|
|
90
|
+
cellContext.node.appendChild(node);
|
|
91
|
+
}
|
|
92
|
+
view.detectChanges();
|
|
93
|
+
},
|
|
94
|
+
update(cellContext) {
|
|
95
|
+
if (view === undefined) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
assign(cellContext);
|
|
99
|
+
view.detectChanges();
|
|
100
|
+
},
|
|
101
|
+
destroy() {
|
|
102
|
+
view?.destroy();
|
|
103
|
+
view = undefined;
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: MndwCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
109
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.18", type: MndwCellDirective, isStandalone: true, selector: "[mndwCell]", inputs: { id: ["mndwCell", "id"], mndwCellRows: "mndwCellRows" }, ngImport: i0 }); }
|
|
110
|
+
}
|
|
111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: MndwCellDirective, decorators: [{
|
|
112
|
+
type: Directive,
|
|
113
|
+
args: [{
|
|
114
|
+
selector: '[mndwCell]',
|
|
115
|
+
standalone: true,
|
|
116
|
+
}]
|
|
117
|
+
}], propDecorators: { id: [{
|
|
118
|
+
type: Input,
|
|
119
|
+
args: ['mndwCell']
|
|
120
|
+
}], mndwCellRows: [{
|
|
121
|
+
type: Input
|
|
122
|
+
}] } });
|
|
123
|
+
class MndwTableDirective {
|
|
124
|
+
constructor() {
|
|
125
|
+
this.columns = [];
|
|
126
|
+
this.host = inject(ElementRef).nativeElement;
|
|
127
|
+
this.factories = new Map();
|
|
128
|
+
}
|
|
129
|
+
ngAfterContentInit() {
|
|
130
|
+
this.cells.changes.subscribe(() => {
|
|
131
|
+
this.applyColumns();
|
|
132
|
+
});
|
|
133
|
+
this.applyColumns();
|
|
134
|
+
}
|
|
135
|
+
ngOnChanges() {
|
|
136
|
+
this.applyColumns();
|
|
137
|
+
}
|
|
138
|
+
applyColumns() {
|
|
139
|
+
if (this.cells === undefined) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
for (const cell of this.cells) {
|
|
143
|
+
if (!this.factories.has(cell.id)) {
|
|
144
|
+
this.factories.set(cell.id, cell.createRendererFactory());
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
this.host.columns = this.columns.map((column) => {
|
|
148
|
+
const factory = this.factories.get(column.id);
|
|
149
|
+
return factory === undefined ? column : { ...column, renderer: factory };
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: MndwTableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
153
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.18", type: MndwTableDirective, isStandalone: true, selector: "mndw-table", inputs: { columns: "columns" }, queries: [{ propertyName: "cells", predicate: MndwCellDirective }], usesOnChanges: true, ngImport: i0 }); }
|
|
154
|
+
}
|
|
155
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: MndwTableDirective, decorators: [{
|
|
156
|
+
type: Directive,
|
|
157
|
+
args: [{
|
|
158
|
+
selector: 'mndw-table',
|
|
159
|
+
standalone: true,
|
|
160
|
+
}]
|
|
161
|
+
}], propDecorators: { columns: [{
|
|
162
|
+
type: Input
|
|
163
|
+
}], cells: [{
|
|
164
|
+
type: ContentChildren,
|
|
165
|
+
args: [MndwCellDirective]
|
|
166
|
+
}] } });
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Generated bundle index. Do not edit.
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
export { MndwCellDirective, MndwTableDirective, angularCell };
|
|
173
|
+
//# sourceMappingURL=mndw-ui-angular.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mndw-ui-angular.mjs","sources":["../../src/angular-cell.ts","../../src/table-directives.ts","../../src/mndw-ui-angular.ts"],"sourcesContent":["import {\n type ApplicationRef,\n type ComponentRef,\n type EnvironmentInjector,\n type InputSignal,\n type Type,\n createComponent,\n reflectComponentType,\n} from '@angular/core';\nimport type {CellContext, CellRenderer} from '@mndw/ui';\n\nexport interface AngularCellEnv {\n applicationRef: ApplicationRef;\n environmentInjector: EnvironmentInjector;\n}\n\nexport type AngularInput<T> = T | InputSignal<T> | InputSignal<T | undefined>;\n\nexport interface AngularCellShape<Row, Value> {\n row?: AngularInput<Row>;\n value?: AngularInput<Value>;\n colId?: AngularInput<string>;\n}\n\ntype CellInputName = 'row' | 'value' | 'colId';\n\nconst CELL_INPUT_NAMES: readonly CellInputName[] = ['row', 'value', 'colId'];\n\nfunction reflectCellInputs<C>(Component: Type<C>): [CellInputName, string][] {\n const metadata = reflectComponentType(Component);\n\n if (metadata === null) {\n return [];\n }\n\n const reflected: [CellInputName, string][] = [];\n\n for (const input of metadata.inputs) {\n if ((CELL_INPUT_NAMES as readonly string[]).includes(input.propName)) {\n reflected.push([input.propName as CellInputName, input.templateName]);\n }\n }\n\n return reflected;\n}\n\nexport function angularCell<Row, Value = unknown>() {\n return <C extends AngularCellShape<Row, Value>>(\n Component: Type<C>,\n env: AngularCellEnv,\n ): () => CellRenderer<Row, Value> => {\n const reflected = reflectCellInputs(Component);\n\n if (reflected.length === 0) {\n throw new Error('angularCell component must declare at least one of row, value, or colId as an input');\n }\n\n return () => {\n let componentRef: ComponentRef<C> | undefined;\n\n const apply = (context: CellContext<Row, Value>): void => {\n if (componentRef === undefined) {\n throw new Error('Cannot update a cell renderer before mount');\n }\n\n for (const [propName, templateName] of reflected) {\n componentRef.setInput(templateName, context[propName]);\n }\n\n componentRef.changeDetectorRef.detectChanges();\n };\n\n return {\n mount(context) {\n componentRef = createComponent(Component, {\n environmentInjector: env.environmentInjector,\n hostElement: context.node,\n });\n env.applicationRef.attachView(componentRef.hostView);\n apply(context);\n },\n update(context) {\n apply(context);\n },\n destroy() {\n if (componentRef !== undefined) {\n env.applicationRef.detachView(componentRef.hostView);\n componentRef.destroy();\n componentRef = undefined;\n }\n },\n };\n };\n };\n}\n","import {\n ContentChildren,\n Directive,\n ElementRef,\n type EmbeddedViewRef,\n Input,\n QueryList,\n type Signal,\n TemplateRef,\n ViewContainerRef,\n inject,\n} from '@angular/core';\nimport type {CellContext, CellRenderer, Column} from '@mndw/ui';\n\nexport interface MndwCellTemplateContext<Row, Value> {\n $implicit: Row;\n row: Row;\n value: Value;\n colId: string;\n}\n\n@Directive({\n selector: '[mndwCell]',\n standalone: true,\n})\nexport class MndwCellDirective<Row = unknown, Value = unknown> {\n @Input('mndwCell')\n public id = '';\n\n @Input()\n public mndwCellRows?: Signal<readonly Row[]> | readonly Row[];\n\n private readonly templateRef = inject(TemplateRef<MndwCellTemplateContext<Row, Value>>);\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n public static ngTemplateContextGuard<Row, Value>(\n _directive: MndwCellDirective<Row, Value>,\n _context: unknown,\n ): _context is MndwCellTemplateContext<Row, Value> {\n return true;\n }\n\n public createRendererFactory(): () => CellRenderer<Row, Value> {\n const templateRef = this.templateRef;\n const viewContainerRef = this.viewContainerRef;\n\n return () => {\n const context: MndwCellTemplateContext<Row, Value> = {\n $implicit: undefined as unknown as Row,\n row: undefined as unknown as Row,\n value: undefined as unknown as Value,\n colId: '',\n };\n let view: EmbeddedViewRef<MndwCellTemplateContext<Row, Value>> | undefined;\n\n const assign = (cellContext: CellContext<Row, Value>): void => {\n context.$implicit = cellContext.row;\n context.row = cellContext.row;\n context.value = cellContext.value;\n context.colId = cellContext.colId;\n };\n\n return {\n mount(cellContext) {\n assign(cellContext);\n view = viewContainerRef.createEmbeddedView(templateRef, context);\n\n for (const node of view.rootNodes) {\n cellContext.node.appendChild(node);\n }\n\n view.detectChanges();\n },\n update(cellContext) {\n if (view === undefined) {\n return;\n }\n\n assign(cellContext);\n view.detectChanges();\n },\n destroy() {\n view?.destroy();\n view = undefined;\n },\n };\n };\n }\n}\n\n@Directive({\n selector: 'mndw-table',\n standalone: true,\n})\nexport class MndwTableDirective {\n @Input()\n public columns: Column<unknown>[] = [];\n\n @ContentChildren(MndwCellDirective)\n private readonly cells!: QueryList<MndwCellDirective>;\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement as HTMLElement & {\n columns: Column<unknown>[];\n };\n private readonly factories = new Map<string, () => CellRenderer>();\n\n public ngAfterContentInit(): void {\n this.cells.changes.subscribe(() => {\n this.applyColumns();\n });\n this.applyColumns();\n }\n\n public ngOnChanges(): void {\n this.applyColumns();\n }\n\n private applyColumns(): void {\n if (this.cells === undefined) {\n return;\n }\n\n for (const cell of this.cells) {\n if (!this.factories.has(cell.id)) {\n this.factories.set(cell.id, cell.createRendererFactory());\n }\n }\n\n this.host.columns = this.columns.map((column) => {\n const factory = this.factories.get(column.id);\n\n return factory === undefined ? column : {...column, renderer: factory};\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AA0BA,MAAM,gBAAgB,GAA6B,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC;AAE5E,SAAS,iBAAiB,CAAI,SAAkB,EAAA;AAC9C,IAAA,MAAM,QAAQ,GAAG,oBAAoB,CAAC,SAAS,CAAC;AAEhD,IAAA,IAAI,QAAQ,KAAK,IAAI,EAAE;AACrB,QAAA,OAAO,EAAE;IACX;IAEA,MAAM,SAAS,GAA8B,EAAE;AAE/C,IAAA,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,MAAM,EAAE;QACnC,IAAK,gBAAsC,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;AACpE,YAAA,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAyB,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;QACvE;IACF;AAEA,IAAA,OAAO,SAAS;AAClB;SAEgB,WAAW,GAAA;AACzB,IAAA,OAAO,CACL,SAAkB,EAClB,GAAmB,KACe;AAClC,QAAA,MAAM,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC;AAE9C,QAAA,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;AAC1B,YAAA,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC;QACxG;AAEA,QAAA,OAAO,MAAK;AACV,YAAA,IAAI,YAAyC;AAE7C,YAAA,MAAM,KAAK,GAAG,CAAC,OAAgC,KAAU;AACvD,gBAAA,IAAI,YAAY,KAAK,SAAS,E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IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC3D;QACF;AAEA,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KAAI;AAC9C,YAAA,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;AAE7C,YAAA,OAAO,OAAO,KAAK,SAAS,GAAG,MAAM,GAAG,EAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAC;AACxE,QAAA,CAAC,CAAC;IACJ;+GAvCW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAlB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,kBAAkB,4HAIZ,iBAAiB,EAAA,CAAA,EAAA,aAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAJvB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,YAAY;AACtB,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;sBAEE;;sBAGA,eAAe;uBAAC,iBAAiB;;;AClGpC;;AAEG;;;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ApplicationRef, EnvironmentInjector, InputSignal, Type, Signal } from '@angular/core';
|
|
3
|
+
import { CellRenderer, Column } from '@mndw/ui';
|
|
4
|
+
|
|
5
|
+
interface AngularCellEnv {
|
|
6
|
+
applicationRef: ApplicationRef;
|
|
7
|
+
environmentInjector: EnvironmentInjector;
|
|
8
|
+
}
|
|
9
|
+
type AngularInput<T> = T | InputSignal<T> | InputSignal<T | undefined>;
|
|
10
|
+
interface AngularCellShape<Row, Value> {
|
|
11
|
+
row?: AngularInput<Row>;
|
|
12
|
+
value?: AngularInput<Value>;
|
|
13
|
+
colId?: AngularInput<string>;
|
|
14
|
+
}
|
|
15
|
+
declare function angularCell<Row, Value = unknown>(): <C extends AngularCellShape<Row, Value>>(Component: Type<C>, env: AngularCellEnv) => () => CellRenderer<Row, Value>;
|
|
16
|
+
|
|
17
|
+
interface MndwCellTemplateContext<Row, Value> {
|
|
18
|
+
$implicit: Row;
|
|
19
|
+
row: Row;
|
|
20
|
+
value: Value;
|
|
21
|
+
colId: string;
|
|
22
|
+
}
|
|
23
|
+
declare class MndwCellDirective<Row = unknown, Value = unknown> {
|
|
24
|
+
id: string;
|
|
25
|
+
mndwCellRows?: Signal<readonly Row[]> | readonly Row[];
|
|
26
|
+
private readonly templateRef;
|
|
27
|
+
private readonly viewContainerRef;
|
|
28
|
+
static ngTemplateContextGuard<Row, Value>(_directive: MndwCellDirective<Row, Value>, _context: unknown): _context is MndwCellTemplateContext<Row, Value>;
|
|
29
|
+
createRendererFactory(): () => CellRenderer<Row, Value>;
|
|
30
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MndwCellDirective<any, any>, never>;
|
|
31
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MndwCellDirective<any, any>, "[mndwCell]", never, { "id": { "alias": "mndwCell"; "required": false; }; "mndwCellRows": { "alias": "mndwCellRows"; "required": false; }; }, {}, never, never, true, never>;
|
|
32
|
+
}
|
|
33
|
+
declare class MndwTableDirective {
|
|
34
|
+
columns: Column<unknown>[];
|
|
35
|
+
private readonly cells;
|
|
36
|
+
private readonly host;
|
|
37
|
+
private readonly factories;
|
|
38
|
+
ngAfterContentInit(): void;
|
|
39
|
+
ngOnChanges(): void;
|
|
40
|
+
private applyColumns;
|
|
41
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MndwTableDirective, never>;
|
|
42
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MndwTableDirective, "mndw-table", never, { "columns": { "alias": "columns"; "required": false; }; }, {}, ["cells"], never, true, never>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { MndwCellDirective, MndwTableDirective, angularCell };
|
|
46
|
+
export type { AngularCellEnv, AngularCellShape, AngularInput, MndwCellTemplateContext };
|
|
47
|
+
//# sourceMappingURL=mndw-ui-angular.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mndw-ui-angular.d.ts","sources":["../../src/angular-cell.ts","../../src/table-directives.ts"],"mappings":";;;;UAWiB,cAAc;oBACb,cAAc;yBACT,mBAAmB;AACzC;KAEW,YAAY,UAAU,WAAW,MAAM,WAAW;AAExD,UAAW,gBAAgB;AAC/B,UAAM,YAAY;AAClB,YAAQ,YAAY;AACpB,YAAQ,YAAY;AACrB;AAwBD,iBAAgB,WAAW,qCACP,gBAAgB,yBACrB,IAAI,UACV,cAAc,WACZ,YAAY;;ACpCjB,UAAW,uBAAuB;;;;;AAKvC;AAED,cAIa,iBAAiB;AAErB;AAGA,mBAAe,MAAM;AAE5B;AACA;0DAGc,iBAAiB,8CAEhB,uBAAuB;AAI/B,mCAA+B,YAAY;yCAjBvC,iBAAiB;2CAAjB,iBAAiB;AA+D7B;AAED,cAIa,kBAAkB;AAEtB,aAAS,MAAM;AAGtB;AAEA;AAGA;AAEO;AAOA;AAIP;yCAvBW,kBAAkB;2CAAlB,kBAAkB;AAwC9B;;;;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mndw/ui-angular",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"homepage": "https://eralde.github.io/mndw/",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Eralde/mndw.git",
|
|
9
|
+
"directory": "frontend/ui-angular"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"types": "./dist/types/mndw-ui-angular.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/types/mndw-ui-angular.d.ts",
|
|
16
|
+
"default": "./dist/fesm2022/mndw-ui-angular.mjs"
|
|
17
|
+
},
|
|
18
|
+
"./package.json": {
|
|
19
|
+
"default": "./package.json"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@mndw/ui": "^0.1.2"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@angular/core": ">=21.0.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@angular/common": "^21.2.18",
|
|
33
|
+
"@angular/compiler": "^21.2.18",
|
|
34
|
+
"@angular/compiler-cli": "^21.2.18",
|
|
35
|
+
"@angular/core": "^21.2.18",
|
|
36
|
+
"@angular/platform-browser": "^21.2.18",
|
|
37
|
+
"happy-dom": "20.11.1",
|
|
38
|
+
"ng-packagr": "^21.2.7",
|
|
39
|
+
"rxjs": "^7.8.0",
|
|
40
|
+
"typescript": "^5.7.0",
|
|
41
|
+
"vitest": "^3.2.7",
|
|
42
|
+
"zone.js": "^0.15.1"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "ng-packagr -p ng-package.json -c tsconfig.lib.json",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"check": "tsc -p tsconfig.json --noEmit",
|
|
48
|
+
"check:templates": "ngc -p test-fixtures/tsconfig.json"
|
|
49
|
+
},
|
|
50
|
+
"typings": "./dist/types/mndw-ui-angular.d.ts",
|
|
51
|
+
"module": "./dist/fesm2022/mndw-ui-angular.mjs"
|
|
6
52
|
}
|
package/README.md
DELETED