@blueking/ediatable 0.0.1-beta.4 → 0.0.1-beta.6
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 +563 -0
- package/package.json +5 -1
- package/typings/components/date-time-picker-column.vue.d.ts +63 -0
- package/typings/components/head-column.vue.d.ts +17 -9
- package/typings/components/input-column.vue.d.ts +77 -0
- package/typings/components/operation-column.vue.d.ts +48 -0
- package/typings/components/select-column.vue.d.ts +65 -0
- package/typings/components/tag-input-column.vue.d.ts +60 -0
- package/typings/vue2.d.ts +13 -6
- package/typings/vue3.d.ts +7 -6
- package/vue2/index.es.min.js +267 -219
- package/vue2/index.iife.min.js +304 -256
- package/vue2/index.umd.min.js +304 -256
- package/vue2/vue2.css +38 -38
- package/vue3/index.es.min.js +251 -218
- package/vue3/index.iife.min.js +290 -257
- package/vue3/index.umd.min.js +288 -255
- package/vue3/vue3.css +38 -38
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, getCurrentScope, onScopeDispose, unref, computed, watch, getCurrentInstance, defineComponent, useSlots, inject, resolveDirective, openBlock, createElementBlock, normalizeClass, normalizeStyle, withDirectives, renderSlot, createElementVNode, createCommentVNode, createBlock, Fragment, renderList, withCtx, createTextVNode, toDisplayString, reactive, toRefs, h as h$1, mergeModels, useModel, useAttrs, createVNode, mergeProps, createSlots, nextTick, 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,11 +5622,208 @@ function useColumnResize(tableRef, tableColumnResizeRef, mouseupCallback) {
|
|
|
5622
5622
|
handleMouseMove
|
|
5623
5623
|
};
|
|
5624
5624
|
}
|
|
5625
|
-
const
|
|
5626
|
-
const
|
|
5625
|
+
const random$1 = () => `${_$1.random(0, 999999)}_${Date.now()}_${_$1.random(0, 999999)}`;
|
|
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" } };
|
|
5627
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
|
+
});
|
|
5819
|
+
const renderTablekey = Symbol("renderTable");
|
|
5820
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
5628
5821
|
__name: "ediatable",
|
|
5822
|
+
props: {
|
|
5823
|
+
theadList: { default: () => [] }
|
|
5824
|
+
},
|
|
5629
5825
|
setup(__props) {
|
|
5826
|
+
const slots = useSlots();
|
|
5630
5827
|
const checkTableScroll = () => {
|
|
5631
5828
|
rowWidth.value = tableRef.value.clientWidth;
|
|
5632
5829
|
isOverflow.value = tableOuterRef.value.clientWidth < tableRef.value.clientWidth;
|
|
@@ -5666,8 +5863,34 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
5666
5863
|
},
|
|
5667
5864
|
[
|
|
5668
5865
|
createElementVNode("thead", null, [
|
|
5669
|
-
createElementVNode("tr",
|
|
5670
|
-
renderSlot(_ctx.$slots, "default")
|
|
5866
|
+
createElementVNode("tr", null, [
|
|
5867
|
+
unref(slots).default && _ctx.theadList.length === 0 ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(true), createElementBlock(
|
|
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
|
+
))
|
|
5671
5894
|
])
|
|
5672
5895
|
]),
|
|
5673
5896
|
createElementVNode("tbody", null, [
|
|
@@ -7904,7 +8127,7 @@ __webpack_require__$v.d(__webpack_exports__$v, {
|
|
|
7904
8127
|
),
|
|
7905
8128
|
random: () => (
|
|
7906
8129
|
/* reexport */
|
|
7907
|
-
random
|
|
8130
|
+
random
|
|
7908
8131
|
),
|
|
7909
8132
|
renderDirectiveType: () => (
|
|
7910
8133
|
/* reexport */
|
|
@@ -8690,7 +8913,7 @@ var throttle_x$1 = (y4) => {
|
|
|
8690
8913
|
};
|
|
8691
8914
|
const throttle_namespaceObject$1 = throttle_x$1({ ["default"]: () => throttle$1 });
|
|
8692
8915
|
var lowerStr = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
8693
|
-
var random
|
|
8916
|
+
var random = function random2(n2) {
|
|
8694
8917
|
var str = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : lowerStr;
|
|
8695
8918
|
var result = "";
|
|
8696
8919
|
for (var i3 = 0; i3 < n2; i3++) {
|
|
@@ -47842,12 +48065,12 @@ const DbIcon = defineComponent({
|
|
|
47842
48065
|
});
|
|
47843
48066
|
}
|
|
47844
48067
|
});
|
|
47845
|
-
const _hoisted_1$
|
|
48068
|
+
const _hoisted_1$5 = {
|
|
47846
48069
|
key: 0,
|
|
47847
48070
|
class: "input-error"
|
|
47848
48071
|
};
|
|
47849
|
-
const _sfc_main$
|
|
47850
|
-
__name: "date-time-picker",
|
|
48072
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
48073
|
+
__name: "date-time-picker-column",
|
|
47851
48074
|
props: /* @__PURE__ */ mergeModels({
|
|
47852
48075
|
placeholder: { default: "" },
|
|
47853
48076
|
rules: { default: void 0 },
|
|
@@ -47914,7 +48137,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
47914
48137
|
key: "0"
|
|
47915
48138
|
} : void 0
|
|
47916
48139
|
]), 1040, ["model-value", "placeholder", "type"]),
|
|
47917
|
-
unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
48140
|
+
unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
47918
48141
|
withDirectives(createVNode(
|
|
47919
48142
|
unref(DbIcon),
|
|
47920
48143
|
{ type: "exclamation-fill" },
|
|
@@ -47932,18 +48155,12 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
47932
48155
|
};
|
|
47933
48156
|
}
|
|
47934
48157
|
});
|
|
47935
|
-
const
|
|
47936
|
-
const encodeMult = (text) => {
|
|
47937
|
-
const temp = document.createElement("textarea");
|
|
47938
|
-
temp.value = text;
|
|
47939
|
-
return temp.value;
|
|
47940
|
-
};
|
|
47941
|
-
const _hoisted_1$5 = {
|
|
48158
|
+
const _hoisted_1$4 = {
|
|
47942
48159
|
key: 1,
|
|
47943
48160
|
class: "blur-dispaly-main"
|
|
47944
48161
|
};
|
|
47945
|
-
const _sfc_main$
|
|
47946
|
-
__name: "input",
|
|
48162
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
48163
|
+
__name: "input-column",
|
|
47947
48164
|
props: /* @__PURE__ */ mergeModels({
|
|
47948
48165
|
placeholder: { default: "请输入" },
|
|
47949
48166
|
rules: { default: void 0 },
|
|
@@ -48078,7 +48295,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
48078
48295
|
)), [
|
|
48079
48296
|
[_directive_bk_tooltips, unref(errorMessage)]
|
|
48080
48297
|
]) : createCommentVNode("v-if", true),
|
|
48081
|
-
_ctx.isShowBlur && isBlur.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
48298
|
+
_ctx.isShowBlur && isBlur.value ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
48082
48299
|
renderSlot(_ctx.$slots, "blur")
|
|
48083
48300
|
])) : createCommentVNode("v-if", true)
|
|
48084
48301
|
],
|
|
@@ -48088,7 +48305,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
48088
48305
|
};
|
|
48089
48306
|
}
|
|
48090
48307
|
});
|
|
48091
|
-
const _sfc_main$
|
|
48308
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
48092
48309
|
__name: "fixed-column",
|
|
48093
48310
|
props: {
|
|
48094
48311
|
fixed: { default: "right" }
|
|
@@ -48116,200 +48333,16 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
48116
48333
|
};
|
|
48117
48334
|
}
|
|
48118
48335
|
});
|
|
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
|
-
},
|
|
48202
|
-
setup(__props) {
|
|
48203
|
-
const props2 = __props;
|
|
48204
|
-
const { rowWidth, isOverflow: isMinimize } = inject(renderTablekey);
|
|
48205
|
-
const parentTable = inject(tableColumnResizekey);
|
|
48206
|
-
const slots = useSlots();
|
|
48207
|
-
const columnRef = ref();
|
|
48208
|
-
const currentWidth = ref(0);
|
|
48209
|
-
const columnKey = random2();
|
|
48210
|
-
let initWidthRate = 0;
|
|
48211
|
-
let isDragedSelf = false;
|
|
48212
|
-
const finalMinWidth = computed(() => props2.minWidth ? props2.minWidth : props2.width ?? 100);
|
|
48213
|
-
const isFixedRight = computed(() => props2.fixed === "right");
|
|
48214
|
-
const isFixedLeft = computed(() => props2.fixed === "left");
|
|
48215
|
-
const styles = computed(() => {
|
|
48216
|
-
if (props2.width && (rowWidth == null ? void 0 : rowWidth.value) && finalMinWidth.value) {
|
|
48217
|
-
const newWidth = rowWidth.value * initWidthRate;
|
|
48218
|
-
if (newWidth !== props2.width) {
|
|
48219
|
-
let width = 0;
|
|
48220
|
-
if (isMinimize == null ? void 0 : isMinimize.value) {
|
|
48221
|
-
if (currentWidth.value !== 0 && (currentWidth.value !== finalMinWidth.value || currentWidth.value !== props2.width)) {
|
|
48222
|
-
width = currentWidth.value;
|
|
48223
|
-
} else {
|
|
48224
|
-
width = finalMinWidth.value;
|
|
48225
|
-
}
|
|
48226
|
-
} else if (newWidth > finalMinWidth.value) {
|
|
48227
|
-
width = newWidth;
|
|
48228
|
-
} else {
|
|
48229
|
-
width = finalMinWidth.value;
|
|
48230
|
-
}
|
|
48231
|
-
return {
|
|
48232
|
-
minWidth: `${width}px`
|
|
48233
|
-
};
|
|
48234
|
-
}
|
|
48235
|
-
}
|
|
48236
|
-
return {
|
|
48237
|
-
minWidth: props2.width ? `${props2.width}px` : "120px"
|
|
48238
|
-
};
|
|
48239
|
-
});
|
|
48240
|
-
watch(() => [props2.width, rowWidth == null ? void 0 : rowWidth.value, currentWidth.value], ([width, rowWidth2, currentWidth2]) => {
|
|
48241
|
-
if (!isDragedSelf) {
|
|
48242
|
-
return;
|
|
48243
|
-
}
|
|
48244
|
-
if (width && rowWidth2 && currentWidth2 && finalMinWidth.value) {
|
|
48245
|
-
isDragedSelf = false;
|
|
48246
|
-
if (currentWidth2 !== 0 && (currentWidth2 !== finalMinWidth.value || currentWidth2 !== width)) {
|
|
48247
|
-
initWidthRate = currentWidth2 / rowWidth2;
|
|
48248
|
-
} else {
|
|
48249
|
-
initWidthRate = (isMinimize == null ? void 0 : isMinimize.value) ? finalMinWidth.value / rowWidth2 : width / rowWidth2;
|
|
48250
|
-
}
|
|
48251
|
-
}
|
|
48252
|
-
}, {
|
|
48253
|
-
immediate: true
|
|
48254
|
-
});
|
|
48255
|
-
useResizeObserver(columnRef, () => {
|
|
48256
|
-
if (!isDragedSelf) {
|
|
48257
|
-
return;
|
|
48258
|
-
}
|
|
48259
|
-
const width = parseFloat(columnRef.value.style.width);
|
|
48260
|
-
currentWidth.value = width;
|
|
48261
|
-
});
|
|
48262
|
-
const handleMouseDown = (event) => {
|
|
48263
|
-
isDragedSelf = true;
|
|
48264
|
-
parentTable == null ? void 0 : parentTable.columnMousedown(event, {
|
|
48265
|
-
columnKey,
|
|
48266
|
-
minWidth: finalMinWidth.value
|
|
48267
|
-
});
|
|
48268
|
-
};
|
|
48269
|
-
const handleMouseMove = (event) => {
|
|
48270
|
-
parentTable == null ? void 0 : parentTable.columnMouseMove(event);
|
|
48271
|
-
};
|
|
48272
|
-
return (_ctx, _cache) => {
|
|
48273
|
-
const _directive_overflow_tips = resolveDirective("overflow-tips");
|
|
48274
|
-
return openBlock(), createElementBlock("th", {
|
|
48275
|
-
ref_key: "columnRef",
|
|
48276
|
-
ref: columnRef,
|
|
48277
|
-
class: normalizeClass(["bk-ediatable-head-column", {
|
|
48278
|
-
"is-required": _ctx.required,
|
|
48279
|
-
[`column-${unref(columnKey)}`]: true,
|
|
48280
|
-
"is-right-fixed": unref(isMinimize) && isFixedRight.value,
|
|
48281
|
-
"is-left-fixed": unref(isMinimize) && isFixedLeft.value
|
|
48282
|
-
}]),
|
|
48283
|
-
"data-fixed": _ctx.fixed,
|
|
48284
|
-
"data-maxWidth": _ctx.maxWidth,
|
|
48285
|
-
"data-minWidth": finalMinWidth.value,
|
|
48286
|
-
"data-width": _ctx.width,
|
|
48287
|
-
style: normalizeStyle(styles.value),
|
|
48288
|
-
onMousedown: handleMouseDown,
|
|
48289
|
-
onMousemove: handleMouseMove
|
|
48290
|
-
}, [
|
|
48291
|
-
withDirectives((openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
48292
|
-
renderSlot(_ctx.$slots, "default")
|
|
48293
|
-
])), [
|
|
48294
|
-
[_directive_overflow_tips]
|
|
48295
|
-
]),
|
|
48296
|
-
unref(slots).append ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
|
|
48297
|
-
renderSlot(_ctx.$slots, "append")
|
|
48298
|
-
])) : createCommentVNode("v-if", true)
|
|
48299
|
-
], 46, _hoisted_1$4);
|
|
48300
|
-
};
|
|
48301
|
-
}
|
|
48302
|
-
});
|
|
48303
48336
|
const _hoisted_1$3 = { class: "bk-ediatable-operation" };
|
|
48304
48337
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
48305
|
-
__name: "operation",
|
|
48338
|
+
__name: "operation-column",
|
|
48306
48339
|
props: {
|
|
48340
|
+
removeable: { type: Boolean, default: true },
|
|
48307
48341
|
showCopy: { type: Boolean, default: false },
|
|
48308
48342
|
showAdd: { type: Boolean, default: true },
|
|
48309
|
-
showRemove: { type: Boolean, default: true }
|
|
48310
|
-
removeable: { type: Boolean, default: true }
|
|
48343
|
+
showRemove: { type: Boolean, default: true }
|
|
48311
48344
|
},
|
|
48312
|
-
emits: ["
|
|
48345
|
+
emits: ["add", "copy", "remove"],
|
|
48313
48346
|
setup(__props, { emit: __emit }) {
|
|
48314
48347
|
const props2 = __props;
|
|
48315
48348
|
const emits = __emit;
|
|
@@ -48326,7 +48359,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
48326
48359
|
emits("remove");
|
|
48327
48360
|
};
|
|
48328
48361
|
return (_ctx, _cache) => {
|
|
48329
|
-
return openBlock(), createBlock(_sfc_main$
|
|
48362
|
+
return openBlock(), createBlock(_sfc_main$4, null, {
|
|
48330
48363
|
default: withCtx(() => [
|
|
48331
48364
|
createElementVNode("div", _hoisted_1$3, [
|
|
48332
48365
|
_ctx.showCopy ? (openBlock(), createElementBlock("div", {
|
|
@@ -48371,7 +48404,7 @@ const _hoisted_1$2 = {
|
|
|
48371
48404
|
class: "select-error"
|
|
48372
48405
|
};
|
|
48373
48406
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
48374
|
-
__name: "select",
|
|
48407
|
+
__name: "select-column",
|
|
48375
48408
|
props: /* @__PURE__ */ mergeModels({
|
|
48376
48409
|
list: {},
|
|
48377
48410
|
placeholder: { default: "请选择" },
|
|
@@ -49672,7 +49705,7 @@ const _hoisted_2$1 = {
|
|
|
49672
49705
|
style: { "display": "none" }
|
|
49673
49706
|
};
|
|
49674
49707
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
49675
|
-
__name: "tag-input",
|
|
49708
|
+
__name: "tag-input-column",
|
|
49676
49709
|
props: /* @__PURE__ */ mergeModels({
|
|
49677
49710
|
placeholder: { default: "" },
|
|
49678
49711
|
single: { type: Boolean, default: false },
|
|
@@ -49839,7 +49872,7 @@ const _hoisted_3 = {
|
|
|
49839
49872
|
class: "input-error"
|
|
49840
49873
|
};
|
|
49841
49874
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
49842
|
-
__name: "text-plain",
|
|
49875
|
+
__name: "text-plain-column",
|
|
49843
49876
|
props: {
|
|
49844
49877
|
data: {},
|
|
49845
49878
|
isLoading: { type: Boolean },
|
|
@@ -49915,13 +49948,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
49915
49948
|
});
|
|
49916
49949
|
const vue2 = {
|
|
49917
49950
|
name: "Ediatable",
|
|
49951
|
+
props: {
|
|
49952
|
+
theadList: {
|
|
49953
|
+
type: Array,
|
|
49954
|
+
default: []
|
|
49955
|
+
}
|
|
49956
|
+
},
|
|
49918
49957
|
created() {
|
|
49919
|
-
this.app = createApp(_sfc_main$
|
|
49958
|
+
this.app = createApp(_sfc_main$7, {
|
|
49959
|
+
theadList: this.theadList
|
|
49960
|
+
});
|
|
49920
49961
|
},
|
|
49921
49962
|
mounted() {
|
|
49922
49963
|
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
|
+
});
|
|
49923
49970
|
},
|
|
49924
49971
|
beforeDestroy() {
|
|
49972
|
+
this.unWatchStack.forEach((unWatch) => unWatch());
|
|
49925
49973
|
this.app.unmount();
|
|
49926
49974
|
this.app = null;
|
|
49927
49975
|
},
|
|
@@ -49930,10 +49978,10 @@ const vue2 = {
|
|
|
49930
49978
|
}
|
|
49931
49979
|
};
|
|
49932
49980
|
export {
|
|
49933
|
-
_sfc_main$
|
|
49934
|
-
_sfc_main$
|
|
49935
|
-
_sfc_main$
|
|
49936
|
-
_sfc_main$
|
|
49981
|
+
_sfc_main$6 as DateTimePickerColumn,
|
|
49982
|
+
_sfc_main$4 as FixedColumn,
|
|
49983
|
+
_sfc_main$8 as HeadColumn,
|
|
49984
|
+
_sfc_main$5 as InputColumn,
|
|
49937
49985
|
_sfc_main$3 as OperationColumn,
|
|
49938
49986
|
_sfc_main$2 as SelectColumn,
|
|
49939
49987
|
_sfc_main$1 as TagInputColumn,
|