igniteui-react-grids
Version:
Ignite UI React grid components.
70 lines (68 loc) • 1.88 kB
JavaScript
import { PrimaryKeyValue as PrimaryKeyValue_internal } from "./PrimaryKeyValue";
/**
* A primary key value.
*/
export class IgrPrimaryKeyValue {
get i() {
return this._implementation;
}
onImplementationCreated() {
}
constructor(primaryKey = null, primaryKeyValue = null) {
this._implementation = new PrimaryKeyValue_internal(primaryKey, primaryKeyValue);
this._implementation.externalObject = this;
}
_provideImplementation(i) {
this._implementation = i;
this._implementation.externalObject = this;
this.onImplementationCreated();
}
static createIdentityKey(item) {
let int = PrimaryKeyValue_internal.createIdentityKey(item);
let ext = new IgrPrimaryKeyValue(null, null);
ext._provideImplementation(int);
return ext;
}
/**
* The primary key associated with this value.
*/
get key() {
return this.i.key;
}
set key(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.key = v;
}
/**
* The value of the keys for this primary key value.
*/
get value() {
return this.i.value;
}
set value(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.value = v;
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
}
/**
* Determines if two primary key values are equal.
* @param other * The other key value to check against.
*/
equals(other) {
let iv = this.i.equals(other);
return (iv);
}
}