@gisce/react-ooui 1.2.0-rc.16 → 1.2.0-rc.17

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.
@@ -3,7 +3,7 @@ export declare type ExportModalProps = {
3
3
  visible: boolean;
4
4
  locale: string;
5
5
  onClose: () => void;
6
- selectedRegistersToExport?: number;
6
+ selectedRegistersToExport?: any[];
7
7
  totalRegisters: number;
8
8
  model: string;
9
9
  domain: any[];
@@ -1 +1 @@
1
- {"version":3,"file":"ExportModal.d.ts","sourceRoot":"","sources":["ExportModal.tsx"],"names":[],"mappings":";AAWA,oBAAY,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,gBAAgB,gBAkGlD,CAAC"}
1
+ {"version":3,"file":"ExportModal.d.ts","sourceRoot":"","sources":["ExportModal.tsx"],"names":[],"mappings":";AAWA,oBAAY,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yBAAyB,CAAC,EAAE,GAAG,EAAE,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,gBAAgB,gBAsHlD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/react-ooui",
3
- "version": "1.2.0-rc.16",
3
+ "version": "1.2.0-rc.17",
4
4
  "files": [
5
5
  "dist",
6
6
  "src",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@ant-design/plots": "^1.0.9",
39
39
  "@gisce/ooui": "^0.17.11-rc.0",
40
- "@gisce/react-formiga-components": "^1.0.9-rc.11",
40
+ "@gisce/react-formiga-components": "^1.0.9-rc.12",
41
41
  "@gisce/react-formiga-table": "^0.5.0",
42
42
  "@monaco-editor/react": "^4.4.5",
43
43
  "@tabler/icons": "^1.96.0",
@@ -353,13 +353,7 @@ function TreeActionBar(props: Props) {
353
353
  )}
354
354
  limit={limit}
355
355
  totalRegisters={totalItems || 0}
356
- selectedRegistersToExport={
357
- selectedRowItems &&
358
- selectedRowItems.length &&
359
- selectedRowItems.length > 0
360
- ? selectedRowItems.length
361
- : undefined
362
- }
356
+ selectedRegistersToExport={selectedRowItems}
363
357
  visibleRegisters={results?.length}
364
358
  context={parentContext}
365
359
  />
@@ -13,7 +13,7 @@ export type ExportModalProps = {
13
13
  visible: boolean;
14
14
  locale: string;
15
15
  onClose: () => void;
16
- selectedRegistersToExport?: number;
16
+ selectedRegistersToExport?: any[];
17
17
  totalRegisters: number;
18
18
  model: string;
19
19
  domain: any[];
@@ -39,16 +39,30 @@ export const ExportModal = (props: ExportModalProps) => {
39
39
 
40
40
  const onSucceed = useCallback(
41
41
  async (options: ExportOptions) => {
42
- if (options.selectedKeys.length === 0) {
42
+ if (
43
+ options.selectedKeys === undefined ||
44
+ options.selectedKeys.length === 0
45
+ ) {
43
46
  showInfo(tForLang("selectAtLeastOneField", locale));
44
47
  return;
45
48
  }
46
49
 
50
+ let exportDomain = domain;
51
+
52
+ if (
53
+ options.registersAmount === "selected" &&
54
+ selectedRegistersToExport?.length !== 0
55
+ ) {
56
+ exportDomain = [
57
+ ["id", "in", selectedRegistersToExport?.map((r) => r.id)],
58
+ ];
59
+ }
60
+
47
61
  const { datas } = await ConnectionProvider.getHandler().exportData({
48
62
  model,
49
63
  fields: options.selectedKeys,
50
- domain: options.registersAmount === "all" ? [] : domain,
51
- limit: options.registersAmount === "all" ? undefined : limit,
64
+ domain: exportDomain,
65
+ limit: options.registersAmount === "all" ? 0 : limit,
52
66
  context,
53
67
  format: options.exportType,
54
68
  });
@@ -113,7 +127,13 @@ export const ExportModal = (props: ExportModalProps) => {
113
127
  locale={locale as Locale}
114
128
  onSucceed={onSucceed}
115
129
  onCancel={onClose}
116
- selectedRegistersToExport={selectedRegistersToExport}
130
+ selectedRegistersToExport={
131
+ selectedRegistersToExport &&
132
+ selectedRegistersToExport.length &&
133
+ selectedRegistersToExport.length > 0
134
+ ? selectedRegistersToExport.length
135
+ : undefined
136
+ }
117
137
  totalRegisters={totalRegisters}
118
138
  onGetFieldChilds={onGetFieldChilds}
119
139
  onGetFields={onGetFields}