@oxygen-cms/ui 1.9.1 → 2.1.0
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/package.json +1 -1
- package/src/CrudApi.js +39 -0
- package/src/PagesApi.js +2 -0
- package/src/PartialsApi.js +7 -0
- package/src/components/ContentResourceEdit.vue +980 -0
- package/src/components/{PageEdit.vue → PageEditWysiwyg.vue} +1 -1
- package/src/components/ResourceList.vue +8 -3
- package/src/components/VersionsDrawer.vue +386 -0
- package/src/components/content/PartialNodeView.vue +1 -1
- package/src/components/pages/CreatePageDropdown.vue +5 -5
- package/src/components/pages/PageActions.vue +67 -0
- package/src/components/pages/PageChooseParent.vue +170 -0
- package/src/components/pages/PageEdit.vue +149 -0
- package/src/components/pages/PageList.vue +1 -1
- package/src/components/{PageNestedRow.vue → pages/PageNestedRow.vue} +3 -3
- package/src/components/{PageStatusIcon.vue → pages/PageStatusIcon.vue} +1 -1
- package/src/components/{PageTable.vue → pages/PageTable.vue} +5 -5
- package/src/components/partials/CreatePartialDropdown.vue +1 -1
- package/src/components/{PartialActions.vue → partials/PartialActions.vue} +1 -1
- package/src/components/partials/PartialEdit.vue +49 -0
- package/src/components/{PartialList.vue → partials/PartialList.vue} +3 -3
- package/src/components/{PartialStatusIcon.vue → partials/PartialStatusIcon.vue} +1 -1
- package/src/components/{PartialTable.vue → partials/PartialTable.vue} +1 -1
- package/src/icons.js +11 -2
- package/src/modules/PagesPartials.js +10 -27
- package/src/components/LegacyPage.vue +0 -263
- package/src/components/PageActions.vue +0 -151
- /package/src/components/{PageNestedPagination.vue → pages/PageNestedPagination.vue} +0 -0
package/package.json
CHANGED
package/src/CrudApi.js
CHANGED
|
@@ -36,6 +36,45 @@ export class CrudApi {
|
|
|
36
36
|
return data;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Determines if a model has unsaved changes compared to the server version.
|
|
41
|
+
* Can be overridden by subclasses to check specific fields.
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} model - The current model state
|
|
44
|
+
* @param {Object} serverModel - The original model from the server
|
|
45
|
+
* @returns {boolean}
|
|
46
|
+
*/
|
|
47
|
+
static isDirty(model, serverModel) {
|
|
48
|
+
if (!model || !serverModel) return false;
|
|
49
|
+
|
|
50
|
+
// Get all fillable fields from the model
|
|
51
|
+
const fillableFields = this.prepareModelForAPI(model);
|
|
52
|
+
const fieldsToCheck = Object.keys(fillableFields);
|
|
53
|
+
|
|
54
|
+
// Also check common fields that might not be in prepareModelForAPI
|
|
55
|
+
const commonFields = ['content', 'title', 'description', 'stage'];
|
|
56
|
+
const allFields = new Set([...fieldsToCheck, ...commonFields]);
|
|
57
|
+
|
|
58
|
+
for (const field of allFields) {
|
|
59
|
+
const modelValue = model[field];
|
|
60
|
+
const serverValue = serverModel[field];
|
|
61
|
+
|
|
62
|
+
// Handle arrays/objects with JSON comparison
|
|
63
|
+
if (typeof modelValue === 'object' && modelValue !== null) {
|
|
64
|
+
if (JSON.stringify(modelValue) !== JSON.stringify(serverValue)) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
// Simple value comparison
|
|
69
|
+
if (modelValue !== serverValue) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
|
|
39
78
|
async list({ inTrash, page, q, sortField, sortOrder }) {
|
|
40
79
|
return this.request('get')
|
|
41
80
|
.withQueryParams({
|
package/src/PagesApi.js
CHANGED
package/src/PartialsApi.js
CHANGED
|
@@ -12,6 +12,13 @@ export default class PartialsApi extends CrudApi {
|
|
|
12
12
|
static prepareModelForAPI(data) {
|
|
13
13
|
let m = { ...data };
|
|
14
14
|
delete m.id;
|
|
15
|
+
delete m.stage;
|
|
16
|
+
delete m.headVersion;
|
|
17
|
+
delete m.createdAt;
|
|
18
|
+
delete m.updatedAt;
|
|
19
|
+
delete m.deletedAt;
|
|
20
|
+
delete m.createdBy;
|
|
21
|
+
delete m.updatedBy;
|
|
15
22
|
return m;
|
|
16
23
|
}
|
|
17
24
|
|