@conduction/nextcloud-vue 0.1.0-beta.4 → 0.1.0-beta.5

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.
Files changed (68) hide show
  1. package/dist/nextcloud-vue.cjs +67614 -0
  2. package/dist/nextcloud-vue.cjs.js +9554 -8980
  3. package/dist/nextcloud-vue.cjs.js.map +1 -1
  4. package/dist/nextcloud-vue.cjs.map +1 -0
  5. package/dist/nextcloud-vue.css +1231 -1231
  6. package/dist/nextcloud-vue.esm.js +9554 -8980
  7. package/dist/nextcloud-vue.esm.js.map +1 -1
  8. package/package.json +11 -4
  9. package/src/components/CnActionsBar/CnActionsBar.vue +235 -235
  10. package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +579 -579
  11. package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -217
  12. package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -121
  13. package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +418 -418
  14. package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -247
  15. package/src/components/CnCardGrid/CnCardGrid.vue +152 -152
  16. package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -132
  17. package/src/components/CnChartWidget/CnChartWidget.vue +320 -320
  18. package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -77
  19. package/src/components/CnCopyDialog/CnCopyDialog.vue +250 -250
  20. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +225 -225
  21. package/src/components/CnDashboardPage/CnDashboardPage.vue +390 -390
  22. package/src/components/CnDataTable/CnDataTable.vue +349 -349
  23. package/src/components/CnDeleteDialog/CnDeleteDialog.vue +170 -170
  24. package/src/components/CnDetailCard/CnDetailCard.vue +214 -214
  25. package/src/components/CnDetailPage/CnDetailPage.vue +285 -281
  26. package/src/components/CnFacetSidebar/CnFacetSidebar.vue +231 -231
  27. package/src/components/CnFilterBar/CnFilterBar.vue +152 -152
  28. package/src/components/CnFormDialog/CnFormDialog.vue +302 -11
  29. package/src/components/CnIcon/CnIcon.vue +89 -89
  30. package/src/components/CnIndexPage/CnIndexPage.vue +884 -874
  31. package/src/components/CnIndexSidebar/CnIndexSidebar.vue +503 -503
  32. package/src/components/CnItemCard/CnItemCard.vue +132 -132
  33. package/src/components/CnKpiGrid/CnKpiGrid.vue +89 -89
  34. package/src/components/CnMassActionBar/CnMassActionBar.vue +160 -160
  35. package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +320 -320
  36. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +238 -238
  37. package/src/components/CnMassExportDialog/CnMassExportDialog.vue +190 -190
  38. package/src/components/CnMassImportDialog/CnMassImportDialog.vue +491 -491
  39. package/src/components/CnNoteCard/CnNoteCard.vue +149 -149
  40. package/src/components/CnNotesCard/CnNotesCard.vue +413 -413
  41. package/src/components/CnObjectCard/CnObjectCard.vue +292 -292
  42. package/src/components/CnObjectSidebar/CnObjectSidebar.vue +876 -876
  43. package/src/components/CnPageHeader/CnPageHeader.vue +57 -57
  44. package/src/components/CnPagination/CnPagination.vue +252 -252
  45. package/src/components/CnRegisterMapping/CnRegisterMapping.vue +792 -792
  46. package/src/components/CnRowActions/CnRowActions.vue +95 -73
  47. package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -226
  48. package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +787 -787
  49. package/src/components/CnSchemaFormDialog/CnSchemaPropertiesTab.vue +305 -305
  50. package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +1398 -1398
  51. package/src/components/CnSchemaFormDialog/CnSchemaSecurityTab.vue +236 -236
  52. package/src/components/CnSettingsCard/CnSettingsCard.vue +92 -92
  53. package/src/components/CnSettingsSection/CnSettingsSection.vue +266 -266
  54. package/src/components/CnStatsBlock/CnStatsBlock.vue +420 -420
  55. package/src/components/CnStatusBadge/CnStatusBadge.vue +77 -77
  56. package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +540 -540
  57. package/src/components/CnTasksCard/CnTasksCard.vue +373 -373
  58. package/src/components/CnTileWidget/CnTileWidget.vue +159 -159
  59. package/src/components/CnTimelineStages/CnTimelineStages.vue +292 -292
  60. package/src/components/CnUserActionMenu/CnUserActionMenu.vue +435 -435
  61. package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +312 -312
  62. package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -180
  63. package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +211 -211
  64. package/src/index.js +1 -1
  65. package/src/types/notification.d.ts +13 -13
  66. package/src/types/organisation.d.ts +15 -15
  67. package/src/types/schema.d.ts +13 -13
  68. package/src/types/task.d.ts +6 -6
@@ -1,305 +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 &quot;Add property&quot; 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>
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 &quot;Add property&quot; 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>