@masterteam/data-table 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -14
- package/fesm2022/masterteam-data-table-legacy.mjs +6 -1235
- package/fesm2022/masterteam-data-table-legacy.mjs.map +1 -1
- package/fesm2022/masterteam-data-table.mjs +988 -4
- package/fesm2022/masterteam-data-table.mjs.map +1 -1
- package/legacy/README.md +11 -40
- package/package.json +3 -3
- package/types/masterteam-data-table-legacy.d.ts +7 -122
- package/types/masterteam-data-table.d.ts +266 -3
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, computed, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
2
|
+
import { input, computed, ChangeDetectionStrategy, ViewEncapsulation, Component, inject, Injectable, output, untracked } from '@angular/core';
|
|
3
3
|
import { currencyUnitOf, EntityPreview, EntityText, EntityRuntimeContextStore } from '@masterteam/components/entities';
|
|
4
|
-
import { TableValueResolver } from '@masterteam/components/table';
|
|
5
|
-
import { AUTO_GROUP_COLUMN_ID } from '@masterteam/data-grid';
|
|
4
|
+
import { TableValueResolver, TableExportService } from '@masterteam/components/table';
|
|
5
|
+
import { AUTO_GROUP_COLUMN_ID, applyGridViewState, captureGridViewState, MtDataGridComponent } from '@masterteam/data-grid';
|
|
6
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
7
|
+
import { TranslocoService } from '@jsverse/transloco';
|
|
8
|
+
import { EmptyState } from '@masterteam/components/empty-state';
|
|
9
|
+
import { Button } from '@masterteam/components/button';
|
|
10
|
+
import { ConfirmationService } from '@masterteam/components/confirmation';
|
|
11
|
+
import { Popover } from 'primeng/popover';
|
|
12
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
6
13
|
|
|
7
14
|
const NUMERIC = new Set([
|
|
8
15
|
'Number',
|
|
@@ -445,9 +452,986 @@ function mtEntityColumn(options) {
|
|
|
445
452
|
};
|
|
446
453
|
}
|
|
447
454
|
|
|
455
|
+
const axisLabels = {
|
|
456
|
+
'line enabled': 'إظهار الخط',
|
|
457
|
+
'line width': 'سُمك الخط',
|
|
458
|
+
'line colour': 'لون الخط',
|
|
459
|
+
'ticks enabled': 'إظهار التدريجات',
|
|
460
|
+
'tick width': 'سُمك التدريج',
|
|
461
|
+
'tick size': 'حجم التدريج',
|
|
462
|
+
'labels enabled': 'إظهار التسميات',
|
|
463
|
+
'label font size': 'حجم خط التسمية',
|
|
464
|
+
'label colour': 'لون التسمية',
|
|
465
|
+
'label rotation': 'زاوية التسمية',
|
|
466
|
+
'gridlines enabled': 'إظهار خطوط الشبكة',
|
|
467
|
+
'gridline width': 'سُمك خطوط الشبكة',
|
|
468
|
+
'gridline colour': 'لون خطوط الشبكة',
|
|
469
|
+
};
|
|
470
|
+
/** Package defaults; products override source-message keys in components.dataGrid. */
|
|
471
|
+
const MT_TABLE_GRID_AR = {
|
|
472
|
+
'Data grid': 'جدول البيانات',
|
|
473
|
+
'No Rows To Show': 'لا توجد سجلات للعرض',
|
|
474
|
+
'Loading…': 'جارٍ التحميل…',
|
|
475
|
+
'Loading...': 'جارٍ التحميل…',
|
|
476
|
+
'(Default)': '(افتراضي)',
|
|
477
|
+
'(Blanks)': '(فارغ)',
|
|
478
|
+
'(Select All)': '(تحديد الكل)',
|
|
479
|
+
'(Select All Search Results)': '(تحديد كل نتائج البحث)',
|
|
480
|
+
'Row Groups': 'مجموعات الصفوف',
|
|
481
|
+
'Column Labels': 'تسميات الأعمدة',
|
|
482
|
+
Values: 'القيم',
|
|
483
|
+
Columns: 'الأعمدة',
|
|
484
|
+
Column: 'عمودي',
|
|
485
|
+
'Column Group': 'مجموعة أعمدة',
|
|
486
|
+
Filters: 'عوامل التصفية',
|
|
487
|
+
visible: 'ظاهر',
|
|
488
|
+
hidden: 'مخفي',
|
|
489
|
+
true: 'نعم',
|
|
490
|
+
false: 'لا',
|
|
491
|
+
hex: 'رمز اللون',
|
|
492
|
+
'Column Menu': 'قائمة العمود',
|
|
493
|
+
'Context Menu': 'قائمة السياق',
|
|
494
|
+
'Column Filter': 'تصفية العمود',
|
|
495
|
+
'Choose Columns': 'اختيار الأعمدة',
|
|
496
|
+
'Pivot Mode': 'الوضع المحوري',
|
|
497
|
+
'Drag here to set row groups': 'اسحب هنا لتجميع الصفوف',
|
|
498
|
+
'Drag here to set column labels': 'اسحب هنا لتعيين تسميات الأعمدة',
|
|
499
|
+
'Drag here to aggregate': 'اسحب هنا لتجميع القيم',
|
|
500
|
+
"Pivot columns — a dropped column's values become column headers": 'أعمدة محورية — تصبح قيم العمود المسحوب رؤوس أعمدة',
|
|
501
|
+
'Filter Columns Input': 'بحث الأعمدة',
|
|
502
|
+
'Column with Header Selection': 'عمود مع تحديد الرأس',
|
|
503
|
+
'Toggle All Columns Visibility': 'تبديل ظهور كل الأعمدة',
|
|
504
|
+
'Column List': 'قائمة الأعمدة',
|
|
505
|
+
'Press SPACE to toggle visibility (': 'اضغط مسافة لتبديل الظهور (',
|
|
506
|
+
'Search columns': 'بحث الأعمدة',
|
|
507
|
+
'Search columns...': 'بحث الأعمدة…',
|
|
508
|
+
'Search filters': 'بحث عوامل التصفية',
|
|
509
|
+
'Search filters...': 'بحث عوامل التصفية…',
|
|
510
|
+
'Search filter values': 'بحث قيم التصفية',
|
|
511
|
+
'Search...': 'بحث…',
|
|
512
|
+
'No columns': 'لا توجد أعمدة',
|
|
513
|
+
'No matches.': 'لا توجد نتائج مطابقة.',
|
|
514
|
+
'Type to search...': 'اكتب للبحث…',
|
|
515
|
+
'Could not load values.': 'تعذر تحميل القيم.',
|
|
516
|
+
'Quick filter': 'بحث سريع',
|
|
517
|
+
'Add Filter': 'إضافة تصفية',
|
|
518
|
+
'Add Filter Field': 'إضافة شرط تصفية',
|
|
519
|
+
'Delete Filter': 'حذف التصفية',
|
|
520
|
+
'Open Filter Menu': 'فتح قائمة التصفية',
|
|
521
|
+
'Filter List': 'قائمة التصفية',
|
|
522
|
+
'Filtering operator': 'معامل التصفية',
|
|
523
|
+
'Filter join operator': 'معامل ربط الشروط',
|
|
524
|
+
'Filter...': 'تصفية…',
|
|
525
|
+
'Filter Value': 'قيمة التصفية',
|
|
526
|
+
'Filter from value': 'قيمة بداية التصفية',
|
|
527
|
+
'Filter to Value': 'قيمة نهاية التصفية',
|
|
528
|
+
From: 'من',
|
|
529
|
+
To: 'إلى',
|
|
530
|
+
'Text Filter': 'تصفية نصية',
|
|
531
|
+
'Number Filter': 'تصفية رقمية',
|
|
532
|
+
'Date Filter': 'تصفية تاريخ',
|
|
533
|
+
'Set Filter': 'تصفية قيم',
|
|
534
|
+
'Date Filter Input': 'حقل تصفية التاريخ',
|
|
535
|
+
'{column} Filter Input': 'حقل تصفية {column}',
|
|
536
|
+
Contains: 'يحتوي على',
|
|
537
|
+
'Does not contain': 'لا يحتوي على',
|
|
538
|
+
Equals: 'يساوي',
|
|
539
|
+
'Does not equal': 'لا يساوي',
|
|
540
|
+
'Begins with': 'يبدأ بـ',
|
|
541
|
+
'Ends with': 'ينتهي بـ',
|
|
542
|
+
'Greater than': 'أكبر من',
|
|
543
|
+
'Greater than or equal to': 'أكبر من أو يساوي',
|
|
544
|
+
'Less than': 'أقل من',
|
|
545
|
+
'Less than or equal to': 'أقل من أو يساوي',
|
|
546
|
+
Between: 'بين',
|
|
547
|
+
Blank: 'فارغ',
|
|
548
|
+
'Not blank': 'غير فارغ',
|
|
549
|
+
Before: 'قبل',
|
|
550
|
+
After: 'بعد',
|
|
551
|
+
AND: 'و',
|
|
552
|
+
OR: 'أو',
|
|
553
|
+
Apply: 'تطبيق',
|
|
554
|
+
Reset: 'إعادة ضبط',
|
|
555
|
+
Cancel: 'إلغاء',
|
|
556
|
+
Clear: 'مسح',
|
|
557
|
+
Close: 'إغلاق',
|
|
558
|
+
'Select Field': 'اختيار حقل',
|
|
559
|
+
'Sort Ascending': 'ترتيب تصاعدي',
|
|
560
|
+
'Sort Descending': 'ترتيب تنازلي',
|
|
561
|
+
'Clear Sort': 'مسح الترتيب',
|
|
562
|
+
'Pin Column': 'تثبيت العمود',
|
|
563
|
+
'No Pin': 'إلغاء التثبيت',
|
|
564
|
+
'Pin Left': 'تثبيت يسارًا',
|
|
565
|
+
'Pin Right': 'تثبيت يمينًا',
|
|
566
|
+
'Autosize This Column': 'ضبط عرض العمود تلقائيًا',
|
|
567
|
+
'Autosize All Columns': 'ضبط عرض كل الأعمدة تلقائيًا',
|
|
568
|
+
'Reset Columns': 'إعادة ضبط الأعمدة',
|
|
569
|
+
'Group by {column}': 'تجميع حسب {column}',
|
|
570
|
+
'Un-Group by {column}': 'إلغاء التجميع حسب {column}',
|
|
571
|
+
'Remove from Values': 'إزالة من القيم',
|
|
572
|
+
'Add to Values': 'إضافة إلى القيم',
|
|
573
|
+
'Remove from Labels': 'إزالة من التسميات',
|
|
574
|
+
'Add to Labels': 'إضافة إلى التسميات',
|
|
575
|
+
'Expand All': 'توسيع الكل',
|
|
576
|
+
'Collapse All': 'طي الكل',
|
|
577
|
+
'Expand All Column Groups': 'توسيع كل مجموعات الأعمدة',
|
|
578
|
+
'Collapse All Column Groups': 'طي كل مجموعات الأعمدة',
|
|
579
|
+
Expand: 'توسيع',
|
|
580
|
+
Collapse: 'طي',
|
|
581
|
+
Remove: 'إزالة',
|
|
582
|
+
Reorder: 'إعادة ترتيب',
|
|
583
|
+
Resize: 'تغيير حجم',
|
|
584
|
+
Cut: 'قص',
|
|
585
|
+
Copy: 'نسخ',
|
|
586
|
+
'Copy with Headers': 'نسخ مع الرؤوس',
|
|
587
|
+
'Copy with Group Headers': 'نسخ مع رؤوس المجموعات',
|
|
588
|
+
Paste: 'لصق',
|
|
589
|
+
Export: 'تصدير',
|
|
590
|
+
'CSV Export': 'تصدير CSV',
|
|
591
|
+
'Excel Export (.xlsx)': 'تصدير Excel (.xlsx)',
|
|
592
|
+
'PDF Export': 'تصدير PDF',
|
|
593
|
+
Pagination: 'ترقيم الصفحات',
|
|
594
|
+
Page: 'صفحة',
|
|
595
|
+
'Page number,': 'رقم الصفحة،',
|
|
596
|
+
'Page Size': 'حجم الصفحة',
|
|
597
|
+
'Page Size:': 'حجم الصفحة:',
|
|
598
|
+
'First Page': 'الصفحة الأولى',
|
|
599
|
+
'Last Page': 'الصفحة الأخيرة',
|
|
600
|
+
'Next Page': 'الصفحة التالية',
|
|
601
|
+
'Previous Page': 'الصفحة السابقة',
|
|
602
|
+
of: 'من',
|
|
603
|
+
to: 'إلى',
|
|
604
|
+
Rows: 'الصفوف',
|
|
605
|
+
'Total Rows': 'إجمالي الصفوف',
|
|
606
|
+
'Filtered Rows': 'الصفوف المصفاة',
|
|
607
|
+
Selected: 'المحدد',
|
|
608
|
+
'Row Number': 'رقم الصف',
|
|
609
|
+
Count: 'العدد',
|
|
610
|
+
Sum: 'المجموع',
|
|
611
|
+
Min: 'الأدنى',
|
|
612
|
+
Max: 'الأعلى',
|
|
613
|
+
Avg: 'المتوسط',
|
|
614
|
+
Average: 'المتوسط',
|
|
615
|
+
Total: 'الإجمالي',
|
|
616
|
+
First: 'الأول',
|
|
617
|
+
Last: 'الأخير',
|
|
618
|
+
None: 'بدون',
|
|
619
|
+
count: 'العدد',
|
|
620
|
+
sum: 'المجموع',
|
|
621
|
+
min: 'الأدنى',
|
|
622
|
+
max: 'الأعلى',
|
|
623
|
+
avg: 'المتوسط',
|
|
624
|
+
first: 'الأول',
|
|
625
|
+
last: 'الأخير',
|
|
626
|
+
Chart: 'الرسم البياني',
|
|
627
|
+
Data: 'البيانات',
|
|
628
|
+
Format: 'التنسيق',
|
|
629
|
+
'Advanced settings': 'إعدادات متقدمة',
|
|
630
|
+
'Choose at least two series in Data.': 'اختر سلسلتين على الأقل من البيانات.',
|
|
631
|
+
'Choose three series in Data: X, Y and bubble size.': 'اختر ثلاث سلاسل من البيانات: س وص وحجم الفقاعة.',
|
|
632
|
+
'Choose series': 'اختيار السلاسل',
|
|
633
|
+
'Category axis': 'محور الفئات',
|
|
634
|
+
'Value axis': 'محور القيم',
|
|
635
|
+
'Chart Range': 'رسم النطاق',
|
|
636
|
+
'Range Chart': 'رسم النطاق',
|
|
637
|
+
'Horizontal chart scroll': 'تمرير المخطط أفقياً',
|
|
638
|
+
'Vertical chart scroll': 'تمرير المخطط عمودياً',
|
|
639
|
+
'{series} by {category}': '{series} حسب {category}',
|
|
640
|
+
'Chart Menu': 'قائمة الرسم البياني',
|
|
641
|
+
'Chart legend': 'مفتاح الرسم البياني',
|
|
642
|
+
'Chart toolbar': 'شريط أدوات الرسم',
|
|
643
|
+
'Chart settings': 'إعدادات الرسم',
|
|
644
|
+
'Chart type': 'نوع الرسم',
|
|
645
|
+
'Chart tool panel width': 'عرض لوحة الرسم',
|
|
646
|
+
'Close chart tool panel': 'إغلاق لوحة الرسم',
|
|
647
|
+
'No data available to be charted.': 'لا توجد بيانات متاحة للرسم.',
|
|
648
|
+
'Edit Chart': 'تحرير الرسم',
|
|
649
|
+
'Advanced Settings': 'إعدادات متقدمة',
|
|
650
|
+
'Link to Grid': 'ربط بالجدول',
|
|
651
|
+
'Unlink from Grid': 'فصل عن الجدول',
|
|
652
|
+
'Download Chart': 'تنزيل الرسم',
|
|
653
|
+
Maximize: 'تكبير',
|
|
654
|
+
Restore: 'استعادة الحجم',
|
|
655
|
+
'Next legend page': 'الصفحة التالية من المفتاح',
|
|
656
|
+
'Previous legend page': 'الصفحة السابقة من المفتاح',
|
|
657
|
+
Categories: 'الفئات',
|
|
658
|
+
Category: 'الفئة',
|
|
659
|
+
Series: 'السلاسل',
|
|
660
|
+
Aggregation: 'التجميع',
|
|
661
|
+
'Aggregation Function': 'دالة التجميع',
|
|
662
|
+
'Switch Category / Series': 'تبديل الفئة والسلسلة',
|
|
663
|
+
Themes: 'السمات',
|
|
664
|
+
Range: 'النطاق',
|
|
665
|
+
'Select range': 'اختيار نطاق',
|
|
666
|
+
'Used as category': 'مستخدم كفئة',
|
|
667
|
+
Records: 'السجلات',
|
|
668
|
+
Measures: 'المقاييس',
|
|
669
|
+
Measure: 'المقياس',
|
|
670
|
+
Analysis: 'التحليل',
|
|
671
|
+
'Count of records': 'عدد السجلات',
|
|
672
|
+
'Non-empty {column}': '{column} غير الفارغة',
|
|
673
|
+
'Distinct {column}': 'القيم المميزة في {column}',
|
|
674
|
+
Unassigned: 'غير محدد',
|
|
675
|
+
Recommended: 'موصى به',
|
|
676
|
+
'multi-value': 'متعدد القيم',
|
|
677
|
+
'Needs a numeric series': 'يتطلب سلسلة رقمية',
|
|
678
|
+
'Shares of a multi-value category overlap': 'حصص الفئة متعددة القيم متداخلة ولا تصلح للرسم النسبي',
|
|
679
|
+
'Each record counts once in every category it belongs to; totals can exceed the number of records.': 'يُحتسب كل سجل مرة واحدة في كل فئة ينتمي إليها، وقد تتجاوز المجاميع عدد السجلات.',
|
|
680
|
+
'Measures count records per category; numeric series use the aggregation below.': 'تحسب المقاييس السجلات في كل فئة، أما السلاسل الرقمية فتستخدم التجميع أدناه.',
|
|
681
|
+
'No numeric columns in this range.': 'لا توجد أعمدة رقمية في هذا النطاق.',
|
|
682
|
+
'Additional columns are unused by this type': 'هذا النوع لا يستخدم الأعمدة الإضافية',
|
|
683
|
+
', Alt+Up or Alt+Down to reorder': '، Alt+أعلى أو Alt+أسفل لإعادة الترتيب',
|
|
684
|
+
'Secondary axis': 'محور ثانوي',
|
|
685
|
+
'Rows {start}–{end}': 'الصفوف {start}–{end}',
|
|
686
|
+
'Columns {columns}': 'الأعمدة {columns}',
|
|
687
|
+
'All matching rows': 'كل الصفوف المطابقة',
|
|
688
|
+
'Selected rows: {count}': 'الصفوف المحددة: {count}',
|
|
689
|
+
Bar: 'شريطي',
|
|
690
|
+
'Stacked Column': 'أعمدة مكدسة',
|
|
691
|
+
'100% Stacked Column': 'أعمدة مكدسة بنسبة ١٠٠٪',
|
|
692
|
+
'Stacked Bar': 'أشرطة مكدسة',
|
|
693
|
+
'100% Stacked Bar': 'أشرطة مكدسة بنسبة ١٠٠٪',
|
|
694
|
+
Pie: 'دائري',
|
|
695
|
+
Donut: 'حلقي',
|
|
696
|
+
Line: 'خطي',
|
|
697
|
+
'Stacked Line': 'خطوط مكدسة',
|
|
698
|
+
'100% Stacked Line': 'خطوط مكدسة بنسبة ١٠٠٪',
|
|
699
|
+
Area: 'مساحي',
|
|
700
|
+
'Stacked Area': 'مساحات مكدسة',
|
|
701
|
+
'100% Stacked Area': 'مساحات مكدسة بنسبة ١٠٠٪',
|
|
702
|
+
Scatter: 'مبعثر',
|
|
703
|
+
Bubble: 'فقاعي',
|
|
704
|
+
Polar: 'قطبي',
|
|
705
|
+
'Radar Line': 'راداري خطي',
|
|
706
|
+
'Radar Area': 'راداري مساحي',
|
|
707
|
+
Nightingale: 'وردة قطبية',
|
|
708
|
+
'Radial Column': 'أعمدة شعاعية',
|
|
709
|
+
'Radial Bar': 'أشرطة شعاعية',
|
|
710
|
+
Statistical: 'إحصائي',
|
|
711
|
+
'Box Plot': 'صندوقي',
|
|
712
|
+
Histogram: 'مدرج تكراري',
|
|
713
|
+
'Range Bar': 'أشرطة نطاق',
|
|
714
|
+
'Range Area': 'مساحة نطاق',
|
|
715
|
+
Hierarchical: 'هرمي',
|
|
716
|
+
Treemap: 'خريطة شجرية',
|
|
717
|
+
Sunburst: 'حلقات شجرية',
|
|
718
|
+
Specialized: 'متخصص',
|
|
719
|
+
Heatmap: 'خريطة حرارية',
|
|
720
|
+
Waterfall: 'شلالي',
|
|
721
|
+
Funnel: 'قمعي',
|
|
722
|
+
'Cone Funnel': 'قمع مخروطي',
|
|
723
|
+
Pyramid: 'هرمي متدرج',
|
|
724
|
+
Combination: 'مركب',
|
|
725
|
+
'Column & Line': 'أعمدة وخط',
|
|
726
|
+
'Area & Column': 'مساحة وأعمدة',
|
|
727
|
+
'Custom Combo': 'رسم مركب مخصص',
|
|
728
|
+
Titles: 'العناوين',
|
|
729
|
+
Title: 'العنوان',
|
|
730
|
+
Subtitle: 'العنوان الفرعي',
|
|
731
|
+
Legend: 'المفتاح',
|
|
732
|
+
Axes: 'المحاور',
|
|
733
|
+
Tooltip: 'التلميحات',
|
|
734
|
+
Navigator: 'المستكشف',
|
|
735
|
+
Position: 'الموضع',
|
|
736
|
+
Spacing: 'التباعد',
|
|
737
|
+
Number: 'الرقم',
|
|
738
|
+
'Title enabled': 'إظهار العنوان',
|
|
739
|
+
'Subtitle enabled': 'إظهار العنوان الفرعي',
|
|
740
|
+
'Title text': 'نص العنوان',
|
|
741
|
+
'Subtitle text': 'نص العنوان الفرعي',
|
|
742
|
+
'Padding top': 'الهامش العلوي',
|
|
743
|
+
'Padding right': 'الهامش الأيمن',
|
|
744
|
+
'Padding bottom': 'الهامش السفلي',
|
|
745
|
+
'Padding left': 'الهامش الأيسر',
|
|
746
|
+
'Background enabled': 'إظهار الخلفية',
|
|
747
|
+
'Background colour': 'لون الخلفية',
|
|
748
|
+
'Legend enabled': 'إظهار المفتاح',
|
|
749
|
+
'Item font size': 'حجم خط العنصر',
|
|
750
|
+
'Marker size': 'حجم العلامة',
|
|
751
|
+
'Marker shape': 'شكل العلامة',
|
|
752
|
+
'Number format': 'تنسيق الرقم',
|
|
753
|
+
'Labels enabled': 'إظهار التسميات',
|
|
754
|
+
'Label font size': 'حجم خط التسمية',
|
|
755
|
+
'Label placement': 'موضع التسمية',
|
|
756
|
+
'Fill opacity': 'عتامة التعبئة',
|
|
757
|
+
'Stroke width': 'سُمك الحد',
|
|
758
|
+
'Stroke opacity': 'عتامة الحد',
|
|
759
|
+
'Line width': 'سُمك الخط',
|
|
760
|
+
'Line dash': 'نمط الخط',
|
|
761
|
+
'Markers enabled': 'إظهار العلامات',
|
|
762
|
+
'Sector stroke width': 'سُمك حدود القطاعات',
|
|
763
|
+
'Callout labels enabled': 'إظهار تسميات الشرح',
|
|
764
|
+
'Callout length': 'طول خط الشرح',
|
|
765
|
+
'Callout font size': 'حجم خط الشرح',
|
|
766
|
+
'Inner radius': 'نصف القطر الداخلي',
|
|
767
|
+
'Start angle': 'زاوية البداية',
|
|
768
|
+
'Min bubble size': 'أصغر حجم فقاعة',
|
|
769
|
+
'Max bubble size': 'أكبر حجم فقاعة',
|
|
770
|
+
'Corner radius': 'استدارة الزوايا',
|
|
771
|
+
'Shadow enabled': 'إظهار الظل',
|
|
772
|
+
'Shadow blur': 'تمويه الظل',
|
|
773
|
+
'Shadow offset': 'إزاحة الظل',
|
|
774
|
+
'Radar area opacity': 'عتامة المساحة الرادارية',
|
|
775
|
+
'Rose type': 'نوع الوردة',
|
|
776
|
+
'Bar width': 'عرض الشريط',
|
|
777
|
+
'Node gap': 'تباعد العقد',
|
|
778
|
+
'Square ratio': 'نسبة التربيع',
|
|
779
|
+
Gap: 'التباعد',
|
|
780
|
+
Sort: 'الترتيب',
|
|
781
|
+
'Minimum width': 'أقل عرض',
|
|
782
|
+
'Box width': 'عرض الصندوق',
|
|
783
|
+
'Border style': 'نمط الحد',
|
|
784
|
+
'Bin count': 'عدد الفئات',
|
|
785
|
+
'Bar gap': 'تباعد الأشرطة',
|
|
786
|
+
'Range width': 'عرض النطاق',
|
|
787
|
+
'Column width': 'عرض العمود',
|
|
788
|
+
'Tooltip enabled': 'إظهار التلميحات',
|
|
789
|
+
'Snap to nearest': 'محاذاة إلى الأقرب',
|
|
790
|
+
'Navigator enabled': 'إظهار المستكشف',
|
|
791
|
+
'Navigator height': 'ارتفاع المستكشف',
|
|
792
|
+
Top: 'أعلى',
|
|
793
|
+
Right: 'يمين',
|
|
794
|
+
Bottom: 'أسفل',
|
|
795
|
+
Left: 'يسار',
|
|
796
|
+
Circle: 'دائرة',
|
|
797
|
+
Square: 'مربع',
|
|
798
|
+
Diamond: 'معين',
|
|
799
|
+
Triangle: 'مثلث',
|
|
800
|
+
Inside: 'داخل',
|
|
801
|
+
Outside: 'خارج',
|
|
802
|
+
Solid: 'متصل',
|
|
803
|
+
Dashed: 'متقطع',
|
|
804
|
+
Dotted: 'منقط',
|
|
805
|
+
Radius: 'نصف القطر',
|
|
806
|
+
Ascending: 'تصاعدي',
|
|
807
|
+
Descending: 'تنازلي',
|
|
808
|
+
List: 'قائمة',
|
|
809
|
+
'font size': 'حجم الخط',
|
|
810
|
+
bold: 'عريض',
|
|
811
|
+
italic: 'مائل',
|
|
812
|
+
colour: 'اللون',
|
|
813
|
+
slider: 'شريط التمرير',
|
|
814
|
+
type: 'النوع',
|
|
815
|
+
settings: 'الإعدادات',
|
|
816
|
+
data: 'البيانات',
|
|
817
|
+
format: 'التنسيق',
|
|
818
|
+
'tool panel': 'لوحة الأدوات',
|
|
819
|
+
...Object.fromEntries(['Category', 'Number'].flatMap((axis) => Object.entries(axisLabels).map(([suffix, label]) => [
|
|
820
|
+
`${axis} ${suffix}`,
|
|
821
|
+
`${label} (${axis === 'Category' ? 'الفئة' : 'القيمة'})`,
|
|
822
|
+
]))),
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
const TEXT = {
|
|
826
|
+
selectRow: ['Select row', 'تحديد الصف'],
|
|
827
|
+
selectAll: ['Select all rows on this page', 'تحديد كل الصفوف في هذه الصفحة'],
|
|
828
|
+
search: ['Search', 'بحث'],
|
|
829
|
+
columns: ['Columns', 'الأعمدة'],
|
|
830
|
+
rowActions: ['Row actions', 'إجراءات السجل'],
|
|
831
|
+
actions: ['Actions', 'الإجراءات'],
|
|
832
|
+
groupBy: ['Group by', 'تجميع حسب'],
|
|
833
|
+
noGrouping: ['No grouping', 'بدون تجميع'],
|
|
834
|
+
analysis: ['Analysis', 'التحليل'],
|
|
835
|
+
export: ['Export', 'تصدير'],
|
|
836
|
+
csv: ['CSV', 'CSV'],
|
|
837
|
+
excel: ['Excel', 'Excel'],
|
|
838
|
+
pdf: ['PDF', 'PDF'],
|
|
839
|
+
print: ['Print', 'طباعة'],
|
|
840
|
+
focus: ['Focus table', 'توسيع الجدول'],
|
|
841
|
+
closeFocus: ['Close focus view', 'إغلاق العرض الموسع'],
|
|
842
|
+
retry: ['Try again', 'إعادة المحاولة'],
|
|
843
|
+
failed: ['Unable to load this table.', 'تعذر تحميل هذا الجدول.'],
|
|
844
|
+
exportFailed: ['Export failed. Try again.', 'تعذر التصدير. حاول مرة أخرى.'],
|
|
845
|
+
noRows: ['No records', 'لا توجد سجلات'],
|
|
846
|
+
loading: ['Loading…', 'جارٍ التحميل…'],
|
|
847
|
+
reset: ['Reset view', 'إعادة ضبط العرض'],
|
|
848
|
+
rows: ['records', 'سجل'],
|
|
849
|
+
previous: ['Previous page', 'الصفحة السابقة'],
|
|
850
|
+
next: ['Next page', 'الصفحة التالية'],
|
|
851
|
+
pageSize: ['Rows per page', 'عدد الصفوف في الصفحة'],
|
|
852
|
+
page: ['Page', 'الصفحة'],
|
|
853
|
+
compare: ['Compare selected records', 'مقارنة السجلات المحددة'],
|
|
854
|
+
close: ['Close', 'إغلاق'],
|
|
855
|
+
incomplete: [
|
|
856
|
+
'Whole-table analysis is unavailable until the complete result is loaded.',
|
|
857
|
+
'يتاح تحليل الجدول بعد تحميل جميع النتائج.',
|
|
858
|
+
],
|
|
859
|
+
chart: ['Chart table', 'رسم بياني للجدول'],
|
|
860
|
+
chartSelection: ['Chart selection', 'رسم بياني للتحديد'],
|
|
861
|
+
};
|
|
862
|
+
/** Product translations override package defaults. Language changes remain reactive. */
|
|
863
|
+
class MtTableText {
|
|
864
|
+
transloco = inject(TranslocoService);
|
|
865
|
+
language = toSignal(this.transloco.langChanges$, {
|
|
866
|
+
initialValue: this.transloco.getActiveLang(),
|
|
867
|
+
equal: () => false,
|
|
868
|
+
});
|
|
869
|
+
translationEvents = toSignal(this.transloco.events$);
|
|
870
|
+
gridLocale = computed(() => {
|
|
871
|
+
this.translationEvents();
|
|
872
|
+
const language = this.language();
|
|
873
|
+
const translation = this.transloco.getTranslation(language);
|
|
874
|
+
const prefix = 'components.dataGrid.';
|
|
875
|
+
const overrides = Object.fromEntries(Object.entries(translation)
|
|
876
|
+
.filter(([key, value]) => key.startsWith(prefix) && typeof value === 'string')
|
|
877
|
+
.map(([key, value]) => [key.slice(prefix.length), value]));
|
|
878
|
+
return {
|
|
879
|
+
...(language.startsWith('ar') ? MT_TABLE_GRID_AR : {}),
|
|
880
|
+
...overrides,
|
|
881
|
+
};
|
|
882
|
+
}, ...(ngDevMode ? [{ debugName: "gridLocale" }] : /* istanbul ignore next */ []));
|
|
883
|
+
text(key) {
|
|
884
|
+
this.translationEvents();
|
|
885
|
+
const language = this.language();
|
|
886
|
+
const path = `components.dataTable.${key}`;
|
|
887
|
+
const translation = this.transloco.getTranslation(language);
|
|
888
|
+
const override = translation['components']?.dataTable?.[key] ?? translation[path];
|
|
889
|
+
return typeof override === 'string'
|
|
890
|
+
? override
|
|
891
|
+
: TEXT[key][language.startsWith('ar') ? 1 : 0];
|
|
892
|
+
}
|
|
893
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtTableText, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
894
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtTableText, providedIn: 'root' });
|
|
895
|
+
}
|
|
896
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtTableText, decorators: [{
|
|
897
|
+
type: Injectable,
|
|
898
|
+
args: [{ providedIn: 'root' }]
|
|
899
|
+
}] });
|
|
900
|
+
|
|
901
|
+
/** Reuse the existing Arabic-safe product print path with the entire matching result. */
|
|
902
|
+
function mtTablePrintConfiguration(api, definitions, title) {
|
|
903
|
+
const state = api.getColumnState().filter((column) => !column.hide);
|
|
904
|
+
const columns = state.flatMap((column) => definitions.filter((definition) => (definition.colId ?? definition.field) === column.colId));
|
|
905
|
+
const rows = new Map();
|
|
906
|
+
api.forEachNodeAfterFilterAndSort((node) => {
|
|
907
|
+
if (node.detail || node.footer)
|
|
908
|
+
return;
|
|
909
|
+
for (const leaf of node.group ? (node.allLeafChildren ?? []) : [node])
|
|
910
|
+
if (leaf.data)
|
|
911
|
+
rows.set(leaf.id, leaf.data);
|
|
912
|
+
});
|
|
913
|
+
return {
|
|
914
|
+
title,
|
|
915
|
+
filename: title || 'table',
|
|
916
|
+
rows: [...rows.values()],
|
|
917
|
+
columns: columns.map((column) => ({
|
|
918
|
+
key: column.colId ?? column.field,
|
|
919
|
+
label: column.headerName ?? column.colId ?? column.field,
|
|
920
|
+
type: 'custom',
|
|
921
|
+
exportable: true,
|
|
922
|
+
})),
|
|
923
|
+
resolveValue: (row, column) => {
|
|
924
|
+
const definition = columns.find((definition) => (definition.colId ?? definition.field) === column.key);
|
|
925
|
+
const entity = definition.cellRendererParams?.['entity'];
|
|
926
|
+
if (entity) {
|
|
927
|
+
const value = entity(row);
|
|
928
|
+
const exported = value ? mtEntityCellValues(value).export : null;
|
|
929
|
+
return exported instanceof Date
|
|
930
|
+
? exported.toLocaleDateString()
|
|
931
|
+
: exported;
|
|
932
|
+
}
|
|
933
|
+
const value = definition.valueGetter
|
|
934
|
+
? definition.valueGetter({
|
|
935
|
+
data: row,
|
|
936
|
+
column: definition,
|
|
937
|
+
rowIndex: 0,
|
|
938
|
+
})
|
|
939
|
+
: row[definition.field ?? column.key];
|
|
940
|
+
if (definition.valueFormatter)
|
|
941
|
+
return definition.valueFormatter({
|
|
942
|
+
data: row,
|
|
943
|
+
column: definition,
|
|
944
|
+
rowIndex: 0,
|
|
945
|
+
value,
|
|
946
|
+
});
|
|
947
|
+
return typeof value === 'number' ||
|
|
948
|
+
typeof value === 'boolean' ||
|
|
949
|
+
typeof value === 'string'
|
|
950
|
+
? value
|
|
951
|
+
: null;
|
|
952
|
+
},
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* A column without a data source (no `field`, no `valueGetter`) is a control column, such as
|
|
958
|
+
* the row actions. Like the reference grid, its header keeps the menu button only: there is
|
|
959
|
+
* nothing to sort or filter.
|
|
960
|
+
*/
|
|
961
|
+
function mtIsControlColumn(column) {
|
|
962
|
+
return column.field === undefined && column.valueGetter === undefined;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* The one standard header (user decision 2026-11-03). Every data column shows the sort
|
|
966
|
+
* indicator, the menu button and the filter button, and it resizes and moves. No page may
|
|
967
|
+
* replace the header: custom header renderers are dropped and floating filters stay off,
|
|
968
|
+
* because filtering lives in the header's filter button.
|
|
969
|
+
*
|
|
970
|
+
* Backend limits are the only page choices kept: `sortable: false` marks a column the server
|
|
971
|
+
* cannot sort (its sort indicator is hidden), and with `server` set, `filter: false` marks a
|
|
972
|
+
* column the server cannot filter (its filter button is hidden). Control columns keep their
|
|
973
|
+
* own width, pinning and lock settings.
|
|
974
|
+
*/
|
|
975
|
+
function mtStandardColumns(columns, options = {}) {
|
|
976
|
+
return columns.map((column) => 'children' in column
|
|
977
|
+
? standardGroup(column, options)
|
|
978
|
+
: standardColumn(column, options));
|
|
979
|
+
}
|
|
980
|
+
function standardGroup(group, options) {
|
|
981
|
+
return { ...group, children: mtStandardColumns(group.children, options) };
|
|
982
|
+
}
|
|
983
|
+
function standardColumn(column, options) {
|
|
984
|
+
const header = {
|
|
985
|
+
...column,
|
|
986
|
+
};
|
|
987
|
+
delete header.headerRenderer;
|
|
988
|
+
delete header.headerRendererParams;
|
|
989
|
+
if (mtIsControlColumn(column))
|
|
990
|
+
return {
|
|
991
|
+
...header,
|
|
992
|
+
sortable: false,
|
|
993
|
+
filter: false,
|
|
994
|
+
floatingFilter: false,
|
|
995
|
+
suppressHeaderMenuButton: false,
|
|
996
|
+
suppressHeaderFilterButton: true,
|
|
997
|
+
};
|
|
998
|
+
return {
|
|
999
|
+
...header,
|
|
1000
|
+
sortable: column.sortable !== false,
|
|
1001
|
+
resizable: true,
|
|
1002
|
+
suppressMovable: false,
|
|
1003
|
+
filter: column.filter === false && options.server
|
|
1004
|
+
? false
|
|
1005
|
+
: column.filter === undefined || column.filter === false
|
|
1006
|
+
? true
|
|
1007
|
+
: column.filter,
|
|
1008
|
+
floatingFilter: false,
|
|
1009
|
+
suppressHeaderMenuButton: false,
|
|
1010
|
+
suppressHeaderFilterButton: false,
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
const EXPORT_FORMATS = [
|
|
1015
|
+
'csv',
|
|
1016
|
+
'excel',
|
|
1017
|
+
'pdf',
|
|
1018
|
+
];
|
|
1019
|
+
const STATUS_BAR = {
|
|
1020
|
+
panels: ['totalAndFilteredRowCount', 'selectedRowCount', 'aggregation'],
|
|
1021
|
+
};
|
|
1022
|
+
const PAGE_SIZES = [10, 20, 50, 100];
|
|
1023
|
+
function controlColumnIds(columns) {
|
|
1024
|
+
const ids = new Set();
|
|
1025
|
+
const visit = (defs) => defs.forEach((def) => {
|
|
1026
|
+
if ('children' in def)
|
|
1027
|
+
visit(def.children);
|
|
1028
|
+
else if (mtIsControlColumn(def) && def.colId)
|
|
1029
|
+
ids.add(def.colId);
|
|
1030
|
+
});
|
|
1031
|
+
visit(columns);
|
|
1032
|
+
return ids;
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* The one standard grid for product pages (user decision 2026-11-03). Every page that shows
|
|
1036
|
+
* the new grid renders this component, so every grid has the same header (sort, menu and
|
|
1037
|
+
* filter on every data column; the menu only on control columns), the same geometry, the same
|
|
1038
|
+
* top strip (group panel, quick filter, pivot zone while pivoting), the same Columns and
|
|
1039
|
+
* Filters side bar, status bar, pager, context menu, CSV/Excel export and charts.
|
|
1040
|
+
*
|
|
1041
|
+
* A page supplies data, entity columns, the row id, permissions and behaviour hooks only;
|
|
1042
|
+
* there is deliberately no input for header templates, heights or feature toggles.
|
|
1043
|
+
*/
|
|
1044
|
+
class MtStandardGridComponent {
|
|
1045
|
+
text = inject(MtTableText);
|
|
1046
|
+
printService = inject(TableExportService);
|
|
1047
|
+
rows = input.required(...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
1048
|
+
columns = input.required(...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
1049
|
+
/** Row id; local tables without ids get a stable id per row object. */
|
|
1050
|
+
rowId = input((row) => this.identity(row), ...(ngDevMode ? [{ debugName: "rowId" }] : /* istanbul ignore next */ []));
|
|
1051
|
+
/** Accessible name of the grid. */
|
|
1052
|
+
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1053
|
+
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
1054
|
+
/** Grid height in px, or `'auto'` to grow with its rows (the page layout decides). */
|
|
1055
|
+
height = input(560, ...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
|
|
1056
|
+
/** Row checkboxes with the header select-all. */
|
|
1057
|
+
selection = input(false, ...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
1058
|
+
/** Export permission: the CSV, Excel and PDF items of the context menu. */
|
|
1059
|
+
exportable = input(true, ...(ngDevMode ? [{ debugName: "exportable" }] : /* istanbul ignore next */ []));
|
|
1060
|
+
exportName = input('export', ...(ngDevMode ? [{ debugName: "exportName" }] : /* istanbul ignore next */ []));
|
|
1061
|
+
/** The formats the Export menu offers (a narrower export permission). */
|
|
1062
|
+
exportFormats = input(EXPORT_FORMATS, ...(ngDevMode ? [{ debugName: "exportFormats" }] : /* istanbul ignore next */ []));
|
|
1063
|
+
/**
|
|
1064
|
+
* An owner-run export that replaces the grid's own, e.g. a server export of rows the grid
|
|
1065
|
+
* has not loaded. The menu stays the standard one.
|
|
1066
|
+
*/
|
|
1067
|
+
exporter = input(null, ...(ngDevMode ? [{ debugName: "exporter" }] : /* istanbul ignore next */ []));
|
|
1068
|
+
/** Page-specific row actions, appended to the standard context menu of a data row. */
|
|
1069
|
+
rowMenuItems = input(null, ...(ngDevMode ? [{ debugName: "rowMenuItems" }] : /* istanbul ignore next */ []));
|
|
1070
|
+
/** Server paging; sorting, filtering and paging then belong to the owner (external data). */
|
|
1071
|
+
server = input(null, ...(ngDevMode ? [{ debugName: "server" }] : /* istanbul ignore next */ []));
|
|
1072
|
+
/** The pager. A page whose grid scrolls every row inside its own viewport turns it off. */
|
|
1073
|
+
paged = input(true, ...(ngDevMode ? [{ debugName: "paged" }] : /* istanbul ignore next */ []));
|
|
1074
|
+
/** A detail row under expandable rows. */
|
|
1075
|
+
detail = input(null, ...(ngDevMode ? [{ debugName: "detail" }] : /* istanbul ignore next */ []));
|
|
1076
|
+
/** Where the grid sits (e.g. a record path), shown in chart titles; defaults to the label. */
|
|
1077
|
+
chartContext = input(null, ...(ngDevMode ? [{ debugName: "chartContext" }] : /* istanbul ignore next */ []));
|
|
1078
|
+
/** Quick-filter text shown in the top strip (a restored search term). */
|
|
1079
|
+
search = input('', ...(ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []));
|
|
1080
|
+
/** The standard empty state's text; without a title the grid's own no-rows line shows. */
|
|
1081
|
+
emptyTitle = input(null, ...(ngDevMode ? [{ debugName: "emptyTitle" }] : /* istanbul ignore next */ []));
|
|
1082
|
+
emptyDescription = input(null, ...(ngDevMode ? [{ debugName: "emptyDescription" }] : /* istanbul ignore next */ []));
|
|
1083
|
+
/** A saved view applied once when the grid is ready. */
|
|
1084
|
+
view = input(null, ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
1085
|
+
gridReady = output();
|
|
1086
|
+
rowClicked = output();
|
|
1087
|
+
selectionChanged = output();
|
|
1088
|
+
sortChanged = output();
|
|
1089
|
+
filterChanged = output();
|
|
1090
|
+
paginationChanged = output();
|
|
1091
|
+
rowGroupOpened = output();
|
|
1092
|
+
/** The captured view after any column, sort, filter or grouping change (persist it per user). */
|
|
1093
|
+
viewChanged = output();
|
|
1094
|
+
/** A chart was opened, changed or closed (persist the chart session). */
|
|
1095
|
+
chartsChanged = output();
|
|
1096
|
+
/** Fixed height in px; in `'auto'` mode the grid sizes itself and this is its fallback. */
|
|
1097
|
+
gridHeight = computed(() => {
|
|
1098
|
+
const height = this.height();
|
|
1099
|
+
return height === 'auto' ? 400 : height;
|
|
1100
|
+
}, ...(ngDevMode ? [{ debugName: "gridHeight" }] : /* istanbul ignore next */ []));
|
|
1101
|
+
standardColumns = computed(() => mtStandardColumns(this.columns(), { server: this.server() !== null }), ...(ngDevMode ? [{ debugName: "standardColumns" }] : /* istanbul ignore next */ []));
|
|
1102
|
+
/** A server page keeps the server's group order; the server supplies the group counts. */
|
|
1103
|
+
serverGroups = computed(() => this.server() !== null, ...(ngDevMode ? [{ debugName: "serverGroups" }] : /* istanbul ignore next */ []));
|
|
1104
|
+
autoGroupColumnDef = computed(() => this.serverGroups()
|
|
1105
|
+
? { cellRendererParams: { suppressCount: true } }
|
|
1106
|
+
: undefined, ...(ngDevMode ? [{ debugName: "autoGroupColumnDef" }] : /* istanbul ignore next */ []));
|
|
1107
|
+
direction = computed(() => this.text.language().startsWith('ar') ? 'rtl' : 'ltr', ...(ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []));
|
|
1108
|
+
sideBar = computed(() => ({
|
|
1109
|
+
toolPanels: ['columns', 'filters'],
|
|
1110
|
+
position: this.direction() === 'rtl' ? 'left' : 'right',
|
|
1111
|
+
}), ...(ngDevMode ? [{ debugName: "sideBar" }] : /* istanbul ignore next */ []));
|
|
1112
|
+
selectionOptions = computed(() => this.selection()
|
|
1113
|
+
? {
|
|
1114
|
+
mode: 'multiRow',
|
|
1115
|
+
headerCheckbox: true,
|
|
1116
|
+
enableClickSelection: false,
|
|
1117
|
+
selectAll: 'filtered',
|
|
1118
|
+
}
|
|
1119
|
+
: undefined, ...(ngDevMode ? [{ debugName: "selectionOptions" }] : /* istanbul ignore next */ []));
|
|
1120
|
+
exportParams = computed(() => ({
|
|
1121
|
+
fileName: this.exportName(),
|
|
1122
|
+
processCellCallback: (mtEntityExportValue),
|
|
1123
|
+
}), ...(ngDevMode ? [{ debugName: "exportParams" }] : /* istanbul ignore next */ []));
|
|
1124
|
+
// Template `?.` yields null; the grid needs undefined for client-side paging.
|
|
1125
|
+
pageSize = computed(() => this.server()?.pageSize ?? 20, ...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
|
|
1126
|
+
serverTotal = computed(() => this.server()?.total, ...(ngDevMode ? [{ debugName: "serverTotal" }] : /* istanbul ignore next */ []));
|
|
1127
|
+
serverPage = computed(() => this.server()?.page, ...(ngDevMode ? [{ debugName: "serverPage" }] : /* istanbul ignore next */ []));
|
|
1128
|
+
pagedTotal = computed(() => this.paged() ? this.serverTotal() : undefined, ...(ngDevMode ? [{ debugName: "pagedTotal" }] : /* istanbul ignore next */ []));
|
|
1129
|
+
pagedPage = computed(() => this.paged() ? this.serverPage() : undefined, ...(ngDevMode ? [{ debugName: "pagedPage" }] : /* istanbul ignore next */ []));
|
|
1130
|
+
detailRenderer = computed(() => this.detail()?.renderer, ...(ngDevMode ? [{ debugName: "detailRenderer" }] : /* istanbul ignore next */ []));
|
|
1131
|
+
detailParams = computed(() => this.detail()?.params, ...(ngDevMode ? [{ debugName: "detailParams" }] : /* istanbul ignore next */ []));
|
|
1132
|
+
isRowMaster = computed(() => this.detail()?.isRowMaster, ...(ngDevMode ? [{ debugName: "isRowMaster" }] : /* istanbul ignore next */ []));
|
|
1133
|
+
chartTitle = computed(() => this.chartContext() ?? this.label(), ...(ngDevMode ? [{ debugName: "chartTitle" }] : /* istanbul ignore next */ []));
|
|
1134
|
+
csvAllowed = computed(() => this.exportable() && this.exportFormats().includes('csv'), ...(ngDevMode ? [{ debugName: "csvAllowed" }] : /* istanbul ignore next */ []));
|
|
1135
|
+
excelAllowed = computed(() => this.exportable() && this.exportFormats().includes('excel'), ...(ngDevMode ? [{ debugName: "excelAllowed" }] : /* istanbul ignore next */ []));
|
|
1136
|
+
statusBar = STATUS_BAR;
|
|
1137
|
+
pageSizes = PAGE_SIZES;
|
|
1138
|
+
fit = { type: 'fitGridWidth' };
|
|
1139
|
+
api = null;
|
|
1140
|
+
identities = new WeakMap();
|
|
1141
|
+
nextIdentity = 0;
|
|
1142
|
+
identity(row) {
|
|
1143
|
+
const key = row;
|
|
1144
|
+
let id = this.identities.get(key);
|
|
1145
|
+
if (!id)
|
|
1146
|
+
this.identities.set(key, (id = `row-${this.nextIdentity++}`));
|
|
1147
|
+
return id;
|
|
1148
|
+
}
|
|
1149
|
+
applyingView = false;
|
|
1150
|
+
onReady(event) {
|
|
1151
|
+
this.api = event.api;
|
|
1152
|
+
const view = untracked(this.view);
|
|
1153
|
+
if (view) {
|
|
1154
|
+
this.applyingView = true;
|
|
1155
|
+
try {
|
|
1156
|
+
applyGridViewState(event.api, view);
|
|
1157
|
+
}
|
|
1158
|
+
finally {
|
|
1159
|
+
this.applyingView = false;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
this.gridReady.emit(event);
|
|
1163
|
+
}
|
|
1164
|
+
onViewChange() {
|
|
1165
|
+
if (!this.api || this.applyingView)
|
|
1166
|
+
return;
|
|
1167
|
+
this.viewChanged.emit(captureGridViewState(this.api));
|
|
1168
|
+
}
|
|
1169
|
+
onRowClicked(event) {
|
|
1170
|
+
if (event.node.data !== undefined)
|
|
1171
|
+
this.rowClicked.emit(event.node.data);
|
|
1172
|
+
}
|
|
1173
|
+
onSelectionChanged(event) {
|
|
1174
|
+
this.selectionChanged.emit(event.selectedNodes.flatMap((node) => node.data === undefined ? [] : [node.data]));
|
|
1175
|
+
}
|
|
1176
|
+
leafColumns = computed(() => {
|
|
1177
|
+
const leaves = [];
|
|
1178
|
+
const visit = (defs) => defs.forEach((def) => 'children' in def ? visit(def.children) : leaves.push(def));
|
|
1179
|
+
visit(this.standardColumns());
|
|
1180
|
+
return leaves;
|
|
1181
|
+
}, ...(ngDevMode ? [{ debugName: "leafColumns" }] : /* istanbul ignore next */ []));
|
|
1182
|
+
/** The standard context menu: default items, an Export submenu, then the page's row items. */
|
|
1183
|
+
contextMenu = (params) => {
|
|
1184
|
+
const controls = controlColumnIds(this.columns());
|
|
1185
|
+
const columnKeys = [
|
|
1186
|
+
...(params.api.getRowGroupColumns().length ? [AUTO_GROUP_COLUMN_ID] : []),
|
|
1187
|
+
...(params.api.getPivotResultColumns().length
|
|
1188
|
+
? params.api.getPivotResultColumns()
|
|
1189
|
+
: params.api
|
|
1190
|
+
.getColumnState()
|
|
1191
|
+
.filter((column) => !column.hide && !controls.has(column.colId))
|
|
1192
|
+
.map((column) => column.colId)),
|
|
1193
|
+
];
|
|
1194
|
+
const items = params.defaultItems.flatMap((item) => {
|
|
1195
|
+
if (item === 'pdfExport')
|
|
1196
|
+
return [];
|
|
1197
|
+
if (item !== 'export')
|
|
1198
|
+
return [item];
|
|
1199
|
+
const formats = this.exportFormats();
|
|
1200
|
+
if (!this.exportable() || formats.length === 0)
|
|
1201
|
+
return [];
|
|
1202
|
+
const exporter = this.exporter();
|
|
1203
|
+
const clientExport = {
|
|
1204
|
+
csv: () => params.api.exportDataAsCsv({ ...this.exportParams(), columnKeys }),
|
|
1205
|
+
excel: () => {
|
|
1206
|
+
void params.api.exportDataAsExcel({
|
|
1207
|
+
...this.exportParams(),
|
|
1208
|
+
columnKeys,
|
|
1209
|
+
});
|
|
1210
|
+
},
|
|
1211
|
+
pdf: () => this.printService.printPdf(mtTablePrintConfiguration(params.api, this.leafColumns().filter((column) => !controls.has(column.colId ?? '')), this.exportName())),
|
|
1212
|
+
};
|
|
1213
|
+
return [
|
|
1214
|
+
{
|
|
1215
|
+
name: this.text.text('export'),
|
|
1216
|
+
icon: 'export',
|
|
1217
|
+
subMenu: formats.map((format) => ({
|
|
1218
|
+
name: this.text.text(format),
|
|
1219
|
+
icon: format,
|
|
1220
|
+
action: exporter ? () => exporter(format) : clientExport[format],
|
|
1221
|
+
})),
|
|
1222
|
+
},
|
|
1223
|
+
];
|
|
1224
|
+
});
|
|
1225
|
+
const row = params.node?.data;
|
|
1226
|
+
const rowItems = row !== undefined && this.rowMenuItems() ? this.rowMenuItems()(row) : [];
|
|
1227
|
+
return rowItems.length ? [...items, 'separator', ...rowItems] : items;
|
|
1228
|
+
};
|
|
1229
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtStandardGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1230
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: MtStandardGridComponent, isStandalone: true, selector: "mt-standard-grid", inputs: { rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: true, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, rowId: { classPropertyName: "rowId", publicName: "rowId", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, exportable: { classPropertyName: "exportable", publicName: "exportable", isSignal: true, isRequired: false, transformFunction: null }, exportName: { classPropertyName: "exportName", publicName: "exportName", isSignal: true, isRequired: false, transformFunction: null }, exportFormats: { classPropertyName: "exportFormats", publicName: "exportFormats", isSignal: true, isRequired: false, transformFunction: null }, exporter: { classPropertyName: "exporter", publicName: "exporter", isSignal: true, isRequired: false, transformFunction: null }, rowMenuItems: { classPropertyName: "rowMenuItems", publicName: "rowMenuItems", isSignal: true, isRequired: false, transformFunction: null }, server: { classPropertyName: "server", publicName: "server", isSignal: true, isRequired: false, transformFunction: null }, paged: { classPropertyName: "paged", publicName: "paged", isSignal: true, isRequired: false, transformFunction: null }, detail: { classPropertyName: "detail", publicName: "detail", isSignal: true, isRequired: false, transformFunction: null }, chartContext: { classPropertyName: "chartContext", publicName: "chartContext", isSignal: true, isRequired: false, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: true, isRequired: false, transformFunction: null }, emptyTitle: { classPropertyName: "emptyTitle", publicName: "emptyTitle", isSignal: true, isRequired: false, transformFunction: null }, emptyDescription: { classPropertyName: "emptyDescription", publicName: "emptyDescription", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { gridReady: "gridReady", rowClicked: "rowClicked", selectionChanged: "selectionChanged", sortChanged: "sortChanged", filterChanged: "filterChanged", paginationChanged: "paginationChanged", rowGroupOpened: "rowGroupOpened", viewChanged: "viewChanged", chartsChanged: "chartsChanged" }, ngImport: i0, template: "<div class=\"mt-standard-grid\">\n <div class=\"mt-standard-grid-toolbar\">\n <ng-content select=\"[mtGridToolbar]\" />\n </div>\n <mt-data-grid\n [rowData]=\"rows()\"\n [columnDefs]=\"standardColumns()\"\n [getRowId]=\"rowId()\"\n [dataProcessing]=\"server() ? 'external' : 'client'\"\n [height]=\"gridHeight()\"\n [autoHeight]=\"height() === 'auto'\"\n [autoSizeStrategy]=\"fit\"\n [ariaLabel]=\"label()\"\n [loading]=\"loading()\"\n [direction]=\"direction()\"\n [localeText]=\"text.gridLocale()\"\n [showQuickFilter]=\"true\"\n [quickFilterText]=\"search()\"\n rowGroupPanelShow=\"always\"\n pivotPanelShow=\"onlyWhenPivoting\"\n [sideBar]=\"sideBar()\"\n [statusBar]=\"statusBar\"\n [rowSelection]=\"selectionOptions()\"\n [cellSelection]=\"true\"\n [enableCharts]=\"!server()\"\n [chartContext]=\"chartTitle()\"\n [chartRecordsLabel]=\"label()\"\n [animateRows]=\"true\"\n [suppressCutToClipboard]=\"true\"\n [suppressCsvExport]=\"!csvAllowed()\"\n [suppressExcelExport]=\"!excelAllowed()\"\n [suppressPdfExport]=\"true\"\n [defaultCsvExportParams]=\"exportParams()\"\n [defaultExcelExportParams]=\"exportParams()\"\n [getContextMenuItems]=\"contextMenu\"\n groupDisplayType=\"groupRows\"\n [groupMaintainOrder]=\"serverGroups()\"\n [autoGroupColumnDef]=\"autoGroupColumnDef()\"\n [groupDefaultExpanded]=\"-1\"\n [pagination]=\"paged()\"\n paginationPanelShow=\"whenNeeded\"\n [paginationPageSize]=\"pageSize()\"\n [paginationPageSizeSelector]=\"pageSizes\"\n [paginationTotalRows]=\"pagedTotal()\"\n [paginationCurrentPage]=\"pagedPage()\"\n [masterDetail]=\"detail() !== null\"\n [detailCellRenderer]=\"detailRenderer()\"\n [detailCellRendererParams]=\"detailParams()\"\n [detailRowAutoHeight]=\"true\"\n [isRowMaster]=\"isRowMaster()\"\n [noRowsTemplate]=\"emptyTitle() ? emptyState : undefined\"\n (gridReady)=\"onReady($event)\"\n (rowClicked)=\"onRowClicked($event)\"\n (selectionChanged)=\"onSelectionChanged($event)\"\n (sortChanged)=\"sortChanged.emit($event); onViewChange()\"\n (filterChanged)=\"filterChanged.emit($event); onViewChange()\"\n (paginationChanged)=\"paginationChanged.emit($event)\"\n (rowGroupOpened)=\"rowGroupOpened.emit($event)\"\n (chartCreated)=\"chartsChanged.emit()\"\n (chartDestroyed)=\"chartsChanged.emit()\"\n (chartOptionsChanged)=\"chartsChanged.emit()\"\n (columnRowGroupChanged)=\"onViewChange()\"\n (columnValueChanged)=\"onViewChange()\"\n (columnPivotChanged)=\"onViewChange()\"\n (columnPivotModeChanged)=\"onViewChange()\"\n (columnMoved)=\"onViewChange()\"\n (columnPinned)=\"onViewChange()\"\n (columnVisible)=\"onViewChange()\"\n (columnResized)=\"$event.finished && onViewChange()\"\n />\n</div>\n<ng-template #emptyState>\n <mt-empty-state\n [title]=\"emptyTitle() ?? ''\"\n [description]=\"emptyDescription() ?? ''\"\n />\n</ng-template>\n", styles: [":host{display:block}.mt-standard-grid{display:flex;flex-direction:column;gap:12px}.mt-standard-grid-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px}.mt-standard-grid-toolbar:empty{display:none}\n"], dependencies: [{ kind: "component", type: MtDataGridComponent, selector: "mt-data-grid", inputs: ["rowData", "dataProcessing", "columnDefs", "getRowId", "height", "autoHeight", "autoHeightMaxRows", "autoHeightMinRows", "rowHeight", "animateRows", "headerHeight", "groupHeaderHeight", "direction", "localeText", "localeTextResolver", "ariaLabel", "loading", "noRowsText", "loadingText", "noRowsTemplate", "autoSizeStrategy", "columnMenu", "mainMenuItems", "autoSizePadding", "quickFilterText", "showQuickFilter", "includeHiddenColumnsInQuickFilter", "quickFilterParser", "quickFilterMatcher", "cacheQuickFilter", "applyQuickFilterBeforePivotOrAgg", "filtersToolPanelDef", "isExternalFilterPresent", "doesExternalFilterPass", "floatingFiltersHeight", "rowSelection", "selectionColumnDef", "rowNumbers", "rowDragManaged", "rowDragEntireRow", "rowDragMultiRow", "suppressMoveWhenRowDragging", "cellSelection", "statusBar", "suppressContextMenu", "allowContextMenuWithControlKey", "preventDefaultOnContextMenu", "getContextMenuItems", "suppressCsvExport", "suppressExcelExport", "suppressPdfExport", "defaultPdfExportParams", "excelStyles", "processCellForClipboard", "processHeaderForClipboard", "processGroupHeaderForClipboard", "copySelectedRows", "copyHeadersToClipboard", "copyGroupHeadersToClipboard", "clipboardDelimiter", "suppressCopyRowsToClipboard", "suppressCopySingleCellRanges", "suppressCutToClipboard", "defaultCsvExportParams", "defaultExcelExportParams", "groupDisplayType", "groupRowRenderer", "groupRowRendererParams", "suppressGroupRowsSticky", "groupHideOpenParents", "groupHideParentOfSingleChild", "groupRemoveSingleChildren", "groupRemoveLowestSingleChildren", "showOpenedGroup", "groupAggFiltering", "suppressAggFilteredOnly", "aggregateOnlyChangedColumns", "suppressColumnMoveAnimation", "pivotRowTotals", "pivotColumnGroupTotals", "pivotMaxGeneratedColumns", "pivotDefaultExpanded", "pivotSuppressAutoColumn", "suppressExpandablePivotGroups", "processPivotResultColDef", "processPivotResultColGroupDef", "processUnpinnedColumns", "rowGroupPanelShow", "pivotPanelShow", "pivotPanelHint", "groupDefaultExpanded", "autoGroupColumnDef", "groupTotalRow", "grandTotalRow", "aggFuncs", "suppressRowGroupHidesColumns", "suppressMakeColumnVisibleAfterUnGroup", "sideBar", "pivotMode", "suppressAggFuncInHeader", "enableCharts", "chartThemes", "customChartThemes", "chartToolPanelsDef", "chartThemeOverrides", "chartContext", "chartRecordsLabel", "getChartToolbarItems", "groupMaintainOrder", "treeData", "getDataPath", "masterDetail", "isRowMaster", "detailCellRenderer", "detailCellRendererParams", "detailRowHeight", "detailRowAutoHeight", "singleClickEdit", "suppressClickEdit", "stopEditingWhenCellsLoseFocus", "undoRedoCellEditing", "undoRedoCellEditingLimit", "pagination", "paginationPanelShow", "paginationPageSize", "paginationTotalRows", "paginationCurrentPage", "paginationPageSizeSelector", "rowGroupPanelSuppressSort"], outputs: ["displayedColumnsChanged", "columnEverythingChanged", "pivotMaxColumnsExceeded", "gridReady", "sortChanged", "cellFocused", "columnResized", "columnMoved", "columnPinned", "columnVisible", "columnGroupOpened", "filterChanged", "filterModified", "filterOpened", "rowSelected", "selectionChanged", "rowClicked", "rowDragEnter", "rowDragMove", "rowDragLeave", "rowDragEnd", "cellSelectionChanged", "contextMenuVisibleChanged", "rowGroupOpened", "columnRowGroupChanged", "expandOrCollapseAll", "cellEditingStarted", "cellEditingStopped", "cellValueChanged", "pasteStart", "pasteEnd", "fillStart", "fillEnd", "paginationChanged", "toolPanelVisibleChanged", "toolPanelSizeChanged", "columnValueChanged", "columnPivotChanged", "columnPivotModeChanged", "chartCreated", "chartDestroyed", "chartRangeSelectionChanged", "chartOptionsChanged"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1231
|
+
}
|
|
1232
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtStandardGridComponent, decorators: [{
|
|
1233
|
+
type: Component,
|
|
1234
|
+
args: [{ selector: 'mt-standard-grid', imports: [MtDataGridComponent, EmptyState], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mt-standard-grid\">\n <div class=\"mt-standard-grid-toolbar\">\n <ng-content select=\"[mtGridToolbar]\" />\n </div>\n <mt-data-grid\n [rowData]=\"rows()\"\n [columnDefs]=\"standardColumns()\"\n [getRowId]=\"rowId()\"\n [dataProcessing]=\"server() ? 'external' : 'client'\"\n [height]=\"gridHeight()\"\n [autoHeight]=\"height() === 'auto'\"\n [autoSizeStrategy]=\"fit\"\n [ariaLabel]=\"label()\"\n [loading]=\"loading()\"\n [direction]=\"direction()\"\n [localeText]=\"text.gridLocale()\"\n [showQuickFilter]=\"true\"\n [quickFilterText]=\"search()\"\n rowGroupPanelShow=\"always\"\n pivotPanelShow=\"onlyWhenPivoting\"\n [sideBar]=\"sideBar()\"\n [statusBar]=\"statusBar\"\n [rowSelection]=\"selectionOptions()\"\n [cellSelection]=\"true\"\n [enableCharts]=\"!server()\"\n [chartContext]=\"chartTitle()\"\n [chartRecordsLabel]=\"label()\"\n [animateRows]=\"true\"\n [suppressCutToClipboard]=\"true\"\n [suppressCsvExport]=\"!csvAllowed()\"\n [suppressExcelExport]=\"!excelAllowed()\"\n [suppressPdfExport]=\"true\"\n [defaultCsvExportParams]=\"exportParams()\"\n [defaultExcelExportParams]=\"exportParams()\"\n [getContextMenuItems]=\"contextMenu\"\n groupDisplayType=\"groupRows\"\n [groupMaintainOrder]=\"serverGroups()\"\n [autoGroupColumnDef]=\"autoGroupColumnDef()\"\n [groupDefaultExpanded]=\"-1\"\n [pagination]=\"paged()\"\n paginationPanelShow=\"whenNeeded\"\n [paginationPageSize]=\"pageSize()\"\n [paginationPageSizeSelector]=\"pageSizes\"\n [paginationTotalRows]=\"pagedTotal()\"\n [paginationCurrentPage]=\"pagedPage()\"\n [masterDetail]=\"detail() !== null\"\n [detailCellRenderer]=\"detailRenderer()\"\n [detailCellRendererParams]=\"detailParams()\"\n [detailRowAutoHeight]=\"true\"\n [isRowMaster]=\"isRowMaster()\"\n [noRowsTemplate]=\"emptyTitle() ? emptyState : undefined\"\n (gridReady)=\"onReady($event)\"\n (rowClicked)=\"onRowClicked($event)\"\n (selectionChanged)=\"onSelectionChanged($event)\"\n (sortChanged)=\"sortChanged.emit($event); onViewChange()\"\n (filterChanged)=\"filterChanged.emit($event); onViewChange()\"\n (paginationChanged)=\"paginationChanged.emit($event)\"\n (rowGroupOpened)=\"rowGroupOpened.emit($event)\"\n (chartCreated)=\"chartsChanged.emit()\"\n (chartDestroyed)=\"chartsChanged.emit()\"\n (chartOptionsChanged)=\"chartsChanged.emit()\"\n (columnRowGroupChanged)=\"onViewChange()\"\n (columnValueChanged)=\"onViewChange()\"\n (columnPivotChanged)=\"onViewChange()\"\n (columnPivotModeChanged)=\"onViewChange()\"\n (columnMoved)=\"onViewChange()\"\n (columnPinned)=\"onViewChange()\"\n (columnVisible)=\"onViewChange()\"\n (columnResized)=\"$event.finished && onViewChange()\"\n />\n</div>\n<ng-template #emptyState>\n <mt-empty-state\n [title]=\"emptyTitle() ?? ''\"\n [description]=\"emptyDescription() ?? ''\"\n />\n</ng-template>\n", styles: [":host{display:block}.mt-standard-grid{display:flex;flex-direction:column;gap:12px}.mt-standard-grid-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px}.mt-standard-grid-toolbar:empty{display:none}\n"] }]
|
|
1235
|
+
}], propDecorators: { rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: true }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], rowId: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowId", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], exportable: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportable", required: false }] }], exportName: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportName", required: false }] }], exportFormats: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportFormats", required: false }] }], exporter: [{ type: i0.Input, args: [{ isSignal: true, alias: "exporter", required: false }] }], rowMenuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowMenuItems", required: false }] }], server: [{ type: i0.Input, args: [{ isSignal: true, alias: "server", required: false }] }], paged: [{ type: i0.Input, args: [{ isSignal: true, alias: "paged", required: false }] }], detail: [{ type: i0.Input, args: [{ isSignal: true, alias: "detail", required: false }] }], chartContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "chartContext", required: false }] }], search: [{ type: i0.Input, args: [{ isSignal: true, alias: "search", required: false }] }], emptyTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyTitle", required: false }] }], emptyDescription: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyDescription", required: false }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], gridReady: [{ type: i0.Output, args: ["gridReady"] }], rowClicked: [{ type: i0.Output, args: ["rowClicked"] }], selectionChanged: [{ type: i0.Output, args: ["selectionChanged"] }], sortChanged: [{ type: i0.Output, args: ["sortChanged"] }], filterChanged: [{ type: i0.Output, args: ["filterChanged"] }], paginationChanged: [{ type: i0.Output, args: ["paginationChanged"] }], rowGroupOpened: [{ type: i0.Output, args: ["rowGroupOpened"] }], viewChanged: [{ type: i0.Output, args: ["viewChanged"] }], chartsChanged: [{ type: i0.Output, args: ["chartsChanged"] }] } });
|
|
1236
|
+
|
|
1237
|
+
/** The standard row-actions column id. */
|
|
1238
|
+
const MT_ACTIONS_COLUMN_ID = '$actions';
|
|
1239
|
+
/**
|
|
1240
|
+
* The standard row-actions cell: inline buttons, or a ⋮ menu for `shape: 'popover'`, with the
|
|
1241
|
+
* action's confirmation popup. The page owns the operations; the grid only hosts the cell.
|
|
1242
|
+
*/
|
|
1243
|
+
class MtActionsCell {
|
|
1244
|
+
params = input.required(...(ngDevMode ? [{ debugName: "params" }] : /* istanbul ignore next */ []));
|
|
1245
|
+
confirmation = inject(ConfirmationService);
|
|
1246
|
+
label = computed(() => String(this.params()['label']), ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1247
|
+
actions = computed(() => {
|
|
1248
|
+
const { data, node } = this.params();
|
|
1249
|
+
return data && !node.group && !node.footer
|
|
1250
|
+
? this.params()['actions'].filter((action) => !action.hidden?.(data))
|
|
1251
|
+
: [];
|
|
1252
|
+
}, ...(ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []));
|
|
1253
|
+
inline = computed(() => this.actions().filter((action) => this.params()['shape'] !== 'popover' || action.placement === 'inline'), ...(ngDevMode ? [{ debugName: "inline" }] : /* istanbul ignore next */ []));
|
|
1254
|
+
menu = computed(() => this.actions().filter((action) => this.params()['shape'] === 'popover' && action.placement !== 'inline'), ...(ngDevMode ? [{ debugName: "menu" }] : /* istanbul ignore next */ []));
|
|
1255
|
+
hasMenu = computed(() => !this.params().node.group &&
|
|
1256
|
+
!this.params().node.footer &&
|
|
1257
|
+
this.params()['shape'] === 'popover' &&
|
|
1258
|
+
(!!this.params()['requestActions'] || this.menu().length > 0), ...(ngDevMode ? [{ debugName: "hasMenu" }] : /* istanbul ignore next */ []));
|
|
1259
|
+
loading() {
|
|
1260
|
+
return (this.params()['loading']?.(this.params().data) ?? false);
|
|
1261
|
+
}
|
|
1262
|
+
busy(action) {
|
|
1263
|
+
return typeof action.loading === 'function'
|
|
1264
|
+
? action.loading(this.params().data)
|
|
1265
|
+
: !!action.loading;
|
|
1266
|
+
}
|
|
1267
|
+
open(event, popover) {
|
|
1268
|
+
this.params()['requestActions']?.(this.params().data);
|
|
1269
|
+
popover.toggle(event);
|
|
1270
|
+
}
|
|
1271
|
+
run(action, event) {
|
|
1272
|
+
const row = this.params().data;
|
|
1273
|
+
if (action.hidden?.(row) || this.busy(action) || this.loading())
|
|
1274
|
+
return;
|
|
1275
|
+
const accept = () => {
|
|
1276
|
+
if (!action.hidden?.(row) && !this.busy(action) && !this.loading())
|
|
1277
|
+
action.action(row);
|
|
1278
|
+
};
|
|
1279
|
+
if (!action.confirmation) {
|
|
1280
|
+
accept();
|
|
1281
|
+
return;
|
|
1282
|
+
}
|
|
1283
|
+
const config = { ...action.confirmation, event, accept };
|
|
1284
|
+
if (action.confirmation.confirmationType === 'delete')
|
|
1285
|
+
this.confirmation.confirmDelete(config);
|
|
1286
|
+
else
|
|
1287
|
+
this.confirmation.confirm(config);
|
|
1288
|
+
}
|
|
1289
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtActionsCell, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1290
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: MtActionsCell, isStandalone: true, selector: "mt-actions-cell", inputs: { params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "$event.stopPropagation()", "pointerdown": "$event.stopPropagation()" } }, ngImport: i0, template: "@for (action of inline(); track $index) {\n <mt-button\n [icon]=\"action.icon\"\n [label]=\"action.label\"\n [ariaLabel]=\"action.tooltip || action.label || label()\"\n [tooltip]=\"action.tooltip\"\n [severity]=\"action.color || 'secondary'\"\n [variant]=\"action.variant || 'text'\"\n size=\"small\"\n [loading]=\"busy(action)\"\n (click)=\"run(action, $event)\"\n />\n}\n@if (hasMenu()) {\n <mt-button\n icon=\"general.dots-vertical\"\n severity=\"secondary\"\n variant=\"text\"\n size=\"small\"\n [ariaLabel]=\"label()\"\n (click)=\"open($event, popover)\"\n />\n <p-popover #popover appendTo=\"body\">\n <div class=\"flex min-w-40 flex-col gap-1\" [attr.aria-label]=\"label()\">\n @if (loading()) {\n <span role=\"status\" class=\"p-2\">{{ params()[\"loadingLabel\"] }}</span>\n } @else {\n @for (action of menu(); track $index) {\n <mt-button\n [icon]=\"action.icon\"\n [label]=\"action.label || action.tooltip\"\n [severity]=\"action.color || 'secondary'\"\n variant=\"text\"\n size=\"small\"\n [loading]=\"busy(action)\"\n (click)=\"run(action, $event); popover.hide()\"\n />\n }\n }\n </div>\n </p-popover>\n}\n", styles: [":host{display:flex;align-items:center;justify-content:center;gap:4px;height:100%}\n"], dependencies: [{ kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Popover, selector: "p-popover", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions", "motionOptions"], outputs: ["onShow", "onHide"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1291
|
+
}
|
|
1292
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtActionsCell, decorators: [{
|
|
1293
|
+
type: Component,
|
|
1294
|
+
args: [{ selector: 'mt-actions-cell', imports: [Button, Popover], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1295
|
+
'(click)': '$event.stopPropagation()',
|
|
1296
|
+
'(pointerdown)': '$event.stopPropagation()',
|
|
1297
|
+
}, template: "@for (action of inline(); track $index) {\n <mt-button\n [icon]=\"action.icon\"\n [label]=\"action.label\"\n [ariaLabel]=\"action.tooltip || action.label || label()\"\n [tooltip]=\"action.tooltip\"\n [severity]=\"action.color || 'secondary'\"\n [variant]=\"action.variant || 'text'\"\n size=\"small\"\n [loading]=\"busy(action)\"\n (click)=\"run(action, $event)\"\n />\n}\n@if (hasMenu()) {\n <mt-button\n icon=\"general.dots-vertical\"\n severity=\"secondary\"\n variant=\"text\"\n size=\"small\"\n [ariaLabel]=\"label()\"\n (click)=\"open($event, popover)\"\n />\n <p-popover #popover appendTo=\"body\">\n <div class=\"flex min-w-40 flex-col gap-1\" [attr.aria-label]=\"label()\">\n @if (loading()) {\n <span role=\"status\" class=\"p-2\">{{ params()[\"loadingLabel\"] }}</span>\n } @else {\n @for (action of menu(); track $index) {\n <mt-button\n [icon]=\"action.icon\"\n [label]=\"action.label || action.tooltip\"\n [severity]=\"action.color || 'secondary'\"\n variant=\"text\"\n size=\"small\"\n [loading]=\"busy(action)\"\n (click)=\"run(action, $event); popover.hide()\"\n />\n }\n }\n </div>\n </p-popover>\n}\n", styles: [":host{display:flex;align-items:center;justify-content:center;gap:4px;height:100%}\n"] }]
|
|
1298
|
+
}], propDecorators: { params: [{ type: i0.Input, args: [{ isSignal: true, alias: "params", required: true }] }] } });
|
|
1299
|
+
/** The standard row-actions control column, pinned at the end edge (menu-only header). */
|
|
1300
|
+
function mtActionsColumn(options) {
|
|
1301
|
+
return {
|
|
1302
|
+
colId: MT_ACTIONS_COLUMN_ID,
|
|
1303
|
+
headerName: options.label,
|
|
1304
|
+
// Fits the header label and its menu button at the standard padding.
|
|
1305
|
+
width: 120,
|
|
1306
|
+
minWidth: 120,
|
|
1307
|
+
maxWidth: 120,
|
|
1308
|
+
suppressSizeToFit: true,
|
|
1309
|
+
resizable: false,
|
|
1310
|
+
pinned: options.rtl ? 'left' : 'right',
|
|
1311
|
+
lockPinned: true,
|
|
1312
|
+
lockVisible: true,
|
|
1313
|
+
excludeFromQuickFilter: true,
|
|
1314
|
+
cellRenderer: MtActionsCell,
|
|
1315
|
+
cellRendererParams: {
|
|
1316
|
+
actions: options.actions,
|
|
1317
|
+
shape: options.shape ?? 'flat',
|
|
1318
|
+
loading: options.loading ?? null,
|
|
1319
|
+
label: options.label,
|
|
1320
|
+
loadingLabel: options.loadingLabel ?? '',
|
|
1321
|
+
requestActions: options.requestActions,
|
|
1322
|
+
},
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* Renders a page's cell template (`cellRendererParams.template`) with the row as `$implicit`,
|
|
1328
|
+
* the same context mt-table gives `customCellTpl`. Group and total rows show the value text.
|
|
1329
|
+
*/
|
|
1330
|
+
class MtTemplateCell {
|
|
1331
|
+
params = input.required(...(ngDevMode ? [{ debugName: "params" }] : /* istanbul ignore next */ []));
|
|
1332
|
+
template = computed(() => this.params()['template'], ...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
1333
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtTemplateCell, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1334
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: MtTemplateCell, isStandalone: true, selector: "mt-template-cell", inputs: { params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@if (!params().node.group && !params().node.footer && template()) {\n <ng-container\n [ngTemplateOutlet]=\"template()!\"\n [ngTemplateOutletContext]=\"{ $implicit: params().data }\"\n />\n} @else {\n {{ params().valueFormatted }}\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1335
|
+
}
|
|
1336
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MtTemplateCell, decorators: [{
|
|
1337
|
+
type: Component,
|
|
1338
|
+
args: [{ selector: 'mt-template-cell', imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (!params().node.group && !params().node.footer && template()) {\n <ng-container\n [ngTemplateOutlet]=\"template()!\"\n [ngTemplateOutletContext]=\"{ $implicit: params().data }\"\n />\n} @else {\n {{ params().valueFormatted }}\n}\n" }]
|
|
1339
|
+
}], propDecorators: { params: [{ type: i0.Input, args: [{ isSignal: true, alias: "params", required: true }] }] } });
|
|
1340
|
+
|
|
1341
|
+
function isEntity(value) {
|
|
1342
|
+
return (!!value &&
|
|
1343
|
+
typeof value === 'object' &&
|
|
1344
|
+
'viewType' in value);
|
|
1345
|
+
}
|
|
1346
|
+
function width(value) {
|
|
1347
|
+
const text = value?.trim();
|
|
1348
|
+
if (!text)
|
|
1349
|
+
return undefined;
|
|
1350
|
+
const parsed = Number.parseFloat(text);
|
|
1351
|
+
if (!Number.isFinite(parsed) || parsed <= 0)
|
|
1352
|
+
return undefined;
|
|
1353
|
+
// A percentage of a typical 1200px page; px values stay as they are.
|
|
1354
|
+
return text.endsWith('%') ? parsed * 12 : parsed;
|
|
1355
|
+
}
|
|
1356
|
+
function filterType(column) {
|
|
1357
|
+
if (column.filterable === false)
|
|
1358
|
+
return false;
|
|
1359
|
+
if (column.type === 'number')
|
|
1360
|
+
return 'number';
|
|
1361
|
+
if (column.type === 'date' || column.type === 'dateTime')
|
|
1362
|
+
return 'date';
|
|
1363
|
+
if (column.type === 'boolean' || column.filterConfig?.options)
|
|
1364
|
+
return 'set';
|
|
1365
|
+
return 'text';
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* Maps mt-table column definitions onto standard-grid columns, for pages moving from
|
|
1369
|
+
* mt-table to the standard grid. Entity values (or `type: 'entity'`) become entity columns,
|
|
1370
|
+
* `customCellTpl` renders through the page's template, and `exportValue` feeds sort, filter
|
|
1371
|
+
* and export. Sorting follows the standard header; pass `sortable: false` on the mt-table
|
|
1372
|
+
* column only where the backend cannot sort it. Keys in `controls` (row actions rendered by
|
|
1373
|
+
* a template) become control columns: no value, a menu-only header, pinned at the end.
|
|
1374
|
+
*/
|
|
1375
|
+
function mtTableColumns(columns, rows, options = {}) {
|
|
1376
|
+
return columns
|
|
1377
|
+
.filter((column) => !column.filterOnly)
|
|
1378
|
+
.map((column) => options.controls?.includes(column.key)
|
|
1379
|
+
? controlColumn(column, options.rtl ?? false)
|
|
1380
|
+
: mtTableColumn(column, rows));
|
|
1381
|
+
}
|
|
1382
|
+
function controlColumn(column, rtl) {
|
|
1383
|
+
return {
|
|
1384
|
+
colId: column.key,
|
|
1385
|
+
headerName: column.label,
|
|
1386
|
+
initialWidth: width(column.width) ?? 120,
|
|
1387
|
+
minWidth: 80,
|
|
1388
|
+
pinned: rtl ? 'left' : 'right',
|
|
1389
|
+
lockPinned: true,
|
|
1390
|
+
lockVisible: true,
|
|
1391
|
+
suppressSizeToFit: true,
|
|
1392
|
+
excludeFromQuickFilter: true,
|
|
1393
|
+
cellRenderer: MtTemplateCell,
|
|
1394
|
+
cellRendererParams: { template: column.customCellTpl },
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
function mtTableColumn(column, rows) {
|
|
1398
|
+
const read = (row) => TableValueResolver.getProperty(row, column.key);
|
|
1399
|
+
const initialWidth = width(column.width);
|
|
1400
|
+
const base = {
|
|
1401
|
+
colId: column.key,
|
|
1402
|
+
headerName: column.label,
|
|
1403
|
+
...(initialWidth ? { initialWidth } : {}),
|
|
1404
|
+
minWidth: 90,
|
|
1405
|
+
...(column.sortable === false ? { sortable: false } : {}),
|
|
1406
|
+
filter: filterType(column),
|
|
1407
|
+
enableRowGroup: column.groupable !== false,
|
|
1408
|
+
...(column.align === 'end' ? { type: 'rightAligned' } : {}),
|
|
1409
|
+
valueGetter: ({ data }) => column.exportValue ? column.exportValue(data) : read(data),
|
|
1410
|
+
};
|
|
1411
|
+
if (column.customCellTpl)
|
|
1412
|
+
return {
|
|
1413
|
+
...base,
|
|
1414
|
+
cellRenderer: MtTemplateCell,
|
|
1415
|
+
cellRendererParams: { template: column.customCellTpl },
|
|
1416
|
+
};
|
|
1417
|
+
const sample = rows.map(read).find(isEntity);
|
|
1418
|
+
if (column.type === 'entity' || sample)
|
|
1419
|
+
return mtEntityColumn({
|
|
1420
|
+
...base,
|
|
1421
|
+
key: column.key,
|
|
1422
|
+
label: column.label,
|
|
1423
|
+
viewType: (sample?.viewType ?? 'Text'),
|
|
1424
|
+
entity: (row) => {
|
|
1425
|
+
const value = read(row);
|
|
1426
|
+
return isEntity(value) ? value : null;
|
|
1427
|
+
},
|
|
1428
|
+
});
|
|
1429
|
+
return base;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
448
1432
|
/**
|
|
449
1433
|
* Generated bundle index. Do not edit.
|
|
450
1434
|
*/
|
|
451
1435
|
|
|
452
|
-
export { MtDataTableEntityCell, mtEntityCategoryValues, mtEntityCellValues, mtEntityColumn, mtEntityExportValue };
|
|
1436
|
+
export { MT_ACTIONS_COLUMN_ID, MtActionsCell, MtDataTableEntityCell, MtStandardGridComponent, MtTableText, MtTemplateCell, mtActionsColumn, mtEntityCategoryValues, mtEntityCellValues, mtEntityColumn, mtEntityExportValue, mtIsControlColumn, mtStandardColumns, mtTableColumns, mtTablePrintConfiguration };
|
|
453
1437
|
//# sourceMappingURL=masterteam-data-table.mjs.map
|