@visns-studio/visns-components 1.4.8 → 1.4.10

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,76 +1,62 @@
1
- import React, { useEffect, useState } from 'react';
2
- import SelectList from './visns-select-list';
3
- import Select, { createFilter } from 'react-select';
1
+ import React, { useEffect, useState } from "react";
2
+ import SelectList from "./visns-select-list";
3
+ import Select, { createFilter } from "react-select";
4
4
 
5
5
  function MultiSelect(props) {
6
- const { inputValue, onChange, options, settings, multi } = props;
7
- const [selectOptions, setSelectOptions] = useState([]);
8
-
9
- useEffect(() => {
10
- let _options = [];
11
-
12
- options.forEach((a) => {
13
- let _optionItem = {
14
- value: a.id,
15
- label: a.label,
16
- };
17
-
18
- if (a.hasOwnProperty('description')) {
19
- _optionItem = {
20
- ..._optionItem,
21
- description: a.description,
22
- };
23
- }
24
-
25
- if (a.hasOwnProperty('rate')) {
26
- _optionItem = {
27
- ..._optionItem,
28
- rate: a.rate,
29
- };
30
- }
31
-
32
- if (a.hasOwnProperty('buy_price')) {
33
- _optionItem = {
34
- ..._optionItem,
35
- buy_price: a.buy_price,
36
- };
37
- }
38
-
39
- if (a.hasOwnProperty('sell_price')) {
40
- _optionItem = {
41
- ..._optionItem,
42
- sell_price: a.sell_price,
43
- };
44
- }
45
-
46
- _options.push(_optionItem);
47
- });
48
-
49
- setSelectOptions(_options);
50
- }, [options]);
51
-
52
- return (
53
- <Select
54
- isClearable
55
- isSearchable
56
- isMulti={multi}
57
- filterOption={createFilter({ ignoreAccents: false })}
58
- components={{ SelectList }}
59
- options={selectOptions}
60
- onChange={(inputValue, action) => {
61
- onChange(inputValue, action, settings.id);
62
- }}
63
- className="visns__ms"
64
- styles={{
65
- menu: (provided) => ({ ...provided, zIndex: 9999 }),
66
- control: (base) => ({
67
- ...base,
68
- minHeight: '52px',
69
- }),
70
- }}
71
- value={inputValue}
72
- />
73
- );
6
+ const { inputValue, multi, onChange, options, settings, style } = props;
7
+ const [selectOptions, setSelectOptions] = useState([]);
8
+
9
+ useEffect(() => {
10
+ let _options = [];
11
+
12
+ if (options.length > 0) {
13
+ options.forEach((a) => {
14
+ let _optionItem;
15
+
16
+ _optionItem = {
17
+ value: a.id,
18
+ label: a.label,
19
+ };
20
+
21
+ Object.keys(a).forEach((b) => {
22
+ _optionItem = {
23
+ ..._optionItem,
24
+ [b]: a[b],
25
+ };
26
+ });
27
+
28
+ _options.push(_optionItem);
29
+ });
30
+
31
+ setSelectOptions(_options);
32
+ }
33
+ }, [options]);
34
+
35
+ return (
36
+ <Select
37
+ isClearable
38
+ isSearchable
39
+ isMulti={multi}
40
+ filterOption={createFilter({ ignoreAccents: false })}
41
+ components={{ SelectList }}
42
+ options={selectOptions}
43
+ onChange={(inputValue, action) => {
44
+ onChange(inputValue, action, settings.id);
45
+ }}
46
+ className="visns__ms"
47
+ styles={{
48
+ menu: (provided) => ({ ...provided, zIndex: 9999 }),
49
+ control: (base) => ({
50
+ ...base,
51
+ minHeight:
52
+ style && style.multi_select_height
53
+ ? style.multi_select_height
54
+ : "52px",
55
+ }),
56
+ }}
57
+ value={inputValue}
58
+ />
59
+ );
74
60
  }
75
61
 
76
62
  export default MultiSelect;
package/package.json CHANGED
@@ -1,54 +1,54 @@
1
1
  {
2
- "dependencies": {
3
- "@inovua/reactdatagrid-community": "^5.9.4",
4
- "@inovua/reactdatagrid-enterprise": "^5.9.4",
5
- "akar-icons": "^1.9.28",
6
- "awesome-debounce-promise": "^2.1.0",
7
- "axios": "^1.4.0",
8
- "framer-motion": "^10.12.16",
9
- "html-react-parser": "^4.0.0",
10
- "lodash": "^4.17.21",
11
- "moment": "^2.29.4",
12
- "numeral": "^2.0.6",
13
- "react-confirm-alert": "^3.0.6",
14
- "react-datepicker": "^4.14.0",
15
- "react-dropzone": "^14.2.3",
16
- "react-number-format": "^5.2.2",
17
- "react-promise-tracker": "^2.1.1",
18
- "react-quill": "^2.0.0",
19
- "react-select": "^5.7.3",
20
- "react-slugify": "^3.0.2",
21
- "react-sortable-hoc": "^2.0.0",
22
- "react-toastify": "^9.1.3",
23
- "react-toggle": "^4.1.3",
24
- "react-tooltip": "^5.14.0",
25
- "react-window": "^1.8.9",
26
- "reactjs-popup": "^2.0.5"
27
- },
28
- "devDependecies": {
29
- "react": "^18.2.0",
30
- "react-dom": "^18.2.0"
31
- },
32
- "peerDependencies": {
33
- "react": "^17.0.1",
34
- "react-dom": "^17.0.1"
35
- },
36
- "name": "@visns-studio/visns-components",
37
- "version": "1.4.8",
38
- "description": "Various packages to assist in the development of our Custom Applications.",
39
- "main": "index.js",
40
- "devDependencies": {},
41
- "scripts": {
42
- "test": "echo \"Error: no test specified\" && exit 1"
43
- },
44
- "repository": {
45
- "type": "git",
46
- "url": "git+https://github.com/visnsstudio/visns-components.git"
47
- },
48
- "author": "Visns Studio",
49
- "license": "ISC",
50
- "bugs": {
51
- "url": "https://github.com/visnsstudio/visns-components/issues"
52
- },
53
- "homepage": "https://github.com/visnsstudio/visns-components#readme"
2
+ "dependencies": {
3
+ "@inovua/reactdatagrid-community": "^5.9.4",
4
+ "@inovua/reactdatagrid-enterprise": "^5.9.4",
5
+ "akar-icons": "^1.9.28",
6
+ "awesome-debounce-promise": "^2.1.0",
7
+ "axios": "^1.4.0",
8
+ "framer-motion": "^10.12.16",
9
+ "html-react-parser": "^4.0.0",
10
+ "lodash": "^4.17.21",
11
+ "moment": "^2.29.4",
12
+ "numeral": "^2.0.6",
13
+ "react-confirm-alert": "^3.0.6",
14
+ "react-datepicker": "^4.14.0",
15
+ "react-dropzone": "^14.2.3",
16
+ "react-number-format": "^5.2.2",
17
+ "react-promise-tracker": "^2.1.1",
18
+ "react-quill": "^2.0.0",
19
+ "react-select": "^5.7.3",
20
+ "react-slugify": "^3.0.2",
21
+ "react-sortable-hoc": "^2.0.0",
22
+ "react-toastify": "^9.1.3",
23
+ "react-toggle": "^4.1.3",
24
+ "react-tooltip": "^5.14.0",
25
+ "react-window": "^1.8.9",
26
+ "reactjs-popup": "^2.0.5"
27
+ },
28
+ "devDependecies": {
29
+ "react": "^18.2.0",
30
+ "react-dom": "^18.2.0"
31
+ },
32
+ "peerDependencies": {
33
+ "react": "^17.0.1",
34
+ "react-dom": "^17.0.1"
35
+ },
36
+ "name": "@visns-studio/visns-components",
37
+ "version": "1.4.10",
38
+ "description": "Various packages to assist in the development of our Custom Applications.",
39
+ "main": "index.js",
40
+ "devDependencies": {},
41
+ "scripts": {
42
+ "test": "echo \"Error: no test specified\" && exit 1"
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/visnsstudio/visns-components.git"
47
+ },
48
+ "author": "Visns Studio",
49
+ "license": "ISC",
50
+ "bugs": {
51
+ "url": "https://github.com/visnsstudio/visns-components/issues"
52
+ },
53
+ "homepage": "https://github.com/visnsstudio/visns-components#readme"
54
54
  }