@contractspec/example.crm-pipeline 3.7.7 → 3.7.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.
- package/.turbo/turbo-build.log +45 -42
- package/CHANGELOG.md +36 -0
- package/README.md +2 -1
- package/dist/browser/docs/crm-pipeline.docblock.js +1 -1
- package/dist/browser/docs/index.js +1 -1
- package/dist/browser/handlers/crm.handlers.js +13 -2
- package/dist/browser/handlers/index.js +13 -2
- package/dist/browser/index.js +392 -159
- package/dist/browser/ui/CrmDashboard.js +366 -144
- package/dist/browser/ui/hooks/index.js +19 -8
- package/dist/browser/ui/hooks/useDealList.js +19 -8
- package/dist/browser/ui/index.js +391 -158
- package/dist/browser/ui/renderers/index.js +32 -10
- package/dist/browser/ui/renderers/pipeline.markdown.js +13 -2
- package/dist/browser/ui/renderers/pipeline.renderer.js +19 -8
- package/dist/browser/ui/tables/DealListTab.js +390 -0
- package/dist/docs/crm-pipeline.docblock.js +1 -1
- package/dist/docs/index.js +1 -1
- package/dist/handlers/crm.handlers.d.ts +2 -0
- package/dist/handlers/crm.handlers.js +13 -2
- package/dist/handlers/index.js +13 -2
- package/dist/index.js +392 -159
- package/dist/node/docs/crm-pipeline.docblock.js +1 -1
- package/dist/node/docs/index.js +1 -1
- package/dist/node/handlers/crm.handlers.js +13 -2
- package/dist/node/handlers/index.js +13 -2
- package/dist/node/index.js +392 -159
- package/dist/node/ui/CrmDashboard.js +366 -144
- package/dist/node/ui/hooks/index.js +19 -8
- package/dist/node/ui/hooks/useDealList.js +19 -8
- package/dist/node/ui/index.js +391 -158
- package/dist/node/ui/renderers/index.js +32 -10
- package/dist/node/ui/renderers/pipeline.markdown.js +13 -2
- package/dist/node/ui/renderers/pipeline.renderer.js +19 -8
- package/dist/node/ui/tables/DealListTab.js +390 -0
- package/dist/ui/CrmDashboard.js +366 -144
- package/dist/ui/hooks/index.js +19 -8
- package/dist/ui/hooks/useDealList.d.ts +8 -2
- package/dist/ui/hooks/useDealList.js +19 -8
- package/dist/ui/index.js +391 -158
- package/dist/ui/renderers/index.js +32 -10
- package/dist/ui/renderers/pipeline.markdown.js +13 -2
- package/dist/ui/renderers/pipeline.renderer.js +19 -8
- package/dist/ui/tables/DealListTab.d.ts +20 -0
- package/dist/ui/tables/DealListTab.js +391 -0
- package/dist/ui/tables/DealListTab.smoke.test.d.ts +1 -0
- package/package.json +27 -12
- package/src/docs/crm-pipeline.docblock.ts +1 -1
- package/src/handlers/crm.handlers.ts +18 -1
- package/src/ui/CrmDashboard.tsx +2 -71
- package/src/ui/hooks/useDealList.ts +36 -8
- package/src/ui/tables/DealListTab.smoke.test.tsx +149 -0
- package/src/ui/tables/DealListTab.tsx +276 -0
|
@@ -10,8 +10,13 @@ function useDealList(options = {}) {
|
|
|
10
10
|
const [stages, setStages] = useState([]);
|
|
11
11
|
const [loading, setLoading] = useState(true);
|
|
12
12
|
const [error, setError] = useState(null);
|
|
13
|
-
const [
|
|
13
|
+
const [internalPage, setInternalPage] = useState(0);
|
|
14
14
|
const pipelineId = options.pipelineId ?? "pipeline-1";
|
|
15
|
+
const pageIndex = options.pageIndex ?? internalPage;
|
|
16
|
+
const pageSize = options.pageSize ?? options.limit ?? 50;
|
|
17
|
+
const [sort] = options.sorting ?? [];
|
|
18
|
+
const sortBy = sort?.id;
|
|
19
|
+
const sortDirection = sort ? sort.desc ? "desc" : "asc" : undefined;
|
|
15
20
|
const fetchData = useCallback(async () => {
|
|
16
21
|
setLoading(true);
|
|
17
22
|
setError(null);
|
|
@@ -23,8 +28,10 @@ function useDealList(options = {}) {
|
|
|
23
28
|
stageId: options.stageId,
|
|
24
29
|
status: options.status === "all" ? undefined : options.status,
|
|
25
30
|
search: options.search,
|
|
26
|
-
limit:
|
|
27
|
-
offset:
|
|
31
|
+
limit: pageSize,
|
|
32
|
+
offset: pageIndex * pageSize,
|
|
33
|
+
sortBy: sortBy === "name" || sortBy === "value" || sortBy === "status" || sortBy === "expectedCloseDate" || sortBy === "updatedAt" ? sortBy : undefined,
|
|
34
|
+
sortDirection
|
|
28
35
|
}),
|
|
29
36
|
crm.getDealsByStage({ projectId, pipelineId }),
|
|
30
37
|
crm.getPipelineStages({ pipelineId })
|
|
@@ -44,8 +51,10 @@ function useDealList(options = {}) {
|
|
|
44
51
|
options.stageId,
|
|
45
52
|
options.status,
|
|
46
53
|
options.search,
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
pageIndex,
|
|
55
|
+
pageSize,
|
|
56
|
+
sortBy,
|
|
57
|
+
sortDirection
|
|
49
58
|
]);
|
|
50
59
|
useEffect(() => {
|
|
51
60
|
fetchData();
|
|
@@ -73,10 +82,12 @@ function useDealList(options = {}) {
|
|
|
73
82
|
loading,
|
|
74
83
|
error,
|
|
75
84
|
stats,
|
|
76
|
-
page,
|
|
85
|
+
page: pageIndex + 1,
|
|
86
|
+
pageIndex,
|
|
87
|
+
pageSize,
|
|
77
88
|
refetch: fetchData,
|
|
78
|
-
nextPage: () =>
|
|
79
|
-
prevPage: () =>
|
|
89
|
+
nextPage: options.pageIndex === undefined ? () => setInternalPage((page) => page + 1) : undefined,
|
|
90
|
+
prevPage: options.pageIndex === undefined ? () => pageIndex > 0 && setInternalPage((page) => page - 1) : undefined
|
|
80
91
|
};
|
|
81
92
|
}
|
|
82
93
|
|
|
@@ -10,8 +10,13 @@ function useDealList(options = {}) {
|
|
|
10
10
|
const [stages, setStages] = useState([]);
|
|
11
11
|
const [loading, setLoading] = useState(true);
|
|
12
12
|
const [error, setError] = useState(null);
|
|
13
|
-
const [
|
|
13
|
+
const [internalPage, setInternalPage] = useState(0);
|
|
14
14
|
const pipelineId = options.pipelineId ?? "pipeline-1";
|
|
15
|
+
const pageIndex = options.pageIndex ?? internalPage;
|
|
16
|
+
const pageSize = options.pageSize ?? options.limit ?? 50;
|
|
17
|
+
const [sort] = options.sorting ?? [];
|
|
18
|
+
const sortBy = sort?.id;
|
|
19
|
+
const sortDirection = sort ? sort.desc ? "desc" : "asc" : undefined;
|
|
15
20
|
const fetchData = useCallback(async () => {
|
|
16
21
|
setLoading(true);
|
|
17
22
|
setError(null);
|
|
@@ -23,8 +28,10 @@ function useDealList(options = {}) {
|
|
|
23
28
|
stageId: options.stageId,
|
|
24
29
|
status: options.status === "all" ? undefined : options.status,
|
|
25
30
|
search: options.search,
|
|
26
|
-
limit:
|
|
27
|
-
offset:
|
|
31
|
+
limit: pageSize,
|
|
32
|
+
offset: pageIndex * pageSize,
|
|
33
|
+
sortBy: sortBy === "name" || sortBy === "value" || sortBy === "status" || sortBy === "expectedCloseDate" || sortBy === "updatedAt" ? sortBy : undefined,
|
|
34
|
+
sortDirection
|
|
28
35
|
}),
|
|
29
36
|
crm.getDealsByStage({ projectId, pipelineId }),
|
|
30
37
|
crm.getPipelineStages({ pipelineId })
|
|
@@ -44,8 +51,10 @@ function useDealList(options = {}) {
|
|
|
44
51
|
options.stageId,
|
|
45
52
|
options.status,
|
|
46
53
|
options.search,
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
pageIndex,
|
|
55
|
+
pageSize,
|
|
56
|
+
sortBy,
|
|
57
|
+
sortDirection
|
|
49
58
|
]);
|
|
50
59
|
useEffect(() => {
|
|
51
60
|
fetchData();
|
|
@@ -73,10 +82,12 @@ function useDealList(options = {}) {
|
|
|
73
82
|
loading,
|
|
74
83
|
error,
|
|
75
84
|
stats,
|
|
76
|
-
page,
|
|
85
|
+
page: pageIndex + 1,
|
|
86
|
+
pageIndex,
|
|
87
|
+
pageSize,
|
|
77
88
|
refetch: fetchData,
|
|
78
|
-
nextPage: () =>
|
|
79
|
-
prevPage: () =>
|
|
89
|
+
nextPage: options.pageIndex === undefined ? () => setInternalPage((page) => page + 1) : undefined,
|
|
90
|
+
prevPage: options.pageIndex === undefined ? () => pageIndex > 0 && setInternalPage((page) => page - 1) : undefined
|
|
80
91
|
};
|
|
81
92
|
}
|
|
82
93
|
export {
|