This commit is contained in:
2020-10-07 18:04:48 +00:00
parent 077a75589a
commit f753f586b7
3 changed files with 26 additions and 6 deletions

View File

@@ -254,6 +254,7 @@ export default {
//Get the field data type
//https://lodash.com/docs#find
//de-lodash
// let ctrlType = window.$gz. _.find(
// this.$store.state.formCustomTemplate[this.formKey],
// ["dataKey", dataKey]

View File

@@ -474,10 +474,13 @@ function synthesizeWorkingArray(vm) {
//first, insert the templated fields into the working array so they are in current selected order
for (let i = 0; i < template.length; i++) {
let templateItem = template[i];
let afItem = window.$gz._.find(vm.availableFields, [
"fieldKey",
templateItem.fld
]);
//de-lodash
// let afItem = window.$gz. _.find(vm.availableFields, [
// "fieldKey",
// templateItem.fld
// ]);
let afItem = vm.availableFields.find(z => z.fieldKey == templateItem.fld);
if (afItem != null) {
//Push into working array
@@ -498,7 +501,12 @@ function synthesizeWorkingArray(vm) {
continue;
}
//is this field already in the template and was added above?
if (window.$gz._.find(template, ["fld", afItem.fieldKey]) != null) {
//de-lodash
// if (window.$gz ._.find(template, ["fld", afItem.fieldKey]) != null) {
// continue;
// }
if (template.find(z => z.fld == afItem.fieldKey) != null) {
continue;
}

View File

@@ -655,8 +655,19 @@ export default {
filterItem.value,
item.enumType
);
//add only if not already in the collection (accidental double click)
if (!window.$gz._.find(item.filter.items, filterItem)) {
//de-lodash
// if (!window.$gz._.find(item.filter.items, filterItem)) {
//some fits better here as it only test for truthiness and returns immediately on true
//also the item is unique and display doesn't need to be compared for equality it's irrelevant
//so only the op and the value need to be checked
if (
!item.filter.items.some(
z => z.op == filterItem.op && z.value == filterItem.value
)
) {
item.filter.items.push(filterItem);
window.$gz.form.setFormState({
vm: this,