@gisce/react-ooui 1.1.2-rc.0 → 1.1.2-rc.1

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.
@@ -15,6 +15,7 @@ declare type Props = {
15
15
  action_id: number;
16
16
  action_type: string;
17
17
  treeExpandable?: boolean;
18
+ limit?: number;
18
19
  };
19
20
  declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<unknown>>;
20
21
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ActionView.d.ts","sourceRoot":"","sources":["ActionView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAIf,OAAO,EAIL,eAAe,EAGf,QAAQ,EACT,MAAM,eAAe,CAAC;AAiBvB,aAAK,KAAK,GAAG;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,eAAe,CAAC;IAC7B,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;;AAuaF,wBAAsC"}
1
+ {"version":3,"file":"ActionView.d.ts","sourceRoot":"","sources":["ActionView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAIf,OAAO,EAIL,eAAe,EAGf,QAAQ,EACT,MAAM,eAAe,CAAC;AAiBvB,aAAK,KAAK,GAAG;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,eAAe,CAAC;IAC7B,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;;AA2aF,wBAAsC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RootView.d.ts","sourceRoot":"","sources":["RootView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAaf,aAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oBAAY,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;;AA8cF,wBAAoC"}
1
+ {"version":3,"file":"RootView.d.ts","sourceRoot":"","sources":["RootView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAaf,aAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oBAAY,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;;AAudF,wBAAoC"}
@@ -1 +1 @@
1
- {"version":3,"file":"GraphActionView.d.ts","sourceRoot":"","sources":["GraphActionView.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAO7C,oBAAY,oBAAoB,GAAG;IACjC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;IACZ,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,eAAe,UAAW,oBAAoB,uBA+G1D,CAAC"}
1
+ {"version":3,"file":"GraphActionView.d.ts","sourceRoot":"","sources":["GraphActionView.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAO7C,oBAAY,oBAAoB,GAAG;IACjC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;IACZ,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,eAAe,UAAW,oBAAoB,uBAiH1D,CAAC"}
@@ -14,6 +14,7 @@ export declare type TreeActionViewProps = {
14
14
  setCurrentView: (view: View) => void;
15
15
  availableViews: View[];
16
16
  searchTreeNameSearch?: string;
17
+ limit?: number;
17
18
  };
18
19
  export declare const TreeActionView: (props: TreeActionViewProps) => JSX.Element | null;
19
20
  //# sourceMappingURL=TreeActionView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TreeActionView.d.ts","sourceRoot":"","sources":["TreeActionView.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAKnD,oBAAY,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,GAAG,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,mBAAmB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,YAAY,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACrC,cAAc,EAAE,IAAI,EAAE,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,mBAAmB,uBAsDxD,CAAC"}
1
+ {"version":3,"file":"TreeActionView.d.ts","sourceRoot":"","sources":["TreeActionView.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAKnD,oBAAY,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,GAAG,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,mBAAmB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,YAAY,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACrC,cAAc,EAAE,IAAI,EAAE,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,mBAAmB,uBAuDxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["Dashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAGf,OAAO,gCAAgC,CAAC;AACxC,OAAO,kCAAkC,CAAC;AAI1C,OAAO,EAAE,cAAc,EAAY,MAAM,SAAS,CAAC;;AAiWnD,wBAAqC"}
1
+ {"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["Dashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAGf,OAAO,gCAAgC,CAAC;AACxC,OAAO,kCAAkC,CAAC;AAI1C,OAAO,EAAE,cAAc,EAAY,MAAM,SAAS,CAAC;;AAkWnD,wBAAqC"}
@@ -7,7 +7,6 @@ declare type OnRowClickedData = {
7
7
  treeView: TreeView;
8
8
  };
9
9
  declare type Props = {
10
- action?: string;
11
10
  model?: string;
12
11
  formView?: FormView;
13
12
  treeView?: TreeView;
@@ -1 +1 @@
1
- {"version":3,"file":"SearchTree.d.ts","sourceRoot":"","sources":["SearchTree.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAA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AAS,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,YAAY,CAoL9C;AAED,eAAe,IAAI,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/react-ooui",
3
- "version": "1.1.2-rc.0",
3
+ "version": "1.1.2-rc.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "src",
@@ -1,5 +1,6 @@
1
+ import { DEFAULT_SEARCH_LIMIT } from "@/hooks/useSearch";
1
2
  import { View } from "@/types";
2
- import React, { useEffect, useState } from "react";
3
+ import React, { useEffect, useRef, useState } from "react";
3
4
 
4
5
  export type ActionViewContextType = {
5
6
  title: string;
@@ -50,6 +51,8 @@ export type ActionViewContextType = {
50
51
  goToResourceId?: (id: number) => Promise<void>;
51
52
  searchValues?: any;
52
53
  setSearchValues?: (value: any) => void;
54
+ limit?: number;
55
+ setLimit?: (value: number) => void;
53
56
  };
54
57
 
55
58
  export const ActionViewContext =
@@ -60,19 +63,6 @@ type ActionViewProviderProps = ActionViewContextType & {
60
63
  };
61
64
 
62
65
  const ActionViewProvider = (props: ActionViewProviderProps): any => {
63
- const [formIsSaving, setFormIsSaving] = useState<boolean>(false);
64
- const [formHasChanges, setFormHasChanges] = useState<boolean>(false);
65
- const [removingItem, setRemovingItem] = useState<boolean>(false);
66
- const [formIsLoading, setFormIsLoading] = useState<boolean>(true);
67
- const [treeIsLoading, setTreeIsLoading] = useState<boolean>(true);
68
- const [attachments, setAttachments] = useState<any>([]);
69
- const [duplicatingItem, setDuplicatingItem] = useState<boolean>(false);
70
- const [searchParams, setSearchParams] = useState<any[]>([]);
71
- const [searchVisible, setSearchVisible] = useState<boolean>(false);
72
- const [graphIsLoading, setGraphIsLoading] = useState<boolean>(true);
73
- const [previousView, setPreviousView] = useState<View>();
74
- const [searchValues, setSearchValues] = useState<any>({});
75
-
76
66
  const {
77
67
  children,
78
68
  currentView,
@@ -98,8 +88,25 @@ const ActionViewProvider = (props: ActionViewProviderProps): any => {
98
88
  searchTreeNameSearch,
99
89
  setSearchTreeNameSearch,
100
90
  goToResourceId,
91
+ limit: limitProps,
101
92
  } = props;
102
93
 
94
+ const [formIsSaving, setFormIsSaving] = useState<boolean>(false);
95
+ const [formHasChanges, setFormHasChanges] = useState<boolean>(false);
96
+ const [removingItem, setRemovingItem] = useState<boolean>(false);
97
+ const [formIsLoading, setFormIsLoading] = useState<boolean>(true);
98
+ const [treeIsLoading, setTreeIsLoading] = useState<boolean>(true);
99
+ const [attachments, setAttachments] = useState<any>([]);
100
+ const [duplicatingItem, setDuplicatingItem] = useState<boolean>(false);
101
+ const [searchParams, setSearchParams] = useState<any[]>([]);
102
+ const [searchVisible, setSearchVisible] = useState<boolean>(false);
103
+ const [graphIsLoading, setGraphIsLoading] = useState<boolean>(true);
104
+ const [previousView, setPreviousView] = useState<View>();
105
+ const [searchValues, setSearchValues] = useState<any>({});
106
+ const [limit, setLimit] = useState<number>(
107
+ limitProps !== undefined ? limitProps : DEFAULT_SEARCH_LIMIT
108
+ );
109
+
103
110
  useEffect(() => {
104
111
  if (results && results.length > 0 && !currentItemIndex) {
105
112
  setCurrentItemIndex?.(0);
@@ -107,6 +114,10 @@ const ActionViewProvider = (props: ActionViewProviderProps): any => {
107
114
  }
108
115
  }, [results]);
109
116
 
117
+ useEffect(() => {
118
+ setLimit(limitProps !== undefined ? limitProps : DEFAULT_SEARCH_LIMIT);
119
+ }, [limitProps]);
120
+
110
121
  useEffect(() => {
111
122
  if (availableViews.length === 1) {
112
123
  setPreviousView(availableViews[0]);
@@ -172,6 +183,8 @@ const ActionViewProvider = (props: ActionViewProviderProps): any => {
172
183
  goToResourceId,
173
184
  searchValues,
174
185
  setSearchValues,
186
+ limit,
187
+ setLimit,
175
188
  }}
176
189
  >
177
190
  {children}
@@ -29,7 +29,6 @@ type UseSearchOpts = {
29
29
  resultsActionView?: any[];
30
30
  domain: any;
31
31
  currentId?: number;
32
- limitFromAction?: number;
33
32
  limit?: number;
34
33
  setLimit?: (value: number) => void;
35
34
  setSearchValues?: (value: any) => void;
@@ -58,7 +57,6 @@ export const useSearch = (opts: UseSearchOpts) => {
58
57
  resultsActionView,
59
58
  domain,
60
59
  currentId,
61
- limitFromAction,
62
60
  limit,
63
61
  setLimit,
64
62
  searchParams = [],
@@ -74,9 +72,9 @@ export const useSearch = (opts: UseSearchOpts) => {
74
72
  const [totalItems, setTotalItems] = useState<number>();
75
73
  const [resultsInternal, setResultsInternal] = useState<any>([]);
76
74
  const [colorsForResults, setColorsForResults] = useState<any>(undefined);
75
+ const internalLimit = useRef(limit || DEFAULT_SEARCH_LIMIT);
77
76
 
78
77
  const originalResults = useRef<any[]>([]);
79
- const internalLimit = useRef(80);
80
78
  const actionDomain = useRef<any>([]);
81
79
 
82
80
  const setResults = useCallback((results: any) => {
@@ -165,7 +163,6 @@ export const useSearch = (opts: UseSearchOpts) => {
165
163
  sorter,
166
164
  setCurrentItemIndex,
167
165
  setActionViewTotalItems,
168
- internalLimit,
169
166
  actionDomain,
170
167
  ]);
171
168
 
@@ -179,7 +176,7 @@ export const useSearch = (opts: UseSearchOpts) => {
179
176
  const { totalItems, results, attrsEvaluated } =
180
177
  await ConnectionProvider.getHandler().searchForTree({
181
178
  params: mergedParams,
182
- limit,
179
+ limit: internalLimit.current,
183
180
  offset,
184
181
  model,
185
182
  fields: treeView!.field_parent
@@ -261,7 +258,6 @@ export const useSearch = (opts: UseSearchOpts) => {
261
258
  currentId,
262
259
  domain,
263
260
  formView,
264
- internalLimit,
265
261
  limit,
266
262
  model,
267
263
  nameSearch,
@@ -316,6 +312,7 @@ export const useSearch = (opts: UseSearchOpts) => {
316
312
  setSearchFilterLoading(true);
317
313
  setSearchError(undefined);
318
314
  setPage(1);
315
+ internalLimit.current = newLimit;
319
316
  if (newLimit) setLimit?.(newLimit);
320
317
  if (newOffset) setOffset(newOffset);
321
318
  fetchResults();
@@ -352,7 +349,7 @@ export const useSearch = (opts: UseSearchOpts) => {
352
349
  setSearchError(undefined);
353
350
  setOffset(0);
354
351
  setPage(1);
355
- setLimit?.(limitFromAction || DEFAULT_SEARCH_LIMIT);
352
+ setLimit?.(limit || DEFAULT_SEARCH_LIMIT);
356
353
  }, [
357
354
  tableRefreshing,
358
355
  setSearchTreeNameSearch,
@@ -361,7 +358,7 @@ export const useSearch = (opts: UseSearchOpts) => {
361
358
  setOffset,
362
359
  setPage,
363
360
  setLimit,
364
- limitFromAction,
361
+ limit,
365
362
  ]);
366
363
 
367
364
  const fetchChildrenForRecord = useCallback(
@@ -49,6 +49,7 @@ type Props = {
49
49
  action_id: number;
50
50
  action_type: string;
51
51
  treeExpandable?: boolean;
52
+ limit?: number;
52
53
  };
53
54
 
54
55
  function ActionView(props: Props, ref: any) {
@@ -67,6 +68,7 @@ function ActionView(props: Props, ref: any) {
67
68
  action_id,
68
69
  action_type,
69
70
  treeExpandable = false,
71
+ limit,
70
72
  } = props;
71
73
  const [currentView, setCurrentViewInternal] = useState<View>();
72
74
 
@@ -363,6 +365,7 @@ function ActionView(props: Props, ref: any) {
363
365
  currentView!.type === view.type &&
364
366
  currentView!.view_id === view.view_id
365
367
  }
368
+ limit={limit}
366
369
  model={model}
367
370
  context={context}
368
371
  domain={domain}
@@ -398,6 +401,7 @@ function ActionView(props: Props, ref: any) {
398
401
  formView={
399
402
  availableViews.find((v) => v.type === "form") as FormView
400
403
  }
404
+ limit={limit}
401
405
  />
402
406
  );
403
407
  }
@@ -458,6 +462,7 @@ function ActionView(props: Props, ref: any) {
458
462
  setSearchTreeNameSearch={setSearchTreeNameSearch}
459
463
  searchTreeNameSearch={searchTreeNameSearch}
460
464
  goToResourceId={goToResourceId}
465
+ limit={limit}
461
466
  >
462
467
  {content()}
463
468
  <GoToResourceModal
@@ -122,6 +122,7 @@ function RootView(props: RootViewProps, ref: any) {
122
122
  name: title,
123
123
  target,
124
124
  view_type,
125
+ limit,
125
126
  } = dataForAction;
126
127
 
127
128
  const treeExpandable = view_type === "tree";
@@ -174,6 +175,7 @@ function RootView(props: RootViewProps, ref: any) {
174
175
  forced_values,
175
176
  res_id,
176
177
  treeExpandable,
178
+ limit,
177
179
  });
178
180
  }
179
181
 
@@ -228,6 +230,7 @@ function RootView(props: RootViewProps, ref: any) {
228
230
  views,
229
231
  target,
230
232
  string: title,
233
+ limit,
231
234
  } = relateData;
232
235
 
233
236
  const [id, type] = views[0];
@@ -257,6 +260,7 @@ function RootView(props: RootViewProps, ref: any) {
257
260
  initialView,
258
261
  action_id,
259
262
  action_type,
263
+ limit,
260
264
  });
261
265
  }
262
266
 
@@ -288,6 +292,7 @@ function RootView(props: RootViewProps, ref: any) {
288
292
  name: title,
289
293
  target,
290
294
  view_type,
295
+ limit,
291
296
  } = dataForAction;
292
297
  const treeExpandable = view_type === "tree";
293
298
 
@@ -343,6 +348,7 @@ function RootView(props: RootViewProps, ref: any) {
343
348
  action_type,
344
349
  res_id,
345
350
  treeExpandable,
351
+ limit,
346
352
  });
347
353
  }
348
354
 
@@ -387,6 +393,7 @@ function RootView(props: RootViewProps, ref: any) {
387
393
  values,
388
394
  forced_values,
389
395
  treeExpandable = false,
396
+ limit,
390
397
  }: {
391
398
  domain: any;
392
399
  context: any;
@@ -401,6 +408,7 @@ function RootView(props: RootViewProps, ref: any) {
401
408
  values?: any;
402
409
  forced_values?: any;
403
410
  treeExpandable?: boolean;
411
+ limit?: number;
404
412
  }) {
405
413
  const key = uuidv4();
406
414
 
@@ -447,6 +455,7 @@ function RootView(props: RootViewProps, ref: any) {
447
455
  formDefaultValues={values}
448
456
  formForcedValues={forced_values}
449
457
  treeExpandable={treeExpandable}
458
+ limit={limit}
450
459
  />
451
460
  ),
452
461
  key,
@@ -45,7 +45,8 @@ export const GraphActionView = (props: GraphActionViewProps) => {
45
45
  setTotalItems: setActionViewTotalItems = undefined,
46
46
  setSearchTreeNameSearch = undefined,
47
47
  setTreeIsLoading = undefined,
48
- results = undefined,
48
+ limit,
49
+ setLimit,
49
50
  } = actionViewContext || {};
50
51
 
51
52
  const { searchParams, searchValues, setSearchValues } = useContext(
@@ -59,7 +60,6 @@ export const GraphActionView = (props: GraphActionViewProps) => {
59
60
  searchFilterLoading,
60
61
  searchError,
61
62
  offset,
62
- limit,
63
63
  tableRefreshing,
64
64
  } = useSearch({
65
65
  model,
@@ -81,6 +81,8 @@ export const GraphActionView = (props: GraphActionViewProps) => {
81
81
  domain,
82
82
  currentId,
83
83
  setActionViewTotalItems,
84
+ limit,
85
+ setLimit,
84
86
  });
85
87
 
86
88
  if (!visible) {
@@ -120,7 +122,7 @@ export const GraphActionView = (props: GraphActionViewProps) => {
120
122
  ) : (
121
123
  <>
122
124
  <p style={{ textAlign: "right" }}>
123
- {`${t("totalRegisters")} ${results?.length}`}
125
+ {`${t("totalRegisters")} ${resultsActionView?.length}`}
124
126
  </p>
125
127
  <Graph
126
128
  ref={graphRef}
@@ -18,6 +18,7 @@ export type TreeActionViewProps = {
18
18
  setCurrentView: (view: View) => void;
19
19
  availableViews: View[];
20
20
  searchTreeNameSearch?: string;
21
+ limit?: number;
21
22
  };
22
23
 
23
24
  export const TreeActionView = (props: TreeActionViewProps) => {
@@ -35,6 +36,7 @@ export const TreeActionView = (props: TreeActionViewProps) => {
35
36
  setCurrentView,
36
37
  availableViews,
37
38
  searchTreeNameSearch,
39
+ limit,
38
40
  } = props;
39
41
 
40
42
  if (!visible) {
@@ -320,6 +320,7 @@ function Dashboard(props: DashboardProps, ref: any) {
320
320
  domain={domain}
321
321
  setCanWeClose={() => {}}
322
322
  initialView={initialView}
323
+ limit={limit}
323
324
  />
324
325
  );
325
326
  }
@@ -34,7 +34,6 @@ type OnRowClickedData = {
34
34
  };
35
35
 
36
36
  type Props = {
37
- action?: string;
38
37
  model?: string;
39
38
  formView?: FormView;
40
39
  treeView?: TreeView;
@@ -50,7 +49,6 @@ type Props = {
50
49
 
51
50
  function SearchTree(props: Props, ref: any) {
52
51
  const {
53
- action,
54
52
  model,
55
53
  formView: formViewProps,
56
54
  treeView: treeViewProps,
@@ -68,18 +66,13 @@ function SearchTree(props: Props, ref: any) {
68
66
  const [initialFetchDone, setInitialFetchDone] = useState<boolean>(false);
69
67
 
70
68
  const searchNameGetDoneRef = useRef(false);
71
- const internalLimit = useRef(80);
72
69
 
73
70
  const [currentModel, setCurrentModel] = useState<string>();
74
71
  const [treeView, setTreeView] = useState<TreeView>();
75
72
  const [formView, setFormView] = useState<FormView>();
76
73
 
77
- const [limitFromAction, setLimitFromAction] = useState<number>();
78
- const [limit, setLimit] = useState<number>(DEFAULT_SEARCH_LIMIT);
79
-
80
74
  const [initialError, setInitialError] = useState<string>();
81
75
 
82
- const actionDomain = useRef<any>([]);
83
76
  const [searchFilterHeight, setSearchFilterHeight] = useState<number>(200);
84
77
 
85
78
  const expandableClickActionData = useRef<any>();
@@ -112,6 +105,8 @@ function SearchTree(props: Props, ref: any) {
112
105
  setTreeIsLoading = undefined,
113
106
  searchValues = {},
114
107
  setSearchValues = undefined,
108
+ limit = DEFAULT_SEARCH_LIMIT,
109
+ setLimit = undefined,
115
110
  } = (rootTree ? actionViewContext : {}) || {};
116
111
 
117
112
  const {
@@ -151,9 +146,8 @@ function SearchTree(props: Props, ref: any) {
151
146
  domain,
152
147
  currentId,
153
148
  setActionViewTotalItems,
154
- limitFromAction,
155
- setLimit,
156
149
  limit,
150
+ setLimit,
157
151
  });
158
152
 
159
153
  useImperativeHandle(ref, () => ({
@@ -172,20 +166,16 @@ function SearchTree(props: Props, ref: any) {
172
166
  searchNameGetDoneRef.current = false;
173
167
  fetchResults();
174
168
  }
175
- }, [page, limit, offset, initialFetchDone, visible, nameSearch]);
169
+ }, [page, offset, initialFetchDone, visible, nameSearch]);
176
170
 
177
- const fetchData = async (type: "action" | "model") => {
171
+ const fetchData = async () => {
178
172
  setInitialFetchDone(false);
179
173
  setIsLoading(true);
180
174
  setInitialError(undefined);
181
175
  setTreeIsLoading?.(true);
182
176
 
183
177
  try {
184
- if (type === "action") {
185
- await fetchActionData();
186
- } else {
187
- await fetchModelData();
188
- }
178
+ await fetchModelData();
189
179
  setInitialFetchDone(true);
190
180
  } catch (error) {
191
181
  setInitialError(error);
@@ -195,20 +185,6 @@ function SearchTree(props: Props, ref: any) {
195
185
  }
196
186
  };
197
187
 
198
- const fetchActionData = async () => {
199
- const dataForAction =
200
- await ConnectionProvider.getHandler().getViewsForAction({
201
- action: action!,
202
- context: parentContext,
203
- });
204
- actionDomain.current = dataForAction.domain;
205
- setFormView(dataForAction.views.get("form"));
206
- setTreeView(dataForAction.views.get("tree"));
207
- setCurrentModel(dataForAction.model);
208
- setLimitFromAction(dataForAction.limit);
209
- setLimit(dataForAction.limit);
210
- };
211
-
212
188
  const fetchModelData = async () => {
213
189
  setCurrentModel(model);
214
190
 
@@ -234,20 +210,14 @@ function SearchTree(props: Props, ref: any) {
234
210
 
235
211
  setFormView(_formView as FormView);
236
212
  setTreeView(_treeView as TreeView);
237
- setLimitFromAction(undefined);
238
- setLimit(DEFAULT_SEARCH_LIMIT);
239
213
  };
240
214
 
241
215
  useEffect(() => {
242
- if (action) {
243
- fetchData("action");
244
- } else if (model) {
245
- fetchData("model");
246
- }
247
- }, [action, model]);
216
+ fetchData();
217
+ }, [model]);
248
218
 
249
219
  const onSearchTreeLimitChange = (newLimit: number) => {
250
- internalLimit.current = newLimit;
220
+ setLimit?.(newLimit);
251
221
  };
252
222
 
253
223
  const treeButOpen = async (record: any) => {
@@ -119,6 +119,7 @@ function Tree(props: Props): React.ReactElement {
119
119
  const treeOoui = useRef<any>(null);
120
120
 
121
121
  const { t } = useContext(LocaleContext) as LocaleContextType;
122
+ const internalLimit = useRef(limit);
122
123
 
123
124
  useEffect(() => {
124
125
  treeOoui.current = getTree(treeView);
@@ -143,9 +144,10 @@ function Tree(props: Props): React.ReactElement {
143
144
  errorInParseColors.current = false;
144
145
  const items = getTableItems(treeOoui.current, results);
145
146
  setItems(items);
147
+ internalLimit.current = limit;
146
148
  }, [results]);
147
149
 
148
- const from = (page - 1) * limit + 1;
150
+ const from = (page - 1) * internalLimit.current + 1;
149
151
  const to = from - 1 + items.length;
150
152
  const summary =
151
153
  total === undefined
@@ -169,7 +171,7 @@ function Tree(props: Props): React.ReactElement {
169
171
  <Col span={12}>
170
172
  <Pagination
171
173
  total={total}
172
- pageSize={limit}
174
+ pageSize={internalLimit.current}
173
175
  current={page}
174
176
  showSizeChanger={false}
175
177
  onChange={onRequestPageChange}