chore: adding comments part 3
Some checks failed
Build / Build-and-ng-test (pull_request) Failing after 23s

This commit is contained in:
Mihajlo Medjedovic 2023-08-04 12:05:00 +02:00
parent 81c0aec202
commit cd3e0f614b
6 changed files with 49 additions and 1 deletions

View File

@ -1,3 +1,7 @@
/**
* Model for the dynamic cell validation in the editor
* (sending whole row to the backend service and recieving data for the cell dropdown)
*/
export interface DynamicExtendedCellValidation {
DISPLAY_INDEX: number
DISPLAY_TYPE: string

View File

@ -1,8 +1,14 @@
/**
* Edit record modal - input has been focused event
*/
export interface EditRecordInputFocusedEvent {
event: any
colName: number
}
/**
* Edit record modal - dropdown has been changed event
*/
export interface EditRecordDropdownChangeEvent {
colName: string
col: number

View File

@ -1,3 +1,6 @@
/**
* Editor restrictions model (based on the licencing)
*/
export interface EditorRestrictions {
restrictEditRecord?: boolean // Feature is locked but edit/add record buttons are visible so when user clicks he gets the `locked feature modal`
restrictAddRecord?: boolean // Same as editRecord, but for addRecord

View File

@ -1,3 +1,6 @@
/**
* Converting date object to the UTC time string
*/
export const dateToUtcTime = (date: Date) => {
let timeStr = ('0' + date.getUTCHours()).slice(-2) + ':'
timeStr = timeStr + ('0' + date.getUTCMinutes()).slice(-2) + ':'
@ -5,6 +8,9 @@ export const dateToUtcTime = (date: Date) => {
return timeStr
}
/**
* Converts date object to the time string
*/
export const dateToTime = (date: Date) => {
let timeStr = ('0' + date.getHours()).slice(-2) + ':'
timeStr = timeStr + ('0' + date.getMinutes()).slice(-2) + ':'
@ -12,6 +18,9 @@ export const dateToTime = (date: Date) => {
return timeStr
}
/**
* Converts date object to the YYYY-MM-DD
*/
export const dateFormat = (date: Date) => {
return (
date.getFullYear() +

View File

@ -1,9 +1,17 @@
import { Col } from 'src/app/shared/dc-validator/models/col.model'
/**
* Converts excel date serial number to JS date
*/
export const excelDateToJSDate = (serial: number) => {
return new Date(Math.round((serial - 25569) * 86400 * 1000))
}
/**
* Parsing table columns for the HOT in editor
* Converts array of objects into array of strings, every string is column name (key)
* @param data array of objects (columns data)
*/
export const parseTableColumns = (data: Col[]): string[] => {
const columns: string[] = []
@ -16,6 +24,12 @@ export const parseTableColumns = (data: Col[]): string[] => {
return columns
}
/**
* Captures headers that are not found in the current table but is found in the uploaded file data
* @param data
* @param headers
* @returns string array of missing headers
*/
export const getMissingHeaders = (data: any, headers: any) => {
const missingHeaders: string[] = []
const remainingHeaders: string[] = []

View File

@ -1,3 +1,7 @@
/**
* Custom renderer for HOT cell
* Used to show error icon
*/
export const errorRenderer = (
instance: any,
td: any,
@ -14,6 +18,10 @@ export const errorRenderer = (
return td
}
/**
* Custom renderer for HOT cell
* Used to revert cell back to original state (no spinner, no error)
*/
export const noSpinnerRenderer = (
instance: any,
td: any,
@ -28,7 +36,11 @@ export const noSpinnerRenderer = (
return td
}
// Spinner shown whilst waiting for SAS to respond
/**
* Custom renderer for HOT cell
* Used to show loading spinner in the cell
* (Spinner shown whilst waiting for SAS to respond)
*/
export const spinnerRenderer = (
instance: any,
td: any,