@antscorp/antsomi-ui 1.3.5-beta.788 → 1.3.5-beta.789
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/TagifyInput/TagifyInput.js +26 -7
- package/es/components/molecules/TagifyInput/types.d.ts +1 -0
- package/es/locales/en/google-sheet.json +2 -0
- package/es/locales/i18n.d.ts +6 -0
- package/es/locales/ja/google-sheet.json +2 -0
- package/es/locales/vi/google-sheet.json +3 -1
- package/package.json +5 -2
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// Libraries
|
|
3
3
|
import { useRef, useEffect, useCallback, useMemo, memo, forwardRef, useImperativeHandle, useLayoutEffect, } from 'react';
|
|
4
4
|
import _ from 'lodash';
|
|
5
|
+
import htmlEntities from 'he';
|
|
5
6
|
// Hooks
|
|
6
7
|
import { useDeepCompareMemo } from '@antscorp/antsomi-ui/es/hooks/useDeepCompareMemo';
|
|
7
8
|
import { useDebounce } from '@antscorp/antsomi-ui/es/hooks/useDebounce';
|
|
@@ -20,7 +21,7 @@ import { acceptablePatternChecking, getCachedRegex, getPersonalizeTagInfo, patte
|
|
|
20
21
|
import { EMOJI, PERSONALIZE_PTN, SHORT_LINK, defaultCssVariables, tagifyDefaultProps, } from './constants';
|
|
21
22
|
const TagifyInput = forwardRef((props, ref) => {
|
|
22
23
|
// Props
|
|
23
|
-
const { initialValue, status, readonly, disabled, maxLength, maxHeight, placeholder, acceptableTagPattern, mapAttributes, maxPersonalizeTags, name, children, cssTagifyVariables, onTagClick, onChange, } = props;
|
|
24
|
+
const { initialValue, escapeHTML, status, readonly, disabled, maxLength, maxHeight, placeholder, acceptableTagPattern, mapAttributes, maxPersonalizeTags, name, children, cssTagifyVariables, onTagClick, onChange, } = props;
|
|
24
25
|
// States
|
|
25
26
|
const [inputTypeDebounce, , setInputTyping] = useDebounce(initialValue, 450);
|
|
26
27
|
// Refs
|
|
@@ -30,7 +31,19 @@ const TagifyInput = forwardRef((props, ref) => {
|
|
|
30
31
|
const placeHolderRef = useRef(null);
|
|
31
32
|
// Memoizations
|
|
32
33
|
const cssVariablesMemoized = useMemo(() => _.assign({}, defaultCssVariables, cssTagifyVariables || {}), [cssTagifyVariables]);
|
|
33
|
-
|
|
34
|
+
// Only run in the first render
|
|
35
|
+
// Use for the initialize value of the tagify instance
|
|
36
|
+
const parsedDefaultValue = useDeepCompareMemo(() => {
|
|
37
|
+
if (!escapeHTML) {
|
|
38
|
+
return parseTagStringToTagify(initialValue, acceptableTagPattern);
|
|
39
|
+
}
|
|
40
|
+
// Sometimes the input value has html tags, it makes the input rendered incorrectly -> it rendered html
|
|
41
|
+
// -> need to escape the html tags to render correctly
|
|
42
|
+
const escapeContent = htmlEntities.escape(initialValue);
|
|
43
|
+
const content = parseTagStringToTagify(escapeContent, acceptableTagPattern);
|
|
44
|
+
return content;
|
|
45
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
+
}, []);
|
|
34
47
|
// Expose some methods
|
|
35
48
|
useImperativeHandle(ref, () => ({
|
|
36
49
|
onAddNewTag: (newTag) => {
|
|
@@ -315,17 +328,23 @@ const TagifyInput = forwardRef((props, ref) => {
|
|
|
315
328
|
const { empty } = settings.classNames;
|
|
316
329
|
const { classList } = DOM?.scope;
|
|
317
330
|
// If input is empty, load the original values
|
|
318
|
-
if (classList.contains(empty) &&
|
|
319
|
-
_.
|
|
320
|
-
|
|
321
|
-
|
|
331
|
+
if (classList.contains(empty) && _.isString(initialValue) && initialValue !== '') {
|
|
332
|
+
let textValue = _.cloneDeep(initialValue);
|
|
333
|
+
if (escapeHTML) {
|
|
334
|
+
// Sometimes the input value has html tags, it makes the input rendered incorrectly -> it rendered html
|
|
335
|
+
// -> need to escape the html tags to render correctly
|
|
336
|
+
textValue = htmlEntities.escape(textValue);
|
|
337
|
+
}
|
|
338
|
+
// Convert the string to tagify pattern
|
|
339
|
+
const content = parseTagStringToTagify(textValue, acceptableTagPattern);
|
|
340
|
+
tagifyRef.current.loadOriginalValues(content);
|
|
322
341
|
// Need to sync label of the tags if any map attribute is changed to make correct label
|
|
323
342
|
if (!_.isEmpty(mapAttributes)) {
|
|
324
343
|
makeValidLabelTags(mapAttributes);
|
|
325
344
|
}
|
|
326
345
|
}
|
|
327
346
|
}
|
|
328
|
-
}, [
|
|
347
|
+
}, [initialValue, mapAttributes, escapeHTML, acceptableTagPattern, makeValidLabelTags]);
|
|
329
348
|
// Float style input
|
|
330
349
|
useEffect(() => {
|
|
331
350
|
if (!tagifyRef.current?.DOM.scope)
|
|
@@ -14,6 +14,7 @@ export interface TagifyInputProps {
|
|
|
14
14
|
* Only used when the component is first rendered.
|
|
15
15
|
*/
|
|
16
16
|
initialValue: string;
|
|
17
|
+
escapeHTML?: boolean;
|
|
17
18
|
/**
|
|
18
19
|
* Optional mapping configuration for custom attributes associated with tags.
|
|
19
20
|
* Defines how tag attributes are mapped and processed internally.
|
|
@@ -2042,6 +2042,8 @@
|
|
|
2042
2042
|
"_3RD_CAMPAIGN_MESSAGE_DELIVERY": "Message delivery",
|
|
2043
2043
|
"_3RD_CAMPAIGN_MESSAGE_DELIVERY_TOOLTIP": "Please schedule the message at least 3 hours in advance and ensure it falls within the allowed time frame for sending advertising messages from 8:00 AM to 11:30 AM and 1:30 PM to 8:00 PM.",
|
|
2044
2044
|
"_3RD_CAMPAIGN_INFO_AUDIENCE_SIZE": "Recommend targeting an audience size of less than 100K to ensure the message is delivered on time.",
|
|
2045
|
+
"_3RD_CAMPAIGN_ERROR_START_TIME": "Start time should be at least 3 hour after saving journey",
|
|
2046
|
+
"_3RD_CAMPAIGN_TITLE_SCHEDULE": "Schedule",
|
|
2045
2047
|
"_PREDICT_MODEL_ALL_MODEL": "All Models",
|
|
2046
2048
|
"_PREDICT_MODEL_TAB_PREDICTIVE_MODELS": "Predictive Models",
|
|
2047
2049
|
"_PREDICT_MODEL_TAB_COMPUTATION_HISTORIES": "Computation Histories ",
|
package/es/locales/i18n.d.ts
CHANGED
|
@@ -2044,6 +2044,8 @@ export declare const translationsJson: {
|
|
|
2044
2044
|
_3RD_CAMPAIGN_MESSAGE_DELIVERY: string;
|
|
2045
2045
|
_3RD_CAMPAIGN_MESSAGE_DELIVERY_TOOLTIP: string;
|
|
2046
2046
|
_3RD_CAMPAIGN_INFO_AUDIENCE_SIZE: string;
|
|
2047
|
+
_3RD_CAMPAIGN_ERROR_START_TIME: string;
|
|
2048
|
+
_3RD_CAMPAIGN_TITLE_SCHEDULE: string;
|
|
2047
2049
|
_PREDICT_MODEL_ALL_MODEL: string;
|
|
2048
2050
|
_PREDICT_MODEL_TAB_PREDICTIVE_MODELS: string;
|
|
2049
2051
|
_PREDICT_MODEL_TAB_COMPUTATION_HISTORIES: string;
|
|
@@ -5387,6 +5389,8 @@ export declare const translationsJson: {
|
|
|
5387
5389
|
_3RD_CAMPAIGN_MESSAGE_DELIVERY: string;
|
|
5388
5390
|
_3RD_CAMPAIGN_MESSAGE_DELIVERY_TOOLTIP: string;
|
|
5389
5391
|
_3RD_CAMPAIGN_INFO_AUDIENCE_SIZE: string;
|
|
5392
|
+
_3RD_CAMPAIGN_ERROR_START_TIME: string;
|
|
5393
|
+
_3RD_CAMPAIGN_TITLE_SCHEDULE: string;
|
|
5390
5394
|
_PREDICT_MODEL_ALL_MODEL: string;
|
|
5391
5395
|
_PREDICT_MODEL_TAB_PREDICTIVE_MODELS: string;
|
|
5392
5396
|
_PREDICT_MODEL_TAB_COMPUTATION_HISTORIES: string;
|
|
@@ -8276,6 +8280,8 @@ export declare const translationsJson: {
|
|
|
8276
8280
|
_3RD_CAMPAIGN_MESSAGE_DELIVERY: string;
|
|
8277
8281
|
_3RD_CAMPAIGN_MESSAGE_DELIVERY_TOOLTIP: string;
|
|
8278
8282
|
_3RD_CAMPAIGN_INFO_AUDIENCE_SIZE: string;
|
|
8283
|
+
_3RD_CAMPAIGN_ERROR_START_TIME: string;
|
|
8284
|
+
_3RD_CAMPAIGN_TITLE_SCHEDULE: string;
|
|
8279
8285
|
_PREDICT_MODEL_ALL_MODEL: string;
|
|
8280
8286
|
_PREDICT_MODEL_TAB_PREDICTIVE_MODELS: string;
|
|
8281
8287
|
_PREDICT_MODEL_TAB_COMPUTATION_HISTORIES: string;
|
|
@@ -2038,6 +2038,8 @@
|
|
|
2038
2038
|
"_3RD_CAMPAIGN_MESSAGE_DELIVERY": "メッセージ配信",
|
|
2039
2039
|
"_3RD_CAMPAIGN_MESSAGE_DELIVERY_TOOLTIP": "メッセージは少なくとも 3 時間前にスケジュールし、午前 8 時から午前 11 時 30 分と午後 1 時 30 分から午後 8 時までの広告メッセージの送信に許可されている時間枠内に収まるようにしてください。",
|
|
2040
2040
|
"_3RD_CAMPAIGN_INFO_AUDIENCE_SIZE": "メッセージが予定どおりに配信されるように、対象ユーザーのサイズを 100,000 未満にすることをお勧めします。",
|
|
2041
|
+
"_3RD_CAMPAIGN_ERROR_START_TIME": "開始時間はルートを保存してから少なくとも 3 時間である必要があります",
|
|
2042
|
+
"_3RD_CAMPAIGN_TITLE_SCHEDULE": "スケジュール",
|
|
2041
2043
|
"_PREDICT_MODEL_ALL_MODEL": "全モデル",
|
|
2042
2044
|
"_PREDICT_MODEL_TAB_PREDICTIVE_MODELS": "予測モデル",
|
|
2043
2045
|
"_PREDICT_MODEL_TAB_COMPUTATION_HISTORIES": "計算履歴 ",
|
|
@@ -2041,7 +2041,9 @@
|
|
|
2041
2041
|
"_BLAST_CAMPAIGN_NO_TEMP": "Không có mẫu tin nào. Vui lòng kiểm tra các điểm đến của bạn.",
|
|
2042
2042
|
"_3RD_CAMPAIGN_MESSAGE_DELIVERY": "Gửi tin nhắn",
|
|
2043
2043
|
"_3RD_CAMPAIGN_MESSAGE_DELIVERY_TOOLTIP": "Vui lòng lên lịch gửi tin nhắn trước ít nhất 3 giờ và đảm bảo nằm trong khung thời gian được phép gửi tin nhắn quảng cáo từ 8:00 sáng đến 11:30 sáng và từ 1:30 chiều đến 8:00 tối.",
|
|
2044
|
-
"_3RD_CAMPAIGN_INFO_AUDIENCE_SIZE": "Đề xuất nhắm mục tiêu đến nhóm đối tượng dưới 100K để đảm bảo thông điệp được gửi đúng thời
|
|
2044
|
+
"_3RD_CAMPAIGN_INFO_AUDIENCE_SIZE": "Đề xuất nhắm mục tiêu đến nhóm đối tượng dưới 100K để đảm bảo thông điệp được gửi đúng thời gian.",
|
|
2045
|
+
"_3RD_CAMPAIGN_ERROR_START_TIME": "Thời gian bắt đầu phải ít nhất 3 giờ sau khi lưu hành trình",
|
|
2046
|
+
"_3RD_CAMPAIGN_TITLE_SCHEDULE": "Đặt lịch",
|
|
2045
2047
|
"_PREDICT_MODEL_ALL_MODEL": "Tất cả các mẫu",
|
|
2046
2048
|
"_PREDICT_MODEL_TAB_PREDICTIVE_MODELS": "Mô hình dự đoán",
|
|
2047
2049
|
"_PREDICT_MODEL_TAB_COMPUTATION_HISTORIES": "Lịch sử tính toán ",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antscorp/antsomi-ui",
|
|
3
|
-
"version": "1.3.5-beta.
|
|
3
|
+
"version": "1.3.5-beta.789",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -85,7 +85,6 @@
|
|
|
85
85
|
"@types/react-router-dom": "^5.3.3",
|
|
86
86
|
"@types/react-window": "^1.8.8",
|
|
87
87
|
"@yaireo/tagify": "^4.31.2",
|
|
88
|
-
"string-replace-to-array": "^2.1.0",
|
|
89
88
|
"ace-builds": "1.4.14",
|
|
90
89
|
"animate.css": "^4.1.1",
|
|
91
90
|
"antd": "5.12.6",
|
|
@@ -98,6 +97,7 @@
|
|
|
98
97
|
"deepmerge": "^4.3.1",
|
|
99
98
|
"fabric": "^5.3.0",
|
|
100
99
|
"font-awesome": "4.7.0",
|
|
100
|
+
"he": "^1.2.0",
|
|
101
101
|
"highlight.js": "^11.8.0",
|
|
102
102
|
"html-entities": "^2.0.2",
|
|
103
103
|
"html-react-parser": "^5.1.12",
|
|
@@ -132,6 +132,7 @@
|
|
|
132
132
|
"remark-gfm": "^3.0.1",
|
|
133
133
|
"remark-gfm-alias-story": "npm:remark-gfm@4.0.0",
|
|
134
134
|
"socket.io-client": "^4.7.5",
|
|
135
|
+
"string-replace-to-array": "^2.1.0",
|
|
135
136
|
"swiper": "^11.0.7",
|
|
136
137
|
"tui-image-editor": "^3.15.3",
|
|
137
138
|
"uniqid": "^5.4.0",
|
|
@@ -171,6 +172,8 @@
|
|
|
171
172
|
"@testing-library/jest-dom": "^6.5.0",
|
|
172
173
|
"@testing-library/react": "^16.0.0",
|
|
173
174
|
"@testing-library/user-event": "^14.5.2",
|
|
175
|
+
"@types/he": "^1.2.3",
|
|
176
|
+
"@types/jest": "^29.5.0",
|
|
174
177
|
"@types/node": "^18.15.10",
|
|
175
178
|
"@types/pako": "2.0.0",
|
|
176
179
|
"@types/react": "^18.0.33",
|