@antscorp/antsomi-ui 1.3.7-beta.6 → 1.3.7-beta.61
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/atoms/Input/Input.js +3 -1
- package/es/components/atoms/InputDynamic/InputDynamic.js +3 -3
- package/es/components/icons/LazyIcon/LazyIcon.d.ts +2 -0
- package/es/components/icons/LazyIcon/LazyIcon.js +2 -0
- package/es/components/icons/QRCodeManagementIcon.d.ts +3 -0
- package/es/components/icons/QRCodeManagementIcon.js +7 -0
- package/es/components/icons/QRSetDashboardIcon.d.ts +3 -0
- package/es/components/icons/QRSetDashboardIcon.js +7 -0
- package/es/components/icons/index.d.ts +2 -0
- package/es/components/icons/index.js +2 -0
- package/es/components/molecules/AddDynamicContent/AddDynamicContent.js +28 -2
- package/es/components/molecules/AddDynamicContent/constants.d.ts +2 -0
- package/es/components/molecules/AddDynamicContent/constants.js +2 -0
- package/es/components/molecules/ColorPicker/index.d.ts +2 -0
- package/es/components/molecules/ColorPicker/index.js +8 -3
- package/es/components/molecules/EmojiPopover/EmojiPopover.d.ts +1 -0
- package/es/components/molecules/EmojiPopover/EmojiPopover.js +2 -2
- package/es/components/molecules/EmojiPopover/styled.d.ts +2 -2
- package/es/components/molecules/EmojiPopover/styled.js +1 -1
- package/es/components/molecules/HeaderV2/HeaderV2.d.ts +1 -1
- package/es/components/molecules/Modal/Modal.js +7 -1
- package/es/components/molecules/SearchPopover/SearchPopover.js +2 -2
- package/es/components/molecules/SearchPopover/styled.d.ts +12 -1
- package/es/components/molecules/SearchPopover/styled.js +1 -2
- package/es/components/molecules/SearchPopover/types.d.ts +4 -3
- package/es/components/molecules/Select/Select.js +1 -1
- package/es/components/molecules/ShareAccess/ShareAccess.d.ts +2 -1
- package/es/components/molecules/ShareAccess/ShareAccess.js +12 -9
- package/es/components/molecules/ShareAccess/components/LayoutContent/LayoutContent.js +5 -5
- package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.js +2 -2
- package/es/components/molecules/ShareAccess/hooks/useShareAccess.d.ts +2 -1
- package/es/components/molecules/ShareAccess/index.d.ts +1 -0
- package/es/components/molecules/ShareAccess/reducer.d.ts +1 -1
- package/es/components/molecules/ShareAccess/reducer.js +7 -4
- package/es/components/molecules/ShareAccess/types.d.ts +22 -0
- package/es/components/molecules/ShareAccess/utils.d.ts +3 -1
- package/es/components/molecules/ShareAccess/utils.js +35 -2
- package/es/components/molecules/TagifyInput/TagifyInput.js +48 -27
- package/es/components/molecules/TagifyInput/types.d.ts +14 -8
- package/es/components/molecules/TagifyInput/utils.d.ts +6 -1
- package/es/components/molecules/TagifyInput/utils.js +19 -0
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +1 -0
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +3 -7
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +10 -10
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +46 -327
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.d.ts +9 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.js +5 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.d.ts +23 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.js +81 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.d.ts +24 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.js +32 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.d.ts +26 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.js +93 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.d.ts +24 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.js +94 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.d.ts +7 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.js +132 -0
- package/es/components/molecules/VirtualizedMenu/styled.js +14 -3
- package/es/components/molecules/VirtualizedMenu/types.d.ts +1 -0
- package/es/components/molecules/VirtualizedMenu/utils.d.ts +1 -0
- package/es/components/molecules/VirtualizedMenu/utils.js +1 -0
- package/es/components/molecules/index.d.ts +1 -0
- package/es/components/organism/AccountSharing/AccountSharing.d.ts +1 -0
- package/es/components/organism/AccountSharing/AccountSharing.js +11 -4
- package/es/components/organism/AccountSharing/styled.js +1 -1
- package/es/components/organism/ActivityTimeline/ActivityTimeline.js +3 -3
- package/es/components/organism/ActivityTimeline/constants.d.ts +9 -9
- package/es/components/organism/ActivityTimeline/constants.js +3 -3
- package/es/components/organism/ActivityTimeline/index.d.ts +530 -1
- package/es/components/organism/ActivityTimeline/index.js +9 -1
- package/es/components/organism/ActivityTimeline/utils.js +175 -8
- package/es/components/organism/LeftMenu/LeftMenu.js +3 -3
- package/es/components/organism/LeftMenu/hooks/usePermission.js +1 -1
- package/es/components/organism/LeftMenu/types/index.d.ts +7 -0
- package/es/components/organism/LeftMenu/utils/index.js +1 -1
- package/es/components/organism/Login/Login.js +12 -3
- package/es/components/organism/Login/components/SignIn/SignIn.js +2 -2
- package/es/components/organism/Login/types/index.d.ts +2 -0
- package/es/components/organism/TextEditor/TextEditor.d.ts +9 -2
- package/es/components/organism/TextEditor/TextEditor.js +203 -42
- package/es/components/organism/TextEditor/constants.d.ts +9 -0
- package/es/components/organism/TextEditor/constants.js +66 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +6 -128
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +7 -292
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +1 -1
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +4 -0
- package/es/components/organism/TextEditor/extensions/Link.js +33 -14
- package/es/components/organism/TextEditor/extensions/ListItem.d.ts +10 -0
- package/es/components/organism/TextEditor/extensions/ListItem.js +93 -0
- package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +5 -6
- package/es/components/organism/TextEditor/extensions/SmartTag.js +96 -4
- package/es/components/organism/TextEditor/hooks/useColorSet.js +7 -0
- package/es/components/organism/TextEditor/hooks/useMarkTracking.js +2 -1
- package/es/components/organism/TextEditor/index.d.ts +7 -5
- package/es/components/organism/TextEditor/index.scss +4 -7
- package/es/components/organism/TextEditor/provider.d.ts +1 -0
- package/es/components/organism/TextEditor/provider.js +6 -3
- package/es/components/organism/TextEditor/store.d.ts +11 -4
- package/es/components/organism/TextEditor/store.js +22 -2
- package/es/components/organism/TextEditor/stories/WithOldDynAndLink/froala-legacy-format.settings.json +95 -0
- package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.d.ts +111 -0
- package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.js +82 -0
- package/es/components/organism/TextEditor/stories/shared.d.ts +64 -0
- package/es/components/organism/TextEditor/stories/shared.js +57 -0
- package/es/components/organism/TextEditor/styled.d.ts +1 -1
- package/es/components/organism/TextEditor/styled.js +1 -0
- package/es/components/organism/TextEditor/types.d.ts +161 -11
- package/es/components/organism/TextEditor/types.js +1 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +2 -1
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +80 -51
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +1 -1
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +1 -1
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +2 -2
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +12 -2
- package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.d.ts +16 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.js +61 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/index.js +1 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.d.ts +9 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.js +126 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Popover/Popover.js +1 -1
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +1 -3
- package/es/components/organism/TextEditor/ui/Toolbar/{Toolbar.d.ts → FormattingToolbar.d.ts} +3 -4
- package/es/components/organism/TextEditor/ui/Toolbar/FormattingToolbar.js +90 -0
- package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.d.ts +10 -0
- package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.js +39 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +4 -3
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +2 -2
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +6 -1
- package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +2 -1
- package/es/components/organism/TextEditor/ui/Toolbar/index.js +2 -1
- package/es/components/organism/TextEditor/utils/documentState.d.ts +14 -0
- package/es/components/organism/TextEditor/utils/documentState.js +25 -0
- package/es/components/organism/TextEditor/utils/htmlProcessing.js +60 -0
- package/es/components/organism/TextEditor/utils/link.d.ts +10 -1
- package/es/components/organism/TextEditor/utils/link.js +161 -7
- package/es/components/organism/TextEditor/utils/menu.js +2 -1
- package/es/components/organism/TextEditor/utils/selection.js +3 -2
- package/es/components/organism/TextEditor/utils/smartTag.js +2 -1
- package/es/components/organism/index.d.ts +1 -1
- package/es/hooks/index.d.ts +1 -1
- package/es/hooks/index.js +1 -1
- package/es/providers/ConfigProvider/ConfigProvider.d.ts +4 -0
- package/es/providers/ConfigProvider/ConfigProvider.js +2 -3
- package/es/providers/ConfigProvider/GlobalStyle.d.ts +2 -2
- package/es/providers/ConfigProvider/GlobalStyle.js +67 -64
- package/es/services/MediaTemplateDesign/UploadFile/index.js +4 -4
- package/es/utils/common.d.ts +1 -1
- package/es/utils/common.js +3 -3
- package/es/utils/cookie.js +2 -1
- package/package.json +18 -23
- package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/BubbleToolbar/BubbleToolbar.js +0 -1
- package/es/components/organism/TextEditor/ui/BubbleToolbar/index.d.ts +0 -0
- package/es/components/organism/TextEditor/ui/BubbleToolbar/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.js +0 -39
|
@@ -6,7 +6,9 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
6
6
|
// Types
|
|
7
7
|
import { Input as AntdInput } from 'antd';
|
|
8
8
|
// Components
|
|
9
|
-
import { Icon
|
|
9
|
+
import { Icon } from '../Icon';
|
|
10
|
+
import { RequiredLabel } from '../RequiredLabel';
|
|
11
|
+
import { Text } from '../Text';
|
|
10
12
|
// Utils
|
|
11
13
|
import { handleError } from '@antscorp/antsomi-ui/es/utils/handleError';
|
|
12
14
|
import { getPreventKeyboardAction } from '@antscorp/antsomi-ui/es/utils/web';
|
|
@@ -30,9 +30,9 @@ const defaultProps = {
|
|
|
30
30
|
apiConfig: {
|
|
31
31
|
domain: 'https://sandbox-media-template.antsomi.com/cdp',
|
|
32
32
|
slug: '/api/v1',
|
|
33
|
-
token: '
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
token: '5474r2x214z284d4w2b4y4o5l4u5n4x5s2x2h4g45416',
|
|
34
|
+
userId: '1600083836',
|
|
35
|
+
accountId: '1600083836',
|
|
36
36
|
},
|
|
37
37
|
disabled: false,
|
|
38
38
|
showIndex: true,
|
|
@@ -408,4 +408,6 @@ export declare const LazyIcon: {
|
|
|
408
408
|
WebPersonalizationIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
|
|
409
409
|
WidgetIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
|
|
410
410
|
WritingAIAssitantIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
|
|
411
|
+
QRCodeManagementIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
|
|
412
|
+
QRSetDashboardIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
|
|
411
413
|
};
|
|
@@ -411,4 +411,6 @@ export const LazyIcon = {
|
|
|
411
411
|
WebPersonalizationIcon: lazy(() => import('../WebPersonalizationIcon').then(m => ({ default: m.WebPersonalizationIcon }))),
|
|
412
412
|
WidgetIcon: lazy(() => import('../WidgetIcon').then(m => ({ default: m.WidgetIcon }))),
|
|
413
413
|
WritingAIAssitantIcon: lazy(() => import('../WritingAIAssitantIcon').then(m => ({ default: m.WritingAIAssitantIcon }))),
|
|
414
|
+
QRCodeManagementIcon: lazy(() => import('../QRCodeManagementIcon').then(m => ({ default: m.QRCodeManagementIcon }))),
|
|
415
|
+
QRSetDashboardIcon: lazy(() => import('../QRSetDashboardIcon').then(m => ({ default: m.QRSetDashboardIcon }))),
|
|
414
416
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { useIcon } from './hooks/useIcon';
|
|
4
|
+
export const QRCodeManagementIcon = forwardRef((props, ref) => {
|
|
5
|
+
const { width, height } = useIcon(props);
|
|
6
|
+
return (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, ref: ref, width: width, height: height, children: _jsx("g", { children: _jsx("path", { d: "M2.604 7.3118V2.60425H7.31156V4.16675H4.1665V7.3118H2.604ZM2.604 22.3959V17.6884H4.1665V20.8334H7.31156V22.3959H2.604ZM17.6881 22.3959V20.8334H20.8332V17.6884H22.3957V22.3959H17.6881ZM20.8332 7.3118V4.16675H17.6881V2.60425H22.3957V7.3118H20.8332ZM17.9386 17.9389H19.3509V19.3511H17.9386V17.9389ZM17.9386 15.1141H19.3509V16.5264H17.9386V15.1141ZM16.5261 16.5264H17.9386V17.9389H16.5261V16.5264ZM15.1139 17.9389H16.5261V19.3511H15.1139V17.9389ZM13.7017 16.5264H15.1139V17.9389H13.7017V16.5264ZM16.5261 13.7019H17.9386V15.1141H16.5261V13.7019ZM15.1139 15.1141H16.5261V16.5264H15.1139V15.1141ZM13.7017 13.7019H15.1139V15.1141H13.7017V13.7019ZM19.3509 5.64904V11.2983H13.7017V5.64904H19.3509ZM11.298 13.7019V19.3511H5.6488V13.7019H11.298ZM11.298 5.64904V11.2983H5.6488V5.64904H11.298ZM10.0558 18.1089V14.9441H6.89098V18.1089H10.0558ZM10.0558 10.0561V6.89123H6.89098V10.0561H10.0558ZM18.1087 10.0561V6.89123H14.9438V10.0561H18.1087Z", fill: "currentColor" }) }) }));
|
|
7
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { useIcon } from './hooks/useIcon';
|
|
4
|
+
export const QRSetDashboardIcon = forwardRef((props, ref) => {
|
|
5
|
+
const { width, height } = useIcon(props);
|
|
6
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 18 18", width: width, height: height, ref: ref, ...props, children: _jsx("path", { fill: "currentColor", d: "M10 18v-2h2v2zm-2-2v-5h2v5zm8-3V9h2v4zm-2-4V7h2v2zM2 11V9h2v2zM0 9V7h2v2zm9-7V0h2v2zM1.5 4.5h3v-3h-3zM0 6V0h6v6zm1.5 10.5h3v-3h-3zM0 18v-6h6v6zM13.5 4.5h3v-3h-3zM12 6V0h6v6zm2 12v-3h-2v-2h4v3h2v2zm-4-7V9h4v2zm-4 0V9H4V7h6v2H8v2zm1-5V2h2v2h2v2zM2.25 3.75v-1.5h1.5v1.5zm0 12v-1.5h1.5v1.5zm12-12v-1.5h1.5v1.5z" }) }));
|
|
7
|
+
});
|
|
@@ -401,3 +401,5 @@ export { WebIcon } from './WebIcon';
|
|
|
401
401
|
export { WebPersonalizationIcon } from './WebPersonalizationIcon';
|
|
402
402
|
export { WidgetIcon } from './WidgetIcon';
|
|
403
403
|
export { WritingAIAssitantIcon } from './WritingAIAssitantIcon';
|
|
404
|
+
export { QRSetDashboardIcon } from './QRSetDashboardIcon';
|
|
405
|
+
export { QRCodeManagementIcon } from './QRCodeManagementIcon';
|
|
@@ -401,3 +401,5 @@ export { WebIcon } from './WebIcon';
|
|
|
401
401
|
export { WebPersonalizationIcon } from './WebPersonalizationIcon';
|
|
402
402
|
export { WidgetIcon } from './WidgetIcon';
|
|
403
403
|
export { WritingAIAssitantIcon } from './WritingAIAssitantIcon';
|
|
404
|
+
export { QRSetDashboardIcon } from './QRSetDashboardIcon';
|
|
405
|
+
export { QRCodeManagementIcon } from './QRCodeManagementIcon';
|
|
@@ -15,6 +15,7 @@ import { Text } from '@antscorp/antsomi-ui/es/components/atoms/Text';
|
|
|
15
15
|
import { Form, Select, TreeSelect } from 'antd';
|
|
16
16
|
import { TreeNode } from 'rc-tree-select';
|
|
17
17
|
// Locales
|
|
18
|
+
import { translate, translations as translationLib } from '@antscorp/antsomi-locales';
|
|
18
19
|
import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
19
20
|
import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
20
21
|
// Query
|
|
@@ -33,6 +34,7 @@ import { buildMappingFields, buildOptionAttrArchive, checkStatusAttr, CUSTOM_TYP
|
|
|
33
34
|
// Style
|
|
34
35
|
import { EditorScript } from '../EditorScript';
|
|
35
36
|
import { InputSuggestion, ModalCustom } from './styled';
|
|
37
|
+
import { Input, Radio } from '../../atoms';
|
|
36
38
|
const getMembers = (member) => {
|
|
37
39
|
if (!member.children || !member.children.length) {
|
|
38
40
|
return member;
|
|
@@ -303,6 +305,12 @@ export const AddDynamicContent = props => {
|
|
|
303
305
|
}
|
|
304
306
|
return false;
|
|
305
307
|
}, [selectedAttr, selectedDynamicContentType, eventTrackingAttributes?.mainObjects]);
|
|
308
|
+
const eventBOAttributeLabel = useMemo(() => {
|
|
309
|
+
if (!selectedAttr?.itemTypeId || !listEventAttributes)
|
|
310
|
+
return '';
|
|
311
|
+
const boAttr = listEventAttributes.find(row => row.itemTypeId === selectedAttr?.itemTypeId);
|
|
312
|
+
return boAttr?.label;
|
|
313
|
+
}, [listEventAttributes, selectedAttr]);
|
|
306
314
|
const itemTypeName = useMemo(() => {
|
|
307
315
|
let draftItemTypeName = '';
|
|
308
316
|
if (itemTypeId) {
|
|
@@ -416,6 +424,8 @@ export const AddDynamicContent = props => {
|
|
|
416
424
|
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: undefined,
|
|
417
425
|
[DYNAMIC_CONTENT_SETTING_KEY.FUNCTION]: undefined,
|
|
418
426
|
[DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE]: optionDataType[0].value,
|
|
427
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DEFAULT_VALUE]: '',
|
|
428
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DATA_SOURCE]: 'event',
|
|
419
429
|
});
|
|
420
430
|
}, [form]);
|
|
421
431
|
useEffect(() => {
|
|
@@ -1119,7 +1129,7 @@ export const AddDynamicContent = props => {
|
|
|
1119
1129
|
__html: `${t(translations.dynamicContent.modal.label.displayFormat)}: <bdo dir='ltr'>${formatedAttr}</bdo>`,
|
|
1120
1130
|
} })) : null, !showDetailEditDF && (_jsx(Button, { disabled: isActionArchive &&
|
|
1121
1131
|
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value, type: "text", style: { display: 'inline-block' }, onClick: () => setShowDetailEditDF(prevShow => !prevShow), children: t(translations.edit.title) }))] }), children: _jsx(Select, { disabled: isActionArchive &&
|
|
1122
|
-
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value, style: { height: 28 }, options: attrDFOptions }) })] }));
|
|
1132
|
+
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value, style: { height: 28 }, options: attrDFOptions }) }), renderDefaultValue()] }));
|
|
1123
1133
|
};
|
|
1124
1134
|
const renderCustomerAttrFields = () => {
|
|
1125
1135
|
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
@@ -1205,6 +1215,22 @@ export const AddDynamicContent = props => {
|
|
|
1205
1215
|
gap: '8px',
|
|
1206
1216
|
}, children: _jsx(DisplayFormat, { infos: infos, url: url, displayFormatType: selectedDFType, formatSettings: attrDFSettings, onSettingsChange: (values) => setAttrDFSettings(values), dynamicContentType: form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE) }) }));
|
|
1207
1217
|
};
|
|
1218
|
+
const renderGetFromData = () => (_jsx(Form.Item, { className: "ants-items-center", label: translate(translationLib._TITL_PERSONALIZATION_LOOKUP_YES, 'Get data from'), name: DYNAMIC_CONTENT_SETTING_KEY.DATA_SOURCE, required: true, children: _jsx(Radio.Group, { defaultValue: "event", options: [
|
|
1219
|
+
{
|
|
1220
|
+
value: 'event',
|
|
1221
|
+
label: 'Event data',
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
value: 'object',
|
|
1225
|
+
label: (_jsxs(Text, { children: [translate(translationLib._TITL_PERSONALIZATION_LOOKUP_YES, 'Data object'), ' ', _jsx("b", { children: eventBOAttributeLabel })] })),
|
|
1226
|
+
disabled: !selectedAttr?.itemTypeId,
|
|
1227
|
+
},
|
|
1228
|
+
], style: {
|
|
1229
|
+
display: 'flex',
|
|
1230
|
+
flexDirection: 'column',
|
|
1231
|
+
gap: 8,
|
|
1232
|
+
} }) }));
|
|
1233
|
+
const renderDefaultValue = () => (_jsx(Form.Item, { className: "ants-items-center", label: translate(translations._TITL_DEFAULT_VALUE, 'Default value'), name: DYNAMIC_CONTENT_SETTING_KEY.DEFAULT_VALUE, children: _jsx(Input, { placeholder: "Enter fallback text when data is unavailable" }) }));
|
|
1208
1234
|
return (_jsx(ModalCustom, { closable: false, destroyOnClose: true, forceRender: true, mask: true, okButtonProps: { disabled: formSubmitDisabled }, title: modalTitle || t(translations.dynamicContent.modal.title.addDynamicContent), visible: visible, onCancel: handleOnCancelModal, onOk: handleOnOkModal, children: _jsxs(Spin, { spinning: isFetchingSourceBO ||
|
|
1209
1235
|
isFetchingListBoAttr ||
|
|
1210
1236
|
isFetchingEventAttr ||
|
|
@@ -1212,7 +1238,7 @@ export const AddDynamicContent = props => {
|
|
|
1212
1238
|
isFetchingPromotionCodeAttr ||
|
|
1213
1239
|
isFetchingDynamicContentAttr, children: [_jsxs(Form, { style: { width: '100%' }, form: form, labelAlign: "left", labelCol: { span: 9 }, wrapperCol: { span: 15 }, onValuesChange: handleFormValuesChanges, initialValues: {
|
|
1214
1240
|
[DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE]: listDynamicContentTypes[0].value,
|
|
1215
|
-
}, children: [_jsx(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.contentSource), name: DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE, required: true, children: _jsx(Select, { style: { height: 28 }, options: listDynamicContentTypes }) }), selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value && (
|
|
1241
|
+
}, children: [_jsx(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.contentSource), name: DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE, required: true, children: _jsx(Select, { style: { height: 28 }, options: listDynamicContentTypes }) }), selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value && (_jsxs(_Fragment, { children: [renderVisitorAttrFields(), renderDefaultValue()] })), selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value && (_jsxs(_Fragment, { children: [renderCustomerAttrFields(), renderDefaultValue()] })), selectedDynamicContentType === CUSTOM_TYPE.value && _jsx(_Fragment, { children: renderCustomFunctionFields() }), selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value && (_jsxs(_Fragment, { children: [renderEventFields(), renderSourceFields(), renderEventAttrFields(), renderGetFromData(), renderDefaultValue(), isShowEventIndexField
|
|
1216
1242
|
? renderIndexFields({ disabled: false, loading: false })
|
|
1217
1243
|
: null] })), selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value && (_jsxs(_Fragment, { children: [renderPromotionPoolFields(), renderPromotionCodeAttr()] })), selectedDynamicContentType && regexCSType.test(selectedDynamicContentType) && (_jsxs(_Fragment, { children: [renderBoAttrFields(), renderIndexFields({ disabled: isActionArchive, loading: isFetchingListBoAttr })] })), showDisplayFormat && renderDisplayFormat()] }), showDisplayFormat && renderDisplayFormat() !== null && renderDetailDFSettings(), isShowCustomFunction && selectedDynamicContentType === CUSTOM_TYPE.value && (_jsx("div", { style: {
|
|
1218
1244
|
display: 'flex',
|
|
@@ -12,6 +12,8 @@ export declare const DYNAMIC_CONTENT_SETTING_KEY: {
|
|
|
12
12
|
PERNAME: string;
|
|
13
13
|
SAVE_AS_TEMPLATE: string;
|
|
14
14
|
DATA_TYPE: string;
|
|
15
|
+
DATA_SOURCE: string;
|
|
16
|
+
DEFAULT_VALUE: string;
|
|
15
17
|
};
|
|
16
18
|
export declare const DYNAMIC_CONTENT_TYPE_KEY: {
|
|
17
19
|
readonly BO_SETTINGS: "bo-settings";
|
|
@@ -12,6 +12,8 @@ export const DYNAMIC_CONTENT_SETTING_KEY = {
|
|
|
12
12
|
PERNAME: 'templateName',
|
|
13
13
|
SAVE_AS_TEMPLATE: 'saveAsTemplate',
|
|
14
14
|
DATA_TYPE: 'dataType',
|
|
15
|
+
DATA_SOURCE: 'dataSource',
|
|
16
|
+
DEFAULT_VALUE: 'defaultValue',
|
|
15
17
|
};
|
|
16
18
|
export const DYNAMIC_CONTENT_TYPE_KEY = {
|
|
17
19
|
BO_SETTINGS: 'bo-settings',
|
|
@@ -7,8 +7,10 @@ export interface ColorPickerProps {
|
|
|
7
7
|
defaultColor?: string;
|
|
8
8
|
icon?: React.ReactNode | string;
|
|
9
9
|
onChange?: (color: string) => void;
|
|
10
|
+
onAfterClosePicker?: (color: string) => void;
|
|
10
11
|
showInput?: boolean;
|
|
11
12
|
positionInput?: 'right' | 'left';
|
|
12
13
|
style?: React.CSSProperties;
|
|
14
|
+
inputProps?: any;
|
|
13
15
|
}
|
|
14
16
|
export declare const ColorPicker: React.FC<ColorPickerProps>;
|
|
@@ -22,8 +22,8 @@ const styleBtnColor = {
|
|
|
22
22
|
};
|
|
23
23
|
export const ColorPicker = props => {
|
|
24
24
|
// Props
|
|
25
|
-
const { className = '', defaultColor = '#000000', presetColors, positionInput = 'left', icon, showInput = true, style = {}, isHideAlpha, } = props;
|
|
26
|
-
const { onChange = () => { } } = props;
|
|
25
|
+
const { className = '', defaultColor = '#000000', presetColors, positionInput = 'left', icon, showInput = true, style = {}, isHideAlpha, inputProps = {}, } = props;
|
|
26
|
+
const { onChange = () => { }, onAfterClosePicker = () => { } } = props;
|
|
27
27
|
// States
|
|
28
28
|
const [color, setColor] = useState(defaultColor);
|
|
29
29
|
const [popoverVisible, setPopoverVisible] = useState(false);
|
|
@@ -71,7 +71,12 @@ export const ColorPicker = props => {
|
|
|
71
71
|
const onPopoverVisibleChange = visible => {
|
|
72
72
|
setPopoverVisible(visible);
|
|
73
73
|
};
|
|
74
|
-
|
|
74
|
+
const handleAfterOpenChange = (visible) => {
|
|
75
|
+
if (!visible && typeof onAfterClosePicker === 'function') {
|
|
76
|
+
onAfterClosePicker(color);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return (_jsxs(ColorPickerWrapper, { className: `antsomi-color-picker ${className || ''}`, style: style, children: [showInput && positionInput === 'left' && (_jsx(Input, { style: { textTransform: 'uppercase' }, value: color, onChange: onChangeColorInput, ...inputProps })), _jsx(Popover, { arrow: true, content: _jsx(CustomPicker, { color: color, presetColors: presetColors, isHideAlpha: isHideAlpha, onChange: onChangeColorPicker, onChangeComplete: onChangeComplete }), trigger: "click", open: popoverVisible, getPopupContainer: triggerNode => triggerNode, onOpenChange: onPopoverVisibleChange, afterOpenChange: handleAfterOpenChange, children: _jsx("div", { className: "antsomi-popover-button", style: styleBtnColor, children: iconNode || (_jsx("span", { style: {
|
|
75
80
|
backgroundColor: color,
|
|
76
81
|
display: 'block',
|
|
77
82
|
width: 20,
|
|
@@ -9,6 +9,7 @@ interface EmojiPopoverProps {
|
|
|
9
9
|
collections?: CollectionItemProps[];
|
|
10
10
|
isForceHide?: boolean;
|
|
11
11
|
children?: React.ReactNode;
|
|
12
|
+
destroyTooltipOnHide?: boolean;
|
|
12
13
|
onEmojiClick?: (emoji: string | TagDataCustomize) => void;
|
|
13
14
|
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
14
15
|
}
|
|
@@ -11,7 +11,7 @@ import { EMOJI_COLLECTIONS, } from '@antscorp/antsomi-ui/es/components/molecules
|
|
|
11
11
|
import { EmojiTabs, EmojiPopoverStyled } from './styled';
|
|
12
12
|
// Utils
|
|
13
13
|
import { handleGetTextToReplace } from './utils';
|
|
14
|
-
const EmojiPopover = ({ disabled, collections, isForceHide, children, onEmojiClick, getPopupContainer, }) => {
|
|
14
|
+
const EmojiPopover = ({ disabled, collections, isForceHide, children, destroyTooltipOnHide, onEmojiClick, getPopupContainer, }) => {
|
|
15
15
|
const [state, setState] = useImmer({
|
|
16
16
|
isOpen: false,
|
|
17
17
|
collectionActive: collections ? collections[0]?.key : EMOJI_COLLECTIONS.COMMON,
|
|
@@ -70,7 +70,7 @@ const EmojiPopover = ({ disabled, collections, isForceHide, children, onEmojiCli
|
|
|
70
70
|
if (emojiCollections.length <= 1) {
|
|
71
71
|
content = emojiCollections.at(0)?.children;
|
|
72
72
|
}
|
|
73
|
-
return (_jsx(EmojiPopoverStyled, { content: content, placement: "topLeft", trigger: "click", fresh: false, style: { padding: 15 }, arrow: false, rootClassName: "antsomi-emoji-popover", open: state.isOpen, onOpenChange: handleOpenChange, getPopupContainer: getPopupContainer, children: children || (_jsx(Button, { type: "link", icon: _jsx(EmojiSmileIcon, {}), disabled: disabled, onClick: () => handleOpenChange(true) })) }));
|
|
73
|
+
return (_jsx(EmojiPopoverStyled, { content: content, placement: "topLeft", destroyTooltipOnHide: destroyTooltipOnHide, trigger: "click", fresh: false, style: { padding: 15 }, arrow: false, rootClassName: "antsomi-emoji-popover", open: state.isOpen, onOpenChange: handleOpenChange, getPopupContainer: getPopupContainer, children: children || (_jsx(Button, { type: "link", icon: _jsx(EmojiSmileIcon, {}), disabled: disabled, onClick: () => handleOpenChange(true) })) }));
|
|
74
74
|
};
|
|
75
75
|
EmojiPopover.defaultProps = {
|
|
76
76
|
disabled: false,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const EmojiTabs: import("styled-components").StyledComponent<import("react").FC<import("antd").TabsProps> & {
|
|
2
|
+
export declare const EmojiTabs: import("styled-components").StyledComponent<import("react").FC<import("antd/es/tabs").TabsProps> & {
|
|
3
3
|
TabPane: import("react").FC<import("antd").TabPaneProps>;
|
|
4
4
|
}, any, {
|
|
5
5
|
shadow?: boolean | undefined;
|
|
6
6
|
}, never>;
|
|
7
|
-
export declare const EmojiPopoverStyled: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").PopoverProps & import("react").RefAttributes<unknown>> & {
|
|
7
|
+
export declare const EmojiPopoverStyled: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/popover").PopoverProps & import("react").RefAttributes<unknown>> & {
|
|
8
8
|
_InternalPanelDoNotUseOrYouWillBeFired: import("react").FC<import("antd/es/popover/PurePanel").PurePanelProps>;
|
|
9
9
|
}, any, {}, never>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Libraries
|
|
2
|
-
import { Popover } from 'antd';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
// Components
|
|
5
4
|
import { Tabs as TabsUI } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
5
|
+
import { Popover } from '../../atoms/Popover';
|
|
6
6
|
export const EmojiTabs = styled(TabsUI) `
|
|
7
7
|
.antsomi-tabs-tab {
|
|
8
8
|
padding: 5.5px 20px !important;
|
|
@@ -26,7 +26,7 @@ export interface HeaderV2Props {
|
|
|
26
26
|
notificationConfig?: {
|
|
27
27
|
show?: boolean;
|
|
28
28
|
};
|
|
29
|
-
accountSharingConfig: Pick<AccountSharingProps, 'isShowSharing' | 'isShareAccountAccess' | 'u_ogs' | 'appCode' | 'callbackLogout' | 'callbackGetInfoAccount'> & {
|
|
29
|
+
accountSharingConfig: Pick<AccountSharingProps, 'isShowSharing' | 'isShareAccountAccess' | 'u_ogs' | 'appCode' | 'callbackLogout' | 'callbackGetInfoAccount' | 'portalRedirectUrl'> & {
|
|
30
30
|
show?: boolean;
|
|
31
31
|
};
|
|
32
32
|
useURLParam?: boolean;
|
|
@@ -16,7 +16,10 @@ export const OriginalModal = memo(props => {
|
|
|
16
16
|
});
|
|
17
17
|
OriginalModal.displayName = 'OriginalModal';
|
|
18
18
|
export const Modal = Object.assign(OriginalModal, {
|
|
19
|
-
confirm: (props) => StyledModal.confirm({
|
|
19
|
+
confirm: (props) => StyledModal.confirm({
|
|
20
|
+
cancelText: 'Cancel',
|
|
21
|
+
...props,
|
|
22
|
+
}),
|
|
20
23
|
useModal: StyledModal.useModal,
|
|
21
24
|
success: StyledModal.success,
|
|
22
25
|
info: StyledModal.info,
|
|
@@ -24,3 +27,6 @@ export const Modal = Object.assign(OriginalModal, {
|
|
|
24
27
|
warning: StyledModal.warning,
|
|
25
28
|
destroyAll: StyledModal.destroyAll,
|
|
26
29
|
});
|
|
30
|
+
Modal.defaultProps = {
|
|
31
|
+
loading: false,
|
|
32
|
+
};
|
|
@@ -5,7 +5,7 @@ import { StyledInput } from './styled';
|
|
|
5
5
|
import { translate, translations } from '@antscorp/antsomi-ui/es/locales';
|
|
6
6
|
import { SearchIcon } from '../../icons';
|
|
7
7
|
export const SearchPopover = props => {
|
|
8
|
-
const { inputSearchProps = {}, ...popoverProps } = props;
|
|
8
|
+
const { inputSearchProps = {}, inputSearchRef, ...popoverProps } = props;
|
|
9
9
|
const { overlayClassName, arrow = false, children, content, trigger = ['click'], ...restPopoverProps } = popoverProps;
|
|
10
|
-
return (_jsx(Popover, { trigger: trigger, arrow: arrow, destroyTooltipOnHide: true, ...restPopoverProps, overlayClassName: clsx('no-padding-content', overlayClassName), overlay: true, content: _jsxs(_Fragment, { children: [_jsx(StyledInput, { placeholder: inputSearchProps?.placeholder || `${translate(translations.global.search)}`, bordered: false, ...inputSearchProps, addonAfter: _jsx(SearchIcon, {}), withWrapper: false }), content] }), children: children }));
|
|
10
|
+
return (_jsx(Popover, { trigger: trigger, arrow: arrow, destroyTooltipOnHide: true, ...restPopoverProps, overlayClassName: clsx('no-padding-content', overlayClassName), overlay: true, content: _jsxs(_Fragment, { children: [_jsx(StyledInput, { ref: inputSearchRef, placeholder: inputSearchProps?.placeholder || `${translate(translations.global.search)}`, bordered: false, ...inputSearchProps, addonAfter: _jsx(SearchIcon, {}), withWrapper: false }), content] }), children: children }));
|
|
11
11
|
};
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledInput: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../atoms/Input").InputProps & import("react").RefAttributes<import("rc-input").InputRef>> & {
|
|
3
|
+
readonly DefaultInput: import("react").ForwardRefExoticComponent<import("antd").InputProps & import("react").RefAttributes<import("rc-input").InputRef>> & {
|
|
4
|
+
Group: import("react").FC<import("antd/es/input").GroupProps>;
|
|
5
|
+
Search: import("react").ForwardRefExoticComponent<import("antd/es/input").SearchProps & import("react").RefAttributes<import("rc-input").InputRef>>;
|
|
6
|
+
TextArea: import("react").ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>;
|
|
7
|
+
Password: import("react").ForwardRefExoticComponent<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("rc-input").InputRef>>;
|
|
8
|
+
};
|
|
9
|
+
readonly CustomSearch: import("react").ForwardRefExoticComponent<import("../../atoms/Input").InputProps & import("react").RefAttributes<import("rc-input").InputRef>>;
|
|
10
|
+
readonly TextArea: import("react").ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>;
|
|
11
|
+
readonly Password: import("react").ForwardRefExoticComponent<import("../../atoms/Input").InputProps & import("react").RefAttributes<import("rc-input").InputRef>>;
|
|
12
|
+
}, any, {}, never>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import styled from 'styled-components';
|
|
3
2
|
import { Input } from '../../atoms/Input';
|
|
4
3
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
5
|
-
export const StyledInput = styled(
|
|
4
|
+
export const StyledInput = styled(Input) `
|
|
6
5
|
&.antsomi-input-group-wrapper {
|
|
7
6
|
padding: 8px 10px;
|
|
8
7
|
border-bottom: 1px solid var(--divider-1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PopoverProps } from 'antd';
|
|
2
|
-
import { InputProps } from '../../atoms/Input';
|
|
1
|
+
import type { InputRef, PopoverProps } from 'antd';
|
|
2
|
+
import type { InputProps } from '../../atoms/Input';
|
|
3
3
|
import React, { PropsWithChildren } from 'react';
|
|
4
|
-
import { MenuInlineProps } from '../VirtualizedMenu/types';
|
|
4
|
+
import type { MenuInlineProps } from '../VirtualizedMenu/types';
|
|
5
5
|
export type SearchConfig = {
|
|
6
6
|
searchWithKey?: boolean;
|
|
7
7
|
};
|
|
@@ -9,6 +9,7 @@ export type SearchPopoverProps = PropsWithChildren<{
|
|
|
9
9
|
inputSearchProps?: InputProps & {
|
|
10
10
|
searchConfig?: SearchConfig;
|
|
11
11
|
};
|
|
12
|
+
inputSearchRef?: React.RefObject<InputRef>;
|
|
12
13
|
isAllowEmpty?: boolean;
|
|
13
14
|
noItemContent?: React.ReactNode;
|
|
14
15
|
} & PopoverProps>;
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// Libraries
|
|
3
3
|
import { Select as AntdSelect } from 'antd';
|
|
4
4
|
// Components
|
|
5
|
-
import { Flex } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
6
5
|
import { Text } from '../../atoms/Text';
|
|
6
|
+
import { Flex } from '../../atoms/Flex';
|
|
7
7
|
// Icons
|
|
8
8
|
import Icon from '@antscorp/icons';
|
|
9
9
|
// Constants
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { ShareAccessProps } from './types';
|
|
2
|
-
export declare const ShareAccess: (props: ShareAccessProps) => import("react/jsx-runtime").JSX.Element
|
|
3
|
+
export declare const ShareAccess: React.MemoExoticComponent<(props: ShareAccessProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable react/jsx-no-constructed-context-values */
|
|
3
|
-
import { useReducer } from 'react';
|
|
3
|
+
import { memo, useReducer } from 'react';
|
|
4
|
+
import isEqual from 'react-fast-compare';
|
|
4
5
|
import { ShareAccessDispatchContext, ShareAccessStateContext } from './context';
|
|
5
6
|
import { LayoutContent } from './components';
|
|
6
7
|
import { shareAccessReducer } from './reducer';
|
|
7
8
|
import { updateObjAccessInfo } from './actions';
|
|
8
9
|
import { useDeepCompareEffect } from '@antscorp/antsomi-ui/es/hooks/useDeepCompareEffect';
|
|
9
|
-
import { safeParseAccessInfo } from './utils';
|
|
10
|
-
export const ShareAccess = (props) => {
|
|
11
|
-
const { accessInfo, excludeUserAccess, userId, onChange, userPermission } = props;
|
|
12
|
-
const [state, dispatch] = useReducer(shareAccessReducer(onChange), {
|
|
10
|
+
import { fromRaw, safeParseAccessInfo } from './utils';
|
|
11
|
+
export const ShareAccess = memo((props) => {
|
|
12
|
+
const { accessInfo, rawAccessInfo, excludeUserAccess, userId, onChange, onRawChange, userPermission, isLoading, } = props;
|
|
13
|
+
const [state, dispatch] = useReducer(shareAccessReducer(onChange, onRawChange), {
|
|
13
14
|
modalTransferOwnership: {
|
|
14
15
|
open: false,
|
|
15
16
|
userToOwnerShipId: -1,
|
|
16
17
|
},
|
|
17
18
|
});
|
|
18
19
|
useDeepCompareEffect(() => {
|
|
19
|
-
|
|
20
|
+
const resolved = rawAccessInfo ? fromRaw(rawAccessInfo) : accessInfo;
|
|
21
|
+
if (!resolved)
|
|
20
22
|
return;
|
|
21
23
|
dispatch(updateObjAccessInfo({
|
|
22
|
-
updated: safeParseAccessInfo(
|
|
24
|
+
updated: safeParseAccessInfo(resolved),
|
|
23
25
|
triggerOut: false,
|
|
24
26
|
}));
|
|
25
|
-
}, [accessInfo]);
|
|
27
|
+
}, [accessInfo, rawAccessInfo]);
|
|
26
28
|
return (_jsx(ShareAccessStateContext.Provider, { value: {
|
|
27
29
|
...state,
|
|
28
30
|
excludeUserAccess,
|
|
29
31
|
accessUserId: userId,
|
|
30
32
|
accessUserPermission: userPermission,
|
|
33
|
+
isLoading,
|
|
31
34
|
}, children: _jsx(ShareAccessDispatchContext.Provider, { value: dispatch, children: _jsx(LayoutContent, { ...props }) }) }));
|
|
32
|
-
};
|
|
35
|
+
}, isEqual);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useShareAccess } from '../../hooks';
|
|
2
3
|
import { GeneralAccess } from '../GeneralAccess';
|
|
3
4
|
import { ModalTransferOwnership } from '../ModalTransferOwnerShip/ModalTransferOwnerShip';
|
|
4
5
|
import { PeopleAccess } from '../PeopleAccess';
|
|
5
6
|
import { SearchUser } from '../SearchUser';
|
|
6
7
|
import { StyledLayoutContentRoot } from './styled';
|
|
7
8
|
export const LayoutContent = (props) => {
|
|
8
|
-
const { getUserInfo, generalAccessSettings, excludeUserAccess, placeholder, allowAddUser = true, hideTransferOwnership, } = props;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (_jsxs(StyledLayoutContentRoot, { children: [allowAddUser && _jsx(SearchUser, { getUserInfo: getUserInfo, placeholder: placeholder }), _jsx(PeopleAccess, { excludeUserAccess: excludeUserAccess, hideTransferOwnership: hideTransferOwnership }), _jsx(GeneralAccess, { generalAccessSettings: generalAccessSettings }), _jsx(ModalTransferOwnership, {})] }));
|
|
9
|
+
const { getUserInfo, generalAccessSettings, excludeUserAccess, placeholder, allowAddUser = true, hideTransferOwnership, className, } = props;
|
|
10
|
+
const { state } = useShareAccess();
|
|
11
|
+
const { isLoading } = state;
|
|
12
|
+
return (_jsxs(StyledLayoutContentRoot, { className: className, children: [!isLoading && allowAddUser && (_jsx(SearchUser, { getUserInfo: getUserInfo, placeholder: placeholder })), _jsx(PeopleAccess, { excludeUserAccess: excludeUserAccess, hideTransferOwnership: hideTransferOwnership }), _jsx(GeneralAccess, { generalAccessSettings: generalAccessSettings }), _jsx(ModalTransferOwnership, {})] }));
|
|
13
13
|
};
|
|
@@ -19,7 +19,7 @@ const ROLE_BY_ACTIONS = {
|
|
|
19
19
|
export const PeopleAccess = (props) => {
|
|
20
20
|
const { excludeUserAccess, hideTransferOwnership } = props;
|
|
21
21
|
const { state, dispatch } = useShareAccess();
|
|
22
|
-
const { accessInfo, accessUserId, accessUserPermission } = state;
|
|
22
|
+
const { accessInfo, accessUserId, accessUserPermission, isLoading } = state;
|
|
23
23
|
const dataSourceSorted = useMemo(() => {
|
|
24
24
|
if (!Array.isArray(accessInfo?.listAccess))
|
|
25
25
|
return [];
|
|
@@ -86,7 +86,7 @@ export const PeopleAccess = (props) => {
|
|
|
86
86
|
};
|
|
87
87
|
if (!accessInfo)
|
|
88
88
|
return null;
|
|
89
|
-
return (_jsxs(StyledPeopleAccessRoot, { children: [_jsx("div", { className: "title", children: "People with access" }), _jsx(List, { dataSource: dataSourceSorted, loading: { spinning:
|
|
89
|
+
return (_jsxs(StyledPeopleAccessRoot, { children: [_jsx("div", { className: "title", children: "People with access" }), _jsx(List, { dataSource: dataSourceSorted, loading: { spinning: !!isLoading, indicator: _jsx(Spin, {}) }, renderItem: access => {
|
|
90
90
|
const actions = getActionsByUser({
|
|
91
91
|
userId: accessUserId,
|
|
92
92
|
updatedUserId: access.userId,
|
|
@@ -3,7 +3,8 @@ export declare const useShareAccess: () => {
|
|
|
3
3
|
state: {
|
|
4
4
|
allowEdit: boolean;
|
|
5
5
|
allowView: boolean;
|
|
6
|
-
accessInfo?: import("
|
|
6
|
+
accessInfo?: import("..").ObjectAccessInfo | undefined;
|
|
7
|
+
isLoading?: boolean | undefined;
|
|
7
8
|
accessUserId?: number | undefined;
|
|
8
9
|
accessUserPermission?: {
|
|
9
10
|
view: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ShareAccessAction, ShareAccessProps, ShareAccessState } from './types';
|
|
2
|
-
export declare const shareAccessReducer: (onChange: ShareAccessProps['onChange']) => (state: ShareAccessState, action: ShareAccessAction) => ShareAccessState;
|
|
2
|
+
export declare const shareAccessReducer: (onChange: ShareAccessProps['onChange'], onRawChange: ShareAccessProps['onRawChange']) => (state: ShareAccessState, action: ShareAccessAction) => ShareAccessState;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import produce from 'immer';
|
|
2
|
-
import { mappingOutData } from './utils';
|
|
3
2
|
import { TYPES } from './constants';
|
|
4
|
-
|
|
3
|
+
import { mappingOutData, toRaw } from './utils';
|
|
4
|
+
export const shareAccessReducer = (onChange, onRawChange) => (state, action) => produce(state, draft => {
|
|
5
5
|
switch (action.type) {
|
|
6
6
|
case TYPES.UPDATE_OBJECT_ACCESS_INFO: {
|
|
7
7
|
const { updated, triggerOut = true } = action.payload;
|
|
8
|
+
// console.log({ action });
|
|
8
9
|
draft.accessInfo = updated;
|
|
9
|
-
if (
|
|
10
|
-
|
|
10
|
+
if (triggerOut) {
|
|
11
|
+
const mapped = mappingOutData(action.payload.updated);
|
|
12
|
+
onChange?.(mapped);
|
|
13
|
+
onRawChange?.(toRaw(mapped));
|
|
11
14
|
}
|
|
12
15
|
break;
|
|
13
16
|
}
|
|
@@ -27,28 +27,50 @@ export type ObjectAccessInfo = {
|
|
|
27
27
|
ownerId: number;
|
|
28
28
|
listAccess: UserAccessInfo[];
|
|
29
29
|
};
|
|
30
|
+
export type UserAccessInfoRaw = {
|
|
31
|
+
user_id: number;
|
|
32
|
+
role: number;
|
|
33
|
+
allow_view: number;
|
|
34
|
+
allow_edit: number;
|
|
35
|
+
allow_comment: number;
|
|
36
|
+
full_name?: string;
|
|
37
|
+
email?: string;
|
|
38
|
+
avatar?: string;
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
};
|
|
41
|
+
export type ObjectAccessInfoRaw = {
|
|
42
|
+
is_public: number;
|
|
43
|
+
public_role: number | null;
|
|
44
|
+
owner_id?: number;
|
|
45
|
+
list_access: UserAccessInfoRaw[];
|
|
46
|
+
};
|
|
30
47
|
export type ActionKey = (typeof PEOPLE_ACTION_KEYS)[keyof typeof PEOPLE_ACTION_KEYS];
|
|
31
48
|
export type ExcludeUserAccess = Array<ActionKey>;
|
|
32
49
|
export type GeneralAccessSettings = {
|
|
33
50
|
publicOnlyWith?: boolean;
|
|
34
51
|
};
|
|
35
52
|
export type ShareAccessProps = {
|
|
53
|
+
className?: string;
|
|
36
54
|
userId?: number;
|
|
37
55
|
userPermission?: {
|
|
38
56
|
edit: number;
|
|
39
57
|
view: number;
|
|
40
58
|
};
|
|
41
59
|
accessInfo?: ObjectAccessInfo;
|
|
60
|
+
isLoading?: boolean;
|
|
42
61
|
allowAddUser?: boolean;
|
|
43
62
|
placeholder?: string;
|
|
44
63
|
excludeUserAccess?: ExcludeUserAccess;
|
|
45
64
|
getUserInfo?(search: string, signal: AbortSignal): Promise<UserInfo[]> | UserInfo[];
|
|
46
65
|
generalAccessSettings?: GeneralAccessSettings;
|
|
47
66
|
onChange?: (accessInfo: ObjectAccessInfo) => void;
|
|
67
|
+
rawAccessInfo?: ObjectAccessInfoRaw;
|
|
68
|
+
onRawChange?: (raw: ObjectAccessInfoRaw) => void;
|
|
48
69
|
hideTransferOwnership?: boolean;
|
|
49
70
|
};
|
|
50
71
|
export type ShareAccessState = {
|
|
51
72
|
accessInfo?: ObjectAccessInfo;
|
|
73
|
+
isLoading?: boolean;
|
|
52
74
|
accessUserId?: number;
|
|
53
75
|
accessUserPermission?: {
|
|
54
76
|
view: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionKey, ObjectAccessInfo, UserAccessInfo, UserInfo } from './types';
|
|
1
|
+
import { ActionKey, ObjectAccessInfo, ObjectAccessInfoRaw, UserAccessInfo, UserInfo } from './types';
|
|
2
2
|
export declare const mergePermission: (objectPermissionAllow: boolean, menuPermissionValue: number) => boolean;
|
|
3
3
|
export declare const composeObjectMenuPermissions: (params: {
|
|
4
4
|
isPublic: boolean;
|
|
@@ -54,6 +54,8 @@ export declare const safeParseAccessInfo: (accessInfo: ObjectAccessInfo) => {
|
|
|
54
54
|
isPublic: number;
|
|
55
55
|
publicRole: number | null;
|
|
56
56
|
};
|
|
57
|
+
export declare const fromRaw: (raw: ObjectAccessInfoRaw) => ObjectAccessInfo;
|
|
58
|
+
export declare const toRaw: (info: ObjectAccessInfo) => ObjectAccessInfoRaw;
|
|
57
59
|
export declare const mappingOutData: (shareAccess: ObjectAccessInfo) => {
|
|
58
60
|
isPublic: number;
|
|
59
61
|
publicRole: number | null;
|