Front end of the Slack clone application.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import { Input } from '@angular/core';
  2. /**
  3. * Base class for all Ionic components. Exposes some common functionality
  4. * that all Ionic components need, such as accessing underlying native elements and
  5. * sending/receiving app-level events.
  6. */
  7. /** @hidden */
  8. export class Ion {
  9. constructor(config, elementRef, renderer, componentName) {
  10. this._config = config;
  11. this._elementRef = elementRef;
  12. this._renderer = renderer;
  13. this._componentName = componentName;
  14. if (componentName) {
  15. this._setComponentName();
  16. this._setMode(config.get('mode'));
  17. }
  18. }
  19. /**
  20. * @input {string} The color to use from your Sass `$colors` map.
  21. * Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"dark"`.
  22. * For more information, see [Theming your App](/docs/theming/theming-your-app).
  23. */
  24. set color(val) {
  25. this._setColor(val);
  26. }
  27. get color() {
  28. return this._color;
  29. }
  30. /**
  31. * @input {string} The mode determines which platform styles to use.
  32. * Possible values are: `"ios"`, `"md"`, or `"wp"`.
  33. * For more information, see [Platform Styles](/docs/theming/platform-specific-styles).
  34. */
  35. set mode(val) {
  36. this._setMode(val);
  37. }
  38. get mode() {
  39. return this._mode;
  40. }
  41. /** @hidden */
  42. setElementClass(className, isAdd) {
  43. this._renderer.setElementClass(this._elementRef.nativeElement, className, isAdd);
  44. }
  45. /** @hidden */
  46. setElementAttribute(attributeName, attributeValue) {
  47. this._renderer.setElementAttribute(this._elementRef.nativeElement, attributeName, attributeValue);
  48. }
  49. /** @hidden */
  50. setElementStyle(property, value) {
  51. this._renderer.setElementStyle(this._elementRef.nativeElement, property, value);
  52. }
  53. /** @hidden */
  54. _setColor(newColor, componentName) {
  55. if (componentName) {
  56. // This is needed for the item-radio
  57. this._componentName = componentName;
  58. }
  59. if (this._color) {
  60. this.setElementClass(`${this._componentName}-${this._mode}-${this._color}`, false);
  61. }
  62. if (newColor) {
  63. this.setElementClass(`${this._componentName}-${this._mode}-${newColor}`, true);
  64. this._color = newColor;
  65. }
  66. }
  67. /** @hidden */
  68. _setMode(newMode) {
  69. if (this._mode) {
  70. this.setElementClass(`${this._componentName}-${this._mode}`, false);
  71. }
  72. if (newMode) {
  73. this.setElementClass(`${this._componentName}-${newMode}`, true);
  74. // Remove the color class associated with the previous mode,
  75. // change the mode, then add the new color class
  76. this._setColor(null);
  77. this._mode = newMode;
  78. this._setColor(this._color);
  79. }
  80. }
  81. /** @hidden */
  82. _setComponentName() {
  83. this.setElementClass(this._componentName, true);
  84. }
  85. /** @hidden */
  86. getElementRef() {
  87. return this._elementRef;
  88. }
  89. /** @hidden */
  90. getNativeElement() {
  91. return this._elementRef.nativeElement;
  92. }
  93. }
  94. Ion.propDecorators = {
  95. 'color': [{ type: Input },],
  96. 'mode': [{ type: Input },],
  97. };
  98. //# sourceMappingURL=ion.js.map