@portnet/ui 5.0.13 → 5.0.15
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.
|
@@ -8,10 +8,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
require("core-js/modules/es.array.includes.js");
|
|
10
10
|
require("core-js/modules/es.promise.js");
|
|
11
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
11
12
|
require("core-js/modules/es.string.includes.js");
|
|
13
|
+
require("core-js/modules/es.string.trim.js");
|
|
12
14
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
13
15
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
14
16
|
require("core-js/modules/esnext.iterator.map.js");
|
|
17
|
+
require("core-js/modules/esnext.iterator.some.js");
|
|
15
18
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
16
19
|
var _formik = require("formik");
|
|
17
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -106,7 +109,8 @@ const PuiSpecificReferentielField = _ref2 => {
|
|
|
106
109
|
getReturnedValue,
|
|
107
110
|
getRenderedValue,
|
|
108
111
|
onChange,
|
|
109
|
-
onError
|
|
112
|
+
onError,
|
|
113
|
+
requireAtLeastOneCriteria
|
|
110
114
|
} = _ref2;
|
|
111
115
|
const {
|
|
112
116
|
token,
|
|
@@ -116,6 +120,7 @@ const PuiSpecificReferentielField = _ref2 => {
|
|
|
116
120
|
const axios = (0, _useAxios.default)(token, secret, baseURL);
|
|
117
121
|
const [dataFetchingState, dataFetchingDispatch] = React.useReducer(dataFetchingReducer, dataFetchingInitalState);
|
|
118
122
|
const [filtreredFilters, setFiltreredFilters] = React.useState([..._specificReferentielsBaseFilters.default[searchKey]]);
|
|
123
|
+
const [requireCriteriaError, setRequireCriteriaError] = React.useState(false);
|
|
119
124
|
const formRef = React.useRef();
|
|
120
125
|
const [isMounted, setIsMounted] = React.useState(false);
|
|
121
126
|
const pageChangeHandler = pageNumber => {
|
|
@@ -125,6 +130,14 @@ const PuiSpecificReferentielField = _ref2 => {
|
|
|
125
130
|
});
|
|
126
131
|
};
|
|
127
132
|
const submitHandler = async values => {
|
|
133
|
+
if (requireAtLeastOneCriteria) {
|
|
134
|
+
const hasAtLeastOne = Object.values(values).some(v => v !== null && v !== undefined && v.toString().trim() !== "");
|
|
135
|
+
if (!hasAtLeastOne) {
|
|
136
|
+
setRequireCriteriaError(true);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
setRequireCriteriaError(false);
|
|
128
141
|
try {
|
|
129
142
|
dataFetchingDispatch({
|
|
130
143
|
type: "GET_DATA"
|
|
@@ -248,6 +261,16 @@ const PuiSpecificReferentielField = _ref2 => {
|
|
|
248
261
|
}, filtreredFilter.name);
|
|
249
262
|
})
|
|
250
263
|
})
|
|
264
|
+
}), requireCriteriaError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
265
|
+
item: true,
|
|
266
|
+
xs: 12,
|
|
267
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
268
|
+
style: {
|
|
269
|
+
color: "red",
|
|
270
|
+
fontSize: "0.85rem"
|
|
271
|
+
},
|
|
272
|
+
children: "Veuillez saisir au moins un crit\xE8re de recherche."
|
|
273
|
+
})
|
|
251
274
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
252
275
|
item: true,
|
|
253
276
|
xs: 12,
|
|
@@ -309,7 +332,8 @@ PuiSpecificReferentielField.propTypes = {
|
|
|
309
332
|
getRenderedValue: _propTypes.default.func.isRequired,
|
|
310
333
|
getReturnedValue: _propTypes.default.func,
|
|
311
334
|
onChange: _propTypes.default.func,
|
|
312
|
-
onError: _propTypes.default.func
|
|
335
|
+
onError: _propTypes.default.func,
|
|
336
|
+
requireAtLeastOneCriteria: _propTypes.default.bool
|
|
313
337
|
};
|
|
314
338
|
PuiSpecificReferentielField.defaultProps = {
|
|
315
339
|
disabled: false,
|
|
@@ -322,6 +346,7 @@ PuiSpecificReferentielField.defaultProps = {
|
|
|
322
346
|
tableProps: {},
|
|
323
347
|
getReturnedValue: row => row,
|
|
324
348
|
onError: () => {},
|
|
325
|
-
onChange: () => {}
|
|
349
|
+
onChange: () => {},
|
|
350
|
+
requireAtLeastOneCriteria: false
|
|
326
351
|
};
|
|
327
352
|
var _default = exports.default = PuiSpecificReferentielField;
|
package/package.json
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@portnet/ui",
|
|
3
|
-
"version": "5.0.
|
|
4
|
-
"description": "Portnet UI",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"react",
|
|
7
|
-
"components",
|
|
8
|
-
"ui"
|
|
9
|
-
],
|
|
10
|
-
"main": "dist/index.js",
|
|
11
|
-
"private": false,
|
|
12
|
-
"files": [
|
|
13
|
-
"dist",
|
|
14
|
-
"README.md"
|
|
15
|
-
],
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@emotion/react": "^11.10.5",
|
|
18
|
-
"@emotion/styled": "^11.10.5",
|
|
19
|
-
"@fortawesome/fontawesome-svg-core": "^6.4.2",
|
|
20
|
-
"@fortawesome/free-regular-svg-icons": "^7.1.0",
|
|
21
|
-
"@fortawesome/free-solid-svg-icons": "^6.4.2",
|
|
22
|
-
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
23
|
-
"@mui/icons-material": "^5.10.16",
|
|
24
|
-
"@mui/lab": "^5.0.0-alpha.60",
|
|
25
|
-
"@mui/material": "^5.10.16",
|
|
26
|
-
"@mui/x-data-grid": "^5.17.26",
|
|
27
|
-
"@mui/x-data-grid-pro": "^5.17.26",
|
|
28
|
-
"@mui/x-date-pickers": "^5.0.4",
|
|
29
|
-
"@reduxjs/toolkit": "^2.11.2",
|
|
30
|
-
"@testing-library/jest-dom": "^5.16.5",
|
|
31
|
-
"@testing-library/react": "^13.4.0",
|
|
32
|
-
"@testing-library/user-event": "^13.5.0",
|
|
33
|
-
"axios": "^1.13.2",
|
|
34
|
-
"bootstrap": "^5.3.2",
|
|
35
|
-
"formik": "^2.2.9",
|
|
36
|
-
"lodash": "^4.17.21",
|
|
37
|
-
"moment": "^2.30.1",
|
|
38
|
-
"react": "^18.2.0",
|
|
39
|
-
"react-dom": "^18.2.0",
|
|
40
|
-
"react-query": "^3.39.3",
|
|
41
|
-
"react-redux": "^8.0.5",
|
|
42
|
-
"react-scripts": "^5.0.1",
|
|
43
|
-
"react-toastify": "^9.1.3",
|
|
44
|
-
"react-transition-group": "^4.4.5",
|
|
45
|
-
"reactstrap": "^9.2.0",
|
|
46
|
-
"styled-components": "^6.1.3",
|
|
47
|
-
"uuid": "^9.0.0",
|
|
48
|
-
"web-vitals": "^2.1.4",
|
|
49
|
-
"yup": "^0.32.11"
|
|
50
|
-
},
|
|
51
|
-
"scripts": {
|
|
52
|
-
"start": "react-scripts start",
|
|
53
|
-
"build": "rimraf dist && cross-env NODE_ENV=production babel src/lib --out-dir dist --copy-files",
|
|
54
|
-
"test": "react-scripts test",
|
|
55
|
-
"eject": "react-scripts eject",
|
|
56
|
-
"storybook": "storybook dev -p 6006 -s public",
|
|
57
|
-
"build-storybook": "storybook build -s public"
|
|
58
|
-
},
|
|
59
|
-
"eslintConfig": {
|
|
60
|
-
"extends": [
|
|
61
|
-
"react-app",
|
|
62
|
-
"react-app/jest"
|
|
63
|
-
],
|
|
64
|
-
"overrides": [
|
|
65
|
-
{
|
|
66
|
-
"files": [
|
|
67
|
-
"**/*.stories.*"
|
|
68
|
-
],
|
|
69
|
-
"rules": {
|
|
70
|
-
"import/no-anonymous-default-export": "off"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
},
|
|
75
|
-
"browserslist": {
|
|
76
|
-
"production": [
|
|
77
|
-
">0.2%",
|
|
78
|
-
"not dead",
|
|
79
|
-
"not op_mini all"
|
|
80
|
-
],
|
|
81
|
-
"development": [
|
|
82
|
-
"last 1 chrome version",
|
|
83
|
-
"last 1 firefox version",
|
|
84
|
-
"last 1 safari version"
|
|
85
|
-
]
|
|
86
|
-
},
|
|
87
|
-
"devDependencies": {
|
|
88
|
-
"@babel/cli": "^7.19.3",
|
|
89
|
-
"@babel/core": "^7.20.5",
|
|
90
|
-
"@babel/preset-env": "^7.20.2",
|
|
91
|
-
"@babel/preset-react": "^7.18.6",
|
|
92
|
-
"@storybook/addon-actions": "^7.6.4",
|
|
93
|
-
"@storybook/addon-essentials": "^7.6.4",
|
|
94
|
-
"@storybook/addon-interactions": "^7.6.4",
|
|
95
|
-
"@storybook/addon-links": "^7.6.4",
|
|
96
|
-
"@storybook/node-logger": "^7.6.4",
|
|
97
|
-
"@storybook/preset-create-react-app": "^7.6.4",
|
|
98
|
-
"@storybook/react": "^7.6.4",
|
|
99
|
-
"@storybook/react-webpack5": "^7.6.4",
|
|
100
|
-
"@storybook/testing-library": "^0.2.2",
|
|
101
|
-
"ajv": "^8.17.1",
|
|
102
|
-
"ajv-keywords": "^5.1.0",
|
|
103
|
-
"cross-env": "^7.0.3",
|
|
104
|
-
"husky": "^4.3.8",
|
|
105
|
-
"prop-types": "^15.8.1",
|
|
106
|
-
"rimraf": "^5.0.5",
|
|
107
|
-
"storybook": "^7.6.4",
|
|
108
|
-
"webpack": "^5.75.0"
|
|
109
|
-
}
|
|
110
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@portnet/ui",
|
|
3
|
+
"version": "5.0.15",
|
|
4
|
+
"description": "Portnet UI",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"components",
|
|
8
|
+
"ui"
|
|
9
|
+
],
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"private": false,
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@emotion/react": "^11.10.5",
|
|
18
|
+
"@emotion/styled": "^11.10.5",
|
|
19
|
+
"@fortawesome/fontawesome-svg-core": "^6.4.2",
|
|
20
|
+
"@fortawesome/free-regular-svg-icons": "^7.1.0",
|
|
21
|
+
"@fortawesome/free-solid-svg-icons": "^6.4.2",
|
|
22
|
+
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
23
|
+
"@mui/icons-material": "^5.10.16",
|
|
24
|
+
"@mui/lab": "^5.0.0-alpha.60",
|
|
25
|
+
"@mui/material": "^5.10.16",
|
|
26
|
+
"@mui/x-data-grid": "^5.17.26",
|
|
27
|
+
"@mui/x-data-grid-pro": "^5.17.26",
|
|
28
|
+
"@mui/x-date-pickers": "^5.0.4",
|
|
29
|
+
"@reduxjs/toolkit": "^2.11.2",
|
|
30
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
31
|
+
"@testing-library/react": "^13.4.0",
|
|
32
|
+
"@testing-library/user-event": "^13.5.0",
|
|
33
|
+
"axios": "^1.13.2",
|
|
34
|
+
"bootstrap": "^5.3.2",
|
|
35
|
+
"formik": "^2.2.9",
|
|
36
|
+
"lodash": "^4.17.21",
|
|
37
|
+
"moment": "^2.30.1",
|
|
38
|
+
"react": "^18.2.0",
|
|
39
|
+
"react-dom": "^18.2.0",
|
|
40
|
+
"react-query": "^3.39.3",
|
|
41
|
+
"react-redux": "^8.0.5",
|
|
42
|
+
"react-scripts": "^5.0.1",
|
|
43
|
+
"react-toastify": "^9.1.3",
|
|
44
|
+
"react-transition-group": "^4.4.5",
|
|
45
|
+
"reactstrap": "^9.2.0",
|
|
46
|
+
"styled-components": "^6.1.3",
|
|
47
|
+
"uuid": "^9.0.0",
|
|
48
|
+
"web-vitals": "^2.1.4",
|
|
49
|
+
"yup": "^0.32.11"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"start": "react-scripts start",
|
|
53
|
+
"build": "rimraf dist && cross-env NODE_ENV=production babel src/lib --out-dir dist --copy-files",
|
|
54
|
+
"test": "react-scripts test",
|
|
55
|
+
"eject": "react-scripts eject",
|
|
56
|
+
"storybook": "storybook dev -p 6006 -s public",
|
|
57
|
+
"build-storybook": "storybook build -s public"
|
|
58
|
+
},
|
|
59
|
+
"eslintConfig": {
|
|
60
|
+
"extends": [
|
|
61
|
+
"react-app",
|
|
62
|
+
"react-app/jest"
|
|
63
|
+
],
|
|
64
|
+
"overrides": [
|
|
65
|
+
{
|
|
66
|
+
"files": [
|
|
67
|
+
"**/*.stories.*"
|
|
68
|
+
],
|
|
69
|
+
"rules": {
|
|
70
|
+
"import/no-anonymous-default-export": "off"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"browserslist": {
|
|
76
|
+
"production": [
|
|
77
|
+
">0.2%",
|
|
78
|
+
"not dead",
|
|
79
|
+
"not op_mini all"
|
|
80
|
+
],
|
|
81
|
+
"development": [
|
|
82
|
+
"last 1 chrome version",
|
|
83
|
+
"last 1 firefox version",
|
|
84
|
+
"last 1 safari version"
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@babel/cli": "^7.19.3",
|
|
89
|
+
"@babel/core": "^7.20.5",
|
|
90
|
+
"@babel/preset-env": "^7.20.2",
|
|
91
|
+
"@babel/preset-react": "^7.18.6",
|
|
92
|
+
"@storybook/addon-actions": "^7.6.4",
|
|
93
|
+
"@storybook/addon-essentials": "^7.6.4",
|
|
94
|
+
"@storybook/addon-interactions": "^7.6.4",
|
|
95
|
+
"@storybook/addon-links": "^7.6.4",
|
|
96
|
+
"@storybook/node-logger": "^7.6.4",
|
|
97
|
+
"@storybook/preset-create-react-app": "^7.6.4",
|
|
98
|
+
"@storybook/react": "^7.6.4",
|
|
99
|
+
"@storybook/react-webpack5": "^7.6.4",
|
|
100
|
+
"@storybook/testing-library": "^0.2.2",
|
|
101
|
+
"ajv": "^8.17.1",
|
|
102
|
+
"ajv-keywords": "^5.1.0",
|
|
103
|
+
"cross-env": "^7.0.3",
|
|
104
|
+
"husky": "^4.3.8",
|
|
105
|
+
"prop-types": "^15.8.1",
|
|
106
|
+
"rimraf": "^5.0.5",
|
|
107
|
+
"storybook": "^7.6.4",
|
|
108
|
+
"webpack": "^5.75.0"
|
|
109
|
+
}
|
|
110
|
+
}
|