Object.hasOwn & hasOwnProperty replace with lodash has (#367)
* Object.hasOwn & hasOwnProperty replace with lodash has * fix _has
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
<script setup>
|
||||
import { defineProps, computed } from 'vue'
|
||||
import { default as _has } from 'lodash/has'
|
||||
const { copy } = useClipboard()
|
||||
|
||||
const props = defineProps({
|
||||
@@ -40,7 +41,7 @@ const preFillUrl = computed(() => {
|
||||
const url = props.form.share_url
|
||||
const uriComponents = new URLSearchParams()
|
||||
props.form.properties.filter((property) => {
|
||||
return props.formData.hasOwnProperty(property.id) && props.formData[property.id] !== null
|
||||
return _has(props.formData, property.id) && props.formData[property.id] !== null
|
||||
}).forEach((property) => {
|
||||
if (Array.isArray(props.formData[property.id])) {
|
||||
props.formData[property.id].forEach((value) => {
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
import VSwitch from '../../../../forms/components/VSwitch.vue'
|
||||
import OpenCompleteForm from '../../OpenCompleteForm.vue'
|
||||
import {handleDarkMode} from "~/lib/forms/public-page.js"
|
||||
import { default as _has } from 'lodash/has'
|
||||
|
||||
export default {
|
||||
components: { OpenCompleteForm, VSwitch },
|
||||
@@ -89,7 +90,7 @@ export default {
|
||||
}
|
||||
},
|
||||
creating () { // returns true if we are creating a form
|
||||
return !this.form.hasOwnProperty('id')
|
||||
return !_has(this.form, 'id')
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -66,10 +66,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed } from 'vue'
|
||||
import clonedeep from 'clone-deep'
|
||||
import EditorOptionsPanel from '../../../editors/EditorOptionsPanel.vue'
|
||||
import SelectInput from '../../../../forms/SelectInput.vue'
|
||||
import { default as _has } from 'lodash/has'
|
||||
|
||||
export default {
|
||||
components: { SelectInput, EditorOptionsPanel },
|
||||
@@ -152,7 +152,7 @@ export default {
|
||||
['title', 'description', 'properties', 'cleanings', 'views_count', 'submissions_count', 'workspace', 'workspace_id', 'updated_at',
|
||||
'share_url', 'slug', 'notion_database_url', 'id', 'database_id', 'database_fields_update', 'creator',
|
||||
'created_at', 'deleted_at', 'last_edited_human'].forEach((property) => {
|
||||
if (copyForm.hasOwnProperty(property)) {
|
||||
if (_has(copyForm, property)) {
|
||||
delete copyForm[property]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
import ConditionEditor from './ConditionEditor.client.vue'
|
||||
import Modal from '../../../../global/Modal.vue'
|
||||
import clonedeep from 'clone-deep'
|
||||
import { default as _has } from 'lodash/has'
|
||||
|
||||
export default {
|
||||
name: 'FormBlockLogicEditor',
|
||||
@@ -100,7 +101,7 @@ export default {
|
||||
computed: {
|
||||
copyFromOptions () {
|
||||
return this.form.properties.filter((field) => {
|
||||
return field.id !== this.field.id && field.hasOwnProperty('logic') && field.logic !== null && field.logic !== {}
|
||||
return field.id !== this.field.id && _has(field, 'logic') && field.logic !== null && field.logic !== {}
|
||||
}).map((field) => {
|
||||
return { name: field.name, value: field.id }
|
||||
})
|
||||
@@ -166,7 +167,7 @@ export default {
|
||||
},
|
||||
|
||||
mounted () {
|
||||
if (!this.field.hasOwnProperty('logic')) {
|
||||
if (!_has(this.field, 'logic')) {
|
||||
this.field.logic = this.logic
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user