@weitutech/by-components-v3 1.1.13 → 1.1.14
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/dist/by-component-v3.js +50 -2
- package/dist/by-component-v3.umd.cjs +1 -1
- package/dist/types/src/router/index.d.ts +2 -0
- package/dist/types/src/views/Home.vue.d.ts +2 -0
- package/dist/types/src/{config.d.ts → views/configs/config.d.ts} +8 -8
- package/dist/types/src/{toolbar-config.d.ts → views/configs/toolbar-config.d.ts} +3 -3
- package/dist/types/src/views/tests/FormTest.vue.d.ts +2 -0
- package/dist/types/src/views/tests/TableTest.vue.d.ts +2 -0
- package/dist/types/src/views/tests/ToolBarTableTest.vue.d.ts +2 -0
- package/dist/types/src/views/tests/ToolBarTest.vue.d.ts +2 -0
- package/package.json +4 -3
- package/src/main.ts +2 -0
package/dist/by-component-v3.js
CHANGED
|
@@ -40558,8 +40558,11 @@ const ByTable = /* @__PURE__ */ defineComponent({
|
|
|
40558
40558
|
columns,
|
|
40559
40559
|
...others
|
|
40560
40560
|
} = props.gridOptions;
|
|
40561
|
-
|
|
40561
|
+
let newColumns = replaceColumnWidthToColumns(props.name, columns);
|
|
40562
40562
|
setHasCache();
|
|
40563
|
+
if (isMobile.value || tableWidth.value < 1e3) {
|
|
40564
|
+
newColumns = removeFixedColumns(newColumns);
|
|
40565
|
+
}
|
|
40563
40566
|
return {
|
|
40564
40567
|
border: true,
|
|
40565
40568
|
round: true,
|
|
@@ -40611,6 +40614,8 @@ const ByTable = /* @__PURE__ */ defineComponent({
|
|
|
40611
40614
|
const hasCache = ref(false);
|
|
40612
40615
|
const originColumns = ref([]);
|
|
40613
40616
|
const tempColumns = ref([]);
|
|
40617
|
+
const tableWidth = ref(window.innerWidth);
|
|
40618
|
+
const isMobile = ref(false);
|
|
40614
40619
|
watch(() => props.gridOptions.columns, (newColumns) => {
|
|
40615
40620
|
const result = rewriteWidthColumns(tempColumns.value, newColumns);
|
|
40616
40621
|
originColumns.value = result;
|
|
@@ -40623,8 +40628,51 @@ const ByTable = /* @__PURE__ */ defineComponent({
|
|
|
40623
40628
|
events.forEach((eventName) => {
|
|
40624
40629
|
listeners.value["on" + eventName.split("-").map((item) => capitalizeFirstLetter(item)).join("")] = (event) => emit(eventName, event);
|
|
40625
40630
|
});
|
|
40626
|
-
|
|
40631
|
+
checkDeviceType();
|
|
40632
|
+
initResizeListener();
|
|
40633
|
+
});
|
|
40634
|
+
onUnmounted(() => {
|
|
40635
|
+
removeResizeListener();
|
|
40627
40636
|
});
|
|
40637
|
+
const checkDeviceType = () => {
|
|
40638
|
+
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
40639
|
+
const isMobileByUA = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent.toLowerCase());
|
|
40640
|
+
const isSmallScreen = window.innerWidth <= 1024;
|
|
40641
|
+
isMobile.value = isMobileByUA || isSmallScreen;
|
|
40642
|
+
};
|
|
40643
|
+
const initResizeListener = () => {
|
|
40644
|
+
window.addEventListener("resize", handleResize);
|
|
40645
|
+
nextTick(() => {
|
|
40646
|
+
if (vxeGridRef.value && vxeGridRef.value.$el) {
|
|
40647
|
+
tableWidth.value = vxeGridRef.value.$el.offsetWidth;
|
|
40648
|
+
}
|
|
40649
|
+
});
|
|
40650
|
+
};
|
|
40651
|
+
const removeResizeListener = () => {
|
|
40652
|
+
window.removeEventListener("resize", handleResize);
|
|
40653
|
+
};
|
|
40654
|
+
const handleResize = () => {
|
|
40655
|
+
if (vxeGridRef.value && vxeGridRef.value.$el) {
|
|
40656
|
+
tableWidth.value = vxeGridRef.value.$el.offsetWidth;
|
|
40657
|
+
} else {
|
|
40658
|
+
tableWidth.value = window.innerWidth;
|
|
40659
|
+
}
|
|
40660
|
+
};
|
|
40661
|
+
const removeFixedColumns = (columns) => {
|
|
40662
|
+
if (!columns || !Array.isArray(columns)) return columns;
|
|
40663
|
+
return columns.map((column) => {
|
|
40664
|
+
const newColumn = {
|
|
40665
|
+
...column
|
|
40666
|
+
};
|
|
40667
|
+
if (newColumn.fixed) {
|
|
40668
|
+
delete newColumn.fixed;
|
|
40669
|
+
}
|
|
40670
|
+
if (newColumn.children && Array.isArray(newColumn.children)) {
|
|
40671
|
+
newColumn.children = removeFixedColumns(newColumn.children);
|
|
40672
|
+
}
|
|
40673
|
+
return newColumn;
|
|
40674
|
+
});
|
|
40675
|
+
};
|
|
40628
40676
|
const handlePagerChange = (context) => {
|
|
40629
40677
|
if (vxeGridRef.value) {
|
|
40630
40678
|
vxeGridRef.value.scrollTo(0, 0);
|