Source: map-google-maps/src/main/resources/META-INF/resources/js/GoogleMapsDialog.es.js

  1. /**
  2. * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or modify it under
  5. * the terms of the GNU Lesser General Public License as published by the Free
  6. * Software Foundation; either version 2.1 of the License, or (at your option)
  7. * any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  12. * details.
  13. */
  14. import State, {Config} from 'metal-state';
  15. /**
  16. * GoogleMapsDialog
  17. * @review
  18. */
  19. class GoogleMapsDialog extends State {
  20. /**
  21. * Creates a new map dialog using Google Map's API
  22. * @param {Array} args List of arguments to be passed to State
  23. * @review
  24. */
  25. constructor(...args) {
  26. super(...args);
  27. this._dialog = new google.maps.InfoWindow();
  28. }
  29. /**
  30. * Opens the dialog with the given map attribute and passes
  31. * the given configuration to the dialog object.
  32. * @param {Object} cfg
  33. * @review
  34. */
  35. open(cfg) {
  36. this._dialog.setOptions(cfg);
  37. this._dialog.open(this.map, cfg.marker);
  38. }
  39. }
  40. /**
  41. * State definition.
  42. * @review
  43. * @static
  44. * @type {!Object}
  45. */
  46. GoogleMapsDialog.STATE = {
  47. /**
  48. * Map used for creating the dialog content
  49. * @review
  50. * @type {Object}
  51. */
  52. map: Config.object(),
  53. };
  54. export default GoogleMapsDialog;
  55. export {GoogleMapsDialog};