@portnet/ui 0.1.49 → 0.1.51

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.
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.weak-map.js");
4
- require("core-js/modules/esnext.iterator.constructor.js");
5
- require("core-js/modules/esnext.iterator.filter.js");
6
4
  require("core-js/modules/esnext.iterator.for-each.js");
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.default = void 0;
9
+ require("core-js/modules/es.array.includes.js");
10
+ require("core-js/modules/esnext.iterator.constructor.js");
11
+ require("core-js/modules/esnext.iterator.filter.js");
11
12
  require("core-js/modules/esnext.iterator.map.js");
12
13
  require("core-js/modules/web.dom-collections.iterator.js");
13
14
  var _react = _interopRequireWildcard(require("react"));
@@ -55,12 +56,13 @@ const PuiSearchPage = _ref => {
55
56
  setSearchSectionExpanded(prev => !prev);
56
57
  };
57
58
 
58
- // Extract the columns from tableProps
59
+ // Extract columns from tableProps
59
60
  const {
60
61
  columns
61
62
  } = tableProps || {};
62
- const firstRowFields = columns.slice(0, 3); // Display only the first 3 columns when collapsed
63
- const additionalFields = columns.slice(3); // Remaining columns when expanded
63
+ const alwaysVisibleFields = ["numFactura", "tipoFacturaDescripcion", "estadoDescripcion"]; // First-row fields
64
+ const visibleColumns = isSearchSectionExpanded ? columns // Show all columns when expanded
65
+ : columns.filter(col => alwaysVisibleFields.includes(col.field)); // Show only selected columns when collapsed
64
66
 
65
67
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
66
68
  title: title,
@@ -99,42 +101,19 @@ const PuiSearchPage = _ref => {
99
101
  submitForm
100
102
  } = _ref2;
101
103
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiFormikForm.default, {
102
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
104
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
103
105
  container: true,
104
106
  spacing: 2,
105
- children: [firstRowFields.map((column, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
106
- item: true,
107
- xs: 12,
108
- sm: 4,
109
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
110
- children: column.headerName
111
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
112
- name: column.field,
113
- placeholder: column.headerName,
114
- style: {
115
- width: "100%",
116
- padding: "8px",
117
- borderRadius: "4px",
118
- border: "1px solid #ccc"
119
- }
120
- })]
121
- }, index)), isSearchSectionExpanded && additionalFields.map((column, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
107
+ children: visibleColumns.map((column, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
122
108
  item: true,
123
109
  xs: 12,
124
110
  sm: 4,
125
111
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
126
112
  children: column.headerName
127
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
128
- name: column.field,
129
- placeholder: column.headerName,
130
- style: {
131
- width: "100%",
132
- padding: "8px",
133
- borderRadius: "4px",
134
- border: "1px solid #ccc"
135
- }
136
- })]
137
- }, index))]
113
+ }), column.renderCell ? column.renderCell({
114
+ row: {}
115
+ }) : null]
116
+ }, index))
138
117
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
139
118
  container: true,
140
119
  justifyContent: "end",
@@ -176,7 +155,7 @@ const PuiSearchPage = _ref => {
176
155
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread(_objectSpread({
177
156
  paginationMode: "server"
178
157
  }, tableProps), {}, {
179
- pinnedColumns: tableProps.pinnedColumns // Added pinnedColumns
158
+ pinnedColumns: tableProps.pinnedColumns
180
159
  }))]
181
160
  });
182
161
  };
@@ -193,7 +172,8 @@ PuiSearchPage.propTypes = {
193
172
  tableProps: _propTypes.default.shape({
194
173
  columns: _propTypes.default.arrayOf(_propTypes.default.shape({
195
174
  field: _propTypes.default.string.isRequired,
196
- headerName: _propTypes.default.string.isRequired
175
+ headerName: _propTypes.default.string.isRequired,
176
+ renderCell: _propTypes.default.func
197
177
  })).isRequired,
198
178
  pinnedColumns: _propTypes.default.object
199
179
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portnet/ui",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
4
4
  "description": "Portnet UI",
5
5
  "keywords": [
6
6
  "react",