@finsys/core 1.4.2 → 1.5.0
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/data/form-field-display-names.json +172 -0
- package/dist/index.cjs +465 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -1
- package/dist/index.d.ts +56 -1
- package/dist/index.js +455 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -377,4 +377,59 @@ declare function getBaseCategories(): Category[];
|
|
|
377
377
|
declare function getBaseFieldSpecMap(): Map<string, FieldData>;
|
|
378
378
|
declare function getBaseFieldNames(): string[];
|
|
379
379
|
|
|
380
|
-
|
|
380
|
+
declare enum IhsValueFormat {
|
|
381
|
+
STRING = "string",
|
|
382
|
+
CURRENCY = "currency",
|
|
383
|
+
NUMBER = "number",
|
|
384
|
+
PERCENTAGE = "percentage",
|
|
385
|
+
DATE = "date",
|
|
386
|
+
TABLE = "table"
|
|
387
|
+
}
|
|
388
|
+
interface IhsFieldDetail {
|
|
389
|
+
name: string;
|
|
390
|
+
displayName: string;
|
|
391
|
+
category: string;
|
|
392
|
+
value: unknown;
|
|
393
|
+
valueFormat: IhsValueFormat;
|
|
394
|
+
}
|
|
395
|
+
interface IhsDetailCategory {
|
|
396
|
+
category: string;
|
|
397
|
+
items: {
|
|
398
|
+
name: string;
|
|
399
|
+
displayName: string;
|
|
400
|
+
value: unknown;
|
|
401
|
+
valueFormat: IhsValueFormat;
|
|
402
|
+
}[];
|
|
403
|
+
}
|
|
404
|
+
declare enum FileFieldTableType {
|
|
405
|
+
TIME_SERIES = "timeSeries",
|
|
406
|
+
KEY_VALUE = "keyValue"
|
|
407
|
+
}
|
|
408
|
+
interface FileFieldTableItem {
|
|
409
|
+
displayName: string;
|
|
410
|
+
timePeriods: string[];
|
|
411
|
+
data: Record<string, unknown>;
|
|
412
|
+
formattedData: Record<string, string>;
|
|
413
|
+
type: FileFieldTableType;
|
|
414
|
+
isNumeric: boolean;
|
|
415
|
+
}
|
|
416
|
+
interface FileFieldTableData {
|
|
417
|
+
name: string;
|
|
418
|
+
displayName: string;
|
|
419
|
+
type: FileFieldTableType;
|
|
420
|
+
items: FileFieldTableItem[];
|
|
421
|
+
hasData: boolean;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/** Returns the full display name registry (extraction column → human label). */
|
|
425
|
+
declare function getDisplayNames(): Record<string, string>;
|
|
426
|
+
/** Looks up a display name. Falls back to camelCase → Title Case conversion. */
|
|
427
|
+
declare function getDisplayName(fieldName: string): string;
|
|
428
|
+
declare function extractTimePeriods(columnNames: string[]): string[];
|
|
429
|
+
declare function groupColumnsByTimePeriod(columnNames: string[]): Record<string, Record<string, string>>;
|
|
430
|
+
declare function groupFieldsByPattern(fields: FieldData[]): Record<string, FieldData[]>;
|
|
431
|
+
declare function buildFileFieldTables(ihsData: Record<string, unknown>): Record<string, FileFieldTableData>;
|
|
432
|
+
declare function processIhsDetails(ihsData: Record<string, unknown>): IhsFieldDetail[];
|
|
433
|
+
declare function groupDetailsByCategory(details: IhsFieldDetail[]): IhsDetailCategory[];
|
|
434
|
+
|
|
435
|
+
export { BASE_FIELD_SPECS, BasicFormField, type Category, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DropdownOption, type EditorValidator, FIELD_TYPE_DEFINITIONS, type FieldData, type FieldGroup, type FieldReference, FieldType, type FileFieldTableData, type FileFieldTableItem, FileFieldTableType, FileFormField, FormField, FormFieldCategory, type FormFieldInputType, type FormFieldType, type FormFieldTypeDefinitions, FormFieldValidator, FormSpec, type FormValidatorDefinitions, type IhsDetailCategory, type IhsFieldDetail, IhsValueFormat, type PageConfig, type RHFSchemaOutput, type RHFStep, type ResolvedField, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type UnifiedFormConfig, type Validator, applyDynamicTitles, buildFileFieldTables, evaluateExpression, extractTimePeriods, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getPastMonthLabel, getPastYearLabel, getStepDefaultValues, getStepSchema, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, processIhsDetails, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -377,4 +377,59 @@ declare function getBaseCategories(): Category[];
|
|
|
377
377
|
declare function getBaseFieldSpecMap(): Map<string, FieldData>;
|
|
378
378
|
declare function getBaseFieldNames(): string[];
|
|
379
379
|
|
|
380
|
-
|
|
380
|
+
declare enum IhsValueFormat {
|
|
381
|
+
STRING = "string",
|
|
382
|
+
CURRENCY = "currency",
|
|
383
|
+
NUMBER = "number",
|
|
384
|
+
PERCENTAGE = "percentage",
|
|
385
|
+
DATE = "date",
|
|
386
|
+
TABLE = "table"
|
|
387
|
+
}
|
|
388
|
+
interface IhsFieldDetail {
|
|
389
|
+
name: string;
|
|
390
|
+
displayName: string;
|
|
391
|
+
category: string;
|
|
392
|
+
value: unknown;
|
|
393
|
+
valueFormat: IhsValueFormat;
|
|
394
|
+
}
|
|
395
|
+
interface IhsDetailCategory {
|
|
396
|
+
category: string;
|
|
397
|
+
items: {
|
|
398
|
+
name: string;
|
|
399
|
+
displayName: string;
|
|
400
|
+
value: unknown;
|
|
401
|
+
valueFormat: IhsValueFormat;
|
|
402
|
+
}[];
|
|
403
|
+
}
|
|
404
|
+
declare enum FileFieldTableType {
|
|
405
|
+
TIME_SERIES = "timeSeries",
|
|
406
|
+
KEY_VALUE = "keyValue"
|
|
407
|
+
}
|
|
408
|
+
interface FileFieldTableItem {
|
|
409
|
+
displayName: string;
|
|
410
|
+
timePeriods: string[];
|
|
411
|
+
data: Record<string, unknown>;
|
|
412
|
+
formattedData: Record<string, string>;
|
|
413
|
+
type: FileFieldTableType;
|
|
414
|
+
isNumeric: boolean;
|
|
415
|
+
}
|
|
416
|
+
interface FileFieldTableData {
|
|
417
|
+
name: string;
|
|
418
|
+
displayName: string;
|
|
419
|
+
type: FileFieldTableType;
|
|
420
|
+
items: FileFieldTableItem[];
|
|
421
|
+
hasData: boolean;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/** Returns the full display name registry (extraction column → human label). */
|
|
425
|
+
declare function getDisplayNames(): Record<string, string>;
|
|
426
|
+
/** Looks up a display name. Falls back to camelCase → Title Case conversion. */
|
|
427
|
+
declare function getDisplayName(fieldName: string): string;
|
|
428
|
+
declare function extractTimePeriods(columnNames: string[]): string[];
|
|
429
|
+
declare function groupColumnsByTimePeriod(columnNames: string[]): Record<string, Record<string, string>>;
|
|
430
|
+
declare function groupFieldsByPattern(fields: FieldData[]): Record<string, FieldData[]>;
|
|
431
|
+
declare function buildFileFieldTables(ihsData: Record<string, unknown>): Record<string, FileFieldTableData>;
|
|
432
|
+
declare function processIhsDetails(ihsData: Record<string, unknown>): IhsFieldDetail[];
|
|
433
|
+
declare function groupDetailsByCategory(details: IhsFieldDetail[]): IhsDetailCategory[];
|
|
434
|
+
|
|
435
|
+
export { BASE_FIELD_SPECS, BasicFormField, type Category, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DropdownOption, type EditorValidator, FIELD_TYPE_DEFINITIONS, type FieldData, type FieldGroup, type FieldReference, FieldType, type FileFieldTableData, type FileFieldTableItem, FileFieldTableType, FileFormField, FormField, FormFieldCategory, type FormFieldInputType, type FormFieldType, type FormFieldTypeDefinitions, FormFieldValidator, FormSpec, type FormValidatorDefinitions, type IhsDetailCategory, type IhsFieldDetail, IhsValueFormat, type PageConfig, type RHFSchemaOutput, type RHFStep, type ResolvedField, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type UnifiedFormConfig, type Validator, applyDynamicTitles, buildFileFieldTables, evaluateExpression, extractTimePeriods, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getPastMonthLabel, getPastYearLabel, getStepDefaultValues, getStepSchema, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, processIhsDetails, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
|
package/dist/index.js
CHANGED
|
@@ -9088,19 +9088,468 @@ function getBaseFieldNames() {
|
|
|
9088
9088
|
cachedFieldNames = [...new Set(names)];
|
|
9089
9089
|
return cachedFieldNames;
|
|
9090
9090
|
}
|
|
9091
|
+
|
|
9092
|
+
// src/ihs-types.ts
|
|
9093
|
+
var IhsValueFormat = /* @__PURE__ */ ((IhsValueFormat2) => {
|
|
9094
|
+
IhsValueFormat2["STRING"] = "string";
|
|
9095
|
+
IhsValueFormat2["CURRENCY"] = "currency";
|
|
9096
|
+
IhsValueFormat2["NUMBER"] = "number";
|
|
9097
|
+
IhsValueFormat2["PERCENTAGE"] = "percentage";
|
|
9098
|
+
IhsValueFormat2["DATE"] = "date";
|
|
9099
|
+
IhsValueFormat2["TABLE"] = "table";
|
|
9100
|
+
return IhsValueFormat2;
|
|
9101
|
+
})(IhsValueFormat || {});
|
|
9102
|
+
var FileFieldTableType = /* @__PURE__ */ ((FileFieldTableType2) => {
|
|
9103
|
+
FileFieldTableType2["TIME_SERIES"] = "timeSeries";
|
|
9104
|
+
FileFieldTableType2["KEY_VALUE"] = "keyValue";
|
|
9105
|
+
return FileFieldTableType2;
|
|
9106
|
+
})(FileFieldTableType || {});
|
|
9107
|
+
|
|
9108
|
+
// src/data/form-field-display-names.json
|
|
9109
|
+
var form_field_display_names_default = {
|
|
9110
|
+
accountHolderName: "Account Holder Name",
|
|
9111
|
+
statementDate: "Statement Date",
|
|
9112
|
+
bankName: "Bank Name",
|
|
9113
|
+
accountNumber: "Account Number",
|
|
9114
|
+
totalCredits: "Total Credits",
|
|
9115
|
+
totalDebits: "Total Debits",
|
|
9116
|
+
openingBalance: "Opening Balance",
|
|
9117
|
+
bankBalance: "Bank Balance",
|
|
9118
|
+
nonCurrentAssetsSubsidiaryCompanies: "Subsidiary Companies (Non-Current Assets)",
|
|
9119
|
+
nonCurrentAssetsAssociatedCompanies: "Associated Companies (Non-Current Assets)",
|
|
9120
|
+
nonCurrentAssetsDevelopmentPropertiesOrExpenditure: "Development Properties/Expenditure (Non-Current Assets)",
|
|
9121
|
+
nonCurrentAssetInvestmentProperties: "Investment Properties (Non-Current Assets)",
|
|
9122
|
+
nonCurrentAssetsInvestments: "Investments (Non-Current Assets)",
|
|
9123
|
+
nonCurrentAssetInvestmentSecurities: "Investment Securities (Non-Current Assets)",
|
|
9124
|
+
nonCurrentAssetDeferredAssets: "Deferred Assets (Non-Current Assets)",
|
|
9125
|
+
nonCurrentAssetDeposits: "Deposits (Non-Current Assets)",
|
|
9126
|
+
nonCurrentAssetOwnGoodwill: "Own Goodwill (Non-Current Assets)",
|
|
9127
|
+
nonCurrentAssetGoodwillOnConsolidation: "Goodwill on Consolidation (Non-Current Assets)",
|
|
9128
|
+
nonCurrentAssetSinkingFund: "Sinking Fund (Non-Current Assets)",
|
|
9129
|
+
nonCurrentAssetPropertyPlantEquipment: "Property, Plant & Equipment (Non-Current Assets)",
|
|
9130
|
+
nonCurrentAssetInventories: "Inventories (Non-Current Assets)",
|
|
9131
|
+
nonCurrentAssetRightOfUseAssets: "Right of Use Assets (Non-Current Assets)",
|
|
9132
|
+
nonCurrentAssetIntangibleAssets: "Intangible Assets (Non-Current Assets)",
|
|
9133
|
+
nonCurrentAssetPrepaidLeasePayments: "Prepaid Lease Payments (Non-Current Assets)",
|
|
9134
|
+
nonCurrentAssetFinancialAssetAtFairValue: "Financial Assets at Fair Value (Non-Current Assets)",
|
|
9135
|
+
nonCurrentAssetLandUseRight: "Land Use Rights (Non-Current Assets)",
|
|
9136
|
+
nonCurrentAssetTradeReceivables: "Trade Receivables (Non-Current Assets)",
|
|
9137
|
+
nonCurrentAssetOtherReceivables: "Other Receivables (Non-Current Assets)",
|
|
9138
|
+
nonCurrentAssetTradeAndOtherReceivables: "Trade and Other Receivables (Non-Current Assets)",
|
|
9139
|
+
nonCurrentAssetOtherReceivablesDepositsAndPrepayments: "Other Receivables, Deposits and Prepayments (Non-Current Assets)",
|
|
9140
|
+
totalNonCurrentAssets: "Total Non-Current Assets",
|
|
9141
|
+
currentAssetDevelopmentPropertiesOrExpenditure: "Development Properties/Expenditure (Current Assets)",
|
|
9142
|
+
currentAssetShortTermInvestments: "Short Term Investments (Current Assets)",
|
|
9143
|
+
currentAssetTradeDebtors: "Trade Debtors (Current Assets)",
|
|
9144
|
+
currentAssetShortTermDeposits: "Short Term Deposits (Current Assets)",
|
|
9145
|
+
currentAssetAmountDueFromHoldingCompany: "Amount Due from Holding Company (Current Assets)",
|
|
9146
|
+
currentAssetAmountDueFromSubsidiaryCompanies: "Amount Due from Subsidiary Companies (Current Assets)",
|
|
9147
|
+
currentAssetAmountDueFromAssociatedCompanies: "Amount Due from Associated Companies (Current Assets)",
|
|
9148
|
+
currentAssetAmountDueFromDirector: "Amount Due from Director (Current Assets)",
|
|
9149
|
+
currentAssetAmountDueFromCustomer: "Amount Due from Customer (Current Assets)",
|
|
9150
|
+
currentAssetAmountOwingByShareholders: "Amount Owing by Shareholders (Current Assets)",
|
|
9151
|
+
currentAssetInventories: "Inventories (Current Assets)",
|
|
9152
|
+
currentAssetFinancialAssetAtFairValue: "Financial Assets at Fair Value (Current Assets)",
|
|
9153
|
+
currentAssetLandUseRight: "Land Use Rights (Current Assets)",
|
|
9154
|
+
currentAssetTaxRecoverable: "Tax Recoverable (Current Assets)",
|
|
9155
|
+
currentAssetContractAssets: "Contract Assets (Current Assets)",
|
|
9156
|
+
currentAssetCurrentTaxAssets: "Current Tax Assets (Current Assets)",
|
|
9157
|
+
currentAssetPrepayments: "Prepayments (Current Assets)",
|
|
9158
|
+
currentAssetDerivative: "Derivatives (Current Assets)",
|
|
9159
|
+
currentAssetCashAndBankBalances: "Cash and Bank Balances (Current Assets)",
|
|
9160
|
+
currentAssetOtherReceivables: "Other Receivables (Current Assets)",
|
|
9161
|
+
currentAssetRestrictedCash: "Restricted Cash (Current Assets)",
|
|
9162
|
+
currentAssetCashAndCashEquivalents: "Cash and Cash Equivalents (Current Assets)",
|
|
9163
|
+
currentAssetDepositsCashAndBankBalances: "Deposits, Cash and Bank Balances (Current Assets)",
|
|
9164
|
+
currentAssetCashAtBanks: "Cash at Banks (Current Assets)",
|
|
9165
|
+
currentAssetCashOnHand: "Cash on Hand (Current Assets)",
|
|
9166
|
+
currentAssetDepositsAndPrepayments: "Deposits and Prepayments (Current Assets)",
|
|
9167
|
+
currentAssetTradeAndOtherReceivables: "Trade and Other Receivables (Current Assets)",
|
|
9168
|
+
currentAssetOtherReceivablesDepositsAndPrepayments: "Other Receivables, Deposits and Prepayments (Current Assets)",
|
|
9169
|
+
currentAssetOtherReceivablesAndDeposits: "Other Receivables and Deposits (Current Assets)",
|
|
9170
|
+
currentAssetOtherReceivablesAndPrepayments: "Other Receivables and Prepayments (Current Assets)",
|
|
9171
|
+
currentAssetCash: "Cash (Current Assets)",
|
|
9172
|
+
totalCurrentAssets: "Total Current Assets",
|
|
9173
|
+
totalAssets: "Total Assets",
|
|
9174
|
+
currentLiabilitiesTradeCreditors: "Trade Creditors (Current Liabilities)",
|
|
9175
|
+
currentLiabilitiesHirePurchasePayables: "Hire Purchase Payables (Current Liabilities)",
|
|
9176
|
+
currentLiabilitiesBankOverdraft: "Bank Overdraft (Current Liabilities)",
|
|
9177
|
+
currentLiabilitiesBankAcceptance: "Bank Acceptance (Current Liabilities)",
|
|
9178
|
+
currentLiabilitiesBorrowingsOrTermLoans: "Borrowings/Term Loans (Current Liabilities)",
|
|
9179
|
+
currentLiabilitiesBankborrowings: "Bank Borrowings (Current Liabilities)",
|
|
9180
|
+
currentLiabilitiesAmountsOwingToHoldingCompany: "Amounts Owing to Holding Company (Current Liabilities)",
|
|
9181
|
+
currentLiabilitiesAmountsOwingToSubsidiaryCompanies: "Amounts Owing to Subsidiary Companies (Current Liabilities)",
|
|
9182
|
+
currentLiabilitiesAmountOwingToAssociatedCompanies: "Amount Owing to Associated Companies (Current Liabilities)",
|
|
9183
|
+
currentLiabilitiesAmountsOwingToDirector: "Amounts Owing to Director (Current Liabilities)",
|
|
9184
|
+
currentLiabilitiesProvisionForTaxation: "Provision for Taxation (Current Liabilities)",
|
|
9185
|
+
currentLiabilitiesLeasePayables: "Lease Payables (Current Liabilities)",
|
|
9186
|
+
currentLiabilitiesFinanceLeasePayables: "Finance Lease Payables (Current Liabilities)",
|
|
9187
|
+
currentLiabilitiesOtherPayables: "Other Payables (Current Liabilities)",
|
|
9188
|
+
currentLiabilitiesDividendPayables: "Dividend Payables (Current Liabilities)",
|
|
9189
|
+
currentLiabilitiesTradeAndOtherPayables: "Trade and Other Payables (Current Liabilities)",
|
|
9190
|
+
currentLiabilitiesDepositsFromCustomers: "Deposits from Customers (Current Liabilities)",
|
|
9191
|
+
currentLiabilitiesOtherPayablesAccrualsAndDeposits: "Other Payables, Accruals and Deposits (Current Liabilities)",
|
|
9192
|
+
currentLiabilitiesOtherPayablesAndAccruals: "Other Payables and Accruals (Current Liabilities)",
|
|
9193
|
+
currentLiabilitiesContractLiabilities: "Contract Liabilities (Current Liabilities)",
|
|
9194
|
+
currentLiabilitiesDerivative: "Derivative Liabilities (Current Liabilities)",
|
|
9195
|
+
totalCurrentLiabilities: "Total Current Liabilities",
|
|
9196
|
+
shortTermLiabilities: "Short Term Liabilities",
|
|
9197
|
+
nonCurrentLiabilitiesBorrowingsOrTermLoans: "Borrowings/Term Loans (Non-Current Liabilities)",
|
|
9198
|
+
nonCurrentLiabilitiesBankBorrowings: "Bank Borrowings (Non-Current Liabilities)",
|
|
9199
|
+
nonCurrentLiabilitiesLeaseObligations: "Lease Obligations (Non-Current Liabilities)",
|
|
9200
|
+
nonCurrentLiabilitiesFinanceLeaseObligations: "Finance Lease Obligations (Non-Current Liabilities)",
|
|
9201
|
+
nonCurrentLiabilitiesDeferredTaxation: "Deferred Taxation (Non-Current Liabilities)",
|
|
9202
|
+
nonCurrentLiabilitiesRetirementBenefits: "Retirement Benefits (Non-Current Liabilities)",
|
|
9203
|
+
nonCurrentLiabilitiesHirePurchasePayables: "Hire Purchase Payables (Non-Current Liabilities)",
|
|
9204
|
+
nonCurrentLiabilitiesDepositsFromCustomers: "Deposits from Customers (Non-Current Liabilities)",
|
|
9205
|
+
nonCurrentLiabilitiesContractLiabilities: "Contract Liabilities (Non-Current Liabilities)",
|
|
9206
|
+
totalNonCurrentLiabilities: "Total Non-Current Liabilities",
|
|
9207
|
+
totalLiabilities: "Total Liabilities",
|
|
9208
|
+
tangibleAssets: "Tangible Assets",
|
|
9209
|
+
shareCapital: "Share Capital",
|
|
9210
|
+
preferenceShareCapital: "Preference Share Capital",
|
|
9211
|
+
sharePremium: "Share Premium",
|
|
9212
|
+
reserves: "Reserves",
|
|
9213
|
+
capitalReserves: "Capital Reserves",
|
|
9214
|
+
revaluationReserves: "Revaluation Reserves",
|
|
9215
|
+
exchangeEqualisationOrFluctuationReserves: "Exchange Equalisation/Fluctuation Reserves",
|
|
9216
|
+
retainedEarnings: "Retained Earnings",
|
|
9217
|
+
totalEquity: "Total Equity",
|
|
9218
|
+
revenue: "Revenue",
|
|
9219
|
+
costOfGoodsSold: "Cost of Goods Sold",
|
|
9220
|
+
grossProfit: "Gross Profit",
|
|
9221
|
+
otherIncome: "Other Income",
|
|
9222
|
+
profitFromOperations: "Profit from Operations",
|
|
9223
|
+
financeCost: "Finance Cost",
|
|
9224
|
+
ebitda: "Profit Before Tax",
|
|
9225
|
+
taxes: "Taxes",
|
|
9226
|
+
zakat: "Zakat",
|
|
9227
|
+
profitAfterTax: "Profit After Tax",
|
|
9228
|
+
netProfit: "Net Profit",
|
|
9229
|
+
netOperatingCashFlow: "Net Operating Cash Flow",
|
|
9230
|
+
depreciation: "Depreciation",
|
|
9231
|
+
depreciationOfPropertyPlantEquipment: "Depreciation of Property, Plant & Equipment",
|
|
9232
|
+
depreciationRightOfUseAssets: "Depreciation of Right of Use Assets",
|
|
9233
|
+
depreciationOfInvestmentProperties: "Depreciation of Investment Properties",
|
|
9234
|
+
depreciationOfInvestmentSecurities: "Depreciation of Investment Securities",
|
|
9235
|
+
endOfYearCash: "End of Year Cash",
|
|
9236
|
+
epfAccountHolderName: "Account Holder Name",
|
|
9237
|
+
epfAccountHolderAddress: "Account Holder Address",
|
|
9238
|
+
epfStatementYear: "Statement Year",
|
|
9239
|
+
epfKwspMemberNumber: "KWSP Member Number",
|
|
9240
|
+
epfIcNumber: "IC No.",
|
|
9241
|
+
epfEmployerNumber: "Employer Number",
|
|
9242
|
+
epfDateOfStatement: "Date Of Statement",
|
|
9243
|
+
epfTotalContribution: "Total Contribution",
|
|
9244
|
+
epfTotalCurrentContribution: "Total Current Contribution",
|
|
9245
|
+
payslipEmployerName: "Employer Name",
|
|
9246
|
+
payslipEmployeeName: "Employee Name",
|
|
9247
|
+
payslipPayPeriod: "Pay Period",
|
|
9248
|
+
payslipPayDate: "Pay Date",
|
|
9249
|
+
payslipGrossPay: "Gross Pay",
|
|
9250
|
+
payslipDeduction: "Deduction",
|
|
9251
|
+
payslipEmployeeEpfContribution: "Employee EPF Contribution",
|
|
9252
|
+
payslipEmployeeSocsoContribution: "Employee SOCSO Contribution",
|
|
9253
|
+
payslipNetPay: "Net Pay",
|
|
9254
|
+
incorporatedDate: "Incorporated Date",
|
|
9255
|
+
companyName: "Company Name",
|
|
9256
|
+
companyRegNo: "Company Registration No.",
|
|
9257
|
+
ssmCompanyName: "Company Name (SSM)",
|
|
9258
|
+
ssmCompanyRegNo: "Registration No. (SSM)",
|
|
9259
|
+
ssmIncorporatedDate: "Incorporated Date (SSM)",
|
|
9260
|
+
businessCommencementDate: "Business Commencement Date",
|
|
9261
|
+
businessNature: "Business Nature",
|
|
9262
|
+
companyStatus: "Company Status",
|
|
9263
|
+
shareholders: "Shareholders",
|
|
9264
|
+
directors: "Directors",
|
|
9265
|
+
previousDirectors: "Previous Directors",
|
|
9266
|
+
totalShareIssued: "Total Shares Issued",
|
|
9267
|
+
companyLastOldName: "Previous Company Name",
|
|
9268
|
+
companyNameDateOfChange: "Company Name Change Date",
|
|
9269
|
+
businessOrigin: "Business Origin",
|
|
9270
|
+
registeredAddress: "Registered Address",
|
|
9271
|
+
icName: "Name (IC)",
|
|
9272
|
+
icNumber: "IC Number",
|
|
9273
|
+
icAddress: "Address (IC)",
|
|
9274
|
+
icGender: "Gender (IC)",
|
|
9275
|
+
icReligion: "Religion (IC)",
|
|
9276
|
+
icDateOfBirth: "Date of Birth (IC)",
|
|
9277
|
+
icPlaceOfBirth: "Place of Birth (IC)",
|
|
9278
|
+
icNationality: "Nationality (IC)",
|
|
9279
|
+
icRace: "Race (IC)"
|
|
9280
|
+
};
|
|
9281
|
+
|
|
9282
|
+
// src/ihs-processing.ts
|
|
9283
|
+
var displayNames = form_field_display_names_default;
|
|
9284
|
+
function getDisplayNames() {
|
|
9285
|
+
return displayNames;
|
|
9286
|
+
}
|
|
9287
|
+
function getDisplayName(fieldName) {
|
|
9288
|
+
if (displayNames[fieldName]) return displayNames[fieldName];
|
|
9289
|
+
return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase()).trim();
|
|
9290
|
+
}
|
|
9291
|
+
var TIME_PERIOD_REGEX = /T(\d+)$/;
|
|
9292
|
+
function extractTimePeriods(columnNames) {
|
|
9293
|
+
const periods = /* @__PURE__ */ new Set();
|
|
9294
|
+
for (const col of columnNames) {
|
|
9295
|
+
const match = TIME_PERIOD_REGEX.exec(col);
|
|
9296
|
+
if (match) periods.add(`T${match[1]}`);
|
|
9297
|
+
}
|
|
9298
|
+
return [...periods].sort((a, b) => {
|
|
9299
|
+
const numA = parseInt(a.slice(1), 10);
|
|
9300
|
+
const numB = parseInt(b.slice(1), 10);
|
|
9301
|
+
return numA - numB;
|
|
9302
|
+
});
|
|
9303
|
+
}
|
|
9304
|
+
function groupColumnsByTimePeriod(columnNames) {
|
|
9305
|
+
const groups = {};
|
|
9306
|
+
for (const col of columnNames) {
|
|
9307
|
+
const match = /^(.+?)(T\d+)$/.exec(col);
|
|
9308
|
+
if (!match) continue;
|
|
9309
|
+
const [, baseName, period] = match;
|
|
9310
|
+
if (!groups[baseName]) groups[baseName] = {};
|
|
9311
|
+
groups[baseName][period] = col;
|
|
9312
|
+
}
|
|
9313
|
+
return groups;
|
|
9314
|
+
}
|
|
9315
|
+
var FIELD_GROUP_PREFIXES = [
|
|
9316
|
+
["bank_statement", "bank_statements"],
|
|
9317
|
+
["financials", "financials"],
|
|
9318
|
+
["epf_statement", "epf_statements"],
|
|
9319
|
+
["payslip_statement", "payslip_statements"],
|
|
9320
|
+
["ssm", "ssm_documents"],
|
|
9321
|
+
["ic_", "ic_documents"]
|
|
9322
|
+
];
|
|
9323
|
+
function groupFieldsByPattern(fields) {
|
|
9324
|
+
const groups = {};
|
|
9325
|
+
for (const field of fields) {
|
|
9326
|
+
if (!field.name) continue;
|
|
9327
|
+
let groupName = field.name;
|
|
9328
|
+
for (const [prefix, group] of FIELD_GROUP_PREFIXES) {
|
|
9329
|
+
if (field.name.startsWith(prefix)) {
|
|
9330
|
+
groupName = group;
|
|
9331
|
+
break;
|
|
9332
|
+
}
|
|
9333
|
+
}
|
|
9334
|
+
if (!groups[groupName]) groups[groupName] = [];
|
|
9335
|
+
groups[groupName].push(field);
|
|
9336
|
+
}
|
|
9337
|
+
return groups;
|
|
9338
|
+
}
|
|
9339
|
+
var GROUP_DISPLAY_NAMES = {
|
|
9340
|
+
bank_statements: "Bank Statements",
|
|
9341
|
+
financials: "Audited Financial Statements",
|
|
9342
|
+
epf_statements: "EPF Statements",
|
|
9343
|
+
payslip_statements: "Payslip Statements",
|
|
9344
|
+
ssm_documents: "SSM Company Information",
|
|
9345
|
+
ic_documents: "Identification Card"
|
|
9346
|
+
};
|
|
9347
|
+
function isNumericField(fieldName) {
|
|
9348
|
+
const patterns = [
|
|
9349
|
+
"balance",
|
|
9350
|
+
"amount",
|
|
9351
|
+
"credit",
|
|
9352
|
+
"debit",
|
|
9353
|
+
"total",
|
|
9354
|
+
"revenue",
|
|
9355
|
+
"cost",
|
|
9356
|
+
"income",
|
|
9357
|
+
"expense",
|
|
9358
|
+
"liability",
|
|
9359
|
+
"asset",
|
|
9360
|
+
"equity",
|
|
9361
|
+
"profit",
|
|
9362
|
+
"loss",
|
|
9363
|
+
"cash",
|
|
9364
|
+
"tax",
|
|
9365
|
+
"interest"
|
|
9366
|
+
];
|
|
9367
|
+
const lower = fieldName.toLowerCase();
|
|
9368
|
+
return patterns.some((p) => lower.includes(p));
|
|
9369
|
+
}
|
|
9370
|
+
function formatValue(value, numeric) {
|
|
9371
|
+
if (value === null || value === void 0 || value === "") return "-";
|
|
9372
|
+
if (numeric) {
|
|
9373
|
+
const num = Number(value);
|
|
9374
|
+
if (!isNaN(num))
|
|
9375
|
+
return num.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
9376
|
+
}
|
|
9377
|
+
return String(value);
|
|
9378
|
+
}
|
|
9379
|
+
function buildTableForGroup(groupName, fields, ihsData) {
|
|
9380
|
+
const allColumns = [];
|
|
9381
|
+
for (const field of fields) {
|
|
9382
|
+
if (field.ihs_column_names) {
|
|
9383
|
+
allColumns.push(...field.ihs_column_names);
|
|
9384
|
+
}
|
|
9385
|
+
}
|
|
9386
|
+
if (allColumns.length === 0) return null;
|
|
9387
|
+
const periods = extractTimePeriods(allColumns);
|
|
9388
|
+
const isTimeSeries = periods.length > 0;
|
|
9389
|
+
const tableType = isTimeSeries ? "timeSeries" /* TIME_SERIES */ : "keyValue" /* KEY_VALUE */;
|
|
9390
|
+
const groupDisplayName = GROUP_DISPLAY_NAMES[groupName] || fields[0]?.displayName || getDisplayName(groupName);
|
|
9391
|
+
if (isTimeSeries) {
|
|
9392
|
+
const columnGroups = groupColumnsByTimePeriod(allColumns);
|
|
9393
|
+
const items = [];
|
|
9394
|
+
for (const [baseName, periodMap] of Object.entries(columnGroups)) {
|
|
9395
|
+
const numeric = isNumericField(baseName);
|
|
9396
|
+
const data = {};
|
|
9397
|
+
const formattedData = {};
|
|
9398
|
+
for (const period of periods) {
|
|
9399
|
+
const colName = periodMap[period];
|
|
9400
|
+
const value = colName ? ihsData[colName] ?? null : null;
|
|
9401
|
+
data[period] = value;
|
|
9402
|
+
formattedData[period] = formatValue(value, numeric);
|
|
9403
|
+
}
|
|
9404
|
+
items.push({
|
|
9405
|
+
displayName: getDisplayName(baseName),
|
|
9406
|
+
timePeriods: periods,
|
|
9407
|
+
data,
|
|
9408
|
+
formattedData,
|
|
9409
|
+
type: tableType,
|
|
9410
|
+
isNumeric: numeric
|
|
9411
|
+
});
|
|
9412
|
+
}
|
|
9413
|
+
const hasData = items.some(
|
|
9414
|
+
(item) => Object.values(item.data).some((v) => v !== null && v !== void 0 && v !== "")
|
|
9415
|
+
);
|
|
9416
|
+
return { name: groupName, displayName: groupDisplayName, type: tableType, items, hasData };
|
|
9417
|
+
} else {
|
|
9418
|
+
const items = [];
|
|
9419
|
+
for (const colName of allColumns) {
|
|
9420
|
+
const value = ihsData[colName] ?? null;
|
|
9421
|
+
const numeric = isNumericField(colName);
|
|
9422
|
+
items.push({
|
|
9423
|
+
displayName: getDisplayName(colName),
|
|
9424
|
+
timePeriods: [],
|
|
9425
|
+
data: { value },
|
|
9426
|
+
formattedData: { value: formatValue(value, numeric) },
|
|
9427
|
+
type: tableType,
|
|
9428
|
+
isNumeric: numeric
|
|
9429
|
+
});
|
|
9430
|
+
}
|
|
9431
|
+
const hasData = items.some((item) => {
|
|
9432
|
+
const v = item.data["value"];
|
|
9433
|
+
return v !== null && v !== void 0 && v !== "";
|
|
9434
|
+
});
|
|
9435
|
+
return { name: groupName, displayName: groupDisplayName, type: tableType, items, hasData };
|
|
9436
|
+
}
|
|
9437
|
+
}
|
|
9438
|
+
function buildFileFieldTables(ihsData) {
|
|
9439
|
+
const specs = getBaseFieldSpecs();
|
|
9440
|
+
const fileFields = specs.filter((f) => f.type === "file" && f.ihs_column_names?.length);
|
|
9441
|
+
const grouped = groupFieldsByPattern(fileFields);
|
|
9442
|
+
const tables = {};
|
|
9443
|
+
for (const [groupName, fields] of Object.entries(grouped)) {
|
|
9444
|
+
const table = buildTableForGroup(groupName, fields, ihsData);
|
|
9445
|
+
if (table && table.hasData) {
|
|
9446
|
+
tables[groupName] = table;
|
|
9447
|
+
}
|
|
9448
|
+
}
|
|
9449
|
+
return tables;
|
|
9450
|
+
}
|
|
9451
|
+
function isFileOrFinancialColumn(fieldName, fileColumnSet) {
|
|
9452
|
+
return fileColumnSet.has(fieldName) || fieldName.startsWith("financials") || fieldName.startsWith("bank_statement");
|
|
9453
|
+
}
|
|
9454
|
+
function inferValueFormat(fieldName, value) {
|
|
9455
|
+
const currencyFields = /* @__PURE__ */ new Set([
|
|
9456
|
+
"totalFinancing",
|
|
9457
|
+
"monthlyGrossIncome",
|
|
9458
|
+
"approvedAmount",
|
|
9459
|
+
"monthlyInstallment"
|
|
9460
|
+
]);
|
|
9461
|
+
if (currencyFields.has(fieldName)) return "currency" /* CURRENCY */;
|
|
9462
|
+
const numberFields = /* @__PURE__ */ new Set([
|
|
9463
|
+
"age",
|
|
9464
|
+
"noOfDependants",
|
|
9465
|
+
"financingTenure",
|
|
9466
|
+
"ihsId",
|
|
9467
|
+
"programId",
|
|
9468
|
+
"borrowerAgentId"
|
|
9469
|
+
]);
|
|
9470
|
+
if (numberFields.has(fieldName)) return "number" /* NUMBER */;
|
|
9471
|
+
const tableFields = /* @__PURE__ */ new Set(["shareholders", "directors", "previousDirectors"]);
|
|
9472
|
+
if (tableFields.has(fieldName)) return "table" /* TABLE */;
|
|
9473
|
+
if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}/.test(value)) return "date" /* DATE */;
|
|
9474
|
+
return "string" /* STRING */;
|
|
9475
|
+
}
|
|
9476
|
+
var EXCLUDED_FIELDS = /* @__PURE__ */ new Set([
|
|
9477
|
+
"updatedAt",
|
|
9478
|
+
"programIds",
|
|
9479
|
+
"borrowerAgentId",
|
|
9480
|
+
"programId",
|
|
9481
|
+
"__v",
|
|
9482
|
+
"_id",
|
|
9483
|
+
"id"
|
|
9484
|
+
]);
|
|
9485
|
+
function processIhsDetails(ihsData) {
|
|
9486
|
+
const specs = getBaseFieldSpecs();
|
|
9487
|
+
const fileColumnSet = /* @__PURE__ */ new Set();
|
|
9488
|
+
for (const field of specs) {
|
|
9489
|
+
if (field.type === "file" && field.ihs_column_names) {
|
|
9490
|
+
for (const col of field.ihs_column_names) {
|
|
9491
|
+
fileColumnSet.add(col);
|
|
9492
|
+
}
|
|
9493
|
+
}
|
|
9494
|
+
}
|
|
9495
|
+
const specMap = getBaseFieldSpecMap();
|
|
9496
|
+
const categories = getBaseCategories();
|
|
9497
|
+
const categoryNameMap = {};
|
|
9498
|
+
for (const cat of categories) {
|
|
9499
|
+
categoryNameMap[String(cat.id)] = cat.name;
|
|
9500
|
+
}
|
|
9501
|
+
const details = [];
|
|
9502
|
+
for (const [key, value] of Object.entries(ihsData)) {
|
|
9503
|
+
if (value === null || value === void 0 || value === "" || value === "Not Specified") continue;
|
|
9504
|
+
if (value === false) continue;
|
|
9505
|
+
if (EXCLUDED_FIELDS.has(key)) continue;
|
|
9506
|
+
if (isFileOrFinancialColumn(key, fileColumnSet)) continue;
|
|
9507
|
+
const spec = specMap.get(key);
|
|
9508
|
+
const categoryId = spec?.category ? String(spec.category) : "0";
|
|
9509
|
+
const category = categoryNameMap[categoryId] || "General";
|
|
9510
|
+
details.push({
|
|
9511
|
+
name: key,
|
|
9512
|
+
displayName: getDisplayName(key),
|
|
9513
|
+
category,
|
|
9514
|
+
value,
|
|
9515
|
+
valueFormat: inferValueFormat(key, value)
|
|
9516
|
+
});
|
|
9517
|
+
}
|
|
9518
|
+
return details;
|
|
9519
|
+
}
|
|
9520
|
+
function groupDetailsByCategory(details) {
|
|
9521
|
+
const groups = {};
|
|
9522
|
+
for (const detail of details) {
|
|
9523
|
+
if (!groups[detail.category]) groups[detail.category] = [];
|
|
9524
|
+
groups[detail.category].push(detail);
|
|
9525
|
+
}
|
|
9526
|
+
return Object.entries(groups).filter(([cat]) => cat !== "Default Category" && cat !== "General").map(([category, items]) => ({
|
|
9527
|
+
category,
|
|
9528
|
+
items: items.map((d) => ({
|
|
9529
|
+
name: d.name,
|
|
9530
|
+
displayName: d.displayName,
|
|
9531
|
+
value: d.value,
|
|
9532
|
+
valueFormat: d.valueFormat
|
|
9533
|
+
}))
|
|
9534
|
+
}));
|
|
9535
|
+
}
|
|
9091
9536
|
export {
|
|
9092
9537
|
BASE_FIELD_SPECS,
|
|
9093
9538
|
BasicFormField,
|
|
9094
9539
|
DEFAULT_VALIDATOR_DEFINITIONS,
|
|
9095
9540
|
FIELD_TYPE_DEFINITIONS,
|
|
9096
9541
|
FieldType,
|
|
9542
|
+
FileFieldTableType,
|
|
9097
9543
|
FileFormField,
|
|
9098
9544
|
FormField,
|
|
9099
9545
|
FormFieldCategory,
|
|
9100
9546
|
FormFieldValidator,
|
|
9101
9547
|
FormSpec,
|
|
9548
|
+
IhsValueFormat,
|
|
9102
9549
|
applyDynamicTitles,
|
|
9550
|
+
buildFileFieldTables,
|
|
9103
9551
|
evaluateExpression,
|
|
9552
|
+
extractTimePeriods,
|
|
9104
9553
|
generateRHFSchema,
|
|
9105
9554
|
generateSurveyJson,
|
|
9106
9555
|
getBaseCategories,
|
|
@@ -9108,11 +9557,17 @@ export {
|
|
|
9108
9557
|
getBaseFieldSpecMap,
|
|
9109
9558
|
getBaseFieldSpecs,
|
|
9110
9559
|
getCategoryName,
|
|
9560
|
+
getDisplayName,
|
|
9561
|
+
getDisplayNames,
|
|
9111
9562
|
getPastMonthLabel,
|
|
9112
9563
|
getPastYearLabel,
|
|
9113
9564
|
getStepDefaultValues,
|
|
9114
9565
|
getStepSchema,
|
|
9566
|
+
groupColumnsByTimePeriod,
|
|
9567
|
+
groupDetailsByCategory,
|
|
9115
9568
|
groupFieldsByCategory,
|
|
9569
|
+
groupFieldsByPattern,
|
|
9570
|
+
processIhsDetails,
|
|
9116
9571
|
resolvePageFields,
|
|
9117
9572
|
validateFormConfig,
|
|
9118
9573
|
validateFormSpec,
|