@blokkli/editor 2.0.0-alpha.16 → 2.0.0-alpha.18
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/dist/module.json +1 -1
- package/dist/module.mjs +640 -137
- package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +1 -1
- package/dist/modules/drupal/graphql/base/fragment.paragraphsFieldItem.graphql +3 -1
- package/dist/modules/drupal/graphql/base/query.pbConfig.graphql +1 -10
- package/dist/modules/drupal/graphql/features/comments.graphql +11 -8
- package/dist/modules/drupal/graphql/mutations/set_paragraph_schedule.graphql +15 -0
- package/dist/modules/drupal/index.mjs +33 -0
- package/dist/modules/drupal/runtime/adapter/index.js +12 -4
- package/dist/runtime/adapter/index.d.ts +21 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +3 -0
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue +23 -15
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +20 -44
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +10 -5
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +4 -2
- package/dist/runtime/components/BlokkliEditable.vue +32 -14
- package/dist/runtime/components/BlokkliField.vue +3 -0
- package/dist/runtime/components/BlokkliField.vue.d.ts +3 -3
- package/dist/runtime/components/BlokkliItem.vue +1 -1
- package/dist/runtime/components/BlokkliItem.vue.d.ts +4 -2
- package/dist/runtime/components/BlokkliProvider.vue +41 -28
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +2 -1
- package/dist/runtime/components/Edit/Actions/index.vue +36 -20
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +436 -25
- package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +83 -0
- package/dist/runtime/components/Edit/ArtboardTooltip/index.vue.d.ts +32 -0
- package/dist/runtime/components/Edit/Banner/index.vue +51 -0
- package/dist/runtime/components/Edit/Banner/index.vue.d.ts +18 -0
- package/dist/runtime/components/Edit/Dialog/index.vue +6 -4
- package/dist/runtime/components/Edit/DraggableList.vue +15 -7
- package/dist/runtime/components/Edit/DraggableList.vue.d.ts +5 -5
- package/dist/runtime/components/Edit/EditIndicator.vue +118 -44
- package/dist/runtime/components/Edit/EditIndicator.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/EditProvider.vue +101 -31
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/AddList/index.vue +9 -11
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +28 -26
- package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue +1 -1
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +15 -11
- package/dist/runtime/components/Edit/Features/Anchors/Renderer.vue +19 -102
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +3 -0
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +29 -53
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue +154 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue.d.ts +27 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +222 -0
- package/dist/runtime/components/Edit/Features/{Selection/AddButtons/AddButtonsField.vue.d.ts → BlockScheduler/Dialog/index.vue.d.ts} +6 -9
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +96 -0
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +15 -16
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +51 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/{Group → Item}/index.vue.d.ts +9 -13
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +46 -66
- package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +2 -0
- package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +35 -20
- package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue.d.ts +5 -3
- package/dist/runtime/components/Edit/Features/Comments/CommentInput/index.vue +29 -0
- package/dist/runtime/components/Edit/Features/{Publish/Dialog/ScheduleDate.vue.d.ts → Comments/CommentInput/index.vue.d.ts} +2 -2
- package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +22 -16
- package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue.d.ts +1 -0
- package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue +15 -6
- package/dist/runtime/components/Edit/Features/Comments/index.vue +21 -9
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +4 -7
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +26 -35
- package/dist/runtime/components/Edit/Features/Debug/Renderer.vue +240 -0
- package/dist/runtime/components/Edit/Features/Debug/Renderer.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Debug/index.vue +7 -165
- package/dist/runtime/components/Edit/Features/Delete/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +14 -6
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +55 -48
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +30 -18
- package/dist/runtime/components/Edit/Features/Duplicate/index.vue +6 -8
- package/dist/runtime/components/Edit/Features/Edit/index.vue +16 -22
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +7 -6
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +69 -4
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +13 -9
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +45 -87
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +41 -43
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +11 -9
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/History/index.vue +5 -2
- package/dist/runtime/components/Edit/Features/Hover/Overlay/fragment.glsl +139 -0
- package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue +261 -0
- package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Hover/Overlay/vertex.glsl +117 -0
- package/dist/runtime/components/Edit/Features/Hover/index.vue +25 -0
- package/dist/runtime/components/Edit/Features/Hover/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +5 -7
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +19 -27
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +32 -28
- package/dist/runtime/components/Edit/Features/Library/index.vue +28 -23
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +6 -3
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +15 -12
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +36 -29
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +2 -4
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +6 -1
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +8 -6
- package/dist/runtime/components/Edit/Features/Options/index.vue +6 -6
- package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue +35 -0
- package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Ownership/index.vue +7 -25
- package/dist/runtime/components/Edit/Features/ProxyView/index.vue +5 -1
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +68 -15
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +15 -15
- package/dist/runtime/components/Edit/Features/Search/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +39 -74
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +7 -5
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/fragment.glsl +106 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +440 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue.d.ts +32 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/vertex.glsl +102 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +53 -125
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +88 -29
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +5 -3
- package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +11 -2
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Selection/index.vue +66 -39
- package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue +13 -6
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +3 -0
- package/dist/runtime/components/Edit/Features/Transform/index.vue +2 -27
- package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +17 -11
- package/dist/runtime/components/Edit/Features/Translations/index.vue +20 -23
- package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue +5 -5
- package/dist/runtime/components/Edit/Features/index.vue +17 -7
- package/dist/runtime/components/Edit/Form/Text/index.vue +2 -1
- package/dist/runtime/components/Edit/Form/Text/index.vue.d.ts +1 -0
- package/dist/runtime/components/Edit/Form/Toggle/index.vue +4 -3
- package/dist/runtime/components/Edit/Form/Toggle/index.vue.d.ts +12 -2
- package/dist/runtime/components/Edit/Indicators/index.vue +1 -1
- package/dist/runtime/components/Edit/InfoBox/index.vue +6 -2
- package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +12 -2
- package/dist/runtime/components/Edit/Konami/Game/index.vue +5 -5
- package/dist/runtime/components/Edit/{Features/Publish/Dialog/ScheduleDate.vue → ScheduleDate/index.vue} +6 -58
- package/dist/runtime/components/Edit/ScheduleDate/index.vue.d.ts +23 -0
- package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +3 -0
- package/dist/runtime/components/Edit/Transition/Height.vue +95 -0
- package/dist/runtime/components/Edit/Transition/Height.vue.d.ts +36 -0
- package/dist/runtime/components/Edit/index.d.ts +7 -3
- package/dist/runtime/components/Edit/index.js +12 -4
- package/dist/runtime/composables/defineBlokkli.js +4 -2
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/animationProvider.d.ts +35 -1
- package/dist/runtime/helpers/animationProvider.js +179 -48
- package/dist/runtime/helpers/composables/defineRenderer.d.ts +8 -0
- package/dist/runtime/helpers/composables/defineRenderer.js +8 -0
- package/dist/runtime/helpers/composables/useStateBasedCache.d.ts +4 -0
- package/dist/runtime/helpers/composables/useStateBasedCache.js +13 -0
- package/dist/runtime/helpers/composables/useStickyToolbar.d.ts +4 -1
- package/dist/runtime/helpers/composables/useStickyToolbar.js +53 -35
- package/dist/runtime/helpers/definitionProvider.d.ts +1 -1
- package/dist/runtime/helpers/dom/index.d.ts +1 -0
- package/dist/runtime/helpers/domProvider.d.ts +54 -14
- package/dist/runtime/helpers/domProvider.js +168 -134
- package/dist/runtime/helpers/index.d.ts +1 -8
- package/dist/runtime/helpers/index.js +1 -84
- package/dist/runtime/helpers/providers/blocks.d.ts +10 -0
- package/dist/runtime/helpers/providers/blocks.js +91 -0
- package/dist/runtime/helpers/providers/directive.d.ts +24 -0
- package/dist/runtime/helpers/providers/directive.js +205 -0
- package/dist/runtime/helpers/providers/element.d.ts +6 -0
- package/dist/runtime/helpers/providers/element.js +35 -0
- package/dist/runtime/helpers/providers/fields.d.ts +8 -0
- package/dist/runtime/helpers/providers/fields.js +47 -0
- package/dist/runtime/helpers/selectionProvider.d.ts +11 -11
- package/dist/runtime/helpers/selectionProvider.js +38 -45
- package/dist/runtime/helpers/stateProvider.d.ts +7 -2
- package/dist/runtime/helpers/stateProvider.js +83 -14
- package/dist/runtime/helpers/storageProvider.d.ts +3 -2
- package/dist/runtime/helpers/storageProvider.js +6 -2
- package/dist/runtime/helpers/symbols.d.ts +1 -0
- package/dist/runtime/helpers/symbols.js +1 -0
- package/dist/runtime/helpers/themeProvider.d.ts +2 -1
- package/dist/runtime/helpers/themeProvider.js +24 -14
- package/dist/runtime/helpers/typesProvider.js +10 -26
- package/dist/runtime/helpers/uiProvider.d.ts +11 -3
- package/dist/runtime/helpers/uiProvider.js +45 -17
- package/dist/runtime/icons/calendar.svg +1 -0
- package/dist/runtime/icons/clock.svg +1 -0
- package/dist/runtime/icons/comment_add.svg +1 -5
- package/dist/runtime/icons/delete.svg +1 -8
- package/dist/runtime/icons/duplicate.svg +1 -12
- package/dist/runtime/icons/edit.svg +1 -8
- package/dist/runtime/icons/reusable.svg +1 -5
- package/dist/runtime/plugins/blokkliDirectives.js +96 -0
- package/dist/runtime/types/index.d.ts +66 -35
- package/package.json +1 -1
- package/dist/runtime/components/Edit/DragInteractions/index.vue +0 -401
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +0 -63
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue +0 -54
- package/dist/runtime/plugins/blokkliEditable.js +0 -31
- /package/dist/runtime/components/Edit/{DragInteractions → Features/BlockScheduler}/index.vue.d.ts +0 -0
- /package/dist/runtime/plugins/{blokkliEditable.d.ts → blokkliDirectives.d.ts} +0 -0
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
7
|
-
import
|
|
7
|
+
import defineRenderer from "#blokkli/helpers/composables/defineRenderer";
|
|
8
|
+
import { useBlokkli, computed } from "#imports";
|
|
8
9
|
import {
|
|
9
10
|
setBuffersAndAttributes,
|
|
10
11
|
drawBufferInfo,
|
|
@@ -18,7 +19,7 @@ const props = defineProps({
|
|
|
18
19
|
results: { type: Array, required: true },
|
|
19
20
|
gl: { type: null, required: true }
|
|
20
21
|
});
|
|
21
|
-
const { animation, ui, theme, selection, eventBus } = useBlokkli();
|
|
22
|
+
const { animation, ui, theme, selection, eventBus, element } = useBlokkli();
|
|
22
23
|
const programInfo = animation.registerProgram("analyze", props.gl, [vs, fs]);
|
|
23
24
|
const statusPriority = {
|
|
24
25
|
violation: 3,
|
|
@@ -26,7 +27,6 @@ const statusPriority = {
|
|
|
26
27
|
pass: 1,
|
|
27
28
|
inapplicable: 0
|
|
28
29
|
};
|
|
29
|
-
const providerElement = ui.providerElement();
|
|
30
30
|
const nodes = computed(() => {
|
|
31
31
|
const allNodes = props.results.filter((v) => v.status === "incomplete" || v.status === "violation").flatMap((result) => {
|
|
32
32
|
const nodes2 = Array.isArray(result.nodes) ? result.nodes : [result.nodes];
|
|
@@ -34,14 +34,18 @@ const nodes = computed(() => {
|
|
|
34
34
|
const targets = Array.isArray(node.targets) ? node.targets : [node.targets];
|
|
35
35
|
return targets.map((v) => {
|
|
36
36
|
if (typeof v === "string") {
|
|
37
|
-
return
|
|
37
|
+
return element.query(
|
|
38
|
+
ui.providerElement,
|
|
39
|
+
v,
|
|
40
|
+
"Find analyze node target element."
|
|
41
|
+
);
|
|
38
42
|
}
|
|
39
43
|
return v;
|
|
40
|
-
}).filter((v) => v instanceof HTMLElement).filter((v) => providerElement.contains(v));
|
|
41
|
-
}).map((
|
|
44
|
+
}).filter((v) => v instanceof HTMLElement).filter((v) => ui.providerElement.contains(v));
|
|
45
|
+
}).map((element2) => {
|
|
42
46
|
return {
|
|
43
47
|
id: result.id,
|
|
44
|
-
element,
|
|
48
|
+
element: element2,
|
|
45
49
|
title: result.title,
|
|
46
50
|
status: result.status
|
|
47
51
|
};
|
|
@@ -112,23 +116,24 @@ class AnalyzeRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
const collector = new AnalyzeRectangleBufferCollector(props.gl);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
defineRenderer("analyze-overlay", {
|
|
120
|
+
zIndex: 500,
|
|
121
|
+
enabled: () => !selection.isMultiSelecting.value && !selection.isDragging.value,
|
|
122
|
+
render: (ctx) => {
|
|
123
|
+
ctx.gl.useProgram(programInfo.program);
|
|
124
|
+
const { info } = collector.getBufferInfo();
|
|
125
|
+
if (!info) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
setUniforms(programInfo, {
|
|
129
|
+
u_color_violation: toShaderColor(theme.red.value.normal),
|
|
130
|
+
u_color_incomplete: toShaderColor(theme.yellow.value.normal),
|
|
131
|
+
u_color_pass: toShaderColor(theme.lime.value.normal)
|
|
132
|
+
});
|
|
133
|
+
animation.setSharedUniforms(ctx.gl, programInfo);
|
|
134
|
+
setBuffersAndAttributes(ctx.gl, programInfo, info);
|
|
135
|
+
drawBufferInfo(ctx.gl, info, ctx.gl.TRIANGLES);
|
|
123
136
|
}
|
|
124
|
-
setUniforms(programInfo, {
|
|
125
|
-
u_color_violation: toShaderColor(theme.red.value.normal),
|
|
126
|
-
u_color_incomplete: toShaderColor(theme.yellow.value.normal),
|
|
127
|
-
u_color_pass: toShaderColor(theme.lime.value.normal)
|
|
128
|
-
});
|
|
129
|
-
animation.setSharedUniforms(props.gl, programInfo);
|
|
130
|
-
setBuffersAndAttributes(props.gl, programInfo, info);
|
|
131
|
-
drawBufferInfo(props.gl, info, props.gl.TRIANGLES);
|
|
132
137
|
});
|
|
133
138
|
onBlokkliEvent("ui:resized", function() {
|
|
134
139
|
collector.clearCache();
|
|
@@ -156,9 +161,6 @@ onBlokkliEvent("mouse:up", (e) => {
|
|
|
156
161
|
}
|
|
157
162
|
}
|
|
158
163
|
});
|
|
159
|
-
onBeforeUnmount(() => {
|
|
160
|
-
props.gl.clear(props.gl.COLOR_BUFFER_BIT);
|
|
161
|
-
});
|
|
162
164
|
</script>
|
|
163
165
|
|
|
164
166
|
<script>
|
|
@@ -75,7 +75,7 @@ const lastRun = useState(() => 0);
|
|
|
75
75
|
const lastRunKey = useState(() => "");
|
|
76
76
|
const selectedCategory = useState(() => ALL);
|
|
77
77
|
const hasInitialized = useState(() => false);
|
|
78
|
-
const providerRootElement = ui.providerElement
|
|
78
|
+
const providerRootElement = ui.providerElement;
|
|
79
79
|
const resultsFiltered = computed(() => {
|
|
80
80
|
if (selectedCategory.value === ALL) {
|
|
81
81
|
return results.value;
|
|
@@ -23,20 +23,24 @@ const props = defineProps({
|
|
|
23
23
|
resultId: { type: String, required: true },
|
|
24
24
|
target: { type: null, required: true }
|
|
25
25
|
});
|
|
26
|
-
const { eventBus, dom } = useBlokkli();
|
|
26
|
+
const { eventBus, dom, blocks, element } = useBlokkli();
|
|
27
27
|
const elButton = useTemplateRef("elButton");
|
|
28
28
|
const isFocused = ref(false);
|
|
29
29
|
let focusTimeout = null;
|
|
30
30
|
function getElement() {
|
|
31
31
|
if (props.target) {
|
|
32
32
|
if (typeof props.target === "string") {
|
|
33
|
-
return
|
|
33
|
+
return element.query(
|
|
34
|
+
document.documentElement,
|
|
35
|
+
props.target,
|
|
36
|
+
"Find analyze result item node target."
|
|
37
|
+
);
|
|
34
38
|
} else if (props.target instanceof HTMLElement) {
|
|
35
39
|
return props.target;
|
|
36
40
|
} else if (typeof props.target === "object" && "uuid" in props.target) {
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
41
|
+
const item = blocks.getBlock(props.target.uuid);
|
|
42
|
+
if (item) {
|
|
43
|
+
return dom.getDragElement(item) ?? null;
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
}
|
|
@@ -53,8 +57,8 @@ function getLabel() {
|
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
|
-
function findClosestUuid(
|
|
57
|
-
const closestBlock =
|
|
60
|
+
function findClosestUuid(element2) {
|
|
61
|
+
const closestBlock = element2.closest("[data-uuid]");
|
|
58
62
|
if (closestBlock instanceof HTMLElement) {
|
|
59
63
|
const uuid = closestBlock.dataset.uuid;
|
|
60
64
|
if (uuid) {
|
|
@@ -63,11 +67,11 @@ function findClosestUuid(element) {
|
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
async function onClick() {
|
|
66
|
-
const
|
|
67
|
-
if (!
|
|
70
|
+
const element2 = getElement();
|
|
71
|
+
if (!element2) {
|
|
68
72
|
return;
|
|
69
73
|
}
|
|
70
|
-
const closestUuid = findClosestUuid(
|
|
74
|
+
const closestUuid = findClosestUuid(element2);
|
|
71
75
|
if (closestUuid) {
|
|
72
76
|
eventBus.emit("select", closestUuid);
|
|
73
77
|
} else {
|
|
@@ -75,7 +79,7 @@ async function onClick() {
|
|
|
75
79
|
}
|
|
76
80
|
await renderCycle();
|
|
77
81
|
eventBus.emit("scrollIntoView", {
|
|
78
|
-
element
|
|
82
|
+
element: element2
|
|
79
83
|
});
|
|
80
84
|
}
|
|
81
85
|
onBlokkliEvent("analyze:click-node", (e) => {
|
|
@@ -11,12 +11,28 @@
|
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script setup>
|
|
14
|
-
import { useBlokkli,
|
|
14
|
+
import { useBlokkli, useRoute, computed } from "#imports";
|
|
15
15
|
import { PluginBlockIndicator } from "#blokkli/plugins";
|
|
16
16
|
import { emitMessage } from "#blokkli/helpers/eventBus";
|
|
17
17
|
const route = useRoute();
|
|
18
|
-
const {
|
|
19
|
-
const
|
|
18
|
+
const { $t, adapter, dom } = useBlokkli();
|
|
19
|
+
const items = computed(() => {
|
|
20
|
+
const anchorItems = [];
|
|
21
|
+
for (const entry of Object.entries(dom.registeredBlocks.value)) {
|
|
22
|
+
const uuid = entry[0];
|
|
23
|
+
const element = entry[1];
|
|
24
|
+
if (!element || !uuid) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (element.id) {
|
|
28
|
+
anchorItems.push({
|
|
29
|
+
id: element.id,
|
|
30
|
+
uuid
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return anchorItems;
|
|
35
|
+
});
|
|
20
36
|
function getLinkForClipboard(item) {
|
|
21
37
|
if (adapter.buildAnchorLink) {
|
|
22
38
|
return adapter.buildAnchorLink(item.id, item.uuid);
|
|
@@ -34,103 +50,4 @@ function onClick(item) {
|
|
|
34
50
|
emitMessage(message, "success", void 0, true);
|
|
35
51
|
}
|
|
36
52
|
}
|
|
37
|
-
const items = ref([]);
|
|
38
|
-
const trackedElements = /* @__PURE__ */ new Map();
|
|
39
|
-
let observer = null;
|
|
40
|
-
const getAnchorData = (el) => {
|
|
41
|
-
const uuid = el.getAttribute("data-uuid");
|
|
42
|
-
const id = el.getAttribute("id");
|
|
43
|
-
return uuid && id ? { uuid, id } : null;
|
|
44
|
-
};
|
|
45
|
-
const syncItems = () => {
|
|
46
|
-
const newItems = Array.from(trackedElements.values());
|
|
47
|
-
items.value = newItems;
|
|
48
|
-
};
|
|
49
|
-
const checkElement = (el) => {
|
|
50
|
-
const data = getAnchorData(el);
|
|
51
|
-
const isTracked = trackedElements.has(el);
|
|
52
|
-
if (data && !isTracked) {
|
|
53
|
-
trackedElements.set(el, data);
|
|
54
|
-
return true;
|
|
55
|
-
} else if (!data && isTracked) {
|
|
56
|
-
trackedElements.delete(el);
|
|
57
|
-
return true;
|
|
58
|
-
} else if (data && isTracked) {
|
|
59
|
-
const existing = trackedElements.get(el);
|
|
60
|
-
if (existing.uuid !== data.uuid || existing.id !== data.id) {
|
|
61
|
-
trackedElements.set(el, data);
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
|
-
};
|
|
67
|
-
const processAddedNode = (node) => {
|
|
68
|
-
if (node.nodeType !== Node.ELEMENT_NODE) return false;
|
|
69
|
-
let changed = false;
|
|
70
|
-
const el = node;
|
|
71
|
-
if (el.hasAttribute("data-uuid") && el.hasAttribute("id")) {
|
|
72
|
-
changed = checkElement(el) || changed;
|
|
73
|
-
}
|
|
74
|
-
return changed;
|
|
75
|
-
};
|
|
76
|
-
const processRemovedNode = (node) => {
|
|
77
|
-
if (node.nodeType !== Node.ELEMENT_NODE) return false;
|
|
78
|
-
let changed = false;
|
|
79
|
-
const el = node;
|
|
80
|
-
if (!el.id) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
if (trackedElements.delete(el)) {
|
|
84
|
-
changed = true;
|
|
85
|
-
}
|
|
86
|
-
const toRemove = [];
|
|
87
|
-
for (const [trackedEl] of trackedElements) {
|
|
88
|
-
if (node.contains(trackedEl)) {
|
|
89
|
-
toRemove.push(trackedEl);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
for (const el2 of toRemove) {
|
|
93
|
-
trackedElements.delete(el2);
|
|
94
|
-
changed = true;
|
|
95
|
-
}
|
|
96
|
-
return changed;
|
|
97
|
-
};
|
|
98
|
-
onMounted(() => {
|
|
99
|
-
const elements = rootElement.querySelectorAll("[data-uuid][id]");
|
|
100
|
-
for (const el of elements) {
|
|
101
|
-
const data = getAnchorData(el);
|
|
102
|
-
if (data) {
|
|
103
|
-
trackedElements.set(el, data);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
syncItems();
|
|
107
|
-
observer = new MutationObserver((mutations) => {
|
|
108
|
-
let changed = false;
|
|
109
|
-
for (const mutation of mutations) {
|
|
110
|
-
if (mutation.type === "childList") {
|
|
111
|
-
for (const node of mutation.addedNodes) {
|
|
112
|
-
changed = processAddedNode(node) || changed;
|
|
113
|
-
}
|
|
114
|
-
for (const node of mutation.removedNodes) {
|
|
115
|
-
changed = processRemovedNode(node) || changed;
|
|
116
|
-
}
|
|
117
|
-
} else if (mutation.type === "attributes") {
|
|
118
|
-
const target = mutation.target;
|
|
119
|
-
changed = checkElement(target) || changed;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (changed) {
|
|
123
|
-
syncItems();
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
observer.observe(rootElement, {
|
|
127
|
-
childList: true,
|
|
128
|
-
subtree: true,
|
|
129
|
-
attributes: true,
|
|
130
|
-
attributeFilter: ["data-uuid", "id"]
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
onBeforeUnmount(() => {
|
|
134
|
-
observer?.disconnect();
|
|
135
|
-
});
|
|
136
53
|
</script>
|
|
@@ -232,6 +232,9 @@ const resetZoom = () => {
|
|
|
232
232
|
animation.requestDraw();
|
|
233
233
|
};
|
|
234
234
|
onBlokkliEvent("keyPressed", (e) => {
|
|
235
|
+
if (ui.hasDialogOpen.value) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
235
238
|
if (e.code === "Home") {
|
|
236
239
|
e.originalEvent.preventDefault();
|
|
237
240
|
artboard.scrollToTop();
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
:key="renderKey"
|
|
37
37
|
to="#blokkli-add-list-sidebar-before"
|
|
38
38
|
>
|
|
39
|
-
<div class="bk-list-sidebar-form">
|
|
39
|
+
<div class="bk bk-list-sidebar-form">
|
|
40
40
|
<input
|
|
41
41
|
id="add_block_search"
|
|
42
42
|
v-model="searchText"
|
|
@@ -91,53 +91,36 @@ const {
|
|
|
91
91
|
$t,
|
|
92
92
|
state,
|
|
93
93
|
dom,
|
|
94
|
-
definitions
|
|
94
|
+
definitions,
|
|
95
|
+
blocks
|
|
95
96
|
} = useBlokkli();
|
|
96
97
|
const shouldRender = computed(() => state.editMode.value === "editing");
|
|
97
98
|
const searchText = ref("");
|
|
98
99
|
const itemEntityType = runtimeConfig.itemEntityType;
|
|
99
100
|
const favorites = storage.use("blockFavorites", []);
|
|
100
|
-
const activeField = computed(() => {
|
|
101
|
-
if (selection.activeFieldKey.value) {
|
|
102
|
-
const el = document.querySelector(
|
|
103
|
-
`[data-field-key="${selection.activeFieldKey.value}"]`
|
|
104
|
-
);
|
|
105
|
-
if (el && el instanceof HTMLElement) {
|
|
106
|
-
const label = el.dataset.fieldLabel;
|
|
107
|
-
const name = el.dataset.fieldName;
|
|
108
|
-
const isNested = el.dataset.fieldIsNested === "true";
|
|
109
|
-
const hostEntityType = el.dataset.hostEntityType;
|
|
110
|
-
const hostEntityUuid = el.dataset.hostEntityUuid;
|
|
111
|
-
if (label && name && hostEntityType && hostEntityUuid) {
|
|
112
|
-
return { label, name, hostEntityType, hostEntityUuid, isNested };
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return void 0;
|
|
117
|
-
});
|
|
118
101
|
const getAllowedTypesForSelected = (p) => {
|
|
119
|
-
if (types.itemBundlesWithNested.includes(p.
|
|
120
|
-
return types.fieldConfig.forEntityTypeAndBundle(itemEntityType, p.
|
|
102
|
+
if (types.itemBundlesWithNested.includes(p.bundle)) {
|
|
103
|
+
return types.fieldConfig.forEntityTypeAndBundle(itemEntityType, p.bundle).flatMap((v) => v.allowedBundles).filter(Boolean);
|
|
121
104
|
}
|
|
122
|
-
if (p.
|
|
123
|
-
return types.fieldConfig.forEntityTypeAndBundle(itemEntityType, p.
|
|
105
|
+
if (p.host.type === itemEntityType) {
|
|
106
|
+
return types.fieldConfig.forEntityTypeAndBundle(itemEntityType, p.host.bundle).flatMap((v) => v.allowedBundles).filter(Boolean);
|
|
124
107
|
} else {
|
|
125
108
|
return types.getFieldConfig(
|
|
126
109
|
context.value.entityType,
|
|
127
110
|
context.value.entityBundle,
|
|
128
|
-
p.
|
|
111
|
+
p.host.fieldName
|
|
129
112
|
)?.allowedBundles || [];
|
|
130
113
|
}
|
|
131
114
|
};
|
|
132
|
-
const bundlesForRenderedFields = computed(
|
|
133
|
-
|
|
115
|
+
const bundlesForRenderedFields = computed(() => {
|
|
116
|
+
return dom.registeredFieldTypes.value.flatMap((field) => {
|
|
134
117
|
return types.getFieldConfig(
|
|
135
118
|
field.entityType,
|
|
136
119
|
field.entityBundle,
|
|
137
120
|
field.fieldName
|
|
138
121
|
)?.allowedBundles || [];
|
|
139
|
-
}).filter(onlyUnique)
|
|
140
|
-
);
|
|
122
|
+
}).filter(onlyUnique);
|
|
123
|
+
});
|
|
141
124
|
const generallyAvailableBundles = computed(
|
|
142
125
|
() => types.generallyAvailableBundles.filter(
|
|
143
126
|
(v) => (
|
|
@@ -147,15 +130,8 @@ const generallyAvailableBundles = computed(
|
|
|
147
130
|
)
|
|
148
131
|
);
|
|
149
132
|
const selectableBundles = computed(() => {
|
|
150
|
-
if (selection.
|
|
151
|
-
return selection.
|
|
152
|
-
}
|
|
153
|
-
if (activeField.value && activeField.value.hostEntityType === context.value.entityType) {
|
|
154
|
-
return types.getFieldConfig(
|
|
155
|
-
context.value.entityType,
|
|
156
|
-
context.value.entityBundle,
|
|
157
|
-
activeField.value.name
|
|
158
|
-
)?.allowedBundles || [];
|
|
133
|
+
if (selection.items.value.length) {
|
|
134
|
+
return selection.items.value.flatMap((v) => getAllowedTypesForSelected(v));
|
|
159
135
|
}
|
|
160
136
|
return generallyAvailableBundles.value.map((v) => v.id || "");
|
|
161
137
|
});
|
|
@@ -191,18 +167,18 @@ const sortedList = computed(() => {
|
|
|
191
167
|
});
|
|
192
168
|
const renderKey = ref("");
|
|
193
169
|
const getBundlesForAppendCommands = () => {
|
|
194
|
-
|
|
170
|
+
const item = selection.item.value;
|
|
171
|
+
if (!item) {
|
|
195
172
|
return [];
|
|
196
173
|
}
|
|
197
|
-
const block = selection.blocks.value[0];
|
|
198
174
|
const field = types.getFieldConfig(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
175
|
+
item.host.type,
|
|
176
|
+
item.host.bundle,
|
|
177
|
+
item.host.fieldName
|
|
202
178
|
);
|
|
203
179
|
if (field) {
|
|
204
180
|
if (field.cardinality !== -1) {
|
|
205
|
-
const key = getFieldKey(
|
|
181
|
+
const key = getFieldKey(item.host.uuid, item.host.fieldName);
|
|
206
182
|
const count = state.getFieldBlockCount(key);
|
|
207
183
|
if (count >= field.cardinality) {
|
|
208
184
|
return [];
|
|
@@ -213,7 +189,7 @@ const getBundlesForAppendCommands = () => {
|
|
|
213
189
|
return [];
|
|
214
190
|
};
|
|
215
191
|
const getAppendEndCommands = () => {
|
|
216
|
-
if (selection.
|
|
192
|
+
if (selection.items.value.length !== 0) {
|
|
217
193
|
return [];
|
|
218
194
|
}
|
|
219
195
|
return types.fieldConfig.forEntityTypeAndBundle(
|
|
@@ -279,7 +255,7 @@ const getInsertCommands = (block) => {
|
|
|
279
255
|
if (!block) {
|
|
280
256
|
return [];
|
|
281
257
|
}
|
|
282
|
-
const nestedFields = types.fieldConfig.forEntityTypeAndBundle(itemEntityType, block.
|
|
258
|
+
const nestedFields = types.fieldConfig.forEntityTypeAndBundle(itemEntityType, block.bundle).map((field) => {
|
|
283
259
|
return {
|
|
284
260
|
...field,
|
|
285
261
|
uuid: block.uuid
|
|
@@ -307,8 +283,8 @@ const getInsertCommands = (block) => {
|
|
|
307
283
|
});
|
|
308
284
|
}
|
|
309
285
|
);
|
|
310
|
-
if (block.
|
|
311
|
-
const parentBlock =
|
|
286
|
+
if (block.host.type === runtimeConfig.itemEntityType) {
|
|
287
|
+
const parentBlock = blocks.getBlock(block.host.uuid);
|
|
312
288
|
if (parentBlock) {
|
|
313
289
|
getInsertCommands(parentBlock).forEach((parentCommand) => {
|
|
314
290
|
commands.push(parentCommand);
|
|
@@ -318,7 +294,7 @@ const getInsertCommands = (block) => {
|
|
|
318
294
|
return commands;
|
|
319
295
|
};
|
|
320
296
|
const commandCallbackAppend = (bundle) => {
|
|
321
|
-
const block = selection.
|
|
297
|
+
const block = selection.items.value[0];
|
|
322
298
|
if (!block) {
|
|
323
299
|
return;
|
|
324
300
|
}
|
|
@@ -326,9 +302,9 @@ const commandCallbackAppend = (bundle) => {
|
|
|
326
302
|
bundle,
|
|
327
303
|
afterUuid: selection.uuids.value[0],
|
|
328
304
|
host: {
|
|
329
|
-
type: block.
|
|
330
|
-
uuid: block.
|
|
331
|
-
fieldName: block.
|
|
305
|
+
type: block.host.type,
|
|
306
|
+
uuid: block.host.uuid,
|
|
307
|
+
fieldName: block.host.fieldName
|
|
332
308
|
}
|
|
333
309
|
});
|
|
334
310
|
};
|
|
@@ -353,7 +329,7 @@ defineCommands(() => {
|
|
|
353
329
|
}
|
|
354
330
|
return [
|
|
355
331
|
...getAppendCommands(),
|
|
356
|
-
...getInsertCommands(selection.
|
|
332
|
+
...getInsertCommands(selection.items.value[0]),
|
|
357
333
|
...getAppendEndCommands()
|
|
358
334
|
];
|
|
359
335
|
});
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bk-schedule-section">
|
|
3
|
+
<FormToggle v-model="isEnabled" :disabled="disabled">
|
|
4
|
+
<div class="bk-schedule-section-toggle-title">
|
|
5
|
+
<Icon :name="icon" />
|
|
6
|
+
<div class="bk-schedule-section-toggle-title-label">{{ label }}</div>
|
|
7
|
+
</div>
|
|
8
|
+
</FormToggle>
|
|
9
|
+
|
|
10
|
+
<TransitionHeight opacity>
|
|
11
|
+
<div v-if="isEnabled" class="bk-schedule-section-content">
|
|
12
|
+
<div
|
|
13
|
+
v-if="hasMixedDates && !overrideMode"
|
|
14
|
+
class="bk-schedule-section-mixed"
|
|
15
|
+
>
|
|
16
|
+
<InfoBox :text="mixedDatesMessage" />
|
|
17
|
+
<button type="button" class="bk-button" @click="enableOverride">
|
|
18
|
+
{{ $t("blockSchedulerOverride", "Set date for all") }}
|
|
19
|
+
</button>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div v-if="!hasMixedDates || overrideMode">
|
|
23
|
+
<ScheduleDate v-model="selectedDate" />
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</TransitionHeight>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup>
|
|
31
|
+
import { ref, computed, watch, useBlokkli } from "#imports";
|
|
32
|
+
import {
|
|
33
|
+
FormToggle,
|
|
34
|
+
ScheduleDate,
|
|
35
|
+
InfoBox,
|
|
36
|
+
Icon,
|
|
37
|
+
TransitionHeight
|
|
38
|
+
} from "#blokkli/components";
|
|
39
|
+
const props = defineProps({
|
|
40
|
+
label: { type: String, required: true },
|
|
41
|
+
icon: { type: null, required: true },
|
|
42
|
+
items: { type: Array, required: true },
|
|
43
|
+
supportedBundles: { type: Array, required: true },
|
|
44
|
+
disabled: { type: Boolean, required: false, default: false }
|
|
45
|
+
});
|
|
46
|
+
const { $t, ui } = useBlokkli();
|
|
47
|
+
const modelValue = defineModel({ type: null });
|
|
48
|
+
const isEnabled = ref(false);
|
|
49
|
+
const selectedDate = ref(void 0);
|
|
50
|
+
const overrideMode = ref(false);
|
|
51
|
+
const hasMixedDates = computed(() => {
|
|
52
|
+
const supportedItems2 = props.items.filter(
|
|
53
|
+
(item) => props.supportedBundles.includes(item.bundle)
|
|
54
|
+
);
|
|
55
|
+
if (supportedItems2.length === 0) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const dates = supportedItems2.map((item) => item.date);
|
|
59
|
+
if (dates.every((date) => date == null)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
const firstDate = dates[0];
|
|
63
|
+
const allSame = dates.every((date) => date === firstDate);
|
|
64
|
+
return !allSame;
|
|
65
|
+
});
|
|
66
|
+
const commonDate = computed(() => {
|
|
67
|
+
if (hasMixedDates.value) {
|
|
68
|
+
return void 0;
|
|
69
|
+
}
|
|
70
|
+
const supportedItems2 = props.items.filter(
|
|
71
|
+
(item) => props.supportedBundles.includes(item.bundle)
|
|
72
|
+
);
|
|
73
|
+
const dates = supportedItems2.map((item) => item.date).filter((date) => date != null);
|
|
74
|
+
if (dates.length === 0) {
|
|
75
|
+
return void 0;
|
|
76
|
+
}
|
|
77
|
+
return dates[0] || void 0;
|
|
78
|
+
});
|
|
79
|
+
const mixedDatesMessage = computed(() => {
|
|
80
|
+
const supportedItems2 = props.items.filter(
|
|
81
|
+
(item) => props.supportedBundles.includes(item.bundle)
|
|
82
|
+
);
|
|
83
|
+
const dates = supportedItems2.map((item) => item.date).filter((date) => date != null);
|
|
84
|
+
const uniqueDates = [...new Set(dates)];
|
|
85
|
+
const formattedDates = uniqueDates.map((date) => ui.formatDate(date)).join(", ");
|
|
86
|
+
const message = $t(
|
|
87
|
+
"blockSchedulerMixedDates",
|
|
88
|
+
"Selected blocks have different dates: @dates"
|
|
89
|
+
);
|
|
90
|
+
return message.replace("@dates", formattedDates);
|
|
91
|
+
});
|
|
92
|
+
function getTomorrowDate() {
|
|
93
|
+
const tomorrow = /* @__PURE__ */ new Date();
|
|
94
|
+
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
95
|
+
tomorrow.setHours(12, 0, 0, 0);
|
|
96
|
+
return tomorrow.toISOString();
|
|
97
|
+
}
|
|
98
|
+
function getMostCommonDate() {
|
|
99
|
+
const supportedItems2 = props.items.filter(
|
|
100
|
+
(item) => props.supportedBundles.includes(item.bundle)
|
|
101
|
+
);
|
|
102
|
+
const dates = supportedItems2.map((item) => item.date).filter((date) => date != null);
|
|
103
|
+
if (dates.length === 0) {
|
|
104
|
+
return void 0;
|
|
105
|
+
}
|
|
106
|
+
const dateCount = /* @__PURE__ */ new Map();
|
|
107
|
+
for (const date of dates) {
|
|
108
|
+
dateCount.set(date, (dateCount.get(date) || 0) + 1);
|
|
109
|
+
}
|
|
110
|
+
let mostCommonDate;
|
|
111
|
+
let maxCount = 0;
|
|
112
|
+
for (const [date, count] of dateCount.entries()) {
|
|
113
|
+
if (count > maxCount) {
|
|
114
|
+
maxCount = count;
|
|
115
|
+
mostCommonDate = date;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return mostCommonDate;
|
|
119
|
+
}
|
|
120
|
+
const supportedItems = props.items.filter(
|
|
121
|
+
(item) => props.supportedBundles.includes(item.bundle)
|
|
122
|
+
);
|
|
123
|
+
const hasAnyDate = supportedItems.some((item) => item.date != null);
|
|
124
|
+
if (hasAnyDate && !props.disabled) {
|
|
125
|
+
isEnabled.value = true;
|
|
126
|
+
if (commonDate.value) {
|
|
127
|
+
selectedDate.value = commonDate.value;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
watch(isEnabled, (enabled) => {
|
|
131
|
+
if (!enabled) {
|
|
132
|
+
selectedDate.value = void 0;
|
|
133
|
+
overrideMode.value = false;
|
|
134
|
+
modelValue.value = null;
|
|
135
|
+
} else if (commonDate.value && !hasMixedDates.value) {
|
|
136
|
+
selectedDate.value = commonDate.value;
|
|
137
|
+
} else if (!selectedDate.value) {
|
|
138
|
+
selectedDate.value = getTomorrowDate();
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
watch(selectedDate, (date) => {
|
|
142
|
+
if (isEnabled.value) {
|
|
143
|
+
modelValue.value = date || null;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
function enableOverride() {
|
|
147
|
+
overrideMode.value = true;
|
|
148
|
+
selectedDate.value = getMostCommonDate() || getTomorrowDate();
|
|
149
|
+
}
|
|
150
|
+
defineExpose({
|
|
151
|
+
isEnabled,
|
|
152
|
+
selectedDate
|
|
153
|
+
});
|
|
154
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { BlokkliIcon } from '#blokkli-build/icons';
|
|
2
|
+
export type ScheduleItemData = {
|
|
3
|
+
uuid: string;
|
|
4
|
+
bundle: string;
|
|
5
|
+
date: string | null | undefined;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_Props = {
|
|
8
|
+
label: string;
|
|
9
|
+
icon: BlokkliIcon;
|
|
10
|
+
items: ScheduleItemData[];
|
|
11
|
+
supportedBundles: string[];
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type __VLS_PublicProps = __VLS_Props & {
|
|
15
|
+
modelValue?: string | null | undefined;
|
|
16
|
+
};
|
|
17
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
18
|
+
isEnabled: import("vue").Ref<boolean, boolean>;
|
|
19
|
+
selectedDate: import("vue").Ref<string | undefined, string | undefined>;
|
|
20
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
|
+
"update:modelValue": (value: string | null | undefined) => any;
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
23
|
+
"onUpdate:modelValue"?: ((value: string | null | undefined) => any) | undefined;
|
|
24
|
+
}>, {
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
export default _default;
|