bkui-vue 0.0.1-beta.48 → 0.0.1-beta.50
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/dist/index.cjs.js +21 -21
- package/dist/index.esm.js +353 -264
- package/dist/index.umd.js +21 -21
- package/dist/style.css +1 -1
- package/lib/alert/alert.d.ts +1 -1
- package/lib/alert/index.d.ts +4 -4
- package/lib/animate-number/animate-number.d.ts +1 -1
- package/lib/animate-number/index.d.ts +4 -4
- package/lib/backtop/backtop.d.ts +1 -1
- package/lib/backtop/index.d.ts +4 -4
- package/lib/badge/badge.d.ts +2 -2
- package/lib/badge/index.d.ts +7 -7
- package/lib/breadcrumb/breadcrumb.d.ts +1 -1
- package/lib/breadcrumb/index.d.ts +4 -4
- package/lib/button/button.css +31 -23
- package/lib/button/button.d.ts +15 -8
- package/lib/button/button.less +22 -18
- package/lib/button/button.variable.css +31 -23
- package/lib/button/index.d.ts +26 -15
- package/lib/button/index.js +1 -1
- package/lib/checkbox/index.js +1 -1
- package/lib/date-picker/date-picker.d.ts +6 -6
- package/lib/date-picker/index.d.ts +17 -17
- package/lib/date-picker/props.d.ts +1 -1
- package/lib/dialog/dialog.css +102 -0
- package/lib/dialog/dialog.d.ts +1 -1
- package/lib/dialog/dialog.less +86 -0
- package/lib/dialog/dialog.variable.css +102 -0
- package/lib/dialog/index.d.ts +4 -4
- package/lib/dropdown/dropdown.d.ts +4 -2
- package/lib/dropdown/index.d.ts +15 -7
- package/lib/dropdown/index.js +1 -1
- package/lib/input/index.d.ts +11 -3
- package/lib/input/index.js +1 -1
- package/lib/input/input.css +6 -2
- package/lib/input/input.d.ts +7 -1
- package/lib/input/input.less +6 -2
- package/lib/input/input.variable.css +6 -2
- package/lib/link/index.d.ts +7 -7
- package/lib/link/link.d.ts +2 -2
- package/lib/loading/index.d.ts +8 -0
- package/lib/loading/index.js +1 -1
- package/lib/loading/loading.css +1 -0
- package/lib/loading/loading.d.ts +6 -0
- package/lib/loading/loading.less +1 -0
- package/lib/loading/loading.variable.css +1 -0
- package/lib/modal/index.d.ts +4 -4
- package/lib/modal/modal.css +8 -8
- package/lib/modal/modal.d.ts +1 -1
- package/lib/modal/modal.less +25 -23
- package/lib/modal/modal.variable.css +8 -8
- package/lib/popover/index.d.ts +4 -4
- package/lib/popover/popover.d.ts +1 -1
- package/lib/resize-layout/index.d.ts +4 -4
- package/lib/resize-layout/resize-layout.d.ts +1 -1
- package/lib/select/index.d.ts +34 -4
- package/lib/select/index.js +1 -1
- package/lib/select/select.css +5 -0
- package/lib/select/select.d.ts +14 -1
- package/lib/select/select.less +6 -0
- package/lib/select/select.variable.css +5 -0
- package/lib/shared/popover.d.ts +2 -2
- package/lib/sideslider/index.d.ts +4 -4
- package/lib/sideslider/sideslider.d.ts +1 -1
- package/lib/slider/slider.d.ts +1 -1
- package/lib/switcher/index.d.ts +4 -4
- package/lib/switcher/switcher.d.ts +1 -1
- package/lib/tab/index.d.ts +8 -8
- package/lib/tab/tab-nav.d.ts +1 -1
- package/lib/tab/tab-panel.d.ts +1 -1
- package/lib/tab/tab.d.ts +2 -2
- package/lib/table/index.d.ts +4 -4
- package/lib/table/index.js +1 -1
- package/lib/table/table.css +8 -1
- package/lib/table/table.d.ts +3 -4
- package/lib/table/table.less +13 -1
- package/lib/table/table.variable.css +8 -1
- package/lib/table/use-common.d.ts +17 -0
- package/lib/table/utils.d.ts +0 -8
- package/package.json +5 -1
package/dist/index.esm.js
CHANGED
@@ -8483,7 +8483,7 @@ const loadingTypes = {
|
|
8483
8483
|
indicator: {
|
8484
8484
|
type: Function
|
8485
8485
|
},
|
8486
|
-
loading: PropTypes.bool,
|
8486
|
+
loading: PropTypes.bool.def(true),
|
8487
8487
|
inline: PropTypes.bool.def(true),
|
8488
8488
|
theme: PropTypes.theme(["white", "primary", "warning", "success", "danger"]),
|
8489
8489
|
title: PropTypes.string.def(""),
|
@@ -8536,16 +8536,17 @@ var Component$r = defineComponent({
|
|
8536
8536
|
}
|
8537
8537
|
});
|
8538
8538
|
const BkLoading = withInstallProps(Component$r, { setDefaultIndicator, BkLoadingMode, BkLoadingSize }, true);
|
8539
|
+
const btnSizes = ["", "small", "large"];
|
8539
8540
|
const buttonProps = {
|
8540
8541
|
theme: PropTypes.theme().def(""),
|
8541
8542
|
hoverTheme: PropTypes.theme(["primary", "warning", "success", "danger"]).def(""),
|
8542
|
-
size: PropTypes.size(),
|
8543
|
+
size: PropTypes.size(btnSizes).def(""),
|
8543
8544
|
title: PropTypes.string,
|
8544
8545
|
icon: PropTypes.string,
|
8545
8546
|
iconRight: PropTypes.string,
|
8546
8547
|
disabled: PropTypes.bool,
|
8547
8548
|
loading: PropTypes.bool,
|
8548
|
-
|
8549
|
+
loadingMode: PropTypes.commonType(Object.values(BkLoadingMode)),
|
8549
8550
|
outline: PropTypes.bool,
|
8550
8551
|
text: PropTypes.bool,
|
8551
8552
|
nativeType: {
|
@@ -8565,6 +8566,7 @@ var Component$q = defineComponent({
|
|
8565
8566
|
const isHover = ref(false);
|
8566
8567
|
const showSlot = (_a = slots.default) != null ? _a : false;
|
8567
8568
|
const btnClsPrefix = "bk-button";
|
8569
|
+
const isText = computed(() => props.text && !props.hoverTheme);
|
8568
8570
|
const btnCls = computed(() => {
|
8569
8571
|
const hoverTheme = props.hoverTheme ? `${btnClsPrefix}-hover-${props.hoverTheme}` : "";
|
8570
8572
|
const btnThemeCls = props.theme ? `${btnClsPrefix}-${props.theme}` : "";
|
@@ -8572,11 +8574,12 @@ var Component$q = defineComponent({
|
|
8572
8574
|
return classes({
|
8573
8575
|
"is-disabled": props.disabled,
|
8574
8576
|
"is-outline": props.outline,
|
8575
|
-
"is-text":
|
8576
|
-
[`${btnClsPrefix}-${props.size}`]: props.size
|
8577
|
+
"is-text": isText.value,
|
8578
|
+
[`${btnClsPrefix}-${props.size}`]: props.size && btnSizes.includes(props.size),
|
8577
8579
|
"no-slot": !showSlot
|
8578
8580
|
}, `${themeCls} ${btnClsPrefix} ${hoverTheme}`);
|
8579
8581
|
});
|
8582
|
+
console.log(btnCls.value, props);
|
8580
8583
|
const loadingTheme = computed(() => {
|
8581
8584
|
if (props.text || props.outline || props.hoverTheme) {
|
8582
8585
|
if (isHover.value && !props.text)
|
@@ -8585,7 +8588,7 @@ var Component$q = defineComponent({
|
|
8585
8588
|
}
|
8586
8589
|
return ["", "default"].includes(props.theme) ? "" : "white";
|
8587
8590
|
});
|
8588
|
-
const loadingSize = computed(() => props.size === BkLoadingSize.Small ? BkLoadingSize.Mini : BkLoadingSize.Small);
|
8591
|
+
const loadingSize = computed(() => isText.value || props.size === BkLoadingSize.Small ? BkLoadingSize.Mini : BkLoadingSize.Small);
|
8589
8592
|
const handleClick = () => {
|
8590
8593
|
if (props.loading)
|
8591
8594
|
return;
|
@@ -8609,13 +8612,13 @@ var Component$q = defineComponent({
|
|
8609
8612
|
"onClick": handleClick,
|
8610
8613
|
"onMouseover": handleMouseOver,
|
8611
8614
|
"onMouseleave": handleMouseout
|
8612
|
-
}), [props.loading
|
8615
|
+
}), [props.loading && createVNode(BkLoading, {
|
8613
8616
|
"loading": true,
|
8614
8617
|
"class": `${btnClsPrefix}-loading`,
|
8615
|
-
"mode": props.
|
8618
|
+
"mode": props.loadingMode,
|
8616
8619
|
"theme": loadingTheme.value,
|
8617
8620
|
"size": loadingSize.value
|
8618
|
-
}, null)
|
8621
|
+
}, null), slots.default && createVNode("span", {
|
8619
8622
|
"class": `${btnClsPrefix}-text`
|
8620
8623
|
}, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])]);
|
8621
8624
|
};
|
@@ -8714,6 +8717,8 @@ const useCheckbox = () => {
|
|
8714
8717
|
if (isGroup) {
|
8715
8718
|
watch(() => checkboxGroup.props.modelValue, (modelValue) => {
|
8716
8719
|
isChecked.value = modelValue.includes(props.label);
|
8720
|
+
}, {
|
8721
|
+
deep: true
|
8717
8722
|
});
|
8718
8723
|
} else {
|
8719
8724
|
watch(() => props.modelValue, (modelValue) => {
|
@@ -9335,7 +9340,7 @@ const inputType = {
|
|
9335
9340
|
clearable: PropTypes.bool,
|
9336
9341
|
disabled: PropTypes.bool,
|
9337
9342
|
readonly: PropTypes.bool,
|
9338
|
-
placeholder: PropTypes.string,
|
9343
|
+
placeholder: PropTypes.string.def("Enter"),
|
9339
9344
|
prefixIcon: PropTypes.string,
|
9340
9345
|
suffixIcon: PropTypes.string,
|
9341
9346
|
suffix: PropTypes.string,
|
@@ -11216,9 +11221,10 @@ var Component$a = defineComponent({
|
|
11216
11221
|
noMatchText: PropTypes.string.def("\u65E0\u5339\u914D\u6570\u636E"),
|
11217
11222
|
loadingText: PropTypes.string.def("\u52A0\u8F7D\u4E2D..."),
|
11218
11223
|
placeholder: PropTypes.string.def("\u8BF7\u9009\u62E9"),
|
11219
|
-
selectAllText: PropTypes.string.def("\u5168\u90E8")
|
11224
|
+
selectAllText: PropTypes.string.def("\u5168\u90E8"),
|
11225
|
+
scrollLoading: PropTypes.bool.def(false)
|
11220
11226
|
},
|
11221
|
-
emits: ["update:modelValue", "change", "toggle", "clear"],
|
11227
|
+
emits: ["update:modelValue", "change", "toggle", "clear", "scroll-end"],
|
11222
11228
|
setup(props, {
|
11223
11229
|
emit
|
11224
11230
|
}) {
|
@@ -11379,6 +11385,16 @@ var Component$a = defineComponent({
|
|
11379
11385
|
selectedCallback();
|
11380
11386
|
emitChange([...states.selectedOptions.values()].map((option) => option.value));
|
11381
11387
|
};
|
11388
|
+
const handleScroll = (e) => {
|
11389
|
+
const {
|
11390
|
+
scrollTop,
|
11391
|
+
clientHeight,
|
11392
|
+
scrollHeight
|
11393
|
+
} = e.target;
|
11394
|
+
if (scrollTop + clientHeight === scrollHeight) {
|
11395
|
+
emit("scroll-end");
|
11396
|
+
}
|
11397
|
+
};
|
11382
11398
|
const handleClickOutside = () => {
|
11383
11399
|
hidePopover();
|
11384
11400
|
handleBlur();
|
@@ -11432,7 +11448,8 @@ var Component$a = defineComponent({
|
|
11432
11448
|
showPopover,
|
11433
11449
|
handleToggleAll,
|
11434
11450
|
handleOptionSelected,
|
11435
|
-
handleClickOutside
|
11451
|
+
handleClickOutside,
|
11452
|
+
handleScroll
|
11436
11453
|
});
|
11437
11454
|
},
|
11438
11455
|
render() {
|
@@ -11456,6 +11473,7 @@ var Component$a = defineComponent({
|
|
11456
11473
|
const suffixIcon = () => {
|
11457
11474
|
if (this.loading) {
|
11458
11475
|
return createVNode(BkLoading, {
|
11476
|
+
"loading": true,
|
11459
11477
|
"class": "spinner",
|
11460
11478
|
"mode": "spin",
|
11461
11479
|
"size": "mini"
|
@@ -11523,6 +11541,7 @@ var Component$a = defineComponent({
|
|
11523
11541
|
"class": "bk-select-empty"
|
11524
11542
|
}, [this.searchLoading && createVNode(BkLoading, {
|
11525
11543
|
"class": "mr5",
|
11544
|
+
"loading": true,
|
11526
11545
|
"mode": "spin",
|
11527
11546
|
"size": "mini"
|
11528
11547
|
}, null), this.curContentText]), createVNode("div", {
|
@@ -11531,13 +11550,22 @@ var Component$a = defineComponent({
|
|
11531
11550
|
"class": "bk-select-dropdown",
|
11532
11551
|
"style": {
|
11533
11552
|
maxHeight: `${this.scrollHeight}px`
|
11534
|
-
}
|
11553
|
+
},
|
11554
|
+
"onScroll": this.handleScroll
|
11535
11555
|
}, [withDirectives(createVNode("ul", {
|
11536
11556
|
"class": "bk-select-options"
|
11537
11557
|
}, [this.multiple && this.showSelectAll && !this.searchKey && createVNode("li", {
|
11538
11558
|
"class": "bk-select-option",
|
11539
11559
|
"onClick": this.handleToggleAll
|
11540
|
-
}, [this.selectAllText]), (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
|
11560
|
+
}, [this.selectAllText]), (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a), this.scrollLoading && createVNode("li", {
|
11561
|
+
"class": "bk-select-options-loading"
|
11562
|
+
}, [createVNode(BkLoading, {
|
11563
|
+
"class": "spinner mr5",
|
11564
|
+
"theme": "primary",
|
11565
|
+
"loading": true,
|
11566
|
+
"mode": "spin",
|
11567
|
+
"size": "mini"
|
11568
|
+
}, null), this.loadingText])]), [[vShow, this.isShowSelectContent]])]), this.$slots.extension && createVNode("div", {
|
11541
11569
|
"class": "bk-select-extension"
|
11542
11570
|
}, [this.$slots.extension()])])]);
|
11543
11571
|
};
|
@@ -12124,6 +12152,241 @@ var Component$6 = defineComponent({
|
|
12124
12152
|
});
|
12125
12153
|
const BkVirtualRender = withInstall(Component$6);
|
12126
12154
|
const BORDER_OPRIONS = ["none", "row", "col", "outer"];
|
12155
|
+
const resolvePropVal = (prop, key, args) => {
|
12156
|
+
if (Object.prototype.hasOwnProperty.call(prop, key)) {
|
12157
|
+
if (typeof prop[key] === "function") {
|
12158
|
+
return prop[key].call(globalThis, ...args);
|
12159
|
+
}
|
12160
|
+
return prop[key];
|
12161
|
+
}
|
12162
|
+
return void 0;
|
12163
|
+
};
|
12164
|
+
const resolveNumberToNumArray = (prop) => {
|
12165
|
+
if (/^\d+$/.test(`${prop}`)) {
|
12166
|
+
return [parseInt(`${prop}`, 10)];
|
12167
|
+
}
|
12168
|
+
return [];
|
12169
|
+
};
|
12170
|
+
const resolveWidth = (propWidth) => resolveNumberOrStringToPix(propWidth, "auto");
|
12171
|
+
const resolveNumberOrStringToPix = (val, defaultValue = "100%", offset2 = null) => {
|
12172
|
+
let target = "";
|
12173
|
+
if (/^auto|null|undefined$/ig.test(`${val}`)) {
|
12174
|
+
target = defaultValue;
|
12175
|
+
} else {
|
12176
|
+
target = /^\d+\.?\d+$/.test(`${val}`) ? `${val}px` : val;
|
12177
|
+
}
|
12178
|
+
if (offset2) {
|
12179
|
+
target = `calc(${target} - ${offset2})`;
|
12180
|
+
}
|
12181
|
+
return target;
|
12182
|
+
};
|
12183
|
+
const resolvePropBorderToClassStr = (val) => {
|
12184
|
+
const defaultVal = ["row"];
|
12185
|
+
if (typeof val === "string") {
|
12186
|
+
defaultVal.push(val);
|
12187
|
+
}
|
12188
|
+
if (Array.isArray(val)) {
|
12189
|
+
defaultVal.push(...val.filter((str) => BORDER_OPRIONS.includes(str)));
|
12190
|
+
}
|
12191
|
+
return [...new Set(defaultVal)].map((item) => `bordered-${item}`).join(" ");
|
12192
|
+
};
|
12193
|
+
const resolveColumnWidth = (root, colgroups, autoWidth = 20) => {
|
12194
|
+
const {
|
12195
|
+
width
|
12196
|
+
} = root.getBoundingClientRect() || {};
|
12197
|
+
let avgWidth = width - 4;
|
12198
|
+
const avgColIndexList = [];
|
12199
|
+
const resolveColNumberWidth = (col, numWidth, resetAvgWidth = true) => {
|
12200
|
+
Object.assign(col, {
|
12201
|
+
calcWidth: numWidth
|
12202
|
+
});
|
12203
|
+
if (resetAvgWidth) {
|
12204
|
+
avgWidth = avgWidth - numWidth;
|
12205
|
+
if (avgWidth < 0) {
|
12206
|
+
avgWidth = 0;
|
12207
|
+
}
|
12208
|
+
}
|
12209
|
+
};
|
12210
|
+
colgroups.forEach((col, index) => {
|
12211
|
+
const colWidth = String(col.width);
|
12212
|
+
let isAutoWidthCol = true;
|
12213
|
+
if (/^\d+\.?\d*(px)?$/.test(colWidth)) {
|
12214
|
+
const numWidth = Number(colWidth.replace("px", ""));
|
12215
|
+
resolveColNumberWidth(col, numWidth);
|
12216
|
+
isAutoWidthCol = false;
|
12217
|
+
}
|
12218
|
+
if (/^\d+\.?\d*%$/.test(colWidth)) {
|
12219
|
+
let perWidth = autoWidth;
|
12220
|
+
if (avgWidth > 0) {
|
12221
|
+
const percent = Number(colWidth.replace("%", ""));
|
12222
|
+
perWidth = avgWidth * percent / 100;
|
12223
|
+
}
|
12224
|
+
resolveColNumberWidth(col, perWidth);
|
12225
|
+
isAutoWidthCol = false;
|
12226
|
+
}
|
12227
|
+
if (isAutoWidthCol) {
|
12228
|
+
avgColIndexList.push(index);
|
12229
|
+
}
|
12230
|
+
});
|
12231
|
+
if (avgColIndexList.length > 0) {
|
12232
|
+
let autoAvgWidth = autoWidth;
|
12233
|
+
if (avgWidth > 0) {
|
12234
|
+
autoAvgWidth = avgWidth / avgColIndexList.length;
|
12235
|
+
avgColIndexList.forEach((idx) => resolveColNumberWidth(colgroups[idx], autoAvgWidth, false));
|
12236
|
+
}
|
12237
|
+
}
|
12238
|
+
};
|
12239
|
+
const observerResize = (root, callbackFn, delay = 60, immediate = false) => {
|
12240
|
+
const callFn = lodash.exports.throttle(() => {
|
12241
|
+
if (typeof callbackFn === "function") {
|
12242
|
+
callbackFn();
|
12243
|
+
}
|
12244
|
+
}, delay);
|
12245
|
+
const resizeObserver = new ResizeObserver(() => {
|
12246
|
+
callFn();
|
12247
|
+
});
|
12248
|
+
if (immediate) {
|
12249
|
+
if (typeof callbackFn === "function") {
|
12250
|
+
callbackFn();
|
12251
|
+
}
|
12252
|
+
}
|
12253
|
+
return {
|
12254
|
+
start: () => {
|
12255
|
+
resizeObserver.observe(root);
|
12256
|
+
},
|
12257
|
+
stop: () => {
|
12258
|
+
resizeObserver.disconnect();
|
12259
|
+
resizeObserver.unobserve(root);
|
12260
|
+
}
|
12261
|
+
};
|
12262
|
+
};
|
12263
|
+
const isPercentPixOrNumber = (val) => /^\d+\.?\d*(px|%)?$/.test(`${val}`);
|
12264
|
+
const resolveHeadConfig = (props) => {
|
12265
|
+
const {
|
12266
|
+
showHead,
|
12267
|
+
headHeight,
|
12268
|
+
thead = {}
|
12269
|
+
} = props;
|
12270
|
+
return Object.assign({}, {
|
12271
|
+
isShow: showHead,
|
12272
|
+
height: headHeight
|
12273
|
+
}, __spreadValues({}, thead));
|
12274
|
+
};
|
12275
|
+
const getRowText = (row, key, column) => {
|
12276
|
+
if (column.type === "index") {
|
12277
|
+
return row.__$table_row_index;
|
12278
|
+
}
|
12279
|
+
return row[key];
|
12280
|
+
};
|
12281
|
+
const resolveActiveColumns = (props) => {
|
12282
|
+
if (props.columnPick !== "disabled") {
|
12283
|
+
if (props.columnPick === "multi") {
|
12284
|
+
return Array.isArray(props.activeColumn) ? props.activeColumn : resolveNumberToNumArray(props.activeColumn);
|
12285
|
+
}
|
12286
|
+
return Array.isArray(props.activeColumn) ? resolveNumberToNumArray(props.activeColumn[0]) : resolveNumberToNumArray(props.activeColumn);
|
12287
|
+
}
|
12288
|
+
return [];
|
12289
|
+
};
|
12290
|
+
var useActiveColumns = (props) => {
|
12291
|
+
let activeColumns = reactive([]);
|
12292
|
+
if (props.columnPick === "disabled") {
|
12293
|
+
return {
|
12294
|
+
activeColumns
|
12295
|
+
};
|
12296
|
+
}
|
12297
|
+
const activeCols = reactive(resolveActiveColumns(props));
|
12298
|
+
const getActiveColumns = () => (props.columns || []).map((_column, index) => ({
|
12299
|
+
index,
|
12300
|
+
active: activeCols.some((colIndex) => colIndex === index),
|
12301
|
+
_column
|
12302
|
+
}));
|
12303
|
+
watchEffect(() => {
|
12304
|
+
activeColumns = getActiveColumns();
|
12305
|
+
const cols = resolveActiveColumns(props);
|
12306
|
+
activeColumns.forEach((col, index) => {
|
12307
|
+
Object.assign(col, {
|
12308
|
+
active: cols.some((colIndex) => colIndex === index)
|
12309
|
+
});
|
12310
|
+
});
|
12311
|
+
});
|
12312
|
+
return {
|
12313
|
+
activeColumns
|
12314
|
+
};
|
12315
|
+
};
|
12316
|
+
const resolvePaginationOption = (propPagination, defVal) => {
|
12317
|
+
if (!!propPagination) {
|
12318
|
+
if (typeof propPagination === "object") {
|
12319
|
+
let current = Object.prototype.hasOwnProperty.call(propPagination, "current") ? propPagination.current : propPagination.value;
|
12320
|
+
if (!/\d+/.test(current)) {
|
12321
|
+
current = 1;
|
12322
|
+
}
|
12323
|
+
return __spreadProps(__spreadValues(__spreadValues({}, defVal), propPagination), {
|
12324
|
+
current
|
12325
|
+
});
|
12326
|
+
}
|
12327
|
+
return defVal;
|
12328
|
+
}
|
12329
|
+
return {};
|
12330
|
+
};
|
12331
|
+
var userPagination = (props) => {
|
12332
|
+
const startIndex = ref(0);
|
12333
|
+
const endIndex = ref(0);
|
12334
|
+
const indexData = computed(() => props.data.map((item, index) => __spreadProps(__spreadValues({}, item), {
|
12335
|
+
__$table_row_index: index + 1
|
12336
|
+
})));
|
12337
|
+
let pagination2 = reactive({
|
12338
|
+
count: 0,
|
12339
|
+
limit: 10,
|
12340
|
+
current: 1
|
12341
|
+
});
|
12342
|
+
pagination2 = resolvePaginationOption(props.pagination, pagination2);
|
12343
|
+
const resetStartEndIndex = () => {
|
12344
|
+
if (!props.pagination || props.remotePagination) {
|
12345
|
+
startIndex.value = 0;
|
12346
|
+
endIndex.value = props.data.length;
|
12347
|
+
return;
|
12348
|
+
}
|
12349
|
+
startIndex.value = (pagination2.current - 1) * pagination2.limit;
|
12350
|
+
endIndex.value = pagination2.current * pagination2.limit;
|
12351
|
+
};
|
12352
|
+
resetStartEndIndex();
|
12353
|
+
const pageData = reactive([]);
|
12354
|
+
const sort = (sortFn) => {
|
12355
|
+
if (typeof sortFn === "function") {
|
12356
|
+
pageData.sort(sortFn);
|
12357
|
+
}
|
12358
|
+
};
|
12359
|
+
const filter = (filterFn) => {
|
12360
|
+
if (typeof filterFn === "function") {
|
12361
|
+
const filterVals = pageData.filter((row, index) => filterFn(row, index, props.data));
|
12362
|
+
pageData.splice(0, pageData.length, ...filterVals);
|
12363
|
+
}
|
12364
|
+
};
|
12365
|
+
const resolvePageData = (filterFn, sortFn) => {
|
12366
|
+
pageData.splice(0, pageData.length, ...indexData.value.slice(startIndex.value, endIndex.value));
|
12367
|
+
filter(filterFn);
|
12368
|
+
sort(sortFn);
|
12369
|
+
};
|
12370
|
+
const watchEffectFn = (filterFn, sortFn) => {
|
12371
|
+
pagination2 = resolvePaginationOption(props.pagination, pagination2);
|
12372
|
+
resetStartEndIndex();
|
12373
|
+
resolvePageData(filterFn, sortFn);
|
12374
|
+
};
|
12375
|
+
const localPagination = computed(() => {
|
12376
|
+
if (!props.pagination) {
|
12377
|
+
return null;
|
12378
|
+
}
|
12379
|
+
return props.remotePagination ? pagination2 : __spreadProps(__spreadValues({}, pagination2), {
|
12380
|
+
count: props.data.length
|
12381
|
+
});
|
12382
|
+
});
|
12383
|
+
return {
|
12384
|
+
pageData,
|
12385
|
+
localPagination,
|
12386
|
+
resolvePageData,
|
12387
|
+
watchEffectFn
|
12388
|
+
};
|
12389
|
+
};
|
12127
12390
|
var SortScope = /* @__PURE__ */ ((SortScope2) => {
|
12128
12391
|
SortScope2["CURRENT"] = "current";
|
12129
12392
|
SortScope2["ALL"] = "all";
|
@@ -12608,156 +12871,6 @@ var Component$5 = defineComponent({
|
|
12608
12871
|
}
|
12609
12872
|
});
|
12610
12873
|
const BkPagination = withInstall(Component$5);
|
12611
|
-
const resolvePropVal = (prop, key, args) => {
|
12612
|
-
if (Object.prototype.hasOwnProperty.call(prop, key)) {
|
12613
|
-
if (typeof prop[key] === "function") {
|
12614
|
-
return prop[key].call(globalThis, ...args);
|
12615
|
-
}
|
12616
|
-
return prop[key];
|
12617
|
-
}
|
12618
|
-
return void 0;
|
12619
|
-
};
|
12620
|
-
const resolveActiveColumns = (props) => {
|
12621
|
-
if (props.columnPick !== "disabled") {
|
12622
|
-
if (props.columnPick === "multi") {
|
12623
|
-
return Array.isArray(props.activeColumn) ? props.activeColumn : resolveNumberToNumArray(props.activeColumn);
|
12624
|
-
}
|
12625
|
-
return Array.isArray(props.activeColumn) ? resolveNumberToNumArray(props.activeColumn[0]) : resolveNumberToNumArray(props.activeColumn);
|
12626
|
-
}
|
12627
|
-
return [];
|
12628
|
-
};
|
12629
|
-
const resolveNumberToNumArray = (prop) => {
|
12630
|
-
if (/^\d+$/.test(`${prop}`)) {
|
12631
|
-
return [parseInt(`${prop}`, 10)];
|
12632
|
-
}
|
12633
|
-
return [];
|
12634
|
-
};
|
12635
|
-
const resolveWidth = (propWidth) => resolveNumberOrStringToPix(propWidth, "auto");
|
12636
|
-
const resolveNumberOrStringToPix = (val, defaultValue = "100%", offset2 = null) => {
|
12637
|
-
let target = "";
|
12638
|
-
if (/^auto|null|undefined$/ig.test(`${val}`)) {
|
12639
|
-
target = defaultValue;
|
12640
|
-
} else {
|
12641
|
-
target = /^\d+\.?\d+$/.test(`${val}`) ? `${val}px` : val;
|
12642
|
-
}
|
12643
|
-
if (offset2) {
|
12644
|
-
target = `calc(${target} - ${offset2})`;
|
12645
|
-
}
|
12646
|
-
return target;
|
12647
|
-
};
|
12648
|
-
const resolvePropBorderToClassStr = (val) => {
|
12649
|
-
const defaultVal = ["row"];
|
12650
|
-
if (typeof val === "string") {
|
12651
|
-
defaultVal.push(val);
|
12652
|
-
}
|
12653
|
-
if (Array.isArray(val)) {
|
12654
|
-
defaultVal.push(...val.filter((str) => BORDER_OPRIONS.includes(str)));
|
12655
|
-
}
|
12656
|
-
return [...new Set(defaultVal)].map((item) => `bordered-${item}`).join(" ");
|
12657
|
-
};
|
12658
|
-
const resolveColumnWidth = (root, colgroups, autoWidth = 20) => {
|
12659
|
-
const {
|
12660
|
-
width
|
12661
|
-
} = root.getBoundingClientRect() || {};
|
12662
|
-
let avgWidth = width - 4;
|
12663
|
-
const avgColIndexList = [];
|
12664
|
-
const resolveColNumberWidth = (col, numWidth, resetAvgWidth = true) => {
|
12665
|
-
Object.assign(col, {
|
12666
|
-
calcWidth: numWidth
|
12667
|
-
});
|
12668
|
-
if (resetAvgWidth) {
|
12669
|
-
avgWidth = avgWidth - numWidth;
|
12670
|
-
if (avgWidth < 0) {
|
12671
|
-
avgWidth = 0;
|
12672
|
-
}
|
12673
|
-
}
|
12674
|
-
};
|
12675
|
-
colgroups.forEach((col, index) => {
|
12676
|
-
const colWidth = String(col.width);
|
12677
|
-
let isAutoWidthCol = true;
|
12678
|
-
if (/^\d+\.?\d*(px)?$/.test(colWidth)) {
|
12679
|
-
const numWidth = Number(colWidth.replace("px", ""));
|
12680
|
-
resolveColNumberWidth(col, numWidth);
|
12681
|
-
isAutoWidthCol = false;
|
12682
|
-
}
|
12683
|
-
if (/^\d+\.?\d*%$/.test(colWidth)) {
|
12684
|
-
let perWidth = autoWidth;
|
12685
|
-
if (avgWidth > 0) {
|
12686
|
-
const percent = Number(colWidth.replace("%", ""));
|
12687
|
-
perWidth = avgWidth * percent / 100;
|
12688
|
-
}
|
12689
|
-
resolveColNumberWidth(col, perWidth);
|
12690
|
-
isAutoWidthCol = false;
|
12691
|
-
}
|
12692
|
-
if (isAutoWidthCol) {
|
12693
|
-
avgColIndexList.push(index);
|
12694
|
-
}
|
12695
|
-
});
|
12696
|
-
if (avgColIndexList.length > 0) {
|
12697
|
-
let autoAvgWidth = autoWidth;
|
12698
|
-
if (avgWidth > 0) {
|
12699
|
-
autoAvgWidth = avgWidth / avgColIndexList.length;
|
12700
|
-
avgColIndexList.forEach((idx) => resolveColNumberWidth(colgroups[idx], autoAvgWidth, false));
|
12701
|
-
}
|
12702
|
-
}
|
12703
|
-
};
|
12704
|
-
const observerResize = (root, callbackFn, delay = 60, immediate = false) => {
|
12705
|
-
const callFn = lodash.exports.throttle(() => {
|
12706
|
-
if (typeof callbackFn === "function") {
|
12707
|
-
callbackFn();
|
12708
|
-
}
|
12709
|
-
}, delay);
|
12710
|
-
const resizeObserver = new ResizeObserver(() => {
|
12711
|
-
callFn();
|
12712
|
-
});
|
12713
|
-
if (immediate) {
|
12714
|
-
if (typeof callbackFn === "function") {
|
12715
|
-
callbackFn();
|
12716
|
-
}
|
12717
|
-
}
|
12718
|
-
return {
|
12719
|
-
start: () => {
|
12720
|
-
resizeObserver.observe(root);
|
12721
|
-
},
|
12722
|
-
stop: () => {
|
12723
|
-
resizeObserver.disconnect();
|
12724
|
-
resizeObserver.unobserve(root);
|
12725
|
-
}
|
12726
|
-
};
|
12727
|
-
};
|
12728
|
-
const isPercentPixOrNumber = (val) => /^\d+\.?\d*(px|%)?$/.test(`${val}`);
|
12729
|
-
const resolvePaginationOption = (propPagination, defVal) => {
|
12730
|
-
if (!!propPagination) {
|
12731
|
-
if (typeof propPagination === "object") {
|
12732
|
-
let current = Object.prototype.hasOwnProperty.call(propPagination, "current") ? propPagination.current : propPagination.value;
|
12733
|
-
if (!/\d+/.test(current)) {
|
12734
|
-
current = 1;
|
12735
|
-
}
|
12736
|
-
return __spreadProps(__spreadValues(__spreadValues({}, defVal), propPagination), {
|
12737
|
-
current
|
12738
|
-
});
|
12739
|
-
}
|
12740
|
-
return defVal;
|
12741
|
-
}
|
12742
|
-
return {};
|
12743
|
-
};
|
12744
|
-
const resolveHeadConfig = (props) => {
|
12745
|
-
const {
|
12746
|
-
showHead,
|
12747
|
-
headHeight,
|
12748
|
-
thead = {}
|
12749
|
-
} = props;
|
12750
|
-
return Object.assign({}, {
|
12751
|
-
isShow: showHead,
|
12752
|
-
height: headHeight
|
12753
|
-
}, __spreadValues({}, thead));
|
12754
|
-
};
|
12755
|
-
const getRowText = (row, key, column) => {
|
12756
|
-
if (column.type === "index") {
|
12757
|
-
return row.__$table_row_index;
|
12758
|
-
}
|
12759
|
-
return row[key];
|
12760
|
-
};
|
12761
12874
|
function _isSlot(s2) {
|
12762
12875
|
return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
|
12763
12876
|
}
|
@@ -12815,6 +12928,8 @@ var HeadFilter = defineComponent({
|
|
12815
12928
|
const handleBtnResetClick = () => {
|
12816
12929
|
if (state.checked.length) {
|
12817
12930
|
state.checked.splice(0, state.checked.length);
|
12931
|
+
isShow.value = false;
|
12932
|
+
nextTick(() => emit("change", state.checked, filterFn));
|
12818
12933
|
}
|
12819
12934
|
};
|
12820
12935
|
return () => createVNode(BkPopover, mergeProps({
|
@@ -13129,79 +13244,82 @@ class TableRender {
|
|
13129
13244
|
})]);
|
13130
13245
|
}
|
13131
13246
|
}
|
13247
|
+
const useClass = (props, root) => {
|
13248
|
+
const autoHeight = ref("auto");
|
13249
|
+
const tableClass = computed(() => classes({
|
13250
|
+
[resolveClassName("table")]: true
|
13251
|
+
}, resolvePropBorderToClassStr(props.border)));
|
13252
|
+
const headClass = classes({
|
13253
|
+
[resolveClassName("table-head")]: true
|
13254
|
+
});
|
13255
|
+
const contentClass = classes({
|
13256
|
+
[resolveClassName("table-body")]: true
|
13257
|
+
});
|
13258
|
+
const footerClass = classes({
|
13259
|
+
[resolveClassName("table-footer")]: true,
|
13260
|
+
["is-hidden"]: !props.pagination
|
13261
|
+
});
|
13262
|
+
const wrapperStyle = computed(() => ({
|
13263
|
+
minHeight: resolveNumberOrStringToPix(props.minHeight, "auto")
|
13264
|
+
}));
|
13265
|
+
const contentStyle = computed(() => {
|
13266
|
+
const isAutoHeight = !isPercentPixOrNumber(props.height);
|
13267
|
+
const resolveHeight = resolveNumberOrStringToPix(props.height);
|
13268
|
+
const resolveHeadHeight = props.showHead ? resolveNumberOrStringToPix(props.headHeight) : "0";
|
13269
|
+
const resolveFooterHeight = props.pagination ? 40 : 0;
|
13270
|
+
const contentHeight = `calc(${resolveHeight} - ${resolveHeadHeight} - ${resolveFooterHeight}px - 2px)`;
|
13271
|
+
return __spreadValues({
|
13272
|
+
display: "block"
|
13273
|
+
}, isAutoHeight ? { maxHeight: contentHeight } : { height: contentHeight });
|
13274
|
+
});
|
13275
|
+
onMounted(() => {
|
13276
|
+
resetTableHeight(root == null ? void 0 : root.value);
|
13277
|
+
});
|
13278
|
+
const resetTableHeight = (rootEl) => {
|
13279
|
+
if (rootEl) {
|
13280
|
+
const { height } = root.value.parentElement.getBoundingClientRect();
|
13281
|
+
autoHeight.value = `${height}px`;
|
13282
|
+
}
|
13283
|
+
};
|
13284
|
+
return { tableClass, headClass, contentClass, footerClass, wrapperStyle, contentStyle, resetTableHeight };
|
13285
|
+
};
|
13132
13286
|
var Component$4 = defineComponent({
|
13133
13287
|
name: "Table",
|
13134
13288
|
props: tableProps,
|
13135
13289
|
emits: ["columnPick", "rowClick", "rowDblClick", "pageLimitChange", "pageValueChange"],
|
13136
13290
|
setup(props, ctx) {
|
13137
|
-
const activeCols = reactive(resolveActiveColumns(props));
|
13138
13291
|
const colgroups = reactive(props.columns.map((col) => __spreadProps(__spreadValues({}, col), {
|
13139
13292
|
calcWidth: null
|
13140
13293
|
})));
|
13141
|
-
const startIndex = ref(0);
|
13142
|
-
const endIndex = ref(0);
|
13143
13294
|
let columnSortFn = null;
|
13144
13295
|
let columnFilterFn = null;
|
13145
|
-
let pagination2 = reactive({
|
13146
|
-
count: 0,
|
13147
|
-
limit: 10,
|
13148
|
-
current: 1
|
13149
|
-
});
|
13150
|
-
pagination2 = resolvePaginationOption(props.pagination, pagination2);
|
13151
|
-
const resetStartEndIndex = () => {
|
13152
|
-
if (!props.pagination || props.remotePagination) {
|
13153
|
-
startIndex.value = 0;
|
13154
|
-
endIndex.value = props.data.length;
|
13155
|
-
return;
|
13156
|
-
}
|
13157
|
-
startIndex.value = (pagination2.current - 1) * pagination2.limit;
|
13158
|
-
endIndex.value = pagination2.current * pagination2.limit;
|
13159
|
-
};
|
13160
|
-
resetStartEndIndex();
|
13161
13296
|
let observerIns = null;
|
13162
13297
|
const root = ref();
|
13163
|
-
const
|
13164
|
-
|
13165
|
-
|
13166
|
-
|
13167
|
-
|
13298
|
+
const {
|
13299
|
+
activeColumns
|
13300
|
+
} = useActiveColumns(props);
|
13301
|
+
const {
|
13302
|
+
pageData,
|
13303
|
+
localPagination,
|
13304
|
+
resolvePageData,
|
13305
|
+
watchEffectFn
|
13306
|
+
} = userPagination(props);
|
13307
|
+
const {
|
13308
|
+
tableClass,
|
13309
|
+
headClass,
|
13310
|
+
contentClass,
|
13311
|
+
footerClass,
|
13312
|
+
wrapperStyle,
|
13313
|
+
contentStyle
|
13314
|
+
} = useClass(props);
|
13168
13315
|
const reactiveProp = reactive({
|
13169
|
-
|
13170
|
-
|
13316
|
+
scrollTranslateY: 0,
|
13317
|
+
activeColumns
|
13171
13318
|
});
|
13172
|
-
|
13173
|
-
nextTick(() => {
|
13174
|
-
reactiveProp.activeColumns = getActiveColumns();
|
13175
|
-
const cols = resolveActiveColumns(props);
|
13176
|
-
reactiveProp.activeColumns.forEach((col, index) => {
|
13177
|
-
Object.assign(col, {
|
13178
|
-
active: cols.some((colIndex) => colIndex === index)
|
13179
|
-
});
|
13180
|
-
});
|
13181
|
-
});
|
13182
|
-
}, {
|
13183
|
-
deep: true
|
13184
|
-
});
|
13185
|
-
const indexData = computed(() => props.data.map((item, index) => __spreadProps(__spreadValues({}, item), {
|
13186
|
-
__$table_row_index: index + 1
|
13187
|
-
})));
|
13188
|
-
const pageData = reactive([]);
|
13189
|
-
const resolvePageData = () => {
|
13190
|
-
pageData.splice(0, pageData.length, ...indexData.value.slice(startIndex.value, endIndex.value));
|
13191
|
-
if (typeof columnFilterFn === "function") {
|
13192
|
-
const filterVals = pageData.filter((row, index) => columnFilterFn(row, index, props.data));
|
13193
|
-
pageData.splice(0, pageData.length, ...filterVals);
|
13194
|
-
}
|
13195
|
-
if (typeof columnSortFn === "function") {
|
13196
|
-
pageData.sort(columnSortFn);
|
13197
|
-
}
|
13198
|
-
};
|
13319
|
+
const tableRender = new TableRender(props, ctx, reactiveProp, colgroups);
|
13199
13320
|
watchEffect(() => {
|
13200
|
-
|
13201
|
-
resetStartEndIndex();
|
13202
|
-
resolvePageData();
|
13321
|
+
watchEffectFn(columnFilterFn, columnSortFn);
|
13203
13322
|
});
|
13204
|
-
const tableRender = new TableRender(props, ctx, reactiveProp, colgroups);
|
13205
13323
|
tableRender.on(EVENTS.ON_SORT_BY_CLICK, (args) => {
|
13206
13324
|
const {
|
13207
13325
|
sortFn
|
@@ -13213,48 +13331,11 @@ var Component$4 = defineComponent({
|
|
13213
13331
|
filterFn
|
13214
13332
|
} = args;
|
13215
13333
|
columnFilterFn = filterFn;
|
13216
|
-
resolvePageData();
|
13217
|
-
});
|
13218
|
-
const wrapperStyle = computed(() => ({
|
13219
|
-
minHeight: resolveNumberOrStringToPix(props.minHeight, "auto")
|
13220
|
-
}));
|
13221
|
-
const localPagination = computed(() => {
|
13222
|
-
if (!props.pagination) {
|
13223
|
-
return null;
|
13224
|
-
}
|
13225
|
-
return props.remotePagination ? pagination2 : __spreadProps(__spreadValues({}, pagination2), {
|
13226
|
-
count: props.data.length
|
13227
|
-
});
|
13228
|
-
});
|
13229
|
-
const contentStyle = computed(() => {
|
13230
|
-
const resolveHeight = resolveNumberOrStringToPix(props.height);
|
13231
|
-
const resolveHeadHeight = props.showHead ? resolveNumberOrStringToPix(props.headHeight) : "0";
|
13232
|
-
const isAutoHeight = !isPercentPixOrNumber(props.height);
|
13233
|
-
const resolveFooterHeight = props.pagination ? 40 : 0;
|
13234
|
-
const contentHeight = `calc(${resolveHeight} - ${resolveHeadHeight} - ${resolveFooterHeight}px - 2px)`;
|
13235
|
-
return __spreadValues({
|
13236
|
-
display: "block"
|
13237
|
-
}, isAutoHeight ? {
|
13238
|
-
maxHeight: contentHeight
|
13239
|
-
} : {
|
13240
|
-
height: contentHeight
|
13241
|
-
});
|
13242
|
-
});
|
13243
|
-
const tableClass = computed(() => classes({
|
13244
|
-
[resolveClassName("table")]: true
|
13245
|
-
}, resolvePropBorderToClassStr(props.border)));
|
13246
|
-
const headClass = classes({
|
13247
|
-
[resolveClassName("table-head")]: true
|
13248
|
-
});
|
13249
|
-
const contentClass = classes({
|
13250
|
-
[resolveClassName("table-body")]: true
|
13251
|
-
});
|
13252
|
-
const footerClass = classes({
|
13253
|
-
[resolveClassName("table-footer")]: true
|
13334
|
+
resolvePageData(columnFilterFn, columnSortFn);
|
13254
13335
|
});
|
13255
13336
|
const handleScrollChanged = (args) => {
|
13256
|
-
const
|
13257
|
-
reactiveProp.scrollTranslateY =
|
13337
|
+
const pagination2 = args[1];
|
13338
|
+
reactiveProp.scrollTranslateY = pagination2.translateY;
|
13258
13339
|
};
|
13259
13340
|
onMounted(() => {
|
13260
13341
|
observerIns = observerResize(root.value, () => {
|
@@ -20640,7 +20721,7 @@ var Dropdown = defineComponent({
|
|
20640
20721
|
disabled: PropTypes.bool.def(false),
|
20641
20722
|
extCls: PropTypes.string
|
20642
20723
|
},
|
20643
|
-
emits: ["showChange"],
|
20724
|
+
emits: ["showChange", "show", "hide"],
|
20644
20725
|
setup(props, {
|
20645
20726
|
emit
|
20646
20727
|
}) {
|
@@ -20661,12 +20742,20 @@ var Dropdown = defineComponent({
|
|
20661
20742
|
});
|
20662
20743
|
});
|
20663
20744
|
watch(() => props.disabled, (val) => handleUpdateDisabled(val));
|
20745
|
+
const afterShow = () => {
|
20746
|
+
emit("show");
|
20747
|
+
};
|
20748
|
+
const afterHidden = () => {
|
20749
|
+
emit("hide");
|
20750
|
+
};
|
20664
20751
|
const registerDropdown = () => {
|
20665
20752
|
if (props.disabled)
|
20666
20753
|
return;
|
20667
20754
|
popoverInstance = new BKPopover(reference2.value, refContent.value, {
|
20668
20755
|
placement: props.placement,
|
20669
|
-
trigger: props.trigger
|
20756
|
+
trigger: props.trigger,
|
20757
|
+
afterShow,
|
20758
|
+
afterHidden
|
20670
20759
|
});
|
20671
20760
|
props.trigger === "manual" && props.isShow && popoverInstance.show();
|
20672
20761
|
};
|