@ngneat/cmdk
Advanced tools
Comparing version 1.1.0-beta.1 to 2.0.0-beta.1
import { ModuleWithProviders } from '@angular/core'; | ||
import * as i0 from "@angular/core"; | ||
import * as i1 from "./components/command/command.component"; | ||
import * as i2 from "./directives/input/input.directive"; | ||
import * as i3 from "./directives/empty/empty.directive"; | ||
import * as i4 from "./components/group/group.component"; | ||
import * as i5 from "./components/separator/separator.component"; | ||
import * as i6 from "./directives/item/item.directive"; | ||
import * as i7 from "./directives/loader/loader.directive"; | ||
import * as i8 from "./components/list/list.component"; | ||
import * as i9 from "@angular/common"; | ||
import * as i10 from "@ngneat/overview"; | ||
import * as i11 from "@angular/cdk/a11y"; | ||
import * as i1 from "@angular/common"; | ||
import * as i2 from "@ngneat/overview"; | ||
import * as i3 from "@angular/cdk/a11y"; | ||
import * as i4 from "./components/command/command.component"; | ||
import * as i5 from "./directives/input/input.directive"; | ||
import * as i6 from "./directives/empty/empty.directive"; | ||
import * as i7 from "./components/group/group.component"; | ||
import * as i8 from "./components/separator/separator.component"; | ||
import * as i9 from "./directives/item/item.directive"; | ||
import * as i10 from "./directives/loader/loader.directive"; | ||
import * as i11 from "./components/list/list.component"; | ||
export declare class CmdkModule { | ||
static forRoot(): ModuleWithProviders<CmdkModule>; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<CmdkModule, never>; | ||
static ɵmod: i0.ɵɵNgModuleDeclaration<CmdkModule, [typeof i1.CommandComponent, typeof i2.InputDirective, typeof i3.EmptyDirective, typeof i4.GroupComponent, typeof i5.SeparatorComponent, typeof i6.ItemDirective, typeof i7.LoaderDirective, typeof i8.ListComponent], [typeof i9.CommonModule, typeof i10.DynamicViewModule, typeof i11.A11yModule], [typeof i1.CommandComponent, typeof i2.InputDirective, typeof i3.EmptyDirective, typeof i4.GroupComponent, typeof i5.SeparatorComponent, typeof i6.ItemDirective, typeof i7.LoaderDirective, typeof i8.ListComponent]>; | ||
static ɵmod: i0.ɵɵNgModuleDeclaration<CmdkModule, never, [typeof i1.CommonModule, typeof i2.DynamicViewModule, typeof i3.A11yModule, typeof i4.CommandComponent, typeof i5.InputDirective, typeof i6.EmptyDirective, typeof i7.GroupComponent, typeof i8.SeparatorComponent, typeof i9.ItemDirective, typeof i10.LoaderDirective, typeof i11.ListComponent], [typeof i4.CommandComponent, typeof i5.InputDirective, typeof i6.EmptyDirective, typeof i7.GroupComponent, typeof i8.SeparatorComponent, typeof i9.ItemDirective, typeof i10.LoaderDirective, typeof i11.ListComponent]>; | ||
static ɵinj: i0.ɵɵInjectorDeclaration<CmdkModule>; | ||
} |
@@ -43,3 +43,3 @@ import { EventEmitter, QueryList, AfterViewInit, OnChanges, SimpleChanges, OnDestroy } from '@angular/core'; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<CommandComponent, never>; | ||
static ɵcmp: i0.ɵɵComponentDeclaration<CommandComponent, "cmdk-command", ["cmdkCommand"], { "value": "value"; "ariaLabel": "ariaLabel"; "loading": "loading"; "filter": "filter"; "loop": "loop"; }, { "valueChanged": "valueChanged"; }, ["empty", "loader", "items", "groups", "lists", "separators"], ["*"], false, never>; | ||
static ɵcmp: i0.ɵɵComponentDeclaration<CommandComponent, "cmdk-command", ["cmdkCommand"], { "value": { "alias": "value"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "filter": { "alias": "filter"; "required": false; }; "loop": { "alias": "loop"; "required": false; }; }, { "valueChanged": "valueChanged"; }, ["empty", "loader", "items", "groups", "lists", "separators"], ["*"], true, never>; | ||
} |
@@ -23,3 +23,3 @@ import { ChangeDetectorRef, QueryList } from '@angular/core'; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<GroupComponent, never>; | ||
static ɵcmp: i0.ɵɵComponentDeclaration<GroupComponent, "cmdk-group", never, { "label": "label"; "ariaLabel": "ariaLabel"; }, {}, ["items"], ["*"], false, never>; | ||
static ɵcmp: i0.ɵɵComponentDeclaration<GroupComponent, "cmdk-group", never, { "label": { "alias": "label"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; }, {}, ["items"], ["*"], true, never>; | ||
} |
@@ -24,3 +24,3 @@ import { AfterViewInit, ChangeDetectorRef, ElementRef, OnDestroy, QueryList } from '@angular/core'; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<ListComponent, never>; | ||
static ɵcmp: i0.ɵɵComponentDeclaration<ListComponent, "cmdk-list", never, { "ariaLabel": "ariaLabel"; }, {}, ["items"], ["*"], false, never>; | ||
static ɵcmp: i0.ɵɵComponentDeclaration<ListComponent, "cmdk-list", never, { "ariaLabel": { "alias": "ariaLabel"; "required": false; }; }, {}, ["items"], ["*"], true, never>; | ||
} |
@@ -12,3 +12,3 @@ import { ChangeDetectorRef } from '@angular/core'; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<SeparatorComponent, never>; | ||
static ɵcmp: i0.ɵɵComponentDeclaration<SeparatorComponent, "cmdk-separator", never, {}, {}, never, never, false, never>; | ||
static ɵcmp: i0.ɵɵComponentDeclaration<SeparatorComponent, "cmdk-separator", never, {}, {}, never, never, true, never>; | ||
} |
@@ -9,3 +9,3 @@ import * as i0 from "@angular/core"; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<EmptyDirective, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<EmptyDirective, "[cmdkEmpty]", never, {}, {}, never, never, false, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<EmptyDirective, "[cmdkEmpty]", never, {}, {}, never, never, true, never>; | ||
} |
@@ -13,3 +13,3 @@ import { AfterViewInit, OnDestroy } from '@angular/core'; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<InputDirective, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<InputDirective, "input[cmdkInput]", never, { "updateOn": "updateOn"; "value": "value"; }, {}, never, never, false, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<InputDirective, "input[cmdkInput]", never, { "updateOn": { "alias": "updateOn"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, {}, never, never, true, never>; | ||
} |
@@ -9,5 +9,3 @@ import { ListKeyManagerOption } from '@angular/cdk/a11y'; | ||
get disabled(): any; | ||
selected: EventEmitter<{ | ||
event: KeyboardEvent | PointerEvent; | ||
}>; | ||
selected: EventEmitter<any>; | ||
originalDisplay: string; | ||
@@ -25,3 +23,3 @@ getLabel?(): string; | ||
_elementRef: ElementRef<any>; | ||
onClick(ev: PointerEvent): void; | ||
onClick(): void; | ||
onKeyUp(ev: KeyboardEvent): void; | ||
@@ -41,3 +39,3 @@ get hidden(): boolean; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<ItemDirective, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<ItemDirective, "[cmdkItem]", never, { "disabled": "disabled"; "filtered": "filtered"; "value": "value"; }, { "selected": "selected"; }, never, never, false, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<ItemDirective, "[cmdkItem]", never, { "disabled": { "alias": "disabled"; "required": false; }; "filtered": { "alias": "filtered"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "selected": "selected"; }, never, never, true, never>; | ||
} |
@@ -1,11 +0,9 @@ | ||
import { TemplateRef, ViewContainerRef } from '@angular/core'; | ||
import * as i0 from "@angular/core"; | ||
export declare class LoaderDirective { | ||
private _hasView; | ||
private _templateRef; | ||
private _viewContainer; | ||
private _hasView; | ||
constructor(_templateRef: TemplateRef<any>, _viewContainer: ViewContainerRef); | ||
set cmdkLoader(condition: boolean | undefined); | ||
static ɵfac: i0.ɵɵFactoryDeclaration<LoaderDirective, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<LoaderDirective, "[cmdkLoader]", never, {}, {}, never, never, false, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<LoaderDirective, "[cmdkLoader]", never, {}, {}, never, never, true, never>; | ||
} |
@@ -55,5 +55,3 @@ import { EventEmitter } from '@angular/core'; | ||
*/ | ||
selected: EventEmitter<{ | ||
event: KeyboardEvent | PointerEvent; | ||
}>; | ||
selected: EventEmitter<void>; | ||
} | ||
@@ -60,0 +58,0 @@ export interface CmdkInputProps { |
{ | ||
"name": "@ngneat/cmdk", | ||
"version": "1.1.0-beta.1", | ||
"version": "2.0.0-beta.1", | ||
"peerDependencies": { | ||
"@angular/common": "^15.1.0", | ||
"@angular/core": "^15.1.0" | ||
"@angular/common": ">=16.0.0", | ||
"@angular/core": ">16.0.0" | ||
}, | ||
"dependencies": { | ||
"tslib": "^2.3.0", | ||
"@ngneat/overview": "^4.1.0", | ||
"@ngneat/until-destroy": "^9.2.3", | ||
"@angular/cdk": "^15.2.0" | ||
"@ngneat/overview": ">=5.0.0", | ||
"@ngneat/until-destroy": ">=10.0.0", | ||
"@angular/cdk": ">=16.0.0" | ||
}, | ||
@@ -34,7 +34,3 @@ "keywords": [ | ||
"schematics": "./schematics/collection.json", | ||
"module": "fesm2015/ngneat-cmdk.mjs", | ||
"es2020": "fesm2020/ngneat-cmdk.mjs", | ||
"esm2020": "esm2020/ngneat-cmdk.mjs", | ||
"fesm2020": "fesm2020/ngneat-cmdk.mjs", | ||
"fesm2015": "fesm2015/ngneat-cmdk.mjs", | ||
"module": "fesm2022/ngneat-cmdk.mjs", | ||
"typings": "index.d.ts", | ||
@@ -47,7 +43,5 @@ "exports": { | ||
"types": "./index.d.ts", | ||
"esm2020": "./esm2020/ngneat-cmdk.mjs", | ||
"es2020": "./fesm2020/ngneat-cmdk.mjs", | ||
"es2015": "./fesm2015/ngneat-cmdk.mjs", | ||
"node": "./fesm2015/ngneat-cmdk.mjs", | ||
"default": "./fesm2020/ngneat-cmdk.mjs" | ||
"esm2022": "./esm2022/ngneat-cmdk.mjs", | ||
"esm": "./esm2022/ngneat-cmdk.mjs", | ||
"default": "./fesm2022/ngneat-cmdk.mjs" | ||
} | ||
@@ -54,0 +48,0 @@ }, |
@@ -33,7 +33,8 @@ <p align="center"> | ||
## Table of Contents | ||
## Compatibility with Angular Versions | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [FAQ](#faq) | ||
| @ngneat/cmdk | Angular | | ||
| -- | -- | | ||
| 1.x | <16 | | ||
| 2.x | >=16 | | ||
@@ -51,6 +52,17 @@ ## Installation | ||
```bash | ||
# First, install dependencies | ||
npm install @ngneat/overview @ngneat/until-destroy @angular/cdk | ||
# For Angular version < 16 | ||
npm install @ngneat/cmdk | ||
## First, install dependencies | ||
npm install @ngneat/overview@4 @ngneat/until-destroy@9 @angular/cdk@15 | ||
## Then library | ||
npm install @ngneat/cmdk@1 | ||
# For Angular version >= 16 | ||
## First, install dependencies | ||
npm install @ngneat/overview@5 @ngneat/until-destroy@10 @angular/cdk@16 | ||
## Then library | ||
npm install @ngneat/cmdk@2 | ||
``` | ||
@@ -60,13 +72,12 @@ | ||
```bash | ||
# First, install dependencies | ||
yarn add @ngneat/overview @ngneat/until-destroy @angular/cdk | ||
Same as `npm`, just instead of `npm install`, write `yarn add`. | ||
yarn add @ngneat/cmdk | ||
``` | ||
## Usage | ||
### 1. Import in module | ||
### 1. Setup | ||
#### 1.1 Module Setup | ||
> This is taken care with ng add @ngneat/cmdk | ||
```ts | ||
@@ -83,2 +94,30 @@ import { CmdkModule } from '@ngneat/cmdk'; | ||
#### 1.2 Standalone Setup | ||
```typescript | ||
import { AppComponent } from './src/app.component'; | ||
import { | ||
CommandComponent, | ||
GroupComponent, | ||
InputDirective, | ||
ItemDirective, | ||
ListComponent, | ||
EmptyDirective | ||
} from '@ngneat/cmdk'; | ||
@Component({ | ||
selector: 'app-root', | ||
standalone: true, | ||
imports: [ | ||
CommandComponent, | ||
InputDirective, | ||
ListComponent, | ||
GroupComponent, | ||
ItemDirective, | ||
EmptyDirective | ||
], | ||
}) | ||
``` | ||
### 2. Start using it | ||
@@ -190,8 +229,8 @@ | ||
| Name | Description | | ||
|-------------------------------------------------------------------| -------------------------------------------------------------------------------- | | ||
| <code>value: string | undefined;</code> | Contextual Value of the list-item | | ||
| `@Input() disabled: boolean` | Contextually mark the item as disabled. Keyboard navigation will skip this item. | | ||
| `@Input() filtered: boolean` | Contextually mark the item as filtered. | | ||
| `@Output() selected: EventEmitter<KeyboardEvent \| PointerEvent>` | Event handler called when the item is selected | | ||
| Name | Description | | ||
| -------------------------------------------- | -------------------------------------------------------------------------------- | | ||
| <code>value: string | undefined;</code> | Contextual Value of the list-item | | ||
| `@Input() disabled: boolean` | Contextually mark the item as disabled. Keyboard navigation will skip this item. | | ||
| `@Input() filtered: boolean` | Contextually mark the item as filtered. | | ||
| `@Output() selected: EventEmitter<void>` | Event handler called when the item is selected | | ||
@@ -198,0 +237,0 @@ ### Group |
@@ -48,18 +48,23 @@ "use strict"; | ||
} | ||
const modulePath = (0, ng_ast_utils_1.getAppModulePath)(host, project.architect.build.options.main); | ||
const moduleSource = (0, utils_1.getSourceFile)(host, modulePath); | ||
importModuleSet.forEach((item) => { | ||
if ((0, ast_utils_1.isImported)(moduleSource, item.moduleName, item.importPath)) { | ||
context.logger.warn(`Could not import "${item.moduleName}" because it's already imported.`); | ||
} | ||
else { | ||
const change = (0, ast_utils_1.insertImport)(moduleSource, modulePath, item.moduleName, item.importPath); | ||
if (change) { | ||
const recorder = host.beginUpdate(modulePath); | ||
recorder.insertLeft(change.pos, change.toAdd); | ||
host.commitUpdate(recorder); | ||
context.logger.log('info', '✅ Written import statement for "' + item.moduleName + '"'); | ||
if (!(0, ng_ast_utils_1.isStandaloneApp)(host, project.architect.build.options.main)) { | ||
const modulePath = (0, ng_ast_utils_1.getAppModulePath)(host, project.architect.build.options.main); | ||
const moduleSource = (0, utils_1.getSourceFile)(host, modulePath); | ||
importModuleSet.forEach((item) => { | ||
if ((0, ast_utils_1.isImported)(moduleSource, item.moduleName, item.importPath)) { | ||
context.logger.warn(`Could not import "${item.moduleName}" because it's already imported.`); | ||
} | ||
} | ||
}); | ||
else { | ||
const change = (0, ast_utils_1.insertImport)(moduleSource, modulePath, item.moduleName, item.importPath); | ||
if (change) { | ||
const recorder = host.beginUpdate(modulePath); | ||
recorder.insertLeft(change.pos, change.toAdd); | ||
host.commitUpdate(recorder); | ||
context.logger.log('info', '✅ Written import statement for "' + item.moduleName + '"'); | ||
} | ||
} | ||
}); | ||
} | ||
else { | ||
context.logger.log('info', 'ℹ️ Skipped import for stand-alone application. Need to be imported manually.'); | ||
} | ||
return host; | ||
@@ -66,0 +71,0 @@ } |
@@ -19,3 +19,3 @@ "use strict"; | ||
const getProjectFromWorkspace = (workspace, projectName) => { | ||
const finalProjectName = projectName || workspace.defaultProject; | ||
const finalProjectName = projectName; | ||
if (finalProjectName) { | ||
@@ -22,0 +22,0 @@ const project = workspace.projects[finalProjectName]; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
489
286389
59
3226
1
+ Added@angular/cdk@19.0.5(transitive)
+ Added@angular/common@19.0.6(transitive)
+ Added@angular/core@19.0.6(transitive)
+ Added@ngneat/overview@6.1.1(transitive)
+ Added@ngneat/until-destroy@10.0.0(transitive)
+ Addedzone.js@0.15.0(transitive)
- Removed@angular/cdk@15.2.9(transitive)
- Removed@angular/common@15.2.10(transitive)
- Removed@angular/core@15.2.10(transitive)
- Removed@ngneat/overview@4.1.0(transitive)
- Removed@ngneat/until-destroy@9.2.3(transitive)
- Removedzone.js@0.13.3(transitive)
Updated@angular/cdk@>=16.0.0
Updated@ngneat/overview@>=5.0.0