@react-stately/table 3.11.7-nightly.4555 → 3.11.7-nightly.4560
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/dist/Cell.main.js +38 -0
- package/dist/Cell.main.js.map +1 -0
- package/dist/Cell.mjs +33 -0
- package/dist/Cell.module.js +33 -0
- package/dist/Cell.module.js.map +1 -0
- package/dist/Column.main.js +75 -0
- package/dist/Column.main.js.map +1 -0
- package/dist/Column.mjs +66 -0
- package/dist/Column.module.js +66 -0
- package/dist/Column.module.js.map +1 -0
- package/dist/Row.main.js +97 -0
- package/dist/Row.main.js.map +1 -0
- package/dist/Row.mjs +88 -0
- package/dist/Row.module.js +88 -0
- package/dist/Row.module.js.map +1 -0
- package/dist/TableBody.main.js +61 -0
- package/dist/TableBody.main.js.map +1 -0
- package/dist/TableBody.mjs +52 -0
- package/dist/TableBody.module.js +52 -0
- package/dist/TableBody.module.js.map +1 -0
- package/dist/TableCollection.main.js +284 -0
- package/dist/TableCollection.main.js.map +1 -0
- package/dist/TableCollection.mjs +278 -0
- package/dist/TableCollection.module.js +278 -0
- package/dist/TableCollection.module.js.map +1 -0
- package/dist/TableColumnLayout.main.js +162 -0
- package/dist/TableColumnLayout.main.js.map +1 -0
- package/dist/TableColumnLayout.mjs +157 -0
- package/dist/TableColumnLayout.module.js +157 -0
- package/dist/TableColumnLayout.module.js.map +1 -0
- package/dist/TableHeader.main.js +56 -0
- package/dist/TableHeader.main.js.map +1 -0
- package/dist/TableHeader.mjs +47 -0
- package/dist/TableHeader.module.js +47 -0
- package/dist/TableHeader.module.js.map +1 -0
- package/dist/TableUtils.main.js +184 -0
- package/dist/TableUtils.main.js.map +1 -0
- package/dist/TableUtils.mjs +175 -0
- package/dist/TableUtils.module.js +175 -0
- package/dist/TableUtils.module.js.map +1 -0
- package/dist/import.mjs +11 -1216
- package/dist/main.js +21 -1230
- package/dist/main.js.map +1 -1
- package/dist/module.js +11 -1216
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/useTableColumnResizeState.main.js +113 -0
- package/dist/useTableColumnResizeState.main.js.map +1 -0
- package/dist/useTableColumnResizeState.mjs +108 -0
- package/dist/useTableColumnResizeState.module.js +108 -0
- package/dist/useTableColumnResizeState.module.js.map +1 -0
- package/dist/useTableState.main.js +71 -0
- package/dist/useTableState.main.js.map +1 -0
- package/dist/useTableState.mjs +66 -0
- package/dist/useTableState.module.js +66 -0
- package/dist/useTableState.module.js.map +1 -0
- package/dist/useTreeGridState.main.js +207 -0
- package/dist/useTreeGridState.main.js.map +1 -0
- package/dist/useTreeGridState.mjs +202 -0
- package/dist/useTreeGridState.module.js +202 -0
- package/dist/useTreeGridState.module.js.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
function $parcel$export(e, n, v, s) {
|
|
3
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
$parcel$export(module.exports, "Cell", () => $ad4ab0a21c733e1f$export$f6f0c3fe4ec306ea);
|
|
7
|
+
/*
|
|
8
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
9
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
+
* governing permissions and limitations under the License.
|
|
17
|
+
*/ function $ad4ab0a21c733e1f$var$Cell(props) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
$ad4ab0a21c733e1f$var$Cell.getCollectionNode = function* getCollectionNode(props) {
|
|
21
|
+
let { children: children } = props;
|
|
22
|
+
let textValue = props.textValue || (typeof children === "string" ? children : "") || props["aria-label"] || "";
|
|
23
|
+
yield {
|
|
24
|
+
type: "cell",
|
|
25
|
+
props: props,
|
|
26
|
+
rendered: children,
|
|
27
|
+
textValue: textValue,
|
|
28
|
+
"aria-label": props["aria-label"],
|
|
29
|
+
hasChildNodes: false
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* A Cell represents the value of a single Column within a Table Row.
|
|
34
|
+
*/ // We don't want getCollectionNode to show up in the type definition
|
|
35
|
+
let $ad4ab0a21c733e1f$export$f6f0c3fe4ec306ea = $ad4ab0a21c733e1f$var$Cell;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=Cell.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAMD,SAAS,2BAAK,KAAgB;IAC5B,OAAO;AACT;AAEA,2BAAK,iBAAiB,GAAG,UAAU,kBAAqB,KAAgB;IACtE,IAAI,YAAC,QAAQ,EAAC,GAAG;IAEjB,IAAI,YAAY,MAAM,SAAS,IAAK,CAAA,OAAO,aAAa,WAAW,WAAW,EAAC,KAAM,KAAK,CAAC,aAAa,IAAI;IAC5G,MAAM;QACJ,MAAM;QACN,OAAO;QACP,UAAU;mBACV;QACA,cAAc,KAAK,CAAC,aAAa;QACjC,eAAe;IACjB;AACF;AAEA;;CAEC,GACD,oEAAoE;AACpE,IAAI,4CAAQ","sources":["packages/@react-stately/table/src/Cell.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CellProps} from '@react-types/table';\nimport {JSX, ReactElement} from 'react';\nimport {PartialNode} from '@react-stately/collections';\n\nfunction Cell(props: CellProps): ReactElement { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nCell.getCollectionNode = function* getCollectionNode<T>(props: CellProps): Generator<PartialNode<T>> {\n let {children} = props;\n\n let textValue = props.textValue || (typeof children === 'string' ? children : '') || props['aria-label'] || '';\n yield {\n type: 'cell',\n props: props,\n rendered: children,\n textValue,\n 'aria-label': props['aria-label'],\n hasChildNodes: false\n };\n};\n\n/**\n * A Cell represents the value of a single Column within a Table Row.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _Cell = Cell as (props: CellProps) => JSX.Element;\nexport {_Cell as Cell};\n"],"names":[],"version":3,"file":"Cell.main.js.map"}
|
package/dist/Cell.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/ function $941d1d9a6a28982a$var$Cell(props) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
$941d1d9a6a28982a$var$Cell.getCollectionNode = function* getCollectionNode(props) {
|
|
15
|
+
let { children: children } = props;
|
|
16
|
+
let textValue = props.textValue || (typeof children === "string" ? children : "") || props["aria-label"] || "";
|
|
17
|
+
yield {
|
|
18
|
+
type: "cell",
|
|
19
|
+
props: props,
|
|
20
|
+
rendered: children,
|
|
21
|
+
textValue: textValue,
|
|
22
|
+
"aria-label": props["aria-label"],
|
|
23
|
+
hasChildNodes: false
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A Cell represents the value of a single Column within a Table Row.
|
|
28
|
+
*/ // We don't want getCollectionNode to show up in the type definition
|
|
29
|
+
let $941d1d9a6a28982a$export$f6f0c3fe4ec306ea = $941d1d9a6a28982a$var$Cell;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export {$941d1d9a6a28982a$export$f6f0c3fe4ec306ea as Cell};
|
|
33
|
+
//# sourceMappingURL=Cell.mjs.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/ function $941d1d9a6a28982a$var$Cell(props) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
$941d1d9a6a28982a$var$Cell.getCollectionNode = function* getCollectionNode(props) {
|
|
15
|
+
let { children: children } = props;
|
|
16
|
+
let textValue = props.textValue || (typeof children === "string" ? children : "") || props["aria-label"] || "";
|
|
17
|
+
yield {
|
|
18
|
+
type: "cell",
|
|
19
|
+
props: props,
|
|
20
|
+
rendered: children,
|
|
21
|
+
textValue: textValue,
|
|
22
|
+
"aria-label": props["aria-label"],
|
|
23
|
+
hasChildNodes: false
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A Cell represents the value of a single Column within a Table Row.
|
|
28
|
+
*/ // We don't want getCollectionNode to show up in the type definition
|
|
29
|
+
let $941d1d9a6a28982a$export$f6f0c3fe4ec306ea = $941d1d9a6a28982a$var$Cell;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export {$941d1d9a6a28982a$export$f6f0c3fe4ec306ea as Cell};
|
|
33
|
+
//# sourceMappingURL=Cell.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAMD,SAAS,2BAAK,KAAgB;IAC5B,OAAO;AACT;AAEA,2BAAK,iBAAiB,GAAG,UAAU,kBAAqB,KAAgB;IACtE,IAAI,YAAC,QAAQ,EAAC,GAAG;IAEjB,IAAI,YAAY,MAAM,SAAS,IAAK,CAAA,OAAO,aAAa,WAAW,WAAW,EAAC,KAAM,KAAK,CAAC,aAAa,IAAI;IAC5G,MAAM;QACJ,MAAM;QACN,OAAO;QACP,UAAU;mBACV;QACA,cAAc,KAAK,CAAC,aAAa;QACjC,eAAe;IACjB;AACF;AAEA;;CAEC,GACD,oEAAoE;AACpE,IAAI,4CAAQ","sources":["packages/@react-stately/table/src/Cell.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CellProps} from '@react-types/table';\nimport {JSX, ReactElement} from 'react';\nimport {PartialNode} from '@react-stately/collections';\n\nfunction Cell(props: CellProps): ReactElement { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nCell.getCollectionNode = function* getCollectionNode<T>(props: CellProps): Generator<PartialNode<T>> {\n let {children} = props;\n\n let textValue = props.textValue || (typeof children === 'string' ? children : '') || props['aria-label'] || '';\n yield {\n type: 'cell',\n props: props,\n rendered: children,\n textValue,\n 'aria-label': props['aria-label'],\n hasChildNodes: false\n };\n};\n\n/**\n * A Cell represents the value of a single Column within a Table Row.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _Cell = Cell as (props: CellProps) => JSX.Element;\nexport {_Cell as Cell};\n"],"names":[],"version":3,"file":"Cell.module.js.map"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var $kykIu$react = require("react");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function $parcel$interopDefault(a) {
|
|
5
|
+
return a && a.__esModule ? a.default : a;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function $parcel$export(e, n, v, s) {
|
|
9
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
$parcel$export(module.exports, "Column", () => $714483d9f6ca4c55$export$816b5d811295e6bc);
|
|
13
|
+
/*
|
|
14
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
15
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
16
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
17
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
*
|
|
19
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
20
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
21
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
22
|
+
* governing permissions and limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
function $714483d9f6ca4c55$var$Column(props) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
$714483d9f6ca4c55$var$Column.getCollectionNode = function* getCollectionNode(props, context) {
|
|
28
|
+
let { title: title, children: children, childColumns: childColumns } = props;
|
|
29
|
+
let rendered = title || children;
|
|
30
|
+
let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"];
|
|
31
|
+
let fullNodes = yield {
|
|
32
|
+
type: "column",
|
|
33
|
+
hasChildNodes: !!childColumns || title && (0, ($parcel$interopDefault($kykIu$react))).Children.count(children) > 0,
|
|
34
|
+
rendered: rendered,
|
|
35
|
+
textValue: textValue,
|
|
36
|
+
props: props,
|
|
37
|
+
*childNodes () {
|
|
38
|
+
if (childColumns) for (let child of childColumns)yield {
|
|
39
|
+
type: "column",
|
|
40
|
+
value: child
|
|
41
|
+
};
|
|
42
|
+
else if (title) {
|
|
43
|
+
let childColumns = [];
|
|
44
|
+
(0, ($parcel$interopDefault($kykIu$react))).Children.forEach(children, (child)=>{
|
|
45
|
+
childColumns.push({
|
|
46
|
+
type: "column",
|
|
47
|
+
element: child
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
yield* childColumns;
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
shouldInvalidate (newContext) {
|
|
54
|
+
// This is a bit of a hack, but it works.
|
|
55
|
+
// If this method is called, then there's a cached version of this node available.
|
|
56
|
+
// But, we need to keep the list of columns in the new context up to date.
|
|
57
|
+
updateContext(newContext);
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
let updateContext = (context)=>{
|
|
62
|
+
// register leaf columns on the context so that <Row> can access them
|
|
63
|
+
for (let node of fullNodes)if (!node.hasChildNodes) context.columns.push(node);
|
|
64
|
+
};
|
|
65
|
+
updateContext(context);
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* A Column represents a field of each item within a Table. Columns may also contain nested
|
|
69
|
+
* Column elements to represent column groups. Nested columns can be statically defined as
|
|
70
|
+
* children, or dynamically generated using a function based on the `childColumns` prop.
|
|
71
|
+
*/ // We don't want getCollectionNode to show up in the type definition
|
|
72
|
+
let $714483d9f6ca4c55$export$816b5d811295e6bc = $714483d9f6ca4c55$var$Column;
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=Column.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAQD,SAAS,6BAAU,KAAqB;IACtC,OAAO;AACT;AAEA,6BAAO,iBAAiB,GAAG,UAAU,kBAAqB,KAAqB,EAAE,OAAoC;IACnH,IAAI,SAAC,KAAK,YAAE,QAAQ,gBAAE,YAAY,EAAC,GAAG;IAEtC,IAAI,WAAW,SAAS;IACxB,IAAI,YAAY,MAAM,SAAS,IAAK,CAAA,OAAO,aAAa,WAAW,WAAW,EAAC,KAAM,KAAK,CAAC,aAAa;IAExG,IAAI,YAAY,MAAM;QACpB,MAAM;QACN,eAAe,CAAC,CAAC,gBAAiB,SAAS,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY;kBAC5E;mBACA;eACA;QACA,CAAC;YACC,IAAI,cACF,KAAK,IAAI,SAAS,aAChB,MAAM;gBACJ,MAAM;gBACN,OAAO;YACT;iBAEG,IAAI,OAAO;gBAChB,IAAI,eAAiC,EAAE;gBACvC,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAA;oBAC/B,aAAa,IAAI,CAAC;wBAChB,MAAM;wBACN,SAAS;oBACX;gBACF;gBAEA,OAAO;YACT;QACF;QACA,kBAAiB,UAAuC;YACtD,yCAAyC;YACzC,kFAAkF;YAClF,0EAA0E;YAC1E,cAAc;YACd,OAAO;QACT;IACF;IAEA,IAAI,gBAAgB,CAAC;QACnB,qEAAqE;QACrE,KAAK,IAAI,QAAQ,UACf,IAAI,CAAC,KAAK,aAAa,EACrB,QAAQ,OAAO,CAAC,IAAI,CAAC;IAG3B;IAEA,cAAc;AAChB;AAEA;;;;CAIC,GACD,oEAAoE;AACpE,IAAI,4CAAU","sources":["packages/@react-stately/table/src/Column.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CollectionBuilderContext} from './useTableState';\nimport {ColumnProps} from '@react-types/table';\nimport {GridNode} from '@react-types/grid';\nimport {PartialNode} from '@react-stately/collections';\nimport React, {JSX, ReactElement} from 'react';\n\nfunction Column<T>(props: ColumnProps<T>): ReactElement { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nColumn.getCollectionNode = function* getCollectionNode<T>(props: ColumnProps<T>, context: CollectionBuilderContext<T>): Generator<PartialNode<T>, void, GridNode<T>[]> {\n let {title, children, childColumns} = props;\n\n let rendered = title || children;\n let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label'];\n\n let fullNodes = yield {\n type: 'column',\n hasChildNodes: !!childColumns || (title && React.Children.count(children) > 0),\n rendered,\n textValue,\n props,\n *childNodes() {\n if (childColumns) {\n for (let child of childColumns) {\n yield {\n type: 'column',\n value: child\n };\n }\n } else if (title) {\n let childColumns: PartialNode<T>[] = [];\n React.Children.forEach(children, child => {\n childColumns.push({\n type: 'column',\n element: child as ReactElement<ColumnProps<T>>\n });\n });\n\n yield* childColumns;\n }\n },\n shouldInvalidate(newContext: CollectionBuilderContext<T>) {\n // This is a bit of a hack, but it works.\n // If this method is called, then there's a cached version of this node available.\n // But, we need to keep the list of columns in the new context up to date.\n updateContext(newContext);\n return false;\n }\n };\n\n let updateContext = (context: CollectionBuilderContext<T>) => {\n // register leaf columns on the context so that <Row> can access them\n for (let node of fullNodes) {\n if (!node.hasChildNodes) {\n context.columns.push(node);\n }\n }\n };\n\n updateContext(context);\n};\n\n/**\n * A Column represents a field of each item within a Table. Columns may also contain nested\n * Column elements to represent column groups. Nested columns can be statically defined as\n * children, or dynamically generated using a function based on the `childColumns` prop.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _Column = Column as <T>(props: ColumnProps<T>) => JSX.Element;\nexport {_Column as Column};\n"],"names":[],"version":3,"file":"Column.main.js.map"}
|
package/dist/Column.mjs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import $kIQ5E$react from "react";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
function $1cd244557c2f97d5$var$Column(props) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
$1cd244557c2f97d5$var$Column.getCollectionNode = function* getCollectionNode(props, context) {
|
|
18
|
+
let { title: title, children: children, childColumns: childColumns } = props;
|
|
19
|
+
let rendered = title || children;
|
|
20
|
+
let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"];
|
|
21
|
+
let fullNodes = yield {
|
|
22
|
+
type: "column",
|
|
23
|
+
hasChildNodes: !!childColumns || title && (0, $kIQ5E$react).Children.count(children) > 0,
|
|
24
|
+
rendered: rendered,
|
|
25
|
+
textValue: textValue,
|
|
26
|
+
props: props,
|
|
27
|
+
*childNodes () {
|
|
28
|
+
if (childColumns) for (let child of childColumns)yield {
|
|
29
|
+
type: "column",
|
|
30
|
+
value: child
|
|
31
|
+
};
|
|
32
|
+
else if (title) {
|
|
33
|
+
let childColumns = [];
|
|
34
|
+
(0, $kIQ5E$react).Children.forEach(children, (child)=>{
|
|
35
|
+
childColumns.push({
|
|
36
|
+
type: "column",
|
|
37
|
+
element: child
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
yield* childColumns;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
shouldInvalidate (newContext) {
|
|
44
|
+
// This is a bit of a hack, but it works.
|
|
45
|
+
// If this method is called, then there's a cached version of this node available.
|
|
46
|
+
// But, we need to keep the list of columns in the new context up to date.
|
|
47
|
+
updateContext(newContext);
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
let updateContext = (context)=>{
|
|
52
|
+
// register leaf columns on the context so that <Row> can access them
|
|
53
|
+
for (let node of fullNodes)if (!node.hasChildNodes) context.columns.push(node);
|
|
54
|
+
};
|
|
55
|
+
updateContext(context);
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* A Column represents a field of each item within a Table. Columns may also contain nested
|
|
59
|
+
* Column elements to represent column groups. Nested columns can be statically defined as
|
|
60
|
+
* children, or dynamically generated using a function based on the `childColumns` prop.
|
|
61
|
+
*/ // We don't want getCollectionNode to show up in the type definition
|
|
62
|
+
let $1cd244557c2f97d5$export$816b5d811295e6bc = $1cd244557c2f97d5$var$Column;
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export {$1cd244557c2f97d5$export$816b5d811295e6bc as Column};
|
|
66
|
+
//# sourceMappingURL=Column.mjs.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import $kIQ5E$react from "react";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
function $1cd244557c2f97d5$var$Column(props) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
$1cd244557c2f97d5$var$Column.getCollectionNode = function* getCollectionNode(props, context) {
|
|
18
|
+
let { title: title, children: children, childColumns: childColumns } = props;
|
|
19
|
+
let rendered = title || children;
|
|
20
|
+
let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"];
|
|
21
|
+
let fullNodes = yield {
|
|
22
|
+
type: "column",
|
|
23
|
+
hasChildNodes: !!childColumns || title && (0, $kIQ5E$react).Children.count(children) > 0,
|
|
24
|
+
rendered: rendered,
|
|
25
|
+
textValue: textValue,
|
|
26
|
+
props: props,
|
|
27
|
+
*childNodes () {
|
|
28
|
+
if (childColumns) for (let child of childColumns)yield {
|
|
29
|
+
type: "column",
|
|
30
|
+
value: child
|
|
31
|
+
};
|
|
32
|
+
else if (title) {
|
|
33
|
+
let childColumns = [];
|
|
34
|
+
(0, $kIQ5E$react).Children.forEach(children, (child)=>{
|
|
35
|
+
childColumns.push({
|
|
36
|
+
type: "column",
|
|
37
|
+
element: child
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
yield* childColumns;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
shouldInvalidate (newContext) {
|
|
44
|
+
// This is a bit of a hack, but it works.
|
|
45
|
+
// If this method is called, then there's a cached version of this node available.
|
|
46
|
+
// But, we need to keep the list of columns in the new context up to date.
|
|
47
|
+
updateContext(newContext);
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
let updateContext = (context)=>{
|
|
52
|
+
// register leaf columns on the context so that <Row> can access them
|
|
53
|
+
for (let node of fullNodes)if (!node.hasChildNodes) context.columns.push(node);
|
|
54
|
+
};
|
|
55
|
+
updateContext(context);
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* A Column represents a field of each item within a Table. Columns may also contain nested
|
|
59
|
+
* Column elements to represent column groups. Nested columns can be statically defined as
|
|
60
|
+
* children, or dynamically generated using a function based on the `childColumns` prop.
|
|
61
|
+
*/ // We don't want getCollectionNode to show up in the type definition
|
|
62
|
+
let $1cd244557c2f97d5$export$816b5d811295e6bc = $1cd244557c2f97d5$var$Column;
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export {$1cd244557c2f97d5$export$816b5d811295e6bc as Column};
|
|
66
|
+
//# sourceMappingURL=Column.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAQD,SAAS,6BAAU,KAAqB;IACtC,OAAO;AACT;AAEA,6BAAO,iBAAiB,GAAG,UAAU,kBAAqB,KAAqB,EAAE,OAAoC;IACnH,IAAI,SAAC,KAAK,YAAE,QAAQ,gBAAE,YAAY,EAAC,GAAG;IAEtC,IAAI,WAAW,SAAS;IACxB,IAAI,YAAY,MAAM,SAAS,IAAK,CAAA,OAAO,aAAa,WAAW,WAAW,EAAC,KAAM,KAAK,CAAC,aAAa;IAExG,IAAI,YAAY,MAAM;QACpB,MAAM;QACN,eAAe,CAAC,CAAC,gBAAiB,SAAS,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY;kBAC5E;mBACA;eACA;QACA,CAAC;YACC,IAAI,cACF,KAAK,IAAI,SAAS,aAChB,MAAM;gBACJ,MAAM;gBACN,OAAO;YACT;iBAEG,IAAI,OAAO;gBAChB,IAAI,eAAiC,EAAE;gBACvC,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAA;oBAC/B,aAAa,IAAI,CAAC;wBAChB,MAAM;wBACN,SAAS;oBACX;gBACF;gBAEA,OAAO;YACT;QACF;QACA,kBAAiB,UAAuC;YACtD,yCAAyC;YACzC,kFAAkF;YAClF,0EAA0E;YAC1E,cAAc;YACd,OAAO;QACT;IACF;IAEA,IAAI,gBAAgB,CAAC;QACnB,qEAAqE;QACrE,KAAK,IAAI,QAAQ,UACf,IAAI,CAAC,KAAK,aAAa,EACrB,QAAQ,OAAO,CAAC,IAAI,CAAC;IAG3B;IAEA,cAAc;AAChB;AAEA;;;;CAIC,GACD,oEAAoE;AACpE,IAAI,4CAAU","sources":["packages/@react-stately/table/src/Column.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CollectionBuilderContext} from './useTableState';\nimport {ColumnProps} from '@react-types/table';\nimport {GridNode} from '@react-types/grid';\nimport {PartialNode} from '@react-stately/collections';\nimport React, {JSX, ReactElement} from 'react';\n\nfunction Column<T>(props: ColumnProps<T>): ReactElement { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nColumn.getCollectionNode = function* getCollectionNode<T>(props: ColumnProps<T>, context: CollectionBuilderContext<T>): Generator<PartialNode<T>, void, GridNode<T>[]> {\n let {title, children, childColumns} = props;\n\n let rendered = title || children;\n let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label'];\n\n let fullNodes = yield {\n type: 'column',\n hasChildNodes: !!childColumns || (title && React.Children.count(children) > 0),\n rendered,\n textValue,\n props,\n *childNodes() {\n if (childColumns) {\n for (let child of childColumns) {\n yield {\n type: 'column',\n value: child\n };\n }\n } else if (title) {\n let childColumns: PartialNode<T>[] = [];\n React.Children.forEach(children, child => {\n childColumns.push({\n type: 'column',\n element: child as ReactElement<ColumnProps<T>>\n });\n });\n\n yield* childColumns;\n }\n },\n shouldInvalidate(newContext: CollectionBuilderContext<T>) {\n // This is a bit of a hack, but it works.\n // If this method is called, then there's a cached version of this node available.\n // But, we need to keep the list of columns in the new context up to date.\n updateContext(newContext);\n return false;\n }\n };\n\n let updateContext = (context: CollectionBuilderContext<T>) => {\n // register leaf columns on the context so that <Row> can access them\n for (let node of fullNodes) {\n if (!node.hasChildNodes) {\n context.columns.push(node);\n }\n }\n };\n\n updateContext(context);\n};\n\n/**\n * A Column represents a field of each item within a Table. Columns may also contain nested\n * Column elements to represent column groups. Nested columns can be statically defined as\n * children, or dynamically generated using a function based on the `childColumns` prop.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _Column = Column as <T>(props: ColumnProps<T>) => JSX.Element;\nexport {_Column as Column};\n"],"names":[],"version":3,"file":"Column.module.js.map"}
|
package/dist/Row.main.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
var $7Z9ig$react = require("react");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function $parcel$interopDefault(a) {
|
|
5
|
+
return a && a.__esModule ? a.default : a;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function $parcel$export(e, n, v, s) {
|
|
9
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
$parcel$export(module.exports, "Row", () => $9ec6912e32cc0d81$export$b59bdbef9ce70de2);
|
|
13
|
+
/*
|
|
14
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
15
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
16
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
17
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
*
|
|
19
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
20
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
21
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
22
|
+
* governing permissions and limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
function $9ec6912e32cc0d81$var$Row(props) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
$9ec6912e32cc0d81$var$Row.getCollectionNode = function* getCollectionNode(props, context) {
|
|
28
|
+
let { children: children, textValue: textValue, UNSTABLE_childItems: UNSTABLE_childItems } = props;
|
|
29
|
+
yield {
|
|
30
|
+
type: "item",
|
|
31
|
+
props: props,
|
|
32
|
+
textValue: textValue,
|
|
33
|
+
"aria-label": props["aria-label"],
|
|
34
|
+
hasChildNodes: true,
|
|
35
|
+
*childNodes () {
|
|
36
|
+
// Process cells first
|
|
37
|
+
if (context.showDragButtons) yield {
|
|
38
|
+
type: "cell",
|
|
39
|
+
key: "header-drag",
|
|
40
|
+
props: {
|
|
41
|
+
isDragButtonCell: true
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
if (context.showSelectionCheckboxes && context.selectionMode !== "none") yield {
|
|
45
|
+
type: "cell",
|
|
46
|
+
key: "header",
|
|
47
|
+
props: {
|
|
48
|
+
isSelectionCell: true
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
if (typeof children === "function") {
|
|
52
|
+
for (let column of context.columns)yield {
|
|
53
|
+
type: "cell",
|
|
54
|
+
element: children(column.key),
|
|
55
|
+
key: column.key // this is combined with the row key by CollectionBuilder
|
|
56
|
+
};
|
|
57
|
+
if (UNSTABLE_childItems) for (let child of UNSTABLE_childItems)// Note: in order to reuse the render function of TableBody for our child rows, we just need to yield a type and a value here. CollectionBuilder will then look up
|
|
58
|
+
// the parent renderer and use that to build the full node of this child row, using the value provided here to generate the cells
|
|
59
|
+
yield {
|
|
60
|
+
type: "item",
|
|
61
|
+
value: child
|
|
62
|
+
};
|
|
63
|
+
} else {
|
|
64
|
+
let cells = [];
|
|
65
|
+
let childRows = [];
|
|
66
|
+
(0, ($parcel$interopDefault($7Z9ig$react))).Children.forEach(children, (node)=>{
|
|
67
|
+
if (node.type === $9ec6912e32cc0d81$var$Row) {
|
|
68
|
+
if (cells.length < context.columns.length) throw new Error("All of a Row's child Cells must be positioned before any child Rows.");
|
|
69
|
+
childRows.push({
|
|
70
|
+
type: "item",
|
|
71
|
+
element: node
|
|
72
|
+
});
|
|
73
|
+
} else cells.push({
|
|
74
|
+
type: "cell",
|
|
75
|
+
element: node
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
if (cells.length !== context.columns.length) throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`);
|
|
79
|
+
yield* cells;
|
|
80
|
+
yield* childRows;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
shouldInvalidate (newContext) {
|
|
84
|
+
// Invalidate all rows if the columns changed.
|
|
85
|
+
return newContext.columns.length !== context.columns.length || newContext.columns.some((c, i)=>c.key !== context.columns[i].key) || newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes || newContext.showDragButtons !== context.showDragButtons || newContext.selectionMode !== context.selectionMode;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* A Row represents a single item in a Table and contains Cell elements for each column.
|
|
91
|
+
* Cells can be statically defined as children, or generated dynamically using a function
|
|
92
|
+
* based on the columns defined in the TableHeader.
|
|
93
|
+
*/ // We don't want getCollectionNode to show up in the type definition
|
|
94
|
+
let $9ec6912e32cc0d81$export$b59bdbef9ce70de2 = $9ec6912e32cc0d81$var$Row;
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=Row.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAOD,SAAS,0BAAO,KAAkB;IAChC,OAAO;AACT;AAEA,0BAAI,iBAAiB,GAAG,UAAU,kBAAqB,KAAkB,EAAE,OAAoC;IAC7G,IAAI,YAAC,QAAQ,aAAE,SAAS,uBAAE,mBAAmB,EAAC,GAAG;IAEjD,MAAM;QACJ,MAAM;QACN,OAAO;mBACP;QACA,cAAc,KAAK,CAAC,aAAa;QACjC,eAAe;QACf,CAAC;YACC,sBAAsB;YACtB,IAAI,QAAQ,eAAe,EACzB,MAAM;gBACJ,MAAM;gBACN,KAAK;gBACL,OAAO;oBACL,kBAAkB;gBACpB;YACF;YAGF,IAAI,QAAQ,uBAAuB,IAAI,QAAQ,aAAa,KAAK,QAC/D,MAAM;gBACJ,MAAM;gBACN,KAAK;gBACL,OAAO;oBACL,iBAAiB;gBACnB;YACF;YAGF,IAAI,OAAO,aAAa,YAAY;gBAClC,KAAK,IAAI,UAAU,QAAQ,OAAO,CAChC,MAAM;oBACJ,MAAM;oBACN,SAAS,SAAS,OAAO,GAAG;oBAC5B,KAAK,OAAO,GAAG,CAAC,yDAAyD;gBAC3E;gBAGF,IAAI,qBACF,KAAK,IAAI,SAAS,oBAChB,kKAAkK;gBAClK,iIAAiI;gBACjI,MAAM;oBACJ,MAAM;oBACN,OAAO;gBACT;YAGN,OAAO;gBACL,IAAI,QAA0B,EAAE;gBAChC,IAAI,YAA8B,EAAE;gBACpC,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAA;oBAC/B,IAAI,KAAK,IAAI,KAAK,2BAAK;wBACrB,IAAI,MAAM,MAAM,GAAG,QAAQ,OAAO,CAAC,MAAM,EACvC,MAAM,IAAI,MAAM;wBAGlB,UAAU,IAAI,CAAC;4BACb,MAAM;4BACN,SAAS;wBACX;oBACF,OACE,MAAM,IAAI,CAAC;wBACT,MAAM;wBACN,SAAS;oBACX;gBAEJ;gBAEA,IAAI,MAAM,MAAM,KAAK,QAAQ,OAAO,CAAC,MAAM,EACzC,MAAM,IAAI,MAAM,CAAC,0CAA0C,EAAE,MAAM,MAAM,CAAC,WAAW,EAAE,QAAQ,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;gBAG1H,OAAO;gBACP,OAAO;YACT;QACF;QACA,kBAAiB,UAAuC;YACtD,8CAA8C;YAC9C,OAAO,WAAW,OAAO,CAAC,MAAM,KAAK,QAAQ,OAAO,CAAC,MAAM,IACzD,WAAW,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAM,EAAE,GAAG,KAAK,QAAQ,OAAO,CAAC,EAAE,CAAC,GAAG,KAClE,WAAW,uBAAuB,KAAK,QAAQ,uBAAuB,IACtE,WAAW,eAAe,KAAK,QAAQ,eAAe,IACtD,WAAW,aAAa,KAAK,QAAQ,aAAa;QACtD;IACF;AACF;AAEA;;;;CAIC,GACD,oEAAoE;AACpE,IAAI,4CAAO","sources":["packages/@react-stately/table/src/Row.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CollectionBuilderContext} from './useTableState';\nimport {PartialNode} from '@react-stately/collections';\nimport React, {JSX, ReactElement} from 'react';\nimport {RowProps} from '@react-types/table';\n\nfunction Row<T>(props: RowProps<T>): ReactElement { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nRow.getCollectionNode = function* getCollectionNode<T>(props: RowProps<T>, context: CollectionBuilderContext<T>): Generator<PartialNode<T>> {\n let {children, textValue, UNSTABLE_childItems} = props;\n\n yield {\n type: 'item',\n props: props,\n textValue,\n 'aria-label': props['aria-label'],\n hasChildNodes: true,\n *childNodes() {\n // Process cells first\n if (context.showDragButtons) {\n yield {\n type: 'cell',\n key: 'header-drag', // this is combined with the row key by CollectionBuilder\n props: {\n isDragButtonCell: true\n }\n };\n }\n\n if (context.showSelectionCheckboxes && context.selectionMode !== 'none') {\n yield {\n type: 'cell',\n key: 'header', // this is combined with the row key by CollectionBuilder\n props: {\n isSelectionCell: true\n }\n };\n }\n\n if (typeof children === 'function') {\n for (let column of context.columns) {\n yield {\n type: 'cell',\n element: children(column.key),\n key: column.key // this is combined with the row key by CollectionBuilder\n };\n }\n\n if (UNSTABLE_childItems) {\n for (let child of UNSTABLE_childItems) {\n // Note: in order to reuse the render function of TableBody for our child rows, we just need to yield a type and a value here. CollectionBuilder will then look up\n // the parent renderer and use that to build the full node of this child row, using the value provided here to generate the cells\n yield {\n type: 'item',\n value: child\n };\n }\n }\n } else {\n let cells: PartialNode<T>[] = [];\n let childRows: PartialNode<T>[] = [];\n React.Children.forEach(children, node => {\n if (node.type === Row) {\n if (cells.length < context.columns.length) {\n throw new Error('All of a Row\\'s child Cells must be positioned before any child Rows.');\n }\n\n childRows.push({\n type: 'item',\n element: node\n });\n } else {\n cells.push({\n type: 'cell',\n element: node\n });\n }\n });\n\n if (cells.length !== context.columns.length) {\n throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`);\n }\n\n yield* cells;\n yield* childRows;\n }\n },\n shouldInvalidate(newContext: CollectionBuilderContext<T>) {\n // Invalidate all rows if the columns changed.\n return newContext.columns.length !== context.columns.length ||\n newContext.columns.some((c, i) => c.key !== context.columns[i].key) ||\n newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes ||\n newContext.showDragButtons !== context.showDragButtons ||\n newContext.selectionMode !== context.selectionMode;\n }\n };\n};\n\n/**\n * A Row represents a single item in a Table and contains Cell elements for each column.\n * Cells can be statically defined as children, or generated dynamically using a function\n * based on the columns defined in the TableHeader.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _Row = Row as <T>(props: RowProps<T>) => JSX.Element;\nexport {_Row as Row};\n"],"names":[],"version":3,"file":"Row.main.js.map"}
|
package/dist/Row.mjs
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import $7GIZw$react from "react";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
function $70d70eb16ea48428$var$Row(props) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
$70d70eb16ea48428$var$Row.getCollectionNode = function* getCollectionNode(props, context) {
|
|
18
|
+
let { children: children, textValue: textValue, UNSTABLE_childItems: UNSTABLE_childItems } = props;
|
|
19
|
+
yield {
|
|
20
|
+
type: "item",
|
|
21
|
+
props: props,
|
|
22
|
+
textValue: textValue,
|
|
23
|
+
"aria-label": props["aria-label"],
|
|
24
|
+
hasChildNodes: true,
|
|
25
|
+
*childNodes () {
|
|
26
|
+
// Process cells first
|
|
27
|
+
if (context.showDragButtons) yield {
|
|
28
|
+
type: "cell",
|
|
29
|
+
key: "header-drag",
|
|
30
|
+
props: {
|
|
31
|
+
isDragButtonCell: true
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
if (context.showSelectionCheckboxes && context.selectionMode !== "none") yield {
|
|
35
|
+
type: "cell",
|
|
36
|
+
key: "header",
|
|
37
|
+
props: {
|
|
38
|
+
isSelectionCell: true
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
if (typeof children === "function") {
|
|
42
|
+
for (let column of context.columns)yield {
|
|
43
|
+
type: "cell",
|
|
44
|
+
element: children(column.key),
|
|
45
|
+
key: column.key // this is combined with the row key by CollectionBuilder
|
|
46
|
+
};
|
|
47
|
+
if (UNSTABLE_childItems) for (let child of UNSTABLE_childItems)// Note: in order to reuse the render function of TableBody for our child rows, we just need to yield a type and a value here. CollectionBuilder will then look up
|
|
48
|
+
// the parent renderer and use that to build the full node of this child row, using the value provided here to generate the cells
|
|
49
|
+
yield {
|
|
50
|
+
type: "item",
|
|
51
|
+
value: child
|
|
52
|
+
};
|
|
53
|
+
} else {
|
|
54
|
+
let cells = [];
|
|
55
|
+
let childRows = [];
|
|
56
|
+
(0, $7GIZw$react).Children.forEach(children, (node)=>{
|
|
57
|
+
if (node.type === $70d70eb16ea48428$var$Row) {
|
|
58
|
+
if (cells.length < context.columns.length) throw new Error("All of a Row's child Cells must be positioned before any child Rows.");
|
|
59
|
+
childRows.push({
|
|
60
|
+
type: "item",
|
|
61
|
+
element: node
|
|
62
|
+
});
|
|
63
|
+
} else cells.push({
|
|
64
|
+
type: "cell",
|
|
65
|
+
element: node
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
if (cells.length !== context.columns.length) throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`);
|
|
69
|
+
yield* cells;
|
|
70
|
+
yield* childRows;
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
shouldInvalidate (newContext) {
|
|
74
|
+
// Invalidate all rows if the columns changed.
|
|
75
|
+
return newContext.columns.length !== context.columns.length || newContext.columns.some((c, i)=>c.key !== context.columns[i].key) || newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes || newContext.showDragButtons !== context.showDragButtons || newContext.selectionMode !== context.selectionMode;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* A Row represents a single item in a Table and contains Cell elements for each column.
|
|
81
|
+
* Cells can be statically defined as children, or generated dynamically using a function
|
|
82
|
+
* based on the columns defined in the TableHeader.
|
|
83
|
+
*/ // We don't want getCollectionNode to show up in the type definition
|
|
84
|
+
let $70d70eb16ea48428$export$b59bdbef9ce70de2 = $70d70eb16ea48428$var$Row;
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
export {$70d70eb16ea48428$export$b59bdbef9ce70de2 as Row};
|
|
88
|
+
//# sourceMappingURL=Row.mjs.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import $7GIZw$react from "react";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
function $70d70eb16ea48428$var$Row(props) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
$70d70eb16ea48428$var$Row.getCollectionNode = function* getCollectionNode(props, context) {
|
|
18
|
+
let { children: children, textValue: textValue, UNSTABLE_childItems: UNSTABLE_childItems } = props;
|
|
19
|
+
yield {
|
|
20
|
+
type: "item",
|
|
21
|
+
props: props,
|
|
22
|
+
textValue: textValue,
|
|
23
|
+
"aria-label": props["aria-label"],
|
|
24
|
+
hasChildNodes: true,
|
|
25
|
+
*childNodes () {
|
|
26
|
+
// Process cells first
|
|
27
|
+
if (context.showDragButtons) yield {
|
|
28
|
+
type: "cell",
|
|
29
|
+
key: "header-drag",
|
|
30
|
+
props: {
|
|
31
|
+
isDragButtonCell: true
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
if (context.showSelectionCheckboxes && context.selectionMode !== "none") yield {
|
|
35
|
+
type: "cell",
|
|
36
|
+
key: "header",
|
|
37
|
+
props: {
|
|
38
|
+
isSelectionCell: true
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
if (typeof children === "function") {
|
|
42
|
+
for (let column of context.columns)yield {
|
|
43
|
+
type: "cell",
|
|
44
|
+
element: children(column.key),
|
|
45
|
+
key: column.key // this is combined with the row key by CollectionBuilder
|
|
46
|
+
};
|
|
47
|
+
if (UNSTABLE_childItems) for (let child of UNSTABLE_childItems)// Note: in order to reuse the render function of TableBody for our child rows, we just need to yield a type and a value here. CollectionBuilder will then look up
|
|
48
|
+
// the parent renderer and use that to build the full node of this child row, using the value provided here to generate the cells
|
|
49
|
+
yield {
|
|
50
|
+
type: "item",
|
|
51
|
+
value: child
|
|
52
|
+
};
|
|
53
|
+
} else {
|
|
54
|
+
let cells = [];
|
|
55
|
+
let childRows = [];
|
|
56
|
+
(0, $7GIZw$react).Children.forEach(children, (node)=>{
|
|
57
|
+
if (node.type === $70d70eb16ea48428$var$Row) {
|
|
58
|
+
if (cells.length < context.columns.length) throw new Error("All of a Row's child Cells must be positioned before any child Rows.");
|
|
59
|
+
childRows.push({
|
|
60
|
+
type: "item",
|
|
61
|
+
element: node
|
|
62
|
+
});
|
|
63
|
+
} else cells.push({
|
|
64
|
+
type: "cell",
|
|
65
|
+
element: node
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
if (cells.length !== context.columns.length) throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`);
|
|
69
|
+
yield* cells;
|
|
70
|
+
yield* childRows;
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
shouldInvalidate (newContext) {
|
|
74
|
+
// Invalidate all rows if the columns changed.
|
|
75
|
+
return newContext.columns.length !== context.columns.length || newContext.columns.some((c, i)=>c.key !== context.columns[i].key) || newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes || newContext.showDragButtons !== context.showDragButtons || newContext.selectionMode !== context.selectionMode;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* A Row represents a single item in a Table and contains Cell elements for each column.
|
|
81
|
+
* Cells can be statically defined as children, or generated dynamically using a function
|
|
82
|
+
* based on the columns defined in the TableHeader.
|
|
83
|
+
*/ // We don't want getCollectionNode to show up in the type definition
|
|
84
|
+
let $70d70eb16ea48428$export$b59bdbef9ce70de2 = $70d70eb16ea48428$var$Row;
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
export {$70d70eb16ea48428$export$b59bdbef9ce70de2 as Row};
|
|
88
|
+
//# sourceMappingURL=Row.module.js.map
|