Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
feat(control-utils): add packages control-utils (#417)
Browse files Browse the repository at this point in the history
* feat(control-utils): add package

* fix: remove export

* fix: export

* fix: dep version
  • Loading branch information
kristw authored Apr 29, 2020
1 parent 322d632 commit 2f83074
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 11 deletions.
2 changes: 0 additions & 2 deletions packages/superset-ui-chart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
"@superset-ui/core": "^0.12.0",
"@superset-ui/dimension": "^0.12.0",
"@superset-ui/query": "^0.12.0",
"@superset-ui/translation": "0.x",
"@superset-ui/validator": "0.x",
"react": "^16.13.1"
}
}
5 changes: 0 additions & 5 deletions packages/superset-ui-chart/src/controls/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/superset-ui-chart/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@ export { default as getChartTransformPropsRegistry } from './registries/ChartTra

export { default as ChartDataProvider } from './components/ChartDataProvider';

export * from './controls/index';

export * from './types/TransformFunction';
export * from './types/QueryResponse';
23 changes: 23 additions & 0 deletions packages/superset-ui-control-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## @superset-ui/control-utils

[![Version](https://img.shields.io/npm/v/@superset-ui/control-utils.svg?style=flat)](https://img.shields.io/npm/v/@superset-ui/control-utils.svg?style=flat)
[![David (path)](https://img.shields.io/david/apache-superset/superset-ui.svg?path=packages%2Fsuperset-ui-control-utils&style=flat-square)](https://david-dm.org/apache-superset/superset-ui?path=packages/superset-ui-control-utils)

Description

#### Example usage

```js
import { xxx } from '@superset-ui/control-utils';
```

#### API

`fn(args)`

- Do something

### Development

`@data-ui/build-config` is used to manage the build configuration for this package including babel
builds, jest testing, eslint, and prettier.
30 changes: 30 additions & 0 deletions packages/superset-ui-control-utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@superset-ui/control-utils",
"version": "0.0.0",
"description": "Superset UI control-utils",
"sideEffects": false,
"main": "lib/index.js",
"module": "esm/index.js",
"files": [
"esm",
"lib"
],
"repository": {
"type": "git",
"url": "git+https://github.com/apache-superset/superset-ui.git"
},
"keywords": ["superset"],
"author": "Superset",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/apache-superset/superset-ui/issues"
},
"homepage": "https://github.com/apache-superset/superset-ui#readme",
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"@superset-ui/translation": "^0.12",
"@superset-ui/validator": "^0.12"
}
}
5 changes: 5 additions & 0 deletions packages/superset-ui-control-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as sectionModules from './sections';

export const sections = sectionModules;
export { D3_FORMAT_DOCS, D3_FORMAT_OPTIONS, D3_TIME_FORMAT_OPTIONS } from './D3Formatting';
export { formatSelectOptions, formatSelectOptionsForRange } from './selectOptions';
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function formatSelectOptions(options: Formattable[]): Formatted[] {
*/
export function formatSelectOptionsForRange(start: number, end: number) {
const options: Formatted[] = [];
for (let i = start; i <= end; i++) {
for (let i = start; i <= end; i += 1) {
options.push([i, i.toString()]);
}
return options;
Expand Down
8 changes: 8 additions & 0 deletions packages/superset-ui-control-utils/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { sections } from '../src';

describe('@superset-ui/control-utils', () => {
it('exports sections', () => {
expect(sections).toBeDefined();
expect(sections.datasourceAndVizType).toBeDefined();
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatSelectOptions, formatSelectOptionsForRange } from '../../src';
import { formatSelectOptions, formatSelectOptionsForRange } from '../src';

describe('formatSelectOptions', () => {
it('formats an array of options', () => {
Expand Down

1 comment on commit 2f83074

@vercel
Copy link

@vercel vercel bot commented on 2f83074 Apr 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.