@masterteam/components 0.0.265 → 0.0.267
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/assets/common.css +2 -309
- package/fesm2022/masterteam-components-avatar-text.mjs +46 -0
- package/fesm2022/masterteam-components-avatar-text.mjs.map +1 -0
- package/fesm2022/masterteam-components-avatar.mjs +50 -0
- package/fesm2022/masterteam-components-avatar.mjs.map +1 -0
- package/fesm2022/masterteam-components-breadcrumb.mjs +27 -0
- package/fesm2022/masterteam-components-breadcrumb.mjs.map +1 -0
- package/fesm2022/masterteam-components-business-fields.mjs +1907 -0
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -0
- package/fesm2022/masterteam-components-button-group.mjs +20 -0
- package/fesm2022/masterteam-components-button-group.mjs.map +1 -0
- package/fesm2022/masterteam-components-button.mjs +82 -0
- package/fesm2022/masterteam-components-button.mjs.map +1 -0
- package/fesm2022/masterteam-components-card.mjs +28 -0
- package/fesm2022/masterteam-components-card.mjs.map +1 -0
- package/fesm2022/masterteam-components-checkbox-field.mjs +92 -0
- package/fesm2022/masterteam-components-checkbox-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-chip.mjs +39 -0
- package/fesm2022/masterteam-components-chip.mjs.map +1 -0
- package/fesm2022/masterteam-components-client-page-menu.mjs +153 -0
- package/fesm2022/masterteam-components-client-page-menu.mjs.map +1 -0
- package/fesm2022/masterteam-components-client-page.mjs +413 -0
- package/fesm2022/masterteam-components-client-page.mjs.map +1 -0
- package/fesm2022/masterteam-components-color-picker-field.mjs +106 -0
- package/fesm2022/masterteam-components-color-picker-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-confirmation.mjs +98 -0
- package/fesm2022/masterteam-components-confirmation.mjs.map +1 -0
- package/fesm2022/masterteam-components-date-field.mjs +158 -0
- package/fesm2022/masterteam-components-date-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-dialog.mjs +33 -0
- package/fesm2022/masterteam-components-dialog.mjs.map +1 -0
- package/fesm2022/masterteam-components-drawer.mjs +268 -0
- package/fesm2022/masterteam-components-drawer.mjs.map +1 -0
- package/fesm2022/masterteam-components-dynamic-drawer.mjs +608 -0
- package/fesm2022/masterteam-components-dynamic-drawer.mjs.map +1 -0
- package/fesm2022/masterteam-components-editor-field.mjs +103 -0
- package/fesm2022/masterteam-components-editor-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-empty-state.mjs +53 -0
- package/fesm2022/masterteam-components-empty-state.mjs.map +1 -0
- package/fesm2022/masterteam-components-entities.mjs +2242 -0
- package/fesm2022/masterteam-components-entities.mjs.map +1 -0
- package/fesm2022/masterteam-components-field-validation.mjs +237 -0
- package/fesm2022/masterteam-components-field-validation.mjs.map +1 -0
- package/fesm2022/masterteam-components-formula.mjs +3848 -0
- package/fesm2022/masterteam-components-formula.mjs.map +1 -0
- package/fesm2022/masterteam-components-icon-field.mjs +158 -0
- package/fesm2022/masterteam-components-icon-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-list.mjs +31 -0
- package/fesm2022/masterteam-components-list.mjs.map +1 -0
- package/fesm2022/masterteam-components-location-field.mjs +607 -0
- package/fesm2022/masterteam-components-location-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-menu.mjs +135 -0
- package/fesm2022/masterteam-components-menu.mjs.map +1 -0
- package/fesm2022/masterteam-components-modal.mjs +108 -0
- package/fesm2022/masterteam-components-modal.mjs.map +1 -0
- package/fesm2022/masterteam-components-module-summary-card.mjs +34 -0
- package/fesm2022/masterteam-components-module-summary-card.mjs.map +1 -0
- package/fesm2022/masterteam-components-multi-select-field.mjs +321 -0
- package/fesm2022/masterteam-components-multi-select-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-number-field.mjs +102 -0
- package/fesm2022/masterteam-components-number-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-page-header.mjs +42 -0
- package/fesm2022/masterteam-components-page-header.mjs.map +1 -0
- package/fesm2022/masterteam-components-page.mjs +35 -0
- package/fesm2022/masterteam-components-page.mjs.map +1 -0
- package/fesm2022/masterteam-components-paginator.mjs +43 -0
- package/fesm2022/masterteam-components-paginator.mjs.map +1 -0
- package/fesm2022/masterteam-components-pick-list-field.mjs +210 -0
- package/fesm2022/masterteam-components-pick-list-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-progress.mjs +63 -0
- package/fesm2022/masterteam-components-progress.mjs.map +1 -0
- package/fesm2022/masterteam-components-property-filter-builder.mjs +386 -0
- package/fesm2022/masterteam-components-property-filter-builder.mjs.map +1 -0
- package/fesm2022/masterteam-components-radio-button-field.mjs +85 -0
- package/fesm2022/masterteam-components-radio-button-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-radio-cards-field.mjs +131 -0
- package/fesm2022/masterteam-components-radio-cards-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-radio-cards.mjs +74 -0
- package/fesm2022/masterteam-components-radio-cards.mjs.map +1 -0
- package/fesm2022/masterteam-components-runtime-action.mjs +406 -0
- package/fesm2022/masterteam-components-runtime-action.mjs.map +1 -0
- package/fesm2022/masterteam-components-select-field.mjs +415 -0
- package/fesm2022/masterteam-components-select-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-sidebar.mjs +155 -0
- package/fesm2022/masterteam-components-sidebar.mjs.map +1 -0
- package/fesm2022/masterteam-components-slider-field.mjs +128 -0
- package/fesm2022/masterteam-components-slider-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-statistic-card.mjs +42 -0
- package/fesm2022/masterteam-components-statistic-card.mjs.map +1 -0
- package/fesm2022/masterteam-components-table.mjs +3372 -0
- package/fesm2022/masterteam-components-table.mjs.map +1 -0
- package/fesm2022/masterteam-components-tabs.mjs +289 -0
- package/fesm2022/masterteam-components-tabs.mjs.map +1 -0
- package/fesm2022/masterteam-components-text-field.mjs +202 -0
- package/fesm2022/masterteam-components-text-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-textarea-field.mjs +126 -0
- package/fesm2022/masterteam-components-textarea-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-toast.mjs +80 -0
- package/fesm2022/masterteam-components-toast.mjs.map +1 -0
- package/fesm2022/masterteam-components-toggle-field.mjs +116 -0
- package/fesm2022/masterteam-components-toggle-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-tooltip.mjs +147 -0
- package/fesm2022/masterteam-components-tooltip.mjs.map +1 -0
- package/fesm2022/masterteam-components-topbar.mjs +32 -0
- package/fesm2022/masterteam-components-topbar.mjs.map +1 -0
- package/fesm2022/masterteam-components-tree.mjs +260 -0
- package/fesm2022/masterteam-components-tree.mjs.map +1 -0
- package/fesm2022/masterteam-components-treeselect-field.mjs +265 -0
- package/fesm2022/masterteam-components-treeselect-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-upload-field.mjs +846 -0
- package/fesm2022/masterteam-components-upload-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-uploader.mjs +425 -0
- package/fesm2022/masterteam-components-uploader.mjs.map +1 -0
- package/fesm2022/masterteam-components-user-search-field.mjs +374 -0
- package/fesm2022/masterteam-components-user-search-field.mjs.map +1 -0
- package/fesm2022/masterteam-components.mjs +2536 -0
- package/fesm2022/masterteam-components.mjs.map +1 -0
- package/package.json +278 -54
- package/types/masterteam-components-avatar-text.d.ts +23 -0
- package/types/masterteam-components-avatar.d.ts +23 -0
- package/types/masterteam-components-breadcrumb.d.ts +18 -0
- package/types/masterteam-components-business-fields.d.ts +675 -0
- package/types/masterteam-components-button-group.d.ts +8 -0
- package/types/masterteam-components-button.d.ts +62 -0
- package/types/masterteam-components-card.d.ts +14 -0
- package/types/masterteam-components-checkbox-field.d.ts +38 -0
- package/types/masterteam-components-chip.d.ts +21 -0
- package/types/masterteam-components-client-page-menu.d.ts +55 -0
- package/types/masterteam-components-client-page.d.ts +115 -0
- package/types/masterteam-components-color-picker-field.d.ts +39 -0
- package/types/masterteam-components-confirmation.d.ts +41 -0
- package/types/masterteam-components-date-field.d.ts +57 -0
- package/types/masterteam-components-dialog.d.ts +12 -0
- package/types/masterteam-components-drawer.d.ts +62 -0
- package/types/masterteam-components-dynamic-drawer.d.ts +159 -0
- package/types/masterteam-components-editor-field.d.ts +39 -0
- package/types/masterteam-components-empty-state.d.ts +47 -0
- package/types/masterteam-components-entities.d.ts +1116 -0
- package/types/masterteam-components-field-validation.d.ts +59 -0
- package/types/masterteam-components-formula.d.ts +759 -0
- package/types/masterteam-components-icon-field.d.ts +44 -0
- package/types/masterteam-components-list.d.ts +18 -0
- package/types/masterteam-components-location-field.d.ts +173 -0
- package/types/masterteam-components-menu.d.ts +55 -0
- package/types/masterteam-components-modal.d.ts +30 -0
- package/types/masterteam-components-module-summary-card.d.ts +18 -0
- package/types/masterteam-components-multi-select-field.d.ts +104 -0
- package/types/masterteam-components-number-field.d.ts +47 -0
- package/types/masterteam-components-page-header.d.ts +30 -0
- package/types/masterteam-components-page.d.ts +26 -0
- package/types/masterteam-components-paginator.d.ts +20 -0
- package/types/masterteam-components-pick-list-field.d.ts +65 -0
- package/types/masterteam-components-progress.d.ts +30 -0
- package/types/masterteam-components-property-filter-builder.d.ts +90 -0
- package/types/masterteam-components-radio-button-field.d.ts +41 -0
- package/types/masterteam-components-radio-cards-field.d.ts +39 -0
- package/types/masterteam-components-radio-cards.d.ts +33 -0
- package/types/masterteam-components-runtime-action.d.ts +105 -0
- package/types/masterteam-components-select-field.d.ts +136 -0
- package/types/masterteam-components-sidebar.d.ts +71 -0
- package/types/masterteam-components-slider-field.d.ts +41 -0
- package/types/masterteam-components-statistic-card.d.ts +28 -0
- package/types/masterteam-components-table.d.ts +937 -0
- package/types/masterteam-components-tabs.d.ts +80 -0
- package/types/masterteam-components-text-field.d.ts +60 -0
- package/types/masterteam-components-textarea-field.d.ts +45 -0
- package/types/masterteam-components-toast.d.ts +27 -0
- package/types/masterteam-components-toggle-field.d.ts +44 -0
- package/types/masterteam-components-tooltip.d.ts +26 -0
- package/types/masterteam-components-topbar.d.ts +20 -0
- package/types/masterteam-components-tree.d.ts +106 -0
- package/types/masterteam-components-treeselect-field.d.ts +79 -0
- package/types/masterteam-components-upload-field.d.ts +112 -0
- package/types/masterteam-components-uploader.d.ts +53 -0
- package/types/masterteam-components-user-search-field.d.ts +110 -0
- package/types/masterteam-components.d.ts +1261 -0
- package/.angular/cache/21.2.7/@masterteam/components/.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/@masterteam/components/angular-compiler.db +0 -0
- package/.angular/cache/21.2.7/@masterteam/components/angular-compiler.db-lock +0 -0
- package/.angular/cache/21.2.7/ng-packagr/045efd332b9db1d21b3a595a37ae03ebb11b457a5dc6e2d1cbc561b694e17f1a +0 -1
- package/.angular/cache/21.2.7/ng-packagr/0727b170af3d53236c0cafe16ea670d089e48d4c5c525b1dbcc1c684bb6e99c7 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/0873bc9048494ebc33fe0a7b856324c7c4ca681b0dcaa87338e3290186906d49 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/1010cd8fc996d0c2df519ed60085f4b1f38ccfc873900055bc75fc20a3c26bab +0 -1
- package/.angular/cache/21.2.7/ng-packagr/12379a8ab7254ad3df2635823a358cfce32e6d0f390be68596cc97e02307e6c4 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/1239e7a937657b62f858d17d47738ed30facbdaa91032511e29ed148b748400b +0 -1
- package/.angular/cache/21.2.7/ng-packagr/133b9ecf47ba424244902da90d77cd3f135b85f95c01b16de7b2247f57518f01 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/175d45dc6da51834e7fe937c09d23dbf28d2a823f838ef5271fd3e148776d6ec +0 -1
- package/.angular/cache/21.2.7/ng-packagr/19d99ad4d927324b03cdbef34331ba2c58bd580f1f0ca591cb5f8dbf436c913c +0 -1
- package/.angular/cache/21.2.7/ng-packagr/1a86918763f95c1c2b9fa781bda1ceedf15aead87f0e11ea1324318af43a897a +0 -1
- package/.angular/cache/21.2.7/ng-packagr/1f08100dbc280be7da64c809315376eb7d0cfd074916a6042f609f03f4276a8e +0 -1
- package/.angular/cache/21.2.7/ng-packagr/2224877a7e762b86541428e4c40d61f54f505867c305769ae42e67e4aa81bd93 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/24957fb7ec060692ebcf1471e1bdce39f40aed938959e580048ade58015762d2 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/295fcdc1c4462e7feae96a24255369508a559faaecc4676267749a7ce23e4b6d +0 -1
- package/.angular/cache/21.2.7/ng-packagr/2b37e2f2d6564d10bad1fd0ecc16453962fd855cd1e36ad7aa24baf3e4f2e8b3 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/2c20f0929771e857b570ba2beffe91f598f299ce26d4825fe4315bfe5a3dd40a +0 -1
- package/.angular/cache/21.2.7/ng-packagr/37dea2e5798cad4a21d66292eeed5be26d04500d9a1534332ad42ce664a058c2 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/3b6239b640fcb5ea7067a2655a2901d32f55372812b586aa008e77c59e8f2090 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/3beb1b4dfe75d1e6749cf91f05d51ba4eece939f5c15f6f33ed587bfd198f0a3 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/3f161e6c2ead4519d0663dd79199dafceb2cc22da7ce92a72b809b93bfce0bb0 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/43551862d17cd02626e18b30243390081a6247784485660048b060a3d4ab7fa7 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/47aedf032519b41d96866fcf8fbd4f1dfd29f9e9a534b39dee0e44d402227d2d +0 -1
- package/.angular/cache/21.2.7/ng-packagr/4a1768888c60921955bfdfba8b31c8d853bd7b2a7d3a7b83934de049e1e6e6a2 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/4a783e339117597607bff17eeca0ad24d84b8cbc1e28927e7e453ccfa6223180 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/4d9331b2050326f586cd8f6593a9e04e1c7944b2f9e98023649023c099597a5d +0 -1
- package/.angular/cache/21.2.7/ng-packagr/4e379f506919d47af7008658c75242aa05f0056c1caec4061d7fa5746f776049 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/55009bb7d44552dd816ce32fa2b0f7985f3f08fefd6409c2b4f6b9ffe35dad83 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/58ae3f1f9664f7b16844d2e4a279dd4ca9371de014cf5687320c2d5cb259a74f +0 -1
- package/.angular/cache/21.2.7/ng-packagr/5c08e906bd3fe1aa6c1d62f2bbb2b3f276e1c17fe45ef081e76bd1b865ac3dfa +0 -1
- package/.angular/cache/21.2.7/ng-packagr/5ce333a40ad635188347fa9bc601d5fd14be6baacbae7d096259d725ac9757af +0 -1
- package/.angular/cache/21.2.7/ng-packagr/5f32cceaee6a6ea19cc6cbff5ea089b752f13a0fdcd32597d4c99d5e1e031bb5 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/691ad4ccdc0a8ede36e1f4e5e97638c20c2d3142916ffac3a1b172178c139205 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/6b57160e0d2da3f31693831e84a3f4209c1f33a04abd636e34af03956e7329d8 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/70bc711a1d7b631845885c26adc2d6b1bff47d11332b2625cedfa11e9d5ac79a +0 -1
- package/.angular/cache/21.2.7/ng-packagr/7427c266237012afaef486c2af94ee08a491e8d7b6fc7e5ee887980830bbd333 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/7e8fa7c61cf9a932ba3a0e65eb73c7412e81666b7a8f923dac7b75acfbb94b1d +0 -1
- package/.angular/cache/21.2.7/ng-packagr/81aab7fdab43cbdfa869db759d6113ae01ec6f5e0e9061d7fc089c260886e4d1 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/83a81758045ff710a34ea3cf6f54435a1f5dea9839d8c0adda0bbce7c3fb6e8b +0 -1
- package/.angular/cache/21.2.7/ng-packagr/883eae810a4c09f06617bdc2e4bc30a69f09726401b2a051840969f635d076f1 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/8a6b9be66de40c57054dca5fde376c3cec1bec1ae191a16f1ae6a83306d9ebfe +0 -1
- package/.angular/cache/21.2.7/ng-packagr/8d42c8144f6929de46984094bf390a0c4168404ab13a5194839f6ba5e42bc3ce +0 -1
- package/.angular/cache/21.2.7/ng-packagr/91093656c61a5404f0d576f872247eeb480dd938e6999d481a97893c72b5f3d0 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/91e881172037c63d819e30d30e390e0d7dc0dee9808b3902275ccc8b1887d864 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/9ef28cf3a676e7bd0d37762c4868b4810efca2f241ed0dae75ebca41988e2c00 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/a07cbea405c1831b3f686a8e57c4b500d89cbab2b95e110487890269945feeaa +0 -1
- package/.angular/cache/21.2.7/ng-packagr/a463deba940880d9461612c9cd00d90062bf97aa31b1c4556b8b47a967cb6882 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/ab03ed1e4a371113b41b663d526d2b06565ceb062e6f033f726f1e455fc5d1d6 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/ad0e84be4f2211aff6187b4bec9adbe15f0e8b36851e9c6c63b38303c2daad37 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/aece79242dae70eb748605e37483e75e122e4ce414fa8be875499e8af26ee5d6 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/aff32db91ce03de30d2bbc84f266fe3fb2c6629d5eeb39a364204d9499484368 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/b0671e73a162927d28ef1742ec008e514264bc2ce29f2255bedaea553492fe5d +0 -1
- package/.angular/cache/21.2.7/ng-packagr/bb50d71f3cdeebbb85fd983be8103f9c216060464f8e7e534271197391e6dcf7 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/c64241290ab30d8761b2f5493a039427f5cda1a48b5be88ce62ee5c714c0f690 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/c794d2e79b26ab378c0dbf8afa7b8ac1337ba9afb288941d44a086cb1bd4bad2 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/d942edf8fd8e8e884138ffcdb1a07ad14a0b5e211f8ccea1dc9ea0b48f50cfc9 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/dbe0b9b9f18ba7b96d9c84f4fd16cde158c9701c202d00113e6f88ba93407bce +0 -1
- package/.angular/cache/21.2.7/ng-packagr/f564395a410a2723aac48e582f5fe416bfeaa48677cea47b10c5152d4f2b6672 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/fc9b0d27f081ca7b2a4cbefa75136d7bd7a8c341dbaa0587855071a6003906b8 +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-avatar-text.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-avatar.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-breadcrumb.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-business-fields.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-button-group.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-button.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-card.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-checkbox-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-chip.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-client-page-menu.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-client-page.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-color-picker-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-confirmation.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-date-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-dialog.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-drawer.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-dynamic-drawer.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-editor-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-empty-state.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-entities.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-field-validation.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-formula.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-icon-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-list.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-location-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-menu.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-modal.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-module-summary-card.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-multi-select-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-number-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-page-header.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-page.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-paginator.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-pick-list-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-progress.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-property-filter-builder.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-radio-button-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-radio-cards-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-radio-cards.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-runtime-action.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-select-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-sidebar.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-slider-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-statistic-card.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-table.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-tabs.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-text-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-textarea-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-toast.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-toggle-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-tooltip.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-topbar.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-tree.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-treeselect-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-upload-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-uploader.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components-user-search-field.tsbuildinfo +0 -1
- package/.angular/cache/21.2.7/ng-packagr/tsbuildinfo/masterteam-components.tsbuildinfo +0 -1
- package/angular.json +0 -32
- package/api/api.ts +0 -1
- package/api/public-api.ts +0 -5
- package/avatar/avatar.html +0 -32
- package/avatar/avatar.scss +0 -0
- package/avatar/avatar.ts +0 -54
- package/avatar/ng-package.json +0 -6
- package/avatar/public-api.ts +0 -1
- package/avatar-text/avatar-text.html +0 -26
- package/avatar-text/avatar-text.scss +0 -0
- package/avatar-text/avatar-text.ts +0 -52
- package/avatar-text/ng-package.json +0 -6
- package/avatar-text/public-api.ts +0 -1
- package/breadcrumb/breadcrumb.html +0 -53
- package/breadcrumb/breadcrumb.scss +0 -0
- package/breadcrumb/breadcrumb.ts +0 -26
- package/breadcrumb/ng-package.json +0 -6
- package/breadcrumb/public-api.ts +0 -1
- package/business-fields/entity-list-field/entity-list-add-token.ts +0 -25
- package/business-fields/entity-list-field/entity-list-field.html +0 -70
- package/business-fields/entity-list-field/entity-list-field.scss +0 -3
- package/business-fields/entity-list-field/entity-list-field.ts +0 -1067
- package/business-fields/lookup-matrix-field/lookup-matrix-field.html +0 -38
- package/business-fields/lookup-matrix-field/lookup-matrix-field.spec.ts +0 -183
- package/business-fields/lookup-matrix-field/lookup-matrix-field.ts +0 -239
- package/business-fields/lookup-module-check-list-field/lookup-module-check-list-field.html +0 -95
- package/business-fields/lookup-module-check-list-field/lookup-module-check-list-field.ts +0 -336
- package/business-fields/lookup-module-check-list-field/lookup-module-check-list-form-token.ts +0 -42
- package/business-fields/ng-package.json +0 -6
- package/business-fields/public-api.ts +0 -8
- package/business-fields/schedule-item-selector-field/schedule-item-selector-field.html +0 -32
- package/business-fields/schedule-item-selector-field/schedule-item-selector-field.ts +0 -272
- package/business-fields/schedule-predecessor-field/schedule-predecessor-field.html +0 -89
- package/business-fields/schedule-predecessor-field/schedule-predecessor-field.ts +0 -441
- package/business-fields/schema-connection-field/schema-connection-field.html +0 -58
- package/business-fields/schema-connection-field/schema-connection-field.scss +0 -0
- package/business-fields/schema-connection-field/schema-connection-field.ts +0 -456
- package/button/button.html +0 -44
- package/button/button.scss +0 -0
- package/button/button.ts +0 -120
- package/button/ng-package.json +0 -6
- package/button/public-api.ts +0 -1
- package/button-group/button-group.html +0 -3
- package/button-group/button-group.scss +0 -20
- package/button-group/button-group.ts +0 -12
- package/button-group/ng-package.json +0 -6
- package/button-group/public-api.ts +0 -1
- package/card/card.html +0 -26
- package/card/card.scss +0 -0
- package/card/card.ts +0 -29
- package/card/ng-package.json +0 -6
- package/card/public-api.ts +0 -1
- package/checkbox-field/checkbox-field.html +0 -31
- package/checkbox-field/checkbox-field.scss +0 -0
- package/checkbox-field/checkbox-field.spec.ts +0 -21
- package/checkbox-field/checkbox-field.ts +0 -123
- package/checkbox-field/ng-package.json +0 -6
- package/checkbox-field/public-api.ts +0 -1
- package/chip/chip.html +0 -16
- package/chip/chip.scss +0 -19
- package/chip/chip.ts +0 -45
- package/chip/ng-package.json +0 -6
- package/chip/public-api.ts +0 -1
- package/client-page/client-page.html +0 -232
- package/client-page/client-page.ts +0 -588
- package/client-page/index.ts +0 -2
- package/client-page/ng-package.json +0 -6
- package/client-page/public-api.ts +0 -1
- package/client-page-menu/client-page-menu.html +0 -142
- package/client-page-menu/client-page-menu.ts +0 -199
- package/client-page-menu/index.ts +0 -2
- package/client-page-menu/ng-package.json +0 -6
- package/client-page-menu/public-api.ts +0 -1
- package/color-picker-field/color-picker-field.html +0 -45
- package/color-picker-field/color-picker-field.scss +0 -52
- package/color-picker-field/color-picker-field.ts +0 -131
- package/color-picker-field/ng-package.json +0 -6
- package/color-picker-field/public-api.ts +0 -1
- package/confirmation/confirmation-dialog.html +0 -83
- package/confirmation/confirmation-dialog.scss +0 -0
- package/confirmation/confirmation-dialog.ts +0 -15
- package/confirmation/confirmation.spec.ts +0 -43
- package/confirmation/confirmation.ts +0 -103
- package/confirmation/ng-package.json +0 -6
- package/confirmation/public-api.ts +0 -2
- package/date-field/date-field.html +0 -65
- package/date-field/date-field.scss +0 -0
- package/date-field/date-field.spec.ts +0 -118
- package/date-field/date-field.ts +0 -196
- package/date-field/ng-package.json +0 -6
- package/date-field/public-api.ts +0 -1
- package/dialog/dialog.ts +0 -29
- package/dialog/ng-package.json +0 -6
- package/dialog/public-api.ts +0 -1
- package/drawer/drawer.html +0 -67
- package/drawer/drawer.scss +0 -1
- package/drawer/drawer.ts +0 -348
- package/drawer/ng-package.json +0 -5
- package/drawer/public-api.ts +0 -1
- package/dynamic-drawer/dynamic-drawer-host.ts +0 -476
- package/dynamic-drawer/dynamic-drawer.spec.ts +0 -204
- package/dynamic-drawer/dynamic-drawer.ts +0 -235
- package/dynamic-drawer/ng-package.json +0 -6
- package/dynamic-drawer/public-api.ts +0 -2
- package/editor-field/editor-field.html +0 -38
- package/editor-field/editor-field.scss +0 -219
- package/editor-field/editor-field.ts +0 -126
- package/editor-field/ng-package.json +0 -6
- package/editor-field/public-api.ts +0 -1
- package/empty-state/empty-state.html +0 -236
- package/empty-state/empty-state.ts +0 -85
- package/empty-state/ng-package.json +0 -6
- package/empty-state/public-api.ts +0 -1
- package/entities/comparison/comparison-entity-list/comparison-entity-list.html +0 -87
- package/entities/comparison/comparison-entity-list/comparison-entity-list.ts +0 -93
- package/entities/comparison/comparison-value/comparison-value.html +0 -31
- package/entities/comparison/comparison-value/comparison-value.ts +0 -53
- package/entities/currency-display.utils.spec.ts +0 -94
- package/entities/currency-display.utils.ts +0 -92
- package/entities/entities-manage/entities-manage.html +0 -74
- package/entities/entities-manage/entities-manage.scss +0 -72
- package/entities/entities-manage/entities-manage.ts +0 -121
- package/entities/entities-manage/entities-resize-base.ts +0 -153
- package/entities/entities-preview/entities-preview.css +0 -77
- package/entities/entities-preview/entities-preview.html +0 -56
- package/entities/entities-preview/entities-preview.ts +0 -281
- package/entities/entity-attachment/entity-attachment.html +0 -49
- package/entities/entity-attachment/entity-attachment.ts +0 -462
- package/entities/entity-checkbox/entity-checkbox.html +0 -28
- package/entities/entity-checkbox/entity-checkbox.ts +0 -65
- package/entities/entity-comparison.model.ts +0 -39
- package/entities/entity-connection/entity-connection.html +0 -12
- package/entities/entity-connection/entity-connection.ts +0 -75
- package/entities/entity-currency/entity-currency.html +0 -12
- package/entities/entity-currency/entity-currency.ts +0 -59
- package/entities/entity-date/entity-date.html +0 -16
- package/entities/entity-date/entity-date.ts +0 -50
- package/entities/entity-display.utils.ts +0 -94
- package/entities/entity-field/entity-field.ts +0 -94
- package/entities/entity-leaf-details/entity-leaf-details.html +0 -35
- package/entities/entity-leaf-details/entity-leaf-details.ts +0 -56
- package/entities/entity-location/entity-location.html +0 -34
- package/entities/entity-location/entity-location.ts +0 -98
- package/entities/entity-long-text/entity-long-text.html +0 -9
- package/entities/entity-long-text/entity-long-text.ts +0 -45
- package/entities/entity-lookup/entity-lookup.html +0 -25
- package/entities/entity-lookup/entity-lookup.ts +0 -68
- package/entities/entity-lookup-module-check-list/entity-lookup-module-check-list.html +0 -39
- package/entities/entity-lookup-module-check-list/entity-lookup-module-check-list.spec.ts +0 -148
- package/entities/entity-lookup-module-check-list/entity-lookup-module-check-list.ts +0 -152
- package/entities/entity-percentage/entity-percentage.html +0 -22
- package/entities/entity-percentage/entity-percentage.ts +0 -163
- package/entities/entity-phase-gate/entity-phase-gate.html +0 -20
- package/entities/entity-phase-gate/entity-phase-gate.ts +0 -129
- package/entities/entity-preview/entity-preview-body.html +0 -8
- package/entities/entity-preview/entity-preview-body.ts +0 -19
- package/entities/entity-preview/entity-preview.html +0 -14
- package/entities/entity-preview/entity-preview.ts +0 -33
- package/entities/entity-preview/entity-value-preview.html +0 -62
- package/entities/entity-preview/entity-value-preview.spec.ts +0 -191
- package/entities/entity-preview/entity-value-preview.ts +0 -69
- package/entities/entity-schedule-item/entity-schedule-item.html +0 -19
- package/entities/entity-schedule-item/entity-schedule-item.ts +0 -41
- package/entities/entity-sections.util.ts +0 -103
- package/entities/entity-status/entity-status.html +0 -20
- package/entities/entity-status/entity-status.ts +0 -60
- package/entities/entity-text/entity-text.html +0 -20
- package/entities/entity-text/entity-text.ts +0 -35
- package/entities/entity-user/entity-user.html +0 -181
- package/entities/entity-user/entity-user.ts +0 -179
- package/entities/entity.model.ts +0 -407
- package/entities/leaf-details-display.utils.ts +0 -269
- package/entities/ng-package.json +0 -6
- package/entities/percentage-color.utils.spec.ts +0 -94
- package/entities/percentage-color.utils.ts +0 -80
- package/entities/public-api.ts +0 -30
- package/field-validation/character-limit.validator.ts +0 -22
- package/field-validation/error-message.pipe.spec.ts +0 -184
- package/field-validation/error-message.pipe.ts +0 -80
- package/field-validation/field-validation.ts +0 -168
- package/field-validation/ng-package.json +0 -6
- package/field-validation/public-api.ts +0 -2
- package/formula/formula-editor/formula-editor.html +0 -89
- package/formula/formula-editor/formula-editor.scss +0 -25
- package/formula/formula-editor/formula-editor.ts +0 -467
- package/formula/formula-editor/index.ts +0 -1
- package/formula/formula-editor-code/formula-autocomplete-normalization.util.spec.ts +0 -58
- package/formula/formula-editor-code/formula-autocomplete-normalization.util.ts +0 -64
- package/formula/formula-editor-code/formula-completion-range.util.spec.ts +0 -62
- package/formula/formula-editor-code/formula-completion-range.util.ts +0 -71
- package/formula/formula-editor-code/formula-completion-suggestion.util.spec.ts +0 -23
- package/formula/formula-editor-code/formula-completion-suggestion.util.ts +0 -18
- package/formula/formula-editor-code/formula-editor-code.html +0 -15
- package/formula/formula-editor-code/formula-editor-code.scss +0 -90
- package/formula/formula-editor-code/formula-editor-code.ts +0 -1095
- package/formula/formula-editor-code/index.ts +0 -1
- package/formula/formula-status-bar/formula-status-bar.html +0 -119
- package/formula/formula-status-bar/formula-status-bar.ts +0 -66
- package/formula/formula-status-bar/index.ts +0 -1
- package/formula/formula-toolbar/formula-toolbar.html +0 -361
- package/formula/formula-toolbar/formula-toolbar.ts +0 -532
- package/formula/formula-toolbar/index.ts +0 -2
- package/formula/formula-toolbar/operators.ts +0 -122
- package/formula/models/formula-block.model.ts +0 -61
- package/formula/models/formula-token.model.spec.ts +0 -57
- package/formula/models/formula-token.model.ts +0 -852
- package/formula/models/index.ts +0 -5
- package/formula/models/smart-block.model.ts +0 -132
- package/formula/models/validation-result.model.ts +0 -80
- package/formula/ng-package.json +0 -6
- package/formula/public-api.ts +0 -8
- package/formula/runtime/formula-runtime-catalogs.ts +0 -554
- package/formula/runtime/formula-runtime-engine.spec.ts +0 -328
- package/formula/runtime/formula-runtime-engine.ts +0 -794
- package/formula/runtime/formula-runtime.model.ts +0 -53
- package/formula/runtime/index.ts +0 -3
- package/formula/toolbar-item/index.ts +0 -1
- package/formula/toolbar-item/toolbar-item.html +0 -143
- package/formula/toolbar-item/toolbar-item.scss +0 -14
- package/formula/toolbar-item/toolbar-item.ts +0 -223
- package/icon-field/icon-field.html +0 -58
- package/icon-field/icon-field.scss +0 -24
- package/icon-field/icon-field.spec.ts +0 -77
- package/icon-field/icon-field.ts +0 -205
- package/icon-field/ng-package.json +0 -6
- package/icon-field/public-api.ts +0 -1
- package/list/list.html +0 -22
- package/list/list.ts +0 -36
- package/list/ng-package.json +0 -6
- package/list/public-api.ts +0 -1
- package/location-field/location-field.html +0 -86
- package/location-field/location-field.spec.ts +0 -295
- package/location-field/location-field.ts +0 -662
- package/location-field/location-manual-dialog.html +0 -43
- package/location-field/location-manual-dialog.ts +0 -104
- package/location-field/location-value.ts +0 -67
- package/location-field/ng-package.json +0 -6
- package/location-field/public-api.ts +0 -3
- package/menu/menu.html +0 -71
- package/menu/menu.scss +0 -3
- package/menu/menu.ts +0 -186
- package/menu/ng-package.json +0 -6
- package/menu/public-api.ts +0 -1
- package/modal/modal.ts +0 -127
- package/modal/ng-package.json +0 -6
- package/modal/public-api.ts +0 -1
- package/module-summary-card/module-summary-card.html +0 -43
- package/module-summary-card/module-summary-card.scss +0 -0
- package/module-summary-card/module-summary-card.ts +0 -40
- package/module-summary-card/ng-package.json +0 -6
- package/module-summary-card/public-api.ts +0 -1
- package/multi-select-field/multi-select-field.html +0 -140
- package/multi-select-field/multi-select-field.scss +0 -0
- package/multi-select-field/multi-select-field.spec.ts +0 -21
- package/multi-select-field/multi-select-field.ts +0 -397
- package/multi-select-field/ng-package.json +0 -6
- package/multi-select-field/public-api.ts +0 -1
- package/ng-package.json +0 -9
- package/number-field/ng-package.json +0 -6
- package/number-field/number-field.html +0 -39
- package/number-field/number-field.scss +0 -8
- package/number-field/number-field.spec.ts +0 -21
- package/number-field/number-field.ts +0 -124
- package/number-field/public-api.ts +0 -1
- package/page/index.ts +0 -1
- package/page/ng-package.json +0 -6
- package/page/page.html +0 -37
- package/page/page.ts +0 -43
- package/page/public-api.ts +0 -1
- package/page-header/index.ts +0 -2
- package/page-header/ng-package.json +0 -6
- package/page-header/page-header.html +0 -60
- package/page-header/page-header.ts +0 -54
- package/page-header/public-api.ts +0 -1
- package/paginator/ng-package.json +0 -6
- package/paginator/paginator.html +0 -50
- package/paginator/paginator.scss +0 -0
- package/paginator/paginator.ts +0 -53
- package/paginator/public-api.ts +0 -1
- package/pick-list-field/ng-package.json +0 -6
- package/pick-list-field/pick-list-field.html +0 -39
- package/pick-list-field/pick-list-field.scss +0 -26
- package/pick-list-field/pick-list-field.ts +0 -259
- package/pick-list-field/public-api.ts +0 -1
- package/progress/ng-package.json +0 -6
- package/progress/progress.html +0 -36
- package/progress/progress.ts +0 -61
- package/progress/public-api.ts +0 -1
- package/property-filter-builder/ng-package.json +0 -6
- package/property-filter-builder/property-filter-builder.html +0 -192
- package/property-filter-builder/property-filter-builder.ts +0 -548
- package/property-filter-builder/public-api.ts +0 -1
- package/radio-button-field/ng-package.json +0 -6
- package/radio-button-field/public-api.ts +0 -1
- package/radio-button-field/radio-button-field.html +0 -44
- package/radio-button-field/radio-button-field.scss +0 -0
- package/radio-button-field/radio-button-field.ts +0 -114
- package/radio-cards/ng-package.json +0 -6
- package/radio-cards/public-api.ts +0 -1
- package/radio-cards/radio-cards.css +0 -3
- package/radio-cards/radio-cards.html +0 -54
- package/radio-cards/radio-cards.spec.ts +0 -22
- package/radio-cards/radio-cards.ts +0 -92
- package/radio-cards-field/ng-package.json +0 -6
- package/radio-cards-field/public-api.ts +0 -1
- package/radio-cards-field/radio-cards-field.css +0 -0
- package/radio-cards-field/radio-cards-field.html +0 -38
- package/radio-cards-field/radio-cards-field.spec.ts +0 -22
- package/radio-cards-field/radio-cards-field.ts +0 -182
- package/runtime-action/ng-package.json +0 -6
- package/runtime-action/payload-builder.ts +0 -246
- package/runtime-action/public-api.ts +0 -4
- package/runtime-action/runtime-action-context.store.ts +0 -26
- package/runtime-action/runtime-action.runner.ts +0 -302
- package/runtime-action/runtime-action.types.ts +0 -82
- package/select-field/current-user.util.ts +0 -54
- package/select-field/ng-package.json +0 -6
- package/select-field/public-api.ts +0 -1
- package/select-field/select-field.html +0 -142
- package/select-field/select-field.scss +0 -0
- package/select-field/select-field.spec.ts +0 -21
- package/select-field/select-field.ts +0 -471
- package/sidebar/ng-package.json +0 -6
- package/sidebar/public-api.ts +0 -1
- package/sidebar/sidebar.html +0 -368
- package/sidebar/sidebar.ts +0 -303
- package/slider-field/ng-package.json +0 -7
- package/slider-field/public-api.ts +0 -1
- package/slider-field/slider-field.html +0 -33
- package/slider-field/slider-field.scss +0 -11
- package/slider-field/slider-field.spec.ts +0 -44
- package/slider-field/slider-field.ts +0 -166
- package/src/lib/base/base.facade.ts +0 -159
- package/src/lib/base/crud-base.state.ts +0 -248
- package/src/lib/config/date-format.config.ts +0 -55
- package/src/lib/config/ds-identity.preset.ts +0 -538
- package/src/lib/config/ds-identity.tokens.ts +0 -209
- package/src/lib/config/dynamic-form.model.ts +0 -1162
- package/src/lib/config/povide-messages.ts +0 -5
- package/src/lib/config/provide-confirmation.ts +0 -5
- package/src/lib/config/providemt.ts +0 -506
- package/src/lib/config/public-api.ts +0 -0
- package/src/lib/pipes/mt-date-format.pipe.spec.ts +0 -60
- package/src/lib/pipes/mt-date-format.pipe.ts +0 -81
- package/src/lib/utils/api-request.helper.ts +0 -59
- package/src/lib/utils/clock-time.util.ts +0 -58
- package/src/lib/utils/color.utils.ts +0 -187
- package/src/lib/utils/entity-adapter.ts +0 -50
- package/src/lib/utils/field-id.ts +0 -42
- package/src/lib/utils/http-context.ts +0 -35
- package/src/lib/utils/inputs.ts +0 -6
- package/src/lib/utils/state-helpers.ts +0 -49
- package/src/lib/utils/theme.ts +0 -281
- package/src/public-api.ts +0 -30
- package/statistic-card/ng-package.json +0 -6
- package/statistic-card/public-api.ts +0 -1
- package/statistic-card/statistic-card.html +0 -31
- package/statistic-card/statistic-card.scss +0 -0
- package/statistic-card/statistic-card.ts +0 -59
- package/table/ng-package.json +0 -7
- package/table/public-api.ts +0 -10
- package/table/table-actions-menu/public-api.ts +0 -1
- package/table/table-actions-menu/table-actions-menu.html +0 -75
- package/table/table-actions-menu/table-actions-menu.ts +0 -171
- package/table/table-caption/public-api.ts +0 -1
- package/table/table-caption/table-caption.html +0 -118
- package/table/table-caption/table-caption.ts +0 -221
- package/table/table-column-filter/public-api.ts +0 -1
- package/table/table-column-filter/table-column-filter.html +0 -44
- package/table/table-column-filter/table-column-filter.ts +0 -106
- package/table/table-export/html-to-text.util.ts +0 -67
- package/table/table-export/public-api.ts +0 -1
- package/table/table-export/table-export.service.spec.ts +0 -186
- package/table/table-export/table-export.service.ts +0 -325
- package/table/table-filter/public-api.ts +0 -1
- package/table/table-filter/table-filter.css +0 -9
- package/table/table-filter/table-filter.html +0 -63
- package/table/table-filter/table-filter.ts +0 -126
- package/table/table-filter-field/public-api.ts +0 -1
- package/table/table-filter-field/table-filter-field.html +0 -182
- package/table/table-filter-field/table-filter-field.ts +0 -208
- package/table/table-grouping/public-api.ts +0 -1
- package/table/table-grouping/table-grouping.spec.ts +0 -218
- package/table/table-grouping/table-grouping.ts +0 -237
- package/table/table-types.ts +0 -242
- package/table/table-value.utils.spec.ts +0 -63
- package/table/table-value.utils.ts +0 -1014
- package/table/table.css +0 -145
- package/table/table.html +0 -572
- package/table/table.ts +0 -2042
- package/tabs/ng-package.json +0 -6
- package/tabs/public-api.ts +0 -1
- package/tabs/tabs.html +0 -417
- package/tabs/tabs.scss +0 -3
- package/tabs/tabs.spec.ts +0 -79
- package/tabs/tabs.ts +0 -397
- package/text-field/ng-package.json +0 -6
- package/text-field/public-api.ts +0 -1
- package/text-field/text-field.html +0 -75
- package/text-field/text-field.scss +0 -56
- package/text-field/text-field.ts +0 -251
- package/textarea-field/ng-package.json +0 -6
- package/textarea-field/public-api.ts +0 -1
- package/textarea-field/textarea-field.html +0 -37
- package/textarea-field/textarea-field.scss +0 -0
- package/textarea-field/textarea-field.spec.ts +0 -21
- package/textarea-field/textarea-field.ts +0 -169
- package/toast/ng-package.json +0 -6
- package/toast/public-api.ts +0 -2
- package/toast/toast.html +0 -18
- package/toast/toast.service.ts +0 -67
- package/toast/toast.ts +0 -21
- package/toggle-field/ng-package.json +0 -6
- package/toggle-field/public-api.ts +0 -1
- package/toggle-field/toggle-field.html +0 -78
- package/toggle-field/toggle-field.scss +0 -24
- package/toggle-field/toggle-field.ts +0 -150
- package/tooltip/ng-package.json +0 -6
- package/tooltip/public-api.ts +0 -2
- package/tooltip/tooltip.ts +0 -30
- package/tooltip/truncate-tooltip.ts +0 -124
- package/topbar/ng-package.json +0 -6
- package/topbar/public-api.ts +0 -1
- package/topbar/topbar.html +0 -52
- package/topbar/topbar.ts +0 -27
- package/tree/ng-package.json +0 -6
- package/tree/public-api.ts +0 -2
- package/tree/tree-types.ts +0 -55
- package/tree/tree.html +0 -126
- package/tree/tree.scss +0 -1
- package/tree/tree.ts +0 -303
- package/treeselect-field/ng-package.json +0 -6
- package/treeselect-field/public-api.ts +0 -1
- package/treeselect-field/treeselect-field.html +0 -71
- package/treeselect-field/treeselect-field.ts +0 -348
- package/tsconfig.check.json +0 -20
- package/tsconfig.json +0 -16
- package/tsconfig.spec.json +0 -24
- package/upload-field/ng-package.json +0 -6
- package/upload-field/public-api.ts +0 -2
- package/upload-field/secure-image.pipe.ts +0 -258
- package/upload-field/upload-field.html +0 -274
- package/upload-field/upload-field.scss +0 -0
- package/upload-field/upload-field.spec.ts +0 -169
- package/upload-field/upload-field.ts +0 -764
- package/upload-field/upload-file-preview/upload-file-preview.html +0 -41
- package/upload-field/upload-file-preview/upload-file-preview.scss +0 -0
- package/upload-field/upload-file-preview/upload-file-preview.ts +0 -57
- package/upload-field/upload-user-preview/upload-user-preview.css +0 -0
- package/upload-field/upload-user-preview/upload-user-preview.html +0 -73
- package/upload-field/upload-user-preview/upload-user-preview.ts +0 -54
- package/uploader/ng-package.json +0 -6
- package/uploader/public-api.ts +0 -1
- package/uploader/uploader.service.spec.ts +0 -271
- package/uploader/uploader.service.ts +0 -733
- package/user-search-field/ng-package.json +0 -6
- package/user-search-field/public-api.ts +0 -1
- package/user-search-field/user-search-field.html +0 -88
- package/user-search-field/user-search-field.scss +0 -4
- package/user-search-field/user-search-field.spec.ts +0 -176
- package/user-search-field/user-search-field.ts +0 -483
|
@@ -0,0 +1,3372 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, output, viewChild, computed, signal, ChangeDetectionStrategy, Component, model, inject, forwardRef, DestroyRef, Injectable, contentChild, effect } from '@angular/core';
|
|
3
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
import { Card } from '@masterteam/components/card';
|
|
5
|
+
import * as i1$1 from '@angular/forms';
|
|
6
|
+
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
7
|
+
import * as i2 from '@jsverse/transloco';
|
|
8
|
+
import { TranslocoModule, TranslocoService } from '@jsverse/transloco';
|
|
9
|
+
import { Button } from '@masterteam/components/button';
|
|
10
|
+
import { Icon } from '@masterteam/icons';
|
|
11
|
+
import { Tabs } from '@masterteam/components/tabs';
|
|
12
|
+
import { TextField } from '@masterteam/components/text-field';
|
|
13
|
+
import { Avatar } from '@masterteam/components/avatar';
|
|
14
|
+
import * as i1 from 'primeng/tieredmenu';
|
|
15
|
+
import { TieredMenuModule } from 'primeng/tieredmenu';
|
|
16
|
+
import { Drawer } from '@masterteam/components/drawer';
|
|
17
|
+
import { parseClockTime, clockTimeToSeconds, toClockTimeParts, MTDateFormatPipe } from '@masterteam/components';
|
|
18
|
+
import { DateField } from '@masterteam/components/date-field';
|
|
19
|
+
import { NumberField } from '@masterteam/components/number-field';
|
|
20
|
+
import { MultiSelectField } from '@masterteam/components/multi-select-field';
|
|
21
|
+
import { SelectField } from '@masterteam/components/select-field';
|
|
22
|
+
import { TreeSelectField } from '@masterteam/components/treeselect-field';
|
|
23
|
+
import { UserSearchField } from '@masterteam/components/user-search-field';
|
|
24
|
+
import * as i1$2 from 'primeng/popover';
|
|
25
|
+
import { PopoverModule } from 'primeng/popover';
|
|
26
|
+
import * as XLSX from 'xlsx';
|
|
27
|
+
import { ToggleField } from '@masterteam/components/toggle-field';
|
|
28
|
+
import { Paginator } from '@masterteam/components/paginator';
|
|
29
|
+
import { CheckboxField } from '@masterteam/components/checkbox-field';
|
|
30
|
+
import * as i1$3 from 'primeng/table';
|
|
31
|
+
import { TableModule } from 'primeng/table';
|
|
32
|
+
import * as i3 from 'primeng/skeleton';
|
|
33
|
+
import { SkeletonModule } from 'primeng/skeleton';
|
|
34
|
+
import * as i4 from 'primeng/progressbar';
|
|
35
|
+
import { ProgressBarModule } from 'primeng/progressbar';
|
|
36
|
+
import { ConfirmationService } from '@masterteam/components/confirmation';
|
|
37
|
+
import { EntityPreview } from '@masterteam/components/entities';
|
|
38
|
+
import { EmptyState } from '@masterteam/components/empty-state';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Up to this many actions render as their own buttons instead of hiding behind
|
|
42
|
+
* the `⋯`. Export / print / group-by is exactly three, so the common table
|
|
43
|
+
* shows them all at a glance; anything richer keeps the menu rather than
|
|
44
|
+
* crowding the caption.
|
|
45
|
+
*/
|
|
46
|
+
const FLAT_ACTION_LIMIT = 3;
|
|
47
|
+
/**
|
|
48
|
+
* Top-right `⋯` menu. Uses PrimeNG TieredMenu (popup mode) so submenu
|
|
49
|
+
* cascading, keyboard navigation, and outside-click-to-close come for free.
|
|
50
|
+
* Item rendering is overridden via the `#item` template so each row shows
|
|
51
|
+
* either a flat tone chip (main actions) or an `mt-avatar` (column picker).
|
|
52
|
+
*/
|
|
53
|
+
class TableActionsMenu {
|
|
54
|
+
exportable = input(false, { ...(ngDevMode ? { debugName: "exportable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
55
|
+
printable = input(false, { ...(ngDevMode ? { debugName: "printable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
56
|
+
groupable = input(false, { ...(ngDevMode ? { debugName: "groupable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
57
|
+
groupColumns = input([], ...(ngDevMode ? [{ debugName: "groupColumns" }] : /* istanbul ignore next */ []));
|
|
58
|
+
activeGroup = input(null, ...(ngDevMode ? [{ debugName: "activeGroup" }] : /* istanbul ignore next */ []));
|
|
59
|
+
exportRequested = output();
|
|
60
|
+
printRequested = output();
|
|
61
|
+
groupChange = output();
|
|
62
|
+
menu = viewChild('menu', ...(ngDevMode ? [{ debugName: "menu" }] : /* istanbul ignore next */ []));
|
|
63
|
+
/** Tailwind classes for flat tone chips, keyed by `iconTone`. */
|
|
64
|
+
toneClass = {
|
|
65
|
+
emerald: 'bg-emerald-50 text-emerald-700',
|
|
66
|
+
sky: 'bg-sky-50 text-sky-700',
|
|
67
|
+
indigo: 'bg-indigo-50 text-indigo-700',
|
|
68
|
+
secondary: 'bg-gray-100 text-gray-700',
|
|
69
|
+
};
|
|
70
|
+
items = computed(() => {
|
|
71
|
+
const items = [];
|
|
72
|
+
if (this.exportable()) {
|
|
73
|
+
items.push({
|
|
74
|
+
labelKey: 'components.table.exportExcel',
|
|
75
|
+
iconKey: 'file.file-download-02',
|
|
76
|
+
iconTone: 'emerald',
|
|
77
|
+
command: () => this.exportRequested.emit(),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (this.printable()) {
|
|
81
|
+
items.push({
|
|
82
|
+
labelKey: 'components.table.printPdf',
|
|
83
|
+
iconKey: 'media.printer',
|
|
84
|
+
iconTone: 'sky',
|
|
85
|
+
command: () => this.printRequested.emit(),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (this.groupable()) {
|
|
89
|
+
const activeKey = this.activeGroup();
|
|
90
|
+
const activeLabel = this.groupColumns().find((c) => c.key === activeKey)?.label ??
|
|
91
|
+
activeKey ??
|
|
92
|
+
null;
|
|
93
|
+
items.push({
|
|
94
|
+
labelKey: 'components.table.groupBy',
|
|
95
|
+
iconKey: 'layout.columns-03',
|
|
96
|
+
iconTone: 'indigo',
|
|
97
|
+
badge: activeLabel ?? undefined,
|
|
98
|
+
items: [
|
|
99
|
+
{
|
|
100
|
+
labelKey: 'components.table.noGrouping',
|
|
101
|
+
iconKey: 'general.x-close',
|
|
102
|
+
iconTone: 'secondary',
|
|
103
|
+
useAvatar: true,
|
|
104
|
+
selected: !activeKey,
|
|
105
|
+
command: () => this.groupChange.emit(null),
|
|
106
|
+
},
|
|
107
|
+
...this.groupColumns().map((col) => ({
|
|
108
|
+
rawLabel: col.label,
|
|
109
|
+
iconKey: 'layout.columns-03',
|
|
110
|
+
iconTone: 'secondary',
|
|
111
|
+
useAvatar: true,
|
|
112
|
+
selected: activeKey === col.key,
|
|
113
|
+
command: () => this.groupChange.emit(col.key),
|
|
114
|
+
})),
|
|
115
|
+
],
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return items;
|
|
119
|
+
}, ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
120
|
+
/** True while the actions render as individual buttons. */
|
|
121
|
+
isFlat = computed(() => this.items().length > 0 && this.items().length <= FLAT_ACTION_LIMIT, ...(ngDevMode ? [{ debugName: "isFlat" }] : /* istanbul ignore next */ []));
|
|
122
|
+
/**
|
|
123
|
+
* What the popup renders. In `⋯` mode that's the whole action list; in flat
|
|
124
|
+
* mode the buttons *are* the top level, so the popup only ever shows the
|
|
125
|
+
* children of the button that opened it (the group-by column list).
|
|
126
|
+
*/
|
|
127
|
+
openSubmenu = signal(null, ...(ngDevMode ? [{ debugName: "openSubmenu" }] : /* istanbul ignore next */ []));
|
|
128
|
+
menuModel = computed(() => this.openSubmenu() ?? this.items(), ...(ngDevMode ? [{ debugName: "menuModel" }] : /* istanbul ignore next */ []));
|
|
129
|
+
toggle(event) {
|
|
130
|
+
this.openSubmenu.set(null);
|
|
131
|
+
this.menu()?.toggle(event);
|
|
132
|
+
}
|
|
133
|
+
/** Flat-mode click: run a leaf action, or open a parent's submenu. */
|
|
134
|
+
activate(event, item) {
|
|
135
|
+
const children = item.items;
|
|
136
|
+
if (!children?.length) {
|
|
137
|
+
item.command?.({});
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
this.openSubmenu.set(children);
|
|
141
|
+
this.menu()?.toggle(event);
|
|
142
|
+
}
|
|
143
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableActionsMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
144
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: TableActionsMenu, isStandalone: true, selector: "mt-table-actions-menu", inputs: { exportable: { classPropertyName: "exportable", publicName: "exportable", isSignal: true, isRequired: false, transformFunction: null }, printable: { classPropertyName: "printable", publicName: "printable", isSignal: true, isRequired: false, transformFunction: null }, groupable: { classPropertyName: "groupable", publicName: "groupable", isSignal: true, isRequired: false, transformFunction: null }, groupColumns: { classPropertyName: "groupColumns", publicName: "groupColumns", isSignal: true, isRequired: false, transformFunction: null }, activeGroup: { classPropertyName: "activeGroup", publicName: "activeGroup", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { exportRequested: "exportRequested", printRequested: "printRequested", groupChange: "groupChange" }, host: { classAttribute: "flex items-center gap-2" }, viewQueries: [{ propertyName: "menu", first: true, predicate: ["menu"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (isFlat()) {\r\n @for (item of items(); track item.labelKey ?? item.rawLabel) {\r\n <mt-button\r\n (click)=\"activate($event, item)\"\r\n [icon]=\"item.iconKey\"\r\n [label]=\"item.badge\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [tooltip]=\"\r\n item.labelKey ? (item.labelKey | transloco) : (item.rawLabel ?? '')\r\n \"\r\n />\r\n }\r\n} @else {\r\n <mt-button\r\n (click)=\"toggle($event)\"\r\n icon=\"general.dots-horizontal\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [tooltip]=\"'components.table.actions' | transloco\"\r\n />\r\n}\r\n\r\n<p-tieredMenu\r\n #menu\r\n [model]=\"menuModel()\"\r\n [popup]=\"true\"\r\n appendTo=\"body\"\r\n styleClass=\"mt-table-actions-menu\"\r\n>\r\n <ng-template #item let-item let-hasSubmenu=\"hasSubmenu\">\r\n <button\r\n type=\"button\"\r\n class=\"flex items-center gap-2.5 w-full px-2.5 py-2 text-sm cursor-pointer text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-surface-700 transition-colors\"\r\n [class.bg-primary-50]=\"item.selected\"\r\n [class.dark:bg-primary-950]=\"item.selected\"\r\n [class.text-primary-700]=\"item.selected\"\r\n >\r\n @if (item.iconKey) {\r\n @if (item.useAvatar) {\r\n <mt-avatar [icon]=\"item.iconKey\" shape=\"circle\" />\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center justify-center w-7 h-7 rounded-full shrink-0\"\r\n [class]=\"toneClass[item.iconTone ?? 'secondary']\"\r\n >\r\n <mt-icon [icon]=\"item.iconKey\" class=\"text-sm\" />\r\n </span>\r\n }\r\n }\r\n <span class=\"flex-1 text-start truncate\">\r\n @if (item.labelKey) {\r\n {{ item.labelKey | transloco }}\r\n } @else {\r\n {{ item.rawLabel }}\r\n }\r\n </span>\r\n @if (item.badge) {\r\n <span\r\n class=\"text-xs px-1.5 py-0.5 rounded-full bg-primary-50 text-primary-700 dark:bg-primary-950 dark:text-primary-300 shrink-0\"\r\n >\r\n {{ item.badge }}\r\n </span>\r\n }\r\n @if (hasSubmenu) {\r\n <mt-icon\r\n icon=\"arrow.chevron-right\"\r\n class=\"text-xs text-gray-400 shrink-0\"\r\n />\r\n }\r\n </button>\r\n </ng-template>\r\n</p-tieredMenu>\r\n", dependencies: [{ kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { 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: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "ngmodule", type: TieredMenuModule }, { kind: "component", type: i1.TieredMenu, selector: "p-tieredMenu, p-tieredmenu, p-tiered-menu", inputs: ["model", "popup", "style", "styleClass", "breakpoint", "autoZIndex", "baseZIndex", "autoDisplay", "showTransitionOptions", "hideTransitionOptions", "id", "ariaLabel", "ariaLabelledBy", "disabled", "tabindex", "appendTo", "motionOptions"], outputs: ["onShow", "onHide"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
145
|
+
}
|
|
146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableActionsMenu, decorators: [{
|
|
147
|
+
type: Component,
|
|
148
|
+
args: [{ selector: 'mt-table-actions-menu', standalone: true, imports: [Avatar, Button, Icon, TieredMenuModule, TranslocoModule], host: { class: 'flex items-center gap-2' }, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (isFlat()) {\r\n @for (item of items(); track item.labelKey ?? item.rawLabel) {\r\n <mt-button\r\n (click)=\"activate($event, item)\"\r\n [icon]=\"item.iconKey\"\r\n [label]=\"item.badge\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [tooltip]=\"\r\n item.labelKey ? (item.labelKey | transloco) : (item.rawLabel ?? '')\r\n \"\r\n />\r\n }\r\n} @else {\r\n <mt-button\r\n (click)=\"toggle($event)\"\r\n icon=\"general.dots-horizontal\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n [tooltip]=\"'components.table.actions' | transloco\"\r\n />\r\n}\r\n\r\n<p-tieredMenu\r\n #menu\r\n [model]=\"menuModel()\"\r\n [popup]=\"true\"\r\n appendTo=\"body\"\r\n styleClass=\"mt-table-actions-menu\"\r\n>\r\n <ng-template #item let-item let-hasSubmenu=\"hasSubmenu\">\r\n <button\r\n type=\"button\"\r\n class=\"flex items-center gap-2.5 w-full px-2.5 py-2 text-sm cursor-pointer text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-surface-700 transition-colors\"\r\n [class.bg-primary-50]=\"item.selected\"\r\n [class.dark:bg-primary-950]=\"item.selected\"\r\n [class.text-primary-700]=\"item.selected\"\r\n >\r\n @if (item.iconKey) {\r\n @if (item.useAvatar) {\r\n <mt-avatar [icon]=\"item.iconKey\" shape=\"circle\" />\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center justify-center w-7 h-7 rounded-full shrink-0\"\r\n [class]=\"toneClass[item.iconTone ?? 'secondary']\"\r\n >\r\n <mt-icon [icon]=\"item.iconKey\" class=\"text-sm\" />\r\n </span>\r\n }\r\n }\r\n <span class=\"flex-1 text-start truncate\">\r\n @if (item.labelKey) {\r\n {{ item.labelKey | transloco }}\r\n } @else {\r\n {{ item.rawLabel }}\r\n }\r\n </span>\r\n @if (item.badge) {\r\n <span\r\n class=\"text-xs px-1.5 py-0.5 rounded-full bg-primary-50 text-primary-700 dark:bg-primary-950 dark:text-primary-300 shrink-0\"\r\n >\r\n {{ item.badge }}\r\n </span>\r\n }\r\n @if (hasSubmenu) {\r\n <mt-icon\r\n icon=\"arrow.chevron-right\"\r\n class=\"text-xs text-gray-400 shrink-0\"\r\n />\r\n }\r\n </button>\r\n </ng-template>\r\n</p-tieredMenu>\r\n" }]
|
|
149
|
+
}], propDecorators: { exportable: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportable", required: false }] }], printable: [{ type: i0.Input, args: [{ isSignal: true, alias: "printable", required: false }] }], groupable: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupable", required: false }] }], groupColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupColumns", required: false }] }], activeGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeGroup", required: false }] }], exportRequested: [{ type: i0.Output, args: ["exportRequested"] }], printRequested: [{ type: i0.Output, args: ["printRequested"] }], groupChange: [{ type: i0.Output, args: ["groupChange"] }], menu: [{ type: i0.ViewChild, args: ['menu', { isSignal: true }] }] } });
|
|
150
|
+
|
|
151
|
+
class TableValueResolver {
|
|
152
|
+
/**
|
|
153
|
+
* View types the table knows how to filter/sort/export. Deliberately a
|
|
154
|
+
* subset of `EntityViewType` — the richer ones (`Location`, `Connection`,
|
|
155
|
+
* `LookupModuleCheckList`, `LeafDetails`) have no scalar the table could
|
|
156
|
+
* compare, so they stay out and simply render. Anything listed here also
|
|
157
|
+
* needs a branch in `getColumnFilterType` and `getEntityValueByType`.
|
|
158
|
+
*/
|
|
159
|
+
static ALL_ENTITY_VIEW_TYPES = [
|
|
160
|
+
'Text',
|
|
161
|
+
'LongText',
|
|
162
|
+
'Date',
|
|
163
|
+
'DateTime',
|
|
164
|
+
'Time',
|
|
165
|
+
'Number',
|
|
166
|
+
'Percentage',
|
|
167
|
+
'Status',
|
|
168
|
+
'Currency',
|
|
169
|
+
'Checkbox',
|
|
170
|
+
'User',
|
|
171
|
+
'MultiUser',
|
|
172
|
+
'Lookup',
|
|
173
|
+
'LookupMatrix',
|
|
174
|
+
'PhaseGate',
|
|
175
|
+
'Attachment',
|
|
176
|
+
];
|
|
177
|
+
static UNSORTABLE_ENTITY_VIEW_TYPES = new Set(['Attachment', 'Checkbox']);
|
|
178
|
+
static EXPORTABLE_ENTITY_VIEW_TYPES = new Set([
|
|
179
|
+
'Text',
|
|
180
|
+
'LongText',
|
|
181
|
+
'Date',
|
|
182
|
+
'DateTime',
|
|
183
|
+
'Time',
|
|
184
|
+
'Number',
|
|
185
|
+
'Percentage',
|
|
186
|
+
'Status',
|
|
187
|
+
'Currency',
|
|
188
|
+
'Checkbox',
|
|
189
|
+
'User',
|
|
190
|
+
'MultiUser',
|
|
191
|
+
'Lookup',
|
|
192
|
+
'LookupMatrix',
|
|
193
|
+
'PhaseGate',
|
|
194
|
+
]);
|
|
195
|
+
/**
|
|
196
|
+
* `Time` is sortable and exportable but not filterable: a time-of-day has no
|
|
197
|
+
* meaningful date-range filter, and a date picker cannot express one — it
|
|
198
|
+
* would silently filter by day instead of by clock time.
|
|
199
|
+
*/
|
|
200
|
+
static FILTERABLE_ENTITY_VIEW_TYPES = new Set(TableValueResolver.ALL_ENTITY_VIEW_TYPES.filter((viewType) => viewType !== 'Attachment' &&
|
|
201
|
+
viewType !== 'Time' &&
|
|
202
|
+
viewType !== 'MultiUser'));
|
|
203
|
+
/**
|
|
204
|
+
* Sentinel `key` value that resolves to the whole row instead of a property
|
|
205
|
+
* path. Use it when a cell renderer (e.g. `type: 'user'`) needs the full
|
|
206
|
+
* record, not a single field — `key: '{{record}}'` in the column def.
|
|
207
|
+
*/
|
|
208
|
+
static RECORD_KEY = '{{record}}';
|
|
209
|
+
static getProperty(obj, key) {
|
|
210
|
+
if (key === TableValueResolver.RECORD_KEY) {
|
|
211
|
+
return obj;
|
|
212
|
+
}
|
|
213
|
+
return key.split('.').reduce((current, segment) => {
|
|
214
|
+
if (!current || typeof current !== 'object') {
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
return current[segment];
|
|
218
|
+
}, obj);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Recursively scans `value` for any string field that contains `searchTerm`.
|
|
222
|
+
* Used by the general-search box so nested displays (e.g. `name.display` on a
|
|
223
|
+
* lookup row, where the row's top-level `name` is an object) are still
|
|
224
|
+
* matched. `searchTerm` is expected to be lowercase.
|
|
225
|
+
*/
|
|
226
|
+
static matchesSearchTerm(value, searchTerm, depth = 0) {
|
|
227
|
+
if (value === null || value === undefined) {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
if (typeof value === 'string') {
|
|
231
|
+
return value.toLowerCase().includes(searchTerm);
|
|
232
|
+
}
|
|
233
|
+
if (depth >= 4) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
if (Array.isArray(value)) {
|
|
237
|
+
return value.some((entry) => TableValueResolver.matchesSearchTerm(entry, searchTerm, depth + 1));
|
|
238
|
+
}
|
|
239
|
+
if (typeof value === 'object') {
|
|
240
|
+
return Object.values(value).some((entry) => TableValueResolver.matchesSearchTerm(entry, searchTerm, depth + 1));
|
|
241
|
+
}
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
static getColumnFilterType(column, row) {
|
|
245
|
+
if (column.filterConfig?.type) {
|
|
246
|
+
return column.filterConfig.type;
|
|
247
|
+
}
|
|
248
|
+
if (column.type === 'date' || column.type === 'dateTime') {
|
|
249
|
+
return 'date';
|
|
250
|
+
}
|
|
251
|
+
if (column.type === 'number') {
|
|
252
|
+
return 'numberRange';
|
|
253
|
+
}
|
|
254
|
+
if (column.type === 'boolean') {
|
|
255
|
+
return 'boolean';
|
|
256
|
+
}
|
|
257
|
+
if (column.type === 'user') {
|
|
258
|
+
return 'user';
|
|
259
|
+
}
|
|
260
|
+
if (column.type === 'status') {
|
|
261
|
+
return 'select';
|
|
262
|
+
}
|
|
263
|
+
if (column.type !== 'entity') {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
const viewType = TableValueResolver.getEntityViewType(column, row);
|
|
267
|
+
if (!viewType ||
|
|
268
|
+
!TableValueResolver.FILTERABLE_ENTITY_VIEW_TYPES.has(viewType)) {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
switch (viewType) {
|
|
272
|
+
case 'Date':
|
|
273
|
+
case 'DateTime':
|
|
274
|
+
return 'date';
|
|
275
|
+
case 'Checkbox':
|
|
276
|
+
return 'boolean';
|
|
277
|
+
case 'Status':
|
|
278
|
+
case 'Lookup':
|
|
279
|
+
case 'LookupMatrix':
|
|
280
|
+
case 'PhaseGate':
|
|
281
|
+
return 'select';
|
|
282
|
+
case 'User':
|
|
283
|
+
return 'userSelect';
|
|
284
|
+
case 'Percentage':
|
|
285
|
+
case 'Number':
|
|
286
|
+
return 'numberRange';
|
|
287
|
+
case 'Text':
|
|
288
|
+
case 'LongText':
|
|
289
|
+
case 'Currency':
|
|
290
|
+
default:
|
|
291
|
+
return 'text';
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Returns a column with its filterConfig normalized for rendering:
|
|
296
|
+
* - `type` is resolved via `getColumnFilterType`
|
|
297
|
+
* - `options` for `select` filters are auto-generated from `data` when not provided
|
|
298
|
+
*
|
|
299
|
+
* Used by both popover and per-column filter modes so option-building stays in one place.
|
|
300
|
+
*/
|
|
301
|
+
static buildFilterableColumn(column, data) {
|
|
302
|
+
const sampleRow = data[0];
|
|
303
|
+
const filterType = TableValueResolver.getColumnFilterType(column, sampleRow);
|
|
304
|
+
if ((filterType === 'select' || filterType === 'userSelect') &&
|
|
305
|
+
!column.filterConfig?.options?.length) {
|
|
306
|
+
const uniqueOptions = Array.from(data.reduce((options, row) => {
|
|
307
|
+
const value = TableValueResolver.getColumnFilterValue(row, column);
|
|
308
|
+
if (value === null || value === undefined || value === '') {
|
|
309
|
+
return options;
|
|
310
|
+
}
|
|
311
|
+
const optionKey = `${typeof value}:${String(value)}`;
|
|
312
|
+
if (!options.has(optionKey)) {
|
|
313
|
+
options.set(optionKey, {
|
|
314
|
+
label: String(value),
|
|
315
|
+
value,
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
return options;
|
|
319
|
+
}, new Map()))
|
|
320
|
+
.map(([, option]) => option)
|
|
321
|
+
.sort((a, b) => a.label.localeCompare(b.label));
|
|
322
|
+
return {
|
|
323
|
+
...column,
|
|
324
|
+
filterConfig: {
|
|
325
|
+
...column.filterConfig,
|
|
326
|
+
type: filterType,
|
|
327
|
+
options: uniqueOptions,
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
return {
|
|
332
|
+
...column,
|
|
333
|
+
filterConfig: {
|
|
334
|
+
...column.filterConfig,
|
|
335
|
+
type: filterType ?? column.filterConfig?.type ?? 'text',
|
|
336
|
+
},
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Returns true when `item` passes the filter for `key`. Pure function — callers
|
|
341
|
+
* pass `column` so the resolver can apply type-aware normalisation (entity,
|
|
342
|
+
* status, user, date, boolean). Shared by `mt-table` row-filtering and
|
|
343
|
+
* `client-list-cards-view` card-filtering.
|
|
344
|
+
*/
|
|
345
|
+
static matchesFilter(item, key, filterValue, column) {
|
|
346
|
+
if (filterValue === null ||
|
|
347
|
+
filterValue === undefined ||
|
|
348
|
+
filterValue === '' ||
|
|
349
|
+
(typeof filterValue === 'string' && filterValue.trim() === '')) {
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
if (Array.isArray(filterValue)) {
|
|
353
|
+
if (filterValue.length === 0)
|
|
354
|
+
return true;
|
|
355
|
+
return filterValue.some((entry) => TableValueResolver.matchesFilter(item, key, entry, column));
|
|
356
|
+
}
|
|
357
|
+
const itemValue = TableValueResolver.getProperty(item, key);
|
|
358
|
+
const normalizedFilterValue = column
|
|
359
|
+
? TableValueResolver.getColumnFilterValue(item, column)
|
|
360
|
+
: TableValueResolver.resolveDisplayValue(itemValue);
|
|
361
|
+
const filterType = column
|
|
362
|
+
? TableValueResolver.getColumnFilterType(column, item)
|
|
363
|
+
: null;
|
|
364
|
+
if (typeof filterValue === 'object' && filterValue !== null) {
|
|
365
|
+
const objectFilter = filterValue;
|
|
366
|
+
if (filterType === 'numberRange' &&
|
|
367
|
+
(objectFilter.from != null || objectFilter.to != null)) {
|
|
368
|
+
const itemNumericValue = column?.type === 'entity'
|
|
369
|
+
? TableValueResolver.normalizeNumericSortValue(itemValue
|
|
370
|
+
?.rawValue ??
|
|
371
|
+
itemValue?.value ??
|
|
372
|
+
itemValue)
|
|
373
|
+
: TableValueResolver.normalizeNumericSortValue(itemValue);
|
|
374
|
+
if (itemNumericValue === null) {
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
const fromNumeric = objectFilter.from != null ? Number(objectFilter.from) : null;
|
|
378
|
+
const toNumeric = objectFilter.to != null ? Number(objectFilter.to) : null;
|
|
379
|
+
if (fromNumeric !== null &&
|
|
380
|
+
!Number.isNaN(fromNumeric) &&
|
|
381
|
+
itemNumericValue < fromNumeric) {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
if (toNumeric !== null &&
|
|
385
|
+
!Number.isNaN(toNumeric) &&
|
|
386
|
+
itemNumericValue > toNumeric) {
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
if (objectFilter.from || objectFilter.to) {
|
|
392
|
+
const itemDateValue = filterType === 'date'
|
|
393
|
+
? typeof normalizedFilterValue === 'number'
|
|
394
|
+
? normalizedFilterValue
|
|
395
|
+
: normalizedFilterValue != null && normalizedFilterValue !== ''
|
|
396
|
+
? new Date(String(normalizedFilterValue)).getTime()
|
|
397
|
+
: null
|
|
398
|
+
: itemValue instanceof Date
|
|
399
|
+
? itemValue.getTime()
|
|
400
|
+
: new Date(String(itemValue)).getTime();
|
|
401
|
+
if (itemDateValue === null ||
|
|
402
|
+
itemDateValue === undefined ||
|
|
403
|
+
Number.isNaN(itemDateValue)) {
|
|
404
|
+
return true;
|
|
405
|
+
}
|
|
406
|
+
if (objectFilter.from &&
|
|
407
|
+
itemDateValue < new Date(objectFilter.from).getTime()) {
|
|
408
|
+
return false;
|
|
409
|
+
}
|
|
410
|
+
if (objectFilter.to) {
|
|
411
|
+
const toDate = new Date(objectFilter.to);
|
|
412
|
+
toDate.setHours(23, 59, 59, 999);
|
|
413
|
+
if (itemDateValue > toDate.getTime()) {
|
|
414
|
+
return false;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return true;
|
|
418
|
+
}
|
|
419
|
+
if (objectFilter.userName) {
|
|
420
|
+
const normalizedItemUser = itemValue;
|
|
421
|
+
if (!normalizedItemUser)
|
|
422
|
+
return false;
|
|
423
|
+
return (normalizedItemUser['id'] === objectFilter.id ||
|
|
424
|
+
normalizedItemUser['userName'] === objectFilter.userName ||
|
|
425
|
+
normalizedItemUser['displayName'] === objectFilter.displayName);
|
|
426
|
+
}
|
|
427
|
+
if (filterType === 'treeSelect') {
|
|
428
|
+
const filterLabel = TableValueResolver.resolveTreeFilterLabel(filterValue);
|
|
429
|
+
if (!filterLabel) {
|
|
430
|
+
return true;
|
|
431
|
+
}
|
|
432
|
+
const itemLabel = normalizedFilterValue ??
|
|
433
|
+
TableValueResolver.resolveTreeFilterLabel(itemValue);
|
|
434
|
+
return itemLabel === null || itemLabel === undefined
|
|
435
|
+
? false
|
|
436
|
+
: String(itemLabel).toLowerCase().includes(filterLabel.toLowerCase());
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
if (typeof filterValue === 'boolean') {
|
|
440
|
+
return normalizedFilterValue === filterValue;
|
|
441
|
+
}
|
|
442
|
+
if (filterType === 'select' || filterType === 'userSelect') {
|
|
443
|
+
return (String(normalizedFilterValue).toLowerCase() ===
|
|
444
|
+
String(filterValue).trim().toLowerCase());
|
|
445
|
+
}
|
|
446
|
+
if (typeof normalizedFilterValue === 'string' ||
|
|
447
|
+
typeof normalizedFilterValue === 'number') {
|
|
448
|
+
// Trim the query so " john " matches "john smith"; the whitespace-only
|
|
449
|
+
// case already short-circuited via the guard above.
|
|
450
|
+
return String(normalizedFilterValue)
|
|
451
|
+
.toLowerCase()
|
|
452
|
+
.includes(String(filterValue).trim().toLowerCase());
|
|
453
|
+
}
|
|
454
|
+
return normalizedFilterValue === filterValue;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Applies every entry of `filters` against `item` — used by cards view and
|
|
458
|
+
* anywhere else that consumes the same filter shape as mt-table.
|
|
459
|
+
*/
|
|
460
|
+
static matchesAllFilters(item, filters, columns) {
|
|
461
|
+
return Object.keys(filters).every((key) => {
|
|
462
|
+
if (key === 'generalSearch')
|
|
463
|
+
return true;
|
|
464
|
+
const column = columns.find((col) => col.key === key);
|
|
465
|
+
return TableValueResolver.matchesFilter(item, key, filters[key], column);
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* True when a filter slot holds a meaningful value (scalar, text, date-range bounds,
|
|
470
|
+
* or user lookup). Shared by popover and per-column modes to compute active counts.
|
|
471
|
+
*/
|
|
472
|
+
static hasFilterValue(value) {
|
|
473
|
+
if (value === null || value === undefined || value === '') {
|
|
474
|
+
return false;
|
|
475
|
+
}
|
|
476
|
+
// A whitespace-only text filter is not a real value — keeps it out of the
|
|
477
|
+
// active-filter count and makes the column-filter Apply clear instead of
|
|
478
|
+
// committing " ".
|
|
479
|
+
if (typeof value === 'string') {
|
|
480
|
+
return value.trim().length > 0;
|
|
481
|
+
}
|
|
482
|
+
if (Array.isArray(value)) {
|
|
483
|
+
return value.length > 0;
|
|
484
|
+
}
|
|
485
|
+
if (typeof value === 'object') {
|
|
486
|
+
const filterValue = value;
|
|
487
|
+
return (filterValue.from != null ||
|
|
488
|
+
filterValue.to != null ||
|
|
489
|
+
filterValue.value != null ||
|
|
490
|
+
filterValue.userName != null ||
|
|
491
|
+
filterValue.id != null ||
|
|
492
|
+
filterValue.key != null ||
|
|
493
|
+
filterValue.label != null ||
|
|
494
|
+
filterValue.data != null);
|
|
495
|
+
}
|
|
496
|
+
return true;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Produces the filter payload a cell-click should apply for `column`.
|
|
500
|
+
* Returns null when the cell type is not click-filterable.
|
|
501
|
+
*
|
|
502
|
+
* Shapes match `Table.matchesFilter` branches:
|
|
503
|
+
* - user / entity(User) → `{ id, userName, displayName }`
|
|
504
|
+
* - status / entity(Status|Lookup) → scalar display string
|
|
505
|
+
* - boolean → boolean
|
|
506
|
+
*/
|
|
507
|
+
static buildClickFilterValue(row, column) {
|
|
508
|
+
const cellValue = TableValueResolver.getProperty(row, column.key);
|
|
509
|
+
if (cellValue === null || cellValue === undefined || cellValue === '') {
|
|
510
|
+
return null;
|
|
511
|
+
}
|
|
512
|
+
const filterType = TableValueResolver.getColumnFilterType(column, row);
|
|
513
|
+
if (column.type === 'user' || filterType === 'user') {
|
|
514
|
+
// Entity(User) envelopes store the user object under `.value`; plain user
|
|
515
|
+
// columns may hold it directly. Both paths produce the {id,userName,displayName} shape.
|
|
516
|
+
const source = column.type === 'entity' &&
|
|
517
|
+
cellValue &&
|
|
518
|
+
typeof cellValue === 'object' &&
|
|
519
|
+
'value' in cellValue
|
|
520
|
+
? cellValue['value']
|
|
521
|
+
: cellValue;
|
|
522
|
+
return TableValueResolver.extractUserFilterValue(source);
|
|
523
|
+
}
|
|
524
|
+
// Entity-typed columns carry a `{ viewType, value, rawValue, ... }` envelope.
|
|
525
|
+
// Unwrap once so boolean / scalar branches below operate on the inner value,
|
|
526
|
+
// matching what `matchesFilter` -> `getColumnFilterValue` compares against.
|
|
527
|
+
const normalized = column.type === 'entity'
|
|
528
|
+
? TableValueResolver.getEntityValueByType(cellValue, 'filter')
|
|
529
|
+
: cellValue;
|
|
530
|
+
if (normalized === null || normalized === undefined || normalized === '') {
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
if (filterType === 'boolean') {
|
|
534
|
+
return TableValueResolver.resolveBooleanValue(normalized);
|
|
535
|
+
}
|
|
536
|
+
if (filterType === 'select' ||
|
|
537
|
+
filterType === 'userSelect' ||
|
|
538
|
+
filterType === 'text') {
|
|
539
|
+
if (column.type === 'entity') {
|
|
540
|
+
return String(normalized);
|
|
541
|
+
}
|
|
542
|
+
const display = TableValueResolver.resolveDisplayValue(cellValue);
|
|
543
|
+
return display === null ? null : String(display);
|
|
544
|
+
}
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* True when two filter values refer to the same thing. Mirrors the branches
|
|
549
|
+
* in `Table.matchesFilter`: scalar equality, boolean equality, or user-object
|
|
550
|
+
* identity on id / userName / displayName.
|
|
551
|
+
*/
|
|
552
|
+
static isFilterValueEqual(a, b) {
|
|
553
|
+
if (a === b)
|
|
554
|
+
return true;
|
|
555
|
+
if (a === null || a === undefined || b === null || b === undefined) {
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
558
|
+
if (typeof a === 'object' && typeof b === 'object') {
|
|
559
|
+
const left = a;
|
|
560
|
+
const right = b;
|
|
561
|
+
if (left['id'] != null && left['id'] === right['id'])
|
|
562
|
+
return true;
|
|
563
|
+
if (left['key'] != null && left['key'] === right['key'])
|
|
564
|
+
return true;
|
|
565
|
+
if (left['userName'] != null && left['userName'] === right['userName']) {
|
|
566
|
+
return true;
|
|
567
|
+
}
|
|
568
|
+
if (left['displayName'] != null &&
|
|
569
|
+
left['displayName'] === right['displayName']) {
|
|
570
|
+
return true;
|
|
571
|
+
}
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
return String(a) === String(b);
|
|
575
|
+
}
|
|
576
|
+
static extractUserFilterValue(value) {
|
|
577
|
+
if (value === null || value === undefined)
|
|
578
|
+
return null;
|
|
579
|
+
if (typeof value === 'object') {
|
|
580
|
+
const record = value;
|
|
581
|
+
const inner = record['value'] && typeof record['value'] === 'object'
|
|
582
|
+
? record['value']
|
|
583
|
+
: record;
|
|
584
|
+
const id = inner['id'];
|
|
585
|
+
const userName = inner['userName'] ?? inner['username'];
|
|
586
|
+
const displayName = inner['displayName'] ?? inner['name'];
|
|
587
|
+
if (id == null && userName == null && displayName == null) {
|
|
588
|
+
const fallback = TableValueResolver.resolveDisplayValue(value);
|
|
589
|
+
return fallback === null ? null : String(fallback);
|
|
590
|
+
}
|
|
591
|
+
return {
|
|
592
|
+
...(id != null ? { id } : {}),
|
|
593
|
+
...(userName != null ? { userName } : {}),
|
|
594
|
+
...(displayName != null ? { displayName } : {}),
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
return String(value);
|
|
598
|
+
}
|
|
599
|
+
static getColumnFilterValue(row, column) {
|
|
600
|
+
const cellValue = TableValueResolver.getProperty(row, column.key);
|
|
601
|
+
if (cellValue === null || cellValue === undefined) {
|
|
602
|
+
return null;
|
|
603
|
+
}
|
|
604
|
+
if (column.type === 'entity') {
|
|
605
|
+
const filterType = TableValueResolver.getColumnFilterType(column, row);
|
|
606
|
+
if (filterType === 'date') {
|
|
607
|
+
return TableValueResolver.getEntityValueByType(cellValue, 'sort');
|
|
608
|
+
}
|
|
609
|
+
return TableValueResolver.getEntityValueByType(cellValue, 'filter');
|
|
610
|
+
}
|
|
611
|
+
if (column.type === 'date' || column.type === 'dateTime') {
|
|
612
|
+
return TableValueResolver.normalizeDateSortValue(cellValue);
|
|
613
|
+
}
|
|
614
|
+
if (column.type === 'number') {
|
|
615
|
+
return TableValueResolver.normalizeNumericSortValue(cellValue);
|
|
616
|
+
}
|
|
617
|
+
if (column.type === 'boolean') {
|
|
618
|
+
return TableValueResolver.resolveBooleanValue(cellValue);
|
|
619
|
+
}
|
|
620
|
+
return TableValueResolver.resolveDisplayValue(cellValue);
|
|
621
|
+
}
|
|
622
|
+
static resolveDateValue(value) {
|
|
623
|
+
if (value === null || value === undefined || value === '') {
|
|
624
|
+
return null;
|
|
625
|
+
}
|
|
626
|
+
if (typeof value === 'string' ||
|
|
627
|
+
typeof value === 'number' ||
|
|
628
|
+
value instanceof Date) {
|
|
629
|
+
return value;
|
|
630
|
+
}
|
|
631
|
+
if (typeof value === 'object') {
|
|
632
|
+
const objectValue = value;
|
|
633
|
+
return TableValueResolver.resolveDateValue(objectValue['actualValue'] ??
|
|
634
|
+
objectValue['rawValue'] ??
|
|
635
|
+
objectValue['value'] ??
|
|
636
|
+
objectValue['displayValue']);
|
|
637
|
+
}
|
|
638
|
+
return String(value);
|
|
639
|
+
}
|
|
640
|
+
static getEntityValueByType(value, usage) {
|
|
641
|
+
if (value === null || value === undefined) {
|
|
642
|
+
return null;
|
|
643
|
+
}
|
|
644
|
+
if (typeof value !== 'object') {
|
|
645
|
+
return TableValueResolver.resolveDisplayValue(value);
|
|
646
|
+
}
|
|
647
|
+
const entityData = value;
|
|
648
|
+
// ChangeRequest snapshot cells carry a frozen old→new comparison. On screen
|
|
649
|
+
// the cell renders the "after" side (see EntityPreview/ComparisonValue), so
|
|
650
|
+
// export/sort/filter must resolve that same new value — not `entityData.value`,
|
|
651
|
+
// which is the pre-change base and would export identically for every row.
|
|
652
|
+
if (entityData.comparison?.kind === 'Value') {
|
|
653
|
+
const after = entityData.comparison.newValue;
|
|
654
|
+
return TableValueResolver.getEntityValueByType({
|
|
655
|
+
...entityData,
|
|
656
|
+
value: (after.display ?? after.value ?? ''),
|
|
657
|
+
comparison: undefined,
|
|
658
|
+
}, usage);
|
|
659
|
+
}
|
|
660
|
+
if (usage === 'sort' &&
|
|
661
|
+
TableValueResolver.UNSORTABLE_ENTITY_VIEW_TYPES.has(entityData.viewType)) {
|
|
662
|
+
return null;
|
|
663
|
+
}
|
|
664
|
+
if (usage === 'export' &&
|
|
665
|
+
!TableValueResolver.EXPORTABLE_ENTITY_VIEW_TYPES.has(entityData.viewType)) {
|
|
666
|
+
return TableValueResolver.resolveDisplayValue(entityData.value);
|
|
667
|
+
}
|
|
668
|
+
switch (entityData.viewType) {
|
|
669
|
+
case 'Currency':
|
|
670
|
+
case 'Percentage':
|
|
671
|
+
case 'Number':
|
|
672
|
+
return usage === 'sort'
|
|
673
|
+
? TableValueResolver.normalizeNumericSortValue(entityData.rawValue ?? entityData.value)
|
|
674
|
+
: TableValueResolver.resolveDisplayValue(entityData.value);
|
|
675
|
+
case 'Date':
|
|
676
|
+
case 'DateTime':
|
|
677
|
+
return usage === 'sort'
|
|
678
|
+
? TableValueResolver.normalizeDateSortValue(entityData.rawValue ?? entityData.value)
|
|
679
|
+
: TableValueResolver.resolveDisplayValue(entityData.value);
|
|
680
|
+
// `Time` sorts by clock, not by instant — a time of day has no calendar
|
|
681
|
+
// date to order by. Its export runs through `mtDateFormat` in the
|
|
682
|
+
// table/cards date path, not here, because the backend `value` for a Time
|
|
683
|
+
// property is the unformatted stored value.
|
|
684
|
+
case 'Time':
|
|
685
|
+
return usage === 'sort'
|
|
686
|
+
? TableValueResolver.normalizeClockSortValue(entityData.rawValue ?? entityData.value)
|
|
687
|
+
: TableValueResolver.resolveDisplayValue(entityData.value);
|
|
688
|
+
case 'Checkbox':
|
|
689
|
+
return TableValueResolver.resolveBooleanValue(entityData.rawValue ?? entityData.value);
|
|
690
|
+
case 'LongText':
|
|
691
|
+
// Rich-text value holds HTML (rendered via [innerHTML] on screen).
|
|
692
|
+
// Strip tags so the export shows clean text instead of <p>…</p> markup.
|
|
693
|
+
return TableValueResolver.stripHtml(TableValueResolver.resolveDisplayValue(entityData.value));
|
|
694
|
+
case 'MultiUser': {
|
|
695
|
+
const users = Array.isArray(entityData.value)
|
|
696
|
+
? entityData.value
|
|
697
|
+
: [];
|
|
698
|
+
const names = users
|
|
699
|
+
.map((user) => user.displayName ?? user.name ?? user.userName)
|
|
700
|
+
.filter((name) => typeof name === 'string' && name.trim().length > 0);
|
|
701
|
+
return names.length ? names.join(', ') : null;
|
|
702
|
+
}
|
|
703
|
+
case 'Status':
|
|
704
|
+
case 'Lookup':
|
|
705
|
+
case 'PhaseGate':
|
|
706
|
+
case 'User':
|
|
707
|
+
case 'Text':
|
|
708
|
+
default:
|
|
709
|
+
return TableValueResolver.resolveDisplayValue(entityData.value);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
// Export cells use simple rich-text markup. Keep this lightweight unless
|
|
713
|
+
// nested or encoded markup requires a DOM parser later.
|
|
714
|
+
static stripHtml(value) {
|
|
715
|
+
if (typeof value !== 'string') {
|
|
716
|
+
return value;
|
|
717
|
+
}
|
|
718
|
+
const text = value
|
|
719
|
+
.replace(/<br\s*\/?>/gi, ' ')
|
|
720
|
+
.replace(/<\/(p|div|li|h[1-6])>/gi, ' ')
|
|
721
|
+
.replace(/<[^>]*>/g, '')
|
|
722
|
+
.replace(/ /gi, ' ')
|
|
723
|
+
.replace(/&/gi, '&')
|
|
724
|
+
.replace(/</gi, '<')
|
|
725
|
+
.replace(/>/gi, '>')
|
|
726
|
+
.replace(/"/gi, '"')
|
|
727
|
+
.replace(/'/gi, "'")
|
|
728
|
+
.replace(/\s+/g, ' ')
|
|
729
|
+
.trim();
|
|
730
|
+
return text === '' ? null : text;
|
|
731
|
+
}
|
|
732
|
+
static resolveDisplayValue(value) {
|
|
733
|
+
if (value === null || value === undefined || value === '') {
|
|
734
|
+
return null;
|
|
735
|
+
}
|
|
736
|
+
if (typeof value === 'string' ||
|
|
737
|
+
typeof value === 'number' ||
|
|
738
|
+
typeof value === 'boolean') {
|
|
739
|
+
return value;
|
|
740
|
+
}
|
|
741
|
+
if (value instanceof Date) {
|
|
742
|
+
return value.toISOString();
|
|
743
|
+
}
|
|
744
|
+
if (typeof value === 'object') {
|
|
745
|
+
const objectValue = value;
|
|
746
|
+
const displayCandidate = objectValue['display'] ??
|
|
747
|
+
objectValue['displayValue'] ??
|
|
748
|
+
objectValue['displayName'] ??
|
|
749
|
+
objectValue['pathLabel'] ??
|
|
750
|
+
objectValue['name'] ??
|
|
751
|
+
objectValue['label'] ??
|
|
752
|
+
objectValue['code'] ??
|
|
753
|
+
objectValue['value'];
|
|
754
|
+
return TableValueResolver.resolveDisplayValue(displayCandidate);
|
|
755
|
+
}
|
|
756
|
+
return String(value);
|
|
757
|
+
}
|
|
758
|
+
static resolveBooleanValue(value) {
|
|
759
|
+
if (value === null || value === undefined || value === '') {
|
|
760
|
+
return null;
|
|
761
|
+
}
|
|
762
|
+
if (typeof value === 'boolean') {
|
|
763
|
+
return value;
|
|
764
|
+
}
|
|
765
|
+
if (typeof value === 'string') {
|
|
766
|
+
return ['true', '1', 'yes', 'on'].includes(value.toLowerCase());
|
|
767
|
+
}
|
|
768
|
+
if (typeof value === 'number') {
|
|
769
|
+
return value === 1;
|
|
770
|
+
}
|
|
771
|
+
return null;
|
|
772
|
+
}
|
|
773
|
+
static normalizeTextSortValue(value) {
|
|
774
|
+
if (value === null || value === undefined || value === '') {
|
|
775
|
+
return null;
|
|
776
|
+
}
|
|
777
|
+
return String(value).toLocaleLowerCase();
|
|
778
|
+
}
|
|
779
|
+
static normalizeNumericSortValue(value) {
|
|
780
|
+
if (value === null || value === undefined || value === '') {
|
|
781
|
+
return null;
|
|
782
|
+
}
|
|
783
|
+
const numericValue = typeof value === 'number'
|
|
784
|
+
? value
|
|
785
|
+
: Number.parseFloat(String(value).replace(/[^0-9.-]/g, ''));
|
|
786
|
+
return Number.isNaN(numericValue) ? null : numericValue;
|
|
787
|
+
}
|
|
788
|
+
static normalizeDateSortValue(value) {
|
|
789
|
+
const resolvedValue = TableValueResolver.resolveDateValue(value);
|
|
790
|
+
if (resolvedValue === null ||
|
|
791
|
+
resolvedValue === undefined ||
|
|
792
|
+
resolvedValue === '') {
|
|
793
|
+
return null;
|
|
794
|
+
}
|
|
795
|
+
const timestamp = resolvedValue instanceof Date
|
|
796
|
+
? resolvedValue.getTime()
|
|
797
|
+
: new Date(String(resolvedValue)).getTime();
|
|
798
|
+
return Number.isNaN(timestamp) ? null : timestamp;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Order a `Time` cell by seconds since midnight. The stored shape is a
|
|
802
|
+
* wall-clock `HH:mm:ss`, which `Date` cannot parse at all; values still held
|
|
803
|
+
* as a full instant contribute their local clock, so a column holding both
|
|
804
|
+
* shapes still sorts by time of day rather than by the date part.
|
|
805
|
+
*/
|
|
806
|
+
static normalizeClockSortValue(value) {
|
|
807
|
+
const resolvedValue = TableValueResolver.resolveDateValue(value);
|
|
808
|
+
if (resolvedValue === null ||
|
|
809
|
+
resolvedValue === undefined ||
|
|
810
|
+
resolvedValue === '') {
|
|
811
|
+
return null;
|
|
812
|
+
}
|
|
813
|
+
const clockTime = parseClockTime(resolvedValue);
|
|
814
|
+
if (clockTime)
|
|
815
|
+
return clockTimeToSeconds(clockTime);
|
|
816
|
+
const parsed = resolvedValue instanceof Date
|
|
817
|
+
? resolvedValue
|
|
818
|
+
: new Date(String(resolvedValue));
|
|
819
|
+
const parsedClockTime = toClockTimeParts(parsed);
|
|
820
|
+
return parsedClockTime ? clockTimeToSeconds(parsedClockTime) : null;
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Resolves an entity column's view type from the column def, falling back to
|
|
824
|
+
* a sample row's cell. Public because grouping decides what it can bucket
|
|
825
|
+
* from the entity view type, which is finer-grained than the filter type
|
|
826
|
+
* (`Lookup` and `LookupMatrix` both filter as `select`-ish but only the view
|
|
827
|
+
* type says whether the values are categorical).
|
|
828
|
+
*/
|
|
829
|
+
static getEntityViewType(column, row) {
|
|
830
|
+
const explicitViewType = column.viewType;
|
|
831
|
+
if (TableValueResolver.isEntityViewType(explicitViewType)) {
|
|
832
|
+
return explicitViewType;
|
|
833
|
+
}
|
|
834
|
+
const cellValue = row
|
|
835
|
+
? TableValueResolver.getProperty(row, column.key)
|
|
836
|
+
: undefined;
|
|
837
|
+
if (cellValue &&
|
|
838
|
+
typeof cellValue === 'object' &&
|
|
839
|
+
'viewType' in cellValue) {
|
|
840
|
+
const viewType = cellValue.viewType;
|
|
841
|
+
if (TableValueResolver.isEntityViewType(viewType)) {
|
|
842
|
+
return viewType;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
return null;
|
|
846
|
+
}
|
|
847
|
+
static isEntityViewType(value) {
|
|
848
|
+
return (typeof value === 'string' &&
|
|
849
|
+
TableValueResolver.ALL_ENTITY_VIEW_TYPES.includes(value));
|
|
850
|
+
}
|
|
851
|
+
static resolveTreeFilterLabel(value) {
|
|
852
|
+
if (!value || typeof value !== 'object') {
|
|
853
|
+
return null;
|
|
854
|
+
}
|
|
855
|
+
const record = value;
|
|
856
|
+
const data = record['data'];
|
|
857
|
+
if (data && typeof data === 'object') {
|
|
858
|
+
const pathLabel = data['pathLabel'];
|
|
859
|
+
if (typeof pathLabel === 'string' && pathLabel.trim().length > 0) {
|
|
860
|
+
return pathLabel.trim();
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
const pathLabel = record['pathLabel'];
|
|
864
|
+
if (typeof pathLabel === 'string' && pathLabel.trim().length > 0) {
|
|
865
|
+
return pathLabel.trim();
|
|
866
|
+
}
|
|
867
|
+
const label = record['label'];
|
|
868
|
+
if (typeof label === 'string' && label.trim().length > 0) {
|
|
869
|
+
return label.trim();
|
|
870
|
+
}
|
|
871
|
+
const key = record['key'];
|
|
872
|
+
return typeof key === 'string' && key.trim().length > 0 ? key.trim() : null;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Renders a single filter control for one `ColumnDef`, dispatching on
|
|
878
|
+
* `column.filterConfig.type` (`text` | `select` | `treeSelect` | `date`
|
|
879
|
+
* | `boolean` | `user` | `numberRange`).
|
|
880
|
+
*
|
|
881
|
+
* Two-way binds the filter value via `value` / `valueChange`. Shared by both
|
|
882
|
+
* filter UX modes (popover + per-column) so field rendering lives in one place.
|
|
883
|
+
* Add a new filter type by adding a `@case` in the template and extending
|
|
884
|
+
* `FilterConfig['type']`.
|
|
885
|
+
*/
|
|
886
|
+
const EMPTY_MULTI_VALUE = Object.freeze([]);
|
|
887
|
+
const DEFAULT_NUMBER_RANGE_MIN = -999999999999999;
|
|
888
|
+
const DEFAULT_NUMBER_RANGE_MAX = 999999999999999;
|
|
889
|
+
const PERCENTAGE_RANGE_MIN = 0;
|
|
890
|
+
const PERCENTAGE_RANGE_MAX = 100;
|
|
891
|
+
class TableFilterField {
|
|
892
|
+
column = input.required(...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
|
|
893
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
894
|
+
transloco = inject(TranslocoService);
|
|
895
|
+
booleanOptions = computed(() => [
|
|
896
|
+
{ label: this.transloco.translate('components.table.yes'), value: true },
|
|
897
|
+
{ label: this.transloco.translate('components.table.no'), value: false },
|
|
898
|
+
], ...(ngDevMode ? [{ debugName: "booleanOptions" }] : /* istanbul ignore next */ []));
|
|
899
|
+
multiValue = computed(() => {
|
|
900
|
+
const current = this.value();
|
|
901
|
+
if (Array.isArray(current))
|
|
902
|
+
return current;
|
|
903
|
+
if (current === null || current === undefined || current === '') {
|
|
904
|
+
return EMPTY_MULTI_VALUE;
|
|
905
|
+
}
|
|
906
|
+
return [current];
|
|
907
|
+
}, ...(ngDevMode ? [{ debugName: "multiValue" }] : /* istanbul ignore next */ []));
|
|
908
|
+
filterOptions = computed(() => this.column().filterConfig?.options ?? EMPTY_MULTI_VALUE, ...(ngDevMode ? [{ debugName: "filterOptions" }] : /* istanbul ignore next */ []));
|
|
909
|
+
treeOptions = computed(() => this.column().filterConfig?.treeOptions ?? [], ...(ngDevMode ? [{ debugName: "treeOptions" }] : /* istanbul ignore next */ []));
|
|
910
|
+
getFilterType() {
|
|
911
|
+
return this.column().filterConfig?.type ?? 'text';
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* `select` / `userSelect` filters default to multi-select unless the caller
|
|
915
|
+
* opts out with `filterConfig.multiple: false`.
|
|
916
|
+
*/
|
|
917
|
+
isMultiple() {
|
|
918
|
+
return this.column().filterConfig?.multiple !== false;
|
|
919
|
+
}
|
|
920
|
+
getScalarValue() {
|
|
921
|
+
const current = this.value();
|
|
922
|
+
return current?.value ?? current ?? null;
|
|
923
|
+
}
|
|
924
|
+
getDateRangeValue(part) {
|
|
925
|
+
const current = this.value();
|
|
926
|
+
if (!current || typeof current !== 'object')
|
|
927
|
+
return null;
|
|
928
|
+
const raw = part === 'from' ? current.from : current.to;
|
|
929
|
+
if (raw == null)
|
|
930
|
+
return null;
|
|
931
|
+
return raw instanceof Date ? raw : new Date(raw);
|
|
932
|
+
}
|
|
933
|
+
getNumberRangeValue(part) {
|
|
934
|
+
const current = this.value();
|
|
935
|
+
if (!current || typeof current !== 'object')
|
|
936
|
+
return null;
|
|
937
|
+
const raw = part === 'from' ? current.from : current.to;
|
|
938
|
+
return typeof raw === 'number' ? raw : raw == null ? null : Number(raw);
|
|
939
|
+
}
|
|
940
|
+
getNumberRangeMin() {
|
|
941
|
+
const configured = this.resolveConfiguredNumber('min');
|
|
942
|
+
if (configured !== null)
|
|
943
|
+
return configured;
|
|
944
|
+
return this.isPercentageColumn()
|
|
945
|
+
? PERCENTAGE_RANGE_MIN
|
|
946
|
+
: DEFAULT_NUMBER_RANGE_MIN;
|
|
947
|
+
}
|
|
948
|
+
getNumberRangeMax() {
|
|
949
|
+
const configured = this.resolveConfiguredNumber('max');
|
|
950
|
+
if (configured !== null)
|
|
951
|
+
return configured;
|
|
952
|
+
return this.isPercentageColumn()
|
|
953
|
+
? PERCENTAGE_RANGE_MAX
|
|
954
|
+
: DEFAULT_NUMBER_RANGE_MAX;
|
|
955
|
+
}
|
|
956
|
+
updateScalar(next) {
|
|
957
|
+
this.value.set(next);
|
|
958
|
+
}
|
|
959
|
+
getTreePlaceholder() {
|
|
960
|
+
const configured = this.column().filterConfig?.['placeholder'];
|
|
961
|
+
if (typeof configured === 'string' && configured.trim().length > 0) {
|
|
962
|
+
return configured;
|
|
963
|
+
}
|
|
964
|
+
return `${this.transloco.translate('components.table.select')} ${this.column().filterConfig?.label || this.column().label}`;
|
|
965
|
+
}
|
|
966
|
+
getTreeFilterBy() {
|
|
967
|
+
const configured = this.column().filterConfig?.['filterBy'];
|
|
968
|
+
return typeof configured === 'string' && configured.trim().length > 0
|
|
969
|
+
? configured
|
|
970
|
+
: 'label,data.pathLabel';
|
|
971
|
+
}
|
|
972
|
+
getTreeFilterPlaceholder() {
|
|
973
|
+
const configured = this.column().filterConfig?.['filterPlaceholder'];
|
|
974
|
+
return typeof configured === 'string' && configured.trim().length > 0
|
|
975
|
+
? configured
|
|
976
|
+
: this.transloco.translate('components.table.search');
|
|
977
|
+
}
|
|
978
|
+
getTreeScrollHeight() {
|
|
979
|
+
const configured = this.column().filterConfig?.['scrollHeight'];
|
|
980
|
+
return typeof configured === 'string' && configured.trim().length > 0
|
|
981
|
+
? configured
|
|
982
|
+
: '20rem';
|
|
983
|
+
}
|
|
984
|
+
getTreePanelStyleClass() {
|
|
985
|
+
const configured = this.column().filterConfig?.['panelStyleClass'];
|
|
986
|
+
return typeof configured === 'string' && configured.trim().length > 0
|
|
987
|
+
? configured
|
|
988
|
+
: undefined;
|
|
989
|
+
}
|
|
990
|
+
updateDate(part, next) {
|
|
991
|
+
const current = this.value() ?? {};
|
|
992
|
+
this.value.set({ ...current, [part]: next });
|
|
993
|
+
}
|
|
994
|
+
updateNumber(part, next) {
|
|
995
|
+
const current = this.value() ?? {};
|
|
996
|
+
this.value.set({ ...current, [part]: this.clampNumberRangeValue(next) });
|
|
997
|
+
}
|
|
998
|
+
isPercentageColumn() {
|
|
999
|
+
return this.column().viewType === 'Percentage';
|
|
1000
|
+
}
|
|
1001
|
+
resolveConfiguredNumber(key) {
|
|
1002
|
+
const configured = this.column().filterConfig?.[key];
|
|
1003
|
+
if (typeof configured === 'number' && Number.isFinite(configured)) {
|
|
1004
|
+
return configured;
|
|
1005
|
+
}
|
|
1006
|
+
if (typeof configured === 'string' && configured.trim()) {
|
|
1007
|
+
const parsed = Number(configured);
|
|
1008
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
1009
|
+
}
|
|
1010
|
+
return null;
|
|
1011
|
+
}
|
|
1012
|
+
clampNumberRangeValue(value) {
|
|
1013
|
+
if (value === null || value === undefined)
|
|
1014
|
+
return null;
|
|
1015
|
+
const numericValue = Number(value);
|
|
1016
|
+
if (!Number.isFinite(numericValue))
|
|
1017
|
+
return null;
|
|
1018
|
+
return Math.min(this.getNumberRangeMax(), Math.max(this.getNumberRangeMin(), numericValue));
|
|
1019
|
+
}
|
|
1020
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableFilterField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1021
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: TableFilterField, isStandalone: true, selector: "mt-table-filter-field", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, ngImport: i0, template: "@switch (getFilterType()) {\r\n @case (\"text\") {\r\n <mt-text-field\r\n [ngModel]=\"getScalarValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [placeholder]=\"\r\n ('components.table.select' | transloco) +\r\n ' ' +\r\n (column().filterConfig?.label || column().label)\r\n \"\r\n />\r\n }\r\n @case (\"select\") {\r\n @if (isMultiple()) {\r\n <mt-multi-select-field\r\n [ngModel]=\"multiValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [options]=\"filterOptions()\"\r\n [placeholder]=\"\r\n ('components.table.select' | transloco) +\r\n ' ' +\r\n (column().filterConfig?.label || column().label)\r\n \"\r\n [showClear]=\"true\"\r\n [filter]=\"true\"\r\n filterBy=\"label\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n />\r\n } @else {\r\n <mt-select-field\r\n [ngModel]=\"getScalarValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [options]=\"filterOptions()\"\r\n [placeholder]=\"\r\n ('components.table.select' | transloco) +\r\n ' ' +\r\n (column().filterConfig?.label || column().label)\r\n \"\r\n [hasPlaceholderPrefix]=\"false\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n showClear\r\n />\r\n }\r\n }\r\n @case (\"userSelect\") {\r\n @if (isMultiple()) {\r\n <mt-multi-select-field\r\n [ngModel]=\"multiValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [options]=\"filterOptions()\"\r\n [placeholder]=\"\r\n ('components.table.select' | transloco) +\r\n ' ' +\r\n (column().filterConfig?.label || column().label)\r\n \"\r\n [showClear]=\"true\"\r\n [filter]=\"true\"\r\n filterBy=\"label\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n />\r\n } @else {\r\n <mt-select-field\r\n [ngModel]=\"getScalarValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [options]=\"filterOptions()\"\r\n [placeholder]=\"\r\n ('components.table.select' | transloco) +\r\n ' ' +\r\n (column().filterConfig?.label || column().label)\r\n \"\r\n [hasPlaceholderPrefix]=\"false\"\r\n [markCurrentUser]=\"true\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n showClear\r\n />\r\n }\r\n }\r\n @case (\"treeSelect\") {\r\n <mt-treeselect-field\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [options]=\"treeOptions()\"\r\n [placeholder]=\"getTreePlaceholder()\"\r\n [selectionMode]=\"$any(column().filterConfig)?.selectionMode || 'single'\"\r\n [scrollHeight]=\"getTreeScrollHeight()\"\r\n [panelStyleClass]=\"getTreePanelStyleClass()\"\r\n [filter]=\"column().filterConfig?.['filter'] !== false\"\r\n [filterBy]=\"getTreeFilterBy()\"\r\n [filterPlaceholder]=\"getTreeFilterPlaceholder()\"\r\n [showClear]=\"column().filterConfig?.['showClear'] !== false\"\r\n [resetFilterOnHide]=\"\r\n column().filterConfig?.['resetFilterOnHide'] !== false\r\n \"\r\n [overlayOptions]=\"$any(column().filterConfig)?.overlayOptions\"\r\n />\r\n }\r\n @case (\"date\") {\r\n <div class=\"space-y-3\">\r\n <div class=\"space-y-1\">\r\n <label\r\n class=\"block text-sm font-medium text-gray-700 dark:text-gray-300\"\r\n >\r\n {{ \"components.table.from\" | transloco }}\r\n </label>\r\n <mt-date-field\r\n [ngModel]=\"getDateRangeValue('from')\"\r\n (ngModelChange)=\"updateDate('from', $event)\"\r\n [placeholder]=\"'components.table.from' | transloco\"\r\n />\r\n </div>\r\n <div class=\"space-y-1\">\r\n <label\r\n class=\"block text-sm font-medium text-gray-700 dark:text-gray-300\"\r\n >\r\n {{ \"components.table.to\" | transloco }}\r\n </label>\r\n <mt-date-field\r\n [ngModel]=\"getDateRangeValue('to')\"\r\n (ngModelChange)=\"updateDate('to', $event)\"\r\n [placeholder]=\"'components.table.to' | transloco\"\r\n />\r\n </div>\r\n </div>\r\n }\r\n @case (\"boolean\") {\r\n <mt-select-field\r\n [ngModel]=\"getScalarValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [options]=\"booleanOptions()\"\r\n [placeholder]=\"'components.table.select' | transloco\"\r\n [hasPlaceholderPrefix]=\"false\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n showClear\r\n />\r\n }\r\n @case (\"user\") {\r\n <mt-user-search-field\r\n [ngModel]=\"getScalarValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [placeholder]=\"column().filterConfig?.label || column().label\"\r\n [apiUrl]=\"column().filterConfig?.apiUrl ?? ''\"\r\n [context]=\"column().filterConfig?.context\"\r\n />\r\n }\r\n @case (\"numberRange\") {\r\n <div class=\"space-y-3\">\r\n <div class=\"space-y-1\">\r\n <label\r\n class=\"block text-sm font-medium text-gray-700 dark:text-gray-300\"\r\n >\r\n {{ \"components.table.from\" | transloco }}\r\n </label>\r\n <mt-number-field\r\n [ngModel]=\"getNumberRangeValue('from')\"\r\n (ngModelChange)=\"updateNumber('from', $event)\"\r\n [placeholder]=\"'components.table.from' | transloco\"\r\n [min]=\"getNumberRangeMin()\"\r\n [max]=\"getNumberRangeMax()\"\r\n />\r\n </div>\r\n <div class=\"space-y-1\">\r\n <label\r\n class=\"block text-sm font-medium text-gray-700 dark:text-gray-300\"\r\n >\r\n {{ \"components.table.to\" | transloco }}\r\n </label>\r\n <mt-number-field\r\n [ngModel]=\"getNumberRangeValue('to')\"\r\n (ngModelChange)=\"updateNumber('to', $event)\"\r\n [placeholder]=\"'components.table.to' | transloco\"\r\n [min]=\"getNumberRangeMin()\"\r\n [max]=\"getNumberRangeMax()\"\r\n />\r\n </div>\r\n </div>\r\n }\r\n}\r\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: NumberField, selector: "mt-number-field", inputs: ["field", "hint", "label", "placeholder", "class", "readonly", "pInputs", "format", "useGrouping", "maxFractionDigits", "min", "max", "required"] }, { kind: "component", type: SelectField, selector: "mt-select-field", inputs: ["field", "hint", "label", "placeholder", "hasPlaceholderPrefix", "class", "readonly", "pInputs", "options", "optionValue", "optionLabel", "filter", "filterBy", "dataKey", "showClear", "clearAfterSelect", "required", "group", "size", "optionGroupLabel", "optionGroupChildren", "loading", "optionIcon", "optionIconColor", "optionIconShape", "optionAvatarShape", "optionGroupIcon", "optionGroupIconColor", "optionGroupIconShape", "optionGroupAvatarShape", "markCurrentUser"], outputs: ["onChange"] }, { kind: "component", type: MultiSelectField, selector: "mt-multi-select-field", inputs: ["field", "label", "placeholder", "class", "readonly", "pInputs", "options", "optionValue", "optionLabel", "filter", "filterBy", "dataKey", "showClear", "display", "required", "maxSelectedLabels", "group", "virtualScroll", "virtualScrollItemSize", "optionGroupLabel", "optionGroupChildren", "optionIcon", "optionIconColor", "optionIconShape", "optionAvatarShape", "optionGroupIcon", "optionGroupIconColor", "optionGroupIconShape", "optionGroupAvatarShape"], outputs: ["onChange"] }, { kind: "component", type: DateField, selector: "mt-date-field", inputs: ["field", "hint", "label", "placeholder", "class", "readonly", "showIcon", "showOnFocus", "showClear", "showTime", "timeOnly", "minDate", "maxDate", "pInputs", "required"] }, { kind: "component", type: UserSearchField, selector: "mt-user-search-field", inputs: ["hint", "hideUnlinkedHint", "label", "placeholder", "class", "readonly", "required", "isMultiple", "apiUrl", "dataKey", "paramName", "minLength", "context", "size"] }, { kind: "component", type: TreeSelectField, selector: "mt-treeselect-field", inputs: ["field", "hint", "label", "placeholder", "class", "readonly", "required", "pInputs", "options", "selectionMode", "display", "scrollHeight", "panelStyleClass", "containerStyleClass", "overlayOptions", "filter", "filterBy", "filterMode", "filterPlaceholder", "filterLocale", "filterInputAutoFocus", "showClear", "resetFilterOnHide", "propagateSelectionDown", "propagateSelectionUp", "virtualScroll", "virtualScrollItemSize", "loading", "loadingMode", "size", "variant", "fluid", "appendTo", "selectedLabelPath"], outputs: ["onChange"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1022
|
+
}
|
|
1023
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableFilterField, decorators: [{
|
|
1024
|
+
type: Component,
|
|
1025
|
+
args: [{ selector: 'mt-table-filter-field', standalone: true, imports: [
|
|
1026
|
+
FormsModule,
|
|
1027
|
+
TextField,
|
|
1028
|
+
NumberField,
|
|
1029
|
+
SelectField,
|
|
1030
|
+
MultiSelectField,
|
|
1031
|
+
DateField,
|
|
1032
|
+
UserSearchField,
|
|
1033
|
+
TreeSelectField,
|
|
1034
|
+
TranslocoModule,
|
|
1035
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@switch (getFilterType()) {\r\n @case (\"text\") {\r\n <mt-text-field\r\n [ngModel]=\"getScalarValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [placeholder]=\"\r\n ('components.table.select' | transloco) +\r\n ' ' +\r\n (column().filterConfig?.label || column().label)\r\n \"\r\n />\r\n }\r\n @case (\"select\") {\r\n @if (isMultiple()) {\r\n <mt-multi-select-field\r\n [ngModel]=\"multiValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [options]=\"filterOptions()\"\r\n [placeholder]=\"\r\n ('components.table.select' | transloco) +\r\n ' ' +\r\n (column().filterConfig?.label || column().label)\r\n \"\r\n [showClear]=\"true\"\r\n [filter]=\"true\"\r\n filterBy=\"label\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n />\r\n } @else {\r\n <mt-select-field\r\n [ngModel]=\"getScalarValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [options]=\"filterOptions()\"\r\n [placeholder]=\"\r\n ('components.table.select' | transloco) +\r\n ' ' +\r\n (column().filterConfig?.label || column().label)\r\n \"\r\n [hasPlaceholderPrefix]=\"false\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n showClear\r\n />\r\n }\r\n }\r\n @case (\"userSelect\") {\r\n @if (isMultiple()) {\r\n <mt-multi-select-field\r\n [ngModel]=\"multiValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [options]=\"filterOptions()\"\r\n [placeholder]=\"\r\n ('components.table.select' | transloco) +\r\n ' ' +\r\n (column().filterConfig?.label || column().label)\r\n \"\r\n [showClear]=\"true\"\r\n [filter]=\"true\"\r\n filterBy=\"label\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n />\r\n } @else {\r\n <mt-select-field\r\n [ngModel]=\"getScalarValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [options]=\"filterOptions()\"\r\n [placeholder]=\"\r\n ('components.table.select' | transloco) +\r\n ' ' +\r\n (column().filterConfig?.label || column().label)\r\n \"\r\n [hasPlaceholderPrefix]=\"false\"\r\n [markCurrentUser]=\"true\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n showClear\r\n />\r\n }\r\n }\r\n @case (\"treeSelect\") {\r\n <mt-treeselect-field\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [options]=\"treeOptions()\"\r\n [placeholder]=\"getTreePlaceholder()\"\r\n [selectionMode]=\"$any(column().filterConfig)?.selectionMode || 'single'\"\r\n [scrollHeight]=\"getTreeScrollHeight()\"\r\n [panelStyleClass]=\"getTreePanelStyleClass()\"\r\n [filter]=\"column().filterConfig?.['filter'] !== false\"\r\n [filterBy]=\"getTreeFilterBy()\"\r\n [filterPlaceholder]=\"getTreeFilterPlaceholder()\"\r\n [showClear]=\"column().filterConfig?.['showClear'] !== false\"\r\n [resetFilterOnHide]=\"\r\n column().filterConfig?.['resetFilterOnHide'] !== false\r\n \"\r\n [overlayOptions]=\"$any(column().filterConfig)?.overlayOptions\"\r\n />\r\n }\r\n @case (\"date\") {\r\n <div class=\"space-y-3\">\r\n <div class=\"space-y-1\">\r\n <label\r\n class=\"block text-sm font-medium text-gray-700 dark:text-gray-300\"\r\n >\r\n {{ \"components.table.from\" | transloco }}\r\n </label>\r\n <mt-date-field\r\n [ngModel]=\"getDateRangeValue('from')\"\r\n (ngModelChange)=\"updateDate('from', $event)\"\r\n [placeholder]=\"'components.table.from' | transloco\"\r\n />\r\n </div>\r\n <div class=\"space-y-1\">\r\n <label\r\n class=\"block text-sm font-medium text-gray-700 dark:text-gray-300\"\r\n >\r\n {{ \"components.table.to\" | transloco }}\r\n </label>\r\n <mt-date-field\r\n [ngModel]=\"getDateRangeValue('to')\"\r\n (ngModelChange)=\"updateDate('to', $event)\"\r\n [placeholder]=\"'components.table.to' | transloco\"\r\n />\r\n </div>\r\n </div>\r\n }\r\n @case (\"boolean\") {\r\n <mt-select-field\r\n [ngModel]=\"getScalarValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [options]=\"booleanOptions()\"\r\n [placeholder]=\"'components.table.select' | transloco\"\r\n [hasPlaceholderPrefix]=\"false\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n showClear\r\n />\r\n }\r\n @case (\"user\") {\r\n <mt-user-search-field\r\n [ngModel]=\"getScalarValue()\"\r\n (ngModelChange)=\"updateScalar($event)\"\r\n [placeholder]=\"column().filterConfig?.label || column().label\"\r\n [apiUrl]=\"column().filterConfig?.apiUrl ?? ''\"\r\n [context]=\"column().filterConfig?.context\"\r\n />\r\n }\r\n @case (\"numberRange\") {\r\n <div class=\"space-y-3\">\r\n <div class=\"space-y-1\">\r\n <label\r\n class=\"block text-sm font-medium text-gray-700 dark:text-gray-300\"\r\n >\r\n {{ \"components.table.from\" | transloco }}\r\n </label>\r\n <mt-number-field\r\n [ngModel]=\"getNumberRangeValue('from')\"\r\n (ngModelChange)=\"updateNumber('from', $event)\"\r\n [placeholder]=\"'components.table.from' | transloco\"\r\n [min]=\"getNumberRangeMin()\"\r\n [max]=\"getNumberRangeMax()\"\r\n />\r\n </div>\r\n <div class=\"space-y-1\">\r\n <label\r\n class=\"block text-sm font-medium text-gray-700 dark:text-gray-300\"\r\n >\r\n {{ \"components.table.to\" | transloco }}\r\n </label>\r\n <mt-number-field\r\n [ngModel]=\"getNumberRangeValue('to')\"\r\n (ngModelChange)=\"updateNumber('to', $event)\"\r\n [placeholder]=\"'components.table.to' | transloco\"\r\n [min]=\"getNumberRangeMin()\"\r\n [max]=\"getNumberRangeMax()\"\r\n />\r\n </div>\r\n </div>\r\n }\r\n}\r\n" }]
|
|
1036
|
+
}], propDecorators: { column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
1037
|
+
|
|
1038
|
+
class TableFilter {
|
|
1039
|
+
columns = input.required(...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
1040
|
+
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
1041
|
+
filterApplied = output();
|
|
1042
|
+
filterReset = output();
|
|
1043
|
+
transloco = inject(TranslocoService);
|
|
1044
|
+
panelOpen = signal(false, ...(ngDevMode ? [{ debugName: "panelOpen" }] : /* istanbul ignore next */ []));
|
|
1045
|
+
pendingFilters = signal({}, ...(ngDevMode ? [{ debugName: "pendingFilters" }] : /* istanbul ignore next */ []));
|
|
1046
|
+
appliedFilters = signal({}, ...(ngDevMode ? [{ debugName: "appliedFilters" }] : /* istanbul ignore next */ []));
|
|
1047
|
+
onChange = () => { };
|
|
1048
|
+
onTouched = () => { };
|
|
1049
|
+
open() {
|
|
1050
|
+
// Start from what is applied, so reopening does not resurrect edits the
|
|
1051
|
+
// user abandoned by closing the panel.
|
|
1052
|
+
this.pendingFilters.set({ ...this.appliedFilters() });
|
|
1053
|
+
this.panelOpen.set(true);
|
|
1054
|
+
}
|
|
1055
|
+
/** "3 filters applied" under the drawer title, or empty when there are none. */
|
|
1056
|
+
filterSummary = computed(() => {
|
|
1057
|
+
const count = this.activeFilterCount();
|
|
1058
|
+
return count > 0
|
|
1059
|
+
? this.transloco.translate('components.table.filtersApplied', { count })
|
|
1060
|
+
: '';
|
|
1061
|
+
}, ...(ngDevMode ? [{ debugName: "filterSummary" }] : /* istanbul ignore next */ []));
|
|
1062
|
+
filterableColumns = computed(() => this.columns()
|
|
1063
|
+
.filter((col) => TableValueResolver.getColumnFilterType(col, this.data()[0]) !== null)
|
|
1064
|
+
.map((col) => TableValueResolver.buildFilterableColumn(col, this.data())), ...(ngDevMode ? [{ debugName: "filterableColumns" }] : /* istanbul ignore next */ []));
|
|
1065
|
+
activeFilterCount = computed(() => Object.entries(this.appliedFilters()).filter(([key, value]) =>
|
|
1066
|
+
// `generalSearch` is the table's global search term, not a column
|
|
1067
|
+
// filter — it's injected into the filters map for lazy fetches but
|
|
1068
|
+
// must not light up the filter button's active badge.
|
|
1069
|
+
key !== 'generalSearch' && TableValueResolver.hasFilterValue(value)).length, ...(ngDevMode ? [{ debugName: "activeFilterCount" }] : /* istanbul ignore next */ []));
|
|
1070
|
+
updateFilter(key, value) {
|
|
1071
|
+
this.pendingFilters.update((filters) => ({
|
|
1072
|
+
...filters,
|
|
1073
|
+
[key]: value,
|
|
1074
|
+
}));
|
|
1075
|
+
this.onTouched();
|
|
1076
|
+
}
|
|
1077
|
+
apply() {
|
|
1078
|
+
const filters = { ...this.pendingFilters() };
|
|
1079
|
+
this.appliedFilters.set(filters);
|
|
1080
|
+
this.onChange(filters);
|
|
1081
|
+
this.filterApplied.emit(filters);
|
|
1082
|
+
}
|
|
1083
|
+
reset() {
|
|
1084
|
+
this.pendingFilters.set({});
|
|
1085
|
+
this.appliedFilters.set({});
|
|
1086
|
+
this.onChange({});
|
|
1087
|
+
this.filterReset.emit();
|
|
1088
|
+
}
|
|
1089
|
+
// ControlValueAccessor
|
|
1090
|
+
writeValue(value) {
|
|
1091
|
+
const filters = value ?? {};
|
|
1092
|
+
this.pendingFilters.set(filters);
|
|
1093
|
+
this.appliedFilters.set(filters);
|
|
1094
|
+
}
|
|
1095
|
+
registerOnChange(fn) {
|
|
1096
|
+
this.onChange = fn;
|
|
1097
|
+
}
|
|
1098
|
+
registerOnTouched(fn) {
|
|
1099
|
+
this.onTouched = fn;
|
|
1100
|
+
}
|
|
1101
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableFilter, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1102
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: TableFilter, isStandalone: true, selector: "mt-table-filter", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filterApplied: "filterApplied", filterReset: "filterReset" }, providers: [
|
|
1103
|
+
{
|
|
1104
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1105
|
+
useExisting: forwardRef(() => TableFilter),
|
|
1106
|
+
multi: true,
|
|
1107
|
+
},
|
|
1108
|
+
], ngImport: i0, template: "<mt-button\r\n (click)=\"open()\"\r\n [label]=\"'components.table.filter' | transloco\"\r\n [badge]=\"activeFilterCount()\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n icon=\"general.filter-funnel-01\"\r\n/>\r\n\r\n<!--\r\n A right-hand drawer, not a floating popover.\r\n\r\n The popover opened at 320px wide with a ~190px scroll area, so a form taller\r\n than that was sliced horizontally through the middle of a field: the last\r\n input rendered half-drawn at the bottom edge with no scrollbar cue, no close\r\n control and nothing to say more fields existed below (finding H-11). It also\r\n opened on top of the cards it filtered, which removes the feedback loop that\r\n makes filtering feel responsive.\r\n\r\n The drawer is full height, so the form fits; it is non-modal, so the results\r\n stay visible and legible beside it while values change; and it brings a close\r\n button of its own.\r\n-->\r\n<mt-drawer\r\n [(visible)]=\"panelOpen\"\r\n position=\"right\"\r\n [modal]=\"false\"\r\n [closeOnEscape]=\"true\"\r\n [showMaximizeToggle]=\"false\"\r\n [blockScroll]=\"false\"\r\n [title]=\"'components.table.filterOptions' | transloco\"\r\n [subtitle]=\"filterSummary()\"\r\n styleClass=\"mt-table-filter-drawer\"\r\n>\r\n <div content class=\"flex flex-col gap-4 px-5 py-4\">\r\n @for (col of filterableColumns(); track col.key) {\r\n <div class=\"space-y-1\">\r\n <label\r\n class=\"block text-sm font-medium text-gray-700 dark:text-gray-300\"\r\n >\r\n {{ col.filterConfig?.label || col.label }}\r\n </label>\r\n <mt-table-filter-field\r\n [column]=\"col\"\r\n [value]=\"pendingFilters()[col.key]\"\r\n (valueChange)=\"updateFilter(col.key, $event)\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n\r\n <ng-container footer>\r\n <mt-button\r\n variant=\"outlined\"\r\n (onClick)=\"reset()\"\r\n [label]=\"'components.table.reset' | transloco\"\r\n />\r\n <mt-button\r\n (onClick)=\"apply(); panelOpen.set(false)\"\r\n [label]=\"'components.table.apply' | transloco\"\r\n />\r\n </ng-container>\r\n</mt-drawer>\r\n", styles: [":host ::ng-deep .mt-table-filter-drawer{width:min(26rem,100vw)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { 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: Drawer, selector: "mt-drawer", inputs: ["visible", "position", "fullScreen", "closeOnEscape", "blockScroll", "dismissible", "title", "subtitle", "loadingHeader", "styleClass", "transitionOptions", "appendTo", "modal", "showMaximizeToggle", "maximizeTooltip", "restoreTooltip", "maximized"], outputs: ["visibleChange", "onShow", "onHide", "maximizedChange"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "component", type: TableFilterField, selector: "mt-table-filter-field", inputs: ["column", "value"], outputs: ["valueChange"] }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1109
|
+
}
|
|
1110
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableFilter, decorators: [{
|
|
1111
|
+
type: Component,
|
|
1112
|
+
args: [{ selector: 'mt-table-filter', standalone: true, imports: [FormsModule, Button, Drawer, TranslocoModule, TableFilterField], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1113
|
+
{
|
|
1114
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1115
|
+
useExisting: forwardRef(() => TableFilter),
|
|
1116
|
+
multi: true,
|
|
1117
|
+
},
|
|
1118
|
+
], template: "<mt-button\r\n (click)=\"open()\"\r\n [label]=\"'components.table.filter' | transloco\"\r\n [badge]=\"activeFilterCount()\"\r\n severity=\"primary\"\r\n size=\"small\"\r\n icon=\"general.filter-funnel-01\"\r\n/>\r\n\r\n<!--\r\n A right-hand drawer, not a floating popover.\r\n\r\n The popover opened at 320px wide with a ~190px scroll area, so a form taller\r\n than that was sliced horizontally through the middle of a field: the last\r\n input rendered half-drawn at the bottom edge with no scrollbar cue, no close\r\n control and nothing to say more fields existed below (finding H-11). It also\r\n opened on top of the cards it filtered, which removes the feedback loop that\r\n makes filtering feel responsive.\r\n\r\n The drawer is full height, so the form fits; it is non-modal, so the results\r\n stay visible and legible beside it while values change; and it brings a close\r\n button of its own.\r\n-->\r\n<mt-drawer\r\n [(visible)]=\"panelOpen\"\r\n position=\"right\"\r\n [modal]=\"false\"\r\n [closeOnEscape]=\"true\"\r\n [showMaximizeToggle]=\"false\"\r\n [blockScroll]=\"false\"\r\n [title]=\"'components.table.filterOptions' | transloco\"\r\n [subtitle]=\"filterSummary()\"\r\n styleClass=\"mt-table-filter-drawer\"\r\n>\r\n <div content class=\"flex flex-col gap-4 px-5 py-4\">\r\n @for (col of filterableColumns(); track col.key) {\r\n <div class=\"space-y-1\">\r\n <label\r\n class=\"block text-sm font-medium text-gray-700 dark:text-gray-300\"\r\n >\r\n {{ col.filterConfig?.label || col.label }}\r\n </label>\r\n <mt-table-filter-field\r\n [column]=\"col\"\r\n [value]=\"pendingFilters()[col.key]\"\r\n (valueChange)=\"updateFilter(col.key, $event)\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n\r\n <ng-container footer>\r\n <mt-button\r\n variant=\"outlined\"\r\n (onClick)=\"reset()\"\r\n [label]=\"'components.table.reset' | transloco\"\r\n />\r\n <mt-button\r\n (onClick)=\"apply(); panelOpen.set(false)\"\r\n [label]=\"'components.table.apply' | transloco\"\r\n />\r\n </ng-container>\r\n</mt-drawer>\r\n", styles: [":host ::ng-deep .mt-table-filter-drawer{width:min(26rem,100vw)}\n"] }]
|
|
1119
|
+
}], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], filterApplied: [{ type: i0.Output, args: ["filterApplied"] }], filterReset: [{ type: i0.Output, args: ["filterReset"] }] } });
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* A filter value as a short human-readable string for its chip.
|
|
1123
|
+
*
|
|
1124
|
+
* Deliberately shallow: a chip says WHICH filter is on and roughly what it is
|
|
1125
|
+
* set to, and the panel remains the place to read or change the exact value.
|
|
1126
|
+
*/
|
|
1127
|
+
function describeFilterValue(value) {
|
|
1128
|
+
if (Array.isArray(value)) {
|
|
1129
|
+
return value.map((entry) => describeFilterValue(entry)).join(', ');
|
|
1130
|
+
}
|
|
1131
|
+
if (value instanceof Date) {
|
|
1132
|
+
return value.toLocaleDateString();
|
|
1133
|
+
}
|
|
1134
|
+
if (value && typeof value === 'object') {
|
|
1135
|
+
const record = value;
|
|
1136
|
+
const direct = record['label'] ?? record['display'] ?? record['userName'];
|
|
1137
|
+
if (typeof direct === 'string' && direct.trim()) {
|
|
1138
|
+
return direct.trim();
|
|
1139
|
+
}
|
|
1140
|
+
const nested = record['value'];
|
|
1141
|
+
if (nested !== undefined && nested !== null && nested !== '') {
|
|
1142
|
+
return describeFilterValue(nested);
|
|
1143
|
+
}
|
|
1144
|
+
const from = record['from'];
|
|
1145
|
+
const to = record['to'];
|
|
1146
|
+
if (from != null || to != null) {
|
|
1147
|
+
const start = from != null ? describeFilterValue(from) : '…';
|
|
1148
|
+
const end = to != null ? describeFilterValue(to) : '…';
|
|
1149
|
+
return `${start} – ${end}`;
|
|
1150
|
+
}
|
|
1151
|
+
const key = record['key'] ?? record['id'];
|
|
1152
|
+
if (key !== undefined && key !== null) {
|
|
1153
|
+
return String(key);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
if (typeof value === 'boolean') {
|
|
1157
|
+
return value ? '✓' : '✗';
|
|
1158
|
+
}
|
|
1159
|
+
return String(value ?? '');
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Stateless, controlled toolbar used by `mt-table` and by list-style consumers
|
|
1163
|
+
* (e.g. `client-list-cards-view`) so the two share one caption UI without
|
|
1164
|
+
* duplicating the search/filter/actions markup.
|
|
1165
|
+
*
|
|
1166
|
+
* The caption only renders the popover-mode filter button — per-column filter
|
|
1167
|
+
* icons live in the table header itself (cards have no columns).
|
|
1168
|
+
*/
|
|
1169
|
+
class TableCaption {
|
|
1170
|
+
// Capability flags
|
|
1171
|
+
generalSearch = input(false, { ...(ngDevMode ? { debugName: "generalSearch" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1172
|
+
showFilters = input(false, { ...(ngDevMode ? { debugName: "showFilters" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1173
|
+
filterMode = input('popover', ...(ngDevMode ? [{ debugName: "filterMode" }] : /* istanbul ignore next */ []));
|
|
1174
|
+
exportable = input(false, { ...(ngDevMode ? { debugName: "exportable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1175
|
+
printable = input(false, { ...(ngDevMode ? { debugName: "printable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1176
|
+
groupable = input(false, { ...(ngDevMode ? { debugName: "groupable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1177
|
+
// Context for pickers
|
|
1178
|
+
columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
1179
|
+
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
1180
|
+
groupColumns = input([], ...(ngDevMode ? [{ debugName: "groupColumns" }] : /* istanbul ignore next */ []));
|
|
1181
|
+
// Tabs
|
|
1182
|
+
tabs = input(...(ngDevMode ? [undefined, { debugName: "tabs" }] : /* istanbul ignore next */ []));
|
|
1183
|
+
tabsOptionLabel = input('label', ...(ngDevMode ? [{ debugName: "tabsOptionLabel" }] : /* istanbul ignore next */ []));
|
|
1184
|
+
tabsOptionValue = input('value', ...(ngDevMode ? [{ debugName: "tabsOptionValue" }] : /* istanbul ignore next */ []));
|
|
1185
|
+
// Toolbar-level action buttons rendered inline (not the dots menu)
|
|
1186
|
+
actions = input([], ...(ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []));
|
|
1187
|
+
// Projected caption slots
|
|
1188
|
+
captionStart = input(null, ...(ngDevMode ? [{ debugName: "captionStart" }] : /* istanbul ignore next */ []));
|
|
1189
|
+
captionEnd = input(null, ...(ngDevMode ? [{ debugName: "captionEnd" }] : /* istanbul ignore next */ []));
|
|
1190
|
+
// Two-way state (the caption is a controlled component)
|
|
1191
|
+
activeTab = model(...(ngDevMode ? [undefined, { debugName: "activeTab" }] : /* istanbul ignore next */ []));
|
|
1192
|
+
filters = model({}, ...(ngDevMode ? [{ debugName: "filters" }] : /* istanbul ignore next */ []));
|
|
1193
|
+
filterTerm = model('', ...(ngDevMode ? [{ debugName: "filterTerm" }] : /* istanbul ignore next */ []));
|
|
1194
|
+
groupBy = model(null, ...(ngDevMode ? [{ debugName: "groupBy" }] : /* istanbul ignore next */ []));
|
|
1195
|
+
// Events
|
|
1196
|
+
exportRequested = output();
|
|
1197
|
+
printRequested = output();
|
|
1198
|
+
onTabChange = output();
|
|
1199
|
+
searchChange = output();
|
|
1200
|
+
filterApplied = output();
|
|
1201
|
+
filterReset = output();
|
|
1202
|
+
showsAnything = computed(() => !!this.captionStart() ||
|
|
1203
|
+
!!this.captionEnd() ||
|
|
1204
|
+
this.generalSearch() ||
|
|
1205
|
+
(this.showFilters() && this.filterMode() === 'popover') ||
|
|
1206
|
+
this.exportable() ||
|
|
1207
|
+
this.printable() ||
|
|
1208
|
+
this.groupable() ||
|
|
1209
|
+
(this.tabs()?.length ?? 0) > 0 ||
|
|
1210
|
+
this.actions().length > 0, ...(ngDevMode ? [{ debugName: "showsAnything" }] : /* istanbul ignore next */ []));
|
|
1211
|
+
onSearch(term) {
|
|
1212
|
+
// Single source of truth for the search box shared by mt-table and the
|
|
1213
|
+
// cards view. A whitespace-only query is meaningless, so collapse it to
|
|
1214
|
+
// '' here — otherwise a literal " " substring-matches almost every row
|
|
1215
|
+
// (local) or is sent verbatim as `generalSearch` (lazy). `.trim()` is
|
|
1216
|
+
// idempotent against typing multi-word terms ("John Doe"): a trailing
|
|
1217
|
+
// space yields the same value as before, the model signal doesn't
|
|
1218
|
+
// re-emit, and the input keeps the space the user just typed.
|
|
1219
|
+
const normalized = term.trim();
|
|
1220
|
+
this.filterTerm.set(normalized);
|
|
1221
|
+
this.searchChange.emit(normalized);
|
|
1222
|
+
}
|
|
1223
|
+
onFilterApplied(next) {
|
|
1224
|
+
this.filters.set(next);
|
|
1225
|
+
this.filterApplied.emit(next);
|
|
1226
|
+
}
|
|
1227
|
+
onFilterReset() {
|
|
1228
|
+
this.filters.set({});
|
|
1229
|
+
this.filterReset.emit();
|
|
1230
|
+
}
|
|
1231
|
+
/**
|
|
1232
|
+
* The filters currently narrowing the list, as removable chips.
|
|
1233
|
+
*
|
|
1234
|
+
* The filter panel used to be the only place a filter existed: close it and
|
|
1235
|
+
* nothing on screen said the list was narrowed, so a user could stare at an
|
|
1236
|
+
* unexpectedly short result set with no way to see why (finding H-11). A chip
|
|
1237
|
+
* row states it in the results' own space and clears one filter per click.
|
|
1238
|
+
*/
|
|
1239
|
+
appliedFilterChips = computed(() => {
|
|
1240
|
+
const columns = this.columns();
|
|
1241
|
+
return Object.entries(this.filters())
|
|
1242
|
+
.filter(([key, value]) =>
|
|
1243
|
+
// The global search term rides in the same map but has its own input.
|
|
1244
|
+
key !== 'generalSearch' && TableValueResolver.hasFilterValue(value))
|
|
1245
|
+
.map(([key, value]) => {
|
|
1246
|
+
const column = columns.find((col) => col.key === key);
|
|
1247
|
+
return {
|
|
1248
|
+
key,
|
|
1249
|
+
label: column?.filterConfig?.label || column?.label || key,
|
|
1250
|
+
value: describeFilterValue(value),
|
|
1251
|
+
};
|
|
1252
|
+
});
|
|
1253
|
+
}, ...(ngDevMode ? [{ debugName: "appliedFilterChips" }] : /* istanbul ignore next */ []));
|
|
1254
|
+
removeFilter(key) {
|
|
1255
|
+
const next = { ...this.filters() };
|
|
1256
|
+
delete next[key];
|
|
1257
|
+
this.filters.set(next);
|
|
1258
|
+
this.filterApplied.emit(next);
|
|
1259
|
+
}
|
|
1260
|
+
clearAllFilters() {
|
|
1261
|
+
this.onFilterReset();
|
|
1262
|
+
}
|
|
1263
|
+
onGroupChange(key) {
|
|
1264
|
+
this.groupBy.set(key);
|
|
1265
|
+
}
|
|
1266
|
+
tabChanged(tab) {
|
|
1267
|
+
this.onTabChange.emit(tab);
|
|
1268
|
+
}
|
|
1269
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableCaption, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1270
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: TableCaption, isStandalone: true, selector: "mt-table-caption", inputs: { generalSearch: { classPropertyName: "generalSearch", publicName: "generalSearch", isSignal: true, isRequired: false, transformFunction: null }, showFilters: { classPropertyName: "showFilters", publicName: "showFilters", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, exportable: { classPropertyName: "exportable", publicName: "exportable", isSignal: true, isRequired: false, transformFunction: null }, printable: { classPropertyName: "printable", publicName: "printable", isSignal: true, isRequired: false, transformFunction: null }, groupable: { classPropertyName: "groupable", publicName: "groupable", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, groupColumns: { classPropertyName: "groupColumns", publicName: "groupColumns", isSignal: true, isRequired: false, transformFunction: null }, tabs: { classPropertyName: "tabs", publicName: "tabs", isSignal: true, isRequired: false, transformFunction: null }, tabsOptionLabel: { classPropertyName: "tabsOptionLabel", publicName: "tabsOptionLabel", isSignal: true, isRequired: false, transformFunction: null }, tabsOptionValue: { classPropertyName: "tabsOptionValue", publicName: "tabsOptionValue", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, captionStart: { classPropertyName: "captionStart", publicName: "captionStart", isSignal: true, isRequired: false, transformFunction: null }, captionEnd: { classPropertyName: "captionEnd", publicName: "captionEnd", isSignal: true, isRequired: false, transformFunction: null }, activeTab: { classPropertyName: "activeTab", publicName: "activeTab", isSignal: true, isRequired: false, transformFunction: null }, filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: false, transformFunction: null }, filterTerm: { classPropertyName: "filterTerm", publicName: "filterTerm", isSignal: true, isRequired: false, transformFunction: null }, groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeTab: "activeTabChange", filters: "filtersChange", filterTerm: "filterTermChange", groupBy: "groupByChange", exportRequested: "exportRequested", printRequested: "printRequested", onTabChange: "onTabChange", searchChange: "searchChange", filterApplied: "filterApplied", filterReset: "filterReset" }, ngImport: i0, template: "@if (showsAnything()) {\r\n <div class=\"mt-table-caption\">\r\n <div\r\n class=\"flex relative items-center gap-2 pb-4\"\r\n [class]=\"!generalSearch() ? 'justify-end' : 'justify-between'\"\r\n >\r\n <div class=\"flex items-center gap-2\">\r\n @if (captionStart(); as tpl) {\r\n <ng-container *ngTemplateOutlet=\"tpl\"></ng-container>\r\n }\r\n @if (tabs()) {\r\n <mt-tabs\r\n [(active)]=\"activeTab\"\r\n [options]=\"tabs()\"\r\n [optionLabel]=\"tabsOptionLabel()\"\r\n [optionValue]=\"tabsOptionValue()\"\r\n (onChange)=\"tabChanged($event)\"\r\n size=\"large\"\r\n ></mt-tabs>\r\n }\r\n @if (generalSearch()) {\r\n <mt-text-field\r\n [ngModel]=\"filterTerm()\"\r\n (ngModelChange)=\"onSearch($event)\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"'components.table.search' | transloco\"\r\n ></mt-text-field>\r\n }\r\n </div>\r\n <div class=\"flex items-center gap-2\">\r\n @if (showFilters() && filterMode() === \"popover\") {\r\n <mt-table-filter\r\n [columns]=\"columns()\"\r\n [data]=\"data()\"\r\n [ngModel]=\"filters()\"\r\n (filterApplied)=\"onFilterApplied($event)\"\r\n (filterReset)=\"onFilterReset()\"\r\n />\r\n }\r\n @if (exportable() || printable() || groupable()) {\r\n <mt-table-actions-menu\r\n [exportable]=\"exportable()\"\r\n [printable]=\"printable()\"\r\n [groupable]=\"groupable()\"\r\n [groupColumns]=\"groupColumns()\"\r\n [activeGroup]=\"groupBy()\"\r\n (exportRequested)=\"exportRequested.emit()\"\r\n (printRequested)=\"printRequested.emit()\"\r\n (groupChange)=\"onGroupChange($event)\"\r\n />\r\n }\r\n @if (actions().length > 0) {\r\n <div class=\"flex items-center space-x-2\">\r\n @for (action of actions(); track action.label) {\r\n <mt-button\r\n [icon]=\"action.icon\"\r\n [severity]=\"action.color\"\r\n [variant]=\"action.variant\"\r\n [size]=\"$any(action).size || 'small'\"\r\n (click)=\"action.action(null)\"\r\n [label]=\"action.label\"\r\n [tooltip]=\"action.tooltip\"\r\n ></mt-button>\r\n }\r\n </div>\r\n }\r\n @if (captionEnd(); as tpl) {\r\n <ng-container *ngTemplateOutlet=\"tpl\"></ng-container>\r\n }\r\n </div>\r\n </div>\r\n\r\n @if (appliedFilterChips().length > 0) {\r\n <!--\r\n States, in the results' own space, which filters are narrowing the list \u2014\r\n the panel used to be the only place that knew, so closing it left the\r\n user with a short result set and no explanation (finding H-11).\r\n -->\r\n <div\r\n class=\"flex flex-wrap items-center gap-2 pb-4\"\r\n role=\"list\"\r\n [attr.aria-label]=\"'components.table.activeFilters' | transloco\"\r\n >\r\n <span class=\"text-xs font-medium text-gray-500\">\r\n {{ \"components.table.activeFilters\" | transloco }}\r\n </span>\r\n @for (chip of appliedFilterChips(); track chip.key) {\r\n <span\r\n role=\"listitem\"\r\n class=\"inline-flex max-w-64 items-center gap-1 rounded-full bg-primary-50 py-1 pe-1 ps-2.5 text-xs text-primary-700 dark:bg-primary-950 dark:text-primary-300\"\r\n >\r\n <span class=\"truncate\">\r\n <span class=\"font-medium\">{{ chip.label }}</span\r\n >: {{ chip.value }}\r\n </span>\r\n <button\r\n type=\"button\"\r\n class=\"flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-full border-0 bg-transparent p-0 text-primary-700 transition-colors hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-900\"\r\n [attr.aria-label]=\"\r\n ('components.table.clearFilter' | transloco) + ': ' + chip.label\r\n \"\r\n (click)=\"removeFilter(chip.key)\"\r\n >\r\n <mt-icon icon=\"general.x-close\" class=\"text-[10px]\" />\r\n </button>\r\n </span>\r\n }\r\n <button\r\n type=\"button\"\r\n class=\"cursor-pointer border-0 bg-transparent p-0 text-xs font-medium text-gray-500 underline transition-colors hover:text-gray-700\"\r\n (click)=\"clearAllFilters()\"\r\n >\r\n {{ \"components.emptyState.clearFilters\" | transloco }}\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n}\r\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TranslocoModule }, { 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: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: TableFilter, selector: "mt-table-filter", inputs: ["columns", "data"], outputs: ["filterApplied", "filterReset"] }, { kind: "component", type: TableActionsMenu, selector: "mt-table-actions-menu", inputs: ["exportable", "printable", "groupable", "groupColumns", "activeGroup"], outputs: ["exportRequested", "printRequested", "groupChange"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1271
|
+
}
|
|
1272
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableCaption, decorators: [{
|
|
1273
|
+
type: Component,
|
|
1274
|
+
args: [{ selector: 'mt-table-caption', standalone: true, imports: [
|
|
1275
|
+
NgTemplateOutlet,
|
|
1276
|
+
FormsModule,
|
|
1277
|
+
TranslocoModule,
|
|
1278
|
+
Button,
|
|
1279
|
+
Tabs,
|
|
1280
|
+
TextField,
|
|
1281
|
+
TableFilter,
|
|
1282
|
+
TableActionsMenu,
|
|
1283
|
+
Icon,
|
|
1284
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (showsAnything()) {\r\n <div class=\"mt-table-caption\">\r\n <div\r\n class=\"flex relative items-center gap-2 pb-4\"\r\n [class]=\"!generalSearch() ? 'justify-end' : 'justify-between'\"\r\n >\r\n <div class=\"flex items-center gap-2\">\r\n @if (captionStart(); as tpl) {\r\n <ng-container *ngTemplateOutlet=\"tpl\"></ng-container>\r\n }\r\n @if (tabs()) {\r\n <mt-tabs\r\n [(active)]=\"activeTab\"\r\n [options]=\"tabs()\"\r\n [optionLabel]=\"tabsOptionLabel()\"\r\n [optionValue]=\"tabsOptionValue()\"\r\n (onChange)=\"tabChanged($event)\"\r\n size=\"large\"\r\n ></mt-tabs>\r\n }\r\n @if (generalSearch()) {\r\n <mt-text-field\r\n [ngModel]=\"filterTerm()\"\r\n (ngModelChange)=\"onSearch($event)\"\r\n icon=\"general.search-lg\"\r\n [placeholder]=\"'components.table.search' | transloco\"\r\n ></mt-text-field>\r\n }\r\n </div>\r\n <div class=\"flex items-center gap-2\">\r\n @if (showFilters() && filterMode() === \"popover\") {\r\n <mt-table-filter\r\n [columns]=\"columns()\"\r\n [data]=\"data()\"\r\n [ngModel]=\"filters()\"\r\n (filterApplied)=\"onFilterApplied($event)\"\r\n (filterReset)=\"onFilterReset()\"\r\n />\r\n }\r\n @if (exportable() || printable() || groupable()) {\r\n <mt-table-actions-menu\r\n [exportable]=\"exportable()\"\r\n [printable]=\"printable()\"\r\n [groupable]=\"groupable()\"\r\n [groupColumns]=\"groupColumns()\"\r\n [activeGroup]=\"groupBy()\"\r\n (exportRequested)=\"exportRequested.emit()\"\r\n (printRequested)=\"printRequested.emit()\"\r\n (groupChange)=\"onGroupChange($event)\"\r\n />\r\n }\r\n @if (actions().length > 0) {\r\n <div class=\"flex items-center space-x-2\">\r\n @for (action of actions(); track action.label) {\r\n <mt-button\r\n [icon]=\"action.icon\"\r\n [severity]=\"action.color\"\r\n [variant]=\"action.variant\"\r\n [size]=\"$any(action).size || 'small'\"\r\n (click)=\"action.action(null)\"\r\n [label]=\"action.label\"\r\n [tooltip]=\"action.tooltip\"\r\n ></mt-button>\r\n }\r\n </div>\r\n }\r\n @if (captionEnd(); as tpl) {\r\n <ng-container *ngTemplateOutlet=\"tpl\"></ng-container>\r\n }\r\n </div>\r\n </div>\r\n\r\n @if (appliedFilterChips().length > 0) {\r\n <!--\r\n States, in the results' own space, which filters are narrowing the list \u2014\r\n the panel used to be the only place that knew, so closing it left the\r\n user with a short result set and no explanation (finding H-11).\r\n -->\r\n <div\r\n class=\"flex flex-wrap items-center gap-2 pb-4\"\r\n role=\"list\"\r\n [attr.aria-label]=\"'components.table.activeFilters' | transloco\"\r\n >\r\n <span class=\"text-xs font-medium text-gray-500\">\r\n {{ \"components.table.activeFilters\" | transloco }}\r\n </span>\r\n @for (chip of appliedFilterChips(); track chip.key) {\r\n <span\r\n role=\"listitem\"\r\n class=\"inline-flex max-w-64 items-center gap-1 rounded-full bg-primary-50 py-1 pe-1 ps-2.5 text-xs text-primary-700 dark:bg-primary-950 dark:text-primary-300\"\r\n >\r\n <span class=\"truncate\">\r\n <span class=\"font-medium\">{{ chip.label }}</span\r\n >: {{ chip.value }}\r\n </span>\r\n <button\r\n type=\"button\"\r\n class=\"flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-full border-0 bg-transparent p-0 text-primary-700 transition-colors hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-900\"\r\n [attr.aria-label]=\"\r\n ('components.table.clearFilter' | transloco) + ': ' + chip.label\r\n \"\r\n (click)=\"removeFilter(chip.key)\"\r\n >\r\n <mt-icon icon=\"general.x-close\" class=\"text-[10px]\" />\r\n </button>\r\n </span>\r\n }\r\n <button\r\n type=\"button\"\r\n class=\"cursor-pointer border-0 bg-transparent p-0 text-xs font-medium text-gray-500 underline transition-colors hover:text-gray-700\"\r\n (click)=\"clearAllFilters()\"\r\n >\r\n {{ \"components.emptyState.clearFilters\" | transloco }}\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n}\r\n" }]
|
|
1285
|
+
}], propDecorators: { generalSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "generalSearch", required: false }] }], showFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFilters", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], exportable: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportable", required: false }] }], printable: [{ type: i0.Input, args: [{ isSignal: true, alias: "printable", required: false }] }], groupable: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupable", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], groupColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupColumns", required: false }] }], tabs: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabs", required: false }] }], tabsOptionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabsOptionLabel", required: false }] }], tabsOptionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabsOptionValue", required: false }] }], actions: [{ type: i0.Input, args: [{ isSignal: true, alias: "actions", required: false }] }], captionStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionStart", required: false }] }], captionEnd: [{ type: i0.Input, args: [{ isSignal: true, alias: "captionEnd", required: false }] }], activeTab: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeTab", required: false }] }, { type: i0.Output, args: ["activeTabChange"] }], filters: [{ type: i0.Input, args: [{ isSignal: true, alias: "filters", required: false }] }, { type: i0.Output, args: ["filtersChange"] }], filterTerm: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterTerm", required: false }] }, { type: i0.Output, args: ["filterTermChange"] }], groupBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupBy", required: false }] }, { type: i0.Output, args: ["groupByChange"] }], exportRequested: [{ type: i0.Output, args: ["exportRequested"] }], printRequested: [{ type: i0.Output, args: ["printRequested"] }], onTabChange: [{ type: i0.Output, args: ["onTabChange"] }], searchChange: [{ type: i0.Output, args: ["searchChange"] }], filterApplied: [{ type: i0.Output, args: ["filterApplied"] }], filterReset: [{ type: i0.Output, args: ["filterReset"] }] } });
|
|
1286
|
+
|
|
1287
|
+
const OVERLAY_SELECTOR = '.p-popover, .p-select-overlay, .p-multiselect-overlay, .p-treeselect-overlay, .p-datepicker-panel, .p-autocomplete-panel, .p-autocomplete-overlay';
|
|
1288
|
+
/**
|
|
1289
|
+
* Per-column filter affordance: a small funnel icon in the column header that
|
|
1290
|
+
* opens a popover with a single `TableFilterField`.
|
|
1291
|
+
*
|
|
1292
|
+
* Buffers edits in `pendingValue` until the user hits Apply — matches the
|
|
1293
|
+
* popover-mode UX so behavior is predictable between modes. Emits `filterChange`
|
|
1294
|
+
* with either the new value or `null` to clear.
|
|
1295
|
+
*/
|
|
1296
|
+
class TableColumnFilter {
|
|
1297
|
+
column = input.required(...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
|
|
1298
|
+
value = input(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1299
|
+
filterChange = output();
|
|
1300
|
+
pendingValue = signal(null, ...(ngDevMode ? [{ debugName: "pendingValue" }] : /* istanbul ignore next */ []));
|
|
1301
|
+
hasActiveValue = computed(() => TableValueResolver.hasFilterValue(this.value()), ...(ngDevMode ? [{ debugName: "hasActiveValue" }] : /* istanbul ignore next */ []));
|
|
1302
|
+
popoverRef = viewChild('popover', ...(ngDevMode ? [{ debugName: "popoverRef" }] : /* istanbul ignore next */ []));
|
|
1303
|
+
constructor() {
|
|
1304
|
+
// See TableFilter: body-appended child overlays don't dismiss on inner
|
|
1305
|
+
// container scroll. Close the popover when the scroll happens outside
|
|
1306
|
+
// the popover or any open dropdown overlay.
|
|
1307
|
+
const onScroll = (event) => {
|
|
1308
|
+
const popover = this.popoverRef();
|
|
1309
|
+
if (!popover?.container)
|
|
1310
|
+
return;
|
|
1311
|
+
const target = event.target;
|
|
1312
|
+
if (target instanceof Element && target.closest(OVERLAY_SELECTOR)) {
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
popover.hide();
|
|
1316
|
+
};
|
|
1317
|
+
window.addEventListener('scroll', onScroll, true);
|
|
1318
|
+
inject(DestroyRef).onDestroy(() => {
|
|
1319
|
+
window.removeEventListener('scroll', onScroll, true);
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
open(popover, event) {
|
|
1323
|
+
event.stopPropagation();
|
|
1324
|
+
this.pendingValue.set(this.cloneValue(this.value()));
|
|
1325
|
+
popover.toggle(event);
|
|
1326
|
+
}
|
|
1327
|
+
apply(popover) {
|
|
1328
|
+
const next = this.pendingValue();
|
|
1329
|
+
this.filterChange.emit(TableValueResolver.hasFilterValue(next) ? next : null);
|
|
1330
|
+
popover.hide();
|
|
1331
|
+
}
|
|
1332
|
+
clear(popover) {
|
|
1333
|
+
this.pendingValue.set(null);
|
|
1334
|
+
this.filterChange.emit(null);
|
|
1335
|
+
popover.hide();
|
|
1336
|
+
}
|
|
1337
|
+
cloneValue(value) {
|
|
1338
|
+
if (value === null || value === undefined)
|
|
1339
|
+
return null;
|
|
1340
|
+
// Arrays must stay arrays — `{ ...array }` would turn a multi-select
|
|
1341
|
+
// value (e.g. ["a","b"]) into {0:"a",1:"b"}, which then matches no
|
|
1342
|
+
// option when the popover is reopened, dropping the selection.
|
|
1343
|
+
if (Array.isArray(value))
|
|
1344
|
+
return [...value];
|
|
1345
|
+
if (typeof value === 'object')
|
|
1346
|
+
return { ...value };
|
|
1347
|
+
return value;
|
|
1348
|
+
}
|
|
1349
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableColumnFilter, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1350
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.8", type: TableColumnFilter, isStandalone: true, selector: "mt-table-column-filter", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filterChange: "filterChange" }, viewQueries: [{ propertyName: "popoverRef", first: true, predicate: ["popover"], descendants: true, isSignal: true }], ngImport: i0, template: "<mt-button\r\n (onClick)=\"open(popover, $event)\"\r\n [icon]=\"\r\n hasActiveValue() ? 'general.filter-funnel-02' : 'general.filter-funnel-01'\r\n \"\r\n [severity]=\"hasActiveValue() ? 'primary' : 'secondary'\"\r\n variant=\"text\"\r\n size=\"small\"\r\n [tooltip]=\"'components.table.filter' | transloco\"\r\n styleClass=\"!p-1 !text-sm\"\r\n/>\r\n\r\n<p-popover #popover [style]=\"{ width: '280px' }\" appendTo=\"body\">\r\n <div class=\"flex flex-col gap-3\" (keydown.enter)=\"apply(popover)\">\r\n <h4\r\n class=\"text-sm font-semibold text-gray-700 dark:text-gray-300 truncate\"\r\n [title]=\"column().filterConfig?.label || column().label\"\r\n >\r\n {{ column().filterConfig?.label || column().label }}\r\n </h4>\r\n\r\n <mt-table-filter-field\r\n [column]=\"column()\"\r\n [value]=\"pendingValue()\"\r\n (valueChange)=\"pendingValue.set($event)\"\r\n />\r\n\r\n <div\r\n class=\"flex justify-end gap-2 pt-2 border-t border-surface-200 dark:border-surface-700\"\r\n >\r\n <mt-button\r\n variant=\"outlined\"\r\n size=\"small\"\r\n (onClick)=\"clear(popover)\"\r\n [label]=\"'components.table.reset' | transloco\"\r\n />\r\n <mt-button\r\n size=\"small\"\r\n (onClick)=\"apply(popover)\"\r\n [label]=\"'components.table.apply' | transloco\"\r\n />\r\n </div>\r\n </div>\r\n</p-popover>\r\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { 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: "ngmodule", type: PopoverModule }, { kind: "component", type: i1$2.Popover, selector: "p-popover", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions", "motionOptions"], outputs: ["onShow", "onHide"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "component", type: TableFilterField, selector: "mt-table-filter-field", inputs: ["column", "value"], outputs: ["valueChange"] }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1351
|
+
}
|
|
1352
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableColumnFilter, decorators: [{
|
|
1353
|
+
type: Component,
|
|
1354
|
+
args: [{ selector: 'mt-table-column-filter', standalone: true, imports: [
|
|
1355
|
+
FormsModule,
|
|
1356
|
+
Button,
|
|
1357
|
+
PopoverModule,
|
|
1358
|
+
TranslocoModule,
|
|
1359
|
+
TableFilterField,
|
|
1360
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mt-button\r\n (onClick)=\"open(popover, $event)\"\r\n [icon]=\"\r\n hasActiveValue() ? 'general.filter-funnel-02' : 'general.filter-funnel-01'\r\n \"\r\n [severity]=\"hasActiveValue() ? 'primary' : 'secondary'\"\r\n variant=\"text\"\r\n size=\"small\"\r\n [tooltip]=\"'components.table.filter' | transloco\"\r\n styleClass=\"!p-1 !text-sm\"\r\n/>\r\n\r\n<p-popover #popover [style]=\"{ width: '280px' }\" appendTo=\"body\">\r\n <div class=\"flex flex-col gap-3\" (keydown.enter)=\"apply(popover)\">\r\n <h4\r\n class=\"text-sm font-semibold text-gray-700 dark:text-gray-300 truncate\"\r\n [title]=\"column().filterConfig?.label || column().label\"\r\n >\r\n {{ column().filterConfig?.label || column().label }}\r\n </h4>\r\n\r\n <mt-table-filter-field\r\n [column]=\"column()\"\r\n [value]=\"pendingValue()\"\r\n (valueChange)=\"pendingValue.set($event)\"\r\n />\r\n\r\n <div\r\n class=\"flex justify-end gap-2 pt-2 border-t border-surface-200 dark:border-surface-700\"\r\n >\r\n <mt-button\r\n variant=\"outlined\"\r\n size=\"small\"\r\n (onClick)=\"clear(popover)\"\r\n [label]=\"'components.table.reset' | transloco\"\r\n />\r\n <mt-button\r\n size=\"small\"\r\n (onClick)=\"apply(popover)\"\r\n [label]=\"'components.table.apply' | transloco\"\r\n />\r\n </div>\r\n </div>\r\n</p-popover>\r\n" }]
|
|
1361
|
+
}], ctorParameters: () => [], propDecorators: { column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], popoverRef: [{ type: i0.ViewChild, args: ['popover', { isSignal: true }] }] } });
|
|
1362
|
+
|
|
1363
|
+
function stripHtmlToPlainText(value) {
|
|
1364
|
+
if (value === null || value === undefined) {
|
|
1365
|
+
return '';
|
|
1366
|
+
}
|
|
1367
|
+
const raw = String(value);
|
|
1368
|
+
if (raw === '') {
|
|
1369
|
+
return '';
|
|
1370
|
+
}
|
|
1371
|
+
if (!/[<&]/.test(raw)) {
|
|
1372
|
+
return raw.trim();
|
|
1373
|
+
}
|
|
1374
|
+
const withoutTags = raw
|
|
1375
|
+
.replace(/<\s*(?:br|\/p|\/div|\/li|\/tr|\/h[1-6]|\/pre|\/blockquote)\b[^>]*>/gi, ' ')
|
|
1376
|
+
.replace(/<[^>]*>/g, '');
|
|
1377
|
+
const decoded = decodeHtmlEntities(withoutTags);
|
|
1378
|
+
return decoded.replace(/\s+/g, ' ').trim();
|
|
1379
|
+
}
|
|
1380
|
+
const NAMED_ENTITIES = {
|
|
1381
|
+
nbsp: ' ',
|
|
1382
|
+
amp: '&',
|
|
1383
|
+
lt: '<',
|
|
1384
|
+
gt: '>',
|
|
1385
|
+
quot: '"',
|
|
1386
|
+
apos: "'",
|
|
1387
|
+
};
|
|
1388
|
+
function decodeHtmlEntities(text) {
|
|
1389
|
+
if (!text.includes('&')) {
|
|
1390
|
+
return text;
|
|
1391
|
+
}
|
|
1392
|
+
return text.replace(/&(#x?[0-9a-f]+|[a-z][a-z0-9]*);/gi, (match, entity) => {
|
|
1393
|
+
const token = entity.toLowerCase();
|
|
1394
|
+
if (token[0] === '#') {
|
|
1395
|
+
const codePoint = token[1] === 'x'
|
|
1396
|
+
? Number.parseInt(token.slice(2), 16)
|
|
1397
|
+
: Number.parseInt(token.slice(1), 10);
|
|
1398
|
+
if (Number.isNaN(codePoint) || codePoint <= 0) {
|
|
1399
|
+
return match;
|
|
1400
|
+
}
|
|
1401
|
+
try {
|
|
1402
|
+
return String.fromCodePoint(codePoint);
|
|
1403
|
+
}
|
|
1404
|
+
catch {
|
|
1405
|
+
return match;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
const named = NAMED_ENTITIES[token];
|
|
1409
|
+
return named === undefined ? match : named;
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* Centralises table export/print so any `mt-table` (and future tables) can
|
|
1415
|
+
* drop in the behaviour without reimplementing XLSX serialisation or print
|
|
1416
|
+
* DOM cloning. Injected schema-agnostically via `resolveValue` on the config.
|
|
1417
|
+
*/
|
|
1418
|
+
class TableExportService {
|
|
1419
|
+
static PRINT_ROOT_CLASS = 'mt-printing';
|
|
1420
|
+
static PRINT_REGION_CLASS = 'mt-print-region';
|
|
1421
|
+
static PRINT_STYLE_ID = 'mt-table-print-style';
|
|
1422
|
+
static MAX_PRINT_COLUMNS_PER_TABLE = 8;
|
|
1423
|
+
static RTL_LANGUAGES = /^(ar|fa|he|ur)(?:-|$)/i;
|
|
1424
|
+
transloco = inject(TranslocoService);
|
|
1425
|
+
static PRINT_CSS = `
|
|
1426
|
+
@media print {
|
|
1427
|
+
html.mt-printing body > *:not(.mt-print-region) { display: none !important; }
|
|
1428
|
+
html.mt-printing, html.mt-printing body { width: 100% !important; height: auto !important;
|
|
1429
|
+
overflow: visible !important; background: #ffffff !important; }
|
|
1430
|
+
.mt-print-region { display: block !important; width: 100%; max-width: 100%;
|
|
1431
|
+
box-sizing: border-box; overflow: visible !important; padding: 16px; color: #111827;
|
|
1432
|
+
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
|
|
1433
|
+
.mt-print-region h1 { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
|
|
1434
|
+
.mt-print-region table { width: 100%; max-width: 100%; table-layout: fixed;
|
|
1435
|
+
border-collapse: collapse; font-size: 12px; }
|
|
1436
|
+
.mt-print-region table + table { margin-top: 16px; }
|
|
1437
|
+
.mt-print-region th, .mt-print-region td { text-align: start; padding: 6px 8px;
|
|
1438
|
+
border: 1px solid #e5e7eb; vertical-align: top; white-space: normal;
|
|
1439
|
+
overflow-wrap: anywhere; word-break: break-word; }
|
|
1440
|
+
.mt-print-region thead th { background: #f3f4f6; font-weight: 600; }
|
|
1441
|
+
.mt-print-region tbody tr { break-inside: avoid; page-break-inside: avoid; }
|
|
1442
|
+
}
|
|
1443
|
+
.mt-print-region { display: none; }
|
|
1444
|
+
`;
|
|
1445
|
+
exportToExcel(config) {
|
|
1446
|
+
const workbook = this.buildExcelWorkbook(config);
|
|
1447
|
+
XLSX.writeFileXLSX(workbook, `${this.normalizeFilename(config.filename)}.xlsx`);
|
|
1448
|
+
}
|
|
1449
|
+
buildExcelWorkbook(config) {
|
|
1450
|
+
const columns = this.getExcelExportableColumns(config.columns, config.rows);
|
|
1451
|
+
const labeledRows = this.buildLabeledRows(config.rows, columns, config.resolveValue);
|
|
1452
|
+
const worksheet = XLSX.utils.json_to_sheet(labeledRows, {
|
|
1453
|
+
header: columns.map((column) => column.label),
|
|
1454
|
+
});
|
|
1455
|
+
this.configureWorksheet(worksheet, columns, labeledRows);
|
|
1456
|
+
const workbook = XLSX.utils.book_new();
|
|
1457
|
+
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
|
1458
|
+
if (this.isRtlExport()) {
|
|
1459
|
+
workbook.Workbook = {
|
|
1460
|
+
Views: [{ RTL: true }],
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1463
|
+
return workbook;
|
|
1464
|
+
}
|
|
1465
|
+
printPdf(config) {
|
|
1466
|
+
if (typeof document === 'undefined' || typeof window === 'undefined') {
|
|
1467
|
+
return;
|
|
1468
|
+
}
|
|
1469
|
+
const columns = this.getExportableColumns(config.columns);
|
|
1470
|
+
const region = this.buildPrintRegion(config, columns);
|
|
1471
|
+
this.ensurePrintStyles();
|
|
1472
|
+
document.body.appendChild(region);
|
|
1473
|
+
document.documentElement.classList.add(TableExportService.PRINT_ROOT_CLASS);
|
|
1474
|
+
const cleanup = () => {
|
|
1475
|
+
document.documentElement.classList.remove(TableExportService.PRINT_ROOT_CLASS);
|
|
1476
|
+
region.remove();
|
|
1477
|
+
window.removeEventListener('afterprint', cleanup);
|
|
1478
|
+
};
|
|
1479
|
+
window.addEventListener('afterprint', cleanup);
|
|
1480
|
+
window.print();
|
|
1481
|
+
}
|
|
1482
|
+
ensurePrintStyles() {
|
|
1483
|
+
if (document.getElementById(TableExportService.PRINT_STYLE_ID)) {
|
|
1484
|
+
return;
|
|
1485
|
+
}
|
|
1486
|
+
const style = document.createElement('style');
|
|
1487
|
+
style.id = TableExportService.PRINT_STYLE_ID;
|
|
1488
|
+
style.textContent = TableExportService.PRINT_CSS;
|
|
1489
|
+
document.head.appendChild(style);
|
|
1490
|
+
}
|
|
1491
|
+
getExportableColumns(columns) {
|
|
1492
|
+
return columns.filter((column) => !column.filterOnly &&
|
|
1493
|
+
(column.type !== 'custom' ||
|
|
1494
|
+
column.exportable === true ||
|
|
1495
|
+
!!column.exportValue));
|
|
1496
|
+
}
|
|
1497
|
+
getExcelExportableColumns(columns, rows) {
|
|
1498
|
+
return this.getExportableColumns(columns).filter((column) => {
|
|
1499
|
+
if (column.type !== 'entity')
|
|
1500
|
+
return true;
|
|
1501
|
+
const sampleRow = rows.find((row) => TableValueResolver.getProperty(row, column.key) !== null &&
|
|
1502
|
+
TableValueResolver.getProperty(row, column.key) !== undefined);
|
|
1503
|
+
return (TableValueResolver.getEntityViewType(column, sampleRow) !== 'Attachment');
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
/**
|
|
1507
|
+
* Resolves a single cell's exported/printed scalar. A column-level
|
|
1508
|
+
* `exportValue` always wins; everything else defers to the caller-supplied
|
|
1509
|
+
* resolver. The caller owns entity formatting too so Date/DateTime/Time can
|
|
1510
|
+
* use the configured MT formats instead of leaking raw ISO strings.
|
|
1511
|
+
*/
|
|
1512
|
+
resolveCellValue(row, column, resolveValue) {
|
|
1513
|
+
if (column.exportValue) {
|
|
1514
|
+
return column.exportValue(row);
|
|
1515
|
+
}
|
|
1516
|
+
return resolveValue(row, column);
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Produces rows keyed by column label (Excel header row).
|
|
1520
|
+
* Values already passed through the caller's type-aware resolver.
|
|
1521
|
+
*/
|
|
1522
|
+
buildLabeledRows(rows, columns, resolveValue) {
|
|
1523
|
+
return rows.map((row) => {
|
|
1524
|
+
const labeledRow = {};
|
|
1525
|
+
columns.forEach((column) => {
|
|
1526
|
+
const cellValue = this.resolveCellValue(row, column, resolveValue);
|
|
1527
|
+
labeledRow[column.label] = this.toPlainExportValue(cellValue, true);
|
|
1528
|
+
});
|
|
1529
|
+
return labeledRow;
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
buildPrintRegion(config, columns) {
|
|
1533
|
+
const region = document.createElement('section');
|
|
1534
|
+
region.className = TableExportService.PRINT_REGION_CLASS;
|
|
1535
|
+
region.dir = this.isRtlExport() ? 'rtl' : 'ltr';
|
|
1536
|
+
if (config.title) {
|
|
1537
|
+
const heading = document.createElement('h1');
|
|
1538
|
+
heading.textContent = config.title;
|
|
1539
|
+
region.appendChild(heading);
|
|
1540
|
+
}
|
|
1541
|
+
this.getPrintColumnGroups(columns).forEach((columnGroup) => {
|
|
1542
|
+
region.appendChild(this.buildPrintTable(config, columnGroup));
|
|
1543
|
+
});
|
|
1544
|
+
return region;
|
|
1545
|
+
}
|
|
1546
|
+
buildPrintTable(config, columns) {
|
|
1547
|
+
const table = document.createElement('table');
|
|
1548
|
+
const thead = document.createElement('thead');
|
|
1549
|
+
const headerRow = document.createElement('tr');
|
|
1550
|
+
columns.forEach((column) => {
|
|
1551
|
+
const th = document.createElement('th');
|
|
1552
|
+
th.textContent = column.label;
|
|
1553
|
+
headerRow.appendChild(th);
|
|
1554
|
+
});
|
|
1555
|
+
thead.appendChild(headerRow);
|
|
1556
|
+
table.appendChild(thead);
|
|
1557
|
+
const tbody = document.createElement('tbody');
|
|
1558
|
+
config.rows.forEach((row) => {
|
|
1559
|
+
const tr = document.createElement('tr');
|
|
1560
|
+
columns.forEach((column) => {
|
|
1561
|
+
const td = document.createElement('td');
|
|
1562
|
+
const cellValue = this.resolveCellValue(row, column, config.resolveValue);
|
|
1563
|
+
const plainValue = this.toPlainExportValue(cellValue, true);
|
|
1564
|
+
td.textContent = plainValue === null ? '' : String(plainValue);
|
|
1565
|
+
tr.appendChild(td);
|
|
1566
|
+
});
|
|
1567
|
+
tbody.appendChild(tr);
|
|
1568
|
+
});
|
|
1569
|
+
table.appendChild(tbody);
|
|
1570
|
+
return table;
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* A browser cannot paginate a table horizontally. Keep wide exports inside
|
|
1574
|
+
* the printable page by splitting them into readable tables and repeating
|
|
1575
|
+
* the first (normally identifying) column in every continuation group.
|
|
1576
|
+
*/
|
|
1577
|
+
getPrintColumnGroups(columns) {
|
|
1578
|
+
if (columns.length <= TableExportService.MAX_PRINT_COLUMNS_PER_TABLE) {
|
|
1579
|
+
return [columns];
|
|
1580
|
+
}
|
|
1581
|
+
const [identityColumn, ...remainingColumns] = columns;
|
|
1582
|
+
const continuationSize = TableExportService.MAX_PRINT_COLUMNS_PER_TABLE - 1;
|
|
1583
|
+
const groups = [];
|
|
1584
|
+
for (let index = 0; index < remainingColumns.length; index += continuationSize) {
|
|
1585
|
+
groups.push([
|
|
1586
|
+
identityColumn,
|
|
1587
|
+
...remainingColumns.slice(index, index + continuationSize),
|
|
1588
|
+
]);
|
|
1589
|
+
}
|
|
1590
|
+
return groups;
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* Normalises a resolved cell value for export. Rich-text columns surface their
|
|
1594
|
+
* value as an HTML string, so string cells are stripped to plain text (tags
|
|
1595
|
+
* removed, entities decoded) before they reach an Excel cell or a PDF table
|
|
1596
|
+
* cell. Non-string values (numbers, booleans, dates) pass through untouched.
|
|
1597
|
+
*/
|
|
1598
|
+
toPlainExportValue(value, localizeBoolean) {
|
|
1599
|
+
if (localizeBoolean &&
|
|
1600
|
+
typeof value === 'boolean' &&
|
|
1601
|
+
this.isArabicExport()) {
|
|
1602
|
+
return this.transloco.translate(value ? 'components.table.yes' : 'components.table.no');
|
|
1603
|
+
}
|
|
1604
|
+
return typeof value === 'string'
|
|
1605
|
+
? stripHtmlToPlainText(value)
|
|
1606
|
+
: (value ?? null);
|
|
1607
|
+
}
|
|
1608
|
+
configureWorksheet(worksheet, columns, rows) {
|
|
1609
|
+
if (worksheet['!ref']) {
|
|
1610
|
+
worksheet['!autofilter'] = { ref: worksheet['!ref'] };
|
|
1611
|
+
}
|
|
1612
|
+
worksheet['!cols'] = columns.map((column) => {
|
|
1613
|
+
const contentWidth = rows.reduce((width, row) => Math.max(width, String(row[column.label] ?? '').length), column.label.length);
|
|
1614
|
+
return { wch: Math.min(50, Math.max(10, contentWidth + 2)) };
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
isArabicExport() {
|
|
1618
|
+
return /^ar(?:-|$)/i.test(this.transloco.getActiveLang());
|
|
1619
|
+
}
|
|
1620
|
+
isRtlExport() {
|
|
1621
|
+
const language = this.transloco.getActiveLang();
|
|
1622
|
+
const documentIsRtl = typeof document !== 'undefined' &&
|
|
1623
|
+
document.documentElement.dir.toLowerCase() === 'rtl';
|
|
1624
|
+
return TableExportService.RTL_LANGUAGES.test(language) || documentIsRtl;
|
|
1625
|
+
}
|
|
1626
|
+
normalizeFilename(value) {
|
|
1627
|
+
const sanitized = (value ?? '').trim().replace(/[\\/:*?"<>|]+/g, '-');
|
|
1628
|
+
return sanitized.length ? sanitized : 'download';
|
|
1629
|
+
}
|
|
1630
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableExportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1631
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableExportService, providedIn: 'root' });
|
|
1632
|
+
}
|
|
1633
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TableExportService, decorators: [{
|
|
1634
|
+
type: Injectable,
|
|
1635
|
+
args: [{ providedIn: 'root' }]
|
|
1636
|
+
}] });
|
|
1637
|
+
|
|
1638
|
+
/**
|
|
1639
|
+
* Column filter types that produce useful (low-cardinality) row groups.
|
|
1640
|
+
* Unique-valued columns (plain text, dates) would create a group per row —
|
|
1641
|
+
* pointless visually and slow — so we exclude them from the group picker.
|
|
1642
|
+
*/
|
|
1643
|
+
const GROUPABLE_FILTER_TYPES = new Set([
|
|
1644
|
+
'select',
|
|
1645
|
+
'boolean',
|
|
1646
|
+
'user',
|
|
1647
|
+
]);
|
|
1648
|
+
/**
|
|
1649
|
+
* Entity view types whose values are categorical enough to bucket rows by.
|
|
1650
|
+
* Entity columns are judged on this rather than their filter type: a
|
|
1651
|
+
* `LookupMatrix` (e.g. a risk Classification) filters as free text but its
|
|
1652
|
+
* values are a small fixed set, so it groups perfectly well.
|
|
1653
|
+
*/
|
|
1654
|
+
const GROUPABLE_ENTITY_VIEW_TYPES = new Set([
|
|
1655
|
+
'Status',
|
|
1656
|
+
'Lookup',
|
|
1657
|
+
'LookupMatrix',
|
|
1658
|
+
'PhaseGate',
|
|
1659
|
+
'User',
|
|
1660
|
+
'Checkbox',
|
|
1661
|
+
]);
|
|
1662
|
+
/** Bucket every row whose grouped value is missing/empty falls into. */
|
|
1663
|
+
const EMPTY_GROUP_KEY = '__mt_group_empty__';
|
|
1664
|
+
/**
|
|
1665
|
+
* Pure controller owning all row-grouping concerns. Table instantiates one and
|
|
1666
|
+
* binds its signals — keeps grouping logic out of table.ts.
|
|
1667
|
+
*
|
|
1668
|
+
* PrimeNG's subheader grouping renders only when `sortField === groupRowsBy`.
|
|
1669
|
+
* `setGroup` therefore also pins the sort to the grouped column; clearing the
|
|
1670
|
+
* group leaves the user's sort untouched.
|
|
1671
|
+
*/
|
|
1672
|
+
class TableGroupingController {
|
|
1673
|
+
columns;
|
|
1674
|
+
rows;
|
|
1675
|
+
groupBy;
|
|
1676
|
+
sortField;
|
|
1677
|
+
sortDirection;
|
|
1678
|
+
transloco;
|
|
1679
|
+
constructor(columns, rows, groupBy, sortField, sortDirection, transloco) {
|
|
1680
|
+
this.columns = columns;
|
|
1681
|
+
this.rows = rows;
|
|
1682
|
+
this.groupBy = groupBy;
|
|
1683
|
+
this.sortField = sortField;
|
|
1684
|
+
this.sortDirection = sortDirection;
|
|
1685
|
+
this.transloco = transloco;
|
|
1686
|
+
}
|
|
1687
|
+
translate(key) {
|
|
1688
|
+
return this.transloco ? this.transloco.translate(key) : key;
|
|
1689
|
+
}
|
|
1690
|
+
groupableColumns = computed(() => {
|
|
1691
|
+
const sampleRow = this.rows()[0];
|
|
1692
|
+
return this.columns().filter((col) => {
|
|
1693
|
+
if (col.filterOnly)
|
|
1694
|
+
return false;
|
|
1695
|
+
// Explicit `groupable` wins over the cardinality heuristic in both
|
|
1696
|
+
// directions — the host knows when a high-cardinality column is still
|
|
1697
|
+
// worth grouping (backend-ordered) or when a low-cardinality one isn't.
|
|
1698
|
+
if (typeof col.groupable === 'boolean')
|
|
1699
|
+
return col.groupable;
|
|
1700
|
+
if (col.type === 'custom')
|
|
1701
|
+
return false;
|
|
1702
|
+
if (col.type === 'entity') {
|
|
1703
|
+
const viewType = TableValueResolver.getEntityViewType(col, sampleRow);
|
|
1704
|
+
return !!viewType && GROUPABLE_ENTITY_VIEW_TYPES.has(viewType);
|
|
1705
|
+
}
|
|
1706
|
+
const filterType = TableValueResolver.getColumnFilterType(col, sampleRow);
|
|
1707
|
+
return filterType !== null && GROUPABLE_FILTER_TYPES.has(filterType);
|
|
1708
|
+
});
|
|
1709
|
+
}, ...(ngDevMode ? [{ debugName: "groupableColumns" }] : /* istanbul ignore next */ []));
|
|
1710
|
+
/**
|
|
1711
|
+
* Row counts per group key — consumed by the group header template so each
|
|
1712
|
+
* subheader can show "Status: Active (12)".
|
|
1713
|
+
*/
|
|
1714
|
+
groupCounts = computed(() => {
|
|
1715
|
+
const column = this.activeGroupColumn();
|
|
1716
|
+
if (!column)
|
|
1717
|
+
return new Map();
|
|
1718
|
+
const counts = new Map();
|
|
1719
|
+
for (const row of this.rows()) {
|
|
1720
|
+
const key = this.getGroupKey(row, column);
|
|
1721
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
1722
|
+
}
|
|
1723
|
+
return counts;
|
|
1724
|
+
}, ...(ngDevMode ? [{ debugName: "groupCounts" }] : /* istanbul ignore next */ []));
|
|
1725
|
+
getGroupCount(row) {
|
|
1726
|
+
const column = this.activeGroupColumn();
|
|
1727
|
+
if (!column)
|
|
1728
|
+
return 0;
|
|
1729
|
+
return this.groupCounts().get(this.getGroupKey(row, column)) ?? 0;
|
|
1730
|
+
}
|
|
1731
|
+
activeGroupColumn = computed(() => {
|
|
1732
|
+
const key = this.groupBy();
|
|
1733
|
+
if (!key)
|
|
1734
|
+
return null;
|
|
1735
|
+
return this.columns().find((col) => col.key === key) ?? null;
|
|
1736
|
+
}, ...(ngDevMode ? [{ debugName: "activeGroupColumn" }] : /* istanbul ignore next */ []));
|
|
1737
|
+
groupingActive = computed(() => this.activeGroupColumn() !== null, ...(ngDevMode ? [{ debugName: "groupingActive" }] : /* istanbul ignore next */ []));
|
|
1738
|
+
/**
|
|
1739
|
+
* Whether the group header repeats the grouped column's name before the
|
|
1740
|
+
* value. Opt-out per column via `ColumnDef.showGroupColumnLabel`.
|
|
1741
|
+
*/
|
|
1742
|
+
showsGroupColumnLabel = computed(() => this.activeGroupColumn()?.showGroupColumnLabel !== false, ...(ngDevMode ? [{ debugName: "showsGroupColumnLabel" }] : /* istanbul ignore next */ []));
|
|
1743
|
+
/**
|
|
1744
|
+
* Returns true when the given column is the active group column and
|
|
1745
|
+
* therefore cannot have its sort cleared (PrimeNG requirement).
|
|
1746
|
+
*/
|
|
1747
|
+
isGroupLockedSort(columnKey) {
|
|
1748
|
+
return this.groupingActive() && this.activeGroupColumn()?.key === columnKey;
|
|
1749
|
+
}
|
|
1750
|
+
setGroup(key) {
|
|
1751
|
+
this.groupBy.set(key && key.length > 0 ? key : null);
|
|
1752
|
+
if (key) {
|
|
1753
|
+
this.sortField.set(key);
|
|
1754
|
+
if (this.sortDirection() === null) {
|
|
1755
|
+
this.sortDirection.set('asc');
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* Display label for a row's grouped value — used by the `#groupheader`
|
|
1761
|
+
* template. Leverages the same resolver pipeline the cells use, so status
|
|
1762
|
+
* maps / user display names render consistently.
|
|
1763
|
+
*/
|
|
1764
|
+
getGroupLabel(row) {
|
|
1765
|
+
const column = this.activeGroupColumn();
|
|
1766
|
+
if (!column)
|
|
1767
|
+
return '';
|
|
1768
|
+
const cellValue = TableValueResolver.getProperty(row, column.key);
|
|
1769
|
+
if (cellValue === null || cellValue === undefined || cellValue === '') {
|
|
1770
|
+
return '—';
|
|
1771
|
+
}
|
|
1772
|
+
if (column.type === 'entity') {
|
|
1773
|
+
const entityValue = TableValueResolver.getEntityValueByType(cellValue, 'export');
|
|
1774
|
+
return entityValue === null ? '—' : String(entityValue);
|
|
1775
|
+
}
|
|
1776
|
+
const display = TableValueResolver.resolveDisplayValue(cellValue);
|
|
1777
|
+
if (display === null || display === undefined)
|
|
1778
|
+
return '—';
|
|
1779
|
+
if (typeof display === 'boolean')
|
|
1780
|
+
return display
|
|
1781
|
+
? this.translate('components.table.yes')
|
|
1782
|
+
: this.translate('components.table.no');
|
|
1783
|
+
return String(display);
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Accent color for status/entity-Status group headers. Reused from the
|
|
1787
|
+
* cell renderer's status-map pipeline so tint is consistent with the cell.
|
|
1788
|
+
*/
|
|
1789
|
+
getGroupAccentColor(row) {
|
|
1790
|
+
const column = this.activeGroupColumn();
|
|
1791
|
+
if (!column)
|
|
1792
|
+
return null;
|
|
1793
|
+
if (column.type !== 'status' && column.type !== 'entity')
|
|
1794
|
+
return null;
|
|
1795
|
+
const cellValue = TableValueResolver.getProperty(row, column.key);
|
|
1796
|
+
if (cellValue === null || cellValue === undefined)
|
|
1797
|
+
return null;
|
|
1798
|
+
if (typeof cellValue === 'object') {
|
|
1799
|
+
const obj = cellValue;
|
|
1800
|
+
const color = obj['color'];
|
|
1801
|
+
if (typeof color === 'string' && color.length > 0)
|
|
1802
|
+
return color;
|
|
1803
|
+
// Entity cells carry the color on the resolved value, not the wrapper.
|
|
1804
|
+
const value = obj['value'];
|
|
1805
|
+
if (value && typeof value === 'object') {
|
|
1806
|
+
const valueColor = value['color'];
|
|
1807
|
+
if (typeof valueColor === 'string' && valueColor.length > 0) {
|
|
1808
|
+
return valueColor;
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
return null;
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* Returns the stable string key for the active group column on this row.
|
|
1816
|
+
* Used to add a synthetic `__mt_group__` field so PrimeNG compares a plain
|
|
1817
|
+
* string rather than a complex entity object (whose JSON representation is
|
|
1818
|
+
* not stable across rows).
|
|
1819
|
+
*/
|
|
1820
|
+
getGroupSortKey(row) {
|
|
1821
|
+
const column = this.activeGroupColumn();
|
|
1822
|
+
if (!column)
|
|
1823
|
+
return '';
|
|
1824
|
+
return this.getGroupKey(row, column);
|
|
1825
|
+
}
|
|
1826
|
+
/** Stable key used to bucket rows into groups — normalised to string. */
|
|
1827
|
+
getGroupKey(row, column) {
|
|
1828
|
+
// A column can name its own identity field, so rows sharing a display
|
|
1829
|
+
// label still split into separate groups (and vice versa).
|
|
1830
|
+
if (column.groupKey) {
|
|
1831
|
+
const identity = TableValueResolver.getProperty(row, column.groupKey);
|
|
1832
|
+
return identity === null || identity === undefined || identity === ''
|
|
1833
|
+
? EMPTY_GROUP_KEY
|
|
1834
|
+
: String(identity);
|
|
1835
|
+
}
|
|
1836
|
+
const cellValue = TableValueResolver.getProperty(row, column.key);
|
|
1837
|
+
if (cellValue === null || cellValue === undefined || cellValue === '') {
|
|
1838
|
+
return EMPTY_GROUP_KEY;
|
|
1839
|
+
}
|
|
1840
|
+
if (column.type === 'entity') {
|
|
1841
|
+
const entityValue = TableValueResolver.getEntityValueByType(cellValue, 'filter');
|
|
1842
|
+
return entityValue === null ? EMPTY_GROUP_KEY : String(entityValue);
|
|
1843
|
+
}
|
|
1844
|
+
const display = TableValueResolver.resolveDisplayValue(cellValue);
|
|
1845
|
+
return display === null || display === undefined
|
|
1846
|
+
? EMPTY_GROUP_KEY
|
|
1847
|
+
: String(display);
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
const DEFAULT_PERSIST_STATE_EXCLUDE = ['pagePosition'];
|
|
1852
|
+
class Table {
|
|
1853
|
+
static LOADING_COLUMN_COUNT = 5;
|
|
1854
|
+
selectionChange = output();
|
|
1855
|
+
cellChange = output();
|
|
1856
|
+
lazyLoad = output();
|
|
1857
|
+
columnReorder = output();
|
|
1858
|
+
rowReorder = output();
|
|
1859
|
+
rowClick = output();
|
|
1860
|
+
/** Fired when the empty state's action button is pressed. */
|
|
1861
|
+
emptyAction = output();
|
|
1862
|
+
/**
|
|
1863
|
+
* Fires when the per-row actions popover is opened (3-dots click) so the
|
|
1864
|
+
* parent can lazy-load row-specific actions instead of fetching for every
|
|
1865
|
+
* visible row up front. Only emitted when `actionShape` is `popover`.
|
|
1866
|
+
*/
|
|
1867
|
+
rowActionsRequested = output();
|
|
1868
|
+
filters = model({}, ...(ngDevMode ? [{ debugName: "filters" }] : /* istanbul ignore next */ []));
|
|
1869
|
+
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
1870
|
+
columns = input.required(...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
1871
|
+
rowActions = input([], ...(ngDevMode ? [{ debugName: "rowActions" }] : /* istanbul ignore next */ []));
|
|
1872
|
+
size = input(undefined, ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1873
|
+
showGridlines = input(false, { ...(ngDevMode ? { debugName: "showGridlines" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1874
|
+
stripedRows = input(false, { ...(ngDevMode ? { debugName: "stripedRows" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1875
|
+
selectableRows = input(false, { ...(ngDevMode ? { debugName: "selectableRows" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1876
|
+
clickableRows = input(false, { ...(ngDevMode ? { debugName: "clickableRows" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1877
|
+
generalSearch = input(false, { ...(ngDevMode ? { debugName: "generalSearch" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1878
|
+
lazyLocalSearch = input(false, { ...(ngDevMode ? { debugName: "lazyLocalSearch" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1879
|
+
showFilters = input(false, { ...(ngDevMode ? { debugName: "showFilters" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1880
|
+
filterMode = input('popover', ...(ngDevMode ? [{ debugName: "filterMode" }] : /* istanbul ignore next */ []));
|
|
1881
|
+
loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1882
|
+
updating = input(false, { ...(ngDevMode ? { debugName: "updating" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1883
|
+
lazy = input(false, { ...(ngDevMode ? { debugName: "lazy" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1884
|
+
lazyLocalSort = input(false, { ...(ngDevMode ? { debugName: "lazyLocalSort" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1885
|
+
lazyTotalRecords = input(...(ngDevMode ? [undefined, { debugName: "lazyTotalRecords" }] : /* istanbul ignore next */ []));
|
|
1886
|
+
reorderableColumns = input(false, { ...(ngDevMode ? { debugName: "reorderableColumns" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1887
|
+
reorderableRows = input(false, { ...(ngDevMode ? { debugName: "reorderableRows" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1888
|
+
dataKey = input(...(ngDevMode ? [undefined, { debugName: "dataKey" }] : /* istanbul ignore next */ []));
|
|
1889
|
+
storageKey = input(null, ...(ngDevMode ? [{ debugName: "storageKey" }] : /* istanbul ignore next */ []));
|
|
1890
|
+
storageMode = input('local', ...(ngDevMode ? [{ debugName: "storageMode" }] : /* istanbul ignore next */ []));
|
|
1891
|
+
persistStateExclude = input(DEFAULT_PERSIST_STATE_EXCLUDE, ...(ngDevMode ? [{ debugName: "persistStateExclude" }] : /* istanbul ignore next */ []));
|
|
1892
|
+
exportable = input(false, { ...(ngDevMode ? { debugName: "exportable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1893
|
+
printable = input(false, { ...(ngDevMode ? { debugName: "printable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1894
|
+
groupable = input(false, { ...(ngDevMode ? { debugName: "groupable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1895
|
+
/**
|
|
1896
|
+
* Optional external group-count map keyed by the group display label
|
|
1897
|
+
* (e.g. `"Approved" → 42`). When provided, the group header shows these
|
|
1898
|
+
* totals instead of the local page row count. Use this in lazy tables where
|
|
1899
|
+
* the backend provides total-count-per-group via KPI/stats data.
|
|
1900
|
+
*/
|
|
1901
|
+
groupCountMap = input(null, ...(ngDevMode ? [{ debugName: "groupCountMap" }] : /* istanbul ignore next */ []));
|
|
1902
|
+
cellClickFilter = input(false, { ...(ngDevMode ? { debugName: "cellClickFilter" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1903
|
+
/**
|
|
1904
|
+
* When true and `rowActions` is non-empty, the trailing actions column is
|
|
1905
|
+
* pinned to the right via PrimeNG's frozen-column support. The table also
|
|
1906
|
+
* switches to scrollable mode so horizontal scrolling reveals the rest of
|
|
1907
|
+
* the columns while the actions stay visible. Off by default to preserve
|
|
1908
|
+
* existing layout for tables that don't opt in.
|
|
1909
|
+
*/
|
|
1910
|
+
freezeActions = input(false, { ...(ngDevMode ? { debugName: "freezeActions" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1911
|
+
virtualScroll = input(false, { ...(ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1912
|
+
virtualScrollItemSize = input(52, ...(ngDevMode ? [{ debugName: "virtualScrollItemSize" }] : /* istanbul ignore next */ []));
|
|
1913
|
+
scrollHeight = input('520px', ...(ngDevMode ? [{ debugName: "scrollHeight" }] : /* istanbul ignore next */ []));
|
|
1914
|
+
printTitle = input('', ...(ngDevMode ? [{ debugName: "printTitle" }] : /* istanbul ignore next */ []));
|
|
1915
|
+
exportFilename = input('download', ...(ngDevMode ? [{ debugName: "exportFilename" }] : /* istanbul ignore next */ []));
|
|
1916
|
+
actionShape = input('flat', ...(ngDevMode ? [{ debugName: "actionShape" }] : /* istanbul ignore next */ []));
|
|
1917
|
+
/**
|
|
1918
|
+
* Optional per-row predicate. When it returns true for a given row, the
|
|
1919
|
+
* row-actions popover renders a small skeleton block instead of the action
|
|
1920
|
+
* list — used while a parent is fetching that row's actions on demand.
|
|
1921
|
+
*/
|
|
1922
|
+
rowActionsLoadingFn = input(null, ...(ngDevMode ? [{ debugName: "rowActionsLoadingFn" }] : /* istanbul ignore next */ []));
|
|
1923
|
+
tableLayout = input('fixed', ...(ngDevMode ? [{ debugName: "tableLayout" }] : /* istanbul ignore next */ []));
|
|
1924
|
+
noCard = input(false, { ...(ngDevMode ? { debugName: "noCard" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1925
|
+
dateFormat = inject(MTDateFormatPipe);
|
|
1926
|
+
// Tabs inputs and outputs
|
|
1927
|
+
tabs = input(...(ngDevMode ? [undefined, { debugName: "tabs" }] : /* istanbul ignore next */ []));
|
|
1928
|
+
tabsOptionLabel = input('label', ...(ngDevMode ? [{ debugName: "tabsOptionLabel" }] : /* istanbul ignore next */ []));
|
|
1929
|
+
tabsOptionValue = input('value', ...(ngDevMode ? [{ debugName: "tabsOptionValue" }] : /* istanbul ignore next */ []));
|
|
1930
|
+
activeTab = model(...(ngDevMode ? [undefined, { debugName: "activeTab" }] : /* istanbul ignore next */ []));
|
|
1931
|
+
onTabChange = output();
|
|
1932
|
+
// Table actions inputs and outputs
|
|
1933
|
+
actions = input([], ...(ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []));
|
|
1934
|
+
// Content TemplateRefs
|
|
1935
|
+
captionStartContent = contentChild('captionStart', ...(ngDevMode ? [{ debugName: "captionStartContent" }] : /* istanbul ignore next */ []));
|
|
1936
|
+
captionEndContent = contentChild('captionEnd', ...(ngDevMode ? [{ debugName: "captionEndContent" }] : /* istanbul ignore next */ []));
|
|
1937
|
+
emptyContent = contentChild('empty', ...(ngDevMode ? [{ debugName: "emptyContent" }] : /* istanbul ignore next */ []));
|
|
1938
|
+
/**
|
|
1939
|
+
* Copy for the empty state. Left unset, the table falls back to the generic
|
|
1940
|
+
* "Nothing here yet" / "No results match your filters" pair — but a list that
|
|
1941
|
+
* knows what it holds should say so, which is the whole point of finding
|
|
1942
|
+
* H-12: `emptyDescription="Deliverables you own appear here."`
|
|
1943
|
+
*/
|
|
1944
|
+
emptyTitle = input(...(ngDevMode ? [undefined, { debugName: "emptyTitle" }] : /* istanbul ignore next */ []));
|
|
1945
|
+
emptyDescription = input(...(ngDevMode ? [undefined, { debugName: "emptyDescription" }] : /* istanbul ignore next */ []));
|
|
1946
|
+
/**
|
|
1947
|
+
* Call to action on the empty state. Supplying a label takes ownership of the
|
|
1948
|
+
* behaviour: `emptyAction` fires and the table does nothing else. Without
|
|
1949
|
+
* one, a filtered-empty table offers "Clear filters" and handles it itself.
|
|
1950
|
+
*/
|
|
1951
|
+
emptyActionLabel = input(...(ngDevMode ? [undefined, { debugName: "emptyActionLabel" }] : /* istanbul ignore next */ []));
|
|
1952
|
+
emptyActionIcon = input(...(ngDevMode ? [undefined, { debugName: "emptyActionIcon" }] : /* istanbul ignore next */ []));
|
|
1953
|
+
paginatorPosition = input('end', ...(ngDevMode ? [{ debugName: "paginatorPosition" }] : /* istanbul ignore next */ []));
|
|
1954
|
+
/**
|
|
1955
|
+
* Pagination for a single page of rows is noise that implies more data
|
|
1956
|
+
* exists, so it is off by default now (finding M-05). Set it when the row
|
|
1957
|
+
* count is genuinely unknown to the user and the "1 of 1" is reassuring.
|
|
1958
|
+
*/
|
|
1959
|
+
alwaysShowPaginator = input(false, { ...(ngDevMode ? { debugName: "alwaysShowPaginator" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1960
|
+
rowsPerPageOptions = input([5, 10, 20, 50, 100], ...(ngDevMode ? [{ debugName: "rowsPerPageOptions" }] : /* istanbul ignore next */ []));
|
|
1961
|
+
pageSize = model(10, ...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
|
|
1962
|
+
currentPage = model(0, ...(ngDevMode ? [{ debugName: "currentPage" }] : /* istanbul ignore next */ []));
|
|
1963
|
+
first = model(0, ...(ngDevMode ? [{ debugName: "first" }] : /* istanbul ignore next */ []));
|
|
1964
|
+
filterTerm = model('', ...(ngDevMode ? [{ debugName: "filterTerm" }] : /* istanbul ignore next */ []));
|
|
1965
|
+
groupBy = model(null, ...(ngDevMode ? [{ debugName: "groupBy" }] : /* istanbul ignore next */ []));
|
|
1966
|
+
/**
|
|
1967
|
+
* Sort state is a `model` so a lazy host that owns sort itself (URL / store)
|
|
1968
|
+
* can push its value in instead of letting the table drift out of sync with
|
|
1969
|
+
* the query it actually sent.
|
|
1970
|
+
*/
|
|
1971
|
+
sortField = model(null, ...(ngDevMode ? [{ debugName: "sortField" }] : /* istanbul ignore next */ []));
|
|
1972
|
+
sortDirection = model(null, ...(ngDevMode ? [{ debugName: "sortDirection" }] : /* istanbul ignore next */ []));
|
|
1973
|
+
confirmationService = inject(ConfirmationService);
|
|
1974
|
+
exportService = inject(TableExportService);
|
|
1975
|
+
transloco = inject(TranslocoService);
|
|
1976
|
+
grouping;
|
|
1977
|
+
selectedRowKeys = signal(new Set(), ...(ngDevMode ? [{ debugName: "selectedRowKeys" }] : /* istanbul ignore next */ []));
|
|
1978
|
+
transientSelectedRows = signal(new Set(), ...(ngDevMode ? [{ debugName: "transientSelectedRows" }] : /* istanbul ignore next */ []));
|
|
1979
|
+
hydratedStorageKey = signal(null, ...(ngDevMode ? [{ debugName: "hydratedStorageKey" }] : /* istanbul ignore next */ []));
|
|
1980
|
+
storageHydrated = signal(false, ...(ngDevMode ? [{ debugName: "storageHydrated" }] : /* istanbul ignore next */ []));
|
|
1981
|
+
isColumnFilterMode = computed(() => this.showFilters() && this.filterMode() === 'column', ...(ngDevMode ? [{ debugName: "isColumnFilterMode" }] : /* istanbul ignore next */ []));
|
|
1982
|
+
filterableColumnMap = computed(() => {
|
|
1983
|
+
if (!this.isColumnFilterMode()) {
|
|
1984
|
+
return new Map();
|
|
1985
|
+
}
|
|
1986
|
+
const data = this.data();
|
|
1987
|
+
const map = new Map();
|
|
1988
|
+
this.columns().forEach((col) => {
|
|
1989
|
+
if (TableValueResolver.getColumnFilterType(col, data[0]) === null) {
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
map.set(col.key, TableValueResolver.buildFilterableColumn(col, data));
|
|
1993
|
+
});
|
|
1994
|
+
return map;
|
|
1995
|
+
}, ...(ngDevMode ? [{ debugName: "filterableColumnMap" }] : /* istanbul ignore next */ []));
|
|
1996
|
+
getFilterableColumn(key) {
|
|
1997
|
+
return this.filterableColumnMap().get(key);
|
|
1998
|
+
}
|
|
1999
|
+
onColumnFilterChange(key, value) {
|
|
2000
|
+
const next = { ...this.filters() };
|
|
2001
|
+
if (value === null || value === undefined) {
|
|
2002
|
+
delete next[key];
|
|
2003
|
+
}
|
|
2004
|
+
else {
|
|
2005
|
+
next[key] = value;
|
|
2006
|
+
}
|
|
2007
|
+
this.onFilterApplied(next);
|
|
2008
|
+
}
|
|
2009
|
+
activeFilterCount = computed(() => {
|
|
2010
|
+
const filters = this.filters();
|
|
2011
|
+
return Object.values(filters).filter((value) => value !== null && value !== undefined && value !== '').length;
|
|
2012
|
+
}, ...(ngDevMode ? [{ debugName: "activeFilterCount" }] : /* istanbul ignore next */ []));
|
|
2013
|
+
/**
|
|
2014
|
+
* Whether the user narrowed the list themselves. Drives which empty state the
|
|
2015
|
+
* table shows: "nothing matched what you asked for, clear it" reads very
|
|
2016
|
+
* differently from "this list has nothing in it yet" (finding H-12).
|
|
2017
|
+
*/
|
|
2018
|
+
hasActiveFilters = computed(() => this.activeFilterCount() > 0 || this.filterTerm().trim().length > 0, ...(ngDevMode ? [{ debugName: "hasActiveFilters" }] : /* istanbul ignore next */ []));
|
|
2019
|
+
/** Action offered on the empty state. Defaults to clearing an active filter. */
|
|
2020
|
+
resolvedEmptyActionLabel = computed(() => {
|
|
2021
|
+
const configured = this.emptyActionLabel()?.trim();
|
|
2022
|
+
if (configured) {
|
|
2023
|
+
return configured;
|
|
2024
|
+
}
|
|
2025
|
+
return this.hasActiveFilters()
|
|
2026
|
+
? this.transloco.translate('components.emptyState.clearFilters')
|
|
2027
|
+
: undefined;
|
|
2028
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedEmptyActionLabel" }] : /* istanbul ignore next */ []));
|
|
2029
|
+
resolvedEmptyActionIcon = computed(() => {
|
|
2030
|
+
if (this.emptyActionLabel()?.trim()) {
|
|
2031
|
+
return this.emptyActionIcon();
|
|
2032
|
+
}
|
|
2033
|
+
return this.hasActiveFilters() ? 'general.x-close' : undefined;
|
|
2034
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedEmptyActionIcon" }] : /* istanbul ignore next */ []));
|
|
2035
|
+
/**
|
|
2036
|
+
* The empty-state action. A caller that supplied its own label owns the
|
|
2037
|
+
* behaviour and just gets the event; otherwise the default action is the one
|
|
2038
|
+
* the default label promises — clear the filters and the search term.
|
|
2039
|
+
*/
|
|
2040
|
+
onEmptyAction() {
|
|
2041
|
+
if (this.emptyActionLabel()?.trim()) {
|
|
2042
|
+
this.emptyAction.emit();
|
|
2043
|
+
return;
|
|
2044
|
+
}
|
|
2045
|
+
this.filterTerm.set('');
|
|
2046
|
+
this.onFilterApplied({});
|
|
2047
|
+
this.emptyAction.emit();
|
|
2048
|
+
}
|
|
2049
|
+
filteredData = computed(() => {
|
|
2050
|
+
const data = this.data();
|
|
2051
|
+
const applyLocalSearch = !this.lazy() || this.lazyLocalSearch();
|
|
2052
|
+
const applyLocalSort = !this.lazy() || this.lazyLocalSort();
|
|
2053
|
+
const searchTerm = applyLocalSearch
|
|
2054
|
+
? this.filterTerm().trim().toLowerCase()
|
|
2055
|
+
: '';
|
|
2056
|
+
const filters = this.filters();
|
|
2057
|
+
const filterKeys = this.lazy() ? [] : Object.keys(filters);
|
|
2058
|
+
let result = data;
|
|
2059
|
+
// Apply search term — recurse into nested objects/arrays so column keys
|
|
2060
|
+
// that point at a nested display (e.g. `name.display` on a lookup row)
|
|
2061
|
+
// are still searched. Top-level-only matching used to drop multi-word
|
|
2062
|
+
// queries on tables whose display string lives one level deep.
|
|
2063
|
+
if (searchTerm !== '') {
|
|
2064
|
+
result = result.filter((item) => TableValueResolver.matchesSearchTerm(item, searchTerm));
|
|
2065
|
+
}
|
|
2066
|
+
// Apply column filters
|
|
2067
|
+
if (filterKeys.length > 0) {
|
|
2068
|
+
result = result.filter((item) => filterKeys.every((key) => this.matchesFilter(item, key, filters[key])));
|
|
2069
|
+
}
|
|
2070
|
+
return applyLocalSort ? this.sortData(result) : result;
|
|
2071
|
+
}, ...(ngDevMode ? [{ debugName: "filteredData" }] : /* istanbul ignore next */ []));
|
|
2072
|
+
renderedColumns = computed(() => {
|
|
2073
|
+
const visible = this.columns().filter((column) => !column.filterOnly);
|
|
2074
|
+
// The grouped column's value is already the group header — repeating it in
|
|
2075
|
+
// every row is noise. Never hide the last one, or the table would render
|
|
2076
|
+
// with no columns at all. Export/print still read the full `columns()`.
|
|
2077
|
+
const groupedKey = this.groupBy();
|
|
2078
|
+
const withoutGrouped = groupedKey
|
|
2079
|
+
? visible.filter((column) => column.key !== groupedKey)
|
|
2080
|
+
: visible;
|
|
2081
|
+
const columns = withoutGrouped.length ? withoutGrouped : visible;
|
|
2082
|
+
if (columns.length > 0 || !this.loading()) {
|
|
2083
|
+
return columns;
|
|
2084
|
+
}
|
|
2085
|
+
return Array.from({ length: Table.LOADING_COLUMN_COUNT }, (_, index) => ({
|
|
2086
|
+
key: `__loading-${index}`,
|
|
2087
|
+
label: '',
|
|
2088
|
+
type: 'text',
|
|
2089
|
+
}));
|
|
2090
|
+
}, ...(ngDevMode ? [{ debugName: "renderedColumns" }] : /* istanbul ignore next */ []));
|
|
2091
|
+
/**
|
|
2092
|
+
* Synthetic field name added to each row so PrimeNG's `groupRowsBy`
|
|
2093
|
+
* compares a stable primitive string instead of a complex entity object.
|
|
2094
|
+
*/
|
|
2095
|
+
static GROUP_KEY_FIELD = '__mt_group__';
|
|
2096
|
+
groupKeyField = Table.GROUP_KEY_FIELD;
|
|
2097
|
+
displayData = computed(() => {
|
|
2098
|
+
if (this.loading()) {
|
|
2099
|
+
return Array.from({ length: this.pageSize() }, () => ({}));
|
|
2100
|
+
}
|
|
2101
|
+
return this.filteredData();
|
|
2102
|
+
}, ...(ngDevMode ? [{ debugName: "displayData" }] : /* istanbul ignore next */ []));
|
|
2103
|
+
/**
|
|
2104
|
+
* Display data enriched with a stable group key field so PrimeNG groups
|
|
2105
|
+
* rows correctly. Without this, PrimeNG JSON-stringifies the full entity
|
|
2106
|
+
* object (spread of column + backend value), which may differ between rows
|
|
2107
|
+
* even when they share the same status display.
|
|
2108
|
+
*/
|
|
2109
|
+
groupKeyedData = computed(() => {
|
|
2110
|
+
const data = this.displayData();
|
|
2111
|
+
if (!this.grouping.groupingActive())
|
|
2112
|
+
return data;
|
|
2113
|
+
return data.map((row) => ({
|
|
2114
|
+
...row,
|
|
2115
|
+
[Table.GROUP_KEY_FIELD]: this.grouping.getGroupSortKey(row),
|
|
2116
|
+
}));
|
|
2117
|
+
}, ...(ngDevMode ? [{ debugName: "groupKeyedData" }] : /* istanbul ignore next */ []));
|
|
2118
|
+
totalRecords = computed(() => {
|
|
2119
|
+
if (this.lazy() && this.lazyTotalRecords() !== undefined) {
|
|
2120
|
+
return this.lazyTotalRecords();
|
|
2121
|
+
}
|
|
2122
|
+
return this.filteredData().length;
|
|
2123
|
+
}, ...(ngDevMode ? [{ debugName: "totalRecords" }] : /* istanbul ignore next */ []));
|
|
2124
|
+
usesVirtualScroll = computed(() => {
|
|
2125
|
+
if (!this.virtualScroll()) {
|
|
2126
|
+
return false;
|
|
2127
|
+
}
|
|
2128
|
+
const rowCount = this.displayData().length;
|
|
2129
|
+
if (rowCount === 0) {
|
|
2130
|
+
return false;
|
|
2131
|
+
}
|
|
2132
|
+
const itemSize = this.virtualScrollItemSize();
|
|
2133
|
+
if (!Number.isFinite(itemSize) || itemSize <= 0) {
|
|
2134
|
+
return false;
|
|
2135
|
+
}
|
|
2136
|
+
const scrollHeightPx = this.resolveScrollHeightPixels(this.scrollHeight());
|
|
2137
|
+
if (scrollHeightPx === null) {
|
|
2138
|
+
return rowCount > this.pageSize();
|
|
2139
|
+
}
|
|
2140
|
+
return rowCount * itemSize > scrollHeightPx;
|
|
2141
|
+
}, ...(ngDevMode ? [{ debugName: "usesVirtualScroll" }] : /* istanbul ignore next */ []));
|
|
2142
|
+
showPaginator = computed(() => {
|
|
2143
|
+
if (this.virtualScroll()) {
|
|
2144
|
+
return false;
|
|
2145
|
+
}
|
|
2146
|
+
if (this.alwaysShowPaginator()) {
|
|
2147
|
+
return true;
|
|
2148
|
+
}
|
|
2149
|
+
const pageSize = this.pageSize();
|
|
2150
|
+
return pageSize > 0 && this.totalRecords() > pageSize;
|
|
2151
|
+
}, ...(ngDevMode ? [{ debugName: "showPaginator" }] : /* istanbul ignore next */ []));
|
|
2152
|
+
// TODO: remove after updating the toggle and checkbox logic
|
|
2153
|
+
paginatedData = computed(() => {
|
|
2154
|
+
const data = this.filteredData();
|
|
2155
|
+
const first = this.first();
|
|
2156
|
+
const pageSize = this.pageSize();
|
|
2157
|
+
if (this.lazy() || this.virtualScroll()) {
|
|
2158
|
+
return data;
|
|
2159
|
+
}
|
|
2160
|
+
return data.slice(first, first + pageSize);
|
|
2161
|
+
}, ...(ngDevMode ? [{ debugName: "paginatedData" }] : /* istanbul ignore next */ []));
|
|
2162
|
+
allSelectedOnPage = computed(() => {
|
|
2163
|
+
const pageData = this.paginatedData();
|
|
2164
|
+
if (pageData.length === 0)
|
|
2165
|
+
return false;
|
|
2166
|
+
return pageData.every((row) => this.isRowSelected(row));
|
|
2167
|
+
}, ...(ngDevMode ? [{ debugName: "allSelectedOnPage" }] : /* istanbul ignore next */ []));
|
|
2168
|
+
totalColumnSpan = computed(() => this.renderedColumns().length +
|
|
2169
|
+
(this.reorderableRows() ? 1 : 0) +
|
|
2170
|
+
(this.selectableRows() ? 1 : 0) +
|
|
2171
|
+
(this.rowActions().length > 0 ? 1 : 0), ...(ngDevMode ? [{ debugName: "totalColumnSpan" }] : /* istanbul ignore next */ []));
|
|
2172
|
+
constructor() {
|
|
2173
|
+
this.grouping = new TableGroupingController(this.columns, this.filteredData, this.groupBy, this.sortField, this.sortDirection, this.transloco);
|
|
2174
|
+
effect(() => {
|
|
2175
|
+
const storageKey = this.getNormalizedStorageKey();
|
|
2176
|
+
const storage = this.getStorage();
|
|
2177
|
+
const previousStorageKey = this.hydratedStorageKey();
|
|
2178
|
+
this.storageHydrated.set(false);
|
|
2179
|
+
if (!storageKey || !storage) {
|
|
2180
|
+
this.hydratedStorageKey.set(storageKey);
|
|
2181
|
+
this.storageHydrated.set(true);
|
|
2182
|
+
return;
|
|
2183
|
+
}
|
|
2184
|
+
if (previousStorageKey === storageKey) {
|
|
2185
|
+
this.storageHydrated.set(true);
|
|
2186
|
+
return;
|
|
2187
|
+
}
|
|
2188
|
+
const persistedState = this.getRestorablePersistedState(this.readPersistedState(storage, storageKey));
|
|
2189
|
+
this.applyPersistedState(persistedState);
|
|
2190
|
+
this.hydratedStorageKey.set(storageKey);
|
|
2191
|
+
this.storageHydrated.set(true);
|
|
2192
|
+
if (this.lazy() && this.shouldEmitLazyLoadAfterRestore(persistedState)) {
|
|
2193
|
+
queueMicrotask(() => this.emitLazyLoad({}));
|
|
2194
|
+
}
|
|
2195
|
+
});
|
|
2196
|
+
effect(() => {
|
|
2197
|
+
const storageKey = this.getNormalizedStorageKey();
|
|
2198
|
+
const storage = this.getStorage();
|
|
2199
|
+
if (!storageKey ||
|
|
2200
|
+
!storage ||
|
|
2201
|
+
!this.storageHydrated() ||
|
|
2202
|
+
this.hydratedStorageKey() !== storageKey) {
|
|
2203
|
+
return;
|
|
2204
|
+
}
|
|
2205
|
+
this.writePersistedState(storage, storageKey, this.buildPersistedState());
|
|
2206
|
+
});
|
|
2207
|
+
// Drop filters / groupBy whose column no longer exists. Dynamic tables
|
|
2208
|
+
// (e.g. runtime schemas) can drop columns between fetches, which would
|
|
2209
|
+
// otherwise strand a filter the user can't clear from the UI.
|
|
2210
|
+
effect(() => {
|
|
2211
|
+
const columns = this.columns();
|
|
2212
|
+
if (columns.length === 0 || this.loading()) {
|
|
2213
|
+
return;
|
|
2214
|
+
}
|
|
2215
|
+
const validKeys = new Set(columns.map((c) => c.key));
|
|
2216
|
+
const currentFilters = this.filters();
|
|
2217
|
+
const staleFilterKeys = Object.keys(currentFilters).filter((key) => key !== 'generalSearch' && !validKeys.has(key));
|
|
2218
|
+
if (staleFilterKeys.length > 0) {
|
|
2219
|
+
const next = { ...currentFilters };
|
|
2220
|
+
staleFilterKeys.forEach((key) => delete next[key]);
|
|
2221
|
+
this.filters.set(next);
|
|
2222
|
+
}
|
|
2223
|
+
const currentGroup = this.groupBy();
|
|
2224
|
+
if (currentGroup && !validKeys.has(currentGroup)) {
|
|
2225
|
+
this.groupBy.set(null);
|
|
2226
|
+
}
|
|
2227
|
+
});
|
|
2228
|
+
effect(() => {
|
|
2229
|
+
if (this.lazy()) {
|
|
2230
|
+
return;
|
|
2231
|
+
}
|
|
2232
|
+
const totalRecords = this.totalRecords();
|
|
2233
|
+
const pageSize = this.pageSize();
|
|
2234
|
+
const currentFirst = this.first();
|
|
2235
|
+
if (pageSize <= 0) {
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2238
|
+
const maxFirst = totalRecords > 0
|
|
2239
|
+
? Math.floor((totalRecords - 1) / pageSize) * pageSize
|
|
2240
|
+
: 0;
|
|
2241
|
+
const normalizedFirst = Math.min(currentFirst, maxFirst);
|
|
2242
|
+
const normalizedPage = Math.floor(normalizedFirst / pageSize);
|
|
2243
|
+
if (normalizedFirst !== currentFirst) {
|
|
2244
|
+
this.first.set(normalizedFirst);
|
|
2245
|
+
}
|
|
2246
|
+
if (this.currentPage() !== normalizedPage) {
|
|
2247
|
+
this.currentPage.set(normalizedPage);
|
|
2248
|
+
}
|
|
2249
|
+
});
|
|
2250
|
+
}
|
|
2251
|
+
/**
|
|
2252
|
+
* Returns the count for a group row — uses `groupCountMap` when provided
|
|
2253
|
+
* (e.g. backend KPI totals) so lazy tables show the real total instead of
|
|
2254
|
+
* the current-page row count.
|
|
2255
|
+
*/
|
|
2256
|
+
getDisplayGroupCount(row) {
|
|
2257
|
+
const map = this.groupCountMap();
|
|
2258
|
+
if (map) {
|
|
2259
|
+
const label = this.grouping.getGroupLabel(row);
|
|
2260
|
+
const count = map.get(label);
|
|
2261
|
+
if (count !== undefined)
|
|
2262
|
+
return count;
|
|
2263
|
+
}
|
|
2264
|
+
return this.grouping.getGroupCount(row);
|
|
2265
|
+
}
|
|
2266
|
+
/**
|
|
2267
|
+
* Called when the user picks a group column from the caption's actions menu.
|
|
2268
|
+
* Syncs PrimeNG grouping sort state and asks lazy tables to reload grouped
|
|
2269
|
+
* rows consecutively from the backend.
|
|
2270
|
+
*/
|
|
2271
|
+
onGroupByChange(key) {
|
|
2272
|
+
this.groupBy.set(key);
|
|
2273
|
+
if (key) {
|
|
2274
|
+
this.sortField.set(key);
|
|
2275
|
+
if (this.sortDirection() === null) {
|
|
2276
|
+
this.sortDirection.set('asc');
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
else {
|
|
2280
|
+
this.sortField.set(null);
|
|
2281
|
+
this.sortDirection.set(null);
|
|
2282
|
+
}
|
|
2283
|
+
// Grouping re-orders the whole result set, so the current offset points at
|
|
2284
|
+
// unrelated rows — restart at page 1 like a filter change does.
|
|
2285
|
+
this.first.set(0);
|
|
2286
|
+
this.currentPage.set(0);
|
|
2287
|
+
if (this.lazy()) {
|
|
2288
|
+
queueMicrotask(() => this.emitLazyLoad({}));
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
onFilterApplied(filters) {
|
|
2292
|
+
this.filters.set(this.withoutGeneralSearch(filters));
|
|
2293
|
+
this.first.set(0);
|
|
2294
|
+
this.currentPage.set(0);
|
|
2295
|
+
if (this.lazy()) {
|
|
2296
|
+
this.emitLazyLoad({});
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
onFilterReset() {
|
|
2300
|
+
this.filters.set({});
|
|
2301
|
+
this.first.set(0);
|
|
2302
|
+
this.currentPage.set(0);
|
|
2303
|
+
if (this.lazy()) {
|
|
2304
|
+
this.emitLazyLoad({});
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
matchesFilter(item, key, filterValue) {
|
|
2308
|
+
const column = this.columns().find((col) => col.key === key);
|
|
2309
|
+
return TableValueResolver.matchesFilter(item, key, filterValue, column);
|
|
2310
|
+
}
|
|
2311
|
+
toggleRow(row) {
|
|
2312
|
+
const rowKey = this.getRowSelectionKey(row);
|
|
2313
|
+
if (rowKey !== null) {
|
|
2314
|
+
const nextSelection = new Set(this.selectedRowKeys());
|
|
2315
|
+
if (nextSelection.has(rowKey)) {
|
|
2316
|
+
nextSelection.delete(rowKey);
|
|
2317
|
+
}
|
|
2318
|
+
else {
|
|
2319
|
+
nextSelection.add(rowKey);
|
|
2320
|
+
}
|
|
2321
|
+
this.selectedRowKeys.set(nextSelection);
|
|
2322
|
+
}
|
|
2323
|
+
else {
|
|
2324
|
+
const nextSelection = new Set(this.transientSelectedRows());
|
|
2325
|
+
if (nextSelection.has(row)) {
|
|
2326
|
+
nextSelection.delete(row);
|
|
2327
|
+
}
|
|
2328
|
+
else {
|
|
2329
|
+
nextSelection.add(row);
|
|
2330
|
+
}
|
|
2331
|
+
this.transientSelectedRows.set(nextSelection);
|
|
2332
|
+
}
|
|
2333
|
+
this.emitSelectionChange();
|
|
2334
|
+
}
|
|
2335
|
+
toggleAllRowsOnPage() {
|
|
2336
|
+
const pageData = this.paginatedData();
|
|
2337
|
+
const allSelected = this.allSelectedOnPage();
|
|
2338
|
+
const nextSelectedRowKeys = new Set(this.selectedRowKeys());
|
|
2339
|
+
const nextTransientSelection = new Set(this.transientSelectedRows());
|
|
2340
|
+
pageData.forEach((row) => {
|
|
2341
|
+
const rowKey = this.getRowSelectionKey(row);
|
|
2342
|
+
if (rowKey !== null) {
|
|
2343
|
+
if (allSelected) {
|
|
2344
|
+
nextSelectedRowKeys.delete(rowKey);
|
|
2345
|
+
}
|
|
2346
|
+
else {
|
|
2347
|
+
nextSelectedRowKeys.add(rowKey);
|
|
2348
|
+
}
|
|
2349
|
+
return;
|
|
2350
|
+
}
|
|
2351
|
+
if (allSelected) {
|
|
2352
|
+
nextTransientSelection.delete(row);
|
|
2353
|
+
}
|
|
2354
|
+
else {
|
|
2355
|
+
nextTransientSelection.add(row);
|
|
2356
|
+
}
|
|
2357
|
+
});
|
|
2358
|
+
this.selectedRowKeys.set(nextSelectedRowKeys);
|
|
2359
|
+
this.transientSelectedRows.set(nextTransientSelection);
|
|
2360
|
+
this.emitSelectionChange();
|
|
2361
|
+
}
|
|
2362
|
+
getProperty(obj, key) {
|
|
2363
|
+
return TableValueResolver.getProperty(obj, key);
|
|
2364
|
+
}
|
|
2365
|
+
getDateProperty(obj, key) {
|
|
2366
|
+
return TableValueResolver.resolveDateValue(this.getProperty(obj, key));
|
|
2367
|
+
}
|
|
2368
|
+
getEntityPreviewData(row, col) {
|
|
2369
|
+
const cellValue = this.getProperty(row, col.key);
|
|
2370
|
+
if (col.type === 'user') {
|
|
2371
|
+
return this.buildUserEntityData(cellValue, col.label);
|
|
2372
|
+
}
|
|
2373
|
+
if (col.type === 'status') {
|
|
2374
|
+
return this.buildStatusEntityData(cellValue, col);
|
|
2375
|
+
}
|
|
2376
|
+
return null;
|
|
2377
|
+
}
|
|
2378
|
+
/**
|
|
2379
|
+
* Entity data resolver that abstracts over the `user` / `status` vs `entity`
|
|
2380
|
+
* distinction — used by the shared filterable-cell template so the three
|
|
2381
|
+
* cases don't duplicate markup.
|
|
2382
|
+
*/
|
|
2383
|
+
resolveCellEntityData(row, col) {
|
|
2384
|
+
if (col.type === 'entity') {
|
|
2385
|
+
return this.getEntityColumnData(row, col);
|
|
2386
|
+
}
|
|
2387
|
+
if (col.type === 'user' || col.type === 'status') {
|
|
2388
|
+
return this.getEntityPreviewData(row, col);
|
|
2389
|
+
}
|
|
2390
|
+
return null;
|
|
2391
|
+
}
|
|
2392
|
+
tabChanged(tab) {
|
|
2393
|
+
this.filterTerm.set('');
|
|
2394
|
+
this.first.set(0);
|
|
2395
|
+
this.currentPage.set(0);
|
|
2396
|
+
this.onTabChange.emit(tab);
|
|
2397
|
+
}
|
|
2398
|
+
onTablePage(event) {
|
|
2399
|
+
if (this.lazy()) {
|
|
2400
|
+
this.handleLazyLoad(event);
|
|
2401
|
+
return;
|
|
2402
|
+
}
|
|
2403
|
+
this.updatePagingFromEvent(event);
|
|
2404
|
+
}
|
|
2405
|
+
handleLazyLoad(event) {
|
|
2406
|
+
this.updatePagingFromEvent(event);
|
|
2407
|
+
this.emitLazyLoad(event);
|
|
2408
|
+
}
|
|
2409
|
+
onPaginatorPage(event) {
|
|
2410
|
+
if (this.lazy()) {
|
|
2411
|
+
this.handleLazyLoad(event);
|
|
2412
|
+
return;
|
|
2413
|
+
}
|
|
2414
|
+
this.updatePagingFromEvent(event);
|
|
2415
|
+
}
|
|
2416
|
+
onSearchChange(searchTerm) {
|
|
2417
|
+
this.filterTerm.set(searchTerm);
|
|
2418
|
+
this.first.set(0);
|
|
2419
|
+
this.currentPage.set(0);
|
|
2420
|
+
if (this.lazy() && !this.lazyLocalSearch()) {
|
|
2421
|
+
this.emitLazyLoad({});
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
toggleSort(column) {
|
|
2425
|
+
if (!this.isColumnSortable(column)) {
|
|
2426
|
+
return;
|
|
2427
|
+
}
|
|
2428
|
+
if (this.sortField() !== column.key) {
|
|
2429
|
+
this.sortField.set(column.key);
|
|
2430
|
+
this.sortDirection.set('asc');
|
|
2431
|
+
return;
|
|
2432
|
+
}
|
|
2433
|
+
const direction = this.sortDirection();
|
|
2434
|
+
if (direction === 'asc') {
|
|
2435
|
+
this.sortDirection.set('desc');
|
|
2436
|
+
return;
|
|
2437
|
+
}
|
|
2438
|
+
if (direction === 'desc') {
|
|
2439
|
+
// Tri-state reset. PrimeNG subheader grouping breaks without a matching
|
|
2440
|
+
// sort, so when this column is the active group we wrap to 'asc' instead.
|
|
2441
|
+
if (this.grouping.isGroupLockedSort(column.key)) {
|
|
2442
|
+
this.sortDirection.set('asc');
|
|
2443
|
+
}
|
|
2444
|
+
else {
|
|
2445
|
+
this.sortField.set(null);
|
|
2446
|
+
this.sortDirection.set(null);
|
|
2447
|
+
}
|
|
2448
|
+
return;
|
|
2449
|
+
}
|
|
2450
|
+
this.sortDirection.set('asc');
|
|
2451
|
+
}
|
|
2452
|
+
isColumnSortable(column) {
|
|
2453
|
+
return column.sortable === true && (!this.lazy() || this.lazyLocalSort());
|
|
2454
|
+
}
|
|
2455
|
+
getSortIcon(column) {
|
|
2456
|
+
if (this.sortField() !== column.key || !this.sortDirection()) {
|
|
2457
|
+
return 'arrow.chevron-selector-vertical';
|
|
2458
|
+
}
|
|
2459
|
+
return this.sortDirection() === 'asc'
|
|
2460
|
+
? 'arrow.arrow-up'
|
|
2461
|
+
: 'arrow.arrow-down';
|
|
2462
|
+
}
|
|
2463
|
+
onCellChange(row, columnKey, newValue, type) {
|
|
2464
|
+
this.setProperty(row, columnKey, newValue);
|
|
2465
|
+
this.cellChange.emit({
|
|
2466
|
+
row,
|
|
2467
|
+
column: columnKey,
|
|
2468
|
+
value: newValue,
|
|
2469
|
+
type: type,
|
|
2470
|
+
});
|
|
2471
|
+
}
|
|
2472
|
+
resolveActionLoading(action, row) {
|
|
2473
|
+
if (typeof action.loading === 'function') {
|
|
2474
|
+
return action.loading(row);
|
|
2475
|
+
}
|
|
2476
|
+
return action.loading;
|
|
2477
|
+
}
|
|
2478
|
+
getVisibleRowActions(row) {
|
|
2479
|
+
return this.rowActions().filter((action) => !action.hidden?.(row));
|
|
2480
|
+
}
|
|
2481
|
+
getInlineRowActions(row) {
|
|
2482
|
+
return this.getVisibleRowActions(row).filter((action) => action.placement === 'inline');
|
|
2483
|
+
}
|
|
2484
|
+
/**
|
|
2485
|
+
* Menu actions with the destructive ones moved to the bottom.
|
|
2486
|
+
*
|
|
2487
|
+
* The Risks row menu read Preview, Update Risk, **Delete Risk**, Close Risk,
|
|
2488
|
+
* Transfer to Issue, Escalate — the irreversible action third of six, between
|
|
2489
|
+
* the two most common ones, separated from them by nothing but its colour
|
|
2490
|
+
* (finding M-07). Colour alone is not separation, and it is no separation at
|
|
2491
|
+
* all for a user with a colour-vision deficiency. Order within each group is
|
|
2492
|
+
* preserved, so a caller's deliberate sequence still holds.
|
|
2493
|
+
*/
|
|
2494
|
+
getMenuRowActions(row) {
|
|
2495
|
+
const menu = this.getVisibleRowActions(row).filter((action) => action.placement !== 'inline');
|
|
2496
|
+
return [
|
|
2497
|
+
...menu.filter((action) => !Table.isDestructiveAction(action)),
|
|
2498
|
+
...menu.filter((action) => Table.isDestructiveAction(action)),
|
|
2499
|
+
];
|
|
2500
|
+
}
|
|
2501
|
+
/**
|
|
2502
|
+
* True for the first destructive item, which is where the divider goes. The
|
|
2503
|
+
* divider is rendered above it rather than below the last routine item so a
|
|
2504
|
+
* menu that is *only* destructive does not open with a stray rule.
|
|
2505
|
+
*/
|
|
2506
|
+
isFirstDestructiveAction(row, index) {
|
|
2507
|
+
const menu = this.getMenuRowActions(row);
|
|
2508
|
+
const action = menu[index];
|
|
2509
|
+
return (index > 0 &&
|
|
2510
|
+
!!action &&
|
|
2511
|
+
Table.isDestructiveAction(action) &&
|
|
2512
|
+
!Table.isDestructiveAction(menu[index - 1]));
|
|
2513
|
+
}
|
|
2514
|
+
/** Deleting, or anything the caller flagged `danger`. */
|
|
2515
|
+
static isDestructiveAction(action) {
|
|
2516
|
+
if (!action) {
|
|
2517
|
+
return false;
|
|
2518
|
+
}
|
|
2519
|
+
return (action.color === 'danger' ||
|
|
2520
|
+
action.confirmation?.confirmationType === 'delete');
|
|
2521
|
+
}
|
|
2522
|
+
shouldShowRowActionsPopover(row) {
|
|
2523
|
+
return (this.isRowActionsLoading(row) || this.getMenuRowActions(row).length > 0);
|
|
2524
|
+
}
|
|
2525
|
+
isRowActionsLoading(row) {
|
|
2526
|
+
return this.rowActionsLoadingFn()?.(row) ?? false;
|
|
2527
|
+
}
|
|
2528
|
+
onRowActionsToggle(event, popover, row) {
|
|
2529
|
+
this.rowActionsRequested.emit(row);
|
|
2530
|
+
popover.toggle(event);
|
|
2531
|
+
}
|
|
2532
|
+
onColumnReorder(event) {
|
|
2533
|
+
this.columnReorder.emit(event);
|
|
2534
|
+
}
|
|
2535
|
+
onRowReorder(event) {
|
|
2536
|
+
this.rowReorder.emit({
|
|
2537
|
+
...event,
|
|
2538
|
+
value: event.value ?? this.data(),
|
|
2539
|
+
});
|
|
2540
|
+
}
|
|
2541
|
+
onRowClick(event, row) {
|
|
2542
|
+
if (!this.clickableRows() || this.loading()) {
|
|
2543
|
+
return;
|
|
2544
|
+
}
|
|
2545
|
+
const target = event.target;
|
|
2546
|
+
if (target?.closest('button, a, input, textarea, select, label, [role="button"], [data-row-click-ignore="true"]')) {
|
|
2547
|
+
return;
|
|
2548
|
+
}
|
|
2549
|
+
this.rowClick.emit(row);
|
|
2550
|
+
}
|
|
2551
|
+
updatePagingFromEvent(event) {
|
|
2552
|
+
const first = event?.first ?? this.first();
|
|
2553
|
+
const rows = event?.rows ?? this.pageSize();
|
|
2554
|
+
this.first.set(first);
|
|
2555
|
+
this.pageSize.set(rows);
|
|
2556
|
+
const page = typeof event?.page === 'number'
|
|
2557
|
+
? event.page
|
|
2558
|
+
: Math.floor((first ?? 0) / (rows || 1));
|
|
2559
|
+
this.currentPage.set(page);
|
|
2560
|
+
}
|
|
2561
|
+
emitLazyLoad(event) {
|
|
2562
|
+
const sortField = this.sortField();
|
|
2563
|
+
this.lazyLoad.emit({
|
|
2564
|
+
...event,
|
|
2565
|
+
// Sort is always reported, and `null` explicitly means "no sort". Without
|
|
2566
|
+
// that, a host can't tell "sort unchanged" from "sort cleared" and keeps
|
|
2567
|
+
// sending a stale backend sort after the user clears it.
|
|
2568
|
+
sortField,
|
|
2569
|
+
sortOrder: sortField ? (this.sortDirection() === 'desc' ? -1 : 1) : 0,
|
|
2570
|
+
pageSize: this.pageSize(),
|
|
2571
|
+
currentPage: this.currentPage() + 1,
|
|
2572
|
+
first: this.first(),
|
|
2573
|
+
filters: this.lazyLoadFilters(),
|
|
2574
|
+
});
|
|
2575
|
+
}
|
|
2576
|
+
lazyLoadFilters() {
|
|
2577
|
+
const filters = this.withoutGeneralSearch(this.filters());
|
|
2578
|
+
const searchTerm = this.filterTerm().trim();
|
|
2579
|
+
if (!searchTerm || this.lazyLocalSearch()) {
|
|
2580
|
+
return filters;
|
|
2581
|
+
}
|
|
2582
|
+
return {
|
|
2583
|
+
...filters,
|
|
2584
|
+
generalSearch: searchTerm,
|
|
2585
|
+
};
|
|
2586
|
+
}
|
|
2587
|
+
withoutGeneralSearch(filters) {
|
|
2588
|
+
if (!Object.prototype.hasOwnProperty.call(filters, 'generalSearch')) {
|
|
2589
|
+
return filters;
|
|
2590
|
+
}
|
|
2591
|
+
const next = { ...filters };
|
|
2592
|
+
delete next['generalSearch'];
|
|
2593
|
+
return next;
|
|
2594
|
+
}
|
|
2595
|
+
exportExcel() {
|
|
2596
|
+
if (this.loading()) {
|
|
2597
|
+
return;
|
|
2598
|
+
}
|
|
2599
|
+
this.exportService.exportToExcel({
|
|
2600
|
+
rows: this.filteredData(),
|
|
2601
|
+
columns: this.columns(),
|
|
2602
|
+
filename: this.exportFilename(),
|
|
2603
|
+
resolveValue: (row, column) => this.getColumnExportValue(row, column),
|
|
2604
|
+
});
|
|
2605
|
+
}
|
|
2606
|
+
printPdf() {
|
|
2607
|
+
if (this.loading()) {
|
|
2608
|
+
return;
|
|
2609
|
+
}
|
|
2610
|
+
this.exportService.printPdf({
|
|
2611
|
+
rows: this.filteredData(),
|
|
2612
|
+
columns: this.columns(),
|
|
2613
|
+
filename: this.exportFilename(),
|
|
2614
|
+
title: this.printTitle() || undefined,
|
|
2615
|
+
resolveValue: (row, column) => this.getColumnExportValue(row, column),
|
|
2616
|
+
});
|
|
2617
|
+
}
|
|
2618
|
+
onCellFilterClick(event, row, column) {
|
|
2619
|
+
if (!this.cellClickFilter())
|
|
2620
|
+
return;
|
|
2621
|
+
const next = TableValueResolver.buildClickFilterValue(row, column);
|
|
2622
|
+
if (next === null || next === undefined)
|
|
2623
|
+
return;
|
|
2624
|
+
event.stopPropagation();
|
|
2625
|
+
const current = this.filters();
|
|
2626
|
+
const patched = { ...current };
|
|
2627
|
+
if (TableValueResolver.isFilterValueEqual(current[column.key], next)) {
|
|
2628
|
+
delete patched[column.key];
|
|
2629
|
+
}
|
|
2630
|
+
else {
|
|
2631
|
+
patched[column.key] = next;
|
|
2632
|
+
}
|
|
2633
|
+
this.onFilterApplied(patched);
|
|
2634
|
+
}
|
|
2635
|
+
isCellFilterActive(row, column) {
|
|
2636
|
+
if (!this.cellClickFilter())
|
|
2637
|
+
return false;
|
|
2638
|
+
const current = this.filters()[column.key];
|
|
2639
|
+
if (current === null || current === undefined)
|
|
2640
|
+
return false;
|
|
2641
|
+
const next = TableValueResolver.buildClickFilterValue(row, column);
|
|
2642
|
+
if (next === null || next === undefined)
|
|
2643
|
+
return false;
|
|
2644
|
+
return TableValueResolver.isFilterValueEqual(current, next);
|
|
2645
|
+
}
|
|
2646
|
+
isCellClickFilterable(column, row) {
|
|
2647
|
+
if (!this.cellClickFilter())
|
|
2648
|
+
return false;
|
|
2649
|
+
if (column.type === 'boolean') {
|
|
2650
|
+
// Editable booleans keep the toggle interaction; only readonly ones filter.
|
|
2651
|
+
return column.readonly === true;
|
|
2652
|
+
}
|
|
2653
|
+
if (column.type === 'status' || column.type === 'user')
|
|
2654
|
+
return true;
|
|
2655
|
+
if (column.type === 'entity') {
|
|
2656
|
+
const filterType = TableValueResolver.getColumnFilterType(column, row);
|
|
2657
|
+
return (filterType === 'select' ||
|
|
2658
|
+
filterType === 'user' ||
|
|
2659
|
+
filterType === 'boolean');
|
|
2660
|
+
}
|
|
2661
|
+
return false;
|
|
2662
|
+
}
|
|
2663
|
+
rowAction(event, action, row) {
|
|
2664
|
+
if (!action.confirmation) {
|
|
2665
|
+
action.action(row);
|
|
2666
|
+
}
|
|
2667
|
+
else if (action.confirmation?.confirmationType === 'delete') {
|
|
2668
|
+
this.confirmationService.confirmDelete({
|
|
2669
|
+
event: event,
|
|
2670
|
+
...action.confirmation,
|
|
2671
|
+
accept: () => {
|
|
2672
|
+
action.action(row);
|
|
2673
|
+
},
|
|
2674
|
+
reject: () => { },
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
else {
|
|
2678
|
+
this.confirmationService.confirm({
|
|
2679
|
+
event: event,
|
|
2680
|
+
...action.confirmation,
|
|
2681
|
+
accept: () => {
|
|
2682
|
+
action.action(row);
|
|
2683
|
+
},
|
|
2684
|
+
reject: () => { },
|
|
2685
|
+
});
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
buildUserEntityData(value, columnLabel) {
|
|
2689
|
+
if (!value)
|
|
2690
|
+
return null;
|
|
2691
|
+
// Some APIs return `image` instead of the `photoUrl` expected by EntityUserValue.
|
|
2692
|
+
// Normalize here so the entity-user component always receives `photoUrl`.
|
|
2693
|
+
const normalizedValue = typeof value === 'object' && !('photoUrl' in value) && 'image' in value
|
|
2694
|
+
? {
|
|
2695
|
+
...value,
|
|
2696
|
+
photoUrl: value['image'],
|
|
2697
|
+
}
|
|
2698
|
+
: value;
|
|
2699
|
+
return {
|
|
2700
|
+
name: columnLabel,
|
|
2701
|
+
viewType: 'User',
|
|
2702
|
+
value: normalizedValue,
|
|
2703
|
+
configuration: {
|
|
2704
|
+
hideLabel: true,
|
|
2705
|
+
showDisplayName: true,
|
|
2706
|
+
showPhoneNumber: false,
|
|
2707
|
+
showEmail: false,
|
|
2708
|
+
},
|
|
2709
|
+
};
|
|
2710
|
+
}
|
|
2711
|
+
buildStatusEntityData(value, column) {
|
|
2712
|
+
const statusValue = this.resolveStatusValue(value, column);
|
|
2713
|
+
return {
|
|
2714
|
+
name: column.label,
|
|
2715
|
+
viewType: 'Status',
|
|
2716
|
+
value: statusValue ?? '',
|
|
2717
|
+
configuration: {
|
|
2718
|
+
hideName: true,
|
|
2719
|
+
},
|
|
2720
|
+
};
|
|
2721
|
+
}
|
|
2722
|
+
resolveStatusValue(value, column) {
|
|
2723
|
+
const unwrappedValue = this.unwrapStatusValue(value, column);
|
|
2724
|
+
if (unwrappedValue === null ||
|
|
2725
|
+
unwrappedValue === undefined ||
|
|
2726
|
+
unwrappedValue === '') {
|
|
2727
|
+
return null;
|
|
2728
|
+
}
|
|
2729
|
+
if (typeof unwrappedValue === 'object') {
|
|
2730
|
+
const objectValue = unwrappedValue;
|
|
2731
|
+
const statusKey = this.readStringProperty(objectValue, 'key') ??
|
|
2732
|
+
this.readStringProperty(objectValue, 'code') ??
|
|
2733
|
+
this.readStringProperty(objectValue, 'value') ??
|
|
2734
|
+
this.readStringProperty(objectValue, 'id') ??
|
|
2735
|
+
this.readStringProperty(objectValue, 'display') ??
|
|
2736
|
+
this.readStringProperty(objectValue, 'displayValue') ??
|
|
2737
|
+
this.readStringProperty(objectValue, 'displayName') ??
|
|
2738
|
+
this.readStringProperty(objectValue, 'label') ??
|
|
2739
|
+
this.readStringProperty(objectValue, 'name');
|
|
2740
|
+
const mappedStatus = this.resolveStatusMapValue(column, statusKey);
|
|
2741
|
+
const display = this.readStringProperty(objectValue, 'display') ??
|
|
2742
|
+
this.readStringProperty(objectValue, 'displayValue') ??
|
|
2743
|
+
this.readStringProperty(objectValue, 'displayName') ??
|
|
2744
|
+
this.readStringProperty(objectValue, 'label') ??
|
|
2745
|
+
this.readStringProperty(objectValue, 'name') ??
|
|
2746
|
+
mappedStatus?.display ??
|
|
2747
|
+
statusKey;
|
|
2748
|
+
if (!display) {
|
|
2749
|
+
return null;
|
|
2750
|
+
}
|
|
2751
|
+
return {
|
|
2752
|
+
key: statusKey ?? display,
|
|
2753
|
+
display,
|
|
2754
|
+
color: this.readStringProperty(objectValue, 'color') ??
|
|
2755
|
+
mappedStatus?.color ??
|
|
2756
|
+
this.resolveDefaultStatusColor(statusKey ?? display),
|
|
2757
|
+
description: this.readStringProperty(objectValue, 'description') ??
|
|
2758
|
+
mappedStatus?.description,
|
|
2759
|
+
};
|
|
2760
|
+
}
|
|
2761
|
+
const normalizedValue = TableValueResolver.resolveDisplayValue(unwrappedValue);
|
|
2762
|
+
if (normalizedValue === null || normalizedValue === undefined) {
|
|
2763
|
+
return null;
|
|
2764
|
+
}
|
|
2765
|
+
const statusKey = String(normalizedValue);
|
|
2766
|
+
const mappedStatus = this.resolveStatusMapValue(column, statusKey);
|
|
2767
|
+
return {
|
|
2768
|
+
key: statusKey,
|
|
2769
|
+
display: mappedStatus?.display ?? statusKey,
|
|
2770
|
+
color: mappedStatus?.color ?? this.resolveDefaultStatusColor(statusKey),
|
|
2771
|
+
description: mappedStatus?.description,
|
|
2772
|
+
};
|
|
2773
|
+
}
|
|
2774
|
+
unwrapStatusValue(value, column) {
|
|
2775
|
+
if (!value || typeof value !== 'object') {
|
|
2776
|
+
return value;
|
|
2777
|
+
}
|
|
2778
|
+
const entityValue = value;
|
|
2779
|
+
if (!('value' in value)) {
|
|
2780
|
+
return value;
|
|
2781
|
+
}
|
|
2782
|
+
if (entityValue.viewType === 'Status' ||
|
|
2783
|
+
this.isEntityStatusCompatibilityColumn(column)) {
|
|
2784
|
+
return entityValue.value;
|
|
2785
|
+
}
|
|
2786
|
+
return value;
|
|
2787
|
+
}
|
|
2788
|
+
isEntityStatusCompatibilityColumn(column) {
|
|
2789
|
+
return column?.type === 'entity' && this.isStatusColumnKey(column.key);
|
|
2790
|
+
}
|
|
2791
|
+
isStatusColumnKey(key) {
|
|
2792
|
+
return typeof key === 'string' && key.trim().toLowerCase() === 'status';
|
|
2793
|
+
}
|
|
2794
|
+
resolveStatusMapValue(column, key) {
|
|
2795
|
+
if (!column?.statusMap || !key) {
|
|
2796
|
+
return undefined;
|
|
2797
|
+
}
|
|
2798
|
+
const directMatch = column.statusMap[key];
|
|
2799
|
+
if (directMatch) {
|
|
2800
|
+
return directMatch;
|
|
2801
|
+
}
|
|
2802
|
+
const normalizedKey = this.normalizeStatusToken(key);
|
|
2803
|
+
return Object.entries(column.statusMap).find(([entryKey]) => this.normalizeStatusToken(entryKey) === normalizedKey)?.[1];
|
|
2804
|
+
}
|
|
2805
|
+
resolveDefaultStatusColor(value) {
|
|
2806
|
+
const normalizedValue = this.normalizeStatusToken(value);
|
|
2807
|
+
if ([
|
|
2808
|
+
'active',
|
|
2809
|
+
'approved',
|
|
2810
|
+
'completed',
|
|
2811
|
+
'create',
|
|
2812
|
+
'created',
|
|
2813
|
+
'done',
|
|
2814
|
+
'enabled',
|
|
2815
|
+
'healthy',
|
|
2816
|
+
'low',
|
|
2817
|
+
'open',
|
|
2818
|
+
'published',
|
|
2819
|
+
'runtime',
|
|
2820
|
+
'success',
|
|
2821
|
+
'succeeded',
|
|
2822
|
+
].includes(normalizedValue)) {
|
|
2823
|
+
return '#047857';
|
|
2824
|
+
}
|
|
2825
|
+
if ([
|
|
2826
|
+
'change',
|
|
2827
|
+
'current',
|
|
2828
|
+
'draft',
|
|
2829
|
+
'inprogress',
|
|
2830
|
+
'info',
|
|
2831
|
+
'medium',
|
|
2832
|
+
'process',
|
|
2833
|
+
'progress',
|
|
2834
|
+
'running',
|
|
2835
|
+
'update',
|
|
2836
|
+
'updated',
|
|
2837
|
+
].includes(normalizedValue)) {
|
|
2838
|
+
return '#0369a1';
|
|
2839
|
+
}
|
|
2840
|
+
if ([
|
|
2841
|
+
'bulkupdate',
|
|
2842
|
+
'comment',
|
|
2843
|
+
'configure',
|
|
2844
|
+
'configured',
|
|
2845
|
+
'controlpanel',
|
|
2846
|
+
'discussion',
|
|
2847
|
+
].includes(normalizedValue)) {
|
|
2848
|
+
return '#4338ca';
|
|
2849
|
+
}
|
|
2850
|
+
if ([
|
|
2851
|
+
'awaiting',
|
|
2852
|
+
'escalation',
|
|
2853
|
+
'high',
|
|
2854
|
+
'hold',
|
|
2855
|
+
'move',
|
|
2856
|
+
'moved',
|
|
2857
|
+
'pending',
|
|
2858
|
+
'phasegate',
|
|
2859
|
+
'queued',
|
|
2860
|
+
'warning',
|
|
2861
|
+
].includes(normalizedValue)) {
|
|
2862
|
+
return '#b45309';
|
|
2863
|
+
}
|
|
2864
|
+
if ([
|
|
2865
|
+
'blocked',
|
|
2866
|
+
'cancelled',
|
|
2867
|
+
'canceled',
|
|
2868
|
+
'close',
|
|
2869
|
+
'closed',
|
|
2870
|
+
'critical',
|
|
2871
|
+
'delete',
|
|
2872
|
+
'deleted',
|
|
2873
|
+
'error',
|
|
2874
|
+
'failed',
|
|
2875
|
+
'governance',
|
|
2876
|
+
'inactive',
|
|
2877
|
+
'rejected',
|
|
2878
|
+
].includes(normalizedValue)) {
|
|
2879
|
+
return '#be123c';
|
|
2880
|
+
}
|
|
2881
|
+
return '#475569';
|
|
2882
|
+
}
|
|
2883
|
+
normalizeStatusToken(value) {
|
|
2884
|
+
return value
|
|
2885
|
+
.trim()
|
|
2886
|
+
.toLocaleLowerCase()
|
|
2887
|
+
.replace(/[\s_-]+/g, '');
|
|
2888
|
+
}
|
|
2889
|
+
readStringProperty(value, key) {
|
|
2890
|
+
const propertyValue = value[key];
|
|
2891
|
+
return typeof propertyValue === 'string' && propertyValue.trim().length > 0
|
|
2892
|
+
? propertyValue.trim()
|
|
2893
|
+
: null;
|
|
2894
|
+
}
|
|
2895
|
+
/**
|
|
2896
|
+
* Gets the entity data for an 'entity' type column.
|
|
2897
|
+
* The row data is expected to already be in EntityData format.
|
|
2898
|
+
* Automatically hides entity name and configures User entities
|
|
2899
|
+
* to show only avatar + displayName.
|
|
2900
|
+
*/
|
|
2901
|
+
getEntityColumnData(row, col) {
|
|
2902
|
+
const cellValue = this.getProperty(row, col.key);
|
|
2903
|
+
if (!cellValue || typeof cellValue !== 'object')
|
|
2904
|
+
return null;
|
|
2905
|
+
const entityData = cellValue;
|
|
2906
|
+
if (this.isEntityStatusCompatibilityColumn(col)) {
|
|
2907
|
+
return this.buildStatusEntityData(cellValue, col);
|
|
2908
|
+
}
|
|
2909
|
+
// For User entities: show avatar + displayName only
|
|
2910
|
+
if (entityData.viewType === 'User') {
|
|
2911
|
+
return {
|
|
2912
|
+
...entityData,
|
|
2913
|
+
configuration: {
|
|
2914
|
+
...entityData.configuration,
|
|
2915
|
+
hideName: true,
|
|
2916
|
+
showDisplayName: true,
|
|
2917
|
+
showPhoneNumber: false,
|
|
2918
|
+
showEmail: false,
|
|
2919
|
+
},
|
|
2920
|
+
};
|
|
2921
|
+
}
|
|
2922
|
+
// For all other entities: hide the name label
|
|
2923
|
+
return {
|
|
2924
|
+
...entityData,
|
|
2925
|
+
configuration: {
|
|
2926
|
+
...entityData.configuration,
|
|
2927
|
+
hideName: true,
|
|
2928
|
+
},
|
|
2929
|
+
};
|
|
2930
|
+
}
|
|
2931
|
+
getStatusEntityAccentColor(row) {
|
|
2932
|
+
const statusColumn = this.columns().find((column) => this.isStatusColumnKey(column.key));
|
|
2933
|
+
if (!statusColumn) {
|
|
2934
|
+
return null;
|
|
2935
|
+
}
|
|
2936
|
+
return this.resolveStatusEntityAccentColor(this.getProperty(row, statusColumn.key), statusColumn);
|
|
2937
|
+
}
|
|
2938
|
+
resolveStatusEntityAccentColor(value, column) {
|
|
2939
|
+
return this.resolveStatusValue(value, column)?.color ?? null;
|
|
2940
|
+
}
|
|
2941
|
+
getBooleanProperty(obj, key) {
|
|
2942
|
+
const value = this.getProperty(obj, key);
|
|
2943
|
+
if (typeof value === 'boolean') {
|
|
2944
|
+
return value;
|
|
2945
|
+
}
|
|
2946
|
+
return TableValueResolver.resolveBooleanValue(value) ?? false;
|
|
2947
|
+
}
|
|
2948
|
+
setProperty(obj, key, value) {
|
|
2949
|
+
const path = key.split('.');
|
|
2950
|
+
const lastKey = path.pop();
|
|
2951
|
+
if (!lastKey) {
|
|
2952
|
+
return;
|
|
2953
|
+
}
|
|
2954
|
+
const target = path.reduce((current, segment) => {
|
|
2955
|
+
if (!current?.[segment] || typeof current[segment] !== 'object') {
|
|
2956
|
+
current[segment] = {};
|
|
2957
|
+
}
|
|
2958
|
+
return current[segment];
|
|
2959
|
+
}, obj);
|
|
2960
|
+
if (target && typeof target === 'object') {
|
|
2961
|
+
target[lastKey] = value;
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
sortData(data) {
|
|
2965
|
+
const field = this.sortField();
|
|
2966
|
+
const direction = this.sortDirection();
|
|
2967
|
+
if (!field || !direction) {
|
|
2968
|
+
return data;
|
|
2969
|
+
}
|
|
2970
|
+
const column = this.columns().find((item) => item.key === field);
|
|
2971
|
+
if (!column || !this.isColumnSortable(column)) {
|
|
2972
|
+
return data;
|
|
2973
|
+
}
|
|
2974
|
+
return [...data].sort((leftRow, rightRow) => {
|
|
2975
|
+
const leftValue = this.getSortValue(leftRow, column);
|
|
2976
|
+
const rightValue = this.getSortValue(rightRow, column);
|
|
2977
|
+
if (leftValue === rightValue)
|
|
2978
|
+
return 0;
|
|
2979
|
+
if (leftValue === null || leftValue === undefined || leftValue === '') {
|
|
2980
|
+
return 1;
|
|
2981
|
+
}
|
|
2982
|
+
if (rightValue === null ||
|
|
2983
|
+
rightValue === undefined ||
|
|
2984
|
+
rightValue === '') {
|
|
2985
|
+
return -1;
|
|
2986
|
+
}
|
|
2987
|
+
const comparison = leftValue < rightValue ? -1 : 1;
|
|
2988
|
+
return direction === 'asc' ? comparison : -comparison;
|
|
2989
|
+
});
|
|
2990
|
+
}
|
|
2991
|
+
getSortValue(row, column) {
|
|
2992
|
+
const cellValue = this.getProperty(row, column.key);
|
|
2993
|
+
const resolvedValue = this.getColumnResolvedValue(row, column);
|
|
2994
|
+
if (resolvedValue === null ||
|
|
2995
|
+
resolvedValue === undefined ||
|
|
2996
|
+
resolvedValue === '') {
|
|
2997
|
+
return null;
|
|
2998
|
+
}
|
|
2999
|
+
if (column.type === 'date' || column.type === 'dateTime') {
|
|
3000
|
+
return TableValueResolver.normalizeDateSortValue(cellValue);
|
|
3001
|
+
}
|
|
3002
|
+
if (typeof resolvedValue === 'number') {
|
|
3003
|
+
return resolvedValue;
|
|
3004
|
+
}
|
|
3005
|
+
if (typeof resolvedValue === 'boolean') {
|
|
3006
|
+
return resolvedValue ? 1 : 0;
|
|
3007
|
+
}
|
|
3008
|
+
if (cellValue instanceof Date) {
|
|
3009
|
+
return cellValue.getTime();
|
|
3010
|
+
}
|
|
3011
|
+
return TableValueResolver.normalizeTextSortValue(resolvedValue);
|
|
3012
|
+
}
|
|
3013
|
+
/**
|
|
3014
|
+
* Export/print value resolver — same pipeline as `getColumnResolvedValue`
|
|
3015
|
+
* except date / dateTime columns (and their entity counterparts) are
|
|
3016
|
+
* formatted via the MT date pipe so Excel and PDF show locale-aware dates
|
|
3017
|
+
* instead of raw ISO strings. Sort path keeps the ISO form for ordering.
|
|
3018
|
+
*/
|
|
3019
|
+
getColumnExportValue(row, column) {
|
|
3020
|
+
const cellValue = this.getProperty(row, column.key);
|
|
3021
|
+
if (cellValue === null || cellValue === undefined)
|
|
3022
|
+
return null;
|
|
3023
|
+
const dateType = this.resolveDateColumnType(column, row);
|
|
3024
|
+
if (dateType) {
|
|
3025
|
+
const dateValue = TableValueResolver.resolveDateValue(column.type === 'entity'
|
|
3026
|
+
? TableValueResolver.getEntityValueByType(cellValue, 'sort')
|
|
3027
|
+
: cellValue);
|
|
3028
|
+
if (dateValue === null)
|
|
3029
|
+
return null;
|
|
3030
|
+
const formatted = this.dateFormat.transform(dateValue, dateType);
|
|
3031
|
+
return formatted || null;
|
|
3032
|
+
}
|
|
3033
|
+
return this.getColumnResolvedValue(row, column);
|
|
3034
|
+
}
|
|
3035
|
+
/**
|
|
3036
|
+
* Detects whether a column should be treated as a date for export purposes:
|
|
3037
|
+
* native `date` / `dateTime` types, or entity columns whose viewType is
|
|
3038
|
+
* `Date` / `DateTime` / `Time`.
|
|
3039
|
+
*/
|
|
3040
|
+
resolveDateColumnType(column, row) {
|
|
3041
|
+
if (column.type === 'date')
|
|
3042
|
+
return 'date';
|
|
3043
|
+
if (column.type === 'dateTime')
|
|
3044
|
+
return 'dateTime';
|
|
3045
|
+
if (column.type === 'entity') {
|
|
3046
|
+
// `Time` is resolved ahead of the filter gate below: it is deliberately
|
|
3047
|
+
// not filterable, but it still has to export as a formatted clock time
|
|
3048
|
+
// rather than the raw stored value.
|
|
3049
|
+
if (TableValueResolver.getEntityViewType(column, row) === 'Time') {
|
|
3050
|
+
return 'time';
|
|
3051
|
+
}
|
|
3052
|
+
const filterType = TableValueResolver.getColumnFilterType(column, row);
|
|
3053
|
+
if (filterType !== 'date')
|
|
3054
|
+
return null;
|
|
3055
|
+
const viewType = column.viewType;
|
|
3056
|
+
if (typeof viewType === 'string' &&
|
|
3057
|
+
viewType.toLowerCase() === 'datetime') {
|
|
3058
|
+
return 'dateTime';
|
|
3059
|
+
}
|
|
3060
|
+
const cellValue = this.getProperty(row, column.key);
|
|
3061
|
+
if (cellValue &&
|
|
3062
|
+
typeof cellValue === 'object' &&
|
|
3063
|
+
cellValue.viewType === 'DateTime') {
|
|
3064
|
+
return 'dateTime';
|
|
3065
|
+
}
|
|
3066
|
+
return 'date';
|
|
3067
|
+
}
|
|
3068
|
+
return null;
|
|
3069
|
+
}
|
|
3070
|
+
getColumnResolvedValue(row, column) {
|
|
3071
|
+
const cellValue = this.getProperty(row, column.key);
|
|
3072
|
+
if (cellValue === null || cellValue === undefined) {
|
|
3073
|
+
return null;
|
|
3074
|
+
}
|
|
3075
|
+
if (column.type === 'entity') {
|
|
3076
|
+
return TableValueResolver.getEntityValueByType(cellValue, 'export');
|
|
3077
|
+
}
|
|
3078
|
+
if (column.type === 'boolean') {
|
|
3079
|
+
return this.getBooleanProperty(row, column.key);
|
|
3080
|
+
}
|
|
3081
|
+
if (column.type === 'date' || column.type === 'dateTime') {
|
|
3082
|
+
const dateValue = TableValueResolver.resolveDateValue(cellValue);
|
|
3083
|
+
return dateValue instanceof Date ? dateValue.toISOString() : dateValue;
|
|
3084
|
+
}
|
|
3085
|
+
if (typeof cellValue === 'number' || typeof cellValue === 'boolean') {
|
|
3086
|
+
return cellValue;
|
|
3087
|
+
}
|
|
3088
|
+
if (cellValue instanceof Date) {
|
|
3089
|
+
return cellValue.toISOString();
|
|
3090
|
+
}
|
|
3091
|
+
return TableValueResolver.resolveDisplayValue(cellValue);
|
|
3092
|
+
}
|
|
3093
|
+
isRowSelected(row) {
|
|
3094
|
+
const rowKey = this.getRowSelectionKey(row);
|
|
3095
|
+
if (rowKey !== null) {
|
|
3096
|
+
return this.selectedRowKeys().has(rowKey);
|
|
3097
|
+
}
|
|
3098
|
+
return this.transientSelectedRows().has(row);
|
|
3099
|
+
}
|
|
3100
|
+
/**
|
|
3101
|
+
* Types whose rendered width is bounded by their own shape — a date, a
|
|
3102
|
+
* yes/no, an avatar, a status chip. They get sized to content so the columns
|
|
3103
|
+
* that hold real text absorb the leftover width instead (finding M-05).
|
|
3104
|
+
*/
|
|
3105
|
+
static SHRINK_TO_CONTENT_TYPES = new Set(['date', 'dateTime', 'boolean', 'number', 'user', 'status']);
|
|
3106
|
+
/**
|
|
3107
|
+
* Alignment class for a column's header and cells. Numbers align to the end
|
|
3108
|
+
* with tabular figures so the digits line up down the column; everything else
|
|
3109
|
+
* keeps the reading direction.
|
|
3110
|
+
*/
|
|
3111
|
+
getColumnAlignClass(column) {
|
|
3112
|
+
const align = column.align ?? (column.type === 'number' ? 'end' : 'start');
|
|
3113
|
+
if (align === 'end') {
|
|
3114
|
+
return 'text-end tabular-nums';
|
|
3115
|
+
}
|
|
3116
|
+
return align === 'center' ? 'text-center' : 'text-start';
|
|
3117
|
+
}
|
|
3118
|
+
/**
|
|
3119
|
+
* `width: 1%` is the shrink-to-content idiom for an auto-layout table: the
|
|
3120
|
+
* browser treats it as a floor, gives the column exactly what its content
|
|
3121
|
+
* needs, and hands the remainder to the columns that asked for nothing. An
|
|
3122
|
+
* explicit `width` on the column always wins.
|
|
3123
|
+
*/
|
|
3124
|
+
getColumnWidth(column) {
|
|
3125
|
+
if (column.width) {
|
|
3126
|
+
return column.width;
|
|
3127
|
+
}
|
|
3128
|
+
const shrink = column.shrink ?? Table.SHRINK_TO_CONTENT_TYPES.has(column.type ?? 'text');
|
|
3129
|
+
return shrink ? '1%' : null;
|
|
3130
|
+
}
|
|
3131
|
+
getColumnMinWidth(column) {
|
|
3132
|
+
const width = column.width?.trim();
|
|
3133
|
+
if (!width || width.endsWith('%')) {
|
|
3134
|
+
return null;
|
|
3135
|
+
}
|
|
3136
|
+
return width;
|
|
3137
|
+
}
|
|
3138
|
+
emitSelectionChange() {
|
|
3139
|
+
this.selectionChange.emit(this.getSelectedRows());
|
|
3140
|
+
}
|
|
3141
|
+
getSelectedRows() {
|
|
3142
|
+
const dataKey = this.dataKey();
|
|
3143
|
+
if (!dataKey) {
|
|
3144
|
+
return Array.from(this.transientSelectedRows());
|
|
3145
|
+
}
|
|
3146
|
+
const selectedRowKeys = this.selectedRowKeys();
|
|
3147
|
+
return this.data().filter((row) => {
|
|
3148
|
+
const rowKey = this.getRowSelectionKey(row);
|
|
3149
|
+
return rowKey !== null && selectedRowKeys.has(rowKey);
|
|
3150
|
+
});
|
|
3151
|
+
}
|
|
3152
|
+
getRowSelectionKey(row) {
|
|
3153
|
+
const dataKey = this.dataKey();
|
|
3154
|
+
if (!dataKey) {
|
|
3155
|
+
return null;
|
|
3156
|
+
}
|
|
3157
|
+
const value = this.getProperty(row, dataKey);
|
|
3158
|
+
if (value === null || value === undefined || value === '') {
|
|
3159
|
+
return null;
|
|
3160
|
+
}
|
|
3161
|
+
return String(value);
|
|
3162
|
+
}
|
|
3163
|
+
getNormalizedStorageKey() {
|
|
3164
|
+
const storageKey = this.storageKey()?.trim();
|
|
3165
|
+
return storageKey ? storageKey : null;
|
|
3166
|
+
}
|
|
3167
|
+
getStorage() {
|
|
3168
|
+
if (typeof window === 'undefined') {
|
|
3169
|
+
return null;
|
|
3170
|
+
}
|
|
3171
|
+
return this.storageMode() === 'session'
|
|
3172
|
+
? window.sessionStorage
|
|
3173
|
+
: window.localStorage;
|
|
3174
|
+
}
|
|
3175
|
+
buildPersistedState() {
|
|
3176
|
+
const state = {};
|
|
3177
|
+
if (this.shouldPersistStateKey('pageSize')) {
|
|
3178
|
+
state.pageSize = this.pageSize();
|
|
3179
|
+
}
|
|
3180
|
+
if (this.shouldPersistStateKey('pagePosition')) {
|
|
3181
|
+
state.first = this.first();
|
|
3182
|
+
state.currentPage = this.currentPage();
|
|
3183
|
+
}
|
|
3184
|
+
if (this.shouldPersistStateKey('sort')) {
|
|
3185
|
+
state.sortField = this.sortField();
|
|
3186
|
+
state.sortDirection = this.sortDirection();
|
|
3187
|
+
}
|
|
3188
|
+
if (this.shouldPersistStateKey('selection')) {
|
|
3189
|
+
state.selectedRowKeys = this.dataKey()
|
|
3190
|
+
? Array.from(this.selectedRowKeys())
|
|
3191
|
+
: [];
|
|
3192
|
+
}
|
|
3193
|
+
if (this.shouldPersistStateKey('groupBy')) {
|
|
3194
|
+
state.groupBy = this.groupBy();
|
|
3195
|
+
}
|
|
3196
|
+
return state;
|
|
3197
|
+
}
|
|
3198
|
+
applyPersistedState(persistedState) {
|
|
3199
|
+
this.transientSelectedRows.set(new Set());
|
|
3200
|
+
if (!persistedState) {
|
|
3201
|
+
this.selectedRowKeys.set(new Set());
|
|
3202
|
+
return;
|
|
3203
|
+
}
|
|
3204
|
+
const pageSize = this.shouldPersistStateKey('pageSize')
|
|
3205
|
+
? this.normalizePersistedPageSize(this.toPositiveInteger(persistedState.pageSize))
|
|
3206
|
+
: null;
|
|
3207
|
+
if (pageSize !== null) {
|
|
3208
|
+
this.pageSize.set(pageSize);
|
|
3209
|
+
}
|
|
3210
|
+
if (this.shouldPersistStateKey('pagePosition')) {
|
|
3211
|
+
const first = this.toNonNegativeInteger(persistedState.first);
|
|
3212
|
+
if (first !== null) {
|
|
3213
|
+
this.first.set(first);
|
|
3214
|
+
}
|
|
3215
|
+
const currentPage = this.toNonNegativeInteger(persistedState.currentPage);
|
|
3216
|
+
if (currentPage !== null) {
|
|
3217
|
+
this.currentPage.set(currentPage);
|
|
3218
|
+
}
|
|
3219
|
+
else if (first !== null && pageSize !== null) {
|
|
3220
|
+
this.currentPage.set(Math.floor(first / pageSize));
|
|
3221
|
+
}
|
|
3222
|
+
}
|
|
3223
|
+
if (this.shouldPersistStateKey('sort')) {
|
|
3224
|
+
this.sortField.set(typeof persistedState.sortField === 'string'
|
|
3225
|
+
? persistedState.sortField
|
|
3226
|
+
: null);
|
|
3227
|
+
this.sortDirection.set(persistedState.sortDirection === 'asc' ||
|
|
3228
|
+
persistedState.sortDirection === 'desc'
|
|
3229
|
+
? persistedState.sortDirection
|
|
3230
|
+
: null);
|
|
3231
|
+
}
|
|
3232
|
+
if (this.shouldPersistStateKey('selection')) {
|
|
3233
|
+
this.selectedRowKeys.set(new Set(Array.isArray(persistedState.selectedRowKeys)
|
|
3234
|
+
? persistedState.selectedRowKeys
|
|
3235
|
+
: []));
|
|
3236
|
+
}
|
|
3237
|
+
if (this.shouldPersistStateKey('groupBy')) {
|
|
3238
|
+
this.groupBy.set(typeof persistedState.groupBy === 'string' && persistedState.groupBy
|
|
3239
|
+
? persistedState.groupBy
|
|
3240
|
+
: null);
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
shouldEmitLazyLoadAfterRestore(persistedState) {
|
|
3244
|
+
if (!persistedState) {
|
|
3245
|
+
return false;
|
|
3246
|
+
}
|
|
3247
|
+
return ((this.shouldPersistStateKey('pageSize') &&
|
|
3248
|
+
persistedState.pageSize !== undefined) ||
|
|
3249
|
+
(this.shouldPersistStateKey('pagePosition') &&
|
|
3250
|
+
(persistedState.first !== undefined ||
|
|
3251
|
+
persistedState.currentPage !== undefined)));
|
|
3252
|
+
}
|
|
3253
|
+
shouldPersistStateKey(key) {
|
|
3254
|
+
const excluded = this.persistStateExclude();
|
|
3255
|
+
return !(Array.isArray(excluded) ? excluded : DEFAULT_PERSIST_STATE_EXCLUDE).includes(key);
|
|
3256
|
+
}
|
|
3257
|
+
readPersistedState(storage, storageKey) {
|
|
3258
|
+
try {
|
|
3259
|
+
const raw = storage.getItem(storageKey);
|
|
3260
|
+
if (!raw) {
|
|
3261
|
+
return null;
|
|
3262
|
+
}
|
|
3263
|
+
const parsed = JSON.parse(raw);
|
|
3264
|
+
return parsed && typeof parsed === 'object' ? parsed : null;
|
|
3265
|
+
}
|
|
3266
|
+
catch {
|
|
3267
|
+
return null;
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
getRestorablePersistedState(persistedState) {
|
|
3271
|
+
if (!persistedState) {
|
|
3272
|
+
return null;
|
|
3273
|
+
}
|
|
3274
|
+
const restorableState = {};
|
|
3275
|
+
if (this.shouldPersistStateKey('pageSize')) {
|
|
3276
|
+
restorableState.pageSize = persistedState.pageSize;
|
|
3277
|
+
}
|
|
3278
|
+
if (this.shouldPersistStateKey('pagePosition')) {
|
|
3279
|
+
restorableState.first = persistedState.first;
|
|
3280
|
+
restorableState.currentPage = persistedState.currentPage;
|
|
3281
|
+
}
|
|
3282
|
+
if (this.shouldPersistStateKey('sort')) {
|
|
3283
|
+
restorableState.sortField = persistedState.sortField;
|
|
3284
|
+
restorableState.sortDirection = persistedState.sortDirection;
|
|
3285
|
+
}
|
|
3286
|
+
if (this.shouldPersistStateKey('selection')) {
|
|
3287
|
+
restorableState.selectedRowKeys = persistedState.selectedRowKeys;
|
|
3288
|
+
}
|
|
3289
|
+
if (this.shouldPersistStateKey('groupBy')) {
|
|
3290
|
+
restorableState.groupBy = persistedState.groupBy;
|
|
3291
|
+
}
|
|
3292
|
+
return Object.keys(restorableState).some((key) => restorableState[key] !== undefined)
|
|
3293
|
+
? restorableState
|
|
3294
|
+
: null;
|
|
3295
|
+
}
|
|
3296
|
+
writePersistedState(storage, storageKey, state) {
|
|
3297
|
+
try {
|
|
3298
|
+
storage.setItem(storageKey, JSON.stringify(state));
|
|
3299
|
+
}
|
|
3300
|
+
catch {
|
|
3301
|
+
// Ignore storage write failures.
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
toPositiveInteger(value) {
|
|
3305
|
+
const normalized = Number(value);
|
|
3306
|
+
if (!Number.isFinite(normalized) || normalized <= 0) {
|
|
3307
|
+
return null;
|
|
3308
|
+
}
|
|
3309
|
+
return Math.trunc(normalized);
|
|
3310
|
+
}
|
|
3311
|
+
normalizePersistedPageSize(value) {
|
|
3312
|
+
if (value === null) {
|
|
3313
|
+
return null;
|
|
3314
|
+
}
|
|
3315
|
+
const allowedOptions = this.rowsPerPageOptions().filter((option) => Number.isFinite(option) && option > 0);
|
|
3316
|
+
if (!allowedOptions.length) {
|
|
3317
|
+
return value;
|
|
3318
|
+
}
|
|
3319
|
+
return allowedOptions.includes(value) ? value : allowedOptions[0];
|
|
3320
|
+
}
|
|
3321
|
+
resolveScrollHeightPixels(value) {
|
|
3322
|
+
const normalized = value.trim().toLowerCase();
|
|
3323
|
+
const match = normalized.match(/^(\d+(?:\.\d+)?)(px|rem)$/);
|
|
3324
|
+
if (!match) {
|
|
3325
|
+
return null;
|
|
3326
|
+
}
|
|
3327
|
+
const amount = Number(match[1]);
|
|
3328
|
+
if (!Number.isFinite(amount) || amount <= 0) {
|
|
3329
|
+
return null;
|
|
3330
|
+
}
|
|
3331
|
+
return match[2] === 'rem' ? amount * 16 : amount;
|
|
3332
|
+
}
|
|
3333
|
+
toNonNegativeInteger(value) {
|
|
3334
|
+
const normalized = Number(value);
|
|
3335
|
+
if (!Number.isFinite(normalized) || normalized < 0) {
|
|
3336
|
+
return null;
|
|
3337
|
+
}
|
|
3338
|
+
return Math.trunc(normalized);
|
|
3339
|
+
}
|
|
3340
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Table, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3341
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: Table, isStandalone: true, selector: "mt-table", inputs: { filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, rowActions: { classPropertyName: "rowActions", publicName: "rowActions", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, showGridlines: { classPropertyName: "showGridlines", publicName: "showGridlines", isSignal: true, isRequired: false, transformFunction: null }, stripedRows: { classPropertyName: "stripedRows", publicName: "stripedRows", isSignal: true, isRequired: false, transformFunction: null }, selectableRows: { classPropertyName: "selectableRows", publicName: "selectableRows", isSignal: true, isRequired: false, transformFunction: null }, clickableRows: { classPropertyName: "clickableRows", publicName: "clickableRows", isSignal: true, isRequired: false, transformFunction: null }, generalSearch: { classPropertyName: "generalSearch", publicName: "generalSearch", isSignal: true, isRequired: false, transformFunction: null }, lazyLocalSearch: { classPropertyName: "lazyLocalSearch", publicName: "lazyLocalSearch", isSignal: true, isRequired: false, transformFunction: null }, showFilters: { classPropertyName: "showFilters", publicName: "showFilters", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, updating: { classPropertyName: "updating", publicName: "updating", isSignal: true, isRequired: false, transformFunction: null }, lazy: { classPropertyName: "lazy", publicName: "lazy", isSignal: true, isRequired: false, transformFunction: null }, lazyLocalSort: { classPropertyName: "lazyLocalSort", publicName: "lazyLocalSort", isSignal: true, isRequired: false, transformFunction: null }, lazyTotalRecords: { classPropertyName: "lazyTotalRecords", publicName: "lazyTotalRecords", isSignal: true, isRequired: false, transformFunction: null }, reorderableColumns: { classPropertyName: "reorderableColumns", publicName: "reorderableColumns", isSignal: true, isRequired: false, transformFunction: null }, reorderableRows: { classPropertyName: "reorderableRows", publicName: "reorderableRows", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null }, storageKey: { classPropertyName: "storageKey", publicName: "storageKey", isSignal: true, isRequired: false, transformFunction: null }, storageMode: { classPropertyName: "storageMode", publicName: "storageMode", isSignal: true, isRequired: false, transformFunction: null }, persistStateExclude: { classPropertyName: "persistStateExclude", publicName: "persistStateExclude", isSignal: true, isRequired: false, transformFunction: null }, exportable: { classPropertyName: "exportable", publicName: "exportable", isSignal: true, isRequired: false, transformFunction: null }, printable: { classPropertyName: "printable", publicName: "printable", isSignal: true, isRequired: false, transformFunction: null }, groupable: { classPropertyName: "groupable", publicName: "groupable", isSignal: true, isRequired: false, transformFunction: null }, groupCountMap: { classPropertyName: "groupCountMap", publicName: "groupCountMap", isSignal: true, isRequired: false, transformFunction: null }, cellClickFilter: { classPropertyName: "cellClickFilter", publicName: "cellClickFilter", isSignal: true, isRequired: false, transformFunction: null }, freezeActions: { classPropertyName: "freezeActions", publicName: "freezeActions", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null }, scrollHeight: { classPropertyName: "scrollHeight", publicName: "scrollHeight", isSignal: true, isRequired: false, transformFunction: null }, printTitle: { classPropertyName: "printTitle", publicName: "printTitle", isSignal: true, isRequired: false, transformFunction: null }, exportFilename: { classPropertyName: "exportFilename", publicName: "exportFilename", isSignal: true, isRequired: false, transformFunction: null }, actionShape: { classPropertyName: "actionShape", publicName: "actionShape", isSignal: true, isRequired: false, transformFunction: null }, rowActionsLoadingFn: { classPropertyName: "rowActionsLoadingFn", publicName: "rowActionsLoadingFn", isSignal: true, isRequired: false, transformFunction: null }, tableLayout: { classPropertyName: "tableLayout", publicName: "tableLayout", isSignal: true, isRequired: false, transformFunction: null }, noCard: { classPropertyName: "noCard", publicName: "noCard", isSignal: true, isRequired: false, transformFunction: null }, tabs: { classPropertyName: "tabs", publicName: "tabs", isSignal: true, isRequired: false, transformFunction: null }, tabsOptionLabel: { classPropertyName: "tabsOptionLabel", publicName: "tabsOptionLabel", isSignal: true, isRequired: false, transformFunction: null }, tabsOptionValue: { classPropertyName: "tabsOptionValue", publicName: "tabsOptionValue", isSignal: true, isRequired: false, transformFunction: null }, activeTab: { classPropertyName: "activeTab", publicName: "activeTab", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", 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 }, emptyActionLabel: { classPropertyName: "emptyActionLabel", publicName: "emptyActionLabel", isSignal: true, isRequired: false, transformFunction: null }, emptyActionIcon: { classPropertyName: "emptyActionIcon", publicName: "emptyActionIcon", isSignal: true, isRequired: false, transformFunction: null }, paginatorPosition: { classPropertyName: "paginatorPosition", publicName: "paginatorPosition", isSignal: true, isRequired: false, transformFunction: null }, alwaysShowPaginator: { classPropertyName: "alwaysShowPaginator", publicName: "alwaysShowPaginator", isSignal: true, isRequired: false, transformFunction: null }, rowsPerPageOptions: { classPropertyName: "rowsPerPageOptions", publicName: "rowsPerPageOptions", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, currentPage: { classPropertyName: "currentPage", publicName: "currentPage", isSignal: true, isRequired: false, transformFunction: null }, first: { classPropertyName: "first", publicName: "first", isSignal: true, isRequired: false, transformFunction: null }, filterTerm: { classPropertyName: "filterTerm", publicName: "filterTerm", isSignal: true, isRequired: false, transformFunction: null }, groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null }, sortField: { classPropertyName: "sortField", publicName: "sortField", isSignal: true, isRequired: false, transformFunction: null }, sortDirection: { classPropertyName: "sortDirection", publicName: "sortDirection", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange", cellChange: "cellChange", lazyLoad: "lazyLoad", columnReorder: "columnReorder", rowReorder: "rowReorder", rowClick: "rowClick", emptyAction: "emptyAction", rowActionsRequested: "rowActionsRequested", filters: "filtersChange", activeTab: "activeTabChange", onTabChange: "onTabChange", pageSize: "pageSizeChange", currentPage: "currentPageChange", first: "firstChange", filterTerm: "filterTermChange", groupBy: "groupByChange", sortField: "sortFieldChange", sortDirection: "sortDirectionChange" }, providers: [MTDateFormatPipe], queries: [{ propertyName: "captionStartContent", first: true, predicate: ["captionStart"], descendants: true, isSignal: true }, { propertyName: "captionEndContent", first: true, predicate: ["captionEnd"], descendants: true, isSignal: true }, { propertyName: "emptyContent", first: true, predicate: ["empty"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (!noCard()) {\r\n <mt-card>\r\n <ng-container *ngTemplateOutlet=\"tableContent\" />\r\n </mt-card>\r\n} @else {\r\n <ng-container *ngTemplateOutlet=\"tableContent\" />\r\n}\r\n\r\n<ng-template #tableContent>\r\n <div class=\"space-y-4 rounded-lg\">\r\n <div>\r\n <mt-table-caption\r\n [generalSearch]=\"generalSearch()\"\r\n [showFilters]=\"showFilters()\"\r\n [filterMode]=\"filterMode()\"\r\n [exportable]=\"exportable()\"\r\n [printable]=\"printable()\"\r\n [groupable]=\"groupable()\"\r\n [columns]=\"columns()\"\r\n [data]=\"data()\"\r\n [groupColumns]=\"grouping.groupableColumns()\"\r\n [tabs]=\"tabs()\"\r\n [tabsOptionLabel]=\"tabsOptionLabel()\"\r\n [tabsOptionValue]=\"tabsOptionValue()\"\r\n [actions]=\"actions()\"\r\n [captionStart]=\"captionStartContent() ?? null\"\r\n [captionEnd]=\"captionEndContent() ?? null\"\r\n [(activeTab)]=\"activeTab\"\r\n [(filters)]=\"filters\"\r\n [(filterTerm)]=\"filterTerm\"\r\n [groupBy]=\"groupBy()\"\r\n (groupByChange)=\"onGroupByChange($event)\"\r\n (exportRequested)=\"exportExcel()\"\r\n (printRequested)=\"printPdf()\"\r\n (onTabChange)=\"tabChanged($event)\"\r\n (searchChange)=\"onSearchChange($event)\"\r\n (filterApplied)=\"onFilterApplied($event)\"\r\n (filterReset)=\"onFilterReset()\"\r\n />\r\n\r\n @if (!loading() && emptyContent() && data().length === 0) {\r\n <div\r\n class=\"p-4 bg-content rounded-md text-center text-gray-600 dark:text-gray-300\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"emptyContent()\"></ng-container>\r\n </div>\r\n } @else {\r\n <div\r\n class=\"overflow-x-auto rounded-[10px] border border-surface-200 bg-white\"\r\n >\r\n <p-table\r\n [value]=\"groupKeyedData()\"\r\n [columns]=\"renderedColumns()\"\r\n [size]=\"size()\"\r\n [showGridlines]=\"showGridlines()\"\r\n [stripedRows]=\"stripedRows()\"\r\n [lazy]=\"lazy()\"\r\n [totalRecords]=\"totalRecords()\"\r\n [reorderableColumns]=\"reorderableColumns()\"\r\n [reorderableRows]=\"reorderableRows()\"\r\n [dataKey]=\"dataKey()\"\r\n [first]=\"first()\"\r\n [rows]=\"pageSize()\"\r\n [exportFilename]=\"exportFilename()\"\r\n [rowGroupMode]=\"grouping.groupingActive() ? 'subheader' : null\"\r\n [groupRowsBy]=\"grouping.groupingActive() ? groupKeyField : null\"\r\n [sortField]=\"sortField()\"\r\n [sortOrder]=\"sortDirection() === 'desc' ? -1 : 1\"\r\n [scrollable]=\"freezeActions() || usesVirtualScroll()\"\r\n [virtualScroll]=\"usesVirtualScroll()\"\r\n [virtualScrollItemSize]=\"virtualScrollItemSize()\"\r\n [scrollHeight]=\"usesVirtualScroll() ? scrollHeight() : undefined\"\r\n (onPage)=\"onTablePage($event)\"\r\n (onLazyLoad)=\"handleLazyLoad($event)\"\r\n (onColReorder)=\"onColumnReorder($event)\"\r\n (onRowReorder)=\"onRowReorder($event)\"\r\n [paginator]=\"!virtualScroll()\"\r\n paginatorStyleClass=\"hidden!\"\r\n class=\"mt-table min-w-full align-middle text-sm\"\r\n [class.table-auto]=\"tableLayout() === 'auto'\"\r\n [class.table-fixed]=\"tableLayout() === 'fixed'\"\r\n >\r\n <ng-template\r\n #header\r\n let-columns\r\n class=\"bg-surface-50 dark:bg-surface-950 border-b border-surface-300 dark:border-surface-500\"\r\n >\r\n <tr>\r\n @if (reorderableRows()) {\r\n <th class=\"w-10\"></th>\r\n }\r\n @if (selectableRows()) {\r\n <th class=\"w-12 text-start\">\r\n <mt-checkbox-field\r\n [ngModel]=\"allSelectedOnPage()\"\r\n (ngModelChange)=\"toggleAllRowsOnPage()\"\r\n ></mt-checkbox-field>\r\n </th>\r\n }\r\n\r\n @for (col of columns; track col.key || col.label || $index) {\r\n @if (reorderableColumns()) {\r\n <th\r\n pReorderableColumn\r\n class=\"text-start text-sm font-normal text-color\"\r\n >\r\n <div class=\"flex items-center gap-2\">\r\n {{ col.label }}\r\n @if (\r\n isColumnFilterMode() && getFilterableColumn(col.key);\r\n as filterableCol\r\n ) {\r\n <mt-table-column-filter\r\n [column]=\"filterableCol\"\r\n [value]=\"filters()[col.key]\"\r\n (filterChange)=\"\r\n onColumnFilterChange(col.key, $event)\r\n \"\r\n />\r\n }\r\n <mt-button\r\n styleClass=\"cursor-move!\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n icon=\"general.menu-05\"\r\n ></mt-button>\r\n </div>\r\n </th>\r\n } @else {\r\n <th\r\n class=\"text-sm font-normal text-color\"\r\n [class]=\"getColumnAlignClass(col)\"\r\n [style.width]=\"getColumnWidth(col)\"\r\n [style.minWidth]=\"getColumnMinWidth(col)\"\r\n >\r\n <div class=\"inline-flex items-center gap-1\">\r\n @if (isColumnSortable(col)) {\r\n <button\r\n type=\"button\"\r\n class=\"inline-flex items-center gap-2 cursor-pointer\"\r\n (click)=\"toggleSort(col)\"\r\n >\r\n <span>{{ col.label }}</span>\r\n <mt-icon\r\n [icon]=\"getSortIcon(col)\"\r\n class=\"text-xs text-gray-400\"\r\n />\r\n </button>\r\n } @else {\r\n {{ col.label }}\r\n }\r\n @if (\r\n isColumnFilterMode() && getFilterableColumn(col.key);\r\n as filterableCol\r\n ) {\r\n <mt-table-column-filter\r\n [column]=\"filterableCol\"\r\n [value]=\"filters()[col.key]\"\r\n (filterChange)=\"\r\n onColumnFilterChange(col.key, $event)\r\n \"\r\n />\r\n }\r\n </div>\r\n </th>\r\n }\r\n }\r\n\r\n @if (rowActions().length > 0) {\r\n <th\r\n class=\"mt-actions-column text-center! text-sm font-normal text-color\"\r\n [class.mt-frozen-actions]=\"freezeActions()\"\r\n [pFrozenColumn]=\"freezeActions()\"\r\n alignFrozen=\"right\"\r\n >\r\n {{ \"components.table.actions\" | transloco }}\r\n </th>\r\n }\r\n </tr>\r\n @if (updating()) {\r\n <tr>\r\n <th [attr.colspan]=\"totalColumnSpan()\" class=\"!p-0\">\r\n <p-progressBar\r\n mode=\"indeterminate\"\r\n [style]=\"{ height: '4px' }\"\r\n />\r\n </th>\r\n </tr>\r\n }\r\n </ng-template>\r\n <ng-template\r\n #body\r\n let-row\r\n let-columns=\"columns\"\r\n let-index=\"rowIndex\"\r\n class=\"divide-y divide-gray-200\"\r\n >\r\n @if (loading()) {\r\n <tr>\r\n @if (reorderableRows()) {\r\n <td><p-skeleton /></td>\r\n }\r\n @if (selectableRows()) {\r\n <td><p-skeleton /></td>\r\n }\r\n @for (col of columns; track col.key || col.label || $index) {\r\n <td><p-skeleton /></td>\r\n }\r\n @if (rowActions().length > 0) {\r\n <td><p-skeleton /></td>\r\n }\r\n </tr>\r\n } @else {\r\n <tr\r\n class=\"border-surface-300 transition-colors duration-150 dark:border-surface-500\"\r\n [class.mt-table-clickable-row]=\"clickableRows()\"\r\n [class.mt-table-status-entity-row]=\"\r\n getStatusEntityAccentColor(row)\r\n \"\r\n [style.--mt-table-status-accent]=\"\r\n getStatusEntityAccentColor(row)\r\n \"\r\n [class.cursor-pointer]=\"clickableRows()\"\r\n [pReorderableRow]=\"index\"\r\n (click)=\"onRowClick($event, row)\"\r\n >\r\n @if (reorderableRows()) {\r\n <td class=\"w-10 text-center\">\r\n <mt-button\r\n styleClass=\"cursor-move!\"\r\n pReorderableRowHandle\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n icon=\"general.menu-05\"\r\n ></mt-button>\r\n <!-- <mt-icon-->\r\n <!-- icon=\"general.menu-05\"-->\r\n <!-- class=\"cursor-move text-gray-500\"-->\r\n <!-- pReorderableRowHandle-->\r\n <!-- ></mt-icon>-->\r\n </td>\r\n }\r\n @if (selectableRows()) {\r\n <td class=\"w-12\">\r\n <mt-checkbox-field\r\n [ngModel]=\"isRowSelected(row)\"\r\n (ngModelChange)=\"toggleRow(row)\"\r\n ></mt-checkbox-field>\r\n </td>\r\n }\r\n\r\n @for (col of columns; track col.key || col.label || $index) {\r\n <td\r\n class=\"text-sm font-normal text-muted-color\"\r\n [class]=\"getColumnAlignClass(col)\"\r\n [style.width]=\"getColumnWidth(col)\"\r\n [style.minWidth]=\"getColumnMinWidth(col)\"\r\n >\r\n @switch (col.type) {\r\n @case (\"boolean\") {\r\n @if (isCellClickFilterable(col, row)) {\r\n <span\r\n data-row-click-ignore=\"true\"\r\n class=\"inline-flex items-center cursor-pointer px-1.5 py-0.5 rounded transition-colors\"\r\n [class.ring-2]=\"isCellFilterActive(row, col)\"\r\n [class.ring-primary-400]=\"\r\n isCellFilterActive(row, col)\r\n \"\r\n [class.hover:underline]=\"\r\n !isCellFilterActive(row, col)\r\n \"\r\n (click)=\"onCellFilterClick($event, row, col)\"\r\n >\r\n {{\r\n getBooleanProperty(row, col.key)\r\n ? (\"components.table.yes\" | transloco)\r\n : (\"components.table.no\" | transloco)\r\n }}\r\n </span>\r\n } @else {\r\n <mt-toggle-field\r\n [disabled]=\"col.readonly\"\r\n [ngModel]=\"getBooleanProperty(row, col.key)\"\r\n (ngModelChange)=\"\r\n onCellChange(row, col.key, $event, 'boolean')\r\n \"\r\n ></mt-toggle-field>\r\n }\r\n }\r\n @case (\"date\") {\r\n {{\r\n getDateProperty(row, col.key) | mtDateFormat: \"date\"\r\n }}\r\n }\r\n @case (\"dateTime\") {\r\n {{\r\n getDateProperty(row, col.key)\r\n | mtDateFormat: \"dateTime\"\r\n }}\r\n }\r\n @case (\"user\") {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n filterableCell;\r\n context: { row: row, col: col }\r\n \"\r\n ></ng-container>\r\n }\r\n @case (\"status\") {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n filterableCell;\r\n context: { row: row, col: col }\r\n \"\r\n ></ng-container>\r\n }\r\n @case (\"entity\") {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n filterableCell;\r\n context: { row: row, col: col }\r\n \"\r\n ></ng-container>\r\n }\r\n @case (\"custom\") {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n col.customCellTpl;\r\n context: { $implicit: row }\r\n \"\r\n >\r\n </ng-container>\r\n }\r\n @default {\r\n {{ getProperty(row, col.key) }}\r\n }\r\n }\r\n </td>\r\n }\r\n\r\n @if (rowActions().length > 0) {\r\n <td\r\n class=\"mt-actions-column text-center\"\r\n [class.mt-frozen-actions]=\"freezeActions()\"\r\n [pFrozenColumn]=\"freezeActions()\"\r\n alignFrozen=\"right\"\r\n >\r\n @if (actionShape() === \"popover\") {\r\n <div class=\"flex items-center justify-center gap-1\">\r\n @for (\r\n action of getInlineRowActions(row);\r\n track $index\r\n ) {\r\n <mt-button\r\n [icon]=\"action.icon\"\r\n [severity]=\"action.color\"\r\n [variant]=\"action.variant\"\r\n [size]=\"action.size || 'small'\"\r\n (click)=\"rowAction($event, action, row)\"\r\n [tooltip]=\"action.tooltip\"\r\n [label]=\"action.label\"\r\n [loading]=\"resolveActionLoading(action, row)\"\r\n data-row-click-ignore=\"true\"\r\n ></mt-button>\r\n }\r\n @if (shouldShowRowActionsPopover(row)) {\r\n <mt-button\r\n icon=\"general.dots-vertical\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"large\"\r\n (click)=\"\r\n onRowActionsToggle($event, rowPopover, row)\r\n \"\r\n data-row-click-ignore=\"true\"\r\n ></mt-button>\r\n <p-popover #rowPopover appendTo=\"body\">\r\n <div class=\"flex flex-col min-w-40\">\r\n @if (isRowActionsLoading(row)) {\r\n <div class=\"flex flex-col gap-2 p-2\">\r\n <p-skeleton height=\"1.5rem\" />\r\n <p-skeleton height=\"1.5rem\" />\r\n <p-skeleton height=\"1.5rem\" />\r\n </div>\r\n } @else {\r\n @for (\r\n action of getMenuRowActions(row);\r\n track $index\r\n ) {\r\n @if (\r\n isFirstDestructiveAction(row, $index)\r\n ) {\r\n <hr\r\n class=\"my-1 border-0 border-t border-surface-200 dark:border-surface-700\"\r\n />\r\n }\r\n <button\r\n class=\"flex items-center gap-2 px-2 cursor-pointer py-2 text-sm rounded transition-colors\"\r\n [class]=\"\r\n action.color === 'danger'\r\n ? 'text-red-600 hover:bg-red-50 dark:hover:bg-red-950'\r\n : 'text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-surface-700'\r\n \"\r\n (click)=\"\r\n rowAction($event, action, row);\r\n rowPopover.hide()\r\n \"\r\n >\r\n @if (action.icon) {\r\n <mt-icon\r\n [icon]=\"action.icon\"\r\n class=\"text-base\"\r\n />\r\n }\r\n <span>{{\r\n action.label || action.tooltip\r\n }}</span>\r\n </button>\r\n }\r\n }\r\n </div>\r\n </p-popover>\r\n }\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex flex-wrap items-center justify-center gap-2\"\r\n >\r\n @for (action of rowActions(); track $index) {\r\n @let hidden = action.hidden?.(row);\r\n @if (!hidden) {\r\n <mt-button\r\n [icon]=\"action.icon\"\r\n [severity]=\"action.color\"\r\n [variant]=\"action.variant\"\r\n [size]=\"action.size || 'small'\"\r\n (click)=\"rowAction($event, action, row)\"\r\n [tooltip]=\"action.tooltip\"\r\n [label]=\"action.label\"\r\n [loading]=\"resolveActionLoading(action, row)\"\r\n ></mt-button>\r\n }\r\n }\r\n </div>\r\n }\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </ng-template>\r\n <ng-template #filterableCell let-row=\"row\" let-col=\"col\">\r\n @let filterable = isCellClickFilterable(col, row);\r\n @let active = isCellFilterActive(row, col);\r\n @if (filterable) {\r\n <span\r\n data-row-click-ignore=\"true\"\r\n class=\"flex w-full items-center rounded px-1 transition-colors\"\r\n [class.mt-cell-filterable]=\"!active\"\r\n [class.mt-cell-filter-active]=\"active\"\r\n [title]=\"\r\n active\r\n ? ('components.table.clearFilter' | transloco)\r\n : ('components.table.filterByThis' | transloco)\r\n \"\r\n (click)=\"onCellFilterClick($event, row, col)\"\r\n >\r\n @if (resolveCellEntityData(row, col); as entityData) {\r\n <mt-entity-preview\r\n [data]=\"entityData\"\r\n attachmentShape=\"compact\"\r\n ></mt-entity-preview>\r\n } @else {\r\n {{ getProperty(row, col.key) }}\r\n }\r\n </span>\r\n } @else {\r\n @if (resolveCellEntityData(row, col); as entityData) {\r\n <mt-entity-preview\r\n [data]=\"entityData\"\r\n attachmentShape=\"compact\"\r\n ></mt-entity-preview>\r\n } @else {\r\n {{ getProperty(row, col.key) }}\r\n }\r\n }\r\n </ng-template>\r\n <ng-template #groupheader let-row>\r\n @if (grouping.groupingActive()) {\r\n <tr\r\n class=\"mt-group-header\"\r\n [style.--mt-group-accent]=\"\r\n grouping.getGroupAccentColor(row) ??\r\n 'var(--p-primary-color)'\r\n \"\r\n >\r\n <td [attr.colspan]=\"totalColumnSpan()\" class=\"!p-0\">\r\n <div\r\n class=\"mt-group-header__accent flex items-center gap-2.5 px-4 py-2.5 bg-surface-50 dark:bg-surface-900 border-y border-surface-200 dark:border-surface-700\"\r\n >\r\n @if (grouping.showsGroupColumnLabel()) {\r\n <span\r\n class=\"shrink-0 text-xs text-gray-500 dark:text-gray-400\"\r\n >\r\n {{ grouping.activeGroupColumn()?.label }}\r\n </span>\r\n <span\r\n class=\"shrink-0 text-gray-300 dark:text-gray-600\"\r\n aria-hidden=\"true\"\r\n >\u00B7</span\r\n >\r\n }\r\n <span\r\n class=\"truncate text-sm font-semibold text-gray-900 dark:text-gray-100\"\r\n >\r\n {{ grouping.getGroupLabel(row) }}\r\n </span>\r\n <span\r\n class=\"ms-auto shrink-0 inline-flex items-center rounded-full bg-surface-200/70 px-2 py-0.5 text-xs font-medium text-gray-600 dark:bg-surface-700/60 dark:text-gray-300\"\r\n >\r\n {{ getDisplayGroupCount(row) }}\r\n </span>\r\n </div>\r\n </td>\r\n </tr>\r\n }\r\n </ng-template>\r\n <ng-template #emptymessage>\r\n <tr>\r\n <td [attr.colspan]=\"totalColumnSpan()\">\r\n <!--\r\n One empty state across the product (finding H-12). When a\r\n filter or a search term is active the table says so and\r\n offers to clear it, instead of the same \"No data found\" that\r\n a genuinely empty list shows.\r\n -->\r\n <mt-empty-state\r\n class=\"min-h-44\"\r\n [variant]=\"hasActiveFilters() ? 'filtered' : 'empty'\"\r\n [title]=\"emptyTitle()\"\r\n [description]=\"emptyDescription()\"\r\n [actionLabel]=\"resolvedEmptyActionLabel()\"\r\n [actionIcon]=\"resolvedEmptyActionIcon()\"\r\n (actionClick)=\"onEmptyAction()\"\r\n />\r\n </td>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n </div>\r\n }\r\n </div>\r\n\r\n @if (showPaginator()) {\r\n <div\r\n class=\"flex flex-col gap-3 pb-3 px-4\"\r\n [class]=\"'items-' + paginatorPosition()\"\r\n >\r\n <mt-paginator\r\n [(rows)]=\"pageSize\"\r\n [(first)]=\"first\"\r\n [(page)]=\"currentPage\"\r\n [totalRecords]=\"totalRecords()\"\r\n [alwaysShow]=\"alwaysShowPaginator()\"\r\n [rowsPerPageOptions]=\"rowsPerPageOptions()\"\r\n (onPageChange)=\"onPaginatorPage($event)\"\r\n ></mt-paginator>\r\n </div>\r\n }\r\n </div>\r\n</ng-template>\r\n", styles: [":host ::ng-deep .p-datatable-header{padding:0 0 1.5rem;background:transparent;border:0}:host ::ng-deep .p-datatable-table{border-collapse:separate;border-spacing:0}:host ::ng-deep .p-datatable-thead>tr>th{padding:.9rem 1rem;background:var(--p-content-background, #ffffff);border-bottom:1px solid var(--p-content-border-color, #ebebf0);color:var(--p-text-color, #323232);font-size:14px;font-weight:400;line-height:20px;white-space:nowrap}:host ::ng-deep .p-datatable-tbody>tr>td{padding:.72rem 1rem;background:var(--p-content-background, #ffffff);border-bottom:1px solid var(--p-content-border-color, #ebebf0);color:var(--p-text-muted-color, #4b4b4b);font-size:14px;font-weight:400;line-height:20px;vertical-align:middle}:host ::ng-deep .p-datatable-tbody>tr:last-child>td{border-bottom:0}:host ::ng-deep .p-datatable-thead>tr>th:first-child{border-top-left-radius:.625rem}:host ::ng-deep .p-datatable-thead>tr>th:last-child{border-top-right-radius:.625rem}:host ::ng-deep .p-datatable-tbody>tr:last-child>td:first-child{border-bottom-left-radius:.625rem}:host ::ng-deep .p-datatable-tbody>tr:last-child>td:last-child{border-bottom-right-radius:.625rem}.mt-table-clickable-row>td{transition:background-color .16s ease,color .16s ease,border-color .16s ease}.mt-table-clickable-row:hover>td,.mt-table-clickable-row:focus-within>td{background:var(--p-surface-50, #fafafa)}.mt-table-clickable-row:hover>td:first-child,.mt-table-clickable-row:focus-within>td:first-child{border-inline-start:none}.mt-table-status-entity-row>td{background:var(--p-content-background, #ffffff)}.mt-table-status-entity-row>td:first-child:before{display:none}:host ::ng-deep tr.mt-group-header>td{padding:0!important;background:transparent}tr.mt-group-header .mt-group-header__accent{border-inline-start:3px solid var(--mt-group-accent, var(--p-primary-color))}:host ::ng-deep .mt-frozen-actions{border-inline-start:1px solid var(--p-content-border-color, #ebebf0)}:host ::ng-deep .mt-actions-column{max-width:15rem;max-inline-size:8rem}.mt-cell-filterable{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2314b8a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-in}.mt-cell-filter-active{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%2314b8a6' stroke='%2314b8a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-out}.mt-cell-filterable:hover{background-color:#ccfbf147;outline:1px dashed rgb(20 184 166 / .28);outline-offset:2px}.mt-cell-filter-active{box-shadow:inset 0 0 0 1.5px #14b8a666}\n"], dependencies: [{ kind: "ngmodule", type: TableModule }, { kind: "component", type: i1$3.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i1$3.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "directive", type: i1$3.ReorderableColumn, selector: "[pReorderableColumn]", inputs: ["pReorderableColumnDisabled"] }, { kind: "directive", type: i1$3.ReorderableRowHandle, selector: "[pReorderableRowHandle]" }, { kind: "directive", type: i1$3.ReorderableRow, selector: "[pReorderableRow]", inputs: ["pReorderableRow", "pReorderableRowDisabled"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ToggleField, selector: "mt-toggle-field", inputs: ["label", "inputId", "labelPosition", "placeholder", "readonly", "pInputs", "required", "toggleShape", "size", "icon", "descriptionCard"], outputs: ["onChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { 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: Paginator, selector: "mt-paginator", inputs: ["rows", "totalRecords", "first", "page", "rowsPerPageOptions", "showFirstLastIcon", "showCurrentPageReport", "fluid", "pageLinkSize", "alwaysShow"], outputs: ["rowsChange", "firstChange", "pageChange", "onPageChange"] }, { kind: "component", type: CheckboxField, selector: "mt-checkbox-field", inputs: ["label", "labelPosition", "placeholder", "readonly", "pInputs", "required"], outputs: ["onChange"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i3.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: ProgressBarModule }, { kind: "component", type: i4.ProgressBar, selector: "p-progressBar, p-progressbar, p-progress-bar", inputs: ["value", "showValue", "styleClass", "valueStyleClass", "unit", "mode", "color"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "component", type: TableCaption, selector: "mt-table-caption", inputs: ["generalSearch", "showFilters", "filterMode", "exportable", "printable", "groupable", "columns", "data", "groupColumns", "tabs", "tabsOptionLabel", "tabsOptionValue", "actions", "captionStart", "captionEnd", "activeTab", "filters", "filterTerm", "groupBy"], outputs: ["activeTabChange", "filtersChange", "filterTermChange", "groupByChange", "exportRequested", "printRequested", "onTabChange", "searchChange", "filterApplied", "filterReset"] }, { kind: "component", type: TableColumnFilter, selector: "mt-table-column-filter", inputs: ["column", "value"], outputs: ["filterChange"] }, { kind: "component", type: EntityPreview, selector: "mt-entity-preview", inputs: ["data", "attachmentShape"] }, { kind: "ngmodule", type: PopoverModule }, { kind: "component", type: i1$2.Popover, selector: "p-popover", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions", "motionOptions"], outputs: ["onShow", "onHide"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: Card, selector: "mt-card", inputs: ["class", "title", "paddingless"] }, { kind: "component", type: EmptyState, selector: "mt-empty-state", inputs: ["variant", "illustration", "title", "description", "actionLabel", "actionIcon"], outputs: ["actionClick"] }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }, { kind: "pipe", type: MTDateFormatPipe, name: "mtDateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3342
|
+
}
|
|
3343
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Table, decorators: [{
|
|
3344
|
+
type: Component,
|
|
3345
|
+
args: [{ selector: 'mt-table', standalone: true, providers: [MTDateFormatPipe], imports: [
|
|
3346
|
+
TableModule,
|
|
3347
|
+
NgTemplateOutlet,
|
|
3348
|
+
ToggleField,
|
|
3349
|
+
FormsModule,
|
|
3350
|
+
Button,
|
|
3351
|
+
Paginator,
|
|
3352
|
+
CheckboxField,
|
|
3353
|
+
SkeletonModule,
|
|
3354
|
+
ProgressBarModule,
|
|
3355
|
+
TranslocoModule,
|
|
3356
|
+
TableCaption,
|
|
3357
|
+
TableColumnFilter,
|
|
3358
|
+
EntityPreview,
|
|
3359
|
+
PopoverModule,
|
|
3360
|
+
Icon,
|
|
3361
|
+
Card,
|
|
3362
|
+
MTDateFormatPipe,
|
|
3363
|
+
EmptyState,
|
|
3364
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (!noCard()) {\r\n <mt-card>\r\n <ng-container *ngTemplateOutlet=\"tableContent\" />\r\n </mt-card>\r\n} @else {\r\n <ng-container *ngTemplateOutlet=\"tableContent\" />\r\n}\r\n\r\n<ng-template #tableContent>\r\n <div class=\"space-y-4 rounded-lg\">\r\n <div>\r\n <mt-table-caption\r\n [generalSearch]=\"generalSearch()\"\r\n [showFilters]=\"showFilters()\"\r\n [filterMode]=\"filterMode()\"\r\n [exportable]=\"exportable()\"\r\n [printable]=\"printable()\"\r\n [groupable]=\"groupable()\"\r\n [columns]=\"columns()\"\r\n [data]=\"data()\"\r\n [groupColumns]=\"grouping.groupableColumns()\"\r\n [tabs]=\"tabs()\"\r\n [tabsOptionLabel]=\"tabsOptionLabel()\"\r\n [tabsOptionValue]=\"tabsOptionValue()\"\r\n [actions]=\"actions()\"\r\n [captionStart]=\"captionStartContent() ?? null\"\r\n [captionEnd]=\"captionEndContent() ?? null\"\r\n [(activeTab)]=\"activeTab\"\r\n [(filters)]=\"filters\"\r\n [(filterTerm)]=\"filterTerm\"\r\n [groupBy]=\"groupBy()\"\r\n (groupByChange)=\"onGroupByChange($event)\"\r\n (exportRequested)=\"exportExcel()\"\r\n (printRequested)=\"printPdf()\"\r\n (onTabChange)=\"tabChanged($event)\"\r\n (searchChange)=\"onSearchChange($event)\"\r\n (filterApplied)=\"onFilterApplied($event)\"\r\n (filterReset)=\"onFilterReset()\"\r\n />\r\n\r\n @if (!loading() && emptyContent() && data().length === 0) {\r\n <div\r\n class=\"p-4 bg-content rounded-md text-center text-gray-600 dark:text-gray-300\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"emptyContent()\"></ng-container>\r\n </div>\r\n } @else {\r\n <div\r\n class=\"overflow-x-auto rounded-[10px] border border-surface-200 bg-white\"\r\n >\r\n <p-table\r\n [value]=\"groupKeyedData()\"\r\n [columns]=\"renderedColumns()\"\r\n [size]=\"size()\"\r\n [showGridlines]=\"showGridlines()\"\r\n [stripedRows]=\"stripedRows()\"\r\n [lazy]=\"lazy()\"\r\n [totalRecords]=\"totalRecords()\"\r\n [reorderableColumns]=\"reorderableColumns()\"\r\n [reorderableRows]=\"reorderableRows()\"\r\n [dataKey]=\"dataKey()\"\r\n [first]=\"first()\"\r\n [rows]=\"pageSize()\"\r\n [exportFilename]=\"exportFilename()\"\r\n [rowGroupMode]=\"grouping.groupingActive() ? 'subheader' : null\"\r\n [groupRowsBy]=\"grouping.groupingActive() ? groupKeyField : null\"\r\n [sortField]=\"sortField()\"\r\n [sortOrder]=\"sortDirection() === 'desc' ? -1 : 1\"\r\n [scrollable]=\"freezeActions() || usesVirtualScroll()\"\r\n [virtualScroll]=\"usesVirtualScroll()\"\r\n [virtualScrollItemSize]=\"virtualScrollItemSize()\"\r\n [scrollHeight]=\"usesVirtualScroll() ? scrollHeight() : undefined\"\r\n (onPage)=\"onTablePage($event)\"\r\n (onLazyLoad)=\"handleLazyLoad($event)\"\r\n (onColReorder)=\"onColumnReorder($event)\"\r\n (onRowReorder)=\"onRowReorder($event)\"\r\n [paginator]=\"!virtualScroll()\"\r\n paginatorStyleClass=\"hidden!\"\r\n class=\"mt-table min-w-full align-middle text-sm\"\r\n [class.table-auto]=\"tableLayout() === 'auto'\"\r\n [class.table-fixed]=\"tableLayout() === 'fixed'\"\r\n >\r\n <ng-template\r\n #header\r\n let-columns\r\n class=\"bg-surface-50 dark:bg-surface-950 border-b border-surface-300 dark:border-surface-500\"\r\n >\r\n <tr>\r\n @if (reorderableRows()) {\r\n <th class=\"w-10\"></th>\r\n }\r\n @if (selectableRows()) {\r\n <th class=\"w-12 text-start\">\r\n <mt-checkbox-field\r\n [ngModel]=\"allSelectedOnPage()\"\r\n (ngModelChange)=\"toggleAllRowsOnPage()\"\r\n ></mt-checkbox-field>\r\n </th>\r\n }\r\n\r\n @for (col of columns; track col.key || col.label || $index) {\r\n @if (reorderableColumns()) {\r\n <th\r\n pReorderableColumn\r\n class=\"text-start text-sm font-normal text-color\"\r\n >\r\n <div class=\"flex items-center gap-2\">\r\n {{ col.label }}\r\n @if (\r\n isColumnFilterMode() && getFilterableColumn(col.key);\r\n as filterableCol\r\n ) {\r\n <mt-table-column-filter\r\n [column]=\"filterableCol\"\r\n [value]=\"filters()[col.key]\"\r\n (filterChange)=\"\r\n onColumnFilterChange(col.key, $event)\r\n \"\r\n />\r\n }\r\n <mt-button\r\n styleClass=\"cursor-move!\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n icon=\"general.menu-05\"\r\n ></mt-button>\r\n </div>\r\n </th>\r\n } @else {\r\n <th\r\n class=\"text-sm font-normal text-color\"\r\n [class]=\"getColumnAlignClass(col)\"\r\n [style.width]=\"getColumnWidth(col)\"\r\n [style.minWidth]=\"getColumnMinWidth(col)\"\r\n >\r\n <div class=\"inline-flex items-center gap-1\">\r\n @if (isColumnSortable(col)) {\r\n <button\r\n type=\"button\"\r\n class=\"inline-flex items-center gap-2 cursor-pointer\"\r\n (click)=\"toggleSort(col)\"\r\n >\r\n <span>{{ col.label }}</span>\r\n <mt-icon\r\n [icon]=\"getSortIcon(col)\"\r\n class=\"text-xs text-gray-400\"\r\n />\r\n </button>\r\n } @else {\r\n {{ col.label }}\r\n }\r\n @if (\r\n isColumnFilterMode() && getFilterableColumn(col.key);\r\n as filterableCol\r\n ) {\r\n <mt-table-column-filter\r\n [column]=\"filterableCol\"\r\n [value]=\"filters()[col.key]\"\r\n (filterChange)=\"\r\n onColumnFilterChange(col.key, $event)\r\n \"\r\n />\r\n }\r\n </div>\r\n </th>\r\n }\r\n }\r\n\r\n @if (rowActions().length > 0) {\r\n <th\r\n class=\"mt-actions-column text-center! text-sm font-normal text-color\"\r\n [class.mt-frozen-actions]=\"freezeActions()\"\r\n [pFrozenColumn]=\"freezeActions()\"\r\n alignFrozen=\"right\"\r\n >\r\n {{ \"components.table.actions\" | transloco }}\r\n </th>\r\n }\r\n </tr>\r\n @if (updating()) {\r\n <tr>\r\n <th [attr.colspan]=\"totalColumnSpan()\" class=\"!p-0\">\r\n <p-progressBar\r\n mode=\"indeterminate\"\r\n [style]=\"{ height: '4px' }\"\r\n />\r\n </th>\r\n </tr>\r\n }\r\n </ng-template>\r\n <ng-template\r\n #body\r\n let-row\r\n let-columns=\"columns\"\r\n let-index=\"rowIndex\"\r\n class=\"divide-y divide-gray-200\"\r\n >\r\n @if (loading()) {\r\n <tr>\r\n @if (reorderableRows()) {\r\n <td><p-skeleton /></td>\r\n }\r\n @if (selectableRows()) {\r\n <td><p-skeleton /></td>\r\n }\r\n @for (col of columns; track col.key || col.label || $index) {\r\n <td><p-skeleton /></td>\r\n }\r\n @if (rowActions().length > 0) {\r\n <td><p-skeleton /></td>\r\n }\r\n </tr>\r\n } @else {\r\n <tr\r\n class=\"border-surface-300 transition-colors duration-150 dark:border-surface-500\"\r\n [class.mt-table-clickable-row]=\"clickableRows()\"\r\n [class.mt-table-status-entity-row]=\"\r\n getStatusEntityAccentColor(row)\r\n \"\r\n [style.--mt-table-status-accent]=\"\r\n getStatusEntityAccentColor(row)\r\n \"\r\n [class.cursor-pointer]=\"clickableRows()\"\r\n [pReorderableRow]=\"index\"\r\n (click)=\"onRowClick($event, row)\"\r\n >\r\n @if (reorderableRows()) {\r\n <td class=\"w-10 text-center\">\r\n <mt-button\r\n styleClass=\"cursor-move!\"\r\n pReorderableRowHandle\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n size=\"small\"\r\n icon=\"general.menu-05\"\r\n ></mt-button>\r\n <!-- <mt-icon-->\r\n <!-- icon=\"general.menu-05\"-->\r\n <!-- class=\"cursor-move text-gray-500\"-->\r\n <!-- pReorderableRowHandle-->\r\n <!-- ></mt-icon>-->\r\n </td>\r\n }\r\n @if (selectableRows()) {\r\n <td class=\"w-12\">\r\n <mt-checkbox-field\r\n [ngModel]=\"isRowSelected(row)\"\r\n (ngModelChange)=\"toggleRow(row)\"\r\n ></mt-checkbox-field>\r\n </td>\r\n }\r\n\r\n @for (col of columns; track col.key || col.label || $index) {\r\n <td\r\n class=\"text-sm font-normal text-muted-color\"\r\n [class]=\"getColumnAlignClass(col)\"\r\n [style.width]=\"getColumnWidth(col)\"\r\n [style.minWidth]=\"getColumnMinWidth(col)\"\r\n >\r\n @switch (col.type) {\r\n @case (\"boolean\") {\r\n @if (isCellClickFilterable(col, row)) {\r\n <span\r\n data-row-click-ignore=\"true\"\r\n class=\"inline-flex items-center cursor-pointer px-1.5 py-0.5 rounded transition-colors\"\r\n [class.ring-2]=\"isCellFilterActive(row, col)\"\r\n [class.ring-primary-400]=\"\r\n isCellFilterActive(row, col)\r\n \"\r\n [class.hover:underline]=\"\r\n !isCellFilterActive(row, col)\r\n \"\r\n (click)=\"onCellFilterClick($event, row, col)\"\r\n >\r\n {{\r\n getBooleanProperty(row, col.key)\r\n ? (\"components.table.yes\" | transloco)\r\n : (\"components.table.no\" | transloco)\r\n }}\r\n </span>\r\n } @else {\r\n <mt-toggle-field\r\n [disabled]=\"col.readonly\"\r\n [ngModel]=\"getBooleanProperty(row, col.key)\"\r\n (ngModelChange)=\"\r\n onCellChange(row, col.key, $event, 'boolean')\r\n \"\r\n ></mt-toggle-field>\r\n }\r\n }\r\n @case (\"date\") {\r\n {{\r\n getDateProperty(row, col.key) | mtDateFormat: \"date\"\r\n }}\r\n }\r\n @case (\"dateTime\") {\r\n {{\r\n getDateProperty(row, col.key)\r\n | mtDateFormat: \"dateTime\"\r\n }}\r\n }\r\n @case (\"user\") {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n filterableCell;\r\n context: { row: row, col: col }\r\n \"\r\n ></ng-container>\r\n }\r\n @case (\"status\") {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n filterableCell;\r\n context: { row: row, col: col }\r\n \"\r\n ></ng-container>\r\n }\r\n @case (\"entity\") {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n filterableCell;\r\n context: { row: row, col: col }\r\n \"\r\n ></ng-container>\r\n }\r\n @case (\"custom\") {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n col.customCellTpl;\r\n context: { $implicit: row }\r\n \"\r\n >\r\n </ng-container>\r\n }\r\n @default {\r\n {{ getProperty(row, col.key) }}\r\n }\r\n }\r\n </td>\r\n }\r\n\r\n @if (rowActions().length > 0) {\r\n <td\r\n class=\"mt-actions-column text-center\"\r\n [class.mt-frozen-actions]=\"freezeActions()\"\r\n [pFrozenColumn]=\"freezeActions()\"\r\n alignFrozen=\"right\"\r\n >\r\n @if (actionShape() === \"popover\") {\r\n <div class=\"flex items-center justify-center gap-1\">\r\n @for (\r\n action of getInlineRowActions(row);\r\n track $index\r\n ) {\r\n <mt-button\r\n [icon]=\"action.icon\"\r\n [severity]=\"action.color\"\r\n [variant]=\"action.variant\"\r\n [size]=\"action.size || 'small'\"\r\n (click)=\"rowAction($event, action, row)\"\r\n [tooltip]=\"action.tooltip\"\r\n [label]=\"action.label\"\r\n [loading]=\"resolveActionLoading(action, row)\"\r\n data-row-click-ignore=\"true\"\r\n ></mt-button>\r\n }\r\n @if (shouldShowRowActionsPopover(row)) {\r\n <mt-button\r\n icon=\"general.dots-vertical\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"large\"\r\n (click)=\"\r\n onRowActionsToggle($event, rowPopover, row)\r\n \"\r\n data-row-click-ignore=\"true\"\r\n ></mt-button>\r\n <p-popover #rowPopover appendTo=\"body\">\r\n <div class=\"flex flex-col min-w-40\">\r\n @if (isRowActionsLoading(row)) {\r\n <div class=\"flex flex-col gap-2 p-2\">\r\n <p-skeleton height=\"1.5rem\" />\r\n <p-skeleton height=\"1.5rem\" />\r\n <p-skeleton height=\"1.5rem\" />\r\n </div>\r\n } @else {\r\n @for (\r\n action of getMenuRowActions(row);\r\n track $index\r\n ) {\r\n @if (\r\n isFirstDestructiveAction(row, $index)\r\n ) {\r\n <hr\r\n class=\"my-1 border-0 border-t border-surface-200 dark:border-surface-700\"\r\n />\r\n }\r\n <button\r\n class=\"flex items-center gap-2 px-2 cursor-pointer py-2 text-sm rounded transition-colors\"\r\n [class]=\"\r\n action.color === 'danger'\r\n ? 'text-red-600 hover:bg-red-50 dark:hover:bg-red-950'\r\n : 'text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-surface-700'\r\n \"\r\n (click)=\"\r\n rowAction($event, action, row);\r\n rowPopover.hide()\r\n \"\r\n >\r\n @if (action.icon) {\r\n <mt-icon\r\n [icon]=\"action.icon\"\r\n class=\"text-base\"\r\n />\r\n }\r\n <span>{{\r\n action.label || action.tooltip\r\n }}</span>\r\n </button>\r\n }\r\n }\r\n </div>\r\n </p-popover>\r\n }\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex flex-wrap items-center justify-center gap-2\"\r\n >\r\n @for (action of rowActions(); track $index) {\r\n @let hidden = action.hidden?.(row);\r\n @if (!hidden) {\r\n <mt-button\r\n [icon]=\"action.icon\"\r\n [severity]=\"action.color\"\r\n [variant]=\"action.variant\"\r\n [size]=\"action.size || 'small'\"\r\n (click)=\"rowAction($event, action, row)\"\r\n [tooltip]=\"action.tooltip\"\r\n [label]=\"action.label\"\r\n [loading]=\"resolveActionLoading(action, row)\"\r\n ></mt-button>\r\n }\r\n }\r\n </div>\r\n }\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </ng-template>\r\n <ng-template #filterableCell let-row=\"row\" let-col=\"col\">\r\n @let filterable = isCellClickFilterable(col, row);\r\n @let active = isCellFilterActive(row, col);\r\n @if (filterable) {\r\n <span\r\n data-row-click-ignore=\"true\"\r\n class=\"flex w-full items-center rounded px-1 transition-colors\"\r\n [class.mt-cell-filterable]=\"!active\"\r\n [class.mt-cell-filter-active]=\"active\"\r\n [title]=\"\r\n active\r\n ? ('components.table.clearFilter' | transloco)\r\n : ('components.table.filterByThis' | transloco)\r\n \"\r\n (click)=\"onCellFilterClick($event, row, col)\"\r\n >\r\n @if (resolveCellEntityData(row, col); as entityData) {\r\n <mt-entity-preview\r\n [data]=\"entityData\"\r\n attachmentShape=\"compact\"\r\n ></mt-entity-preview>\r\n } @else {\r\n {{ getProperty(row, col.key) }}\r\n }\r\n </span>\r\n } @else {\r\n @if (resolveCellEntityData(row, col); as entityData) {\r\n <mt-entity-preview\r\n [data]=\"entityData\"\r\n attachmentShape=\"compact\"\r\n ></mt-entity-preview>\r\n } @else {\r\n {{ getProperty(row, col.key) }}\r\n }\r\n }\r\n </ng-template>\r\n <ng-template #groupheader let-row>\r\n @if (grouping.groupingActive()) {\r\n <tr\r\n class=\"mt-group-header\"\r\n [style.--mt-group-accent]=\"\r\n grouping.getGroupAccentColor(row) ??\r\n 'var(--p-primary-color)'\r\n \"\r\n >\r\n <td [attr.colspan]=\"totalColumnSpan()\" class=\"!p-0\">\r\n <div\r\n class=\"mt-group-header__accent flex items-center gap-2.5 px-4 py-2.5 bg-surface-50 dark:bg-surface-900 border-y border-surface-200 dark:border-surface-700\"\r\n >\r\n @if (grouping.showsGroupColumnLabel()) {\r\n <span\r\n class=\"shrink-0 text-xs text-gray-500 dark:text-gray-400\"\r\n >\r\n {{ grouping.activeGroupColumn()?.label }}\r\n </span>\r\n <span\r\n class=\"shrink-0 text-gray-300 dark:text-gray-600\"\r\n aria-hidden=\"true\"\r\n >\u00B7</span\r\n >\r\n }\r\n <span\r\n class=\"truncate text-sm font-semibold text-gray-900 dark:text-gray-100\"\r\n >\r\n {{ grouping.getGroupLabel(row) }}\r\n </span>\r\n <span\r\n class=\"ms-auto shrink-0 inline-flex items-center rounded-full bg-surface-200/70 px-2 py-0.5 text-xs font-medium text-gray-600 dark:bg-surface-700/60 dark:text-gray-300\"\r\n >\r\n {{ getDisplayGroupCount(row) }}\r\n </span>\r\n </div>\r\n </td>\r\n </tr>\r\n }\r\n </ng-template>\r\n <ng-template #emptymessage>\r\n <tr>\r\n <td [attr.colspan]=\"totalColumnSpan()\">\r\n <!--\r\n One empty state across the product (finding H-12). When a\r\n filter or a search term is active the table says so and\r\n offers to clear it, instead of the same \"No data found\" that\r\n a genuinely empty list shows.\r\n -->\r\n <mt-empty-state\r\n class=\"min-h-44\"\r\n [variant]=\"hasActiveFilters() ? 'filtered' : 'empty'\"\r\n [title]=\"emptyTitle()\"\r\n [description]=\"emptyDescription()\"\r\n [actionLabel]=\"resolvedEmptyActionLabel()\"\r\n [actionIcon]=\"resolvedEmptyActionIcon()\"\r\n (actionClick)=\"onEmptyAction()\"\r\n />\r\n </td>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n </div>\r\n }\r\n </div>\r\n\r\n @if (showPaginator()) {\r\n <div\r\n class=\"flex flex-col gap-3 pb-3 px-4\"\r\n [class]=\"'items-' + paginatorPosition()\"\r\n >\r\n <mt-paginator\r\n [(rows)]=\"pageSize\"\r\n [(first)]=\"first\"\r\n [(page)]=\"currentPage\"\r\n [totalRecords]=\"totalRecords()\"\r\n [alwaysShow]=\"alwaysShowPaginator()\"\r\n [rowsPerPageOptions]=\"rowsPerPageOptions()\"\r\n (onPageChange)=\"onPaginatorPage($event)\"\r\n ></mt-paginator>\r\n </div>\r\n }\r\n </div>\r\n</ng-template>\r\n", styles: [":host ::ng-deep .p-datatable-header{padding:0 0 1.5rem;background:transparent;border:0}:host ::ng-deep .p-datatable-table{border-collapse:separate;border-spacing:0}:host ::ng-deep .p-datatable-thead>tr>th{padding:.9rem 1rem;background:var(--p-content-background, #ffffff);border-bottom:1px solid var(--p-content-border-color, #ebebf0);color:var(--p-text-color, #323232);font-size:14px;font-weight:400;line-height:20px;white-space:nowrap}:host ::ng-deep .p-datatable-tbody>tr>td{padding:.72rem 1rem;background:var(--p-content-background, #ffffff);border-bottom:1px solid var(--p-content-border-color, #ebebf0);color:var(--p-text-muted-color, #4b4b4b);font-size:14px;font-weight:400;line-height:20px;vertical-align:middle}:host ::ng-deep .p-datatable-tbody>tr:last-child>td{border-bottom:0}:host ::ng-deep .p-datatable-thead>tr>th:first-child{border-top-left-radius:.625rem}:host ::ng-deep .p-datatable-thead>tr>th:last-child{border-top-right-radius:.625rem}:host ::ng-deep .p-datatable-tbody>tr:last-child>td:first-child{border-bottom-left-radius:.625rem}:host ::ng-deep .p-datatable-tbody>tr:last-child>td:last-child{border-bottom-right-radius:.625rem}.mt-table-clickable-row>td{transition:background-color .16s ease,color .16s ease,border-color .16s ease}.mt-table-clickable-row:hover>td,.mt-table-clickable-row:focus-within>td{background:var(--p-surface-50, #fafafa)}.mt-table-clickable-row:hover>td:first-child,.mt-table-clickable-row:focus-within>td:first-child{border-inline-start:none}.mt-table-status-entity-row>td{background:var(--p-content-background, #ffffff)}.mt-table-status-entity-row>td:first-child:before{display:none}:host ::ng-deep tr.mt-group-header>td{padding:0!important;background:transparent}tr.mt-group-header .mt-group-header__accent{border-inline-start:3px solid var(--mt-group-accent, var(--p-primary-color))}:host ::ng-deep .mt-frozen-actions{border-inline-start:1px solid var(--p-content-border-color, #ebebf0)}:host ::ng-deep .mt-actions-column{max-width:15rem;max-inline-size:8rem}.mt-cell-filterable{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2314b8a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-in}.mt-cell-filter-active{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%2314b8a6' stroke='%2314b8a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-out}.mt-cell-filterable:hover{background-color:#ccfbf147;outline:1px dashed rgb(20 184 166 / .28);outline-offset:2px}.mt-cell-filter-active{box-shadow:inset 0 0 0 1.5px #14b8a666}\n"] }]
|
|
3365
|
+
}], ctorParameters: () => [], propDecorators: { selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], cellChange: [{ type: i0.Output, args: ["cellChange"] }], lazyLoad: [{ type: i0.Output, args: ["lazyLoad"] }], columnReorder: [{ type: i0.Output, args: ["columnReorder"] }], rowReorder: [{ type: i0.Output, args: ["rowReorder"] }], rowClick: [{ type: i0.Output, args: ["rowClick"] }], emptyAction: [{ type: i0.Output, args: ["emptyAction"] }], rowActionsRequested: [{ type: i0.Output, args: ["rowActionsRequested"] }], filters: [{ type: i0.Input, args: [{ isSignal: true, alias: "filters", required: false }] }, { type: i0.Output, args: ["filtersChange"] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], rowActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowActions", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], showGridlines: [{ type: i0.Input, args: [{ isSignal: true, alias: "showGridlines", required: false }] }], stripedRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "stripedRows", required: false }] }], selectableRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectableRows", required: false }] }], clickableRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickableRows", required: false }] }], generalSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "generalSearch", required: false }] }], lazyLocalSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazyLocalSearch", required: false }] }], showFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFilters", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], updating: [{ type: i0.Input, args: [{ isSignal: true, alias: "updating", required: false }] }], lazy: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazy", required: false }] }], lazyLocalSort: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazyLocalSort", required: false }] }], lazyTotalRecords: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazyTotalRecords", required: false }] }], reorderableColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "reorderableColumns", required: false }] }], reorderableRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "reorderableRows", required: false }] }], dataKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataKey", required: false }] }], storageKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "storageKey", required: false }] }], storageMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "storageMode", required: false }] }], persistStateExclude: [{ type: i0.Input, args: [{ isSignal: true, alias: "persistStateExclude", required: false }] }], exportable: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportable", required: false }] }], printable: [{ type: i0.Input, args: [{ isSignal: true, alias: "printable", required: false }] }], groupable: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupable", required: false }] }], groupCountMap: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupCountMap", required: false }] }], cellClickFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "cellClickFilter", required: false }] }], freezeActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "freezeActions", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }], scrollHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollHeight", required: false }] }], printTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "printTitle", required: false }] }], exportFilename: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportFilename", required: false }] }], actionShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionShape", required: false }] }], rowActionsLoadingFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowActionsLoadingFn", required: false }] }], tableLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableLayout", required: false }] }], noCard: [{ type: i0.Input, args: [{ isSignal: true, alias: "noCard", required: false }] }], tabs: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabs", required: false }] }], tabsOptionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabsOptionLabel", required: false }] }], tabsOptionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabsOptionValue", required: false }] }], activeTab: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeTab", required: false }] }, { type: i0.Output, args: ["activeTabChange"] }], onTabChange: [{ type: i0.Output, args: ["onTabChange"] }], actions: [{ type: i0.Input, args: [{ isSignal: true, alias: "actions", required: false }] }], captionStartContent: [{ type: i0.ContentChild, args: ['captionStart', { isSignal: true }] }], captionEndContent: [{ type: i0.ContentChild, args: ['captionEnd', { isSignal: true }] }], emptyContent: [{ type: i0.ContentChild, args: ['empty', { isSignal: true }] }], emptyTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyTitle", required: false }] }], emptyDescription: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyDescription", required: false }] }], emptyActionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyActionLabel", required: false }] }], emptyActionIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyActionIcon", required: false }] }], paginatorPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "paginatorPosition", required: false }] }], alwaysShowPaginator: [{ type: i0.Input, args: [{ isSignal: true, alias: "alwaysShowPaginator", required: false }] }], rowsPerPageOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowsPerPageOptions", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }, { type: i0.Output, args: ["pageSizeChange"] }], currentPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "currentPage", required: false }] }, { type: i0.Output, args: ["currentPageChange"] }], first: [{ type: i0.Input, args: [{ isSignal: true, alias: "first", required: false }] }, { type: i0.Output, args: ["firstChange"] }], filterTerm: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterTerm", required: false }] }, { type: i0.Output, args: ["filterTermChange"] }], groupBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupBy", required: false }] }, { type: i0.Output, args: ["groupByChange"] }], sortField: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortField", required: false }] }, { type: i0.Output, args: ["sortFieldChange"] }], sortDirection: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortDirection", required: false }] }, { type: i0.Output, args: ["sortDirectionChange"] }] } });
|
|
3366
|
+
|
|
3367
|
+
/**
|
|
3368
|
+
* Generated bundle index. Do not edit.
|
|
3369
|
+
*/
|
|
3370
|
+
|
|
3371
|
+
export { EMPTY_GROUP_KEY, Table, TableActionsMenu, TableCaption, TableColumnFilter, TableExportService, TableFilter, TableFilterField, TableGroupingController, TableValueResolver };
|
|
3372
|
+
//# sourceMappingURL=masterteam-components-table.mjs.map
|