@applica-software-guru/react-admin 1.5.260 → 1.5.262
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/ra-inputs/DateInput.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +18 -18
- package/dist/react-admin.cjs.js.gz +0 -0
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +1147 -1140
- package/dist/react-admin.es.js.gz +0 -0
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +17 -17
- package/dist/react-admin.umd.js.gz +0 -0
- package/dist/react-admin.umd.js.map +1 -1
- package/dist/style.css.gz +0 -0
- package/package.json +2 -11
- package/src/components/ra-inputs/DateInput.tsx +21 -2
- package/vite.config.js +3 -1
|
Binary file
|
package/package.json
CHANGED
|
@@ -33,9 +33,6 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@applica-software-guru/crud-client": "^1.1",
|
|
35
35
|
"@applica-software-guru/iam-client": "^1.1",
|
|
36
|
-
"@testing-library/jest-dom": "^5.16.5",
|
|
37
|
-
"@testing-library/react": "^14.0.0",
|
|
38
|
-
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
39
36
|
"@types/node": "^20.12.13",
|
|
40
37
|
"@types/react": "^18.3.3",
|
|
41
38
|
"@types/react-dom": "^18.3.0",
|
|
@@ -45,30 +42,24 @@
|
|
|
45
42
|
"eslint": "^8.25.0",
|
|
46
43
|
"eslint-config-prettier": "^8.5.0",
|
|
47
44
|
"eslint-config-react-app": "7.0.1",
|
|
48
|
-
"eslint-import-resolver-webpack": "^0.13.8",
|
|
49
45
|
"eslint-plugin-export": "^0.1.2",
|
|
50
46
|
"eslint-plugin-filenames": "^1.3.2",
|
|
51
|
-
"eslint-plugin-flowtype": "^8.0.3",
|
|
52
47
|
"eslint-plugin-import": "^2.26.0",
|
|
53
48
|
"eslint-plugin-jsx-a11y": "^6.6.1",
|
|
54
49
|
"eslint-plugin-prettier": "^4.2.1",
|
|
55
50
|
"eslint-plugin-react": "^7.31.10",
|
|
56
51
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
57
|
-
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
58
52
|
"eslint-plugin-sort-exports": "^0.9.1",
|
|
59
|
-
"file-loader": "^6.2.0",
|
|
60
53
|
"husky": "^9.0.11",
|
|
61
54
|
"jsdom": "^22.1.0",
|
|
62
|
-
"lint-staged": "^13.0.3",
|
|
63
55
|
"prettier": "^2.8.8",
|
|
64
56
|
"react": "^18.2.0",
|
|
65
57
|
"react-dom": "^18.2.0",
|
|
66
|
-
"react-error-overlay": "6.0.9",
|
|
67
58
|
"typescript": "^5.4.5",
|
|
68
59
|
"vite": "^5.2.12",
|
|
60
|
+
"vite-plugin-compression": "^0.5.1",
|
|
69
61
|
"vite-plugin-dts": "^2.3.0",
|
|
70
62
|
"vite-plugin-linter": "^2.0.2",
|
|
71
|
-
"vite-tsconfig-paths": "^4.3.2",
|
|
72
63
|
"vitest": "^1.6.0"
|
|
73
64
|
},
|
|
74
65
|
"eslintConfig": {
|
|
@@ -115,5 +106,5 @@
|
|
|
115
106
|
"type": "module",
|
|
116
107
|
"types": "dist/index.d.ts",
|
|
117
108
|
"typings": "dist/index.d.ts",
|
|
118
|
-
"version": "1.5.
|
|
109
|
+
"version": "1.5.262"
|
|
119
110
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { LabeledInput } from '@/components/ra-inputs/LabeledInput';
|
|
2
2
|
import { styled } from '@mui/material/styles';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import { useCallback, useState } from 'react';
|
|
3
5
|
import { DateInputProps, DateInput as RaDateInput } from 'react-admin';
|
|
4
6
|
|
|
7
|
+
const MAX_YEAR_LENGTH = 4;
|
|
8
|
+
|
|
5
9
|
const StyledDateInput = styled(RaDateInput, { slot: 'root' })(({ label }) => ({
|
|
6
10
|
'& legend': {
|
|
7
11
|
width: label === false ? 0 : 'auto'
|
|
@@ -9,11 +13,26 @@ const StyledDateInput = styled(RaDateInput, { slot: 'root' })(({ label }) => ({
|
|
|
9
13
|
}));
|
|
10
14
|
|
|
11
15
|
function DateInput(props: DateInputProps): JSX.Element {
|
|
16
|
+
const [dateValue, setDateValue] = useState('');
|
|
17
|
+
|
|
18
|
+
const handleInput = useCallback(
|
|
19
|
+
(event: React.ChangeEvent<HTMLInputElement>) => {
|
|
20
|
+
const nextValue = event.target.value;
|
|
21
|
+
const year = dayjs(nextValue).year();
|
|
22
|
+
|
|
23
|
+
if (year.toString().length > MAX_YEAR_LENGTH) {
|
|
24
|
+
event.target.value = dateValue;
|
|
25
|
+
} else {
|
|
26
|
+
setDateValue(nextValue);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
[dateValue]
|
|
30
|
+
);
|
|
31
|
+
|
|
12
32
|
return (
|
|
13
33
|
// @ts-ignore
|
|
14
34
|
<LabeledInput {...props}>
|
|
15
|
-
{
|
|
16
|
-
<StyledDateInput />
|
|
35
|
+
<StyledDateInput {...props} onInput={handleInput} />
|
|
17
36
|
</LabeledInput>
|
|
18
37
|
);
|
|
19
38
|
}
|
package/vite.config.js
CHANGED
|
@@ -4,6 +4,7 @@ import react from '@vitejs/plugin-react';
|
|
|
4
4
|
import { resolve } from 'node:path';
|
|
5
5
|
import process from 'process';
|
|
6
6
|
import { defineConfig } from 'vite';
|
|
7
|
+
import viteCompression from 'vite-plugin-compression';
|
|
7
8
|
import dts from 'vite-plugin-dts';
|
|
8
9
|
import { EsLinter, linterPlugin } from 'vite-plugin-linter';
|
|
9
10
|
|
|
@@ -37,7 +38,8 @@ export default defineConfig((configEnv) => {
|
|
|
37
38
|
linterPlugin({
|
|
38
39
|
include: ['./src/**/*.{js,jsx,ts,tsx}'],
|
|
39
40
|
linters: [new EsLinter({ configEnv })]
|
|
40
|
-
})
|
|
41
|
+
}),
|
|
42
|
+
viteCompression()
|
|
41
43
|
],
|
|
42
44
|
optimizeDeps: {
|
|
43
45
|
include: ['react', 'react-dom', 'react-admin', 'ra-ui-materialui', 'ra-core', 'ra-i18n-polyglot']
|