@etsoo/react 1.4.78 → 1.4.79

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.
@@ -2,6 +2,7 @@ import { Keyboard } from '@etsoo/shared';
2
2
  import { Autocomplete } from '@mui/material';
3
3
  import React from 'react';
4
4
  import { Utils } from '../app/Utils';
5
+ import { Utils as SharedUtils } from '@etsoo/shared';
5
6
  import { InputField } from './InputField';
6
7
  import { SearchField } from './SearchField';
7
8
  /**
@@ -81,6 +82,9 @@ export function ComboBox(props) {
81
82
  return;
82
83
  if (onLoadData)
83
84
  onLoadData(result);
85
+ if (search) {
86
+ SharedUtils.addBlankItem(result, idField, labelField);
87
+ }
84
88
  setOptions(result);
85
89
  });
86
90
  }
@@ -1,3 +1,4 @@
1
+ import { Utils } from '@etsoo/shared';
1
2
  import React from 'react';
2
3
  import { globalApp } from '..';
3
4
  import { SelectEx } from './SelectEx';
@@ -15,7 +16,7 @@ export function SelectBool(props) {
15
16
  { id: 'true', label: globalApp.get('yes') }
16
17
  ];
17
18
  if (search)
18
- options.unshift({ id: '', label: '---' });
19
+ Utils.addBlankItem(options);
19
20
  // Layout
20
21
  return React.createElement(SelectEx, { options: options, search: search, ...rest });
21
22
  }
@@ -3,6 +3,7 @@ import { Checkbox, FormControl, InputLabel, ListItemText, MenuItem, OutlinedInpu
3
3
  import React from 'react';
4
4
  import { MUGlobal } from './MUGlobal';
5
5
  import { ListItemRightIcon } from './ListItemRightIcon';
6
+ import { Utils } from '@etsoo/shared';
6
7
  /**
7
8
  * Extended select component
8
9
  * @param props Props
@@ -96,6 +97,9 @@ export function SelectEx(props) {
96
97
  return;
97
98
  if (onLoadData)
98
99
  onLoadData(result);
100
+ if (search) {
101
+ Utils.addBlankItem(result, idField, labelField);
102
+ }
99
103
  setOptions(result);
100
104
  });
101
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.4.78",
3
+ "version": "1.4.79",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -50,9 +50,9 @@
50
50
  "@emotion/react": "^11.7.1",
51
51
  "@emotion/style": "^0.8.0",
52
52
  "@emotion/styled": "^11.6.0",
53
- "@etsoo/appscript": "^1.2.28",
53
+ "@etsoo/appscript": "^1.2.29",
54
54
  "@etsoo/notificationbase": "^1.1.0",
55
- "@etsoo/shared": "^1.1.7",
55
+ "@etsoo/shared": "^1.1.9",
56
56
  "@mui/icons-material": "^5.3.1",
57
57
  "@mui/material": "^5.3.1",
58
58
  "@reach/router": "^1.3.4",
@@ -85,7 +85,7 @@
85
85
  "@types/react-test-renderer": "^17.0.1",
86
86
  "@typescript-eslint/eslint-plugin": "^5.10.1",
87
87
  "@typescript-eslint/parser": "^5.10.1",
88
- "eslint": "^8.7.0",
88
+ "eslint": "^8.8.0",
89
89
  "eslint-config-airbnb-base": "^15.0.0",
90
90
  "eslint-plugin-import": "^2.25.4",
91
91
  "eslint-plugin-react": "^7.28.0",
@@ -3,6 +3,7 @@ import { Keyboard } from '@etsoo/shared';
3
3
  import { Autocomplete, AutocompleteRenderInputParams } from '@mui/material';
4
4
  import React from 'react';
5
5
  import { Utils } from '../app/Utils';
6
+ import { Utils as SharedUtils } from '@etsoo/shared';
6
7
  import { AutocompleteExtendedProps } from './AutocompleteExtendedProps';
7
8
  import { InputField } from './InputField';
8
9
  import { SearchField } from './SearchField';
@@ -155,6 +156,9 @@ export function ComboBox<T extends {} = IdLabelDto>(props: ComboBoxProps<T>) {
155
156
  loadData().then((result) => {
156
157
  if (result == null || !isMounted.current) return;
157
158
  if (onLoadData) onLoadData(result);
159
+ if (search) {
160
+ SharedUtils.addBlankItem(result, idField, labelField);
161
+ }
158
162
  setOptions(result);
159
163
  });
160
164
  }
@@ -1,4 +1,5 @@
1
1
  import { IdLabelDto } from '@etsoo/appscript';
2
+ import { Utils } from '@etsoo/shared';
2
3
  import React from 'react';
3
4
  import { globalApp } from '..';
4
5
  import { SelectEx, SelectExProps } from './SelectEx';
@@ -24,7 +25,7 @@ export function SelectBool(props: SelectBoolProps) {
24
25
  { id: 'true', label: globalApp.get('yes')! }
25
26
  ];
26
27
 
27
- if (search) options.unshift({ id: '', label: '---' });
28
+ if (search) Utils.addBlankItem(options);
28
29
 
29
30
  // Layout
30
31
  return <SelectEx options={options} search={search} {...rest} />;
@@ -14,6 +14,7 @@ import React from 'react';
14
14
  import { MUGlobal } from './MUGlobal';
15
15
  import { IdLabelDto } from '@etsoo/appscript';
16
16
  import { ListItemRightIcon } from './ListItemRightIcon';
17
+ import { Utils } from '@etsoo/shared';
17
18
 
18
19
  /**
19
20
  * Extended select component props
@@ -171,6 +172,9 @@ export function SelectEx<T extends {} = IdLabelDto>(props: SelectExProps<T>) {
171
172
  loadData().then((result) => {
172
173
  if (result == null || !isMounted.current) return;
173
174
  if (onLoadData) onLoadData(result);
175
+ if (search) {
176
+ Utils.addBlankItem(result, idField, labelField);
177
+ }
174
178
  setOptions(result);
175
179
  });
176
180
  }