Skip to content

Commit

Permalink
WebcomponentsVue: Changed imports to import types
Browse files Browse the repository at this point in the history
  • Loading branch information
AufarZakiev committed Dec 24, 2024
1 parent 6e43b69 commit a8b12ab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 4 additions & 5 deletions libraries/webcomponents-vue/src/InputForm/InputForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import * as ui from 'datagrok-api/ui';
import * as DG from 'datagrok-api/dg';
import * as Vue from 'vue';

import {Advice, ValidationResult} from '@datagrok-libraries/compute-utils/reactive-tree-driver/src/data/common-types';
import type {ValidationResult} from '@datagrok-libraries/compute-utils/reactive-tree-driver/src/data/common-types';
import type {InputFormT} from '@datagrok-libraries/webcomponents';
import {ValidationResultBase} from '@datagrok-libraries/compute-utils/shared-utils/validation';
import {ConsistencyInfo} from '@datagrok-libraries/compute-utils/reactive-tree-driver/src/runtime/StateTreeNodes';
import type {ConsistencyInfo} from '@datagrok-libraries/compute-utils/reactive-tree-driver/src/runtime/StateTreeNodes';
import {injectInputBaseStatus, isInputInjected} from './utils';
import {BehaviorSubject, merge} from 'rxjs';
import {map, tap} from 'rxjs/operators';
Expand Down Expand Up @@ -52,7 +51,7 @@ export const InputForm = Vue.defineComponent({
const isReadonly = Vue.computed(() => props.isReadonly);

const states = Vue.reactive({
meta: {} as Record<string, any>
meta: {} as Record<string, any>,
});

useExtractedObservable(() => props.callMeta, (meta) => {
Expand All @@ -61,7 +60,7 @@ export const InputForm = Vue.defineComponent({
return merge(...entries).pipe(
tap(([k, val]) => {
states.meta[k] = Object.freeze(val);
})
}),
);
});

Expand Down
10 changes: 7 additions & 3 deletions libraries/webcomponents-vue/src/InputForm/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as grok from 'datagrok-api/grok';
import * as ui from 'datagrok-api/ui';
import * as DG from 'datagrok-api/dg';
import {ConsistencyInfo} from '@datagrok-libraries/compute-utils/reactive-tree-driver/src/runtime/StateTreeNodes';
import {ValidationResultBase} from '@datagrok-libraries/compute-utils/shared-utils/validation';
import type {ConsistencyInfo} from '@datagrok-libraries/compute-utils/reactive-tree-driver/src/runtime/StateTreeNodes';
import type {ValidationResultBase} from '@datagrok-libraries/compute-utils/shared-utils/validation';
import $ from 'cash-dom';
import {FuncCallInput, isFuncCallInput} from '@datagrok-libraries/compute-utils/shared-utils/input-wrappers';
import type {FuncCallInput} from '@datagrok-libraries/compute-utils/shared-utils/input-wrappers';

function addPopover(icon: HTMLElement) {
const popover = ui.div([], 'd4-tooltip');
Expand Down Expand Up @@ -194,6 +194,10 @@ export interface FuncCallInputStatusable<T = any> extends FuncCallInput<T> {
}) => void;
}

export function isFuncCallInput<T = any>(arg: any): arg is FuncCallInput<T> {
return arg && arg.root && arg.onInput;
}

export function isInputInjected(arg: any): arg is FuncCallInputStatusable {
return arg?.setStatus && isFuncCallInput(arg);
}

0 comments on commit a8b12ab

Please sign in to comment.