@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,4 +1,4 @@
1
- import { ref, provide, onMounted, onBeforeUnmount, defineComponent, openBlock, createElementBlock, createElementVNode, renderSlot, reactive, toRefs, h, 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 } from "vue";
1
+ 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, mergeModels, useModel, useAttrs, createVNode, mergeProps, createSlots, nextTick } from "vue";
2
2
  import "bkui-vue/dist/style.css";
3
3
  import { DatePicker, Input, Select, TagInput, Loading } from "bkui-vue";
4
4
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -5489,7 +5489,7 @@ lodash.exports;
5489
5489
  var lodashExports = lodash.exports;
5490
5490
  const _ = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports);
5491
5491
  !function() {
5492
- 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>';
5492
+ 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>';
5493
5493
  if (document.body) {
5494
5494
  document.body.insertAdjacentHTML("afterbegin", svgCode);
5495
5495
  } else {
@@ -5623,11 +5623,208 @@ function useColumnResize(tableRef, tableColumnResizeRef, mouseupCallback) {
5623
5623
  handleMouseMove
5624
5624
  };
5625
5625
  }
5626
- const _hoisted_1$7 = { style: { "position": "relative" } };
5627
- const renderTablekey = Symbol("renderTable");
5626
+ const random = () => `${_.random(0, 999999)}_${Date.now()}_${_.random(0, 999999)}`;
5627
+ const encodeMult = (text) => {
5628
+ const temp = document.createElement("textarea");
5629
+ temp.value = text;
5630
+ return temp.value;
5631
+ };
5632
+ function tryOnScopeDispose(fn2) {
5633
+ if (getCurrentScope()) {
5634
+ onScopeDispose(fn2);
5635
+ return true;
5636
+ }
5637
+ return false;
5638
+ }
5639
+ function toValue(r) {
5640
+ return typeof r === "function" ? r() : unref(r);
5641
+ }
5642
+ const isClient = typeof window !== "undefined" && typeof document !== "undefined";
5643
+ typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
5644
+ function unrefElement(elRef) {
5645
+ var _a;
5646
+ const plain = toValue(elRef);
5647
+ return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
5648
+ }
5649
+ const defaultWindow = isClient ? window : void 0;
5650
+ function useMounted() {
5651
+ const isMounted = ref(false);
5652
+ const instance = getCurrentInstance();
5653
+ if (instance) {
5654
+ onMounted(() => {
5655
+ isMounted.value = true;
5656
+ }, instance);
5657
+ }
5658
+ return isMounted;
5659
+ }
5660
+ function useSupported(callback) {
5661
+ const isMounted = useMounted();
5662
+ return computed(() => {
5663
+ isMounted.value;
5664
+ return Boolean(callback());
5665
+ });
5666
+ }
5667
+ function useResizeObserver(target, callback, options = {}) {
5668
+ const { window: window2 = defaultWindow, ...observerOptions } = options;
5669
+ let observer;
5670
+ const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
5671
+ const cleanup = () => {
5672
+ if (observer) {
5673
+ observer.disconnect();
5674
+ observer = void 0;
5675
+ }
5676
+ };
5677
+ const targets = computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
5678
+ const stopWatch = watch(
5679
+ targets,
5680
+ (els) => {
5681
+ cleanup();
5682
+ if (isSupported.value && window2) {
5683
+ observer = new ResizeObserver(callback);
5684
+ for (const _el of els)
5685
+ _el && observer.observe(_el, observerOptions);
5686
+ }
5687
+ },
5688
+ { immediate: true, flush: "post" }
5689
+ );
5690
+ const stop = () => {
5691
+ cleanup();
5692
+ stopWatch();
5693
+ };
5694
+ tryOnScopeDispose(stop);
5695
+ return {
5696
+ isSupported,
5697
+ stop
5698
+ };
5699
+ }
5700
+ const _hoisted_1$6 = ["data-fixed", "data-maxWidth", "data-minWidth", "data-width"];
5701
+ const _hoisted_2$2 = { class: "th-cell" };
5702
+ const _hoisted_3$1 = { style: { "display": "inline-block", "line-height": "40px", "vertical-align": "top" } };
5628
5703
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
5704
+ __name: "head-column",
5705
+ props: {
5706
+ fixed: { default: void 0 },
5707
+ maxWidth: { default: void 0 },
5708
+ minWidth: { default: void 0 },
5709
+ required: { type: Boolean, default: true },
5710
+ width: { default: void 0 },
5711
+ renderAppend: { type: Function, default: void 0 }
5712
+ },
5713
+ setup(__props) {
5714
+ const props = __props;
5715
+ const slots = useSlots();
5716
+ const { rowWidth, isOverflow: isMinimize } = inject(renderTablekey);
5717
+ const parentTable = inject(tableColumnResizekey);
5718
+ const columnRef = ref();
5719
+ const currentWidth = ref(0);
5720
+ const columnKey = random();
5721
+ let initWidthRate = 0;
5722
+ let isDragedSelf = false;
5723
+ const finalMinWidth = computed(() => props.minWidth ? props.minWidth : props.width ?? 100);
5724
+ const isFixedRight = computed(() => props.fixed === "right");
5725
+ const isFixedLeft = computed(() => props.fixed === "left");
5726
+ const styles = computed(() => {
5727
+ if (props.width && (rowWidth == null ? void 0 : rowWidth.value) && finalMinWidth.value) {
5728
+ const newWidth = rowWidth.value * initWidthRate;
5729
+ if (newWidth !== props.width) {
5730
+ let width = 0;
5731
+ if (isMinimize == null ? void 0 : isMinimize.value) {
5732
+ if (currentWidth.value !== 0 && (currentWidth.value !== finalMinWidth.value || currentWidth.value !== props.width)) {
5733
+ width = currentWidth.value;
5734
+ } else {
5735
+ width = finalMinWidth.value;
5736
+ }
5737
+ } else if (newWidth > finalMinWidth.value) {
5738
+ width = newWidth;
5739
+ } else {
5740
+ width = finalMinWidth.value;
5741
+ }
5742
+ return {
5743
+ minWidth: `${width}px`
5744
+ };
5745
+ }
5746
+ }
5747
+ return {
5748
+ minWidth: props.width ? `${props.width}px` : "120px"
5749
+ };
5750
+ });
5751
+ const RenderAppendElement = computed(() => props.renderAppend && props.renderAppend());
5752
+ watch(
5753
+ () => [props.width, rowWidth == null ? void 0 : rowWidth.value, currentWidth.value],
5754
+ ([width, rowWidth2, currentWidth2]) => {
5755
+ if (!isDragedSelf) {
5756
+ return;
5757
+ }
5758
+ if (width && rowWidth2 && currentWidth2 && finalMinWidth.value) {
5759
+ isDragedSelf = false;
5760
+ if (currentWidth2 !== 0 && (currentWidth2 !== finalMinWidth.value || currentWidth2 !== width)) {
5761
+ initWidthRate = currentWidth2 / rowWidth2;
5762
+ } else {
5763
+ initWidthRate = (isMinimize == null ? void 0 : isMinimize.value) ? finalMinWidth.value / rowWidth2 : width / rowWidth2;
5764
+ }
5765
+ }
5766
+ },
5767
+ {
5768
+ immediate: true
5769
+ }
5770
+ );
5771
+ useResizeObserver(columnRef, () => {
5772
+ if (!isDragedSelf) {
5773
+ return;
5774
+ }
5775
+ const width = parseFloat(columnRef.value.style.width);
5776
+ currentWidth.value = width;
5777
+ });
5778
+ const handleMouseDown = (event) => {
5779
+ isDragedSelf = true;
5780
+ parentTable == null ? void 0 : parentTable.columnMousedown(event, {
5781
+ columnKey,
5782
+ minWidth: finalMinWidth.value
5783
+ });
5784
+ };
5785
+ const handleMouseMove = (event) => {
5786
+ parentTable == null ? void 0 : parentTable.columnMouseMove(event);
5787
+ };
5788
+ return (_ctx, _cache) => {
5789
+ const _directive_overflow_tips = resolveDirective("overflow-tips");
5790
+ return openBlock(), createElementBlock("th", {
5791
+ ref_key: "columnRef",
5792
+ ref: columnRef,
5793
+ class: normalizeClass(["bk-ediatable-head-column", {
5794
+ "is-required": _ctx.required,
5795
+ [`column-${unref(columnKey)}`]: true,
5796
+ "is-right-fixed": unref(isMinimize) && isFixedRight.value,
5797
+ "is-left-fixed": unref(isMinimize) && isFixedLeft.value
5798
+ }]),
5799
+ "data-fixed": _ctx.fixed,
5800
+ "data-maxWidth": _ctx.maxWidth,
5801
+ "data-minWidth": finalMinWidth.value,
5802
+ "data-width": _ctx.width,
5803
+ style: normalizeStyle(styles.value),
5804
+ onMousedown: handleMouseDown,
5805
+ onMousemove: handleMouseMove
5806
+ }, [
5807
+ withDirectives((openBlock(), createElementBlock("div", _hoisted_2$2, [
5808
+ renderSlot(_ctx.$slots, "default")
5809
+ ])), [
5810
+ [_directive_overflow_tips]
5811
+ ]),
5812
+ createElementVNode("div", _hoisted_3$1, [
5813
+ unref(slots).append && !_ctx.renderAppend ? renderSlot(_ctx.$slots, "append", { key: 0 }) : createCommentVNode("v-if", true),
5814
+ _ctx.renderAppend ? (openBlock(), createBlock(unref(RenderAppendElement), { key: 1 })) : createCommentVNode("v-if", true)
5815
+ ])
5816
+ ], 46, _hoisted_1$6);
5817
+ };
5818
+ }
5819
+ });
5820
+ const renderTablekey = Symbol("renderTable");
5821
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
5629
5822
  __name: "ediatable",
5823
+ props: {
5824
+ theadList: { default: () => [] }
5825
+ },
5630
5826
  setup(__props) {
5827
+ const slots = useSlots();
5631
5828
  const checkTableScroll = () => {
5632
5829
  rowWidth.value = tableRef.value.clientWidth;
5633
5830
  isOverflow.value = tableOuterRef.value.clientWidth < tableRef.value.clientWidth;
@@ -5667,8 +5864,34 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
5667
5864
  },
5668
5865
  [
5669
5866
  createElementVNode("thead", null, [
5670
- createElementVNode("tr", _hoisted_1$7, [
5671
- renderSlot(_ctx.$slots, "default")
5867
+ createElementVNode("tr", null, [
5868
+ unref(slots).default && _ctx.theadList.length === 0 ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(true), createElementBlock(
5869
+ Fragment,
5870
+ { key: 1 },
5871
+ renderList(_ctx.theadList, (head, index) => {
5872
+ return openBlock(), createBlock(_sfc_main$8, {
5873
+ key: index,
5874
+ width: head.width,
5875
+ "min-width": head.minWidth,
5876
+ "max-width": head.maxWidth,
5877
+ fixed: head.fixed,
5878
+ required: head.required,
5879
+ "render-append": head.renderAppend
5880
+ }, {
5881
+ default: withCtx(() => [
5882
+ createTextVNode(
5883
+ toDisplayString(head.title),
5884
+ 1
5885
+ /* TEXT */
5886
+ )
5887
+ ]),
5888
+ _: 2
5889
+ /* DYNAMIC */
5890
+ }, 1032, ["width", "min-width", "max-width", "fixed", "required", "render-append"]);
5891
+ }),
5892
+ 128
5893
+ /* KEYED_FRAGMENT */
5894
+ ))
5672
5895
  ])
5673
5896
  ]),
5674
5897
  createElementVNode("tbody", null, [
@@ -5789,12 +6012,12 @@ const DbIcon = defineComponent({
5789
6012
  });
5790
6013
  }
5791
6014
  });
5792
- const _hoisted_1$6 = {
6015
+ const _hoisted_1$5 = {
5793
6016
  key: 0,
5794
6017
  class: "input-error"
5795
6018
  };
5796
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
5797
- __name: "date-time-picker",
6019
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
6020
+ __name: "date-time-picker-column",
5798
6021
  props: /* @__PURE__ */ mergeModels({
5799
6022
  placeholder: { default: "" },
5800
6023
  rules: { default: void 0 },
@@ -5861,7 +6084,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
5861
6084
  key: "0"
5862
6085
  } : void 0
5863
6086
  ]), 1040, ["model-value", "placeholder", "type"]),
5864
- unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$6, [
6087
+ unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
5865
6088
  withDirectives(createVNode(
5866
6089
  unref(DbIcon),
5867
6090
  { type: "exclamation-fill" },
@@ -5879,18 +6102,12 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
5879
6102
  };
5880
6103
  }
5881
6104
  });
5882
- const random = () => `${_.random(0, 999999)}_${Date.now()}_${_.random(0, 999999)}`;
5883
- const encodeMult = (text) => {
5884
- const temp = document.createElement("textarea");
5885
- temp.value = text;
5886
- return temp.value;
5887
- };
5888
- const _hoisted_1$5 = {
6105
+ const _hoisted_1$4 = {
5889
6106
  key: 1,
5890
6107
  class: "blur-dispaly-main"
5891
6108
  };
5892
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
5893
- __name: "input",
6109
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
6110
+ __name: "input-column",
5894
6111
  props: /* @__PURE__ */ mergeModels({
5895
6112
  placeholder: { default: "请输入" },
5896
6113
  rules: { default: void 0 },
@@ -5898,7 +6115,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
5898
6115
  type: { default: "text" },
5899
6116
  min: { default: Number.MIN_SAFE_INTEGER },
5900
6117
  max: { default: Number.MAX_SAFE_INTEGER },
5901
- isShowBlur: { type: Boolean, default: false }
6118
+ isShowBlur: { type: Boolean, default: false },
6119
+ precision: { default: 0 }
5902
6120
  }, {
5903
6121
  "modelValue": {
5904
6122
  default: ""
@@ -5990,25 +6208,27 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
5990
6208
  }])
5991
6209
  },
5992
6210
  [
5993
- createVNode(unref(Input), {
6211
+ createVNode(unref(Input), mergeProps({
5994
6212
  class: "input-box",
5995
6213
  disabled: _ctx.disabled,
5996
6214
  max: _ctx.max,
5997
6215
  min: _ctx.min,
5998
6216
  "model-value": modelValue.value,
5999
6217
  placeholder: _ctx.placeholder,
6000
- type: _ctx.type,
6218
+ type: _ctx.type
6219
+ }, _ctx.$attrs, {
6220
+ precision: _ctx.precision,
6001
6221
  onBlur: handleBlur,
6002
6222
  onChange: handleInput,
6003
6223
  onFocus: _cache[0] || (_cache[0] = () => isBlur.value = false),
6004
6224
  onInput: handleInput,
6005
6225
  onKeydown: handleKeydown,
6006
6226
  onPaste: handlePaste
6007
- }, {
6227
+ }), {
6008
6228
  suffix: withCtx(() => []),
6009
6229
  _: 1
6010
6230
  /* STABLE */
6011
- }, 8, ["disabled", "max", "min", "model-value", "placeholder", "type"]),
6231
+ }, 16, ["disabled", "max", "min", "model-value", "placeholder", "type", "precision"]),
6012
6232
  unref(errorMessage) ? withDirectives((openBlock(), createBlock(
6013
6233
  unref(DbIcon),
6014
6234
  {
@@ -6022,7 +6242,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
6022
6242
  )), [
6023
6243
  [_directive_bk_tooltips, unref(errorMessage)]
6024
6244
  ]) : createCommentVNode("v-if", true),
6025
- _ctx.isShowBlur && isBlur.value ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
6245
+ _ctx.isShowBlur && isBlur.value ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
6026
6246
  renderSlot(_ctx.$slots, "blur")
6027
6247
  ])) : createCommentVNode("v-if", true)
6028
6248
  ],
@@ -6032,7 +6252,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
6032
6252
  };
6033
6253
  }
6034
6254
  });
6035
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
6255
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
6036
6256
  __name: "fixed-column",
6037
6257
  props: {
6038
6258
  fixed: { default: "right" }
@@ -6060,202 +6280,22 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
6060
6280
  };
6061
6281
  }
6062
6282
  });
6063
- function tryOnScopeDispose(fn2) {
6064
- if (getCurrentScope()) {
6065
- onScopeDispose(fn2);
6066
- return true;
6067
- }
6068
- return false;
6069
- }
6070
- function toValue(r) {
6071
- return typeof r === "function" ? r() : unref(r);
6072
- }
6073
- const isClient = typeof window !== "undefined" && typeof document !== "undefined";
6074
- typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
6075
- function unrefElement(elRef) {
6076
- var _a;
6077
- const plain = toValue(elRef);
6078
- return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
6079
- }
6080
- const defaultWindow = isClient ? window : void 0;
6081
- function useMounted() {
6082
- const isMounted = ref(false);
6083
- const instance = getCurrentInstance();
6084
- if (instance) {
6085
- onMounted(() => {
6086
- isMounted.value = true;
6087
- }, instance);
6088
- }
6089
- return isMounted;
6090
- }
6091
- function useSupported(callback) {
6092
- const isMounted = useMounted();
6093
- return computed(() => {
6094
- isMounted.value;
6095
- return Boolean(callback());
6096
- });
6097
- }
6098
- function useResizeObserver(target, callback, options = {}) {
6099
- const { window: window2 = defaultWindow, ...observerOptions } = options;
6100
- let observer;
6101
- const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
6102
- const cleanup = () => {
6103
- if (observer) {
6104
- observer.disconnect();
6105
- observer = void 0;
6106
- }
6107
- };
6108
- const targets = computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
6109
- const stopWatch = watch(
6110
- targets,
6111
- (els) => {
6112
- cleanup();
6113
- if (isSupported.value && window2) {
6114
- observer = new ResizeObserver(callback);
6115
- for (const _el of els)
6116
- _el && observer.observe(_el, observerOptions);
6117
- }
6118
- },
6119
- { immediate: true, flush: "post" }
6120
- );
6121
- const stop = () => {
6122
- cleanup();
6123
- stopWatch();
6124
- };
6125
- tryOnScopeDispose(stop);
6126
- return {
6127
- isSupported,
6128
- stop
6129
- };
6130
- }
6131
- const _hoisted_1$4 = ["data-fixed", "data-maxWidth", "data-minWidth", "data-width"];
6132
- const _hoisted_2$2 = { class: "th-cell" };
6133
- const _hoisted_3$1 = {
6134
- key: 0,
6135
- style: { "display": "inline-block", "line-height": "40px", "vertical-align": "top" }
6136
- };
6137
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
6138
- __name: "head-column",
6139
- props: {
6140
- width: { default: void 0 },
6141
- required: { type: Boolean, default: true },
6142
- minWidth: { default: void 0 },
6143
- maxWidth: { default: void 0 },
6144
- fixed: { default: void 0 }
6145
- },
6146
- setup(__props) {
6147
- const props = __props;
6148
- const { rowWidth, isOverflow: isMinimize } = inject(renderTablekey);
6149
- const parentTable = inject(tableColumnResizekey);
6150
- const slots = useSlots();
6151
- const columnRef = ref();
6152
- const currentWidth = ref(0);
6153
- const columnKey = random();
6154
- let initWidthRate = 0;
6155
- let isDragedSelf = false;
6156
- const finalMinWidth = computed(() => props.minWidth ? props.minWidth : props.width ?? 100);
6157
- const isFixedRight = computed(() => props.fixed === "right");
6158
- const isFixedLeft = computed(() => props.fixed === "left");
6159
- const styles = computed(() => {
6160
- if (props.width && (rowWidth == null ? void 0 : rowWidth.value) && finalMinWidth.value) {
6161
- const newWidth = rowWidth.value * initWidthRate;
6162
- if (newWidth !== props.width) {
6163
- let width = 0;
6164
- if (isMinimize == null ? void 0 : isMinimize.value) {
6165
- if (currentWidth.value !== 0 && (currentWidth.value !== finalMinWidth.value || currentWidth.value !== props.width)) {
6166
- width = currentWidth.value;
6167
- } else {
6168
- width = finalMinWidth.value;
6169
- }
6170
- } else if (newWidth > finalMinWidth.value) {
6171
- width = newWidth;
6172
- } else {
6173
- width = finalMinWidth.value;
6174
- }
6175
- return {
6176
- minWidth: `${width}px`
6177
- };
6178
- }
6179
- }
6180
- return {
6181
- minWidth: props.width ? `${props.width}px` : "120px"
6182
- };
6183
- });
6184
- watch(() => [props.width, rowWidth == null ? void 0 : rowWidth.value, currentWidth.value], ([width, rowWidth2, currentWidth2]) => {
6185
- if (!isDragedSelf) {
6186
- return;
6187
- }
6188
- if (width && rowWidth2 && currentWidth2 && finalMinWidth.value) {
6189
- isDragedSelf = false;
6190
- if (currentWidth2 !== 0 && (currentWidth2 !== finalMinWidth.value || currentWidth2 !== width)) {
6191
- initWidthRate = currentWidth2 / rowWidth2;
6192
- } else {
6193
- initWidthRate = (isMinimize == null ? void 0 : isMinimize.value) ? finalMinWidth.value / rowWidth2 : width / rowWidth2;
6194
- }
6195
- }
6196
- }, {
6197
- immediate: true
6198
- });
6199
- useResizeObserver(columnRef, () => {
6200
- if (!isDragedSelf) {
6201
- return;
6202
- }
6203
- const width = parseFloat(columnRef.value.style.width);
6204
- currentWidth.value = width;
6205
- });
6206
- const handleMouseDown = (event) => {
6207
- isDragedSelf = true;
6208
- parentTable == null ? void 0 : parentTable.columnMousedown(event, {
6209
- columnKey,
6210
- minWidth: finalMinWidth.value
6211
- });
6212
- };
6213
- const handleMouseMove = (event) => {
6214
- parentTable == null ? void 0 : parentTable.columnMouseMove(event);
6215
- };
6216
- return (_ctx, _cache) => {
6217
- const _directive_overflow_tips = resolveDirective("overflow-tips");
6218
- return openBlock(), createElementBlock("th", {
6219
- ref_key: "columnRef",
6220
- ref: columnRef,
6221
- class: normalizeClass(["bk-ediatable-head-column", {
6222
- "is-required": _ctx.required,
6223
- [`column-${unref(columnKey)}`]: true,
6224
- "is-right-fixed": unref(isMinimize) && isFixedRight.value,
6225
- "is-left-fixed": unref(isMinimize) && isFixedLeft.value
6226
- }]),
6227
- "data-fixed": _ctx.fixed,
6228
- "data-maxWidth": _ctx.maxWidth,
6229
- "data-minWidth": finalMinWidth.value,
6230
- "data-width": _ctx.width,
6231
- style: normalizeStyle(styles.value),
6232
- onMousedown: handleMouseDown,
6233
- onMousemove: handleMouseMove
6234
- }, [
6235
- withDirectives((openBlock(), createElementBlock("div", _hoisted_2$2, [
6236
- renderSlot(_ctx.$slots, "default")
6237
- ])), [
6238
- [_directive_overflow_tips]
6239
- ]),
6240
- unref(slots).append ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
6241
- renderSlot(_ctx.$slots, "append")
6242
- ])) : createCommentVNode("v-if", true)
6243
- ], 46, _hoisted_1$4);
6244
- };
6245
- }
6246
- });
6247
6283
  const _hoisted_1$3 = { class: "bk-ediatable-operation" };
6248
6284
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
6249
- __name: "operation",
6285
+ __name: "operation-column",
6250
6286
  props: {
6287
+ removeable: { type: Boolean, default: true },
6288
+ showCopy: { type: Boolean, default: false },
6251
6289
  showAdd: { type: Boolean, default: true },
6252
- showRemove: { type: Boolean, default: true },
6253
- removeable: { type: Boolean, default: true }
6290
+ showRemove: { type: Boolean, default: true }
6254
6291
  },
6255
- emits: ["add", "remove"],
6292
+ emits: ["add", "copy", "remove"],
6256
6293
  setup(__props, { emit: __emit }) {
6257
6294
  const props = __props;
6258
6295
  const emits = __emit;
6296
+ const handleCopy = () => {
6297
+ emits("copy");
6298
+ };
6259
6299
  const handleAppend = () => {
6260
6300
  emits("add");
6261
6301
  };
@@ -6266,12 +6306,19 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
6266
6306
  emits("remove");
6267
6307
  };
6268
6308
  return (_ctx, _cache) => {
6269
- return openBlock(), createBlock(_sfc_main$5, null, {
6309
+ return openBlock(), createBlock(_sfc_main$4, null, {
6270
6310
  default: withCtx(() => [
6271
6311
  createElementVNode("div", _hoisted_1$3, [
6272
- _ctx.showAdd ? (openBlock(), createElementBlock("div", {
6312
+ _ctx.showCopy ? (openBlock(), createElementBlock("div", {
6273
6313
  key: 0,
6274
6314
  class: "action-btn",
6315
+ onClick: handleCopy
6316
+ }, [
6317
+ createVNode(unref(DbIcon), { type: "copy" })
6318
+ ])) : createCommentVNode("v-if", true),
6319
+ _ctx.showAdd ? (openBlock(), createElementBlock("div", {
6320
+ key: 1,
6321
+ class: "action-btn",
6275
6322
  onClick: handleAppend
6276
6323
  }, [
6277
6324
  createVNode(unref(DbIcon), { type: "plus-fill" })
@@ -6279,7 +6326,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
6279
6326
  _ctx.showRemove ? (openBlock(), createElementBlock(
6280
6327
  "div",
6281
6328
  {
6282
- key: 1,
6329
+ key: 2,
6283
6330
  class: normalizeClass(["action-btn", {
6284
6331
  disabled: _ctx.removeable
6285
6332
  }]),
@@ -6304,7 +6351,7 @@ const _hoisted_1$2 = {
6304
6351
  class: "select-error"
6305
6352
  };
6306
6353
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
6307
- __name: "select",
6354
+ __name: "select-column",
6308
6355
  props: /* @__PURE__ */ mergeModels({
6309
6356
  list: {},
6310
6357
  placeholder: { default: "请选择" },
@@ -6383,7 +6430,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
6383
6430
  style: normalizeStyle({ height: rootHeight.value + "px" })
6384
6431
  },
6385
6432
  [
6386
- createVNode(unref(Select), {
6433
+ createVNode(unref(Select), mergeProps(_ctx.$attrs, {
6387
6434
  "model-value": localValue.value,
6388
6435
  "auto-focus": "",
6389
6436
  class: "select-box",
@@ -6396,7 +6443,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
6396
6443
  "show-select-all": _ctx.showSelectAll,
6397
6444
  onChange: handleSelect,
6398
6445
  onClear: handleRemove
6399
- }, {
6446
+ }), {
6400
6447
  default: withCtx(() => [
6401
6448
  (openBlock(true), createElementBlock(
6402
6449
  Fragment,
@@ -6414,7 +6461,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
6414
6461
  ]),
6415
6462
  _: 1
6416
6463
  /* STABLE */
6417
- }, 8, ["model-value", "disabled", "multiple", "placeholder", "show-select-all"]),
6464
+ }, 16, ["model-value", "disabled", "multiple", "placeholder", "show-select-all"]),
6418
6465
  unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
6419
6466
  withDirectives(createVNode(
6420
6467
  unref(DbIcon),
@@ -8954,7 +9001,7 @@ const _hoisted_2$1 = {
8954
9001
  style: { "display": "none" }
8955
9002
  };
8956
9003
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
8957
- __name: "tag-input",
9004
+ __name: "tag-input-column",
8958
9005
  props: /* @__PURE__ */ mergeModels({
8959
9006
  placeholder: { default: "" },
8960
9007
  single: { type: Boolean, default: false },
@@ -9040,8 +9087,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9040
9087
  class: normalizeClass(["bk-ediatable-tag-input", { ["is-error"]: Boolean(unref(errorMessage)) }])
9041
9088
  },
9042
9089
  [
9043
- createVNode(unref(TagInput), {
9044
- "model-value": modelValue.value,
9090
+ createVNode(unref(TagInput), mergeProps({ "model-value": modelValue.value }, _ctx.$attrs, {
9045
9091
  "allow-auto-match": "",
9046
9092
  "allow-create": "",
9047
9093
  clearable: false,
@@ -9053,7 +9099,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9053
9099
  onBlur: handleBlur,
9054
9100
  onChange: handleChange,
9055
9101
  onFocus: handleFocus
9056
- }, null, 8, ["model-value", "max-data", "placeholder"]),
9102
+ }), null, 16, ["model-value", "max-data", "placeholder"]),
9057
9103
  unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
9058
9104
  withDirectives(createVNode(
9059
9105
  unref(DbIcon),
@@ -9122,7 +9168,7 @@ const _hoisted_3 = {
9122
9168
  class: "input-error"
9123
9169
  };
9124
9170
  const _sfc_main = /* @__PURE__ */ defineComponent({
9125
- __name: "text-plain",
9171
+ __name: "text-plain-column",
9126
9172
  props: {
9127
9173
  data: {},
9128
9174
  isLoading: { type: Boolean },
@@ -9197,14 +9243,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9197
9243
  }
9198
9244
  });
9199
9245
  export {
9200
- _sfc_main$7 as DateTimePickerColumn,
9201
- _sfc_main$8 as Ediatable,
9202
- _sfc_main$5 as FixedColumn,
9203
- _sfc_main$4 as HeadColumn,
9204
- _sfc_main$6 as InputColumn,
9246
+ _sfc_main$6 as DateTimePickerColumn,
9247
+ _sfc_main$7 as Ediatable,
9248
+ _sfc_main$4 as FixedColumn,
9249
+ _sfc_main$8 as HeadColumn,
9250
+ _sfc_main$5 as InputColumn,
9205
9251
  _sfc_main$3 as OperationColumn,
9206
9252
  _sfc_main$2 as SelectColumn,
9207
9253
  _sfc_main$1 as TagInputColumn,
9208
9254
  _sfc_main as TextPlainColumn,
9209
- _sfc_main$8 as default
9255
+ _sfc_main$7 as default
9210
9256
  };