@portnet/ui 3.0.3 → 3.0.5
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.
- package/dist/components/buttons/PuiButton.js +136 -0
- package/dist/components/buttons/PuiIconButton.js +97 -0
- package/dist/components/common/PuiAlertContext.js +13 -0
- package/dist/components/common/StyledMuiButton.js +47 -0
- package/dist/components/common/StyledMuiTextField.js +120 -0
- package/dist/components/inputs/PuiAutocomplete.js +350 -0
- package/dist/components/inputs/PuiCheckbox.js +307 -0
- package/dist/components/inputs/PuiCheckboxGroup.js +213 -0
- package/dist/components/inputs/PuiCheckboxItem.js +161 -0
- package/dist/components/inputs/PuiDateField.js +279 -0
- package/dist/components/inputs/PuiDateTimeField.js +395 -0
- package/dist/components/inputs/PuiFileField.js +264 -0
- package/dist/components/inputs/PuiRadioGroup.js +196 -0
- package/dist/components/inputs/PuiRadioItem.js +99 -0
- package/dist/components/inputs/PuiSelect.js +357 -0
- package/dist/components/inputs/PuiTextField.js +262 -0
- package/dist/components/others/PuiBadge.js +56 -0
- package/dist/components/others/PuiChip.js +149 -0
- package/dist/components/others/PuiDialog.js +101 -0
- package/dist/components/others/PuiFormikForm.js +71 -0
- package/dist/components/others/PuiGrid.js +21 -0
- package/dist/components/others/PuiIcon.js +91 -0
- package/dist/components/others/PuiLoadingBackdrop.js +32 -0
- package/dist/components/others/PuiMainContainer.js +40 -0
- package/dist/components/others/PuiNavigation.js +67 -0
- package/dist/components/others/PuiSection.js +97 -0
- package/dist/components/others/PuiTooltip.js +85 -0
- package/dist/components/providers/PuiAlertProvider.js +132 -0
- package/dist/components/providers/PuiLocalizationProvider.js +32 -0
- package/dist/components/referentiel/common/ReferetielContext.js +13 -0
- package/dist/components/referentiel/common/constants/specificReferentielsApis.js +22 -0
- package/dist/components/referentiel/common/constants/specificReferentielsBaseColumns.js +691 -0
- package/dist/components/referentiel/common/constants/specificReferentielsBaseFilters.js +598 -0
- package/dist/components/referentiel/common/constants/specificReferentielsInitialValues.js +80 -0
- package/dist/components/referentiel/common/constants/specificReferentielsKeys.js +18 -0
- package/dist/components/referentiel/common/constants/specificReferentielsTitles.js +22 -0
- package/dist/components/referentiel/common/constants/specificReferentielsValidationSchemas.js +86 -0
- package/dist/components/referentiel/components/PuiBasePopupReferentielField.js +355 -0
- package/dist/components/referentiel/components/PuiCustomPopupReferentielField.js +180 -0
- package/dist/components/referentiel/components/PuiSimplePopupReferentielField.js +323 -0
- package/dist/components/referentiel/components/PuiSimpleReferentielField.js +201 -0
- package/dist/components/referentiel/components/PuiSpecificReferentielField.js +343 -0
- package/dist/components/referentiel/providers/PuiReferentielProvider.js +65 -0
- package/dist/components/tab/PuiTab.js +25 -0
- package/dist/components/tab/PuiTabs.js +145 -0
- package/dist/components/table/ActionPopover.js +54 -0
- package/dist/components/table/PuiTable.js +446 -0
- package/dist/components/table/PuiTableAction.js +63 -0
- package/dist/components/typography/PuiDefinition.js +42 -0
- package/dist/components/typography/PuiIndication.js +79 -0
- package/dist/components/typography/PuiMainTitle.js +85 -0
- package/dist/components/ui/dialogs/PuiSearchDialog.js +105 -0
- package/dist/components/ui/pages/errors/PuiErrorBasePage.js +73 -0
- package/dist/components/ui/pages/errors/PuiForbiddenErrorPage.js +36 -0
- package/dist/components/ui/pages/errors/PuiNetworkErrorPage.js +36 -0
- package/dist/components/ui/pages/errors/PuiNotFoundErrorPage.js +30 -0
- package/dist/components/ui/pages/errors/PuiServerErrorPage.js +37 -0
- package/dist/components/ui/pages/general/PuiDefaultPage.js +68 -0
- package/dist/components/ui/pages/general/PuiSearchPage.js +201 -0
- package/dist/config/apperance.js +26 -0
- package/dist/config/mapping.js +26 -0
- package/dist/config/referentiel.js +10 -0
- package/dist/general/yupValidationErrors.js +8 -0
- package/dist/hooks/useAlert.js +20 -0
- package/dist/hooks/useAxios.js +23 -0
- package/dist/hooks/useCustomAxios.js +36 -0
- package/dist/hooks/useQuery.js +19 -0
- package/dist/index.js +335 -0
- package/package.json +1 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.weak-map.js");
|
|
4
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
require("core-js/modules/es.symbol.description.js");
|
|
10
|
+
var _formik = require("formik");
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _PuiButton = _interopRequireDefault(require("../../../buttons/PuiButton"));
|
|
14
|
+
var _PuiFormikForm = _interopRequireDefault(require("../../../others/PuiFormikForm"));
|
|
15
|
+
var _PuiGrid = _interopRequireDefault(require("../../../others/PuiGrid"));
|
|
16
|
+
var _PuiIcon = _interopRequireDefault(require("../../../others/PuiIcon"));
|
|
17
|
+
var _PuiSection = _interopRequireDefault(require("../../../others/PuiSection"));
|
|
18
|
+
var _PuiTable = _interopRequireDefault(require("../../../table/PuiTable"));
|
|
19
|
+
var _PuiDefaultPage = _interopRequireDefault(require("./PuiDefaultPage"));
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
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); }
|
|
22
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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); }
|
|
29
|
+
const PuiStandardSearchPageContainer = _ref => {
|
|
30
|
+
let {
|
|
31
|
+
actions,
|
|
32
|
+
children
|
|
33
|
+
} = _ref;
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
|
|
35
|
+
container: true,
|
|
36
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
37
|
+
item: true,
|
|
38
|
+
xs: 12,
|
|
39
|
+
children: children
|
|
40
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
41
|
+
item: true,
|
|
42
|
+
xs: 12,
|
|
43
|
+
children: actions
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const PuiSearchPage = _ref2 => {
|
|
48
|
+
let {
|
|
49
|
+
formik,
|
|
50
|
+
formikProps,
|
|
51
|
+
title,
|
|
52
|
+
titleIcon,
|
|
53
|
+
trace,
|
|
54
|
+
navActions,
|
|
55
|
+
topNav,
|
|
56
|
+
bottomNav,
|
|
57
|
+
loading,
|
|
58
|
+
tableProps,
|
|
59
|
+
retour,
|
|
60
|
+
onRetour,
|
|
61
|
+
onReset,
|
|
62
|
+
onSubmit,
|
|
63
|
+
children: _children,
|
|
64
|
+
additionalActions
|
|
65
|
+
} = _ref2;
|
|
66
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
|
|
67
|
+
title: title,
|
|
68
|
+
titleIcon: titleIcon,
|
|
69
|
+
trace: trace,
|
|
70
|
+
navActions: navActions,
|
|
71
|
+
topNav: topNav,
|
|
72
|
+
bottomNav: bottomNav,
|
|
73
|
+
loading: loading,
|
|
74
|
+
retour: retour,
|
|
75
|
+
onRetour: onRetour,
|
|
76
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiSection.default, {
|
|
77
|
+
title: "Param\xE8tres de recherche",
|
|
78
|
+
sx: {
|
|
79
|
+
marginBottom: 2
|
|
80
|
+
},
|
|
81
|
+
children: formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
|
|
82
|
+
initialValues: {}
|
|
83
|
+
}, formikProps), {}, {
|
|
84
|
+
children: _ref3 => {
|
|
85
|
+
let {
|
|
86
|
+
resetForm,
|
|
87
|
+
submitForm
|
|
88
|
+
} = _ref3;
|
|
89
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiFormikForm.default, {
|
|
90
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
|
|
91
|
+
actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
|
|
92
|
+
container: true,
|
|
93
|
+
justifyContent: "end",
|
|
94
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
95
|
+
item: true,
|
|
96
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
97
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
98
|
+
type: "effacer",
|
|
99
|
+
size: "small"
|
|
100
|
+
}),
|
|
101
|
+
onClick: resetForm,
|
|
102
|
+
color: "tertiary",
|
|
103
|
+
children: "Effacer"
|
|
104
|
+
})
|
|
105
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
106
|
+
item: true,
|
|
107
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
108
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
109
|
+
type: "rechercher",
|
|
110
|
+
size: "small"
|
|
111
|
+
}),
|
|
112
|
+
onClick: submitForm,
|
|
113
|
+
loadingPosition: "start",
|
|
114
|
+
children: "Rechercher"
|
|
115
|
+
})
|
|
116
|
+
}), additionalActions && additionalActions.map((actionItem, index) => {
|
|
117
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
118
|
+
item: true,
|
|
119
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
120
|
+
startIcon: actionItem.icon,
|
|
121
|
+
onClick: actionItem.action,
|
|
122
|
+
children: actionItem.name
|
|
123
|
+
})
|
|
124
|
+
}, index);
|
|
125
|
+
})]
|
|
126
|
+
}),
|
|
127
|
+
children: _children
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
})) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
|
|
132
|
+
actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
|
|
133
|
+
container: true,
|
|
134
|
+
justifyContent: "end",
|
|
135
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
136
|
+
item: true,
|
|
137
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
138
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
139
|
+
type: "effacer",
|
|
140
|
+
size: "small"
|
|
141
|
+
}),
|
|
142
|
+
onClick: onReset,
|
|
143
|
+
color: "tertiary",
|
|
144
|
+
children: "Effacer"
|
|
145
|
+
})
|
|
146
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
147
|
+
item: true,
|
|
148
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
149
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
150
|
+
type: "rechercher",
|
|
151
|
+
size: "small"
|
|
152
|
+
}),
|
|
153
|
+
onClick: onSubmit,
|
|
154
|
+
loadingPosition: "start",
|
|
155
|
+
children: "Rechercher"
|
|
156
|
+
})
|
|
157
|
+
}), additionalActions && additionalActions.map((actionItem, index) => {
|
|
158
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
159
|
+
item: true,
|
|
160
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
161
|
+
startIcon: actionItem.icon,
|
|
162
|
+
onClick: actionItem.action,
|
|
163
|
+
children: actionItem.name
|
|
164
|
+
})
|
|
165
|
+
}, index);
|
|
166
|
+
})]
|
|
167
|
+
}),
|
|
168
|
+
children: _children
|
|
169
|
+
})
|
|
170
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread({
|
|
171
|
+
paginationMode: "server"
|
|
172
|
+
}, tableProps))]
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
PuiSearchPage.propTypes = {
|
|
176
|
+
formik: _propTypes.default.bool,
|
|
177
|
+
formikProps: _propTypes.default.object,
|
|
178
|
+
title: _propTypes.default.string.isRequired,
|
|
179
|
+
titleIcon: _propTypes.default.element.isRequired,
|
|
180
|
+
trace: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
181
|
+
navActions: _propTypes.default.element,
|
|
182
|
+
topNav: _propTypes.default.bool,
|
|
183
|
+
bottomNav: _propTypes.default.bool,
|
|
184
|
+
loading: _propTypes.default.bool,
|
|
185
|
+
tableProps: _propTypes.default.object,
|
|
186
|
+
retour: _propTypes.default.bool,
|
|
187
|
+
onRetour: _propTypes.default.func,
|
|
188
|
+
onReset: _propTypes.default.func,
|
|
189
|
+
onSubmit: _propTypes.default.func,
|
|
190
|
+
additionalActions: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
191
|
+
name: _propTypes.default.string.isRequired,
|
|
192
|
+
action: _propTypes.default.func.isRequired,
|
|
193
|
+
icon: _propTypes.default.element
|
|
194
|
+
}))
|
|
195
|
+
};
|
|
196
|
+
PuiSearchPage.defaultProps = {
|
|
197
|
+
formik: true,
|
|
198
|
+
loading: false,
|
|
199
|
+
additionalActions: []
|
|
200
|
+
};
|
|
201
|
+
var _default = exports.default = PuiSearchPage;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.palette = void 0;
|
|
7
|
+
const palette = exports.palette = {
|
|
8
|
+
inherit: "inherit",
|
|
9
|
+
primary: "#232f66",
|
|
10
|
+
secondary: "#e7e7e7",
|
|
11
|
+
error: "#d32f2f",
|
|
12
|
+
warning: "#FD9727",
|
|
13
|
+
success: "#48AC24",
|
|
14
|
+
info: "#2278CF",
|
|
15
|
+
white: "#FFF",
|
|
16
|
+
dark: "#000",
|
|
17
|
+
gray: {
|
|
18
|
+
darker: "#505050",
|
|
19
|
+
dark: "#b6b6b6",
|
|
20
|
+
light: "#F1F1F1"
|
|
21
|
+
},
|
|
22
|
+
background: {
|
|
23
|
+
required: "#FFFBE3",
|
|
24
|
+
error: "#FFE5E5"
|
|
25
|
+
}
|
|
26
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.iconsMapping = exports.iconTypes = void 0;
|
|
7
|
+
var _AccessTime = _interopRequireDefault(require("@mui/icons-material/AccessTime"));
|
|
8
|
+
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
9
|
+
var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
|
|
10
|
+
var _Edit = _interopRequireDefault(require("@mui/icons-material/Edit"));
|
|
11
|
+
var _MoreVert = _interopRequireDefault(require("@mui/icons-material/MoreVert"));
|
|
12
|
+
var _Report = _interopRequireDefault(require("@mui/icons-material/Report"));
|
|
13
|
+
var _Search = _interopRequireDefault(require("@mui/icons-material/Search"));
|
|
14
|
+
var _Visibility = _interopRequireDefault(require("@mui/icons-material/Visibility"));
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
const iconsMapping = exports.iconsMapping = {
|
|
17
|
+
recherche: _Search.default,
|
|
18
|
+
supprimer: _Delete.default,
|
|
19
|
+
detail: _Visibility.default,
|
|
20
|
+
modifier: _Edit.default,
|
|
21
|
+
choisir: _Check.default,
|
|
22
|
+
historique: _AccessTime.default,
|
|
23
|
+
danger: _Report.default,
|
|
24
|
+
"voir-plus": _MoreVert.default
|
|
25
|
+
};
|
|
26
|
+
const iconTypes = exports.iconTypes = ["recherche", "supprimer", "detail", "modifier", "choisir", "historique", "danger", "voir-plus"];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TYPE_STRING = exports.TYPE_NUMBER = void 0;
|
|
7
|
+
const TYPE_STRING = exports.TYPE_STRING = 'Ce champ doit être de type "String"';
|
|
8
|
+
const TYPE_NUMBER = exports.TYPE_NUMBER = "Ce champ doit être un nombre valide";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.weak-map.js");
|
|
4
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _PuiAlertContext = _interopRequireDefault(require("../components/common/PuiAlertContext"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
const useAlert = () => {
|
|
15
|
+
const {
|
|
16
|
+
dispatchAlert
|
|
17
|
+
} = React.useContext(_PuiAlertContext.default);
|
|
18
|
+
return dispatchAlert;
|
|
19
|
+
};
|
|
20
|
+
var _default = exports.default = useAlert;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const useAxios = function useAxios(token) {
|
|
10
|
+
let secret = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
11
|
+
let baseURL = arguments.length > 2 ? arguments[2] : undefined;
|
|
12
|
+
const axiosInstance = _axios.default.create({
|
|
13
|
+
baseURL: baseURL,
|
|
14
|
+
headers: {
|
|
15
|
+
Authorization: secret ? token : "Bearer ".concat(token)
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
axiosInstance.interceptors.response.use(response => response, error => {
|
|
19
|
+
throw error;
|
|
20
|
+
});
|
|
21
|
+
return axiosInstance;
|
|
22
|
+
};
|
|
23
|
+
var _default = exports.default = useAxios;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/es.promise.js");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const useCustomAxios = (token, secret, customUrl) => {
|
|
12
|
+
const axiosInstance = (0, _react.useMemo)(() => {
|
|
13
|
+
const instance = _axios.default.create({
|
|
14
|
+
baseURL: customUrl || "",
|
|
15
|
+
headers: {
|
|
16
|
+
"Content-Type": "application/json"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Intercepteur pour ajouter l'authentification
|
|
21
|
+
instance.interceptors.request.use(config => {
|
|
22
|
+
if (token) {
|
|
23
|
+
config.headers.Authorization = secret ? token : "Bearer ".concat(token);
|
|
24
|
+
}
|
|
25
|
+
if (secret) {
|
|
26
|
+
config.headers["X-Secret"] = secret;
|
|
27
|
+
}
|
|
28
|
+
return config;
|
|
29
|
+
}, error => {
|
|
30
|
+
return Promise.reject(error);
|
|
31
|
+
});
|
|
32
|
+
return instance;
|
|
33
|
+
}, [token, secret, customUrl]);
|
|
34
|
+
return axiosInstance;
|
|
35
|
+
};
|
|
36
|
+
var _default = exports.default = useCustomAxios;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
|
+
require("core-js/modules/web.url-search-params.js");
|
|
9
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
10
|
+
require("core-js/modules/es.string.search.js");
|
|
11
|
+
const useQuery = () => {
|
|
12
|
+
const queryParams = new URLSearchParams(window.location.search);
|
|
13
|
+
const queryObject = {};
|
|
14
|
+
queryParams.forEach((paramValue, paramKey) => {
|
|
15
|
+
queryObject[paramKey] = paramValue;
|
|
16
|
+
});
|
|
17
|
+
return queryObject;
|
|
18
|
+
};
|
|
19
|
+
var _default = exports.default = useQuery;
|