Skip to content

Commit 124b3ca

Browse files
committed
Updated example and packages
1 parent d3bde30 commit 124b3ca

File tree

6 files changed

+39
-32
lines changed

6 files changed

+39
-32
lines changed

Diff for: LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2022-2024 bluefox <[email protected]>
3+
Copyright (c) 2022-2025 bluefox <[email protected]>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Diff for: README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Build process creates files in directory build.
77
All files from `admin/custom` folder must be in adapter admin directory.
88

99
To use this component in admin, add to `jsonConfig.json` file:
10-
```
10+
```json
1111
"myCustomAttribute": {
1212
"type": "custom",
1313
"i18n": true,
@@ -17,7 +17,7 @@ To use this component in admin, add to `jsonConfig.json` file:
1717
```
1818

1919
Explanation:
20-
- `AdminComponentTemplateSet` - is unique name of this set of components (see in `src/modulefederation.config.js => name (line 14)`). It is suggested to use adapter name for it.
20+
- `AdminComponentTemplateSet` - is unique name of this set of components (see in `src/modulefederation.config.js => name (line 4)`). It is suggested to use adapter name for it.
2121
- `Components` - file name where all components are (`src/Components.jsx`)
2222
- `ExampleComponent` - name of component in `Components.js`which must be used.
2323
- `i18n` - if set to `true`, so the admin will load language files from `i18n`directory (in the same directory, where `customComponents.js` is), if set to language object, it will be used directly. Example: `{"easyconfig_text": {"en": "Text"}}`.
@@ -32,7 +32,7 @@ Start in `src`:
3232
-->
3333
## Changelog
3434
### **WORK IN PROGRESS**
35-
* (bluefox) Changed for Admin 7.4.4
35+
* (bluefox) Updated example and packages
3636

3737
### 1.0.1 (2024-07-14)
3838
* (bluefox) Changed for Admin 7
@@ -53,7 +53,7 @@ Start in `src`:
5353
## License
5454
The MIT License (MIT)
5555

56-
Copyright (c) 2022-2024 bluefox <[email protected]>
56+
Copyright (c) 2022-2025 bluefox <[email protected]>
5757

5858
Permission is hereby granted, free of charge, to any person obtaining a copy
5959
of this software and associated documentation files (the "Software"), to deal

Diff for: package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@
1313
"2-build": "node tasks --2-build",
1414
"3-copy": "node tasks --3-copy",
1515
"npm": "npm i -f && cd src-admin && npm i -f",
16-
"update-packages": "ncu --upgrade && cd src && ncu --upgrade && cd .."
16+
"update-packages": "npx -y npm-check-updates --upgrade && cd src-admin && npx -y npm-check-updates --upgrade"
1717
},
1818
"dependencies": {},
1919
"devDependencies": {
2020
"@alcalzone/release-script": "^3.8.0",
2121
"@alcalzone/release-script-plugin-iobroker": "^3.7.2",
2222
"@alcalzone/release-script-plugin-license": "^3.7.0",
23-
"@iobroker/build-tools": "^2.0.9",
24-
"@iobroker/eslint-config": "^1.0.0",
25-
"gulp": "^4.0.2"
23+
"@iobroker/build-tools": "^2.0.14",
24+
"@iobroker/eslint-config": "^1.0.0"
2625
}
2726
}

Diff for: src-admin/package.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@
99
"dependencies": {},
1010
"devDependencies": {
1111
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
12-
"@iobroker/adapter-react-v5": "^7.4.3",
13-
"@iobroker/json-config": "^7.4.3",
12+
"@iobroker/adapter-react-v5": "^7.4.14",
13+
"@iobroker/json-config": "^7.4.14",
14+
"@mui/material": "^6.4.0",
1415
"prop-types": "^15.8.1",
15-
"react": "^19.0.0",
16-
"react-dom": "^19.0.0",
16+
"react": "^18.3.1",
17+
"react-dom": "^18.3.1",
1718
"react-scripts": "^5.0.1",
1819
"react-refresh": "^0.16.0",
19-
"@originjs/vite-plugin-federation": "^1.3.6",
20+
"@originjs/vite-plugin-federation": "^1.3.9",
2021
"@rollup/plugin-babel": "^6.0.4",
21-
"@rollup/plugin-commonjs": "^28.0.1",
22-
"@rollup/plugin-node-resolve": "^15.3.0",
23-
"@rollup/plugin-replace": "^6.0.1",
24-
"@types/react": "^19.0.0",
25-
"@types/react-dom": "^19.0.0",
22+
"@rollup/plugin-commonjs": "^28.0.2",
23+
"@rollup/plugin-node-resolve": "^16.0.0",
24+
"@rollup/plugin-replace": "^6.0.2",
25+
"@types/react": "^18.3.18",
26+
"@types/react-dom": "^18.3.5",
2627
"@craco/craco": "^7.1.0",
2728
"craco-esbuild": "^0.6.1",
2829
"craco-module-federation": "^1.1.0"

Diff for: src-admin/src/App.jsx

+16-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
import React from 'react';
33
import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
44

5-
import { GenericApp, I18n, Loader, ConfigGeneric, AdminConnection } from '@iobroker/adapter-react-v5';
5+
import { Box } from '@mui/material';
6+
7+
import { GenericApp, I18n, Loader, AdminConnection } from '@iobroker/adapter-react-v5';
68

79
import ExampleComponent from './ExampleComponent';
810

@@ -49,9 +51,18 @@ class App extends GenericApp {
4951
<Box sx={styles.app}>
5052
<div style={styles.item}>
5153
<ExampleComponent
52-
socket={this.socket}
53-
themeType={this.state.themeType}
54-
themeName={this.state.themeName}
54+
// Admin will provide the following object to the component
55+
oContext={{
56+
socket: this.socket,
57+
themeType: this.state.themeType,
58+
adapterName: 'example',
59+
dateFormat: 'DD.MM.YYYY',
60+
instance: 0,
61+
isFloatComma: true,
62+
theme: this.state.theme,
63+
_themeName: this.state.themeName,
64+
forceUpdate: () => {},
65+
}}
5566
attr="myCustomAttribute"
5667
data={this.state.data}
5768
onError={() => {}}
@@ -69,4 +80,4 @@ class App extends GenericApp {
6980
}
7081
}
7182

72-
export default withStyles(styles)(App);
83+
export default App;

Diff for: tasks.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const fs = require('node:fs');
2-
const cp = require('node:child_process');
3-
const { deleteFoldersRecursive, npmInstall, buildReact, copyFiles } = require('@iobroker/build-tools')
1+
const { deleteFoldersRecursive, npmInstall, buildReact, copyFiles } = require('@iobroker/build-tools');
42
const src = `${__dirname}/src-admin/`;
53

64
function clean() {
@@ -18,11 +16,9 @@ function copyAllFiles() {
1816
if (process.argv.includes('--0-clean')) {
1917
clean();
2018
} else if (process.argv.includes('--1-npm')) {
21-
npmInstall(src)
22-
.catch(e => console.error(`Cannot install npm: ${e}`));
19+
npmInstall(src).catch(e => console.error(`Cannot install npm: ${e}`));
2320
} else if (process.argv.includes('--2-build')) {
24-
buildReact(src, { craco: true })
25-
.catch(e => console.error(`Cannot build: ${e}`));
21+
buildReact(src, { craco: true }).catch(e => console.error(`Cannot build: ${e}`));
2622
} else if (process.argv.includes('--3-copy')) {
2723
copyAllFiles();
2824
} else {
@@ -33,5 +29,5 @@ if (process.argv.includes('--0-clean')) {
3329
.catch(e => {
3430
console.error(e);
3531
process.exit(2);
36-
})
32+
});
3733
}

0 commit comments

Comments
 (0)