@portnet/ui 0.1.46 → 0.1.48

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,14 +1,16 @@
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
4
  require("core-js/modules/esnext.iterator.filter.js");
6
5
  require("core-js/modules/esnext.iterator.for-each.js");
7
6
  Object.defineProperty(exports, "__esModule", {
8
7
  value: true
9
8
  });
10
9
  exports.default = void 0;
10
+ require("core-js/modules/es.promise.js");
11
+ require("core-js/modules/esnext.iterator.constructor.js");
11
12
  require("core-js/modules/esnext.iterator.map.js");
13
+ require("core-js/modules/esnext.iterator.to-array.js");
12
14
  require("core-js/modules/web.dom-collections.iterator.js");
13
15
  var _react = _interopRequireWildcard(require("react"));
14
16
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -50,7 +52,6 @@ const PuiStandardSearchPageContainer = _ref => {
50
52
  });
51
53
  };
52
54
  const PuiSearchPage = _ref2 => {
53
- var _tableProps$rows, _tableProps$columns;
54
55
  let {
55
56
  formik,
56
57
  formikProps,
@@ -66,7 +67,7 @@ const PuiSearchPage = _ref2 => {
66
67
  onRetour,
67
68
  onReset,
68
69
  onSubmit,
69
- children: _children,
70
+ children,
70
71
  additionalActions,
71
72
  collapsibleSearchSection = true // Collapsible by default
72
73
  } = _ref2;
@@ -75,13 +76,8 @@ const PuiSearchPage = _ref2 => {
75
76
  setSearchSectionExpanded(prev => !prev);
76
77
  };
77
78
 
78
- // Extract the first row for display when collapsed
79
- const firstRow = (tableProps === null || tableProps === void 0 || (_tableProps$rows = tableProps.rows) === null || _tableProps$rows === void 0 ? void 0 : _tableProps$rows[0]) || {};
80
- const firstRowColumns = tableProps === null || tableProps === void 0 || (_tableProps$columns = tableProps.columns) === null || _tableProps$columns === void 0 ? void 0 : _tableProps$columns.map(col => ({
81
- field: col.field,
82
- headerName: col.headerName,
83
- value: firstRow[col.field] || "-"
84
- }));
79
+ // Convert children to an array safely
80
+ const childArray = _react.default.Children.toArray(children);
85
81
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
86
82
  title: title,
87
83
  titleIcon: titleIcon,
@@ -110,7 +106,7 @@ const PuiSearchPage = _ref2 => {
110
106
  sx: {
111
107
  marginBottom: 2
112
108
  },
113
- children: isSearchSectionExpanded ? formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
109
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
114
110
  initialValues: {}
115
111
  }, formikProps), {}, {
116
112
  children: _ref3 => {
@@ -118,95 +114,59 @@ const PuiSearchPage = _ref2 => {
118
114
  resetForm,
119
115
  submitForm
120
116
  } = _ref3;
121
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiFormikForm.default, {
122
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
123
- actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
124
- container: true,
125
- justifyContent: "end",
126
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
127
- item: true,
128
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
129
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
130
- type: "effacer",
131
- size: "small"
132
- }),
133
- onClick: resetForm,
134
- color: "tertiary",
135
- children: "Effacer"
136
- })
137
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
138
- item: true,
139
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
140
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
141
- type: "rechercher",
142
- size: "small"
143
- }),
144
- onClick: submitForm,
145
- loadingPosition: "start",
146
- children: "Rechercher"
147
- })
148
- }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
149
- item: true,
150
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
151
- startIcon: actionItem.icon,
152
- onClick: actionItem.action,
153
- children: actionItem.name
154
- })
155
- }, index))]
156
- }),
157
- children: _children
158
- })
117
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiFormikForm.default, {
118
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
119
+ container: true,
120
+ spacing: 2,
121
+ children: isSearchSectionExpanded ? childArray.map((child, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
122
+ item: true,
123
+ xs: 12,
124
+ sm: 4,
125
+ children: child
126
+ }, index)) : childArray.slice(0, 3).map((child, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
127
+ item: true,
128
+ xs: 12,
129
+ sm: 4,
130
+ children: child
131
+ }, index))
132
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
133
+ container: true,
134
+ justifyContent: "end",
135
+ spacing: 2,
136
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
137
+ item: true,
138
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
139
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
140
+ type: "effacer",
141
+ size: "small"
142
+ }),
143
+ onClick: resetForm,
144
+ color: "tertiary",
145
+ children: "Effacer"
146
+ })
147
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
148
+ item: true,
149
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
150
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
151
+ type: "rechercher",
152
+ size: "small"
153
+ }),
154
+ onClick: submitForm,
155
+ loadingPosition: "start",
156
+ children: "Rechercher"
157
+ })
158
+ }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
159
+ item: true,
160
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
161
+ startIcon: actionItem.icon,
162
+ onClick: actionItem.action,
163
+ children: actionItem.name
164
+ })
165
+ }, index))]
166
+ })]
159
167
  });
160
168
  }
161
- })) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
162
- actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
163
- container: true,
164
- justifyContent: "end",
165
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
166
- item: true,
167
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
168
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
169
- type: "effacer",
170
- size: "small"
171
- }),
172
- onClick: onReset,
173
- color: "tertiary",
174
- children: "Effacer"
175
- })
176
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
177
- item: true,
178
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
179
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
180
- type: "rechercher",
181
- size: "small"
182
- }),
183
- onClick: onSubmit,
184
- loadingPosition: "start",
185
- children: "Rechercher"
186
- })
187
- }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
188
- item: true,
189
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
190
- startIcon: actionItem.icon,
191
- onClick: actionItem.action,
192
- children: actionItem.name
193
- })
194
- }, index))]
195
- }),
196
- children: _children
197
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
198
- container: true,
199
- spacing: 2,
200
- children: firstRowColumns === null || firstRowColumns === void 0 ? void 0 : firstRowColumns.map(col => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
201
- item: true,
202
- xs: 12,
203
- sm: 6,
204
- md: 4,
205
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("strong", {
206
- children: [col.headerName, ":"]
207
- }), " ", col.value]
208
- }, col.field))
209
- })
169
+ }))
210
170
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread(_objectSpread({
211
171
  paginationMode: "server"
212
172
  }, tableProps), {}, {
@@ -225,8 +185,6 @@ PuiSearchPage.propTypes = {
225
185
  bottomNav: _propTypes.default.bool,
226
186
  loading: _propTypes.default.bool,
227
187
  tableProps: _propTypes.default.shape({
228
- rows: _propTypes.default.array,
229
- columns: _propTypes.default.array,
230
188
  pinnedColumns: _propTypes.default.object // Added pinnedColumns prop type
231
189
  }),
232
190
  retour: _propTypes.default.bool,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portnet/ui",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
4
4
  "description": "Portnet UI",
5
5
  "keywords": [
6
6
  "react",