@blueking/ediatable 0.0.1-beta.3 → 0.0.1-beta.5

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.
@@ -1,5 +1,5 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "@blueking/bkui-library";
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";
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;
@@ -5488,7 +5488,7 @@ lodash.exports;
5488
5488
  var lodashExports = lodash.exports;
5489
5489
  const _$1 = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports);
5490
5490
  !function() {
5491
- var svgCode = '<svg xmlns="http://www.w3.org/2000/svg" data-name="ediatable" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0;visibility:hidden"><symbol id="icon-exclamation-fill" viewBox="0 0 64 64"><path fill="#737987" d="M32 4C16.5 4 4 16.5 4 32s12.5 28 28 28 28-12.5 28-28S47.5 4 32 4zm0 44c-1.7 0-3-1.3-3-3s1.3-3 3-3 3 1.3 3 3-1.3 3-3 3zm3-28.7L34 38c0 1.1-.9 2-2 2s-2-.9-2-2l-1-18.7V19c0-1.7 1.3-3 3-3s3 1.3 3 3v.3z"/></symbol><symbol id="icon-minus-fill" viewBox="0 0 1024 1024"><path d="M512 64C264 64 64 264 64 512s200 448 448 448 448-200 448-448S760 64 512 64zm224 480H288v-64h448v64z"/></symbol><symbol id="icon-plus-fill" viewBox="0 0 1024 1024"><path d="M512 64C264 64 64 264 64 512s200 448 448 448 448-200 448-448S760 64 512 64zm224 480H544v192h-64V544H288v-64h192V288h64v192h192v64z"/></symbol></svg>';
5491
+ var svgCode = '<svg xmlns="http://www.w3.org/2000/svg" data-name="ediatable" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0;visibility:hidden"><symbol id="icon-exclamation-fill" viewBox="0 0 64 64"><path fill="#737987" d="M32 4C16.5 4 4 16.5 4 32s12.5 28 28 28 28-12.5 28-28S47.5 4 32 4zm0 44c-1.7 0-3-1.3-3-3s1.3-3 3-3 3 1.3 3 3-1.3 3-3 3zm3-28.7L34 38c0 1.1-.9 2-2 2s-2-.9-2-2l-1-18.7V19c0-1.7 1.3-3 3-3s3 1.3 3 3v.3z"/></symbol><symbol id="icon-copy" viewBox="0 0 1024 1024"><path d="M864 128H288c-17.6 0-32 14.4-32 32v96h-96c-17.6 0-32 14.4-32 32v576c0 17.6 14.4 32 32 32h576c17.6 0 32-14.4 32-32v-96h96c17.6 0 32-14.4 32-32V160c0-17.6-14.4-32-32-32zM704 704v128H192V320h512v384zm128 0h-64V288c0-17.6-14.4-32-32-32H320v-64h512v512z"/><path d="M275.2 419.2h336v64h-336zM272 544h336v64H272zM272 672h336v64H272z"/></symbol><symbol id="icon-minus-fill" viewBox="0 0 1024 1024"><path d="M512 64C264 64 64 264 64 512s200 448 448 448 448-200 448-448S760 64 512 64zm224 480H288v-64h448v64z"/></symbol><symbol id="icon-plus-fill" viewBox="0 0 1024 1024"><path d="M512 64C264 64 64 264 64 512s200 448 448 448 448-200 448-448S760 64 512 64zm224 480H544v192h-64V544H288v-64h192V288h64v192h192v64z"/></symbol></svg>';
5492
5492
  if (document.body) {
5493
5493
  document.body.insertAdjacentHTML("afterbegin", svgCode);
5494
5494
  } else {
@@ -5622,11 +5622,208 @@ function useColumnResize(tableRef, tableColumnResizeRef, mouseupCallback) {
5622
5622
  handleMouseMove
5623
5623
  };
5624
5624
  }
5625
- const _hoisted_1$7 = { style: { "position": "relative" } };
5626
- const renderTablekey = Symbol("renderTable");
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", _hoisted_1$7, [
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$1
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$1 = function random(n2) {
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$6 = {
48068
+ const _hoisted_1$5 = {
47846
48069
  key: 0,
47847
48070
  class: "input-error"
47848
48071
  };
47849
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
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$6, [
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 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 = {
48158
+ const _hoisted_1$4 = {
47942
48159
  key: 1,
47943
48160
  class: "blur-dispaly-main"
47944
48161
  };
47945
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
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 },
@@ -47951,7 +48168,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
47951
48168
  type: { default: "text" },
47952
48169
  min: { default: Number.MIN_SAFE_INTEGER },
47953
48170
  max: { default: Number.MAX_SAFE_INTEGER },
47954
- isShowBlur: { type: Boolean, default: false }
48171
+ isShowBlur: { type: Boolean, default: false },
48172
+ precision: { default: 0 }
47955
48173
  }, {
47956
48174
  "modelValue": {
47957
48175
  default: ""
@@ -48043,25 +48261,27 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
48043
48261
  }])
48044
48262
  },
48045
48263
  [
48046
- createVNode(unref(__webpack_exports__default$7), {
48264
+ createVNode(unref(__webpack_exports__default$7), mergeProps({
48047
48265
  class: "input-box",
48048
48266
  disabled: _ctx.disabled,
48049
48267
  max: _ctx.max,
48050
48268
  min: _ctx.min,
48051
48269
  "model-value": modelValue.value,
48052
48270
  placeholder: _ctx.placeholder,
48053
- type: _ctx.type,
48271
+ type: _ctx.type
48272
+ }, _ctx.$attrs, {
48273
+ precision: _ctx.precision,
48054
48274
  onBlur: handleBlur,
48055
48275
  onChange: handleInput,
48056
48276
  onFocus: _cache[0] || (_cache[0] = () => isBlur.value = false),
48057
48277
  onInput: handleInput,
48058
48278
  onKeydown: handleKeydown,
48059
48279
  onPaste: handlePaste
48060
- }, {
48280
+ }), {
48061
48281
  suffix: withCtx(() => []),
48062
48282
  _: 1
48063
48283
  /* STABLE */
48064
- }, 8, ["disabled", "max", "min", "model-value", "placeholder", "type"]),
48284
+ }, 16, ["disabled", "max", "min", "model-value", "placeholder", "type", "precision"]),
48065
48285
  unref(errorMessage) ? withDirectives((openBlock(), createBlock(
48066
48286
  unref(DbIcon),
48067
48287
  {
@@ -48075,7 +48295,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
48075
48295
  )), [
48076
48296
  [_directive_bk_tooltips, unref(errorMessage)]
48077
48297
  ]) : createCommentVNode("v-if", true),
48078
- _ctx.isShowBlur && isBlur.value ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
48298
+ _ctx.isShowBlur && isBlur.value ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
48079
48299
  renderSlot(_ctx.$slots, "blur")
48080
48300
  ])) : createCommentVNode("v-if", true)
48081
48301
  ],
@@ -48085,7 +48305,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
48085
48305
  };
48086
48306
  }
48087
48307
  });
48088
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
48308
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
48089
48309
  __name: "fixed-column",
48090
48310
  props: {
48091
48311
  fixed: { default: "right" }
@@ -48113,202 +48333,22 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
48113
48333
  };
48114
48334
  }
48115
48335
  });
48116
- function tryOnScopeDispose(fn2) {
48117
- if (getCurrentScope()) {
48118
- onScopeDispose(fn2);
48119
- return true;
48120
- }
48121
- return false;
48122
- }
48123
- function toValue(r2) {
48124
- return typeof r2 === "function" ? r2() : unref(r2);
48125
- }
48126
- const isClient = typeof window !== "undefined" && typeof document !== "undefined";
48127
- typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
48128
- function unrefElement(elRef) {
48129
- var _a;
48130
- const plain = toValue(elRef);
48131
- return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
48132
- }
48133
- const defaultWindow = isClient ? window : void 0;
48134
- function useMounted() {
48135
- const isMounted = ref(false);
48136
- const instance2 = getCurrentInstance();
48137
- if (instance2) {
48138
- onMounted(() => {
48139
- isMounted.value = true;
48140
- }, instance2);
48141
- }
48142
- return isMounted;
48143
- }
48144
- function useSupported(callback) {
48145
- const isMounted = useMounted();
48146
- return computed(() => {
48147
- isMounted.value;
48148
- return Boolean(callback());
48149
- });
48150
- }
48151
- function useResizeObserver(target, callback, options = {}) {
48152
- const { window: window2 = defaultWindow, ...observerOptions } = options;
48153
- let observer;
48154
- const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
48155
- const cleanup = () => {
48156
- if (observer) {
48157
- observer.disconnect();
48158
- observer = void 0;
48159
- }
48160
- };
48161
- const targets = computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
48162
- const stopWatch = watch(
48163
- targets,
48164
- (els) => {
48165
- cleanup();
48166
- if (isSupported.value && window2) {
48167
- observer = new ResizeObserver(callback);
48168
- for (const _el of els)
48169
- _el && observer.observe(_el, observerOptions);
48170
- }
48171
- },
48172
- { immediate: true, flush: "post" }
48173
- );
48174
- const stop = () => {
48175
- cleanup();
48176
- stopWatch();
48177
- };
48178
- tryOnScopeDispose(stop);
48179
- return {
48180
- isSupported,
48181
- stop
48182
- };
48183
- }
48184
- const _hoisted_1$4 = ["data-fixed", "data-maxWidth", "data-minWidth", "data-width"];
48185
- const _hoisted_2$2 = { class: "th-cell" };
48186
- const _hoisted_3$1 = {
48187
- key: 0,
48188
- style: { "display": "inline-block", "line-height": "40px", "vertical-align": "top" }
48189
- };
48190
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
48191
- __name: "head-column",
48192
- props: {
48193
- width: { default: void 0 },
48194
- required: { type: Boolean, default: true },
48195
- minWidth: { default: void 0 },
48196
- maxWidth: { default: void 0 },
48197
- fixed: { default: void 0 }
48198
- },
48199
- setup(__props) {
48200
- const props2 = __props;
48201
- const { rowWidth, isOverflow: isMinimize } = inject(renderTablekey);
48202
- const parentTable = inject(tableColumnResizekey);
48203
- const slots = useSlots();
48204
- const columnRef = ref();
48205
- const currentWidth = ref(0);
48206
- const columnKey = random2();
48207
- let initWidthRate = 0;
48208
- let isDragedSelf = false;
48209
- const finalMinWidth = computed(() => props2.minWidth ? props2.minWidth : props2.width ?? 100);
48210
- const isFixedRight = computed(() => props2.fixed === "right");
48211
- const isFixedLeft = computed(() => props2.fixed === "left");
48212
- const styles = computed(() => {
48213
- if (props2.width && (rowWidth == null ? void 0 : rowWidth.value) && finalMinWidth.value) {
48214
- const newWidth = rowWidth.value * initWidthRate;
48215
- if (newWidth !== props2.width) {
48216
- let width = 0;
48217
- if (isMinimize == null ? void 0 : isMinimize.value) {
48218
- if (currentWidth.value !== 0 && (currentWidth.value !== finalMinWidth.value || currentWidth.value !== props2.width)) {
48219
- width = currentWidth.value;
48220
- } else {
48221
- width = finalMinWidth.value;
48222
- }
48223
- } else if (newWidth > finalMinWidth.value) {
48224
- width = newWidth;
48225
- } else {
48226
- width = finalMinWidth.value;
48227
- }
48228
- return {
48229
- minWidth: `${width}px`
48230
- };
48231
- }
48232
- }
48233
- return {
48234
- minWidth: props2.width ? `${props2.width}px` : "120px"
48235
- };
48236
- });
48237
- watch(() => [props2.width, rowWidth == null ? void 0 : rowWidth.value, currentWidth.value], ([width, rowWidth2, currentWidth2]) => {
48238
- if (!isDragedSelf) {
48239
- return;
48240
- }
48241
- if (width && rowWidth2 && currentWidth2 && finalMinWidth.value) {
48242
- isDragedSelf = false;
48243
- if (currentWidth2 !== 0 && (currentWidth2 !== finalMinWidth.value || currentWidth2 !== width)) {
48244
- initWidthRate = currentWidth2 / rowWidth2;
48245
- } else {
48246
- initWidthRate = (isMinimize == null ? void 0 : isMinimize.value) ? finalMinWidth.value / rowWidth2 : width / rowWidth2;
48247
- }
48248
- }
48249
- }, {
48250
- immediate: true
48251
- });
48252
- useResizeObserver(columnRef, () => {
48253
- if (!isDragedSelf) {
48254
- return;
48255
- }
48256
- const width = parseFloat(columnRef.value.style.width);
48257
- currentWidth.value = width;
48258
- });
48259
- const handleMouseDown = (event) => {
48260
- isDragedSelf = true;
48261
- parentTable == null ? void 0 : parentTable.columnMousedown(event, {
48262
- columnKey,
48263
- minWidth: finalMinWidth.value
48264
- });
48265
- };
48266
- const handleMouseMove = (event) => {
48267
- parentTable == null ? void 0 : parentTable.columnMouseMove(event);
48268
- };
48269
- return (_ctx, _cache) => {
48270
- const _directive_overflow_tips = resolveDirective("overflow-tips");
48271
- return openBlock(), createElementBlock("th", {
48272
- ref_key: "columnRef",
48273
- ref: columnRef,
48274
- class: normalizeClass(["bk-ediatable-head-column", {
48275
- "is-required": _ctx.required,
48276
- [`column-${unref(columnKey)}`]: true,
48277
- "is-right-fixed": unref(isMinimize) && isFixedRight.value,
48278
- "is-left-fixed": unref(isMinimize) && isFixedLeft.value
48279
- }]),
48280
- "data-fixed": _ctx.fixed,
48281
- "data-maxWidth": _ctx.maxWidth,
48282
- "data-minWidth": finalMinWidth.value,
48283
- "data-width": _ctx.width,
48284
- style: normalizeStyle(styles.value),
48285
- onMousedown: handleMouseDown,
48286
- onMousemove: handleMouseMove
48287
- }, [
48288
- withDirectives((openBlock(), createElementBlock("div", _hoisted_2$2, [
48289
- renderSlot(_ctx.$slots, "default")
48290
- ])), [
48291
- [_directive_overflow_tips]
48292
- ]),
48293
- unref(slots).append ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
48294
- renderSlot(_ctx.$slots, "append")
48295
- ])) : createCommentVNode("v-if", true)
48296
- ], 46, _hoisted_1$4);
48297
- };
48298
- }
48299
- });
48300
48336
  const _hoisted_1$3 = { class: "bk-ediatable-operation" };
48301
48337
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
48302
- __name: "operation",
48338
+ __name: "operation-column",
48303
48339
  props: {
48340
+ removeable: { type: Boolean, default: true },
48341
+ showCopy: { type: Boolean, default: false },
48304
48342
  showAdd: { type: Boolean, default: true },
48305
- showRemove: { type: Boolean, default: true },
48306
- removeable: { type: Boolean, default: true }
48343
+ showRemove: { type: Boolean, default: true }
48307
48344
  },
48308
- emits: ["add", "remove"],
48345
+ emits: ["add", "copy", "remove"],
48309
48346
  setup(__props, { emit: __emit }) {
48310
48347
  const props2 = __props;
48311
48348
  const emits = __emit;
48349
+ const handleCopy = () => {
48350
+ emits("copy");
48351
+ };
48312
48352
  const handleAppend = () => {
48313
48353
  emits("add");
48314
48354
  };
@@ -48319,12 +48359,19 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
48319
48359
  emits("remove");
48320
48360
  };
48321
48361
  return (_ctx, _cache) => {
48322
- return openBlock(), createBlock(_sfc_main$5, null, {
48362
+ return openBlock(), createBlock(_sfc_main$4, null, {
48323
48363
  default: withCtx(() => [
48324
48364
  createElementVNode("div", _hoisted_1$3, [
48325
- _ctx.showAdd ? (openBlock(), createElementBlock("div", {
48365
+ _ctx.showCopy ? (openBlock(), createElementBlock("div", {
48326
48366
  key: 0,
48327
48367
  class: "action-btn",
48368
+ onClick: handleCopy
48369
+ }, [
48370
+ createVNode(unref(DbIcon), { type: "copy" })
48371
+ ])) : createCommentVNode("v-if", true),
48372
+ _ctx.showAdd ? (openBlock(), createElementBlock("div", {
48373
+ key: 1,
48374
+ class: "action-btn",
48328
48375
  onClick: handleAppend
48329
48376
  }, [
48330
48377
  createVNode(unref(DbIcon), { type: "plus-fill" })
@@ -48332,7 +48379,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
48332
48379
  _ctx.showRemove ? (openBlock(), createElementBlock(
48333
48380
  "div",
48334
48381
  {
48335
- key: 1,
48382
+ key: 2,
48336
48383
  class: normalizeClass(["action-btn", {
48337
48384
  disabled: _ctx.removeable
48338
48385
  }]),
@@ -48357,7 +48404,7 @@ const _hoisted_1$2 = {
48357
48404
  class: "select-error"
48358
48405
  };
48359
48406
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
48360
- __name: "select",
48407
+ __name: "select-column",
48361
48408
  props: /* @__PURE__ */ mergeModels({
48362
48409
  list: {},
48363
48410
  placeholder: { default: "请选择" },
@@ -48436,7 +48483,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
48436
48483
  style: normalizeStyle({ height: rootHeight.value + "px" })
48437
48484
  },
48438
48485
  [
48439
- createVNode(unref(__webpack_exports__default$2), {
48486
+ createVNode(unref(__webpack_exports__default$2), mergeProps(_ctx.$attrs, {
48440
48487
  "model-value": localValue.value,
48441
48488
  "auto-focus": "",
48442
48489
  class: "select-box",
@@ -48449,7 +48496,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
48449
48496
  "show-select-all": _ctx.showSelectAll,
48450
48497
  onChange: handleSelect,
48451
48498
  onClear: handleRemove
48452
- }, {
48499
+ }), {
48453
48500
  default: withCtx(() => [
48454
48501
  (openBlock(true), createElementBlock(
48455
48502
  Fragment,
@@ -48467,7 +48514,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
48467
48514
  ]),
48468
48515
  _: 1
48469
48516
  /* STABLE */
48470
- }, 8, ["model-value", "disabled", "multiple", "placeholder", "show-select-all"]),
48517
+ }, 16, ["model-value", "disabled", "multiple", "placeholder", "show-select-all"]),
48471
48518
  unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
48472
48519
  withDirectives(createVNode(
48473
48520
  unref(DbIcon),
@@ -49658,7 +49705,7 @@ const _hoisted_2$1 = {
49658
49705
  style: { "display": "none" }
49659
49706
  };
49660
49707
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
49661
- __name: "tag-input",
49708
+ __name: "tag-input-column",
49662
49709
  props: /* @__PURE__ */ mergeModels({
49663
49710
  placeholder: { default: "" },
49664
49711
  single: { type: Boolean, default: false },
@@ -49744,8 +49791,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
49744
49791
  class: normalizeClass(["bk-ediatable-tag-input", { ["is-error"]: Boolean(unref(errorMessage)) }])
49745
49792
  },
49746
49793
  [
49747
- createVNode(unref(__webpack_exports__default$1), {
49748
- "model-value": modelValue.value,
49794
+ createVNode(unref(__webpack_exports__default$1), mergeProps({ "model-value": modelValue.value }, _ctx.$attrs, {
49749
49795
  "allow-auto-match": "",
49750
49796
  "allow-create": "",
49751
49797
  clearable: false,
@@ -49757,7 +49803,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
49757
49803
  onBlur: handleBlur,
49758
49804
  onChange: handleChange,
49759
49805
  onFocus: handleFocus
49760
- }, null, 8, ["model-value", "max-data", "placeholder"]),
49806
+ }), null, 16, ["model-value", "max-data", "placeholder"]),
49761
49807
  unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
49762
49808
  withDirectives(createVNode(
49763
49809
  unref(DbIcon),
@@ -49826,7 +49872,7 @@ const _hoisted_3 = {
49826
49872
  class: "input-error"
49827
49873
  };
49828
49874
  const _sfc_main = /* @__PURE__ */ defineComponent({
49829
- __name: "text-plain",
49875
+ __name: "text-plain-column",
49830
49876
  props: {
49831
49877
  data: {},
49832
49878
  isLoading: { type: Boolean },
@@ -49902,13 +49948,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49902
49948
  });
49903
49949
  const vue2 = {
49904
49950
  name: "Ediatable",
49951
+ props: {
49952
+ theadList: {
49953
+ type: Array,
49954
+ default: []
49955
+ }
49956
+ },
49905
49957
  created() {
49906
- this.app = createApp(_sfc_main$8);
49958
+ this.app = createApp(_sfc_main$7, {
49959
+ theadList: this.theadList
49960
+ });
49907
49961
  },
49908
49962
  mounted() {
49909
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
+ });
49910
49970
  },
49911
49971
  beforeDestroy() {
49972
+ this.unWatchStack.forEach((unWatch) => unWatch());
49912
49973
  this.app.unmount();
49913
49974
  this.app = null;
49914
49975
  },
@@ -49917,10 +49978,10 @@ const vue2 = {
49917
49978
  }
49918
49979
  };
49919
49980
  export {
49920
- _sfc_main$7 as DateTimePickerColumn,
49921
- _sfc_main$5 as FixedColumn,
49922
- _sfc_main$4 as HeadColumn,
49923
- _sfc_main$6 as InputColumn,
49981
+ _sfc_main$6 as DateTimePickerColumn,
49982
+ _sfc_main$4 as FixedColumn,
49983
+ _sfc_main$8 as HeadColumn,
49984
+ _sfc_main$5 as InputColumn,
49924
49985
  _sfc_main$3 as OperationColumn,
49925
49986
  _sfc_main$2 as SelectColumn,
49926
49987
  _sfc_main$1 as TagInputColumn,