@omniumretail/component-library 1.1.58 → 1.1.60

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.1.58",
3
+ "version": "1.1.60",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -60,11 +60,13 @@ export const TagField = (props: customTagProps) => {
60
60
  if (inputValue && allTags.indexOf(inputValue) === -1) {
61
61
  const [, value] = inputValue.split('=');
62
62
 
63
- const newAllTags = props.addSwitch ? [inputValue] : [...allTags, inputValue];
64
- const newTags = props.addSwitch ? [inputValue] : [...tags, inputValue];
65
-
66
- setAllTags(newAllTags);
67
- setTags(newTags);
63
+ if (props.addSwitch) {
64
+ const newTags = props.addSwitch ? [inputValue] : [...tags, inputValue];
65
+ setTags(newTags);
66
+ setAllTags([inputValue]);
67
+ } else {
68
+ setAllTags([...allTags, inputValue]);
69
+ }
68
70
 
69
71
  const matchedFilter = advancedTags && advancedTags.find(filter => filter.display === inputValue.split('=')[0]);
70
72
 
@@ -75,8 +77,10 @@ export const TagField = (props: customTagProps) => {
75
77
  };
76
78
 
77
79
  setAdvancedTagList([...advancedTagList, newTag]);
80
+
78
81
  } else if (props.addSwitch) {
79
82
  setTags([inputValue]);
83
+
80
84
  } else {
81
85
  setTags([...tags, inputValue]);
82
86
  }
@@ -123,8 +127,14 @@ export const TagField = (props: customTagProps) => {
123
127
  // Adiciona a nova tag ao allTags usando a prop addExtraTags
124
128
  if (props.addExtraTags && typeof props.addExtraTags === "string") {
125
129
  const newTags = props.addSwitch ? [props.addExtraTags] : [...tags, props.addExtraTags];
126
- setTags(newTags);
127
- setAllTags(newTags);
130
+
131
+ if (props.addSwitch) {
132
+ setTags([props.addExtraTags]);
133
+ setAllTags([props.addExtraTags]);
134
+ } else {
135
+ setTags([...tags, props.addExtraTags]);
136
+ setAllTags([...allTags, props.addExtraTags]);
137
+ }
128
138
  }
129
139
  }, [props.addExtraTags, props.addSwitch]);
130
140