UNPKG

isoxml-angular

Version:

JavaScript library to parse and generate ISOXML (ISO11783-10) files

74 lines (73 loc) 2.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DeviceElement = void 0; const classRegistry_1 = require("../classRegistry"); const utils_1 = require("../utils"); const ATTRIBUTES = { A: { name: "DeviceElementId", type: "xs:ID", isPrimaryId: true, isOptional: false, isOnlyV4: false, }, B: { name: "DeviceElementObjectId", type: "xs:unsignedShort", isPrimaryId: false, isOptional: false, isOnlyV4: false, minValue: 1, maxValue: 65534, }, C: { name: "DeviceElementType", type: "xs:NMTOKEN", isPrimaryId: false, isOptional: false, isOnlyV4: false, }, D: { name: "DeviceElementDesignator", type: "xs:string", isPrimaryId: false, isOptional: true, isOnlyV4: false, }, E: { name: "DeviceElementNumber", type: "xs:unsignedShort", isPrimaryId: false, isOptional: false, isOnlyV4: false, minValue: 0, maxValue: 4095, }, F: { name: "ParentObjectId", type: "xs:unsignedShort", isPrimaryId: false, isOptional: false, isOnlyV4: false, minValue: 0, maxValue: 65534, }, }; const CHILD_TAGS = { DOR: { name: "DeviceObjectReference", isOnlyV4: false }, }; class DeviceElement { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = "DET" /* TAGS.DeviceElement */; } static fromXML(xml, isoxmlManager, internalId, targetClass = DeviceElement) { return (0, utils_1.fromXML)(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return (0, utils_1.toXML)(this, ATTRIBUTES, CHILD_TAGS); } } exports.DeviceElement = DeviceElement; (0, classRegistry_1.registerEntityClass)("main", "DET" /* TAGS.DeviceElement */, DeviceElement);