igniteui-webcomponents-datasources 7.1.1-beta.2 → 7.1.1-beta.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/esm2022/lib/Entity.d.ts +14 -0
- package/esm2022/lib/Entity.js +65 -0
- package/esm2022/lib/EntityProperty.d.ts +12 -0
- package/esm2022/lib/EntityProperty.js +27 -0
- package/esm2022/lib/EntitySet.d.ts +15 -0
- package/esm2022/lib/EntitySet.js +50 -0
- package/esm2022/lib/ODataDataSourcePage.d.ts +19 -0
- package/esm2022/lib/ODataDataSourcePage.js +67 -0
- package/esm2022/lib/ODataSchemaProvider.d.ts +12 -0
- package/esm2022/lib/ODataSchemaProvider.js +120 -0
- package/esm2022/lib/ODataVirtualDataSource.d.ts +28 -0
- package/esm2022/lib/ODataVirtualDataSource.js +132 -0
- package/esm2022/lib/ODataVirtualDataSourceDataProvider.d.ts +120 -0
- package/esm2022/lib/ODataVirtualDataSourceDataProvider.js +450 -0
- package/esm2022/lib/ODataVirtualDataSourceDataProviderWorker.d.ts +57 -0
- package/esm2022/lib/ODataVirtualDataSourceDataProviderWorker.js +710 -0
- package/esm2022/lib/ODataVirtualDataSourceDataProviderWorkerSettings.d.ts +42 -0
- package/esm2022/lib/ODataVirtualDataSourceDataProviderWorkerSettings.js +83 -0
- package/esm2022/lib/ODataVirtualDataSourceProviderTaskDataHolder.d.ts +5 -0
- package/esm2022/lib/ODataVirtualDataSourceProviderTaskDataHolder.js +6 -0
- package/esm2022/lib/RestVirtualDataSource.d.ts +86 -0
- package/esm2022/lib/RestVirtualDataSource.js +272 -0
- package/esm2022/lib/RestVirtualDataSourceDataProvider.d.ts +171 -0
- package/esm2022/lib/RestVirtualDataSourceDataProvider.js +535 -0
- package/esm2022/lib/RestVirtualDataSourceDataProviderWorker.d.ts +70 -0
- package/esm2022/lib/RestVirtualDataSourceDataProviderWorker.js +762 -0
- package/esm2022/lib/RestVirtualDataSourceDataProviderWorkerSettings.d.ts +93 -0
- package/esm2022/lib/RestVirtualDataSourceDataProviderWorkerSettings.js +159 -0
- package/esm2022/lib/RestVirtualDataSourcePage.d.ts +19 -0
- package/esm2022/lib/RestVirtualDataSourcePage.js +67 -0
- package/esm2022/lib/RestVirtualDataSourceProviderTaskDataHolder.d.ts +5 -0
- package/esm2022/lib/RestVirtualDataSourceProviderTaskDataHolder.js +6 -0
- package/esm2022/lib/Schema.d.ts +15 -0
- package/esm2022/lib/Schema.js +54 -0
- package/esm2022/lib/util.d.ts +27 -0
- package/esm2022/lib/util.js +116 -0
- package/esm2022/public_api.d.ts +18 -0
- package/esm2022/public_api.js +18 -0
- package/package.json +7 -7
- package/fesm2022/igniteui-webcomponents-datasources.mjs +0 -3611
- package/igniteui-webcomponents-datasources.d.ts +0 -754
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EntityProperty } from "./EntityProperty";
|
|
2
|
+
import { XElement } from "igniteui-webcomponents-core";
|
|
3
|
+
export declare class Entity {
|
|
4
|
+
private _properties;
|
|
5
|
+
private _primaryKey;
|
|
6
|
+
constructor(name: string, entityNode: XElement);
|
|
7
|
+
private _name;
|
|
8
|
+
get name(): string;
|
|
9
|
+
set name(value: string);
|
|
10
|
+
get properties(): Map<string, EntityProperty>;
|
|
11
|
+
get primaryKey(): string[];
|
|
12
|
+
private loadProperties;
|
|
13
|
+
private loadPrimaryKey;
|
|
14
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { EntityProperty } from "./EntityProperty";
|
|
2
|
+
import { XName } from "igniteui-webcomponents-core";
|
|
3
|
+
import { toArray } from './util';
|
|
4
|
+
export class Entity {
|
|
5
|
+
constructor(name, entityNode) {
|
|
6
|
+
this._properties = null;
|
|
7
|
+
this._primaryKey = null;
|
|
8
|
+
this._name = null;
|
|
9
|
+
this.name = name;
|
|
10
|
+
this.loadProperties(entityNode);
|
|
11
|
+
this.loadPrimaryKey(entityNode);
|
|
12
|
+
}
|
|
13
|
+
get name() {
|
|
14
|
+
return this._name;
|
|
15
|
+
}
|
|
16
|
+
set name(value) {
|
|
17
|
+
this._name = value;
|
|
18
|
+
}
|
|
19
|
+
get properties() {
|
|
20
|
+
if (null == this._properties) {
|
|
21
|
+
this._properties = new Map();
|
|
22
|
+
}
|
|
23
|
+
return this._properties;
|
|
24
|
+
}
|
|
25
|
+
get primaryKey() {
|
|
26
|
+
if (null == this._primaryKey) {
|
|
27
|
+
this._primaryKey = [];
|
|
28
|
+
}
|
|
29
|
+
return this._primaryKey;
|
|
30
|
+
}
|
|
31
|
+
loadProperties(entityNode) {
|
|
32
|
+
let children = toArray(entityNode.elements());
|
|
33
|
+
let elementCount = children.length;
|
|
34
|
+
let nameAttr = XName.get("Name", "");
|
|
35
|
+
let typeAttr = XName.get("Type", "");
|
|
36
|
+
for (let i = 0; i < elementCount; i++) {
|
|
37
|
+
let node = children[i];
|
|
38
|
+
if (node.name.localName == "Property") {
|
|
39
|
+
let name = node.attribute(nameAttr).value;
|
|
40
|
+
let type = node.attribute(typeAttr).value;
|
|
41
|
+
this.properties.set(name, new EntityProperty(name, type));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
;
|
|
45
|
+
}
|
|
46
|
+
loadPrimaryKey(entityNode) {
|
|
47
|
+
let children = toArray(entityNode.elements());
|
|
48
|
+
let elementCount = children.length;
|
|
49
|
+
let nameAttr = XName.get("Name", "");
|
|
50
|
+
for (let i = 0; i < elementCount; i++) {
|
|
51
|
+
let node = children[i];
|
|
52
|
+
if (node.name.localName == "Key") {
|
|
53
|
+
let subChildren = toArray(node.elements());
|
|
54
|
+
let keyNodeCOunt = subChildren.length;
|
|
55
|
+
for (let j = 0; j < keyNodeCOunt; j++) {
|
|
56
|
+
let keyNode = subChildren[j];
|
|
57
|
+
if (keyNode.name.localName == "PropertyRef") {
|
|
58
|
+
this.primaryKey.push(keyNode.attribute(nameAttr).value);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class EntityProperty {
|
|
2
|
+
constructor(name: string, schemaType: string);
|
|
3
|
+
private _name;
|
|
4
|
+
get name(): string;
|
|
5
|
+
set name(value: string);
|
|
6
|
+
private _isNullable;
|
|
7
|
+
get isNullable(): boolean;
|
|
8
|
+
set isNullable(value: boolean);
|
|
9
|
+
private _type;
|
|
10
|
+
get type(): string;
|
|
11
|
+
set type(value: string);
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export class EntityProperty {
|
|
2
|
+
constructor(name, schemaType) {
|
|
3
|
+
this._name = null;
|
|
4
|
+
this._isNullable = false;
|
|
5
|
+
this._type = null;
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.type = schemaType;
|
|
8
|
+
}
|
|
9
|
+
get name() {
|
|
10
|
+
return this._name;
|
|
11
|
+
}
|
|
12
|
+
set name(value) {
|
|
13
|
+
this._name = value;
|
|
14
|
+
}
|
|
15
|
+
get isNullable() {
|
|
16
|
+
return this._isNullable;
|
|
17
|
+
}
|
|
18
|
+
set isNullable(value) {
|
|
19
|
+
this._isNullable = value;
|
|
20
|
+
}
|
|
21
|
+
get type() {
|
|
22
|
+
return this._type;
|
|
23
|
+
}
|
|
24
|
+
set type(value) {
|
|
25
|
+
this._type = value;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class EntitySet {
|
|
2
|
+
constructor(name: string, entityType: string);
|
|
3
|
+
private _entityName;
|
|
4
|
+
get entityName(): string;
|
|
5
|
+
set entityName(value: string);
|
|
6
|
+
private _entityNamespace;
|
|
7
|
+
get entityNamespace(): string;
|
|
8
|
+
set entityNamespace(value: string);
|
|
9
|
+
private _entityType;
|
|
10
|
+
get entityType(): string;
|
|
11
|
+
set entityType(value: string);
|
|
12
|
+
private _name;
|
|
13
|
+
get name(): string;
|
|
14
|
+
set name(value: string);
|
|
15
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export class EntitySet {
|
|
2
|
+
constructor(name, entityType) {
|
|
3
|
+
this._entityName = null;
|
|
4
|
+
this._entityNamespace = null;
|
|
5
|
+
this._entityType = null;
|
|
6
|
+
this._name = null;
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.entityType = entityType;
|
|
9
|
+
if (entityType.indexOf(".") >= 0) {
|
|
10
|
+
let parts = entityType.split('.');
|
|
11
|
+
if (parts.length == 2) {
|
|
12
|
+
this.entityNamespace = parts[0];
|
|
13
|
+
this.entityName = parts[1];
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
let i = entityType.lastIndexOf('.');
|
|
17
|
+
this.entityNamespace = entityType.substr(0, i);
|
|
18
|
+
this.entityName = entityType.substr(i + 1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.entityNamespace = entityType;
|
|
23
|
+
this.entityName = entityType;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
get entityName() {
|
|
27
|
+
return this._entityName;
|
|
28
|
+
}
|
|
29
|
+
set entityName(value) {
|
|
30
|
+
this._entityName = value;
|
|
31
|
+
}
|
|
32
|
+
get entityNamespace() {
|
|
33
|
+
return this._entityNamespace;
|
|
34
|
+
}
|
|
35
|
+
set entityNamespace(value) {
|
|
36
|
+
this._entityNamespace = value;
|
|
37
|
+
}
|
|
38
|
+
get entityType() {
|
|
39
|
+
return this._entityType;
|
|
40
|
+
}
|
|
41
|
+
set entityType(value) {
|
|
42
|
+
this._entityType = value;
|
|
43
|
+
}
|
|
44
|
+
get name() {
|
|
45
|
+
return this._name;
|
|
46
|
+
}
|
|
47
|
+
set name(value) {
|
|
48
|
+
this._name = value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IDataSourcePage } from "igniteui-webcomponents-core";
|
|
2
|
+
import { IDataSourceSchema } from "igniteui-webcomponents-core";
|
|
3
|
+
import { ISectionInformation } from "igniteui-webcomponents-core";
|
|
4
|
+
import { ISummaryResult } from "igniteui-webcomponents-core";
|
|
5
|
+
export declare class ODataDataSourcePage implements IDataSourcePage {
|
|
6
|
+
private _actualData;
|
|
7
|
+
private _schema;
|
|
8
|
+
private _pageIndex;
|
|
9
|
+
private _groupInformation;
|
|
10
|
+
private _summaryInformation;
|
|
11
|
+
constructor(sourceData_: any, schema: IDataSourceSchema, groupInformation: ISectionInformation[], summaryInformation: ISummaryResult[], pageIndex: number);
|
|
12
|
+
count(): number;
|
|
13
|
+
getItemAtIndex(index: number): any;
|
|
14
|
+
getItemValueAtIndex(index: number, valueName: string): any;
|
|
15
|
+
pageIndex(): number;
|
|
16
|
+
schema(): IDataSourceSchema;
|
|
17
|
+
getGroupInformation(): ISectionInformation[];
|
|
18
|
+
getSummaryInformation(): ISummaryResult[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { DataSourceSchemaPropertyType } from "igniteui-webcomponents-core";
|
|
2
|
+
export class ODataDataSourcePage {
|
|
3
|
+
constructor(sourceData_, schema, groupInformation, summaryInformation, pageIndex) {
|
|
4
|
+
this._actualData = null;
|
|
5
|
+
this._schema = null;
|
|
6
|
+
this._pageIndex = 0;
|
|
7
|
+
this._groupInformation = null;
|
|
8
|
+
this._summaryInformation = null;
|
|
9
|
+
if (sourceData_ == null) {
|
|
10
|
+
this._actualData = null;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
let count = (sourceData_.value.length);
|
|
14
|
+
this._actualData = [];
|
|
15
|
+
let dateProps = new Set();
|
|
16
|
+
for (let i = 0; i < schema.propertyNames.length; i++) {
|
|
17
|
+
if (schema.propertyTypes[i] == DataSourceSchemaPropertyType.DateTimeValue || schema.propertyTypes[i] == DataSourceSchemaPropertyType.DateTimeOffsetValue) {
|
|
18
|
+
dateProps.add(schema.propertyNames[i]);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
let value_;
|
|
22
|
+
for (let i_ = 0; i_ < count; i_++) {
|
|
23
|
+
let currItem_ = sourceData_.value[i_];
|
|
24
|
+
let dict = new Map();
|
|
25
|
+
let properties = Array.from(Object.keys(currItem_));
|
|
26
|
+
let values = (properties.map((k) => currItem_[k]));
|
|
27
|
+
for (let i1 = 0; i1 < properties.length; i1++) {
|
|
28
|
+
value_ = values[i1];
|
|
29
|
+
if (dateProps.has(properties[i1])) {
|
|
30
|
+
value_ = new Date(value_);
|
|
31
|
+
}
|
|
32
|
+
dict.set(properties[i1], value_);
|
|
33
|
+
}
|
|
34
|
+
this._actualData[i_] = dict;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
this._schema = schema;
|
|
38
|
+
this._groupInformation = groupInformation;
|
|
39
|
+
this._summaryInformation = summaryInformation;
|
|
40
|
+
this._pageIndex = pageIndex;
|
|
41
|
+
}
|
|
42
|
+
count() {
|
|
43
|
+
return this._actualData.length;
|
|
44
|
+
}
|
|
45
|
+
getItemAtIndex(index) {
|
|
46
|
+
return this._actualData[index];
|
|
47
|
+
}
|
|
48
|
+
getItemValueAtIndex(index, valueName) {
|
|
49
|
+
let item = this._actualData[index];
|
|
50
|
+
if (!item.has(valueName)) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return item.get(valueName);
|
|
54
|
+
}
|
|
55
|
+
pageIndex() {
|
|
56
|
+
return this._pageIndex;
|
|
57
|
+
}
|
|
58
|
+
schema() {
|
|
59
|
+
return this._schema;
|
|
60
|
+
}
|
|
61
|
+
getGroupInformation() {
|
|
62
|
+
return this._groupInformation;
|
|
63
|
+
}
|
|
64
|
+
getSummaryInformation() {
|
|
65
|
+
return this._summaryInformation;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { XNamespace } from "igniteui-webcomponents-core";
|
|
2
|
+
import { IDataSourceSchema } from "igniteui-webcomponents-core";
|
|
3
|
+
export declare class ODataSchemaProvider {
|
|
4
|
+
private _entityTypeSchemaNamespace;
|
|
5
|
+
private _entitySetSchemaNamespace;
|
|
6
|
+
static nS: XNamespace;
|
|
7
|
+
constructor(metadataDocument: string);
|
|
8
|
+
private _schema;
|
|
9
|
+
private get schema();
|
|
10
|
+
private set schema(value);
|
|
11
|
+
getODataDataSourceSchema(entitySet: string): IDataSourceSchema;
|
|
12
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Schema } from "./Schema";
|
|
2
|
+
import { XDocument } from "igniteui-webcomponents-core";
|
|
3
|
+
import { XElement } from "igniteui-webcomponents-core";
|
|
4
|
+
import { XName } from "igniteui-webcomponents-core";
|
|
5
|
+
import { XNamespace } from "igniteui-webcomponents-core";
|
|
6
|
+
import { DataSourceSchemaPropertyType } from "igniteui-webcomponents-core";
|
|
7
|
+
import { ODataDataSourceSchema } from "igniteui-webcomponents-core";
|
|
8
|
+
import { XmlNodeType } from "igniteui-webcomponents-core";
|
|
9
|
+
import { toArray, first } from './util';
|
|
10
|
+
import { fromEnum, typeCast } from "igniteui-webcomponents-core";
|
|
11
|
+
class ODataSchemaProvider {
|
|
12
|
+
static { this.nS = XNamespace.get("http://docs.oasis-open.org/odata/ns/edm"); }
|
|
13
|
+
constructor(metadataDocument) {
|
|
14
|
+
this._entityTypeSchemaNamespace = null;
|
|
15
|
+
this._entitySetSchemaNamespace = null;
|
|
16
|
+
this._schema = null;
|
|
17
|
+
if (null == metadataDocument) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
let xmlDoc = XDocument.parse(metadataDocument);
|
|
21
|
+
let schemaElements = toArray(first(fromEnum(first(fromEnum(xmlDoc.elements())).elements())).elements1(XName.get("Schema", ODataSchemaProvider.nS.namespaceName)));
|
|
22
|
+
if (null == schemaElements) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
let entitySetElements = null;
|
|
26
|
+
let entityTypeElements = null;
|
|
27
|
+
let elementCount = schemaElements.length;
|
|
28
|
+
let entityContainer = XName.get("EntityContainer", ODataSchemaProvider.nS.namespaceName);
|
|
29
|
+
let entitySet = XName.get("EntitySet", ODataSchemaProvider.nS.namespaceName);
|
|
30
|
+
let namespaceAttribute = XName.get("Namespace", "");
|
|
31
|
+
let entityType = XName.get("EntityType", ODataSchemaProvider.nS.namespaceName);
|
|
32
|
+
for (let i = 0; i < elementCount; i++) {
|
|
33
|
+
let node = schemaElements[i];
|
|
34
|
+
if (node.nodeType != XmlNodeType.Element) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
let schemaElement = schemaElements[i];
|
|
38
|
+
if (null == entitySetElements) {
|
|
39
|
+
let nodes = toArray(schemaElement.elements1(entityContainer));
|
|
40
|
+
if (null != nodes && nodes.length > 0) {
|
|
41
|
+
entitySetElements = toArray((typeCast(XElement.$type, nodes[0])).elements1(entitySet));
|
|
42
|
+
if (null != entitySetElements) {
|
|
43
|
+
this._entitySetSchemaNamespace = schemaElement.attribute(namespaceAttribute).value;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (null == entityTypeElements) {
|
|
48
|
+
entityTypeElements = toArray(schemaElement.elements1(entityType));
|
|
49
|
+
if (null != entityTypeElements) {
|
|
50
|
+
this._entityTypeSchemaNamespace = schemaElement.attribute(namespaceAttribute).value;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (null == entitySetElements || null == entityTypeElements) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.schema = new Schema(this._entityTypeSchemaNamespace, entityTypeElements, entitySetElements);
|
|
58
|
+
}
|
|
59
|
+
get schema() {
|
|
60
|
+
return this._schema;
|
|
61
|
+
}
|
|
62
|
+
set schema(value) {
|
|
63
|
+
this._schema = value;
|
|
64
|
+
}
|
|
65
|
+
getODataDataSourceSchema(entitySet) {
|
|
66
|
+
if (this.schema == null) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
let valueNames = [];
|
|
70
|
+
let valueTypes = [];
|
|
71
|
+
let primaryKey = [];
|
|
72
|
+
let es = this.schema.entitySets.get(entitySet);
|
|
73
|
+
if (null != es) {
|
|
74
|
+
let entity = this.schema.entities.get(es.entityName);
|
|
75
|
+
if (null != entity) {
|
|
76
|
+
for (let property of entity.properties.values()) {
|
|
77
|
+
valueNames.push(property.name);
|
|
78
|
+
if (property.type == "Edm.String") {
|
|
79
|
+
valueTypes.push(DataSourceSchemaPropertyType.StringValue);
|
|
80
|
+
}
|
|
81
|
+
else if (property.type == "Edm.Int16" || property.type == "Edm.Int32") {
|
|
82
|
+
valueTypes.push(DataSourceSchemaPropertyType.IntValue);
|
|
83
|
+
}
|
|
84
|
+
else if (property.type == "Edm.Double") {
|
|
85
|
+
valueTypes.push(DataSourceSchemaPropertyType.DoubleValue);
|
|
86
|
+
}
|
|
87
|
+
else if (property.type == "Edm.Single") {
|
|
88
|
+
valueTypes.push(DataSourceSchemaPropertyType.SingleValue);
|
|
89
|
+
}
|
|
90
|
+
else if (property.type == "Edm.Boolean") {
|
|
91
|
+
valueTypes.push(DataSourceSchemaPropertyType.BooleanValue);
|
|
92
|
+
}
|
|
93
|
+
else if (property.type == "Edm.Byte") {
|
|
94
|
+
valueTypes.push(DataSourceSchemaPropertyType.ShortValue);
|
|
95
|
+
}
|
|
96
|
+
else if (property.type == "Edm.DateTime" || property.type == "Edm.DateTimeOffset") {
|
|
97
|
+
valueTypes.push(DataSourceSchemaPropertyType.DateTimeValue);
|
|
98
|
+
}
|
|
99
|
+
else if (property.type == "Edm.Int64") {
|
|
100
|
+
valueTypes.push(DataSourceSchemaPropertyType.LongValue);
|
|
101
|
+
}
|
|
102
|
+
else if (property.type == "Edm.Decimal") {
|
|
103
|
+
valueTypes.push(DataSourceSchemaPropertyType.DecimalValue);
|
|
104
|
+
}
|
|
105
|
+
else if (property.type == "Edm.SByte") {
|
|
106
|
+
valueTypes.push(DataSourceSchemaPropertyType.ShortValue);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
valueTypes.push(DataSourceSchemaPropertyType.ObjectValue);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
for (let k of entity.primaryKey) {
|
|
113
|
+
primaryKey.push(k);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return new ODataDataSourceSchema(valueNames, valueTypes, primaryKey);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export { ODataSchemaProvider };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { VirtualDataSource } from "igniteui-webcomponents-core";
|
|
2
|
+
import { IDataSource } from "igniteui-webcomponents-core";
|
|
3
|
+
import { IExternalDataSource } from "igniteui-webcomponents-core";
|
|
4
|
+
export declare class ODataVirtualDataSource extends VirtualDataSource implements IExternalDataSource {
|
|
5
|
+
constructor();
|
|
6
|
+
private onBaseUriChanged;
|
|
7
|
+
private _baseUri;
|
|
8
|
+
get baseUri(): string;
|
|
9
|
+
set baseUri(value: string);
|
|
10
|
+
private onEntitySetChanged;
|
|
11
|
+
private _entitySet;
|
|
12
|
+
get entitySet(): string;
|
|
13
|
+
set entitySet(value: string);
|
|
14
|
+
private onTimeoutMillisecondsChanged;
|
|
15
|
+
private _timeoutMilliseconds;
|
|
16
|
+
get timeoutMilliseconds(): number;
|
|
17
|
+
set timeoutMilliseconds(value: number);
|
|
18
|
+
get isSortingSupportedOverride(): boolean;
|
|
19
|
+
get isFilteringSupportedOverride(): boolean;
|
|
20
|
+
get isGroupingSupportedOverride(): boolean;
|
|
21
|
+
private _isAggregationSupportedByServer;
|
|
22
|
+
get isAggregationSupportedByServer(): boolean;
|
|
23
|
+
set isAggregationSupportedByServer(isSupported: boolean);
|
|
24
|
+
private _enableJsonp;
|
|
25
|
+
get enableJsonp(): boolean;
|
|
26
|
+
set enableJsonp(isEnabled: boolean);
|
|
27
|
+
clone(): IDataSource;
|
|
28
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { VirtualDataSource } from "igniteui-webcomponents-core";
|
|
2
|
+
import { ODataVirtualDataSourceDataProvider } from "./ODataVirtualDataSourceDataProvider";
|
|
3
|
+
import { typeCast } from "igniteui-webcomponents-core";
|
|
4
|
+
export class ODataVirtualDataSource extends VirtualDataSource {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
this._baseUri = null;
|
|
8
|
+
this._entitySet = null;
|
|
9
|
+
this._timeoutMilliseconds = 10000;
|
|
10
|
+
this._isAggregationSupportedByServer = false;
|
|
11
|
+
this._enableJsonp = true;
|
|
12
|
+
this.dataProvider = ((() => {
|
|
13
|
+
let $ret = new ODataVirtualDataSourceDataProvider();
|
|
14
|
+
$ret.executionContext = this.executionContext;
|
|
15
|
+
$ret.enableJsonp = this.enableJsonp;
|
|
16
|
+
$ret.isAggregationSupported = this.isGroupingSupported;
|
|
17
|
+
return $ret;
|
|
18
|
+
})());
|
|
19
|
+
this.externalDataSource = this;
|
|
20
|
+
}
|
|
21
|
+
onBaseUriChanged(oldValue, newValue) {
|
|
22
|
+
if (typeCast(ODataVirtualDataSourceDataProvider.$type, this.actualDataProvider) !== null) {
|
|
23
|
+
this.actualDataProvider.baseUri = this.baseUri;
|
|
24
|
+
}
|
|
25
|
+
this.queueAutoRefresh();
|
|
26
|
+
}
|
|
27
|
+
get baseUri() {
|
|
28
|
+
return this._baseUri;
|
|
29
|
+
}
|
|
30
|
+
set baseUri(value) {
|
|
31
|
+
let oldValue = this._baseUri;
|
|
32
|
+
this._baseUri = value;
|
|
33
|
+
if (oldValue != this._baseUri) {
|
|
34
|
+
this.onBaseUriChanged(oldValue, this._baseUri);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
onEntitySetChanged(oldValue, newValue) {
|
|
38
|
+
if (typeCast(ODataVirtualDataSourceDataProvider.$type, this.actualDataProvider) !== null) {
|
|
39
|
+
this.actualDataProvider.entitySet = this.entitySet;
|
|
40
|
+
}
|
|
41
|
+
this.queueAutoRefresh();
|
|
42
|
+
}
|
|
43
|
+
get entitySet() {
|
|
44
|
+
return this._entitySet;
|
|
45
|
+
}
|
|
46
|
+
set entitySet(value) {
|
|
47
|
+
let oldValue = this._entitySet;
|
|
48
|
+
this._entitySet = value;
|
|
49
|
+
if (this._entitySet != oldValue) {
|
|
50
|
+
this.onEntitySetChanged(oldValue, this._entitySet);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
onTimeoutMillisecondsChanged(oldValue, newValue) {
|
|
54
|
+
if (typeCast(ODataVirtualDataSourceDataProvider.$type, this.actualDataProvider) !== null) {
|
|
55
|
+
this.actualDataProvider.timeoutMilliseconds = this.timeoutMilliseconds;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
get timeoutMilliseconds() {
|
|
59
|
+
return this._timeoutMilliseconds;
|
|
60
|
+
}
|
|
61
|
+
set timeoutMilliseconds(value) {
|
|
62
|
+
let oldValue = this._timeoutMilliseconds;
|
|
63
|
+
this._timeoutMilliseconds = value;
|
|
64
|
+
if (oldValue != this._timeoutMilliseconds) {
|
|
65
|
+
this.onTimeoutMillisecondsChanged(oldValue, this._timeoutMilliseconds);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
get isSortingSupportedOverride() {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
get isFilteringSupportedOverride() {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
get isGroupingSupportedOverride() {
|
|
75
|
+
return this.isAggregationSupportedByServer;
|
|
76
|
+
}
|
|
77
|
+
get isAggregationSupportedByServer() {
|
|
78
|
+
return this._isAggregationSupportedByServer;
|
|
79
|
+
}
|
|
80
|
+
set isAggregationSupportedByServer(isSupported) {
|
|
81
|
+
this._isAggregationSupportedByServer = isSupported;
|
|
82
|
+
if (typeCast(ODataVirtualDataSourceDataProvider.$type, this.actualDataProvider) !== null) {
|
|
83
|
+
this.actualDataProvider.isAggregationSupported = isSupported;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
get enableJsonp() {
|
|
87
|
+
return this._enableJsonp;
|
|
88
|
+
}
|
|
89
|
+
set enableJsonp(isEnabled) {
|
|
90
|
+
this._enableJsonp = isEnabled;
|
|
91
|
+
if (typeCast(ODataVirtualDataSourceDataProvider.$type, this.actualDataProvider) !== null) {
|
|
92
|
+
this.actualDataProvider.enableJsonp = isEnabled;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
clone() {
|
|
96
|
+
let dataSource = new ODataVirtualDataSource();
|
|
97
|
+
dataSource.executionContext = this.executionContext;
|
|
98
|
+
dataSource.includeSummaryRowsInSection = this.includeSummaryRowsInSection;
|
|
99
|
+
dataSource.isSectionCollapsable = this.isSectionCollapsable;
|
|
100
|
+
dataSource.isSectionExpandedDefault = this.isSectionExpandedDefault;
|
|
101
|
+
//dataSource.isSectionHeaderNormalRow = this.isSectionHeaderNormalRow;
|
|
102
|
+
dataSource.isSectionSummaryRowsAtBottom = this.isSectionSummaryRowsAtBottom;
|
|
103
|
+
//dataSource.isSectionContentVisible = this.isSectionContentVisible;
|
|
104
|
+
dataSource.primaryKey = this.primaryKey;
|
|
105
|
+
dataSource.propertiesRequested = this.propertiesRequested;
|
|
106
|
+
dataSource.sectionHeaderDisplayMode = this.sectionHeaderDisplayMode;
|
|
107
|
+
dataSource.shouldEmitSectionFooters = this.shouldEmitSectionFooters;
|
|
108
|
+
dataSource.shouldEmitSectionHeaders = this.shouldEmitSectionHeaders;
|
|
109
|
+
dataSource.shouldEmitShiftedRows = this.shouldEmitShiftedRows;
|
|
110
|
+
dataSource.summaryScope = this.summaryScope;
|
|
111
|
+
for (var i = 0; i < this.groupDescriptions.size(); i++) {
|
|
112
|
+
dataSource.groupDescriptions.add(this.groupDescriptions.get(i));
|
|
113
|
+
}
|
|
114
|
+
for (var i = 0; i < this.sortDescriptions.size(); i++) {
|
|
115
|
+
dataSource.sortDescriptions.add(this.sortDescriptions.get(i));
|
|
116
|
+
}
|
|
117
|
+
for (var i = 0; i < this.filterExpressions.size(); i++) {
|
|
118
|
+
dataSource.filterExpressions.add(this.filterExpressions.get(i));
|
|
119
|
+
}
|
|
120
|
+
for (var i = 0; i < this.summaryDescriptions.size(); i++) {
|
|
121
|
+
dataSource.summaryDescriptions.add(this.summaryDescriptions.get(i));
|
|
122
|
+
}
|
|
123
|
+
dataSource.pageSizeRequested = this.pageSizeRequested;
|
|
124
|
+
dataSource.maxCachedPages = this.maxCachedPages;
|
|
125
|
+
dataSource.baseUri = this.baseUri;
|
|
126
|
+
dataSource.entitySet = this.entitySet;
|
|
127
|
+
dataSource.timeoutMilliseconds = this.timeoutMilliseconds;
|
|
128
|
+
dataSource.isAggregationSupportedByServer = this.isAggregationSupportedByServer;
|
|
129
|
+
dataSource.enableJsonp = this.enableJsonp;
|
|
130
|
+
return dataSource;
|
|
131
|
+
}
|
|
132
|
+
}
|