@mozaic-ds/angular 0.22.0 → 0.23.0-beta.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.
- package/CHANGELOG.md +7 -0
- package/README.md +5 -3
- package/angular.json +2 -9
- package/jest.config.js +6 -0
- package/package.json +30 -19
- package/projects/kit/components/datatable/components/caption/moz-datatable-caption.component.html +13 -0
- package/projects/kit/components/datatable/components/caption/moz-datatable-caption.component.ts +31 -0
- package/projects/kit/components/datatable/components/content/moz-datatable-content-cell.component.html +1 -0
- package/projects/kit/components/datatable/components/content/moz-datatable-content-cell.component.ts +17 -0
- package/projects/kit/components/datatable/components/footer/moz-datatable-footer.component.html +34 -0
- package/projects/kit/components/datatable/components/footer/moz-datatable-footer.component.ts +46 -0
- package/projects/kit/components/datatable/components/header/moz-datatable-header-cell.component.html +1 -0
- package/projects/kit/components/datatable/components/header/moz-datatable-header-cell.component.ts +17 -0
- package/projects/kit/components/datatable/index.ts +6 -0
- package/projects/kit/components/datatable/model/column-def.ts +5 -0
- package/projects/kit/components/datatable/model/datatable-settings.ts +11 -0
- package/projects/kit/components/datatable/model/footer-settings.ts +14 -0
- package/projects/kit/components/datatable/model/row-data.ts +3 -0
- package/projects/kit/components/datatable/moz-datatable.component.html +75 -0
- package/projects/kit/components/datatable/moz-datatable.component.scss +13 -0
- package/projects/kit/components/datatable/moz-datatable.component.spec.ts +123 -0
- package/projects/kit/components/datatable/moz-datatable.component.ts +97 -0
- package/projects/kit/components/datatable/moz-datatable.module.ts +44 -0
- package/projects/kit/components/datatable/moz-datatable.stories.ts +376 -0
- package/projects/kit/components/datatable/public-api.ts +6 -0
- package/projects/kit/components/icon/icon.component.spec.ts +4 -0
- package/projects/kit/components/pagination/pagination.component.html +2 -0
- package/projects/kit/components/pagination/pagination.component.ts +2 -1
- package/projects/kit/components/public-api.ts +1 -0
- package/projects/kit/components/tabs/tabs.component.ts +4 -2
- package/projects/kit/package.json +16 -3
- package/projects/kit/setup-jest.ts +1 -0
- package/projects/kit/tsconfig.spec.json +1 -1
- package/tsconfig.json +1 -0
- package/projects/kit/components/dialog/dialog.component.spec.ts +0 -24
- package/projects/kit/karma.conf.js +0 -41
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
ContentChildren,
|
|
5
|
+
QueryList,
|
|
6
|
+
AfterContentInit,
|
|
7
|
+
TemplateRef,
|
|
8
|
+
ContentChild,
|
|
9
|
+
Output,
|
|
10
|
+
EventEmitter,
|
|
11
|
+
ViewEncapsulation,
|
|
12
|
+
} from '@angular/core';
|
|
13
|
+
import { MozDatatableContentCellComponent } from './components/content/moz-datatable-content-cell.component';
|
|
14
|
+
import { MozDatatableFooterComponent } from './components/footer/moz-datatable-footer.component';
|
|
15
|
+
import { MozDatatableCaptionComponent } from './components/caption/moz-datatable-caption.component';
|
|
16
|
+
import { MozDatatableHeaderCellComponent } from './components/header/moz-datatable-header-cell.component';
|
|
17
|
+
import { FooterSettings } from './model/footer-settings';
|
|
18
|
+
import { DatatableSettings } from './model/datatable-settings';
|
|
19
|
+
import { RowData } from './model/row-data';
|
|
20
|
+
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'moz-datatable',
|
|
23
|
+
styleUrls: ['./moz-datatable.component.scss'],
|
|
24
|
+
templateUrl: './moz-datatable.component.html',
|
|
25
|
+
encapsulation: ViewEncapsulation.None,
|
|
26
|
+
})
|
|
27
|
+
export class MozDatatableComponent implements AfterContentInit {
|
|
28
|
+
@Input() public footerSettings?: FooterSettings;
|
|
29
|
+
@Input() public datatableSettings?: DatatableSettings;
|
|
30
|
+
|
|
31
|
+
// FROM BODY DATATABLE
|
|
32
|
+
@Output() rowClicked = new EventEmitter<RowData>();
|
|
33
|
+
|
|
34
|
+
// FROM PAGINATION FOOTER
|
|
35
|
+
@Output() pageChange = new EventEmitter<number>();
|
|
36
|
+
@Output() changeRowsPerPage = new EventEmitter<number>();
|
|
37
|
+
|
|
38
|
+
@ContentChildren(MozDatatableHeaderCellComponent)
|
|
39
|
+
public headerCellComponents?: QueryList<MozDatatableHeaderCellComponent>;
|
|
40
|
+
|
|
41
|
+
@ContentChildren(MozDatatableContentCellComponent)
|
|
42
|
+
public contentCellComponents?: QueryList<MozDatatableContentCellComponent>;
|
|
43
|
+
|
|
44
|
+
@ContentChild(MozDatatableFooterComponent)
|
|
45
|
+
public footerComponent?: MozDatatableFooterComponent;
|
|
46
|
+
|
|
47
|
+
@ContentChild(MozDatatableCaptionComponent)
|
|
48
|
+
public captionComponent?: MozDatatableCaptionComponent;
|
|
49
|
+
|
|
50
|
+
public customHeaderCellsMap: Map<string, TemplateRef<any>> = new Map<string, TemplateRef<any>>();
|
|
51
|
+
public customContentCellsMap: Map<string, TemplateRef<any>> = new Map<string, TemplateRef<any>>();
|
|
52
|
+
|
|
53
|
+
ngAfterContentInit(): void {
|
|
54
|
+
this.buildCustomHeaderMap();
|
|
55
|
+
this.buildCustomContentMap();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public buildCustomHeaderMap(): void {
|
|
59
|
+
if (this.headerCellComponents) {
|
|
60
|
+
this.headerCellComponents.forEach((header) => {
|
|
61
|
+
if (header.field && header.templateRef) {
|
|
62
|
+
this.customHeaderCellsMap.set(header.field, header.templateRef);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public buildCustomContentMap(): void {
|
|
69
|
+
if (this.contentCellComponents) {
|
|
70
|
+
this.contentCellComponents.forEach((cell) => {
|
|
71
|
+
if (cell.field && cell.templateRef) {
|
|
72
|
+
this.customContentCellsMap.set(cell.field, cell.templateRef);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public getCustomHeader(columnId: string): TemplateRef<any> | undefined {
|
|
79
|
+
return this.customHeaderCellsMap.get(columnId);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public getCustomContent(columnId: string): TemplateRef<any> | undefined {
|
|
83
|
+
return this.customContentCellsMap.get(columnId);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public rowClickEvent(rowClick: RowData): void {
|
|
87
|
+
this.rowClicked.emit(rowClick);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public rowPerPageChangeEvent($event: number): void {
|
|
91
|
+
this.changeRowsPerPage.emit($event);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public pageChangeEvent($event: number): void {
|
|
95
|
+
this.pageChange.emit($event);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { MozDatatableContentCellComponent } from './components/content/moz-datatable-content-cell.component';
|
|
4
|
+
import { MozDatatableComponent } from './moz-datatable.component';
|
|
5
|
+
import { MozDatatableFooterComponent } from './components/footer/moz-datatable-footer.component';
|
|
6
|
+
import { MozDatatableHeaderCellComponent } from './components/header/moz-datatable-header-cell.component';
|
|
7
|
+
import { MozDatatableCaptionComponent } from './components/caption/moz-datatable-caption.component';
|
|
8
|
+
import { PaginationModule } from '../pagination/pagination.module';
|
|
9
|
+
import { SelectModule } from '../select/select.module';
|
|
10
|
+
import { FormsModule } from '@angular/forms';
|
|
11
|
+
import { IconModule } from '../icon/icon.module';
|
|
12
|
+
import { ButtonModule } from '../button/button.module';
|
|
13
|
+
import { ToggleModule } from '../toggle/toggle.module';
|
|
14
|
+
import { TextInputModule } from '../text-input/text-input.module';
|
|
15
|
+
import { TagModule } from '../tag/tag.module';
|
|
16
|
+
|
|
17
|
+
@NgModule({
|
|
18
|
+
declarations: [
|
|
19
|
+
MozDatatableComponent,
|
|
20
|
+
MozDatatableContentCellComponent,
|
|
21
|
+
MozDatatableHeaderCellComponent,
|
|
22
|
+
MozDatatableFooterComponent,
|
|
23
|
+
MozDatatableCaptionComponent,
|
|
24
|
+
],
|
|
25
|
+
imports: [
|
|
26
|
+
CommonModule,
|
|
27
|
+
PaginationModule,
|
|
28
|
+
SelectModule,
|
|
29
|
+
FormsModule,
|
|
30
|
+
IconModule,
|
|
31
|
+
ButtonModule,
|
|
32
|
+
ToggleModule,
|
|
33
|
+
TextInputModule,
|
|
34
|
+
TagModule,
|
|
35
|
+
],
|
|
36
|
+
exports: [
|
|
37
|
+
MozDatatableComponent,
|
|
38
|
+
MozDatatableContentCellComponent,
|
|
39
|
+
MozDatatableHeaderCellComponent,
|
|
40
|
+
MozDatatableFooterComponent,
|
|
41
|
+
MozDatatableCaptionComponent,
|
|
42
|
+
],
|
|
43
|
+
})
|
|
44
|
+
export class MozDatatableModule {}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { Meta, moduleMetadata } from '@storybook/angular';
|
|
2
|
+
import { MozDatatableComponent } from './moz-datatable.component';
|
|
3
|
+
import { StoryObj } from '@storybook/angular';
|
|
4
|
+
import { MozDatatableModule } from './moz-datatable.module';
|
|
5
|
+
import { BadgeModule } from '../badge/badge.module';
|
|
6
|
+
import { TextInputModule } from '../text-input/text-input.module';
|
|
7
|
+
import { ButtonModule } from '../button/button.module';
|
|
8
|
+
import { IconModule } from '../icon/icon.module';
|
|
9
|
+
import { ToggleModule } from '../toggle/toggle.module';
|
|
10
|
+
import { TagModule } from '../tag/tag.module';
|
|
11
|
+
|
|
12
|
+
type StoryType = MozDatatableComponent;
|
|
13
|
+
|
|
14
|
+
const meta: Meta<StoryType> = {
|
|
15
|
+
title: 'Data/Datatable',
|
|
16
|
+
component: MozDatatableComponent,
|
|
17
|
+
decorators: [
|
|
18
|
+
moduleMetadata({
|
|
19
|
+
imports: [
|
|
20
|
+
MozDatatableModule,
|
|
21
|
+
BadgeModule,
|
|
22
|
+
TextInputModule,
|
|
23
|
+
ButtonModule,
|
|
24
|
+
IconModule,
|
|
25
|
+
ToggleModule,
|
|
26
|
+
TagModule,
|
|
27
|
+
],
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
argTypes: {
|
|
31
|
+
rowPerPageChangeEvent: { action: 'rowPerPageChange' },
|
|
32
|
+
rowClickEvent: { action: 'rowClick' },
|
|
33
|
+
pageChangeEvent: { action: 'pageChange' },
|
|
34
|
+
},
|
|
35
|
+
render: (args) => {
|
|
36
|
+
const { ...props } = args;
|
|
37
|
+
return {
|
|
38
|
+
props,
|
|
39
|
+
template: `
|
|
40
|
+
<moz-datatable [datatableSettings]="datatableSettings" [footerSettings]="footerSettings">
|
|
41
|
+
|
|
42
|
+
<moz-datatable-content-cell field="discount">
|
|
43
|
+
<ng-template let-item>
|
|
44
|
+
<input
|
|
45
|
+
moz-input
|
|
46
|
+
type="number"
|
|
47
|
+
placeholder="e.g. 15"
|
|
48
|
+
size="s"
|
|
49
|
+
/>
|
|
50
|
+
</ng-template>
|
|
51
|
+
</moz-datatable-content-cell>
|
|
52
|
+
|
|
53
|
+
<moz-datatable-content-cell field="status">
|
|
54
|
+
<ng-template let-row>
|
|
55
|
+
<div moz-badge [type]="row.content.type">{{row.content.label}}</div>
|
|
56
|
+
</ng-template>
|
|
57
|
+
</moz-datatable-content-cell>
|
|
58
|
+
|
|
59
|
+
<moz-datatable-content-cell field="productLink">
|
|
60
|
+
<ng-template let-row>
|
|
61
|
+
<a href="{{row.content.link}}">{{row.content.label}}</a>
|
|
62
|
+
</ng-template>
|
|
63
|
+
</moz-datatable-content-cell>
|
|
64
|
+
|
|
65
|
+
</moz-datatable>
|
|
66
|
+
`,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default meta;
|
|
72
|
+
|
|
73
|
+
type Story = StoryObj<StoryType>;
|
|
74
|
+
|
|
75
|
+
export const Default: Story = {
|
|
76
|
+
args: {
|
|
77
|
+
datatableSettings: {
|
|
78
|
+
columnDefs: [
|
|
79
|
+
{
|
|
80
|
+
field: 'productName',
|
|
81
|
+
headerName: 'Product name',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
field: 'productId',
|
|
85
|
+
headerName: 'Product id',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
field: 'discount',
|
|
89
|
+
headerName: 'Discount %',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
field: 'status',
|
|
93
|
+
headerName: 'status',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
field: 'productLink',
|
|
97
|
+
headerName: 'product link',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
rowData: [
|
|
101
|
+
{
|
|
102
|
+
productName: 'Perceuse-visseuse à Percussion',
|
|
103
|
+
productId: '#123456789',
|
|
104
|
+
discount: 0,
|
|
105
|
+
status: { label: 'Waiting for approval', type: 'warning' },
|
|
106
|
+
productLink: { label: 'Page link', link: '#' },
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
productName: 'Perceuse à percussion sans fil',
|
|
110
|
+
productId: '#456',
|
|
111
|
+
discount: 0,
|
|
112
|
+
status: { label: 'Online', type: 'success' },
|
|
113
|
+
productLink: { label: 'Page link', link: '#' },
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
productName: 'Perceuse sans fil',
|
|
117
|
+
productId: '#2345678',
|
|
118
|
+
discount: 0,
|
|
119
|
+
status: { label: 'Online', type: 'success' },
|
|
120
|
+
productLink: { label: 'Page link', link: '#' },
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
productName: 'Perceuse à percussion filaire',
|
|
124
|
+
productId: '-',
|
|
125
|
+
discount: 0,
|
|
126
|
+
status: { label: 'Draft', type: 'neutral' },
|
|
127
|
+
productLink: { label: 'Page link', link: '#' },
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
productName: 'Perceuse visseuse sans fil',
|
|
131
|
+
productId: '#34567',
|
|
132
|
+
discount: 0,
|
|
133
|
+
status: { label: 'Offline', type: 'danger' },
|
|
134
|
+
productLink: { label: 'Page link', link: '#' },
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export const FixHeaderRow: Story = {
|
|
142
|
+
args: {
|
|
143
|
+
datatableSettings: {
|
|
144
|
+
columnDefs: [
|
|
145
|
+
{
|
|
146
|
+
field: 'productName',
|
|
147
|
+
headerName: 'Product name',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
field: 'productId',
|
|
151
|
+
headerName: 'Product id',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
field: 'discount',
|
|
155
|
+
headerName: 'Discount %',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
field: 'status',
|
|
159
|
+
headerName: 'status',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
field: 'productLink',
|
|
163
|
+
headerName: 'product link',
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
rowData: [
|
|
167
|
+
{
|
|
168
|
+
productName: 'Perceuse-visseuse à Percussion',
|
|
169
|
+
productId: '#123456789',
|
|
170
|
+
discount: 0,
|
|
171
|
+
status: { label: 'Waiting for approval', type: 'warning' },
|
|
172
|
+
productLink: { label: 'Page link', link: '#' },
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
productName: 'Perceuse à percussion sans fil',
|
|
176
|
+
productId: '#456',
|
|
177
|
+
discount: 0,
|
|
178
|
+
status: { label: 'Online', type: 'success' },
|
|
179
|
+
productLink: { label: 'Page link', link: '#' },
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
productName: 'Perceuse sans fil',
|
|
183
|
+
productId: '#2345678',
|
|
184
|
+
discount: 0,
|
|
185
|
+
status: { label: 'Online', type: 'success' },
|
|
186
|
+
productLink: { label: 'Page link', link: '#' },
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
productName: 'Perceuse à percussion filaire',
|
|
190
|
+
productId: '-',
|
|
191
|
+
discount: 0,
|
|
192
|
+
status: { label: 'Draft', type: 'neutral' },
|
|
193
|
+
productLink: { label: 'Page link', link: '#' },
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
productName: 'Perceuse visseuse sans fil',
|
|
197
|
+
productId: '#34567',
|
|
198
|
+
discount: 0,
|
|
199
|
+
status: { label: 'Offline', type: 'danger' },
|
|
200
|
+
productLink: { label: 'Page link', link: '#' },
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
fixHeaderRow: true,
|
|
204
|
+
datatableMaxHeight: '200px',
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export const WithCaptionAndPagination: Story = {
|
|
210
|
+
render: (args) => ({
|
|
211
|
+
props: args,
|
|
212
|
+
template: `
|
|
213
|
+
<moz-datatable [datatableSettings]="datatableSettings" [footerSettings]="footerSettings">
|
|
214
|
+
|
|
215
|
+
<moz-datatable-caption>
|
|
216
|
+
<ng-container edition>
|
|
217
|
+
<button
|
|
218
|
+
moz-button
|
|
219
|
+
size="s"
|
|
220
|
+
variation="bordered"
|
|
221
|
+
widthBehavior="fit"
|
|
222
|
+
theme="neutral"
|
|
223
|
+
[onlyIcon]="true"
|
|
224
|
+
>
|
|
225
|
+
<moz-icon iconName="Navigation_Publish_Edit_24px"></moz-icon>
|
|
226
|
+
</button>
|
|
227
|
+
<button
|
|
228
|
+
moz-button
|
|
229
|
+
size="s"
|
|
230
|
+
variation="bordered"
|
|
231
|
+
widthBehavior="fit"
|
|
232
|
+
theme="neutral"
|
|
233
|
+
[onlyIcon]="true"
|
|
234
|
+
>
|
|
235
|
+
<moz-icon iconName="Media_Download_Web_24px"></moz-icon>
|
|
236
|
+
</button>
|
|
237
|
+
</ng-container>
|
|
238
|
+
<ng-container actions>
|
|
239
|
+
<div>
|
|
240
|
+
<moz-toggle size="s">Slot toggle</moz-toggle>
|
|
241
|
+
</div>
|
|
242
|
+
<div>
|
|
243
|
+
<input moz-input type="search" placeholder="This is a SLOT text input" size="s" />
|
|
244
|
+
</div>
|
|
245
|
+
<button moz-button size="s" variation="bordered" widthBehavior="fit">
|
|
246
|
+
<moz-icon iconName="Navigation_Display_Filter_24px"></moz-icon>
|
|
247
|
+
Filters
|
|
248
|
+
</button>
|
|
249
|
+
<button
|
|
250
|
+
moz-button
|
|
251
|
+
size="s"
|
|
252
|
+
variation="bordered"
|
|
253
|
+
widthBehavior="fit"
|
|
254
|
+
theme="neutral"
|
|
255
|
+
[onlyIcon]="true"
|
|
256
|
+
>
|
|
257
|
+
<moz-icon iconName="Navigation_Display_Setting_24px"></moz-icon>
|
|
258
|
+
</button>
|
|
259
|
+
<button moz-button size="s">Primary action</button>
|
|
260
|
+
<button moz-button size="s" theme="danger" variation="bordered">Negative action</button>
|
|
261
|
+
</ng-container>
|
|
262
|
+
<ng-container filters>
|
|
263
|
+
<moz-tag type="removable" size="s">
|
|
264
|
+
slot tag 1
|
|
265
|
+
</moz-tag>
|
|
266
|
+
<moz-tag type="removable" size="s">
|
|
267
|
+
slot tag 2
|
|
268
|
+
</moz-tag>
|
|
269
|
+
</ng-container>
|
|
270
|
+
</moz-datatable-caption>
|
|
271
|
+
|
|
272
|
+
<moz-datatable-content-cell field="discount">
|
|
273
|
+
<ng-template let-item>
|
|
274
|
+
<input
|
|
275
|
+
moz-input
|
|
276
|
+
type="number"
|
|
277
|
+
placeholder="e.g. 15"
|
|
278
|
+
size="s"
|
|
279
|
+
/>
|
|
280
|
+
</ng-template>
|
|
281
|
+
</moz-datatable-content-cell>
|
|
282
|
+
|
|
283
|
+
<moz-datatable-content-cell field="status">
|
|
284
|
+
<ng-template let-row>
|
|
285
|
+
<div moz-badge [type]="row.content.type">{{row.content.label}}</div>
|
|
286
|
+
</ng-template>
|
|
287
|
+
</moz-datatable-content-cell>
|
|
288
|
+
|
|
289
|
+
<moz-datatable-content-cell field="productLink">
|
|
290
|
+
<ng-template let-row>
|
|
291
|
+
<a href="{{row.content.link}}">{{row.content.label}}</a>
|
|
292
|
+
</ng-template>
|
|
293
|
+
</moz-datatable-content-cell>
|
|
294
|
+
</moz-datatable>
|
|
295
|
+
`,
|
|
296
|
+
}),
|
|
297
|
+
args: {
|
|
298
|
+
datatableSettings: {
|
|
299
|
+
activateCaption: true,
|
|
300
|
+
activatePagination: true,
|
|
301
|
+
columnDefs: [
|
|
302
|
+
{
|
|
303
|
+
field: 'productName',
|
|
304
|
+
headerName: 'Product name',
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
field: 'productId',
|
|
308
|
+
headerName: 'Product id',
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
field: 'discount',
|
|
312
|
+
headerName: 'Discount %',
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
field: 'status',
|
|
316
|
+
headerName: 'status',
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
field: 'productLink',
|
|
320
|
+
headerName: 'product link',
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
rowData: [
|
|
324
|
+
{
|
|
325
|
+
productName: 'Perceuse-visseuse à Percussion',
|
|
326
|
+
productId: '#123456789',
|
|
327
|
+
discount: 0,
|
|
328
|
+
status: { label: 'Waiting for approval', type: 'warning' },
|
|
329
|
+
productLink: { label: 'Page link', link: '#' },
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
productName: 'Perceuse à percussion sans fil',
|
|
333
|
+
productId: '#456',
|
|
334
|
+
discount: 0,
|
|
335
|
+
status: { label: 'Online', type: 'success' },
|
|
336
|
+
productLink: { label: 'Page link', link: '#' },
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
productName: 'Perceuse sans fil',
|
|
340
|
+
productId: '#2345678',
|
|
341
|
+
discount: 0,
|
|
342
|
+
status: { label: 'Online', type: 'success' },
|
|
343
|
+
productLink: { label: 'Page link', link: '#' },
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
productName: 'Perceuse à percussion filaire',
|
|
347
|
+
productId: '-',
|
|
348
|
+
discount: 0,
|
|
349
|
+
status: { label: 'Draft', type: 'neutral' },
|
|
350
|
+
productLink: { label: 'Page link', link: '#' },
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
productName: 'Perceuse visseuse sans fil',
|
|
354
|
+
productId: '#34567',
|
|
355
|
+
discount: 0,
|
|
356
|
+
status: { label: 'Offline', type: 'danger' },
|
|
357
|
+
productLink: { label: 'Page link', link: '#' },
|
|
358
|
+
},
|
|
359
|
+
],
|
|
360
|
+
},
|
|
361
|
+
footerSettings: {
|
|
362
|
+
pagination: {
|
|
363
|
+
totalItems: 150,
|
|
364
|
+
itemsPerPage: 5,
|
|
365
|
+
currentPage: 1,
|
|
366
|
+
rowPerPage: { options: [5, 10, 15, 20], selected: 5 },
|
|
367
|
+
},
|
|
368
|
+
labels: {
|
|
369
|
+
rowPerPage: 'Rows per page',
|
|
370
|
+
items: 'Products',
|
|
371
|
+
page: 'Page',
|
|
372
|
+
of: 'of',
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './moz-datatable.component';
|
|
2
|
+
export * from './components/header/moz-datatable-header-cell.component';
|
|
3
|
+
export * from './components/footer/moz-datatable-footer.component';
|
|
4
|
+
export * from './components/content/moz-datatable-content-cell.component';
|
|
5
|
+
export * from './components/caption/moz-datatable-caption.component';
|
|
6
|
+
export * from './moz-datatable.module';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
3
|
import { IconComponent } from './icon.component';
|
|
4
|
+
import { IconService } from './icon.service';
|
|
5
|
+
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
|
4
6
|
|
|
5
7
|
describe('IconComponent', () => {
|
|
6
8
|
let component: IconComponent;
|
|
@@ -9,6 +11,8 @@ describe('IconComponent', () => {
|
|
|
9
11
|
beforeEach(async () => {
|
|
10
12
|
await TestBed.configureTestingModule({
|
|
11
13
|
declarations: [IconComponent],
|
|
14
|
+
imports: [HttpClientModule],
|
|
15
|
+
providers: [IconService, HttpClient],
|
|
12
16
|
}).compileComponents();
|
|
13
17
|
});
|
|
14
18
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
class="mc-pagination__button"
|
|
6
6
|
[disabled]="isFirstPage"
|
|
7
7
|
[onlyIcon]="true"
|
|
8
|
+
[size]="(selectSize | async)!"
|
|
8
9
|
(click)="previousPage()"
|
|
9
10
|
*ngIf="leftIconName | async; let icon"
|
|
10
11
|
>
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
class="mc-pagination__button"
|
|
30
31
|
[disabled]="isLastPage"
|
|
31
32
|
(click)="nextPage()"
|
|
33
|
+
[size]="(selectSize | async)!"
|
|
32
34
|
[onlyIcon]="true"
|
|
33
35
|
*ngIf="rightIconName | async; let icon"
|
|
34
36
|
>
|
|
@@ -10,7 +10,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
|
10
10
|
import { debounceTime, map, Observable, shareReplay, startWith } from 'rxjs';
|
|
11
11
|
import { GlobalEventsService } from '../../common';
|
|
12
12
|
import { IconSize } from '../icon/icon-size';
|
|
13
|
-
import {
|
|
13
|
+
import { SELECT_SIZE, SelectSize } from '../select/select-size';
|
|
14
14
|
import {
|
|
15
15
|
Page,
|
|
16
16
|
PAGINATION_FIRST_PAGE,
|
|
@@ -108,6 +108,7 @@ export class PaginationComponent implements ControlValueAccessor {
|
|
|
108
108
|
public writeValue(value: any) {
|
|
109
109
|
if (!value || value === this.currentPage || value > this.numberOfPages) return;
|
|
110
110
|
this.currentPage = value;
|
|
111
|
+
this.cd.markForCheck();
|
|
111
112
|
this.onChange(value);
|
|
112
113
|
}
|
|
113
114
|
|
|
@@ -121,8 +121,10 @@ export class TabsComponent implements AfterViewInit, OnDestroy, OnChanges {
|
|
|
121
121
|
const selectTabByIndex =
|
|
122
122
|
typeof this.selectTabIndex === 'number' && tabs.get(this.selectTabIndex);
|
|
123
123
|
const firstSelectedTab = selectTabByIndex || activeTab || tabs.first;
|
|
124
|
-
firstSelectedTab
|
|
125
|
-
|
|
124
|
+
if (firstSelectedTab) {
|
|
125
|
+
firstSelectedTab.selected = true;
|
|
126
|
+
this.tryNavigateToTab(firstSelectedTab);
|
|
127
|
+
}
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
private tryNavigateToTab(tab: TabComponent) {
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mozaic-ds/angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
|
+
"exports": {
|
|
5
|
+
".": {
|
|
6
|
+
"sass": "./_index.scss"
|
|
7
|
+
},
|
|
8
|
+
"./adeo": {
|
|
9
|
+
"types": "./adeo/index.d.ts",
|
|
10
|
+
"esm2020": "./adeo/esm2020/mozaic-ds-angular.mjs",
|
|
11
|
+
"es2020": "./adeo/fesm2020/mozaic-ds-angular.mjs",
|
|
12
|
+
"es2015": "./adeo/fesm2015/mozaic-ds-angular.mjs",
|
|
13
|
+
"node": "./adeo/fesm2015/mozaic-ds-angular.mjs",
|
|
14
|
+
"default": "./adeo/fesm2020/mozaic-ds-angular.mjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
4
17
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "
|
|
6
|
-
"@angular/core": "
|
|
18
|
+
"@angular/common": ">=15.1.3",
|
|
19
|
+
"@angular/core": ">=15.1.3"
|
|
7
20
|
},
|
|
8
21
|
"dependencies": {
|
|
9
22
|
"tslib": "^2.3.0"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'jest-preset-angular/setup-jest';
|
package/tsconfig.json
CHANGED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { DialogComponent } from './dialog.component';
|
|
4
|
-
|
|
5
|
-
describe('DialogComponent', () => {
|
|
6
|
-
let component: DialogComponent;
|
|
7
|
-
let fixture: ComponentFixture<DialogComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [DialogComponent],
|
|
12
|
-
}).compileComponents();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
fixture = TestBed.createComponent(DialogComponent);
|
|
17
|
-
component = fixture.componentInstance;
|
|
18
|
-
fixture.detectChanges();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should create', () => {
|
|
22
|
-
expect(component).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
});
|