@esvndev/es-data-sharing 1.0.0 → 1.1.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/component/common/dynamic-field-input.d.ts +11 -0
- package/dist/component/common/grid-column-builder.d.ts +10 -0
- package/dist/component/modal/batch-master-card.d.ts +9 -0
- package/dist/component/modal/index.d.ts +5 -2
- package/dist/component/modal/modal-sharing.d.ts +4 -0
- package/dist/component/org-detail/detail-tab-table.d.ts +10 -0
- package/dist/component/org-override/override-table.d.ts +2 -0
- package/dist/component/org-scope/org-table.d.ts +1 -0
- package/dist/index.d.ts +46 -10
- package/dist/index.js +436 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +438 -33
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css +8 -0
- package/dist/styles/index.css.map +1 -1
- package/dist/types/index.d.ts +40 -7
- package/package.json +5 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ISharingFieldDef } from '../../types';
|
|
3
|
+
interface Props {
|
|
4
|
+
field: ISharingFieldDef;
|
|
5
|
+
value: any;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
onChange: (val: any, selectedOption?: any) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const DynamicFieldInput: React.FC<Props>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColumnTable } from 'es-grid-template';
|
|
3
|
+
import { ISharingFieldDef } from '../../types';
|
|
4
|
+
export interface BuildGridColumnOptions {
|
|
5
|
+
t: (key: string, fallback?: any) => any;
|
|
6
|
+
isFieldEditable?: (field: ISharingFieldDef, rowData: any) => boolean;
|
|
7
|
+
formatDisplayValue?: (field: ISharingFieldDef, rowData: any, resolvedDisplay: any) => React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function resolveFieldDisplayValue(field: ISharingFieldDef, rowData: Record<string, any> | undefined, rawVal: any): any;
|
|
10
|
+
export declare function buildGridColumns(fields: ISharingFieldDef[], options: BuildGridColumnOptions): ColumnTable<any>[];
|
|
@@ -5,10 +5,13 @@ export interface IFDataSharingRef {
|
|
|
5
5
|
close: () => void;
|
|
6
6
|
}
|
|
7
7
|
export interface IFDataSharingProps {
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/** Tên DB dự án cho môi trường Test (ví dụ: process.env.REACT_APP_SHARING_DATABASE). Trên Cloud để trống để API tự lấy theo JWT claim "data". */
|
|
9
|
+
database?: string;
|
|
10
|
+
/** Function gọi lấy dữ liệu chia sẻ + cấu hình đơn vị + detailData (như ObjectBank) */
|
|
11
|
+
fetchSharingData?: (entityType: string, entityId: string, database?: string) => Promise<{
|
|
10
12
|
isGlobalShared: boolean;
|
|
11
13
|
orgList: IOrgSharingItem[];
|
|
14
|
+
detailData?: Record<string, Record<string, any>[]>;
|
|
12
15
|
}>;
|
|
13
16
|
/** Function callback lưu dữ liệu */
|
|
14
17
|
onSave?: (payload: IDataSharingPayload) => Promise<void>;
|
|
@@ -5,9 +5,13 @@ interface Props {
|
|
|
5
5
|
toggle: () => void;
|
|
6
6
|
config: ISharingMetadataConfig;
|
|
7
7
|
masterData: Record<string, any>;
|
|
8
|
+
masterDataList?: Record<string, any>[];
|
|
8
9
|
entityId: string;
|
|
10
|
+
entityIds?: string[];
|
|
9
11
|
orgList: IOrgSharingItem[];
|
|
10
12
|
setOrgList: React.Dispatch<React.SetStateAction<IOrgSharingItem[]>>;
|
|
13
|
+
detailData: Record<string, Record<string, any>[]>;
|
|
14
|
+
setDetailData: React.Dispatch<React.SetStateAction<Record<string, Record<string, any>[]>>>;
|
|
11
15
|
isGlobalShared: boolean;
|
|
12
16
|
setIsGlobalShared: React.Dispatch<React.SetStateAction<boolean>>;
|
|
13
17
|
onSave: (payload: IDataSharingPayload) => Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IOrgSharingItem, ISharingDetailTabConfig } from '../../types';
|
|
3
|
+
interface Props {
|
|
4
|
+
tabConfig: ISharingDetailTabConfig;
|
|
5
|
+
orgList: IOrgSharingItem[];
|
|
6
|
+
rows: Record<string, any>[];
|
|
7
|
+
onChangeRows: (updatedRows: Record<string, any>[]) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const DetailTabTable: React.FC<Props>;
|
|
10
|
+
export {};
|
|
@@ -3,7 +3,9 @@ import { IOrgSharingItem, ISharingFieldDef } from '../../types';
|
|
|
3
3
|
interface Props {
|
|
4
4
|
orgList: IOrgSharingItem[];
|
|
5
5
|
overrideColumns: ISharingFieldDef[];
|
|
6
|
+
masterData?: Record<string, any>;
|
|
6
7
|
onChangeOverride: (targetOrgId: string, fieldKey: string, value: any) => void;
|
|
8
|
+
onApplyFirstToAll?: () => void;
|
|
7
9
|
}
|
|
8
10
|
export declare const OverrideTable: React.FC<Props>;
|
|
9
11
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
type FieldType = 'text' | 'number' | 'currency' | 'select' | 'user' | 'date';
|
|
3
|
+
type FieldType = 'text' | 'number' | 'numeric' | 'currency' | 'select' | 'selectTable' | 'user' | 'date' | 'switch' | 'checkbox';
|
|
4
|
+
interface ISharingFieldOption {
|
|
5
|
+
label: string;
|
|
6
|
+
value: any;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
4
9
|
interface ISharingFieldDef {
|
|
5
10
|
key: string;
|
|
6
11
|
label: string;
|
|
7
12
|
type?: FieldType;
|
|
8
13
|
optionsApi?: string;
|
|
9
|
-
options?:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
options?: ISharingFieldOption[];
|
|
15
|
+
selectTableColumns?: any[];
|
|
16
|
+
menuWidth?: number;
|
|
17
|
+
fieldLabel?: string;
|
|
18
|
+
fieldKey?: string;
|
|
19
|
+
/** Map target field -> option source field when selecting an option (e.g. { bankCode: 'key', name: 'name', swiftCode: 'swiftCode' }) */
|
|
20
|
+
autoFillMap?: Record<string, string>;
|
|
21
|
+
/** Enforce only 1 true checkbox per scope key (e.g. 'organizationId') */
|
|
22
|
+
uniqueScopeKey?: string;
|
|
23
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
24
|
+
fixedType?: 'left' | 'right';
|
|
13
25
|
required?: boolean;
|
|
14
26
|
readonly?: boolean;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
defaultValue?: any;
|
|
29
|
+
width?: number | string;
|
|
30
|
+
}
|
|
31
|
+
interface ISharingDetailTabConfig {
|
|
32
|
+
key: string;
|
|
33
|
+
title: string;
|
|
34
|
+
icon?: string;
|
|
35
|
+
columns: ISharingFieldDef[];
|
|
36
|
+
allowAdd?: boolean;
|
|
37
|
+
allowDelete?: boolean;
|
|
38
|
+
defaultRow?: Record<string, any>;
|
|
15
39
|
}
|
|
16
40
|
interface ISharingMetadataConfig {
|
|
17
41
|
entityType: string;
|
|
@@ -19,6 +43,8 @@ interface ISharingMetadataConfig {
|
|
|
19
43
|
masterCardTitle: string;
|
|
20
44
|
masterFields: ISharingFieldDef[];
|
|
21
45
|
overrideColumns: ISharingFieldDef[];
|
|
46
|
+
detailTabs?: ISharingDetailTabConfig[];
|
|
47
|
+
showEffectiveDate?: boolean;
|
|
22
48
|
}
|
|
23
49
|
interface IOrgSharingItem {
|
|
24
50
|
targetOrgId: string;
|
|
@@ -38,6 +64,7 @@ interface IOrgSharingItem {
|
|
|
38
64
|
interface IDataSharingPayload {
|
|
39
65
|
entityType: string;
|
|
40
66
|
entityId: string;
|
|
67
|
+
entityIds?: string[];
|
|
41
68
|
isGlobalShared: boolean;
|
|
42
69
|
sharingList: {
|
|
43
70
|
TargetOrgId: string;
|
|
@@ -48,13 +75,19 @@ interface IDataSharingPayload {
|
|
|
48
75
|
Status: number;
|
|
49
76
|
}[];
|
|
50
77
|
orgConfigList?: Record<string, any>[];
|
|
78
|
+
detailData?: Record<string, Record<string, any>[]>;
|
|
79
|
+
database?: string;
|
|
51
80
|
}
|
|
52
81
|
interface IFDataSharingOpenParams {
|
|
53
82
|
entityType: string;
|
|
54
|
-
entityId
|
|
55
|
-
|
|
83
|
+
entityId?: string;
|
|
84
|
+
entityIds?: string[];
|
|
85
|
+
masterData?: Record<string, any>;
|
|
86
|
+
masterDataList?: Record<string, any>[];
|
|
56
87
|
config: ISharingMetadataConfig;
|
|
57
88
|
initialGlobalShared?: boolean;
|
|
89
|
+
initialDetailData?: Record<string, Record<string, any>[]>;
|
|
90
|
+
database?: string;
|
|
58
91
|
}
|
|
59
92
|
|
|
60
93
|
interface IFDataSharingRef {
|
|
@@ -62,10 +95,13 @@ interface IFDataSharingRef {
|
|
|
62
95
|
close: () => void;
|
|
63
96
|
}
|
|
64
97
|
interface IFDataSharingProps {
|
|
65
|
-
/**
|
|
66
|
-
|
|
98
|
+
/** Tên DB dự án cho môi trường Test (ví dụ: process.env.REACT_APP_SHARING_DATABASE). Trên Cloud để trống để API tự lấy theo JWT claim "data". */
|
|
99
|
+
database?: string;
|
|
100
|
+
/** Function gọi lấy dữ liệu chia sẻ + cấu hình đơn vị + detailData (như ObjectBank) */
|
|
101
|
+
fetchSharingData?: (entityType: string, entityId: string, database?: string) => Promise<{
|
|
67
102
|
isGlobalShared: boolean;
|
|
68
103
|
orgList: IOrgSharingItem[];
|
|
104
|
+
detailData?: Record<string, Record<string, any>[]>;
|
|
69
105
|
}>;
|
|
70
106
|
/** Function callback lưu dữ liệu */
|
|
71
107
|
onSave?: (payload: IDataSharingPayload) => Promise<void>;
|
|
@@ -74,4 +110,4 @@ interface IFDataSharingProps {
|
|
|
74
110
|
}
|
|
75
111
|
declare const DataSharingComponent: React.ForwardRefExoticComponent<IFDataSharingProps & React.RefAttributes<IFDataSharingRef>>;
|
|
76
112
|
|
|
77
|
-
export { FieldType, IDataSharingPayload, IFDataSharingOpenParams, IFDataSharingProps, IFDataSharingRef, IOrgSharingItem, ISharingFieldDef, ISharingMetadataConfig, DataSharingComponent as default };
|
|
113
|
+
export { FieldType, IDataSharingPayload, IFDataSharingOpenParams, IFDataSharingProps, IFDataSharingRef, IOrgSharingItem, ISharingDetailTabConfig, ISharingFieldDef, ISharingFieldOption, ISharingMetadataConfig, DataSharingComponent as default };
|