@gisce/react-ooui 1.4.0-rc.0 → 1.4.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["Tree.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAE,QAAQ,EAAU,MAAM,SAAS,CAAC;AAwB3C,aAAK,KAAK,GAAG;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACrC,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC7C,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC7C,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,wBAAwB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO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,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA8GF,iBAAS,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,YAAY,CAqN9C;AAED,eAAe,IAAI,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/react-ooui",
3
- "version": "1.4.0-rc.0",
3
+ "version": "1.4.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "src",
@@ -1,5 +1,5 @@
1
1
  import React, { useContext, useState } from "react";
2
- import { Space, Spin } from "antd";
2
+ import { Space } from "antd";
3
3
  import ChangeViewButton from "./ChangeViewButton";
4
4
  import {
5
5
  ActionViewContext,
@@ -151,13 +151,6 @@ function TreeActionBar(props: Props) {
151
151
 
152
152
  return (
153
153
  <Space wrap={true}>
154
- {treeIsLoading && (
155
- <>
156
- <Spin />
157
- {separator()}
158
- {separator()}
159
- </>
160
- )}
161
154
  {treeExpandable ? null : (
162
155
  <>
163
156
  <SearchBar
@@ -107,7 +107,13 @@ export const useSearch = (opts: UseSearchOpts) => {
107
107
  });
108
108
 
109
109
  const { colors, status } = getTree(treeView!);
110
- console.log(colors, status);
110
+ const attrs: any = {};
111
+ if (colors) {
112
+ attrs.colors = colors;
113
+ }
114
+ if (status) {
115
+ attrs.status = status;
116
+ }
111
117
 
112
118
  const resultsWithData =
113
119
  await ConnectionProvider.getHandler().readEvalUiObjects({
@@ -118,10 +124,7 @@ export const useSearch = (opts: UseSearchOpts) => {
118
124
  ? { ...treeView!.fields, [treeView!.field_parent]: {} }
119
125
  : treeView!.fields,
120
126
  context,
121
- attrs: {
122
- colors,
123
- status,
124
- },
127
+ attrs,
125
128
  });
126
129
  const resultsData = resultsWithData[0];
127
130
 
@@ -173,7 +176,14 @@ export const useSearch = (opts: UseSearchOpts) => {
173
176
  const { params, newOffset } = opts || {};
174
177
 
175
178
  const mergedParams = mergeParams(params || searchParams, domain);
176
- const { colors, status } = getTree(treeView!);
179
+ const { colors, status } = getTree(treeView!); const attrs: any = {};
180
+ if (colors) {
181
+ attrs.colors = colors;
182
+ }
183
+ if (status) {
184
+ attrs.status = status;
185
+ }
186
+
177
187
 
178
188
  const { totalItems, results, attrsEvaluated } =
179
189
  await ConnectionProvider.getHandler().searchForTree({
@@ -185,7 +195,7 @@ export const useSearch = (opts: UseSearchOpts) => {
185
195
  ? { ...treeView!.fields, [treeView!.field_parent]: {} }
186
196
  : treeView!.fields,
187
197
  context,
188
- attrs: { colors, status },
198
+ attrs,
189
199
  });
190
200
  setColorsForResults(getColorMap(attrsEvaluated));
191
201
  setStatusForResults(getStatusMap(attrsEvaluated));
@@ -283,7 +293,6 @@ export const useSearch = (opts: UseSearchOpts) => {
283
293
 
284
294
  const changeSort = useCallback(
285
295
  (newSorter: any) => {
286
- if (JSON.stringify(newSorter) === JSON.stringify(sorter)) return;
287
296
  setSorter?.(newSorter);
288
297
  const sortedResults =
289
298
  newSorter !== undefined
@@ -182,9 +182,9 @@ function SearchTree(props: Props, ref: any) {
182
182
  setInitialFetchDone(true);
183
183
  } catch (error) {
184
184
  setInitialError(error);
185
- setTreeIsLoading?.(false);
186
185
  } finally {
187
186
  setIsLoading(false);
187
+ setTreeIsLoading?.(false);
188
188
  }
189
189
  };
190
190
 
@@ -118,7 +118,7 @@ const imageComponent = (value: string): React.ReactElement => {
118
118
  };
119
119
 
120
120
  const TagComponent = (
121
- value: any,
121
+ value: any,
122
122
  key: string,
123
123
  ooui: any,
124
124
  context: any
@@ -127,12 +127,14 @@ const TagComponent = (
127
127
  };
128
128
 
129
129
  const SelectionComponent = (
130
- value: any,
130
+ value: any,
131
131
  key: string,
132
132
  ooui: any,
133
133
  context: any
134
134
  ): React.ReactElement => {
135
- return <>{ooui.selectionValues.get(value)}</>;
135
+ return (
136
+ <>{ooui.selectionValues.get(value)}</>
137
+ );
136
138
  };
137
139
 
138
140
  const referenceComponent = (
@@ -152,12 +154,9 @@ const referenceComponent = (
152
154
  );
153
155
  };
154
156
 
155
- const AvatarFn = (
156
- value: any,
157
- key: string,
158
- ooui: any,
159
- context: any
160
- ): React.ReactElement => <Avatar ooui={ooui} value={value} />;
157
+ const AvatarFn = (value: any, key:string, ooui: any, context: any): React.ReactElement => (
158
+ <Avatar ooui={ooui} value={value} />
159
+ )
161
160
 
162
161
  function Tree(props: Props): React.ReactElement {
163
162
  const {
@@ -309,7 +308,9 @@ function Tree(props: Props): React.ReactElement {
309
308
  summary.push(`${sumField.label}: ${Math.round(total * 100) / 100}`);
310
309
  });
311
310
 
312
- return <div className="p-1 pb-0 pl-2 mt-2 ">{summary.join(", ")}</div>;
311
+ return (
312
+ <div className="p-1 pb-0 pl-2 mt-2 ">{summary.join(", ")}</div>
313
+ );
313
314
  }
314
315
 
315
316
  let dataTable;
@@ -332,12 +333,11 @@ function Tree(props: Props): React.ReactElement {
332
333
  ) : (
333
334
  <div>
334
335
  {pagination()}
335
- {loading && <Spin className="pb-4" />}
336
336
  <GisceTable
337
337
  height={adjustedHeight!}
338
338
  columns={dataTable.columns}
339
339
  dataSource={items}
340
- loading={false}
340
+ loading={loading}
341
341
  loadingComponent={<Spin />}
342
342
  onRowStyle={(record: any) => {
343
343
  if (colorsForResults![record.id]) {