@portnet/ui 0.1.51 → 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.
|
@@ -1,14 +1,13 @@
|
|
|
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");
|
|
4
6
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
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");
|
|
12
11
|
require("core-js/modules/esnext.iterator.map.js");
|
|
13
12
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
14
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -31,8 +30,26 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
31
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; }
|
|
32
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; }
|
|
33
32
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
34
|
-
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); }
|
|
35
|
-
const
|
|
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 => {
|
|
36
53
|
let {
|
|
37
54
|
formik,
|
|
38
55
|
formikProps,
|
|
@@ -48,22 +65,14 @@ const PuiSearchPage = _ref => {
|
|
|
48
65
|
onRetour,
|
|
49
66
|
onReset,
|
|
50
67
|
onSubmit,
|
|
68
|
+
children: _children,
|
|
51
69
|
additionalActions,
|
|
52
70
|
collapsibleSearchSection = true // Collapsible by default
|
|
53
|
-
} =
|
|
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 columns from tableProps
|
|
60
|
-
const {
|
|
61
|
-
columns
|
|
62
|
-
} = tableProps || {};
|
|
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
|
|
66
|
-
|
|
67
76
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
|
|
68
77
|
title: title,
|
|
69
78
|
titleIcon: titleIcon,
|
|
@@ -92,70 +101,95 @@ const PuiSearchPage = _ref => {
|
|
|
92
101
|
sx: {
|
|
93
102
|
marginBottom: 2
|
|
94
103
|
},
|
|
95
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
|
|
104
|
+
children: isSearchSectionExpanded && (formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
|
|
96
105
|
initialValues: {}
|
|
97
106
|
}, formikProps), {}, {
|
|
98
|
-
children:
|
|
107
|
+
children: _ref3 => {
|
|
99
108
|
let {
|
|
100
109
|
resetForm,
|
|
101
110
|
submitForm
|
|
102
|
-
} =
|
|
103
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
104
|
-
children:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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"
|
|
157
191
|
}, tableProps), {}, {
|
|
158
|
-
pinnedColumns: tableProps.pinnedColumns
|
|
192
|
+
pinnedColumns: tableProps.pinnedColumns // Added pinnedColumns
|
|
159
193
|
}))]
|
|
160
194
|
});
|
|
161
195
|
};
|
|
@@ -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
|
-
|
|
174
|
-
field: _propTypes.default.string.isRequired,
|
|
175
|
-
headerName: _propTypes.default.string.isRequired,
|
|
176
|
-
renderCell: _propTypes.default.func
|
|
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,
|