@ngrdt/utils 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +1 -1
- package/index.esm.js +1 -1
- package/package.json +4 -2
- package/src/index.d.ts +17 -1
- package/src/lib/array.utils.d.ts +6 -0
- package/src/lib/color.utils.d.ts +5 -0
- package/src/lib/css.utils.d.ts +14 -0
- package/src/lib/date-format.d.ts +77 -0
- package/src/lib/date.utils.d.ts +60 -0
- package/src/lib/encodings.d.ts +44 -0
- package/src/lib/file.utils.d.ts +69 -0
- package/src/lib/html.utils.d.ts +4 -0
- package/src/lib/keyboard.utils.d.ts +36 -0
- package/src/lib/mime-types.d.ts +109 -0
- package/src/lib/model.utils.d.ts +22 -0
- package/src/lib/names.d.ts +19 -0
- package/src/lib/object.utils.d.ts +5 -0
- package/src/lib/random.utils.d.ts +4 -0
- package/src/lib/router.utils.d.ts +1 -0
- package/src/lib/rxjs.utils.d.ts +6 -0
- package/src/lib/string.utils.d.ts +22 -0
- package/src/lib/type.utils.d.ts +13 -0
- package/src/lib/rdt-string.utils.d.ts +0 -3
package/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.RdtStringUtils=class{static capitalize(t){return t.charAt(0).toLocaleUpperCase()+t.slice(1)}};
|
|
1
|
+
"use strict";var t=require("rxjs");function e(t){return{name:t,className:(s=t,e=a(s),e.charAt(0).toUpperCase()+e.slice(1)),propertyName:a(t),constantName:n(t),fileName:r(t)};var e,s}function a(t){return t.replace(/([^a-zA-Z0-9])+(.)?/g,((t,e,a)=>a?a.toUpperCase():"")).replace(/[^a-zA-Z\d]/g,"").replace(/^([A-Z])/,(t=>t.toLowerCase()))}function n(t){return r(a(t.toUpperCase()===t?t.toLowerCase():t)).replace(/([^a-zA-Z0-9])/g,"_").toUpperCase()}function r(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase().replace(/(?!^_)[ _]/g,"-")}const s=["je","lze"];function i(t){const e=parseInt(t);return isNaN(e)?{obj:{},key:t}:{obj:[],key:e}}class o{static tokenize(t){return t?t.split(/\W+/).filter((t=>!!t)):[]}static joinPaths(t,e){const a=t.endsWith("/"),n=e.startsWith("/");return a&&n?t.slice(0,-1)+e:a||n?t+e:t+"/"+e}static isAlphabetCharacter(t){return!(t.length>1)&&t.toLocaleLowerCase()!==t.toLocaleUpperCase()}static isNumericCharacter(t){return!isNaN(parseInt(t))}static capitalize(t){return t.charAt(0).toLocaleUpperCase()+t.slice(1)}static toDataTestId(t){var e;return null==(e=o.removeAccents(t).toLowerCase())?void 0:e.replace(/ /g,"-")}static removeAccents(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}static stripTrailingSlash(t){const e=t.match(/#|\?|$/),a=e&&e.index||t.length,n=a-("/"===t[a-1]?1:0);return t.slice(0,n)+t.slice(a)}static createAbsoluteUrl(t,e){return o.joinPaths(e,t)}static appendQueryParams(t,e){if(e&&0!==Object.keys(e).length){return`${t}?${new URLSearchParams(e)}`}return t}static localeCompare(t,e,a="asc"){const n="asc"===a?1:-1;return t==e?0:null==t?-n:null==e?n:t.localeCompare(e)*n}static komixcomlocalReplaceString(t){const e=location.hostname;return{replaceString:t.includes("komix.com")?"komix.com":"komix.local",toReplace:e.includes("komix.com")?"komix.com":"komix.local"}}static swapChars(t,e,a){return e<0||a<0||e>=t.length||a>=t.length?t:(a<e&&([e,a]=[a,e]),t.slice(0,e)+t[a]+t.slice(e+1,a)+t[e]+t.slice(a+1))}static insertAt(t,e,a){return t.slice(0,e)+a+t.slice(e)}static getDataTestId(t,e,a){var n;let r=null==(n=t.toLowerCase())?void 0:n.replace(/ /g,"-");return e&&(r=`${e}__${r}`),a&&(r=`${r}--${a}`),o.removeAccents(r)}}function l(){return l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},l.apply(this,arguments)}const p={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight"},c={SPACEBAR:" ",ENTER:"Enter",ESCAPE:"Escape",HOME:"Home",END:"End",TAB:"Tab",ARROW:p},u=l({},c,{SPACEBAR:"Space"}),d=Array.from(Array(26)).map(((t,e)=>e+65)).map((t=>String.fromCharCode(t))),g=d.map((t=>`Key${t.toUpperCase()}`));class m{static scrollIntoViewHorizontallyWithinParent(t){const e=t.parentElement;if(!e)return;const a=t.offsetLeft,n=t.offsetWidth,r=e.offsetWidth,s=e.scrollLeft,i=a,o=a-r+n;s>i?e.scrollLeft=i:s<o&&(e.scrollLeft=o)}static setCaretPosition(t,e){t.focus(),t.setSelectionRange(e,e)}}class h{static getDays(t,e){return h.getDayOffset(new Date(t))-h.getDayOffset(new Date(e))}static checkDate(t,e,a){const n=new Date(t,e-1,a);return n.getFullYear()===t&&n.getMonth()+1===e&&n.getDate()===a}static isValidDate(t){return null!=t&&(t instanceof Date?!isNaN(t.getTime()):!isNaN(new Date(t).getTime()))}static startOfDay(t){const e=new Date(t);return e.setHours(0,0,0,0),e}static endOfDay(t){const e=new Date(t);return e.setHours(23,59,59),e}static startOfMonth(t){const e=new Date(t);return e.setHours(0,0,0,0),e.setDate(1),e}static endOfMonth(t){const e=new Date(t);return e.setHours(23,59,59),e.setDate(0),e}static startOfYear(t){return new Date(t,0,1)}static endOfYear(t){return new Date(t,11,31)}static beginningOfNextMonth(){const t=new Date;return 11===t.getMonth()?new Date(t.getFullYear()+1,0,1):new Date(t.getFullYear(),t.getMonth()+1,1)}static endOfNextMonth(){const t=new Date;if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,0,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+2,1);return this.minusOneDay(e)}}static beginningOfInThreeMonths(){const t=new Date;return 10===t.getMonth()?new Date(t.getFullYear()+1,1,1):11===t.getMonth()?new Date(t.getFullYear()+1,2,1):new Date(t.getFullYear(),t.getMonth()+3,1)}static endOfInNextThreeMonths(){const t=new Date;if(9===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,2,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,3,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+4,1);return this.minusOneDay(e)}}static minusOneDay(t){return new Date(t.getTime()-h.DAY)}static toISOLocal(t){return`${t.getFullYear()}-${`${t.getMonth()+1}`.padStart(2,"0")}-${`${t.getDate()}`.padStart(2,"0")}T${`${t.getHours()}`.padStart(2,"0")}:${`${t.getMinutes()}`.padStart(2,"0")}:${`${t.getSeconds()}`.padStart(2,"0")}`}static formatDate(t){if(null==t||""===t)return"";const e=t instanceof Date?t:new Date(t);if(h.isValidDate(e)){const t=e.getFullYear(),a=`${e.getMonth()+1}`.padStart(2,"0");return`${`${e.getDate()}`.padStart(2,"0")}.${a}.${t}`}return""}static timeToDate(t){const e=new Date(0);if(h.hhMmSsMsRegex.test(t)){const a=t.match(h.hhMmSsMsRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]),s=parseInt(a[4]);return e.setHours(t,n,r,s),e}}else if(h.hhMmSsRegex.test(t)){const a=t.match(h.hhMmSsRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]);return e.setHours(t,n,r),e}}else if(h.hhMmRegex.test(t)){const a=t.match(h.hhMmRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]);return e.setHours(t,n),e}}return null}static setTime(t,e){const a=new Date(t),n=h.timeToDate(e);return n&&a.setHours(n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),a}static getTime(t,e=!0){const a=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0");if(e){return`${a}:${n}:${t.getSeconds().toString().padStart(2,"0")}`}return`${a}:${n}`}static parseToDate(t){if(t instanceof Date)return h.isValidDate(t)?t:null;if("string"==typeof t){const e=new Date(t);if(h.isValidDate(e))return e}return null}static parse(t){if(t instanceof Date)return h.isValidDate(t)?t.getTime():null;if("string"==typeof t){const e=new Date(t);if(h.isValidDate(e))return e.getTime()}return null}static isEqual(t,e){return t===e||!(!t||!e)&&t.getTime()===e.getTime()}static isLeapYear(t){return 29===new Date(t,1,29).getDate()}static getDaysInYear(t){return h.isLeapYear(t)?366:365}static getDayOffset(t){const e=t.getFullYear()-1,a=t.getMonth()+1,n=t.getDate(),r=Math.trunc(e/4)-Math.trunc(e/100)+Math.trunc(e/400);return h.isLeapYear(e+1)?365*e+r+h.daysUpToMonthLeapYear[a-1]+n-1:365*e+r+h.daysUpToMonth[a-1]+n-1}static doubleDigitYearToPast(t){const e=h.getCurrentYear(),a=e%100;return t<=a?t+e-a:t+e-a-100}static doubleDigitYearToFuture(t){const e=h.getCurrentYear(),a=e%100;return t>=a?t+e-a:t+e-a+100}static getCurrentYear(){return(new Date).getFullYear()}static calculateAge(t,e){const a=new Date(t),n=new Date(e);let r=n.getFullYear()-a.getFullYear();const s=n.getMonth()-a.getMonth(),i=n.getDate()-a.getDate();return(s<0||0===s&&i<0)&&r--,r}}var f,x,M;h.MS=1,h.SECOND=1e3*h.MS,h.MINUTE=60*h.SECOND,h.HOUR=60*h.MINUTE,h.DAY=24*h.HOUR,h.hhMmRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*$/,h.hhMmSsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*$/,h.hhMmSsMsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*[\W|\s]\s*(\d{1,3})\s*$/,h.daysUpToMonth=[0,31,59,90,120,151,181,212,243,273,304,334],h.daysUpToMonthLeapYear=[0,31,60,91,121,152,182,213,244,274,305,335],exports.Month=void 0,(f=exports.Month||(exports.Month={}))[f.January=0]="January",f[f.February=1]="February",f[f.March=2]="March",f[f.April=3]="April",f[f.May=4]="May",f[f.June=5]="June",f[f.July=6]="July",f[f.August=7]="August",f[f.September=8]="September",f[f.October=9]="October",f[f.November=10]="November",f[f.December=11]="December",exports.RdtMimeType=void 0,(x=exports.RdtMimeType||(exports.RdtMimeType={})).DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",x.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",x.PDF="application/pdf",x.TXT="text/plain",x.CSV="text/csv",x.ZIP="application/zip",x.JPG="image/jpeg",x.PNG="image/png",x.GIF="image/gif",x.SVG="image/svg+xml",x.HTML="text/html",x.XML="application/xml",x.JSON="application/json",x.MP3="audio/mpeg",x.MP4="video/mp4",x.OGG="audio/ogg",x.WEBM="video/webm",x.WAV="audio/wav",x.AVI="video/x-msvideo",x.MPEG="video/mpeg",x.WEBP="image/webp",x.ICO="image/x-icon",x.TTF="font/ttf",x.WOFF="font/woff",x.WOFF2="font/woff2",x.EOT="application/vnd.ms-fontobject",x.OTF="font/otf",x.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",x.PPT="application/vnd.ms-powerpoint",x.XLS="application/vnd.ms-excel",x.DOC="application/msword",x.ODT="application/vnd.oasis.opendocument.text",x.ODS="application/vnd.oasis.opendocument.spreadsheet",x.ODP="application/vnd.oasis.opendocument.presentation",x.ODF="application/vnd.oasis.opendocument.formula",x.RAR="application/vnd.rar",x.TAR="application/x-tar",x.GZIP="application/gzip",x.BZIP2="application/x-bzip2",x.XZ="application/x-xz",x.SEVENZ="application/x-7z-compressed",x.RAR5="application/x-rar-compressed",x.WMA="audio/x-ms-wma",x.WMV="video/x-ms-wmv",x.FLV="video/x-flv",x.OGV="video/ogg",x.BIN="application/octet-stream",exports.VnshCombinedMimeType=void 0,(M=exports.VnshCombinedMimeType||(exports.VnshCombinedMimeType={})).IMAGE="image/*",M.AUDIO="audio/*",M.VIDEO="video/*",M.FONT="font/*",M.DOCUMENT="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,application/pdf,text/plain,text/csv",M.SPREADSHEET="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet",M.PRESENTATION="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.oasis.opendocument.presentation",M.ARCHIVE="application/zip,application/vnd.rar,application/x-tar,application/gzip,application/x-bzip2,application/x-xz,application/x-7z-compressed,application/x-rar-compressed";const y={"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/pdf":"pdf","text/plain":"txt","text/csv":"csv","application/zip":"zip","image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/svg+xml":"svg","text/html":"html","application/xml":"xml","application/json":"json","audio/mpeg":"mp3","video/mp4":"mp4","audio/ogg":"ogg","video/webm":"webm","audio/wav":"wav","video/x-msvideo":"avi","video/mpeg":"mpeg","image/webp":"webp","image/x-icon":"ico","font/ttf":"ttf","font/woff":"woff","font/woff2":"woff2","application/vnd.ms-fontobject":"eot","font/otf":"otf","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/vnd.ms-powerpoint":"ppt","application/vnd.ms-excel":"xls","application/msword":"doc","application/vnd.oasis.opendocument.text":"odt","application/vnd.oasis.opendocument.spreadsheet":"ods","application/vnd.oasis.opendocument.presentation":"odp","application/vnd.oasis.opendocument.formula":"odf","application/vnd.rar":"rar","application/x-tar":"tar","application/gzip":"gz","application/x-bzip2":"bz2","application/x-xz":"xz","application/x-7z-compressed":"7z","application/x-rar-compressed":"rar","audio/x-ms-wma":"wma","video/x-ms-wmv":"wmv","video/x-flv":"flv","video/ogg":"ogv","application/octet-stream":"bin"},v={};for(const[t,e]of Object.entries(y))v[e]=t;var D,w;exports.RdtMsOfficeAction=void 0,(D=exports.RdtMsOfficeAction||(exports.RdtMsOfficeAction={})).Edit="ofe|u|",D.View="ofv|u|",exports.RdtMsOfficeApp=void 0,(w=exports.RdtMsOfficeApp||(exports.RdtMsOfficeApp={})).Word="ms-word",w.Excel="ms-excel",w.PowerPoint="ms-powerpoint";const b=exports.RdtMimeType.BIN,O="ofv|u|";var I;exports.FileSizeUnit=void 0,(I=exports.FileSizeUnit||(exports.FileSizeUnit={})).B="B",I.KB="KB",I.MB="MB",I.GB="GB",I.TB="TB",I.PB="PB",I.EB="EB",I.ZB="ZB",I.YB="YB";const R=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];class S{static getMsOfficeLink(t,e){var a;const n=null!=(a=e.app)?a:S.getMsOfficeAppByMimeType(e.mimeType);if(n){var r;return`${n}:${null!=(r=e.action)?r:O}${t}`}return t}static openFileFromRemoteUrl(t,e){window.open(S.getMsOfficeLink(t,e))}static openFileInBrowser(t,e){const a=S.getBase64Link(t,e);window.open(a,"_blank")}static fileAsArrayBuffer(t){return new Promise(((e,a)=>{t||a(null);const n=new FileReader;n.onload=()=>e(n.result),n.onerror=a,n.readAsArrayBuffer(t)}))}static fileAsText(t,e){return new Promise(((a,n)=>{t||n(null);const r=new FileReader;r.onload=()=>a(r.result),r.onerror=n,r.readAsText(t,e)}))}static downloadFileFromData(t,e,a){var n;a=null!=(n=null!=a?a:S.getMimeTypeFromFileName(e))?n:S.getMimeTypeFromBase64(t);const r=S.getBase64Link(t,a);this.downloadFileFromRemoteUrl(r,e,a)}static downloadFileFromRemoteUrl(t,e,a){a=null!=a?a:S.getMimeTypeFromFileName(e);const n=document.createElement("a");n.href=t,n.download=S.getFileName(e,a),n.click()}static getMimeTypeFromBase64(t){var e;return null==(e=t.match(/data:(.*?);base64/))?void 0:e[1]}static getMimeTypeFromFileName(t){const e=null==t?void 0:t.split(".").pop();var a;return null!=(a=v[e])?a:b}static getFileName(t,e){if(e){const a=y[e];return t.endsWith(`.${a}`)?t:`${t}.${a}`}return t}static getBase64Link(t,e){return t.startsWith("data:")?t:e?`data:${e};base64,${t}`:(console.error("Missing mime type for base64 data."),"")}static getMimeTypeFromResponse(t){var e;return null==(e=t.body)?void 0:e.type}static getFileNameFromResponse(t){var e,a,n,r,s;return null!=(s=null==(r=t.headers.get("content-disposition"))||null==(n=r.split("filename="))||null==(a=n[1])||null==(e=a.split(";"))?void 0:e[0])?s:""}static async blobToDataUrl(t){return new Promise(((e,a)=>{t||a(null);const n=new FileReader;n.onload=()=>e(n.result),n.onerror=a,n.readAsDataURL(t)}))}static convertFromBytes(t,e=2){if(0===t)return"0 B";const a=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,a)).toFixed(e))+" "+R[a]}static convertToBytes(t,e){const a=R.indexOf(e);return t*Math.pow(1024,a)}static fileSizeToBytes(t){const[e,a]=t.split(" "),n=parseFloat(e),r=a;return isNaN(n)||-1===R.indexOf(r)?null:S.convertToBytes(n,r)}static getMsOfficeAppByMimeType(t){switch(t){case exports.RdtMimeType.DOC:case exports.RdtMimeType.DOCX:case exports.RdtMimeType.ODT:return"ms-word";case exports.RdtMimeType.XLS:case exports.RdtMimeType.XLSX:case exports.RdtMimeType.ODS:return"ms-excel";case exports.RdtMimeType.PPT:case exports.RdtMimeType.PPTX:case exports.RdtMimeType.ODP:return"ms-powerpoint";default:return null}}}class _{static normalizeColor(t){const e=t.trim();return this.isHexColor(e)?_.normalizeHex(e):this.isRgbColor(e)?_.normalizeRgb(e):this.isRgbaColor(e)?_.normalizeRgba(e):null}static normalizeHex(t){const e=t.match(_.hexRegex);return e?`#${e[2]}`:null}static normalizeRgb(t){const e=t.match(_.rgbRegex);return e?`rgb(${e[2]},${e[3]},${e[4]})`:null}static normalizeRgba(t){const e=t.match(_.rgbaRegex);return e?`rgba(${e[2]},${e[3]},${e[4]},${e[5]})`:null}static isRgbColor(t){return _.rgbRegex.test(t)}static isHexColor(t){return _.hexRegex.test(t)}static isRgbaColor(t){return _.rgbaRegex.test(t)}}var T;_.rgbRegex=/^(rgb)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\s*\)?$/,_.rgbaRegex=/^(rgba)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+((0(\.\d+)?)|(1(\.0)?))\s*\)?$/,_.hexRegex=/^(#?)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,function(t){t.Day="day",t.Month="month",t.Year="year",t.Constant="constant"}(T||(T={}));var F,N,A,C,E;exports.RdtInsertMode=void 0,(F=exports.RdtInsertMode||(exports.RdtInsertMode={}))[F.Overwrite=0]="Overwrite",F[F.Shift=1]="Shift",exports.RdtPasteMode=void 0,(N=exports.RdtPasteMode||(exports.RdtPasteMode={}))[N.Replace=0]="Replace",N[N.Insert=1]="Insert",exports.RdtYearInputMode=void 0,(A=exports.RdtYearInputMode||(exports.RdtYearInputMode={}))[A.FourDigit=1]="FourDigit",A[A.TwoDigit=2]="TwoDigit",A[A.Both=3]="Both",exports.RdtLeadingZeroInputMode=void 0,(C=exports.RdtLeadingZeroInputMode||(exports.RdtLeadingZeroInputMode={}))[C.NoLeadingZero=1]="NoLeadingZero",C[C.LeadingZero=2]="LeadingZero",C[C.Both=3]="Both";exports.RdtEncoding=void 0,(E=exports.RdtEncoding||(exports.RdtEncoding={})).UTF_8="utf-8",E.IBM_866="ibm866",E.ISO_8859_2="iso-8859-2",E.ISO_8859_3="iso-8859-3",E.ISO_8859_4="iso-8859-4",E.ISO_8859_5="iso-8859-5",E.ISO_8859_6="iso-8859-6",E.ISO_8859_7="iso-8859-7",E.ISO_8859_8="iso-8859-8",E.ISO_8859_8_I="iso-8859-8-i",E.ISO_8859_10="iso-8859-10",E.ISO_8859_13="iso-8859-13",E.ISO_8859_14="iso-8859-14",E.ISO_8859_15="iso-8859-15",E.ISO_8859_16="iso-8859-16",E.KOI8_R="koi8-r",E.MACINTOSH="macintosh",E.WINDOWS_874="windows-874",E.WINDOWS_1250="windows-1250",E.WINDOWS_1251="windows-1251",E.WINDOWS_1252="windows-1252",E.WINDOWS_1253="windows-1253",E.WINDOWS_1254="windows-1254",E.WINDOWS_1255="windows-1255",E.WINDOWS_1256="windows-1256",E.WINDOWS_1257="windows-1257",E.WINDOWS_1258="windows-1258",E.X_MAC_CYRILLIC="x-mac-cyrillic",E.GBK="gbk",E.GB18030="gb18030",E.BIG5="big5",E.EUC_JP="euc-jp",E.ISO_2022_JP="iso-2022-jp",E.SHIFT_JIS="shift-jis",E.EUC_KR="euc-kr",E.HZ_GB_2312="hz-gb-2312",E.ISO_2022_CN="iso-2022-cn",E.ISO_2022_CN_EXT="iso-2022-cn-ext",E.ISO_2022_KR="iso-2022-kr",E.UTF_16="utf-16",E.X_USER_DEFINED="x-user-defined",exports.ALPHABET_KB_KEYS=d,exports.ARROW=p,exports.EXTENSION_BY_MIME_TYPE=y,exports.FileUtils=S,exports.KB_ALPHABET_CODES=g,exports.KB_CODE=u,exports.KB_KEY=c,exports.MIME_TYPE_BY_EXTENSION=v,exports.PRIMENG_DATE_FORMAT_META={d:{type:"day",minLength:1,maxLength:2},dd:{type:"day",minLength:2,maxLength:2},m:{type:"month",minLength:1,maxLength:2},mm:{type:"month",minLength:2,maxLength:2},y:{type:"year",minLength:2,maxLength:2},yy:{type:"year",minLength:4,maxLength:4}},exports.RdtArrayUtils=class{static removeAt(t,e){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),...t.slice(e+1)]}static insertAt(t,e,a){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),a,...t.slice(e)]}static isEqual(t,e){return t&&e?t.length===e.length&&t.every((t=>e.indexOf(t)>-1)):!t==!e}},exports.RdtCssUtils=_,exports.RdtDateParser=class{set leadingZeroMode(t){this.cfg.leadingZeroMode=t,this._parsedFormat=this.parseFormat(this.cfg)}set yearInputMode(t){this.cfg.yearInputMode=t,this._parsedFormat=this.parseFormat(this.cfg)}set twoDigitYearInputStrategy(t){this.cfg.twoDigitYearInputStrategy=t,this._parsedFormat=this.parseFormat(this.cfg)}set insertMode(t){this.cfg.insertMode=t,this._parsedFormat=this.parseFormat(this.cfg)}set format(t){this.cfg.format=t,this._parsedFormat=this.parseFormat(this.cfg)}get format(){return this.cfg.format}get leadingZeroMode(){return this.cfg.leadingZeroMode}get yearInputMode(){return this.cfg.yearInputMode}get twoDigitYearInputStrategy(){return this.cfg.twoDigitYearInputStrategy}get insertMode(){return this.cfg.insertMode}onKeyDown(t){"Backspace"===t.key&&(this.deleting=!0);const e=t.target;var a;this.caretPosition=null!=(a=e.selectionStart)?a:e.value.length-1}onKeyUp(t){"Backspace"===t.key&&(this.deleting=!1)}onInput(t){const e=t.target,a=e.value;var n;const r=null!=(n=e.selectionStart)?n:a.length-1,s=this.parse(a,r);e.value=s.prettyInput,m.setCaretPosition(e,s.caret),this._value=s.date,this._inputValue=s.prettyInput,this.caretPosition=s.caret}get value(){return this._value}set value(t){if(!(t instanceof Date))return this._value=null,void(this._inputValue="");let e="";this._parsedFormat.forEach((a=>{switch(a.type){case"constant":e+=a.value;break;case"day":e+=`${t.getDate()}`.padStart(a.minLength,"0");break;case"month":e+=`${t.getMonth()+1}`.padStart(a.minLength,"0");break;case"year":e+=(""+t.getFullYear()%10**a.maxLength).padStart(a.minLength,"0")}})),this._value=t,this._inputValue=e}set inputValue(t){this._inputValue=t}get inputValue(){return this._inputValue}parse(t,e=this.caretPosition,a=this.deleting){let n=t,r=null,s=null,i=null,l="",p=e,c=!0,u=!1;for(let d=0;d<this._parsedFormat.length&&0!==n.length;d++){const g=this._parsedFormat[d],m=n.search(/\d/);if("constant"===g.type){if(m>0){const e=a?n.substring(0,g.value.length):n.substring(0,m);if(a&&e!==g.value){if(n.length===t.length)continue;p-=g.value.length-e.length}n=n.substring(m)}l+=g.value}else{if(m<0)break;if(p>l.length&&(c=!0),"year"===g.type)if(1&this.cfg.yearInputMode&&(n.match(/^\d{3,4}/)||n.match(/^\d{2}$/)&&d!==this._parsedFormat.length-1))if(!a&&0===this.cfg.insertMode&&n.match(/^\d{5}/)&&e<n.length&&e-l.length<=5&&o.isNumericCharacter(n[e])&&(n=n.substring(0,e)+n.substring(e+1)),n.match(/^\d{4}/)){const t=n.substring(0,4);i=parseInt(t),n=n.substring(4),l+=t,a||({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a))}else n.match(/^\d{3}/)?(l+=n.substring(0,3),n=n.substring(3),l.length<=p&&(c=!1)):(l=n.substring(0,2),n=n.substring(2),l.length<=p&&(c=!1));else if(2&this.cfg.yearInputMode&&n.match(/^\d{2}/)&&(this.containsNonNumericCharacters(n.substring(2))||d===this._parsedFormat.length-1)){const t=n.substring(0,2),e=parseInt(t);i="past"===this.cfg.twoDigitYearInputStrategy?h.doubleDigitYearToPast(e):h.doubleDigitYearToFuture(e),n=n.substring(2),a||({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a)),l+=t,1&this.cfg.yearInputMode&&d===this._parsedFormat.length-1&&(u=!0)}else n.match(/^\d/)&&(l+=n[0],n=n.substring(1),l.length<=p&&(c=!1));else if("month"===g.type){const t=this.readNumber(1,12,l,n,p,a);l=t.output,n=t.rest,p=t.targetCaret,null!==t.value&&(s=t.value,t.complete&&!a&&({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a)),!t.complete&&l.length<=p&&(c=!1))}else if("day"===g.type){const t=this.readNumber(1,31,l,n,p,a);l=t.output,n=t.rest,p=t.targetCaret,null!==t.value&&(r=t.value,t.complete&&!a&&({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a)),!t.complete&&l.length<=p&&(c=!1))}}}let d=null;if(null!==i&&null!==s&&null!==r&&(d=new Date(i,s-1,r),d.getMonth()!==s-1&&(d=null)),p=Math.min(p,l.length+1),a)d||(l=t,p=e);else if(e===t.length)p=l.length;else if(c)for(;p>0&&l.length>p&&!o.isNumericCharacter(l[p]);)p++;return{prettyInput:l,date:d,complete:null!==d,caret:p,ambiguous:u||null===d}}readNumber(t,e,a,n,r,s){const i=function(t){return Math.log10(t)+1|0}(e);let o=null,l="",p=!1;if(1&this.cfg.leadingZeroMode){var c,u;let r=null!=(u=null==(c=n.match(/^\d+/))?void 0:c[0])?u:"";if(r.length>0){if(r=r.slice(0,i),o=parseInt(r),o<t){o=null;let e="9";for(;r.length+1>i||parseInt(r+e)<t;)r=r.slice(0,-1),e+="9"}else{for(;o>e&&r.length>0;)r=r.slice(0,-1),o=parseInt(r);0===r.length&&(o=null)}"0"!==r[0]||0===t||2&this.cfg.leadingZeroMode||(o=null,r="")}a+=r,n=n.substring(r.length),l=r}else{const t=new RegExp(`^\\d{${i}}`);n.match(t)&&(l=n.substring(0,i),a+=l,n=n.substring(i),o=parseInt(l))}return null!==o&&o>=t&&o<=e?(p=l.length===i||10*o>e,({rest:n,targetCaret:r}=this.useUpNumbersUntilNextSeparator(n,r,p&&!s,s)),{value:o,complete:p,output:a,rest:n,targetCaret:r}):{value:null,complete:!1,output:a,rest:n,targetCaret:r}}parseFormat(t){const e=Object.keys(t.symbolMeta);e.sort(((t,e)=>e.length-t.length));let a=t.format;const n=[];for(;a.length>0;){const r=e.map((t=>a.indexOf(t))),s=r.indexOf(Math.min(...r.filter((t=>t>=0)))),i=r[s],o=e[s];i>0?(n.push({type:"constant",value:a.substring(0,i)}),a=a.substring(i)):i<0?(n.push({type:"constant",value:a}),a=""):(n.push(t.symbolMeta[o]),a=a.substring(i+o.length))}return n}useUpNumbersUntilNextSeparator(t,e,a,n){let r=0;for(;r<t.length&&o.isNumericCharacter(t[r]);)r++;return r!==t.length?{rest:t.substring(r),targetCaret:e-(n?r:0)}:a?{rest:" "+t,targetCaret:e}:{rest:t,targetCaret:e}}containsNonNumericCharacters(t){return t.search(/\D/)>=0}constructor(t){this.cfg=t,this._inputValue="",this._value=null,this._parsedFormat=this.parseFormat(t),this.deleting=!1,this.caretPosition=0}},exports.RdtDateUtils=h,exports.RdtHTMLUtils=m,exports.RdtModelUtils=class{static inferPropertyInfo(t,a){const n=e(a).fileName.split("-"),r={};n.forEach((t=>r[t]=1));let i=0,o="";t.forEach((({key:t})=>{const a=e(t).fileName.split("-");let n=0;a.forEach((t=>{var e;return n+=null!=(e=r[t])?e:0}));const s=a.includes("id");n>i&&s?(i=n,o=t):n===i&&s&&t.length<o.length&&(o=t)}));return t.map((t=>{const a=e(t.key).fileName.split("-"),n=a.includes("id");return{key:t.key,type:t.type,required:!0,formControlType:"date"===t.type?"string":t.type,primaryKey:t.key===o,foreignKey:n&&t.key!==o,probablyBoolean:s.includes(a[0])&&"number"===t.type}}))}static names(t){return e(t)}},exports.RdtObjectUtils=class{static pluck(t,e){if(!t)return;const a=Array.isArray(e)?e:e.split(".");let n=t;for(const t of a){if(null==n)return;n=Array.isArray(n)&&"string"==typeof t?n[parseInt(t)]:n[t]}return n}static notNullGuard(t){return null!=t}static expandKey(t,e){const a=t.split(".");if(0===a.length)return e;const n=i(a[0]);let r=n;for(let t=1;t<a.length;t++){const e=i(a[t]);r.obj[r.key]=e.obj,r=e}return r.obj[r.key]=e,n.obj}},exports.RdtRandomUtils=class{static randomId(){return Math.random().toString(36).substring(2)}static trueFalse(){return Math.random()<.5}},exports.RdtRxUtils=class{static repeatLatestWhen(e){return a=>t.combineLatest([a,e.pipe(t.startWith(null))]).pipe(t.map((([t])=>t)))}static completeIfNull(e){return e.pipe(t.switchMap((e=>null==e?t.EMPTY:t.of(e))))}static makeObservable(e){return e instanceof t.Observable?e:t.of(e)}},exports.RdtStringUtils=o,exports.Rdt_DEFAULT_MIME_TYPE=b,exports.Rdt_DEFAULT_MS_OFFICE_ACTION=O;
|
package/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class a{static capitalize(a){return a.charAt(0).toLocaleUpperCase()+a.slice(1)}}export{a as RdtStringUtils};
|
|
1
|
+
import{combineLatest as t,startWith as e,map as a,switchMap as n,EMPTY as r,of as s,Observable as i}from"rxjs";function o(t){return{name:t,className:(a=t,e=l(a),e.charAt(0).toUpperCase()+e.slice(1)),propertyName:l(t),constantName:c(t),fileName:p(t)};var e,a}function l(t){return t.replace(/([^a-zA-Z0-9])+(.)?/g,((t,e,a)=>a?a.toUpperCase():"")).replace(/[^a-zA-Z\d]/g,"").replace(/^([A-Z])/,(t=>t.toLowerCase()))}function c(t){return p(l(t.toUpperCase()===t?t.toLowerCase():t)).replace(/([^a-zA-Z0-9])/g,"_").toUpperCase()}function p(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase().replace(/(?!^_)[ _]/g,"-")}const u=["je","lze"];class g{static inferPropertyInfo(t,e){const a=o(e).fileName.split("-"),n={};a.forEach((t=>n[t]=1));let r=0,s="";t.forEach((({key:t})=>{const e=o(t).fileName.split("-");let a=0;e.forEach((t=>{var e;return a+=null!=(e=n[t])?e:0}));const i=e.includes("id");a>r&&i?(r=a,s=t):a===r&&i&&t.length<s.length&&(s=t)}));return t.map((t=>{const e=o(t.key).fileName.split("-"),a=e.includes("id");return{key:t.key,type:t.type,required:!0,formControlType:"date"===t.type?"string":t.type,primaryKey:t.key===s,foreignKey:a&&t.key!==s,probablyBoolean:u.includes(e[0])&&"number"===t.type}}))}static names(t){return o(t)}}class m{static removeAt(t,e){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),...t.slice(e+1)]}static insertAt(t,e,a){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),a,...t.slice(e)]}static isEqual(t,e){return t&&e?t.length===e.length&&t.every((t=>e.indexOf(t)>-1)):!t==!e}}class d{static pluck(t,e){if(!t)return;const a=Array.isArray(e)?e:e.split(".");let n=t;for(const t of a){if(null==n)return;n=Array.isArray(n)&&"string"==typeof t?n[parseInt(t)]:n[t]}return n}static notNullGuard(t){return null!=t}static expandKey(t,e){const a=t.split(".");if(0===a.length)return e;const n=h(a[0]);let r=n;for(let t=1;t<a.length;t++){const e=h(a[t]);r.obj[r.key]=e.obj,r=e}return r.obj[r.key]=e,n.obj}}function h(t){const e=parseInt(t);return isNaN(e)?{obj:{},key:t}:{obj:[],key:e}}class f{static randomId(){return Math.random().toString(36).substring(2)}static trueFalse(){return Math.random()<.5}}class w{static repeatLatestWhen(n){return r=>t([r,n.pipe(e(null))]).pipe(a((([t])=>t)))}static completeIfNull(t){return t.pipe(n((t=>null==t?r:s(t))))}static makeObservable(t){return t instanceof i?t:s(t)}}class y{static tokenize(t){return t?t.split(/\W+/).filter((t=>!!t)):[]}static joinPaths(t,e){const a=t.endsWith("/"),n=e.startsWith("/");return a&&n?t.slice(0,-1)+e:a||n?t+e:t+"/"+e}static isAlphabetCharacter(t){return!(t.length>1)&&t.toLocaleLowerCase()!==t.toLocaleUpperCase()}static isNumericCharacter(t){return!isNaN(parseInt(t))}static capitalize(t){return t.charAt(0).toLocaleUpperCase()+t.slice(1)}static toDataTestId(t){var e;return null==(e=y.removeAccents(t).toLowerCase())?void 0:e.replace(/ /g,"-")}static removeAccents(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}static stripTrailingSlash(t){const e=t.match(/#|\?|$/),a=e&&e.index||t.length,n=a-("/"===t[a-1]?1:0);return t.slice(0,n)+t.slice(a)}static createAbsoluteUrl(t,e){return y.joinPaths(e,t)}static appendQueryParams(t,e){if(e&&0!==Object.keys(e).length){return`${t}?${new URLSearchParams(e)}`}return t}static localeCompare(t,e,a="asc"){const n="asc"===a?1:-1;return t==e?0:null==t?-n:null==e?n:t.localeCompare(e)*n}static komixcomlocalReplaceString(t){const e=location.hostname;return{replaceString:t.includes("komix.com")?"komix.com":"komix.local",toReplace:e.includes("komix.com")?"komix.com":"komix.local"}}static swapChars(t,e,a){return e<0||a<0||e>=t.length||a>=t.length?t:(a<e&&([e,a]=[a,e]),t.slice(0,e)+t[a]+t.slice(e+1,a)+t[e]+t.slice(a+1))}static insertAt(t,e,a){return t.slice(0,e)+a+t.slice(e)}static getDataTestId(t,e,a){var n;let r=null==(n=t.toLowerCase())?void 0:n.replace(/ /g,"-");return e&&(r=`${e}__${r}`),a&&(r=`${r}--${a}`),y.removeAccents(r)}}function D(){return D=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},D.apply(this,arguments)}const v={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight"},x={SPACEBAR:" ",ENTER:"Enter",ESCAPE:"Escape",HOME:"Home",END:"End",TAB:"Tab",ARROW:v},b=D({},x,{SPACEBAR:"Space"}),M=Array.from(Array(26)).map(((t,e)=>e+65)).map((t=>String.fromCharCode(t))),O=M.map((t=>`Key${t.toUpperCase()}`));class S{static scrollIntoViewHorizontallyWithinParent(t){const e=t.parentElement;if(!e)return;const a=t.offsetLeft,n=t.offsetWidth,r=e.offsetWidth,s=e.scrollLeft,i=a,o=a-r+n;s>i?e.scrollLeft=i:s<o&&(e.scrollLeft=o)}static setCaretPosition(t,e){t.focus(),t.setSelectionRange(e,e)}}class I{static getDays(t,e){return I.getDayOffset(new Date(t))-I.getDayOffset(new Date(e))}static checkDate(t,e,a){const n=new Date(t,e-1,a);return n.getFullYear()===t&&n.getMonth()+1===e&&n.getDate()===a}static isValidDate(t){return null!=t&&(t instanceof Date?!isNaN(t.getTime()):!isNaN(new Date(t).getTime()))}static startOfDay(t){const e=new Date(t);return e.setHours(0,0,0,0),e}static endOfDay(t){const e=new Date(t);return e.setHours(23,59,59),e}static startOfMonth(t){const e=new Date(t);return e.setHours(0,0,0,0),e.setDate(1),e}static endOfMonth(t){const e=new Date(t);return e.setHours(23,59,59),e.setDate(0),e}static startOfYear(t){return new Date(t,0,1)}static endOfYear(t){return new Date(t,11,31)}static beginningOfNextMonth(){const t=new Date;return 11===t.getMonth()?new Date(t.getFullYear()+1,0,1):new Date(t.getFullYear(),t.getMonth()+1,1)}static endOfNextMonth(){const t=new Date;if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,0,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+2,1);return this.minusOneDay(e)}}static beginningOfInThreeMonths(){const t=new Date;return 10===t.getMonth()?new Date(t.getFullYear()+1,1,1):11===t.getMonth()?new Date(t.getFullYear()+1,2,1):new Date(t.getFullYear(),t.getMonth()+3,1)}static endOfInNextThreeMonths(){const t=new Date;if(9===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,2,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,3,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+4,1);return this.minusOneDay(e)}}static minusOneDay(t){return new Date(t.getTime()-I.DAY)}static toISOLocal(t){return`${t.getFullYear()}-${`${t.getMonth()+1}`.padStart(2,"0")}-${`${t.getDate()}`.padStart(2,"0")}T${`${t.getHours()}`.padStart(2,"0")}:${`${t.getMinutes()}`.padStart(2,"0")}:${`${t.getSeconds()}`.padStart(2,"0")}`}static formatDate(t){if(null==t||""===t)return"";const e=t instanceof Date?t:new Date(t);if(I.isValidDate(e)){const t=e.getFullYear(),a=`${e.getMonth()+1}`.padStart(2,"0");return`${`${e.getDate()}`.padStart(2,"0")}.${a}.${t}`}return""}static timeToDate(t){const e=new Date(0);if(I.hhMmSsMsRegex.test(t)){const a=t.match(I.hhMmSsMsRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]),s=parseInt(a[4]);return e.setHours(t,n,r,s),e}}else if(I.hhMmSsRegex.test(t)){const a=t.match(I.hhMmSsRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]);return e.setHours(t,n,r),e}}else if(I.hhMmRegex.test(t)){const a=t.match(I.hhMmRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]);return e.setHours(t,n),e}}return null}static setTime(t,e){const a=new Date(t),n=I.timeToDate(e);return n&&a.setHours(n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),a}static getTime(t,e=!0){const a=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0");if(e){return`${a}:${n}:${t.getSeconds().toString().padStart(2,"0")}`}return`${a}:${n}`}static parseToDate(t){if(t instanceof Date)return I.isValidDate(t)?t:null;if("string"==typeof t){const e=new Date(t);if(I.isValidDate(e))return e}return null}static parse(t){if(t instanceof Date)return I.isValidDate(t)?t.getTime():null;if("string"==typeof t){const e=new Date(t);if(I.isValidDate(e))return e.getTime()}return null}static isEqual(t,e){return t===e||!(!t||!e)&&t.getTime()===e.getTime()}static isLeapYear(t){return 29===new Date(t,1,29).getDate()}static getDaysInYear(t){return I.isLeapYear(t)?366:365}static getDayOffset(t){const e=t.getFullYear()-1,a=t.getMonth()+1,n=t.getDate(),r=Math.trunc(e/4)-Math.trunc(e/100)+Math.trunc(e/400);return I.isLeapYear(e+1)?365*e+r+I.daysUpToMonthLeapYear[a-1]+n-1:365*e+r+I.daysUpToMonth[a-1]+n-1}static doubleDigitYearToPast(t){const e=I.getCurrentYear(),a=e%100;return t<=a?t+e-a:t+e-a-100}static doubleDigitYearToFuture(t){const e=I.getCurrentYear(),a=e%100;return t>=a?t+e-a:t+e-a+100}static getCurrentYear(){return(new Date).getFullYear()}static calculateAge(t,e){const a=new Date(t),n=new Date(e);let r=n.getFullYear()-a.getFullYear();const s=n.getMonth()-a.getMonth(),i=n.getDate()-a.getDate();return(s<0||0===s&&i<0)&&r--,r}}var F,_,N;I.MS=1,I.SECOND=1e3*I.MS,I.MINUTE=60*I.SECOND,I.HOUR=60*I.MINUTE,I.DAY=24*I.HOUR,I.hhMmRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*$/,I.hhMmSsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*$/,I.hhMmSsMsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*[\W|\s]\s*(\d{1,3})\s*$/,I.daysUpToMonth=[0,31,59,90,120,151,181,212,243,273,304,334],I.daysUpToMonthLeapYear=[0,31,60,91,121,152,182,213,244,274,305,335],function(t){t[t.January=0]="January",t[t.February=1]="February",t[t.March=2]="March",t[t.April=3]="April",t[t.May=4]="May",t[t.June=5]="June",t[t.July=6]="July",t[t.August=7]="August",t[t.September=8]="September",t[t.October=9]="October",t[t.November=10]="November",t[t.December=11]="December"}(F||(F={})),function(t){t.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",t.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",t.PDF="application/pdf",t.TXT="text/plain",t.CSV="text/csv",t.ZIP="application/zip",t.JPG="image/jpeg",t.PNG="image/png",t.GIF="image/gif",t.SVG="image/svg+xml",t.HTML="text/html",t.XML="application/xml",t.JSON="application/json",t.MP3="audio/mpeg",t.MP4="video/mp4",t.OGG="audio/ogg",t.WEBM="video/webm",t.WAV="audio/wav",t.AVI="video/x-msvideo",t.MPEG="video/mpeg",t.WEBP="image/webp",t.ICO="image/x-icon",t.TTF="font/ttf",t.WOFF="font/woff",t.WOFF2="font/woff2",t.EOT="application/vnd.ms-fontobject",t.OTF="font/otf",t.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",t.PPT="application/vnd.ms-powerpoint",t.XLS="application/vnd.ms-excel",t.DOC="application/msword",t.ODT="application/vnd.oasis.opendocument.text",t.ODS="application/vnd.oasis.opendocument.spreadsheet",t.ODP="application/vnd.oasis.opendocument.presentation",t.ODF="application/vnd.oasis.opendocument.formula",t.RAR="application/vnd.rar",t.TAR="application/x-tar",t.GZIP="application/gzip",t.BZIP2="application/x-bzip2",t.XZ="application/x-xz",t.SEVENZ="application/x-7z-compressed",t.RAR5="application/x-rar-compressed",t.WMA="audio/x-ms-wma",t.WMV="video/x-ms-wmv",t.FLV="video/x-flv",t.OGV="video/ogg",t.BIN="application/octet-stream"}(_||(_={})),function(t){t.IMAGE="image/*",t.AUDIO="audio/*",t.VIDEO="video/*",t.FONT="font/*",t.DOCUMENT="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,application/pdf,text/plain,text/csv",t.SPREADSHEET="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet",t.PRESENTATION="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.oasis.opendocument.presentation",t.ARCHIVE="application/zip,application/vnd.rar,application/x-tar,application/gzip,application/x-bzip2,application/x-xz,application/x-7z-compressed,application/x-rar-compressed"}(N||(N={}));const T={"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/pdf":"pdf","text/plain":"txt","text/csv":"csv","application/zip":"zip","image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/svg+xml":"svg","text/html":"html","application/xml":"xml","application/json":"json","audio/mpeg":"mp3","video/mp4":"mp4","audio/ogg":"ogg","video/webm":"webm","audio/wav":"wav","video/x-msvideo":"avi","video/mpeg":"mpeg","image/webp":"webp","image/x-icon":"ico","font/ttf":"ttf","font/woff":"woff","font/woff2":"woff2","application/vnd.ms-fontobject":"eot","font/otf":"otf","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/vnd.ms-powerpoint":"ppt","application/vnd.ms-excel":"xls","application/msword":"doc","application/vnd.oasis.opendocument.text":"odt","application/vnd.oasis.opendocument.spreadsheet":"ods","application/vnd.oasis.opendocument.presentation":"odp","application/vnd.oasis.opendocument.formula":"odf","application/vnd.rar":"rar","application/x-tar":"tar","application/gzip":"gz","application/x-bzip2":"bz2","application/x-xz":"xz","application/x-7z-compressed":"7z","application/x-rar-compressed":"rar","audio/x-ms-wma":"wma","video/x-ms-wmv":"wmv","video/x-flv":"flv","video/ogg":"ogv","application/octet-stream":"bin"},C={};for(const[t,e]of Object.entries(T))C[e]=t;var A,R;!function(t){t.Edit="ofe|u|",t.View="ofv|u|"}(A||(A={})),function(t){t.Word="ms-word",t.Excel="ms-excel",t.PowerPoint="ms-powerpoint"}(R||(R={}));const B=_.BIN,$="ofv|u|";var L;!function(t){t.B="B",t.KB="KB",t.MB="MB",t.GB="GB",t.TB="TB",t.PB="PB",t.EB="EB",t.ZB="ZB",t.YB="YB"}(L||(L={}));const E=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];class P{static getMsOfficeLink(t,e){var a;const n=null!=(a=e.app)?a:P.getMsOfficeAppByMimeType(e.mimeType);if(n){var r;return`${n}:${null!=(r=e.action)?r:$}${t}`}return t}static openFileFromRemoteUrl(t,e){window.open(P.getMsOfficeLink(t,e))}static openFileInBrowser(t,e){const a=P.getBase64Link(t,e);window.open(a,"_blank")}static fileAsArrayBuffer(t){return new Promise(((e,a)=>{t||a(null);const n=new FileReader;n.onload=()=>e(n.result),n.onerror=a,n.readAsArrayBuffer(t)}))}static fileAsText(t,e){return new Promise(((a,n)=>{t||n(null);const r=new FileReader;r.onload=()=>a(r.result),r.onerror=n,r.readAsText(t,e)}))}static downloadFileFromData(t,e,a){var n;a=null!=(n=null!=a?a:P.getMimeTypeFromFileName(e))?n:P.getMimeTypeFromBase64(t);const r=P.getBase64Link(t,a);this.downloadFileFromRemoteUrl(r,e,a)}static downloadFileFromRemoteUrl(t,e,a){a=null!=a?a:P.getMimeTypeFromFileName(e);const n=document.createElement("a");n.href=t,n.download=P.getFileName(e,a),n.click()}static getMimeTypeFromBase64(t){var e;return null==(e=t.match(/data:(.*?);base64/))?void 0:e[1]}static getMimeTypeFromFileName(t){const e=null==t?void 0:t.split(".").pop();var a;return null!=(a=C[e])?a:B}static getFileName(t,e){if(e){const a=T[e];return t.endsWith(`.${a}`)?t:`${t}.${a}`}return t}static getBase64Link(t,e){return t.startsWith("data:")?t:e?`data:${e};base64,${t}`:(console.error("Missing mime type for base64 data."),"")}static getMimeTypeFromResponse(t){var e;return null==(e=t.body)?void 0:e.type}static getFileNameFromResponse(t){var e,a,n,r,s;return null!=(s=null==(r=t.headers.get("content-disposition"))||null==(n=r.split("filename="))||null==(a=n[1])||null==(e=a.split(";"))?void 0:e[0])?s:""}static async blobToDataUrl(t){return new Promise(((e,a)=>{t||a(null);const n=new FileReader;n.onload=()=>e(n.result),n.onerror=a,n.readAsDataURL(t)}))}static convertFromBytes(t,e=2){if(0===t)return"0 B";const a=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,a)).toFixed(e))+" "+E[a]}static convertToBytes(t,e){const a=E.indexOf(e);return t*Math.pow(1024,a)}static fileSizeToBytes(t){const[e,a]=t.split(" "),n=parseFloat(e),r=a;return isNaN(n)||-1===E.indexOf(r)?null:P.convertToBytes(n,r)}static getMsOfficeAppByMimeType(t){switch(t){case _.DOC:case _.DOCX:case _.ODT:return"ms-word";case _.XLS:case _.XLSX:case _.ODS:return"ms-excel";case _.PPT:case _.PPTX:case _.ODP:return"ms-powerpoint";default:return null}}}class W{static normalizeColor(t){const e=t.trim();return this.isHexColor(e)?W.normalizeHex(e):this.isRgbColor(e)?W.normalizeRgb(e):this.isRgbaColor(e)?W.normalizeRgba(e):null}static normalizeHex(t){const e=t.match(W.hexRegex);return e?`#${e[2]}`:null}static normalizeRgb(t){const e=t.match(W.rgbRegex);return e?`rgb(${e[2]},${e[3]},${e[4]})`:null}static normalizeRgba(t){const e=t.match(W.rgbaRegex);return e?`rgba(${e[2]},${e[3]},${e[4]},${e[5]})`:null}static isRgbColor(t){return W.rgbRegex.test(t)}static isHexColor(t){return W.hexRegex.test(t)}static isRgbaColor(t){return W.rgbaRegex.test(t)}}var Y;W.rgbRegex=/^(rgb)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\s*\)?$/,W.rgbaRegex=/^(rgba)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+((0(\.\d+)?)|(1(\.0)?))\s*\)?$/,W.hexRegex=/^(#?)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,function(t){t.Day="day",t.Month="month",t.Year="year",t.Constant="constant"}(Y||(Y={}));const U={d:{type:"day",minLength:1,maxLength:2},dd:{type:"day",minLength:2,maxLength:2},m:{type:"month",minLength:1,maxLength:2},mm:{type:"month",minLength:2,maxLength:2},y:{type:"year",minLength:2,maxLength:2},yy:{type:"year",minLength:4,maxLength:4}};var k,z,H,j,V;!function(t){t[t.Overwrite=0]="Overwrite",t[t.Shift=1]="Shift"}(k||(k={})),function(t){t[t.Replace=0]="Replace",t[t.Insert=1]="Insert"}(z||(z={})),function(t){t[t.FourDigit=1]="FourDigit",t[t.TwoDigit=2]="TwoDigit",t[t.Both=3]="Both"}(H||(H={})),function(t){t[t.NoLeadingZero=1]="NoLeadingZero",t[t.LeadingZero=2]="LeadingZero",t[t.Both=3]="Both"}(j||(j={}));class Z{set leadingZeroMode(t){this.cfg.leadingZeroMode=t,this._parsedFormat=this.parseFormat(this.cfg)}set yearInputMode(t){this.cfg.yearInputMode=t,this._parsedFormat=this.parseFormat(this.cfg)}set twoDigitYearInputStrategy(t){this.cfg.twoDigitYearInputStrategy=t,this._parsedFormat=this.parseFormat(this.cfg)}set insertMode(t){this.cfg.insertMode=t,this._parsedFormat=this.parseFormat(this.cfg)}set format(t){this.cfg.format=t,this._parsedFormat=this.parseFormat(this.cfg)}get format(){return this.cfg.format}get leadingZeroMode(){return this.cfg.leadingZeroMode}get yearInputMode(){return this.cfg.yearInputMode}get twoDigitYearInputStrategy(){return this.cfg.twoDigitYearInputStrategy}get insertMode(){return this.cfg.insertMode}onKeyDown(t){"Backspace"===t.key&&(this.deleting=!0);const e=t.target;var a;this.caretPosition=null!=(a=e.selectionStart)?a:e.value.length-1}onKeyUp(t){"Backspace"===t.key&&(this.deleting=!1)}onInput(t){const e=t.target,a=e.value;var n;const r=null!=(n=e.selectionStart)?n:a.length-1,s=this.parse(a,r);e.value=s.prettyInput,S.setCaretPosition(e,s.caret),this._value=s.date,this._inputValue=s.prettyInput,this.caretPosition=s.caret}get value(){return this._value}set value(t){if(!(t instanceof Date))return this._value=null,void(this._inputValue="");let e="";this._parsedFormat.forEach((a=>{switch(a.type){case"constant":e+=a.value;break;case"day":e+=`${t.getDate()}`.padStart(a.minLength,"0");break;case"month":e+=`${t.getMonth()+1}`.padStart(a.minLength,"0");break;case"year":e+=(""+t.getFullYear()%10**a.maxLength).padStart(a.minLength,"0")}})),this._value=t,this._inputValue=e}set inputValue(t){this._inputValue=t}get inputValue(){return this._inputValue}parse(t,e=this.caretPosition,a=this.deleting){let n=t,r=null,s=null,i=null,o="",l=e,c=!0,p=!1;for(let u=0;u<this._parsedFormat.length&&0!==n.length;u++){const g=this._parsedFormat[u],m=n.search(/\d/);if("constant"===g.type){if(m>0){const e=a?n.substring(0,g.value.length):n.substring(0,m);if(a&&e!==g.value){if(n.length===t.length)continue;l-=g.value.length-e.length}n=n.substring(m)}o+=g.value}else{if(m<0)break;if(l>o.length&&(c=!0),"year"===g.type)if(1&this.cfg.yearInputMode&&(n.match(/^\d{3,4}/)||n.match(/^\d{2}$/)&&u!==this._parsedFormat.length-1))if(!a&&0===this.cfg.insertMode&&n.match(/^\d{5}/)&&e<n.length&&e-o.length<=5&&y.isNumericCharacter(n[e])&&(n=n.substring(0,e)+n.substring(e+1)),n.match(/^\d{4}/)){const t=n.substring(0,4);i=parseInt(t),n=n.substring(4),o+=t,a||({rest:n,targetCaret:l}=this.useUpNumbersUntilNextSeparator(n,l,!0,a))}else n.match(/^\d{3}/)?(o+=n.substring(0,3),n=n.substring(3),o.length<=l&&(c=!1)):(o=n.substring(0,2),n=n.substring(2),o.length<=l&&(c=!1));else if(2&this.cfg.yearInputMode&&n.match(/^\d{2}/)&&(this.containsNonNumericCharacters(n.substring(2))||u===this._parsedFormat.length-1)){const t=n.substring(0,2),e=parseInt(t);i="past"===this.cfg.twoDigitYearInputStrategy?I.doubleDigitYearToPast(e):I.doubleDigitYearToFuture(e),n=n.substring(2),a||({rest:n,targetCaret:l}=this.useUpNumbersUntilNextSeparator(n,l,!0,a)),o+=t,1&this.cfg.yearInputMode&&u===this._parsedFormat.length-1&&(p=!0)}else n.match(/^\d/)&&(o+=n[0],n=n.substring(1),o.length<=l&&(c=!1));else if("month"===g.type){const t=this.readNumber(1,12,o,n,l,a);o=t.output,n=t.rest,l=t.targetCaret,null!==t.value&&(s=t.value,t.complete&&!a&&({rest:n,targetCaret:l}=this.useUpNumbersUntilNextSeparator(n,l,!0,a)),!t.complete&&o.length<=l&&(c=!1))}else if("day"===g.type){const t=this.readNumber(1,31,o,n,l,a);o=t.output,n=t.rest,l=t.targetCaret,null!==t.value&&(r=t.value,t.complete&&!a&&({rest:n,targetCaret:l}=this.useUpNumbersUntilNextSeparator(n,l,!0,a)),!t.complete&&o.length<=l&&(c=!1))}}}let u=null;if(null!==i&&null!==s&&null!==r&&(u=new Date(i,s-1,r),u.getMonth()!==s-1&&(u=null)),l=Math.min(l,o.length+1),a)u||(o=t,l=e);else if(e===t.length)l=o.length;else if(c)for(;l>0&&o.length>l&&!y.isNumericCharacter(o[l]);)l++;return{prettyInput:o,date:u,complete:null!==u,caret:l,ambiguous:p||null===u}}readNumber(t,e,a,n,r,s){const i=function(t){return Math.log10(t)+1|0}(e);let o=null,l="",c=!1;if(1&this.cfg.leadingZeroMode){var p,u;let r=null!=(u=null==(p=n.match(/^\d+/))?void 0:p[0])?u:"";if(r.length>0){if(r=r.slice(0,i),o=parseInt(r),o<t){o=null;let e="9";for(;r.length+1>i||parseInt(r+e)<t;)r=r.slice(0,-1),e+="9"}else{for(;o>e&&r.length>0;)r=r.slice(0,-1),o=parseInt(r);0===r.length&&(o=null)}"0"!==r[0]||0===t||2&this.cfg.leadingZeroMode||(o=null,r="")}a+=r,n=n.substring(r.length),l=r}else{const t=new RegExp(`^\\d{${i}}`);n.match(t)&&(l=n.substring(0,i),a+=l,n=n.substring(i),o=parseInt(l))}return null!==o&&o>=t&&o<=e?(c=l.length===i||10*o>e,({rest:n,targetCaret:r}=this.useUpNumbersUntilNextSeparator(n,r,c&&!s,s)),{value:o,complete:c,output:a,rest:n,targetCaret:r}):{value:null,complete:!1,output:a,rest:n,targetCaret:r}}parseFormat(t){const e=Object.keys(t.symbolMeta);e.sort(((t,e)=>e.length-t.length));let a=t.format;const n=[];for(;a.length>0;){const r=e.map((t=>a.indexOf(t))),s=r.indexOf(Math.min(...r.filter((t=>t>=0)))),i=r[s],o=e[s];i>0?(n.push({type:"constant",value:a.substring(0,i)}),a=a.substring(i)):i<0?(n.push({type:"constant",value:a}),a=""):(n.push(t.symbolMeta[o]),a=a.substring(i+o.length))}return n}useUpNumbersUntilNextSeparator(t,e,a,n){let r=0;for(;r<t.length&&y.isNumericCharacter(t[r]);)r++;return r!==t.length?{rest:t.substring(r),targetCaret:e-(n?r:0)}:a?{rest:" "+t,targetCaret:e}:{rest:t,targetCaret:e}}containsNonNumericCharacters(t){return t.search(/\D/)>=0}constructor(t){this.cfg=t,this._inputValue="",this._value=null,this._parsedFormat=this.parseFormat(t),this.deleting=!1,this.caretPosition=0}}!function(t){t.UTF_8="utf-8",t.IBM_866="ibm866",t.ISO_8859_2="iso-8859-2",t.ISO_8859_3="iso-8859-3",t.ISO_8859_4="iso-8859-4",t.ISO_8859_5="iso-8859-5",t.ISO_8859_6="iso-8859-6",t.ISO_8859_7="iso-8859-7",t.ISO_8859_8="iso-8859-8",t.ISO_8859_8_I="iso-8859-8-i",t.ISO_8859_10="iso-8859-10",t.ISO_8859_13="iso-8859-13",t.ISO_8859_14="iso-8859-14",t.ISO_8859_15="iso-8859-15",t.ISO_8859_16="iso-8859-16",t.KOI8_R="koi8-r",t.MACINTOSH="macintosh",t.WINDOWS_874="windows-874",t.WINDOWS_1250="windows-1250",t.WINDOWS_1251="windows-1251",t.WINDOWS_1252="windows-1252",t.WINDOWS_1253="windows-1253",t.WINDOWS_1254="windows-1254",t.WINDOWS_1255="windows-1255",t.WINDOWS_1256="windows-1256",t.WINDOWS_1257="windows-1257",t.WINDOWS_1258="windows-1258",t.X_MAC_CYRILLIC="x-mac-cyrillic",t.GBK="gbk",t.GB18030="gb18030",t.BIG5="big5",t.EUC_JP="euc-jp",t.ISO_2022_JP="iso-2022-jp",t.SHIFT_JIS="shift-jis",t.EUC_KR="euc-kr",t.HZ_GB_2312="hz-gb-2312",t.ISO_2022_CN="iso-2022-cn",t.ISO_2022_CN_EXT="iso-2022-cn-ext",t.ISO_2022_KR="iso-2022-kr",t.UTF_16="utf-16",t.X_USER_DEFINED="x-user-defined"}(V||(V={}));export{M as ALPHABET_KB_KEYS,v as ARROW,T as EXTENSION_BY_MIME_TYPE,L as FileSizeUnit,P as FileUtils,O as KB_ALPHABET_CODES,b as KB_CODE,x as KB_KEY,C as MIME_TYPE_BY_EXTENSION,F as Month,U as PRIMENG_DATE_FORMAT_META,m as RdtArrayUtils,W as RdtCssUtils,Z as RdtDateParser,I as RdtDateUtils,V as RdtEncoding,S as RdtHTMLUtils,k as RdtInsertMode,j as RdtLeadingZeroInputMode,_ as RdtMimeType,g as RdtModelUtils,A as RdtMsOfficeAction,R as RdtMsOfficeApp,d as RdtObjectUtils,z as RdtPasteMode,f as RdtRandomUtils,w as RdtRxUtils,y as RdtStringUtils,H as RdtYearInputMode,B as Rdt_DEFAULT_MIME_TYPE,$ as Rdt_DEFAULT_MS_OFFICE_ACTION,N as VnshCombinedMimeType};
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
export * from './lib/
|
|
1
|
+
export * from './lib/model.utils';
|
|
2
|
+
export * from './lib/array.utils';
|
|
3
|
+
export * from './lib/color.utils';
|
|
4
|
+
export * from './lib/object.utils';
|
|
5
|
+
export * from './lib/random.utils';
|
|
6
|
+
export * from './lib/rxjs.utils';
|
|
7
|
+
export * from './lib/type.utils';
|
|
8
|
+
export * from './lib/string.utils';
|
|
9
|
+
export * from './lib/keyboard.utils';
|
|
10
|
+
export * from './lib/html.utils';
|
|
11
|
+
export * from './lib/date.utils';
|
|
12
|
+
export * from './lib/file.utils';
|
|
13
|
+
export * from './lib/mime-types';
|
|
14
|
+
export * from './lib/css.utils';
|
|
15
|
+
export * from './lib/date-format';
|
|
16
|
+
export * from './lib/encodings';
|
|
17
|
+
export * from './lib/router.utils';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Nullable } from './type.utils';
|
|
2
|
+
export declare class RdtArrayUtils {
|
|
3
|
+
static removeAt<T>(array: T[], index: number): T[];
|
|
4
|
+
static insertAt<T>(array: T[], index: number, item: T): T[];
|
|
5
|
+
static isEqual<T>(a: Nullable<Readonly<T[]>>, b: Nullable<Readonly<T[]>>): boolean;
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class RdtCssUtils {
|
|
2
|
+
static normalizeColor(color: string): string | null;
|
|
3
|
+
private static normalizeHex;
|
|
4
|
+
private static normalizeRgb;
|
|
5
|
+
private static normalizeRgba;
|
|
6
|
+
private static isRgbColor;
|
|
7
|
+
private static isHexColor;
|
|
8
|
+
private static isRgbaColor;
|
|
9
|
+
private static rgbRegex;
|
|
10
|
+
private static rgbaRegex;
|
|
11
|
+
private static hexRegex;
|
|
12
|
+
}
|
|
13
|
+
export type RdtHorizontalDirection = 'left' | 'right';
|
|
14
|
+
export type RdtVerticalDirection = 'up' | 'down';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
interface RdtNumericNode {
|
|
2
|
+
type: RdtFormatType.Day | RdtFormatType.Month | RdtFormatType.Year;
|
|
3
|
+
maxLength: number;
|
|
4
|
+
minLength: number;
|
|
5
|
+
}
|
|
6
|
+
declare enum RdtFormatType {
|
|
7
|
+
Day = "day",
|
|
8
|
+
Month = "month",
|
|
9
|
+
Year = "year",
|
|
10
|
+
Constant = "constant"
|
|
11
|
+
}
|
|
12
|
+
export declare const PRIMENG_DATE_FORMAT_META: Record<string, RdtNumericNode>;
|
|
13
|
+
export interface RdtDateInputConfig {
|
|
14
|
+
format: string;
|
|
15
|
+
yearInputMode: RdtYearInputMode;
|
|
16
|
+
twoDigitYearInputStrategy: RdtTwoDigitYearInputConversionStrategy;
|
|
17
|
+
leadingZeroMode: RdtLeadingZeroInputMode;
|
|
18
|
+
symbolMeta: Record<string, RdtNumericNode>;
|
|
19
|
+
insertMode: RdtInsertMode;
|
|
20
|
+
}
|
|
21
|
+
export declare enum RdtInsertMode {
|
|
22
|
+
Overwrite = 0,
|
|
23
|
+
Shift = 1
|
|
24
|
+
}
|
|
25
|
+
export declare enum RdtPasteMode {
|
|
26
|
+
Replace = 0,
|
|
27
|
+
Insert = 1
|
|
28
|
+
}
|
|
29
|
+
export declare enum RdtYearInputMode {
|
|
30
|
+
FourDigit = 1,
|
|
31
|
+
TwoDigit = 2,
|
|
32
|
+
Both = 3
|
|
33
|
+
}
|
|
34
|
+
export declare enum RdtLeadingZeroInputMode {
|
|
35
|
+
NoLeadingZero = 1,
|
|
36
|
+
LeadingZero = 2,
|
|
37
|
+
Both = 3
|
|
38
|
+
}
|
|
39
|
+
export type RdtTwoDigitYearInputConversionStrategy = 'past' | 'future';
|
|
40
|
+
export declare class RdtDateParser {
|
|
41
|
+
private cfg;
|
|
42
|
+
private _value;
|
|
43
|
+
private _inputValue;
|
|
44
|
+
private _parsedFormat;
|
|
45
|
+
private deleting;
|
|
46
|
+
private caretPosition;
|
|
47
|
+
constructor(cfg: RdtDateInputConfig);
|
|
48
|
+
set leadingZeroMode(mode: RdtLeadingZeroInputMode);
|
|
49
|
+
set yearInputMode(mode: RdtYearInputMode);
|
|
50
|
+
set twoDigitYearInputStrategy(strategy: RdtTwoDigitYearInputConversionStrategy);
|
|
51
|
+
set insertMode(mode: RdtInsertMode);
|
|
52
|
+
set format(format: string);
|
|
53
|
+
get format(): string;
|
|
54
|
+
get leadingZeroMode(): RdtLeadingZeroInputMode;
|
|
55
|
+
get yearInputMode(): RdtYearInputMode;
|
|
56
|
+
get twoDigitYearInputStrategy(): RdtTwoDigitYearInputConversionStrategy;
|
|
57
|
+
get insertMode(): RdtInsertMode;
|
|
58
|
+
onKeyDown(event: KeyboardEvent): void;
|
|
59
|
+
onKeyUp(event: KeyboardEvent): void;
|
|
60
|
+
onInput(event: InputEvent): void;
|
|
61
|
+
get value(): Date | null;
|
|
62
|
+
set value(d: Date | null);
|
|
63
|
+
set inputValue(value: string);
|
|
64
|
+
get inputValue(): string;
|
|
65
|
+
parse(input: string, caretPosition?: number, deleting?: boolean): {
|
|
66
|
+
prettyInput: string;
|
|
67
|
+
date: Date | null;
|
|
68
|
+
complete: boolean;
|
|
69
|
+
caret: number;
|
|
70
|
+
ambiguous: boolean;
|
|
71
|
+
};
|
|
72
|
+
private readNumber;
|
|
73
|
+
private parseFormat;
|
|
74
|
+
private useUpNumbersUntilNextSeparator;
|
|
75
|
+
private containsNonNumericCharacters;
|
|
76
|
+
}
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Nullable } from './type.utils';
|
|
2
|
+
export declare class RdtDateUtils {
|
|
3
|
+
static readonly MS = 1;
|
|
4
|
+
static readonly SECOND: number;
|
|
5
|
+
static readonly MINUTE: number;
|
|
6
|
+
static readonly HOUR: number;
|
|
7
|
+
static readonly DAY: number;
|
|
8
|
+
/**
|
|
9
|
+
* Returns number of days between two dates.
|
|
10
|
+
* Returns zero in case dates are the same. Ignores time.
|
|
11
|
+
*/
|
|
12
|
+
static getDays(a: Date | string | number, b: Date | string | number): number;
|
|
13
|
+
static checkDate(year: number, month: number, day: number): boolean;
|
|
14
|
+
static isValidDate(value: any): value is string | number | Date;
|
|
15
|
+
static startOfDay(input: Date | string): Date;
|
|
16
|
+
static endOfDay(input: Date | string): Date;
|
|
17
|
+
static startOfMonth(input: Date | string): Date;
|
|
18
|
+
static endOfMonth(input: Date | string): Date;
|
|
19
|
+
static startOfYear(year: number): Date;
|
|
20
|
+
static endOfYear(year: number): Date;
|
|
21
|
+
static beginningOfNextMonth(): Date;
|
|
22
|
+
static endOfNextMonth(): Date;
|
|
23
|
+
static beginningOfInThreeMonths(): Date;
|
|
24
|
+
static endOfInNextThreeMonths(): Date;
|
|
25
|
+
static minusOneDay(date: Date): Date;
|
|
26
|
+
static toISOLocal(d: Date): string;
|
|
27
|
+
static formatDate(date: any): string;
|
|
28
|
+
static timeToDate(time: string): Date | null;
|
|
29
|
+
static setTime(date: Date, time: string): Date;
|
|
30
|
+
static getTime(d: Date, showSeconds?: boolean): string;
|
|
31
|
+
static parseToDate(input: Nullable<string | Date>): Date | null;
|
|
32
|
+
static parse(input: Nullable<string | Date>): number | null;
|
|
33
|
+
static isEqual(d1: Date | null, d2: Date | null): boolean;
|
|
34
|
+
static isLeapYear(year: number): boolean;
|
|
35
|
+
static getDaysInYear(year: number): 365 | 366;
|
|
36
|
+
private static hhMmRegex;
|
|
37
|
+
private static hhMmSsRegex;
|
|
38
|
+
private static hhMmSsMsRegex;
|
|
39
|
+
private static daysUpToMonth;
|
|
40
|
+
private static daysUpToMonthLeapYear;
|
|
41
|
+
private static getDayOffset;
|
|
42
|
+
static doubleDigitYearToPast(year2: number): number;
|
|
43
|
+
static doubleDigitYearToFuture(year2: number): number;
|
|
44
|
+
static getCurrentYear(): number;
|
|
45
|
+
static calculateAge(birthDateStr: string, referenceDateStr: string): number;
|
|
46
|
+
}
|
|
47
|
+
export declare enum Month {
|
|
48
|
+
January = 0,
|
|
49
|
+
February = 1,
|
|
50
|
+
March = 2,
|
|
51
|
+
April = 3,
|
|
52
|
+
May = 4,
|
|
53
|
+
June = 5,
|
|
54
|
+
July = 6,
|
|
55
|
+
August = 7,
|
|
56
|
+
September = 8,
|
|
57
|
+
October = 9,
|
|
58
|
+
November = 10,
|
|
59
|
+
December = 11
|
|
60
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare enum RdtEncoding {
|
|
2
|
+
UTF_8 = "utf-8",
|
|
3
|
+
IBM_866 = "ibm866",
|
|
4
|
+
ISO_8859_2 = "iso-8859-2",
|
|
5
|
+
ISO_8859_3 = "iso-8859-3",
|
|
6
|
+
ISO_8859_4 = "iso-8859-4",
|
|
7
|
+
ISO_8859_5 = "iso-8859-5",
|
|
8
|
+
ISO_8859_6 = "iso-8859-6",
|
|
9
|
+
ISO_8859_7 = "iso-8859-7",
|
|
10
|
+
ISO_8859_8 = "iso-8859-8",
|
|
11
|
+
ISO_8859_8_I = "iso-8859-8-i",
|
|
12
|
+
ISO_8859_10 = "iso-8859-10",
|
|
13
|
+
ISO_8859_13 = "iso-8859-13",
|
|
14
|
+
ISO_8859_14 = "iso-8859-14",
|
|
15
|
+
ISO_8859_15 = "iso-8859-15",
|
|
16
|
+
ISO_8859_16 = "iso-8859-16",
|
|
17
|
+
KOI8_R = "koi8-r",
|
|
18
|
+
MACINTOSH = "macintosh",
|
|
19
|
+
WINDOWS_874 = "windows-874",
|
|
20
|
+
WINDOWS_1250 = "windows-1250",
|
|
21
|
+
WINDOWS_1251 = "windows-1251",
|
|
22
|
+
WINDOWS_1252 = "windows-1252",
|
|
23
|
+
WINDOWS_1253 = "windows-1253",
|
|
24
|
+
WINDOWS_1254 = "windows-1254",
|
|
25
|
+
WINDOWS_1255 = "windows-1255",
|
|
26
|
+
WINDOWS_1256 = "windows-1256",
|
|
27
|
+
WINDOWS_1257 = "windows-1257",
|
|
28
|
+
WINDOWS_1258 = "windows-1258",
|
|
29
|
+
X_MAC_CYRILLIC = "x-mac-cyrillic",
|
|
30
|
+
GBK = "gbk",
|
|
31
|
+
GB18030 = "gb18030",
|
|
32
|
+
BIG5 = "big5",
|
|
33
|
+
EUC_JP = "euc-jp",
|
|
34
|
+
ISO_2022_JP = "iso-2022-jp",
|
|
35
|
+
SHIFT_JIS = "shift-jis",
|
|
36
|
+
EUC_KR = "euc-kr",
|
|
37
|
+
HZ_GB_2312 = "hz-gb-2312",
|
|
38
|
+
ISO_2022_CN = "iso-2022-cn",
|
|
39
|
+
ISO_2022_CN_EXT = "iso-2022-cn-ext",
|
|
40
|
+
ISO_2022_KR = "iso-2022-kr",
|
|
41
|
+
UTF_16 = "utf-16",
|
|
42
|
+
X_USER_DEFINED = "x-user-defined"
|
|
43
|
+
}
|
|
44
|
+
export type AllEncodingAliases = 'unicode-1-1-utf-8' | 'unicode11utf8' | 'unicode20utf8' | 'utf-8' | 'utf8' | 'x-unicode20utf8' | '866' | 'cp866' | 'csibm866' | 'ibm866' | 'csisolatin2' | 'iso-8859-2' | 'iso-ir-101' | 'iso8859-2' | 'iso88592' | 'iso_8859-2' | 'iso_8859-2:1987' | 'l2' | 'latin2' | 'csisolatin3' | 'iso-8859-3' | 'iso-ir-109' | 'iso8859-3' | 'iso88593' | 'iso_8859-3' | 'iso_8859-3:1988' | 'l3' | 'latin3' | 'csisolatin4' | 'iso-8859-4' | 'iso-ir-110' | 'iso8859-4' | 'iso88594' | 'iso_8859-4' | 'iso_8859-4:1988' | 'l4' | 'latin4' | 'csisolatincyrillic' | 'cyrillic' | 'iso-8859-5' | 'iso-ir-144' | 'iso8859-5' | 'iso88595' | 'iso_8859-5' | 'iso_8859-5:1988' | 'arabic' | 'asmo-708' | 'csiso88596e' | 'csiso88596i' | 'csisolatinarabic' | 'ecma-114' | 'iso-8859-6' | 'iso-8859-6-e' | 'iso-8859-6-i' | 'iso-ir-127' | 'iso8859-6' | 'iso88596' | 'iso_8859-6' | 'iso_8859-6:1987' | 'csisolatingreek' | 'ecma-118' | 'elot_928' | 'greek' | 'greek8' | 'iso-8859-7' | 'iso-ir-126' | 'iso8859-7' | 'iso88597' | 'iso_8859-7' | 'iso_8859-7:1987' | 'sun_eu_greek' | 'csiso88598e' | 'csisolatinhebrew' | 'hebrew' | 'iso-8859-8' | 'iso-8859-8-e' | 'iso-ir-138' | 'iso8859-8' | 'iso88598' | 'iso_8859-8' | 'iso_8859-8:1988' | 'visual' | 'csiso88598i' | 'iso-8859-8-i' | 'logical' | 'csisolatin6' | 'iso-8859-10' | 'iso-ir-157' | 'iso8859-10' | 'iso885910' | 'l6' | 'latin6' | 'iso-8859-13' | 'iso8859-13' | 'iso885913' | 'iso-8859-14' | 'iso8859-14' | 'iso885914' | 'csisolatin9' | 'iso-8859-15' | 'iso8859-15' | 'iso885915' | 'iso_8859-15' | 'l9' | 'iso-8859-16' | 'cskoi8r' | 'koi' | 'koi8' | 'koi8-r' | 'koi8_r' | 'koi8-ru' | 'koi8-u' | 'csmacintosh' | 'mac' | 'macintosh' | 'x-mac-roman' | 'dos-874' | 'iso-8859-11' | 'iso8859-11' | 'iso885911' | 'tis-620' | 'windows-874' | 'cp1250' | 'windows-1250' | 'x-cp1250' | 'cp1251' | 'windows-1251' | 'x-cp1251' | 'ansi_x3.4-1968' | 'ascii' | 'cp1252' | 'cp819' | 'csisolatin1' | 'ibm819' | 'iso-8859-1' | 'iso-ir-100' | 'iso8859-1' | 'iso88591' | 'iso_8859-1' | 'iso_8859-1:1987' | 'l1' | 'latin1' | 'us-ascii' | 'windows-1252' | 'x-cp1252' | 'cp1253' | 'windows-1253' | 'x-cp1253' | 'cp1254' | 'csisolatin5' | 'iso-8859-9' | 'iso-ir-148' | 'iso8859-9' | 'iso88599' | 'iso_8859-9' | 'iso_8859-9:1989' | 'l5' | 'latin5' | 'windows-1254' | 'x-cp1254' | 'cp1255' | 'windows-1255' | 'x-cp1255' | 'cp1256' | 'windows-1256' | 'x-cp1256' | 'cp1257' | 'windows-1257' | 'x-cp1257' | 'cp1258' | 'windows-1258' | 'x-cp1258' | 'x-mac-cyrillic' | 'x-mac-ukrainian' | 'chinese' | 'csgb2312' | 'csiso58gb231280' | 'gb2312' | 'gb_2312' | 'gb_2312-80' | 'gbk' | 'iso-ir-58' | 'x-gbk' | 'gb18030' | 'big5' | 'big5-hkscs' | 'cn-big5' | 'csbig5' | 'x-x-big5' | 'cseucpkdfmtjapanese' | 'euc-jp' | 'x-euc-jp' | 'csiso2022jp' | 'iso-2022-jp' | 'csshiftjis' | 'ms932' | 'ms_kanji' | 'shift-jis' | 'shift_jis' | 'sjis' | 'windows-31j' | 'x-sjis' | 'cseuckr' | 'csksc56011987' | 'euc-kr' | 'iso-ir-149' | 'korean' | 'ks_c_5601-1987' | 'ks_c_5601-1989' | 'ksc5601' | 'ksc_5601' | 'windows-949' | 'csiso2022kr' | 'hz-gb-2312' | 'iso-2022-cn' | 'iso-2022-cn-ext' | 'iso-2022-kr' | 'replacement' | 'unicodefffe' | 'utf-16be' | 'csunicode' | 'iso-10646-ucs-2' | 'ucs-2' | 'unicode' | 'unicodefeff' | 'utf-16' | 'utf-16le' | 'x-user-defined';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { HttpResponse } from '@angular/common/http';
|
|
2
|
+
import { RdtEncoding } from './encodings';
|
|
3
|
+
import { RdtMimeType } from './mime-types';
|
|
4
|
+
import { Nullable } from './type.utils';
|
|
5
|
+
export declare enum RdtMsOfficeAction {
|
|
6
|
+
Edit = "ofe|u|",
|
|
7
|
+
View = "ofv|u|"
|
|
8
|
+
}
|
|
9
|
+
export declare enum RdtMsOfficeApp {
|
|
10
|
+
Word = "ms-word",
|
|
11
|
+
Excel = "ms-excel",
|
|
12
|
+
PowerPoint = "ms-powerpoint"
|
|
13
|
+
}
|
|
14
|
+
export interface RdtMsOfficeConfig {
|
|
15
|
+
mimeType?: RdtMimeType;
|
|
16
|
+
app?: RdtMsOfficeApp;
|
|
17
|
+
action?: RdtMsOfficeAction;
|
|
18
|
+
}
|
|
19
|
+
export interface RdtDocumentFile<T = string> {
|
|
20
|
+
fileName: string;
|
|
21
|
+
content?: T;
|
|
22
|
+
url?: string;
|
|
23
|
+
mimeType?: RdtMimeType;
|
|
24
|
+
size?: number;
|
|
25
|
+
modified?: Date;
|
|
26
|
+
originalFile?: File;
|
|
27
|
+
}
|
|
28
|
+
export interface DokumentProtokol {
|
|
29
|
+
DokumentProtokol: {
|
|
30
|
+
filename: string;
|
|
31
|
+
content_data: string;
|
|
32
|
+
guid: string;
|
|
33
|
+
code: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export declare const Rdt_DEFAULT_MIME_TYPE = RdtMimeType.BIN;
|
|
37
|
+
export declare const Rdt_DEFAULT_MS_OFFICE_ACTION = RdtMsOfficeAction.View;
|
|
38
|
+
export declare enum FileSizeUnit {
|
|
39
|
+
B = "B",
|
|
40
|
+
KB = "KB",
|
|
41
|
+
MB = "MB",
|
|
42
|
+
GB = "GB",
|
|
43
|
+
TB = "TB",
|
|
44
|
+
PB = "PB",
|
|
45
|
+
EB = "EB",
|
|
46
|
+
ZB = "ZB",
|
|
47
|
+
YB = "YB"
|
|
48
|
+
}
|
|
49
|
+
export type RdtFileSize = `${number} ${FileSizeUnit}`;
|
|
50
|
+
export declare class FileUtils {
|
|
51
|
+
static getMsOfficeLink(url: string, config: RdtMsOfficeConfig): string;
|
|
52
|
+
static openFileFromRemoteUrl(url: string, config: RdtMsOfficeConfig): void;
|
|
53
|
+
static openFileInBrowser(stringData: string, mimeType?: RdtMimeType): void;
|
|
54
|
+
static fileAsArrayBuffer(file: Blob): Promise<ArrayBuffer>;
|
|
55
|
+
static fileAsText(file: Blob, encoding?: RdtEncoding): Promise<string>;
|
|
56
|
+
static downloadFileFromData(stringData: string, filename: string, mimeType?: RdtMimeType): void;
|
|
57
|
+
static downloadFileFromRemoteUrl(url: string, filename: string, mimeType?: RdtMimeType): void;
|
|
58
|
+
static getMimeTypeFromBase64(base64Data: string): RdtMimeType | undefined;
|
|
59
|
+
static getMimeTypeFromFileName(fileName: Nullable<string>): RdtMimeType;
|
|
60
|
+
static getFileName(filename: string, mimeType?: RdtMimeType): string;
|
|
61
|
+
static getBase64Link(base64Data: string, mimeType?: RdtMimeType): string;
|
|
62
|
+
static getMimeTypeFromResponse(resp: HttpResponse<Blob>): RdtMimeType;
|
|
63
|
+
static getFileNameFromResponse(resp: HttpResponse<Blob>): string;
|
|
64
|
+
static blobToDataUrl(file: Blob): Promise<string>;
|
|
65
|
+
static convertFromBytes(bytes: number, decimals?: number): string;
|
|
66
|
+
static convertToBytes(amount: number, unit: FileSizeUnit): number;
|
|
67
|
+
static fileSizeToBytes(fileSize: RdtFileSize): number | null;
|
|
68
|
+
static getMsOfficeAppByMimeType(mimeType: RdtMimeType | undefined): RdtMsOfficeApp | null;
|
|
69
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const ARROW: {
|
|
2
|
+
UP: string;
|
|
3
|
+
DOWN: string;
|
|
4
|
+
LEFT: string;
|
|
5
|
+
RIGHT: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const KB_KEY: {
|
|
8
|
+
SPACEBAR: string;
|
|
9
|
+
ENTER: string;
|
|
10
|
+
ESCAPE: string;
|
|
11
|
+
HOME: string;
|
|
12
|
+
END: string;
|
|
13
|
+
TAB: string;
|
|
14
|
+
ARROW: {
|
|
15
|
+
UP: string;
|
|
16
|
+
DOWN: string;
|
|
17
|
+
LEFT: string;
|
|
18
|
+
RIGHT: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare const KB_CODE: {
|
|
22
|
+
SPACEBAR: string;
|
|
23
|
+
ENTER: string;
|
|
24
|
+
ESCAPE: string;
|
|
25
|
+
HOME: string;
|
|
26
|
+
END: string;
|
|
27
|
+
TAB: string;
|
|
28
|
+
ARROW: {
|
|
29
|
+
UP: string;
|
|
30
|
+
DOWN: string;
|
|
31
|
+
LEFT: string;
|
|
32
|
+
RIGHT: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare const ALPHABET_KB_KEYS: string[];
|
|
36
|
+
export declare const KB_ALPHABET_CODES: string[];
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
export declare enum RdtMimeType {
|
|
2
|
+
DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
3
|
+
XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
4
|
+
PDF = "application/pdf",
|
|
5
|
+
TXT = "text/plain",
|
|
6
|
+
CSV = "text/csv",
|
|
7
|
+
ZIP = "application/zip",
|
|
8
|
+
JPG = "image/jpeg",
|
|
9
|
+
PNG = "image/png",
|
|
10
|
+
GIF = "image/gif",
|
|
11
|
+
SVG = "image/svg+xml",
|
|
12
|
+
HTML = "text/html",
|
|
13
|
+
XML = "application/xml",
|
|
14
|
+
JSON = "application/json",
|
|
15
|
+
MP3 = "audio/mpeg",
|
|
16
|
+
MP4 = "video/mp4",
|
|
17
|
+
OGG = "audio/ogg",
|
|
18
|
+
WEBM = "video/webm",
|
|
19
|
+
WAV = "audio/wav",
|
|
20
|
+
AVI = "video/x-msvideo",
|
|
21
|
+
MPEG = "video/mpeg",
|
|
22
|
+
WEBP = "image/webp",
|
|
23
|
+
ICO = "image/x-icon",
|
|
24
|
+
TTF = "font/ttf",
|
|
25
|
+
WOFF = "font/woff",
|
|
26
|
+
WOFF2 = "font/woff2",
|
|
27
|
+
EOT = "application/vnd.ms-fontobject",
|
|
28
|
+
OTF = "font/otf",
|
|
29
|
+
PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
30
|
+
PPT = "application/vnd.ms-powerpoint",
|
|
31
|
+
XLS = "application/vnd.ms-excel",
|
|
32
|
+
DOC = "application/msword",
|
|
33
|
+
ODT = "application/vnd.oasis.opendocument.text",
|
|
34
|
+
ODS = "application/vnd.oasis.opendocument.spreadsheet",
|
|
35
|
+
ODP = "application/vnd.oasis.opendocument.presentation",
|
|
36
|
+
ODF = "application/vnd.oasis.opendocument.formula",
|
|
37
|
+
RAR = "application/vnd.rar",
|
|
38
|
+
TAR = "application/x-tar",
|
|
39
|
+
GZIP = "application/gzip",
|
|
40
|
+
BZIP2 = "application/x-bzip2",
|
|
41
|
+
XZ = "application/x-xz",
|
|
42
|
+
SEVENZ = "application/x-7z-compressed",
|
|
43
|
+
RAR5 = "application/x-rar-compressed",
|
|
44
|
+
WMA = "audio/x-ms-wma",
|
|
45
|
+
WMV = "video/x-ms-wmv",
|
|
46
|
+
FLV = "video/x-flv",
|
|
47
|
+
OGV = "video/ogg",
|
|
48
|
+
BIN = "application/octet-stream"
|
|
49
|
+
}
|
|
50
|
+
export declare enum VnshCombinedMimeType {
|
|
51
|
+
IMAGE = "image/*",
|
|
52
|
+
AUDIO = "audio/*",
|
|
53
|
+
VIDEO = "video/*",
|
|
54
|
+
FONT = "font/*",
|
|
55
|
+
DOCUMENT = "application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,application/pdf,text/plain,text/csv",
|
|
56
|
+
SPREADSHEET = "application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet",
|
|
57
|
+
PRESENTATION = "application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.oasis.opendocument.presentation",
|
|
58
|
+
ARCHIVE = "application/zip,application/vnd.rar,application/x-tar,application/gzip,application/x-bzip2,application/x-xz,application/x-7z-compressed,application/x-rar-compressed"
|
|
59
|
+
}
|
|
60
|
+
export declare const EXTENSION_BY_MIME_TYPE: {
|
|
61
|
+
readonly "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx";
|
|
62
|
+
readonly "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx";
|
|
63
|
+
readonly "application/pdf": "pdf";
|
|
64
|
+
readonly "text/plain": "txt";
|
|
65
|
+
readonly "text/csv": "csv";
|
|
66
|
+
readonly "application/zip": "zip";
|
|
67
|
+
readonly "image/jpeg": "jpg";
|
|
68
|
+
readonly "image/png": "png";
|
|
69
|
+
readonly "image/gif": "gif";
|
|
70
|
+
readonly "image/svg+xml": "svg";
|
|
71
|
+
readonly "text/html": "html";
|
|
72
|
+
readonly "application/xml": "xml";
|
|
73
|
+
readonly "application/json": "json";
|
|
74
|
+
readonly "audio/mpeg": "mp3";
|
|
75
|
+
readonly "video/mp4": "mp4";
|
|
76
|
+
readonly "audio/ogg": "ogg";
|
|
77
|
+
readonly "video/webm": "webm";
|
|
78
|
+
readonly "audio/wav": "wav";
|
|
79
|
+
readonly "video/x-msvideo": "avi";
|
|
80
|
+
readonly "video/mpeg": "mpeg";
|
|
81
|
+
readonly "image/webp": "webp";
|
|
82
|
+
readonly "image/x-icon": "ico";
|
|
83
|
+
readonly "font/ttf": "ttf";
|
|
84
|
+
readonly "font/woff": "woff";
|
|
85
|
+
readonly "font/woff2": "woff2";
|
|
86
|
+
readonly "application/vnd.ms-fontobject": "eot";
|
|
87
|
+
readonly "font/otf": "otf";
|
|
88
|
+
readonly "application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx";
|
|
89
|
+
readonly "application/vnd.ms-powerpoint": "ppt";
|
|
90
|
+
readonly "application/vnd.ms-excel": "xls";
|
|
91
|
+
readonly "application/msword": "doc";
|
|
92
|
+
readonly "application/vnd.oasis.opendocument.text": "odt";
|
|
93
|
+
readonly "application/vnd.oasis.opendocument.spreadsheet": "ods";
|
|
94
|
+
readonly "application/vnd.oasis.opendocument.presentation": "odp";
|
|
95
|
+
readonly "application/vnd.oasis.opendocument.formula": "odf";
|
|
96
|
+
readonly "application/vnd.rar": "rar";
|
|
97
|
+
readonly "application/x-tar": "tar";
|
|
98
|
+
readonly "application/gzip": "gz";
|
|
99
|
+
readonly "application/x-bzip2": "bz2";
|
|
100
|
+
readonly "application/x-xz": "xz";
|
|
101
|
+
readonly "application/x-7z-compressed": "7z";
|
|
102
|
+
readonly "application/x-rar-compressed": "rar";
|
|
103
|
+
readonly "audio/x-ms-wma": "wma";
|
|
104
|
+
readonly "video/x-ms-wmv": "wmv";
|
|
105
|
+
readonly "video/x-flv": "flv";
|
|
106
|
+
readonly "video/ogg": "ogv";
|
|
107
|
+
readonly "application/octet-stream": "bin";
|
|
108
|
+
};
|
|
109
|
+
export declare const MIME_TYPE_BY_EXTENSION: Record<(typeof EXTENSION_BY_MIME_TYPE)[keyof typeof EXTENSION_BY_MIME_TYPE], RdtMimeType>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare class RdtModelUtils {
|
|
2
|
+
static inferPropertyInfo(properties: {
|
|
3
|
+
key: string;
|
|
4
|
+
type: string;
|
|
5
|
+
}[], interfaceName: string): RdtModelProperty[];
|
|
6
|
+
static names(name: string): {
|
|
7
|
+
name: string;
|
|
8
|
+
className: string;
|
|
9
|
+
propertyName: string;
|
|
10
|
+
constantName: string;
|
|
11
|
+
fileName: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface RdtModelProperty {
|
|
15
|
+
key: string;
|
|
16
|
+
type: 'string' | 'number' | 'date' | 'boolean' | 'array' | 'object' | 'any';
|
|
17
|
+
formControlType: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'any';
|
|
18
|
+
required: boolean;
|
|
19
|
+
foreignKey: boolean;
|
|
20
|
+
primaryKey: boolean;
|
|
21
|
+
probablyBoolean: boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* From @nx/devkit because it has nodejs as dependency and won't transpile.
|
|
3
|
+
* Util function to generate different strings based off the provided name.
|
|
4
|
+
*
|
|
5
|
+
* Examples:
|
|
6
|
+
*
|
|
7
|
+
* ```typescript
|
|
8
|
+
* names("my-name") // {name: 'my-name', className: 'MyName', propertyName: 'myName', constantName: 'MY_NAME', fileName: 'my-name'}
|
|
9
|
+
* names("myName") // {name: 'myName', className: 'MyName', propertyName: 'myName', constantName: 'MY_NAME', fileName: 'my-name'}
|
|
10
|
+
* ```
|
|
11
|
+
* @param name
|
|
12
|
+
*/
|
|
13
|
+
export declare function names(name: string): {
|
|
14
|
+
name: string;
|
|
15
|
+
className: string;
|
|
16
|
+
propertyName: string;
|
|
17
|
+
constantName: string;
|
|
18
|
+
fileName: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type WindowOpenTargetType = '_blank' | '_self' | '_parent' | '_top';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
export declare class RdtRxUtils {
|
|
3
|
+
static repeatLatestWhen<T>(notifier$: Observable<any>): (source: Observable<T>) => Observable<T>;
|
|
4
|
+
static completeIfNull<T>(source$: Observable<T>): Observable<NonNullable<T>>;
|
|
5
|
+
static makeObservable<T>(value: T | Observable<T>): Observable<T>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Params } from '@angular/router';
|
|
2
|
+
import { Nullable } from './type.utils';
|
|
3
|
+
export declare class RdtStringUtils {
|
|
4
|
+
static tokenize(value: string | undefined): string[];
|
|
5
|
+
static joinPaths(parent: string, child: string): string;
|
|
6
|
+
static isAlphabetCharacter(char: string): boolean;
|
|
7
|
+
static isNumericCharacter(char: string): boolean;
|
|
8
|
+
static capitalize(str: string): string;
|
|
9
|
+
static toDataTestId(str: string): string;
|
|
10
|
+
static removeAccents(str: string): string;
|
|
11
|
+
static stripTrailingSlash(url: string): string;
|
|
12
|
+
static createAbsoluteUrl(url: string, baseHref: string): string;
|
|
13
|
+
static appendQueryParams(url: string, params: Nullable<Params>): string;
|
|
14
|
+
static localeCompare(a: Nullable<string>, b: Nullable<string>, order?: 'asc' | 'desc'): number;
|
|
15
|
+
static komixcomlocalReplaceString(url: string): {
|
|
16
|
+
replaceString: string;
|
|
17
|
+
toReplace: string;
|
|
18
|
+
};
|
|
19
|
+
static swapChars(src: string, i: number, j: number): string;
|
|
20
|
+
static insertAt(src: string, index: number, value: string): string;
|
|
21
|
+
static getDataTestId(label: string, prefix?: Nullable<string>, suffix?: Nullable<string>): string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type TypesAreEqual<T, U> = [T] extends [U] ? [U] extends [T] ? true : false : false;
|
|
2
|
+
export type DotNotationPath<T> = keyof T extends string ? PathImpl2<T> extends infer P ? P extends string | keyof T ? P : keyof T : keyof T : never;
|
|
3
|
+
export type StringKey<T, TGrid = T> = keyof T & keyof TGrid & string;
|
|
4
|
+
export type Nullable<T> = T | null | undefined;
|
|
5
|
+
type IsAny<T> = unknown extends T ? [keyof T] extends [never] ? false : true : false;
|
|
6
|
+
type ExcludeArrayKeys<T> = T extends ArrayLike<any> ? Exclude<keyof T, keyof any[]> : keyof T;
|
|
7
|
+
type PathImpl<T, Key extends keyof T> = Key extends string ? IsAny<T[Key]> extends true ? never : T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], ExcludeArrayKeys<T[Key]>> & string}` | `${Key}.${ExcludeArrayKeys<T[Key]> & string}` : never : never;
|
|
8
|
+
type PathImpl2<T> = PathImpl<T, keyof T> | keyof T;
|
|
9
|
+
export type NullPartial<T> = {
|
|
10
|
+
[key in keyof T]: T[key] | null;
|
|
11
|
+
};
|
|
12
|
+
export type Modify<T, R> = Omit<T, keyof R> & R;
|
|
13
|
+
export {};
|