@infinite-table/infinite-react 0.5.0 → 0.5.2
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/README.md +104 -0
- package/index.css +896 -0
- package/index.d.ts +2264 -0
- package/index.esm.css +896 -0
- package/index.esm.js +15404 -0
- package/index.js +15240 -0
- package/package.json +9 -94
- package/.vscode/settings.json +0 -3
- package/API.md +0 -0
- package/build/buildPackageJson.js +0 -43
- package/build/scripts/test.js +0 -37
- package/bundler.config.js +0 -25
- package/globals.d.ts +0 -7
- package/rollup.config.js +0 -15
- package/run-build-deepmap.js +0 -47
- package/run-build.js +0 -45
- package/run-dts-concat.js +0 -21
- package/src/components/CSSVariableWatch.tsx +0 -82
- package/src/components/DataSource/BooleanCollectionState.ts +0 -214
- package/src/components/DataSource/BooleanDeepCollectionState.ts +0 -208
- package/src/components/DataSource/DataSourceContext.ts +0 -20
- package/src/components/DataSource/GroupRowsState.ts +0 -74
- package/src/components/DataSource/Indexer.ts +0 -27
- package/src/components/DataSource/RowSelectionState.ts +0 -763
- package/src/components/DataSource/defaultFilterTypes.ts +0 -64
- package/src/components/DataSource/index.tsx +0 -108
- package/src/components/DataSource/privateHooks/getChangeDetect.ts +0 -7
- package/src/components/DataSource/privateHooks/useLoadData.ts +0 -783
- package/src/components/DataSource/publicHooks/useDataSource.ts +0 -19
- package/src/components/DataSource/publicHooks/useDataSourceActions.ts +0 -14
- package/src/components/DataSource/state/getInitialState.ts +0 -494
- package/src/components/DataSource/state/normalizeSortInfo.ts +0 -35
- package/src/components/DataSource/state/reducer.ts +0 -466
- package/src/components/DataSource/state/rowInfoStatus.ts +0 -27
- package/src/components/DataSource/types.ts +0 -548
- package/src/components/HeadlessTable/HeadlessTableWithPinnedContainers.tsx +0 -142
- package/src/components/HeadlessTable/MappedCells.ts +0 -251
- package/src/components/HeadlessTable/RawTable.tsx +0 -98
- package/src/components/HeadlessTable/ReactHeadlessTableRenderer.tsx +0 -1516
- package/src/components/HeadlessTable/index.tsx +0 -234
- package/src/components/InfiniteTable/InfiniteCls.css.ts +0 -164
- package/src/components/InfiniteTable/InfiniteTableContext.ts +0 -16
- package/src/components/InfiniteTable/api/getImperativeApi.ts +0 -391
- package/src/components/InfiniteTable/api/getSelectionApi.ts +0 -364
- package/src/components/InfiniteTable/api/type.ts +0 -11
- package/src/components/InfiniteTable/components/ActiveCellIndicator.css.ts +0 -51
- package/src/components/InfiniteTable/components/ActiveCellIndicator.tsx +0 -116
- package/src/components/InfiniteTable/components/ActiveRowIndicator.css.ts +0 -56
- package/src/components/InfiniteTable/components/ActiveRowIndicator.tsx +0 -94
- package/src/components/InfiniteTable/components/CheckBox.css.ts +0 -13
- package/src/components/InfiniteTable/components/CheckBox.tsx +0 -96
- package/src/components/InfiniteTable/components/FilterEditors.tsx +0 -52
- package/src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx +0 -27
- package/src/components/InfiniteTable/components/InfiniteTableBody/index.tsx +0 -1
- package/src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx +0 -31
- package/src/components/InfiniteTable/components/InfiniteTableFooter/index.tsx +0 -1
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableColumnHeaderFilter.tsx +0 -102
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx +0 -163
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx +0 -574
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx +0 -79
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderTypes.tsx +0 -25
- package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx +0 -185
- package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/GroupResizeHandle.tsx +0 -159
- package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts +0 -124
- package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/columnResizer.ts +0 -166
- package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx +0 -146
- package/src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts +0 -240
- package/src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts +0 -358
- package/src/components/InfiniteTable/components/InfiniteTableHeader/index.tsx +0 -1
- package/src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx +0 -114
- package/src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx +0 -146
- package/src/components/InfiniteTable/components/InfiniteTableLicenseFooter/footer.css.ts +0 -7
- package/src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx +0 -110
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx +0 -120
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCellTypes.ts +0 -74
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx +0 -457
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx +0 -107
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts +0 -6
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowTypes.ts +0 -32
- package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowUnvirtualized.tsx +0 -75
- package/src/components/InfiniteTable/components/InfiniteTableRow/columnRendering.tsx +0 -263
- package/src/components/InfiniteTable/components/InfiniteTableRow/index.tsx +0 -1
- package/src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts +0 -74
- package/src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts +0 -199
- package/src/components/InfiniteTable/components/LoadMask.css.ts +0 -34
- package/src/components/InfiniteTable/components/LoadMask.tsx +0 -27
- package/src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx +0 -56
- package/src/components/InfiniteTable/components/cell.css.ts +0 -192
- package/src/components/InfiniteTable/components/icons/ArrowDown.tsx +0 -14
- package/src/components/InfiniteTable/components/icons/ArrowUp.tsx +0 -14
- package/src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts +0 -31
- package/src/components/InfiniteTable/components/icons/ExpanderIcon.tsx +0 -63
- package/src/components/InfiniteTable/components/icons/Icon.tsx +0 -18
- package/src/components/InfiniteTable/components/icons/InfiniteTableIconClassName.ts +0 -1
- package/src/components/InfiniteTable/components/icons/LoadingIcon.css.ts +0 -8
- package/src/components/InfiniteTable/components/icons/LoadingIcon.tsx +0 -45
- package/src/components/InfiniteTable/components/icons/MenuIcon.tsx +0 -50
- package/src/components/InfiniteTable/components/icons/SortIcon.tsx +0 -113
- package/src/components/InfiniteTable/eventHandlers/eventHandlerTypes.ts +0 -57
- package/src/components/InfiniteTable/eventHandlers/index.ts +0 -95
- package/src/components/InfiniteTable/eventHandlers/keyboardNavigation.ts +0 -232
- package/src/components/InfiniteTable/eventHandlers/keyboardSelection.ts +0 -110
- package/src/components/InfiniteTable/eventHandlers/onCellClick.ts +0 -94
- package/src/components/InfiniteTable/eventHandlers/onKeyDown.ts +0 -25
- package/src/components/InfiniteTable/hooks/adjustColumnOrderForAllColumns.ts +0 -70
- package/src/components/InfiniteTable/hooks/reorderColumnsOnDrag.ts +0 -476
- package/src/components/InfiniteTable/hooks/useAutoSizeColumns.ts +0 -206
- package/src/components/InfiniteTable/hooks/useCellClassName.ts +0 -80
- package/src/components/InfiniteTable/hooks/useCellRendering.tsx +0 -217
- package/src/components/InfiniteTable/hooks/useColumnGroups.ts +0 -71
- package/src/components/InfiniteTable/hooks/useColumnMenu.ts +0 -72
- package/src/components/InfiniteTable/hooks/useColumnPointerEvents.ts +0 -258
- package/src/components/InfiniteTable/hooks/useColumnRowspan.ts +0 -43
- package/src/components/InfiniteTable/hooks/useColumnSizeFn.ts +0 -24
- package/src/components/InfiniteTable/hooks/useColumnsWhen.ts +0 -582
- package/src/components/InfiniteTable/hooks/useComputed.ts +0 -186
- package/src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts +0 -219
- package/src/components/InfiniteTable/hooks/useDOMProps.ts +0 -306
- package/src/components/InfiniteTable/hooks/useEffectWithRaf.ts +0 -47
- package/src/components/InfiniteTable/hooks/useInfiniteTable.ts +0 -10
- package/src/components/InfiniteTable/hooks/useInfiniteTableState.ts +0 -11
- package/src/components/InfiniteTable/hooks/useInternalProps.ts +0 -8
- package/src/components/InfiniteTable/hooks/useLicense/LicenseDetails.ts +0 -13
- package/src/components/InfiniteTable/hooks/useLicense/crc32.ts +0 -56
- package/src/components/InfiniteTable/hooks/useLicense/decode.ts +0 -147
- package/src/components/InfiniteTable/hooks/useLicense/useLicense.ts +0 -39
- package/src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts +0 -21
- package/src/components/InfiniteTable/hooks/useRowHover.ts +0 -18
- package/src/components/InfiniteTable/hooks/useScrollToActiveCell.ts +0 -48
- package/src/components/InfiniteTable/hooks/useScrollToActiveRow.ts +0 -44
- package/src/components/InfiniteTable/hooks/useScrollbars.ts +0 -51
- package/src/components/InfiniteTable/hooks/useToggleGroupRow.ts +0 -56
- package/src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx +0 -165
- package/src/components/InfiniteTable/hooks/useYourBrain.ts +0 -55
- package/src/components/InfiniteTable/index.tsx +0 -352
- package/src/components/InfiniteTable/internalProps.ts +0 -4
- package/src/components/InfiniteTable/state/computeColumnGroupsDepths.ts +0 -29
- package/src/components/InfiniteTable/state/getColumnVisibilityForHideEmptyGroupColumns.ts +0 -127
- package/src/components/InfiniteTable/state/getInitialState.ts +0 -375
- package/src/components/InfiniteTable/theme.css.ts +0 -556
- package/src/components/InfiniteTable/types/InfiniteTableAction.ts +0 -6
- package/src/components/InfiniteTable/types/InfiniteTableActionType.ts +0 -12
- package/src/components/InfiniteTable/types/InfiniteTableColumn.ts +0 -478
- package/src/components/InfiniteTable/types/InfiniteTableComputedValues.ts +0 -43
- package/src/components/InfiniteTable/types/InfiniteTableContextValue.ts +0 -12
- package/src/components/InfiniteTable/types/InfiniteTableInternalProps.ts +0 -3
- package/src/components/InfiniteTable/types/InfiniteTableProps.ts +0 -511
- package/src/components/InfiniteTable/types/InfiniteTableState.ts +0 -195
- package/src/components/InfiniteTable/types/Utility.ts +0 -35
- package/src/components/InfiniteTable/types/index.ts +0 -96
- package/src/components/InfiniteTable/utilities.css.ts +0 -179
- package/src/components/InfiniteTable/utils/MultiRowSelector.ts +0 -111
- package/src/components/InfiniteTable/utils/RenderHookComponentForInfinite.tsx +0 -52
- package/src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts +0 -33
- package/src/components/InfiniteTable/utils/assignFiltered.ts +0 -29
- package/src/components/InfiniteTable/utils/defaultGetColumContextMenuItems.tsx +0 -108
- package/src/components/InfiniteTable/utils/getColumnComputedType.ts +0 -33
- package/src/components/InfiniteTable/utils/getColumnForGroupBy.tsx +0 -313
- package/src/components/InfiniteTable/utils/getComputedVisibleColumns.ts +0 -773
- package/src/components/InfiniteTable/utils/getContextMenuForColumn.tsx +0 -72
- package/src/components/InfiniteTable/utils/infiniteDOMUtils.ts +0 -189
- package/src/components/InfiniteTable/utils/mapToObject.ts +0 -20
- package/src/components/InfiniteTable/utils/moveXatY.ts +0 -25
- package/src/components/InfiniteTable/utils/objectValuesExcept.ts +0 -9
- package/src/components/InfiniteTable/utils/progressiveSpeedScroller.ts +0 -158
- package/src/components/InfiniteTable/utils/rafFn.ts +0 -13
- package/src/components/InfiniteTable/utils/toCSSVarName.ts +0 -1
- package/src/components/InfiniteTable/utils/toMap.ts +0 -24
- package/src/components/Menu/Menu.tsx +0 -750
- package/src/components/Menu/MenuCls.css.ts +0 -139
- package/src/components/Menu/MenuContext.ts +0 -10
- package/src/components/Menu/MenuContextValue.ts +0 -15
- package/src/components/Menu/MenuProps.ts +0 -98
- package/src/components/Menu/MenuState.ts +0 -56
- package/src/components/Menu/MenuTriangleContext.ts +0 -352
- package/src/components/Menu/childrenToRuntimeItems.tsx +0 -103
- package/src/components/Menu/getMenuState.tsx +0 -119
- package/src/components/Menu/index.tsx +0 -88
- package/src/components/Menu/propToIdentifyMenu.ts +0 -1
- package/src/components/RawList/AvoidReactDiff.tsx +0 -48
- package/src/components/RawList/MappedItems.ts +0 -143
- package/src/components/RawList/ReactVirtualRenderer.tsx +0 -307
- package/src/components/RawList/index.tsx +0 -42
- package/src/components/RawList/types.ts +0 -23
- package/src/components/RawList/useVirtualRenderer.ts +0 -36
- package/src/components/RenderHookComponent.tsx +0 -10
- package/src/components/ResizeObserver/index.tsx +0 -170
- package/src/components/VirtualBrain/MatrixBrain.ts +0 -1621
- package/src/components/VirtualBrain/ScrollListener.ts +0 -39
- package/src/components/VirtualBrain/index.ts +0 -664
- package/src/components/VirtualList/ColumnListWithExternalScrolling.tsx +0 -78
- package/src/components/VirtualList/InfiniteListRootClassName.ts +0 -1
- package/src/components/VirtualList/RowListWithExternalScrolling.tsx +0 -120
- package/src/components/VirtualList/SpacePlaceholder.tsx +0 -32
- package/src/components/VirtualList/VirtualList.css.ts +0 -29
- package/src/components/VirtualList/VirtualList.tsx +0 -141
- package/src/components/VirtualList/VirtualRowList.tsx +0 -34
- package/src/components/VirtualList/types.ts +0 -56
- package/src/components/VirtualList/useCorrectHeightForRowElements.ts +0 -14
- package/src/components/VirtualScrollContainer/VirtualScrollContainer.css.ts +0 -51
- package/src/components/VirtualScrollContainer/getScrollableClassName.ts +0 -30
- package/src/components/VirtualScrollContainer/index.tsx +0 -63
- package/src/components/flexbox/index.ts +0 -562
- package/src/components/hooks/useComponentState/index.tsx +0 -562
- package/src/components/hooks/useComponentState/types.ts +0 -32
- package/src/components/hooks/useEffectOnceWithProperUnmount.ts +0 -33
- package/src/components/hooks/useEffectWithChanges.ts +0 -56
- package/src/components/hooks/useImmutableRef.ts +0 -7
- package/src/components/hooks/useInterceptedMap.ts +0 -71
- package/src/components/hooks/useLatest.tsx +0 -8
- package/src/components/hooks/useLazyLatest.ts +0 -23
- package/src/components/hooks/useMemoShallowObjectMerge.ts +0 -16
- package/src/components/hooks/useMounted.ts +0 -18
- package/src/components/hooks/useOnMount.ts +0 -21
- package/src/components/hooks/useOnScroll.ts +0 -34
- package/src/components/hooks/useOnce.ts +0 -10
- package/src/components/hooks/useOverlay/index.tsx +0 -418
- package/src/components/hooks/usePrevious.ts +0 -8
- package/src/components/hooks/usePropertyOld.ts +0 -168
- package/src/components/hooks/useRerender.ts +0 -12
- package/src/components/hooks/xuseProperty.ts +0 -165
- package/src/components/types/CellPosition.ts +0 -4
- package/src/components/types/NonUndefined.ts +0 -1
- package/src/components/types/RemoveObject.ts +0 -22
- package/src/components/types/Renderable.ts +0 -3
- package/src/components/types/ScrollPosition.ts +0 -7
- package/src/components/types/Setter.ts +0 -2
- package/src/components/types/Size.ts +0 -6
- package/src/components/types/SubscriptionCallback.ts +0 -10
- package/src/components/types/VoidFn.ts +0 -1
- package/src/components/utils/buildSubscriptionCallback.tsx +0 -60
- package/src/components/utils/clamp.ts +0 -3
- package/src/components/utils/debounce.ts +0 -16
- package/src/components/utils/decamelize.ts +0 -11
- package/src/components/utils/discardCallsWithEqualArg.ts +0 -42
- package/src/components/utils/getRenderIndexes.ts +0 -33
- package/src/components/utils/getScrollbarWidth.ts +0 -31
- package/src/components/utils/getVirtualRenderCount.ts +0 -21
- package/src/components/utils/isControlled.ts +0 -12
- package/src/components/utils/isControlledValue.ts +0 -5
- package/src/index.tsx +0 -34
- package/src/test.tsx +0 -18
- package/src/utils/DeepMap/index.ts +0 -588
- package/src/utils/DeepMap/once.ts +0 -16
- package/src/utils/DeepMap/sortAscending.ts +0 -1
- package/src/utils/DeepMap/tsconfig.deepmap.json +0 -17
- package/src/utils/DeepMap/xpackage.json +0 -26
- package/src/utils/debug.ts +0 -40
- package/src/utils/deepClone.ts +0 -38
- package/src/utils/getGlobal.ts +0 -3
- package/src/utils/groupAndPivot/defaultToKey.ts +0 -3
- package/src/utils/groupAndPivot/getGroupKeysForDataItem.ts +0 -19
- package/src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts +0 -361
- package/src/utils/groupAndPivot/index.ts +0 -1229
- package/src/utils/groupAndPivot/types.ts +0 -10
- package/src/utils/join.ts +0 -4
- package/src/utils/mathIntersection.ts +0 -21
- package/src/utils/minified.d.ts +0 -2
- package/src/utils/minified.js +0 -6
- package/src/utils/multisort/index.ts +0 -151
- package/src/utils/multisort/sortTypes.ts +0 -25
- package/src/utils/notes-status.md +0 -92
- package/src/utils/pageGeometry/ConvexPoly.ts +0 -34
- package/src/utils/pageGeometry/Point.ts +0 -51
- package/src/utils/pageGeometry/PolyWithPoints.ts +0 -52
- package/src/utils/pageGeometry/Rectangle.ts +0 -98
- package/src/utils/pageGeometry/Triangle.ts +0 -16
- package/src/utils/pageGeometry/alignment/index.ts +0 -221
- package/src/utils/pageGeometry/polyContainsPoint.ts +0 -182
- package/src/utils/pageGeometry/types.ts +0 -3
- package/src/utils/proxyFnCall.ts +0 -46
- package/src/utils/raf.ts +0 -13
- package/src/utils/selectParent.ts +0 -18
- package/src/utils/shallowEqualObjects.ts +0 -49
- package/src/utils/stripVar.ts +0 -3
- package/src/utils/toUpperFirst.ts +0 -5
- package/todo.md +0 -2
- package/tsconfig.build.json +0 -8
- package/tsconfig.dev.json +0 -7
- package/tsconfig.json +0 -30
- package/tsconfig.typebundler.json +0 -13
- package/typedoc.json +0 -4
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export type ArrayElement<ArrayType extends readonly unknown[]> =
|
|
2
|
-
ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
|
|
3
|
-
|
|
4
|
-
export type MapOrRecord<K extends string, V> = Map<K, V> | Record<K, V>;
|
|
5
|
-
|
|
6
|
-
export type RequireOnlyOneProperty<T, Keys extends keyof T> = Pick<
|
|
7
|
-
T,
|
|
8
|
-
Exclude<keyof T, Keys>
|
|
9
|
-
> &
|
|
10
|
-
{
|
|
11
|
-
[K in Keys]-?: Required<Pick<T, K>> &
|
|
12
|
-
Partial<Record<Exclude<Keys, K>, undefined>>;
|
|
13
|
-
}[Keys];
|
|
14
|
-
|
|
15
|
-
export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<
|
|
16
|
-
T,
|
|
17
|
-
Exclude<keyof T, Keys>
|
|
18
|
-
> &
|
|
19
|
-
{
|
|
20
|
-
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
|
|
21
|
-
}[Keys];
|
|
22
|
-
|
|
23
|
-
export type DiscriminatedUnion<A, B> =
|
|
24
|
-
| (A & {
|
|
25
|
-
[K in keyof B]?: undefined;
|
|
26
|
-
})
|
|
27
|
-
| (B & {
|
|
28
|
-
[K in keyof A]?: undefined;
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export type AllPropertiesOrNone<DATA_TYPE> =
|
|
32
|
-
| DATA_TYPE
|
|
33
|
-
| { [KEY in keyof DATA_TYPE]?: never };
|
|
34
|
-
|
|
35
|
-
export type KeyOfNoSymbol<T> = Exclude<keyof T, Symbol>;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { InfiniteTableRowInfo } from '../../../utils/groupAndPivot';
|
|
2
|
-
|
|
3
|
-
import type { InfiniteTableAction } from './InfiniteTableAction';
|
|
4
|
-
import type { InfiniteTableActionType } from './InfiniteTableActionType';
|
|
5
|
-
import type {
|
|
6
|
-
InfiniteTableColumn,
|
|
7
|
-
InfiniteTableColumnComparer,
|
|
8
|
-
InfiniteTableComputedColumn,
|
|
9
|
-
InfiniteTableColumnRenderParam,
|
|
10
|
-
InfiniteTableColumnRenderValueParam,
|
|
11
|
-
InfiniteTableColumnRowspanParam,
|
|
12
|
-
InfiniteTablePivotColumn,
|
|
13
|
-
InfiniteTableColumnRenderFunctionForGroupRows,
|
|
14
|
-
InfiniteTableColumnRenderFunctionForNormalRows,
|
|
15
|
-
} from './InfiniteTableColumn';
|
|
16
|
-
import type { InfiniteTableComputedValues } from './InfiniteTableComputedValues';
|
|
17
|
-
import type { InfiniteTableContextValue } from './InfiniteTableContextValue';
|
|
18
|
-
import type {
|
|
19
|
-
InfiniteTableProps,
|
|
20
|
-
InfiniteTableApi,
|
|
21
|
-
InfiniteTablePropColumnOrder,
|
|
22
|
-
InfiniteTablePropColumnVisibility,
|
|
23
|
-
InfiniteTablePropColumnPinning,
|
|
24
|
-
InfiniteTableColumnAggregator,
|
|
25
|
-
InfiniteTableColumnGroup,
|
|
26
|
-
InfiniteTablePropGroupRenderStrategy,
|
|
27
|
-
InfiniteTablePropColumnGroups,
|
|
28
|
-
InfiniteTablePropRowStyle,
|
|
29
|
-
InfiniteTableRowStyleFn,
|
|
30
|
-
InfiniteTableRowClassNameFn,
|
|
31
|
-
InfiniteTableFilterEditorProps,
|
|
32
|
-
InfiniteTablePropFilterEditors,
|
|
33
|
-
InfiniteTablePropRowClassName,
|
|
34
|
-
InfiniteTablePropColumns,
|
|
35
|
-
InfiniteTableColumnsMap,
|
|
36
|
-
InfiniteTablePropComponents,
|
|
37
|
-
InfiniteTableGroupColumnFunction,
|
|
38
|
-
InfiniteTableGroupColumnGetterOptions,
|
|
39
|
-
InfiniteTablePropColumnSizing,
|
|
40
|
-
InfiniteTablePropColumnTypes,
|
|
41
|
-
InfiniteTableColumnSizingOptions,
|
|
42
|
-
Scrollbars,
|
|
43
|
-
InfiniteTableGroupColumnBase,
|
|
44
|
-
InfiniteTablePropGroupColumn,
|
|
45
|
-
InfiniteTablePropAutoSizeColumnsKey,
|
|
46
|
-
InfiniteTablePropHeaderOptions,
|
|
47
|
-
InfiniteTablePropKeyboardNavigation,
|
|
48
|
-
} from './InfiniteTableProps';
|
|
49
|
-
import type { InfiniteTableState } from './InfiniteTableState';
|
|
50
|
-
|
|
51
|
-
export type {
|
|
52
|
-
Scrollbars,
|
|
53
|
-
InfiniteTablePropHeaderOptions,
|
|
54
|
-
InfiniteTablePropAutoSizeColumnsKey,
|
|
55
|
-
InfiniteTableColumnAggregator,
|
|
56
|
-
InfiniteTableComputedValues,
|
|
57
|
-
InfiniteTableColumnRowspanParam,
|
|
58
|
-
InfiniteTablePivotColumn,
|
|
59
|
-
InfiniteTablePropColumns,
|
|
60
|
-
InfiniteTablePropGroupColumn,
|
|
61
|
-
InfiniteTableColumnsMap,
|
|
62
|
-
InfiniteTableRowInfo,
|
|
63
|
-
InfiniteTableGroupColumnFunction,
|
|
64
|
-
InfiniteTableGroupColumnBase,
|
|
65
|
-
InfiniteTablePropColumnOrder,
|
|
66
|
-
InfiniteTablePropComponents,
|
|
67
|
-
InfiniteTablePropColumnVisibility,
|
|
68
|
-
InfiniteTablePropColumnPinning,
|
|
69
|
-
InfiniteTableColumnGroup,
|
|
70
|
-
InfiniteTableColumn,
|
|
71
|
-
InfiniteTableColumnComparer,
|
|
72
|
-
InfiniteTableComputedColumn,
|
|
73
|
-
InfiniteTableColumnRenderParam,
|
|
74
|
-
InfiniteTableColumnRenderFunctionForGroupRows,
|
|
75
|
-
InfiniteTableColumnRenderFunctionForNormalRows,
|
|
76
|
-
InfiniteTableColumnRenderValueParam,
|
|
77
|
-
InfiniteTableContextValue,
|
|
78
|
-
InfiniteTablePropGroupRenderStrategy,
|
|
79
|
-
InfiniteTablePropColumnGroups,
|
|
80
|
-
InfiniteTablePropColumnSizing,
|
|
81
|
-
InfiniteTableColumnSizingOptions,
|
|
82
|
-
InfiniteTableState,
|
|
83
|
-
InfiniteTableAction,
|
|
84
|
-
InfiniteTableProps,
|
|
85
|
-
InfiniteTablePropKeyboardNavigation,
|
|
86
|
-
InfiniteTablePropColumnTypes,
|
|
87
|
-
InfiniteTableApi,
|
|
88
|
-
InfiniteTableActionType,
|
|
89
|
-
InfiniteTablePropRowStyle,
|
|
90
|
-
InfiniteTablePropRowClassName,
|
|
91
|
-
InfiniteTableRowStyleFn,
|
|
92
|
-
InfiniteTableRowClassNameFn,
|
|
93
|
-
InfiniteTableGroupColumnGetterOptions,
|
|
94
|
-
InfiniteTableFilterEditorProps,
|
|
95
|
-
InfiniteTablePropFilterEditors,
|
|
96
|
-
};
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CSSProperties,
|
|
3
|
-
globalStyle,
|
|
4
|
-
style,
|
|
5
|
-
styleVariants,
|
|
6
|
-
} from '@vanilla-extract/css';
|
|
7
|
-
|
|
8
|
-
import { ThemeVars } from './theme.css';
|
|
9
|
-
|
|
10
|
-
const borderBox: CSSProperties = {
|
|
11
|
-
boxSizing: 'border-box',
|
|
12
|
-
};
|
|
13
|
-
export const boxSizingBorderBox = style(borderBox);
|
|
14
|
-
|
|
15
|
-
globalStyle(`${boxSizingBorderBox}:before`, borderBox);
|
|
16
|
-
globalStyle(`${boxSizingBorderBox}:after`, borderBox);
|
|
17
|
-
globalStyle(`${boxSizingBorderBox} *`, borderBox);
|
|
18
|
-
globalStyle(`${boxSizingBorderBox} *:before`, borderBox);
|
|
19
|
-
globalStyle(`${boxSizingBorderBox} *:after`, borderBox);
|
|
20
|
-
|
|
21
|
-
export const position = styleVariants({
|
|
22
|
-
relative: { position: 'relative' },
|
|
23
|
-
absolute: { position: 'absolute' },
|
|
24
|
-
sticky: { position: 'sticky' },
|
|
25
|
-
fixed: { position: 'fixed' },
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export const fill = styleVariants({
|
|
29
|
-
currentColor: { fill: 'currentColor' },
|
|
30
|
-
accentColor: { fill: ThemeVars.color.accent },
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export const margin = styleVariants({
|
|
34
|
-
none: { margin: 0 },
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export const stroke = styleVariants({
|
|
38
|
-
currentColor: { stroke: 'currentColor' },
|
|
39
|
-
accentColor: { stroke: ThemeVars.color.accent },
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export const background = styleVariants({
|
|
43
|
-
inherit: { background: 'inherit' },
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export const transformTranslateZero = style({
|
|
47
|
-
transform: 'translate3d(0,0,0)',
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export const transform = styleVariants({
|
|
51
|
-
translateZero: { transform: 'translate3d(0,0,0)' },
|
|
52
|
-
rotate90: { transform: 'rotate(90deg)' },
|
|
53
|
-
rotate180: { transform: 'rotate(180deg)' },
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
export const cursor = styleVariants({
|
|
57
|
-
pointer: { cursor: 'pointer' },
|
|
58
|
-
default: { cursor: 'default' },
|
|
59
|
-
colResize: { cursor: 'col-resize' },
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
export const pointerEvents = styleVariants({
|
|
63
|
-
none: { pointerEvents: 'none' },
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
export const flex = styleVariants({
|
|
67
|
-
1: { flex: 1 },
|
|
68
|
-
none: { flex: 'none' },
|
|
69
|
-
});
|
|
70
|
-
export const zIndex = styleVariants({
|
|
71
|
-
1: { zIndex: 1 },
|
|
72
|
-
10: { zIndex: 10 },
|
|
73
|
-
100: { zIndex: 100 },
|
|
74
|
-
1000: { zIndex: 1000 },
|
|
75
|
-
'1k': { zIndex: 1000 },
|
|
76
|
-
10_000: { zIndex: 10_000 },
|
|
77
|
-
'10k': { zIndex: 10_000 },
|
|
78
|
-
100_000: { zIndex: 100_000 },
|
|
79
|
-
'100k': { zIndex: 100_000 },
|
|
80
|
-
1_000_000: { zIndex: 1_000_000 },
|
|
81
|
-
10_000_000: { zIndex: 10_000_000 },
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
export const display = styleVariants({
|
|
85
|
-
flex: { display: 'flex' },
|
|
86
|
-
contents: { display: 'contents' },
|
|
87
|
-
none: { display: 'none' },
|
|
88
|
-
block: { display: 'block' },
|
|
89
|
-
grid: { display: 'grid' },
|
|
90
|
-
inlineBlock: { display: 'inline-block' },
|
|
91
|
-
inlineFlex: { display: 'inline-flex' },
|
|
92
|
-
inlineGrid: { display: 'inline-grid' },
|
|
93
|
-
});
|
|
94
|
-
export const userSelect = styleVariants({
|
|
95
|
-
none: { userSelect: 'none' },
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
export const height = styleVariants({
|
|
99
|
-
'100%': { height: '100%' },
|
|
100
|
-
'0': { height: '0' },
|
|
101
|
-
});
|
|
102
|
-
export const width = styleVariants({
|
|
103
|
-
'100%': { width: '100%' },
|
|
104
|
-
'0': { width: '0' },
|
|
105
|
-
});
|
|
106
|
-
export const top = styleVariants({
|
|
107
|
-
'100%': { top: '100%' },
|
|
108
|
-
'0': { top: '0' },
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
export const left = styleVariants({
|
|
112
|
-
'100%': { left: '100%' },
|
|
113
|
-
'0': { left: '0' },
|
|
114
|
-
auto: { left: 'auto' },
|
|
115
|
-
});
|
|
116
|
-
export const bottom = styleVariants({
|
|
117
|
-
'100%': { bottom: '100%' },
|
|
118
|
-
'0': { bottom: '0' },
|
|
119
|
-
});
|
|
120
|
-
export const right = styleVariants({
|
|
121
|
-
'100%': { right: '100%' },
|
|
122
|
-
'0': { right: '0' },
|
|
123
|
-
auto: { right: 'auto' },
|
|
124
|
-
});
|
|
125
|
-
export const flexFlow = styleVariants({
|
|
126
|
-
column: { flexFlow: 'column' },
|
|
127
|
-
columnReverse: { flexFlow: 'column-reverse' },
|
|
128
|
-
row: { flexFlow: 'row' },
|
|
129
|
-
rowReverse: { flexFlow: 'row-reverse' },
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
export const alignItems = styleVariants({
|
|
133
|
-
center: { alignItems: 'center' },
|
|
134
|
-
stretch: { alignItems: 'stretch' },
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
export const justifyContent = styleVariants({
|
|
138
|
-
center: { justifyContent: 'center' },
|
|
139
|
-
spaceBetween: { justifyContent: 'space-between' },
|
|
140
|
-
spaceAround: { justifyContent: 'space-around' },
|
|
141
|
-
start: { justifyContent: 'flex-start' },
|
|
142
|
-
end: { justifyContent: 'flex-end' },
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
export const overflow = styleVariants({
|
|
146
|
-
hidden: { overflow: 'hidden' },
|
|
147
|
-
auto: { overflow: 'auto' },
|
|
148
|
-
visible: { overflow: 'visible' },
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
export const visibility = styleVariants({
|
|
152
|
-
visible: { visibility: 'visible' },
|
|
153
|
-
hidden: { visibility: 'hidden' },
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
export const willChange = styleVariants({
|
|
157
|
-
transform: { willChange: 'transform' },
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
export const whiteSpace = styleVariants({
|
|
161
|
-
nowrap: { whiteSpace: 'nowrap' },
|
|
162
|
-
});
|
|
163
|
-
export const textOverflow = styleVariants({
|
|
164
|
-
ellipsis: { textOverflow: 'ellipsis' },
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
export const cssEllipsisClassName = style([
|
|
168
|
-
whiteSpace.nowrap,
|
|
169
|
-
textOverflow.ellipsis,
|
|
170
|
-
overflow.hidden,
|
|
171
|
-
]);
|
|
172
|
-
|
|
173
|
-
export const absoluteCover = style([
|
|
174
|
-
position.absolute,
|
|
175
|
-
top[0],
|
|
176
|
-
left[0],
|
|
177
|
-
right[0],
|
|
178
|
-
bottom[0],
|
|
179
|
-
]);
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { RowSelectionState } from '../../DataSource/RowSelectionState';
|
|
2
|
-
|
|
3
|
-
export type MultiRowSelectorOptions = {
|
|
4
|
-
getIdForIndex: (index: number) => string | number;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
function ensureMinMax(start: number, end: number) {
|
|
8
|
-
return start < end ? [start, end] : [end, start];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export class MultiRowSelector {
|
|
12
|
-
getIdForIndex: MultiRowSelectorOptions['getIdForIndex'];
|
|
13
|
-
|
|
14
|
-
multiSelectStartIndex: number = 0;
|
|
15
|
-
multiSelectEndIndex?: number;
|
|
16
|
-
|
|
17
|
-
_rowSelectionState!: RowSelectionState;
|
|
18
|
-
|
|
19
|
-
constructor(options: MultiRowSelectorOptions) {
|
|
20
|
-
this.getIdForIndex = options.getIdForIndex;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
set rowSelectionState(rowSelectionState: RowSelectionState) {
|
|
24
|
-
this._rowSelectionState = rowSelectionState;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
get rowSelectionState() {
|
|
28
|
-
return this._rowSelectionState;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
private selectRange(startIndex: number, endIndex: number) {
|
|
32
|
-
const [start, end] = ensureMinMax(startIndex, endIndex);
|
|
33
|
-
|
|
34
|
-
const rowSelectionState = this.rowSelectionState;
|
|
35
|
-
|
|
36
|
-
for (let i = start; i <= end; i++) {
|
|
37
|
-
const id = this.getIdForIndex(i);
|
|
38
|
-
|
|
39
|
-
rowSelectionState.selectRow(id);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
private deselectRange(startIndex: number, endIndex: number) {
|
|
43
|
-
const [start, end] = ensureMinMax(startIndex, endIndex);
|
|
44
|
-
|
|
45
|
-
const rowSelectionState = this.rowSelectionState;
|
|
46
|
-
|
|
47
|
-
for (let i = start; i <= end; i++) {
|
|
48
|
-
const id = this.getIdForIndex(i);
|
|
49
|
-
|
|
50
|
-
rowSelectionState.deselectRow(id);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* This is the single click, without any modifier
|
|
56
|
-
*/
|
|
57
|
-
resetClick(index: number) {
|
|
58
|
-
this.rowSelectionState.deselectAll();
|
|
59
|
-
const id = this.getIdForIndex(index);
|
|
60
|
-
|
|
61
|
-
this.rowSelectionState.selectRow(id);
|
|
62
|
-
|
|
63
|
-
this.multiSelectStartIndex = index;
|
|
64
|
-
this.multiSelectEndIndex = undefined;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* This is the click with ctrl/cmd key pressed
|
|
69
|
-
* @param index
|
|
70
|
-
*/
|
|
71
|
-
singleAddClick(index: number) {
|
|
72
|
-
const id = this.getIdForIndex(index);
|
|
73
|
-
|
|
74
|
-
if (this.rowSelectionState.isRowSelected(id)) {
|
|
75
|
-
this.rowSelectionState.deselectRow(id);
|
|
76
|
-
if (this.rowSelectionState.isRowSelected(this.getIdForIndex(index + 1))) {
|
|
77
|
-
this.multiSelectStartIndex = index + 1;
|
|
78
|
-
} else {
|
|
79
|
-
// this.lastResetClickIndex = index;
|
|
80
|
-
}
|
|
81
|
-
// this.lastMultiAddClickIndex = undefined;
|
|
82
|
-
} else {
|
|
83
|
-
this.rowSelectionState.selectRow(id);
|
|
84
|
-
this.multiSelectStartIndex = index;
|
|
85
|
-
|
|
86
|
-
let multiSelectEndIndex = undefined;
|
|
87
|
-
|
|
88
|
-
// we have to go to previous rows and find the last row that we meet that is selected
|
|
89
|
-
// without going over any deselected rows and that's the selection end
|
|
90
|
-
for (let i = index - 1; i >= 0; i--) {
|
|
91
|
-
const id = this.getIdForIndex(i);
|
|
92
|
-
if (this.rowSelectionState.isRowSelected(id)) {
|
|
93
|
-
multiSelectEndIndex = i;
|
|
94
|
-
} else {
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
this.multiSelectEndIndex = multiSelectEndIndex;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
multiSelectClick(index: number) {
|
|
103
|
-
if (this.multiSelectEndIndex != null) {
|
|
104
|
-
this.deselectRange(this.multiSelectStartIndex, this.multiSelectEndIndex);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
this.selectRange(this.multiSelectStartIndex, index);
|
|
108
|
-
|
|
109
|
-
this.multiSelectEndIndex = index;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { InfiniteTableHeaderCellContext } from '../components/InfiniteTableHeader/InfiniteTableHeaderCell';
|
|
3
|
-
|
|
4
|
-
import { InfiniteTableColumnCellContext } from '../components/InfiniteTableRow/InfiniteTableColumnCell';
|
|
5
|
-
import {
|
|
6
|
-
InfiniteTableColumnCellContextType,
|
|
7
|
-
InfiniteTableHeaderCellContextType,
|
|
8
|
-
} from '../types/InfiniteTableColumn';
|
|
9
|
-
import {
|
|
10
|
-
RenderHookComponent,
|
|
11
|
-
RenderHookComponentProps,
|
|
12
|
-
} from '../../RenderHookComponent';
|
|
13
|
-
|
|
14
|
-
export function RenderCellHookComponent<T, RENDER_FN extends Function>(
|
|
15
|
-
props: RenderHookComponentProps<
|
|
16
|
-
RENDER_FN,
|
|
17
|
-
InfiniteTableColumnCellContextType<T>
|
|
18
|
-
>,
|
|
19
|
-
) {
|
|
20
|
-
const ContextProvider =
|
|
21
|
-
InfiniteTableColumnCellContext.Provider as React.Provider<
|
|
22
|
-
InfiniteTableColumnCellContextType<T>
|
|
23
|
-
>;
|
|
24
|
-
return (
|
|
25
|
-
<ContextProvider value={props.renderParam}>
|
|
26
|
-
<RenderHookComponent
|
|
27
|
-
render={props.render}
|
|
28
|
-
renderParam={props.renderParam}
|
|
29
|
-
/>
|
|
30
|
-
</ContextProvider>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function RenderHeaderCellHookComponent<T, RENDER_FN extends Function>(
|
|
35
|
-
props: RenderHookComponentProps<
|
|
36
|
-
RENDER_FN,
|
|
37
|
-
InfiniteTableHeaderCellContextType<T>
|
|
38
|
-
>,
|
|
39
|
-
) {
|
|
40
|
-
const ContextProvider =
|
|
41
|
-
InfiniteTableHeaderCellContext.Provider as React.Provider<
|
|
42
|
-
InfiniteTableHeaderCellContextType<T>
|
|
43
|
-
>;
|
|
44
|
-
return (
|
|
45
|
-
<ContextProvider value={props.renderParam}>
|
|
46
|
-
<RenderHookComponent
|
|
47
|
-
render={props.render}
|
|
48
|
-
renderParam={props.renderParam}
|
|
49
|
-
/>
|
|
50
|
-
</ContextProvider>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InfiniteTablePropColumnOrderNormalized,
|
|
3
|
-
InfiniteTablePropColumnPinning,
|
|
4
|
-
} from '../types/InfiniteTableProps';
|
|
5
|
-
|
|
6
|
-
const order = ['start', undefined, 'end'];
|
|
7
|
-
export const adjustColumnOrderForPinning = (
|
|
8
|
-
columnOrder: InfiniteTablePropColumnOrderNormalized,
|
|
9
|
-
columnPinning: InfiniteTablePropColumnPinning,
|
|
10
|
-
) => {
|
|
11
|
-
if (columnPinning && Object.keys(columnPinning).length > 0) {
|
|
12
|
-
// make sure pinned columns are coming first
|
|
13
|
-
columnOrder.sort((colId1: string, colId2: string) => {
|
|
14
|
-
let p1 = columnPinning[colId1];
|
|
15
|
-
let p2 = columnPinning[colId2];
|
|
16
|
-
|
|
17
|
-
if (p1 === true) {
|
|
18
|
-
p1 = 'start';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (p2 === true) {
|
|
22
|
-
p2 = 'start';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (p1 == p2) {
|
|
26
|
-
return 0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return order.indexOf(p1) - order.indexOf(p2);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return columnOrder;
|
|
33
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export function assignFiltered(
|
|
2
|
-
filterFn: (value: any, key: string) => boolean,
|
|
3
|
-
target: any,
|
|
4
|
-
...rest: any[]
|
|
5
|
-
) {
|
|
6
|
-
const result = target;
|
|
7
|
-
|
|
8
|
-
rest.forEach((obj) => {
|
|
9
|
-
for (const key in obj) {
|
|
10
|
-
if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
|
|
11
|
-
result[key] = obj[key];
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function assignNonNull(target: any, ...rest: any[]) {
|
|
20
|
-
return assignFiltered((value) => value != null, target, ...rest);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function assignExcept(
|
|
24
|
-
exceptKeys: Record<string, boolean>,
|
|
25
|
-
target: any,
|
|
26
|
-
...rest: any[]
|
|
27
|
-
) {
|
|
28
|
-
return assignFiltered((_value, key) => !(key in exceptKeys), target, ...rest);
|
|
29
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { MenuItemObject, MenuProps } from '../../Menu/MenuProps';
|
|
3
|
-
import { InfiniteCheckBox } from '../components/CheckBox';
|
|
4
|
-
import {
|
|
5
|
-
InfiniteTableApi,
|
|
6
|
-
InfiniteTableComputedColumn,
|
|
7
|
-
InfiniteTableComputedValues,
|
|
8
|
-
InfiniteTableState,
|
|
9
|
-
} from '../types';
|
|
10
|
-
import { InfiniteTableActions } from '../types/InfiniteTableState';
|
|
11
|
-
|
|
12
|
-
export function defaultGetColumContextMenuItems<T>(params: {
|
|
13
|
-
column: InfiniteTableComputedColumn<T>;
|
|
14
|
-
api: InfiniteTableApi<T>;
|
|
15
|
-
getState: () => InfiniteTableState<T>;
|
|
16
|
-
getComputed: () => InfiniteTableComputedValues<T>;
|
|
17
|
-
actions: InfiniteTableActions<T>;
|
|
18
|
-
}): MenuProps['items'] {
|
|
19
|
-
const { column, getComputed, api } = params;
|
|
20
|
-
|
|
21
|
-
return [
|
|
22
|
-
{
|
|
23
|
-
key: 'sort-asc',
|
|
24
|
-
label: 'Sort Ascending',
|
|
25
|
-
disabled: column.computedSortedAsc,
|
|
26
|
-
onAction: () => {
|
|
27
|
-
api.setSortingForColumn(column.id, 1);
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
key: 'sort-desc',
|
|
32
|
-
label: 'Sort Descending',
|
|
33
|
-
disabled: column.computedSortedDesc,
|
|
34
|
-
onAction: () => {
|
|
35
|
-
api.setSortingForColumn(column.id, -1);
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
key: 'sort-none',
|
|
40
|
-
label: 'Unsort',
|
|
41
|
-
disabled: !column.computedSorted,
|
|
42
|
-
onAction: () => {
|
|
43
|
-
api.setSortingForColumn(column.id, null);
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
'-',
|
|
47
|
-
{
|
|
48
|
-
key: 'pin-start',
|
|
49
|
-
label: 'Pin to start',
|
|
50
|
-
disabled: column.computedPinned === 'start',
|
|
51
|
-
onAction: () => {
|
|
52
|
-
api.setPinningForColumn(column.id, 'start');
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
// {
|
|
56
|
-
// key: 'pin-end',
|
|
57
|
-
// label: 'Pin to end',
|
|
58
|
-
// disabled: column.computedPinned === 'end',
|
|
59
|
-
// onAction: () => {},
|
|
60
|
-
// },
|
|
61
|
-
{
|
|
62
|
-
key: 'unpin',
|
|
63
|
-
label: 'Unpin',
|
|
64
|
-
disabled: !column.computedPinned,
|
|
65
|
-
onAction: () => {
|
|
66
|
-
api.setPinningForColumn(column.id, false);
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
'-',
|
|
70
|
-
{
|
|
71
|
-
key: 'columns',
|
|
72
|
-
label: 'Columns',
|
|
73
|
-
menu: () => {
|
|
74
|
-
const colItems: MenuItemObject[] = [];
|
|
75
|
-
|
|
76
|
-
getComputed().computedColumnsMapInInitialOrder.forEach((col, id) => {
|
|
77
|
-
colItems.push({
|
|
78
|
-
key: id,
|
|
79
|
-
label: col.name || id || '',
|
|
80
|
-
|
|
81
|
-
check: (
|
|
82
|
-
<InfiniteCheckBox
|
|
83
|
-
key={col.id}
|
|
84
|
-
disabled={
|
|
85
|
-
col.computedVisible && api.getVisibleColumnsCount() === 1
|
|
86
|
-
}
|
|
87
|
-
checked={col.computedVisible}
|
|
88
|
-
onChange={(checked) => {
|
|
89
|
-
api.setVisibilityForColumn(col.id, !!checked);
|
|
90
|
-
}}
|
|
91
|
-
></InfiniteCheckBox>
|
|
92
|
-
),
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
columns: [
|
|
98
|
-
{
|
|
99
|
-
name: 'check',
|
|
100
|
-
},
|
|
101
|
-
{ name: 'label' },
|
|
102
|
-
],
|
|
103
|
-
items: colItems,
|
|
104
|
-
};
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
];
|
|
108
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { InfiniteTableColumn } from '../types';
|
|
2
|
-
import type {
|
|
3
|
-
InfiniteTableColumnType,
|
|
4
|
-
InfiniteTablePropColumnTypes,
|
|
5
|
-
} from '../types/InfiniteTableProps';
|
|
6
|
-
|
|
7
|
-
const emptyType: InfiniteTableColumnType<any> = Object.freeze({
|
|
8
|
-
filterType: 'string',
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export function getColumnComputedType<T>(
|
|
12
|
-
column: InfiniteTableColumn<T>,
|
|
13
|
-
columnTypes: InfiniteTablePropColumnTypes<T>,
|
|
14
|
-
): InfiniteTableColumnType<T> {
|
|
15
|
-
const defaultType: InfiniteTableColumnType<T> =
|
|
16
|
-
columnTypes['default'] || emptyType;
|
|
17
|
-
|
|
18
|
-
if (column.type === undefined) {
|
|
19
|
-
return defaultType;
|
|
20
|
-
}
|
|
21
|
-
if (column.type === null) {
|
|
22
|
-
return emptyType;
|
|
23
|
-
}
|
|
24
|
-
if (typeof column.type === 'string') {
|
|
25
|
-
const type = columnTypes[column.type] || emptyType;
|
|
26
|
-
|
|
27
|
-
return type;
|
|
28
|
-
}
|
|
29
|
-
return column.type.reduce(
|
|
30
|
-
(acc, columnType) => Object.assign(acc, columnTypes[columnType]),
|
|
31
|
-
{} as InfiniteTableColumnType<T>,
|
|
32
|
-
);
|
|
33
|
-
}
|