Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/js-smart/ng-kit
Reusable Angular components, Utility classes
https://github.com/js-smart/ng-kit
angular bootstrap typescript
Last synced: 16 days ago
JSON representation
Reusable Angular components, Utility classes
- Host: GitHub
- URL: https://github.com/js-smart/ng-kit
- Owner: js-smart
- License: mit
- Created: 2021-12-14T02:34:21.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-19T16:47:53.000Z (23 days ago)
- Last Synced: 2024-11-19T17:45:11.253Z (23 days ago)
- Topics: angular, bootstrap, typescript
- Language: TypeScript
- Homepage: https://ng-kit.netlify.app/
- Size: 6.59 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-angular - ng-kit - Reusable Angular components built with Angular Material and Bootstrap 5.x, Utility classes/functions for Date, Form and String operations. (Table of contents / Third Party Components)
- fucking-awesome-angular - ng-kit - Reusable Angular components built with Angular Material and Bootstrap 5.x, Utility classes/functions for Date, Form and String operations. (Table of contents / Third Party Components)
README
# Angular components and utilities
Reusable Angular components built with Angular Material and Bootstrap 5.x, Utility classes/functions for Date, Form and String operations
[![CI](https://github.com/js-smart/ng-kit/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/js-smart/ng-kit/actions/workflows/build.yml)
### Installation
Install the library
```shell
npm install @js-smart/ng-kit
```and use it as shown below in each section
### Technologies
1. Angular
2. Bootstrap## Auto Complete
Reusable Auto Complete that extends Mat Auto Complete component
### Demo
https://ng-kit.netlify.app
### Usage
The library has one `autocomplete` component. To use the Auto Complete component, add the following code to the HTML page
**app.component.html**
```typescript
< /form>```
**app.component.ts**
Then define form group instances and object array (cities) and names (for string array)
```typescript
// Define objects
cities = [{ id: 1001, location: 'New York' }, { id: 1002, location: 'Boston' }, { id: 1001, location: 'Washington DC' }];// Define Form Groups
inputFormGroup = this.fb.group({
autocomplete: ['']
})//Display function
displayFn(object
:
any
):
string
{
if (typeof object === "string") return object;
return object && object["location"] ? object["location"] : "";
}
```If you are using strings rather than objects, do not provide `bindLabel`, `bindValue` and `displayWith` inputs. See below sample
```
```
### Auto Complete API
#### List of selectors that can be used to select the component(s)
| AutoComplete Selector |
|--------------------------------|
| autocomplete, lib-autocomplete |#### Properties
| Property | Description | Type | Default Value |
|----------------|---------------------------------------------------------------------------------------------------------------------------|-------------------|---------------|
| inputFormGroup | Input Form Group | FormGroup | |
| label | Label of the AutoComplete | string | |
| placeHolder | PlaceHolder of the AutoComplete | string | |
| appearance | Appearance of the AutoComplete, defaults to `fill` | string | fill |
| classes | List of CSS classes that need to applied to autocomplete | string | |
| bindLabel | Applies only to AutoComplete with Objects. Attribute of the Object whose value would be shown when searching for data | string | id |
| bindValue | Applies only to AutoComplete with Objects. Attribute of the Object whose value would be used for search. Defaults to `ID` | string | id |
| displayWith | Applies only to AutoComplete with Objects. A function used to show display value in Input | boolean | false |
| required | Provide `true` if AutoComplete is required, otherwise provide `false` | boolean | false |
| data | List of Objects or String values that need to be bind and searched for | any[] or string[] | false |## Alert
Reusable alert component created with Bootstrap 5+ and Angular 17+
### Auto Complete API
#### List of selectors that can be used to select the component
| Selector |
|-----------------|
| alert,lib-alert |#### Properties
| Property | Description | Type | Default Value |
|------------------|------------------------------------------------------------------------------------------------------------|------------------|---------------|
| dismissible | If set, displays an inline "Close" button | boolean | false |
| dismissOnTimeout | If set, dismisses the alert after Dismiss Timeout | boolean | true |
| dismissTimeout | Number in milliseconds, after which alert will be closed | string or number | 5000 |
| isOpen | Is alert visible | boolean | false |
| type | Alert type. Provides one of four bootstrap supported contextual classes: success, info, warning and danger | string | info |## Spinner
Reusable Spinner component created with Bootstrap 5.x and Angular 17.x
### Demo
https://main--js-smart-ng-kit.netlify.app/alert-demo
### API
#### List of selectors that can be used to select the component
| Selector |
|---------------------|
| spinner,lib-spinner |#### Properties
| Property | Description | Type | Default Value |
|------------------|----------------------------------------------|--------------------------|---------------|
| bootstrapSpinner | Use Boostrap Spinner. Default `true` | boolean | false |
| diameter | Diameter of the Angular Material spinner | boolean | true |
| color | Color of the Angular Material spinner | string or `ThemePalette` | 5000 |
| strokeWidth | Stroke Width of the Angular Material spinner | boolean | false |Angular (2++) directive that prints HTML section
### Usage
Import the main module `NgxPrintModule` :
```js
import { NgxPrintModule } from '@js-smart/print';@NgModule({
...
imports:
[NgxPrintModule, ...],
...
})export class YourAppModule {
}
```**3-** Then plug n' play with it:
- Assuming you want to print the following HTML section:
```html
```
- Now, what you have to do is tagging your *wanted-to-print* section by an `id` attribute, then link that `id` to a
directive parameter in your button :```html
```
### Optional properties
- You want a customized title for your printing window ? you have the choice by adding a new attribute to your print
button `printTitle`:```html
```
- Also, would you like to customize the printing window style sheet (CSS) ? Hence you can do so by adding infinite
styles to another attribute called `printStyle`:```html
```
Here some simple styles were added to every `h1` & `h2` tags within the `div` where `print-section` is tagged to
its `id` attribute.- If you would like to use your existing CSS with media print you can add the `useExistingCss` attribute:
```html
```
- If you want to customize the printing window style sheet (CSS) by importing the css provided in assets/css
use `styleSheetFile`:```html
```
### Publish library to NPM
1. Build the library
```shell
nx build ng-kit
```
2. If the NPM token is not configured, open `~/.npmrc` and add the following line:
```shell
//registry.npmjs.org/:_authToken=
```
3. Then navigate to `dist` directory anf publish the library to NPM. If prompted, enter the 2fa auth code from the Authenticator app.
```shell
cd dist/libs/ng-kit && npm publish --tag latest
```
For beta releases use tag `--tag beta`