asv-hlps 1.2.28 → 1.2.29
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/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +2 -0
- package/lib/cjs/reacts/hooks/useReadonlyFetchTobs.d.ts +5 -0
- package/lib/cjs/reacts/hooks/useReadonlyFetchTobs.js +38 -0
- package/lib/cjs/reacts/index.d.ts +2 -0
- package/lib/cjs/reacts/index.js +8 -0
- package/lib/esm/index.d.ts +2 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/reacts/hooks/useReadonlyFetchTobs.d.ts +5 -0
- package/lib/esm/reacts/hooks/useReadonlyFetchTobs.js +36 -0
- package/lib/esm/reacts/index.d.ts +2 -0
- package/lib/esm/reacts/index.js +2 -0
- package/package.json +3 -1
package/lib/cjs/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import "./pdfs/invoices/infoInvoice";
|
|
|
16
16
|
import "./pdfs/tools/tools";
|
|
17
17
|
import "./product";
|
|
18
18
|
import "./react-utils";
|
|
19
|
+
import "./reacts/index";
|
|
19
20
|
import "./sale";
|
|
20
21
|
import "./services/authService";
|
|
21
22
|
import "./user";
|
|
@@ -35,4 +36,5 @@ export * from "./react-utils";
|
|
|
35
36
|
export * from "./sale";
|
|
36
37
|
export * from "./user";
|
|
37
38
|
export * from "./utils";
|
|
39
|
+
export * from "./reacts/index";
|
|
38
40
|
export { AuthService, StorageService, HlpProduct, HlpEntry, StockPipe, AmountOnListBillPipe, AmountOnBillPipe };
|
package/lib/cjs/index.js
CHANGED
|
@@ -46,6 +46,7 @@ require("./pdfs/invoices/infoInvoice");
|
|
|
46
46
|
require("./pdfs/tools/tools");
|
|
47
47
|
require("./product");
|
|
48
48
|
require("./react-utils");
|
|
49
|
+
require("./reacts/index");
|
|
49
50
|
require("./sale");
|
|
50
51
|
require("./services/authService");
|
|
51
52
|
require("./user");
|
|
@@ -65,3 +66,4 @@ __exportStar(require("./react-utils"), exports);
|
|
|
65
66
|
__exportStar(require("./sale"), exports);
|
|
66
67
|
__exportStar(require("./user"), exports);
|
|
67
68
|
__exportStar(require("./utils"), exports);
|
|
69
|
+
__exportStar(require("./reacts/index"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
const react_utils_1 = require("../../react-utils");
|
|
14
|
+
const useReadonlyFetchTobs = (url, httpService, urlParam, valueProp = "id", labelProp = "name") => {
|
|
15
|
+
const [tobs, setTobs] = (0, react_1.useState)([]);
|
|
16
|
+
const getDatas = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
try {
|
|
18
|
+
if (!urlParam) {
|
|
19
|
+
const { data: tobs } = yield httpService.get(url);
|
|
20
|
+
setTobs(tobs);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const { data: tobs } = yield httpService.getByParam(urlParam, url);
|
|
24
|
+
setTobs(tobs);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (error) { }
|
|
28
|
+
});
|
|
29
|
+
(0, react_1.useEffect)(() => {
|
|
30
|
+
getDatas();
|
|
31
|
+
return () => { };
|
|
32
|
+
}, []);
|
|
33
|
+
// const options = useMemo(() => selectOptionsToLabelAndValue(tobs, valueProp, labelProp), []);
|
|
34
|
+
const options = (0, react_utils_1.selectOptionsToLabelAndValue)(tobs, valueProp, labelProp);
|
|
35
|
+
return { tobs, options };
|
|
36
|
+
};
|
|
37
|
+
exports.default = useReadonlyFetchTobs;
|
|
38
|
+
// export default {tobs , options} ;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useReadonlyFetchTobs = void 0;
|
|
7
|
+
const useReadonlyFetchTobs_1 = __importDefault(require("./hooks/useReadonlyFetchTobs"));
|
|
8
|
+
exports.useReadonlyFetchTobs = useReadonlyFetchTobs_1.default;
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import "./pdfs/invoices/infoInvoice";
|
|
|
16
16
|
import "./pdfs/tools/tools";
|
|
17
17
|
import "./product";
|
|
18
18
|
import "./react-utils";
|
|
19
|
+
import "./reacts/index";
|
|
19
20
|
import "./sale";
|
|
20
21
|
import "./services/authService";
|
|
21
22
|
import "./user";
|
|
@@ -35,4 +36,5 @@ export * from "./react-utils";
|
|
|
35
36
|
export * from "./sale";
|
|
36
37
|
export * from "./user";
|
|
37
38
|
export * from "./utils";
|
|
39
|
+
export * from "./reacts/index";
|
|
38
40
|
export { AuthService, StorageService, HlpProduct, HlpEntry, StockPipe, AmountOnListBillPipe, AmountOnBillPipe };
|
package/lib/esm/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import "./pdfs/invoices/infoInvoice";
|
|
|
19
19
|
import "./pdfs/tools/tools";
|
|
20
20
|
import "./product";
|
|
21
21
|
import "./react-utils";
|
|
22
|
+
import "./reacts/index";
|
|
22
23
|
import "./sale";
|
|
23
24
|
import "./services/authService";
|
|
24
25
|
import "./user";
|
|
@@ -38,5 +39,6 @@ export * from "./react-utils";
|
|
|
38
39
|
export * from "./sale";
|
|
39
40
|
export * from "./user";
|
|
40
41
|
export * from "./utils";
|
|
42
|
+
export * from "./reacts/index";
|
|
41
43
|
// export * from "./helpers/hlpProduct";
|
|
42
44
|
export { AuthService, StorageService, HlpProduct, HlpEntry, StockPipe, AmountOnListBillPipe, AmountOnBillPipe };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { useEffect, useState } from "react";
|
|
11
|
+
import { selectOptionsToLabelAndValue } from "../../react-utils";
|
|
12
|
+
const useReadonlyFetchTobs = (url, httpService, urlParam, valueProp = "id", labelProp = "name") => {
|
|
13
|
+
const [tobs, setTobs] = useState([]);
|
|
14
|
+
const getDatas = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
try {
|
|
16
|
+
if (!urlParam) {
|
|
17
|
+
const { data: tobs } = yield httpService.get(url);
|
|
18
|
+
setTobs(tobs);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const { data: tobs } = yield httpService.getByParam(urlParam, url);
|
|
22
|
+
setTobs(tobs);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (error) { }
|
|
26
|
+
});
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
getDatas();
|
|
29
|
+
return () => { };
|
|
30
|
+
}, []);
|
|
31
|
+
// const options = useMemo(() => selectOptionsToLabelAndValue(tobs, valueProp, labelProp), []);
|
|
32
|
+
const options = selectOptionsToLabelAndValue(tobs, valueProp, labelProp);
|
|
33
|
+
return { tobs, options };
|
|
34
|
+
};
|
|
35
|
+
export default useReadonlyFetchTobs;
|
|
36
|
+
// export default {tobs , options} ;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asv-hlps",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.29",
|
|
4
4
|
"description": "helpers",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/bcryptjs": "^2.4.2",
|
|
20
20
|
"@types/randomatic": "^3.1.3",
|
|
21
|
+
"@types/react": "^18.0.18",
|
|
21
22
|
"typescript": "^4.7.4"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
"bcryptjs": "^2.4.3",
|
|
26
27
|
"jwt-decode": "^3.1.2",
|
|
27
28
|
"randomatic": "^3.1.1",
|
|
29
|
+
"react": "^18.2.0",
|
|
28
30
|
"yup": "^0.32.11"
|
|
29
31
|
}
|
|
30
32
|
}
|