intelicoreact 1.4.72 → 1.4.73

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.
@@ -55,26 +55,22 @@ const TagList = _ref => {
55
55
  onToggleRenderAll === null || onToggleRenderAll === void 0 ? void 0 : onToggleRenderAll(v);
56
56
  };
57
57
 
58
- const getStaticTagsCount = () => {
59
- var _window$getComputedSt;
58
+ const getStaticTagsCount = computedWidth => {
59
+ var _result$items;
60
60
 
61
61
  if (typeof shownItemsCount === "number") return shownItemsCount;
62
- const computedWidth = wrapperWidth || parseInt(wrapperRef !== null && wrapperRef !== void 0 && wrapperRef.current ? (_window$getComputedSt = window.getComputedStyle(wrapperRef.current)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.width : 0);
63
62
  const delta = typeof onEditClick === "function" ? 60 : 32;
64
- if (isNaN(computedWidth)) return -1;
65
- const result = tagList.map(_ref2 => {
63
+ const result = tagList.reduce((result, _ref2, index) => {
66
64
  let {
67
65
  itemRef
68
66
  } = _ref2;
69
- return itemRef;
70
- }).reduce((result, itemRef) => {
71
67
  const itemStyle = (itemRef === null || itemRef === void 0 ? void 0 : itemRef.current) && window.getComputedStyle(itemRef.current);
72
68
  const itemWidth = [parseInt(itemStyle === null || itemStyle === void 0 ? void 0 : itemStyle.width, 10), parseInt(itemStyle === null || itemStyle === void 0 ? void 0 : itemStyle.marginLeft, 10), parseInt(itemStyle === null || itemStyle === void 0 ? void 0 : itemStyle.marginRight, 10)].reduce((result, item) => {
73
69
  if (!isNaN(item)) result += item;
74
70
  return result;
75
71
  }, 0);
76
72
 
77
- if (!isNaN(itemWidth) && itemWidth > 0 && itemWidth + result.width < wrapperWidth - delta) {
73
+ if (!isNaN(itemWidth) && itemWidth > 0 && itemWidth + result.width < computedWidth - delta || index === 0) {
78
74
  result = {
79
75
  count: result.count + 1,
80
76
  width: result.width + itemWidth,
@@ -91,6 +87,11 @@ const TagList = _ref => {
91
87
  width: 0,
92
88
  items: []
93
89
  });
90
+
91
+ if ((result === null || result === void 0 ? void 0 : (_result$items = result.items) === null || _result$items === void 0 ? void 0 : _result$items.length) === 1) {
92
+ result.items[0].r.style.maxWidth = "".concat(computedWidth - delta - 8, "px");
93
+ }
94
+
94
95
  return result === null || result === void 0 ? void 0 : result.count;
95
96
  };
96
97
 
@@ -102,24 +103,14 @@ const TagList = _ref => {
102
103
  };
103
104
 
104
105
  const renderTags = () => {
105
- const tagsRenderOrder = renderOrder !== null && renderOrder !== void 0 ? renderOrder : tagList.map(_ref3 => {
106
- let {
107
- value,
108
- id
109
- } = _ref3;
110
- return value !== null && value !== void 0 ? value : id;
111
- });
112
- return tagsRenderOrder.map((v, i) => {
106
+ // const tagsRenderOrder =
107
+ // renderOrder ?? tagList.map(({ value, id }) => value ?? id);
108
+ console.log("render", [...tagList]);
109
+ return tagList.map((item, i) => {
113
110
  var _item$id, _item$id2;
114
111
 
115
- const item = tagList.find(_ref4 => {
116
- let {
117
- value,
118
- id
119
- } = _ref4;
120
- return (value !== null && value !== void 0 ? value : id) === v;
121
- });
122
- if (!item) return null;
112
+ // const item = tagList.find(({ value, id }) => (value ?? id) === v);
113
+ // if (!item) return null;
123
114
  const isHidden = renderItemsCount !== -1 && staticTagsCount !== -1 ? i >= renderItemsCount : false;
124
115
  return /*#__PURE__*/_react.default.createElement("div", {
125
116
  className: "tag-list_wrapper_item ".concat(isHidden ? "tag-list_wrapper_item--hidden" : ""),
@@ -169,13 +160,13 @@ const TagList = _ref => {
169
160
  let computedWidth = wrapperWidth;
170
161
 
171
162
  if (computedWidth === 0) {
172
- var _window$getComputedSt2;
163
+ var _window$getComputedSt;
173
164
 
174
- computedWidth = parseInt(wrapperRef !== null && wrapperRef !== void 0 && wrapperRef.current ? (_window$getComputedSt2 = window.getComputedStyle(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) === null || _window$getComputedSt2 === void 0 ? void 0 : _window$getComputedSt2.width : 0);
165
+ computedWidth = parseInt(wrapperRef !== null && wrapperRef !== void 0 && wrapperRef.current ? (_window$getComputedSt = window.getComputedStyle(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.width : 0);
175
166
  }
176
167
 
177
168
  if (!isNaN(computedWidth)) {
178
- setStaticTagsCount(getStaticTagsCount());
169
+ setStaticTagsCount(getStaticTagsCount(computedWidth));
179
170
  }
180
171
  }
181
172
  }, [tagList, wrapperWidth, wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current]); //
@@ -23,6 +23,18 @@
23
23
 
24
24
  &_item {
25
25
  display: inline-block;
26
+ box-sizing: border-box;
27
+ overflow: hidden;
28
+
29
+ .tag {
30
+ max-width: 100%;
31
+ box-sizing: border-box;
32
+
33
+ &__label {
34
+ overflow: hidden;
35
+ text-overflow: ellipsis;
36
+ }
37
+ }
26
38
 
27
39
  &--hidden {
28
40
  display: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.4.72",
3
+ "version": "1.4.73",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [