@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
|
|
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
|
-
} =
|
|
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:
|
|
107
|
+
children: _ref3 => {
|
|
98
108
|
let {
|
|
99
109
|
resetForm,
|
|
100
110
|
submitForm
|
|
101
|
-
} =
|
|
102
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
103
|
-
children:
|
|
104
|
-
|
|
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
|
-
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
|
-
|
|
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,
|