-
+
+
@@ -188,151 +185,4 @@ const onFileSelection = async (e: unknown) => {
.expand-icon:hover {
background-color: var(--v-primary-lighten4);
}
-
-/*.img-container {
- margin: 0 -2px;
-}
-
-.no-overflow {
- overflow: hidden;
-}
-
-.add {
- transition: 0.2s background-color;
- !*background-color: #666666ee;*!
- border-radius: 4px;
- height: 33px;
- margin: 5px 2px;
-}
-
-.add:hover {
- !*background-color: #66666699;*!
-}
-
-.thumbnail {
- height: 99px;
- width: 99px;
- margin: 2px;
- border-radius: 4px;
-}
-
-.thumbnail img {
- !*max-height: 33px;*!
- max-width: 99px;
-}
-
-.main {
- min-height: 20px;
- position: relative;
- height: auto;
-}
-
-.expand-icon {
- margin-left: 8px;
- border-radius: 2px;
- !*opacity: 0;*!
- transition: 0.3s background-color;
-}
-
-.expand-icon:hover {
- !*opacity: 1;*!
- background-color: var(--v-primary-lighten4);
-}
-
-.modal-thumbnail img {
- height: 50px;
- max-width: 100%;
- border-radius: 4px;
-}
-
-.modal-thumbnail {
- position: relative;
- margin: 10px 10px;
-}
-
-.remove-icon {
- position: absolute;
- top: 5px;
- right: 5px;
-}
-
-.modal-thumbnail-card {
- .download-icon {
- position: absolute;
- bottom: 5px;
- right: 5px;
- opacity: 0;
- transition: 0.4s opacity;
- }
-
- &:hover .download-icon {
- opacity: 1;
- }
-}
-
-.image-overlay-container {
- max-height: 100vh;
- overflow-y: auto;
- position: relative;
-}
-
-.image-overlay-container .close-icon {
- position: fixed;
- top: 15px;
- right: 15px;
-}
-
-.overlay-thumbnail {
- transition: 0.4s transform, 0.4s opacity;
- opacity: 0.5;
-}
-
-.overlay-thumbnail.active {
- transform: scale(1.4);
- opacity: 1;
-}
-
-.overlay-thumbnail:hover {
- opacity: 1;
-}
-
-.modal-title {
- text-overflow: ellipsis;
- white-space: nowrap;
- width: 100%;
- overflow: hidden;
-}
-
-.modal-thumbnail-card {
- transition: 0.4s transform;
-}
-
-.modal-thumbnail-card:hover {
- transform: scale(1.05);
-}
-
-.drop-overlay {
- z-index: 5;
- position: absolute;
- width: 100%;
- height: 100%;
- left: 0;
- right: 0;
- top: 0;
- bottom: 5px;
- background: #aaaaaa44;
- display: flex;
- justify-content: center;
- align-items: center;
- pointer-events: none;
-}
-
-.expand-icon {
- opacity: 0;
- transition: 0.4s opacity;
-}
-
-.main:hover .expand-icon {
- opacity: 1;
-}*/
diff --git a/packages/nc-gui-v2/components/cell/Currency.vue b/packages/nc-gui-v2/components/cell/Currency.vue
index 84db28f405..fe99200482 100644
--- a/packages/nc-gui-v2/components/cell/Currency.vue
+++ b/packages/nc-gui-v2/components/cell/Currency.vue
@@ -1,24 +1,22 @@
-
- {{ currency }}
+
+ {{ currency }}
-
-
diff --git a/packages/nc-gui-v2/components/cell/Email.vue b/packages/nc-gui-v2/components/cell/Email.vue
index f743c5d3f5..aac35dbb60 100644
--- a/packages/nc-gui-v2/components/cell/Email.vue
+++ b/packages/nc-gui-v2/components/cell/Email.vue
@@ -1,6 +1,7 @@
diff --git a/packages/nc-gui-v2/components/cell/Float.vue b/packages/nc-gui-v2/components/cell/Float.vue
index 58355b5c20..ec4c49f699 100644
--- a/packages/nc-gui-v2/components/cell/Float.vue
+++ b/packages/nc-gui-v2/components/cell/Float.vue
@@ -1,5 +1,6 @@
+import { inject, ref, useVModel } from '#imports'
+import { EditModeInj } from '~/context'
+
interface Props {
modelValue: number
}
@@ -11,15 +14,11 @@ const props = defineProps()
const emits = defineEmits()
-const editEnabled = inject('editEnabled')
-
-const root = ref()
+const editEnabled = inject(EditModeInj, ref(false))
-const vModel = useVModel(props, 'modelValue', emits)
+const vModel = useVModel(props, 'modelValue', emit)
-onMounted(() => {
- root.value?.focus()
-})
+const focus = (el: HTMLInputElement) => el.focus()
function onKeyDown(evt: KeyboardEvent) {
return evt.key === '.' && evt.preventDefault()
@@ -29,7 +28,7 @@ function onKeyDown(evt: KeyboardEvent) {
import MonacoJsonObjectEditor from '@/components/monaco/Editor.vue'
-import { inject } from '#imports'
+import { computed, inject } from '#imports'
+import { EditModeInj } from '~/context'
interface Props {
modelValue: string | Record
@@ -11,7 +12,7 @@ const props = defineProps()
const emits = defineEmits(['update:modelValue', 'cancel'])
-const editEnabled = inject('editEnabled')
+const editEnabled = inject(EditModeInj)
let expand = $ref(false)
@@ -19,7 +20,7 @@ let isValid = $ref(true)
let error = $ref()
-const localState = computed({
+const vModel = computed({
get: () => (typeof props.modelValue === 'string' ? JSON.parse(props.modelValue) : props.modelValue),
set: (val) => {
if (props.isForm) {
@@ -30,7 +31,7 @@ const localState = computed({
function save() {
expand = false
- emits('update:modelValue', JSON.stringify(props.modelValue))
+ emits('update:modelValue', JSON.stringify(vModel.value))
}
function validate(n: boolean, e: any) {
@@ -69,14 +70,14 @@ export default {
import { computed, inject } from '#imports'
-import { ColumnInj } from '~/context'
+import { ColumnInj, EditModeInj } from '~/context'
interface Props {
modelValue: string
@@ -12,7 +12,7 @@ const emit = defineEmits(['update:modelValue'])
const column = inject(ColumnInj)
const isForm = inject('isForm', false)
-const editEnabled = inject('editEnabled', false)
+const editEnabled = inject(EditModeInj, ref(false))
const options = computed(() => column?.dtxp?.split(',').map((v) => v.replace(/\\'/g, "'").replace(/^'|'$/g, '')) || [])
@@ -24,56 +24,6 @@ const localState = computed({
emit('update:modelValue', val?.filter((v) => options.value.includes(v)).join(','))
},
})
-
-/* import colors from '@/components/project/spreadsheet/helpers/colors'
-
-export default {
- name: 'SetListCheckboxCell',
- props: {
- value: String,
- column: Object,
- values: Array,
- },
- data() {},
- computed: {
- colors() {
- return this.$store.state.settings.darkTheme ? colors.dark : colors.light
- },
- localState: {
- get() {
- return (this.value && this.value.split(',')) || []
- },
- set(val) {
- this.$emit('input', val.join(','))
- this.$emit('update')
- },
- },
- setValues() {
- if (this.column && this.column.dtxp) {
- return this.column.dtxp.split(',').map((v) => v.replace(/^'|'$/g, ''))
- }
- return this.values || []
- },
- parentListeners() {
- const $listeners = {}
-
- if (this.$listeners.blur) {
- $listeners.blur = this.$listeners.blur
- }
- if (this.$listeners.focus) {
- $listeners.focus = this.$listeners.focus
- }
-
- return $listeners
- },
- },
- mounted() {
- this.$el.focus()
- const event = document.createEvent('MouseEvents')
- event.initMouseEvent('mousedown', true, true, window)
- this.$el.dispatchEvent(event)
- },
-} */
diff --git a/packages/nc-gui-v2/components/cell/SingleSelect.vue b/packages/nc-gui-v2/components/cell/SingleSelect.vue
index 112e26f4b7..66570ef61c 100644
--- a/packages/nc-gui-v2/components/cell/SingleSelect.vue
+++ b/packages/nc-gui-v2/components/cell/SingleSelect.vue
@@ -1,6 +1,6 @@
-
+
diff --git a/packages/nc-gui-v2/components/cell/TextArea.vue b/packages/nc-gui-v2/components/cell/TextArea.vue
index e02de3d753..b911cc5268 100644
--- a/packages/nc-gui-v2/components/cell/TextArea.vue
+++ b/packages/nc-gui-v2/components/cell/TextArea.vue
@@ -1,5 +1,6 @@
-
+
{{ vModel }}
diff --git a/packages/nc-gui-v2/components/cell/Url.vue b/packages/nc-gui-v2/components/cell/Url.vue
index 760f93955a..3f39bd9988 100644
--- a/packages/nc-gui-v2/components/cell/Url.vue
+++ b/packages/nc-gui-v2/components/cell/Url.vue
@@ -1,7 +1,7 @@
-
+
{{ value }}
{{ value }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/nc-gui-v2/components/smartsheet/Grid.vue b/packages/nc-gui-v2/components/smartsheet/Grid.vue
index bae3fbbf1e..f3c8930496 100644
--- a/packages/nc-gui-v2/components/smartsheet/Grid.vue
+++ b/packages/nc-gui-v2/components/smartsheet/Grid.vue
@@ -12,6 +12,7 @@ import {
import {
ActiveViewInj,
ChangePageInj,
+ EditModeInj,
FieldsInj,
IsFormInj,
IsGridInj,
@@ -44,6 +45,7 @@ provide(IsFormInj, false)
provide(IsGridInj, true)
provide(PaginationDataInj, paginationData)
provide(ChangePageInj, changePage)
+provide(EditModeInj, editEnabled)
const reloadViewDataHook = inject(ReloadViewDataHookInj)
reloadViewDataHook?.on(() => {
@@ -142,68 +144,6 @@ if (meta) useProvideColumnCreateStore(meta)
@click="selectCell(rowIndex, colIndex)"
@dblclick="editEnabled = true"
>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/nc-gui-v2/context/index.ts b/packages/nc-gui-v2/context/index.ts
index d5213f89b0..809c3ee5cd 100644
--- a/packages/nc-gui-v2/context/index.ts
+++ b/packages/nc-gui-v2/context/index.ts
@@ -21,3 +21,4 @@ export const FieldsInj: InjectionKey
[> = Symbol('fields-injection')
export const ViewListInj: InjectionKey][> = Symbol('view-list-injection')
export const RightSidebarInj: InjectionKey][> = Symbol('right-sidebar-injection')
+export const EditModeInj: InjectionKey][> = Symbol('edit-mode-injection')
]