@blueking/ediatable 0.0.1-beta.7 → 0.0.1-beta.9

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,6 +1,5 @@
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";
2
- import "bkui-vue/dist/style.css";
3
- import { DatePicker, Input, Select, TagInput, Loading } from "bkui-vue";
1
+ import { ref, provide, onMounted, onBeforeUnmount, getCurrentScope, onScopeDispose, unref, computed, watch, getCurrentInstance, defineComponent, useSlots, inject, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, withDirectives, renderSlot, createCommentVNode, createBlock, Fragment, renderList, withCtx, createTextVNode, toDisplayString, reactive, toRefs, h, mergeModels, useModel, useAttrs, createVNode, mergeProps, createSlots, nextTick } from "vue";
2
+ import { bkTooltips, DatePicker, Input, Select, TagInput, Loading } from "bkui-vue";
4
3
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
5
4
  function getDefaultExportFromCjs(x) {
6
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -5528,10 +5527,8 @@ function useColumnResize(tableRef, tableColumnResizeRef, mouseupCallback) {
5528
5527
  if (!dragable) {
5529
5528
  return;
5530
5529
  }
5531
- const {
5532
- columnKey,
5533
- minWidth = 100
5534
- } = payload;
5530
+ const { columnKey, minWidth = 100 } = payload;
5531
+ const target = event.target.closest("th");
5535
5532
  const tableEl = tableRef.value;
5536
5533
  const columnEl = tableEl.querySelector(`th.column-${columnKey}`);
5537
5534
  const tableLeft = tableEl.getBoundingClientRect().left;
@@ -5561,6 +5558,7 @@ function useColumnResize(tableRef, tableColumnResizeRef, mouseupCallback) {
5561
5558
  resizeProxy.style.display = "block";
5562
5559
  resizeProxyLeft = Math.max(minLeft, proxyLeft);
5563
5560
  resizeProxy.style.left = `${resizeProxyLeft}px`;
5561
+ target.classList.add("poiner-right");
5564
5562
  };
5565
5563
  const handleMouseUp = () => {
5566
5564
  if (dragging.value) {
@@ -5585,15 +5583,22 @@ function useColumnResize(tableRef, tableColumnResizeRef, mouseupCallback) {
5585
5583
  document.addEventListener("mouseup", handleMouseUp);
5586
5584
  };
5587
5585
  const handleMouseMove = (event) => {
5586
+ var _a;
5587
+ if (dragging.value) {
5588
+ return;
5589
+ }
5588
5590
  const target = event.target.closest("th");
5589
5591
  const rect = target.getBoundingClientRect();
5590
5592
  const bodyStyle = document.body.style;
5591
5593
  if (rect.width > 12 && rect.right - event.pageX < 8) {
5592
5594
  bodyStyle.cursor = "col-resize";
5593
5595
  dragable = true;
5596
+ target.classList.add("poiner-right");
5594
5597
  } else if (!dragging.value) {
5595
5598
  bodyStyle.cursor = "";
5596
5599
  dragable = false;
5600
+ target.classList.remove("poiner-right");
5601
+ (_a = target.previousElementSibling) == null ? void 0 : _a.classList.remove("poiner-right");
5597
5602
  }
5598
5603
  };
5599
5604
  const handleOuterMousemove = _.throttle((event) => {
@@ -5623,940 +5628,100 @@ function useColumnResize(tableRef, tableColumnResizeRef, mouseupCallback) {
5623
5628
  handleMouseMove
5624
5629
  };
5625
5630
  }
5626
- const _hoisted_1$7 = { style: { "position": "relative" } };
5627
- const renderTablekey = Symbol("renderTable");
5628
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
5629
- __name: "ediatable",
5630
- setup(__props) {
5631
- const checkTableScroll = () => {
5632
- rowWidth.value = tableRef.value.clientWidth;
5633
- isOverflow.value = tableOuterRef.value.clientWidth < tableRef.value.clientWidth;
5634
- initColumnWidth();
5635
- };
5636
- const tableOuterRef = ref();
5637
- const tableRef = ref();
5638
- const tableColumnResizeRef = ref();
5639
- const isOverflow = ref(false);
5640
- const rowWidth = ref(0);
5641
- const { initColumnWidth } = useColumnResize(tableOuterRef, tableColumnResizeRef, _.debounce(checkTableScroll));
5642
- provide(renderTablekey, {
5643
- isOverflow,
5644
- rowWidth
5645
- });
5646
- onMounted(() => {
5647
- window.addEventListener("resize", checkTableScroll);
5648
- checkTableScroll();
5649
- setTimeout(() => checkTableScroll());
5650
- });
5651
- onBeforeUnmount(() => window.removeEventListener("resize", checkTableScroll));
5652
- return (_ctx, _cache) => {
5653
- return openBlock(), createElementBlock(
5654
- "div",
5655
- {
5656
- id: "ediatableRenderTableKey",
5657
- ref_key: "tableOuterRef",
5658
- ref: tableOuterRef,
5659
- class: "bk-ediatable"
5660
- },
5661
- [
5662
- createElementVNode(
5663
- "table",
5664
- {
5665
- ref_key: "tableRef",
5666
- ref: tableRef
5667
- },
5668
- [
5669
- createElementVNode("thead", null, [
5670
- createElementVNode("tr", _hoisted_1$7, [
5671
- renderSlot(_ctx.$slots, "default")
5672
- ])
5673
- ]),
5674
- createElementVNode("tbody", null, [
5675
- renderSlot(_ctx.$slots, "data")
5676
- ])
5677
- ],
5678
- 512
5679
- /* NEED_PATCH */
5680
- ),
5681
- createElementVNode(
5682
- "div",
5683
- {
5684
- ref_key: "tableColumnResizeRef",
5685
- ref: tableColumnResizeRef,
5686
- class: "table-column-resize"
5687
- },
5688
- null,
5689
- 512
5690
- /* NEED_PATCH */
5691
- )
5692
- ],
5693
- 512
5694
- /* NEED_PATCH */
5695
- );
5696
- };
5631
+ var top = "top";
5632
+ var bottom = "bottom";
5633
+ var right = "right";
5634
+ var left = "left";
5635
+ var auto = "auto";
5636
+ var basePlacements = [top, bottom, right, left];
5637
+ var start = "start";
5638
+ var end = "end";
5639
+ var clippingParents = "clippingParents";
5640
+ var viewport = "viewport";
5641
+ var popper = "popper";
5642
+ var reference = "reference";
5643
+ var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
5644
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
5645
+ }, []);
5646
+ var placements$1 = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
5647
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
5648
+ }, []);
5649
+ var beforeRead = "beforeRead";
5650
+ var read = "read";
5651
+ var afterRead = "afterRead";
5652
+ var beforeMain = "beforeMain";
5653
+ var main = "main";
5654
+ var afterMain = "afterMain";
5655
+ var beforeWrite = "beforeWrite";
5656
+ var write = "write";
5657
+ var afterWrite = "afterWrite";
5658
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
5659
+ function getNodeName(element) {
5660
+ return element ? (element.nodeName || "").toLowerCase() : null;
5661
+ }
5662
+ function getWindow(node) {
5663
+ if (node == null) {
5664
+ return window;
5697
5665
  }
5698
- });
5699
- const getRuleMessage = (rule) => {
5700
- if (typeof rule.message === "function") {
5701
- return rule.message();
5666
+ if (node.toString() !== "[object Window]") {
5667
+ var ownerDocument = node.ownerDocument;
5668
+ return ownerDocument ? ownerDocument.defaultView || window : window;
5702
5669
  }
5703
- return rule.message;
5704
- };
5705
- function useValidtor(rules) {
5706
- const state = reactive({
5707
- loading: false,
5708
- error: false,
5709
- message: ""
5710
- });
5711
- const validator = (targetValue) => {
5712
- state.error = false, state.message = "";
5713
- if (!rules) {
5714
- return Promise.resolve(true);
5715
- }
5716
- const run = /* @__PURE__ */ (() => {
5717
- let stepIndex = -1;
5718
- return async () => {
5719
- stepIndex = stepIndex + 1;
5720
- if (stepIndex >= rules.length) {
5721
- return Promise.resolve(true);
5722
- }
5723
- const rule = rules[stepIndex];
5724
- return Promise.resolve().then(() => {
5725
- const result = rule.validator(targetValue);
5726
- if (typeof result !== "boolean" && typeof result.then === "function") {
5727
- return result.then((data) => {
5728
- if (data === false) {
5729
- return Promise.reject(getRuleMessage(rule));
5730
- }
5731
- }).then(() => run(), () => {
5732
- state.error = true;
5733
- const message = getRuleMessage(rule);
5734
- state.message = message;
5735
- return Promise.reject(message);
5736
- });
5737
- }
5738
- if (!result) {
5739
- state.error = true;
5740
- const message = getRuleMessage(rule);
5741
- state.message = message;
5742
- return Promise.reject(message);
5743
- }
5744
- return run();
5745
- });
5746
- };
5747
- })();
5748
- return run();
5749
- };
5750
- return {
5751
- ...toRefs(state),
5752
- validator
5753
- };
5670
+ return node;
5754
5671
  }
5755
- const DbIcon = defineComponent({
5756
- name: "DbIcon",
5757
- props: {
5758
- type: {
5759
- type: String,
5760
- required: true
5761
- },
5762
- svg: {
5763
- type: Boolean,
5764
- default: false
5765
- }
5766
- },
5767
- render() {
5768
- if (this.svg) {
5769
- return h(
5770
- "svg",
5771
- {
5772
- class: {
5773
- "db-svg-icon": true
5774
- }
5775
- },
5776
- [
5777
- h("use", {
5778
- "xlink:href": `#db-icon-${this.type}`
5779
- })
5780
- ]
5781
- );
5672
+ function isElement$1(node) {
5673
+ var OwnElement = getWindow(node).Element;
5674
+ return node instanceof OwnElement || node instanceof Element;
5675
+ }
5676
+ function isHTMLElement(node) {
5677
+ var OwnElement = getWindow(node).HTMLElement;
5678
+ return node instanceof OwnElement || node instanceof HTMLElement;
5679
+ }
5680
+ function isShadowRoot(node) {
5681
+ if (typeof ShadowRoot === "undefined") {
5682
+ return false;
5683
+ }
5684
+ var OwnElement = getWindow(node).ShadowRoot;
5685
+ return node instanceof OwnElement || node instanceof ShadowRoot;
5686
+ }
5687
+ function applyStyles(_ref) {
5688
+ var state = _ref.state;
5689
+ Object.keys(state.elements).forEach(function(name) {
5690
+ var style = state.styles[name] || {};
5691
+ var attributes = state.attributes[name] || {};
5692
+ var element = state.elements[name];
5693
+ if (!isHTMLElement(element) || !getNodeName(element)) {
5694
+ return;
5782
5695
  }
5783
- const classes = {
5784
- "ediatable-icon": true,
5785
- [`icon-${this.type}`]: true
5786
- };
5787
- return h("i", {
5788
- class: classes
5696
+ Object.assign(element.style, style);
5697
+ Object.keys(attributes).forEach(function(name2) {
5698
+ var value = attributes[name2];
5699
+ if (value === false) {
5700
+ element.removeAttribute(name2);
5701
+ } else {
5702
+ element.setAttribute(name2, value === true ? "" : value);
5703
+ }
5789
5704
  });
5790
- }
5791
- });
5792
- const _hoisted_1$6 = {
5793
- key: 0,
5794
- class: "input-error"
5795
- };
5796
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
5797
- __name: "date-time-picker",
5798
- props: /* @__PURE__ */ mergeModels({
5799
- placeholder: { default: "" },
5800
- rules: { default: void 0 },
5801
- type: { default: void 0 },
5802
- disabled: { type: Boolean, default: false }
5803
- }, {
5804
- "modelValue": {},
5805
- "modelModifiers": {}
5806
- }),
5807
- emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
5808
- setup(__props, { expose: __expose, emit: __emit }) {
5809
- const props = __props;
5810
- const emits = __emit;
5811
- const modelValue = useModel(__props, "modelValue");
5812
- const attrs = useAttrs();
5813
- const slots = useSlots();
5814
- const { message: errorMessage, validator } = useValidtor(props.rules);
5815
- const handleChange = (value) => {
5816
- modelValue.value = value;
5817
- validator(modelValue.value).then(() => {
5818
- emits("change", modelValue.value);
5819
- });
5820
- };
5821
- const handleOpenChange = (open) => {
5822
- if (!open) {
5823
- validator(modelValue.value);
5824
- }
5825
- };
5826
- __expose({
5827
- getValue() {
5828
- return validator(modelValue.value).then(() => modelValue.value);
5829
- }
5830
- });
5831
- return (_ctx, _cache) => {
5832
- const _directive_bk_tooltips = resolveDirective("bk-tooltips");
5833
- return openBlock(), createElementBlock(
5834
- "div",
5835
- {
5836
- class: normalizeClass(["bk-ediatable-time-picker", {
5837
- "is-error": Boolean(unref(errorMessage)),
5838
- "is-disabled": _ctx.disabled
5839
- }])
5840
- },
5841
- [
5842
- createVNode(unref(DatePicker), mergeProps({
5843
- "append-to-body": "",
5844
- clearable: false,
5845
- "model-value": modelValue.value,
5846
- placeholder: _ctx.placeholder,
5847
- style: { "width": "100%" },
5848
- type: _ctx.type
5849
- }, unref(attrs), {
5850
- onChange: handleChange,
5851
- onOpenChange: handleOpenChange
5852
- }), createSlots({
5853
- _: 2
5854
- /* DYNAMIC */
5855
- }, [
5856
- unref(slots).footer ? {
5857
- name: "footer",
5858
- fn: withCtx(() => [
5859
- renderSlot(_ctx.$slots, "footer")
5860
- ]),
5861
- key: "0"
5862
- } : void 0
5863
- ]), 1040, ["model-value", "placeholder", "type"]),
5864
- unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$6, [
5865
- withDirectives(createVNode(
5866
- unref(DbIcon),
5867
- { type: "exclamation-fill" },
5868
- null,
5869
- 512
5870
- /* NEED_PATCH */
5871
- ), [
5872
- [_directive_bk_tooltips, unref(errorMessage)]
5873
- ])
5874
- ])) : createCommentVNode("v-if", true)
5875
- ],
5876
- 2
5877
- /* CLASS */
5878
- );
5879
- };
5880
- }
5881
- });
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 = {
5889
- key: 1,
5890
- class: "blur-dispaly-main"
5891
- };
5892
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
5893
- __name: "input",
5894
- props: /* @__PURE__ */ mergeModels({
5895
- placeholder: { default: "请输入" },
5896
- rules: { default: void 0 },
5897
- disabled: { type: Boolean, default: false },
5898
- type: { default: "text" },
5899
- min: { default: Number.MIN_SAFE_INTEGER },
5900
- max: { default: Number.MAX_SAFE_INTEGER },
5901
- isShowBlur: { type: Boolean, default: false },
5902
- precision: { default: 0 }
5903
- }, {
5904
- "modelValue": {
5905
- default: ""
5906
- },
5907
- "modelModifiers": {}
5908
- }),
5909
- emits: /* @__PURE__ */ mergeModels(["submit"], ["update:modelValue"]),
5910
- setup(__props, { expose: __expose, emit: __emit }) {
5911
- const props = __props;
5912
- const emits = __emit;
5913
- const modelValue = useModel(__props, "modelValue");
5914
- const rootRef = ref();
5915
- const isBlur = ref(true);
5916
- const isPassword = computed(() => props.type === "password");
5917
- let oldInputText = "";
5918
- const {
5919
- message: errorMessage,
5920
- validator
5921
- } = useValidtor(props.rules);
5922
- const handleInput = (value) => {
5923
- isBlur.value = false;
5924
- modelValue.value = value;
5925
- };
5926
- const handleBlur = (event) => {
5927
- isBlur.value = true;
5928
- if (props.disabled) {
5929
- event.preventDefault();
5930
- return;
5931
- }
5932
- if (modelValue.value) {
5933
- if (oldInputText === modelValue.value) {
5934
- return;
5935
- }
5936
- oldInputText = modelValue.value;
5937
- validator(modelValue.value).then(() => {
5938
- emits("submit", modelValue.value);
5939
- });
5940
- return;
5941
- }
5942
- emits("submit", modelValue.value);
5943
- };
5944
- const handleKeydown = (_value, event) => {
5945
- if (props.disabled) {
5946
- event.preventDefault();
5947
- return;
5948
- }
5949
- if (event.isComposing) {
5950
- return;
5951
- }
5952
- if (event.which === 13 || event.key === "Enter") {
5953
- if (oldInputText === modelValue.value) {
5954
- return;
5955
- }
5956
- oldInputText = modelValue.value;
5957
- event.preventDefault();
5958
- validator(modelValue.value).then((result) => {
5959
- if (result) {
5960
- emits("submit", modelValue.value);
5961
- }
5962
- });
5963
- }
5964
- };
5965
- const handlePaste = (_value, event) => {
5966
- event.preventDefault();
5967
- let paste = (event.clipboardData || window.clipboardData).getData("text");
5968
- paste = encodeMult(paste);
5969
- modelValue.value += paste.replace(/^\s+|\s+$/g, "");
5970
- };
5971
- __expose({
5972
- getValue() {
5973
- return validator(modelValue.value).then(() => modelValue.value);
5974
- },
5975
- focus() {
5976
- var _a;
5977
- (_a = rootRef.value.querySelector("input")) == null ? void 0 : _a.focus();
5978
- }
5979
- });
5980
- return (_ctx, _cache) => {
5981
- const _directive_bk_tooltips = resolveDirective("bk-tooltips");
5982
- return openBlock(), createElementBlock(
5983
- "div",
5984
- {
5985
- ref_key: "rootRef",
5986
- ref: rootRef,
5987
- class: normalizeClass(["bk-ediatable-input", {
5988
- "is-error": Boolean(unref(errorMessage)),
5989
- "is-disabled": _ctx.disabled,
5990
- "is-password": isPassword.value
5991
- }])
5992
- },
5993
- [
5994
- createVNode(unref(Input), mergeProps({
5995
- class: "input-box",
5996
- disabled: _ctx.disabled,
5997
- max: _ctx.max,
5998
- min: _ctx.min,
5999
- "model-value": modelValue.value,
6000
- placeholder: _ctx.placeholder,
6001
- type: _ctx.type
6002
- }, _ctx.$attrs, {
6003
- precision: _ctx.precision,
6004
- onBlur: handleBlur,
6005
- onChange: handleInput,
6006
- onFocus: _cache[0] || (_cache[0] = () => isBlur.value = false),
6007
- onInput: handleInput,
6008
- onKeydown: handleKeydown,
6009
- onPaste: handlePaste
6010
- }), {
6011
- suffix: withCtx(() => []),
6012
- _: 1
6013
- /* STABLE */
6014
- }, 16, ["disabled", "max", "min", "model-value", "placeholder", "type", "precision"]),
6015
- unref(errorMessage) ? withDirectives((openBlock(), createBlock(
6016
- unref(DbIcon),
6017
- {
6018
- key: 0,
6019
- class: "error-icon",
6020
- type: "exclamation-fill"
6021
- },
6022
- null,
6023
- 512
6024
- /* NEED_PATCH */
6025
- )), [
6026
- [_directive_bk_tooltips, unref(errorMessage)]
6027
- ]) : createCommentVNode("v-if", true),
6028
- _ctx.isShowBlur && isBlur.value ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
6029
- renderSlot(_ctx.$slots, "blur")
6030
- ])) : createCommentVNode("v-if", true)
6031
- ],
6032
- 2
6033
- /* CLASS */
6034
- );
6035
- };
6036
- }
6037
- });
6038
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
6039
- __name: "fixed-column",
6040
- props: {
6041
- fixed: { default: "right" }
6042
- },
6043
- setup(__props) {
6044
- const props = __props;
6045
- const { isOverflow: isFixed } = inject(renderTablekey);
6046
- const isFixedRight = computed(() => (isFixed == null ? void 0 : isFixed.value) && props.fixed === "right");
6047
- const isFixedLeft = computed(() => (isFixed == null ? void 0 : isFixed.value) && props.fixed === "left");
6048
- return (_ctx, _cache) => {
6049
- return openBlock(), createElementBlock(
6050
- "td",
6051
- {
6052
- class: normalizeClass({
6053
- "bk-ediatable-right-fixed-column": isFixedRight.value,
6054
- "bk-ediatable-left-fixed-column": isFixedLeft.value
6055
- })
6056
- },
6057
- [
6058
- renderSlot(_ctx.$slots, "default")
6059
- ],
6060
- 2
6061
- /* CLASS */
6062
- );
6063
- };
6064
- }
6065
- });
6066
- function tryOnScopeDispose(fn2) {
6067
- if (getCurrentScope()) {
6068
- onScopeDispose(fn2);
6069
- return true;
6070
- }
6071
- return false;
6072
- }
6073
- function toValue(r) {
6074
- return typeof r === "function" ? r() : unref(r);
6075
- }
6076
- const isClient = typeof window !== "undefined" && typeof document !== "undefined";
6077
- typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
6078
- function unrefElement(elRef) {
6079
- var _a;
6080
- const plain = toValue(elRef);
6081
- return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
6082
- }
6083
- const defaultWindow = isClient ? window : void 0;
6084
- function useMounted() {
6085
- const isMounted = ref(false);
6086
- const instance = getCurrentInstance();
6087
- if (instance) {
6088
- onMounted(() => {
6089
- isMounted.value = true;
6090
- }, instance);
6091
- }
6092
- return isMounted;
6093
- }
6094
- function useSupported(callback) {
6095
- const isMounted = useMounted();
6096
- return computed(() => {
6097
- isMounted.value;
6098
- return Boolean(callback());
6099
- });
6100
- }
6101
- function useResizeObserver(target, callback, options = {}) {
6102
- const { window: window2 = defaultWindow, ...observerOptions } = options;
6103
- let observer;
6104
- const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
6105
- const cleanup = () => {
6106
- if (observer) {
6107
- observer.disconnect();
6108
- observer = void 0;
6109
- }
6110
- };
6111
- const targets = computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
6112
- const stopWatch = watch(
6113
- targets,
6114
- (els) => {
6115
- cleanup();
6116
- if (isSupported.value && window2) {
6117
- observer = new ResizeObserver(callback);
6118
- for (const _el of els)
6119
- _el && observer.observe(_el, observerOptions);
6120
- }
6121
- },
6122
- { immediate: true, flush: "post" }
6123
- );
6124
- const stop = () => {
6125
- cleanup();
6126
- stopWatch();
6127
- };
6128
- tryOnScopeDispose(stop);
6129
- return {
6130
- isSupported,
6131
- stop
6132
- };
6133
- }
6134
- const _hoisted_1$4 = ["data-fixed", "data-maxWidth", "data-minWidth", "data-width"];
6135
- const _hoisted_2$2 = { class: "th-cell" };
6136
- const _hoisted_3$1 = {
6137
- key: 0,
6138
- style: { "display": "inline-block", "line-height": "40px", "vertical-align": "top" }
6139
- };
6140
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
6141
- __name: "head-column",
6142
- props: {
6143
- width: { default: void 0 },
6144
- required: { type: Boolean, default: true },
6145
- minWidth: { default: void 0 },
6146
- maxWidth: { default: void 0 },
6147
- fixed: { default: void 0 },
6148
- memo: { default: void 0 }
6149
- },
6150
- setup(__props) {
6151
- const props = __props;
6152
- const { rowWidth, isOverflow: isMinimize } = inject(renderTablekey);
6153
- const parentTable = inject(tableColumnResizekey);
6154
- const slots = useSlots();
6155
- const columnRef = ref();
6156
- const currentWidth = ref(0);
6157
- const columnKey = random();
6158
- let initWidthRate = 0;
6159
- let isDragedSelf = false;
6160
- const finalMinWidth = computed(() => props.minWidth ? props.minWidth : props.width ?? 100);
6161
- const isFixedRight = computed(() => props.fixed === "right");
6162
- const isFixedLeft = computed(() => props.fixed === "left");
6163
- const styles = computed(() => {
6164
- if (props.width && (rowWidth == null ? void 0 : rowWidth.value) && finalMinWidth.value) {
6165
- const newWidth = rowWidth.value * initWidthRate;
6166
- if (newWidth !== props.width) {
6167
- let width = 0;
6168
- if (isMinimize == null ? void 0 : isMinimize.value) {
6169
- if (currentWidth.value !== 0 && (currentWidth.value !== finalMinWidth.value || currentWidth.value !== props.width)) {
6170
- width = currentWidth.value;
6171
- } else {
6172
- width = finalMinWidth.value;
6173
- }
6174
- } else if (newWidth > finalMinWidth.value) {
6175
- width = newWidth;
6176
- } else {
6177
- width = finalMinWidth.value;
6178
- }
6179
- return {
6180
- minWidth: `${width}px`
6181
- };
6182
- }
6183
- }
6184
- return {
6185
- minWidth: props.width ? `${props.width}px` : "120px"
6186
- };
6187
- });
6188
- watch(() => [props.width, rowWidth == null ? void 0 : rowWidth.value, currentWidth.value], ([width, rowWidth2, currentWidth2]) => {
6189
- if (!isDragedSelf) {
6190
- return;
6191
- }
6192
- if (width && rowWidth2 && currentWidth2 && finalMinWidth.value) {
6193
- isDragedSelf = false;
6194
- if (currentWidth2 !== 0 && (currentWidth2 !== finalMinWidth.value || currentWidth2 !== width)) {
6195
- initWidthRate = currentWidth2 / rowWidth2;
6196
- } else {
6197
- initWidthRate = (isMinimize == null ? void 0 : isMinimize.value) ? finalMinWidth.value / rowWidth2 : width / rowWidth2;
6198
- }
6199
- }
6200
- }, {
6201
- immediate: true
6202
- });
6203
- useResizeObserver(columnRef, () => {
6204
- if (!isDragedSelf) {
6205
- return;
6206
- }
6207
- const width = parseFloat(columnRef.value.style.width);
6208
- currentWidth.value = width;
6209
- });
6210
- const handleMouseDown = (event) => {
6211
- isDragedSelf = true;
6212
- parentTable == null ? void 0 : parentTable.columnMousedown(event, {
6213
- columnKey,
6214
- minWidth: finalMinWidth.value
6215
- });
6216
- };
6217
- const handleMouseMove = (event) => {
6218
- parentTable == null ? void 0 : parentTable.columnMouseMove(event);
6219
- };
6220
- return (_ctx, _cache) => {
6221
- const _directive_overflow_tips = resolveDirective("overflow-tips");
6222
- const _directive_bk_tooltips = resolveDirective("bk-tooltips");
6223
- return openBlock(), createElementBlock("th", {
6224
- ref_key: "columnRef",
6225
- ref: columnRef,
6226
- class: normalizeClass(["bk-ediatable-head-column", {
6227
- "is-required": _ctx.required,
6228
- [`column-${unref(columnKey)}`]: true,
6229
- "is-right-fixed": unref(isMinimize) && isFixedRight.value,
6230
- "is-left-fixed": unref(isMinimize) && isFixedLeft.value
6231
- }]),
6232
- "data-fixed": _ctx.fixed,
6233
- "data-maxWidth": _ctx.maxWidth,
6234
- "data-minWidth": finalMinWidth.value,
6235
- "data-width": _ctx.width,
6236
- style: normalizeStyle(styles.value),
6237
- onMousedown: handleMouseDown,
6238
- onMousemove: handleMouseMove
6239
- }, [
6240
- withDirectives((openBlock(), createElementBlock("div", _hoisted_2$2, [
6241
- createElementVNode(
6242
- "span",
6243
- {
6244
- class: normalizeClass({ "title-memo": _ctx.memo })
6245
- },
6246
- [
6247
- renderSlot(_ctx.$slots, "default")
6248
- ],
6249
- 2
6250
- /* CLASS */
6251
- )
6252
- ])), [
6253
- [_directive_overflow_tips],
6254
- [_directive_bk_tooltips, {
6255
- content: _ctx.memo,
6256
- disabled: !_ctx.memo
6257
- }]
6258
- ]),
6259
- unref(slots).append ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
6260
- renderSlot(_ctx.$slots, "append")
6261
- ])) : createCommentVNode("v-if", true)
6262
- ], 46, _hoisted_1$4);
6263
- };
6264
- }
6265
- });
6266
- const _hoisted_1$3 = { class: "bk-ediatable-operation" };
6267
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
6268
- __name: "operation",
6269
- props: {
6270
- showCopy: { type: Boolean, default: false },
6271
- showAdd: { type: Boolean, default: true },
6272
- showRemove: { type: Boolean, default: true },
6273
- removeable: { type: Boolean, default: true }
6274
- },
6275
- emits: ["copy", "add", "remove"],
6276
- setup(__props, { emit: __emit }) {
6277
- const props = __props;
6278
- const emits = __emit;
6279
- const handleCopy = () => {
6280
- emits("copy");
6281
- };
6282
- const handleAppend = () => {
6283
- emits("add");
6284
- };
6285
- const handleRemove = () => {
6286
- if (props.removeable) {
6287
- return;
6288
- }
6289
- emits("remove");
6290
- };
6291
- return (_ctx, _cache) => {
6292
- return openBlock(), createBlock(_sfc_main$5, null, {
6293
- default: withCtx(() => [
6294
- createElementVNode("div", _hoisted_1$3, [
6295
- _ctx.showCopy ? (openBlock(), createElementBlock("div", {
6296
- key: 0,
6297
- class: "action-btn",
6298
- onClick: handleCopy
6299
- }, [
6300
- createVNode(unref(DbIcon), { type: "copy" })
6301
- ])) : createCommentVNode("v-if", true),
6302
- _ctx.showAdd ? (openBlock(), createElementBlock("div", {
6303
- key: 1,
6304
- class: "action-btn",
6305
- onClick: handleAppend
6306
- }, [
6307
- createVNode(unref(DbIcon), { type: "plus-fill" })
6308
- ])) : createCommentVNode("v-if", true),
6309
- _ctx.showRemove ? (openBlock(), createElementBlock(
6310
- "div",
6311
- {
6312
- key: 2,
6313
- class: normalizeClass(["action-btn", {
6314
- disabled: _ctx.removeable
6315
- }]),
6316
- onClick: handleRemove
6317
- },
6318
- [
6319
- createVNode(unref(DbIcon), { type: "minus-fill" })
6320
- ],
6321
- 2
6322
- /* CLASS */
6323
- )) : createCommentVNode("v-if", true)
6324
- ])
6325
- ]),
6326
- _: 1
6327
- /* STABLE */
6328
- });
6329
- };
6330
- }
6331
- });
6332
- const _hoisted_1$2 = {
6333
- key: 0,
6334
- class: "select-error"
6335
- };
6336
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
6337
- __name: "select",
6338
- props: /* @__PURE__ */ mergeModels({
6339
- list: {},
6340
- placeholder: { default: "请选择" },
6341
- rules: { default: () => [] },
6342
- disabled: { type: Boolean, default: false },
6343
- multiple: { type: Boolean, default: false },
6344
- showSelectAll: { type: Boolean, default: false }
6345
- }, {
6346
- "modelValue": {},
6347
- "modelModifiers": {}
6348
- }),
6349
- emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
6350
- setup(__props, { expose: __expose, emit: __emit }) {
6351
- const { Option } = Select;
6352
- const props = __props;
6353
- const emits = __emit;
6354
- const modelValue = useModel(__props, "modelValue");
6355
- const rootRef = ref();
6356
- const localValue = ref("");
6357
- const rootHeight = ref(42);
6358
- const { message: errorMessage, validator } = useValidtor(props.rules);
6359
- watch(
6360
- modelValue,
6361
- (value) => {
6362
- if (value === void 0) {
6363
- return;
6364
- }
6365
- localValue.value = value;
6366
- if (typeof value !== "object" && value) {
6367
- validator(value);
6368
- return;
6369
- }
6370
- if (Array.isArray(value) && value.length > 0) {
6371
- validator(value);
6372
- return;
6373
- }
6374
- },
6375
- {
6376
- immediate: true
6377
- }
6378
- );
6379
- const handleSelect = (value) => {
6380
- localValue.value = value;
6381
- validator(localValue.value).then(() => {
6382
- modelValue.value = value;
6383
- emits("change", localValue.value);
6384
- });
6385
- };
6386
- const handleRemove = () => {
6387
- localValue.value = "";
6388
- validator(localValue.value).then(() => {
6389
- modelValue.value = localValue.value;
6390
- emits("change", localValue.value);
6391
- });
6392
- };
6393
- const checkRootHeight = () => {
6394
- rootHeight.value = rootRef.value.parentNode.clientHeight;
6395
- };
6396
- useResizeObserver(rootRef, _.throttle(checkRootHeight, 500));
6397
- __expose({
6398
- getValue() {
6399
- return validator(localValue.value).then(() => localValue.value);
6400
- }
6401
- });
6402
- return (_ctx, _cache) => {
6403
- const _directive_bk_tooltips = resolveDirective("bk-tooltips");
6404
- return openBlock(), createElementBlock(
6405
- "div",
6406
- {
6407
- ref_key: "rootRef",
6408
- ref: rootRef,
6409
- class: normalizeClass(["bk-ediatable-select", {
6410
- "is-error": Boolean(unref(errorMessage)),
6411
- "is-disable": _ctx.disabled
6412
- }]),
6413
- style: normalizeStyle({ height: rootHeight.value + "px" })
6414
- },
6415
- [
6416
- createVNode(unref(Select), mergeProps(_ctx.$attrs, {
6417
- "model-value": localValue.value,
6418
- "auto-focus": "",
6419
- class: "select-box",
6420
- clearable: false,
6421
- disabled: _ctx.disabled,
6422
- filterable: "",
6423
- "input-search": false,
6424
- multiple: _ctx.multiple,
6425
- placeholder: _ctx.placeholder,
6426
- "show-select-all": _ctx.showSelectAll,
6427
- onChange: handleSelect,
6428
- onClear: handleRemove
6429
- }), {
6430
- default: withCtx(() => [
6431
- (openBlock(true), createElementBlock(
6432
- Fragment,
6433
- null,
6434
- renderList(_ctx.list, (item, index) => {
6435
- return openBlock(), createBlock(unref(Option), {
6436
- key: index,
6437
- label: item.label,
6438
- value: item.value
6439
- }, null, 8, ["label", "value"]);
6440
- }),
6441
- 128
6442
- /* KEYED_FRAGMENT */
6443
- ))
6444
- ]),
6445
- _: 1
6446
- /* STABLE */
6447
- }, 16, ["model-value", "disabled", "multiple", "placeholder", "show-select-all"]),
6448
- unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
6449
- withDirectives(createVNode(
6450
- unref(DbIcon),
6451
- { type: "exclamation-fill" },
6452
- null,
6453
- 512
6454
- /* NEED_PATCH */
6455
- ), [
6456
- [_directive_bk_tooltips, unref(errorMessage)]
6457
- ])
6458
- ])) : createCommentVNode("v-if", true)
6459
- ],
6460
- 6
6461
- /* CLASS, STYLE */
6462
- );
6463
- };
6464
- }
6465
- });
6466
- var top = "top";
6467
- var bottom = "bottom";
6468
- var right = "right";
6469
- var left = "left";
6470
- var auto = "auto";
6471
- var basePlacements = [top, bottom, right, left];
6472
- var start = "start";
6473
- var end = "end";
6474
- var clippingParents = "clippingParents";
6475
- var viewport = "viewport";
6476
- var popper = "popper";
6477
- var reference = "reference";
6478
- var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
6479
- return acc.concat([placement + "-" + start, placement + "-" + end]);
6480
- }, []);
6481
- var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
6482
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
6483
- }, []);
6484
- var beforeRead = "beforeRead";
6485
- var read = "read";
6486
- var afterRead = "afterRead";
6487
- var beforeMain = "beforeMain";
6488
- var main = "main";
6489
- var afterMain = "afterMain";
6490
- var beforeWrite = "beforeWrite";
6491
- var write = "write";
6492
- var afterWrite = "afterWrite";
6493
- var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
6494
- function getNodeName(element) {
6495
- return element ? (element.nodeName || "").toLowerCase() : null;
6496
- }
6497
- function getWindow(node) {
6498
- if (node == null) {
6499
- return window;
6500
- }
6501
- if (node.toString() !== "[object Window]") {
6502
- var ownerDocument = node.ownerDocument;
6503
- return ownerDocument ? ownerDocument.defaultView || window : window;
6504
- }
6505
- return node;
6506
- }
6507
- function isElement$1(node) {
6508
- var OwnElement = getWindow(node).Element;
6509
- return node instanceof OwnElement || node instanceof Element;
6510
- }
6511
- function isHTMLElement(node) {
6512
- var OwnElement = getWindow(node).HTMLElement;
6513
- return node instanceof OwnElement || node instanceof HTMLElement;
6514
- }
6515
- function isShadowRoot(node) {
6516
- if (typeof ShadowRoot === "undefined") {
6517
- return false;
6518
- }
6519
- var OwnElement = getWindow(node).ShadowRoot;
6520
- return node instanceof OwnElement || node instanceof ShadowRoot;
6521
- }
6522
- function applyStyles(_ref) {
6523
- var state = _ref.state;
6524
- Object.keys(state.elements).forEach(function(name) {
6525
- var style = state.styles[name] || {};
6526
- var attributes = state.attributes[name] || {};
6527
- var element = state.elements[name];
6528
- if (!isHTMLElement(element) || !getNodeName(element)) {
6529
- return;
6530
- }
6531
- Object.assign(element.style, style);
6532
- Object.keys(attributes).forEach(function(name2) {
6533
- var value = attributes[name2];
6534
- if (value === false) {
6535
- element.removeAttribute(name2);
6536
- } else {
6537
- element.setAttribute(name2, value === true ? "" : value);
6538
- }
6539
- });
6540
- });
6541
- }
6542
- function effect$2(_ref2) {
6543
- var state = _ref2.state;
6544
- var initialStyles = {
6545
- popper: {
6546
- position: state.options.strategy,
6547
- left: "0",
6548
- top: "0",
6549
- margin: "0"
6550
- },
6551
- arrow: {
6552
- position: "absolute"
6553
- },
6554
- reference: {}
6555
- };
6556
- Object.assign(state.elements.popper.style, initialStyles.popper);
6557
- state.styles = initialStyles;
6558
- if (state.elements.arrow) {
6559
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
5705
+ });
5706
+ }
5707
+ function effect$2(_ref2) {
5708
+ var state = _ref2.state;
5709
+ var initialStyles = {
5710
+ popper: {
5711
+ position: state.options.strategy,
5712
+ left: "0",
5713
+ top: "0",
5714
+ margin: "0"
5715
+ },
5716
+ arrow: {
5717
+ position: "absolute"
5718
+ },
5719
+ reference: {}
5720
+ };
5721
+ Object.assign(state.elements.popper.style, initialStyles.popper);
5722
+ state.styles = initialStyles;
5723
+ if (state.elements.arrow) {
5724
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
6560
5725
  }
6561
5726
  return function() {
6562
5727
  Object.keys(state.elements).forEach(function(name) {
@@ -7226,16 +6391,16 @@ function computeAutoPlacement(state, options) {
7226
6391
  if (options === void 0) {
7227
6392
  options = {};
7228
6393
  }
7229
- var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
6394
+ var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements$1 : _options$allowedAutoP;
7230
6395
  var variation = getVariation(placement);
7231
- var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
6396
+ var placements2 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
7232
6397
  return getVariation(placement2) === variation;
7233
6398
  }) : basePlacements;
7234
- var allowedPlacements = placements$1.filter(function(placement2) {
6399
+ var allowedPlacements = placements2.filter(function(placement2) {
7235
6400
  return allowedAutoPlacements.indexOf(placement2) >= 0;
7236
6401
  });
7237
6402
  if (allowedPlacements.length === 0) {
7238
- allowedPlacements = placements$1;
6403
+ allowedPlacements = placements2;
7239
6404
  }
7240
6405
  var overflows = allowedPlacements.reduce(function(acc, placement2) {
7241
6406
  acc[placement2] = detectOverflow(state, {
@@ -7334,8 +6499,7 @@ function flip(_ref) {
7334
6499
  };
7335
6500
  for (var _i = numberOfChecks; _i > 0; _i--) {
7336
6501
  var _ret = _loop(_i);
7337
- if (_ret === "break")
7338
- break;
6502
+ if (_ret === "break") break;
7339
6503
  }
7340
6504
  }
7341
6505
  if (state.placement !== firstFittingPlacement) {
@@ -7425,7 +6589,7 @@ function distanceAndSkiddingToXY(placement, rects, offset2) {
7425
6589
  function offset(_ref2) {
7426
6590
  var state = _ref2.state, options = _ref2.options, name = _ref2.name;
7427
6591
  var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
7428
- var data = placements.reduce(function(acc, placement) {
6592
+ var data = placements$1.reduce(function(acc, placement) {
7429
6593
  acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
7430
6594
  return acc;
7431
6595
  }, {});
@@ -8022,7 +7186,7 @@ var renderProps = {
8022
7186
  theme: "",
8023
7187
  zIndex: 9999
8024
7188
  };
8025
- var defaultProps = Object.assign({
7189
+ var defaultProps$1 = Object.assign({
8026
7190
  appendTo: TIPPY_DEFAULT_APPEND_TO,
8027
7191
  aria: {
8028
7192
  content: "auto",
@@ -8071,11 +7235,11 @@ var defaultProps = Object.assign({
8071
7235
  trigger: "mouseenter focus",
8072
7236
  triggerTarget: null
8073
7237
  }, pluginProps, renderProps);
8074
- var defaultKeys = Object.keys(defaultProps);
7238
+ var defaultKeys = Object.keys(defaultProps$1);
8075
7239
  var setDefaultProps = function setDefaultProps2(partialProps) {
8076
7240
  var keys = Object.keys(partialProps);
8077
7241
  keys.forEach(function(key) {
8078
- defaultProps[key] = partialProps[key];
7242
+ defaultProps$1[key] = partialProps[key];
8079
7243
  });
8080
7244
  };
8081
7245
  function getExtendedPassedProps(passedProps) {
@@ -8084,14 +7248,14 @@ function getExtendedPassedProps(passedProps) {
8084
7248
  var name = plugin.name, defaultValue = plugin.defaultValue;
8085
7249
  if (name) {
8086
7250
  var _name;
8087
- acc[name] = passedProps[name] !== void 0 ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
7251
+ acc[name] = passedProps[name] !== void 0 ? passedProps[name] : (_name = defaultProps$1[name]) != null ? _name : defaultValue;
8088
7252
  }
8089
7253
  return acc;
8090
7254
  }, {});
8091
7255
  return Object.assign({}, passedProps, pluginProps2);
8092
7256
  }
8093
7257
  function getDataAttributeProps(reference2, plugins) {
8094
- var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
7258
+ var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps$1, {
8095
7259
  plugins
8096
7260
  }))) : defaultKeys;
8097
7261
  var props = propKeys.reduce(function(acc, key) {
@@ -8116,7 +7280,7 @@ function evaluateProps(reference2, props) {
8116
7280
  var out = Object.assign({}, props, {
8117
7281
  content: invokeWithArgsOrReturn(props.content, [reference2])
8118
7282
  }, props.ignoreAttributes ? {} : getDataAttributeProps(reference2, props.plugins));
8119
- out.aria = Object.assign({}, defaultProps.aria, out.aria);
7283
+ out.aria = Object.assign({}, defaultProps$1.aria, out.aria);
8120
7284
  out.aria = {
8121
7285
  expanded: out.aria.expanded === "auto" ? props.interactive : out.aria.expanded,
8122
7286
  content: out.aria.content === "auto" ? props.interactive ? null : "describedby" : out.aria.content
@@ -8231,7 +7395,7 @@ var idCounter = 1;
8231
7395
  var mouseMoveListeners = [];
8232
7396
  var mountedInstances = [];
8233
7397
  function createTippy(reference2, passedProps) {
8234
- var props = evaluateProps(reference2, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps))));
7398
+ var props = evaluateProps(reference2, Object.assign({}, defaultProps$1, getExtendedPassedProps(removeUndefinedProps(passedProps))));
8235
7399
  var showTimeout;
8236
7400
  var hideTimeout;
8237
7401
  var scheduleHideAnimationFrame;
@@ -8337,7 +7501,7 @@ function createTippy(reference2, passedProps) {
8337
7501
  if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === "focus") {
8338
7502
  return 0;
8339
7503
  }
8340
- return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
7504
+ return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps$1.delay);
8341
7505
  }
8342
7506
  function handleStyles(fromHide) {
8343
7507
  if (fromHide === void 0) {
@@ -8712,269 +7876,1305 @@ function createTippy(reference2, passedProps) {
8712
7876
  if (currentInput.isTouch && touchValue === "hold" && touchDelay) {
8713
7877
  delay = touchDelay;
8714
7878
  }
8715
- if (delay) {
8716
- showTimeout = setTimeout(function() {
8717
- instance.show();
8718
- }, delay);
7879
+ if (delay) {
7880
+ showTimeout = setTimeout(function() {
7881
+ instance.show();
7882
+ }, delay);
7883
+ } else {
7884
+ instance.show();
7885
+ }
7886
+ }
7887
+ function scheduleHide(event) {
7888
+ instance.clearDelayTimeouts();
7889
+ invokeHook("onUntrigger", [instance, event]);
7890
+ if (!instance.state.isVisible) {
7891
+ removeDocumentPress();
7892
+ return;
7893
+ }
7894
+ if (instance.props.trigger.indexOf("mouseenter") >= 0 && instance.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(event.type) >= 0 && isVisibleFromClick) {
7895
+ return;
7896
+ }
7897
+ var delay = getDelay(false);
7898
+ if (delay) {
7899
+ hideTimeout = setTimeout(function() {
7900
+ if (instance.state.isVisible) {
7901
+ instance.hide();
7902
+ }
7903
+ }, delay);
7904
+ } else {
7905
+ scheduleHideAnimationFrame = requestAnimationFrame(function() {
7906
+ instance.hide();
7907
+ });
7908
+ }
7909
+ }
7910
+ function enable() {
7911
+ instance.state.isEnabled = true;
7912
+ }
7913
+ function disable() {
7914
+ instance.hide();
7915
+ instance.state.isEnabled = false;
7916
+ }
7917
+ function clearDelayTimeouts() {
7918
+ clearTimeout(showTimeout);
7919
+ clearTimeout(hideTimeout);
7920
+ cancelAnimationFrame(scheduleHideAnimationFrame);
7921
+ }
7922
+ function setProps(partialProps) {
7923
+ if (instance.state.isDestroyed) {
7924
+ return;
7925
+ }
7926
+ invokeHook("onBeforeUpdate", [instance, partialProps]);
7927
+ removeListeners();
7928
+ var prevProps = instance.props;
7929
+ var nextProps = evaluateProps(reference2, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
7930
+ ignoreAttributes: true
7931
+ }));
7932
+ instance.props = nextProps;
7933
+ addListeners();
7934
+ if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
7935
+ cleanupInteractiveMouseListeners();
7936
+ debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
7937
+ }
7938
+ if (prevProps.triggerTarget && !nextProps.triggerTarget) {
7939
+ normalizeToArray(prevProps.triggerTarget).forEach(function(node) {
7940
+ node.removeAttribute("aria-expanded");
7941
+ });
7942
+ } else if (nextProps.triggerTarget) {
7943
+ reference2.removeAttribute("aria-expanded");
7944
+ }
7945
+ handleAriaExpandedAttribute();
7946
+ handleStyles();
7947
+ if (onUpdate) {
7948
+ onUpdate(prevProps, nextProps);
7949
+ }
7950
+ if (instance.popperInstance) {
7951
+ createPopperInstance();
7952
+ getNestedPopperTree().forEach(function(nestedPopper) {
7953
+ requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
7954
+ });
7955
+ }
7956
+ invokeHook("onAfterUpdate", [instance, partialProps]);
7957
+ }
7958
+ function setContent2(content) {
7959
+ instance.setProps({
7960
+ content
7961
+ });
7962
+ }
7963
+ function show() {
7964
+ var isAlreadyVisible = instance.state.isVisible;
7965
+ var isDestroyed = instance.state.isDestroyed;
7966
+ var isDisabled = !instance.state.isEnabled;
7967
+ var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
7968
+ var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps$1.duration);
7969
+ if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
7970
+ return;
7971
+ }
7972
+ if (getCurrentTarget().hasAttribute("disabled")) {
7973
+ return;
7974
+ }
7975
+ invokeHook("onShow", [instance], false);
7976
+ if (instance.props.onShow(instance) === false) {
7977
+ return;
7978
+ }
7979
+ instance.state.isVisible = true;
7980
+ if (getIsDefaultRenderFn()) {
7981
+ popper2.style.visibility = "visible";
7982
+ }
7983
+ handleStyles();
7984
+ addDocumentPress();
7985
+ if (!instance.state.isMounted) {
7986
+ popper2.style.transition = "none";
7987
+ }
7988
+ if (getIsDefaultRenderFn()) {
7989
+ var _getDefaultTemplateCh2 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh2.box, content = _getDefaultTemplateCh2.content;
7990
+ setTransitionDuration([box, content], 0);
7991
+ }
7992
+ onFirstUpdate = function onFirstUpdate2() {
7993
+ var _instance$popperInsta2;
7994
+ if (!instance.state.isVisible || ignoreOnFirstUpdate) {
7995
+ return;
7996
+ }
7997
+ ignoreOnFirstUpdate = true;
7998
+ void popper2.offsetHeight;
7999
+ popper2.style.transition = instance.props.moveTransition;
8000
+ if (getIsDefaultRenderFn() && instance.props.animation) {
8001
+ var _getDefaultTemplateCh3 = getDefaultTemplateChildren(), _box = _getDefaultTemplateCh3.box, _content = _getDefaultTemplateCh3.content;
8002
+ setTransitionDuration([_box, _content], duration);
8003
+ setVisibilityState([_box, _content], "visible");
8004
+ }
8005
+ handleAriaContentAttribute();
8006
+ handleAriaExpandedAttribute();
8007
+ pushIfUnique(mountedInstances, instance);
8008
+ (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
8009
+ invokeHook("onMount", [instance]);
8010
+ if (instance.props.animation && getIsDefaultRenderFn()) {
8011
+ onTransitionedIn(duration, function() {
8012
+ instance.state.isShown = true;
8013
+ invokeHook("onShown", [instance]);
8014
+ });
8015
+ }
8016
+ };
8017
+ mount();
8018
+ }
8019
+ function hide2() {
8020
+ var isAlreadyHidden = !instance.state.isVisible;
8021
+ var isDestroyed = instance.state.isDestroyed;
8022
+ var isDisabled = !instance.state.isEnabled;
8023
+ var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps$1.duration);
8024
+ if (isAlreadyHidden || isDestroyed || isDisabled) {
8025
+ return;
8026
+ }
8027
+ invokeHook("onHide", [instance], false);
8028
+ if (instance.props.onHide(instance) === false) {
8029
+ return;
8030
+ }
8031
+ instance.state.isVisible = false;
8032
+ instance.state.isShown = false;
8033
+ ignoreOnFirstUpdate = false;
8034
+ isVisibleFromClick = false;
8035
+ if (getIsDefaultRenderFn()) {
8036
+ popper2.style.visibility = "hidden";
8037
+ }
8038
+ cleanupInteractiveMouseListeners();
8039
+ removeDocumentPress();
8040
+ handleStyles(true);
8041
+ if (getIsDefaultRenderFn()) {
8042
+ var _getDefaultTemplateCh4 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh4.box, content = _getDefaultTemplateCh4.content;
8043
+ if (instance.props.animation) {
8044
+ setTransitionDuration([box, content], duration);
8045
+ setVisibilityState([box, content], "hidden");
8046
+ }
8047
+ }
8048
+ handleAriaContentAttribute();
8049
+ handleAriaExpandedAttribute();
8050
+ if (instance.props.animation) {
8051
+ if (getIsDefaultRenderFn()) {
8052
+ onTransitionedOut(duration, instance.unmount);
8053
+ }
8054
+ } else {
8055
+ instance.unmount();
8056
+ }
8057
+ }
8058
+ function hideWithInteractivity(event) {
8059
+ getDocument().addEventListener("mousemove", debouncedOnMouseMove);
8060
+ pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
8061
+ debouncedOnMouseMove(event);
8062
+ }
8063
+ function unmount() {
8064
+ if (instance.state.isVisible) {
8065
+ instance.hide();
8066
+ }
8067
+ if (!instance.state.isMounted) {
8068
+ return;
8069
+ }
8070
+ destroyPopperInstance();
8071
+ getNestedPopperTree().forEach(function(nestedPopper) {
8072
+ nestedPopper._tippy.unmount();
8073
+ });
8074
+ if (popper2.parentNode) {
8075
+ popper2.parentNode.removeChild(popper2);
8076
+ }
8077
+ mountedInstances = mountedInstances.filter(function(i) {
8078
+ return i !== instance;
8079
+ });
8080
+ instance.state.isMounted = false;
8081
+ invokeHook("onHidden", [instance]);
8082
+ }
8083
+ function destroy() {
8084
+ if (instance.state.isDestroyed) {
8085
+ return;
8086
+ }
8087
+ instance.clearDelayTimeouts();
8088
+ instance.unmount();
8089
+ removeListeners();
8090
+ delete reference2._tippy;
8091
+ instance.state.isDestroyed = true;
8092
+ invokeHook("onDestroy", [instance]);
8093
+ }
8094
+ }
8095
+ function tippy(targets, optionalProps) {
8096
+ if (optionalProps === void 0) {
8097
+ optionalProps = {};
8098
+ }
8099
+ var plugins = defaultProps$1.plugins.concat(optionalProps.plugins || []);
8100
+ bindGlobalEventListeners();
8101
+ var passedProps = Object.assign({}, optionalProps, {
8102
+ plugins
8103
+ });
8104
+ var elements = getArrayOfElements(targets);
8105
+ var instances = elements.reduce(function(acc, reference2) {
8106
+ var instance = reference2 && createTippy(reference2, passedProps);
8107
+ if (instance) {
8108
+ acc.push(instance);
8109
+ }
8110
+ return acc;
8111
+ }, []);
8112
+ return isElement(targets) ? instances[0] : instances;
8113
+ }
8114
+ tippy.defaultProps = defaultProps$1;
8115
+ tippy.setDefaultProps = setDefaultProps;
8116
+ tippy.currentInput = currentInput;
8117
+ Object.assign({}, applyStyles$1, {
8118
+ effect: function effect2(_ref) {
8119
+ var state = _ref.state;
8120
+ var initialStyles = {
8121
+ popper: {
8122
+ position: state.options.strategy,
8123
+ left: "0",
8124
+ top: "0",
8125
+ margin: "0"
8126
+ },
8127
+ arrow: {
8128
+ position: "absolute"
8129
+ },
8130
+ reference: {}
8131
+ };
8132
+ Object.assign(state.elements.popper.style, initialStyles.popper);
8133
+ state.styles = initialStyles;
8134
+ if (state.elements.arrow) {
8135
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
8136
+ }
8137
+ }
8138
+ });
8139
+ tippy.setDefaultProps({
8140
+ render
8141
+ });
8142
+ const dbTheme = "db-tippy";
8143
+ const dbDefaultProps = { theme: dbTheme };
8144
+ function dbTippy(targets, optionalProps) {
8145
+ const props = optionalProps ? { ...optionalProps } : optionalProps;
8146
+ if (props) {
8147
+ const { theme } = props;
8148
+ props.theme = theme ? `${dbTheme} ${props.theme}` : dbTheme;
8149
+ }
8150
+ if (targets instanceof Element) {
8151
+ const target = targets;
8152
+ return tippy(target, props || dbDefaultProps);
8153
+ }
8154
+ return tippy(targets, props || dbDefaultProps);
8155
+ }
8156
+ const placements = [
8157
+ "top",
8158
+ "bottom",
8159
+ "right",
8160
+ "left",
8161
+ "auto",
8162
+ "auto-start",
8163
+ "auto-end",
8164
+ "top-start",
8165
+ "top-end",
8166
+ "bottom-start",
8167
+ "bottom-end",
8168
+ "right-start",
8169
+ "right-end",
8170
+ "left-start",
8171
+ "left-end"
8172
+ ];
8173
+ function checkOverflow(el) {
8174
+ if (!el) return false;
8175
+ const createDom = (el2, css) => {
8176
+ const dom = document.createElement("div");
8177
+ const width = parseFloat(css.width) ? `${Math.ceil(parseFloat(css.width))}px` : css.width;
8178
+ dom.style.cssText = `
8179
+ width: ${width};
8180
+ line-height: ${css.lineHeight};
8181
+ font-size: ${css.fontSize};
8182
+ word-break: ${css.wordBreak};
8183
+ padding: ${css.padding};
8184
+ `;
8185
+ dom.textContent = el2.textContent;
8186
+ return dom;
8187
+ };
8188
+ let isOverflow = false;
8189
+ try {
8190
+ const css = window.getComputedStyle(el, null);
8191
+ const lineClamp = css.webkitLineClamp;
8192
+ if (lineClamp !== "none") {
8193
+ const targetHeight = parseFloat(css.height);
8194
+ const dom = createDom(el, css);
8195
+ document.body.appendChild(dom);
8196
+ const domHeight = window.getComputedStyle(dom, null).height;
8197
+ document.body.removeChild(dom);
8198
+ isOverflow = targetHeight < parseFloat(domHeight);
8719
8199
  } else {
8720
- instance.show();
8200
+ isOverflow = el.clientWidth < el.scrollWidth || el.clientHeight < el.scrollHeight;
8721
8201
  }
8202
+ } catch (e) {
8203
+ console.warn("There is an error when check element overflow state: ", e);
8722
8204
  }
8723
- function scheduleHide(event) {
8724
- instance.clearDelayTimeouts();
8725
- invokeHook("onUntrigger", [instance, event]);
8726
- if (!instance.state.isVisible) {
8727
- removeDocumentPress();
8728
- return;
8205
+ return isOverflow;
8206
+ }
8207
+ function beforeShow(instance) {
8208
+ const { reference: reference2 } = instance;
8209
+ const { props } = reference2._bk_overflow_tips_;
8210
+ const isOverflow = checkOverflow(reference2);
8211
+ if (isOverflow) {
8212
+ let { content } = props;
8213
+ if (!content) {
8214
+ content = props.allowHTML ? reference2.innerHTML : reference2.textContent;
8215
+ }
8216
+ instance.setContent(content);
8217
+ return true;
8218
+ }
8219
+ return false;
8220
+ }
8221
+ function setupOnShow(props, customProps) {
8222
+ props.onShow = (instance) => {
8223
+ if (typeof customProps.onShow === "function") {
8224
+ const result = customProps.onShow(instance);
8225
+ if (!result) return false;
8226
+ }
8227
+ const isShow = beforeShow(instance);
8228
+ if (!isShow) return false;
8229
+ };
8230
+ }
8231
+ function setupTheme(props, customProps) {
8232
+ const theme = ["db-tippy bk-overflow-tips"];
8233
+ if (customProps.theme) {
8234
+ theme.push(customProps.theme);
8235
+ }
8236
+ props.theme = theme.join(" ");
8237
+ }
8238
+ function formatModifiers(modifiers) {
8239
+ const keys = Object.entries(modifiers).map((item) => item[0]);
8240
+ if (keys.length === 0) return {};
8241
+ const props = {};
8242
+ for (const key of keys) {
8243
+ if (placements.includes(key)) {
8244
+ props.placement = key;
8729
8245
  }
8730
- if (instance.props.trigger.indexOf("mouseenter") >= 0 && instance.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(event.type) >= 0 && isVisibleFromClick) {
8731
- return;
8246
+ }
8247
+ return props;
8248
+ }
8249
+ const defaultProps = {
8250
+ arrow: true,
8251
+ interactive: true,
8252
+ delay: 150,
8253
+ allowHTML: false,
8254
+ maxWidth: 600,
8255
+ // boundary: 'window',
8256
+ placement: "top",
8257
+ appendTo: () => document.body
8258
+ };
8259
+ const overflowTips = {
8260
+ mounted(el, binding) {
8261
+ const customProps = typeof binding.value === "object" ? binding.value : formatModifiers(binding.modifiers);
8262
+ const props = Object.assign({ ...defaultProps }, customProps);
8263
+ setupOnShow(props, customProps);
8264
+ setupTheme(props, customProps);
8265
+ el._bk_overflow_tips_ = {
8266
+ props,
8267
+ // 指令配置的props单独存储方便后续做判断
8268
+ instance: dbTippy(el, props)
8269
+ };
8270
+ },
8271
+ updated(el, binding) {
8272
+ const { props, instance } = el._bk_overflow_tips_;
8273
+ const customProps = typeof binding.value === "object" ? binding.value : formatModifiers(binding.modifiers);
8274
+ Object.assign(props, customProps);
8275
+ setupOnShow(props, customProps);
8276
+ setupTheme(props, customProps);
8277
+ instance.setProps(props);
8278
+ },
8279
+ beforeUnmount(el) {
8280
+ el._tippy && el._tippy.destroy();
8281
+ delete el._bk_overflow_tips_;
8282
+ }
8283
+ };
8284
+ const random = () => `${_.random(0, 999999)}_${Date.now()}_${_.random(0, 999999)}`;
8285
+ const encodeMult = (text) => {
8286
+ const temp = document.createElement("textarea");
8287
+ temp.value = text;
8288
+ return temp.value;
8289
+ };
8290
+ function tryOnScopeDispose(fn2) {
8291
+ if (getCurrentScope()) {
8292
+ onScopeDispose(fn2);
8293
+ return true;
8294
+ }
8295
+ return false;
8296
+ }
8297
+ function toValue(r) {
8298
+ return typeof r === "function" ? r() : unref(r);
8299
+ }
8300
+ const isClient = typeof window !== "undefined" && typeof document !== "undefined";
8301
+ typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
8302
+ function unrefElement(elRef) {
8303
+ var _a;
8304
+ const plain = toValue(elRef);
8305
+ return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
8306
+ }
8307
+ const defaultWindow = isClient ? window : void 0;
8308
+ function useMounted() {
8309
+ const isMounted = ref(false);
8310
+ const instance = getCurrentInstance();
8311
+ if (instance) {
8312
+ onMounted(() => {
8313
+ isMounted.value = true;
8314
+ }, instance);
8315
+ }
8316
+ return isMounted;
8317
+ }
8318
+ function useSupported(callback) {
8319
+ const isMounted = useMounted();
8320
+ return computed(() => {
8321
+ isMounted.value;
8322
+ return Boolean(callback());
8323
+ });
8324
+ }
8325
+ function useResizeObserver(target, callback, options = {}) {
8326
+ const { window: window2 = defaultWindow, ...observerOptions } = options;
8327
+ let observer;
8328
+ const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
8329
+ const cleanup = () => {
8330
+ if (observer) {
8331
+ observer.disconnect();
8332
+ observer = void 0;
8732
8333
  }
8733
- var delay = getDelay(false);
8734
- if (delay) {
8735
- hideTimeout = setTimeout(function() {
8736
- if (instance.state.isVisible) {
8737
- instance.hide();
8334
+ };
8335
+ const targets = computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
8336
+ const stopWatch = watch(
8337
+ targets,
8338
+ (els) => {
8339
+ cleanup();
8340
+ if (isSupported.value && window2) {
8341
+ observer = new ResizeObserver(callback);
8342
+ for (const _el of els)
8343
+ _el && observer.observe(_el, observerOptions);
8344
+ }
8345
+ },
8346
+ { immediate: true, flush: "post" }
8347
+ );
8348
+ const stop = () => {
8349
+ cleanup();
8350
+ stopWatch();
8351
+ };
8352
+ tryOnScopeDispose(stop);
8353
+ return {
8354
+ isSupported,
8355
+ stop
8356
+ };
8357
+ }
8358
+ const _hoisted_1$6 = ["data-fixed", "data-maxWidth", "data-minWidth", "data-width"];
8359
+ const _hoisted_2$2 = { class: "th-cell" };
8360
+ const _hoisted_3$1 = { style: { "display": "inline-block", "line-height": "40px", "vertical-align": "top" } };
8361
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8362
+ __name: "head-column",
8363
+ props: {
8364
+ fixed: { default: void 0 },
8365
+ maxWidth: { default: void 0 },
8366
+ minWidth: { default: void 0 },
8367
+ required: { type: Boolean, default: true },
8368
+ width: { default: void 0 },
8369
+ renderAppend: { type: Function, default: void 0 },
8370
+ memo: { default: void 0 }
8371
+ },
8372
+ setup(__props) {
8373
+ const props = __props;
8374
+ const slots = useSlots();
8375
+ const { rowWidth, isOverflow: isMinimize, isScrollToLeft, isScrollToRight } = inject(renderTablekey);
8376
+ const parentTable = inject(tableColumnResizekey);
8377
+ const columnRef = ref();
8378
+ const currentWidth = ref(0);
8379
+ const vBkTooltips = bkTooltips;
8380
+ const vOverflowTips = overflowTips;
8381
+ const columnKey = random();
8382
+ let initWidthRate = 0;
8383
+ let isDragedSelf = false;
8384
+ const finalMinWidth = computed(() => props.minWidth ? props.minWidth : props.width ?? 100);
8385
+ const isFixedRight = computed(() => props.fixed === "right");
8386
+ const isFixedLeft = computed(() => props.fixed === "left");
8387
+ const styles = computed(() => {
8388
+ if (props.width && (rowWidth == null ? void 0 : rowWidth.value) && finalMinWidth.value) {
8389
+ const newWidth = rowWidth.value * initWidthRate;
8390
+ if (newWidth !== props.width) {
8391
+ let width = 0;
8392
+ if (isMinimize == null ? void 0 : isMinimize.value) {
8393
+ if (currentWidth.value !== 0 && (currentWidth.value !== finalMinWidth.value || currentWidth.value !== props.width)) {
8394
+ width = currentWidth.value;
8395
+ } else {
8396
+ width = finalMinWidth.value;
8397
+ }
8398
+ } else if (newWidth > finalMinWidth.value) {
8399
+ width = newWidth;
8400
+ } else {
8401
+ width = finalMinWidth.value;
8402
+ }
8403
+ return {
8404
+ minWidth: `${width}px`
8405
+ };
8738
8406
  }
8739
- }, delay);
8740
- } else {
8741
- scheduleHideAnimationFrame = requestAnimationFrame(function() {
8742
- instance.hide();
8407
+ }
8408
+ return {
8409
+ minWidth: props.width ? `${props.width}px` : "120px"
8410
+ };
8411
+ });
8412
+ const RenderAppendElement = computed(() => props.renderAppend && props.renderAppend());
8413
+ watch(
8414
+ () => [props.width, rowWidth == null ? void 0 : rowWidth.value, currentWidth.value],
8415
+ ([width, rowWidth2, currentWidth2]) => {
8416
+ if (!isDragedSelf) {
8417
+ return;
8418
+ }
8419
+ if (width && rowWidth2 && currentWidth2 && finalMinWidth.value) {
8420
+ isDragedSelf = false;
8421
+ if (currentWidth2 !== 0 && (currentWidth2 !== finalMinWidth.value || currentWidth2 !== width)) {
8422
+ initWidthRate = currentWidth2 / rowWidth2;
8423
+ } else {
8424
+ initWidthRate = (isMinimize == null ? void 0 : isMinimize.value) ? finalMinWidth.value / rowWidth2 : width / rowWidth2;
8425
+ }
8426
+ }
8427
+ },
8428
+ {
8429
+ immediate: true
8430
+ }
8431
+ );
8432
+ useResizeObserver(columnRef, () => {
8433
+ if (!isDragedSelf) {
8434
+ return;
8435
+ }
8436
+ const width = parseFloat(columnRef.value.style.width);
8437
+ currentWidth.value = width;
8438
+ });
8439
+ const handleMouseDown = (event) => {
8440
+ isDragedSelf = true;
8441
+ parentTable == null ? void 0 : parentTable.columnMousedown(event, {
8442
+ columnKey,
8443
+ minWidth: finalMinWidth.value
8743
8444
  });
8744
- }
8745
- }
8746
- function enable() {
8747
- instance.state.isEnabled = true;
8445
+ };
8446
+ const handleMouseMove = (event) => {
8447
+ parentTable == null ? void 0 : parentTable.columnMouseMove(event);
8448
+ };
8449
+ return (_ctx, _cache) => {
8450
+ return openBlock(), createElementBlock("th", {
8451
+ ref_key: "columnRef",
8452
+ ref: columnRef,
8453
+ class: normalizeClass(["bk-ediatable-head-column", {
8454
+ [`column-${unref(columnKey)}`]: true,
8455
+ "is-right-fixed": unref(isMinimize) && isFixedRight.value && !unref(isScrollToRight),
8456
+ "is-left-fixed": unref(isMinimize) && isFixedLeft.value && !unref(isScrollToLeft)
8457
+ }]),
8458
+ "data-fixed": _ctx.fixed,
8459
+ "data-maxWidth": _ctx.maxWidth,
8460
+ "data-minWidth": finalMinWidth.value,
8461
+ "data-width": _ctx.width,
8462
+ style: normalizeStyle(styles.value),
8463
+ onMousedown: handleMouseDown,
8464
+ onMousemove: handleMouseMove
8465
+ }, [
8466
+ createElementVNode(
8467
+ "div",
8468
+ {
8469
+ class: normalizeClass({ "is-required": _ctx.required })
8470
+ },
8471
+ [
8472
+ withDirectives((openBlock(), createElementBlock("div", _hoisted_2$2, [
8473
+ withDirectives((openBlock(), createElementBlock(
8474
+ "span",
8475
+ {
8476
+ class: normalizeClass({ "title-memo": _ctx.memo })
8477
+ },
8478
+ [
8479
+ renderSlot(_ctx.$slots, "default")
8480
+ ],
8481
+ 2
8482
+ /* CLASS */
8483
+ )), [
8484
+ [unref(vBkTooltips), {
8485
+ content: _ctx.memo,
8486
+ disabled: !_ctx.memo
8487
+ }]
8488
+ ])
8489
+ ])), [
8490
+ [unref(vOverflowTips)]
8491
+ ]),
8492
+ createElementVNode("div", _hoisted_3$1, [
8493
+ slots.append && !_ctx.renderAppend ? renderSlot(_ctx.$slots, "append", { key: 0 }) : createCommentVNode("v-if", true),
8494
+ _ctx.renderAppend ? (openBlock(), createBlock(unref(RenderAppendElement), { key: 1 })) : createCommentVNode("v-if", true)
8495
+ ])
8496
+ ],
8497
+ 2
8498
+ /* CLASS */
8499
+ )
8500
+ ], 46, _hoisted_1$6);
8501
+ };
8748
8502
  }
8749
- function disable() {
8750
- instance.hide();
8751
- instance.state.isEnabled = false;
8503
+ });
8504
+ const renderTablekey = Symbol("renderTable");
8505
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
8506
+ __name: "ediatable",
8507
+ props: {
8508
+ theadList: { default: () => [] }
8509
+ },
8510
+ setup(__props) {
8511
+ const slots = useSlots();
8512
+ const checkTableScroll = () => {
8513
+ rowWidth.value = tableRef.value.clientWidth;
8514
+ isOverflow.value = tableOuterRef.value.clientWidth < tableRef.value.clientWidth;
8515
+ initColumnWidth();
8516
+ };
8517
+ const tableOuterRef = ref();
8518
+ const tableRef = ref();
8519
+ const tableColumnResizeRef = ref();
8520
+ const isOverflow = ref(false);
8521
+ const rowWidth = ref(0);
8522
+ const isScrollToLeft = ref(true);
8523
+ const isScrollToRight = ref(false);
8524
+ const { initColumnWidth } = useColumnResize(tableOuterRef, tableColumnResizeRef, _.debounce(checkTableScroll));
8525
+ provide(renderTablekey, {
8526
+ isOverflow,
8527
+ rowWidth,
8528
+ isScrollToLeft,
8529
+ isScrollToRight
8530
+ });
8531
+ const handleScroll = _.throttle(() => {
8532
+ isScrollToLeft.value = tableOuterRef.value.scrollLeft === 0;
8533
+ isScrollToRight.value = tableOuterRef.value.scrollWidth - tableOuterRef.value.scrollLeft < tableOuterRef.value.clientWidth + 1;
8534
+ }, 200);
8535
+ onMounted(() => {
8536
+ window.addEventListener("resize", checkTableScroll);
8537
+ checkTableScroll();
8538
+ setTimeout(() => checkTableScroll());
8539
+ tableOuterRef.value.addEventListener("scroll", handleScroll);
8540
+ });
8541
+ onBeforeUnmount(() => {
8542
+ window.removeEventListener("resize", checkTableScroll);
8543
+ tableOuterRef.value.removeEventListener("scroll", handleScroll);
8544
+ });
8545
+ return (_ctx, _cache) => {
8546
+ return openBlock(), createElementBlock(
8547
+ "div",
8548
+ {
8549
+ id: "ediatableRenderTableKey",
8550
+ ref_key: "tableOuterRef",
8551
+ ref: tableOuterRef,
8552
+ class: normalizeClass(["bk-ediatable", { "scrollbar-exists": isOverflow.value }])
8553
+ },
8554
+ [
8555
+ createElementVNode(
8556
+ "table",
8557
+ {
8558
+ ref_key: "tableRef",
8559
+ ref: tableRef
8560
+ },
8561
+ [
8562
+ createElementVNode("thead", null, [
8563
+ createElementVNode("tr", null, [
8564
+ slots.default && _ctx.theadList.length === 0 ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(true), createElementBlock(
8565
+ Fragment,
8566
+ { key: 1 },
8567
+ renderList(_ctx.theadList, (head, index) => {
8568
+ return openBlock(), createBlock(_sfc_main$8, {
8569
+ key: index,
8570
+ width: head.width,
8571
+ "min-width": head.minWidth,
8572
+ "max-width": head.maxWidth,
8573
+ fixed: head.fixed,
8574
+ required: head.required,
8575
+ "render-append": head.renderAppend,
8576
+ memo: head.memo
8577
+ }, {
8578
+ default: withCtx(() => [
8579
+ createTextVNode(
8580
+ toDisplayString(head.title),
8581
+ 1
8582
+ /* TEXT */
8583
+ )
8584
+ ]),
8585
+ _: 2
8586
+ /* DYNAMIC */
8587
+ }, 1032, ["width", "min-width", "max-width", "fixed", "required", "render-append", "memo"]);
8588
+ }),
8589
+ 128
8590
+ /* KEYED_FRAGMENT */
8591
+ ))
8592
+ ])
8593
+ ]),
8594
+ renderSlot(_ctx.$slots, "data")
8595
+ ],
8596
+ 512
8597
+ /* NEED_PATCH */
8598
+ ),
8599
+ createElementVNode(
8600
+ "div",
8601
+ {
8602
+ ref_key: "tableColumnResizeRef",
8603
+ ref: tableColumnResizeRef,
8604
+ class: "table-column-resize"
8605
+ },
8606
+ null,
8607
+ 512
8608
+ /* NEED_PATCH */
8609
+ )
8610
+ ],
8611
+ 2
8612
+ /* CLASS */
8613
+ );
8614
+ };
8752
8615
  }
8753
- function clearDelayTimeouts() {
8754
- clearTimeout(showTimeout);
8755
- clearTimeout(hideTimeout);
8756
- cancelAnimationFrame(scheduleHideAnimationFrame);
8616
+ });
8617
+ const getRuleMessage = (rule) => {
8618
+ if (typeof rule.message === "function") {
8619
+ return rule.message();
8757
8620
  }
8758
- function setProps(partialProps) {
8759
- if (instance.state.isDestroyed) {
8760
- return;
8761
- }
8762
- invokeHook("onBeforeUpdate", [instance, partialProps]);
8763
- removeListeners();
8764
- var prevProps = instance.props;
8765
- var nextProps = evaluateProps(reference2, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
8766
- ignoreAttributes: true
8767
- }));
8768
- instance.props = nextProps;
8769
- addListeners();
8770
- if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
8771
- cleanupInteractiveMouseListeners();
8772
- debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
8773
- }
8774
- if (prevProps.triggerTarget && !nextProps.triggerTarget) {
8775
- normalizeToArray(prevProps.triggerTarget).forEach(function(node) {
8776
- node.removeAttribute("aria-expanded");
8777
- });
8778
- } else if (nextProps.triggerTarget) {
8779
- reference2.removeAttribute("aria-expanded");
8621
+ return rule.message;
8622
+ };
8623
+ function useValidtor(rules) {
8624
+ const state = reactive({
8625
+ loading: false,
8626
+ error: false,
8627
+ message: ""
8628
+ });
8629
+ const validator = (targetValue) => {
8630
+ state.error = false, state.message = "";
8631
+ if (!rules) {
8632
+ return Promise.resolve(true);
8780
8633
  }
8781
- handleAriaExpandedAttribute();
8782
- handleStyles();
8783
- if (onUpdate) {
8784
- onUpdate(prevProps, nextProps);
8634
+ const run = /* @__PURE__ */ (() => {
8635
+ let stepIndex = -1;
8636
+ return async () => {
8637
+ stepIndex = stepIndex + 1;
8638
+ if (stepIndex >= rules.length) {
8639
+ return Promise.resolve(true);
8640
+ }
8641
+ const rule = rules[stepIndex];
8642
+ return Promise.resolve().then(() => {
8643
+ const result = rule.validator(targetValue);
8644
+ if (typeof result !== "boolean" && typeof result.then === "function") {
8645
+ return result.then((data) => {
8646
+ if (data === false) {
8647
+ return Promise.reject(getRuleMessage(rule));
8648
+ }
8649
+ }).then(() => run(), () => {
8650
+ state.error = true;
8651
+ const message = getRuleMessage(rule);
8652
+ state.message = message;
8653
+ return Promise.reject(message);
8654
+ });
8655
+ }
8656
+ if (!result) {
8657
+ state.error = true;
8658
+ const message = getRuleMessage(rule);
8659
+ state.message = message;
8660
+ return Promise.reject(message);
8661
+ }
8662
+ return run();
8663
+ });
8664
+ };
8665
+ })();
8666
+ return run();
8667
+ };
8668
+ return {
8669
+ ...toRefs(state),
8670
+ validator
8671
+ };
8672
+ }
8673
+ const DbIcon = defineComponent({
8674
+ name: "DbIcon",
8675
+ props: {
8676
+ type: {
8677
+ type: String,
8678
+ required: true
8679
+ },
8680
+ svg: {
8681
+ type: Boolean,
8682
+ default: false
8785
8683
  }
8786
- if (instance.popperInstance) {
8787
- createPopperInstance();
8788
- getNestedPopperTree().forEach(function(nestedPopper) {
8789
- requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
8790
- });
8684
+ },
8685
+ render() {
8686
+ if (this.svg) {
8687
+ return h(
8688
+ "svg",
8689
+ {
8690
+ class: {
8691
+ "db-svg-icon": true
8692
+ }
8693
+ },
8694
+ [
8695
+ h("use", {
8696
+ "xlink:href": `#db-icon-${this.type}`
8697
+ })
8698
+ ]
8699
+ );
8791
8700
  }
8792
- invokeHook("onAfterUpdate", [instance, partialProps]);
8701
+ const classes = {
8702
+ "ediatable-icon": true,
8703
+ [`icon-${this.type}`]: true
8704
+ };
8705
+ return h("i", {
8706
+ class: classes
8707
+ });
8793
8708
  }
8794
- function setContent2(content) {
8795
- instance.setProps({
8796
- content
8709
+ });
8710
+ const _hoisted_1$5 = {
8711
+ key: 0,
8712
+ class: "input-error"
8713
+ };
8714
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8715
+ __name: "date-time-picker-column",
8716
+ props: /* @__PURE__ */ mergeModels({
8717
+ placeholder: { default: "" },
8718
+ rules: { default: void 0 },
8719
+ type: { default: void 0 },
8720
+ disabled: { type: Boolean, default: false }
8721
+ }, {
8722
+ "modelValue": {},
8723
+ "modelModifiers": {}
8724
+ }),
8725
+ emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
8726
+ setup(__props, { expose: __expose, emit: __emit }) {
8727
+ const props = __props;
8728
+ const emits = __emit;
8729
+ const modelValue = useModel(__props, "modelValue");
8730
+ const attrs = useAttrs();
8731
+ const slots = useSlots();
8732
+ const { message: errorMessage, validator } = useValidtor(props.rules);
8733
+ const vBkTooltips = bkTooltips;
8734
+ const handleChange = (value) => {
8735
+ modelValue.value = value;
8736
+ validator(modelValue.value).then(() => {
8737
+ emits("change", modelValue.value);
8738
+ });
8739
+ };
8740
+ const handleOpenChange = (open) => {
8741
+ if (!open) {
8742
+ validator(modelValue.value);
8743
+ }
8744
+ };
8745
+ __expose({
8746
+ getValue() {
8747
+ return validator(modelValue.value).then(() => modelValue.value);
8748
+ }
8797
8749
  });
8750
+ return (_ctx, _cache) => {
8751
+ return openBlock(), createElementBlock(
8752
+ "div",
8753
+ {
8754
+ class: normalizeClass(["bk-ediatable-time-picker", {
8755
+ "is-error": Boolean(unref(errorMessage)),
8756
+ "is-disabled": _ctx.disabled
8757
+ }])
8758
+ },
8759
+ [
8760
+ createVNode(unref(DatePicker), mergeProps({
8761
+ "append-to-body": "",
8762
+ clearable: false,
8763
+ "model-value": modelValue.value,
8764
+ placeholder: _ctx.placeholder,
8765
+ style: { "width": "100%" },
8766
+ type: _ctx.type
8767
+ }, unref(attrs), {
8768
+ onChange: handleChange,
8769
+ onOpenChange: handleOpenChange
8770
+ }), createSlots({
8771
+ _: 2
8772
+ /* DYNAMIC */
8773
+ }, [
8774
+ unref(slots).footer ? {
8775
+ name: "footer",
8776
+ fn: withCtx(() => [
8777
+ renderSlot(_ctx.$slots, "footer")
8778
+ ]),
8779
+ key: "0"
8780
+ } : void 0
8781
+ ]), 1040, ["model-value", "placeholder", "type"]),
8782
+ unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
8783
+ withDirectives(createVNode(
8784
+ unref(DbIcon),
8785
+ { type: "exclamation-fill" },
8786
+ null,
8787
+ 512
8788
+ /* NEED_PATCH */
8789
+ ), [
8790
+ [unref(vBkTooltips), unref(errorMessage)]
8791
+ ])
8792
+ ])) : createCommentVNode("v-if", true)
8793
+ ],
8794
+ 2
8795
+ /* CLASS */
8796
+ );
8797
+ };
8798
8798
  }
8799
- function show() {
8800
- var isAlreadyVisible = instance.state.isVisible;
8801
- var isDestroyed = instance.state.isDestroyed;
8802
- var isDisabled = !instance.state.isEnabled;
8803
- var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
8804
- var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
8805
- if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
8806
- return;
8807
- }
8808
- if (getCurrentTarget().hasAttribute("disabled")) {
8809
- return;
8810
- }
8811
- invokeHook("onShow", [instance], false);
8812
- if (instance.props.onShow(instance) === false) {
8813
- return;
8814
- }
8815
- instance.state.isVisible = true;
8816
- if (getIsDefaultRenderFn()) {
8817
- popper2.style.visibility = "visible";
8818
- }
8819
- handleStyles();
8820
- addDocumentPress();
8821
- if (!instance.state.isMounted) {
8822
- popper2.style.transition = "none";
8823
- }
8824
- if (getIsDefaultRenderFn()) {
8825
- var _getDefaultTemplateCh2 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh2.box, content = _getDefaultTemplateCh2.content;
8826
- setTransitionDuration([box, content], 0);
8827
- }
8828
- onFirstUpdate = function onFirstUpdate2() {
8829
- var _instance$popperInsta2;
8830
- if (!instance.state.isVisible || ignoreOnFirstUpdate) {
8799
+ });
8800
+ const _hoisted_1$4 = {
8801
+ key: 1,
8802
+ class: "blur-dispaly-main"
8803
+ };
8804
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
8805
+ __name: "input-column",
8806
+ props: /* @__PURE__ */ mergeModels({
8807
+ placeholder: { default: "请输入" },
8808
+ rules: { default: void 0 },
8809
+ disabled: { type: Boolean, default: false },
8810
+ type: { default: "text" },
8811
+ min: { default: Number.MIN_SAFE_INTEGER },
8812
+ max: { default: Number.MAX_SAFE_INTEGER },
8813
+ isShowBlur: { type: Boolean, default: false },
8814
+ precision: { default: 0 }
8815
+ }, {
8816
+ "modelValue": {
8817
+ default: ""
8818
+ },
8819
+ "modelModifiers": {}
8820
+ }),
8821
+ emits: /* @__PURE__ */ mergeModels(["submit"], ["update:modelValue"]),
8822
+ setup(__props, { expose: __expose, emit: __emit }) {
8823
+ const props = __props;
8824
+ const emits = __emit;
8825
+ const modelValue = useModel(__props, "modelValue");
8826
+ const rootRef = ref();
8827
+ const isBlur = ref(true);
8828
+ const isPassword = computed(() => props.type === "password");
8829
+ let oldInputText = "";
8830
+ const vBkTooltips = bkTooltips;
8831
+ const {
8832
+ message: errorMessage,
8833
+ validator
8834
+ } = useValidtor(props.rules);
8835
+ const handleInput = (value) => {
8836
+ isBlur.value = false;
8837
+ modelValue.value = value;
8838
+ };
8839
+ const handleBlur = (event) => {
8840
+ isBlur.value = true;
8841
+ if (props.disabled) {
8842
+ event.preventDefault();
8831
8843
  return;
8832
8844
  }
8833
- ignoreOnFirstUpdate = true;
8834
- void popper2.offsetHeight;
8835
- popper2.style.transition = instance.props.moveTransition;
8836
- if (getIsDefaultRenderFn() && instance.props.animation) {
8837
- var _getDefaultTemplateCh3 = getDefaultTemplateChildren(), _box = _getDefaultTemplateCh3.box, _content = _getDefaultTemplateCh3.content;
8838
- setTransitionDuration([_box, _content], duration);
8839
- setVisibilityState([_box, _content], "visible");
8845
+ if (modelValue.value) {
8846
+ if (oldInputText === modelValue.value) {
8847
+ return;
8848
+ }
8849
+ oldInputText = modelValue.value;
8850
+ validator(modelValue.value).then(() => {
8851
+ emits("submit", modelValue.value);
8852
+ });
8853
+ return;
8840
8854
  }
8841
- handleAriaContentAttribute();
8842
- handleAriaExpandedAttribute();
8843
- pushIfUnique(mountedInstances, instance);
8844
- (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
8845
- invokeHook("onMount", [instance]);
8846
- if (instance.props.animation && getIsDefaultRenderFn()) {
8847
- onTransitionedIn(duration, function() {
8848
- instance.state.isShown = true;
8849
- invokeHook("onShown", [instance]);
8855
+ emits("submit", modelValue.value);
8856
+ };
8857
+ const handleKeydown = (_value, event) => {
8858
+ if (props.disabled) {
8859
+ event.preventDefault();
8860
+ return;
8861
+ }
8862
+ if (event.isComposing) {
8863
+ return;
8864
+ }
8865
+ if (event.which === 13 || event.key === "Enter") {
8866
+ if (oldInputText === modelValue.value) {
8867
+ return;
8868
+ }
8869
+ oldInputText = modelValue.value;
8870
+ event.preventDefault();
8871
+ validator(modelValue.value).then((result) => {
8872
+ if (result) {
8873
+ emits("submit", modelValue.value);
8874
+ }
8850
8875
  });
8851
8876
  }
8852
8877
  };
8853
- mount();
8878
+ const handlePaste = (_value, event) => {
8879
+ event.preventDefault();
8880
+ let paste = (event.clipboardData || window.clipboardData).getData("text");
8881
+ paste = encodeMult(paste);
8882
+ modelValue.value += paste.replace(/^\s+|\s+$/g, "");
8883
+ };
8884
+ __expose({
8885
+ getValue() {
8886
+ return validator(modelValue.value).then(() => modelValue.value);
8887
+ },
8888
+ focus() {
8889
+ var _a;
8890
+ (_a = rootRef.value.querySelector("input")) == null ? void 0 : _a.focus();
8891
+ }
8892
+ });
8893
+ return (_ctx, _cache) => {
8894
+ return openBlock(), createElementBlock(
8895
+ "div",
8896
+ {
8897
+ ref_key: "rootRef",
8898
+ ref: rootRef,
8899
+ class: normalizeClass(["bk-ediatable-input", {
8900
+ "is-error": Boolean(unref(errorMessage)),
8901
+ "is-disabled": _ctx.disabled,
8902
+ "is-password": isPassword.value
8903
+ }])
8904
+ },
8905
+ [
8906
+ createVNode(unref(Input), mergeProps({
8907
+ class: "input-box",
8908
+ disabled: _ctx.disabled,
8909
+ max: _ctx.max,
8910
+ min: _ctx.min,
8911
+ "model-value": modelValue.value,
8912
+ placeholder: _ctx.placeholder,
8913
+ type: _ctx.type
8914
+ }, _ctx.$attrs, {
8915
+ precision: _ctx.precision,
8916
+ onBlur: handleBlur,
8917
+ onChange: handleInput,
8918
+ onFocus: _cache[0] || (_cache[0] = () => isBlur.value = false),
8919
+ onInput: handleInput,
8920
+ onKeydown: handleKeydown,
8921
+ onPaste: handlePaste
8922
+ }), {
8923
+ suffix: withCtx(() => []),
8924
+ _: 1
8925
+ /* STABLE */
8926
+ }, 16, ["disabled", "max", "min", "model-value", "placeholder", "type", "precision"]),
8927
+ unref(errorMessage) ? withDirectives((openBlock(), createBlock(
8928
+ unref(DbIcon),
8929
+ {
8930
+ key: 0,
8931
+ class: "error-icon",
8932
+ type: "exclamation-fill"
8933
+ },
8934
+ null,
8935
+ 512
8936
+ /* NEED_PATCH */
8937
+ )), [
8938
+ [unref(vBkTooltips), unref(errorMessage)]
8939
+ ]) : createCommentVNode("v-if", true),
8940
+ _ctx.isShowBlur && isBlur.value ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
8941
+ renderSlot(_ctx.$slots, "blur")
8942
+ ])) : createCommentVNode("v-if", true)
8943
+ ],
8944
+ 2
8945
+ /* CLASS */
8946
+ );
8947
+ };
8948
+ }
8949
+ });
8950
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
8951
+ __name: "fixed-column",
8952
+ props: {
8953
+ fixed: { default: "right" }
8954
+ },
8955
+ setup(__props) {
8956
+ const props = __props;
8957
+ const { isOverflow: isFixed, isScrollToLeft, isScrollToRight } = inject(renderTablekey);
8958
+ const isFixedRight = computed(() => (isFixed == null ? void 0 : isFixed.value) && props.fixed === "right" && !isScrollToRight.value);
8959
+ const isFixedLeft = computed(() => (isFixed == null ? void 0 : isFixed.value) && props.fixed === "left" && !isScrollToLeft.value);
8960
+ return (_ctx, _cache) => {
8961
+ return openBlock(), createElementBlock(
8962
+ "td",
8963
+ {
8964
+ class: normalizeClass({
8965
+ "bk-ediatable-right-fixed-column": isFixedRight.value,
8966
+ "bk-ediatable-left-fixed-column": isFixedLeft.value
8967
+ })
8968
+ },
8969
+ [
8970
+ renderSlot(_ctx.$slots, "default")
8971
+ ],
8972
+ 2
8973
+ /* CLASS */
8974
+ );
8975
+ };
8976
+ }
8977
+ });
8978
+ const _hoisted_1$3 = { class: "bk-ediatable-operation" };
8979
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
8980
+ __name: "operation-column",
8981
+ props: {
8982
+ removeable: { type: Boolean, default: true },
8983
+ showCopy: { type: Boolean, default: false },
8984
+ showAdd: { type: Boolean, default: true },
8985
+ showRemove: { type: Boolean, default: true }
8986
+ },
8987
+ emits: ["add", "copy", "remove"],
8988
+ setup(__props, { emit: __emit }) {
8989
+ const props = __props;
8990
+ const emits = __emit;
8991
+ const handleCopy = () => {
8992
+ emits("copy");
8993
+ };
8994
+ const handleAppend = () => {
8995
+ emits("add");
8996
+ };
8997
+ const handleRemove = () => {
8998
+ if (props.removeable) {
8999
+ return;
9000
+ }
9001
+ emits("remove");
9002
+ };
9003
+ return (_ctx, _cache) => {
9004
+ return openBlock(), createBlock(_sfc_main$4, null, {
9005
+ default: withCtx(() => [
9006
+ createElementVNode("div", _hoisted_1$3, [
9007
+ _ctx.showCopy ? (openBlock(), createElementBlock("div", {
9008
+ key: 0,
9009
+ class: "action-btn",
9010
+ onClick: handleCopy
9011
+ }, [
9012
+ createVNode(unref(DbIcon), { type: "copy" })
9013
+ ])) : createCommentVNode("v-if", true),
9014
+ _ctx.showAdd ? (openBlock(), createElementBlock("div", {
9015
+ key: 1,
9016
+ class: "action-btn",
9017
+ onClick: handleAppend
9018
+ }, [
9019
+ createVNode(unref(DbIcon), { type: "plus-fill" })
9020
+ ])) : createCommentVNode("v-if", true),
9021
+ _ctx.showRemove ? (openBlock(), createElementBlock(
9022
+ "div",
9023
+ {
9024
+ key: 2,
9025
+ class: normalizeClass(["action-btn", {
9026
+ disabled: _ctx.removeable
9027
+ }]),
9028
+ onClick: handleRemove
9029
+ },
9030
+ [
9031
+ createVNode(unref(DbIcon), { type: "minus-fill" })
9032
+ ],
9033
+ 2
9034
+ /* CLASS */
9035
+ )) : createCommentVNode("v-if", true)
9036
+ ])
9037
+ ]),
9038
+ _: 1
9039
+ /* STABLE */
9040
+ });
9041
+ };
8854
9042
  }
8855
- function hide2() {
8856
- var isAlreadyHidden = !instance.state.isVisible;
8857
- var isDestroyed = instance.state.isDestroyed;
8858
- var isDisabled = !instance.state.isEnabled;
8859
- var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
8860
- if (isAlreadyHidden || isDestroyed || isDisabled) {
8861
- return;
8862
- }
8863
- invokeHook("onHide", [instance], false);
8864
- if (instance.props.onHide(instance) === false) {
8865
- return;
8866
- }
8867
- instance.state.isVisible = false;
8868
- instance.state.isShown = false;
8869
- ignoreOnFirstUpdate = false;
8870
- isVisibleFromClick = false;
8871
- if (getIsDefaultRenderFn()) {
8872
- popper2.style.visibility = "hidden";
8873
- }
8874
- cleanupInteractiveMouseListeners();
8875
- removeDocumentPress();
8876
- handleStyles(true);
8877
- if (getIsDefaultRenderFn()) {
8878
- var _getDefaultTemplateCh4 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh4.box, content = _getDefaultTemplateCh4.content;
8879
- if (instance.props.animation) {
8880
- setTransitionDuration([box, content], duration);
8881
- setVisibilityState([box, content], "hidden");
9043
+ });
9044
+ const _hoisted_1$2 = {
9045
+ key: 0,
9046
+ class: "select-error"
9047
+ };
9048
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
9049
+ __name: "select-column",
9050
+ props: /* @__PURE__ */ mergeModels({
9051
+ list: {},
9052
+ placeholder: { default: "请选择" },
9053
+ rules: { default: () => [] },
9054
+ disabled: { type: Boolean, default: false },
9055
+ multiple: { type: Boolean, default: false },
9056
+ showSelectAll: { type: Boolean, default: false }
9057
+ }, {
9058
+ "modelValue": {},
9059
+ "modelModifiers": {}
9060
+ }),
9061
+ emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
9062
+ setup(__props, { expose: __expose, emit: __emit }) {
9063
+ const { Option } = Select;
9064
+ const props = __props;
9065
+ const emits = __emit;
9066
+ const modelValue = useModel(__props, "modelValue");
9067
+ const rootRef = ref();
9068
+ const localValue = ref("");
9069
+ const rootHeight = ref(42);
9070
+ const { message: errorMessage, validator } = useValidtor(props.rules);
9071
+ const vBkTooltips = bkTooltips;
9072
+ watch(
9073
+ modelValue,
9074
+ (value) => {
9075
+ if (value === void 0) {
9076
+ return;
9077
+ }
9078
+ localValue.value = value;
9079
+ if (typeof value !== "object" && value) {
9080
+ validator(value);
9081
+ return;
9082
+ }
9083
+ if (Array.isArray(value) && value.length > 0) {
9084
+ validator(value);
9085
+ return;
9086
+ }
9087
+ },
9088
+ {
9089
+ immediate: true
8882
9090
  }
8883
- }
8884
- handleAriaContentAttribute();
8885
- handleAriaExpandedAttribute();
8886
- if (instance.props.animation) {
8887
- if (getIsDefaultRenderFn()) {
8888
- onTransitionedOut(duration, instance.unmount);
9091
+ );
9092
+ const handleSelect = (value) => {
9093
+ localValue.value = value;
9094
+ validator(localValue.value).then(() => {
9095
+ modelValue.value = value;
9096
+ emits("change", localValue.value);
9097
+ });
9098
+ };
9099
+ const handleRemove = () => {
9100
+ localValue.value = "";
9101
+ validator(localValue.value).then(() => {
9102
+ modelValue.value = localValue.value;
9103
+ emits("change", localValue.value);
9104
+ });
9105
+ };
9106
+ const checkRootHeight = () => {
9107
+ rootHeight.value = rootRef.value.parentNode.clientHeight;
9108
+ };
9109
+ useResizeObserver(rootRef, _.throttle(checkRootHeight, 500));
9110
+ __expose({
9111
+ getValue() {
9112
+ return validator(localValue.value).then(() => localValue.value);
8889
9113
  }
8890
- } else {
8891
- instance.unmount();
8892
- }
8893
- }
8894
- function hideWithInteractivity(event) {
8895
- getDocument().addEventListener("mousemove", debouncedOnMouseMove);
8896
- pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
8897
- debouncedOnMouseMove(event);
8898
- }
8899
- function unmount() {
8900
- if (instance.state.isVisible) {
8901
- instance.hide();
8902
- }
8903
- if (!instance.state.isMounted) {
8904
- return;
8905
- }
8906
- destroyPopperInstance();
8907
- getNestedPopperTree().forEach(function(nestedPopper) {
8908
- nestedPopper._tippy.unmount();
8909
- });
8910
- if (popper2.parentNode) {
8911
- popper2.parentNode.removeChild(popper2);
8912
- }
8913
- mountedInstances = mountedInstances.filter(function(i) {
8914
- return i !== instance;
8915
9114
  });
8916
- instance.state.isMounted = false;
8917
- invokeHook("onHidden", [instance]);
8918
- }
8919
- function destroy() {
8920
- if (instance.state.isDestroyed) {
8921
- return;
8922
- }
8923
- instance.clearDelayTimeouts();
8924
- instance.unmount();
8925
- removeListeners();
8926
- delete reference2._tippy;
8927
- instance.state.isDestroyed = true;
8928
- invokeHook("onDestroy", [instance]);
8929
- }
8930
- }
8931
- function tippy(targets, optionalProps) {
8932
- if (optionalProps === void 0) {
8933
- optionalProps = {};
8934
- }
8935
- var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
8936
- bindGlobalEventListeners();
8937
- var passedProps = Object.assign({}, optionalProps, {
8938
- plugins
8939
- });
8940
- var elements = getArrayOfElements(targets);
8941
- var instances = elements.reduce(function(acc, reference2) {
8942
- var instance = reference2 && createTippy(reference2, passedProps);
8943
- if (instance) {
8944
- acc.push(instance);
8945
- }
8946
- return acc;
8947
- }, []);
8948
- return isElement(targets) ? instances[0] : instances;
8949
- }
8950
- tippy.defaultProps = defaultProps;
8951
- tippy.setDefaultProps = setDefaultProps;
8952
- tippy.currentInput = currentInput;
8953
- Object.assign({}, applyStyles$1, {
8954
- effect: function effect2(_ref) {
8955
- var state = _ref.state;
8956
- var initialStyles = {
8957
- popper: {
8958
- position: state.options.strategy,
8959
- left: "0",
8960
- top: "0",
8961
- margin: "0"
8962
- },
8963
- arrow: {
8964
- position: "absolute"
8965
- },
8966
- reference: {}
9115
+ return (_ctx, _cache) => {
9116
+ return openBlock(), createElementBlock(
9117
+ "div",
9118
+ {
9119
+ ref_key: "rootRef",
9120
+ ref: rootRef,
9121
+ class: normalizeClass(["bk-ediatable-select", {
9122
+ "is-error": Boolean(unref(errorMessage)),
9123
+ "is-disable": _ctx.disabled
9124
+ }]),
9125
+ style: normalizeStyle({ height: rootHeight.value + "px" })
9126
+ },
9127
+ [
9128
+ createVNode(unref(Select), mergeProps(_ctx.$attrs, {
9129
+ "model-value": localValue.value,
9130
+ "auto-focus": "",
9131
+ class: "select-box",
9132
+ clearable: false,
9133
+ disabled: _ctx.disabled,
9134
+ filterable: "",
9135
+ "input-search": false,
9136
+ multiple: _ctx.multiple,
9137
+ placeholder: _ctx.placeholder,
9138
+ "show-select-all": _ctx.showSelectAll,
9139
+ onChange: handleSelect,
9140
+ onClear: handleRemove
9141
+ }), {
9142
+ default: withCtx(() => [
9143
+ (openBlock(true), createElementBlock(
9144
+ Fragment,
9145
+ null,
9146
+ renderList(_ctx.list, (item, index) => {
9147
+ return openBlock(), createBlock(unref(Option), {
9148
+ key: index,
9149
+ label: item.label,
9150
+ value: item.value
9151
+ }, null, 8, ["label", "value"]);
9152
+ }),
9153
+ 128
9154
+ /* KEYED_FRAGMENT */
9155
+ ))
9156
+ ]),
9157
+ _: 1
9158
+ /* STABLE */
9159
+ }, 16, ["model-value", "disabled", "multiple", "placeholder", "show-select-all"]),
9160
+ unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
9161
+ withDirectives(createVNode(
9162
+ unref(DbIcon),
9163
+ { type: "exclamation-fill" },
9164
+ null,
9165
+ 512
9166
+ /* NEED_PATCH */
9167
+ ), [
9168
+ [unref(vBkTooltips), unref(errorMessage)]
9169
+ ])
9170
+ ])) : createCommentVNode("v-if", true)
9171
+ ],
9172
+ 6
9173
+ /* CLASS, STYLE */
9174
+ );
8967
9175
  };
8968
- Object.assign(state.elements.popper.style, initialStyles.popper);
8969
- state.styles = initialStyles;
8970
- if (state.elements.arrow) {
8971
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
8972
- }
8973
9176
  }
8974
9177
  });
8975
- tippy.setDefaultProps({
8976
- render
8977
- });
8978
9178
  const _hoisted_1$1 = {
8979
9179
  key: 0,
8980
9180
  class: "input-error"
@@ -8984,7 +9184,7 @@ const _hoisted_2$1 = {
8984
9184
  style: { "display": "none" }
8985
9185
  };
8986
9186
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
8987
- __name: "tag-input",
9187
+ __name: "tag-input-column",
8988
9188
  props: /* @__PURE__ */ mergeModels({
8989
9189
  placeholder: { default: "" },
8990
9190
  single: { type: Boolean, default: false },
@@ -9003,6 +9203,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9003
9203
  const popRef = ref();
9004
9204
  const isFocus = ref(false);
9005
9205
  let tippyIns;
9206
+ const vBkTooltips = bkTooltips;
9006
9207
  const { message: errorMessage, validator } = useValidtor(props.rules);
9007
9208
  const tagInputPasteFn = (value) => value.split("\n").map((item) => ({ id: item }));
9008
9209
  const handleChange = (value) => {
@@ -9054,7 +9255,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9054
9255
  }
9055
9256
  });
9056
9257
  return (_ctx, _cache) => {
9057
- const _directive_bk_tooltips = resolveDirective("bk-tooltips");
9058
9258
  return openBlock(), createElementBlock(
9059
9259
  "div",
9060
9260
  {
@@ -9091,7 +9291,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9091
9291
  512
9092
9292
  /* NEED_PATCH */
9093
9293
  ), [
9094
- [_directive_bk_tooltips, unref(errorMessage)]
9294
+ [unref(vBkTooltips), unref(errorMessage)]
9095
9295
  ])
9096
9296
  ])) : createCommentVNode("v-if", true)
9097
9297
  ],
@@ -9122,17 +9322,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9122
9322
  });
9123
9323
  function useIsWidthOverflow(domRef, watchVariable) {
9124
9324
  const isOverflow = ref(false);
9125
- const checkOverflow = () => {
9325
+ const checkOverflow2 = () => {
9126
9326
  if (domRef.value) {
9127
9327
  isOverflow.value = domRef.value.clientWidth < domRef.value.scrollWidth;
9128
9328
  }
9129
9329
  };
9130
- useResizeObserver(domRef, checkOverflow);
9330
+ useResizeObserver(domRef, checkOverflow2);
9131
9331
  watch(
9132
9332
  watchVariable,
9133
9333
  () => {
9134
9334
  setTimeout(() => {
9135
- checkOverflow();
9335
+ checkOverflow2();
9136
9336
  });
9137
9337
  },
9138
9338
  {
@@ -9151,7 +9351,7 @@ const _hoisted_3 = {
9151
9351
  class: "input-error"
9152
9352
  };
9153
9353
  const _sfc_main = /* @__PURE__ */ defineComponent({
9154
- __name: "text-plain",
9354
+ __name: "text-plain-column",
9155
9355
  props: {
9156
9356
  data: {},
9157
9357
  isLoading: { type: Boolean },
@@ -9162,6 +9362,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9162
9362
  const props = __props;
9163
9363
  const textRef = ref();
9164
9364
  const renderData = computed(() => props.data);
9365
+ const vBkTooltips = bkTooltips;
9165
9366
  const { isOverflow } = useIsWidthOverflow(textRef, renderData);
9166
9367
  const { message: errorMessage, validator } = useValidtor(props.rules);
9167
9368
  __expose({
@@ -9170,7 +9371,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9170
9371
  }
9171
9372
  });
9172
9373
  return (_ctx, _cache) => {
9173
- const _directive_bk_tooltips = resolveDirective("bk-tooltips");
9174
9374
  return openBlock(), createBlock(unref(Loading), { loading: _ctx.isLoading }, {
9175
9375
  default: withCtx(() => [
9176
9376
  withDirectives((openBlock(), createElementBlock(
@@ -9205,7 +9405,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9205
9405
  512
9206
9406
  /* NEED_PATCH */
9207
9407
  ), [
9208
- [_directive_bk_tooltips, unref(errorMessage)]
9408
+ [unref(vBkTooltips), unref(errorMessage)]
9209
9409
  ])
9210
9410
  ])) : createCommentVNode("v-if", true),
9211
9411
  renderSlot(_ctx.$slots, "default")
@@ -9213,7 +9413,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9213
9413
  2
9214
9414
  /* CLASS */
9215
9415
  )), [
9216
- [_directive_bk_tooltips, {
9416
+ [unref(vBkTooltips), {
9217
9417
  content: _ctx.data || _ctx.placeholder,
9218
9418
  disabled: !unref(isOverflow)
9219
9419
  }]
@@ -9226,14 +9426,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9226
9426
  }
9227
9427
  });
9228
9428
  export {
9229
- _sfc_main$7 as DateTimePickerColumn,
9230
- _sfc_main$8 as Ediatable,
9231
- _sfc_main$5 as FixedColumn,
9232
- _sfc_main$4 as HeadColumn,
9233
- _sfc_main$6 as InputColumn,
9429
+ _sfc_main$6 as DateTimePickerColumn,
9430
+ _sfc_main$7 as Ediatable,
9431
+ _sfc_main$4 as FixedColumn,
9432
+ _sfc_main$8 as HeadColumn,
9433
+ _sfc_main$5 as InputColumn,
9234
9434
  _sfc_main$3 as OperationColumn,
9235
9435
  _sfc_main$2 as SelectColumn,
9236
9436
  _sfc_main$1 as TagInputColumn,
9237
9437
  _sfc_main as TextPlainColumn,
9238
- _sfc_main$8 as default
9438
+ _sfc_main$7 as default
9239
9439
  };