@antscorp/antsomi-ui 1.5.3 → 1.5.5
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/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.js +8 -1
- package/es/components/organism/FilterSetting/components/common/InputArray/index.js +1 -1
- package/es/components/organism/FilterSetting/components/common/InputOrSelect/index.js +6 -1
- package/es/components/organism/FilterSetting/components/common/InputSelectMulti/index.js +2 -1
- package/package.json +1 -1
|
@@ -108,12 +108,16 @@ export const useTemplateSave = (options) => {
|
|
|
108
108
|
}, [categoryList]);
|
|
109
109
|
// Effects
|
|
110
110
|
useDeepCompareEffect(() => {
|
|
111
|
+
// Self-executing asynchronous function to handle template items
|
|
111
112
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
113
|
var _a;
|
|
114
|
+
// Check if infiniteObjectTemplate is available
|
|
113
115
|
if (infiniteObjectTemplate) {
|
|
114
116
|
const { pages } = infiniteObjectTemplate;
|
|
115
117
|
const selectedTemplateId = +(((_a = value.templateName) === null || _a === void 0 ? void 0 : _a.id) || -1);
|
|
118
|
+
// Generate new template items by flattening entities from pages and adding label and description properties
|
|
116
119
|
const newTemplateItems = pages.flatMap(({ entities }) => entities.flatMap(entity => (Object.assign(Object.assign({}, entity.toJson()), { label: entity.name, description: entity.description || '' }))));
|
|
120
|
+
// If the selected template ID is not found in the new template items, fetch its details
|
|
117
121
|
if (!newTemplateItems.find(item => +item.id === selectedTemplateId)) {
|
|
118
122
|
const objectTemplate = yield queryClient.fetchQuery({
|
|
119
123
|
queryKey: [QUERY_KEYS.GET_OBJECT_TEMPLATE_DETAIL, selectedTemplateId],
|
|
@@ -126,13 +130,16 @@ export const useTemplateSave = (options) => {
|
|
|
126
130
|
},
|
|
127
131
|
}),
|
|
128
132
|
});
|
|
129
|
-
|
|
133
|
+
// If the object template is found, add it to the beginning of the new template items
|
|
134
|
+
if (objectTemplate && objectTemplate.name) {
|
|
130
135
|
newTemplateItems.unshift(Object.assign(Object.assign({}, objectTemplate.toJson()), { label: objectTemplate.name, description: objectTemplate.description || '' }));
|
|
131
136
|
}
|
|
132
137
|
}
|
|
138
|
+
// Update state with the new template items
|
|
133
139
|
setTemplateItems(newTemplateItems);
|
|
134
140
|
}
|
|
135
141
|
}))();
|
|
142
|
+
// Dependencies for the effect: update if any of these change
|
|
136
143
|
}, [infiniteObjectTemplate, objectType, publicLevel, (_a = value.templateName) === null || _a === void 0 ? void 0 : _a.id]);
|
|
137
144
|
const onLoadMore = useCallback(() => {
|
|
138
145
|
if (!isFetchingNextPage && hasNextPage) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
4
4
|
// Atoms
|
|
5
|
-
import { Tag } from '@antscorp/antsomi-ui/es/components/
|
|
5
|
+
import { StyledTag as Tag } from '@antscorp/antsomi-ui/es/components/molecules/SelectV2/styled';
|
|
6
6
|
import { StyledSelect } from './styled';
|
|
7
7
|
// Translations
|
|
8
8
|
import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
@@ -29,9 +29,10 @@ import get from 'lodash/get';
|
|
|
29
29
|
// Icons
|
|
30
30
|
import Icon from '@antscorp/icons';
|
|
31
31
|
// Atoms
|
|
32
|
-
import { Button, Text
|
|
32
|
+
import { Button, Text } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
33
33
|
// Molecules
|
|
34
34
|
import { Modal, SelectV2 as Select, RadioGroup, TreeSelect, } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
35
|
+
import { StyledTag as Tag } from '@antscorp/antsomi-ui/es/components/molecules/SelectV2/styled';
|
|
35
36
|
// Translations
|
|
36
37
|
import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
37
38
|
// Queries
|
|
@@ -485,6 +486,10 @@ export const StyledDropdown = styled.div `
|
|
|
485
486
|
}
|
|
486
487
|
`;
|
|
487
488
|
export const StyledSelect = styled(Select) `
|
|
489
|
+
.antsomi-select-selection-search {
|
|
490
|
+
width: fit-content !important;
|
|
491
|
+
}
|
|
492
|
+
|
|
488
493
|
.antsomi-select-selection-placeholder {
|
|
489
494
|
${props => {
|
|
490
495
|
var _a;
|
|
@@ -28,9 +28,10 @@ import styled from 'styled-components';
|
|
|
28
28
|
import { Popover, Input } from 'antd';
|
|
29
29
|
import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
30
30
|
// Atoms
|
|
31
|
-
import { Button, Divider, Icon, Text
|
|
31
|
+
import { Button, Divider, Icon, Text } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
32
32
|
// Molecules
|
|
33
33
|
import { ModalSelect, StyledTreeSelect } from '../InputOrSelect';
|
|
34
|
+
import { StyledTag as Tag } from '@antscorp/antsomi-ui/es/components/molecules/SelectV2/styled';
|
|
34
35
|
// Components
|
|
35
36
|
import { TreeContentWrapper } from './Tree';
|
|
36
37
|
import { ColumnSuggestion } from './ColumnSuggestion';
|