6464 {{ t('tables', 'Advanced settings') }}
6565 </h3 >
6666
67- <!-- technical name -->
68- <div class =" fix-col-4 title space-T" :class =" {error: technicalNameInvalidError}" >
69- {{ t('tables', 'Technical name') }}
70- </div >
71- <div class =" fix-col-4" :class =" {error: technicalNameInvalidError}" >
72- <input
73- v-model =" localTechnicalName"
74- data-cy =" columnTechnicalNameInput"
75- :placeholder =" t('tables', 'Optional, e.g. customer_name')" >
67+ <div class =" fix-col-4" >
68+ <NcButton
69+ type="tertiary"
70+ data-cy="columnAdvancedSettingsToggle"
71+ :aria-expanded =" showAdvanced "
72+ :aria-label =" advancedToggleLabel "
73+ @click =" showAdvanced = ! showAdvanced " >
74+ <template #icon >
75+ <ChevronUp v-if =" showAdvanced " :size =" 20 " />
76+ <ChevronDown v-else :size =" 20 " />
77+ </template >
78+ {{ advancedToggleLabel }}
79+ </NcButton >
7680 </div >
7781
78- <!-- warning for technical name changes -->
79- <div v-if =" editColumn" class =" fix-col-4 space-T" >
80- <NcNoteCard type="warning">
81- <p >{{ t('tables', 'Changing the technical name affects integrations and API. Make sure to update your services accordingly.') }}</p >
82- </NcNoteCard >
83- </div >
82+ <template v-if =" showAdvanced " >
83+ <!-- technical name -->
84+ <div class =" fix-col-4 title space-T" :class =" {error: technicalNameInvalidError}" >
85+ {{ t('tables', 'Technical name') }}
86+ </div >
87+ <div class =" fix-col-4" :class =" {error: technicalNameInvalidError}" >
88+ <input
89+ v-model =" localTechnicalName"
90+ type =" text"
91+ data-cy =" columnTechnicalNameInput"
92+ :placeholder =" t('tables', 'Optional, e.g. customer_name')" >
93+ </div >
8494
85- <!-- column width -->
86- <div class =" fix-col-4 mandatory title space-T" :class =" {error: widthInvalidError}" >
87- {{ t('tables', 'Column width') }}
88- </div >
89- <div class =" fix-col-4" :class =" {error: widthInvalidError}" >
90- <input
91- v-model.number =" localColumnWidth"
92- type =" number"
93- pattern =" \d+"
94- :min =" COLUMN_WIDTH_MIN"
95- :max =" COLUMN_WIDTH_MAX"
96- :placeholder =" t('tables', 'Enter a column width between {min} and {max}', { min: COLUMN_WIDTH_MIN, max: COLUMN_WIDTH_MAX })" >
97- </div >
95+ <!-- warning for technical name changes -->
96+ <div class =" fix-col-4 space-T" >
97+ <NcNoteCard type="warning">
98+ <p >{{ t('tables', 'Changing the technical name affects integrations and API. Make sure to update your services accordingly.') }}</p >
99+ </NcNoteCard >
100+ </div >
101+
102+ <!-- column width -->
103+ <div class =" fix-col-4 mandatory title space-T" :class =" {error: widthInvalidError}" >
104+ {{ t('tables', 'Column width') }}
105+ </div >
106+ <div class =" fix-col-4" :class =" {error: widthInvalidError}" >
107+ <input
108+ v-model.number =" localColumnWidth"
109+ type =" number"
110+ pattern =" \d+"
111+ :min =" COLUMN_WIDTH_MIN"
112+ :max =" COLUMN_WIDTH_MAX"
113+ :placeholder =" t('tables', 'Enter a column width between {min} and {max}', { min: COLUMN_WIDTH_MIN, max: COLUMN_WIDTH_MAX })" >
114+ </div >
115+ </template >
98116
99117 </div >
100118</template >
101119
102120<script >
103- import { NcCheckboxRadioSwitch , NcNoteCard , NcSelect } from ' @nextcloud/vue'
121+ import { NcButton , NcCheckboxRadioSwitch , NcNoteCard , NcSelect } from ' @nextcloud/vue'
104122import { mapState } from ' pinia'
105123import { translate as t } from ' @nextcloud/l10n'
124+ import ChevronDown from ' vue-material-design-icons/ChevronDown.vue'
125+ import ChevronUp from ' vue-material-design-icons/ChevronUp.vue'
106126import { useTablesStore } from ' ../../../../../../store/store.js'
107127import { COLUMN_WIDTH_MAX , COLUMN_WIDTH_MIN } from ' ../../../../../constants.js'
108128
109129export default {
110130 name: ' MainForm' ,
111131 components: {
132+ ChevronDown,
133+ ChevronUp,
134+ NcButton,
112135 NcCheckboxRadioSwitch,
113136 NcNoteCard,
114137 NcSelect,
@@ -161,10 +184,20 @@ export default {
161184 return {
162185 COLUMN_WIDTH_MIN ,
163186 COLUMN_WIDTH_MAX ,
187+ showAdvanced: false ,
164188 }
165189 },
190+ watch: {
191+ technicalNameInvalidError: ' expandAdvancedOnError' ,
192+ widthInvalidError: ' expandAdvancedOnError' ,
193+ },
166194 computed: {
167195 ... mapState (useTablesStore, [' views' , ' activeElement' , ' isView' ]),
196+ advancedToggleLabel () {
197+ return this .showAdvanced
198+ ? t (' tables' , ' Hide advanced settings' )
199+ : t (' tables' , ' Show advanced settings' )
200+ },
168201 localTitle: {
169202 get () { return this .title },
170203 set (title ) { this .$emit (' update:title' , title) },
@@ -202,7 +235,12 @@ export default {
202235 },
203236
204237 mounted () {
205- if (this .editColumn ) return
238+ if (this .editColumn ) {
239+ if (this .technicalName || this .customSettings ? .width ) {
240+ this .showAdvanced = true
241+ }
242+ return
243+ }
206244 if (! this .isView ) {
207245 this .localSelectedViews = this .viewsForTable
208246 } else {
@@ -211,6 +249,11 @@ export default {
211249 },
212250 methods: {
213251 t,
252+ expandAdvancedOnError (show ) {
253+ if (show) {
254+ this .showAdvanced = true
255+ }
256+ },
214257 },
215258}
216259< / script>
0 commit comments