awing-library 2.1.2-dev.527 → 2.1.2-dev.528
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":"Container.d.ts","sourceRoot":"","sources":["../../../src/AWING/AsyncAutocomplete/Container.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../src/AWING/AsyncAutocomplete/Container.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,2CAgO5E"}
|
|
@@ -9,7 +9,7 @@ import { Fragment, useCallback, useEffect, useRef, useState } from "react";
|
|
|
9
9
|
import { useTranslation } from "react-i18next";
|
|
10
10
|
function AsyncAutocomplete(props) {
|
|
11
11
|
const { t } = useTranslation();
|
|
12
|
-
const { multiple, value = null, onChange, fetchOptions, getOptionValue, getOptionLabel, getOptionDisabled, disabled, TextFieldProps, pageSize = 10, required = false, ...other } = props;
|
|
12
|
+
const { multiple, value = null, open, onChange, fetchOptions, getOptionValue, getOptionLabel, getOptionDisabled, disabled, TextFieldProps, pageSize = 10, required = false, ...other } = props;
|
|
13
13
|
const [inputValue, setInputValue] = useState('');
|
|
14
14
|
const [searchString, setSearchString] = useState('');
|
|
15
15
|
const [options, setOptions] = useState([]);
|
|
@@ -18,7 +18,7 @@ function AsyncAutocomplete(props) {
|
|
|
18
18
|
const [hasMore, setHasMore] = useState(true);
|
|
19
19
|
const listboxRef = useRef(null);
|
|
20
20
|
const loadingMoreRef = useRef(false);
|
|
21
|
-
const [
|
|
21
|
+
const [isOpen, setIsOpen] = useState(open ?? false);
|
|
22
22
|
const [fetched, setFetched] = useState(false);
|
|
23
23
|
useEffect(()=>{
|
|
24
24
|
if (value) setInputValue(getOptionLabel(value));
|
|
@@ -55,14 +55,14 @@ function AsyncAutocomplete(props) {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
useEffect(()=>{
|
|
58
|
-
if (!
|
|
58
|
+
if (!isOpen || fetched) return;
|
|
59
59
|
triggerFetchFirstPage(searchString);
|
|
60
60
|
setFetched(true);
|
|
61
61
|
}, [
|
|
62
|
-
|
|
62
|
+
isOpen
|
|
63
63
|
]);
|
|
64
64
|
useEffect(()=>{
|
|
65
|
-
if (!
|
|
65
|
+
if (!isOpen) return;
|
|
66
66
|
triggerFetchFirstPage(searchString);
|
|
67
67
|
}, [
|
|
68
68
|
searchString
|
|
@@ -109,9 +109,9 @@ function AsyncAutocomplete(props) {
|
|
|
109
109
|
getOptionValue
|
|
110
110
|
]);
|
|
111
111
|
return /*#__PURE__*/ jsx(Autocomplete, {
|
|
112
|
-
open:
|
|
113
|
-
onOpen: ()=>
|
|
114
|
-
onClose: ()=>
|
|
112
|
+
open: isOpen,
|
|
113
|
+
onOpen: ()=>setIsOpen(true),
|
|
114
|
+
onClose: ()=>setIsOpen(false),
|
|
115
115
|
multiple: multiple,
|
|
116
116
|
getOptionLabel: (option)=>'string' == typeof option ? option : getOptionLabel(option),
|
|
117
117
|
options: options,
|
|
@@ -6,7 +6,7 @@ import { fireEvent, render, screen } from "@testing-library/react";
|
|
|
6
6
|
import { Constants } from "../../Commons/Constant.js";
|
|
7
7
|
import container from "./container.js";
|
|
8
8
|
var __webpack_modules__ = {
|
|
9
|
-
"
|
|
9
|
+
"AWING/DataInput": function(module) {
|
|
10
10
|
module.exports = __WEBPACK_EXTERNAL_MODULE__DataInput_index_js_c7933a4f__;
|
|
11
11
|
},
|
|
12
12
|
"../helper": function(module) {
|
|
@@ -23,7 +23,7 @@ function __webpack_require__(moduleId) {
|
|
|
23
23
|
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
24
24
|
return module.exports;
|
|
25
25
|
}
|
|
26
|
-
var index_js_ = __webpack_require__("
|
|
26
|
+
var index_js_ = __webpack_require__("AWING/DataInput");
|
|
27
27
|
jest.mock('../DataInput', ()=>({
|
|
28
28
|
__esModule: true,
|
|
29
29
|
default: jest.fn(),
|
|
@@ -91,7 +91,7 @@ jest.mock('@mui/material', ()=>({
|
|
|
91
91
|
children: children
|
|
92
92
|
})
|
|
93
93
|
}));
|
|
94
|
-
const mockInputFactory = __webpack_require__("
|
|
94
|
+
const mockInputFactory = __webpack_require__("AWING/DataInput")["default"];
|
|
95
95
|
const mockCalculateValue = __webpack_require__("../helper").calculateValue;
|
|
96
96
|
const mockConvertFormulaToBinaryTree = __webpack_require__("../helper").convertFormulaToBinaryTree;
|
|
97
97
|
const mockReplaceFieldsValue = __webpack_require__("../helper").replaceFieldsValue;
|
|
@@ -5,7 +5,7 @@ import { act, fireEvent, render, screen, waitFor } from "@testing-library/react"
|
|
|
5
5
|
import containerOptimized from "./containerOptimized.js";
|
|
6
6
|
import { createFormStateManager } from "./formStateManager.js";
|
|
7
7
|
var __webpack_modules__ = {
|
|
8
|
-
"
|
|
8
|
+
"AWING/DataInput": function(module) {
|
|
9
9
|
module.exports = __WEBPACK_EXTERNAL_MODULE__DataInput_index_js_c7933a4f__;
|
|
10
10
|
}
|
|
11
11
|
};
|
|
@@ -98,7 +98,7 @@ jest.mock('@mui/material', ()=>({
|
|
|
98
98
|
children: children
|
|
99
99
|
})
|
|
100
100
|
}));
|
|
101
|
-
const mockInputFactory = __webpack_require__("
|
|
101
|
+
const mockInputFactory = __webpack_require__("AWING/DataInput")["default"];
|
|
102
102
|
describe('DataForm Optimized - Performance Tests', ()=>{
|
|
103
103
|
let inputRenderCounts = {};
|
|
104
104
|
const mockFields = [
|