@blueking/ediatable 0.0.1-beta.5 → 0.0.1-beta.7
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 +0 -563
- package/package.json +1 -5
- package/typings/components/head-column.vue.d.ts +13 -17
- package/typings/vue2.d.ts +6 -13
- package/typings/vue3.d.ts +6 -7
- package/vue2/index.es.min.js +236 -268
- package/vue2/index.iife.min.js +276 -305
- package/vue2/index.umd.min.js +276 -305
- package/vue2/vue2.css +41 -38
- package/vue3/index.es.min.js +235 -252
- package/vue3/index.iife.min.js +277 -291
- package/vue3/index.umd.min.js +275 -289
- package/vue3/vue3.css +41 -38
- package/typings/components/date-time-picker-column.vue.d.ts +0 -63
- package/typings/components/input-column.vue.d.ts +0 -77
- package/typings/components/operation-column.vue.d.ts +0 -48
- package/typings/components/select-column.vue.d.ts +0 -65
- package/typings/components/tag-input-column.vue.d.ts +0 -60
package/vue2/index.es.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "@blueking/bkui-library";
|
|
2
|
-
import { ref, provide, onMounted, onBeforeUnmount,
|
|
2
|
+
import { ref, provide, onMounted, onBeforeUnmount, defineComponent, openBlock, createElementBlock, createElementVNode, renderSlot, reactive, toRefs, h as h$1, mergeModels, useModel, useAttrs, useSlots, resolveDirective, normalizeClass, unref, createVNode, mergeProps, createSlots, withCtx, withDirectives, createCommentVNode, computed, createBlock, inject, getCurrentScope, onScopeDispose, watch, getCurrentInstance, normalizeStyle, Fragment, renderList, nextTick, toDisplayString, createApp } from "@blueking/bkui-library";
|
|
3
3
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
4
4
|
function getDefaultExportFromCjs(x3) {
|
|
5
5
|
return x3 && x3.__esModule && Object.prototype.hasOwnProperty.call(x3, "default") ? x3["default"] : x3;
|
|
@@ -5622,208 +5622,11 @@ function useColumnResize(tableRef, tableColumnResizeRef, mouseupCallback) {
|
|
|
5622
5622
|
handleMouseMove
|
|
5623
5623
|
};
|
|
5624
5624
|
}
|
|
5625
|
-
const
|
|
5626
|
-
const encodeMult = (text) => {
|
|
5627
|
-
const temp = document.createElement("textarea");
|
|
5628
|
-
temp.value = text;
|
|
5629
|
-
return temp.value;
|
|
5630
|
-
};
|
|
5631
|
-
function tryOnScopeDispose(fn2) {
|
|
5632
|
-
if (getCurrentScope()) {
|
|
5633
|
-
onScopeDispose(fn2);
|
|
5634
|
-
return true;
|
|
5635
|
-
}
|
|
5636
|
-
return false;
|
|
5637
|
-
}
|
|
5638
|
-
function toValue(r2) {
|
|
5639
|
-
return typeof r2 === "function" ? r2() : unref(r2);
|
|
5640
|
-
}
|
|
5641
|
-
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
5642
|
-
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
5643
|
-
function unrefElement(elRef) {
|
|
5644
|
-
var _a;
|
|
5645
|
-
const plain = toValue(elRef);
|
|
5646
|
-
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
5647
|
-
}
|
|
5648
|
-
const defaultWindow = isClient ? window : void 0;
|
|
5649
|
-
function useMounted() {
|
|
5650
|
-
const isMounted = ref(false);
|
|
5651
|
-
const instance2 = getCurrentInstance();
|
|
5652
|
-
if (instance2) {
|
|
5653
|
-
onMounted(() => {
|
|
5654
|
-
isMounted.value = true;
|
|
5655
|
-
}, instance2);
|
|
5656
|
-
}
|
|
5657
|
-
return isMounted;
|
|
5658
|
-
}
|
|
5659
|
-
function useSupported(callback) {
|
|
5660
|
-
const isMounted = useMounted();
|
|
5661
|
-
return computed(() => {
|
|
5662
|
-
isMounted.value;
|
|
5663
|
-
return Boolean(callback());
|
|
5664
|
-
});
|
|
5665
|
-
}
|
|
5666
|
-
function useResizeObserver(target, callback, options = {}) {
|
|
5667
|
-
const { window: window2 = defaultWindow, ...observerOptions } = options;
|
|
5668
|
-
let observer;
|
|
5669
|
-
const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
|
|
5670
|
-
const cleanup = () => {
|
|
5671
|
-
if (observer) {
|
|
5672
|
-
observer.disconnect();
|
|
5673
|
-
observer = void 0;
|
|
5674
|
-
}
|
|
5675
|
-
};
|
|
5676
|
-
const targets = computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
|
|
5677
|
-
const stopWatch = watch(
|
|
5678
|
-
targets,
|
|
5679
|
-
(els) => {
|
|
5680
|
-
cleanup();
|
|
5681
|
-
if (isSupported.value && window2) {
|
|
5682
|
-
observer = new ResizeObserver(callback);
|
|
5683
|
-
for (const _el of els)
|
|
5684
|
-
_el && observer.observe(_el, observerOptions);
|
|
5685
|
-
}
|
|
5686
|
-
},
|
|
5687
|
-
{ immediate: true, flush: "post" }
|
|
5688
|
-
);
|
|
5689
|
-
const stop = () => {
|
|
5690
|
-
cleanup();
|
|
5691
|
-
stopWatch();
|
|
5692
|
-
};
|
|
5693
|
-
tryOnScopeDispose(stop);
|
|
5694
|
-
return {
|
|
5695
|
-
isSupported,
|
|
5696
|
-
stop
|
|
5697
|
-
};
|
|
5698
|
-
}
|
|
5699
|
-
const _hoisted_1$6 = ["data-fixed", "data-maxWidth", "data-minWidth", "data-width"];
|
|
5700
|
-
const _hoisted_2$2 = { class: "th-cell" };
|
|
5701
|
-
const _hoisted_3$1 = { style: { "display": "inline-block", "line-height": "40px", "vertical-align": "top" } };
|
|
5702
|
-
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
5703
|
-
__name: "head-column",
|
|
5704
|
-
props: {
|
|
5705
|
-
fixed: { default: void 0 },
|
|
5706
|
-
maxWidth: { default: void 0 },
|
|
5707
|
-
minWidth: { default: void 0 },
|
|
5708
|
-
required: { type: Boolean, default: true },
|
|
5709
|
-
width: { default: void 0 },
|
|
5710
|
-
renderAppend: { type: Function, default: void 0 }
|
|
5711
|
-
},
|
|
5712
|
-
setup(__props) {
|
|
5713
|
-
const props2 = __props;
|
|
5714
|
-
const slots = useSlots();
|
|
5715
|
-
const { rowWidth, isOverflow: isMinimize } = inject(renderTablekey);
|
|
5716
|
-
const parentTable = inject(tableColumnResizekey);
|
|
5717
|
-
const columnRef = ref();
|
|
5718
|
-
const currentWidth = ref(0);
|
|
5719
|
-
const columnKey = random$1();
|
|
5720
|
-
let initWidthRate = 0;
|
|
5721
|
-
let isDragedSelf = false;
|
|
5722
|
-
const finalMinWidth = computed(() => props2.minWidth ? props2.minWidth : props2.width ?? 100);
|
|
5723
|
-
const isFixedRight = computed(() => props2.fixed === "right");
|
|
5724
|
-
const isFixedLeft = computed(() => props2.fixed === "left");
|
|
5725
|
-
const styles = computed(() => {
|
|
5726
|
-
if (props2.width && (rowWidth == null ? void 0 : rowWidth.value) && finalMinWidth.value) {
|
|
5727
|
-
const newWidth = rowWidth.value * initWidthRate;
|
|
5728
|
-
if (newWidth !== props2.width) {
|
|
5729
|
-
let width = 0;
|
|
5730
|
-
if (isMinimize == null ? void 0 : isMinimize.value) {
|
|
5731
|
-
if (currentWidth.value !== 0 && (currentWidth.value !== finalMinWidth.value || currentWidth.value !== props2.width)) {
|
|
5732
|
-
width = currentWidth.value;
|
|
5733
|
-
} else {
|
|
5734
|
-
width = finalMinWidth.value;
|
|
5735
|
-
}
|
|
5736
|
-
} else if (newWidth > finalMinWidth.value) {
|
|
5737
|
-
width = newWidth;
|
|
5738
|
-
} else {
|
|
5739
|
-
width = finalMinWidth.value;
|
|
5740
|
-
}
|
|
5741
|
-
return {
|
|
5742
|
-
minWidth: `${width}px`
|
|
5743
|
-
};
|
|
5744
|
-
}
|
|
5745
|
-
}
|
|
5746
|
-
return {
|
|
5747
|
-
minWidth: props2.width ? `${props2.width}px` : "120px"
|
|
5748
|
-
};
|
|
5749
|
-
});
|
|
5750
|
-
const RenderAppendElement = computed(() => props2.renderAppend && props2.renderAppend());
|
|
5751
|
-
watch(
|
|
5752
|
-
() => [props2.width, rowWidth == null ? void 0 : rowWidth.value, currentWidth.value],
|
|
5753
|
-
([width, rowWidth2, currentWidth2]) => {
|
|
5754
|
-
if (!isDragedSelf) {
|
|
5755
|
-
return;
|
|
5756
|
-
}
|
|
5757
|
-
if (width && rowWidth2 && currentWidth2 && finalMinWidth.value) {
|
|
5758
|
-
isDragedSelf = false;
|
|
5759
|
-
if (currentWidth2 !== 0 && (currentWidth2 !== finalMinWidth.value || currentWidth2 !== width)) {
|
|
5760
|
-
initWidthRate = currentWidth2 / rowWidth2;
|
|
5761
|
-
} else {
|
|
5762
|
-
initWidthRate = (isMinimize == null ? void 0 : isMinimize.value) ? finalMinWidth.value / rowWidth2 : width / rowWidth2;
|
|
5763
|
-
}
|
|
5764
|
-
}
|
|
5765
|
-
},
|
|
5766
|
-
{
|
|
5767
|
-
immediate: true
|
|
5768
|
-
}
|
|
5769
|
-
);
|
|
5770
|
-
useResizeObserver(columnRef, () => {
|
|
5771
|
-
if (!isDragedSelf) {
|
|
5772
|
-
return;
|
|
5773
|
-
}
|
|
5774
|
-
const width = parseFloat(columnRef.value.style.width);
|
|
5775
|
-
currentWidth.value = width;
|
|
5776
|
-
});
|
|
5777
|
-
const handleMouseDown = (event) => {
|
|
5778
|
-
isDragedSelf = true;
|
|
5779
|
-
parentTable == null ? void 0 : parentTable.columnMousedown(event, {
|
|
5780
|
-
columnKey,
|
|
5781
|
-
minWidth: finalMinWidth.value
|
|
5782
|
-
});
|
|
5783
|
-
};
|
|
5784
|
-
const handleMouseMove = (event) => {
|
|
5785
|
-
parentTable == null ? void 0 : parentTable.columnMouseMove(event);
|
|
5786
|
-
};
|
|
5787
|
-
return (_ctx, _cache) => {
|
|
5788
|
-
const _directive_overflow_tips = resolveDirective("overflow-tips");
|
|
5789
|
-
return openBlock(), createElementBlock("th", {
|
|
5790
|
-
ref_key: "columnRef",
|
|
5791
|
-
ref: columnRef,
|
|
5792
|
-
class: normalizeClass(["bk-ediatable-head-column", {
|
|
5793
|
-
"is-required": _ctx.required,
|
|
5794
|
-
[`column-${unref(columnKey)}`]: true,
|
|
5795
|
-
"is-right-fixed": unref(isMinimize) && isFixedRight.value,
|
|
5796
|
-
"is-left-fixed": unref(isMinimize) && isFixedLeft.value
|
|
5797
|
-
}]),
|
|
5798
|
-
"data-fixed": _ctx.fixed,
|
|
5799
|
-
"data-maxWidth": _ctx.maxWidth,
|
|
5800
|
-
"data-minWidth": finalMinWidth.value,
|
|
5801
|
-
"data-width": _ctx.width,
|
|
5802
|
-
style: normalizeStyle(styles.value),
|
|
5803
|
-
onMousedown: handleMouseDown,
|
|
5804
|
-
onMousemove: handleMouseMove
|
|
5805
|
-
}, [
|
|
5806
|
-
withDirectives((openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
5807
|
-
renderSlot(_ctx.$slots, "default")
|
|
5808
|
-
])), [
|
|
5809
|
-
[_directive_overflow_tips]
|
|
5810
|
-
]),
|
|
5811
|
-
createElementVNode("div", _hoisted_3$1, [
|
|
5812
|
-
unref(slots).append && !_ctx.renderAppend ? renderSlot(_ctx.$slots, "append", { key: 0 }) : createCommentVNode("v-if", true),
|
|
5813
|
-
_ctx.renderAppend ? (openBlock(), createBlock(unref(RenderAppendElement), { key: 1 })) : createCommentVNode("v-if", true)
|
|
5814
|
-
])
|
|
5815
|
-
], 46, _hoisted_1$6);
|
|
5816
|
-
};
|
|
5817
|
-
}
|
|
5818
|
-
});
|
|
5625
|
+
const _hoisted_1$7 = { style: { "position": "relative" } };
|
|
5819
5626
|
const renderTablekey = Symbol("renderTable");
|
|
5820
|
-
const _sfc_main$
|
|
5627
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
5821
5628
|
__name: "ediatable",
|
|
5822
|
-
props: {
|
|
5823
|
-
theadList: { default: () => [] }
|
|
5824
|
-
},
|
|
5825
5629
|
setup(__props) {
|
|
5826
|
-
const slots = useSlots();
|
|
5827
5630
|
const checkTableScroll = () => {
|
|
5828
5631
|
rowWidth.value = tableRef.value.clientWidth;
|
|
5829
5632
|
isOverflow.value = tableOuterRef.value.clientWidth < tableRef.value.clientWidth;
|
|
@@ -5863,34 +5666,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5863
5666
|
},
|
|
5864
5667
|
[
|
|
5865
5668
|
createElementVNode("thead", null, [
|
|
5866
|
-
createElementVNode("tr",
|
|
5867
|
-
|
|
5868
|
-
Fragment,
|
|
5869
|
-
{ key: 1 },
|
|
5870
|
-
renderList(_ctx.theadList, (head, index2) => {
|
|
5871
|
-
return openBlock(), createBlock(_sfc_main$8, {
|
|
5872
|
-
key: index2,
|
|
5873
|
-
width: head.width,
|
|
5874
|
-
"min-width": head.minWidth,
|
|
5875
|
-
"max-width": head.maxWidth,
|
|
5876
|
-
fixed: head.fixed,
|
|
5877
|
-
required: head.required,
|
|
5878
|
-
"render-append": head.renderAppend
|
|
5879
|
-
}, {
|
|
5880
|
-
default: withCtx(() => [
|
|
5881
|
-
createTextVNode(
|
|
5882
|
-
toDisplayString(head.title),
|
|
5883
|
-
1
|
|
5884
|
-
/* TEXT */
|
|
5885
|
-
)
|
|
5886
|
-
]),
|
|
5887
|
-
_: 2
|
|
5888
|
-
/* DYNAMIC */
|
|
5889
|
-
}, 1032, ["width", "min-width", "max-width", "fixed", "required", "render-append"]);
|
|
5890
|
-
}),
|
|
5891
|
-
128
|
|
5892
|
-
/* KEYED_FRAGMENT */
|
|
5893
|
-
))
|
|
5669
|
+
createElementVNode("tr", _hoisted_1$7, [
|
|
5670
|
+
renderSlot(_ctx.$slots, "default")
|
|
5894
5671
|
])
|
|
5895
5672
|
]),
|
|
5896
5673
|
createElementVNode("tbody", null, [
|
|
@@ -8127,7 +7904,7 @@ __webpack_require__$v.d(__webpack_exports__$v, {
|
|
|
8127
7904
|
),
|
|
8128
7905
|
random: () => (
|
|
8129
7906
|
/* reexport */
|
|
8130
|
-
random
|
|
7907
|
+
random$1
|
|
8131
7908
|
),
|
|
8132
7909
|
renderDirectiveType: () => (
|
|
8133
7910
|
/* reexport */
|
|
@@ -8913,7 +8690,7 @@ var throttle_x$1 = (y4) => {
|
|
|
8913
8690
|
};
|
|
8914
8691
|
const throttle_namespaceObject$1 = throttle_x$1({ ["default"]: () => throttle$1 });
|
|
8915
8692
|
var lowerStr = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
8916
|
-
var random = function
|
|
8693
|
+
var random$1 = function random(n2) {
|
|
8917
8694
|
var str = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : lowerStr;
|
|
8918
8695
|
var result = "";
|
|
8919
8696
|
for (var i3 = 0; i3 < n2; i3++) {
|
|
@@ -48065,12 +47842,12 @@ const DbIcon = defineComponent({
|
|
|
48065
47842
|
});
|
|
48066
47843
|
}
|
|
48067
47844
|
});
|
|
48068
|
-
const _hoisted_1$
|
|
47845
|
+
const _hoisted_1$6 = {
|
|
48069
47846
|
key: 0,
|
|
48070
47847
|
class: "input-error"
|
|
48071
47848
|
};
|
|
48072
|
-
const _sfc_main$
|
|
48073
|
-
__name: "date-time-picker
|
|
47849
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
47850
|
+
__name: "date-time-picker",
|
|
48074
47851
|
props: /* @__PURE__ */ mergeModels({
|
|
48075
47852
|
placeholder: { default: "" },
|
|
48076
47853
|
rules: { default: void 0 },
|
|
@@ -48137,7 +47914,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
48137
47914
|
key: "0"
|
|
48138
47915
|
} : void 0
|
|
48139
47916
|
]), 1040, ["model-value", "placeholder", "type"]),
|
|
48140
|
-
unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
47917
|
+
unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
48141
47918
|
withDirectives(createVNode(
|
|
48142
47919
|
unref(DbIcon),
|
|
48143
47920
|
{ type: "exclamation-fill" },
|
|
@@ -48155,12 +47932,18 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
48155
47932
|
};
|
|
48156
47933
|
}
|
|
48157
47934
|
});
|
|
48158
|
-
const
|
|
47935
|
+
const random2 = () => `${_$1.random(0, 999999)}_${Date.now()}_${_$1.random(0, 999999)}`;
|
|
47936
|
+
const encodeMult = (text) => {
|
|
47937
|
+
const temp = document.createElement("textarea");
|
|
47938
|
+
temp.value = text;
|
|
47939
|
+
return temp.value;
|
|
47940
|
+
};
|
|
47941
|
+
const _hoisted_1$5 = {
|
|
48159
47942
|
key: 1,
|
|
48160
47943
|
class: "blur-dispaly-main"
|
|
48161
47944
|
};
|
|
48162
|
-
const _sfc_main$
|
|
48163
|
-
__name: "input
|
|
47945
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
47946
|
+
__name: "input",
|
|
48164
47947
|
props: /* @__PURE__ */ mergeModels({
|
|
48165
47948
|
placeholder: { default: "请输入" },
|
|
48166
47949
|
rules: { default: void 0 },
|
|
@@ -48236,7 +48019,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
48236
48019
|
event.preventDefault();
|
|
48237
48020
|
let paste = (event.clipboardData || window.clipboardData).getData("text");
|
|
48238
48021
|
paste = encodeMult(paste);
|
|
48239
|
-
modelValue.value
|
|
48022
|
+
modelValue.value += paste.replace(/^\s+|\s+$/g, "");
|
|
48240
48023
|
};
|
|
48241
48024
|
__expose({
|
|
48242
48025
|
getValue() {
|
|
@@ -48295,7 +48078,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
48295
48078
|
)), [
|
|
48296
48079
|
[_directive_bk_tooltips, unref(errorMessage)]
|
|
48297
48080
|
]) : createCommentVNode("v-if", true),
|
|
48298
|
-
_ctx.isShowBlur && isBlur.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
48081
|
+
_ctx.isShowBlur && isBlur.value ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
48299
48082
|
renderSlot(_ctx.$slots, "blur")
|
|
48300
48083
|
])) : createCommentVNode("v-if", true)
|
|
48301
48084
|
],
|
|
@@ -48305,7 +48088,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
48305
48088
|
};
|
|
48306
48089
|
}
|
|
48307
48090
|
});
|
|
48308
|
-
const _sfc_main$
|
|
48091
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
48309
48092
|
__name: "fixed-column",
|
|
48310
48093
|
props: {
|
|
48311
48094
|
fixed: { default: "right" }
|
|
@@ -48333,16 +48116,216 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
48333
48116
|
};
|
|
48334
48117
|
}
|
|
48335
48118
|
});
|
|
48119
|
+
function tryOnScopeDispose(fn2) {
|
|
48120
|
+
if (getCurrentScope()) {
|
|
48121
|
+
onScopeDispose(fn2);
|
|
48122
|
+
return true;
|
|
48123
|
+
}
|
|
48124
|
+
return false;
|
|
48125
|
+
}
|
|
48126
|
+
function toValue(r2) {
|
|
48127
|
+
return typeof r2 === "function" ? r2() : unref(r2);
|
|
48128
|
+
}
|
|
48129
|
+
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
48130
|
+
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
48131
|
+
function unrefElement(elRef) {
|
|
48132
|
+
var _a;
|
|
48133
|
+
const plain = toValue(elRef);
|
|
48134
|
+
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
48135
|
+
}
|
|
48136
|
+
const defaultWindow = isClient ? window : void 0;
|
|
48137
|
+
function useMounted() {
|
|
48138
|
+
const isMounted = ref(false);
|
|
48139
|
+
const instance2 = getCurrentInstance();
|
|
48140
|
+
if (instance2) {
|
|
48141
|
+
onMounted(() => {
|
|
48142
|
+
isMounted.value = true;
|
|
48143
|
+
}, instance2);
|
|
48144
|
+
}
|
|
48145
|
+
return isMounted;
|
|
48146
|
+
}
|
|
48147
|
+
function useSupported(callback) {
|
|
48148
|
+
const isMounted = useMounted();
|
|
48149
|
+
return computed(() => {
|
|
48150
|
+
isMounted.value;
|
|
48151
|
+
return Boolean(callback());
|
|
48152
|
+
});
|
|
48153
|
+
}
|
|
48154
|
+
function useResizeObserver(target, callback, options = {}) {
|
|
48155
|
+
const { window: window2 = defaultWindow, ...observerOptions } = options;
|
|
48156
|
+
let observer;
|
|
48157
|
+
const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
|
|
48158
|
+
const cleanup = () => {
|
|
48159
|
+
if (observer) {
|
|
48160
|
+
observer.disconnect();
|
|
48161
|
+
observer = void 0;
|
|
48162
|
+
}
|
|
48163
|
+
};
|
|
48164
|
+
const targets = computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
|
|
48165
|
+
const stopWatch = watch(
|
|
48166
|
+
targets,
|
|
48167
|
+
(els) => {
|
|
48168
|
+
cleanup();
|
|
48169
|
+
if (isSupported.value && window2) {
|
|
48170
|
+
observer = new ResizeObserver(callback);
|
|
48171
|
+
for (const _el of els)
|
|
48172
|
+
_el && observer.observe(_el, observerOptions);
|
|
48173
|
+
}
|
|
48174
|
+
},
|
|
48175
|
+
{ immediate: true, flush: "post" }
|
|
48176
|
+
);
|
|
48177
|
+
const stop = () => {
|
|
48178
|
+
cleanup();
|
|
48179
|
+
stopWatch();
|
|
48180
|
+
};
|
|
48181
|
+
tryOnScopeDispose(stop);
|
|
48182
|
+
return {
|
|
48183
|
+
isSupported,
|
|
48184
|
+
stop
|
|
48185
|
+
};
|
|
48186
|
+
}
|
|
48187
|
+
const _hoisted_1$4 = ["data-fixed", "data-maxWidth", "data-minWidth", "data-width"];
|
|
48188
|
+
const _hoisted_2$2 = { class: "th-cell" };
|
|
48189
|
+
const _hoisted_3$1 = {
|
|
48190
|
+
key: 0,
|
|
48191
|
+
style: { "display": "inline-block", "line-height": "40px", "vertical-align": "top" }
|
|
48192
|
+
};
|
|
48193
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
48194
|
+
__name: "head-column",
|
|
48195
|
+
props: {
|
|
48196
|
+
width: { default: void 0 },
|
|
48197
|
+
required: { type: Boolean, default: true },
|
|
48198
|
+
minWidth: { default: void 0 },
|
|
48199
|
+
maxWidth: { default: void 0 },
|
|
48200
|
+
fixed: { default: void 0 },
|
|
48201
|
+
memo: { default: void 0 }
|
|
48202
|
+
},
|
|
48203
|
+
setup(__props) {
|
|
48204
|
+
const props2 = __props;
|
|
48205
|
+
const { rowWidth, isOverflow: isMinimize } = inject(renderTablekey);
|
|
48206
|
+
const parentTable = inject(tableColumnResizekey);
|
|
48207
|
+
const slots = useSlots();
|
|
48208
|
+
const columnRef = ref();
|
|
48209
|
+
const currentWidth = ref(0);
|
|
48210
|
+
const columnKey = random2();
|
|
48211
|
+
let initWidthRate = 0;
|
|
48212
|
+
let isDragedSelf = false;
|
|
48213
|
+
const finalMinWidth = computed(() => props2.minWidth ? props2.minWidth : props2.width ?? 100);
|
|
48214
|
+
const isFixedRight = computed(() => props2.fixed === "right");
|
|
48215
|
+
const isFixedLeft = computed(() => props2.fixed === "left");
|
|
48216
|
+
const styles = computed(() => {
|
|
48217
|
+
if (props2.width && (rowWidth == null ? void 0 : rowWidth.value) && finalMinWidth.value) {
|
|
48218
|
+
const newWidth = rowWidth.value * initWidthRate;
|
|
48219
|
+
if (newWidth !== props2.width) {
|
|
48220
|
+
let width = 0;
|
|
48221
|
+
if (isMinimize == null ? void 0 : isMinimize.value) {
|
|
48222
|
+
if (currentWidth.value !== 0 && (currentWidth.value !== finalMinWidth.value || currentWidth.value !== props2.width)) {
|
|
48223
|
+
width = currentWidth.value;
|
|
48224
|
+
} else {
|
|
48225
|
+
width = finalMinWidth.value;
|
|
48226
|
+
}
|
|
48227
|
+
} else if (newWidth > finalMinWidth.value) {
|
|
48228
|
+
width = newWidth;
|
|
48229
|
+
} else {
|
|
48230
|
+
width = finalMinWidth.value;
|
|
48231
|
+
}
|
|
48232
|
+
return {
|
|
48233
|
+
minWidth: `${width}px`
|
|
48234
|
+
};
|
|
48235
|
+
}
|
|
48236
|
+
}
|
|
48237
|
+
return {
|
|
48238
|
+
minWidth: props2.width ? `${props2.width}px` : "120px"
|
|
48239
|
+
};
|
|
48240
|
+
});
|
|
48241
|
+
watch(() => [props2.width, rowWidth == null ? void 0 : rowWidth.value, currentWidth.value], ([width, rowWidth2, currentWidth2]) => {
|
|
48242
|
+
if (!isDragedSelf) {
|
|
48243
|
+
return;
|
|
48244
|
+
}
|
|
48245
|
+
if (width && rowWidth2 && currentWidth2 && finalMinWidth.value) {
|
|
48246
|
+
isDragedSelf = false;
|
|
48247
|
+
if (currentWidth2 !== 0 && (currentWidth2 !== finalMinWidth.value || currentWidth2 !== width)) {
|
|
48248
|
+
initWidthRate = currentWidth2 / rowWidth2;
|
|
48249
|
+
} else {
|
|
48250
|
+
initWidthRate = (isMinimize == null ? void 0 : isMinimize.value) ? finalMinWidth.value / rowWidth2 : width / rowWidth2;
|
|
48251
|
+
}
|
|
48252
|
+
}
|
|
48253
|
+
}, {
|
|
48254
|
+
immediate: true
|
|
48255
|
+
});
|
|
48256
|
+
useResizeObserver(columnRef, () => {
|
|
48257
|
+
if (!isDragedSelf) {
|
|
48258
|
+
return;
|
|
48259
|
+
}
|
|
48260
|
+
const width = parseFloat(columnRef.value.style.width);
|
|
48261
|
+
currentWidth.value = width;
|
|
48262
|
+
});
|
|
48263
|
+
const handleMouseDown = (event) => {
|
|
48264
|
+
isDragedSelf = true;
|
|
48265
|
+
parentTable == null ? void 0 : parentTable.columnMousedown(event, {
|
|
48266
|
+
columnKey,
|
|
48267
|
+
minWidth: finalMinWidth.value
|
|
48268
|
+
});
|
|
48269
|
+
};
|
|
48270
|
+
const handleMouseMove = (event) => {
|
|
48271
|
+
parentTable == null ? void 0 : parentTable.columnMouseMove(event);
|
|
48272
|
+
};
|
|
48273
|
+
return (_ctx, _cache) => {
|
|
48274
|
+
const _directive_overflow_tips = resolveDirective("overflow-tips");
|
|
48275
|
+
const _directive_bk_tooltips = resolveDirective("bk-tooltips");
|
|
48276
|
+
return openBlock(), createElementBlock("th", {
|
|
48277
|
+
ref_key: "columnRef",
|
|
48278
|
+
ref: columnRef,
|
|
48279
|
+
class: normalizeClass(["bk-ediatable-head-column", {
|
|
48280
|
+
"is-required": _ctx.required,
|
|
48281
|
+
[`column-${unref(columnKey)}`]: true,
|
|
48282
|
+
"is-right-fixed": unref(isMinimize) && isFixedRight.value,
|
|
48283
|
+
"is-left-fixed": unref(isMinimize) && isFixedLeft.value
|
|
48284
|
+
}]),
|
|
48285
|
+
"data-fixed": _ctx.fixed,
|
|
48286
|
+
"data-maxWidth": _ctx.maxWidth,
|
|
48287
|
+
"data-minWidth": finalMinWidth.value,
|
|
48288
|
+
"data-width": _ctx.width,
|
|
48289
|
+
style: normalizeStyle(styles.value),
|
|
48290
|
+
onMousedown: handleMouseDown,
|
|
48291
|
+
onMousemove: handleMouseMove
|
|
48292
|
+
}, [
|
|
48293
|
+
withDirectives((openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
48294
|
+
createElementVNode(
|
|
48295
|
+
"span",
|
|
48296
|
+
{
|
|
48297
|
+
class: normalizeClass({ "title-memo": _ctx.memo })
|
|
48298
|
+
},
|
|
48299
|
+
[
|
|
48300
|
+
renderSlot(_ctx.$slots, "default")
|
|
48301
|
+
],
|
|
48302
|
+
2
|
|
48303
|
+
/* CLASS */
|
|
48304
|
+
)
|
|
48305
|
+
])), [
|
|
48306
|
+
[_directive_overflow_tips],
|
|
48307
|
+
[_directive_bk_tooltips, {
|
|
48308
|
+
content: _ctx.memo,
|
|
48309
|
+
disabled: !_ctx.memo
|
|
48310
|
+
}]
|
|
48311
|
+
]),
|
|
48312
|
+
unref(slots).append ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
|
|
48313
|
+
renderSlot(_ctx.$slots, "append")
|
|
48314
|
+
])) : createCommentVNode("v-if", true)
|
|
48315
|
+
], 46, _hoisted_1$4);
|
|
48316
|
+
};
|
|
48317
|
+
}
|
|
48318
|
+
});
|
|
48336
48319
|
const _hoisted_1$3 = { class: "bk-ediatable-operation" };
|
|
48337
48320
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
48338
|
-
__name: "operation
|
|
48321
|
+
__name: "operation",
|
|
48339
48322
|
props: {
|
|
48340
|
-
removeable: { type: Boolean, default: true },
|
|
48341
48323
|
showCopy: { type: Boolean, default: false },
|
|
48342
48324
|
showAdd: { type: Boolean, default: true },
|
|
48343
|
-
showRemove: { type: Boolean, default: true }
|
|
48325
|
+
showRemove: { type: Boolean, default: true },
|
|
48326
|
+
removeable: { type: Boolean, default: true }
|
|
48344
48327
|
},
|
|
48345
|
-
emits: ["
|
|
48328
|
+
emits: ["copy", "add", "remove"],
|
|
48346
48329
|
setup(__props, { emit: __emit }) {
|
|
48347
48330
|
const props2 = __props;
|
|
48348
48331
|
const emits = __emit;
|
|
@@ -48359,7 +48342,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
48359
48342
|
emits("remove");
|
|
48360
48343
|
};
|
|
48361
48344
|
return (_ctx, _cache) => {
|
|
48362
|
-
return openBlock(), createBlock(_sfc_main$
|
|
48345
|
+
return openBlock(), createBlock(_sfc_main$5, null, {
|
|
48363
48346
|
default: withCtx(() => [
|
|
48364
48347
|
createElementVNode("div", _hoisted_1$3, [
|
|
48365
48348
|
_ctx.showCopy ? (openBlock(), createElementBlock("div", {
|
|
@@ -48404,7 +48387,7 @@ const _hoisted_1$2 = {
|
|
|
48404
48387
|
class: "select-error"
|
|
48405
48388
|
};
|
|
48406
48389
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
48407
|
-
__name: "select
|
|
48390
|
+
__name: "select",
|
|
48408
48391
|
props: /* @__PURE__ */ mergeModels({
|
|
48409
48392
|
list: {},
|
|
48410
48393
|
placeholder: { default: "请选择" },
|
|
@@ -49705,7 +49688,7 @@ const _hoisted_2$1 = {
|
|
|
49705
49688
|
style: { "display": "none" }
|
|
49706
49689
|
};
|
|
49707
49690
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
49708
|
-
__name: "tag-input
|
|
49691
|
+
__name: "tag-input",
|
|
49709
49692
|
props: /* @__PURE__ */ mergeModels({
|
|
49710
49693
|
placeholder: { default: "" },
|
|
49711
49694
|
single: { type: Boolean, default: false },
|
|
@@ -49872,7 +49855,7 @@ const _hoisted_3 = {
|
|
|
49872
49855
|
class: "input-error"
|
|
49873
49856
|
};
|
|
49874
49857
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
49875
|
-
__name: "text-plain
|
|
49858
|
+
__name: "text-plain",
|
|
49876
49859
|
props: {
|
|
49877
49860
|
data: {},
|
|
49878
49861
|
isLoading: { type: Boolean },
|
|
@@ -49948,28 +49931,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
49948
49931
|
});
|
|
49949
49932
|
const vue2 = {
|
|
49950
49933
|
name: "Ediatable",
|
|
49951
|
-
props: {
|
|
49952
|
-
theadList: {
|
|
49953
|
-
type: Array,
|
|
49954
|
-
default: []
|
|
49955
|
-
}
|
|
49956
|
-
},
|
|
49957
49934
|
created() {
|
|
49958
|
-
this.app = createApp(_sfc_main$
|
|
49959
|
-
theadList: this.theadList
|
|
49960
|
-
});
|
|
49935
|
+
this.app = createApp(_sfc_main$8);
|
|
49961
49936
|
},
|
|
49962
49937
|
mounted() {
|
|
49963
49938
|
this.app.mount(this.$el);
|
|
49964
|
-
this.unWatchStack = Object.keys(this.$props).map((key) => {
|
|
49965
|
-
return this.$watch(key, (value) => {
|
|
49966
|
-
this.app._instance.props[key] = value;
|
|
49967
|
-
this.app._instance.proxy.$forceUpdate();
|
|
49968
|
-
});
|
|
49969
|
-
});
|
|
49970
49939
|
},
|
|
49971
49940
|
beforeDestroy() {
|
|
49972
|
-
this.unWatchStack.forEach((unWatch) => unWatch());
|
|
49973
49941
|
this.app.unmount();
|
|
49974
49942
|
this.app = null;
|
|
49975
49943
|
},
|
|
@@ -49978,10 +49946,10 @@ const vue2 = {
|
|
|
49978
49946
|
}
|
|
49979
49947
|
};
|
|
49980
49948
|
export {
|
|
49981
|
-
_sfc_main$
|
|
49982
|
-
_sfc_main$
|
|
49983
|
-
_sfc_main$
|
|
49984
|
-
_sfc_main$
|
|
49949
|
+
_sfc_main$7 as DateTimePickerColumn,
|
|
49950
|
+
_sfc_main$5 as FixedColumn,
|
|
49951
|
+
_sfc_main$4 as HeadColumn,
|
|
49952
|
+
_sfc_main$6 as InputColumn,
|
|
49985
49953
|
_sfc_main$3 as OperationColumn,
|
|
49986
49954
|
_sfc_main$2 as SelectColumn,
|
|
49987
49955
|
_sfc_main$1 as TagInputColumn,
|