baseui 0.0.0-next-4e68b3e → 0.0.0-next-115360c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data-table/data-table.js +9 -1
- package/data-table/data-table.js.flow +3 -0
- package/data-table/index.d.ts +7 -8
- package/data-table/stateful-data-table.js +2 -1
- package/data-table/stateful-data-table.js.flow +1 -0
- package/data-table/types.js.flow +8 -0
- package/es/data-table/data-table.js +5 -1
- package/es/data-table/stateful-data-table.js +2 -1
- package/esm/data-table/data-table.js +9 -1
- package/esm/data-table/stateful-data-table.js +2 -1
- package/form-control/index.d.ts +9 -0
- package/package.json +2 -1
package/data-table/data-table.js
CHANGED
|
@@ -555,7 +555,8 @@ function DataTable(_ref2) {
|
|
|
555
555
|
sortIndex = _ref2.sortIndex,
|
|
556
556
|
sortDirection = _ref2.sortDirection,
|
|
557
557
|
_ref2$textQuery = _ref2.textQuery,
|
|
558
|
-
textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery
|
|
558
|
+
textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery,
|
|
559
|
+
controlRef = _ref2.controlRef;
|
|
559
560
|
|
|
560
561
|
var _useStyletron13 = (0, _index2.useStyletron)(),
|
|
561
562
|
_useStyletron14 = _slicedToArray(_useStyletron13, 2),
|
|
@@ -754,6 +755,13 @@ function DataTable(_ref2) {
|
|
|
754
755
|
|
|
755
756
|
return result;
|
|
756
757
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
758
|
+
React.useImperativeHandle(controlRef, function () {
|
|
759
|
+
return {
|
|
760
|
+
getRows: function getRows() {
|
|
761
|
+
return rows;
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
}, [rows]);
|
|
757
765
|
|
|
758
766
|
var _React$useState19 = React.useState(0),
|
|
759
767
|
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
|
@@ -658,6 +658,7 @@ export function DataTable({
|
|
|
658
658
|
sortIndex,
|
|
659
659
|
sortDirection,
|
|
660
660
|
textQuery = '',
|
|
661
|
+
controlRef,
|
|
661
662
|
}: DataTablePropsT) {
|
|
662
663
|
const [, theme] = useStyletron();
|
|
663
664
|
const locale = React.useContext(LocaleContext);
|
|
@@ -809,6 +810,8 @@ export function DataTable({
|
|
|
809
810
|
return result;
|
|
810
811
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
811
812
|
|
|
813
|
+
React.useImperativeHandle(controlRef, () => ({ getRows: () => rows }), [rows]);
|
|
814
|
+
|
|
812
815
|
const [browserScrollbarWidth, setBrowserScrollbarWidth] = React.useState(0);
|
|
813
816
|
const normalizedWidths = React.useMemo(() => {
|
|
814
817
|
const resizedWidths = measuredWidths.map((w, i) => Math.floor(w) + Math.floor(resizeDeltas[i]));
|
package/data-table/index.d.ts
CHANGED
|
@@ -34,10 +34,7 @@ export interface SORT_DIRECTIONS {
|
|
|
34
34
|
}
|
|
35
35
|
export const SORT_DIRECTIONS: SORT_DIRECTIONS;
|
|
36
36
|
|
|
37
|
-
export type SortDirectionsT =
|
|
38
|
-
| SORT_DIRECTIONS['ASC']
|
|
39
|
-
| SORT_DIRECTIONS['DESC']
|
|
40
|
-
| null;
|
|
37
|
+
export type SortDirectionsT = SORT_DIRECTIONS['ASC'] | SORT_DIRECTIONS['DESC'] | null;
|
|
41
38
|
export type ColumnT = any;
|
|
42
39
|
export type RowT = {
|
|
43
40
|
id: number | string;
|
|
@@ -54,12 +51,13 @@ export type BatchActionT = {
|
|
|
54
51
|
renderIcon?: any;
|
|
55
52
|
};
|
|
56
53
|
|
|
54
|
+
export interface ImperativeMethods {
|
|
55
|
+
getRows: () => RowT[];
|
|
56
|
+
}
|
|
57
|
+
|
|
57
58
|
export type RowActionT = {
|
|
58
59
|
label: string;
|
|
59
|
-
onClick: (params: {
|
|
60
|
-
event: React.MouseEvent<HTMLButtonElement>;
|
|
61
|
-
row: RowT;
|
|
62
|
-
}) => any;
|
|
60
|
+
onClick: (params: { event: React.MouseEvent<HTMLButtonElement>; row: RowT }) => any;
|
|
63
61
|
renderIcon: any;
|
|
64
62
|
};
|
|
65
63
|
|
|
@@ -69,4 +67,5 @@ export type Props = {
|
|
|
69
67
|
columns: ColumnT[];
|
|
70
68
|
onSelectionChange?: (rows: RowT[]) => any;
|
|
71
69
|
rows: RowT[];
|
|
70
|
+
controlRef?: React.Ref<ImperativeMethods>;
|
|
72
71
|
};
|
package/data-table/types.js.flow
CHANGED
|
@@ -87,6 +87,13 @@ export type RowActionT = {|
|
|
|
87
87
|
renderButton?: React.AbstractComponent<{||}>,
|
|
88
88
|
|};
|
|
89
89
|
|
|
90
|
+
type ImperativeMethodsT = {|
|
|
91
|
+
getRows: () => RowT[],
|
|
92
|
+
|};
|
|
93
|
+
export type ControlRefT = {
|
|
94
|
+
current: ImperativeMethodsT | null,
|
|
95
|
+
};
|
|
96
|
+
|
|
90
97
|
export type StatefulDataTablePropsT = {|
|
|
91
98
|
batchActions?: BatchActionT[],
|
|
92
99
|
columns: ColumnT<>[],
|
|
@@ -109,6 +116,7 @@ export type StatefulDataTablePropsT = {|
|
|
|
109
116
|
rowHeight?: number,
|
|
110
117
|
rowHighlightIndex?: number,
|
|
111
118
|
searchable?: boolean,
|
|
119
|
+
controlRef?: ControlRefT,
|
|
112
120
|
|};
|
|
113
121
|
|
|
114
122
|
export type DataTablePropsT = {|
|
|
@@ -459,7 +459,8 @@ export function DataTable({
|
|
|
459
459
|
selectedRowIds,
|
|
460
460
|
sortIndex,
|
|
461
461
|
sortDirection,
|
|
462
|
-
textQuery = ''
|
|
462
|
+
textQuery = '',
|
|
463
|
+
controlRef
|
|
463
464
|
}) {
|
|
464
465
|
const [, theme] = useStyletron();
|
|
465
466
|
const locale = React.useContext(LocaleContext);
|
|
@@ -596,6 +597,9 @@ export function DataTable({
|
|
|
596
597
|
|
|
597
598
|
return result;
|
|
598
599
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
600
|
+
React.useImperativeHandle(controlRef, () => ({
|
|
601
|
+
getRows: () => rows
|
|
602
|
+
}), [rows]);
|
|
599
603
|
const [browserScrollbarWidth, setBrowserScrollbarWidth] = React.useState(0);
|
|
600
604
|
const normalizedWidths = React.useMemo(() => {
|
|
601
605
|
const resizedWidths = measuredWidths.map((w, i) => Math.floor(w) + Math.floor(resizeDeltas[i]));
|
|
@@ -536,7 +536,8 @@ export function DataTable(_ref2) {
|
|
|
536
536
|
sortIndex = _ref2.sortIndex,
|
|
537
537
|
sortDirection = _ref2.sortDirection,
|
|
538
538
|
_ref2$textQuery = _ref2.textQuery,
|
|
539
|
-
textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery
|
|
539
|
+
textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery,
|
|
540
|
+
controlRef = _ref2.controlRef;
|
|
540
541
|
|
|
541
542
|
var _useStyletron13 = useStyletron(),
|
|
542
543
|
_useStyletron14 = _slicedToArray(_useStyletron13, 2),
|
|
@@ -735,6 +736,13 @@ export function DataTable(_ref2) {
|
|
|
735
736
|
|
|
736
737
|
return result;
|
|
737
738
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
739
|
+
React.useImperativeHandle(controlRef, function () {
|
|
740
|
+
return {
|
|
741
|
+
getRows: function getRows() {
|
|
742
|
+
return rows;
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
}, [rows]);
|
|
738
746
|
|
|
739
747
|
var _React$useState19 = React.useState(0),
|
|
740
748
|
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
package/form-control/index.d.ts
CHANGED
|
@@ -32,3 +32,12 @@ export class FormControl extends React.Component<
|
|
|
32
32
|
FormControlProps,
|
|
33
33
|
FormControlState
|
|
34
34
|
> {}
|
|
35
|
+
|
|
36
|
+
export interface FormControlChildProps {
|
|
37
|
+
'aria-describedby': string | null,
|
|
38
|
+
'aria-errormessage': string | null,
|
|
39
|
+
key: React.Key,
|
|
40
|
+
disabled: boolean,
|
|
41
|
+
error: boolean,
|
|
42
|
+
positive: boolean
|
|
43
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baseui",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-115360c",
|
|
4
4
|
"description": "A React Component library implementing the Base design language",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"build:esm": "cross-env NODE_ENV=production BABEL_ENV=esm babel ./src --out-dir ./dist/esm --ignore **.test.js,**/__tests__/**,**/e2e.js,**/template-component/**,**/test/**",
|
|
30
30
|
"build:es": "cross-env NODE_ENV=production BABEL_ENV=es babel ./src --out-dir ./dist/es --ignore **.test.js,**/__tests__/**,**/e2e.js,**/template-component/**,**/test/**",
|
|
31
31
|
"build": "yarn build:cjs && yarn build:esm && yarn build:es && yarn build:copy-files && yarn build:copy-flow-files && yarn build:copy-ts-files && yarn build:package-json",
|
|
32
|
+
"build:docs-and-ladle": "yarn documentation:build && yarn ladle build --base-url /ladle/ && mv build public/ladle",
|
|
32
33
|
"build:documentation-site-files": "node ./scripts/build-documentation-site-files.js",
|
|
33
34
|
"unit-test": "yarn jest --coverage",
|
|
34
35
|
"e2e:build": "yarn ladle build --out build-ladle",
|