@ecodev/natural 69.0.12 → 70.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3722,6 +3722,41 @@ function unwrapNavigable(item) {
3722
3722
  }
3723
3723
  return item;
3724
3724
  }
3725
+ function getNumberRows(dataSource) {
3726
+ return dataSource?.data?.items.filter(row => unwrapNavigable(row).id).length ?? 0;
3727
+ }
3728
+ function getVisibleSelections(selection, dataSource) {
3729
+ return dataSource?.data?.items.filter(row => selection.isSelected(unwrapNavigable(row))).length ?? 0;
3730
+ }
3731
+ function isAllVisibleSelected(selection, dataSource) {
3732
+ const visibleSelections = getVisibleSelections(selection, dataSource);
3733
+ return visibleSelections > 0 && visibleSelections === getNumberRows(dataSource);
3734
+ }
3735
+ function isPartiallyVisibleSelected(selection, dataSource) {
3736
+ const visibleSelections = getVisibleSelections(selection, dataSource);
3737
+ return visibleSelections > 0 && visibleSelections < getNumberRows(dataSource);
3738
+ }
3739
+ function selectVisible(selection, dataSource) {
3740
+ dataSource?.data?.items.forEach(row => {
3741
+ const unwrapped = unwrapNavigable(row);
3742
+ if (unwrapped.id) {
3743
+ selection.select(unwrapped);
3744
+ }
3745
+ });
3746
+ }
3747
+ function unselectVisible(selection, dataSource) {
3748
+ dataSource?.data?.items.forEach(row => {
3749
+ selection.deselect(unwrapNavigable(row));
3750
+ });
3751
+ }
3752
+ function masterToggleVisible(selection, dataSource) {
3753
+ if (isAllVisibleSelected(selection, dataSource)) {
3754
+ unselectVisible(selection, dataSource);
3755
+ }
3756
+ else {
3757
+ selectVisible(selection, dataSource);
3758
+ }
3759
+ }
3725
3760
  /**
3726
3761
  * This class helps managing a list of paginated items that can be filtered,
3727
3762
  * selected, and then bulk actions can be performed on selection.
@@ -3790,7 +3825,7 @@ class NaturalAbstractList extends NaturalAbstractPanel {
3790
3825
  /**
3791
3826
  * List of page sizes
3792
3827
  */
3793
- pageSizeOptions = [5, 10, 25, 50, 100, 200];
3828
+ pageSizeOptions = [5, 25, 50, 100, 200];
3794
3829
  /**
3795
3830
  * Initial pagination setup
3796
3831
  */
@@ -3807,6 +3842,9 @@ class NaturalAbstractList extends NaturalAbstractPanel {
3807
3842
  route = inject(ActivatedRoute);
3808
3843
  alertService = inject(NaturalAlertService);
3809
3844
  persistenceService = inject(NaturalPersistenceService);
3845
+ isAllVisibleSelected = isAllVisibleSelected;
3846
+ isPartiallyVisibleSelected = isPartiallyVisibleSelected;
3847
+ masterToggleVisible = masterToggleVisible;
3810
3848
  // eslint-disable-next-line @angular-eslint/prefer-inject
3811
3849
  constructor(service) {
3812
3850
  super();
@@ -3950,36 +3988,6 @@ class NaturalAbstractList extends NaturalAbstractPanel {
3950
3988
  }
3951
3989
  }
3952
3990
  }
3953
- /**
3954
- * Selects all rows if they are not all selected; otherwise clear selection
3955
- */
3956
- masterToggle() {
3957
- if (this.isAllSelected()) {
3958
- this.selection.clear();
3959
- }
3960
- else {
3961
- this.dataSource?.data?.items.forEach(row => {
3962
- const unwrapped = unwrapNavigable(row);
3963
- if (unwrapped.id) {
3964
- this.selection.select(unwrapped);
3965
- }
3966
- });
3967
- }
3968
- }
3969
- /**
3970
- * Whether the number of selected elements matches the total number of rows
3971
- */
3972
- isAllSelected() {
3973
- const numSelected = this.selection.selected.length;
3974
- let numRows = 0;
3975
- this.dataSource?.data?.items.forEach(row => {
3976
- const unwrapped = unwrapNavigable(row);
3977
- if (unwrapped.id) {
3978
- numRows++;
3979
- }
3980
- });
3981
- return numSelected === numRows;
3982
- }
3983
3991
  /**
3984
3992
  * Called when a bulk action is selected
3985
3993
  */
@@ -11571,5 +11579,5 @@ function graphqlQuerySigner(key) {
11571
11579
  * Generated bundle index. Do not edit.
11572
11580
  */
11573
11581
 
11574
- export { AvatarService, ColorScheme, InvalidWithValueStateMatcher$1 as InvalidWithValueStateMatcher, LOCAL_STORAGE, NATURAL_DROPDOWN_DATA, NATURAL_ICONS_CONFIG, NATURAL_PERSISTENCE_VALIDATOR, NATURAL_SEO_CONFIG, NaturalAbstractDetail, NaturalAbstractEditableList, NaturalAbstractList, NaturalAbstractModelService, NaturalAbstractNavigableList, NaturalAbstractPanel, NaturalAlertService, NaturalAvatarComponent, NaturalBackgroundDensityDirective, NaturalCapitalizePipe, NaturalColorSchemerComponent, NaturalColumnsPickerComponent, NaturalCompactColorSchemerComponent, NaturalConfirmComponent, NaturalDataSource, NaturalDebounceService, NaturalDetailHeaderComponent, NaturalDialogTriggerComponent, NaturalDropdownRef, NaturalEllipsisPipe, NaturalEnumPipe, NaturalEnumService, NaturalErrorHandler, NaturalErrorMessagePipe, NaturalFileComponent, NaturalFileDropDirective, NaturalFileSelectDirective, NaturalFileService, NaturalFixedButtonComponent, NaturalFixedButtonDetailComponent, NaturalHierarchicSelectorComponent, NaturalHierarchicSelectorDialogComponent, NaturalHierarchicSelectorDialogService, NaturalHierarchicSelectorService, NaturalHttpPrefixDirective, NaturalIconDirective, NaturalLinkMutationService, NaturalLinkableTabDirective, NaturalLoggerConfigExtra, NaturalLoggerConfigUrl, NaturalMatomoService, NaturalMemoryStorage, NaturalPanelsComponent, NaturalPanelsService, NaturalPersistenceService, NaturalQueryVariablesManager, NaturalRelationsComponent, NaturalSearchComponent, NaturalSelectComponent, NaturalSelectEnumComponent, NaturalSelectHierarchicComponent, NaturalSeoService, NaturalSidenavComponent, NaturalSidenavContainerComponent, NaturalSidenavContentComponent, NaturalSidenavService, NaturalSidenavStackService, NaturalSrcDensityDirective, NaturalStampComponent, NaturalSwissParsingDateAdapter, NaturalTableButtonComponent, NaturalThemeChangerComponent, NaturalThemeService, NaturalTimeAgoPipe, NetworkActivityService, PanelsHooksConfig, SESSION_STORAGE, SortingOrder, TypeBooleanComponent, TypeDateComponent, TypeDateRangeComponent, TypeHierarchicSelectorComponent, TypeNaturalSelectComponent, TypeNumberComponent, TypeOptionsComponent, TypeSelectComponent, TypeTextComponent, TypedMatCellDef, activityInterceptor, available, cancellableTimeout, cloneDeepButSkipFile, collectErrors, commonImageMimeTypes, copyToClipboard, createHttpLink, debug, decimal, deepFreeze, deliverableEmail, ensureHttpPrefix, fallbackIfNoOpenedPanels, formatIsoDate, formatIsoDateTime, fromUrl, getForegroundColor, graphqlQuerySigner, greaterThan, hasFilesAndProcessDate, ifValid, integer, isFile, localStorageFactory, localStorageProvider, makePlural, memoryLocalStorageProvider, memorySessionStorageProvider, mergeOverrideArray, money, naturalPanelsUrlMatcher, naturalProviders, nfcCardHex, onHistoryEvent, possibleComparableOperators, possibleNullComparableOperators, provideErrorHandler, provideIcons, providePanels, provideSeo, provideThemes, relationsToIds, replaceObjectKeepingReference, replaceOperatorByField, replaceOperatorByName, rgbToHex, sessionStorageFactory, sessionStorageProvider, time, toGraphQLDoctrineFilter, toNavigationParameters, toUrl, unique, upperCaseFirstLetter, url, urlPattern, validTlds, validateAllFormControls, validateColumns, validatePagination, validateSorting, wrapLike, wrapPrefix, wrapSuffix };
11582
+ export { AvatarService, ColorScheme, InvalidWithValueStateMatcher$1 as InvalidWithValueStateMatcher, LOCAL_STORAGE, NATURAL_DROPDOWN_DATA, NATURAL_ICONS_CONFIG, NATURAL_PERSISTENCE_VALIDATOR, NATURAL_SEO_CONFIG, NaturalAbstractDetail, NaturalAbstractEditableList, NaturalAbstractList, NaturalAbstractModelService, NaturalAbstractNavigableList, NaturalAbstractPanel, NaturalAlertService, NaturalAvatarComponent, NaturalBackgroundDensityDirective, NaturalCapitalizePipe, NaturalColorSchemerComponent, NaturalColumnsPickerComponent, NaturalCompactColorSchemerComponent, NaturalConfirmComponent, NaturalDataSource, NaturalDebounceService, NaturalDetailHeaderComponent, NaturalDialogTriggerComponent, NaturalDropdownRef, NaturalEllipsisPipe, NaturalEnumPipe, NaturalEnumService, NaturalErrorHandler, NaturalErrorMessagePipe, NaturalFileComponent, NaturalFileDropDirective, NaturalFileSelectDirective, NaturalFileService, NaturalFixedButtonComponent, NaturalFixedButtonDetailComponent, NaturalHierarchicSelectorComponent, NaturalHierarchicSelectorDialogComponent, NaturalHierarchicSelectorDialogService, NaturalHierarchicSelectorService, NaturalHttpPrefixDirective, NaturalIconDirective, NaturalLinkMutationService, NaturalLinkableTabDirective, NaturalLoggerConfigExtra, NaturalLoggerConfigUrl, NaturalMatomoService, NaturalMemoryStorage, NaturalPanelsComponent, NaturalPanelsService, NaturalPersistenceService, NaturalQueryVariablesManager, NaturalRelationsComponent, NaturalSearchComponent, NaturalSelectComponent, NaturalSelectEnumComponent, NaturalSelectHierarchicComponent, NaturalSeoService, NaturalSidenavComponent, NaturalSidenavContainerComponent, NaturalSidenavContentComponent, NaturalSidenavService, NaturalSidenavStackService, NaturalSrcDensityDirective, NaturalStampComponent, NaturalSwissParsingDateAdapter, NaturalTableButtonComponent, NaturalThemeChangerComponent, NaturalThemeService, NaturalTimeAgoPipe, NetworkActivityService, PanelsHooksConfig, SESSION_STORAGE, SortingOrder, TypeBooleanComponent, TypeDateComponent, TypeDateRangeComponent, TypeHierarchicSelectorComponent, TypeNaturalSelectComponent, TypeNumberComponent, TypeOptionsComponent, TypeSelectComponent, TypeTextComponent, TypedMatCellDef, activityInterceptor, available, cancellableTimeout, cloneDeepButSkipFile, collectErrors, commonImageMimeTypes, copyToClipboard, createHttpLink, debug, decimal, deepFreeze, deliverableEmail, ensureHttpPrefix, fallbackIfNoOpenedPanels, formatIsoDate, formatIsoDateTime, fromUrl, getForegroundColor, getNumberRows, getVisibleSelections, graphqlQuerySigner, greaterThan, hasFilesAndProcessDate, ifValid, integer, isAllVisibleSelected, isFile, isPartiallyVisibleSelected, localStorageFactory, localStorageProvider, makePlural, masterToggleVisible, memoryLocalStorageProvider, memorySessionStorageProvider, mergeOverrideArray, money, naturalPanelsUrlMatcher, naturalProviders, nfcCardHex, onHistoryEvent, possibleComparableOperators, possibleNullComparableOperators, provideErrorHandler, provideIcons, providePanels, provideSeo, provideThemes, relationsToIds, replaceObjectKeepingReference, replaceOperatorByField, replaceOperatorByName, rgbToHex, selectVisible, sessionStorageFactory, sessionStorageProvider, time, toGraphQLDoctrineFilter, toNavigationParameters, toUrl, unique, unselectVisible, upperCaseFirstLetter, url, urlPattern, validTlds, validateAllFormControls, validateColumns, validatePagination, validateSorting, wrapLike, wrapPrefix, wrapSuffix };
11575
11583
  //# sourceMappingURL=ecodev-natural.mjs.map