@knime/kds-table 0.2.1 → 0.2.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/CHANGELOG.md +11 -0
- package/dist/index.css +141 -152
- package/dist/index.js +255 -29
- package/dist/index.js.map +1 -1
- package/dist/src/components/TableCore.vue.d.ts +2 -0
- package/dist/src/components/TableCore.vue.d.ts.map +1 -1
- package/dist/src/components/TableCoreVirtual.vue.d.ts +1 -0
- package/dist/src/components/TableCoreVirtual.vue.d.ts.map +1 -1
- package/dist/src/components/TableUI.vue.d.ts +53 -15
- package/dist/src/components/TableUI.vue.d.ts.map +1 -1
- package/dist/src/components/TableUIWithAutoSizeCalculation.vue.d.ts +53 -15
- package/dist/src/components/TableUIWithAutoSizeCalculation.vue.d.ts.map +1 -1
- package/dist/src/components/composables/useCommonScrollContainerProps.d.ts +7 -0
- package/dist/src/components/composables/useCommonScrollContainerProps.d.ts.map +1 -1
- package/dist/src/components/composables/useResizeScrollSpacer.d.ts +23 -0
- package/dist/src/components/composables/useResizeScrollSpacer.d.ts.map +1 -0
- package/dist/src/components/layout/Header.vue.d.ts +10 -3
- package/dist/src/components/layout/Header.vue.d.ts.map +1 -1
- package/dist/src/components/layout/useAutoScrollOnRightEdge.d.ts +24 -0
- package/dist/src/components/layout/useAutoScrollOnRightEdge.d.ts.map +1 -0
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, unref, watch, ref, isRef, getCurrentScope, onScopeDispose, getCurrentInstance, onMounted, inject, provide, defineComponent, openBlock, createElementBlock, withModifiers, renderSlot, toValue,
|
|
1
|
+
import { computed, unref, watch, ref, isRef, getCurrentScope, onScopeDispose, getCurrentInstance, onMounted, inject, provide, defineComponent, openBlock, createElementBlock, withModifiers, renderSlot, shallowRef, toValue, readonly, createPropsRestProxy, useModel, createBlock, mergeProps, mergeModels, useTemplateRef, watchEffect, nextTick, withCtx, createVNode, useAttrs, useId, Fragment, createCommentVNode, normalizeClass, createElementVNode, toDisplayString, resolveComponent, withKeys, normalizeStyle, renderList, onUnmounted, defineAsyncComponent, resolveDynamicComponent, h as h$1, useSlots, markRaw, createTextVNode, toRef, useCssVars, onBeforeUnmount, reactive, createSlots, normalizeProps, guardReactiveProps } from 'vue';
|
|
2
2
|
|
|
3
3
|
import './index.css';const defaultTimeFilter = "All time";
|
|
4
4
|
const checkTimeFilter = (inDateString, timeFilterConfig) => {
|
|
@@ -742,6 +742,67 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
742
742
|
};
|
|
743
743
|
}
|
|
744
744
|
|
|
745
|
+
//#endregion
|
|
746
|
+
//#region useRafFn/index.ts
|
|
747
|
+
/**
|
|
748
|
+
* Call function on every `requestAnimationFrame`. With controls of pausing and resuming.
|
|
749
|
+
*
|
|
750
|
+
* @see https://vueuse.org/useRafFn
|
|
751
|
+
* @param fn
|
|
752
|
+
* @param options
|
|
753
|
+
*/
|
|
754
|
+
function useRafFn(fn, options = {}) {
|
|
755
|
+
const { immediate = true, fpsLimit = null, window: window$1 = defaultWindow, once = false } = options;
|
|
756
|
+
const isActive = shallowRef(false);
|
|
757
|
+
const intervalLimit = computed(() => {
|
|
758
|
+
const limit = toValue(fpsLimit);
|
|
759
|
+
return limit ? 1e3 / limit : null;
|
|
760
|
+
});
|
|
761
|
+
let previousFrameTimestamp = 0;
|
|
762
|
+
let rafId = null;
|
|
763
|
+
function loop(timestamp$1) {
|
|
764
|
+
if (!isActive.value || !window$1) return;
|
|
765
|
+
if (!previousFrameTimestamp) previousFrameTimestamp = timestamp$1;
|
|
766
|
+
const delta = timestamp$1 - previousFrameTimestamp;
|
|
767
|
+
if (intervalLimit.value && delta < intervalLimit.value) {
|
|
768
|
+
rafId = window$1.requestAnimationFrame(loop);
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
previousFrameTimestamp = timestamp$1;
|
|
772
|
+
fn({
|
|
773
|
+
delta,
|
|
774
|
+
timestamp: timestamp$1
|
|
775
|
+
});
|
|
776
|
+
if (once) {
|
|
777
|
+
isActive.value = false;
|
|
778
|
+
rafId = null;
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
rafId = window$1.requestAnimationFrame(loop);
|
|
782
|
+
}
|
|
783
|
+
function resume() {
|
|
784
|
+
if (!isActive.value && window$1) {
|
|
785
|
+
isActive.value = true;
|
|
786
|
+
previousFrameTimestamp = 0;
|
|
787
|
+
rafId = window$1.requestAnimationFrame(loop);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
function pause() {
|
|
791
|
+
isActive.value = false;
|
|
792
|
+
if (rafId != null && window$1) {
|
|
793
|
+
window$1.cancelAnimationFrame(rafId);
|
|
794
|
+
rafId = null;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
if (immediate) resume();
|
|
798
|
+
tryOnScopeDispose(pause);
|
|
799
|
+
return {
|
|
800
|
+
isActive: readonly(isActive),
|
|
801
|
+
pause,
|
|
802
|
+
resume
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
|
|
745
806
|
//#endregion
|
|
746
807
|
//#region useResizeObserver/index.ts
|
|
747
808
|
/**
|
|
@@ -1692,7 +1753,7 @@ const _sfc_main$1t = /* @__PURE__ */ defineComponent({
|
|
|
1692
1753
|
}
|
|
1693
1754
|
});
|
|
1694
1755
|
|
|
1695
|
-
const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["__scopeId", "data-v-
|
|
1756
|
+
const BaseButton = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["__scopeId", "data-v-24ade73a"]]);
|
|
1696
1757
|
|
|
1697
1758
|
const _sfc_main$1s = /* @__PURE__ */ defineComponent({
|
|
1698
1759
|
__name: "KdsButton",
|
|
@@ -2767,7 +2828,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
2767
2828
|
}
|
|
2768
2829
|
});
|
|
2769
2830
|
|
|
2770
|
-
const KdsPopover = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["__scopeId", "data-v-
|
|
2831
|
+
const KdsPopover = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["__scopeId", "data-v-3354d162"]]);
|
|
2771
2832
|
|
|
2772
2833
|
const _sfc_main$1h = /* @__PURE__ */ defineComponent({
|
|
2773
2834
|
...{
|
|
@@ -10438,7 +10499,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
10438
10499
|
}
|
|
10439
10500
|
});
|
|
10440
10501
|
|
|
10441
|
-
const BaseCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-
|
|
10502
|
+
const BaseCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-0bec87ad"]]);
|
|
10442
10503
|
|
|
10443
10504
|
const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
10444
10505
|
__name: "KdsCheckbox",
|
|
@@ -14689,7 +14750,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
14689
14750
|
}
|
|
14690
14751
|
});
|
|
14691
14752
|
|
|
14692
|
-
const DropdownContainer = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-
|
|
14753
|
+
const DropdownContainer = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-0a6ce241"]]);
|
|
14693
14754
|
|
|
14694
14755
|
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
14695
14756
|
__name: "KdsDropdown",
|
|
@@ -15544,14 +15605,66 @@ const provideCommonScrollContainerProps = (containerRef, params) => {
|
|
|
15544
15605
|
provideForCloseSubMenusOnScroll();
|
|
15545
15606
|
provide(injectionKey, containerRef);
|
|
15546
15607
|
};
|
|
15608
|
+
const useScrollContainer = () => inject(injectionKey, ref(null));
|
|
15547
15609
|
const useCommonScrollContainerProps = () => {
|
|
15548
15610
|
const closeExpandedSubMenu = injectCloseExpandedSubMenu();
|
|
15549
15611
|
const overflowStyles = useOverflowStyles();
|
|
15550
|
-
const containerRef = inject(injectionKey);
|
|
15551
15612
|
return {
|
|
15552
15613
|
overflowStyles,
|
|
15553
15614
|
closeExpandedSubMenu,
|
|
15554
|
-
containerRef
|
|
15615
|
+
containerRef: useScrollContainer()
|
|
15616
|
+
};
|
|
15617
|
+
};
|
|
15618
|
+
|
|
15619
|
+
const useResizeScrollSpacer = ({
|
|
15620
|
+
columnResizeActive,
|
|
15621
|
+
currentBodyWidth,
|
|
15622
|
+
scrollContainer
|
|
15623
|
+
}) => {
|
|
15624
|
+
const showResizeScrollSpacer = ref(false);
|
|
15625
|
+
const collapseResizeScrollSpacer = ref(false);
|
|
15626
|
+
const additionalSpacerWidth = ref("0px");
|
|
15627
|
+
const getVisibleWidthBeyondBody = () => {
|
|
15628
|
+
const container = scrollContainer.value;
|
|
15629
|
+
if (container === null) {
|
|
15630
|
+
return 0;
|
|
15631
|
+
}
|
|
15632
|
+
return Math.max(
|
|
15633
|
+
0,
|
|
15634
|
+
container.scrollLeft + container.clientWidth - currentBodyWidth.value
|
|
15635
|
+
);
|
|
15636
|
+
};
|
|
15637
|
+
watch(columnResizeActive, (active) => {
|
|
15638
|
+
if (active) {
|
|
15639
|
+
collapseResizeScrollSpacer.value = false;
|
|
15640
|
+
showResizeScrollSpacer.value = true;
|
|
15641
|
+
additionalSpacerWidth.value = "100vw";
|
|
15642
|
+
} else if (showResizeScrollSpacer.value) {
|
|
15643
|
+
const visibleWidthBeyondBody = getVisibleWidthBeyondBody();
|
|
15644
|
+
if (visibleWidthBeyondBody > 0) {
|
|
15645
|
+
additionalSpacerWidth.value = `${visibleWidthBeyondBody}px`;
|
|
15646
|
+
nextTick(() => {
|
|
15647
|
+
scrollContainer.value?.offsetWidth;
|
|
15648
|
+
additionalSpacerWidth.value = "0px";
|
|
15649
|
+
collapseResizeScrollSpacer.value = true;
|
|
15650
|
+
});
|
|
15651
|
+
} else {
|
|
15652
|
+
showResizeScrollSpacer.value = false;
|
|
15653
|
+
additionalSpacerWidth.value = "0px";
|
|
15654
|
+
}
|
|
15655
|
+
}
|
|
15656
|
+
});
|
|
15657
|
+
const onResizeScrollSpacerTransitionEnd = () => {
|
|
15658
|
+
if (collapseResizeScrollSpacer.value) {
|
|
15659
|
+
showResizeScrollSpacer.value = false;
|
|
15660
|
+
collapseResizeScrollSpacer.value = false;
|
|
15661
|
+
}
|
|
15662
|
+
};
|
|
15663
|
+
return {
|
|
15664
|
+
showResizeScrollSpacer,
|
|
15665
|
+
collapseResizeScrollSpacer,
|
|
15666
|
+
additionalSpacerWidth,
|
|
15667
|
+
onResizeScrollSpacerTransitionEnd
|
|
15555
15668
|
};
|
|
15556
15669
|
};
|
|
15557
15670
|
|
|
@@ -15563,7 +15676,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15563
15676
|
columnSizes: {},
|
|
15564
15677
|
specialColumnSizes: {},
|
|
15565
15678
|
currentBodyWidth: {},
|
|
15566
|
-
tableConfig: {}
|
|
15679
|
+
tableConfig: {},
|
|
15680
|
+
columnResizeActive: { type: Boolean }
|
|
15567
15681
|
},
|
|
15568
15682
|
emits: ["scrollerUpdate", "moveSelection", "clearSelection", "expandSelectedCell", "startEditing", "bodyFocusin", "bodyFocusout"],
|
|
15569
15683
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15641,6 +15755,16 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15641
15755
|
containerRef: injectedContainerRef,
|
|
15642
15756
|
overflowStyles
|
|
15643
15757
|
} = useCommonScrollContainerProps();
|
|
15758
|
+
const {
|
|
15759
|
+
showResizeScrollSpacer,
|
|
15760
|
+
collapseResizeScrollSpacer,
|
|
15761
|
+
additionalSpacerWidth,
|
|
15762
|
+
onResizeScrollSpacerTransitionEnd
|
|
15763
|
+
} = useResizeScrollSpacer({
|
|
15764
|
+
columnResizeActive: toRef(props, "columnResizeActive"),
|
|
15765
|
+
currentBodyWidth: toRef(props, "currentBodyWidth"),
|
|
15766
|
+
scrollContainer: containerProps.ref
|
|
15767
|
+
});
|
|
15644
15768
|
__expose({
|
|
15645
15769
|
scrollToPosition: ({ top, left }) => {
|
|
15646
15770
|
if (top !== void 0) {
|
|
@@ -15663,7 +15787,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15663
15787
|
},
|
|
15664
15788
|
style: normalizeStyle(unref(overflowStyles)),
|
|
15665
15789
|
class: normalizeClass(["container", { "fit-content": __props.tableConfig.forceRenderAll }]),
|
|
15666
|
-
onScroll: _cache[
|
|
15790
|
+
onScroll: _cache[7] || (_cache[7] = () => [unref(containerProps).onScroll(), unref(closeExpandedSubMenu)()])
|
|
15667
15791
|
}, [
|
|
15668
15792
|
createElementVNode("div", {
|
|
15669
15793
|
ref_key: "headerContainer",
|
|
@@ -15711,13 +15835,26 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
15711
15835
|
renderSlot(_ctx.$slots, "belowBody", {}, void 0, true)
|
|
15712
15836
|
]),
|
|
15713
15837
|
_: 3
|
|
15714
|
-
})
|
|
15838
|
+
}),
|
|
15839
|
+
unref(showResizeScrollSpacer) ? (openBlock(), createElementBlock("div", {
|
|
15840
|
+
key: 0,
|
|
15841
|
+
class: normalizeClass([
|
|
15842
|
+
"resize-scroll-spacer",
|
|
15843
|
+
{ collapsing: unref(collapseResizeScrollSpacer) }
|
|
15844
|
+
]),
|
|
15845
|
+
"aria-hidden": "true",
|
|
15846
|
+
style: normalizeStyle({
|
|
15847
|
+
width: `calc(${__props.currentBodyWidth}px + ${unref(additionalSpacerWidth)})`
|
|
15848
|
+
}),
|
|
15849
|
+
onTransitionend: _cache[6] || (_cache[6] = //@ts-ignore
|
|
15850
|
+
(...args) => unref(onResizeScrollSpacerTransitionEnd) && unref(onResizeScrollSpacerTransitionEnd)(...args))
|
|
15851
|
+
}, null, 38)) : createCommentVNode("", true)
|
|
15715
15852
|
], 38)) : createCommentVNode("", true);
|
|
15716
15853
|
};
|
|
15717
15854
|
}
|
|
15718
15855
|
});
|
|
15719
15856
|
|
|
15720
|
-
const TableCoreVirtual = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__scopeId", "data-v-
|
|
15857
|
+
const TableCoreVirtual = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__scopeId", "data-v-fb9f9377"]]);
|
|
15721
15858
|
|
|
15722
15859
|
function getDefaultExportFromCjs (x) {
|
|
15723
15860
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -15946,6 +16083,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
15946
16083
|
},
|
|
15947
16084
|
"current-body-width": currentBodyWidth.value,
|
|
15948
16085
|
"table-config": __props.tableConfig,
|
|
16086
|
+
"column-resize-active": __props.columnResize.active,
|
|
15949
16087
|
onScrollerUpdate: _cache[0] || (_cache[0] = (startIndex, endIndex) => emit("scrollerUpdate", startIndex, endIndex)),
|
|
15950
16088
|
onMoveSelection: _cache[1] || (_cache[1] = (...args) => emit("moveSelection", ...args)),
|
|
15951
16089
|
onClearSelection: _cache[2] || (_cache[2] = ($event) => emit("clearSelection")),
|
|
@@ -15972,7 +16110,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
15972
16110
|
renderSlot(_ctx.$slots, "belowBody")
|
|
15973
16111
|
]),
|
|
15974
16112
|
_: 3
|
|
15975
|
-
}, 8, ["scroll-data", "column-sizes", "scroll-config", "special-column-sizes", "current-body-width", "table-config"]);
|
|
16113
|
+
}, 8, ["scroll-data", "column-sizes", "scroll-config", "special-column-sizes", "current-body-width", "table-config", "column-resize-active"]);
|
|
15976
16114
|
};
|
|
15977
16115
|
}
|
|
15978
16116
|
});
|
|
@@ -17122,6 +17260,59 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
17122
17260
|
|
|
17123
17261
|
const TableActionBar = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__scopeId", "data-v-8cfb3c41"]]);
|
|
17124
17262
|
|
|
17263
|
+
const AUTO_SCROLL_EDGE_SIZE = 20;
|
|
17264
|
+
const AUTO_SCROLL_SPEED = 250;
|
|
17265
|
+
const useAutoScrollOnRightEdge = ({
|
|
17266
|
+
scrollContainer,
|
|
17267
|
+
autoScrollOffset,
|
|
17268
|
+
onAutoScroll
|
|
17269
|
+
}) => {
|
|
17270
|
+
let pointerClientX = 0;
|
|
17271
|
+
let scrollLeftBase = 0;
|
|
17272
|
+
const isInTriggerZone = () => {
|
|
17273
|
+
const container = scrollContainer.value;
|
|
17274
|
+
if (!container) {
|
|
17275
|
+
return false;
|
|
17276
|
+
}
|
|
17277
|
+
const { right } = container.getBoundingClientRect();
|
|
17278
|
+
return pointerClientX >= right - AUTO_SCROLL_EDGE_SIZE;
|
|
17279
|
+
};
|
|
17280
|
+
const { pause, resume } = useRafFn(
|
|
17281
|
+
({ delta }) => {
|
|
17282
|
+
const deltaPx = AUTO_SCROLL_SPEED * delta / 1e3;
|
|
17283
|
+
autoScrollOffset.value += deltaPx;
|
|
17284
|
+
const container = scrollContainer.value;
|
|
17285
|
+
onAutoScroll();
|
|
17286
|
+
nextTick(() => {
|
|
17287
|
+
if (container) {
|
|
17288
|
+
container.scrollLeft = scrollLeftBase + autoScrollOffset.value;
|
|
17289
|
+
}
|
|
17290
|
+
});
|
|
17291
|
+
},
|
|
17292
|
+
{ immediate: false }
|
|
17293
|
+
);
|
|
17294
|
+
const updateZone = (clientX) => {
|
|
17295
|
+
pointerClientX = clientX;
|
|
17296
|
+
if (isInTriggerZone()) {
|
|
17297
|
+
resume();
|
|
17298
|
+
} else {
|
|
17299
|
+
pause();
|
|
17300
|
+
}
|
|
17301
|
+
};
|
|
17302
|
+
const onPointerDown = (clientX) => {
|
|
17303
|
+
scrollLeftBase = scrollContainer.value?.scrollLeft ?? 0;
|
|
17304
|
+
updateZone(clientX);
|
|
17305
|
+
};
|
|
17306
|
+
const onPointerMove = (clientX) => {
|
|
17307
|
+
updateZone(clientX);
|
|
17308
|
+
};
|
|
17309
|
+
const onPointerUp = () => {
|
|
17310
|
+
pause();
|
|
17311
|
+
autoScrollOffset.value = 0;
|
|
17312
|
+
};
|
|
17313
|
+
return { onPointerDown, onPointerMove, onPointerUp };
|
|
17314
|
+
};
|
|
17315
|
+
|
|
17125
17316
|
const _sfc_main$8 = {
|
|
17126
17317
|
components: {
|
|
17127
17318
|
KdsCheckbox: _sfc_main$10,
|
|
@@ -17199,6 +17390,32 @@ const _sfc_main$8 = {
|
|
|
17199
17390
|
},
|
|
17200
17391
|
setup(props, { emit }) {
|
|
17201
17392
|
const { indexedData: indexedColumnHeaders, style: headerStyles } = useIndicesAndStylesFor(toRef(props, "columnHeaders"));
|
|
17393
|
+
const scrollContainer = useScrollContainer();
|
|
17394
|
+
const dragIndex = ref(null);
|
|
17395
|
+
const columnSizeOnDragStart = ref(0);
|
|
17396
|
+
const pageXOnDragStart = ref(0);
|
|
17397
|
+
const currentPageX = ref(0);
|
|
17398
|
+
const autoScrollOffset = ref(0);
|
|
17399
|
+
const emitColumnResize = () => {
|
|
17400
|
+
if (dragIndex.value === null) {
|
|
17401
|
+
return;
|
|
17402
|
+
}
|
|
17403
|
+
const newColumnSize = columnSizeOnDragStart.value + (currentPageX.value - pageXOnDragStart.value) + autoScrollOffset.value;
|
|
17404
|
+
emit(
|
|
17405
|
+
"columnResize",
|
|
17406
|
+
dragIndex.value,
|
|
17407
|
+
Math.max(newColumnSize, MIN_COLUMN_SIZE)
|
|
17408
|
+
);
|
|
17409
|
+
};
|
|
17410
|
+
const {
|
|
17411
|
+
onPointerDown: startAutoScroll,
|
|
17412
|
+
onPointerMove: updateAutoScroll,
|
|
17413
|
+
onPointerUp: stopAutoScroll
|
|
17414
|
+
} = useAutoScrollOnRightEdge({
|
|
17415
|
+
scrollContainer,
|
|
17416
|
+
autoScrollOffset,
|
|
17417
|
+
onAutoScroll: emitColumnResize
|
|
17418
|
+
});
|
|
17202
17419
|
let currentColumnIndex = 0;
|
|
17203
17420
|
const onStartEditing = (initialValue) => {
|
|
17204
17421
|
emit("headerCellStartEditing", currentColumnIndex, initialValue);
|
|
@@ -17211,19 +17428,27 @@ const _sfc_main$8 = {
|
|
|
17211
17428
|
currentColumnIndex = columnIndex;
|
|
17212
17429
|
startEditingKeydown(event);
|
|
17213
17430
|
};
|
|
17214
|
-
return {
|
|
17431
|
+
return {
|
|
17432
|
+
indexedColumnHeaders,
|
|
17433
|
+
headerStyles,
|
|
17434
|
+
onHeaderCellKeydown,
|
|
17435
|
+
scrollContainer,
|
|
17436
|
+
dragIndex,
|
|
17437
|
+
columnSizeOnDragStart,
|
|
17438
|
+
pageXOnDragStart,
|
|
17439
|
+
currentPageX,
|
|
17440
|
+
autoScrollOffset,
|
|
17441
|
+
emitColumnResize,
|
|
17442
|
+
startAutoScroll,
|
|
17443
|
+
updateAutoScroll,
|
|
17444
|
+
stopAutoScroll
|
|
17445
|
+
};
|
|
17215
17446
|
},
|
|
17216
17447
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
17217
17448
|
data() {
|
|
17218
17449
|
return {
|
|
17219
17450
|
hoverIndex: null,
|
|
17220
17451
|
// the index of the column that is currently being hovered over; null during resize
|
|
17221
|
-
dragIndex: null,
|
|
17222
|
-
// the index of the column that is currently being dragged / resized
|
|
17223
|
-
columnSizeOnDragStart: 0,
|
|
17224
|
-
// the original width of the column that is currently being resized
|
|
17225
|
-
pageXOnDragStart: 0,
|
|
17226
|
-
// the x coordinate at which the mouse was clicked when starting the resize drag
|
|
17227
17452
|
minimumColumnWidth: MIN_COLUMN_SIZE,
|
|
17228
17453
|
// need to add this here since it is referenced in the template
|
|
17229
17454
|
maximumSubMenuWidth: MAX_SUB_MENU_WIDTH,
|
|
@@ -17325,17 +17550,20 @@ const _sfc_main$8 = {
|
|
|
17325
17550
|
this.currentDragHandlerHeight = this.getDragHandleHeight();
|
|
17326
17551
|
this.columnSizeOnDragStart = this.columnSizes[columnIndex];
|
|
17327
17552
|
this.pageXOnDragStart = event.pageX;
|
|
17553
|
+
this.currentPageX = event.pageX;
|
|
17328
17554
|
this.$emit("columnResizeStart");
|
|
17555
|
+
this.startAutoScroll(event.clientX);
|
|
17329
17556
|
},
|
|
17330
17557
|
onPointerUp(event) {
|
|
17331
17558
|
this.$emit("columnResizeEnd");
|
|
17332
17559
|
if (event.shiftKey) {
|
|
17333
|
-
const newColumnSize = this.columnSizeOnDragStart + event.pageX - this.pageXOnDragStart;
|
|
17560
|
+
const newColumnSize = this.columnSizeOnDragStart + event.pageX - this.pageXOnDragStart + this.autoScrollOffset;
|
|
17334
17561
|
this.$emit(
|
|
17335
17562
|
"allColumnsResize",
|
|
17336
17563
|
Math.max(newColumnSize, this.minimumColumnWidth)
|
|
17337
17564
|
);
|
|
17338
17565
|
}
|
|
17566
|
+
this.stopAutoScroll();
|
|
17339
17567
|
},
|
|
17340
17568
|
/* eslint-disable no-invalid-this */
|
|
17341
17569
|
onPointerMove: throttle(function(event) {
|
|
@@ -17350,12 +17578,9 @@ const _sfc_main$8 = {
|
|
|
17350
17578
|
unthrottledOnPointerMove(event) {
|
|
17351
17579
|
if (this.dragIndex !== null) {
|
|
17352
17580
|
consola.debug("Resize via drag ongoing: ", event);
|
|
17353
|
-
|
|
17354
|
-
this
|
|
17355
|
-
|
|
17356
|
-
this.dragIndex,
|
|
17357
|
-
Math.max(newColumnSize, this.minimumColumnWidth)
|
|
17358
|
-
);
|
|
17581
|
+
this.currentPageX = event.pageX;
|
|
17582
|
+
this.emitColumnResize();
|
|
17583
|
+
this.updateAutoScroll(event.clientX);
|
|
17359
17584
|
}
|
|
17360
17585
|
},
|
|
17361
17586
|
/* The lostpointercapture event is triggered if the pointer capture is lost for any reason, including its
|
|
@@ -17363,6 +17588,7 @@ const _sfc_main$8 = {
|
|
|
17363
17588
|
the onLostPointerCapture function to guarantee order of event handling. */
|
|
17364
17589
|
onLostPointerCapture: throttle(function(event) {
|
|
17365
17590
|
consola.debug("Resize via drag finished: ", event);
|
|
17591
|
+
this.stopAutoScroll();
|
|
17366
17592
|
this.dragIndex = null;
|
|
17367
17593
|
this.hoverIndex = null;
|
|
17368
17594
|
}),
|
|
@@ -17564,10 +17790,10 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
17564
17790
|
key: 2,
|
|
17565
17791
|
class: normalizeClass([
|
|
17566
17792
|
"resize-handle-area",
|
|
17567
|
-
{ hover: $data.hoverIndex === ind, drag: $
|
|
17793
|
+
{ hover: $data.hoverIndex === ind, drag: $setup.dragIndex === ind }
|
|
17568
17794
|
]),
|
|
17569
17795
|
style: normalizeStyle({
|
|
17570
|
-
height: `${$options.dragHandleHeight($
|
|
17796
|
+
height: `${$options.dragHandleHeight($setup.dragIndex === ind)}px`
|
|
17571
17797
|
}),
|
|
17572
17798
|
onPointerover: ($event) => $options.onPointerOver($event, ind),
|
|
17573
17799
|
onPointerleave: _cache[2] || (_cache[2] = (...args) => $options.onPointerLeave && $options.onPointerLeave(...args)),
|
|
@@ -17608,7 +17834,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
17608
17834
|
}, null, 6)) : createCommentVNode("", true)
|
|
17609
17835
|
]);
|
|
17610
17836
|
}
|
|
17611
|
-
const Header = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$2], ["__scopeId", "data-v-
|
|
17837
|
+
const Header = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$2], ["__scopeId", "data-v-3b63e327"]]);
|
|
17612
17838
|
|
|
17613
17839
|
const _hoisted_1$3 = { class: "sticky-container" };
|
|
17614
17840
|
const buttonRef = "button";
|