@blueking/ediatable 0.0.1-beta.8 → 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.
- package/README.md +11 -17
- package/package.json +1 -1
- package/typings/components/head-column.vue.d.ts +1 -1
- package/vue2/index.es.min.js +1085 -917
- package/vue2/index.iife.min.js +1085 -4174
- package/vue2/index.umd.min.js +1085 -4175
- package/vue2/vue2.css +151 -128
- package/vue3/index.es.min.js +1785 -1618
- package/vue3/index.iife.min.js +1085 -4174
- package/vue3/index.umd.min.js +1798 -1606
- package/vue3/vue3.css +68 -44
package/vue3/index.es.min.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ref, provide, onMounted, onBeforeUnmount, getCurrentScope, onScopeDispose, unref, computed, watch, getCurrentInstance, defineComponent, useSlots, inject,
|
|
2
|
-
import "bkui-vue
|
|
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
|
-
|
|
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,1049 +5628,175 @@ function useColumnResize(tableRef, tableColumnResizeRef, mouseupCallback) {
|
|
|
5623
5628
|
handleMouseMove
|
|
5624
5629
|
};
|
|
5625
5630
|
}
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
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;
|
|
5636
5665
|
}
|
|
5637
|
-
|
|
5666
|
+
if (node.toString() !== "[object Window]") {
|
|
5667
|
+
var ownerDocument = node.ownerDocument;
|
|
5668
|
+
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
5669
|
+
}
|
|
5670
|
+
return node;
|
|
5638
5671
|
}
|
|
5639
|
-
function
|
|
5640
|
-
|
|
5672
|
+
function isElement$1(node) {
|
|
5673
|
+
var OwnElement = getWindow(node).Element;
|
|
5674
|
+
return node instanceof OwnElement || node instanceof Element;
|
|
5641
5675
|
}
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
var _a;
|
|
5646
|
-
const plain = toValue(elRef);
|
|
5647
|
-
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
5676
|
+
function isHTMLElement(node) {
|
|
5677
|
+
var OwnElement = getWindow(node).HTMLElement;
|
|
5678
|
+
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
5648
5679
|
}
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
const instance = getCurrentInstance();
|
|
5653
|
-
if (instance) {
|
|
5654
|
-
onMounted(() => {
|
|
5655
|
-
isMounted.value = true;
|
|
5656
|
-
}, instance);
|
|
5680
|
+
function isShadowRoot(node) {
|
|
5681
|
+
if (typeof ShadowRoot === "undefined") {
|
|
5682
|
+
return false;
|
|
5657
5683
|
}
|
|
5658
|
-
|
|
5684
|
+
var OwnElement = getWindow(node).ShadowRoot;
|
|
5685
|
+
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
5659
5686
|
}
|
|
5660
|
-
function
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
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;
|
|
5695
|
+
}
|
|
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
|
+
}
|
|
5704
|
+
});
|
|
5665
5705
|
});
|
|
5666
5706
|
}
|
|
5667
|
-
function
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
}
|
|
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: {}
|
|
5676
5720
|
};
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
(
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
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);
|
|
5725
|
+
}
|
|
5726
|
+
return function() {
|
|
5727
|
+
Object.keys(state.elements).forEach(function(name) {
|
|
5728
|
+
var element = state.elements[name];
|
|
5729
|
+
var attributes = state.attributes[name] || {};
|
|
5730
|
+
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
|
|
5731
|
+
var style = styleProperties.reduce(function(style2, property) {
|
|
5732
|
+
style2[property] = "";
|
|
5733
|
+
return style2;
|
|
5734
|
+
}, {});
|
|
5735
|
+
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
5736
|
+
return;
|
|
5686
5737
|
}
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
stopWatch();
|
|
5738
|
+
Object.assign(element.style, style);
|
|
5739
|
+
Object.keys(attributes).forEach(function(attribute) {
|
|
5740
|
+
element.removeAttribute(attribute);
|
|
5741
|
+
});
|
|
5742
|
+
});
|
|
5693
5743
|
};
|
|
5694
|
-
|
|
5744
|
+
}
|
|
5745
|
+
const applyStyles$1 = {
|
|
5746
|
+
name: "applyStyles",
|
|
5747
|
+
enabled: true,
|
|
5748
|
+
phase: "write",
|
|
5749
|
+
fn: applyStyles,
|
|
5750
|
+
effect: effect$2,
|
|
5751
|
+
requires: ["computeStyles"]
|
|
5752
|
+
};
|
|
5753
|
+
function getBasePlacement$1(placement) {
|
|
5754
|
+
return placement.split("-")[0];
|
|
5755
|
+
}
|
|
5756
|
+
var max = Math.max;
|
|
5757
|
+
var min = Math.min;
|
|
5758
|
+
var round = Math.round;
|
|
5759
|
+
function getUAString() {
|
|
5760
|
+
var uaData = navigator.userAgentData;
|
|
5761
|
+
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
|
5762
|
+
return uaData.brands.map(function(item) {
|
|
5763
|
+
return item.brand + "/" + item.version;
|
|
5764
|
+
}).join(" ");
|
|
5765
|
+
}
|
|
5766
|
+
return navigator.userAgent;
|
|
5767
|
+
}
|
|
5768
|
+
function isLayoutViewport() {
|
|
5769
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
5770
|
+
}
|
|
5771
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
5772
|
+
if (includeScale === void 0) {
|
|
5773
|
+
includeScale = false;
|
|
5774
|
+
}
|
|
5775
|
+
if (isFixedStrategy === void 0) {
|
|
5776
|
+
isFixedStrategy = false;
|
|
5777
|
+
}
|
|
5778
|
+
var clientRect = element.getBoundingClientRect();
|
|
5779
|
+
var scaleX = 1;
|
|
5780
|
+
var scaleY = 1;
|
|
5781
|
+
if (includeScale && isHTMLElement(element)) {
|
|
5782
|
+
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
5783
|
+
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
5784
|
+
}
|
|
5785
|
+
var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
|
|
5786
|
+
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
5787
|
+
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
|
5788
|
+
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
|
5789
|
+
var width = clientRect.width / scaleX;
|
|
5790
|
+
var height = clientRect.height / scaleY;
|
|
5695
5791
|
return {
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
__name: "head-column",
|
|
5705
|
-
props: {
|
|
5706
|
-
fixed: { default: void 0 },
|
|
5707
|
-
maxWidth: { default: void 0 },
|
|
5708
|
-
minWidth: { default: void 0 },
|
|
5709
|
-
required: { type: Boolean, default: true },
|
|
5710
|
-
width: { default: void 0 },
|
|
5711
|
-
renderAppend: { type: Function, default: void 0 },
|
|
5712
|
-
memo: { default: void 0 }
|
|
5713
|
-
},
|
|
5714
|
-
setup(__props) {
|
|
5715
|
-
const props = __props;
|
|
5716
|
-
const slots = useSlots();
|
|
5717
|
-
const { rowWidth, isOverflow: isMinimize } = inject(renderTablekey);
|
|
5718
|
-
const parentTable = inject(tableColumnResizekey);
|
|
5719
|
-
const columnRef = ref();
|
|
5720
|
-
const currentWidth = ref(0);
|
|
5721
|
-
const columnKey = random();
|
|
5722
|
-
let initWidthRate = 0;
|
|
5723
|
-
let isDragedSelf = false;
|
|
5724
|
-
const finalMinWidth = computed(() => props.minWidth ? props.minWidth : props.width ?? 100);
|
|
5725
|
-
const isFixedRight = computed(() => props.fixed === "right");
|
|
5726
|
-
const isFixedLeft = computed(() => props.fixed === "left");
|
|
5727
|
-
const styles = computed(() => {
|
|
5728
|
-
if (props.width && (rowWidth == null ? void 0 : rowWidth.value) && finalMinWidth.value) {
|
|
5729
|
-
const newWidth = rowWidth.value * initWidthRate;
|
|
5730
|
-
if (newWidth !== props.width) {
|
|
5731
|
-
let width = 0;
|
|
5732
|
-
if (isMinimize == null ? void 0 : isMinimize.value) {
|
|
5733
|
-
if (currentWidth.value !== 0 && (currentWidth.value !== finalMinWidth.value || currentWidth.value !== props.width)) {
|
|
5734
|
-
width = currentWidth.value;
|
|
5735
|
-
} else {
|
|
5736
|
-
width = finalMinWidth.value;
|
|
5737
|
-
}
|
|
5738
|
-
} else if (newWidth > finalMinWidth.value) {
|
|
5739
|
-
width = newWidth;
|
|
5740
|
-
} else {
|
|
5741
|
-
width = finalMinWidth.value;
|
|
5742
|
-
}
|
|
5743
|
-
return {
|
|
5744
|
-
minWidth: `${width}px`
|
|
5745
|
-
};
|
|
5746
|
-
}
|
|
5747
|
-
}
|
|
5748
|
-
return {
|
|
5749
|
-
minWidth: props.width ? `${props.width}px` : "120px"
|
|
5750
|
-
};
|
|
5751
|
-
});
|
|
5752
|
-
const RenderAppendElement = computed(() => props.renderAppend && props.renderAppend());
|
|
5753
|
-
watch(
|
|
5754
|
-
() => [props.width, rowWidth == null ? void 0 : rowWidth.value, currentWidth.value],
|
|
5755
|
-
([width, rowWidth2, currentWidth2]) => {
|
|
5756
|
-
if (!isDragedSelf) {
|
|
5757
|
-
return;
|
|
5758
|
-
}
|
|
5759
|
-
if (width && rowWidth2 && currentWidth2 && finalMinWidth.value) {
|
|
5760
|
-
isDragedSelf = false;
|
|
5761
|
-
if (currentWidth2 !== 0 && (currentWidth2 !== finalMinWidth.value || currentWidth2 !== width)) {
|
|
5762
|
-
initWidthRate = currentWidth2 / rowWidth2;
|
|
5763
|
-
} else {
|
|
5764
|
-
initWidthRate = (isMinimize == null ? void 0 : isMinimize.value) ? finalMinWidth.value / rowWidth2 : width / rowWidth2;
|
|
5765
|
-
}
|
|
5766
|
-
}
|
|
5767
|
-
},
|
|
5768
|
-
{
|
|
5769
|
-
immediate: true
|
|
5770
|
-
}
|
|
5771
|
-
);
|
|
5772
|
-
useResizeObserver(columnRef, () => {
|
|
5773
|
-
if (!isDragedSelf) {
|
|
5774
|
-
return;
|
|
5775
|
-
}
|
|
5776
|
-
const width = parseFloat(columnRef.value.style.width);
|
|
5777
|
-
currentWidth.value = width;
|
|
5778
|
-
});
|
|
5779
|
-
const handleMouseDown = (event) => {
|
|
5780
|
-
isDragedSelf = true;
|
|
5781
|
-
parentTable == null ? void 0 : parentTable.columnMousedown(event, {
|
|
5782
|
-
columnKey,
|
|
5783
|
-
minWidth: finalMinWidth.value
|
|
5784
|
-
});
|
|
5785
|
-
};
|
|
5786
|
-
const handleMouseMove = (event) => {
|
|
5787
|
-
parentTable == null ? void 0 : parentTable.columnMouseMove(event);
|
|
5788
|
-
};
|
|
5789
|
-
return (_ctx, _cache) => {
|
|
5790
|
-
const _directive_overflow_tips = resolveDirective("overflow-tips");
|
|
5791
|
-
const _directive_bk_tooltips = resolveDirective("bk-tooltips");
|
|
5792
|
-
return openBlock(), createElementBlock("th", {
|
|
5793
|
-
ref_key: "columnRef",
|
|
5794
|
-
ref: columnRef,
|
|
5795
|
-
class: normalizeClass(["bk-ediatable-head-column", {
|
|
5796
|
-
"is-required": _ctx.required,
|
|
5797
|
-
[`column-${unref(columnKey)}`]: true,
|
|
5798
|
-
"is-right-fixed": unref(isMinimize) && isFixedRight.value,
|
|
5799
|
-
"is-left-fixed": unref(isMinimize) && isFixedLeft.value
|
|
5800
|
-
}]),
|
|
5801
|
-
"data-fixed": _ctx.fixed,
|
|
5802
|
-
"data-maxWidth": _ctx.maxWidth,
|
|
5803
|
-
"data-minWidth": finalMinWidth.value,
|
|
5804
|
-
"data-width": _ctx.width,
|
|
5805
|
-
style: normalizeStyle(styles.value),
|
|
5806
|
-
onMousedown: handleMouseDown,
|
|
5807
|
-
onMousemove: handleMouseMove
|
|
5808
|
-
}, [
|
|
5809
|
-
withDirectives((openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
5810
|
-
createElementVNode(
|
|
5811
|
-
"span",
|
|
5812
|
-
{
|
|
5813
|
-
class: normalizeClass({ "title-memo": _ctx.memo })
|
|
5814
|
-
},
|
|
5815
|
-
[
|
|
5816
|
-
renderSlot(_ctx.$slots, "default")
|
|
5817
|
-
],
|
|
5818
|
-
2
|
|
5819
|
-
/* CLASS */
|
|
5820
|
-
)
|
|
5821
|
-
])), [
|
|
5822
|
-
[_directive_overflow_tips],
|
|
5823
|
-
[_directive_bk_tooltips, {
|
|
5824
|
-
content: _ctx.memo,
|
|
5825
|
-
disabled: !_ctx.memo
|
|
5826
|
-
}]
|
|
5827
|
-
]),
|
|
5828
|
-
createElementVNode("div", _hoisted_3$1, [
|
|
5829
|
-
slots.append && !_ctx.renderAppend ? renderSlot(_ctx.$slots, "append", { key: 0 }) : createCommentVNode("v-if", true),
|
|
5830
|
-
_ctx.renderAppend ? (openBlock(), createBlock(unref(RenderAppendElement), { key: 1 })) : createCommentVNode("v-if", true)
|
|
5831
|
-
])
|
|
5832
|
-
], 46, _hoisted_1$6);
|
|
5833
|
-
};
|
|
5834
|
-
}
|
|
5835
|
-
});
|
|
5836
|
-
const renderTablekey = Symbol("renderTable");
|
|
5837
|
-
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
5838
|
-
__name: "ediatable",
|
|
5839
|
-
props: {
|
|
5840
|
-
theadList: { default: () => [] }
|
|
5841
|
-
},
|
|
5842
|
-
setup(__props) {
|
|
5843
|
-
const slots = useSlots();
|
|
5844
|
-
const checkTableScroll = () => {
|
|
5845
|
-
rowWidth.value = tableRef.value.clientWidth;
|
|
5846
|
-
isOverflow.value = tableOuterRef.value.clientWidth < tableRef.value.clientWidth;
|
|
5847
|
-
initColumnWidth();
|
|
5848
|
-
};
|
|
5849
|
-
const tableOuterRef = ref();
|
|
5850
|
-
const tableRef = ref();
|
|
5851
|
-
const tableColumnResizeRef = ref();
|
|
5852
|
-
const isOverflow = ref(false);
|
|
5853
|
-
const rowWidth = ref(0);
|
|
5854
|
-
const { initColumnWidth } = useColumnResize(tableOuterRef, tableColumnResizeRef, _.debounce(checkTableScroll));
|
|
5855
|
-
provide(renderTablekey, {
|
|
5856
|
-
isOverflow,
|
|
5857
|
-
rowWidth
|
|
5858
|
-
});
|
|
5859
|
-
onMounted(() => {
|
|
5860
|
-
window.addEventListener("resize", checkTableScroll);
|
|
5861
|
-
checkTableScroll();
|
|
5862
|
-
setTimeout(() => checkTableScroll());
|
|
5863
|
-
});
|
|
5864
|
-
onBeforeUnmount(() => window.removeEventListener("resize", checkTableScroll));
|
|
5865
|
-
return (_ctx, _cache) => {
|
|
5866
|
-
return openBlock(), createElementBlock(
|
|
5867
|
-
"div",
|
|
5868
|
-
{
|
|
5869
|
-
id: "ediatableRenderTableKey",
|
|
5870
|
-
ref_key: "tableOuterRef",
|
|
5871
|
-
ref: tableOuterRef,
|
|
5872
|
-
class: "bk-ediatable"
|
|
5873
|
-
},
|
|
5874
|
-
[
|
|
5875
|
-
createElementVNode(
|
|
5876
|
-
"table",
|
|
5877
|
-
{
|
|
5878
|
-
ref_key: "tableRef",
|
|
5879
|
-
ref: tableRef
|
|
5880
|
-
},
|
|
5881
|
-
[
|
|
5882
|
-
createElementVNode("thead", null, [
|
|
5883
|
-
createElementVNode("tr", null, [
|
|
5884
|
-
slots.default && _ctx.theadList.length === 0 ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(true), createElementBlock(
|
|
5885
|
-
Fragment,
|
|
5886
|
-
{ key: 1 },
|
|
5887
|
-
renderList(_ctx.theadList, (head, index) => {
|
|
5888
|
-
return openBlock(), createBlock(_sfc_main$8, {
|
|
5889
|
-
key: index,
|
|
5890
|
-
width: head.width,
|
|
5891
|
-
"min-width": head.minWidth,
|
|
5892
|
-
"max-width": head.maxWidth,
|
|
5893
|
-
fixed: head.fixed,
|
|
5894
|
-
required: head.required,
|
|
5895
|
-
"render-append": head.renderAppend,
|
|
5896
|
-
memo: head.memo
|
|
5897
|
-
}, {
|
|
5898
|
-
default: withCtx(() => [
|
|
5899
|
-
createTextVNode(
|
|
5900
|
-
toDisplayString(head.title),
|
|
5901
|
-
1
|
|
5902
|
-
/* TEXT */
|
|
5903
|
-
)
|
|
5904
|
-
]),
|
|
5905
|
-
_: 2
|
|
5906
|
-
/* DYNAMIC */
|
|
5907
|
-
}, 1032, ["width", "min-width", "max-width", "fixed", "required", "render-append", "memo"]);
|
|
5908
|
-
}),
|
|
5909
|
-
128
|
|
5910
|
-
/* KEYED_FRAGMENT */
|
|
5911
|
-
))
|
|
5912
|
-
])
|
|
5913
|
-
]),
|
|
5914
|
-
createElementVNode("tbody", null, [
|
|
5915
|
-
renderSlot(_ctx.$slots, "data")
|
|
5916
|
-
])
|
|
5917
|
-
],
|
|
5918
|
-
512
|
|
5919
|
-
/* NEED_PATCH */
|
|
5920
|
-
),
|
|
5921
|
-
createElementVNode(
|
|
5922
|
-
"div",
|
|
5923
|
-
{
|
|
5924
|
-
ref_key: "tableColumnResizeRef",
|
|
5925
|
-
ref: tableColumnResizeRef,
|
|
5926
|
-
class: "table-column-resize"
|
|
5927
|
-
},
|
|
5928
|
-
null,
|
|
5929
|
-
512
|
|
5930
|
-
/* NEED_PATCH */
|
|
5931
|
-
)
|
|
5932
|
-
],
|
|
5933
|
-
512
|
|
5934
|
-
/* NEED_PATCH */
|
|
5935
|
-
);
|
|
5936
|
-
};
|
|
5937
|
-
}
|
|
5938
|
-
});
|
|
5939
|
-
const getRuleMessage = (rule) => {
|
|
5940
|
-
if (typeof rule.message === "function") {
|
|
5941
|
-
return rule.message();
|
|
5942
|
-
}
|
|
5943
|
-
return rule.message;
|
|
5944
|
-
};
|
|
5945
|
-
function useValidtor(rules) {
|
|
5946
|
-
const state = reactive({
|
|
5947
|
-
loading: false,
|
|
5948
|
-
error: false,
|
|
5949
|
-
message: ""
|
|
5950
|
-
});
|
|
5951
|
-
const validator = (targetValue) => {
|
|
5952
|
-
state.error = false, state.message = "";
|
|
5953
|
-
if (!rules) {
|
|
5954
|
-
return Promise.resolve(true);
|
|
5955
|
-
}
|
|
5956
|
-
const run = /* @__PURE__ */ (() => {
|
|
5957
|
-
let stepIndex = -1;
|
|
5958
|
-
return async () => {
|
|
5959
|
-
stepIndex = stepIndex + 1;
|
|
5960
|
-
if (stepIndex >= rules.length) {
|
|
5961
|
-
return Promise.resolve(true);
|
|
5962
|
-
}
|
|
5963
|
-
const rule = rules[stepIndex];
|
|
5964
|
-
return Promise.resolve().then(() => {
|
|
5965
|
-
const result = rule.validator(targetValue);
|
|
5966
|
-
if (typeof result !== "boolean" && typeof result.then === "function") {
|
|
5967
|
-
return result.then((data) => {
|
|
5968
|
-
if (data === false) {
|
|
5969
|
-
return Promise.reject(getRuleMessage(rule));
|
|
5970
|
-
}
|
|
5971
|
-
}).then(() => run(), () => {
|
|
5972
|
-
state.error = true;
|
|
5973
|
-
const message = getRuleMessage(rule);
|
|
5974
|
-
state.message = message;
|
|
5975
|
-
return Promise.reject(message);
|
|
5976
|
-
});
|
|
5977
|
-
}
|
|
5978
|
-
if (!result) {
|
|
5979
|
-
state.error = true;
|
|
5980
|
-
const message = getRuleMessage(rule);
|
|
5981
|
-
state.message = message;
|
|
5982
|
-
return Promise.reject(message);
|
|
5983
|
-
}
|
|
5984
|
-
return run();
|
|
5985
|
-
});
|
|
5986
|
-
};
|
|
5987
|
-
})();
|
|
5988
|
-
return run();
|
|
5989
|
-
};
|
|
5990
|
-
return {
|
|
5991
|
-
...toRefs(state),
|
|
5992
|
-
validator
|
|
5993
|
-
};
|
|
5994
|
-
}
|
|
5995
|
-
const DbIcon = defineComponent({
|
|
5996
|
-
name: "DbIcon",
|
|
5997
|
-
props: {
|
|
5998
|
-
type: {
|
|
5999
|
-
type: String,
|
|
6000
|
-
required: true
|
|
6001
|
-
},
|
|
6002
|
-
svg: {
|
|
6003
|
-
type: Boolean,
|
|
6004
|
-
default: false
|
|
6005
|
-
}
|
|
6006
|
-
},
|
|
6007
|
-
render() {
|
|
6008
|
-
if (this.svg) {
|
|
6009
|
-
return h(
|
|
6010
|
-
"svg",
|
|
6011
|
-
{
|
|
6012
|
-
class: {
|
|
6013
|
-
"db-svg-icon": true
|
|
6014
|
-
}
|
|
6015
|
-
},
|
|
6016
|
-
[
|
|
6017
|
-
h("use", {
|
|
6018
|
-
"xlink:href": `#db-icon-${this.type}`
|
|
6019
|
-
})
|
|
6020
|
-
]
|
|
6021
|
-
);
|
|
6022
|
-
}
|
|
6023
|
-
const classes = {
|
|
6024
|
-
"ediatable-icon": true,
|
|
6025
|
-
[`icon-${this.type}`]: true
|
|
6026
|
-
};
|
|
6027
|
-
return h("i", {
|
|
6028
|
-
class: classes
|
|
6029
|
-
});
|
|
6030
|
-
}
|
|
6031
|
-
});
|
|
6032
|
-
const _hoisted_1$5 = {
|
|
6033
|
-
key: 0,
|
|
6034
|
-
class: "input-error"
|
|
6035
|
-
};
|
|
6036
|
-
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
6037
|
-
__name: "date-time-picker-column",
|
|
6038
|
-
props: /* @__PURE__ */ mergeModels({
|
|
6039
|
-
placeholder: { default: "" },
|
|
6040
|
-
rules: { default: void 0 },
|
|
6041
|
-
type: { default: void 0 },
|
|
6042
|
-
disabled: { type: Boolean, default: false }
|
|
6043
|
-
}, {
|
|
6044
|
-
"modelValue": {},
|
|
6045
|
-
"modelModifiers": {}
|
|
6046
|
-
}),
|
|
6047
|
-
emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
|
|
6048
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6049
|
-
const props = __props;
|
|
6050
|
-
const emits = __emit;
|
|
6051
|
-
const modelValue = useModel(__props, "modelValue");
|
|
6052
|
-
const attrs = useAttrs();
|
|
6053
|
-
const slots = useSlots();
|
|
6054
|
-
const { message: errorMessage, validator } = useValidtor(props.rules);
|
|
6055
|
-
const handleChange = (value) => {
|
|
6056
|
-
modelValue.value = value;
|
|
6057
|
-
validator(modelValue.value).then(() => {
|
|
6058
|
-
emits("change", modelValue.value);
|
|
6059
|
-
});
|
|
6060
|
-
};
|
|
6061
|
-
const handleOpenChange = (open) => {
|
|
6062
|
-
if (!open) {
|
|
6063
|
-
validator(modelValue.value);
|
|
6064
|
-
}
|
|
6065
|
-
};
|
|
6066
|
-
__expose({
|
|
6067
|
-
getValue() {
|
|
6068
|
-
return validator(modelValue.value).then(() => modelValue.value);
|
|
6069
|
-
}
|
|
6070
|
-
});
|
|
6071
|
-
return (_ctx, _cache) => {
|
|
6072
|
-
const _directive_bk_tooltips = resolveDirective("bk-tooltips");
|
|
6073
|
-
return openBlock(), createElementBlock(
|
|
6074
|
-
"div",
|
|
6075
|
-
{
|
|
6076
|
-
class: normalizeClass(["bk-ediatable-time-picker", {
|
|
6077
|
-
"is-error": Boolean(unref(errorMessage)),
|
|
6078
|
-
"is-disabled": _ctx.disabled
|
|
6079
|
-
}])
|
|
6080
|
-
},
|
|
6081
|
-
[
|
|
6082
|
-
createVNode(unref(DatePicker), mergeProps({
|
|
6083
|
-
"append-to-body": "",
|
|
6084
|
-
clearable: false,
|
|
6085
|
-
"model-value": modelValue.value,
|
|
6086
|
-
placeholder: _ctx.placeholder,
|
|
6087
|
-
style: { "width": "100%" },
|
|
6088
|
-
type: _ctx.type
|
|
6089
|
-
}, unref(attrs), {
|
|
6090
|
-
onChange: handleChange,
|
|
6091
|
-
onOpenChange: handleOpenChange
|
|
6092
|
-
}), createSlots({
|
|
6093
|
-
_: 2
|
|
6094
|
-
/* DYNAMIC */
|
|
6095
|
-
}, [
|
|
6096
|
-
unref(slots).footer ? {
|
|
6097
|
-
name: "footer",
|
|
6098
|
-
fn: withCtx(() => [
|
|
6099
|
-
renderSlot(_ctx.$slots, "footer")
|
|
6100
|
-
]),
|
|
6101
|
-
key: "0"
|
|
6102
|
-
} : void 0
|
|
6103
|
-
]), 1040, ["model-value", "placeholder", "type"]),
|
|
6104
|
-
unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
6105
|
-
withDirectives(createVNode(
|
|
6106
|
-
unref(DbIcon),
|
|
6107
|
-
{ type: "exclamation-fill" },
|
|
6108
|
-
null,
|
|
6109
|
-
512
|
|
6110
|
-
/* NEED_PATCH */
|
|
6111
|
-
), [
|
|
6112
|
-
[_directive_bk_tooltips, unref(errorMessage)]
|
|
6113
|
-
])
|
|
6114
|
-
])) : createCommentVNode("v-if", true)
|
|
6115
|
-
],
|
|
6116
|
-
2
|
|
6117
|
-
/* CLASS */
|
|
6118
|
-
);
|
|
6119
|
-
};
|
|
6120
|
-
}
|
|
6121
|
-
});
|
|
6122
|
-
const _hoisted_1$4 = {
|
|
6123
|
-
key: 1,
|
|
6124
|
-
class: "blur-dispaly-main"
|
|
6125
|
-
};
|
|
6126
|
-
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
6127
|
-
__name: "input-column",
|
|
6128
|
-
props: /* @__PURE__ */ mergeModels({
|
|
6129
|
-
placeholder: { default: "请输入" },
|
|
6130
|
-
rules: { default: void 0 },
|
|
6131
|
-
disabled: { type: Boolean, default: false },
|
|
6132
|
-
type: { default: "text" },
|
|
6133
|
-
min: { default: Number.MIN_SAFE_INTEGER },
|
|
6134
|
-
max: { default: Number.MAX_SAFE_INTEGER },
|
|
6135
|
-
isShowBlur: { type: Boolean, default: false },
|
|
6136
|
-
precision: { default: 0 }
|
|
6137
|
-
}, {
|
|
6138
|
-
"modelValue": {
|
|
6139
|
-
default: ""
|
|
6140
|
-
},
|
|
6141
|
-
"modelModifiers": {}
|
|
6142
|
-
}),
|
|
6143
|
-
emits: /* @__PURE__ */ mergeModels(["submit"], ["update:modelValue"]),
|
|
6144
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6145
|
-
const props = __props;
|
|
6146
|
-
const emits = __emit;
|
|
6147
|
-
const modelValue = useModel(__props, "modelValue");
|
|
6148
|
-
const rootRef = ref();
|
|
6149
|
-
const isBlur = ref(true);
|
|
6150
|
-
const isPassword = computed(() => props.type === "password");
|
|
6151
|
-
let oldInputText = "";
|
|
6152
|
-
const {
|
|
6153
|
-
message: errorMessage,
|
|
6154
|
-
validator
|
|
6155
|
-
} = useValidtor(props.rules);
|
|
6156
|
-
const handleInput = (value) => {
|
|
6157
|
-
isBlur.value = false;
|
|
6158
|
-
modelValue.value = value;
|
|
6159
|
-
};
|
|
6160
|
-
const handleBlur = (event) => {
|
|
6161
|
-
isBlur.value = true;
|
|
6162
|
-
if (props.disabled) {
|
|
6163
|
-
event.preventDefault();
|
|
6164
|
-
return;
|
|
6165
|
-
}
|
|
6166
|
-
if (modelValue.value) {
|
|
6167
|
-
if (oldInputText === modelValue.value) {
|
|
6168
|
-
return;
|
|
6169
|
-
}
|
|
6170
|
-
oldInputText = modelValue.value;
|
|
6171
|
-
validator(modelValue.value).then(() => {
|
|
6172
|
-
emits("submit", modelValue.value);
|
|
6173
|
-
});
|
|
6174
|
-
return;
|
|
6175
|
-
}
|
|
6176
|
-
emits("submit", modelValue.value);
|
|
6177
|
-
};
|
|
6178
|
-
const handleKeydown = (_value, event) => {
|
|
6179
|
-
if (props.disabled) {
|
|
6180
|
-
event.preventDefault();
|
|
6181
|
-
return;
|
|
6182
|
-
}
|
|
6183
|
-
if (event.isComposing) {
|
|
6184
|
-
return;
|
|
6185
|
-
}
|
|
6186
|
-
if (event.which === 13 || event.key === "Enter") {
|
|
6187
|
-
if (oldInputText === modelValue.value) {
|
|
6188
|
-
return;
|
|
6189
|
-
}
|
|
6190
|
-
oldInputText = modelValue.value;
|
|
6191
|
-
event.preventDefault();
|
|
6192
|
-
validator(modelValue.value).then((result) => {
|
|
6193
|
-
if (result) {
|
|
6194
|
-
emits("submit", modelValue.value);
|
|
6195
|
-
}
|
|
6196
|
-
});
|
|
6197
|
-
}
|
|
6198
|
-
};
|
|
6199
|
-
const handlePaste = (_value, event) => {
|
|
6200
|
-
event.preventDefault();
|
|
6201
|
-
let paste = (event.clipboardData || window.clipboardData).getData("text");
|
|
6202
|
-
paste = encodeMult(paste);
|
|
6203
|
-
modelValue.value += paste.replace(/^\s+|\s+$/g, "");
|
|
6204
|
-
};
|
|
6205
|
-
__expose({
|
|
6206
|
-
getValue() {
|
|
6207
|
-
return validator(modelValue.value).then(() => modelValue.value);
|
|
6208
|
-
},
|
|
6209
|
-
focus() {
|
|
6210
|
-
var _a;
|
|
6211
|
-
(_a = rootRef.value.querySelector("input")) == null ? void 0 : _a.focus();
|
|
6212
|
-
}
|
|
6213
|
-
});
|
|
6214
|
-
return (_ctx, _cache) => {
|
|
6215
|
-
const _directive_bk_tooltips = resolveDirective("bk-tooltips");
|
|
6216
|
-
return openBlock(), createElementBlock(
|
|
6217
|
-
"div",
|
|
6218
|
-
{
|
|
6219
|
-
ref_key: "rootRef",
|
|
6220
|
-
ref: rootRef,
|
|
6221
|
-
class: normalizeClass(["bk-ediatable-input", {
|
|
6222
|
-
"is-error": Boolean(unref(errorMessage)),
|
|
6223
|
-
"is-disabled": _ctx.disabled,
|
|
6224
|
-
"is-password": isPassword.value
|
|
6225
|
-
}])
|
|
6226
|
-
},
|
|
6227
|
-
[
|
|
6228
|
-
createVNode(unref(Input), mergeProps({
|
|
6229
|
-
class: "input-box",
|
|
6230
|
-
disabled: _ctx.disabled,
|
|
6231
|
-
max: _ctx.max,
|
|
6232
|
-
min: _ctx.min,
|
|
6233
|
-
"model-value": modelValue.value,
|
|
6234
|
-
placeholder: _ctx.placeholder,
|
|
6235
|
-
type: _ctx.type
|
|
6236
|
-
}, _ctx.$attrs, {
|
|
6237
|
-
precision: _ctx.precision,
|
|
6238
|
-
onBlur: handleBlur,
|
|
6239
|
-
onChange: handleInput,
|
|
6240
|
-
onFocus: _cache[0] || (_cache[0] = () => isBlur.value = false),
|
|
6241
|
-
onInput: handleInput,
|
|
6242
|
-
onKeydown: handleKeydown,
|
|
6243
|
-
onPaste: handlePaste
|
|
6244
|
-
}), {
|
|
6245
|
-
suffix: withCtx(() => []),
|
|
6246
|
-
_: 1
|
|
6247
|
-
/* STABLE */
|
|
6248
|
-
}, 16, ["disabled", "max", "min", "model-value", "placeholder", "type", "precision"]),
|
|
6249
|
-
unref(errorMessage) ? withDirectives((openBlock(), createBlock(
|
|
6250
|
-
unref(DbIcon),
|
|
6251
|
-
{
|
|
6252
|
-
key: 0,
|
|
6253
|
-
class: "error-icon",
|
|
6254
|
-
type: "exclamation-fill"
|
|
6255
|
-
},
|
|
6256
|
-
null,
|
|
6257
|
-
512
|
|
6258
|
-
/* NEED_PATCH */
|
|
6259
|
-
)), [
|
|
6260
|
-
[_directive_bk_tooltips, unref(errorMessage)]
|
|
6261
|
-
]) : createCommentVNode("v-if", true),
|
|
6262
|
-
_ctx.isShowBlur && isBlur.value ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
6263
|
-
renderSlot(_ctx.$slots, "blur")
|
|
6264
|
-
])) : createCommentVNode("v-if", true)
|
|
6265
|
-
],
|
|
6266
|
-
2
|
|
6267
|
-
/* CLASS */
|
|
6268
|
-
);
|
|
6269
|
-
};
|
|
6270
|
-
}
|
|
6271
|
-
});
|
|
6272
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
6273
|
-
__name: "fixed-column",
|
|
6274
|
-
props: {
|
|
6275
|
-
fixed: { default: "right" }
|
|
6276
|
-
},
|
|
6277
|
-
setup(__props) {
|
|
6278
|
-
const props = __props;
|
|
6279
|
-
const { isOverflow: isFixed } = inject(renderTablekey);
|
|
6280
|
-
const isFixedRight = computed(() => (isFixed == null ? void 0 : isFixed.value) && props.fixed === "right");
|
|
6281
|
-
const isFixedLeft = computed(() => (isFixed == null ? void 0 : isFixed.value) && props.fixed === "left");
|
|
6282
|
-
return (_ctx, _cache) => {
|
|
6283
|
-
return openBlock(), createElementBlock(
|
|
6284
|
-
"td",
|
|
6285
|
-
{
|
|
6286
|
-
class: normalizeClass({
|
|
6287
|
-
"bk-ediatable-right-fixed-column": isFixedRight.value,
|
|
6288
|
-
"bk-ediatable-left-fixed-column": isFixedLeft.value
|
|
6289
|
-
})
|
|
6290
|
-
},
|
|
6291
|
-
[
|
|
6292
|
-
renderSlot(_ctx.$slots, "default")
|
|
6293
|
-
],
|
|
6294
|
-
2
|
|
6295
|
-
/* CLASS */
|
|
6296
|
-
);
|
|
6297
|
-
};
|
|
6298
|
-
}
|
|
6299
|
-
});
|
|
6300
|
-
const _hoisted_1$3 = { class: "bk-ediatable-operation" };
|
|
6301
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
6302
|
-
__name: "operation-column",
|
|
6303
|
-
props: {
|
|
6304
|
-
removeable: { type: Boolean, default: true },
|
|
6305
|
-
showCopy: { type: Boolean, default: false },
|
|
6306
|
-
showAdd: { type: Boolean, default: true },
|
|
6307
|
-
showRemove: { type: Boolean, default: true }
|
|
6308
|
-
},
|
|
6309
|
-
emits: ["add", "copy", "remove"],
|
|
6310
|
-
setup(__props, { emit: __emit }) {
|
|
6311
|
-
const props = __props;
|
|
6312
|
-
const emits = __emit;
|
|
6313
|
-
const handleCopy = () => {
|
|
6314
|
-
emits("copy");
|
|
6315
|
-
};
|
|
6316
|
-
const handleAppend = () => {
|
|
6317
|
-
emits("add");
|
|
6318
|
-
};
|
|
6319
|
-
const handleRemove = () => {
|
|
6320
|
-
if (props.removeable) {
|
|
6321
|
-
return;
|
|
6322
|
-
}
|
|
6323
|
-
emits("remove");
|
|
6324
|
-
};
|
|
6325
|
-
return (_ctx, _cache) => {
|
|
6326
|
-
return openBlock(), createBlock(_sfc_main$4, null, {
|
|
6327
|
-
default: withCtx(() => [
|
|
6328
|
-
createElementVNode("div", _hoisted_1$3, [
|
|
6329
|
-
_ctx.showCopy ? (openBlock(), createElementBlock("div", {
|
|
6330
|
-
key: 0,
|
|
6331
|
-
class: "action-btn",
|
|
6332
|
-
onClick: handleCopy
|
|
6333
|
-
}, [
|
|
6334
|
-
createVNode(unref(DbIcon), { type: "copy" })
|
|
6335
|
-
])) : createCommentVNode("v-if", true),
|
|
6336
|
-
_ctx.showAdd ? (openBlock(), createElementBlock("div", {
|
|
6337
|
-
key: 1,
|
|
6338
|
-
class: "action-btn",
|
|
6339
|
-
onClick: handleAppend
|
|
6340
|
-
}, [
|
|
6341
|
-
createVNode(unref(DbIcon), { type: "plus-fill" })
|
|
6342
|
-
])) : createCommentVNode("v-if", true),
|
|
6343
|
-
_ctx.showRemove ? (openBlock(), createElementBlock(
|
|
6344
|
-
"div",
|
|
6345
|
-
{
|
|
6346
|
-
key: 2,
|
|
6347
|
-
class: normalizeClass(["action-btn", {
|
|
6348
|
-
disabled: _ctx.removeable
|
|
6349
|
-
}]),
|
|
6350
|
-
onClick: handleRemove
|
|
6351
|
-
},
|
|
6352
|
-
[
|
|
6353
|
-
createVNode(unref(DbIcon), { type: "minus-fill" })
|
|
6354
|
-
],
|
|
6355
|
-
2
|
|
6356
|
-
/* CLASS */
|
|
6357
|
-
)) : createCommentVNode("v-if", true)
|
|
6358
|
-
])
|
|
6359
|
-
]),
|
|
6360
|
-
_: 1
|
|
6361
|
-
/* STABLE */
|
|
6362
|
-
});
|
|
6363
|
-
};
|
|
6364
|
-
}
|
|
6365
|
-
});
|
|
6366
|
-
const _hoisted_1$2 = {
|
|
6367
|
-
key: 0,
|
|
6368
|
-
class: "select-error"
|
|
6369
|
-
};
|
|
6370
|
-
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
6371
|
-
__name: "select-column",
|
|
6372
|
-
props: /* @__PURE__ */ mergeModels({
|
|
6373
|
-
list: {},
|
|
6374
|
-
placeholder: { default: "请选择" },
|
|
6375
|
-
rules: { default: () => [] },
|
|
6376
|
-
disabled: { type: Boolean, default: false },
|
|
6377
|
-
multiple: { type: Boolean, default: false },
|
|
6378
|
-
showSelectAll: { type: Boolean, default: false }
|
|
6379
|
-
}, {
|
|
6380
|
-
"modelValue": {},
|
|
6381
|
-
"modelModifiers": {}
|
|
6382
|
-
}),
|
|
6383
|
-
emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
|
|
6384
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6385
|
-
const { Option } = Select;
|
|
6386
|
-
const props = __props;
|
|
6387
|
-
const emits = __emit;
|
|
6388
|
-
const modelValue = useModel(__props, "modelValue");
|
|
6389
|
-
const rootRef = ref();
|
|
6390
|
-
const localValue = ref("");
|
|
6391
|
-
const rootHeight = ref(42);
|
|
6392
|
-
const { message: errorMessage, validator } = useValidtor(props.rules);
|
|
6393
|
-
watch(
|
|
6394
|
-
modelValue,
|
|
6395
|
-
(value) => {
|
|
6396
|
-
if (value === void 0) {
|
|
6397
|
-
return;
|
|
6398
|
-
}
|
|
6399
|
-
localValue.value = value;
|
|
6400
|
-
if (typeof value !== "object" && value) {
|
|
6401
|
-
validator(value);
|
|
6402
|
-
return;
|
|
6403
|
-
}
|
|
6404
|
-
if (Array.isArray(value) && value.length > 0) {
|
|
6405
|
-
validator(value);
|
|
6406
|
-
return;
|
|
6407
|
-
}
|
|
6408
|
-
},
|
|
6409
|
-
{
|
|
6410
|
-
immediate: true
|
|
6411
|
-
}
|
|
6412
|
-
);
|
|
6413
|
-
const handleSelect = (value) => {
|
|
6414
|
-
localValue.value = value;
|
|
6415
|
-
validator(localValue.value).then(() => {
|
|
6416
|
-
modelValue.value = value;
|
|
6417
|
-
emits("change", localValue.value);
|
|
6418
|
-
});
|
|
6419
|
-
};
|
|
6420
|
-
const handleRemove = () => {
|
|
6421
|
-
localValue.value = "";
|
|
6422
|
-
validator(localValue.value).then(() => {
|
|
6423
|
-
modelValue.value = localValue.value;
|
|
6424
|
-
emits("change", localValue.value);
|
|
6425
|
-
});
|
|
6426
|
-
};
|
|
6427
|
-
const checkRootHeight = () => {
|
|
6428
|
-
rootHeight.value = rootRef.value.parentNode.clientHeight;
|
|
6429
|
-
};
|
|
6430
|
-
useResizeObserver(rootRef, _.throttle(checkRootHeight, 500));
|
|
6431
|
-
__expose({
|
|
6432
|
-
getValue() {
|
|
6433
|
-
return validator(localValue.value).then(() => localValue.value);
|
|
6434
|
-
}
|
|
6435
|
-
});
|
|
6436
|
-
return (_ctx, _cache) => {
|
|
6437
|
-
const _directive_bk_tooltips = resolveDirective("bk-tooltips");
|
|
6438
|
-
return openBlock(), createElementBlock(
|
|
6439
|
-
"div",
|
|
6440
|
-
{
|
|
6441
|
-
ref_key: "rootRef",
|
|
6442
|
-
ref: rootRef,
|
|
6443
|
-
class: normalizeClass(["bk-ediatable-select", {
|
|
6444
|
-
"is-error": Boolean(unref(errorMessage)),
|
|
6445
|
-
"is-disable": _ctx.disabled
|
|
6446
|
-
}]),
|
|
6447
|
-
style: normalizeStyle({ height: rootHeight.value + "px" })
|
|
6448
|
-
},
|
|
6449
|
-
[
|
|
6450
|
-
createVNode(unref(Select), mergeProps(_ctx.$attrs, {
|
|
6451
|
-
"model-value": localValue.value,
|
|
6452
|
-
"auto-focus": "",
|
|
6453
|
-
class: "select-box",
|
|
6454
|
-
clearable: false,
|
|
6455
|
-
disabled: _ctx.disabled,
|
|
6456
|
-
filterable: "",
|
|
6457
|
-
"input-search": false,
|
|
6458
|
-
multiple: _ctx.multiple,
|
|
6459
|
-
placeholder: _ctx.placeholder,
|
|
6460
|
-
"show-select-all": _ctx.showSelectAll,
|
|
6461
|
-
onChange: handleSelect,
|
|
6462
|
-
onClear: handleRemove
|
|
6463
|
-
}), {
|
|
6464
|
-
default: withCtx(() => [
|
|
6465
|
-
(openBlock(true), createElementBlock(
|
|
6466
|
-
Fragment,
|
|
6467
|
-
null,
|
|
6468
|
-
renderList(_ctx.list, (item, index) => {
|
|
6469
|
-
return openBlock(), createBlock(unref(Option), {
|
|
6470
|
-
key: index,
|
|
6471
|
-
label: item.label,
|
|
6472
|
-
value: item.value
|
|
6473
|
-
}, null, 8, ["label", "value"]);
|
|
6474
|
-
}),
|
|
6475
|
-
128
|
|
6476
|
-
/* KEYED_FRAGMENT */
|
|
6477
|
-
))
|
|
6478
|
-
]),
|
|
6479
|
-
_: 1
|
|
6480
|
-
/* STABLE */
|
|
6481
|
-
}, 16, ["model-value", "disabled", "multiple", "placeholder", "show-select-all"]),
|
|
6482
|
-
unref(errorMessage) ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
6483
|
-
withDirectives(createVNode(
|
|
6484
|
-
unref(DbIcon),
|
|
6485
|
-
{ type: "exclamation-fill" },
|
|
6486
|
-
null,
|
|
6487
|
-
512
|
|
6488
|
-
/* NEED_PATCH */
|
|
6489
|
-
), [
|
|
6490
|
-
[_directive_bk_tooltips, unref(errorMessage)]
|
|
6491
|
-
])
|
|
6492
|
-
])) : createCommentVNode("v-if", true)
|
|
6493
|
-
],
|
|
6494
|
-
6
|
|
6495
|
-
/* CLASS, STYLE */
|
|
6496
|
-
);
|
|
6497
|
-
};
|
|
6498
|
-
}
|
|
6499
|
-
});
|
|
6500
|
-
var top = "top";
|
|
6501
|
-
var bottom = "bottom";
|
|
6502
|
-
var right = "right";
|
|
6503
|
-
var left = "left";
|
|
6504
|
-
var auto = "auto";
|
|
6505
|
-
var basePlacements = [top, bottom, right, left];
|
|
6506
|
-
var start = "start";
|
|
6507
|
-
var end = "end";
|
|
6508
|
-
var clippingParents = "clippingParents";
|
|
6509
|
-
var viewport = "viewport";
|
|
6510
|
-
var popper = "popper";
|
|
6511
|
-
var reference = "reference";
|
|
6512
|
-
var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
|
|
6513
|
-
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
|
6514
|
-
}, []);
|
|
6515
|
-
var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
|
|
6516
|
-
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
|
6517
|
-
}, []);
|
|
6518
|
-
var beforeRead = "beforeRead";
|
|
6519
|
-
var read = "read";
|
|
6520
|
-
var afterRead = "afterRead";
|
|
6521
|
-
var beforeMain = "beforeMain";
|
|
6522
|
-
var main = "main";
|
|
6523
|
-
var afterMain = "afterMain";
|
|
6524
|
-
var beforeWrite = "beforeWrite";
|
|
6525
|
-
var write = "write";
|
|
6526
|
-
var afterWrite = "afterWrite";
|
|
6527
|
-
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
6528
|
-
function getNodeName(element) {
|
|
6529
|
-
return element ? (element.nodeName || "").toLowerCase() : null;
|
|
6530
|
-
}
|
|
6531
|
-
function getWindow(node) {
|
|
6532
|
-
if (node == null) {
|
|
6533
|
-
return window;
|
|
6534
|
-
}
|
|
6535
|
-
if (node.toString() !== "[object Window]") {
|
|
6536
|
-
var ownerDocument = node.ownerDocument;
|
|
6537
|
-
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
6538
|
-
}
|
|
6539
|
-
return node;
|
|
6540
|
-
}
|
|
6541
|
-
function isElement$1(node) {
|
|
6542
|
-
var OwnElement = getWindow(node).Element;
|
|
6543
|
-
return node instanceof OwnElement || node instanceof Element;
|
|
6544
|
-
}
|
|
6545
|
-
function isHTMLElement(node) {
|
|
6546
|
-
var OwnElement = getWindow(node).HTMLElement;
|
|
6547
|
-
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
6548
|
-
}
|
|
6549
|
-
function isShadowRoot(node) {
|
|
6550
|
-
if (typeof ShadowRoot === "undefined") {
|
|
6551
|
-
return false;
|
|
6552
|
-
}
|
|
6553
|
-
var OwnElement = getWindow(node).ShadowRoot;
|
|
6554
|
-
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
6555
|
-
}
|
|
6556
|
-
function applyStyles(_ref) {
|
|
6557
|
-
var state = _ref.state;
|
|
6558
|
-
Object.keys(state.elements).forEach(function(name) {
|
|
6559
|
-
var style = state.styles[name] || {};
|
|
6560
|
-
var attributes = state.attributes[name] || {};
|
|
6561
|
-
var element = state.elements[name];
|
|
6562
|
-
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
6563
|
-
return;
|
|
6564
|
-
}
|
|
6565
|
-
Object.assign(element.style, style);
|
|
6566
|
-
Object.keys(attributes).forEach(function(name2) {
|
|
6567
|
-
var value = attributes[name2];
|
|
6568
|
-
if (value === false) {
|
|
6569
|
-
element.removeAttribute(name2);
|
|
6570
|
-
} else {
|
|
6571
|
-
element.setAttribute(name2, value === true ? "" : value);
|
|
6572
|
-
}
|
|
6573
|
-
});
|
|
6574
|
-
});
|
|
6575
|
-
}
|
|
6576
|
-
function effect$2(_ref2) {
|
|
6577
|
-
var state = _ref2.state;
|
|
6578
|
-
var initialStyles = {
|
|
6579
|
-
popper: {
|
|
6580
|
-
position: state.options.strategy,
|
|
6581
|
-
left: "0",
|
|
6582
|
-
top: "0",
|
|
6583
|
-
margin: "0"
|
|
6584
|
-
},
|
|
6585
|
-
arrow: {
|
|
6586
|
-
position: "absolute"
|
|
6587
|
-
},
|
|
6588
|
-
reference: {}
|
|
6589
|
-
};
|
|
6590
|
-
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
6591
|
-
state.styles = initialStyles;
|
|
6592
|
-
if (state.elements.arrow) {
|
|
6593
|
-
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
6594
|
-
}
|
|
6595
|
-
return function() {
|
|
6596
|
-
Object.keys(state.elements).forEach(function(name) {
|
|
6597
|
-
var element = state.elements[name];
|
|
6598
|
-
var attributes = state.attributes[name] || {};
|
|
6599
|
-
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
|
|
6600
|
-
var style = styleProperties.reduce(function(style2, property) {
|
|
6601
|
-
style2[property] = "";
|
|
6602
|
-
return style2;
|
|
6603
|
-
}, {});
|
|
6604
|
-
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
6605
|
-
return;
|
|
6606
|
-
}
|
|
6607
|
-
Object.assign(element.style, style);
|
|
6608
|
-
Object.keys(attributes).forEach(function(attribute) {
|
|
6609
|
-
element.removeAttribute(attribute);
|
|
6610
|
-
});
|
|
6611
|
-
});
|
|
6612
|
-
};
|
|
6613
|
-
}
|
|
6614
|
-
const applyStyles$1 = {
|
|
6615
|
-
name: "applyStyles",
|
|
6616
|
-
enabled: true,
|
|
6617
|
-
phase: "write",
|
|
6618
|
-
fn: applyStyles,
|
|
6619
|
-
effect: effect$2,
|
|
6620
|
-
requires: ["computeStyles"]
|
|
6621
|
-
};
|
|
6622
|
-
function getBasePlacement$1(placement) {
|
|
6623
|
-
return placement.split("-")[0];
|
|
6624
|
-
}
|
|
6625
|
-
var max = Math.max;
|
|
6626
|
-
var min = Math.min;
|
|
6627
|
-
var round = Math.round;
|
|
6628
|
-
function getUAString() {
|
|
6629
|
-
var uaData = navigator.userAgentData;
|
|
6630
|
-
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
|
6631
|
-
return uaData.brands.map(function(item) {
|
|
6632
|
-
return item.brand + "/" + item.version;
|
|
6633
|
-
}).join(" ");
|
|
6634
|
-
}
|
|
6635
|
-
return navigator.userAgent;
|
|
6636
|
-
}
|
|
6637
|
-
function isLayoutViewport() {
|
|
6638
|
-
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
6639
|
-
}
|
|
6640
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
6641
|
-
if (includeScale === void 0) {
|
|
6642
|
-
includeScale = false;
|
|
6643
|
-
}
|
|
6644
|
-
if (isFixedStrategy === void 0) {
|
|
6645
|
-
isFixedStrategy = false;
|
|
6646
|
-
}
|
|
6647
|
-
var clientRect = element.getBoundingClientRect();
|
|
6648
|
-
var scaleX = 1;
|
|
6649
|
-
var scaleY = 1;
|
|
6650
|
-
if (includeScale && isHTMLElement(element)) {
|
|
6651
|
-
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
6652
|
-
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
6653
|
-
}
|
|
6654
|
-
var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
|
|
6655
|
-
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
6656
|
-
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
|
6657
|
-
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
|
6658
|
-
var width = clientRect.width / scaleX;
|
|
6659
|
-
var height = clientRect.height / scaleY;
|
|
6660
|
-
return {
|
|
6661
|
-
width,
|
|
6662
|
-
height,
|
|
6663
|
-
top: y,
|
|
6664
|
-
right: x + width,
|
|
6665
|
-
bottom: y + height,
|
|
6666
|
-
left: x,
|
|
6667
|
-
x,
|
|
6668
|
-
y
|
|
5792
|
+
width,
|
|
5793
|
+
height,
|
|
5794
|
+
top: y,
|
|
5795
|
+
right: x + width,
|
|
5796
|
+
bottom: y + height,
|
|
5797
|
+
left: x,
|
|
5798
|
+
x,
|
|
5799
|
+
y
|
|
6669
5800
|
};
|
|
6670
5801
|
}
|
|
6671
5802
|
function getLayoutRect(element) {
|
|
@@ -7260,16 +6391,16 @@ function computeAutoPlacement(state, options) {
|
|
|
7260
6391
|
if (options === void 0) {
|
|
7261
6392
|
options = {};
|
|
7262
6393
|
}
|
|
7263
|
-
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;
|
|
7264
6395
|
var variation = getVariation(placement);
|
|
7265
|
-
var
|
|
6396
|
+
var placements2 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
|
|
7266
6397
|
return getVariation(placement2) === variation;
|
|
7267
6398
|
}) : basePlacements;
|
|
7268
|
-
var allowedPlacements =
|
|
6399
|
+
var allowedPlacements = placements2.filter(function(placement2) {
|
|
7269
6400
|
return allowedAutoPlacements.indexOf(placement2) >= 0;
|
|
7270
6401
|
});
|
|
7271
6402
|
if (allowedPlacements.length === 0) {
|
|
7272
|
-
allowedPlacements =
|
|
6403
|
+
allowedPlacements = placements2;
|
|
7273
6404
|
}
|
|
7274
6405
|
var overflows = allowedPlacements.reduce(function(acc, placement2) {
|
|
7275
6406
|
acc[placement2] = detectOverflow(state, {
|
|
@@ -7458,7 +6589,7 @@ function distanceAndSkiddingToXY(placement, rects, offset2) {
|
|
|
7458
6589
|
function offset(_ref2) {
|
|
7459
6590
|
var state = _ref2.state, options = _ref2.options, name = _ref2.name;
|
|
7460
6591
|
var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
|
|
7461
|
-
var data = placements.reduce(function(acc, placement) {
|
|
6592
|
+
var data = placements$1.reduce(function(acc, placement) {
|
|
7462
6593
|
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
|
|
7463
6594
|
return acc;
|
|
7464
6595
|
}, {});
|
|
@@ -8055,7 +7186,7 @@ var renderProps = {
|
|
|
8055
7186
|
theme: "",
|
|
8056
7187
|
zIndex: 9999
|
|
8057
7188
|
};
|
|
8058
|
-
var defaultProps = Object.assign({
|
|
7189
|
+
var defaultProps$1 = Object.assign({
|
|
8059
7190
|
appendTo: TIPPY_DEFAULT_APPEND_TO,
|
|
8060
7191
|
aria: {
|
|
8061
7192
|
content: "auto",
|
|
@@ -8104,11 +7235,11 @@ var defaultProps = Object.assign({
|
|
|
8104
7235
|
trigger: "mouseenter focus",
|
|
8105
7236
|
triggerTarget: null
|
|
8106
7237
|
}, pluginProps, renderProps);
|
|
8107
|
-
var defaultKeys = Object.keys(defaultProps);
|
|
7238
|
+
var defaultKeys = Object.keys(defaultProps$1);
|
|
8108
7239
|
var setDefaultProps = function setDefaultProps2(partialProps) {
|
|
8109
7240
|
var keys = Object.keys(partialProps);
|
|
8110
7241
|
keys.forEach(function(key) {
|
|
8111
|
-
defaultProps[key] = partialProps[key];
|
|
7242
|
+
defaultProps$1[key] = partialProps[key];
|
|
8112
7243
|
});
|
|
8113
7244
|
};
|
|
8114
7245
|
function getExtendedPassedProps(passedProps) {
|
|
@@ -8117,14 +7248,14 @@ function getExtendedPassedProps(passedProps) {
|
|
|
8117
7248
|
var name = plugin.name, defaultValue = plugin.defaultValue;
|
|
8118
7249
|
if (name) {
|
|
8119
7250
|
var _name;
|
|
8120
|
-
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;
|
|
8121
7252
|
}
|
|
8122
7253
|
return acc;
|
|
8123
7254
|
}, {});
|
|
8124
7255
|
return Object.assign({}, passedProps, pluginProps2);
|
|
8125
7256
|
}
|
|
8126
7257
|
function getDataAttributeProps(reference2, plugins) {
|
|
8127
|
-
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
|
|
7258
|
+
var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps$1, {
|
|
8128
7259
|
plugins
|
|
8129
7260
|
}))) : defaultKeys;
|
|
8130
7261
|
var props = propKeys.reduce(function(acc, key) {
|
|
@@ -8149,7 +7280,7 @@ function evaluateProps(reference2, props) {
|
|
|
8149
7280
|
var out = Object.assign({}, props, {
|
|
8150
7281
|
content: invokeWithArgsOrReturn(props.content, [reference2])
|
|
8151
7282
|
}, props.ignoreAttributes ? {} : getDataAttributeProps(reference2, props.plugins));
|
|
8152
|
-
out.aria = Object.assign({}, defaultProps.aria, out.aria);
|
|
7283
|
+
out.aria = Object.assign({}, defaultProps$1.aria, out.aria);
|
|
8153
7284
|
out.aria = {
|
|
8154
7285
|
expanded: out.aria.expanded === "auto" ? props.interactive : out.aria.expanded,
|
|
8155
7286
|
content: out.aria.content === "auto" ? props.interactive ? null : "describedby" : out.aria.content
|
|
@@ -8264,7 +7395,7 @@ var idCounter = 1;
|
|
|
8264
7395
|
var mouseMoveListeners = [];
|
|
8265
7396
|
var mountedInstances = [];
|
|
8266
7397
|
function createTippy(reference2, passedProps) {
|
|
8267
|
-
var props = evaluateProps(reference2, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps))));
|
|
7398
|
+
var props = evaluateProps(reference2, Object.assign({}, defaultProps$1, getExtendedPassedProps(removeUndefinedProps(passedProps))));
|
|
8268
7399
|
var showTimeout;
|
|
8269
7400
|
var hideTimeout;
|
|
8270
7401
|
var scheduleHideAnimationFrame;
|
|
@@ -8363,651 +7494,1687 @@ function createTippy(reference2, passedProps) {
|
|
|
8363
7494
|
var parent = getCurrentTarget().parentNode;
|
|
8364
7495
|
return parent ? getOwnerDocument(parent) : document;
|
|
8365
7496
|
}
|
|
8366
|
-
function getDefaultTemplateChildren() {
|
|
8367
|
-
return getChildren(popper2);
|
|
7497
|
+
function getDefaultTemplateChildren() {
|
|
7498
|
+
return getChildren(popper2);
|
|
7499
|
+
}
|
|
7500
|
+
function getDelay(isShow) {
|
|
7501
|
+
if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === "focus") {
|
|
7502
|
+
return 0;
|
|
7503
|
+
}
|
|
7504
|
+
return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps$1.delay);
|
|
7505
|
+
}
|
|
7506
|
+
function handleStyles(fromHide) {
|
|
7507
|
+
if (fromHide === void 0) {
|
|
7508
|
+
fromHide = false;
|
|
7509
|
+
}
|
|
7510
|
+
popper2.style.pointerEvents = instance.props.interactive && !fromHide ? "" : "none";
|
|
7511
|
+
popper2.style.zIndex = "" + instance.props.zIndex;
|
|
7512
|
+
}
|
|
7513
|
+
function invokeHook(hook, args, shouldInvokePropsHook) {
|
|
7514
|
+
if (shouldInvokePropsHook === void 0) {
|
|
7515
|
+
shouldInvokePropsHook = true;
|
|
7516
|
+
}
|
|
7517
|
+
pluginsHooks.forEach(function(pluginHooks) {
|
|
7518
|
+
if (pluginHooks[hook]) {
|
|
7519
|
+
pluginHooks[hook].apply(pluginHooks, args);
|
|
7520
|
+
}
|
|
7521
|
+
});
|
|
7522
|
+
if (shouldInvokePropsHook) {
|
|
7523
|
+
var _instance$props;
|
|
7524
|
+
(_instance$props = instance.props)[hook].apply(_instance$props, args);
|
|
7525
|
+
}
|
|
7526
|
+
}
|
|
7527
|
+
function handleAriaContentAttribute() {
|
|
7528
|
+
var aria = instance.props.aria;
|
|
7529
|
+
if (!aria.content) {
|
|
7530
|
+
return;
|
|
7531
|
+
}
|
|
7532
|
+
var attr = "aria-" + aria.content;
|
|
7533
|
+
var id2 = popper2.id;
|
|
7534
|
+
var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
|
|
7535
|
+
nodes.forEach(function(node) {
|
|
7536
|
+
var currentValue = node.getAttribute(attr);
|
|
7537
|
+
if (instance.state.isVisible) {
|
|
7538
|
+
node.setAttribute(attr, currentValue ? currentValue + " " + id2 : id2);
|
|
7539
|
+
} else {
|
|
7540
|
+
var nextValue = currentValue && currentValue.replace(id2, "").trim();
|
|
7541
|
+
if (nextValue) {
|
|
7542
|
+
node.setAttribute(attr, nextValue);
|
|
7543
|
+
} else {
|
|
7544
|
+
node.removeAttribute(attr);
|
|
7545
|
+
}
|
|
7546
|
+
}
|
|
7547
|
+
});
|
|
7548
|
+
}
|
|
7549
|
+
function handleAriaExpandedAttribute() {
|
|
7550
|
+
if (hasAriaExpanded || !instance.props.aria.expanded) {
|
|
7551
|
+
return;
|
|
7552
|
+
}
|
|
7553
|
+
var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
|
|
7554
|
+
nodes.forEach(function(node) {
|
|
7555
|
+
if (instance.props.interactive) {
|
|
7556
|
+
node.setAttribute("aria-expanded", instance.state.isVisible && node === getCurrentTarget() ? "true" : "false");
|
|
7557
|
+
} else {
|
|
7558
|
+
node.removeAttribute("aria-expanded");
|
|
7559
|
+
}
|
|
7560
|
+
});
|
|
7561
|
+
}
|
|
7562
|
+
function cleanupInteractiveMouseListeners() {
|
|
7563
|
+
getDocument().removeEventListener("mousemove", debouncedOnMouseMove);
|
|
7564
|
+
mouseMoveListeners = mouseMoveListeners.filter(function(listener) {
|
|
7565
|
+
return listener !== debouncedOnMouseMove;
|
|
7566
|
+
});
|
|
7567
|
+
}
|
|
7568
|
+
function onDocumentPress(event) {
|
|
7569
|
+
if (currentInput.isTouch) {
|
|
7570
|
+
if (didTouchMove || event.type === "mousedown") {
|
|
7571
|
+
return;
|
|
7572
|
+
}
|
|
7573
|
+
}
|
|
7574
|
+
var actualTarget = event.composedPath && event.composedPath()[0] || event.target;
|
|
7575
|
+
if (instance.props.interactive && actualContains(popper2, actualTarget)) {
|
|
7576
|
+
return;
|
|
7577
|
+
}
|
|
7578
|
+
if (normalizeToArray(instance.props.triggerTarget || reference2).some(function(el) {
|
|
7579
|
+
return actualContains(el, actualTarget);
|
|
7580
|
+
})) {
|
|
7581
|
+
if (currentInput.isTouch) {
|
|
7582
|
+
return;
|
|
7583
|
+
}
|
|
7584
|
+
if (instance.state.isVisible && instance.props.trigger.indexOf("click") >= 0) {
|
|
7585
|
+
return;
|
|
7586
|
+
}
|
|
7587
|
+
} else {
|
|
7588
|
+
invokeHook("onClickOutside", [instance, event]);
|
|
7589
|
+
}
|
|
7590
|
+
if (instance.props.hideOnClick === true) {
|
|
7591
|
+
instance.clearDelayTimeouts();
|
|
7592
|
+
instance.hide();
|
|
7593
|
+
didHideDueToDocumentMouseDown = true;
|
|
7594
|
+
setTimeout(function() {
|
|
7595
|
+
didHideDueToDocumentMouseDown = false;
|
|
7596
|
+
});
|
|
7597
|
+
if (!instance.state.isMounted) {
|
|
7598
|
+
removeDocumentPress();
|
|
7599
|
+
}
|
|
7600
|
+
}
|
|
7601
|
+
}
|
|
7602
|
+
function onTouchMove() {
|
|
7603
|
+
didTouchMove = true;
|
|
7604
|
+
}
|
|
7605
|
+
function onTouchStart() {
|
|
7606
|
+
didTouchMove = false;
|
|
7607
|
+
}
|
|
7608
|
+
function addDocumentPress() {
|
|
7609
|
+
var doc = getDocument();
|
|
7610
|
+
doc.addEventListener("mousedown", onDocumentPress, true);
|
|
7611
|
+
doc.addEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
|
|
7612
|
+
doc.addEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
|
|
7613
|
+
doc.addEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
|
|
7614
|
+
}
|
|
7615
|
+
function removeDocumentPress() {
|
|
7616
|
+
var doc = getDocument();
|
|
7617
|
+
doc.removeEventListener("mousedown", onDocumentPress, true);
|
|
7618
|
+
doc.removeEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
|
|
7619
|
+
doc.removeEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
|
|
7620
|
+
doc.removeEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
|
|
7621
|
+
}
|
|
7622
|
+
function onTransitionedOut(duration, callback) {
|
|
7623
|
+
onTransitionEnd(duration, function() {
|
|
7624
|
+
if (!instance.state.isVisible && popper2.parentNode && popper2.parentNode.contains(popper2)) {
|
|
7625
|
+
callback();
|
|
7626
|
+
}
|
|
7627
|
+
});
|
|
7628
|
+
}
|
|
7629
|
+
function onTransitionedIn(duration, callback) {
|
|
7630
|
+
onTransitionEnd(duration, callback);
|
|
7631
|
+
}
|
|
7632
|
+
function onTransitionEnd(duration, callback) {
|
|
7633
|
+
var box = getDefaultTemplateChildren().box;
|
|
7634
|
+
function listener(event) {
|
|
7635
|
+
if (event.target === box) {
|
|
7636
|
+
updateTransitionEndListener(box, "remove", listener);
|
|
7637
|
+
callback();
|
|
7638
|
+
}
|
|
7639
|
+
}
|
|
7640
|
+
if (duration === 0) {
|
|
7641
|
+
return callback();
|
|
7642
|
+
}
|
|
7643
|
+
updateTransitionEndListener(box, "remove", currentTransitionEndListener);
|
|
7644
|
+
updateTransitionEndListener(box, "add", listener);
|
|
7645
|
+
currentTransitionEndListener = listener;
|
|
7646
|
+
}
|
|
7647
|
+
function on(eventType, handler, options) {
|
|
7648
|
+
if (options === void 0) {
|
|
7649
|
+
options = false;
|
|
7650
|
+
}
|
|
7651
|
+
var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
|
|
7652
|
+
nodes.forEach(function(node) {
|
|
7653
|
+
node.addEventListener(eventType, handler, options);
|
|
7654
|
+
listeners.push({
|
|
7655
|
+
node,
|
|
7656
|
+
eventType,
|
|
7657
|
+
handler,
|
|
7658
|
+
options
|
|
7659
|
+
});
|
|
7660
|
+
});
|
|
7661
|
+
}
|
|
7662
|
+
function addListeners() {
|
|
7663
|
+
if (getIsCustomTouchBehavior()) {
|
|
7664
|
+
on("touchstart", onTrigger2, {
|
|
7665
|
+
passive: true
|
|
7666
|
+
});
|
|
7667
|
+
on("touchend", onMouseLeave, {
|
|
7668
|
+
passive: true
|
|
7669
|
+
});
|
|
7670
|
+
}
|
|
7671
|
+
splitBySpaces(instance.props.trigger).forEach(function(eventType) {
|
|
7672
|
+
if (eventType === "manual") {
|
|
7673
|
+
return;
|
|
7674
|
+
}
|
|
7675
|
+
on(eventType, onTrigger2);
|
|
7676
|
+
switch (eventType) {
|
|
7677
|
+
case "mouseenter":
|
|
7678
|
+
on("mouseleave", onMouseLeave);
|
|
7679
|
+
break;
|
|
7680
|
+
case "focus":
|
|
7681
|
+
on(isIE11 ? "focusout" : "blur", onBlurOrFocusOut);
|
|
7682
|
+
break;
|
|
7683
|
+
case "focusin":
|
|
7684
|
+
on("focusout", onBlurOrFocusOut);
|
|
7685
|
+
break;
|
|
7686
|
+
}
|
|
7687
|
+
});
|
|
7688
|
+
}
|
|
7689
|
+
function removeListeners() {
|
|
7690
|
+
listeners.forEach(function(_ref) {
|
|
7691
|
+
var node = _ref.node, eventType = _ref.eventType, handler = _ref.handler, options = _ref.options;
|
|
7692
|
+
node.removeEventListener(eventType, handler, options);
|
|
7693
|
+
});
|
|
7694
|
+
listeners = [];
|
|
8368
7695
|
}
|
|
8369
|
-
function
|
|
8370
|
-
|
|
8371
|
-
|
|
7696
|
+
function onTrigger2(event) {
|
|
7697
|
+
var _lastTriggerEvent;
|
|
7698
|
+
var shouldScheduleClickHide = false;
|
|
7699
|
+
if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
|
|
7700
|
+
return;
|
|
8372
7701
|
}
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
7702
|
+
var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === "focus";
|
|
7703
|
+
lastTriggerEvent = event;
|
|
7704
|
+
currentTarget = event.currentTarget;
|
|
7705
|
+
handleAriaExpandedAttribute();
|
|
7706
|
+
if (!instance.state.isVisible && isMouseEvent(event)) {
|
|
7707
|
+
mouseMoveListeners.forEach(function(listener) {
|
|
7708
|
+
return listener(event);
|
|
7709
|
+
});
|
|
7710
|
+
}
|
|
7711
|
+
if (event.type === "click" && (instance.props.trigger.indexOf("mouseenter") < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
|
|
7712
|
+
shouldScheduleClickHide = true;
|
|
7713
|
+
} else {
|
|
7714
|
+
scheduleShow(event);
|
|
7715
|
+
}
|
|
7716
|
+
if (event.type === "click") {
|
|
7717
|
+
isVisibleFromClick = !shouldScheduleClickHide;
|
|
7718
|
+
}
|
|
7719
|
+
if (shouldScheduleClickHide && !wasFocused) {
|
|
7720
|
+
scheduleHide(event);
|
|
8378
7721
|
}
|
|
8379
|
-
popper2.style.pointerEvents = instance.props.interactive && !fromHide ? "" : "none";
|
|
8380
|
-
popper2.style.zIndex = "" + instance.props.zIndex;
|
|
8381
7722
|
}
|
|
8382
|
-
function
|
|
8383
|
-
|
|
8384
|
-
|
|
7723
|
+
function onMouseMove(event) {
|
|
7724
|
+
var target = event.target;
|
|
7725
|
+
var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper2.contains(target);
|
|
7726
|
+
if (event.type === "mousemove" && isCursorOverReferenceOrPopper) {
|
|
7727
|
+
return;
|
|
8385
7728
|
}
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
7729
|
+
var popperTreeData = getNestedPopperTree().concat(popper2).map(function(popper22) {
|
|
7730
|
+
var _instance$popperInsta;
|
|
7731
|
+
var instance2 = popper22._tippy;
|
|
7732
|
+
var state2 = (_instance$popperInsta = instance2.popperInstance) == null ? void 0 : _instance$popperInsta.state;
|
|
7733
|
+
if (state2) {
|
|
7734
|
+
return {
|
|
7735
|
+
popperRect: popper22.getBoundingClientRect(),
|
|
7736
|
+
popperState: state2,
|
|
7737
|
+
props
|
|
7738
|
+
};
|
|
8389
7739
|
}
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
(
|
|
7740
|
+
return null;
|
|
7741
|
+
}).filter(Boolean);
|
|
7742
|
+
if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
|
|
7743
|
+
cleanupInteractiveMouseListeners();
|
|
7744
|
+
scheduleHide(event);
|
|
8394
7745
|
}
|
|
8395
7746
|
}
|
|
8396
|
-
function
|
|
8397
|
-
var
|
|
8398
|
-
if (
|
|
7747
|
+
function onMouseLeave(event) {
|
|
7748
|
+
var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf("click") >= 0 && isVisibleFromClick;
|
|
7749
|
+
if (shouldBail) {
|
|
8399
7750
|
return;
|
|
8400
7751
|
}
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
if (instance.state.isVisible) {
|
|
8407
|
-
node.setAttribute(attr, currentValue ? currentValue + " " + id2 : id2);
|
|
8408
|
-
} else {
|
|
8409
|
-
var nextValue = currentValue && currentValue.replace(id2, "").trim();
|
|
8410
|
-
if (nextValue) {
|
|
8411
|
-
node.setAttribute(attr, nextValue);
|
|
8412
|
-
} else {
|
|
8413
|
-
node.removeAttribute(attr);
|
|
8414
|
-
}
|
|
8415
|
-
}
|
|
8416
|
-
});
|
|
7752
|
+
if (instance.props.interactive) {
|
|
7753
|
+
instance.hideWithInteractivity(event);
|
|
7754
|
+
return;
|
|
7755
|
+
}
|
|
7756
|
+
scheduleHide(event);
|
|
8417
7757
|
}
|
|
8418
|
-
function
|
|
8419
|
-
if (
|
|
7758
|
+
function onBlurOrFocusOut(event) {
|
|
7759
|
+
if (instance.props.trigger.indexOf("focusin") < 0 && event.target !== getCurrentTarget()) {
|
|
8420
7760
|
return;
|
|
8421
7761
|
}
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
} else {
|
|
8427
|
-
node.removeAttribute("aria-expanded");
|
|
8428
|
-
}
|
|
8429
|
-
});
|
|
7762
|
+
if (instance.props.interactive && event.relatedTarget && popper2.contains(event.relatedTarget)) {
|
|
7763
|
+
return;
|
|
7764
|
+
}
|
|
7765
|
+
scheduleHide(event);
|
|
8430
7766
|
}
|
|
8431
|
-
function
|
|
8432
|
-
|
|
8433
|
-
mouseMoveListeners = mouseMoveListeners.filter(function(listener) {
|
|
8434
|
-
return listener !== debouncedOnMouseMove;
|
|
8435
|
-
});
|
|
7767
|
+
function isEventListenerStopped(event) {
|
|
7768
|
+
return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf("touch") >= 0 : false;
|
|
8436
7769
|
}
|
|
8437
|
-
function
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
7770
|
+
function createPopperInstance() {
|
|
7771
|
+
destroyPopperInstance();
|
|
7772
|
+
var _instance$props2 = instance.props, popperOptions = _instance$props2.popperOptions, placement = _instance$props2.placement, offset2 = _instance$props2.offset, getReferenceClientRect = _instance$props2.getReferenceClientRect, moveTransition = _instance$props2.moveTransition;
|
|
7773
|
+
var arrow2 = getIsDefaultRenderFn() ? getChildren(popper2).arrow : null;
|
|
7774
|
+
var computedReference = getReferenceClientRect ? {
|
|
7775
|
+
getBoundingClientRect: getReferenceClientRect,
|
|
7776
|
+
contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
|
|
7777
|
+
} : reference2;
|
|
7778
|
+
var tippyModifier = {
|
|
7779
|
+
name: "$$tippy",
|
|
7780
|
+
enabled: true,
|
|
7781
|
+
phase: "beforeWrite",
|
|
7782
|
+
requires: ["computeStyles"],
|
|
7783
|
+
fn: function fn5(_ref2) {
|
|
7784
|
+
var state2 = _ref2.state;
|
|
7785
|
+
if (getIsDefaultRenderFn()) {
|
|
7786
|
+
var _getDefaultTemplateCh = getDefaultTemplateChildren(), box = _getDefaultTemplateCh.box;
|
|
7787
|
+
["placement", "reference-hidden", "escaped"].forEach(function(attr) {
|
|
7788
|
+
if (attr === "placement") {
|
|
7789
|
+
box.setAttribute("data-placement", state2.placement);
|
|
7790
|
+
} else {
|
|
7791
|
+
if (state2.attributes.popper["data-popper-" + attr]) {
|
|
7792
|
+
box.setAttribute("data-" + attr, "");
|
|
7793
|
+
} else {
|
|
7794
|
+
box.removeAttribute("data-" + attr);
|
|
7795
|
+
}
|
|
7796
|
+
}
|
|
7797
|
+
});
|
|
7798
|
+
state2.attributes.popper = {};
|
|
7799
|
+
}
|
|
7800
|
+
}
|
|
7801
|
+
};
|
|
7802
|
+
var modifiers = [{
|
|
7803
|
+
name: "offset",
|
|
7804
|
+
options: {
|
|
7805
|
+
offset: offset2
|
|
7806
|
+
}
|
|
7807
|
+
}, {
|
|
7808
|
+
name: "preventOverflow",
|
|
7809
|
+
options: {
|
|
7810
|
+
padding: {
|
|
7811
|
+
top: 2,
|
|
7812
|
+
bottom: 2,
|
|
7813
|
+
left: 5,
|
|
7814
|
+
right: 5
|
|
7815
|
+
}
|
|
7816
|
+
}
|
|
7817
|
+
}, {
|
|
7818
|
+
name: "flip",
|
|
7819
|
+
options: {
|
|
7820
|
+
padding: 5
|
|
7821
|
+
}
|
|
7822
|
+
}, {
|
|
7823
|
+
name: "computeStyles",
|
|
7824
|
+
options: {
|
|
7825
|
+
adaptive: !moveTransition
|
|
8441
7826
|
}
|
|
7827
|
+
}, tippyModifier];
|
|
7828
|
+
if (getIsDefaultRenderFn() && arrow2) {
|
|
7829
|
+
modifiers.push({
|
|
7830
|
+
name: "arrow",
|
|
7831
|
+
options: {
|
|
7832
|
+
element: arrow2,
|
|
7833
|
+
padding: 3
|
|
7834
|
+
}
|
|
7835
|
+
});
|
|
7836
|
+
}
|
|
7837
|
+
modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
|
|
7838
|
+
instance.popperInstance = createPopper(computedReference, popper2, Object.assign({}, popperOptions, {
|
|
7839
|
+
placement,
|
|
7840
|
+
onFirstUpdate,
|
|
7841
|
+
modifiers
|
|
7842
|
+
}));
|
|
7843
|
+
}
|
|
7844
|
+
function destroyPopperInstance() {
|
|
7845
|
+
if (instance.popperInstance) {
|
|
7846
|
+
instance.popperInstance.destroy();
|
|
7847
|
+
instance.popperInstance = null;
|
|
7848
|
+
}
|
|
7849
|
+
}
|
|
7850
|
+
function mount() {
|
|
7851
|
+
var appendTo = instance.props.appendTo;
|
|
7852
|
+
var parentNode;
|
|
7853
|
+
var node = getCurrentTarget();
|
|
7854
|
+
if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === "parent") {
|
|
7855
|
+
parentNode = node.parentNode;
|
|
7856
|
+
} else {
|
|
7857
|
+
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
|
7858
|
+
}
|
|
7859
|
+
if (!parentNode.contains(popper2)) {
|
|
7860
|
+
parentNode.appendChild(popper2);
|
|
7861
|
+
}
|
|
7862
|
+
instance.state.isMounted = true;
|
|
7863
|
+
createPopperInstance();
|
|
7864
|
+
}
|
|
7865
|
+
function getNestedPopperTree() {
|
|
7866
|
+
return arrayFrom(popper2.querySelectorAll("[data-tippy-root]"));
|
|
7867
|
+
}
|
|
7868
|
+
function scheduleShow(event) {
|
|
7869
|
+
instance.clearDelayTimeouts();
|
|
7870
|
+
if (event) {
|
|
7871
|
+
invokeHook("onTrigger", [instance, event]);
|
|
7872
|
+
}
|
|
7873
|
+
addDocumentPress();
|
|
7874
|
+
var delay = getDelay(true);
|
|
7875
|
+
var _getNormalizedTouchSe = getNormalizedTouchSettings(), touchValue = _getNormalizedTouchSe[0], touchDelay = _getNormalizedTouchSe[1];
|
|
7876
|
+
if (currentInput.isTouch && touchValue === "hold" && touchDelay) {
|
|
7877
|
+
delay = touchDelay;
|
|
7878
|
+
}
|
|
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;
|
|
8442
7893
|
}
|
|
8443
|
-
|
|
8444
|
-
if (instance.props.interactive && actualContains(popper2, actualTarget)) {
|
|
7894
|
+
if (instance.props.trigger.indexOf("mouseenter") >= 0 && instance.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(event.type) >= 0 && isVisibleFromClick) {
|
|
8445
7895
|
return;
|
|
8446
7896
|
}
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
return;
|
|
8455
|
-
}
|
|
7897
|
+
var delay = getDelay(false);
|
|
7898
|
+
if (delay) {
|
|
7899
|
+
hideTimeout = setTimeout(function() {
|
|
7900
|
+
if (instance.state.isVisible) {
|
|
7901
|
+
instance.hide();
|
|
7902
|
+
}
|
|
7903
|
+
}, delay);
|
|
8456
7904
|
} else {
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
if (instance.props.hideOnClick === true) {
|
|
8460
|
-
instance.clearDelayTimeouts();
|
|
8461
|
-
instance.hide();
|
|
8462
|
-
didHideDueToDocumentMouseDown = true;
|
|
8463
|
-
setTimeout(function() {
|
|
8464
|
-
didHideDueToDocumentMouseDown = false;
|
|
7905
|
+
scheduleHideAnimationFrame = requestAnimationFrame(function() {
|
|
7906
|
+
instance.hide();
|
|
8465
7907
|
});
|
|
8466
|
-
if (!instance.state.isMounted) {
|
|
8467
|
-
removeDocumentPress();
|
|
8468
|
-
}
|
|
8469
7908
|
}
|
|
8470
7909
|
}
|
|
8471
|
-
function
|
|
8472
|
-
|
|
8473
|
-
}
|
|
8474
|
-
function onTouchStart() {
|
|
8475
|
-
didTouchMove = false;
|
|
8476
|
-
}
|
|
8477
|
-
function addDocumentPress() {
|
|
8478
|
-
var doc = getDocument();
|
|
8479
|
-
doc.addEventListener("mousedown", onDocumentPress, true);
|
|
8480
|
-
doc.addEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
|
|
8481
|
-
doc.addEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
|
|
8482
|
-
doc.addEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
|
|
8483
|
-
}
|
|
8484
|
-
function removeDocumentPress() {
|
|
8485
|
-
var doc = getDocument();
|
|
8486
|
-
doc.removeEventListener("mousedown", onDocumentPress, true);
|
|
8487
|
-
doc.removeEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
|
|
8488
|
-
doc.removeEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
|
|
8489
|
-
doc.removeEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
|
|
7910
|
+
function enable() {
|
|
7911
|
+
instance.state.isEnabled = true;
|
|
8490
7912
|
}
|
|
8491
|
-
function
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
callback();
|
|
8495
|
-
}
|
|
8496
|
-
});
|
|
7913
|
+
function disable() {
|
|
7914
|
+
instance.hide();
|
|
7915
|
+
instance.state.isEnabled = false;
|
|
8497
7916
|
}
|
|
8498
|
-
function
|
|
8499
|
-
|
|
7917
|
+
function clearDelayTimeouts() {
|
|
7918
|
+
clearTimeout(showTimeout);
|
|
7919
|
+
clearTimeout(hideTimeout);
|
|
7920
|
+
cancelAnimationFrame(scheduleHideAnimationFrame);
|
|
8500
7921
|
}
|
|
8501
|
-
function
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
if (event.target === box) {
|
|
8505
|
-
updateTransitionEndListener(box, "remove", listener);
|
|
8506
|
-
callback();
|
|
8507
|
-
}
|
|
7922
|
+
function setProps(partialProps) {
|
|
7923
|
+
if (instance.state.isDestroyed) {
|
|
7924
|
+
return;
|
|
8508
7925
|
}
|
|
8509
|
-
|
|
8510
|
-
|
|
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);
|
|
8511
7937
|
}
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
options = false;
|
|
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");
|
|
8519
7944
|
}
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
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);
|
|
8528
7954
|
});
|
|
7955
|
+
}
|
|
7956
|
+
invokeHook("onAfterUpdate", [instance, partialProps]);
|
|
7957
|
+
}
|
|
7958
|
+
function setContent2(content) {
|
|
7959
|
+
instance.setProps({
|
|
7960
|
+
content
|
|
8529
7961
|
});
|
|
8530
7962
|
}
|
|
8531
|
-
function
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
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;
|
|
8539
7971
|
}
|
|
8540
|
-
|
|
8541
|
-
|
|
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) {
|
|
8542
7995
|
return;
|
|
8543
7996
|
}
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
break;
|
|
8552
|
-
case "focusin":
|
|
8553
|
-
on("focusout", onBlurOrFocusOut);
|
|
8554
|
-
break;
|
|
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");
|
|
8555
8004
|
}
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
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();
|
|
8564
8018
|
}
|
|
8565
|
-
function
|
|
8566
|
-
var
|
|
8567
|
-
var
|
|
8568
|
-
|
|
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) {
|
|
8569
8025
|
return;
|
|
8570
8026
|
}
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
handleAriaExpandedAttribute();
|
|
8575
|
-
if (!instance.state.isVisible && isMouseEvent(event)) {
|
|
8576
|
-
mouseMoveListeners.forEach(function(listener) {
|
|
8577
|
-
return listener(event);
|
|
8578
|
-
});
|
|
8027
|
+
invokeHook("onHide", [instance], false);
|
|
8028
|
+
if (instance.props.onHide(instance) === false) {
|
|
8029
|
+
return;
|
|
8579
8030
|
}
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8031
|
+
instance.state.isVisible = false;
|
|
8032
|
+
instance.state.isShown = false;
|
|
8033
|
+
ignoreOnFirstUpdate = false;
|
|
8034
|
+
isVisibleFromClick = false;
|
|
8035
|
+
if (getIsDefaultRenderFn()) {
|
|
8036
|
+
popper2.style.visibility = "hidden";
|
|
8584
8037
|
}
|
|
8585
|
-
|
|
8586
|
-
|
|
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
|
+
}
|
|
8587
8047
|
}
|
|
8588
|
-
|
|
8589
|
-
|
|
8048
|
+
handleAriaContentAttribute();
|
|
8049
|
+
handleAriaExpandedAttribute();
|
|
8050
|
+
if (instance.props.animation) {
|
|
8051
|
+
if (getIsDefaultRenderFn()) {
|
|
8052
|
+
onTransitionedOut(duration, instance.unmount);
|
|
8053
|
+
}
|
|
8054
|
+
} else {
|
|
8055
|
+
instance.unmount();
|
|
8590
8056
|
}
|
|
8591
8057
|
}
|
|
8592
|
-
function
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
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) {
|
|
8596
8068
|
return;
|
|
8597
8069
|
}
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
popperRect: popper22.getBoundingClientRect(),
|
|
8605
|
-
popperState: state2,
|
|
8606
|
-
props
|
|
8607
|
-
};
|
|
8608
|
-
}
|
|
8609
|
-
return null;
|
|
8610
|
-
}).filter(Boolean);
|
|
8611
|
-
if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
|
|
8612
|
-
cleanupInteractiveMouseListeners();
|
|
8613
|
-
scheduleHide(event);
|
|
8070
|
+
destroyPopperInstance();
|
|
8071
|
+
getNestedPopperTree().forEach(function(nestedPopper) {
|
|
8072
|
+
nestedPopper._tippy.unmount();
|
|
8073
|
+
});
|
|
8074
|
+
if (popper2.parentNode) {
|
|
8075
|
+
popper2.parentNode.removeChild(popper2);
|
|
8614
8076
|
}
|
|
8077
|
+
mountedInstances = mountedInstances.filter(function(i) {
|
|
8078
|
+
return i !== instance;
|
|
8079
|
+
});
|
|
8080
|
+
instance.state.isMounted = false;
|
|
8081
|
+
invokeHook("onHidden", [instance]);
|
|
8615
8082
|
}
|
|
8616
|
-
function
|
|
8617
|
-
|
|
8618
|
-
if (shouldBail) {
|
|
8083
|
+
function destroy() {
|
|
8084
|
+
if (instance.state.isDestroyed) {
|
|
8619
8085
|
return;
|
|
8620
8086
|
}
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
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);
|
|
8624
8136
|
}
|
|
8625
|
-
scheduleHide(event);
|
|
8626
8137
|
}
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
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);
|
|
8199
|
+
} else {
|
|
8200
|
+
isOverflow = el.clientWidth < el.scrollWidth || el.clientHeight < el.scrollHeight;
|
|
8630
8201
|
}
|
|
8631
|
-
|
|
8632
|
-
|
|
8202
|
+
} catch (e) {
|
|
8203
|
+
console.warn("There is an error when check element overflow state: ", e);
|
|
8204
|
+
}
|
|
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;
|
|
8633
8245
|
}
|
|
8634
|
-
scheduleHide(event);
|
|
8635
8246
|
}
|
|
8636
|
-
|
|
8637
|
-
|
|
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_;
|
|
8638
8282
|
}
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
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;
|
|
8333
|
+
}
|
|
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;
|
|
8659
8395
|
} else {
|
|
8660
|
-
|
|
8661
|
-
box.setAttribute("data-" + attr, "");
|
|
8662
|
-
} else {
|
|
8663
|
-
box.removeAttribute("data-" + attr);
|
|
8664
|
-
}
|
|
8396
|
+
width = finalMinWidth.value;
|
|
8665
8397
|
}
|
|
8666
|
-
})
|
|
8667
|
-
|
|
8398
|
+
} else if (newWidth > finalMinWidth.value) {
|
|
8399
|
+
width = newWidth;
|
|
8400
|
+
} else {
|
|
8401
|
+
width = finalMinWidth.value;
|
|
8402
|
+
}
|
|
8403
|
+
return {
|
|
8404
|
+
minWidth: `${width}px`
|
|
8405
|
+
};
|
|
8668
8406
|
}
|
|
8669
8407
|
}
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
top: 2,
|
|
8681
|
-
bottom: 2,
|
|
8682
|
-
left: 5,
|
|
8683
|
-
right: 5
|
|
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;
|
|
8684
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
|
|
8685
8430
|
}
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
}
|
|
8691
|
-
}, {
|
|
8692
|
-
name: "computeStyles",
|
|
8693
|
-
options: {
|
|
8694
|
-
adaptive: !moveTransition
|
|
8431
|
+
);
|
|
8432
|
+
useResizeObserver(columnRef, () => {
|
|
8433
|
+
if (!isDragedSelf) {
|
|
8434
|
+
return;
|
|
8695
8435
|
}
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
});
|
|
8705
|
-
}
|
|
8706
|
-
modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
|
|
8707
|
-
instance.popperInstance = createPopper(computedReference, popper2, Object.assign({}, popperOptions, {
|
|
8708
|
-
placement,
|
|
8709
|
-
onFirstUpdate,
|
|
8710
|
-
modifiers
|
|
8711
|
-
}));
|
|
8712
|
-
}
|
|
8713
|
-
function destroyPopperInstance() {
|
|
8714
|
-
if (instance.popperInstance) {
|
|
8715
|
-
instance.popperInstance.destroy();
|
|
8716
|
-
instance.popperInstance = null;
|
|
8717
|
-
}
|
|
8718
|
-
}
|
|
8719
|
-
function mount() {
|
|
8720
|
-
var appendTo = instance.props.appendTo;
|
|
8721
|
-
var parentNode;
|
|
8722
|
-
var node = getCurrentTarget();
|
|
8723
|
-
if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === "parent") {
|
|
8724
|
-
parentNode = node.parentNode;
|
|
8725
|
-
} else {
|
|
8726
|
-
parentNode = invokeWithArgsOrReturn(appendTo, [node]);
|
|
8727
|
-
}
|
|
8728
|
-
if (!parentNode.contains(popper2)) {
|
|
8729
|
-
parentNode.appendChild(popper2);
|
|
8730
|
-
}
|
|
8731
|
-
instance.state.isMounted = true;
|
|
8732
|
-
createPopperInstance();
|
|
8733
|
-
}
|
|
8734
|
-
function getNestedPopperTree() {
|
|
8735
|
-
return arrayFrom(popper2.querySelectorAll("[data-tippy-root]"));
|
|
8736
|
-
}
|
|
8737
|
-
function scheduleShow(event) {
|
|
8738
|
-
instance.clearDelayTimeouts();
|
|
8739
|
-
if (event) {
|
|
8740
|
-
invokeHook("onTrigger", [instance, event]);
|
|
8741
|
-
}
|
|
8742
|
-
addDocumentPress();
|
|
8743
|
-
var delay = getDelay(true);
|
|
8744
|
-
var _getNormalizedTouchSe = getNormalizedTouchSettings(), touchValue = _getNormalizedTouchSe[0], touchDelay = _getNormalizedTouchSe[1];
|
|
8745
|
-
if (currentInput.isTouch && touchValue === "hold" && touchDelay) {
|
|
8746
|
-
delay = touchDelay;
|
|
8747
|
-
}
|
|
8748
|
-
if (delay) {
|
|
8749
|
-
showTimeout = setTimeout(function() {
|
|
8750
|
-
instance.show();
|
|
8751
|
-
}, delay);
|
|
8752
|
-
} else {
|
|
8753
|
-
instance.show();
|
|
8754
|
-
}
|
|
8755
|
-
}
|
|
8756
|
-
function scheduleHide(event) {
|
|
8757
|
-
instance.clearDelayTimeouts();
|
|
8758
|
-
invokeHook("onUntrigger", [instance, event]);
|
|
8759
|
-
if (!instance.state.isVisible) {
|
|
8760
|
-
removeDocumentPress();
|
|
8761
|
-
return;
|
|
8762
|
-
}
|
|
8763
|
-
if (instance.props.trigger.indexOf("mouseenter") >= 0 && instance.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(event.type) >= 0 && isVisibleFromClick) {
|
|
8764
|
-
return;
|
|
8765
|
-
}
|
|
8766
|
-
var delay = getDelay(false);
|
|
8767
|
-
if (delay) {
|
|
8768
|
-
hideTimeout = setTimeout(function() {
|
|
8769
|
-
if (instance.state.isVisible) {
|
|
8770
|
-
instance.hide();
|
|
8771
|
-
}
|
|
8772
|
-
}, delay);
|
|
8773
|
-
} else {
|
|
8774
|
-
scheduleHideAnimationFrame = requestAnimationFrame(function() {
|
|
8775
|
-
instance.hide();
|
|
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
|
|
8776
8444
|
});
|
|
8777
|
-
}
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
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
|
+
};
|
|
8781
8502
|
}
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
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
|
+
};
|
|
8785
8615
|
}
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8616
|
+
});
|
|
8617
|
+
const getRuleMessage = (rule) => {
|
|
8618
|
+
if (typeof rule.message === "function") {
|
|
8619
|
+
return rule.message();
|
|
8790
8620
|
}
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
|
|
8804
|
-
cleanupInteractiveMouseListeners();
|
|
8805
|
-
debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
|
|
8806
|
-
}
|
|
8807
|
-
if (prevProps.triggerTarget && !nextProps.triggerTarget) {
|
|
8808
|
-
normalizeToArray(prevProps.triggerTarget).forEach(function(node) {
|
|
8809
|
-
node.removeAttribute("aria-expanded");
|
|
8810
|
-
});
|
|
8811
|
-
} else if (nextProps.triggerTarget) {
|
|
8812
|
-
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);
|
|
8813
8633
|
}
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
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
|
|
8818
8683
|
}
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
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
|
+
);
|
|
8824
8700
|
}
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8701
|
+
const classes = {
|
|
8702
|
+
"ediatable-icon": true,
|
|
8703
|
+
[`icon-${this.type}`]: true
|
|
8704
|
+
};
|
|
8705
|
+
return h("i", {
|
|
8706
|
+
class: classes
|
|
8830
8707
|
});
|
|
8831
8708
|
}
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
}
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
}
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
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
|
+
}
|
|
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
|
+
}
|
|
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();
|
|
8864
8843
|
return;
|
|
8865
8844
|
}
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
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;
|
|
8873
8854
|
}
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
(
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
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
|
+
}
|
|
8883
8875
|
});
|
|
8884
8876
|
}
|
|
8885
8877
|
};
|
|
8886
|
-
|
|
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
|
+
};
|
|
8887
9042
|
}
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
}
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
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
|
|
8915
9090
|
}
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
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);
|
|
8922
9113
|
}
|
|
8923
|
-
} else {
|
|
8924
|
-
instance.unmount();
|
|
8925
|
-
}
|
|
8926
|
-
}
|
|
8927
|
-
function hideWithInteractivity(event) {
|
|
8928
|
-
getDocument().addEventListener("mousemove", debouncedOnMouseMove);
|
|
8929
|
-
pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
|
|
8930
|
-
debouncedOnMouseMove(event);
|
|
8931
|
-
}
|
|
8932
|
-
function unmount() {
|
|
8933
|
-
if (instance.state.isVisible) {
|
|
8934
|
-
instance.hide();
|
|
8935
|
-
}
|
|
8936
|
-
if (!instance.state.isMounted) {
|
|
8937
|
-
return;
|
|
8938
|
-
}
|
|
8939
|
-
destroyPopperInstance();
|
|
8940
|
-
getNestedPopperTree().forEach(function(nestedPopper) {
|
|
8941
|
-
nestedPopper._tippy.unmount();
|
|
8942
|
-
});
|
|
8943
|
-
if (popper2.parentNode) {
|
|
8944
|
-
popper2.parentNode.removeChild(popper2);
|
|
8945
|
-
}
|
|
8946
|
-
mountedInstances = mountedInstances.filter(function(i) {
|
|
8947
|
-
return i !== instance;
|
|
8948
9114
|
});
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
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
|
+
);
|
|
9000
9175
|
};
|
|
9001
|
-
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
9002
|
-
state.styles = initialStyles;
|
|
9003
|
-
if (state.elements.arrow) {
|
|
9004
|
-
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
9005
|
-
}
|
|
9006
9176
|
}
|
|
9007
9177
|
});
|
|
9008
|
-
tippy.setDefaultProps({
|
|
9009
|
-
render
|
|
9010
|
-
});
|
|
9011
9178
|
const _hoisted_1$1 = {
|
|
9012
9179
|
key: 0,
|
|
9013
9180
|
class: "input-error"
|
|
@@ -9036,6 +9203,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
9036
9203
|
const popRef = ref();
|
|
9037
9204
|
const isFocus = ref(false);
|
|
9038
9205
|
let tippyIns;
|
|
9206
|
+
const vBkTooltips = bkTooltips;
|
|
9039
9207
|
const { message: errorMessage, validator } = useValidtor(props.rules);
|
|
9040
9208
|
const tagInputPasteFn = (value) => value.split("\n").map((item) => ({ id: item }));
|
|
9041
9209
|
const handleChange = (value) => {
|
|
@@ -9087,7 +9255,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
9087
9255
|
}
|
|
9088
9256
|
});
|
|
9089
9257
|
return (_ctx, _cache) => {
|
|
9090
|
-
const _directive_bk_tooltips = resolveDirective("bk-tooltips");
|
|
9091
9258
|
return openBlock(), createElementBlock(
|
|
9092
9259
|
"div",
|
|
9093
9260
|
{
|
|
@@ -9124,7 +9291,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
9124
9291
|
512
|
|
9125
9292
|
/* NEED_PATCH */
|
|
9126
9293
|
), [
|
|
9127
|
-
[
|
|
9294
|
+
[unref(vBkTooltips), unref(errorMessage)]
|
|
9128
9295
|
])
|
|
9129
9296
|
])) : createCommentVNode("v-if", true)
|
|
9130
9297
|
],
|
|
@@ -9155,17 +9322,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
9155
9322
|
});
|
|
9156
9323
|
function useIsWidthOverflow(domRef, watchVariable) {
|
|
9157
9324
|
const isOverflow = ref(false);
|
|
9158
|
-
const
|
|
9325
|
+
const checkOverflow2 = () => {
|
|
9159
9326
|
if (domRef.value) {
|
|
9160
9327
|
isOverflow.value = domRef.value.clientWidth < domRef.value.scrollWidth;
|
|
9161
9328
|
}
|
|
9162
9329
|
};
|
|
9163
|
-
useResizeObserver(domRef,
|
|
9330
|
+
useResizeObserver(domRef, checkOverflow2);
|
|
9164
9331
|
watch(
|
|
9165
9332
|
watchVariable,
|
|
9166
9333
|
() => {
|
|
9167
9334
|
setTimeout(() => {
|
|
9168
|
-
|
|
9335
|
+
checkOverflow2();
|
|
9169
9336
|
});
|
|
9170
9337
|
},
|
|
9171
9338
|
{
|
|
@@ -9195,6 +9362,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
9195
9362
|
const props = __props;
|
|
9196
9363
|
const textRef = ref();
|
|
9197
9364
|
const renderData = computed(() => props.data);
|
|
9365
|
+
const vBkTooltips = bkTooltips;
|
|
9198
9366
|
const { isOverflow } = useIsWidthOverflow(textRef, renderData);
|
|
9199
9367
|
const { message: errorMessage, validator } = useValidtor(props.rules);
|
|
9200
9368
|
__expose({
|
|
@@ -9203,7 +9371,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
9203
9371
|
}
|
|
9204
9372
|
});
|
|
9205
9373
|
return (_ctx, _cache) => {
|
|
9206
|
-
const _directive_bk_tooltips = resolveDirective("bk-tooltips");
|
|
9207
9374
|
return openBlock(), createBlock(unref(Loading), { loading: _ctx.isLoading }, {
|
|
9208
9375
|
default: withCtx(() => [
|
|
9209
9376
|
withDirectives((openBlock(), createElementBlock(
|
|
@@ -9238,7 +9405,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
9238
9405
|
512
|
|
9239
9406
|
/* NEED_PATCH */
|
|
9240
9407
|
), [
|
|
9241
|
-
[
|
|
9408
|
+
[unref(vBkTooltips), unref(errorMessage)]
|
|
9242
9409
|
])
|
|
9243
9410
|
])) : createCommentVNode("v-if", true),
|
|
9244
9411
|
renderSlot(_ctx.$slots, "default")
|
|
@@ -9246,7 +9413,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
9246
9413
|
2
|
|
9247
9414
|
/* CLASS */
|
|
9248
9415
|
)), [
|
|
9249
|
-
[
|
|
9416
|
+
[unref(vBkTooltips), {
|
|
9250
9417
|
content: _ctx.data || _ctx.placeholder,
|
|
9251
9418
|
disabled: !unref(isOverflow)
|
|
9252
9419
|
}]
|