@gisce/react-ooui 1.2.0-rc.15 → 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,12 +3,13 @@ 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[];
10
10
  limit?: number;
11
11
  context?: any;
12
+ visibleRegisters: number;
12
13
  };
13
14
  export declare const ExportModal: (props: ExportModalProps) => JSX.Element;
14
15
  //# sourceMappingURL=ExportModal.d.ts.map
@@ -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;CACf,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,gBAAgB,gBAgGlD,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.15",
3
+ "version": "1.2.0-rc.17",
4
4
  "files": [
5
5
  "dist",
6
6
  "src",
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@ant-design/plots": "^1.0.9",
39
- "@gisce/ooui": "^0.17.10-rc.3",
40
- "@gisce/react-formiga-components": "^1.0.9-rc.11",
39
+ "@gisce/ooui": "^0.17.11-rc.0",
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,8 @@ 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}
357
+ visibleRegisters={results?.length}
363
358
  context={parentContext}
364
359
  />
365
360
  </Space>
@@ -13,12 +13,13 @@ 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[];
20
20
  limit?: number;
21
21
  context?: any;
22
+ visibleRegisters: number;
22
23
  };
23
24
 
24
25
  export const ExportModal = (props: ExportModalProps) => {
@@ -32,21 +33,36 @@ export const ExportModal = (props: ExportModalProps) => {
32
33
  totalRegisters,
33
34
  domain,
34
35
  limit,
36
+ visibleRegisters,
35
37
  } = props;
36
38
  const fields = useRef<any>({});
37
39
 
38
40
  const onSucceed = useCallback(
39
41
  async (options: ExportOptions) => {
40
- if (options.selectedKeys.length === 0) {
42
+ if (
43
+ options.selectedKeys === undefined ||
44
+ options.selectedKeys.length === 0
45
+ ) {
41
46
  showInfo(tForLang("selectAtLeastOneField", locale));
42
47
  return;
43
48
  }
44
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
+
45
61
  const { datas } = await ConnectionProvider.getHandler().exportData({
46
62
  model,
47
63
  fields: options.selectedKeys,
48
- domain: options.registersAmount === "all" ? [] : domain,
49
- limit: options.registersAmount === "all" ? undefined : limit,
64
+ domain: exportDomain,
65
+ limit: options.registersAmount === "all" ? 0 : limit,
50
66
  context,
51
67
  format: options.exportType,
52
68
  });
@@ -111,10 +127,17 @@ export const ExportModal = (props: ExportModalProps) => {
111
127
  locale={locale as Locale}
112
128
  onSucceed={onSucceed}
113
129
  onCancel={onClose}
114
- selectedRegistersToExport={selectedRegistersToExport}
130
+ selectedRegistersToExport={
131
+ selectedRegistersToExport &&
132
+ selectedRegistersToExport.length &&
133
+ selectedRegistersToExport.length > 0
134
+ ? selectedRegistersToExport.length
135
+ : undefined
136
+ }
115
137
  totalRegisters={totalRegisters}
116
138
  onGetFieldChilds={onGetFieldChilds}
117
139
  onGetFields={onGetFields}
140
+ visibleRegisters={visibleRegisters}
118
141
  />
119
142
  );
120
143
  };