Skip to content

Commit

Permalink
docs: update to standalone API and schematics less installation
Browse files Browse the repository at this point in the history
  • Loading branch information
geromegrignon committed Nov 29, 2023
1 parent 23c2e26 commit 186e11a
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 3,234 deletions.
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,30 @@ Following open/closed principle, the library focuses on the switch mechanism, gi

## Installation

`ng add @ngneat/edit-in-place`
`npm install @ngneat/edit-in-place`

## Usage

### version 1.9 and above

> The project is now using the Angular Standalone API and support SSR.
> It requires Angular 16+
Imports the **EditableComponent**, **EditModeDirective** and **EditModeDirective** in the ìmports array of your **NgModule** or your standalone**Component**:

```typescript
import { EditableModule } from '@ngneat/edit-in-place';

@NgModule({
...
standalone: true,
imports: [EditableComponent, EditModeDirective, EditModeDirective],
})
export class AppComponent {}
```

### version 1.6 and below

Add the `EditableModule` to your `AppModule`.

```typescript
Expand Down Expand Up @@ -212,18 +232,26 @@ The following actions will trigger this event:

#### editableFocusable

> import { EditableFocusableDirective } from '@ngneat/edit-in-place';
Focus the host element when switching to `editMode` (for nested inputs).

#### editableOnEnter

> import { EditableOnEnterDirective } from '@ngneat/edit-in-place';
Listen to keyup `enter` to switch to `viewMode` and update the value of the `viewMode` host element.

#### editableOnEscape

> import { EditableOnEscapeDirective } from '@ngneat/edit-in-place';
Listen to keyup `escape` to switch to `viewMode` without updating the value of the `viewMode` host element.

#### editableOnSave

> import { EditableOnSaveDirective } from '@ngneat/edit-in-place';
Listen to a `MouseEvent` on ths host element in order to switch to `viewMode` and udpate the value of the content of the `viewMode`*host element.

| @Input | Type | Description | Default |
Expand Down Expand Up @@ -315,6 +343,8 @@ It's triggered by the `editableGroupCancel`:

#### editableGroup

> import { EditableGroupDirective } from '@ngneat/edit-in-place';
Overcharges the behavior of children editable Components to work as one entity.

| @Output | Type | Description |
Expand All @@ -326,16 +356,22 @@ Overcharges the behavior of children editable Components to work as one entity.

#### editableGroupEdit

> import { EditableGroupEditDirective } from '@ngneat/edit-in-place';
Listen to a click `MouseEvent` to switch to *editMode*.


#### editableGroupSave

> import { EditableGroupSaveDirective } from '@ngneat/edit-in-place';
Listen to a click `MouseEvent` to switch to *viewMode* and update the value of the group.


#### editableGroupCancel

> import { EditableGroupCancelDirective } from '@ngneat/edit-in-place';
Listen to a click `MouseEvent` to switch to *viewMode* without updating the value of the group.


Expand Down
3 changes: 2 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@
"production": {
"tsConfig": "projects/ngneat/edit-in-place/tsconfig.lib.prod.json"
}
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@
"contributors:add": "all-contributors add",
"hooks:pre-commit": "node hooks/pre-commit.js",
"commit": "git-cz",
"build:lib": "ng build @ngneat/edit-in-place && npm run schematics:build && npm run copy",
"build:lib": "ng build @ngneat/edit-in-place && npm run copy",
"test:lib": "ng test @ngneat/edit-in-place",
"release": "cd projects/ngneat/edit-in-place && standard-version --infile ../../../CHANGELOG.md",
"copy": "npm run schematics:copy && cp -r README.md dist/ngneat/edit-in-place",
"schematics:build": "npm run build --prefix ./schematics",
"schematics:copy": "cp -r schematics/src/ dist/ngneat/edit-in-place/schematics",
"copy": "cp -r README.md dist/ngneat/edit-in-place",
"test:lib:headless": "cross-env CI=true npm run test:lib",
"prettier:check": "prettier --check \"**\"",
"prettier": "prettier --write \"**\""
Expand Down
18 changes: 0 additions & 18 deletions schematics/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions schematics/.npmignore

This file was deleted.

Loading

0 comments on commit 186e11a

Please sign in to comment.