angularjs-input-birthday
Advanced tools
Comparing version 0.0.2 to 0.0.4
@@ -1,4 +0,71 @@ | ||
webpackJsonp([0,1],[ | ||
/* 0 */, | ||
/* 1 */ | ||
/******/ (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; | ||
/******/ | ||
/******/ // identity function for calling harmony imports with the correct context | ||
/******/ __webpack_require__.i = function(value) { return value; }; | ||
/******/ | ||
/******/ // 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 = 4); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ (function(module, exports) { | ||
@@ -9,3 +76,3 @@ | ||
/***/ }), | ||
/* 2 */ | ||
/* 1 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -16,3 +83,3 @@ | ||
// load the styles | ||
var content = __webpack_require__(5); | ||
var content = __webpack_require__(2); | ||
if(typeof content === 'string') content = [[module.i, content, '']]; | ||
@@ -25,3 +92,3 @@ // Prepare cssTransformation | ||
// add the styles to the DOM | ||
var update = __webpack_require__(123)(content, options); | ||
var update = __webpack_require__(5)(content, options); | ||
if(content.locals) module.exports = content.locals; | ||
@@ -43,8 +110,6 @@ // Hot Module Replacement | ||
/***/ }), | ||
/* 3 */, | ||
/* 4 */, | ||
/* 5 */ | ||
/* 2 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
exports = module.exports = __webpack_require__(7)(undefined); | ||
exports = module.exports = __webpack_require__(3)(undefined); | ||
// imports | ||
@@ -60,24 +125,94 @@ | ||
/***/ }), | ||
/* 6 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/* 3 */ | ||
/***/ (function(module, exports) { | ||
"use strict"; | ||
/* | ||
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(""); | ||
}; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
// 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; | ||
}; | ||
var _angular = __webpack_require__(4); | ||
function cssWithMappingToString(item, useSourceMap) { | ||
var content = item[1] || ''; | ||
var cssMapping = item[3]; | ||
if (!cssMapping) { | ||
return content; | ||
} | ||
var _angular2 = _interopRequireDefault(_angular); | ||
if (useSourceMap && typeof btoa === 'function') { | ||
var sourceMapping = toComment(cssMapping); | ||
var sourceURLs = cssMapping.sources.map(function (source) { | ||
return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' | ||
}); | ||
var _moment = __webpack_require__(0); | ||
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); | ||
} | ||
var _moment2 = _interopRequireDefault(_moment); | ||
return [content].join('\n'); | ||
} | ||
__webpack_require__(3); | ||
// 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; | ||
__webpack_require__(2); | ||
return '/*# ' + data + ' */'; | ||
} | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
__webpack_require__(1); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -95,9 +230,4 @@ | ||
var BirthdayInputComponent = function () { | ||
/** @ngInject */ | ||
function BirthdayInputComponent() { | ||
_classCallCheck(this, BirthdayInputComponent); | ||
this.years = this.getLastYears(); | ||
this.months = _moment2.default.months(); | ||
this.days = []; | ||
} | ||
@@ -108,3 +238,19 @@ | ||
value: function $onInit() { | ||
this.askDay = _angular2.default.isUndefined(this.askDay) || this.askDay; | ||
this.years = this.getLastYears(); | ||
this.months = moment.months(); | ||
this.askDay = angular.isUndefined(this.askDay) || this.askDay; | ||
this.initToday = Boolean(this.initToday); | ||
this.ngModel = this.ngModel && moment(this.ngModel) || this.initToday && moment(new Date()) || undefined; | ||
if (this.ngModel) { | ||
var year = this.ngModel.year(); | ||
var month = this.ngModel.month(); | ||
var nbDays = moment(year + month, 'YYYYMM').daysInMonth(); | ||
this.days = this.range(nbDays); | ||
this.year = year; | ||
this.month = String(this.ngModel.month()); | ||
this.day = parseInt(this.ngModel.format('DD'), 0); | ||
} | ||
} | ||
@@ -119,3 +265,3 @@ }, { | ||
if (year && month && (day || !this.askDay)) { | ||
var birthdayDate = (0, _moment2.default)(year + '-' + month + '-' + day, 'YYYY-MM-DD'); | ||
var birthdayDate = moment(year + '-' + month + '-' + day, 'YYYY-MM-DD'); | ||
if (this.returnFormat) { | ||
@@ -127,3 +273,3 @@ this.ngModel = birthdayDate.format(this.returnFormat); | ||
} else if (this.year && this.month) { | ||
var nbDays = (0, _moment2.default)(year + month, 'YYYYMM').daysInMonth(); | ||
var nbDays = moment(year + month, 'YYYYMM').daysInMonth(); | ||
this.days = this.range(nbDays); | ||
@@ -147,3 +293,3 @@ this.ngModel = undefined; | ||
var years = []; | ||
var currentYear = (0, _moment2.default)().year(); | ||
var currentYear = moment().year(); | ||
for (var i = 0; i < 130; i++) { | ||
@@ -159,4 +305,4 @@ years.push(currentYear--); | ||
_angular2.default.module('angularjs-input-birthday', ['pascalprecht.translate']).component('inputBirthday', { | ||
template: __webpack_require__(1), | ||
angular.module('angularjs-input-birthday', ['pascalprecht.translate']).component('inputBirthday', { | ||
template: __webpack_require__(0), | ||
controller: BirthdayInputComponent, | ||
@@ -166,2 +312,3 @@ bindings: { | ||
returnFormat: '@', | ||
initToday: '<', | ||
askDay: '<', | ||
@@ -173,4 +320,412 @@ ngModel: '=', | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Tobias Koppers @sokra | ||
*/ | ||
var stylesInDom = {}, | ||
memoize = function(fn) { | ||
var memo; | ||
return function () { | ||
if (typeof memo === "undefined") memo = fn.apply(this, arguments); | ||
return memo; | ||
}; | ||
}, | ||
isOldIE = memoize(function() { | ||
// Test for IE <= 9 as proposed by Browserhacks | ||
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 | ||
// Tests for existence of standard globals is to allow style-loader | ||
// to operate correctly into non-standard environments | ||
// @see https://github.com/webpack-contrib/style-loader/issues/177 | ||
return window && document && document.all && !window.atob; | ||
}), | ||
getElement = (function(fn) { | ||
var memo = {}; | ||
return function(selector) { | ||
if (typeof memo[selector] === "undefined") { | ||
memo[selector] = fn.call(this, selector); | ||
} | ||
return memo[selector] | ||
}; | ||
})(function (styleTarget) { | ||
return document.querySelector(styleTarget) | ||
}), | ||
singletonElement = null, | ||
singletonCounter = 0, | ||
styleElementsInsertedAtTop = [], | ||
fixUrls = __webpack_require__(6); | ||
module.exports = function(list, options) { | ||
if(typeof DEBUG !== "undefined" && DEBUG) { | ||
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); | ||
} | ||
options = options || {}; | ||
options.attrs = typeof options.attrs === "object" ? options.attrs : {}; | ||
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style> | ||
// tags it will allow on a page | ||
if (typeof options.singleton === "undefined") options.singleton = isOldIE(); | ||
// By default, add <style> tags to the <head> element | ||
if (typeof options.insertInto === "undefined") options.insertInto = "head"; | ||
// By default, add <style> tags to the bottom of the target | ||
if (typeof options.insertAt === "undefined") options.insertAt = "bottom"; | ||
var styles = listToStyles(list, options); | ||
addStylesToDom(styles, options); | ||
return function update(newList) { | ||
var mayRemove = []; | ||
for(var i = 0; i < styles.length; i++) { | ||
var item = styles[i]; | ||
var domStyle = stylesInDom[item.id]; | ||
domStyle.refs--; | ||
mayRemove.push(domStyle); | ||
} | ||
if(newList) { | ||
var newStyles = listToStyles(newList, options); | ||
addStylesToDom(newStyles, options); | ||
} | ||
for(var i = 0; i < mayRemove.length; i++) { | ||
var domStyle = mayRemove[i]; | ||
if(domStyle.refs === 0) { | ||
for(var j = 0; j < domStyle.parts.length; j++) | ||
domStyle.parts[j](); | ||
delete stylesInDom[domStyle.id]; | ||
} | ||
} | ||
}; | ||
}; | ||
function addStylesToDom(styles, options) { | ||
for(var i = 0; i < styles.length; i++) { | ||
var item = styles[i]; | ||
var domStyle = stylesInDom[item.id]; | ||
if(domStyle) { | ||
domStyle.refs++; | ||
for(var j = 0; j < domStyle.parts.length; j++) { | ||
domStyle.parts[j](item.parts[j]); | ||
} | ||
for(; j < item.parts.length; j++) { | ||
domStyle.parts.push(addStyle(item.parts[j], options)); | ||
} | ||
} else { | ||
var parts = []; | ||
for(var j = 0; j < item.parts.length; j++) { | ||
parts.push(addStyle(item.parts[j], options)); | ||
} | ||
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; | ||
} | ||
} | ||
} | ||
function listToStyles(list, options) { | ||
var styles = []; | ||
var newStyles = {}; | ||
for(var i = 0; i < list.length; i++) { | ||
var item = list[i]; | ||
var id = options.base ? item[0] + options.base : item[0]; | ||
var css = item[1]; | ||
var media = item[2]; | ||
var sourceMap = item[3]; | ||
var part = {css: css, media: media, sourceMap: sourceMap}; | ||
if(!newStyles[id]) | ||
styles.push(newStyles[id] = {id: id, parts: [part]}); | ||
else | ||
newStyles[id].parts.push(part); | ||
} | ||
return styles; | ||
} | ||
function insertStyleElement(options, styleElement) { | ||
var styleTarget = getElement(options.insertInto) | ||
if (!styleTarget) { | ||
throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); | ||
} | ||
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1]; | ||
if (options.insertAt === "top") { | ||
if(!lastStyleElementInsertedAtTop) { | ||
styleTarget.insertBefore(styleElement, styleTarget.firstChild); | ||
} else if(lastStyleElementInsertedAtTop.nextSibling) { | ||
styleTarget.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling); | ||
} else { | ||
styleTarget.appendChild(styleElement); | ||
} | ||
styleElementsInsertedAtTop.push(styleElement); | ||
} else if (options.insertAt === "bottom") { | ||
styleTarget.appendChild(styleElement); | ||
} else { | ||
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'."); | ||
} | ||
} | ||
function removeStyleElement(styleElement) { | ||
styleElement.parentNode.removeChild(styleElement); | ||
var idx = styleElementsInsertedAtTop.indexOf(styleElement); | ||
if(idx >= 0) { | ||
styleElementsInsertedAtTop.splice(idx, 1); | ||
} | ||
} | ||
function createStyleElement(options) { | ||
var styleElement = document.createElement("style"); | ||
options.attrs.type = "text/css"; | ||
attachTagAttrs(styleElement, options.attrs); | ||
insertStyleElement(options, styleElement); | ||
return styleElement; | ||
} | ||
function createLinkElement(options) { | ||
var linkElement = document.createElement("link"); | ||
options.attrs.type = "text/css"; | ||
options.attrs.rel = "stylesheet"; | ||
attachTagAttrs(linkElement, options.attrs); | ||
insertStyleElement(options, linkElement); | ||
return linkElement; | ||
} | ||
function attachTagAttrs(element, attrs) { | ||
Object.keys(attrs).forEach(function (key) { | ||
element.setAttribute(key, attrs[key]); | ||
}); | ||
} | ||
function addStyle(obj, options) { | ||
var styleElement, update, remove, transformResult; | ||
// If a transform function was defined, run it on the css | ||
if (options.transform && obj.css) { | ||
transformResult = options.transform(obj.css); | ||
if (transformResult) { | ||
// If transform returns a value, use that instead of the original css. | ||
// This allows running runtime transformations on the css. | ||
obj.css = transformResult; | ||
} else { | ||
// If the transform function returns a falsy value, don't add this css. | ||
// This allows conditional loading of css | ||
return function() { | ||
// noop | ||
}; | ||
} | ||
} | ||
if (options.singleton) { | ||
var styleIndex = singletonCounter++; | ||
styleElement = singletonElement || (singletonElement = createStyleElement(options)); | ||
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false); | ||
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true); | ||
} else if(obj.sourceMap && | ||
typeof URL === "function" && | ||
typeof URL.createObjectURL === "function" && | ||
typeof URL.revokeObjectURL === "function" && | ||
typeof Blob === "function" && | ||
typeof btoa === "function") { | ||
styleElement = createLinkElement(options); | ||
update = updateLink.bind(null, styleElement, options); | ||
remove = function() { | ||
removeStyleElement(styleElement); | ||
if(styleElement.href) | ||
URL.revokeObjectURL(styleElement.href); | ||
}; | ||
} else { | ||
styleElement = createStyleElement(options); | ||
update = applyToTag.bind(null, styleElement); | ||
remove = function() { | ||
removeStyleElement(styleElement); | ||
}; | ||
} | ||
update(obj); | ||
return function updateStyle(newObj) { | ||
if(newObj) { | ||
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) | ||
return; | ||
update(obj = newObj); | ||
} else { | ||
remove(); | ||
} | ||
}; | ||
} | ||
var replaceText = (function () { | ||
var textStore = []; | ||
return function (index, replacement) { | ||
textStore[index] = replacement; | ||
return textStore.filter(Boolean).join('\n'); | ||
}; | ||
})(); | ||
function applyToSingletonTag(styleElement, index, remove, obj) { | ||
var css = remove ? "" : obj.css; | ||
if (styleElement.styleSheet) { | ||
styleElement.styleSheet.cssText = replaceText(index, css); | ||
} else { | ||
var cssNode = document.createTextNode(css); | ||
var childNodes = styleElement.childNodes; | ||
if (childNodes[index]) styleElement.removeChild(childNodes[index]); | ||
if (childNodes.length) { | ||
styleElement.insertBefore(cssNode, childNodes[index]); | ||
} else { | ||
styleElement.appendChild(cssNode); | ||
} | ||
} | ||
} | ||
function applyToTag(styleElement, obj) { | ||
var css = obj.css; | ||
var media = obj.media; | ||
if(media) { | ||
styleElement.setAttribute("media", media) | ||
} | ||
if(styleElement.styleSheet) { | ||
styleElement.styleSheet.cssText = css; | ||
} else { | ||
while(styleElement.firstChild) { | ||
styleElement.removeChild(styleElement.firstChild); | ||
} | ||
styleElement.appendChild(document.createTextNode(css)); | ||
} | ||
} | ||
function updateLink(linkElement, options, obj) { | ||
var css = obj.css; | ||
var sourceMap = obj.sourceMap; | ||
/* If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled | ||
and there is no publicPath defined then lets turn convertToAbsoluteUrls | ||
on by default. Otherwise default to the convertToAbsoluteUrls option | ||
directly | ||
*/ | ||
var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap; | ||
if (options.convertToAbsoluteUrls || autoFixUrls){ | ||
css = fixUrls(css); | ||
} | ||
if(sourceMap) { | ||
// http://stackoverflow.com/a/26603875 | ||
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; | ||
} | ||
var blob = new Blob([css], { type: "text/css" }); | ||
var oldSrc = linkElement.href; | ||
linkElement.href = URL.createObjectURL(blob); | ||
if(oldSrc) | ||
URL.revokeObjectURL(oldSrc); | ||
} | ||
/***/ }), | ||
/* 6 */ | ||
/***/ (function(module, exports) { | ||
/** | ||
* When source maps are enabled, `style-loader` uses a link element with a data-uri to | ||
* embed the css on the page. This breaks all relative urls because now they are relative to a | ||
* bundle instead of the current page. | ||
* | ||
* One solution is to only use full urls, but that may be impossible. | ||
* | ||
* Instead, this function "fixes" the relative urls to be absolute according to the current page location. | ||
* | ||
* A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command. | ||
* | ||
*/ | ||
module.exports = function (css) { | ||
// get current location | ||
var location = typeof window !== "undefined" && window.location; | ||
if (!location) { | ||
throw new Error("fixUrls requires window.location"); | ||
} | ||
// blank or null? | ||
if (!css || typeof css !== "string") { | ||
return css; | ||
} | ||
var baseUrl = location.protocol + "//" + location.host; | ||
var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/"); | ||
// convert each url(...) | ||
/* | ||
This regular expression is just a way to recursively match brackets within | ||
a string. | ||
/url\s*\( = Match on the word "url" with any whitespace after it and then a parens | ||
( = Start a capturing group | ||
(?: = Start a non-capturing group | ||
[^)(] = Match anything that isn't a parentheses | ||
| = OR | ||
\( = Match a start parentheses | ||
(?: = Start another non-capturing groups | ||
[^)(]+ = Match anything that isn't a parentheses | ||
| = OR | ||
\( = Match a start parentheses | ||
[^)(]* = Match anything that isn't a parentheses | ||
\) = Match a end parentheses | ||
) = End Group | ||
*\) = Match anything and then a close parens | ||
) = Close non-capturing group | ||
* = Match anything | ||
) = Close capturing group | ||
\) = Match a close parens | ||
/gi = Get all matches, not the first. Be case insensitive. | ||
*/ | ||
var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) { | ||
// strip quotes (if they exist) | ||
var unquotedOrigUrl = origUrl | ||
.trim() | ||
.replace(/^"(.*)"$/, function(o, $1){ return $1; }) | ||
.replace(/^'(.*)'$/, function(o, $1){ return $1; }); | ||
// already a full url? no change | ||
if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) { | ||
return fullMatch; | ||
} | ||
// convert the url to a full url | ||
var newUrl; | ||
if (unquotedOrigUrl.indexOf("//") === 0) { | ||
//TODO: should we add protocol? | ||
newUrl = unquotedOrigUrl; | ||
} else if (unquotedOrigUrl.indexOf("/") === 0) { | ||
// path should be relative to the base url | ||
newUrl = baseUrl + unquotedOrigUrl; // already starts with '/' | ||
} else { | ||
// path should be relative to current directory | ||
newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './' | ||
} | ||
// send back the fixed url(...) | ||
return "url(" + JSON.stringify(newUrl) + ")"; | ||
}); | ||
// send back the fixed css | ||
return fixedCss; | ||
}; | ||
/***/ }) | ||
],[6]); | ||
/******/ ]); | ||
//# sourceMappingURL=angularjs-input-birthday.map |
@@ -1,1 +0,1 @@ | ||
webpackJsonp([1,0],[,function(t,n){t.exports='<fieldset class="birthday-picker">\n <label for="birthday-input-year"\n class="sr-only">\n {{ \'birthday-input.year-label\' | translate }}\n </label>\n <select id="birthday-input-year"\n class="birth-year"\n data-ng-model="$ctrl.year"\n data-ng-change="$ctrl.update()"\n data-ng-options="value for value in $ctrl.years">\n <option value="">{{ \'birthday-input.years\' | translate }}</option>\n </select>\n\n <label for="birthday-input-month"\n class="sr-only">\n {{ \'birthday-input.month-label\' | translate }}\n </label>\n <select id="birthday-input-month"\n class="birth-month"\n data-ng-model="$ctrl.month"\n data-ng-change="$ctrl.update()"\n data-ng-options="key as value for (key, value) in $ctrl.months">\n <option value="">{{ \'birthday-input.months\' | translate }}</option>\n </select>\n\n <label for="birthday-input-day"\n class="sr-only"\n data-ng-if="$ctrl.askDay">\n {{ \'birthday-input.day-label\' | translate }}\n </label>\n <select id="birthday-input-day"\n class="birth-day"\n data-ng-if="$ctrl.askDay"\n data-ng-model="$ctrl.day"\n data-ng-change="$ctrl.update()"\n data-ng-options="value for value in $ctrl.days"\n data-ng-disabled="!$ctrl.month || !$ctrl.year">\n <option value="">{{ \'birthday-input.days\' | translate }}</option>\n </select>\n</fieldset>\n'},function(t,n,a){var e=a(5);"string"==typeof e&&(e=[[t.i,e,""]]);var r={};r.transform=void 0;a(123)(e,r);e.locals&&(t.exports=e.locals)},,,function(t,n,a){n=t.exports=a(7)(void 0),n.push([t.i,"birthday {\n background: red;\n color: black; }\n",""])},function(t,n,a){"use strict";function e(t){return t&&t.__esModule?t:{default:t}}function r(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,n){for(var a=0;a<n.length;a++){var e=n[a];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}return function(n,a,e){return a&&t(n.prototype,a),e&&t(n,e),n}}(),l=a(4),s=e(l),o=a(0),u=e(o);a(3),a(2);var d=function(){function t(){r(this,t),this.years=this.getLastYears(),this.months=u.default.months(),this.days=[]}return i(t,[{key:"$onInit",value:function(){this.askDay=s.default.isUndefined(this.askDay)||this.askDay}},{key:"update",value:function(){var t=this.year&&String(this.year),n=this.month&&String(Number(this.month)+1),a=this.day&&String(this.day);if(t&&n&&(a||!this.askDay)){var e=(0,u.default)(t+"-"+n+"-"+a,"YYYY-MM-DD");this.returnFormat?this.ngModel=e.format(this.returnFormat):this.ngModel="moment"===this.returnType?e:e.toDate()}else if(this.year&&this.month){var r=(0,u.default)(t+n,"YYYYMM").daysInMonth();this.days=this.range(r),this.ngModel=void 0}else this.ngModel=void 0,this.days=[]}},{key:"range",value:function(t){return Array.apply(null,Array(t)).map(function(t,n){return++n})}},{key:"getLastYears",value:function(){for(var t=[],n=(0,u.default)().year(),a=0;a<130;a++)t.push(n--);return t}}]),t}();s.default.module("angularjs-input-birthday",["pascalprecht.translate"]).component("inputBirthday",{template:a(1),controller:d,bindings:{returnType:"@",returnFormat:"@",askDay:"<",ngModel:"=",yearLabel:"<"}})}],[6]); | ||
!function(t){function n(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}var e={};n.m=t,n.c=e,n.i=function(t){return t},n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=4)}([function(t,n){t.exports='<fieldset class="birthday-picker">\n <label for="birthday-input-year"\n class="sr-only">\n {{ \'birthday-input.year-label\' | translate }}\n </label>\n <select id="birthday-input-year"\n class="birth-year"\n data-ng-model="$ctrl.year"\n data-ng-change="$ctrl.update()"\n data-ng-options="value for value in $ctrl.years">\n <option value="">{{ \'birthday-input.years\' | translate }}</option>\n </select>\n\n <label for="birthday-input-month"\n class="sr-only">\n {{ \'birthday-input.month-label\' | translate }}\n </label>\n <select id="birthday-input-month"\n class="birth-month"\n data-ng-model="$ctrl.month"\n data-ng-change="$ctrl.update()"\n data-ng-options="key as value for (key, value) in $ctrl.months">\n <option value="">{{ \'birthday-input.months\' | translate }}</option>\n </select>\n\n <label for="birthday-input-day"\n class="sr-only"\n data-ng-if="$ctrl.askDay">\n {{ \'birthday-input.day-label\' | translate }}\n </label>\n <select id="birthday-input-day"\n class="birth-day"\n data-ng-if="$ctrl.askDay"\n data-ng-model="$ctrl.day"\n data-ng-change="$ctrl.update()"\n data-ng-options="value for value in $ctrl.days"\n data-ng-disabled="!$ctrl.month || !$ctrl.year">\n <option value="">{{ \'birthday-input.days\' | translate }}</option>\n </select>\n</fieldset>\n'},function(t,n,e){var r=e(2);"string"==typeof r&&(r=[[t.i,r,""]]);var a={};a.transform=void 0;e(5)(r,a);r.locals&&(t.exports=r.locals)},function(t,n,e){n=t.exports=e(3)(void 0),n.push([t.i,"birthday {\n background: red;\n color: black; }\n",""])},function(t,n){function e(t,n){var e=t[1]||"",a=t[3];if(!a)return e;if(n&&"function"==typeof btoa){var o=r(a);return[e].concat(a.sources.map(function(t){return"/*# sourceURL="+a.sourceRoot+t+" */"})).concat([o]).join("\n")}return[e].join("\n")}function r(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}t.exports=function(t){var n=[];return n.toString=function(){return this.map(function(n){var r=e(n,t);return n[2]?"@media "+n[2]+"{"+r+"}":r}).join("")},n.i=function(t,e){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},a=0;a<this.length;a++){var o=this[a][0];"number"==typeof o&&(r[o]=!0)}for(a=0;a<t.length;a++){var i=t[a];"number"==typeof i[0]&&r[i[0]]||(e&&!i[2]?i[2]=e:e&&(i[2]="("+i[2]+") and ("+e+")"),n.push(i))}},n}},function(t,n,e){"use strict";function r(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}();e(1);var o=function(){function t(){r(this,t)}return a(t,[{key:"$onInit",value:function(){if(this.years=this.getLastYears(),this.months=moment.months(),this.askDay=angular.isUndefined(this.askDay)||this.askDay,this.initToday=Boolean(this.initToday),this.ngModel=this.ngModel&&moment(this.ngModel)||this.initToday&&moment(new Date)||void 0,this.ngModel){var t=this.ngModel.year(),n=this.ngModel.month(),e=moment(t+n,"YYYYMM").daysInMonth();this.days=this.range(e),this.year=t,this.month=String(this.ngModel.month()),this.day=parseInt(this.ngModel.format("DD"),0)}}},{key:"update",value:function(){var t=this.year&&String(this.year),n=this.month&&String(Number(this.month)+1),e=this.day&&String(this.day);if(t&&n&&(e||!this.askDay)){var r=moment(t+"-"+n+"-"+e,"YYYY-MM-DD");this.returnFormat?this.ngModel=r.format(this.returnFormat):this.ngModel="moment"===this.returnType?r:r.toDate()}else if(this.year&&this.month){var a=moment(t+n,"YYYYMM").daysInMonth();this.days=this.range(a),this.ngModel=void 0}else this.ngModel=void 0,this.days=[]}},{key:"range",value:function(t){return Array.apply(null,Array(t)).map(function(t,n){return++n})}},{key:"getLastYears",value:function(){for(var t=[],n=moment().year(),e=0;e<130;e++)t.push(n--);return t}}]),t}();angular.module("angularjs-input-birthday",["pascalprecht.translate"]).component("inputBirthday",{template:e(0),controller:o,bindings:{returnType:"@",returnFormat:"@",initToday:"<",askDay:"<",ngModel:"=",yearLabel:"<"}})},function(t,n,e){function r(t,n){for(var e=0;e<t.length;e++){var r=t[e],a=p[r.id];if(a){a.refs++;for(var o=0;o<a.parts.length;o++)a.parts[o](r.parts[o]);for(;o<r.parts.length;o++)a.parts.push(c(r.parts[o],n))}else{for(var i=[],o=0;o<r.parts.length;o++)i.push(c(r.parts[o],n));p[r.id]={id:r.id,refs:1,parts:i}}}}function a(t,n){for(var e=[],r={},a=0;a<t.length;a++){var o=t[a],i=n.base?o[0]+n.base:o[0],s=o[1],l=o[2],u=o[3],c={css:s,media:l,sourceMap:u};r[i]?r[i].parts.push(c):e.push(r[i]={id:i,parts:[c]})}return e}function o(t,n){var e=v(t.insertInto);if(!e)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=g[g.length-1];if("top"===t.insertAt)r?r.nextSibling?e.insertBefore(n,r.nextSibling):e.appendChild(n):e.insertBefore(n,e.firstChild),g.push(n);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");e.appendChild(n)}}function i(t){t.parentNode.removeChild(t);var n=g.indexOf(t);n>=0&&g.splice(n,1)}function s(t){var n=document.createElement("style");return t.attrs.type="text/css",u(n,t.attrs),o(t,n),n}function l(t){var n=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",u(n,t.attrs),o(t,n),n}function u(t,n){Object.keys(n).forEach(function(e){t.setAttribute(e,n[e])})}function c(t,n){var e,r,a,o;if(n.transform&&t.css){if(!(o=n.transform(t.css)))return function(){};t.css=o}if(n.singleton){var u=b++;e=m||(m=s(n)),r=f.bind(null,e,u,!1),a=f.bind(null,e,u,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(e=l(n),r=h.bind(null,e,n),a=function(){i(e),e.href&&URL.revokeObjectURL(e.href)}):(e=s(n),r=d.bind(null,e),a=function(){i(e)});return r(t),function(n){if(n){if(n.css===t.css&&n.media===t.media&&n.sourceMap===t.sourceMap)return;r(t=n)}else a()}}function f(t,n,e,r){var a=e?"":r.css;if(t.styleSheet)t.styleSheet.cssText=w(n,a);else{var o=document.createTextNode(a),i=t.childNodes;i[n]&&t.removeChild(i[n]),i.length?t.insertBefore(o,i[n]):t.appendChild(o)}}function d(t,n){var e=n.css,r=n.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}function h(t,n,e){var r=e.css,a=e.sourceMap,o=void 0===n.convertToAbsoluteUrls&&a;(n.convertToAbsoluteUrls||o)&&(r=M(r)),a&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */");var i=new Blob([r],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(i),s&&URL.revokeObjectURL(s)}var p={},y=function(t){var n;return function(){return void 0===n&&(n=t.apply(this,arguments)),n}}(function(){return window&&document&&document.all&&!window.atob}),v=function(t){var n={};return function(e){return void 0===n[e]&&(n[e]=t.call(this,e)),n[e]}}(function(t){return document.querySelector(t)}),m=null,b=0,g=[],M=e(6);t.exports=function(t,n){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");n=n||{},n.attrs="object"==typeof n.attrs?n.attrs:{},void 0===n.singleton&&(n.singleton=y()),void 0===n.insertInto&&(n.insertInto="head"),void 0===n.insertAt&&(n.insertAt="bottom");var e=a(t,n);return r(e,n),function(t){for(var o=[],i=0;i<e.length;i++){var s=e[i],l=p[s.id];l.refs--,o.push(l)}if(t){r(a(t,n),n)}for(var i=0;i<o.length;i++){var l=o[i];if(0===l.refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete p[l.id]}}}};var w=function(){var t=[];return function(n,e){return t[n]=e,t.filter(Boolean).join("\n")}}()},function(t,n){t.exports=function(t){var n="undefined"!=typeof window&&window.location;if(!n)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var e=n.protocol+"//"+n.host,r=e+n.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,n){var a=n.trim().replace(/^"(.*)"$/,function(t,n){return n}).replace(/^'(.*)'$/,function(t,n){return n});if(/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(a))return t;var o;return o=0===a.indexOf("//")?a:0===a.indexOf("/")?e+a:r+a.replace(/^\.\//,""),"url("+JSON.stringify(o)+")"})}}]); |
{ | ||
"name": "angularjs-input-birthday", | ||
"version": "0.0.2", | ||
"version": "0.0.4", | ||
"description": "AngularJS Component for birthday selector", | ||
@@ -18,5 +18,6 @@ "author": { | ||
"license": "MIT", | ||
"homepage": "https://heyprof.github.io/angularjs-input-birthday/", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/heyprof/angularjs-input-birthday" | ||
"url": "https://github.com/heyprof/angularjs-input-birthday.git" | ||
}, | ||
@@ -43,3 +44,2 @@ "bugs": { | ||
"babel-preset-es2015": "^6.24.1", | ||
"clean-webpack-plugin": "^0.1.16", | ||
"css-loader": "^0.28.1", | ||
@@ -46,0 +46,0 @@ "eslint": "^3.19.0", |
@@ -27,3 +27,3 @@ ## angularjs-input-birthday | ||
**See [example page]() for more informations and options doc** | ||
**See [example page](https://heyprof.github.io/angularjs-input-birthday/) for more informations and options doc** | ||
@@ -40,2 +40,5 @@ ### Contrib | ||
- [Npm Guide](https://docs.npmjs.com/getting-started/publishing-npm-packages) | ||
- [Bower Guide](https://bower.io/docs/creating-packages/) | ||
### LICENCE | ||
@@ -42,0 +45,0 @@ |
@@ -7,2 +7,8 @@ import angular from 'angular'; | ||
class DevServerComponent { | ||
$onInit() { | ||
this.birthdate = new Date('1990-02-25').toISOString(); | ||
} | ||
} | ||
angular.module('dev-server', [ | ||
@@ -28,2 +34,12 @@ 'pascalprecht.translate', | ||
}); | ||
}).component('devServer', { | ||
template: ` | ||
<input-birthday return-type="moment" ng-model="birthdate"></input-birthday> | ||
<pre>{{ birthdate }}</pre> | ||
<input-birthday return-type="moment" ng-model="birthdate2" init-today="true"></input-birthday> | ||
<pre>{{ birthdate2 }}</pre> | ||
<input-birthday return-type="moment" ng-model="$ctrl.birthdate"></input-birthday> | ||
<pre>{{ $ctrl.birthdate }}</pre> | ||
`, | ||
controller: DevServerComponent | ||
}); |
@@ -1,5 +0,1 @@ | ||
import angular from 'angular'; | ||
import moment from 'moment'; | ||
import 'angular-translate'; | ||
import './input-birthday.style.scss'; | ||
@@ -17,11 +13,23 @@ | ||
class BirthdayInputComponent { | ||
/** @ngInject */ | ||
constructor() { | ||
$onInit() { | ||
this.years = this.getLastYears(); | ||
this.months = moment.months(); | ||
this.days = []; | ||
} | ||
this.askDay = angular.isUndefined(this.askDay) || this.askDay; | ||
this.initToday = Boolean(this.initToday); | ||
$onInit() { | ||
this.askDay = angular.isUndefined(this.askDay) || this.askDay; | ||
this.ngModel = | ||
(this.ngModel && moment(this.ngModel)) || | ||
(this.initToday && moment(new Date())) || | ||
undefined; | ||
if (this.ngModel) { | ||
const year = this.ngModel.year(); | ||
const month = this.ngModel.month(); | ||
const nbDays = moment(year + month, 'YYYYMM').daysInMonth(); | ||
this.days = this.range(nbDays); | ||
this.year = year; | ||
this.month = String(this.ngModel.month()); | ||
this.day = parseInt(this.ngModel.format('DD'), 0); | ||
} | ||
} | ||
@@ -73,2 +81,3 @@ | ||
returnFormat: '@', | ||
initToday: '<', | ||
askDay: '<', | ||
@@ -75,0 +84,0 @@ ngModel: '=', |
/* eslint-disable quote-props */ | ||
const CleanWebpackPlugin = require('clean-webpack-plugin'); | ||
const webpack = require('webpack'); | ||
@@ -41,9 +40,2 @@ const path = require('path'); | ||
plugins: [ | ||
new CleanWebpackPlugin('dist/*'), | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'vendor', | ||
minChunks(module) { | ||
return module.context && module.context.indexOf('node_modules') !== -1; | ||
} | ||
}), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
@@ -50,0 +42,0 @@ include: /\.min\.js$/, |
@@ -11,8 +11,8 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
output: { | ||
publicPath: '/' | ||
filename: '[name].js', | ||
sourceMapFilename: '[name].map' | ||
}, | ||
devtool: 'eval', | ||
devServer: { | ||
hot: true, | ||
publicPath: '/' | ||
hot: true | ||
}, | ||
@@ -26,5 +26,8 @@ module: { | ||
}, { | ||
test: /\.scss$/, | ||
loaders: ['style-loader', 'css-loader', 'sass-loader', 'postcss-loader'] | ||
test: /\.(css|scss$)/, | ||
loaders: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader'] | ||
}, { | ||
test: /\.(eot|svg|ttf|woff|woff2)$/, | ||
loader: 'file-loader?name=public/fonts/[name].[ext]' | ||
}, { | ||
test: /\.js$/, | ||
@@ -44,2 +47,11 @@ exclude: /(node_modules)/, | ||
plugins: [ | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'vendor', | ||
minChunks(module) { | ||
return module.context && module.context.indexOf('node_modules') !== -1; | ||
} | ||
}), | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'manifest' | ||
}), | ||
new webpack.HotModuleReplacementPlugin(), | ||
@@ -46,0 +58,0 @@ new HtmlWebpackPlugin({template: './src/dev-server.html'}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
60661
19
26
880
2
64
1