An open source alternative to Tableau. Embeddable visual analytic
TypeScript bidatadata-analysisdata-miningdata-visualizationedak6skanarieslow-codepivot-tablereacttableautableau-alternativetypescriptvegavega-litevisualization
fix: block empty view workflow (#270)
islxyqwe4806b948a312
diff --git a/packages/graphic-walker/src/computation/index.ts b/packages/graphic-walker/src/computation/index.tsindex 7e82e3cc..7dca6995 100644--- a/packages/graphic-walker/src/computation/index.ts+++ b/packages/graphic-walker/src/computation/index.ts@@ -9,6 +9,7 @@ import type {IRow,ISortWorkflowStep,ITransformWorkflowStep,+ IViewWorkflowStep,IVisFilter,} from '../interfaces';import { getTimeFormat } from '../lib/inferMeta';@@ -86,12 +87,12 @@ export const dataReadRaw = async (};export const dataQuery = async (service: IComputationFunction, workflow: IDataQueryWorkflowStep[], limit?: number): Promise<IRow[]> => {+ const viewWorkflow = workflow.find(x => x.type === 'view') as IViewWorkflowStep | undefined;if (- workflow.length === 1 &&- workflow[0].type === 'view' &&- workflow[0].query.length === 1 &&- workflow[0].query[0].op === 'raw' &&- workflow[0].query[0].fields.length === 0+ viewWorkflow &&+ viewWorkflow.query.length === 1 &&+ viewWorkflow.query[0].op === 'raw' &&+ viewWorkflow.query[0].fields.length === 0) {return [];}diff --git a/packages/graphic-walker/src/fields/filterField/slider.tsx b/packages/graphic-walker/src/fields/filterField/slider.tsxindex 980fcb98..855db65f 100644--- a/packages/graphic-walker/src/fields/filterField/slider.tsx+++ b/packages/graphic-walker/src/fields/filterField/slider.tsx@@ -1,4 +1,4 @@-import React, { useEffect } from 'react';+import React, { useEffect, useState } from 'react';import styled from 'styled-components';import { filter, fromEvent, map, throttleTime } from 'rxjs';import { useTranslation } from 'react-i18next';@@ -71,10 +71,12 @@ const SliderSlice = styled.div`height: 100%;`;-const nicer = (range: readonly [number, number], value: number): string => {+ if (typeof value !== 'number') {+ console.warn('Expected a number but received', typeof value);+ return '';+ }const precision = /(\.\d*)$/.exec(((range[1] - range[0]) / 1000).toString())?.[0].length;-return precision === undefined ? `${value}` : value.toFixed(precision).replace(/\.?0+$/, '');};@@ -86,26 +88,41 @@ interface ValueInputProps {onChange: (value: number) => void;}-const ValueInput: React.FC<ValueInputProps> = props => {+const ValueInput: React.FC<ValueInputProps> = (props) => {const { min, max, value, resetValue, onChange } = props;- const handleSubmitValue = (value) => {- if (!isNaN(value) && value <= max && value >= min) {- onChange(value);+ const [innerValue, setInnerValue] = useState(`${value}`);++ const handleSubmitValue = () => {+ const v = Number(innerValue);+ if (!isNaN(v) && v <= max && v >= min) {+ onChange(v);} else {onChange(resetValue);+ setInnerValue(`${resetValue}`);}- }+ };++ useEffect(() => {+ setInnerValue(`${value}`);+ }, [value]);+return (<inputtype="number"min={min}max={max}className="block w-full rounded-md border-0 py-1 px-2 text-gray-900 dark:text-white shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 dark:bg-zinc-900 dark:border-gray-700 focus:ring-1 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"- value={value}- onChange={(e) => handleSubmitValue(Number(e.target.value))}+ value={innerValue}+ onChange={(e) => setInnerValue(e.target.value)}+ onBlur={handleSubmitValue}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ handleSubmitValue();+ }+ }}/>- )-}+ );+};interface SliderProps {min: number;