dasar-ui 1.1.0 → 1.3.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/README.md +19 -14
- package/fesm2022/dasar-ui.mjs +9664 -0
- package/fesm2022/dasar-ui.mjs.map +1 -0
- package/package.json +39 -42
- package/types/dasar-ui.d.ts +2114 -0
- package/.editorconfig +0 -17
- package/.nvmrc +0 -1
- package/.prettierrc +0 -12
- package/.vscode/extensions.json +0 -4
- package/.vscode/launch.json +0 -20
- package/.vscode/settings.json +0 -4
- package/.vscode/tasks.json +0 -42
- package/CHANGELOG.md +0 -18
- package/angular.json +0 -37
- package/projects/dasar-ui/README.md +0 -64
- package/projects/dasar-ui/ng-package.json +0 -10
- package/projects/dasar-ui/package.json +0 -27
- package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.html +0 -9
- package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.scss +0 -352
- package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.ts +0 -154
- package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.scss +0 -69
- package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.ts +0 -30
- package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.html +0 -158
- package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.scss +0 -371
- package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.ts +0 -458
- package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.html +0 -80
- package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.scss +0 -184
- package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.ts +0 -294
- package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.html +0 -42
- package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.scss +0 -38
- package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.ts +0 -207
- package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.html +0 -102
- package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.scss +0 -301
- package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.ts +0 -527
- package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.registry.ts +0 -5089
- package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.scss +0 -24
- package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.ts +0 -97
- package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.html +0 -54
- package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.scss +0 -281
- package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.ts +0 -323
- package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.html +0 -63
- package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.scss +0 -195
- package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.ts +0 -240
- package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.html +0 -90
- package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.scss +0 -358
- package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.ts +0 -337
- package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.html +0 -98
- package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.scss +0 -51
- package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.ts +0 -99
- package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.css +0 -0
- package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.ts +0 -9
- package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.html +0 -163
- package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.scss +0 -283
- package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.ts +0 -230
- package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.css +0 -0
- package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.ts +0 -9
- package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.html +0 -185
- package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.scss +0 -347
- package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.ts +0 -497
- package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.css +0 -0
- package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.ts +0 -9
- package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.html +0 -162
- package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.scss +0 -283
- package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.ts +0 -380
- package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.html +0 -41
- package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.scss +0 -126
- package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.ts +0 -72
- package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.html +0 -43
- package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.scss +0 -189
- package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.ts +0 -139
- package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.ts +0 -286
- package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.css +0 -0
- package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.ts +0 -9
- package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.css +0 -0
- package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.ts +0 -9
- package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.css +0 -0
- package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.ts +0 -9
- package/projects/dasar-ui/src/lib/models/theme.model.ts +0 -643
- package/projects/dasar-ui/src/lib/models/type.model.ts +0 -11
- package/projects/dasar-ui/src/lib/services/theme.service.ts +0 -643
- package/projects/dasar-ui/src/lib/styles/theme.ts +0 -70
- package/projects/dasar-ui/src/lib/utils/common.ts +0 -175
- package/projects/dasar-ui/src/public-api.ts +0 -23
- package/projects/dasar-ui/tsconfig.lib.json +0 -21
- package/projects/dasar-ui/tsconfig.lib.prod.json +0 -11
- package/projects/dasar-ui/tsconfig.spec.json +0 -11
- package/tsconfig.json +0 -37
- /package/{projects/dasar-ui/src/lib/styles → styles}/theme.scss +0 -0
|
@@ -1,497 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
booleanAttribute,
|
|
3
|
-
Component,
|
|
4
|
-
HostBinding,
|
|
5
|
-
Input,
|
|
6
|
-
Output,
|
|
7
|
-
EventEmitter,
|
|
8
|
-
forwardRef,
|
|
9
|
-
ViewEncapsulation,
|
|
10
|
-
TemplateRef,
|
|
11
|
-
ChangeDetectorRef,
|
|
12
|
-
inject,
|
|
13
|
-
HostListener,
|
|
14
|
-
ElementRef,
|
|
15
|
-
ViewChild,
|
|
16
|
-
AfterViewInit,
|
|
17
|
-
Directive,
|
|
18
|
-
ContentChild,
|
|
19
|
-
} from '@angular/core';
|
|
20
|
-
import { ControlValueAccessor, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
21
|
-
import { CommonModule } from '@angular/common';
|
|
22
|
-
|
|
23
|
-
import { DASAR_THEME_PROVIDER } from '../dasar-theme-provider/dasar-theme-provider';
|
|
24
|
-
import { DasarChipComponent, DasarChipVariantType } from '../dasar-chip/dasar-chip';
|
|
25
|
-
import { ClassType, StyleType, ScaleAttributeType } from '../../models/type.model';
|
|
26
|
-
import { DasarButtonComponent } from '../dasar-button/dasar-button';
|
|
27
|
-
import { DasarThemeService } from '../../services/theme.service';
|
|
28
|
-
import { DasarIconComponent } from '../dasar-icon/dasar-icon';
|
|
29
|
-
import { resolveThemeDefault } from '../../utils/common';
|
|
30
|
-
|
|
31
|
-
export type DasarSelectSizeType = Extract<ScaleAttributeType, 'sm' | 'md' | 'lg'>;
|
|
32
|
-
export type DasarSelectChipSizeType = Extract<ScaleAttributeType, 'xs' | 'sm' | 'md' | 'lg' | 'xl'>;
|
|
33
|
-
export type DasarSelectMultipleDisplayType = 'text' | 'chip' | null;
|
|
34
|
-
export type DasarSelectAppearanceType = 'outline' | 'filled';
|
|
35
|
-
export type DasarSelectRadiusType = ScaleAttributeType;
|
|
36
|
-
|
|
37
|
-
export interface DasarSelectConfig {
|
|
38
|
-
multipleType?: DasarSelectMultipleDisplayType;
|
|
39
|
-
arrowIconName?: string;
|
|
40
|
-
debounceTime?: number;
|
|
41
|
-
appearance?: DasarSelectAppearanceType;
|
|
42
|
-
radius?: DasarSelectRadiusType;
|
|
43
|
-
options?: DasarSelectOption[];
|
|
44
|
-
chipSize?: DasarSelectChipSizeType;
|
|
45
|
-
size?: DasarSelectSizeType;
|
|
46
|
-
hint?: string;
|
|
47
|
-
placeholder?: string;
|
|
48
|
-
labelRight?: string;
|
|
49
|
-
label?: string;
|
|
50
|
-
dropdownPanelClass?: ClassType;
|
|
51
|
-
containerClass?: ClassType;
|
|
52
|
-
optionClass?: ClassType;
|
|
53
|
-
dropdownPanelStyle?: StyleType;
|
|
54
|
-
containerStyle?: StyleType;
|
|
55
|
-
fullWidth?: boolean;
|
|
56
|
-
clearable?: boolean;
|
|
57
|
-
searchable?: boolean;
|
|
58
|
-
disabled?: boolean;
|
|
59
|
-
loading?: boolean;
|
|
60
|
-
error?: boolean;
|
|
61
|
-
hideOverflow?: boolean;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@Directive({ selector: '[prefix-slot]', standalone: true })
|
|
65
|
-
export class DasarSelectPrefixSlot {}
|
|
66
|
-
@Directive({ selector: '[suffix-slot]', standalone: true })
|
|
67
|
-
export class DasarSelectSuffixSlot {}
|
|
68
|
-
@Directive({ selector: '[label-slot]', standalone: true })
|
|
69
|
-
export class DasarSelectLabelSlot {}
|
|
70
|
-
@Directive({ selector: '[extra-label-slot]', standalone: true })
|
|
71
|
-
export class DasarSelectExtraLabelSlot {}
|
|
72
|
-
@Directive({ selector: '[option-loading-slot]', standalone: true })
|
|
73
|
-
export class DasarSelectOptionLoadingSlot {}
|
|
74
|
-
@Directive({ selector: '[option-empty-slot]', standalone: true })
|
|
75
|
-
export class DasarSelectOptionEmptySlot {}
|
|
76
|
-
@Directive({ selector: '[chip-template]', standalone: true })
|
|
77
|
-
export class DasarSelectChipTemplate {
|
|
78
|
-
constructor(public templateRef: TemplateRef<any>) {}
|
|
79
|
-
}
|
|
80
|
-
@Directive({ selector: '[option-template]', standalone: true })
|
|
81
|
-
export class DasarSelectOptionTemplate {
|
|
82
|
-
constructor(public templateRef: TemplateRef<any>) {}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface DasarSelectOption {
|
|
86
|
-
chipVariant?: DasarChipVariantType;
|
|
87
|
-
chipClass?: ClassType;
|
|
88
|
-
chipStyle?: StyleType;
|
|
89
|
-
disabled?: boolean;
|
|
90
|
-
iconName?: string;
|
|
91
|
-
label: string;
|
|
92
|
-
value: any;
|
|
93
|
-
[key: string]: any;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@Component({
|
|
97
|
-
providers: [
|
|
98
|
-
{
|
|
99
|
-
provide: NG_VALUE_ACCESSOR,
|
|
100
|
-
useExisting: forwardRef(() => DasarSelect),
|
|
101
|
-
multi: true,
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
imports: [
|
|
105
|
-
CommonModule,
|
|
106
|
-
FormsModule,
|
|
107
|
-
DasarIconComponent,
|
|
108
|
-
DasarButtonComponent,
|
|
109
|
-
DasarChipComponent,
|
|
110
|
-
],
|
|
111
|
-
encapsulation: ViewEncapsulation.None,
|
|
112
|
-
templateUrl: './dasar-select.html',
|
|
113
|
-
styleUrls: ['./dasar-select.scss'],
|
|
114
|
-
selector: 'dasar-select',
|
|
115
|
-
standalone: true,
|
|
116
|
-
})
|
|
117
|
-
export class DasarSelect implements ControlValueAccessor {
|
|
118
|
-
@ViewChild('searchInput') searchInput?: ElementRef<HTMLInputElement>;
|
|
119
|
-
|
|
120
|
-
@ContentChild(DasarSelectOptionLoadingSlot) optionLoadingSlot?: DasarSelectOptionLoadingSlot;
|
|
121
|
-
@ContentChild(DasarSelectOptionEmptySlot) optionEmptySlot?: DasarSelectOptionEmptySlot;
|
|
122
|
-
@ContentChild(DasarSelectOptionTemplate) optionTemplate?: DasarSelectOptionTemplate;
|
|
123
|
-
@ContentChild(DasarSelectExtraLabelSlot) extraLabelSlot?: DasarSelectExtraLabelSlot;
|
|
124
|
-
@ContentChild(DasarSelectChipTemplate) chipTemplate?: DasarSelectChipTemplate;
|
|
125
|
-
@ContentChild(DasarSelectPrefixSlot) prefixSlot?: DasarSelectPrefixSlot;
|
|
126
|
-
@ContentChild(DasarSelectSuffixSlot) suffixSlot?: DasarSelectSuffixSlot;
|
|
127
|
-
@ContentChild(DasarSelectLabelSlot) labelSlot?: DasarSelectLabelSlot;
|
|
128
|
-
|
|
129
|
-
private themeProvider = inject(DASAR_THEME_PROVIDER, { optional: true });
|
|
130
|
-
private themeService = inject(DasarThemeService, { optional: true });
|
|
131
|
-
private cdr = inject(ChangeDetectorRef);
|
|
132
|
-
private elementRef = inject(ElementRef);
|
|
133
|
-
private debounceTimer: any = null;
|
|
134
|
-
searchQuery = '';
|
|
135
|
-
isOpen = false;
|
|
136
|
-
|
|
137
|
-
@Input({ alias: 'multiple-type' }) multipleType: DasarSelectMultipleDisplayType =
|
|
138
|
-
resolveThemeDefault('select', 'multipleType', null, this.themeProvider, this.themeService);
|
|
139
|
-
@Input({ alias: 'chip-size' }) chipSize: DasarSelectChipSizeType = resolveThemeDefault(
|
|
140
|
-
'select',
|
|
141
|
-
'chipSize',
|
|
142
|
-
'xs',
|
|
143
|
-
this.themeProvider,
|
|
144
|
-
this.themeService,
|
|
145
|
-
);
|
|
146
|
-
@Input({ alias: 'arrow-icon-name' }) arrowIconName = resolveThemeDefault(
|
|
147
|
-
'select',
|
|
148
|
-
'arrowIconName',
|
|
149
|
-
'chevron-down',
|
|
150
|
-
this.themeProvider,
|
|
151
|
-
this.themeService,
|
|
152
|
-
);
|
|
153
|
-
@Input({ alias: 'debounce-time' }) debounceTime = resolveThemeDefault(
|
|
154
|
-
'select',
|
|
155
|
-
'debounceTime',
|
|
156
|
-
300,
|
|
157
|
-
this.themeProvider,
|
|
158
|
-
this.themeService,
|
|
159
|
-
);
|
|
160
|
-
@Input() appearance = resolveThemeDefault(
|
|
161
|
-
'select',
|
|
162
|
-
'appearance',
|
|
163
|
-
'outline',
|
|
164
|
-
this.themeProvider,
|
|
165
|
-
this.themeService,
|
|
166
|
-
);
|
|
167
|
-
@Input() radius = resolveThemeDefault(
|
|
168
|
-
'select',
|
|
169
|
-
'radius',
|
|
170
|
-
'md',
|
|
171
|
-
this.themeProvider,
|
|
172
|
-
this.themeService,
|
|
173
|
-
);
|
|
174
|
-
@Input() options = resolveThemeDefault(
|
|
175
|
-
'select',
|
|
176
|
-
'options',
|
|
177
|
-
[],
|
|
178
|
-
this.themeProvider,
|
|
179
|
-
this.themeService,
|
|
180
|
-
);
|
|
181
|
-
@Input() size = resolveThemeDefault(
|
|
182
|
-
'select',
|
|
183
|
-
'size',
|
|
184
|
-
'md',
|
|
185
|
-
this.themeProvider,
|
|
186
|
-
this.themeService,
|
|
187
|
-
);
|
|
188
|
-
@Input() hint = resolveThemeDefault(
|
|
189
|
-
'select',
|
|
190
|
-
'hint',
|
|
191
|
-
undefined,
|
|
192
|
-
this.themeProvider,
|
|
193
|
-
this.themeService,
|
|
194
|
-
);
|
|
195
|
-
@Input() placeholder = resolveThemeDefault(
|
|
196
|
-
'select',
|
|
197
|
-
'placeholder',
|
|
198
|
-
'Select item',
|
|
199
|
-
this.themeProvider,
|
|
200
|
-
this.themeService,
|
|
201
|
-
);
|
|
202
|
-
@Input() label = resolveThemeDefault(
|
|
203
|
-
'select',
|
|
204
|
-
'label',
|
|
205
|
-
undefined,
|
|
206
|
-
this.themeProvider,
|
|
207
|
-
this.themeService,
|
|
208
|
-
);
|
|
209
|
-
@Input() labelRight = resolveThemeDefault(
|
|
210
|
-
'select',
|
|
211
|
-
'labelRight',
|
|
212
|
-
undefined,
|
|
213
|
-
this.themeProvider,
|
|
214
|
-
this.themeService,
|
|
215
|
-
);
|
|
216
|
-
@Input({ alias: 'dropdown-panel-class' }) dropdownPanelClass = resolveThemeDefault(
|
|
217
|
-
'select',
|
|
218
|
-
'dropdownPanelClass',
|
|
219
|
-
null,
|
|
220
|
-
this.themeProvider,
|
|
221
|
-
this.themeService,
|
|
222
|
-
);
|
|
223
|
-
@Input({ alias: 'container-class' }) containerClass = resolveThemeDefault(
|
|
224
|
-
'select',
|
|
225
|
-
'containerClass',
|
|
226
|
-
null,
|
|
227
|
-
this.themeProvider,
|
|
228
|
-
this.themeService,
|
|
229
|
-
);
|
|
230
|
-
@Input({ alias: 'option-class' }) optionClass = resolveThemeDefault(
|
|
231
|
-
'select',
|
|
232
|
-
'optionClass',
|
|
233
|
-
null,
|
|
234
|
-
this.themeProvider,
|
|
235
|
-
this.themeService,
|
|
236
|
-
);
|
|
237
|
-
@Input({ alias: 'dropdown-panel-style' }) dropdownPanelStyle = resolveThemeDefault(
|
|
238
|
-
'select',
|
|
239
|
-
'dropdownPanelStyle',
|
|
240
|
-
null,
|
|
241
|
-
this.themeProvider,
|
|
242
|
-
this.themeService,
|
|
243
|
-
);
|
|
244
|
-
@Input({ alias: 'container-style' }) containerStyle = resolveThemeDefault(
|
|
245
|
-
'select',
|
|
246
|
-
'containerStyle',
|
|
247
|
-
null,
|
|
248
|
-
this.themeProvider,
|
|
249
|
-
this.themeService,
|
|
250
|
-
);
|
|
251
|
-
@Input({ alias: 'full-width', transform: booleanAttribute }) fullWidth = resolveThemeDefault(
|
|
252
|
-
'select',
|
|
253
|
-
'fullWidth',
|
|
254
|
-
false,
|
|
255
|
-
this.themeProvider,
|
|
256
|
-
this.themeService,
|
|
257
|
-
);
|
|
258
|
-
@Input({ transform: booleanAttribute }) clearable = resolveThemeDefault(
|
|
259
|
-
'select',
|
|
260
|
-
'clearable',
|
|
261
|
-
false,
|
|
262
|
-
this.themeProvider,
|
|
263
|
-
this.themeService,
|
|
264
|
-
);
|
|
265
|
-
@Input({ transform: booleanAttribute }) searchable = resolveThemeDefault(
|
|
266
|
-
'select',
|
|
267
|
-
'searchable',
|
|
268
|
-
false,
|
|
269
|
-
this.themeProvider,
|
|
270
|
-
this.themeService,
|
|
271
|
-
);
|
|
272
|
-
@Input({ transform: booleanAttribute }) disabled = resolveThemeDefault(
|
|
273
|
-
'select',
|
|
274
|
-
'disabled',
|
|
275
|
-
false,
|
|
276
|
-
this.themeProvider,
|
|
277
|
-
this.themeService,
|
|
278
|
-
);
|
|
279
|
-
@Input({ transform: booleanAttribute }) loading = resolveThemeDefault(
|
|
280
|
-
'select',
|
|
281
|
-
'loading',
|
|
282
|
-
false,
|
|
283
|
-
this.themeProvider,
|
|
284
|
-
this.themeService,
|
|
285
|
-
);
|
|
286
|
-
@Input({ transform: booleanAttribute }) error = resolveThemeDefault(
|
|
287
|
-
'select',
|
|
288
|
-
'error',
|
|
289
|
-
false,
|
|
290
|
-
this.themeProvider,
|
|
291
|
-
this.themeService,
|
|
292
|
-
);
|
|
293
|
-
@Input({ alias: 'hide-overflow', transform: booleanAttribute }) hideOverflow =
|
|
294
|
-
resolveThemeDefault('card', 'hideOverflow', false, this.themeProvider, this.themeService);
|
|
295
|
-
|
|
296
|
-
@Output() valueChange = new EventEmitter<any>();
|
|
297
|
-
@Output() onBlurEvent = new EventEmitter<FocusEvent>();
|
|
298
|
-
@Output() onSearchChange = new EventEmitter<string>();
|
|
299
|
-
@Output() onFocus = new EventEmitter<FocusEvent>();
|
|
300
|
-
@Output() onPanelOpened = new EventEmitter<void>();
|
|
301
|
-
@Output() onPanelClosed = new EventEmitter<void>();
|
|
302
|
-
@Output() onCleared = new EventEmitter<void>();
|
|
303
|
-
|
|
304
|
-
@HostBinding('class.dasar-select') readonly baseClass = true;
|
|
305
|
-
@HostBinding('class.full-width') get hasFullWidth(): boolean {
|
|
306
|
-
return this.fullWidth;
|
|
307
|
-
}
|
|
308
|
-
@HostBinding('class.disabled') get isDisabled(): boolean {
|
|
309
|
-
return this.disabled;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
_value: any = '';
|
|
313
|
-
@Input()
|
|
314
|
-
get value(): any {
|
|
315
|
-
return this._value;
|
|
316
|
-
}
|
|
317
|
-
set value(val: any) {
|
|
318
|
-
if (this._value !== val) {
|
|
319
|
-
this._value = val;
|
|
320
|
-
this.cdr.markForCheck();
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
onChange: any = () => {};
|
|
325
|
-
onTouched: any = () => {};
|
|
326
|
-
|
|
327
|
-
// Control Value
|
|
328
|
-
writeValue(val: any): void {
|
|
329
|
-
this._value = val ?? (this.multipleType ? [] : '');
|
|
330
|
-
this.cdr.markForCheck();
|
|
331
|
-
}
|
|
332
|
-
registerOnChange(fn: any): void {
|
|
333
|
-
this.onChange = fn;
|
|
334
|
-
}
|
|
335
|
-
registerOnTouched(fn: any): void {
|
|
336
|
-
this.onTouched = fn;
|
|
337
|
-
}
|
|
338
|
-
setDisabledState(isDisabled: boolean): void {
|
|
339
|
-
this.disabled = isDisabled;
|
|
340
|
-
this.cdr.markForCheck();
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
get hasValue(): boolean {
|
|
344
|
-
const val = this.value;
|
|
345
|
-
if (this.multipleType) {
|
|
346
|
-
return Array.isArray(val) && val.length > 0;
|
|
347
|
-
}
|
|
348
|
-
return val !== null && val !== undefined && val !== '';
|
|
349
|
-
}
|
|
350
|
-
get isMultiple(): boolean {
|
|
351
|
-
return this.multipleType != null;
|
|
352
|
-
}
|
|
353
|
-
get selectedOption(): DasarSelectOption | undefined {
|
|
354
|
-
return this.options.find((opt) => opt.value === this._value);
|
|
355
|
-
}
|
|
356
|
-
get selectedOptions(): DasarSelectOption[] {
|
|
357
|
-
if (!Array.isArray(this._value)) return [];
|
|
358
|
-
return this.options.filter((opt) => this._value.includes(opt.value));
|
|
359
|
-
}
|
|
360
|
-
get filteredOptions(): DasarSelectOption[] {
|
|
361
|
-
if (!this.searchable || !this.searchQuery.trim()) {
|
|
362
|
-
return this.options;
|
|
363
|
-
}
|
|
364
|
-
const query = this.searchQuery.toLowerCase();
|
|
365
|
-
return this.options.filter((opt) => opt.label.toLowerCase().includes(query));
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
@HostListener('document:click', ['$event'])
|
|
369
|
-
onDocumentClick(event: MouseEvent): void {
|
|
370
|
-
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
371
|
-
if (this.isOpen) {
|
|
372
|
-
this.closePanel();
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
@HostListener('document:dasar-select:opened', ['$event'])
|
|
377
|
-
onGlobalSelectOpened(event: any): void {
|
|
378
|
-
if (event.detail !== this && this.isOpen) {
|
|
379
|
-
this.closePanel();
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// Processing
|
|
384
|
-
removeOption(option: DasarSelectOption, event: Event): void {
|
|
385
|
-
event.stopPropagation();
|
|
386
|
-
if (this.disabled) return;
|
|
387
|
-
|
|
388
|
-
if (this.multipleType && Array.isArray(this._value)) {
|
|
389
|
-
this._value = this._value.filter((val) => val !== option.value);
|
|
390
|
-
this.onChange(this._value);
|
|
391
|
-
this.valueChange.emit(this._value);
|
|
392
|
-
this.cdr.detectChanges(); // Force UI update immediately
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
clearSelection(event: Event): void {
|
|
396
|
-
event.stopPropagation();
|
|
397
|
-
const emptyVal = this.multipleType ? [] : '';
|
|
398
|
-
this.value = emptyVal;
|
|
399
|
-
this.onChange(emptyVal);
|
|
400
|
-
this.valueChange.emit(emptyVal);
|
|
401
|
-
this.onCleared.emit();
|
|
402
|
-
if (this.isOpen) {
|
|
403
|
-
this.closePanel();
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
toggleDropdown(): void {
|
|
407
|
-
if (this.disabled) return;
|
|
408
|
-
if (this.isOpen) {
|
|
409
|
-
this.closePanel();
|
|
410
|
-
} else {
|
|
411
|
-
this.openPanel();
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
openPanel(): void {
|
|
415
|
-
if (this.disabled || this.isOpen) return;
|
|
416
|
-
this.isOpen = true;
|
|
417
|
-
this.onPanelOpened.emit();
|
|
418
|
-
const openEvent = new CustomEvent('dasar-select:opened', { detail: this });
|
|
419
|
-
document.dispatchEvent(openEvent);
|
|
420
|
-
if (this.searchable) {
|
|
421
|
-
setTimeout(() => {
|
|
422
|
-
this.searchInput?.nativeElement.focus();
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
closePanel(): void {
|
|
427
|
-
if (!this.isOpen) return;
|
|
428
|
-
this.isOpen = false;
|
|
429
|
-
this.searchQuery = '';
|
|
430
|
-
this.onPanelClosed.emit();
|
|
431
|
-
this.onTouched();
|
|
432
|
-
}
|
|
433
|
-
isOptionSelected(option: DasarSelectOption): boolean {
|
|
434
|
-
if (this.multipleType) {
|
|
435
|
-
return Array.isArray(this._value) && this._value.includes(option.value);
|
|
436
|
-
}
|
|
437
|
-
return this._value === option.value;
|
|
438
|
-
}
|
|
439
|
-
selectOption(option: DasarSelectOption, event: Event): void {
|
|
440
|
-
event.stopPropagation();
|
|
441
|
-
if (option.disabled) return;
|
|
442
|
-
|
|
443
|
-
if (this.multipleType) {
|
|
444
|
-
let currentVal = Array.isArray(this._value) ? [...this._value] : [];
|
|
445
|
-
const index = currentVal.indexOf(option.value);
|
|
446
|
-
if (index > -1) {
|
|
447
|
-
currentVal.splice(index, 1);
|
|
448
|
-
} else {
|
|
449
|
-
currentVal.push(option.value);
|
|
450
|
-
}
|
|
451
|
-
this._value = currentVal;
|
|
452
|
-
this.onChange(this._value);
|
|
453
|
-
this.valueChange.emit(this._value);
|
|
454
|
-
|
|
455
|
-
// If searchable, re-focus input after selecting a chip
|
|
456
|
-
if (this.searchable) {
|
|
457
|
-
this.searchQuery = '';
|
|
458
|
-
this.searchInput?.nativeElement.focus();
|
|
459
|
-
}
|
|
460
|
-
} else {
|
|
461
|
-
this._value = option.value;
|
|
462
|
-
this.onChange(this._value);
|
|
463
|
-
this.valueChange.emit(this._value);
|
|
464
|
-
this.closePanel();
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
getMultipleDisplayText(): string {
|
|
468
|
-
const selected = this.selectedOptions;
|
|
469
|
-
if (selected.length === 0) return '';
|
|
470
|
-
return selected.map((s) => s.label).join(', ');
|
|
471
|
-
}
|
|
472
|
-
onSearchInput(query: string): void {
|
|
473
|
-
if (this.debounceTimer) {
|
|
474
|
-
clearTimeout(this.debounceTimer);
|
|
475
|
-
}
|
|
476
|
-
this.debounceTimer = setTimeout(() => {
|
|
477
|
-
this.onSearchChange.emit(query);
|
|
478
|
-
}, this.debounceTime);
|
|
479
|
-
}
|
|
480
|
-
onInputFocus(event?: FocusEvent): void {
|
|
481
|
-
if (event) this.onFocus.emit(event);
|
|
482
|
-
}
|
|
483
|
-
onInputBlur(event?: FocusEvent): void {
|
|
484
|
-
if (event) this.onBlurEvent.emit(event);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
export const DasarSelectComponent = [
|
|
488
|
-
DasarSelect,
|
|
489
|
-
DasarSelectLabelSlot,
|
|
490
|
-
DasarSelectSuffixSlot,
|
|
491
|
-
DasarSelectChipTemplate,
|
|
492
|
-
DasarSelectOptionTemplate,
|
|
493
|
-
DasarSelectExtraLabelSlot,
|
|
494
|
-
DasarSelectOptionEmptySlot,
|
|
495
|
-
DasarSelectOptionLoadingSlot,
|
|
496
|
-
DasarSelectPrefixSlot,
|
|
497
|
-
] as const;
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p>dasar-slider works!</p>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { DasarSlider } from './dasar-slider';
|
|
3
|
-
|
|
4
|
-
describe('DasarSlider', () => {
|
|
5
|
-
let component: DasarSlider;
|
|
6
|
-
let fixture: ComponentFixture<DasarSlider>;
|
|
7
|
-
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
await TestBed.configureTestingModule({
|
|
10
|
-
imports: [DasarSlider],
|
|
11
|
-
}).compileComponents();
|
|
12
|
-
|
|
13
|
-
fixture = TestBed.createComponent(DasarSlider);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
await fixture.whenStable();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
<div
|
|
2
|
-
class="dasar-table-container appearance-{{ appearance }} size-{{ size }} spacing-{{ spacing }}"
|
|
3
|
-
[ngClass]="containerClass"
|
|
4
|
-
[ngStyle]="containerStyle"
|
|
5
|
-
[class.fluid]="fluid"
|
|
6
|
-
>
|
|
7
|
-
<div class="dasar-table-wrapper" [ngClass]="wrapperClass" [ngStyle]="wrapperStyle">
|
|
8
|
-
<table
|
|
9
|
-
class="dasar-table-native"
|
|
10
|
-
[class.hoverable]="hoverable"
|
|
11
|
-
[class.striped]="striped"
|
|
12
|
-
[ngClass]="tableClass"
|
|
13
|
-
[ngStyle]="tableStyle"
|
|
14
|
-
>
|
|
15
|
-
@if (columns.length > 0) {
|
|
16
|
-
<thead [ngClass]="headerClass" [ngStyle]="headerStyle">
|
|
17
|
-
@if (hasHeader) {
|
|
18
|
-
<ng-content select="[header-slot]"></ng-content>
|
|
19
|
-
} @else {
|
|
20
|
-
<tr>
|
|
21
|
-
@if (expandable) {
|
|
22
|
-
<th class="expand-col-header" style="width: 40px"></th>
|
|
23
|
-
}
|
|
24
|
-
@for (col of columns; track col.key) {
|
|
25
|
-
<th
|
|
26
|
-
[style.text-align]="col.align || 'left'"
|
|
27
|
-
[style.width]="col.width || 'auto'"
|
|
28
|
-
[class.sortable]="col.sortable"
|
|
29
|
-
[ngClass]="getColHeaderClass(col)"
|
|
30
|
-
[ngStyle]="getColHeaderStyle(col)"
|
|
31
|
-
(click)="col.sortable ? onSort(col.key) : null"
|
|
32
|
-
>
|
|
33
|
-
<div
|
|
34
|
-
class="th-content"
|
|
35
|
-
[style.justify-content]="
|
|
36
|
-
col.align === 'right'
|
|
37
|
-
? 'flex-end'
|
|
38
|
-
: col.align === 'center'
|
|
39
|
-
? 'center'
|
|
40
|
-
: 'flex-start'
|
|
41
|
-
"
|
|
42
|
-
>
|
|
43
|
-
<span>{{ col.label ?? col.key }}</span>
|
|
44
|
-
@if (col.sortable) {
|
|
45
|
-
<span class="sort-indicator" [class.active]="sortKey === col.key">
|
|
46
|
-
@if (sortKey === col.key && sortDirection === 'asc') {
|
|
47
|
-
↑
|
|
48
|
-
} @else if (sortKey === col.key && sortDirection === 'desc') {
|
|
49
|
-
↓
|
|
50
|
-
} @else {
|
|
51
|
-
↕
|
|
52
|
-
}
|
|
53
|
-
</span>
|
|
54
|
-
}
|
|
55
|
-
</div>
|
|
56
|
-
</th>
|
|
57
|
-
}
|
|
58
|
-
</tr>
|
|
59
|
-
}
|
|
60
|
-
</thead>
|
|
61
|
-
<tbody [ngClass]="bodyClass" [ngStyle]="bodyStyle">
|
|
62
|
-
@if (hasBody) {
|
|
63
|
-
<ng-content select="[body-slot]"></ng-content>
|
|
64
|
-
} @else {
|
|
65
|
-
@if (loading) {
|
|
66
|
-
<tr class="state-row">
|
|
67
|
-
<td [attr.colspan]="columns.length + (expandable ? 1 : 0)" class="state-cell">
|
|
68
|
-
<div class="state-content">
|
|
69
|
-
<div class="dasar-spinner"></div>
|
|
70
|
-
<span>{{ loadingText }}</span>
|
|
71
|
-
</div>
|
|
72
|
-
</td>
|
|
73
|
-
</tr>
|
|
74
|
-
} @else if (data.length === 0) {
|
|
75
|
-
<tr class="state-row">
|
|
76
|
-
<td [attr.colspan]="columns.length + (expandable ? 1 : 0)" class="state-cell">
|
|
77
|
-
@if (hasEmpty) {
|
|
78
|
-
<ng-content select="[empty-slot]"></ng-content>
|
|
79
|
-
} @else {
|
|
80
|
-
<div class="empty-content">
|
|
81
|
-
<h5>{{ emptyTitle }}</h5>
|
|
82
|
-
<p>{{ emptyDescription }}</p>
|
|
83
|
-
</div>
|
|
84
|
-
}
|
|
85
|
-
</td>
|
|
86
|
-
</tr>
|
|
87
|
-
} @else {
|
|
88
|
-
@for (row of data; track row; let i = $index) {
|
|
89
|
-
<tr
|
|
90
|
-
class="dasar-table-row"
|
|
91
|
-
[class.expanded]="isExpanded(i)"
|
|
92
|
-
(click)="rowClick(row, i, $event)"
|
|
93
|
-
(dblclick)="rowDblClick(row, i, $event)"
|
|
94
|
-
(contextmenu)="rowContextMenu(row, i, $event)"
|
|
95
|
-
>
|
|
96
|
-
@if (expandable) {
|
|
97
|
-
<td
|
|
98
|
-
class="expand-col-cell"
|
|
99
|
-
style="width: 40px; display: flex; justify-items: center; align-items: center"
|
|
100
|
-
>
|
|
101
|
-
<dasar-button
|
|
102
|
-
variant="ghost"
|
|
103
|
-
[size]="size"
|
|
104
|
-
icon-only
|
|
105
|
-
[class.is-expanded]="isExpanded(i)"
|
|
106
|
-
(click)="toggleExpand(row, i, $event)"
|
|
107
|
-
>
|
|
108
|
-
<dasar-icon
|
|
109
|
-
[name]="isExpanded(i) ? 'chevron-down' : 'chevron-right'"
|
|
110
|
-
></dasar-icon>
|
|
111
|
-
</dasar-button>
|
|
112
|
-
</td>
|
|
113
|
-
}
|
|
114
|
-
@for (col of columns; track col.key) {
|
|
115
|
-
<td
|
|
116
|
-
[style.text-align]="col.align || 'left'"
|
|
117
|
-
[ngClass]="getColCellClass(col, row, i)"
|
|
118
|
-
[ngStyle]="getColCellStyle(col, row, i)"
|
|
119
|
-
>
|
|
120
|
-
@if (getCellTemplate(col.key); as tmpl) {
|
|
121
|
-
<ng-container
|
|
122
|
-
*ngTemplateOutlet="
|
|
123
|
-
tmpl;
|
|
124
|
-
context: { $implicit: row[col.key], row: row, index: i }
|
|
125
|
-
"
|
|
126
|
-
></ng-container>
|
|
127
|
-
} @else {
|
|
128
|
-
{{ row[col.key] }}
|
|
129
|
-
}
|
|
130
|
-
</td>
|
|
131
|
-
}
|
|
132
|
-
</tr>
|
|
133
|
-
@if (expandable && isExpanded(i) && hasExpanded) {
|
|
134
|
-
<tr class="dasar-table-expanded-row">
|
|
135
|
-
<td
|
|
136
|
-
[attr.colspan]="columns.length + (expandable ? 1 : 0)"
|
|
137
|
-
class="expanded-cell"
|
|
138
|
-
>
|
|
139
|
-
<ng-container
|
|
140
|
-
*ngTemplateOutlet="
|
|
141
|
-
providedExpanded!.templateRef;
|
|
142
|
-
context: { $implicit: row, index: i }
|
|
143
|
-
"
|
|
144
|
-
></ng-container>
|
|
145
|
-
</td>
|
|
146
|
-
</tr>
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
</tbody>
|
|
152
|
-
} @else {
|
|
153
|
-
<ng-content></ng-content>
|
|
154
|
-
}
|
|
155
|
-
</table>
|
|
156
|
-
</div>
|
|
157
|
-
@if (hasPagination) {
|
|
158
|
-
<div class="dasar-table-pagination" [ngClass]="paginationClass" [ngStyle]="paginationStyle">
|
|
159
|
-
<ng-content select="[pagination-slot]"></ng-content>
|
|
160
|
-
</div>
|
|
161
|
-
}
|
|
162
|
-
</div>
|