gl-w-frontend
Advanced tools
Comparing version 1.4.0 to 1.4.1-alpha
@@ -9,1 +9,2 @@ import 'node_modules/jquery-ui-dist/jquery-ui.min'; | ||
export * from './scripts/core/services/string/core-services-string.service'; | ||
export * from './scripts/core/services/url/core-services-url.service'; |
@@ -9,2 +9,3 @@ import 'node_modules/jquery-ui-dist/jquery-ui.min'; | ||
export * from './scripts/core/services/string/core-services-string.service'; | ||
export * from './scripts/core/services/url/core-services-url.service'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,6 +0,9 @@ | ||
export declare class ArrayRemove { | ||
static duplicateLegacy(array: any[]): any[]; | ||
declare class Remove { | ||
duplicateLegacy(array: any[]): any[]; | ||
} | ||
export declare class ArraySort { | ||
static byKey(array: any[], key: string, asc: boolean): PromiseLike<any[]>; | ||
export declare const ArrayRemove: Remove; | ||
declare class Sort { | ||
byKey(array: any[], key: string, asc: boolean): PromiseLike<any[]>; | ||
} | ||
export declare const ArraySort: Sort; | ||
export {}; |
@@ -1,5 +0,5 @@ | ||
var ArrayRemove = /** @class */ (function () { | ||
function ArrayRemove() { | ||
var Remove = /** @class */ (function () { | ||
function Remove() { | ||
} | ||
ArrayRemove.duplicateLegacy = function (array) { | ||
Remove.prototype.duplicateLegacy = function (array) { | ||
var unique = array.filter(function (item, index) { | ||
@@ -10,9 +10,10 @@ return array.indexOf(item) === index; | ||
}; | ||
return ArrayRemove; | ||
return Remove; | ||
}()); | ||
export { ArrayRemove }; | ||
var ArraySort = /** @class */ (function () { | ||
function ArraySort() { | ||
// tslint:disable-next-line:variable-name | ||
export var ArrayRemove = new Remove(); | ||
var Sort = /** @class */ (function () { | ||
function Sort() { | ||
} | ||
ArraySort.byKey = function (array, key, asc) { | ||
Sort.prototype.byKey = function (array, key, asc) { | ||
return new Promise(function (resolve) { | ||
@@ -28,6 +29,6 @@ var _asc = asc ? 1 : -1; | ||
}; | ||
return ArraySort; | ||
return Sort; | ||
}()); | ||
export { ArraySort }; | ||
module.exports = { ArrayRemove: ArrayRemove, ArraySort: ArraySort }; | ||
// tslint:disable-next-line:variable-name | ||
export var ArraySort = new Sort(); | ||
//# sourceMappingURL=core-services-array.service.js.map |
@@ -1,12 +0,20 @@ | ||
export declare class AttachmentConvert { | ||
static textFileToUrlImage(file: File): PromiseLike<string>; | ||
declare class Convert { | ||
textFileToUrlImage(file: File): PromiseLike<string>; | ||
} | ||
export declare class AttachmentParser { | ||
static parseAcceptFiles(accepts: string): string[]; | ||
export declare const AttachmentConvert: Convert; | ||
declare class Clean { | ||
cleanAttachmentText(string: string): string; | ||
} | ||
export declare class AttachmentValidate { | ||
static file(input: HTMLInputElement, accepts: string[]): boolean; | ||
static fileSize(input: HTMLInputElement): boolean; | ||
export declare const AttachmentClean: Clean; | ||
declare class Parser { | ||
parseAcceptFiles(accepts: string): string[]; | ||
} | ||
export declare const AttachmentParser: Parser; | ||
declare class Validate { | ||
file(input: HTMLInputElement, accepts: string[]): boolean; | ||
fileSize(input: HTMLInputElement): boolean; | ||
/** The user must include the attribute 'data-maxsize' in mb(megabyte); */ | ||
static maxSize: (input: HTMLInputElement) => number; | ||
maxSize: (input: HTMLInputElement) => number; | ||
} | ||
export declare const AttachmentValidate: Validate; | ||
export {}; |
@@ -12,6 +12,6 @@ var __values = (this && this.__values) || function(o) { | ||
}; | ||
var AttachmentConvert = /** @class */ (function () { | ||
function AttachmentConvert() { | ||
var Convert = /** @class */ (function () { | ||
function Convert() { | ||
} | ||
AttachmentConvert.textFileToUrlImage = function (file) { | ||
Convert.prototype.textFileToUrlImage = function (file) { | ||
return new Promise(function (resolve) { | ||
@@ -25,9 +25,181 @@ var fileReader = new FileReader(); | ||
}; | ||
return AttachmentConvert; | ||
return Convert; | ||
}()); | ||
export { AttachmentConvert }; | ||
var AttachmentParser = /** @class */ (function () { | ||
function AttachmentParser() { | ||
// tslint:disable-next-line:variable-name | ||
export var AttachmentConvert = new Convert(); | ||
var Clean = /** @class */ (function () { | ||
function Clean() { | ||
} | ||
AttachmentParser.parseAcceptFiles = function (accepts) { | ||
Clean.prototype.cleanAttachmentText = function (string) { | ||
return string | ||
.replace(/€/g, '') | ||
.replace(/`/g, '') | ||
.replace(/„/g, '') | ||
.replace(/…/g, '') | ||
.replace(/†/g, '') | ||
.replace(/‡/g, '') | ||
.replace(/ˆ/g, '') | ||
.replace(/‰/g, '') | ||
.replace(/Š/g, '') | ||
.replace(/‹/g, '') | ||
.replace(/Œ/g, '') | ||
.replace(//g, '') | ||
.replace(/Ž/g, '') | ||
.replace(//g, '') | ||
.replace(/‘/g, '') | ||
.replace(/’/g, '') | ||
.replace(/“/g, '') | ||
.replace(/”/g, '') | ||
.replace(/•/g, '') | ||
.replace(/˜/g, '') | ||
.replace(/™/g, '') | ||
.replace(/š/g, '') | ||
.replace(/›/g, '') | ||
.replace(/œ/g, '') | ||
.replace(/ž/g, '') | ||
.replace(/Ÿ/g, '') | ||
.replace(/¢/g, '') | ||
.replace(/£/g, '') | ||
.replace(/¤/g, '') | ||
.replace(/¥/g, '') | ||
.replace(/¦/g, '') | ||
.replace(/§/g, '') | ||
.replace(/¨/g, '') | ||
.replace(/©/g, '') | ||
.replace(/ª/g, '') | ||
.replace(/«/g, '') | ||
.replace(/¬/g, '') | ||
.replace(/®/g, '') | ||
.replace(/¯/g, '') | ||
.replace(/°/g, '') | ||
.replace(/±/g, '') | ||
.replace(/²/g, '') | ||
.replace(/³/g, '') | ||
.replace(/´/g, '') | ||
.replace(/µ/g, '') | ||
.replace(/¶/g, '') | ||
.replace(/·/g, '') | ||
.replace(/¹/g, '') | ||
.replace(/º/g, '') | ||
.replace(/»/g, '') | ||
.replace(/¼/g, '') | ||
.replace(/½/g, '') | ||
.replace(/¾/g, '') | ||
.replace(/¿/g, '') | ||
.replace(/Å/g, 'A') | ||
.replace(/Æ/g, 'A') | ||
.replace(/Ð/g, 'D') | ||
.replace(/Ø/g, 'O') | ||
.replace(/ß/g, 'B') | ||
.replace(/æ/g, 'a') | ||
.replace(/÷/g, '') | ||
.replace(/ø/g, 'o') | ||
.replace(/þ/g, 'b') | ||
.replace(/!/g, '') | ||
.replace(/"/g, '') | ||
.replace(/#/g, '') | ||
.replace(/\$/g, '') | ||
.replace(/%/g, '') | ||
.replace(/&/g, '') | ||
.replace(/'/g, '') | ||
.replace(/\(/g, '') | ||
.replace(/\)/g, '') | ||
.replace(/\*/g, '') | ||
.replace(/\+/g, '') | ||
.replace(/\//g, '') | ||
.replace(/:/g, '') | ||
.replace(/;/g, '') | ||
.replace(/</g, '') | ||
.replace(/=/g, '') | ||
.replace(/>/g, '') | ||
.replace(/\?/g, '') | ||
.replace(/@/g, '') | ||
.replace(/\[/g, '') | ||
.replace(/\\/g, '') | ||
.replace(/]/g, '') | ||
.replace(/\^/g, '') | ||
.replace(/_/g, '') | ||
.replace(/`/g, '') | ||
.replace(/{/g, '') | ||
.replace(/\|/g, '') | ||
.replace(/}/g, '') | ||
.replace(/~/g, '') | ||
.replace(/`/g, '') | ||
.replace(//g, '') | ||
.replace(/ƒ/g, 'f') | ||
.replace(/„/g, '') | ||
.replace(/…/g, '') | ||
.replace(/†/g, '') | ||
.replace(/‡/g, '') | ||
.replace(/ˆ/g, '') | ||
.replace(/‰/g, '') | ||
.replace(/Š/g, '') | ||
.replace(/‹/g, '') | ||
.replace(/Œ/g, '') | ||
.replace(//g, '') | ||
.replace(/Ž/g, 'Z') | ||
.replace(//g, '') | ||
.replace(//g, '') | ||
.replace(/‘/g, '') | ||
.replace(/’/g, '') | ||
.replace(/“/g, '') | ||
.replace(/”/g, '') | ||
.replace(/•/g, '') | ||
.replace(/–/g, '') | ||
.replace(/—/g, '') | ||
.replace(/˜/g, '') | ||
.replace(/™/g, '') | ||
.replace(/š/g, '') | ||
.replace(/›/g, '') | ||
.replace(/œ/g, '') | ||
.replace(//g, '') | ||
.replace(/ž/g, 'z') | ||
.replace(/Ÿ/g, 'Y') | ||
.replace(/¡/g, '') | ||
.replace(/¢/g, 'c') | ||
.replace(/£/g, '') | ||
.replace(/¤/g, '') | ||
.replace(/¥/g, 'Y') | ||
.replace(/¦/g, '') | ||
.replace(/§/g, '') | ||
.replace(/¨/g, '') | ||
.replace(/©/g, '') | ||
.replace(/ª/g, '') | ||
.replace(/«/g, '') | ||
.replace(/¬/g, '') | ||
.replace(/®/g, '') | ||
.replace(/¯/g, '') | ||
.replace(/°/g, '') | ||
.replace(/±/g, '') | ||
.replace(/²/g, '2') | ||
.replace(/³/g, '3') | ||
.replace(/´/g, '') | ||
.replace(/µ/g, 'u') | ||
.replace(/¶/g, '') | ||
.replace(/·/g, '') | ||
.replace(/¹/g, '1') | ||
.replace(/º/g, '') | ||
.replace(/»/g, '') | ||
.replace(/¼/g, '') | ||
.replace(/½/g, '') | ||
.replace(/¾/g, '') | ||
.replace(/¿/g, '') | ||
.replace(/Ð/g, 'D') | ||
.replace(/ß/g, 'B') | ||
.replace(/æ/g, 'a') | ||
.replace(/÷/g, '') | ||
.replace(/ø/g, 'o') | ||
.replace(/þ/g, 'b') | ||
.replace(/&/g, '') | ||
.replace(/</g, '') | ||
.replace(/>/g, ''); | ||
}; | ||
return Clean; | ||
}()); | ||
// tslint:disable-next-line:variable-name | ||
export var AttachmentClean = new Clean(); | ||
var Parser = /** @class */ (function () { | ||
function Parser() { | ||
} | ||
Parser.prototype.parseAcceptFiles = function (accepts) { | ||
return accepts | ||
@@ -40,9 +212,20 @@ .replace(/image\//g, '') | ||
}; | ||
return AttachmentParser; | ||
return Parser; | ||
}()); | ||
export { AttachmentParser }; | ||
var AttachmentValidate = /** @class */ (function () { | ||
function AttachmentValidate() { | ||
// tslint:disable-next-line:variable-name | ||
export var AttachmentParser = new Parser(); | ||
var Validate = /** @class */ (function () { | ||
function Validate() { | ||
/** The user must include the attribute 'data-maxsize' in mb(megabyte); */ | ||
this.maxSize = function (input) { | ||
var fileName = input.attributes['data-maxsize'].nodeValue; | ||
if (fileName) { | ||
return parseInt(fileName, 10); | ||
} | ||
else { | ||
return 1024 * 45; | ||
} | ||
}; | ||
} | ||
AttachmentValidate.file = function (input, accepts) { | ||
Validate.prototype.file = function (input, accepts) { | ||
var e_1, _a; | ||
@@ -72,3 +255,3 @@ var fileName = input.value; | ||
}; | ||
AttachmentValidate.fileSize = function (input) { | ||
Validate.prototype.fileSize = function (input) { | ||
if (input != null && input.files != null) { | ||
@@ -84,16 +267,6 @@ var fileSize = input.files[0].size / 1024; | ||
}; | ||
/** 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; | ||
return Validate; | ||
}()); | ||
export { AttachmentValidate }; | ||
module.exports = { AttachmentConvert: AttachmentConvert, AttachmentParser: AttachmentParser, AttachmentValidate: AttachmentValidate }; | ||
// tslint:disable-next-line:variable-name | ||
export var AttachmentValidate = new Validate(); | ||
//# sourceMappingURL=core-services-attachment.service.js.map |
import { IFullScreenAlt, IFullScreenSrc, IMenuButton } from '../menu/core-services-menu.interfaces'; | ||
import { IFullscreenResult } from './core-services-browser.interfaces'; | ||
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; | ||
declare class FullScreen { | ||
listener(menuButton: IMenuButton, alt: IFullScreenAlt, src: IFullScreenSrc, showLog?: boolean): void; | ||
disableListener(): void; | ||
toggle(menuButton: IMenuButton, alt: IFullScreenAlt, src: IFullScreenSrc, showLog?: boolean): PromiseLike<IFullscreenResult>; | ||
available(): boolean; | ||
} | ||
export declare class BrowserVersion { | ||
static isIE(): boolean; | ||
static isBeforeIE11(): boolean; | ||
export declare const BrowserFullScreen: FullScreen; | ||
declare class Version { | ||
isIE(): boolean; | ||
isBeforeIE11(): boolean; | ||
} | ||
export declare const BrowserVersion: Version; | ||
export {}; |
import * as screenfull from 'screenfull'; | ||
var BrowserFullScreen = /** @class */ (function () { | ||
function BrowserFullScreen() { | ||
var FullScreen = /** @class */ (function () { | ||
function FullScreen() { | ||
} | ||
BrowserFullScreen.listener = function (menuButton, alt, src, showLog) { | ||
FullScreen.prototype.listener = function (menuButton, alt, src, showLog) { | ||
if (showLog === void 0) { showLog = false; } | ||
@@ -29,3 +29,3 @@ if (screenfull.isEnabled) { | ||
}; | ||
BrowserFullScreen.disableListener = function () { | ||
FullScreen.prototype.disableListener = function () { | ||
// @ts-ignore | ||
@@ -36,3 +36,3 @@ screenfull.off('change', function () { | ||
}; | ||
BrowserFullScreen.toggle = function (menuButton, alt, src, showLog) { | ||
FullScreen.prototype.toggle = function (menuButton, alt, src, showLog) { | ||
if (showLog === void 0) { showLog = false; } | ||
@@ -70,12 +70,13 @@ return new Promise(function (resolve, reject) { | ||
}; | ||
BrowserFullScreen.available = function () { | ||
FullScreen.prototype.available = function () { | ||
return screenfull.isEnabled; | ||
}; | ||
return BrowserFullScreen; | ||
return FullScreen; | ||
}()); | ||
export { BrowserFullScreen }; | ||
var BrowserVersion = /** @class */ (function () { | ||
function BrowserVersion() { | ||
// tslint:disable-next-line:variable-name | ||
export var BrowserFullScreen = new FullScreen(); | ||
var Version = /** @class */ (function () { | ||
function Version() { | ||
} | ||
BrowserVersion.isIE = function () { | ||
Version.prototype.isIE = function () { | ||
var ua = window.navigator.userAgent; | ||
@@ -85,9 +86,9 @@ var msie = ua.indexOf('MSIE '); | ||
}; | ||
BrowserVersion.isBeforeIE11 = function () { | ||
Version.prototype.isBeforeIE11 = function () { | ||
return navigator.appVersion.indexOf('MSIE 10') !== -1; | ||
}; | ||
return BrowserVersion; | ||
return Version; | ||
}()); | ||
export { BrowserVersion }; | ||
module.exports = { BrowserFullScreen: BrowserFullScreen, BrowserVersion: BrowserVersion }; | ||
// tslint:disable-next-line:variable-name | ||
export var BrowserVersion = new Version(); | ||
//# sourceMappingURL=core-services-browser.service.js.map |
import { IComboBoxData } from './core-services-combobox.interface'; | ||
export declare class ComboBoxCore { | ||
declare class Core { | ||
/** This function is using Jquery and Jquery-ui and typescript is not available | ||
@@ -8,10 +8,14 @@ * To this function work is necessary the following imports, respectively: | ||
*/ | ||
static initialize(combobox: HTMLSelectElement, callback: any, invalidCallback: any): void; | ||
static loadData(combobox: HTMLSelectElement, data: IComboBoxData[], keepValue: boolean): PromiseLike<HTMLSelectElement | null>; | ||
initialize(combobox: HTMLSelectElement, callback: any, invalidCallback: any): void; | ||
loadData(combobox: HTMLSelectElement, data: IComboBoxData[], keepValue: boolean): PromiseLike<HTMLSelectElement | null>; | ||
} | ||
export declare class ComboBoxData { | ||
static byValue(arrayData: IComboBoxData[], value: string): string; | ||
export declare const ComboBoxCore: Core; | ||
declare class Data { | ||
byValue(arrayData: IComboBoxData[], value: string): string; | ||
} | ||
export declare class ComboBoxDom { | ||
static disableInput(combobox: HTMLSelectElement, disable: boolean): void; | ||
export declare const ComboBoxData: Data; | ||
declare class Dom { | ||
disableInput(combobox: HTMLSelectElement, disable: boolean): void; | ||
} | ||
export declare const ComboBoxDom: Dom; | ||
export {}; |
import * as $ from 'jquery'; | ||
// 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() { | ||
import { ElementRemove } from '../elements/core-services-elements.service'; | ||
var Core = /** @class */ (function () { | ||
function Core() { | ||
} | ||
@@ -13,3 +11,3 @@ /** This function is using Jquery and Jquery-ui and typescript is not available | ||
*/ | ||
ComboBoxCore.initialize = function (combobox, callback, invalidCallback) { | ||
Core.prototype.initialize = function (combobox, callback, invalidCallback) { | ||
$.widget('custom.combobox', { | ||
@@ -171,3 +169,3 @@ _create: function () { | ||
}; | ||
ComboBoxCore.loadData = function (combobox, data, keepValue) { | ||
Core.prototype.loadData = function (combobox, data, keepValue) { | ||
return new Promise(function (resolve) { | ||
@@ -177,3 +175,3 @@ var parent = combobox.parentNode; | ||
var comboboxInput = parent.querySelector('input.custom-combobox-input'); | ||
Remove.childElements(combobox); | ||
ElementRemove.childElements(combobox); | ||
if (!keepValue) { | ||
@@ -200,9 +198,10 @@ combobox.value = ''; | ||
}; | ||
return ComboBoxCore; | ||
return Core; | ||
}()); | ||
export { ComboBoxCore }; | ||
var ComboBoxData = /** @class */ (function () { | ||
function ComboBoxData() { | ||
// tslint:disable-next-line:variable-name | ||
export var ComboBoxCore = new Core(); | ||
var Data = /** @class */ (function () { | ||
function Data() { | ||
} | ||
ComboBoxData.byValue = function (arrayData, value) { | ||
Data.prototype.byValue = function (arrayData, value) { | ||
var tempActionPlan = arrayData.filter(function (x) { return x.value === value; }); | ||
@@ -216,9 +215,10 @@ if (value == null || tempActionPlan.length === 0) { | ||
}; | ||
return ComboBoxData; | ||
return Data; | ||
}()); | ||
export { ComboBoxData }; | ||
var ComboBoxDom = /** @class */ (function () { | ||
function ComboBoxDom() { | ||
// tslint:disable-next-line:variable-name | ||
export var ComboBoxData = new Data(); | ||
var Dom = /** @class */ (function () { | ||
function Dom() { | ||
} | ||
ComboBoxDom.disableInput = function (combobox, disable) { | ||
Dom.prototype.disableInput = function (combobox, disable) { | ||
var parent = combobox.parentNode; | ||
@@ -246,6 +246,6 @@ var input = parent.querySelector('input'); | ||
}; | ||
return ComboBoxDom; | ||
return Dom; | ||
}()); | ||
export { ComboBoxDom }; | ||
module.exports = { ComboBoxCore: ComboBoxCore, ComboBoxData: ComboBoxData, ComboBoxDom: ComboBoxDom }; | ||
// tslint:disable-next-line:variable-name | ||
export var ComboBoxDom = new Dom(); | ||
//# sourceMappingURL=core-services-combobox.service.js.map |
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; | ||
declare class Get { | ||
customDate(date: IDate, format: string): string; | ||
currentDate(outputFormat?: string): string; | ||
dayMonthYear(date: IDate, format?: string): IDayMonthYear; | ||
localDate(year: number, month: number, day: number, local?: IDateLocal): string; | ||
dateFromIso(date: IDate, format?: string): string; | ||
ganttDate(date: IDate): Date; | ||
isoDateCustom(date: IDate, dateFormat: string, outputFormat: string): string; | ||
isoDate(date: IDate, format?: string): string; | ||
isoDateWithoutTime(date: IDate): string; | ||
dateMilliseconds(date: IDate, dateFormat: string, outputFormat: string): number; | ||
dateToMillisecondsNoTime(date: IDate): number; | ||
millisecondsToDate(date: IDate, 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): IWeeksOfMonth[]; | ||
daysOfMonth(weeksRange: IWeeksOfMonth[]): IDaysOfMonth[][]; | ||
weekOfYear(date: string, format: string): number; | ||
} | ||
export declare class DateComparable { | ||
static isDateBefore(startDate: string, endDate: string, type?: IUnityOfTime): boolean; | ||
export declare const DateGet: Get; | ||
declare class Comparable { | ||
isDateBefore(startDate: string, endDate: string, type?: IUnityOfTime): boolean; | ||
} | ||
export declare class DateValidation { | ||
static date(date: IDate): boolean; | ||
export declare const DateComparable: Comparable; | ||
declare class Validation { | ||
date(date: IDate): boolean; | ||
} | ||
export declare class DatePicker { | ||
export declare const DateValidation: Validation; | ||
declare class Picker { | ||
/** | ||
@@ -38,8 +41,10 @@ * Date picker utilities; | ||
*/ | ||
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; | ||
setDatePicker(datePicker: HTMLInputElement, dateFormat: string): void; | ||
monthYearDatePicker(datePicker: HTMLInputElement, dateFormat: string, setValueCallback: any): void; | ||
dateFromDatePicker(date: IDate, format?: string, outputFormat?: string): string; | ||
localDateForDatePicker(date: IDate, outputFormat?: string): string; | ||
currentDateForDatePicker(dateFormat?: string, outputFormat?: string): string; | ||
dateForDatePicker(month: number, day: number, year: number): string; | ||
} | ||
export declare const DatePicker: Picker; | ||
export {}; |
@@ -32,13 +32,13 @@ var __values = (this && this.__values) || function(o) { | ||
import { StringConverter } from '../string/core-services-string.service'; | ||
var DateGet = /** @class */ (function () { | ||
function DateGet() { | ||
var Get = /** @class */ (function () { | ||
function Get() { | ||
} | ||
DateGet.customDate = function (date, format) { | ||
Get.prototype.customDate = function (date, format) { | ||
return moment(date).format(format); | ||
}; | ||
DateGet.currentDate = function (outputFormat) { | ||
Get.prototype.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) { | ||
Get.prototype.dayMonthYear = function (date, format) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
@@ -51,3 +51,3 @@ var x = moment(date, format, true).format(format); | ||
}; | ||
DateGet.localDate = function (year, month, day, local) { | ||
Get.prototype.localDate = function (year, month, day, local) { | ||
if (local === void 0) { local = 'pt-BR'; } | ||
@@ -57,35 +57,35 @@ var options = { year: 'numeric', month: 'numeric', day: 'numeric' }; | ||
}; | ||
DateGet.dateFromIso = function (date, format) { | ||
Get.prototype.dateFromIso = function (date, format) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
return moment.utc(date).format(format); | ||
}; | ||
DateGet.ganttDate = function (date) { | ||
Get.prototype.ganttDate = function (date) { | ||
var splitDate = this.dayMonthYear(date); | ||
return new Date(splitDate.year, splitDate.month, splitDate.day); | ||
}; | ||
DateGet.isoDateCustom = function (date, dateFormat, outputFormat) { | ||
Get.prototype.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) { | ||
Get.prototype.isoDate = function (date, format) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
return moment.utc(date, format).format(format); | ||
}; | ||
DateGet.isoDateWithoutTime = function (date) { | ||
Get.prototype.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) { | ||
Get.prototype.dateMilliseconds = function (date, dateFormat, outputFormat) { | ||
return +moment(this.isoDateCustom(date, dateFormat, outputFormat), dateFormat).format('x'); | ||
}; | ||
DateGet.dateToMillisecondsNoTime = function (date) { | ||
Get.prototype.dateToMillisecondsNoTime = function (date) { | ||
return +moment(this.isoDateWithoutTime(date)).format('x'); | ||
}; | ||
DateGet.millisecondsToDate = function (date, outputFormat) { | ||
Get.prototype.millisecondsToDate = function (date, outputFormat) { | ||
return moment.utc(date, 'x').format(outputFormat); | ||
}; | ||
DateGet.daysToMilliseconds = function (days) { | ||
Get.prototype.daysToMilliseconds = function (days) { | ||
return days * 24 * 60 * 60 * 1000; | ||
}; | ||
DateGet.durationInDays = function (start, end, countFirstDay) { | ||
Get.prototype.durationInDays = function (start, end, countFirstDay) { | ||
var s = this.dayMonthYear(start); | ||
@@ -99,6 +99,6 @@ var e = this.dayMonthYear(end); | ||
}; | ||
DateGet.durationInMilliseconds = function (start, end) { | ||
Get.prototype.durationInMilliseconds = function (start, end) { | ||
return this.daysToMilliseconds(this.durationInDays(start, end, false)); | ||
}; | ||
DateGet.monthName = function (month, language) { | ||
Get.prototype.monthName = function (month, language) { | ||
if (language === void 0) { language = 'pt-br'; } | ||
@@ -140,3 +140,3 @@ if (language === 'pt-br' || language === 'pt-pt' || language === 'pt') { | ||
}; | ||
DateGet.weeksOfMonth = function (year, month) { | ||
Get.prototype.weeksOfMonth = function (year, month) { | ||
var e_1, _a, e_2, _b; | ||
@@ -215,3 +215,3 @@ // @js-ignore | ||
}; | ||
DateGet.daysOfMonth = function (weeksRange) { | ||
Get.prototype.daysOfMonth = function (weeksRange) { | ||
var e_3, _a; | ||
@@ -251,30 +251,33 @@ var range = []; | ||
}; | ||
DateGet.weekOfYear = function (date, format) { | ||
Get.prototype.weekOfYear = function (date, format) { | ||
return moment(date, format).week(); | ||
}; | ||
return DateGet; | ||
return Get; | ||
}()); | ||
export { DateGet }; | ||
var DateComparable = /** @class */ (function () { | ||
function DateComparable() { | ||
// tslint:disable-next-line:variable-name | ||
export var DateGet = new Get(); | ||
var Comparable = /** @class */ (function () { | ||
function Comparable() { | ||
} | ||
DateComparable.isDateBefore = function (startDate, endDate, type) { | ||
Comparable.prototype.isDateBefore = function (startDate, endDate, type) { | ||
if (type === void 0) { type = 'day'; } | ||
return moment(endDate).isBefore(startDate, type); | ||
}; | ||
return DateComparable; | ||
return Comparable; | ||
}()); | ||
export { DateComparable }; | ||
var DateValidation = /** @class */ (function () { | ||
function DateValidation() { | ||
// tslint:disable-next-line:variable-name | ||
export var DateComparable = new Comparable(); | ||
var Validation = /** @class */ (function () { | ||
function Validation() { | ||
} | ||
DateValidation.date = function (date) { | ||
Validation.prototype.date = function (date) { | ||
var aDate = moment(date, 'DD/MM/YYYY', true); | ||
return aDate.isValid(); | ||
}; | ||
return DateValidation; | ||
return Validation; | ||
}()); | ||
export { DateValidation }; | ||
var DatePicker = /** @class */ (function () { | ||
function DatePicker() { | ||
// tslint:disable-next-line:variable-name | ||
export var DateValidation = new Validation(); | ||
var Picker = /** @class */ (function () { | ||
function Picker() { | ||
} | ||
@@ -289,6 +292,6 @@ /** | ||
*/ | ||
DatePicker.setDatePicker = function (datePicker, dateFormat) { | ||
Picker.prototype.setDatePicker = function (datePicker, dateFormat) { | ||
$(datePicker).datepicker('option', 'dateFormat', dateFormat); | ||
}; | ||
DatePicker.monthYearDatePicker = function (datePicker, dateFormat, setValueCallback) { | ||
Picker.prototype.monthYearDatePicker = function (datePicker, dateFormat, setValueCallback) { | ||
$(datePicker).datepicker({ | ||
@@ -336,3 +339,3 @@ changeMonth: true, | ||
}; | ||
DatePicker.dateFromDatePicker = function (date, format, outputFormat) { | ||
Picker.prototype.dateFromDatePicker = function (date, format, outputFormat) { | ||
if (format === void 0) { format = 'DD/MM/YYYY'; } | ||
@@ -342,7 +345,7 @@ if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
}; | ||
DatePicker.localDateForDatePicker = function (date, outputFormat) { | ||
Picker.prototype.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) { | ||
Picker.prototype.currentDateForDatePicker = function (dateFormat, outputFormat) { | ||
if (dateFormat === void 0) { dateFormat = 'DD/MM/YYYY'; } | ||
@@ -352,3 +355,3 @@ if (outputFormat === void 0) { outputFormat = 'DD/MM/YYYY'; } | ||
}; | ||
DatePicker.dateForDatePicker = function (month, day, year) { | ||
Picker.prototype.dateForDatePicker = function (month, day, year) { | ||
var x = moment(new Date(year, month, day), 'DD/MM/YYYY', true).toISOString().split('T')[0]; | ||
@@ -358,6 +361,6 @@ x = x.split('-')[2] + '/' + x.split('-')[1] + '/' + x.split('-')[0]; | ||
}; | ||
return DatePicker; | ||
return Picker; | ||
}()); | ||
export { DatePicker }; | ||
module.exports = { DateGet: DateGet, DateComparable: DateComparable, DateValidation: DateValidation, DatePicker: DatePicker }; | ||
// tslint:disable-next-line:variable-name | ||
export var DatePicker = new Picker(); | ||
//# sourceMappingURL=core-services-date.service.js.map |
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; | ||
declare class Remove { | ||
childElements(elementClassId: string | HTMLElement): void; | ||
} | ||
export declare class Selector { | ||
static element(className: string): HTMLElement | null; | ||
export declare const ElementRemove: Remove; | ||
declare class Selector { | ||
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; | ||
export declare const ElementSelector: Selector; | ||
declare class Highlight { | ||
clearError(field: TFields): void; | ||
error(fieldHighlighted: TFields): void; | ||
invalidDate(date: IDate, input: HTMLElement): void; | ||
setError(field: TFields): void; | ||
} | ||
export declare const ElementHighlight: Highlight; | ||
export {}; |
@@ -5,3 +5,3 @@ import { DateValidation } from '../date/core-services-date.service'; | ||
} | ||
Remove.childElements = function (elementClassId) { | ||
Remove.prototype.childElements = function (elementClassId) { | ||
if (typeof elementClassId === 'string') { | ||
@@ -23,7 +23,8 @@ var element = document.querySelector(elementClassId); | ||
}()); | ||
export { Remove }; | ||
// tslint:disable-next-line:variable-name | ||
export var ElementRemove = new Remove(); | ||
var Selector = /** @class */ (function () { | ||
function Selector() { | ||
} | ||
Selector.element = function (className) { | ||
Selector.prototype.element = function (className) { | ||
return document.querySelector(className); | ||
@@ -33,7 +34,8 @@ }; | ||
}()); | ||
export { Selector }; | ||
// tslint:disable-next-line:variable-name | ||
export var ElementSelector = new Selector(); | ||
var Highlight = /** @class */ (function () { | ||
function Highlight() { | ||
} | ||
Highlight.clearError = function (field) { | ||
Highlight.prototype.clearError = function (field) { | ||
var _a; | ||
@@ -52,3 +54,3 @@ if (typeof (field) === 'object') { | ||
}; | ||
Highlight.error = function (fieldHighlighted) { | ||
Highlight.prototype.error = function (fieldHighlighted) { | ||
if (fieldHighlighted != null) { | ||
@@ -59,3 +61,3 @@ fieldHighlighted.classList.add('required-fill'); | ||
}; | ||
Highlight.invalidDate = function (date, input) { | ||
Highlight.prototype.invalidDate = function (date, input) { | ||
if (DateValidation.date(date)) { | ||
@@ -68,3 +70,3 @@ input.classList.remove('error-highlight'); | ||
}; | ||
Highlight.setError = function (field) { | ||
Highlight.prototype.setError = function (field) { | ||
if (field != null) { | ||
@@ -77,4 +79,4 @@ field.classList.add('required-fill'); | ||
}()); | ||
export { Highlight }; | ||
module.exports = { Remove: Remove, Selector: Selector, Highlight: Highlight }; | ||
// tslint:disable-next-line:variable-name | ||
export var ElementHighlight = new Highlight(); | ||
//# sourceMappingURL=core-services-elements.service.js.map |
@@ -1,3 +0,19 @@ | ||
export declare class StringConverter { | ||
static numberToString(number: number): string; | ||
declare class Clean { | ||
trim(text: string): string; | ||
trimLeft(text: string): string; | ||
trimRight(text: string): string; | ||
trimBetween(text: string): string; | ||
trimMiddle(text: string): string; | ||
cleanText(string: string): string; | ||
} | ||
export declare const StringClean: Clean; | ||
declare class Converter { | ||
currencyToNumber(num: number, decimal?: string, currency?: string): number; | ||
formatNumber(num: number, decimal?: string): string; | ||
numberToString(number: number): string; | ||
stringToBoolean(value: string): boolean; | ||
stringUnicode(string: string): string; | ||
titleCase(string: string): string; | ||
} | ||
export declare const StringConverter: Converter; | ||
export {}; |
@@ -1,5 +0,89 @@ | ||
var StringConverter = /** @class */ (function () { | ||
function StringConverter() { | ||
import { UrlDecode } from '../url/core-services-url.service'; | ||
var Clean = /** @class */ (function () { | ||
function Clean() { | ||
} | ||
StringConverter.numberToString = function (number) { | ||
Clean.prototype.trim = function (text) { | ||
if (text == null) { | ||
return ''; | ||
} | ||
else { | ||
var between = /^\s*|\s*$/g; // remove space from start and end | ||
var middle = /\s\s+/g; // remove space from middle | ||
return text | ||
.replace(between, '') | ||
.replace(middle, ' '); | ||
} | ||
}; | ||
Clean.prototype.trimLeft = function (text) { | ||
if (text == null) { | ||
return ''; | ||
} | ||
else { | ||
var between = /^\s*/g; // remove space from start | ||
return text.replace(between, ''); | ||
} | ||
}; | ||
Clean.prototype.trimRight = function (text) { | ||
if (text == null) { | ||
return ''; | ||
} | ||
else { | ||
var between = /\s*$/g; // remove space from end | ||
return text.replace(between, ''); | ||
} | ||
}; | ||
Clean.prototype.trimBetween = function (text) { | ||
if (text == null) { | ||
return ''; | ||
} | ||
else { | ||
var between = /^\s*|\s*$/g; // remove space from start and end | ||
return text.replace(between, ''); | ||
} | ||
}; | ||
Clean.prototype.trimMiddle = function (text) { | ||
if (text == null) { | ||
return ''; | ||
} | ||
else { | ||
var middle = /\s\s+/g; // remove space from middle | ||
return text.replace(middle, ' '); | ||
} | ||
}; | ||
Clean.prototype.cleanText = function (string) { | ||
string = this.trim(string); | ||
return UrlDecode.decodeHtmlText(StringConverter.stringUnicode(string).trim()); | ||
}; | ||
return Clean; | ||
}()); | ||
// tslint:disable-next-line:variable-name | ||
export var StringClean = new Clean(); | ||
var Converter = /** @class */ (function () { | ||
function Converter() { | ||
} | ||
Converter.prototype.currencyToNumber = function (num, decimal, currency) { | ||
if (decimal === void 0) { decimal = ','; } | ||
if (currency != null) { | ||
return parseFloat(num.toString() | ||
.replace(/\./g, '') | ||
.replace(',', '.') | ||
.replace(' ', '') | ||
.replace(currency, '')); | ||
} | ||
else { | ||
return parseFloat(num.toString() | ||
.replace(/\./g, '') | ||
.replace(',', '.') | ||
.replace('Ar$ ', '') | ||
.replace('R$ ', '') | ||
.replace('€ ', '') | ||
.replace('US$ ', '')); | ||
} | ||
}; | ||
Converter.prototype.formatNumber = function (num, decimal) { | ||
if (decimal === void 0) { decimal = '.'; } | ||
var separator = decimal === '.' ? '$1.' : '$1,'; | ||
return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, separator); | ||
}; | ||
Converter.prototype.numberToString = function (number) { | ||
var maxLength = number.toString().length; | ||
@@ -60,6 +144,34 @@ if (maxLength < 3) { | ||
}; | ||
return StringConverter; | ||
Converter.prototype.stringToBoolean = function (value) { | ||
switch (value) { | ||
case 'true': | ||
return true; | ||
case 'false': | ||
return false; | ||
case 'null': | ||
case null: | ||
return false; | ||
default: | ||
return true; | ||
} | ||
}; | ||
Converter.prototype.stringUnicode = function (string) { | ||
try { | ||
return string.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); | ||
} | ||
catch (e) { | ||
return UrlDecode.decodeHtmlText(string); | ||
} | ||
}; | ||
Converter.prototype.titleCase = function (string) { | ||
var splitStr = string.toLowerCase().split(' '); | ||
for (var i = 0; i < splitStr.length; i++) { | ||
splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1); | ||
} | ||
return splitStr.join(' '); | ||
}; | ||
return Converter; | ||
}()); | ||
export { StringConverter }; | ||
module.exports = { StringConverter: StringConverter }; | ||
// tslint:disable-next-line:variable-name | ||
export var StringConverter = new Converter(); | ||
//# sourceMappingURL=core-services-string.service.js.map |
@@ -9,1 +9,2 @@ import 'node_modules/jquery-ui-dist/jquery-ui.min'; | ||
export * from './scripts/core/services/string/core-services-string.service'; | ||
export * from './scripts/core/services/url/core-services-url.service'; |
@@ -1,1 +0,1 @@ | ||
"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")); | ||
"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"));__export(require("./scripts/core/services/url/core-services-url.service")); |
@@ -1,6 +0,9 @@ | ||
export declare class ArrayRemove { | ||
static duplicateLegacy(array: any[]): any[]; | ||
declare class Remove { | ||
duplicateLegacy(array: any[]): any[]; | ||
} | ||
export declare class ArraySort { | ||
static byKey(array: any[], key: string, asc: boolean): PromiseLike<any[]>; | ||
export declare const ArrayRemove: Remove; | ||
declare class Sort { | ||
byKey(array: any[], key: string, asc: boolean): PromiseLike<any[]>; | ||
} | ||
export declare const ArraySort: Sort; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var ArrayRemove=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=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}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Remove=function(){function Remove(){}Remove.prototype.duplicateLegacy=function(array){var unique=array.filter(function(item,index){return array.indexOf(item)===index});return unique.sort()};return Remove}();exports.ArrayRemove=new Remove;var Sort=function(){function Sort(){}Sort.prototype.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 Sort}();exports.ArraySort=new Sort; |
@@ -1,12 +0,20 @@ | ||
export declare class AttachmentConvert { | ||
static textFileToUrlImage(file: File): PromiseLike<string>; | ||
declare class Convert { | ||
textFileToUrlImage(file: File): PromiseLike<string>; | ||
} | ||
export declare class AttachmentParser { | ||
static parseAcceptFiles(accepts: string): string[]; | ||
export declare const AttachmentConvert: Convert; | ||
declare class Clean { | ||
cleanAttachmentText(string: string): string; | ||
} | ||
export declare class AttachmentValidate { | ||
static file(input: HTMLInputElement, accepts: string[]): boolean; | ||
static fileSize(input: HTMLInputElement): boolean; | ||
export declare const AttachmentClean: Clean; | ||
declare class Parser { | ||
parseAcceptFiles(accepts: string): string[]; | ||
} | ||
export declare const AttachmentParser: Parser; | ||
declare class Validate { | ||
file(input: HTMLInputElement, accepts: string[]): boolean; | ||
fileSize(input: HTMLInputElement): boolean; | ||
/** The user must include the attribute 'data-maxsize' in mb(megabyte); */ | ||
static maxSize: (input: HTMLInputElement) => number; | ||
maxSize: (input: HTMLInputElement) => number; | ||
} | ||
export declare const AttachmentValidate: Validate; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
"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=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=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=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}};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}; | ||
"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 Convert=function(){function Convert(){}Convert.prototype.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 Convert}();exports.AttachmentConvert=new Convert;var Clean=function(){function Clean(){}Clean.prototype.cleanAttachmentText=function(string){return string.replace(/€/g,"").replace(/`/g,"").replace(/„/g,"").replace(/…/g,"").replace(/†/g,"").replace(/‡/g,"").replace(/ˆ/g,"").replace(/‰/g,"").replace(/Š/g,"").replace(/‹/g,"").replace(/Œ/g,"").replace(//g,"").replace(/Ž/g,"").replace(//g,"").replace(/‘/g,"").replace(/’/g,"").replace(/“/g,"").replace(/”/g,"").replace(/•/g,"").replace(/˜/g,"").replace(/™/g,"").replace(/š/g,"").replace(/›/g,"").replace(/œ/g,"").replace(/ž/g,"").replace(/Ÿ/g,"").replace(/¢/g,"").replace(/£/g,"").replace(/¤/g,"").replace(/¥/g,"").replace(/¦/g,"").replace(/§/g,"").replace(/¨/g,"").replace(/©/g,"").replace(/ª/g,"").replace(/«/g,"").replace(/¬/g,"").replace(/®/g,"").replace(/¯/g,"").replace(/°/g,"").replace(/±/g,"").replace(/²/g,"").replace(/³/g,"").replace(/´/g,"").replace(/µ/g,"").replace(/¶/g,"").replace(/·/g,"").replace(/¹/g,"").replace(/º/g,"").replace(/»/g,"").replace(/¼/g,"").replace(/½/g,"").replace(/¾/g,"").replace(/¿/g,"").replace(/Å/g,"A").replace(/Æ/g,"A").replace(/Ð/g,"D").replace(/Ø/g,"O").replace(/ß/g,"B").replace(/æ/g,"a").replace(/÷/g,"").replace(/ø/g,"o").replace(/þ/g,"b").replace(/!/g,"").replace(/"/g,"").replace(/#/g,"").replace(/\$/g,"").replace(/%/g,"").replace(/&/g,"").replace(/'/g,"").replace(/\(/g,"").replace(/\)/g,"").replace(/\*/g,"").replace(/\+/g,"").replace(/\//g,"").replace(/:/g,"").replace(/;/g,"").replace(/</g,"").replace(/=/g,"").replace(/>/g,"").replace(/\?/g,"").replace(/@/g,"").replace(/\[/g,"").replace(/\\/g,"").replace(/]/g,"").replace(/\^/g,"").replace(/_/g,"").replace(/`/g,"").replace(/{/g,"").replace(/\|/g,"").replace(/}/g,"").replace(/~/g,"").replace(/`/g,"").replace(//g,"").replace(/ƒ/g,"f").replace(/„/g,"").replace(/…/g,"").replace(/†/g,"").replace(/‡/g,"").replace(/ˆ/g,"").replace(/‰/g,"").replace(/Š/g,"").replace(/‹/g,"").replace(/Œ/g,"").replace(//g,"").replace(/Ž/g,"Z").replace(//g,"").replace(//g,"").replace(/‘/g,"").replace(/’/g,"").replace(/“/g,"").replace(/”/g,"").replace(/•/g,"").replace(/–/g,"").replace(/—/g,"").replace(/˜/g,"").replace(/™/g,"").replace(/š/g,"").replace(/›/g,"").replace(/œ/g,"").replace(//g,"").replace(/ž/g,"z").replace(/Ÿ/g,"Y").replace(/¡/g,"").replace(/¢/g,"c").replace(/£/g,"").replace(/¤/g,"").replace(/¥/g,"Y").replace(/¦/g,"").replace(/§/g,"").replace(/¨/g,"").replace(/©/g,"").replace(/ª/g,"").replace(/«/g,"").replace(/¬/g,"").replace(/®/g,"").replace(/¯/g,"").replace(/°/g,"").replace(/±/g,"").replace(/²/g,"2").replace(/³/g,"3").replace(/´/g,"").replace(/µ/g,"u").replace(/¶/g,"").replace(/·/g,"").replace(/¹/g,"1").replace(/º/g,"").replace(/»/g,"").replace(/¼/g,"").replace(/½/g,"").replace(/¾/g,"").replace(/¿/g,"").replace(/Ð/g,"D").replace(/ß/g,"B").replace(/æ/g,"a").replace(/÷/g,"").replace(/ø/g,"o").replace(/þ/g,"b").replace(/&/g,"").replace(/</g,"").replace(/>/g,"")};return Clean}();exports.AttachmentClean=new Clean;var Parser=function(){function Parser(){}Parser.prototype.parseAcceptFiles=function(accepts){return accepts.replace(/image\//g,"").replace(/x-/g,"").replace(/\+xml/g,"").replace(/ /g,"").split(",")};return Parser}();exports.AttachmentParser=new Parser;var Validate=function(){function Validate(){this.maxSize=function(input){var fileName=input.attributes["data-maxsize"].nodeValue;if(fileName){return parseInt(fileName,10)}else{return 1024*45}}}Validate.prototype.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};Validate.prototype.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}};return Validate}();exports.AttachmentValidate=new Validate; |
import { IFullScreenAlt, IFullScreenSrc, IMenuButton } from '../menu/core-services-menu.interfaces'; | ||
import { IFullscreenResult } from './core-services-browser.interfaces'; | ||
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; | ||
declare class FullScreen { | ||
listener(menuButton: IMenuButton, alt: IFullScreenAlt, src: IFullScreenSrc, showLog?: boolean): void; | ||
disableListener(): void; | ||
toggle(menuButton: IMenuButton, alt: IFullScreenAlt, src: IFullScreenSrc, showLog?: boolean): PromiseLike<IFullscreenResult>; | ||
available(): boolean; | ||
} | ||
export declare class BrowserVersion { | ||
static isIE(): boolean; | ||
static isBeforeIE11(): boolean; | ||
export declare const BrowserFullScreen: FullScreen; | ||
declare class Version { | ||
isIE(): boolean; | ||
isBeforeIE11(): boolean; | ||
} | ||
export declare const BrowserVersion: Version; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var screenfull=require("screenfull");var BrowserFullScreen=function(){function BrowserFullScreen(){}BrowserFullScreen.listener=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")}};BrowserFullScreen.disableListener=function(){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=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}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var screenfull=require("screenfull");var FullScreen=function(){function FullScreen(){}FullScreen.prototype.listener=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")}};FullScreen.prototype.disableListener=function(){screenfull.off("change",function(){console.log("Fullscreen listener has been disabled")})};FullScreen.prototype.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})}})};FullScreen.prototype.available=function(){return screenfull.isEnabled};return FullScreen}();exports.BrowserFullScreen=new FullScreen;var Version=function(){function Version(){}Version.prototype.isIE=function(){var ua=window.navigator.userAgent;var msie=ua.indexOf("MSIE ");return msie>0||!!navigator.userAgent.match(/Trident.*rv:11\./)};Version.prototype.isBeforeIE11=function(){return navigator.appVersion.indexOf("MSIE 10")!==-1};return Version}();exports.BrowserVersion=new Version; |
import { IComboBoxData } from './core-services-combobox.interface'; | ||
export declare class ComboBoxCore { | ||
declare class Core { | ||
/** This function is using Jquery and Jquery-ui and typescript is not available | ||
@@ -8,10 +8,14 @@ * To this function work is necessary the following imports, respectively: | ||
*/ | ||
static initialize(combobox: HTMLSelectElement, callback: any, invalidCallback: any): void; | ||
static loadData(combobox: HTMLSelectElement, data: IComboBoxData[], keepValue: boolean): PromiseLike<HTMLSelectElement | null>; | ||
initialize(combobox: HTMLSelectElement, callback: any, invalidCallback: any): void; | ||
loadData(combobox: HTMLSelectElement, data: IComboBoxData[], keepValue: boolean): PromiseLike<HTMLSelectElement | null>; | ||
} | ||
export declare class ComboBoxData { | ||
static byValue(arrayData: IComboBoxData[], value: string): string; | ||
export declare const ComboBoxCore: Core; | ||
declare class Data { | ||
byValue(arrayData: IComboBoxData[], value: string): string; | ||
} | ||
export declare class ComboBoxDom { | ||
static disableInput(combobox: HTMLSelectElement, disable: boolean): void; | ||
export declare const ComboBoxData: Data; | ||
declare class Dom { | ||
disableInput(combobox: HTMLSelectElement, disable: boolean): void; | ||
} | ||
export declare const ComboBoxDom: Dom; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var $=require("jquery");var core_services_elements_service_1=require("../elements/core-services-elements.service");var ComboBoxCore=function(){function ComboBoxCore(){}ComboBoxCore.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()};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=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=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;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}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var $=require("jquery");var core_services_elements_service_1=require("../elements/core-services-elements.service");var Core=function(){function Core(){}Core.prototype.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()};Core.prototype.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.ElementRemove.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 Core}();exports.ComboBoxCore=new Core;var Data=function(){function Data(){}Data.prototype.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 Data}();exports.ComboBoxData=new Data;var Dom=function(){function Dom(){}Dom.prototype.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")}}};return Dom}();exports.ComboBoxDom=new Dom; |
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; | ||
declare class Get { | ||
customDate(date: IDate, format: string): string; | ||
currentDate(outputFormat?: string): string; | ||
dayMonthYear(date: IDate, format?: string): IDayMonthYear; | ||
localDate(year: number, month: number, day: number, local?: IDateLocal): string; | ||
dateFromIso(date: IDate, format?: string): string; | ||
ganttDate(date: IDate): Date; | ||
isoDateCustom(date: IDate, dateFormat: string, outputFormat: string): string; | ||
isoDate(date: IDate, format?: string): string; | ||
isoDateWithoutTime(date: IDate): string; | ||
dateMilliseconds(date: IDate, dateFormat: string, outputFormat: string): number; | ||
dateToMillisecondsNoTime(date: IDate): number; | ||
millisecondsToDate(date: IDate, 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): IWeeksOfMonth[]; | ||
daysOfMonth(weeksRange: IWeeksOfMonth[]): IDaysOfMonth[][]; | ||
weekOfYear(date: string, format: string): number; | ||
} | ||
export declare class DateComparable { | ||
static isDateBefore(startDate: string, endDate: string, type?: IUnityOfTime): boolean; | ||
export declare const DateGet: Get; | ||
declare class Comparable { | ||
isDateBefore(startDate: string, endDate: string, type?: IUnityOfTime): boolean; | ||
} | ||
export declare class DateValidation { | ||
static date(date: IDate): boolean; | ||
export declare const DateComparable: Comparable; | ||
declare class Validation { | ||
date(date: IDate): boolean; | ||
} | ||
export declare class DatePicker { | ||
export declare const DateValidation: Validation; | ||
declare class Picker { | ||
/** | ||
@@ -38,8 +41,10 @@ * Date picker utilities; | ||
*/ | ||
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; | ||
setDatePicker(datePicker: HTMLInputElement, dateFormat: string): void; | ||
monthYearDatePicker(datePicker: HTMLInputElement, dateFormat: string, setValueCallback: any): void; | ||
dateFromDatePicker(date: IDate, format?: string, outputFormat?: string): string; | ||
localDateForDatePicker(date: IDate, outputFormat?: string): string; | ||
currentDateForDatePicker(dateFormat?: string, outputFormat?: string): string; | ||
dateForDatePicker(month: number, day: number, year: number): string; | ||
} | ||
export declare const DatePicker: Picker; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
"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=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*1e3};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;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};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=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=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=function(){function DatePicker(){}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();$(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)}}})};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}; | ||
"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 Get=function(){function Get(){}Get.prototype.customDate=function(date,format){return moment(date).format(format)};Get.prototype.currentDate=function(outputFormat){if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment.utc(new Date,outputFormat).local().format(outputFormat)};Get.prototype.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}};Get.prototype.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)};Get.prototype.dateFromIso=function(date,format){if(format===void 0){format="DD/MM/YYYY"}return moment.utc(date).format(format)};Get.prototype.ganttDate=function(date){var splitDate=this.dayMonthYear(date);return new Date(splitDate.year,splitDate.month,splitDate.day)};Get.prototype.isoDateCustom=function(date,dateFormat,outputFormat){var splitDate=this.dayMonthYear(date);return new Date(splitDate.year,splitDate.month,splitDate.day).toISOString()};Get.prototype.isoDate=function(date,format){if(format===void 0){format="DD/MM/YYYY"}return moment.utc(date,format).format(format)};Get.prototype.isoDateWithoutTime=function(date){var splitDate=this.dayMonthYear(date);return moment.utc(new Date(splitDate.year,splitDate.month,splitDate.day)).toISOString()};Get.prototype.dateMilliseconds=function(date,dateFormat,outputFormat){return+moment(this.isoDateCustom(date,dateFormat,outputFormat),dateFormat).format("x")};Get.prototype.dateToMillisecondsNoTime=function(date){return+moment(this.isoDateWithoutTime(date)).format("x")};Get.prototype.millisecondsToDate=function(date,outputFormat){return moment.utc(date,"x").format(outputFormat)};Get.prototype.daysToMilliseconds=function(days){return days*24*60*60*1e3};Get.prototype.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};Get.prototype.durationInMilliseconds=function(start,end){return this.daysToMilliseconds(this.durationInDays(start,end,false))};Get.prototype.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""}}};Get.prototype.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};Get.prototype.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};Get.prototype.weekOfYear=function(date,format){return moment(date,format).week()};return Get}();exports.DateGet=new Get;var Comparable=function(){function Comparable(){}Comparable.prototype.isDateBefore=function(startDate,endDate,type){if(type===void 0){type="day"}return moment(endDate).isBefore(startDate,type)};return Comparable}();exports.DateComparable=new Comparable;var Validation=function(){function Validation(){}Validation.prototype.date=function(date){var aDate=moment(date,"DD/MM/YYYY",true);return aDate.isValid()};return Validation}();exports.DateValidation=new Validation;var Picker=function(){function Picker(){}Picker.prototype.setDatePicker=function(datePicker,dateFormat){$(datePicker).datepicker("option","dateFormat",dateFormat)};Picker.prototype.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)}}})};Picker.prototype.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)};Picker.prototype.localDateForDatePicker=function(date,outputFormat){if(outputFormat===void 0){outputFormat="DD/MM/YYYY"}return moment.utc(date,outputFormat).local().format(outputFormat)};Picker.prototype.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)};Picker.prototype.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 Picker}();exports.DatePicker=new Picker; |
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; | ||
declare class Remove { | ||
childElements(elementClassId: string | HTMLElement): void; | ||
} | ||
export declare class Selector { | ||
static element(className: string): HTMLElement | null; | ||
export declare const ElementRemove: Remove; | ||
declare class Selector { | ||
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; | ||
export declare const ElementSelector: Selector; | ||
declare class Highlight { | ||
clearError(field: TFields): void; | ||
error(fieldHighlighted: TFields): void; | ||
invalidDate(date: IDate, input: HTMLElement): void; | ||
setError(field: TFields): void; | ||
} | ||
export declare const ElementHighlight: Highlight; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var core_services_date_service_1=require("../date/core-services-date.service");var Remove=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=function(){function Selector(){}Selector.element=function(className){return document.querySelector(className)};return Selector}();exports.Selector=Selector;var Highlight=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}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var core_services_date_service_1=require("../date/core-services-date.service");var Remove=function(){function Remove(){}Remove.prototype.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.ElementRemove=new Remove;var Selector=function(){function Selector(){}Selector.prototype.element=function(className){return document.querySelector(className)};return Selector}();exports.ElementSelector=new Selector;var Highlight=function(){function Highlight(){}Highlight.prototype.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.prototype.error=function(fieldHighlighted){if(fieldHighlighted!=null){fieldHighlighted.classList.add("required-fill");fieldHighlighted.focus()}};Highlight.prototype.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.prototype.setError=function(field){if(field!=null){field.classList.add("required-fill");field.focus()}};return Highlight}();exports.ElementHighlight=new Highlight; |
@@ -1,3 +0,19 @@ | ||
export declare class StringConverter { | ||
static numberToString(number: number): string; | ||
declare class Clean { | ||
trim(text: string): string; | ||
trimLeft(text: string): string; | ||
trimRight(text: string): string; | ||
trimBetween(text: string): string; | ||
trimMiddle(text: string): string; | ||
cleanText(string: string): string; | ||
} | ||
export declare const StringClean: Clean; | ||
declare class Converter { | ||
currencyToNumber(num: number, decimal?: string, currency?: string): number; | ||
formatNumber(num: number, decimal?: string): string; | ||
numberToString(number: number): string; | ||
stringToBoolean(value: string): boolean; | ||
stringUnicode(string: string): string; | ||
titleCase(string: string): string; | ||
} | ||
export declare const StringConverter: Converter; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var StringConverter=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<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()}};return StringConverter}();exports.StringConverter=StringConverter;module.exports={StringConverter:StringConverter}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var core_services_url_service_1=require("../url/core-services-url.service");var Clean=function(){function Clean(){}Clean.prototype.trim=function(text){if(text==null){return""}else{var between=/^\s*|\s*$/g;var middle=/\s\s+/g;return text.replace(between,"").replace(middle," ")}};Clean.prototype.trimLeft=function(text){if(text==null){return""}else{var between=/^\s*/g;return text.replace(between,"")}};Clean.prototype.trimRight=function(text){if(text==null){return""}else{var between=/\s*$/g;return text.replace(between,"")}};Clean.prototype.trimBetween=function(text){if(text==null){return""}else{var between=/^\s*|\s*$/g;return text.replace(between,"")}};Clean.prototype.trimMiddle=function(text){if(text==null){return""}else{var middle=/\s\s+/g;return text.replace(middle," ")}};Clean.prototype.cleanText=function(string){string=this.trim(string);return core_services_url_service_1.UrlDecode.decodeHtmlText(exports.StringConverter.stringUnicode(string).trim())};return Clean}();exports.StringClean=new Clean;var Converter=function(){function Converter(){}Converter.prototype.currencyToNumber=function(num,decimal,currency){if(decimal===void 0){decimal=","}if(currency!=null){return parseFloat(num.toString().replace(/\./g,"").replace(",",".").replace(" ","").replace(currency,""))}else{return parseFloat(num.toString().replace(/\./g,"").replace(",",".").replace("Ar$ ","").replace("R$ ","").replace("€ ","").replace("US$ ",""))}};Converter.prototype.formatNumber=function(num,decimal){if(decimal===void 0){decimal="."}var separator=decimal==="."?"$1.":"$1,";return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,separator)};Converter.prototype.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()}};Converter.prototype.stringToBoolean=function(value){switch(value){case"true":return true;case"false":return false;case"null":case null:return false;default:return true}};Converter.prototype.stringUnicode=function(string){try{return string.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}catch(e){return core_services_url_service_1.UrlDecode.decodeHtmlText(string)}};Converter.prototype.titleCase=function(string){var splitStr=string.toLowerCase().split(" ");for(var i=0;i<splitStr.length;i++){splitStr[i]=splitStr[i].charAt(0).toUpperCase()+splitStr[i].substring(1)}return splitStr.join(" ")};return Converter}();exports.StringConverter=new Converter; |
{ | ||
"name": "gl-w-frontend", | ||
"version": "1.4.0", | ||
"version": "1.4.1-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.4.0-green.svg)](https://www.npmjs.com/package/gl-w-frontend) | ||
[![version](https://img.shields.io/badge/version-1.4.1-green.svg)](https://www.npmjs.com/package/gl-w-frontend) | ||
@@ -4,0 +4,0 @@ ### What is this repository for? ### |
@@ -22,2 +22,3 @@ { | ||
}, | ||
"indent": true, | ||
"component-class-suffix": true, | ||
@@ -24,0 +25,0 @@ "contextual-lifecycle": true, |
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
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
228576
87
2189
8