@ram_28/kf-ai-sdk 1.0.18 → 1.0.20
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 +45 -12
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.mjs +2 -2
- package/dist/auth.cjs +1 -1
- package/dist/auth.mjs +1 -1
- package/dist/{client-C15j4O5B.cjs → client-DgtkT50N.cjs} +1 -1
- package/dist/{client-CfvLiGfP.js → client-V-WzUb8H.js} +9 -5
- package/dist/components/hooks/useFilter/types.d.ts +14 -11
- package/dist/components/hooks/useFilter/types.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/useFilter.d.ts +1 -1
- package/dist/components/hooks/useFilter/useFilter.d.ts.map +1 -1
- package/dist/components/hooks/useForm/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/context.d.ts +1 -1
- package/dist/components/hooks/useKanban/context.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/types.d.ts +5 -22
- package/dist/components/hooks/useKanban/types.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/useKanban.d.ts.map +1 -1
- package/dist/components/hooks/useTable/types.d.ts +19 -31
- package/dist/components/hooks/useTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useTable/useTable.d.ts.map +1 -1
- package/dist/error-handling-CAoD0Kwb.cjs +1 -0
- package/dist/error-handling-CrhTtD88.js +14 -0
- package/dist/filter.cjs +1 -1
- package/dist/filter.mjs +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.mjs +825 -814
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/kanban.cjs +2 -2
- package/dist/kanban.mjs +335 -323
- package/dist/{metadata-2FLBsFcf.cjs → metadata-0lZAfuTP.cjs} +1 -1
- package/dist/{metadata-DBcoDth-.js → metadata-B88D_pVS.js} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +113 -96
- package/dist/table.types.d.ts +1 -1
- package/dist/table.types.d.ts.map +1 -1
- package/dist/types/common.d.ts +26 -6
- package/dist/types/common.d.ts.map +1 -1
- package/dist/useFilter-DzpP_ag0.cjs +1 -0
- package/dist/useFilter-H5bgAZQF.js +120 -0
- package/dist/utils/api/buildListOptions.d.ts +43 -0
- package/dist/utils/api/buildListOptions.d.ts.map +1 -0
- package/dist/utils/api/index.d.ts +2 -0
- package/dist/utils/api/index.d.ts.map +1 -0
- package/dist/utils/error-handling.d.ts +41 -0
- package/dist/utils/error-handling.d.ts.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/docs/QUICK_REFERENCE.md +142 -420
- package/docs/useAuth.md +52 -340
- package/docs/useFilter.md +858 -162
- package/docs/useForm.md +712 -501
- package/docs/useKanban.md +534 -279
- package/docs/useTable.md +725 -214
- package/package.json +1 -1
- package/sdk/api/client.ts +7 -1
- package/sdk/components/hooks/useFilter/types.ts +14 -11
- package/sdk/components/hooks/useFilter/useFilter.ts +20 -18
- package/sdk/components/hooks/useForm/apiClient.ts +2 -1
- package/sdk/components/hooks/useForm/useForm.ts +47 -13
- package/sdk/components/hooks/useKanban/context.ts +5 -3
- package/sdk/components/hooks/useKanban/types.ts +7 -23
- package/sdk/components/hooks/useKanban/useKanban.ts +54 -18
- package/sdk/components/hooks/useTable/types.ts +26 -32
- package/sdk/components/hooks/useTable/useTable.llm.txt +8 -22
- package/sdk/components/hooks/useTable/useTable.ts +70 -25
- package/sdk/index.ts +154 -10
- package/sdk/table.types.ts +3 -0
- package/sdk/types/common.ts +31 -6
- package/sdk/utils/api/buildListOptions.ts +120 -0
- package/sdk/utils/api/index.ts +2 -0
- package/sdk/utils/error-handling.ts +150 -0
- package/sdk/utils/index.ts +6 -0
- package/dist/useFilter-Dofowpr_.cjs +0 -1
- package/dist/useFilter-Dv-mr9QW.js +0 -117
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("./client-
|
|
1
|
+
"use strict";const o=require("./client-DgtkT50N.cjs");async function c(e){try{const r=o.getApiBaseUrl(),s=o.getDefaultHeaders(),a=await fetch(`${r}/api/app/meta/bdo/${e}`,{method:"GET",headers:s});if(!a.ok)throw new Error(`Failed to fetch schema for ${e}: ${a.statusText}`);const t=await a.json();if(!t||typeof t!="object")throw new Error(`Invalid BDO schema response for ${e}`);return t}catch(r){throw console.error(`Schema fetch error for ${e}:`,r),new Error(`Failed to load BDO schema: ${r instanceof Error?r.message:"Unknown error"}`)}}async function n(e){try{const r=o.getApiBaseUrl(),s=o.getDefaultHeaders(),a=e!=null&&e.Filter||e!=null&&e.Sort?"POST":"GET",t=await fetch(`${r}/api/app/metadata/list`,{method:a,headers:s,...a==="POST"&&e&&{body:JSON.stringify(e)}});if(!t.ok)throw new Error(`Failed to list metadata: ${t.statusText}`);return await t.json()}catch(r){throw console.error("Metadata list error:",r),new Error(`Failed to list metadata: ${r instanceof Error?r.message:"Unknown error"}`)}}exports.getBdoSchema=c;exports.listMetadata=n;
|
package/dist/table.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),O=require("@tanstack/react-query"),A=require("./client-DgtkT50N.cjs"),h=require("./error-handling-CAoD0Kwb.cjs"),re=require("./useFilter-DzpP_ag0.cjs");function oe(o){var Q,z,M,P,F,w,R,x;const[s,b]=t.useState({query:"",debouncedQuery:""}),c=t.useRef(null),j=300,G=()=>{var r,y;const e=(r=o.initialState)==null?void 0:r.sort;if(e&&e.length>0){const D=e[0],L=Object.keys(D)[0],te=(y=D[L])==null?void 0:y.toLowerCase();return{field:L,direction:te}}return{field:null,direction:null}},[n,p]=t.useState(G),[a,i]=t.useState({pageNo:((z=(Q=o.initialState)==null?void 0:Q.pagination)==null?void 0:z.pageNo)||1,pageSize:((P=(M=o.initialState)==null?void 0:M.pagination)==null?void 0:P.pageSize)||10}),u=re.useFilter({conditions:(w=(F=o.initialState)==null?void 0:F.filter)==null?void 0:w.conditions,operator:((x=(R=o.initialState)==null?void 0:R.filter)==null?void 0:x.operator)||"And"}),l=t.useMemo(()=>{const e={};return s.debouncedQuery&&(e.Search=s.debouncedQuery),u.payload&&(e.Filter=u.payload),e},[s.debouncedQuery,u.payload]),N=t.useMemo(()=>{const e={...l};return n.field&&n.direction&&(e.Sort=[{[String(n.field)]:n.direction==="asc"?"ASC":"DESC"}]),e.Page=a.pageNo,e.PageSize=a.pageSize,e},[l,n,a]),{data:g,isLoading:H,isFetching:I,error:q,refetch:E}=O.useQuery({queryKey:["table",o.source,N],queryFn:async()=>{try{const e=await A.api(o.source).list(N);return o.onSuccess&&o.onSuccess(e.Data),e}catch(e){throw o.onError&&o.onError(h.toError(e)),e}},staleTime:0,gcTime:0}),{data:d,isLoading:K,isFetching:_,error:T,refetch:k}=O.useQuery({queryKey:["table-count",o.source,l],queryFn:async()=>{try{return await A.api(o.source).count(l)}catch(e){throw o.onError&&o.onError(h.toError(e)),e}},staleTime:0,gcTime:0}),B=t.useMemo(()=>(g==null?void 0:g.Data)||[],[g]),f=t.useMemo(()=>(d==null?void 0:d.Count)||0,[d]),S=t.useMemo(()=>Math.ceil(f/a.pageSize),[f,a.pageSize]),U=t.useCallback(e=>{p(r=>{if(r.field===e){if(r.direction==="asc")return{field:e,direction:"desc"};if(r.direction==="desc")return{field:null,direction:null}}return{field:e,direction:"asc"}})},[]),J=t.useCallback(()=>{p({field:null,direction:null})},[]),V=t.useCallback((e,r)=>{p({field:e,direction:r})},[]),W=t.useCallback(e=>{if(e.length>255){console.warn("Search query exceeds maximum length of 255 characters");return}b(r=>({...r,query:e})),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{b(r=>({...r,debouncedQuery:e})),i(r=>({...r,pageNo:1}))},j)},[]),X=t.useCallback(()=>{c.current&&clearTimeout(c.current),b({query:"",debouncedQuery:""}),i(e=>({...e,pageNo:1}))},[]);t.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const m=a.pageNo<S,C=a.pageNo>1,Y=t.useCallback(()=>{m&&i(e=>({...e,pageNo:e.pageNo+1}))},[m]),Z=t.useCallback(()=>{C&&i(e=>({...e,pageNo:e.pageNo-1}))},[C]),$=t.useCallback(e=>{const r=Math.max(1,Math.min(e,S));i(y=>({...y,pageNo:r}))},[S]),v=t.useCallback(e=>{i(r=>({...r,pageSize:e,pageNo:1}))},[]),ee=t.useCallback(async()=>{const[e]=await Promise.all([E(),k()]);return e.data||{Data:[]}},[E,k]);return{rows:B,totalItems:f,isLoading:H||K,isFetching:I||_,error:q?h.toError(q):T?h.toError(T):null,search:{query:s.query,setQuery:W,clear:X},sort:{field:n.field,direction:n.direction,toggle:U,clear:J,set:V},filter:u,pagination:{pageNo:a.pageNo,pageSize:a.pageSize,totalPages:S,totalItems:f,canGoNext:m,canGoPrevious:C,goToNext:Y,goToPrevious:Z,goToPage:$,setPageSize:v},refetch:ee}}exports.useTable=oe;
|
package/dist/table.mjs
CHANGED
|
@@ -1,148 +1,165 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { useState as q, useRef as ne, useMemo as s, useCallback as o, useEffect as ie } from "react";
|
|
2
|
+
import { useQuery as G } from "@tanstack/react-query";
|
|
3
|
+
import { a as I } from "./client-V-WzUb8H.js";
|
|
4
|
+
import { t as p } from "./error-handling-CrhTtD88.js";
|
|
5
|
+
import { u as ce } from "./useFilter-H5bgAZQF.js";
|
|
6
|
+
function de(r) {
|
|
7
|
+
var w, F, x, R, D, L, M, A;
|
|
8
|
+
const [u, m] = q({
|
|
9
|
+
query: "",
|
|
10
|
+
debouncedQuery: ""
|
|
11
|
+
}), i = ne(null), K = 300, _ = () => {
|
|
12
|
+
var t, h;
|
|
13
|
+
const e = (t = r.initialState) == null ? void 0 : t.sort;
|
|
14
|
+
if (e && e.length > 0) {
|
|
15
|
+
const O = e[0], k = Object.keys(O)[0], oe = (h = O[k]) == null ? void 0 : h.toLowerCase();
|
|
16
|
+
return { field: k, direction: oe };
|
|
17
|
+
}
|
|
18
|
+
return { field: null, direction: null };
|
|
19
|
+
}, [c, N] = q(_), [n, a] = q({
|
|
20
|
+
pageNo: ((F = (w = r.initialState) == null ? void 0 : w.pagination) == null ? void 0 : F.pageNo) || 1,
|
|
21
|
+
pageSize: ((R = (x = r.initialState) == null ? void 0 : x.pagination) == null ? void 0 : R.pageSize) || 10
|
|
22
|
+
}), l = ce({
|
|
23
|
+
conditions: (L = (D = r.initialState) == null ? void 0 : D.filter) == null ? void 0 : L.conditions,
|
|
24
|
+
operator: ((A = (M = r.initialState) == null ? void 0 : M.filter) == null ? void 0 : A.operator) || "And"
|
|
25
|
+
}), g = s(() => {
|
|
19
26
|
const e = {};
|
|
20
|
-
return
|
|
21
|
-
}, [
|
|
22
|
-
const e = { ...
|
|
23
|
-
return
|
|
27
|
+
return u.debouncedQuery && (e.Search = u.debouncedQuery), l.payload && (e.Filter = l.payload), e;
|
|
28
|
+
}, [u.debouncedQuery, l.payload]), E = s(() => {
|
|
29
|
+
const e = { ...g };
|
|
30
|
+
return c.field && c.direction && (e.Sort = [
|
|
24
31
|
{
|
|
25
|
-
[String(
|
|
32
|
+
[String(c.field)]: c.direction === "asc" ? "ASC" : "DESC"
|
|
26
33
|
}
|
|
27
|
-
]),
|
|
28
|
-
}, [
|
|
29
|
-
data:
|
|
30
|
-
isLoading:
|
|
31
|
-
isFetching:
|
|
32
|
-
error:
|
|
33
|
-
refetch:
|
|
34
|
-
} =
|
|
35
|
-
queryKey: ["table",
|
|
34
|
+
]), e.Page = n.pageNo, e.PageSize = n.pageSize, e;
|
|
35
|
+
}, [g, c, n]), {
|
|
36
|
+
data: d,
|
|
37
|
+
isLoading: j,
|
|
38
|
+
isFetching: B,
|
|
39
|
+
error: z,
|
|
40
|
+
refetch: C
|
|
41
|
+
} = G({
|
|
42
|
+
queryKey: ["table", r.source, E],
|
|
36
43
|
queryFn: async () => {
|
|
37
44
|
try {
|
|
38
|
-
const e = await
|
|
39
|
-
return
|
|
45
|
+
const e = await I(r.source).list(E);
|
|
46
|
+
return r.onSuccess && r.onSuccess(e.Data), e;
|
|
40
47
|
} catch (e) {
|
|
41
|
-
throw
|
|
48
|
+
throw r.onError && r.onError(p(e)), e;
|
|
42
49
|
}
|
|
43
50
|
},
|
|
44
51
|
staleTime: 0,
|
|
45
52
|
gcTime: 0
|
|
46
53
|
}), {
|
|
47
54
|
data: f,
|
|
48
|
-
isLoading:
|
|
49
|
-
isFetching:
|
|
50
|
-
error:
|
|
51
|
-
refetch:
|
|
52
|
-
} =
|
|
53
|
-
queryKey: ["table-count",
|
|
55
|
+
isLoading: H,
|
|
56
|
+
isFetching: U,
|
|
57
|
+
error: P,
|
|
58
|
+
refetch: Q
|
|
59
|
+
} = G({
|
|
60
|
+
queryKey: ["table-count", r.source, g],
|
|
54
61
|
queryFn: async () => {
|
|
55
62
|
try {
|
|
56
|
-
return await
|
|
63
|
+
return await I(r.source).count(g);
|
|
57
64
|
} catch (e) {
|
|
58
|
-
throw
|
|
65
|
+
throw r.onError && r.onError(p(e)), e;
|
|
59
66
|
}
|
|
60
67
|
},
|
|
61
68
|
staleTime: 0,
|
|
62
69
|
gcTime: 0
|
|
63
|
-
}),
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
if (
|
|
70
|
+
}), J = s(() => (d == null ? void 0 : d.Data) || [], [d]), S = s(() => (f == null ? void 0 : f.Count) || 0, [f]), y = s(() => Math.ceil(S / n.pageSize), [S, n.pageSize]), V = o((e) => {
|
|
71
|
+
N((t) => {
|
|
72
|
+
if (t.field === e) {
|
|
73
|
+
if (t.direction === "asc")
|
|
67
74
|
return { field: e, direction: "desc" };
|
|
68
|
-
if (
|
|
75
|
+
if (t.direction === "desc")
|
|
69
76
|
return { field: null, direction: null };
|
|
70
77
|
}
|
|
71
78
|
return { field: e, direction: "asc" };
|
|
72
79
|
});
|
|
73
|
-
}, []),
|
|
74
|
-
|
|
75
|
-
}, []),
|
|
76
|
-
(e,
|
|
77
|
-
|
|
80
|
+
}, []), W = o(() => {
|
|
81
|
+
N({ field: null, direction: null });
|
|
82
|
+
}, []), X = o(
|
|
83
|
+
(e, t) => {
|
|
84
|
+
N({ field: e, direction: t });
|
|
78
85
|
},
|
|
79
86
|
[]
|
|
80
|
-
),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}, [
|
|
87
|
+
), Y = o((e) => {
|
|
88
|
+
if (e.length > 255) {
|
|
89
|
+
console.warn("Search query exceeds maximum length of 255 characters");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
m((t) => ({ ...t, query: e })), i.current && clearTimeout(i.current), i.current = setTimeout(() => {
|
|
93
|
+
m((t) => ({ ...t, debouncedQuery: e })), a((t) => ({ ...t, pageNo: 1 }));
|
|
94
|
+
}, K);
|
|
95
|
+
}, []), Z = o(() => {
|
|
96
|
+
i.current && clearTimeout(i.current), m({ query: "", debouncedQuery: "" }), a((e) => ({ ...e, pageNo: 1 }));
|
|
97
|
+
}, []);
|
|
98
|
+
ie(() => () => {
|
|
99
|
+
i.current && clearTimeout(i.current);
|
|
100
|
+
}, []);
|
|
101
|
+
const b = n.pageNo < y, T = n.pageNo > 1, $ = o(() => {
|
|
102
|
+
b && a((e) => ({ ...e, pageNo: e.pageNo + 1 }));
|
|
103
|
+
}, [b]), v = o(() => {
|
|
104
|
+
T && a((e) => ({ ...e, pageNo: e.pageNo - 1 }));
|
|
105
|
+
}, [T]), ee = o(
|
|
89
106
|
(e) => {
|
|
90
|
-
const
|
|
91
|
-
|
|
107
|
+
const t = Math.max(1, Math.min(e, y));
|
|
108
|
+
a((h) => ({ ...h, pageNo: t }));
|
|
92
109
|
},
|
|
93
|
-
[
|
|
94
|
-
),
|
|
95
|
-
|
|
96
|
-
...
|
|
110
|
+
[y]
|
|
111
|
+
), te = o((e) => {
|
|
112
|
+
a((t) => ({
|
|
113
|
+
...t,
|
|
97
114
|
pageSize: e,
|
|
98
115
|
pageNo: 1
|
|
99
116
|
}));
|
|
100
|
-
}, []),
|
|
101
|
-
const [e] = await Promise.all([
|
|
117
|
+
}, []), re = o(async () => {
|
|
118
|
+
const [e] = await Promise.all([C(), Q()]);
|
|
102
119
|
return e.data || { Data: [] };
|
|
103
|
-
}, [
|
|
120
|
+
}, [C, Q]);
|
|
104
121
|
return {
|
|
105
122
|
// Data
|
|
106
|
-
rows:
|
|
107
|
-
totalItems:
|
|
123
|
+
rows: J,
|
|
124
|
+
totalItems: S,
|
|
108
125
|
// Loading States
|
|
109
|
-
isLoading:
|
|
110
|
-
isFetching:
|
|
126
|
+
isLoading: j || H,
|
|
127
|
+
isFetching: B || U,
|
|
111
128
|
// Error Handling
|
|
112
|
-
error:
|
|
129
|
+
error: z ? p(z) : P ? p(P) : null,
|
|
113
130
|
// Search (Flat Access)
|
|
114
131
|
search: {
|
|
115
|
-
query:
|
|
116
|
-
setQuery:
|
|
117
|
-
clear:
|
|
132
|
+
query: u.query,
|
|
133
|
+
setQuery: Y,
|
|
134
|
+
clear: Z
|
|
118
135
|
},
|
|
119
136
|
// Sorting (Flat Access)
|
|
120
137
|
sort: {
|
|
121
|
-
field:
|
|
122
|
-
direction:
|
|
123
|
-
toggle:
|
|
124
|
-
clear:
|
|
125
|
-
set:
|
|
138
|
+
field: c.field,
|
|
139
|
+
direction: c.direction,
|
|
140
|
+
toggle: V,
|
|
141
|
+
clear: W,
|
|
142
|
+
set: X
|
|
126
143
|
},
|
|
127
144
|
// Filter (Simplified chainable API)
|
|
128
145
|
filter: l,
|
|
129
146
|
// Pagination (Flat Access)
|
|
130
147
|
pagination: {
|
|
131
|
-
|
|
132
|
-
pageSize:
|
|
133
|
-
totalPages:
|
|
134
|
-
totalItems:
|
|
135
|
-
canGoNext:
|
|
136
|
-
canGoPrevious:
|
|
137
|
-
goToNext:
|
|
138
|
-
goToPrevious:
|
|
139
|
-
goToPage:
|
|
140
|
-
setPageSize:
|
|
148
|
+
pageNo: n.pageNo,
|
|
149
|
+
pageSize: n.pageSize,
|
|
150
|
+
totalPages: y,
|
|
151
|
+
totalItems: S,
|
|
152
|
+
canGoNext: b,
|
|
153
|
+
canGoPrevious: T,
|
|
154
|
+
goToNext: $,
|
|
155
|
+
goToPrevious: v,
|
|
156
|
+
goToPage: ee,
|
|
157
|
+
setPageSize: te
|
|
141
158
|
},
|
|
142
159
|
// Operations
|
|
143
|
-
refetch:
|
|
160
|
+
refetch: re
|
|
144
161
|
};
|
|
145
162
|
}
|
|
146
163
|
export {
|
|
147
|
-
|
|
164
|
+
de as useTable
|
|
148
165
|
};
|
package/dist/table.types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { UseTableOptionsType, UseTableReturnType, ColumnDefinitionType, } from './components/hooks/useTable/types';
|
|
1
|
+
export type { UseTableOptionsType, UseTableReturnType, ColumnDefinitionType, PaginationStateType, } from './components/hooks/useTable/types';
|
|
2
2
|
//# sourceMappingURL=table.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.types.d.ts","sourceRoot":"","sources":["../sdk/table.types.ts"],"names":[],"mappings":"AAKA,YAAY,EAEV,mBAAmB,EACnB,kBAAkB,EAGlB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"table.types.d.ts","sourceRoot":"","sources":["../sdk/table.types.ts"],"names":[],"mappings":"AAKA,YAAY,EAEV,mBAAmB,EACnB,kBAAkB,EAGlB,oBAAoB,EAGpB,mBAAmB,GACpB,MAAM,mCAAmC,CAAC"}
|
package/dist/types/common.d.ts
CHANGED
|
@@ -27,14 +27,15 @@ export type ConditionGroupOperatorType = "And" | "Or" | "Not";
|
|
|
27
27
|
export type FilterRHSTypeType = "Constant" | "BOField" | "AppVariable";
|
|
28
28
|
/**
|
|
29
29
|
* Leaf condition (actual field comparison)
|
|
30
|
+
* @template T - Data type for type-safe field names (defaults to any)
|
|
30
31
|
*/
|
|
31
|
-
export interface ConditionType {
|
|
32
|
+
export interface ConditionType<T = any> {
|
|
32
33
|
/** Optional ID for hook state management (omitted in API payload) */
|
|
33
34
|
id?: string;
|
|
34
35
|
/** Condition operator */
|
|
35
36
|
Operator: ConditionOperatorType;
|
|
36
|
-
/** Left-hand side field name */
|
|
37
|
-
LHSField: string;
|
|
37
|
+
/** Left-hand side field name (keyof T when generic is provided) */
|
|
38
|
+
LHSField: T extends any ? keyof T | string : string;
|
|
38
39
|
/** Right-hand side value */
|
|
39
40
|
RHSValue: any;
|
|
40
41
|
/** Right-hand side type (optional, defaults to Constant) */
|
|
@@ -42,19 +43,21 @@ export interface ConditionType {
|
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
45
|
* Group combining conditions (recursive structure)
|
|
46
|
+
* @template T - Data type for type-safe field names (defaults to any)
|
|
45
47
|
*/
|
|
46
|
-
export interface ConditionGroupType {
|
|
48
|
+
export interface ConditionGroupType<T = any> {
|
|
47
49
|
/** Optional ID for hook state management (omitted in API payload) */
|
|
48
50
|
id?: string;
|
|
49
51
|
/** Group operator (And, Or, Not) */
|
|
50
52
|
Operator: ConditionGroupOperatorType;
|
|
51
53
|
/** Nested conditions (can be Condition or ConditionGroup) */
|
|
52
|
-
Condition: Array<ConditionType | ConditionGroupType
|
|
54
|
+
Condition: Array<ConditionType<T> | ConditionGroupType<T>>;
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* Root filter type (alias for ConditionGroup)
|
|
58
|
+
* @template T - Data type for type-safe field names (defaults to any)
|
|
56
59
|
*/
|
|
57
|
-
export type FilterType = ConditionGroupType
|
|
60
|
+
export type FilterType<T = any> = ConditionGroupType<T>;
|
|
58
61
|
/**
|
|
59
62
|
* DateTime encoding format used by the API
|
|
60
63
|
*/
|
|
@@ -228,4 +231,21 @@ export interface FetchFieldResponseType {
|
|
|
228
231
|
/** Array of field options */
|
|
229
232
|
Data: FetchFieldOptionType[];
|
|
230
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Column definition for data display and behavior
|
|
236
|
+
* Used by useTable and useKanban for defining field configurations
|
|
237
|
+
* @template T - Data type for type-safe field names
|
|
238
|
+
*/
|
|
239
|
+
export interface ColumnDefinitionType<T> {
|
|
240
|
+
/** Field name from the data type */
|
|
241
|
+
fieldId: keyof T;
|
|
242
|
+
/** Display label (optional, defaults to fieldId) */
|
|
243
|
+
label?: string;
|
|
244
|
+
/** Enable sorting for this field */
|
|
245
|
+
enableSorting?: boolean;
|
|
246
|
+
/** Enable filtering for this field */
|
|
247
|
+
enableFiltering?: boolean;
|
|
248
|
+
/** Custom transform function (overrides auto-formatting) */
|
|
249
|
+
transform?: (value: any, item: T) => React.ReactNode;
|
|
250
|
+
}
|
|
231
251
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../sdk/types/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,MAAM,CAAC;AAE/C;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAC7B,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GACzC,SAAS,GAAG,YAAY,GAAG,IAAI,GAA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S,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;CACtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const u=require("react"),d=t=>"Condition"in t,y=t=>"LHSField"in t;let A=0;const l=()=>{const t=Math.random().toString(36).substring(2,9);return`filter_${Date.now()}_${t}_${++A}`},M=t=>t.id?t:{...t,id:l()},k=t=>t.map(o=>{const n=M(o);return d(n)?{...n,Condition:k(n.Condition)}:n}),g=t=>t.map(o=>{if(d(o)){const{id:b,...C}=o;return{...C,Condition:g(o.Condition)}}const{id:n,...r}=o;return r}),h=(t,o)=>{for(const n of t){if(n.id===o)return n;if(d(n)){const r=h(n.Condition,o);if(r)return r}}},f=(t,o,n)=>t.map(r=>r.id===o?n(r):d(r)?{...r,Condition:f(r.Condition,o,n)}:r),O=(t,o)=>t.filter(n=>n.id!==o).map(n=>d(n)?{...n,Condition:O(n.Condition,o)}:n),p=(t,o,n)=>t.map(r=>r.id===o&&d(r)?{...r,Condition:[...r.Condition,n]}:d(r)?{...r,Condition:p(r.Condition,o,n)}:r);function R(t={}){const[o,n]=u.useState(()=>k(t.conditions||[])),[r,b]=u.useState(t.operator||"And"),C=u.useMemo(()=>{if(o.length!==0)return{Operator:r,Condition:g(o)}},[o,r]),G=o.length>0,S=u.useCallback((i,s)=>{const c=l(),e={...i,id:c};return n(s?a=>p(a,s,e):a=>[...a,e]),c},[]),v=u.useCallback((i,s)=>{const c=l(),e={id:c,Operator:i,Condition:[]};return n(s?a=>p(a,s,e):a=>[...a,e]),c},[]),F=u.useCallback((i,s)=>{n(c=>f(c,i,e=>d(e)?e:{...e,...s}))},[]),I=u.useCallback((i,s)=>{n(c=>f(c,i,e=>d(e)?{...e,Operator:s}:e))},[]),w=u.useCallback(i=>{n(s=>O(s,i))},[]),T=u.useCallback(i=>h(o,i),[o]),_=u.useCallback(()=>{n([])},[]),$=u.useCallback(i=>{b(i)},[]);return{operator:r,items:o,payload:C,hasConditions:G,addCondition:S,addConditionGroup:v,updateCondition:F,updateGroupOperator:I,removeCondition:w,getCondition:T,clearAllConditions:_,setRootOperator:$}}exports.isCondition=y;exports.isConditionGroup=d;exports.useFilter=R;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useState as h, useMemo as M, useCallback as c } from "react";
|
|
2
|
+
const u = (r) => "Condition" in r, D = (r) => "LHSField" in r;
|
|
3
|
+
let k = 0;
|
|
4
|
+
const f = () => {
|
|
5
|
+
const r = Math.random().toString(36).substring(2, 9);
|
|
6
|
+
return `filter_${Date.now()}_${r}_${++k}`;
|
|
7
|
+
}, x = (r) => r.id ? r : { ...r, id: f() }, O = (r) => r.map((o) => {
|
|
8
|
+
const n = x(o);
|
|
9
|
+
return u(n) ? {
|
|
10
|
+
...n,
|
|
11
|
+
Condition: O(n.Condition)
|
|
12
|
+
} : n;
|
|
13
|
+
}), v = (r) => r.map((o) => {
|
|
14
|
+
if (u(o)) {
|
|
15
|
+
const { id: g, ...C } = o;
|
|
16
|
+
return {
|
|
17
|
+
...C,
|
|
18
|
+
Condition: v(o.Condition)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const { id: n, ...t } = o;
|
|
22
|
+
return t;
|
|
23
|
+
}), G = (r, o) => {
|
|
24
|
+
for (const n of r) {
|
|
25
|
+
if (n.id === o)
|
|
26
|
+
return n;
|
|
27
|
+
if (u(n)) {
|
|
28
|
+
const t = G(n.Condition, o);
|
|
29
|
+
if (t) return t;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, p = (r, o, n) => r.map((t) => t.id === o ? n(t) : u(t) ? {
|
|
33
|
+
...t,
|
|
34
|
+
Condition: p(t.Condition, o, n)
|
|
35
|
+
} : t), I = (r, o) => r.filter((n) => n.id !== o).map((n) => u(n) ? {
|
|
36
|
+
...n,
|
|
37
|
+
Condition: I(n.Condition, o)
|
|
38
|
+
} : n), l = (r, o, n) => r.map((t) => t.id === o && u(t) ? {
|
|
39
|
+
...t,
|
|
40
|
+
Condition: [...t.Condition, n]
|
|
41
|
+
} : u(t) ? {
|
|
42
|
+
...t,
|
|
43
|
+
Condition: l(t.Condition, o, n)
|
|
44
|
+
} : t);
|
|
45
|
+
function H(r = {}) {
|
|
46
|
+
const [o, n] = h(
|
|
47
|
+
() => O(r.conditions || [])
|
|
48
|
+
), [t, g] = h(
|
|
49
|
+
r.operator || "And"
|
|
50
|
+
), C = M(() => {
|
|
51
|
+
if (o.length !== 0)
|
|
52
|
+
return {
|
|
53
|
+
Operator: t,
|
|
54
|
+
Condition: v(o)
|
|
55
|
+
};
|
|
56
|
+
}, [o, t]), S = o.length > 0, w = c(
|
|
57
|
+
(i, s) => {
|
|
58
|
+
const d = f(), e = { ...i, id: d };
|
|
59
|
+
return n(s ? (a) => l(a, s, e) : (a) => [...a, e]), d;
|
|
60
|
+
},
|
|
61
|
+
[]
|
|
62
|
+
), F = c(
|
|
63
|
+
(i, s) => {
|
|
64
|
+
const d = f(), e = {
|
|
65
|
+
id: d,
|
|
66
|
+
Operator: i,
|
|
67
|
+
Condition: []
|
|
68
|
+
};
|
|
69
|
+
return n(s ? (a) => l(a, s, e) : (a) => [...a, e]), d;
|
|
70
|
+
},
|
|
71
|
+
[]
|
|
72
|
+
), T = c(
|
|
73
|
+
(i, s) => {
|
|
74
|
+
n(
|
|
75
|
+
(d) => p(d, i, (e) => u(e) ? e : { ...e, ...s })
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
[]
|
|
79
|
+
), _ = c(
|
|
80
|
+
(i, s) => {
|
|
81
|
+
n(
|
|
82
|
+
(d) => p(d, i, (e) => u(e) ? { ...e, Operator: s } : e)
|
|
83
|
+
);
|
|
84
|
+
},
|
|
85
|
+
[]
|
|
86
|
+
), $ = c((i) => {
|
|
87
|
+
n((s) => I(s, i));
|
|
88
|
+
}, []), b = c(
|
|
89
|
+
(i) => G(o, i),
|
|
90
|
+
[o]
|
|
91
|
+
), y = c(() => {
|
|
92
|
+
n([]);
|
|
93
|
+
}, []), A = c((i) => {
|
|
94
|
+
g(i);
|
|
95
|
+
}, []);
|
|
96
|
+
return {
|
|
97
|
+
// State
|
|
98
|
+
operator: t,
|
|
99
|
+
items: o,
|
|
100
|
+
payload: C,
|
|
101
|
+
hasConditions: S,
|
|
102
|
+
// Add operations
|
|
103
|
+
addCondition: w,
|
|
104
|
+
addConditionGroup: F,
|
|
105
|
+
// Update operations
|
|
106
|
+
updateCondition: T,
|
|
107
|
+
updateGroupOperator: _,
|
|
108
|
+
// Remove & access
|
|
109
|
+
removeCondition: $,
|
|
110
|
+
getCondition: b,
|
|
111
|
+
// Utility
|
|
112
|
+
clearAllConditions: y,
|
|
113
|
+
setRootOperator: A
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
u as a,
|
|
118
|
+
D as i,
|
|
119
|
+
H as u
|
|
120
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ListOptionsType, FilterType, SortType } from "../../types/common";
|
|
2
|
+
/**
|
|
3
|
+
* Options for building list API request options
|
|
4
|
+
*/
|
|
5
|
+
export interface BuildListOptionsParams<T = any> {
|
|
6
|
+
/** Search query string */
|
|
7
|
+
search?: string;
|
|
8
|
+
/** Filter payload */
|
|
9
|
+
filter?: FilterType<T>;
|
|
10
|
+
/** Sort configuration */
|
|
11
|
+
sort?: {
|
|
12
|
+
field: keyof T | null;
|
|
13
|
+
direction: "asc" | "desc" | null;
|
|
14
|
+
};
|
|
15
|
+
/** Sort array in API format */
|
|
16
|
+
sortArray?: SortType;
|
|
17
|
+
/** Pagination settings */
|
|
18
|
+
pagination?: {
|
|
19
|
+
pageNo: number;
|
|
20
|
+
pageSize: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Build list options for count queries
|
|
25
|
+
* Excludes pagination and sorting (they don't affect count)
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildCountOptions<T = any>(params: Pick<BuildListOptionsParams<T>, "search" | "filter">): ListOptionsType;
|
|
28
|
+
/**
|
|
29
|
+
* Build list options for data queries
|
|
30
|
+
* Includes all options: search, filter, sort, pagination
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildListOptions<T = any>(params: BuildListOptionsParams<T>): ListOptionsType;
|
|
33
|
+
/**
|
|
34
|
+
* Combine filter payload with additional column filter
|
|
35
|
+
* Used for kanban column-specific queries
|
|
36
|
+
*/
|
|
37
|
+
export declare function combineFilters<T = any>(baseFilter: FilterType<T> | undefined, additionalCondition: {
|
|
38
|
+
LHSField: string;
|
|
39
|
+
Operator: string;
|
|
40
|
+
RHSValue: any;
|
|
41
|
+
RHSType?: string;
|
|
42
|
+
}): FilterType<T>;
|
|
43
|
+
//# sourceMappingURL=buildListOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildListOptions.d.ts","sourceRoot":"","sources":["../../../sdk/utils/api/buildListOptions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,GAAG;IAC7C,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACvB,yBAAyB;IACzB,IAAI,CAAC,EAAE;QACL,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;QACtB,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;KAClC,CAAC;IACF,+BAA+B;IAC/B,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,0BAA0B;IAC1B,UAAU,CAAC,EAAE;QACX,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,GAAG,EACvC,MAAM,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC,GAC3D,eAAe,CAYjB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,GAAG,EACtC,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAChC,eAAe,CAyBjB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,GAAG,GAAG,EACpC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,EACrC,mBAAmB,EAAE;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACA,UAAU,CAAC,CAAC,CAAC,CAyBf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../sdk/utils/api/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safely convert unknown error to Error object
|
|
3
|
+
* Handles all possible error types that could be thrown
|
|
4
|
+
*/
|
|
5
|
+
export declare function toError(err: unknown): Error;
|
|
6
|
+
/**
|
|
7
|
+
* Type guard to check if a value is an Error
|
|
8
|
+
*/
|
|
9
|
+
export declare function isError(value: unknown): value is Error;
|
|
10
|
+
/**
|
|
11
|
+
* Type guard to check if error has a specific code
|
|
12
|
+
*/
|
|
13
|
+
export declare function hasErrorCode(err: unknown, code: string): err is Error & {
|
|
14
|
+
code: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Type guard to check if error is a network error
|
|
18
|
+
*/
|
|
19
|
+
export declare function isNetworkError(err: unknown): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Type guard to check if error is a timeout error
|
|
22
|
+
*/
|
|
23
|
+
export declare function isTimeoutError(err: unknown): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Type guard to check if error is an abort error
|
|
26
|
+
*/
|
|
27
|
+
export declare function isAbortError(err: unknown): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Extract error message from unknown error
|
|
30
|
+
*/
|
|
31
|
+
export declare function getErrorMessage(err: unknown): string;
|
|
32
|
+
/**
|
|
33
|
+
* Safe error handler wrapper for async functions
|
|
34
|
+
* Returns a tuple of [result, error]
|
|
35
|
+
*/
|
|
36
|
+
export declare function tryCatch<T>(fn: () => Promise<T>): Promise<[T, null] | [null, Error]>;
|
|
37
|
+
/**
|
|
38
|
+
* Create a wrapped error with original error as cause
|
|
39
|
+
*/
|
|
40
|
+
export declare function wrapError(message: string, cause: unknown): Error;
|
|
41
|
+
//# sourceMappingURL=error-handling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../sdk/utils/error-handling.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CA0B3C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAEtD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,MAAM,GACX,GAAG,IAAI,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAMjC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAYpD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAQpD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIlD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAmBpD;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAC9B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAOpC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,CAUhE"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../sdk/utils/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAG7B,cAAc,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../sdk/utils/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAG7B,cAAc,MAAM,CAAC;AAGrB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,OAAO,CAAC"}
|