@gisce/react-ooui 1.1.31-rc.0 → 1.1.31
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/helpers/iconMapper.d.ts +5 -2
- package/dist/helpers/iconMapper.d.ts.map +1 -1
- package/dist/react-ooui.es.js +520 -517
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +1 -1
- package/dist/react-ooui.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/helpers/iconMapper.ts +9 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gisce/react-ooui",
|
|
3
|
-
"version": "1.1.31
|
|
3
|
+
"version": "1.1.31",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"src",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@ant-design/plots": "^1.0.9",
|
|
39
|
-
"@gisce/ooui": "^0.17.
|
|
39
|
+
"@gisce/ooui": "^0.17.12",
|
|
40
40
|
"@gisce/react-formiga-table": "^0.5.0",
|
|
41
41
|
"@monaco-editor/react": "^4.4.5",
|
|
42
42
|
"@tabler/icons-react": "^2.11.0",
|
|
@@ -100,17 +100,17 @@ const iconMapping: { [key: string]: string } = {
|
|
|
100
100
|
STOCK_PREFERENCES: "Setting",
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
export default (key: string) => {
|
|
103
|
+
export default (key: string, className?: any) => {
|
|
104
104
|
if (key.indexOf("gtk-") !== -1) {
|
|
105
105
|
const rootIcon = key.replace("gtk-", "").replace(/\-/g, "_");
|
|
106
106
|
key = `STOCK_${rootIcon.toUpperCase()}`;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
if (iconMapping.hasOwnProperty(key)) {
|
|
110
|
-
return getIconForKey(iconMapping[key]);
|
|
110
|
+
return getIconForKey(iconMapping[key], className);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
return getIconForKey(key);
|
|
113
|
+
return getIconForKey(key, className);
|
|
114
114
|
};
|
|
115
115
|
|
|
116
116
|
function toCamelCase(key: string): string {
|
|
@@ -125,7 +125,7 @@ function toCamelCase(key: string): string {
|
|
|
125
125
|
.join("")}`;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
function getIconForKey(key: string) {
|
|
128
|
+
function getIconForKey(key: string, className?: any) {
|
|
129
129
|
let IconCamelCase = key.charAt(0).toUpperCase() + key.slice(1); // Capitalize first letter
|
|
130
130
|
if (IconCamelCase.indexOf("-") !== -1) {
|
|
131
131
|
IconCamelCase = toCamelCase(IconCamelCase);
|
|
@@ -133,7 +133,10 @@ function getIconForKey(key: string) {
|
|
|
133
133
|
|
|
134
134
|
const antKey: AntKey = `${IconCamelCase}Outlined` as any;
|
|
135
135
|
if (AntIcons[antKey]) {
|
|
136
|
-
return
|
|
136
|
+
return () =>
|
|
137
|
+
React.createElement(AntIcons[antKey] as any, {
|
|
138
|
+
className,
|
|
139
|
+
});
|
|
137
140
|
}
|
|
138
141
|
|
|
139
142
|
const tablerKey: TablerKey = `Icon${IconCamelCase}` as any;
|
|
@@ -147,6 +150,7 @@ function getIconForKey(key: string) {
|
|
|
147
150
|
const CustomIcon = () =>
|
|
148
151
|
React.createElement(Icon, {
|
|
149
152
|
component: TablerIcon,
|
|
153
|
+
className,
|
|
150
154
|
});
|
|
151
155
|
return CustomIcon;
|
|
152
156
|
}
|