@ram_28/kf-ai-sdk 2.0.1 → 2.0.3
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/BaseField-B6da88U7.js +40 -0
- package/dist/BaseField-Drp0-OxL.cjs +1 -0
- package/dist/api/client.d.ts +7 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.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 +12 -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 +3 -4
- package/dist/bdo/fields/DateField.d.ts.map +1 -1
- 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 +5 -4
- package/dist/bdo/fields/ObjectField.d.ts.map +1 -1
- 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 +9 -16
- 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 +1 -18
- package/dist/bdo/fields/TextAreaField.d.ts.map +1 -1
- 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 +5 -2
- 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 +286 -243
- package/dist/bdo.types.d.ts +2 -3
- package/dist/bdo.types.d.ts.map +1 -1
- package/dist/{client-BIkaIr2y.js → client-BULEEaCP.js} +84 -79
- package/dist/client-DtPpfJc1.cjs +1 -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 +77 -8
- package/dist/components/hooks/useForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useDraftInteraction.d.ts +26 -0
- package/dist/components/hooks/useForm/useDraftInteraction.d.ts.map +1 -0
- package/dist/components/hooks/useForm/useForm.d.ts +2 -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-BQrBcCON.js} +37 -13
- package/dist/constants-D0J69if5.cjs +1 -0
- 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 +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 +333 -1142
- package/dist/form.types.d.ts +1 -1
- package/dist/form.types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm-Cj63v5ny.js +1014 -0
- package/dist/index.esm-DuwT11sx.cjs +1 -0
- package/dist/{metadata-Bz8zJqC1.cjs → metadata-BJWukIqS.cjs} +1 -1
- package/dist/{metadata-VbQzyD2C.js → metadata-CJuFxytC.js} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +116 -122
- package/dist/types/base-fields.d.ts +24 -59
- package/dist/types/base-fields.d.ts.map +1 -1
- package/dist/types/constants.d.ts +2 -2
- 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/dist/workflow/Activity.d.ts +85 -0
- package/dist/workflow/Activity.d.ts.map +1 -0
- package/dist/workflow/ActivityInstance.d.ts +96 -0
- package/dist/workflow/ActivityInstance.d.ts.map +1 -0
- package/dist/workflow/client.d.ts +39 -0
- package/dist/workflow/client.d.ts.map +1 -0
- package/dist/workflow/components/useActivityForm/createActivityItemProxy.d.ts +16 -0
- package/dist/workflow/components/useActivityForm/createActivityItemProxy.d.ts.map +1 -0
- package/dist/workflow/components/useActivityForm/createActivityResolver.d.ts +22 -0
- package/dist/workflow/components/useActivityForm/createActivityResolver.d.ts.map +1 -0
- package/dist/workflow/components/useActivityForm/index.d.ts +3 -0
- package/dist/workflow/components/useActivityForm/index.d.ts.map +1 -0
- package/dist/workflow/components/useActivityForm/types.d.ts +80 -0
- package/dist/workflow/components/useActivityForm/types.d.ts.map +1 -0
- package/dist/workflow/components/useActivityForm/useActivityForm.d.ts +4 -0
- package/dist/workflow/components/useActivityForm/useActivityForm.d.ts.map +1 -0
- package/dist/workflow/index.d.ts +8 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/types.d.ts +53 -0
- package/dist/workflow/types.d.ts.map +1 -0
- package/dist/workflow.cjs +1 -0
- package/dist/workflow.d.ts +8 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.mjs +565 -0
- package/dist/workflow.types.cjs +1 -0
- package/dist/workflow.types.d.ts +2 -0
- package/dist/workflow.types.d.ts.map +1 -0
- package/dist/workflow.types.mjs +1 -0
- 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/docs/workflow.md +703 -0
- package/package.json +21 -1
- package/sdk/api/client.ts +77 -57
- package/sdk/api/index.ts +1 -0
- package/sdk/api/metadata.ts +22 -20
- package/sdk/base-types.ts +5 -9
- package/sdk/bdo/core/BaseBdo.ts +23 -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 +4 -5
- 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 +9 -5
- package/sdk/bdo/fields/ReferenceField.ts +22 -28
- package/sdk/bdo/fields/SelectField.ts +13 -26
- package/sdk/bdo/fields/StringField.ts +10 -5
- package/sdk/bdo/fields/TextAreaField.ts +3 -32
- package/sdk/bdo/fields/TextField.ts +42 -0
- package/sdk/bdo/fields/UserField.ts +52 -0
- package/sdk/bdo/fields/index.ts +5 -2
- package/sdk/bdo/index.ts +19 -4
- package/sdk/bdo.ts +4 -31
- 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 +4 -0
- package/sdk/components/hooks/useForm/types.ts +92 -9
- package/sdk/components/hooks/useForm/useDraftInteraction.ts +251 -0
- package/sdk/components/hooks/useForm/useForm.ts +132 -60
- package/sdk/components/hooks/useTable/useTable.ts +10 -2
- package/sdk/form.ts +1 -12
- package/sdk/form.types.ts +1 -0
- package/sdk/index.ts +9 -3
- package/sdk/types/base-fields.ts +28 -72
- package/sdk/types/constants.ts +2 -2
- package/sdk/utils/formatting.ts +13 -1
- package/sdk/workflow/Activity.ts +181 -0
- package/sdk/workflow/ActivityInstance.ts +339 -0
- package/sdk/workflow/client.ts +208 -0
- package/sdk/workflow/components/useActivityForm/createActivityItemProxy.ts +126 -0
- package/sdk/workflow/components/useActivityForm/createActivityResolver.ts +61 -0
- package/sdk/workflow/components/useActivityForm/index.ts +5 -0
- package/sdk/workflow/components/useActivityForm/types.ts +166 -0
- package/sdk/workflow/components/useActivityForm/useActivityForm.ts +386 -0
- package/sdk/workflow/index.ts +20 -0
- package/sdk/workflow/types.ts +84 -0
- package/sdk/workflow.ts +25 -0
- package/sdk/workflow.types.ts +11 -0
- 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/docs/useAuth.md
CHANGED
|
@@ -64,12 +64,18 @@ Wrap your app with `AuthProvider` and use `useAuth` in components.
|
|
|
64
64
|
```tsx
|
|
65
65
|
import { useAuth, AuthProvider } from "@ram_28/kf-ai-sdk/auth";
|
|
66
66
|
|
|
67
|
-
// 1. Wrap app with AuthProvider
|
|
67
|
+
// 1. Wrap app with AuthProvider inside QueryClientProvider
|
|
68
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
69
|
+
|
|
70
|
+
const queryClient = new QueryClient();
|
|
71
|
+
|
|
68
72
|
function App() {
|
|
69
73
|
return (
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
|
|
74
|
+
<QueryClientProvider client={queryClient}>
|
|
75
|
+
<AuthProvider>
|
|
76
|
+
<AppContent />
|
|
77
|
+
</AuthProvider>
|
|
78
|
+
</QueryClientProvider>
|
|
73
79
|
);
|
|
74
80
|
}
|
|
75
81
|
|
package/docs/useFilter.md
CHANGED
|
@@ -217,7 +217,7 @@ function SimpleFilter() {
|
|
|
217
217
|
const addCategoryFilter = () => {
|
|
218
218
|
filter.addCondition({
|
|
219
219
|
Operator: ConditionOperator.EQ,
|
|
220
|
-
LHSField: product.Category.
|
|
220
|
+
LHSField: product.Category.id,
|
|
221
221
|
RHSValue: "Electronics",
|
|
222
222
|
RHSType: RHSType.Constant,
|
|
223
223
|
});
|
|
@@ -260,7 +260,7 @@ function TypeSafeFilter() {
|
|
|
260
260
|
const addCategoryFilter = () => {
|
|
261
261
|
filter.addCondition({
|
|
262
262
|
Operator: ConditionOperator.EQ,
|
|
263
|
-
LHSField: product.Category.
|
|
263
|
+
LHSField: product.Category.id, // Type-safe via BDO field
|
|
264
264
|
RHSValue: "Electronics",
|
|
265
265
|
RHSType: RHSType.Constant,
|
|
266
266
|
});
|
|
@@ -306,13 +306,13 @@ function FilterWithInitialState() {
|
|
|
306
306
|
conditions: [
|
|
307
307
|
{
|
|
308
308
|
Operator: ConditionOperator.EQ,
|
|
309
|
-
LHSField: product.Category.
|
|
309
|
+
LHSField: product.Category.id,
|
|
310
310
|
RHSValue: "Electronics",
|
|
311
311
|
RHSType: RHSType.Constant,
|
|
312
312
|
},
|
|
313
313
|
{
|
|
314
314
|
Operator: ConditionOperator.GT,
|
|
315
|
-
LHSField: product.Price.
|
|
315
|
+
LHSField: product.Price.id,
|
|
316
316
|
RHSValue: 100,
|
|
317
317
|
RHSType: RHSType.Constant,
|
|
318
318
|
},
|
|
@@ -346,7 +346,7 @@ function EqualityFilters() {
|
|
|
346
346
|
const filterByStatus = (status: string) => {
|
|
347
347
|
filter.addCondition({
|
|
348
348
|
Operator: ConditionOperator.EQ,
|
|
349
|
-
LHSField: product.Status.
|
|
349
|
+
LHSField: product.Status.id,
|
|
350
350
|
RHSValue: status,
|
|
351
351
|
RHSType: RHSType.Constant,
|
|
352
352
|
});
|
|
@@ -356,7 +356,7 @@ function EqualityFilters() {
|
|
|
356
356
|
const excludeStatus = (status: string) => {
|
|
357
357
|
filter.addCondition({
|
|
358
358
|
Operator: ConditionOperator.NE,
|
|
359
|
-
LHSField: product.Status.
|
|
359
|
+
LHSField: product.Status.id,
|
|
360
360
|
RHSValue: status,
|
|
361
361
|
RHSType: RHSType.Constant,
|
|
362
362
|
});
|
|
@@ -390,7 +390,7 @@ function ComparisonFilters() {
|
|
|
390
390
|
const filterByMinPrice = (minPrice: number) => {
|
|
391
391
|
filter.addCondition({
|
|
392
392
|
Operator: ConditionOperator.GT,
|
|
393
|
-
LHSField: product.Price.
|
|
393
|
+
LHSField: product.Price.id,
|
|
394
394
|
RHSValue: minPrice,
|
|
395
395
|
RHSType: RHSType.Constant,
|
|
396
396
|
});
|
|
@@ -400,7 +400,7 @@ function ComparisonFilters() {
|
|
|
400
400
|
const filterLowStock = (threshold: number) => {
|
|
401
401
|
filter.addCondition({
|
|
402
402
|
Operator: ConditionOperator.LTE,
|
|
403
|
-
LHSField: product.Stock.
|
|
403
|
+
LHSField: product.Stock.id,
|
|
404
404
|
RHSValue: threshold,
|
|
405
405
|
RHSType: RHSType.Constant,
|
|
406
406
|
});
|
|
@@ -446,7 +446,7 @@ function RangeFilters() {
|
|
|
446
446
|
const filterPriceRange = (min: number, max: number) => {
|
|
447
447
|
filter.addCondition({
|
|
448
448
|
Operator: ConditionOperator.Between,
|
|
449
|
-
LHSField: product.Price.
|
|
449
|
+
LHSField: product.Price.id,
|
|
450
450
|
RHSValue: [min, max],
|
|
451
451
|
RHSType: RHSType.Constant,
|
|
452
452
|
});
|
|
@@ -456,7 +456,7 @@ function RangeFilters() {
|
|
|
456
456
|
const filterDateRange = (startDate: string, endDate: string) => {
|
|
457
457
|
filter.addCondition({
|
|
458
458
|
Operator: ConditionOperator.Between,
|
|
459
|
-
LHSField: order.OrderDate.
|
|
459
|
+
LHSField: order.OrderDate.id,
|
|
460
460
|
RHSValue: [startDate, endDate],
|
|
461
461
|
RHSType: RHSType.Constant,
|
|
462
462
|
});
|
|
@@ -466,7 +466,7 @@ function RangeFilters() {
|
|
|
466
466
|
const excludePriceRange = (min: number, max: number) => {
|
|
467
467
|
filter.addCondition({
|
|
468
468
|
Operator: ConditionOperator.NotBetween,
|
|
469
|
-
LHSField: product.Price.
|
|
469
|
+
LHSField: product.Price.id,
|
|
470
470
|
RHSValue: [min, max],
|
|
471
471
|
RHSType: RHSType.Constant,
|
|
472
472
|
});
|
|
@@ -500,7 +500,7 @@ function ListFilters() {
|
|
|
500
500
|
const filterByCategories = (categories: string[]) => {
|
|
501
501
|
filter.addCondition({
|
|
502
502
|
Operator: ConditionOperator.IN,
|
|
503
|
-
LHSField: product.Category.
|
|
503
|
+
LHSField: product.Category.id,
|
|
504
504
|
RHSValue: categories,
|
|
505
505
|
RHSType: RHSType.Constant,
|
|
506
506
|
});
|
|
@@ -510,7 +510,7 @@ function ListFilters() {
|
|
|
510
510
|
const excludeCategories = (categories: string[]) => {
|
|
511
511
|
filter.addCondition({
|
|
512
512
|
Operator: ConditionOperator.NIN,
|
|
513
|
-
LHSField: product.Category.
|
|
513
|
+
LHSField: product.Category.id,
|
|
514
514
|
RHSValue: categories,
|
|
515
515
|
RHSType: RHSType.Constant,
|
|
516
516
|
});
|
|
@@ -546,7 +546,7 @@ function TextFilters() {
|
|
|
546
546
|
const filterByKeyword = (keyword: string) => {
|
|
547
547
|
filter.addCondition({
|
|
548
548
|
Operator: ConditionOperator.Contains,
|
|
549
|
-
LHSField: product.Title.
|
|
549
|
+
LHSField: product.Title.id,
|
|
550
550
|
RHSValue: keyword,
|
|
551
551
|
RHSType: RHSType.Constant,
|
|
552
552
|
});
|
|
@@ -556,7 +556,7 @@ function TextFilters() {
|
|
|
556
556
|
const excludeKeyword = (keyword: string) => {
|
|
557
557
|
filter.addCondition({
|
|
558
558
|
Operator: ConditionOperator.NotContains,
|
|
559
|
-
LHSField: product.Description.
|
|
559
|
+
LHSField: product.Description.id,
|
|
560
560
|
RHSValue: keyword,
|
|
561
561
|
RHSType: RHSType.Constant,
|
|
562
562
|
});
|
|
@@ -594,7 +594,7 @@ function EmptyFilters() {
|
|
|
594
594
|
const filterUnassigned = () => {
|
|
595
595
|
filter.addCondition({
|
|
596
596
|
Operator: ConditionOperator.Empty,
|
|
597
|
-
LHSField: task.AssignedTo.
|
|
597
|
+
LHSField: task.AssignedTo.id,
|
|
598
598
|
RHSValue: null,
|
|
599
599
|
RHSType: RHSType.Constant,
|
|
600
600
|
});
|
|
@@ -604,7 +604,7 @@ function EmptyFilters() {
|
|
|
604
604
|
const filterAssigned = () => {
|
|
605
605
|
filter.addCondition({
|
|
606
606
|
Operator: ConditionOperator.NotEmpty,
|
|
607
|
-
LHSField: task.AssignedTo.
|
|
607
|
+
LHSField: task.AssignedTo.id,
|
|
608
608
|
RHSValue: null,
|
|
609
609
|
RHSType: RHSType.Constant,
|
|
610
610
|
});
|
|
@@ -644,19 +644,19 @@ function AndFilter() {
|
|
|
644
644
|
// Category AND Price AND InStock - all must be true
|
|
645
645
|
filter.addCondition({
|
|
646
646
|
Operator: ConditionOperator.EQ,
|
|
647
|
-
LHSField: product.Category.
|
|
647
|
+
LHSField: product.Category.id,
|
|
648
648
|
RHSValue: "Electronics",
|
|
649
649
|
RHSType: RHSType.Constant,
|
|
650
650
|
});
|
|
651
651
|
filter.addCondition({
|
|
652
652
|
Operator: ConditionOperator.LTE,
|
|
653
|
-
LHSField: product.Price.
|
|
653
|
+
LHSField: product.Price.id,
|
|
654
654
|
RHSValue: 500,
|
|
655
655
|
RHSType: RHSType.Constant,
|
|
656
656
|
});
|
|
657
657
|
filter.addCondition({
|
|
658
658
|
Operator: ConditionOperator.GT,
|
|
659
|
-
LHSField: product.Stock.
|
|
659
|
+
LHSField: product.Stock.id,
|
|
660
660
|
RHSValue: 0,
|
|
661
661
|
RHSType: RHSType.Constant,
|
|
662
662
|
});
|
|
@@ -692,13 +692,13 @@ function OrFilter() {
|
|
|
692
692
|
// High priority OR Overdue - either can match
|
|
693
693
|
filter.addCondition({
|
|
694
694
|
Operator: ConditionOperator.EQ,
|
|
695
|
-
LHSField: task.Priority.
|
|
695
|
+
LHSField: task.Priority.id,
|
|
696
696
|
RHSValue: "High",
|
|
697
697
|
RHSType: RHSType.Constant,
|
|
698
698
|
});
|
|
699
699
|
filter.addCondition({
|
|
700
700
|
Operator: ConditionOperator.LT,
|
|
701
|
-
LHSField: task.DueDate.
|
|
701
|
+
LHSField: task.DueDate.id,
|
|
702
702
|
RHSValue: new Date().toISOString(),
|
|
703
703
|
RHSType: RHSType.Constant,
|
|
704
704
|
});
|
|
@@ -730,7 +730,7 @@ function NestedFilter() {
|
|
|
730
730
|
// Root level condition
|
|
731
731
|
filter.addCondition({
|
|
732
732
|
Operator: ConditionOperator.EQ,
|
|
733
|
-
LHSField: product.Category.
|
|
733
|
+
LHSField: product.Category.id,
|
|
734
734
|
RHSValue: "Electronics",
|
|
735
735
|
RHSType: RHSType.Constant,
|
|
736
736
|
});
|
|
@@ -742,7 +742,7 @@ function NestedFilter() {
|
|
|
742
742
|
filter.addCondition(
|
|
743
743
|
{
|
|
744
744
|
Operator: ConditionOperator.LT,
|
|
745
|
-
LHSField: product.Price.
|
|
745
|
+
LHSField: product.Price.id,
|
|
746
746
|
RHSValue: 100,
|
|
747
747
|
RHSType: RHSType.Constant,
|
|
748
748
|
},
|
|
@@ -752,7 +752,7 @@ function NestedFilter() {
|
|
|
752
752
|
filter.addCondition(
|
|
753
753
|
{
|
|
754
754
|
Operator: ConditionOperator.EQ,
|
|
755
|
-
LHSField: product.OnSale.
|
|
755
|
+
LHSField: product.OnSale.id,
|
|
756
756
|
RHSValue: true,
|
|
757
757
|
RHSType: RHSType.Constant,
|
|
758
758
|
},
|
|
@@ -775,7 +775,7 @@ function DeepNestedFilter() {
|
|
|
775
775
|
const filter = useFilter();
|
|
776
776
|
|
|
777
777
|
// Build: (A AND B) OR (C AND D)
|
|
778
|
-
// Generic example - for real usage, use bdo.field.
|
|
778
|
+
// Generic example - for real usage, use bdo.field.id for LHSField
|
|
779
779
|
const buildFilter = () => {
|
|
780
780
|
filter.clearAllConditions();
|
|
781
781
|
filter.setRootOperator(GroupOperator.Or);
|
|
@@ -918,7 +918,7 @@ function EditableFilter() {
|
|
|
918
918
|
const addFilter = () => {
|
|
919
919
|
const id = filter.addCondition({
|
|
920
920
|
Operator: ConditionOperator.GT,
|
|
921
|
-
LHSField: product.Price.
|
|
921
|
+
LHSField: product.Price.id,
|
|
922
922
|
RHSValue: 50,
|
|
923
923
|
RHSType: RHSType.Constant,
|
|
924
924
|
});
|
|
@@ -976,7 +976,7 @@ function ToggleableGroupOperator() {
|
|
|
976
976
|
const filter = useFilter();
|
|
977
977
|
const [groupId, setGroupId] = useState<string | null>(null);
|
|
978
978
|
|
|
979
|
-
// Generic example - for real usage, use bdo.field.
|
|
979
|
+
// Generic example - for real usage, use bdo.field.id for LHSField
|
|
980
980
|
const createGroup = () => {
|
|
981
981
|
const id = filter.addConditionGroup(GroupOperator.And);
|
|
982
982
|
filter.addCondition(
|
|
@@ -1048,7 +1048,7 @@ function FilterWithApi() {
|
|
|
1048
1048
|
onClick={() =>
|
|
1049
1049
|
filter.addCondition({
|
|
1050
1050
|
Operator: ConditionOperator.EQ,
|
|
1051
|
-
LHSField: product.Status.
|
|
1051
|
+
LHSField: product.Status.id,
|
|
1052
1052
|
RHSValue: "Active",
|
|
1053
1053
|
RHSType: RHSType.Constant,
|
|
1054
1054
|
})
|
|
@@ -1080,13 +1080,13 @@ function FilterWithInitialState() {
|
|
|
1080
1080
|
const savedFilters: Array<ConditionType | ConditionGroupType> = [
|
|
1081
1081
|
{
|
|
1082
1082
|
Operator: ConditionOperator.EQ,
|
|
1083
|
-
LHSField: product.Status.
|
|
1083
|
+
LHSField: product.Status.id,
|
|
1084
1084
|
RHSValue: "Active",
|
|
1085
1085
|
RHSType: RHSType.Constant,
|
|
1086
1086
|
},
|
|
1087
1087
|
{
|
|
1088
1088
|
Operator: ConditionOperator.GT,
|
|
1089
|
-
LHSField: product.Price.
|
|
1089
|
+
LHSField: product.Price.id,
|
|
1090
1090
|
RHSValue: 100,
|
|
1091
1091
|
RHSType: RHSType.Constant,
|
|
1092
1092
|
},
|
|
@@ -1119,7 +1119,7 @@ import { ConditionOperator, RHSType } from "@ram_28/kf-ai-sdk/filter";
|
|
|
1119
1119
|
|
|
1120
1120
|
filter.addCondition({
|
|
1121
1121
|
Operator: ConditionOperator.EQ,
|
|
1122
|
-
LHSField: product.Status.
|
|
1122
|
+
LHSField: product.Status.id,
|
|
1123
1123
|
RHSValue: "Active",
|
|
1124
1124
|
RHSType: RHSType.Constant,
|
|
1125
1125
|
});
|
|
@@ -1148,19 +1148,19 @@ import { ConditionOperator, RHSType } from "@ram_28/kf-ai-sdk/filter";
|
|
|
1148
1148
|
|
|
1149
1149
|
filter.addCondition({
|
|
1150
1150
|
Operator: ConditionOperator.EQ,
|
|
1151
|
-
LHSField: product.Category.
|
|
1151
|
+
LHSField: product.Category.id,
|
|
1152
1152
|
RHSValue: "Electronics",
|
|
1153
1153
|
RHSType: RHSType.Constant,
|
|
1154
1154
|
});
|
|
1155
1155
|
filter.addCondition({
|
|
1156
1156
|
Operator: ConditionOperator.GT,
|
|
1157
|
-
LHSField: product.Price.
|
|
1157
|
+
LHSField: product.Price.id,
|
|
1158
1158
|
RHSValue: 100,
|
|
1159
1159
|
RHSType: RHSType.Constant,
|
|
1160
1160
|
});
|
|
1161
1161
|
filter.addCondition({
|
|
1162
1162
|
Operator: ConditionOperator.LTE,
|
|
1163
|
-
LHSField: product.Stock.
|
|
1163
|
+
LHSField: product.Stock.id,
|
|
1164
1164
|
RHSValue: 50,
|
|
1165
1165
|
RHSType: RHSType.Constant,
|
|
1166
1166
|
});
|
|
@@ -1203,7 +1203,7 @@ import { ConditionOperator, GroupOperator, RHSType } from "@ram_28/kf-ai-sdk/fil
|
|
|
1203
1203
|
// Category = "Electronics" AND (Price < 100 OR OnSale = true)
|
|
1204
1204
|
filter.addCondition({
|
|
1205
1205
|
Operator: ConditionOperator.EQ,
|
|
1206
|
-
LHSField: product.Category.
|
|
1206
|
+
LHSField: product.Category.id,
|
|
1207
1207
|
RHSValue: "Electronics",
|
|
1208
1208
|
RHSType: RHSType.Constant,
|
|
1209
1209
|
});
|
|
@@ -1211,7 +1211,7 @@ const orGroupId = filter.addConditionGroup(GroupOperator.Or);
|
|
|
1211
1211
|
filter.addCondition(
|
|
1212
1212
|
{
|
|
1213
1213
|
Operator: ConditionOperator.LT,
|
|
1214
|
-
LHSField: product.Price.
|
|
1214
|
+
LHSField: product.Price.id,
|
|
1215
1215
|
RHSValue: 100,
|
|
1216
1216
|
RHSType: RHSType.Constant,
|
|
1217
1217
|
},
|
|
@@ -1220,7 +1220,7 @@ filter.addCondition(
|
|
|
1220
1220
|
filter.addCondition(
|
|
1221
1221
|
{
|
|
1222
1222
|
Operator: ConditionOperator.EQ,
|
|
1223
|
-
LHSField: product.OnSale.
|
|
1223
|
+
LHSField: product.OnSale.id,
|
|
1224
1224
|
RHSValue: true,
|
|
1225
1225
|
RHSType: RHSType.Constant,
|
|
1226
1226
|
},
|
|
@@ -1268,7 +1268,7 @@ import { ConditionOperator, RHSType } from "@ram_28/kf-ai-sdk/filter";
|
|
|
1268
1268
|
|
|
1269
1269
|
filter.addCondition({
|
|
1270
1270
|
Operator: ConditionOperator.Between,
|
|
1271
|
-
LHSField: product.Price.
|
|
1271
|
+
LHSField: product.Price.id,
|
|
1272
1272
|
RHSValue: [50, 200],
|
|
1273
1273
|
RHSType: RHSType.Constant,
|
|
1274
1274
|
});
|
|
@@ -1297,7 +1297,7 @@ import { ConditionOperator, RHSType } from "@ram_28/kf-ai-sdk/filter";
|
|
|
1297
1297
|
|
|
1298
1298
|
filter.addCondition({
|
|
1299
1299
|
Operator: ConditionOperator.IN,
|
|
1300
|
-
LHSField: product.Category.
|
|
1300
|
+
LHSField: product.Category.id,
|
|
1301
1301
|
RHSValue: ["Electronics", "Computers", "Accessories"],
|
|
1302
1302
|
RHSType: RHSType.Constant,
|
|
1303
1303
|
});
|