@nanahoshi/mona-ui 0.24.6 → 0.24.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 (63) hide show
  1. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +14 -4
  2. package/fesm2022/nanahoshi-mona-ui-filter.mjs +233 -231
  3. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-CD_ODHpU.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-vXXNWmEN.mjs} +24 -12
  4. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-DDgNmgE0.mjs +208 -0
  5. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-Dzf6Vbs_.mjs +1100 -0
  6. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-Sa1aAtJ-.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-DAPNqnWV.mjs} +34 -21
  7. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BvUM9nPt.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-B9rmDLq8.mjs} +2564 -927
  8. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  9. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +39 -8
  10. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +1 -1
  11. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +3 -6
  12. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +33 -8
  13. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +33 -8
  14. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +33 -8
  15. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +33 -8
  16. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +33 -8
  17. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +33 -8
  18. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +33 -8
  19. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +33 -8
  20. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +33 -8
  21. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +33 -8
  22. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +33 -8
  23. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +33 -8
  24. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +33 -8
  25. package/fesm2022/nanahoshi-mona-ui-pager.mjs +367 -463
  26. package/fesm2022/nanahoshi-mona-ui-query.mjs +317 -122
  27. package/i18n/catalogs/en-US.messages.json +36 -11
  28. package/locales/ar-sa/ar-sa.messages.json +33 -8
  29. package/locales/de-de/de-de.messages.json +33 -8
  30. package/locales/es-es/es-es.messages.json +33 -8
  31. package/locales/fr-fr/fr-fr.messages.json +33 -8
  32. package/locales/id-id/id-id.messages.json +33 -8
  33. package/locales/it-it/it-it.messages.json +33 -8
  34. package/locales/ja-jp/ja-jp.messages.json +33 -8
  35. package/locales/ko-kr/ko-kr.messages.json +33 -8
  36. package/locales/pt-br/pt-br.messages.json +33 -8
  37. package/locales/ru-ru/ru-ru.messages.json +33 -8
  38. package/locales/tr-tr/tr-tr.messages.json +33 -8
  39. package/locales/zh-cn/zh-cn.messages.json +33 -8
  40. package/locales/zh-tw/zh-tw.messages.json +33 -8
  41. package/package.json +1 -1
  42. package/types/nanahoshi-mona-ui-check-box.d.ts +11 -1
  43. package/types/nanahoshi-mona-ui-filter.d.ts +54 -32
  44. package/types/nanahoshi-mona-ui-grid.d.ts +359 -110
  45. package/types/nanahoshi-mona-ui-i18n.d.ts +47 -6
  46. package/types/nanahoshi-mona-ui-list-view.d.ts +1 -2
  47. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +31 -6
  48. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +31 -6
  49. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +31 -6
  50. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +31 -6
  51. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +31 -6
  52. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +31 -6
  53. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +31 -6
  54. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +31 -6
  55. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +31 -6
  56. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +31 -6
  57. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +31 -6
  58. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +31 -6
  59. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +31 -6
  60. package/types/nanahoshi-mona-ui-pager.d.ts +159 -76
  61. package/types/nanahoshi-mona-ui-query.d.ts +45 -14
  62. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-0jN7I1jo.mjs +0 -176
  63. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BI_iE7pl.mjs +0 -946
@@ -1,176 +0,0 @@
1
- import { CdkDropList, CdkDrag, CdkDragPreview } from '@angular/cdk/drag-drop';
2
- import { LucideGripVertical } from '@lucide/angular';
3
- import * as i0 from '@angular/core';
4
- import { inject, DestroyRef, ElementRef, viewChild, computed, input, afterNextRender, afterRenderEffect, Component } from '@angular/core';
5
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
- import { ImmutableList } from '@mirei/ts-collections';
7
- import { fromEvent } from 'rxjs';
8
- import { G as GridNavigationService, g as gridListBaseThemeVariants, a as GridService, b as gridRowDragPreviewThemeVariants, c as gridListTableThemeVariants, d as GridColgroupComponent } from './nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BvUM9nPt.mjs';
9
- import { G as GridAddRowComponent, a as GridDetailRowComponent, b as GridGroupRowComponent, c as GridRowComponent } from './nanahoshi-mona-ui-grid-grid-row.component-BI_iE7pl.mjs';
10
- import { GridFooterRowComponent } from './nanahoshi-mona-ui-grid-grid-footer-row.component-CD_ODHpU.mjs';
11
-
12
- const ROW_MOVE_DURATION = 200;
13
- const ROW_MOVE_EASING = "cubic-bezier(0.2, 0, 0, 1)";
14
- /** Data that arrives later than this after a move request is not animated, since rows may have moved for other reasons. */
15
- const ROW_MOVE_SNAPSHOT_LIFETIME = 1000;
16
- class GridListComponent {
17
- #destroyRef;
18
- #gridNavigationService;
19
- #hostElementRef;
20
- #rowMoveAnimations;
21
- #dropping;
22
- #rowPositionsBeforeMove;
23
- constructor() {
24
- this.#destroyRef = inject(DestroyRef);
25
- this.#gridNavigationService = inject(GridNavigationService);
26
- this.#hostElementRef = inject((ElementRef));
27
- this.#rowMoveAnimations = new Map();
28
- this.#dropping = false;
29
- this.#rowPositionsBeforeMove = null;
30
- this.bodyTableElementRef = viewChild.required("bodyTable", /* @ts-ignore */
31
- ...(ngDevMode ? [{ debugName: "bodyTableElementRef" }] : /* istanbul ignore next */ []));
32
- this.baseClass = gridListBaseThemeVariants({ virtual: false });
33
- this.bodyRows = computed(() => this.gridService.createBodyRows(this.data()), /* @ts-ignore */
34
- ...(ngDevMode ? [{ debugName: "bodyRows" }] : /* istanbul ignore next */ []));
35
- this.gridService = inject(GridService);
36
- this.rowDragPreviewClass = gridRowDragPreviewThemeVariants();
37
- this.tableClass = gridListTableThemeVariants();
38
- this.data = input(ImmutableList.create(), /* @ts-ignore */
39
- ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
40
- afterNextRender({
41
- read: () => {
42
- const bodyTableElement = this.bodyTableElementRef().nativeElement;
43
- const bodyScrollElement = this.#hostElementRef.nativeElement;
44
- this.gridService.bodyTableElement.set(bodyTableElement);
45
- this.gridService.bodyScrollElement.set(bodyScrollElement);
46
- this.setSubscriptions();
47
- this.#destroyRef.onDestroy(() => {
48
- if (this.gridService.bodyTableElement() === bodyTableElement) {
49
- this.gridService.bodyTableElement.set(null);
50
- }
51
- if (this.gridService.bodyScrollElement() === bodyScrollElement) {
52
- this.gridService.bodyScrollElement.set(null);
53
- }
54
- });
55
- }
56
- });
57
- // Rows moved from the keyboard slide from where they were drawn to their new place.
58
- afterRenderEffect({
59
- earlyRead: () => {
60
- this.bodyRows();
61
- return this.#measureRowMoves();
62
- },
63
- write: moves => this.#playRowMoves(moves())
64
- });
65
- }
66
- onRowDragEnded(_event) {
67
- this.gridService.draggingRowUid.set(null);
68
- }
69
- onRowDragStarted(event) {
70
- this.gridService.draggingRowUid.set(event.source.data.uid);
71
- }
72
- onRowDrop(event) {
73
- this.gridService.draggingRowUid.set(null);
74
- // The drag already showed the rows in their new order, so the move must not be animated again.
75
- this.#dropping = true;
76
- try {
77
- this.gridService.requestRowReorder(event.item.data, event.previousIndex, event.currentIndex);
78
- }
79
- finally {
80
- this.#dropping = false;
81
- }
82
- }
83
- onBodyFocus() {
84
- this.#gridNavigationService.focusActiveCellOrFirstHeader();
85
- }
86
- #canAnimateRowMoves() {
87
- const view = this.#hostElementRef.nativeElement.ownerDocument.defaultView;
88
- if (view == null || typeof this.#hostElementRef.nativeElement.animate !== "function") {
89
- return false;
90
- }
91
- return !view.matchMedia("(prefers-reduced-motion: reduce)").matches;
92
- }
93
- #measureRowMoves() {
94
- const snapshot = this.#rowPositionsBeforeMove;
95
- this.#rowPositionsBeforeMove = null;
96
- if (snapshot == null || performance.now() - snapshot.time > ROW_MOVE_SNAPSHOT_LIFETIME) {
97
- return [];
98
- }
99
- // Rows still sliding from an earlier move are measured where they finally belong.
100
- for (const animation of this.#rowMoveAnimations.values()) {
101
- animation.cancel();
102
- }
103
- this.#rowMoveAnimations.clear();
104
- const moves = [];
105
- for (const [uid, position] of this.#readRowPositions()) {
106
- const previousTop = snapshot.positions.get(uid);
107
- if (previousTop != null && Math.abs(previousTop - position.top) >= 0.5) {
108
- moves.push({ element: position.element, offset: previousTop - position.top });
109
- }
110
- }
111
- return moves;
112
- }
113
- #playRowMoves(moves) {
114
- for (const { element, offset } of moves) {
115
- const animation = element.animate([{ transform: `translateY(${offset}px)` }, { transform: "translateY(0)" }], { duration: ROW_MOVE_DURATION, easing: ROW_MOVE_EASING });
116
- this.#rowMoveAnimations.set(element, animation);
117
- animation.addEventListener("finish", () => {
118
- if (this.#rowMoveAnimations.get(element) === animation) {
119
- this.#rowMoveAnimations.delete(element);
120
- }
121
- });
122
- }
123
- }
124
- /** Reads where each data row is drawn, relative to the top of the body table. */
125
- #readRowPositions() {
126
- const table = this.bodyTableElementRef().nativeElement;
127
- const tableTop = table.getBoundingClientRect().top;
128
- const positions = new Map();
129
- for (const element of table.querySelectorAll(":scope > tbody > tr[data-ruid]")) {
130
- const uid = element.dataset["ruid"];
131
- if (uid != null) {
132
- positions.set(uid, { element, top: element.getBoundingClientRect().top - tableTop });
133
- }
134
- }
135
- return positions;
136
- }
137
- setSubscriptions() {
138
- fromEvent(this.#hostElementRef.nativeElement, "focus")
139
- .pipe(takeUntilDestroyed(this.#destroyRef))
140
- .subscribe(() => {
141
- this.#gridNavigationService.focusActiveCellOrFirstHeader();
142
- });
143
- this.gridService.rowReorder$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
144
- if (this.#dropping || !this.#canAnimateRowMoves()) {
145
- return;
146
- }
147
- const positions = new Map();
148
- for (const [uid, position] of this.#readRowPositions()) {
149
- positions.set(uid, position.top);
150
- }
151
- this.#rowPositionsBeforeMove = { positions, time: performance.now() };
152
- });
153
- }
154
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
155
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridListComponent, isStandalone: true, selector: "mona-grid-list", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "baseClass" } }, viewQueries: [{ propertyName: "bodyTableElementRef", first: true, predicate: ["bodyTable"], descendants: true, isSignal: true }], ngImport: i0, template: "<table role=\"presentation\" #bodyTable [class]=\"tableClass\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tbody\n role=\"rowgroup\"\n tabindex=\"0\"\n (focus)=\"onBodyFocus()\"\n cdkDropList\n [cdkDropListData]=\"data().toArray()\"\n [cdkDropListDisabled]=\"!gridService.rowReorderInteractionEnabled()\"\n (cdkDropListDropped)=\"onRowDrop($event)\">\n @if (gridService.addRowVisible()) {\n <tr monaGridAddRow></tr>\n }\n @for (bodyRow of bodyRows(); track bodyRow.key; let rowIndex = $index) {\n @if (bodyRow.type === \"group\") {\n <tr monaGridGroupRow [group]=\"bodyRow\" [rowIndex]=\"rowIndex\"></tr>\n } @else if (bodyRow.type === \"groupFooter\") {\n <tr monaGridFooterRow [groupKey]=\"bodyRow.groupAggregate.groupKey\"></tr>\n } @else {\n <tr\n monaGridRow\n [row]=\"bodyRow.row\"\n [index]=\"rowIndex\"\n cdkDrag\n cdkDragLockAxis=\"y\"\n [cdkDragData]=\"bodyRow.row\"\n [cdkDragDisabled]=\"!gridService.canReorderRow(bodyRow.row)\"\n (cdkDragStarted)=\"onRowDragStarted($event)\"\n (cdkDragEnded)=\"onRowDragEnded($event)\">\n <ng-template cdkDragPreview>\n <div [class]=\"rowDragPreviewClass\">\n <svg lucideGripVertical [size]=\"16\" aria-hidden=\"true\"></svg>\n <span>{{\n gridService.getRowReorderAriaLabel(\n bodyRow.row,\n rowIndex + gridService.paginationState().skip\n )\n }}</span>\n </div>\n </ng-template>\n </tr>\n @if (gridService.isRowExpanded(bodyRow.row) && !gridService.rowDragInProgress()) {\n <tr monaGridDetailRow [row]=\"bodyRow.row\"></tr>\n }\n }\n }\n </tbody>\n</table>\n", dependencies: [{ kind: "component", type: LucideGripVertical, selector: "svg[lucideGripVertical]" }, { kind: "component", type: GridAddRowComponent, selector: "tr[monaGridAddRow]" }, { kind: "component", type: GridColgroupComponent, selector: "colgroup[monaGridColgroup]" }, { kind: "component", type: GridDetailRowComponent, selector: "tr[monaGridDetailRow]", inputs: ["row"] }, { kind: "component", type: GridFooterRowComponent, selector: "tr[monaGridFooterRow]", inputs: ["groupKey"] }, { kind: "component", type: GridGroupRowComponent, selector: "tr[monaGridGroupRow]", inputs: ["group", "rowIndex"] }, { kind: "component", type: GridRowComponent, selector: "tr[monaGridRow]", inputs: ["index", "row"], exportAs: ["monaGridRow"] }, { kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CdkDragPreview, selector: "ng-template[cdkDragPreview]", inputs: ["data", "matchSize"] }] }); }
156
- }
157
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridListComponent, decorators: [{
158
- type: Component,
159
- args: [{ selector: "mona-grid-list", imports: [
160
- LucideGripVertical,
161
- GridAddRowComponent,
162
- GridColgroupComponent,
163
- GridDetailRowComponent,
164
- GridFooterRowComponent,
165
- GridGroupRowComponent,
166
- GridRowComponent,
167
- CdkDropList,
168
- CdkDrag,
169
- CdkDragPreview
170
- ], host: {
171
- "[class]": "baseClass"
172
- }, template: "<table role=\"presentation\" #bodyTable [class]=\"tableClass\" [style.width.px]=\"gridService.tableWidth()\">\n <colgroup monaGridColgroup></colgroup>\n <tbody\n role=\"rowgroup\"\n tabindex=\"0\"\n (focus)=\"onBodyFocus()\"\n cdkDropList\n [cdkDropListData]=\"data().toArray()\"\n [cdkDropListDisabled]=\"!gridService.rowReorderInteractionEnabled()\"\n (cdkDropListDropped)=\"onRowDrop($event)\">\n @if (gridService.addRowVisible()) {\n <tr monaGridAddRow></tr>\n }\n @for (bodyRow of bodyRows(); track bodyRow.key; let rowIndex = $index) {\n @if (bodyRow.type === \"group\") {\n <tr monaGridGroupRow [group]=\"bodyRow\" [rowIndex]=\"rowIndex\"></tr>\n } @else if (bodyRow.type === \"groupFooter\") {\n <tr monaGridFooterRow [groupKey]=\"bodyRow.groupAggregate.groupKey\"></tr>\n } @else {\n <tr\n monaGridRow\n [row]=\"bodyRow.row\"\n [index]=\"rowIndex\"\n cdkDrag\n cdkDragLockAxis=\"y\"\n [cdkDragData]=\"bodyRow.row\"\n [cdkDragDisabled]=\"!gridService.canReorderRow(bodyRow.row)\"\n (cdkDragStarted)=\"onRowDragStarted($event)\"\n (cdkDragEnded)=\"onRowDragEnded($event)\">\n <ng-template cdkDragPreview>\n <div [class]=\"rowDragPreviewClass\">\n <svg lucideGripVertical [size]=\"16\" aria-hidden=\"true\"></svg>\n <span>{{\n gridService.getRowReorderAriaLabel(\n bodyRow.row,\n rowIndex + gridService.paginationState().skip\n )\n }}</span>\n </div>\n </ng-template>\n </tr>\n @if (gridService.isRowExpanded(bodyRow.row) && !gridService.rowDragInProgress()) {\n <tr monaGridDetailRow [row]=\"bodyRow.row\"></tr>\n }\n }\n }\n </tbody>\n</table>\n" }]
173
- }], ctorParameters: () => [], propDecorators: { bodyTableElementRef: [{ type: i0.ViewChild, args: ["bodyTable", { isSignal: true }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
174
-
175
- export { GridListComponent };
176
- //# sourceMappingURL=nanahoshi-mona-ui-grid-grid-list.component-0jN7I1jo.mjs.map