@portnet/ui 0.1.32 → 0.1.34
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.
|
@@ -13,6 +13,9 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var React = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _apperance = require("../../config/apperance");
|
|
15
15
|
var _PuiTooltip = _interopRequireDefault(require("./PuiTooltip"));
|
|
16
|
+
var _CheckCircle = _interopRequireDefault(require("@mui/icons-material/CheckCircle"));
|
|
17
|
+
var _Error = _interopRequireDefault(require("@mui/icons-material/Error"));
|
|
18
|
+
var _HourglassEmpty = _interopRequireDefault(require("@mui/icons-material/HourglassEmpty"));
|
|
16
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
20
|
const _excluded = ["id", "className", "sx", "color", "fullWidth", "children", "icon"];
|
|
18
21
|
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); }
|
|
@@ -47,17 +50,17 @@ const PrimaryChip = (0, _styles.styled)( /*#__PURE__*/React.forwardRef((props, r
|
|
|
47
50
|
};
|
|
48
51
|
});
|
|
49
52
|
const iconMapping = {
|
|
50
|
-
success: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
53
|
+
success: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckCircle.default, {
|
|
51
54
|
style: {
|
|
52
55
|
color: 'white'
|
|
53
56
|
}
|
|
54
57
|
}),
|
|
55
|
-
error: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
58
|
+
error: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Error.default, {
|
|
56
59
|
style: {
|
|
57
60
|
color: 'white'
|
|
58
61
|
}
|
|
59
62
|
}),
|
|
60
|
-
info: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
63
|
+
info: /*#__PURE__*/(0, _jsxRuntime.jsx)(_HourglassEmpty.default, {
|
|
61
64
|
style: {
|
|
62
65
|
color: 'white'
|
|
63
66
|
}
|
|
@@ -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,13 @@ const PuiSearchPage = _ref2 => {
|
|
|
61
64
|
onReset,
|
|
62
65
|
onSubmit,
|
|
63
66
|
children: _children,
|
|
64
|
-
additionalActions
|
|
67
|
+
additionalActions,
|
|
68
|
+
collapsibleSearchSection = false // Collapsible by default
|
|
65
69
|
} = _ref2;
|
|
70
|
+
const [isSearchSectionExpanded, setSearchSectionExpanded] = (0, _react.useState)(true);
|
|
71
|
+
const toggleSearchSection = () => {
|
|
72
|
+
setSearchSectionExpanded(prev => !prev);
|
|
73
|
+
};
|
|
66
74
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
|
|
67
75
|
title: title,
|
|
68
76
|
titleIcon: titleIcon,
|
|
@@ -74,98 +82,109 @@ const PuiSearchPage = _ref2 => {
|
|
|
74
82
|
retour: retour,
|
|
75
83
|
onRetour: onRetour,
|
|
76
84
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiSection.default, {
|
|
77
|
-
title:
|
|
85
|
+
title: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
86
|
+
onClick: toggleSearchSection,
|
|
87
|
+
style: {
|
|
88
|
+
display: "flex",
|
|
89
|
+
alignItems: "center",
|
|
90
|
+
cursor: "pointer" // Cursor changes to indicate clickability
|
|
91
|
+
},
|
|
92
|
+
children: [isSearchSectionExpanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
93
|
+
style: {
|
|
94
|
+
marginLeft: "8px"
|
|
95
|
+
},
|
|
96
|
+
children: "Param\xE8tres de recherche"
|
|
97
|
+
}), " "]
|
|
98
|
+
}),
|
|
78
99
|
sx: {
|
|
79
100
|
marginBottom: 2
|
|
80
101
|
},
|
|
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
|
-
|
|
102
|
+
children: isSearchSectionExpanded && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
103
|
+
children: formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
|
|
104
|
+
initialValues: {}
|
|
105
|
+
}, formikProps), {}, {
|
|
106
|
+
children: _ref3 => {
|
|
107
|
+
let {
|
|
108
|
+
resetForm,
|
|
109
|
+
submitForm
|
|
110
|
+
} = _ref3;
|
|
111
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiFormikForm.default, {
|
|
112
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
|
|
113
|
+
actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
|
|
114
|
+
container: true,
|
|
115
|
+
justifyContent: "end",
|
|
116
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
117
|
+
item: true,
|
|
118
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
119
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
120
|
+
type: "effacer",
|
|
121
|
+
size: "small"
|
|
122
|
+
}),
|
|
123
|
+
onClick: resetForm,
|
|
124
|
+
color: "tertiary",
|
|
125
|
+
children: "Effacer"
|
|
126
|
+
})
|
|
127
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
128
|
+
item: true,
|
|
129
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
130
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
131
|
+
type: "rechercher",
|
|
132
|
+
size: "small"
|
|
133
|
+
}),
|
|
134
|
+
onClick: submitForm,
|
|
135
|
+
loadingPosition: "start",
|
|
136
|
+
children: "Rechercher"
|
|
137
|
+
})
|
|
138
|
+
}), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
118
139
|
item: true,
|
|
119
140
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
120
141
|
startIcon: actionItem.icon,
|
|
121
142
|
onClick: actionItem.action,
|
|
122
143
|
children: actionItem.name
|
|
123
144
|
})
|
|
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, {
|
|
145
|
+
}, index))]
|
|
146
|
+
}),
|
|
147
|
+
children: _children
|
|
148
|
+
})
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
})) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
|
|
152
|
+
actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
|
|
153
|
+
container: true,
|
|
154
|
+
justifyContent: "end",
|
|
155
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
156
|
+
item: true,
|
|
157
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
158
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
159
|
+
type: "effacer",
|
|
160
|
+
size: "small"
|
|
161
|
+
}),
|
|
162
|
+
onClick: onReset,
|
|
163
|
+
color: "tertiary",
|
|
164
|
+
children: "Effacer"
|
|
165
|
+
})
|
|
166
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
167
|
+
item: true,
|
|
168
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
169
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
170
|
+
type: "rechercher",
|
|
171
|
+
size: "small"
|
|
172
|
+
}),
|
|
173
|
+
onClick: onSubmit,
|
|
174
|
+
loadingPosition: "start",
|
|
175
|
+
children: "Rechercher"
|
|
176
|
+
})
|
|
177
|
+
}), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
159
178
|
item: true,
|
|
160
179
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
161
180
|
startIcon: actionItem.icon,
|
|
162
181
|
onClick: actionItem.action,
|
|
163
182
|
children: actionItem.name
|
|
164
183
|
})
|
|
165
|
-
}, index)
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
|
|
184
|
+
}, index))]
|
|
185
|
+
}),
|
|
186
|
+
children: _children
|
|
187
|
+
})
|
|
169
188
|
})
|
|
170
189
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread({
|
|
171
190
|
paginationMode: "server"
|
|
@@ -191,11 +210,13 @@ PuiSearchPage.propTypes = {
|
|
|
191
210
|
name: _propTypes.default.string.isRequired,
|
|
192
211
|
action: _propTypes.default.func.isRequired,
|
|
193
212
|
icon: _propTypes.default.element
|
|
194
|
-
}))
|
|
213
|
+
})),
|
|
214
|
+
collapsibleSearchSection: _propTypes.default.bool // New prop with default value
|
|
195
215
|
};
|
|
196
216
|
PuiSearchPage.defaultProps = {
|
|
197
217
|
formik: true,
|
|
198
218
|
loading: false,
|
|
199
|
-
additionalActions: []
|
|
219
|
+
additionalActions: [],
|
|
220
|
+
collapsibleSearchSection: false // Collapsible by default
|
|
200
221
|
};
|
|
201
222
|
var _default = exports.default = PuiSearchPage;
|