@sava-info-systems/api-maker-with-extensions 1.9.0 → 1.11.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/1025.js +1 -1
- package/dist/1097.js +1 -1
- package/dist/148.js +1 -1
- package/dist/1558.js +1 -1
- package/dist/1678.js +1 -1
- package/dist/1754.js +1 -1
- package/dist/1928.js +1 -1
- package/dist/1957.js +1 -1
- package/dist/2140.js +1 -1
- package/dist/2295.js +1 -1
- package/dist/2473.js +1 -1
- package/dist/2714.js +1 -1
- package/dist/2735.js +1 -1
- package/dist/2908.js +1 -1
- package/dist/3139.js +1 -1
- package/dist/3450.js +1 -1
- package/dist/4110.js +1 -1
- package/dist/4181.js +1 -1
- package/dist/4186.js +1 -1
- package/dist/4211.js +1 -1
- package/dist/4575.js +1 -1
- package/dist/4842.js +1 -1
- package/dist/485.js +1 -1
- package/dist/4895.js +1 -1
- package/dist/5249.js +1 -1
- package/dist/5334.js +1 -1
- package/dist/5421.js +1 -1
- package/dist/5679.js +1 -1
- package/dist/5761.js +1 -1
- package/dist/5765.js +1 -1
- package/dist/6236.js +1 -1
- package/dist/6393.js +1 -1
- package/dist/6401.js +1 -1
- package/dist/7368.js +1 -1
- package/dist/7436.js +1 -1
- package/dist/7470.js +1 -1
- package/dist/7649.js +1 -1
- package/dist/7975.js +1 -1
- package/dist/7977.js +1 -1
- package/dist/7987.js +1 -1
- package/dist/8125.js +1 -1
- package/dist/8266.js +1 -1
- package/dist/8296.js +1 -1
- package/dist/8841.js +1 -1
- package/dist/885.js +1 -1
- package/dist/891.js +1 -1
- package/dist/913.js +1 -1
- package/dist/9243.js +1 -1
- package/dist/9575.js +1 -1
- package/dist/9939.js +1 -1
- package/dist/assets/schema-types/InterfaceProps.ts +3 -1
- package/dist/assets/schema-types/types.ts +313 -12
- package/dist/assets/swagger/index.html +4 -0
- package/dist/common.js +1 -1
- package/dist/index.html +4 -1
- package/dist/main.js +1 -1
- package/main.js +1 -1
- package/package.json +6 -5
- package/sandbox/assets/schema-types/types.js +41 -0
- package/sandbox/sandbox.js +1 -1
- package/src/assets/schema-types/types.ts +313 -12
- package/src/public/dist-db-masters/browser/main.js +49 -49
- package/src/public/index.hbs +2 -2
|
@@ -56,6 +56,7 @@ export enum EAPICategoryEnum {
|
|
|
56
56
|
EVENTS = 'EVENTS',
|
|
57
57
|
SCHEDULERS = 'SCHEDULERS',
|
|
58
58
|
MIGRATION_SCRIPT = 'MIGRATION_SCRIPT',
|
|
59
|
+
WEB_SOCKET_EVENT_CAN_USER_CONNECT_CODE = 'WEB_SOCKET_EVENT_CAN_USER_CONNECT_CODE',
|
|
59
60
|
PROCESS_INITIALIZER = 'PROCESS_INITIALIZER',
|
|
60
61
|
UTILITY_CLASS = 'UTILITY_CLASS',
|
|
61
62
|
}
|
|
@@ -201,6 +202,9 @@ export interface IBaseParams {
|
|
|
201
202
|
*/
|
|
202
203
|
skipHookRunning?: boolean;
|
|
203
204
|
|
|
205
|
+
/** Default true, if true, it will allow update by id & replace by id & master save without version field and it will not throw error when version is different. */
|
|
206
|
+
skipConcurrencyControl?: boolean;
|
|
207
|
+
|
|
204
208
|
/**
|
|
205
209
|
* It is used in instance & database & collection hooks
|
|
206
210
|
*/
|
|
@@ -251,6 +255,7 @@ export enum EErrorType {
|
|
|
251
255
|
schemaKeyNotFound = 'schemaKeyNotFound',
|
|
252
256
|
schemaNotFound = 'schemaNotFound',
|
|
253
257
|
emailNotValid = 'emailNotValid',
|
|
258
|
+
enumValidation = 'enumValidation',
|
|
254
259
|
}
|
|
255
260
|
|
|
256
261
|
// Main interfaces
|
|
@@ -279,7 +284,15 @@ export interface ISchemaProperty { // Add new schema property in ValidateDBSchem
|
|
|
279
284
|
|
|
280
285
|
/** API Maker will take care of assigning incremental value for this field. */
|
|
281
286
|
isAutoIncrementByAM?: boolean | IIsAutoIncrementByAM;
|
|
282
|
-
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* if true, system will fail update/replace operation when value of this field in request payload, and value of database is not same.<br/>
|
|
290
|
+
* Sending this field in update request is mandatory.<br/>
|
|
291
|
+
* We can use conversions -> conversionFun to generate it's values.<br/>
|
|
292
|
+
* This will not work for SCHEMA_UPDATE_MANY API because it is direct query on database for updating multiple rows.<br/>
|
|
293
|
+
* By using optimistic concurrency control, you can ensure that updates are not overwritten by concurrent modifications, maintaining data integrity.<br/>
|
|
294
|
+
* */
|
|
295
|
+
isConcurrencyControlField?: boolean;
|
|
283
296
|
}
|
|
284
297
|
|
|
285
298
|
export interface IIsAutoIncrementByAM {
|
|
@@ -295,6 +308,13 @@ export interface IPropertyConversion {
|
|
|
295
308
|
toUpperCase?: boolean;
|
|
296
309
|
conversionFun?: Function;
|
|
297
310
|
|
|
311
|
+
/**
|
|
312
|
+
* When we are tying to save/replace and property is not present in payload, this default value will be applied to it.<br/>
|
|
313
|
+
* This default value will be converted to that type and applied.<br/>
|
|
314
|
+
* Empty string and null values will be treated based on configuration.
|
|
315
|
+
* */
|
|
316
|
+
defaults?: IPropertyConversionDefaults
|
|
317
|
+
|
|
298
318
|
/** enable encryption for this property */
|
|
299
319
|
encryption?: boolean | IEncryptionDescription;
|
|
300
320
|
|
|
@@ -305,6 +325,25 @@ export interface IPropertyConversion {
|
|
|
305
325
|
hashing?: boolean | IPropertyHashing;
|
|
306
326
|
}
|
|
307
327
|
|
|
328
|
+
export interface IPropertyConversionDefaults {
|
|
329
|
+
/** This default value will converted to type and applied. */
|
|
330
|
+
defaultValue?: any;
|
|
331
|
+
|
|
332
|
+
/** defaultValue has higher priority. If defaultValue is not present, system will execution this function and returned value will be set. */
|
|
333
|
+
defaultFun?: Function;
|
|
334
|
+
|
|
335
|
+
/** If true, it will apply default value when value is also null. */
|
|
336
|
+
shouldReplaceNullWithDefault?: boolean;
|
|
337
|
+
|
|
338
|
+
/** If true, it will apply default value when value is also empty string. */
|
|
339
|
+
shouldReplaceEmptyStringWithDefault?: boolean;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export enum EIPropertyConversionDefaults {
|
|
343
|
+
defaultValue = 'defaultValue',
|
|
344
|
+
defaultFun = 'defaultFun',
|
|
345
|
+
}
|
|
346
|
+
|
|
308
347
|
export interface IEncryptionDescription {
|
|
309
348
|
/** by default is DB for encryption and User for decryption. value will be encrypted while sending to DB | User */
|
|
310
349
|
sendingTo?: ESendingToSchema;
|
|
@@ -400,6 +439,9 @@ export interface IAuthTokenAMDB extends Partial<IAuthTokenAM> {
|
|
|
400
439
|
table?: string;
|
|
401
440
|
usernameColumn?: string;
|
|
402
441
|
passwordColumn?: string;
|
|
442
|
+
/** If you use this column, password field will not be present in JWT token and this value will be present, It is used to identify pass is changed or not. */
|
|
443
|
+
passwordChangedAtColumn?: string;
|
|
444
|
+
|
|
403
445
|
/** column name which holds values of, comma separated groups assigned to this db user. * = means all groups of api user. DB user can hit API if he/she has access in any of these groups. */
|
|
404
446
|
groupsColumn?: string;
|
|
405
447
|
countOfUsersForTesting?: number; // load these much users in dropdown.
|
|
@@ -774,8 +816,8 @@ export interface ICommonApisSchema {
|
|
|
774
816
|
/**
|
|
775
817
|
* => Returns [a object] or [an array of objects].
|
|
776
818
|
*/
|
|
777
|
-
saveSingleOrMultiple<T>(query: IApiParamsSave): Promise<T | T[]>;
|
|
778
|
-
saveSingleOrMultiple<T>(query: IApiParamsSave, getFullResponse: boolean): Promise<IAPIResponse<T | T[]>>;
|
|
819
|
+
saveSingleOrMultiple<T>(query: Omit<IApiParamsSave, 'skipConcurrencyControl'>): Promise<T | T[]>;
|
|
820
|
+
saveSingleOrMultiple<T>(query: Omit<IApiParamsSave, 'skipConcurrencyControl'>, getFullResponse: boolean): Promise<IAPIResponse<T | T[]>>;
|
|
779
821
|
/**
|
|
780
822
|
* => Returns [a object] or [an array of objects].
|
|
781
823
|
*/
|
|
@@ -843,21 +885,21 @@ export interface ICommonApisGen {
|
|
|
843
885
|
/**
|
|
844
886
|
* => Returns [a object] or [an array of objects].
|
|
845
887
|
*/
|
|
846
|
-
saveSingleOrMultipleGen<T>(query: IApiParamsSave): Promise<T | T[]>;
|
|
847
|
-
saveSingleOrMultipleGen<T>(query: IApiParamsSave, getFullResponse: boolean): Promise<IAPIResponse<T | T[]>>;
|
|
888
|
+
saveSingleOrMultipleGen<T>(query: Omit<IApiParamsSave, 'skipConcurrencyControl'>): Promise<T | T[]>;
|
|
889
|
+
saveSingleOrMultipleGen<T>(query: Omit<IApiParamsSave, 'skipConcurrencyControl'>, getFullResponse: boolean): Promise<IAPIResponse<T | T[]>>;
|
|
848
890
|
/**
|
|
849
891
|
* => Returns [a object] or [an array of objects].
|
|
850
892
|
*/
|
|
851
|
-
masterSaveGen<T>(query: IApiParamsSave): Promise<T | T[]>;
|
|
852
|
-
masterSaveGen<T>(query: IApiParamsSave, getFullResponse: boolean): Promise<IAPIResponse<T | T[]>>;
|
|
893
|
+
masterSaveGen<T>(query: Omit<IApiParamsSave, 'skipConcurrencyControl'>): Promise<T | T[]>;
|
|
894
|
+
masterSaveGen<T>(query: Omit<IApiParamsSave, 'skipConcurrencyControl'>, getFullResponse: boolean): Promise<IAPIResponse<T | T[]>>;
|
|
853
895
|
|
|
854
896
|
arrayOperationsGen<T>(query: IArrayOperationBody & IAMGlobalBaseParams): Promise<T>;
|
|
855
897
|
arrayOperationsGen<T>(query: IArrayOperationBody & IAMGlobalBaseParams, getFullResponse: boolean): Promise<IAPIResponse<T>>;
|
|
856
898
|
/**
|
|
857
899
|
* => Returns [a single object].
|
|
858
900
|
*/
|
|
859
|
-
updateByIdGen<T>(query: IApiParamsUpdate): Promise<T>;
|
|
860
|
-
updateByIdGen<T>(query: IApiParamsUpdate, getFullResponse: boolean): Promise<IAPIResponse<T>>;
|
|
901
|
+
updateByIdGen<T>(query: Omit<IApiParamsUpdate, 'skipConcurrencyControl'>): Promise<T>;
|
|
902
|
+
updateByIdGen<T>(query: Omit<IApiParamsUpdate, 'skipConcurrencyControl'>, getFullResponse: boolean): Promise<IAPIResponse<T>>;
|
|
861
903
|
/**
|
|
862
904
|
* => Returns [updatedRowsCount].
|
|
863
905
|
*/
|
|
@@ -866,8 +908,8 @@ export interface ICommonApisGen {
|
|
|
866
908
|
/**
|
|
867
909
|
* => Returns [a single object].
|
|
868
910
|
*/
|
|
869
|
-
replaceByIdGen<T>(query: IApiParamsUpdate): Promise<T>;
|
|
870
|
-
replaceByIdGen<T>(query: IApiParamsUpdate, getFullResponse: boolean): Promise<IAPIResponse<T>>;
|
|
911
|
+
replaceByIdGen<T>(query: Omit<IApiParamsUpdate, 'skipConcurrencyControl'>): Promise<T>;
|
|
912
|
+
replaceByIdGen<T>(query: Omit<IApiParamsUpdate, 'skipConcurrencyControl'>, getFullResponse: boolean): Promise<IAPIResponse<T>>;
|
|
871
913
|
/**
|
|
872
914
|
* => Returns [a single object].
|
|
873
915
|
*/
|
|
@@ -1022,6 +1064,9 @@ export interface IApiParamsGetById extends IAMGlobalBaseParams {
|
|
|
1022
1064
|
|
|
1023
1065
|
export interface IApiParamsSave extends IAMGlobalBaseParams {
|
|
1024
1066
|
saveData?: any; // used to save data in db.
|
|
1067
|
+
|
|
1068
|
+
/** Default true, if true, it will allow update by id & replace by id & master save without version field and it will not throw error when version is different. */
|
|
1069
|
+
skipConcurrencyControl?: boolean;
|
|
1025
1070
|
}
|
|
1026
1071
|
|
|
1027
1072
|
export interface IApiParamsQueryStream extends IAMGlobalBaseParams {
|
|
@@ -1050,6 +1095,9 @@ export interface IApiParamsUpdate extends IAMGlobalBaseParams {
|
|
|
1050
1095
|
upsert?: boolean; // insert if item not available.
|
|
1051
1096
|
returnDocument?: string; // return old doc if 'before', 'before' | 'after'
|
|
1052
1097
|
select?: any; // to select which rows will return in response.
|
|
1098
|
+
|
|
1099
|
+
/** Default true, if true, it will allow update by id & replace by id & master save without version field and it will not throw error when version is different. */
|
|
1100
|
+
skipConcurrencyControl?: boolean;
|
|
1053
1101
|
}
|
|
1054
1102
|
|
|
1055
1103
|
export interface IApiParamsUpdateMany extends IAMGlobalBaseParams {
|
|
@@ -1260,6 +1308,7 @@ export interface IWSObject {
|
|
|
1260
1308
|
apiUser?: any; // IApiUser
|
|
1261
1309
|
amUser?: any; // IUser
|
|
1262
1310
|
};
|
|
1311
|
+
auth: ISandboxReqAuthObj;
|
|
1263
1312
|
}
|
|
1264
1313
|
|
|
1265
1314
|
export type IWSObject_P = Partial<IWSObject>;
|
|
@@ -1835,7 +1884,7 @@ export interface IDBMasterCustomActionButton {
|
|
|
1835
1884
|
actionName: string;
|
|
1836
1885
|
|
|
1837
1886
|
/** ex : pi pi-check. https://primeng.org/icons */
|
|
1838
|
-
cssClass
|
|
1887
|
+
cssClass?: string,
|
|
1839
1888
|
|
|
1840
1889
|
/** Give style object in angular style. */
|
|
1841
1890
|
style?: any;
|
|
@@ -1851,6 +1900,35 @@ export interface IDBMasterCustomActionButton {
|
|
|
1851
1900
|
* ex: confirmationMessageScript: "`Do you want to approve ${selectedGridItems.length}?`",
|
|
1852
1901
|
* */
|
|
1853
1902
|
confirmationMessageScript?: string;
|
|
1903
|
+
|
|
1904
|
+
/** custom HTML code of button */
|
|
1905
|
+
htmlCode?: string;
|
|
1906
|
+
|
|
1907
|
+
jsCode?: {
|
|
1908
|
+
/**
|
|
1909
|
+
* Available variables:<br/>
|
|
1910
|
+
* globalData: any = User will send it using SET_GLOBAL_DATA_TO_USE_IN_ANY_SCRIPT event from parent. <br/>
|
|
1911
|
+
* utils: any = Common utility functions for user to use. <br/>
|
|
1912
|
+
* queryParams: any = Query params received from URL. <br/>
|
|
1913
|
+
* config: IDBMasterConfigFormField <br/>
|
|
1914
|
+
* gridData: Array of grid data. <br/>
|
|
1915
|
+
* selectedGridItems: Selected grid items. <br/>
|
|
1916
|
+
* event: any <br/>
|
|
1917
|
+
*/
|
|
1918
|
+
appendTo: EDBMasterCustomActionButtonAppendTo,
|
|
1919
|
+
/**
|
|
1920
|
+
* // Return promise for long awaiting tasks.
|
|
1921
|
+
* new Promise(async (resolve, reject) => {
|
|
1922
|
+
* await new Promise(r => setTimeout(r, 3000));
|
|
1923
|
+
* resolve();
|
|
1924
|
+
* });
|
|
1925
|
+
*
|
|
1926
|
+
* // Return function
|
|
1927
|
+
* (function setData() { dropdownData[0].name = 'Sample data'; } );
|
|
1928
|
+
*
|
|
1929
|
+
*/
|
|
1930
|
+
code: string,
|
|
1931
|
+
}[],
|
|
1854
1932
|
}
|
|
1855
1933
|
|
|
1856
1934
|
type uiMakerComponentSeverity = 'contrast' | 'danger' | 'help' | 'info' | 'primary' | 'secondary' | 'success' | 'warning';
|
|
@@ -2673,10 +2751,202 @@ export interface IDBMasterConfigFormField {
|
|
|
2673
2751
|
|
|
2674
2752
|
// autocompleteSettings : start
|
|
2675
2753
|
autocompleteSettings?: {
|
|
2754
|
+
/** Give style object in angular style. */
|
|
2755
|
+
style?: any;
|
|
2756
|
+
|
|
2757
|
+
/** custom CSS class to assign to control */
|
|
2758
|
+
cssClass?: string,
|
|
2759
|
+
|
|
2760
|
+
placeholder?: string;
|
|
2761
|
+
showClear?: boolean;
|
|
2762
|
+
|
|
2763
|
+
/** Minimum number of characters to initiate a search. */
|
|
2764
|
+
minLength?: number;
|
|
2765
|
+
|
|
2766
|
+
/** Delay between keystrokes to wait before sending a query. */
|
|
2767
|
+
delay?: number;
|
|
2768
|
+
|
|
2769
|
+
/** When present, autocomplete clears the manual input if it does not match of the suggestions to force only accepting values from the suggestions. */
|
|
2770
|
+
forceSelection?: number;
|
|
2771
|
+
|
|
2772
|
+
dataSource: 'static_data' | 'db_data' | 'api_call'; // custom_code = We can call any API in that.
|
|
2773
|
+
|
|
2774
|
+
/** it will use used when dataSource is 'static_data'. */
|
|
2775
|
+
staticData?: any[]; // { label: string; value: any; }[] works default.
|
|
2776
|
+
|
|
2777
|
+
/**
|
|
2778
|
+
* it can pickup IDB values from schema also.
|
|
2779
|
+
*/
|
|
2780
|
+
dbData?: Partial<Pick<ICollectionIdentity, 'instance' | 'database' | 'collection' | 'table'>
|
|
2781
|
+
& Pick<IQueryFormat, 'find' | 'select' | 'limit' | 'deep' | 'sort'>>;
|
|
2782
|
+
|
|
2783
|
+
/** Default : label */
|
|
2784
|
+
optionLabel?: string;
|
|
2785
|
+
|
|
2786
|
+
/** Default : value */
|
|
2787
|
+
optionValue?: string;
|
|
2788
|
+
|
|
2789
|
+
/** one field or multiple comma separated fields are supported without any space in between. */
|
|
2790
|
+
filterBy?: string;
|
|
2791
|
+
filterMatchMode?: 'contains' | 'startsWith' | 'endsWith';
|
|
2792
|
+
|
|
2793
|
+
/** Default : false, if true it will get latest data when form opens for add/edit operation. */
|
|
2794
|
+
alwaysGetLatestDataOnFormOpen?: boolean;
|
|
2795
|
+
|
|
2796
|
+
/** Default : false, Make it true to handle huge amount of data. */
|
|
2797
|
+
virtualScroll?: boolean;
|
|
2798
|
+
|
|
2799
|
+
/** on value change of current dropdown, it will change values of these dropdowns and reload them. */
|
|
2800
|
+
reloadDropdownsOfPath?: string[];
|
|
2801
|
+
|
|
2802
|
+
/** API call will happen when these values of path are present in formData */
|
|
2803
|
+
isDependentOnPath?: string[];
|
|
2804
|
+
|
|
2676
2805
|
dropdown?: boolean;
|
|
2806
|
+
|
|
2807
|
+
addNewFormConfig?: IDBMasterConfig;
|
|
2808
|
+
|
|
2809
|
+
apiCallOverrides?: IDBMasterAPICallOverrides;
|
|
2810
|
+
|
|
2811
|
+
jsCode?: {
|
|
2812
|
+
/**
|
|
2813
|
+
* modifyDropdownRequest = It will run before hitting API call. So we can do whatever we want.<br/>
|
|
2814
|
+
* onceDropdownDataLoaded = Execute code when dropdown data is loaded.<br/>
|
|
2815
|
+
*
|
|
2816
|
+
* Available variables:<br/>
|
|
2817
|
+
* reqBody: IQueryFormat | any. Useful to modify apiCallOverrides also,<br/>
|
|
2818
|
+
* formData: any = Entire form object<br/>
|
|
2819
|
+
* column: IDBMasterConfigFormField = Configuration of that form column. column.dropdownSettings?.dbData?.find will be query to get data. <br/>
|
|
2820
|
+
* allDropdownDataMap: {[path: string]: any[]} = Map of all dropdown data<br/>
|
|
2821
|
+
* dropdownData: any[] = Latest loaded dropdown data<br/>
|
|
2822
|
+
* reloadDropdownsOfPath: string[] = Add path to this variable to reload its dropdown data.<br/>
|
|
2823
|
+
* globalData: any = User will send it using SET_GLOBAL_DATA_TO_USE_IN_ANY_SCRIPT event from parent.<br/>
|
|
2824
|
+
* utils: any = Common utility functions for user to use. <br/>
|
|
2825
|
+
* queryParams: any = Query params received from URL. <br/>
|
|
2826
|
+
*/
|
|
2827
|
+
appendTo: EDBMasterAutoCompleteAppendTo,
|
|
2828
|
+
/**
|
|
2829
|
+
* // dropdownData is available to use.
|
|
2830
|
+
*
|
|
2831
|
+
* // Return promise for long awaiting tasks.
|
|
2832
|
+
* new Promise(async (resolve, reject) => {
|
|
2833
|
+
* await new Promise(r => setTimeout(r, 3000));
|
|
2834
|
+
* dropdownData[0].name = 'Sample data';
|
|
2835
|
+
* resolve();
|
|
2836
|
+
* });
|
|
2837
|
+
*
|
|
2838
|
+
* // Directly modify data of grid
|
|
2839
|
+
* dropdownData[0].name = 'Sample data';
|
|
2840
|
+
*
|
|
2841
|
+
* // Return function
|
|
2842
|
+
* (function setData() { dropdownData[0].name = 'Sample data'; } );
|
|
2843
|
+
*
|
|
2844
|
+
*/
|
|
2845
|
+
code: string,
|
|
2846
|
+
|
|
2847
|
+
}[],
|
|
2848
|
+
|
|
2677
2849
|
};
|
|
2678
2850
|
// autocompleteSettings : end
|
|
2679
2851
|
|
|
2852
|
+
// multiselectSettings : start
|
|
2853
|
+
multiselectSettings?: {
|
|
2854
|
+
/** Give style object in angular style. */
|
|
2855
|
+
style?: any;
|
|
2856
|
+
|
|
2857
|
+
/** custom CSS class to assign to control */
|
|
2858
|
+
cssClass?: string,
|
|
2859
|
+
|
|
2860
|
+
placeholder?: string;
|
|
2861
|
+
showClear?: boolean;
|
|
2862
|
+
|
|
2863
|
+
/** Minimum number of characters to initiate a search. */
|
|
2864
|
+
minLength?: number;
|
|
2865
|
+
|
|
2866
|
+
/** Delay between keystrokes to wait before sending a query. */
|
|
2867
|
+
delay?: number;
|
|
2868
|
+
|
|
2869
|
+
dataSource: 'static_data' | 'db_data' | 'api_call'; // custom_code = We can call any API in that.
|
|
2870
|
+
|
|
2871
|
+
/** it will use used when dataSource is 'static_data'. */
|
|
2872
|
+
staticData?: any[]; // { label: string; value: any; }[] works default.
|
|
2873
|
+
|
|
2874
|
+
/**
|
|
2875
|
+
* it can pickup IDB values from schema also.
|
|
2876
|
+
*/
|
|
2877
|
+
dbData?: Partial<Pick<ICollectionIdentity, 'instance' | 'database' | 'collection' | 'table'>
|
|
2878
|
+
& Pick<IQueryFormat, 'find' | 'select' | 'limit' | 'deep' | 'sort'>>;
|
|
2879
|
+
|
|
2880
|
+
/** Default : label */
|
|
2881
|
+
optionLabel?: string;
|
|
2882
|
+
|
|
2883
|
+
/** Default : value */
|
|
2884
|
+
optionValue?: string;
|
|
2885
|
+
|
|
2886
|
+
/** Enable filter */
|
|
2887
|
+
filter?: boolean;
|
|
2888
|
+
|
|
2889
|
+
/** one field or multiple comma separated fields are supported without any space in between. */
|
|
2890
|
+
filterBy?: string;
|
|
2891
|
+
filterMatchMode?: 'contains' | 'startsWith' | 'endsWith';
|
|
2892
|
+
|
|
2893
|
+
/** Default : false, if true it will get latest data when form opens for add/edit operation. */
|
|
2894
|
+
alwaysGetLatestDataOnFormOpen?: boolean;
|
|
2895
|
+
|
|
2896
|
+
/** Default : false, Make it true to handle huge amount of data. */
|
|
2897
|
+
virtualScroll?: boolean;
|
|
2898
|
+
|
|
2899
|
+
/** on value change of current dropdown, it will change values of these dropdowns and reload them. */
|
|
2900
|
+
reloadDropdownsOfPath?: string[];
|
|
2901
|
+
|
|
2902
|
+
/** API call will happen when these values of path are present in formData */
|
|
2903
|
+
isDependentOnPath?: string[];
|
|
2904
|
+
|
|
2905
|
+
addNewFormConfig?: IDBMasterConfig;
|
|
2906
|
+
|
|
2907
|
+
apiCallOverrides?: IDBMasterAPICallOverrides;
|
|
2908
|
+
|
|
2909
|
+
jsCode?: {
|
|
2910
|
+
/**
|
|
2911
|
+
* modifyDropdownRequest = It will run before hitting API call. So we can do whatever we want.<br/>
|
|
2912
|
+
* onceDropdownDataLoaded = Execute code when dropdown data is loaded.<br/>
|
|
2913
|
+
*
|
|
2914
|
+
* Available variables:<br/>
|
|
2915
|
+
* reqBody: IQueryFormat | any. Useful to modify apiCallOverrides also,<br/>
|
|
2916
|
+
* formData: any = Entire form object<br/>
|
|
2917
|
+
* column: IDBMasterConfigFormField = Configuration of that form column. column.dropdownSettings?.dbData?.find will be query to get data. <br/>
|
|
2918
|
+
* allDropdownDataMap: {[path: string]: any[]} = Map of all dropdown data<br/>
|
|
2919
|
+
* dropdownData: any[] = Latest loaded dropdown data<br/>
|
|
2920
|
+
* reloadDropdownsOfPath: string[] = Add path to this variable to reload its dropdown data.<br/>
|
|
2921
|
+
* globalData: any = User will send it using SET_GLOBAL_DATA_TO_USE_IN_ANY_SCRIPT event from parent.<br/>
|
|
2922
|
+
* utils: any = Common utility functions for user to use. <br/>
|
|
2923
|
+
* queryParams: any = Query params received from URL. <br/>
|
|
2924
|
+
*/
|
|
2925
|
+
appendTo: EDBMasterMultiSelectAppendTo,
|
|
2926
|
+
/**
|
|
2927
|
+
* // dropdownData is available to use.
|
|
2928
|
+
*
|
|
2929
|
+
* // Return promise for long awaiting tasks.
|
|
2930
|
+
* new Promise(async (resolve, reject) => {
|
|
2931
|
+
* await new Promise(r => setTimeout(r, 3000));
|
|
2932
|
+
* dropdownData[0].name = 'Sample data';
|
|
2933
|
+
* resolve();
|
|
2934
|
+
* });
|
|
2935
|
+
*
|
|
2936
|
+
* // Directly modify data of grid
|
|
2937
|
+
* dropdownData[0].name = 'Sample data';
|
|
2938
|
+
*
|
|
2939
|
+
* // Return function
|
|
2940
|
+
* (function setData() { dropdownData[0].name = 'Sample data'; } );
|
|
2941
|
+
*
|
|
2942
|
+
*/
|
|
2943
|
+
code: string,
|
|
2944
|
+
|
|
2945
|
+
}[],
|
|
2946
|
+
|
|
2947
|
+
};
|
|
2948
|
+
// multiselectSettings : end
|
|
2949
|
+
|
|
2680
2950
|
// fileUploadSettings : start
|
|
2681
2951
|
fileUploadSettings?: {
|
|
2682
2952
|
/** Give style object in angular style. */
|
|
@@ -3040,6 +3310,9 @@ export interface IPropertyValidation {
|
|
|
3040
3310
|
unique?: boolean;
|
|
3041
3311
|
email?: boolean; // Allowed Types : string
|
|
3042
3312
|
validatorFun?: Function;
|
|
3313
|
+
|
|
3314
|
+
/** If value is present it should be from this array. */
|
|
3315
|
+
enum?: any[];
|
|
3043
3316
|
}
|
|
3044
3317
|
|
|
3045
3318
|
// genericConfig : end
|
|
@@ -3055,6 +3328,28 @@ export enum EDBMasterDropdownAppendTo {
|
|
|
3055
3328
|
|
|
3056
3329
|
// dropdownSettings : end
|
|
3057
3330
|
|
|
3331
|
+
// autocompleteSettings : start
|
|
3332
|
+
export enum EDBMasterAutoCompleteAppendTo {
|
|
3333
|
+
onSelect = 'onSelect',
|
|
3334
|
+
visible = 'visible',
|
|
3335
|
+
disabled = 'disabled',
|
|
3336
|
+
modifyAutoCompleteRequest = 'modifyAutoCompleteRequest',
|
|
3337
|
+
onceAutoCompleteDataLoaded = 'onceAutoCompleteDataLoaded',
|
|
3338
|
+
}
|
|
3339
|
+
|
|
3340
|
+
// autocompleteSettings : end
|
|
3341
|
+
|
|
3342
|
+
// multiselectSettings : start
|
|
3343
|
+
export enum EDBMasterMultiSelectAppendTo {
|
|
3344
|
+
visible = 'visible',
|
|
3345
|
+
disabled = 'disabled',
|
|
3346
|
+
modifyMultiSelectRequest = 'modifyMultiSelectRequest',
|
|
3347
|
+
onceMultiSelectDataLoaded = 'onceMultiSelectDataLoaded',
|
|
3348
|
+
onChange = 'onChange',
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
// multiselectSettings : end
|
|
3352
|
+
|
|
3058
3353
|
// inputTextSettings : start
|
|
3059
3354
|
export enum EDBMasterInputTextAppendTo {
|
|
3060
3355
|
visible = 'visible',
|
|
@@ -3262,6 +3557,8 @@ export enum EDBMasterFormControl {
|
|
|
3262
3557
|
radio = 'radio',
|
|
3263
3558
|
color_picker = 'color_picker',
|
|
3264
3559
|
dropdown = 'dropdown',
|
|
3560
|
+
auto_complete = 'auto_complete',
|
|
3561
|
+
multi_select = 'multi_select',
|
|
3265
3562
|
file_upload = 'file_upload',
|
|
3266
3563
|
grid = 'grid',
|
|
3267
3564
|
divider = 'divider',
|
|
@@ -3276,6 +3573,10 @@ export enum EDBMasterFormControl {
|
|
|
3276
3573
|
customHTML = 'customHTML',
|
|
3277
3574
|
}
|
|
3278
3575
|
|
|
3576
|
+
export enum EDBMasterCustomActionButtonAppendTo {
|
|
3577
|
+
click = 'click',
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3279
3580
|
// genericConfig : end
|
|
3280
3581
|
|
|
3281
3582
|
export interface IDBMasterMessageFromIframeToParent {
|