@portnet/ui 0.1.47 → 0.1.49

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,26 +30,8 @@ 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); } // 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 => {
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 => {
53
35
  let {
54
36
  formik,
55
37
  formikProps,
@@ -65,14 +47,21 @@ const PuiSearchPage = _ref2 => {
65
47
  onRetour,
66
48
  onReset,
67
49
  onSubmit,
68
- children: _children,
69
50
  additionalActions,
70
51
  collapsibleSearchSection = true // Collapsible by default
71
- } = _ref2;
52
+ } = _ref;
72
53
  const [isSearchSectionExpanded, setSearchSectionExpanded] = (0, _react.useState)(false);
73
54
  const toggleSearchSection = () => {
74
55
  setSearchSectionExpanded(prev => !prev);
75
56
  };
57
+
58
+ // Extract the columns from tableProps
59
+ const {
60
+ columns
61
+ } = 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
64
+
76
65
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
77
66
  title: title,
78
67
  titleIcon: titleIcon,
@@ -104,35 +93,47 @@ const PuiSearchPage = _ref2 => {
104
93
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
105
94
  initialValues: {}
106
95
  }, formikProps), {}, {
107
- children: _ref3 => {
96
+ children: _ref2 => {
108
97
  let {
109
98
  resetForm,
110
99
  submitForm
111
- } = _ref3;
100
+ } = _ref2;
112
101
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiFormikForm.default, {
113
102
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
114
103
  container: true,
115
104
  spacing: 2,
116
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
117
- item: true,
118
- xs: 12,
119
- sm: 4,
120
- children: [_children[0], " "]
121
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
122
- item: true,
123
- xs: 12,
124
- sm: 4,
125
- children: [_children[1], " "]
126
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
105
+ children: [firstRowFields.map((column, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
127
106
  item: true,
128
107
  xs: 12,
129
108
  sm: 4,
130
- children: [_children[2], " "]
131
- }), isSearchSectionExpanded && _children.slice(3).map((child, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
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, {
132
122
  item: true,
133
123
  xs: 12,
134
124
  sm: 4,
135
- children: child
125
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
126
+ 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
+ })]
136
137
  }, index))]
137
138
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
138
139
  container: true,
@@ -183,13 +184,17 @@ PuiSearchPage.propTypes = {
183
184
  formik: _propTypes.default.bool,
184
185
  formikProps: _propTypes.default.object,
185
186
  title: _propTypes.default.string.isRequired,
186
- titleIcon: _propTypes.default.element.isRequired,
187
+ titleIcon: _propTypes.default.element,
187
188
  trace: _propTypes.default.arrayOf(_propTypes.default.string),
188
189
  navActions: _propTypes.default.element,
189
190
  topNav: _propTypes.default.bool,
190
191
  bottomNav: _propTypes.default.bool,
191
192
  loading: _propTypes.default.bool,
192
193
  tableProps: _propTypes.default.shape({
194
+ columns: _propTypes.default.arrayOf(_propTypes.default.shape({
195
+ field: _propTypes.default.string.isRequired,
196
+ headerName: _propTypes.default.string.isRequired
197
+ })).isRequired,
193
198
  pinnedColumns: _propTypes.default.object
194
199
  }),
195
200
  retour: _propTypes.default.bool,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portnet/ui",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "description": "Portnet UI",
5
5
  "keywords": [
6
6
  "react",