mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 11:33:04 +00:00
Fixed merge issue
This commit is contained in:
@@ -81,7 +81,7 @@ export class DsDynamicGroupComponent implements OnDestroy, OnInit {
|
||||
|
||||
this.formId = this.formService.getUniqueId(this.model.id);
|
||||
this.formModel = this.formBuilderService.modelFromConfiguration(config, this.model.scopeUUID, {});
|
||||
this.chips = new Chips(this.model.value, 'value', this.model.mandatoryField, this.EnvConfig.submission.metadata.icons);
|
||||
this.chips = new Chips(this.model.value, 'value', this.model.mandatoryField);
|
||||
this.subs.push(
|
||||
this.chips.chipsItems
|
||||
.subscribe((subItems: any[]) => {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { isNotEmpty } from '../../../empty.util';
|
||||
import { isNotEmpty, isNotNull } from '../../../empty.util';
|
||||
|
||||
export class FormFieldMetadataValueObject {
|
||||
metadata?: string;
|
||||
|
@@ -2,6 +2,5 @@ export enum NotificationType {
|
||||
Success = 'alert-success',
|
||||
Error = 'alert-danger',
|
||||
Info = 'alert-info',
|
||||
Warning = 'alert-warning',
|
||||
// Bare = 'bare'
|
||||
Warning = 'alert-warning'
|
||||
}
|
||||
|
52
src/app/shared/object.util.ts
Normal file
52
src/app/shared/object.util.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { isNotEmpty } from './empty.util';
|
||||
import { isEqual, isObject, transform } from 'lodash';
|
||||
|
||||
/**
|
||||
* Returns passed object without specified property
|
||||
*/
|
||||
export function deleteProperty(object, key): object {
|
||||
const {[key]: deletedKey, ...otherKeys} = object;
|
||||
return otherKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the passed value is null or undefined.
|
||||
* hasNoValue(); // true
|
||||
* hasNoValue(null); // true
|
||||
* hasNoValue(undefined); // true
|
||||
* hasNoValue(''); // false
|
||||
* hasNoValue({}); // false
|
||||
* hasNoValue([]); // false
|
||||
* hasNoValue(function() {}); // false
|
||||
*/
|
||||
export function isObjectEmpty(obj: any): boolean {
|
||||
const objectType = typeof obj;
|
||||
if (objectType === 'object') {
|
||||
if (Object.keys(obj).length === 0) {
|
||||
return true;
|
||||
} else {
|
||||
let result = true;
|
||||
for (const key in obj) {
|
||||
if (isNotEmpty(obj[key])) {
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function difference(object, base) {
|
||||
const changes = (o, b) => {
|
||||
return transform(o, (result, value, key) => {
|
||||
if (!isEqual(value, b[key]) && isNotEmpty(value)) {
|
||||
const resultValue = (isObject(value) && isObject(b[key])) ? changes(value, b[key]) : value;
|
||||
if (!isObjectEmpty(resultValue)) {
|
||||
result[key] = resultValue;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
return changes(object, base);
|
||||
}
|
Reference in New Issue
Block a user