geonetwork-ui 2.5.0-dev.d91908296 → 2.5.0-dev.e41adefdb

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 (150) hide show
  1. package/esm2022/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.mjs +50 -32
  2. package/esm2022/libs/api/repository/src/lib/gn4/gn4-repository.mjs +2 -2
  3. package/esm2022/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.mjs +18 -16
  4. package/esm2022/libs/feature/dataviz/src/lib/service/data.service.mjs +17 -7
  5. package/esm2022/libs/feature/dataviz/src/lib/table-view/table-view.component.mjs +12 -17
  6. package/esm2022/libs/feature/editor/src/lib/components/constraint-card/constraint-card.component.mjs +3 -3
  7. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.mjs +2 -1
  8. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.mjs +2 -2
  9. package/esm2022/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.mjs +11 -11
  10. package/esm2022/libs/feature/editor/src/lib/fields.config.mjs +2 -2
  11. package/esm2022/libs/feature/record/src/lib/data-view/data-view.component.mjs +3 -3
  12. package/esm2022/libs/feature/record/src/lib/feature-record.module.mjs +6 -7
  13. package/esm2022/libs/feature/search/src/lib/utils/service/fields.mjs +46 -1
  14. package/esm2022/libs/feature/search/src/lib/utils/service/fields.service.mjs +3 -2
  15. package/esm2022/libs/ui/dataviz/src/index.mjs +3 -3
  16. package/esm2022/libs/ui/dataviz/src/lib/data-table/custom.mat.paginator.intl.mjs +51 -0
  17. package/esm2022/libs/ui/dataviz/src/lib/data-table/data-table.component.mjs +133 -0
  18. package/esm2022/libs/ui/dataviz/src/lib/data-table/data-table.data.source.mjs +24 -0
  19. package/esm2022/libs/ui/dataviz/src/lib/data-table/data-table.fixtures.mjs +82 -0
  20. package/esm2022/libs/ui/elements/src/index.mjs +2 -1
  21. package/esm2022/libs/ui/elements/src/lib/application-banner/application-banner.component.mjs +78 -0
  22. package/esm2022/libs/ui/elements/src/lib/metadata-info/metadata-info.component.mjs +18 -10
  23. package/esm2022/libs/ui/elements/src/lib/record-api-form/record-api-form.component.mjs +2 -1
  24. package/esm2022/libs/ui/elements/src/lib/ui-elements.module.mjs +10 -4
  25. package/esm2022/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.mjs +7 -2
  26. package/esm2022/libs/ui/search/src/lib/results-table/results-table.component.mjs +14 -12
  27. package/esm2022/libs/util/data-fetcher/src/index.mjs +3 -1
  28. package/esm2022/libs/util/data-fetcher/src/lib/model.mjs +7 -3
  29. package/esm2022/libs/util/data-fetcher/src/lib/readers/wfs.mjs +20 -2
  30. package/esm2022/libs/util/data-fetcher/src/lib/utils.mjs +3 -3
  31. package/esm2022/libs/util/shared/src/lib/services/date.service.mjs +41 -0
  32. package/esm2022/libs/util/shared/src/lib/services/index.mjs +2 -1
  33. package/esm2022/libs/util/shared/src/lib/utils/temporal-extent-union.mjs +4 -4
  34. package/esm2022/translations/de.json +9 -3
  35. package/esm2022/translations/en.json +9 -3
  36. package/esm2022/translations/es.json +9 -3
  37. package/esm2022/translations/fr.json +11 -5
  38. package/esm2022/translations/it.json +9 -3
  39. package/esm2022/translations/nl.json +9 -3
  40. package/esm2022/translations/pt.json +9 -3
  41. package/fesm2022/geonetwork-ui.mjs +867 -432
  42. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  43. package/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.d.ts +3 -1
  44. package/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.d.ts.map +1 -1
  45. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts.map +1 -1
  46. package/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.d.ts +7 -9
  47. package/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.d.ts.map +1 -1
  48. package/libs/feature/dataviz/src/lib/service/data.service.d.ts.map +1 -1
  49. package/libs/feature/dataviz/src/lib/table-view/table-view.component.d.ts +3 -6
  50. package/libs/feature/dataviz/src/lib/table-view/table-view.component.d.ts.map +1 -1
  51. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.d.ts.map +1 -1
  52. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.d.ts.map +1 -1
  53. package/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.d.ts +3 -3
  54. package/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.d.ts.map +1 -1
  55. package/libs/feature/record/src/lib/feature-record.module.d.ts +2 -2
  56. package/libs/feature/record/src/lib/feature-record.module.d.ts.map +1 -1
  57. package/libs/feature/search/src/lib/utils/service/fields.d.ts +10 -0
  58. package/libs/feature/search/src/lib/utils/service/fields.d.ts.map +1 -1
  59. package/libs/feature/search/src/lib/utils/service/fields.service.d.ts.map +1 -1
  60. package/libs/ui/dataviz/src/index.d.ts +2 -2
  61. package/libs/ui/dataviz/src/index.d.ts.map +1 -1
  62. package/libs/ui/dataviz/src/lib/data-table/custom.mat.paginator.intl.d.ts +14 -0
  63. package/libs/ui/dataviz/src/lib/data-table/custom.mat.paginator.intl.d.ts.map +1 -0
  64. package/libs/ui/dataviz/src/lib/data-table/data-table.component.d.ts +45 -0
  65. package/libs/ui/dataviz/src/lib/data-table/data-table.component.d.ts.map +1 -0
  66. package/libs/ui/dataviz/src/lib/data-table/data-table.data.source.d.ts +12 -0
  67. package/libs/ui/dataviz/src/lib/data-table/data-table.data.source.d.ts.map +1 -0
  68. package/libs/ui/dataviz/src/lib/data-table/data-table.fixtures.d.ts +10 -0
  69. package/libs/ui/dataviz/src/lib/data-table/data-table.fixtures.d.ts.map +1 -0
  70. package/libs/ui/elements/src/index.d.ts +1 -0
  71. package/libs/ui/elements/src/index.d.ts.map +1 -1
  72. package/libs/ui/elements/src/lib/application-banner/application-banner.component.d.ts +16 -0
  73. package/libs/ui/elements/src/lib/application-banner/application-banner.component.d.ts.map +1 -0
  74. package/libs/ui/elements/src/lib/metadata-info/metadata-info.component.d.ts +5 -0
  75. package/libs/ui/elements/src/lib/metadata-info/metadata-info.component.d.ts.map +1 -1
  76. package/libs/ui/elements/src/lib/record-api-form/record-api-form.component.d.ts.map +1 -1
  77. package/libs/ui/elements/src/lib/ui-elements.module.d.ts +2 -1
  78. package/libs/ui/elements/src/lib/ui-elements.module.d.ts.map +1 -1
  79. package/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.d.ts.map +1 -1
  80. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts +3 -2
  81. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
  82. package/libs/util/data-fetcher/src/index.d.ts +3 -1
  83. package/libs/util/data-fetcher/src/index.d.ts.map +1 -1
  84. package/libs/util/data-fetcher/src/lib/model.d.ts +1 -1
  85. package/libs/util/data-fetcher/src/lib/model.d.ts.map +1 -1
  86. package/libs/util/data-fetcher/src/lib/readers/wfs.d.ts.map +1 -1
  87. package/libs/util/shared/src/lib/services/date.service.d.ts +13 -0
  88. package/libs/util/shared/src/lib/services/date.service.d.ts.map +1 -0
  89. package/libs/util/shared/src/lib/services/index.d.ts +1 -0
  90. package/libs/util/shared/src/lib/services/index.d.ts.map +1 -1
  91. package/libs/util/shared/src/lib/utils/temporal-extent-union.d.ts +2 -1
  92. package/libs/util/shared/src/lib/utils/temporal-extent-union.d.ts.map +1 -1
  93. package/package.json +1 -1
  94. package/src/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.ts +55 -32
  95. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +1 -5
  96. package/src/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.html +3 -3
  97. package/src/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.ts +17 -15
  98. package/src/libs/feature/dataviz/src/lib/service/data.service.ts +21 -11
  99. package/src/libs/feature/dataviz/src/lib/table-view/table-view.component.html +4 -3
  100. package/src/libs/feature/dataviz/src/lib/table-view/table-view.component.ts +9 -18
  101. package/src/libs/feature/editor/src/lib/components/constraint-card/constraint-card.component.html +1 -1
  102. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.ts +1 -0
  103. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.ts +1 -1
  104. package/src/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.ts +3 -4
  105. package/src/libs/feature/editor/src/lib/fields.config.ts +1 -1
  106. package/src/libs/feature/record/src/lib/data-view/data-view.component.html +1 -1
  107. package/src/libs/feature/record/src/lib/feature-record.module.ts +6 -4
  108. package/src/libs/feature/search/src/lib/utils/service/fields.service.ts +2 -0
  109. package/src/libs/feature/search/src/lib/utils/service/fields.ts +55 -0
  110. package/src/libs/ui/dataviz/src/index.ts +2 -2
  111. package/src/libs/ui/dataviz/src/lib/data-table/custom.mat.paginator.intl.ts +52 -0
  112. package/src/libs/ui/dataviz/src/lib/{table/table.component.css → data-table/data-table.component.css} +4 -0
  113. package/src/libs/ui/dataviz/src/lib/data-table/data-table.component.html +67 -0
  114. package/src/libs/ui/dataviz/src/lib/data-table/data-table.component.ts +173 -0
  115. package/src/libs/ui/dataviz/src/lib/data-table/data-table.data.source.ts +33 -0
  116. package/src/libs/ui/dataviz/src/lib/data-table/data-table.fixtures.ts +84 -0
  117. package/src/libs/ui/elements/src/index.ts +1 -0
  118. package/src/libs/ui/elements/src/lib/application-banner/application-banner.component.css +0 -0
  119. package/src/libs/ui/elements/src/lib/application-banner/application-banner.component.html +25 -0
  120. package/src/libs/ui/elements/src/lib/application-banner/application-banner.component.ts +70 -0
  121. package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.html +3 -3
  122. package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts +12 -2
  123. package/src/libs/ui/elements/src/lib/record-api-form/record-api-form.component.ts +2 -0
  124. package/src/libs/ui/elements/src/lib/ui-elements.module.ts +3 -0
  125. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts +6 -0
  126. package/src/libs/ui/search/src/lib/results-table/results-table.component.ts +4 -2
  127. package/src/libs/util/data-fetcher/src/index.ts +3 -0
  128. package/src/libs/util/data-fetcher/src/lib/model.ts +6 -2
  129. package/src/libs/util/data-fetcher/src/lib/readers/wfs.ts +23 -1
  130. package/src/libs/util/data-fetcher/src/lib/utils.ts +2 -2
  131. package/src/libs/util/shared/src/lib/services/date.service.ts +45 -0
  132. package/src/libs/util/shared/src/lib/services/index.ts +1 -0
  133. package/src/libs/util/shared/src/lib/utils/temporal-extent-union.ts +6 -3
  134. package/translations/de.json +9 -3
  135. package/translations/en.json +9 -3
  136. package/translations/es.json +9 -3
  137. package/translations/fr.json +11 -5
  138. package/translations/it.json +9 -3
  139. package/translations/nl.json +9 -3
  140. package/translations/pt.json +9 -3
  141. package/translations/sk.json +9 -3
  142. package/esm2022/libs/ui/dataviz/src/lib/table/table.component.mjs +0 -61
  143. package/esm2022/libs/ui/dataviz/src/lib/table/table.fixtures.mjs +0 -40
  144. package/libs/ui/dataviz/src/lib/table/table.component.d.ts +0 -29
  145. package/libs/ui/dataviz/src/lib/table/table.component.d.ts.map +0 -1
  146. package/libs/ui/dataviz/src/lib/table/table.fixtures.d.ts +0 -11
  147. package/libs/ui/dataviz/src/lib/table/table.fixtures.d.ts.map +0 -1
  148. package/src/libs/ui/dataviz/src/lib/table/table.component.html +0 -40
  149. package/src/libs/ui/dataviz/src/lib/table/table.component.ts +0 -80
  150. package/src/libs/ui/dataviz/src/lib/table/table.fixtures.ts +0 -40
@@ -1,40 +0,0 @@
1
- export const tableItemFixture = () => [
2
- {
3
- name: 'name 1',
4
- id: 'id 1',
5
- age: 15,
6
- },
7
- {
8
- name: 'name 2',
9
- id: 'id 2',
10
- age: 10,
11
- },
12
- {
13
- name: 'name 3',
14
- id: 'id 3',
15
- age: 55,
16
- },
17
- ];
18
- export const someHabTableItemFixture = () => [
19
- {
20
- name: 'France',
21
- id: '1',
22
- pop: 50500000,
23
- },
24
- {
25
- name: 'Italy',
26
- id: '2',
27
- pop: 155878789655,
28
- },
29
- {
30
- name: 'UK',
31
- id: '3',
32
- pop: 31522456,
33
- },
34
- {
35
- name: 'US',
36
- id: '4',
37
- pop: 3215448888,
38
- },
39
- ];
40
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFibGUuZml4dHVyZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9saWJzL3VpL2RhdGF2aXovc3JjL2xpYi90YWJsZS90YWJsZS5maXh0dXJlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQUMsTUFBTSxnQkFBZ0IsR0FBRyxHQUFHLEVBQUUsQ0FBQztJQUNwQztRQUNFLElBQUksRUFBRSxRQUFRO1FBQ2QsRUFBRSxFQUFFLE1BQU07UUFDVixHQUFHLEVBQUUsRUFBRTtLQUNSO0lBQ0Q7UUFDRSxJQUFJLEVBQUUsUUFBUTtRQUNkLEVBQUUsRUFBRSxNQUFNO1FBQ1YsR0FBRyxFQUFFLEVBQUU7S0FDUjtJQUNEO1FBQ0UsSUFBSSxFQUFFLFFBQVE7UUFDZCxFQUFFLEVBQUUsTUFBTTtRQUNWLEdBQUcsRUFBRSxFQUFFO0tBQ1I7Q0FDRixDQUFBO0FBRUQsTUFBTSxDQUFDLE1BQU0sdUJBQXVCLEdBQUcsR0FBRyxFQUFFLENBQUM7SUFDM0M7UUFDRSxJQUFJLEVBQUUsUUFBUTtRQUNkLEVBQUUsRUFBRSxHQUFHO1FBQ1AsR0FBRyxFQUFFLFFBQVE7S0FDZDtJQUNEO1FBQ0UsSUFBSSxFQUFFLE9BQU87UUFDYixFQUFFLEVBQUUsR0FBRztRQUNQLEdBQUcsRUFBRSxZQUFZO0tBQ2xCO0lBQ0Q7UUFDRSxJQUFJLEVBQUUsSUFBSTtRQUNWLEVBQUUsRUFBRSxHQUFHO1FBQ1AsR0FBRyxFQUFFLFFBQVE7S0FDZDtJQUNEO1FBQ0UsSUFBSSxFQUFFLElBQUk7UUFDVixFQUFFLEVBQUUsR0FBRztRQUNQLEdBQUcsRUFBRSxVQUFVO0tBQ2hCO0NBQ0YsQ0FBQSIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCB0YWJsZUl0ZW1GaXh0dXJlID0gKCkgPT4gW1xuICB7XG4gICAgbmFtZTogJ25hbWUgMScsXG4gICAgaWQ6ICdpZCAxJyxcbiAgICBhZ2U6IDE1LFxuICB9LFxuICB7XG4gICAgbmFtZTogJ25hbWUgMicsXG4gICAgaWQ6ICdpZCAyJyxcbiAgICBhZ2U6IDEwLFxuICB9LFxuICB7XG4gICAgbmFtZTogJ25hbWUgMycsXG4gICAgaWQ6ICdpZCAzJyxcbiAgICBhZ2U6IDU1LFxuICB9LFxuXVxuXG5leHBvcnQgY29uc3Qgc29tZUhhYlRhYmxlSXRlbUZpeHR1cmUgPSAoKSA9PiBbXG4gIHtcbiAgICBuYW1lOiAnRnJhbmNlJyxcbiAgICBpZDogJzEnLFxuICAgIHBvcDogNTA1MDAwMDAsXG4gIH0sXG4gIHtcbiAgICBuYW1lOiAnSXRhbHknLFxuICAgIGlkOiAnMicsXG4gICAgcG9wOiAxNTU4Nzg3ODk2NTUsXG4gIH0sXG4gIHtcbiAgICBuYW1lOiAnVUsnLFxuICAgIGlkOiAnMycsXG4gICAgcG9wOiAzMTUyMjQ1NixcbiAgfSxcbiAge1xuICAgIG5hbWU6ICdVUycsXG4gICAgaWQ6ICc0JyxcbiAgICBwb3A6IDMyMTU0NDg4ODgsXG4gIH0sXG5dXG4iXX0=
@@ -1,29 +0,0 @@
1
- import { AfterViewInit, ElementRef, EventEmitter } from '@angular/core';
2
- import { MatSort } from '@angular/material/sort';
3
- import { TableVirtualScrollDataSource } from 'ng-table-virtual-scroll';
4
- import * as i0 from "@angular/core";
5
- export type TableItemId = string | number;
6
- type TableItemType = string | number | Date;
7
- export interface TableItemModel {
8
- id: TableItemId;
9
- [key: string]: TableItemType;
10
- }
11
- export declare class TableComponent implements AfterViewInit {
12
- private eltRef;
13
- set data(value: TableItemModel[]);
14
- activeId: TableItemId;
15
- selected: EventEmitter<any>;
16
- sort: MatSort;
17
- properties: string[];
18
- dataSource: TableVirtualScrollDataSource<any>;
19
- headerHeight: number;
20
- count: number;
21
- constructor(eltRef: ElementRef);
22
- ngAfterViewInit(): void;
23
- scrollToItem(itemId: TableItemId): void;
24
- getRowEltId(id: TableItemId): string;
25
- static ɵfac: i0.ɵɵFactoryDeclaration<TableComponent, never>;
26
- static ɵcmp: i0.ɵɵComponentDeclaration<TableComponent, "gn-ui-table", never, { "data": { "alias": "data"; "required": false; }; "activeId": { "alias": "activeId"; "required": false; }; }, { "selected": "selected"; }, never, never, true, never>;
27
- }
28
- export {};
29
- //# sourceMappingURL=table.component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table.component.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/ui/dataviz/src/lib/table/table.component.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EAGb,UAAU,EACV,YAAY,EAIb,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,OAAO,EAAiB,MAAM,wBAAwB,CAAA;AAE/D,OAAO,EACL,4BAA4B,EAE7B,MAAM,yBAAyB,CAAA;;AAKhC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,CAAA;AACzC,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;AAE3C,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,WAAW,CAAA;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAC7B;AAED,qBAea,cAAe,YAAW,aAAa;IAiBtC,OAAO,CAAC,MAAM;IAhB1B,IAAa,IAAI,CAAC,KAAK,EAAE,cAAc,EAAE,EAMxC;IACQ,QAAQ,EAAE,WAAW,CAAA;IACpB,QAAQ,oBAA0B;IAEN,IAAI,EAAE,OAAO,CAAA;IACnD,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,UAAU,EAAE,4BAA4B,CAAC,GAAG,CAAC,CAAA;IAC7C,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;gBAEO,MAAM,EAAE,UAAU;IAEtC,eAAe;IAKf,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAOhC,WAAW,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM;yCA/BhC,cAAc;2CAAd,cAAc;CAkC1B"}
@@ -1,11 +0,0 @@
1
- export declare const tableItemFixture: () => {
2
- name: string;
3
- id: string;
4
- age: number;
5
- }[];
6
- export declare const someHabTableItemFixture: () => {
7
- name: string;
8
- id: string;
9
- pop: number;
10
- }[];
11
- //# sourceMappingURL=table.fixtures.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table.fixtures.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/ui/dataviz/src/lib/table/table.fixtures.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;GAgB5B,CAAA;AAED,eAAO,MAAM,uBAAuB;;;;GAqBnC,CAAA"}
@@ -1,40 +0,0 @@
1
- <div class="border border-gray-300 rounded-lg overflow-hidden bg-white h-full">
2
- <cdk-virtual-scroll-viewport
3
- tvsItemSize="48"
4
- headerHeight="56"
5
- style="height: calc(100% - 37px)"
6
- >
7
- <table mat-table [dataSource]="dataSource" class="mat-elevation-z8" matSort>
8
- <ng-container *ngFor="let prop of properties" [matColumnDef]="prop">
9
- <th
10
- mat-header-cell
11
- *matHeaderCellDef
12
- mat-sort-header
13
- class="text-sm text-black bg-white"
14
- >
15
- {{ prop }}
16
- </th>
17
- <td
18
- mat-cell
19
- *matCellDef="let element"
20
- class="whitespace-nowrap pr-1 truncate"
21
- >
22
- {{ element[prop] }}
23
- </td>
24
- </ng-container>
25
-
26
- <tr mat-header-row *matHeaderRowDef="properties; sticky: true"></tr>
27
- <tr
28
- [id]="getRowEltId(row.id)"
29
- mat-row
30
- *matRowDef="let row; columns: properties"
31
- (click)="selected.emit(row)"
32
- [class.active]="row.id === activeId"
33
- ></tr>
34
- </table>
35
- </cdk-virtual-scroll-viewport>
36
- <div class="text-gray-900 border-t border-gray-300 px-4 py-2 text-sm">
37
- <span class="count font-extrabold text-primary">{{ count }}</span
38
- >&nbsp;<span translate>table.object.count</span>.
39
- </div>
40
- </div>
@@ -1,80 +0,0 @@
1
- import { ScrollingModule } from '@angular/cdk/scrolling'
2
- import { NgForOf } from '@angular/common'
3
- import {
4
- AfterViewInit,
5
- ChangeDetectionStrategy,
6
- Component,
7
- ElementRef,
8
- EventEmitter,
9
- Input,
10
- Output,
11
- ViewChild,
12
- } from '@angular/core'
13
- import { MatSort, MatSortModule } from '@angular/material/sort'
14
- import { MatTableModule } from '@angular/material/table'
15
- import {
16
- TableVirtualScrollDataSource,
17
- TableVirtualScrollModule,
18
- } from 'ng-table-virtual-scroll'
19
- import { TranslateModule } from '@ngx-translate/core'
20
-
21
- const rowIdPrefix = 'table-item-'
22
-
23
- export type TableItemId = string | number
24
- type TableItemType = string | number | Date
25
-
26
- export interface TableItemModel {
27
- id: TableItemId
28
- [key: string]: TableItemType
29
- }
30
-
31
- @Component({
32
- standalone: true,
33
- imports: [
34
- MatTableModule,
35
- MatSortModule,
36
- TableVirtualScrollModule,
37
- ScrollingModule,
38
- NgForOf,
39
- TranslateModule,
40
- ],
41
- selector: 'gn-ui-table',
42
- templateUrl: './table.component.html',
43
- styleUrls: ['./table.component.css'],
44
- changeDetection: ChangeDetectionStrategy.OnPush,
45
- })
46
- export class TableComponent implements AfterViewInit {
47
- @Input() set data(value: TableItemModel[]) {
48
- this.dataSource = new TableVirtualScrollDataSource(value)
49
- this.dataSource.sort = this.sort
50
- this.properties =
51
- Array.isArray(value) && value.length ? Object.keys(value[0]) : []
52
- this.count = value.length
53
- }
54
- @Input() activeId: TableItemId
55
- @Output() selected = new EventEmitter<any>()
56
-
57
- @ViewChild(MatSort, { static: true }) sort: MatSort
58
- properties: string[]
59
- dataSource: TableVirtualScrollDataSource<any>
60
- headerHeight: number
61
- count: number
62
-
63
- constructor(private eltRef: ElementRef) {}
64
-
65
- ngAfterViewInit() {
66
- this.headerHeight =
67
- this.eltRef.nativeElement.querySelector('thead').offsetHeight
68
- }
69
-
70
- scrollToItem(itemId: TableItemId): void {
71
- const row = this.eltRef.nativeElement.querySelector(
72
- `#${this.getRowEltId(itemId)}`
73
- )
74
- this.eltRef.nativeElement.scrollTop = row.offsetTop - this.headerHeight
75
- }
76
-
77
- public getRowEltId(id: TableItemId): string {
78
- return rowIdPrefix + id
79
- }
80
- }
@@ -1,40 +0,0 @@
1
- export const tableItemFixture = () => [
2
- {
3
- name: 'name 1',
4
- id: 'id 1',
5
- age: 15,
6
- },
7
- {
8
- name: 'name 2',
9
- id: 'id 2',
10
- age: 10,
11
- },
12
- {
13
- name: 'name 3',
14
- id: 'id 3',
15
- age: 55,
16
- },
17
- ]
18
-
19
- export const someHabTableItemFixture = () => [
20
- {
21
- name: 'France',
22
- id: '1',
23
- pop: 50500000,
24
- },
25
- {
26
- name: 'Italy',
27
- id: '2',
28
- pop: 155878789655,
29
- },
30
- {
31
- name: 'UK',
32
- id: '3',
33
- pop: 31522456,
34
- },
35
- {
36
- name: 'US',
37
- id: '4',
38
- pop: 3215448888,
39
- },
40
- ]