@enigmatry/entry-components 17.0.0-preview.5.1 → 17.0.0-preview.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +32 -32
  2. package/assets/nswag-templates/Client.RequestBody.liquid +95 -95
  3. package/assets/nswag-templates/Client.RequestUrl.liquid +67 -67
  4. package/assets/nswag-templates/ConvertToClass.liquid +64 -64
  5. package/assets/nswag-templates/original/Client.RequestBody.liquid +89 -89
  6. package/assets/nswag-templates/original/Client.RequestUrl.liquid +59 -59
  7. package/assets/nswag-templates/original/ConvertToClass.liquid +65 -65
  8. package/assets/nswag-templates/original/File.FormatDate.liquid +4 -4
  9. package/assets/nswag-templates/original/File.ParseDateOnly.liquid +4 -4
  10. package/button/README.md +45 -45
  11. package/date-time-picker/README.md +69 -69
  12. package/dialog/README.md +73 -73
  13. package/esm2022/button/entry-button.directive.mjs +1 -1
  14. package/esm2022/button/entry-button.module.mjs +1 -1
  15. package/esm2022/button/public-api.mjs +1 -1
  16. package/esm2022/common/common.module.mjs +1 -1
  17. package/esm2022/common/date-time/entry-date-time-adapter.mjs +1 -1
  18. package/esm2022/common/date-time/entry-date-time-formats.mjs +1 -1
  19. package/esm2022/common/date-time/entry-time-adapter.mjs +1 -1
  20. package/esm2022/common/date-time/native-time-adapter.mjs +1 -1
  21. package/esm2022/common/directives/auto-disable-button.directive.mjs +1 -1
  22. package/esm2022/common/directives/ng-control-accessor.directive.mjs +1 -1
  23. package/esm2022/common/directives/noop-control-value-accessor.mjs +1 -1
  24. package/esm2022/common/interceptors/accept-language.interceptor.mjs +1 -1
  25. package/esm2022/common/public-api.mjs +1 -1
  26. package/esm2022/date-time-picker/date-time-picker.component.mjs +3 -3
  27. package/esm2022/date-time-picker/date-time-picker.module.mjs +1 -1
  28. package/esm2022/date-time-picker/public-api.mjs +1 -1
  29. package/esm2022/date-time-picker/time-picker.component.mjs +3 -3
  30. package/esm2022/dialog/dialogs/alert/entry-alert-dialog-data.interface.mjs +1 -1
  31. package/esm2022/dialog/dialogs/alert/entry-alert-dialog.component.mjs +3 -3
  32. package/esm2022/dialog/dialogs/confirm/entry-confirm-dialog-data.interface.mjs +1 -1
  33. package/esm2022/dialog/dialogs/confirm/entry-confirm-dialog.component.mjs +3 -3
  34. package/esm2022/dialog/dialogs/entry-dialog.component.mjs +3 -3
  35. package/esm2022/dialog/dialogs/error/entry-error-dialog-data.interface.mjs +1 -1
  36. package/esm2022/dialog/dialogs/error/entry-error-dialog.component.mjs +3 -3
  37. package/esm2022/dialog/entry-dialog-buttons-alignment.type.mjs +1 -1
  38. package/esm2022/dialog/entry-dialog-config.model.mjs +1 -1
  39. package/esm2022/dialog/entry-dialog.module.mjs +1 -1
  40. package/esm2022/dialog/entry-dialog.service.mjs +1 -1
  41. package/esm2022/dialog/public-api.mjs +1 -1
  42. package/esm2022/file-input/entry-file-input.component.mjs +1 -1
  43. package/esm2022/file-input/entry-file-input.module.mjs +1 -1
  44. package/esm2022/file-input/public-api.mjs +1 -1
  45. package/esm2022/permissions/permission-type.mjs +1 -1
  46. package/esm2022/permissions/permission.directive.mjs +1 -1
  47. package/esm2022/permissions/permission.module.mjs +1 -1
  48. package/esm2022/permissions/permission.pipe.mjs +1 -1
  49. package/esm2022/permissions/public-api.mjs +1 -1
  50. package/esm2022/public-api.mjs +1 -1
  51. package/esm2022/search-filter/autocomplete/autocomplete-search-filter.component.mjs +3 -3
  52. package/esm2022/search-filter/autocomplete/autocomplete-search-filter.model.mjs +1 -1
  53. package/esm2022/search-filter/control-type.mjs +1 -1
  54. package/esm2022/search-filter/date/date-search-filter.component.mjs +3 -3
  55. package/esm2022/search-filter/date/date-search-filter.model.mjs +1 -1
  56. package/esm2022/search-filter/date-time/date-time-search-filter.component.mjs +3 -3
  57. package/esm2022/search-filter/date-time/date-time-search-filter.model.mjs +1 -1
  58. package/esm2022/search-filter/public-api.mjs +1 -1
  59. package/esm2022/search-filter/search-filter-base.model.mjs +1 -1
  60. package/esm2022/search-filter/search-filter-config.model.mjs +1 -1
  61. package/esm2022/search-filter/search-filter-params.type.mjs +1 -1
  62. package/esm2022/search-filter/select/select-search-filter.component.mjs +3 -3
  63. package/esm2022/search-filter/select/select-search-filter.model.mjs +1 -1
  64. package/esm2022/search-filter/select-option.model.mjs +1 -1
  65. package/esm2022/search-filter/text/text-search-filter.component.mjs +3 -3
  66. package/esm2022/search-filter/text/text-search-filter.model.mjs +1 -1
  67. package/esm2022/spinner/entry-spinner/spinner.component.mjs +1 -1
  68. package/esm2022/spinner/public-api.mjs +1 -1
  69. package/esm2022/spinner/spinner.module.mjs +1 -1
  70. package/esm2022/table/components/entry-cell/entry-cell.component.mjs +1 -1
  71. package/esm2022/table/components/entry-cell-context-menu/entry-cell-context-menu.component.mjs +3 -3
  72. package/esm2022/table/components/entry-cell-formatted-value/entry-cell-formatted-value.component.mjs +3 -3
  73. package/esm2022/table/components/entry-table/entry-table.component.mjs +3 -3
  74. package/esm2022/table/entry-table.module.mjs +1 -1
  75. package/esm2022/table/interfaces/entry-table-config.mjs +1 -1
  76. package/esm2022/table/interfaces/paged-query.mjs +1 -1
  77. package/esm2022/table/interfaces/pagination.mjs +1 -1
  78. package/esm2022/table/public-api.mjs +1 -1
  79. package/esm2022/validation/entry-display-control-validation.directive.mjs +1 -1
  80. package/esm2022/validation/entry-form-errors.component.mjs +13 -13
  81. package/esm2022/validation/entry-validation-config.model.mjs +1 -1
  82. package/esm2022/validation/entry-validation.mjs +1 -1
  83. package/esm2022/validation/entry-validation.module.mjs +1 -1
  84. package/esm2022/validation/public-api.mjs +1 -1
  85. package/esm2022/validation/validation-problem-details.interface.mjs +1 -1
  86. package/fesm2022/enigmatry-entry-components-button.mjs.map +1 -1
  87. package/fesm2022/enigmatry-entry-components-common.mjs.map +1 -1
  88. package/fesm2022/enigmatry-entry-components-date-time-picker.mjs +4 -4
  89. package/fesm2022/enigmatry-entry-components-date-time-picker.mjs.map +1 -1
  90. package/fesm2022/enigmatry-entry-components-dialog.mjs +8 -8
  91. package/fesm2022/enigmatry-entry-components-dialog.mjs.map +1 -1
  92. package/fesm2022/enigmatry-entry-components-file-input.mjs.map +1 -1
  93. package/fesm2022/enigmatry-entry-components-permissions.mjs.map +1 -1
  94. package/fesm2022/enigmatry-entry-components-search-filter.mjs +10 -10
  95. package/fesm2022/enigmatry-entry-components-search-filter.mjs.map +1 -1
  96. package/fesm2022/enigmatry-entry-components-spinner.mjs.map +1 -1
  97. package/fesm2022/enigmatry-entry-components-table.mjs +6 -6
  98. package/fesm2022/enigmatry-entry-components-table.mjs.map +1 -1
  99. package/fesm2022/enigmatry-entry-components-validation.mjs +12 -12
  100. package/fesm2022/enigmatry-entry-components-validation.mjs.map +1 -1
  101. package/fesm2022/enigmatry-entry-components.mjs.map +1 -1
  102. package/file-input/README.md +70 -70
  103. package/package.json +4 -4
  104. package/permissions/README.md +67 -67
  105. package/search-filter/README.md +132 -132
  106. package/styles/_generator.scss +25 -25
  107. package/styles/modules/_default-theme.scss +91 -91
  108. package/styles/modules/components/buttons/_generator.scss +10 -10
  109. package/styles/modules/components/buttons/_radio.scss +18 -18
  110. package/styles/modules/components/checkboxes/_generator.scss +31 -31
  111. package/styles/modules/components/dialogs/_generator.scss +13 -13
  112. package/styles/modules/components/forms/_generator.scss +14 -14
  113. package/styles/modules/components/inputs/_generator.scss +14 -14
  114. package/styles/modules/components/search-filter/_generator.scss +14 -14
  115. package/styles/modules/components/tables/_cells.scss +25 -25
  116. package/styles/modules/components/tables/_generator.scss +6 -6
  117. package/styles/modules/components/tables/_header.scss +10 -10
  118. package/styles/modules/components/tables/_no-result.scss +9 -9
  119. package/styles/modules/components/tables/_rows.scss +39 -39
  120. package/styles/modules/components/tables/_sorting.scss +10 -10
  121. package/styles/modules/components/tables/_table-body.scss +12 -12
  122. package/styles/modules/components/toggle/_generator.scss +47 -47
  123. package/styles/modules/typography/_fonts.scss +64 -64
  124. package/styles/modules/vendors/angular-material/_generator.scss +46 -46
  125. package/styles/modules/vendors/angular-material/_palette-generator.scss +32 -32
  126. package/styles/modules/vendors/angular-material/_typography-generator.scss +107 -107
  127. package/styles/partials/core/components/_index.scss +4 -4
  128. package/styles/partials/core/components/date-time-picker/_general.scss +64 -64
  129. package/styles/partials/core/components/dialogs/_general.scss +23 -23
  130. package/styles/partials/core/components/forms/_general.scss +21 -21
  131. package/styles/partials/core/components/search-filter/_general.scss +8 -8
  132. package/styles/partials/core/components/tables/_general.scss +17 -17
  133. package/styles/partials/generator-test.scss +41 -41
  134. package/styles/partials/theming.scss +1 -1
  135. package/table/README.md +76 -76
  136. package/validation/README.md +108 -108
@@ -1,71 +1,71 @@
1
- # Entry File Input
2
-
3
- `EntryFileInputComponent` is an Angular component that provides a custom file input button with additional functionality
4
-
5
- ## Setup
6
-
7
- Import the [EntryFileInputModule] in your NgModule:
8
-
9
- ```typescript
10
- import { EntryFileInputModule } from '@enigmatry/entry-components/file-input';
11
- @NgModule({
12
- imports: [
13
- EntryFileInputModule,
14
- ...
15
- ],
16
- ...
17
- })
18
- export class MyModule {}
19
- ```
20
-
21
- ## Usage
22
-
23
- Use the entry-file-input component in your template:
24
-
25
- ```html
26
- <entry-file-input
27
- [label]="'Choose a file...'"
28
- [matIcon]="'attachment'"
29
- [accept]="'image/*'"
30
- [multiple]="false"
31
- [disabled]="false"
32
- [(ngModel)]="files"
33
- (selectedFile)="selectEvent($event)">
34
- </entry-file-input>
35
- ```
36
-
37
- ```typescript
38
- export class Sample {
39
-
40
- files: File | FileList;
41
-
42
- selectEvent(files: FileList | File): void {
43
- if (files instanceof FileList) {
44
- ...
45
- } else {
46
- ...
47
- }
48
- };
49
- }
50
- ```
51
-
52
- ## API Summary
53
-
54
- #### Inputs
55
- - matIcon: string
56
- - MatIcon for the select file button. Defaults to 'insert_drive_file' (optional).
57
- - multiple: boolean
58
- - Sets if multiple files can be selected at once in.
59
- - accept: string
60
- - Sets files accepted when opening the file browser dialog. Same as "accept" attribute in `<input/>` element.
61
- - disabled: boolean
62
- - Disables input and clears selected files.
63
-
64
- #### Events
65
-
66
- - selectedFile: function($event)
67
- - Emits a [File or FileList] object.
68
-
69
- #### Styling
70
-
1
+ # Entry File Input
2
+
3
+ `EntryFileInputComponent` is an Angular component that provides a custom file input button with additional functionality
4
+
5
+ ## Setup
6
+
7
+ Import the [EntryFileInputModule] in your NgModule:
8
+
9
+ ```typescript
10
+ import { EntryFileInputModule } from '@enigmatry/entry-components/file-input';
11
+ @NgModule({
12
+ imports: [
13
+ EntryFileInputModule,
14
+ ...
15
+ ],
16
+ ...
17
+ })
18
+ export class MyModule {}
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Use the entry-file-input component in your template:
24
+
25
+ ```html
26
+ <entry-file-input
27
+ [label]="'Choose a file...'"
28
+ [matIcon]="'attachment'"
29
+ [accept]="'image/*'"
30
+ [multiple]="false"
31
+ [disabled]="false"
32
+ [(ngModel)]="files"
33
+ (selectedFile)="selectEvent($event)">
34
+ </entry-file-input>
35
+ ```
36
+
37
+ ```typescript
38
+ export class Sample {
39
+
40
+ files: File | FileList;
41
+
42
+ selectEvent(files: FileList | File): void {
43
+ if (files instanceof FileList) {
44
+ ...
45
+ } else {
46
+ ...
47
+ }
48
+ };
49
+ }
50
+ ```
51
+
52
+ ## API Summary
53
+
54
+ #### Inputs
55
+ - matIcon: string
56
+ - MatIcon for the select file button. Defaults to 'insert_drive_file' (optional).
57
+ - multiple: boolean
58
+ - Sets if multiple files can be selected at once in.
59
+ - accept: string
60
+ - Sets files accepted when opening the file browser dialog. Same as "accept" attribute in `<input/>` element.
61
+ - disabled: boolean
62
+ - Disables input and clears selected files.
63
+
64
+ #### Events
65
+
66
+ - selectedFile: function($event)
67
+ - Emits a [File or FileList] object.
68
+
69
+ #### Styling
70
+
71
71
  Button type and color can be styled by providing entry-button configuration.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enigmatry/entry-components",
3
- "version": "17.0.0-preview.5.1",
3
+ "version": "17.0.0-preview.7",
4
4
  "author": "Enigmatry",
5
5
  "description": "Enigmatry entry angular material components",
6
6
  "homepage": "https://github.com/enigmatry/entry-angular-building-blocks/tree/master/libs/entry-components#readme",
@@ -16,11 +16,11 @@
16
16
  "@angular/core": "^17.0.0",
17
17
  "@angular/material": "^17.0.0",
18
18
  "@angular/forms": "^17.0.0",
19
- "@angular/platform-browser": "^17.0.0",
20
- "lodash-es": "^4.17.21"
19
+ "@angular/platform-browser": "^17.0.0"
21
20
  },
22
21
  "dependencies": {
23
- "tslib": "^2.6.3"
22
+ "lodash-es": "^4.17.21",
23
+ "tslib": "^2.6.2"
24
24
  },
25
25
  "publishConfig": {
26
26
  "access": "public"
@@ -1,68 +1,68 @@
1
- # Entry Permissions
2
-
3
- Reusable angular components for applying permission-based authorization:
4
- - Route guard
5
- - View directives
6
- - Pipe
7
-
8
- ## Integration
9
-
10
- Permissions is part of the `@enigmatry/entry-components`:
11
-
12
- ```npm
13
- npm i @enigmatry/entry-components
14
- ```
15
-
16
- Create a permission service that implements EntryPermissionService&lt;T&gt; where T is the permission type that you use in your application. You need to provide implementation of the hasPermissions method (for example by checking if the logged in user has needed permissions).
17
-
18
- ```ts
19
- export class PermissionService implements EntryPermissionService<PermissionId> {
20
- hasPermissions(permissions: PermissionId[]): boolean {
21
- // TODO: provide implementation
22
- }
23
- }
24
- ```
25
-
26
- Import permissions module:
27
-
28
- ```ts
29
- import { EntryPermissionModule } from '@enigmatry/entry-components/permissions';
30
- ```
31
-
32
- Provide implementation of the EntryPermissionService:
33
-
34
- ```ts
35
- providers: [
36
- {
37
- provide: EntryPermissionService,
38
- useClass: PermissionService
39
- }
40
- ]
41
- ```
42
-
43
- <!-- `PermissionService` should be provided in the root scope. -- TODO: add more details with example from the blueprint app -->
44
-
45
- ## Basic usage
46
-
47
- ### Route guard
48
-
49
- ```ts
50
- canActivate: [entryPermissionGuard],
51
- data: {
52
- permissions: {
53
- only: [PermissionId.UsersRead]
54
- }
55
- }
56
- ```
57
-
58
- ### View directives
59
-
60
- ```html
61
- <button mat-menu-item *entryPermissionsOnly="[PermissionId.UsersRead]" routerLink="users">Users</button>
62
- ```
63
-
64
- ### Pipe
65
-
66
- ```ts
67
- [isEnabled]="[PermissionId.UsersWrite] | entryHasPermissions"
1
+ # Entry Permissions
2
+
3
+ Reusable angular components for applying permission-based authorization:
4
+ - Route guard
5
+ - View directives
6
+ - Pipe
7
+
8
+ ## Integration
9
+
10
+ Permissions is part of the `@enigmatry/entry-components`:
11
+
12
+ ```npm
13
+ npm i @enigmatry/entry-components
14
+ ```
15
+
16
+ Create a permission service that implements EntryPermissionService&lt;T&gt; where T is the permission type that you use in your application. You need to provide implementation of the hasPermissions method (for example by checking if the logged in user has needed permissions).
17
+
18
+ ```ts
19
+ export class PermissionService implements EntryPermissionService<PermissionId> {
20
+ hasPermissions(permissions: PermissionId[]): boolean {
21
+ // TODO: provide implementation
22
+ }
23
+ }
24
+ ```
25
+
26
+ Import permissions module:
27
+
28
+ ```ts
29
+ import { EntryPermissionModule } from '@enigmatry/entry-components/permissions';
30
+ ```
31
+
32
+ Provide implementation of the EntryPermissionService:
33
+
34
+ ```ts
35
+ providers: [
36
+ {
37
+ provide: EntryPermissionService,
38
+ useClass: PermissionService
39
+ }
40
+ ]
41
+ ```
42
+
43
+ <!-- `PermissionService` should be provided in the root scope. -- TODO: add more details with example from the blueprint app -->
44
+
45
+ ## Basic usage
46
+
47
+ ### Route guard
48
+
49
+ ```ts
50
+ canActivate: [entryPermissionGuard],
51
+ data: {
52
+ permissions: {
53
+ only: [PermissionId.UsersRead]
54
+ }
55
+ }
56
+ ```
57
+
58
+ ### View directives
59
+
60
+ ```html
61
+ <button mat-menu-item *entryPermissionsOnly="[PermissionId.UsersRead]" routerLink="users">Users</button>
62
+ ```
63
+
64
+ ### Pipe
65
+
66
+ ```ts
67
+ [isEnabled]="[PermissionId.UsersWrite] | entryHasPermissions"
68
68
  ```
@@ -1,132 +1,132 @@
1
- # Entry Search Filter
2
-
3
- Entry component for providing standard filtering capabilities that can be consumed by entry-table component, but also any other list data representation component like Angular material table component. It supports the following filtering inputs:
4
-
5
- * Text filter
6
- * Select filter (fixed or dynamic options)
7
- * Autocomplete filter
8
- * Date filter
9
- * DateTime filter
10
-
11
- ## Integration
12
-
13
- Import component package:
14
-
15
- ```ts
16
- import { EntrySearchFilterModule } from '@enigmatry/entry-components/search-filter';
17
- ```
18
-
19
- ## Basic usage
20
-
21
- Provide filters in component and use `<entry-search-filter>` to display them in view
22
-
23
- ```ts
24
- import {
25
- AutocompleteSearchFilter,
26
- SelectOption,
27
- SelectSearchFilter,
28
- TextSearchFilter,
29
- DateTimeSearchFilter
30
- } from '@enigmatry/entry-components/search-filter';
31
-
32
- @Component({...})
33
- export class ExampleComponent {
34
-
35
- filters = [
36
- new TextSearchFilter({
37
- key: 'name',
38
- label: 'Name',
39
- placeholder: 'Name',
40
- maxLength: 25
41
- }),
42
- new SelectSearchFilter({
43
- key: 'username',
44
- label: 'Username',
45
- placeholder: 'Select username',
46
- multiSelect: false,
47
- options$: this._usersService
48
- .getUsernames()
49
- .pipe(map(usernames => usernames.map(un => new SelectOption(un, un))))
50
- }),
51
- new AutocompleteSearchFilter({
52
- key: 'country',
53
- label: 'Country',
54
- placeholder: 'Select country',
55
- minimumCharacters: 0,
56
- search: (input: string) => of(Object.values(Country)
57
- .filter(value => value.toLocaleLowerCase().includes(input.toLocaleLowerCase()))
58
- .map((country => new SelectOption(country, country))))
59
- }),
60
- new DateTimeSearchFilter({
61
- key: 'createdAt',
62
- label: 'Created at',
63
- placeholder: 'Created at'
64
- })
65
- ];
66
- }
67
- ```
68
-
69
- ```html
70
- <entry-search-filter
71
- [searchFilters]="filters"
72
- (searchFilterChange)="searchFilterChange($event)">
73
- </entry-search-filter>
74
- ```
75
-
76
- ## Configuration
77
-
78
- - provide entry search filter config (optional):
79
- - `applyButtonText`: Apply button text
80
- - `noneSelectedOptionText`: None option text in select dropdown
81
-
82
- - provide `ENTRY_MAT_DATE_TIME` for `DateTimeSearchFilter` (required when this filter is used):
83
- - matDateFormats of type `MatDateFormats`
84
- - `compareDate` function
85
-
86
- ```ts
87
- import { EntrySearchFilterModule, provideEntrySearchFilterConfig } from '@enigmatry/entry-components/search-filter';
88
- // ...
89
-
90
- @NgModule({
91
- imports: [
92
- EntrySearchFilterModule
93
- ],
94
- providers: [
95
- provideEntrySearchFilterConfig({
96
- applyButtonText: 'Filter',
97
- noneSelectedOptionText: '-'
98
- }),
99
- // provide date adapter used by mat-datepicker
100
- // usually provided in shared or material module
101
- {
102
- provide: DateAdapter,
103
- useClass: DateFnsAdapter,
104
- deps: [MAT_DATE_LOCALE],
105
- },
106
- // provide matDateFormats along with compareDate function
107
- {
108
- provide: ENTRY_MAT_DATE_TIME,
109
- useValue: {
110
- matDateFormats: {
111
- parse: {
112
- // formats used for parsing:
113
- dateInput: ['dd-MM-yyyy', 'dd-MM-yyyy HH', 'dd-MM-yyyy HH:mm'],
114
- },
115
- display: {
116
- // display value in input always as 'dd-MM-yyyy HH:mm'
117
- dateInput: 'dd-MM-yyyy HH:mm',
118
- // standard mat-datepicker calendar options
119
- monthYearLabel: 'LLL uuuu',
120
- dateA11yLabel: 'PP',
121
- monthYearA11yLabel: 'LLLL uuuu',
122
- },
123
- },
124
- compareDate(first: Date, second: Date): number {
125
- return first.getTime() - second.getTime();
126
- }
127
- }
128
- }
129
- ]
130
- })
131
- export class SharedModule { }
132
- ```
1
+ # Entry Search Filter
2
+
3
+ Entry component for providing standard filtering capabilities that can be consumed by entry-table component, but also any other list data representation component like Angular material table component. It supports the following filtering inputs:
4
+
5
+ * Text filter
6
+ * Select filter (fixed or dynamic options)
7
+ * Autocomplete filter
8
+ * Date filter
9
+ * DateTime filter
10
+
11
+ ## Integration
12
+
13
+ Import component package:
14
+
15
+ ```ts
16
+ import { EntrySearchFilterModule } from '@enigmatry/entry-components/search-filter';
17
+ ```
18
+
19
+ ## Basic usage
20
+
21
+ Provide filters in component and use `<entry-search-filter>` to display them in view
22
+
23
+ ```ts
24
+ import {
25
+ AutocompleteSearchFilter,
26
+ SelectOption,
27
+ SelectSearchFilter,
28
+ TextSearchFilter,
29
+ DateTimeSearchFilter
30
+ } from '@enigmatry/entry-components/search-filter';
31
+
32
+ @Component({...})
33
+ export class ExampleComponent {
34
+
35
+ filters = [
36
+ new TextSearchFilter({
37
+ key: 'name',
38
+ label: 'Name',
39
+ placeholder: 'Name',
40
+ maxLength: 25
41
+ }),
42
+ new SelectSearchFilter({
43
+ key: 'username',
44
+ label: 'Username',
45
+ placeholder: 'Select username',
46
+ multiSelect: false,
47
+ options$: this._usersService
48
+ .getUsernames()
49
+ .pipe(map(usernames => usernames.map(un => new SelectOption(un, un))))
50
+ }),
51
+ new AutocompleteSearchFilter({
52
+ key: 'country',
53
+ label: 'Country',
54
+ placeholder: 'Select country',
55
+ minimumCharacters: 0,
56
+ search: (input: string) => of(Object.values(Country)
57
+ .filter(value => value.toLocaleLowerCase().includes(input.toLocaleLowerCase()))
58
+ .map((country => new SelectOption(country, country))))
59
+ }),
60
+ new DateTimeSearchFilter({
61
+ key: 'createdAt',
62
+ label: 'Created at',
63
+ placeholder: 'Created at'
64
+ })
65
+ ];
66
+ }
67
+ ```
68
+
69
+ ```html
70
+ <entry-search-filter
71
+ [searchFilters]="filters"
72
+ (searchFilterChange)="searchFilterChange($event)">
73
+ </entry-search-filter>
74
+ ```
75
+
76
+ ## Configuration
77
+
78
+ - provide entry search filter config (optional):
79
+ - `applyButtonText`: Apply button text
80
+ - `noneSelectedOptionText`: None option text in select dropdown
81
+
82
+ - provide `ENTRY_MAT_DATE_TIME` for `DateTimeSearchFilter` (required when this filter is used):
83
+ - matDateFormats of type `MatDateFormats`
84
+ - `compareDate` function
85
+
86
+ ```ts
87
+ import { EntrySearchFilterModule, provideEntrySearchFilterConfig } from '@enigmatry/entry-components/search-filter';
88
+ // ...
89
+
90
+ @NgModule({
91
+ imports: [
92
+ EntrySearchFilterModule
93
+ ],
94
+ providers: [
95
+ provideEntrySearchFilterConfig({
96
+ applyButtonText: 'Filter',
97
+ noneSelectedOptionText: '-'
98
+ }),
99
+ // provide date adapter used by mat-datepicker
100
+ // usually provided in shared or material module
101
+ {
102
+ provide: DateAdapter,
103
+ useClass: DateFnsAdapter,
104
+ deps: [MAT_DATE_LOCALE],
105
+ },
106
+ // provide matDateFormats along with compareDate function
107
+ {
108
+ provide: ENTRY_MAT_DATE_TIME,
109
+ useValue: {
110
+ matDateFormats: {
111
+ parse: {
112
+ // formats used for parsing:
113
+ dateInput: ['dd-MM-yyyy', 'dd-MM-yyyy HH', 'dd-MM-yyyy HH:mm'],
114
+ },
115
+ display: {
116
+ // display value in input always as 'dd-MM-yyyy HH:mm'
117
+ dateInput: 'dd-MM-yyyy HH:mm',
118
+ // standard mat-datepicker calendar options
119
+ monthYearLabel: 'LLL uuuu',
120
+ dateA11yLabel: 'PP',
121
+ monthYearA11yLabel: 'LLLL uuuu',
122
+ },
123
+ },
124
+ compareDate(first: Date, second: Date): number {
125
+ return first.getTime() - second.getTime();
126
+ }
127
+ }
128
+ }
129
+ ]
130
+ })
131
+ export class SharedModule { }
132
+ ```
@@ -1,26 +1,26 @@
1
- @use 'modules/components/dialogs/generator' as dialogs;
2
- @use 'modules/components/forms/generator' as forms;
3
- @use 'modules/components/search-filter/generator' as search-filters;
4
- @use 'modules/components/tables/generator' as tables;
5
- @use 'modules/components/inputs/generator' as inputs;
6
- @use 'modules/components/buttons/generator' as buttons;
7
- @use 'modules/components/checkboxes/generator' as checkboxes;
8
- @use 'modules/components/toggle/generator' as toggle;
9
- @use 'modules/default-theme' as default;
10
- @use 'modules/vendors/angular-material/generator' as material-theme;
11
- @use 'sass:map';
12
- @use 'partials/theming';
13
-
14
- @mixin generate-from($custom-theme: ()) {
15
- $merged-theme: map.deep-merge(default.$theme, $custom-theme);
16
-
17
- @include material-theme.generate-from($merged-theme);
18
- @include inputs.generate-from($merged-theme);
19
- @include buttons.generate-from($merged-theme);
20
- @include tables.generate-from($merged-theme);
21
- @include forms.generate-from($merged-theme);
22
- @include search-filters.generate-from($merged-theme);
23
- @include dialogs.generate-from($merged-theme);
24
- @include checkboxes.generate-from($merged-theme);
25
- @include toggle.generate-from($merged-theme);
1
+ @use 'modules/components/dialogs/generator' as dialogs;
2
+ @use 'modules/components/forms/generator' as forms;
3
+ @use 'modules/components/search-filter/generator' as search-filters;
4
+ @use 'modules/components/tables/generator' as tables;
5
+ @use 'modules/components/inputs/generator' as inputs;
6
+ @use 'modules/components/buttons/generator' as buttons;
7
+ @use 'modules/components/checkboxes/generator' as checkboxes;
8
+ @use 'modules/components/toggle/generator' as toggle;
9
+ @use 'modules/default-theme' as default;
10
+ @use 'modules/vendors/angular-material/generator' as material-theme;
11
+ @use 'sass:map';
12
+ @use 'partials/theming';
13
+
14
+ @mixin generate-from($custom-theme: ()) {
15
+ $merged-theme: map.deep-merge(default.$theme, $custom-theme);
16
+
17
+ @include material-theme.generate-from($merged-theme);
18
+ @include inputs.generate-from($merged-theme);
19
+ @include buttons.generate-from($merged-theme);
20
+ @include tables.generate-from($merged-theme);
21
+ @include forms.generate-from($merged-theme);
22
+ @include search-filters.generate-from($merged-theme);
23
+ @include dialogs.generate-from($merged-theme);
24
+ @include checkboxes.generate-from($merged-theme);
25
+ @include toggle.generate-from($merged-theme);
26
26
  }