42 lines
2.1 KiB
JavaScript
Executable File
42 lines
2.1 KiB
JavaScript
Executable File
"use strict";
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.dev/license
|
|
*/
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.default = default_1;
|
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
const utils_1 = require("../../utils");
|
|
/** Scaffolds a new Angular component that uses the Drag and Drop module. */
|
|
function default_1(options) {
|
|
return (0, schematics_1.chain)([
|
|
(0, utils_1.buildComponent)(Object.assign({}, options), {
|
|
template: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template',
|
|
stylesheet: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.__style__.template',
|
|
}),
|
|
options.skipImport ? (0, schematics_1.noop)() : addDragDropModulesToModule(options),
|
|
]);
|
|
}
|
|
/** Adds the required modules to the main module of the CLI project. */
|
|
function addDragDropModulesToModule(options) {
|
|
return (host) => __awaiter(this, void 0, void 0, function* () {
|
|
const isStandalone = yield (0, utils_1.isStandaloneSchematic)(host, options);
|
|
if (!isStandalone) {
|
|
const modulePath = yield (0, utils_1.findModuleFromOptions)(host, options);
|
|
(0, utils_1.addModuleImportToModule)(host, modulePath, 'DragDropModule', '@angular/cdk/drag-drop');
|
|
}
|
|
});
|
|
}
|
|
//# sourceMappingURL=index.js.map
|