Coder Social home page Coder Social logo

tiaguinho / material-community-components Goto Github PK

View Code? Open in Web Editor NEW
323.0 20.0 50.0 7.42 MB

:panda_face: Angular Material Components created from the community

Home Page: https://tiaguinho.github.io/material-community-components

License: MIT License

TypeScript 60.45% HTML 29.11% JavaScript 1.32% SCSS 9.08% Shell 0.03%
material angular angular-material2 community angular-components typescript timerpicker colorpicker scrollspy speed-dial

material-community-components's Introduction

Material Community Components

Angular Material components that are not implemented in official package.

npm version Travis CI Coverage Status patreon

The idea of the Material Community Components is to provide components that aren't available in the Angular Material2 yet.

All the components are created using Angular, Material 2 and CDK. Since version 7.1.0 only Angular 9+ is supported.

The color-picker component has an additional peer-dependency to @thebespokepixel/es-tinycolor to help with color calculations.

Check out our documentation & live demo

Components

All the components have the prefix mcc followed by the package name.

Component Package Screenshot
Color Picker mcc-color-picker alt text
Scrollspy mcc-scrollspy alt text
Speed Dial mcc-speed-dial alt text
Timer Picker mcc-timer-picker alt text

If you miss any component, please follow the CONTRIBUTION GUIDELINE to open an issue or file your idea here.

Install

step: 1

We use some components from Angular Material. To be able to use this components, you have to install the @angular/animations. If you follow all the steps in Material Guide, you already have this step done.

    npm install --save @angular/animations

Note: @angular/animations uses the WebAnimation API that isn't supported by all browsers yet. If you want to support Material component animations in these browsers, you'll have to include a polyfill.

import {BrowserAnimationsModule} from '@angular/platform-browser/animations';

@NgModule({
  ...
  imports: [BrowserAnimationsModule],
  ...
})
export class PizzaPartyAppModule { }

If you don't want to add another dependency to your project, you can use the NoopAnimationsModule.

import {NoopAnimationsModule} from '@angular/platform-browser/animations';

@NgModule({
  ...
  imports: [NoopAnimationsModule],
  ...
})
export class PizzaPartyAppModule { }

step: 2

Install material community components package:

    npm install material-community-components

or

  yarn add material-community-components

Theming

To use the same theme of Angular Material add the following code to your style.scss.

@use '~@angular/material' as mat;
@use '~material-community-components/theming' as mcc;

@include mat.core();

// Define the palettes for your theme using the Material Design palettes available in palette.scss
// (imported above). For each palette, you can optionally specify a default, lighter, and darker
// hue. Available color palettes: https://material.io/design/color/
$demo-primary: mat.define-palette(mat.$green-palette);
$demo-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);

// The warn palette is optional (defaults to red).
$demo-warn: mat.define-palette(mat.$red-palette);

// Create the theme object (a Sass map containing all of the palettes).
$demo-theme: mat.define-light-theme($demo-primary, $demo-accent, $demo-warn);

// build angular material theme
@include mat.all-component-themes($demo-theme);

// pass angular material theme to material community components
@include mcc.mcc-theme($demo-theme); 

Right now only timer-picker and speed-dial do support the theme (see ISSUE-172).

Upgrading from 7.x.x

Since version 9.0.0 the lib only provides secondary entry-points for import. To migrate change your imports like that:

Before:

import { MccColorPickerModule} from 'material-community-components';
import { MccTimerPickerModule} from 'material-community-components';
import { MccSpeedDialModule} from 'material-community-components';
import { MccScrollspyModule} from 'material-community-components';

After:

import { MccColorPickerModule} from 'material-community-components/color-picker';
import { MccTimerPickerModule} from 'material-community-components/timer-picker';
import { MccSpeedDialModule} from 'material-community-components/speed-dial';
import { MccScrollspyModule} from 'material-community-components/scrollspy';

How to use

For more examples, you can see our demo folder or read the documentation

License

The MIT License (MIT) Copyright (c) 2018

Sponsors

alt text

material-community-components's People

Contributors

amhhernandez avatar damingerdai avatar dependabot[bot] avatar doclm avatar josduj avatar jpisano avatar leocaseiro avatar motabass avatar osamuca avatar phigamedevelopment avatar pierrickhus avatar r3gloria avatar rennnyyy avatar striky1 avatar tiaguinho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

material-community-components's Issues

Missing half of picker

Sometimes half of picker missing, depends on screen size and picker position on screen or if we have scroll.
Maybe suggestion is that we have onOpen emitter so we can handle what we can do in these cases ( and many more situations ). In general I think it would be good option to have open emitter.

Thanks
Examples with missing part:
Bottom part missing
picker-example
Top part missing
picker-example2

EMPTY_COLOR customization

Is it possible to implement the possibility to customize the EMPTY_COLOR constant?
My application is multi-language and I would be very happy not having 'none' always shown for the empty color and sent back as color value (in fact, I would prefer to set it to empty string).

selected color not updated in preview hex and background due to bug in coerceHexaColor

When changing the color the RGB values get updated while changing, but the hex value and background color of the preview-div are not updated.

I fixed it locally by changing coerceHexaColor in color-picker.ts
The validity check fails on the fact that the string doesn't start with a '#'

So I added the following lines at the beginning of the function:

if (color != null && color.charAt(0) !== '#') {
color = #${color};
}

PS:
I'm using the picker with [hideUsedColors]="true" [hideEmptyUsedColors]="true"
in which case the buttons overlap with the preview-div.
I fixed it locally by increasing the height of .mcc-color-picker-selector-preview to 70px instead of 40px

Scrollspy component

On the Material website, when we start to scroll the page, the right nav current section automatically changes.

The idea of this components is to provide an easy way to map the page and automatically create that right navigation system.

Errors compiling the module (MatColorPicker) in AOT, fresh project

Describe the bug
The library (mat-color-picker) makes the project un-compilable in --aot compilation.

To Reproduce
Steps to reproduce the behavior:

  1. ng new testapp
  2. cd testapp
  3. npm install --save @angular/material
  4. npm install --save @angular/cdk
  5. npm install --save rxjs-compat
  6. npm install --save mat-color-picker
  7. edit src\app\app.module.ts and add import BrowserAnimationsModule, MatColorPickerModule
  8. ng serve --aot

Expected behavior
Application to compile

Actual behavior
ERROR in Error during template compile of 'MatColorPickerModule'
Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'NgModule'
'NgModule' calls 'ɵmakeDecorator'.
node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.
node_modules/mat-color-picker/node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.

Desktop (please complete the following information):

  • OS: Windows 10

Project fails to build locally when running `npm start`

I get the following error when running npm start with a freshly cloned repo. Creating an empty src/demo-app/assets directory fixed the error.

Error: ENOENT: no such file or directory, stat '/Users/alockwood/material-community-components/src/demo-app/assets'
    at Object.fs.statSync (fs.js:972:11)
    at Observable.rxjs_1.Observable.obs [as _subscribe] (/Users/alockwood/material-community-components/node_modules/@angular/cli/node_modules/@angular-devkit/core/node/host.js:212:25)
    at Observable.subscribe (/Users/alockwood/material-community-components/node_modules/rxjs/internal/Observable.js:162:69)
    at MapOperator.call (/Users/alockwood/material-community-components/node_modules/rxjs/internal/operators/map.js:62:23)
    at Observable.subscribe (/Users/alockwood/material-community-components/node_modules/rxjs/internal/Observable.js:159:22)
    at CatchOperator.call (/Users/alockwood/material-community-components/node_modules/rxjs/internal/operators/catchError.js:85:23)
    at Observable.subscribe (/Users/alockwood/material-community-components/node_modules/rxjs/internal/Observable.js:159:22)
    at MapOperator.call (/Users/alockwood/material-community-components/node_modules/rxjs/internal/operators/map.js:62:23)
    at Observable.subscribe (/Users/alockwood/material-community-components/node_modules/rxjs/internal/Observable.js:159:22)
    at /Users/alockwood/material-community-components/node_modules/rxjs/internal/util/subscribeTo.js:22:31
    at Object.subscribeToResult (/Users/alockwood/material-community-components/node_modules/rxjs/internal/util/subscribeToResult.js:7:45)
    at new ForkJoinSubscriber (/Users/alockwood/material-community-components/node_modules/rxjs/internal/observable/forkJoin.js:165:57)
    at Observable._subscribe (/Users/alockwood/material-community-components/node_modules/rxjs/internal/observable/forkJoin.js:145:16)
    at Observable.subscribe (/Users/alockwood/material-community-components/node_modules/rxjs/internal/Observable.js:162:69)
    at /Users/alockwood/material-community-components/node_modules/rxjs/internal/util/subscribeTo.js:22:31
    at Object.subscribeToResult (/Users/alockwood/material-community-components/node_modules/rxjs/internal/util/subscribeToResult.js:7:45)

Tests

Add tests to the component.

New Design

Change component design to be smaller

Compatibility with angular and rxjs 6

Angular 6 should be released on April. This package seems to be incompatible with Angular upgrade to RxJS 6

I test it with a sample project generated with ng new angular-test

"dependencies": {
  "@angular/animations": "^6.0.0-rc.0",
  "@angular/cdk": "^6.0.0-beta.5",
  "@angular/common": "^6.0.0-rc.0",
  "@angular/compiler": "^6.0.0-rc.0",
  "@angular/core": "^6.0.0-rc.0",
  "@angular/forms": "^6.0.0-rc.0",
  "@angular/http": "^6.0.0-rc.0",
  "@angular/material": "^6.0.0-beta.5",
  "@angular/platform-browser": "^6.0.0-rc.0",
  "@angular/platform-browser-dynamic": "^6.0.0-rc.0",
  "@angular/router": "^6.0.0-rc.0",
  "core-js": "^2.4.1",
  "material-community-components": "^2.6.8",
  "rxjs": "^6.0.0-beta.3",
  "zone.js": "^0.8.20"
},
"devDependencies": {
  "@angular/compiler-cli": "^6.0.0-rc.0",
  "@angular-devkit/build-angular": "~0.0.9",
  "typescript": "~2.7.2",
  "@angular/cli": "~6.0.0-beta.8",
  "@angular/language-service": "^6.0.0-rc.0",
  "@types/jasmine": "~2.8.6",
  "@types/jasminewd2": "~2.0.3",
  "@types/node": "~8.9.4",
  "codelyzer": "~4.1.0",
  "jasmine-core": "~2.99.1",
  "jasmine-spec-reporter": "~4.2.1",
  "karma": "~2.0.0",
  "karma-chrome-launcher": "~2.2.0",
  "karma-coverage-istanbul-reporter": "~1.4.1",
  "karma-jasmine": "~1.1.1",
  "karma-jasmine-html-reporter": "^0.2.2",
  "protractor": "~5.3.0",
  "ts-node": "~5.0.0",
  "tslint": "~5.9.1"
}

Running ng serve will throw the following errors

ERROR in node_modules/material-community-components/color-picker/color-picker.component.d.ts(4,10): error TS2305: Module '"angular-test/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/material-community-components/color-picker/color-picker.directives.d.ts(5,10): error TS2305: Module '"angular-test/node_modules/rxjs/BehaviorSubject"' has no exported member 'BehaviorSubject'.
node_modules/material-community-components/color-picker/color-picker.service.d.ts(1,10): error TS2305: Module '"angular-test/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/material-community-components/timer-picker/timer-picker.component.d.ts(3,10): error TS2305: Module '"angular-test/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/material-community-components/timer-picker/timer-picker.directives.d.ts(3,10): error TS2305: Module '"angular-test/node_modules/rxjs/BehaviorSubject"' has no exported member 'BehaviorSubject'.
node_modules/rxjs/BehaviorSubject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/BehaviorSubject'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.

Maybe we need a branch to apply some changes for the upcoming release

24h format

The timepicker should have a 24h format and not just convert it.
AM/PM is confusing for European users.
chrome-android-time

Relax angular version to allow 5.2

Would it be possible to relax version dependencies on angular to allow 5.0 (as now) and also 5.2 ?

We have a project already running on angular 5.2 and adding this library install angular 5.0 side-by-side. It then trigger that bug and prevent compilation altogether.

Color picker open with selected color when canceled before

Describe the bug
When I open the color picker and select some color and cancel, the color picker should (or not?) reset the color to the selected one.

To Reproduce
screencast-tiaguinho github io-2018 07 12-12-51-14

Expected behavior
When I open the color picker again the selected color should be the actually selected color, not the one I selected before and canceled.

Desktop (please complete the following information):

  • OS: Ubuntu
  • Browser: Chrome
  • Version: 66.0.3359.117 (Official Build) (64-bit)

feat(Angular 6 support).

Hi guys.

With the angular version 6 removed the rxjs imports such as below.

import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Subscription } from 'rxjs/Subscription';
import { Observable } from 'rxjs/Observable';

So material community components won't work in angular 6
I think we should replace them with

import { Subscription, Observable,  BehaviorSubject } from 'rxjs';

this import syntax will work at previous versions.

Cannot compile with --aot

I would like to use mcc color picker from mcc latest release 2.4.3 but when I import the module in my application module I get the following error.

Only AOT compilation is affected.

OS: MacOS 10.13.3

I made a simple sample repo with the issue here: https://github.com/DocLM/mcc-test

ng serve --aot
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-03-09T16:44:22.314Z                                                       
Hash: afcf2ba8b0c1ee4d5a1b
Time: 2581ms
chunk {inline} inline.bundle.js (inline) 3.85 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 2.91 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 577 bytes [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 41.5 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 852 kB [initial] [rendered]

ERROR in : Unexpected value 'MccColorPickerModule in ...path.../node_modules/material-community-components/material-community-components.d.ts' imported by the module 'AppModule in ...path.../src/app/app.module.ts'. Please add a @NgModule annotation.


webpack: Failed to compile.

Maybe related to ng-packagr/ng-packagr#355

Selected Color not updating the color in the panel

When I update the selected color it would be nice the color in the panel is updated too. So when i'm updating multiple entities the color of the previous one doesnt stay behind.

Also when I'm trying to select a color, often I can't select a color by just clicking but i have to drag.

Thansk for your great work !

ColorPicker: Whenever you modify an RGB value to below 16 the wrong HEX value is produced

If you use the RGB inputs on the color picker to modify the color and change the value of any of the three, the HEX produced will be incorrect and the RGB value will jump. For example, if you type 15 as the R value the HEX value produced will be F0 and the R value will be 240. I've traced it down to the following method:

private _getHex(data: any): string {
    const hex = new Array(3);
    hex[0] = data[0].toString(16);
    hex[1] = data[1].toString(16);
    hex[2] = data[2].toString(16);

    hex.forEach((val, key) => {
      if (val.length === 1) {
        hex[key] += '0';
      }
    });

    return coerceHexaColor(`${hex[0]}${hex[1]}${hex[2]}`);
}

I believe it should be:

hex[key] = '0' + hex[key];

Instead of:

hex[key] += '0';

Transparent

Add button to erase color from color picker

Connect color-picker

Create directive to connect color-picker with any component.

Example:

<mat-color-picker #trigger></mat-color-picker>
<input type="text" [matColorPickerConnected]="trigger" />

Click out and selected emitter relation

I am not sure is this bug, but if we select color but not confirmed it with confirm button, and click outside of component I get that value and it triggers selected emitter.

My question/suggestion is on click out emitter I dont want to have any value, or if i selected earlier to stay on that value, I selected something and click out of picker it triggers both selected emit and clickOut emit, but I want selected to be only when user select confirm button,

Is this possible now, or if not than this is suggestion :)

P.S. You done great job with these components, I really like it.

Missing documentations, Examples

I'm trying to use the color-picker library after I've run the npm install command I've tried to add the MccColorPickerModule to my app.module, but the documentation doesn't specify from where should I import it. In addition, in the example page, the "view code" section is missing so I can't understand how to use the API. When I've tried to run the demo-app I've realized that the demo-app is an empty folder (only with favicon)

sugestão

olhei que você segue um padrão nos commits e queria saber se posso subir um plugin que já faz essa automatização, demorou?!

Highlight the selected color

I am using the minimal version of colorpicker, like you see in the image I don't have any feedback when I select some color, I can't see the selected color before confirmation.

I think is better if the user has some feedback when he clicks on some color, maybe with an highlight around the selected button or similar.
Is it possible?

colorpicker

Reactive Forms

The matColorPickerOrigin directive does not work Reactive Forms.
If I change the value with the input the picker is updated but if I add the picker the input is updated but not the form

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.