ballerina-core 1.0.202 → 1.0.203
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/package.json
CHANGED
|
@@ -29,37 +29,48 @@ const initialiseFiltersAndSorting = <
|
|
|
29
29
|
>(
|
|
30
30
|
filterTypes: Map<string, SumNType<any>>,
|
|
31
31
|
) => {
|
|
32
|
-
return
|
|
33
|
-
Co<CustomPresentationContext, ExtraContext>()
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
)
|
|
42
|
-
.then((
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
32
|
+
return filterTypes.size == 0
|
|
33
|
+
? Co<CustomPresentationContext, ExtraContext>().SetState(
|
|
34
|
+
TableAbstractRendererState.Updaters.Core.customFormState.children.isFilteringInitialized(
|
|
35
|
+
// always set to true even if the first call fails so we don't block the flow
|
|
36
|
+
replaceWith(true),
|
|
37
|
+
),
|
|
38
|
+
)
|
|
39
|
+
: Co<CustomPresentationContext, ExtraContext>().Seq([
|
|
40
|
+
Co<CustomPresentationContext, ExtraContext>()
|
|
41
|
+
.GetState()
|
|
42
|
+
.then((current) => {
|
|
43
|
+
const getDefaultFiltersAndSorting =
|
|
44
|
+
current.tableApiSource.getDefaultFiltersAndSorting(filterTypes);
|
|
45
|
+
return Co<CustomPresentationContext, ExtraContext>()
|
|
46
|
+
.Await(
|
|
47
|
+
getDefaultFiltersAndSorting(current.parseFromApiByType),
|
|
48
|
+
() =>
|
|
49
|
+
console.error(
|
|
50
|
+
"error getting default filters and sorting from api",
|
|
51
|
+
),
|
|
52
|
+
)
|
|
53
|
+
.then((filtersAndSorting) => {
|
|
54
|
+
return filtersAndSorting.kind == "l"
|
|
55
|
+
? Co<CustomPresentationContext, ExtraContext>().SetState(
|
|
56
|
+
TableAbstractRendererState.Updaters.Core.customFormState.children
|
|
57
|
+
.filters(replaceWith(filtersAndSorting.value.filters))
|
|
58
|
+
.then(
|
|
59
|
+
TableAbstractRendererState.Updaters.Core.customFormState.children.sorting(
|
|
60
|
+
replaceWith(filtersAndSorting.value.sorting),
|
|
61
|
+
),
|
|
62
|
+
),
|
|
63
|
+
)
|
|
64
|
+
: Co<CustomPresentationContext, ExtraContext>().Wait(0);
|
|
65
|
+
});
|
|
66
|
+
}),
|
|
67
|
+
Co<CustomPresentationContext, ExtraContext>().SetState(
|
|
68
|
+
TableAbstractRendererState.Updaters.Core.customFormState.children.isFilteringInitialized(
|
|
69
|
+
// always set to true even if the first call fails so we don't block the flow
|
|
70
|
+
replaceWith(true),
|
|
71
|
+
),
|
|
72
|
+
),
|
|
73
|
+
]);
|
|
63
74
|
};
|
|
64
75
|
|
|
65
76
|
const intialiseTable = <
|
|
@@ -80,8 +91,6 @@ const intialiseTable = <
|
|
|
80
91
|
current.fromTableApiParser,
|
|
81
92
|
);
|
|
82
93
|
|
|
83
|
-
console.debug("params", current.customFormState.filterAndSortParam);
|
|
84
|
-
|
|
85
94
|
const params =
|
|
86
95
|
current.customFormState.filterAndSortParam == ""
|
|
87
96
|
? Map<string, string>()
|
|
@@ -183,6 +192,7 @@ export const TableReinitialiseRunner = <
|
|
|
183
192
|
interval: 15,
|
|
184
193
|
runFilter: (props) =>
|
|
185
194
|
props.context.customFormState.initializationStatus === "initialized" &&
|
|
195
|
+
props.context.customFormState.isFilteringInitialized &&
|
|
186
196
|
props.context.customFormState.shouldReinitialize,
|
|
187
197
|
},
|
|
188
198
|
);
|
|
@@ -197,10 +207,11 @@ export const TableRunner = <
|
|
|
197
207
|
interval: 15,
|
|
198
208
|
runFilter: (props) => {
|
|
199
209
|
return (
|
|
200
|
-
props.context.customFormState.initializationStatus ===
|
|
210
|
+
(props.context.customFormState.initializationStatus ===
|
|
201
211
|
"not initialized" ||
|
|
202
|
-
|
|
203
|
-
|
|
212
|
+
props.context.customFormState.initializationStatus ===
|
|
213
|
+
"reinitializing") &&
|
|
214
|
+
props.context.customFormState.isFilteringInitialized
|
|
204
215
|
);
|
|
205
216
|
},
|
|
206
217
|
},
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ListRepo,
|
|
12
12
|
BasicUpdater,
|
|
13
13
|
Guid,
|
|
14
|
+
FilterTypeKind,
|
|
14
15
|
} from "../../../../../../main";
|
|
15
16
|
|
|
16
17
|
export type TuplePredicateExpression = {
|
|
@@ -912,6 +913,32 @@ export const PredicateValue = {
|
|
|
912
913
|
return PredicateValue.Default.filterEqualsTo(value);
|
|
913
914
|
}
|
|
914
915
|
},
|
|
916
|
+
FilterToKindAndValue: (
|
|
917
|
+
filter: ValueFilter,
|
|
918
|
+
): { kind: FilterTypeKind; value: PredicateValue } => {
|
|
919
|
+
switch (filter.kind) {
|
|
920
|
+
case "contains":
|
|
921
|
+
return { kind: "contains", value: filter.contains };
|
|
922
|
+
case "=":
|
|
923
|
+
return { kind: "=", value: filter.equalsTo };
|
|
924
|
+
case "!=":
|
|
925
|
+
return { kind: "!=", value: filter.notEqualsTo };
|
|
926
|
+
case ">=":
|
|
927
|
+
return { kind: ">=", value: filter.greaterThanOrEqualsTo };
|
|
928
|
+
case ">":
|
|
929
|
+
return { kind: ">", value: filter.greaterThan };
|
|
930
|
+
case "!=null":
|
|
931
|
+
return { kind: "!=null", value: PredicateValue.Default.unit() };
|
|
932
|
+
case "=null":
|
|
933
|
+
return { kind: "=null", value: PredicateValue.Default.unit() };
|
|
934
|
+
case "<=":
|
|
935
|
+
return { kind: "<=", value: filter.smallerThanOrEqualsTo };
|
|
936
|
+
case "<":
|
|
937
|
+
return { kind: "<", value: filter.smallerThan };
|
|
938
|
+
default:
|
|
939
|
+
return { kind: "startsWith", value: filter.startsWith };
|
|
940
|
+
}
|
|
941
|
+
},
|
|
915
942
|
ParseAsDate: (json: any): ValueOrErrors<PredicateValue, string> => {
|
|
916
943
|
if (PredicateValue.Operations.IsDate(json))
|
|
917
944
|
return ValueOrErrors.Default.return(json);
|