@progress/kendo-schematics
Advanced tools
Comparing version 3.0.1 to 3.1.0-dev.202205110915
@@ -6,3 +6,3 @@ { | ||
"license": "SEE LICENSE in LICENSE.md", | ||
"version": "3.0.1", | ||
"version": "3.1.0-dev.202205110915", | ||
"scripts": { | ||
@@ -9,0 +9,0 @@ "build-package": "npm run build", |
@@ -11,8 +11,2 @@ { | ||
}, | ||
"grid": { | ||
"description": "Generates a component containing Kendo Angular Grid component", | ||
"schema": "./collection/grid/schema.json", | ||
"factory": "./collection/grid/index#grid", | ||
"hidden": true | ||
}, | ||
"ng-add": { | ||
@@ -22,4 +16,9 @@ "description": "Register Kendo Angular components", | ||
"factory": "./collection/ngAdd/index#ngAdd" | ||
} | ||
}, | ||
"grid": { | ||
"description": "Generates a component containing Kendo Angular Grid component.", | ||
"factory": "./collection/grid/index#grid", | ||
"schema": "./collection/grid/schema.json" | ||
} | ||
} | ||
} |
import { Rule } from '@angular-devkit/schematics'; | ||
export declare function grid(options: any): Rule; | ||
import { Schema } from './schema'; | ||
export declare function grid(_options: Schema): Rule; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.grid = void 0; | ||
const core_1 = require("@angular-devkit/core"); | ||
const schematics_1 = require("@angular-devkit/schematics"); | ||
const operators_1 = require("rxjs/operators"); | ||
const utils_1 = require("../utils"); | ||
const rules_1 = require("../rules"); | ||
const packageDeps = { | ||
"@progress/kendo-angular-grid": "latest" | ||
}; | ||
const templateSource = schematics_1.url('files'); | ||
const templateContent = (t) => ({ | ||
templateContent: t.read('content.tmpl').toString() | ||
}); | ||
const prepareTemplates = (context) => utils_1.asObservable(templateSource(context)).pipe(operators_1.map(templateContent)); | ||
function grid(options) { | ||
const moduleOptions = { | ||
module: options.module, | ||
symbolName: 'BarComponent', | ||
symbolImport: '@progress/kendo-bar' | ||
}; //resolve declr, imports, exports, etc. | ||
const dependencies = {}; //resolve package deps. | ||
const rules = schematics_1.chain([ | ||
rules_1.addDeclarationToNgModule(moduleOptions), | ||
rules_1.addToPackageJson({ dependencies }) | ||
]); | ||
return rules_1.withBase(prepareTemplates, rules)(options); | ||
const path_1 = require("path"); | ||
const data_1 = require("./files/data"); | ||
function grid(_options) { | ||
return (_tree, _context) => { | ||
_options.name = path_1.basename(_options.name); | ||
let path = path_1.normalize('/' + path_1.dirname((_options.path + '/' + _options.name))); | ||
if (process.platform == "win32") { | ||
path = path.replace(/\\/g, '/'); | ||
} | ||
const templateSource = schematics_1.apply(schematics_1.url(_options.inlineTemplate ? './files/inline' : './files/html'), [ | ||
schematics_1.template(Object.assign(Object.assign({}, _options), { classify: core_1.strings.classify, dasherize: core_1.strings.dasherize, arrayify(args) { | ||
return args.map(s => `'${s}'`).join(", "); | ||
} })), | ||
schematics_1.move(_options.path), | ||
]); | ||
const angularComponentOptions = { | ||
path: _options.path, | ||
name: _options.name, | ||
inlineTemplate: _options.inlineTemplate, | ||
inlineStyle: _options.inlineStyle, | ||
skipTests: _options.skipTests | ||
}; | ||
if (_options.mockedData) { | ||
_tree.create(`${_options.path}/${_options.name}/data.ts`, `export const products = ${data_1.products}`); | ||
} | ||
return schematics_1.chain([ | ||
schematics_1.externalSchematic('@schematics/angular', 'component', angularComponentOptions), | ||
schematics_1.mergeWith(templateSource, schematics_1.MergeStrategy.Overwrite) | ||
]); | ||
}; | ||
} | ||
exports.grid = grid; |
@@ -0,49 +1,60 @@ | ||
import { strings } from '@angular-devkit/core'; | ||
import { | ||
Rule, | ||
SchematicContext, | ||
Tree, | ||
chain, | ||
url | ||
apply, | ||
chain, | ||
externalSchematic, | ||
MergeStrategy, | ||
mergeWith, | ||
move, | ||
Rule, | ||
SchematicContext, | ||
template, | ||
Tree, | ||
url | ||
} from '@angular-devkit/schematics'; | ||
import { map } from 'rxjs/operators'; | ||
import { basename, normalize, dirname, win32 } from 'path'; | ||
import { Schema } from './schema'; | ||
import { products } from './files/data'; | ||
import { | ||
asObservable | ||
} from '../utils'; | ||
export function grid(_options: Schema): Rule { | ||
return (_tree: Tree, _context: SchematicContext) => { | ||
_options.name = basename(_options.name); | ||
import { | ||
addDeclarationToNgModule, | ||
addToPackageJson, | ||
withBase, | ||
ComponentTemplate | ||
} from '../rules'; | ||
let path = normalize('/' + dirname((_options.path + '/' + _options.name))); | ||
if (process.platform == "win32") { | ||
path = path.replace(/\\/g, '/'); | ||
} | ||
const packageDeps = { | ||
"@progress/kendo-angular-grid": "latest" | ||
}; | ||
const templateSource = apply( | ||
url(_options.inlineTemplate ? './files/inline' : './files/html'), [ | ||
template({ | ||
..._options, | ||
classify: strings.classify, | ||
dasherize: strings.dasherize, | ||
arrayify(args: string[]) { | ||
return args.map(s => `'${s}'`).join(", "); | ||
} | ||
}), | ||
move(_options.path), | ||
], | ||
); | ||
const templateSource = url('files'); | ||
const templateContent = (t: Tree) => ({ | ||
templateContent: t.read('content.tmpl').toString() | ||
}); | ||
const prepareTemplates: ComponentTemplate = (context: SchematicContext) => | ||
asObservable(templateSource(context)).pipe( | ||
map(templateContent) | ||
); | ||
const angularComponentOptions = { | ||
path: _options.path, | ||
name: _options.name, | ||
inlineTemplate: _options.inlineTemplate, | ||
inlineStyle: _options.inlineStyle, | ||
skipTests: _options.skipTests | ||
}; | ||
export function grid(options: any): Rule { | ||
const moduleOptions = { | ||
module: options.module, | ||
symbolName: 'BarComponent', | ||
symbolImport: '@progress/kendo-bar' | ||
}; //resolve declr, imports, exports, etc. | ||
const dependencies = {}; //resolve package deps. | ||
if(_options.mockedData) { | ||
_tree.create(`${_options.path}/${_options.name}/data.ts`, `export const products = ${products}`); | ||
} | ||
const rules = chain([ | ||
addDeclarationToNgModule(moduleOptions), | ||
addToPackageJson({ dependencies }) | ||
]); | ||
return withBase(prepareTemplates, rules)(options); | ||
return chain([ | ||
externalSchematic('@schematics/angular', 'component', angularComponentOptions), | ||
mergeWith(templateSource, MergeStrategy.Overwrite) | ||
]); | ||
}; | ||
} |
@@ -1,3 +0,17 @@ | ||
import { Schema as ComponentSchema } from '../component/schema'; | ||
export interface Schema extends ComponentSchema { | ||
export interface Schema { | ||
path?: string; | ||
name: string; | ||
inlineStyle: boolean; | ||
inlineTemplate: boolean; | ||
skipTests: boolean; | ||
filtering?: boolean; | ||
grouping?: boolean; | ||
paging?: boolean; | ||
sorting?: boolean; | ||
pageSize?: number; | ||
height?: number; | ||
columns?: Array<string>; | ||
dataPath?: string; | ||
dataName: string; | ||
mockedData?: boolean; | ||
} |
{ | ||
"$schema": "http://json-schema.org/schema", | ||
"$id": "grid", | ||
"title": "Create a Kendo Angular Grid component", | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"description": "Library name" | ||
}, | ||
"sourceDir": { | ||
"type": "string", | ||
"format": "path", | ||
"description": "The path of the source directory.", | ||
"default": "src", | ||
"alias": "sd", | ||
"visible": false | ||
}, | ||
"path": { | ||
"type": "string", | ||
"format": "path", | ||
"description": "The path to create the component.", | ||
"default": "app", | ||
"visible": false | ||
}, | ||
"appRoot": { | ||
"type": "string", | ||
"format": "path", | ||
"description": "The root of the application.", | ||
"visible": false | ||
}, | ||
"flat": { | ||
"type": "boolean", | ||
"description": "Flag to indicate if a dir is created.", | ||
"default": false | ||
}, | ||
"prefix": { | ||
"type": "string", | ||
"format": "html-selector", | ||
"description": "The prefix to apply to generated selectors.", | ||
"alias": "p" | ||
}, | ||
"selector": { | ||
"type": "string", | ||
"format": "html-selector", | ||
"description": "The selector to use for the component." | ||
}, | ||
"inlineTemplate": { | ||
"description": "Specifies if the template will be in the ts file.", | ||
"type": "boolean", | ||
"default": false, | ||
"alias": "it" | ||
}, | ||
"inlineStyle": { | ||
"description": "Specifies if the style will be in the ts file.", | ||
"type": "boolean", | ||
"default": false, | ||
"alias": "s" | ||
}, | ||
"styleext": { | ||
"description": "The file extension to be used for style files.", | ||
"type": "string", | ||
"default": "css" | ||
}, | ||
"viewEncapsulation": { | ||
"description": "Specifies the view encapsulation strategy.", | ||
"enum": ["Emulated", "Native", "None"], | ||
"type": "string", | ||
"alias": "v" | ||
}, | ||
"changeDetection": { | ||
"description": "Specifies the change detection strategy.", | ||
"enum": ["Default", "OnPush"], | ||
"type": "string", | ||
"default": "Default" | ||
}, | ||
"module": { | ||
"type": "string", | ||
"description": "Allows specification of the declaring module.", | ||
"alias": "m" | ||
}, | ||
"export": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Specifies if declaring module exports the component." | ||
}, | ||
"skipImport": { | ||
"type": "boolean", | ||
"description": "Flag to skip the module import.", | ||
"default": false | ||
} | ||
}, | ||
"required": [ | ||
"name" | ||
] | ||
"progress:name": "Grid", | ||
"progress:description": "Generate new Kendo UI for Angular Grid page", | ||
"$schema": "http://json-schema.org/schema", | ||
"$id": "Schema", | ||
"type": "object", | ||
"properties": { | ||
"path": { | ||
"type": "string", | ||
"format": "path", | ||
"progress:editorVisible": false | ||
}, | ||
"name": { | ||
"type": "string", | ||
"$default": { | ||
"$source": "argv", | ||
"index": 0 | ||
}, | ||
"default": "GridPage" | ||
}, | ||
"inlineTemplate": { | ||
"progress:display-name": "Inline template", | ||
"description": "Include template inline in the component.ts file. By default, an external template file is created and referenced in the component.ts file.", | ||
"type": "boolean", | ||
"default": false, | ||
"alias": "t" | ||
}, | ||
"inlineStyle": { | ||
"description": "Include styles inline in the component.ts file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the component.ts file.", | ||
"type": "boolean", | ||
"default": false, | ||
"alias": "s" | ||
}, | ||
"skipTests": { | ||
"type": "boolean", | ||
"description": "Do not create \"spec.ts\" test files for the new component.", | ||
"default": false | ||
}, | ||
"filtering": { | ||
"progress:category": "Grid Features", | ||
"description": "Enables Grid filtering", | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"grouping": { | ||
"description": "Enables Grid grouping", | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"paging": { | ||
"description": "Enables Grid paging", | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"sorting": { | ||
"description": "Enables Grid sorting", | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"pageSize": { | ||
"description": "Sets the pageSize of a pageable Grid", | ||
"type": "number", | ||
"default": 3 | ||
}, | ||
"height": { | ||
"description": "Sets the height of the Grid", | ||
"type": "number", | ||
"default": 300 | ||
}, | ||
"columns": { | ||
"progress:category": "Data Binding", | ||
"description": "Specifies the fields that will be rendered as columns in the Grid", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"uniqueItems": true | ||
}, | ||
"mockedData": { | ||
"description": "Enables the generation of a local data file", | ||
"type": "boolean" | ||
}, | ||
"dataPath": { | ||
"description": "Sets a path to the local data file", | ||
"type": "string", | ||
"progress:hideOnPropertyValue": { | ||
"property": "mockedData", | ||
"value": true | ||
} | ||
}, | ||
"dataName": { | ||
"description": "Sets a name to the local data property", | ||
"type": "string", | ||
"progress:hideOnPropertyValue": { | ||
"property": "mockedData", | ||
"value": true | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"name" | ||
] | ||
} |
@@ -1,3 +0,17 @@ | ||
import { Schema as ComponentSchema } from '../component/schema'; | ||
export interface Schema extends ComponentSchema { | ||
} | ||
export interface Schema { | ||
path?: string; | ||
name: string; | ||
inlineStyle: boolean; | ||
inlineTemplate: boolean; | ||
skipTests: boolean; | ||
filtering?: boolean; | ||
grouping?: boolean; | ||
paging?: boolean; | ||
sorting?: boolean; | ||
pageSize?: number; | ||
height?: number; | ||
columns?: Array<string>; | ||
dataPath?: string; | ||
dataName: string; | ||
mockedData?: boolean; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
308988
86
6715
1