From f753f586b7c0b92d539dbdda0ee872cbc6d2de60 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 7 Oct 2020 18:04:48 +0000 Subject: [PATCH] --- .../src/components/custom-fields-control.vue | 1 + .../src/views/adm-global-select-templates.vue | 18 +++++++++++++----- ayanova/src/views/ay-data-list-view.vue | 13 ++++++++++++- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/ayanova/src/components/custom-fields-control.vue b/ayanova/src/components/custom-fields-control.vue index 45c758c0..a2325237 100644 --- a/ayanova/src/components/custom-fields-control.vue +++ b/ayanova/src/components/custom-fields-control.vue @@ -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] diff --git a/ayanova/src/views/adm-global-select-templates.vue b/ayanova/src/views/adm-global-select-templates.vue index 56b11029..3532a603 100644 --- a/ayanova/src/views/adm-global-select-templates.vue +++ b/ayanova/src/views/adm-global-select-templates.vue @@ -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; } diff --git a/ayanova/src/views/ay-data-list-view.vue b/ayanova/src/views/ay-data-list-view.vue index 570874fd..1b0c35ad 100644 --- a/ayanova/src/views/ay-data-list-view.vue +++ b/ayanova/src/views/ay-data-list-view.vue @@ -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,