@xyo-network/react-table 2.64.9 → 2.65.0
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/package.json +6 -6
- package/dist/browser/components/TableEx/TableCellEx.cjs +0 -32
- package/dist/browser/components/TableEx/TableCellEx.cjs.map +0 -1
- package/dist/browser/components/TableEx/TableCellEx.js +0 -11
- package/dist/browser/components/TableEx/TableCellEx.js.map +0 -1
- package/dist/browser/components/TableEx/TableEx.cjs +0 -39
- package/dist/browser/components/TableEx/TableEx.cjs.map +0 -1
- package/dist/browser/components/TableEx/TableEx.js +0 -18
- package/dist/browser/components/TableEx/TableEx.js.map +0 -1
- package/dist/browser/components/TableEx/TableFooterEx.cjs +0 -42
- package/dist/browser/components/TableEx/TableFooterEx.cjs.map +0 -1
- package/dist/browser/components/TableEx/TableFooterEx.js +0 -21
- package/dist/browser/components/TableEx/TableFooterEx.js.map +0 -1
- package/dist/browser/components/TableEx/index.cjs +0 -69
- package/dist/browser/components/TableEx/index.cjs.map +0 -1
- package/dist/browser/components/TableEx/index.js +0 -46
- package/dist/browser/components/TableEx/index.js.map +0 -1
- package/dist/browser/components/TableEx/types/TableExVariants.cjs +0 -19
- package/dist/browser/components/TableEx/types/TableExVariants.cjs.map +0 -1
- package/dist/browser/components/TableEx/types/TableExVariants.js +0 -1
- package/dist/browser/components/TableEx/types/TableExVariants.js.map +0 -1
- package/dist/browser/components/TableEx/types/index.cjs +0 -19
- package/dist/browser/components/TableEx/types/index.cjs.map +0 -1
- package/dist/browser/components/TableEx/types/index.js +0 -1
- package/dist/browser/components/TableEx/types/index.js.map +0 -1
- package/dist/browser/components/index.cjs +0 -69
- package/dist/browser/components/index.cjs.map +0 -1
- package/dist/browser/components/index.js +0 -46
- package/dist/browser/components/index.js.map +0 -1
- package/dist/browser/context/TableHeight/Context.cjs +0 -28
- package/dist/browser/context/TableHeight/Context.cjs.map +0 -1
- package/dist/browser/context/TableHeight/Context.js +0 -7
- package/dist/browser/context/TableHeight/Context.js.map +0 -1
- package/dist/browser/context/TableHeight/Provider.cjs +0 -54
- package/dist/browser/context/TableHeight/Provider.cjs.map +0 -1
- package/dist/browser/context/TableHeight/Provider.js +0 -33
- package/dist/browser/context/TableHeight/Provider.js.map +0 -1
- package/dist/browser/context/TableHeight/State.cjs +0 -19
- package/dist/browser/context/TableHeight/State.cjs.map +0 -1
- package/dist/browser/context/TableHeight/State.js +0 -1
- package/dist/browser/context/TableHeight/State.js.map +0 -1
- package/dist/browser/context/TableHeight/index.cjs +0 -60
- package/dist/browser/context/TableHeight/index.cjs.map +0 -1
- package/dist/browser/context/TableHeight/index.js +0 -37
- package/dist/browser/context/TableHeight/index.js.map +0 -1
- package/dist/browser/context/TableHeight/use.cjs +0 -34
- package/dist/browser/context/TableHeight/use.cjs.map +0 -1
- package/dist/browser/context/TableHeight/use.js +0 -13
- package/dist/browser/context/TableHeight/use.js.map +0 -1
- package/dist/browser/context/index.cjs +0 -60
- package/dist/browser/context/index.cjs.map +0 -1
- package/dist/browser/context/index.js +0 -37
- package/dist/browser/context/index.js.map +0 -1
- package/dist/docs.json +0 -1442
- package/dist/node/components/TableEx/TableCellEx.cjs +0 -36
- package/dist/node/components/TableEx/TableCellEx.cjs.map +0 -1
- package/dist/node/components/TableEx/TableCellEx.js +0 -11
- package/dist/node/components/TableEx/TableCellEx.js.map +0 -1
- package/dist/node/components/TableEx/TableEx.cjs +0 -44
- package/dist/node/components/TableEx/TableEx.cjs.map +0 -1
- package/dist/node/components/TableEx/TableEx.js +0 -18
- package/dist/node/components/TableEx/TableEx.js.map +0 -1
- package/dist/node/components/TableEx/TableFooterEx.cjs +0 -46
- package/dist/node/components/TableEx/TableFooterEx.cjs.map +0 -1
- package/dist/node/components/TableEx/TableFooterEx.js +0 -21
- package/dist/node/components/TableEx/TableFooterEx.js.map +0 -1
- package/dist/node/components/TableEx/index.cjs +0 -76
- package/dist/node/components/TableEx/index.cjs.map +0 -1
- package/dist/node/components/TableEx/index.js +0 -46
- package/dist/node/components/TableEx/index.js.map +0 -1
- package/dist/node/components/TableEx/types/TableExVariants.cjs +0 -19
- package/dist/node/components/TableEx/types/TableExVariants.cjs.map +0 -1
- package/dist/node/components/TableEx/types/TableExVariants.js +0 -1
- package/dist/node/components/TableEx/types/TableExVariants.js.map +0 -1
- package/dist/node/components/TableEx/types/index.cjs +0 -19
- package/dist/node/components/TableEx/types/index.cjs.map +0 -1
- package/dist/node/components/TableEx/types/index.js +0 -1
- package/dist/node/components/TableEx/types/index.js.map +0 -1
- package/dist/node/components/index.cjs +0 -76
- package/dist/node/components/index.cjs.map +0 -1
- package/dist/node/components/index.js +0 -46
- package/dist/node/components/index.js.map +0 -1
- package/dist/node/context/TableHeight/Context.cjs +0 -32
- package/dist/node/context/TableHeight/Context.cjs.map +0 -1
- package/dist/node/context/TableHeight/Context.js +0 -7
- package/dist/node/context/TableHeight/Context.js.map +0 -1
- package/dist/node/context/TableHeight/Provider.cjs +0 -58
- package/dist/node/context/TableHeight/Provider.cjs.map +0 -1
- package/dist/node/context/TableHeight/Provider.js +0 -33
- package/dist/node/context/TableHeight/Provider.js.map +0 -1
- package/dist/node/context/TableHeight/State.cjs +0 -19
- package/dist/node/context/TableHeight/State.cjs.map +0 -1
- package/dist/node/context/TableHeight/State.js +0 -1
- package/dist/node/context/TableHeight/State.js.map +0 -1
- package/dist/node/context/TableHeight/index.cjs +0 -66
- package/dist/node/context/TableHeight/index.cjs.map +0 -1
- package/dist/node/context/TableHeight/index.js +0 -37
- package/dist/node/context/TableHeight/index.js.map +0 -1
- package/dist/node/context/TableHeight/use.cjs +0 -38
- package/dist/node/context/TableHeight/use.cjs.map +0 -1
- package/dist/node/context/TableHeight/use.js +0 -13
- package/dist/node/context/TableHeight/use.js.map +0 -1
- package/dist/node/context/index.cjs +0 -66
- package/dist/node/context/index.cjs.map +0 -1
- package/dist/node/context/index.js +0 -37
- package/dist/node/context/index.js.map +0 -1
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/context/TableHeight/Provider.tsx
|
|
21
|
-
var Provider_exports = {};
|
|
22
|
-
__export(Provider_exports, {
|
|
23
|
-
TableHeightProvider: () => TableHeightProvider
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(Provider_exports);
|
|
26
|
-
var import_react = require("react");
|
|
27
|
-
|
|
28
|
-
// src/context/TableHeight/Context.ts
|
|
29
|
-
var import_react_shared = require("@xyo-network/react-shared");
|
|
30
|
-
var TableHeightContext = (0, import_react_shared.createContextEx)();
|
|
31
|
-
|
|
32
|
-
// src/context/TableHeight/Provider.tsx
|
|
33
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
-
var TableHeightProvider = ({
|
|
35
|
-
children,
|
|
36
|
-
additionalRows = 0,
|
|
37
|
-
defaultVisibleRows,
|
|
38
|
-
heightFormat = "px"
|
|
39
|
-
}) => {
|
|
40
|
-
const [visibleRows, setVisibleRows] = (0, import_react.useState)(defaultVisibleRows);
|
|
41
|
-
const [height, setHeight] = (0, import_react.useState)();
|
|
42
|
-
const [rowHeight, setRowHeight] = (0, import_react.useState)();
|
|
43
|
-
const formattedHeight = (0, import_react.useMemo)(() => height !== void 0 ? `${height}${heightFormat}` : void 0, [height, heightFormat]);
|
|
44
|
-
(0, import_react.useEffect)(() => {
|
|
45
|
-
setVisibleRows(defaultVisibleRows);
|
|
46
|
-
}, [defaultVisibleRows]);
|
|
47
|
-
(0, import_react.useEffect)(() => {
|
|
48
|
-
if (rowHeight !== void 0 && visibleRows !== void 0) {
|
|
49
|
-
setHeight(rowHeight * (visibleRows + additionalRows));
|
|
50
|
-
}
|
|
51
|
-
}, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
|
|
52
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=Provider.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/context/TableHeight/Provider.tsx","../../../../src/context/TableHeight/Context.ts"],"sourcesContent":["import { WithChildren } from '@xylabs/react-shared'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context'\n\nexport interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {\n /** @field Account for optional header and footer rows */\n additionalRows?: number\n defaultVisibleRows?: number\n heightFormat?: string\n}\n\nexport const TableHeightProvider: React.FC<TableHeightProviderProps> = ({\n children,\n additionalRows = 0,\n defaultVisibleRows,\n heightFormat = 'px',\n}) => {\n const [visibleRows, setVisibleRows] = useState(defaultVisibleRows)\n const [height, setHeight] = useState<number | undefined>()\n const [rowHeight, setRowHeight] = useState<number | undefined>()\n\n const formattedHeight = useMemo(() => (height !== undefined ? `${height}${heightFormat}` : undefined), [height, heightFormat])\n\n useEffect(() => {\n setVisibleRows(defaultVisibleRows)\n }, [defaultVisibleRows])\n\n useEffect(() => {\n if (rowHeight !== undefined && visibleRows !== undefined) {\n setHeight(rowHeight * (visibleRows + additionalRows))\n }\n }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])\n\n return (\n <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightState } from './State'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA6C;;;ACF7C,0BAAgC;AAIzB,IAAM,yBAAqB,qCAAkC;;;ADgChE;AAvBG,IAAM,sBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA,eAAe;AACjB,MAAM;AACJ,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,kBAAkB;AACjE,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAA6B;AACzD,QAAM,CAAC,WAAW,YAAY,QAAI,uBAA6B;AAE/D,QAAM,sBAAkB,sBAAQ,MAAO,WAAW,SAAY,GAAG,MAAM,GAAG,YAAY,KAAK,QAAY,CAAC,QAAQ,YAAY,CAAC;AAE7H,8BAAU,MAAM;AACd,mBAAe,kBAAkB;AAAA,EACnC,GAAG,CAAC,kBAAkB,CAAC;AAEvB,8BAAU,MAAM;AACd,QAAI,cAAc,UAAa,gBAAgB,QAAW;AACxD,gBAAU,aAAa,cAAc,eAAe;AAAA,IACtD;AAAA,EACF,GAAG,CAAC,oBAAoB,WAAW,aAAa,cAAc,CAAC;AAE/D,SACE,4CAAC,mBAAmB,UAAnB,EAA4B,OAAO,EAAE,QAAQ,iBAAiB,UAAU,MAAM,WAAW,cAAc,gBAAgB,YAAY,GACjI,UACH;AAEJ;","names":[]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// src/context/TableHeight/Provider.tsx
|
|
2
|
-
import { useEffect, useMemo, useState } from "react";
|
|
3
|
-
|
|
4
|
-
// src/context/TableHeight/Context.ts
|
|
5
|
-
import { createContextEx } from "@xyo-network/react-shared";
|
|
6
|
-
var TableHeightContext = createContextEx();
|
|
7
|
-
|
|
8
|
-
// src/context/TableHeight/Provider.tsx
|
|
9
|
-
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
var TableHeightProvider = ({
|
|
11
|
-
children,
|
|
12
|
-
additionalRows = 0,
|
|
13
|
-
defaultVisibleRows,
|
|
14
|
-
heightFormat = "px"
|
|
15
|
-
}) => {
|
|
16
|
-
const [visibleRows, setVisibleRows] = useState(defaultVisibleRows);
|
|
17
|
-
const [height, setHeight] = useState();
|
|
18
|
-
const [rowHeight, setRowHeight] = useState();
|
|
19
|
-
const formattedHeight = useMemo(() => height !== void 0 ? `${height}${heightFormat}` : void 0, [height, heightFormat]);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
setVisibleRows(defaultVisibleRows);
|
|
22
|
-
}, [defaultVisibleRows]);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (rowHeight !== void 0 && visibleRows !== void 0) {
|
|
25
|
-
setHeight(rowHeight * (visibleRows + additionalRows));
|
|
26
|
-
}
|
|
27
|
-
}, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
|
|
28
|
-
return /* @__PURE__ */ jsx(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
|
|
29
|
-
};
|
|
30
|
-
export {
|
|
31
|
-
TableHeightProvider
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=Provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/context/TableHeight/Provider.tsx","../../../../src/context/TableHeight/Context.ts"],"sourcesContent":["import { WithChildren } from '@xylabs/react-shared'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context'\n\nexport interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {\n /** @field Account for optional header and footer rows */\n additionalRows?: number\n defaultVisibleRows?: number\n heightFormat?: string\n}\n\nexport const TableHeightProvider: React.FC<TableHeightProviderProps> = ({\n children,\n additionalRows = 0,\n defaultVisibleRows,\n heightFormat = 'px',\n}) => {\n const [visibleRows, setVisibleRows] = useState(defaultVisibleRows)\n const [height, setHeight] = useState<number | undefined>()\n const [rowHeight, setRowHeight] = useState<number | undefined>()\n\n const formattedHeight = useMemo(() => (height !== undefined ? `${height}${heightFormat}` : undefined), [height, heightFormat])\n\n useEffect(() => {\n setVisibleRows(defaultVisibleRows)\n }, [defaultVisibleRows])\n\n useEffect(() => {\n if (rowHeight !== undefined && visibleRows !== undefined) {\n setHeight(rowHeight * (visibleRows + additionalRows))\n }\n }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])\n\n return (\n <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightState } from './State'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n"],"mappings":";AAEA,SAAS,WAAW,SAAS,gBAAgB;;;ACF7C,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ADgChE;AAvBG,IAAM,sBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA,eAAe;AACjB,MAAM;AACJ,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,kBAAkB;AACjE,QAAM,CAAC,QAAQ,SAAS,IAAI,SAA6B;AACzD,QAAM,CAAC,WAAW,YAAY,IAAI,SAA6B;AAE/D,QAAM,kBAAkB,QAAQ,MAAO,WAAW,SAAY,GAAG,MAAM,GAAG,YAAY,KAAK,QAAY,CAAC,QAAQ,YAAY,CAAC;AAE7H,YAAU,MAAM;AACd,mBAAe,kBAAkB;AAAA,EACnC,GAAG,CAAC,kBAAkB,CAAC;AAEvB,YAAU,MAAM;AACd,QAAI,cAAc,UAAa,gBAAgB,QAAW;AACxD,gBAAU,aAAa,cAAc,eAAe;AAAA,IACtD;AAAA,EACF,GAAG,CAAC,oBAAoB,WAAW,aAAa,cAAc,CAAC;AAE/D,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,EAAE,QAAQ,iBAAiB,UAAU,MAAM,WAAW,cAAc,gBAAgB,YAAY,GACjI,UACH;AAEJ;","names":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/context/TableHeight/State.ts
|
|
17
|
-
var State_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(State_exports);
|
|
19
|
-
//# sourceMappingURL=State.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/context/TableHeight/State.ts"],"sourcesContent":["import { ContextExState } from '@xyo-network/react-shared'\nimport { Dispatch, SetStateAction } from 'react'\n\nexport interface TableHeightState extends ContextExState {\n height?: string\n rowHeight?: number\n setRowHeight?: Dispatch<SetStateAction<number | undefined>>\n setVisibleRows?: Dispatch<SetStateAction<number | undefined>>\n visibleRows?: number\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=State.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/context/TableHeight/index.ts
|
|
21
|
-
var TableHeight_exports = {};
|
|
22
|
-
__export(TableHeight_exports, {
|
|
23
|
-
TableHeightContext: () => TableHeightContext,
|
|
24
|
-
TableHeightProvider: () => TableHeightProvider,
|
|
25
|
-
useTableHeight: () => useTableHeight
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(TableHeight_exports);
|
|
28
|
-
|
|
29
|
-
// src/context/TableHeight/Context.ts
|
|
30
|
-
var import_react_shared = require("@xyo-network/react-shared");
|
|
31
|
-
var TableHeightContext = (0, import_react_shared.createContextEx)();
|
|
32
|
-
|
|
33
|
-
// src/context/TableHeight/Provider.tsx
|
|
34
|
-
var import_react = require("react");
|
|
35
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var TableHeightProvider = ({
|
|
37
|
-
children,
|
|
38
|
-
additionalRows = 0,
|
|
39
|
-
defaultVisibleRows,
|
|
40
|
-
heightFormat = "px"
|
|
41
|
-
}) => {
|
|
42
|
-
const [visibleRows, setVisibleRows] = (0, import_react.useState)(defaultVisibleRows);
|
|
43
|
-
const [height, setHeight] = (0, import_react.useState)();
|
|
44
|
-
const [rowHeight, setRowHeight] = (0, import_react.useState)();
|
|
45
|
-
const formattedHeight = (0, import_react.useMemo)(() => height !== void 0 ? `${height}${heightFormat}` : void 0, [height, heightFormat]);
|
|
46
|
-
(0, import_react.useEffect)(() => {
|
|
47
|
-
setVisibleRows(defaultVisibleRows);
|
|
48
|
-
}, [defaultVisibleRows]);
|
|
49
|
-
(0, import_react.useEffect)(() => {
|
|
50
|
-
if (rowHeight !== void 0 && visibleRows !== void 0) {
|
|
51
|
-
setHeight(rowHeight * (visibleRows + additionalRows));
|
|
52
|
-
}
|
|
53
|
-
}, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
|
|
54
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// src/context/TableHeight/use.tsx
|
|
58
|
-
var import_react_shared2 = require("@xyo-network/react-shared");
|
|
59
|
-
var useTableHeight = (required = false) => (0, import_react_shared2.useContextEx)(TableHeightContext, "TableHeight", required);
|
|
60
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/context/TableHeight/index.ts","../../../../src/context/TableHeight/Context.ts","../../../../src/context/TableHeight/Provider.tsx","../../../../src/context/TableHeight/use.tsx"],"sourcesContent":["export * from './Context'\nexport * from './Provider'\nexport * from './State'\nexport * from './use'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightState } from './State'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context'\n\nexport interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {\n /** @field Account for optional header and footer rows */\n additionalRows?: number\n defaultVisibleRows?: number\n heightFormat?: string\n}\n\nexport const TableHeightProvider: React.FC<TableHeightProviderProps> = ({\n children,\n additionalRows = 0,\n defaultVisibleRows,\n heightFormat = 'px',\n}) => {\n const [visibleRows, setVisibleRows] = useState(defaultVisibleRows)\n const [height, setHeight] = useState<number | undefined>()\n const [rowHeight, setRowHeight] = useState<number | undefined>()\n\n const formattedHeight = useMemo(() => (height !== undefined ? `${height}${heightFormat}` : undefined), [height, heightFormat])\n\n useEffect(() => {\n setVisibleRows(defaultVisibleRows)\n }, [defaultVisibleRows])\n\n useEffect(() => {\n if (rowHeight !== undefined && visibleRows !== undefined) {\n setHeight(rowHeight * (visibleRows + additionalRows))\n }\n }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])\n\n return (\n <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAAgC;AAIzB,IAAM,yBAAqB,qCAAkC;;;ACFpE,mBAA6C;AAkCzC;AAvBG,IAAM,sBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA,eAAe;AACjB,MAAM;AACJ,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,kBAAkB;AACjE,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAA6B;AACzD,QAAM,CAAC,WAAW,YAAY,QAAI,uBAA6B;AAE/D,QAAM,sBAAkB,sBAAQ,MAAO,WAAW,SAAY,GAAG,MAAM,GAAG,YAAY,KAAK,QAAY,CAAC,QAAQ,YAAY,CAAC;AAE7H,8BAAU,MAAM;AACd,mBAAe,kBAAkB;AAAA,EACnC,GAAG,CAAC,kBAAkB,CAAC;AAEvB,8BAAU,MAAM;AACd,QAAI,cAAc,UAAa,gBAAgB,QAAW;AACxD,gBAAU,aAAa,cAAc,eAAe;AAAA,IACtD;AAAA,EACF,GAAG,CAAC,oBAAoB,WAAW,aAAa,cAAc,CAAC;AAE/D,SACE,4CAAC,mBAAmB,UAAnB,EAA4B,OAAO,EAAE,QAAQ,iBAAiB,UAAU,MAAM,WAAW,cAAc,gBAAgB,YAAY,GACjI,UACH;AAEJ;;;ACxCA,IAAAA,uBAA6B;AAItB,IAAM,iBAAiB,CAAC,WAAW,cAAU,mCAAa,oBAAoB,eAAe,QAAQ;","names":["import_react_shared"]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// src/context/TableHeight/Context.ts
|
|
2
|
-
import { createContextEx } from "@xyo-network/react-shared";
|
|
3
|
-
var TableHeightContext = createContextEx();
|
|
4
|
-
|
|
5
|
-
// src/context/TableHeight/Provider.tsx
|
|
6
|
-
import { useEffect, useMemo, useState } from "react";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
var TableHeightProvider = ({
|
|
9
|
-
children,
|
|
10
|
-
additionalRows = 0,
|
|
11
|
-
defaultVisibleRows,
|
|
12
|
-
heightFormat = "px"
|
|
13
|
-
}) => {
|
|
14
|
-
const [visibleRows, setVisibleRows] = useState(defaultVisibleRows);
|
|
15
|
-
const [height, setHeight] = useState();
|
|
16
|
-
const [rowHeight, setRowHeight] = useState();
|
|
17
|
-
const formattedHeight = useMemo(() => height !== void 0 ? `${height}${heightFormat}` : void 0, [height, heightFormat]);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
setVisibleRows(defaultVisibleRows);
|
|
20
|
-
}, [defaultVisibleRows]);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (rowHeight !== void 0 && visibleRows !== void 0) {
|
|
23
|
-
setHeight(rowHeight * (visibleRows + additionalRows));
|
|
24
|
-
}
|
|
25
|
-
}, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
|
|
26
|
-
return /* @__PURE__ */ jsx(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// src/context/TableHeight/use.tsx
|
|
30
|
-
import { useContextEx } from "@xyo-network/react-shared";
|
|
31
|
-
var useTableHeight = (required = false) => useContextEx(TableHeightContext, "TableHeight", required);
|
|
32
|
-
export {
|
|
33
|
-
TableHeightContext,
|
|
34
|
-
TableHeightProvider,
|
|
35
|
-
useTableHeight
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/context/TableHeight/Context.ts","../../../../src/context/TableHeight/Provider.tsx","../../../../src/context/TableHeight/use.tsx"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightState } from './State'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context'\n\nexport interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {\n /** @field Account for optional header and footer rows */\n additionalRows?: number\n defaultVisibleRows?: number\n heightFormat?: string\n}\n\nexport const TableHeightProvider: React.FC<TableHeightProviderProps> = ({\n children,\n additionalRows = 0,\n defaultVisibleRows,\n heightFormat = 'px',\n}) => {\n const [visibleRows, setVisibleRows] = useState(defaultVisibleRows)\n const [height, setHeight] = useState<number | undefined>()\n const [rowHeight, setRowHeight] = useState<number | undefined>()\n\n const formattedHeight = useMemo(() => (height !== undefined ? `${height}${heightFormat}` : undefined), [height, heightFormat])\n\n useEffect(() => {\n setVisibleRows(defaultVisibleRows)\n }, [defaultVisibleRows])\n\n useEffect(() => {\n if (rowHeight !== undefined && visibleRows !== undefined) {\n setHeight(rowHeight * (visibleRows + additionalRows))\n }\n }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])\n\n return (\n <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ACFpE,SAAS,WAAW,SAAS,gBAAgB;AAkCzC;AAvBG,IAAM,sBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA,eAAe;AACjB,MAAM;AACJ,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,kBAAkB;AACjE,QAAM,CAAC,QAAQ,SAAS,IAAI,SAA6B;AACzD,QAAM,CAAC,WAAW,YAAY,IAAI,SAA6B;AAE/D,QAAM,kBAAkB,QAAQ,MAAO,WAAW,SAAY,GAAG,MAAM,GAAG,YAAY,KAAK,QAAY,CAAC,QAAQ,YAAY,CAAC;AAE7H,YAAU,MAAM;AACd,mBAAe,kBAAkB;AAAA,EACnC,GAAG,CAAC,kBAAkB,CAAC;AAEvB,YAAU,MAAM;AACd,QAAI,cAAc,UAAa,gBAAgB,QAAW;AACxD,gBAAU,aAAa,cAAc,eAAe;AAAA,IACtD;AAAA,EACF,GAAG,CAAC,oBAAoB,WAAW,aAAa,cAAc,CAAC;AAE/D,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,EAAE,QAAQ,iBAAiB,UAAU,MAAM,WAAW,cAAc,gBAAgB,YAAY,GACjI,UACH;AAEJ;;;ACxCA,SAAS,oBAAoB;AAItB,IAAM,iBAAiB,CAAC,WAAW,UAAU,aAAa,oBAAoB,eAAe,QAAQ;","names":[]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/context/TableHeight/use.tsx
|
|
21
|
-
var use_exports = {};
|
|
22
|
-
__export(use_exports, {
|
|
23
|
-
useTableHeight: () => useTableHeight
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(use_exports);
|
|
26
|
-
var import_react_shared2 = require("@xyo-network/react-shared");
|
|
27
|
-
|
|
28
|
-
// src/context/TableHeight/Context.ts
|
|
29
|
-
var import_react_shared = require("@xyo-network/react-shared");
|
|
30
|
-
var TableHeightContext = (0, import_react_shared.createContextEx)();
|
|
31
|
-
|
|
32
|
-
// src/context/TableHeight/use.tsx
|
|
33
|
-
var useTableHeight = (required = false) => (0, import_react_shared2.useContextEx)(TableHeightContext, "TableHeight", required);
|
|
34
|
-
//# sourceMappingURL=use.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/context/TableHeight/use.tsx","../../../../src/context/TableHeight/Context.ts"],"sourcesContent":["import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightState } from './State'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,uBAA6B;;;ACA7B,0BAAgC;AAIzB,IAAM,yBAAqB,qCAAkC;;;ADA7D,IAAM,iBAAiB,CAAC,WAAW,cAAU,mCAAa,oBAAoB,eAAe,QAAQ;","names":["import_react_shared"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// src/context/TableHeight/use.tsx
|
|
2
|
-
import { useContextEx } from "@xyo-network/react-shared";
|
|
3
|
-
|
|
4
|
-
// src/context/TableHeight/Context.ts
|
|
5
|
-
import { createContextEx } from "@xyo-network/react-shared";
|
|
6
|
-
var TableHeightContext = createContextEx();
|
|
7
|
-
|
|
8
|
-
// src/context/TableHeight/use.tsx
|
|
9
|
-
var useTableHeight = (required = false) => useContextEx(TableHeightContext, "TableHeight", required);
|
|
10
|
-
export {
|
|
11
|
-
useTableHeight
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=use.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/context/TableHeight/use.tsx","../../../../src/context/TableHeight/Context.ts"],"sourcesContent":["import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightState } from './State'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n"],"mappings":";AAAA,SAAS,oBAAoB;;;ACA7B,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ADA7D,IAAM,iBAAiB,CAAC,WAAW,UAAU,aAAa,oBAAoB,eAAe,QAAQ;","names":[]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/context/index.ts
|
|
21
|
-
var context_exports = {};
|
|
22
|
-
__export(context_exports, {
|
|
23
|
-
TableHeightContext: () => TableHeightContext,
|
|
24
|
-
TableHeightProvider: () => TableHeightProvider,
|
|
25
|
-
useTableHeight: () => useTableHeight
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(context_exports);
|
|
28
|
-
|
|
29
|
-
// src/context/TableHeight/Context.ts
|
|
30
|
-
var import_react_shared = require("@xyo-network/react-shared");
|
|
31
|
-
var TableHeightContext = (0, import_react_shared.createContextEx)();
|
|
32
|
-
|
|
33
|
-
// src/context/TableHeight/Provider.tsx
|
|
34
|
-
var import_react = require("react");
|
|
35
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var TableHeightProvider = ({
|
|
37
|
-
children,
|
|
38
|
-
additionalRows = 0,
|
|
39
|
-
defaultVisibleRows,
|
|
40
|
-
heightFormat = "px"
|
|
41
|
-
}) => {
|
|
42
|
-
const [visibleRows, setVisibleRows] = (0, import_react.useState)(defaultVisibleRows);
|
|
43
|
-
const [height, setHeight] = (0, import_react.useState)();
|
|
44
|
-
const [rowHeight, setRowHeight] = (0, import_react.useState)();
|
|
45
|
-
const formattedHeight = (0, import_react.useMemo)(() => height !== void 0 ? `${height}${heightFormat}` : void 0, [height, heightFormat]);
|
|
46
|
-
(0, import_react.useEffect)(() => {
|
|
47
|
-
setVisibleRows(defaultVisibleRows);
|
|
48
|
-
}, [defaultVisibleRows]);
|
|
49
|
-
(0, import_react.useEffect)(() => {
|
|
50
|
-
if (rowHeight !== void 0 && visibleRows !== void 0) {
|
|
51
|
-
setHeight(rowHeight * (visibleRows + additionalRows));
|
|
52
|
-
}
|
|
53
|
-
}, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
|
|
54
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// src/context/TableHeight/use.tsx
|
|
58
|
-
var import_react_shared2 = require("@xyo-network/react-shared");
|
|
59
|
-
var useTableHeight = (required = false) => (0, import_react_shared2.useContextEx)(TableHeightContext, "TableHeight", required);
|
|
60
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/context/index.ts","../../../src/context/TableHeight/Context.ts","../../../src/context/TableHeight/Provider.tsx","../../../src/context/TableHeight/use.tsx"],"sourcesContent":["export * from './TableHeight'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightState } from './State'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context'\n\nexport interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {\n /** @field Account for optional header and footer rows */\n additionalRows?: number\n defaultVisibleRows?: number\n heightFormat?: string\n}\n\nexport const TableHeightProvider: React.FC<TableHeightProviderProps> = ({\n children,\n additionalRows = 0,\n defaultVisibleRows,\n heightFormat = 'px',\n}) => {\n const [visibleRows, setVisibleRows] = useState(defaultVisibleRows)\n const [height, setHeight] = useState<number | undefined>()\n const [rowHeight, setRowHeight] = useState<number | undefined>()\n\n const formattedHeight = useMemo(() => (height !== undefined ? `${height}${heightFormat}` : undefined), [height, heightFormat])\n\n useEffect(() => {\n setVisibleRows(defaultVisibleRows)\n }, [defaultVisibleRows])\n\n useEffect(() => {\n if (rowHeight !== undefined && visibleRows !== undefined) {\n setHeight(rowHeight * (visibleRows + additionalRows))\n }\n }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])\n\n return (\n <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAAgC;AAIzB,IAAM,yBAAqB,qCAAkC;;;ACFpE,mBAA6C;AAkCzC;AAvBG,IAAM,sBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA,eAAe;AACjB,MAAM;AACJ,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,kBAAkB;AACjE,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAA6B;AACzD,QAAM,CAAC,WAAW,YAAY,QAAI,uBAA6B;AAE/D,QAAM,sBAAkB,sBAAQ,MAAO,WAAW,SAAY,GAAG,MAAM,GAAG,YAAY,KAAK,QAAY,CAAC,QAAQ,YAAY,CAAC;AAE7H,8BAAU,MAAM;AACd,mBAAe,kBAAkB;AAAA,EACnC,GAAG,CAAC,kBAAkB,CAAC;AAEvB,8BAAU,MAAM;AACd,QAAI,cAAc,UAAa,gBAAgB,QAAW;AACxD,gBAAU,aAAa,cAAc,eAAe;AAAA,IACtD;AAAA,EACF,GAAG,CAAC,oBAAoB,WAAW,aAAa,cAAc,CAAC;AAE/D,SACE,4CAAC,mBAAmB,UAAnB,EAA4B,OAAO,EAAE,QAAQ,iBAAiB,UAAU,MAAM,WAAW,cAAc,gBAAgB,YAAY,GACjI,UACH;AAEJ;;;ACxCA,IAAAA,uBAA6B;AAItB,IAAM,iBAAiB,CAAC,WAAW,cAAU,mCAAa,oBAAoB,eAAe,QAAQ;","names":["import_react_shared"]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// src/context/TableHeight/Context.ts
|
|
2
|
-
import { createContextEx } from "@xyo-network/react-shared";
|
|
3
|
-
var TableHeightContext = createContextEx();
|
|
4
|
-
|
|
5
|
-
// src/context/TableHeight/Provider.tsx
|
|
6
|
-
import { useEffect, useMemo, useState } from "react";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
var TableHeightProvider = ({
|
|
9
|
-
children,
|
|
10
|
-
additionalRows = 0,
|
|
11
|
-
defaultVisibleRows,
|
|
12
|
-
heightFormat = "px"
|
|
13
|
-
}) => {
|
|
14
|
-
const [visibleRows, setVisibleRows] = useState(defaultVisibleRows);
|
|
15
|
-
const [height, setHeight] = useState();
|
|
16
|
-
const [rowHeight, setRowHeight] = useState();
|
|
17
|
-
const formattedHeight = useMemo(() => height !== void 0 ? `${height}${heightFormat}` : void 0, [height, heightFormat]);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
setVisibleRows(defaultVisibleRows);
|
|
20
|
-
}, [defaultVisibleRows]);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (rowHeight !== void 0 && visibleRows !== void 0) {
|
|
23
|
-
setHeight(rowHeight * (visibleRows + additionalRows));
|
|
24
|
-
}
|
|
25
|
-
}, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
|
|
26
|
-
return /* @__PURE__ */ jsx(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// src/context/TableHeight/use.tsx
|
|
30
|
-
import { useContextEx } from "@xyo-network/react-shared";
|
|
31
|
-
var useTableHeight = (required = false) => useContextEx(TableHeightContext, "TableHeight", required);
|
|
32
|
-
export {
|
|
33
|
-
TableHeightContext,
|
|
34
|
-
TableHeightProvider,
|
|
35
|
-
useTableHeight
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/context/TableHeight/Context.ts","../../../src/context/TableHeight/Provider.tsx","../../../src/context/TableHeight/use.tsx"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightState } from './State'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context'\n\nexport interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {\n /** @field Account for optional header and footer rows */\n additionalRows?: number\n defaultVisibleRows?: number\n heightFormat?: string\n}\n\nexport const TableHeightProvider: React.FC<TableHeightProviderProps> = ({\n children,\n additionalRows = 0,\n defaultVisibleRows,\n heightFormat = 'px',\n}) => {\n const [visibleRows, setVisibleRows] = useState(defaultVisibleRows)\n const [height, setHeight] = useState<number | undefined>()\n const [rowHeight, setRowHeight] = useState<number | undefined>()\n\n const formattedHeight = useMemo(() => (height !== undefined ? `${height}${heightFormat}` : undefined), [height, heightFormat])\n\n useEffect(() => {\n setVisibleRows(defaultVisibleRows)\n }, [defaultVisibleRows])\n\n useEffect(() => {\n if (rowHeight !== undefined && visibleRows !== undefined) {\n setHeight(rowHeight * (visibleRows + additionalRows))\n }\n }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])\n\n return (\n <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ACFpE,SAAS,WAAW,SAAS,gBAAgB;AAkCzC;AAvBG,IAAM,sBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA,eAAe;AACjB,MAAM;AACJ,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,kBAAkB;AACjE,QAAM,CAAC,QAAQ,SAAS,IAAI,SAA6B;AACzD,QAAM,CAAC,WAAW,YAAY,IAAI,SAA6B;AAE/D,QAAM,kBAAkB,QAAQ,MAAO,WAAW,SAAY,GAAG,MAAM,GAAG,YAAY,KAAK,QAAY,CAAC,QAAQ,YAAY,CAAC;AAE7H,YAAU,MAAM;AACd,mBAAe,kBAAkB;AAAA,EACnC,GAAG,CAAC,kBAAkB,CAAC;AAEvB,YAAU,MAAM;AACd,QAAI,cAAc,UAAa,gBAAgB,QAAW;AACxD,gBAAU,aAAa,cAAc,eAAe;AAAA,IACtD;AAAA,EACF,GAAG,CAAC,oBAAoB,WAAW,aAAa,cAAc,CAAC;AAE/D,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,EAAE,QAAQ,iBAAiB,UAAU,MAAM,WAAW,cAAc,gBAAgB,YAAY,GACjI,UACH;AAEJ;;;ACxCA,SAAS,oBAAoB;AAItB,IAAM,iBAAiB,CAAC,WAAW,UAAU,aAAa,oBAAoB,eAAe,QAAQ;","names":[]}
|