@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.
Files changed (28) hide show
  1. package/package.json +1 -1
  2. package/src/CrudApi.js +39 -0
  3. package/src/PagesApi.js +2 -0
  4. package/src/PartialsApi.js +7 -0
  5. package/src/components/ContentResourceEdit.vue +980 -0
  6. package/src/components/{PageEdit.vue → PageEditWysiwyg.vue} +1 -1
  7. package/src/components/ResourceList.vue +8 -3
  8. package/src/components/VersionsDrawer.vue +386 -0
  9. package/src/components/content/PartialNodeView.vue +1 -1
  10. package/src/components/pages/CreatePageDropdown.vue +5 -5
  11. package/src/components/pages/PageActions.vue +67 -0
  12. package/src/components/pages/PageChooseParent.vue +170 -0
  13. package/src/components/pages/PageEdit.vue +149 -0
  14. package/src/components/pages/PageList.vue +1 -1
  15. package/src/components/{PageNestedRow.vue → pages/PageNestedRow.vue} +3 -3
  16. package/src/components/{PageStatusIcon.vue → pages/PageStatusIcon.vue} +1 -1
  17. package/src/components/{PageTable.vue → pages/PageTable.vue} +5 -5
  18. package/src/components/partials/CreatePartialDropdown.vue +1 -1
  19. package/src/components/{PartialActions.vue → partials/PartialActions.vue} +1 -1
  20. package/src/components/partials/PartialEdit.vue +49 -0
  21. package/src/components/{PartialList.vue → partials/PartialList.vue} +3 -3
  22. package/src/components/{PartialStatusIcon.vue → partials/PartialStatusIcon.vue} +1 -1
  23. package/src/components/{PartialTable.vue → partials/PartialTable.vue} +1 -1
  24. package/src/icons.js +11 -2
  25. package/src/modules/PagesPartials.js +10 -27
  26. package/src/components/LegacyPage.vue +0 -263
  27. package/src/components/PageActions.vue +0 -151
  28. /package/src/components/{PageNestedPagination.vue → pages/PageNestedPagination.vue} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxygen-cms/ui",
3
- "version": "1.9.1",
3
+ "version": "2.1.0",
4
4
  "description": "Various utilities for UI-building in Vue.js",
5
5
  "main": "none",
6
6
  "repository": {
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
@@ -21,6 +21,8 @@ export default class PagesApi extends CrudApi {
21
21
  delete m.createdBy;
22
22
  delete m.updatedBy;
23
23
  delete m.headVersion;
24
+ delete m.slug; // slug is computed from slugPart, not directly fillable
25
+ delete m.numChildren; // computed field
24
26
  return m;
25
27
  }
26
28
 
@@ -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