@economic/taco 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/dist/components/Table3/Table3.d.ts +1 -1
  2. package/dist/components/Table3/components/columns/internal/Actions.d.ts +1 -2
  3. package/dist/components/Table3/components/rows/Row.d.ts +1 -0
  4. package/dist/components/Table3/hooks/features/useRowActions.d.ts +5 -0
  5. package/dist/components/Table3/hooks/useTable.d.ts +2 -0
  6. package/dist/components/Table3/hooks/useTableDataLoader.d.ts +1 -2
  7. package/dist/components/Table3/types.d.ts +0 -2
  8. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +3 -1
  9. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  10. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +2 -2
  12. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +6 -15
  14. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +1 -1
  16. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +11 -2
  18. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +32 -20
  20. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowActions.js +10 -0
  22. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowActions.js.map +1 -0
  23. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +1 -1
  24. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js +2 -3
  26. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js.map +1 -1
  27. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +10 -9
  28. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/Table3/hooks/useTableDataLoader.js +0 -8
  30. package/dist/esm/packages/taco/src/components/Table3/hooks/useTableDataLoader.js.map +1 -1
  31. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js +4 -0
  32. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js.map +1 -1
  33. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  34. package/dist/taco.cjs.development.js +79 -106
  35. package/dist/taco.cjs.development.js.map +1 -1
  36. package/dist/taco.cjs.production.min.js +1 -1
  37. package/dist/taco.cjs.production.min.js.map +1 -1
  38. package/package.json +2 -2
  39. package/types.json +5429 -5459
  40. package/dist/components/Table3/hooks/listeners/useSearchStateListener.d.ts +0 -3
  41. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSearchStateListener.js +0 -51
  42. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSearchStateListener.js.map +0 -1
@@ -1,3 +0,0 @@
1
- import { Table as RTable } from '@tanstack/react-table';
2
- import { Table3SearchHandler } from '../../types';
3
- export declare function useSearchStateListener<TType = unknown>(table: RTable<TType>, onSearch?: Table3SearchHandler): void;
@@ -1,51 +0,0 @@
1
- import React__default from 'react';
2
- import { _finallyRethrows } from '../../../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
3
- import { useLazyEffect } from '../../../../hooks/useLazyEffect.js';
4
-
5
- // we use a listener, and not the internal "controlled" change handlers because we don't actually want consumers
6
- // to control the state outside the table. this listener is really here to let the consumer make a server request
7
- // and provide the server with the search state, so that it can search server side
8
- function useSearchStateListener(table, onSearch) {
9
- const tableMeta = table.options.meta;
10
- const rows = table.getRowModel().rows;
11
- const loadingRef = React__default.useRef(false);
12
- const lastUsedExcludeRef = React__default.useRef(tableMeta.search.excludeUnmatchedResults);
13
- const handleSearch = function (query, excludeUnmatchedResults) {
14
- try {
15
- const _temp4 = function () {
16
- if (tableMeta.search.isEnabled && !loadingRef.current) {
17
- function _temp3() {
18
- if (excludeUnmatchedResults && table.options.enableRowSelection) {
19
- table.resetRowSelection();
20
- }
21
- }
22
- const _temp2 = function () {
23
- if (typeof onSearch === 'function' && (excludeUnmatchedResults || lastUsedExcludeRef.current)) {
24
- const _temp = _finallyRethrows(function () {
25
- loadingRef.current = true;
26
- // if we are transitioning from true to false on exclude, then we need to "reset" by searching with no value
27
- return Promise.resolve(onSearch(!excludeUnmatchedResults && lastUsedExcludeRef.current ? undefined : query)).then(function () {});
28
- }, function (_wasThrown, _result) {
29
- loadingRef.current = false;
30
- lastUsedExcludeRef.current = excludeUnmatchedResults;
31
- if (_wasThrown) throw _result;
32
- return _result;
33
- });
34
- if (_temp && _temp.then) return _temp.then(function () {});
35
- }
36
- }();
37
- return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
38
- }
39
- }();
40
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
41
- } catch (e) {
42
- return Promise.reject(e);
43
- }
44
- };
45
- useLazyEffect(() => {
46
- handleSearch(tableMeta.search.query, tableMeta.search.excludeUnmatchedResults);
47
- }, [tableMeta.search.isEnabled, tableMeta.search.query, tableMeta.search.excludeUnmatchedResults, rows.length]);
48
- }
49
-
50
- export { useSearchStateListener };
51
- //# sourceMappingURL=useSearchStateListener.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSearchStateListener.js","sources":["../../../../../../../../../src/components/Table3/hooks/listeners/useSearchStateListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { Table3SearchHandler } from '../../types';\nimport { useLazyEffect } from '../../../../hooks/useLazyEffect';\n\n// we use a listener, and not the internal \"controlled\" change handlers because we don't actually want consumers\n// to control the state outside the table. this listener is really here to let the consumer make a server request\n// and provide the server with the search state, so that it can search server side\nexport function useSearchStateListener<TType = unknown>(table: RTable<TType>, onSearch?: Table3SearchHandler) {\n const tableMeta = table.options.meta as TableMeta<TType>;\n const rows = table.getRowModel().rows;\n const loadingRef = React.useRef(false);\n const lastUsedExcludeRef = React.useRef(tableMeta.search.excludeUnmatchedResults);\n\n const handleSearch = async (query: string | undefined, excludeUnmatchedResults: boolean) => {\n if (tableMeta.search.isEnabled && !loadingRef.current) {\n if (typeof onSearch === 'function' && (excludeUnmatchedResults || lastUsedExcludeRef.current)) {\n try {\n loadingRef.current = true;\n // if we are transitioning from true to false on exclude, then we need to \"reset\" by searching with no value\n await onSearch(!excludeUnmatchedResults && lastUsedExcludeRef.current ? undefined : query);\n } finally {\n loadingRef.current = false;\n lastUsedExcludeRef.current = excludeUnmatchedResults;\n }\n }\n\n if (excludeUnmatchedResults && table.options.enableRowSelection) {\n table.resetRowSelection();\n }\n }\n };\n\n useLazyEffect(() => {\n handleSearch(tableMeta.search.query, tableMeta.search.excludeUnmatchedResults);\n }, [tableMeta.search.isEnabled, tableMeta.search.query, tableMeta.search.excludeUnmatchedResults, rows.length]);\n}\n"],"names":["useSearchStateListener","table","onSearch","tableMeta","options","meta","rows","getRowModel","loadingRef","React","useRef","lastUsedExcludeRef","search","excludeUnmatchedResults","handleSearch","query","isEnabled","current","enableRowSelection","resetRowSelection","undefined","useLazyEffect","length"],"mappings":";;;;AAKA;AACA;AACA;SACgBA,sBAAsB,CAAkBC,KAAoB,EAAEC,QAA8B;EACxG,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAAwB;EACxD,MAAMC,IAAI,GAAGL,KAAK,CAACM,WAAW,EAAE,CAACD,IAAI;EACrC,MAAME,UAAU,GAAGC,cAAK,CAACC,MAAM,CAAC,KAAK,CAAC;EACtC,MAAMC,k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