awing-library 2.1.2-dev.527 → 2.1.2-dev.529
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.
- package/dist/AWING/AsyncAutocomplete/Container.d.ts.map +1 -1
- package/dist/AWING/AsyncAutocomplete/Container.js +8 -8
- package/dist/AWING/DataForm/container.test.js +7 -7
- package/dist/AWING/DataForm2/containerOptimized.test.js +2 -2
- package/dist/AWING/MultipleChoice/component.d.ts.map +1 -1
- package/dist/AWING/MultipleChoice/component.js +14 -7
- package/dist/AWING/MultipleHierarchicalChoice/component.d.ts.map +1 -1
- package/dist/AWING/MultipleHierarchicalChoice/component.js +8 -5
- package/dist/AWING/PlaceFilter/Input/AreaSelectField/component.d.ts.map +1 -1
- package/dist/AWING/PlaceFilter/Input/AreaSelectField/component.js +11 -12
- package/dist/AWING/PlaceFilter/Tag/component/utils.d.ts +1 -6
- package/dist/AWING/PlaceFilter/Tag/component/utils.d.ts.map +1 -1
- package/dist/AWING/PlaceFilter/Tag/component/utils.js +11 -14
- package/package.json +1 -1
|
@@ -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,10 +6,10 @@ 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
|
+
"AWING/helper": function(module) {
|
|
13
13
|
module.exports = __WEBPACK_EXTERNAL_MODULE__helper_js_663c9e82__;
|
|
14
14
|
}
|
|
15
15
|
};
|
|
@@ -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,10 +91,10 @@ jest.mock('@mui/material', ()=>({
|
|
|
91
91
|
children: children
|
|
92
92
|
})
|
|
93
93
|
}));
|
|
94
|
-
const mockInputFactory = __webpack_require__("
|
|
95
|
-
const mockCalculateValue = __webpack_require__("
|
|
96
|
-
const mockConvertFormulaToBinaryTree = __webpack_require__("
|
|
97
|
-
const mockReplaceFieldsValue = __webpack_require__("
|
|
94
|
+
const mockInputFactory = __webpack_require__("AWING/DataInput")["default"];
|
|
95
|
+
const mockCalculateValue = __webpack_require__("AWING/helper").calculateValue;
|
|
96
|
+
const mockConvertFormulaToBinaryTree = __webpack_require__("AWING/helper").convertFormulaToBinaryTree;
|
|
97
|
+
const mockReplaceFieldsValue = __webpack_require__("AWING/helper").replaceFieldsValue;
|
|
98
98
|
describe('DataForm Component', ()=>{
|
|
99
99
|
const mockFields = [
|
|
100
100
|
{
|
|
@@ -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 = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/AWING/MultipleChoice/component.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,6BAA6B,EAAW,MAAM,aAAa,CAAC;AAarE,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,KAAK,EAAE,6BAA6B,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/AWING/MultipleChoice/component.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,6BAA6B,EAAW,MAAM,aAAa,CAAC;AAarE,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,KAAK,EAAE,6BAA6B,2CAwHnF"}
|
|
@@ -15,14 +15,17 @@ const useStyles = makeStyles({
|
|
|
15
15
|
function MultipleChoiceComponent(props) {
|
|
16
16
|
const classes = useStyles();
|
|
17
17
|
const { label, selected, options, onChange, popupOpen = true, onOpen, onClose, variant, placeholder, error, helperText, operators, operator, onOperatorChange } = props;
|
|
18
|
-
const renderTags = (options, getTagProps)=>options.map((option, i)
|
|
18
|
+
const renderTags = (options, getTagProps)=>options.map((option, i)=>{
|
|
19
|
+
const { key, ...tagProps } = getTagProps({
|
|
20
|
+
index: i
|
|
21
|
+
});
|
|
22
|
+
return /*#__PURE__*/ jsx(Chip, {
|
|
19
23
|
label: option.name,
|
|
20
24
|
title: option.name,
|
|
21
25
|
size: "small",
|
|
22
|
-
...
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}));
|
|
26
|
+
...tagProps
|
|
27
|
+
}, key);
|
|
28
|
+
});
|
|
26
29
|
const renderInput = (params)=>/*#__PURE__*/ jsxs(Box, {
|
|
27
30
|
style: {
|
|
28
31
|
position: 'relative'
|
|
@@ -71,8 +74,10 @@ function MultipleChoiceComponent(props) {
|
|
|
71
74
|
})
|
|
72
75
|
]
|
|
73
76
|
});
|
|
74
|
-
const renderOption = (props, option, { selected })
|
|
75
|
-
|
|
77
|
+
const renderOption = (props, option, { selected })=>{
|
|
78
|
+
const { key: _key, ...optionProps } = props;
|
|
79
|
+
return /*#__PURE__*/ createElement(Box, {
|
|
80
|
+
...optionProps,
|
|
76
81
|
component: "li",
|
|
77
82
|
key: option.id,
|
|
78
83
|
style: {
|
|
@@ -90,6 +95,7 @@ function MultipleChoiceComponent(props) {
|
|
|
90
95
|
})
|
|
91
96
|
]
|
|
92
97
|
});
|
|
98
|
+
};
|
|
93
99
|
return /*#__PURE__*/ jsx(Autocomplete, {
|
|
94
100
|
className: operator ? classes.hideIndicator : '',
|
|
95
101
|
size: "small",
|
|
@@ -100,6 +106,7 @@ function MultipleChoiceComponent(props) {
|
|
|
100
106
|
onChange: onChange,
|
|
101
107
|
value: selected,
|
|
102
108
|
getOptionLabel: (option)=>option.name,
|
|
109
|
+
getOptionKey: (option)=>option.id,
|
|
103
110
|
isOptionEqualToValue: (option, value)=>option?.id === value?.id,
|
|
104
111
|
renderTags: renderTags,
|
|
105
112
|
renderInput: renderInput,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/AWING/MultipleHierarchicalChoice/component.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAoC,wCAAwC,EAAE,MAAM,aAAa,CAAC;AAazG,iBAAS,mCAAmC,CAAC,KAAK,EAAE,wCAAwC,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/AWING/MultipleHierarchicalChoice/component.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAoC,wCAAwC,EAAE,MAAM,aAAa,CAAC;AAazG,iBAAS,mCAAmC,CAAC,KAAK,EAAE,wCAAwC,2CAiI3F;AAED,eAAe,mCAAmC,CAAC"}
|
|
@@ -23,14 +23,17 @@ function MultipleHierarchicalChoiceComponent(props) {
|
|
|
23
23
|
});
|
|
24
24
|
return result;
|
|
25
25
|
};
|
|
26
|
-
const renderTags = (options, getTagProps)=>options.map((option, i)
|
|
26
|
+
const renderTags = (options, getTagProps)=>options.map((option, i)=>{
|
|
27
|
+
const { key, ...tagProps } = getTagProps({
|
|
28
|
+
index: i
|
|
29
|
+
});
|
|
30
|
+
return /*#__PURE__*/ jsx(Chip, {
|
|
27
31
|
label: getTagName(option),
|
|
28
32
|
title: getTagName(option),
|
|
29
33
|
size: "small",
|
|
30
|
-
...
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}));
|
|
34
|
+
...tagProps
|
|
35
|
+
}, key);
|
|
36
|
+
});
|
|
34
37
|
const renderInput = (params)=>/*#__PURE__*/ jsxs(Box, {
|
|
35
38
|
style: {
|
|
36
39
|
position: 'relative'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../../src/AWING/PlaceFilter/Input/AreaSelectField/component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEH,iBAAiB,EAOpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAC;AACpF,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../../src/AWING/PlaceFilter/Input/AreaSelectField/component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEH,iBAAiB,EAOpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAC;AACpF,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAC1C,iBAAiB,CAAC,gCAAgC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,UAAU,CAAC,CACtF,CAAC;AACF,UAAU,6BAA6B;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,gCAAgC,EAAE,CAAC;IAC5C,YAAY,EAAE,gCAAgC,EAAE,CAAC;IACjD,QAAQ,EAAE,oBAAoB,CAAC;CAClC;AAMD,QAAA,MAAM,wBAAwB,EAAE,EAAE,CAAC,6BAA6B,CA8C/D,CAAC;AACF,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment, createElement } from "react";
|
|
3
2
|
import { Autocomplete, Chip, ListSubheader, TextField } from "@mui/material";
|
|
4
|
-
const renderTags = (options, getTagProps)=>options.map((option, i)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
const renderTags = (options, getTagProps)=>options.map((option, i)=>{
|
|
4
|
+
const { key, ...tagProps } = getTagProps({
|
|
5
|
+
index: i
|
|
6
|
+
});
|
|
7
|
+
return /*#__PURE__*/ jsx(Chip, {
|
|
8
|
+
label: option.name,
|
|
9
|
+
title: option.name,
|
|
10
|
+
size: "small",
|
|
11
|
+
...tagProps
|
|
12
|
+
}, key);
|
|
13
|
+
});
|
|
15
14
|
const AreaSelectFieldComponent = (props)=>{
|
|
16
15
|
const { label, placeholder, options, areaSelected, onChange } = props;
|
|
17
16
|
const renderInput = (params)=>/*#__PURE__*/ jsx(TextField, {
|
|
@@ -4,10 +4,5 @@ export declare const CustomSpan: import("@emotion/styled").StyledComponent<{
|
|
|
4
4
|
as?: React.ElementType;
|
|
5
5
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
6
6
|
export declare const getTagInputDetail: ((tag: ITag) => import("react").FunctionComponentElement<import("@mui/material/OverridableComponent").DefaultComponentProps<import("@mui/material").TypographyTypeMap<{}, "span">>>[]) & import("lodash").MemoizedFunction;
|
|
7
|
-
export declare const getTagTitle: (tag: ITag, numOfPreviousPlaces: number) => import("react").DetailedReactHTMLElement<
|
|
8
|
-
children: (string | import("react").FunctionComponentElement<{
|
|
9
|
-
theme?: import("@emotion/react").Theme;
|
|
10
|
-
as?: React.ElementType;
|
|
11
|
-
} & import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>>)[];
|
|
12
|
-
}, HTMLElement>;
|
|
7
|
+
export declare const getTagTitle: (tag: ITag, numOfPreviousPlaces: number) => import("react").DetailedReactHTMLElement<import("react").HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
13
8
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/AWING/PlaceFilter/Tag/component/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,IAAI,EAAE,MAAM,6BAA6B,CAAC;AASjE,eAAO,MAAM,UAAU;;SAEL,MAElB,WAAW;2GADV,CAAC;AAsDF,eAAO,MAAM,iBAAiB,SAAiB,IAAI,+MAmBjD,CAAC;AACH,eAAO,MAAM,WAAW,QAAS,IAAI,uBAAuB,MAAM
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/AWING/PlaceFilter/Tag/component/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,IAAI,EAAE,MAAM,6BAA6B,CAAC;AASjE,eAAO,MAAM,UAAU;;SAEL,MAElB,WAAW;2GADV,CAAC;AAsDF,eAAO,MAAM,iBAAiB,SAAiB,IAAI,+MAmBjD,CAAC;AACH,eAAO,MAAM,WAAW,QAAS,IAAI,uBAAuB,MAAM,uGA4EjE,CAAC"}
|
|
@@ -128,20 +128,17 @@ const getTagTitle = (tag, numOfPreviousPlaces)=>{
|
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
title = (title.length >= MAX_TAG_TITLE_LENGTH ? `${title.slice(0, MAX_TAG_TITLE_LENGTH - 1)}...` : title) || 'ALL';
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
color: NEGATIVE_COLOR,
|
|
142
|
-
children: `${numOfPlaces} (-${numOfPreviousPlaces - numOfPlaces})`
|
|
143
|
-
})
|
|
144
|
-
]
|
|
131
|
+
let placeCountNode;
|
|
132
|
+
placeCountNode = numOfPreviousPlaces === numOfPlaces ? createElement(CustomSpan, {
|
|
133
|
+
color: NORMAL_COLOR,
|
|
134
|
+
children: numOfPlaces
|
|
135
|
+
}) : numOfPreviousPlaces < numOfPlaces ? createElement(CustomSpan, {
|
|
136
|
+
color: POSITIVE_COLOR,
|
|
137
|
+
children: `${numOfPlaces} (+${numOfPlaces - numOfPreviousPlaces})`
|
|
138
|
+
}) : createElement(CustomSpan, {
|
|
139
|
+
color: NEGATIVE_COLOR,
|
|
140
|
+
children: `${numOfPlaces} (-${numOfPreviousPlaces - numOfPlaces})`
|
|
145
141
|
});
|
|
142
|
+
return createElement('span', null, `${title}: `, placeCountNode);
|
|
146
143
|
};
|
|
147
144
|
export { CustomSpan, getTagInputDetail, getTagTitle };
|