@economic/taco 2.26.4 → 2.26.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +2 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js +25 -5
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -1
- package/dist/primitives/Table/useTableManager/features/useTableServerLoading.d.ts +1 -0
- package/dist/taco.cjs.development.js +29 -8
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
@@ -27,8 +27,8 @@ function Row(props) {
|
|
27
27
|
}
|
28
28
|
}, [tableMeta.editing.isEditing, isActiveRow]);
|
29
29
|
const attributes = {
|
30
|
-
'data-row-editing-invalid': tableMeta.editing.hasRowErrors(row.id) ? !tableMeta.editing.hasRowErrorsSeen(row.id) ? 'unseen' : true : undefined,
|
31
|
-
'data-row-editing-status': tableMeta.editing.getRowSaveStatus(row.id),
|
30
|
+
'data-row-editing-invalid': tableMeta.editing.isEnabled && tableMeta.editing.hasRowErrors(row.id) ? !tableMeta.editing.hasRowErrorsSeen(row.id) ? 'unseen' : true : undefined,
|
31
|
+
'data-row-editing-status': tableMeta.editing.isEnabled && tableMeta.editing.getRowSaveStatus(row.id) ? tableMeta.editing.getRowSaveStatus(row.id) : undefined,
|
32
32
|
onFocus: handleFocus
|
33
33
|
};
|
34
34
|
return /*#__PURE__*/React__default.createElement(DisplayRow, Object.assign({}, props, attributes), tableMeta.editing.getRowSaveStatus(row.id) ? /*#__PURE__*/React__default.createElement(SaveStatus, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { DisplayRow, DisplayRowProps } from '../../../../primitives/Table/Core/components/Row/BuiltIns/DisplayRow';\nimport { SaveStatus } from './Editing/SaveStatus';\nimport { useAugmentedFocusManager } from '../../../../primitives/Table/Core/components/Body/util';\n\nexport function Row<TType = unknown>(props: DisplayRowProps<TType>) {\n const { row, index, table } = props;\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;\n\n React.useEffect(() => {\n if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {\n focusManager.focusFirst();\n }\n }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLTableRowElement>) => {\n if (tableMeta.editing.isEditing && isActiveRow) {\n const cellIndex = Number(event.target.closest('td')?.getAttribute('data-cell-index') ?? undefined);\n\n if (!isNaN(cellIndex) && tableMeta.editing.lastFocusedCellIndex !== cellIndex) {\n tableMeta.editing.setLastFocusedCellIndex(Number(cellIndex));\n }\n }\n },\n [tableMeta.editing.isEditing, isActiveRow]\n );\n\n const attributes = {\n 'data-row-editing-invalid'
|
1
|
+
{"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { DisplayRow, DisplayRowProps } from '../../../../primitives/Table/Core/components/Row/BuiltIns/DisplayRow';\nimport { SaveStatus } from './Editing/SaveStatus';\nimport { useAugmentedFocusManager } from '../../../../primitives/Table/Core/components/Body/util';\n\nexport function Row<TType = unknown>(props: DisplayRowProps<TType>) {\n const { row, index, table } = props;\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;\n\n React.useEffect(() => {\n if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {\n focusManager.focusFirst();\n }\n }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLTableRowElement>) => {\n if (tableMeta.editing.isEditing && isActiveRow) {\n const cellIndex = Number(event.target.closest('td')?.getAttribute('data-cell-index') ?? undefined);\n\n if (!isNaN(cellIndex) && tableMeta.editing.lastFocusedCellIndex !== cellIndex) {\n tableMeta.editing.setLastFocusedCellIndex(Number(cellIndex));\n }\n }\n },\n [tableMeta.editing.isEditing, isActiveRow]\n );\n\n const attributes = {\n 'data-row-editing-invalid':\n tableMeta.editing.isEnabled && tableMeta.editing.hasRowErrors(row.id)\n ? !tableMeta.editing.hasRowErrorsSeen(row.id)\n ? 'unseen'\n : true\n : undefined,\n 'data-row-editing-status':\n tableMeta.editing.isEnabled && tableMeta.editing.getRowSaveStatus(row.id)\n ? tableMeta.editing.getRowSaveStatus(row.id)\n : undefined,\n onFocus: handleFocus,\n };\n\n return (\n <DisplayRow<TType> {...props} {...attributes}>\n {tableMeta.editing.getRowSaveStatus(row.id) ? <SaveStatus rowId={row.id} table={table} /> : null}\n </DisplayRow>\n );\n}\n"],"names":["Row","props","row","index","table","focusManager","useAugmentedFocusManager","tableMeta","options","meta","isActiveRow","rowActive","rowActiveIndex","React","useEffect","editing","isEditing","lastFocusedCellIndex","undefined","focusFirst","handleFocus","useCallback","event","_event$target$closest","_event$target$closest2","cellIndex","Number","target","closest","getAttribute","isNaN","setLastFocusedCellIndex","attributes","isEnabled","hasRowErrors","id","hasRowErrorsSeen","getRowSaveStatus","onFocus","DisplayRow","SaveStatus","rowId"],"mappings":";;;;;SAMgBA,GAAGA,CAAkBC,KAA6B;EAC9D,MAAM;I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,0BAA0B,EACtBzB,SAAS,CAACQ,OAAO,CAACkB,SAAS,IAAI1B,SAAS,CAACQ,OAAO,CAACmB,YAAY,CAAChC,GAAG,CAACiC,EAAE,CAAC,GAC/D,CAAC5B,SAAS,CAACQ,OAAO,CAACqB,gBAAgB,CAAClC,GAAG,CAACiC,EAAE,CAAC,GACvC,QAAQ,GACR,IAAI,GACRjB,SAAS;IACnB,yBAAyB,EACrBX,SAAS,CAACQ,OAAO,CAACkB,SAAS,IAAI1B,SAAS,CAACQ,OAAO,CAACsB,gBAAgB,CAACnC,GAAG,CAACiC,EAAE,CAAC,GACnE5B,SAAS,CAACQ,OAAO,CAACsB,gBAAgB,CAACnC,GAAG,CAACiC,EAAE,CAAC,GAC1CjB,SAAS;IACnBoB,OAAO,EAAElB;GACZ;EAED,oBACIP,6BAAC0B,UAAU,oBAAYtC,KAAK,EAAM+B,UAAU,GACvCzB,SAAS,CAACQ,OAAO,CAACsB,gBAAgB,CAACnC,GAAG,CAACiC,EAAE,CAAC,gBAAGtB,6BAAC2B,UAAU;IAACC,KAAK,EAAEvC,GAAG,CAACiC,EAAE;IAAE/B,KAAK,EAAEA;IAAS,GAAG,IAAI,CACvF;AAErB;;;;"}
|
@@ -24,11 +24,12 @@ function TableGrid(props) {
|
|
24
24
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("style", null, table.stylesheet), /*#__PURE__*/React__default.createElement(FocusScope, null, /*#__PURE__*/React__default.createElement("table", Object.assign({}, attributes, {
|
25
25
|
id: table.id,
|
26
26
|
"data-table-font-size": table.meta.fontSize.size,
|
27
|
+
"data-table-grouped": !!((_table$state$grouping = table.state.grouping) !== null && _table$state$grouping !== void 0 && _table$state$grouping.length),
|
27
28
|
"data-table-horizontally-scrolled": table.meta.columnFreezing.isHorizontallyScrolled ? true : undefined,
|
29
|
+
"data-table-status": table.meta.server.isEnabled ? table.meta.server.isReady ? 'ready' : undefined : 'ready',
|
28
30
|
"data-table-pause-hover": table.meta.rowActive.isHoverStatePaused ? true : undefined,
|
29
31
|
"data-table-resizing": table.state.columnSizingInfo.isResizingColumn ? true : undefined,
|
30
32
|
"data-table-row-height": table.meta.rowHeight.height,
|
31
|
-
"data-table-grouped": !!((_table$state$grouping = table.state.grouping) !== null && _table$state$grouping !== void 0 && _table$state$grouping.length),
|
32
33
|
onFocus: handleFocus,
|
33
34
|
onScroll: table.meta.columnFreezing.handleScroll,
|
34
35
|
ref: table.ref,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Table.js","sources":["../../../../../../../../src/primitives/Table/Core/Table.tsx"],"sourcesContent":["import React from 'react';\nimport { FocusScope } from '@react-aria/focus';\nimport { Header } from './components/Header/Header';\nimport { Body } from './components/Body/Body';\nimport { Footer } from './components/Footer/Footer';\nimport { EmptyStateBody } from './components/Body/EmptyStateBody';\nimport { useTableReturnValue } from './useTable';\nimport { TableToolbar } from './components/Toolbar/Toolbar';\nimport './style.css';\n\ntype TableProps = {\n children: JSX.Element | Array<JSX.Element | null>;\n};\n\nexport function Table(props: TableProps) {\n return <>{props.children}</>;\n}\nTable.Toolbar = TableToolbar;\nTable.Grid = TableGrid;\n\nexport type TableGridProps<TType = unknown> = React.TableHTMLAttributes<HTMLTableElement> & {\n 'data-taco': string;\n enableHorizontalArrowKeyNavigation?: boolean;\n table: useTableReturnValue<TType>;\n};\n\nexport function TableGrid<TType = unknown>(props: TableGridProps<TType>) {\n const { enableHorizontalArrowKeyNavigation, table, ...attributes } = props;\n const handleFocus =\n table.meta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);\n }\n : undefined;\n\n return (\n <>\n <style>{table.stylesheet}</style>\n <FocusScope>\n <table\n {...attributes}\n id={table.id}\n data-table-font-size={table.meta.fontSize.size}\n data-table-horizontally-scrolled={table.meta.columnFreezing.isHorizontallyScrolled ? true : undefined}\n data-table-pause-hover={table.meta.rowActive.isHoverStatePaused ? true : undefined}\n data-table-resizing={table.state.columnSizingInfo.isResizingColumn ? true : undefined}\n data-table-row-height={table.meta.rowHeight.height}\n
|
1
|
+
{"version":3,"file":"Table.js","sources":["../../../../../../../../src/primitives/Table/Core/Table.tsx"],"sourcesContent":["import React from 'react';\nimport { FocusScope } from '@react-aria/focus';\nimport { Header } from './components/Header/Header';\nimport { Body } from './components/Body/Body';\nimport { Footer } from './components/Footer/Footer';\nimport { EmptyStateBody } from './components/Body/EmptyStateBody';\nimport { useTableReturnValue } from './useTable';\nimport { TableToolbar } from './components/Toolbar/Toolbar';\nimport './style.css';\n\ntype TableProps = {\n children: JSX.Element | Array<JSX.Element | null>;\n};\n\nexport function Table(props: TableProps) {\n return <>{props.children}</>;\n}\nTable.Toolbar = TableToolbar;\nTable.Grid = TableGrid;\n\nexport type TableGridProps<TType = unknown> = React.TableHTMLAttributes<HTMLTableElement> & {\n 'data-taco': string;\n enableHorizontalArrowKeyNavigation?: boolean;\n table: useTableReturnValue<TType>;\n};\n\nexport function TableGrid<TType = unknown>(props: TableGridProps<TType>) {\n const { enableHorizontalArrowKeyNavigation, table, ...attributes } = props;\n const handleFocus =\n table.meta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);\n }\n : undefined;\n\n return (\n <>\n <style>{table.stylesheet}</style>\n <FocusScope>\n <table\n {...attributes}\n id={table.id}\n data-table-font-size={table.meta.fontSize.size}\n data-table-grouped={!!table.state.grouping?.length}\n data-table-horizontally-scrolled={table.meta.columnFreezing.isHorizontallyScrolled ? true : undefined}\n data-table-status={table.meta.server.isEnabled ? (table.meta.server.isReady ? 'ready' : undefined) : 'ready'}\n data-table-pause-hover={table.meta.rowActive.isHoverStatePaused ? true : undefined}\n data-table-resizing={table.state.columnSizingInfo.isResizingColumn ? true : undefined}\n data-table-row-height={table.meta.rowHeight.height}\n onFocus={handleFocus}\n onScroll={table.meta.columnFreezing.handleScroll}\n ref={table.ref}\n style={table.style}\n tabIndex={-1}>\n <thead>\n {table.instance.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map(props => (\n <Header key={props.id} header={props} scrollToIndex={table.renderer.scrollToIndex} />\n ))}\n </tr>\n ))}\n </thead>\n {table.instance.getRowModel().rows.length ? (\n <>\n <Body\n enableHorizontalArrowKeyNavigation={enableHorizontalArrowKeyNavigation}\n table={table.instance}\n style={table.renderer.style}>\n {table.renderer.rows}\n </Body>\n {table.meta.footer.isEnabled ? (\n <tfoot>\n <tr>{table.instance.getFooterGroups()[0].headers.map(Footer)}</tr>\n </tfoot>\n ) : null}\n </>\n ) : (\n <EmptyStateBody emptyState={table.props.emptyState} />\n )}\n </table>\n </FocusScope>\n </>\n );\n}\n"],"names":["Table","props","React","children","Toolbar","TableToolbar","Grid","TableGrid","enableHorizontalArrowKeyNavigation","table","attributes","handleFocus","meta","rowActive","rowActiveIndex","undefined","event","length","renderer","scrollToIndex","stylesheet","FocusScope","id","fontSize","size","_table$state$grouping","state","grouping","columnFreezing","isHorizontallyScrolled","server","isEnabled","isReady","isHoverStatePaused","columnSizingInfo","isResizingColumn","rowHeight","height","onFocus","onScroll","handleScroll","ref","style","tabIndex","instance","getHeaderGroups","map","headerGroup","key","headers","Header","header","getRowModel","rows","Body","footer","getFooterGroups","Footer","EmptyStateBody","emptyState"],"mappings":";;;;;;;;SAcgBA,KAAKA,CAACC,KAAiB;EACnC,oBAAOC,4DAAGD,KAAK,CAACE,QAAQ,CAAI;AAChC;AACAH,KAAK,CAACI,OAAO,GAAGC,YAAY;AAC5BL,KAAK,CAACM,IAAI,GAAGC,SAAS;SAQNA,SAASA,CAAkBN,KAA4B;;EACnE,MAAM;IAAEO,kCAAkC;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGT,KAAK;EAC1E,MAAMU,WAAW,GACbF,KAAK,CAACG,IAAI,CAACC,SAAS,CAACC,cAAc,KAAKC,SAAS,G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CAACzB;KAChByB,WAAW,CAACE,OAAO,CAACH,GAAG,CAAC7C,KAAK,mBAC1BC,6BAACgD,MAAM;IAACF,GAAG,EAAE/C,KAAK,CAACqB,EAAE;IAAE6B,MAAM,EAAElD,KAAK;IAAEkB,aAAa,EAAEV,KAAK,CAACS,QAAQ,CAACC;IAAiB,CACxF,CAAC,CACD,CACR,CAAC,CACE,EACPV,KAAK,CAACmC,QAAQ,CAACQ,WAAW,EAAE,CAACC,IAAI,CAACpC,MAAM,kBACrCf,yEACIA,6BAACoD,IAAI;IACD9C,kCAAkC,EAAEA,kCAAkC;IACtEC,KAAK,EAAEA,KAAK,CAACmC,QAAQ;IACrBF,KAAK,EAAEjC,KAAK,CAACS,QAAQ,CAACwB;KACrBjC,KAAK,CAACS,QAAQ,CAACmC,IAAI,CACjB,EACN5C,KAAK,CAACG,IAAI,CAAC2C,MAAM,CAACxB,SAAS,kBACxB7B,yDACIA,yCAAKO,KAAK,CAACmC,QAAQ,CAACY,eAAe,EAAE,CAAC,CAAC,CAAC,CAACP,OAAO,CAACH,GAAG,CAACW,MAAM,CAAC,CAAM,CAC9D,IACR,IAAI,CACT,mBAEHvD,6BAACwD,cAAc;IAACC,UAAU,EAAElD,KAAK,CAACR,KAAK,CAAC0D;IAAc,CACzD,CACG,CACC,CACd;AAEX;;;;"}
|
@@ -4,34 +4,53 @@ import { DEFAULT_PAGE_SIZE } from '../../useTableDataLoader.js';
|
|
4
4
|
|
5
5
|
function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE) {
|
6
6
|
const isEnabled = !!loadPage && !!loadAll;
|
7
|
+
const [isReady, setReady] = React__default.useState(false);
|
7
8
|
const [loadAllStatus, setLoadedStatus] = React__default.useState(TableServerLoadAllState.Incomplete);
|
9
|
+
let _loadPage;
|
8
10
|
let _loadAll;
|
9
11
|
let _loadAllIfNeeded;
|
12
|
+
if (typeof loadPage === 'function') {
|
13
|
+
_loadPage = function (...args) {
|
14
|
+
try {
|
15
|
+
const _temp = function () {
|
16
|
+
if (typeof loadPage === 'function') {
|
17
|
+
return Promise.resolve(loadPage(...args)).then(function () {
|
18
|
+
setReady(true);
|
19
|
+
});
|
20
|
+
}
|
21
|
+
}();
|
22
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
23
|
+
} catch (e) {
|
24
|
+
return Promise.reject(e);
|
25
|
+
}
|
26
|
+
};
|
27
|
+
}
|
10
28
|
if (typeof loadAll === 'function') {
|
11
29
|
_loadAll = function (...args) {
|
12
30
|
try {
|
13
|
-
const
|
31
|
+
const _temp2 = function () {
|
14
32
|
if (typeof loadAll === 'function') {
|
15
33
|
setLoadedStatus(TableServerLoadAllState.Loading);
|
16
34
|
return Promise.resolve(loadAll(...args)).then(function () {
|
17
35
|
setLoadedStatus(TableServerLoadAllState.Completed);
|
36
|
+
setReady(true);
|
18
37
|
});
|
19
38
|
}
|
20
39
|
}();
|
21
|
-
return Promise.resolve(
|
40
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
22
41
|
} catch (e) {
|
23
42
|
return Promise.reject(e);
|
24
43
|
}
|
25
44
|
};
|
26
45
|
_loadAllIfNeeded = function (...args) {
|
27
46
|
try {
|
28
|
-
const
|
47
|
+
const _temp3 = function () {
|
29
48
|
if (loadAllStatus === TableServerLoadAllState.Incomplete) {
|
30
49
|
var _loadAll2;
|
31
50
|
return Promise.resolve((_loadAll2 = _loadAll) === null || _loadAll2 === void 0 ? void 0 : _loadAll2(...args)).then(function () {});
|
32
51
|
}
|
33
52
|
}();
|
34
|
-
return Promise.resolve(
|
53
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
|
35
54
|
} catch (e) {
|
36
55
|
return Promise.reject(e);
|
37
56
|
}
|
@@ -39,7 +58,8 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
39
58
|
}
|
40
59
|
return {
|
41
60
|
isEnabled,
|
42
|
-
|
61
|
+
isReady,
|
62
|
+
loadPage: _loadPage,
|
43
63
|
loadAll: _loadAll,
|
44
64
|
loadAllIfNeeded: _loadAllIfNeeded,
|
45
65
|
loadAllStatus,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTableServerLoading.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/features/useTableServerLoading.ts"],"sourcesContent":["import React from 'react';\nimport { TableServerLoadAllHandler, TableServerLoadAllState, TableServerLoadPageHandler } from '../../types';\nimport { DEFAULT_PAGE_SIZE } from '../../useTableDataLoader';\n\nexport function useTableServerLoading(\n loadPage?: TableServerLoadPageHandler,\n loadAll?: TableServerLoadAllHandler,\n pageSize = DEFAULT_PAGE_SIZE\n) {\n const isEnabled = !!loadPage && !!loadAll;\n const [loadAllStatus, setLoadedStatus] = React.useState<TableServerLoadAllState>(TableServerLoadAllState.Incomplete);\n\n let _loadAll: TableServerLoadAllHandler | undefined;\n let _loadAllIfNeeded: TableServerLoadAllHandler | undefined;\n\n if (typeof loadAll === 'function') {\n _loadAll = async (...args) => {\n if (typeof loadAll === 'function') {\n setLoadedStatus(TableServerLoadAllState.Loading);\n await loadAll(...args);\n setLoadedStatus(TableServerLoadAllState.Completed);\n }\n };\n\n _loadAllIfNeeded = async (...args) => {\n if (loadAllStatus === TableServerLoadAllState.Incomplete) {\n await _loadAll?.(...args);\n }\n };\n }\n\n return {\n isEnabled,\n loadPage,\n loadAll: _loadAll,\n loadAllIfNeeded: _loadAllIfNeeded,\n loadAllStatus,\n pageSize,\n };\n}\n"],"names":["useTableServerLoading","loadPage","loadAll","pageSize","DEFAULT_PAGE_SIZE","isEnabled","
|
1
|
+
{"version":3,"file":"useTableServerLoading.js","sources":["../../../../../../../../../src/primitives/Table/useTableManager/features/useTableServerLoading.ts"],"sourcesContent":["import React from 'react';\nimport { TableServerLoadAllHandler, TableServerLoadAllState, TableServerLoadPageHandler } from '../../types';\nimport { DEFAULT_PAGE_SIZE } from '../../useTableDataLoader';\n\nexport function useTableServerLoading(\n loadPage?: TableServerLoadPageHandler,\n loadAll?: TableServerLoadAllHandler,\n pageSize = DEFAULT_PAGE_SIZE\n) {\n const isEnabled = !!loadPage && !!loadAll;\n const [isReady, setReady] = React.useState(false);\n const [loadAllStatus, setLoadedStatus] = React.useState<TableServerLoadAllState>(TableServerLoadAllState.Incomplete);\n\n let _loadPage: TableServerLoadPageHandler | undefined;\n let _loadAll: TableServerLoadAllHandler | undefined;\n let _loadAllIfNeeded: TableServerLoadAllHandler | undefined;\n\n if (typeof loadPage === 'function') {\n _loadPage = async (...args) => {\n if (typeof loadPage === 'function') {\n await loadPage(...args);\n setReady(true);\n }\n };\n }\n\n if (typeof loadAll === 'function') {\n _loadAll = async (...args) => {\n if (typeof loadAll === 'function') {\n setLoadedStatus(TableServerLoadAllState.Loading);\n await loadAll(...args);\n setLoadedStatus(TableServerLoadAllState.Completed);\n setReady(true);\n }\n };\n\n _loadAllIfNeeded = async (...args) => {\n if (loadAllStatus === TableServerLoadAllState.Incomplete) {\n await _loadAll?.(...args);\n }\n };\n }\n\n return {\n isEnabled,\n isReady,\n loadPage: _loadPage,\n loadAll: _loadAll,\n loadAllIfNeeded: _loadAllIfNeeded,\n loadAllStatus,\n pageSize,\n };\n}\n"],"names":["useTableServerLoading","loadPage","loadAll","pageSize","DEFAULT_PAGE_SIZE","isEnabled","isReady","setReady","React","useState","loadAllStatus","setLoadedStatus","TableServerLoadAllState","Incomplete","_loadPage","_loadAll","_loadAllIfNeeded","args","Promise","resolve","then","_temp","e","reject","Loading","Completed","_temp2","_loadAll2","_temp3","loadAllIfNeeded"],"mappings":";;;;SAIgBA,qBAAqBA,CACjCC,QAAqC,EACrCC,OAAmC,EACnCC,QAAQ,GAAGC,iBAAiB;EAE5B,MAAMC,SAAS,GAAG,CAAC,CAACJ,QAAQ,IAAI,CAAC,CAACC,OAAO;EACzC,MAAM,CAACI,OAAO,EAAEC,QAAQ,CAAC,GAAGC,cAAK,CAACC,QAAQ,C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OAAA,EAAAQ,SAAA,GAC9CZ,QAAQ,cAAAY,SAAA,uBAARA,SAAA,CAAW,GAAGV,IAAI,CAAC,EAAAG,IAAA;;;QAAA,OAAAF,OAAA,CAAAC,OAAA,CAAAS,MAAA,IAAAA,MAAA,CAAAR,IAAA,GAAAQ,MAAA,CAAAR,IAAA;OAEhC,QAAAE,CAAA;QAAA,OAAAJ,OAAA,CAAAK,MAAA,CAAAD,CAAA;;;;EAGL,OAAO;IACHjB,SAAS;IACTC,OAAO;IACPL,QAAQ,EAAEa,SAAS;IACnBZ,OAAO,EAAEa,QAAQ;IACjBc,eAAe,EAAEb,gBAAgB;IACjCN,aAAa;IACbP;GACH;AACL;;;;"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { TableServerLoadAllHandler, TableServerLoadAllState, TableServerLoadPageHandler } from '../../types';
|
2
2
|
export declare function useTableServerLoading(loadPage?: TableServerLoadPageHandler, loadAll?: TableServerLoadAllHandler, pageSize?: number): {
|
3
3
|
isEnabled: boolean;
|
4
|
+
isReady: boolean;
|
4
5
|
loadPage: TableServerLoadPageHandler | undefined;
|
5
6
|
loadAll: TableServerLoadAllHandler | undefined;
|
6
7
|
loadAllIfNeeded: TableServerLoadAllHandler | undefined;
|
@@ -10413,34 +10413,53 @@ function useTableDataLoader(fetch, fetchAll, options = {
|
|
10413
10413
|
|
10414
10414
|
function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE) {
|
10415
10415
|
const isEnabled = !!loadPage && !!loadAll;
|
10416
|
+
const [isReady, setReady] = React__default.useState(false);
|
10416
10417
|
const [loadAllStatus, setLoadedStatus] = React__default.useState(exports.TableServerLoadAllState.Incomplete);
|
10418
|
+
let _loadPage;
|
10417
10419
|
let _loadAll;
|
10418
10420
|
let _loadAllIfNeeded;
|
10421
|
+
if (typeof loadPage === 'function') {
|
10422
|
+
_loadPage = function (...args) {
|
10423
|
+
try {
|
10424
|
+
const _temp = function () {
|
10425
|
+
if (typeof loadPage === 'function') {
|
10426
|
+
return Promise.resolve(loadPage(...args)).then(function () {
|
10427
|
+
setReady(true);
|
10428
|
+
});
|
10429
|
+
}
|
10430
|
+
}();
|
10431
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
10432
|
+
} catch (e) {
|
10433
|
+
return Promise.reject(e);
|
10434
|
+
}
|
10435
|
+
};
|
10436
|
+
}
|
10419
10437
|
if (typeof loadAll === 'function') {
|
10420
10438
|
_loadAll = function (...args) {
|
10421
10439
|
try {
|
10422
|
-
const
|
10440
|
+
const _temp2 = function () {
|
10423
10441
|
if (typeof loadAll === 'function') {
|
10424
10442
|
setLoadedStatus(exports.TableServerLoadAllState.Loading);
|
10425
10443
|
return Promise.resolve(loadAll(...args)).then(function () {
|
10426
10444
|
setLoadedStatus(exports.TableServerLoadAllState.Completed);
|
10445
|
+
setReady(true);
|
10427
10446
|
});
|
10428
10447
|
}
|
10429
10448
|
}();
|
10430
|
-
return Promise.resolve(
|
10449
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
10431
10450
|
} catch (e) {
|
10432
10451
|
return Promise.reject(e);
|
10433
10452
|
}
|
10434
10453
|
};
|
10435
10454
|
_loadAllIfNeeded = function (...args) {
|
10436
10455
|
try {
|
10437
|
-
const
|
10456
|
+
const _temp3 = function () {
|
10438
10457
|
if (loadAllStatus === exports.TableServerLoadAllState.Incomplete) {
|
10439
10458
|
var _loadAll2;
|
10440
10459
|
return Promise.resolve((_loadAll2 = _loadAll) === null || _loadAll2 === void 0 ? void 0 : _loadAll2(...args)).then(function () {});
|
10441
10460
|
}
|
10442
10461
|
}();
|
10443
|
-
return Promise.resolve(
|
10462
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
|
10444
10463
|
} catch (e) {
|
10445
10464
|
return Promise.reject(e);
|
10446
10465
|
}
|
@@ -10448,7 +10467,8 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
10448
10467
|
}
|
10449
10468
|
return {
|
10450
10469
|
isEnabled,
|
10451
|
-
|
10470
|
+
isReady,
|
10471
|
+
loadPage: _loadPage,
|
10452
10472
|
loadAll: _loadAll,
|
10453
10473
|
loadAllIfNeeded: _loadAllIfNeeded,
|
10454
10474
|
loadAllStatus,
|
@@ -15735,11 +15755,12 @@ function TableGrid(props) {
|
|
15735
15755
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("style", null, table.stylesheet), /*#__PURE__*/React__default.createElement(focus.FocusScope, null, /*#__PURE__*/React__default.createElement("table", Object.assign({}, attributes, {
|
15736
15756
|
id: table.id,
|
15737
15757
|
"data-table-font-size": table.meta.fontSize.size,
|
15758
|
+
"data-table-grouped": !!((_table$state$grouping = table.state.grouping) !== null && _table$state$grouping !== void 0 && _table$state$grouping.length),
|
15738
15759
|
"data-table-horizontally-scrolled": table.meta.columnFreezing.isHorizontallyScrolled ? true : undefined,
|
15760
|
+
"data-table-status": table.meta.server.isEnabled ? table.meta.server.isReady ? 'ready' : undefined : 'ready',
|
15739
15761
|
"data-table-pause-hover": table.meta.rowActive.isHoverStatePaused ? true : undefined,
|
15740
15762
|
"data-table-resizing": table.state.columnSizingInfo.isResizingColumn ? true : undefined,
|
15741
15763
|
"data-table-row-height": table.meta.rowHeight.height,
|
15742
|
-
"data-table-grouped": !!((_table$state$grouping = table.state.grouping) !== null && _table$state$grouping !== void 0 && _table$state$grouping.length),
|
15743
15764
|
onFocus: handleFocus,
|
15744
15765
|
onScroll: table.meta.columnFreezing.handleScroll,
|
15745
15766
|
ref: table.ref,
|
@@ -18275,8 +18296,8 @@ function Row$2(props) {
|
|
18275
18296
|
}
|
18276
18297
|
}, [tableMeta.editing.isEditing, isActiveRow]);
|
18277
18298
|
const attributes = {
|
18278
|
-
'data-row-editing-invalid': tableMeta.editing.hasRowErrors(row.id) ? !tableMeta.editing.hasRowErrorsSeen(row.id) ? 'unseen' : true : undefined,
|
18279
|
-
'data-row-editing-status': tableMeta.editing.getRowSaveStatus(row.id),
|
18299
|
+
'data-row-editing-invalid': tableMeta.editing.isEnabled && tableMeta.editing.hasRowErrors(row.id) ? !tableMeta.editing.hasRowErrorsSeen(row.id) ? 'unseen' : true : undefined,
|
18300
|
+
'data-row-editing-status': tableMeta.editing.isEnabled && tableMeta.editing.getRowSaveStatus(row.id) ? tableMeta.editing.getRowSaveStatus(row.id) : undefined,
|
18280
18301
|
onFocus: handleFocus
|
18281
18302
|
};
|
18282
18303
|
return /*#__PURE__*/React__default.createElement(DisplayRow, Object.assign({}, props, attributes), tableMeta.editing.getRowSaveStatus(row.id) ? /*#__PURE__*/React__default.createElement(SaveStatus, {
|