@conduction/nextcloud-vue 0.1.0-beta.2 → 0.1.0-beta.4
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/README.md +226 -226
- package/css/index.css +5 -0
- package/dist/nextcloud-vue.cjs.js +60455 -8755
- package/dist/nextcloud-vue.cjs.js.map +1 -1
- package/dist/nextcloud-vue.css +2062 -528
- package/dist/nextcloud-vue.esm.js +60411 -8731
- package/dist/nextcloud-vue.esm.js.map +1 -1
- package/package.json +75 -61
- package/src/components/CnActionsBar/CnActionsBar.vue +235 -225
- package/src/components/CnActionsBar/index.js +1 -1
- package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +579 -0
- package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -0
- package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -0
- package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +418 -0
- package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -0
- package/src/components/CnAdvancedFormDialog/index.js +1 -0
- package/src/components/CnCardGrid/CnCardGrid.vue +152 -152
- package/src/components/CnCardGrid/index.js +1 -1
- package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -132
- package/src/components/CnCellRenderer/index.js +1 -1
- package/src/components/CnChartWidget/CnChartWidget.vue +320 -0
- package/src/components/CnChartWidget/index.js +1 -0
- package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -77
- package/src/components/CnConfigurationCard/index.js +1 -1
- package/src/components/CnDashboardGrid/CnDashboardGrid.vue +225 -0
- package/src/components/CnDashboardGrid/index.js +1 -0
- package/src/components/CnDashboardPage/CnDashboardPage.vue +390 -0
- package/src/components/CnDashboardPage/index.js +1 -0
- package/src/components/CnDataTable/CnDataTable.vue +349 -349
- package/src/components/CnDataTable/index.js +1 -1
- package/src/components/CnDetailCard/CnDetailCard.vue +214 -0
- package/src/components/CnDetailCard/index.js +1 -0
- package/src/components/CnDetailPage/CnDetailPage.vue +281 -0
- package/src/components/CnDetailPage/index.js +1 -0
- package/src/components/CnFacetSidebar/CnFacetSidebar.vue +231 -223
- package/src/components/CnFacetSidebar/index.js +1 -1
- package/src/components/CnFilterBar/CnFilterBar.vue +152 -152
- package/src/components/CnFilterBar/index.js +1 -1
- package/src/components/CnIcon/CnIcon.vue +89 -89
- package/src/components/CnIcon/index.js +1 -1
- package/src/components/CnIndexPage/CnIndexPage.vue +874 -816
- package/src/components/CnIndexPage/index.js +1 -1
- package/src/components/CnIndexSidebar/CnIndexSidebar.vue +503 -484
- package/src/components/CnIndexSidebar/index.js +1 -1
- package/src/components/CnItemCard/CnItemCard.vue +132 -0
- package/src/components/CnItemCard/index.js +1 -0
- package/src/components/CnKpiGrid/CnKpiGrid.vue +89 -89
- package/src/components/CnKpiGrid/index.js +1 -1
- package/src/components/CnMassActionBar/CnMassActionBar.vue +160 -160
- package/src/components/CnMassActionBar/index.js +1 -1
- package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +320 -320
- package/src/components/CnMassCopyDialog/index.js +1 -1
- package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +238 -238
- package/src/components/CnMassDeleteDialog/index.js +1 -1
- package/src/components/CnMassExportDialog/CnMassExportDialog.vue +190 -190
- package/src/components/CnMassExportDialog/index.js +1 -1
- package/src/components/CnMassImportDialog/CnMassImportDialog.vue +491 -491
- package/src/components/CnMassImportDialog/index.js +1 -1
- package/src/components/CnNoteCard/CnNoteCard.vue +149 -0
- package/src/components/CnNoteCard/index.js +1 -0
- package/src/components/CnNotesCard/CnNotesCard.vue +413 -0
- package/src/components/CnNotesCard/index.js +1 -0
- package/src/components/CnObjectCard/CnObjectCard.vue +292 -292
- package/src/components/CnObjectCard/index.js +1 -1
- package/src/components/CnObjectSidebar/CnObjectSidebar.vue +876 -0
- package/src/components/CnObjectSidebar/index.js +1 -0
- package/src/components/CnPageHeader/CnPageHeader.vue +57 -57
- package/src/components/CnPageHeader/index.js +1 -1
- package/src/components/CnPagination/CnPagination.vue +252 -252
- package/src/components/CnPagination/index.js +1 -1
- package/src/components/CnRowActions/CnRowActions.vue +73 -73
- package/src/components/CnRowActions/index.js +1 -1
- package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -0
- package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +787 -0
- package/src/components/CnSchemaFormDialog/CnSchemaPropertiesTab.vue +305 -0
- package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +1398 -0
- package/src/components/CnSchemaFormDialog/CnSchemaSecurityTab.vue +236 -0
- package/src/components/CnSchemaFormDialog/index.js +1 -0
- package/src/components/CnSettingsCard/CnSettingsCard.vue +92 -92
- package/src/components/CnSettingsCard/index.js +1 -1
- package/src/components/CnSettingsSection/CnSettingsSection.vue +266 -266
- package/src/components/CnSettingsSection/index.js +1 -1
- package/src/components/CnStatsBlock/CnStatsBlock.vue +420 -366
- package/src/components/CnStatsBlock/index.js +1 -1
- package/src/components/CnStatusBadge/CnStatusBadge.vue +77 -77
- package/src/components/CnStatusBadge/index.js +1 -1
- package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +540 -0
- package/src/components/CnTabbedFormDialog/index.js +1 -0
- package/src/components/CnTasksCard/CnTasksCard.vue +373 -0
- package/src/components/CnTasksCard/index.js +1 -0
- package/src/components/CnTileWidget/CnTileWidget.vue +159 -0
- package/src/components/CnTileWidget/index.js +1 -0
- package/src/components/CnTimelineStages/CnTimelineStages.vue +292 -0
- package/src/components/CnTimelineStages/index.js +1 -0
- package/src/components/CnUserActionMenu/CnUserActionMenu.vue +435 -0
- package/src/components/CnUserActionMenu/index.js +1 -0
- package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +312 -312
- package/src/components/CnVersionInfoCard/index.js +1 -1
- package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -0
- package/src/components/CnWidgetRenderer/index.js +1 -0
- package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +211 -0
- package/src/components/CnWidgetWrapper/index.js +1 -0
- package/src/components/index.js +43 -29
- package/src/composables/index.js +4 -3
- package/src/composables/useDashboardView.js +240 -0
- package/src/composables/useDetailView.js +289 -132
- package/src/composables/useListView.js +363 -153
- package/src/composables/useSubResource.js +142 -142
- package/src/constants/metadata.js +30 -30
- package/src/css/CnSchemaFormDialog.css +546 -0
- package/src/css/__sample_nextcloud_tokens.css +110 -0
- package/src/css/actions-bar.css +48 -48
- package/src/css/badge.css +51 -51
- package/src/css/card.css +128 -128
- package/src/css/dashboard.css +70 -0
- package/src/css/detail-page.css +168 -0
- package/src/css/detail.css +68 -68
- package/src/css/index-page.css +44 -32
- package/src/css/index-sidebar.css +193 -187
- package/src/css/index.css +16 -12
- package/src/css/layout.css +90 -90
- package/src/css/page-header.css +33 -33
- package/src/css/pagination.css +72 -72
- package/src/css/table.css +142 -142
- package/src/css/timeline-stages.css +218 -0
- package/src/css/utilities.css +46 -46
- package/src/index.js +72 -53
- package/src/store/createSubResourcePlugin.js +135 -135
- package/src/store/index.js +3 -3
- package/src/store/plugins/auditTrails.js +17 -17
- package/src/store/plugins/files.js +250 -186
- package/src/store/plugins/index.js +7 -5
- package/src/store/plugins/lifecycle.js +180 -180
- package/src/store/plugins/relations.js +68 -68
- package/src/store/plugins/search.js +372 -0
- package/src/store/plugins/selection.js +104 -0
- package/src/store/useObjectStore.js +829 -686
- package/src/types/auditTrail.d.ts +32 -32
- package/src/types/file.d.ts +23 -23
- package/src/types/index.d.ts +35 -35
- package/src/types/notification.d.ts +36 -36
- package/src/types/object.d.ts +40 -40
- package/src/types/organisation.d.ts +41 -41
- package/src/types/register.d.ts +25 -25
- package/src/types/schema.d.ts +39 -39
- package/src/types/shared.d.ts +79 -79
- package/src/types/source.d.ts +14 -14
- package/src/types/task.d.ts +31 -31
- package/src/utils/errors.js +96 -96
- package/src/utils/headers.js +68 -50
- package/src/utils/id.js +13 -0
- package/src/utils/index.js +3 -3
- package/src/utils/schema.js +422 -419
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Fragment>
|
|
3
|
+
<div class="cn-schema-form__scrollable">
|
|
4
|
+
<CnDataTable
|
|
5
|
+
:columns="tableColumns"
|
|
6
|
+
:rows="propertyRows"
|
|
7
|
+
row-key="_id"
|
|
8
|
+
:selectable="false"
|
|
9
|
+
:row-class="getRowClass"
|
|
10
|
+
:empty-text="'No properties found. Click "Add property" to create one.'"
|
|
11
|
+
@row-click="onRowClick">
|
|
12
|
+
<template #actions-header>
|
|
13
|
+
<NcButton
|
|
14
|
+
type="primary"
|
|
15
|
+
:disabled="loading"
|
|
16
|
+
@click="$emit('add-property')">
|
|
17
|
+
<template #icon>
|
|
18
|
+
<Plus :size="20" />
|
|
19
|
+
</template>
|
|
20
|
+
Add property
|
|
21
|
+
</NcButton>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<template #column-_key="{ row }">
|
|
25
|
+
<div v-if="selectedProperty === row._key" class="cn-schema-form__name-input-container" @click.stop>
|
|
26
|
+
<AlertOutline v-if="isPropertyModified(row._key)"
|
|
27
|
+
:size="16"
|
|
28
|
+
class="cn-schema-form__warning-icon"
|
|
29
|
+
:title="'Property has been modified. Changes will only take effect after the schema is saved.'" />
|
|
30
|
+
<NcTextField
|
|
31
|
+
ref="propertyNameInput"
|
|
32
|
+
:value="row._key"
|
|
33
|
+
label="(technical) Property Name"
|
|
34
|
+
@update:value="onPropertyKeyUpdate(row._key, $event)"
|
|
35
|
+
@click.stop />
|
|
36
|
+
</div>
|
|
37
|
+
<div v-else class="cn-schema-form__name-display-container">
|
|
38
|
+
<AlertOutline v-if="isPropertyModified(row._key)"
|
|
39
|
+
:size="16"
|
|
40
|
+
class="cn-schema-form__warning-icon"
|
|
41
|
+
:title="'Property has been modified. Changes will only take effect after the schema is saved.'" />
|
|
42
|
+
<div class="cn-schema-form__name-with-chips">
|
|
43
|
+
<span class="cn-schema-form__property-name">{{ row._key }}</span>
|
|
44
|
+
<div class="cn-schema-form__inline-chips">
|
|
45
|
+
<span v-if="isPropertyRequired(schema, row._key)"
|
|
46
|
+
class="cn-schema-form__property-chip cn-schema-form__chip-primary">Required</span>
|
|
47
|
+
<span v-if="row.immutable"
|
|
48
|
+
class="cn-schema-form__property-chip cn-schema-form__chip-secondary">Immutable</span>
|
|
49
|
+
<span v-if="row.deprecated"
|
|
50
|
+
class="cn-schema-form__property-chip cn-schema-form__chip-warning">Deprecated</span>
|
|
51
|
+
<span v-if="row.visible === false"
|
|
52
|
+
class="cn-schema-form__property-chip cn-schema-form__chip-secondary">Hidden in view</span>
|
|
53
|
+
<span v-if="row.hideOnCollection"
|
|
54
|
+
class="cn-schema-form__property-chip cn-schema-form__chip-secondary">Hidden in Collection</span>
|
|
55
|
+
<span v-if="row.hideOnForm"
|
|
56
|
+
class="cn-schema-form__property-chip cn-schema-form__chip-secondary">Hidden in Form</span>
|
|
57
|
+
<span v-if="row.const !== undefined"
|
|
58
|
+
class="cn-schema-form__property-chip cn-schema-form__chip-success">Constant</span>
|
|
59
|
+
<span v-if="row.enum && row.enum.length > 0"
|
|
60
|
+
class="cn-schema-form__property-chip cn-schema-form__chip-success">Enumeration ({{ row.enum.length }})</span>
|
|
61
|
+
<span v-if="row.facetable === true || (typeof row.facetable === 'object' && row.facetable !== null)"
|
|
62
|
+
class="cn-schema-form__property-chip cn-schema-form__chip-info">Facetable</span>
|
|
63
|
+
<span v-if="hasCustomTableSettings(row._key)"
|
|
64
|
+
class="cn-schema-form__property-chip cn-schema-form__chip-table">Table</span>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<template #column-type="{ row }">
|
|
71
|
+
<NcSelect
|
|
72
|
+
v-if="selectedProperty === row._key"
|
|
73
|
+
v-model="schema.properties[row._key].type"
|
|
74
|
+
:options="typeOptionsForSelect"
|
|
75
|
+
input-label="Property Type"
|
|
76
|
+
@click.stop />
|
|
77
|
+
<span v-else>{{ row.type }}</span>
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<template #row-actions="{ row }">
|
|
81
|
+
<CnSchemaPropertyActions
|
|
82
|
+
:property-key="row._key"
|
|
83
|
+
:property="schema.properties[row._key]"
|
|
84
|
+
:schema-item="schema"
|
|
85
|
+
:original-properties="originalProperties"
|
|
86
|
+
:available-schemas="availableSchemas"
|
|
87
|
+
:available-registers="availableRegisters"
|
|
88
|
+
:available-tags-options="availableTagsOptions"
|
|
89
|
+
:user-groups="userGroups"
|
|
90
|
+
:sorted-user-groups="sortedUserGroups"
|
|
91
|
+
:loading-groups="loadingGroups"
|
|
92
|
+
@copy-property="$emit('copy-property', $event)"
|
|
93
|
+
@delete-property="$emit('delete-property', $event)" />
|
|
94
|
+
</template>
|
|
95
|
+
</CnDataTable>
|
|
96
|
+
</div>
|
|
97
|
+
<CnNoteCard v-if="propertiesModified && !loading" type="warning" class="cn-schema-form__properties-warning">
|
|
98
|
+
<p>Properties have been modified. Changes will only take effect after the schema is saved.</p>
|
|
99
|
+
</CnNoteCard>
|
|
100
|
+
</Fragment>
|
|
101
|
+
</template>
|
|
102
|
+
|
|
103
|
+
<!-- eslint-disable jsdoc/valid-types -->
|
|
104
|
+
<script>
|
|
105
|
+
import { NcButton, NcTextField, NcSelect } from '@nextcloud/vue'
|
|
106
|
+
import { CnDataTable } from '../CnDataTable/index.js'
|
|
107
|
+
import { CnNoteCard } from '../CnNoteCard/index.js'
|
|
108
|
+
import CnSchemaPropertyActions from './CnSchemaPropertyActions.vue'
|
|
109
|
+
|
|
110
|
+
import Plus from 'vue-material-design-icons/Plus.vue'
|
|
111
|
+
import AlertOutline from 'vue-material-design-icons/AlertOutline.vue'
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* CnSchemaPropertiesTab — Properties table tab for CnSchemaFormDialog.
|
|
115
|
+
*
|
|
116
|
+
* Renders the properties of a JSON Schema in a CnDataTable with inline editing
|
|
117
|
+
* for property name and type, plus an actions dropdown per row.
|
|
118
|
+
*
|
|
119
|
+
* @event add-property Emitted when "Add property" button is clicked.
|
|
120
|
+
* @event update:selected-property Emitted when row selection changes. Payload: key or null.
|
|
121
|
+
* @event update:property-key Emitted when property is renamed. Payload: { oldKey, newKey }.
|
|
122
|
+
* @event copy-property Emitted when copy action is triggered. Payload: key.
|
|
123
|
+
* @event delete-property Emitted when delete action is triggered. Payload: key.
|
|
124
|
+
*/
|
|
125
|
+
export default {
|
|
126
|
+
name: 'CnSchemaPropertiesTab',
|
|
127
|
+
components: {
|
|
128
|
+
NcButton,
|
|
129
|
+
NcTextField,
|
|
130
|
+
NcSelect,
|
|
131
|
+
CnDataTable,
|
|
132
|
+
CnNoteCard,
|
|
133
|
+
CnSchemaPropertyActions,
|
|
134
|
+
Plus,
|
|
135
|
+
AlertOutline,
|
|
136
|
+
},
|
|
137
|
+
props: {
|
|
138
|
+
/** The full schema item (needs .properties, .required) */
|
|
139
|
+
schemaItem: { type: Object, required: true },
|
|
140
|
+
/** Disable state */
|
|
141
|
+
loading: { type: Boolean, default: false },
|
|
142
|
+
/** Currently selected property key */
|
|
143
|
+
selectedProperty: { type: String, default: null },
|
|
144
|
+
/** Whether any properties have been modified */
|
|
145
|
+
propertiesModified: { type: Boolean, default: false },
|
|
146
|
+
/** Original properties snapshot for modification detection */
|
|
147
|
+
originalProperties: { type: Object, default: () => ({}) },
|
|
148
|
+
/** Type options for the inline NcSelect */
|
|
149
|
+
typeOptionsForSelect: { type: Array, default: () => [] },
|
|
150
|
+
/** Available schemas for references */
|
|
151
|
+
availableSchemas: { type: Array, default: () => [] },
|
|
152
|
+
/** Available registers */
|
|
153
|
+
availableRegisters: { type: Array, default: () => [] },
|
|
154
|
+
/** Available tags for file property config */
|
|
155
|
+
availableTagsOptions: { type: Array, default: () => [] },
|
|
156
|
+
/** User groups for RBAC */
|
|
157
|
+
userGroups: { type: Array, default: () => [] },
|
|
158
|
+
/** Filtered/sorted user groups */
|
|
159
|
+
sortedUserGroups: { type: Array, default: () => [] },
|
|
160
|
+
/** Whether groups are loading */
|
|
161
|
+
loadingGroups: { type: Boolean, default: false },
|
|
162
|
+
},
|
|
163
|
+
data() {
|
|
164
|
+
return {
|
|
165
|
+
propertyStableIds: {},
|
|
166
|
+
nextPropertyId: 1,
|
|
167
|
+
isRenaming: false,
|
|
168
|
+
tableColumns: [
|
|
169
|
+
{ key: '_key', label: 'Name', sortable: false },
|
|
170
|
+
{ key: 'type', label: 'Type', sortable: false },
|
|
171
|
+
],
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
computed: {
|
|
175
|
+
/** Local alias to avoid vue/no-mutating-props on template bindings */
|
|
176
|
+
schema() {
|
|
177
|
+
return this.schemaItem
|
|
178
|
+
},
|
|
179
|
+
sortedProperties() {
|
|
180
|
+
const properties = this.schema.properties || {}
|
|
181
|
+
return Object.entries(properties)
|
|
182
|
+
.sort(([keyA, propA], [keyB, propB]) => {
|
|
183
|
+
const orderA = propA.order || 0
|
|
184
|
+
const orderB = propB.order || 0
|
|
185
|
+
if (orderA > 0 && orderB > 0) {
|
|
186
|
+
return orderA - orderB
|
|
187
|
+
}
|
|
188
|
+
if (orderA > 0) return -1
|
|
189
|
+
if (orderB > 0) return 1
|
|
190
|
+
const createdA = propA.created || ''
|
|
191
|
+
const createdB = propB.created || ''
|
|
192
|
+
return createdA.localeCompare(createdB)
|
|
193
|
+
})
|
|
194
|
+
},
|
|
195
|
+
propertyRows() {
|
|
196
|
+
return this.sortedProperties.map(([key, prop]) => ({
|
|
197
|
+
_id: this.getStablePropertyId(key),
|
|
198
|
+
_key: key,
|
|
199
|
+
...prop,
|
|
200
|
+
}))
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
watch: {
|
|
204
|
+
selectedProperty(newKey) {
|
|
205
|
+
if (newKey) {
|
|
206
|
+
// Skip focus+select when the change comes from a rename —
|
|
207
|
+
// onPropertyKeyUpdate handles its own cursor positioning.
|
|
208
|
+
if (this.isRenaming) {
|
|
209
|
+
this.isRenaming = false
|
|
210
|
+
return
|
|
211
|
+
}
|
|
212
|
+
this.$nextTick(() => {
|
|
213
|
+
if (this.$refs.propertyNameInput) {
|
|
214
|
+
const inputs = Array.isArray(this.$refs.propertyNameInput)
|
|
215
|
+
? this.$refs.propertyNameInput
|
|
216
|
+
: [this.$refs.propertyNameInput]
|
|
217
|
+
if (inputs[0]) {
|
|
218
|
+
const input = inputs[0].$el.querySelector('input')
|
|
219
|
+
if (input) {
|
|
220
|
+
input.focus()
|
|
221
|
+
input.select()
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
methods: {
|
|
230
|
+
getStablePropertyId(propertyName) {
|
|
231
|
+
if (!this.propertyStableIds[propertyName]) {
|
|
232
|
+
this.propertyStableIds[propertyName] = this.nextPropertyId++
|
|
233
|
+
}
|
|
234
|
+
return this.propertyStableIds[propertyName]
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
isPropertyRequired(schema, key) {
|
|
238
|
+
const isInSchemaRequired = schema.required && schema.required.includes(key)
|
|
239
|
+
const hasPropertyRequired = schema.properties && schema.properties[key] && schema.properties[key].required === true
|
|
240
|
+
return isInSchemaRequired || hasPropertyRequired
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
isPropertyModified(key) {
|
|
244
|
+
if (!this.originalProperties) return false
|
|
245
|
+
const currentProperty = JSON.stringify(this.schema.properties[key] || {})
|
|
246
|
+
const originalProperty = JSON.stringify(this.originalProperties[key] || {})
|
|
247
|
+
return currentProperty !== originalProperty
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
hasCustomTableSettings(key) {
|
|
251
|
+
const table = this.schema.properties[key]?.table
|
|
252
|
+
if (!table) return false
|
|
253
|
+
const defaults = { default: false }
|
|
254
|
+
return !Object.keys(table).every(setting => table[setting] === defaults[setting])
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
getRowClass(row) {
|
|
258
|
+
const classes = []
|
|
259
|
+
if (this.selectedProperty === row._key) {
|
|
260
|
+
classes.push('cn-schema-form__selected-row')
|
|
261
|
+
}
|
|
262
|
+
if (this.isPropertyModified(row._key)) {
|
|
263
|
+
classes.push('cn-schema-form__modified-row')
|
|
264
|
+
}
|
|
265
|
+
return classes.join(' ')
|
|
266
|
+
},
|
|
267
|
+
|
|
268
|
+
onRowClick(row) {
|
|
269
|
+
if (this.selectedProperty === row._key) return
|
|
270
|
+
this.$emit('update:selected-property', row._key)
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
onPropertyKeyUpdate(oldKey, newKey) {
|
|
274
|
+
if (!newKey || newKey === oldKey) return
|
|
275
|
+
if (this.schema.properties[newKey] && newKey !== oldKey) return
|
|
276
|
+
|
|
277
|
+
this.isRenaming = true
|
|
278
|
+
|
|
279
|
+
// Transfer stable ID
|
|
280
|
+
if (this.propertyStableIds[oldKey]) {
|
|
281
|
+
this.propertyStableIds[newKey] = this.propertyStableIds[oldKey]
|
|
282
|
+
delete this.propertyStableIds[oldKey]
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
this.$emit('update:property-key', { oldKey, newKey })
|
|
286
|
+
|
|
287
|
+
// Refocus after rename
|
|
288
|
+
this.$nextTick(() => {
|
|
289
|
+
if (this.$refs.propertyNameInput) {
|
|
290
|
+
const inputs = Array.isArray(this.$refs.propertyNameInput)
|
|
291
|
+
? this.$refs.propertyNameInput
|
|
292
|
+
: [this.$refs.propertyNameInput]
|
|
293
|
+
if (inputs[0]) {
|
|
294
|
+
const input = inputs[0].$el.querySelector('input')
|
|
295
|
+
if (input) {
|
|
296
|
+
input.focus()
|
|
297
|
+
input.setSelectionRange(input.value.length, input.value.length)
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
})
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
}
|
|
305
|
+
</script>
|