@nocobase/plugin-theme-editor 0.11.1-alpha.2 → 0.11.1-alpha.4
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/lib/client/antd-token-previewer/locale/fr-FR.d.ts +3 -0
- package/lib/client/antd-token-previewer/locale/fr-FR.js +24 -0
- package/lib/client/hooks/useThemeSettings.js +2 -3
- package/lib/client/hooks/useUpdateThemeSettings.js +8 -6
- package/lib/locale/fr-FR.d.ts +23 -0
- package/lib/locale/fr-FR.js +31 -0
- package/package.json +7 -7
- package/src/client/antd-token-previewer/locale/fr-FR.ts +20 -0
- package/src/client/hooks/useThemeSettings.tsx +2 -2
- package/src/client/hooks/useUpdateThemeSettings.tsx +6 -6
- package/src/locale/fr-FR.ts +26 -0
- /package/lib/{client/locale → locale}/en-US.d.ts +0 -0
- /package/lib/{client/locale → locale}/en-US.js +0 -0
- /package/lib/{client/locale → locale}/zh-CN.d.ts +0 -0
- /package/lib/{client/locale → locale}/zh-CN.js +0 -0
- /package/src/{client/locale → locale}/en-US.ts +0 -0
- /package/src/{client/locale → locale}/zh-CN.ts +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const locale = {
|
|
8
|
+
_lang: 'fr-FR',
|
|
9
|
+
followPrimary: 'Suivre la couleur du branding',
|
|
10
|
+
reset: 'Réinitialiser',
|
|
11
|
+
next: 'Suivant',
|
|
12
|
+
groupView: 'Vue groupe',
|
|
13
|
+
fill: 'Remplir',
|
|
14
|
+
border: 'Bordure',
|
|
15
|
+
background: 'Arrière-plan',
|
|
16
|
+
text: 'Texte',
|
|
17
|
+
demo: {
|
|
18
|
+
overview: 'Aperçu',
|
|
19
|
+
components: 'Composants',
|
|
20
|
+
relatedTokens: 'Jetons associés'
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var _default = locale;
|
|
24
|
+
exports.default = _default;
|
|
@@ -51,7 +51,6 @@ const useThemeSettings = () => {
|
|
|
51
51
|
};
|
|
52
52
|
exports.useThemeSettings = useThemeSettings;
|
|
53
53
|
function Label() {
|
|
54
|
-
var _currentUser$data, _currentUser$data$dat, _systemSettings$data, _systemSettings$data$;
|
|
55
54
|
const _useTranslation = (0, _locale.useTranslation)(),
|
|
56
55
|
t = _useTranslation.t;
|
|
57
56
|
const currentUser = (0, _client().useCurrentUserContext)();
|
|
@@ -105,11 +104,11 @@ function Label() {
|
|
|
105
104
|
(0, _client2().error)(err);
|
|
106
105
|
return null;
|
|
107
106
|
}
|
|
108
|
-
if (!
|
|
107
|
+
if (!currentUser) {
|
|
109
108
|
(0, _client2().error)('Please check if provide `CurrentUserProvider` in your app.');
|
|
110
109
|
throw new Error('Please check if provide `CurrentUserProvider` in your app.');
|
|
111
110
|
}
|
|
112
|
-
if (!
|
|
111
|
+
if (!systemSettings) {
|
|
113
112
|
(0, _client2().error)('Please check if provide `SystemSettingsProvider` in your app.');
|
|
114
113
|
throw new Error('Please check if provide `SystemSettingsProvider` in your app.');
|
|
115
114
|
}
|
|
@@ -38,20 +38,21 @@ function useUpdateThemeSettings() {
|
|
|
38
38
|
const systemSettings = (0, _client().useSystemSettings)();
|
|
39
39
|
const updateUserThemeSettings = (0, _react().useCallback)( /*#__PURE__*/function () {
|
|
40
40
|
var _ref = _asyncToGenerator(function* (themeId) {
|
|
41
|
-
|
|
41
|
+
var _currentUser$data$dat;
|
|
42
|
+
if (themeId === ((_currentUser$data$dat = currentUser.data.data.systemSettings) === null || _currentUser$data$dat === void 0 ? void 0 : _currentUser$data$dat.themeId)) {
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
44
45
|
try {
|
|
45
46
|
yield api.resource('users').updateProfile({
|
|
46
47
|
values: {
|
|
47
|
-
systemSettings: _objectSpread(_objectSpread({}, currentUser.data.data.systemSettings), {}, {
|
|
48
|
+
systemSettings: _objectSpread(_objectSpread({}, currentUser.data.data.systemSettings || {}), {}, {
|
|
48
49
|
themeId
|
|
49
50
|
})
|
|
50
51
|
}
|
|
51
52
|
});
|
|
52
53
|
currentUser.mutate({
|
|
53
54
|
data: _objectSpread(_objectSpread({}, currentUser.data.data), {}, {
|
|
54
|
-
systemSettings: _objectSpread(_objectSpread({}, currentUser.data.data.systemSettings), {}, {
|
|
55
|
+
systemSettings: _objectSpread(_objectSpread({}, currentUser.data.data.systemSettings || {}), {}, {
|
|
55
56
|
themeId
|
|
56
57
|
})
|
|
57
58
|
})
|
|
@@ -66,21 +67,22 @@ function useUpdateThemeSettings() {
|
|
|
66
67
|
}(), [api, currentUser]);
|
|
67
68
|
const updateSystemThemeSettings = (0, _react().useCallback)( /*#__PURE__*/function () {
|
|
68
69
|
var _ref2 = _asyncToGenerator(function* (themeId) {
|
|
69
|
-
|
|
70
|
+
var _systemSettings$data$;
|
|
71
|
+
if (themeId === ((_systemSettings$data$ = systemSettings.data.data.options) === null || _systemSettings$data$ === void 0 ? void 0 : _systemSettings$data$.themeId)) {
|
|
70
72
|
return;
|
|
71
73
|
}
|
|
72
74
|
yield api.request({
|
|
73
75
|
url: 'systemSettings:update/1',
|
|
74
76
|
method: 'post',
|
|
75
77
|
data: {
|
|
76
|
-
options: _objectSpread(_objectSpread({}, systemSettings.data.data.options), {}, {
|
|
78
|
+
options: _objectSpread(_objectSpread({}, systemSettings.data.data.options || {}), {}, {
|
|
77
79
|
themeId
|
|
78
80
|
})
|
|
79
81
|
}
|
|
80
82
|
});
|
|
81
83
|
systemSettings.mutate({
|
|
82
84
|
data: _objectSpread(_objectSpread({}, systemSettings.data.data), {}, {
|
|
83
|
-
options: _objectSpread(_objectSpread({}, systemSettings.data.data.options), {}, {
|
|
85
|
+
options: _objectSpread(_objectSpread({}, systemSettings.data.data.options || {}), {}, {
|
|
84
86
|
themeId
|
|
85
87
|
})
|
|
86
88
|
})
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const locale: {
|
|
2
|
+
Theme: string;
|
|
3
|
+
Local: string;
|
|
4
|
+
'Dark theme': string;
|
|
5
|
+
Optional: string;
|
|
6
|
+
'Non-optional': string;
|
|
7
|
+
Current: string;
|
|
8
|
+
Default: string;
|
|
9
|
+
'Theme Editor': string;
|
|
10
|
+
Save: string;
|
|
11
|
+
Close: string;
|
|
12
|
+
Edit: string;
|
|
13
|
+
Export: string;
|
|
14
|
+
'edit Theme Config': string;
|
|
15
|
+
'The theme of the JSON format is incorrect': string;
|
|
16
|
+
'Edited successfully': string;
|
|
17
|
+
'Saved successfully': string;
|
|
18
|
+
'Initializing Editor...': string;
|
|
19
|
+
'Save theme': string;
|
|
20
|
+
'Please set a name for this theme': string;
|
|
21
|
+
'Please input the theme name': string;
|
|
22
|
+
};
|
|
23
|
+
export default locale;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const locale = {
|
|
8
|
+
Theme: 'Thème',
|
|
9
|
+
Local: 'Local',
|
|
10
|
+
'Dark theme': 'Thème sombre',
|
|
11
|
+
Optional: 'Optionnel',
|
|
12
|
+
'Non-optional': 'Non-optionnel',
|
|
13
|
+
Current: 'Actuel',
|
|
14
|
+
Default: 'Par défaut',
|
|
15
|
+
// 主题编辑器
|
|
16
|
+
'Theme Editor': 'Éditeur de thème',
|
|
17
|
+
Save: 'Enregistrer',
|
|
18
|
+
Close: 'Fermer',
|
|
19
|
+
Edit: 'Modifier',
|
|
20
|
+
Export: 'Exporter',
|
|
21
|
+
'edit Theme Config': 'Modifier la configuration du thème',
|
|
22
|
+
'The theme of the JSON format is incorrect': 'Le thème au format JSON est incorrect',
|
|
23
|
+
'Edited successfully': 'Modifié avec succès',
|
|
24
|
+
'Saved successfully': 'Enregistré avec succès',
|
|
25
|
+
'Initializing Editor...': "Initialisation de l'éditeur...",
|
|
26
|
+
'Save theme': 'Enregistrer le thème',
|
|
27
|
+
'Please set a name for this theme': 'Veuillez définir un nom pour ce thème',
|
|
28
|
+
'Please input the theme name': 'Veuillez saisir le nom du thème'
|
|
29
|
+
};
|
|
30
|
+
var _default = locale;
|
|
31
|
+
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-theme-editor",
|
|
3
|
-
"version": "0.11.1-alpha.
|
|
3
|
+
"version": "0.11.1-alpha.4",
|
|
4
4
|
"main": "lib/server/index.js",
|
|
5
5
|
"displayName": "Theme editor",
|
|
6
6
|
"displayName.zh-CN": "主题编辑器",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"@ant-design/cssinjs": "^1.11.1",
|
|
22
22
|
"@ant-design/icons": "^5.1.4",
|
|
23
23
|
"@emotion/css": "^11.11.2",
|
|
24
|
-
"@nocobase/client": "0.11.1-alpha.
|
|
25
|
-
"@nocobase/database": "0.11.1-alpha.
|
|
26
|
-
"@nocobase/server": "0.11.1-alpha.
|
|
27
|
-
"@nocobase/test": "0.11.1-alpha.
|
|
28
|
-
"@nocobase/utils": "0.11.1-alpha.
|
|
24
|
+
"@nocobase/client": "0.11.1-alpha.4",
|
|
25
|
+
"@nocobase/database": "0.11.1-alpha.4",
|
|
26
|
+
"@nocobase/server": "0.11.1-alpha.4",
|
|
27
|
+
"@nocobase/test": "0.11.1-alpha.4",
|
|
28
|
+
"@nocobase/utils": "0.11.1-alpha.4",
|
|
29
29
|
"antd": "^5.6.4",
|
|
30
30
|
"lodash": "4.17.21",
|
|
31
31
|
"react": "^18.2.0"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "d9b5bde913013f1057e1aab49587eb0ad3dcb06e"
|
|
34
34
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Locale } from './interface';
|
|
2
|
+
|
|
3
|
+
const locale: Locale = {
|
|
4
|
+
_lang: 'fr-FR',
|
|
5
|
+
followPrimary: 'Suivre la couleur du branding',
|
|
6
|
+
reset: 'Réinitialiser',
|
|
7
|
+
next: 'Suivant',
|
|
8
|
+
groupView: 'Vue groupe',
|
|
9
|
+
fill: 'Remplir',
|
|
10
|
+
border: 'Bordure',
|
|
11
|
+
background: 'Arrière-plan',
|
|
12
|
+
text: 'Texte',
|
|
13
|
+
demo: {
|
|
14
|
+
overview: 'Aperçu',
|
|
15
|
+
components: 'Composants',
|
|
16
|
+
relatedTokens: 'Jetons associés',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default locale;
|
|
@@ -68,12 +68,12 @@ function Label() {
|
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
if (!currentUser
|
|
71
|
+
if (!currentUser) {
|
|
72
72
|
error('Please check if provide `CurrentUserProvider` in your app.');
|
|
73
73
|
throw new Error('Please check if provide `CurrentUserProvider` in your app.');
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
if (!systemSettings
|
|
76
|
+
if (!systemSettings) {
|
|
77
77
|
error('Please check if provide `SystemSettingsProvider` in your app.');
|
|
78
78
|
throw new Error('Please check if provide `SystemSettingsProvider` in your app.');
|
|
79
79
|
}
|
|
@@ -9,14 +9,14 @@ export function useUpdateThemeSettings() {
|
|
|
9
9
|
|
|
10
10
|
const updateUserThemeSettings = useCallback(
|
|
11
11
|
async (themeId: number | null) => {
|
|
12
|
-
if (themeId === currentUser.data.data.systemSettings
|
|
12
|
+
if (themeId === currentUser.data.data.systemSettings?.themeId) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
try {
|
|
16
16
|
await api.resource('users').updateProfile({
|
|
17
17
|
values: {
|
|
18
18
|
systemSettings: {
|
|
19
|
-
...currentUser.data.data.systemSettings,
|
|
19
|
+
...(currentUser.data.data.systemSettings || {}),
|
|
20
20
|
themeId,
|
|
21
21
|
},
|
|
22
22
|
},
|
|
@@ -25,7 +25,7 @@ export function useUpdateThemeSettings() {
|
|
|
25
25
|
data: {
|
|
26
26
|
...currentUser.data.data,
|
|
27
27
|
systemSettings: {
|
|
28
|
-
...currentUser.data.data.systemSettings,
|
|
28
|
+
...(currentUser.data.data.systemSettings || {}),
|
|
29
29
|
themeId,
|
|
30
30
|
},
|
|
31
31
|
},
|
|
@@ -39,7 +39,7 @@ export function useUpdateThemeSettings() {
|
|
|
39
39
|
|
|
40
40
|
const updateSystemThemeSettings = useCallback(
|
|
41
41
|
async (themeId: number | null) => {
|
|
42
|
-
if (themeId === systemSettings.data.data.options
|
|
42
|
+
if (themeId === systemSettings.data.data.options?.themeId) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
await api.request({
|
|
@@ -47,7 +47,7 @@ export function useUpdateThemeSettings() {
|
|
|
47
47
|
method: 'post',
|
|
48
48
|
data: {
|
|
49
49
|
options: {
|
|
50
|
-
...systemSettings.data.data.options,
|
|
50
|
+
...(systemSettings.data.data.options || {}),
|
|
51
51
|
themeId,
|
|
52
52
|
},
|
|
53
53
|
},
|
|
@@ -56,7 +56,7 @@ export function useUpdateThemeSettings() {
|
|
|
56
56
|
data: {
|
|
57
57
|
...systemSettings.data.data,
|
|
58
58
|
options: {
|
|
59
|
-
...systemSettings.data.data.options,
|
|
59
|
+
...(systemSettings.data.data.options || {}),
|
|
60
60
|
themeId,
|
|
61
61
|
},
|
|
62
62
|
},
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const locale = {
|
|
2
|
+
Theme: 'Thème',
|
|
3
|
+
Local: 'Local',
|
|
4
|
+
'Dark theme': 'Thème sombre',
|
|
5
|
+
Optional: 'Optionnel',
|
|
6
|
+
'Non-optional': 'Non-optionnel',
|
|
7
|
+
Current: 'Actuel',
|
|
8
|
+
Default: 'Par défaut',
|
|
9
|
+
|
|
10
|
+
// 主题编辑器
|
|
11
|
+
'Theme Editor': 'Éditeur de thème',
|
|
12
|
+
Save: 'Enregistrer',
|
|
13
|
+
Close: 'Fermer',
|
|
14
|
+
Edit: 'Modifier',
|
|
15
|
+
Export: 'Exporter',
|
|
16
|
+
'edit Theme Config': 'Modifier la configuration du thème',
|
|
17
|
+
'The theme of the JSON format is incorrect': 'Le thème au format JSON est incorrect',
|
|
18
|
+
'Edited successfully': 'Modifié avec succès',
|
|
19
|
+
'Saved successfully': 'Enregistré avec succès',
|
|
20
|
+
'Initializing Editor...': "Initialisation de l'éditeur...",
|
|
21
|
+
'Save theme': 'Enregistrer le thème',
|
|
22
|
+
'Please set a name for this theme': 'Veuillez définir un nom pour ce thème',
|
|
23
|
+
'Please input the theme name': 'Veuillez saisir le nom du thème',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default locale;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|