apostrophe 4.28.1 → 4.29.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/CHANGELOG.md +29 -4
- package/README.md +2 -2
- package/defaults.js +1 -0
- package/lib/safe-json-script.js +27 -0
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposAdminBarLocale.vue +1 -1
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue +1 -0
- package/modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue +3 -5
- package/modules/@apostrophecms/area/ui/apos/components/AposBreadcrumbOperations.vue +13 -1
- package/modules/@apostrophecms/asset/lib/globalIcons.js +3 -0
- package/modules/@apostrophecms/attachment/index.js +43 -1
- package/modules/@apostrophecms/color-field/index.js +7 -1
- package/modules/@apostrophecms/doc/index.js +11 -1
- package/modules/@apostrophecms/doc-type/index.js +165 -32
- package/modules/@apostrophecms/doc-type/ui/apos/components/AposDocEditor.vue +1 -1
- package/modules/@apostrophecms/doc-type/ui/apos/logic/AposDocContextMenu.js +104 -59
- package/modules/@apostrophecms/file/index.js +109 -8
- package/modules/@apostrophecms/i18n/i18n/de.json +0 -2
- package/modules/@apostrophecms/i18n/i18n/en.json +40 -1
- package/modules/@apostrophecms/i18n/i18n/es.json +0 -1
- package/modules/@apostrophecms/i18n/i18n/fr.json +0 -1
- package/modules/@apostrophecms/i18n/i18n/it.json +0 -1
- package/modules/@apostrophecms/i18n/i18n/pt-BR.json +0 -1
- package/modules/@apostrophecms/i18n/i18n/sk.json +0 -1
- package/modules/@apostrophecms/i18n/ui/apos/apps/AposI18nBatchReporting.js +18 -1
- package/modules/@apostrophecms/i18n/ui/apos/apps/AposI18nLocalizeActions.js +50 -0
- package/modules/@apostrophecms/i18n/ui/apos/components/AposI18nLocalize.vue +56 -13
- package/modules/@apostrophecms/image/ui/apos/components/AposImageRelationshipEditor.vue +8 -2
- package/modules/@apostrophecms/layout-column-widget/index.js +156 -163
- package/modules/@apostrophecms/layout-widget/index.js +7 -2
- package/modules/@apostrophecms/layout-widget/ui/apos/components/AposAreaLayoutEditor.vue +6 -11
- package/modules/@apostrophecms/layout-widget/ui/apos/components/AposGridColumn.vue +3 -5
- package/modules/@apostrophecms/layout-widget/ui/apos/components/AposGridLayout.vue +4 -4
- package/modules/@apostrophecms/layout-widget/ui/apos/components/AposGridManager.vue +0 -16
- package/modules/@apostrophecms/layout-widget/ui/apos/lib/grid-state.mjs +7 -27
- package/modules/@apostrophecms/layout-widget/views/column.html +7 -9
- package/modules/@apostrophecms/login/index.js +39 -40
- package/modules/@apostrophecms/modal/ui/apos/components/AposDocsManagerToolbar.vue +17 -2
- package/modules/@apostrophecms/modal/ui/apos/components/AposModal.vue +3 -2
- package/modules/@apostrophecms/notification/ui/apos/components/AposNotification.vue +1 -0
- package/modules/@apostrophecms/page/index.js +2 -0
- package/modules/@apostrophecms/piece-type/index.js +3 -1
- package/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManager.vue +1 -0
- package/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManagerDisplay.vue +5 -0
- package/modules/@apostrophecms/recently-edited/index.js +831 -0
- package/modules/@apostrophecms/recently-edited/ui/apos/components/AposCellTitle.vue +54 -0
- package/modules/@apostrophecms/recently-edited/ui/apos/components/AposRecentlyEditedCombo.vue +454 -0
- package/modules/@apostrophecms/recently-edited/ui/apos/components/AposRecentlyEditedFilterTag.vue +75 -0
- package/modules/@apostrophecms/recently-edited/ui/apos/components/AposRecentlyEditedFilters.vue +287 -0
- package/modules/@apostrophecms/recently-edited/ui/apos/components/AposRecentlyEditedIcon.vue +16 -0
- package/modules/@apostrophecms/recently-edited/ui/apos/components/AposRecentlyEditedManager.vue +346 -0
- package/modules/@apostrophecms/recently-edited/ui/apos/composables/useRecentlyEditedBatch.js +193 -0
- package/modules/@apostrophecms/recently-edited/ui/apos/composables/useRecentlyEditedData.js +276 -0
- package/modules/@apostrophecms/recently-edited/ui/apos/composables/useRecentlyEditedFetch.js +199 -0
- package/modules/@apostrophecms/recently-edited/ui/apos/composables/useRecentlyEditedFilters.js +100 -0
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputRelationship.js +8 -4
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputWrapper.js +1 -1
- package/modules/@apostrophecms/styles/index.js +10 -0
- package/modules/@apostrophecms/styles/lib/apiRoutes.js +6 -0
- package/modules/@apostrophecms/styles/lib/handlers.js +5 -0
- package/modules/@apostrophecms/styles/lib/methods.js +9 -3
- package/modules/@apostrophecms/styles/lib/presets.js +119 -0
- package/modules/@apostrophecms/styles/ui/apos/components/TheAposStyles.vue +3 -8
- package/modules/@apostrophecms/styles/ui/apos/composables/AposStyles.js +1 -3
- package/modules/@apostrophecms/styles/ui/apos/render-factory.js +29 -0
- package/modules/@apostrophecms/styles/ui/apos/universal/backgroundHelpers.mjs +140 -0
- package/modules/@apostrophecms/styles/ui/apos/universal/customRules.mjs +105 -0
- package/modules/@apostrophecms/styles/ui/apos/universal/render.mjs +195 -15
- package/modules/@apostrophecms/template/index.js +22 -6
- package/modules/@apostrophecms/ui/ui/apos/components/AposCellContextMenu.vue +2 -0
- package/modules/@apostrophecms/ui/ui/apos/components/AposContextMenu.vue +18 -4
- package/modules/@apostrophecms/ui/ui/apos/composables/useInfiniteScroll.js +91 -0
- package/modules/@apostrophecms/ui/ui/apos/scss/global/_theme.scss +1 -0
- package/modules/@apostrophecms/ui/ui/apos/stores/modal.js +5 -2
- package/modules/@apostrophecms/ui/ui/apos/utils/index.js +9 -0
- package/modules/@apostrophecms/url/index.js +38 -4
- package/modules/@apostrophecms/widget-type/index.js +22 -6
- package/modules/@apostrophecms/widget-type/ui/apos/components/AposWidgetEditor.vue +8 -4
- package/package.json +17 -17
- package/test/add-missing-schema-fields-project/node_modules/.package-lock.json +2 -2
- package/test/layout-widget-migration.js +719 -0
- package/test/login-requirements.js +1 -1
- package/test/pieces-public-api.js +80 -0
- package/test/pieces.js +25 -0
- package/test/recently-edited.js +2311 -0
- package/test/schemas.js +39 -3
- package/test/static-build.js +642 -0
- package/test/styles.js +2569 -0
- package/.claude/settings.local.json +0 -15
- package/modules/@apostrophecms/layout-widget/ui/apos/components/AposLayoutColControlDialog.vue +0 -171
|
@@ -317,7 +317,7 @@ export default {
|
|
|
317
317
|
type: Object,
|
|
318
318
|
default: null
|
|
319
319
|
},
|
|
320
|
-
|
|
320
|
+
targetLocale: {
|
|
321
321
|
required: false,
|
|
322
322
|
type: Object,
|
|
323
323
|
default: null
|
|
@@ -385,7 +385,7 @@ export default {
|
|
|
385
385
|
title: this.$t('apostrophe:selectLocales'),
|
|
386
386
|
filter: '',
|
|
387
387
|
if() {
|
|
388
|
-
return !this.
|
|
388
|
+
return !this.targetLocale;
|
|
389
389
|
},
|
|
390
390
|
complete() {
|
|
391
391
|
return this.selectedLocales.length > 0;
|
|
@@ -409,7 +409,7 @@ export default {
|
|
|
409
409
|
},
|
|
410
410
|
values: {
|
|
411
411
|
toLocalize: { data: 'thisDocAndRelated' },
|
|
412
|
-
toLocales: { data: this.
|
|
412
|
+
toLocales: { data: this.targetLocale ? [ this.targetLocale ] : [] },
|
|
413
413
|
relatedDocSettings: { data: 'localizeNewRelated' },
|
|
414
414
|
relatedDocTypesToLocalize: { data: [] },
|
|
415
415
|
translateContent: { data: false },
|
|
@@ -836,7 +836,7 @@ export default {
|
|
|
836
836
|
this.modal.busy = true;
|
|
837
837
|
for (const locale of this.selectedLocales) {
|
|
838
838
|
try {
|
|
839
|
-
await apos.http.post(`${apos.modules[doc.type].action}/${doc._id}/localize`, {
|
|
839
|
+
const result = await apos.http.post(`${apos.modules[doc.type].action}/${doc._id}/localize`, {
|
|
840
840
|
body: {
|
|
841
841
|
toLocale: locale.name,
|
|
842
842
|
update: (doc._id === this.fullDoc._id) || !(this.wizard.values.relatedDocSettings.data === 'localizeNewRelated')
|
|
@@ -853,10 +853,11 @@ export default {
|
|
|
853
853
|
locale,
|
|
854
854
|
docTypeLabel: this.singular(doc.type),
|
|
855
855
|
doc,
|
|
856
|
+
result,
|
|
856
857
|
relationship: doc._id === this.fullDoc._id
|
|
857
858
|
});
|
|
858
859
|
|
|
859
|
-
if (this.
|
|
860
|
+
if (this.targetLocale && this.shouldRedirect) {
|
|
860
861
|
// Ask for the redirect URL, this way it still works if we
|
|
861
862
|
// need to carry a session across hostnames
|
|
862
863
|
const result = await apos.http.post(`${this.moduleOptions.action}/locale`, {
|
|
@@ -938,15 +939,57 @@ export default {
|
|
|
938
939
|
}
|
|
939
940
|
);
|
|
940
941
|
} else {
|
|
941
|
-
|
|
942
|
-
|
|
942
|
+
const successes = notifications.filter(({ type }) => type === 'success');
|
|
943
|
+
const count = successes.length;
|
|
944
|
+
const targetLocales = [ ...new Set(successes.map(item => item.locale.name)) ];
|
|
945
|
+
const managerOpen = apos.modal.get()
|
|
946
|
+
.some(modal => modal.componentName === 'AposRecentlyEditedManager');
|
|
947
|
+
|
|
948
|
+
if (count === 1) {
|
|
949
|
+
const item = successes[0];
|
|
950
|
+
const hasUrl = !!item.result?._url;
|
|
951
|
+
await apos.notify('apostrophe:localizingNotificationSuccess', {
|
|
943
952
|
type: 'success',
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
953
|
+
icon: 'translate-icon',
|
|
954
|
+
interpolate: { count },
|
|
955
|
+
dismiss: managerOpen,
|
|
956
|
+
...!managerOpen && {
|
|
957
|
+
buttons: [
|
|
958
|
+
{
|
|
959
|
+
type: 'event',
|
|
960
|
+
label: hasUrl
|
|
961
|
+
? 'apostrophe:localizeOpenDocument'
|
|
962
|
+
: 'apostrophe:localizeEditDocument',
|
|
963
|
+
name: 'localize-open-document',
|
|
964
|
+
data: {
|
|
965
|
+
_url: item.result?._url || null,
|
|
966
|
+
type: item.doc.type,
|
|
967
|
+
_id: item.result?._id || null,
|
|
968
|
+
locale: item.locale.name,
|
|
969
|
+
slug: item.result?.slug || item.doc.slug
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
]
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
} else if (count > 1) {
|
|
976
|
+
await apos.notify('apostrophe:localizingNotificationSuccess', {
|
|
977
|
+
type: 'success',
|
|
978
|
+
icon: 'translate-icon',
|
|
979
|
+
interpolate: { count },
|
|
980
|
+
dismiss: managerOpen,
|
|
981
|
+
...!managerOpen && {
|
|
982
|
+
buttons: [
|
|
983
|
+
{
|
|
984
|
+
type: 'event',
|
|
985
|
+
label: 'apostrophe:localizeManageDocuments',
|
|
986
|
+
name: 'localize-manage-documents',
|
|
987
|
+
data: {
|
|
988
|
+
locales: targetLocales
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
]
|
|
992
|
+
}
|
|
950
993
|
});
|
|
951
994
|
}
|
|
952
995
|
}
|
|
@@ -290,21 +290,27 @@ export default {
|
|
|
290
290
|
};
|
|
291
291
|
},
|
|
292
292
|
async submit() {
|
|
293
|
+
let attachment;
|
|
293
294
|
if (this.image.attachment) {
|
|
294
|
-
await apos.http.post(`${apos.attachment.action}/crop`, {
|
|
295
|
+
attachment = await apos.http.post(`${apos.attachment.action}/crop`, {
|
|
295
296
|
body: {
|
|
296
297
|
_id: this.image.attachment._id,
|
|
297
|
-
crop: this.docFields.data
|
|
298
|
+
crop: this.docFields.data,
|
|
299
|
+
annotate: true
|
|
298
300
|
},
|
|
299
301
|
busy: true
|
|
300
302
|
});
|
|
301
303
|
}
|
|
302
304
|
|
|
303
305
|
if (!this.widget) {
|
|
306
|
+
if (attachment) {
|
|
307
|
+
this.image.attachment = attachment;
|
|
308
|
+
}
|
|
304
309
|
this.$emit('modal-result', this.docFields.data);
|
|
305
310
|
} else {
|
|
306
311
|
const image = {
|
|
307
312
|
...this.image,
|
|
313
|
+
...(attachment && { attachment }),
|
|
308
314
|
_fields: this.docFields.data
|
|
309
315
|
};
|
|
310
316
|
const widget = {
|
|
@@ -1,50 +1,3 @@
|
|
|
1
|
-
const alignSchema = {
|
|
2
|
-
justify: {
|
|
3
|
-
type: 'select',
|
|
4
|
-
label: 'apostrophe:layoutJustify',
|
|
5
|
-
choices: [
|
|
6
|
-
{
|
|
7
|
-
label: 'apostrophe:layoutStretchHorizontal',
|
|
8
|
-
value: 'stretch'
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
label: 'apostrophe:layoutLeft',
|
|
12
|
-
value: 'start'
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
label: 'apostrophe:layoutRight',
|
|
16
|
-
value: 'end'
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
label: 'apostrophe:layoutCenter',
|
|
20
|
-
value: 'center'
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
align: {
|
|
25
|
-
type: 'select',
|
|
26
|
-
label: 'apostrophe:layoutAlign',
|
|
27
|
-
choices: [
|
|
28
|
-
{
|
|
29
|
-
label: 'apostrophe:layoutStretchVertical',
|
|
30
|
-
value: 'stretch'
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
label: 'apostrophe:layoutTop',
|
|
34
|
-
value: 'start'
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
label: 'apostrophe:layoutBottom',
|
|
38
|
-
value: 'end'
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
label: 'apostrophe:layoutMiddle',
|
|
42
|
-
value: 'center'
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
1
|
module.exports = {
|
|
49
2
|
extend: '@apostrophecms/widget-type',
|
|
50
3
|
options: {
|
|
@@ -67,13 +20,8 @@ module.exports = {
|
|
|
67
20
|
nativeAction: 'move',
|
|
68
21
|
placement: 'breadcrumb',
|
|
69
22
|
icon: 'cursor-move-icon',
|
|
70
|
-
rawEvents: [ 'mousedown', 'touchstart' ]
|
|
71
|
-
|
|
72
|
-
layoutColConfig: {
|
|
73
|
-
placement: 'breadcrumb',
|
|
74
|
-
icon: 'cog-icon',
|
|
75
|
-
type: 'menu',
|
|
76
|
-
modal: 'AposLayoutColControlDialog'
|
|
23
|
+
rawEvents: [ 'mousedown', 'touchstart' ],
|
|
24
|
+
hidden: true
|
|
77
25
|
},
|
|
78
26
|
layoutColEditStyles: {
|
|
79
27
|
action: 'apos-edit-styles',
|
|
@@ -85,7 +33,8 @@ module.exports = {
|
|
|
85
33
|
action: 'apos-layout-col-delete',
|
|
86
34
|
placement: 'breadcrumb',
|
|
87
35
|
icon: 'delete-icon',
|
|
88
|
-
tooltip: 'apostrophe:delete'
|
|
36
|
+
tooltip: 'apostrophe:delete',
|
|
37
|
+
hidden: true
|
|
89
38
|
}
|
|
90
39
|
}
|
|
91
40
|
};
|
|
@@ -103,127 +52,171 @@ module.exports = {
|
|
|
103
52
|
}
|
|
104
53
|
};
|
|
105
54
|
},
|
|
106
|
-
fields
|
|
55
|
+
fields: {
|
|
56
|
+
add: {
|
|
57
|
+
colstart: {
|
|
58
|
+
type: 'integer'
|
|
59
|
+
},
|
|
60
|
+
colspan: {
|
|
61
|
+
type: 'integer'
|
|
62
|
+
},
|
|
63
|
+
rowstart: {
|
|
64
|
+
type: 'integer',
|
|
65
|
+
def: 1
|
|
66
|
+
},
|
|
67
|
+
rowspan: {
|
|
68
|
+
type: 'integer',
|
|
69
|
+
def: 1
|
|
70
|
+
},
|
|
71
|
+
order: {
|
|
72
|
+
type: 'integer'
|
|
73
|
+
},
|
|
74
|
+
content: {
|
|
75
|
+
type: 'area',
|
|
76
|
+
options: {
|
|
77
|
+
widgets: {
|
|
78
|
+
'@apostrophecms/rich-text': {},
|
|
79
|
+
'@apostrophecms/image': {},
|
|
80
|
+
'@apostrophecms/video': {},
|
|
81
|
+
'@apostrophecms/file': {}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
// `utility` group is specifically excluded from tab
|
|
87
|
+
// rendering in AposModalTabsMixin, we show only Styles.
|
|
88
|
+
group: {
|
|
89
|
+
utility: {
|
|
90
|
+
fields: [ 'colstart', 'colspan', 'rowstart', 'rowspan', 'order', 'content' ]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
styles(self, options) {
|
|
107
95
|
const breakpoints = options?.labelBreakpoints ||
|
|
108
|
-
options?.breakpoints || // BC,
|
|
96
|
+
options?.breakpoints || // BC, deprecated
|
|
109
97
|
{};
|
|
110
98
|
return {
|
|
111
99
|
add: {
|
|
112
|
-
|
|
113
|
-
type: '
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
required: true
|
|
123
|
-
},
|
|
124
|
-
rowstart: {
|
|
125
|
-
type: 'integer',
|
|
126
|
-
def: 1
|
|
127
|
-
},
|
|
128
|
-
rowspan: {
|
|
129
|
-
type: 'integer',
|
|
130
|
-
def: 1
|
|
131
|
-
},
|
|
132
|
-
order: {
|
|
133
|
-
type: 'integer'
|
|
134
|
-
},
|
|
135
|
-
...alignSchema
|
|
100
|
+
showTablet: {
|
|
101
|
+
type: 'boolean',
|
|
102
|
+
label: 'apostrophe:layoutTabletShow',
|
|
103
|
+
...(options?.showBreakpointsHelp
|
|
104
|
+
? {
|
|
105
|
+
help: 'apostrophe:layoutTabletShowHelp',
|
|
106
|
+
helpInterpolation: {
|
|
107
|
+
mobile: breakpoints.mobile || 600,
|
|
108
|
+
tablet: breakpoints.tablet || 900
|
|
109
|
+
}
|
|
136
110
|
}
|
|
137
|
-
|
|
111
|
+
: {}),
|
|
112
|
+
def: true
|
|
138
113
|
},
|
|
139
|
-
|
|
140
|
-
type: '
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
rowstart: {
|
|
150
|
-
type: 'integer',
|
|
151
|
-
def: 1
|
|
152
|
-
},
|
|
153
|
-
rowspan: {
|
|
154
|
-
type: 'integer',
|
|
155
|
-
def: 1
|
|
156
|
-
},
|
|
157
|
-
order: {
|
|
158
|
-
type: 'integer'
|
|
159
|
-
},
|
|
160
|
-
show: {
|
|
161
|
-
type: 'boolean',
|
|
162
|
-
label: 'apostrophe:layoutTabletShow',
|
|
163
|
-
...(options?.showBreakpointsHelp
|
|
164
|
-
? {
|
|
165
|
-
help: 'apostrophe:layoutTabletShowHelp',
|
|
166
|
-
helpInterpolation: {
|
|
167
|
-
mobile: breakpoints.mobile || 600,
|
|
168
|
-
tablet: breakpoints.tablet || 900
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
: {}),
|
|
172
|
-
def: true
|
|
173
|
-
},
|
|
174
|
-
...alignSchema
|
|
114
|
+
showMobile: {
|
|
115
|
+
type: 'boolean',
|
|
116
|
+
label: 'apostrophe:layoutMobileShow',
|
|
117
|
+
...(options?.showBreakpointsHelp
|
|
118
|
+
? {
|
|
119
|
+
help: 'apostrophe:layoutMobileShowHelp',
|
|
120
|
+
helpInterpolation: {
|
|
121
|
+
mobile: breakpoints.mobile || 600
|
|
122
|
+
}
|
|
175
123
|
}
|
|
176
|
-
|
|
124
|
+
: {}),
|
|
125
|
+
def: true
|
|
177
126
|
},
|
|
178
|
-
|
|
179
|
-
type: '
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
},
|
|
199
|
-
show: {
|
|
200
|
-
type: 'boolean',
|
|
201
|
-
label: 'apostrophe:layoutMobileShow',
|
|
202
|
-
...(options?.showBreakpointsHelp
|
|
203
|
-
? {
|
|
204
|
-
help: 'apostrophe:layoutMobileShowHelp',
|
|
205
|
-
helpInterpolation: {
|
|
206
|
-
mobile: breakpoints.mobile || 600
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
: {}),
|
|
210
|
-
def: true
|
|
211
|
-
},
|
|
212
|
-
...alignSchema
|
|
127
|
+
justify: {
|
|
128
|
+
type: 'select',
|
|
129
|
+
label: 'apostrophe:layoutJustify',
|
|
130
|
+
property: '--justify',
|
|
131
|
+
choices: [
|
|
132
|
+
{
|
|
133
|
+
label: 'apostrophe:layoutStretchHorizontal',
|
|
134
|
+
value: 'stretch'
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
label: 'apostrophe:layoutLeft',
|
|
138
|
+
value: 'start'
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
label: 'apostrophe:layoutRight',
|
|
142
|
+
value: 'end'
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
label: 'apostrophe:layoutCenter',
|
|
146
|
+
value: 'center'
|
|
213
147
|
}
|
|
214
|
-
|
|
148
|
+
]
|
|
215
149
|
},
|
|
216
|
-
|
|
217
|
-
type: '
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
'
|
|
223
|
-
'
|
|
150
|
+
align: {
|
|
151
|
+
type: 'select',
|
|
152
|
+
label: 'apostrophe:layoutAlign',
|
|
153
|
+
property: '--align',
|
|
154
|
+
choices: [
|
|
155
|
+
{
|
|
156
|
+
label: 'apostrophe:layoutStretchVertical',
|
|
157
|
+
value: 'stretch'
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
label: 'apostrophe:layoutTop',
|
|
161
|
+
value: 'start'
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
label: 'apostrophe:layoutBottom',
|
|
165
|
+
value: 'end'
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
label: 'apostrophe:layoutMiddle',
|
|
169
|
+
value: 'center'
|
|
224
170
|
}
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
},
|
|
176
|
+
init(self) {
|
|
177
|
+
self.addColumnWidgetMigration();
|
|
178
|
+
},
|
|
179
|
+
methods(self) {
|
|
180
|
+
return {
|
|
181
|
+
addColumnWidgetMigration() {
|
|
182
|
+
self.apos.migration.add(
|
|
183
|
+
`${self.__meta.name}:flatten-column-schema`,
|
|
184
|
+
async () => {
|
|
185
|
+
await self.apos.migration.eachWidget({}, 5, async (doc, widget, dotPath) => {
|
|
186
|
+
if (widget.type !== self.name) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const update = self.migrateColumnWidget(widget, dotPath);
|
|
190
|
+
if (!update) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
await self.apos.doc.db.updateOne(
|
|
194
|
+
{ _id: doc._id },
|
|
195
|
+
update
|
|
196
|
+
);
|
|
197
|
+
});
|
|
225
198
|
}
|
|
199
|
+
);
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
migrateColumnWidget(widget, dotPath) {
|
|
203
|
+
if (!widget.desktop) {
|
|
204
|
+
return null;
|
|
226
205
|
}
|
|
206
|
+
const d = widget.desktop || {};
|
|
207
|
+
return {
|
|
208
|
+
$set: {
|
|
209
|
+
[`${dotPath}.colstart`]: d.colstart ?? null,
|
|
210
|
+
[`${dotPath}.colspan`]: d.colspan ?? null,
|
|
211
|
+
[`${dotPath}.rowstart`]: d.rowstart ?? 1,
|
|
212
|
+
[`${dotPath}.rowspan`]: d.rowspan ?? 1,
|
|
213
|
+
[`${dotPath}.order`]: d.order ?? null,
|
|
214
|
+
[`${dotPath}.justify`]: d.justify ?? null,
|
|
215
|
+
[`${dotPath}.align`]: d.align ?? null,
|
|
216
|
+
[`${dotPath}.showTablet`]: widget.tablet?.show ?? true,
|
|
217
|
+
[`${dotPath}.showMobile`]: widget.mobile?.show ?? true
|
|
218
|
+
}
|
|
219
|
+
};
|
|
227
220
|
}
|
|
228
221
|
};
|
|
229
222
|
}
|
|
@@ -71,6 +71,11 @@ module.exports = {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
+
},
|
|
75
|
+
group: {
|
|
76
|
+
utility: {
|
|
77
|
+
fields: [ 'columns' ]
|
|
78
|
+
}
|
|
74
79
|
}
|
|
75
80
|
};
|
|
76
81
|
},
|
|
@@ -358,12 +363,12 @@ module.exports = {
|
|
|
358
363
|
if (!Array.isArray(widgets)) {
|
|
359
364
|
return;
|
|
360
365
|
}
|
|
361
|
-
const items = widgets.filter(widget => widget.
|
|
366
|
+
const items = widgets.filter(widget => widget.showTablet !== false);
|
|
362
367
|
if (items.length % 2 === 0) {
|
|
363
368
|
return;
|
|
364
369
|
}
|
|
365
370
|
items.sort((a, b) =>
|
|
366
|
-
(a.
|
|
371
|
+
(a.order ?? 0) - (b.order ?? 0)
|
|
367
372
|
);
|
|
368
373
|
return items[items.length - 1]._id;
|
|
369
374
|
}
|
|
@@ -371,7 +371,7 @@ export default {
|
|
|
371
371
|
this.layoutColumnWidgetName,
|
|
372
372
|
contentFieldDefPerColumn[index]
|
|
373
373
|
);
|
|
374
|
-
Object.assign(widget
|
|
374
|
+
Object.assign(widget, {
|
|
375
375
|
colspan: item.colspan,
|
|
376
376
|
colstart: item.colstart,
|
|
377
377
|
rowstart: item.rowstart,
|
|
@@ -394,7 +394,7 @@ export default {
|
|
|
394
394
|
}
|
|
395
395
|
const { _id, ...rest } = patch;
|
|
396
396
|
const widget = this.newWidget(widgetName);
|
|
397
|
-
Object.assign(widget
|
|
397
|
+
Object.assign(widget, rest);
|
|
398
398
|
const insert = {
|
|
399
399
|
widget,
|
|
400
400
|
index: this.layoutColumnWidgets.length
|
|
@@ -427,7 +427,7 @@ export default {
|
|
|
427
427
|
this.layoutPatchMany(patches);
|
|
428
428
|
},
|
|
429
429
|
// Apply a partial widget patch, for only the current device mode
|
|
430
|
-
layoutPatchOne(patch
|
|
430
|
+
layoutPatchOne(patch) {
|
|
431
431
|
if (!patch || !patch._id) {
|
|
432
432
|
return;
|
|
433
433
|
}
|
|
@@ -439,7 +439,7 @@ export default {
|
|
|
439
439
|
// this is not the same as the nested object _id in the widget.
|
|
440
440
|
// Be sure to keep the existing internal _id's intact.
|
|
441
441
|
const { _id, ...rest } = patch;
|
|
442
|
-
Object.assign(widget
|
|
442
|
+
Object.assign(widget, rest);
|
|
443
443
|
// eslint-disable-next-line no-console
|
|
444
444
|
this.update(widget).catch(console.error);
|
|
445
445
|
},
|
|
@@ -453,20 +453,15 @@ export default {
|
|
|
453
453
|
this.layoutPatchOne(patch);
|
|
454
454
|
}
|
|
455
455
|
},
|
|
456
|
-
// Apply a full widget patch
|
|
456
|
+
// Apply a full widget patch
|
|
457
457
|
layoutPatchFull(patch) {
|
|
458
458
|
const widget = this.next.find(w => w._id === patch._id);
|
|
459
459
|
if (widget?.type !== this.layoutColumnWidgetName) {
|
|
460
460
|
return;
|
|
461
461
|
}
|
|
462
462
|
|
|
463
|
-
const {
|
|
464
|
-
_id, desktop = {}, tablet = {}, mobile = {}, ...rest
|
|
465
|
-
} = patch;
|
|
463
|
+
const { _id, ...rest } = patch;
|
|
466
464
|
Object.assign(widget, rest);
|
|
467
|
-
Object.assign(widget.desktop, desktop);
|
|
468
|
-
Object.assign(widget.tablet, tablet);
|
|
469
|
-
Object.assign(widget.mobile, mobile);
|
|
470
465
|
|
|
471
466
|
// eslint-disable-next-line no-console
|
|
472
467
|
this.update(widget).catch(console.error);
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
data-apos-test="aposLayoutItem"
|
|
11
11
|
:data-id="item._id"
|
|
12
12
|
:data-tablet-full="props.tabletFullItems[item._id] || false"
|
|
13
|
-
:data-visible-tablet="item.
|
|
14
|
-
:data-visible-mobile="item.
|
|
13
|
+
:data-visible-tablet="item.showTablet !== false"
|
|
14
|
+
:data-visible-mobile="item.showMobile !== false"
|
|
15
15
|
>
|
|
16
16
|
<slot />
|
|
17
17
|
</component>
|
|
@@ -45,9 +45,7 @@ const itemStyles = computed(() => {
|
|
|
45
45
|
'--colspan': props.item.colspan,
|
|
46
46
|
'--rowstart': props.item.rowstart,
|
|
47
47
|
'--rowspan': props.item.rowspan,
|
|
48
|
-
'--order': props.item.order
|
|
49
|
-
'--justify': props.item.justify,
|
|
50
|
-
'--align': props.item.align
|
|
48
|
+
'--order': props.item.order
|
|
51
49
|
},
|
|
52
50
|
widgetStyles.inline
|
|
53
51
|
];
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
:item="item"
|
|
32
32
|
:tablet-full-items="tabletFullItems"
|
|
33
33
|
:data-tablet-full="tabletFullItems[item._id] || false"
|
|
34
|
-
:data-visible-tablet="item.
|
|
35
|
-
:data-visible-mobile="item.
|
|
34
|
+
:data-visible-tablet="item.showTablet !== false"
|
|
35
|
+
:data-visible-mobile="item.showMobile !== false"
|
|
36
36
|
:data-id="`${ item._id }`"
|
|
37
37
|
>
|
|
38
38
|
<div
|
|
@@ -188,12 +188,12 @@ export default {
|
|
|
188
188
|
return {};
|
|
189
189
|
}
|
|
190
190
|
const items = this.gridState.current.items
|
|
191
|
-
.filter(widget => widget.
|
|
191
|
+
.filter(widget => widget.showTablet !== false);
|
|
192
192
|
if (items.length % 2 === 0) {
|
|
193
193
|
return {};
|
|
194
194
|
}
|
|
195
195
|
items.sort((a, b) =>
|
|
196
|
-
(a.
|
|
196
|
+
(a.order ?? 0) - (b.order ?? 0)
|
|
197
197
|
);
|
|
198
198
|
const lastId = items[items.length - 1]._id;
|
|
199
199
|
return {
|
|
@@ -98,7 +98,6 @@
|
|
|
98
98
|
:skip-info="true"
|
|
99
99
|
:disabled="opstate.disabled"
|
|
100
100
|
:teleport-modals="true"
|
|
101
|
-
@update="updateItem"
|
|
102
101
|
@operation="onBreadcrumbOperation(item, $event)"
|
|
103
102
|
/>
|
|
104
103
|
</div>
|
|
@@ -800,21 +799,6 @@ export default {
|
|
|
800
799
|
colstart
|
|
801
800
|
};
|
|
802
801
|
},
|
|
803
|
-
updateItem(data) {
|
|
804
|
-
const { align, justify } = (data[this.gridState.deviceMode] || {});
|
|
805
|
-
const patch = {
|
|
806
|
-
mobile: {
|
|
807
|
-
show: data.mobile?.show ?? true
|
|
808
|
-
},
|
|
809
|
-
tablet: {
|
|
810
|
-
show: data.tablet?.show ?? true
|
|
811
|
-
}
|
|
812
|
-
};
|
|
813
|
-
patch[this.gridState.deviceMode] ||= {};
|
|
814
|
-
patch[this.gridState.deviceMode].align = align;
|
|
815
|
-
patch[this.gridState.deviceMode].justify = justify;
|
|
816
|
-
this.patchItem(data, patch);
|
|
817
|
-
},
|
|
818
802
|
patchItem(item, patch) {
|
|
819
803
|
this.$emit('patch-item', {
|
|
820
804
|
...patch,
|