@omnia/fx-models 7.8.81-preview → 7.8.83-preview
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/ManifestIds.d.ts +1 -0
- package/ManifestIds.js +3 -0
- package/filterbuilder/index.d.ts +1 -1
- package/filterbuilder/index.js +1 -1
- package/filterbuilder/transformers/OmniaSearchFilterTransformer.d.ts +9 -0
- package/filterbuilder/transformers/OmniaSearchFilterTransformer.js +116 -0
- package/filterbuilder/transformers/index.d.ts +2 -0
- package/filterbuilder/transformers/index.js +5 -0
- package/omniasearch/IPagedSearchResult.d.ts +2 -0
- package/omniasearch/SearchQuery.d.ts +1 -0
- package/package.json +1 -1
- package/properties/PropertyValuePrimitiveConverter.d.ts +2 -1
package/ManifestIds.d.ts
CHANGED
|
@@ -192,6 +192,7 @@ export declare class OmniaWebComponentManifests {
|
|
|
192
192
|
static get FxUxMenuBlade(): Guid;
|
|
193
193
|
static get FxUxWizard(): Guid;
|
|
194
194
|
static get FxUxPeoplePicker(): Guid;
|
|
195
|
+
static get FxUxSkeletonLoader(): Guid;
|
|
195
196
|
static get FxUxIcon(): Guid;
|
|
196
197
|
static get FxUxButton(): Guid;
|
|
197
198
|
static get FxUxDatatable(): Guid;
|
package/ManifestIds.js
CHANGED
|
@@ -592,6 +592,9 @@ class OmniaWebComponentManifests {
|
|
|
592
592
|
static get FxUxPeoplePicker() {
|
|
593
593
|
return new models_1.Guid("4893dcff-9223-448c-9259-367a1b4ad652");
|
|
594
594
|
}
|
|
595
|
+
static get FxUxSkeletonLoader() {
|
|
596
|
+
return new models_1.Guid("4ecc3b27-de00-4525-8b22-cba846f79ad9");
|
|
597
|
+
}
|
|
595
598
|
static get FxUxIcon() {
|
|
596
599
|
return new models_1.Guid("EC34A224-751B-4124-B150-3174AC3868F1");
|
|
597
600
|
}
|
package/filterbuilder/index.d.ts
CHANGED
package/filterbuilder/index.js
CHANGED
|
@@ -5,4 +5,4 @@ tslib_1.__exportStar(require("./FilterComponent"), exports);
|
|
|
5
5
|
tslib_1.__exportStar(require("./FilterBuilder"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./FilterOperatorBuilder"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./helper/FilterHelper"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./transformers
|
|
8
|
+
tslib_1.__exportStar(require("./transformers"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FilterComponent } from "../FilterComponent";
|
|
2
|
+
import { IFilterTransformer } from "./FilterTransformer";
|
|
3
|
+
export declare class OmniaSearchFilterTransformer implements IFilterTransformer<string> {
|
|
4
|
+
transform(filters: FilterComponent[]): string;
|
|
5
|
+
private transformFilterCondition;
|
|
6
|
+
private transformFilterLogicalOperator;
|
|
7
|
+
private transformFilterExpressionOperator;
|
|
8
|
+
private getQueryStringValue;
|
|
9
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OmniaSearchFilterTransformer = void 0;
|
|
4
|
+
const QueryFilter_1 = require("../../QueryFilter");
|
|
5
|
+
const FilterComponent_1 = require("../FilterComponent");
|
|
6
|
+
class OmniaSearchFilterTransformer {
|
|
7
|
+
transform(filters) {
|
|
8
|
+
let result = "";
|
|
9
|
+
filters.forEach((filter, index) => {
|
|
10
|
+
if (index !== 0) {
|
|
11
|
+
result += this.transformFilterLogicalOperator(filter.filterLogicalOperator);
|
|
12
|
+
}
|
|
13
|
+
if (filter instanceof FilterComponent_1.FilterConditionComponent) {
|
|
14
|
+
result += this.transformFilterCondition(filter);
|
|
15
|
+
}
|
|
16
|
+
else if (filter instanceof FilterComponent_1.FilterExpressionComponent) {
|
|
17
|
+
result += this.transformFilterExpressionOperator(filter);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
transformFilterCondition(filterCondition) {
|
|
23
|
+
let operatorString = "";
|
|
24
|
+
let valueString = "";
|
|
25
|
+
let firstValue = null;
|
|
26
|
+
if (!filterCondition.values) {
|
|
27
|
+
valueString = "NULL";
|
|
28
|
+
if (filterCondition.filterOperator === QueryFilter_1.FilterOperator.Eq) {
|
|
29
|
+
operatorString = " IS ";
|
|
30
|
+
}
|
|
31
|
+
else if (filterCondition.filterOperator === QueryFilter_1.FilterOperator.Ne) {
|
|
32
|
+
operatorString = " IS NOT ";
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
throw new Error("Invalid operator for NULL value.");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
firstValue = filterCondition.values[0];
|
|
40
|
+
if (firstValue == null) {
|
|
41
|
+
if (filterCondition.filterOperator === QueryFilter_1.FilterOperator.Eq) {
|
|
42
|
+
return `(${filterCondition.propertyName} IS NULL OR ${filterCondition.propertyName} IS EMPTY OR ${filterCondition.propertyName} NOT EXISTS)`;
|
|
43
|
+
}
|
|
44
|
+
else if (filterCondition.filterOperator === QueryFilter_1.FilterOperator.Ne) {
|
|
45
|
+
return `(${filterCondition.propertyName} IS NOT NULL AND ${filterCondition.propertyName} IS NOT EMPTY)`;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
throw new Error("Invalid operator for NULL value.");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
valueString = this.getQueryStringValue(firstValue);
|
|
52
|
+
switch (filterCondition.filterOperator) {
|
|
53
|
+
case QueryFilter_1.FilterOperator.Eq:
|
|
54
|
+
operatorString = "=";
|
|
55
|
+
break;
|
|
56
|
+
case QueryFilter_1.FilterOperator.Ne:
|
|
57
|
+
operatorString = "!=";
|
|
58
|
+
break;
|
|
59
|
+
case QueryFilter_1.FilterOperator.Gt:
|
|
60
|
+
operatorString = ">";
|
|
61
|
+
break;
|
|
62
|
+
case QueryFilter_1.FilterOperator.Lt:
|
|
63
|
+
operatorString = "<";
|
|
64
|
+
break;
|
|
65
|
+
case QueryFilter_1.FilterOperator.Ge:
|
|
66
|
+
operatorString = ">=";
|
|
67
|
+
break;
|
|
68
|
+
case QueryFilter_1.FilterOperator.Le:
|
|
69
|
+
operatorString = "<=";
|
|
70
|
+
break;
|
|
71
|
+
case QueryFilter_1.FilterOperator.In:
|
|
72
|
+
operatorString = " IN ";
|
|
73
|
+
valueString = `[${filterCondition.values.map((x) => this.getQueryStringValue(x)).join(", ")}]`;
|
|
74
|
+
break;
|
|
75
|
+
case QueryFilter_1.FilterOperator.NotIn:
|
|
76
|
+
operatorString = " IN ";
|
|
77
|
+
valueString = `[${filterCondition.values.map((x) => this.getQueryStringValue(x)).join(", ")}]`;
|
|
78
|
+
return `NOT ${filterCondition.propertyName}${operatorString}${valueString}`;
|
|
79
|
+
default:
|
|
80
|
+
operatorString = " = ";
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (!operatorString) {
|
|
85
|
+
throw new Error(`Invalid operator ${filterCondition.filterOperator}`);
|
|
86
|
+
}
|
|
87
|
+
return `${filterCondition.propertyName}${operatorString}${valueString}`;
|
|
88
|
+
}
|
|
89
|
+
transformFilterLogicalOperator(filterLogicalOperator) {
|
|
90
|
+
switch (filterLogicalOperator) {
|
|
91
|
+
case QueryFilter_1.FilterLogicalOperator.And:
|
|
92
|
+
return " AND ";
|
|
93
|
+
case QueryFilter_1.FilterLogicalOperator.Or:
|
|
94
|
+
return " OR ";
|
|
95
|
+
default:
|
|
96
|
+
throw new Error(`Invalid logical operator: ${filterLogicalOperator}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
transformFilterExpressionOperator(filterExpressionComponent) {
|
|
100
|
+
const innerExpressionString = this.transform(filterExpressionComponent.filters);
|
|
101
|
+
return `(${innerExpressionString})`;
|
|
102
|
+
}
|
|
103
|
+
getQueryStringValue(value) {
|
|
104
|
+
if (value == null) {
|
|
105
|
+
return "";
|
|
106
|
+
}
|
|
107
|
+
else if (typeof value === "number") {
|
|
108
|
+
return value.toString();
|
|
109
|
+
}
|
|
110
|
+
else if (typeof value === "boolean") {
|
|
111
|
+
return `${value}`;
|
|
112
|
+
}
|
|
113
|
+
return `"${value.toString()}"`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.OmniaSearchFilterTransformer = OmniaSearchFilterTransformer;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ISearchResult } from "./ISearchResult";
|
|
2
2
|
import { IndexedDocument } from "./IndexedDocument";
|
|
3
|
+
import { OmniaRefiner } from "./OmniaRefiner";
|
|
3
4
|
export interface IPagedSearchResultToken {
|
|
4
5
|
}
|
|
5
6
|
export interface IPagedSearchResult<TIndexedDocument extends IndexedDocument> extends ISearchResult<TIndexedDocument> {
|
|
6
7
|
totalPages: number;
|
|
7
8
|
error: string;
|
|
9
|
+
refiners?: Array<OmniaRefiner>;
|
|
8
10
|
}
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { PropertyValue } from "@omnia/fx-models";
|
|
1
|
+
import { PropertyConfiguration, PropertyValue } from "@omnia/fx-models";
|
|
2
2
|
export declare abstract class PropertyValuePrimitiveConverter {
|
|
3
3
|
abstract toPrimitiveString(propertyValue: PropertyValue): string;
|
|
4
|
+
abstract toDisplayString(propertyValue: PropertyValue, propertyConfiguration?: PropertyConfiguration<any>): Promise<string>;
|
|
4
5
|
}
|