refactor: replace yarn with npm (#1405)
* refactor: replace yarn with npm * revert npm requirement back to 14 for vercel * disable build Storybook job * fix linting errors * update lock file * rebase master and bump encodable/color to 1.1.1 * update package-lock.json update lock file * change node version format to satisfy vercel * remove restriction on @encodable/color * rename yarn.lock to package-lock.json * add resolved in lock file and restriction on @encodable/color * install dependences by npm ci Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
This commit is contained in:
parent
2e5d7d25c8
commit
f552abaa42
|
|
@ -38,28 +38,28 @@ jobs:
|
|||
${{ runner.OS }}-node-
|
||||
${{ runner.OS }}-
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Cache yarn
|
||||
- name: Get npm cache directory path
|
||||
id: npm-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(npm config get cache)"
|
||||
- name: Cache npm
|
||||
uses: actions/cache@v1
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
id: npm-cache # use this to check for `cache-hit` (`steps.npm-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
${{ runner.os }}-npm-
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
run: npm ci
|
||||
- name: Build packages
|
||||
run: yarn build
|
||||
run: npm run build
|
||||
- name: Run ESLint
|
||||
run: yarn lint --quiet
|
||||
run: npm run lint --quiet
|
||||
- name: Run unit tests
|
||||
run: yarn test
|
||||
run: npm run test
|
||||
- name: Build Storybook
|
||||
run: yarn build-storybook
|
||||
run: npm run build-storybook
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: storybookBuild
|
||||
|
|
|
|||
|
|
@ -1301,7 +1301,7 @@ $PWD/coverage.xml"
|
|||
-or -name .venvs \
|
||||
-or -name .virtualenv \
|
||||
-or -name .virtualenvs \
|
||||
-or -name .yarn-cache \
|
||||
-or -name .npm-cache \
|
||||
-or -name __pycache__ \
|
||||
-or -name env \
|
||||
-or -name envs \
|
||||
|
|
|
|||
|
|
@ -40,28 +40,28 @@ jobs:
|
|||
${{ runner.OS }}-node-
|
||||
${{ runner.OS }}-
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Cache yarn
|
||||
- name: Get npm cache directory path
|
||||
id: npm-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(npm config get cache)"
|
||||
- name: Cache npm
|
||||
uses: actions/cache@v1
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
id: npm-cache # use this to check for `cache-hit` (`steps.npm-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
${{ runner.os }}-npm-
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
run: npm ci
|
||||
- name: Build packages
|
||||
run: yarn build
|
||||
run: npm run build
|
||||
- name: Run unit tests
|
||||
run: yarn test
|
||||
run: npm run test
|
||||
|
||||
- name: Configure npm and git
|
||||
run: |
|
||||
yarn logout
|
||||
npm logout
|
||||
echo "@superset-ui:registry=https://registry.npmjs.org/" > .npmrc
|
||||
echo "registry=https://registry.npmjs.org/" >> .npmrc
|
||||
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> $HOME/.npmrc 2> /dev/null
|
||||
|
|
@ -77,7 +77,7 @@ jobs:
|
|||
run: |
|
||||
git update-index --assume-unchanged .npmrc
|
||||
git tag -d `git tag | grep -E '^trigger-'`
|
||||
yarn ci:release-from-tag
|
||||
npm run ci:release-from-tag
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
|||
|
|
@ -36,13 +36,9 @@ test-changelog.md
|
|||
|
||||
*.tsbuildinfo
|
||||
|
||||
# Ignore npm lock files, always use yarn.lock instead
|
||||
npm-shrinkwrap.json
|
||||
package-lock.json
|
||||
|
||||
# Ignore yarn.lock in packages
|
||||
plugins/*/yarn.lock
|
||||
packages/*/yarn.lock
|
||||
# Ignore package-lock in packages
|
||||
plugins/*/package-lock.json
|
||||
packages/*/package-lock.json
|
||||
|
||||
# For country map geojson conversion script
|
||||
.ipynb_checkpoints/
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
package-lock=false
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"arrowParens": "avoid",
|
||||
"bracketSpacing": true,
|
||||
"jsxBracketSameLine": false,
|
||||
"bracketSameLine": false,
|
||||
"printWidth": 100,
|
||||
"proseWrap": "always",
|
||||
"requirePragma": false,
|
||||
|
|
|
|||
|
|
@ -3,24 +3,24 @@
|
|||
### Setup local development
|
||||
|
||||
1. clone this repo
|
||||
2. have `yarn` install package dependencies and manage the symlinking between packages for you
|
||||
2. have `npm` install package dependencies and manage the symlinking between packages for you
|
||||
|
||||
```sh
|
||||
git clone ...superset-ui && cd superset-ui
|
||||
yarn install
|
||||
yarn build
|
||||
npm ci
|
||||
npm build
|
||||
```
|
||||
|
||||
To build only selected packages or plugins,
|
||||
|
||||
```bash
|
||||
yarn build "*chart-table"
|
||||
npm build "*chart-table"
|
||||
```
|
||||
|
||||
### File organization
|
||||
|
||||
[lerna](https://github.com/lerna/lerna/) and [yarn](https://yarnpkg.com) are used to manage versions
|
||||
and dependencies between packages in this monorepo.
|
||||
[lerna](https://github.com/lerna/lerna/) and [npm](https://www.npmjs.com/) are used to manage
|
||||
versions and dependencies between packages in this monorepo.
|
||||
|
||||
```
|
||||
superset-ui/
|
||||
|
|
@ -44,7 +44,7 @@ superset-ui/
|
|||
### Builds, linting, and testing
|
||||
|
||||
Each package defines its own build config, linting, and testing. You can have lerna run commands
|
||||
across all packages using the syntax `yarn run test` (or `yarn run test:watch` for watch mode) from
|
||||
across all packages using the syntax `npm run test` (or `npm run test:watch` for watch mode) from
|
||||
the root `@superset-ui` directory.
|
||||
|
||||
- [Using Storybook](docs/storybook.md) - You can test your components independently from Superset
|
||||
|
|
@ -65,7 +65,7 @@ committing. You can use `npm run commit` to help you create a commit message.
|
|||
publish new versions of `superset-ui`.
|
||||
|
||||
1. Checkout the `master` branch from the main repo at `apache-superset/superset-ui` - NOT A FORK!
|
||||
2. run `yarn run ci:create-patch-version` to bump the patch version (the most common case) or
|
||||
`yarn run ci:create-minor-version` to bump the minor version. Once the process finishes and the
|
||||
2. run `npm run ci:create-patch-version` to bump the patch version (the most common case) or
|
||||
`npm run ci:create-minor-version` to bump the minor version. Once the process finishes and the
|
||||
commit has been pushed to GitHub, CI will complete publishing the release to npm (takes some time
|
||||
to complete).
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
## Activate plugins for local development
|
||||
|
||||
1. First, make sure you have run `yarn` and `yarn build` in `superset-ui` or your own plugin repo.
|
||||
1. First, make sure you have run `npm ci` and `npm run build` in `superset-ui` or your own plugin
|
||||
repo.
|
||||
2. Go to [superset-frontend](https://github.com/apache/superset/tree/master/superset-frontend), use
|
||||
`npm link` to create a symlink of the plugin source code in `node_modules`:
|
||||
|
||||
|
|
@ -23,4 +24,4 @@
|
|||
|
||||
## Deactivate plugins
|
||||
|
||||
To deactivate a plugin, simply run `npm install` in `superset/superset-frontend` again.
|
||||
To deactivate a plugin, simply run `npm ci` in `superset/superset-frontend` again.
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
You can demo your changes by running the storybook demo locally with the following commands:
|
||||
|
||||
```sh
|
||||
yarn install
|
||||
yarn build
|
||||
yarn storybook
|
||||
npm ci
|
||||
npm run build
|
||||
npm run storybook
|
||||
```
|
||||
|
||||
The Storybook will
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"lerna": "3.2.1",
|
||||
"npmClient": "yarn",
|
||||
"npmClient": "npm",
|
||||
"packages": [
|
||||
"packages/*",
|
||||
"plugins/*"
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -6,37 +6,37 @@
|
|||
"scripts": {
|
||||
"build": "node ./scripts/build.js",
|
||||
"build:assets": "node ./scripts/copyAssets.js",
|
||||
"babel": "yarn build --no-type",
|
||||
"demo": "cd packages/superset-ui-demo && yarn demo:build",
|
||||
"demo:clean": "cd packages/superset-ui-demo && yarn demo:clean",
|
||||
"demo:build": "cd packages/superset-ui-demo && yarn demo:build",
|
||||
"storybook": "cd packages/superset-ui-demo && yarn storybook",
|
||||
"build-storybook": "cd packages/superset-ui-demo && yarn build-storybook",
|
||||
"chromatic": "cd packages/superset-ui-demo && yarn chromatic",
|
||||
"sb": "yarn storybook",
|
||||
"clean": "yarn build --clean --no-babel --no-type",
|
||||
"babel": "npm run build --no-type",
|
||||
"demo": "cd packages/superset-ui-demo && npm run demo:build",
|
||||
"demo:clean": "cd packages/superset-ui-demo && npm run demo:clean",
|
||||
"demo:build": "cd packages/superset-ui-demo && npm run demo:build",
|
||||
"storybook": "cd packages/superset-ui-demo && npm run storybook",
|
||||
"build-storybook": "cd packages/superset-ui-demo && npm run build-storybook",
|
||||
"chromatic": "cd packages/superset-ui-demo && npm run chromatic",
|
||||
"sb": "npm run storybook",
|
||||
"clean": "npm run build --clean --no-babel --no-type",
|
||||
"commit": "superset-commit",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 10",
|
||||
"jest": "NODE_ENV=test jest --coverage --verbose",
|
||||
"lint": "esprint check",
|
||||
"lint:fix": "yarn lint --fix",
|
||||
"format": "yarn prettier",
|
||||
"lint:fix": "npm run lint --fix",
|
||||
"format": "npm run prettier",
|
||||
"prettier": "prettier --write .",
|
||||
"test": "yarn jest",
|
||||
"test:watch": "yarn lint:fix && yarn jest --watch",
|
||||
"type": "yarn build --no-babel",
|
||||
"prepare-release": "git checkout master && git pull --rebase origin master && yarn install && yarn test",
|
||||
"prerelease": "yarn build",
|
||||
"release": "yarn prepare-release && lerna publish && yarn postrelease",
|
||||
"test": "npm run jest",
|
||||
"test:watch": "npm run lint:fix && npm run jest --watch",
|
||||
"type": "npm run build --no-babel",
|
||||
"prepare-release": "git checkout master && git pull --rebase origin master && npm run install && npm run test",
|
||||
"prerelease": "npm run build",
|
||||
"release": "npm run prepare-release && lerna publish && npm run postrelease",
|
||||
"postrelease": "lerna run deploy-demo",
|
||||
"list-changed-packages": "lerna changed",
|
||||
"manual-release": "lerna publish --force-publish && yarn postrelease",
|
||||
"manual-release": "lerna publish --force-publish && npm run postrelease",
|
||||
"clean-npm-lock": "rm -rf package-lock.json ./{packages,plugins}/*/package-lock.json",
|
||||
"ci:create-patch-version": "yarn clean-npm-lock && lerna version patch --yes",
|
||||
"ci:create-minor-version": "yarn clean-npm-lock && lerna version minor --yes",
|
||||
"ci:create-conventional-version": "yarn clean-npm-lock && lerna version --conventional-commits --create-release github --yes",
|
||||
"ci:release-from-tag": "yarn clean-npm-lock && lerna publish from-package --yes",
|
||||
"ci:release-conventional": "yarn clean-npm-lock && lerna publish --conventional-commits --create-release github --yes"
|
||||
"ci:create-patch-version": "npm run clean-npm-lock && lerna version patch --yes",
|
||||
"ci:create-minor-version": "npm run clean-npm-lock && lerna version minor --yes",
|
||||
"ci:create-conventional-version": "npm run clean-npm-lock && lerna version --conventional-commits --create-release github --yes",
|
||||
"ci:release-from-tag": "npm run clean-npm-lock && lerna publish from-package --yes",
|
||||
"ci:release-conventional": "npm run clean-npm-lock && lerna publish --conventional-commits --create-release github --yes"
|
||||
},
|
||||
"repository": "https://github.com/apache-superset/superset-ui.git",
|
||||
"keywords": [
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
"@types/enzyme": "^3.10.3",
|
||||
"@types/jest": "^26.0.4",
|
||||
"@types/jsdom": "^12.2.4",
|
||||
"@types/react": "^16.14.2",
|
||||
"@types/react": "^16.13.1",
|
||||
"@types/react-test-renderer": "^16.9.2",
|
||||
"@typescript-eslint/eslint-plugin": "^4.1.0",
|
||||
"@typescript-eslint/parser": "^4.1.0",
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.1",
|
||||
"enzyme-to-json": "^3.4.3",
|
||||
"eslint": "^7.17.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-airbnb": "^18.2.1",
|
||||
"eslint-config-prettier": "^7.1.0",
|
||||
"eslint-import-resolver-typescript": "^2.3.0",
|
||||
|
|
@ -118,7 +118,7 @@
|
|||
"jsdom": "^16.4.0",
|
||||
"lerna": "^3.15.0",
|
||||
"lint-staged": "^10.0.3",
|
||||
"prettier": "^2.2.1",
|
||||
"prettier": "^2.4.1",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-loadable": "^5.5.0",
|
||||
|
|
@ -136,9 +136,8 @@
|
|||
"yargs": "^15.4.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14",
|
||||
"npm": "^7.5.4",
|
||||
"yarn": ">=1.13.0"
|
||||
"node": "14.x || 16.x",
|
||||
"npm": "^7.5.4"
|
||||
},
|
||||
"workspaces": [
|
||||
"./packages/*",
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
"@emotion/react": "^11.4.1",
|
||||
"@types/react": "*",
|
||||
"antd": "^4.9.4",
|
||||
"react": "^16.13.1"
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,9 +54,8 @@ export function ControlFormItem({
|
|||
const { gridUnit } = useTheme();
|
||||
const [hovered, setHovered] = useState(false);
|
||||
const [value, setValue] = useState(initialValue === undefined ? defaultValue : initialValue);
|
||||
const [validationErrors, setValidationErrors] = useState<
|
||||
ControlHeaderProps['validationErrors']
|
||||
>();
|
||||
const [validationErrors, setValidationErrors] =
|
||||
useState<ControlHeaderProps['validationErrors']>();
|
||||
|
||||
const handleChange = (e: ChangeEvent<HTMLInputElement> | JsonValue) => {
|
||||
const fieldValue =
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
import React, { useState, ReactNode } from 'react';
|
||||
import AntdSelect, { SelectProps as AntdSelectProps } from 'antd/lib/select';
|
||||
|
||||
export const { Option } = AntdSelect;
|
||||
export const { Option }: any = AntdSelect;
|
||||
|
||||
export type SelectOption<VT = string> = [VT, ReactNode];
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ import { SHARED_COLUMN_CONFIG_PROPS, SharedColumnConfigProp } from './constants'
|
|||
*/
|
||||
export type ColumnConfig = {
|
||||
[key in SharedColumnConfigProp]?: typeof SHARED_COLUMN_CONFIG_PROPS[key]['value'];
|
||||
} &
|
||||
Record<string, StrictJsonValue>;
|
||||
} & Record<string, StrictJsonValue>;
|
||||
|
||||
/**
|
||||
* All required info about a column to render the
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ export type TabOverride = 'data' | 'customize' | boolean;
|
|||
export interface BaseControlConfig<
|
||||
T extends ControlType = ControlType,
|
||||
O extends SelectOption = SelectOption,
|
||||
V = JsonValue
|
||||
V = JsonValue,
|
||||
> extends AnyDict {
|
||||
type: T;
|
||||
label?: ReactNode;
|
||||
|
|
@ -201,7 +201,7 @@ export interface BaseControlConfig<
|
|||
export interface ControlValueValidator<
|
||||
T = ControlType,
|
||||
O extends SelectOption = SelectOption,
|
||||
V = unknown
|
||||
V = unknown,
|
||||
> {
|
||||
(value: V, state?: ControlState<T, O>): boolean | string;
|
||||
}
|
||||
|
|
@ -229,7 +229,7 @@ interface FilterOption<T extends SelectOption> {
|
|||
// Ref: superset-frontend/src/components/Select/SupersetStyledSelect.tsx
|
||||
export interface SelectControlConfig<
|
||||
O extends SelectOption = SelectOption,
|
||||
T extends SelectControlType = SelectControlType
|
||||
T extends SelectControlType = SelectControlType,
|
||||
> extends BaseControlConfig<T, O> {
|
||||
clearable?: boolean;
|
||||
freeForm?: boolean;
|
||||
|
|
@ -244,7 +244,7 @@ export interface SelectControlConfig<
|
|||
|
||||
export type SharedControlConfig<
|
||||
T extends InternalControlType = InternalControlType,
|
||||
O extends SelectOption = SelectOption
|
||||
O extends SelectOption = SelectOption,
|
||||
> = T extends SelectControlType ? SelectControlConfig<O, T> : BaseControlConfig<T>;
|
||||
|
||||
/** --------------------------------------------
|
||||
|
|
@ -260,7 +260,7 @@ export type CustomControlConfig<P = {}> = BaseControlConfig<React.ComponentType<
|
|||
// - otherwise assume it's a custom component control
|
||||
export type ControlConfig<
|
||||
T = AnyDict,
|
||||
O extends SelectOption = SelectOption
|
||||
O extends SelectOption = SelectOption,
|
||||
> = T extends InternalControlType
|
||||
? SharedControlConfig<T, O>
|
||||
: T extends object
|
||||
|
|
|
|||
|
|
@ -66,15 +66,8 @@ class WithLegend extends PureComponent<Props, {}> {
|
|||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
className,
|
||||
debounceTime,
|
||||
width,
|
||||
height,
|
||||
position,
|
||||
renderChart,
|
||||
renderLegend,
|
||||
} = this.props;
|
||||
const { className, debounceTime, width, height, position, renderChart, renderLegend } =
|
||||
this.props;
|
||||
|
||||
const isHorizontal = position === 'left' || position === 'right';
|
||||
|
||||
|
|
|
|||
|
|
@ -6,19 +6,17 @@ const TITLE_STYLES: CSSProperties = { fontSize: 16, fontWeight: 'bold', paddingB
|
|||
const BODY_STYLES: CSSProperties = { fontSize: 14 };
|
||||
const MIN_WIDTH_FOR_BODY = 250;
|
||||
|
||||
const generateContainerStyles: (
|
||||
height: number | string,
|
||||
width: number | string,
|
||||
) => CSSProperties = (height: number | string, width: number | string) => ({
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
height,
|
||||
justifyContent: 'center',
|
||||
padding: 16,
|
||||
textAlign: 'center',
|
||||
width,
|
||||
});
|
||||
const generateContainerStyles: (height: number | string, width: number | string) => CSSProperties =
|
||||
(height: number | string, width: number | string) => ({
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
height,
|
||||
justifyContent: 'center',
|
||||
padding: 16,
|
||||
textAlign: 'center',
|
||||
width,
|
||||
});
|
||||
|
||||
type Props = {
|
||||
className?: string;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ type ValueOrModuleWithValue<T> = T | { default: T };
|
|||
|
||||
interface ChartPluginConfig<
|
||||
FormData extends QueryFormData = QueryFormData,
|
||||
Props extends ChartProps = ChartProps
|
||||
Props extends ChartProps = ChartProps,
|
||||
> {
|
||||
metadata: ChartMetadata;
|
||||
/** Use buildQuery for immediate value. For lazy-loading, use loadBuildQuery. */
|
||||
|
|
@ -60,7 +60,7 @@ function sanitizeLoader<T>(
|
|||
|
||||
export default class ChartPlugin<
|
||||
FormData extends QueryFormData = QueryFormData,
|
||||
Props extends ChartProps = ChartProps
|
||||
Props extends ChartProps = ChartProps,
|
||||
> extends Plugin {
|
||||
controlPanel: ChartControlPanel;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ interface RegistryWithDefaultKeyConfig extends RegistryConfig {
|
|||
|
||||
export default class RegistryWithDefaultKey<
|
||||
V,
|
||||
W extends V | Promise<V> = V | Promise<V>
|
||||
W extends V | Promise<V> = V | Promise<V>,
|
||||
> extends Registry<V, W> {
|
||||
initialDefaultKey?: string;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ function isPayloadless(method?: Method) {
|
|||
export default function makeApi<
|
||||
Payload = SupersetPayload,
|
||||
Result = JsonObject,
|
||||
T extends ParseMethod = ParseMethod
|
||||
T extends ParseMethod = ParseMethod,
|
||||
>({
|
||||
endpoint,
|
||||
method,
|
||||
|
|
|
|||
|
|
@ -32,8 +32,12 @@ export default function buildQueryContext(
|
|||
}
|
||||
| BuildFinalQueryObjects,
|
||||
): QueryContext {
|
||||
const { queryFields, buildQuery = WRAP_IN_ARRAY, hooks = {}, ownState = {} } =
|
||||
typeof options === 'function' ? { buildQuery: options, queryFields: {} } : options || {};
|
||||
const {
|
||||
queryFields,
|
||||
buildQuery = WRAP_IN_ARRAY,
|
||||
hooks = {},
|
||||
ownState = {},
|
||||
} = typeof options === 'function' ? { buildQuery: options, queryFields: {} } : options || {};
|
||||
return {
|
||||
datasource: new DatasourceKey(formData.datasource).toObject(),
|
||||
force: formData.force || false,
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ describe('buildQueryObject', () => {
|
|||
datasource: '5__table',
|
||||
granularity_sqla: 'ds',
|
||||
viz_type: 'table',
|
||||
url_params: (null as unknown) as undefined,
|
||||
url_params: null as unknown as undefined,
|
||||
}).url_params,
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ const packages = readdirSync(basePath).filter(name => {
|
|||
return stat.isSymbolicLink();
|
||||
});
|
||||
|
||||
// find @superset-ui/core source
|
||||
const corePath = path.resolve(__dirname, '../../../packages/superset-ui-core');
|
||||
const rootPath = path.resolve(__dirname, '../../../');
|
||||
|
||||
const PLUGIN_PACKAGES_PATH_REGEXP = new RegExp(
|
||||
`${path.resolve(__dirname, '../../../plugins/(legacy-)*(plugin|preset)-')}.+/src`,
|
||||
|
|
@ -64,9 +63,13 @@ module.exports = {
|
|||
|
||||
// todo: remove hard code after move storybook to superset repo.
|
||||
config.resolve.alias['@emotion/styled'] = path.resolve(
|
||||
corePath,
|
||||
rootPath,
|
||||
'./node_modules/@emotion/styled',
|
||||
);
|
||||
config.resolve.alias['@emotion/core'] = path.resolve(
|
||||
rootPath,
|
||||
'./node_modules/@emotion/core',
|
||||
);
|
||||
|
||||
config.devtool = 'eval-cheap-module-source-map';
|
||||
config.devServer = {
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ Storybook of `@superset-ui` packages. See it live at
|
|||
|
||||
#### Run storybook
|
||||
|
||||
To view the storybook locally, you should first run `yarn install && yarn run bootstrap` in the
|
||||
To view the storybook locally, you should first run `npm ci && npm run bootstrap` in the
|
||||
`@superset-ui` monorepo root directory, which will install all dependencies for this package and
|
||||
sym-link any `@superset-ui` packages to your local system.
|
||||
|
||||
After that run `yarn run storybook` which will open up a dev server at http://localhost:9001.
|
||||
After that run `npm run storybook` which will open up a dev server at http://localhost:9001.
|
||||
|
||||
#### Adding new stories
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ exported for that package in the `storybook/stories/<package>/index.js` file.
|
|||
If you are creating stories for a package that doesn't yet have any stories, follow these steps:
|
||||
|
||||
1. Add any new package dependencies (including any `@superset-ui/*` packages) via
|
||||
`yarn add <package>`.
|
||||
`npm install <package>`.
|
||||
|
||||
2. Create a new folder that mirrors the package name
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
"@emotion/styled": "^11.3.0",
|
||||
"@react-icons/all-files": "^4.1.0",
|
||||
"@storybook/addon-actions": "^6.3.12",
|
||||
"@storybook/addon-info": "^5.3.21",
|
||||
"@storybook/addon-knobs": "^6.3.1",
|
||||
"@storybook/addon-links": "^6.3.12",
|
||||
"@storybook/addons": "^6.3.12",
|
||||
|
|
@ -61,7 +60,6 @@
|
|||
"@superset-ui/legacy-plugin-chart-sunburst": "0.18.14",
|
||||
"@superset-ui/legacy-plugin-chart-time-table": "0.18.14",
|
||||
"@superset-ui/legacy-plugin-chart-treemap": "0.18.14",
|
||||
"@superset-ui/legacy-plugin-chart-word-cloud": "^0.11.15",
|
||||
"@superset-ui/legacy-plugin-chart-world-map": "0.18.14",
|
||||
"@superset-ui/legacy-preset-chart-big-number": "0.18.14",
|
||||
"@superset-ui/plugin-chart-echarts": "0.18.14",
|
||||
|
|
@ -77,6 +75,7 @@
|
|||
"jquery": "^3.4.1",
|
||||
"memoize-one": "^5.1.1",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-loadable": "^5.5.0",
|
||||
"react-resizable": "^1.10.1",
|
||||
"storybook-addon-jsx": "^7.3.14"
|
||||
|
|
@ -88,5 +87,8 @@
|
|||
"fork-ts-checker-webpack-plugin": "^5.0.7",
|
||||
"ts-loader": "^7.0.4",
|
||||
"typescript": "^3.8.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@encodable/color": "=1.1.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,60 +3,10 @@ export default [
|
|||
{
|
||||
key: 'Entrance exam',
|
||||
values: [
|
||||
0.87,
|
||||
0.944,
|
||||
1.0,
|
||||
0.879,
|
||||
0.69,
|
||||
0.667,
|
||||
0.794,
|
||||
0.838,
|
||||
0.875,
|
||||
0.385,
|
||||
0.968,
|
||||
0.804,
|
||||
1.0,
|
||||
0.943,
|
||||
0.96,
|
||||
0.333,
|
||||
0.5,
|
||||
0.929,
|
||||
0.863,
|
||||
0.75,
|
||||
0.957,
|
||||
0.914,
|
||||
1.0,
|
||||
0.909,
|
||||
0.742,
|
||||
0.964,
|
||||
0.25,
|
||||
0.75,
|
||||
0.5,
|
||||
0.867,
|
||||
0.909,
|
||||
0.333,
|
||||
0.867,
|
||||
0.952,
|
||||
0.857,
|
||||
0.949,
|
||||
0.857,
|
||||
0.333,
|
||||
0.8,
|
||||
0.707,
|
||||
0.833,
|
||||
0.75,
|
||||
0.88,
|
||||
0.771,
|
||||
1.0,
|
||||
1.0,
|
||||
0.769,
|
||||
1.0,
|
||||
0.769,
|
||||
0.622,
|
||||
0.909,
|
||||
0.725,
|
||||
0.951,
|
||||
1.0,
|
||||
0.87, 0.944, 1.0, 0.879, 0.69, 0.667, 0.794, 0.838, 0.875, 0.385, 0.968, 0.804, 1.0, 0.943,
|
||||
0.96, 0.333, 0.5, 0.929, 0.863, 0.75, 0.957, 0.914, 1.0, 0.909, 0.742, 0.964, 0.25, 0.75, 0.5,
|
||||
0.867, 0.909, 0.333, 0.867, 0.952, 0.857, 0.949, 0.857, 0.333, 0.8, 0.707, 0.833, 0.75, 0.88,
|
||||
0.771, 1.0, 1.0, 0.769, 1.0, 0.769, 0.622, 0.909, 0.725, 0.951, 1.0,
|
||||
],
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -128,8 +128,7 @@ export const withNull = () => (
|
|||
['sum__num', 'other'],
|
||||
['sum__num', 'All'],
|
||||
],
|
||||
html:
|
||||
'<table border="1" class="dataframe dataframe table table-striped table-bordered table-condensed table-hover">\n <thead>\n <tr>\n <th></th>\n <th colspan="2" halign="left">sum__num</th>\n </tr>\n <tr>\n <th>state</th>\n <th>other</th>\n <th>All</th>\n </tr>\n <tr>\n <th>name</th>\n <th></th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Christopher</th>\n <td>null</td>\n <td>803607</td>\n </tr>\n <tr>\n <th>David</th>\n <td>null</td>\n <td>673992</td>\n </tr>\n <tr>\n <th>James</th>\n <td>749686</td>\n <td>null</td>\n </tr>\n <tr>\n <th>Jennifer</th>\n <td>587540</td>\n <td>null</td>\n </tr>\n <tr>\n <th>John</th>\n <td>638450</td>\n <td>638450</td>\n </tr>\n <tr>\n <th>Joshua</th>\n <td>null</td>\n <td>548044</td>\n </tr>\n <tr>\n <th>Matthew</th>\n <td>608212</td>\n <td>608212</td>\n </tr>\n <tr>\n <th>Michael</th>\n <td>1047996</td>\n <td>1047996</td>\n </tr>\n <tr>\n <th>Robert</th>\n <td>575592</td>\n <td>575592</td>\n </tr>\n <tr>\n <th>William</th>\n <td>574464</td>\n <td>574464</td>\n </tr>\n <tr>\n <th>All</th>\n <td>6807583</td>\n <td>6807583</td>\n </tr>\n </tbody>\n</table>',
|
||||
html: '<table border="1" class="dataframe dataframe table table-striped table-bordered table-condensed table-hover">\n <thead>\n <tr>\n <th></th>\n <th colspan="2" halign="left">sum__num</th>\n </tr>\n <tr>\n <th>state</th>\n <th>other</th>\n <th>All</th>\n </tr>\n <tr>\n <th>name</th>\n <th></th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>Christopher</th>\n <td>null</td>\n <td>803607</td>\n </tr>\n <tr>\n <th>David</th>\n <td>null</td>\n <td>673992</td>\n </tr>\n <tr>\n <th>James</th>\n <td>749686</td>\n <td>null</td>\n </tr>\n <tr>\n <th>Jennifer</th>\n <td>587540</td>\n <td>null</td>\n </tr>\n <tr>\n <th>John</th>\n <td>638450</td>\n <td>638450</td>\n </tr>\n <tr>\n <th>Joshua</th>\n <td>null</td>\n <td>548044</td>\n </tr>\n <tr>\n <th>Matthew</th>\n <td>608212</td>\n <td>608212</td>\n </tr>\n <tr>\n <th>Michael</th>\n <td>1047996</td>\n <td>1047996</td>\n </tr>\n <tr>\n <th>Robert</th>\n <td>575592</td>\n <td>575592</td>\n </tr>\n <tr>\n <th>William</th>\n <td>574464</td>\n <td>574464</td>\n </tr>\n <tr>\n <th>All</th>\n <td>6807583</td>\n <td>6807583</td>\n </tr>\n </tbody>\n</table>',
|
||||
},
|
||||
},
|
||||
]}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import { TableChartFormData, TableChartProps } from '@superset-ui/plugin-chart-t
|
|||
// eslint-disable-next-line import/extensions
|
||||
import birthNamesJson from './birthNames.json';
|
||||
|
||||
export const birthNames = (birthNamesJson as unknown) as TableChartProps;
|
||||
export const birthNames = birthNamesJson as unknown as TableChartProps;
|
||||
|
||||
export const basicFormData: TableChartFormData = {
|
||||
datasource: '1__table',
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ const metadata = new ChartMetadata({
|
|||
export default class CountryMapChartPlugin extends ChartPlugin {
|
||||
constructor() {
|
||||
super({
|
||||
loadChart: () => import('./ReactCountryMap.js'),
|
||||
loadChart: () => import('./ReactCountryMap'),
|
||||
metadata,
|
||||
transformProps,
|
||||
controlPanel,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ const metadata = new ChartMetadata({
|
|||
export default class HeatmapChartPlugin extends ChartPlugin {
|
||||
constructor() {
|
||||
super({
|
||||
loadChart: () => import('./ReactHeatmap.js'),
|
||||
loadChart: () => import('./ReactHeatmap'),
|
||||
metadata,
|
||||
transformProps,
|
||||
controlPanel,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export default class MapBoxChartPlugin extends ChartPlugin {
|
|||
constructor() {
|
||||
super({
|
||||
loadChart: () => import('./MapBox'),
|
||||
loadTransformProps: () => import('./transformProps.js'),
|
||||
loadTransformProps: () => import('./transformProps'),
|
||||
metadata,
|
||||
controlPanel,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -195,10 +195,12 @@ class TTestTable extends React.Component {
|
|||
</Th>,
|
||||
);
|
||||
const rows = data.map((entry, i) => {
|
||||
const values = groups.map((
|
||||
group,
|
||||
j, // group names
|
||||
) => <Td key={j} column={group} data={entry.group[j]} />);
|
||||
const values = groups.map(
|
||||
(
|
||||
group,
|
||||
j, // group names
|
||||
) => <Td key={j} column={group} data={entry.group[j]} />,
|
||||
);
|
||||
values.push(
|
||||
<Td
|
||||
key={numGroups + 1}
|
||||
|
|
|
|||
|
|
@ -18,14 +18,8 @@
|
|||
*/
|
||||
export default function transformProps(chartProps) {
|
||||
const { width, height, formData, queriesData } = chartProps;
|
||||
const {
|
||||
includeSeries,
|
||||
linearColorScheme,
|
||||
metrics,
|
||||
secondaryMetric,
|
||||
series,
|
||||
showDatatable,
|
||||
} = formData;
|
||||
const { includeSeries, linearColorScheme, metrics, secondaryMetric, series, showDatatable } =
|
||||
formData;
|
||||
|
||||
return {
|
||||
width,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ const metadata = new ChartMetadata({
|
|||
export default class PartitionChartPlugin extends ChartPlugin {
|
||||
constructor() {
|
||||
super({
|
||||
loadChart: () => import('./ReactPartition.js'),
|
||||
loadChart: () => import('./ReactPartition'),
|
||||
metadata,
|
||||
transformProps,
|
||||
controlPanel,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ import controlPanel from './controlPanel';
|
|||
|
||||
const metadata = new ChartMetadata({
|
||||
category: t('Table'),
|
||||
description: t(`Used to summarize a set of data by grouping together multiple statistics along two axes. Examples: Sales numbers by region and month, tasks by status and assignee, active users by age and location.
|
||||
description:
|
||||
t(`Used to summarize a set of data by grouping together multiple statistics along two axes. Examples: Sales numbers by region and month, tasks by status and assignee, active users by age and location.
|
||||
|
||||
This chart is being deprecated and we recommend checking out Pivot Table V2 instead!`),
|
||||
name: t('Pivot Table'),
|
||||
|
|
@ -35,7 +36,7 @@ const metadata = new ChartMetadata({
|
|||
export default class PivotTableChartPlugin extends ChartPlugin {
|
||||
constructor() {
|
||||
super({
|
||||
loadChart: () => import('./ReactPivotTable.js'),
|
||||
loadChart: () => import('./ReactPivotTable'),
|
||||
metadata,
|
||||
transformProps,
|
||||
controlPanel,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ const metadata = new ChartMetadata({
|
|||
export default class RoseChartPlugin extends ChartPlugin {
|
||||
constructor() {
|
||||
super({
|
||||
loadChart: () => import('./ReactRose.js'),
|
||||
loadChart: () => import('./ReactRose'),
|
||||
metadata,
|
||||
transformProps,
|
||||
controlPanel,
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ const metadata = new ChartMetadata({
|
|||
export default class SankeyChartPlugin extends ChartPlugin {
|
||||
constructor() {
|
||||
super({
|
||||
loadChart: () => import('./ReactSankeyLoop.js'),
|
||||
loadChart: () => import('./ReactSankeyLoop'),
|
||||
metadata,
|
||||
transformProps,
|
||||
controlPanel,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ const metadata = new ChartMetadata({
|
|||
export default class SunburstChartPlugin extends ChartPlugin {
|
||||
constructor() {
|
||||
super({
|
||||
loadChart: () => import('./ReactSunburst.js'),
|
||||
loadChart: () => import('./ReactSunburst'),
|
||||
metadata,
|
||||
transformProps,
|
||||
controlPanel,
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ const metadata = new ChartMetadata({
|
|||
export default class TreemapChartPlugin extends ChartPlugin {
|
||||
constructor() {
|
||||
super({
|
||||
loadChart: () => import('./ReactTreemap.js'),
|
||||
loadChart: () => import('./ReactTreemap'),
|
||||
metadata,
|
||||
transformProps,
|
||||
controlPanel,
|
||||
|
|
|
|||
|
|
@ -35,9 +35,10 @@ export default function EchartsMixedTimeseries({
|
|||
formData,
|
||||
seriesBreakdown,
|
||||
}: EchartsMixedTimeseriesChartTransformedProps) {
|
||||
const isFirstQuery = useCallback((seriesIndex: number) => seriesIndex < seriesBreakdown, [
|
||||
seriesBreakdown,
|
||||
]);
|
||||
const isFirstQuery = useCallback(
|
||||
(seriesIndex: number) => seriesIndex < seriesBreakdown,
|
||||
[seriesBreakdown],
|
||||
);
|
||||
|
||||
const handleChange = useCallback(
|
||||
(values: string[], seriesIndex: number) => {
|
||||
|
|
|
|||
|
|
@ -281,9 +281,8 @@ export default function transformProps(
|
|||
const prophetValue = !richTooltip ? [params] : params;
|
||||
|
||||
const rows: Array<string> = [`${tooltipTimeFormatter(value)}`];
|
||||
const prophetValues: Record<string, ProphetValue> = extractProphetValuesFromTooltipParams(
|
||||
prophetValue,
|
||||
);
|
||||
const prophetValues: Record<string, ProphetValue> =
|
||||
extractProphetValuesFromTooltipParams(prophetValue);
|
||||
|
||||
Object.keys(prophetValues).forEach(key => {
|
||||
const value = prophetValues[key];
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ export default class EchartsPieChartPlugin extends ChartPlugin<
|
|||
behaviors: [Behavior.INTERACTIVE_CHART],
|
||||
category: t('Part of a Whole'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
description: t(`The classic. Great for showing how much of a company each investor gets, what demographics follow your blog, or what portion of the budget goes to the military industrial complex.
|
||||
description:
|
||||
t(`The classic. Great for showing how much of a company each investor gets, what demographics follow your blog, or what portion of the budget goes to the military industrial complex.
|
||||
|
||||
Pie charts can be difficult to interpret precisely. If clarity of relative proportion is important, consider using a bar or other chart type instead.`),
|
||||
exampleGallery: [
|
||||
|
|
|
|||
|
|
@ -69,10 +69,8 @@ export default function transformProps(
|
|||
): TimeseriesChartTransformedProps {
|
||||
const { width, height, filterState, formData, hooks, queriesData, datasource } = chartProps;
|
||||
const { verboseMap = {} } = datasource;
|
||||
const {
|
||||
annotation_data: annotationData_,
|
||||
data = [],
|
||||
} = queriesData[0] as TimeseriesChartDataResponseResult;
|
||||
const { annotation_data: annotationData_, data = [] } =
|
||||
queriesData[0] as TimeseriesChartDataResponseResult;
|
||||
const annotationData = annotationData_ || {};
|
||||
|
||||
const {
|
||||
|
|
@ -273,9 +271,8 @@ export default function transformProps(
|
|||
const prophetValue = !richTooltip ? [params] : params;
|
||||
|
||||
const rows: Array<string> = [`${tooltipFormatter(value)}`];
|
||||
const prophetValues: Record<string, ProphetValue> = extractProphetValuesFromTooltipParams(
|
||||
prophetValue,
|
||||
);
|
||||
const prophetValues: Record<string, ProphetValue> =
|
||||
extractProphetValuesFromTooltipParams(prophetValue);
|
||||
|
||||
Object.keys(prophetValues).forEach(key => {
|
||||
const value = prophetValues[key];
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ export function transformEventAnnotation(
|
|||
const eventData: MarkLine1DDataItemOption[] = [
|
||||
{
|
||||
name: label,
|
||||
xAxis: (time as unknown) as number,
|
||||
xAxis: time as unknown as number,
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@
|
|||
},
|
||||
"peerDependencies": {
|
||||
"@ant-design/icons": "^4.2.2",
|
||||
"react": "^16.13.1"
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/types": "^7.13.12",
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import useMountedMemo from '../utils/useMountedMemo';
|
|||
|
||||
type ReactElementWithChildren<
|
||||
T extends keyof JSX.IntrinsicElements,
|
||||
C extends ReactNode = ReactNode
|
||||
C extends ReactNode = ReactNode,
|
||||
> = ReactElement<ComponentPropsWithRef<T> & { children: C }, T>;
|
||||
|
||||
type Th = ReactElementWithChildren<'th'>;
|
||||
|
|
|
|||
|
|
@ -243,9 +243,9 @@ export default function TableChart<D extends DataRecord = DataRecord>(
|
|||
function getValueRange(key: string, alignPositiveNegative: boolean) {
|
||||
if (typeof data?.[0]?.[key] === 'number') {
|
||||
const nums = data.map(row => row[key]) as number[];
|
||||
return (alignPositiveNegative
|
||||
? [0, d3Max(nums.map(Math.abs))]
|
||||
: d3Extent(nums)) as ValueRange;
|
||||
return (
|
||||
alignPositiveNegative ? [0, d3Max(nums.map(Math.abs))] : d3Extent(nums)
|
||||
) as ValueRange;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,9 +10,8 @@ export type LegendItemMarkRendererType<Config extends EncodingConfig> = React.Co
|
|||
LegendItemMarkRendererProps<Config>
|
||||
>;
|
||||
|
||||
export type LegendItemLabelRendererProps<
|
||||
Config extends EncodingConfig
|
||||
> = LegendItemMarkRendererProps<Config>;
|
||||
export type LegendItemLabelRendererProps<Config extends EncodingConfig> =
|
||||
LegendItemMarkRendererProps<Config>;
|
||||
|
||||
export type LegendItemLabelRendererType<Config extends EncodingConfig> = React.ComponentType<
|
||||
LegendItemLabelRendererProps<Config>
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ function getPackages(packagePattern, tsOnly = false) {
|
|||
let scope = getPackages(glob);
|
||||
|
||||
if (shouldLint) {
|
||||
run(`yarn lint --fix {packages,plugins}/${scope}/{src,test}`);
|
||||
run(`npm run lint --fix {packages,plugins}/${scope}/{src,test}`);
|
||||
}
|
||||
|
||||
if (shouldCleanup) {
|
||||
|
|
|
|||
|
|
@ -136,34 +136,32 @@ class TableVis extends React.PureComponent<InternalTableProps, TableState> {
|
|||
};
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps: React.GetDerivedStateFromProps<
|
||||
InternalTableProps,
|
||||
TableState
|
||||
> = (props: InternalTableProps, state: TableState) => {
|
||||
const { filters } = props;
|
||||
const { selectedCells, filters: prevFilters } = state;
|
||||
if (prevFilters !== filters) {
|
||||
const newSelectedCells = new Set(Array.from(selectedCells));
|
||||
Object.keys(filters).forEach(key => {
|
||||
filters[key].forEach(value => {
|
||||
newSelectedCells.add(
|
||||
getCellHash({
|
||||
key,
|
||||
value,
|
||||
}),
|
||||
);
|
||||
static getDerivedStateFromProps: React.GetDerivedStateFromProps<InternalTableProps, TableState> =
|
||||
(props: InternalTableProps, state: TableState) => {
|
||||
const { filters } = props;
|
||||
const { selectedCells, filters: prevFilters } = state;
|
||||
if (prevFilters !== filters) {
|
||||
const newSelectedCells = new Set(Array.from(selectedCells));
|
||||
Object.keys(filters).forEach(key => {
|
||||
filters[key].forEach(value => {
|
||||
newSelectedCells.add(
|
||||
getCellHash({
|
||||
key,
|
||||
value,
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
...state,
|
||||
filters,
|
||||
selectedCells: newSelectedCells,
|
||||
};
|
||||
}
|
||||
return {
|
||||
...state,
|
||||
filters,
|
||||
selectedCells: newSelectedCells,
|
||||
};
|
||||
}
|
||||
|
||||
return state;
|
||||
};
|
||||
return state;
|
||||
};
|
||||
|
||||
handleCellSelected = (cell: Cell) => () => {
|
||||
const { selectedCells } = this.state;
|
||||
|
|
|
|||
|
|
@ -206,15 +206,8 @@ class ChoroplethMap extends React.PureComponent<
|
|||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
height,
|
||||
width,
|
||||
encoding,
|
||||
tooltipOpen,
|
||||
tooltipLeft,
|
||||
tooltipTop,
|
||||
tooltipData,
|
||||
} = this.props;
|
||||
const { height, width, encoding, tooltipOpen, tooltipLeft, tooltipTop, tooltipData } =
|
||||
this.props;
|
||||
const { showMiniMap } = this.state;
|
||||
const encoder = this.createEncoder(encoding);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ Storybook of `@superset-ui-plugins` packages. See it live at
|
|||
To view the storybook locally, you should:
|
||||
|
||||
1. Clone [superset-ui-plugins](https://github.com/apache-superset/superset-ui-plugins) repo.
|
||||
2. Run `yarn install && yarn build` in the `superset-ui-plugins` root directory.
|
||||
2. Run `npm ci && npm build` in the `superset-ui-plugins` root directory.
|
||||
3. Change to the demo directory `cd packages/superset-ui-plugins-demo`.
|
||||
4. Run `yarn run storybook`. This will open up a dev server at http://localhost:9001.
|
||||
4. Run `npm run storybook`. This will open up a dev server at http://localhost:9001.
|
||||
|
||||
#### Adding new stories
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ exported for that package in the `storybook/stories/<package>/index.js` file.
|
|||
|
||||
If you are creating stories for a package that doesn't yet have any stories, follow these steps:
|
||||
|
||||
1. Add any new package dependencies via `yarn add <package>`, but if it is `@superset-ui/*`
|
||||
1. Add any new package dependencies via `npm install <package>`, but if it is `@superset-ui/*`
|
||||
packages, manually add it to `peerDependencies`.
|
||||
|
||||
2. Create a new folder that mirrors the package name
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
"demo:publish": "gh-pages -d _gh-pages",
|
||||
"deploy-demo": "npm run demo:clean && npm run demo:build && npm run demo:publish && npm run demo:clean",
|
||||
"storybook:run": "start-storybook -p 9001",
|
||||
"storybook": "cd ../../ && yarn build && cd ./packages/superset-ui-plugins-demo && yarn storybook:run"
|
||||
"storybook": "cd ../../ && npm run build && cd ./packages/superset-ui-plugins-demo && npm run storybook:run"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue