@antscorp/antsomi-ui 1.3.3-beta.88 → 1.3.3-beta.89
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/InputDynamic/InputDynamic.js +12 -9
- package/es/components/atoms/InputDynamic/utils.js +1 -4
- package/es/components/atoms/SlideBar/SlideBar.d.ts +3 -0
- package/es/components/atoms/SlideBar/SlideBar.js +12 -1
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.d.ts +1 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.js +2 -2
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/index.d.ts +1 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/index.js +4 -2
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/styled.js +1 -1
- package/package.json +1 -1
|
@@ -98,7 +98,7 @@ export const InputDynamic = (props) => {
|
|
|
98
98
|
tmp = tmp === null || tmp === void 0 ? void 0 : tmp.replace(
|
|
99
99
|
// replace old non tracking url to detect url
|
|
100
100
|
/<button(?=[^>]*class="insert-word")[^>]*value=['"]#(?:{nontrackurl\()?(https?:\/\/[0-9a-zA-Z-{}|"\./?_=&%:#*@;]+)(?:\)})?['"][^>]*>.*?<\/button>/g, match => {
|
|
101
|
-
const url = match.match(/(https?:\/\/[0-9a-zA-Z-\./?_=&%:#*@;]+)/);
|
|
101
|
+
const url = match.match(/(https?:\/\/[0-9a-zA-Z-\./?_=&%:#*@;]+)(?![^ ])/);
|
|
102
102
|
if (url) {
|
|
103
103
|
return `<span id="${random(5)}" class="detect-url">${url[1]}</span>`;
|
|
104
104
|
}
|
|
@@ -160,13 +160,23 @@ export const InputDynamic = (props) => {
|
|
|
160
160
|
break;
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
|
+
const handleChangeInputDebounce = (ms) => {
|
|
164
|
+
clearTimeout(timerRef.current);
|
|
165
|
+
timerRef.current = setTimeout(() => {
|
|
166
|
+
caretPositionRef.current = CaretPositioning.saveSelection(personalizationInputRef.current);
|
|
167
|
+
onTriggerChange();
|
|
168
|
+
}, ms);
|
|
169
|
+
};
|
|
163
170
|
const onPaste = (e) => {
|
|
171
|
+
var _a;
|
|
164
172
|
// cancel paste
|
|
165
173
|
e.preventDefault();
|
|
166
174
|
// get text representation of clipboard
|
|
167
175
|
const text = (e.originalEvent || e).clipboardData.getData('text/plain');
|
|
176
|
+
handleChangeInputDebounce(ms);
|
|
168
177
|
// insert text manually
|
|
169
178
|
document.execCommand('insertHTML', false, text);
|
|
179
|
+
(_a = personalizationInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
170
180
|
};
|
|
171
181
|
const handleInsertSortLink = (url, type) => {
|
|
172
182
|
try {
|
|
@@ -247,16 +257,9 @@ export const InputDynamic = (props) => {
|
|
|
247
257
|
console.log(error);
|
|
248
258
|
}
|
|
249
259
|
};
|
|
250
|
-
const handleChangeInputDebounce = () => {
|
|
251
|
-
clearTimeout(timerRef.current);
|
|
252
|
-
timerRef.current = setTimeout(() => {
|
|
253
|
-
caretPositionRef.current = CaretPositioning.saveSelection(personalizationInputRef.current);
|
|
254
|
-
onTriggerChange();
|
|
255
|
-
}, ms);
|
|
256
|
-
};
|
|
257
260
|
const handleKeyPress = (e) => {
|
|
258
261
|
if (isRealTime) {
|
|
259
|
-
handleChangeInputDebounce();
|
|
262
|
+
handleChangeInputDebounce(ms);
|
|
260
263
|
}
|
|
261
264
|
if (canMultipleLine)
|
|
262
265
|
return;
|
|
@@ -107,10 +107,7 @@ export const convertHtmlText = (htmlText, format = 'raw', state, objectWidgetInp
|
|
|
107
107
|
else if (found[0] === 'productTemplate') {
|
|
108
108
|
bgColor = '#9238b5';
|
|
109
109
|
}
|
|
110
|
-
else if (found[0] === 'promotion_code' ||
|
|
111
|
-
foundLink[0] === 'nontrackurl' ||
|
|
112
|
-
foundLink[0] === 'shortlink' ||
|
|
113
|
-
foundLink[0] === 'shortlink_static') {
|
|
110
|
+
else if (found[0] === 'promotion_code' || foundLink[0] === 'nontrackurl') {
|
|
114
111
|
bgColor = '#6750A7';
|
|
115
112
|
}
|
|
116
113
|
else if (found[0] === 'custom') {
|
|
@@ -11,6 +11,9 @@ export type SlideBarLimitProps = {
|
|
|
11
11
|
export type ActionType = (typeof slideActionType)[keyof typeof slideActionType];
|
|
12
12
|
export type SlideBarState = {
|
|
13
13
|
cacheInfoClicked: SlideBarOptionProps;
|
|
14
|
+
openPopover: {
|
|
15
|
+
[key in string]: boolean;
|
|
16
|
+
};
|
|
14
17
|
disabledPrev: boolean;
|
|
15
18
|
disabledNext: boolean;
|
|
16
19
|
notiUpdateScroll: number;
|
|
@@ -29,6 +29,7 @@ export const SlideBar = props => {
|
|
|
29
29
|
label: '',
|
|
30
30
|
value: '',
|
|
31
31
|
},
|
|
32
|
+
openPopover: {},
|
|
32
33
|
disabledPrev: true,
|
|
33
34
|
disabledNext: true,
|
|
34
35
|
notiUpdateScroll: 1,
|
|
@@ -93,11 +94,15 @@ export const SlideBar = props => {
|
|
|
93
94
|
console.log(error);
|
|
94
95
|
}
|
|
95
96
|
};
|
|
97
|
+
const handleClosePopover = () => {
|
|
98
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { openPopover: {} })));
|
|
99
|
+
};
|
|
96
100
|
const handleDuplicateSlide = (slideInfo) => {
|
|
97
101
|
try {
|
|
98
102
|
if (typeof callback === 'function' && !_.isEmpty(slideInfo)) {
|
|
99
103
|
callback(slideActionType.DUPLICATE, slideInfo);
|
|
100
104
|
}
|
|
105
|
+
handleClosePopover();
|
|
101
106
|
}
|
|
102
107
|
catch (error) {
|
|
103
108
|
handleError(error, {
|
|
@@ -117,6 +122,7 @@ export const SlideBar = props => {
|
|
|
117
122
|
if (typeof callback === 'function' && !_.isEmpty(slideInfo)) {
|
|
118
123
|
callback(slideActionType.DELETE, slideInfo);
|
|
119
124
|
}
|
|
125
|
+
handleClosePopover();
|
|
120
126
|
}
|
|
121
127
|
catch (error) {
|
|
122
128
|
handleError(error, {
|
|
@@ -177,6 +183,11 @@ export const SlideBar = props => {
|
|
|
177
183
|
});
|
|
178
184
|
}
|
|
179
185
|
};
|
|
186
|
+
const handleOpenChange = (newOpen, itemId) => {
|
|
187
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { openPopover: {
|
|
188
|
+
[itemId]: newOpen,
|
|
189
|
+
} })));
|
|
190
|
+
};
|
|
180
191
|
useEffect(() => () => {
|
|
181
192
|
setState(prev => (Object.assign(Object.assign({}, prev), { cacheInfoClicked: { label: '', value: '' } })));
|
|
182
193
|
}, []);
|
|
@@ -217,7 +228,7 @@ export const SlideBar = props => {
|
|
|
217
228
|
handleActiveSlide(e, item);
|
|
218
229
|
} }),
|
|
219
230
|
React.createElement(SlideText, { isActive: activeId === item.value }, label),
|
|
220
|
-
!isViewMode && (React.createElement(Popover, { placement: "bottomLeft", trigger: "click", content: React.createElement(MenuList, null,
|
|
231
|
+
!isViewMode && (React.createElement(Popover, { placement: "bottomLeft", trigger: "click", open: state.openPopover[item.value], onOpenChange: newOpen => handleOpenChange(newOpen, item.value), content: React.createElement(MenuList, null,
|
|
221
232
|
React.createElement(WrapperDisable, { disabled: disabledDuplicate },
|
|
222
233
|
React.createElement(MenuItem, { isDisabled: disabledDuplicate, onClick: (e) => {
|
|
223
234
|
e.stopPropagation();
|
|
@@ -8,7 +8,7 @@ import { RichMenuCell } from './RichMenuCell';
|
|
|
8
8
|
import { tryCatchWrapper } from '@antscorp/antsomi-ui/es/utils';
|
|
9
9
|
const PATH = 'src/app/modules/Dashboard/containers/RichMenu/containers/Design/components/Workspace/components/RichMenuBlock/index.tsx';
|
|
10
10
|
export const RichMenuBlock = props => {
|
|
11
|
-
const { richMenu, layerActive, cellActiveIdx, isPreview, onClickCell, onChange } = props;
|
|
11
|
+
const { richMenu, layerActive, cellActiveIdx, isPreview, isActionLink = false, onClickCell, onChange, } = props;
|
|
12
12
|
const { gridTemplateCols = [], gridTemplateRows = [], cells = [], uploadMode, image, layoutType, rows, cols, } = richMenu || {};
|
|
13
13
|
const { imageUrl, imageStyles } = image || {};
|
|
14
14
|
const grid = {
|
|
@@ -44,7 +44,7 @@ export const RichMenuBlock = props => {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}, PATH);
|
|
47
|
-
const renderCell = (cellInfo, ctx) => (React.createElement(RichMenuCell, { context: ctx, isPreview: isPreview, layerActive: layerActive, cellActiveIdx: cellActiveIdx, cell: cellInfo, isSingleMode: isSingleUploadMode, onClick: handleClickCell }));
|
|
47
|
+
const renderCell = (cellInfo, ctx) => (React.createElement(RichMenuCell, { context: ctx, isActionLink: isActionLink, isPreview: isPreview, layerActive: layerActive, cellActiveIdx: cellActiveIdx, cell: cellInfo, isSingleMode: isSingleUploadMode, onClick: handleClickCell }));
|
|
48
48
|
return (React.createElement(ResizeGrid, Object.assign({ grid: grid, isPreview: isPreview, containerStyle: imageStyles, isCompact: layoutType === 'compact', renderCell: renderCell, cellActiveStyle: { background: 'rgba(0, 95, 184, 0.5)' }, cellBorder: isSingleUploadMode ? '1px solid rgba(0, 95, 184, 1)' : '1px dotted #000000', onChange: handleGridChange }, Object.assign({}, (isSingleUploadMode && {
|
|
49
49
|
image: imageUrl,
|
|
50
50
|
imagePosition: imageStyles === null || imageStyles === void 0 ? void 0 : imageStyles.objectPosition,
|
|
@@ -23,7 +23,7 @@ import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
|
23
23
|
import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
24
24
|
const PATH = 'src/app/modules/Dashboard/containers/RichMenu/containers/Design/components/Workspace/components/RichMenuCell';
|
|
25
25
|
export const RichMenuCell = props => {
|
|
26
|
-
const { cell, context, layerActive = 'all', cellActiveIdx, isSingleMode, isPreview, onClick, } = props;
|
|
26
|
+
const { cell, context, layerActive = 'all', cellActiveIdx, isSingleMode, isPreview, isActionLink = false, onClick, } = props;
|
|
27
27
|
const [videoState, setVideoState] = useState({
|
|
28
28
|
status: 'idle',
|
|
29
29
|
});
|
|
@@ -93,7 +93,9 @@ export const RichMenuCell = props => {
|
|
|
93
93
|
React.createElement(ActionButton, { id: "video-capture-action-play", onClick: handleVideoPlay },
|
|
94
94
|
React.createElement(Icon, { type: "icon-ants-play-circle", size: 24, style: { width: 26, color: '#fff' } }),
|
|
95
95
|
isAddLabel && React.createElement(ActionButtonLabel, null, "Play")),
|
|
96
|
-
isAddLabel && action.label && (React.createElement(Link, { id: "video-capture-action-external"
|
|
96
|
+
isAddLabel && action.label && (React.createElement(Link, Object.assign({ id: "video-capture-action-external" }, (isActionLink
|
|
97
|
+
? { href: action.externalUrl, target: '_blank', rel: 'noreferrer' }
|
|
98
|
+
: {})),
|
|
97
99
|
React.createElement("div", { style: { width: 26 } },
|
|
98
100
|
React.createElement(CircleBorder, null,
|
|
99
101
|
React.createElement(Icon, { type: "icon-ants-redo", size: 14, style: { color: '#fff', height: '17px' } }))),
|