@talxis/base-controls 1.2509.1-alpha.6 → 1.2509.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +49 -0
- package/README.md +3 -40
- package/dist/components/DatasetControl/DatasetControl.js +55 -59
- package/dist/components/DatasetControl/DatasetControl.js.map +1 -1
- package/dist/components/DatasetControl/Paging/DatasetPaging.d.ts +3 -0
- package/dist/components/DatasetControl/Paging/DatasetPaging.js +69 -0
- package/dist/components/DatasetControl/Paging/DatasetPaging.js.map +1 -0
- package/dist/components/DatasetControl/Paging/Paging.d.ts +26 -0
- package/dist/components/DatasetControl/Paging/Paging.js +80 -0
- package/dist/components/DatasetControl/Paging/Paging.js.map +1 -0
- package/dist/components/DatasetControl/Paging/index.d.ts +3 -0
- package/dist/components/DatasetControl/Paging/index.js +3 -0
- package/dist/components/DatasetControl/Paging/index.js.map +1 -0
- package/dist/components/DatasetControl/Paging/interfaces.d.ts +16 -0
- package/dist/components/DatasetControl/Paging/styles.d.ts +35 -0
- package/dist/components/DatasetControl/Paging/styles.js +41 -0
- package/dist/components/DatasetControl/Paging/styles.js.map +1 -0
- package/dist/components/DatasetControl/Paging/translations.d.ts +38 -0
- package/dist/components/DatasetControl/Paging/translations.js +14 -0
- package/dist/components/DatasetControl/Paging/translations.js.map +1 -0
- package/dist/components/DatasetControl/QuickFind/QuickFind.d.ts +12 -4
- package/dist/components/DatasetControl/QuickFind/QuickFind.js +32 -36
- package/dist/components/DatasetControl/QuickFind/QuickFind.js.map +1 -1
- package/dist/components/DatasetControl/QuickFind/styles.d.ts +1 -1
- package/dist/components/DatasetControl/QuickFind/styles.js +2 -2
- package/dist/components/DatasetControl/QuickFind/styles.js.map +1 -1
- package/dist/components/DatasetControl/index.d.ts +1 -0
- package/dist/components/DatasetControl/index.js +2 -0
- package/dist/components/DatasetControl/index.js.map +1 -1
- package/dist/components/DatasetControl/interfaces.d.ts +20 -54
- package/dist/components/DatasetControl/styles.d.ts +11 -4
- package/dist/components/DatasetControl/styles.js +11 -5
- package/dist/components/DatasetControl/styles.js.map +1 -1
- package/dist/components/DatasetControl/translations.d.ts +0 -44
- package/dist/components/DatasetControl/translations.js +1 -15
- package/dist/components/DatasetControl/translations.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +3 -0
- package/dist/components/Grid/Grid.js +37 -0
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/Grid/GridContext.d.ts +3 -0
- package/dist/components/Grid/GridContext.js.map +1 -0
- package/dist/components/Grid/aggregation/Aggregation.d.ts +18 -0
- package/dist/components/Grid/aggregation/Aggregation.js +129 -0
- package/dist/components/Grid/aggregation/Aggregation.js.map +1 -0
- package/dist/components/Grid/{grid/Grid.d.ts → core/components/AgGrid/AgGrid.d.ts} +2 -2
- package/dist/components/Grid/core/components/AgGrid/AgGrid.js +203 -0
- package/dist/components/Grid/core/components/AgGrid/AgGrid.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.js +12 -0
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.js.map +1 -0
- package/dist/components/Grid/{overlays/empty-records → core/components/AgGrid/components/EmptyRecordsOverlay}/styles.d.ts +1 -1
- package/dist/components/Grid/{overlays/empty-records → core/components/AgGrid/components/EmptyRecordsOverlay}/styles.js +1 -1
- package/dist/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/styles.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.js.map +1 -0
- package/dist/components/Grid/{grid/ag-grid/AgGridContext.d.ts → core/components/AgGrid/context.d.ts} +2 -2
- package/dist/components/Grid/{grid/ag-grid/AgGridContext.js → core/components/AgGrid/context.js} +1 -1
- package/dist/components/Grid/core/components/AgGrid/context.js.map +1 -0
- package/dist/components/Grid/core/components/AgGrid/model/AgGrid.d.ts +52 -0
- package/dist/components/Grid/core/components/AgGrid/model/AgGrid.js +343 -0
- package/dist/components/Grid/core/components/AgGrid/model/AgGrid.js.map +1 -0
- package/dist/components/Grid/{grid/ValueComparator.d.ts → core/components/AgGrid/model/Comparator.d.ts} +1 -1
- package/dist/components/Grid/{grid/ValueComparator.js → core/components/AgGrid/model/Comparator.js} +1 -7
- package/dist/components/Grid/core/components/AgGrid/model/Comparator.js.map +1 -0
- package/dist/components/Grid/{grid → core/components/AgGrid}/styles.d.ts +4 -24
- package/dist/components/Grid/{grid → core/components/AgGrid}/styles.js +6 -37
- package/dist/components/Grid/core/components/AgGrid/styles.js.map +1 -0
- package/dist/components/Grid/{cells/cell → core/components/Cell}/Cell.d.ts +3 -3
- package/dist/components/Grid/core/components/Cell/Cell.js +158 -0
- package/dist/components/Grid/core/components/Cell/Cell.js.map +1 -0
- package/dist/components/Grid/{cells/cell/content → core/components/Cell/CellContent}/CellContent.d.ts +2 -2
- package/dist/components/Grid/{cells/cell/content → core/components/Cell/CellContent}/CellContent.js +31 -40
- package/dist/components/Grid/core/components/Cell/CellContent/CellContent.js.map +1 -0
- package/dist/components/Grid/core/components/Cell/CellContent/styles.js.map +1 -0
- package/dist/components/Grid/{cells/cell/notifications → core/components/Cell/Notifications}/Notifications.d.ts +1 -1
- package/dist/components/Grid/{cells/cell/notifications → core/components/Cell/Notifications}/Notifications.js +5 -5
- package/dist/components/Grid/core/components/Cell/Notifications/Notifications.js.map +1 -0
- package/dist/components/Grid/{cells/cell/notifications → core/components/Cell/Notifications}/styles.js +1 -1
- package/dist/components/Grid/core/components/Cell/Notifications/styles.js.map +1 -0
- package/dist/components/Grid/{cells/cell → core/components/Cell}/styles.d.ts +3 -34
- package/dist/components/Grid/core/components/Cell/styles.js +59 -0
- package/dist/components/Grid/core/components/Cell/styles.js.map +1 -0
- package/dist/components/Grid/{column-headers/column-header → core/components/ColumnHeader}/ColumnHeader.d.ts +1 -1
- package/dist/components/Grid/core/components/ColumnHeader/ColumnHeader.js +61 -0
- package/dist/components/Grid/core/components/ColumnHeader/ColumnHeader.js.map +1 -0
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.d.ts +2 -0
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.js +50 -0
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.js.map +1 -0
- package/dist/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/styles.js.map +1 -0
- package/dist/components/Grid/core/components/ColumnHeader/styles.d.ts +42 -0
- package/dist/components/Grid/core/components/ColumnHeader/styles.js +48 -0
- package/dist/components/Grid/core/components/ColumnHeader/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Dialog/Constants.d.ts +2 -0
- package/dist/components/Grid/core/components/Dialog/Constants.js +9 -0
- package/dist/components/Grid/core/components/Dialog/Constants.js.map +1 -0
- package/dist/components/Grid/core/components/Dialog/Styles.d.ts +2 -0
- package/dist/components/Grid/core/components/Dialog/Styles.js +61 -0
- package/dist/components/Grid/core/components/Dialog/Styles.js.map +1 -0
- package/dist/components/Grid/core/components/Dialog/index.d.ts +4 -0
- package/dist/components/Grid/core/components/Dialog/index.js +16 -0
- package/dist/components/Grid/core/components/Dialog/index.js.map +1 -0
- package/dist/components/Grid/core/components/Dialog/interfaces/index.d.ts +6 -0
- package/dist/components/Grid/core/components/Dialog/interfaces/index.js +2 -0
- package/dist/components/Grid/core/components/Dialog/interfaces/index.js.map +1 -0
- package/dist/components/Grid/core/components/Save/Save.d.ts +2 -0
- package/dist/components/Grid/core/components/Save/Save.js +59 -0
- package/dist/components/Grid/core/components/Save/Save.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.d.ts +7 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.js +73 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/ChangeGrid/ChangeGrid.d.ts +11 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/ChangeGrid/ChangeGrid.js +231 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/ChangeGrid/ChangeGrid.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/ChangeGrid/styles.d.ts +39 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/ChangeGrid/styles.js +45 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/ChangeGrid/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/styles.d.ts +31 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/styles.js +37 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Save/styles.d.ts +35 -0
- package/dist/components/Grid/core/components/Save/styles.js +42 -0
- package/dist/components/Grid/core/components/Save/styles.js.map +1 -0
- package/dist/components/Grid/core/controllers/useGridController.d.ts +7 -0
- package/dist/components/Grid/core/controllers/useGridController.js +29 -0
- package/dist/components/Grid/core/controllers/useGridController.js.map +1 -0
- package/dist/components/Grid/core/enums/ConditionOperator.d.ts +48 -0
- package/dist/components/Grid/core/enums/ConditionOperator.js +52 -0
- package/dist/components/Grid/core/enums/ConditionOperator.js.map +1 -0
- package/dist/components/Grid/core/enums/DataType.d.ts +25 -0
- package/dist/components/Grid/core/enums/DataType.js +30 -0
- package/dist/components/Grid/core/enums/DataType.js.map +1 -0
- package/dist/components/Grid/core/hooks/useGridInstance.d.ts +2 -0
- package/dist/components/Grid/{grid → core/hooks}/useGridInstance.js +2 -2
- package/dist/components/Grid/core/hooks/useGridInstance.js.map +1 -0
- package/dist/components/Grid/core/hooks/useRefreshCallback.d.ts +2 -0
- package/dist/components/Grid/core/hooks/useRefreshCallback.js +20 -0
- package/dist/components/Grid/core/hooks/useRefreshCallback.js.map +1 -0
- package/dist/components/Grid/core/interfaces/IGridColumn.d.ts +13 -0
- package/dist/components/Grid/core/interfaces/IGridContext.d.ts +4 -0
- package/dist/components/Grid/core/model/Grid.d.ts +83 -0
- package/dist/components/Grid/core/model/Grid.js +528 -0
- package/dist/components/Grid/core/model/Grid.js.map +1 -0
- package/dist/components/Grid/core/model/GridDependency.d.ts +13 -0
- package/dist/components/Grid/core/model/GridDependency.js +28 -0
- package/dist/components/Grid/core/model/GridDependency.js.map +1 -0
- package/dist/components/Grid/core/services/KeyListener.d.ts +12 -0
- package/dist/components/Grid/core/services/KeyListener.js +31 -0
- package/dist/components/Grid/core/services/KeyListener.js.map +1 -0
- package/dist/components/Grid/{column-headers/column-header → filtering/components/FilterCallout}/FilterCallout.d.ts +1 -1
- package/dist/components/Grid/filtering/components/FilterCallout/FilterCallout.js +59 -0
- package/dist/components/Grid/filtering/components/FilterCallout/FilterCallout.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.d.ts +7 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.js +56 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.d.ts +7 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.js +73 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValueBetween.d.ts +7 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValueBetween.js +90 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValueBetween.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.d.ts +48 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.js +146 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/LegacyControlRendering/Component.d.ts +11 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/LegacyControlRendering/Component.js +53 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/LegacyControlRendering/Component.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/LegacyControlRendering/controller/useComponentController.d.ts +9 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/LegacyControlRendering/controller/useComponentController.js +31 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/LegacyControlRendering/controller/useComponentController.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/LegacyControlRendering/model/Component.d.ts +10 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/LegacyControlRendering/model/Component.js +294 -0
- package/dist/components/Grid/filtering/components/FilterCallout/components/LegacyControlRendering/model/Component.js.map +1 -0
- package/dist/components/Grid/filtering/components/FilterCallout/styles.d.ts +35 -0
- package/dist/components/Grid/{column-headers/column-header → filtering/components/FilterCallout}/styles.js +11 -20
- package/dist/components/Grid/filtering/components/FilterCallout/styles.js.map +1 -0
- package/dist/components/Grid/filtering/constants.d.ts +5 -0
- package/dist/components/Grid/filtering/constants.js +53 -0
- package/dist/components/Grid/filtering/constants.js.map +1 -0
- package/dist/components/Grid/filtering/controller/useColumnFilterConditionController.d.ts +21 -0
- package/dist/components/Grid/filtering/controller/useColumnFilterConditionController.js +44 -0
- package/dist/components/Grid/filtering/controller/useColumnFilterConditionController.js.map +1 -0
- package/dist/components/Grid/filtering/model/Condition.d.ts +49 -0
- package/dist/components/Grid/filtering/model/Condition.js +347 -0
- package/dist/components/Grid/filtering/model/Condition.js.map +1 -0
- package/dist/components/Grid/filtering/model/Filtering.d.ts +11 -0
- package/dist/components/Grid/filtering/model/Filtering.js +78 -0
- package/dist/components/Grid/filtering/model/Filtering.js.map +1 -0
- package/dist/components/Grid/filtering/utils/FilteringUtilts.d.ts +34 -0
- package/dist/components/Grid/filtering/utils/FilteringUtilts.js +195 -0
- package/dist/components/Grid/filtering/utils/FilteringUtilts.js.map +1 -0
- package/dist/components/Grid/index.d.ts +1 -1
- package/dist/components/Grid/index.js +1 -1
- package/dist/components/Grid/interfaces.d.ts +0 -9
- package/dist/components/Grid/selection/model/Selection.d.ts +12 -0
- package/dist/components/Grid/selection/model/Selection.js +55 -0
- package/dist/components/Grid/selection/model/Selection.js.map +1 -0
- package/dist/components/Grid/sorting/Sorting.d.ts +10 -0
- package/dist/components/Grid/sorting/Sorting.js +31 -0
- package/dist/components/Grid/sorting/Sorting.js.map +1 -0
- package/dist/components/Grid/{column-headers/column-header/ColumnHeaderContextualMenu.d.ts → sorting/components/SortingContextualMenu/SortingContextualMenu.d.ts} +3 -3
- package/dist/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.js +157 -0
- package/dist/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.js.map +1 -0
- package/dist/components/Grid/sorting/components/SortingContextualMenu/styles.d.ts +9 -0
- package/dist/components/Grid/sorting/components/SortingContextualMenu/styles.js +15 -0
- package/dist/components/Grid/sorting/components/SortingContextualMenu/styles.js.map +1 -0
- package/dist/components/Grid/sorting/controllers/useColumnSortingController.d.ts +9 -0
- package/dist/components/Grid/sorting/controllers/useColumnSortingController.js +22 -0
- package/dist/components/Grid/sorting/controllers/useColumnSortingController.js.map +1 -0
- package/dist/components/Grid/translations.d.ts +180 -20
- package/dist/components/Grid/translations.js +48 -5
- package/dist/components/Grid/translations.js.map +1 -1
- package/dist/components/GridCellRenderer/DefaultContentRenderer/DefaultContentRenderer.d.ts +2 -0
- package/dist/components/GridCellRenderer/DefaultContentRenderer/DefaultContentRenderer.js +11 -0
- package/dist/components/GridCellRenderer/DefaultContentRenderer/DefaultContentRenderer.js.map +1 -0
- package/dist/components/GridCellRenderer/DefaultContentRenderer/index.d.ts +1 -0
- package/dist/components/GridCellRenderer/DefaultContentRenderer/index.js +2 -0
- package/dist/components/GridCellRenderer/DefaultContentRenderer/index.js.map +1 -0
- package/dist/components/GridCellRenderer/GridCellRenderer.js +282 -99
- package/dist/components/GridCellRenderer/GridCellRenderer.js.map +1 -1
- package/dist/components/GridCellRenderer/OptionSet/OptionSet.d.ts +5 -0
- package/dist/components/GridCellRenderer/OptionSet/OptionSet.js +75 -0
- package/dist/components/GridCellRenderer/OptionSet/OptionSet.js.map +1 -0
- package/dist/components/GridCellRenderer/OptionSet/index.d.ts +1 -0
- package/dist/components/GridCellRenderer/OptionSet/index.js +2 -0
- package/dist/components/GridCellRenderer/OptionSet/index.js.map +1 -0
- package/dist/components/GridCellRenderer/OptionSet/styles.d.ts +20 -0
- package/dist/components/GridCellRenderer/OptionSet/styles.js +29 -0
- package/dist/components/GridCellRenderer/OptionSet/styles.js.map +1 -0
- package/dist/components/GridCellRenderer/RecordCommands/Icon.d.ts +7 -0
- package/dist/components/GridCellRenderer/RecordCommands/Icon.js +32 -0
- package/dist/components/GridCellRenderer/RecordCommands/Icon.js.map +1 -0
- package/dist/components/GridCellRenderer/RecordCommands/RecordCommands.d.ts +13 -0
- package/dist/components/GridCellRenderer/RecordCommands/RecordCommands.js +103 -0
- package/dist/components/GridCellRenderer/RecordCommands/RecordCommands.js.map +1 -0
- package/dist/components/GridCellRenderer/RecordCommands/styles.d.ts +13 -0
- package/dist/components/GridCellRenderer/RecordCommands/styles.js +32 -0
- package/dist/components/GridCellRenderer/RecordCommands/styles.js.map +1 -0
- package/dist/components/GridCellRenderer/interfaces.d.ts +42 -53
- package/dist/components/GridCellRenderer/styles.d.ts +60 -34
- package/dist/components/GridCellRenderer/styles.js +77 -69
- package/dist/components/GridCellRenderer/styles.js.map +1 -1
- package/dist/components/GridCellRenderer/translations.d.ts +1 -1
- package/dist/components/GridCellRenderer/translations.js +32 -30
- package/dist/components/GridCellRenderer/translations.js.map +1 -1
- package/dist/components/GridCellRenderer/useComponentProps.d.ts +6 -0
- package/dist/components/GridCellRenderer/useComponentProps.js +10 -0
- package/dist/components/GridCellRenderer/useComponentProps.js.map +1 -0
- package/dist/components/Lookup/Lookup.js +1 -1
- package/dist/components/Lookup/Lookup.js.map +1 -1
- package/dist/components/Lookup/hooks/useLookup.js +2 -2
- package/dist/components/Lookup/hooks/useLookup.js.map +1 -1
- package/dist/components/MultiSelectOptionSet/MultiSelectOptionSet.js +2 -2
- package/dist/components/MultiSelectOptionSet/MultiSelectOptionSet.js.map +1 -1
- package/dist/components/NestedControlRenderer/NestedControl.d.ts +0 -2
- package/dist/components/NestedControlRenderer/NestedControl.js +2 -5
- package/dist/components/NestedControlRenderer/NestedControl.js.map +1 -1
- package/dist/components/NestedControlRenderer/NestedControlRenderer.js +6 -11
- package/dist/components/NestedControlRenderer/NestedControlRenderer.js.map +1 -1
- package/dist/components/NestedControlRenderer/interfaces.d.ts +0 -4
- package/dist/components/NestedControlRenderer/properties/FileProperty.js +1 -1
- package/dist/components/NestedControlRenderer/properties/FileProperty.js.map +1 -1
- package/dist/components/OptionSet/OptionSet.js +4 -5
- package/dist/components/OptionSet/OptionSet.js.map +1 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/index.js +3 -1
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/useControl.d.ts +0 -1
- package/dist/hooks/useControl.js +0 -1
- package/dist/hooks/useControl.js.map +1 -1
- package/dist/hooks/useInputBasedControl.js +1 -2
- package/dist/hooks/useInputBasedControl.js.map +1 -1
- package/dist/index.d.ts +299 -162
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/property.d.ts +1 -1
- package/dist/utils/BaseControls.d.ts +1 -2
- package/dist/utils/BaseControls.js +1 -5
- package/dist/utils/BaseControls.js.map +1 -1
- package/dist/utils/dataset/adapters/VirtualDatasetAdapter.d.ts +16 -12
- package/dist/utils/dataset/adapters/VirtualDatasetAdapter.js +72 -27
- package/dist/utils/dataset/adapters/VirtualDatasetAdapter.js.map +1 -1
- package/dist/utils/theme/components/ThemeWrapper.d.ts +1 -1
- package/dist/utils/theme/components/ThemeWrapper.js.map +1 -1
- package/dist/utils/theme/hooks/useControlTheme.js +1 -2
- package/dist/utils/theme/hooks/useControlTheme.js.map +1 -1
- package/package.json +5 -9
- package/dist/components/DatasetControl/DatasetControlModel.d.ts +0 -37
- package/dist/components/DatasetControl/DatasetControlModel.js +0 -110
- package/dist/components/DatasetControl/DatasetControlModel.js.map +0 -1
- package/dist/components/DatasetControl/Filtering/DatasetColumnFiltering.d.ts +0 -3
- package/dist/components/DatasetControl/Filtering/DatasetColumnFiltering.js +0 -166
- package/dist/components/DatasetControl/Filtering/DatasetColumnFiltering.js.map +0 -1
- package/dist/components/DatasetControl/Filtering/DatasetColumnFilteringModel.d.ts +0 -15
- package/dist/components/DatasetControl/Filtering/DatasetColumnFilteringModel.js +0 -59
- package/dist/components/DatasetControl/Filtering/DatasetColumnFilteringModel.js.map +0 -1
- package/dist/components/DatasetControl/Filtering/interfaces.d.ts +0 -31
- package/dist/components/DatasetControl/Filtering/styles.d.ts +0 -16
- package/dist/components/DatasetControl/Filtering/styles.js +0 -23
- package/dist/components/DatasetControl/Filtering/styles.js.map +0 -1
- package/dist/components/DatasetControl/Filtering/translations.d.ts +0 -154
- package/dist/components/DatasetControl/Filtering/translations.js +0 -43
- package/dist/components/DatasetControl/Filtering/translations.js.map +0 -1
- package/dist/components/DatasetControl/Header/Header.d.ts +0 -5
- package/dist/components/DatasetControl/Header/Header.js +0 -89
- package/dist/components/DatasetControl/Header/Header.js.map +0 -1
- package/dist/components/DatasetControl/Header/styles.d.ts +0 -22
- package/dist/components/DatasetControl/Header/styles.js +0 -29
- package/dist/components/DatasetControl/Header/styles.js.map +0 -1
- package/dist/components/DatasetControl/Pagination/Pagination.d.ts +0 -5
- package/dist/components/DatasetControl/Pagination/Pagination.js +0 -91
- package/dist/components/DatasetControl/Pagination/Pagination.js.map +0 -1
- package/dist/components/DatasetControl/Pagination/PaginationModel.d.ts +0 -10
- package/dist/components/DatasetControl/Pagination/PaginationModel.js +0 -45
- package/dist/components/DatasetControl/Pagination/PaginationModel.js.map +0 -1
- package/dist/components/DatasetControl/Pagination/styles.d.ts +0 -23
- package/dist/components/DatasetControl/Pagination/styles.js +0 -29
- package/dist/components/DatasetControl/Pagination/styles.js.map +0 -1
- package/dist/components/DatasetControl/useModel.d.ts +0 -4
- package/dist/components/DatasetControl/useModel.js +0 -9
- package/dist/components/DatasetControl/useModel.js.map +0 -1
- package/dist/components/Grid/cells/cell/Cell.js +0 -302
- package/dist/components/Grid/cells/cell/Cell.js.map +0 -1
- package/dist/components/Grid/cells/cell/content/CellContent.js.map +0 -1
- package/dist/components/Grid/cells/cell/content/styles.js.map +0 -1
- package/dist/components/Grid/cells/cell/notifications/Notifications.js.map +0 -1
- package/dist/components/Grid/cells/cell/notifications/styles.js.map +0 -1
- package/dist/components/Grid/cells/cell/styles.js +0 -78
- package/dist/components/Grid/cells/cell/styles.js.map +0 -1
- package/dist/components/Grid/column-headers/column-header/ColumnHeader.js +0 -83
- package/dist/components/Grid/column-headers/column-header/ColumnHeader.js.map +0 -1
- package/dist/components/Grid/column-headers/column-header/ColumnHeaderContextualMenu.js +0 -115
- package/dist/components/Grid/column-headers/column-header/ColumnHeaderContextualMenu.js.map +0 -1
- package/dist/components/Grid/column-headers/column-header/FilterCallout.js +0 -103
- package/dist/components/Grid/column-headers/column-header/FilterCallout.js.map +0 -1
- package/dist/components/Grid/column-headers/column-header/styles.d.ts +0 -84
- package/dist/components/Grid/column-headers/column-header/styles.js.map +0 -1
- package/dist/components/Grid/column-headers/record-selection-checkbox/RecordSelectionCheckbox.d.ts +0 -2
- package/dist/components/Grid/column-headers/record-selection-checkbox/RecordSelectionCheckbox.js +0 -50
- package/dist/components/Grid/column-headers/record-selection-checkbox/RecordSelectionCheckbox.js.map +0 -1
- package/dist/components/Grid/column-headers/record-selection-checkbox/styles.js.map +0 -1
- package/dist/components/Grid/errors/FullWidthCellRendererError/FullWidthCellRendererError.d.ts +0 -6
- package/dist/components/Grid/errors/FullWidthCellRendererError/FullWidthCellRendererError.js +0 -15
- package/dist/components/Grid/errors/FullWidthCellRendererError/FullWidthCellRendererError.js.map +0 -1
- package/dist/components/Grid/errors/FullWidthCellRendererError/styles.d.ts +0 -6
- package/dist/components/Grid/errors/FullWidthCellRendererError/styles.js +0 -13
- package/dist/components/Grid/errors/FullWidthCellRendererError/styles.js.map +0 -1
- package/dist/components/Grid/grid/Grid.js +0 -64
- package/dist/components/Grid/grid/Grid.js.map +0 -1
- package/dist/components/Grid/grid/GridContext.d.ts +0 -3
- package/dist/components/Grid/grid/GridContext.js.map +0 -1
- package/dist/components/Grid/grid/GridModel.d.ts +0 -117
- package/dist/components/Grid/grid/GridModel.js +0 -787
- package/dist/components/Grid/grid/GridModel.js.map +0 -1
- package/dist/components/Grid/grid/ValueComparator.js.map +0 -1
- package/dist/components/Grid/grid/ag-grid/AgGridContext.js.map +0 -1
- package/dist/components/Grid/grid/ag-grid/AgGridModel.d.ts +0 -88
- package/dist/components/Grid/grid/ag-grid/AgGridModel.js +0 -565
- package/dist/components/Grid/grid/ag-grid/AgGridModel.js.map +0 -1
- package/dist/components/Grid/grid/ag-grid/ServerSideDatasource.d.ts +0 -7
- package/dist/components/Grid/grid/ag-grid/ServerSideDatasource.js +0 -38
- package/dist/components/Grid/grid/ag-grid/ServerSideDatasource.js.map +0 -1
- package/dist/components/Grid/grid/ag-grid/useAgGridInstance.d.ts +0 -2
- package/dist/components/Grid/grid/ag-grid/useAgGridInstance.js +0 -9
- package/dist/components/Grid/grid/ag-grid/useAgGridInstance.js.map +0 -1
- package/dist/components/Grid/grid/styles.js.map +0 -1
- package/dist/components/Grid/grid/useGridInstance.d.ts +0 -2
- package/dist/components/Grid/grid/useGridInstance.js.map +0 -1
- package/dist/components/Grid/loading/full-row/FullRowLoading.d.ts +0 -3
- package/dist/components/Grid/loading/full-row/FullRowLoading.js +0 -33
- package/dist/components/Grid/loading/full-row/FullRowLoading.js.map +0 -1
- package/dist/components/Grid/loading/full-row/styles.d.ts +0 -9
- package/dist/components/Grid/loading/full-row/styles.js +0 -16
- package/dist/components/Grid/loading/full-row/styles.js.map +0 -1
- package/dist/components/Grid/overlays/empty-records/EmptyRecordsOverlay.js +0 -13
- package/dist/components/Grid/overlays/empty-records/EmptyRecordsOverlay.js.map +0 -1
- package/dist/components/Grid/overlays/empty-records/styles.js.map +0 -1
- package/dist/components/Grid/overlays/loading/LoadingOverlay.js.map +0 -1
- package/dist/components/GridCellRenderer/GridCellRendererModel.d.ts +0 -51
- package/dist/components/GridCellRenderer/GridCellRendererModel.js +0 -211
- package/dist/components/GridCellRenderer/GridCellRendererModel.js.map +0 -1
- package/dist/components/GridCellRenderer/ValueRenderer/ColorfulOptionSetValueRenderer/ColorfulOptionSetValueRenderer.d.ts +0 -9
- package/dist/components/GridCellRenderer/ValueRenderer/ColorfulOptionSetValueRenderer/ColorfulOptionSetValueRenderer.js +0 -53
- package/dist/components/GridCellRenderer/ValueRenderer/ColorfulOptionSetValueRenderer/ColorfulOptionSetValueRenderer.js.map +0 -1
- package/dist/components/GridCellRenderer/ValueRenderer/ColorfulOptionSetValueRenderer/styles.d.ts +0 -20
- package/dist/components/GridCellRenderer/ValueRenderer/ColorfulOptionSetValueRenderer/styles.js +0 -29
- package/dist/components/GridCellRenderer/ValueRenderer/ColorfulOptionSetValueRenderer/styles.js.map +0 -1
- package/dist/components/GridCellRenderer/ValueRenderer/FileRenderer/FileRenderer.d.ts +0 -7
- package/dist/components/GridCellRenderer/ValueRenderer/FileRenderer/FileRenderer.js +0 -76
- package/dist/components/GridCellRenderer/ValueRenderer/FileRenderer/FileRenderer.js.map +0 -1
- package/dist/components/GridCellRenderer/ValueRenderer/FileRenderer/styles.d.ts +0 -18
- package/dist/components/GridCellRenderer/ValueRenderer/FileRenderer/styles.js +0 -25
- package/dist/components/GridCellRenderer/ValueRenderer/FileRenderer/styles.js.map +0 -1
- package/dist/components/GridCellRenderer/ValueRenderer/ValueRenderer.d.ts +0 -3
- package/dist/components/GridCellRenderer/ValueRenderer/ValueRenderer.js +0 -52
- package/dist/components/GridCellRenderer/ValueRenderer/ValueRenderer.js.map +0 -1
- package/dist/components/GridCellRenderer/ValueRenderer/styles.d.ts +0 -1666
- package/dist/components/GridCellRenderer/ValueRenderer/styles.js +0 -31
- package/dist/components/GridCellRenderer/ValueRenderer/styles.js.map +0 -1
- package/dist/components/GridCellRenderer/properties/Email.d.ts +0 -5
- package/dist/components/GridCellRenderer/properties/Email.js +0 -15
- package/dist/components/GridCellRenderer/properties/Email.js.map +0 -1
- package/dist/components/GridCellRenderer/properties/File.d.ts +0 -19
- package/dist/components/GridCellRenderer/properties/File.js +0 -99
- package/dist/components/GridCellRenderer/properties/File.js.map +0 -1
- package/dist/components/GridCellRenderer/properties/Image.d.ts +0 -4
- package/dist/components/GridCellRenderer/properties/Image.js +0 -15
- package/dist/components/GridCellRenderer/properties/Image.js.map +0 -1
- package/dist/components/GridCellRenderer/properties/Lookup.d.ts +0 -6
- package/dist/components/GridCellRenderer/properties/Lookup.js +0 -19
- package/dist/components/GridCellRenderer/properties/Lookup.js.map +0 -1
- package/dist/components/GridCellRenderer/properties/MultiSelectOptionSet.d.ts +0 -5
- package/dist/components/GridCellRenderer/properties/MultiSelectOptionSet.js +0 -11
- package/dist/components/GridCellRenderer/properties/MultiSelectOptionSet.js.map +0 -1
- package/dist/components/GridCellRenderer/properties/MultilineText.d.ts +0 -4
- package/dist/components/GridCellRenderer/properties/MultilineText.js +0 -10
- package/dist/components/GridCellRenderer/properties/MultilineText.js.map +0 -1
- package/dist/components/GridCellRenderer/properties/OptionSet.d.ts +0 -5
- package/dist/components/GridCellRenderer/properties/OptionSet.js +0 -11
- package/dist/components/GridCellRenderer/properties/OptionSet.js.map +0 -1
- package/dist/components/GridCellRenderer/properties/OptionSetBase.d.ts +0 -7
- package/dist/components/GridCellRenderer/properties/OptionSetBase.js +0 -19
- package/dist/components/GridCellRenderer/properties/OptionSetBase.js.map +0 -1
- package/dist/components/GridCellRenderer/properties/Phone.d.ts +0 -9
- package/dist/components/GridCellRenderer/properties/Phone.js +0 -15
- package/dist/components/GridCellRenderer/properties/Phone.js.map +0 -1
- package/dist/components/GridCellRenderer/properties/Property.d.ts +0 -19
- package/dist/components/GridCellRenderer/properties/Property.js +0 -54
- package/dist/components/GridCellRenderer/properties/Property.js.map +0 -1
- package/dist/components/GridCellRenderer/properties/TwoOptions.d.ts +0 -5
- package/dist/components/GridCellRenderer/properties/TwoOptions.js +0 -11
- package/dist/components/GridCellRenderer/properties/TwoOptions.js.map +0 -1
- package/dist/components/GridCellRenderer/properties/Url.d.ts +0 -5
- package/dist/components/GridCellRenderer/properties/Url.js +0 -15
- package/dist/components/GridCellRenderer/properties/Url.js.map +0 -1
- package/dist/components/GridCellRenderer/useModel.d.ts +0 -4
- package/dist/components/GridCellRenderer/useModel.js +0 -9
- package/dist/components/GridCellRenderer/useModel.js.map +0 -1
- package/dist/components/GridColumnHeader/GridColumnHeader.d.ts +0 -3
- package/dist/components/GridColumnHeader/GridColumnHeader.js +0 -134
- package/dist/components/GridColumnHeader/GridColumnHeader.js.map +0 -1
- package/dist/components/GridColumnHeader/GridColumnHeaderModel.d.ts +0 -26
- package/dist/components/GridColumnHeader/GridColumnHeaderModel.js +0 -87
- package/dist/components/GridColumnHeader/GridColumnHeaderModel.js.map +0 -1
- package/dist/components/GridColumnHeader/interfaces.d.ts +0 -45
- package/dist/components/GridColumnHeader/styles.d.ts +0 -37
- package/dist/components/GridColumnHeader/styles.js +0 -55
- package/dist/components/GridColumnHeader/styles.js.map +0 -1
- package/dist/components/GridColumnHeader/translations.d.ts +0 -26
- package/dist/components/GridColumnHeader/translations.js +0 -29
- package/dist/components/GridColumnHeader/translations.js.map +0 -1
- package/dist/components/Ribbon/Ribbon.d.ts +0 -3
- package/dist/components/Ribbon/Ribbon.js +0 -97
- package/dist/components/Ribbon/Ribbon.js.map +0 -1
- package/dist/components/Ribbon/RibbonModel.d.ts +0 -4
- package/dist/components/Ribbon/interfaces.d.ts +0 -19
- package/dist/components/Ribbon/styles.d.ts +0 -11
- package/dist/components/Ribbon/styles.js +0 -18
- package/dist/components/Ribbon/styles.js.map +0 -1
- package/dist/hooks/useEventEmitter.d.ts +0 -2
- package/dist/hooks/useEventEmitter.js +0 -18
- package/dist/hooks/useEventEmitter.js.map +0 -1
- /package/dist/components/Grid/{grid/GridContext.js → GridContext.js} +0 -0
- /package/dist/components/Grid/{overlays/empty-records/EmptyRecordsOverlay.d.ts → core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.d.ts} +0 -0
- /package/dist/components/Grid/{overlays/loading → core/components/AgGrid/components/LoadingOverlay}/LoadingOverlay.d.ts +0 -0
- /package/dist/components/Grid/{overlays/loading → core/components/AgGrid/components/LoadingOverlay}/LoadingOverlay.js +0 -0
- /package/dist/components/Grid/{cells/cell/content → core/components/Cell/CellContent}/styles.d.ts +0 -0
- /package/dist/components/Grid/{cells/cell/content → core/components/Cell/CellContent}/styles.js +0 -0
- /package/dist/components/Grid/{cells/cell/notifications → core/components/Cell/Notifications}/styles.d.ts +0 -0
- /package/dist/components/Grid/{column-headers/record-selection-checkbox → core/components/ColumnHeader/components/GlobalCheckbox}/styles.d.ts +0 -0
- /package/dist/components/Grid/{column-headers/record-selection-checkbox → core/components/ColumnHeader/components/GlobalCheckbox}/styles.js +0 -0
|
@@ -1,97 +1,81 @@
|
|
|
1
1
|
import { mergeStyleSets } from '@fluentui/react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const getGridCellRendererStyles = (model, height) => {
|
|
5
|
-
const columnAlignment = model.getColumnAlignment();
|
|
6
|
-
const theme = model.getControlTheme();
|
|
7
|
-
const isMultiline = model.isMultiline();
|
|
8
|
-
const autoHeightEnabled = model.isAutoHeightEnabled();
|
|
9
|
-
const hasAggregationLabel = !!model.getAggregationLabel();
|
|
10
|
-
const formattedAggregatedValue = model.getFormattedAggregatedValue();
|
|
11
|
-
const value = model.getValue();
|
|
12
|
-
if (minHeight === undefined) {
|
|
13
|
-
minHeight = height;
|
|
14
|
-
}
|
|
3
|
+
const getGridCellLabelStyles = (columnAlignment, dataType, rowHeight, theme) => {
|
|
15
4
|
return mergeStyleSets({
|
|
16
|
-
|
|
17
|
-
height:
|
|
18
|
-
minHeight: autoHeightEnabled ? minHeight : undefined,
|
|
5
|
+
root: {
|
|
6
|
+
height: rowHeight,
|
|
19
7
|
paddingLeft: 8,
|
|
20
8
|
paddingRight: 8,
|
|
21
9
|
display: 'flex',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
flexDirection: 'column'
|
|
11
|
+
},
|
|
12
|
+
aggregationLabel: {
|
|
13
|
+
lineHeight: 6,
|
|
14
|
+
textAlign: columnAlignment,
|
|
15
|
+
color: theme.semanticColors.infoIcon,
|
|
16
|
+
fontSize: 12,
|
|
25
17
|
overflow: 'hidden',
|
|
26
|
-
|
|
18
|
+
textOverflow: 'ellipsis',
|
|
27
19
|
},
|
|
28
|
-
|
|
20
|
+
prefixSuffixContentWrapper: {
|
|
29
21
|
display: 'flex',
|
|
30
|
-
minWidth: 0,
|
|
31
|
-
gap: 5,
|
|
32
22
|
flexGrow: 1,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: getJustifyContent(columnAlignment),
|
|
25
|
+
gap: 10,
|
|
36
26
|
},
|
|
37
|
-
|
|
27
|
+
fileWrapper: {
|
|
38
28
|
display: 'flex',
|
|
29
|
+
gap: 5,
|
|
39
30
|
overflow: 'hidden',
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
gap: 3
|
|
31
|
+
textOverflow: 'ellipsis',
|
|
32
|
+
alignItems: 'center'
|
|
43
33
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
width: '100%',
|
|
48
|
-
textAlign: 'right',
|
|
49
|
-
color: theme.semanticColors.infoIcon,
|
|
34
|
+
contentWrapper: {
|
|
35
|
+
flexGrow: 1,
|
|
36
|
+
textAlign: columnAlignment,
|
|
50
37
|
overflow: 'hidden',
|
|
51
|
-
textOverflow: 'ellipsis'
|
|
52
|
-
padding: 'initial',
|
|
53
|
-
paddingTop: 3
|
|
38
|
+
textOverflow: 'ellipsis'
|
|
54
39
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
40
|
+
fileImage: {
|
|
41
|
+
marginRight: 5,
|
|
42
|
+
flexShrink: 0,
|
|
43
|
+
'img': {
|
|
44
|
+
width: 32
|
|
45
|
+
}
|
|
60
46
|
},
|
|
61
|
-
|
|
62
|
-
|
|
47
|
+
link: {
|
|
48
|
+
maxWidth: '100%',
|
|
63
49
|
overflow: 'hidden',
|
|
64
50
|
textOverflow: 'ellipsis',
|
|
65
|
-
|
|
66
|
-
textAlign: columnAlignment,
|
|
51
|
+
...(isMultiple(dataType) ? getMultilineStyles(rowHeight, theme) : {})
|
|
67
52
|
},
|
|
68
|
-
|
|
53
|
+
icon: {
|
|
69
54
|
'img': {
|
|
70
|
-
width:
|
|
55
|
+
width: 20
|
|
71
56
|
}
|
|
57
|
+
},
|
|
58
|
+
fileIcon: {
|
|
59
|
+
fontSize: 18
|
|
60
|
+
},
|
|
61
|
+
loadingSpinnerCircle: {
|
|
62
|
+
width: 20,
|
|
63
|
+
height: 20
|
|
72
64
|
}
|
|
73
65
|
});
|
|
74
66
|
};
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return 'flex-end';
|
|
86
|
-
}
|
|
67
|
+
const getDefaultContentRendererStyles = (theme, dataType, rowHeight) => {
|
|
68
|
+
return mergeStyleSets({
|
|
69
|
+
content: {
|
|
70
|
+
overflow: 'hidden',
|
|
71
|
+
textOverflow: 'ellipsis',
|
|
72
|
+
flexGrow: 1,
|
|
73
|
+
...(isMultiple(dataType) ? getMultilineStyles(rowHeight, theme) : {})
|
|
74
|
+
},
|
|
75
|
+
placeholder: {
|
|
76
|
+
color: theme.semanticColors.inputPlaceholderText
|
|
87
77
|
}
|
|
88
|
-
}
|
|
89
|
-
if (isMultiline) {
|
|
90
|
-
return 'flex-start';
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
return 'center';
|
|
94
|
-
}
|
|
78
|
+
});
|
|
95
79
|
};
|
|
96
80
|
const getJustifyContent = (columnAlignment) => {
|
|
97
81
|
switch (columnAlignment) {
|
|
@@ -106,6 +90,30 @@ const getJustifyContent = (columnAlignment) => {
|
|
|
106
90
|
}
|
|
107
91
|
}
|
|
108
92
|
};
|
|
93
|
+
const getMultilineStyles = (rowHeight, theme) => {
|
|
94
|
+
rowHeight = rowHeight + 1;
|
|
95
|
+
let fontSize = 20;
|
|
96
|
+
const themeFontSize = theme.fonts.medium.fontSize;
|
|
97
|
+
theme.fonts.medium.lineHeight;
|
|
98
|
+
if (typeof themeFontSize === 'number') {
|
|
99
|
+
fontSize = themeFontSize;
|
|
100
|
+
}
|
|
101
|
+
else if (typeof themeFontSize === 'string' && themeFontSize.endsWith('px')) {
|
|
102
|
+
fontSize = parseInt(themeFontSize.replace('px', ''));
|
|
103
|
+
}
|
|
104
|
+
const clamp = Math.floor(rowHeight / fontSize) - 1;
|
|
105
|
+
return {
|
|
106
|
+
lineHeight: '1.2',
|
|
107
|
+
display: '-webkit-box',
|
|
108
|
+
whiteSpace: 'normal',
|
|
109
|
+
'-webkit-box-orient': 'vertical',
|
|
110
|
+
wordBreak: 'break-all',
|
|
111
|
+
'-webkit-line-clamp': clamp.toString(),
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
const isMultiple = (dataType) => {
|
|
115
|
+
return dataType === 'Multiple' || dataType === 'SingleLine.TextArea';
|
|
116
|
+
};
|
|
109
117
|
|
|
110
|
-
export {
|
|
118
|
+
export { getDefaultContentRendererStyles, getGridCellLabelStyles };
|
|
111
119
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../src/components/GridCellRenderer/styles.ts"],"sourcesContent":["import { mergeStyleSets } from \"@fluentui/react\"\nimport { IColumn } from \"@talxis/client-libraries\";\nimport {
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../src/components/GridCellRenderer/styles.ts"],"sourcesContent":["import { mergeStyleSets } from \"@fluentui/react\"\nimport { DataType, IColumn } from \"@talxis/client-libraries\";\nimport { ITheme } from \"@talxis/react-components\";\n\nexport const getGridCellLabelStyles = (columnAlignment: IColumn['alignment'], dataType: DataType, rowHeight: number, theme: ITheme) => {\n return mergeStyleSets({\n root: {\n height: rowHeight,\n paddingLeft: 8,\n paddingRight: 8,\n display: 'flex',\n flexDirection: 'column'\n },\n aggregationLabel: {\n lineHeight: 6,\n textAlign: columnAlignment,\n color: theme.semanticColors.infoIcon,\n fontSize: 12,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n prefixSuffixContentWrapper: {\n display: 'flex',\n flexGrow: 1,\n alignItems: 'center',\n justifyContent: getJustifyContent(columnAlignment),\n gap: 10,\n\n },\n fileWrapper: {\n display: 'flex',\n gap: 5,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n alignItems: 'center'\n },\n contentWrapper: {\n flexGrow: 1,\n textAlign: columnAlignment,\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n },\n fileImage: {\n marginRight: 5,\n flexShrink: 0,\n 'img': {\n width: 32\n }\n },\n link: {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n ...(isMultiple(dataType) ? getMultilineStyles(rowHeight, theme) : {})\n },\n icon: {\n 'img': {\n width: 20\n }\n },\n fileIcon: {\n fontSize: 18\n },\n loadingSpinnerCircle: {\n width: 20,\n height: 20\n }\n })\n}\nexport const getDefaultContentRendererStyles = (theme: ITheme, dataType: DataType, rowHeight: number) => {\n return mergeStyleSets({\n content: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n flexGrow: 1,\n ...(isMultiple(dataType) ? getMultilineStyles(rowHeight, theme) : {})\n },\n placeholder: {\n color: theme.semanticColors.inputPlaceholderText\n }\n });\n}\n\nconst getJustifyContent = (columnAlignment: IColumn['alignment']) => {\n switch (columnAlignment) {\n case 'left': {\n return 'flex-start';\n }\n case 'center': {\n return 'center';\n }\n case 'right': {\n return 'flex-end';\n }\n }\n}\n\nconst getMultilineStyles = (rowHeight: number, theme: ITheme) => {\n rowHeight = rowHeight + 1;\n let fontSize = 20;\n const themeFontSize = theme.fonts.medium.fontSize;\n theme.fonts.medium.lineHeight\n if (typeof themeFontSize === 'number') {\n fontSize = themeFontSize;\n }\n else if (typeof themeFontSize === 'string' && themeFontSize.endsWith('px')) {\n fontSize = parseInt(themeFontSize.replace('px', ''));\n }\n const clamp = Math.floor(rowHeight / fontSize) - 1;\n return {\n lineHeight: '1.2',\n display: '-webkit-box',\n whiteSpace: 'normal',\n '-webkit-box-orient': 'vertical',\n wordBreak: 'break-all',\n '-webkit-line-clamp': clamp.toString(),\n };\n}\n\nconst isMultiple = (dataType: DataType) => {\n return dataType === 'Multiple' || dataType === 'SingleLine.TextArea';\n}\n"],"names":[],"mappings":";;AAIO,MAAM,sBAAsB,GAAG,CAAC,eAAqC,EAAE,QAAkB,EAAE,SAAiB,EAAE,KAAa,KAAI;AAClI,IAAA,OAAO,cAAc,CAAC;AAClB,QAAA,IAAI,EAAE;AACF,YAAA,MAAM,EAAE,SAAS;AACjB,YAAA,WAAW,EAAE,CAAC;AACd,YAAA,YAAY,EAAE,CAAC;AACf,YAAA,OAAO,EAAE,MAAM;AACf,YAAA,aAAa,EAAE,QAAQ;AAC1B,SAAA;AACD,QAAA,gBAAgB,EAAE;AACd,YAAA,UAAU,EAAE,CAAC;AACb,YAAA,SAAS,EAAE,eAAe;AAC1B,YAAA,KAAK,EAAE,KAAK,C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|
8
|
+
1029: 'Maximum',
|
|
9
|
+
1033: 'Maximum'
|
|
10
|
+
},
|
|
11
|
+
min: {
|
|
12
|
+
1029: 'Minimum',
|
|
13
|
+
1033: 'Minimum'
|
|
14
|
+
},
|
|
15
|
+
avg: {
|
|
16
|
+
1029: 'Průměr',
|
|
17
|
+
1033: 'Average'
|
|
18
|
+
},
|
|
19
|
+
sum: {
|
|
20
|
+
1029: 'Součet',
|
|
21
|
+
1033: 'Sum'
|
|
22
|
+
},
|
|
23
|
+
count: {
|
|
24
|
+
1029: 'Počet (včetně prázdných hodnot)',
|
|
25
|
+
1033: 'Count (including empty values)'
|
|
26
|
+
},
|
|
27
|
+
countcolumn: {
|
|
28
|
+
1029: 'Počet',
|
|
29
|
+
1033: 'Count'
|
|
30
|
+
}
|
|
31
|
+
};
|
|
30
32
|
};
|
|
31
33
|
|
|
32
|
-
export {
|
|
34
|
+
export { getDefaultGridRendererTranslations };
|
|
33
35
|
//# sourceMappingURL=translations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.js","sources":["../../../src/components/GridCellRenderer/translations.ts"],"sourcesContent":["export const
|
|
1
|
+
{"version":3,"file":"translations.js","sources":["../../../src/components/GridCellRenderer/translations.ts"],"sourcesContent":["export const getDefaultGridRendererTranslations = () => {\n return {\n download: {\n 1029: 'Stáhnout',\n 1033: 'Download'\n },\n max: {\n 1029: 'Maximum',\n 1033: 'Maximum'\n },\n min: {\n 1029: 'Minimum',\n 1033: 'Minimum'\n },\n avg: {\n 1029: 'Průměr',\n 1033: 'Average'\n },\n sum: {\n 1029: 'Součet',\n 1033: 'Sum'\n },\n count: {\n 1029: 'Počet (včetně prázdných hodnot)',\n 1033: 'Count (including empty values)'\n },\n countcolumn: {\n 1029: 'Počet',\n 1033: 'Count'\n }\n }\n};"],"names":[],"mappings":"AAAO,MAAM,kCAAkC,GAAG,MAAK;IACnD,OAAO;AACH,QAAA,QAAQ,EAAE;AACN,YAAA,IAAI,EAAE,UAAU;AAChB,YAAA,IAAI,EAAE,UAAU;AACnB,SAAA;AACD,QAAA,GAAG,EAAE;AACD,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,IAAI,EAAE,SAAS;AAClB,SAAA;AACD,QAAA,GAAG,EAAE;AACD,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,IAAI,EAAE,SAAS;AAClB,SAAA;AACD,QAAA,GAAG,EAAE;AACD,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,IAAI,EAAE,SAAS;AAClB,SAAA;AACD,QAAA,GAAG,EAAE;AACD,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,IAAI,EAAE,KAAK;AACd,SAAA;AACD,QAAA,KAAK,EAAE;AACH,YAAA,IAAI,EAAE,iCAAiC;AACvC,YAAA,IAAI,EAAE,gCAAgC;AACzC,SAAA;AACD,QAAA,WAAW,EAAE;AACT,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,IAAI,EAAE,OAAO;AAChB,SAAA;KACJ,CAAA;AACL;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IGridCellRendererComponentProps } from "./interfaces";
|
|
3
|
+
export declare const ComponentPropsContext: import("react").Context<{
|
|
4
|
+
current: IGridCellRendererComponentProps;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const useComponentProps: () => IGridCellRendererComponentProps;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const ComponentPropsContext = createContext({});
|
|
4
|
+
const useComponentProps = () => {
|
|
5
|
+
const context = useContext(ComponentPropsContext);
|
|
6
|
+
return context.current;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { ComponentPropsContext, useComponentProps };
|
|
10
|
+
//# sourceMappingURL=useComponentProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useComponentProps.js","sources":["../../../src/components/GridCellRenderer/useComponentProps.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport { IGridCellRendererComponentProps } from \"./interfaces\";\n\n\nexport const ComponentPropsContext = createContext<{\n current: IGridCellRendererComponentProps\n}>({} as any);\n\nexport const useComponentProps = () => {\n const context = useContext(ComponentPropsContext);\n return context.current;\n}"],"names":[],"mappings":";;MAIa,qBAAqB,GAAG,aAAa,CAE/C,EAAS,EAAE;AAEP,MAAM,iBAAiB,GAAG,MAAK;AAClC,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAClD,OAAO,OAAO,CAAC,OAAO,CAAC;AAC3B;;;;"}
|
|
@@ -109,7 +109,7 @@ const Lookup = (props) => {
|
|
|
109
109
|
targetEntityName = result.layout.Rows.find(x => x.Cells.find(y => y.Name === attribute))?.Cells?.find(y => y.Name === attribute)?.RelatedEntityName || metadata.LogicalName;
|
|
110
110
|
targetAttribute = attribute.split(".")[1];
|
|
111
111
|
}
|
|
112
|
-
const entityMetadata = await
|
|
112
|
+
const entityMetadata = await window.Xrm.Utility.getEntityMetadata(targetEntityName, [targetAttribute]);
|
|
113
113
|
const attributetype = entityMetadata.Attributes.get(targetAttribute).AttributeTypeName;
|
|
114
114
|
let primaryName;
|
|
115
115
|
switch (attributetype) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lookup.js","sources":["../../../src/components/Lookup/Lookup.tsx"],"sourcesContent":["\nimport { ILayout, ILookup, IMetadata } from \"./interfaces\";\nimport { useLookup } from \"./hooks/useLookup\";\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { ThemeProvider } from \"@fluentui/react\";\nimport { IItemProps, TagPicker } from \"@talxis/react-components\";\nimport { TargetSelector } from \"./components/TargetSelector\";\nimport { useMouseOver } from \"../../hooks/useMouseOver\";\nimport { getLookupStyles, getSuggestionsCalloutStyles } from \"./styles\";\nimport { IBasePicker } from \"@fluentui/react/lib/components/pickers/BasePicker.types\";\nimport { ITag } from \"@fluentui/react/lib/components/pickers/TagPicker/TagPicker.types\";\nimport { RecordCreator } from \"./components/RecordCreator\";\nimport { useFocusIn } from \"../../hooks/useFocusIn\";\nimport { useControlSizing } from \"../../hooks/useControlSizing\";\nimport dayjs from \"dayjs\";\n\nexport const Lookup = (props: ILookup) => {\n const context = props.context;\n const ref = useRef<HTMLDivElement>(null);\n const componentRef = useRef<IBasePicker<ITag>>(null);\n const itemLimit = props.parameters.MultipleEnabled?.raw === true ? Infinity : 1\n const { height } = useControlSizing(props.context.mode);\n const [value, entities, labels, records, selectEntity, getSearchResults, theme] = useLookup(props);\n const styles = getLookupStyles(theme, itemLimit === 1, height);\n const suggestionsCalloutTheme = props.context.fluentDesignLanguage?.applicationTheme ?? theme;\n const suggestionsCalloutStyles = useMemo(() => getSuggestionsCalloutStyles(suggestionsCalloutTheme), [suggestionsCalloutTheme])\n const mouseOver = useMouseOver(ref);\n const isFocused = useFocusIn(ref, 100);\n const firstRenderRef = useRef(true);\n const shouldFocusRef = useRef(false);\n const [placeholder, setPlaceholder] = useState('---');\n const onOverrideComponentProps = props.onOverrideComponentProps ?? ((props) => props);\n\n\n useEffect(() => {\n if (firstRenderRef.current) {\n firstRenderRef.current = false;\n return;\n }\n //@ts-ignore\n if (componentRef.current.state.suggestionsVisible) {\n //if the suggestions callout is open and the selected target changes, refresh the results\n forceSearch();\n }\n }, [entities])\n\n useEffect(() => {\n const onKeyPress = (ev: KeyboardEvent) => {\n if (context.mode.isControlDisabled) {\n return;\n }\n if (ev.key === 'Backspace') {\n const picker = ref.current?.querySelector('[class*=\"TALXIS__tag-picker__root\"]');\n if ((document.activeElement === picker) && value.length === 1) {\n records.select(undefined);\n setTimeout(() => {\n componentRef.current?.focusInput()\n }, 200)\n }\n }\n }\n document.addEventListener('keydown', onKeyPress)\n return () => {\n document.removeEventListener('keydown', onKeyPress);\n }\n }, [value]);\n\n useEffect(() => {\n if (props.parameters.AutoFocus?.raw === true) {\n focus();\n }\n }, []);\n\n const focus = () => {\n if (componentRef.current?.items?.length === itemLimit) {\n const el = ref.current?.querySelector(':scope>div') as HTMLDivElement;\n el?.click();\n el?.focus();\n return;\n }\n componentRef.current?.focusInput();\n }\n\n const forceSearch = async () => {\n //@ts-ignore - We need to use internal methods to show and fill the suggestions on entity change\n componentRef.current.suggestionStore.updateSuggestions([]);\n //@ts-ignore - ^^same as above\n componentRef.current.setState({\n suggestionsVisible: true,\n suggestionsLoading: true,\n });\n //@ts-ignore - ^^same as above\n const results = await onResolveSuggestions(componentRef.current.input.current.value)\n //@ts-ignore - ^^same as above\n componentRef.current.updateSuggestionsList(results);\n //@ts-ignore - ^^same above\n componentRef.current.setState({\n isMostRecentlyUsedVisible: false,\n suggestionsVisible: true,\n moreSuggestionsAvailable: false,\n });\n }\n\n const isComponentActive = () => {\n return mouseOver || isFocused;\n }\n\n const getSecondaryName = async (result: ComponentFramework.LookupValue & {\n entityData: {\n [key: string]: any;\n };\n layout: ILayout;\n }): Promise<string | undefined> => {\n const metadata = await entities.find(x => x.entityName === result.entityType)?.metadata;\n const attribute: string | undefined = result.layout?.Rows?.[0]?.Cells?.[1]?.Name;\n //polymorphic, selected all\n if (!entities.find(x => x.selected)) {\n return metadata?.DisplayName;\n }\n else if (metadata?.LogicalName && attribute) {\n let targetEntityName = metadata.LogicalName;\n let targetAttribute = attribute;\n //checking for attributes pointing to related entity attribute, given by convention of using dot as separator\n if (attribute.includes(\".\")) {\n targetEntityName = result.layout.Rows.find(x => x.Cells.find(y => y.Name === attribute))?.Cells?.find(y => y.Name === attribute)?.RelatedEntityName || metadata.LogicalName;\n targetAttribute = attribute.split(\".\")[1]\n }\n const entityMetadata: ComponentFramework.PropertyHelper.EntityMetadata = await props.context.utils.getEntityMetadata(targetEntityName, [targetAttribute]);\n const attributetype: string = entityMetadata.Attributes.get(targetAttribute).AttributeTypeName;\n let primaryName: string;\n switch (attributetype) {\n case \"lookup\":\n case \"partylist\":\n case \"owner\":\n case \"customer\":\n primaryName = result.entityData[`_${targetAttribute}_value@OData.Community.Display.V1.FormattedValue`];\n break;\n case \"optionset\":\n case \"picklist\":\n case \"state\":\n case \"status\":\n case \"boolean\":\n case \"integer\":\n case \"bigint\":\n case \"decimal\":\n case \"money\":\n //TODO: Introduce user formatting, this approach takes format from application user setting\n primaryName = result.entityData[`${targetAttribute}@OData.Community.Display.V1.FormattedValue`];\n break;\n case \"datetime\":\n primaryName = props.context.formatting.formatTime(dayjs(result.entityData[attribute]).toDate(), 1);\n break;\n default:\n primaryName = result.entityData[attribute];\n };\n return primaryName;\n }\n }\n\n const onResolveSuggestions = async (filter: string, selectedItems?: IItemProps[] | undefined): Promise<IItemProps[]> => {\n //TODO: onResolveSuggestions gets called when the record gets selected resulting in unnecessary call\n const results = await getSearchResults(filter);\n const suggestions: IItemProps[] = [];\n for (const result of results) {\n if (selectedItems?.find(x => x.key === result.id)) {\n continue;\n }\n suggestions.push({\n key: result.id,\n text: result.name,\n secondaryText: await getSecondaryName(result),\n 'data-entity': result.entityType\n })\n }\n return suggestions;\n }\n\n const componentProps = onOverrideComponentProps({\n ref: componentRef,\n readOnly: context.mode.isControlDisabled,\n resolveDelay: 200,\n stackItems: itemLimit === 1,\n errorMessage: props.parameters.value.errorMessage,\n hideErrorMessage: !props.parameters.ShowErrorMessage?.raw,\n pickerCalloutProps: {\n layerProps: {\n eventBubblingEnabled: true\n },\n className: suggestionsCalloutStyles.suggestionsCallout,\n theme: suggestionsCalloutTheme,\n },\n inputProps: {\n placeholder: placeholder,\n onMouseEnter: () => {\n if (context.mode.isControlDisabled) {\n return;\n }\n setPlaceholder(`${labels.placeholder()} ${props.parameters.value.attributes.DisplayName}`);\n },\n onMouseLeave: () => {\n setPlaceholder(\"---\");\n }\n\n },\n pickerSuggestionsProps: {\n loadingText: labels.searching(),\n theme: suggestionsCalloutTheme,\n noResultsFoundText: labels.noRecordsFound(),\n className: suggestionsCalloutStyles.suggestionsContainer,\n // @ts-ignore\n suggestionsHeaderText: (\n <>\n {props.parameters.IsInlineNewEnabled?.raw !== false && (\n <RecordCreator labels={labels} entities={entities} onCreateRecord={records.create} />\n )}\n {props.parameters.value.attributes.Targets.length > 1 && (\n <TargetSelector\n labels={labels}\n entities={entities}\n onEntitySelected={(entityName) => {\n selectEntity(entityName);\n }}\n />\n )}\n </>\n )\n },\n transparent: itemLimit === 1,\n onChange: (items) => {\n records.select(\n items?.map((item) => {\n return {\n entityType: item['data-entity'],\n id: item.key,\n name: item.text\n };\n })\n );\n },\n searchBtnProps: {\n key: 'search',\n iconProps: {\n iconName: 'Search'\n },\n showOnlyOnHover: true\n },\n selectedItems: value.map((lookup) => {\n return {\n key: lookup.id,\n text: lookup.name || labels.noName(),\n 'data-entity': lookup.entityType,\n 'data-navigation-enabled': props.parameters.EnableNavigation?.raw !== false,\n onClick: () => {\n if (props.parameters.EnableNavigation?.raw === false) {\n return;\n }\n context.navigation.openForm({\n entityName: lookup.entityType,\n entityId: lookup.id\n });\n },\n deleteButtonProps:\n isComponentActive() || itemLimit > 1\n ? {\n key: 'delete',\n iconProps: {\n iconName: 'Cancel',\n },\n onClick: () => {\n shouldFocusRef.current = false;\n records.deselect(lookup);\n setTimeout(() => {\n focus();\n }, 200);\n }\n }\n : undefined\n };\n }),\n itemLimit: itemLimit,\n onEmptyResolveSuggestions: !context.mode.isControlDisabled ? (selectedItems) => onResolveSuggestions(\"\", selectedItems as IItemProps[]) as any : undefined,\n onResolveSuggestions: onResolveSuggestions,\n });\n\n return (\n <ThemeProvider applyTo=\"none\" theme={theme} className={`talxis__lookupControl ${styles.root}`} ref={ref}>\n <TagPicker {...componentProps} />\n </ThemeProvider>\n );\n};"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;AAgBa,MAAA,MAAM,GAAG,CAAC,KAAc,KAAI;AACrC,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAC9B,IAAA,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AACzC,IAAA,MAAM,YA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AA,CAAC,aAAa,EAAA,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA,sBAAA,EAAyB,MAAM,CAAC,IAAI,CAAA,CAAE,EAAE,GAAG,EAAE,GAAG,EAAA,QAAA,EACnGA,GAAC,CAAA,SAAS,EAAK,EAAA,GAAA,cAAc,EAAI,CAAA,EAAA,CACrB,EAClB;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"Lookup.js","sources":["../../../src/components/Lookup/Lookup.tsx"],"sourcesContent":["\nimport { ILayout, ILookup, IMetadata } from \"./interfaces\";\nimport { useLookup } from \"./hooks/useLookup\";\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { ThemeProvider } from \"@fluentui/react\";\nimport { IItemProps, TagPicker } from \"@talxis/react-components\";\nimport { TargetSelector } from \"./components/TargetSelector\";\nimport { useMouseOver } from \"../../hooks/useMouseOver\";\nimport { getLookupStyles, getSuggestionsCalloutStyles } from \"./styles\";\nimport { IBasePicker } from \"@fluentui/react/lib/components/pickers/BasePicker.types\";\nimport { ITag } from \"@fluentui/react/lib/components/pickers/TagPicker/TagPicker.types\";\nimport { RecordCreator } from \"./components/RecordCreator\";\nimport { useFocusIn } from \"../../hooks/useFocusIn\";\nimport { useControlSizing } from \"../../hooks/useControlSizing\";\nimport dayjs from \"dayjs\";\n\nexport const Lookup = (props: ILookup) => {\n const context = props.context;\n const ref = useRef<HTMLDivElement>(null);\n const componentRef = useRef<IBasePicker<ITag>>(null);\n const itemLimit = props.parameters.MultipleEnabled?.raw === true ? Infinity : 1\n const { height } = useControlSizing(props.context.mode);\n const [value, entities, labels, records, selectEntity, getSearchResults, theme] = useLookup(props);\n const styles = getLookupStyles(theme, itemLimit === 1, height);\n const suggestionsCalloutTheme = props.context.fluentDesignLanguage?.applicationTheme ?? theme;\n const suggestionsCalloutStyles = useMemo(() => getSuggestionsCalloutStyles(suggestionsCalloutTheme), [suggestionsCalloutTheme])\n const mouseOver = useMouseOver(ref);\n const isFocused = useFocusIn(ref, 100);\n const firstRenderRef = useRef(true);\n const shouldFocusRef = useRef(false);\n const [placeholder, setPlaceholder] = useState('---');\n const onOverrideComponentProps = props.onOverrideComponentProps ?? ((props) => props);\n\n\n useEffect(() => {\n if (firstRenderRef.current) {\n firstRenderRef.current = false;\n return;\n }\n //@ts-ignore\n if (componentRef.current.state.suggestionsVisible) {\n //if the suggestions callout is open and the selected target changes, refresh the results\n forceSearch();\n }\n }, [entities])\n\n useEffect(() => {\n const onKeyPress = (ev: KeyboardEvent) => {\n if (context.mode.isControlDisabled) {\n return;\n }\n if (ev.key === 'Backspace') {\n const picker = ref.current?.querySelector('[class*=\"TALXIS__tag-picker__root\"]');\n if ((document.activeElement === picker) && value.length === 1) {\n records.select(undefined);\n setTimeout(() => {\n componentRef.current?.focusInput()\n }, 200)\n }\n }\n }\n document.addEventListener('keydown', onKeyPress)\n return () => {\n document.removeEventListener('keydown', onKeyPress);\n }\n }, [value]);\n\n useEffect(() => {\n if (props.parameters.AutoFocus?.raw === true) {\n focus();\n }\n }, []);\n\n const focus = () => {\n if (componentRef.current?.items?.length === itemLimit) {\n const el = ref.current?.querySelector(':scope>div') as HTMLDivElement;\n el?.click();\n el?.focus();\n return;\n }\n componentRef.current?.focusInput();\n }\n\n const forceSearch = async () => {\n //@ts-ignore - We need to use internal methods to show and fill the suggestions on entity change\n componentRef.current.suggestionStore.updateSuggestions([]);\n //@ts-ignore - ^^same as above\n componentRef.current.setState({\n suggestionsVisible: true,\n suggestionsLoading: true,\n });\n //@ts-ignore - ^^same as above\n const results = await onResolveSuggestions(componentRef.current.input.current.value)\n //@ts-ignore - ^^same as above\n componentRef.current.updateSuggestionsList(results);\n //@ts-ignore - ^^same above\n componentRef.current.setState({\n isMostRecentlyUsedVisible: false,\n suggestionsVisible: true,\n moreSuggestionsAvailable: false,\n });\n }\n\n const isComponentActive = () => {\n return mouseOver || isFocused;\n }\n\n const getSecondaryName = async (result: ComponentFramework.LookupValue & {\n entityData: {\n [key: string]: any;\n };\n layout: ILayout;\n }): Promise<string | undefined> => {\n const metadata = await entities.find(x => x.entityName === result.entityType)?.metadata;\n const attribute: string | undefined = result.layout?.Rows?.[0]?.Cells?.[1]?.Name;\n //polymorphic, selected all\n if (!entities.find(x => x.selected)) {\n return metadata?.DisplayName;\n }\n else if (metadata?.LogicalName && attribute) {\n let targetEntityName = metadata.LogicalName;\n let targetAttribute = attribute;\n //checking for attributes pointing to related entity attribute, given by convention of using dot as separator\n if (attribute.includes(\".\")) {\n targetEntityName = result.layout.Rows.find(x => x.Cells.find(y => y.Name === attribute))?.Cells?.find(y => y.Name === attribute)?.RelatedEntityName || metadata.LogicalName;\n targetAttribute = attribute.split(\".\")[1]\n }\n const entityMetadata: ComponentFramework.PropertyHelper.EntityMetadata = await window.Xrm.Utility.getEntityMetadata(targetEntityName, [targetAttribute]);\n const attributetype: string = entityMetadata.Attributes.get(targetAttribute).AttributeTypeName;\n let primaryName: string;\n switch (attributetype) {\n case \"lookup\":\n case \"partylist\":\n case \"owner\":\n case \"customer\":\n primaryName = result.entityData[`_${targetAttribute}_value@OData.Community.Display.V1.FormattedValue`];\n break;\n case \"optionset\":\n case \"picklist\":\n case \"state\":\n case \"status\":\n case \"boolean\":\n case \"integer\":\n case \"bigint\":\n case \"decimal\":\n case \"money\":\n //TODO: Introduce user formatting, this approach takes format from application user setting\n primaryName = result.entityData[`${targetAttribute}@OData.Community.Display.V1.FormattedValue`];\n break;\n case \"datetime\":\n primaryName = props.context.formatting.formatTime(dayjs(result.entityData[attribute]).toDate(), 1);\n break;\n default:\n primaryName = result.entityData[attribute];\n };\n return primaryName;\n }\n }\n\n const onResolveSuggestions = async (filter: string, selectedItems?: IItemProps[] | undefined): Promise<IItemProps[]> => {\n //TODO: onResolveSuggestions gets called when the record gets selected resulting in unnecessary call\n const results = await getSearchResults(filter);\n const suggestions: IItemProps[] = [];\n for (const result of results) {\n if (selectedItems?.find(x => x.key === result.id)) {\n continue;\n }\n suggestions.push({\n key: result.id,\n text: result.name,\n secondaryText: await getSecondaryName(result),\n 'data-entity': result.entityType\n })\n }\n return suggestions;\n }\n\n const componentProps = onOverrideComponentProps({\n ref: componentRef,\n readOnly: context.mode.isControlDisabled,\n resolveDelay: 200,\n stackItems: itemLimit === 1,\n errorMessage: props.parameters.value.errorMessage,\n hideErrorMessage: !props.parameters.ShowErrorMessage?.raw,\n pickerCalloutProps: {\n layerProps: {\n eventBubblingEnabled: true\n },\n className: suggestionsCalloutStyles.suggestionsCallout,\n theme: suggestionsCalloutTheme,\n },\n inputProps: {\n placeholder: placeholder,\n onMouseEnter: () => {\n if (context.mode.isControlDisabled) {\n return;\n }\n setPlaceholder(`${labels.placeholder()} ${props.parameters.value.attributes.DisplayName}`);\n },\n onMouseLeave: () => {\n setPlaceholder(\"---\");\n }\n\n },\n pickerSuggestionsProps: {\n loadingText: labels.searching(),\n theme: suggestionsCalloutTheme,\n noResultsFoundText: labels.noRecordsFound(),\n className: suggestionsCalloutStyles.suggestionsContainer,\n // @ts-ignore\n suggestionsHeaderText: (\n <>\n {props.parameters.IsInlineNewEnabled?.raw !== false && (\n <RecordCreator labels={labels} entities={entities} onCreateRecord={records.create} />\n )}\n {props.parameters.value.attributes.Targets.length > 1 && (\n <TargetSelector\n labels={labels}\n entities={entities}\n onEntitySelected={(entityName) => {\n selectEntity(entityName);\n }}\n />\n )}\n </>\n )\n },\n transparent: itemLimit === 1,\n onChange: (items) => {\n records.select(\n items?.map((item) => {\n return {\n entityType: item['data-entity'],\n id: item.key,\n name: item.text\n };\n })\n );\n },\n searchBtnProps: {\n key: 'search',\n iconProps: {\n iconName: 'Search'\n },\n showOnlyOnHover: true\n },\n selectedItems: value.map((lookup) => {\n return {\n key: lookup.id,\n text: lookup.name || labels.noName(),\n 'data-entity': lookup.entityType,\n 'data-navigation-enabled': props.parameters.EnableNavigation?.raw !== false,\n onClick: () => {\n if (props.parameters.EnableNavigation?.raw === false) {\n return;\n }\n context.navigation.openForm({\n entityName: lookup.entityType,\n entityId: lookup.id\n });\n },\n deleteButtonProps:\n isComponentActive() || itemLimit > 1\n ? {\n key: 'delete',\n iconProps: {\n iconName: 'Cancel',\n },\n onClick: () => {\n shouldFocusRef.current = false;\n records.deselect(lookup);\n setTimeout(() => {\n focus();\n }, 200);\n }\n }\n : undefined\n };\n }),\n itemLimit: itemLimit,\n onEmptyResolveSuggestions: !context.mode.isControlDisabled ? (selectedItems) => onResolveSuggestions(\"\", selectedItems as IItemProps[]) as any : undefined,\n onResolveSuggestions: onResolveSuggestions,\n });\n\n return (\n <ThemeProvider applyTo=\"none\" theme={theme} className={`talxis__lookupControl ${styles.root}`} ref={ref}>\n <TagPicker {...componentProps} />\n </ThemeProvider>\n );\n};"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;AAgBa,MAAA,MAAM,GAAG,CAAC,KAAc,KAAI;AACrC,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAC9B,IAAA,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AACzC,IAAA,MAAM,YAAY,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;AACrD,IAAA,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,GAAG,KAAK,IAAI,GAAG,QAAQ,GAAG,CAAC,CAAA;AAC/E,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AACnG,IAAA,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,EAAE,SAAS,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/D,MAAM,uBAAuB,GAAG,KAAK,CAAC,OAAO,CAA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,EACb,iBAAiB,EAAE,IAAI,SAAS,GAAG,CAAC;AAChC,sBAAE;AACE,wBAAA,GAAG,EAAE,QAAQ;AACb,wBAAA,SAAS,EAAE;AACP,4BAAA,QAAQ,EAAE,QAAQ;AACrB,yBAAA;wBACD,OAAO,EAAE,MAAK;AACV,4BAAA,cAAc,CAAC,OAAO,GAAG,KAAK,CAAC;AAC/B,4BAAA,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;4BACzB,UAAU,CAAC,MAAK;AACZ,gCAAA,KAAK,EAAE,CAAC;6BACX,EAAE,GAAG,CAAC,CAAC;yBACX;AACJ,qBAAA;AACD,sBAAE,SAAS;aACtB,CAAC;AACN,SAAC,CAAC;AACF,QAAA,SAAS,EAAE,SAAS;QACpB,yBAAyB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,GAAG,CAAC,aAAa,KAAK,oBAAoB,CAAC,EAAE,EAAE,aAA6B,CAAQ,GAAG,SAAS;AAC1J,QAAA,oBAAoB,EAAE,oBAAoB;AAC7C,KAAA,CAAC,CAAC;AAEH,IAAA,QACIA,GAAA,CAAC,aAAa,EAAA,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA,sBAAA,EAAyB,MAAM,CAAC,IAAI,CAAA,CAAE,EAAE,GAAG,EAAE,GAAG,EAAA,QAAA,EACnGA,GAAC,CAAA,SAAS,EAAK,EAAA,GAAA,cAAc,EAAI,CAAA,EAAA,CACrB,EAClB;AACN;;;;"}
|
|
@@ -15,7 +15,7 @@ const useLookup = (props) => {
|
|
|
15
15
|
return {
|
|
16
16
|
entityName: target,
|
|
17
17
|
selected: targets.length === 1 ? true : false,
|
|
18
|
-
metadata:
|
|
18
|
+
metadata: window.Xrm.Utility.getEntityMetadata(target, []),
|
|
19
19
|
};
|
|
20
20
|
});
|
|
21
21
|
});
|
|
@@ -115,7 +115,7 @@ const useLookup = (props) => {
|
|
|
115
115
|
targetEntityName = layout.Rows.find(x => x.Cells)?.Cells?.find(y => y.Name === attribute)?.RelatedEntityName || entityName;
|
|
116
116
|
targetAttribute = attribute.split(".")[1];
|
|
117
117
|
}
|
|
118
|
-
const entityMetadata = await
|
|
118
|
+
const entityMetadata = await window.Xrm.Utility.getEntityMetadata(targetEntityName, [targetAttribute]);
|
|
119
119
|
const attributetype = entityMetadata.Attributes.get(targetAttribute).AttributeTypeName;
|
|
120
120
|
let primaryName;
|
|
121
121
|
switch (attributetype.toLowerCase()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLookup.js","sources":["../../../../src/components/Lookup/hooks/useLookup.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { ITranslation, useControl } from \"../../../hooks\";\nimport { IEntity, ILayout, ILookup, IMetadata } from \"../interfaces\";\nimport { lookupTranslations } from \"../translations\";\nimport { useFetchXml } from \"./useFetchXml\";\nimport { ITheme } from \"@talxis/react-components\";\nimport dayjs from \"dayjs\";\n\nexport const useLookup = (props: ILookup): [\n ComponentFramework.LookupValue[],\n IEntity[],\n ITranslation<Required<ILookup>['translations']>,\n {\n create: (entityName: string) => void,\n select: (record: ComponentFramework.LookupValue[] | undefined) => void,\n deselect: (record: ComponentFramework.LookupValue) => void,\n },\n (entityName: string | null) => void,\n (query: string) => Promise<(ComponentFramework.LookupValue & { entityData: { [key: string]: any }, layout: ILayout })[]>,\n ITheme\n] => {\n\n const targets = props.parameters.value.attributes.Targets;\n const boundValue = props.parameters.value.raw;\n const context = props.context;\n const { labels, theme, onNotifyOutputChanged } = useControl('Lookup', props, lookupTranslations);\n const [getFetchXml, applyLookupQuery] = useFetchXml(context);\n\n const [entities, setEntities] = useState<IEntity[]>(() => {\n return targets.map(target => {\n return {\n entityName: target,\n selected: targets.length === 1 ? true : false,\n metadata: props.context.utils.getEntityMetadata(target, []) as any,\n }\n })\n });\n\n const selectedEntity = entities.find(x => x.selected);\n\n const selectEntity = (entityName: string | null) => {\n setEntities([...entities as IEntity[]].map(entity => {\n return {\n entityName: entity.entityName,\n metadata: entity.metadata,\n selected: entity.entityName === entityName\n }\n }))\n }\n\n const selectRecords = (records: ComponentFramework.LookupValue[] | undefined) => {\n onNotifyOutputChanged({\n value: records\n })\n }\n const getSearchFetchXml = async (entityName: string, query: string, viewIdCallBack: (id: string) => void): Promise<string> => {\n const response = (await props.parameters.value.getAllViews(entityName)).find(x => x.isDefault);\n if (!response?.viewId) {\n throw new Error(`Entity ${entityName} does not have a default view id!`);\n }\n viewIdCallBack(response.viewId);\n let fetchXml = response?.fetchXml\n if (!fetchXml) {\n fetchXml = (await getFetchXml(response.viewId)).fetchxml;\n }\n return applyLookupQuery(entities.find(x => x.entityName === entityName)!, fetchXml, query);\n\n }\n const getSearchResults = async (query: string): Promise<(ComponentFramework.LookupValue & { entityData: { [key: string]: any }, layout: ILayout })[]> => {\n if (props.onSearch) {\n return props.onSearch(selectedEntity ? [selectedEntity?.entityName] : targets, query) as any;\n }\n const fetchXmlMap = new Map<string, Promise<string>>();\n const entityViewIdMap = new Map<string, string>();\n if (selectedEntity) {\n fetchXmlMap.set(selectedEntity.entityName, getSearchFetchXml(selectedEntity.entityName, query, (viewId) => entityViewIdMap.set(selectedEntity.entityName, viewId)))\n }\n else {\n for (const entity of targets) {\n fetchXmlMap.set(entity, getSearchFetchXml(entity, query, (viewId) => entityViewIdMap.set(entity, viewId)))\n }\n }\n await Promise.all(fetchXmlMap.values());\n const responsePromiseMap = new Map<string, Promise<ComponentFramework.WebApi.RetrieveMultipleResponse>>()\n const aliasEntityMap: { aliasAttribute: string, entityAttribute: string }[] = [];\n const domParser = new DOMParser();\n for (const [entityName, fetchXml] of fetchXmlMap) {\n const fetchXMLresult = await fetchXml;\n responsePromiseMap.set(entityName, context.webAPI.retrieveMultipleRecords(entityName, `?$top=25&fetchXml=${encodeURIComponent((fetchXMLresult))}`))\n //parsing of link entities from fetchXML\n const xml = domParser.parseFromString(fetchXMLresult, \"application/xml\");\n const linkEntities = xml.querySelectorAll(`link-entity`);\n for (const linkEntity of linkEntities) {\n const aliasAttribute = linkEntity.getAttribute('alias');\n const entityAttribute = linkEntity.getAttribute('name');\n if (entityAttribute) {\n aliasEntityMap.push({ aliasAttribute: aliasAttribute ?? entityAttribute, entityAttribute: entityAttribute })\n }\n else {\n throw Error(\"Link-entity without name property is not supported. Offedning query: \" + fetchXMLresult);\n }\n }\n }\n await Promise.all(responsePromiseMap.values());\n const result: (ComponentFramework.LookupValue & { entityData: { [key: string]: any }, layout: ILayout })[] = [];\n for (const [entityName, response] of responsePromiseMap) {\n const layout: ILayout = JSON.parse((await getFetchXml(entityViewIdMap.get(entityName)!)).layoutjson ?? \"{}\");\n //Mapping link-entities' logical names to layout's Cell \n if (layout.Rows.some(x => x.Cells.some(x => x.Name.includes(\".\")))) {\n const cellsToModify = layout.Rows.flatMap(row => row.Cells)\n .filter(cell => cell.Name.includes(\".\"));\n\n cellsToModify.forEach(cell => {\n const alias = cell.Name.split(\".\")[0]\n cell.RelatedEntityName = aliasEntityMap.find(x => x.aliasAttribute === alias)?.entityAttribute ?? \"\";\n });\n }\n for (const entity of (await response).entities) {\n const entityMetadata = await entities.find(x => x.entityName === entityName)!.metadata;\n result.push({\n entityType: entityName,\n id: entity[entityMetadata.PrimaryIdAttribute],\n name: await getPrimaryName(entity, entityName, layout.Rows?.[0]?.Cells?.[0]?.Name, layout),\n entityData: entity,\n layout: layout\n });\n }\n }\n return result;\n }\n\n const getPrimaryName = async (\n entity: ComponentFramework.WebApi.Entity,\n entityName: string,\n attribute: string,\n layout: ILayout\n ): Promise<string> => {\n let targetEntityName = entityName;\n let targetAttribute = attribute;\n //checking for attributes pointing to related entity attribute, given by convention of using dot as separator\n if (attribute.includes(\".\")) {\n targetEntityName = layout.Rows.find(x => x.Cells)?.Cells?.find(y => y.Name === attribute)?.RelatedEntityName || entityName;\n targetAttribute = attribute.split(\".\")[1]\n }\n const entityMetadata: ComponentFramework.PropertyHelper.EntityMetadata = await props.context.utils.getEntityMetadata(targetEntityName, [targetAttribute]);\n const attributetype: string = entityMetadata.Attributes.get(targetAttribute).AttributeTypeName;\n let primaryName: string;\n switch (attributetype.toLowerCase()) {\n case \"lookup\":\n case \"partylist\":\n case \"owner\":\n case \"customer\":\n primaryName = entity[`_${targetAttribute}_value@OData.Community.Display.V1.FormattedValue`];\n break;\n case \"optionset\":\n case \"picklist\":\n case \"state\":\n case \"status\":\n case \"boolean\":\n case \"integer\":\n case \"bigint\":\n case \"decimal\":\n case \"money\":\n //TODO: Introduce user formatting, this approach takes format from application user setting\n primaryName = entity[`${targetAttribute}@OData.Community.Display.V1.FormattedValue`];\n break;\n case \"datetime\":\n primaryName = props.context.formatting.formatTime(dayjs(entity[targetAttribute]).toDate(), 1);\n break\n default:\n primaryName = entity[targetAttribute];\n };\n return (\n primaryName ??\n entity[entityMetadata.PrimaryNameAttribute] ??\n labels.noName()\n );\n };\n\n const createRecord = async (entityName: string) => {\n const formParameters = props.onGetOnCreateFormParameters?.(entityName)\n const result = await context.navigation.openForm({\n entityName: entityName,\n useQuickCreateForm: true\n }, formParameters);\n if (!result.savedEntityReference) {\n return;\n }\n onNotifyOutputChanged({\n value: [\n ...boundValue,\n ...result.savedEntityReference\n ]\n });\n }\n\n const deselectRecord = (record: ComponentFramework.LookupValue) => {\n const map = new Map<string, ComponentFramework.LookupValue>(boundValue.map(value => [value.id, value]));\n map.delete(record.id);\n onNotifyOutputChanged({\n value: [...map.values()]\n })\n }\n\n return [\n boundValue, entities, labels, {\n create: createRecord,\n deselect: deselectRecord,\n select: selectRecords\n },\n selectEntity,\n getSearchResults,\n theme\n ];\n};"],"names":[],"mappings":";;;;;;AAQa,MAAA,SAAS,GAAG,CAAC,KAAc,KAYpC;IAEA,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;IAC1D,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC;AAC9C,IAAA,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ooks/useLookup.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { ITranslation, useControl } from \"../../../hooks\";\nimport { IEntity, ILayout, ILookup, IMetadata } from \"../interfaces\";\nimport { lookupTranslations } from \"../translations\";\nimport { useFetchXml } from \"./useFetchXml\";\nimport { ITheme } from \"@talxis/react-components\";\nimport dayjs from \"dayjs\";\n\nexport const useLookup = (props: ILookup): [\n ComponentFramework.LookupValue[],\n IEntity[],\n ITranslation<Required<ILookup>['translations']>,\n {\n create: (entityName: string) => void,\n select: (record: ComponentFramework.LookupValue[] | undefined) => void,\n deselect: (record: ComponentFramework.LookupValue) => void,\n },\n (entityName: string | null) => void,\n (query: string) => Promise<(ComponentFramework.LookupValue & { entityData: { [key: string]: any }, layout: ILayout })[]>,\n ITheme\n] => {\n\n const targets = props.parameters.value.attributes.Targets;\n const boundValue = props.parameters.value.raw;\n const context = props.context;\n const { labels, theme, onNotifyOutputChanged } = useControl('Lookup', props, lookupTranslations);\n const [getFetchXml, applyLookupQuery] = useFetchXml(context);\n\n const [entities, setEntities] = useState<IEntity[]>(() => {\n return targets.map(target => {\n return {\n entityName: target,\n selected: targets.length === 1 ? true : false,\n metadata: window.Xrm.Utility.getEntityMetadata(target, []) as any,\n }\n })\n });\n\n const selectedEntity = entities.find(x => x.selected);\n\n const selectEntity = (entityName: string | null) => {\n setEntities([...entities as IEntity[]].map(entity => {\n return {\n entityName: entity.entityName,\n metadata: entity.metadata,\n selected: entity.entityName === entityName\n }\n }))\n }\n\n const selectRecords = (records: ComponentFramework.LookupValue[] | undefined) => {\n onNotifyOutputChanged({\n value: records\n })\n }\n const getSearchFetchXml = async (entityName: string, query: string, viewIdCallBack: (id: string) => void): Promise<string> => {\n const response = (await props.parameters.value.getAllViews(entityName)).find(x => x.isDefault);\n if (!response?.viewId) {\n throw new Error(`Entity ${entityName} does not have a default view id!`);\n }\n viewIdCallBack(response.viewId);\n let fetchXml = response?.fetchXml\n if (!fetchXml) {\n fetchXml = (await getFetchXml(response.viewId)).fetchxml;\n }\n return applyLookupQuery(entities.find(x => x.entityName === entityName)!, fetchXml, query);\n\n }\n const getSearchResults = async (query: string): Promise<(ComponentFramework.LookupValue & { entityData: { [key: string]: any }, layout: ILayout })[]> => {\n if (props.onSearch) {\n return props.onSearch(selectedEntity ? [selectedEntity?.entityName] : targets, query) as any;\n }\n const fetchXmlMap = new Map<string, Promise<string>>();\n const entityViewIdMap = new Map<string, string>();\n if (selectedEntity) {\n fetchXmlMap.set(selectedEntity.entityName, getSearchFetchXml(selectedEntity.entityName, query, (viewId) => entityViewIdMap.set(selectedEntity.entityName, viewId)))\n }\n else {\n for (const entity of targets) {\n fetchXmlMap.set(entity, getSearchFetchXml(entity, query, (viewId) => entityViewIdMap.set(entity, viewId)))\n }\n }\n await Promise.all(fetchXmlMap.values());\n const responsePromiseMap = new Map<string, Promise<ComponentFramework.WebApi.RetrieveMultipleResponse>>()\n const aliasEntityMap: { aliasAttribute: string, entityAttribute: string }[] = [];\n const domParser = new DOMParser();\n for (const [entityName, fetchXml] of fetchXmlMap) {\n const fetchXMLresult = await fetchXml;\n responsePromiseMap.set(entityName, context.webAPI.retrieveMultipleRecords(entityName, `?$top=25&fetchXml=${encodeURIComponent((fetchXMLresult))}`))\n //parsing of link entities from fetchXML\n const xml = domParser.parseFromString(fetchXMLresult, \"application/xml\");\n const linkEntities = xml.querySelectorAll(`link-entity`);\n for (const linkEntity of linkEntities) {\n const aliasAttribute = linkEntity.getAttribute('alias');\n const entityAttribute = linkEntity.getAttribute('name');\n if (entityAttribute) {\n aliasEntityMap.push({ aliasAttribute: aliasAttribute ?? entityAttribute, entityAttribute: entityAttribute })\n }\n else {\n throw Error(\"Link-entity without name property is not supported. Offedning query: \" + fetchXMLresult);\n }\n }\n }\n await Promise.all(responsePromiseMap.values());\n const result: (ComponentFramework.LookupValue & { entityData: { [key: string]: any }, layout: ILayout })[] = [];\n for (const [entityName, response] of responsePromiseMap) {\n const layout: ILayout = JSON.parse((await getFetchXml(entityViewIdMap.get(entityName)!)).layoutjson ?? \"{}\");\n //Mapping link-entities' logical names to layout's Cell \n if (layout.Rows.some(x => x.Cells.some(x => x.Name.includes(\".\")))) {\n const cellsToModify = layout.Rows.flatMap(row => row.Cells)\n .filter(cell => cell.Name.includes(\".\"));\n\n cellsToModify.forEach(cell => {\n const alias = cell.Name.split(\".\")[0]\n cell.RelatedEntityName = aliasEntityMap.find(x => x.aliasAttribute === alias)?.entityAttribute ?? \"\";\n });\n }\n for (const entity of (await response).entities) {\n const entityMetadata = await entities.find(x => x.entityName === entityName)!.metadata;\n result.push({\n entityType: entityName,\n id: entity[entityMetadata.PrimaryIdAttribute],\n name: await getPrimaryName(entity, entityName, layout.Rows?.[0]?.Cells?.[0]?.Name, layout),\n entityData: entity,\n layout: layout\n });\n }\n }\n return result;\n }\n\n const getPrimaryName = async (\n entity: ComponentFramework.WebApi.Entity,\n entityName: string,\n attribute: string,\n layout: ILayout\n ): Promise<string> => {\n let targetEntityName = entityName;\n let targetAttribute = attribute;\n //checking for attributes pointing to related entity attribute, given by convention of using dot as separator\n if (attribute.includes(\".\")) {\n targetEntityName = layout.Rows.find(x => x.Cells)?.Cells?.find(y => y.Name === attribute)?.RelatedEntityName || entityName;\n targetAttribute = attribute.split(\".\")[1]\n }\n const entityMetadata: ComponentFramework.PropertyHelper.EntityMetadata = await window.Xrm.Utility.getEntityMetadata(targetEntityName, [targetAttribute]);\n const attributetype: string = entityMetadata.Attributes.get(targetAttribute).AttributeTypeName;\n let primaryName: string;\n switch (attributetype.toLowerCase()) {\n case \"lookup\":\n case \"partylist\":\n case \"owner\":\n case \"customer\":\n primaryName = entity[`_${targetAttribute}_value@OData.Community.Display.V1.FormattedValue`];\n break;\n case \"optionset\":\n case \"picklist\":\n case \"state\":\n case \"status\":\n case \"boolean\":\n case \"integer\":\n case \"bigint\":\n case \"decimal\":\n case \"money\":\n //TODO: Introduce user formatting, this approach takes format from application user setting\n primaryName = entity[`${targetAttribute}@OData.Community.Display.V1.FormattedValue`];\n break;\n case \"datetime\":\n primaryName = props.context.formatting.formatTime(dayjs(entity[targetAttribute]).toDate(), 1);\n break\n default:\n primaryName = entity[targetAttribute];\n };\n return (\n primaryName ??\n entity[entityMetadata.PrimaryNameAttribute] ??\n labels.noName()\n );\n };\n\n const createRecord = async (entityName: string) => {\n const formParameters = props.onGetOnCreateFormParameters?.(entityName)\n const result = await context.navigation.openForm({\n entityName: entityName,\n useQuickCreateForm: true\n }, formParameters);\n if (!result.savedEntityReference) {\n return;\n }\n onNotifyOutputChanged({\n value: [\n ...boundValue,\n ...result.savedEntityReference\n ]\n });\n }\n\n const deselectRecord = (record: ComponentFramework.LookupValue) => {\n const map = new Map<string, ComponentFramework.LookupValue>(boundValue.map(value => [value.id, value]));\n map.delete(record.id);\n onNotifyOutputChanged({\n value: [...map.values()]\n })\n }\n\n return [\n boundValue, entities, labels, {\n create: createRecord,\n deselect: deselectRecord,\n select: selectRecords\n },\n selectEntity,\n getSearchResults,\n theme\n ];\n};"],"names":[],"mappings":";;;;;;AAQa,MAAA,SAAS,GAAG,CAAC,KAAc,KAYpC;IAEA,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;IAC1D,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC;AAC9C,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAC9B,IAAA,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACjG,MAAM,CAAC,WAAW,EAAE,gBAAgB,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAE7D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAY,MAAK;AACrD,QAAA,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,IAAG;YACxB,OAA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C9B,OAAO;AACV,SAAA;AACD,QAAA,qBAAqB,CAAC;AAClB,YAAA,KAAK,EAAE;AACH,gBAAA,GAAG,UAAU;gBACb,GAAG,MAAM,CAAC,oBAAoB;AACjC,aAAA;AACJ,SAAA,CAAC,CAAC;AACP,KAAC,CAAA;AAED,IAAA,MAAM,cAAc,GAAG,CAAC,MAAsC,KAAI;QAC9D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAyC,UAAU,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AACxG,QAAA,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACtB,QAAA,qBAAqB,CAAC;AAClB,YAAA,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;AAC3B,SAAA,CAAC,CAAA;AACN,KAAC,CAAA;IAED,OAAO;AACH,QAAA,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE;AAC1B,YAAA,MAAM,EAAE,YAAY;AACpB,YAAA,QAAQ,EAAE,cAAc;AACxB,YAAA,MAAM,EAAE,aAAa;AACxB,SAAA;QACD,YAAY;QACZ,gBAAgB;QAChB,KAAK;KACR,CAAC;AACN;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { ComboBox } from '@talxis/react-components';
|
|
3
3
|
import { ThemeProvider } from '@fluentui/react';
|
|
4
|
-
import
|
|
4
|
+
import React__default, { useRef, useMemo, useEffect } from 'react';
|
|
5
5
|
import ReactDOM from 'react-dom';
|
|
6
6
|
import { ColorfulOptions } from './ColofulOptions/ColorfulOptions.js';
|
|
7
7
|
import { getIsColorFeatureEnabled, onRenderColorfulOption } from '../OptionSet/shared.js';
|
|
@@ -58,7 +58,7 @@ const MultiSelectOptionSet = (props) => {
|
|
|
58
58
|
const container = document.createElement('div');
|
|
59
59
|
container.setAttribute('class', `${className} ${styles.colorfulOptionsWrapper}`);
|
|
60
60
|
container.onclick = () => componentRef.current?.focus(true);
|
|
61
|
-
ReactDOM.render(
|
|
61
|
+
ReactDOM.render(React__default.createElement(ColorfulOptions, {
|
|
62
62
|
value: boundValue,
|
|
63
63
|
context: props.context
|
|
64
64
|
}), container);
|