UNPKG

@taiga-ui/cdk

Version:

Base library for creating Angular components and applications using Taiga UI principles regarding of actual visual appearance

26 lines 1.44 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.migrateProgressSegmented = void 0; const elements_1 = require("../../../../utils/templates/elements"); const inputs_1 = require("../../../../utils/templates/inputs"); const template_resource_1 = require("../../../../utils/templates/template-resource"); function migrateProgressSegmented({ resource, recorder, fileSystem, }) { const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem); const templateOffset = (0, template_resource_1.getTemplateOffset)(resource); const elements = (0, elements_1.findElementsByTagName)(template, 'tui-progress-segmented'); elements.forEach(({ attrs, sourceCodeLocation }) => { var _a, _b; if (!sourceCodeLocation) { return; } const maxAttr = (0, inputs_1.findAttr)(attrs, 'max'); if (!maxAttr) { return; } const max = maxAttr.value; const insertTo = ((_b = (_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[maxAttr.name]) === null || _b === void 0 ? void 0 : _b.endOffset) || 0; recorder.insertRight(insertTo + templateOffset, ` [segments]="${max}"`); }); } exports.migrateProgressSegmented = migrateProgressSegmented; //# sourceMappingURL=migrate-progress-segmented.js.map