@portnet/ui 0.1.50 → 0.1.52

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.
@@ -30,8 +30,26 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
30
30
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
31
31
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
32
32
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
33
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
34
- const PuiSearchPage = _ref => {
33
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // Container for search form and actions
34
+ const PuiStandardSearchPageContainer = _ref => {
35
+ let {
36
+ actions,
37
+ children
38
+ } = _ref;
39
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
40
+ container: true,
41
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
42
+ item: true,
43
+ xs: 12,
44
+ children: children
45
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
46
+ item: true,
47
+ xs: 12,
48
+ children: actions
49
+ })]
50
+ });
51
+ };
52
+ const PuiSearchPage = _ref2 => {
35
53
  let {
36
54
  formik,
37
55
  formikProps,
@@ -47,22 +65,14 @@ const PuiSearchPage = _ref => {
47
65
  onRetour,
48
66
  onReset,
49
67
  onSubmit,
50
- children,
68
+ children: _children,
51
69
  additionalActions,
52
70
  collapsibleSearchSection = true // Collapsible by default
53
- } = _ref;
71
+ } = _ref2;
54
72
  const [isSearchSectionExpanded, setSearchSectionExpanded] = (0, _react.useState)(false);
55
73
  const toggleSearchSection = () => {
56
74
  setSearchSectionExpanded(prev => !prev);
57
75
  };
58
-
59
- // Extract the columns from tableProps
60
- const {
61
- columns
62
- } = tableProps || [];
63
- const alwaysVisibleFields = columns.slice(0, 3); // First three fields
64
- const additionalFields = columns.slice(3); // Remaining fields
65
-
66
76
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
67
77
  title: title,
68
78
  titleIcon: titleIcon,
@@ -91,66 +101,90 @@ const PuiSearchPage = _ref => {
91
101
  sx: {
92
102
  marginBottom: 2
93
103
  },
94
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
104
+ children: isSearchSectionExpanded && (formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
95
105
  initialValues: {}
96
106
  }, formikProps), {}, {
97
- children: _ref2 => {
107
+ children: _ref3 => {
98
108
  let {
99
109
  resetForm,
100
110
  submitForm
101
- } = _ref2;
102
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiFormikForm.default, {
103
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
104
- container: true,
105
- spacing: 2,
106
- children: [alwaysVisibleFields.map((field, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
107
- item: true,
108
- xs: 12,
109
- sm: 4,
110
- children: field.renderCell || field.headerName
111
- }, index)), isSearchSectionExpanded && additionalFields.map((field, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
112
- item: true,
113
- xs: 12,
114
- sm: 4,
115
- children: field.renderCell || field.headerName
116
- }, index))]
117
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
118
- container: true,
119
- justifyContent: "end",
120
- spacing: 2,
121
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
122
- item: true,
123
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
124
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
125
- type: "effacer",
126
- size: "small"
127
- }),
128
- onClick: resetForm,
129
- color: "tertiary",
130
- children: "Effacer"
131
- })
132
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
133
- item: true,
134
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
135
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
136
- type: "rechercher",
137
- size: "small"
138
- }),
139
- onClick: submitForm,
140
- loadingPosition: "start",
141
- children: "Rechercher"
142
- })
143
- }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
144
- item: true,
145
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
146
- startIcon: actionItem.icon,
147
- onClick: actionItem.action,
148
- children: actionItem.name
149
- })
150
- }, index))]
151
- })]
111
+ } = _ref3;
112
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiFormikForm.default, {
113
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
114
+ actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
115
+ container: true,
116
+ justifyContent: "end",
117
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
118
+ item: true,
119
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
120
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
121
+ type: "effacer",
122
+ size: "small"
123
+ }),
124
+ onClick: resetForm,
125
+ color: "tertiary",
126
+ children: "Effacer"
127
+ })
128
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
129
+ item: true,
130
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
131
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
132
+ type: "rechercher",
133
+ size: "small"
134
+ }),
135
+ onClick: submitForm,
136
+ loadingPosition: "start",
137
+ children: "Rechercher"
138
+ })
139
+ }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
140
+ item: true,
141
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
142
+ startIcon: actionItem.icon,
143
+ onClick: actionItem.action,
144
+ children: actionItem.name
145
+ })
146
+ }, index))]
147
+ }),
148
+ children: _children
149
+ })
152
150
  });
153
151
  }
152
+ })) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
153
+ actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
154
+ container: true,
155
+ justifyContent: "end",
156
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
157
+ item: true,
158
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
159
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
160
+ type: "effacer",
161
+ size: "small"
162
+ }),
163
+ onClick: onReset,
164
+ color: "tertiary",
165
+ children: "Effacer"
166
+ })
167
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
168
+ item: true,
169
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
170
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
171
+ type: "rechercher",
172
+ size: "small"
173
+ }),
174
+ onClick: onSubmit,
175
+ loadingPosition: "start",
176
+ children: "Rechercher"
177
+ })
178
+ }), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
179
+ item: true,
180
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
181
+ startIcon: actionItem.icon,
182
+ onClick: actionItem.action,
183
+ children: actionItem.name
184
+ })
185
+ }, index))]
186
+ }),
187
+ children: _children
154
188
  }))
155
189
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread(_objectSpread({
156
190
  paginationMode: "server"
@@ -163,19 +197,14 @@ PuiSearchPage.propTypes = {
163
197
  formik: _propTypes.default.bool,
164
198
  formikProps: _propTypes.default.object,
165
199
  title: _propTypes.default.string.isRequired,
166
- titleIcon: _propTypes.default.element,
200
+ titleIcon: _propTypes.default.element.isRequired,
167
201
  trace: _propTypes.default.arrayOf(_propTypes.default.string),
168
202
  navActions: _propTypes.default.element,
169
203
  topNav: _propTypes.default.bool,
170
204
  bottomNav: _propTypes.default.bool,
171
205
  loading: _propTypes.default.bool,
172
206
  tableProps: _propTypes.default.shape({
173
- columns: _propTypes.default.arrayOf(_propTypes.default.shape({
174
- field: _propTypes.default.string.isRequired,
175
- headerName: _propTypes.default.string.isRequired,
176
- renderCell: _propTypes.default.node
177
- })).isRequired,
178
- pinnedColumns: _propTypes.default.object
207
+ pinnedColumns: _propTypes.default.object // Added pinnedColumns prop type
179
208
  }),
180
209
  retour: _propTypes.default.bool,
181
210
  onRetour: _propTypes.default.func,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portnet/ui",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
4
  "description": "Portnet UI",
5
5
  "keywords": [
6
6
  "react",