Skip to content

Commit 9a99eb4

Browse files
fix: send dataframe events in run mode
* fix: send dataframe events in run mode * fix: make cursor consistent betwwen modes for tag block
1 parent 1c3766a commit 9a99eb4

File tree

3 files changed

+4
-45
lines changed

3 files changed

+4
-45
lines changed

src/ui/src/components/core/content/CoreDataframe.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,15 +346,12 @@ const relativePosition = ref(0);
346346
const columnWidths = ref<number[]>([]);
347347
let columnBeingWidthAdjusted: number = null;
348348
349-
const wf = inject(injectionKeys.core);
350-
const instancePath = inject(injectionKeys.instancePath);
351-
352349
const {
353350
handleUpdateCell,
354351
handleAddRow,
355352
handleActionRow,
356353
isBusy: isUpdatingBusy,
357-
} = useDataFrameValueBroker(wf, instancePath, rootEl, table);
354+
} = useDataFrameValueBroker(rootEl, table);
358355
359356
async function onAddRow() {
360357
await handleAddRow();

src/ui/src/components/core/content/CoreDataframe/useDataframeValueBroker.ts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
import { ComponentPublicInstance, computed, Ref, ShallowRef } from "vue";
1+
import { ComponentPublicInstance, Ref, ShallowRef } from "vue";
22
import { type internal } from "arquero";
33
import { ARQUERO_INTERNAL_ID, UNNAMED_INDEX_COLUMN_PATTERN } from "./constants";
44
import { useJobs } from "./useJobs";
5-
import { Core, InstancePath } from "@/writerTypes";
6-
import { useComponentLinkedBlueprints } from "@/composables/useComponentBlueprints";
75

86
/**
97
* Encapsulates the logic to update an Arquero table and sync it with the backend
108
*/
119
export function useDataFrameValueBroker(
12-
wf: Core,
13-
instancePath: InstancePath,
1410
emitterEl: Ref<HTMLElement | ComponentPublicInstance>,
1511
table: ShallowRef<internal.ColumnTable | null>,
1612
) {
17-
const componentId = instancePath.at(-1).componentId;
18-
const component = computed(() => wf.getComponentById(componentId));
1913

2014
type Job =
2115
| {
@@ -69,8 +63,6 @@ export function useDataFrameValueBroker(
6963
[ARQUERO_INTERNAL_ID]: () => aq.op.row_number(),
7064
});
7165

72-
if (!isEventUsed(eventType)) return;
73-
7466
return new Promise((res) => {
7567
const event = new CustomEvent(eventType, {
7668
detail: {
@@ -88,7 +80,6 @@ export function useDataFrameValueBroker(
8880
async function handlerActionRow(action: string, rowIndex: number) {
8981
const eventType = "wf-dataframe-action";
9082
if (!table.value) throw Error("Table is not ready");
91-
if (!isEventUsed(eventType)) return;
9283

9384
const rowIndexBackend = rowIndex - 1; // 0-based index (arquero is based on 1-based index)
9485

@@ -137,8 +128,6 @@ export function useDataFrameValueBroker(
137128

138129
table.value = table.value.derive({ [columnName]: updater });
139130

140-
if (!isEventUsed(eventType)) return;
141-
142131
const record = cleanRecord(table.value.filter(recordFilter).object());
143132

144133
return new Promise((res) => {
@@ -153,18 +142,6 @@ export function useDataFrameValueBroker(
153142
});
154143
}
155144

156-
function isEventUsed(eventType: string): boolean {
157-
const isHandlerSet = component.value.handlers?.[eventType];
158-
const isBindingSet = component.value.binding?.eventType == eventType;
159-
const isBlueprintAttached = useComponentLinkedBlueprints(
160-
wf,
161-
componentId,
162-
eventType,
163-
).isLinked.value;
164-
165-
return Boolean(isHandlerSet || isBindingSet || isBlueprintAttached);
166-
}
167-
168145
function dispatchEvent(event: CustomEvent) {
169146
if (emitterEl.value instanceof HTMLElement) {
170147
emitterEl.value.dispatchEvent(event);

src/ui/src/components/core/content/CoreTags.vue

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import {
3535
primaryTextColor,
3636
} from "@/renderer/sharedStyleFields";
3737
import { WdsColor } from "@/wds/tokens";
38-
import { useComponentLinkedBlueprints } from "@/composables/useComponentBlueprints";
3938
4039
const clickHandlerStub = `
4140
def handle_tag_click(state, payload):
@@ -90,7 +89,7 @@ export default {
9089
};
9190
</script>
9291
<script setup lang="ts">
93-
import { computed, inject, useTemplateRef } from "vue";
92+
import { inject, useTemplateRef } from "vue";
9493
import injectionKeys from "@/injectionKeys";
9594
import chroma from "chroma-js";
9695
@@ -108,22 +107,8 @@ const COLOR_STEPS = [
108107
];
109108
const rootEl = useTemplateRef("rootEl");
110109
const fields = inject(injectionKeys.evaluatedFields);
111-
const componentId = inject(injectionKeys.componentId);
112-
const wf = inject(injectionKeys.core);
113110
const isBeingEdited = inject(injectionKeys.isBeingEdited);
114111
115-
const { isLinked: hasLinkedBlueprint } = useComponentLinkedBlueprints(
116-
wf,
117-
componentId,
118-
"wf-tag-click",
119-
);
120-
121-
const isClickable = computed(() => {
122-
if (hasLinkedBlueprint.value) return true;
123-
const component = wf.getComponentById(componentId);
124-
return typeof component.handlers?.["wf-tag-click"] !== "undefined";
125-
});
126-
127112
function generateColor(s: string | number) {
128113
if (!fields.rotateHue.value) {
129114
return fields.referenceColor.value;
@@ -188,7 +173,7 @@ function handleTagClick(tagId: string | number) {
188173
display: flex;
189174
align-items: center;
190175
gap: 4px;
191-
cursor: v-bind("isClickable ? 'pointer' : 'auto'");
176+
cursor: pointer;
192177
overflow: hidden;
193178
}
194179
.CoreTags__tag span {

0 commit comments

Comments
 (0)