@luomus/laji-form 15.1.120 → 15.1.121
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.
|
@@ -488,7 +488,7 @@ export default class LajiForm extends React.Component<LajiFormProps, LajiFormSta
|
|
|
488
488
|
addEventListener: (target: typeof document | typeof window, name: string, fn: (e: Event) => void) => void;
|
|
489
489
|
setTimeout: (fn: () => void, time?: number) => number;
|
|
490
490
|
destroy: () => void;
|
|
491
|
-
getSchemaValidationErrors: (formData: any) =>
|
|
491
|
+
getSchemaValidationErrors: (formData: any) => ErrorSchema;
|
|
492
492
|
getFormDataReadyForSubmit: (formData: any, schema: JSONSchema) => {
|
|
493
493
|
formData: any;
|
|
494
494
|
removedArrayItemsAndObjects: string[];
|
|
@@ -377,7 +377,7 @@ class LajiForm extends React.Component {
|
|
|
377
377
|
ignoreErrorPaths.forEach(path => {
|
|
378
378
|
schemaErrors = (0, utils_1.immutableDelete)(schemaErrors, path);
|
|
379
379
|
});
|
|
380
|
-
return schemaErrors;
|
|
380
|
+
return removeEmptyErrorObjects(schemaErrors);
|
|
381
381
|
};
|
|
382
382
|
this.getFormDataReadyForSubmit = (formData, schema) => {
|
|
383
383
|
formData = this.memoizedFormContext.services.ids.removeLajiFormIds(formData);
|
|
@@ -597,6 +597,21 @@ const removeEmptyValuesAndTrim = (formData, schema) => {
|
|
|
597
597
|
return formData;
|
|
598
598
|
}
|
|
599
599
|
};
|
|
600
|
+
const removeEmptyErrorObjects = (errors) => {
|
|
601
|
+
const result = {};
|
|
602
|
+
for (const key of Object.keys(errors)) {
|
|
603
|
+
if (key === "__errors") {
|
|
604
|
+
result[key] = errors[key];
|
|
605
|
+
}
|
|
606
|
+
else if (errors[key]) {
|
|
607
|
+
const cleanedValue = removeEmptyErrorObjects(errors[key]);
|
|
608
|
+
if (Object.keys(cleanedValue).length > 0) {
|
|
609
|
+
result[key] = cleanedValue;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return Object.keys(result).length === 0 ? {} : result;
|
|
614
|
+
};
|
|
600
615
|
const getShortcuts = (uiSchema) => {
|
|
601
616
|
var _a, _b;
|
|
602
617
|
if ((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.platform) === null || _b === void 0 ? void 0 : _b.includes("Mac")) {
|
package/package.json
CHANGED
|
@@ -268,4 +268,5 @@ export declare const maybeJSONPointerToLocator: (pointer: string) => string;
|
|
|
268
268
|
/** Fills value into given input and presses tab to unfocus it. Useful for inputs with debounce */
|
|
269
269
|
export declare const updateValue: ($input: Locator, value: string) => Promise<void>;
|
|
270
270
|
export declare const getRemoveUnit: (page: Page) => (gatheringIdx: number, unitIdx: number) => Promise<void>;
|
|
271
|
+
export declare const getRemoveIdentification: (page: Page) => (gatheringIdx: number, unitIdx: number, identificationIdx: number) => Promise<void>;
|
|
271
272
|
export {};
|
|
@@ -53,7 +53,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
53
53
|
return t;
|
|
54
54
|
};
|
|
55
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
-
exports.getRemoveUnit = exports.updateValue = exports.maybeJSONPointerToLocator = exports.filterUUIDs = exports.mockImageMetadata = exports.DemoPageForm = exports.Form = exports.getFocusedId = exports.getFocusedElement = exports.lajiFormLocate = exports.lajiFormLocator = exports.navigateToForm = exports.emptyForm = void 0;
|
|
56
|
+
exports.getRemoveIdentification = exports.getRemoveUnit = exports.updateValue = exports.maybeJSONPointerToLocator = exports.filterUUIDs = exports.mockImageMetadata = exports.DemoPageForm = exports.Form = exports.getFocusedId = exports.getFocusedElement = exports.lajiFormLocate = exports.lajiFormLocator = exports.navigateToForm = exports.emptyForm = void 0;
|
|
57
57
|
exports.createForm = createForm;
|
|
58
58
|
const path = __importStar(require("path"));
|
|
59
59
|
const test_utils_1 = require("@luomus/laji-map/test-export/test-utils");
|
|
@@ -415,3 +415,8 @@ const getRemoveUnit = (page) => (gatheringIdx, unitIdx) => __awaiter(void 0, voi
|
|
|
415
415
|
return page.locator(`#root_gatherings_${gatheringIdx}_units_${unitIdx}-delete-confirm-yes`).click();
|
|
416
416
|
});
|
|
417
417
|
exports.getRemoveUnit = getRemoveUnit;
|
|
418
|
+
const getRemoveIdentification = (page) => (gatheringIdx, unitIdx, identificationIdx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
419
|
+
yield page.locator(`#root_gatherings_${gatheringIdx}_units_${unitIdx}_identifications_${identificationIdx}-delete`).click();
|
|
420
|
+
return page.locator(`#root_gatherings_${gatheringIdx}_units_${unitIdx}_identifications_${identificationIdx}-delete-confirm-yes`).click();
|
|
421
|
+
});
|
|
422
|
+
exports.getRemoveIdentification = getRemoveIdentification;
|