@infinite-table/infinite-react 5.0.0-canary.0 → 5.0.0-canary.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/index.css +10 -10
- package/index.d.ts +18 -1
- package/index.dev.js +263 -137
- package/index.dev.mjs +263 -137
- package/index.js +263 -137
- package/index.mjs +263 -137
- package/package.json +2 -2
package/index.dev.mjs
CHANGED
|
@@ -1364,7 +1364,7 @@ function stripVar(cssVariableWithVarString) {
|
|
|
1364
1364
|
}
|
|
1365
1365
|
|
|
1366
1366
|
// src/components/InfiniteTable/internalVars.css.ts
|
|
1367
|
-
var InternalVars = { currentColumnTransformX: "var(--currentColumnTransformX__16hkbkc0)", y: "var(--y__16hkbkc1)", activeCellRowOffset: "var(--activeCellRowOffset__16hkbkc2)", activeCellRowHeight: "var(--
|
|
1367
|
+
var InternalVars = { currentColumnTransformX: "var(--currentColumnTransformX__16hkbkc0)", y: "var(--y__16hkbkc1)", activeCellRowOffset: "var(--activeCellRowOffset__16hkbkc2)", activeCellRowOffsetX: "var(--activeCellRowOffsetX__16hkbkc3)", activeCellRowHeight: "var(--activeCellRowHeight__16hkbkc4)", activeCellOffsetX: "var(--activeCellOffsetX__16hkbkc5)", activeCellOffsetY: "var(--activeCellOffsetY__16hkbkc6)", scrollTopForActiveRow: "var(--scrollTopForActiveRow__16hkbkc7)", scrollLeftForActiveRowWhenHorizontalLayout: "var(--scrollLeftForActiveRowWhenHorizontalLayout__16hkbkc8)", activeCellColWidth: "var(--activeCellColWidth__16hkbkc9)", activeCellColOffset: "var(--activeCellColOffset__16hkbkca)", columnReorderEffectDurationAtIndex: "var(--columnReorderEffectDurationAtIndex__16hkbkcb)", columnWidthAtIndex: "var(--columnWidthAtIndex__16hkbkcc)", columnOffsetAtIndex: "var(--columnOffsetAtIndex__16hkbkcd)", columnOffsetAtIndexWhileReordering: "var(--columnOffsetAtIndexWhileReordering__16hkbkce)", columnZIndexAtIndex: "var(--columnZIndexAtIndex__16hkbkcf)", pinnedStartWidth: "var(--pinnedStartWidth__16hkbkcg)", pinnedEndWidth: "var(--pinnedEndWidth__16hkbkch)", pinnedEndOffset: "var(--pinnedEndOffset__16hkbkci)", computedVisibleColumnsCount: "var(--computedVisibleColumnsCount__16hkbkcj)", baseZIndexForCells: "var(--baseZIndexForCells__16hkbkck)", bodyWidth: "var(--bodyWidth__16hkbkcl)", bodyHeight: "var(--bodyHeight__16hkbkcm)", scrollbarWidthHorizontal: "var(--scrollbarWidthHorizontal__16hkbkcn)", scrollbarWidthVertical: "var(--scrollbarWidthVertical__16hkbkco)", scrollLeft: "var(--scrollLeft__16hkbkcp)", scrollTop: "var(--scrollTop__16hkbkcq)" };
|
|
1368
1368
|
|
|
1369
1369
|
// src/utils/selectParent.ts
|
|
1370
1370
|
function selectParent(el, selector2) {
|
|
@@ -3076,11 +3076,13 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3076
3076
|
return { start: startRow, end: endRow };
|
|
3077
3077
|
};
|
|
3078
3078
|
this.getScrollPositionForScrollRowIntoView = (rowIndex, config = { offset: 0 }) => {
|
|
3079
|
+
var _a;
|
|
3079
3080
|
if (this.destroyed) {
|
|
3080
3081
|
return null;
|
|
3081
3082
|
}
|
|
3082
3083
|
const { brain } = this;
|
|
3083
3084
|
const scrollPosition = brain.getScrollPosition();
|
|
3085
|
+
let scrollLeft2 = scrollPosition.scrollLeft;
|
|
3084
3086
|
let { scrollAdjustPosition, offset = 0 } = config;
|
|
3085
3087
|
if (this.isRowFullyVisible(rowIndex) && !scrollAdjustPosition) {
|
|
3086
3088
|
return scrollPosition;
|
|
@@ -3110,9 +3112,22 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3110
3112
|
offset += rowHeight;
|
|
3111
3113
|
scrollTop2 += rowOffset - bottom + offset + fixedEndRowsHeight;
|
|
3112
3114
|
}
|
|
3113
|
-
|
|
3115
|
+
if (this.brain.isHorizontalLayoutBrain) {
|
|
3116
|
+
const colIndex = (_a = config.colIndex) != null ? _a : Math.ceil(this.brain.getInitialCols() / 2);
|
|
3117
|
+
const colScrollPosition = this.getScrollPositionForScrollColumnIntoView(
|
|
3118
|
+
colIndex,
|
|
3119
|
+
__spreadProps(__spreadValues({}, config), {
|
|
3120
|
+
horizontalLayoutPageIndex: this.brain.getPageIndexForRow(rowIndex)
|
|
3121
|
+
})
|
|
3122
|
+
);
|
|
3123
|
+
if (colScrollPosition) {
|
|
3124
|
+
scrollLeft2 = colScrollPosition.scrollLeft;
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
return {
|
|
3128
|
+
scrollLeft: scrollLeft2,
|
|
3114
3129
|
scrollTop: scrollTop2
|
|
3115
|
-
}
|
|
3130
|
+
};
|
|
3116
3131
|
};
|
|
3117
3132
|
this.getScrollPositionForScrollColumnIntoView = (colIndex, config = { offset: 0 }) => {
|
|
3118
3133
|
if (this.destroyed) {
|
|
@@ -4223,9 +4238,9 @@ var HorizontalLayoutTableRenderer = class extends ReactHeadlessTableRenderer {
|
|
|
4223
4238
|
element.style.setProperty(currentTransformY, currentTransformYValue);
|
|
4224
4239
|
}
|
|
4225
4240
|
const xOffset = `calc(var(${columnOffsetX}) + ${pageOffset})`;
|
|
4226
|
-
const
|
|
4241
|
+
const transformX2 = `var(${columnOffsetXWhileReordering}, ${xOffset})`;
|
|
4227
4242
|
const transformY = `var(${currentTransformY})`;
|
|
4228
|
-
const transformValue = `translate3d(${
|
|
4243
|
+
const transformValue = `translate3d(${transformX2}, ${transformY}, 0px)`;
|
|
4229
4244
|
if (element.__transformValue !== transformValue) {
|
|
4230
4245
|
element.__transformValue = transformValue;
|
|
4231
4246
|
element.style.transform = transformValue;
|
|
@@ -4349,46 +4364,169 @@ var useRerender = () => {
|
|
|
4349
4364
|
var ActiveCellIndicatorCls = { visible: "ActiveCellIndicator_ActiveCellIndicatorCls_visible__nxbq1c2 ActiveCellIndicator_ActiveCellIndicator__nxbq1c1 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2", hidden: "ActiveCellIndicator_ActiveCellIndicatorCls_hidden__nxbq1c3 ActiveCellIndicator_ActiveCellIndicator__nxbq1c1 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2" };
|
|
4350
4365
|
var ActiveIndicatorWrapperCls = "ActiveCellIndicator_ActiveIndicatorWrapperCls__nxbq1c0 utilities_pointerEvents_none__16lm1iwl utilities_position_sticky__16lm1iw4 utilities_left_0__16lm1iw1e utilities_top_0__16lm1iw1c utilities_height_0__16lm1iw18 utilities_zIndex_1000000__16lm1iwu";
|
|
4351
4366
|
|
|
4367
|
+
// ../node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js
|
|
4368
|
+
function toPrimitive(t, r) {
|
|
4369
|
+
if ("object" != typeof t || !t)
|
|
4370
|
+
return t;
|
|
4371
|
+
var e = t[Symbol.toPrimitive];
|
|
4372
|
+
if (void 0 !== e) {
|
|
4373
|
+
var i = e.call(t, r || "default");
|
|
4374
|
+
if ("object" != typeof i)
|
|
4375
|
+
return i;
|
|
4376
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
4377
|
+
}
|
|
4378
|
+
return ("string" === r ? String : Number)(t);
|
|
4379
|
+
}
|
|
4380
|
+
function toPropertyKey(t) {
|
|
4381
|
+
var i = toPrimitive(t, "string");
|
|
4382
|
+
return "symbol" == typeof i ? i : String(i);
|
|
4383
|
+
}
|
|
4384
|
+
function _defineProperty(obj, key, value) {
|
|
4385
|
+
key = toPropertyKey(key);
|
|
4386
|
+
if (key in obj) {
|
|
4387
|
+
Object.defineProperty(obj, key, {
|
|
4388
|
+
value,
|
|
4389
|
+
enumerable: true,
|
|
4390
|
+
configurable: true,
|
|
4391
|
+
writable: true
|
|
4392
|
+
});
|
|
4393
|
+
} else {
|
|
4394
|
+
obj[key] = value;
|
|
4395
|
+
}
|
|
4396
|
+
return obj;
|
|
4397
|
+
}
|
|
4398
|
+
function ownKeys(e, r) {
|
|
4399
|
+
var t = Object.keys(e);
|
|
4400
|
+
if (Object.getOwnPropertySymbols) {
|
|
4401
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
4402
|
+
r && (o = o.filter(function(r2) {
|
|
4403
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
4404
|
+
})), t.push.apply(t, o);
|
|
4405
|
+
}
|
|
4406
|
+
return t;
|
|
4407
|
+
}
|
|
4408
|
+
function _objectSpread2(e) {
|
|
4409
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
4410
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
4411
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
4412
|
+
_defineProperty(e, r2, t[r2]);
|
|
4413
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
4414
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
4415
|
+
});
|
|
4416
|
+
}
|
|
4417
|
+
return e;
|
|
4418
|
+
}
|
|
4419
|
+
function mapValues(input, fn) {
|
|
4420
|
+
var result = {};
|
|
4421
|
+
for (var _key in input) {
|
|
4422
|
+
result[_key] = fn(input[_key], _key);
|
|
4423
|
+
}
|
|
4424
|
+
return result;
|
|
4425
|
+
}
|
|
4426
|
+
var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
|
|
4427
|
+
for (var key of Object.keys(compoundCheck)) {
|
|
4428
|
+
var _selections$key;
|
|
4429
|
+
if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
|
|
4430
|
+
return false;
|
|
4431
|
+
}
|
|
4432
|
+
}
|
|
4433
|
+
return true;
|
|
4434
|
+
};
|
|
4435
|
+
var createRuntimeFn = (config) => {
|
|
4436
|
+
var runtimeFn = (options) => {
|
|
4437
|
+
var className = config.defaultClassName;
|
|
4438
|
+
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
4439
|
+
for (var variantName in selections) {
|
|
4440
|
+
var _selections$variantNa;
|
|
4441
|
+
var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
4442
|
+
if (variantSelection != null) {
|
|
4443
|
+
var selection = variantSelection;
|
|
4444
|
+
if (typeof selection === "boolean") {
|
|
4445
|
+
selection = selection === true ? "true" : "false";
|
|
4446
|
+
}
|
|
4447
|
+
var selectionClassName = (
|
|
4448
|
+
// @ts-expect-error
|
|
4449
|
+
config.variantClassNames[variantName][selection]
|
|
4450
|
+
);
|
|
4451
|
+
if (selectionClassName) {
|
|
4452
|
+
className += " " + selectionClassName;
|
|
4453
|
+
}
|
|
4454
|
+
}
|
|
4455
|
+
}
|
|
4456
|
+
for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
4457
|
+
if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
|
|
4458
|
+
className += " " + compoundClassName;
|
|
4459
|
+
}
|
|
4460
|
+
}
|
|
4461
|
+
return className;
|
|
4462
|
+
};
|
|
4463
|
+
runtimeFn.variants = () => Object.keys(config.variantClassNames);
|
|
4464
|
+
runtimeFn.classNames = {
|
|
4465
|
+
get base() {
|
|
4466
|
+
return config.defaultClassName.split(" ")[0];
|
|
4467
|
+
},
|
|
4468
|
+
get variants() {
|
|
4469
|
+
return mapValues(config.variantClassNames, (classNames) => mapValues(classNames, (className) => className.split(" ")[0]));
|
|
4470
|
+
}
|
|
4471
|
+
};
|
|
4472
|
+
return runtimeFn;
|
|
4473
|
+
};
|
|
4474
|
+
|
|
4352
4475
|
// src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
|
|
4353
|
-
var
|
|
4476
|
+
var ActiveRowIndicatorRecipe = createRuntimeFn({ defaultClassName: "ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e", variantClassNames: { active: { true: "ActiveRowIndicator_ActiveRowIndicatorRecipe_active_true__j26lrx2", false: "ActiveRowIndicator_ActiveRowIndicatorRecipe_active_false__j26lrx3" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4354
4477
|
|
|
4355
4478
|
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
4356
4479
|
var { rootClassName: rootClassName3 } = internalProps;
|
|
4357
4480
|
var baseCls = `${rootClassName3}-ActiveRowIndicator`;
|
|
4481
|
+
var transformX = `calc(${InternalVars.activeCellRowOffsetX} + var(${stripVar(
|
|
4482
|
+
InternalVars.scrollLeftForActiveRowWhenHorizontalLayout
|
|
4483
|
+
)}, 0px))`;
|
|
4358
4484
|
var ActiveStyle = {
|
|
4359
4485
|
[stripVar(InternalVars.activeCellOffsetY)]: InternalVars.activeCellRowOffset,
|
|
4360
|
-
transform: `translate3d(
|
|
4486
|
+
transform: `translate3d(${transformX}, calc( ${InternalVars.activeCellOffsetY} + var(${stripVar(InternalVars.scrollTopForActiveRow)}, 0px)), 0px)`,
|
|
4361
4487
|
height: InternalVars.activeCellRowHeight,
|
|
4362
4488
|
maxWidth: ThemeVars.runtime.totalVisibleColumnsWidthVar
|
|
4363
4489
|
};
|
|
4364
4490
|
var ActiveRowIndicatorFn = (props) => {
|
|
4365
4491
|
const { brain } = props;
|
|
4366
4492
|
const domRef = useRef5(null);
|
|
4367
|
-
const active = props.activeRowIndex != null && brain.
|
|
4493
|
+
const active = props.activeRowIndex != null && brain.getInitialRows() > props.activeRowIndex;
|
|
4368
4494
|
const [_rerenderId, rerender] = useRerender();
|
|
4369
4495
|
useLayoutEffect4(() => {
|
|
4370
4496
|
if (props.activeRowIndex == null) {
|
|
4371
4497
|
return;
|
|
4372
4498
|
}
|
|
4373
|
-
|
|
4499
|
+
let activeCellRowOffsetX = "0px";
|
|
4500
|
+
let rowIndex = props.activeRowIndex;
|
|
4501
|
+
if (brain.isHorizontalLayoutBrain && brain.rowsPerPage) {
|
|
4502
|
+
const pageIndex = brain.getPageIndexForRow(rowIndex);
|
|
4503
|
+
if (pageIndex > 0) {
|
|
4504
|
+
activeCellRowOffsetX = `calc(${ThemeVars.runtime.totalVisibleColumnsWidthVar} * ${pageIndex})`;
|
|
4505
|
+
}
|
|
4506
|
+
rowIndex = rowIndex % brain.rowsPerPage;
|
|
4507
|
+
}
|
|
4374
4508
|
const activeCellRowHeight = brain.getRowHeight(rowIndex);
|
|
4375
4509
|
const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
|
|
4376
4510
|
const node = domRef.current;
|
|
4377
4511
|
const vars = {
|
|
4378
4512
|
activeCellRowHeight: `${activeCellRowHeight}px`,
|
|
4379
|
-
activeCellRowOffset: `${activeCellRowOffset}px
|
|
4513
|
+
activeCellRowOffset: `${activeCellRowOffset}px`,
|
|
4514
|
+
activeCellRowOffsetX
|
|
4380
4515
|
};
|
|
4381
4516
|
setInfiniteVarsOnNode(vars, node);
|
|
4382
|
-
}, [props.activeRowIndex]);
|
|
4517
|
+
}, [props.activeRowIndex, brain]);
|
|
4383
4518
|
useEffect5(() => {
|
|
4384
|
-
const
|
|
4519
|
+
const updateVars = (scrollPosition) => {
|
|
4385
4520
|
setInfiniteVarsOnNode(
|
|
4386
4521
|
{
|
|
4387
|
-
scrollTopForActiveRow: `${-scrollPosition.scrollTop}px
|
|
4522
|
+
scrollTopForActiveRow: `${-scrollPosition.scrollTop}px`,
|
|
4523
|
+
scrollLeftForActiveRowWhenHorizontalLayout: `${-scrollPosition.scrollLeft}px`
|
|
4388
4524
|
},
|
|
4389
4525
|
domRef.current
|
|
4390
4526
|
);
|
|
4391
|
-
}
|
|
4527
|
+
};
|
|
4528
|
+
updateVars(brain.getScrollPosition());
|
|
4529
|
+
const removeOnScroll = brain.onScroll(updateVars);
|
|
4392
4530
|
const removeOnRenderCountChange = brain.onRenderCountChange(rerender);
|
|
4393
4531
|
return () => {
|
|
4394
4532
|
removeOnRenderCountChange();
|
|
@@ -4402,7 +4540,9 @@ var ActiveRowIndicatorFn = (props) => {
|
|
|
4402
4540
|
{
|
|
4403
4541
|
ref: domRef,
|
|
4404
4542
|
"data-name": "active-row-indicator",
|
|
4405
|
-
className: `${baseCls} ${
|
|
4543
|
+
className: `${baseCls} ${ActiveRowIndicatorRecipe({
|
|
4544
|
+
active
|
|
4545
|
+
})}`,
|
|
4406
4546
|
style: active ? ActiveStyle : void 0
|
|
4407
4547
|
}
|
|
4408
4548
|
))
|
|
@@ -4444,7 +4584,7 @@ var ActiveCellIndicatorFn = (props) => {
|
|
|
4444
4584
|
const active = props.activeCellIndex != null && brain.getInitialRows() > props.activeCellIndex[0];
|
|
4445
4585
|
useLayoutEffect5(() => {
|
|
4446
4586
|
reposition(brain, props.activeCellIndex, props.rowHeight, domRef);
|
|
4447
|
-
}, [props.activeCellIndex, props.rowHeight]);
|
|
4587
|
+
}, [props.activeCellIndex, props.rowHeight, brain]);
|
|
4448
4588
|
useEffect6(() => {
|
|
4449
4589
|
const removeOnRenderCountChange = brain.onRenderCountChange(() => {
|
|
4450
4590
|
rerender();
|
|
@@ -5216,114 +5356,6 @@ var useInfiniteTableState = () => {
|
|
|
5216
5356
|
import * as React26 from "react";
|
|
5217
5357
|
import { useEffect as useEffect10, useLayoutEffect as useLayoutEffect8, useState as useState5 } from "react";
|
|
5218
5358
|
|
|
5219
|
-
// ../node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js
|
|
5220
|
-
function toPrimitive(t, r) {
|
|
5221
|
-
if ("object" != typeof t || !t)
|
|
5222
|
-
return t;
|
|
5223
|
-
var e = t[Symbol.toPrimitive];
|
|
5224
|
-
if (void 0 !== e) {
|
|
5225
|
-
var i = e.call(t, r || "default");
|
|
5226
|
-
if ("object" != typeof i)
|
|
5227
|
-
return i;
|
|
5228
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5229
|
-
}
|
|
5230
|
-
return ("string" === r ? String : Number)(t);
|
|
5231
|
-
}
|
|
5232
|
-
function toPropertyKey(t) {
|
|
5233
|
-
var i = toPrimitive(t, "string");
|
|
5234
|
-
return "symbol" == typeof i ? i : String(i);
|
|
5235
|
-
}
|
|
5236
|
-
function _defineProperty(obj, key, value) {
|
|
5237
|
-
key = toPropertyKey(key);
|
|
5238
|
-
if (key in obj) {
|
|
5239
|
-
Object.defineProperty(obj, key, {
|
|
5240
|
-
value,
|
|
5241
|
-
enumerable: true,
|
|
5242
|
-
configurable: true,
|
|
5243
|
-
writable: true
|
|
5244
|
-
});
|
|
5245
|
-
} else {
|
|
5246
|
-
obj[key] = value;
|
|
5247
|
-
}
|
|
5248
|
-
return obj;
|
|
5249
|
-
}
|
|
5250
|
-
function ownKeys(e, r) {
|
|
5251
|
-
var t = Object.keys(e);
|
|
5252
|
-
if (Object.getOwnPropertySymbols) {
|
|
5253
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
5254
|
-
r && (o = o.filter(function(r2) {
|
|
5255
|
-
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
5256
|
-
})), t.push.apply(t, o);
|
|
5257
|
-
}
|
|
5258
|
-
return t;
|
|
5259
|
-
}
|
|
5260
|
-
function _objectSpread2(e) {
|
|
5261
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
5262
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
5263
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
5264
|
-
_defineProperty(e, r2, t[r2]);
|
|
5265
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
5266
|
-
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
5267
|
-
});
|
|
5268
|
-
}
|
|
5269
|
-
return e;
|
|
5270
|
-
}
|
|
5271
|
-
function mapValues(input, fn) {
|
|
5272
|
-
var result = {};
|
|
5273
|
-
for (var _key in input) {
|
|
5274
|
-
result[_key] = fn(input[_key], _key);
|
|
5275
|
-
}
|
|
5276
|
-
return result;
|
|
5277
|
-
}
|
|
5278
|
-
var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
|
|
5279
|
-
for (var key of Object.keys(compoundCheck)) {
|
|
5280
|
-
var _selections$key;
|
|
5281
|
-
if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
|
|
5282
|
-
return false;
|
|
5283
|
-
}
|
|
5284
|
-
}
|
|
5285
|
-
return true;
|
|
5286
|
-
};
|
|
5287
|
-
var createRuntimeFn = (config) => {
|
|
5288
|
-
var runtimeFn = (options) => {
|
|
5289
|
-
var className = config.defaultClassName;
|
|
5290
|
-
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
5291
|
-
for (var variantName in selections) {
|
|
5292
|
-
var _selections$variantNa;
|
|
5293
|
-
var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
5294
|
-
if (variantSelection != null) {
|
|
5295
|
-
var selection = variantSelection;
|
|
5296
|
-
if (typeof selection === "boolean") {
|
|
5297
|
-
selection = selection === true ? "true" : "false";
|
|
5298
|
-
}
|
|
5299
|
-
var selectionClassName = (
|
|
5300
|
-
// @ts-expect-error
|
|
5301
|
-
config.variantClassNames[variantName][selection]
|
|
5302
|
-
);
|
|
5303
|
-
if (selectionClassName) {
|
|
5304
|
-
className += " " + selectionClassName;
|
|
5305
|
-
}
|
|
5306
|
-
}
|
|
5307
|
-
}
|
|
5308
|
-
for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
5309
|
-
if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
|
|
5310
|
-
className += " " + compoundClassName;
|
|
5311
|
-
}
|
|
5312
|
-
}
|
|
5313
|
-
return className;
|
|
5314
|
-
};
|
|
5315
|
-
runtimeFn.variants = () => Object.keys(config.variantClassNames);
|
|
5316
|
-
runtimeFn.classNames = {
|
|
5317
|
-
get base() {
|
|
5318
|
-
return config.defaultClassName.split(" ")[0];
|
|
5319
|
-
},
|
|
5320
|
-
get variants() {
|
|
5321
|
-
return mapValues(config.variantClassNames, (classNames) => mapValues(classNames, (className) => className.split(" ")[0]));
|
|
5322
|
-
}
|
|
5323
|
-
};
|
|
5324
|
-
return runtimeFn;
|
|
5325
|
-
};
|
|
5326
|
-
|
|
5327
5359
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
5328
5360
|
var CellCls = "cell_CellCls__1eexc2a5 utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1o utilities_alignItems_center__16lm1iw1q utilities_position_absolute__16lm1iw2 utilities_willChange_transform__16lm1iw22 utilities_whiteSpace_nowrap__16lm1iw23 utilities_userSelect_none__16lm1iw17";
|
|
5329
5361
|
var HeaderCellContentRecipe = createRuntimeFn({ defaultClassName: "header_HeaderCellContentRecipe__12zfob122 utilities_height_100%__16lm1iw19 utilities_width_100%__16lm1iw1b utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1o utilities_alignItems_center__16lm1iw1q utilities_justifyContent_start__16lm1iw1v", variantClassNames: { filtered: { false: "header_HeaderCellContentRecipe_filtered_false__12zfob123", true: "header_HeaderCellContentRecipe_filtered_true__12zfob124" }, verticalAlign: { start: "header_HeaderCellContentRecipe_verticalAlign_start__12zfob125", end: "header_HeaderCellContentRecipe_verticalAlign_end__12zfob126", center: "header_HeaderCellContentRecipe_verticalAlign_center__12zfob127" }, align: { start: "header_HeaderCellContentRecipe_align_start__12zfob128", end: "header_HeaderCellContentRecipe_align_end__12zfob129", center: "header_HeaderCellContentRecipe_align_center__12zfob12a" } }, defaultVariants: {}, compoundVariants: [] });
|
|
@@ -8757,6 +8789,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
8757
8789
|
if (inEdit) {
|
|
8758
8790
|
return null;
|
|
8759
8791
|
}
|
|
8792
|
+
renderParamRef.current = renderParam;
|
|
8760
8793
|
if (renderFunctions.renderGroupIcon) {
|
|
8761
8794
|
renderParam.renderBag.groupIcon = /* @__PURE__ */ React36.createElement(
|
|
8762
8795
|
RenderCellHookComponent,
|
|
@@ -8970,6 +9003,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
8970
9003
|
bottom: bottomSelectionBorder
|
|
8971
9004
|
} : null;
|
|
8972
9005
|
const afterChildren = editor;
|
|
9006
|
+
const theChildren = renderChildren();
|
|
8973
9007
|
const cellProps = {
|
|
8974
9008
|
domRef,
|
|
8975
9009
|
cellType: "body",
|
|
@@ -9008,7 +9042,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
9008
9042
|
colClassName,
|
|
9009
9043
|
rowComputedClassName
|
|
9010
9044
|
),
|
|
9011
|
-
renderChildren
|
|
9045
|
+
renderChildren: useCallback12(() => theChildren, [renderChildren])
|
|
9012
9046
|
};
|
|
9013
9047
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
9014
9048
|
return (
|
|
@@ -10800,7 +10834,7 @@ function lazyGroup(groupParams, rootData) {
|
|
|
10800
10834
|
rootData.visitDepthFirst(
|
|
10801
10835
|
(lazyGroupRowInfo, keys, _index, next) => {
|
|
10802
10836
|
const [_rootKey, ...currentGroupKeys] = keys;
|
|
10803
|
-
|
|
10837
|
+
let dataArray = lazyGroupRowInfo.children;
|
|
10804
10838
|
const current = deepMap.get(currentGroupKeys);
|
|
10805
10839
|
if (current) {
|
|
10806
10840
|
current.cache = lazyGroupRowInfo.cache;
|
|
@@ -10823,10 +10857,11 @@ function lazyGroup(groupParams, rootData) {
|
|
|
10823
10857
|
);
|
|
10824
10858
|
}
|
|
10825
10859
|
}
|
|
10826
|
-
indexer.indexArray(dataArray, {
|
|
10860
|
+
const res = indexer.indexArray(dataArray, {
|
|
10827
10861
|
toPrimaryKey,
|
|
10828
10862
|
cache
|
|
10829
10863
|
});
|
|
10864
|
+
dataArray = res;
|
|
10830
10865
|
}
|
|
10831
10866
|
return next == null ? void 0 : next();
|
|
10832
10867
|
}
|
|
@@ -12819,11 +12854,15 @@ var Indexer = class {
|
|
|
12819
12854
|
};
|
|
12820
12855
|
this.indexArray = (arr, options) => {
|
|
12821
12856
|
const { cache, toPrimaryKey } = options;
|
|
12857
|
+
if (cache && cache.shouldResetDataSource()) {
|
|
12858
|
+
this.clear();
|
|
12859
|
+
arr = [];
|
|
12860
|
+
}
|
|
12822
12861
|
if (cache && !cache.isEmpty()) {
|
|
12823
12862
|
arr = arr.concat();
|
|
12824
12863
|
}
|
|
12825
12864
|
if (!arr.length && cache) {
|
|
12826
|
-
const cacheInfo =
|
|
12865
|
+
const cacheInfo = cache.getMutationsArray();
|
|
12827
12866
|
if (cacheInfo && cacheInfo.length) {
|
|
12828
12867
|
for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
|
|
12829
12868
|
const info = cacheInfo[cacheIndex];
|
|
@@ -13136,6 +13175,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
13136
13175
|
}
|
|
13137
13176
|
|
|
13138
13177
|
// src/components/DataSource/DataSourceCache.ts
|
|
13178
|
+
var CLEAR_SYMBOL = Symbol("CLEAR");
|
|
13139
13179
|
var DataSourceCache = class {
|
|
13140
13180
|
constructor() {
|
|
13141
13181
|
this.affectedFields = /* @__PURE__ */ new Set();
|
|
@@ -13189,6 +13229,21 @@ var DataSourceCache = class {
|
|
|
13189
13229
|
});
|
|
13190
13230
|
this.primaryKeyToData.set(primaryKey, value);
|
|
13191
13231
|
};
|
|
13232
|
+
this.resetDataSource = (metadata) => {
|
|
13233
|
+
this.clear();
|
|
13234
|
+
this.allFieldsAffected = true;
|
|
13235
|
+
const pk = CLEAR_SYMBOL;
|
|
13236
|
+
const value = this.primaryKeyToData.get(pk) || [];
|
|
13237
|
+
value.push({
|
|
13238
|
+
type: "clear-all",
|
|
13239
|
+
primaryKey: void 0,
|
|
13240
|
+
metadata
|
|
13241
|
+
});
|
|
13242
|
+
this.primaryKeyToData.set(pk, value);
|
|
13243
|
+
};
|
|
13244
|
+
this.shouldResetDataSource = () => {
|
|
13245
|
+
return this.primaryKeyToData.has(CLEAR_SYMBOL);
|
|
13246
|
+
};
|
|
13192
13247
|
this.clear = () => {
|
|
13193
13248
|
this.allFieldsAffected = false;
|
|
13194
13249
|
this.affectedFields.clear();
|
|
@@ -13204,9 +13259,15 @@ var DataSourceCache = class {
|
|
|
13204
13259
|
const data = this.primaryKeyToData.get(primaryKey);
|
|
13205
13260
|
return data;
|
|
13206
13261
|
};
|
|
13262
|
+
this.getMutationsCount = () => {
|
|
13263
|
+
return this.primaryKeyToData.size;
|
|
13264
|
+
};
|
|
13207
13265
|
this.getMutations = () => {
|
|
13208
13266
|
return new Map(this.primaryKeyToData);
|
|
13209
13267
|
};
|
|
13268
|
+
this.getMutationsArray = () => {
|
|
13269
|
+
return Array.from(this.primaryKeyToData.values()).flat();
|
|
13270
|
+
};
|
|
13210
13271
|
}
|
|
13211
13272
|
static clone(cache, { light = false } = {}) {
|
|
13212
13273
|
const clone = new DataSourceCache();
|
|
@@ -13468,6 +13529,32 @@ var DataSourceApiImpl = class {
|
|
|
13468
13529
|
const { indexer } = this.getState();
|
|
13469
13530
|
return (_a = indexer.getDataForPrimaryKey(id)) != null ? _a : null;
|
|
13470
13531
|
};
|
|
13532
|
+
/**
|
|
13533
|
+
* Replaces all data in the DataSource with the provided data.
|
|
13534
|
+
* @param data - The new data to replace the existing data with.
|
|
13535
|
+
* @param options - Additional options for the operation.
|
|
13536
|
+
* @param options.flush - If true, the mutations will be flushed immediately.
|
|
13537
|
+
* @param options.metadata - Additional metadata for the operation.
|
|
13538
|
+
* @returns A promise that resolves when the operation is complete.
|
|
13539
|
+
*/
|
|
13540
|
+
this.replaceAllData = (data, options) => {
|
|
13541
|
+
this.batchOperation({
|
|
13542
|
+
type: "replace-all",
|
|
13543
|
+
array: data,
|
|
13544
|
+
metadata: options == null ? void 0 : options.metadata
|
|
13545
|
+
});
|
|
13546
|
+
return this.addDataArray(data, options);
|
|
13547
|
+
};
|
|
13548
|
+
/**
|
|
13549
|
+
* Clears all data in the DataSource.
|
|
13550
|
+
* @param options - Additional options for the operation.
|
|
13551
|
+
* @param options.flush - If true, the mutations will be flushed immediately.
|
|
13552
|
+
* @param options.metadata - Additional metadata for the operation.
|
|
13553
|
+
* @returns A promise that resolves when the operation is complete.
|
|
13554
|
+
*/
|
|
13555
|
+
this.clearAllData = (options) => {
|
|
13556
|
+
return this.replaceAllData([], options);
|
|
13557
|
+
};
|
|
13471
13558
|
this.updateData = (data, options) => {
|
|
13472
13559
|
return this.updateDataArray([data], options);
|
|
13473
13560
|
};
|
|
@@ -13663,12 +13750,12 @@ var DataSourceApiImpl = class {
|
|
|
13663
13750
|
}, delay);
|
|
13664
13751
|
}
|
|
13665
13752
|
}
|
|
13753
|
+
if (operation.type === "replace-all") {
|
|
13754
|
+
this.pendingOperations.length = 0;
|
|
13755
|
+
}
|
|
13666
13756
|
this.pendingOperations.push(operation);
|
|
13667
13757
|
return this.pendingPromise;
|
|
13668
13758
|
}
|
|
13669
|
-
batchOperations(operations) {
|
|
13670
|
-
this.pendingOperations.push(...operations);
|
|
13671
|
-
}
|
|
13672
13759
|
commitOperations(operations) {
|
|
13673
13760
|
if (!operations.length) {
|
|
13674
13761
|
return;
|
|
@@ -13708,14 +13795,21 @@ var DataSourceApiImpl = class {
|
|
|
13708
13795
|
position2 = "after";
|
|
13709
13796
|
});
|
|
13710
13797
|
break;
|
|
13798
|
+
case "replace-all":
|
|
13799
|
+
cache.resetDataSource(operation.metadata);
|
|
13800
|
+
break;
|
|
13711
13801
|
}
|
|
13712
13802
|
});
|
|
13713
13803
|
this.actions.cache = cache;
|
|
13714
13804
|
}
|
|
13805
|
+
flush() {
|
|
13806
|
+
return this.commit();
|
|
13807
|
+
}
|
|
13715
13808
|
commit() {
|
|
13716
13809
|
this.commitOperations(this.pendingOperations);
|
|
13717
13810
|
this.pendingOperations.length = 0;
|
|
13718
|
-
|
|
13811
|
+
const pendingPromise = this.pendingPromise;
|
|
13812
|
+
if (pendingPromise && this.resolvePendingPromise) {
|
|
13719
13813
|
const resolve = this.resolvePendingPromise;
|
|
13720
13814
|
requestAnimationFrame(() => {
|
|
13721
13815
|
resolve(true);
|
|
@@ -13723,6 +13817,7 @@ var DataSourceApiImpl = class {
|
|
|
13723
13817
|
this.pendingPromise = null;
|
|
13724
13818
|
this.resolvePendingPromise = null;
|
|
13725
13819
|
}
|
|
13820
|
+
return pendingPromise || Promise.resolve(true);
|
|
13726
13821
|
}
|
|
13727
13822
|
};
|
|
13728
13823
|
function getCacheAffectedParts(state) {
|
|
@@ -16988,22 +17083,35 @@ var InfiniteTableApiImpl = class {
|
|
|
16988
17083
|
state.scrollerDOMRef.current.scrollTop = Math.max(scrollTop2, 0);
|
|
16989
17084
|
}
|
|
16990
17085
|
scrollRowIntoView(rowIndex, config = { offset: 0 }) {
|
|
17086
|
+
var _a;
|
|
16991
17087
|
const state = this.getState();
|
|
17088
|
+
const computed = this.getComputed();
|
|
17089
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
17090
|
+
let columnId = config.columnId;
|
|
17091
|
+
let colIndex = void 0;
|
|
17092
|
+
if (!columnId && state.brain.isHorizontalLayoutBrain && computed.computedVisibleColumns.length > 0) {
|
|
17093
|
+
columnId = computed.computedVisibleColumns[Math.ceil(computed.computedVisibleColumns.length / 2)].id;
|
|
17094
|
+
colIndex = (_a = computed.computedVisibleColumnsMap.get(columnId)) == null ? void 0 : _a.computedVisibleIndex;
|
|
17095
|
+
}
|
|
16992
17096
|
const scrollPosition = state.renderer.getScrollPositionForScrollRowIntoView(
|
|
16993
17097
|
rowIndex,
|
|
16994
|
-
config
|
|
17098
|
+
__spreadProps(__spreadValues({}, config), { colIndex })
|
|
16995
17099
|
);
|
|
16996
17100
|
if (!scrollPosition) {
|
|
16997
17101
|
return false;
|
|
16998
17102
|
}
|
|
16999
|
-
const currentScrollPosition = state.brain.getScrollPosition();
|
|
17000
17103
|
const scrollTopMax = state.brain.scrollTopMax;
|
|
17001
|
-
|
|
17104
|
+
const scrollLeftChanged = scrollPosition.scrollLeft !== currentScrollPosition.scrollLeft;
|
|
17105
|
+
const scrollTopValid = scrollPosition.scrollTop <= scrollTopMax + (config.offset || 0);
|
|
17106
|
+
if (!scrollTopValid && !scrollLeftChanged) {
|
|
17002
17107
|
return false;
|
|
17003
17108
|
}
|
|
17004
|
-
if (scrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
|
|
17109
|
+
if (scrollTopValid && scrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
|
|
17005
17110
|
state.scrollerDOMRef.current.scrollTop = scrollPosition.scrollTop;
|
|
17006
17111
|
}
|
|
17112
|
+
if (scrollLeftChanged) {
|
|
17113
|
+
state.scrollerDOMRef.current.scrollLeft = scrollPosition.scrollLeft;
|
|
17114
|
+
}
|
|
17007
17115
|
return true;
|
|
17008
17116
|
}
|
|
17009
17117
|
scrollColumnIntoView(columnId, config = { offset: 0 }) {
|
|
@@ -19691,7 +19799,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
19691
19799
|
}
|
|
19692
19800
|
let valid2 = isValidLicense(licenseKey, {
|
|
19693
19801
|
publishedAt: 1624970570587,
|
|
19694
|
-
version: "5.0.0-canary.
|
|
19802
|
+
version: "5.0.0-canary.2"
|
|
19695
19803
|
});
|
|
19696
19804
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
19697
19805
|
return true;
|
|
@@ -19952,6 +20060,15 @@ function handleRowNavigation(options, event) {
|
|
|
19952
20060
|
},
|
|
19953
20061
|
ArrowLeft: () => {
|
|
19954
20062
|
const rowInfo = dataArray[activeRowIndex];
|
|
20063
|
+
if (brain.isHorizontalLayoutBrain) {
|
|
20064
|
+
const rowsPerPage = brain.rowsPerPage;
|
|
20065
|
+
if (activeRowIndex - rowsPerPage >= min) {
|
|
20066
|
+
activeRowIndex = activeRowIndex - rowsPerPage;
|
|
20067
|
+
} else {
|
|
20068
|
+
KeyToFunction.ArrowUp();
|
|
20069
|
+
}
|
|
20070
|
+
return;
|
|
20071
|
+
}
|
|
19955
20072
|
if (rowInfo && rowInfo.isGroupRow) {
|
|
19956
20073
|
return api.collapseGroupRow(rowInfo.groupKeys);
|
|
19957
20074
|
}
|
|
@@ -19962,6 +20079,15 @@ function handleRowNavigation(options, event) {
|
|
|
19962
20079
|
},
|
|
19963
20080
|
ArrowRight: () => {
|
|
19964
20081
|
const rowInfo = dataArray[activeRowIndex];
|
|
20082
|
+
if (brain.isHorizontalLayoutBrain) {
|
|
20083
|
+
const rowsPerPage = brain.rowsPerPage;
|
|
20084
|
+
if (activeRowIndex + rowsPerPage <= max) {
|
|
20085
|
+
activeRowIndex = activeRowIndex + rowsPerPage;
|
|
20086
|
+
} else {
|
|
20087
|
+
KeyToFunction.ArrowDown();
|
|
20088
|
+
}
|
|
20089
|
+
return;
|
|
20090
|
+
}
|
|
19965
20091
|
if (rowInfo && rowInfo.isGroupRow) {
|
|
19966
20092
|
return api.expandGroupRow(rowInfo.groupKeys);
|
|
19967
20093
|
}
|