gl-w-frontend
Advanced tools
Comparing version 1.3.10 to 1.4.0-alpha
@@ -1,123 +0,8 @@ | ||
/// <reference types="moment-range" /> | ||
declare const Array: { | ||
removeArrayDuplicateLegacy: (array: any[]) => any[]; | ||
sortByKey: (array: any[], key: string, asc: boolean) => PromiseLike<any[]>; | ||
}; | ||
declare const ArraySort: { | ||
sortByKey: (array: any[], key: string, asc: boolean) => PromiseLike<any[]>; | ||
}; | ||
declare const ArrayRemove: { | ||
removeArrayDuplicateLegacy: (array: any[]) => any[]; | ||
}; | ||
declare const Attachment: { | ||
validateFile: (input: HTMLInputElement, accepts: string[]) => boolean; | ||
validateFileSize: (input: HTMLInputElement) => boolean; | ||
textFileToUrlImage: (file: File) => PromiseLike<string>; | ||
parseAcceptFiles: (accepts: string) => string[]; | ||
}; | ||
declare const AttachmentValidate: { | ||
validateFile: (input: HTMLInputElement, accepts: string[]) => boolean; | ||
validateFileSize: (input: HTMLInputElement) => boolean; | ||
fileMaxSize: (input: HTMLInputElement) => number; | ||
}; | ||
declare const AttachmentConvert: { | ||
textFileToUrlImage: (file: File) => PromiseLike<string>; | ||
}; | ||
declare const AttachmentParse: { | ||
parseAcceptFiles: (accepts: string) => string[]; | ||
}; | ||
declare const Browser: { | ||
isIE: () => boolean; | ||
isBeforeIE11: () => boolean; | ||
disableFullscreenListener: () => void; | ||
fullscreenListener: (menuButton: import("./scripts/core/services/menu/core-services-menu.interfaces").IMenuButton, alt: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenAlt, src: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenSrc, showLog?: boolean) => void; | ||
toggleFullScreen: (menuButton: import("./scripts/core/services/menu/core-services-menu.interfaces").IMenuButton, alt: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenAlt, src: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenSrc, showLog?: boolean) => PromiseLike<import("./scripts/core/services/browser/core-services-browser.interfaces").IFullscreenResult>; | ||
hasFullscreen: () => boolean; | ||
}; | ||
declare const BrowserVersion: { | ||
isIE: () => boolean; | ||
isBeforeIE11: () => boolean; | ||
}; | ||
declare const BrowserFullscreen: { | ||
disableFullscreenListener: () => void; | ||
fullscreenListener: (menuButton: import("./scripts/core/services/menu/core-services-menu.interfaces").IMenuButton, alt: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenAlt, src: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenSrc, showLog?: boolean) => void; | ||
toggleFullScreen: (menuButton: import("./scripts/core/services/menu/core-services-menu.interfaces").IMenuButton, alt: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenAlt, src: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenSrc, showLog?: boolean) => PromiseLike<import("./scripts/core/services/browser/core-services-browser.interfaces").IFullscreenResult>; | ||
hasFullscreen: () => boolean; | ||
}; | ||
declare const ComboBox: { | ||
initialize: (combobox: HTMLSelectElement, callback: any, invalidCallback: any) => void; | ||
loadData: (combobox: HTMLSelectElement, data: import("./scripts/core/services/combobox/core-services-combobox.interface").IComboBoxData[], keepValue: boolean) => Promise<unknown>; | ||
dataByValue: (arrayData: import("./scripts/core/services/combobox/core-services-combobox.interface").IComboBoxData[], value: string) => string; | ||
disableInput: (combobox: HTMLSelectElement, disable: boolean) => void; | ||
}; | ||
declare const ComboBoxCore: { | ||
initialize: (combobox: HTMLSelectElement, callback: any, invalidCallback: any) => void; | ||
loadData: (combobox: HTMLSelectElement, data: import("./scripts/core/services/combobox/core-services-combobox.interface").IComboBoxData[], keepValue: boolean) => Promise<unknown>; | ||
}; | ||
declare const ComboBoxData: { | ||
dataByValue: (arrayData: import("./scripts/core/services/combobox/core-services-combobox.interface").IComboBoxData[], value: string) => string; | ||
}; | ||
declare const ComboBoxDom: { | ||
disableInput: (combobox: HTMLSelectElement, disable: boolean) => void; | ||
}; | ||
declare const DateCore: { | ||
customDate: (date: import("moment").MomentInput, format: string) => string; | ||
currentDate: (outputFormat?: string) => string; | ||
dayMonthYear: (date: import("moment").MomentInput, format?: string) => import("./scripts/core/services/date/core-services-date.interface").IDayMonthYear; | ||
localDate: (year: number, month: number, day: number, local?: import("./scripts/core/services/date/core-services-date.interface").IDateLocal) => string; | ||
dateFromIso: (date: import("moment").MomentInput, format?: string) => string; | ||
ganttDate: (date: import("moment").MomentInput) => Date; | ||
isoDateCustom: (date: import("moment").MomentInput, dateFormat: string, outputFormat: string) => string; | ||
isoDate: (date: import("moment").MomentInput, format?: string) => string; | ||
isoDateWithoutTime: (date: import("moment").MomentInput) => string; | ||
dateMilliseconds: (date: import("moment").MomentInput, dateFormat: string, outputFormat: string) => number; | ||
dateToMillisecondsNoTime: (date: import("moment").MomentInput) => number; | ||
millisecondsToDate: (date: import("moment").MomentInput, outputFormat: string) => string; | ||
daysToMilliseconds: (days: number) => number; | ||
durationInDays: (start: number, end: number, countFirstDay: boolean) => number; | ||
durationInMilliseconds: (start: number, end: number) => number; | ||
monthName: (month: number, language?: string) => string; | ||
weeksOfMonth: (year: number, month: number) => import("./scripts/core/services/date/core-services-date.interface").IWeeksOfMonth[]; | ||
daysOfMonth: (weeksRange: import("./scripts/core/services/date/core-services-date.interface").IWeeksOfMonth[]) => import("./scripts/core/services/date/core-services-date.interface").IDaysOfMonth[][]; | ||
weekOfYear: (date: string, format: string) => number; | ||
isDateBefore: (startDate: string, endDate: string, type?: import("moment").unitOfTime.StartOf) => boolean; | ||
}; | ||
declare const DateGet: { | ||
customDate: (date: import("moment").MomentInput, format: string) => string; | ||
currentDate: (outputFormat?: string) => string; | ||
dayMonthYear: (date: import("moment").MomentInput, format?: string) => import("./scripts/core/services/date/core-services-date.interface").IDayMonthYear; | ||
localDate: (year: number, month: number, day: number, local?: import("./scripts/core/services/date/core-services-date.interface").IDateLocal) => string; | ||
dateFromIso: (date: import("moment").MomentInput, format?: string) => string; | ||
ganttDate: (date: import("moment").MomentInput) => Date; | ||
isoDateCustom: (date: import("moment").MomentInput, dateFormat: string, outputFormat: string) => string; | ||
isoDate: (date: import("moment").MomentInput, format?: string) => string; | ||
isoDateWithoutTime: (date: import("moment").MomentInput) => string; | ||
dateMilliseconds: (date: import("moment").MomentInput, dateFormat: string, outputFormat: string) => number; | ||
dateToMillisecondsNoTime: (date: import("moment").MomentInput) => number; | ||
millisecondsToDate: (date: import("moment").MomentInput, outputFormat: string) => string; | ||
daysToMilliseconds: (days: number) => number; | ||
durationInDays: (start: number, end: number, countFirstDay: boolean) => number; | ||
durationInMilliseconds: (start: number, end: number) => number; | ||
monthName: (month: number, language?: string) => string; | ||
weeksOfMonth: (year: number, month: number) => import("./scripts/core/services/date/core-services-date.interface").IWeeksOfMonth[]; | ||
daysOfMonth: (weeksRange: import("./scripts/core/services/date/core-services-date.interface").IWeeksOfMonth[]) => import("./scripts/core/services/date/core-services-date.interface").IDaysOfMonth[][]; | ||
weekOfYear: (date: string, format: string) => number; | ||
}; | ||
declare const DateComparable: { | ||
isDateBefore: (startDate: string, endDate: string, type?: import("moment").unitOfTime.StartOf) => boolean; | ||
}; | ||
declare const DateValidation: { | ||
validateDate: (date: import("moment").MomentInput) => boolean; | ||
}; | ||
declare const DatePicker: { | ||
setDatePicker: (datePicker: HTMLInputElement, dateFormat: string) => void; | ||
monthYearDatePicker: (datePicker: HTMLInputElement, dateFormat: string, setValueCallback: any) => void; | ||
dateFromDatePicker: (date: import("moment").MomentInput, format?: string, outputFormat?: string) => string; | ||
localDateForDatePicker: (date: import("moment").MomentInput, outputFormat?: string) => string; | ||
currentDateForDatePicker: (dateFormat?: string, outputFormat?: string) => string; | ||
dateForDatePicker: (month: number, day: number, year: number) => string; | ||
}; | ||
declare const Elements: { | ||
removeChildElements: (elementClassId: string | HTMLElement) => void; | ||
}; | ||
export { Array, ArraySort, ArrayRemove, Attachment, AttachmentValidate, AttachmentConvert, AttachmentParse, Browser, BrowserVersion, BrowserFullscreen, ComboBox, ComboBoxCore, ComboBoxData, ComboBoxDom, DateCore, DateGet, DateComparable, DateValidation, DatePicker, Elements }; | ||
import '../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
export * from './scripts/core/services/array/core-services-array.service'; | ||
export * from './scripts/core/services/attachment/core-services-attachment.service'; | ||
export * from './scripts/core/services/browser/core-services-browser.service'; | ||
export * from './scripts/core/services/combobox/core-services-combobox.service'; | ||
export * from './scripts/core/services/date/core-services-date.service'; | ||
export * from './scripts/core/services/elements/core-services-elements.service'; | ||
export * from './scripts/core/services/string/core-services-string.service'; |
@@ -1,51 +0,9 @@ | ||
/* tslint:disable:variable-name */ | ||
import { validateFile, validateFileSize, fileMaxSize, textFileToUrlImage, parseAcceptFiles } from './scripts/core/services/attachment/core-services-attachment.service'; | ||
import { removeArrayDuplicateLegacy, sortByKey } from './scripts/core/services/array/core-services-array.service'; | ||
import { isBeforeIE11, isIE, disableFullscreenListener, fullscreenListener, toggleFullScreen, hasFullscreen } from './scripts/core/services/browser/core-services-browser.service'; | ||
import { initialize, loadData, dataByValue, disableInput } from './scripts/core/services/combobox/core-services-combobox.service'; | ||
import { customDate, currentDate, dayMonthYear, localDate, dateFromIso, ganttDate, isoDateCustom, isoDate, isoDateWithoutTime, dateMilliseconds, dateToMillisecondsNoTime, millisecondsToDate, daysToMilliseconds, durationInDays, durationInMilliseconds, monthName, weeksOfMonth, daysOfMonth, weekOfYear, isDateBefore, validateDate, setDatePicker, monthYearDatePicker, dateFromDatePicker, localDateForDatePicker, currentDateForDatePicker, dateForDatePicker } from './scripts/core/services/date/core-services-date.service'; | ||
import { removeChildElements } from './scripts/core/services/elements/core-services-elements.service'; | ||
import { numberToString } from './scripts/core/services/string/core-services-string.service'; | ||
// region Array | ||
var Array = { removeArrayDuplicateLegacy: removeArrayDuplicateLegacy, sortByKey: sortByKey }; | ||
var ArraySort = { sortByKey: sortByKey }; | ||
var ArrayRemove = { removeArrayDuplicateLegacy: removeArrayDuplicateLegacy }; | ||
// endregion | ||
// region Attachment | ||
var Attachment = { validateFile: validateFile, validateFileSize: validateFileSize, textFileToUrlImage: textFileToUrlImage, parseAcceptFiles: parseAcceptFiles }; | ||
var AttachmentValidate = { validateFile: validateFile, validateFileSize: validateFileSize, fileMaxSize: fileMaxSize }; | ||
var AttachmentConvert = { textFileToUrlImage: textFileToUrlImage }; | ||
var AttachmentParse = { parseAcceptFiles: parseAcceptFiles }; | ||
// endregion | ||
// region Browser | ||
var Browser = { isIE: isIE, isBeforeIE11: isBeforeIE11, disableFullscreenListener: disableFullscreenListener, fullscreenListener: fullscreenListener, toggleFullScreen: toggleFullScreen, hasFullscreen: hasFullscreen }; | ||
var BrowserVersion = { isIE: isIE, isBeforeIE11: isBeforeIE11 }; | ||
var BrowserFullscreen = { disableFullscreenListener: disableFullscreenListener, fullscreenListener: fullscreenListener, toggleFullScreen: toggleFullScreen, hasFullscreen: hasFullscreen }; | ||
// endregion | ||
// region ComboBox | ||
var ComboBox = { initialize: initialize, loadData: loadData, dataByValue: dataByValue, disableInput: disableInput }; | ||
var ComboBoxCore = { initialize: initialize, loadData: loadData }; | ||
var ComboBoxData = { dataByValue: dataByValue }; | ||
var ComboBoxDom = { disableInput: disableInput }; | ||
// endregion | ||
// region Date | ||
var DateCore = { customDate: customDate, currentDate: currentDate, dayMonthYear: dayMonthYear, localDate: localDate, dateFromIso: dateFromIso, ganttDate: ganttDate, isoDateCustom: isoDateCustom, isoDate: isoDate, isoDateWithoutTime: isoDateWithoutTime, | ||
dateMilliseconds: dateMilliseconds, dateToMillisecondsNoTime: dateToMillisecondsNoTime, millisecondsToDate: millisecondsToDate, daysToMilliseconds: daysToMilliseconds, durationInDays: durationInDays, durationInMilliseconds: durationInMilliseconds, | ||
monthName: monthName, weeksOfMonth: weeksOfMonth, daysOfMonth: daysOfMonth, weekOfYear: weekOfYear, isDateBefore: isDateBefore }; | ||
var DateGet = { customDate: customDate, currentDate: currentDate, dayMonthYear: dayMonthYear, localDate: localDate, dateFromIso: dateFromIso, ganttDate: ganttDate, isoDateCustom: isoDateCustom, isoDate: isoDate, isoDateWithoutTime: isoDateWithoutTime, | ||
dateMilliseconds: dateMilliseconds, dateToMillisecondsNoTime: dateToMillisecondsNoTime, millisecondsToDate: millisecondsToDate, daysToMilliseconds: daysToMilliseconds, durationInDays: durationInDays, durationInMilliseconds: durationInMilliseconds, | ||
monthName: monthName, weeksOfMonth: weeksOfMonth, daysOfMonth: daysOfMonth, weekOfYear: weekOfYear }; | ||
var DateComparable = { isDateBefore: isDateBefore }; | ||
var DateValidation = { validateDate: validateDate }; | ||
var DatePicker = { setDatePicker: setDatePicker, monthYearDatePicker: monthYearDatePicker, dateFromDatePicker: dateFromDatePicker, localDateForDatePicker: localDateForDatePicker, | ||
currentDateForDatePicker: currentDateForDatePicker, dateForDatePicker: dateForDatePicker | ||
}; | ||
// endregion | ||
// region Elements | ||
var Elements = { removeChildElements: removeChildElements }; | ||
// endregion | ||
// region String | ||
var String = { numberToString: numberToString }; | ||
// end region | ||
export { Array, ArraySort, ArrayRemove, Attachment, AttachmentValidate, AttachmentConvert, AttachmentParse, Browser, BrowserVersion, BrowserFullscreen, ComboBox, ComboBoxCore, ComboBoxData, ComboBoxDom, DateCore, DateGet, DateComparable, DateValidation, DatePicker, Elements }; | ||
import '../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
export * from './scripts/core/services/array/core-services-array.service'; | ||
export * from './scripts/core/services/attachment/core-services-attachment.service'; | ||
export * from './scripts/core/services/browser/core-services-browser.service'; | ||
export * from './scripts/core/services/combobox/core-services-combobox.service'; | ||
export * from './scripts/core/services/date/core-services-date.service'; | ||
export * from './scripts/core/services/elements/core-services-elements.service'; | ||
export * from './scripts/core/services/string/core-services-string.service'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,8 +0,6 @@ | ||
/** | ||
* Remove items | ||
*/ | ||
export declare const removeArrayDuplicateLegacy: (array: any[]) => any[]; | ||
/** | ||
* Sort Arrays | ||
*/ | ||
export declare const sortByKey: (array: any[], key: string, asc: boolean) => PromiseLike<any[]>; | ||
export declare class ArrayRemove { | ||
static duplicateLegacy(array: any[]): any[]; | ||
} | ||
export declare class ArraySort { | ||
static byKey(array: any[], key: string, asc: boolean): PromiseLike<any[]>; | ||
} |
@@ -1,24 +0,31 @@ | ||
/** | ||
* Remove items | ||
*/ | ||
export var removeArrayDuplicateLegacy = function (array) { | ||
var unique = array.filter(function (item, index) { | ||
return array.indexOf(item) === index; | ||
}); | ||
return unique.sort(); | ||
}; | ||
/** | ||
* Sort Arrays | ||
*/ | ||
export var sortByKey = function (array, key, asc) { | ||
return new Promise(function (resolve) { | ||
var _asc = asc ? 1 : -1; | ||
var sorted = array.sort(function (a, b) { | ||
var x = a[key]; | ||
var y = b[key]; | ||
return (x === y) ? 0 : ((x > y) ? _asc : -1 * _asc); | ||
var ArrayRemove = /** @class */ (function () { | ||
function ArrayRemove() { | ||
} | ||
ArrayRemove.duplicateLegacy = function (array) { | ||
var unique = array.filter(function (item, index) { | ||
return array.indexOf(item) === index; | ||
}); | ||
resolve(sorted); | ||
}); | ||
}; | ||
return unique.sort(); | ||
}; | ||
return ArrayRemove; | ||
}()); | ||
export { ArrayRemove }; | ||
var ArraySort = /** @class */ (function () { | ||
function ArraySort() { | ||
} | ||
ArraySort.byKey = function (array, key, asc) { | ||
return new Promise(function (resolve) { | ||
var _asc = asc ? 1 : -1; | ||
var sorted = array.sort(function (a, b) { | ||
var x = a[key]; | ||
var y = b[key]; | ||
return (x === y) ? 0 : ((x > y) ? _asc : -1 * _asc); | ||
}); | ||
resolve(sorted); | ||
}); | ||
}; | ||
return ArraySort; | ||
}()); | ||
export { ArraySort }; | ||
module.exports = { ArrayRemove: ArrayRemove, ArraySort: ArraySort }; | ||
//# sourceMappingURL=core-services-array.service.js.map |
@@ -1,17 +0,12 @@ | ||
/** | ||
* Convert | ||
*/ | ||
export declare const textFileToUrlImage: (file: File) => PromiseLike<string>; | ||
/** | ||
* Parser | ||
*/ | ||
export declare const parseAcceptFiles: (accepts: string) => string[]; | ||
/** | ||
* Validate | ||
*/ | ||
export declare const validateFile: (input: HTMLInputElement, accepts: string[]) => boolean; | ||
export declare const validateFileSize: (input: HTMLInputElement) => boolean; | ||
/** | ||
* The user must include the attribute 'data-maxsize' in mb(megabyte); | ||
*/ | ||
export declare const fileMaxSize: (input: HTMLInputElement) => number; | ||
export declare class AttachmentConvert { | ||
static textFileToUrlImage(file: File): PromiseLike<string>; | ||
} | ||
export declare class AttachmentParser { | ||
static parseAcceptFiles(accepts: string): string[]; | ||
} | ||
export declare class AttachmentValidate { | ||
static file(input: HTMLInputElement, accepts: string[]): boolean; | ||
static fileSize(input: HTMLInputElement): boolean; | ||
/** The user must include the attribute 'data-maxsize' in mb(megabyte); */ | ||
static maxSize: (input: HTMLInputElement) => number; | ||
} |
@@ -12,76 +12,84 @@ var __values = (this && this.__values) || function(o) { | ||
}; | ||
/** | ||
* Convert | ||
*/ | ||
export var textFileToUrlImage = function (file) { | ||
return new Promise(function (resolve) { | ||
var fileReader = new FileReader(); | ||
fileReader.addEventListener('load', function (e) { | ||
resolve(e.target.result); | ||
var AttachmentConvert = /** @class */ (function () { | ||
function AttachmentConvert() { | ||
} | ||
AttachmentConvert.textFileToUrlImage = function (file) { | ||
return new Promise(function (resolve) { | ||
var fileReader = new FileReader(); | ||
fileReader.addEventListener('load', function (e) { | ||
resolve(e.target.result); | ||
}); | ||
fileReader.readAsDataURL(file); | ||
}); | ||
fileReader.readAsDataURL(file); | ||
}); | ||
}; | ||
/** | ||
* Parser | ||
*/ | ||
export var parseAcceptFiles = function (accepts) { | ||
return accepts | ||
.replace(/image\//g, '') | ||
.replace(/x-/g, '') | ||
.replace(/\+xml/g, '') | ||
.replace(/ /g, '') | ||
.split(','); | ||
}; | ||
/** | ||
* Validate | ||
*/ | ||
export var validateFile = function (input, accepts) { | ||
var e_1, _a; | ||
var fileName = input.value; | ||
var idxDot = fileName.lastIndexOf('.') + 1; | ||
var extFile = fileName.substr(idxDot, fileName.length).toLowerCase(); | ||
if (accepts.length === 1 && accepts[0] === '*') { | ||
return true; | ||
}; | ||
return AttachmentConvert; | ||
}()); | ||
export { AttachmentConvert }; | ||
var AttachmentParser = /** @class */ (function () { | ||
function AttachmentParser() { | ||
} | ||
try { | ||
for (var accepts_1 = __values(accepts), accepts_1_1 = accepts_1.next(); !accepts_1_1.done; accepts_1_1 = accepts_1.next()) { | ||
var extension = accepts_1_1.value; | ||
if (extFile === extension) { | ||
return true; | ||
} | ||
AttachmentParser.parseAcceptFiles = function (accepts) { | ||
return accepts | ||
.replace(/image\//g, '') | ||
.replace(/x-/g, '') | ||
.replace(/\+xml/g, '') | ||
.replace(/ /g, '') | ||
.split(','); | ||
}; | ||
return AttachmentParser; | ||
}()); | ||
export { AttachmentParser }; | ||
var AttachmentValidate = /** @class */ (function () { | ||
function AttachmentValidate() { | ||
} | ||
AttachmentValidate.file = function (input, accepts) { | ||
var e_1, _a; | ||
var fileName = input.value; | ||
var idxDot = fileName.lastIndexOf('.') + 1; | ||
var extFile = fileName.substr(idxDot, fileName.length).toLowerCase(); | ||
if (accepts.length === 1 && accepts[0] === '*') { | ||
return true; | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (accepts_1_1 && !accepts_1_1.done && (_a = accepts_1.return)) _a.call(accepts_1); | ||
for (var accepts_1 = __values(accepts), accepts_1_1 = accepts_1.next(); !accepts_1_1.done; accepts_1_1 = accepts_1.next()) { | ||
var extension = accepts_1_1.value; | ||
if (extFile === extension) { | ||
return true; | ||
} | ||
} | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
return false; | ||
}; | ||
export var validateFileSize = function (input) { | ||
if (input != null && input.files != null) { | ||
var fileSize = input.files[0].size / 1024; | ||
var maxSize = fileMaxSize(input); | ||
return fileSize <= maxSize; | ||
} | ||
else { | ||
console.error('Input is null.'); | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (accepts_1_1 && !accepts_1_1.done && (_a = accepts_1.return)) _a.call(accepts_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
return false; | ||
} | ||
}; | ||
/** | ||
* The user must include the attribute 'data-maxsize' in mb(megabyte); | ||
*/ | ||
export var fileMaxSize = function (input) { | ||
var fileName = input.attributes['data-maxsize'].nodeValue; | ||
if (fileName) { | ||
return parseInt(fileName, 10); | ||
} | ||
else { | ||
return 1024 * 45; | ||
} | ||
}; | ||
}; | ||
AttachmentValidate.fileSize = function (input) { | ||
if (input != null && input.files != null) { | ||
var fileSize = input.files[0].size / 1024; | ||
var max = this.maxSize(input); | ||
return fileSize <= max; | ||
} | ||
else { | ||
console.error('Input is null.'); | ||
return false; | ||
} | ||
}; | ||
/** The user must include the attribute 'data-maxsize' in mb(megabyte); */ | ||
AttachmentValidate.maxSize = function (input) { | ||
var fileName = input.attributes['data-maxsize'].nodeValue; | ||
if (fileName) { | ||
return parseInt(fileName, 10); | ||
} | ||
else { | ||
return 1024 * 45; | ||
} | ||
}; | ||
return AttachmentValidate; | ||
}()); | ||
export { AttachmentValidate }; | ||
module.exports = { AttachmentConvert: AttachmentConvert, AttachmentParser: AttachmentParser, AttachmentValidate: AttachmentValidate }; | ||
//# sourceMappingURL=core-services-attachment.service.js.map |
import { IFullScreenAlt, IFullScreenSrc, IMenuButton } from '../menu/core-services-menu.interfaces'; | ||
import { IFullscreenResult } from './core-services-browser.interfaces'; | ||
/** | ||
* Ffullscreen | ||
*/ | ||
export declare const fullscreenListener: (menuButton: IMenuButton, alt: IFullScreenAlt, src: IFullScreenSrc, showLog?: boolean) => void; | ||
export declare const disableFullscreenListener: () => void; | ||
export declare const toggleFullScreen: (menuButton: IMenuButton, alt: IFullScreenAlt, src: IFullScreenSrc, showLog?: boolean) => PromiseLike<IFullscreenResult>; | ||
export declare const hasFullscreen: () => boolean; | ||
/** | ||
* Version | ||
*/ | ||
export declare const isIE: () => boolean; | ||
export declare const isBeforeIE11: () => boolean; | ||
export declare class BrowserFullScreen { | ||
static listener(menuButton: IMenuButton, alt: IFullScreenAlt, src: IFullScreenSrc, showLog?: boolean): void; | ||
static disableListener(): void; | ||
static toggle(menuButton: IMenuButton, alt: IFullScreenAlt, src: IFullScreenSrc, showLog?: boolean): PromiseLike<IFullscreenResult>; | ||
static available(): boolean; | ||
} | ||
export declare class BrowserVersion { | ||
static isIE(): boolean; | ||
static isBeforeIE11(): boolean; | ||
} |
import * as screenfull from 'screenfull'; | ||
/** | ||
* Ffullscreen | ||
*/ | ||
export var fullscreenListener = function (menuButton, alt, src, showLog) { | ||
if (showLog === void 0) { showLog = false; } | ||
if (screenfull.isEnabled) { | ||
// @ts-ignore | ||
screenfull.on('change', function () { | ||
// @ts-ignore | ||
if (screenfull.isFullscreen) { | ||
menuButton.src = src.exit; | ||
menuButton.alt = alt.exit; | ||
} | ||
else { | ||
menuButton.src = src.enter; | ||
menuButton.alt = alt.enter; | ||
} | ||
if (showLog) { | ||
// @ts-ignore | ||
var label = screenfull.isFullscreen ? 'enabled' : 'disabled'; | ||
console.log("Fullscreen " + label); | ||
} | ||
}); | ||
var BrowserFullScreen = /** @class */ (function () { | ||
function BrowserFullScreen() { | ||
} | ||
else { | ||
console.log('This browser does not support fullscreen api'); | ||
} | ||
}; | ||
export var disableFullscreenListener = function () { | ||
// @ts-ignore | ||
screenfull.off('change', function () { | ||
console.log('Fullscreen listener has been disabled'); | ||
}); | ||
}; | ||
export var toggleFullScreen = function (menuButton, alt, src, showLog) { | ||
if (showLog === void 0) { showLog = false; } | ||
return new Promise(function (resolve, reject) { | ||
BrowserFullScreen.listener = function (menuButton, alt, src, showLog) { | ||
if (showLog === void 0) { showLog = false; } | ||
if (screenfull.isEnabled) { | ||
if (screenfull.isFullscreen) { | ||
screenfull.exit().then(function () { | ||
screenfull.on('change', function () { | ||
// @ts-ignore | ||
if (screenfull.isFullscreen) { | ||
menuButton.src = src.exit; | ||
menuButton.alt = alt.exit; | ||
} | ||
else { | ||
menuButton.src = src.enter; | ||
menuButton.alt = alt.enter; | ||
}).catch(function (error) { | ||
console.log(error); | ||
reject(error); | ||
}); | ||
} | ||
if (showLog) { | ||
// @ts-ignore | ||
var label = screenfull.isFullscreen ? 'enabled' : 'disabled'; | ||
console.log("Fullscreen " + label); | ||
} | ||
}); | ||
} | ||
else { | ||
console.log('This browser does not support fullscreen api'); | ||
} | ||
}; | ||
BrowserFullScreen.disableListener = function () { | ||
// @ts-ignore | ||
screenfull.off('change', function () { | ||
console.log('Fullscreen listener has been disabled'); | ||
}); | ||
}; | ||
BrowserFullScreen.toggle = function (menuButton, alt, src, showLog) { | ||
if (showLog === void 0) { showLog = false; } | ||
return new Promise(function (resolve, reject) { | ||
if (screenfull.isEnabled) { | ||
if (screenfull.isFullscreen) { | ||
screenfull.exit().then(function () { | ||
menuButton.src = src.enter; | ||
menuButton.alt = alt.enter; | ||
}).catch(function (error) { | ||
console.log(error); | ||
reject(error); | ||
}); | ||
} | ||
else { | ||
screenfull.request().then(function () { | ||
menuButton.src = src.exit; | ||
menuButton.alt = alt.exit; | ||
}).catch(function (error) { | ||
console.log(error); | ||
reject(error); | ||
}); | ||
} | ||
if (showLog) { | ||
var label = screenfull.isFullscreen ? 'enabled' : 'disabled'; | ||
console.log("Fullscreen " + label); | ||
} | ||
resolve({ src: menuButton.src, alt: menuButton.alt }); | ||
} | ||
else { | ||
screenfull.request().then(function () { | ||
menuButton.src = src.exit; | ||
menuButton.alt = alt.exit; | ||
}).catch(function (error) { | ||
console.log(error); | ||
reject(error); | ||
}); | ||
resolve({ src: null, alt: null }); | ||
} | ||
if (showLog) { | ||
// @ts-ignore | ||
var label = screenfull.isFullscreen ? 'enabled' : 'disabled'; | ||
console.log("Fullscreen " + label); | ||
} | ||
resolve({ src: menuButton.src, alt: menuButton.alt }); | ||
} | ||
else { | ||
resolve({ src: null, alt: null }); | ||
} | ||
}); | ||
}; | ||
export var hasFullscreen = function () { | ||
return screenfull.isEnabled; | ||
}; | ||
/** | ||
* Version | ||
*/ | ||
export var isIE = function () { | ||
var ua = window.navigator.userAgent; | ||
var msie = ua.indexOf('MSIE '); | ||
return msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\./); | ||
}; | ||
export var isBeforeIE11 = function () { | ||
return navigator.appVersion.indexOf('MSIE 10') !== -1; | ||
}; | ||
}); | ||
}; | ||
BrowserFullScreen.available = function () { | ||
return screenfull.isEnabled; | ||
}; | ||
return BrowserFullScreen; | ||
}()); | ||
export { BrowserFullScreen }; | ||
var BrowserVersion = /** @class */ (function () { | ||
function BrowserVersion() { | ||
} | ||
BrowserVersion.isIE = function () { | ||
var ua = window.navigator.userAgent; | ||
var msie = ua.indexOf('MSIE '); | ||
return msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\./); | ||
}; | ||
BrowserVersion.isBeforeIE11 = function () { | ||
return navigator.appVersion.indexOf('MSIE 10') !== -1; | ||
}; | ||
return BrowserVersion; | ||
}()); | ||
export { BrowserVersion }; | ||
module.exports = { BrowserFullScreen: BrowserFullScreen, BrowserVersion: BrowserVersion }; | ||
//# sourceMappingURL=core-services-browser.service.js.map |
@@ -1,12 +0,16 @@ | ||
import 'node_modules/jquery-ui-dist/jquery-ui.min'; | ||
import { IComboBoxData } from './core-services-combobox.interface'; | ||
/** | ||
* This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
export declare const initialize: (combobox: HTMLSelectElement, callback: any, invalidCallback: any) => void; | ||
export declare const loadData: (combobox: HTMLSelectElement, data: IComboBoxData[], keepValue: boolean) => Promise<unknown>; | ||
export declare const dataByValue: (arrayData: IComboBoxData[], value: string) => string; | ||
export declare const disableInput: (combobox: HTMLSelectElement, disable: boolean) => void; | ||
export declare class ComboBoxCore { | ||
/** This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
static initialize(combobox: HTMLSelectElement, callback: any, invalidCallback: any): void; | ||
static loadData(combobox: HTMLSelectElement, data: IComboBoxData[], keepValue: boolean): PromiseLike<HTMLSelectElement | null>; | ||
} | ||
export declare class ComboBoxData { | ||
static byValue(arrayData: IComboBoxData[], value: string): string; | ||
} | ||
export declare class ComboBoxDom { | ||
static disableInput(combobox: HTMLSelectElement, disable: boolean): void; | ||
} |
import * as $ from 'jquery'; | ||
import 'node_modules/jquery-ui-dist/jquery-ui.min'; | ||
import { removeChildElements } from '../elements/core-services-elements.service'; | ||
/** | ||
* This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
export var initialize = function (combobox, callback, invalidCallback) { | ||
$.widget('custom.combobox', { | ||
_create: function () { | ||
// @ts-ignore | ||
this.wrapper = $('<span>') | ||
.addClass('custom-combobox') | ||
.insertAfter(this.element); | ||
this.element.hide(); | ||
this._createAutocomplete(); | ||
this._createShowAllButton(); | ||
// @ts-ignore | ||
this.input.attr('placeholder', this.element.attr('placeholder')); | ||
// @ts-ignore | ||
this.input.focus().blur(); | ||
}, | ||
_createAutocomplete: function () { | ||
var selected = this.element.children(':selected'); | ||
var value = selected.val() ? selected.text() : ''; | ||
// @ts-ignore | ||
this.input = $('<input>') | ||
// import 'jquery-ui-dist'; | ||
// import '../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
import { Remove } from '../elements/core-services-elements.service'; | ||
var ComboBoxCore = /** @class */ (function () { | ||
function ComboBoxCore() { | ||
} | ||
/** This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
ComboBoxCore.initialize = function (combobox, callback, invalidCallback) { | ||
$.widget('custom.combobox', { | ||
_create: function () { | ||
// @ts-ignore | ||
.appendTo(this.wrapper) | ||
.val(value) | ||
.attr('title', '') | ||
.addClass("custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left " + this.element.attr('class')) | ||
.autocomplete({ | ||
delay: 0, | ||
minLength: 0, | ||
this.wrapper = $('<span>') | ||
.addClass('custom-combobox') | ||
.insertAfter(this.element); | ||
this.element.hide(); | ||
this._createAutocomplete(); | ||
this._createShowAllButton(); | ||
// @ts-ignore | ||
maxShowItems: 5, | ||
source: $.proxy(this, '_source') | ||
}) | ||
.tooltip({ | ||
classes: { 'ui-tooltip': 'ui-state-highlight' } | ||
}); | ||
// noinspection JSDeprecatedSymbols | ||
// @ts-ignore | ||
this.input.focus().blur(); | ||
// @ts-ignore | ||
// noinspection SpellCheckingInspection | ||
this._on(this.input, { | ||
autocompleteselect: function (event, ui) { | ||
ui.item.option.selected = true; | ||
// Get the value: ui.item.option.value | ||
// Get the text: ui.item.value | ||
callback(ui.item.option.value, ui.item.value); | ||
this._trigger('select', event, { | ||
item: ui.item.option | ||
}); | ||
}, | ||
disable: function () { | ||
this._disable(); | ||
}, | ||
enable: function () { | ||
this._enable(); | ||
}, | ||
autocompletechange: '_removeIfInvalid' | ||
}); | ||
}, | ||
_createShowAllButton: function () { | ||
// @ts-ignore | ||
var input = this.input; | ||
var wasOpen = false; | ||
$('<a>') | ||
.attr('tabIndex', -1) | ||
.attr('title', 'Mostrar todos os itens') | ||
.tooltip() | ||
this.input.attr('placeholder', this.element.attr('placeholder')); | ||
// @ts-ignore | ||
.appendTo(this.wrapper) | ||
.button({ | ||
icons: { | ||
primary: 'ui-icon-triangle-1-s' | ||
}, | ||
text: false | ||
}) | ||
.removeClass('ui-corner-all') | ||
.on('mousedown', function () { | ||
wasOpen = input.autocomplete('widget').is(':visible'); | ||
}) | ||
.on('click', function () { | ||
wasOpen = input.autocomplete('widget').is(':visible'); | ||
input.trigger('focus'); | ||
// Close if already visible | ||
if (wasOpen) { | ||
this.input.focus().blur(); | ||
}, | ||
_createAutocomplete: function () { | ||
var selected = this.element.children(':selected'); | ||
var value = selected.val() ? selected.text() : ''; | ||
// @ts-ignore | ||
this.input = $('<input>') | ||
// @ts-ignore | ||
.appendTo(this.wrapper) | ||
.val(value) | ||
.attr('title', '') | ||
.addClass("custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left " + this.element.attr('class')) | ||
.autocomplete({ | ||
delay: 0, | ||
minLength: 0, | ||
// @ts-ignore | ||
maxShowItems: 5, | ||
source: $.proxy(this, '_source') | ||
}) | ||
.tooltip({ | ||
classes: { 'ui-tooltip': 'ui-state-highlight' } | ||
}); | ||
// @ts-ignore | ||
this.input.focus().blur(); | ||
// @ts-ignore | ||
// noinspection SpellCheckingInspection | ||
this._on(this.input, { | ||
autocompleteselect: function (event, ui) { | ||
ui.item.option.selected = true; | ||
// Get the value: ui.item.option.value | ||
// Get the text: ui.item.value | ||
callback(ui.item.option.value, ui.item.value); | ||
this._trigger('select', event, { | ||
item: ui.item.option | ||
}); | ||
}, | ||
disable: function () { | ||
this._disable(); | ||
}, | ||
enable: function () { | ||
this._enable(); | ||
}, | ||
autocompletechange: '_removeIfInvalid' | ||
}); | ||
}, | ||
_createShowAllButton: function () { | ||
// @ts-ignore | ||
var input = this.input; | ||
var wasOpen = false; | ||
$('<a>') | ||
.attr('tabIndex', -1) | ||
.attr('title', 'Mostrar todos os itens') | ||
.tooltip() | ||
// @ts-ignore | ||
.appendTo(this.wrapper) | ||
.button({ | ||
icons: { | ||
primary: 'ui-icon-triangle-1-s' | ||
}, | ||
text: false | ||
}) | ||
.removeClass('ui-corner-all') | ||
.on('mousedown', function () { | ||
wasOpen = input.autocomplete('widget').is(':visible'); | ||
}) | ||
.on('click', function () { | ||
wasOpen = input.autocomplete('widget').is(':visible'); | ||
input.trigger('focus'); | ||
if (wasOpen) { | ||
return; | ||
} | ||
// Pass empty string as value to search for, displaying all results | ||
input.autocomplete('search', ''); | ||
}); | ||
}, | ||
_source: function (request, response) { | ||
var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), 'i'); | ||
response(this.element.children('option').map(function () { | ||
var text = $(this).text(); | ||
// @ts-ignore | ||
if (this.value && (!request.term || matcher.test(text))) { | ||
return { | ||
label: text, | ||
value: text, | ||
option: this | ||
}; | ||
} | ||
else { | ||
return null; | ||
} | ||
})); | ||
}, | ||
_removeIfInvalid: function (event, ui) { | ||
// Selected an item, nothing to do | ||
if (ui.item) { | ||
return; | ||
} | ||
// Pass empty string as value to search for, displaying all results | ||
input.autocomplete('search', ''); | ||
}); | ||
}, | ||
_source: function (request, response) { | ||
// noinspection TypeScriptValidateJSTypes | ||
var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), 'i'); | ||
// noinspection TypeScriptValidateJSTypes | ||
response(this.element.children('option').map(function () { | ||
// Search for a match (case-insensitive) | ||
// @ts-ignore | ||
var text = $(this).text(); | ||
// @ts-ignore | ||
if (this.value && (!request.term || matcher.test(text))) { | ||
return { | ||
label: text, | ||
value: text, | ||
var value = this.input.val(); | ||
var valueLowerCase = value.toLowerCase(); | ||
var valid = false; | ||
this.element.children('option').each(function () { | ||
if ($(this).text().toLowerCase() === valueLowerCase) { | ||
// @ts-ignore | ||
option: this | ||
}; | ||
} | ||
else { | ||
return null; | ||
} | ||
})); | ||
}, | ||
_removeIfInvalid: function (event, ui) { | ||
// Selected an item, nothing to do | ||
if (ui.item) { | ||
return; | ||
} | ||
// Search for a match (case-insensitive) | ||
// @ts-ignore | ||
var value = this.input.val(); | ||
var valueLowerCase = value.toLowerCase(); | ||
var valid = false; | ||
this.element.children('option').each(function () { | ||
if ($(this).text().toLowerCase() === valueLowerCase) { | ||
this.selected = valid = true; | ||
return false; | ||
} | ||
}); | ||
// Found a match, nothing to do | ||
if (valid) { | ||
// Get the value: this.element.val() | ||
// Get the text: this.input.val() | ||
// @ts-ignore | ||
this.selected = valid = true; | ||
return false; | ||
callback(this.element.val(), this.input.val()); | ||
return; | ||
} | ||
}); | ||
// Found a match, nothing to do | ||
if (valid) { | ||
// Get the value: this.element.val() | ||
// Get the text: this.input.val() | ||
// Remove invalid value | ||
// noinspection TypeScriptValidateJSTypes | ||
// @ts-ignore | ||
callback(this.element.val(), this.input.val()); | ||
return; | ||
} | ||
// Remove invalid value | ||
// noinspection TypeScriptValidateJSTypes | ||
// @ts-ignore | ||
this.input | ||
.val('') | ||
.attr('title', "O valor " + value + " n\u00E3o existe para este item!") | ||
.tooltip('open'); | ||
this.element.val(''); | ||
// @ts-ignore | ||
this._delay(function () { | ||
this.input | ||
.val('') | ||
.attr('title', "O valor " + value + " n\u00E3o existe para este item!") | ||
.tooltip('open'); | ||
this.element.val(''); | ||
// @ts-ignore | ||
this.input.tooltip('close').attr('title', ''); | ||
}, 2500); | ||
// @ts-ignore | ||
this.input.autocomplete('instance').term = ''; | ||
// @ts-ignore | ||
invalidCallback(this.element.val(), this.input.val()); | ||
}, | ||
_destroy: function () { | ||
// @ts-ignore | ||
this.wrapper.remove(); | ||
this.element.show(); | ||
} | ||
}); | ||
// @ts-ignore | ||
$(combobox).combobox(); | ||
}; | ||
export var loadData = function (combobox, data, keepValue) { | ||
return new Promise(function (resolve) { | ||
var parent = combobox.parentNode; | ||
if (parent != null) { | ||
var comboboxInput = parent.querySelector('input.custom-combobox-input'); | ||
removeChildElements(combobox); | ||
if (!keepValue) { | ||
combobox.value = ''; | ||
comboboxInput.value = ''; | ||
this._delay(function () { | ||
// @ts-ignore | ||
this.input.tooltip('close').attr('title', ''); | ||
}, 2500); | ||
// @ts-ignore | ||
this.input.autocomplete('instance').term = ''; | ||
// @ts-ignore | ||
invalidCallback(this.element.val(), this.input.val()); | ||
}, | ||
_destroy: function () { | ||
// @ts-ignore | ||
this.wrapper.remove(); | ||
this.element.show(); | ||
} | ||
var emptyOption = document.createElement('option'); | ||
emptyOption.value = ''; | ||
combobox.appendChild(emptyOption); | ||
data.forEach(function (d) { | ||
var option = document.createElement('option'); | ||
option.value = d.value; | ||
option.innerText = d.text; | ||
combobox.appendChild(option); | ||
}); | ||
resolve(combobox); | ||
}); | ||
// @ts-ignore | ||
$(combobox).combobox(); | ||
}; | ||
ComboBoxCore.loadData = function (combobox, data, keepValue) { | ||
return new Promise(function (resolve) { | ||
var parent = combobox.parentNode; | ||
if (parent != null) { | ||
var comboboxInput = parent.querySelector('input.custom-combobox-input'); | ||
Remove.childElements(combobox); | ||
if (!keepValue) { | ||
combobox.value = ''; | ||
comboboxInput.value = ''; | ||
} | ||
var emptyOption = document.createElement('option'); | ||
emptyOption.value = ''; | ||
combobox.appendChild(emptyOption); | ||
data.forEach(function (d) { | ||
var option = document.createElement('option'); | ||
option.value = d.value; | ||
option.innerText = d.text; | ||
combobox.appendChild(option); | ||
}); | ||
resolve(combobox); | ||
} | ||
else { | ||
console.error('Parent of current combobox is null'); | ||
resolve(null); | ||
} | ||
}); | ||
}; | ||
return ComboBoxCore; | ||
}()); | ||
export { ComboBoxCore }; | ||
var ComboBoxData = /** @class */ (function () { | ||
function ComboBoxData() { | ||
} | ||
ComboBoxData.byValue = function (arrayData, value) { | ||
var tempActionPlan = arrayData.filter(function (x) { return x.value === value; }); | ||
if (value == null || tempActionPlan.length === 0) { | ||
return ''; | ||
} | ||
else { | ||
console.error('Parent of current combobox is null'); | ||
resolve(null); | ||
return tempActionPlan[0].text; | ||
} | ||
}); | ||
}; | ||
export var dataByValue = function (arrayData, value) { | ||
var tempActionPlan = arrayData.filter(function (x) { return x.value === value; }); | ||
if (value == null || tempActionPlan.length === 0) { | ||
return ''; | ||
}; | ||
return ComboBoxData; | ||
}()); | ||
export { ComboBoxData }; | ||
var ComboBoxDom = /** @class */ (function () { | ||
function ComboBoxDom() { | ||
} | ||
else { | ||
return tempActionPlan[0].text; | ||
} | ||
}; | ||
export var disableInput = function (combobox, disable) { | ||
var parent = combobox.parentNode; | ||
var input = parent.querySelector('input'); | ||
if (input == null) { | ||
console.error("Input not found on current combobox group: " + parent); | ||
} | ||
else { | ||
if (disable) { | ||
input.disabled = true; // this disables just the popup menu (widget), | ||
input.classList.add('ui-autocomplete-disabled'); | ||
input.classList.add('ui-state-disabled'); | ||
input.setAttribute('tabIndex', '-1'); | ||
input.setAttribute('aria-disabled', 'true'); | ||
ComboBoxDom.disableInput = function (combobox, disable) { | ||
var parent = combobox.parentNode; | ||
var input = parent.querySelector('input'); | ||
if (input == null) { | ||
console.error("Input not found on current combobox group: " + parent); | ||
} | ||
else { | ||
input.disabled = false; | ||
input.classList.remove('ui-state-disabled'); | ||
input.classList.remove('ui-autocomplete-disabled'); | ||
input.removeAttribute('tabIndex'); | ||
input.setAttribute('aria-disabled', 'false'); | ||
if (disable) { | ||
input.disabled = true; // this disables just the popup menu (widget), | ||
input.classList.add('ui-autocomplete-disabled'); | ||
input.classList.add('ui-state-disabled'); | ||
input.setAttribute('tabIndex', '-1'); | ||
input.setAttribute('aria-disabled', 'true'); | ||
} | ||
else { | ||
input.disabled = false; | ||
input.classList.remove('ui-state-disabled'); | ||
input.classList.remove('ui-autocomplete-disabled'); | ||
input.removeAttribute('tabIndex'); | ||
input.setAttribute('aria-disabled', 'false'); | ||
} | ||
} | ||
} | ||
}; | ||
}; | ||
return ComboBoxDom; | ||
}()); | ||
export { ComboBoxDom }; | ||
module.exports = { ComboBoxCore: ComboBoxCore, ComboBoxData: ComboBoxData, ComboBoxDom: ComboBoxDom }; | ||
//# sourceMappingURL=core-services-combobox.service.js.map |
@@ -1,47 +0,44 @@ | ||
import 'node_modules/jquery-ui-dist/jquery-ui.min'; | ||
import * as moment from 'moment'; | ||
import { IDateLocal, IDayMonthYear, IDaysOfMonth, IWeeksOfMonth } from './core-services-date.interface'; | ||
/** | ||
* Date Get data | ||
*/ | ||
export declare const customDate: (date: moment.MomentInput, format: string) => string; | ||
export declare const currentDate: (outputFormat?: string) => string; | ||
export declare const dayMonthYear: (date: moment.MomentInput, format?: string) => IDayMonthYear; | ||
export declare const localDate: (year: number, month: number, day: number, local?: IDateLocal) => string; | ||
export declare const dateFromIso: (date: moment.MomentInput, format?: string) => string; | ||
export declare const ganttDate: (date: moment.MomentInput) => Date; | ||
export declare const isoDateCustom: (date: moment.MomentInput, dateFormat: string, outputFormat: string) => string; | ||
export declare const isoDate: (date: moment.MomentInput, format?: string) => string; | ||
export declare const isoDateWithoutTime: (date: moment.MomentInput) => string; | ||
export declare const dateMilliseconds: (date: moment.MomentInput, dateFormat: string, outputFormat: string) => number; | ||
export declare const dateToMillisecondsNoTime: (date: moment.MomentInput) => number; | ||
export declare const millisecondsToDate: (date: moment.MomentInput, outputFormat: string) => string; | ||
export declare const daysToMilliseconds: (days: number) => number; | ||
export declare const durationInDays: (start: number, end: number, countFirstDay: boolean) => number; | ||
export declare const durationInMilliseconds: (start: number, end: number) => number; | ||
export declare const monthName: (month: number, language?: string) => string; | ||
export declare const weeksOfMonth: (year: number, month: number) => IWeeksOfMonth[]; | ||
export declare const daysOfMonth: (weeksRange: IWeeksOfMonth[]) => IDaysOfMonth[][]; | ||
export declare const weekOfYear: (date: string, format: string) => number; | ||
/** | ||
* Date comparable | ||
*/ | ||
export declare const isDateBefore: (startDate: string, endDate: string, type?: moment.unitOfTime.StartOf) => boolean; | ||
/** | ||
* Date validation | ||
*/ | ||
export declare const validateDate: (date: moment.MomentInput) => boolean; | ||
/** | ||
* Date picker utilities; | ||
* Jquery ui | ||
* This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
export declare const setDatePicker: (datePicker: HTMLInputElement, dateFormat: string) => void; | ||
export declare const monthYearDatePicker: (datePicker: HTMLInputElement, dateFormat: string, setValueCallback: any) => void; | ||
export declare const dateFromDatePicker: (date: moment.MomentInput, format?: string, outputFormat?: string) => string; | ||
export declare const localDateForDatePicker: (date: moment.MomentInput, outputFormat?: string) => string; | ||
export declare const currentDateForDatePicker: (dateFormat?: string, outputFormat?: string) => string; | ||
export declare const dateForDatePicker: (month: number, day: number, year: number) => string; | ||
import { IDate, IDateLocal, IDayMonthYear, IDaysOfMonth, IUnityOfTime, IWeeksOfMonth } from './core-services-date.interface'; | ||
export declare class DateGet { | ||
static customDate(date: IDate, format: string): string; | ||
static currentDate(outputFormat?: string): string; | ||
static dayMonthYear(date: IDate, format?: string): IDayMonthYear; | ||
static localDate(year: number, month: number, day: number, local?: IDateLocal): string; | ||
static dateFromIso(date: IDate, format?: string): string; | ||
static ganttDate(date: IDate): Date; | ||
static isoDateCustom(date: IDate, dateFormat: string, outputFormat: string): string; | ||
static isoDate(date: IDate, format?: string): string; | ||
static isoDateWithoutTime(date: IDate): string; | ||
static dateMilliseconds(date: IDate, dateFormat: string, outputFormat: string): number; | ||
static dateToMillisecondsNoTime(date: IDate): number; | ||
static millisecondsToDate(date: IDate, outputFormat: string): string; | ||
static daysToMilliseconds(days: number): number; | ||
static durationInDays(start: number, end: number, countFirstDay: boolean): number; | ||
static durationInMilliseconds(start: number, end: number): number; | ||
static monthName(month: number, language?: string): string; | ||
static weeksOfMonth(year: number, month: number): IWeeksOfMonth[]; | ||
static daysOfMonth(weeksRange: IWeeksOfMonth[]): IDaysOfMonth[][]; | ||
static weekOfYear(date: string, format: string): number; | ||
} | ||
export declare class DateComparable { | ||
static isDateBefore(startDate: string, endDate: string, type?: IUnityOfTime): boolean; | ||
} | ||
export declare class DateValidation { | ||
static date(date: IDate): boolean; | ||
} | ||
export declare class DatePicker { | ||
/** | ||
* Date picker utilities; | ||
* Jquery ui | ||
* This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
static setDatePicker(datePicker: HTMLInputElement, dateFormat: string): void; | ||
static monthYearDatePicker(datePicker: HTMLInputElement, dateFormat: string, setValueCallback: any): void; | ||
static dateFromDatePicker(date: IDate, format?: string, outputFormat?: string): string; | ||
static localDateForDatePicker(date: IDate, outputFormat?: string): string; | ||
static currentDateForDatePicker(dateFormat?: string, outputFormat?: string): string; | ||
static dateForDatePicker(month: number, day: number, year: number): string; | ||
} |
@@ -29,309 +29,324 @@ var __values = (this && this.__values) || function(o) { | ||
import * as $ from 'jquery'; | ||
import 'node_modules/jquery-ui-dist/jquery-ui.min'; | ||
import * as moment from 'moment'; | ||
import { extendMoment } from 'moment-range'; | ||
import { numberToString } from '../string/core-services-string.service'; | ||
/** | ||
* Date Get data | ||
*/ | ||
export var customDate = function (date, format) { | ||
return moment(date).format(format); | ||
}; | ||
export var currentDate = function (outputFormat) { | ||
if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
return moment.utc(new Date(), outputFormat).local().format(outputFormat); | ||
}; | ||
export var dayMonthYear = function (date, format) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
var x = moment(date, format, true).format(format); | ||
var d = parseInt(x.split('/')[0], 10); | ||
var m = parseInt(x.split('/')[1], 10) - 1; | ||
var y = parseInt(x.split('/')[2], 10); | ||
return { day: d, month: m, year: y }; | ||
}; | ||
export var localDate = function (year, month, day, local) { | ||
if (local === void 0) { local = 'pt-BR'; } | ||
var options = { year: 'numeric', month: 'numeric', day: 'numeric' }; | ||
return new Date(year, month, day).toLocaleDateString(local, options); | ||
}; | ||
export var dateFromIso = function (date, format) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
return moment.utc(date).format(format); | ||
}; | ||
export var ganttDate = function (date) { | ||
var splitDate = dayMonthYear(date); | ||
return new Date(splitDate.year, splitDate.month, splitDate.day); | ||
}; | ||
export var isoDateCustom = function (date, dateFormat, outputFormat) { | ||
var splitDate = dayMonthYear(date); | ||
return new Date(splitDate.year, splitDate.month, splitDate.day).toISOString(); | ||
}; | ||
export var isoDate = function (date, format) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
return moment.utc(date, format).format(format); | ||
}; | ||
export var isoDateWithoutTime = function (date) { | ||
var splitDate = dayMonthYear(date); | ||
return moment.utc(new Date(splitDate.year, splitDate.month, splitDate.day)).toISOString(); | ||
}; | ||
export var dateMilliseconds = function (date, dateFormat, outputFormat) { | ||
return +moment(isoDateCustom(date, dateFormat, outputFormat), dateFormat).format('x'); | ||
}; | ||
export var dateToMillisecondsNoTime = function (date) { | ||
return +moment(isoDateWithoutTime(date)).format('x'); | ||
}; | ||
export var millisecondsToDate = function (date, outputFormat) { | ||
return moment.utc(date, 'x').format(outputFormat); | ||
}; | ||
export var daysToMilliseconds = function (days) { | ||
return days * 24 * 60 * 60 * 1000; | ||
}; | ||
export var durationInDays = function (start, end, countFirstDay) { | ||
var s = dayMonthYear(start); | ||
var e = dayMonthYear(end); | ||
var startDate = moment([s.year, s.month, s.day]); | ||
var endDate = moment([e.year, e.month, e.day]); | ||
var difference = endDate.diff(startDate, 'days'); | ||
var additional = countFirstDay ? 1 : 0; | ||
return difference + additional; | ||
}; | ||
export var durationInMilliseconds = function (start, end) { | ||
return daysToMilliseconds(durationInDays(start, end, false)); | ||
}; | ||
export var monthName = function (month, language) { | ||
if (language === void 0) { language = 'pt-br'; } | ||
if (language === 'pt-br' || language === 'pt-pt' || language === 'pt') { | ||
switch (month) { | ||
case 0: return 'Janeiro'; | ||
case 1: return 'Fevereiro'; | ||
case 2: return 'Março'; | ||
case 3: return 'Abril'; | ||
case 4: return 'Maio'; | ||
case 5: return 'Junho'; | ||
case 6: return 'Julho'; | ||
case 7: return 'Agosto'; | ||
case 8: return 'Setembro'; | ||
case 9: return 'Outubro'; | ||
case 10: return 'Novembro'; | ||
case 11: return 'Dezembro'; | ||
default: return ''; | ||
} | ||
import { StringConverter } from '../string/core-services-string.service'; | ||
var DateGet = /** @class */ (function () { | ||
function DateGet() { | ||
} | ||
else { | ||
switch (month) { | ||
case 0: return 'January'; | ||
case 1: return 'February'; | ||
case 2: return 'March'; | ||
case 3: return 'April'; | ||
case 4: return 'May'; | ||
case 5: return 'June'; | ||
case 6: return 'July'; | ||
case 7: return 'August'; | ||
case 8: return 'September'; | ||
case 9: return 'October'; | ||
case 10: return 'November'; | ||
case 11: return 'December'; | ||
default: return ''; | ||
DateGet.customDate = function (date, format) { | ||
return moment(date).format(format); | ||
}; | ||
DateGet.currentDate = function (outputFormat) { | ||
if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
return moment.utc(new Date(), outputFormat).local().format(outputFormat); | ||
}; | ||
DateGet.dayMonthYear = function (date, format) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
var x = moment(date, format, true).format(format); | ||
var d = parseInt(x.split('/')[0], 10); | ||
var m = parseInt(x.split('/')[1], 10) - 1; | ||
var y = parseInt(x.split('/')[2], 10); | ||
return { day: d, month: m, year: y }; | ||
}; | ||
DateGet.localDate = function (year, month, day, local) { | ||
if (local === void 0) { local = 'pt-BR'; } | ||
var options = { year: 'numeric', month: 'numeric', day: 'numeric' }; | ||
return new Date(year, month, day).toLocaleDateString(local, options); | ||
}; | ||
DateGet.dateFromIso = function (date, format) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
return moment.utc(date).format(format); | ||
}; | ||
DateGet.ganttDate = function (date) { | ||
var splitDate = this.dayMonthYear(date); | ||
return new Date(splitDate.year, splitDate.month, splitDate.day); | ||
}; | ||
DateGet.isoDateCustom = function (date, dateFormat, outputFormat) { | ||
var splitDate = this.dayMonthYear(date); | ||
return new Date(splitDate.year, splitDate.month, splitDate.day).toISOString(); | ||
}; | ||
DateGet.isoDate = function (date, format) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
return moment.utc(date, format).format(format); | ||
}; | ||
DateGet.isoDateWithoutTime = function (date) { | ||
var splitDate = this.dayMonthYear(date); | ||
return moment.utc(new Date(splitDate.year, splitDate.month, splitDate.day)).toISOString(); | ||
}; | ||
DateGet.dateMilliseconds = function (date, dateFormat, outputFormat) { | ||
return +moment(this.isoDateCustom(date, dateFormat, outputFormat), dateFormat).format('x'); | ||
}; | ||
DateGet.dateToMillisecondsNoTime = function (date) { | ||
return +moment(this.isoDateWithoutTime(date)).format('x'); | ||
}; | ||
DateGet.millisecondsToDate = function (date, outputFormat) { | ||
return moment.utc(date, 'x').format(outputFormat); | ||
}; | ||
DateGet.daysToMilliseconds = function (days) { | ||
return days * 24 * 60 * 60 * 1000; | ||
}; | ||
DateGet.durationInDays = function (start, end, countFirstDay) { | ||
var s = this.dayMonthYear(start); | ||
var e = this.dayMonthYear(end); | ||
var startDate = moment([s.year, s.month, s.day]); | ||
var endDate = moment([e.year, e.month, e.day]); | ||
var difference = endDate.diff(startDate, 'days'); | ||
var additional = countFirstDay ? 1 : 0; | ||
return difference + additional; | ||
}; | ||
DateGet.durationInMilliseconds = function (start, end) { | ||
return this.daysToMilliseconds(this.durationInDays(start, end, false)); | ||
}; | ||
DateGet.monthName = function (month, language) { | ||
if (language === void 0) { language = 'pt-br'; } | ||
if (language === 'pt-br' || language === 'pt-pt' || language === 'pt') { | ||
switch (month) { | ||
case 0: return 'Janeiro'; | ||
case 1: return 'Fevereiro'; | ||
case 2: return 'Março'; | ||
case 3: return 'Abril'; | ||
case 4: return 'Maio'; | ||
case 5: return 'Junho'; | ||
case 6: return 'Julho'; | ||
case 7: return 'Agosto'; | ||
case 8: return 'Setembro'; | ||
case 9: return 'Outubro'; | ||
case 10: return 'Novembro'; | ||
case 11: return 'Dezembro'; | ||
default: return ''; | ||
} | ||
} | ||
} | ||
}; | ||
export var weeksOfMonth = function (year, month) { | ||
var e_1, _a, e_2, _b; | ||
// @js-ignore | ||
var _moment = extendMoment(moment); | ||
// Year and month are variables | ||
var startDate = moment([year, month]); | ||
// Get the first and last day of the month | ||
var firstDay = moment(startDate).startOf('month'); | ||
var endDay = moment(startDate).endOf('month'); | ||
// Create a range for the month we can iterate through | ||
var monthRange = _moment.range(firstDay, endDay); | ||
// Get all the weeks during the current month | ||
var weeks = []; | ||
var _loop_1 = function (range) { | ||
var contain = weeks.filter(function (x) { return x === range.week(); }).length > 0; | ||
if (!contain) { | ||
weeks.push(range.week()); | ||
else { | ||
switch (month) { | ||
case 0: return 'January'; | ||
case 1: return 'February'; | ||
case 2: return 'March'; | ||
case 3: return 'April'; | ||
case 4: return 'May'; | ||
case 5: return 'June'; | ||
case 6: return 'July'; | ||
case 7: return 'August'; | ||
case 8: return 'September'; | ||
case 9: return 'October'; | ||
case 10: return 'November'; | ||
case 11: return 'December'; | ||
default: return ''; | ||
} | ||
} | ||
}; | ||
try { | ||
for (var _c = __values(monthRange.by('days')), _d = _c.next(); !_d.done; _d = _c.next()) { | ||
var range = _d.value; | ||
_loop_1(range); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
DateGet.weeksOfMonth = function (year, month) { | ||
var e_1, _a, e_2, _b; | ||
// @js-ignore | ||
var _moment = extendMoment(moment); | ||
// Year and month are variables | ||
var startDate = moment([year, month]); | ||
// Get the first and last day of the month | ||
var firstDay = moment(startDate).startOf('month'); | ||
var endDay = moment(startDate).endOf('month'); | ||
// Create a range for the month we can iterate through | ||
var monthRange = _moment.range(firstDay, endDay); | ||
// Get all the weeks during the current month | ||
var weeks = []; | ||
var _loop_1 = function (range) { | ||
var contain = weeks.filter(function (x) { return x === range.week(); }).length > 0; | ||
if (!contain) { | ||
weeks.push(range.week()); | ||
} | ||
}; | ||
try { | ||
if (_d && !_d.done && (_a = _c.return)) _a.call(_c); | ||
for (var _c = __values(monthRange.by('days')), _d = _c.next(); !_d.done; _d = _c.next()) { | ||
var range = _d.value; | ||
_loop_1(range); | ||
} | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
// Create a range for each week | ||
var calendar = []; | ||
try { | ||
for (var weeks_1 = __values(weeks), weeks_1_1 = weeks_1.next(); !weeks_1_1.done; weeks_1_1 = weeks_1.next()) { | ||
var week = weeks_1_1.value; | ||
// Create a range for that week between 1st and 7th day | ||
var firstWeekDay = void 0; | ||
var lastWeekDay = void 0; | ||
var weekRange = void 0; | ||
if (month === 11 && week === 1) { | ||
firstWeekDay = moment(year + 1, 'YYYY').week(week).day(0).isAfter(firstDay) ? moment(year + 1, 'YYYY').week(week).day(0) : firstDay; | ||
lastWeekDay = moment(year + 1, 'YYYY').week(week).day(6).isBefore(endDay) ? moment(year + 1, 'YYYY').week(week).day(6) : endDay; | ||
weekRange = _moment.range(firstWeekDay, lastWeekDay); | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (_d && !_d.done && (_a = _c.return)) _a.call(_c); | ||
} | ||
else { | ||
firstWeekDay = moment().week(week).day(0).isAfter(firstDay) ? moment().week(week).day(0) : firstDay; | ||
lastWeekDay = moment().week(week).day(6).isBefore(endDay) ? moment().week(week).day(6) : endDay; | ||
weekRange = _moment.range(firstWeekDay, lastWeekDay); | ||
} | ||
// Add to the calendar | ||
calendar.push({ | ||
week: week, | ||
start: moment(weekRange.start.toISOString()).format('DD/MM/YYYY'), | ||
startDay: moment(weekRange.start.toISOString()).format('DD'), | ||
startMonth: moment(weekRange.start.toISOString()).format('MM'), | ||
startYear: moment(weekRange.start.toISOString()).format('YYYY'), | ||
end: moment(weekRange.end.toISOString()).format('DD/MM/YYYY'), | ||
endDay: moment(weekRange.end.toISOString()).format('DD'), | ||
endMonth: moment(weekRange.end.toISOString()).format('MM'), | ||
endYear: moment(weekRange.end.toISOString()).format('YYYY') | ||
}); | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
// Create a range for each week | ||
var calendar = []; | ||
try { | ||
if (weeks_1_1 && !weeks_1_1.done && (_b = weeks_1.return)) _b.call(weeks_1); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
return calendar; | ||
}; | ||
export var daysOfMonth = function (weeksRange) { | ||
var e_3, _a; | ||
var range = []; | ||
try { | ||
for (var _b = __values(weeksRange.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var _d = __read(_c.value, 2), i = _d[0], week = _d[1]; | ||
var start = parseInt(weeksRange[i].startDay, 10); | ||
var end = parseInt(weeksRange[i].endDay, 10); | ||
var month = weeksRange[i].startMonth; | ||
var year = weeksRange[i].startYear; | ||
var weekDays = []; | ||
for (var j = start; j <= end; j++) { | ||
var day = numberToString(j); | ||
weekDays.push({ | ||
week: week.week, | ||
day: day, | ||
month: "" + month, | ||
year: "" + year, | ||
dayMonth: day + "/" + month, | ||
date: day + "/" + month + "/" + year, | ||
monthYear: month + "/" + year, | ||
for (var weeks_1 = __values(weeks), weeks_1_1 = weeks_1.next(); !weeks_1_1.done; weeks_1_1 = weeks_1.next()) { | ||
var week = weeks_1_1.value; | ||
// Create a range for that week between 1st and 7th day | ||
var firstWeekDay = void 0; | ||
var lastWeekDay = void 0; | ||
var weekRange = void 0; | ||
if (month === 11 && week === 1) { | ||
firstWeekDay = moment(year + 1, 'YYYY').week(week).day(0).isAfter(firstDay) ? moment(year + 1, 'YYYY').week(week).day(0) : firstDay; | ||
lastWeekDay = moment(year + 1, 'YYYY').week(week).day(6).isBefore(endDay) ? moment(year + 1, 'YYYY').week(week).day(6) : endDay; | ||
weekRange = _moment.range(firstWeekDay, lastWeekDay); | ||
} | ||
else { | ||
firstWeekDay = moment().week(week).day(0).isAfter(firstDay) ? moment().week(week).day(0) : firstDay; | ||
lastWeekDay = moment().week(week).day(6).isBefore(endDay) ? moment().week(week).day(6) : endDay; | ||
weekRange = _moment.range(firstWeekDay, lastWeekDay); | ||
} | ||
// Add to the calendar | ||
calendar.push({ | ||
week: week, | ||
start: moment(weekRange.start.toISOString()).format('DD/MM/YYYY'), | ||
startDay: moment(weekRange.start.toISOString()).format('DD'), | ||
startMonth: moment(weekRange.start.toISOString()).format('MM'), | ||
startYear: moment(weekRange.start.toISOString()).format('YYYY'), | ||
end: moment(weekRange.end.toISOString()).format('DD/MM/YYYY'), | ||
endDay: moment(weekRange.end.toISOString()).format('DD'), | ||
endMonth: moment(weekRange.end.toISOString()).format('MM'), | ||
endYear: moment(weekRange.end.toISOString()).format('YYYY') | ||
}); | ||
} | ||
range.push(weekDays); | ||
} | ||
} | ||
catch (e_3_1) { e_3 = { error: e_3_1 }; } | ||
finally { | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (weeks_1_1 && !weeks_1_1.done && (_b = weeks_1.return)) _b.call(weeks_1); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
return calendar; | ||
}; | ||
DateGet.daysOfMonth = function (weeksRange) { | ||
var e_3, _a; | ||
var range = []; | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b); | ||
for (var _b = __values(weeksRange.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var _d = __read(_c.value, 2), i = _d[0], week = _d[1]; | ||
var start = parseInt(weeksRange[i].startDay, 10); | ||
var end = parseInt(weeksRange[i].endDay, 10); | ||
var month = weeksRange[i].startMonth; | ||
var year = weeksRange[i].startYear; | ||
var weekDays = []; | ||
for (var j = start; j <= end; j++) { | ||
var day = StringConverter.numberToString(j); | ||
weekDays.push({ | ||
week: week.week, | ||
day: day, | ||
month: "" + month, | ||
year: "" + year, | ||
dayMonth: day + "/" + month, | ||
date: day + "/" + month + "/" + year, | ||
monthYear: month + "/" + year, | ||
}); | ||
} | ||
range.push(weekDays); | ||
} | ||
} | ||
finally { if (e_3) throw e_3.error; } | ||
catch (e_3_1) { e_3 = { error: e_3_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b); | ||
} | ||
finally { if (e_3) throw e_3.error; } | ||
} | ||
return range; | ||
}; | ||
DateGet.weekOfYear = function (date, format) { | ||
return moment(date, format).week(); | ||
}; | ||
return DateGet; | ||
}()); | ||
export { DateGet }; | ||
var DateComparable = /** @class */ (function () { | ||
function DateComparable() { | ||
} | ||
return range; | ||
}; | ||
export var weekOfYear = function (date, format) { | ||
return moment(date, format).week(); | ||
}; | ||
/** | ||
* Date comparable | ||
*/ | ||
export var isDateBefore = function (startDate, endDate, type) { | ||
if (type === void 0) { type = 'day'; } | ||
return moment(endDate).isBefore(startDate, type); | ||
}; | ||
/** | ||
* Date validation | ||
*/ | ||
export var validateDate = function (date) { | ||
var aDate = moment(date, 'DD/MM/YYYY', true); | ||
return aDate.isValid(); | ||
}; | ||
/** | ||
* Date picker utilities; | ||
* Jquery ui | ||
* This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
export var setDatePicker = function (datePicker, dateFormat) { | ||
$(datePicker).datepicker('option', 'dateFormat', dateFormat); | ||
}; | ||
export var monthYearDatePicker = function (datePicker, dateFormat, setValueCallback) { | ||
$(datePicker).datepicker({ | ||
changeMonth: true, | ||
changeYear: true, | ||
showButtonPanel: true, | ||
dateFormat: dateFormat, | ||
showAnim: 'drop', | ||
showOn: 'button', | ||
buttonImage: 'src/assets/img/icons/calendar.svg', | ||
buttonImageOnly: true, | ||
buttonText: 'Select period', | ||
onClose: function () { | ||
var _month = $('#ui-datepicker-div .ui-datepicker-month :selected').val(); | ||
var _year = $('#ui-datepicker-div .ui-datepicker-year :selected').val(); | ||
DateComparable.isDateBefore = function (startDate, endDate, type) { | ||
if (type === void 0) { type = 'day'; } | ||
return moment(endDate).isBefore(startDate, type); | ||
}; | ||
return DateComparable; | ||
}()); | ||
export { DateComparable }; | ||
var DateValidation = /** @class */ (function () { | ||
function DateValidation() { | ||
} | ||
DateValidation.date = function (date) { | ||
var aDate = moment(date, 'DD/MM/YYYY', true); | ||
return aDate.isValid(); | ||
}; | ||
return DateValidation; | ||
}()); | ||
export { DateValidation }; | ||
var DatePicker = /** @class */ (function () { | ||
function DatePicker() { | ||
} | ||
/** | ||
* Date picker utilities; | ||
* Jquery ui | ||
* This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
DatePicker.setDatePicker = function (datePicker, dateFormat) { | ||
$(datePicker).datepicker('option', 'dateFormat', dateFormat); | ||
}; | ||
DatePicker.monthYearDatePicker = function (datePicker, dateFormat, setValueCallback) { | ||
$(datePicker).datepicker({ | ||
changeMonth: true, | ||
changeYear: true, | ||
showButtonPanel: true, | ||
dateFormat: dateFormat, | ||
showAnim: 'drop', | ||
showOn: 'button', | ||
buttonImage: 'src/assets/img/icons/calendar.svg', | ||
buttonImageOnly: true, | ||
buttonText: 'Select period', | ||
onClose: function () { | ||
var _month = $('#ui-datepicker-div .ui-datepicker-month :selected').val(); | ||
var _year = $('#ui-datepicker-div .ui-datepicker-year :selected').val(); | ||
// @ts-ignore | ||
$(this).datepicker('setDate', new Date(_year, _month, 1)); | ||
setValueCallback(datePicker.value); | ||
setTimeout(function () { | ||
var parentCalendar = document.querySelector('#ui-datepicker-div'); | ||
// @ts-ignore | ||
parentCalendar.classList.remove('only-month-year'); | ||
}, 500); | ||
}, | ||
// @ts-ignore | ||
$(this).datepicker('setDate', new Date(_year, _month, 1)); | ||
setValueCallback(datePicker.value); | ||
setTimeout(function () { | ||
beforeShow: function () { | ||
var parentCalendar = document.querySelector('#ui-datepicker-div'); | ||
// @ts-ignore | ||
parentCalendar.classList.remove('only-month-year'); | ||
}, 500); | ||
}, | ||
// @ts-ignore | ||
beforeShow: function () { | ||
var parentCalendar = document.querySelector('#ui-datepicker-div'); | ||
// @ts-ignore | ||
parentCalendar.classList.add('only-month-year'); | ||
var selDate = $(this).val(); | ||
// @ts-ignore | ||
if (selDate.length > 0) { | ||
parentCalendar.classList.add('only-month-year'); | ||
var selDate = $(this).val(); | ||
// @ts-ignore | ||
var _year = parseInt(selDate.substring(selDate.length - 4, selDate.length), 10); | ||
// @ts-ignore | ||
var _month = parseInt(selDate.substring(0, selDate.length - 5), 10) - 1; | ||
$(this).datepicker('option', 'defaultDate', new Date(_year, _month, 1)); | ||
$(this).datepicker('setDate', new Date(_year, _month, 1)); | ||
console.log(_year); | ||
console.log(_month); | ||
if (selDate.length > 0) { | ||
// @ts-ignore | ||
var _year = parseInt(selDate.substring(selDate.length - 4, selDate.length), 10); | ||
// @ts-ignore | ||
var _month = parseInt(selDate.substring(0, selDate.length - 5), 10) - 1; | ||
$(this).datepicker('option', 'defaultDate', new Date(_year, _month, 1)); | ||
$(this).datepicker('setDate', new Date(_year, _month, 1)); | ||
console.log(_year); | ||
console.log(_month); | ||
} | ||
} | ||
} | ||
}); | ||
}; | ||
export var dateFromDatePicker = function (date, format, outputFormat) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
return moment(date, format).format(outputFormat); | ||
}; | ||
export var localDateForDatePicker = function (date, outputFormat) { | ||
if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
return moment.utc(date, outputFormat).local().format(outputFormat); | ||
}; | ||
export var currentDateForDatePicker = function (dateFormat, outputFormat) { | ||
if (dateFormat === void 0) { dateFormat = 'DD/MM/YYYY'; } | ||
if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
return moment.utc(new Date(), 'DD/MM/YYYY').format(outputFormat); | ||
}; | ||
export var dateForDatePicker = function (month, day, year) { | ||
var x = moment(new Date(year, month, day), 'DD/MM/YYYY', true).toISOString().split('T')[0]; | ||
x = x.split('-')[2] + '/' + x.split('-')[1] + '/' + x.split('-')[0]; | ||
return x; | ||
}; | ||
}); | ||
}; | ||
DatePicker.dateFromDatePicker = function (date, format, outputFormat) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
return moment(date, format).format(outputFormat); | ||
}; | ||
DatePicker.localDateForDatePicker = function (date, outputFormat) { | ||
if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
return moment.utc(date, outputFormat).local().format(outputFormat); | ||
}; | ||
DatePicker.currentDateForDatePicker = function (dateFormat, outputFormat) { | ||
if (dateFormat === void 0) { dateFormat = 'DD/MM/YYYY'; } | ||
if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
return moment.utc(new Date(), 'DD/MM/YYYY').format(outputFormat); | ||
}; | ||
DatePicker.dateForDatePicker = function (month, day, year) { | ||
var x = moment(new Date(year, month, day), 'DD/MM/YYYY', true).toISOString().split('T')[0]; | ||
x = x.split('-')[2] + '/' + x.split('-')[1] + '/' + x.split('-')[0]; | ||
return x; | ||
}; | ||
return DatePicker; | ||
}()); | ||
export { DatePicker }; | ||
module.exports = { DateGet: DateGet, DateComparable: DateComparable, DateValidation: DateValidation, DatePicker: DatePicker }; | ||
//# sourceMappingURL=core-services-date.service.js.map |
@@ -1,4 +0,14 @@ | ||
/** | ||
* Remove | ||
*/ | ||
export declare const removeChildElements: (elementClassId: string | HTMLElement) => void; | ||
import { TFields } from './core-services-elements.interface'; | ||
import { IDate } from '../date/core-services-date.interface'; | ||
export declare class Remove { | ||
static childElements(elementClassId: string | HTMLElement): void; | ||
} | ||
export declare class Selector { | ||
static element(className: string): HTMLElement | null; | ||
} | ||
export declare class Highlight { | ||
static clearError(field: TFields): void; | ||
static error(fieldHighlighted: TFields): void; | ||
static invalidDate(date: IDate, input: HTMLElement): void; | ||
static setError(field: TFields): void; | ||
} |
@@ -1,19 +0,73 @@ | ||
/** | ||
* Remove | ||
*/ | ||
export var removeChildElements = function (elementClassId) { | ||
if (typeof elementClassId === 'string') { | ||
var element = document.querySelector(elementClassId); | ||
if (element != null) { | ||
while (element.firstChild) { | ||
element.removeChild(element.firstChild); | ||
import { DateValidation } from '../date/core-services-date.service'; | ||
var Remove = /** @class */ (function () { | ||
function Remove() { | ||
} | ||
Remove.childElements = function (elementClassId) { | ||
if (typeof elementClassId === 'string') { | ||
var element = document.querySelector(elementClassId); | ||
if (element != null) { | ||
while (element.firstChild) { | ||
element.removeChild(element.firstChild); | ||
} | ||
} | ||
} | ||
else { | ||
while (elementClassId.firstChild) { | ||
elementClassId.removeChild(elementClassId.firstChild); | ||
} | ||
} | ||
}; | ||
return Remove; | ||
}()); | ||
export { Remove }; | ||
var Selector = /** @class */ (function () { | ||
function Selector() { | ||
} | ||
else { | ||
while (elementClassId.firstChild) { | ||
elementClassId.removeChild(elementClassId.firstChild); | ||
Selector.element = function (className) { | ||
return document.querySelector(className); | ||
}; | ||
return Selector; | ||
}()); | ||
export { Selector }; | ||
var Highlight = /** @class */ (function () { | ||
function Highlight() { | ||
} | ||
Highlight.clearError = function (field) { | ||
var _a; | ||
if (typeof (field) === 'object') { | ||
(_a = field) === null || _a === void 0 ? void 0 : _a.classList.remove('required-fill'); | ||
} | ||
} | ||
}; | ||
else { | ||
if (field != null) { | ||
var currentField = document.querySelector(field); | ||
if (currentField != null) { | ||
currentField.classList.remove('required-fill'); | ||
} | ||
} | ||
} | ||
}; | ||
Highlight.error = function (fieldHighlighted) { | ||
if (fieldHighlighted != null) { | ||
fieldHighlighted.classList.add('required-fill'); | ||
fieldHighlighted.focus(); | ||
} | ||
}; | ||
Highlight.invalidDate = function (date, input) { | ||
if (DateValidation.date(date)) { | ||
input.classList.remove('error-highlight'); | ||
} | ||
else { | ||
input.classList.add('error-highlight'); | ||
} | ||
}; | ||
Highlight.setError = function (field) { | ||
if (field != null) { | ||
field.classList.add('required-fill'); | ||
field.focus(); | ||
} | ||
}; | ||
return Highlight; | ||
}()); | ||
export { Highlight }; | ||
module.exports = { Remove: Remove, Selector: Selector, Highlight: Highlight }; | ||
//# sourceMappingURL=core-services-elements.service.js.map |
@@ -1,1 +0,3 @@ | ||
export declare const numberToString: (number: number) => string; | ||
export declare class StringConverter { | ||
static numberToString(number: number): string; | ||
} |
@@ -1,57 +0,64 @@ | ||
export var numberToString = function (number) { | ||
var maxLength = number.toString().length; | ||
if (maxLength < 3) { | ||
if (number < 10) { | ||
return '0' + number; | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
var StringConverter = /** @class */ (function () { | ||
function StringConverter() { | ||
} | ||
else if (maxLength < 4) { | ||
if (number < 10) { | ||
return '00' + number; | ||
StringConverter.numberToString = function (number) { | ||
var maxLength = number.toString().length; | ||
if (maxLength < 3) { | ||
if (number < 10) { | ||
return '0' + number; | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
} | ||
else if (number < 100) { | ||
return '0' + number; | ||
else if (maxLength < 4) { | ||
if (number < 10) { | ||
return '00' + number; | ||
} | ||
else if (number < 100) { | ||
return '0' + number; | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
} | ||
else { | ||
return number.toString(); | ||
else if (maxLength < 5) { | ||
if (number < 10) { | ||
return '000' + number; | ||
} | ||
else if (number < 100) { | ||
return '00' + number; | ||
} | ||
else if (number < 1000) { | ||
return '0' + number; | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
} | ||
} | ||
else if (maxLength < 5) { | ||
if (number < 10) { | ||
return '000' + number; | ||
else if (maxLength < 6) { | ||
if (number < 10) { | ||
return '0000' + number; | ||
} | ||
else if (number < 100) { | ||
return '000' + number; | ||
} | ||
else if (number < 1000) { | ||
return '00' + number; | ||
} | ||
else if (number < 10000) { | ||
return '0' + number; | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
} | ||
else if (number < 100) { | ||
return '00' + number; | ||
} | ||
else if (number < 1000) { | ||
return '0' + number; | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
} | ||
else if (maxLength < 6) { | ||
if (number < 10) { | ||
return '0000' + number; | ||
} | ||
else if (number < 100) { | ||
return '000' + number; | ||
} | ||
else if (number < 1000) { | ||
return '00' + number; | ||
} | ||
else if (number < 10000) { | ||
return '0' + number; | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
}; | ||
}; | ||
return StringConverter; | ||
}()); | ||
export { StringConverter }; | ||
module.exports = { StringConverter: StringConverter }; | ||
//# sourceMappingURL=core-services-string.service.js.map |
@@ -1,123 +0,8 @@ | ||
/// <reference types="moment-range" /> | ||
declare const Array: { | ||
removeArrayDuplicateLegacy: (array: any[]) => any[]; | ||
sortByKey: (array: any[], key: string, asc: boolean) => PromiseLike<any[]>; | ||
}; | ||
declare const ArraySort: { | ||
sortByKey: (array: any[], key: string, asc: boolean) => PromiseLike<any[]>; | ||
}; | ||
declare const ArrayRemove: { | ||
removeArrayDuplicateLegacy: (array: any[]) => any[]; | ||
}; | ||
declare const Attachment: { | ||
validateFile: (input: HTMLInputElement, accepts: string[]) => boolean; | ||
validateFileSize: (input: HTMLInputElement) => boolean; | ||
textFileToUrlImage: (file: File) => PromiseLike<string>; | ||
parseAcceptFiles: (accepts: string) => string[]; | ||
}; | ||
declare const AttachmentValidate: { | ||
validateFile: (input: HTMLInputElement, accepts: string[]) => boolean; | ||
validateFileSize: (input: HTMLInputElement) => boolean; | ||
fileMaxSize: (input: HTMLInputElement) => number; | ||
}; | ||
declare const AttachmentConvert: { | ||
textFileToUrlImage: (file: File) => PromiseLike<string>; | ||
}; | ||
declare const AttachmentParse: { | ||
parseAcceptFiles: (accepts: string) => string[]; | ||
}; | ||
declare const Browser: { | ||
isIE: () => boolean; | ||
isBeforeIE11: () => boolean; | ||
disableFullscreenListener: () => void; | ||
fullscreenListener: (menuButton: import("./scripts/core/services/menu/core-services-menu.interfaces").IMenuButton, alt: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenAlt, src: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenSrc, showLog?: boolean) => void; | ||
toggleFullScreen: (menuButton: import("./scripts/core/services/menu/core-services-menu.interfaces").IMenuButton, alt: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenAlt, src: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenSrc, showLog?: boolean) => PromiseLike<import("./scripts/core/services/browser/core-services-browser.interfaces").IFullscreenResult>; | ||
hasFullscreen: () => boolean; | ||
}; | ||
declare const BrowserVersion: { | ||
isIE: () => boolean; | ||
isBeforeIE11: () => boolean; | ||
}; | ||
declare const BrowserFullscreen: { | ||
disableFullscreenListener: () => void; | ||
fullscreenListener: (menuButton: import("./scripts/core/services/menu/core-services-menu.interfaces").IMenuButton, alt: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenAlt, src: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenSrc, showLog?: boolean) => void; | ||
toggleFullScreen: (menuButton: import("./scripts/core/services/menu/core-services-menu.interfaces").IMenuButton, alt: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenAlt, src: import("./scripts/core/services/menu/core-services-menu.interfaces").IFullScreenSrc, showLog?: boolean) => PromiseLike<import("./scripts/core/services/browser/core-services-browser.interfaces").IFullscreenResult>; | ||
hasFullscreen: () => boolean; | ||
}; | ||
declare const ComboBox: { | ||
initialize: (combobox: HTMLSelectElement, callback: any, invalidCallback: any) => void; | ||
loadData: (combobox: HTMLSelectElement, data: import("./scripts/core/services/combobox/core-services-combobox.interface").IComboBoxData[], keepValue: boolean) => Promise<unknown>; | ||
dataByValue: (arrayData: import("./scripts/core/services/combobox/core-services-combobox.interface").IComboBoxData[], value: string) => string; | ||
disableInput: (combobox: HTMLSelectElement, disable: boolean) => void; | ||
}; | ||
declare const ComboBoxCore: { | ||
initialize: (combobox: HTMLSelectElement, callback: any, invalidCallback: any) => void; | ||
loadData: (combobox: HTMLSelectElement, data: import("./scripts/core/services/combobox/core-services-combobox.interface").IComboBoxData[], keepValue: boolean) => Promise<unknown>; | ||
}; | ||
declare const ComboBoxData: { | ||
dataByValue: (arrayData: import("./scripts/core/services/combobox/core-services-combobox.interface").IComboBoxData[], value: string) => string; | ||
}; | ||
declare const ComboBoxDom: { | ||
disableInput: (combobox: HTMLSelectElement, disable: boolean) => void; | ||
}; | ||
declare const DateCore: { | ||
customDate: (date: import("moment").MomentInput, format: string) => string; | ||
currentDate: (outputFormat?: string) => string; | ||
dayMonthYear: (date: import("moment").MomentInput, format?: string) => import("./scripts/core/services/date/core-services-date.interface").IDayMonthYear; | ||
localDate: (year: number, month: number, day: number, local?: import("./scripts/core/services/date/core-services-date.interface").IDateLocal) => string; | ||
dateFromIso: (date: import("moment").MomentInput, format?: string) => string; | ||
ganttDate: (date: import("moment").MomentInput) => Date; | ||
isoDateCustom: (date: import("moment").MomentInput, dateFormat: string, outputFormat: string) => string; | ||
isoDate: (date: import("moment").MomentInput, format?: string) => string; | ||
isoDateWithoutTime: (date: import("moment").MomentInput) => string; | ||
dateMilliseconds: (date: import("moment").MomentInput, dateFormat: string, outputFormat: string) => number; | ||
dateToMillisecondsNoTime: (date: import("moment").MomentInput) => number; | ||
millisecondsToDate: (date: import("moment").MomentInput, outputFormat: string) => string; | ||
daysToMilliseconds: (days: number) => number; | ||
durationInDays: (start: number, end: number, countFirstDay: boolean) => number; | ||
durationInMilliseconds: (start: number, end: number) => number; | ||
monthName: (month: number, language?: string) => string; | ||
weeksOfMonth: (year: number, month: number) => import("./scripts/core/services/date/core-services-date.interface").IWeeksOfMonth[]; | ||
daysOfMonth: (weeksRange: import("./scripts/core/services/date/core-services-date.interface").IWeeksOfMonth[]) => import("./scripts/core/services/date/core-services-date.interface").IDaysOfMonth[][]; | ||
weekOfYear: (date: string, format: string) => number; | ||
isDateBefore: (startDate: string, endDate: string, type?: import("moment").unitOfTime.StartOf) => boolean; | ||
}; | ||
declare const DateGet: { | ||
customDate: (date: import("moment").MomentInput, format: string) => string; | ||
currentDate: (outputFormat?: string) => string; | ||
dayMonthYear: (date: import("moment").MomentInput, format?: string) => import("./scripts/core/services/date/core-services-date.interface").IDayMonthYear; | ||
localDate: (year: number, month: number, day: number, local?: import("./scripts/core/services/date/core-services-date.interface").IDateLocal) => string; | ||
dateFromIso: (date: import("moment").MomentInput, format?: string) => string; | ||
ganttDate: (date: import("moment").MomentInput) => Date; | ||
isoDateCustom: (date: import("moment").MomentInput, dateFormat: string, outputFormat: string) => string; | ||
isoDate: (date: import("moment").MomentInput, format?: string) => string; | ||
isoDateWithoutTime: (date: import("moment").MomentInput) => string; | ||
dateMilliseconds: (date: import("moment").MomentInput, dateFormat: string, outputFormat: string) => number; | ||
dateToMillisecondsNoTime: (date: import("moment").MomentInput) => number; | ||
millisecondsToDate: (date: import("moment").MomentInput, outputFormat: string) => string; | ||
daysToMilliseconds: (days: number) => number; | ||
durationInDays: (start: number, end: number, countFirstDay: boolean) => number; | ||
durationInMilliseconds: (start: number, end: number) => number; | ||
monthName: (month: number, language?: string) => string; | ||
weeksOfMonth: (year: number, month: number) => import("./scripts/core/services/date/core-services-date.interface").IWeeksOfMonth[]; | ||
daysOfMonth: (weeksRange: import("./scripts/core/services/date/core-services-date.interface").IWeeksOfMonth[]) => import("./scripts/core/services/date/core-services-date.interface").IDaysOfMonth[][]; | ||
weekOfYear: (date: string, format: string) => number; | ||
}; | ||
declare const DateComparable: { | ||
isDateBefore: (startDate: string, endDate: string, type?: import("moment").unitOfTime.StartOf) => boolean; | ||
}; | ||
declare const DateValidation: { | ||
validateDate: (date: import("moment").MomentInput) => boolean; | ||
}; | ||
declare const DatePicker: { | ||
setDatePicker: (datePicker: HTMLInputElement, dateFormat: string) => void; | ||
monthYearDatePicker: (datePicker: HTMLInputElement, dateFormat: string, setValueCallback: any) => void; | ||
dateFromDatePicker: (date: import("moment").MomentInput, format?: string, outputFormat?: string) => string; | ||
localDateForDatePicker: (date: import("moment").MomentInput, outputFormat?: string) => string; | ||
currentDateForDatePicker: (dateFormat?: string, outputFormat?: string) => string; | ||
dateForDatePicker: (month: number, day: number, year: number) => string; | ||
}; | ||
declare const Elements: { | ||
removeChildElements: (elementClassId: string | HTMLElement) => void; | ||
}; | ||
export { Array, ArraySort, ArrayRemove, Attachment, AttachmentValidate, AttachmentConvert, AttachmentParse, Browser, BrowserVersion, BrowserFullscreen, ComboBox, ComboBoxCore, ComboBoxData, ComboBoxDom, DateCore, DateGet, DateComparable, DateValidation, DatePicker, Elements }; | ||
import '../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
export * from './scripts/core/services/array/core-services-array.service'; | ||
export * from './scripts/core/services/attachment/core-services-attachment.service'; | ||
export * from './scripts/core/services/browser/core-services-browser.service'; | ||
export * from './scripts/core/services/combobox/core-services-combobox.service'; | ||
export * from './scripts/core/services/date/core-services-date.service'; | ||
export * from './scripts/core/services/elements/core-services-elements.service'; | ||
export * from './scripts/core/services/string/core-services-string.service'; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var core_services_attachment_service_1=require("./scripts/core/services/attachment/core-services-attachment.service");var core_services_array_service_1=require("./scripts/core/services/array/core-services-array.service");var core_services_browser_service_1=require("./scripts/core/services/browser/core-services-browser.service");var core_services_combobox_service_1=require("./scripts/core/services/combobox/core-services-combobox.service");var core_services_date_service_1=require("./scripts/core/services/date/core-services-date.service");var core_services_elements_service_1=require("./scripts/core/services/elements/core-services-elements.service");var core_services_string_service_1=require("./scripts/core/services/string/core-services-string.service");var Array={removeArrayDuplicateLegacy:core_services_array_service_1.removeArrayDuplicateLegacy,sortByKey:core_services_array_service_1.sortByKey};exports.Array=Array;var ArraySort={sortByKey:core_services_array_service_1.sortByKey};exports.ArraySort=ArraySort;var ArrayRemove={removeArrayDuplicateLegacy:core_services_array_service_1.removeArrayDuplicateLegacy};exports.ArrayRemove=ArrayRemove;var Attachment={validateFile:core_services_attachment_service_1.validateFile,validateFileSize:core_services_attachment_service_1.validateFileSize,textFileToUrlImage:core_services_attachment_service_1.textFileToUrlImage,parseAcceptFiles:core_services_attachment_service_1.parseAcceptFiles};exports.Attachment=Attachment;var AttachmentValidate={validateFile:core_services_attachment_service_1.validateFile,validateFileSize:core_services_attachment_service_1.validateFileSize,fileMaxSize:core_services_attachment_service_1.fileMaxSize};exports.AttachmentValidate=AttachmentValidate;var AttachmentConvert={textFileToUrlImage:core_services_attachment_service_1.textFileToUrlImage};exports.AttachmentConvert=AttachmentConvert;var AttachmentParse={parseAcceptFiles:core_services_attachment_service_1.parseAcceptFiles};exports.AttachmentParse=AttachmentParse;var Browser={isIE:core_services_browser_service_1.isIE,isBeforeIE11:core_services_browser_service_1.isBeforeIE11,disableFullscreenListener:core_services_browser_service_1.disableFullscreenListener,fullscreenListener:core_services_browser_service_1.fullscreenListener,toggleFullScreen:core_services_browser_service_1.toggleFullScreen,hasFullscreen:core_services_browser_service_1.hasFullscreen};exports.Browser=Browser;var BrowserVersion={isIE:core_services_browser_service_1.isIE,isBeforeIE11:core_services_browser_service_1.isBeforeIE11};exports.BrowserVersion=BrowserVersion;var BrowserFullscreen={disableFullscreenListener:core_services_browser_service_1.disableFullscreenListener,fullscreenListener:core_services_browser_service_1.fullscreenListener,toggleFullScreen:core_services_browser_service_1.toggleFullScreen,hasFullscreen:core_services_browser_service_1.hasFullscreen};exports.BrowserFullscreen=BrowserFullscreen;var ComboBox={initialize:core_services_combobox_service_1.initialize,loadData:core_services_combobox_service_1.loadData,dataByValue:core_services_combobox_service_1.dataByValue,disableInput:core_services_combobox_service_1.disableInput};exports.ComboBox=ComboBox;var ComboBoxCore={initialize:core_services_combobox_service_1.initialize,loadData:core_services_combobox_service_1.loadData};exports.ComboBoxCore=ComboBoxCore;var ComboBoxData={dataByValue:core_services_combobox_service_1.dataByValue};exports.ComboBoxData=ComboBoxData;var ComboBoxDom={disableInput:core_services_combobox_service_1.disableInput};exports.ComboBoxDom=ComboBoxDom;var DateCore={customDate:core_services_date_service_1.customDate,currentDate:core_services_date_service_1.currentDate,dayMonthYear:core_services_date_service_1.dayMonthYear,localDate:core_services_date_service_1.localDate,dateFromIso:core_services_date_service_1.dateFromIso,ganttDate:core_services_date_service_1.ganttDate,isoDateCustom:core_services_date_service_1.isoDateCustom,isoDate:core_services_date_service_1.isoDate,isoDateWithoutTime:core_services_date_service_1.isoDateWithoutTime,dateMilliseconds:core_services_date_service_1.dateMilliseconds,dateToMillisecondsNoTime:core_services_date_service_1.dateToMillisecondsNoTime,millisecondsToDate:core_services_date_service_1.millisecondsToDate,daysToMilliseconds:core_services_date_service_1.daysToMilliseconds,durationInDays:core_services_date_service_1.durationInDays,durationInMilliseconds:core_services_date_service_1.durationInMilliseconds,monthName:core_services_date_service_1.monthName,weeksOfMonth:core_services_date_service_1.weeksOfMonth,daysOfMonth:core_services_date_service_1.daysOfMonth,weekOfYear:core_services_date_service_1.weekOfYear,isDateBefore:core_services_date_service_1.isDateBefore};exports.DateCore=DateCore;var DateGet={customDate:core_services_date_service_1.customDate,currentDate:core_services_date_service_1.currentDate,dayMonthYear:core_services_date_service_1.dayMonthYear,localDate:core_services_date_service_1.localDate,dateFromIso:core_services_date_service_1.dateFromIso,ganttDate:core_services_date_service_1.ganttDate,isoDateCustom:core_services_date_service_1.isoDateCustom,isoDate:core_services_date_service_1.isoDate,isoDateWithoutTime:core_services_date_service_1.isoDateWithoutTime,dateMilliseconds:core_services_date_service_1.dateMilliseconds,dateToMillisecondsNoTime:core_services_date_service_1.dateToMillisecondsNoTime,millisecondsToDate:core_services_date_service_1.millisecondsToDate,daysToMilliseconds:core_services_date_service_1.daysToMilliseconds,durationInDays:core_services_date_service_1.durationInDays,durationInMilliseconds:core_services_date_service_1.durationInMilliseconds,monthName:core_services_date_service_1.monthName,weeksOfMonth:core_services_date_service_1.weeksOfMonth,daysOfMonth:core_services_date_service_1.daysOfMonth,weekOfYear:core_services_date_service_1.weekOfYear};exports.DateGet=DateGet;var DateComparable={isDateBefore:core_services_date_service_1.isDateBefore};exports.DateComparable=DateComparable;var DateValidation={validateDate:core_services_date_service_1.validateDate};exports.DateValidation=DateValidation;var DatePicker={setDatePicker:core_services_date_service_1.setDatePicker,monthYearDatePicker:core_services_date_service_1.monthYearDatePicker,dateFromDatePicker:core_services_date_service_1.dateFromDatePicker,localDateForDatePicker:core_services_date_service_1.localDateForDatePicker,currentDateForDatePicker:core_services_date_service_1.currentDateForDatePicker,dateForDatePicker:core_services_date_service_1.dateForDatePicker};exports.DatePicker=DatePicker;var Elements={removeChildElements:core_services_elements_service_1.removeChildElements};exports.Elements=Elements;var String={numberToString:core_services_string_service_1.numberToString}; | ||
"use strict";function __export(m){for(var p in m)if(!exports.hasOwnProperty(p))exports[p]=m[p]}Object.defineProperty(exports,"__esModule",{value:true});require("../node_modules/jquery-ui-dist/jquery-ui.min");__export(require("./scripts/core/services/array/core-services-array.service"));__export(require("./scripts/core/services/attachment/core-services-attachment.service"));__export(require("./scripts/core/services/browser/core-services-browser.service"));__export(require("./scripts/core/services/combobox/core-services-combobox.service"));__export(require("./scripts/core/services/date/core-services-date.service"));__export(require("./scripts/core/services/elements/core-services-elements.service"));__export(require("./scripts/core/services/string/core-services-string.service")); |
@@ -1,8 +0,6 @@ | ||
/** | ||
* Remove items | ||
*/ | ||
export declare const removeArrayDuplicateLegacy: (array: any[]) => any[]; | ||
/** | ||
* Sort Arrays | ||
*/ | ||
export declare const sortByKey: (array: any[], key: string, asc: boolean) => PromiseLike<any[]>; | ||
export declare class ArrayRemove { | ||
static duplicateLegacy(array: any[]): any[]; | ||
} | ||
export declare class ArraySort { | ||
static byKey(array: any[], key: string, asc: boolean): PromiseLike<any[]>; | ||
} |
@@ -1,1 +0,33 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.removeArrayDuplicateLegacy=function(array){var unique=array.filter(function(item,index){return array.indexOf(item)===index});return unique.sort()};exports.sortByKey=function(array,key,asc){return new Promise(function(resolve){var _asc=asc?1:-1;var sorted=array.sort(function(a,b){var x=a[key];var y=b[key];return x===y?0:x>y?_asc:-1*_asc});resolve(sorted)})}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ArrayRemove = /** @class */ (function () { | ||
function ArrayRemove() { | ||
} | ||
ArrayRemove.duplicateLegacy = function (array) { | ||
var unique = array.filter(function (item, index) { | ||
return array.indexOf(item) === index; | ||
}); | ||
return unique.sort(); | ||
}; | ||
return ArrayRemove; | ||
}()); | ||
exports.ArrayRemove = ArrayRemove; | ||
var ArraySort = /** @class */ (function () { | ||
function ArraySort() { | ||
} | ||
ArraySort.byKey = function (array, key, asc) { | ||
return new Promise(function (resolve) { | ||
var _asc = asc ? 1 : -1; | ||
var sorted = array.sort(function (a, b) { | ||
var x = a[key]; | ||
var y = b[key]; | ||
return (x === y) ? 0 : ((x > y) ? _asc : -1 * _asc); | ||
}); | ||
resolve(sorted); | ||
}); | ||
}; | ||
return ArraySort; | ||
}()); | ||
exports.ArraySort = ArraySort; | ||
module.exports = { ArrayRemove: ArrayRemove, ArraySort: ArraySort }; | ||
//# sourceMappingURL=core-services-array.service.js.map |
@@ -1,17 +0,12 @@ | ||
/** | ||
* Convert | ||
*/ | ||
export declare const textFileToUrlImage: (file: File) => PromiseLike<string>; | ||
/** | ||
* Parser | ||
*/ | ||
export declare const parseAcceptFiles: (accepts: string) => string[]; | ||
/** | ||
* Validate | ||
*/ | ||
export declare const validateFile: (input: HTMLInputElement, accepts: string[]) => boolean; | ||
export declare const validateFileSize: (input: HTMLInputElement) => boolean; | ||
/** | ||
* The user must include the attribute 'data-maxsize' in mb(megabyte); | ||
*/ | ||
export declare const fileMaxSize: (input: HTMLInputElement) => number; | ||
export declare class AttachmentConvert { | ||
static textFileToUrlImage(file: File): PromiseLike<string>; | ||
} | ||
export declare class AttachmentParser { | ||
static parseAcceptFiles(accepts: string): string[]; | ||
} | ||
export declare class AttachmentValidate { | ||
static file(input: HTMLInputElement, accepts: string[]): boolean; | ||
static fileSize(input: HTMLInputElement): boolean; | ||
/** The user must include the attribute 'data-maxsize' in mb(megabyte); */ | ||
static maxSize: (input: HTMLInputElement) => number; | ||
} |
@@ -1,1 +0,96 @@ | ||
"use strict";var __values=this&&this.__values||function(o){var s=typeof Symbol==="function"&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&typeof o.length==="number")return{next:function(){if(o&&i>=o.length)o=void 0;return{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(exports,"__esModule",{value:true});exports.textFileToUrlImage=function(file){return new Promise(function(resolve){var fileReader=new FileReader;fileReader.addEventListener("load",function(e){resolve(e.target.result)});fileReader.readAsDataURL(file)})};exports.parseAcceptFiles=function(accepts){return accepts.replace(/image\//g,"").replace(/x-/g,"").replace(/\+xml/g,"").replace(/ /g,"").split(",")};exports.validateFile=function(input,accepts){var e_1,_a;var fileName=input.value;var idxDot=fileName.lastIndexOf(".")+1;var extFile=fileName.substr(idxDot,fileName.length).toLowerCase();if(accepts.length===1&&accepts[0]==="*"){return true}try{for(var accepts_1=__values(accepts),accepts_1_1=accepts_1.next();!accepts_1_1.done;accepts_1_1=accepts_1.next()){var extension=accepts_1_1.value;if(extFile===extension){return true}}}catch(e_1_1){e_1={error:e_1_1}}finally{try{if(accepts_1_1&&!accepts_1_1.done&&(_a=accepts_1.return))_a.call(accepts_1)}finally{if(e_1)throw e_1.error}}return false};exports.validateFileSize=function(input){if(input!=null&&input.files!=null){var fileSize=input.files[0].size/1024;var maxSize=exports.fileMaxSize(input);return fileSize<=maxSize}else{console.error("Input is null.");return false}};exports.fileMaxSize=function(input){var fileName=input.attributes["data-maxsize"].nodeValue;if(fileName){return parseInt(fileName,10)}else{return 1024*45}}; | ||
"use strict"; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var AttachmentConvert = /** @class */ (function () { | ||
function AttachmentConvert() { | ||
} | ||
AttachmentConvert.textFileToUrlImage = function (file) { | ||
return new Promise(function (resolve) { | ||
var fileReader = new FileReader(); | ||
fileReader.addEventListener('load', function (e) { | ||
resolve(e.target.result); | ||
}); | ||
fileReader.readAsDataURL(file); | ||
}); | ||
}; | ||
return AttachmentConvert; | ||
}()); | ||
exports.AttachmentConvert = AttachmentConvert; | ||
var AttachmentParser = /** @class */ (function () { | ||
function AttachmentParser() { | ||
} | ||
AttachmentParser.parseAcceptFiles = function (accepts) { | ||
return accepts | ||
.replace(/image\//g, '') | ||
.replace(/x-/g, '') | ||
.replace(/\+xml/g, '') | ||
.replace(/ /g, '') | ||
.split(','); | ||
}; | ||
return AttachmentParser; | ||
}()); | ||
exports.AttachmentParser = AttachmentParser; | ||
var AttachmentValidate = /** @class */ (function () { | ||
function AttachmentValidate() { | ||
} | ||
AttachmentValidate.file = function (input, accepts) { | ||
var e_1, _a; | ||
var fileName = input.value; | ||
var idxDot = fileName.lastIndexOf('.') + 1; | ||
var extFile = fileName.substr(idxDot, fileName.length).toLowerCase(); | ||
if (accepts.length === 1 && accepts[0] === '*') { | ||
return true; | ||
} | ||
try { | ||
for (var accepts_1 = __values(accepts), accepts_1_1 = accepts_1.next(); !accepts_1_1.done; accepts_1_1 = accepts_1.next()) { | ||
var extension = accepts_1_1.value; | ||
if (extFile === extension) { | ||
return true; | ||
} | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (accepts_1_1 && !accepts_1_1.done && (_a = accepts_1.return)) _a.call(accepts_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
return false; | ||
}; | ||
AttachmentValidate.fileSize = function (input) { | ||
if (input != null && input.files != null) { | ||
var fileSize = input.files[0].size / 1024; | ||
var max = this.maxSize(input); | ||
return fileSize <= max; | ||
} | ||
else { | ||
console.error('Input is null.'); | ||
return false; | ||
} | ||
}; | ||
/** The user must include the attribute 'data-maxsize' in mb(megabyte); */ | ||
AttachmentValidate.maxSize = function (input) { | ||
var fileName = input.attributes['data-maxsize'].nodeValue; | ||
if (fileName) { | ||
return parseInt(fileName, 10); | ||
} | ||
else { | ||
return 1024 * 45; | ||
} | ||
}; | ||
return AttachmentValidate; | ||
}()); | ||
exports.AttachmentValidate = AttachmentValidate; | ||
module.exports = { AttachmentConvert: AttachmentConvert, AttachmentParser: AttachmentParser, AttachmentValidate: AttachmentValidate }; | ||
//# sourceMappingURL=core-services-attachment.service.js.map |
@@ -1,1 +0,3 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true}); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=core-services-browser.interfaces.js.map |
import { IFullScreenAlt, IFullScreenSrc, IMenuButton } from '../menu/core-services-menu.interfaces'; | ||
import { IFullscreenResult } from './core-services-browser.interfaces'; | ||
/** | ||
* Ffullscreen | ||
*/ | ||
export declare const fullscreenListener: (menuButton: IMenuButton, alt: IFullScreenAlt, src: IFullScreenSrc, showLog?: boolean) => void; | ||
export declare const disableFullscreenListener: () => void; | ||
export declare const toggleFullScreen: (menuButton: IMenuButton, alt: IFullScreenAlt, src: IFullScreenSrc, showLog?: boolean) => PromiseLike<IFullscreenResult>; | ||
export declare const hasFullscreen: () => boolean; | ||
/** | ||
* Version | ||
*/ | ||
export declare const isIE: () => boolean; | ||
export declare const isBeforeIE11: () => boolean; | ||
export declare class BrowserFullScreen { | ||
static listener(menuButton: IMenuButton, alt: IFullScreenAlt, src: IFullScreenSrc, showLog?: boolean): void; | ||
static disableListener(): void; | ||
static toggle(menuButton: IMenuButton, alt: IFullScreenAlt, src: IFullScreenSrc, showLog?: boolean): PromiseLike<IFullscreenResult>; | ||
static available(): boolean; | ||
} | ||
export declare class BrowserVersion { | ||
static isIE(): boolean; | ||
static isBeforeIE11(): boolean; | ||
} |
@@ -1,1 +0,91 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var screenfull=require("screenfull");exports.fullscreenListener=function(menuButton,alt,src,showLog){if(showLog===void 0){showLog=false}if(screenfull.isEnabled){screenfull.on("change",function(){if(screenfull.isFullscreen){menuButton.src=src.exit;menuButton.alt=alt.exit}else{menuButton.src=src.enter;menuButton.alt=alt.enter}if(showLog){var label=screenfull.isFullscreen?"enabled":"disabled";console.log("Fullscreen "+label)}})}else{console.log("This browser does not support fullscreen api")}};exports.disableFullscreenListener=function(){screenfull.off("change",function(){console.log("Fullscreen listener has been disabled")})};exports.toggleFullScreen=function(menuButton,alt,src,showLog){if(showLog===void 0){showLog=false}return new Promise(function(resolve,reject){if(screenfull.isEnabled){if(screenfull.isFullscreen){screenfull.exit().then(function(){menuButton.src=src.enter;menuButton.alt=alt.enter}).catch(function(error){console.log(error);reject(error)})}else{screenfull.request().then(function(){menuButton.src=src.exit;menuButton.alt=alt.exit}).catch(function(error){console.log(error);reject(error)})}if(showLog){var label=screenfull.isFullscreen?"enabled":"disabled";console.log("Fullscreen "+label)}resolve({src:menuButton.src,alt:menuButton.alt})}else{resolve({src:null,alt:null})}})};exports.hasFullscreen=function(){return screenfull.isEnabled};exports.isIE=function(){var ua=window.navigator.userAgent;var msie=ua.indexOf("MSIE ");return msie>0||!!navigator.userAgent.match(/Trident.*rv:11\./)};exports.isBeforeIE11=function(){return navigator.appVersion.indexOf("MSIE 10")!==-1}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var screenfull = require("screenfull"); | ||
var BrowserFullScreen = /** @class */ (function () { | ||
function BrowserFullScreen() { | ||
} | ||
BrowserFullScreen.listener = function (menuButton, alt, src, showLog) { | ||
if (showLog === void 0) { showLog = false; } | ||
if (screenfull.isEnabled) { | ||
screenfull.on('change', function () { | ||
// @ts-ignore | ||
if (screenfull.isFullscreen) { | ||
menuButton.src = src.exit; | ||
menuButton.alt = alt.exit; | ||
} | ||
else { | ||
menuButton.src = src.enter; | ||
menuButton.alt = alt.enter; | ||
} | ||
if (showLog) { | ||
// @ts-ignore | ||
var label = screenfull.isFullscreen ? 'enabled' : 'disabled'; | ||
console.log("Fullscreen " + label); | ||
} | ||
}); | ||
} | ||
else { | ||
console.log('This browser does not support fullscreen api'); | ||
} | ||
}; | ||
BrowserFullScreen.disableListener = function () { | ||
// @ts-ignore | ||
screenfull.off('change', function () { | ||
console.log('Fullscreen listener has been disabled'); | ||
}); | ||
}; | ||
BrowserFullScreen.toggle = function (menuButton, alt, src, showLog) { | ||
if (showLog === void 0) { showLog = false; } | ||
return new Promise(function (resolve, reject) { | ||
if (screenfull.isEnabled) { | ||
if (screenfull.isFullscreen) { | ||
screenfull.exit().then(function () { | ||
menuButton.src = src.enter; | ||
menuButton.alt = alt.enter; | ||
}).catch(function (error) { | ||
console.log(error); | ||
reject(error); | ||
}); | ||
} | ||
else { | ||
screenfull.request().then(function () { | ||
menuButton.src = src.exit; | ||
menuButton.alt = alt.exit; | ||
}).catch(function (error) { | ||
console.log(error); | ||
reject(error); | ||
}); | ||
} | ||
if (showLog) { | ||
var label = screenfull.isFullscreen ? 'enabled' : 'disabled'; | ||
console.log("Fullscreen " + label); | ||
} | ||
resolve({ src: menuButton.src, alt: menuButton.alt }); | ||
} | ||
else { | ||
resolve({ src: null, alt: null }); | ||
} | ||
}); | ||
}; | ||
BrowserFullScreen.available = function () { | ||
return screenfull.isEnabled; | ||
}; | ||
return BrowserFullScreen; | ||
}()); | ||
exports.BrowserFullScreen = BrowserFullScreen; | ||
var BrowserVersion = /** @class */ (function () { | ||
function BrowserVersion() { | ||
} | ||
BrowserVersion.isIE = function () { | ||
var ua = window.navigator.userAgent; | ||
var msie = ua.indexOf('MSIE '); | ||
return msie > 0 || !!navigator.userAgent.match(/Trident.*rv:11\./); | ||
}; | ||
BrowserVersion.isBeforeIE11 = function () { | ||
return navigator.appVersion.indexOf('MSIE 10') !== -1; | ||
}; | ||
return BrowserVersion; | ||
}()); | ||
exports.BrowserVersion = BrowserVersion; | ||
module.exports = { BrowserFullScreen: BrowserFullScreen, BrowserVersion: BrowserVersion }; | ||
//# sourceMappingURL=core-services-browser.service.js.map |
@@ -1,1 +0,3 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true}); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=core-services-combobox.interface.js.map |
@@ -1,12 +0,16 @@ | ||
import 'node_modules/jquery-ui-dist/jquery-ui.min'; | ||
import { IComboBoxData } from './core-services-combobox.interface'; | ||
/** | ||
* This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
export declare const initialize: (combobox: HTMLSelectElement, callback: any, invalidCallback: any) => void; | ||
export declare const loadData: (combobox: HTMLSelectElement, data: IComboBoxData[], keepValue: boolean) => Promise<unknown>; | ||
export declare const dataByValue: (arrayData: IComboBoxData[], value: string) => string; | ||
export declare const disableInput: (combobox: HTMLSelectElement, disable: boolean) => void; | ||
export declare class ComboBoxCore { | ||
/** This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
static initialize(combobox: HTMLSelectElement, callback: any, invalidCallback: any): void; | ||
static loadData(combobox: HTMLSelectElement, data: IComboBoxData[], keepValue: boolean): PromiseLike<HTMLSelectElement | null>; | ||
} | ||
export declare class ComboBoxData { | ||
static byValue(arrayData: IComboBoxData[], value: string): string; | ||
} | ||
export declare class ComboBoxDom { | ||
static disableInput(combobox: HTMLSelectElement, disable: boolean): void; | ||
} |
@@ -1,1 +0,247 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var $=require("jquery");require("node_modules/jquery-ui-dist/jquery-ui.min");var core_services_elements_service_1=require("../elements/core-services-elements.service");exports.initialize=function(combobox,callback,invalidCallback){$.widget("custom.combobox",{_create:function(){this.wrapper=$("<span>").addClass("custom-combobox").insertAfter(this.element);this.element.hide();this._createAutocomplete();this._createShowAllButton();this.input.attr("placeholder",this.element.attr("placeholder"));this.input.focus().blur()},_createAutocomplete:function(){var selected=this.element.children(":selected");var value=selected.val()?selected.text():"";this.input=$("<input>").appendTo(this.wrapper).val(value).attr("title","").addClass("custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left "+this.element.attr("class")).autocomplete({delay:0,minLength:0,maxShowItems:5,source:$.proxy(this,"_source")}).tooltip({classes:{"ui-tooltip":"ui-state-highlight"}});this.input.focus().blur();this._on(this.input,{autocompleteselect:function(event,ui){ui.item.option.selected=true;callback(ui.item.option.value,ui.item.value);this._trigger("select",event,{item:ui.item.option})},disable:function(){this._disable()},enable:function(){this._enable()},autocompletechange:"_removeIfInvalid"})},_createShowAllButton:function(){var input=this.input;var wasOpen=false;$("<a>").attr("tabIndex",-1).attr("title","Mostrar todos os itens").tooltip().appendTo(this.wrapper).button({icons:{primary:"ui-icon-triangle-1-s"},text:false}).removeClass("ui-corner-all").on("mousedown",function(){wasOpen=input.autocomplete("widget").is(":visible")}).on("click",function(){wasOpen=input.autocomplete("widget").is(":visible");input.trigger("focus");if(wasOpen){return}input.autocomplete("search","")})},_source:function(request,response){var matcher=new RegExp($.ui.autocomplete.escapeRegex(request.term),"i");response(this.element.children("option").map(function(){var text=$(this).text();if(this.value&&(!request.term||matcher.test(text))){return{label:text,value:text,option:this}}else{return null}}))},_removeIfInvalid:function(event,ui){if(ui.item){return}var value=this.input.val();var valueLowerCase=value.toLowerCase();var valid=false;this.element.children("option").each(function(){if($(this).text().toLowerCase()===valueLowerCase){this.selected=valid=true;return false}});if(valid){callback(this.element.val(),this.input.val());return}this.input.val("").attr("title","O valor "+value+" não existe para este item!").tooltip("open");this.element.val("");this._delay(function(){this.input.tooltip("close").attr("title","")},2500);this.input.autocomplete("instance").term="";invalidCallback(this.element.val(),this.input.val())},_destroy:function(){this.wrapper.remove();this.element.show()}});$(combobox).combobox()};exports.loadData=function(combobox,data,keepValue){return new Promise(function(resolve){var parent=combobox.parentNode;if(parent!=null){var comboboxInput=parent.querySelector("input.custom-combobox-input");core_services_elements_service_1.removeChildElements(combobox);if(!keepValue){combobox.value="";comboboxInput.value=""}var emptyOption=document.createElement("option");emptyOption.value="";combobox.appendChild(emptyOption);data.forEach(function(d){var option=document.createElement("option");option.value=d.value;option.innerText=d.text;combobox.appendChild(option)});resolve(combobox)}else{console.error("Parent of current combobox is null");resolve(null)}})};exports.dataByValue=function(arrayData,value){var tempActionPlan=arrayData.filter(function(x){return x.value===value});if(value==null||tempActionPlan.length===0){return""}else{return tempActionPlan[0].text}};exports.disableInput=function(combobox,disable){var parent=combobox.parentNode;var input=parent.querySelector("input");if(input==null){console.error("Input not found on current combobox group: "+parent)}else{if(disable){input.disabled=true;input.classList.add("ui-autocomplete-disabled");input.classList.add("ui-state-disabled");input.setAttribute("tabIndex","-1");input.setAttribute("aria-disabled","true")}else{input.disabled=false;input.classList.remove("ui-state-disabled");input.classList.remove("ui-autocomplete-disabled");input.removeAttribute("tabIndex");input.setAttribute("aria-disabled","false")}}}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var $ = require("jquery"); | ||
// import 'jquery-ui-dist'; | ||
// import '../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
var core_services_elements_service_1 = require("../elements/core-services-elements.service"); | ||
var ComboBoxCore = /** @class */ (function () { | ||
function ComboBoxCore() { | ||
} | ||
/** This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
ComboBoxCore.initialize = function (combobox, callback, invalidCallback) { | ||
$.widget('custom.combobox', { | ||
_create: function () { | ||
// @ts-ignore | ||
this.wrapper = $('<span>') | ||
.addClass('custom-combobox') | ||
.insertAfter(this.element); | ||
this.element.hide(); | ||
this._createAutocomplete(); | ||
this._createShowAllButton(); | ||
// @ts-ignore | ||
this.input.attr('placeholder', this.element.attr('placeholder')); | ||
// @ts-ignore | ||
this.input.focus().blur(); | ||
}, | ||
_createAutocomplete: function () { | ||
var selected = this.element.children(':selected'); | ||
var value = selected.val() ? selected.text() : ''; | ||
// @ts-ignore | ||
this.input = $('<input>') | ||
// @ts-ignore | ||
.appendTo(this.wrapper) | ||
.val(value) | ||
.attr('title', '') | ||
.addClass("custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left " + this.element.attr('class')) | ||
.autocomplete({ | ||
delay: 0, | ||
minLength: 0, | ||
// @ts-ignore | ||
maxShowItems: 5, | ||
source: $.proxy(this, '_source') | ||
}) | ||
.tooltip({ | ||
classes: { 'ui-tooltip': 'ui-state-highlight' } | ||
}); | ||
// @ts-ignore | ||
this.input.focus().blur(); | ||
// @ts-ignore | ||
// noinspection SpellCheckingInspection | ||
this._on(this.input, { | ||
autocompleteselect: function (event, ui) { | ||
ui.item.option.selected = true; | ||
// Get the value: ui.item.option.value | ||
// Get the text: ui.item.value | ||
callback(ui.item.option.value, ui.item.value); | ||
this._trigger('select', event, { | ||
item: ui.item.option | ||
}); | ||
}, | ||
disable: function () { | ||
this._disable(); | ||
}, | ||
enable: function () { | ||
this._enable(); | ||
}, | ||
autocompletechange: '_removeIfInvalid' | ||
}); | ||
}, | ||
_createShowAllButton: function () { | ||
// @ts-ignore | ||
var input = this.input; | ||
var wasOpen = false; | ||
$('<a>') | ||
.attr('tabIndex', -1) | ||
.attr('title', 'Mostrar todos os itens') | ||
.tooltip() | ||
// @ts-ignore | ||
.appendTo(this.wrapper) | ||
.button({ | ||
icons: { | ||
primary: 'ui-icon-triangle-1-s' | ||
}, | ||
text: false | ||
}) | ||
.removeClass('ui-corner-all') | ||
.on('mousedown', function () { | ||
wasOpen = input.autocomplete('widget').is(':visible'); | ||
}) | ||
.on('click', function () { | ||
wasOpen = input.autocomplete('widget').is(':visible'); | ||
input.trigger('focus'); | ||
if (wasOpen) { | ||
return; | ||
} | ||
// Pass empty string as value to search for, displaying all results | ||
input.autocomplete('search', ''); | ||
}); | ||
}, | ||
_source: function (request, response) { | ||
var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), 'i'); | ||
response(this.element.children('option').map(function () { | ||
var text = $(this).text(); | ||
// @ts-ignore | ||
if (this.value && (!request.term || matcher.test(text))) { | ||
return { | ||
label: text, | ||
value: text, | ||
option: this | ||
}; | ||
} | ||
else { | ||
return null; | ||
} | ||
})); | ||
}, | ||
_removeIfInvalid: function (event, ui) { | ||
// Selected an item, nothing to do | ||
if (ui.item) { | ||
return; | ||
} | ||
// Search for a match (case-insensitive) | ||
// @ts-ignore | ||
var value = this.input.val(); | ||
var valueLowerCase = value.toLowerCase(); | ||
var valid = false; | ||
this.element.children('option').each(function () { | ||
if ($(this).text().toLowerCase() === valueLowerCase) { | ||
// @ts-ignore | ||
this.selected = valid = true; | ||
return false; | ||
} | ||
}); | ||
// Found a match, nothing to do | ||
if (valid) { | ||
// Get the value: this.element.val() | ||
// Get the text: this.input.val() | ||
// @ts-ignore | ||
callback(this.element.val(), this.input.val()); | ||
return; | ||
} | ||
// Remove invalid value | ||
// noinspection TypeScriptValidateJSTypes | ||
// @ts-ignore | ||
this.input | ||
.val('') | ||
.attr('title', "O valor " + value + " n\u00E3o existe para este item!") | ||
.tooltip('open'); | ||
this.element.val(''); | ||
// @ts-ignore | ||
this._delay(function () { | ||
// @ts-ignore | ||
this.input.tooltip('close').attr('title', ''); | ||
}, 2500); | ||
// @ts-ignore | ||
this.input.autocomplete('instance').term = ''; | ||
// @ts-ignore | ||
invalidCallback(this.element.val(), this.input.val()); | ||
}, | ||
_destroy: function () { | ||
// @ts-ignore | ||
this.wrapper.remove(); | ||
this.element.show(); | ||
} | ||
}); | ||
// @ts-ignore | ||
$(combobox).combobox(); | ||
}; | ||
ComboBoxCore.loadData = function (combobox, data, keepValue) { | ||
return new Promise(function (resolve) { | ||
var parent = combobox.parentNode; | ||
if (parent != null) { | ||
var comboboxInput = parent.querySelector('input.custom-combobox-input'); | ||
core_services_elements_service_1.Remove.childElements(combobox); | ||
if (!keepValue) { | ||
combobox.value = ''; | ||
comboboxInput.value = ''; | ||
} | ||
var emptyOption = document.createElement('option'); | ||
emptyOption.value = ''; | ||
combobox.appendChild(emptyOption); | ||
data.forEach(function (d) { | ||
var option = document.createElement('option'); | ||
option.value = d.value; | ||
option.innerText = d.text; | ||
combobox.appendChild(option); | ||
}); | ||
resolve(combobox); | ||
} | ||
else { | ||
console.error('Parent of current combobox is null'); | ||
resolve(null); | ||
} | ||
}); | ||
}; | ||
return ComboBoxCore; | ||
}()); | ||
exports.ComboBoxCore = ComboBoxCore; | ||
var ComboBoxData = /** @class */ (function () { | ||
function ComboBoxData() { | ||
} | ||
ComboBoxData.byValue = function (arrayData, value) { | ||
var tempActionPlan = arrayData.filter(function (x) { return x.value === value; }); | ||
if (value == null || tempActionPlan.length === 0) { | ||
return ''; | ||
} | ||
else { | ||
return tempActionPlan[0].text; | ||
} | ||
}; | ||
return ComboBoxData; | ||
}()); | ||
exports.ComboBoxData = ComboBoxData; | ||
var ComboBoxDom = /** @class */ (function () { | ||
function ComboBoxDom() { | ||
} | ||
ComboBoxDom.disableInput = function (combobox, disable) { | ||
var parent = combobox.parentNode; | ||
var input = parent.querySelector('input'); | ||
if (input == null) { | ||
console.error("Input not found on current combobox group: " + parent); | ||
} | ||
else { | ||
if (disable) { | ||
input.disabled = true; // this disables just the popup menu (widget), | ||
input.classList.add('ui-autocomplete-disabled'); | ||
input.classList.add('ui-state-disabled'); | ||
input.setAttribute('tabIndex', '-1'); | ||
input.setAttribute('aria-disabled', 'true'); | ||
} | ||
else { | ||
input.disabled = false; | ||
input.classList.remove('ui-state-disabled'); | ||
input.classList.remove('ui-autocomplete-disabled'); | ||
input.removeAttribute('tabIndex'); | ||
input.setAttribute('aria-disabled', 'false'); | ||
} | ||
} | ||
}; | ||
return ComboBoxDom; | ||
}()); | ||
exports.ComboBoxDom = ComboBoxDom; | ||
module.exports = { ComboBoxCore: ComboBoxCore, ComboBoxData: ComboBoxData, ComboBoxDom: ComboBoxDom }; | ||
//# sourceMappingURL=core-services-combobox.service.js.map |
@@ -1,1 +0,3 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true}); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=core-services-date.interface.js.map |
@@ -1,47 +0,44 @@ | ||
import 'node_modules/jquery-ui-dist/jquery-ui.min'; | ||
import * as moment from 'moment'; | ||
import { IDateLocal, IDayMonthYear, IDaysOfMonth, IWeeksOfMonth } from './core-services-date.interface'; | ||
/** | ||
* Date Get data | ||
*/ | ||
export declare const customDate: (date: moment.MomentInput, format: string) => string; | ||
export declare const currentDate: (outputFormat?: string) => string; | ||
export declare const dayMonthYear: (date: moment.MomentInput, format?: string) => IDayMonthYear; | ||
export declare const localDate: (year: number, month: number, day: number, local?: IDateLocal) => string; | ||
export declare const dateFromIso: (date: moment.MomentInput, format?: string) => string; | ||
export declare const ganttDate: (date: moment.MomentInput) => Date; | ||
export declare const isoDateCustom: (date: moment.MomentInput, dateFormat: string, outputFormat: string) => string; | ||
export declare const isoDate: (date: moment.MomentInput, format?: string) => string; | ||
export declare const isoDateWithoutTime: (date: moment.MomentInput) => string; | ||
export declare const dateMilliseconds: (date: moment.MomentInput, dateFormat: string, outputFormat: string) => number; | ||
export declare const dateToMillisecondsNoTime: (date: moment.MomentInput) => number; | ||
export declare const millisecondsToDate: (date: moment.MomentInput, outputFormat: string) => string; | ||
export declare const daysToMilliseconds: (days: number) => number; | ||
export declare const durationInDays: (start: number, end: number, countFirstDay: boolean) => number; | ||
export declare const durationInMilliseconds: (start: number, end: number) => number; | ||
export declare const monthName: (month: number, language?: string) => string; | ||
export declare const weeksOfMonth: (year: number, month: number) => IWeeksOfMonth[]; | ||
export declare const daysOfMonth: (weeksRange: IWeeksOfMonth[]) => IDaysOfMonth[][]; | ||
export declare const weekOfYear: (date: string, format: string) => number; | ||
/** | ||
* Date comparable | ||
*/ | ||
export declare const isDateBefore: (startDate: string, endDate: string, type?: moment.unitOfTime.StartOf) => boolean; | ||
/** | ||
* Date validation | ||
*/ | ||
export declare const validateDate: (date: moment.MomentInput) => boolean; | ||
/** | ||
* Date picker utilities; | ||
* Jquery ui | ||
* This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
export declare const setDatePicker: (datePicker: HTMLInputElement, dateFormat: string) => void; | ||
export declare const monthYearDatePicker: (datePicker: HTMLInputElement, dateFormat: string, setValueCallback: any) => void; | ||
export declare const dateFromDatePicker: (date: moment.MomentInput, format?: string, outputFormat?: string) => string; | ||
export declare const localDateForDatePicker: (date: moment.MomentInput, outputFormat?: string) => string; | ||
export declare const currentDateForDatePicker: (dateFormat?: string, outputFormat?: string) => string; | ||
export declare const dateForDatePicker: (month: number, day: number, year: number) => string; | ||
import { IDate, IDateLocal, IDayMonthYear, IDaysOfMonth, IUnityOfTime, IWeeksOfMonth } from './core-services-date.interface'; | ||
export declare class DateGet { | ||
static customDate(date: IDate, format: string): string; | ||
static currentDate(outputFormat?: string): string; | ||
static dayMonthYear(date: IDate, format?: string): IDayMonthYear; | ||
static localDate(year: number, month: number, day: number, local?: IDateLocal): string; | ||
static dateFromIso(date: IDate, format?: string): string; | ||
static ganttDate(date: IDate): Date; | ||
static isoDateCustom(date: IDate, dateFormat: string, outputFormat: string): string; | ||
static isoDate(date: IDate, format?: string): string; | ||
static isoDateWithoutTime(date: IDate): string; | ||
static dateMilliseconds(date: IDate, dateFormat: string, outputFormat: string): number; | ||
static dateToMillisecondsNoTime(date: IDate): number; | ||
static millisecondsToDate(date: IDate, outputFormat: string): string; | ||
static daysToMilliseconds(days: number): number; | ||
static durationInDays(start: number, end: number, countFirstDay: boolean): number; | ||
static durationInMilliseconds(start: number, end: number): number; | ||
static monthName(month: number, language?: string): string; | ||
static weeksOfMonth(year: number, month: number): IWeeksOfMonth[]; | ||
static daysOfMonth(weeksRange: IWeeksOfMonth[]): IDaysOfMonth[][]; | ||
static weekOfYear(date: string, format: string): number; | ||
} | ||
export declare class DateComparable { | ||
static isDateBefore(startDate: string, endDate: string, type?: IUnityOfTime): boolean; | ||
} | ||
export declare class DateValidation { | ||
static date(date: IDate): boolean; | ||
} | ||
export declare class DatePicker { | ||
/** | ||
* Date picker utilities; | ||
* Jquery ui | ||
* This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
static setDatePicker(datePicker: HTMLInputElement, dateFormat: string): void; | ||
static monthYearDatePicker(datePicker: HTMLInputElement, dateFormat: string, setValueCallback: any): void; | ||
static dateFromDatePicker(date: IDate, format?: string, outputFormat?: string): string; | ||
static localDateForDatePicker(date: IDate, outputFormat?: string): string; | ||
static currentDateForDatePicker(dateFormat?: string, outputFormat?: string): string; | ||
static dateForDatePicker(month: number, day: number, year: number): string; | ||
} |
@@ -1,1 +0,353 @@ | ||
"use strict";var __values=this&&this.__values||function(o){var s=typeof Symbol==="function"&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&typeof o.length==="number")return{next:function(){if(o&&i>=o.length)o=void 0;return{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")};var __read=this&&this.__read||function(o,n){var m=typeof Symbol==="function"&&o[Symbol.iterator];if(!m)return o;var i=m.call(o),r,ar=[],e;try{while((n===void 0||n-- >0)&&!(r=i.next()).done)ar.push(r.value)}catch(error){e={error:error}}finally{try{if(r&&!r.done&&(m=i["return"]))m.call(i)}finally{if(e)throw e.error}}return ar};Object.defineProperty(exports,"__esModule",{value:true});var $=require("jquery");require("node_modules/jquery-ui-dist/jquery-ui.min");var moment=require("moment");var moment_range_1=require("moment-range");var core_services_string_service_1=require("../string/core-services-string.service");exports.customDate=function(date,format){return moment(date).format(format)};exports.currentDate=function(outputFormat){if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment.utc(new Date,outputFormat).local().format(outputFormat)};exports.dayMonthYear=function(date,format){if(format===void 0){format="DD/MM/YYYY"}var x=moment(date,format,true).format(format);var d=parseInt(x.split("/")[0],10);var m=parseInt(x.split("/")[1],10)-1;var y=parseInt(x.split("/")[2],10);return{day:d,month:m,year:y}};exports.localDate=function(year,month,day,local){if(local===void 0){local="pt-BR"}var options={year:"numeric",month:"numeric",day:"numeric"};return new Date(year,month,day).toLocaleDateString(local,options)};exports.dateFromIso=function(date,format){if(format===void 0){format="DD/MM/YYYY"}return moment.utc(date).format(format)};exports.ganttDate=function(date){var splitDate=exports.dayMonthYear(date);return new Date(splitDate.year,splitDate.month,splitDate.day)};exports.isoDateCustom=function(date,dateFormat,outputFormat){var splitDate=exports.dayMonthYear(date);return new Date(splitDate.year,splitDate.month,splitDate.day).toISOString()};exports.isoDate=function(date,format){if(format===void 0){format="DD/MM/YYYY"}return moment.utc(date,format).format(format)};exports.isoDateWithoutTime=function(date){var splitDate=exports.dayMonthYear(date);return moment.utc(new Date(splitDate.year,splitDate.month,splitDate.day)).toISOString()};exports.dateMilliseconds=function(date,dateFormat,outputFormat){return+moment(exports.isoDateCustom(date,dateFormat,outputFormat),dateFormat).format("x")};exports.dateToMillisecondsNoTime=function(date){return+moment(exports.isoDateWithoutTime(date)).format("x")};exports.millisecondsToDate=function(date,outputFormat){return moment.utc(date,"x").format(outputFormat)};exports.daysToMilliseconds=function(days){return days*24*60*60*1e3};exports.durationInDays=function(start,end,countFirstDay){var s=exports.dayMonthYear(start);var e=exports.dayMonthYear(end);var startDate=moment([s.year,s.month,s.day]);var endDate=moment([e.year,e.month,e.day]);var difference=endDate.diff(startDate,"days");var additional=countFirstDay?1:0;return difference+additional};exports.durationInMilliseconds=function(start,end){return exports.daysToMilliseconds(exports.durationInDays(start,end,false))};exports.monthName=function(month,language){if(language===void 0){language="pt-br"}if(language==="pt-br"||language==="pt-pt"||language==="pt"){switch(month){case 0:return"Janeiro";case 1:return"Fevereiro";case 2:return"Março";case 3:return"Abril";case 4:return"Maio";case 5:return"Junho";case 6:return"Julho";case 7:return"Agosto";case 8:return"Setembro";case 9:return"Outubro";case 10:return"Novembro";case 11:return"Dezembro";default:return""}}else{switch(month){case 0:return"January";case 1:return"February";case 2:return"March";case 3:return"April";case 4:return"May";case 5:return"June";case 6:return"July";case 7:return"August";case 8:return"September";case 9:return"October";case 10:return"November";case 11:return"December";default:return""}}};exports.weeksOfMonth=function(year,month){var e_1,_a,e_2,_b;var _moment=moment_range_1.extendMoment(moment);var startDate=moment([year,month]);var firstDay=moment(startDate).startOf("month");var endDay=moment(startDate).endOf("month");var monthRange=_moment.range(firstDay,endDay);var weeks=[];var _loop_1=function(range){var contain=weeks.filter(function(x){return x===range.week()}).length>0;if(!contain){weeks.push(range.week())}};try{for(var _c=__values(monthRange.by("days")),_d=_c.next();!_d.done;_d=_c.next()){var range=_d.value;_loop_1(range)}}catch(e_1_1){e_1={error:e_1_1}}finally{try{if(_d&&!_d.done&&(_a=_c.return))_a.call(_c)}finally{if(e_1)throw e_1.error}}var calendar=[];try{for(var weeks_1=__values(weeks),weeks_1_1=weeks_1.next();!weeks_1_1.done;weeks_1_1=weeks_1.next()){var week=weeks_1_1.value;var firstWeekDay=void 0;var lastWeekDay=void 0;var weekRange=void 0;if(month===11&&week===1){firstWeekDay=moment(year+1,"YYYY").week(week).day(0).isAfter(firstDay)?moment(year+1,"YYYY").week(week).day(0):firstDay;lastWeekDay=moment(year+1,"YYYY").week(week).day(6).isBefore(endDay)?moment(year+1,"YYYY").week(week).day(6):endDay;weekRange=_moment.range(firstWeekDay,lastWeekDay)}else{firstWeekDay=moment().week(week).day(0).isAfter(firstDay)?moment().week(week).day(0):firstDay;lastWeekDay=moment().week(week).day(6).isBefore(endDay)?moment().week(week).day(6):endDay;weekRange=_moment.range(firstWeekDay,lastWeekDay)}calendar.push({week:week,start:moment(weekRange.start.toISOString()).format("DD/MM/YYYY"),startDay:moment(weekRange.start.toISOString()).format("DD"),startMonth:moment(weekRange.start.toISOString()).format("MM"),startYear:moment(weekRange.start.toISOString()).format("YYYY"),end:moment(weekRange.end.toISOString()).format("DD/MM/YYYY"),endDay:moment(weekRange.end.toISOString()).format("DD"),endMonth:moment(weekRange.end.toISOString()).format("MM"),endYear:moment(weekRange.end.toISOString()).format("YYYY")})}}catch(e_2_1){e_2={error:e_2_1}}finally{try{if(weeks_1_1&&!weeks_1_1.done&&(_b=weeks_1.return))_b.call(weeks_1)}finally{if(e_2)throw e_2.error}}return calendar};exports.daysOfMonth=function(weeksRange){var e_3,_a;var range=[];try{for(var _b=__values(weeksRange.entries()),_c=_b.next();!_c.done;_c=_b.next()){var _d=__read(_c.value,2),i=_d[0],week=_d[1];var start=parseInt(weeksRange[i].startDay,10);var end=parseInt(weeksRange[i].endDay,10);var month=weeksRange[i].startMonth;var year=weeksRange[i].startYear;var weekDays=[];for(var j=start;j<=end;j++){var day=core_services_string_service_1.numberToString(j);weekDays.push({week:week.week,day:day,month:""+month,year:""+year,dayMonth:day+"/"+month,date:day+"/"+month+"/"+year,monthYear:month+"/"+year})}range.push(weekDays)}}catch(e_3_1){e_3={error:e_3_1}}finally{try{if(_c&&!_c.done&&(_a=_b.return))_a.call(_b)}finally{if(e_3)throw e_3.error}}return range};exports.weekOfYear=function(date,format){return moment(date,format).week()};exports.isDateBefore=function(startDate,endDate,type){if(type===void 0){type="day"}return moment(endDate).isBefore(startDate,type)};exports.validateDate=function(date){var aDate=moment(date,"DD/MM/YYYY",true);return aDate.isValid()};exports.setDatePicker=function(datePicker,dateFormat){$(datePicker).datepicker("option","dateFormat",dateFormat)};exports.monthYearDatePicker=function(datePicker,dateFormat,setValueCallback){$(datePicker).datepicker({changeMonth:true,changeYear:true,showButtonPanel:true,dateFormat:dateFormat,showAnim:"drop",showOn:"button",buttonImage:"src/assets/img/icons/calendar.svg",buttonImageOnly:true,buttonText:"Select period",onClose:function(){var _month=$("#ui-datepicker-div .ui-datepicker-month :selected").val();var _year=$("#ui-datepicker-div .ui-datepicker-year :selected").val();$(this).datepicker("setDate",new Date(_year,_month,1));setValueCallback(datePicker.value);setTimeout(function(){var parentCalendar=document.querySelector("#ui-datepicker-div");parentCalendar.classList.remove("only-month-year")},500)},beforeShow:function(){var parentCalendar=document.querySelector("#ui-datepicker-div");parentCalendar.classList.add("only-month-year");var selDate=$(this).val();if(selDate.length>0){var _year=parseInt(selDate.substring(selDate.length-4,selDate.length),10);var _month=parseInt(selDate.substring(0,selDate.length-5),10)-1;$(this).datepicker("option","defaultDate",new Date(_year,_month,1));$(this).datepicker("setDate",new Date(_year,_month,1));console.log(_year);console.log(_month)}}})};exports.dateFromDatePicker=function(date,format,outputFormat){if(format===void 0){format="DD/MM/YYYY"}if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment(date,format).format(outputFormat)};exports.localDateForDatePicker=function(date,outputFormat){if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment.utc(date,outputFormat).local().format(outputFormat)};exports.currentDateForDatePicker=function(dateFormat,outputFormat){if(dateFormat===void 0){dateFormat="DD/MM/YYYY"}if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment.utc(new Date,"DD/MM/YYYY").format(outputFormat)};exports.dateForDatePicker=function(month,day,year){var x=moment(new Date(year,month,day),"DD/MM/YYYY",true).toISOString().split("T")[0];x=x.split("-")[2]+"/"+x.split("-")[1]+"/"+x.split("-")[0];return x}; | ||
"use strict"; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var $ = require("jquery"); | ||
var moment = require("moment"); | ||
var moment_range_1 = require("moment-range"); | ||
var core_services_string_service_1 = require("../string/core-services-string.service"); | ||
var DateGet = /** @class */ (function () { | ||
function DateGet() { | ||
} | ||
DateGet.customDate = function (date, format) { | ||
return moment(date).format(format); | ||
}; | ||
DateGet.currentDate = function (outputFormat) { | ||
if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
return moment.utc(new Date(), outputFormat).local().format(outputFormat); | ||
}; | ||
DateGet.dayMonthYear = function (date, format) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
var x = moment(date, format, true).format(format); | ||
var d = parseInt(x.split('/')[0], 10); | ||
var m = parseInt(x.split('/')[1], 10) - 1; | ||
var y = parseInt(x.split('/')[2], 10); | ||
return { day: d, month: m, year: y }; | ||
}; | ||
DateGet.localDate = function (year, month, day, local) { | ||
if (local === void 0) { local = 'pt-BR'; } | ||
var options = { year: 'numeric', month: 'numeric', day: 'numeric' }; | ||
return new Date(year, month, day).toLocaleDateString(local, options); | ||
}; | ||
DateGet.dateFromIso = function (date, format) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
return moment.utc(date).format(format); | ||
}; | ||
DateGet.ganttDate = function (date) { | ||
var splitDate = this.dayMonthYear(date); | ||
return new Date(splitDate.year, splitDate.month, splitDate.day); | ||
}; | ||
DateGet.isoDateCustom = function (date, dateFormat, outputFormat) { | ||
var splitDate = this.dayMonthYear(date); | ||
return new Date(splitDate.year, splitDate.month, splitDate.day).toISOString(); | ||
}; | ||
DateGet.isoDate = function (date, format) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
return moment.utc(date, format).format(format); | ||
}; | ||
DateGet.isoDateWithoutTime = function (date) { | ||
var splitDate = this.dayMonthYear(date); | ||
return moment.utc(new Date(splitDate.year, splitDate.month, splitDate.day)).toISOString(); | ||
}; | ||
DateGet.dateMilliseconds = function (date, dateFormat, outputFormat) { | ||
return +moment(this.isoDateCustom(date, dateFormat, outputFormat), dateFormat).format('x'); | ||
}; | ||
DateGet.dateToMillisecondsNoTime = function (date) { | ||
return +moment(this.isoDateWithoutTime(date)).format('x'); | ||
}; | ||
DateGet.millisecondsToDate = function (date, outputFormat) { | ||
return moment.utc(date, 'x').format(outputFormat); | ||
}; | ||
DateGet.daysToMilliseconds = function (days) { | ||
return days * 24 * 60 * 60 * 1000; | ||
}; | ||
DateGet.durationInDays = function (start, end, countFirstDay) { | ||
var s = this.dayMonthYear(start); | ||
var e = this.dayMonthYear(end); | ||
var startDate = moment([s.year, s.month, s.day]); | ||
var endDate = moment([e.year, e.month, e.day]); | ||
var difference = endDate.diff(startDate, 'days'); | ||
var additional = countFirstDay ? 1 : 0; | ||
return difference + additional; | ||
}; | ||
DateGet.durationInMilliseconds = function (start, end) { | ||
return this.daysToMilliseconds(this.durationInDays(start, end, false)); | ||
}; | ||
DateGet.monthName = function (month, language) { | ||
if (language === void 0) { language = 'pt-br'; } | ||
if (language === 'pt-br' || language === 'pt-pt' || language === 'pt') { | ||
switch (month) { | ||
case 0: return 'Janeiro'; | ||
case 1: return 'Fevereiro'; | ||
case 2: return 'Março'; | ||
case 3: return 'Abril'; | ||
case 4: return 'Maio'; | ||
case 5: return 'Junho'; | ||
case 6: return 'Julho'; | ||
case 7: return 'Agosto'; | ||
case 8: return 'Setembro'; | ||
case 9: return 'Outubro'; | ||
case 10: return 'Novembro'; | ||
case 11: return 'Dezembro'; | ||
default: return ''; | ||
} | ||
} | ||
else { | ||
switch (month) { | ||
case 0: return 'January'; | ||
case 1: return 'February'; | ||
case 2: return 'March'; | ||
case 3: return 'April'; | ||
case 4: return 'May'; | ||
case 5: return 'June'; | ||
case 6: return 'July'; | ||
case 7: return 'August'; | ||
case 8: return 'September'; | ||
case 9: return 'October'; | ||
case 10: return 'November'; | ||
case 11: return 'December'; | ||
default: return ''; | ||
} | ||
} | ||
}; | ||
DateGet.weeksOfMonth = function (year, month) { | ||
var e_1, _a, e_2, _b; | ||
// @js-ignore | ||
var _moment = moment_range_1.extendMoment(moment); | ||
// Year and month are variables | ||
var startDate = moment([year, month]); | ||
// Get the first and last day of the month | ||
var firstDay = moment(startDate).startOf('month'); | ||
var endDay = moment(startDate).endOf('month'); | ||
// Create a range for the month we can iterate through | ||
var monthRange = _moment.range(firstDay, endDay); | ||
// Get all the weeks during the current month | ||
var weeks = []; | ||
var _loop_1 = function (range) { | ||
var contain = weeks.filter(function (x) { return x === range.week(); }).length > 0; | ||
if (!contain) { | ||
weeks.push(range.week()); | ||
} | ||
}; | ||
try { | ||
for (var _c = __values(monthRange.by('days')), _d = _c.next(); !_d.done; _d = _c.next()) { | ||
var range = _d.value; | ||
_loop_1(range); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (_d && !_d.done && (_a = _c.return)) _a.call(_c); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
// Create a range for each week | ||
var calendar = []; | ||
try { | ||
for (var weeks_1 = __values(weeks), weeks_1_1 = weeks_1.next(); !weeks_1_1.done; weeks_1_1 = weeks_1.next()) { | ||
var week = weeks_1_1.value; | ||
// Create a range for that week between 1st and 7th day | ||
var firstWeekDay = void 0; | ||
var lastWeekDay = void 0; | ||
var weekRange = void 0; | ||
if (month === 11 && week === 1) { | ||
firstWeekDay = moment(year + 1, 'YYYY').week(week).day(0).isAfter(firstDay) ? moment(year + 1, 'YYYY').week(week).day(0) : firstDay; | ||
lastWeekDay = moment(year + 1, 'YYYY').week(week).day(6).isBefore(endDay) ? moment(year + 1, 'YYYY').week(week).day(6) : endDay; | ||
weekRange = _moment.range(firstWeekDay, lastWeekDay); | ||
} | ||
else { | ||
firstWeekDay = moment().week(week).day(0).isAfter(firstDay) ? moment().week(week).day(0) : firstDay; | ||
lastWeekDay = moment().week(week).day(6).isBefore(endDay) ? moment().week(week).day(6) : endDay; | ||
weekRange = _moment.range(firstWeekDay, lastWeekDay); | ||
} | ||
// Add to the calendar | ||
calendar.push({ | ||
week: week, | ||
start: moment(weekRange.start.toISOString()).format('DD/MM/YYYY'), | ||
startDay: moment(weekRange.start.toISOString()).format('DD'), | ||
startMonth: moment(weekRange.start.toISOString()).format('MM'), | ||
startYear: moment(weekRange.start.toISOString()).format('YYYY'), | ||
end: moment(weekRange.end.toISOString()).format('DD/MM/YYYY'), | ||
endDay: moment(weekRange.end.toISOString()).format('DD'), | ||
endMonth: moment(weekRange.end.toISOString()).format('MM'), | ||
endYear: moment(weekRange.end.toISOString()).format('YYYY') | ||
}); | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (weeks_1_1 && !weeks_1_1.done && (_b = weeks_1.return)) _b.call(weeks_1); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
return calendar; | ||
}; | ||
DateGet.daysOfMonth = function (weeksRange) { | ||
var e_3, _a; | ||
var range = []; | ||
try { | ||
for (var _b = __values(weeksRange.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var _d = __read(_c.value, 2), i = _d[0], week = _d[1]; | ||
var start = parseInt(weeksRange[i].startDay, 10); | ||
var end = parseInt(weeksRange[i].endDay, 10); | ||
var month = weeksRange[i].startMonth; | ||
var year = weeksRange[i].startYear; | ||
var weekDays = []; | ||
for (var j = start; j <= end; j++) { | ||
var day = core_services_string_service_1.StringConverter.numberToString(j); | ||
weekDays.push({ | ||
week: week.week, | ||
day: day, | ||
month: "" + month, | ||
year: "" + year, | ||
dayMonth: day + "/" + month, | ||
date: day + "/" + month + "/" + year, | ||
monthYear: month + "/" + year, | ||
}); | ||
} | ||
range.push(weekDays); | ||
} | ||
} | ||
catch (e_3_1) { e_3 = { error: e_3_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b); | ||
} | ||
finally { if (e_3) throw e_3.error; } | ||
} | ||
return range; | ||
}; | ||
DateGet.weekOfYear = function (date, format) { | ||
return moment(date, format).week(); | ||
}; | ||
return DateGet; | ||
}()); | ||
exports.DateGet = DateGet; | ||
var DateComparable = /** @class */ (function () { | ||
function DateComparable() { | ||
} | ||
DateComparable.isDateBefore = function (startDate, endDate, type) { | ||
if (type === void 0) { type = 'day'; } | ||
return moment(endDate).isBefore(startDate, type); | ||
}; | ||
return DateComparable; | ||
}()); | ||
exports.DateComparable = DateComparable; | ||
var DateValidation = /** @class */ (function () { | ||
function DateValidation() { | ||
} | ||
DateValidation.date = function (date) { | ||
var aDate = moment(date, 'DD/MM/YYYY', true); | ||
return aDate.isValid(); | ||
}; | ||
return DateValidation; | ||
}()); | ||
exports.DateValidation = DateValidation; | ||
var DatePicker = /** @class */ (function () { | ||
function DatePicker() { | ||
} | ||
/** | ||
* Date picker utilities; | ||
* Jquery ui | ||
* This function is using Jquery and Jquery-ui and typescript is not available | ||
* To this function work is necessary the following imports, respectively: | ||
* import * as $ from 'jquery'; or import $ = require('jquery'); | ||
* import '../../../../../node_modules/jquery-ui-dist/jquery-ui.min'; | ||
*/ | ||
DatePicker.setDatePicker = function (datePicker, dateFormat) { | ||
$(datePicker).datepicker('option', 'dateFormat', dateFormat); | ||
}; | ||
DatePicker.monthYearDatePicker = function (datePicker, dateFormat, setValueCallback) { | ||
$(datePicker).datepicker({ | ||
changeMonth: true, | ||
changeYear: true, | ||
showButtonPanel: true, | ||
dateFormat: dateFormat, | ||
showAnim: 'drop', | ||
showOn: 'button', | ||
buttonImage: 'src/assets/img/icons/calendar.svg', | ||
buttonImageOnly: true, | ||
buttonText: 'Select period', | ||
onClose: function () { | ||
var _month = $('#ui-datepicker-div .ui-datepicker-month :selected').val(); | ||
var _year = $('#ui-datepicker-div .ui-datepicker-year :selected').val(); | ||
// @ts-ignore | ||
$(this).datepicker('setDate', new Date(_year, _month, 1)); | ||
setValueCallback(datePicker.value); | ||
setTimeout(function () { | ||
var parentCalendar = document.querySelector('#ui-datepicker-div'); | ||
// @ts-ignore | ||
parentCalendar.classList.remove('only-month-year'); | ||
}, 500); | ||
}, | ||
// @ts-ignore | ||
beforeShow: function () { | ||
var parentCalendar = document.querySelector('#ui-datepicker-div'); | ||
// @ts-ignore | ||
parentCalendar.classList.add('only-month-year'); | ||
var selDate = $(this).val(); | ||
// @ts-ignore | ||
if (selDate.length > 0) { | ||
// @ts-ignore | ||
var _year = parseInt(selDate.substring(selDate.length - 4, selDate.length), 10); | ||
// @ts-ignore | ||
var _month = parseInt(selDate.substring(0, selDate.length - 5), 10) - 1; | ||
$(this).datepicker('option', 'defaultDate', new Date(_year, _month, 1)); | ||
$(this).datepicker('setDate', new Date(_year, _month, 1)); | ||
console.log(_year); | ||
console.log(_month); | ||
} | ||
} | ||
}); | ||
}; | ||
DatePicker.dateFromDatePicker = function (date, format, outputFormat) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
return moment(date, format).format(outputFormat); | ||
}; | ||
DatePicker.localDateForDatePicker = function (date, outputFormat) { | ||
if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
return moment.utc(date, outputFormat).local().format(outputFormat); | ||
}; | ||
DatePicker.currentDateForDatePicker = function (dateFormat, outputFormat) { | ||
if (dateFormat === void 0) { dateFormat = 'DD/MM/YYYY'; } | ||
if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
return moment.utc(new Date(), 'DD/MM/YYYY').format(outputFormat); | ||
}; | ||
DatePicker.dateForDatePicker = function (month, day, year) { | ||
var x = moment(new Date(year, month, day), 'DD/MM/YYYY', true).toISOString().split('T')[0]; | ||
x = x.split('-')[2] + '/' + x.split('-')[1] + '/' + x.split('-')[0]; | ||
return x; | ||
}; | ||
return DatePicker; | ||
}()); | ||
exports.DatePicker = DatePicker; | ||
module.exports = { DateGet: DateGet, DateComparable: DateComparable, DateValidation: DateValidation, DatePicker: DatePicker }; | ||
//# sourceMappingURL=core-services-date.service.js.map |
@@ -1,4 +0,14 @@ | ||
/** | ||
* Remove | ||
*/ | ||
export declare const removeChildElements: (elementClassId: string | HTMLElement) => void; | ||
import { TFields } from './core-services-elements.interface'; | ||
import { IDate } from '../date/core-services-date.interface'; | ||
export declare class Remove { | ||
static childElements(elementClassId: string | HTMLElement): void; | ||
} | ||
export declare class Selector { | ||
static element(className: string): HTMLElement | null; | ||
} | ||
export declare class Highlight { | ||
static clearError(field: TFields): void; | ||
static error(fieldHighlighted: TFields): void; | ||
static invalidDate(date: IDate, input: HTMLElement): void; | ||
static setError(field: TFields): void; | ||
} |
@@ -1,1 +0,75 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.removeChildElements=function(elementClassId){if(typeof elementClassId==="string"){var element=document.querySelector(elementClassId);if(element!=null){while(element.firstChild){element.removeChild(element.firstChild)}}}else{while(elementClassId.firstChild){elementClassId.removeChild(elementClassId.firstChild)}}}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_services_date_service_1 = require("../date/core-services-date.service"); | ||
var Remove = /** @class */ (function () { | ||
function Remove() { | ||
} | ||
Remove.childElements = function (elementClassId) { | ||
if (typeof elementClassId === 'string') { | ||
var element = document.querySelector(elementClassId); | ||
if (element != null) { | ||
while (element.firstChild) { | ||
element.removeChild(element.firstChild); | ||
} | ||
} | ||
} | ||
else { | ||
while (elementClassId.firstChild) { | ||
elementClassId.removeChild(elementClassId.firstChild); | ||
} | ||
} | ||
}; | ||
return Remove; | ||
}()); | ||
exports.Remove = Remove; | ||
var Selector = /** @class */ (function () { | ||
function Selector() { | ||
} | ||
Selector.element = function (className) { | ||
return document.querySelector(className); | ||
}; | ||
return Selector; | ||
}()); | ||
exports.Selector = Selector; | ||
var Highlight = /** @class */ (function () { | ||
function Highlight() { | ||
} | ||
Highlight.clearError = function (field) { | ||
var _a; | ||
if (typeof (field) === 'object') { | ||
(_a = field) === null || _a === void 0 ? void 0 : _a.classList.remove('required-fill'); | ||
} | ||
else { | ||
if (field != null) { | ||
var currentField = document.querySelector(field); | ||
if (currentField != null) { | ||
currentField.classList.remove('required-fill'); | ||
} | ||
} | ||
} | ||
}; | ||
Highlight.error = function (fieldHighlighted) { | ||
if (fieldHighlighted != null) { | ||
fieldHighlighted.classList.add('required-fill'); | ||
fieldHighlighted.focus(); | ||
} | ||
}; | ||
Highlight.invalidDate = function (date, input) { | ||
if (core_services_date_service_1.DateValidation.date(date)) { | ||
input.classList.remove('error-highlight'); | ||
} | ||
else { | ||
input.classList.add('error-highlight'); | ||
} | ||
}; | ||
Highlight.setError = function (field) { | ||
if (field != null) { | ||
field.classList.add('required-fill'); | ||
field.focus(); | ||
} | ||
}; | ||
return Highlight; | ||
}()); | ||
exports.Highlight = Highlight; | ||
module.exports = { Remove: Remove, Selector: Selector, Highlight: Highlight }; | ||
//# sourceMappingURL=core-services-elements.service.js.map |
@@ -1,1 +0,3 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true}); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=core-services-menu.interfaces.js.map |
@@ -1,1 +0,3 @@ | ||
export declare const numberToString: (number: number) => string; | ||
export declare class StringConverter { | ||
static numberToString(number: number): string; | ||
} |
@@ -1,1 +0,66 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.numberToString=function(number){var maxLength=number.toString().length;if(maxLength<3){if(number<10){return"0"+number}else{return number.toString()}}else if(maxLength<4){if(number<10){return"00"+number}else if(number<100){return"0"+number}else{return number.toString()}}else if(maxLength<5){if(number<10){return"000"+number}else if(number<100){return"00"+number}else if(number<1e3){return"0"+number}else{return number.toString()}}else if(maxLength<6){if(number<10){return"0000"+number}else if(number<100){return"000"+number}else if(number<1e3){return"00"+number}else if(number<1e4){return"0"+number}else{return number.toString()}}else{return number.toString()}}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var StringConverter = /** @class */ (function () { | ||
function StringConverter() { | ||
} | ||
StringConverter.numberToString = function (number) { | ||
var maxLength = number.toString().length; | ||
if (maxLength < 3) { | ||
if (number < 10) { | ||
return '0' + number; | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
} | ||
else if (maxLength < 4) { | ||
if (number < 10) { | ||
return '00' + number; | ||
} | ||
else if (number < 100) { | ||
return '0' + number; | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
} | ||
else if (maxLength < 5) { | ||
if (number < 10) { | ||
return '000' + number; | ||
} | ||
else if (number < 100) { | ||
return '00' + number; | ||
} | ||
else if (number < 1000) { | ||
return '0' + number; | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
} | ||
else if (maxLength < 6) { | ||
if (number < 10) { | ||
return '0000' + number; | ||
} | ||
else if (number < 100) { | ||
return '000' + number; | ||
} | ||
else if (number < 1000) { | ||
return '00' + number; | ||
} | ||
else if (number < 10000) { | ||
return '0' + number; | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
} | ||
else { | ||
return number.toString(); | ||
} | ||
}; | ||
return StringConverter; | ||
}()); | ||
exports.StringConverter = StringConverter; | ||
module.exports = { StringConverter: StringConverter }; | ||
//# sourceMappingURL=core-services-string.service.js.map |
{ | ||
"name": "gl-w-frontend", | ||
"version": "1.3.10", | ||
"version": "1.4.0-alpha", | ||
"description": "Common code for using among web front-end development such as pure JavaScript, ES6+ and TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "lib/", |
# gl-w-frontend # | ||
[![version](https://img.shields.io/badge/version-1.3.10-green.svg)](https://www.npmjs.com/package/gl-w-frontend) | ||
[![version](https://img.shields.io/badge/version-1.4.0-aplha-green.svg)](https://www.npmjs.com/package/gl-w-frontend) | ||
@@ -4,0 +4,0 @@ ### What is this repository for? ### |
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
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
81
2357
3
160362
1