@conduction/nextcloud-vue 0.1.0-beta.4 → 0.1.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nextcloud-vue.cjs +67614 -0
- package/dist/nextcloud-vue.cjs.js +9559 -8983
- package/dist/nextcloud-vue.cjs.js.map +1 -1
- package/dist/nextcloud-vue.cjs.map +1 -0
- package/dist/nextcloud-vue.css +1231 -1231
- package/dist/nextcloud-vue.esm.js +9559 -8983
- package/dist/nextcloud-vue.esm.js.map +1 -1
- package/package.json +14 -5
- package/src/components/CnActionsBar/CnActionsBar.vue +235 -235
- package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +579 -579
- package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -217
- package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -121
- package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +418 -418
- package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -247
- package/src/components/CnCardGrid/CnCardGrid.vue +152 -152
- package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -132
- package/src/components/CnChartWidget/CnChartWidget.vue +320 -320
- package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -77
- package/src/components/CnCopyDialog/CnCopyDialog.vue +250 -250
- package/src/components/CnDashboardGrid/CnDashboardGrid.vue +225 -225
- package/src/components/CnDashboardPage/CnDashboardPage.vue +390 -390
- package/src/components/CnDataTable/CnDataTable.vue +349 -349
- package/src/components/CnDeleteDialog/CnDeleteDialog.vue +170 -170
- package/src/components/CnDetailCard/CnDetailCard.vue +214 -214
- package/src/components/CnDetailPage/CnDetailPage.vue +285 -281
- package/src/components/CnFacetSidebar/CnFacetSidebar.vue +231 -231
- package/src/components/CnFilterBar/CnFilterBar.vue +152 -152
- package/src/components/CnFormDialog/CnFormDialog.vue +302 -11
- package/src/components/CnIcon/CnIcon.vue +89 -89
- package/src/components/CnIndexPage/CnIndexPage.vue +884 -874
- package/src/components/CnIndexSidebar/CnIndexSidebar.vue +503 -503
- package/src/components/CnItemCard/CnItemCard.vue +132 -132
- package/src/components/CnKpiGrid/CnKpiGrid.vue +89 -89
- package/src/components/CnMassActionBar/CnMassActionBar.vue +160 -160
- package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +320 -320
- package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +238 -238
- package/src/components/CnMassExportDialog/CnMassExportDialog.vue +190 -190
- package/src/components/CnMassImportDialog/CnMassImportDialog.vue +491 -491
- package/src/components/CnNoteCard/CnNoteCard.vue +149 -149
- package/src/components/CnNotesCard/CnNotesCard.vue +413 -413
- package/src/components/CnObjectCard/CnObjectCard.vue +292 -292
- package/src/components/CnObjectCard/eslint-setup.md +235 -0
- package/src/components/CnObjectCard/package.json-or.json +132 -0
- package/src/components/CnObjectSidebar/CnObjectSidebar.vue +876 -876
- package/src/components/CnPageHeader/CnPageHeader.vue +57 -57
- package/src/components/CnPagination/CnPagination.vue +252 -252
- package/src/components/CnRegisterMapping/CnRegisterMapping.vue +792 -792
- package/src/components/CnRowActions/CnRowActions.vue +95 -73
- package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -226
- package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +787 -787
- package/src/components/CnSchemaFormDialog/CnSchemaPropertiesTab.vue +305 -305
- package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +1398 -1398
- package/src/components/CnSchemaFormDialog/CnSchemaSecurityTab.vue +236 -236
- package/src/components/CnSettingsCard/CnSettingsCard.vue +92 -92
- package/src/components/CnSettingsSection/CnSettingsSection.vue +266 -266
- package/src/components/CnStatsBlock/CnStatsBlock.vue +420 -420
- package/src/components/CnStatusBadge/CnStatusBadge.vue +77 -77
- package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +540 -540
- package/src/components/CnTasksCard/CnTasksCard.vue +373 -373
- package/src/components/CnTileWidget/CnTileWidget.vue +159 -159
- package/src/components/CnTimelineStages/CnTimelineStages.vue +292 -292
- package/src/components/CnUserActionMenu/CnUserActionMenu.vue +435 -435
- package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +312 -312
- package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -180
- package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +211 -211
- package/src/index.js +1 -1
- package/src/types/notification.d.ts +13 -13
- package/src/types/organisation.d.ts +15 -15
- package/src/types/schema.d.ts +13 -13
- package/src/types/task.d.ts +6 -6
- package/src/utils/headers.js +5 -3
|
@@ -1,247 +1,247 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- Edit mode -->
|
|
3
|
-
<div
|
|
4
|
-
v-if="isEditable && (inputComponent === 'NcCheckboxRadioSwitch' || isEditing)"
|
|
5
|
-
class="cn-advanced-form-dialog__value-input-container"
|
|
6
|
-
@click.stop>
|
|
7
|
-
<div
|
|
8
|
-
v-if="inputComponent === 'NcCheckboxRadioSwitch'"
|
|
9
|
-
class="cn-advanced-form-dialog__boolean-input-row">
|
|
10
|
-
<NcCheckboxRadioSwitch
|
|
11
|
-
:checked="value"
|
|
12
|
-
type="switch"
|
|
13
|
-
class="cn-advanced-form-dialog__boolean-input-row__input"
|
|
14
|
-
@update:checked="emit($event)">
|
|
15
|
-
{{ displayName }}
|
|
16
|
-
</NcCheckboxRadioSwitch>
|
|
17
|
-
<InformationOutline
|
|
18
|
-
v-if="schemaProp && schemaProp.description"
|
|
19
|
-
v-tooltip="schemaProp.description"
|
|
20
|
-
class="cn-advanced-form-dialog__info-icon"
|
|
21
|
-
:size="16" />
|
|
22
|
-
</div>
|
|
23
|
-
<NcDateTimePickerNative
|
|
24
|
-
v-else-if="inputComponent === 'NcDateTimePickerNative'"
|
|
25
|
-
:value="value"
|
|
26
|
-
:type="inputType"
|
|
27
|
-
:label="displayName"
|
|
28
|
-
@update:value="emit($event)" />
|
|
29
|
-
<NcTextField
|
|
30
|
-
v-else
|
|
31
|
-
ref="inputRef"
|
|
32
|
-
:value="stringValue"
|
|
33
|
-
:type="inputType"
|
|
34
|
-
:placeholder="displayName"
|
|
35
|
-
:min="minimum"
|
|
36
|
-
:max="maximum"
|
|
37
|
-
:step="step"
|
|
38
|
-
@update:value="emitConverted($event)" />
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<!-- Display mode -->
|
|
42
|
-
<div
|
|
43
|
-
v-else
|
|
44
|
-
:title="editabilityWarning">
|
|
45
|
-
<pre
|
|
46
|
-
v-if="typeof value === 'object' && value !== null"
|
|
47
|
-
class="cn-advanced-form-dialog__json-value">{{ formattedObjectValue }}</pre>
|
|
48
|
-
<span
|
|
49
|
-
v-else-if="inputComponent === 'NcDateTimePickerNative' && isValidDate(value)">{{
|
|
50
|
-
new Date(value).toLocaleString()
|
|
51
|
-
}}</span>
|
|
52
|
-
<span v-else>{{ displayValue }}</span>
|
|
53
|
-
</div>
|
|
54
|
-
</template>
|
|
55
|
-
|
|
56
|
-
<script>
|
|
57
|
-
import {
|
|
58
|
-
NcTextField,
|
|
59
|
-
NcCheckboxRadioSwitch,
|
|
60
|
-
NcDateTimePickerNative,
|
|
61
|
-
} from '@nextcloud/vue'
|
|
62
|
-
import InformationOutline from 'vue-material-design-icons/InformationOutline.vue'
|
|
63
|
-
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'
|
|
64
|
-
import { formatValue } from '../../utils/schema.js'
|
|
65
|
-
|
|
66
|
-
export default {
|
|
67
|
-
name: 'CnPropertyValueCell',
|
|
68
|
-
|
|
69
|
-
directives: { tooltip: Tooltip },
|
|
70
|
-
|
|
71
|
-
components: {
|
|
72
|
-
NcTextField,
|
|
73
|
-
NcCheckboxRadioSwitch,
|
|
74
|
-
NcDateTimePickerNative,
|
|
75
|
-
InformationOutline,
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
props: {
|
|
79
|
-
/** The schema property key */
|
|
80
|
-
propertyKey: { type: String, required: true },
|
|
81
|
-
/** Full JSON schema object */
|
|
82
|
-
schema: { type: Object, default: null },
|
|
83
|
-
/** Resolved current value (formData[key] ?? objectValue) */
|
|
84
|
-
value: { default: null },
|
|
85
|
-
/** Whether this property is editable at all */
|
|
86
|
-
isEditable: { type: Boolean, default: true },
|
|
87
|
-
/** Whether this row is currently selected for editing */
|
|
88
|
-
isEditing: { type: Boolean, default: false },
|
|
89
|
-
/** Display name for the property (used in labels/placeholders) */
|
|
90
|
-
displayName: { type: String, default: '' },
|
|
91
|
-
/** Editability warning message shown as title when not editable */
|
|
92
|
-
editabilityWarning: { type: String, default: null },
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
computed: {
|
|
96
|
-
schemaProp() {
|
|
97
|
-
return this.schema?.properties?.[this.propertyKey] || null
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
inputComponent() {
|
|
101
|
-
const prop = this.schemaProp
|
|
102
|
-
if (!prop) return 'NcTextField'
|
|
103
|
-
if (prop.type === 'boolean') return 'NcCheckboxRadioSwitch'
|
|
104
|
-
if (prop.type === 'string' && ['date', 'time', 'date-time'].includes(prop.format)) {
|
|
105
|
-
return 'NcDateTimePickerNative'
|
|
106
|
-
}
|
|
107
|
-
return 'NcTextField'
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
inputType() {
|
|
111
|
-
const prop = this.schemaProp
|
|
112
|
-
if (!prop) return 'text'
|
|
113
|
-
const fmt = prop.format || ''
|
|
114
|
-
if (prop.type === 'string') {
|
|
115
|
-
if (fmt === 'date') return 'date'
|
|
116
|
-
if (fmt === 'time') return 'time'
|
|
117
|
-
if (fmt === 'date-time') return 'datetime-local'
|
|
118
|
-
if (fmt === 'email') return 'email'
|
|
119
|
-
if (fmt === 'url' || fmt === 'uri') return 'url'
|
|
120
|
-
}
|
|
121
|
-
if (prop.type === 'number' || prop.type === 'integer') return 'number'
|
|
122
|
-
return 'text'
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
minimum() {
|
|
126
|
-
return this.schemaProp?.minimum
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
maximum() {
|
|
130
|
-
return this.schemaProp?.maximum
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
step() {
|
|
134
|
-
const prop = this.schemaProp
|
|
135
|
-
if (prop?.type === 'integer') return '1'
|
|
136
|
-
if (prop?.type === 'number') return 'any'
|
|
137
|
-
return undefined
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
stringValue() {
|
|
141
|
-
const v = this.value
|
|
142
|
-
if (v == null) return ''
|
|
143
|
-
if (typeof v === 'string') return v
|
|
144
|
-
if (typeof v === 'object') return JSON.stringify(v)
|
|
145
|
-
return String(v)
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
formattedObjectValue() {
|
|
149
|
-
return formatValue(this.value, this.schemaProp || {})
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
displayValue() {
|
|
153
|
-
const prop = this.schemaProp
|
|
154
|
-
if (prop?.const !== undefined) return prop.const
|
|
155
|
-
const v = this.value
|
|
156
|
-
if (v === null || v === undefined || v === '') return '—'
|
|
157
|
-
return formatValue(v, prop || {})
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
methods: {
|
|
162
|
-
/** Focus the underlying text input (called by parent after row click) */
|
|
163
|
-
focus() {
|
|
164
|
-
const ref = this.$refs.inputRef
|
|
165
|
-
if (!ref) return
|
|
166
|
-
const input = ref.$el?.querySelector('input')
|
|
167
|
-
if (input) {
|
|
168
|
-
input.focus()
|
|
169
|
-
input.select()
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
emit(newVal) {
|
|
174
|
-
this.$emit('update:value', newVal)
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
emitConverted(newVal) {
|
|
178
|
-
const prop = this.schemaProp
|
|
179
|
-
let converted = newVal
|
|
180
|
-
if (prop) {
|
|
181
|
-
switch (prop.type) {
|
|
182
|
-
case 'number':
|
|
183
|
-
converted = newVal === '' ? null : parseFloat(newVal)
|
|
184
|
-
if (Number.isNaN(converted)) converted = null
|
|
185
|
-
break
|
|
186
|
-
case 'integer':
|
|
187
|
-
converted = newVal === '' ? null : parseInt(newVal, 10)
|
|
188
|
-
if (Number.isNaN(converted)) converted = null
|
|
189
|
-
break
|
|
190
|
-
case 'boolean':
|
|
191
|
-
converted = Boolean(newVal)
|
|
192
|
-
break
|
|
193
|
-
default:
|
|
194
|
-
converted = newVal
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
this.$emit('update:value', converted)
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
isValidDate(v) {
|
|
201
|
-
if (!v) return false
|
|
202
|
-
const d = new Date(v)
|
|
203
|
-
return d instanceof Date && !Number.isNaN(d.getTime())
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
}
|
|
207
|
-
</script>
|
|
208
|
-
|
|
209
|
-
<style scoped>
|
|
210
|
-
.cn-advanced-form-dialog__value-input-container :deep(.text-field) {
|
|
211
|
-
margin: 0;
|
|
212
|
-
padding: 0;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
.cn-advanced-form-dialog__boolean-input-row {
|
|
216
|
-
display: flex;
|
|
217
|
-
align-items: center;
|
|
218
|
-
gap: 6px;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/* patch extreme size in field */
|
|
222
|
-
.cn-advanced-form-dialog__boolean-input-row__input > span {
|
|
223
|
-
padding-left: 0;
|
|
224
|
-
padding-block: 0;
|
|
225
|
-
}
|
|
226
|
-
.cn-advanced-form-dialog__boolean-input-row__input > input {
|
|
227
|
-
margin: 0;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.cn-advanced-form-dialog__info-icon {
|
|
231
|
-
flex-shrink: 0;
|
|
232
|
-
color: var(--color-text-maxcontrast);
|
|
233
|
-
cursor: help;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.cn-advanced-form-dialog__json-value {
|
|
237
|
-
max-height: 200px;
|
|
238
|
-
overflow-y: auto;
|
|
239
|
-
white-space: pre-wrap;
|
|
240
|
-
font-family: monospace;
|
|
241
|
-
font-size: 12px;
|
|
242
|
-
background: var(--color-background-dark);
|
|
243
|
-
padding: 8px;
|
|
244
|
-
border-radius: 4px;
|
|
245
|
-
margin: 0;
|
|
246
|
-
}
|
|
247
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<!-- Edit mode -->
|
|
3
|
+
<div
|
|
4
|
+
v-if="isEditable && (inputComponent === 'NcCheckboxRadioSwitch' || isEditing)"
|
|
5
|
+
class="cn-advanced-form-dialog__value-input-container"
|
|
6
|
+
@click.stop>
|
|
7
|
+
<div
|
|
8
|
+
v-if="inputComponent === 'NcCheckboxRadioSwitch'"
|
|
9
|
+
class="cn-advanced-form-dialog__boolean-input-row">
|
|
10
|
+
<NcCheckboxRadioSwitch
|
|
11
|
+
:checked="value"
|
|
12
|
+
type="switch"
|
|
13
|
+
class="cn-advanced-form-dialog__boolean-input-row__input"
|
|
14
|
+
@update:checked="emit($event)">
|
|
15
|
+
{{ displayName }}
|
|
16
|
+
</NcCheckboxRadioSwitch>
|
|
17
|
+
<InformationOutline
|
|
18
|
+
v-if="schemaProp && schemaProp.description"
|
|
19
|
+
v-tooltip="schemaProp.description"
|
|
20
|
+
class="cn-advanced-form-dialog__info-icon"
|
|
21
|
+
:size="16" />
|
|
22
|
+
</div>
|
|
23
|
+
<NcDateTimePickerNative
|
|
24
|
+
v-else-if="inputComponent === 'NcDateTimePickerNative'"
|
|
25
|
+
:value="value"
|
|
26
|
+
:type="inputType"
|
|
27
|
+
:label="displayName"
|
|
28
|
+
@update:value="emit($event)" />
|
|
29
|
+
<NcTextField
|
|
30
|
+
v-else
|
|
31
|
+
ref="inputRef"
|
|
32
|
+
:value="stringValue"
|
|
33
|
+
:type="inputType"
|
|
34
|
+
:placeholder="displayName"
|
|
35
|
+
:min="minimum"
|
|
36
|
+
:max="maximum"
|
|
37
|
+
:step="step"
|
|
38
|
+
@update:value="emitConverted($event)" />
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<!-- Display mode -->
|
|
42
|
+
<div
|
|
43
|
+
v-else
|
|
44
|
+
:title="editabilityWarning">
|
|
45
|
+
<pre
|
|
46
|
+
v-if="typeof value === 'object' && value !== null"
|
|
47
|
+
class="cn-advanced-form-dialog__json-value">{{ formattedObjectValue }}</pre>
|
|
48
|
+
<span
|
|
49
|
+
v-else-if="inputComponent === 'NcDateTimePickerNative' && isValidDate(value)">{{
|
|
50
|
+
new Date(value).toLocaleString()
|
|
51
|
+
}}</span>
|
|
52
|
+
<span v-else>{{ displayValue }}</span>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script>
|
|
57
|
+
import {
|
|
58
|
+
NcTextField,
|
|
59
|
+
NcCheckboxRadioSwitch,
|
|
60
|
+
NcDateTimePickerNative,
|
|
61
|
+
} from '@nextcloud/vue'
|
|
62
|
+
import InformationOutline from 'vue-material-design-icons/InformationOutline.vue'
|
|
63
|
+
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'
|
|
64
|
+
import { formatValue } from '../../utils/schema.js'
|
|
65
|
+
|
|
66
|
+
export default {
|
|
67
|
+
name: 'CnPropertyValueCell',
|
|
68
|
+
|
|
69
|
+
directives: { tooltip: Tooltip },
|
|
70
|
+
|
|
71
|
+
components: {
|
|
72
|
+
NcTextField,
|
|
73
|
+
NcCheckboxRadioSwitch,
|
|
74
|
+
NcDateTimePickerNative,
|
|
75
|
+
InformationOutline,
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
props: {
|
|
79
|
+
/** The schema property key */
|
|
80
|
+
propertyKey: { type: String, required: true },
|
|
81
|
+
/** Full JSON schema object */
|
|
82
|
+
schema: { type: Object, default: null },
|
|
83
|
+
/** Resolved current value (formData[key] ?? objectValue) */
|
|
84
|
+
value: { default: null },
|
|
85
|
+
/** Whether this property is editable at all */
|
|
86
|
+
isEditable: { type: Boolean, default: true },
|
|
87
|
+
/** Whether this row is currently selected for editing */
|
|
88
|
+
isEditing: { type: Boolean, default: false },
|
|
89
|
+
/** Display name for the property (used in labels/placeholders) */
|
|
90
|
+
displayName: { type: String, default: '' },
|
|
91
|
+
/** Editability warning message shown as title when not editable */
|
|
92
|
+
editabilityWarning: { type: String, default: null },
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
computed: {
|
|
96
|
+
schemaProp() {
|
|
97
|
+
return this.schema?.properties?.[this.propertyKey] || null
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
inputComponent() {
|
|
101
|
+
const prop = this.schemaProp
|
|
102
|
+
if (!prop) return 'NcTextField'
|
|
103
|
+
if (prop.type === 'boolean') return 'NcCheckboxRadioSwitch'
|
|
104
|
+
if (prop.type === 'string' && ['date', 'time', 'date-time'].includes(prop.format)) {
|
|
105
|
+
return 'NcDateTimePickerNative'
|
|
106
|
+
}
|
|
107
|
+
return 'NcTextField'
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
inputType() {
|
|
111
|
+
const prop = this.schemaProp
|
|
112
|
+
if (!prop) return 'text'
|
|
113
|
+
const fmt = prop.format || ''
|
|
114
|
+
if (prop.type === 'string') {
|
|
115
|
+
if (fmt === 'date') return 'date'
|
|
116
|
+
if (fmt === 'time') return 'time'
|
|
117
|
+
if (fmt === 'date-time') return 'datetime-local'
|
|
118
|
+
if (fmt === 'email') return 'email'
|
|
119
|
+
if (fmt === 'url' || fmt === 'uri') return 'url'
|
|
120
|
+
}
|
|
121
|
+
if (prop.type === 'number' || prop.type === 'integer') return 'number'
|
|
122
|
+
return 'text'
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
minimum() {
|
|
126
|
+
return this.schemaProp?.minimum
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
maximum() {
|
|
130
|
+
return this.schemaProp?.maximum
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
step() {
|
|
134
|
+
const prop = this.schemaProp
|
|
135
|
+
if (prop?.type === 'integer') return '1'
|
|
136
|
+
if (prop?.type === 'number') return 'any'
|
|
137
|
+
return undefined
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
stringValue() {
|
|
141
|
+
const v = this.value
|
|
142
|
+
if (v == null) return ''
|
|
143
|
+
if (typeof v === 'string') return v
|
|
144
|
+
if (typeof v === 'object') return JSON.stringify(v)
|
|
145
|
+
return String(v)
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
formattedObjectValue() {
|
|
149
|
+
return formatValue(this.value, this.schemaProp || {})
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
displayValue() {
|
|
153
|
+
const prop = this.schemaProp
|
|
154
|
+
if (prop?.const !== undefined) return prop.const
|
|
155
|
+
const v = this.value
|
|
156
|
+
if (v === null || v === undefined || v === '') return '—'
|
|
157
|
+
return formatValue(v, prop || {})
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
methods: {
|
|
162
|
+
/** Focus the underlying text input (called by parent after row click) */
|
|
163
|
+
focus() {
|
|
164
|
+
const ref = this.$refs.inputRef
|
|
165
|
+
if (!ref) return
|
|
166
|
+
const input = ref.$el?.querySelector('input')
|
|
167
|
+
if (input) {
|
|
168
|
+
input.focus()
|
|
169
|
+
input.select()
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
emit(newVal) {
|
|
174
|
+
this.$emit('update:value', newVal)
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
emitConverted(newVal) {
|
|
178
|
+
const prop = this.schemaProp
|
|
179
|
+
let converted = newVal
|
|
180
|
+
if (prop) {
|
|
181
|
+
switch (prop.type) {
|
|
182
|
+
case 'number':
|
|
183
|
+
converted = newVal === '' ? null : parseFloat(newVal)
|
|
184
|
+
if (Number.isNaN(converted)) converted = null
|
|
185
|
+
break
|
|
186
|
+
case 'integer':
|
|
187
|
+
converted = newVal === '' ? null : parseInt(newVal, 10)
|
|
188
|
+
if (Number.isNaN(converted)) converted = null
|
|
189
|
+
break
|
|
190
|
+
case 'boolean':
|
|
191
|
+
converted = Boolean(newVal)
|
|
192
|
+
break
|
|
193
|
+
default:
|
|
194
|
+
converted = newVal
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
this.$emit('update:value', converted)
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
isValidDate(v) {
|
|
201
|
+
if (!v) return false
|
|
202
|
+
const d = new Date(v)
|
|
203
|
+
return d instanceof Date && !Number.isNaN(d.getTime())
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
}
|
|
207
|
+
</script>
|
|
208
|
+
|
|
209
|
+
<style scoped>
|
|
210
|
+
.cn-advanced-form-dialog__value-input-container :deep(.text-field) {
|
|
211
|
+
margin: 0;
|
|
212
|
+
padding: 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.cn-advanced-form-dialog__boolean-input-row {
|
|
216
|
+
display: flex;
|
|
217
|
+
align-items: center;
|
|
218
|
+
gap: 6px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* patch extreme size in field */
|
|
222
|
+
.cn-advanced-form-dialog__boolean-input-row__input > span {
|
|
223
|
+
padding-left: 0;
|
|
224
|
+
padding-block: 0;
|
|
225
|
+
}
|
|
226
|
+
.cn-advanced-form-dialog__boolean-input-row__input > input {
|
|
227
|
+
margin: 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.cn-advanced-form-dialog__info-icon {
|
|
231
|
+
flex-shrink: 0;
|
|
232
|
+
color: var(--color-text-maxcontrast);
|
|
233
|
+
cursor: help;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.cn-advanced-form-dialog__json-value {
|
|
237
|
+
max-height: 200px;
|
|
238
|
+
overflow-y: auto;
|
|
239
|
+
white-space: pre-wrap;
|
|
240
|
+
font-family: monospace;
|
|
241
|
+
font-size: 12px;
|
|
242
|
+
background: var(--color-background-dark);
|
|
243
|
+
padding: 8px;
|
|
244
|
+
border-radius: 4px;
|
|
245
|
+
margin: 0;
|
|
246
|
+
}
|
|
247
|
+
</style>
|