@portnet/ui 0.1.33 → 0.1.35
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,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
3
4
|
require("core-js/modules/es.weak-map.js");
|
|
4
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
require("core-js/modules/
|
|
10
|
-
var
|
|
9
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var
|
|
12
|
+
var _formik = require("formik");
|
|
13
13
|
var _PuiButton = _interopRequireDefault(require("../../../buttons/PuiButton"));
|
|
14
14
|
var _PuiFormikForm = _interopRequireDefault(require("../../../others/PuiFormikForm"));
|
|
15
15
|
var _PuiGrid = _interopRequireDefault(require("../../../others/PuiGrid"));
|
|
@@ -17,15 +17,18 @@ var _PuiIcon = _interopRequireDefault(require("../../../others/PuiIcon"));
|
|
|
17
17
|
var _PuiSection = _interopRequireDefault(require("../../../others/PuiSection"));
|
|
18
18
|
var _PuiTable = _interopRequireDefault(require("../../../table/PuiTable"));
|
|
19
19
|
var _PuiDefaultPage = _interopRequireDefault(require("./PuiDefaultPage"));
|
|
20
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
21
|
+
var _ExpandLess = _interopRequireDefault(require("@mui/icons-material/ExpandLess"));
|
|
20
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
25
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
26
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
27
|
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; }
|
|
26
28
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
29
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
28
|
-
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); }
|
|
30
|
+
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); } // Arrow for collapsed state
|
|
31
|
+
// Arrow for expanded state
|
|
29
32
|
const PuiStandardSearchPageContainer = _ref => {
|
|
30
33
|
let {
|
|
31
34
|
actions,
|
|
@@ -61,8 +64,14 @@ const PuiSearchPage = _ref2 => {
|
|
|
61
64
|
onReset,
|
|
62
65
|
onSubmit,
|
|
63
66
|
children: _children,
|
|
64
|
-
additionalActions
|
|
67
|
+
additionalActions,
|
|
68
|
+
collapsibleSearchSection = true // Collapsible by default
|
|
65
69
|
} = _ref2;
|
|
70
|
+
// Start with the section collapsed (not displayed on first render)
|
|
71
|
+
const [isSearchSectionExpanded, setSearchSectionExpanded] = (0, _react.useState)(false);
|
|
72
|
+
const toggleSearchSection = () => {
|
|
73
|
+
setSearchSectionExpanded(prev => !prev);
|
|
74
|
+
};
|
|
66
75
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
|
|
67
76
|
title: title,
|
|
68
77
|
titleIcon: titleIcon,
|
|
@@ -74,98 +83,109 @@ const PuiSearchPage = _ref2 => {
|
|
|
74
83
|
retour: retour,
|
|
75
84
|
onRetour: onRetour,
|
|
76
85
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiSection.default, {
|
|
77
|
-
title:
|
|
86
|
+
title: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
87
|
+
onClick: toggleSearchSection,
|
|
88
|
+
style: {
|
|
89
|
+
display: "flex",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
cursor: collapsibleSearchSection ? "pointer" : "default" // Clickable only if collapsibleSearchSection is true
|
|
92
|
+
},
|
|
93
|
+
children: [collapsibleSearchSection && (isSearchSectionExpanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
94
|
+
style: {
|
|
95
|
+
marginLeft: collapsibleSearchSection ? "8px" : "0px"
|
|
96
|
+
},
|
|
97
|
+
children: "Param\xE8tres de recherche"
|
|
98
|
+
}), " "]
|
|
99
|
+
}),
|
|
78
100
|
sx: {
|
|
79
101
|
marginBottom: 2
|
|
80
102
|
},
|
|
81
|
-
children:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
103
|
+
children: isSearchSectionExpanded && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
104
|
+
children: formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
|
|
105
|
+
initialValues: {}
|
|
106
|
+
}, formikProps), {}, {
|
|
107
|
+
children: _ref3 => {
|
|
108
|
+
let {
|
|
109
|
+
resetForm,
|
|
110
|
+
submitForm
|
|
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, {
|
|
118
140
|
item: true,
|
|
119
141
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
120
142
|
startIcon: actionItem.icon,
|
|
121
143
|
onClick: actionItem.action,
|
|
122
144
|
children: actionItem.name
|
|
123
145
|
})
|
|
124
|
-
}, index)
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
})
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
})
|
|
157
|
-
}), additionalActions && additionalActions.map((actionItem, index) => {
|
|
158
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
146
|
+
}, index))]
|
|
147
|
+
}),
|
|
148
|
+
children: _children
|
|
149
|
+
})
|
|
150
|
+
});
|
|
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, {
|
|
159
179
|
item: true,
|
|
160
180
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
161
181
|
startIcon: actionItem.icon,
|
|
162
182
|
onClick: actionItem.action,
|
|
163
183
|
children: actionItem.name
|
|
164
184
|
})
|
|
165
|
-
}, index)
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
|
|
185
|
+
}, index))]
|
|
186
|
+
}),
|
|
187
|
+
children: _children
|
|
188
|
+
})
|
|
169
189
|
})
|
|
170
190
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread({
|
|
171
191
|
paginationMode: "server"
|
|
@@ -191,11 +211,13 @@ PuiSearchPage.propTypes = {
|
|
|
191
211
|
name: _propTypes.default.string.isRequired,
|
|
192
212
|
action: _propTypes.default.func.isRequired,
|
|
193
213
|
icon: _propTypes.default.element
|
|
194
|
-
}))
|
|
214
|
+
})),
|
|
215
|
+
collapsibleSearchSection: _propTypes.default.bool // New prop with default value
|
|
195
216
|
};
|
|
196
217
|
PuiSearchPage.defaultProps = {
|
|
197
218
|
formik: true,
|
|
198
219
|
loading: false,
|
|
199
|
-
additionalActions: []
|
|
220
|
+
additionalActions: [],
|
|
221
|
+
collapsibleSearchSection: true // Collapsible by default is true
|
|
200
222
|
};
|
|
201
223
|
var _default = exports.default = PuiSearchPage;
|