@lls/store 24.1.67-e4a0b752 → 24.1.67
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/index.js +6 -22
- package/package.json +4 -10
package/lib/index.js
CHANGED
|
@@ -747,34 +747,24 @@ import { makeEntitiesFilter } from "@lls/utils";
|
|
|
747
747
|
// src/selectors/crud.ts
|
|
748
748
|
init_define_import_meta();
|
|
749
749
|
import { createSearchSelector, makeGetAllEntities, makeGetEntityById } from "@lls/utils";
|
|
750
|
-
import { useMemo } from "react";
|
|
751
|
-
import { useSelector } from "react-redux";
|
|
752
750
|
var crud = (entityName, { search: search25 }) => {
|
|
753
751
|
const getElements = makeGetAllEntities(entityName);
|
|
754
752
|
const makeSearchElements = () => createSearchSelector(
|
|
755
|
-
|
|
753
|
+
getElements,
|
|
756
754
|
(_state, params) => params,
|
|
757
755
|
(elements, params) => search25(params)(elements)
|
|
758
756
|
);
|
|
759
757
|
const methodName = `${entityName.charAt(0).toUpperCase()}${entityName.slice(1)}`;
|
|
760
758
|
const getElementById = makeGetEntityById(entityName);
|
|
761
|
-
const useSearch = makeUseSearch(makeSearchElements);
|
|
762
759
|
const back = {
|
|
763
760
|
[`get${methodName}`]: getElements,
|
|
764
761
|
[`search${methodName}`]: makeSearchElements(),
|
|
765
762
|
[`get${methodName.replace(/s$/, "")}`]: getElementById,
|
|
766
763
|
[`makeSearch${methodName}`]: makeSearchElements,
|
|
767
|
-
[`filter${methodName}`]: search25
|
|
768
|
-
[`useSearch${methodName}`]: useSearch
|
|
764
|
+
[`filter${methodName}`]: search25
|
|
769
765
|
};
|
|
770
766
|
return back;
|
|
771
767
|
};
|
|
772
|
-
var makeUseSearch = (makeSearchElements) => {
|
|
773
|
-
return (params) => {
|
|
774
|
-
const fn = useMemo(makeSearchElements, []);
|
|
775
|
-
return useSelector((state) => fn(state, params));
|
|
776
|
-
};
|
|
777
|
-
};
|
|
778
768
|
|
|
779
769
|
// src/selectors/school.ts
|
|
780
770
|
var search = ({ ids }) => makeEntitiesFilter({ id: ids });
|
|
@@ -811,7 +801,7 @@ var search2 = ({
|
|
|
811
801
|
levels: levelIds,
|
|
812
802
|
subjects: subjectIds,
|
|
813
803
|
valid: isValid,
|
|
814
|
-
|
|
804
|
+
publishers,
|
|
815
805
|
hasNewDesign,
|
|
816
806
|
isWorkbook,
|
|
817
807
|
isWorkplan,
|
|
@@ -824,7 +814,7 @@ var search2 = ({
|
|
|
824
814
|
_2.isFunction(sortByQuery) ? sortByQuery : sortByQuery ? _2.sortBy(sortByQuery) : _2.identity
|
|
825
815
|
);
|
|
826
816
|
};
|
|
827
|
-
var { getBooks, getBook, searchBooks, makeSearchBooks, filterBooks
|
|
817
|
+
var { getBooks, getBook, searchBooks, makeSearchBooks, filterBooks } = crud("books", {
|
|
828
818
|
search: search2
|
|
829
819
|
});
|
|
830
820
|
var makeSearchValidBooks = () => createSearchSelector2(makeSearchBooks(), (books) => _2.filter({ valid: true, hasNewDesign: true }, books));
|
|
@@ -925,7 +915,7 @@ var getDraftPages = makeGetAllEntities2("drafts");
|
|
|
925
915
|
var makeGetDraftPage = () => makeGetEntityById3("drafts");
|
|
926
916
|
var getDraftPage = makeGetDraftPage();
|
|
927
917
|
var makeSearchDraftPages = () => createSearchSelector3(
|
|
928
|
-
|
|
918
|
+
getDraftPages,
|
|
929
919
|
(_state, params) => params,
|
|
930
920
|
(pages, params) => search5(params)(pages)
|
|
931
921
|
);
|
|
@@ -936,7 +926,6 @@ var makeSearchModifiedPages = () => createSearchSelector3(
|
|
|
936
926
|
(pages, params) => search5({ ...params, isOriginal: false })(pages)
|
|
937
927
|
);
|
|
938
928
|
var searchModifiedPages = makeSearchModifiedPages();
|
|
939
|
-
var useSearchModifiedPages = makeUseSearch(makeSearchModifiedPages);
|
|
940
929
|
|
|
941
930
|
// src/selectors/collection.ts
|
|
942
931
|
init_define_import_meta();
|
|
@@ -1435,9 +1424,6 @@ var garDivisionSchema = define(garDivision, {
|
|
|
1435
1424
|
students: [user],
|
|
1436
1425
|
school
|
|
1437
1426
|
});
|
|
1438
|
-
var documentSchema = define(document, {
|
|
1439
|
-
page
|
|
1440
|
-
});
|
|
1441
1427
|
var chapterSchema = define(chapter, {
|
|
1442
1428
|
book,
|
|
1443
1429
|
oldBook: book,
|
|
@@ -1691,7 +1677,5 @@ export {
|
|
|
1691
1677
|
searchTools,
|
|
1692
1678
|
searchUsers,
|
|
1693
1679
|
searchValidBooks,
|
|
1694
|
-
setEntitiesReducer
|
|
1695
|
-
useSearchBooks,
|
|
1696
|
-
useSearchModifiedPages
|
|
1680
|
+
setEntitiesReducer
|
|
1697
1681
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@lls/store",
|
|
3
3
|
"description": "model de donnée et selecteurs",
|
|
4
4
|
"homepage": "https://github.com/lelivrescolaire/monorepo/tree/dev/libs/store",
|
|
5
|
-
"version": "24.1.67
|
|
5
|
+
"version": "24.1.67",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./lib/builttypes/store/src/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -25,30 +25,24 @@
|
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@lls/utils": "*",
|
|
27
27
|
"lodash": "*",
|
|
28
|
-
"react": "*"
|
|
29
|
-
"react-redux": "*",
|
|
30
|
-
"redux": "*"
|
|
28
|
+
"react": "*"
|
|
31
29
|
},
|
|
32
30
|
"devDependencies": {
|
|
33
31
|
"@biomejs/biome": "1.9.1",
|
|
34
|
-
"@testing-library/react": "16.0.1",
|
|
35
32
|
"@types/lodash": "4.17.7",
|
|
36
33
|
"@types/node": "22.5.5",
|
|
37
34
|
"@types/react": "18.3.6",
|
|
38
|
-
"@types/react-redux": "7.1.34",
|
|
39
35
|
"@vitejs/plugin-react-swc": "3.7.0",
|
|
40
36
|
"esbuild": "0.23.1",
|
|
41
37
|
"lodash": "4.17.21",
|
|
42
38
|
"react": "18.3.1",
|
|
43
|
-
"react-redux": "8.1.1",
|
|
44
|
-
"redux": "5.0.1",
|
|
45
39
|
"reselect": "4.1.8",
|
|
46
40
|
"typescript": "5.6.2",
|
|
47
41
|
"vite": "5.4.6",
|
|
48
42
|
"vite-tsconfig-paths": "5.0.1",
|
|
49
43
|
"vitest": "2.1.1",
|
|
50
|
-
"@lls/utils": "24.1.67
|
|
51
|
-
"@lls/vitescripts": "24.1.67
|
|
44
|
+
"@lls/utils": "24.1.67",
|
|
45
|
+
"@lls/vitescripts": "24.1.67"
|
|
52
46
|
},
|
|
53
47
|
"license": "ISC",
|
|
54
48
|
"dependencies": {
|