react-core-ts 1.8.6 → 1.8.8
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/README.md +1 -0
- package/dist/AutoCompleteWithSelectedList.js +19 -19
- package/dist/AutoCompleteWithSelectedList.js.map +1 -1
- package/dist/ReactCheckbox.js +1 -1
- package/dist/ReactCheckbox.js.map +1 -1
- package/dist/commontypes.d.ts +1 -0
- package/dist/styles/styles/components/autocomplete.css +688 -0
- package/dist/styles/styles/components/selectedautocomplete.css +130 -0
- package/dist/styles/styles/components/tooltip.css +497 -0
- package/dist/styles/styles/components/treedropdown.css +97 -0
- package/dist/styles/styles/global.css +8 -0
- package/dist/utilities/filterSuggestions.d.ts +1 -1
- package/dist/utilities/filterSuggestions.js +8 -6
- package/dist/utilities/filterSuggestions.js.map +1 -1
- package/package.json +1 -1
- package/src/AutoCompleteWithSelectedList.tsx +3 -1
- package/src/ReactCheckbox.tsx +11 -13
- package/src/commontypes.ts +1 -0
- package/src/utilities/filterSuggestions.ts +8 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
interface Item {
|
|
2
2
|
[key: string]: string;
|
|
3
3
|
}
|
|
4
|
-
export declare const filterSuggestions: (data: Item[], query: string, type: string, desc: string, inputValue?: any[] | string, async?: boolean, isTreeDropdown?: boolean, withoutSort?: boolean) => Item[];
|
|
4
|
+
export declare const filterSuggestions: (data: Item[], query: string, type: string, desc: string, inputValue?: any[] | string, async?: boolean, isTreeDropdown?: boolean, withoutSort?: boolean, matchFromStart?: boolean) => Item[];
|
|
5
5
|
export {};
|
|
@@ -12,16 +12,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.filterSuggestions = void 0;
|
|
13
13
|
var filterSuggestions = function (data, query, type, desc, inputValue, async, // API filter
|
|
14
14
|
isTreeDropdown, // Tree dropdowns
|
|
15
|
-
withoutSort // Don't show selected items on top of the suggections
|
|
16
|
-
) {
|
|
17
|
-
if ((type ===
|
|
18
|
-
type ===
|
|
19
|
-
type ===
|
|
15
|
+
withoutSort, // Don't show selected items on top of the suggections
|
|
16
|
+
matchFromStart) {
|
|
17
|
+
if ((type === 'custom_search_select' ||
|
|
18
|
+
type === 'auto_complete' ||
|
|
19
|
+
type === 'auto_suggestion') &&
|
|
20
20
|
!async &&
|
|
21
21
|
query &&
|
|
22
22
|
!isTreeDropdown) {
|
|
23
23
|
return data === null || data === void 0 ? void 0 : data.filter(function (item) {
|
|
24
|
-
return
|
|
24
|
+
return matchFromStart
|
|
25
|
+
? item[desc].toLowerCase().startsWith(query.toLowerCase())
|
|
26
|
+
: item[desc].toLowerCase().includes(query.toLowerCase());
|
|
25
27
|
});
|
|
26
28
|
}
|
|
27
29
|
return isTreeDropdown || withoutSort
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterSuggestions.js","sourceRoot":"","sources":["../../src/utilities/filterSuggestions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIO,IAAM,iBAAiB,GAAG,UAC/B,IAAY,EACZ,KAAa,EACb,IAAY,EACZ,IAAY,EACZ,UAA2B,EAC3B,KAAe,EAAE,aAAa;AAC9B,cAAwB,EAAE,iBAAiB;AAC3C,WAAqB,
|
|
1
|
+
{"version":3,"file":"filterSuggestions.js","sourceRoot":"","sources":["../../src/utilities/filterSuggestions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIO,IAAM,iBAAiB,GAAG,UAC/B,IAAY,EACZ,KAAa,EACb,IAAY,EACZ,IAAY,EACZ,UAA2B,EAC3B,KAAe,EAAE,aAAa;AAC9B,cAAwB,EAAE,iBAAiB;AAC3C,WAAqB,EAAE,sDAAsD;AAC7E,cAAwB;IAExB,IACE,CAAC,IAAI,KAAK,sBAAsB;QAC9B,IAAI,KAAK,eAAe;QACxB,IAAI,KAAK,iBAAiB,CAAC;QAC7B,CAAC,KAAK;QACN,KAAK;QACL,CAAC,cAAc,EACf;QACA,OAAO,IAAI,aAAJ,IAAI,uBAA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AG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -70,6 +70,7 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
70
70
|
shortCode = '',
|
|
71
71
|
labelCode = '',
|
|
72
72
|
tabInlineSearch = true,
|
|
73
|
+
matchFromStart = false
|
|
73
74
|
},
|
|
74
75
|
ref
|
|
75
76
|
) => {
|
|
@@ -398,7 +399,8 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
398
399
|
selected,
|
|
399
400
|
async,
|
|
400
401
|
false,
|
|
401
|
-
true
|
|
402
|
+
true,
|
|
403
|
+
matchFromStart
|
|
402
404
|
);
|
|
403
405
|
|
|
404
406
|
useEffect(() => {
|
package/src/ReactCheckbox.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { CheckboxProps } from './commontypes'
|
|
4
|
-
import CustomIcons from './components/customIcons'
|
|
3
|
+
import { CheckboxProps } from './commontypes';
|
|
4
|
+
import CustomIcons from './components/customIcons';
|
|
5
5
|
|
|
6
6
|
const Checkbox: React.FC<CheckboxProps> = ({
|
|
7
7
|
name,
|
|
@@ -13,21 +13,21 @@ const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
13
13
|
checked,
|
|
14
14
|
className: propsClassName,
|
|
15
15
|
value,
|
|
16
|
-
labalClass
|
|
16
|
+
labalClass,
|
|
17
17
|
}) => {
|
|
18
18
|
const getIconName = () => {
|
|
19
19
|
if (checked) {
|
|
20
20
|
if (disabled) {
|
|
21
21
|
return intermediate
|
|
22
22
|
? 'input_intermediate_check_disabled'
|
|
23
|
-
: 'input_checked_disabled'
|
|
23
|
+
: 'input_checked_disabled';
|
|
24
24
|
} else {
|
|
25
|
-
return intermediate ? 'input_intermediate_check' : 'input_checked'
|
|
25
|
+
return intermediate ? 'input_intermediate_check' : 'input_checked';
|
|
26
26
|
}
|
|
27
27
|
} else {
|
|
28
|
-
return disabled ? 'input_unchecked_disabled' : 'input_unchecked'
|
|
28
|
+
return disabled ? 'input_unchecked_disabled' : 'input_unchecked';
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
};
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<div
|
|
@@ -63,11 +63,9 @@ const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
63
63
|
</div>
|
|
64
64
|
</label>
|
|
65
65
|
</div>
|
|
66
|
-
<div className={labalClass}
|
|
67
|
-
{label}
|
|
68
|
-
</div>
|
|
66
|
+
<div className={labalClass}>{label}</div>
|
|
69
67
|
</div>
|
|
70
68
|
);
|
|
71
|
-
}
|
|
69
|
+
};
|
|
72
70
|
|
|
73
|
-
export default Checkbox
|
|
71
|
+
export default Checkbox;
|
package/src/commontypes.ts
CHANGED
|
@@ -80,6 +80,7 @@ export interface AutoSuggestionInputProps {
|
|
|
80
80
|
shortCode?: string
|
|
81
81
|
labelCode?: string,
|
|
82
82
|
tabInlineSearch?: boolean // tab dropdown search
|
|
83
|
+
matchFromStart?: boolean // match data's from the starting position
|
|
83
84
|
}
|
|
84
85
|
export interface IconsProps {
|
|
85
86
|
name: any;
|
|
@@ -10,18 +10,21 @@ export const filterSuggestions = (
|
|
|
10
10
|
inputValue?: any[] | string,
|
|
11
11
|
async?: boolean, // API filter
|
|
12
12
|
isTreeDropdown?: boolean, // Tree dropdowns
|
|
13
|
-
withoutSort?: boolean // Don't show selected items on top of the suggections
|
|
13
|
+
withoutSort?: boolean, // Don't show selected items on top of the suggections
|
|
14
|
+
matchFromStart?: boolean
|
|
14
15
|
): Item[] => {
|
|
15
16
|
if (
|
|
16
|
-
(type ===
|
|
17
|
-
type ===
|
|
18
|
-
type ===
|
|
17
|
+
(type === 'custom_search_select' ||
|
|
18
|
+
type === 'auto_complete' ||
|
|
19
|
+
type === 'auto_suggestion') &&
|
|
19
20
|
!async &&
|
|
20
21
|
query &&
|
|
21
22
|
!isTreeDropdown
|
|
22
23
|
) {
|
|
23
24
|
return data?.filter((item) =>
|
|
24
|
-
|
|
25
|
+
matchFromStart
|
|
26
|
+
? item[desc].toLowerCase().startsWith(query.toLowerCase())
|
|
27
|
+
: item[desc].toLowerCase().includes(query.toLowerCase())
|
|
25
28
|
);
|
|
26
29
|
}
|
|
27
30
|
return isTreeDropdown || withoutSort
|