@portnet/ui 0.1.48 → 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.
@@ -1,16 +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");
4
5
  require("core-js/modules/esnext.iterator.filter.js");
5
6
  require("core-js/modules/esnext.iterator.for-each.js");
6
7
  Object.defineProperty(exports, "__esModule", {
7
8
  value: true
8
9
  });
9
10
  exports.default = void 0;
10
- require("core-js/modules/es.promise.js");
11
- require("core-js/modules/esnext.iterator.constructor.js");
12
11
  require("core-js/modules/esnext.iterator.map.js");
13
- require("core-js/modules/esnext.iterator.to-array.js");
14
12
  require("core-js/modules/web.dom-collections.iterator.js");
15
13
  var _react = _interopRequireWildcard(require("react"));
16
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -32,26 +30,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
32
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; }
33
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; }
34
32
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
35
- 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
36
- const PuiStandardSearchPageContainer = _ref => {
37
- let {
38
- actions,
39
- children
40
- } = _ref;
41
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
42
- container: true,
43
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
44
- item: true,
45
- xs: 12,
46
- children: children
47
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
48
- item: true,
49
- xs: 12,
50
- children: actions
51
- })]
52
- });
53
- };
54
- 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 => {
55
35
  let {
56
36
  formik,
57
37
  formikProps,
@@ -67,17 +47,21 @@ const PuiSearchPage = _ref2 => {
67
47
  onRetour,
68
48
  onReset,
69
49
  onSubmit,
70
- children,
71
50
  additionalActions,
72
51
  collapsibleSearchSection = true // Collapsible by default
73
- } = _ref2;
52
+ } = _ref;
74
53
  const [isSearchSectionExpanded, setSearchSectionExpanded] = (0, _react.useState)(false);
75
54
  const toggleSearchSection = () => {
76
55
  setSearchSectionExpanded(prev => !prev);
77
56
  };
78
57
 
79
- // Convert children to an array safely
80
- const childArray = _react.default.Children.toArray(children);
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
+
81
65
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
82
66
  title: title,
83
67
  titleIcon: titleIcon,
@@ -109,26 +93,48 @@ const PuiSearchPage = _ref2 => {
109
93
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
110
94
  initialValues: {}
111
95
  }, formikProps), {}, {
112
- children: _ref3 => {
96
+ children: _ref2 => {
113
97
  let {
114
98
  resetForm,
115
99
  submitForm
116
- } = _ref3;
100
+ } = _ref2;
117
101
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiFormikForm.default, {
118
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
102
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
119
103
  container: true,
120
104
  spacing: 2,
121
- children: isSearchSectionExpanded ? childArray.map((child, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
105
+ children: [firstRowFields.map((column, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
122
106
  item: true,
123
107
  xs: 12,
124
108
  sm: 4,
125
- children: child
126
- }, index)) : childArray.slice(0, 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, {
127
122
  item: true,
128
123
  xs: 12,
129
124
  sm: 4,
130
- children: child
131
- }, index))
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
+ })]
137
+ }, index))]
132
138
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
133
139
  container: true,
134
140
  justifyContent: "end",
@@ -178,14 +184,18 @@ PuiSearchPage.propTypes = {
178
184
  formik: _propTypes.default.bool,
179
185
  formikProps: _propTypes.default.object,
180
186
  title: _propTypes.default.string.isRequired,
181
- titleIcon: _propTypes.default.element.isRequired,
187
+ titleIcon: _propTypes.default.element,
182
188
  trace: _propTypes.default.arrayOf(_propTypes.default.string),
183
189
  navActions: _propTypes.default.element,
184
190
  topNav: _propTypes.default.bool,
185
191
  bottomNav: _propTypes.default.bool,
186
192
  loading: _propTypes.default.bool,
187
193
  tableProps: _propTypes.default.shape({
188
- pinnedColumns: _propTypes.default.object // Added pinnedColumns prop type
194
+ columns: _propTypes.default.arrayOf(_propTypes.default.shape({
195
+ field: _propTypes.default.string.isRequired,
196
+ headerName: _propTypes.default.string.isRequired
197
+ })).isRequired,
198
+ pinnedColumns: _propTypes.default.object
189
199
  }),
190
200
  retour: _propTypes.default.bool,
191
201
  onRetour: _propTypes.default.func,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portnet/ui",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
4
4
  "description": "Portnet UI",
5
5
  "keywords": [
6
6
  "react",