@cashub/ui 0.40.6 → 0.41.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashub/ui",
3
- "version": "0.40.6",
3
+ "version": "0.41.0",
4
4
  "private": false,
5
5
  "author": "CasHUB Team",
6
6
  "description": "CasHUB UI components library",
@@ -151,6 +151,14 @@ const InfiniteGridTable = _ref => {
151
151
  sortable,
152
152
  align
153
153
  } = column;
154
+ let key = 'TH';
155
+ if (title) {
156
+ key += "".concat(key).concat(title);
157
+ } else if (fieldName) {
158
+ key += "".concat(key).concat(fieldName);
159
+ } else {
160
+ key += "".concat(key).concat(index);
161
+ }
154
162
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridTableHeadCell.default, {
155
163
  width: width,
156
164
  align: align,
@@ -169,7 +177,7 @@ const InfiniteGridTable = _ref => {
169
177
  index: index,
170
178
  onResize: handleResizeColumn
171
179
  })]
172
- }, "TH".concat(index));
180
+ }, key);
173
181
  });
174
182
  tableHeads.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_GridTableHeadCell.default, {
175
183
  role: "presentation",
@@ -241,8 +249,28 @@ const InfiniteGridTable = _ref => {
241
249
  })
242
250
  });
243
251
  }, [backgroundReverse, tableColumns, texts]);
252
+
253
+ // merge previous column width to columns array
244
254
  (0, _react.useEffect)(() => {
245
- setTableColumns(columns);
255
+ setTableColumns(previousColumns => {
256
+ return columns.map(column => {
257
+ const previousColumn = previousColumns.find(previousColumn => {
258
+ const {
259
+ title: previousTitle,
260
+ fieldName: previousFieldName
261
+ } = previousColumn;
262
+ const {
263
+ title,
264
+ fieldName
265
+ } = column;
266
+ return title === previousTitle && fieldName === previousFieldName;
267
+ });
268
+ const width = (previousColumn === null || previousColumn === void 0 ? void 0 : previousColumn.width) || column.width;
269
+ return _objectSpread(_objectSpread({}, column), {}, {
270
+ width
271
+ });
272
+ });
273
+ });
246
274
  }, [columns]);
247
275
  (0, _react.useEffect)(() => {
248
276
  handleResize();
@@ -10,5 +10,5 @@ var _templateObject;
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
11
  function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
12
12
  // integrate tagify component
13
- const TagifyStyle = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .tagify__dropdown {\n &__wrapper {\n max-height: 320px;\n border: 1px solid var(--border-color);\n color: var(--font-on-background);\n background: var(--color-background1);\n box-shadow: var(--box-shadow);\n border-radius: var(--border-radius);\n padding: var(--spacing-s) 0;\n overflow-y: auto;\n overflow-x: visible;\n\n ", "\n }\n\n &__item {\n max-width: 100%;\n word-break: break-all;\n padding: 12px var(--spacing-s);\n background: var(--color-background1);\n transition: 0.3s;\n\n &:hover {\n background: var(--color-hover);\n }\n }\n\n hr {\n border: none;\n border-top: 1px solid var(--border-color);\n margin: var(--spacing-s) 0;\n }\n }\n"])), _scrollbar.default);
13
+ const TagifyStyle = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .tagify__dropdown {\n &__wrapper {\n max-height: 320px;\n border: 1px solid var(--border-color);\n color: var(--font-on-background);\n background: var(--color-background1);\n box-shadow: var(--box-shadow);\n border-radius: var(--border-radius);\n padding: var(--spacing-s) 0;\n overflow-y: auto;\n overflow-x: visible;\n\n ", "\n }\n\n &__item {\n max-width: 100%;\n word-break: break-all;\n padding: 12px var(--spacing-s);\n background: var(--color-background1);\n transition: 0.3s;\n\n &:hover {\n background: var(--color-hover);\n }\n\n &[data-value=\"__create__\"] {\n border-radius: 0 0 var(--border-radius) var(--border-radius);\n border-top: 1px solid var(--border-color);\n padding-top: var(--spacing);\n\n &.fixed-bottom{\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: var(--spacing-s);\n }\n }\n }\n\n &.has-fixed-bottom {\n .tagify__dropdown__wrapper {\n padding-bottom: 60px;\n }\n }\n }\n"])), _scrollbar.default);
14
14
  var _default = exports.default = TagifyStyle;