@ram_28/kf-ai-sdk 2.0.0 → 2.0.2
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 +36 -39
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/metadata.d.ts +26 -22
- package/dist/api/metadata.d.ts.map +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.mjs +3 -3
- package/dist/auth.cjs +1 -1
- package/dist/auth.mjs +2 -2
- package/dist/base-types.d.ts +1 -1
- package/dist/base-types.d.ts.map +1 -1
- package/dist/bdo/core/BaseBdo.d.ts +8 -20
- package/dist/bdo/core/BaseBdo.d.ts.map +1 -1
- package/dist/bdo/core/Item.d.ts +8 -44
- package/dist/bdo/core/Item.d.ts.map +1 -1
- package/dist/bdo/core/types.d.ts +124 -41
- package/dist/bdo/core/types.d.ts.map +1 -1
- package/dist/bdo/fields/ArrayField.d.ts +5 -4
- package/dist/bdo/fields/ArrayField.d.ts.map +1 -1
- package/dist/bdo/fields/BaseField.d.ts +14 -19
- package/dist/bdo/fields/BaseField.d.ts.map +1 -1
- package/dist/bdo/fields/BooleanField.d.ts +3 -4
- package/dist/bdo/fields/BooleanField.d.ts.map +1 -1
- package/dist/bdo/fields/DateField.d.ts +18 -0
- package/dist/bdo/fields/DateField.d.ts.map +1 -0
- package/dist/bdo/fields/DateTimeField.d.ts +5 -4
- package/dist/bdo/fields/DateTimeField.d.ts.map +1 -1
- package/dist/bdo/fields/FileField.d.ts +18 -0
- package/dist/bdo/fields/FileField.d.ts.map +1 -0
- package/dist/bdo/fields/NumberField.d.ts +6 -4
- package/dist/bdo/fields/NumberField.d.ts.map +1 -1
- package/dist/bdo/fields/ObjectField.d.ts +20 -0
- package/dist/bdo/fields/ObjectField.d.ts.map +1 -0
- package/dist/bdo/fields/ReferenceField.d.ts +13 -14
- package/dist/bdo/fields/ReferenceField.d.ts.map +1 -1
- package/dist/bdo/fields/SelectField.d.ts +10 -17
- package/dist/bdo/fields/SelectField.d.ts.map +1 -1
- package/dist/bdo/fields/StringField.d.ts +6 -4
- package/dist/bdo/fields/StringField.d.ts.map +1 -1
- package/dist/bdo/fields/TextAreaField.d.ts +2 -0
- package/dist/bdo/fields/TextAreaField.d.ts.map +1 -0
- package/dist/bdo/fields/TextField.d.ts +22 -0
- package/dist/bdo/fields/TextField.d.ts.map +1 -0
- package/dist/bdo/fields/UserField.d.ts +20 -0
- package/dist/bdo/fields/UserField.d.ts.map +1 -0
- package/dist/bdo/fields/index.d.ts +6 -0
- package/dist/bdo/fields/index.d.ts.map +1 -1
- package/dist/bdo/index.d.ts +2 -2
- package/dist/bdo/index.d.ts.map +1 -1
- package/dist/bdo.cjs +1 -1
- package/dist/bdo.d.ts +1 -5
- package/dist/bdo.d.ts.map +1 -1
- package/dist/bdo.mjs +349 -230
- package/dist/bdo.types.d.ts +2 -3
- package/dist/bdo.types.d.ts.map +1 -1
- package/dist/client-Bo-RLKJi.cjs +1 -0
- package/dist/client-eA4VvNTo.js +178 -0
- package/dist/components/hooks/useFilter/useFilter.d.ts.map +1 -1
- package/dist/components/hooks/useForm/createItemProxy.d.ts.map +1 -1
- package/dist/components/hooks/useForm/createResolver.d.ts +12 -2
- package/dist/components/hooks/useForm/createResolver.d.ts.map +1 -1
- package/dist/components/hooks/useForm/index.d.ts +1 -1
- package/dist/components/hooks/useForm/index.d.ts.map +1 -1
- package/dist/components/hooks/useForm/types.d.ts +62 -6
- package/dist/components/hooks/useForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useForm.d.ts +1 -27
- package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/components/hooks/useTable/useTable.d.ts.map +1 -1
- package/dist/{constants-DaX7GLgl.js → constants-CM9xOACN.js} +37 -13
- package/dist/constants-D0J69if5.cjs +1 -0
- package/dist/filter.cjs +1 -1
- package/dist/filter.mjs +2 -2
- package/dist/form.cjs +1 -1
- package/dist/form.d.ts +1 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/form.mjs +879 -809
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/{metadata-Bz8zJqC1.cjs → metadata-BN57S6W9.cjs} +1 -1
- package/dist/{metadata-VbQzyD2C.js → metadata-P7DGCgIG.js} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +74 -70
- package/dist/types/base-fields.d.ts +25 -60
- package/dist/types/base-fields.d.ts.map +1 -1
- package/dist/types/constants.d.ts +6 -0
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/useFilter-Bg0jvIL6.cjs +1 -0
- package/dist/useFilter-DPNLKY3H.js +118 -0
- package/dist/utils/formatting.d.ts +10 -1
- package/dist/utils/formatting.d.ts.map +1 -1
- package/docs/api.md +140 -572
- package/docs/bdo.md +742 -0
- package/docs/useAuth.md +10 -4
- package/docs/useFilter.md +40 -40
- package/docs/useForm.md +91 -62
- package/docs/useTable.md +38 -38
- package/package.json +1 -1
- package/sdk/api/client.ts +52 -65
- package/sdk/api/metadata.ts +22 -20
- package/sdk/base-types.ts +9 -9
- package/sdk/bdo/core/BaseBdo.ts +13 -38
- package/sdk/bdo/core/Item.ts +34 -56
- package/sdk/bdo/core/types.ts +147 -45
- package/sdk/bdo/fields/ArrayField.ts +9 -5
- package/sdk/bdo/fields/BaseField.ts +19 -29
- package/sdk/bdo/fields/BooleanField.ts +4 -5
- package/sdk/bdo/fields/DateField.ts +55 -0
- package/sdk/bdo/fields/DateTimeField.ts +9 -5
- package/sdk/bdo/fields/FileField.ts +39 -0
- package/sdk/bdo/fields/NumberField.ts +8 -5
- package/sdk/bdo/fields/ObjectField.ts +46 -0
- package/sdk/bdo/fields/ReferenceField.ts +22 -28
- package/sdk/bdo/fields/SelectField.ts +15 -28
- package/sdk/bdo/fields/StringField.ts +10 -5
- package/sdk/bdo/fields/TextAreaField.ts +6 -0
- package/sdk/bdo/fields/TextField.ts +42 -0
- package/sdk/bdo/fields/UserField.ts +52 -0
- package/sdk/bdo/fields/index.ts +6 -0
- package/sdk/bdo/index.ts +19 -4
- package/sdk/bdo.ts +7 -28
- package/sdk/bdo.types.ts +26 -21
- package/sdk/components/hooks/useFilter/useFilter.ts +13 -30
- package/sdk/components/hooks/useForm/createItemProxy.ts +47 -11
- package/sdk/components/hooks/useForm/createResolver.ts +65 -6
- package/sdk/components/hooks/useForm/index.ts +3 -0
- package/sdk/components/hooks/useForm/types.ts +75 -6
- package/sdk/components/hooks/useForm/useForm.ts +35 -50
- package/sdk/components/hooks/useTable/useTable.ts +10 -2
- package/sdk/form.ts +1 -12
- package/sdk/index.ts +3 -3
- package/sdk/types/base-fields.ts +29 -73
- package/sdk/types/constants.ts +6 -0
- package/sdk/utils/formatting.ts +13 -1
- package/dist/client-BIkaIr2y.js +0 -217
- package/dist/client-DxjRcEtN.cjs +0 -1
- package/dist/constants-C49b9Exc.cjs +0 -1
- package/dist/useFilter-DzpP_ag0.cjs +0 -1
- package/dist/useFilter-H5bgAZQF.js +0 -120
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { AuthProvider, useAuth } from './auth';
|
|
|
6
6
|
export type { UseAuthReturnType, UserDetailsType, AuthStatusType, AuthProviderPropsType, } from './auth/types';
|
|
7
7
|
export { api, setApiBaseUrl, getApiBaseUrl, getBdoSchema } from './api';
|
|
8
8
|
export type { SortType, SortDirectionType, FilterType, ConditionType, ConditionGroupType, ConditionOperatorType, ConditionGroupOperatorType, ListResponseType, ListOptionsType, ColumnDefinitionType, } from './types/common';
|
|
9
|
-
export type { StringFieldType, TextAreaFieldType, NumberFieldType,
|
|
9
|
+
export type { StringFieldType, TextFieldType, TextAreaFieldType, NumberFieldType, BooleanFieldType, DateFieldType, DateTimeFieldType, SelectFieldType, ArrayFieldType, ReferenceFieldType, ExtractReferenceType, ExtractFetchFieldType, UserFieldType, FileFieldType, } from './types/base-fields';
|
|
10
10
|
export { formatCurrency, formatDate, formatDateTime, formatNumber, formatBoolean, formatArray, formatJSON, formatFieldValue, } from './utils/formatting';
|
|
11
11
|
export { cn } from './utils/cn';
|
|
12
12
|
export { toError, isError, getErrorMessage, isNetworkError, isTimeoutError, isAbortError, tryCatch, wrapError, } from './utils/error-handling';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../sdk/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,YAAY,EACV,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACxF,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC/C,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAOxE,YAAY,EACV,QAAQ,EACR,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../sdk/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,YAAY,EACV,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACx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require("./client-
|
|
1
|
+
"use strict";const o=require("./client-Bo-RLKJi.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 o=require("react"),L=require("@tanstack/react-query"),x=require("./client-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),L=require("@tanstack/react-query"),x=require("./client-Bo-RLKJi.cjs"),oe=require("./useFilter-Bg0jvIL6.cjs"),l=require("./constants-D0J69if5.cjs");function b(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t!==null&&typeof t=="object"&&"message"in t&&typeof t.message=="string"){const i=new Error(t.message);return Object.assign(i,t),i}return new Error(String(t))}function ne(t){var k,w,R,z,M,P,Q,D;const[i,h]=o.useState({query:"",debouncedQuery:"",field:null}),c=o.useRef(null),j=300,G=()=>{var r,n;const e=(r=t.initialState)==null?void 0:r.sort;if(e&&e.length>0){const A=e[0],H=Object.keys(A)[0],re=(n=A[H])==null?void 0:n.toLowerCase();return{field:H,direction:re}}return{field:null,direction:null}},[s,C]=o.useState(G),[a,u]=o.useState({pageNo:((w=(k=t.initialState)==null?void 0:k.pagination)==null?void 0:w.pageNo)||1,pageSize:((z=(R=t.initialState)==null?void 0:R.pagination)==null?void 0:z.pageSize)||10}),d=oe.useFilter({conditions:(P=(M=t.initialState)==null?void 0:M.filter)==null?void 0:P.conditions,operator:((D=(Q=t.initialState)==null?void 0:Q.filter)==null?void 0:D.operator)||"And"});o.useEffect(()=>{u(e=>({...e,pageNo:1}))},[d.payload]);const g=o.useMemo(()=>{const e={};let r=d.payload;if(i.debouncedQuery&&i.field){const n={LHSField:i.field,Operator:"Contains",RHSValue:i.debouncedQuery,RHSType:"Constant"};r?r.Operator==="And"?r={...r,Condition:[...r.Condition||[],n]}:r={Operator:"And",Condition:[r,n]}:r={Operator:"And",Condition:[n]}}return r&&(e.Filter=r),e},[i.debouncedQuery,i.field,d.payload]),T=o.useMemo(()=>{const e={...g};return s.field&&s.direction&&(e.Sort=[{[String(s.field)]:s.direction==="asc"?"ASC":"DESC"}]),e.Page=a.pageNo,e.PageSize=a.pageSize,e},[g,s,a]),{data:f,isLoading:I,isFetching:K,error:E,refetch:O}=L.useQuery({queryKey:["table",t.source,T],queryFn:async()=>{try{const e=await x.api(t.source).list(T);return t.onSuccess&&t.onSuccess(e.Data),e}catch(e){throw t.onError&&t.onError(b(e)),e}},staleTime:0,gcTime:30*1e3}),{data:S,isLoading:_,isFetching:B,error:q,refetch:F}=L.useQuery({queryKey:["table-count",t.source,g],queryFn:async()=>{try{return await x.api(t.source).count(g)}catch(e){throw t.onError&&t.onError(b(e)),e}},staleTime:0,gcTime:30*1e3}),U=o.useMemo(()=>(f==null?void 0:f.Data)||[],[f]),p=o.useMemo(()=>(S==null?void 0:S.Count)||0,[S]),y=o.useMemo(()=>Math.ceil(p/a.pageSize),[p,a.pageSize]),V=o.useCallback(e=>{C(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=o.useCallback(()=>{C({field:null,direction:null})},[]),W=o.useCallback((e,r)=>{C({field:e,direction:r})},[]),X=o.useCallback((e,r)=>{if(r.length>255){console.warn("Search query exceeds maximum length of 255 characters");return}h(n=>({...n,query:r,field:e})),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{h(n=>({...n,debouncedQuery:r})),u(n=>({...n,pageNo:1}))},j)},[]),Y=o.useCallback(()=>{c.current&&clearTimeout(c.current),h({query:"",debouncedQuery:"",field:null}),u(e=>({...e,pageNo:1}))},[]);o.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const m=a.pageNo<y,N=a.pageNo>1,Z=o.useCallback(()=>{m&&u(e=>({...e,pageNo:e.pageNo+1}))},[m]),$=o.useCallback(()=>{N&&u(e=>({...e,pageNo:e.pageNo-1}))},[N]),v=o.useCallback(e=>{const r=Math.max(1,Math.min(e,y));u(n=>({...n,pageNo:r}))},[y]),ee=o.useCallback(e=>{u(r=>({...r,pageSize:e,pageNo:1}))},[]),te=o.useCallback(async()=>{const[e]=await Promise.all([O(),F()]);return e.data||{Data:[]}},[O,F]);return{rows:U,totalItems:p,isLoading:I||_,isFetching:K||B,error:E?b(E):q?b(q):null,search:{query:i.query,field:i.field,set:X,clear:Y},sort:{field:s.field,direction:s.direction,toggle:V,clear:J,set:W},filter:d,pagination:{pageNo:a.pageNo,pageSize:a.pageSize,totalPages:y,totalItems:p,canGoNext:m,canGoPrevious:N,goToNext:Z,goToPrevious:$,goToPage:v,setPageSize:ee},refetch:te}}exports.ConditionOperator=l.ConditionOperator;exports.GroupOperator=l.GroupOperator;exports.RHSType=l.RHSType;exports.SortDirection=l.SortDirection;exports.TableDefaults=l.Defaults;exports.useTable=ne;
|
package/dist/table.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useState as E, useRef as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { a as
|
|
4
|
-
import { u as ae } from "./useFilter-
|
|
5
|
-
import { C as Se, G as pe, R as ye, S as me, b as he } from "./constants-
|
|
6
|
-
function
|
|
1
|
+
import { useState as E, useRef as ie, useEffect as G, useMemo as l, useCallback as i } from "react";
|
|
2
|
+
import { useQuery as j } from "@tanstack/react-query";
|
|
3
|
+
import { a as k } from "./client-eA4VvNTo.js";
|
|
4
|
+
import { u as ae } from "./useFilter-DPNLKY3H.js";
|
|
5
|
+
import { C as Se, G as pe, R as ye, S as me, b as he } from "./constants-CM9xOACN.js";
|
|
6
|
+
function m(t) {
|
|
7
7
|
if (t instanceof Error)
|
|
8
8
|
return t;
|
|
9
9
|
if (typeof t == "string")
|
|
@@ -16,27 +16,31 @@ function y(t) {
|
|
|
16
16
|
}
|
|
17
17
|
function ge(t) {
|
|
18
18
|
var R, P, q, A, Q, x, D, L;
|
|
19
|
-
const [n,
|
|
19
|
+
const [n, h] = E({
|
|
20
20
|
query: "",
|
|
21
21
|
debouncedQuery: "",
|
|
22
22
|
field: null
|
|
23
|
-
}), c =
|
|
23
|
+
}), c = ie(null), I = 300, K = () => {
|
|
24
24
|
var r, o;
|
|
25
25
|
const e = (r = t.initialState) == null ? void 0 : r.sort;
|
|
26
26
|
if (e && e.length > 0) {
|
|
27
|
-
const H = e[0], M = Object.keys(H)[0],
|
|
28
|
-
return { field: M, direction:
|
|
27
|
+
const H = e[0], M = Object.keys(H)[0], ne = (o = H[M]) == null ? void 0 : o.toLowerCase();
|
|
28
|
+
return { field: M, direction: ne };
|
|
29
29
|
}
|
|
30
30
|
return { field: null, direction: null };
|
|
31
|
-
}, [s,
|
|
31
|
+
}, [s, C] = E(K), [a, u] = E({
|
|
32
32
|
pageNo: ((P = (R = t.initialState) == null ? void 0 : R.pagination) == null ? void 0 : P.pageNo) || 1,
|
|
33
33
|
pageSize: ((A = (q = t.initialState) == null ? void 0 : q.pagination) == null ? void 0 : A.pageSize) || 10
|
|
34
|
-
}),
|
|
34
|
+
}), g = ae({
|
|
35
35
|
conditions: (x = (Q = t.initialState) == null ? void 0 : Q.filter) == null ? void 0 : x.conditions,
|
|
36
36
|
operator: ((L = (D = t.initialState) == null ? void 0 : D.filter) == null ? void 0 : L.operator) || "And"
|
|
37
|
-
})
|
|
37
|
+
});
|
|
38
|
+
G(() => {
|
|
39
|
+
u((e) => ({ ...e, pageNo: 1 }));
|
|
40
|
+
}, [g.payload]);
|
|
41
|
+
const d = l(() => {
|
|
38
42
|
const e = {};
|
|
39
|
-
let r =
|
|
43
|
+
let r = g.payload;
|
|
40
44
|
if (n.debouncedQuery && n.field) {
|
|
41
45
|
const o = {
|
|
42
46
|
LHSField: n.field,
|
|
@@ -56,50 +60,50 @@ function ge(t) {
|
|
|
56
60
|
};
|
|
57
61
|
}
|
|
58
62
|
return r && (e.Filter = r), e;
|
|
59
|
-
}, [n.debouncedQuery, n.field,
|
|
60
|
-
const e = { ...
|
|
63
|
+
}, [n.debouncedQuery, n.field, g.payload]), T = l(() => {
|
|
64
|
+
const e = { ...d };
|
|
61
65
|
return s.field && s.direction && (e.Sort = [
|
|
62
66
|
{
|
|
63
67
|
[String(s.field)]: s.direction === "asc" ? "ASC" : "DESC"
|
|
64
68
|
}
|
|
65
69
|
]), e.Page = a.pageNo, e.PageSize = a.pageSize, e;
|
|
66
|
-
}, [
|
|
67
|
-
data:
|
|
68
|
-
isLoading:
|
|
69
|
-
isFetching:
|
|
70
|
+
}, [d, s, a]), {
|
|
71
|
+
data: f,
|
|
72
|
+
isLoading: _,
|
|
73
|
+
isFetching: B,
|
|
70
74
|
error: w,
|
|
71
75
|
refetch: F
|
|
72
|
-
} =
|
|
76
|
+
} = j({
|
|
73
77
|
queryKey: ["table", t.source, T],
|
|
74
78
|
queryFn: async () => {
|
|
75
79
|
try {
|
|
76
|
-
const e = await
|
|
80
|
+
const e = await k(t.source).list(T);
|
|
77
81
|
return t.onSuccess && t.onSuccess(e.Data), e;
|
|
78
82
|
} catch (e) {
|
|
79
|
-
throw t.onError && t.onError(
|
|
83
|
+
throw t.onError && t.onError(m(e)), e;
|
|
80
84
|
}
|
|
81
85
|
},
|
|
82
86
|
staleTime: 0,
|
|
83
|
-
gcTime:
|
|
87
|
+
gcTime: 30 * 1e3
|
|
84
88
|
}), {
|
|
85
|
-
data:
|
|
86
|
-
isLoading:
|
|
87
|
-
isFetching:
|
|
89
|
+
data: S,
|
|
90
|
+
isLoading: U,
|
|
91
|
+
isFetching: V,
|
|
88
92
|
error: O,
|
|
89
93
|
refetch: z
|
|
90
|
-
} =
|
|
91
|
-
queryKey: ["table-count", t.source,
|
|
94
|
+
} = j({
|
|
95
|
+
queryKey: ["table-count", t.source, d],
|
|
92
96
|
queryFn: async () => {
|
|
93
97
|
try {
|
|
94
|
-
return await
|
|
98
|
+
return await k(t.source).count(d);
|
|
95
99
|
} catch (e) {
|
|
96
|
-
throw t.onError && t.onError(
|
|
100
|
+
throw t.onError && t.onError(m(e)), e;
|
|
97
101
|
}
|
|
98
102
|
},
|
|
99
103
|
staleTime: 0,
|
|
100
|
-
gcTime:
|
|
101
|
-
}),
|
|
102
|
-
|
|
104
|
+
gcTime: 30 * 1e3
|
|
105
|
+
}), J = l(() => (f == null ? void 0 : f.Data) || [], [f]), p = l(() => (S == null ? void 0 : S.Count) || 0, [S]), y = l(() => Math.ceil(p / a.pageSize), [p, a.pageSize]), W = i((e) => {
|
|
106
|
+
C((r) => {
|
|
103
107
|
if (r.field === e) {
|
|
104
108
|
if (r.direction === "asc")
|
|
105
109
|
return { field: e, direction: "desc" };
|
|
@@ -108,88 +112,88 @@ function ge(t) {
|
|
|
108
112
|
}
|
|
109
113
|
return { field: e, direction: "asc" };
|
|
110
114
|
});
|
|
111
|
-
}, []),
|
|
112
|
-
|
|
113
|
-
}, []),
|
|
115
|
+
}, []), X = i(() => {
|
|
116
|
+
C({ field: null, direction: null });
|
|
117
|
+
}, []), Y = i(
|
|
114
118
|
(e, r) => {
|
|
115
|
-
|
|
119
|
+
C({ field: e, direction: r });
|
|
116
120
|
},
|
|
117
121
|
[]
|
|
118
|
-
),
|
|
122
|
+
), Z = i((e, r) => {
|
|
119
123
|
if (r.length > 255) {
|
|
120
124
|
console.warn("Search query exceeds maximum length of 255 characters");
|
|
121
125
|
return;
|
|
122
126
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
}, []),
|
|
127
|
-
c.current && clearTimeout(c.current),
|
|
127
|
+
h((o) => ({ ...o, query: r, field: e })), c.current && clearTimeout(c.current), c.current = setTimeout(() => {
|
|
128
|
+
h((o) => ({ ...o, debouncedQuery: r })), u((o) => ({ ...o, pageNo: 1 }));
|
|
129
|
+
}, I);
|
|
130
|
+
}, []), $ = i(() => {
|
|
131
|
+
c.current && clearTimeout(c.current), h({ query: "", debouncedQuery: "", field: null }), u((e) => ({ ...e, pageNo: 1 }));
|
|
128
132
|
}, []);
|
|
129
|
-
|
|
133
|
+
G(() => () => {
|
|
130
134
|
c.current && clearTimeout(c.current);
|
|
131
135
|
}, []);
|
|
132
|
-
const N = a.pageNo <
|
|
136
|
+
const N = a.pageNo < y, b = a.pageNo > 1, v = i(() => {
|
|
133
137
|
N && u((e) => ({ ...e, pageNo: e.pageNo + 1 }));
|
|
134
|
-
}, [N]),
|
|
138
|
+
}, [N]), ee = i(() => {
|
|
135
139
|
b && u((e) => ({ ...e, pageNo: e.pageNo - 1 }));
|
|
136
|
-
}, [b]),
|
|
140
|
+
}, [b]), te = i(
|
|
137
141
|
(e) => {
|
|
138
|
-
const r = Math.max(1, Math.min(e,
|
|
142
|
+
const r = Math.max(1, Math.min(e, y));
|
|
139
143
|
u((o) => ({ ...o, pageNo: r }));
|
|
140
144
|
},
|
|
141
|
-
[
|
|
142
|
-
),
|
|
145
|
+
[y]
|
|
146
|
+
), re = i((e) => {
|
|
143
147
|
u((r) => ({
|
|
144
148
|
...r,
|
|
145
149
|
pageSize: e,
|
|
146
150
|
pageNo: 1
|
|
147
151
|
}));
|
|
148
|
-
}, []),
|
|
152
|
+
}, []), oe = i(async () => {
|
|
149
153
|
const [e] = await Promise.all([F(), z()]);
|
|
150
154
|
return e.data || { Data: [] };
|
|
151
155
|
}, [F, z]);
|
|
152
156
|
return {
|
|
153
157
|
// Data
|
|
154
|
-
rows:
|
|
155
|
-
totalItems:
|
|
158
|
+
rows: J,
|
|
159
|
+
totalItems: p,
|
|
156
160
|
// Loading States
|
|
157
|
-
isLoading:
|
|
158
|
-
isFetching:
|
|
161
|
+
isLoading: _ || U,
|
|
162
|
+
isFetching: B || V,
|
|
159
163
|
// Error Handling
|
|
160
|
-
error: w ?
|
|
164
|
+
error: w ? m(w) : O ? m(O) : null,
|
|
161
165
|
// Search (Flat Access)
|
|
162
166
|
search: {
|
|
163
167
|
query: n.query,
|
|
164
168
|
field: n.field,
|
|
165
|
-
set:
|
|
166
|
-
clear:
|
|
169
|
+
set: Z,
|
|
170
|
+
clear: $
|
|
167
171
|
},
|
|
168
172
|
// Sorting (Flat Access)
|
|
169
173
|
sort: {
|
|
170
174
|
field: s.field,
|
|
171
175
|
direction: s.direction,
|
|
172
|
-
toggle:
|
|
173
|
-
clear:
|
|
174
|
-
set:
|
|
176
|
+
toggle: W,
|
|
177
|
+
clear: X,
|
|
178
|
+
set: Y
|
|
175
179
|
},
|
|
176
180
|
// Filter (Simplified chainable API)
|
|
177
|
-
filter:
|
|
181
|
+
filter: g,
|
|
178
182
|
// Pagination (Flat Access)
|
|
179
183
|
pagination: {
|
|
180
184
|
pageNo: a.pageNo,
|
|
181
185
|
pageSize: a.pageSize,
|
|
182
|
-
totalPages:
|
|
183
|
-
totalItems:
|
|
186
|
+
totalPages: y,
|
|
187
|
+
totalItems: p,
|
|
184
188
|
canGoNext: N,
|
|
185
189
|
canGoPrevious: b,
|
|
186
|
-
goToNext:
|
|
187
|
-
goToPrevious:
|
|
188
|
-
goToPage:
|
|
189
|
-
setPageSize:
|
|
190
|
+
goToNext: v,
|
|
191
|
+
goToPrevious: ee,
|
|
192
|
+
goToPage: te,
|
|
193
|
+
setPageSize: re
|
|
190
194
|
},
|
|
191
195
|
// Operations
|
|
192
|
-
refetch:
|
|
196
|
+
refetch: oe
|
|
193
197
|
};
|
|
194
198
|
}
|
|
195
199
|
export {
|
|
@@ -13,15 +13,17 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export type StringFieldType<T extends string = string, _MinLength extends number = never, _MaxLength extends number = never> = T;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Text field for longer content (replaces TextAreaFieldType)
|
|
17
17
|
* Resolves to: string
|
|
18
18
|
* Storage: TEXT in database
|
|
19
19
|
* Use this for descriptions, comments, rich text content
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* TextAreaFieldType // => string (multi-line)
|
|
23
20
|
*/
|
|
24
|
-
export type
|
|
21
|
+
export type TextFieldType = string;
|
|
22
|
+
/**
|
|
23
|
+
* Multi-line text field (deprecated alias for TextFieldType)
|
|
24
|
+
* @deprecated Use TextFieldType instead
|
|
25
|
+
*/
|
|
26
|
+
export type TextAreaFieldType = TextFieldType;
|
|
25
27
|
/**
|
|
26
28
|
* Numeric field with optional precision constraints
|
|
27
29
|
* @template Precision - Number of decimal places (optional)
|
|
@@ -34,16 +36,6 @@ export type TextAreaFieldType = string;
|
|
|
34
36
|
* NumberFieldType<2> // => number with 2 decimal places
|
|
35
37
|
*/
|
|
36
38
|
export type NumberFieldType<_Precision extends number = never> = number;
|
|
37
|
-
/**
|
|
38
|
-
* Large integer field for big numbers
|
|
39
|
-
* Resolves to: number
|
|
40
|
-
* Storage: BIGINT in database
|
|
41
|
-
* Use this for large counters, timestamps, file sizes
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* LongFieldType // => number (large integer)
|
|
45
|
-
*/
|
|
46
|
-
export type LongFieldType = number;
|
|
47
39
|
/**
|
|
48
40
|
* Boolean field
|
|
49
41
|
* Resolves to: boolean
|
|
@@ -91,35 +83,6 @@ type Second = number;
|
|
|
91
83
|
* "2026-01-23T01:21:33"
|
|
92
84
|
*/
|
|
93
85
|
export type DateTimeFieldType = `${Year}-${Month}-${Day}T${Hour}:${Minute}:${Second}`;
|
|
94
|
-
/**
|
|
95
|
-
* Currency field supporting multiple value formats
|
|
96
|
-
* Resolves to: CurrencyValueType
|
|
97
|
-
* Storage: JSON/VARCHAR in database
|
|
98
|
-
* Use this for prices, monetary amounts, financial data
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* CurrencyFieldType // => {value: number, currency: string} | string
|
|
102
|
-
*/
|
|
103
|
-
export type CurrencyFieldType = CurrencyValueType;
|
|
104
|
-
/**
|
|
105
|
-
* Currency value format - supports both object and string representations
|
|
106
|
-
*/
|
|
107
|
-
export type CurrencyValueType = {
|
|
108
|
-
value: number;
|
|
109
|
-
currency: string;
|
|
110
|
-
} | string;
|
|
111
|
-
/**
|
|
112
|
-
* JSON field for structured data
|
|
113
|
-
* @template T - Expected JSON structure (optional)
|
|
114
|
-
* Resolves to: T or JSONValueType
|
|
115
|
-
* Storage: JSON/TEXT in database
|
|
116
|
-
* Use this for configurations, metadata, flexible schemas
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* JSONFieldType // => JSONValueType (any valid JSON)
|
|
120
|
-
* JSONFieldType<{settings: {theme: string}}> // => {settings: {theme: string}}
|
|
121
|
-
*/
|
|
122
|
-
export type JSONFieldType<T = JSONValueType> = T;
|
|
123
86
|
/**
|
|
124
87
|
* Reference/Lookup field for relationships to other Business Data Objects
|
|
125
88
|
*
|
|
@@ -163,15 +126,6 @@ export type ExtractFetchFieldType<T> = T extends {
|
|
|
163
126
|
Value: string;
|
|
164
127
|
Label: string;
|
|
165
128
|
};
|
|
166
|
-
/**
|
|
167
|
-
* Valid JSON value types
|
|
168
|
-
*/
|
|
169
|
-
export type JSONValueType = string | number | boolean | null | JSONObjectType | JSONArrayType;
|
|
170
|
-
export interface JSONObjectType {
|
|
171
|
-
[key: string]: JSONValueType;
|
|
172
|
-
}
|
|
173
|
-
export interface JSONArrayType extends Array<JSONValueType> {
|
|
174
|
-
}
|
|
175
129
|
/**
|
|
176
130
|
* Select field for single choice from predefined options
|
|
177
131
|
* @template T - Union of allowed option values
|
|
@@ -182,7 +136,20 @@ export interface JSONArrayType extends Array<JSONValueType> {
|
|
|
182
136
|
* @example
|
|
183
137
|
* SelectFieldType<'active' | 'inactive' | 'pending'> // => 'active' | 'inactive' | 'pending'
|
|
184
138
|
*/
|
|
185
|
-
export type SelectFieldType<T extends string> = T;
|
|
139
|
+
export type SelectFieldType<T extends string | number = string> = T;
|
|
140
|
+
/**
|
|
141
|
+
* User field for user references
|
|
142
|
+
* Resolves to: { _id: string; _name: string }
|
|
143
|
+
*/
|
|
144
|
+
export type UserFieldType = {
|
|
145
|
+
_id: string;
|
|
146
|
+
_name: string;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* File field for file attachments
|
|
150
|
+
* Resolves to: Record<string, unknown>
|
|
151
|
+
*/
|
|
152
|
+
export type FileFieldType = Record<string, unknown>;
|
|
186
153
|
/**
|
|
187
154
|
* Array field with MultiValue support
|
|
188
155
|
* @template T - Type of array elements
|
|
@@ -225,11 +192,9 @@ export type OptionalFieldType<T> = T | undefined;
|
|
|
225
192
|
export type ExtractFieldType<T> = T extends OptionalFieldType<infer U> ? U : T;
|
|
226
193
|
/**
|
|
227
194
|
* User reference type for _created_by / _modified_by fields
|
|
195
|
+
* @deprecated Use UserFieldType instead
|
|
228
196
|
*/
|
|
229
|
-
export type UserRefType =
|
|
230
|
-
_id: StringFieldType;
|
|
231
|
-
username: StringFieldType;
|
|
232
|
-
};
|
|
197
|
+
export type UserRefType = UserFieldType;
|
|
233
198
|
/**
|
|
234
199
|
* System fields type - use with intersection (&) in entity types
|
|
235
200
|
* Contains all 7 system-managed fields that every BDO has.
|
|
@@ -245,8 +210,8 @@ export type SystemFieldsType = {
|
|
|
245
210
|
_id: StringFieldType;
|
|
246
211
|
_created_at: DateTimeFieldType;
|
|
247
212
|
_modified_at: DateTimeFieldType;
|
|
248
|
-
_created_by:
|
|
249
|
-
_modified_by:
|
|
213
|
+
_created_by: UserFieldType;
|
|
214
|
+
_modified_by: UserFieldType;
|
|
250
215
|
_version: StringFieldType;
|
|
251
216
|
_m_version: StringFieldType;
|
|
252
217
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-fields.d.ts","sourceRoot":"","sources":["../../sdk/types/base-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe,CACzB,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,UAAU,SAAS,MAAM,GAAG,KAAK,EACjC,UAAU,SAAS,MAAM,GAAG,KAAK,IAC/B,CAAC,CAAC;AAEN
|
|
1
|
+
{"version":3,"file":"base-fields.d.ts","sourceRoot":"","sources":["../../sdk/types/base-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe,CACzB,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,UAAU,SAAS,MAAM,GAAG,KAAK,EACjC,UAAU,SAAS,MAAM,GAAG,KAAK,IAC/B,CAAC,CAAC;AAEN;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,CAAC,UAAU,SAAS,MAAM,GAAG,KAAK,IAAI,MAAM,CAAC;AAExE;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAEvC;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,KAAK,IAAI,GAAG,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG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|
231
231
|
/** Activity flow field */
|
|
232
232
|
readonly ActivityFlow: "ActivityFlow";
|
|
233
|
+
/** Multi-line text field */
|
|
234
|
+
readonly TextArea: "TextArea";
|
|
235
|
+
/** Secret/password field */
|
|
236
|
+
readonly Secret: "Secret";
|
|
237
|
+
/** User reference field */
|
|
238
|
+
readonly User: "User";
|
|
233
239
|
};
|
|
234
240
|
/**
|
|
235
241
|
* Form input types for rendering
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../sdk/types/constants.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB;IAC5B,YAAY;;IAEZ,gBAAgB;;IAEhB,mBAAmB;;IAEnB,4BAA4B;;IAE5B,gBAAgB;;IAEhB,yBAAyB;;IAEzB,yBAAyB;;IAEzB,0BAA0B;;IAE1B,oBAAoB;;IAEpB,wBAAwB;;IAExB,0BAA0B;;IAE1B,yBAAyB;;IAEzB,gCAAgC;;IAEhC,wCAAwC;;IAExC,4BAA4B;;IAE5B,4BAA4B;;CAEpB,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa;IACxB,gCAAgC;;IAEhC,8BAA8B;;IAE9B,2BAA2B;;CAEnB,CAAC;AAEX;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO;IAClB,6BAA6B;;IAE7B,8BAA8B;;IAE9B,6BAA6B;;CAErB,CAAC;AAMX;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;IACxB,sBAAsB;;IAEtB,uBAAuB;;CAEf,CAAC;AAMX;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU;IACrB,oBAAoB;;IAEpB,wBAAwB;;IAExB,uBAAuB;;IAEvB,oBAAoB;;IAEpB,oBAAoB;;IAEpB,6BAA6B;;IAE7B,iCAAiC;;IAEjC,gCAAgC;;IAEhC,yBAAyB;;IAEzB,kCAAkC;;CAE1B,CAAC;AA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M,WAAW;IACtB,2CAA2C;;IAE3C,2CAA2C;;CAEnC,CAAC;AAMX;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU;IACrB,kCAAkC;;IAElC,wBAAwB;;IAExB,4BAA4B;;CAEpB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC;AAMX;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW;IACtB,kBAAkB;;IAElB,yBAAyB;;IAEzB,8BAA8B;;IAE9B,mBAAmB;;IAEnB,yBAAyB;;IAEzB,qBAAqB;;IAErB,oBAAoB;;CAEZ,CAAC;AAMX;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB,kBAAkB;;IAElB,mBAAmB;;IAEnB,oBAAoB;;IAEpB,qBAAqB;;CAEb,CAAC;AAMX;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ;IACnB,gDAAgD;;IAEhD,6BAA6B;;IAE7B,sCAAsC;;IAEtC,kCAAkC;;CAE1B,CAAC;AAMX;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe;IAC1B,yDAAyD;;IAEzD,gEAAgE;;CAExD,CAAC;AAMX;;GAEG;AACH,eAAO,MAAM,YAAY;IACvB,0BAA0B;;CAElB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("react"),d=t=>"Condition"in t,$=t=>"LHSField"in t,y=t=>()=>{const o=Math.random().toString(36).substring(2,9);return`filter_${Date.now()}_${o}_${++t.current}`},A=(t,o)=>t.id?t:{...t,id:o()},b=(t,o)=>t.map(r=>{const n=A(r,o);return d(n)?{...n,Condition:b(n.Condition,o)}:n}),k=t=>t.map(o=>{if(d(o)){const{id:c,...l}=o;return{...l,Condition:k(o.Condition)}}const{id:r,...n}=o;return n}),h=(t,o)=>{for(const r of t){if(r.id===o)return r;if(d(r)){const n=h(r.Condition,o);if(n)return n}}},f=(t,o,r)=>t.map(n=>n.id===o?r(n):d(n)?{...n,Condition:f(n.Condition,o,r)}:n),G=(t,o)=>t.filter(r=>r.id!==o).map(r=>d(r)?{...r,Condition:G(r.Condition,o)}:r),p=(t,o,r)=>t.map(n=>n.id===o&&d(n)?{...n,Condition:[...n.Condition,r]}:d(n)?{...n,Condition:p(n.Condition,o,r)}:n);function q(t={}){const o=s.useRef(0),r=s.useMemo(()=>y(o),[]),[n,c]=s.useState(()=>b(t.conditions||[],r)),[l,O]=s.useState(t.operator||"And"),g=s.useMemo(()=>{if(n.length!==0)return{Operator:l,Condition:k(n)}},[n,l]),S=n.length>0,v=s.useCallback((e,u)=>{const a=r(),i={...e,id:a};return c(u?C=>p(C,u,i):C=>[...C,i]),a},[]),F=s.useCallback((e,u)=>{const a=r(),i={id:a,Operator:e,Condition:[]};return c(u?C=>p(C,u,i):C=>[...C,i]),a},[]),I=s.useCallback((e,u)=>{c(a=>f(a,e,i=>d(i)?i:{...i,...u}))},[]),R=s.useCallback((e,u)=>{c(a=>f(a,e,i=>d(i)?{...i,Operator:u}:i))},[]),w=s.useCallback(e=>{c(u=>G(u,e))},[]),M=s.useCallback(e=>h(n,e),[n]),T=s.useCallback(()=>{c([])},[]),_=s.useCallback(e=>{O(e)},[]);return{operator:l,items:n,payload:g,hasConditions:S,addCondition:v,addConditionGroup:F,updateCondition:I,updateGroupOperator:R,removeCondition:w,getCondition:M,clearAllConditions:T,setRootOperator:_}}exports.isCondition=$;exports.isConditionGroup=d;exports.useFilter=q;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { useRef as k, useMemo as h, useState as O, useCallback as a } from "react";
|
|
2
|
+
const c = (r) => "Condition" in r, H = (r) => "LHSField" in r, x = (r) => () => {
|
|
3
|
+
const o = Math.random().toString(36).substring(2, 9);
|
|
4
|
+
return `filter_${Date.now()}_${o}_${++r.current}`;
|
|
5
|
+
}, B = (r, o) => r.id ? r : { ...r, id: o() }, g = (r, o) => r.map((t) => {
|
|
6
|
+
const n = B(t, o);
|
|
7
|
+
return c(n) ? {
|
|
8
|
+
...n,
|
|
9
|
+
Condition: g(n.Condition, o)
|
|
10
|
+
} : n;
|
|
11
|
+
}), G = (r) => r.map((o) => {
|
|
12
|
+
if (c(o)) {
|
|
13
|
+
const { id: d, ...f } = o;
|
|
14
|
+
return {
|
|
15
|
+
...f,
|
|
16
|
+
Condition: G(o.Condition)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const { id: t, ...n } = o;
|
|
20
|
+
return n;
|
|
21
|
+
}), v = (r, o) => {
|
|
22
|
+
for (const t of r) {
|
|
23
|
+
if (t.id === o)
|
|
24
|
+
return t;
|
|
25
|
+
if (c(t)) {
|
|
26
|
+
const n = v(t.Condition, o);
|
|
27
|
+
if (n) return n;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}, p = (r, o, t) => r.map((n) => n.id === o ? t(n) : c(n) ? {
|
|
31
|
+
...n,
|
|
32
|
+
Condition: p(n.Condition, o, t)
|
|
33
|
+
} : n), I = (r, o) => r.filter((t) => t.id !== o).map((t) => c(t) ? {
|
|
34
|
+
...t,
|
|
35
|
+
Condition: I(t.Condition, o)
|
|
36
|
+
} : t), l = (r, o, t) => r.map((n) => n.id === o && c(n) ? {
|
|
37
|
+
...n,
|
|
38
|
+
Condition: [...n.Condition, t]
|
|
39
|
+
} : c(n) ? {
|
|
40
|
+
...n,
|
|
41
|
+
Condition: l(n.Condition, o, t)
|
|
42
|
+
} : n);
|
|
43
|
+
function L(r = {}) {
|
|
44
|
+
const o = k(0), t = h(() => x(o), []), [n, d] = O(
|
|
45
|
+
() => g(r.conditions || [], t)
|
|
46
|
+
), [f, S] = O(
|
|
47
|
+
r.operator || "And"
|
|
48
|
+
), w = h(() => {
|
|
49
|
+
if (n.length !== 0)
|
|
50
|
+
return {
|
|
51
|
+
Operator: f,
|
|
52
|
+
Condition: G(n)
|
|
53
|
+
};
|
|
54
|
+
}, [n, f]), F = n.length > 0, R = a(
|
|
55
|
+
(i, s) => {
|
|
56
|
+
const u = t(), e = { ...i, id: u };
|
|
57
|
+
return d(s ? (C) => l(C, s, e) : (C) => [...C, e]), u;
|
|
58
|
+
},
|
|
59
|
+
[]
|
|
60
|
+
), T = a(
|
|
61
|
+
(i, s) => {
|
|
62
|
+
const u = t(), e = {
|
|
63
|
+
id: u,
|
|
64
|
+
Operator: i,
|
|
65
|
+
Condition: []
|
|
66
|
+
};
|
|
67
|
+
return d(s ? (C) => l(C, s, e) : (C) => [...C, e]), u;
|
|
68
|
+
},
|
|
69
|
+
[]
|
|
70
|
+
), _ = a(
|
|
71
|
+
(i, s) => {
|
|
72
|
+
d(
|
|
73
|
+
(u) => p(u, i, (e) => c(e) ? e : { ...e, ...s })
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
[]
|
|
77
|
+
), $ = a(
|
|
78
|
+
(i, s) => {
|
|
79
|
+
d(
|
|
80
|
+
(u) => p(u, i, (e) => c(e) ? { ...e, Operator: s } : e)
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
[]
|
|
84
|
+
), b = a((i) => {
|
|
85
|
+
d((s) => I(s, i));
|
|
86
|
+
}, []), y = a(
|
|
87
|
+
(i) => v(n, i),
|
|
88
|
+
[n]
|
|
89
|
+
), A = a(() => {
|
|
90
|
+
d([]);
|
|
91
|
+
}, []), M = a((i) => {
|
|
92
|
+
S(i);
|
|
93
|
+
}, []);
|
|
94
|
+
return {
|
|
95
|
+
// State
|
|
96
|
+
operator: f,
|
|
97
|
+
items: n,
|
|
98
|
+
payload: w,
|
|
99
|
+
hasConditions: F,
|
|
100
|
+
// Add operations
|
|
101
|
+
addCondition: R,
|
|
102
|
+
addConditionGroup: T,
|
|
103
|
+
// Update operations
|
|
104
|
+
updateCondition: _,
|
|
105
|
+
updateGroupOperator: $,
|
|
106
|
+
// Remove & access
|
|
107
|
+
removeCondition: b,
|
|
108
|
+
getCondition: y,
|
|
109
|
+
// Utility
|
|
110
|
+
clearAllConditions: A,
|
|
111
|
+
setRootOperator: M
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
c as a,
|
|
116
|
+
H as i,
|
|
117
|
+
L as u
|
|
118
|
+
};
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/** Currency value format - supports both object and string representations */
|
|
2
|
+
type CurrencyValueType = {
|
|
3
|
+
value: number;
|
|
4
|
+
currency: string;
|
|
5
|
+
} | string;
|
|
6
|
+
/** Valid JSON value types */
|
|
7
|
+
type JSONValueType = string | number | boolean | null | {
|
|
8
|
+
[key: string]: JSONValueType;
|
|
9
|
+
} | JSONValueType[];
|
|
2
10
|
/**
|
|
3
11
|
* Data formatting utilities for display and conversion
|
|
4
12
|
*/
|
|
@@ -49,4 +57,5 @@ export declare function formatTextArea(value: string, maxLines?: number): string
|
|
|
49
57
|
* Generic formatter that automatically detects field type and formats accordingly
|
|
50
58
|
*/
|
|
51
59
|
export declare function formatFieldValue(value: any, fieldType?: 'id' | 'string' | 'textarea' | 'number' | 'boolean' | 'date' | 'datetime' | 'currency' | 'json' | 'array'): string;
|
|
60
|
+
export {};
|
|
52
61
|
//# sourceMappingURL=formatting.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../sdk/utils/formatting.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../sdk/utils/formatting.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,KAAK,iBAAiB,GAClB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACnC,MAAM,CAAC;AAEX,6BAA6B;AAC7B,KAAK,aAAa,GACd,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,GAChC,aAAa,EAAE,CAAC;AAEpB;;GAEG;AAEH;;GAEG;AACH,wBAAgB,cAA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