@pega/lists-core 9.0.0-build.9.9 → 9.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.
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -1
- package/lib/src/core/RsCore.d.ts +1 -1
- package/lib/src/core/RsCore.js +1 -1
- package/lib/src/core/RsCore.js.map +1 -1
- package/lib/src/core/RsInternal.d.ts +23 -0
- package/lib/src/core/RsInternal.d.ts.map +1 -1
- package/lib/src/core/RsInternal.js +18 -2
- package/lib/src/core/RsInternal.js.map +1 -1
- package/lib/src/core/RsProps.d.ts +0 -7
- package/lib/src/core/RsProps.d.ts.map +1 -1
- package/lib/src/core/RsProps.js +0 -7
- package/lib/src/core/RsProps.js.map +1 -1
- package/lib/src/core/RsStore.d.ts +5 -1
- package/lib/src/core/RsStore.d.ts.map +1 -1
- package/lib/src/core/RsStore.js +12 -0
- package/lib/src/core/RsStore.js.map +1 -1
- package/lib/src/core/StateResolver.d.ts +0 -1
- package/lib/src/core/StateResolver.d.ts.map +1 -1
- package/lib/src/core/StateResolver.js +19 -9
- package/lib/src/core/StateResolver.js.map +1 -1
- package/lib/src/core/a11y/BaseA11y.d.ts +25 -6
- package/lib/src/core/a11y/BaseA11y.d.ts.map +1 -1
- package/lib/src/core/a11y/BaseA11y.js +39 -8
- package/lib/src/core/a11y/BaseA11y.js.map +1 -1
- package/lib/src/core/actions/actionConstants.d.ts +7 -4
- package/lib/src/core/actions/actionConstants.d.ts.map +1 -1
- package/lib/src/core/actions/actionConstants.js +8 -5
- package/lib/src/core/actions/actionConstants.js.map +1 -1
- package/lib/src/core/actions/actions.d.ts +35 -34
- package/lib/src/core/actions/actions.d.ts.map +1 -1
- package/lib/src/core/actions/actions.js +47 -40
- package/lib/src/core/actions/actions.js.map +1 -1
- package/lib/src/core/actions/actions.types.d.ts +34 -27
- package/lib/src/core/actions/actions.types.d.ts.map +1 -1
- package/lib/src/core/actions/actions.types.js.map +1 -1
- package/lib/src/core/config/config.d.ts +1 -1
- package/lib/src/core/config/config.d.ts.map +1 -1
- package/lib/src/core/config/config.js +5 -2
- package/lib/src/core/config/config.js.map +1 -1
- package/lib/src/core/constants.d.ts +4 -0
- package/lib/src/core/constants.d.ts.map +1 -1
- package/lib/src/core/constants.js +22 -5
- package/lib/src/core/constants.js.map +1 -1
- package/lib/src/core/defaultTranslations.d.ts +6 -1
- package/lib/src/core/defaultTranslations.d.ts.map +1 -1
- package/lib/src/core/defaultTranslations.js +6 -1
- package/lib/src/core/defaultTranslations.js.map +1 -1
- package/lib/src/core/features/featureFactory.d.ts +6 -2
- package/lib/src/core/features/featureFactory.d.ts.map +1 -1
- package/lib/src/core/features/featureFactory.js +9 -8
- package/lib/src/core/features/featureFactory.js.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/animation.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/animation.js +11 -2
- package/lib/src/core/features/uIFeatures/afterRender/animation.js.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.d.ts +2 -16
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.js +48 -89
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.js.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.d.ts +3 -4
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.js +83 -45
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.js.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.js +2 -2
- package/lib/src/core/features/uIFeatures/afterRender/customizeParentContainer/index.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeight.d.ts +4 -1
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeight.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeight.js +15 -14
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeight.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeightToFitRecords.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeightToFitRecords.js +10 -2
- package/lib/src/core/features/uIFeatures/beforeRender/adjustHeightToFitRecords.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/aggregation.d.ts +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/aggregation.js +2 -2
- package/lib/src/core/features/uIFeatures/beforeRender/aggregation.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/animation.d.ts +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/animation.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/animation.js +5 -4
- package/lib/src/core/features/uIFeatures/beforeRender/animation.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/busyIndicator.d.ts +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/busyIndicator.js +2 -2
- package/lib/src/core/features/uIFeatures/beforeRender/busyIndicator.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/changePersonalisation.js +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/changePersonalisation.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/changeTemplate.d.ts +13 -0
- package/lib/src/core/features/uIFeatures/beforeRender/changeTemplate.d.ts.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/changeTemplate.js +40 -0
- package/lib/src/core/features/uIFeatures/beforeRender/changeTemplate.js.map +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnAlias.d.ts +2 -0
- package/lib/src/core/features/uIFeatures/beforeRender/columnAlias.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnAlias.js +14 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnAlias.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnFormatter.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnFormatter.js +7 -5
- package/lib/src/core/features/uIFeatures/beforeRender/columnFormatter.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnOrder.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnOrder.js +13 -5
- package/lib/src/core/features/uIFeatures/beforeRender/columnOrder.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnReOrder.d.ts +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnReOrder.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnReOrder.js +20 -17
- package/lib/src/core/features/uIFeatures/beforeRender/columnReOrder.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.d.ts +2 -4
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.js +61 -40
- package/lib/src/core/features/uIFeatures/beforeRender/columnSizing/resize.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnSort.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnSort.js +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnSort.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnToggle.d.ts +2 -2
- package/lib/src/core/features/uIFeatures/beforeRender/columnToggle.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnToggle.js +10 -5
- package/lib/src/core/features/uIFeatures/beforeRender/columnToggle.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnVisualOrder.d.ts +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/columnVisualOrder.js +4 -4
- package/lib/src/core/features/uIFeatures/beforeRender/columnVisualOrder.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/conditionalStyleFormat.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/conditionalStyleFormat.js +9 -8
- package/lib/src/core/features/uIFeatures/beforeRender/conditionalStyleFormat.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/customColumn.d.ts +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/customColumn.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/customColumn.js +22 -8
- package/lib/src/core/features/uIFeatures/beforeRender/customColumn.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/errorColumn.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/errorColumn.js +9 -6
- package/lib/src/core/features/uIFeatures/beforeRender/errorColumn.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/filter.d.ts +1 -0
- package/lib/src/core/features/uIFeatures/beforeRender/filter.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/filter.js +13 -3
- package/lib/src/core/features/uIFeatures/beforeRender/filter.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/freeze.d.ts +2 -2
- package/lib/src/core/features/uIFeatures/beforeRender/freeze.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/freeze.js +14 -9
- package/lib/src/core/features/uIFeatures/beforeRender/freeze.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/grouping.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/grouping.js +23 -24
- package/lib/src/core/features/uIFeatures/beforeRender/grouping.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.d.ts +32 -1
- package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.js +128 -32
- package/lib/src/core/features/uIFeatures/beforeRender/prepareColumns.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.js +4 -4
- package/lib/src/core/features/uIFeatures/beforeRender/prepareRows.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/rowDragDrop.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/rowDragDrop.js +14 -10
- package/lib/src/core/features/uIFeatures/beforeRender/rowDragDrop.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.d.ts +16 -4
- package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.js +124 -72
- package/lib/src/core/features/uIFeatures/beforeRender/stateHydration.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.d.ts +2 -2
- package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.js +116 -37
- package/lib/src/core/features/uIFeatures/beforeRender/stateSanitization.js.map +1 -1
- package/lib/src/core/features/uIFeatures/index.d.ts +2 -3
- package/lib/src/core/features/uIFeatures/index.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/index.js +2 -4
- package/lib/src/core/features/uIFeatures/index.js.map +1 -1
- package/lib/src/core/generators/ColumnGenerator.d.ts +15 -21
- package/lib/src/core/generators/ColumnGenerator.d.ts.map +1 -1
- package/lib/src/core/generators/ColumnGenerator.js +32 -95
- package/lib/src/core/generators/ColumnGenerator.js.map +1 -1
- package/lib/src/core/generators/ColumnGenerator.types.d.ts +16 -13
- package/lib/src/core/generators/ColumnGenerator.types.d.ts.map +1 -1
- package/lib/src/core/generators/ColumnGenerator.types.js.map +1 -1
- package/lib/src/core/generators/GroupGenerator.d.ts +5 -1
- package/lib/src/core/generators/GroupGenerator.d.ts.map +1 -1
- package/lib/src/core/generators/GroupGenerator.js +20 -0
- package/lib/src/core/generators/GroupGenerator.js.map +1 -1
- package/lib/src/core/generators/RowGenerator.d.ts +2 -2
- package/lib/src/core/generators/RowGenerator.d.ts.map +1 -1
- package/lib/src/core/generators/RowGenerator.js +3 -4
- package/lib/src/core/generators/RowGenerator.js.map +1 -1
- package/lib/src/core/generators/RowGenerator.types.d.ts +2 -1
- package/lib/src/core/generators/RowGenerator.types.d.ts.map +1 -1
- package/lib/src/core/generators/RowGenerator.types.js.map +1 -1
- package/lib/src/core/generators/ViewGenerator.d.ts +42 -28
- package/lib/src/core/generators/ViewGenerator.d.ts.map +1 -1
- package/lib/src/core/generators/ViewGenerator.js +101 -61
- package/lib/src/core/generators/ViewGenerator.js.map +1 -1
- package/lib/src/core/generators/ViewGenerator.types.d.ts +13 -1
- package/lib/src/core/generators/ViewGenerator.types.d.ts.map +1 -1
- package/lib/src/core/generators/ViewGenerator.types.js.map +1 -1
- package/lib/src/core/generators/__tests__/viewUtilityMockSetup.d.ts +3 -0
- package/lib/src/core/generators/__tests__/viewUtilityMockSetup.d.ts.map +1 -1
- package/lib/src/core/generators/viewUtilityMethods.d.ts +23 -10
- package/lib/src/core/generators/viewUtilityMethods.d.ts.map +1 -1
- package/lib/src/core/generators/viewUtilityMethods.js +50 -11
- package/lib/src/core/generators/viewUtilityMethods.js.map +1 -1
- package/lib/src/core/index.d.ts.map +1 -1
- package/lib/src/core/index.js +1 -2
- package/lib/src/core/index.js.map +1 -1
- package/lib/src/core/reducers/changeTemplate.d.ts +5 -0
- package/lib/src/core/reducers/changeTemplate.d.ts.map +1 -0
- package/lib/src/core/reducers/changeTemplate.js +14 -0
- package/lib/src/core/reducers/changeTemplate.js.map +1 -0
- package/lib/src/core/reducers/dragDrop.d.ts.map +1 -1
- package/lib/src/core/reducers/dragDrop.js +5 -4
- package/lib/src/core/reducers/dragDrop.js.map +1 -1
- package/lib/src/core/reducers/error.d.ts +8 -4
- package/lib/src/core/reducers/error.d.ts.map +1 -1
- package/lib/src/core/reducers/{edit.d.ts → galleryView.d.ts} +1 -1
- package/lib/src/core/reducers/galleryView.d.ts.map +1 -0
- package/lib/src/core/reducers/galleryView.js +11 -0
- package/lib/src/core/reducers/galleryView.js.map +1 -0
- package/lib/src/core/reducers/grouping.d.ts.map +1 -1
- package/lib/src/core/reducers/grouping.js +7 -0
- package/lib/src/core/reducers/grouping.js.map +1 -1
- package/lib/src/core/reducers/index.d.ts +8 -4
- package/lib/src/core/reducers/index.d.ts.map +1 -1
- package/lib/src/core/reducers/index.js +5 -3
- package/lib/src/core/reducers/index.js.map +1 -1
- package/lib/src/core/reducers/personalizationDirtyReducer.d.ts.map +1 -1
- package/lib/src/core/reducers/personalizationDirtyReducer.js +8 -4
- package/lib/src/core/reducers/personalizationDirtyReducer.js.map +1 -1
- package/lib/src/core/reducers/personalizationReducer.d.ts +3 -2
- package/lib/src/core/reducers/personalizationReducer.d.ts.map +1 -1
- package/lib/src/core/reducers/personalizationReducer.js +12 -4
- package/lib/src/core/reducers/personalizationReducer.js.map +1 -1
- package/lib/src/core/reducers/renderFormatter.d.ts.map +1 -1
- package/lib/src/core/reducers/renderFormatter.js +13 -3
- package/lib/src/core/reducers/renderFormatter.js.map +1 -1
- package/lib/src/core/reducers/rowSelect.d.ts.map +1 -1
- package/lib/src/core/reducers/rowSelect.js +0 -8
- package/lib/src/core/reducers/rowSelect.js.map +1 -1
- package/lib/src/core/reducers/versioning/index.d.ts +1 -1
- package/lib/src/core/reducers/versioning/index.d.ts.map +1 -1
- package/lib/src/core/reducers/versioning/index.js +1 -1
- package/lib/src/core/reducers/versioning/index.js.map +1 -1
- package/lib/src/core/reducers/visibility.d.ts +2 -1
- package/lib/src/core/reducers/visibility.d.ts.map +1 -1
- package/lib/src/core/reducers/visibility.js +69 -19
- package/lib/src/core/reducers/visibility.js.map +1 -1
- package/lib/src/core/test/junitMocks.d.ts +1322 -0
- package/lib/src/core/test/junitMocks.d.ts.map +1 -1
- package/lib/src/core/test/junitMocks.js +32 -51
- package/lib/src/core/test/junitMocks.js.map +1 -1
- package/lib/src/core/utils/condition-utils.d.ts +1 -1
- package/lib/src/core/utils/condition-utils.d.ts.map +1 -1
- package/lib/src/core/utils/condition-utils.js +5 -3
- package/lib/src/core/utils/condition-utils.js.map +1 -1
- package/lib/src/core/utils/util.d.ts +58 -9
- package/lib/src/core/utils/util.d.ts.map +1 -1
- package/lib/src/core/utils/util.js +151 -18
- package/lib/src/core/utils/util.js.map +1 -1
- package/lib/types/ApiContext.types.d.ts +69 -7
- package/lib/types/ApiContext.types.d.ts.map +1 -1
- package/lib/types/ApiContext.types.js.map +1 -1
- package/lib/types/Meta.types.d.ts +153 -11
- package/lib/types/Meta.types.d.ts.map +1 -1
- package/lib/types/Meta.types.js +7 -1
- package/lib/types/Meta.types.js.map +1 -1
- package/lib/types/RsCoreBootArgs.types.d.ts +11 -13
- package/lib/types/RsCoreBootArgs.types.d.ts.map +1 -1
- package/lib/types/RsCoreBootArgs.types.js.map +1 -1
- package/lib/types/State.types.d.ts +32 -30
- package/lib/types/State.types.d.ts.map +1 -1
- package/lib/types/State.types.js.map +1 -1
- package/lib/types.d.ts +10 -2
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +6 -8
- package/lib/src/core/features/uIFeatures/beforeRender/edit.d.ts +0 -12
- package/lib/src/core/features/uIFeatures/beforeRender/edit.d.ts.map +0 -1
- package/lib/src/core/features/uIFeatures/beforeRender/edit.js +0 -94
- package/lib/src/core/features/uIFeatures/beforeRender/edit.js.map +0 -1
- package/lib/src/core/features/uIFeatures/beforeRender/toggleSelectAllCheckbox.d.ts +0 -12
- package/lib/src/core/features/uIFeatures/beforeRender/toggleSelectAllCheckbox.d.ts.map +0 -1
- package/lib/src/core/features/uIFeatures/beforeRender/toggleSelectAllCheckbox.js +0 -51
- package/lib/src/core/features/uIFeatures/beforeRender/toggleSelectAllCheckbox.js.map +0 -1
- package/lib/src/core/reducers/edit.d.ts.map +0 -1
- package/lib/src/core/reducers/edit.js +0 -65
- package/lib/src/core/reducers/edit.js.map +0 -1
|
@@ -9,7 +9,7 @@ export declare const RsToCBFieldTypeMap: Record<string, FieldType>;
|
|
|
9
9
|
* @param hiddenColumns - An array of hidden columns
|
|
10
10
|
* @returns An array of hidden columns that are referenced in the condition.
|
|
11
11
|
*/
|
|
12
|
-
export declare const getHiddenColumnsReferredInCondition: (condition: Condition,
|
|
12
|
+
export declare const getHiddenColumnsReferredInCondition: (condition: Condition, visibleColumns: State["visibleColumns"]) => string[];
|
|
13
13
|
/**
|
|
14
14
|
* Evaluates whether the the `data` specified in {@link conditionConfig} satisfies the `condition`.
|
|
15
15
|
* @param meta - Repeating structures meta
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-utils.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/condition-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EAAY,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAOxD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAO/C,CAAC;
|
|
1
|
+
{"version":3,"file":"condition-utils.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/condition-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EAAY,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAOxD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAO/C,CAAC;AAyHX;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,GAC9C,WAAW,SAAS,EACpB,gBAAgB,KAAK,CAAC,gBAAgB,CAAC,KACtC,MAAM,EAIR,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,IAAI,EAAE,IAAI,EACV,eAAe,EAAE;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GACvD,OAAO,CAcT"}
|
|
@@ -85,7 +85,7 @@ function transformCondition(condition, meta, conditionBuilderFieldsConfig) {
|
|
|
85
85
|
const { conditionBuilderFields: fields, conditionBuilderFieldsTypeMap: fieldsTypeMap } = conditionBuilderFieldsConfig;
|
|
86
86
|
// cspell:ignore DDTHH
|
|
87
87
|
const currentDateTimeWithTimeZone = dayjs().tz(meta.timezone).format('YYYY-MM-DDTHH:mm:ss.SSS');
|
|
88
|
-
condition = transformComplexCondition(condition, fields, true, currentDateTimeWithTimeZone);
|
|
88
|
+
condition = transformComplexCondition(condition, fields, { transformRelativeDate: true }, currentDateTimeWithTimeZone);
|
|
89
89
|
const { logic, conditions } = splitConditionTree(condition);
|
|
90
90
|
Object.entries(conditions).forEach(([, singleCondition]) => {
|
|
91
91
|
transformConditionBasedOnType(singleCondition, fieldsTypeMap, meta);
|
|
@@ -98,9 +98,11 @@ function transformCondition(condition, meta, conditionBuilderFieldsConfig) {
|
|
|
98
98
|
* @param hiddenColumns - An array of hidden columns
|
|
99
99
|
* @returns An array of hidden columns that are referenced in the condition.
|
|
100
100
|
*/
|
|
101
|
-
export const getHiddenColumnsReferredInCondition = (condition,
|
|
101
|
+
export const getHiddenColumnsReferredInCondition = (condition, visibleColumns) => {
|
|
102
|
+
if (!visibleColumns)
|
|
103
|
+
return [];
|
|
102
104
|
const fields = getUniqueFieldsFromCondition(condition);
|
|
103
|
-
return [...fields].filter(field =>
|
|
105
|
+
return [...fields].filter(field => !visibleColumns?.includes(field));
|
|
104
106
|
};
|
|
105
107
|
/**
|
|
106
108
|
* Evaluates whether the the `data` specified in {@link conditionConfig} satisfies the `condition`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-utils.js","sourceRoot":"","sources":["../../../../src/core/utils/condition-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,GAAG,MAAM,kBAAkB,CAAC;AAEnC,OAAO,EACL,iBAAiB,IAAI,wBAAwB,EAC7C,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EAK1B,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAElB,MAAM,CAAC,MAAM,kBAAkB,GAA8B;IAC3D,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,WAAW;IACrB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;CACT,CAAC;AAEX,MAAM,+BAA+B,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAC7D,MAAM,aAAa,GAAG,GAAG,CAAC;AAO1B,SAAS,4BAA4B,CAAC,SAAoB,EAAE,eAA4B,IAAI,GAAG,EAAE;IAC/F,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;QACvB,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,4BAA4B,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC;IAClG,CAAC;SAAM,IAAI,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,SAAS,CAAC,EAAE,CAAC,OA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O,UAAU,iBAAiB,CACvC,IAAU,EACV,eAAwD;IAExD,IAAI,EAAE,SAAS,EAAE,GAAG,eAAe,CAAC;IACpC,MAAM,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;IACjC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,GAC7D,iCAAiC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAE1D,oEAAoE;IACpE,SAAS,GAAG,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE;QACxD,sBAAsB;QACtB,6BAA6B;KAC9B,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC,SAAS,EAAE,IAAI,EAAE,sBAAsB,EAAE,aAAa,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["import dayjs from 'dayjs';\nimport tZone from 'dayjs/plugin/timezone';\nimport utc from 'dayjs/plugin/utc';\n\nimport {\n evaluateCondition as evaluateConditionUtility,\n parseLogicString,\n splitConditionTree,\n transformComplexCondition,\n type Condition,\n type Field,\n type LeafCondition,\n type FieldType\n} from '@pega/cosmos-react-condition-builder';\n\nimport type { FieldDef, Meta } from '../../../types/Meta.types';\nimport type { RowData } from '../generators/RowGenerator.types';\nimport type { State } from '../../../types/State.types';\n\nimport { deepCopy } from './util';\n\ndayjs.extend(tZone);\ndayjs.extend(utc);\n\nexport const RsToCBFieldTypeMap: Record<string, FieldType> = {\n text: 'TEXT',\n number: 'DECIMAL',\n boolean: 'BOOLEAN',\n datetime: 'DATE_TIME',\n date: 'DATE_ONLY',\n time: 'TIME_ONLY'\n} as const;\n\nconst DateFunctionsWithRhsAsDateInput = ['HOURS', 'MINUTES'];\nconst DOT_DELIMITER = '.';\n\ntype ConditionBuilderFieldsConfig = {\n conditionBuilderFields: Field[];\n conditionBuilderFieldsTypeMap: Record<string, FieldType>;\n};\n\nfunction getUniqueFieldsFromCondition(condition: Condition, uniqueFields: Set<string> = new Set()) {\n if ('AND' in condition) {\n condition.AND.forEach(andCondition => getUniqueFieldsFromCondition(andCondition, uniqueFields));\n } else if ('OR' in condition) {\n condition.OR.forEach(orCondition => getUniqueFieldsFromCondition(orCondition, uniqueFields));\n } else if ('NOT' in condition) {\n getUniqueFieldsFromCondition(condition.NOT, uniqueFields);\n } else {\n const leaf = condition.condition;\n uniqueFields.add(leaf.lhs.field);\n if (leaf.rhs && 'field' in leaf.rhs) {\n uniqueFields.add(leaf.rhs.field);\n }\n }\n return uniqueFields;\n}\n\n/**\n * This api is used to transform the fields present in {@link condition} to a condition builder fields structure\n * @param condition\n * @param fieldDefs meta fieldDefs which needs to be transformed to condition builder fields structure\n * @returns condition builder fields structure\n */\nfunction getConditionBuilderFieldsContract(\n condition: Condition,\n fieldDefs: FieldDef[]\n): ConditionBuilderFieldsConfig {\n const uniqueFieldsInCondition = getUniqueFieldsFromCondition(condition);\n const fieldDefsForFieldInConditions = fieldDefs.filter(field =>\n uniqueFieldsInCondition.has(field.name)\n );\n const conditionBuilderFields = [] as Field[];\n const conditionBuilderFieldsTypeMap = {} as Record<string, FieldType>;\n\n fieldDefsForFieldInConditions.forEach(field => {\n const type = RsToCBFieldTypeMap[field.type.toLowerCase()] ?? 'TEXT';\n conditionBuilderFields.push({\n id: field.name ? field.name : field.label,\n primary: field.name ? field.name : field.label,\n type\n });\n conditionBuilderFieldsTypeMap[field.name] =\n RsToCBFieldTypeMap[field.type.toLowerCase()] ?? 'TEXT';\n });\n\n return { conditionBuilderFields, conditionBuilderFieldsTypeMap };\n}\n\nfunction transformConditionForDateTimeType(condition: LeafCondition, timezone: string) {\n const { rhs } = condition;\n\n if (!rhs || !('value' in rhs)) return;\n\n if ('dateFunction' in rhs && rhs.dateFunction === 'HOURS_OF_DAY') {\n rhs.value = Number(rhs.value).toString().padStart(2, '0');\n return;\n }\n // Adjusting the date inputs for timezone offset.\n // For dateFunctionsWithRhsAsDateInput(HOURS, MINUTES) a date input is present in rhs, so it also needs to be adjusted.\n if (!('dateFunction' in rhs) || DateFunctionsWithRhsAsDateInput.includes(rhs.dateFunction)) {\n const isoDateString = dayjs.tz(rhs.value, timezone).toISOString();\n rhs.value = isoDateString;\n }\n}\n\nfunction transformConditionBasedOnType(\n condition: LeafCondition,\n fieldTypeMap: Record<string, FieldType>,\n meta: Meta\n) {\n const {\n lhs: { field }\n } = condition;\n const type = fieldTypeMap[field];\n const { timezone } = meta;\n\n // For date time the rhs values need to be adjusted for timezone offset.\n if (type === 'DATE_TIME') {\n transformConditionForDateTimeType(condition, timezone!);\n }\n}\n\nfunction transformCondition(\n condition: Condition,\n meta: Meta,\n conditionBuilderFieldsConfig: ConditionBuilderFieldsConfig\n): Condition {\n const { conditionBuilderFields: fields, conditionBuilderFieldsTypeMap: fieldsTypeMap } =\n conditionBuilderFieldsConfig;\n // cspell:ignore DDTHH\n const currentDateTimeWithTimeZone = dayjs().tz(meta.timezone).format('YYYY-MM-DDTHH:mm:ss.SSS');\n\n condition = transformComplexCondition(condition, fields, true, currentDateTimeWithTimeZone);\n const { logic, conditions } = splitConditionTree(condition);\n\n Object.entries(conditions).forEach(([, singleCondition]) => {\n transformConditionBasedOnType(singleCondition, fieldsTypeMap, meta);\n });\n\n return (\n parseLogicString(logic, conditions) as {\n condition: Condition;\n }\n ).condition;\n}\n\n/**\n * Retrieves columns that are referenced in the given condition but are hidden.\n * @param condition - The condition\n * @param hiddenColumns - An array of hidden columns\n * @returns An array of hidden columns that are referenced in the condition.\n */\nexport const getHiddenColumnsReferredInCondition = (\n condition: Condition,\n hiddenColumns: State['hiddenColumns']\n): string[] => {\n const fields = getUniqueFieldsFromCondition(condition);\n return [...fields].filter(field => hiddenColumns?.includes(field));\n};\n\n/**\n * Evaluates whether the the `data` specified in {@link conditionConfig} satisfies the `condition`.\n * @param meta - Repeating structures meta\n * @param conditionConfig - condition config.\n * @returns true if the data satisfies condition, otherwise false.\n */\nexport default function evaluateCondition(\n meta: Meta,\n conditionConfig: { condition: Condition; data: RowData }\n): boolean {\n let { condition } = conditionConfig;\n const { data } = conditionConfig;\n const { fieldDefs } = meta;\n const { conditionBuilderFields, conditionBuilderFieldsTypeMap } =\n getConditionBuilderFieldsContract(condition, fieldDefs);\n\n // TODO: Remove this once evaluateCondition handles Timezone offset.\n condition = transformCondition(deepCopy(condition), meta, {\n conditionBuilderFields,\n conditionBuilderFieldsTypeMap\n });\n\n return evaluateConditionUtility(condition, data, conditionBuilderFields, DOT_DELIMITER);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"condition-utils.js","sourceRoot":"","sources":["../../../../src/core/utils/condition-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,GAAG,MAAM,kBAAkB,CAAC;AAEnC,OAAO,EACL,iBAAiB,IAAI,wBAAwB,EAC7C,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EAK1B,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAElB,MAAM,CAAC,MAAM,kBAAkB,GAA8B;IAC3D,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,WAAW;IACrB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;CACT,CAAC;AAEX,MAAM,+BAA+B,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAC7D,MAAM,aAAa,GAAG,GAAG,CAAC;AAO1B,SAAS,4BAA4B,CAAC,SAAoB,EAAE,eAA4B,IAAI,GAAG,EAAE;IAC/F,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;QACvB,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,EA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GAAG,4BAA4B,CAAC,SAAS,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,cAAc,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,IAAU,EACV,eAAwD;IAExD,IAAI,EAAE,SAAS,EAAE,GAAG,eAAe,CAAC;IACpC,MAAM,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;IACjC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,GAC7D,iCAAiC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAE1D,oEAAoE;IACpE,SAAS,GAAG,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE;QACxD,sBAAsB;QACtB,6BAA6B;KAC9B,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC,SAAS,EAAE,IAAI,EAAE,sBAAsB,EAAE,aAAa,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["import dayjs from 'dayjs';\nimport tZone from 'dayjs/plugin/timezone';\nimport utc from 'dayjs/plugin/utc';\n\nimport {\n evaluateCondition as evaluateConditionUtility,\n parseLogicString,\n splitConditionTree,\n transformComplexCondition,\n type Condition,\n type Field,\n type LeafCondition,\n type FieldType\n} from '@pega/cosmos-react-condition-builder';\n\nimport type { FieldDef, Meta } from '../../../types/Meta.types';\nimport type { RowData } from '../generators/RowGenerator.types';\nimport type { State } from '../../../types/State.types';\n\nimport { deepCopy } from './util';\n\ndayjs.extend(tZone);\ndayjs.extend(utc);\n\nexport const RsToCBFieldTypeMap: Record<string, FieldType> = {\n text: 'TEXT',\n number: 'DECIMAL',\n boolean: 'BOOLEAN',\n datetime: 'DATE_TIME',\n date: 'DATE_ONLY',\n time: 'TIME_ONLY'\n} as const;\n\nconst DateFunctionsWithRhsAsDateInput = ['HOURS', 'MINUTES'];\nconst DOT_DELIMITER = '.';\n\ntype ConditionBuilderFieldsConfig = {\n conditionBuilderFields: Field[];\n conditionBuilderFieldsTypeMap: Record<string, FieldType>;\n};\n\nfunction getUniqueFieldsFromCondition(condition: Condition, uniqueFields: Set<string> = new Set()) {\n if ('AND' in condition) {\n condition.AND.forEach(andCondition => getUniqueFieldsFromCondition(andCondition, uniqueFields));\n } else if ('OR' in condition) {\n condition.OR.forEach(orCondition => getUniqueFieldsFromCondition(orCondition, uniqueFields));\n } else if ('NOT' in condition) {\n getUniqueFieldsFromCondition(condition.NOT, uniqueFields);\n } else {\n const leaf = condition.condition;\n uniqueFields.add(leaf.lhs.field);\n if (leaf.rhs && 'field' in leaf.rhs) {\n uniqueFields.add(leaf.rhs.field);\n }\n }\n return uniqueFields;\n}\n\n/**\n * This api is used to transform the fields present in {@link condition} to a condition builder fields structure\n * @param condition\n * @param fieldDefs meta fieldDefs which needs to be transformed to condition builder fields structure\n * @returns condition builder fields structure\n */\nfunction getConditionBuilderFieldsContract(\n condition: Condition,\n fieldDefs: FieldDef[]\n): ConditionBuilderFieldsConfig {\n const uniqueFieldsInCondition = getUniqueFieldsFromCondition(condition);\n const fieldDefsForFieldInConditions = fieldDefs.filter(field =>\n uniqueFieldsInCondition.has(field.name)\n );\n const conditionBuilderFields = [] as Field[];\n const conditionBuilderFieldsTypeMap = {} as Record<string, FieldType>;\n\n fieldDefsForFieldInConditions.forEach(field => {\n const type = RsToCBFieldTypeMap[field.type.toLowerCase()] ?? 'TEXT';\n conditionBuilderFields.push({\n id: field.name ? field.name : field.label,\n primary: field.name ? field.name : field.label,\n type\n });\n conditionBuilderFieldsTypeMap[field.name] =\n RsToCBFieldTypeMap[field.type.toLowerCase()] ?? 'TEXT';\n });\n\n return { conditionBuilderFields, conditionBuilderFieldsTypeMap };\n}\n\nfunction transformConditionForDateTimeType(condition: LeafCondition, timezone: string) {\n const { rhs } = condition;\n\n if (!rhs || !('value' in rhs)) return;\n\n if ('dateFunction' in rhs && rhs.dateFunction === 'HOURS_OF_DAY') {\n rhs.value = Number(rhs.value).toString().padStart(2, '0');\n return;\n }\n // Adjusting the date inputs for timezone offset.\n // For dateFunctionsWithRhsAsDateInput(HOURS, MINUTES) a date input is present in rhs, so it also needs to be adjusted.\n if (!('dateFunction' in rhs) || DateFunctionsWithRhsAsDateInput.includes(rhs.dateFunction)) {\n const isoDateString = dayjs.tz(rhs.value, timezone).toISOString();\n rhs.value = isoDateString;\n }\n}\n\nfunction transformConditionBasedOnType(\n condition: LeafCondition,\n fieldTypeMap: Record<string, FieldType>,\n meta: Meta\n) {\n const {\n lhs: { field }\n } = condition;\n const type = fieldTypeMap[field];\n const { timezone } = meta;\n\n // For date time the rhs values need to be adjusted for timezone offset.\n if (type === 'DATE_TIME') {\n transformConditionForDateTimeType(condition, timezone!);\n }\n}\n\nfunction transformCondition(\n condition: Condition,\n meta: Meta,\n conditionBuilderFieldsConfig: ConditionBuilderFieldsConfig\n): Condition {\n const { conditionBuilderFields: fields, conditionBuilderFieldsTypeMap: fieldsTypeMap } =\n conditionBuilderFieldsConfig;\n // cspell:ignore DDTHH\n const currentDateTimeWithTimeZone = dayjs().tz(meta.timezone).format('YYYY-MM-DDTHH:mm:ss.SSS');\n\n condition = transformComplexCondition(\n condition,\n fields,\n { transformRelativeDate: true },\n currentDateTimeWithTimeZone\n );\n const { logic, conditions } = splitConditionTree(condition);\n\n Object.entries(conditions).forEach(([, singleCondition]) => {\n transformConditionBasedOnType(singleCondition, fieldsTypeMap, meta);\n });\n\n return (\n parseLogicString(logic, conditions) as {\n condition: Condition;\n }\n ).condition;\n}\n\n/**\n * Retrieves columns that are referenced in the given condition but are hidden.\n * @param condition - The condition\n * @param hiddenColumns - An array of hidden columns\n * @returns An array of hidden columns that are referenced in the condition.\n */\nexport const getHiddenColumnsReferredInCondition = (\n condition: Condition,\n visibleColumns: State['visibleColumns']\n): string[] => {\n if (!visibleColumns) return [];\n const fields = getUniqueFieldsFromCondition(condition);\n return [...fields].filter(field => !visibleColumns?.includes(field));\n};\n\n/**\n * Evaluates whether the the `data` specified in {@link conditionConfig} satisfies the `condition`.\n * @param meta - Repeating structures meta\n * @param conditionConfig - condition config.\n * @returns true if the data satisfies condition, otherwise false.\n */\nexport default function evaluateCondition(\n meta: Meta,\n conditionConfig: { condition: Condition; data: RowData }\n): boolean {\n let { condition } = conditionConfig;\n const { data } = conditionConfig;\n const { fieldDefs } = meta;\n const { conditionBuilderFields, conditionBuilderFieldsTypeMap } =\n getConditionBuilderFieldsContract(condition, fieldDefs);\n\n // TODO: Remove this once evaluateCondition handles Timezone offset.\n condition = transformCondition(deepCopy(condition), meta, {\n conditionBuilderFields,\n conditionBuilderFieldsTypeMap\n });\n\n return evaluateConditionUtility(condition, data, conditionBuilderFields, DOT_DELIMITER);\n}\n"]}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { type Condition, type LeafCondition } from '@pega/cosmos-react-condition-builder';
|
|
2
|
+
import { type ExcludeStrict } from '@pega/cosmos-react-core';
|
|
2
3
|
import { type ActionType } from '../actions/actionConstants';
|
|
3
4
|
import type View from '../generators/ViewGenerator';
|
|
4
5
|
import type { State, Group, Personalization } from '../../../types/State.types';
|
|
5
6
|
import type { Action, PaginationPayload } from '../actions/actions.types';
|
|
6
|
-
import type
|
|
7
|
+
import { type FieldDef, type Meta, type StyleFormat } from '../../../types/Meta.types';
|
|
7
8
|
import type { SupportedConsumerPayloads, SupportedConsumerActionType } from '../generators/viewUtilityMethods';
|
|
8
9
|
import type { DefaultConfigType } from '../config/config';
|
|
9
10
|
import type { RowData } from '../generators/RowGenerator.types';
|
|
10
11
|
import type Column from '../generators/ColumnGenerator';
|
|
11
12
|
import type RsInternal from '../RsInternal';
|
|
13
|
+
import defaultTranslations from '../defaultTranslations';
|
|
12
14
|
import type { FilterInfo, FilterInitializers, AddFilterParams, GenericObject, PassablePromise, DeepNonNullableArray, FunctionToBeMemoized, MemoizedFunction } from './util.types';
|
|
13
15
|
export declare const EXCLUDED_NUMERIC_TYPES: string[];
|
|
14
16
|
export declare const OOTB_COLUMNS: string[];
|
|
@@ -100,7 +102,7 @@ export declare function removeEmptyValues<T>(arr: T[]): DeepNonNullableArray<T>[
|
|
|
100
102
|
*
|
|
101
103
|
* @param params - The parameters for the method.
|
|
102
104
|
* @param params.filterExpression - The filter expression used to determine which fields are included. For more details, see {@link State.filterExpression}.
|
|
103
|
-
* @param
|
|
105
|
+
* @param params.comparator - An optional comparator. If provided, the function will filter fields that have this comparator in the filter expression.
|
|
104
106
|
*
|
|
105
107
|
* @returns An array of field names on which the filter is applied. If a comparator is specified, it returns only the fields that use that comparator.
|
|
106
108
|
*/
|
|
@@ -244,6 +246,7 @@ export declare const dateFunctionLabels: {
|
|
|
244
246
|
DAYS: string;
|
|
245
247
|
HOURS: string;
|
|
246
248
|
MINUTES: string;
|
|
249
|
+
SECONDS: string;
|
|
247
250
|
MONTHS_OF_YEAR: string;
|
|
248
251
|
DAYS_OF_MONTH: string;
|
|
249
252
|
DAYS_OF_WEEK: string;
|
|
@@ -292,12 +295,6 @@ export declare function hasDuplicates<T>(array?: T[]): boolean;
|
|
|
292
295
|
* - The third element is the reject function for the promise.
|
|
293
296
|
*/
|
|
294
297
|
export declare function passablePromise<T>(): PassablePromise<T>;
|
|
295
|
-
/**
|
|
296
|
-
* Logs the given {@link cleanedUpFieldIds invalid column ids} to console as warning.
|
|
297
|
-
* @param cleanedUpFieldIds invalid column ids.
|
|
298
|
-
*
|
|
299
|
-
*/
|
|
300
|
-
export declare function logInvalidFields(cleanedUpFieldIds: string[]): void;
|
|
301
298
|
/**
|
|
302
299
|
* Determines if the filter criteria has changed in the latest state compared to the previous state.
|
|
303
300
|
*
|
|
@@ -353,7 +350,7 @@ export declare function isStaleAction(action: Action, latestActions: Map<ActionT
|
|
|
353
350
|
export declare function isSignificantPaginationOverlap(latestActions: Map<ActionType, Action>, previousExecutedActionQueue: Action[]): boolean;
|
|
354
351
|
/**
|
|
355
352
|
* Returns a unique key for a given group.
|
|
356
|
-
* @param
|
|
353
|
+
* @param group
|
|
357
354
|
*/
|
|
358
355
|
export declare const getGroupKey: (group: Group) => string;
|
|
359
356
|
/**
|
|
@@ -370,6 +367,20 @@ export declare const getGroupFromKey: (groupBy: string, groups: State["groups"])
|
|
|
370
367
|
*/
|
|
371
368
|
export declare const areColumnWidthsCalculated: (columnWidths: State["columnWidths"]) => boolean;
|
|
372
369
|
export declare const isRowReorderFieldEnabled: (meta: Meta) => boolean;
|
|
370
|
+
/**
|
|
371
|
+
* Determines whether the row reorder field is visible.
|
|
372
|
+
*
|
|
373
|
+
* @param meta - View meta containing row reorder field configuration.
|
|
374
|
+
* @returns `true` if the row reorder field is visible; otherwise falls back to the deprecated `dragHandle`.
|
|
375
|
+
*/
|
|
376
|
+
export declare const isRowReorderFieldVisible: (meta: Meta) => boolean;
|
|
377
|
+
/**
|
|
378
|
+
* Determines whether the row error field is visible.
|
|
379
|
+
*
|
|
380
|
+
* @param meta - View meta containing row error field configuration.
|
|
381
|
+
* @returns `true` if the row error field is visible; otherwise falls back to the deprecated `showErrorField`.
|
|
382
|
+
*/
|
|
383
|
+
export declare const isRowErrorFieldVisible: (meta: Meta) => boolean;
|
|
373
384
|
export declare const isRowErrorFieldEnabled: (meta: Meta) => boolean;
|
|
374
385
|
/**
|
|
375
386
|
* Evaluates the style format applicable to a cell based on {@link Column.getExecutionContext current execution context} and {@link Column.conditionalStyleFormats conditionalStyleFormats}
|
|
@@ -379,5 +390,43 @@ export declare const isRowErrorFieldEnabled: (meta: Meta) => boolean;
|
|
|
379
390
|
*/
|
|
380
391
|
export declare const evaluateStyleFormatForCell: (column: Column, rsInternal: RsInternal) => StyleFormat | undefined;
|
|
381
392
|
export declare const isRowSelectFieldEnabled: (meta: Meta) => boolean;
|
|
393
|
+
export declare const isActionConfig: (action: Meta["editing"] | Meta["deleting"]) => action is NonNullable<ExcludeStrict<Meta["editing"] | Meta["deleting"], boolean>>;
|
|
394
|
+
export declare const isDeletingColumnPlacement: (meta: Meta) => boolean;
|
|
395
|
+
export declare const isRowDeleteFieldEnabled: (meta: Meta) => boolean;
|
|
396
|
+
export declare const isRowDeleteFieldVisible: (meta: Meta) => boolean;
|
|
397
|
+
export declare const isRowActionFieldEnabled: (meta: Meta) => boolean;
|
|
382
398
|
export declare const isFreezingEnabled: (meta: Meta) => boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Derives visible column IDs from fieldDefs by excluding hidden columns.
|
|
401
|
+
*
|
|
402
|
+
* @param meta - View meta containing fieldDefs.
|
|
403
|
+
* @param hiddenColumns - Array of hidden column IDs.
|
|
404
|
+
* @returns Array of visible column IDs.
|
|
405
|
+
*/
|
|
406
|
+
export declare function getVisibleColumnsFromHidden(meta: Meta, hiddenColumns: State['hiddenColumns']): string[];
|
|
407
|
+
/**
|
|
408
|
+
* Derives visible column IDs from fieldDefs where show is true.
|
|
409
|
+
*
|
|
410
|
+
* @param meta - View meta containing fieldDefs.
|
|
411
|
+
* @returns Array of visible column IDs.
|
|
412
|
+
*/
|
|
413
|
+
export declare function getVisibleColumnsFromFieldDefs(meta: Meta): string[];
|
|
414
|
+
export declare const isTranslationKey: (key: string) => key is keyof typeof defaultTranslations;
|
|
415
|
+
/**
|
|
416
|
+
* Translates a label if it is a known translation key, otherwise returns it as-is.
|
|
417
|
+
*
|
|
418
|
+
* @param label - The label string to translate.
|
|
419
|
+
* @param translate - The translation function from the RS store.
|
|
420
|
+
*/
|
|
421
|
+
export declare const translateLabel: (label: string, translate: (key: keyof typeof defaultTranslations) => string) => string;
|
|
422
|
+
/**
|
|
423
|
+
* Returns true if a column should still be created for the given fieldDef
|
|
424
|
+
* even when the field is not visible (`show = false`).
|
|
425
|
+
*
|
|
426
|
+
* This happens when the field is required by the current template configuration
|
|
427
|
+
* (e.g., Timeline, Gallery, Map) or when it is marked as a row header.
|
|
428
|
+
*
|
|
429
|
+
* TODO: Refactor, move template-field resolution into the RS layer (e.g. `useRepeat`).
|
|
430
|
+
*/
|
|
431
|
+
export declare const shouldCreateColumnForField: (meta: Meta, fieldDef: FieldDef) => boolean;
|
|
383
432
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/util.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/util.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAatE,OAAoB,EAAE,KAAK,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,IAAI,MAAM,6BAA6B,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAe,MAAM,4BAA4B,CAAC;AAC7F,OAAO,KAAK,EAAE,MAAM,EAAkB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,IAAI,EACT,KAAK,WAAW,EACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAE5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AACxD,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,mBAAmB,MAAM,wBAAwB,CAAC;AAGzD,OAAO,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ACvC,CAAC;AAE7B;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,MAAM,EACb,WAAW,CAAC,GAAG,EAAE,MAAM,OAAO,mBAAmB,KAAK,MAAM,KAC3D,MAA8D,CAAC;AAElE;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GAAI,MAAM,IAAI,EAAE,UAAU,QAAQ,KAAG,OAyC3E,CAAC"}
|
|
@@ -2,17 +2,21 @@ import fastDeepEqual from 'fast-deep-equal/es6';
|
|
|
2
2
|
import { splitConditionTree } from '@pega/cosmos-react-condition-builder';
|
|
3
3
|
import { hasProp } from '@pega/cosmos-react-core';
|
|
4
4
|
import { filterParams, comparatorMap } from '../config/filterConfig';
|
|
5
|
-
import { EXTERNAL_FILTERS, rowActionColumnMeta, rowDragDropColumnMeta, rowErrorColumnMeta, rowSelectColumnMeta, SELECTION_MODES, TEMPLATES } from '../constants';
|
|
5
|
+
import { EXTERNAL_FILTERS, rowActionColumnMeta, rowDeleteColumnMeta, rowDragDropColumnMeta, rowErrorColumnMeta, rowSelectColumnMeta, SELECTION_MODES, TEMPLATES } from '../constants';
|
|
6
6
|
import ActionTypes, {} from '../actions/actionConstants';
|
|
7
|
+
import { FieldType, REPEATING_STRUCTURE_TEMPLATES, ActionColumnPlacement } from '../../../types/Meta.types';
|
|
8
|
+
import defaultTranslations from '../defaultTranslations';
|
|
7
9
|
import evaluateConditionLocally from './condition-utils';
|
|
8
10
|
export const EXCLUDED_NUMERIC_TYPES = ['Currency'];
|
|
9
11
|
export const OOTB_COLUMNS = [
|
|
10
12
|
rowDragDropColumnMeta.field.id,
|
|
11
13
|
rowErrorColumnMeta.field.id,
|
|
12
14
|
rowActionColumnMeta.field.id,
|
|
13
|
-
rowSelectColumnMeta.field.id
|
|
15
|
+
rowSelectColumnMeta.field.id,
|
|
16
|
+
rowDeleteColumnMeta.field.id
|
|
14
17
|
];
|
|
15
18
|
const groupBySeparator = '||'; // To avoid any ambiguities
|
|
19
|
+
const UNSUPPORTED_OBJECT_TYPE_FIELD_ANALYTICAL_FEATURES = ['sort', 'filter', 'grouping'];
|
|
16
20
|
/**
|
|
17
21
|
* Creates an object mapping for each property in `propertiesArr` to a boolean flag indicating whether the feature is enabled.
|
|
18
22
|
* The flag is derived from `fieldDefs`.
|
|
@@ -214,7 +218,7 @@ export function removeEmptyValues(arr) {
|
|
|
214
218
|
*
|
|
215
219
|
* @param params - The parameters for the method.
|
|
216
220
|
* @param params.filterExpression - The filter expression used to determine which fields are included. For more details, see {@link State.filterExpression}.
|
|
217
|
-
* @param
|
|
221
|
+
* @param params.comparator - An optional comparator. If provided, the function will filter fields that have this comparator in the filter expression.
|
|
218
222
|
*
|
|
219
223
|
* @returns An array of field names on which the filter is applied. If a comparator is specified, it returns only the fields that use that comparator.
|
|
220
224
|
*/
|
|
@@ -506,6 +510,23 @@ function updateMetaSettings(meta, defaultConfig) {
|
|
|
506
510
|
}
|
|
507
511
|
});
|
|
508
512
|
}
|
|
513
|
+
const prepareDefaultFieldConfig = (defaultFieldConfig, field) => {
|
|
514
|
+
return Object.fromEntries(Object.entries(defaultFieldConfig).map(([key, value]) => {
|
|
515
|
+
// By default, sorting, filtering and grouping should be disabled for object type fields.
|
|
516
|
+
if (UNSUPPORTED_OBJECT_TYPE_FIELD_ANALYTICAL_FEATURES.includes(key)) {
|
|
517
|
+
value = field.type !== FieldType.OBJECT;
|
|
518
|
+
}
|
|
519
|
+
// By default, aggregation is supported only for number and currency type fields
|
|
520
|
+
if (key === 'aggregation') {
|
|
521
|
+
value = field.type === FieldType.NUMBER || field.type === FieldType.CURRENCY;
|
|
522
|
+
}
|
|
523
|
+
// By default, only text type fields are searchable via global search
|
|
524
|
+
if (key === 'searchable') {
|
|
525
|
+
value = field.type === FieldType.TEXT;
|
|
526
|
+
}
|
|
527
|
+
return [key, value];
|
|
528
|
+
}));
|
|
529
|
+
};
|
|
509
530
|
/**
|
|
510
531
|
* Normalizes the {@link FieldDef} with {@link defaultFieldDef defaultFieldDef config} if not already set.
|
|
511
532
|
*
|
|
@@ -554,11 +575,18 @@ export function normalizeMeta(_meta, defaultConfig) {
|
|
|
554
575
|
meta.height = { ...height };
|
|
555
576
|
meta.comparatorMap = comparatorMap;
|
|
556
577
|
meta.height.minHeight = meta.height.minHeight ?? defaultConfig.height.minHeight;
|
|
557
|
-
meta.defaultFieldDef = { ...defaultConfig.defaultFieldDef, ...meta.defaultFieldDef };
|
|
558
578
|
// Handle if fieldDefs is null or undefined
|
|
559
579
|
meta.fieldDefs = meta.fieldDefs ?? [];
|
|
560
580
|
meta.fieldDefs.forEach((column) => {
|
|
561
|
-
normalizeFieldDef(column,
|
|
581
|
+
normalizeFieldDef(column, {
|
|
582
|
+
...prepareDefaultFieldConfig(defaultConfig.defaultFieldDef, column),
|
|
583
|
+
/*
|
|
584
|
+
TODO: Deprecation - The defaultFieldDef in meta is no longer necessary and is not utilized by any consumers.
|
|
585
|
+
- Consumers should provide the exact fieldDef configuration instead of relying on explicit defaults in meta.
|
|
586
|
+
- Only the in-house defaultFieldDef from `defaultConfig.defaultFieldDef` will be honored.
|
|
587
|
+
*/
|
|
588
|
+
...meta.defaultFieldDef
|
|
589
|
+
});
|
|
562
590
|
});
|
|
563
591
|
updateMetaSettings(meta, defaultConfig);
|
|
564
592
|
return meta;
|
|
@@ -607,6 +635,7 @@ export const dateFunctionLabels = {
|
|
|
607
635
|
DAYS: 'Day',
|
|
608
636
|
HOURS: 'Hour',
|
|
609
637
|
MINUTES: 'Minute',
|
|
638
|
+
SECONDS: 'Second',
|
|
610
639
|
MONTHS_OF_YEAR: 'Month of year',
|
|
611
640
|
DAYS_OF_MONTH: 'Day of month',
|
|
612
641
|
DAYS_OF_WEEK: 'Day of week',
|
|
@@ -692,6 +721,8 @@ export function validateAction(action, payload, externalStateKeys) {
|
|
|
692
721
|
case ActionTypes.SET_IN_EXTERNAL_STATE:
|
|
693
722
|
validateExternalStateAction(payload, externalStateKeys);
|
|
694
723
|
break;
|
|
724
|
+
case ActionTypes.SET_WARNING_MESSAGES:
|
|
725
|
+
break;
|
|
695
726
|
default:
|
|
696
727
|
throw Error(`Action ${action} is not supported!`);
|
|
697
728
|
}
|
|
@@ -728,18 +759,6 @@ export function passablePromise() {
|
|
|
728
759
|
});
|
|
729
760
|
return [promise, resolveRef, rejectRef];
|
|
730
761
|
}
|
|
731
|
-
/**
|
|
732
|
-
* Logs the given {@link cleanedUpFieldIds invalid column ids} to console as warning.
|
|
733
|
-
* @param cleanedUpFieldIds invalid column ids.
|
|
734
|
-
*
|
|
735
|
-
*/
|
|
736
|
-
export function logInvalidFields(cleanedUpFieldIds) {
|
|
737
|
-
// eslint-disable-next-line no-console
|
|
738
|
-
if (cleanedUpFieldIds.length !== 0 && console?.warn) {
|
|
739
|
-
// eslint-disable-next-line no-console
|
|
740
|
-
console.warn(`Columns with following id are not found. \n ${[...new Set(cleanedUpFieldIds)].join(', ')}\n Resulting outcome might not be correct. Please check the configuration.`);
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
762
|
/**
|
|
744
763
|
* Determines if the filter criteria has changed in the latest state compared to the previous state.
|
|
745
764
|
*
|
|
@@ -851,7 +870,7 @@ export function isSignificantPaginationOverlap(latestActions, previousExecutedAc
|
|
|
851
870
|
}
|
|
852
871
|
/**
|
|
853
872
|
* Returns a unique key for a given group.
|
|
854
|
-
* @param
|
|
873
|
+
* @param group
|
|
855
874
|
*/
|
|
856
875
|
export const getGroupKey = (group) => {
|
|
857
876
|
if (group.dateFunction) {
|
|
@@ -889,6 +908,24 @@ export const areColumnWidthsCalculated = (columnWidths) => {
|
|
|
889
908
|
export const isRowReorderFieldEnabled = (meta) => {
|
|
890
909
|
return meta.dragHandle || !!meta.rowReorderField;
|
|
891
910
|
};
|
|
911
|
+
/**
|
|
912
|
+
* Determines whether the row reorder field is visible.
|
|
913
|
+
*
|
|
914
|
+
* @param meta - View meta containing row reorder field configuration.
|
|
915
|
+
* @returns `true` if the row reorder field is visible; otherwise falls back to the deprecated `dragHandle`.
|
|
916
|
+
*/
|
|
917
|
+
export const isRowReorderFieldVisible = (meta) => {
|
|
918
|
+
return meta.rowReorderField ? !!meta.rowReorderField.show : !!meta.dragHandle;
|
|
919
|
+
};
|
|
920
|
+
/**
|
|
921
|
+
* Determines whether the row error field is visible.
|
|
922
|
+
*
|
|
923
|
+
* @param meta - View meta containing row error field configuration.
|
|
924
|
+
* @returns `true` if the row error field is visible; otherwise falls back to the deprecated `showErrorField`.
|
|
925
|
+
*/
|
|
926
|
+
export const isRowErrorFieldVisible = (meta) => {
|
|
927
|
+
return meta.rowErrorField ? !!meta.rowErrorField.show : !!meta.showErrorField;
|
|
928
|
+
};
|
|
892
929
|
// TODO: temporary method, till meta.showErrorField is completely removed(currently deprecated).
|
|
893
930
|
export const isRowErrorFieldEnabled = (meta) => {
|
|
894
931
|
return meta.showErrorField || !!meta.rowErrorField;
|
|
@@ -930,10 +967,106 @@ export const isRowSelectFieldEnabled = (meta) => {
|
|
|
930
967
|
!(template === TEMPLATES.GALLERY && selectionMode === SELECTION_MODES.multi_on_hover) &&
|
|
931
968
|
template !== TEMPLATES.TIMELINE);
|
|
932
969
|
};
|
|
970
|
+
export const isActionConfig = (action) => {
|
|
971
|
+
return !!action && typeof action === 'object' && 'placement' in action;
|
|
972
|
+
};
|
|
973
|
+
export const isDeletingColumnPlacement = (meta) => {
|
|
974
|
+
if (isActionConfig(meta.deleting)) {
|
|
975
|
+
return meta.deleting.placement === ActionColumnPlacement.COLUMN;
|
|
976
|
+
}
|
|
977
|
+
return false;
|
|
978
|
+
};
|
|
979
|
+
export const isRowDeleteFieldEnabled = (meta) => {
|
|
980
|
+
return !!meta.deleting && isDeletingColumnPlacement(meta);
|
|
981
|
+
};
|
|
982
|
+
export const isRowDeleteFieldVisible = (meta) => {
|
|
983
|
+
if (isActionConfig(meta.deleting)) {
|
|
984
|
+
return meta.deleting.placement === ActionColumnPlacement.COLUMN && !!meta.deleting.show;
|
|
985
|
+
}
|
|
986
|
+
return !!meta.deleting;
|
|
987
|
+
};
|
|
988
|
+
// Compatibility alias for existing call sites.
|
|
989
|
+
export const isRowActionFieldEnabled = (meta) => {
|
|
990
|
+
const isEditingEnabled = isActionConfig(meta.editing)
|
|
991
|
+
? meta.editing.placement === ActionColumnPlacement.MENU
|
|
992
|
+
: !!meta.editing;
|
|
993
|
+
const isDeletingEnabled = isActionConfig(meta.deleting)
|
|
994
|
+
? meta.deleting.placement === ActionColumnPlacement.MENU
|
|
995
|
+
: false;
|
|
996
|
+
return isEditingEnabled || isDeletingEnabled;
|
|
997
|
+
};
|
|
933
998
|
export const isFreezingEnabled = (meta) => {
|
|
934
999
|
return (meta.freezeFields ||
|
|
935
1000
|
isRowErrorFieldEnabled(meta) ||
|
|
936
1001
|
isRowReorderFieldEnabled(meta) ||
|
|
937
1002
|
isRowSelectFieldEnabled(meta));
|
|
938
1003
|
};
|
|
1004
|
+
/**
|
|
1005
|
+
* Derives visible column IDs from fieldDefs by excluding hidden columns.
|
|
1006
|
+
*
|
|
1007
|
+
* @param meta - View meta containing fieldDefs.
|
|
1008
|
+
* @param hiddenColumns - Array of hidden column IDs.
|
|
1009
|
+
* @returns Array of visible column IDs.
|
|
1010
|
+
*/
|
|
1011
|
+
export function getVisibleColumnsFromHidden(meta, hiddenColumns) {
|
|
1012
|
+
return meta.fieldDefs
|
|
1013
|
+
.filter(fieldDef => !hiddenColumns?.includes(fieldDef.id))
|
|
1014
|
+
.map(fieldDef => fieldDef.id);
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Derives visible column IDs from fieldDefs where show is true.
|
|
1018
|
+
*
|
|
1019
|
+
* @param meta - View meta containing fieldDefs.
|
|
1020
|
+
* @returns Array of visible column IDs.
|
|
1021
|
+
*/
|
|
1022
|
+
export function getVisibleColumnsFromFieldDefs(meta) {
|
|
1023
|
+
return meta.fieldDefs.filter(fieldDef => fieldDef.show).map(fieldDef => fieldDef.id);
|
|
1024
|
+
}
|
|
1025
|
+
export const isTranslationKey = (key) => key in defaultTranslations;
|
|
1026
|
+
/**
|
|
1027
|
+
* Translates a label if it is a known translation key, otherwise returns it as-is.
|
|
1028
|
+
*
|
|
1029
|
+
* @param label - The label string to translate.
|
|
1030
|
+
* @param translate - The translation function from the RS store.
|
|
1031
|
+
*/
|
|
1032
|
+
export const translateLabel = (label, translate) => (isTranslationKey(label) ? translate(label) : label);
|
|
1033
|
+
/**
|
|
1034
|
+
* Returns true if a column should still be created for the given fieldDef
|
|
1035
|
+
* even when the field is not visible (`show = false`).
|
|
1036
|
+
*
|
|
1037
|
+
* This happens when the field is required by the current template configuration
|
|
1038
|
+
* (e.g., Timeline, Gallery, Map) or when it is marked as a row header.
|
|
1039
|
+
*
|
|
1040
|
+
* TODO: Refactor, move template-field resolution into the RS layer (e.g. `useRepeat`).
|
|
1041
|
+
*/
|
|
1042
|
+
export const shouldCreateColumnForField = (meta, fieldDef) => {
|
|
1043
|
+
if (fieldDef.show || fieldDef.isRowHeader || fieldDef.filterPickList)
|
|
1044
|
+
return true;
|
|
1045
|
+
const template = meta.template;
|
|
1046
|
+
if (template === REPEATING_STRUCTURE_TEMPLATES.TIMELINE) {
|
|
1047
|
+
const { timelineFields = {} } = meta;
|
|
1048
|
+
const referenceNames = [
|
|
1049
|
+
timelineFields.title?.name,
|
|
1050
|
+
timelineFields.date?.name,
|
|
1051
|
+
timelineFields.content?.name,
|
|
1052
|
+
timelineFields.status?.name,
|
|
1053
|
+
timelineFields.icon?.name
|
|
1054
|
+
].filter(Boolean);
|
|
1055
|
+
return referenceNames.includes(fieldDef.name);
|
|
1056
|
+
}
|
|
1057
|
+
if (template === REPEATING_STRUCTURE_TEMPLATES.GALLERY) {
|
|
1058
|
+
const { galleryConfig = {} } = meta;
|
|
1059
|
+
const referenceIds = [
|
|
1060
|
+
galleryConfig.header?.field,
|
|
1061
|
+
galleryConfig.heroImage?.source?.field
|
|
1062
|
+
].filter(Boolean);
|
|
1063
|
+
return referenceIds.includes(fieldDef.id);
|
|
1064
|
+
}
|
|
1065
|
+
if (template === REPEATING_STRUCTURE_TEMPLATES.MAP) {
|
|
1066
|
+
const { mapFieldIds = {} } = meta;
|
|
1067
|
+
const referenceIds = [mapFieldIds.location, mapFieldIds.label, mapFieldIds.content].filter(Boolean);
|
|
1068
|
+
return referenceIds.includes(fieldDef.id);
|
|
1069
|
+
}
|
|
1070
|
+
return false;
|
|
1071
|
+
};
|
|
939
1072
|
//# sourceMappingURL=util.js.map
|