@nanahoshi/mona-ui 0.39.1 → 0.41.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.
Files changed (76) hide show
  1. package/docs/api/common.md +1 -1
  2. package/docs/api/grid.md +214 -17
  3. package/docs/api/i18n.md +36 -0
  4. package/docs/api/kanban.md +222 -0
  5. package/docs/api/locales.md +14 -14
  6. package/docs/api/sortable.md +189 -0
  7. package/docs/api/tabs.md +20 -0
  8. package/docs/grid-selection.md +134 -9
  9. package/docs/grid-state-export.md +56 -6
  10. package/docs/grid-tree.md +279 -0
  11. package/docs/kanban.md +293 -0
  12. package/docs/sortable.md +320 -0
  13. package/docs/tabs.md +59 -10
  14. package/fesm2022/{nanahoshi-mona-ui-grid-grid-colgroup.component-Lv3GunpV.mjs → nanahoshi-mona-ui-grid-grid-colgroup.component-DpszxgFY.mjs} +2 -2
  15. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-BYH9XbCV.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-CpvzAcX8.mjs} +4 -3
  16. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BoSXXLKQ.mjs → nanahoshi-mona-ui-grid-grid-list.component-tRmEWiQR.mjs} +5 -5
  17. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-Df2gfS0X.mjs → nanahoshi-mona-ui-grid-grid-row.component-eET6dh2Q.mjs} +52 -35
  18. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-xjrcCXXF.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-8h2EMexB.mjs} +5 -5
  19. package/fesm2022/{nanahoshi-mona-ui-grid-grid.styles-aPD3c2A6.mjs → nanahoshi-mona-ui-grid-grid.styles-wAf6jsT9.mjs} +646 -20
  20. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1663 -22
  21. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +56 -0
  22. package/fesm2022/nanahoshi-mona-ui-kanban.mjs +660 -0
  23. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +11 -0
  24. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +17 -0
  25. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +17 -0
  26. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +17 -0
  27. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +11 -0
  28. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +17 -0
  29. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +11 -0
  30. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +11 -0
  31. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +21 -0
  32. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +17 -0
  33. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +21 -0
  34. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +11 -0
  35. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +11 -0
  36. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +11 -0
  37. package/fesm2022/nanahoshi-mona-ui-sortable.mjs +733 -0
  38. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +112 -5
  39. package/i18n/catalogs/en-US.messages.json +11 -0
  40. package/kanban/package.json +4 -0
  41. package/llms.txt +10 -5
  42. package/locales/ar-sa/ar-sa.messages.json +11 -0
  43. package/locales/de-de/de-de.messages.json +11 -0
  44. package/locales/es-es/es-es.messages.json +11 -0
  45. package/locales/fr-fr/fr-fr.messages.json +11 -0
  46. package/locales/id-id/id-id.messages.json +11 -0
  47. package/locales/it-it/it-it.messages.json +11 -0
  48. package/locales/ja-jp/ja-jp.messages.json +11 -0
  49. package/locales/ko-kr/ko-kr.messages.json +11 -0
  50. package/locales/pl-pl/pl-pl.messages.json +11 -0
  51. package/locales/pt-br/pt-br.messages.json +11 -0
  52. package/locales/ru-ru/ru-ru.messages.json +11 -0
  53. package/locales/tr-tr/tr-tr.messages.json +11 -0
  54. package/locales/zh-cn/zh-cn.messages.json +11 -0
  55. package/locales/zh-tw/zh-tw.messages.json +11 -0
  56. package/package.json +9 -1
  57. package/sortable/package.json +4 -0
  58. package/types/nanahoshi-mona-ui-grid.d.ts +305 -3
  59. package/types/nanahoshi-mona-ui-i18n.d.ts +23 -0
  60. package/types/nanahoshi-mona-ui-kanban.d.ts +270 -0
  61. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +11 -0
  62. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +11 -0
  63. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +11 -0
  64. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +11 -0
  65. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +11 -0
  66. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +11 -0
  67. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +11 -0
  68. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +11 -0
  69. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +11 -0
  70. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +11 -0
  71. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +11 -0
  72. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +11 -0
  73. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +11 -0
  74. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +11 -0
  75. package/types/nanahoshi-mona-ui-sortable.d.ts +245 -0
  76. package/types/nanahoshi-mona-ui-tabs.d.ts +46 -0
@@ -0,0 +1,660 @@
1
+ import * as i1 from "@angular/cdk/scrolling";
2
+ import { CdkScrollable } from "@angular/cdk/scrolling";
3
+ import { NgTemplateOutlet } from "@angular/common";
4
+ import * as i0 from "@angular/core";
5
+ import { Component, Directive, ElementRef, TemplateRef, booleanAttribute, computed, contentChild, inject, input, output, signal } from "@angular/core";
6
+ import { MonaI18nService, formatNumber, injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
7
+ import { createElementControlId } from "@nanahoshi/mona-ui/internal";
8
+ import * as i2 from "@nanahoshi/mona-ui/sortable";
9
+ import { SortableDirective, SortableGroupDirective, SortableItemDirective } from "@nanahoshi/mona-ui/sortable";
10
+ import { twMerge } from "tailwind-merge";
11
+ import { PreventableEvent } from "@nanahoshi/mona-ui/common";
12
+ import { cva } from "class-variance-authority";
13
+ var KanbanCardTemplateDirective = class KanbanCardTemplateDirective {
14
+ constructor() {
15
+ this.monaKanbanCardTemplateOf = input(null, ...ngDevMode ? [{ debugName: "monaKanbanCardTemplateOf" }] : /* istanbul ignore next */ []);
16
+ }
17
+ static ngTemplateContextGuard(_directive, _context) {
18
+ return true;
19
+ }
20
+ static {
21
+ this.ɵfac = i0.ɵɵngDeclareFactory({
22
+ minVersion: "12.0.0",
23
+ version: "22.2.6",
24
+ ngImport: i0,
25
+ type: KanbanCardTemplateDirective,
26
+ deps: [],
27
+ target: i0.ɵɵFactoryTarget.Directive
28
+ });
29
+ }
30
+ static {
31
+ this.ɵdir = i0.ɵɵngDeclareDirective({
32
+ minVersion: "17.1.0",
33
+ version: "22.2.6",
34
+ type: KanbanCardTemplateDirective,
35
+ isStandalone: true,
36
+ selector: "ng-template[monaKanbanCardTemplate]",
37
+ inputs: { monaKanbanCardTemplateOf: {
38
+ classPropertyName: "monaKanbanCardTemplateOf",
39
+ publicName: "monaKanbanCardTemplateOf",
40
+ isSignal: true,
41
+ isRequired: false,
42
+ transformFunction: null
43
+ } },
44
+ ngImport: i0
45
+ });
46
+ }
47
+ };
48
+ i0.ɵɵngDeclareClassMetadata({
49
+ minVersion: "12.0.0",
50
+ version: "22.2.6",
51
+ ngImport: i0,
52
+ type: KanbanCardTemplateDirective,
53
+ decorators: [{
54
+ type: Directive,
55
+ args: [{ selector: "ng-template[monaKanbanCardTemplate]" }]
56
+ }],
57
+ propDecorators: { monaKanbanCardTemplateOf: [{
58
+ type: i0.Input,
59
+ args: [{
60
+ isSignal: true,
61
+ alias: "monaKanbanCardTemplateOf",
62
+ required: false
63
+ }]
64
+ }] }
65
+ });
66
+ var KanbanColumnFooterTemplateDirective = class KanbanColumnFooterTemplateDirective {
67
+ constructor() {
68
+ this.monaKanbanColumnFooterTemplateOf = input(null, ...ngDevMode ? [{ debugName: "monaKanbanColumnFooterTemplateOf" }] : /* istanbul ignore next */ []);
69
+ }
70
+ static ngTemplateContextGuard(_directive, _context) {
71
+ return true;
72
+ }
73
+ static {
74
+ this.ɵfac = i0.ɵɵngDeclareFactory({
75
+ minVersion: "12.0.0",
76
+ version: "22.2.6",
77
+ ngImport: i0,
78
+ type: KanbanColumnFooterTemplateDirective,
79
+ deps: [],
80
+ target: i0.ɵɵFactoryTarget.Directive
81
+ });
82
+ }
83
+ static {
84
+ this.ɵdir = i0.ɵɵngDeclareDirective({
85
+ minVersion: "17.1.0",
86
+ version: "22.2.6",
87
+ type: KanbanColumnFooterTemplateDirective,
88
+ isStandalone: true,
89
+ selector: "ng-template[monaKanbanColumnFooterTemplate]",
90
+ inputs: { monaKanbanColumnFooterTemplateOf: {
91
+ classPropertyName: "monaKanbanColumnFooterTemplateOf",
92
+ publicName: "monaKanbanColumnFooterTemplateOf",
93
+ isSignal: true,
94
+ isRequired: false,
95
+ transformFunction: null
96
+ } },
97
+ ngImport: i0
98
+ });
99
+ }
100
+ };
101
+ i0.ɵɵngDeclareClassMetadata({
102
+ minVersion: "12.0.0",
103
+ version: "22.2.6",
104
+ ngImport: i0,
105
+ type: KanbanColumnFooterTemplateDirective,
106
+ decorators: [{
107
+ type: Directive,
108
+ args: [{ selector: "ng-template[monaKanbanColumnFooterTemplate]" }]
109
+ }],
110
+ propDecorators: { monaKanbanColumnFooterTemplateOf: [{
111
+ type: i0.Input,
112
+ args: [{
113
+ isSignal: true,
114
+ alias: "monaKanbanColumnFooterTemplateOf",
115
+ required: false
116
+ }]
117
+ }] }
118
+ });
119
+ var KanbanColumnHeaderTemplateDirective = class KanbanColumnHeaderTemplateDirective {
120
+ constructor() {
121
+ this.monaKanbanColumnHeaderTemplateOf = input(null, ...ngDevMode ? [{ debugName: "monaKanbanColumnHeaderTemplateOf" }] : /* istanbul ignore next */ []);
122
+ }
123
+ static ngTemplateContextGuard(_directive, _context) {
124
+ return true;
125
+ }
126
+ static {
127
+ this.ɵfac = i0.ɵɵngDeclareFactory({
128
+ minVersion: "12.0.0",
129
+ version: "22.2.6",
130
+ ngImport: i0,
131
+ type: KanbanColumnHeaderTemplateDirective,
132
+ deps: [],
133
+ target: i0.ɵɵFactoryTarget.Directive
134
+ });
135
+ }
136
+ static {
137
+ this.ɵdir = i0.ɵɵngDeclareDirective({
138
+ minVersion: "17.1.0",
139
+ version: "22.2.6",
140
+ type: KanbanColumnHeaderTemplateDirective,
141
+ isStandalone: true,
142
+ selector: "ng-template[monaKanbanColumnHeaderTemplate]",
143
+ inputs: { monaKanbanColumnHeaderTemplateOf: {
144
+ classPropertyName: "monaKanbanColumnHeaderTemplateOf",
145
+ publicName: "monaKanbanColumnHeaderTemplateOf",
146
+ isSignal: true,
147
+ isRequired: false,
148
+ transformFunction: null
149
+ } },
150
+ ngImport: i0
151
+ });
152
+ }
153
+ };
154
+ i0.ɵɵngDeclareClassMetadata({
155
+ minVersion: "12.0.0",
156
+ version: "22.2.6",
157
+ ngImport: i0,
158
+ type: KanbanColumnHeaderTemplateDirective,
159
+ decorators: [{
160
+ type: Directive,
161
+ args: [{ selector: "ng-template[monaKanbanColumnHeaderTemplate]" }]
162
+ }],
163
+ propDecorators: { monaKanbanColumnHeaderTemplateOf: [{
164
+ type: i0.Input,
165
+ args: [{
166
+ isSignal: true,
167
+ alias: "monaKanbanColumnHeaderTemplateOf",
168
+ required: false
169
+ }]
170
+ }] }
171
+ });
172
+ function localizeNumber(value, options) {
173
+ return formatNumber(value, "en-US", options);
174
+ }
175
+ const KANBAN_DEFAULT_MESSAGES = {
176
+ cardCount: (count) => count === 1 ? `${localizeNumber(count)} card` : `${localizeNumber(count)} cards`,
177
+ cardCountWithLimit: (count, limit) => `${localizeNumber(count)} of ${limit === 1 ? `${localizeNumber(limit)} card` : `${localizeNumber(limit)} cards`}`,
178
+ emptyColumn: "No cards"
179
+ };
180
+ var KanbanCardMoveEvent = class extends PreventableEvent {
181
+ #options;
182
+ constructor(options, originalEvent) {
183
+ super("cardMove", originalEvent);
184
+ this.#options = options;
185
+ }
186
+ get card() {
187
+ return this.#options.card;
188
+ }
189
+ get currentIndex() {
190
+ return this.#options.currentIndex;
191
+ }
192
+ get data() {
193
+ return this.#options.data;
194
+ }
195
+ get movedCard() {
196
+ return this.#options.movedCard;
197
+ }
198
+ get previousIndex() {
199
+ return this.#options.previousIndex;
200
+ }
201
+ get previousStatus() {
202
+ return this.#options.previousStatus;
203
+ }
204
+ get status() {
205
+ return this.#options.status;
206
+ }
207
+ };
208
+ const kanbanBaseThemeVariants = cva("flex max-w-full min-w-0 gap-4 overflow-x-auto p-1");
209
+ const kanbanColumnThemeVariants = cva("flex max-h-full w-72 shrink-0 flex-col rounded-lg bg-surface-muted");
210
+ const kanbanColumnHeaderThemeVariants = cva("flex min-h-11 items-center gap-2 px-3 pt-3 pb-1");
211
+ const kanbanColumnTitleThemeVariants = cva("min-w-0 flex-1 truncate text-sm font-semibold text-foreground");
212
+ const kanbanColumnCountThemeVariants = cva("shrink-0 rounded-full px-2 py-0.5 text-xs font-medium tabular-nums forced-color-adjust-none", {
213
+ variants: { full: {
214
+ true: "bg-warning-subtle text-warning-subtle-foreground forced-colors:bg-[Highlight] forced-colors:text-[HighlightText]",
215
+ false: "bg-background text-muted-foreground forced-colors:bg-[Canvas] forced-colors:text-[CanvasText]"
216
+ } },
217
+ defaultVariants: { full: false }
218
+ });
219
+ const kanbanColumnBodyThemeVariants = cva("relative flex min-h-0 flex-1 flex-col");
220
+ const kanbanColumnListThemeVariants = cva("flex min-h-20 flex-1 flex-col gap-2 overflow-y-auto p-2");
221
+ const kanbanColumnEmptyThemeVariants = cva(`
222
+ pointer-events-none absolute inset-x-2 top-2 flex h-16 items-center justify-center
223
+ rounded-md border border-dashed border-border text-sm text-muted-foreground
224
+ [.cdk-drop-list-dragging+&]:hidden
225
+ `);
226
+ const kanbanColumnFooterThemeVariants = cva("px-2 pb-2");
227
+ const kanbanCardThemeVariants = cva(`
228
+ cursor-grab rounded-md border border-border bg-card p-3 text-sm text-card-foreground
229
+ shadow-(--shadow-raised) select-none
230
+ focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-indicator
231
+ [&.cdk-drag-preview]:cursor-grabbing
232
+ `);
233
+ function readField(card, field) {
234
+ return card[field];
235
+ }
236
+ var KanbanComponent = class KanbanComponent {
237
+ constructor() {
238
+ this.#direction = injectComponentDirection();
239
+ this.#focused = signal(null, ...ngDevMode ? [{ debugName: "#focused" }] : /* istanbul ignore next */ []);
240
+ this.#hostElement = inject(ElementRef).nativeElement;
241
+ this.activeCard = computed(() => {
242
+ const columns = this.columnCards();
243
+ const focused = this.#focused();
244
+ if (focused != null && columns[focused.column]?.[focused.index] !== void 0) return focused;
245
+ const column = columns.findIndex((cards) => cards.length > 0);
246
+ return column < 0 ? null : {
247
+ column,
248
+ index: 0
249
+ };
250
+ }, ...ngDevMode ? [{ debugName: "activeCard" }] : /* istanbul ignore next */ []);
251
+ this.baseClass = computed(() => twMerge(kanbanBaseThemeVariants(), this.userClass()), ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
252
+ this.bodyClass = kanbanColumnBodyThemeVariants();
253
+ this.cardClass = kanbanCardThemeVariants();
254
+ this.cardTemplate = contentChild(KanbanCardTemplateDirective, {
255
+ ...ngDevMode ? { debugName: "cardTemplate" } : /* istanbul ignore next */ {},
256
+ read: TemplateRef
257
+ });
258
+ this.columnCards = computed(() => {
259
+ const field = this.statusField();
260
+ const data = this.data();
261
+ return this.columns().map((column) => data.filter((card) => readField(card, field) === column.status));
262
+ }, ...ngDevMode ? [{ debugName: "columnCards" }] : /* istanbul ignore next */ []);
263
+ this.columnClass = kanbanColumnThemeVariants();
264
+ this.columnFooterTemplate = contentChild(KanbanColumnFooterTemplateDirective, {
265
+ ...ngDevMode ? { debugName: "columnFooterTemplate" } : /* istanbul ignore next */ {},
266
+ read: TemplateRef
267
+ });
268
+ this.columnHeaderTemplate = contentChild(KanbanColumnHeaderTemplateDirective, {
269
+ ...ngDevMode ? { debugName: "columnHeaderTemplate" } : /* istanbul ignore next */ {},
270
+ read: TemplateRef
271
+ });
272
+ this.emptyClass = kanbanColumnEmptyThemeVariants();
273
+ this.enterChecks = computed(() => this.columns().map((column, index) => () => {
274
+ const limit = column.limit;
275
+ return limit == null || this.columnCards()[index].length < limit;
276
+ }), ...ngDevMode ? [{ debugName: "enterChecks" }] : /* istanbul ignore next */ []);
277
+ this.footerClass = kanbanColumnFooterThemeVariants();
278
+ this.headerClass = kanbanColumnHeaderThemeVariants();
279
+ this.id = createElementControlId();
280
+ this.listClass = kanbanColumnListThemeVariants();
281
+ this.messages = inject(MonaI18nService).componentMessages("kanban", KANBAN_DEFAULT_MESSAGES);
282
+ this.titleClass = kanbanColumnTitleThemeVariants();
283
+ this.cardMove = output();
284
+ this.columns = input.required(...ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []);
285
+ this.data = input.required(...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
286
+ this.dataChange = output();
287
+ this.disabled = input(false, {
288
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
289
+ transform: booleanAttribute
290
+ });
291
+ this.statusField = input("status", ...ngDevMode ? [{ debugName: "statusField" }] : /* istanbul ignore next */ []);
292
+ this.textField = input("title", ...ngDevMode ? [{ debugName: "textField" }] : /* istanbul ignore next */ []);
293
+ this.userClass = input("", {
294
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
295
+ alias: "class"
296
+ });
297
+ }
298
+ #direction;
299
+ #focused;
300
+ #hostElement;
301
+ cardContext(card, column, index) {
302
+ return {
303
+ $implicit: card,
304
+ column,
305
+ index
306
+ };
307
+ }
308
+ cardText(card) {
309
+ const text = readField(card, this.textField());
310
+ return text == null ? "" : String(text);
311
+ }
312
+ columnContext(column, cards) {
313
+ return {
314
+ $implicit: column,
315
+ cards,
316
+ count: cards.length
317
+ };
318
+ }
319
+ countBadge(count, column) {
320
+ return column.limit == null ? String(count) : `${count} / ${column.limit}`;
321
+ }
322
+ countClass(count, column) {
323
+ return kanbanColumnCountThemeVariants({ full: column.limit != null && count >= column.limit });
324
+ }
325
+ countText(count, column) {
326
+ const messages = this.messages();
327
+ return column.limit == null ? messages.cardCount(count) : messages.cardCountWithLimit(count, column.limit);
328
+ }
329
+ onCardFocus(column, index) {
330
+ this.#focused.set({
331
+ column,
332
+ index
333
+ });
334
+ }
335
+ onCardKeydown(event, column, index) {
336
+ if (event.target !== event.currentTarget || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
337
+ const columns = this.columnCards();
338
+ const last = columns[column].length - 1;
339
+ let target;
340
+ switch (event.key) {
341
+ case "ArrowUp":
342
+ target = {
343
+ column,
344
+ index: Math.max(index - 1, 0)
345
+ };
346
+ break;
347
+ case "ArrowDown":
348
+ target = {
349
+ column,
350
+ index: Math.min(index + 1, last)
351
+ };
352
+ break;
353
+ case "Home":
354
+ target = {
355
+ column,
356
+ index: 0
357
+ };
358
+ break;
359
+ case "End":
360
+ target = {
361
+ column,
362
+ index: last
363
+ };
364
+ break;
365
+ case "ArrowLeft":
366
+ case "ArrowRight": {
367
+ const forward = event.key === "ArrowRight" !== (this.#direction() === "rtl");
368
+ target = this.findAdjacentColumn(columns, column, index, forward ? 1 : -1);
369
+ break;
370
+ }
371
+ default: return;
372
+ }
373
+ event.preventDefault();
374
+ if (target != null) this.focusCard(target);
375
+ }
376
+ onCardMove(event, columnIndex) {
377
+ const column = this.columns()[columnIndex];
378
+ const field = this.statusField();
379
+ const card = event.item;
380
+ const previousStatus = readField(card, field);
381
+ const movedCard = previousStatus === column.status ? card : {
382
+ ...card,
383
+ [field]: column.status
384
+ };
385
+ const data = this.data().filter((candidate) => candidate !== card);
386
+ const columnCards = data.filter((candidate) => readField(candidate, field) === column.status);
387
+ const next = columnCards[event.currentIndex];
388
+ if (next !== void 0) data.splice(data.indexOf(next), 0, movedCard);
389
+ else if (columnCards.length > 0) data.splice(data.indexOf(columnCards[columnCards.length - 1]) + 1, 0, movedCard);
390
+ else data.push(movedCard);
391
+ const moveEvent = new KanbanCardMoveEvent({
392
+ card,
393
+ currentIndex: event.currentIndex,
394
+ data,
395
+ movedCard,
396
+ previousIndex: event.previousIndex,
397
+ previousStatus,
398
+ status: column.status
399
+ }, event.originalEvent);
400
+ this.cardMove.emit(moveEvent);
401
+ if (moveEvent.isDefaultPrevented()) {
402
+ event.preventDefault();
403
+ return;
404
+ }
405
+ this.dataChange.emit(data);
406
+ }
407
+ findAdjacentColumn(columns, from, index, step) {
408
+ for (let column = from + step; column >= 0 && column < columns.length; column += step) if (columns[column].length > 0) return {
409
+ column,
410
+ index: Math.min(index, columns[column].length - 1)
411
+ };
412
+ return null;
413
+ }
414
+ focusCard(position) {
415
+ this.#hostElement.querySelector(`[data-kanban-card="${position.column}-${position.index}"]`)?.focus();
416
+ }
417
+ static {
418
+ this.ɵfac = i0.ɵɵngDeclareFactory({
419
+ minVersion: "12.0.0",
420
+ version: "22.2.6",
421
+ ngImport: i0,
422
+ type: KanbanComponent,
423
+ deps: [],
424
+ target: i0.ɵɵFactoryTarget.Component
425
+ });
426
+ }
427
+ static {
428
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
429
+ minVersion: "17.0.0",
430
+ version: "22.2.6",
431
+ type: KanbanComponent,
432
+ isStandalone: true,
433
+ selector: "mona-kanban",
434
+ inputs: {
435
+ columns: {
436
+ classPropertyName: "columns",
437
+ publicName: "columns",
438
+ isSignal: true,
439
+ isRequired: true,
440
+ transformFunction: null
441
+ },
442
+ data: {
443
+ classPropertyName: "data",
444
+ publicName: "data",
445
+ isSignal: true,
446
+ isRequired: true,
447
+ transformFunction: null
448
+ },
449
+ disabled: {
450
+ classPropertyName: "disabled",
451
+ publicName: "disabled",
452
+ isSignal: true,
453
+ isRequired: false,
454
+ transformFunction: null
455
+ },
456
+ statusField: {
457
+ classPropertyName: "statusField",
458
+ publicName: "statusField",
459
+ isSignal: true,
460
+ isRequired: false,
461
+ transformFunction: null
462
+ },
463
+ textField: {
464
+ classPropertyName: "textField",
465
+ publicName: "textField",
466
+ isSignal: true,
467
+ isRequired: false,
468
+ transformFunction: null
469
+ },
470
+ userClass: {
471
+ classPropertyName: "userClass",
472
+ publicName: "class",
473
+ isSignal: true,
474
+ isRequired: false,
475
+ transformFunction: null
476
+ }
477
+ },
478
+ outputs: {
479
+ cardMove: "cardMove",
480
+ dataChange: "dataChange"
481
+ },
482
+ host: {
483
+ attributes: { "role": "group" },
484
+ properties: { "class": "baseClass()" }
485
+ },
486
+ queries: [
487
+ {
488
+ propertyName: "cardTemplate",
489
+ first: true,
490
+ predicate: KanbanCardTemplateDirective,
491
+ descendants: true,
492
+ read: TemplateRef,
493
+ isSignal: true
494
+ },
495
+ {
496
+ propertyName: "columnFooterTemplate",
497
+ first: true,
498
+ predicate: KanbanColumnFooterTemplateDirective,
499
+ descendants: true,
500
+ read: TemplateRef,
501
+ isSignal: true
502
+ },
503
+ {
504
+ propertyName: "columnHeaderTemplate",
505
+ first: true,
506
+ predicate: KanbanColumnHeaderTemplateDirective,
507
+ descendants: true,
508
+ read: TemplateRef,
509
+ isSignal: true
510
+ }
511
+ ],
512
+ hostDirectives: [{ directive: i1.CdkScrollable }, { directive: i2.SortableGroupDirective }],
513
+ ngImport: i0,
514
+ template: "@let active = activeCard();\n@for (column of columns(); track $index; let columnIndex = $index) {\n @let cards = columnCards()[columnIndex];\n @let headerId = id + \"-column-\" + columnIndex;\n <!-- Named by the title and the count, so the name has a space between them. -->\n @let labelledBy = columnHeaderTemplate() ? headerId : headerId + \"-title \" + headerId + \"-count\";\n <div role=\"group\" [class]=\"columnClass\" [attr.aria-labelledby]=\"labelledBy\">\n <div [id]=\"headerId\" [class]=\"headerClass\">\n @if (columnHeaderTemplate(); as headerTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"headerTemplate\"\n [ngTemplateOutletContext]=\"columnContext(column, cards)\" />\n } @else {\n <span [id]=\"headerId + '-title'\" [class]=\"titleClass\">{{ column.title }}</span>\n <span aria-hidden=\"true\" [class]=\"countClass(cards.length, column)\">{{\n countBadge(cards.length, column)\n }}</span>\n <span class=\"sr-only\" [id]=\"headerId + '-count'\">{{ countText(cards.length, column) }}</span>\n }\n </div>\n <div [class]=\"bodyClass\">\n <ul\n [class]=\"listClass\"\n [attr.aria-labelledby]=\"labelledBy\"\n [monaSortable]=\"cards\"\n [sortableCanEnter]=\"enterChecks()[columnIndex]\"\n [sortableDisabled]=\"disabled()\"\n [sortableLabel]=\"column.title\"\n (sortableMove)=\"onCardMove($event, columnIndex)\">\n @for (card of cards; track card; let index = $index) {\n <li\n [class]=\"cardClass\"\n [monaSortableItem]=\"card\"\n [sortableLabel]=\"cardText(card)\"\n [tabindex]=\"active?.column === columnIndex && active?.index === index ? 0 : -1\"\n [attr.data-kanban-card]=\"columnIndex + '-' + index\"\n (focus)=\"onCardFocus(columnIndex, index)\"\n (keydown)=\"onCardKeydown($event, columnIndex, index)\">\n @if (cardTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"cardContext(card, column, index)\" />\n } @else {\n {{ cardText(card) }}\n }\n </li>\n }\n </ul>\n @if (cards.length === 0) {\n <p aria-hidden=\"true\" [class]=\"emptyClass\">{{ messages().emptyColumn }}</p>\n }\n </div>\n @if (columnFooterTemplate(); as footerTemplate) {\n <div [class]=\"footerClass\">\n <ng-container\n [ngTemplateOutlet]=\"footerTemplate\"\n [ngTemplateOutletContext]=\"columnContext(column, cards)\" />\n </div>\n }\n </div>\n}\n",
515
+ dependencies: [
516
+ {
517
+ kind: "directive",
518
+ type: NgTemplateOutlet,
519
+ selector: "[ngTemplateOutlet]",
520
+ inputs: [
521
+ "ngTemplateOutletContext",
522
+ "ngTemplateOutlet",
523
+ "ngTemplateOutletInjector"
524
+ ]
525
+ },
526
+ {
527
+ kind: "directive",
528
+ type: SortableDirective,
529
+ selector: "[monaSortable]",
530
+ inputs: [
531
+ "sortableCanEnter",
532
+ "sortableDisabled",
533
+ "monaSortable",
534
+ "sortableLabel",
535
+ "sortableLockAxis",
536
+ "sortableOrientation"
537
+ ],
538
+ outputs: ["monaSortableChange", "sortableMove"],
539
+ exportAs: ["monaSortable"]
540
+ },
541
+ {
542
+ kind: "directive",
543
+ type: SortableItemDirective,
544
+ selector: "[monaSortableItem]",
545
+ inputs: [
546
+ "sortableDisabled",
547
+ "monaSortableItem",
548
+ "sortableLabel"
549
+ ],
550
+ exportAs: ["monaSortableItem"]
551
+ }
552
+ ]
553
+ });
554
+ }
555
+ };
556
+ i0.ɵɵngDeclareClassMetadata({
557
+ minVersion: "12.0.0",
558
+ version: "22.2.6",
559
+ ngImport: i0,
560
+ type: KanbanComponent,
561
+ decorators: [{
562
+ type: Component,
563
+ args: [{
564
+ selector: "mona-kanban",
565
+ imports: [
566
+ NgTemplateOutlet,
567
+ SortableDirective,
568
+ SortableItemDirective
569
+ ],
570
+ hostDirectives: [CdkScrollable, SortableGroupDirective],
571
+ host: {
572
+ role: "group",
573
+ "[class]": "baseClass()"
574
+ },
575
+ template: "@let active = activeCard();\n@for (column of columns(); track $index; let columnIndex = $index) {\n @let cards = columnCards()[columnIndex];\n @let headerId = id + \"-column-\" + columnIndex;\n <!-- Named by the title and the count, so the name has a space between them. -->\n @let labelledBy = columnHeaderTemplate() ? headerId : headerId + \"-title \" + headerId + \"-count\";\n <div role=\"group\" [class]=\"columnClass\" [attr.aria-labelledby]=\"labelledBy\">\n <div [id]=\"headerId\" [class]=\"headerClass\">\n @if (columnHeaderTemplate(); as headerTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"headerTemplate\"\n [ngTemplateOutletContext]=\"columnContext(column, cards)\" />\n } @else {\n <span [id]=\"headerId + '-title'\" [class]=\"titleClass\">{{ column.title }}</span>\n <span aria-hidden=\"true\" [class]=\"countClass(cards.length, column)\">{{\n countBadge(cards.length, column)\n }}</span>\n <span class=\"sr-only\" [id]=\"headerId + '-count'\">{{ countText(cards.length, column) }}</span>\n }\n </div>\n <div [class]=\"bodyClass\">\n <ul\n [class]=\"listClass\"\n [attr.aria-labelledby]=\"labelledBy\"\n [monaSortable]=\"cards\"\n [sortableCanEnter]=\"enterChecks()[columnIndex]\"\n [sortableDisabled]=\"disabled()\"\n [sortableLabel]=\"column.title\"\n (sortableMove)=\"onCardMove($event, columnIndex)\">\n @for (card of cards; track card; let index = $index) {\n <li\n [class]=\"cardClass\"\n [monaSortableItem]=\"card\"\n [sortableLabel]=\"cardText(card)\"\n [tabindex]=\"active?.column === columnIndex && active?.index === index ? 0 : -1\"\n [attr.data-kanban-card]=\"columnIndex + '-' + index\"\n (focus)=\"onCardFocus(columnIndex, index)\"\n (keydown)=\"onCardKeydown($event, columnIndex, index)\">\n @if (cardTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"cardContext(card, column, index)\" />\n } @else {\n {{ cardText(card) }}\n }\n </li>\n }\n </ul>\n @if (cards.length === 0) {\n <p aria-hidden=\"true\" [class]=\"emptyClass\">{{ messages().emptyColumn }}</p>\n }\n </div>\n @if (columnFooterTemplate(); as footerTemplate) {\n <div [class]=\"footerClass\">\n <ng-container\n [ngTemplateOutlet]=\"footerTemplate\"\n [ngTemplateOutletContext]=\"columnContext(column, cards)\" />\n </div>\n }\n </div>\n}\n"
576
+ }]
577
+ }],
578
+ propDecorators: {
579
+ cardTemplate: [{
580
+ type: i0.ContentChild,
581
+ args: [i0.forwardRef(() => KanbanCardTemplateDirective), {
582
+ read: TemplateRef,
583
+ isSignal: true
584
+ }]
585
+ }],
586
+ columnFooterTemplate: [{
587
+ type: i0.ContentChild,
588
+ args: [i0.forwardRef(() => KanbanColumnFooterTemplateDirective), {
589
+ read: TemplateRef,
590
+ isSignal: true
591
+ }]
592
+ }],
593
+ columnHeaderTemplate: [{
594
+ type: i0.ContentChild,
595
+ args: [i0.forwardRef(() => KanbanColumnHeaderTemplateDirective), {
596
+ read: TemplateRef,
597
+ isSignal: true
598
+ }]
599
+ }],
600
+ cardMove: [{
601
+ type: i0.Output,
602
+ args: ["cardMove"]
603
+ }],
604
+ columns: [{
605
+ type: i0.Input,
606
+ args: [{
607
+ isSignal: true,
608
+ alias: "columns",
609
+ required: true
610
+ }]
611
+ }],
612
+ data: [{
613
+ type: i0.Input,
614
+ args: [{
615
+ isSignal: true,
616
+ alias: "data",
617
+ required: true
618
+ }]
619
+ }],
620
+ dataChange: [{
621
+ type: i0.Output,
622
+ args: ["dataChange"]
623
+ }],
624
+ disabled: [{
625
+ type: i0.Input,
626
+ args: [{
627
+ isSignal: true,
628
+ alias: "disabled",
629
+ required: false
630
+ }]
631
+ }],
632
+ statusField: [{
633
+ type: i0.Input,
634
+ args: [{
635
+ isSignal: true,
636
+ alias: "statusField",
637
+ required: false
638
+ }]
639
+ }],
640
+ textField: [{
641
+ type: i0.Input,
642
+ args: [{
643
+ isSignal: true,
644
+ alias: "textField",
645
+ required: false
646
+ }]
647
+ }],
648
+ userClass: [{
649
+ type: i0.Input,
650
+ args: [{
651
+ isSignal: true,
652
+ alias: "class",
653
+ required: false
654
+ }]
655
+ }]
656
+ }
657
+ });
658
+ export { KANBAN_DEFAULT_MESSAGES, KanbanCardMoveEvent, KanbanCardTemplateDirective, KanbanColumnFooterTemplateDirective, KanbanColumnHeaderTemplateDirective, KanbanComponent };
659
+
660
+ //# sourceMappingURL=nanahoshi-mona-ui-kanban.mjs.map
@@ -481,6 +481,8 @@ const MONA_AR_SA_LOCALE = {
481
481
  cancel: "إلغاء",
482
482
  cancelNewRow: "إلغاء الصف الجديد",
483
483
  cancelRowEdit: (rowNumber) => `إلغاء تحرير الصف ${localizeNumber(rowNumber)}`,
484
+ cellsCopied: (count) => `الخلايا المنسوخة: ${localizeNumber(count)}`,
485
+ cellsPasted: (count) => `الخلايا التي تم اللصق فيها: ${localizeNumber(count)}`,
484
486
  clearFilter: (column) => `مسح تصفية ${column}`,
485
487
  collapseDetail: (rowNumber) => `طي تفاصيل الصف ${localizeNumber(rowNumber)}`,
486
488
  columnGrouped: (column) => `تم التجميع حسب ${column}`,
@@ -534,6 +536,11 @@ const MONA_AR_SA_LOCALE = {
534
536
  sortOrder: (position) => `ترتيب الفرز ${localizeNumber(position)}`,
535
537
  toolbar: "شريط أدوات الجدول"
536
538
  },
539
+ kanban: {
540
+ cardCount: (count) => `عدد البطاقات: ${localizeNumber(count)}`,
541
+ cardCountWithLimit: (count, limit) => `عدد البطاقات: ${localizeNumber(count)} من ${localizeNumber(limit)}`,
542
+ emptyColumn: "لا توجد بطاقات"
543
+ },
537
544
  label: { optional: "اختياري" },
538
545
  list: {
539
546
  filterList: "تصفية القائمة",
@@ -653,6 +660,10 @@ const MONA_AR_SA_LOCALE = {
653
660
  minimumValue: "الحد الأدنى",
654
661
  sliderValue: "قيمة شريط التمرير"
655
662
  },
663
+ sortable: {
664
+ itemMoved: (item, position, total) => `تم نقل ${item} إلى الموضع ${localizeNumber(position)} من ${localizeNumber(total)}`,
665
+ itemMovedToList: (item, list, position, total) => `تم نقل ${item} إلى ${list}، الموضع ${localizeNumber(position)} من ${localizeNumber(total)}`
666
+ },
656
667
  spinner: {
657
668
  cancel: "إلغاء",
658
669
  loading: "جارٍ التحميل"