@blokkli/editor 2.0.0-alpha.14 → 2.0.0-alpha.16

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 (47) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +922 -2
  3. package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliEditState.graphql +4 -0
  4. package/dist/modules/drupal/graphql/features/publishNew.graphql +1 -4
  5. package/dist/modules/drupal/graphql/features/scheduler.graphql +31 -0
  6. package/dist/modules/drupal/index.mjs +17 -0
  7. package/dist/modules/drupal/runtime/adapter/index.js +31 -1
  8. package/dist/runtime/adapter/index.d.ts +36 -0
  9. package/dist/runtime/blokkliPlugins/MenuButton/index.vue.d.ts +2 -2
  10. package/dist/runtime/components/Edit/Dialog/index.vue +3 -0
  11. package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +2 -0
  12. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +7 -1
  13. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +22 -3
  14. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/vertex.glsl +1 -0
  15. package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +33 -1
  16. package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue +41 -14
  17. package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue.d.ts +2 -0
  18. package/dist/runtime/components/Edit/Features/Publish/Dialog/PublishOption.vue +47 -0
  19. package/dist/runtime/components/Edit/Features/Publish/Dialog/PublishOption.vue.d.ts +19 -0
  20. package/dist/runtime/components/Edit/Features/Publish/Dialog/ScheduleDate.vue +183 -0
  21. package/dist/runtime/components/Edit/Features/Publish/Dialog/ScheduleDate.vue.d.ts +13 -0
  22. package/dist/runtime/components/Edit/Features/Publish/Dialog/Summary.vue +83 -0
  23. package/dist/runtime/components/Edit/Features/Publish/Dialog/Summary.vue.d.ts +9 -0
  24. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +391 -129
  25. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue.d.ts +3 -14
  26. package/dist/runtime/components/Edit/Features/Publish/index.vue +34 -20
  27. package/dist/runtime/components/Edit/Features/Selection/index.vue +21 -7
  28. package/dist/runtime/components/Edit/Form/Datepicker/index.vue +198 -0
  29. package/dist/runtime/components/Edit/Form/Datepicker/index.vue.d.ts +15 -0
  30. package/dist/runtime/components/Edit/Konami/Game/index.vue +8 -1
  31. package/dist/runtime/components/Edit/index.d.ts +2 -1
  32. package/dist/runtime/components/Edit/index.js +2 -0
  33. package/dist/runtime/composables/defineBlokkli.js +1 -1
  34. package/dist/runtime/css/output.css +1 -1
  35. package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.d.ts +1 -1
  36. package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.js +3 -2
  37. package/dist/runtime/helpers/domProvider.js +6 -1
  38. package/dist/runtime/helpers/stateProvider.d.ts +2 -1
  39. package/dist/runtime/helpers/stateProvider.js +31 -0
  40. package/dist/runtime/helpers/uiProvider.d.ts +2 -0
  41. package/dist/runtime/helpers/uiProvider.js +23 -0
  42. package/dist/runtime/helpers/webgl/index.d.ts +11 -2
  43. package/dist/runtime/helpers/webgl/index.js +162 -7
  44. package/dist/runtime/icons/calendar-clock.svg +1 -0
  45. package/dist/runtime/icons/eye-off.svg +1 -0
  46. package/dist/runtime/types/index.d.ts +9 -1
  47. package/package.json +1 -1
@@ -1,117 +1,276 @@
1
1
  <template>
2
2
  <DialogModal
3
3
  :title="$t('publishDialogTitle', 'Publish changes')"
4
- :width="1200"
4
+ :width="900"
5
5
  :submit-label
6
6
  :is-loading="isLoading"
7
- :can-submit="!!selectedToPublishItems.length"
7
+ :can-submit="canSubmit"
8
8
  class="bk-is-publish-dialog"
9
9
  @submit="onSubmit"
10
10
  @cancel="$emit('close')"
11
11
  >
12
12
  <div class="bk bk-form bk-dialog-publish-form">
13
- <FormGroup title="Einstellungen" horizontal>
14
- <FormItem v-if="publishOptions?.hasRevisionLogMessage">
15
- <FormTextarea
16
- id="revision-message"
17
- v-model="revisionMessage"
18
- label="Protokollnachricht der Revision"
19
- description="Beschreiben Sie kurz die vorgenommenen Änderungen"
20
- :disabled="isLoading"
13
+ <FormItem>
14
+ <div class="bk-form-label">
15
+ {{ $t("publishMode", "Publish mode")
16
+ }}<span class="bk-required-indicator">*</span>
17
+ </div>
18
+ <div class="bk-publish-options">
19
+ <PublishOption
20
+ v-for="option in publishModeOptions"
21
+ :id="option.id"
22
+ :key="option.id"
23
+ v-model="publishMode"
24
+ :icon="option.icon"
25
+ :color="option.color"
26
+ :label="option.label"
27
+ :description="option.description"
28
+ :disabled="option.disabled"
21
29
  />
22
- </FormItem>
23
- <FormItem>
24
- <FormToggle
25
- v-model="shouldPublish"
26
- :label="toggleLabel"
27
- :disabled="isLoading"
28
- />
29
- </FormItem>
30
- </FormGroup>
30
+ </div>
31
+ </FormItem>
32
+
33
+ <FormItem v-if="publishMode === 'scheduled'">
34
+ <div>
35
+ <label class="bk-form-label">
36
+ {{ $t("publishScheduleDate", "Publication date") }}
37
+ </label>
38
+ <div class="bk-publish-schedule-date-wrapper">
39
+ <div v-if="isAlreadyScheduled" class="bk-publish-scheduled-display">
40
+ {{
41
+ ui.formatDate(scheduleDate, {
42
+ weekday: "long",
43
+ year: "numeric",
44
+ month: "2-digit",
45
+ day: "2-digit",
46
+ hour: "2-digit",
47
+ minute: "2-digit"
48
+ })
49
+ }}
50
+ </div>
51
+ <ScheduleDate
52
+ v-else
53
+ v-model="scheduleDate"
54
+ :disabled="isLoading"
55
+ :error="scheduleDateError"
56
+ />
57
+ <button
58
+ v-if="isAlreadyScheduled"
59
+ type="button"
60
+ class="bk-button bk-is-danger"
61
+ @click="removeScheduledDate"
62
+ >
63
+ {{ $t("publishRemoveSchedule", "Remove schedule") }}
64
+ </button>
65
+ </div>
66
+ <div v-if="isAlreadyScheduled" class="bk-form-description">
67
+ {{
68
+ $t(
69
+ "publishAlreadyScheduledDescription",
70
+ "This page is already scheduled for publishing"
71
+ )
72
+ }}
73
+ </div>
74
+ </div>
75
+ </FormItem>
76
+
77
+ <FormItem v-if="publishOptions?.hasRevisionLogMessage">
78
+ <FormTextarea
79
+ id="revision-message"
80
+ v-model="revisionMessage"
81
+ :label="$t('publishRevisionLogMessage', 'Change description')"
82
+ :description="
83
+ $t(
84
+ 'publishRevisionLogMessageDescription',
85
+ 'Briefly describe the changes made'
86
+ )
87
+ "
88
+ :disabled="isLoading || isAlreadyScheduled"
89
+ rows="2"
90
+ />
91
+ </FormItem>
31
92
 
32
- <FormGroup title="Inhalte" horizontal>
33
- <FormItem>
34
- <template v-if="successItems.length">
35
- <h2 class="bk-heading-2">Erfolgreich veröffentlicht</h2>
93
+ <FormItem v-if="successItems.length && showTable">
94
+ <h2 class="bk-heading-2">
95
+ {{ $t("publishSuccessfullyPublished", "Successfully published") }}
96
+ </h2>
36
97
 
37
- <table class="bk-table bk-publish-dialog-table">
38
- <thead>
39
- <tr>
40
- <th>Name</th>
41
- <th colspan="2">Status</th>
42
- </tr>
43
- </thead>
98
+ <table class="bk-table bk-publish-dialog-table">
99
+ <thead>
100
+ <tr>
101
+ <th>{{ $t("publishName", "Name") }}</th>
102
+ <th colspan="2">{{ $t("publishStatus", "Status") }}</th>
103
+ </tr>
104
+ </thead>
44
105
 
45
- <tbody>
46
- <Item
47
- v-for="item in successItems"
48
- :key="'success' + item.id"
49
- v-bind="item"
50
- v-model="states"
51
- :is-current="item.id === currentId"
52
- :should-publish
53
- :is-mutating
54
- :mutation-status="mutationStatusItems[item.id]"
55
- />
56
- </tbody>
57
- </table>
58
- </template>
106
+ <tbody>
107
+ <Item
108
+ v-for="item in successItems"
109
+ :key="'success' + item.id"
110
+ v-bind="item"
111
+ v-model="states"
112
+ :is-current="item.id === currentId"
113
+ :should-publish
114
+ :is-mutating
115
+ :mutation-status="mutationStatusItems[item.id]"
116
+ :is-scheduled="enableScheduling"
117
+ :schedule-date
118
+ />
119
+ </tbody>
120
+ </table>
59
121
 
60
- <table class="bk-table bk-publish-dialog-table">
61
- <thead>
62
- <tr>
63
- <th>Name</th>
64
- <th colspan="2">Status</th>
65
- </tr>
66
- </thead>
122
+ <table class="bk-table bk-publish-dialog-table">
123
+ <thead>
124
+ <tr>
125
+ <th>{{ $t("publishName", "Name") }}</th>
126
+ <th colspan="2">{{ $t("publishStatus", "Status") }}</th>
127
+ </tr>
128
+ </thead>
67
129
 
68
- <tbody>
69
- <Item
70
- v-for="item in toPublishItems"
71
- :key="'to_publish_' + item.id"
72
- v-bind="item"
73
- v-model="states"
74
- :is-current="item.id === currentId"
75
- :should-publish
76
- :is-mutating
77
- :mutation-status="mutationStatusItems[item.id]"
78
- />
79
- </tbody>
80
- </table>
81
- </FormItem>
82
- </FormGroup>
130
+ <tbody>
131
+ <Item
132
+ v-for="item in toPublishItems"
133
+ :key="'to_publish_' + item.id"
134
+ v-bind="item"
135
+ v-model="states"
136
+ :is-current="item.id === currentId"
137
+ :should-publish
138
+ :is-mutating
139
+ :mutation-status="mutationStatusItems[item.id]"
140
+ :is-scheduled="enableScheduling"
141
+ :schedule-date
142
+ />
143
+ </tbody>
144
+ </table>
145
+ </FormItem>
83
146
  </div>
147
+ <template #pre-footer>
148
+ <div>
149
+ <h3 class="bk-form-label">
150
+ {{ $t("publishSummary", "Summary") }}
151
+ </h3>
152
+ <Summary
153
+ :is-published="isCurrentlyPublished"
154
+ :mode="publishMode"
155
+ :current-state-label="currentStateLabel"
156
+ :action-label="actionLabel"
157
+ :result-state-label="resultStateLabel"
158
+ />
159
+ </div>
160
+ </template>
84
161
  </DialogModal>
85
162
  </template>
86
163
 
87
164
  <script setup>
88
- import { ref, computed, useBlokkli, useAsyncData } from "#imports";
89
165
  import {
90
- DialogModal,
91
- FormToggle,
92
- FormTextarea,
93
- FormItem,
94
- FormGroup
95
- } from "#blokkli/components";
96
- import { falsy } from "#blokkli/helpers";
166
+ ref,
167
+ computed,
168
+ watch,
169
+ useBlokkli,
170
+ useAsyncData,
171
+ onMounted,
172
+ onUnmounted
173
+ } from "#imports";
174
+ import { DialogModal, FormTextarea, FormItem } from "#blokkli/components";
175
+ import { emitMessage } from "#blokkli/helpers/eventBus";
97
176
  import Item from "./Item.vue";
98
- const { adapter, $t, state, context } = useBlokkli();
177
+ import PublishOption, {} from "./PublishOption.vue";
178
+ import Summary from "./Summary.vue";
179
+ import ScheduleDate from "./ScheduleDate.vue";
180
+ const showTable = false;
181
+ const { adapter, $t, state, context, ui } = useBlokkli();
99
182
  const isMutating = ref(false);
100
183
  const mutationStatusItems = ref({});
101
184
  const publishedIds = ref([]);
102
- const shouldPublish = defineModel("shouldPublish", { type: Boolean, ...{
103
- default: () => false
104
- } });
105
- const states = defineModel("states", { type: Array, ...{
106
- default: () => []
107
- } });
108
- const revisionMessage = defineModel("revisionMessage", { type: String, ...{
109
- default: () => false
110
- } });
185
+ const states = ref([]);
186
+ const revisionMessage = ref("");
187
+ const currentTimestamp = ref(Date.now());
188
+ let timestampInterval = null;
189
+ onMounted(() => {
190
+ timestampInterval = setInterval(() => {
191
+ currentTimestamp.value = Date.now();
192
+ }, 3e4);
193
+ });
194
+ onUnmounted(() => {
195
+ if (timestampInterval) {
196
+ clearInterval(timestampInterval);
197
+ }
198
+ });
199
+ const publishMode = ref("immediate");
111
200
  const emit = defineEmits(["close", "submit"]);
112
- const { data: publishOptions, status } = await useAsyncData(() => {
201
+ const {
202
+ data: publishOptions,
203
+ status,
204
+ refresh
205
+ } = await useAsyncData(() => {
113
206
  return adapter.getPublishOptions();
114
207
  });
208
+ const canSchedule = computed(() => !!publishOptions.value?.canSchedule);
209
+ const publishOn = computed(
210
+ () => publishOptions.value?.publishOn ?? null
211
+ );
212
+ const isAlreadyScheduled = computed(() => !!publishOn.value);
213
+ const isCurrentlyPublished = computed(() => !!state.entity.value?.status);
214
+ const publishModeOptions = computed(() => {
215
+ const options = [
216
+ {
217
+ id: "save",
218
+ icon: "save",
219
+ color: "red",
220
+ label: $t("publishModeSaveTitle", "Save"),
221
+ description: $t(
222
+ "publishModeSaveDescription",
223
+ "Save changes without publishing"
224
+ ),
225
+ disabled: isCurrentlyPublished.value || isAlreadyScheduled.value
226
+ },
227
+ {
228
+ id: "immediate",
229
+ icon: "publish",
230
+ color: "lime",
231
+ label: $t("publishModeImmediateTitle", "Publish"),
232
+ description: $t(
233
+ "publishModeImmediateDescription",
234
+ "Publish changes immediately"
235
+ ),
236
+ disabled: isAlreadyScheduled.value
237
+ }
238
+ ];
239
+ if (canSchedule.value) {
240
+ options.push({
241
+ id: "scheduled",
242
+ icon: "calendar-clock",
243
+ color: "yellow",
244
+ label: $t("publishModeScheduledTitle", "Schedule"),
245
+ description: $t(
246
+ "publishModeScheduledDescription",
247
+ "Schedule changes for publishing"
248
+ ),
249
+ disabled: false
250
+ });
251
+ }
252
+ return options;
253
+ });
254
+ const scheduleDate = ref(publishOn.value || "");
255
+ if (publishOptions.value?.revisionLogMessage) {
256
+ revisionMessage.value = publishOptions.value.revisionLogMessage;
257
+ }
258
+ if (!isCurrentlyPublished.value) {
259
+ publishMode.value = "save";
260
+ }
261
+ if (publishOn.value) {
262
+ publishMode.value = "scheduled";
263
+ }
264
+ watch(publishMode, (newMode) => {
265
+ if (newMode === "scheduled" && !scheduleDate.value) {
266
+ const tomorrow = /* @__PURE__ */ new Date();
267
+ tomorrow.setDate(tomorrow.getDate() + 1);
268
+ tomorrow.setHours(12, 0, 0, 0);
269
+ scheduleDate.value = tomorrow.toISOString();
270
+ }
271
+ });
272
+ const enableScheduling = computed(() => publishMode.value === "scheduled");
273
+ const shouldPublish = computed(() => publishMode.value !== "save");
115
274
  const { data: editStates } = await useAsyncData(
116
275
  () => {
117
276
  if (adapter.getEditStates) {
@@ -167,39 +326,133 @@ const selectedToPublishItems = computed(
167
326
  )
168
327
  );
169
328
  const isLoading = computed(() => status.value === "pending" || isMutating.value);
170
- const submitLabelPublish = computed(() => {
171
- if (shouldPublish.value) {
172
- const count = 1 + states.value.length;
173
- return "@count Inhalte publizieren".replace("@count", count.toString());
329
+ const scheduleDateError = computed(() => {
330
+ if (publishMode.value !== "scheduled" || !scheduleDate.value) {
331
+ return "";
332
+ }
333
+ const selectedDateTime = new Date(scheduleDate.value);
334
+ const minDateTime = new Date(currentTimestamp.value + 2 * 60 * 1e3);
335
+ if (selectedDateTime < minDateTime) {
336
+ return $t(
337
+ "publishScheduleDateTooSoon",
338
+ "The scheduled date must be at least 2 minutes in the future"
339
+ );
340
+ }
341
+ return "";
342
+ });
343
+ const canSubmit = computed(() => {
344
+ if (!selectedToPublishItems.value.length) {
345
+ return false;
346
+ }
347
+ if (publishMode.value === "scheduled" && !scheduleDate.value) {
348
+ return false;
174
349
  }
175
- return null;
350
+ if (publishMode.value === "scheduled" && isAlreadyScheduled.value) {
351
+ return false;
352
+ }
353
+ if (scheduleDateError.value) {
354
+ return false;
355
+ }
356
+ return true;
176
357
  });
177
- const submitLabelSave = computed(() => {
358
+ const submitLabel = computed(() => {
178
359
  const count = selectedToPublishItems.value.length;
179
- if (!count) {
180
- if (shouldPublish.value) {
181
- return "Inhalte publizieren";
360
+ if (publishMode.value === "scheduled") {
361
+ if (count === 0) {
362
+ return $t("publishSchedulePublication", "Schedule publication");
182
363
  }
183
- return "Inhalte speichern";
364
+ return count === 1 ? $t("publishSchedulePublication", "Schedule publication") : $t(
365
+ "publishSchedulePublications",
366
+ "Schedule @count publications"
367
+ ).replace("@count", count.toString());
184
368
  }
185
- if (!shouldPublish.value) {
186
- return "@count Inhalte speichern".replace("@count", count.toString());
369
+ if (publishMode.value === "save") {
370
+ if (count === 0) {
371
+ return $t("publishSaveContent", "Save content");
372
+ }
373
+ return count === 1 ? $t("publishSaveContent", "Save content") : $t("publishSaveContents", "Save @count contents").replace(
374
+ "@count",
375
+ count.toString()
376
+ );
187
377
  }
188
- return null;
378
+ if (count === 0) {
379
+ return $t("publishPublishContent", "Publish content");
380
+ }
381
+ return count === 1 ? $t("publishPublishContent", "Publish content") : $t("publishPublishContents", "Publish @count contents").replace(
382
+ "@count",
383
+ count.toString()
384
+ );
189
385
  });
190
- const submitLabel = computed(() => {
191
- return [submitLabelPublish.value, submitLabelSave.value].filter(falsy).join(", ");
386
+ const currentStateLabel = computed(
387
+ () => isCurrentlyPublished.value ? $t("publishCurrentlyPublished", "Page is published") : $t("publishCurrentlyUnpublished", "Page is unpublished")
388
+ );
389
+ const actionLabel = computed(() => {
390
+ if (publishMode.value === "save") {
391
+ return $t("publishModeSaveTitle", "Save");
392
+ }
393
+ if (publishMode.value === "scheduled") {
394
+ return $t("publishModeScheduledTitle", "Schedule");
395
+ }
396
+ return $t("publishModeImmediateTitle", "Publish");
192
397
  });
193
- const toggleLabel = computed(() => {
194
- if (states.value.length) {
195
- return "Inhalte publizieren";
398
+ const resultStateLabel = computed(() => {
399
+ if (publishMode.value === "save") {
400
+ return $t(
401
+ "publishResultSaveChanges",
402
+ "Changes are saved, page remains unpublished"
403
+ );
404
+ }
405
+ if (publishMode.value === "scheduled" && scheduleDate.value) {
406
+ const formattedDate = ui.formatDate(scheduleDate.value);
407
+ if (isCurrentlyPublished.value) {
408
+ return $t(
409
+ "publishResultScheduledChanges",
410
+ "Changes will be published on @date"
411
+ ).replace("@date", formattedDate);
412
+ }
413
+ return $t(
414
+ "publishResultScheduledPage",
415
+ "Page will be published on @date"
416
+ ).replace("@date", formattedDate);
417
+ }
418
+ if (isCurrentlyPublished.value) {
419
+ return $t(
420
+ "publishResultPublishChangesRemainPublished",
421
+ "Changes are published, page remains published"
422
+ );
196
423
  }
197
- return "Inhalt publizieren";
424
+ return $t(
425
+ "publishResultPublishChangesNowPublished",
426
+ "Changes are published, page is now published"
427
+ );
198
428
  });
429
+ async function removeScheduledDate() {
430
+ if (!adapter.unscheduleEditState) {
431
+ return;
432
+ }
433
+ isMutating.value = true;
434
+ const previousScheduleDate = scheduleDate.value;
435
+ const success = await state.mutateWithLoadingState(
436
+ () => adapter.unscheduleEditState({
437
+ hostEntityType: context.value.entityType,
438
+ hostEntityUuid: context.value.entityUuid
439
+ })
440
+ );
441
+ if (success) {
442
+ await refresh();
443
+ scheduleDate.value = previousScheduleDate;
444
+ }
445
+ isMutating.value = false;
446
+ }
199
447
  async function onSubmit() {
448
+ currentTimestamp.value = Date.now();
449
+ if (scheduleDateError.value) {
450
+ return;
451
+ }
200
452
  isMutating.value = true;
201
453
  const items = stateItems.value;
202
- let hasAnyError = false;
454
+ const hasAnyError = false;
455
+ let mutationResult = false;
203
456
  for (const item of items) {
204
457
  const isSelected = states.value.includes(item.id) || item.hostEntityType === context.value.entityType && item.hostEntityUuid === context.value.entityUuid;
205
458
  if (!isSelected) {
@@ -209,30 +462,29 @@ async function onSubmit() {
209
462
  continue;
210
463
  }
211
464
  try {
212
- const result = await adapter.publish({
213
- hostEntityType: item.hostEntityType,
214
- hostEntityUuid: item.hostEntityUuid,
215
- closeAfterPublish: true,
216
- revisionLogMessage: revisionMessage.value,
217
- publishIfUnpublished: shouldPublish.value
218
- });
219
- let violations = [];
220
- if (!result.success && result.state) {
221
- const mapped = adapter.mapState(result.state);
222
- if (mapped.mutatedState?.violations) {
223
- violations = mapped.mutatedState.violations;
465
+ if (publishMode.value === "scheduled") {
466
+ if (!adapter.scheduleEditState) {
467
+ throw new Error("scheduleEditState method not available");
224
468
  }
469
+ mutationResult = await state.mutateWithLoadingState(
470
+ () => adapter.scheduleEditState({
471
+ hostEntityType: item.hostEntityType,
472
+ hostEntityUuid: item.hostEntityUuid,
473
+ revisionLogMessage: revisionMessage.value,
474
+ date: scheduleDate.value
475
+ })
476
+ );
477
+ } else {
478
+ mutationResult = await state.mutateWithLoadingState(
479
+ () => adapter.publish({
480
+ hostEntityType: item.hostEntityType,
481
+ hostEntityUuid: item.hostEntityUuid,
482
+ closeAfterPublish: true,
483
+ revisionLogMessage: revisionMessage.value,
484
+ publishIfUnpublished: shouldPublish.value
485
+ })
486
+ );
225
487
  }
226
- mutationStatusItems.value[item.id] = {
227
- id: item.id,
228
- success: result.success,
229
- errors: result.errors,
230
- violations
231
- };
232
- if (result.success) {
233
- publishedIds.value.push(item.id);
234
- }
235
- hasAnyError ||= !result.success;
236
488
  } catch {
237
489
  mutationStatusItems.value[item.id] = {
238
490
  id: item.id,
@@ -244,9 +496,19 @@ async function onSubmit() {
244
496
  }
245
497
  }
246
498
  isMutating.value = false;
247
- if (hasAnyError) {
499
+ if (hasAnyError || !mutationResult) {
248
500
  return;
249
501
  }
250
- emit("submit");
502
+ if (publishMode.value === "scheduled") {
503
+ const formattedDate = ui.formatDate(scheduleDate.value);
504
+ const message = $t(
505
+ "publishScheduleSuccess",
506
+ "Publication scheduled for @date"
507
+ ).replace("@date", formattedDate);
508
+ emitMessage(message, "success");
509
+ emit("close");
510
+ } else {
511
+ emit("submit");
512
+ }
251
513
  }
252
514
  </script>
@@ -1,19 +1,8 @@
1
- type __VLS_PublicProps = {
2
- 'shouldPublish'?: boolean;
3
- 'states'?: string[];
4
- 'revisionMessage'?: string;
5
- };
6
- declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
2
  close: () => void;
8
3
  submit: () => void;
9
- "update:shouldPublish": (value: boolean) => void;
10
- "update:states": (value: string[]) => void;
11
- "update:revisionMessage": (value: string) => void;
12
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
4
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
13
5
  onClose?: (() => any) | undefined;
14
6
  onSubmit?: (() => any) | undefined;
15
- "onUpdate:shouldPublish"?: ((value: boolean) => any) | undefined;
16
- "onUpdate:states"?: ((value: string[]) => any) | undefined;
17
- "onUpdate:revisionMessage"?: ((value: string) => any) | undefined;
18
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
19
8
  export default _default;