UNPKG

@firestitch/address

Version:
931 lines (817 loc) 71.4 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define("@firestitch/address", [], factory); else if(typeof exports === 'object') exports["@firestitch/address"] = factory(); else root["@firestitch/address"] = factory(); })(typeof self !== 'undefined' ? self : this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./index.ts"); /******/ }) /************************************************************************/ /******/ ({ /***/ "../node_modules/css-loader/index.js?{\"sourceMap\":true}!../node_modules/postcss-loader/lib/index.js?{\"sourceMap\":true}!../node_modules/resolve-url-loader/index.js?{\"sourceMap\":true}!../node_modules/sass-loader/lib/loader.js?{\"sourceMap\":true}!./components/fs-address-format/fs-address-format.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("../node_modules/css-loader/lib/css-base.js")(true); // imports // module exports.push([module.i, "span:not(:empty):not(:last-child):after {\n content: \", \";\n}\n\n", "", {"version":3,"sources":["/Users/mendor/work/fs-address/src/components/fs-address-format/src/components/fs-address-format/fs-address-format.component.scss","/Users/mendor/work/fs-address/fs-address-format.component.scss"],"names":[],"mappings":"AACA;EACE,cAAA;CCAD","file":"fs-address-format.component.scss","sourcesContent":["\nspan:not(:empty):not(:last-child):after {\n content: \", \";\n}\n","span:not(:empty):not(:last-child):after {\n content: \", \";\n}\n\n"],"sourceRoot":""}]); // exports /***/ }), /***/ "../node_modules/css-loader/index.js?{\"sourceMap\":true}!../node_modules/postcss-loader/lib/index.js?{\"sourceMap\":true}!../node_modules/resolve-url-loader/index.js?{\"sourceMap\":true}!../node_modules/sass-loader/lib/loader.js?{\"sourceMap\":true}!./components/fs-address-picker/fs-address-picker.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("../node_modules/css-loader/lib/css-base.js")(true); // imports // module exports.push([module.i, ".address-picker-container {\n position: relative;\n}\n\n.input-controls {\n position: absolute;\n top: 0;\n right: 0;\n}\n\n", "", {"version":3,"sources":["/Users/mendor/work/fs-address/src/components/fs-address-picker/src/components/fs-address-picker/fs-address-picker.component.scss","/Users/mendor/work/fs-address/fs-address-picker.component.scss"],"names":[],"mappings":"AAAA;EACE,mBAAA;CCCD;;ADED;EACE,mBAAA;EACA,OAAA;EACA,SAAA;CCCD","file":"fs-address-picker.component.scss","sourcesContent":[".address-picker-container {\n position: relative;\n}\n\n.input-controls {\n position: absolute;\n top: 0;\n right: 0;\n}\n",".address-picker-container {\n position: relative;\n}\n\n.input-controls {\n position: absolute;\n top: 0;\n right: 0;\n}\n\n"],"sourceRoot":""}]); // exports /***/ }), /***/ "../node_modules/css-loader/index.js?{\"sourceMap\":true}!../node_modules/postcss-loader/lib/index.js?{\"sourceMap\":true}!../node_modules/resolve-url-loader/index.js?{\"sourceMap\":true}!../node_modules/sass-loader/lib/loader.js?{\"sourceMap\":true}!./components/fs-address-search/fs-address-search.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("../node_modules/css-loader/lib/css-base.js")(true); // imports // module exports.push([module.i, "mat-form-field {\n width: 100%;\n}\n\n", "", {"version":3,"sources":["/Users/mendor/work/fs-address/src/components/fs-address-search/src/components/fs-address-search/fs-address-search.component.scss","/Users/mendor/work/fs-address/fs-address-search.component.scss"],"names":[],"mappings":"AAAA;EACE,YAAA;CCCD","file":"fs-address-search.component.scss","sourcesContent":["mat-form-field {\n width: 100%;\n}\n","mat-form-field {\n width: 100%;\n}\n\n"],"sourceRoot":""}]); // exports /***/ }), /***/ "../node_modules/css-loader/index.js?{\"sourceMap\":true}!../node_modules/postcss-loader/lib/index.js?{\"sourceMap\":true}!../node_modules/resolve-url-loader/index.js?{\"sourceMap\":true}!../node_modules/sass-loader/lib/loader.js?{\"sourceMap\":true}!./components/fs-address/fs-address.component.scss": /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__("../node_modules/css-loader/lib/css-base.js")(true); // imports // module exports.push([module.i, "agm-map {\n width: 100%;\n height: 400px;\n background-color: grey;\n}\n\n[hidden] {\n display: none !important;\n}\n\n.map-container {\n position: relative;\n}\n\n.map-container .address-incomplete {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n background: #fff;\n border: 1px solid #efefef;\n height: 100%;\n line-height: 100%;\n opacity: 0.87;\n font-size: larger;\n padding: 40px;\n text-align: center;\n}\n\n.map-container .center {\n position: absolute;\n right: 20px;\n top: 20px;\n right: 5px;\n top: 5px;\n z-index: 5;\n background-color: #fff;\n}\n\n", "", {"version":3,"sources":["/Users/mendor/work/fs-address/src/components/fs-address/src/components/fs-address/fs-address.component.scss","/Users/mendor/work/fs-address/fs-address.component.scss","/Users/mendor/work/fs-address/src/components/fs-address/fs-address.component.scss"],"names":[],"mappings":"AAAA;EACI,YAAA;EACA,cAAA;EACA,uBAAA;CCCH;;ACCD;EFCW,yBAAA;CCEV;;ADAD;EACI,mBAAA;CCGH;;ADDG;EACI,mBAAA;EACA,OAAA;EACA,UAAA;EACA,QAAA;EACA,YAAA;EACA,iBAAA;EACA,0BAAA;EACA,aAAA;EACA,kBAAA;EACA,cAAA;EACA,kBAAA;EACA,cAAA;EACA,mBAAA;CCIP;;ADpBD;EAoBQ,mBAAA;EACA,YAAA;EACA,UAAA;EACA,WAAA;EACA,SAAA;EACA,WAAA;EACA,uBAAA;CCIP","file":"fs-address.component.scss","sourcesContent":["agm-map {\n width: 100%;\n height: 400px;\n background-color: grey;\n}\n\n[hidden] { display: none !important; }\n\n.map-container {\n position: relative;\n\n .address-incomplete {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n background: #fff;\n border: 1px solid #efefef;\n height: 100%;\n line-height: 100%;\n opacity: 0.87;\n font-size: larger;\n padding: 40px;\n text-align: center;\n }\n\n .center {\n position: absolute;\n right: 20px;\n top: 20px;\n right: 5px;\n top: 5px;\n z-index: 5;\n background-color: #fff; \n }\n}\n","agm-map {\n width: 100%;\n height: 400px;\n background-color: grey;\n}\n\n[hidden] {\n display: none !important;\n}\n\n.map-container {\n position: relative;\n}\n\n.map-container .address-incomplete {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n background: #fff;\n border: 1px solid #efefef;\n height: 100%;\n line-height: 100%;\n opacity: 0.87;\n font-size: larger;\n padding: 40px;\n text-align: center;\n}\n\n.map-container .center {\n position: absolute;\n right: 20px;\n top: 20px;\n right: 5px;\n top: 5px;\n z-index: 5;\n background-color: #fff;\n}\n\n","agm-map {\n width: 100%;\n height: 400px;\n background-color: grey; }\n\n[hidden] {\n display: none !important; }\n\n.map-container {\n position: relative; }\n .map-container .address-incomplete {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n background: #fff;\n border: 1px solid #efefef;\n height: 100%;\n line-height: 100%;\n opacity: 0.87;\n font-size: larger;\n padding: 40px;\n text-align: center; }\n .map-container .center {\n position: absolute;\n right: 20px;\n top: 20px;\n right: 5px;\n top: 5px;\n z-index: 5;\n background-color: #fff; }\n/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jb21wb25lbnRzL2ZzLWFkZHJlc3MvZnMtYWRkcmVzcy5jb21wb25lbnQuc2NzcyJdLCJzb3VyY2VzQ29udGVudCI6WyJhZ20tbWFwIHtcbiAgICB3aWR0aDogMTAwJTtcbiAgICBoZWlnaHQ6IDQwMHB4O1xuICAgIGJhY2tncm91bmQtY29sb3I6IGdyZXk7XG59XG5cbltoaWRkZW5dIHsgZGlzcGxheTogbm9uZSAhaW1wb3J0YW50OyB9XG5cbi5tYXAtY29udGFpbmVyIHtcbiAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG5cbiAgICAuYWRkcmVzcy1pbmNvbXBsZXRlIHtcbiAgICAgICAgcG9zaXRpb246IGFic29sdXRlO1xuICAgICAgICB0b3A6IDA7XG4gICAgICAgIGJvdHRvbTogMDtcbiAgICAgICAgbGVmdDogMDtcbiAgICAgICAgd2lkdGg6IDEwMCU7XG4gICAgICAgIGJhY2tncm91bmQ6ICNmZmY7XG4gICAgICAgIGJvcmRlcjogMXB4IHNvbGlkICNlZmVmZWY7XG4gICAgICAgIGhlaWdodDogMTAwJTtcbiAgICAgICAgbGluZS1oZWlnaHQ6IDEwMCU7XG4gICAgICAgIG9wYWNpdHk6IDAuODc7XG4gICAgICAgIGZvbnQtc2l6ZTogbGFyZ2VyO1xuICAgICAgICBwYWRkaW5nOiA0MHB4O1xuICAgICAgICB0ZXh0LWFsaWduOiBjZW50ZXI7XG4gICAgfVxuXG4gICAgLmNlbnRlciB7XG4gICAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICAgICAgcmlnaHQ6IDIwcHg7XG4gICAgICAgIHRvcDogMjBweDtcbiAgICAgICAgcmlnaHQ6IDVweDtcbiAgICAgICAgdG9wOiA1cHg7XG4gICAgICAgIHotaW5kZXg6IDU7XG4gICAgICAgIGJhY2tncm91bmQtY29sb3I6ICNmZmY7ICAgIFxuICAgIH1cbn1cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxBQUFBLE9BQU8sQ0FBQztFQUNKLEtBQUssRUFBRSxJQUFJO0VBQ1gsTUFBTSxFQUFFLEtBQUs7RUFDYixnQkFBZ0IsRUFBRSxJQUFJLEdBQ3pCOztDQUVELEFBQUEsQUFBQSxNQUFDLEFBQUEsRUFBUTtFQUFFLE9BQU8sRUFBRSxlQUFlLEdBQUs7O0FBRXhDLEFBQUEsY0FBYyxDQUFDO0VBQ1gsUUFBUSxFQUFFLFFBQVEsR0EyQnJCO0VBNUJELEFBR0ksY0FIVSxDQUdWLG1CQUFtQixDQUFDO0lBQ2hCLFFBQVEsRUFBRSxRQUFRO0lBQ2xCLEdBQUcsRUFBRSxDQUFDO0lBQ04sTUFBTSxFQUFFLENBQUM7SUFDVCxJQUFJLEVBQUUsQ0FBQztJQUNQLEtBQUssRUFBRSxJQUFJO0lBQ1gsVUFBVSxFQUFFLElBQUk7SUFDaEIsTUFBTSxFQUFFLGlCQUFpQjtJQUN6QixNQUFNLEVBQUUsSUFBSTtJQUNaLFdBQVcsRUFBRSxJQUFJO0lBQ2pCLE9BQU8sRUFBRSxJQUFJO0lBQ2IsU0FBUyxFQUFFLE1BQU07SUFDakIsT0FBTyxFQUFFLElBQUk7SUFDYixVQUFVLEVBQUUsTUFBTSxHQUNyQjtFQWpCTCxBQW1CSSxjQW5CVSxDQW1CVixPQUFPLENBQUM7SUFDSixRQUFRLEVBQUUsUUFBUTtJQUNsQixLQUFLLEVBQUUsSUFBSTtJQUNYLEdBQUcsRUFBRSxJQUFJO0lBQ1QsS0FBSyxFQUFFLEdBQUc7SUFDVixHQUFHLEVBQUUsR0FBRztJQUNSLE9BQU8sRUFBRSxDQUFDO0lBQ1YsZ0JBQWdCLEVBQUUsSUFBSSxHQUN6QiJ9 */"],"sourceRoot":""}]); // exports /***/ }), /***/ "../node_modules/css-loader/lib/css-base.js": /***/ (function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function(useSourceMap) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = cssWithMappingToString(item, useSourceMap); if(item[2]) { return "@media " + item[2] + "{" + content + "}"; } else { return content; } }).join(""); }; // import a list of modules into the list list.i = function(modules, mediaQuery) { if(typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for(var i = 0; i < this.length; i++) { var id = this[i][0]; if(typeof id === "number") alreadyImportedModules[id] = true; } for(i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { if(mediaQuery && !item[2]) { item[2] = mediaQuery; } else if(mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; function cssWithMappingToString(item, useSourceMap) { var content = item[1] || ''; var cssMapping = item[3]; if (!cssMapping) { return content; } if (useSourceMap && typeof btoa === 'function') { var sourceMapping = toComment(cssMapping); var sourceURLs = cssMapping.sources.map(function (source) { return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' }); return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); } return [content].join('\n'); } // Adapted from convert-source-map (MIT) function toComment(sourceMap) { // eslint-disable-next-line no-undef var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; return '/*# ' + data + ' */'; } /***/ }), /***/ "./classes/googlemapconfig.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var GoogleMapConfig = (function () { function GoogleMapConfig(apiKey) { this.apiKey = null; this.libraries = ['places']; if (!apiKey) { throw new Error('GoogleMapKey injector invalid'); } this.apiKey = apiKey; } GoogleMapConfig = __decorate([ __param(0, core_1.Inject('GoogleMapKey')), __metadata("design:paramtypes", [Object]) ], GoogleMapConfig); return GoogleMapConfig; }()); exports.GoogleMapConfig = GoogleMapConfig; ; /***/ }), /***/ "./components/fs-address-format/fs-address-format.component.html": /***/ (function(module, exports) { module.exports = "<span class=\"street\">{{address.street}}</span>\n<span class=\"city\">{{address.city}}</span>\n<span class=\"region\">{{address.region}}</span>\n<span class=\"zip\">{{address.zip}}</span>\n<span class=\"country\">{{address.country}}</span>\n" /***/ }), /***/ "./components/fs-address-format/fs-address-format.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("../node_modules/css-loader/index.js?{\"sourceMap\":true}!../node_modules/postcss-loader/lib/index.js?{\"sourceMap\":true}!../node_modules/resolve-url-loader/index.js?{\"sourceMap\":true}!../node_modules/sass-loader/lib/loader.js?{\"sourceMap\":true}!./components/fs-address-format/fs-address-format.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./components/fs-address-format/fs-address-format.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var FsAddressFormatComponent = (function () { function FsAddressFormatComponent() { this.config = {}; this._address = {}; } Object.defineProperty(FsAddressFormatComponent.prototype, "address", { get: function () { return this._address; }, set: function (address) { this._address = address; }, enumerable: true, configurable: true }); FsAddressFormatComponent.prototype.ngOnInit = function () { this.initAddress(); this.initConfig(); }; FsAddressFormatComponent.prototype.initAddress = function () { this.address = Object.assign({ name: void 0, country: void 0, region: void 0, city: void 0, street: void 0, zip: void 0, lat: null, lng: null, }, this.address); }; FsAddressFormatComponent.prototype.initConfig = function () { this.config = Object.assign({ country: true, region: true, city: true, street: true, zip: true, }, this.config); }; __decorate([ core_1.Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], FsAddressFormatComponent.prototype, "address", null); __decorate([ core_1.Input(), __metadata("design:type", Object) ], FsAddressFormatComponent.prototype, "config", void 0); FsAddressFormatComponent = __decorate([ core_1.Component({ selector: 'fs-address-format', template: __webpack_require__("./components/fs-address-format/fs-address-format.component.html"), styles: [__webpack_require__("./components/fs-address-format/fs-address-format.component.scss")] }), __metadata("design:paramtypes", []) ], FsAddressFormatComponent); return FsAddressFormatComponent; }()); exports.FsAddressFormatComponent = FsAddressFormatComponent; /***/ }), /***/ "./components/fs-address-format/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./components/fs-address-format/fs-address-format.component.ts")); /***/ }), /***/ "./components/fs-address-picker/fs-address-picker.component.html": /***/ (function(module, exports) { module.exports = "<div class=\"address-picker-container\">\n\n <input #search style=\"display: none\"/>\n\n <div class=\"search\" *ngIf=\"!isEdit\">\n <fs-address-search\n [address]=\"address\"\n (selected)=\"changed($event)\"\n ></fs-address-search>\n\n <div class=\"input-controls\" *ngIf=\"address && address.description\">\n <button\n mat-icon-button\n (click)=\"clear()\"\n ><mat-icon>close</mat-icon></button>\n <button\n mat-icon-button\n (click)=\"openEdit()\"\n ><mat-icon>create</mat-icon></button>\n </div>\n </div>\n\n <div *ngIf=\"isEdit\">\n <fs-address\n [address]=\"address\"\n [config]=\"config\"\n (change)=\"changed($event)\"\n ></fs-address>\n </div>\n\n</div>\n" /***/ }), /***/ "./components/fs-address-picker/fs-address-picker.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("../node_modules/css-loader/index.js?{\"sourceMap\":true}!../node_modules/postcss-loader/lib/index.js?{\"sourceMap\":true}!../node_modules/resolve-url-loader/index.js?{\"sourceMap\":true}!../node_modules/sass-loader/lib/loader.js?{\"sourceMap\":true}!./components/fs-address-picker/fs-address-picker.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./components/fs-address-picker/fs-address-picker.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var FsAddressPickerComponent = (function () { function FsAddressPickerComponent() { this.addressChange = new core_1.EventEmitter(); this.configChange = new core_1.EventEmitter(); this.change = new core_1.EventEmitter(); this.isEdit = false; } Object.defineProperty(FsAddressPickerComponent.prototype, "address", { get: function () { return this.addressValue; }, set: function (value) { this.addressValue = value; this.addressChange.emit(this.addressValue); }, enumerable: true, configurable: true }); Object.defineProperty(FsAddressPickerComponent.prototype, "config", { get: function () { return this.configValue; }, set: function (value) { this.configValue = value; this.configChange.emit(this.configValue); }, enumerable: true, configurable: true }); FsAddressPickerComponent.prototype.ngOnInit = function () { }; FsAddressPickerComponent.prototype.ngOnDestroy = function () { }; FsAddressPickerComponent.prototype.openEdit = function () { this.isEdit = true; }; FsAddressPickerComponent.prototype.closeEdit = function () { this.isEdit = false; }; FsAddressPickerComponent.prototype.clear = function () { this.address = {}; }; FsAddressPickerComponent.prototype.changed = function (event) { this.change.emit(event); if (event) { this.address = event; } }; __decorate([ core_1.Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], FsAddressPickerComponent.prototype, "address", null); __decorate([ core_1.Output(), __metadata("design:type", Object) ], FsAddressPickerComponent.prototype, "addressChange", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object), __metadata("design:paramtypes", [Object]) ], FsAddressPickerComponent.prototype, "config", null); __decorate([ core_1.Output(), __metadata("design:type", Object) ], FsAddressPickerComponent.prototype, "configChange", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], FsAddressPickerComponent.prototype, "change", void 0); FsAddressPickerComponent = __decorate([ core_1.Component({ selector: 'fs-address-picker', template: __webpack_require__("./components/fs-address-picker/fs-address-picker.component.html"), styles: [__webpack_require__("./components/fs-address-picker/fs-address-picker.component.scss")], }), __metadata("design:paramtypes", []) ], FsAddressPickerComponent); return FsAddressPickerComponent; }()); exports.FsAddressPickerComponent = FsAddressPickerComponent; /***/ }), /***/ "./components/fs-address-picker/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./components/fs-address-picker/fs-address-picker.component.ts")); /***/ }), /***/ "./components/fs-address-search/fs-address-search.component.html": /***/ (function(module, exports) { module.exports = "<mat-form-field>\n\n <input matInput\n placeholder=\"Location\"\n [ngModel]=\"address.description\"\n (ngModelChange)=\"addressChanged($event)\"\n (change)=\"change($event);\"\n #search\n [matAutocomplete]=\"auto\">\n\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selectionChange($event)\">\n <mat-option *ngFor=\"let option of predictions\" [value]=\"option.description\">\n {{option.description}}\n </mat-option>\n </mat-autocomplete>\n\n</mat-form-field>\n" /***/ }), /***/ "./components/fs-address-search/fs-address-search.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("../node_modules/css-loader/index.js?{\"sourceMap\":true}!../node_modules/postcss-loader/lib/index.js?{\"sourceMap\":true}!../node_modules/resolve-url-loader/index.js?{\"sourceMap\":true}!../node_modules/sass-loader/lib/loader.js?{\"sourceMap\":true}!./components/fs-address-search/fs-address-search.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./components/fs-address-search/fs-address-search.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var core_2 = __webpack_require__("@agm/core"); __webpack_require__("rxjs/add/operator/debounceTime"); var Subject_1 = __webpack_require__("rxjs/Subject"); var FsAddressSearchComponent = (function () { function FsAddressSearchComponent(_mapsAPILoader, _ngZone) { var _this = this; this._mapsAPILoader = _mapsAPILoader; this._ngZone = _ngZone; this.address = {}; this.selected = new core_1.EventEmitter(); // Address Predictions this.predictions = []; // Other this._changeAddressDebounce = new Subject_1.Subject(); this._changeAddressDebounce .debounceTime(300) .subscribe(function (value) { _this.updatePredictions(value); }); } FsAddressSearchComponent.prototype.ngOnInit = function () { this.initAddress(); this.initGoogleMap(); if (this.address && this.address.description) { this.updatePredictions(this.address.description); } }; FsAddressSearchComponent.prototype.ngOnDestroy = function () { }; FsAddressSearchComponent.prototype.initAddress = function () { this.address = Object.assign({ name: null, country: null, region: null, address: null, city: null, zip: null, lat: null, lng: null }, this.address); }; FsAddressSearchComponent.prototype.initGoogleMap = function () { var _this = this; this._mapsAPILoader .load() .then(function () { _this.googleAutocompleteService = new google.maps.places.AutocompleteService(); _this.googlePlacesService = new google.maps.places.PlacesService(_this.searchElement.nativeElement); }); }; FsAddressSearchComponent.prototype.updatePredictions = function (value) { var _this = this; if (value && this.googleAutocompleteService) { this.googleAutocompleteService.getPlacePredictions({ input: value }, function (predictions, status) { _this._ngZone.run(function () { _this.predictions.length = 0; if (status != google.maps.places.PlacesServiceStatus.OK) { return; } _this.predictions = predictions; }); }); } }; FsAddressSearchComponent.prototype.addressChanged = function (event) { this._changeAddressDebounce.next(event); }; FsAddressSearchComponent.prototype.change = function (event) { event.stopPropagation(); }; FsAddressSearchComponent.prototype.selectionChange = function (event) { var _this = this; var place = this.predictions.find(function (el) { return el.description === event.option.value; }); var newAddress = { description: place.description }; if (place && this.googlePlacesService) { this.googlePlacesService.getDetails({ placeId: place.place_id }, function (result, status) { _this._ngZone.run(function () { if (status != google.maps.places.PlacesServiceStatus.OK) { return; } newAddress.name = result.name; newAddress.lat = result.geometry.location.lat(); newAddress.lng = result.geometry.location.lng(); result.address_components.forEach(function (item) { if (item.types.some(function (type) { return type === 'country'; })) { newAddress.country = item.short_name; } if (item.types.some(function (type) { return type === 'administrative_area_level_1'; })) { newAddress.region = item.short_name; } if (item.types.some(function (type) { return type === 'locality'; })) { newAddress.city = item.long_name; } if (item.types.some(function (type) { return type === 'postal_code'; })) { newAddress.zip = item.long_name; } }); var streetNumber = result.address_components .find(function (el) { return el.types.some(function (type) { return type === 'street_number'; }); }); if (streetNumber) { newAddress.street = streetNumber.long_name + ' '; } else { var match = newAddress.description.match(/^[\d-]+/); if (match) { newAddress.street = match[0] + ' '; } } var streetAddress = result.address_components .find(function (el) { return el.types.some(function (type) { return type === 'route'; }); }); if (streetAddress) { newAddress.street += streetAddress.long_name; } _this.address = newAddress; _this.selected.emit(newAddress); }); }); } }; __decorate([ core_1.Input(), __metadata("design:type", Object) ], FsAddressSearchComponent.prototype, "address", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], FsAddressSearchComponent.prototype, "selected", void 0); __decorate([ core_1.ViewChild('search'), __metadata("design:type", core_1.ElementRef) ], FsAddressSearchComponent.prototype, "searchElement", void 0); FsAddressSearchComponent = __decorate([ core_1.Component({ selector: 'fs-address-search', template: __webpack_require__("./components/fs-address-search/fs-address-search.component.html"), styles: [__webpack_require__("./components/fs-address-search/fs-address-search.component.scss")], }), __metadata("design:paramtypes", [core_2.MapsAPILoader, core_1.NgZone]) ], FsAddressSearchComponent); return FsAddressSearchComponent; }()); exports.FsAddressSearchComponent = FsAddressSearchComponent; /***/ }), /***/ "./components/fs-address-search/index.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__("./components/fs-address-search/fs-address-search.component.ts")); /***/ }), /***/ "./components/fs-address/fs-address.component.html": /***/ (function(module, exports) { module.exports = "<div>\n <div fxLayout=\"row\">\n <mat-form-field fxFlex>\n <input\n matInput\n [(ngModel)]=\"address.name\"\n [attr.disabled]=\"config.name.disabled\"\n [fsFormRequired]=\"config.name.required\"\n name=\"location_name\"\n placeholder=\"Location name\"\n aria-label=\"Location name\"\n (change)=\"search($event)\"\n autocomplete=\"off\">\n </mat-form-field>\n </div>\n\n <div fxLayout=\"row\">\n <mat-form-field fxFlex>\n <input\n matInput\n [(ngModel)]=\"address.street\"\n [attr.disabled]=\"config.street.disabled\"\n [fsFormRequired]=\"config.street.required\"\n name=\"street\"\n placeholder=\"Street\"\n aria-label=\"Street\"\n (change)=\"search($event)\"\n autocomplete=\"off\">\n </mat-form-field>\n </div>\n\n <div fxLayoutGap=\"5px\">\n <mat-form-field fxFlex>\n <input\n matInput\n [(ngModel)]=\"address.city\"\n [attr.disabled]=\"config.city.disabled\"\n [fsFormRequired]=\"config.city.required\"\n name=\"city\"\n placeholder=\"City\"\n aria-label=\"City\"\n (change)=\"search($event)\"\n autocomplete=\"off\">\n </mat-form-field>\n <mat-form-field fxFlex>\n <input\n matInput\n [(ngModel)]=\"address.zip\"\n [attr.disabled]=\"config.zip.disabled\"\n [fsFormRequired]=\"config.zip.required\"\n name=\"zip\"\n aria-label=\"Zip\"\n [placeholder]=\"zipLabel\"\n (change)=\"search($event)\"\n autocomplete=\"off\">\n </mat-form-field>\n </div>\n\n <div fxLayoutGap=\"5px\">\n <mat-form-field fxFlex>\n\n <mat-select\n [(ngModel)]=\"address.country\"\n [attr.disabled]=\"config.country.disabled\"\n [fsFormRequired]=\"config.country.required\"\n name=\"country\"\n placeholder=\"Country\"\n aria-label=\"Country\"\n (change)=\"changeCountry()\"\n autocomplete=\"off\">\n\n <mat-option *ngFor=\"let country of countries\" [value]=\"country.code\">\n <span>{{ country.name }}</span>\n </mat-option>\n\n </mat-select>\n\n </mat-form-field>\n\n <mat-form-field fxFlex>\n\n <mat-select\n [(ngModel)]=\"address.region\"\n [attr.disabled]=\"config.region.disabled\"\n [fsFormRequired]=\"config.region.required\"\n name=\"region\"\n placeholder=\"{{ regionLabel }}\"\n (change)=\"changeRegion()\"\n autocomplete=\"off\">\n\n <mat-option *ngFor=\"let region of regions\" [value]=\"region.code\">\n <span>{{ region.name }}</span>\n </mat-option>\n\n </mat-select>\n\n </mat-form-field>\n </div>\n\n <div class=\"map-container\" [hidden]=\"!config.map.showMap\">\n\n <button\n mat-button\n class=\"center\"\n type=\"button\"\n *ngIf=\"(address.lat && address.lng) && (config.map.marker.coords.latitude && config.map.marker.coords.longitude)\"\n (click)=\"recenter()\"\n >Center Map using Address</button>\n\n <agm-map\n [latitude]=\"config.map.center.latitude\"\n [longitude]=\"config.map.center.longitude\"\n [zoom]=\"config.map.zoom\"\n [scrollwheel]=\"config.map.scrollwheel\"\n [streetViewControl]=\"config.map.streetViewControl\"\n [zoomControl]=\"config.map.zoomControl\"\n [mapTypeControlOptions]=\"config.map.mapTypeControlOptions\"\n >\n <agm-marker\n [latitude]=\"config.map.marker.coords.latitude\"\n [longitude]=\"config.map.marker.coords.longitude\"\n [markerDraggable]=\"config.map.marker.options.draggable\"\n (dragEnd)=\"config.map.marker.events.dragend($event)\"\n ></agm-marker>\n </agm-map>\n\n <div class=\"address-incomplete\" fxLayout=\"row\" fxLayoutAlign=\"center center\" *ngIf=\"!address.lat && !address.lng\">\n <div *ngIf=\"!isSearched\">Please populate the address above to locate it on the map</div>\n <div *ngIf=\"isSearched\">Could not find address \"{{ searchedAddress }}\"</div>\n </div>\n </div>\n</div>\n" /***/ }), /***/ "./components/fs-address/fs-address.component.scss": /***/ (function(module, exports, __webpack_require__) { var result = __webpack_require__("../node_modules/css-loader/index.js?{\"sourceMap\":true}!../node_modules/postcss-loader/lib/index.js?{\"sourceMap\":true}!../node_modules/resolve-url-loader/index.js?{\"sourceMap\":true}!../node_modules/sass-loader/lib/loader.js?{\"sourceMap\":true}!./components/fs-address/fs-address.component.scss"); if (typeof result === "string") { module.exports = result; } else { module.exports = result.toString(); } /***/ }), /***/ "./components/fs-address/fs-address.component.ts": /***/ (function(module, exports, __webpack_require__) { "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = __webpack_require__("@angular/core"); var lodash_1 = __webpack_require__("lodash"); var core_2 = __webpack_require__("@agm/core"); __webpack_require__("rxjs/add/operator/startWith"); __webpack_require__("rxjs/add/operator/map"); var countries_1 = __webpack_require__("./constants/countries.ts"); var FsAddressComponent = (function () { function FsAddressComponent() { this.address = {}; this.config = {}; this.change = new core_1.EventEmitter(); this.isSearched = false; this.countries = countries_1.COUNTRIES.slice() || []; this.regions = []; } FsAddressComponent.prototype.ngOnInit = function () { var _this = this; this.initAddress(); this.initConfig(); this.initMap(); this.initCountries(); this.initRegions(); this.initZipAndStateLabels(); // Example ready event. Allow to use google object and map instance if (this.agmMap) { this._subMapReady = this.agmMap .mapReady .subscribe(function (map) { _this.agmMap.triggerResize(); if (_this.address.name || _this.address.country || _this.address.region || _this.address.city || _this.address.zip) { _this.address.lat = 9999; _this.address.lng = 9999; _this.search(); } }); } }; FsAddressComponent.prototype.ngOnDestroy = function () { if (this.agmMap) { this._subMapReady.unsubscribe(); } }; FsAddressComponent.prototype.recenter = function () { var _this = this; this.config.map.center = { latitude: this.address.lat, longitude: this.address.lng }; this.config.map.marker.coords.latitude = this.address.lat; this.config.map.marker.coords.longitude = this.address.lng; this.agmMap.triggerResize() .then(function () { return _this.agmMap._mapsWrapper.setCenter({ lat: _this.address.lat, lng: _this.address.lng }); }); }; FsAddressComponent.prototype.changeCountry = function () { var country = lodash_1.filter(countries_1.COUNTRIES, { code: this.address.country })[0]; this.regions = country && country.regions ? country.regions : []; this.updateCountryRegionLabels(); this.search(); }; FsAddressComponent.prototype.changeRegion = function () { var country = lodash_1.filter(countries_1.COUNTRIES, { code: this.address.country })[0]; if (country && country.regions) { var region = lodash_1.filter(country.regions, { code: this.address.region })[0]; this.address.region = region.code; } this.search(); }; FsAddressComponent.prototype.search = function (event) { var _this = this; if (event) { event.stopPropagation(); } var geocoder = new google.maps.Geocoder(); var parts = [ this.address.country, this.address.region, this.address.city, this.address.zip, this.address.street, this.address.name ]; this.searchedAddress = parts.filter(function (part) { return part; }).join(', '); geocoder.geocode({ address: this.searchedAddress }, function (results, status) { _this.isSearched = true; if (status == google.maps.GeocoderStatus.OK && results.length > 0) { var location_1 = results[0].geometry.location; _this.address.description = results[0].formatted_address; _this.address.lat = location_1.lat(); _this.address.lng = location_1.lng(); _this.config.map.center = { latitude: parseFloat(location_1.lat()), longitude: parseFloat(location_1.lng()) }; _this.config.map.marker.coords.latitude = location_1.lat(); _this.config.map.marker.coords.longitude = location_1.lng(); if (_this.agmMap) { _this.agmMap.triggerResize(); } } else { _this.address.lat = null; _this.address.lng = null; } _this.change.emit(_this.address); }); }; FsAddressComponent.prototype.initAddress = function () { this.address = Object.assign({ name: void 0, country: void 0, region: void 0, street: void 0, city: void 0, zip: void 0, lat: null, lng: null, }, this.address); }; FsAddressComponent.prototype.initConfig = function () { this.config = Object.assign({ name: { required: false, visible: true }, country: { required: false, visible: true }, region: { required: true, visible: true }, city: { required: true, visible: true }, street: { required: false, visible: true }, zip: { required: true, visible: true }, }, this.config); }; FsAddressComponent.prototype.initMap = function () { var _this = this; this.config.map = Object.assign({ showMap: true, center: { latitude: this.address.lat || 9999, longitude: this.address.lng || 9999 }, zoom: 13, scrollwheel: false, streetViewControl: false, zoomControl: false, mapTypeControlOptions: { mapTypeIds: [] }, marker: { id: 0, coords: { latitude: this.address.lat, longitude: this.address.lng }, options: { draggable: true }, events: { dragend: function (marker) { _this.address.lat = marker.coords.lat; _this.address.lng = marker.coords.lng; } } } }, this.config.map); }; FsAddressComponent.prototype.initCountries = function () { var _this = this; if (this.config.country && this.config.country.list && this.config.country.list.length) { this.countries.length = 0; this.config.country.list.forEach(function (el) { var country = countries_1.COUNTRIES.find(function (countryEl) { return countryEl.code === el; }); if (country) { _this.countries.push(country); } }); } if (this.countries.length && !this.address.country) { this.address.country = this.countries[0].code; } }; FsAddressComponent.prototype.initRegions = function () { var _this = this; if (this.address.country && this.address.country) { var country = countries_1.COUNTRIES.find(function (countryEl) { return countryEl.code === _this.address.country; }); if (country) { this.regions = country['regions'] || []; } } }; FsAddressComponent.prototype.initZipAndStateLabels = function () { var country = lodash_1.filter(countries_1.COUNTRIES, { code: this.address.country })[0]; this.updateCountryRegionLabels(); }; FsAddressComponent.prototype.updateCountryRegionLabels = function () { this.zipLabel = this.address.country === 'CA' ? 'Postal Code' : 'Zip'; this.regionLabel = this.address.country === 'CA' ? 'Pro