@gisce/react-ooui 1.2.0-rc.74 → 1.2.0-rc.76

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":"Markdown.d.ts","sourceRoot":"","sources":["Markdown.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEpC,eAAQ,MAAM,QAAQ,UAAW,WAAW,gBAM3C,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,GAAG,gBAKvC,CAAA"}
1
+ {"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["Markdown.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEpC,eAAQ,MAAM,QAAQ,UAAW,WAAW,gBAM3C,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,GAAG,gBAQvC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/react-ooui",
3
- "version": "1.2.0-rc.74",
3
+ "version": "1.2.0-rc.76",
4
4
  "files": [
5
5
  "dist",
6
6
  "src",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@ant-design/plots": "^1.0.9",
39
- "@gisce/ooui": "^0.19.2-rc.1",
39
+ "@gisce/ooui": "^0.19.4",
40
40
  "@gisce/react-formiga-components": "^1.0.9-rc.20",
41
41
  "@gisce/react-formiga-table": "^0.5.0",
42
42
  "@monaco-editor/react": "^4.4.5",
@@ -57,9 +57,7 @@ function ChangeViewButton(props: Props) {
57
57
  {getIconForView(view)}
58
58
  </Col>
59
59
  <Col flex="auto" style={{ paddingRight: 20 }}>
60
- {view.type === "graph"
61
- ? (view as GraphView).name
62
- : view.type.charAt(0).toUpperCase() + view.type.slice(1)}
60
+ {view.type.charAt(0).toUpperCase() + view.type.slice(1)}
63
61
  </Col>
64
62
  <Col flex="none">
65
63
  <CheckOutlined
@@ -1,4 +1,4 @@
1
- import { FormView, GenerateReportOptions } from "@/types";
1
+ import { FormView, GenerateReportOptions, ViewType } from "@/types";
2
2
  import React, {
3
3
  useContext,
4
4
  useRef,
@@ -261,33 +261,12 @@ const ContentRootProvider = (
261
261
 
262
262
  return {};
263
263
  } else {
264
- let initialView;
265
- const viewTypes = actionData.view_mode.split(",");
266
- const views = [];
267
-
268
- for (const viewType of viewTypes) {
269
- const viewData = await ConnectionProvider.getHandler().getView({
270
- model: actionData.res_model,
271
- type: viewType,
272
- context: mergedContext,
273
- });
274
- views.push([viewData.view_id, viewType]);
275
- }
276
-
277
- if (!actionData.view_id) {
278
- const type = actionData.view_mode.split(",")[0];
279
-
280
- const [retrievedViewId] = views.find(
281
- ([_, viewType]) => viewType === type
282
- )!;
283
-
284
- initialView = { id: retrievedViewId, type };
285
- } else {
286
- initialView = {
287
- id: actionData.view_id,
288
- type: actionData.view_mode.split(",")[0],
289
- };
290
- }
264
+ const { initialView, views } = await getViewsAndInitialView({
265
+ model: actionData.res_model,
266
+ context: mergedContext,
267
+ view_mode: actionData.view_mode,
268
+ views: actionData.views,
269
+ });
291
270
 
292
271
  openAction?.({
293
272
  target: "current",
@@ -415,4 +394,61 @@ const ContentRootProvider = (
415
394
  );
416
395
  };
417
396
 
397
+ async function getViewsAndInitialView({
398
+ views,
399
+ view_mode,
400
+ model,
401
+ context,
402
+ view_id,
403
+ }: {
404
+ views: any[];
405
+ view_mode: string;
406
+ model: string;
407
+ context: any;
408
+ view_id?: number;
409
+ }) {
410
+ const retriedViewData = [];
411
+ let initialView;
412
+
413
+ if (views) {
414
+ for (const view of views) {
415
+ const viewData = await ConnectionProvider.getHandler().getView({
416
+ model,
417
+ type: view[1],
418
+ id: view[0],
419
+ context,
420
+ });
421
+ retriedViewData.push([viewData.view_id, view[1]]);
422
+ }
423
+ } else {
424
+ const viewTypes = view_mode.split(",");
425
+ for (const viewType of viewTypes) {
426
+ const viewData = await ConnectionProvider.getHandler().getView({
427
+ model,
428
+ type: viewType as ViewType,
429
+ context,
430
+ });
431
+ retriedViewData.push([viewData.view_id, viewType]);
432
+ }
433
+ }
434
+ if (views && views.length > 0) {
435
+ const [id, type] = views[0];
436
+ initialView = {
437
+ id,
438
+ type,
439
+ };
440
+ } else if (!view_id) {
441
+ const type = view_mode.split(",")[0];
442
+ const [retrievedViewId] = views.find(([_, viewType]) => viewType === type)!;
443
+ initialView = { id: retrievedViewId, type };
444
+ } else {
445
+ initialView = {
446
+ id: view_id,
447
+ type: view_mode.split(",")[0],
448
+ };
449
+ }
450
+
451
+ return { views: retriedViewData, initialView };
452
+ }
453
+
418
454
  export default forwardRef(ContentRootProvider);
@@ -77,7 +77,7 @@ export const LabelH1 = (): React.ReactElement => {
77
77
  const ooui = new LabelOoui({
78
78
  name: "field",
79
79
  string: "Lorem ipsum",
80
- widget_props: "{'label_size': 'h1'}",
80
+ widget_props: "{'label_size': 1}",
81
81
  });
82
82
  return (
83
83
  <LocaleProvider lang="en_US">
@@ -90,7 +90,7 @@ export const LabelH2Warning = (): React.ReactElement => {
90
90
  const ooui = new LabelOoui({
91
91
  name: "field",
92
92
  string: "Lorem ipsum",
93
- widget_props: "{'label_size': 'h1', 'label_type': 'warning'}",
93
+ widget_props: "{'label_size': 2, 'label_type': 'warning'}",
94
94
  });
95
95
  return (
96
96
  <LocaleProvider lang="en_US">
@@ -26,7 +26,7 @@ const Label = (props: Props) => {
26
26
  const responsiveAlign = responsiveBehaviour ? "left" : "right";
27
27
  const labelAlgin = align ? align : fieldForLabel ? responsiveAlign : "left";
28
28
 
29
- const TextType = labelSize === "text" ? Text : Title;
29
+ const TextType = labelSize === undefined ? Text : Title;
30
30
 
31
31
  return (
32
32
  <div
@@ -39,7 +39,7 @@ const Label = (props: Props) => {
39
39
  )}
40
40
  <span className="pr-2">
41
41
  <TextType
42
- level={labelSize !== "text" ? (labelSize as string as any) : null}
42
+ level={labelSize}
43
43
  type={labelType as any}
44
44
  >
45
45
  <Interweave content={labelText} />
@@ -12,8 +12,11 @@ export const Markdown = (props: WidgetProps) => {
12
12
  };
13
13
 
14
14
  export const MarkdownInput = (props: any) => {
15
- const {value} = props;
15
+ const {value, ooui} = props;
16
16
  return (
17
- <ReactMarkdown children={value}/>
17
+ <div style={{height: ooui.height ? ooui.height + 'px' : '100%'}}>
18
+ <ReactMarkdown children={value} className="ant-typography"/>
19
+ </div>
20
+
18
21
  )
19
- }
22
+ }