@capillarytech/creatives-library 7.17.218 → 7.17.219-alpha.0
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/package.json +1 -1
- package/v2Components/CapTagList/index.js +50 -28
package/package.json
CHANGED
|
@@ -106,13 +106,16 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
106
106
|
getSearchedExpandedKeys(tags, value = '') {
|
|
107
107
|
let list = [];
|
|
108
108
|
_.forEach(tags, (val = {}, key) => {
|
|
109
|
+
const tagName = typeof(val?.name) === "string" ? _.toLower(_.get(val, 'name', '')) : _.toLower(_.get(val, 'name.props.defaultMessage', ''));
|
|
110
|
+
const tagNameWithoutUnderscore = tagName.replace(/_/g, ' ');
|
|
111
|
+
const searchStringLower = _.toLower(value);
|
|
109
112
|
if (_.has(val, 'subtags')) {
|
|
110
|
-
if (val.name &&
|
|
113
|
+
if (val.name && (tagName.includes(searchStringLower) || tagNameWithoutUnderscore.includes(searchStringLower))) {
|
|
111
114
|
list.push(key);
|
|
112
115
|
}
|
|
113
116
|
const temp = this.getSearchedExpandedKeys(val.subtags, value);
|
|
114
117
|
list = list.concat(temp);
|
|
115
|
-
} else if (val.name &&
|
|
118
|
+
} else if (val.name && (tagName.includes(searchStringLower) || tagNameWithoutUnderscore.includes(searchStringLower))) {
|
|
116
119
|
list.push(key);
|
|
117
120
|
}
|
|
118
121
|
});
|
|
@@ -185,7 +188,8 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
185
188
|
this.setState({showModal: true, visible: false});
|
|
186
189
|
};
|
|
187
190
|
|
|
188
|
-
renderTags(tags
|
|
191
|
+
renderTags(tags) {
|
|
192
|
+
const searchString = this.state.searchValue || '';
|
|
189
193
|
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags } = this?.props?.disableTagsDetails;
|
|
190
194
|
const { accessibleFeatures = [] } = this?.props?.currentOrgDetails || {};
|
|
191
195
|
const hideDateTagsForJpLocale = accessibleFeatures.includes(JP_LOCALE_HIDE_FEATURE);
|
|
@@ -210,40 +214,58 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
210
214
|
supportedTagsString += `${supportedTag} ,`;
|
|
211
215
|
});
|
|
212
216
|
supportedTagsString = supportedTagsString.replace(/,\s*$/, "");
|
|
213
|
-
const
|
|
217
|
+
const tagName = typeof(val?.name) === "string" ? _.toLower(_.get(val, 'name', '')) : _.toLower(_.get(val, 'name.props.defaultMessage', ''));
|
|
218
|
+
const tagNameWithoutUnderscore = tagName.replace(/_/g, ' ');
|
|
214
219
|
const searchStringLower = _.toLower(searchString);
|
|
215
|
-
const tagContainsSearchedString =
|
|
220
|
+
const tagContainsSearchedString = searchStringLower && (tagName.includes(searchStringLower) || tagNameWithoutUnderscore.includes(searchStringLower));
|
|
216
221
|
if (_.has(val, 'subtags')) {
|
|
217
222
|
const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
|
|
218
|
-
const temp = this.renderTags(val
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
223
|
+
const temp = this.renderTags(val?.subtags);
|
|
224
|
+
if (temp?.length) {
|
|
225
|
+
const tagValue = (
|
|
226
|
+
<CapTreeNode
|
|
227
|
+
title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val?.name}</CapTooltip> : val?.name}
|
|
228
|
+
tag={val}
|
|
229
|
+
key={val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`}
|
|
230
|
+
disabled={disabled}
|
|
231
|
+
>
|
|
232
|
+
{temp}
|
|
233
|
+
</CapTreeNode>
|
|
234
|
+
);
|
|
235
|
+
hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tagValue);
|
|
236
|
+
}
|
|
237
|
+
} else {
|
|
231
238
|
let childDisabled = true;
|
|
232
239
|
if (key === CUSTOMER_BARCODE_TAG && !hasCustomerBarcodeFeatureEnabled()) {
|
|
233
240
|
childDisabled = true;
|
|
234
241
|
} else {
|
|
235
242
|
childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
|
|
236
243
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
if (searchString) {
|
|
245
|
+
if (tagContainsSearchedString) {
|
|
246
|
+
const tempNode = (
|
|
247
|
+
<CapTreeNode
|
|
248
|
+
title={childDisabled ? <CapTooltip title={key === CUSTOMER_BARCODE_TAG ? customerBarcodeDisableText : loyaltyAttrDisableText}>{val?.desc || val?.name}</CapTooltip> : (val?.desc || val?.name)}
|
|
249
|
+
tag={val}
|
|
250
|
+
isLeaf
|
|
251
|
+
key={val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`}
|
|
252
|
+
disabled={childDisabled}
|
|
253
|
+
>
|
|
254
|
+
</CapTreeNode>);
|
|
255
|
+
hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tempNode);
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
const tempNode = (
|
|
259
|
+
<CapTreeNode
|
|
260
|
+
title={childDisabled ? <CapTooltip title={key === CUSTOMER_BARCODE_TAG ? customerBarcodeDisableText : loyaltyAttrDisableText}>{val?.desc || val?.name}</CapTooltip> : (val?.desc || val?.name)}
|
|
261
|
+
tag={val}
|
|
262
|
+
isLeaf
|
|
263
|
+
key={val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`}
|
|
264
|
+
disabled={childDisabled}
|
|
265
|
+
>
|
|
266
|
+
</CapTreeNode>);
|
|
267
|
+
hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tempNode);
|
|
268
|
+
}
|
|
247
269
|
}
|
|
248
270
|
});
|
|
249
271
|
return list;
|