drf-react-by-schema 0.17.17 → 0.18.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/api.d.ts +17 -16
- package/dist/api.js +28 -28
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts +0 -1
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.js +1 -2
- package/dist/components/DataGridBySchemaEditable/ConfirmDialog.d.ts +1 -1
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.js +17 -7
- package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts +4 -4
- package/dist/components/DataGridBySchemaEditable/InputInterval.js +17 -7
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts +0 -1
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.js +21 -9
- package/dist/components/DataGridBySchemaEditable/utils.d.ts +1 -2
- package/dist/components/DataGridBySchemaEditable/utils.js +2 -2
- package/dist/components/DataGridBySchemaEditable.js +24 -14
- package/dist/components/DataTotals.d.ts +2 -2
- package/dist/components/DataTotalsServer.d.ts +2 -2
- package/dist/components/DialogActions.d.ts +1 -1
- package/dist/components/DialogActions.js +1 -1
- package/dist/components/FormButtons.d.ts +1 -1
- package/dist/components/FormButtons.js +1 -1
- package/dist/components/GenericModelList.d.ts +2 -2
- package/dist/components/GenericModelList.js +17 -7
- package/dist/components/GenericRelatedModelList.d.ts +2 -2
- package/dist/components/GenericRelatedModelList.js +18 -8
- package/dist/components/details/DetailBySchema.d.ts +2 -2
- package/dist/components/details/DetailBySchema.js +18 -8
- package/dist/components/details/DetailFieldBySchema.d.ts +2 -2
- package/dist/components/details/DetailFieldBySchema.js +1 -1
- package/dist/components/forms/DialogFormBySchema.d.ts +4 -2
- package/dist/components/forms/DialogFormBySchema.js +22 -12
- package/dist/components/forms/FieldBySchema.d.ts +2 -2
- package/dist/components/forms/FieldBySchema.js +1 -1
- package/dist/components/forms/FormBySchema.d.ts +2 -2
- package/dist/components/forms/FormBySchema.js +18 -8
- package/dist/components/forms/inputs/AutocompleteFieldBySchema.d.ts +2 -2
- package/dist/components/forms/inputs/AutocompleteFieldBySchema.js +1 -1
- package/dist/components/forms/inputs/BooleanFieldBySchema.d.ts +2 -2
- package/dist/components/forms/inputs/BooleanFieldBySchema.js +1 -1
- package/dist/components/forms/inputs/DesktopDatePickerBySchema.d.ts +2 -2
- package/dist/components/forms/inputs/DesktopDatePickerBySchema.js +1 -1
- package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.d.ts +2 -2
- package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.js +1 -1
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts +2 -1
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.js +20 -7
- package/dist/components/forms/inputs/FloatFieldBySchema.d.ts +2 -2
- package/dist/components/forms/inputs/FloatFieldBySchema.js +1 -1
- package/dist/components/forms/inputs/TextFieldBySchema.d.ts +2 -2
- package/dist/components/forms/inputs/TextFieldBySchema.js +1 -1
- package/dist/context/APIWrapper.d.ts +1 -1
- package/dist/context/APIWrapper.js +28 -15
- package/dist/context/APIWrapperContext.d.ts +2 -0
- package/dist/context/DRFReactBySchemaProvider.d.ts +1 -1
- package/dist/context/Form.d.ts +1 -1
- package/dist/context/Overlays.d.ts +1 -1
- package/dist/context/Overlays.js +19 -9
- package/dist/styles/index.js +17 -7
- package/dist/styles/layout.d.ts +1 -1
- package/dist/styles/theme.d.ts +1 -1
- package/dist/utils.d.ts +7 -6
- package/dist/utils.js +21 -11
- package/package.json +1 -1
- package/dist/components/DialogJSONSchemaForm.d.ts +0 -13
- package/dist/components/DialogJSONSchemaForm.js +0 -20
package/dist/api.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AxiosError } from 'axios';
|
|
1
2
|
import { serverEndPointType } from './context/DRFReactBySchemaContext';
|
|
2
3
|
import { Item, SchemaType, DataSchemaColumnsType, ItemSchemaColumnsType, Id, TargetApiParams, TargetApiPostParams, GetGenericModelListProps } from './utils';
|
|
3
4
|
interface TargetApiParamsOptionalId {
|
|
@@ -9,49 +10,49 @@ interface TargetApiParamsOptionalId {
|
|
|
9
10
|
export declare const getRawData: ({ path, serverEndPoint, }: {
|
|
10
11
|
path: string;
|
|
11
12
|
serverEndPoint: serverEndPointType | null;
|
|
12
|
-
}) => Promise<any
|
|
13
|
+
}) => Promise<Item[] | AxiosError<unknown, any>>;
|
|
13
14
|
/**
|
|
14
15
|
*
|
|
15
16
|
* @param options - params
|
|
16
17
|
* @returns updatedData when succesfully updated, axiosError otherwise
|
|
17
18
|
*/
|
|
18
|
-
export declare const updateData: ({ path, serverEndPoint, data, id }: TargetApiParams) => Promise<any
|
|
19
|
-
export declare const partialUpdateData: ({ path, serverEndPoint, data, id }: TargetApiParams) => Promise<any
|
|
20
|
-
export declare const createData: ({ path, serverEndPoint, data }: TargetApiPostParams) => Promise<any
|
|
21
|
-
export declare const deleteData: (path: string, serverEndPoint: serverEndPointType | null, id: Id) => Promise<any
|
|
22
|
-
export declare const createOrUpdateData: ({ path, serverEndPoint, data, id, }: TargetApiParamsOptionalId) => Promise<any
|
|
19
|
+
export declare const updateData: ({ path, serverEndPoint, data, id }: TargetApiParams) => Promise<Item | AxiosError<unknown, any>>;
|
|
20
|
+
export declare const partialUpdateData: ({ path, serverEndPoint, data, id }: TargetApiParams) => Promise<Item | AxiosError<unknown, any>>;
|
|
21
|
+
export declare const createData: ({ path, serverEndPoint, data }: TargetApiPostParams) => Promise<Item | AxiosError<unknown, any>>;
|
|
22
|
+
export declare const deleteData: (path: string, serverEndPoint: serverEndPointType | null, id: Id) => Promise<true | AxiosError<unknown, any>>;
|
|
23
|
+
export declare const createOrUpdateData: ({ path, serverEndPoint, data, id, }: TargetApiParamsOptionalId) => Promise<Item | AxiosError<unknown, any>>;
|
|
23
24
|
export declare const updateDataBySchema: ({ model, modelObjectId, serverEndPoint, data, schema, path, }: {
|
|
24
25
|
model: string;
|
|
25
26
|
modelObjectId: Id;
|
|
26
27
|
serverEndPoint: serverEndPointType | null;
|
|
27
28
|
data: Item;
|
|
28
29
|
schema: SchemaType;
|
|
29
|
-
path?: string | null
|
|
30
|
-
}) => Promise<any
|
|
30
|
+
path?: string | null;
|
|
31
|
+
}) => Promise<Item | AxiosError<unknown, any>>;
|
|
31
32
|
export declare const addExistingRelatedModel: ({ model, serverEndPoint, id, data, }: {
|
|
32
33
|
model: string;
|
|
33
34
|
serverEndPoint: serverEndPointType | null;
|
|
34
35
|
id: Id;
|
|
35
36
|
data: Item;
|
|
36
|
-
}) => Promise<any
|
|
37
|
+
}) => Promise<Item | AxiosError<unknown, any>>;
|
|
37
38
|
export declare const getAutoComplete: ({ model, serverEndPoint, }: {
|
|
38
39
|
model: string;
|
|
39
40
|
serverEndPoint: serverEndPointType | null;
|
|
40
41
|
}) => Promise<false | Item[]>;
|
|
41
|
-
export declare const loginByPayload: (payload: Item, serverEndPoint: serverEndPointType | null) => Promise<any
|
|
42
|
+
export declare const loginByPayload: (payload: Item, serverEndPoint: serverEndPointType | null) => Promise<boolean | AxiosError<unknown, any>>;
|
|
42
43
|
export declare const clearJWT: () => boolean;
|
|
43
44
|
export declare const hasJWT: () => boolean;
|
|
44
45
|
export declare const setAuthToken: (token: string | null) => void;
|
|
45
46
|
export declare const isLoggedIn: (serverEndPoint: serverEndPointType | null) => Promise<false | Item>;
|
|
46
|
-
export declare const getSignUpOptions: (serverEndPoint: serverEndPointType | null) => Promise<any
|
|
47
|
-
export declare const signUp: (data: Item, serverEndPoint: serverEndPointType | null) => Promise<any
|
|
47
|
+
export declare const getSignUpOptions: (serverEndPoint: serverEndPointType | null) => Promise<SchemaType | AxiosError<unknown, any>>;
|
|
48
|
+
export declare const signUp: (data: Item, serverEndPoint: serverEndPointType | null) => Promise<Item | AxiosError<unknown, any>>;
|
|
48
49
|
export declare const getGenericModelList: ({ model, serverEndPoint, id, relatedModel, relatedModelId, columnFields, hiddenFields, creatableFields, disabledFields, isInBatches, loadedSchema, loadedModelOptions, page, filter, queryParams, sort, sumRows, }: GetGenericModelListProps) => Promise<false | DataSchemaColumnsType>;
|
|
49
50
|
export declare const getGenericModel: ({ model, serverEndPoint, id, relatedModel, relatedModelId, }: {
|
|
50
51
|
model: string;
|
|
51
52
|
serverEndPoint: serverEndPointType | null;
|
|
52
|
-
id?: Id
|
|
53
|
-
relatedModel?: string
|
|
54
|
-
relatedModelId?: string
|
|
53
|
+
id?: Id;
|
|
54
|
+
relatedModel?: string;
|
|
55
|
+
relatedModelId?: string;
|
|
55
56
|
}) => Promise<false | ItemSchemaColumnsType>;
|
|
56
|
-
export declare const getAllModels: (serverEndPoint: serverEndPointType | null) => Promise<any
|
|
57
|
+
export declare const getAllModels: (serverEndPoint: serverEndPointType | null) => Promise<Item[] | AxiosError<unknown, any>>;
|
|
57
58
|
export {};
|
package/dist/api.js
CHANGED
|
@@ -106,7 +106,7 @@ const getSchema = (path, serverEndPoint) => __awaiter(void 0, void 0, void 0, fu
|
|
|
106
106
|
};
|
|
107
107
|
return { schema: options.actions.POST, modelOptions };
|
|
108
108
|
});
|
|
109
|
-
const getRawData = (
|
|
109
|
+
const getRawData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ path, serverEndPoint, }) {
|
|
110
110
|
var _b;
|
|
111
111
|
if (!serverEndPoint) {
|
|
112
112
|
return {
|
|
@@ -154,8 +154,8 @@ const getRawData = ({ path, serverEndPoint, }) => __awaiter(void 0, void 0, void
|
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
156
|
exports.getRawData = getRawData;
|
|
157
|
-
const getData = (
|
|
158
|
-
var
|
|
157
|
+
const getData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ path, serverEndPoint, route = 'api', }) {
|
|
158
|
+
var _b;
|
|
159
159
|
if (!serverEndPoint) {
|
|
160
160
|
return {
|
|
161
161
|
message: noServerEndPointMessage,
|
|
@@ -170,7 +170,7 @@ const getData = ({ path, serverEndPoint, route = 'api', }) => __awaiter(void 0,
|
|
|
170
170
|
catch (e) {
|
|
171
171
|
if (axios_1.default.isAxiosError(e)) {
|
|
172
172
|
const err = e;
|
|
173
|
-
if (((
|
|
173
|
+
if (((_b = err.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
|
|
174
174
|
const isRefreshed = yield refreshToken(serverEndPoint);
|
|
175
175
|
if (!isRefreshed) {
|
|
176
176
|
console.log(expiredTokenMessage);
|
|
@@ -205,8 +205,8 @@ const getData = ({ path, serverEndPoint, route = 'api', }) => __awaiter(void 0,
|
|
|
205
205
|
* @param options - params
|
|
206
206
|
* @returns updatedData when succesfully updated, axiosError otherwise
|
|
207
207
|
*/
|
|
208
|
-
const updateData = (
|
|
209
|
-
var
|
|
208
|
+
const updateData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ path, serverEndPoint, data, id }) {
|
|
209
|
+
var _b, _c, _d;
|
|
210
210
|
if (!serverEndPoint) {
|
|
211
211
|
return {
|
|
212
212
|
message: noServerEndPointMessage,
|
|
@@ -222,7 +222,7 @@ const updateData = ({ path, serverEndPoint, data, id }) => __awaiter(void 0, voi
|
|
|
222
222
|
if (axios_1.default.isAxiosError(e)) {
|
|
223
223
|
const err = e;
|
|
224
224
|
const message = `Error updating data at ${url}`;
|
|
225
|
-
if (((
|
|
225
|
+
if (((_b = err.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
|
|
226
226
|
const isRefreshed = yield refreshToken(serverEndPoint);
|
|
227
227
|
if (!isRefreshed) {
|
|
228
228
|
console.log(expiredTokenMessage);
|
|
@@ -236,19 +236,19 @@ const updateData = ({ path, serverEndPoint, data, id }) => __awaiter(void 0, voi
|
|
|
236
236
|
return updatedData;
|
|
237
237
|
}
|
|
238
238
|
catch (e) {
|
|
239
|
-
console.log(message, data, (
|
|
239
|
+
console.log(message, data, (_c = err.response) === null || _c === void 0 ? void 0 : _c.data);
|
|
240
240
|
return { message, isAxiosError: true };
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
console.log(message, data, (
|
|
243
|
+
console.log(message, data, (_d = err.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
244
244
|
return { message, isAxiosError: true };
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
return { message: unknownError, isAxiosError: true };
|
|
248
248
|
});
|
|
249
249
|
exports.updateData = updateData;
|
|
250
|
-
const partialUpdateData = (
|
|
251
|
-
var
|
|
250
|
+
const partialUpdateData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ path, serverEndPoint, data, id }) {
|
|
251
|
+
var _b, _c;
|
|
252
252
|
if (!serverEndPoint) {
|
|
253
253
|
return {
|
|
254
254
|
message: noServerEndPointMessage,
|
|
@@ -264,7 +264,7 @@ const partialUpdateData = ({ path, serverEndPoint, data, id }) => __awaiter(void
|
|
|
264
264
|
if (axios_1.default.isAxiosError(e)) {
|
|
265
265
|
const err = e;
|
|
266
266
|
const message = `Error partial updating data at ${url}`;
|
|
267
|
-
if (((
|
|
267
|
+
if (((_b = err.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
|
|
268
268
|
const isRefreshed = yield refreshToken(serverEndPoint);
|
|
269
269
|
if (!isRefreshed) {
|
|
270
270
|
console.log(expiredTokenMessage);
|
|
@@ -285,7 +285,7 @@ const partialUpdateData = ({ path, serverEndPoint, data, id }) => __awaiter(void
|
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
console.log(message, data, (
|
|
288
|
+
console.log(message, data, (_c = err.response) === null || _c === void 0 ? void 0 : _c.data);
|
|
289
289
|
return {
|
|
290
290
|
message: err.response ? err.response.data : message,
|
|
291
291
|
isAxiosError: true,
|
|
@@ -295,8 +295,8 @@ const partialUpdateData = ({ path, serverEndPoint, data, id }) => __awaiter(void
|
|
|
295
295
|
return { message: unknownError, isAxiosError: true };
|
|
296
296
|
});
|
|
297
297
|
exports.partialUpdateData = partialUpdateData;
|
|
298
|
-
const createData = (
|
|
299
|
-
var
|
|
298
|
+
const createData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ path, serverEndPoint, data }) {
|
|
299
|
+
var _b, _c;
|
|
300
300
|
if (!serverEndPoint) {
|
|
301
301
|
return {
|
|
302
302
|
message: noServerEndPointMessage,
|
|
@@ -312,7 +312,7 @@ const createData = ({ path, serverEndPoint, data }) => __awaiter(void 0, void 0,
|
|
|
312
312
|
if (axios_1.default.isAxiosError(e)) {
|
|
313
313
|
const err = e;
|
|
314
314
|
const message = `Error creating data at ${url}`;
|
|
315
|
-
if (((
|
|
315
|
+
if (((_b = err.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
|
|
316
316
|
const isRefreshed = yield refreshToken(serverEndPoint);
|
|
317
317
|
if (!isRefreshed) {
|
|
318
318
|
console.log(expiredTokenMessage);
|
|
@@ -333,7 +333,7 @@ const createData = ({ path, serverEndPoint, data }) => __awaiter(void 0, void 0,
|
|
|
333
333
|
};
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
console.log(message, data, (
|
|
336
|
+
console.log(message, data, (_c = err.response) === null || _c === void 0 ? void 0 : _c.data);
|
|
337
337
|
return {
|
|
338
338
|
message: err.response ? err.response.data : message,
|
|
339
339
|
isAxiosError: true,
|
|
@@ -347,7 +347,7 @@ const createData = ({ path, serverEndPoint, data }) => __awaiter(void 0, void 0,
|
|
|
347
347
|
});
|
|
348
348
|
exports.createData = createData;
|
|
349
349
|
const deleteData = (path, serverEndPoint, id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
350
|
-
var
|
|
350
|
+
var _a;
|
|
351
351
|
if (!serverEndPoint) {
|
|
352
352
|
return {
|
|
353
353
|
message: noServerEndPointMessage,
|
|
@@ -363,7 +363,7 @@ const deleteData = (path, serverEndPoint, id) => __awaiter(void 0, void 0, void
|
|
|
363
363
|
if (axios_1.default.isAxiosError(e)) {
|
|
364
364
|
const err = e;
|
|
365
365
|
const message = `Error deleting data from ${url}`;
|
|
366
|
-
if (((
|
|
366
|
+
if (((_a = err.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
|
|
367
367
|
const isRefreshed = yield refreshToken(serverEndPoint);
|
|
368
368
|
if (!isRefreshed) {
|
|
369
369
|
console.log(expiredTokenMessage);
|
|
@@ -397,7 +397,7 @@ const deleteData = (path, serverEndPoint, id) => __awaiter(void 0, void 0, void
|
|
|
397
397
|
};
|
|
398
398
|
});
|
|
399
399
|
exports.deleteData = deleteData;
|
|
400
|
-
const createOrUpdateData = (
|
|
400
|
+
const createOrUpdateData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ path, serverEndPoint, data, id, }) {
|
|
401
401
|
if ((0, utils_1.isTmpId)(id) || !id) {
|
|
402
402
|
const responseCreate = yield (0, exports.createData)({ path, serverEndPoint, data });
|
|
403
403
|
return responseCreate;
|
|
@@ -465,7 +465,7 @@ const prepareDataBySchema = ({ data, schema }) => {
|
|
|
465
465
|
// console.log({dbData});
|
|
466
466
|
return dbData;
|
|
467
467
|
};
|
|
468
|
-
const updateDataBySchema = ({ model, modelObjectId, serverEndPoint, data, schema, path = null, })
|
|
468
|
+
const updateDataBySchema = (_a) => __awaiter(void 0, [_a], void 0, function* ({ model, modelObjectId, serverEndPoint, data, schema, path = null, }) {
|
|
469
469
|
const dbData = prepareDataBySchema({ data, schema });
|
|
470
470
|
if (!path) {
|
|
471
471
|
path = model;
|
|
@@ -480,7 +480,7 @@ const updateDataBySchema = ({ model, modelObjectId, serverEndPoint, data, schema
|
|
|
480
480
|
return response;
|
|
481
481
|
});
|
|
482
482
|
exports.updateDataBySchema = updateDataBySchema;
|
|
483
|
-
const addExistingRelatedModel = (
|
|
483
|
+
const addExistingRelatedModel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ model, serverEndPoint, id, data, }) {
|
|
484
484
|
const response = yield (0, exports.partialUpdateData)({ path: model, serverEndPoint, data, id });
|
|
485
485
|
return response;
|
|
486
486
|
});
|
|
@@ -507,7 +507,7 @@ const getDataGridColumns = (schema, columnFields = [], hiddenFields = [], creata
|
|
|
507
507
|
return column;
|
|
508
508
|
});
|
|
509
509
|
};
|
|
510
|
-
const getAutoComplete = (
|
|
510
|
+
const getAutoComplete = (_a) => __awaiter(void 0, [_a], void 0, function* ({ model, serverEndPoint, }) {
|
|
511
511
|
const data = yield getData({ path: `${model}/`, serverEndPoint, route: 'autocomplete' });
|
|
512
512
|
if ('isAxiosError' in data) {
|
|
513
513
|
return false;
|
|
@@ -626,7 +626,7 @@ const getSignUpOptions = (serverEndPoint) => __awaiter(void 0, void 0, void 0, f
|
|
|
626
626
|
});
|
|
627
627
|
exports.getSignUpOptions = getSignUpOptions;
|
|
628
628
|
const signUp = (data, serverEndPoint) => __awaiter(void 0, void 0, void 0, function* () {
|
|
629
|
-
var
|
|
629
|
+
var _a;
|
|
630
630
|
if (!serverEndPoint || !serverEndPoint.signUp) {
|
|
631
631
|
return {
|
|
632
632
|
message: noServerEndPointMessage,
|
|
@@ -642,7 +642,7 @@ const signUp = (data, serverEndPoint) => __awaiter(void 0, void 0, void 0, funct
|
|
|
642
642
|
if (axios_1.default.isAxiosError(e)) {
|
|
643
643
|
const err = e;
|
|
644
644
|
const message = `Error trying signUp at ${url}`;
|
|
645
|
-
if (((
|
|
645
|
+
if (((_a = err.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
|
|
646
646
|
const isRefreshed = yield refreshToken(serverEndPoint);
|
|
647
647
|
if (!isRefreshed) {
|
|
648
648
|
console.log(expiredTokenMessage);
|
|
@@ -677,7 +677,7 @@ const signUp = (data, serverEndPoint) => __awaiter(void 0, void 0, void 0, funct
|
|
|
677
677
|
};
|
|
678
678
|
});
|
|
679
679
|
exports.signUp = signUp;
|
|
680
|
-
const getGenericModelList = ({ model, serverEndPoint, id = '', relatedModel = '', relatedModelId = '', columnFields, hiddenFields = ['id'], creatableFields = [], disabledFields = [], isInBatches = false, loadedSchema, loadedModelOptions, page, filter, queryParams = [], sort, sumRows, })
|
|
680
|
+
const getGenericModelList = (_a) => __awaiter(void 0, [_a], void 0, function* ({ model, serverEndPoint, id = '', relatedModel = '', relatedModelId = '', columnFields, hiddenFields = ['id'], creatableFields = [], disabledFields = [], isInBatches = false, loadedSchema, loadedModelOptions, page, filter, queryParams = [], sort, sumRows, }) {
|
|
681
681
|
const newQueryParams = [...queryParams];
|
|
682
682
|
let path = `${model}/${id}`;
|
|
683
683
|
let schemaPath = `${model}/`;
|
|
@@ -787,10 +787,10 @@ const getGenericModelList = ({ model, serverEndPoint, id = '', relatedModel = ''
|
|
|
787
787
|
return { data, columns, schema, modelOptions, rowCount, sumRowsTotals };
|
|
788
788
|
});
|
|
789
789
|
exports.getGenericModelList = getGenericModelList;
|
|
790
|
-
const getGenericModel = ({ model, serverEndPoint, id = '', relatedModel = '', relatedModelId = '', })
|
|
790
|
+
const getGenericModel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ model, serverEndPoint, id = '', relatedModel = '', relatedModelId = '', }) {
|
|
791
791
|
let path = `${model}/${id}`;
|
|
792
792
|
let schemaPath = `${model}/`;
|
|
793
|
-
if (id && relatedModel) {
|
|
793
|
+
if (!(0, utils_1.isTmpId)(id) && relatedModel) {
|
|
794
794
|
path += `/${relatedModel}/`;
|
|
795
795
|
if (relatedModelId) {
|
|
796
796
|
path += `${relatedModelId}/`;
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.BooleanInputCell =
|
|
15
|
+
exports.BooleanInputCell = BooleanInputCell;
|
|
16
16
|
const react_1 = __importDefault(require("react"));
|
|
17
17
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
18
18
|
const Checkbox_1 = __importDefault(require("@mui/material/Checkbox"));
|
|
@@ -39,4 +39,3 @@ function BooleanInputCell({ field, id, value, sx = {} }) {
|
|
|
39
39
|
handleChange(event.target.checked);
|
|
40
40
|
}, sx: sx }));
|
|
41
41
|
}
|
|
42
|
-
exports.BooleanInputCell = BooleanInputCell;
|
|
@@ -4,5 +4,5 @@ type FConfirmDialogProps = {
|
|
|
4
4
|
onClose: (p: any) => void;
|
|
5
5
|
onConfirm: (p: any) => void;
|
|
6
6
|
};
|
|
7
|
-
export declare const ConfirmDialog: React.MemoExoticComponent<({ open, onClose, onConfirm }: FConfirmDialogProps) => JSX.Element>;
|
|
7
|
+
export declare const ConfirmDialog: React.MemoExoticComponent<({ open, onClose, onConfirm }: FConfirmDialogProps) => React.JSX.Element>;
|
|
8
8
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { BulkDeleteData, BulkUpdateData, GridEnrichedBySchemaColDef, Id, Item, OnSelectActions } from '../../utils';
|
|
3
3
|
type CustomToolbarProps = {
|
|
4
4
|
preparedColumns: GridEnrichedBySchemaColDef[];
|
|
@@ -19,5 +19,5 @@ type CustomToolbarProps = {
|
|
|
19
19
|
*
|
|
20
20
|
* @returns Custom Toolbar for the grid
|
|
21
21
|
*/
|
|
22
|
-
export declare const CustomToolbar: ({ preparedColumns, setPreparedColumns, onSelectActions, selectionModel, bulkUpdateData, bulkDeleteData, bulkCreateData, hideColumnsButton, hideFilterButton, hideDensityButton, hideExportButton, hideQuickFilterBar, }: CustomToolbarProps) => JSX.Element;
|
|
22
|
+
export declare const CustomToolbar: ({ preparedColumns, setPreparedColumns, onSelectActions, selectionModel, bulkUpdateData, bulkDeleteData, bulkCreateData, hideColumnsButton, hideFilterButton, hideDensityButton, hideExportButton, hideQuickFilterBar, }: CustomToolbarProps) => React.JSX.Element;
|
|
23
23
|
export {};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
type FooterToolbarProps = {
|
|
3
3
|
isEditable: boolean;
|
|
4
4
|
handleAddItem: () => void;
|
|
5
5
|
};
|
|
6
|
-
export declare const FooterToolbar: ({ isEditable, handleAddItem }: FooterToolbarProps) => JSX.Element;
|
|
6
|
+
export declare const FooterToolbar: ({ isEditable, handleAddItem }: FooterToolbarProps) => React.JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { DateView } from '@mui/x-date-pickers';
|
|
3
3
|
import { GenericValue } from '../../utils';
|
|
4
4
|
type GridDateInputProps = {
|
|
@@ -8,5 +8,5 @@ type GridDateInputProps = {
|
|
|
8
8
|
column: object;
|
|
9
9
|
dateViews?: DateView[];
|
|
10
10
|
};
|
|
11
|
-
export declare const GridDateInput: ({ id, value, field, dateViews }: GridDateInputProps) => JSX.Element;
|
|
11
|
+
export declare const GridDateInput: ({ id, value, field, dateViews }: GridDateInputProps) => React.JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
type GridDecimalInputProps = {
|
|
3
3
|
field: string;
|
|
4
4
|
id: number | string;
|
|
@@ -9,5 +9,5 @@ type GridDecimalInputProps = {
|
|
|
9
9
|
suffix?: string;
|
|
10
10
|
isCurrency?: boolean;
|
|
11
11
|
};
|
|
12
|
-
export declare const GridDecimalInput: ({ id, value, field, decimalPlaces, prefix, suffix, isCurrency, }: GridDecimalInputProps) => JSX.Element;
|
|
12
|
+
export declare const GridDecimalInput: ({ id, value, field, decimalPlaces, prefix, suffix, isCurrency, }: GridDecimalInputProps) => React.JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
type GridPatternInputProps = {
|
|
3
3
|
field: string;
|
|
4
4
|
id: number | string;
|
|
5
5
|
value?: string | number | null;
|
|
6
6
|
patternFormat?: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const GridPatternInput: ({ id, value, field, patternFormat, }: GridPatternInputProps) => JSX.Element;
|
|
8
|
+
export declare const GridPatternInput: ({ id, value, field, patternFormat, }: GridPatternInputProps) => React.JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const InputNumberInterval: (props: any) => JSX.Element;
|
|
3
|
-
export declare const InputDateInterval: (props: any) => JSX.Element;
|
|
4
|
-
export declare const InputFloatInterval: (props: any) => JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const InputNumberInterval: (props: any) => React.JSX.Element;
|
|
3
|
+
export declare const InputDateInterval: (props: any) => React.JSX.Element;
|
|
4
|
+
export declare const InputFloatInterval: (props: any) => React.JSX.Element;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -35,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
46
|
};
|
|
37
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.SelectEditInputCell =
|
|
48
|
+
exports.SelectEditInputCell = SelectEditInputCell;
|
|
39
49
|
const react_1 = __importDefault(require("react"));
|
|
40
50
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
41
51
|
const TextField_1 = __importDefault(require("@mui/material/TextField"));
|
|
@@ -136,6 +146,9 @@ function SelectEditInputCell({ field, id, value, column, type, optionsAC, isInde
|
|
|
136
146
|
id: tmpId,
|
|
137
147
|
labelKey,
|
|
138
148
|
fieldsLayout,
|
|
149
|
+
initialValuesPartial: {
|
|
150
|
+
nome: newValue.inputValue, // TODO: make this "nome" generic!
|
|
151
|
+
},
|
|
139
152
|
});
|
|
140
153
|
}
|
|
141
154
|
// Define new Item as an "optimistic response"
|
|
@@ -167,4 +180,3 @@ function SelectEditInputCell({ field, id, value, column, type, optionsAC, isInde
|
|
|
167
180
|
react_1.default.createElement(Edit_1.default, null))),
|
|
168
181
|
params.InputProps.endAdornment)) }) }))) : (react_1.default.createElement(TextField_1.default, Object.assign({}, params, { sx: sx }))))) }, creatableProps)));
|
|
169
182
|
}
|
|
170
|
-
exports.SelectEditInputCell = SelectEditInputCell;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { GridApi } from '@mui/x-data-grid';
|
|
1
|
+
import { GridApi, GridFilterOperator } from '@mui/x-data-grid';
|
|
3
2
|
import { GridEnrichedBySchemaColDef } from '../../utils';
|
|
4
3
|
export type ResizeType = 'condense' | 'maxContent' | 'fitScreen';
|
|
5
4
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.quantityOnlyOperators =
|
|
3
|
+
exports.quantityOnlyOperators = void 0;
|
|
4
|
+
exports.resizeColumns = resizeColumns;
|
|
4
5
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
5
6
|
const InputInterval_1 = require("./InputInterval");
|
|
6
7
|
/**
|
|
@@ -63,7 +64,6 @@ function resizeColumns(columns, resizeType, apiRef) {
|
|
|
63
64
|
});
|
|
64
65
|
return cols;
|
|
65
66
|
}
|
|
66
|
-
exports.resizeColumns = resizeColumns;
|
|
67
67
|
const quantityOnlyOperators = ({ type }) => {
|
|
68
68
|
const builtInFilters = type === 'date' ? (0, x_data_grid_1.getGridDateOperators)() : (0, x_data_grid_1.getGridNumericOperators)();
|
|
69
69
|
let InputComponent = InputInterval_1.InputNumberInterval;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -78,7 +88,7 @@ const DataGridBySchemaEditable = (0, react_1.forwardRef)(({ schema, data, rowCou
|
|
|
78
88
|
const [preparedColumns, setPreparedColumns] = (0, react_1.useState)(null);
|
|
79
89
|
const [dataGridLoading, setDataGridLoading] = (0, react_1.useState)(false);
|
|
80
90
|
const [rowModesModel, setRowModesModel] = (0, react_1.useState)();
|
|
81
|
-
const [
|
|
91
|
+
const [confirmDialogOpen, setConfirmDialogOpen] = (0, react_1.useState)(false);
|
|
82
92
|
const [selectionModel, setSelectionModel] = (0, react_1.useState)([]);
|
|
83
93
|
const [selectionModelIds, setSelectionModelIds] = (0, react_1.useState)([]);
|
|
84
94
|
const optionsAC = (0, react_1.useRef)(null);
|
|
@@ -520,16 +530,16 @@ const DataGridBySchemaEditable = (0, react_1.forwardRef)(({ schema, data, rowCou
|
|
|
520
530
|
msg: 'Linhas adicionadas com sucesso',
|
|
521
531
|
});
|
|
522
532
|
});
|
|
523
|
-
const
|
|
524
|
-
|
|
533
|
+
const handleConfirmDialogClose = () => {
|
|
534
|
+
setConfirmDialogOpen(false);
|
|
525
535
|
};
|
|
526
536
|
const handleDeleteClick = (id) => () => {
|
|
527
537
|
idToRemove.current = id;
|
|
528
|
-
|
|
538
|
+
setConfirmDialogOpen(true);
|
|
529
539
|
};
|
|
530
540
|
const handleDeleteSave = () => {
|
|
531
541
|
if (idToRemove.current === null) {
|
|
532
|
-
|
|
542
|
+
setConfirmDialogOpen(false);
|
|
533
543
|
return;
|
|
534
544
|
}
|
|
535
545
|
const newData = dataGrid.data.filter((row) => row.id !== idToRemove.current);
|
|
@@ -547,7 +557,7 @@ const DataGridBySchemaEditable = (0, react_1.forwardRef)(({ schema, data, rowCou
|
|
|
547
557
|
onDataChange(newData);
|
|
548
558
|
}
|
|
549
559
|
idToRemove.current = null;
|
|
550
|
-
|
|
560
|
+
setConfirmDialogOpen(false);
|
|
551
561
|
};
|
|
552
562
|
(0, react_1.useEffect)(() => {
|
|
553
563
|
if (!columns) {
|
|
@@ -826,7 +836,7 @@ const DataGridBySchemaEditable = (0, react_1.forwardRef)(({ schema, data, rowCou
|
|
|
826
836
|
}
|
|
827
837
|
}
|
|
828
838
|
: undefined })),
|
|
829
|
-
react_1.default.createElement(ConfirmDialog_1.ConfirmDialog, { open:
|
|
839
|
+
react_1.default.createElement(ConfirmDialog_1.ConfirmDialog, { open: confirmDialogOpen, onClose: handleConfirmDialogClose, onConfirm: handleDeleteSave }),
|
|
830
840
|
react_1.default.createElement(Snackbar_1.default, { open: snackBar.open, autoHideDuration: 5000, onClose: () => {
|
|
831
841
|
setSnackBar(Object.assign(Object.assign({}, initialSnackBar), { open: false }));
|
|
832
842
|
}, anchorOrigin: { vertical: 'top', horizontal: 'center' } },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { GridRowId } from '@mui/x-data-grid';
|
|
3
3
|
import { Item, SumRowsType } from '../utils';
|
|
4
4
|
interface DataTotalsProps {
|
|
@@ -6,5 +6,5 @@ interface DataTotalsProps {
|
|
|
6
6
|
sumRows?: SumRowsType;
|
|
7
7
|
visibleRows: GridRowId[];
|
|
8
8
|
}
|
|
9
|
-
declare const DataTotals: ({ data, sumRows, visibleRows }: DataTotalsProps) => JSX.Element;
|
|
9
|
+
declare const DataTotals: ({ data, sumRows, visibleRows }: DataTotalsProps) => React.JSX.Element;
|
|
10
10
|
export default DataTotals;
|