@mescius/dspdfviewer
Version:
Document Solutions PDF Viewer
117 lines (116 loc) • 9.97 kB
TypeScript
/**
* The `GlobalJsFunctions` class defines global JavaScript functions
* that will be available for JavaScript actions in PDF documents.
*
* This class provides a set of utilities and helper methods that
* can be invoked from JavaScript code embedded in PDF documents.
* It allows enhancing the functionality and interactivity of PDF files
* by adding support for complex use cases.
*/
export declare class GlobalJsFunctions {
/**
* Formats a numeric value as a percentage.
* @param {string} value - The numeric value to format.
* @param {number} nDec - The number of decimal places after the decimal point.
* @param {number} sepStyle - An integer denoting whether to use a separator for thousands.
* If sepStyle=0, use commas. If sepStyle=1, do not separate.
* @returns {string} The formatted percentage value.
*/
AFPercent_Keystroke(value: string, nDec: any, sepStyle: any): string;
/**
* Formats a numeric value as a percentage.
* @param {string} value - The numeric value to format.
* @param {number} nDec - The number of figures to display after the decimal point. eg for "2" the output might be "1,234.567%".
* @param {number} sepStyle - A number indicating the style of separators for thousands and decimal points.
* 0 - Thousands separated using commas and decimals separated using a period. eg "1,234.56%"
* 1 - Decimals separated using a period. eg "1234.56"
* 2 - Thousands separated using periods and decimals separated using a comma. eg "1.234,56%"
* 3 - Decimals separated using a comma. eg "1234,56"
* 4 - Thousands separated using apostrophe and decimals separated using a period. eg "12'345'600.00%"
* @returns {string} The formatted percentage value.
*/
AFPercent_Format(value: string, nDec: any, sepStyle: any): string;
/**
* Formats a numeric value according to specified parameters.
* @param {string} value - The numeric value to format.
* @param {number} decimals - The number of figures to display after the decimal point.
* @param {number} separator - A number indicating the style of separators for thousands and decimal points.
* 0 - Thousands separated using commas and decimals separated using a period.
* 1 - Decimals separated using a period.
* 2 - Thousands separated using periods and decimals separated using a comma.
* 3 - Decimals separated using a comma.
* @param {number} negative - A number indicating the style for negative numbers.
* 0 - A preceding dash indicate negative numbers.
* 1 - Black for positive and red for negative numbers.
* 2 - Negative numbers placed in parentheses.
* 3 - Negative numbers placed in parentheses. Also black for positive and red for negative.
* @param {any} unused - This parameter is currently unused.
* @param {string} currency - A string indicating the currency symbol to be added to numbers.
* @param {boolean} prepend - A boolean indicating whether the currency symbol should be prepended or appended.
* If true, the currency symbol will be prepended.
* If false, the currency symbol will be appended.
* @returns {string} The formatted numeric value.
*/
AFNumber_Format(value: string | number, decimals: number, separator: number, negative: number, unused: any, currency: string, prepend: boolean): string;
AFTime_Format(value: string, date_time_format: string): string;
AFTime_FormatEx(value: string, date_time_format: string): string;
/**
* Formats a date or time value according to the specified style.
* @param {string} value - The date or time value to format. It can be a Date object or a string representing a date.
* @param {string} date_time_format - A string indicating the style used to format a date or time.
* See date_type for examples of the types of styles you can use.
* The "m" and "mm" sequences indicate the month using a one and two digit number respectively - the former being of limited use.
* The "mmm" and "mmmm" sequence indicates the month using a short three character and full name respectively.
* The "d" and "dd" sequences indicates the ordinal day of the month (the former being of limited use) while the "ddd" and "dddd" sequences indicate the day of the week using a short three character and full name respectively.
* The "yy" indicates the short form of the year and the "yyyy" selector indicates the long form of the year.
* The "h", "hh", "H" and "HH" sequences indicate the hours. The upper case versions work on the twenty-four hour clock and the lower case ones on the twelve hour clock.
* The one character selectors indicate the hour using one character (obviously of limited use) and the two character selectors indicate it using two characters.
* The "MM" selector indicates the number of minutes past the current hour.
* The "s" and "ss" selectors indicate the number of seconds past the current minute. The former uses one digit - of limited use - and the latter uses two.
* The "t" and "tt" indicate the time relative to the meridiem - am or pm - using one digit or two characters respectively.
* @returns {string} The formatted date or time string.
*/
AFDate_FormatEx(value: string, date_time_format: string): string;
/**
* Formats a value according to the specified fixed format style.
* @param {string} value - The value to format. It can be a string or a number.
* @param {string} special_type - A number indicating a fixed format style used for structures such as telephone numbers and zip codes.
* 0 - Five digit zip code. eg "12345"
* 1 - Zip plus-four code. eg "12345-6789"
* 2 - A long or short telephone number depending on the number of digits. eg "(123) 456-7890" or "456-7890"
* 3 - Social security number. eg "123-45-6789"
* @returns {string} The formatted value.
*/
AFSpecial_Format(value: string | number, special_type: number | string): string;
/**
* Converts a date string to JavaScript date format based on the specified date_time_format.
* @param {string} dateString - The date string to convert.
* @param {string} date_time_format - A string indicating the style used to format a date or time.
* The format should include placeholders for day, month, and year.
* Examples: "dd-mm-yyyy", "d-m-yy", "mm/dd/yyyy", etc.
* See date_type for examples of the types of styles you can use.
* The "m" and "mm" sequences indicate the month using a one and two digit number respectively - the former being of limited use.
* The "mmm" and "mmmm" sequence indicates the month using a short three character and full name respectively.
* The "d" and "dd" sequences indicates the ordinal day of the month (the former being of limited use) while the "ddd" and "dddd" sequences indicate the day of the week using a short three character and full name respectively.
* The "yy" indicates the short form of the year and the "yyyy" selector indicates the long form of the year.
* The "h", "hh", "H" and "HH" sequences indicate the hours. The upper case versions work on the twenty-four hour clock and the lower case ones on the twelve hour clock.
* The one character selectors indicate the hour using one character (obviously of limited use) and the two character selectors indicate it using two characters.
* The "MM" selector indicates the number of minutes past the current hour.
* The "s" and "ss" selectors indicate the number of seconds past the current minute. The former uses one digit - of limited use - and the latter uses two.
* The "t" and "tt" indicate the time relative to the meridiem - am or pm - using one digit or two characters respectively.
* @returns {string} The date string converted to JavaScript date format.
* @throws {Error} If the date format is invalid or cannot be parsed.
*/
dateStringToJsDateFormat(dateString: string, date_time_format: string): string;
/**
* Formats a date or time based on the provided format string.
*
* @param value - The date or time value to format.
* @param {string} date_time_format - A string indicating the style used to format a date or time.
* Examples: "dd-mm-yyyy", "d-m-yy", "mm/dd/yyyy", etc.
* @param formatTime - A boolean indicating whether to format the time.
* @returns {string} The formatted date or time string.
*/
private formatDateTimeInternal;
}
export declare function getGlobalJsFunctions(): any;