@mcurros2/microm 1.1.390-0 → 1.1.392-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/index.d.ts CHANGED
@@ -19,14 +19,14 @@ export type ValuesRecord = Value[];
19
19
  export interface MicroMRequestOptions {
20
20
  keepalive?: boolean;
21
21
  }
22
- export interface ImportDataMapping {
22
+ export interface FileImportColumnMapping {
23
23
  SourceHeader: string | null;
24
24
  SourceIndex: number | null;
25
25
  DestinationColumnName: string;
26
26
  }
27
- export interface ExcelImportMapping {
27
+ export interface FileImportMapping {
28
28
  SheetName: string | null;
29
- Mapping: ImportDataMapping[];
29
+ Mapping: FileImportColumnMapping[];
30
30
  }
31
31
  export type SQLType = 'char' | 'nchar' | 'varchar' | 'nvarchar' | 'text' | 'ntext' | 'tinyint' | 'smallint' | 'int' | 'bigint' | 'float' | 'decimal' | 'real' | 'bit' | 'money' | 'datetime2' | 'datetime' | 'smalldatetime' | 'date' | 'binary' | 'varbinary' | 'image' | 'time';
32
32
  export interface DataResult {
@@ -49,7 +49,7 @@ export interface DBStatusResult {
49
49
  AutonumReturned: boolean;
50
50
  Results: DBStatus[];
51
51
  }
52
- export function isDBStatusResult(data: any): data is DBStatusResult;
52
+ export function isDBStatusResult(data: unknown): data is DBStatusResult;
53
53
  export function isIn<T>(value: T, ...params: T[]): boolean;
54
54
  export function isPromise<T>(obj: unknown): obj is Promise<T>;
55
55
  export function createKeysSet<T>(): Set<keyof T>;
@@ -500,6 +500,7 @@ export interface StepperFormStep {
500
500
  nextStepLabel?: string;
501
501
  nextStepValidLabel?: string;
502
502
  nextStepValidation?: () => boolean | Promise<boolean>;
503
+ allowStepSelect?: boolean;
503
504
  icon?: ReactNode;
504
505
  }
505
506
  export interface StepperFormProps extends EntityFormProps {
@@ -509,10 +510,11 @@ export interface StepperFormProps extends EntityFormProps {
509
510
  initialStep: number;
510
511
  nextStepLabel?: string;
511
512
  prevStepLabel?: string;
512
- allowStepClickForward?: boolean;
513
513
  completedContent?: ReactNode;
514
514
  hideNextAndBackWhenCompleted?: boolean;
515
515
  onCompleted?: () => void;
516
+ onCancelSubmit?: () => void | Promise<void>;
517
+ cancelSubmitLabel?: ReactNode;
516
518
  stepperProps?: Omit<Partial<StepperProps>, 'children' | 'active'>;
517
519
  }
518
520
  export const StepperFormDefaultProps: Partial<StepperFormProps>;
@@ -1242,7 +1244,7 @@ export class EntityAPI {
1242
1244
  /**
1243
1245
  * Import data
1244
1246
  */
1245
- importData(abort_signal: (AbortSignal | null) | undefined, import_procname: (string | null) | undefined, parentKeys: (ValuesObject | null) | undefined, fileprocess_id: string, excelImportMapping?: ExcelImportMapping, initialRow?: number): Promise<ImpDataResult>;
1247
+ importData(abort_signal: (AbortSignal | null) | undefined, import_procname: (string | null) | undefined, parentKeys: (ValuesObject | null) | undefined, fileprocess_id: string, fileImportMapping?: FileImportMapping, initialRow?: number): Promise<ImpDataResult>;
1246
1248
  executeView(view: EntityView, view_parms?: ValuesObject, limit?: string | null, search?: string[] | null, abort_signal?: AbortSignal | null): Promise<DataResult[]>;
1247
1249
  downloadBlobFile(blob: Blob, filename: string): void;
1248
1250
  exportView(view: EntityView, view_parms?: ValuesObject, limit?: string | null, search?: string[] | null, abort_signal?: AbortSignal | null): Promise<Blob>;
@@ -1621,25 +1623,72 @@ export function useLocaleFormat(props: UseLocaleFormatProps): {
1621
1623
  getNativeValue: (value: Value, sqlType: SQLType) => Value;
1622
1624
  formatColumnValue: (col: EntityColumn<Value>) => string;
1623
1625
  };
1624
- export interface ExcelImportMappingEditorProps {
1625
- file: File;
1626
+ export interface ImportFileSheet {
1627
+ name: string | null;
1628
+ rows: string[][];
1629
+ }
1630
+ export interface ParsedImportFile {
1631
+ format: 'csv' | 'xls' | 'xlsx';
1632
+ sheets: ImportFileSheet[];
1633
+ }
1634
+ export function getImportFileExtension(file: File): string;
1635
+ export function parseCSVRows(text: string): string[][];
1636
+ export function parseImportFile(file: File): Promise<ParsedImportFile>;
1637
+ export interface ImportDataMappingRow {
1638
+ SourceHeader: string;
1639
+ SourceIndex: number;
1640
+ DestinationColumnName: string | null;
1641
+ }
1642
+ export interface ImportDataMappingState {
1643
+ mapping: FileImportMapping;
1644
+ initialRow: number;
1645
+ isValid: boolean;
1646
+ isSuccessful: boolean;
1647
+ sourceColumnCount: number;
1648
+ mappedColumnCount: number;
1649
+ ignoredSourceColumns: string[];
1650
+ omittedRequiredDestinations: string[];
1651
+ }
1652
+ export interface UseImportDataMappingProps {
1626
1653
  destinations: readonly string[];
1627
- onChange: (mapping: ExcelImportMapping | undefined, initialRow: number) => void;
1654
+ requiredDestinations: readonly string[];
1628
1655
  initialRow?: number;
1629
1656
  sampleRowCount?: number;
1657
+ fileErrorLabel?: string;
1658
+ }
1659
+ export interface ImportDataMappingAPI {
1660
+ parsedFile?: ParsedImportFile;
1661
+ sheetName: string;
1662
+ headerRow: number;
1663
+ mappingRows: ImportDataMappingRow[];
1664
+ sampleRows: string[][];
1665
+ mappingState?: ImportDataMappingState;
1666
+ loading: boolean;
1667
+ error?: string;
1668
+ revision: number;
1669
+ loadFile: (file: File) => Promise<void>;
1670
+ reset: () => void;
1671
+ selectSheet: (sheetName: string) => void;
1672
+ selectHeaderRow: (headerRow: number) => void;
1673
+ updateMappingRow: (rowIndex: number, destination: string | null) => void;
1674
+ }
1675
+ export function getImportSourceColumnLabel(row: ImportDataMappingRow): string;
1676
+ export function useImportDataMapping({ destinations, requiredDestinations, initialRow, sampleRowCount, fileErrorLabel }: UseImportDataMappingProps): ImportDataMappingAPI;
1677
+ export interface ImportDataMappingEditorProps {
1678
+ mappingAPI: ImportDataMappingAPI;
1679
+ destinations: readonly string[];
1630
1680
  worksheetLabel?: string;
1631
1681
  initialRowLabel?: string;
1632
1682
  sourceHeaderLabel?: string;
1633
1683
  sourceIndexLabel?: string;
1634
1684
  destinationLabel?: string;
1635
- previewLabel?: string;
1636
- addMappingLabel?: string;
1637
- legacyHelpLabel?: string;
1685
+ mappingCorrectLabel?: string;
1686
+ mappingReviewLabel?: string;
1687
+ editMappedColumnsLabel?: string;
1638
1688
  noDestinationsLabel?: string;
1639
- workbookErrorLabel?: string;
1640
1689
  }
1641
- export const ExcelImportMappingEditorDefaultProps: Partial<ExcelImportMappingEditorProps>;
1642
- export function ExcelImportMappingEditor(props: ExcelImportMappingEditorProps): JSX.Element;
1690
+ export const ImportDataMappingEditorDefaultProps: Partial<ImportDataMappingEditorProps>;
1691
+ export function ImportDataMappingEditor(props: ImportDataMappingEditorProps): JSX.Element | null;
1643
1692
  export const ACTDownloadImportedFileLabels: {
1644
1693
  label: string;
1645
1694
  error: string;
@@ -1713,16 +1762,6 @@ export class ImportEntityDataDef extends EntityDefinition {
1713
1762
  };
1714
1763
  constructor();
1715
1764
  }
1716
- export interface CircleFilledIconProps {
1717
- backColor?: MantineColor;
1718
- color?: MantineColor;
1719
- width?: string | number;
1720
- minWidth?: string | number;
1721
- icon: ReactNode;
1722
- mr?: string;
1723
- }
1724
- export const CircleFilledIconDefaultProps: Partial<CircleFilledIconProps>;
1725
- export const CircleFilledIcon: ForwardRefExoticComponent<CircleFilledIconProps & RefAttributes<HTMLInputElement>>;
1726
1765
  export interface ImageCropOptions {
1727
1766
  aspectRatio?: number;
1728
1767
  }
@@ -1991,29 +2030,122 @@ export interface ModalFileUploadProps {
1991
2030
  }
1992
2031
  export const UseFileUploadFormOpenDefaultProps: Partial<ModalFileUploadProps>;
1993
2032
  export function useFilesUploadForm(): (props: ModalFileUploadProps) => Promise<void>;
2033
+ export interface CircleFilledIconProps {
2034
+ backColor?: MantineColor;
2035
+ color?: MantineColor;
2036
+ width?: string | number;
2037
+ minWidth?: string | number;
2038
+ icon: ReactNode;
2039
+ mr?: string;
2040
+ }
2041
+ export const CircleFilledIconDefaultProps: Partial<CircleFilledIconProps>;
2042
+ export const CircleFilledIcon: ForwardRefExoticComponent<CircleFilledIconProps & RefAttributes<HTMLInputElement>>;
2043
+ export interface ImportCompletedContentProps {
2044
+ fileName: string;
2045
+ result: ImpDataResult;
2046
+ onClose?: () => void | Promise<void>;
2047
+ importedFileLabel?: string;
2048
+ recordsImportedSuccessfullyLabel?: string;
2049
+ recordsNotImportedDueToErrorsLabel?: string;
2050
+ errorColumnTitle?: string;
2051
+ rowColumnTitle?: string;
2052
+ closeLabel?: ReactNode;
2053
+ }
2054
+ export const ImportCompletedContentDefaultProps: Partial<ImportCompletedContentProps>;
2055
+ export function ImportCompletedContent(props: ImportCompletedContentProps): JSX.Element;
2056
+ export interface ImportDataMappingStepProps {
2057
+ mappingAPI: ImportDataMappingAPI;
2058
+ destinations: readonly string[];
2059
+ validationError?: string;
2060
+ }
2061
+ export const ImportDataMappingStepDefaultProps: Partial<ImportDataMappingStepProps>;
2062
+ export function ImportDataMappingStep(props: ImportDataMappingStepProps): JSX.Element;
2063
+ export interface ImportFileStepProps {
2064
+ entity: ImportEntityData;
2065
+ disabled?: boolean;
2066
+ validationError?: string;
2067
+ onValidateFile: (file: File) => Promise<ValidateFileReturnType>;
2068
+ onDelete: (fileGUID: string) => boolean | Promise<boolean>;
2069
+ onUploadComplete: (report: UploadProgressReport) => Promise<UploadCompletionResult | void>;
2070
+ }
2071
+ export function ImportFileStep({ entity, disabled, validationError, onValidateFile, onDelete, onUploadComplete }: ImportFileStepProps): JSX.Element;
2072
+ export interface ImportInstructionsStepProps {
2073
+ importEntity?: Entity<EntityDefinition>;
2074
+ requiredColumns: readonly string[];
2075
+ instructionsLabel?: string;
2076
+ columnHeaderLabel?: string;
2077
+ dataNameLabel?: string;
2078
+ dataTypeLabel?: string;
2079
+ contentLabel?: string;
2080
+ dateFormatLabel?: string;
2081
+ numberFormatLabel?: string;
2082
+ downloadExcelSampleLabel?: string;
2083
+ downloadCSVSampleLabel?: string;
2084
+ }
2085
+ export function getFriendlyImportDataType(type: SQLType): "Integer" | "Number" | "Date" | "Alphanumeric";
2086
+ export function ImportInstructionsStep({ importEntity, requiredColumns, instructionsLabel, columnHeaderLabel, dataNameLabel, dataTypeLabel, contentLabel, dateFormatLabel, numberFormatLabel, downloadExcelSampleLabel, downloadCSVSampleLabel }: ImportInstructionsStepProps): JSX.Element;
2087
+ export interface ImportSampleDataStepProps {
2088
+ mappingAPI: ImportDataMappingAPI;
2089
+ confirmationLabel?: string;
2090
+ noSampleDataLabel?: string;
2091
+ }
2092
+ export const ImportSampleDataStepDefaultProps: Partial<ImportSampleDataStepProps>;
2093
+ export function ImportSampleDataStep(props: ImportSampleDataStepProps): JSX.Element;
2094
+ export interface ImportSummaryStepProps {
2095
+ file: File | null;
2096
+ mappingState?: ImportDataMappingState;
2097
+ importStatus?: OperationStatus<ImpDataResult>;
2098
+ summaryTitleLabel?: string;
2099
+ fileLabel?: string;
2100
+ formatLabel?: string;
2101
+ unknownFormatLabel?: string;
2102
+ worksheetLabel?: string;
2103
+ headerRowLabel?: string;
2104
+ mappedColumnsLabel?: string;
2105
+ ofLabel?: string;
2106
+ ignoredSourceColumnsLabel?: string;
2107
+ omittedRequiredColumnsLabel?: string;
2108
+ noneLabel?: string;
2109
+ submitAndImportLabel?: string;
2110
+ importingDataLabel?: string;
2111
+ }
2112
+ export const ImportSummaryStepDefaultProps: Partial<ImportSummaryStepProps>;
2113
+ export function ImportSummaryStep(props: ImportSummaryStepProps): JSX.Element | null;
1994
2114
  export interface ImportEntityDataFormProps extends FormOptions<ImportEntityData> {
1995
2115
  importEntity?: Entity<EntityDefinition>;
1996
2116
  entityProcName?: string;
1997
2117
  excludedImportDestinations?: string[];
1998
2118
  onImportSuccess?: () => Promise<void>;
1999
- importInfoLabel?: string;
2000
- csvInstructionsLabel?: string;
2119
+ instructionsStepLabel?: string;
2120
+ instructionsStepDescription?: string;
2121
+ uploadStepLabel?: string;
2122
+ uploadStepDescription?: string;
2123
+ dataMappingStepLabel?: string;
2124
+ dataMappingStepDescription?: string;
2125
+ sampleDataStepLabel?: string;
2126
+ sampleDataStepDescription?: string;
2127
+ summaryStepLabel?: string;
2128
+ summaryStepDescription?: string;
2129
+ instructionsLabel?: string;
2001
2130
  columnHeaderLabel?: string;
2002
2131
  dataNameLabel?: string;
2003
2132
  contentLabel?: string;
2004
2133
  dataTypeLabel?: string;
2005
- errorReadingFileLabel?: string;
2006
- emptyCSVFileLabel?: string;
2007
- missingColumnsLabel?: string;
2008
2134
  dateFormatLabel?: string;
2009
2135
  numberFormatLabel?: string;
2010
- downloadSampleLabel?: string;
2136
+ downloadExcelSampleLabel?: string;
2137
+ downloadCSVSampleLabel?: string;
2138
+ errorReadingFileLabel?: string;
2139
+ emptyFileLabel?: string;
2140
+ uploadRequiredLabel?: string;
2141
+ mappingRequiredLabel?: string;
2142
+ confirmDataMappingLabel?: string;
2011
2143
  importButtonLabel?: string;
2012
- importHelpAndInstructionsLabel?: string;
2013
- recordsImportedSusccessfullyLabel?: string;
2014
- recordsNotImportedDueToErrorsLabel?: string;
2015
- importTheCSVFileLabel?: string;
2144
+ submitAndImportLabel?: string;
2145
+ importingDataLabel?: string;
2016
2146
  importedFileLabel?: string;
2147
+ recordsImportedSuccessfullyLabel?: string;
2148
+ recordsNotImportedDueToErrorsLabel?: string;
2017
2149
  errorColumnTitle?: string;
2018
2150
  rowColumnTitle?: string;
2019
2151
  }
@@ -2078,17 +2210,6 @@ export const UseImportDataDefaultProps: {
2078
2210
  noFileProcessLabel: string;
2079
2211
  errorImportingDataLabel: string;
2080
2212
  };
2081
- export interface useEntityCSVImportValidationProps {
2082
- errorReadingFileLabel?: string;
2083
- emptyCSVFileLabel?: string;
2084
- missingColumnsLabel?: string;
2085
- }
2086
- export function useEntityCSVImportValidation({ errorReadingFileLabel, emptyCSVFileLabel, missingColumnsLabel }: useEntityCSVImportValidationProps): {
2087
- validateEntityImportCSVFile: (props: {
2088
- file: File;
2089
- requiredColumns: string[];
2090
- }) => Promise<ValidateFileReturnType>;
2091
- };
2092
2213
  export interface UseExportToExcelProps {
2093
2214
  data: DataResult[];
2094
2215
  dataResultNames?: string[];
@@ -2098,9 +2219,10 @@ export function useExportToExcel(props: UseExportToExcelProps): {
2098
2219
  exportToExcel: () => Promise<void>;
2099
2220
  };
2100
2221
  export function useImportData(importEntity?: Entity<EntityDefinition>): {
2101
- execute: (fileprocess_id: string, importProcedureName?: string, excelImportMapping?: ExcelImportMapping, initialRow?: number) => Promise<OperationStatus<ImpDataResult> | undefined>;
2222
+ execute: (fileprocess_id: string, importProcedureName?: string, fileImportMapping?: FileImportMapping, initialRow?: number) => Promise<OperationStatus<ImpDataResult> | undefined>;
2102
2223
  importStatus: OperationStatus<ImpDataResult>;
2103
- cancellation: AbortController;
2224
+ readonly cancellation: AbortController;
2225
+ cancel: () => void;
2104
2226
  };
2105
2227
  export interface MicroMClientClaimTypes {
2106
2228
  username: string;
@@ -4627,7 +4749,7 @@ export class MicroMClient {
4627
4749
  proctoexcel(entity_name: string, parent_keys: ValuesObject | null, values: ValuesObject, recordsSelection: ValuesObject[] | null, proc_name: string, abort_signal?: AbortSignal | null): Promise<Blob>;
4628
4750
  process(entity_name: string, parent_keys: ValuesObject | null, values: ValuesObject, recordsSelection: ValuesObject[] | null, proc_name: string, abort_signal?: AbortSignal | null): Promise<DBStatusResult>;
4629
4751
  action<TReturn>(entity_name: string, parent_keys: ValuesObject | null, values: ValuesObject, action_name: string, abort_signal?: AbortSignal | null): Promise<TReturn>;
4630
- import(entity_name: string, parent_keys: ValuesObject | null, values: ValuesObject, import_procname: string | null, abort_signal?: AbortSignal | null, excelImportMapping?: ExcelImportMapping, initialRow?: number): Promise<ImpDataResult>;
4752
+ import(entity_name: string, parent_keys: ValuesObject | null, values: ValuesObject, import_procname: string | null, abort_signal?: AbortSignal | null, fileImportMapping?: FileImportMapping, initialRow?: number): Promise<ImpDataResult>;
4631
4753
  }
4632
4754
  export class RecordReader {
4633
4755
  constructor(dataResult: DataResult);