@gisce/react-ooui 1.2.0-rc.83 → 1.2.0-rc.85

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,6 +3,6 @@ import { ButtonGroup as ButtonGroupOoui } from "@gisce/ooui";
3
3
  declare type ButtonGroupProps = {
4
4
  ooui: ButtonGroupOoui;
5
5
  };
6
- export declare const ButtonGroup: (props: ButtonGroupProps) => React.JSX.Element;
6
+ export declare const ButtonGroup: (props: ButtonGroupProps) => React.JSX.Element | null | undefined;
7
7
  export {};
8
8
  //# sourceMappingURL=ButtonGroup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["ButtonGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAIpD,OAAO,EACL,WAAW,IAAI,eAAe,EAG/B,MAAM,aAAa,CAAC;AAQrB,aAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAMF,eAAO,MAAM,WAAW,UAAW,gBAAgB,sBAoElD,CAAC"}
1
+ {"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["ButtonGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAKpD,OAAO,EACL,WAAW,IAAI,eAAe,EAG/B,MAAM,aAAa,CAAC;AAQrB,aAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAQF,eAAO,MAAM,WAAW,UAAW,gBAAgB,yCA2ElD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/react-ooui",
3
- "version": "1.2.0-rc.83",
3
+ "version": "1.2.0-rc.85",
4
4
  "files": [
5
5
  "dist",
6
6
  "src",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@ant-design/plots": "^1.0.9",
35
- "@gisce/ooui": "^0.19.5-rc.1",
35
+ "@gisce/ooui": "^0.19.6",
36
36
  "@gisce/react-formiga-components": "^1.0.9-rc.21",
37
37
  "@gisce/react-formiga-table": "^0.5.0",
38
38
  "@monaco-editor/react": "^4.4.5",
@@ -13,9 +13,8 @@ function SearchBar(props: Props) {
13
13
  const { onSearch, disabled = false, searchText } = props;
14
14
  const { t } = useContext(LocaleContext) as LocaleContextType;
15
15
  const [form] = Form.useForm();
16
- const [mustShowClearSuffix, setMustShowClearSuffix] = useState<boolean>(
17
- false
18
- );
16
+ const [mustShowClearSuffix, setMustShowClearSuffix] =
17
+ useState<boolean>(false);
19
18
 
20
19
  function handleSubmit(values: any) {
21
20
  onSearch(values.search);
@@ -42,6 +41,7 @@ function SearchBar(props: Props) {
42
41
  onChange={(e) => {
43
42
  setMustShowClearSuffix(e.target.value.length > 0);
44
43
  }}
44
+ style={{ borderTopRightRadius: 0, borderBottomRightRadius: 0 }}
45
45
  suffix={
46
46
  (mustShowClearSuffix ||
47
47
  (searchText && searchText.length > 0)) && (
@@ -57,7 +57,11 @@ function SearchBar(props: Props) {
57
57
  </Form.Item>
58
58
  </Col>
59
59
  <Col>
60
- <Button htmlType="submit" disabled={disabled}>
60
+ <Button
61
+ htmlType="submit"
62
+ disabled={disabled}
63
+ style={{ borderTopLeftRadius: 0, borderBottomLeftRadius: 0 }}
64
+ >
61
65
  {t("search")}
62
66
  </Button>
63
67
  </Col>
@@ -257,7 +257,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
257
257
  }
258
258
  />
259
259
  </Col>
260
- <Col flex="32px">
260
+ <Col flex="32px" style={{ paddingRight: 0 }}>
261
261
  <Button
262
262
  icon={<FolderOpenOutlined />}
263
263
  disabled={id === undefined || text === "" || inputText === undefined}
@@ -268,7 +268,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
268
268
  tabIndex={-1}
269
269
  />
270
270
  </Col>
271
- <Col flex="32px">
271
+ <Col flex="32px" style={{ paddingLeft: 0 }}>
272
272
  <Button
273
273
  icon={searching ? <LoadingOutlined /> : <SearchOutlined />}
274
274
  disabled={readOnly || searching}
@@ -2,6 +2,7 @@ import React, { useContext, useState } from "react";
2
2
  import Field from "@/common/Field";
3
3
  import { DownOutlined } from "@ant-design/icons";
4
4
  import { Dropdown, Menu } from "antd";
5
+ import { Button } from "@/widgets/base/Button";
5
6
  import {
6
7
  ButtonGroup as ButtonGroupOoui,
7
8
  Button as ButtonOoui,
@@ -20,6 +21,8 @@ type ButtonGroupProps = {
20
21
 
21
22
  type ItemsProps = {
22
23
  ooui: ButtonOoui[];
24
+ executeButtonAction: any,
25
+ lang: string
23
26
  };
24
27
 
25
28
  export const ButtonGroup = (props: ButtonGroupProps) => {
@@ -73,27 +76,37 @@ export const ButtonGroup = (props: ButtonGroupProps) => {
73
76
 
74
77
  onClick_confirm();
75
78
  }
76
-
77
- return (
78
- <Field ooui={new FieldOoui({ ...{ ooui } })}>
79
- <Dropdown.Button
80
- disabled={!activated || readOnly}
81
- onClick={onClick}
82
- icon={<DownOutlined />}
83
- type={primary ? "primary" : undefined}
84
- //danger={danger ? true : undefined} This works but typescript
85
- // doesn't accept
86
- overlay={Items({ooui: secondaryButtons})}
87
- >
88
- {getButtonIcon()}
89
- {caption}
90
- </Dropdown.Button>
91
- </Field>
92
- );
79
+ if (ooui.buttons.length === 0) {
80
+ return null;
81
+ } else if (ooui.buttons.length > 1) {
82
+ return (
83
+ <Field ooui={new FieldOoui({ ...{ ooui } })}>
84
+ <Dropdown.Button
85
+ disabled={!activated || readOnly}
86
+ onClick={onClick}
87
+ icon={<DownOutlined />}
88
+ type={primary ? "primary" : undefined}
89
+ //danger={danger ? true : undefined} This works but typescript
90
+ // doesn't accept
91
+ overlay={<Items ooui={secondaryButtons} executeButtonAction={executeButtonAction} lang={lang} /> }
92
+ >
93
+ {getButtonIcon()}
94
+ {caption}
95
+ </Dropdown.Button>
96
+ </Field>
97
+ );
98
+ } else if (defaultButton) {
99
+ return (
100
+ <Button ooui={defaultButton} />
101
+ )
102
+ }
93
103
  };
94
104
 
95
105
  const Items = (props: ItemsProps) => {
96
- const { ooui } = props;
106
+ const { ooui, executeButtonAction, lang } = props;
107
+ if (!ooui) {
108
+ return null;
109
+ }
97
110
  const items = ooui.map((button) => {
98
111
  const {
99
112
  id,
@@ -106,10 +119,7 @@ const Items = (props: ItemsProps) => {
106
119
  readOnly,
107
120
  danger,
108
121
  } = button;
109
- const formContext = useContext(FormContext) as FormContextType;
110
- const { executeButtonAction } = formContext || {};
111
122
  const [isRunning, setIsRunning] = useState<boolean>(false);
112
- const { lang } = useContext(LocaleContext) as LocaleContextType;
113
123
 
114
124
  async function onClick_confirm() {
115
125
  setIsRunning(true);