@gisce/react-ooui 2.0.0-alpha.37 → 2.0.0-alpha.39
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/context/ConfigContext.d.ts +9 -1
- package/dist/context/ConfigContext.d.ts.map +1 -1
- package/dist/react-ooui.es.js +2284 -2277
- package/dist/react-ooui.es.js.map +1 -1
- package/package.json +2 -2
- package/src/actionbar/TreeActionBar.tsx +84 -78
- package/src/context/ConfigContext.tsx +22 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gisce/react-ooui",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.39",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": "20.5.0"
|
|
6
6
|
},
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@ant-design/plots": "^1.0.9",
|
|
36
36
|
"@gisce/fiber-diagram": "^1.1.0-rc.3",
|
|
37
|
-
"@gisce/ooui": "1.0.0-alpha.
|
|
37
|
+
"@gisce/ooui": "1.0.0-alpha.13",
|
|
38
38
|
"@gisce/react-formiga-components": "^1.0.9-rc.21",
|
|
39
39
|
"@gisce/react-formiga-table": "^0.8.6",
|
|
40
40
|
"@monaco-editor/react": "^4.4.5",
|
|
@@ -30,7 +30,7 @@ import { showLogInfo } from "@/helpers/logInfoHelper";
|
|
|
30
30
|
import SearchBar from "./SearchBar";
|
|
31
31
|
import { ExportModal } from "..";
|
|
32
32
|
import { mergeParams } from "@/helpers/searchHelper";
|
|
33
|
-
import {
|
|
33
|
+
import { ErpFeatureKeys, useFeatureIsEnabled } from "@/context/ConfigContext";
|
|
34
34
|
|
|
35
35
|
type Props = {
|
|
36
36
|
parentContext?: any;
|
|
@@ -66,7 +66,9 @@ function TreeActionBar(props: Props) {
|
|
|
66
66
|
} = useContext(ActionViewContext) as ActionViewContextType;
|
|
67
67
|
|
|
68
68
|
const { parentContext = {}, treeExpandable, toolbar } = props;
|
|
69
|
-
const
|
|
69
|
+
const advancedExportEnabled = useFeatureIsEnabled(
|
|
70
|
+
ErpFeatureKeys.FEATURE_ADVANCED_EXPORT,
|
|
71
|
+
);
|
|
70
72
|
const { t, lang } = useContext(LocaleContext) as LocaleContextType;
|
|
71
73
|
const contentRootContext = useContext(
|
|
72
74
|
ContentRootContext,
|
|
@@ -287,85 +289,89 @@ function TreeActionBar(props: Props) {
|
|
|
287
289
|
});
|
|
288
290
|
}}
|
|
289
291
|
/>
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
tooltip={t("export")}
|
|
317
|
-
items={[
|
|
318
|
-
{
|
|
319
|
-
id: "print_screen",
|
|
320
|
-
name: t("printScreen"),
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
id: "export",
|
|
324
|
-
name: t("advancedExport"),
|
|
325
|
-
},
|
|
326
|
-
]}
|
|
327
|
-
onItemClick={(itemClicked: any) => {
|
|
328
|
-
if (itemClicked.id === "print_screen") {
|
|
329
|
-
let idsToExport = selectedRowItems?.map((item) => item.id) || [];
|
|
330
|
-
|
|
331
|
-
if (idsToExport.length === 0) {
|
|
332
|
-
idsToExport = results?.map((item) => item.id) || [];
|
|
292
|
+
{advancedExportEnabled && (
|
|
293
|
+
<>
|
|
294
|
+
{separator()}
|
|
295
|
+
<DropdownButton
|
|
296
|
+
icon={
|
|
297
|
+
<Icon
|
|
298
|
+
component={() => (
|
|
299
|
+
<svg
|
|
300
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
301
|
+
className="icon icon-tabler icon-tabler-database-export"
|
|
302
|
+
width="1em"
|
|
303
|
+
height="1em"
|
|
304
|
+
viewBox="0 0 24 24"
|
|
305
|
+
strokeWidth="1.5"
|
|
306
|
+
fill="none"
|
|
307
|
+
stroke="currentColor"
|
|
308
|
+
strokeLinecap="round"
|
|
309
|
+
strokeLinejoin="round"
|
|
310
|
+
>
|
|
311
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
312
|
+
<ellipse cx="12" cy="6" rx="8" ry="3" />
|
|
313
|
+
<path d="M4 6v6c0 1.657 3.582 3 8 3a19.84 19.84 0 0 0 3.302 -.267m4.698 -2.733v-6" />
|
|
314
|
+
<path d="M4 12v6c0 1.599 3.335 2.905 7.538 2.995m8.462 -6.995v-2m-6 7h7m-3 -3l3 3l-3 3" />
|
|
315
|
+
</svg>
|
|
316
|
+
)}
|
|
317
|
+
/>
|
|
333
318
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
type: "ir.actions.report.xml",
|
|
340
|
-
datas: {
|
|
341
|
-
model: currentModel,
|
|
342
|
-
ids: idsToExport,
|
|
319
|
+
tooltip={t("export")}
|
|
320
|
+
items={[
|
|
321
|
+
{
|
|
322
|
+
id: "print_screen",
|
|
323
|
+
name: t("printScreen"),
|
|
343
324
|
},
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
325
|
+
{
|
|
326
|
+
id: "export",
|
|
327
|
+
name: t("advancedExport"),
|
|
328
|
+
},
|
|
329
|
+
]}
|
|
330
|
+
onItemClick={(itemClicked: any) => {
|
|
331
|
+
if (itemClicked.id === "print_screen") {
|
|
332
|
+
let idsToExport =
|
|
333
|
+
selectedRowItems?.map((item) => item.id) || [];
|
|
347
334
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
335
|
+
if (idsToExport.length === 0) {
|
|
336
|
+
idsToExport = results?.map((item) => item.id) || [];
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
runAction({
|
|
340
|
+
id: -1,
|
|
341
|
+
model: currentModel,
|
|
342
|
+
report_name: "printscreen.list",
|
|
343
|
+
type: "ir.actions.report.xml",
|
|
344
|
+
datas: {
|
|
345
|
+
model: currentModel,
|
|
346
|
+
ids: idsToExport,
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
setExportModalVisible(true);
|
|
353
|
+
}}
|
|
354
|
+
disabled={
|
|
355
|
+
duplicatingItem || removingItem || treeIsLoading || hasNameSearch
|
|
356
|
+
}
|
|
357
|
+
/>
|
|
358
|
+
<ExportModal
|
|
359
|
+
visible={exportModalVisible}
|
|
360
|
+
locale={lang}
|
|
361
|
+
onClose={() => setExportModalVisible(false)}
|
|
362
|
+
model={currentModel!}
|
|
363
|
+
domain={mergeParams(
|
|
364
|
+
searchTreeRef?.current?.getDomain() || [],
|
|
365
|
+
searchParams || [],
|
|
366
|
+
)}
|
|
367
|
+
limit={limit}
|
|
368
|
+
totalRegisters={totalItems || 0}
|
|
369
|
+
selectedRegistersToExport={selectedRowItems}
|
|
370
|
+
visibleRegisters={results?.length || 0}
|
|
371
|
+
context={parentContext}
|
|
372
|
+
/>
|
|
373
|
+
</>
|
|
374
|
+
)}
|
|
369
375
|
</Space>
|
|
370
376
|
);
|
|
371
377
|
}
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
2
|
|
|
3
3
|
interface ConfigContextProps {
|
|
4
|
-
|
|
4
|
+
erpFeatures: ErpFeaturesMap;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export const ConfigContext = React.createContext<ConfigContextProps>({
|
|
8
|
-
|
|
8
|
+
erpFeatures: {},
|
|
9
9
|
});
|
|
10
|
+
|
|
11
|
+
// TODO: this should be defined in a third package, because we are duplicating it both in webclient and here
|
|
12
|
+
export enum ErpFeatureKeys {
|
|
13
|
+
FEATURE_ADVANCED_EXPORT = "export_data2",
|
|
14
|
+
// ... add more features here
|
|
15
|
+
}
|
|
16
|
+
// TODO: this should be defined in a third package, because we are duplicating it both in webclient and here
|
|
17
|
+
export type ErpFeaturesMap = {
|
|
18
|
+
[key in ErpFeatureKeys]?: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const useConfigContext = () => {
|
|
22
|
+
return useContext(ConfigContext);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const useFeatureIsEnabled = (featureKey: ErpFeatureKeys): boolean => {
|
|
26
|
+
const { erpFeatures } = useConfigContext();
|
|
27
|
+
return !!erpFeatures[featureKey];
|
|
28
|
+
};
|