UNPKG

angular-odata

Version:

Client side OData typescript library for Angular

57 lines 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Enum = exports.EnumValue = void 0; const core_1 = require("@angular-devkit/core"); const base_1 = require("./base"); const schematics_1 = require("@angular-devkit/schematics"); class EnumValue { constructor(edmType) { this.edmType = edmType; } name() { return this.edmType.Name; } value() { return this.edmType.Value; } } exports.EnumValue = EnumValue; class Enum extends base_1.Base { constructor(options, edmType) { super(options); this.edmType = edmType; } template() { return (0, schematics_1.url)('./files/enum'); } variables() { var _a; return { type: this.name() + 'EnumType', values: ((_a = this.edmType.Member) !== null && _a !== void 0 ? _a : []).map((m) => new EnumValue(m)), }; } name() { return core_1.strings.classify(this.edmType.name()); } fileName() { return core_1.strings.dasherize(this.edmType.name()) + '.enum'; } directory() { return this.edmType.namespace().replace(/\./g, '/'); } fullName() { return this.edmType.fullName(); } members() { return this.edmType.Member.map((m) => `${m.Name} = ${m.Value}`); } flags() { return this.edmType.IsFlags; } importTypes() { return []; } } exports.Enum = Enum; //# sourceMappingURL=enum.js.map