@deot/vc-components 1.0.61 → 1.0.62
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/index.cjs +50 -27
- package/dist/index.d.ts +24 -6
- package/dist/index.iife.js +50 -27
- package/dist/index.js +50 -27
- package/dist/index.style.css +2 -2
- package/dist/index.umd.cjs +50 -27
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9652,10 +9652,11 @@ const useScroller = (expose) => {
|
|
|
9652
9652
|
"vc-scroller__wrapper"
|
|
9653
9653
|
];
|
|
9654
9654
|
});
|
|
9655
|
-
const refreshSize = () => {
|
|
9655
|
+
const refreshSize = async () => {
|
|
9656
9656
|
if (!wrapper.value) return;
|
|
9657
9657
|
wrapperW.value = wrapper.value.clientWidth;
|
|
9658
9658
|
wrapperH.value = wrapper.value.clientHeight;
|
|
9659
|
+
await nextTick();
|
|
9659
9660
|
contentH.value = wrapper.value.scrollHeight;
|
|
9660
9661
|
contentW.value = wrapper.value.scrollWidth;
|
|
9661
9662
|
};
|
|
@@ -14528,11 +14529,10 @@ const Option = /* @__PURE__ */ defineComponent({
|
|
|
14528
14529
|
} = owner.exposed;
|
|
14529
14530
|
return !multiple.value ? true : current.value.slice(-1)[0] === props.value;
|
|
14530
14531
|
});
|
|
14531
|
-
const searchRegex = computed(() => {
|
|
14532
|
-
const v = owner.exposed.searchValue.value.trim().replace(/\s+/g, ' ').split(/\s|,/);
|
|
14533
|
-
return new RegExp(`(${v.join('|')})`, 'i');
|
|
14534
|
-
});
|
|
14535
14532
|
const isActive = computed(() => {
|
|
14533
|
+
const {
|
|
14534
|
+
searchRegex
|
|
14535
|
+
} = owner.exposed;
|
|
14536
14536
|
return !!(searchRegex.value.test(formatterLabel.value) || !props.filterable);
|
|
14537
14537
|
});
|
|
14538
14538
|
const customOptions = computed(() => {
|
|
@@ -14758,6 +14758,10 @@ const Select = /* @__PURE__ */ defineComponent({
|
|
|
14758
14758
|
const v = currentValue.value.length - props.maxTags;
|
|
14759
14759
|
return v < 0 ? 0 : v;
|
|
14760
14760
|
});
|
|
14761
|
+
const searchRegex = computed(() => {
|
|
14762
|
+
const v = searchValue.value.trim().replace(/\s+/g, ' ').split(/\s|,/);
|
|
14763
|
+
return new RegExp(escapeString(`(${v.join('|')})`), 'i');
|
|
14764
|
+
});
|
|
14761
14765
|
const optionMap = ref({});
|
|
14762
14766
|
const options = computed(() => {
|
|
14763
14767
|
return Object.values(optionMap.value);
|
|
@@ -14854,7 +14858,7 @@ const Select = /* @__PURE__ */ defineComponent({
|
|
|
14854
14858
|
add,
|
|
14855
14859
|
remove,
|
|
14856
14860
|
close,
|
|
14857
|
-
|
|
14861
|
+
searchRegex,
|
|
14858
14862
|
multiple,
|
|
14859
14863
|
isActive,
|
|
14860
14864
|
current: currentValue,
|
|
@@ -19129,6 +19133,10 @@ const TableHeader = /* @__PURE__ */ defineComponent({
|
|
|
19129
19133
|
sort: {
|
|
19130
19134
|
type: Object,
|
|
19131
19135
|
default: () => ({})
|
|
19136
|
+
},
|
|
19137
|
+
resizable: {
|
|
19138
|
+
type: Boolean,
|
|
19139
|
+
default: void 0
|
|
19132
19140
|
}
|
|
19133
19141
|
},
|
|
19134
19142
|
setup(props) {
|
|
@@ -19137,6 +19145,9 @@ const TableHeader = /* @__PURE__ */ defineComponent({
|
|
|
19137
19145
|
const draggingColumn = ref(null);
|
|
19138
19146
|
const dragging = ref(false);
|
|
19139
19147
|
const dragState = ref({});
|
|
19148
|
+
const allowDrag = computed(() => {
|
|
19149
|
+
return typeof props.resizable === 'boolean' ? props.resizable : props.border;
|
|
19150
|
+
});
|
|
19140
19151
|
const states = useStates({
|
|
19141
19152
|
columns: 'columns',
|
|
19142
19153
|
isAllSelected: 'isAllSelected',
|
|
@@ -19240,10 +19251,10 @@ const TableHeader = /* @__PURE__ */ defineComponent({
|
|
|
19240
19251
|
if (IS_SERVER$1) return;
|
|
19241
19252
|
if (column.children && column.children.length > 0) return;
|
|
19242
19253
|
/* istanbul ignore if */
|
|
19243
|
-
if (draggingColumn.value &&
|
|
19254
|
+
if (draggingColumn.value && allowDrag.value) {
|
|
19244
19255
|
dragging.value = true;
|
|
19245
19256
|
table.resizeProxyVisible.value = true;
|
|
19246
|
-
const tableEl = table.
|
|
19257
|
+
const tableEl = table.tableWrapper.value;
|
|
19247
19258
|
const tableLeft = tableEl.getBoundingClientRect().left;
|
|
19248
19259
|
const columnEl = instance.vnode.el.querySelector(`.vc-table__th.${column.id}`);
|
|
19249
19260
|
const columnRect = columnEl.getBoundingClientRect();
|
|
@@ -19272,15 +19283,14 @@ const TableHeader = /* @__PURE__ */ defineComponent({
|
|
|
19272
19283
|
} = dragState.value;
|
|
19273
19284
|
const finalLeft = parseInt(resizeProxy.style.left, 10);
|
|
19274
19285
|
const columnWidth = finalLeft - startColumnLeft;
|
|
19275
|
-
column.width = columnWidth;
|
|
19276
|
-
column.
|
|
19277
|
-
table.$emit('header-dragend', column.width, startLeft - startColumnLeft, column, event);
|
|
19286
|
+
column.width = column.minWidth = column.realWidth = columnWidth;
|
|
19287
|
+
table.emit('header-dragend', column.width, startLeft - startColumnLeft, column);
|
|
19278
19288
|
table.store.scheduleLayout();
|
|
19279
19289
|
document.body.style.cursor = '';
|
|
19280
19290
|
dragging.value = false;
|
|
19281
19291
|
draggingColumn.value = null;
|
|
19282
19292
|
dragState.value = {};
|
|
19283
|
-
table.resizeProxyVisible = false;
|
|
19293
|
+
table.resizeProxyVisible.value = false;
|
|
19284
19294
|
}
|
|
19285
19295
|
document.removeEventListener('mousemove', handleMouseMove);
|
|
19286
19296
|
document.removeEventListener('mouseup', handleMouseUp);
|
|
@@ -19301,7 +19311,7 @@ const TableHeader = /* @__PURE__ */ defineComponent({
|
|
|
19301
19311
|
target = target.parentNode;
|
|
19302
19312
|
}
|
|
19303
19313
|
if (!column || !column.resizable) return;
|
|
19304
|
-
if (!dragging.value &&
|
|
19314
|
+
if (!dragging.value && allowDrag.value) {
|
|
19305
19315
|
const rect = target.getBoundingClientRect();
|
|
19306
19316
|
const bodyStyle = document.body.style;
|
|
19307
19317
|
if (rect.width > 12 && rect.right - event.pageX < 8) {
|
|
@@ -19608,7 +19618,11 @@ const props$d = {
|
|
|
19608
19618
|
default: () => ({})
|
|
19609
19619
|
},
|
|
19610
19620
|
// 用于延迟渲染,用于计算高度
|
|
19611
|
-
delay: Number
|
|
19621
|
+
delay: Number,
|
|
19622
|
+
resizable: {
|
|
19623
|
+
type: Boolean,
|
|
19624
|
+
default: void 0
|
|
19625
|
+
}
|
|
19612
19626
|
};
|
|
19613
19627
|
|
|
19614
19628
|
/** @jsxImportSource vue */
|
|
@@ -19617,7 +19631,7 @@ const COMPONENT_NAME$j = 'vc-table';
|
|
|
19617
19631
|
const Table = /* @__PURE__ */ defineComponent({
|
|
19618
19632
|
name: COMPONENT_NAME$j,
|
|
19619
19633
|
props: props$d,
|
|
19620
|
-
emits: ['select', 'select-all', 'selection-change', 'cell-mouse-enter', 'cell-mouse-leave', 'cell-click', 'cell-dblclick', 'row-click', 'row-contextmenu', 'row-dblclick', 'header-click', 'header-contextmenu', 'current-change', 'header-dragend
|
|
19634
|
+
emits: ['select', 'select-all', 'selection-change', 'cell-mouse-enter', 'cell-mouse-leave', 'cell-click', 'cell-dblclick', 'row-click', 'row-contextmenu', 'row-dblclick', 'header-click', 'header-contextmenu', 'current-change', 'header-dragend', 'expand-change', 'sort-change', 'update:sort'],
|
|
19621
19635
|
setup(props, {
|
|
19622
19636
|
slots,
|
|
19623
19637
|
expose,
|
|
@@ -19638,7 +19652,7 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
19638
19652
|
width: null,
|
|
19639
19653
|
height: null
|
|
19640
19654
|
});
|
|
19641
|
-
|
|
19655
|
+
const tableWrapper = ref(null);
|
|
19642
19656
|
// refs
|
|
19643
19657
|
const hiddenColumns = ref(null);
|
|
19644
19658
|
const headerWrapper = ref(null);
|
|
@@ -19996,6 +20010,7 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
19996
20010
|
toggleRowExpansion,
|
|
19997
20011
|
clearSelection,
|
|
19998
20012
|
scroller,
|
|
20013
|
+
tableWrapper,
|
|
19999
20014
|
headerWrapper,
|
|
20000
20015
|
appendWrapper,
|
|
20001
20016
|
footerWrapper,
|
|
@@ -20006,12 +20021,15 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
20006
20021
|
renderExpanded,
|
|
20007
20022
|
hiddenColumns,
|
|
20008
20023
|
props,
|
|
20009
|
-
emit
|
|
20024
|
+
emit,
|
|
20025
|
+
resizeProxy,
|
|
20026
|
+
resizeProxyVisible
|
|
20010
20027
|
};
|
|
20011
20028
|
expose(exposed);
|
|
20012
20029
|
provide('vc-table', exposed);
|
|
20013
20030
|
return () => {
|
|
20014
20031
|
return createVNode("div", {
|
|
20032
|
+
"ref": tableWrapper,
|
|
20015
20033
|
"class": [classes.value, tableId, 'vc-table'],
|
|
20016
20034
|
"onMouseleave": handleMouseLeave
|
|
20017
20035
|
}, [createVNode("div", {
|
|
@@ -20023,6 +20041,7 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
20023
20041
|
}, [createVNode(TableHeader, {
|
|
20024
20042
|
"ref": tableHeader,
|
|
20025
20043
|
"border": props.border,
|
|
20044
|
+
"resizable": props.resizable,
|
|
20026
20045
|
"sort": props.sort,
|
|
20027
20046
|
"style": bodyWidthStyle.value
|
|
20028
20047
|
}, null)]), states.columns.length > 0 && createVNode(ScrollerWheel, {
|
|
@@ -20040,15 +20059,10 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
20040
20059
|
"style": [bodyWidthStyle.value],
|
|
20041
20060
|
"height-style": [bodyHeightStyle.value],
|
|
20042
20061
|
"onScroll": handleScollY
|
|
20043
|
-
}, null), props.data.length === 0 && createVNode("div", {
|
|
20044
|
-
"
|
|
20045
|
-
"style": bodyWidthStyle.value
|
|
20046
|
-
|
|
20047
|
-
'is-absolute': !!props.height
|
|
20048
|
-
}, 'vc-table__empty-wrapper']
|
|
20049
|
-
}, [createVNode("span", {
|
|
20050
|
-
"class": "vc-table__empty-text"
|
|
20051
|
-
}, [slots.empty ? slots.empty() : props.emptyText || '暂无数据'])]), slots.append && createVNode("div", {
|
|
20062
|
+
}, null), props.data.length === 0 && !props.height && createVNode("div", {
|
|
20063
|
+
"class": "vc-table__empty-placeholder",
|
|
20064
|
+
"style": [bodyWidthStyle.value]
|
|
20065
|
+
}, null), slots.append && createVNode("div", {
|
|
20052
20066
|
"ref": appendWrapper,
|
|
20053
20067
|
"class": "vc-table__append-wrapper"
|
|
20054
20068
|
}, [slots.append()])]
|
|
@@ -20072,6 +20086,7 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
20072
20086
|
}, [createVNode(TableHeader, {
|
|
20073
20087
|
"ref": leftFixedTableHeader,
|
|
20074
20088
|
"border": props.border,
|
|
20089
|
+
"resizable": props.resizable,
|
|
20075
20090
|
"sort": props.sort,
|
|
20076
20091
|
"style": bodyWidthStyle.value,
|
|
20077
20092
|
"fixed": "left"
|
|
@@ -20111,6 +20126,7 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
20111
20126
|
}, [createVNode(TableHeader, {
|
|
20112
20127
|
"ref": rightFixedTableHeader,
|
|
20113
20128
|
"border": props.border,
|
|
20129
|
+
"resizable": props.resizable,
|
|
20114
20130
|
"sort": props.sort,
|
|
20115
20131
|
"style": bodyWidthStyle.value,
|
|
20116
20132
|
"fixed": "right"
|
|
@@ -20138,7 +20154,14 @@ const Table = /* @__PURE__ */ defineComponent({
|
|
|
20138
20154
|
"get-summary": props.getSummary,
|
|
20139
20155
|
"style": bodyWidthStyle.value,
|
|
20140
20156
|
"fixed": "right"
|
|
20141
|
-
}, null)]), [[vShow, props.data && props.data.length > 0]])]),
|
|
20157
|
+
}, null)]), [[vShow, props.data && props.data.length > 0]])]), props.data.length === 0 && createVNode("div", {
|
|
20158
|
+
"ref": emptyBlock,
|
|
20159
|
+
"class": [{
|
|
20160
|
+
'has-height': !!props.height
|
|
20161
|
+
}, 'vc-table__empty-wrapper']
|
|
20162
|
+
}, [slots.empty ? slots.empty() : createVNode("span", {
|
|
20163
|
+
"class": "vc-table__empty-text"
|
|
20164
|
+
}, [props.emptyText || '暂无数据'])]), withDirectives(createVNode("div", {
|
|
20142
20165
|
"ref": resizeProxy,
|
|
20143
20166
|
"class": "vc-table__column-resize-proxy"
|
|
20144
20167
|
}, null), [[vShow, resizeProxyVisible.value]])]);
|