@gisce/react-ooui 1.1.28-rc.0 → 1.1.29
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/actionbar/TreeActionBar.d.ts.map +1 -1
- package/dist/helpers/iconMapper.d.ts.map +1 -1
- package/dist/react-ooui.es.js +15 -21
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +2 -2
- package/dist/react-ooui.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/iconMapper.test.ts +11 -0
- package/src/actionbar/TreeActionBar.tsx +16 -17
- package/src/helpers/iconMapper.ts +1 -2
package/package.json
CHANGED
|
@@ -16,4 +16,15 @@ describe("A IconMapper instance", () => {
|
|
|
16
16
|
const icon = iconMapper("gtk-find-and-replace");
|
|
17
17
|
expect(icon).toBe(findAndReplaceIcon);
|
|
18
18
|
})
|
|
19
|
+
test("should return gtk-go", () => {
|
|
20
|
+
const findAndReplaceIcon = Icons.FileSearchOutlined;
|
|
21
|
+
const icon = iconMapper("gtk-find-and-replace");
|
|
22
|
+
expect(icon).toBe(findAndReplaceIcon);
|
|
23
|
+
})
|
|
24
|
+
describe("If key doesn't exist in iconMapper", () => {
|
|
25
|
+
test("should return undefined", () => {
|
|
26
|
+
const icon = iconMapper("gtk-foo-bar");
|
|
27
|
+
expect(icon).toBe(undefined);
|
|
28
|
+
})
|
|
29
|
+
})
|
|
19
30
|
});
|
|
@@ -153,9 +153,24 @@ function TreeActionBar(props: Props) {
|
|
|
153
153
|
}
|
|
154
154
|
}}
|
|
155
155
|
/>
|
|
156
|
+
{!treeExpandable && (
|
|
157
|
+
<ButtonWithBadge
|
|
158
|
+
icon={
|
|
159
|
+
<FilterOutlined
|
|
160
|
+
style={{ color: searchVisible ? "white" : undefined }}
|
|
161
|
+
/>
|
|
162
|
+
}
|
|
163
|
+
tooltip={t("advanced_search")}
|
|
164
|
+
type={searchVisible ? "primary" : "default"}
|
|
165
|
+
onClick={() => {
|
|
166
|
+
setSearchVisible?.(!searchVisible);
|
|
167
|
+
}}
|
|
168
|
+
disabled={duplicatingItem || removingItem || treeIsLoading}
|
|
169
|
+
badgeNumber={searchParams?.length}
|
|
170
|
+
/>
|
|
171
|
+
)}
|
|
156
172
|
{separator()}
|
|
157
173
|
<NewButton disabled={treeIsLoading} />
|
|
158
|
-
{separator()}
|
|
159
174
|
<ActionButton
|
|
160
175
|
icon={<CopyOutlined />}
|
|
161
176
|
tooltip={t("duplicate")}
|
|
@@ -181,22 +196,6 @@ function TreeActionBar(props: Props) {
|
|
|
181
196
|
{separator()}
|
|
182
197
|
</>
|
|
183
198
|
)}
|
|
184
|
-
{!treeExpandable && (
|
|
185
|
-
<ButtonWithBadge
|
|
186
|
-
icon={
|
|
187
|
-
<FilterOutlined
|
|
188
|
-
style={{ color: searchVisible ? "white" : undefined }}
|
|
189
|
-
/>
|
|
190
|
-
}
|
|
191
|
-
tooltip={t("advanced_search")}
|
|
192
|
-
type={searchVisible ? "primary" : "default"}
|
|
193
|
-
onClick={() => {
|
|
194
|
-
setSearchVisible?.(!searchVisible);
|
|
195
|
-
}}
|
|
196
|
-
disabled={duplicatingItem || removingItem || treeIsLoading}
|
|
197
|
-
badgeNumber={searchParams?.length}
|
|
198
|
-
/>
|
|
199
|
-
)}
|
|
200
199
|
<ActionButton
|
|
201
200
|
icon={<InfoCircleOutlined />}
|
|
202
201
|
tooltip={t("showLogs")}
|
|
@@ -103,8 +103,7 @@ const iconMapping: { [key: string]: string } = {
|
|
|
103
103
|
export default (key: string) => {
|
|
104
104
|
if (key.indexOf("gtk-") !== -1) {
|
|
105
105
|
const rootIcon = key.replace("gtk-", "").replace(/\-/g, "_");
|
|
106
|
-
|
|
107
|
-
return getIconForKey(iconMapping[newKey]);
|
|
106
|
+
key = `STOCK_${rootIcon.toUpperCase()}`;
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
if (iconMapping.hasOwnProperty(key)) {
|