@pega/lists-core 8.0.0-build.27.14
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/LICENSE +185 -0
- package/README.md +80 -0
- package/SECURITY.md +11 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +14 -0
- package/lib/index.js.map +1 -0
- package/lib/src/core/RsCore.d.ts +37 -0
- package/lib/src/core/RsCore.d.ts.map +1 -0
- package/lib/src/core/RsCore.js +48 -0
- package/lib/src/core/RsCore.js.map +1 -0
- package/lib/src/core/RsInternal.d.ts +85 -0
- package/lib/src/core/RsInternal.d.ts.map +1 -0
- package/lib/src/core/RsInternal.js +104 -0
- package/lib/src/core/RsInternal.js.map +1 -0
- package/lib/src/core/RsProps.d.ts +52 -0
- package/lib/src/core/RsProps.d.ts.map +1 -0
- package/lib/src/core/RsProps.js +47 -0
- package/lib/src/core/RsProps.js.map +1 -0
- package/lib/src/core/RsStore.d.ts +62 -0
- package/lib/src/core/RsStore.d.ts.map +1 -0
- package/lib/src/core/RsStore.js +59 -0
- package/lib/src/core/RsStore.js.map +1 -0
- package/lib/src/core/StateResolver.d.ts +45 -0
- package/lib/src/core/StateResolver.d.ts.map +1 -0
- package/lib/src/core/StateResolver.js +276 -0
- package/lib/src/core/StateResolver.js.map +1 -0
- package/lib/src/core/a11y/BaseA11y.d.ts +161 -0
- package/lib/src/core/a11y/BaseA11y.d.ts.map +1 -0
- package/lib/src/core/a11y/BaseA11y.js +549 -0
- package/lib/src/core/a11y/BaseA11y.js.map +1 -0
- package/lib/src/core/actions/actionConstants.d.ts +77 -0
- package/lib/src/core/actions/actionConstants.d.ts.map +1 -0
- package/lib/src/core/actions/actionConstants.js +79 -0
- package/lib/src/core/actions/actionConstants.js.map +1 -0
- package/lib/src/core/actions/actions.d.ts +400 -0
- package/lib/src/core/actions/actions.d.ts.map +1 -0
- package/lib/src/core/actions/actions.js +537 -0
- package/lib/src/core/actions/actions.js.map +1 -0
- package/lib/src/core/actions/actions.types.d.ts +504 -0
- package/lib/src/core/actions/actions.types.d.ts.map +1 -0
- package/lib/src/core/actions/actions.types.js +5 -0
- package/lib/src/core/actions/actions.types.js.map +1 -0
- package/lib/src/core/config/config.d.ts +9 -0
- package/lib/src/core/config/config.d.ts.map +1 -0
- package/lib/src/core/config/config.js +93 -0
- package/lib/src/core/config/config.js.map +1 -0
- package/lib/src/core/config/filterConfig.d.ts +123 -0
- package/lib/src/core/config/filterConfig.d.ts.map +1 -0
- package/lib/src/core/config/filterConfig.js +238 -0
- package/lib/src/core/config/filterConfig.js.map +1 -0
- package/lib/src/core/constants.d.ts +146 -0
- package/lib/src/core/constants.d.ts.map +1 -0
- package/lib/src/core/constants.js +124 -0
- package/lib/src/core/constants.js.map +1 -0
- package/lib/src/core/features/featureFactory.d.ts +52 -0
- package/lib/src/core/features/featureFactory.d.ts.map +1 -0
- package/lib/src/core/features/featureFactory.js +118 -0
- package/lib/src/core/features/featureFactory.js.map +1 -0
- package/lib/src/core/features/uIFeatures/afterRender/animation.d.ts +24 -0
- package/lib/src/core/features/uIFeatures/afterRender/animation.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/afterRender/animation.js +157 -0
- package/lib/src/core/features/uIFeatures/afterRender/animation.js.map +1 -0
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.d.ts +29 -0
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.js +114 -0
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.js.map +1 -0
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.d.ts +38 -0
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.js +157 -0
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.js.map +1 -0
- package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.d.ts +16 -0
- package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.js +32 -0
- package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeight.d.ts +25 -0
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeight.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeight.js +139 -0
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeight.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeightToFitRecords.d.ts +18 -0
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeightToFitRecords.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeightToFitRecords.js +46 -0
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeightToFitRecords.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/adjustMaxHeight.d.ts +13 -0
- package/lib/src/core/features/uIFeatures/beforeRender/adjustMaxHeight.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/adjustMaxHeight.js +38 -0
- package/lib/src/core/features/uIFeatures/beforeRender/adjustMaxHeight.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/aggregation.d.ts +11 -0
- package/lib/src/core/features/uIFeatures/beforeRender/aggregation.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/aggregation.js +48 -0
- package/lib/src/core/features/uIFeatures/beforeRender/aggregation.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/animation.d.ts +25 -0
- package/lib/src/core/features/uIFeatures/beforeRender/animation.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/animation.js +106 -0
- package/lib/src/core/features/uIFeatures/beforeRender/animation.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/busyIndicator.d.ts +18 -0
- package/lib/src/core/features/uIFeatures/beforeRender/busyIndicator.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/busyIndicator.js +56 -0
- package/lib/src/core/features/uIFeatures/beforeRender/busyIndicator.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/changePersonalisation.d.ts +7 -0
- package/lib/src/core/features/uIFeatures/beforeRender/changePersonalisation.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/changePersonalisation.js +34 -0
- package/lib/src/core/features/uIFeatures/beforeRender/changePersonalisation.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnAlias.d.ts +10 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnAlias.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnAlias.js +72 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnAlias.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnDisplayMode.d.ts +9 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnDisplayMode.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnDisplayMode.js +26 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnDisplayMode.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnFormatter.d.ts +9 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnFormatter.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnFormatter.js +29 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnFormatter.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnOrder.d.ts +11 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnOrder.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnOrder.js +38 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnOrder.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnReOrder.d.ts +11 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnReOrder.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnReOrder.js +199 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnReOrder.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/index.d.ts +5 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/index.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/index.js +29 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/index.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.d.ts +14 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.js +118 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnSort.d.ts +8 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnSort.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnSort.js +25 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnSort.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnToggle.d.ts +9 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnToggle.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnToggle.js +26 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnToggle.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnVisualOrder.d.ts +12 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnVisualOrder.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnVisualOrder.js +57 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnVisualOrder.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/conditionalStyleFormat.d.ts +9 -0
- package/lib/src/core/features/uIFeatures/beforeRender/conditionalStyleFormat.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/conditionalStyleFormat.js +36 -0
- package/lib/src/core/features/uIFeatures/beforeRender/conditionalStyleFormat.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/customColumn.d.ts +9 -0
- package/lib/src/core/features/uIFeatures/beforeRender/customColumn.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/customColumn.js +70 -0
- package/lib/src/core/features/uIFeatures/beforeRender/customColumn.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/edit.d.ts +12 -0
- package/lib/src/core/features/uIFeatures/beforeRender/edit.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/edit.js +94 -0
- package/lib/src/core/features/uIFeatures/beforeRender/edit.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/errorColumn.d.ts +9 -0
- package/lib/src/core/features/uIFeatures/beforeRender/errorColumn.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/errorColumn.js +26 -0
- package/lib/src/core/features/uIFeatures/beforeRender/errorColumn.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/filter.d.ts +10 -0
- package/lib/src/core/features/uIFeatures/beforeRender/filter.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/filter.js +36 -0
- package/lib/src/core/features/uIFeatures/beforeRender/filter.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/freeze.d.ts +15 -0
- package/lib/src/core/features/uIFeatures/beforeRender/freeze.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/freeze.js +119 -0
- package/lib/src/core/features/uIFeatures/beforeRender/freeze.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/grouping.d.ts +38 -0
- package/lib/src/core/features/uIFeatures/beforeRender/grouping.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/grouping.js +451 -0
- package/lib/src/core/features/uIFeatures/beforeRender/grouping.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/groupsorting.d.ts +7 -0
- package/lib/src/core/features/uIFeatures/beforeRender/groupsorting.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/groupsorting.js +36 -0
- package/lib/src/core/features/uIFeatures/beforeRender/groupsorting.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/moveListRecords.d.ts +7 -0
- package/lib/src/core/features/uIFeatures/beforeRender/moveListRecords.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/moveListRecords.js +76 -0
- package/lib/src/core/features/uIFeatures/beforeRender/moveListRecords.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/personalization.d.ts +16 -0
- package/lib/src/core/features/uIFeatures/beforeRender/personalization.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/personalization.js +306 -0
- package/lib/src/core/features/uIFeatures/beforeRender/personalization.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.d.ts +7 -0
- package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.js +59 -0
- package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.d.ts +7 -0
- package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.js +30 -0
- package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/refresh.d.ts +15 -0
- package/lib/src/core/features/uIFeatures/beforeRender/refresh.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/refresh.js +40 -0
- package/lib/src/core/features/uIFeatures/beforeRender/refresh.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/renderHeader.d.ts +7 -0
- package/lib/src/core/features/uIFeatures/beforeRender/renderHeader.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/renderHeader.js +21 -0
- package/lib/src/core/features/uIFeatures/beforeRender/renderHeader.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/resetFetch.d.ts +7 -0
- package/lib/src/core/features/uIFeatures/beforeRender/resetFetch.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/resetFetch.js +55 -0
- package/lib/src/core/features/uIFeatures/beforeRender/resetFetch.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/resizeGroupedDragDropColumn.d.ts +7 -0
- package/lib/src/core/features/uIFeatures/beforeRender/resizeGroupedDragDropColumn.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/resizeGroupedDragDropColumn.js +24 -0
- package/lib/src/core/features/uIFeatures/beforeRender/resizeGroupedDragDropColumn.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowDragDrop.d.ts +9 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowDragDrop.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowDragDrop.js +232 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowDragDrop.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowHeight.d.ts +7 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowHeight.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowHeight.js +18 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowHeight.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowSelect.d.ts +23 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowSelect.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowSelect.js +135 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowSelect.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/scrollToTop.d.ts +14 -0
- package/lib/src/core/features/uIFeatures/beforeRender/scrollToTop.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/scrollToTop.js +36 -0
- package/lib/src/core/features/uIFeatures/beforeRender/scrollToTop.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.d.ts +19 -0
- package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.js +157 -0
- package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.d.ts +29 -0
- package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.js +214 -0
- package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/toggleHeaderIcons.d.ts +11 -0
- package/lib/src/core/features/uIFeatures/beforeRender/toggleHeaderIcons.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/toggleHeaderIcons.js +26 -0
- package/lib/src/core/features/uIFeatures/beforeRender/toggleHeaderIcons.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/toggleSelectAllCheckbox.d.ts +12 -0
- package/lib/src/core/features/uIFeatures/beforeRender/toggleSelectAllCheckbox.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/toggleSelectAllCheckbox.js +51 -0
- package/lib/src/core/features/uIFeatures/beforeRender/toggleSelectAllCheckbox.js.map +1 -0
- package/lib/src/core/features/uIFeatures/index.d.ts +55 -0
- package/lib/src/core/features/uIFeatures/index.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/index.js +95 -0
- package/lib/src/core/features/uIFeatures/index.js.map +1 -0
- package/lib/src/core/generators/ColumnGenerator.d.ts +349 -0
- package/lib/src/core/generators/ColumnGenerator.d.ts.map +1 -0
- package/lib/src/core/generators/ColumnGenerator.js +725 -0
- package/lib/src/core/generators/ColumnGenerator.js.map +1 -0
- package/lib/src/core/generators/ColumnGenerator.types.d.ts +149 -0
- package/lib/src/core/generators/ColumnGenerator.types.d.ts.map +1 -0
- package/lib/src/core/generators/ColumnGenerator.types.js +2 -0
- package/lib/src/core/generators/ColumnGenerator.types.js.map +1 -0
- package/lib/src/core/generators/GroupGenerator.d.ts +59 -0
- package/lib/src/core/generators/GroupGenerator.d.ts.map +1 -0
- package/lib/src/core/generators/GroupGenerator.js +64 -0
- package/lib/src/core/generators/GroupGenerator.js.map +1 -0
- package/lib/src/core/generators/RowGenerator.d.ts +97 -0
- package/lib/src/core/generators/RowGenerator.d.ts.map +1 -0
- package/lib/src/core/generators/RowGenerator.js +285 -0
- package/lib/src/core/generators/RowGenerator.js.map +1 -0
- package/lib/src/core/generators/RowGenerator.types.d.ts +95 -0
- package/lib/src/core/generators/RowGenerator.types.d.ts.map +1 -0
- package/lib/src/core/generators/RowGenerator.types.js +2 -0
- package/lib/src/core/generators/RowGenerator.types.js.map +1 -0
- package/lib/src/core/generators/ViewGenerator.d.ts +280 -0
- package/lib/src/core/generators/ViewGenerator.d.ts.map +1 -0
- package/lib/src/core/generators/ViewGenerator.js +585 -0
- package/lib/src/core/generators/ViewGenerator.js.map +1 -0
- package/lib/src/core/generators/ViewGenerator.types.d.ts +180 -0
- package/lib/src/core/generators/ViewGenerator.types.d.ts.map +1 -0
- package/lib/src/core/generators/ViewGenerator.types.js +2 -0
- package/lib/src/core/generators/ViewGenerator.types.js.map +1 -0
- package/lib/src/core/generators/__tests__/viewUtilityMockSetup.d.ts +69 -0
- package/lib/src/core/generators/__tests__/viewUtilityMockSetup.d.ts.map +1 -0
- package/lib/src/core/generators/__tests__/viewUtilityMockSetup.js +16 -0
- package/lib/src/core/generators/__tests__/viewUtilityMockSetup.js.map +1 -0
- package/lib/src/core/generators/viewUtilityMethods.d.ts +316 -0
- package/lib/src/core/generators/viewUtilityMethods.d.ts.map +1 -0
- package/lib/src/core/generators/viewUtilityMethods.js +542 -0
- package/lib/src/core/generators/viewUtilityMethods.js.map +1 -0
- package/lib/src/core/index.d.ts +7 -0
- package/lib/src/core/index.d.ts.map +1 -0
- package/lib/src/core/index.js +80 -0
- package/lib/src/core/index.js.map +1 -0
- package/lib/src/core/pubSub/events.d.ts +6 -0
- package/lib/src/core/pubSub/events.d.ts.map +1 -0
- package/lib/src/core/pubSub/events.js +6 -0
- package/lib/src/core/pubSub/events.js.map +1 -0
- package/lib/src/core/pubSub/index.d.ts +7 -0
- package/lib/src/core/pubSub/index.d.ts.map +1 -0
- package/lib/src/core/pubSub/index.js +35 -0
- package/lib/src/core/pubSub/index.js.map +1 -0
- package/lib/src/core/reducers/aggregation.d.ts +5 -0
- package/lib/src/core/reducers/aggregation.d.ts.map +1 -0
- package/lib/src/core/reducers/aggregation.js +35 -0
- package/lib/src/core/reducers/aggregation.js.map +1 -0
- package/lib/src/core/reducers/bootstrap.d.ts +5 -0
- package/lib/src/core/reducers/bootstrap.d.ts.map +1 -0
- package/lib/src/core/reducers/bootstrap.js +12 -0
- package/lib/src/core/reducers/bootstrap.js.map +1 -0
- package/lib/src/core/reducers/columnAlias.d.ts +5 -0
- package/lib/src/core/reducers/columnAlias.d.ts.map +1 -0
- package/lib/src/core/reducers/columnAlias.js +28 -0
- package/lib/src/core/reducers/columnAlias.js.map +1 -0
- package/lib/src/core/reducers/conditionalStyleFormat.d.ts +5 -0
- package/lib/src/core/reducers/conditionalStyleFormat.d.ts.map +1 -0
- package/lib/src/core/reducers/conditionalStyleFormat.js +13 -0
- package/lib/src/core/reducers/conditionalStyleFormat.js.map +1 -0
- package/lib/src/core/reducers/customColumn.d.ts +5 -0
- package/lib/src/core/reducers/customColumn.d.ts.map +1 -0
- package/lib/src/core/reducers/customColumn.js +40 -0
- package/lib/src/core/reducers/customColumn.js.map +1 -0
- package/lib/src/core/reducers/dragDrop.d.ts +6 -0
- package/lib/src/core/reducers/dragDrop.d.ts.map +1 -0
- package/lib/src/core/reducers/dragDrop.js +100 -0
- package/lib/src/core/reducers/dragDrop.js.map +1 -0
- package/lib/src/core/reducers/edit.d.ts +5 -0
- package/lib/src/core/reducers/edit.d.ts.map +1 -0
- package/lib/src/core/reducers/edit.js +65 -0
- package/lib/src/core/reducers/edit.js.map +1 -0
- package/lib/src/core/reducers/error.d.ts +69 -0
- package/lib/src/core/reducers/error.d.ts.map +1 -0
- package/lib/src/core/reducers/error.js +21 -0
- package/lib/src/core/reducers/error.js.map +1 -0
- package/lib/src/core/reducers/externalState.d.ts +5 -0
- package/lib/src/core/reducers/externalState.d.ts.map +1 -0
- package/lib/src/core/reducers/externalState.js +20 -0
- package/lib/src/core/reducers/externalState.js.map +1 -0
- package/lib/src/core/reducers/filter.d.ts +5 -0
- package/lib/src/core/reducers/filter.d.ts.map +1 -0
- package/lib/src/core/reducers/filter.js +29 -0
- package/lib/src/core/reducers/filter.js.map +1 -0
- package/lib/src/core/reducers/forceUpdate.d.ts +5 -0
- package/lib/src/core/reducers/forceUpdate.d.ts.map +1 -0
- package/lib/src/core/reducers/forceUpdate.js +25 -0
- package/lib/src/core/reducers/forceUpdate.js.map +1 -0
- package/lib/src/core/reducers/freeze.d.ts +5 -0
- package/lib/src/core/reducers/freeze.d.ts.map +1 -0
- package/lib/src/core/reducers/freeze.js +36 -0
- package/lib/src/core/reducers/freeze.js.map +1 -0
- package/lib/src/core/reducers/grouping.d.ts +5 -0
- package/lib/src/core/reducers/grouping.d.ts.map +1 -0
- package/lib/src/core/reducers/grouping.js +142 -0
- package/lib/src/core/reducers/grouping.js.map +1 -0
- package/lib/src/core/reducers/index.d.ts +5 -0
- package/lib/src/core/reducers/index.d.ts.map +1 -0
- package/lib/src/core/reducers/index.js +77 -0
- package/lib/src/core/reducers/index.js.map +1 -0
- package/lib/src/core/reducers/moveRecords.d.ts +5 -0
- package/lib/src/core/reducers/moveRecords.d.ts.map +1 -0
- package/lib/src/core/reducers/moveRecords.js +10 -0
- package/lib/src/core/reducers/moveRecords.js.map +1 -0
- package/lib/src/core/reducers/notificationsReducer.d.ts +4 -0
- package/lib/src/core/reducers/notificationsReducer.d.ts.map +1 -0
- package/lib/src/core/reducers/notificationsReducer.js +49 -0
- package/lib/src/core/reducers/notificationsReducer.js.map +1 -0
- package/lib/src/core/reducers/paginations.d.ts +5 -0
- package/lib/src/core/reducers/paginations.d.ts.map +1 -0
- package/lib/src/core/reducers/paginations.js +19 -0
- package/lib/src/core/reducers/paginations.js.map +1 -0
- package/lib/src/core/reducers/personalizationDirtyReducer.d.ts +5 -0
- package/lib/src/core/reducers/personalizationDirtyReducer.d.ts.map +1 -0
- package/lib/src/core/reducers/personalizationDirtyReducer.js +46 -0
- package/lib/src/core/reducers/personalizationDirtyReducer.js.map +1 -0
- package/lib/src/core/reducers/personalizationReducer.d.ts +5 -0
- package/lib/src/core/reducers/personalizationReducer.d.ts.map +1 -0
- package/lib/src/core/reducers/personalizationReducer.js +238 -0
- package/lib/src/core/reducers/personalizationReducer.js.map +1 -0
- package/lib/src/core/reducers/refresh.d.ts +5 -0
- package/lib/src/core/reducers/refresh.d.ts.map +1 -0
- package/lib/src/core/reducers/refresh.js +16 -0
- package/lib/src/core/reducers/refresh.js.map +1 -0
- package/lib/src/core/reducers/renderFormatter.d.ts +5 -0
- package/lib/src/core/reducers/renderFormatter.d.ts.map +1 -0
- package/lib/src/core/reducers/renderFormatter.js +22 -0
- package/lib/src/core/reducers/renderFormatter.js.map +1 -0
- package/lib/src/core/reducers/resize.d.ts +5 -0
- package/lib/src/core/reducers/resize.d.ts.map +1 -0
- package/lib/src/core/reducers/resize.js +32 -0
- package/lib/src/core/reducers/resize.js.map +1 -0
- package/lib/src/core/reducers/rowSelect.d.ts +5 -0
- package/lib/src/core/reducers/rowSelect.d.ts.map +1 -0
- package/lib/src/core/reducers/rowSelect.js +86 -0
- package/lib/src/core/reducers/rowSelect.js.map +1 -0
- package/lib/src/core/reducers/sanitize.d.ts +5 -0
- package/lib/src/core/reducers/sanitize.d.ts.map +1 -0
- package/lib/src/core/reducers/sanitize.js +21 -0
- package/lib/src/core/reducers/sanitize.js.map +1 -0
- package/lib/src/core/reducers/search.d.ts +5 -0
- package/lib/src/core/reducers/search.d.ts.map +1 -0
- package/lib/src/core/reducers/search.js +13 -0
- package/lib/src/core/reducers/search.js.map +1 -0
- package/lib/src/core/reducers/showHeaderIcons.d.ts +5 -0
- package/lib/src/core/reducers/showHeaderIcons.d.ts.map +1 -0
- package/lib/src/core/reducers/showHeaderIcons.js +13 -0
- package/lib/src/core/reducers/showHeaderIcons.js.map +1 -0
- package/lib/src/core/reducers/smallScreen.d.ts +5 -0
- package/lib/src/core/reducers/smallScreen.d.ts.map +1 -0
- package/lib/src/core/reducers/smallScreen.js +22 -0
- package/lib/src/core/reducers/smallScreen.js.map +1 -0
- package/lib/src/core/reducers/sort.d.ts +5 -0
- package/lib/src/core/reducers/sort.d.ts.map +1 -0
- package/lib/src/core/reducers/sort.js +71 -0
- package/lib/src/core/reducers/sort.js.map +1 -0
- package/lib/src/core/reducers/versioning/index.d.ts +16 -0
- package/lib/src/core/reducers/versioning/index.d.ts.map +1 -0
- package/lib/src/core/reducers/versioning/index.js +46 -0
- package/lib/src/core/reducers/versioning/index.js.map +1 -0
- package/lib/src/core/reducers/versioning/v1.d.ts +136 -0
- package/lib/src/core/reducers/versioning/v1.d.ts.map +1 -0
- package/lib/src/core/reducers/versioning/v1.js +156 -0
- package/lib/src/core/reducers/versioning/v1.js.map +1 -0
- package/lib/src/core/reducers/visibility.d.ts +5 -0
- package/lib/src/core/reducers/visibility.d.ts.map +1 -0
- package/lib/src/core/reducers/visibility.js +49 -0
- package/lib/src/core/reducers/visibility.js.map +1 -0
- package/lib/src/core/test/junitMocks.d.ts +756 -0
- package/lib/src/core/test/junitMocks.d.ts.map +1 -0
- package/lib/src/core/test/junitMocks.js +2923 -0
- package/lib/src/core/test/junitMocks.js.map +1 -0
- package/lib/src/core/test/samples/a11ySample.d.ts +8 -0
- package/lib/src/core/test/samples/a11ySample.d.ts.map +1 -0
- package/lib/src/core/test/samples/a11ySample.js +1131 -0
- package/lib/src/core/test/samples/a11ySample.js.map +1 -0
- package/lib/src/core/test/samples/a11ySampleWithLoaders.d.ts +8 -0
- package/lib/src/core/test/samples/a11ySampleWithLoaders.d.ts.map +1 -0
- package/lib/src/core/test/samples/a11ySampleWithLoaders.js +1134 -0
- package/lib/src/core/test/samples/a11ySampleWithLoaders.js.map +1 -0
- package/lib/src/core/test/samples/utils.d.ts +2 -0
- package/lib/src/core/test/samples/utils.d.ts.map +1 -0
- package/lib/src/core/test/samples/utils.js +9 -0
- package/lib/src/core/test/samples/utils.js.map +1 -0
- package/lib/src/core/test/utils/rowDragDropUtils.d.ts +20 -0
- package/lib/src/core/test/utils/rowDragDropUtils.d.ts.map +1 -0
- package/lib/src/core/test/utils/rowDragDropUtils.js +98 -0
- package/lib/src/core/test/utils/rowDragDropUtils.js.map +1 -0
- package/lib/src/core/utils/condition-utils.d.ts +15 -0
- package/lib/src/core/utils/condition-utils.d.ts.map +1 -0
- package/lib/src/core/utils/condition-utils.js +114 -0
- package/lib/src/core/utils/condition-utils.js.map +1 -0
- package/lib/src/core/utils/util.d.ts +380 -0
- package/lib/src/core/utils/util.d.ts.map +1 -0
- package/lib/src/core/utils/util.js +912 -0
- package/lib/src/core/utils/util.js.map +1 -0
- package/lib/src/core/utils/util.types.d.ts +43 -0
- package/lib/src/core/utils/util.types.d.ts.map +1 -0
- package/lib/src/core/utils/util.types.js +2 -0
- package/lib/src/core/utils/util.types.js.map +1 -0
- package/lib/types/ApiContext.types.d.ts +392 -0
- package/lib/types/ApiContext.types.d.ts.map +1 -0
- package/lib/types/ApiContext.types.js +2 -0
- package/lib/types/ApiContext.types.js.map +1 -0
- package/lib/types/Meta.types.d.ts +705 -0
- package/lib/types/Meta.types.d.ts.map +1 -0
- package/lib/types/Meta.types.js +37 -0
- package/lib/types/Meta.types.js.map +1 -0
- package/lib/types/RsCoreBootArgs.types.d.ts +103 -0
- package/lib/types/RsCoreBootArgs.types.d.ts.map +1 -0
- package/lib/types/RsCoreBootArgs.types.js +2 -0
- package/lib/types/RsCoreBootArgs.types.js.map +1 -0
- package/lib/types/State.types.d.ts +374 -0
- package/lib/types/State.types.d.ts.map +1 -0
- package/lib/types/State.types.js +5 -0
- package/lib/types/State.types.js.map +1 -0
- package/lib/types.d.ts +30 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { State } from 'packages/lists-rs-core/types/State.types';
|
|
2
|
+
import type View from '../generators/ViewGenerator';
|
|
3
|
+
import type RsInternal from '../RsInternal';
|
|
4
|
+
import type RsProps from '../RsProps';
|
|
5
|
+
import type StateResolver from '../StateResolver';
|
|
6
|
+
import type RsStore from '../RsStore';
|
|
7
|
+
import type { Action } from '../actions/actions.types';
|
|
8
|
+
export type FeatureProps<WithQueuedActions extends boolean = false> = {
|
|
9
|
+
/** Returns reference to current {@link View} */
|
|
10
|
+
getView: () => View;
|
|
11
|
+
/** Returns reference to {@link RsStore} */
|
|
12
|
+
getRsStore: () => RsStore;
|
|
13
|
+
/** Returns reference to {@link RsProps} */
|
|
14
|
+
getRsProps: () => RsProps;
|
|
15
|
+
/** Returns reference to latest/current {@link State} */
|
|
16
|
+
getState: () => State;
|
|
17
|
+
/** Returns the stable {@link State} before the actions in the queue started executing. */
|
|
18
|
+
getOriginalState: StateResolver['getOriginalState'];
|
|
19
|
+
/** A dispatcher to dispatch RS actions. */
|
|
20
|
+
dispatch: StateResolver['dispatch'];
|
|
21
|
+
} & (WithQueuedActions extends true ? {
|
|
22
|
+
/** A queue of current actions that are dispatched. */
|
|
23
|
+
queuedActions: Action[];
|
|
24
|
+
} : {});
|
|
25
|
+
export type BeforeRenderFeatureProps = FeatureProps<true>;
|
|
26
|
+
export type MiddleWareFeatureProps = {
|
|
27
|
+
/** Reference to RsInternal object. */
|
|
28
|
+
rsInternal: RsInternal;
|
|
29
|
+
/** Returns reference to latest/current {@link State}. */
|
|
30
|
+
getState: () => State;
|
|
31
|
+
/** Returns the stable {@link State} before the actions in the queue started executing. */
|
|
32
|
+
getOriginalState: StateResolver['getOriginalState'];
|
|
33
|
+
/** A dispatcher to dispatch RS actions. */
|
|
34
|
+
dispatch: StateResolver['dispatch'];
|
|
35
|
+
/** A queue of current actions that are dispatched. */
|
|
36
|
+
queuedActions: Action[];
|
|
37
|
+
};
|
|
38
|
+
/** A feature is a function that runs based on a particular state slice change and produces immutable generator({@link View}, {@link Row}, {@link Column}) objects. It may also {@link StateResolver.dispatch dispatch} an action. */
|
|
39
|
+
export type Feature<WithQueuedActions extends boolean = false> = (rsInternal: RsInternal) => ((featureProps: FeatureProps<WithQueuedActions>) => void) | void;
|
|
40
|
+
export type UIFeatures = ReturnType<typeof getUIFeatures>;
|
|
41
|
+
declare function getUIFeatures(): {
|
|
42
|
+
beforeRender: Feature<true>[];
|
|
43
|
+
afterRender: Feature[];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Initializes and return before and after render features.
|
|
47
|
+
* @param rsInternal
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
export default function initializeFeatures(rsInternal: RsInternal): [(featureProps: MiddleWareFeatureProps) => Promise<void | null>, () => void];
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=featureFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"featureFactory.d.ts","sourceRoot":"","sources":["../../../../src/core/features/featureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,KAAK,IAAI,MAAM,6BAA6B,CAAC;AAKpD,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,aAAa,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IAAI,CAAC;AAEtE,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,iBAAS,aAAa;kBAEJ,OAAO,CAAC,IAAI,CAAC,EAAE;iBAChB,OAAO,EAAE;EA8DzB;AAuDD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,UAAU,EAAE,UAAU,GACrB,CAAC,CAAC,YAAY,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC,CAE9E"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import uiFeatures from './uIFeatures';
|
|
2
|
+
function getUIFeatures() {
|
|
3
|
+
const features = {
|
|
4
|
+
beforeRender: [],
|
|
5
|
+
afterRender: []
|
|
6
|
+
};
|
|
7
|
+
features.beforeRender.push(uiFeatures.beforeRender.scrollToTop);
|
|
8
|
+
features.beforeRender.push(uiFeatures.beforeRender.busyIndicator);
|
|
9
|
+
features.beforeRender.push(uiFeatures.beforeRender.personalization);
|
|
10
|
+
// Reset dataApi context so that new count and data could be fetched on change of personalization
|
|
11
|
+
features.beforeRender.push(uiFeatures.beforeRender.resetFetch);
|
|
12
|
+
features.beforeRender.push(uiFeatures.beforeRender.changePersonalisation);
|
|
13
|
+
features.beforeRender.push(uiFeatures.beforeRender.prepareColumns);
|
|
14
|
+
features.beforeRender.push(uiFeatures.beforeRender.columnFormatter);
|
|
15
|
+
features.beforeRender.push(uiFeatures.beforeRender.ColumnDisplayMode);
|
|
16
|
+
/* customColumn feature injects field definitions for custom fields, so stateSanitization feature should run after customColumn */
|
|
17
|
+
features.beforeRender.push(uiFeatures.beforeRender.customColumn);
|
|
18
|
+
features.beforeRender.push(uiFeatures.beforeRender.columnAlias);
|
|
19
|
+
features.beforeRender.push(uiFeatures.beforeRender.stateSanitization);
|
|
20
|
+
features.beforeRender.push(uiFeatures.beforeRender.stateHydration);
|
|
21
|
+
features.beforeRender.push(uiFeatures.beforeRender.conditionalStyleFormat);
|
|
22
|
+
features.beforeRender.push(uiFeatures.beforeRender.columnToggle);
|
|
23
|
+
// ORDER: if any feature is going to generate some markup, then it should come before columnSizing feature
|
|
24
|
+
// If reordering or moving records is enabled then rowDragDrop handler size has to be calculated and picked by column sizing
|
|
25
|
+
features.beforeRender.push(uiFeatures.beforeRender.errorColumn);
|
|
26
|
+
features.beforeRender.push(uiFeatures.beforeRender.rowDragDrop);
|
|
27
|
+
features.beforeRender.push(uiFeatures.beforeRender.columnSizing);
|
|
28
|
+
features.beforeRender.push(uiFeatures.beforeRender.adjustHeight);
|
|
29
|
+
features.beforeRender.push(uiFeatures.beforeRender.adjustMaxHeight);
|
|
30
|
+
features.beforeRender.push(uiFeatures.beforeRender.freeze);
|
|
31
|
+
// columnOrder is required for both columnVisualOrder and columnReorder feature
|
|
32
|
+
features.beforeRender.push(uiFeatures.beforeRender.columnOrder);
|
|
33
|
+
features.beforeRender.push(uiFeatures.beforeRender.columnVisualOrder);
|
|
34
|
+
// Columns header should be rendered as soon as it is available. Features making calculation on columns should be before this.
|
|
35
|
+
features.beforeRender.push(uiFeatures.beforeRender.renderHeader);
|
|
36
|
+
features.beforeRender.push(uiFeatures.beforeRender.refresh);
|
|
37
|
+
features.beforeRender.push(uiFeatures.beforeRender.rowHeight);
|
|
38
|
+
features.beforeRender.push(uiFeatures.beforeRender.animation);
|
|
39
|
+
features.beforeRender.push(uiFeatures.beforeRender.prepareRows);
|
|
40
|
+
// We have to inject this feature always as we are generating instance
|
|
41
|
+
// level data with same to avoid condition block in UI.
|
|
42
|
+
features.beforeRender.push(uiFeatures.beforeRender.grouping);
|
|
43
|
+
features.beforeRender.push(uiFeatures.beforeRender.resizeGroupedDragDropColumn);
|
|
44
|
+
features.beforeRender.push(uiFeatures.beforeRender.filter);
|
|
45
|
+
features.beforeRender.push(uiFeatures.beforeRender.columnSort);
|
|
46
|
+
features.beforeRender.push(uiFeatures.beforeRender.groupSorting);
|
|
47
|
+
features.beforeRender.push(uiFeatures.beforeRender.columnResize);
|
|
48
|
+
features.beforeRender.push(uiFeatures.beforeRender.adjustHeightToFitRecords);
|
|
49
|
+
features.beforeRender.push(uiFeatures.beforeRender.columnReOrder);
|
|
50
|
+
features.beforeRender.push(uiFeatures.beforeRender.rowSelect);
|
|
51
|
+
features.beforeRender.push(uiFeatures.beforeRender.toggleSelectAllCheckbox);
|
|
52
|
+
features.beforeRender.push(uiFeatures.beforeRender.aggregation);
|
|
53
|
+
features.beforeRender.push(uiFeatures.beforeRender.edit);
|
|
54
|
+
features.beforeRender.push(uiFeatures.beforeRender.moveRecords);
|
|
55
|
+
features.beforeRender.push(uiFeatures.beforeRender.toggleHeaderIcons);
|
|
56
|
+
features.afterRender.push(uiFeatures.afterRender.animation);
|
|
57
|
+
features.afterRender.push(uiFeatures.afterRender.columnAutoSizing);
|
|
58
|
+
features.afterRender.push(uiFeatures.afterRender.customizeParentContainer);
|
|
59
|
+
return features;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Initializes and returns before render features which run when any action is dispatched in the queue.
|
|
63
|
+
* @param rsInternal - RsInternal reference.
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
function initializeBeforeRenderFeatures(rsInternal) {
|
|
67
|
+
const features = getUIFeatures();
|
|
68
|
+
const beforeRenderUIFeatures = features.beforeRender.map(t => t(rsInternal)).filter(Boolean);
|
|
69
|
+
return (featureProps) => {
|
|
70
|
+
return beforeRenderUIFeatures.reduce(async (p, feature) => {
|
|
71
|
+
return p.then(() => {
|
|
72
|
+
if (!featureProps.rsInternal.getRsStore().isMounted)
|
|
73
|
+
return null;
|
|
74
|
+
return feature({
|
|
75
|
+
getView: featureProps.rsInternal.getView,
|
|
76
|
+
getRsStore: featureProps.rsInternal.getRsStore,
|
|
77
|
+
getRsProps: featureProps.rsInternal.getRsProps,
|
|
78
|
+
getState: featureProps.getState,
|
|
79
|
+
getOriginalState: featureProps.getOriginalState,
|
|
80
|
+
dispatch: featureProps.dispatch,
|
|
81
|
+
queuedActions: featureProps.queuedActions
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}, Promise.resolve());
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Initializes and returns after render features which run after the render is completed.
|
|
89
|
+
* @param rsInternal RsInternal reference.
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
92
|
+
function initializeAfterRenderFeatures(rsInternal) {
|
|
93
|
+
const features = getUIFeatures();
|
|
94
|
+
const afterRenderUIFeatures = features.afterRender.map(t => t(rsInternal)).filter(Boolean);
|
|
95
|
+
return () => {
|
|
96
|
+
afterRenderUIFeatures.forEach(feature => {
|
|
97
|
+
if (rsInternal.getRsStore().isMounted) {
|
|
98
|
+
feature({
|
|
99
|
+
getView: rsInternal.getView,
|
|
100
|
+
getRsStore: rsInternal.getRsStore,
|
|
101
|
+
getRsProps: rsInternal.getRsProps,
|
|
102
|
+
getState: rsInternal.getRsStateResolver().getState,
|
|
103
|
+
getOriginalState: rsInternal.getRsStateResolver().getOriginalState,
|
|
104
|
+
dispatch: rsInternal.getRsStateResolver().dispatch
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Initializes and return before and after render features.
|
|
112
|
+
* @param rsInternal
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
export default function initializeFeatures(rsInternal) {
|
|
116
|
+
return [initializeBeforeRenderFeatures(rsInternal), initializeAfterRenderFeatures(rsInternal)];
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=featureFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"featureFactory.js","sourceRoot":"","sources":["../../../../src/core/features/featureFactory.ts"],"names":[],"mappings":"AAaA,OAAO,UAAU,MAAM,cAAc,CAAC;AA6CtC,SAAS,aAAa;IACpB,MAAM,QA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AAC,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACxB,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,6BAA6B,CAAC,UAAsB;IAC3D,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,MAAM,qBAAqB,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE3F,OAAO,GAAG,EAAE;QACT,qBAAkE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACpF,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,CAAC;gBACtC,OAAO,CAAC;oBACN,OAAO,EAAE,UAAU,CAAC,OAAO;oBAC3B,UAAU,EAAE,UAAU,CAAC,UAAU;oBACjC,UAAU,EAAE,UAAU,CAAC,UAAU;oBACjC,QAAQ,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,QAAQ;oBACnD,gBAAgB,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,gBAAgB;oBACnE,QAAQ,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,QAAQ;iBACpD,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,UAAsB;IAEtB,OAAO,CAAC,8BAA8B,CAAC,UAAU,CAAC,EAAE,6BAA6B,CAAC,UAAU,CAAC,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import type { State } from 'packages/lists-rs-core/types/State.types';\n\nimport type View from '../generators/ViewGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Column from '../generators/ColumnGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Row from '../generators/RowGenerator';\nimport type RsInternal from '../RsInternal';\nimport type RsProps from '../RsProps';\nimport type StateResolver from '../StateResolver';\nimport type RsStore from '../RsStore';\nimport type { Action } from '../actions/actions.types';\n\nimport uiFeatures from './uIFeatures';\n\nexport type FeatureProps<WithQueuedActions extends boolean = false> = {\n /** Returns reference to current {@link View} */\n getView: () => View;\n /** Returns reference to {@link RsStore} */\n getRsStore: () => RsStore;\n /** Returns reference to {@link RsProps} */\n getRsProps: () => RsProps;\n /** Returns reference to latest/current {@link State} */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n} & (WithQueuedActions extends true\n ? {\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n }\n : // For better readability keeping {} rather than Record<string, never>.\n // eslint-disable-next-line @typescript-eslint/ban-types\n {});\n\nexport type BeforeRenderFeatureProps = FeatureProps<true>;\n\nexport type MiddleWareFeatureProps = {\n /** Reference to RsInternal object. */\n rsInternal: RsInternal;\n /** Returns reference to latest/current {@link State}. */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n};\n\n/** A feature is a function that runs based on a particular state slice change and produces immutable generator({@link View}, {@link Row}, {@link Column}) objects. It may also {@link StateResolver.dispatch dispatch} an action. */\nexport type Feature<WithQueuedActions extends boolean = false> = (\n rsInternal: RsInternal\n) => ((featureProps: FeatureProps<WithQueuedActions>) => void) | void;\n\nexport type UIFeatures = ReturnType<typeof getUIFeatures>;\nfunction getUIFeatures() {\n const features: {\n beforeRender: Feature<true>[];\n afterRender: Feature[];\n } = {\n beforeRender: [],\n afterRender: []\n };\n features.beforeRender.push(uiFeatures.beforeRender.scrollToTop);\n features.beforeRender.push(uiFeatures.beforeRender.busyIndicator);\n features.beforeRender.push(uiFeatures.beforeRender.personalization);\n // Reset dataApi context so that new count and data could be fetched on change of personalization\n features.beforeRender.push(uiFeatures.beforeRender.resetFetch);\n features.beforeRender.push(uiFeatures.beforeRender.changePersonalisation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareColumns);\n features.beforeRender.push(uiFeatures.beforeRender.columnFormatter);\n features.beforeRender.push(uiFeatures.beforeRender.ColumnDisplayMode);\n /* customColumn feature injects field definitions for custom fields, so stateSanitization feature should run after customColumn */\n features.beforeRender.push(uiFeatures.beforeRender.customColumn);\n features.beforeRender.push(uiFeatures.beforeRender.columnAlias);\n features.beforeRender.push(uiFeatures.beforeRender.stateSanitization);\n features.beforeRender.push(uiFeatures.beforeRender.stateHydration);\n features.beforeRender.push(uiFeatures.beforeRender.conditionalStyleFormat);\n features.beforeRender.push(uiFeatures.beforeRender.columnToggle);\n // ORDER: if any feature is going to generate some markup, then it should come before columnSizing feature\n // If reordering or moving records is enabled then rowDragDrop handler size has to be calculated and picked by column sizing\n features.beforeRender.push(uiFeatures.beforeRender.errorColumn);\n features.beforeRender.push(uiFeatures.beforeRender.rowDragDrop);\n features.beforeRender.push(uiFeatures.beforeRender.columnSizing);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeight);\n features.beforeRender.push(uiFeatures.beforeRender.adjustMaxHeight);\n features.beforeRender.push(uiFeatures.beforeRender.freeze);\n // columnOrder is required for both columnVisualOrder and columnReorder feature\n features.beforeRender.push(uiFeatures.beforeRender.columnOrder);\n features.beforeRender.push(uiFeatures.beforeRender.columnVisualOrder);\n // Columns header should be rendered as soon as it is available. Features making calculation on columns should be before this.\n features.beforeRender.push(uiFeatures.beforeRender.renderHeader);\n features.beforeRender.push(uiFeatures.beforeRender.refresh);\n features.beforeRender.push(uiFeatures.beforeRender.rowHeight);\n features.beforeRender.push(uiFeatures.beforeRender.animation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareRows);\n // We have to inject this feature always as we are generating instance\n // level data with same to avoid condition block in UI.\n\n features.beforeRender.push(uiFeatures.beforeRender.grouping);\n features.beforeRender.push(uiFeatures.beforeRender.resizeGroupedDragDropColumn);\n features.beforeRender.push(uiFeatures.beforeRender.filter);\n features.beforeRender.push(uiFeatures.beforeRender.columnSort);\n features.beforeRender.push(uiFeatures.beforeRender.groupSorting);\n features.beforeRender.push(uiFeatures.beforeRender.columnResize);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeightToFitRecords);\n\n features.beforeRender.push(uiFeatures.beforeRender.columnReOrder);\n features.beforeRender.push(uiFeatures.beforeRender.rowSelect);\n features.beforeRender.push(uiFeatures.beforeRender.toggleSelectAllCheckbox);\n features.beforeRender.push(uiFeatures.beforeRender.aggregation);\n features.beforeRender.push(uiFeatures.beforeRender.edit);\n features.beforeRender.push(uiFeatures.beforeRender.moveRecords);\n features.beforeRender.push(uiFeatures.beforeRender.toggleHeaderIcons);\n\n features.afterRender.push(uiFeatures.afterRender.animation);\n features.afterRender.push(uiFeatures.afterRender.columnAutoSizing);\n features.afterRender.push(uiFeatures.afterRender.customizeParentContainer);\n\n return features;\n}\n\n/**\n * Initializes and returns before render features which run when any action is dispatched in the queue.\n * @param rsInternal - RsInternal reference.\n * @returns\n */\nfunction initializeBeforeRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const beforeRenderUIFeatures = features.beforeRender.map(t => t(rsInternal)).filter(Boolean);\n return (featureProps: MiddleWareFeatureProps) => {\n return (beforeRenderUIFeatures as ((featureProps: BeforeRenderFeatureProps) => void)[]).reduce<\n Promise<void | null>\n >(async (p, feature) => {\n return p.then(() => {\n if (!featureProps.rsInternal.getRsStore().isMounted) return null;\n return feature({\n getView: featureProps.rsInternal.getView,\n getRsStore: featureProps.rsInternal.getRsStore,\n getRsProps: featureProps.rsInternal.getRsProps,\n getState: featureProps.getState,\n getOriginalState: featureProps.getOriginalState,\n dispatch: featureProps.dispatch,\n queuedActions: featureProps.queuedActions\n });\n });\n }, Promise.resolve());\n };\n}\n\n/**\n * Initializes and returns after render features which run after the render is completed.\n * @param rsInternal RsInternal reference.\n * @returns\n */\nfunction initializeAfterRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const afterRenderUIFeatures = features.afterRender.map(t => t(rsInternal)).filter(Boolean);\n\n return () => {\n (afterRenderUIFeatures as ((featureProps: FeatureProps) => void)[]).forEach(feature => {\n if (rsInternal.getRsStore().isMounted) {\n feature({\n getView: rsInternal.getView,\n getRsStore: rsInternal.getRsStore,\n getRsProps: rsInternal.getRsProps,\n getState: rsInternal.getRsStateResolver()!.getState,\n getOriginalState: rsInternal.getRsStateResolver()!.getOriginalState,\n dispatch: rsInternal.getRsStateResolver()!.dispatch\n });\n }\n });\n };\n}\n\n/**\n * Initializes and return before and after render features.\n * @param rsInternal\n * @returns\n */\nexport default function initializeFeatures(\n rsInternal: RsInternal\n): [(featureProps: MiddleWareFeatureProps) => Promise<void | null>, () => void] {\n return [initializeBeforeRenderFeatures(rsInternal), initializeAfterRenderFeatures(rsInternal)];\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FeatureProps } from '../../featureFactory';
|
|
2
|
+
/**
|
|
3
|
+
* Handles animations for rows and columns
|
|
4
|
+
* The animations are triggered based on changes to specific state properties:
|
|
5
|
+
*
|
|
6
|
+
* ### Row Animation Triggers
|
|
7
|
+
* - {@link State.filterExpression}
|
|
8
|
+
* - search text
|
|
9
|
+
* - {@link State.sortingOrder}
|
|
10
|
+
* - {@link State.groups}
|
|
11
|
+
* - {@link State.refresh}
|
|
12
|
+
* - {@link State.selectedHeightOption}
|
|
13
|
+
*
|
|
14
|
+
* ### Column Animation Triggers
|
|
15
|
+
* - {@link State.freezeColumns}
|
|
16
|
+
* - {@link State.colOrder}
|
|
17
|
+
* - {@link State.hiddenColumns}
|
|
18
|
+
* - {@link State.columnWidths}
|
|
19
|
+
* - {@link State.refresh}
|
|
20
|
+
* - {@link RsStore.skipColumnAnimationOnNextRun}
|
|
21
|
+
*/
|
|
22
|
+
declare const _default: () => (featureProps: FeatureProps) => void;
|
|
23
|
+
export default _default;
|
|
24
|
+
//# sourceMappingURL=animation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/afterRender/animation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AA6HzD;;;;;;;;;;;;;;;;;;;GAmBG;6CAKqC,YAAY;AAJpD,wBA8BE"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { withMemoization } from '../../../utils/util';
|
|
2
|
+
/**
|
|
3
|
+
* Triggers animation on a {@link domNode} in X and Y direction by {@link deltaX} and {@link deltaY} respectively.
|
|
4
|
+
* @param domNode - Dom node on which animation should be triggered.
|
|
5
|
+
* @param deltaX - Range of movement on X axis.
|
|
6
|
+
* @param deltaY - Range of movement on Y axis
|
|
7
|
+
* @returns void
|
|
8
|
+
*/
|
|
9
|
+
function animate(domNode, deltaX = 150, deltaY = 150) {
|
|
10
|
+
if (!domNode)
|
|
11
|
+
return;
|
|
12
|
+
if (deltaY || deltaX) {
|
|
13
|
+
requestAnimationFrame(() => {
|
|
14
|
+
// Ensure that it inverts immediately
|
|
15
|
+
domNode.style.transition = 'transform 0s';
|
|
16
|
+
// Before the DOM paints, Invert it to its old
|
|
17
|
+
domNode.style.transform = `translate3d(${deltaX}px, ${deltaY}px, 0)`;
|
|
18
|
+
requestAnimationFrame(() => {
|
|
19
|
+
domNode.style.removeProperty('transform');
|
|
20
|
+
domNode.style.removeProperty('transition');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Triggers column animation.
|
|
27
|
+
* @param featureProps - A tuple containing an object of feature props.
|
|
28
|
+
* @returns void
|
|
29
|
+
*/
|
|
30
|
+
const rowAnimation = ([{ getState, getView, getRsStore }]) => {
|
|
31
|
+
const { featuresToAvoid } = getState();
|
|
32
|
+
const rsStore = getRsStore();
|
|
33
|
+
let avoidRowAnimation = false;
|
|
34
|
+
if (featuresToAvoid?.includes('rowAnimation')) {
|
|
35
|
+
avoidRowAnimation = true;
|
|
36
|
+
}
|
|
37
|
+
// Row animation
|
|
38
|
+
if (!avoidRowAnimation && rsStore.oldBoundingBox?.size) {
|
|
39
|
+
const pNode = getView().getDomContainer();
|
|
40
|
+
const rowContainer = pNode?.querySelector('.row-container'); // row container should wrap all the rows.
|
|
41
|
+
// Calculate the bounding box
|
|
42
|
+
const newBoundingBox = new Map();
|
|
43
|
+
rowContainer?.childNodes.forEach(n => {
|
|
44
|
+
if (n.nodeType === Node.ELEMENT_NODE && n instanceof Element && n.hasAttribute?.('data-key'))
|
|
45
|
+
newBoundingBox.set(n.getAttribute('data-key'), n.getBoundingClientRect());
|
|
46
|
+
});
|
|
47
|
+
for (const [key, value] of newBoundingBox) {
|
|
48
|
+
const rowNode = rowContainer?.querySelector(`[data-key='${CSS.escape(key)}']`);
|
|
49
|
+
if (rsStore.oldBoundingBox.has(key)) {
|
|
50
|
+
// Those elements that were in the dom earlier as well
|
|
51
|
+
const deltaY = rsStore.oldBoundingBox.get(key).top - value.top;
|
|
52
|
+
const deltaX = rsStore.oldBoundingBox.get(key).left - value.left;
|
|
53
|
+
animate(rowNode, deltaX, deltaY);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// Those elements that came in now
|
|
57
|
+
animate(rowNode, 0);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
rsStore.oldBoundingBox = null;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Evaluates if column animation needs to be skipped based on {@link State.featuresToAvoid}
|
|
65
|
+
* @param featuresToAvoid
|
|
66
|
+
* @returns boolean - true if columnAnimation should be skipped otherwise false.
|
|
67
|
+
*/
|
|
68
|
+
function avoidColumnAnimation(featuresToAvoid) {
|
|
69
|
+
return featuresToAvoid?.includes('columnAnimation');
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Triggers column animation.
|
|
73
|
+
* @param featureProps - A tuple containing an object of feature props.
|
|
74
|
+
* @returns void
|
|
75
|
+
*/
|
|
76
|
+
const columnAnimation = ([{ getState, getView, getRsStore }]) => {
|
|
77
|
+
const { featuresToAvoid } = getState();
|
|
78
|
+
const rsStore = getRsStore();
|
|
79
|
+
if (rsStore.skipColumnAnimationOnNextRun) {
|
|
80
|
+
rsStore.skipColumnAnimationOnNextRun = false;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
// Column animation
|
|
84
|
+
if (!avoidColumnAnimation(featuresToAvoid) && rsStore.oldColumnBoundingBox?.size) {
|
|
85
|
+
const pNode = getView().getDomContainer();
|
|
86
|
+
// Calculate the bounding box
|
|
87
|
+
const newColBoundingBox = new Map();
|
|
88
|
+
if (getView().getItemElement()) {
|
|
89
|
+
getView()
|
|
90
|
+
.getItemElement()
|
|
91
|
+
.childNodes.forEach(cell => {
|
|
92
|
+
if (cell.nodeType === Node.ELEMENT_NODE &&
|
|
93
|
+
cell instanceof Element &&
|
|
94
|
+
cell.hasAttribute?.('data-col-id')) {
|
|
95
|
+
newColBoundingBox.set(cell.getAttribute('data-col-id'), cell.getBoundingClientRect());
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
rsStore.oldColumnBoundingBox.forEach((value, key) => {
|
|
100
|
+
if (newColBoundingBox.has(key)) {
|
|
101
|
+
const deltaX = value.left - newColBoundingBox.get(key).left;
|
|
102
|
+
const domNodes = pNode?.querySelectorAll(`[data-col-id='${key}']`);
|
|
103
|
+
if (deltaX) {
|
|
104
|
+
domNodes?.forEach(domNode => {
|
|
105
|
+
animate(domNode, deltaX, 0);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
rsStore.oldColumnBoundingBox = null;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Handles animations for rows and columns
|
|
115
|
+
* The animations are triggered based on changes to specific state properties:
|
|
116
|
+
*
|
|
117
|
+
* ### Row Animation Triggers
|
|
118
|
+
* - {@link State.filterExpression}
|
|
119
|
+
* - search text
|
|
120
|
+
* - {@link State.sortingOrder}
|
|
121
|
+
* - {@link State.groups}
|
|
122
|
+
* - {@link State.refresh}
|
|
123
|
+
* - {@link State.selectedHeightOption}
|
|
124
|
+
*
|
|
125
|
+
* ### Column Animation Triggers
|
|
126
|
+
* - {@link State.freezeColumns}
|
|
127
|
+
* - {@link State.colOrder}
|
|
128
|
+
* - {@link State.hiddenColumns}
|
|
129
|
+
* - {@link State.columnWidths}
|
|
130
|
+
* - {@link State.refresh}
|
|
131
|
+
* - {@link RsStore.skipColumnAnimationOnNextRun}
|
|
132
|
+
*/
|
|
133
|
+
export default () => {
|
|
134
|
+
const memoizedRowAnimation = withMemoization(rowAnimation);
|
|
135
|
+
const memoizedColumnAnimation = withMemoization(columnAnimation);
|
|
136
|
+
return function execute(featureProps) {
|
|
137
|
+
const state = featureProps.getState();
|
|
138
|
+
memoizedRowAnimation([featureProps], [
|
|
139
|
+
state.filterExpression,
|
|
140
|
+
// @ts-expect-error Property 'searchText' does not exist on type 'State' but exists on view.state
|
|
141
|
+
state.searchText,
|
|
142
|
+
state.sortingOrder,
|
|
143
|
+
state.groups,
|
|
144
|
+
state.refresh,
|
|
145
|
+
state.selectedHeightOption
|
|
146
|
+
]);
|
|
147
|
+
memoizedColumnAnimation([featureProps], [
|
|
148
|
+
state.freezeColumns,
|
|
149
|
+
state.colOrder,
|
|
150
|
+
state.hiddenColumns,
|
|
151
|
+
state.columnWidths,
|
|
152
|
+
state.refresh,
|
|
153
|
+
featureProps.getRsStore().skipColumnAnimationOnNextRun
|
|
154
|
+
]);
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=animation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.js","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/afterRender/animation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAMtD;;;;;;GAMG;AACH,SAAS,OAAO,CAAC,OAAoB,EAAE,MAAM,GAAG,GAAG,EAAE,MAAM,GAAG,GAAG;IAC/D,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;QACrB,qBAAqB,CAAC,GAAG,EAAE;YACzB,qCAAqC;YACrC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,cAAc,CAAC;YAC1C,8CAA8C;YAC9C,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,eAAe,MAAM,OAAO,MAAM,QAAQ,CAAC;YAErE,qBAAqB,CAAC,GAAG,EAAE;gBACzB,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;gBAC1C,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,YAAY,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,CAA+B,EAAE,EAAE;IACzF,MAAM,EAAE,eAAe,EAAE,GAAG,QAAQ,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAC9B,IAAI,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QAC9C,iBAAiB,GAAG,IAAI,CAAC;IAC3B,CAAC;IACD,gBAAgB;IAChB,IAAI,CAAC,iBAAiB,IAAI,OAAO,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC;QACvD,MAAM,KAAK,GAAG,OAAO,EAAE,CAAC,eAAe,EAA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C,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { State } from '../../../../../types/State.types';\nimport { withMemoization } from '../../../utils/util';\nimport type { FeatureProps } from '../../featureFactory';\n// Used in JsDoc.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type RsStore from '../../../RsStore';\n\n/**\n * Triggers animation on a {@link domNode} in X and Y direction by {@link deltaX} and {@link deltaY} respectively.\n * @param domNode - Dom node on which animation should be triggered.\n * @param deltaX - Range of movement on X axis.\n * @param deltaY - Range of movement on Y axis\n * @returns void\n */\nfunction animate(domNode: HTMLElement, deltaX = 150, deltaY = 150) {\n if (!domNode) return;\n if (deltaY || deltaX) {\n requestAnimationFrame(() => {\n // Ensure that it inverts immediately\n domNode.style.transition = 'transform 0s';\n // Before the DOM paints, Invert it to its old\n domNode.style.transform = `translate3d(${deltaX}px, ${deltaY}px, 0)`;\n\n requestAnimationFrame(() => {\n domNode.style.removeProperty('transform');\n domNode.style.removeProperty('transition');\n });\n });\n }\n}\n\n/**\n * Triggers column animation.\n * @param featureProps - A tuple containing an object of feature props.\n * @returns void\n */\nconst rowAnimation = ([{ getState, getView, getRsStore }]: [featureProps: FeatureProps]) => {\n const { featuresToAvoid } = getState();\n const rsStore = getRsStore();\n let avoidRowAnimation = false;\n if (featuresToAvoid?.includes('rowAnimation')) {\n avoidRowAnimation = true;\n }\n // Row animation\n if (!avoidRowAnimation && rsStore.oldBoundingBox?.size) {\n const pNode = getView().getDomContainer();\n const rowContainer = pNode?.querySelector('.row-container'); // row container should wrap all the rows.\n\n // Calculate the bounding box\n const newBoundingBox = new Map();\n rowContainer?.childNodes.forEach(n => {\n if (n.nodeType === Node.ELEMENT_NODE && n instanceof Element && n.hasAttribute?.('data-key'))\n newBoundingBox.set(n.getAttribute('data-key'), n.getBoundingClientRect());\n });\n\n for (const [key, value] of newBoundingBox) {\n const rowNode = rowContainer?.querySelector<HTMLElement>(`[data-key='${CSS.escape(key)}']`);\n if (rsStore.oldBoundingBox.has(key)) {\n // Those elements that were in the dom earlier as well\n const deltaY = rsStore.oldBoundingBox.get(key)!.top - value.top;\n const deltaX = rsStore.oldBoundingBox.get(key)!.left - value.left;\n animate(rowNode!, deltaX, deltaY);\n } else {\n // Those elements that came in now\n animate(rowNode!, 0);\n }\n }\n rsStore.oldBoundingBox = null;\n }\n};\n\n/**\n * Evaluates if column animation needs to be skipped based on {@link State.featuresToAvoid}\n * @param featuresToAvoid\n * @returns boolean - true if columnAnimation should be skipped otherwise false.\n */\nfunction avoidColumnAnimation(featuresToAvoid: State['featuresToAvoid']) {\n return featuresToAvoid?.includes('columnAnimation');\n}\n/**\n * Triggers column animation.\n * @param featureProps - A tuple containing an object of feature props.\n * @returns void\n */\nconst columnAnimation = ([{ getState, getView, getRsStore }]: [featureProps: FeatureProps]) => {\n const { featuresToAvoid } = getState();\n const rsStore = getRsStore();\n\n if (rsStore.skipColumnAnimationOnNextRun) {\n rsStore.skipColumnAnimationOnNextRun = false;\n return;\n }\n\n // Column animation\n if (!avoidColumnAnimation(featuresToAvoid) && rsStore.oldColumnBoundingBox?.size) {\n const pNode = getView().getDomContainer();\n\n // Calculate the bounding box\n const newColBoundingBox = new Map<string, DOMRect>();\n if (getView().getItemElement()) {\n getView()\n .getItemElement()!\n .childNodes.forEach(cell => {\n if (\n cell.nodeType === Node.ELEMENT_NODE &&\n cell instanceof Element &&\n cell.hasAttribute?.('data-col-id')\n ) {\n newColBoundingBox.set(cell.getAttribute('data-col-id')!, cell.getBoundingClientRect());\n }\n });\n }\n rsStore.oldColumnBoundingBox.forEach((value, key) => {\n if (newColBoundingBox.has(key)) {\n const deltaX = value.left - newColBoundingBox.get(key)!.left;\n const domNodes = pNode?.querySelectorAll<HTMLElement>(`[data-col-id='${key}']`);\n if (deltaX) {\n domNodes?.forEach(domNode => {\n animate(domNode, deltaX, 0);\n });\n }\n }\n });\n rsStore.oldColumnBoundingBox = null;\n }\n};\n\n/**\n * Handles animations for rows and columns\n * The animations are triggered based on changes to specific state properties:\n *\n * ### Row Animation Triggers\n * - {@link State.filterExpression}\n * - search text\n * - {@link State.sortingOrder}\n * - {@link State.groups}\n * - {@link State.refresh}\n * - {@link State.selectedHeightOption}\n *\n * ### Column Animation Triggers\n * - {@link State.freezeColumns}\n * - {@link State.colOrder}\n * - {@link State.hiddenColumns}\n * - {@link State.columnWidths}\n * - {@link State.refresh}\n * - {@link RsStore.skipColumnAnimationOnNextRun}\n */\nexport default () => {\n const memoizedRowAnimation = withMemoization(rowAnimation);\n const memoizedColumnAnimation = withMemoization(columnAnimation);\n\n return function execute(featureProps: FeatureProps) {\n const state = featureProps.getState();\n memoizedRowAnimation(\n [featureProps],\n [\n state.filterExpression,\n // @ts-expect-error Property 'searchText' does not exist on type 'State' but exists on view.state\n state.searchText,\n state.sortingOrder,\n state.groups,\n state.refresh,\n state.selectedHeightOption\n ]\n );\n memoizedColumnAnimation(\n [featureProps],\n [\n state.freezeColumns,\n state.colOrder,\n state.hiddenColumns,\n state.columnWidths,\n state.refresh,\n featureProps.getRsStore().skipColumnAnimationOnNextRun\n ]\n );\n };\n};\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type Column from '../../../../generators/ColumnGenerator';
|
|
2
|
+
import type View from '../../../../generators/ViewGenerator';
|
|
3
|
+
/**
|
|
4
|
+
* Calculates the width of column based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.
|
|
5
|
+
*
|
|
6
|
+
* @param column - A column object representing column in the view.
|
|
7
|
+
* @param domContainer - The HTML element that acts as the container for RS.
|
|
8
|
+
* @param forceAutoSize - A boolean flag that indicates whether to force a recalculation of column widths.
|
|
9
|
+
* @returns column width in pixels.
|
|
10
|
+
*/
|
|
11
|
+
export declare function autoSizeOfColumn(column: Column, domContainer: NonNullable<View['domContainer']>, forceAutoSize?: boolean): number;
|
|
12
|
+
/**
|
|
13
|
+
* Calculates the maximum width available in the dom container
|
|
14
|
+
* @param domContainer The HTML element that acts as the container for RS.
|
|
15
|
+
* @returns Maximum available width.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getMaxAvailableWidth(domContainer: NonNullable<View['domContainer']>): number;
|
|
18
|
+
/**
|
|
19
|
+
* Calculates the width of columns based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width..
|
|
20
|
+
*
|
|
21
|
+
* @param columns - An array of `Column` objects representing the columns in the view.
|
|
22
|
+
* @param domContainer - The HTML element that acts as the container for RS.
|
|
23
|
+
* @param reset - A boolean flag that indicates whether to force a recalculation of column widths.
|
|
24
|
+
* @returns An object containing width for each column.
|
|
25
|
+
*/
|
|
26
|
+
export declare function autoSizeOfColumns(columns: Column[], domContainer: NonNullable<View['domContainer']>, reset?: boolean): {
|
|
27
|
+
[fieldId: string]: number;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=autoSize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoSize.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/autoSize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,wCAAwC,CAAC;AACjE,OAAO,KAAK,IAAI,MAAM,sCAAsC,CAAC;AAO7D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAC/C,aAAa,UAAQ,UA0CtB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,UAmBnF;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EAAE,EACjB,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAC/C,KAAK,CAAC,EAAE,OAAO;;EA8BhB"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { rowSelectColumnMeta } from '../../../../constants';
|
|
2
|
+
import { getScrollbarWidth } from '../../../../utils/util';
|
|
3
|
+
const GROUP_ICON_WIDTH = 24;
|
|
4
|
+
/**
|
|
5
|
+
* Calculates the width of column based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.
|
|
6
|
+
*
|
|
7
|
+
* @param column - A column object representing column in the view.
|
|
8
|
+
* @param domContainer - The HTML element that acts as the container for RS.
|
|
9
|
+
* @param forceAutoSize - A boolean flag that indicates whether to force a recalculation of column widths.
|
|
10
|
+
* @returns column width in pixels.
|
|
11
|
+
*/
|
|
12
|
+
export function autoSizeOfColumn(column, domContainer, forceAutoSize = false) {
|
|
13
|
+
if (!forceAutoSize) {
|
|
14
|
+
// This will be executed in case of reset width
|
|
15
|
+
const personalizedWidth = column.getPersonalizedWidth();
|
|
16
|
+
if (personalizedWidth)
|
|
17
|
+
return personalizedWidth;
|
|
18
|
+
if (column.field.width)
|
|
19
|
+
return column.field.width;
|
|
20
|
+
}
|
|
21
|
+
// Condition for double click event triggered to autosize the column
|
|
22
|
+
/* Autosize calculations begin */
|
|
23
|
+
const cells = domContainer.querySelectorAll(`[data-col-id="${column.field.id}"]`);
|
|
24
|
+
const holder = document.createElement('div');
|
|
25
|
+
holder.style.width = '100000px'; // some very high number
|
|
26
|
+
const span = document.createElement('span');
|
|
27
|
+
holder.appendChild(span);
|
|
28
|
+
domContainer.appendChild(holder);
|
|
29
|
+
cells.forEach(cell => {
|
|
30
|
+
const row = document.createElement('div');
|
|
31
|
+
row.style.display = 'table-row';
|
|
32
|
+
cell.childNodes.forEach(child => row.appendChild(child.cloneNode(true)));
|
|
33
|
+
span.appendChild(row);
|
|
34
|
+
});
|
|
35
|
+
let autoSize = Math.ceil(span.getBoundingClientRect().width);
|
|
36
|
+
const iconsPlaceholder = domContainer.querySelector(`.header .cell[data-col-id="${column.field.id}"] .icons-ph`);
|
|
37
|
+
const groupIconPlaceholder = domContainer.querySelector(`.show-expand-collapse-all .row .cell[data-col-id="${column.field.id}"]`);
|
|
38
|
+
if (iconsPlaceholder) {
|
|
39
|
+
autoSize += iconsPlaceholder.offsetWidth;
|
|
40
|
+
}
|
|
41
|
+
if (groupIconPlaceholder) {
|
|
42
|
+
autoSize += GROUP_ICON_WIDTH;
|
|
43
|
+
}
|
|
44
|
+
domContainer.removeChild(holder);
|
|
45
|
+
// Increased spacing style width by 1px to account for offsetWidth rounding off, this was causing truncation.
|
|
46
|
+
autoSize += 17; // 17px for Spacing styles applied (Fetching applied styles is costly, so keeping some visible space)
|
|
47
|
+
// Allow columns to autosize till a restricted max width
|
|
48
|
+
return column.field.maxWidth && autoSize > column.field.maxWidth
|
|
49
|
+
? column.field.maxWidth
|
|
50
|
+
: autoSize;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Calculates the maximum width available in the dom container
|
|
54
|
+
* @param domContainer The HTML element that acts as the container for RS.
|
|
55
|
+
* @returns Maximum available width.
|
|
56
|
+
*/
|
|
57
|
+
export function getMaxAvailableWidth(domContainer) {
|
|
58
|
+
let width = domContainer.clientWidth - getScrollbarWidth();
|
|
59
|
+
const firstCell = domContainer.querySelector('.cell');
|
|
60
|
+
if (!firstCell) {
|
|
61
|
+
return width;
|
|
62
|
+
}
|
|
63
|
+
let element = firstCell.parentElement;
|
|
64
|
+
let style = null;
|
|
65
|
+
let margin = 0;
|
|
66
|
+
let padding = 0;
|
|
67
|
+
while (element !== domContainer.parentElement) {
|
|
68
|
+
// @ts-expect-error Property 'currentStyle' does not exist on type 'HTMLElement' This was used for IE browser initially. Check if it can be removed.
|
|
69
|
+
style = element.currentStyle || window.getComputedStyle(element);
|
|
70
|
+
margin = parseFloat(style.marginLeft) + parseFloat(style.marginRight);
|
|
71
|
+
padding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
|
|
72
|
+
width -= padding + margin + element.offsetWidth - element.clientWidth;
|
|
73
|
+
element = element.parentElement;
|
|
74
|
+
}
|
|
75
|
+
return width;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Calculates the width of columns based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width..
|
|
79
|
+
*
|
|
80
|
+
* @param columns - An array of `Column` objects representing the columns in the view.
|
|
81
|
+
* @param domContainer - The HTML element that acts as the container for RS.
|
|
82
|
+
* @param reset - A boolean flag that indicates whether to force a recalculation of column widths.
|
|
83
|
+
* @returns An object containing width for each column.
|
|
84
|
+
*/
|
|
85
|
+
export function autoSizeOfColumns(columns, domContainer, reset) {
|
|
86
|
+
let totalCalculatedWidth = 0;
|
|
87
|
+
const columnAutoSizes = {};
|
|
88
|
+
const remainingAvailableWidth = getMaxAvailableWidth(domContainer);
|
|
89
|
+
columns.forEach(column => {
|
|
90
|
+
if (!column.hidden) {
|
|
91
|
+
if (!(column.currentWidth && reset === undefined)) {
|
|
92
|
+
// always calculate the content based width for row selection column because it's width will change depending on if grouping is applied or not.
|
|
93
|
+
const forceAutosize = column.field.id === rowSelectColumnMeta.field.id || !reset;
|
|
94
|
+
const autoSize = autoSizeOfColumn(column, domContainer, forceAutosize);
|
|
95
|
+
columnAutoSizes[column.field.id] = autoSize;
|
|
96
|
+
totalCalculatedWidth += autoSize;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
totalCalculatedWidth += column.currentWidth;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const extraSpace = remainingAvailableWidth - totalCalculatedWidth;
|
|
104
|
+
if (extraSpace <= 0 || Number.isNaN(extraSpace))
|
|
105
|
+
return columnAutoSizes;
|
|
106
|
+
const columnToFillRemainingSpace = columns.find(c => c.field.fillAvailableSpace);
|
|
107
|
+
if (columnToFillRemainingSpace && !columnToFillRemainingSpace.hidden) {
|
|
108
|
+
columnAutoSizes[columnToFillRemainingSpace.field.id] =
|
|
109
|
+
(columnAutoSizes[columnToFillRemainingSpace.field.id] ??
|
|
110
|
+
columnToFillRemainingSpace.currentWidth) + extraSpace;
|
|
111
|
+
}
|
|
112
|
+
return columnAutoSizes;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=autoSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoSize.js","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/autoSize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAI3D,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAc,EACd,YAA+C,EAC/C,aAAa,GAAG,KAAK;IAErB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,+CAA+C;QAC/C,MAAM,iBAAiB,GAAG,MAAM,CAAC,oBAAoB,EAAE,CAAC;QACxD,IAAI,iBAAiB;YAAE,OAAO,iBAAiB,CAAC;QAChD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK;YAAE,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;IACpD,CAAC;IACD,oEAAoE;IACpE,iCAAiC;IACjC,MAAM,KAAK,GAAG,YAAY,CAAC,gBAAgB,CAAC,iBAAiB,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;IAClF,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,wBAAwB;IACzD,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACzB,YAAY,CAAC,WAAW,C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AE,CAAC;YACnB,IAAI,CAAC,CAAC,MAAM,CAAC,YAAY,IAAI,KAAK,KAAK,SAAS,CAAC,EAAE,CAAC;gBAClD,+IAA+I;gBAC/I,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,mBAAmB,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;gBACjF,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;gBACvE,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC;gBAC5C,oBAAoB,IAAI,QAAQ,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,oBAAoB,IAAI,MAAM,CAAC,YAAY,CAAC;YAC9C,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,uBAAuB,GAAG,oBAAoB,CAAC;IAClE,IAAI,UAAU,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC;QAAE,OAAO,eAAe,CAAC;IACxE,MAAM,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEjF,IAAI,0BAA0B,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,CAAC;QACrE,eAAe,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,CAAC;YAClD,CAAC,eAAe,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,CAAC;gBACnD,0BAA0B,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;IAC5D,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { ColumnResizePayload } from '../../../../actions/actions.types';\nimport { rowSelectColumnMeta } from '../../../../constants';\nimport type Column from '../../../../generators/ColumnGenerator';\nimport type View from '../../../../generators/ViewGenerator';\nimport { getScrollbarWidth } from '../../../../utils/util';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { FieldDef } from '../../../../../../types/Meta.types';\n\nconst GROUP_ICON_WIDTH = 24;\n\n/**\n * Calculates the width of column based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.\n *\n * @param column - A column object representing column in the view.\n * @param domContainer - The HTML element that acts as the container for RS.\n * @param forceAutoSize - A boolean flag that indicates whether to force a recalculation of column widths.\n * @returns column width in pixels.\n */\nexport function autoSizeOfColumn(\n column: Column,\n domContainer: NonNullable<View['domContainer']>,\n forceAutoSize = false\n) {\n if (!forceAutoSize) {\n // This will be executed in case of reset width\n const personalizedWidth = column.getPersonalizedWidth();\n if (personalizedWidth) return personalizedWidth;\n if (column.field.width) return column.field.width;\n }\n // Condition for double click event triggered to autosize the column\n /* Autosize calculations begin */\n const cells = domContainer.querySelectorAll(`[data-col-id=\"${column.field.id}\"]`);\n const holder = document.createElement('div');\n holder.style.width = '100000px'; // some very high number\n const span = document.createElement('span');\n holder.appendChild(span);\n domContainer.appendChild(holder);\n cells.forEach(cell => {\n const row = document.createElement('div');\n row.style.display = 'table-row';\n cell.childNodes.forEach(child => row.appendChild(child.cloneNode(true)));\n span.appendChild(row);\n });\n let autoSize = Math.ceil(span.getBoundingClientRect().width);\n const iconsPlaceholder = domContainer.querySelector<HTMLElement>(\n `.header .cell[data-col-id=\"${column.field.id}\"] .icons-ph`\n );\n const groupIconPlaceholder = domContainer.querySelector<HTMLElement>(\n `.show-expand-collapse-all .row .cell[data-col-id=\"${column.field.id}\"]`\n );\n if (iconsPlaceholder) {\n autoSize += iconsPlaceholder.offsetWidth;\n }\n if (groupIconPlaceholder) {\n autoSize += GROUP_ICON_WIDTH;\n }\n domContainer.removeChild(holder);\n // Increased spacing style width by 1px to account for offsetWidth rounding off, this was causing truncation.\n autoSize += 17; // 17px for Spacing styles applied (Fetching applied styles is costly, so keeping some visible space)\n // Allow columns to autosize till a restricted max width\n return column.field.maxWidth && autoSize > column.field.maxWidth\n ? column.field.maxWidth\n : autoSize;\n}\n\n/**\n * Calculates the maximum width available in the dom container\n * @param domContainer The HTML element that acts as the container for RS.\n * @returns Maximum available width.\n */\nexport function getMaxAvailableWidth(domContainer: NonNullable<View['domContainer']>) {\n let width = domContainer.clientWidth - getScrollbarWidth();\n const firstCell = domContainer.querySelector('.cell');\n if (!firstCell) {\n return width;\n }\n let element = firstCell.parentElement!;\n let style = null;\n let margin = 0;\n let padding = 0;\n while (element !== domContainer.parentElement) {\n // @ts-expect-error Property 'currentStyle' does not exist on type 'HTMLElement' This was used for IE browser initially. Check if it can be removed.\n style = element.currentStyle || window.getComputedStyle(element);\n margin = parseFloat(style.marginLeft) + parseFloat(style.marginRight);\n padding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);\n width -= padding + margin + element.offsetWidth - element.clientWidth;\n element = element.parentElement!;\n }\n return width;\n}\n\n/**\n * Calculates the width of columns based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width..\n *\n * @param columns - An array of `Column` objects representing the columns in the view.\n * @param domContainer - The HTML element that acts as the container for RS.\n * @param reset - A boolean flag that indicates whether to force a recalculation of column widths.\n * @returns An object containing width for each column.\n */\nexport function autoSizeOfColumns(\n columns: Column[],\n domContainer: NonNullable<View['domContainer']>,\n reset?: boolean\n) {\n let totalCalculatedWidth = 0;\n const columnAutoSizes: ColumnResizePayload['data'] = {};\n\n const remainingAvailableWidth = getMaxAvailableWidth(domContainer);\n\n columns.forEach(column => {\n if (!column.hidden) {\n if (!(column.currentWidth && reset === undefined)) {\n // always calculate the content based width for row selection column because it's width will change depending on if grouping is applied or not.\n const forceAutosize = column.field.id === rowSelectColumnMeta.field.id || !reset;\n const autoSize = autoSizeOfColumn(column, domContainer, forceAutosize);\n columnAutoSizes[column.field.id] = autoSize;\n totalCalculatedWidth += autoSize;\n } else {\n totalCalculatedWidth += column.currentWidth;\n }\n }\n });\n const extraSpace = remainingAvailableWidth - totalCalculatedWidth;\n if (extraSpace <= 0 || Number.isNaN(extraSpace)) return columnAutoSizes;\n const columnToFillRemainingSpace = columns.find(c => c.field.fillAvailableSpace);\n\n if (columnToFillRemainingSpace && !columnToFillRemainingSpace.hidden) {\n columnAutoSizes[columnToFillRemainingSpace.field.id] =\n (columnAutoSizes[columnToFillRemainingSpace.field.id] ??\n columnToFillRemainingSpace.currentWidth) + extraSpace;\n }\n return columnAutoSizes;\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { OmitStrict } from '@pega/cosmos-react-core';
|
|
2
|
+
import type { FeatureProps } from '../../../featureFactory';
|
|
3
|
+
/**
|
|
4
|
+
* Executes the autosizing feature on all the columns. It dispatches an action that updates {@link State.columnWidths} slice with the calculated widths for all the columns.
|
|
5
|
+
* @param param featureProps
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare function runColumnSizing([{ getState, getView, getRsStore, dispatch }]: [
|
|
9
|
+
featureProps: OmitStrict<FeatureProps, 'getOriginalState' | 'getRsProps'>
|
|
10
|
+
]): void;
|
|
11
|
+
/**
|
|
12
|
+
* Manages the autosizing feature of columns in the view. This includes the following actions:
|
|
13
|
+
* 1. **Executing Autosize for All Columns**:
|
|
14
|
+
*
|
|
15
|
+
* This action is triggered when any of the following properties change:
|
|
16
|
+
* - {@link State.personalization.active}
|
|
17
|
+
* - {@link View.rows}
|
|
18
|
+
* - {@link RsStore.autosizeTriggered}
|
|
19
|
+
* - {@link State.refresh}
|
|
20
|
+
* - {@link State.hiddenColumns}
|
|
21
|
+
* - {@link State.forceUpdateFeatures.forceCalculateAutoWidth}
|
|
22
|
+
* 2. **Resetting Autosize Status**:
|
|
23
|
+
*
|
|
24
|
+
* This action is triggered when any of the following properties change:
|
|
25
|
+
* - {@link State.personalization.active}
|
|
26
|
+
* - {@link State.refresh}
|
|
27
|
+
* - {@link State.hiddenColumns}
|
|
28
|
+
* - {@link State.customFields}
|
|
29
|
+
*
|
|
30
|
+
* 3. **Executing Autosize on Row Selection Column**:
|
|
31
|
+
*
|
|
32
|
+
* This action is triggered when any of the following properties change:
|
|
33
|
+
* - {@link State.groups}
|
|
34
|
+
* - {@link State.responsive.sm}
|
|
35
|
+
*/
|
|
36
|
+
declare const _default: () => (featureProps: FeatureProps) => void;
|
|
37
|
+
export default _default;
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAU1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAwD5D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,EAAE;IAC7E,YAAY,EAAE,UAAU,CAAC,YAAY,EAAE,kBAAkB,GAAG,YAAY,CAAC;CAC1E,QA2DA;AAWD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;6CAKqC,YAAY;AAJpD,wBAwBE"}
|