@deephaven/jsapi-utils 0.13.3-beta.2 → 0.13.7
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/dist/DateUtils.d.ts.map +1 -1
- package/dist/DateUtils.js +0 -5
- package/dist/DateUtils.js.map +1 -1
- package/dist/Formatter.d.ts +4 -4
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js.map +1 -1
- package/dist/FormatterUtils.d.ts +10 -10
- package/dist/FormatterUtils.d.ts.map +1 -1
- package/dist/FormatterUtils.js +15 -15
- package/dist/FormatterUtils.js.map +1 -1
- package/dist/TableUtils.d.ts +25 -24
- package/dist/TableUtils.d.ts.map +1 -1
- package/dist/TableUtils.js +86 -33
- package/dist/TableUtils.js.map +1 -1
- package/dist/formatters/DateTimeColumnFormatter.d.ts +1 -1
- package/dist/formatters/DateTimeColumnFormatter.d.ts.map +1 -1
- package/dist/formatters/DateTimeColumnFormatter.js.map +1 -1
- package/dist/formatters/DecimalColumnFormatter.d.ts +1 -1
- package/dist/formatters/DecimalColumnFormatter.d.ts.map +1 -1
- package/dist/formatters/DecimalColumnFormatter.js.map +1 -1
- package/dist/formatters/IntegerColumnFormatter.d.ts +1 -1
- package/dist/formatters/IntegerColumnFormatter.d.ts.map +1 -1
- package/dist/formatters/IntegerColumnFormatter.js.map +1 -1
- package/dist/formatters/TableColumnFormatter.d.ts +1 -1
- package/dist/formatters/TableColumnFormatter.d.ts.map +1 -1
- package/dist/formatters/TableColumnFormatter.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
package/dist/DateUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateUtils.d.ts","sourceRoot":"","sources":["../src/DateUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAu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AM,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAQ/C;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAChB,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,EAC7B,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EACzB,QAAQ,EAAE,MAAM,GACf,WAAW,GAAG,IAAI;IA4CrB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAqB9C;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,eAAe,CACpB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI;IAwB3B;;;;;;OAMG;IACH,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAiCrE;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;IAwFnD;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI;CAM1D;AAED,eAAe,SAAS,CAAC"}
|
package/dist/DateUtils.js
CHANGED
|
@@ -20,11 +20,6 @@ export class DateUtils {
|
|
|
20
20
|
var minute = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
21
21
|
var second = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
|
|
22
22
|
var ns = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0;
|
|
23
|
-
|
|
24
|
-
if (!timeZone) {
|
|
25
|
-
throw new Error('No timezone provided');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
23
|
var yearString = "".concat(year).padStart(4, '0');
|
|
29
24
|
var monthString = "".concat(month + 1).padStart(2, '0');
|
|
30
25
|
var dayString = "".concat(day).padStart(2, '0');
|
package/dist/DateUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/DateUtils.ts"],"names":["dh","DateUtils","makeDateWrapper","timeZone","year","month","day","hour","minute","second","ns","Error","yearString","padStart","monthString","dayString","hourString","minuteString","secondString","nanoString","dateString","i18n","DateTimeFormat","parse","FULL_DATE_FORMAT","TimeZone","getTimeZone","getNextNanos","sigNanos","parseInt","zeros","repeat","length","nextNanoString","getNextDate","components","values","date","hours","minutes","seconds","nanos","jsDate","Date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","parseMonth","Number","isNaN","NaN","cleanMonthString","trim","toLowerCase","i","months","startsWith","parseDateValues","padEnd","parseDateTimeString","dateTimeString","regex","result","exec","overflow","parseDateRange","text","cleanText","now","startDate","endDate","DateWrapper","ofJsDate","getJsDate","dateWrapper","asDate"],"mappings":";;AAAA,OAAOA,EAAP,MAAe,uBAAf;AAaA,OAAO,MAAMC,SAAN,CAAgB;AAkBrB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACwB,SAAfC,eAAe,CACpBC,QADoB,EAEpBC,IAFoB,EASP;AAAA,QANbC,KAMa,uEANL,CAMK;AAAA,QALbC,GAKa,uEALP,CAKO;AAAA,QAJbC,IAIa,uEAJN,CAIM;AAAA,QAHbC,MAGa,uEAHJ,CAGI;AAAA,QAFbC,MAEa,uEAFJ,CAEI;AAAA,QADbC,EACa,uEADR,CACQ;;AACb,QAAI,CAACP,QAAL,EAAe;AACb,YAAM,IAAIQ,KAAJ,CAAU,sBAAV,CAAN;AACD;;AACD,QAAMC,UAAU,GAAG,UAAGR,IAAH,EAAUS,QAAV,CAAmB,CAAnB,EAAsB,G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;;AAvVoB;;gBAAV7E,S,sBACe,+B;;gBADfA,S,YAGK,CACd,SADc,EAEd,UAFc,EAGd,OAHc,EAId,OAJc,EAKd,KALc,EAMd,MANc,EAOd,MAPc,EAQd,QARc,EASd,WATc,EAUd,SAVc,EAWd,UAXc,EAYd,UAZc,C;;AAuVlB,eAAeA,SAAf","sourcesContent":["import dh from '@deephaven/jsapi-shim';\nimport type { DateWrapper } from '@deephaven/jsapi-shim';\n\ninterface DateParts<T> {\n year: T;\n month: T;\n date: T;\n hours: T;\n minutes: T;\n seconds: T;\n nanos: T;\n}\n\nexport class DateUtils {\n static FULL_DATE_FORMAT = 'yyyy-MM-dd HH:mm:ss.SSSSSSSSS';\n\n static months = [\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december',\n ];\n\n /**\n *\n * @param timeZone The time zone to parse this time in. E.g. America/New_York\n * @param year The year for the date\n * @param month The month, starting at 0\n * @param day The day, starting at 1\n * @param hour The hours\n * @param minute The minutes\n * @param second The seconds\n * @param ns The nanoseconds\n */\n static makeDateWrapper(\n timeZone: string,\n year: number,\n month = 0,\n day = 1,\n hour = 0,\n minute = 0,\n second = 0,\n ns = 0\n ): DateWrapper {\n if (!timeZone) {\n throw new Error('No timezone provided');\n }\n const yearString = `${year}`.padStart(4, '0');\n const monthString = `${month + 1}`.padStart(2, '0');\n const dayString = `${day}`.padStart(2, '0');\n const hourString = `${hour}`.padStart(2, '0');\n const minuteString = `${minute}`.padStart(2, '0');\n const secondString = `${second}`.padStart(2, '0');\n const nanoString = `${ns}`.padStart(9, '0');\n\n const dateString = `${yearString}-${monthString}-${dayString} ${hourString}:${minuteString}:${secondString}.${nanoString}`;\n return dh.i18n.DateTimeFormat.parse(\n DateUtils.FULL_DATE_FORMAT,\n dateString,\n dh.i18n.TimeZone.getTimeZone(timeZone)\n );\n }\n\n /**\n * Takes the string the user entered and returns the next nanos value\n * @param nanoString The nano string to get the next one of\n * @returns The value of the next nanos\n */\n static getNextNanos(nanoString: string): number {\n const sigNanos = parseInt(nanoString, 10);\n // Get the zeroes needed for padding before adding one so we handle overflow properly.\n const zeros = '0'.repeat(9 - nanoString.length);\n const nextNanoString = `${sigNanos + 1}${zeros}`;\n return parseInt(nextNanoString, 10);\n }\n\n /**\n * @param components The string components that were parsed from the original string\n * @param values The values that were parsed from the components\n * @param timeZone The time zone to parse the date in. E.g. America/New_York\n * @returns Returns the DateWrapper for the next date, or null if a full date was passed in\n */\n static getNextDate(\n components: DateParts<string>,\n values: DateParts<number>,\n timeZone: string\n ): DateWrapper | null {\n let { year, month, date, hours, minutes, seconds, nanos } = values;\n\n if (components.nanos != null) {\n if (components.nanos.length === 9) {\n // They want an exact match\n return null;\n }\n nanos = DateUtils.getNextNanos(components.nanos);\n if (nanos > 999999999) {\n // There's an overflow, add it to the seconds manually\n seconds += 1;\n nanos = 0;\n }\n } else if (components.seconds != null) {\n seconds += 1;\n } else if (components.minutes != null) {\n minutes += 1;\n } else if (components.hours != null) {\n hours += 1;\n } else if (components.date != null) {\n date += 1;\n } else if (components.month != null) {\n month += 1;\n } else {\n year += 1;\n }\n\n // Use the JS date to handle overflow rather than doing our own logic\n // Because handling leap years and stuff is a pain\n // Still need to add nanos after, and the overflow from that is already added to seconds above\n const jsDate = new Date(year, month, date, hours, minutes, seconds);\n return DateUtils.makeDateWrapper(\n timeZone,\n jsDate.getFullYear(),\n jsDate.getMonth(),\n jsDate.getDate(),\n jsDate.getHours(),\n jsDate.getMinutes(),\n jsDate.getSeconds(),\n nanos\n );\n }\n\n /**\n * Get the JS month value for the provided string.\n * Matches digits or a month name (eg. '1', '01', 'jan', 'january' should all work)\n * @param monthString The string to parse to a JS month value\n * @returns number The JS month value, which starts at 0 for january, or NaN if nothing could be parsed\n */\n static parseMonth(monthString: string): number {\n const month = parseInt(monthString, 10);\n if (!Number.isNaN(month)) {\n if (month >= 1 && month <= 12) {\n return month - 1;\n }\n return NaN;\n }\n\n const cleanMonthString = monthString.trim().toLowerCase();\n if (cleanMonthString.length >= 3) {\n for (let i = 0; i < DateUtils.months.length; i += 1) {\n if (DateUtils.months[i].startsWith(cleanMonthString)) {\n return i;\n }\n }\n }\n\n return NaN;\n }\n\n /**\n * Parse a date object out of the provided string segments.\n * Also using `parseMonth` to get month names like Aug/August rather than\n * simply doing `parseInt`.\n * @param yearString The year part of the string\n * @param monthString The month part of the string\n * @param dayString The day part of the string\n * @param hourString The hour part of the string\n * @param minuteString The minute part of the string\n * @param secondString The second part of the string\n * @param nanoString The milli part of the string\n */\n static parseDateValues(\n yearString: string,\n monthString: string,\n dayString: string,\n hourString: string,\n minuteString: string,\n secondString: string,\n nanoString: string\n ): DateParts<number> | null {\n const year = parseInt(yearString, 10);\n const month = monthString != null ? this.parseMonth(monthString) : 0;\n const date = dayString != null ? parseInt(dayString, 10) : 1;\n const hours = hourString != null ? parseInt(hourString, 10) : 0;\n const minutes = minuteString != null ? parseInt(minuteString, 10) : 0;\n const seconds = secondString != null ? parseInt(secondString, 10) : 0;\n const nanos =\n nanoString != null ? parseInt(nanoString.padEnd(9, '0'), 10) : 0;\n if (\n Number.isNaN(year) ||\n Number.isNaN(month) ||\n Number.isNaN(date) ||\n Number.isNaN(hours) ||\n Number.isNaN(minutes) ||\n Number.isNaN(seconds) ||\n Number.isNaN(nanos)\n ) {\n return null;\n }\n\n return { year, month, date, hours, minutes, seconds, nanos };\n }\n\n /**\n * Parse out a date time string into it's string components.\n * Anything that is not captured in the string will be undefined.\n *\n * @param dateTimeString The date time string to parse\n * @returns Containing the date time components\n */\n static parseDateTimeString(dateTimeString: string): DateParts<string> {\n const regex = /\\s*(\\d{4})([-./]([\\da-z]+))?([-./](\\d{1,2}))?([tT\\s](\\d{2})([:](\\d{2}))?([:](\\d{2}))?([.](\\d{1,9}))?)?(.*)/;\n const result = regex.exec(dateTimeString);\n if (result == null) {\n throw new Error(`Unexpected date string: ${dateTimeString}`);\n }\n\n const [\n ,\n year,\n ,\n month,\n ,\n date,\n ,\n hours,\n ,\n minutes,\n ,\n seconds,\n ,\n nanos,\n overflow,\n ] = result;\n if (overflow != null && overflow.length > 0) {\n throw new Error(\n `Unexpected characters after date string '${dateTimeString}': ${overflow}`\n );\n }\n\n return { year, month, date, hours, minutes, seconds, nanos };\n }\n\n /**\n * Parses the date range provided from a string of text.\n * @param text The string to parse the date from. Can be a keyword like \"today\", or in the format \"2018-08-04\"\n * @param timeZone The time zone to parse this range in. E.g. America/New_York\n * @returns A tuple with the start and end value/null for that date range, or both null\n */\n static parseDateRange(\n text: string,\n timeZone: string\n ): [DateWrapper, DateWrapper | null] | [null, null] {\n const cleanText = text.trim().toLowerCase();\n if (cleanText.length === 0) {\n throw new Error('Cannot parse date range from empty string');\n }\n\n if (cleanText === 'null') {\n return [null, null];\n }\n\n if (cleanText === 'today') {\n const now = new Date(Date.now());\n const startDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate()\n );\n const endDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate() + 1\n );\n return [startDate, endDate];\n }\n\n if (cleanText === 'yesterday') {\n const now = new Date(Date.now());\n const startDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate() - 1\n );\n const endDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate()\n );\n return [startDate, endDate];\n }\n\n if (cleanText === 'now') {\n const now = new Date(Date.now());\n const date = dh.DateWrapper.ofJsDate(now);\n return [date, null];\n }\n\n const components = DateUtils.parseDateTimeString(cleanText);\n if (\n components.year == null &&\n components.month == null &&\n components.date == null\n ) {\n throw new Error(`Unable to extract year, month, or day ${cleanText}`);\n }\n\n const values = DateUtils.parseDateValues(\n components.year,\n components.month,\n components.date,\n components.hours,\n components.minutes,\n components.seconds,\n components.nanos\n );\n\n if (values == null) {\n throw new Error(`Unable to extract date values from ${components}`);\n }\n\n const startDate = DateUtils.makeDateWrapper(\n timeZone,\n values.year,\n values.month,\n values.date,\n values.hours,\n values.minutes,\n values.seconds,\n values.nanos\n );\n\n const endDate = DateUtils.getNextDate(components, values, timeZone);\n return [startDate, endDate];\n }\n\n /**\n * Gets the Js Date object from the provided DateWrapper.\n * In unit test, DateWrapper is just a number provided in millis, so handles that case.\n * @param dateWrapper The DateWrapper object, or time in millis\n */\n static getJsDate(dateWrapper: DateWrapper | number): Date {\n if (typeof dateWrapper === 'number') {\n return new Date(dateWrapper);\n }\n return dateWrapper.asDate();\n }\n}\n\nexport default DateUtils;\n"],"file":"DateUtils.js"}
|
|
1
|
+
{"version":3,"sources":["../src/DateUtils.ts"],"names":["dh","DateUtils","makeDateWrapper","timeZone","year","month","day","hour","minute","second","ns","yearString","padStart","monthString","dayString","hourString","minuteString","secondString","nanoString","dateString","i18n","DateTimeFormat","parse","FULL_DATE_FORMAT","TimeZone","getTimeZone","getNextNanos","sigNanos","parseInt","zeros","repeat","length","nextNanoString","getNextDate","components","values","date","hours","minutes","seconds","nanos","jsDate","Date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","parseMonth","Number","isNaN","NaN","cleanMonthString","trim","toLowerCase","i","months","startsWith","parseDateValues","padEnd","parseDateTimeString","dateTimeString","regex","result","exec","Error","overflow","parseDateRange","text","cleanText","now","startDate","endDate","DateWrapper","ofJsDate","getJsDate","dateWrapper","asDate"],"mappings":";;AAAA,OAAOA,EAAP,MAAe,uBAAf;AAaA,OAAO,MAAMC,SAAN,CAAgB;AAkBrB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACwB,SAAfC,eAAe,CACpBC,QADoB,EAEpBC,IAFoB,EASP;AAAA,QANbC,KAMa,uEANL,CAMK;AAAA,QALbC,GAKa,uEALP,CAKO;AAAA,QAJbC,IAIa,uEAJN,CAIM;AAAA,QAHbC,MAGa,uEAHJ,CAGI;AAAA,QAFbC,MAEa,uEAFJ,CAEI;AA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A3B,EAAqC;AACnC,aAAO,IAAInC,IAAJ,CAASmC,WAAT,CAAP;AACD;;AACD,WAAOA,WAAW,CAACC,MAAZ,EAAP;AACD;;AApVoB;;gBAAV7E,S,sBACe,+B;;gBADfA,S,YAGK,CACd,SADc,EAEd,UAFc,EAGd,OAHc,EAId,OAJc,EAKd,KALc,EAMd,MANc,EAOd,MAPc,EAQd,QARc,EASd,WATc,EAUd,SAVc,EAWd,UAXc,EAYd,UAZc,C;;AAoVlB,eAAeA,SAAf","sourcesContent":["import dh from '@deephaven/jsapi-shim';\nimport type { DateWrapper } from '@deephaven/jsapi-shim';\n\ninterface DateParts<T> {\n year: T;\n month: T;\n date: T;\n hours: T;\n minutes: T;\n seconds: T;\n nanos: T;\n}\n\nexport class DateUtils {\n static FULL_DATE_FORMAT = 'yyyy-MM-dd HH:mm:ss.SSSSSSSSS';\n\n static months = [\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december',\n ];\n\n /**\n *\n * @param timeZone The time zone to parse this time in. E.g. America/New_York\n * @param year The year for the date\n * @param month The month, starting at 0\n * @param day The day, starting at 1\n * @param hour The hours\n * @param minute The minutes\n * @param second The seconds\n * @param ns The nanoseconds\n */\n static makeDateWrapper(\n timeZone: string,\n year: number,\n month = 0,\n day = 1,\n hour = 0,\n minute = 0,\n second = 0,\n ns = 0\n ): DateWrapper {\n const yearString = `${year}`.padStart(4, '0');\n const monthString = `${month + 1}`.padStart(2, '0');\n const dayString = `${day}`.padStart(2, '0');\n const hourString = `${hour}`.padStart(2, '0');\n const minuteString = `${minute}`.padStart(2, '0');\n const secondString = `${second}`.padStart(2, '0');\n const nanoString = `${ns}`.padStart(9, '0');\n\n const dateString = `${yearString}-${monthString}-${dayString} ${hourString}:${minuteString}:${secondString}.${nanoString}`;\n return dh.i18n.DateTimeFormat.parse(\n DateUtils.FULL_DATE_FORMAT,\n dateString,\n dh.i18n.TimeZone.getTimeZone(timeZone)\n );\n }\n\n /**\n * Takes the string the user entered and returns the next nanos value\n * @param nanoString The nano string to get the next one of\n * @returns The value of the next nanos\n */\n static getNextNanos(nanoString: string): number {\n const sigNanos = parseInt(nanoString, 10);\n // Get the zeroes needed for padding before adding one so we handle overflow properly.\n const zeros = '0'.repeat(9 - nanoString.length);\n const nextNanoString = `${sigNanos + 1}${zeros}`;\n return parseInt(nextNanoString, 10);\n }\n\n /**\n * @param components The string components that were parsed from the original string\n * @param values The values that were parsed from the components\n * @param timeZone The time zone to parse the date in. E.g. America/New_York\n * @returns Returns the DateWrapper for the next date, or null if a full date was passed in\n */\n static getNextDate(\n components: DateParts<string>,\n values: DateParts<number>,\n timeZone: string\n ): DateWrapper | null {\n let { year, month, date, hours, minutes, seconds, nanos } = values;\n\n if (components.nanos != null) {\n if (components.nanos.length === 9) {\n // They want an exact match\n return null;\n }\n nanos = DateUtils.getNextNanos(components.nanos);\n if (nanos > 999999999) {\n // There's an overflow, add it to the seconds manually\n seconds += 1;\n nanos = 0;\n }\n } else if (components.seconds != null) {\n seconds += 1;\n } else if (components.minutes != null) {\n minutes += 1;\n } else if (components.hours != null) {\n hours += 1;\n } else if (components.date != null) {\n date += 1;\n } else if (components.month != null) {\n month += 1;\n } else {\n year += 1;\n }\n\n // Use the JS date to handle overflow rather than doing our own logic\n // Because handling leap years and stuff is a pain\n // Still need to add nanos after, and the overflow from that is already added to seconds above\n const jsDate = new Date(year, month, date, hours, minutes, seconds);\n return DateUtils.makeDateWrapper(\n timeZone,\n jsDate.getFullYear(),\n jsDate.getMonth(),\n jsDate.getDate(),\n jsDate.getHours(),\n jsDate.getMinutes(),\n jsDate.getSeconds(),\n nanos\n );\n }\n\n /**\n * Get the JS month value for the provided string.\n * Matches digits or a month name (eg. '1', '01', 'jan', 'january' should all work)\n * @param monthString The string to parse to a JS month value\n * @returns number The JS month value, which starts at 0 for january, or NaN if nothing could be parsed\n */\n static parseMonth(monthString: string): number {\n const month = parseInt(monthString, 10);\n if (!Number.isNaN(month)) {\n if (month >= 1 && month <= 12) {\n return month - 1;\n }\n return NaN;\n }\n\n const cleanMonthString = monthString.trim().toLowerCase();\n if (cleanMonthString.length >= 3) {\n for (let i = 0; i < DateUtils.months.length; i += 1) {\n if (DateUtils.months[i].startsWith(cleanMonthString)) {\n return i;\n }\n }\n }\n\n return NaN;\n }\n\n /**\n * Parse a date object out of the provided string segments.\n * Also using `parseMonth` to get month names like Aug/August rather than\n * simply doing `parseInt`.\n * @param yearString The year part of the string\n * @param monthString The month part of the string\n * @param dayString The day part of the string\n * @param hourString The hour part of the string\n * @param minuteString The minute part of the string\n * @param secondString The second part of the string\n * @param nanoString The milli part of the string\n */\n static parseDateValues(\n yearString: string,\n monthString: string,\n dayString: string,\n hourString: string,\n minuteString: string,\n secondString: string,\n nanoString: string\n ): DateParts<number> | null {\n const year = parseInt(yearString, 10);\n const month = monthString != null ? this.parseMonth(monthString) : 0;\n const date = dayString != null ? parseInt(dayString, 10) : 1;\n const hours = hourString != null ? parseInt(hourString, 10) : 0;\n const minutes = minuteString != null ? parseInt(minuteString, 10) : 0;\n const seconds = secondString != null ? parseInt(secondString, 10) : 0;\n const nanos =\n nanoString != null ? parseInt(nanoString.padEnd(9, '0'), 10) : 0;\n if (\n Number.isNaN(year) ||\n Number.isNaN(month) ||\n Number.isNaN(date) ||\n Number.isNaN(hours) ||\n Number.isNaN(minutes) ||\n Number.isNaN(seconds) ||\n Number.isNaN(nanos)\n ) {\n return null;\n }\n\n return { year, month, date, hours, minutes, seconds, nanos };\n }\n\n /**\n * Parse out a date time string into it's string components.\n * Anything that is not captured in the string will be undefined.\n *\n * @param dateTimeString The date time string to parse\n * @returns Containing the date time components\n */\n static parseDateTimeString(dateTimeString: string): DateParts<string> {\n const regex = /\\s*(\\d{4})([-./]([\\da-z]+))?([-./](\\d{1,2}))?([tT\\s](\\d{2})([:](\\d{2}))?([:](\\d{2}))?([.](\\d{1,9}))?)?(.*)/;\n const result = regex.exec(dateTimeString);\n if (result == null) {\n throw new Error(`Unexpected date string: ${dateTimeString}`);\n }\n\n const [\n ,\n year,\n ,\n month,\n ,\n date,\n ,\n hours,\n ,\n minutes,\n ,\n seconds,\n ,\n nanos,\n overflow,\n ] = result;\n if (overflow != null && overflow.length > 0) {\n throw new Error(\n `Unexpected characters after date string '${dateTimeString}': ${overflow}`\n );\n }\n\n return { year, month, date, hours, minutes, seconds, nanos };\n }\n\n /**\n * Parses the date range provided from a string of text.\n * @param text The string to parse the date from. Can be a keyword like \"today\", or in the format \"2018-08-04\"\n * @param timeZone The time zone to parse this range in. E.g. America/New_York\n * @returns A tuple with the start and end value/null for that date range, or both null\n */\n static parseDateRange(\n text: string,\n timeZone: string\n ): [DateWrapper, DateWrapper | null] | [null, null] {\n const cleanText = text.trim().toLowerCase();\n if (cleanText.length === 0) {\n throw new Error('Cannot parse date range from empty string');\n }\n\n if (cleanText === 'null') {\n return [null, null];\n }\n\n if (cleanText === 'today') {\n const now = new Date(Date.now());\n const startDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate()\n );\n const endDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate() + 1\n );\n return [startDate, endDate];\n }\n\n if (cleanText === 'yesterday') {\n const now = new Date(Date.now());\n const startDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate() - 1\n );\n const endDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate()\n );\n return [startDate, endDate];\n }\n\n if (cleanText === 'now') {\n const now = new Date(Date.now());\n const date = dh.DateWrapper.ofJsDate(now);\n return [date, null];\n }\n\n const components = DateUtils.parseDateTimeString(cleanText);\n if (\n components.year == null &&\n components.month == null &&\n components.date == null\n ) {\n throw new Error(`Unable to extract year, month, or day ${cleanText}`);\n }\n\n const values = DateUtils.parseDateValues(\n components.year,\n components.month,\n components.date,\n components.hours,\n components.minutes,\n components.seconds,\n components.nanos\n );\n\n if (values == null) {\n throw new Error(`Unable to extract date values from ${components}`);\n }\n\n const startDate = DateUtils.makeDateWrapper(\n timeZone,\n values.year,\n values.month,\n values.date,\n values.hours,\n values.minutes,\n values.seconds,\n values.nanos\n );\n\n const endDate = DateUtils.getNextDate(components, values, timeZone);\n return [startDate, endDate];\n }\n\n /**\n * Gets the Js Date object from the provided DateWrapper.\n * In unit test, DateWrapper is just a number provided in millis, so handles that case.\n * @param dateWrapper The DateWrapper object, or time in millis\n */\n static getJsDate(dateWrapper: DateWrapper | number): Date {\n if (typeof dateWrapper === 'number') {\n return new Date(dateWrapper);\n }\n return dateWrapper.asDate();\n }\n}\n\nexport default DateUtils;\n"],"file":"DateUtils.js"}
|
package/dist/Formatter.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { DateTimeColumnFormatter, DecimalColumnFormatter, IntegerColumnFormatter
|
|
|
3
3
|
declare type ColumnName = string;
|
|
4
4
|
export interface FormattingRule {
|
|
5
5
|
columnType: string;
|
|
6
|
-
columnName:
|
|
6
|
+
columnName: string;
|
|
7
7
|
format: TableColumnFormat;
|
|
8
8
|
}
|
|
9
9
|
export declare class Formatter {
|
|
@@ -19,7 +19,7 @@ export declare class Formatter {
|
|
|
19
19
|
* @param columnName Column name
|
|
20
20
|
* @param format Format object
|
|
21
21
|
*/
|
|
22
|
-
static makeColumnFormattingRule(columnType: DataType, columnName:
|
|
22
|
+
static makeColumnFormattingRule(columnType: DataType, columnName: string, format: TableColumnFormat): FormattingRule;
|
|
23
23
|
/**
|
|
24
24
|
* @param columnFormattingRules Optional array of column formatting rules
|
|
25
25
|
* @param dateTimeOptions Optional object with DateTime configuration
|
|
@@ -45,7 +45,7 @@ export declare class Formatter {
|
|
|
45
45
|
* @param columnName column name
|
|
46
46
|
* @returns format object or null for Default
|
|
47
47
|
*/
|
|
48
|
-
getColumnFormat(columnType: string, columnName:
|
|
48
|
+
getColumnFormat(columnType: string, columnName: string): TableColumnFormat | null;
|
|
49
49
|
getColumnTypeFormatter(columnType: string): TableColumnFormatter;
|
|
50
50
|
/**
|
|
51
51
|
* Gets formatted string for a given value, column type and name
|
|
@@ -54,7 +54,7 @@ export declare class Formatter {
|
|
|
54
54
|
* @param columnName Column name used to determine the formatting settings
|
|
55
55
|
* @param formatOverride Format object passed to the formatter in place of the format defined in columnFormatMap
|
|
56
56
|
*/
|
|
57
|
-
getFormattedString(value: unknown, columnType: string, columnName?: string, formatOverride?:
|
|
57
|
+
getFormattedString(value: unknown, columnType: string, columnName?: string, formatOverride?: TableColumnFormat): string;
|
|
58
58
|
/**
|
|
59
59
|
* Gets the timeZone name
|
|
60
60
|
* @returns The time zone name E.g. America/New_York
|
package/dist/Formatter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Formatter.d.ts","sourceRoot":"","sources":["../src/Formatter.ts"],"names":[],"mappings":"AAAA,OAAmB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAGL,uBAAuB,EACvB,sBAAsB,EAEtB,sBAAsB,EAEtB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAEtB,aAAK,UAAU,GAAG,MAAM,CAAC;AAEzB,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"Formatter.d.ts","sourceRoot":"","sources":["../src/Formatter.ts"],"names":[],"mappings":"AAAA,OAAmB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAGL,uBAAuB,EACvB,sBAAsB,EAEtB,sBAAsB,EAEtB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAEtB,aAAK,UAAU,GAAG,MAAM,CAAC;AAEzB,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAA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M,EAClB,UAAU,SAAK,EACf,cAAc,CAAC,EAAE,iBAAiB,GACjC,MAAM;IAYT;;;OAGG;IACH,IAAI,QAAQ,IAAI,MAAM,CAKrB;CACF;AAED,eAAe,SAAS,CAAC"}
|
package/dist/Formatter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Formatter.ts"],"names":["TableUtils","BooleanColumnFormatter","CharColumnFormatter","DateTimeColumnFormatter","DecimalColumnFormatter","DefaultColumnFormatter","IntegerColumnFormatter","StringColumnFormatter","Formatter","makeColumnFormatMap","columnFormattingRules","Map","reduce","map","next","dataType","getNormalizedType","columnType","has","set","formatMap","get","columnName","format","makeColumnFormattingRule","constructor","dateTimeOptions","decimalFormatOptions","integerFormatOptions","truncateNumbersWithPound","defaultColumnFormatter","typeFormatterMap","BOOLEAN","CHAR","DATETIME","DECIMAL","INT","STRING","columnFormatMap","getColumnFormatMapForType","createIfNecessary","undefined","getColumnFormat","getColumnTypeFormatter","columnTypeFormatter","getFormattedString","value","formatOverride","formatter","timeZone","dhTimeZone","id"],"mappings":";;OAAOA,U;SAELC,sB,EACAC,mB,EACAC,uB,EACAC,sB,EACAC,sB,EACAC,sB,EACAC,qB;AAaF,OAAO,MAAMC,SAAN,CAAgB;AACrB;AACF;AACA;AACA;AACA;AAC4B,SAAnBC,mBAAmB,CACxBC,qBADwB,EAE2B;AACnD,QAAIA,qBAAqB,IAAI,IAA7B,EAAmC;AACjC,aAAO,IAAIC,GAAJ,EAAP;AACD;;AACD,WAAOD,qBAAqB,CAACE,MAAtB,CAA6B,CAACC,GAAD,EAAMC,IAAN,KAAe;AACjD,UAAMC,QAAQ,GAAGf,UAAU,CAACgB,iBAAX,CAA6BF,IAAI,CAACG,UAAlC,CAAjB;;AACA,UAAIF,QAAQ,KAAK,IAAjB,EAAuB;AACrB,eAAOF,GAAP;AACD;;AAED,UAAI,CAACA,GAAG,CAACK,GAAJ,CAAQH,QAAR,CAAL,EAAwB;AACtBF,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A,QAAI2B,mBAAmB,GAAG,KAAKd,sBAA/B;;AACA,QAAIf,QAAJ,EAAc;AAAA;;AACZ6B,MAAAA,mBAAmB,4BACjB,KAAKb,gBAAL,CAAsBV,GAAtB,CAA0BN,QAA1B,CADiB,yEACsB6B,mBADzC;AAED;;AACD,WAAOA,mBAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;;;AACEC,EAAAA,kBAAkB,CAChBC,KADgB,EAEhB7B,UAFgB,EAKR;AAAA,QAFRK,UAEQ,uEAFK,EAEL;AAAA,QADRyB,cACQ;;AACR,QAAID,KAAK,IAAI,IAAb,EAAmB;AACjB,aAAO,EAAP;AACD;;AAED,QAAME,SAAS,GAAG,KAAKL,sBAAL,CAA4B1B,UAA5B,CAAlB;AACA,QAAMM,MAAM,GACVwB,cAAc,IAAI,KAAKL,eAAL,CAAqBzB,UAArB,EAAiCK,UAAjC,CADpB;AAGA,WAAO0B,SAAS,CAACzB,MAAV,CAAiBuB,KAAjB,EAAwBvB,MAAxB,aAAwBA,MAAxB,cAAwBA,MAAxB,GAAkCkB,SAAlC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACc,MAARQ,QAAQ,GAAW;AAAA;;AACrB,QAAMD,SAAS,GAAG,KAAKjB,gBAAL,CAAsBV,GAAtB,CAChBrB,UAAU,CAACe,QAAX,CAAoBmB,QADJ,CAAlB;AAGA,WAAOc,SAAP,aAAOA,SAAP,gDAAOA,SAAS,CAAEE,UAAlB,0DAAO,sBAAuBC,EAA9B;AACD;;AApLoB;AAuLvB,eAAe3C,SAAf","sourcesContent":["import TableUtils, { DataType } from './TableUtils';\nimport {\n BooleanColumnFormatter,\n CharColumnFormatter,\n DateTimeColumnFormatter,\n DecimalColumnFormatter,\n DefaultColumnFormatter,\n IntegerColumnFormatter,\n StringColumnFormatter,\n TableColumnFormat,\n TableColumnFormatter,\n} from './formatters';\n\ntype ColumnName = string;\n\nexport interface FormattingRule {\n columnType: string;\n columnName: ColumnName;\n format: TableColumnFormat;\n}\n\nexport class Formatter {\n /**\n * Converts FormattingRule[] to Map\n * @param columnFormattingRules Array or column formatting rules\n * @returns Map of columnName-to-format Maps indexed by normalized dataType\n */\n static makeColumnFormatMap(\n columnFormattingRules: FormattingRule[]\n ): Map<DataType, Map<ColumnName, TableColumnFormat>> {\n if (columnFormattingRules == null) {\n return new Map();\n }\n return columnFormattingRules.reduce((map, next) => {\n const dataType = TableUtils.getNormalizedType(next.columnType);\n if (dataType === null) {\n return map;\n }\n\n if (!map.has(dataType)) {\n map.set(dataType, new Map());\n }\n const formatMap = map.get(dataType);\n formatMap?.set(next.columnName, next.format);\n return map;\n }, new Map<DataType, Map<ColumnName, TableColumnFormat>>());\n }\n\n /**\n * Creates a column formatting rule\n * @param columnType Normalized data type\n * @param columnName Column name\n * @param format Format object\n */\n static makeColumnFormattingRule(\n columnType: DataType,\n columnName: ColumnName,\n format: TableColumnFormat\n ): FormattingRule {\n return {\n columnType,\n columnName,\n format,\n };\n }\n\n /**\n * @param columnFormattingRules Optional array of column formatting rules\n * @param dateTimeOptions Optional object with DateTime configuration\n * @param decimalFormatOptions Optional object with Decimal configuration\n * @param integerFormatOptions Optional object with Integer configuration\n * @param truncateNumbersWithPound Determine if numbers should be truncated w/ repeating # instead of ellipsis at the end\n */\n constructor(\n columnFormattingRules: FormattingRule[] = [],\n dateTimeOptions?: ConstructorParameters<typeof DateTimeColumnFormatter>[0],\n decimalFormatOptions?: ConstructorParameters<\n typeof DecimalColumnFormatter\n >[0],\n integerFormatOptions?: ConstructorParameters<\n typeof IntegerColumnFormatter\n >[0],\n truncateNumbersWithPound = false\n ) {\n // Formatting order:\n // - columnFormatMap[type][name]\n // - typeFormatterMap[type]\n // - defaultColumnFormatter\n\n this.defaultColumnFormatter = new DefaultColumnFormatter();\n\n // Default formatters by data type\n this.typeFormatterMap = new Map<DataType, TableColumnFormatter>([\n [TableUtils.dataType.BOOLEAN, new BooleanColumnFormatter()],\n [TableUtils.dataType.CHAR, new CharColumnFormatter()],\n [\n TableUtils.dataType.DATETIME,\n new DateTimeColumnFormatter(dateTimeOptions),\n ],\n [\n TableUtils.dataType.DECIMAL,\n new DecimalColumnFormatter(decimalFormatOptions),\n ],\n [\n TableUtils.dataType.INT,\n new IntegerColumnFormatter(integerFormatOptions),\n ],\n [TableUtils.dataType.STRING, new StringColumnFormatter()],\n ]);\n\n // Formats indexed by data type and column name\n this.columnFormatMap = Formatter.makeColumnFormatMap(columnFormattingRules);\n this.truncateNumbersWithPound = truncateNumbersWithPound;\n }\n\n defaultColumnFormatter: TableColumnFormatter;\n\n typeFormatterMap: Map<DataType, TableColumnFormatter>;\n\n columnFormatMap: Map<DataType, Map<string, TableColumnFormat>>;\n\n truncateNumbersWithPound: boolean;\n\n /**\n * Gets columnFormatMap indexed by name for a given column type, creates new Map entry if necessary\n * @param columnType column type\n * @param createIfNecessary create new entry if true\n * @returns Map of format strings indexed by column name or undefined if it doesn't exist\n */\n getColumnFormatMapForType(\n columnType: string,\n createIfNecessary = false\n ): Map<string, TableColumnFormat> | undefined {\n const dataType = TableUtils.getNormalizedType(columnType);\n if (dataType === null) {\n return undefined;\n }\n\n if (createIfNecessary && !this.columnFormatMap.has(dataType)) {\n this.columnFormatMap.set(dataType, new Map());\n }\n return this.columnFormatMap.get(dataType);\n }\n\n /**\n * Gets a column format object for a given column type and name\n * @param columnType column type\n * @param columnName column name\n * @returns format object or null for Default\n */\n getColumnFormat(\n columnType: string,\n columnName: ColumnName\n ): TableColumnFormat | null {\n const columnFormatMap = this.getColumnFormatMapForType(columnType);\n return columnFormatMap?.get(columnName) ?? null;\n }\n\n getColumnTypeFormatter(columnType: string): TableColumnFormatter {\n const dataType = TableUtils.getNormalizedType(columnType);\n let columnTypeFormatter = this.defaultColumnFormatter;\n if (dataType) {\n columnTypeFormatter =\n this.typeFormatterMap.get(dataType) ?? columnTypeFormatter;\n }\n return columnTypeFormatter;\n }\n\n /**\n * Gets formatted string for a given value, column type and name\n * @param value Value to format\n * @param columnType Column type used to determine the formatting settings\n * @param columnName Column name used to determine the formatting settings\n * @param formatOverride Format object passed to the formatter in place of the format defined in columnFormatMap\n */\n getFormattedString(\n value: unknown,\n columnType: string,\n columnName = '',\n formatOverride?: Partial<TableColumnFormat>\n ): string {\n if (value == null) {\n return '';\n }\n\n const formatter = this.getColumnTypeFormatter(columnType);\n const format =\n formatOverride || this.getColumnFormat(columnType, columnName);\n\n return formatter.format(value, format ?? undefined);\n }\n\n /**\n * Gets the timeZone name\n * @returns The time zone name E.g. America/New_York\n */\n get timeZone(): string {\n const formatter = this.typeFormatterMap.get(\n TableUtils.dataType.DATETIME\n ) as DateTimeColumnFormatter;\n return formatter?.dhTimeZone?.id;\n }\n}\n\nexport default Formatter;\n"],"file":"Formatter.js"}
|
|
1
|
+
{"version":3,"sources":["../src/Formatter.ts"],"names":["TableUtils","BooleanColumnFormatter","CharColumnFormatter","DateTimeColumnFormatter","DecimalColumnFormatter","DefaultColumnFormatter","IntegerColumnFormatter","StringColumnFormatter","Formatter","makeColumnFormatMap","columnFormattingRules","Map","reduce","map","next","dataType","getNormalizedType","columnType","has","set","formatMap","get","columnName","format","makeColumnFormattingRule","constructor","dateTimeOptions","decimalFormatOptions","integerFormatOptions","truncateNumbersWithPound","defaultColumnFormatter","typeFormatterMap","BOOLEAN","CHAR","DATETIME","DECIMAL","INT","STRING","columnFormatMap","getColumnFormatMapForType","createIfNecessary","undefined","getColumnFormat","getColumnTypeFormatter","columnTypeFormatter","getFormattedString","value","formatOverride","formatter","timeZone","dhTimeZone","id"],"mappings":";;OAAOA,U;SAELC,sB,EACAC,mB,EACAC,uB,EACAC,sB,EACAC,sB,EACAC,sB,EACAC,qB;AAaF,OAAO,MAAMC,SAAN,CAAgB;AACrB;AACF;AACA;AACA;AACA;AAC4B,SAAnBC,mBAAmB,CACxBC,qBADwB,EAE2B;AACnD,QAAIA,qBAAqB,IAAI,IAA7B,EAAmC;AACjC,aAAO,IAAIC,GAAJ,EAAP;AACD;;AACD,WAAOD,qB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eAAe3C,SAAf","sourcesContent":["import TableUtils, { DataType } from './TableUtils';\nimport {\n BooleanColumnFormatter,\n CharColumnFormatter,\n DateTimeColumnFormatter,\n DecimalColumnFormatter,\n DefaultColumnFormatter,\n IntegerColumnFormatter,\n StringColumnFormatter,\n TableColumnFormat,\n TableColumnFormatter,\n} from './formatters';\n\ntype ColumnName = string;\n\nexport interface FormattingRule {\n columnType: string;\n columnName: string;\n format: TableColumnFormat;\n}\n\nexport class Formatter {\n /**\n * Converts FormattingRule[] to Map\n * @param columnFormattingRules Array or column formatting rules\n * @returns Map of columnName-to-format Maps indexed by normalized dataType\n */\n static makeColumnFormatMap(\n columnFormattingRules: FormattingRule[]\n ): Map<DataType, Map<ColumnName, TableColumnFormat>> {\n if (columnFormattingRules == null) {\n return new Map();\n }\n return columnFormattingRules.reduce((map, next) => {\n const dataType = TableUtils.getNormalizedType(next.columnType);\n if (dataType === null) {\n return map;\n }\n\n if (!map.has(dataType)) {\n map.set(dataType, new Map());\n }\n const formatMap = map.get(dataType);\n formatMap?.set(next.columnName, next.format);\n return map;\n }, new Map<DataType, Map<ColumnName, TableColumnFormat>>());\n }\n\n /**\n * Creates a column formatting rule\n * @param columnType Normalized data type\n * @param columnName Column name\n * @param format Format object\n */\n static makeColumnFormattingRule(\n columnType: DataType,\n columnName: string,\n format: TableColumnFormat\n ): FormattingRule {\n return {\n columnType,\n columnName,\n format,\n };\n }\n\n /**\n * @param columnFormattingRules Optional array of column formatting rules\n * @param dateTimeOptions Optional object with DateTime configuration\n * @param decimalFormatOptions Optional object with Decimal configuration\n * @param integerFormatOptions Optional object with Integer configuration\n * @param truncateNumbersWithPound Determine if numbers should be truncated w/ repeating # instead of ellipsis at the end\n */\n constructor(\n columnFormattingRules: FormattingRule[] = [],\n dateTimeOptions?: ConstructorParameters<typeof DateTimeColumnFormatter>[0],\n decimalFormatOptions?: ConstructorParameters<\n typeof DecimalColumnFormatter\n >[0],\n integerFormatOptions?: ConstructorParameters<\n typeof IntegerColumnFormatter\n >[0],\n truncateNumbersWithPound = false\n ) {\n // Formatting order:\n // - columnFormatMap[type][name]\n // - typeFormatterMap[type]\n // - defaultColumnFormatter\n\n this.defaultColumnFormatter = new DefaultColumnFormatter();\n\n // Default formatters by data type\n this.typeFormatterMap = new Map<DataType, TableColumnFormatter>([\n [TableUtils.dataType.BOOLEAN, new BooleanColumnFormatter()],\n [TableUtils.dataType.CHAR, new CharColumnFormatter()],\n [\n TableUtils.dataType.DATETIME,\n new DateTimeColumnFormatter(dateTimeOptions),\n ],\n [\n TableUtils.dataType.DECIMAL,\n new DecimalColumnFormatter(decimalFormatOptions),\n ],\n [\n TableUtils.dataType.INT,\n new IntegerColumnFormatter(integerFormatOptions),\n ],\n [TableUtils.dataType.STRING, new StringColumnFormatter()],\n ]);\n\n // Formats indexed by data type and column name\n this.columnFormatMap = Formatter.makeColumnFormatMap(columnFormattingRules);\n this.truncateNumbersWithPound = truncateNumbersWithPound;\n }\n\n defaultColumnFormatter: TableColumnFormatter;\n\n typeFormatterMap: Map<DataType, TableColumnFormatter>;\n\n columnFormatMap: Map<DataType, Map<string, TableColumnFormat>>;\n\n truncateNumbersWithPound: boolean;\n\n /**\n * Gets columnFormatMap indexed by name for a given column type, creates new Map entry if necessary\n * @param columnType column type\n * @param createIfNecessary create new entry if true\n * @returns Map of format strings indexed by column name or undefined if it doesn't exist\n */\n getColumnFormatMapForType(\n columnType: string,\n createIfNecessary = false\n ): Map<string, TableColumnFormat> | undefined {\n const dataType = TableUtils.getNormalizedType(columnType);\n if (dataType === null) {\n return undefined;\n }\n\n if (createIfNecessary && !this.columnFormatMap.has(dataType)) {\n this.columnFormatMap.set(dataType, new Map());\n }\n return this.columnFormatMap.get(dataType);\n }\n\n /**\n * Gets a column format object for a given column type and name\n * @param columnType column type\n * @param columnName column name\n * @returns format object or null for Default\n */\n getColumnFormat(\n columnType: string,\n columnName: string\n ): TableColumnFormat | null {\n const columnFormatMap = this.getColumnFormatMapForType(columnType);\n return columnFormatMap?.get(columnName) ?? null;\n }\n\n getColumnTypeFormatter(columnType: string): TableColumnFormatter {\n const dataType = TableUtils.getNormalizedType(columnType);\n let columnTypeFormatter = this.defaultColumnFormatter;\n if (dataType) {\n columnTypeFormatter =\n this.typeFormatterMap.get(dataType) ?? columnTypeFormatter;\n }\n return columnTypeFormatter;\n }\n\n /**\n * Gets formatted string for a given value, column type and name\n * @param value Value to format\n * @param columnType Column type used to determine the formatting settings\n * @param columnName Column name used to determine the formatting settings\n * @param formatOverride Format object passed to the formatter in place of the format defined in columnFormatMap\n */\n getFormattedString(\n value: unknown,\n columnType: string,\n columnName = '',\n formatOverride?: TableColumnFormat\n ): string {\n if (value == null) {\n return '';\n }\n\n const formatter = this.getColumnTypeFormatter(columnType);\n const format =\n formatOverride || this.getColumnFormat(columnType, columnName);\n\n return formatter.format(value, format ?? undefined);\n }\n\n /**\n * Gets the timeZone name\n * @returns The time zone name E.g. America/New_York\n */\n get timeZone(): string {\n const formatter = this.typeFormatterMap.get(\n TableUtils.dataType.DATETIME\n ) as DateTimeColumnFormatter;\n return formatter?.dhTimeZone?.id;\n }\n}\n\nexport default Formatter;\n"],"file":"Formatter.js"}
|
package/dist/FormatterUtils.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { FormattingRule } from './Formatter';
|
|
2
2
|
import Formatter from './Formatter';
|
|
3
3
|
import { DateTimeColumnFormatter } from './formatters';
|
|
4
|
-
declare class FormatterUtils {
|
|
5
|
-
static getColumnFormats(settings
|
|
6
|
-
formatter
|
|
7
|
-
}): FormattingRule[]
|
|
8
|
-
static getDateTimeFormatterOptions(settings
|
|
9
|
-
timeZone
|
|
10
|
-
defaultDateTimeFormat
|
|
11
|
-
showTimeZone
|
|
12
|
-
showTSeparator
|
|
13
|
-
}
|
|
4
|
+
export declare class FormatterUtils {
|
|
5
|
+
static getColumnFormats(settings: {
|
|
6
|
+
formatter: FormattingRule[];
|
|
7
|
+
}): FormattingRule[];
|
|
8
|
+
static getDateTimeFormatterOptions(settings: {
|
|
9
|
+
timeZone: string;
|
|
10
|
+
defaultDateTimeFormat: string;
|
|
11
|
+
showTimeZone: boolean;
|
|
12
|
+
showTSeparator: boolean;
|
|
13
|
+
}): Required<ConstructorParameters<typeof DateTimeColumnFormatter>[0]>;
|
|
14
14
|
/**
|
|
15
15
|
* Check if the formatter has a custom format defined for the column name and type
|
|
16
16
|
* @param formatter Formatter to check
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatterUtils.d.ts","sourceRoot":"","sources":["../src/FormatterUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAwB,MAAM,cAAc,CAAC;AAE7E,
|
|
1
|
+
{"version":3,"file":"FormatterUtils.d.ts","sourceRoot":"","sources":["../src/FormatterUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAwB,MAAM,cAAc,CAAC;AAE7E,qBAAa,cAAc;IACzB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE;QAChC,SAAS,EAAE,cAAc,EAAE,CAAC;KAC7B,GAAG,cAAc,EAAE;IAKpB,MAAM,CAAC,2BAA2B,CAAC,QAAQ,EAAE;QAC3C,QAAQ,EAAE,MAAM,CAAC;QACjB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,YAAY,EAAE,OAAO,CAAC;QACtB,cAAc,EAAE,OAAO,CAAC;KACzB,GAAG,QAAQ,CAAC,qBAAqB,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC;IAetE;;;;;;OAMG;IACH,MAAM,CAAC,2BAA2B,CAChC,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO;CAQX;AAED,eAAe,cAAc,CAAC"}
|
package/dist/FormatterUtils.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { TableColumnFormatter } from "./formatters/index.js";
|
|
2
|
-
|
|
3
|
-
class FormatterUtils {
|
|
2
|
+
export class FormatterUtils {
|
|
4
3
|
static getColumnFormats(settings) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return formatter;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return undefined;
|
|
4
|
+
var {
|
|
5
|
+
formatter
|
|
6
|
+
} = settings;
|
|
7
|
+
return formatter;
|
|
13
8
|
}
|
|
14
9
|
|
|
15
10
|
static getDateTimeFormatterOptions(settings) {
|
|
11
|
+
var {
|
|
12
|
+
timeZone,
|
|
13
|
+
defaultDateTimeFormat,
|
|
14
|
+
showTimeZone,
|
|
15
|
+
showTSeparator
|
|
16
|
+
} = settings;
|
|
16
17
|
return {
|
|
17
|
-
timeZone
|
|
18
|
-
defaultDateTimeFormatString:
|
|
19
|
-
showTimeZone
|
|
20
|
-
showTSeparator
|
|
18
|
+
timeZone,
|
|
19
|
+
defaultDateTimeFormatString: defaultDateTimeFormat,
|
|
20
|
+
showTimeZone,
|
|
21
|
+
showTSeparator
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
@@ -35,6 +36,5 @@ class FormatterUtils {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
}
|
|
38
|
-
|
|
39
39
|
export default FormatterUtils;
|
|
40
40
|
//# sourceMappingURL=FormatterUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/FormatterUtils.ts"],"names":["TableColumnFormatter","FormatterUtils","getColumnFormats","settings","formatter","
|
|
1
|
+
{"version":3,"sources":["../src/FormatterUtils.ts"],"names":["TableColumnFormatter","FormatterUtils","getColumnFormats","settings","formatter","getDateTimeFormatterOptions","timeZone","defaultDateTimeFormat","showTimeZone","showTSeparator","defaultDateTimeFormatString","isCustomColumnFormatDefined","columnName","columnType","columnFormat","getColumnFormat","type","TYPE_CONTEXT_PRESET","TYPE_CONTEXT_CUSTOM"],"mappings":"SAEkCA,oB;AAElC,OAAO,MAAMC,cAAN,CAAqB;AACH,SAAhBC,gBAAgB,CAACC,QAAD,EAEF;AACnB,QAAM;AAAEC,MAAAA;AAAF,QAAgBD,QAAtB;AACA,WAAOC,SAAP;AACD;;AAEiC,SAA3BC,2BAA2B,CAACF,QAAD,EAKqC;AACrE,QAAM;AACJG,MAAAA,QADI;AAEJC,MAAAA,qBAFI;AAGJC,MAAAA,YAHI;AAIJC,MAAAA;AAJI,QAKFN,QALJ;AAMA,WAAO;AACLG,MAAAA,QADK;AAELI,MAAAA,2BAA2B,EAAEH,qBAFxB;AAGLC,MAAAA,YAHK;AAILC,MAAAA;AAJK,KAAP;AAMD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;;;AACoC,SAA3BE,2BAA2B,CAChCP,SADgC,EAEhCQ,UAFgC,EAGhCC,UAHgC,EAIvB;AACT,QAAMC,YAAY,GAAGV,SAAS,CAACW,eAAV,CAA0BF,UAA1B,EAAsCD,UAAtC,CAArB;AACA,WACEE,YAAY,IAAI,IAAhB,KACCA,YAAY,CAACE,IAAb,KAAsBhB,oBAAoB,CAACiB,mBAA3C,IACCH,YAAY,CAACE,IAAb,KAAsBhB,oBAAoB,CAACkB,mBAF7C,CADF;AAKD;;AA9CyB;AAiD5B,eAAejB,cAAf","sourcesContent":["import type { FormattingRule } from './Formatter';\nimport Formatter from './Formatter';\nimport { DateTimeColumnFormatter, TableColumnFormatter } from './formatters';\n\nexport class FormatterUtils {\n static getColumnFormats(settings: {\n formatter: FormattingRule[];\n }): FormattingRule[] {\n const { formatter } = settings;\n return formatter;\n }\n\n static getDateTimeFormatterOptions(settings: {\n timeZone: string;\n defaultDateTimeFormat: string;\n showTimeZone: boolean;\n showTSeparator: boolean;\n }): Required<ConstructorParameters<typeof DateTimeColumnFormatter>[0]> {\n const {\n timeZone,\n defaultDateTimeFormat,\n showTimeZone,\n showTSeparator,\n } = settings;\n return {\n timeZone,\n defaultDateTimeFormatString: defaultDateTimeFormat,\n showTimeZone,\n showTSeparator,\n };\n }\n\n /**\n * Check if the formatter has a custom format defined for the column name and type\n * @param formatter Formatter to check\n * @param columnName Column name\n * @param columnType Column type\n * @returns True, if a custom format is defined\n */\n static isCustomColumnFormatDefined(\n formatter: Formatter,\n columnName: string,\n columnType: string\n ): boolean {\n const columnFormat = formatter.getColumnFormat(columnType, columnName);\n return (\n columnFormat != null &&\n (columnFormat.type === TableColumnFormatter.TYPE_CONTEXT_PRESET ||\n columnFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM)\n );\n }\n}\n\nexport default FormatterUtils;\n"],"file":"FormatterUtils.js"}
|
package/dist/TableUtils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TypeValue as FilterTypeValue, OperatorValue as FilterOperatorValue } from '@deephaven/filters';
|
|
1
|
+
import { Type as FilterType, TypeValue as FilterTypeValue, OperatorValue as FilterOperatorValue } from '@deephaven/filters';
|
|
2
2
|
import { Column, FilterCondition, FilterValue, LongWrapper, Sort, Table, TreeTable } from '@deephaven/jsapi-shim';
|
|
3
3
|
import { CancelablePromise } from '@deephaven/utils';
|
|
4
4
|
declare type Values<T> = T[keyof T];
|
|
@@ -9,16 +9,6 @@ export declare type AdvancedFilterItemType = {
|
|
|
9
9
|
selectedType: FilterTypeValue;
|
|
10
10
|
value: string;
|
|
11
11
|
};
|
|
12
|
-
export interface FilterItem {
|
|
13
|
-
selectedType: FilterTypeValue;
|
|
14
|
-
value: string;
|
|
15
|
-
}
|
|
16
|
-
export declare type AdvancedFilterOptions = {
|
|
17
|
-
filterItems: FilterItem[];
|
|
18
|
-
filterOperators: FilterOperatorValue[];
|
|
19
|
-
invertSelection: boolean;
|
|
20
|
-
selectedValues: unknown[];
|
|
21
|
-
};
|
|
22
12
|
/** Utility class to provide some functions for working with tables */
|
|
23
13
|
export declare class TableUtils {
|
|
24
14
|
static dataType: {
|
|
@@ -28,7 +18,6 @@ export declare class TableUtils {
|
|
|
28
18
|
readonly DECIMAL: "decimal";
|
|
29
19
|
readonly INT: "int";
|
|
30
20
|
readonly STRING: "string";
|
|
31
|
-
readonly UNKNOWN: "unknown";
|
|
32
21
|
};
|
|
33
22
|
static sortDirection: {
|
|
34
23
|
readonly ascending: "ASC";
|
|
@@ -49,20 +38,20 @@ export declare class TableUtils {
|
|
|
49
38
|
* @return The sort for the column, or null if it's not sorted
|
|
50
39
|
*/
|
|
51
40
|
static getSortForColumn(tableSort: Sort[], columnIndex: number): Sort | null;
|
|
52
|
-
static getFilterText(filter
|
|
41
|
+
static getFilterText(filter: FilterCondition): string | null;
|
|
53
42
|
/** Return the valid filter types for the column */
|
|
54
|
-
static getFilterTypes(columnType: string):
|
|
55
|
-
static getNextSort(
|
|
56
|
-
static makeColumnSort(
|
|
43
|
+
static getFilterTypes(columnType: string): FilterType[];
|
|
44
|
+
static getNextSort(table: Table, columnIndex: number): Sort | null;
|
|
45
|
+
static makeColumnSort(table: Table, columnIndex: number, direction: SortDirection, isAbs: boolean): Sort | null;
|
|
57
46
|
/**
|
|
58
47
|
* Toggles the sort for the specified column
|
|
59
48
|
* @param sorts The current sorts from IrisGrid.state
|
|
60
|
-
* @param
|
|
49
|
+
* @param table The table to apply the sort to
|
|
61
50
|
* @param columnIndex The column index to apply the sort to
|
|
62
51
|
* @param addToExisting Add this sort to the existing sort
|
|
63
52
|
*/
|
|
64
|
-
static toggleSortForColumn(sorts: Sort[],
|
|
65
|
-
static sortColumn(
|
|
53
|
+
static toggleSortForColumn(sorts: Sort[], table: Table, columnIndex: number, addToExisting?: boolean): Sort[];
|
|
54
|
+
static sortColumn(table: Table, modelColumn: number, direction: SortDirection, isAbs: boolean, addToExisting: boolean): Sort[];
|
|
66
55
|
/**
|
|
67
56
|
* Sets the sort for the given column *and* removes any reverses
|
|
68
57
|
* @param tableSort The current sorts from IrisGrid.state
|
|
@@ -72,7 +61,7 @@ export declare class TableUtils {
|
|
|
72
61
|
* @returns Returns the modified array of sorts - removing reverses
|
|
73
62
|
*/
|
|
74
63
|
static setSortForColumn(tableSort: Sort[], columnIndex: number, sort: Sort | null, addToExisting?: boolean): Sort[];
|
|
75
|
-
static getNormalizedType(columnType: string): DataType;
|
|
64
|
+
static getNormalizedType(columnType: string): DataType | null;
|
|
76
65
|
static isLongType(columnType: string): boolean;
|
|
77
66
|
static isDateType(columnType: string): boolean;
|
|
78
67
|
static isNumberType(columnType: string): boolean;
|
|
@@ -113,7 +102,7 @@ export declare class TableUtils {
|
|
|
113
102
|
static makeQuickFilterFromComponent(column: Column, text: string, timeZone?: string): FilterCondition | null;
|
|
114
103
|
static makeQuickNumberFilter(column: Column, text: string): FilterCondition | null;
|
|
115
104
|
static makeQuickTextFilter(column: Column, text: string | null): FilterCondition | null;
|
|
116
|
-
static makeQuickBooleanFilter(column: Column, text: string
|
|
105
|
+
static makeQuickBooleanFilter(column: Column, text: string): FilterCondition | null;
|
|
117
106
|
/**
|
|
118
107
|
* Builds a date filter parsed from the text string which may or may not include an operator.
|
|
119
108
|
* @param column The column to build the filter from, with or without a leading operator.
|
|
@@ -129,6 +118,12 @@ export declare class TableUtils {
|
|
|
129
118
|
* @param timeZone The time zone to make this filter with. E.g. America/New_York
|
|
130
119
|
*/
|
|
131
120
|
static makeQuickDateFilterWithOperation(column: Column, text: string, operation: string | undefined, timeZone: string): FilterCondition;
|
|
121
|
+
/**
|
|
122
|
+
* Adds quotes to a value if they're not already added
|
|
123
|
+
* @param value Value to add quotes around
|
|
124
|
+
*/
|
|
125
|
+
static quoteValue(value: string): string;
|
|
126
|
+
static isRangeOperation(operation: string): boolean;
|
|
132
127
|
static makeQuickCharFilter(column: Column, text: string): FilterCondition | null;
|
|
133
128
|
/**
|
|
134
129
|
* @param filter The column filter to apply the range operation to
|
|
@@ -152,7 +147,12 @@ export declare class TableUtils {
|
|
|
152
147
|
* @returns Resolves with the event data
|
|
153
148
|
*/
|
|
154
149
|
static makeCancelableTableEventPromise(table: Table | TreeTable, eventName: string, timeout?: number, matcher?: ((event: CustomEvent) => boolean) | null): CancelablePromise<CustomEvent>;
|
|
155
|
-
static makeAdvancedFilter(column: Column, options:
|
|
150
|
+
static makeAdvancedFilter(column: Column, options: {
|
|
151
|
+
filterItems: AdvancedFilterItemType[];
|
|
152
|
+
filterOperators: FilterOperatorValue[];
|
|
153
|
+
invertSelection: boolean;
|
|
154
|
+
selectedValues: string[];
|
|
155
|
+
}, timeZone: string): FilterCondition | null;
|
|
156
156
|
static removeCommas(value: string): string;
|
|
157
157
|
/**
|
|
158
158
|
* @param columnType The column type to make the filter value from.
|
|
@@ -177,7 +177,8 @@ export declare class TableUtils {
|
|
|
177
177
|
static makeValue(columnType: string, text: string, timeZone: string): string | number | boolean | LongWrapper | null;
|
|
178
178
|
static makeBooleanValue(text: string, allowEmpty?: boolean): boolean | null;
|
|
179
179
|
static makeNumberValue(text: string): number | null;
|
|
180
|
-
static
|
|
180
|
+
static getFilterOperatorString(operation: FilterTypeValue): string;
|
|
181
|
+
static makeAdvancedValueFilter(column: Column, operation: FilterTypeValue, value: string, timeZone: string): FilterCondition | null;
|
|
181
182
|
/**
|
|
182
183
|
* Create a filter using the selected items
|
|
183
184
|
* Has a flag for invertSelection as we start from a "Select All" state and a user just deselects items.
|
|
@@ -187,7 +188,7 @@ export declare class TableUtils {
|
|
|
187
188
|
* @param invertSelection Invert the selection (eg. All items are selected, then you deselect items)
|
|
188
189
|
* @returns Returns a `in` or `notIn` FilterCondition as necessary, or null if no filtering should be applied (everything selected)
|
|
189
190
|
*/
|
|
190
|
-
static makeSelectValueFilter(column: Column, selectedValues:
|
|
191
|
+
static makeSelectValueFilter(column: Column, selectedValues: string[], invertSelection: boolean): FilterCondition | null;
|
|
191
192
|
static isTreeTable(table: unknown): table is TreeTable;
|
|
192
193
|
/**
|
|
193
194
|
* Copies the provided array, sorts by column name case insensitive, and returns the sorted array.
|
package/dist/TableUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableUtils.d.ts","sourceRoot":"","sources":["../src/TableUtils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"TableUtils.d.ts","sourceRoot":"","sources":["../src/TableUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,IAAI,UAAU,EAElB,SAAS,IAAI,eAAe,EAC5B,aAAa,IAAI,mBAAmB,EACrC,MAAM,oBAAoB,CAAC;AAE5B,OAAW,EACT,MAAM,EACN,eAAe,EACf,WAAW,EACX,WAAW,EAEX,IAAI,EACJ,KAAK,EACL,SAAS,EACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,iBAAiB,EAIlB,MAAM,kBAAkB,CAAC;AAK1B,aAAK,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAC5B,oBAAY,QAAQ,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC1D,oBAAY,aAAa,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC;AACpE,oBAAY,WAAW,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;AACjE,oBAAY,sBAAsB,GAAG;IACnC,YAAY,EAAE,eAAe,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,sEAAsE;AACtE,qBAAa,UAAU;IACrB,MAAM,CAAC,QAAQ;;;;;;;MAOJ;IAEX,MAAM,CAAC,aAAa;;;;;MAKT;IAEX,MAAM,CAAC,YAAY;;;;OAIP;IAGZ,MAAM,CAAC,YAAY,SAAqB;IAExC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,MAA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