bkui-vue 0.0.1-beta.88 → 0.0.1-beta.90

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.esm.js CHANGED
@@ -208,20 +208,20 @@ function isShadowRoot(node) {
208
208
  }
209
209
  function applyStyles(_ref) {
210
210
  var state = _ref.state;
211
- Object.keys(state.elements).forEach(function(name2) {
212
- var style = state.styles[name2] || {};
213
- var attributes = state.attributes[name2] || {};
214
- var element = state.elements[name2];
211
+ Object.keys(state.elements).forEach(function(name) {
212
+ var style = state.styles[name] || {};
213
+ var attributes = state.attributes[name] || {};
214
+ var element = state.elements[name];
215
215
  if (!isHTMLElement(element) || !getNodeName(element)) {
216
216
  return;
217
217
  }
218
218
  Object.assign(element.style, style);
219
- Object.keys(attributes).forEach(function(name3) {
220
- var value = attributes[name3];
219
+ Object.keys(attributes).forEach(function(name2) {
220
+ var value = attributes[name2];
221
221
  if (value === false) {
222
- element.removeAttribute(name3);
222
+ element.removeAttribute(name2);
223
223
  } else {
224
- element.setAttribute(name3, value === true ? "" : value);
224
+ element.setAttribute(name2, value === true ? "" : value);
225
225
  }
226
226
  });
227
227
  });
@@ -246,10 +246,10 @@ function effect$2(_ref2) {
246
246
  Object.assign(state.elements.arrow.style, initialStyles.arrow);
247
247
  }
248
248
  return function() {
249
- Object.keys(state.elements).forEach(function(name2) {
250
- var element = state.elements[name2];
251
- var attributes = state.attributes[name2] || {};
252
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name2) ? state.styles[name2] : initialStyles[name2]);
249
+ Object.keys(state.elements).forEach(function(name) {
250
+ var element = state.elements[name];
251
+ var attributes = state.attributes[name] || {};
252
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
253
253
  var style = styleProperties.reduce(function(style2, property) {
254
254
  style2[property] = "";
255
255
  return style2;
@@ -428,7 +428,7 @@ var toPaddingObject = function toPaddingObject2(padding, state) {
428
428
  };
429
429
  function arrow(_ref) {
430
430
  var _state$modifiersData$;
431
- var state = _ref.state, name2 = _ref.name, options = _ref.options;
431
+ var state = _ref.state, name = _ref.name, options = _ref.options;
432
432
  var arrowElement = state.elements.arrow;
433
433
  var popperOffsets2 = state.modifiersData.popperOffsets;
434
434
  var basePlacement = getBasePlacement(state.placement);
@@ -452,7 +452,7 @@ function arrow(_ref) {
452
452
  var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
453
453
  var offset2 = within(min2, center, max2);
454
454
  var axisProp = axis;
455
- state.modifiersData[name2] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
455
+ state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
456
456
  }
457
457
  function effect$1(_ref2) {
458
458
  var state = _ref2.state, options = _ref2.options;
@@ -908,8 +908,8 @@ function getExpandedFallbackPlacements(placement) {
908
908
  return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
909
909
  }
910
910
  function flip(_ref) {
911
- var state = _ref.state, options = _ref.options, name2 = _ref.name;
912
- if (state.modifiersData[name2]._skip) {
911
+ var state = _ref.state, options = _ref.options, name = _ref.name;
912
+ if (state.modifiersData[name]._skip) {
913
913
  return;
914
914
  }
915
915
  var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
@@ -989,7 +989,7 @@ function flip(_ref) {
989
989
  }
990
990
  }
991
991
  if (state.placement !== firstFittingPlacement) {
992
- state.modifiersData[name2]._skip = true;
992
+ state.modifiersData[name]._skip = true;
993
993
  state.placement = firstFittingPlacement;
994
994
  state.reset = true;
995
995
  }
@@ -1024,7 +1024,7 @@ function isAnySideFullyClipped(overflow) {
1024
1024
  });
1025
1025
  }
1026
1026
  function hide(_ref) {
1027
- var state = _ref.state, name2 = _ref.name;
1027
+ var state = _ref.state, name = _ref.name;
1028
1028
  var referenceRect = state.rects.reference;
1029
1029
  var popperRect = state.rects.popper;
1030
1030
  var preventedOffsets = state.modifiersData.preventOverflow;
@@ -1038,7 +1038,7 @@ function hide(_ref) {
1038
1038
  var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1039
1039
  var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1040
1040
  var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1041
- state.modifiersData[name2] = {
1041
+ state.modifiersData[name] = {
1042
1042
  referenceClippingOffsets,
1043
1043
  popperEscapeOffsets,
1044
1044
  isReferenceHidden,
@@ -1073,7 +1073,7 @@ function distanceAndSkiddingToXY(placement, rects, offset2) {
1073
1073
  };
1074
1074
  }
1075
1075
  function offset(_ref2) {
1076
- var state = _ref2.state, options = _ref2.options, name2 = _ref2.name;
1076
+ var state = _ref2.state, options = _ref2.options, name = _ref2.name;
1077
1077
  var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
1078
1078
  var data2 = placements$1.reduce(function(acc, placement) {
1079
1079
  acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
@@ -1084,7 +1084,7 @@ function offset(_ref2) {
1084
1084
  state.modifiersData.popperOffsets.x += x2;
1085
1085
  state.modifiersData.popperOffsets.y += y2;
1086
1086
  }
1087
- state.modifiersData[name2] = data2;
1087
+ state.modifiersData[name] = data2;
1088
1088
  }
1089
1089
  var offset$1 = {
1090
1090
  name: "offset",
@@ -1094,8 +1094,8 @@ var offset$1 = {
1094
1094
  fn: offset
1095
1095
  };
1096
1096
  function popperOffsets(_ref) {
1097
- var state = _ref.state, name2 = _ref.name;
1098
- state.modifiersData[name2] = computeOffsets({
1097
+ var state = _ref.state, name = _ref.name;
1098
+ state.modifiersData[name] = computeOffsets({
1099
1099
  reference: state.rects.reference,
1100
1100
  element: state.rects.popper,
1101
1101
  strategy: "absolute",
@@ -1113,7 +1113,7 @@ function getAltAxis(axis) {
1113
1113
  return axis === "x" ? "y" : "x";
1114
1114
  }
1115
1115
  function preventOverflow(_ref) {
1116
- var state = _ref.state, options = _ref.options, name2 = _ref.name;
1116
+ var state = _ref.state, options = _ref.options, name = _ref.name;
1117
1117
  var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1118
1118
  var overflow = detectOverflow(state, {
1119
1119
  boundary,
@@ -1194,7 +1194,7 @@ function preventOverflow(_ref) {
1194
1194
  popperOffsets2[altAxis] = _preventedOffset;
1195
1195
  data2[altAxis] = _preventedOffset - _offset;
1196
1196
  }
1197
- state.modifiersData[name2] = data2;
1197
+ state.modifiersData[name] = data2;
1198
1198
  }
1199
1199
  var preventOverflow$1 = {
1200
1200
  name: "preventOverflow",
@@ -1395,12 +1395,12 @@ function popperGenerator(generatorOptions) {
1395
1395
  index = -1;
1396
1396
  continue;
1397
1397
  }
1398
- var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name2 = _state$orderedModifie.name;
1398
+ var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
1399
1399
  if (typeof fn2 === "function") {
1400
1400
  state = fn2({
1401
1401
  state,
1402
1402
  options: _options,
1403
- name: name2,
1403
+ name,
1404
1404
  instance
1405
1405
  }) || state;
1406
1406
  }
@@ -1427,11 +1427,11 @@ function popperGenerator(generatorOptions) {
1427
1427
  });
1428
1428
  function runModifierEffects() {
1429
1429
  state.orderedModifiers.forEach(function(_ref3) {
1430
- var name2 = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect2 = _ref3.effect;
1430
+ var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect2 = _ref3.effect;
1431
1431
  if (typeof effect2 === "function") {
1432
1432
  var cleanupFn = effect2({
1433
1433
  state,
1434
- name: name2,
1434
+ name,
1435
1435
  instance,
1436
1436
  options: options2
1437
1437
  });
@@ -2284,13 +2284,13 @@ class PropTypes extends propTypesNS {
2284
2284
  default: "top"
2285
2285
  });
2286
2286
  }
2287
- static commonType(types = [], name2 = "commonType") {
2288
- return j(name2.replace(/^\S/, (s2) => s2.toUpperCase()), {
2287
+ static commonType(types = [], name = "commonType") {
2288
+ return j(name.replace(/^\S/, (s2) => s2.toUpperCase()), {
2289
2289
  type: String,
2290
2290
  validator: (val) => {
2291
2291
  const valid = types.includes(val);
2292
2292
  if (!valid) {
2293
- console.error(`invalid ${name2}, ${val}, the ${name2} must be one of \u3010${types.join(" | ")}\u3011`);
2293
+ console.error(`invalid ${name}, ${val}, the ${name} must be one of \u3010${types.join(" | ")}\u3011`);
2294
2294
  }
2295
2295
  return valid;
2296
2296
  },
@@ -2405,7 +2405,7 @@ function generate(node, key, rootAttrs) {
2405
2405
  const bkIcon = (props, context) => {
2406
2406
  const _a = __spreadValues(__spreadValues({}, context.attrs), props), {
2407
2407
  data: data2,
2408
- name: name2,
2408
+ name,
2409
2409
  width,
2410
2410
  height,
2411
2411
  fill
@@ -2417,7 +2417,7 @@ const bkIcon = (props, context) => {
2417
2417
  "fill"
2418
2418
  ]);
2419
2419
  const rootAttrs = `width: ${width}; height: ${height}; fill: ${fill}`;
2420
- return createVNode("span", restProps, [generate(data2, name2, rootAttrs)]);
2420
+ return createVNode("span", restProps, [generate(data2, name, rootAttrs)]);
2421
2421
  };
2422
2422
  bkIcon.inheritAttrs = false;
2423
2423
  bkIcon.displayName = "bkIcon";
@@ -9126,8 +9126,8 @@ var Component$u = defineComponent({
9126
9126
  const newVal = handleNumber(props.step, false);
9127
9127
  ctx.emit(EVENTS$2.UPDATE, newVal);
9128
9128
  }
9129
- function getCls(name2) {
9130
- return `${inputClsPrefix.value}--${name2}`;
9129
+ function getCls(name) {
9130
+ return `${inputClsPrefix.value}--${name}`;
9131
9131
  }
9132
9132
  function handleVisibleChange() {
9133
9133
  pwdVisible.value = !pwdVisible.value;
@@ -10146,6 +10146,7 @@ const PopoverProps = __spreadValues({
10146
10146
  ]),
10147
10147
  boundary: PropTypes.oneOfType([PropTypes.string.def("parent"), PropTypes.instanceOf(HTMLElement)]),
10148
10148
  fixOnBoundary: PropTypes.bool.def(false),
10149
+ zIndex: PropTypes.number.def(void 0),
10149
10150
  stopBehaviors: PropTypes.oneOfType([
10150
10151
  PropTypes.arrayOf(PropTypes.commonType([
10151
10152
  "stopPropagation",
@@ -10162,6 +10163,7 @@ var Component$l = defineComponent({
10162
10163
  setup(props, ctx) {
10163
10164
  let isPopInstance = false;
10164
10165
  let popoverInstance = /* @__PURE__ */ Object.create(null);
10166
+ const localZIndex = ref(0);
10165
10167
  const {
10166
10168
  width,
10167
10169
  height,
@@ -10178,7 +10180,7 @@ var Component$l = defineComponent({
10178
10180
  const compStyle = computed(() => ({
10179
10181
  width: /^\d+$/.test(String(width.value)) ? `${width.value}px` : width.value,
10180
10182
  height: /^\d+$/.test(String(height.value)) ? `${height.value}px` : height.value,
10181
- zIndex: bkZIndexManager.getModalNextIndex()
10183
+ zIndex: localZIndex.value
10182
10184
  }));
10183
10185
  const themeList = ["dark", "light"];
10184
10186
  const compTheme = computed(() => {
@@ -10194,7 +10196,12 @@ var Component$l = defineComponent({
10194
10196
  const handlePopShow = (val) => {
10195
10197
  var _a, _b;
10196
10198
  if (isPopInstance) {
10197
- val ? (_a = popoverInstance.show) == null ? void 0 : _a.call(popoverInstance) : (_b = popoverInstance.hide) == null ? void 0 : _b.call(popoverInstance);
10199
+ if (val) {
10200
+ localZIndex.value = typeof props.zIndex === "number" ? props.zIndex : bkZIndexManager.getModalNextIndex();
10201
+ (_a = popoverInstance.show) == null ? void 0 : _a.call(popoverInstance);
10202
+ return;
10203
+ }
10204
+ (_b = popoverInstance.hide) == null ? void 0 : _b.call(popoverInstance);
10198
10205
  }
10199
10206
  };
10200
10207
  watch(() => props.isShow, (val) => {
@@ -10527,7 +10534,7 @@ const useRadio = () => {
10527
10534
  const formItem = useFormItem();
10528
10535
  const radioGroup = inject(radioGroupKey, EMPTY_OBJ);
10529
10536
  const isGroup = !isEmptyObj(radioGroup);
10530
- const isChecked = ref(props.checked);
10537
+ const isChecked = ref(false);
10531
10538
  const isDisabled = computed(() => {
10532
10539
  if (isGroup && radioGroup.props.disabled) {
10533
10540
  return true;
@@ -10537,6 +10544,8 @@ const useRadio = () => {
10537
10544
  if (isGroup) {
10538
10545
  watch(() => radioGroup.props.modelValue, (modelValue) => {
10539
10546
  isChecked.value = modelValue === props.label;
10547
+ }, {
10548
+ immediate: true
10540
10549
  });
10541
10550
  } else {
10542
10551
  watch(() => props.modelValue, (modelValue) => {
@@ -10670,7 +10679,6 @@ var RadioButton = defineComponent({
10670
10679
  } = useRadio();
10671
10680
  return {
10672
10681
  isFocused,
10673
- realName: name,
10674
10682
  isChecked,
10675
10683
  isDisabled,
10676
10684
  setChecked,
@@ -13022,6 +13030,7 @@ var EVENTS$1 = /* @__PURE__ */ ((EVENTS2) => {
13022
13030
  EVENTS2["ON_SORT_BY_CLICK"] = "onSortByClick";
13023
13031
  EVENTS2["ON_FILTER_CLICK"] = "onFilterClick";
13024
13032
  EVENTS2["ON_SETTING_CHANGE"] = "onSettingChange";
13033
+ EVENTS2["ON_ROW_EXPAND_CLICK"] = "onRowExpandClick";
13025
13034
  return EVENTS2;
13026
13035
  })(EVENTS$1 || {});
13027
13036
  var EMITEVENTS = /* @__PURE__ */ ((EMITEVENTS2) => {
@@ -13030,6 +13039,7 @@ var EMITEVENTS = /* @__PURE__ */ ((EMITEVENTS2) => {
13030
13039
  EMITEVENTS2["COLUMN_FILTER"] = "columnFilter";
13031
13040
  EMITEVENTS2["ROW_CLICK"] = "rowClick";
13032
13041
  EMITEVENTS2["ROW_DBL_CLICK"] = "rowDblClick";
13042
+ EMITEVENTS2["ROW_EXPAND_CLICK"] = "rowExpand";
13033
13043
  EMITEVENTS2["PAGE_LIMIT_CHANGE"] = "pageLimitChange";
13034
13044
  EMITEVENTS2["PAGE_VALUE_CHANGE"] = "pageValueChange";
13035
13045
  EMITEVENTS2["SETTING_CHANGE"] = "settingChange";
@@ -13043,671 +13053,407 @@ const EMIT_EVENT_TYPES = {
13043
13053
  ["columnSort"]: EMPTY$1,
13044
13054
  ["rowClick"]: EMPTY$1,
13045
13055
  ["rowDblClick"]: EMPTY$1,
13056
+ ["rowExpand"]: EMPTY$1,
13046
13057
  ["pageLimitChange"]: EMPTY$1,
13047
13058
  ["pageValueChange"]: EMPTY$1,
13048
13059
  ["settingChange"]: EMPTY$1,
13049
13060
  ["scrollBottom"]: EMPTY$1
13050
13061
  };
13051
- const resolvePropVal = (prop, key, args) => {
13052
- if (Object.prototype.hasOwnProperty.call(prop, key)) {
13053
- if (typeof prop[key] === "function") {
13054
- return prop[key].call(globalThis, ...args);
13055
- }
13056
- return prop[key];
13057
- }
13058
- return void 0;
13059
- };
13060
- const resolveNumberToNumArray = (prop) => {
13061
- if (/^\d+$/.test(`${prop}`)) {
13062
- return [parseInt(`${prop}`, 10)];
13063
- }
13064
- return [];
13065
- };
13066
- const resolveWidth = (propWidth) => resolveNumberOrStringToPix(propWidth, "auto");
13067
- const resolveNumberOrStringToPix = (val, defaultValue = "100%", offset2 = null) => {
13068
- let target = "";
13069
- if (/^auto|null|undefined$/ig.test(`${val}`)) {
13070
- target = defaultValue;
13071
- } else {
13072
- target = /^\d+\.?\d+$/.test(`${val}`) ? `${val}px` : val;
13073
- }
13074
- if (offset2) {
13075
- target = `calc(${target} - ${offset2})`;
13076
- }
13077
- return target;
13062
+ const TABLE_ROW_ATTRIBUTE = {
13063
+ ROW_INDEX: "__$table_row_index",
13064
+ ROW_UID: "__$uuid",
13065
+ ROW_EXPAND: "__row_expand"
13078
13066
  };
13079
- const resolvePropBorderToClassStr = (val) => {
13080
- const defaultVal = ["row"];
13081
- if (typeof val === "string") {
13082
- defaultVal.push(val);
13083
- }
13084
- if (Array.isArray(val)) {
13085
- defaultVal.push(...val.filter((str) => BORDER_OPRIONS.includes(str)));
13067
+ const resolvePaginationOption = (propPagination, defVal) => {
13068
+ if (!!propPagination) {
13069
+ if (typeof propPagination === "object") {
13070
+ let current = Object.prototype.hasOwnProperty.call(propPagination, "current") ? propPagination.current : propPagination.value;
13071
+ if (!/\d+/.test(current)) {
13072
+ current = 1;
13073
+ }
13074
+ return __spreadProps(__spreadValues(__spreadValues({}, defVal), propPagination), {
13075
+ current
13076
+ });
13077
+ }
13078
+ return defVal;
13086
13079
  }
13087
- return [...new Set(defaultVal)].map((item) => `bordered-${item}`).join(" ");
13088
- };
13089
- const getColumnReactWidth = (colmun, orders = ["resizeWidth", "calcWidth", "width"]) => {
13090
- var _a, _b;
13091
- return (_b = (_a = colmun[orders[0]]) != null ? _a : colmun[orders[1]]) != null ? _b : colmun[orders[2]];
13080
+ return {};
13092
13081
  };
13093
- const resolveColumnWidth = (root, colgroups, autoWidth = 20) => {
13094
- const {
13095
- width
13096
- } = root.getBoundingClientRect() || {};
13097
- let avgWidth = width - 4;
13098
- const avgColIndexList = [];
13099
- const getMinWidth = (col, computedWidth) => {
13100
- const {
13101
- minWidth = void 0
13102
- } = col;
13103
- if (minWidth === void 0) {
13104
- return computedWidth;
13105
- }
13106
- let calcMinWidth = computedWidth;
13107
- if (/^\d+\.?\d*$/.test(`${minWidth}`)) {
13108
- calcMinWidth = Number(minWidth);
13109
- }
13110
- if (/^\d+\.?\d*%$/.test(`${minWidth}`)) {
13111
- calcMinWidth = Number(minWidth) * width / 100;
13112
- }
13113
- if (/^\d+\.?\d*px$/i.test(`${minWidth}`)) {
13114
- calcMinWidth = Number(`${minWidth}`.replace(/px/i, ""));
13082
+ var userPagination = (props, indexData) => {
13083
+ const startIndex = ref(0);
13084
+ const endIndex = ref(0);
13085
+ let pagination2 = reactive({
13086
+ count: 0,
13087
+ limit: 10,
13088
+ current: 1
13089
+ });
13090
+ pagination2 = resolvePaginationOption(props.pagination, pagination2);
13091
+ const localPagination = ref(null);
13092
+ const resetStartEndIndex = () => {
13093
+ if (!props.pagination || props.remotePagination) {
13094
+ startIndex.value = 0;
13095
+ endIndex.value = props.data.length;
13096
+ return;
13115
13097
  }
13116
- return calcMinWidth;
13098
+ startIndex.value = (pagination2.current - 1) * pagination2.limit;
13099
+ endIndex.value = pagination2.current * pagination2.limit;
13117
13100
  };
13118
- const resolveColNumberWidth = (col, numWidth, resetAvgWidth = true) => {
13119
- const minWidth = getMinWidth(col, numWidth);
13120
- const computedWidth = numWidth < minWidth ? minWidth : numWidth;
13121
- Object.assign(col, {
13122
- calcWidth: computedWidth
13123
- });
13124
- if (resetAvgWidth) {
13125
- avgWidth = avgWidth - computedWidth;
13126
- if (avgWidth < 0) {
13127
- avgWidth = 0;
13128
- }
13101
+ const pageData = reactive([]);
13102
+ const sort = (sortFn) => {
13103
+ if (typeof sortFn === "function") {
13104
+ pageData.sort(sortFn);
13129
13105
  }
13130
13106
  };
13131
- colgroups.forEach((col, index) => {
13132
- if (!col.isHidden) {
13133
- const colWidth = String(getColumnReactWidth(col));
13134
- let isAutoWidthCol = true;
13135
- if (/^\d+\.?\d*(px)?$/.test(colWidth)) {
13136
- const numWidth = Number(colWidth.replace("px", ""));
13137
- resolveColNumberWidth(col, numWidth);
13138
- isAutoWidthCol = false;
13139
- }
13140
- if (/^\d+\.?\d*%$/.test(colWidth)) {
13141
- let perWidth = autoWidth;
13142
- if (avgWidth > 0) {
13143
- const percent = Number(colWidth.replace("%", ""));
13144
- perWidth = avgWidth * percent / 100;
13145
- }
13146
- resolveColNumberWidth(col, perWidth);
13147
- isAutoWidthCol = false;
13148
- }
13149
- if (isAutoWidthCol) {
13150
- avgColIndexList.push(index);
13151
- }
13107
+ const filter = (filterFn) => {
13108
+ if (typeof filterFn === "function") {
13109
+ const filterVals = pageData.filter((row, index) => filterFn(row, index, props.data));
13110
+ pageData.splice(0, pageData.length, ...filterVals);
13152
13111
  }
13153
- });
13154
- if (avgColIndexList.length > 0) {
13155
- let autoAvgWidth = autoWidth;
13156
- if (avgWidth > 0) {
13157
- autoAvgWidth = avgWidth / avgColIndexList.length;
13158
- avgColIndexList.forEach((idx) => resolveColNumberWidth(colgroups[idx], autoAvgWidth, false));
13112
+ };
13113
+ const resolvePageData = (filterFn, sortFn) => {
13114
+ pageData.splice(0, pageData.length, ...indexData.slice(startIndex.value, endIndex.value));
13115
+ filter(filterFn);
13116
+ sort(sortFn);
13117
+ };
13118
+ const watchEffectFn = (filterFn, sortFn) => {
13119
+ pagination2 = resolvePaginationOption(props.pagination, pagination2);
13120
+ resolveLocalPagination();
13121
+ resetStartEndIndex();
13122
+ resolvePageData(filterFn, sortFn);
13123
+ };
13124
+ const resolveLocalPagination = () => {
13125
+ if (!props.pagination) {
13126
+ return;
13159
13127
  }
13160
- }
13128
+ localPagination.value = props.remotePagination ? pagination2 : __spreadProps(__spreadValues({}, pagination2), {
13129
+ count: props.data.length
13130
+ });
13131
+ };
13132
+ return {
13133
+ pageData,
13134
+ localPagination,
13135
+ resolvePageData,
13136
+ watchEffectFn
13137
+ };
13161
13138
  };
13162
- const observerResize = (root, callbackFn, delay = 60, immediate = false) => {
13163
- const callFn = lodash.exports.throttle(() => {
13164
- if (typeof callbackFn === "function") {
13165
- callbackFn();
13139
+ var useScrollLoading = (props, ctx) => {
13140
+ const refScrollLoading = toRef(props, "scrollLoading");
13141
+ const getLoadingOption = () => {
13142
+ if (typeof refScrollLoading.value === "boolean") {
13143
+ return {
13144
+ loading: !!refScrollLoading.value,
13145
+ inline: true,
13146
+ title: "",
13147
+ size: BkLoadingSize.Normal,
13148
+ mode: BkLoadingMode.Default,
13149
+ indicator: null
13150
+ };
13166
13151
  }
13167
- }, delay);
13168
- const resizeObserver = new ResizeObserver(() => {
13169
- callFn();
13170
- });
13171
- if (immediate) {
13172
- if (typeof callbackFn === "function") {
13173
- callbackFn();
13152
+ return refScrollLoading.value;
13153
+ };
13154
+ const isRender = computed(() => refScrollLoading.value !== null && (typeof refScrollLoading.value === "boolean" && refScrollLoading.value || typeof refScrollLoading.value === "object"));
13155
+ const renderScrollLoading = () => {
13156
+ var _a, _b, _c;
13157
+ if (isRender.value) {
13158
+ const {
13159
+ loading: loading2,
13160
+ size,
13161
+ mode,
13162
+ title,
13163
+ inline,
13164
+ indicator
13165
+ } = getLoadingOption();
13166
+ return (_c = (_b = (_a = ctx.slots).fixedBottom) == null ? void 0 : _b.call(_a)) != null ? _c : createVNode(BkLoading, {
13167
+ loading: loading2,
13168
+ size,
13169
+ mode,
13170
+ title,
13171
+ inline,
13172
+ indicator
13173
+ }, null);
13174
13174
  }
13175
- }
13175
+ };
13176
13176
  return {
13177
- start: () => {
13178
- resizeObserver.observe(root);
13179
- },
13180
- stop: () => {
13181
- resizeObserver.disconnect();
13182
- resizeObserver.unobserve(root);
13183
- }
13177
+ renderScrollLoading
13184
13178
  };
13185
13179
  };
13186
- const resolveHeadConfig = (props) => {
13187
- const {
13188
- showHead,
13189
- headHeight,
13190
- thead = {}
13191
- } = props;
13192
- return Object.assign({}, {
13193
- isShow: showHead,
13194
- height: headHeight
13195
- }, __spreadValues({}, thead));
13196
- };
13197
- const getRowText = (row, key, column) => {
13198
- if (column.type === "index") {
13199
- return row.__$table_row_index;
13200
- }
13201
- return row[key];
13202
- };
13203
- const formatPropAsArray = (prop, args) => {
13204
- if (Array.isArray(prop)) {
13205
- return prop;
13206
- }
13207
- if (typeof prop === "string" || typeof prop === "object") {
13208
- return [prop];
13209
- }
13210
- if (typeof prop === "function") {
13211
- return formatPropAsArray(Reflect.apply(prop, globalThis, args), args);
13212
- }
13213
- return [];
13214
- };
13215
- const resolveActiveColumns = (props) => {
13216
- if (props.columnPick !== "disabled") {
13217
- if (props.columnPick === "multi") {
13218
- return Array.isArray(props.activeColumn) ? props.activeColumn : resolveNumberToNumArray(props.activeColumn);
13219
- }
13220
- return Array.isArray(props.activeColumn) ? resolveNumberToNumArray(props.activeColumn[0]) : resolveNumberToNumArray(props.activeColumn);
13221
- }
13222
- return [];
13180
+ var SortScope = /* @__PURE__ */ ((SortScope2) => {
13181
+ SortScope2["CURRENT"] = "current";
13182
+ SortScope2["ALL"] = "all";
13183
+ return SortScope2;
13184
+ })(SortScope || {});
13185
+ const tableProps = {
13186
+ data: PropTypes.arrayOf(PropTypes.any).def([]),
13187
+ columns: PropTypes.arrayOf(PropTypes.shape({
13188
+ label: PropTypes.oneOfType([PropTypes.func.def(() => ""), PropTypes.string.def("")]),
13189
+ field: PropTypes.oneOfType([PropTypes.func.def(() => ""), PropTypes.string.def("")]),
13190
+ render: PropTypes.oneOfType([PropTypes.func.def(() => ""), PropTypes.string.def("")]),
13191
+ width: PropTypes.oneOfType([PropTypes.number.def(void 0), PropTypes.string.def("auto")]),
13192
+ minWidth: PropTypes.oneOfType([PropTypes.number.def(void 0), PropTypes.string.def("auto")]).def(),
13193
+ type: PropTypes.commonType(["selection", "index", "expand", "none"], "columnType").def("none"),
13194
+ resizable: PropTypes.bool.def(true),
13195
+ fixed: PropTypes.oneOfType([
13196
+ PropTypes.bool,
13197
+ PropTypes.commonType(["left", "right"], "fixed")
13198
+ ]).def(false),
13199
+ sort: PropTypes.oneOfType([
13200
+ PropTypes.shape({
13201
+ sortFn: PropTypes.func.def(void 0),
13202
+ sortScope: PropTypes.commonType(Object.values(SortScope)).def("current")
13203
+ }),
13204
+ PropTypes.bool,
13205
+ PropTypes.string
13206
+ ]).def(false),
13207
+ filter: PropTypes.oneOfType([
13208
+ PropTypes.shape({
13209
+ list: PropTypes.arrayOf(PropTypes.any).def([]),
13210
+ filterFn: PropTypes.func.def(void 0)
13211
+ }),
13212
+ PropTypes.bool,
13213
+ PropTypes.string
13214
+ ]).def(false)
13215
+ })).def([]),
13216
+ activeColumn: PropTypes.oneOfType([PropTypes.number.def(-1), PropTypes.arrayOf(PropTypes.number.def(-1))]),
13217
+ columnPick: PropTypes.commonType(["multi", "single", "disabled"], "columnPick").def("disabled"),
13218
+ height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def("auto"),
13219
+ minHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def(200),
13220
+ maxHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def("auto"),
13221
+ rowHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.func]).def(40),
13222
+ headHeight: PropTypes.number.def(40),
13223
+ showHead: PropTypes.bool.def(true),
13224
+ thead: PropTypes.shape({
13225
+ height: PropTypes.number.def(40),
13226
+ isShow: PropTypes.bool.def(true),
13227
+ cellFn: PropTypes.func.def(void 0)
13228
+ }),
13229
+ virtualEnabled: PropTypes.bool.def(false),
13230
+ border: PropTypes.arrayOf(PropTypes.commonType(BORDER_OPRIONS, "border")).def(["row"]),
13231
+ pagination: PropTypes.oneOfType([PropTypes.bool.def(false), PropTypes.object.def({})]).def(false),
13232
+ remotePagination: PropTypes.bool.def(false),
13233
+ emptyText: PropTypes.string.def("\u6682\u65E0\u6570\u636E"),
13234
+ settings: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
13235
+ fields: PropTypes.shape([]).def(void 0),
13236
+ checked: PropTypes.shape([]).def(void 0),
13237
+ limit: PropTypes.number.def(void 0),
13238
+ size: PropTypes.size(["small", "default", "large"]).def("default"),
13239
+ sizeList: PropTypes.shape([]).def(void 0)
13240
+ })]).def(false),
13241
+ rowClass: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13242
+ rowStyle: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13243
+ cellStyle: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13244
+ cellClass: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13245
+ scrollLoading: PropTypes.oneOfType([
13246
+ PropTypes.object,
13247
+ PropTypes.bool
13248
+ ]).def(void 0),
13249
+ reserveExpand: PropTypes.bool.def(false),
13250
+ rowKey: PropTypes.oneOfType([
13251
+ PropTypes.string,
13252
+ PropTypes.func
13253
+ ]).def(void 0)
13223
13254
  };
13224
- var useActiveColumns = (props) => {
13225
- let activeColumns = reactive([]);
13226
- if (props.columnPick === "disabled") {
13227
- return {
13228
- activeColumns
13229
- };
13230
- }
13231
- const activeCols = reactive(resolveActiveColumns(props));
13232
- const getActiveColumns = () => (props.columns || []).map((_column, index) => ({
13233
- index,
13234
- active: activeCols.some((colIndex) => colIndex === index),
13235
- _column
13236
- }));
13237
- watchEffect(() => {
13238
- activeColumns = getActiveColumns();
13239
- const cols = resolveActiveColumns(props);
13240
- activeColumns.forEach((col, index) => {
13241
- Object.assign(col, {
13242
- active: cols.some((colIndex) => colIndex === index)
13243
- });
13255
+ function _isSlot$2(s2) {
13256
+ return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
13257
+ }
13258
+ var useLimit = () => {
13259
+ const {
13260
+ proxy
13261
+ } = getCurrentInstance();
13262
+ const localLimit = ref(proxy.limit);
13263
+ watch(() => proxy.limit, (limit) => {
13264
+ localLimit.value = limit;
13265
+ });
13266
+ watch(() => proxy.limitList, (limitList) => {
13267
+ nextTick(() => {
13268
+ if (!limitList.includes(localLimit.value)) {
13269
+ [localLimit.value] = limitList;
13270
+ }
13244
13271
  });
13272
+ }, {
13273
+ immediate: true
13245
13274
  });
13246
- return {
13247
- activeColumns
13248
- };
13249
- };
13250
- var useColumnResize = (colgroups, immediate = true) => {
13251
- const pluginName = "HeadColumnResize";
13252
- let EVENTS2;
13253
- (function(EVENTS3) {
13254
- EVENTS3["MOUSE_MOVE"] = "onMousemove";
13255
- EVENTS3["MOUSE_OUT"] = "onMouseout";
13256
- EVENTS3["MOUSE_DOWN"] = "onMousedown";
13257
- })(EVENTS2 || (EVENTS2 = {}));
13258
- let isInDragSection = false;
13259
- let isMouseDown = false;
13260
- let isDraging = false;
13261
- let startX = 0;
13262
- let dragColumn = null;
13263
- let dragStartOffsetX = 0;
13264
- const dragOffsetX = ref(-1e3);
13265
- const handleMouseUp = (e) => {
13266
- var _a;
13267
- isMouseDown = false;
13268
- isDraging = false;
13269
- const bodyStyle = document.body.style;
13270
- bodyStyle.cursor = "";
13271
- const diff = e.clientX - startX;
13272
- dragColumn.resizeWidth = ((_a = dragColumn.resizeWidth) != null ? _a : dragColumn.calcWidth) + diff;
13273
- document.removeEventListener("mouseup", handleMouseUp);
13274
- document.removeEventListener("mousemove", handleMouseMove);
13275
- startX = 0;
13276
- dragOffsetX.value = -1e3;
13277
- dragColumn = null;
13278
- const targetTable = e.target.closest("table");
13279
- targetTable.querySelectorAll("th").forEach((th) => th.style.setProperty("user-select", "inherit"));
13280
- };
13281
- const handleMouseMove = (e) => {
13282
- const bodyStyle = document.body.style;
13283
- bodyStyle.setProperty("cursor", "");
13284
- dragOffsetX.value = e.clientX - startX + dragStartOffsetX;
13275
+ const handleLimitChange = (limit) => {
13276
+ localLimit.value = limit;
13285
13277
  };
13286
- const handler = {
13287
- [EVENTS2.MOUSE_DOWN]: (e, column) => {
13288
- if (!isInDragSection) {
13289
- return;
13290
- }
13291
- isMouseDown = true;
13292
- const bodyStyle = document.body.style;
13293
- bodyStyle.setProperty("cursor", "col-resize");
13294
- dragColumn = column;
13295
- startX = e.clientX;
13296
- const targetTable = e.target.closest("table");
13297
- dragStartOffsetX = startX - targetTable.getBoundingClientRect().left;
13298
- document.addEventListener("mouseup", handleMouseUp);
13299
- document.addEventListener("mousemove", handleMouseMove);
13300
- },
13301
- [EVENTS2.MOUSE_MOVE]: (e, _column) => {
13302
- if (isMouseDown && !isDraging) {
13303
- isDraging = true;
13304
- }
13305
- const target = e.target.closest("th");
13306
- if (isDraging) {
13307
- target.style.setProperty("user-select", "none");
13308
- }
13309
- if (!isDraging) {
13310
- if (!target) {
13311
- return;
13312
- }
13313
- const rect = target.getBoundingClientRect();
13314
- if (rect.width > 12 && rect.right - e.pageX < 8) {
13315
- isInDragSection = true;
13316
- target.style.setProperty("cursor", "col-resize");
13317
- } else {
13318
- isInDragSection = false;
13319
- }
13320
- }
13321
- },
13322
- [EVENTS2.MOUSE_OUT]: (e, _column) => {
13323
- const target = e.target;
13324
- if (!isDraging) {
13325
- target.style.setProperty("cursor", "");
13326
- }
13278
+ const render2 = ({
13279
+ isFirst,
13280
+ isLast
13281
+ }) => {
13282
+ let _slot;
13283
+ if (!proxy.showLimit) {
13284
+ return null;
13327
13285
  }
13328
- };
13329
- const getEventName = (event) => `${pluginName}_${event}`;
13330
- const registerResizeEvent = () => {
13331
- colgroups.forEach((col) => {
13332
- if (col.resizable !== false) {
13333
- Object.keys(handler).forEach((event) => {
13334
- const name2 = getEventName(event);
13335
- if (!col.listeners.has(name2)) {
13336
- col.listeners.set(name2, []);
13337
- }
13338
- col.listeners.get(name2).push(handler[event]);
13339
- });
13286
+ return createVNode("div", mergeProps({
13287
+ "class": {
13288
+ "bk-pagination-limit": true,
13289
+ "is-first": isFirst,
13290
+ "is-last": isLast
13340
13291
  }
13341
- });
13342
- };
13343
- const resetResizeEvents = () => {
13344
- colgroups.forEach((col) => {
13345
- Object.keys(handler).forEach((event) => {
13346
- const name2 = getEventName(event);
13347
- if (col.listeners.has(name2)) {
13348
- const listeners = col.listeners.get(name2);
13349
- listeners.splice(0, listeners.length);
13350
- }
13351
- });
13352
- });
13292
+ }, {
13293
+ disabled: proxy.disabled
13294
+ }), [createVNode("div", null, [createTextVNode("\u6BCF\u9875")]), createVNode(BkSelect, {
13295
+ "class": "bk-pagination-limit-select",
13296
+ "clearable": false,
13297
+ "modelValue": localLimit.value,
13298
+ "onChange": handleLimitChange,
13299
+ "disabled": proxy.disabled
13300
+ }, _isSlot$2(_slot = proxy.limitList.map((num, index) => createVNode(BkOption, {
13301
+ "value": num,
13302
+ "label": `${num}`,
13303
+ "key": `${index}_${num}`
13304
+ }, null))) ? _slot : {
13305
+ default: () => [_slot]
13306
+ }), createVNode("div", null, [createTextVNode("\u6761")])]);
13353
13307
  };
13354
- if (immediate) {
13355
- registerResizeEvent();
13356
- }
13357
- const dragOffsetXStyle = computed(() => ({
13358
- position: "absolute",
13359
- top: 0,
13360
- bottom: 0,
13361
- left: `${dragOffsetX.value}px`,
13362
- width: "1px",
13363
- "background-color": "#ebeef5"
13364
- }));
13365
13308
  return {
13366
- registerResizeEvent,
13367
- resetResizeEvents,
13368
- dragOffsetX,
13369
- dragOffsetXStyle
13309
+ limit: localLimit,
13310
+ render: render2
13370
13311
  };
13371
13312
  };
13372
- var useFixedColumn = (props, colgroups) => {
13373
- const footHeight = computed(() => props.pagination && props.data.length ? 40 : 0);
13374
- const resolveColumnClass = (column) => ({
13375
- column_fixed: !!column.fixed,
13376
- column_fixed_left: column.fixed !== "right",
13377
- column_fixed_right: column.fixed === "right"
13313
+ const PAGE_ITEMS_NUM = 5;
13314
+ var useList = () => {
13315
+ const {
13316
+ proxy
13317
+ } = getCurrentInstance();
13318
+ const localCurrent = ref(1);
13319
+ const isPagePreDisabled = computed(() => localCurrent.value === 1);
13320
+ const isPageNextDisabled = computed(() => localCurrent.value === proxy.totalPageNum);
13321
+ const showPreBatch = ref(false);
13322
+ const showNextBatch = ref(false);
13323
+ const list = computed(() => {
13324
+ showPreBatch.value = false;
13325
+ showNextBatch.value = false;
13326
+ const stack = [];
13327
+ if (proxy.totalPageNum <= PAGE_ITEMS_NUM) {
13328
+ for (let i = 2; i <= proxy.totalPageNum - 1; i++) {
13329
+ stack.push(i);
13330
+ }
13331
+ return stack;
13332
+ }
13333
+ const pageItemsNumHalf = Math.floor(PAGE_ITEMS_NUM / 2);
13334
+ if (proxy.totalPageNum > PAGE_ITEMS_NUM) {
13335
+ showPreBatch.value = localCurrent.value - pageItemsNumHalf > 2;
13336
+ showNextBatch.value = localCurrent.value + pageItemsNumHalf < proxy.totalPageNum - 1;
13337
+ }
13338
+ const start2 = Math.min(proxy.totalPageNum - PAGE_ITEMS_NUM, Math.max(2, localCurrent.value - pageItemsNumHalf));
13339
+ for (let i = start2; i < start2 + PAGE_ITEMS_NUM; i++) {
13340
+ stack.push(i);
13341
+ }
13342
+ return stack;
13378
13343
  });
13379
- const resolveFixColPos = (column) => column.fixed === "right" ? "right" : "left";
13380
- const resolveFixOffset = {
13381
- left: (ignoreFirst = true) => colgroups.filter((col) => col.fixed && col.fixed !== "right").reduce((offset2, curr, index) => {
13382
- const outOffset = ignoreFirst && index === 0 ? offset2 : offset2 + getColumnReactWidth(curr);
13383
- return outOffset;
13384
- }, 0),
13385
- right: (ignoreFirst = true) => colgroups.filter((col) => col.fixed === "right").reduce((offset2, curr, index) => {
13386
- const outOffset = ignoreFirst && index === 0 ? offset2 : offset2 + getColumnReactWidth(curr);
13387
- return outOffset;
13388
- }, 0)
13389
- };
13390
- const reolveFixRightOffset = resolveFixOffset.right;
13391
- const getFixedColumnStyleResolve = () => {
13392
- const resolveFixedColumnStyle = (column, fixedoffset2) => {
13393
- if (!column.fixed) {
13394
- return {};
13344
+ watch(() => proxy.modelValue, (modelValue) => {
13345
+ nextTick(() => {
13346
+ if (modelValue >= 1 && modelValue <= proxy.totalPageNum) {
13347
+ localCurrent.value = modelValue;
13348
+ } else if (modelValue < 1) {
13349
+ localCurrent.value = 1;
13350
+ } else {
13351
+ localCurrent.value = proxy.totalPageNum;
13395
13352
  }
13396
- const fixedPos = resolveFixColPos(column);
13397
- const opt = fixedPos === "right" ? -1 : 1;
13398
- const offsetX = `${fixedoffset2[fixedPos]}px`;
13399
- fixedoffset2[fixedPos] = fixedoffset2[fixedPos] + getColumnReactWidth(column) * opt;
13400
- return {
13401
- [fixedPos]: offsetX
13402
- };
13403
- };
13404
- const rightOffsetWidth = reolveFixRightOffset(true);
13405
- const fixedoffset = {
13406
- left: 0,
13407
- right: rightOffsetWidth
13408
- };
13409
- return {
13410
- fixedoffset,
13411
- resolveFixedColumnStyle
13412
- };
13413
- };
13414
- const renderFixedColumns = () => {
13415
- const resolveColumnStyle = (colPos) => ({
13416
- width: `${resolveFixOffset[colPos](false)}px`,
13417
- bottom: `${footHeight.value}px`
13418
- });
13419
- const colPosExist = {
13420
- left: false,
13421
- right: false
13422
- };
13423
- return colgroups.filter((col) => !col.isHidden && col.fixed).map((col) => {
13424
- const colPos = resolveFixColPos(col);
13425
- const isExist = colPosExist[colPos];
13426
- colPosExist[colPos] = true;
13427
- return isExist ? "" : createVNode("div", {
13428
- "class": resolveColumnClass(col),
13429
- "style": resolveColumnStyle(colPos)
13430
- }, null);
13431
13353
  });
13432
- };
13433
- const fixedWrapperClass = resolveClassName("table-fixed");
13434
- return {
13435
- renderFixedColumns,
13436
- fixedWrapperClass,
13437
- getFixedColumnStyleResolve
13438
- };
13439
- };
13440
- const resolvePaginationOption = (propPagination, defVal) => {
13441
- if (!!propPagination) {
13442
- if (typeof propPagination === "object") {
13443
- let current = Object.prototype.hasOwnProperty.call(propPagination, "current") ? propPagination.current : propPagination.value;
13444
- if (!/\d+/.test(current)) {
13445
- current = 1;
13354
+ }, {
13355
+ immediate: true
13356
+ });
13357
+ nextTick(() => {
13358
+ watch(() => proxy.totalPageNum, (totalPageNum) => {
13359
+ if (localCurrent.value > totalPageNum) {
13360
+ localCurrent.value = totalPageNum;
13446
13361
  }
13447
- return __spreadProps(__spreadValues(__spreadValues({}, defVal), propPagination), {
13448
- current
13449
- });
13450
- }
13451
- return defVal;
13452
- }
13453
- return {};
13454
- };
13455
- var userPagination = (props) => {
13456
- const startIndex = ref(0);
13457
- const endIndex = ref(0);
13458
- const indexData = computed(() => props.data.map((item, index) => __spreadProps(__spreadValues({}, item), {
13459
- __$table_row_index: index + 1
13460
- })));
13461
- let pagination2 = reactive({
13462
- count: 0,
13463
- limit: 10,
13464
- current: 1
13362
+ });
13465
13363
  });
13466
- pagination2 = resolvePaginationOption(props.pagination, pagination2);
13467
- const localPagination = ref(null);
13468
- const resetStartEndIndex = () => {
13469
- if (!props.pagination || props.remotePagination) {
13470
- startIndex.value = 0;
13471
- endIndex.value = props.data.length;
13364
+ const handlePrePage = () => {
13365
+ if (isPagePreDisabled.value) {
13472
13366
  return;
13473
13367
  }
13474
- startIndex.value = (pagination2.current - 1) * pagination2.limit;
13475
- endIndex.value = pagination2.current * pagination2.limit;
13368
+ localCurrent.value = localCurrent.value - 1;
13476
13369
  };
13477
- const pageData = reactive([]);
13478
- const sort = (sortFn) => {
13479
- if (typeof sortFn === "function") {
13480
- pageData.sort(sortFn);
13370
+ const handleNextPage = () => {
13371
+ if (isPageNextDisabled.value) {
13372
+ return;
13481
13373
  }
13374
+ localCurrent.value = localCurrent.value + 1;
13482
13375
  };
13483
- const filter = (filterFn) => {
13484
- if (typeof filterFn === "function") {
13485
- const filterVals = pageData.filter((row, index) => filterFn(row, index, props.data));
13486
- pageData.splice(0, pageData.length, ...filterVals);
13376
+ const handleItemClick = (totalPageNum) => {
13377
+ if (totalPageNum === localCurrent.value) {
13378
+ return;
13487
13379
  }
13380
+ localCurrent.value = totalPageNum;
13488
13381
  };
13489
- const resolvePageData = (filterFn, sortFn) => {
13490
- pageData.splice(0, pageData.length, ...indexData.value.slice(startIndex.value, endIndex.value));
13491
- filter(filterFn);
13492
- sort(sortFn);
13382
+ const handlePreBatch = () => {
13383
+ localCurrent.value = Math.max(1, localCurrent.value - PAGE_ITEMS_NUM);
13493
13384
  };
13494
- const watchEffectFn = (filterFn, sortFn) => {
13495
- pagination2 = resolvePaginationOption(props.pagination, pagination2);
13496
- resolveLocalPagination();
13497
- resetStartEndIndex();
13498
- resolvePageData(filterFn, sortFn);
13385
+ const handleNextBatch = () => {
13386
+ localCurrent.value = Math.min(proxy.totalPageNum, localCurrent.value + PAGE_ITEMS_NUM);
13499
13387
  };
13500
- const resolveLocalPagination = () => {
13501
- if (!props.pagination) {
13502
- return;
13388
+ const render2 = ({
13389
+ isFirst,
13390
+ isLast
13391
+ }) => createVNode("div", {
13392
+ "class": {
13393
+ "bk-pagination-list": true,
13394
+ "is-first": isFirst,
13395
+ "is-last": isLast
13503
13396
  }
13504
- localPagination.value = props.remotePagination ? pagination2 : __spreadProps(__spreadValues({}, pagination2), {
13505
- count: props.data.length
13506
- });
13507
- };
13397
+ }, [createVNode("div", {
13398
+ "class": {
13399
+ "bk-pagination-list-pre": true,
13400
+ "is-disabled": isPagePreDisabled.value
13401
+ },
13402
+ "onClick": handlePrePage
13403
+ }, [proxy.prevText || createVNode(angleLeft, null, null)]), createVNode("div", {
13404
+ "class": {
13405
+ "bk-pagination-list-item": true,
13406
+ "is-active": localCurrent.value === 1
13407
+ },
13408
+ "key": "1",
13409
+ "onClick": () => handleItemClick(1)
13410
+ }, [createTextVNode("1")]), showPreBatch.value && createVNode("div", {
13411
+ "key": "pre-batch",
13412
+ "class": "bk-pagination-list-pre-batch",
13413
+ "onClick": handlePreBatch
13414
+ }, [createVNode(ellipsis, null, null)]), list.value.map((num) => createVNode("div", {
13415
+ "class": {
13416
+ "bk-pagination-list-item": true,
13417
+ "is-active": localCurrent.value === num
13418
+ },
13419
+ "key": num,
13420
+ "onClick": () => handleItemClick(num)
13421
+ }, [num])), showNextBatch.value && createVNode("div", {
13422
+ "key": "next-batch",
13423
+ "class": "bk-pagination-list-next-batch",
13424
+ "onClick": handleNextBatch
13425
+ }, [createVNode(ellipsis, null, null)]), proxy.totalPageNum > 1 && createVNode("div", {
13426
+ "class": {
13427
+ "bk-pagination-list-item": true,
13428
+ "is-active": localCurrent.value === proxy.totalPageNum
13429
+ },
13430
+ "key": "last",
13431
+ "onClick": () => handleItemClick(proxy.totalPageNum)
13432
+ }, [proxy.totalPageNum]), createVNode("div", {
13433
+ "class": {
13434
+ "bk-pagination-list-pre": true,
13435
+ "is-disabled": isPageNextDisabled.value
13436
+ },
13437
+ "onClick": handleNextPage
13438
+ }, [proxy.nextText || createVNode(angleRight, null, null)])]);
13508
13439
  return {
13509
- pageData,
13510
- localPagination,
13511
- resolvePageData,
13512
- watchEffectFn
13440
+ current: localCurrent,
13441
+ render: render2
13513
13442
  };
13514
13443
  };
13515
- var useScrollLoading = (props, ctx) => {
13516
- const refScrollLoading = toRef(props, "scrollLoading");
13517
- const getLoadingOption = () => {
13518
- if (typeof refScrollLoading.value === "boolean") {
13519
- return {
13520
- loading: !!refScrollLoading.value,
13521
- inline: true,
13522
- title: "",
13523
- size: BkLoadingSize.Normal,
13524
- mode: BkLoadingMode.Default,
13525
- indicator: null
13526
- };
13527
- }
13528
- return refScrollLoading.value;
13529
- };
13530
- const isRender = computed(() => refScrollLoading.value !== null && (typeof refScrollLoading.value === "boolean" && refScrollLoading.value || typeof refScrollLoading.value === "object"));
13531
- const renderScrollLoading = () => {
13532
- var _a, _b, _c;
13533
- if (isRender.value) {
13534
- const {
13535
- loading: loading2,
13536
- size,
13537
- mode,
13538
- title,
13539
- inline,
13540
- indicator
13541
- } = getLoadingOption();
13542
- return (_c = (_b = (_a = ctx.slots).fixedBottom) == null ? void 0 : _b.call(_a)) != null ? _c : createVNode(BkLoading, {
13543
- loading: loading2,
13544
- size,
13545
- mode,
13546
- title,
13547
- inline,
13548
- indicator
13549
- }, null);
13550
- }
13551
- };
13552
- return {
13553
- renderScrollLoading
13554
- };
13555
- };
13556
- var SortScope = /* @__PURE__ */ ((SortScope2) => {
13557
- SortScope2["CURRENT"] = "current";
13558
- SortScope2["ALL"] = "all";
13559
- return SortScope2;
13560
- })(SortScope || {});
13561
- const tableProps = {
13562
- data: PropTypes.arrayOf(PropTypes.any).def([]),
13563
- columns: PropTypes.arrayOf(PropTypes.shape({
13564
- label: PropTypes.oneOfType([PropTypes.func.def(() => ""), PropTypes.string.def("")]),
13565
- field: PropTypes.oneOfType([PropTypes.func.def(() => ""), PropTypes.string.def("")]),
13566
- render: PropTypes.oneOfType([PropTypes.func.def(() => ""), PropTypes.string.def("")]),
13567
- width: PropTypes.oneOfType([PropTypes.number.def(void 0), PropTypes.string.def("auto")]),
13568
- minWidth: PropTypes.oneOfType([PropTypes.number.def(void 0), PropTypes.string.def("auto")]).def(),
13569
- type: PropTypes.commonType(["selection", "index", "expand", "none"], "columnType").def("none"),
13570
- resizable: PropTypes.bool.def(true),
13571
- fixed: PropTypes.oneOfType([
13572
- PropTypes.bool,
13573
- PropTypes.commonType(["left", "right"], "fixed")
13574
- ]).def(false),
13575
- sort: PropTypes.oneOfType([
13576
- PropTypes.shape({
13577
- sortFn: PropTypes.func.def(void 0),
13578
- sortScope: PropTypes.commonType(Object.values(SortScope)).def("current")
13579
- }),
13580
- PropTypes.bool,
13581
- PropTypes.string
13582
- ]).def(false),
13583
- filter: PropTypes.oneOfType([
13584
- PropTypes.shape({
13585
- list: PropTypes.arrayOf(PropTypes.any).def([]),
13586
- filterFn: PropTypes.func.def(void 0)
13587
- }),
13588
- PropTypes.bool,
13589
- PropTypes.string
13590
- ]).def(false)
13591
- })).def([]),
13592
- activeColumn: PropTypes.oneOfType([PropTypes.number.def(-1), PropTypes.arrayOf(PropTypes.number.def(-1))]),
13593
- columnPick: PropTypes.commonType(["multi", "single", "disabled"], "columnPick").def("disabled"),
13594
- height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def("auto"),
13595
- minHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def(200),
13596
- maxHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def("auto"),
13597
- rowHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.func]).def(40),
13598
- headHeight: PropTypes.number.def(40),
13599
- showHead: PropTypes.bool.def(true),
13600
- thead: PropTypes.shape({
13601
- height: PropTypes.number.def(40),
13602
- isShow: PropTypes.bool.def(true),
13603
- cellFn: PropTypes.func.def(void 0)
13604
- }),
13605
- virtualEnabled: PropTypes.bool.def(false),
13606
- border: PropTypes.arrayOf(PropTypes.commonType(BORDER_OPRIONS, "border")).def(["row"]),
13607
- pagination: PropTypes.oneOfType([PropTypes.bool.def(false), PropTypes.object.def({})]).def(false),
13608
- remotePagination: PropTypes.bool.def(false),
13609
- emptyText: PropTypes.string.def("\u6682\u65E0\u6570\u636E"),
13610
- settings: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
13611
- fields: PropTypes.shape([]).def(void 0),
13612
- checked: PropTypes.shape([]).def(void 0),
13613
- limit: PropTypes.number.def(void 0),
13614
- size: PropTypes.size(["small", "default", "large"]).def("default"),
13615
- sizeList: PropTypes.shape([]).def(void 0)
13616
- })]).def(false),
13617
- rowClass: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13618
- rowStyle: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13619
- cellStyle: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13620
- cellClass: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13621
- scrollLoading: PropTypes.oneOfType([
13622
- PropTypes.object,
13623
- PropTypes.bool
13624
- ]).def(void 0)
13625
- };
13626
- function _isSlot$2(s2) {
13627
- return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
13628
- }
13629
- var useLimit = () => {
13630
- const {
13631
- proxy
13632
- } = getCurrentInstance();
13633
- const localLimit = ref(proxy.limit);
13634
- watch(() => proxy.limit, (limit) => {
13635
- localLimit.value = limit;
13636
- });
13637
- watch(() => proxy.limitList, (limitList) => {
13638
- nextTick(() => {
13639
- if (!limitList.includes(localLimit.value)) {
13640
- [localLimit.value] = limitList;
13641
- }
13642
- });
13643
- }, {
13644
- immediate: true
13645
- });
13646
- const handleLimitChange = (limit) => {
13647
- localLimit.value = limit;
13648
- };
13649
- const render2 = ({
13650
- isFirst,
13651
- isLast
13652
- }) => {
13653
- let _slot;
13654
- if (!proxy.showLimit) {
13655
- return null;
13656
- }
13657
- return createVNode("div", mergeProps({
13658
- "class": {
13659
- "bk-pagination-limit": true,
13660
- "is-first": isFirst,
13661
- "is-last": isLast
13662
- }
13663
- }, {
13664
- disabled: proxy.disabled
13665
- }), [createVNode("div", null, [createTextVNode("\u6BCF\u9875")]), createVNode(BkSelect, {
13666
- "class": "bk-pagination-limit-select",
13667
- "clearable": false,
13668
- "modelValue": localLimit.value,
13669
- "onChange": handleLimitChange,
13670
- "disabled": proxy.disabled
13671
- }, _isSlot$2(_slot = proxy.limitList.map((num, index) => createVNode(BkOption, {
13672
- "value": num,
13673
- "label": `${num}`,
13674
- "key": `${index}_${num}`
13675
- }, null))) ? _slot : {
13676
- default: () => [_slot]
13677
- }), createVNode("div", null, [createTextVNode("\u6761")])]);
13678
- };
13679
- return {
13680
- limit: localLimit,
13681
- render: render2
13682
- };
13683
- };
13684
- const PAGE_ITEMS_NUM = 5;
13685
- var useList = () => {
13444
+ var useSmallList = () => {
13686
13445
  const {
13687
13446
  proxy
13688
13447
  } = getCurrentInstance();
13448
+ const inputRef = ref(null);
13449
+ const isFocused = ref(false);
13689
13450
  const localCurrent = ref(1);
13690
13451
  const isPagePreDisabled = computed(() => localCurrent.value === 1);
13691
13452
  const isPageNextDisabled = computed(() => localCurrent.value === proxy.totalPageNum);
13692
- const showPreBatch = ref(false);
13693
- const showNextBatch = ref(false);
13453
+ let inputMemo = 0;
13694
13454
  const list = computed(() => {
13695
- showPreBatch.value = false;
13696
- showNextBatch.value = false;
13697
13455
  const stack = [];
13698
- if (proxy.totalPageNum <= PAGE_ITEMS_NUM) {
13699
- for (let i = 2; i <= proxy.totalPageNum - 1; i++) {
13700
- stack.push(i);
13701
- }
13702
- return stack;
13703
- }
13704
- const pageItemsNumHalf = Math.floor(PAGE_ITEMS_NUM / 2);
13705
- if (proxy.totalPageNum > PAGE_ITEMS_NUM) {
13706
- showPreBatch.value = localCurrent.value - pageItemsNumHalf > 2;
13707
- showNextBatch.value = localCurrent.value + pageItemsNumHalf < proxy.totalPageNum - 1;
13708
- }
13709
- const start2 = Math.min(proxy.totalPageNum - PAGE_ITEMS_NUM, Math.max(2, localCurrent.value - pageItemsNumHalf));
13710
- for (let i = start2; i < start2 + PAGE_ITEMS_NUM; i++) {
13456
+ for (let i = 1; i <= proxy.totalPageNum; i++) {
13711
13457
  stack.push(i);
13712
13458
  }
13713
13459
  return stack;
@@ -13721,6 +13467,7 @@ var useList = () => {
13721
13467
  } else {
13722
13468
  localCurrent.value = proxy.totalPageNum;
13723
13469
  }
13470
+ inputMemo = localCurrent.value;
13724
13471
  });
13725
13472
  }, {
13726
13473
  immediate: true
@@ -13744,343 +13491,542 @@ var useList = () => {
13744
13491
  }
13745
13492
  localCurrent.value = localCurrent.value + 1;
13746
13493
  };
13747
- const handleItemClick = (totalPageNum) => {
13748
- if (totalPageNum === localCurrent.value) {
13494
+ const handlePageEditorFocus = () => {
13495
+ isFocused.value = true;
13496
+ };
13497
+ const handlePageEditorBlur = () => {
13498
+ isFocused.value = false;
13499
+ inputRef.value.textContent = `${inputMemo}`;
13500
+ if (inputMemo !== localCurrent.value) {
13501
+ localCurrent.value = inputMemo;
13502
+ }
13503
+ };
13504
+ const handlePageEditorInput = (event) => {
13505
+ const $target = event.target;
13506
+ const value = Number($target.textContent);
13507
+ if (!value || value < 1 || value > proxy.totalPageNum || value === localCurrent.value) {
13749
13508
  return;
13750
13509
  }
13751
- localCurrent.value = totalPageNum;
13510
+ inputMemo = value;
13752
13511
  };
13753
- const handlePreBatch = () => {
13754
- localCurrent.value = Math.max(1, localCurrent.value - PAGE_ITEMS_NUM);
13512
+ const handlePageEditorKeydown = (event) => {
13513
+ if (["Enter", "NumpadEnter"].includes(event.code)) {
13514
+ event.preventDefault();
13515
+ handlePageEditorBlur();
13516
+ }
13755
13517
  };
13756
- const handleNextBatch = () => {
13757
- localCurrent.value = Math.min(proxy.totalPageNum, localCurrent.value + PAGE_ITEMS_NUM);
13518
+ const handlePageChange = (item) => {
13519
+ inputMemo = item;
13520
+ handlePageEditorBlur();
13758
13521
  };
13759
- const render2 = ({
13760
- isFirst,
13761
- isLast
13762
- }) => createVNode("div", {
13763
- "class": {
13764
- "bk-pagination-list": true,
13765
- "is-first": isFirst,
13766
- "is-last": isLast
13767
- }
13522
+ const render2 = () => createVNode("div", {
13523
+ "class": "bk-pagination-small-list"
13768
13524
  }, [createVNode("div", {
13769
13525
  "class": {
13770
- "bk-pagination-list-pre": true,
13526
+ "bk-pagination-btn-pre": true,
13771
13527
  "is-disabled": isPagePreDisabled.value
13772
13528
  },
13773
13529
  "onClick": handlePrePage
13774
- }, [proxy.prevText || createVNode(angleLeft, null, null)]), createVNode("div", {
13530
+ }, [createVNode(leftShape, null, null)]), createVNode(BkPopover, {
13531
+ "theme": "light",
13532
+ "trigger": "click",
13533
+ "arrow": false,
13534
+ "boundary": "body",
13535
+ "placement": "bottom"
13536
+ }, {
13537
+ default: () => createVNode("div", {
13538
+ "class": {
13539
+ "bk-pagination-picker": true,
13540
+ "is-focused": isFocused.value
13541
+ }
13542
+ }, [createVNode("span", {
13543
+ "ref": inputRef,
13544
+ "class": "bk-pagination-editor",
13545
+ "contenteditable": true,
13546
+ "spellcheck": "false",
13547
+ "onFocus": handlePageEditorFocus,
13548
+ "onBlur": handlePageEditorBlur,
13549
+ "onInput": handlePageEditorInput,
13550
+ "onKeydown": handlePageEditorKeydown
13551
+ }, [localCurrent.value]), createVNode("span", null, [createTextVNode("/")]), createVNode("span", {
13552
+ "class": "bk-pagination-small-list-total"
13553
+ }, [proxy.totalPageNum])]),
13554
+ content: () => createVNode("div", {
13555
+ "class": "bk-pagination-picker-list"
13556
+ }, [list.value.map((item) => createVNode("div", {
13557
+ "class": {
13558
+ item: true,
13559
+ "is-actived": item === localCurrent.value
13560
+ },
13561
+ "key": item,
13562
+ "onClick": () => handlePageChange(item)
13563
+ }, [item]))])
13564
+ }), createVNode("div", {
13775
13565
  "class": {
13776
- "bk-pagination-list-item": true,
13777
- "is-active": localCurrent.value === 1
13778
- },
13779
- "key": "1",
13780
- "onClick": () => handleItemClick(1)
13781
- }, [createTextVNode("1")]), showPreBatch.value && createVNode("div", {
13782
- "key": "pre-batch",
13783
- "class": "bk-pagination-list-pre-batch",
13784
- "onClick": handlePreBatch
13785
- }, [createVNode(ellipsis, null, null)]), list.value.map((num) => createVNode("div", {
13786
- "class": {
13787
- "bk-pagination-list-item": true,
13788
- "is-active": localCurrent.value === num
13789
- },
13790
- "key": num,
13791
- "onClick": () => handleItemClick(num)
13792
- }, [num])), showNextBatch.value && createVNode("div", {
13793
- "key": "next-batch",
13794
- "class": "bk-pagination-list-next-batch",
13795
- "onClick": handleNextBatch
13796
- }, [createVNode(ellipsis, null, null)]), proxy.totalPageNum > 1 && createVNode("div", {
13797
- "class": {
13798
- "bk-pagination-list-item": true,
13799
- "is-active": localCurrent.value === proxy.totalPageNum
13800
- },
13801
- "key": "last",
13802
- "onClick": () => handleItemClick(proxy.totalPageNum)
13803
- }, [proxy.totalPageNum]), createVNode("div", {
13804
- "class": {
13805
- "bk-pagination-list-pre": true,
13806
- "is-disabled": isPageNextDisabled.value
13566
+ "bk-pagination-btn-next": true,
13567
+ "is-disabled": isPageNextDisabled.value
13807
13568
  },
13808
13569
  "onClick": handleNextPage
13809
- }, [proxy.nextText || createVNode(angleRight, null, null)])]);
13570
+ }, [createVNode(rightShape, null, null)])]);
13810
13571
  return {
13811
13572
  current: localCurrent,
13812
13573
  render: render2
13813
13574
  };
13814
13575
  };
13815
- var useSmallList = () => {
13576
+ var useTotal = () => ({
13577
+ isFirst,
13578
+ isLast
13579
+ }) => {
13816
13580
  const {
13817
- proxy
13581
+ props
13818
13582
  } = getCurrentInstance();
13819
- const inputRef = ref(null);
13820
- const isFocused = ref(false);
13821
- const localCurrent = ref(1);
13822
- const isPagePreDisabled = computed(() => localCurrent.value === 1);
13823
- const isPageNextDisabled = computed(() => localCurrent.value === proxy.totalPageNum);
13824
- let inputMemo = 0;
13825
- const list = computed(() => {
13826
- const stack = [];
13827
- for (let i = 1; i <= proxy.totalPageNum; i++) {
13828
- stack.push(i);
13583
+ if (!props.showTotalCount) {
13584
+ return null;
13585
+ }
13586
+ return createVNode("div", mergeProps({
13587
+ "class": {
13588
+ "bk-pagination-total": true,
13589
+ "is-first": isFirst,
13590
+ "is-last": isLast
13829
13591
  }
13830
- return stack;
13831
- });
13832
- watch(() => proxy.modelValue, (modelValue) => {
13833
- nextTick(() => {
13834
- if (modelValue >= 1 && modelValue <= proxy.totalPageNum) {
13835
- localCurrent.value = modelValue;
13836
- } else if (modelValue < 1) {
13837
- localCurrent.value = 1;
13838
- } else {
13839
- localCurrent.value = proxy.totalPageNum;
13840
- }
13841
- inputMemo = localCurrent.value;
13842
- });
13843
13592
  }, {
13844
- immediate: true
13845
- });
13846
- nextTick(() => {
13847
- watch(() => proxy.totalPageNum, (totalPageNum) => {
13848
- if (localCurrent.value > totalPageNum) {
13849
- localCurrent.value = totalPageNum;
13593
+ disabled: props.disabled
13594
+ }), [createTextVNode("\u5171\u8BA1"), createVNode("div", {
13595
+ "class": "bk-pagination-total-num"
13596
+ }, [props.count]), createTextVNode("\u6761")]);
13597
+ };
13598
+ const paginationProps = {
13599
+ modelValue: PropTypes.number.def(1),
13600
+ count: PropTypes.number.def(0).isRequired,
13601
+ limit: PropTypes.number.def(10),
13602
+ limitList: PropTypes.arrayOf(Number).def([10, 20, 50, 100]),
13603
+ showLimit: PropTypes.bool.def(true),
13604
+ type: PropTypes.oneOf(["default", "compact"]).def("default"),
13605
+ location: PropTypes.oneOf(["left", "right"]).def("right"),
13606
+ align: PropTypes.oneOf(["left", "center", "right"]).def("left"),
13607
+ size: PropTypes.size(),
13608
+ small: PropTypes.bool.def(false),
13609
+ showTotalCount: PropTypes.bool.def(true),
13610
+ prevText: PropTypes.string,
13611
+ nextText: PropTypes.string,
13612
+ disabled: PropTypes.bool.def(false),
13613
+ layout: PropTypes.custom((value) => {
13614
+ const layoutNameMap = {
13615
+ total: true,
13616
+ list: true,
13617
+ limit: true
13618
+ };
13619
+ return value.some((item) => layoutNameMap[item]);
13620
+ }, "layout \u7684\u503C\u53EA\u652F\u6301 * total\u3001list\u3001limit *").def(["total", "list", "limit"])
13621
+ };
13622
+ var Component$a = defineComponent({
13623
+ name: "Pagination",
13624
+ props: paginationProps,
13625
+ emits: ["update:modelValue", "change", "update:limit", "limitChange"],
13626
+ setup(props, context) {
13627
+ const totalPageNum = ref(0);
13628
+ const {
13629
+ count,
13630
+ limit
13631
+ } = toRefs(props);
13632
+ const renderTotal = useTotal();
13633
+ const {
13634
+ current: listCurrent,
13635
+ render: renderList
13636
+ } = useList();
13637
+ const {
13638
+ current: smallListCurrent,
13639
+ render: renderSmallList
13640
+ } = useSmallList();
13641
+ const {
13642
+ limit: localLimit,
13643
+ render: renderLimit
13644
+ } = useLimit();
13645
+ watch([count, localLimit, limit], ([count2, localLimit2]) => {
13646
+ const total = Math.ceil(count2 / localLimit2);
13647
+ totalPageNum.value = total < 1 ? 1 : total;
13648
+ }, {
13649
+ immediate: true
13650
+ });
13651
+ watch(listCurrent, (listCurrent2) => {
13652
+ context.emit("update:modelValue", listCurrent2);
13653
+ context.emit("change", listCurrent2);
13654
+ });
13655
+ watch(smallListCurrent, (smallListCurrent2) => {
13656
+ context.emit("update:modelValue", smallListCurrent2);
13657
+ context.emit("change", smallListCurrent2);
13658
+ });
13659
+ watch(localLimit, (localLimit2) => {
13660
+ context.emit("limitChange", localLimit2);
13661
+ });
13662
+ return {
13663
+ totalPageNum,
13664
+ renderTotal,
13665
+ renderList,
13666
+ renderLimit,
13667
+ renderSmallList
13668
+ };
13669
+ },
13670
+ render() {
13671
+ const paginationClass = classes({
13672
+ "bk-pagination": true,
13673
+ [`bk-pagination--${this.size}`]: true,
13674
+ [`is-align-${this.align}`]: true
13675
+ });
13676
+ const layoutMap = {
13677
+ total: this.renderTotal,
13678
+ list: this.small ? this.renderSmallList : this.renderList,
13679
+ limit: this.renderLimit
13680
+ };
13681
+ return createVNode("div", {
13682
+ "class": paginationClass
13683
+ }, [this.layout.map((layout, index) => layoutMap[layout]({
13684
+ isFirst: index === 0,
13685
+ isLast: index === this.layout.length - 1
13686
+ }))]);
13687
+ }
13688
+ });
13689
+ const BkPagination = withInstall(Component$a);
13690
+ var BodyEmpty = defineComponent({
13691
+ name: "BodyEmpty",
13692
+ props: {
13693
+ list: PropTypes.array.def([]),
13694
+ filterList: PropTypes.array.def([]),
13695
+ emptyText: PropTypes.string.def("\u6682\u65E0\u6570\u636E")
13696
+ },
13697
+ emits: ["change"],
13698
+ setup(props, {
13699
+ slots
13700
+ }) {
13701
+ const type = computed(() => props.list.length === 0 ? "empty" : "search-empty");
13702
+ return () => createVNode(BkException, {
13703
+ "scene": "part",
13704
+ "type": type.value
13705
+ }, {
13706
+ default: () => {
13707
+ var _a, _b;
13708
+ return [(_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : props.emptyText];
13850
13709
  }
13851
13710
  });
13852
- });
13853
- const handlePrePage = () => {
13854
- if (isPagePreDisabled.value) {
13855
- return;
13711
+ }
13712
+ });
13713
+ var rngBrowser = { exports: {} };
13714
+ var getRandomValues = typeof crypto != "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != "undefined" && typeof window.msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto);
13715
+ if (getRandomValues) {
13716
+ var rnds8 = new Uint8Array(16);
13717
+ rngBrowser.exports = function whatwgRNG() {
13718
+ getRandomValues(rnds8);
13719
+ return rnds8;
13720
+ };
13721
+ } else {
13722
+ var rnds = new Array(16);
13723
+ rngBrowser.exports = function mathRNG() {
13724
+ for (var i = 0, r2; i < 16; i++) {
13725
+ if ((i & 3) === 0)
13726
+ r2 = Math.random() * 4294967296;
13727
+ rnds[i] = r2 >>> ((i & 3) << 3) & 255;
13856
13728
  }
13857
- localCurrent.value = localCurrent.value - 1;
13729
+ return rnds;
13858
13730
  };
13859
- const handleNextPage = () => {
13860
- if (isPageNextDisabled.value) {
13861
- return;
13731
+ }
13732
+ var byteToHex = [];
13733
+ for (var i = 0; i < 256; ++i) {
13734
+ byteToHex[i] = (i + 256).toString(16).substr(1);
13735
+ }
13736
+ function bytesToUuid$2(buf, offset2) {
13737
+ var i = offset2 || 0;
13738
+ var bth = byteToHex;
13739
+ return [
13740
+ bth[buf[i++]],
13741
+ bth[buf[i++]],
13742
+ bth[buf[i++]],
13743
+ bth[buf[i++]],
13744
+ "-",
13745
+ bth[buf[i++]],
13746
+ bth[buf[i++]],
13747
+ "-",
13748
+ bth[buf[i++]],
13749
+ bth[buf[i++]],
13750
+ "-",
13751
+ bth[buf[i++]],
13752
+ bth[buf[i++]],
13753
+ "-",
13754
+ bth[buf[i++]],
13755
+ bth[buf[i++]],
13756
+ bth[buf[i++]],
13757
+ bth[buf[i++]],
13758
+ bth[buf[i++]],
13759
+ bth[buf[i++]]
13760
+ ].join("");
13761
+ }
13762
+ var bytesToUuid_1 = bytesToUuid$2;
13763
+ var rng$1 = rngBrowser.exports;
13764
+ var bytesToUuid$1 = bytesToUuid_1;
13765
+ var _nodeId;
13766
+ var _clockseq;
13767
+ var _lastMSecs = 0;
13768
+ var _lastNSecs = 0;
13769
+ function v1$1(options, buf, offset2) {
13770
+ var i = buf && offset2 || 0;
13771
+ var b2 = buf || [];
13772
+ options = options || {};
13773
+ var node = options.node || _nodeId;
13774
+ var clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq;
13775
+ if (node == null || clockseq == null) {
13776
+ var seedBytes = rng$1();
13777
+ if (node == null) {
13778
+ node = _nodeId = [
13779
+ seedBytes[0] | 1,
13780
+ seedBytes[1],
13781
+ seedBytes[2],
13782
+ seedBytes[3],
13783
+ seedBytes[4],
13784
+ seedBytes[5]
13785
+ ];
13786
+ }
13787
+ if (clockseq == null) {
13788
+ clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383;
13789
+ }
13790
+ }
13791
+ var msecs = options.msecs !== void 0 ? options.msecs : new Date().getTime();
13792
+ var nsecs = options.nsecs !== void 0 ? options.nsecs : _lastNSecs + 1;
13793
+ var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4;
13794
+ if (dt < 0 && options.clockseq === void 0) {
13795
+ clockseq = clockseq + 1 & 16383;
13796
+ }
13797
+ if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === void 0) {
13798
+ nsecs = 0;
13799
+ }
13800
+ if (nsecs >= 1e4) {
13801
+ throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
13802
+ }
13803
+ _lastMSecs = msecs;
13804
+ _lastNSecs = nsecs;
13805
+ _clockseq = clockseq;
13806
+ msecs += 122192928e5;
13807
+ var tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296;
13808
+ b2[i++] = tl >>> 24 & 255;
13809
+ b2[i++] = tl >>> 16 & 255;
13810
+ b2[i++] = tl >>> 8 & 255;
13811
+ b2[i++] = tl & 255;
13812
+ var tmh = msecs / 4294967296 * 1e4 & 268435455;
13813
+ b2[i++] = tmh >>> 8 & 255;
13814
+ b2[i++] = tmh & 255;
13815
+ b2[i++] = tmh >>> 24 & 15 | 16;
13816
+ b2[i++] = tmh >>> 16 & 255;
13817
+ b2[i++] = clockseq >>> 8 | 128;
13818
+ b2[i++] = clockseq & 255;
13819
+ for (var n2 = 0; n2 < 6; ++n2) {
13820
+ b2[i + n2] = node[n2];
13821
+ }
13822
+ return buf ? buf : bytesToUuid$1(b2);
13823
+ }
13824
+ var v1_1 = v1$1;
13825
+ var rng = rngBrowser.exports;
13826
+ var bytesToUuid = bytesToUuid_1;
13827
+ function v4$1(options, buf, offset2) {
13828
+ var i = buf && offset2 || 0;
13829
+ if (typeof options == "string") {
13830
+ buf = options === "binary" ? new Array(16) : null;
13831
+ options = null;
13832
+ }
13833
+ options = options || {};
13834
+ var rnds = options.random || (options.rng || rng)();
13835
+ rnds[6] = rnds[6] & 15 | 64;
13836
+ rnds[8] = rnds[8] & 63 | 128;
13837
+ if (buf) {
13838
+ for (var ii = 0; ii < 16; ++ii) {
13839
+ buf[i + ii] = rnds[ii];
13840
+ }
13841
+ }
13842
+ return buf || bytesToUuid(rnds);
13843
+ }
13844
+ var v4_1 = v4$1;
13845
+ var v1 = v1_1;
13846
+ var v4 = v4_1;
13847
+ var uuid = v4;
13848
+ uuid.v1 = v1;
13849
+ uuid.v4 = v4;
13850
+ var uuid_1 = uuid;
13851
+ const resolvePropVal = (prop, key, args) => {
13852
+ if (Object.prototype.hasOwnProperty.call(prop, key)) {
13853
+ if (typeof prop[key] === "function") {
13854
+ return prop[key].call(globalThis, ...args);
13855
+ }
13856
+ return prop[key];
13857
+ }
13858
+ return void 0;
13859
+ };
13860
+ const resolveNumberToNumArray = (prop) => {
13861
+ if (/^\d+$/.test(`${prop}`)) {
13862
+ return [parseInt(`${prop}`, 10)];
13863
+ }
13864
+ return [];
13865
+ };
13866
+ const resolveWidth = (propWidth) => resolveNumberOrStringToPix(propWidth, "auto");
13867
+ const resolveNumberOrStringToPix = (val, defaultValue = "100%", offset2 = null) => {
13868
+ let target = "";
13869
+ if (/^auto|null|undefined$/ig.test(`${val}`)) {
13870
+ target = defaultValue;
13871
+ } else {
13872
+ target = /^\d+\.?\d+$/.test(`${val}`) ? `${val}px` : val;
13873
+ }
13874
+ if (offset2) {
13875
+ target = `calc(${target} - ${offset2})`;
13876
+ }
13877
+ return target;
13878
+ };
13879
+ const resolvePropBorderToClassStr = (val) => {
13880
+ const defaultVal = ["row"];
13881
+ if (typeof val === "string") {
13882
+ defaultVal.push(val);
13883
+ }
13884
+ if (Array.isArray(val)) {
13885
+ defaultVal.push(...val.filter((str) => BORDER_OPRIONS.includes(str)));
13886
+ }
13887
+ return [...new Set(defaultVal)].map((item) => `bordered-${item}`).join(" ");
13888
+ };
13889
+ const getColumnReactWidth = (colmun, orders = ["resizeWidth", "calcWidth", "width"]) => {
13890
+ var _a, _b;
13891
+ return (_b = (_a = colmun[orders[0]]) != null ? _a : colmun[orders[1]]) != null ? _b : colmun[orders[2]];
13892
+ };
13893
+ const resolveColumnWidth = (root, colgroups, autoWidth = 20) => {
13894
+ const {
13895
+ width
13896
+ } = root.getBoundingClientRect() || {};
13897
+ let avgWidth = width - 4;
13898
+ const avgColIndexList = [];
13899
+ const getMinWidth = (col, computedWidth) => {
13900
+ const {
13901
+ minWidth = void 0
13902
+ } = col;
13903
+ if (minWidth === void 0) {
13904
+ return computedWidth;
13905
+ }
13906
+ let calcMinWidth = computedWidth;
13907
+ if (/^\d+\.?\d*$/.test(`${minWidth}`)) {
13908
+ calcMinWidth = Number(minWidth);
13862
13909
  }
13863
- localCurrent.value = localCurrent.value + 1;
13864
- };
13865
- const handlePageEditorFocus = () => {
13866
- isFocused.value = true;
13867
- };
13868
- const handlePageEditorBlur = () => {
13869
- isFocused.value = false;
13870
- inputRef.value.textContent = `${inputMemo}`;
13871
- if (inputMemo !== localCurrent.value) {
13872
- localCurrent.value = inputMemo;
13910
+ if (/^\d+\.?\d*%$/.test(`${minWidth}`)) {
13911
+ calcMinWidth = Number(minWidth) * width / 100;
13873
13912
  }
13874
- };
13875
- const handlePageEditorInput = (event) => {
13876
- const $target = event.target;
13877
- const value = Number($target.textContent);
13878
- if (!value || value < 1 || value > proxy.totalPageNum || value === localCurrent.value) {
13879
- return;
13913
+ if (/^\d+\.?\d*px$/i.test(`${minWidth}`)) {
13914
+ calcMinWidth = Number(`${minWidth}`.replace(/px/i, ""));
13880
13915
  }
13881
- inputMemo = value;
13916
+ return calcMinWidth;
13882
13917
  };
13883
- const handlePageEditorKeydown = (event) => {
13884
- if (["Enter", "NumpadEnter"].includes(event.code)) {
13885
- event.preventDefault();
13886
- handlePageEditorBlur();
13918
+ const resolveColNumberWidth = (col, numWidth, resetAvgWidth = true) => {
13919
+ const minWidth = getMinWidth(col, numWidth);
13920
+ const computedWidth = numWidth < minWidth ? minWidth : numWidth;
13921
+ Object.assign(col, {
13922
+ calcWidth: computedWidth
13923
+ });
13924
+ if (resetAvgWidth) {
13925
+ avgWidth = avgWidth - computedWidth;
13926
+ if (avgWidth < 0) {
13927
+ avgWidth = 0;
13928
+ }
13887
13929
  }
13888
13930
  };
13889
- const handlePageChange = (item) => {
13890
- inputMemo = item;
13891
- handlePageEditorBlur();
13892
- };
13893
- const render2 = () => createVNode("div", {
13894
- "class": "bk-pagination-small-list"
13895
- }, [createVNode("div", {
13896
- "class": {
13897
- "bk-pagination-btn-pre": true,
13898
- "is-disabled": isPagePreDisabled.value
13899
- },
13900
- "onClick": handlePrePage
13901
- }, [createVNode(leftShape, null, null)]), createVNode(BkPopover, {
13902
- "theme": "light",
13903
- "trigger": "click",
13904
- "arrow": false,
13905
- "boundary": "body",
13906
- "placement": "bottom"
13907
- }, {
13908
- default: () => createVNode("div", {
13909
- "class": {
13910
- "bk-pagination-picker": true,
13911
- "is-focused": isFocused.value
13931
+ colgroups.forEach((col, index) => {
13932
+ if (!col.isHidden) {
13933
+ const colWidth = String(getColumnReactWidth(col));
13934
+ let isAutoWidthCol = true;
13935
+ if (/^\d+\.?\d*(px)?$/.test(colWidth)) {
13936
+ const numWidth = Number(colWidth.replace("px", ""));
13937
+ resolveColNumberWidth(col, numWidth);
13938
+ isAutoWidthCol = false;
13912
13939
  }
13913
- }, [createVNode("span", {
13914
- "ref": inputRef,
13915
- "class": "bk-pagination-editor",
13916
- "contenteditable": true,
13917
- "spellcheck": "false",
13918
- "onFocus": handlePageEditorFocus,
13919
- "onBlur": handlePageEditorBlur,
13920
- "onInput": handlePageEditorInput,
13921
- "onKeydown": handlePageEditorKeydown
13922
- }, [localCurrent.value]), createVNode("span", null, [createTextVNode("/")]), createVNode("span", {
13923
- "class": "bk-pagination-small-list-total"
13924
- }, [proxy.totalPageNum])]),
13925
- content: () => createVNode("div", {
13926
- "class": "bk-pagination-picker-list"
13927
- }, [list.value.map((item) => createVNode("div", {
13928
- "class": {
13929
- item: true,
13930
- "is-actived": item === localCurrent.value
13931
- },
13932
- "key": item,
13933
- "onClick": () => handlePageChange(item)
13934
- }, [item]))])
13935
- }), createVNode("div", {
13936
- "class": {
13937
- "bk-pagination-btn-next": true,
13938
- "is-disabled": isPageNextDisabled.value
13939
- },
13940
- "onClick": handleNextPage
13941
- }, [createVNode(rightShape, null, null)])]);
13942
- return {
13943
- current: localCurrent,
13944
- render: render2
13945
- };
13940
+ if (/^\d+\.?\d*%$/.test(colWidth)) {
13941
+ let perWidth = autoWidth;
13942
+ if (avgWidth > 0) {
13943
+ const percent = Number(colWidth.replace("%", ""));
13944
+ perWidth = avgWidth * percent / 100;
13945
+ }
13946
+ resolveColNumberWidth(col, perWidth);
13947
+ isAutoWidthCol = false;
13948
+ }
13949
+ if (isAutoWidthCol) {
13950
+ avgColIndexList.push(index);
13951
+ }
13952
+ }
13953
+ });
13954
+ if (avgColIndexList.length > 0) {
13955
+ let autoAvgWidth = autoWidth;
13956
+ if (avgWidth > 0) {
13957
+ autoAvgWidth = avgWidth / avgColIndexList.length;
13958
+ avgColIndexList.forEach((idx) => resolveColNumberWidth(colgroups[idx], autoAvgWidth, false));
13959
+ }
13960
+ }
13946
13961
  };
13947
- var useTotal = () => ({
13948
- isFirst,
13949
- isLast
13950
- }) => {
13951
- const {
13952
- props
13953
- } = getCurrentInstance();
13954
- if (!props.showTotalCount) {
13955
- return null;
13962
+ const observerResize = (root, callbackFn, delay = 60, immediate = false) => {
13963
+ const callFn = lodash.exports.throttle(() => {
13964
+ if (typeof callbackFn === "function") {
13965
+ callbackFn();
13966
+ }
13967
+ }, delay);
13968
+ const resizeObserver = new ResizeObserver(() => {
13969
+ callFn();
13970
+ });
13971
+ if (immediate) {
13972
+ if (typeof callbackFn === "function") {
13973
+ callbackFn();
13974
+ }
13956
13975
  }
13957
- return createVNode("div", mergeProps({
13958
- "class": {
13959
- "bk-pagination-total": true,
13960
- "is-first": isFirst,
13961
- "is-last": isLast
13976
+ return {
13977
+ start: () => {
13978
+ resizeObserver.observe(root);
13979
+ },
13980
+ stop: () => {
13981
+ resizeObserver.disconnect();
13982
+ resizeObserver.unobserve(root);
13962
13983
  }
13963
- }, {
13964
- disabled: props.disabled
13965
- }), [createTextVNode("\u5171\u8BA1"), createVNode("div", {
13966
- "class": "bk-pagination-total-num"
13967
- }, [props.count]), createTextVNode("\u6761")]);
13968
- };
13969
- const paginationProps = {
13970
- modelValue: PropTypes.number.def(1),
13971
- count: PropTypes.number.def(0).isRequired,
13972
- limit: PropTypes.number.def(10),
13973
- limitList: PropTypes.arrayOf(Number).def([10, 20, 50, 100]),
13974
- showLimit: PropTypes.bool.def(true),
13975
- type: PropTypes.oneOf(["default", "compact"]).def("default"),
13976
- location: PropTypes.oneOf(["left", "right"]).def("right"),
13977
- align: PropTypes.oneOf(["left", "center", "right"]).def("left"),
13978
- size: PropTypes.size(),
13979
- small: PropTypes.bool.def(false),
13980
- showTotalCount: PropTypes.bool.def(true),
13981
- prevText: PropTypes.string,
13982
- nextText: PropTypes.string,
13983
- disabled: PropTypes.bool.def(false),
13984
- layout: PropTypes.custom((value) => {
13985
- const layoutNameMap = {
13986
- total: true,
13987
- list: true,
13988
- limit: true
13989
- };
13990
- return value.some((item) => layoutNameMap[item]);
13991
- }, "layout \u7684\u503C\u53EA\u652F\u6301 * total\u3001list\u3001limit *").def(["total", "list", "limit"])
13984
+ };
13992
13985
  };
13993
- var Component$a = defineComponent({
13994
- name: "Pagination",
13995
- props: paginationProps,
13996
- emits: ["update:modelValue", "change", "update:limit", "limitChange"],
13997
- setup(props, context) {
13998
- const totalPageNum = ref(0);
13999
- const {
14000
- count,
14001
- limit
14002
- } = toRefs(props);
14003
- const renderTotal = useTotal();
14004
- const {
14005
- current: listCurrent,
14006
- render: renderList
14007
- } = useList();
14008
- const {
14009
- current: smallListCurrent,
14010
- render: renderSmallList
14011
- } = useSmallList();
14012
- const {
14013
- limit: localLimit,
14014
- render: renderLimit
14015
- } = useLimit();
14016
- watch([count, localLimit, limit], ([count2, localLimit2]) => {
14017
- const total = Math.ceil(count2 / localLimit2);
14018
- totalPageNum.value = total < 1 ? 1 : total;
14019
- }, {
14020
- immediate: true
14021
- });
14022
- watch(listCurrent, (listCurrent2) => {
14023
- context.emit("update:modelValue", listCurrent2);
14024
- context.emit("change", listCurrent2);
14025
- });
14026
- watch(smallListCurrent, (smallListCurrent2) => {
14027
- context.emit("update:modelValue", smallListCurrent2);
14028
- context.emit("change", smallListCurrent2);
14029
- });
14030
- watch(localLimit, (localLimit2) => {
14031
- context.emit("limitChange", localLimit2);
14032
- });
14033
- return {
14034
- totalPageNum,
14035
- renderTotal,
14036
- renderList,
14037
- renderLimit,
14038
- renderSmallList
14039
- };
14040
- },
14041
- render() {
14042
- const paginationClass = classes({
14043
- "bk-pagination": true,
14044
- [`bk-pagination--${this.size}`]: true,
14045
- [`is-align-${this.align}`]: true
14046
- });
14047
- const layoutMap = {
14048
- total: this.renderTotal,
14049
- list: this.small ? this.renderSmallList : this.renderList,
14050
- limit: this.renderLimit
14051
- };
14052
- return createVNode("div", {
14053
- "class": paginationClass
14054
- }, [this.layout.map((layout, index) => layoutMap[layout]({
14055
- isFirst: index === 0,
14056
- isLast: index === this.layout.length - 1
14057
- }))]);
13986
+ const resolveHeadConfig = (props) => {
13987
+ const {
13988
+ showHead,
13989
+ headHeight,
13990
+ thead = {}
13991
+ } = props;
13992
+ return Object.assign({}, {
13993
+ isShow: showHead,
13994
+ height: headHeight
13995
+ }, __spreadValues({}, thead));
13996
+ };
13997
+ const getRowText = (row, key, column) => {
13998
+ if (column.type === "index") {
13999
+ return row[TABLE_ROW_ATTRIBUTE.ROW_INDEX];
14058
14000
  }
14059
- });
14060
- const BkPagination = withInstall(Component$a);
14061
- var BodyEmpty = defineComponent({
14062
- name: "BodyEmpty",
14063
- props: {
14064
- list: PropTypes.array.def([]),
14065
- filterList: PropTypes.array.def([]),
14066
- emptyText: PropTypes.string.def("\u6682\u65E0\u6570\u636E")
14067
- },
14068
- emits: ["change"],
14069
- setup(props, {
14070
- slots
14071
- }) {
14072
- const type = computed(() => props.list.length === 0 ? "empty" : "search-empty");
14073
- return () => createVNode(BkException, {
14074
- "scene": "part",
14075
- "type": type.value
14076
- }, {
14077
- default: () => {
14078
- var _a, _b;
14079
- return [(_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : props.emptyText];
14001
+ return row[key];
14002
+ };
14003
+ const formatPropAsArray = (prop, args) => {
14004
+ if (Array.isArray(prop)) {
14005
+ return prop;
14006
+ }
14007
+ if (typeof prop === "string" || typeof prop === "object") {
14008
+ return [prop];
14009
+ }
14010
+ if (typeof prop === "function") {
14011
+ return formatPropAsArray(Reflect.apply(prop, globalThis, args), args);
14012
+ }
14013
+ return [];
14014
+ };
14015
+ const getRowKey = (item, props) => {
14016
+ if (typeof props.rowKey === "string") {
14017
+ const keys = props.rowKey.split(".");
14018
+ return keys.reduce((pre, cur) => {
14019
+ if (Object.prototype.hasOwnProperty.call(pre, cur)) {
14020
+ return pre[cur];
14080
14021
  }
14081
- });
14022
+ return pre;
14023
+ }, item);
14082
14024
  }
14083
- });
14025
+ if (typeof props.rowKey === "function") {
14026
+ return Reflect.apply(props.rowKey, globalThis, [item]);
14027
+ }
14028
+ return uuid_1.v4();
14029
+ };
14084
14030
  function _isSlot$1(s2) {
14085
14031
  return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
14086
14032
  }
@@ -14419,6 +14365,74 @@ var Settings = defineComponent({
14419
14365
  });
14420
14366
  }
14421
14367
  });
14368
+ var useFixedColumn = (props, colgroups) => {
14369
+ const footHeight = computed(() => props.pagination && props.data.length ? 40 : 0);
14370
+ const resolveColumnClass = (column) => ({
14371
+ column_fixed: !!column.fixed,
14372
+ column_fixed_left: column.fixed !== "right",
14373
+ column_fixed_right: column.fixed === "right"
14374
+ });
14375
+ const resolveFixColPos = (column) => column.fixed === "right" ? "right" : "left";
14376
+ const resolveFixOffset = {
14377
+ left: (ignoreFirst = true) => colgroups.filter((col) => col.fixed && col.fixed !== "right").reduce((offset2, curr, index) => {
14378
+ const outOffset = ignoreFirst && index === 0 ? offset2 : offset2 + getColumnReactWidth(curr);
14379
+ return outOffset;
14380
+ }, 0),
14381
+ right: (ignoreFirst = true) => colgroups.filter((col) => col.fixed === "right").reduce((offset2, curr, index) => {
14382
+ const outOffset = ignoreFirst && index === 0 ? offset2 : offset2 + getColumnReactWidth(curr);
14383
+ return outOffset;
14384
+ }, 0)
14385
+ };
14386
+ const reolveFixRightOffset = resolveFixOffset.right;
14387
+ const getFixedColumnStyleResolve = () => {
14388
+ const resolveFixedColumnStyle = (column, fixedoffset2) => {
14389
+ if (!column.fixed) {
14390
+ return {};
14391
+ }
14392
+ const fixedPos = resolveFixColPos(column);
14393
+ const opt = fixedPos === "right" ? -1 : 1;
14394
+ const offsetX = `${fixedoffset2[fixedPos]}px`;
14395
+ fixedoffset2[fixedPos] = fixedoffset2[fixedPos] + getColumnReactWidth(column) * opt;
14396
+ return {
14397
+ [fixedPos]: offsetX
14398
+ };
14399
+ };
14400
+ const rightOffsetWidth = reolveFixRightOffset(true);
14401
+ const fixedoffset = {
14402
+ left: 0,
14403
+ right: rightOffsetWidth
14404
+ };
14405
+ return {
14406
+ fixedoffset,
14407
+ resolveFixedColumnStyle
14408
+ };
14409
+ };
14410
+ const renderFixedColumns = () => {
14411
+ const resolveColumnStyle = (colPos) => ({
14412
+ width: `${resolveFixOffset[colPos](false)}px`,
14413
+ bottom: `${footHeight.value}px`
14414
+ });
14415
+ const colPosExist = {
14416
+ left: false,
14417
+ right: false
14418
+ };
14419
+ return colgroups.filter((col) => !col.isHidden && col.fixed).map((col) => {
14420
+ const colPos = resolveFixColPos(col);
14421
+ const isExist = colPosExist[colPos];
14422
+ colPosExist[colPos] = true;
14423
+ return isExist ? "" : createVNode("div", {
14424
+ "class": resolveColumnClass(col),
14425
+ "style": resolveColumnStyle(colPos)
14426
+ }, null);
14427
+ });
14428
+ };
14429
+ const fixedWrapperClass = resolveClassName("table-fixed");
14430
+ return {
14431
+ renderFixedColumns,
14432
+ fixedWrapperClass,
14433
+ getFixedColumnStyleResolve
14434
+ };
14435
+ };
14422
14436
  class TableRender {
14423
14437
  constructor(props, ctx, reactiveProp, colgroups) {
14424
14438
  __publicField(this, "getRowHeight", (row, rowIndex) => {
@@ -14650,60 +14664,272 @@ class TableRender {
14650
14664
  resolveFixedColumnStyle,
14651
14665
  fixedoffset
14652
14666
  } = getFixedColumnStyleResolve();
14653
- return createVNode("tr", {
14667
+ return [createVNode("tr", {
14654
14668
  "style": rowStyle,
14655
14669
  "class": rowClass,
14670
+ "key": row[TABLE_ROW_ATTRIBUTE.ROW_UID],
14656
14671
  "onClick": (e) => this.handleRowClick(e, row, rowIndex, rows),
14657
14672
  "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows)
14658
14673
  }, [this.filterColgroups.map((column, index) => {
14659
14674
  const cellStyle = [resolveFixedColumnStyle(column, fixedoffset), ...formatPropAsArray(this.props.cellStyle, [column, index, row, rowIndex, this])];
14660
- const cellClass = [this.getColumnClass(column, index), ...formatPropAsArray(this.props.cellClass, [column, index, row, rowIndex, this])];
14675
+ const cellClass = [this.getColumnClass(column, index), ...formatPropAsArray(this.props.cellClass, [column, index, row, rowIndex, this]), {
14676
+ "expand-row": row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND]
14677
+ }];
14678
+ const tdCtxClass = {
14679
+ cell: true,
14680
+ "expand-cell": column.type === "expand"
14681
+ };
14661
14682
  return createVNode("td", {
14662
14683
  "class": cellClass,
14663
14684
  "style": cellStyle,
14664
14685
  "colspan": 1,
14665
14686
  "rowspan": 1
14666
14687
  }, [createVNode("div", {
14667
- "class": "cell"
14688
+ "class": tdCtxClass
14668
14689
  }, [this.renderCell(row, column, rowIndex, rows)])]);
14669
- })]);
14690
+ })]), this.renderExpandRow(row, rowClass)];
14670
14691
  })]);
14671
14692
  }
14693
+ renderExpandRow(row, rowClass) {
14694
+ var _a, _b, _c;
14695
+ const isExpand = !!row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND];
14696
+ if (isExpand) {
14697
+ const resovledClass = [...rowClass, {
14698
+ row_expend: true
14699
+ }];
14700
+ return createVNode("tr", {
14701
+ "class": resovledClass
14702
+ }, [createVNode("td", {
14703
+ "colspan": this.filterColgroups.length,
14704
+ "rowspan": 1
14705
+ }, [(_c = (_b = (_a = this.context.slots).expandRow) == null ? void 0 : _b.call(_a, row)) != null ? _c : createVNode("div", {
14706
+ "class": "expand-cell-ctx"
14707
+ }, [createTextVNode("Expand Row")])])]);
14708
+ }
14709
+ }
14672
14710
  handleRowClick(e, row, index, rows) {
14673
14711
  this.context.emit("rowClick", e, row, index, rows, this);
14674
14712
  }
14675
14713
  handleRowDblClick(e, row, index, rows) {
14676
14714
  this.context.emit("rowDblClick", e, row, index, rows, this);
14677
14715
  }
14716
+ getExpandCell(row) {
14717
+ const isExpand = !!row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND];
14718
+ return isExpand ? createVNode(downShape, null, null) : createVNode(rightShape, null, null);
14719
+ }
14720
+ handleRowExpandClick(row, column, index, rows, e) {
14721
+ this.emitEvent(EVENTS$1.ON_ROW_EXPAND_CLICK, [{
14722
+ row,
14723
+ column,
14724
+ index,
14725
+ rows,
14726
+ e
14727
+ }]);
14728
+ }
14678
14729
  renderCell(row, column, index, rows) {
14730
+ if (column.type === "expand") {
14731
+ const renderExpandSlot = () => {
14732
+ var _a, _b, _c;
14733
+ if (typeof column.render === "function") {
14734
+ return column.render(null, row, index, rows);
14735
+ }
14736
+ return (_c = (_b = (_a = this.context.slots).expandCell) == null ? void 0 : _b.call(_a, {
14737
+ row,
14738
+ column,
14739
+ index,
14740
+ rows
14741
+ })) != null ? _c : this.getExpandCell(row);
14742
+ };
14743
+ return createVNode("span", {
14744
+ "class": "expand-btn-action",
14745
+ "onClick": (e) => this.handleRowExpandClick(row, column, index, rows, e)
14746
+ }, [renderExpandSlot()]);
14747
+ }
14679
14748
  const cell = getRowText(row, resolvePropVal(column, "field", [column, row]), column);
14680
14749
  if (typeof column.render === "function") {
14681
14750
  return column.render(cell, row, index, rows);
14682
14751
  }
14683
- return cell;
14684
- }
14685
- isColActive(colIndex) {
14686
- return this.props.columnPick !== "disabled" && this.propActiveCols.some((col) => col.index === colIndex && col.active);
14687
- }
14688
- renderColGroup() {
14689
- return createVNode("colgroup", null, [(this.filterColgroups || []).map((column, index) => {
14690
- const colCls = classes({
14691
- active: this.isColActive(index)
14752
+ return cell;
14753
+ }
14754
+ isColActive(colIndex) {
14755
+ return this.props.columnPick !== "disabled" && this.propActiveCols.some((col) => col.index === colIndex && col.active);
14756
+ }
14757
+ renderColGroup() {
14758
+ return createVNode("colgroup", null, [(this.filterColgroups || []).map((column, index) => {
14759
+ const colCls = classes({
14760
+ active: this.isColActive(index)
14761
+ });
14762
+ const width = `${resolveWidth(getColumnReactWidth(column))}`.replace(/px$/i, "");
14763
+ return createVNode("col", {
14764
+ "class": colCls,
14765
+ "width": width
14766
+ }, null);
14767
+ })]);
14768
+ }
14769
+ get filterColgroups() {
14770
+ return this.colgroups.filter((col) => !col.isHidden);
14771
+ }
14772
+ get setting() {
14773
+ return this.reactiveProp.setting;
14774
+ }
14775
+ }
14776
+ const resolveActiveColumns = (props) => {
14777
+ if (props.columnPick !== "disabled") {
14778
+ if (props.columnPick === "multi") {
14779
+ return Array.isArray(props.activeColumn) ? props.activeColumn : resolveNumberToNumArray(props.activeColumn);
14780
+ }
14781
+ return Array.isArray(props.activeColumn) ? resolveNumberToNumArray(props.activeColumn[0]) : resolveNumberToNumArray(props.activeColumn);
14782
+ }
14783
+ return [];
14784
+ };
14785
+ var useActiveColumns = (props) => {
14786
+ let activeColumns = reactive([]);
14787
+ if (props.columnPick === "disabled") {
14788
+ return {
14789
+ activeColumns
14790
+ };
14791
+ }
14792
+ const activeCols = reactive(resolveActiveColumns(props));
14793
+ const getActiveColumns = () => (props.columns || []).map((_column, index) => ({
14794
+ index,
14795
+ active: activeCols.some((colIndex) => colIndex === index),
14796
+ _column
14797
+ }));
14798
+ watchEffect(() => {
14799
+ activeColumns = getActiveColumns();
14800
+ const cols = resolveActiveColumns(props);
14801
+ activeColumns.forEach((col, index) => {
14802
+ Object.assign(col, {
14803
+ active: cols.some((colIndex) => colIndex === index)
14804
+ });
14805
+ });
14806
+ });
14807
+ return {
14808
+ activeColumns
14809
+ };
14810
+ };
14811
+ var useColumnResize = (colgroups, immediate = true) => {
14812
+ const pluginName = "HeadColumnResize";
14813
+ let EVENTS2;
14814
+ (function(EVENTS3) {
14815
+ EVENTS3["MOUSE_MOVE"] = "onMousemove";
14816
+ EVENTS3["MOUSE_OUT"] = "onMouseout";
14817
+ EVENTS3["MOUSE_DOWN"] = "onMousedown";
14818
+ })(EVENTS2 || (EVENTS2 = {}));
14819
+ let isInDragSection = false;
14820
+ let isMouseDown = false;
14821
+ let isDraging = false;
14822
+ let startX = 0;
14823
+ let dragColumn = null;
14824
+ let dragStartOffsetX = 0;
14825
+ const dragOffsetX = ref(-1e3);
14826
+ const handleMouseUp = (e) => {
14827
+ var _a;
14828
+ isMouseDown = false;
14829
+ isDraging = false;
14830
+ const bodyStyle = document.body.style;
14831
+ bodyStyle.cursor = "";
14832
+ const diff = e.clientX - startX;
14833
+ dragColumn.resizeWidth = ((_a = dragColumn.resizeWidth) != null ? _a : dragColumn.calcWidth) + diff;
14834
+ document.removeEventListener("mouseup", handleMouseUp);
14835
+ document.removeEventListener("mousemove", handleMouseMove);
14836
+ startX = 0;
14837
+ dragOffsetX.value = -1e3;
14838
+ dragColumn = null;
14839
+ const targetTable = e.target.closest("table");
14840
+ targetTable.querySelectorAll("th").forEach((th) => th.style.setProperty("user-select", "inherit"));
14841
+ };
14842
+ const handleMouseMove = (e) => {
14843
+ const bodyStyle = document.body.style;
14844
+ bodyStyle.setProperty("cursor", "");
14845
+ dragOffsetX.value = e.clientX - startX + dragStartOffsetX;
14846
+ };
14847
+ const handler = {
14848
+ [EVENTS2.MOUSE_DOWN]: (e, column) => {
14849
+ if (!isInDragSection) {
14850
+ return;
14851
+ }
14852
+ isMouseDown = true;
14853
+ const bodyStyle = document.body.style;
14854
+ bodyStyle.setProperty("cursor", "col-resize");
14855
+ dragColumn = column;
14856
+ startX = e.clientX;
14857
+ const targetTable = e.target.closest("table");
14858
+ dragStartOffsetX = startX - targetTable.getBoundingClientRect().left;
14859
+ document.addEventListener("mouseup", handleMouseUp);
14860
+ document.addEventListener("mousemove", handleMouseMove);
14861
+ },
14862
+ [EVENTS2.MOUSE_MOVE]: (e, _column) => {
14863
+ if (isMouseDown && !isDraging) {
14864
+ isDraging = true;
14865
+ }
14866
+ const target = e.target.closest("th");
14867
+ if (isDraging) {
14868
+ target.style.setProperty("user-select", "none");
14869
+ }
14870
+ if (!isDraging) {
14871
+ if (!target) {
14872
+ return;
14873
+ }
14874
+ const rect = target.getBoundingClientRect();
14875
+ if (rect.width > 12 && rect.right - e.pageX < 8) {
14876
+ isInDragSection = true;
14877
+ target.style.setProperty("cursor", "col-resize");
14878
+ } else {
14879
+ isInDragSection = false;
14880
+ }
14881
+ }
14882
+ },
14883
+ [EVENTS2.MOUSE_OUT]: (e, _column) => {
14884
+ const target = e.target;
14885
+ if (!isDraging) {
14886
+ target.style.setProperty("cursor", "");
14887
+ }
14888
+ }
14889
+ };
14890
+ const getEventName = (event) => `${pluginName}_${event}`;
14891
+ const registerResizeEvent = () => {
14892
+ colgroups.forEach((col) => {
14893
+ if (col.resizable !== false) {
14894
+ Object.keys(handler).forEach((event) => {
14895
+ const name = getEventName(event);
14896
+ if (!col.listeners.has(name)) {
14897
+ col.listeners.set(name, []);
14898
+ }
14899
+ col.listeners.get(name).push(handler[event]);
14900
+ });
14901
+ }
14902
+ });
14903
+ };
14904
+ const resetResizeEvents = () => {
14905
+ colgroups.forEach((col) => {
14906
+ Object.keys(handler).forEach((event) => {
14907
+ const name = getEventName(event);
14908
+ if (col.listeners.has(name)) {
14909
+ const listeners = col.listeners.get(name);
14910
+ listeners.splice(0, listeners.length);
14911
+ }
14692
14912
  });
14693
- const width = `${resolveWidth(getColumnReactWidth(column))}`.replace(/px$/i, "");
14694
- return createVNode("col", {
14695
- "class": colCls,
14696
- "width": width
14697
- }, null);
14698
- })]);
14699
- }
14700
- get filterColgroups() {
14701
- return this.colgroups.filter((col) => !col.isHidden);
14702
- }
14703
- get setting() {
14704
- return this.reactiveProp.setting;
14913
+ });
14914
+ };
14915
+ if (immediate) {
14916
+ registerResizeEvent();
14705
14917
  }
14706
- }
14918
+ const dragOffsetXStyle = computed(() => ({
14919
+ position: "absolute",
14920
+ top: 0,
14921
+ bottom: 0,
14922
+ left: `${dragOffsetX.value}px`,
14923
+ width: "1px",
14924
+ "background-color": "#ebeef5"
14925
+ }));
14926
+ return {
14927
+ registerResizeEvent,
14928
+ resetResizeEvents,
14929
+ dragOffsetX,
14930
+ dragOffsetXStyle
14931
+ };
14932
+ };
14707
14933
  const useClass = (props, root, reactiveProp, pageData) => {
14708
14934
  const autoHeight = ref(200);
14709
14935
  const hasScrollY = ref(false);
@@ -14796,46 +15022,99 @@ const useClass = (props, root, reactiveProp, pageData) => {
14796
15022
  hasFooter
14797
15023
  };
14798
15024
  };
15025
+ const useInit = (props) => {
15026
+ var _a;
15027
+ const colgroups = reactive(((_a = props.columns) != null ? _a : []).map((col) => __spreadProps(__spreadValues({}, col), {
15028
+ calcWidth: null,
15029
+ resizeWidth: null,
15030
+ listeners: /* @__PURE__ */ new Map()
15031
+ })));
15032
+ const { dragOffsetXStyle } = useColumnResize(colgroups, true);
15033
+ const { activeColumns } = useActiveColumns(props);
15034
+ const reactiveSchema = reactive({
15035
+ rowActions: /* @__PURE__ */ new Map(),
15036
+ scrollTranslateY: 0,
15037
+ scrollTranslateX: 0,
15038
+ pos: {
15039
+ bottom: 1
15040
+ },
15041
+ activeColumns,
15042
+ setting: {
15043
+ size: null,
15044
+ height: null
15045
+ }
15046
+ });
15047
+ const isRowExpand = (rowId) => {
15048
+ var _a2;
15049
+ if (reactiveSchema.rowActions.has(rowId)) {
15050
+ return (_a2 = reactiveSchema.rowActions.get(rowId)) == null ? void 0 : _a2.isExpand;
15051
+ }
15052
+ return false;
15053
+ };
15054
+ const setRowExpand = (row, expand = void 0) => {
15055
+ var _a2;
15056
+ const rowId = row[TABLE_ROW_ATTRIBUTE.ROW_UID];
15057
+ const isExpand = typeof expand === "boolean" ? expand : !isRowExpand(rowId);
15058
+ reactiveSchema.rowActions.set(rowId, Object.assign({}, (_a2 = reactiveSchema.rowActions.get(rowId)) != null ? _a2 : {}, { isExpand }));
15059
+ updateIndexData();
15060
+ };
15061
+ const indexData = reactive([]);
15062
+ const initIndexData = (keepLocalAction = false) => {
15063
+ indexData.splice(0, indexData.length, ...props.data.map((item, index) => {
15064
+ const rowId = getRowKey(item, props);
15065
+ return __spreadProps(__spreadValues({}, item), {
15066
+ [TABLE_ROW_ATTRIBUTE.ROW_INDEX]: index + 1,
15067
+ [TABLE_ROW_ATTRIBUTE.ROW_UID]: rowId,
15068
+ [TABLE_ROW_ATTRIBUTE.ROW_EXPAND]: keepLocalAction ? isRowExpand(rowId) : false
15069
+ });
15070
+ }));
15071
+ };
15072
+ const updateIndexData = () => {
15073
+ indexData.forEach((item) => {
15074
+ Object.assign(item, {
15075
+ [TABLE_ROW_ATTRIBUTE.ROW_EXPAND]: isRowExpand(item[TABLE_ROW_ATTRIBUTE.ROW_UID])
15076
+ });
15077
+ });
15078
+ };
15079
+ const { renderFixedColumns, fixedWrapperClass } = useFixedColumn(props, colgroups);
15080
+ return {
15081
+ colgroups,
15082
+ dragOffsetXStyle,
15083
+ reactiveSchema,
15084
+ indexData,
15085
+ fixedWrapperClass,
15086
+ initIndexData,
15087
+ updateIndexData,
15088
+ renderFixedColumns,
15089
+ setRowExpand
15090
+ };
15091
+ };
14799
15092
  var Component$9 = defineComponent({
14800
15093
  name: "Table",
14801
15094
  props: tableProps,
14802
15095
  emits: EMIT_EVENT_TYPES,
14803
15096
  setup(props, ctx) {
14804
- var _a;
14805
- const colgroups = reactive(((_a = props.columns) != null ? _a : []).map((col) => __spreadProps(__spreadValues({}, col), {
14806
- calcWidth: null,
14807
- resizeWidth: null,
14808
- listeners: /* @__PURE__ */ new Map()
14809
- })));
15097
+ const {
15098
+ colgroups,
15099
+ dragOffsetXStyle,
15100
+ reactiveSchema,
15101
+ indexData,
15102
+ renderFixedColumns,
15103
+ setRowExpand,
15104
+ initIndexData,
15105
+ fixedWrapperClass
15106
+ } = useInit(props);
14810
15107
  let columnSortFn = null;
14811
15108
  let columnFilterFn = null;
14812
15109
  let observerIns = null;
14813
15110
  const root = ref();
14814
15111
  const refVirtualRender = ref();
14815
- const {
14816
- dragOffsetXStyle
14817
- } = useColumnResize(colgroups, true);
14818
- const {
14819
- activeColumns
14820
- } = useActiveColumns(props);
14821
- const reactiveProp = reactive({
14822
- scrollTranslateY: 0,
14823
- scrollTranslateX: 0,
14824
- pos: {
14825
- bottom: 1
14826
- },
14827
- activeColumns,
14828
- setting: {
14829
- size: null,
14830
- height: null
14831
- }
14832
- });
14833
15112
  const {
14834
15113
  pageData,
14835
15114
  localPagination,
14836
15115
  resolvePageData,
14837
15116
  watchEffectFn
14838
- } = userPagination(props);
15117
+ } = userPagination(props, indexData);
14839
15118
  const {
14840
15119
  tableClass,
14841
15120
  headClass,
@@ -14847,13 +15126,10 @@ var Component$9 = defineComponent({
14847
15126
  updateBorderClass,
14848
15127
  resetTableHeight,
14849
15128
  hasFooter
14850
- } = useClass(props, root, reactiveProp, pageData);
14851
- const {
14852
- renderFixedColumns,
14853
- fixedWrapperClass
14854
- } = useFixedColumn(props, colgroups);
14855
- const tableRender = new TableRender(props, ctx, reactiveProp, colgroups);
15129
+ } = useClass(props, root, reactiveSchema, pageData);
15130
+ const tableRender = new TableRender(props, ctx, reactiveSchema, colgroups);
14856
15131
  watch(() => [props.data, props.pagination], () => {
15132
+ initIndexData(props.reserveExpand);
14857
15133
  watchEffectFn(columnFilterFn, columnSortFn);
14858
15134
  nextTick(() => {
14859
15135
  resetTableHeight(root.value);
@@ -14896,32 +15172,48 @@ var Component$9 = defineComponent({
14896
15172
  index
14897
15173
  });
14898
15174
  }).on(EVENTS$1.ON_SETTING_CHANGE, (args) => {
14899
- var _a2, _b;
15175
+ var _a, _b;
14900
15176
  const {
14901
15177
  checked = [],
14902
15178
  size,
14903
15179
  height
14904
15180
  } = args;
14905
15181
  checked.length && resolveColumnWidth(root.value, colgroups, 20);
14906
- (_b = (_a2 = refVirtualRender.value) == null ? void 0 : _a2.reset) == null ? void 0 : _b.call(_a2);
15182
+ (_b = (_a = refVirtualRender.value) == null ? void 0 : _a.reset) == null ? void 0 : _b.call(_a);
14907
15183
  ctx.emit(EMITEVENTS.SETTING_CHANGE, {
14908
15184
  checked,
14909
15185
  size,
14910
15186
  height
14911
15187
  });
15188
+ }).on(EVENTS$1.ON_ROW_EXPAND_CLICK, (args) => {
15189
+ const {
15190
+ row,
15191
+ column,
15192
+ index,
15193
+ rows,
15194
+ e
15195
+ } = args;
15196
+ ctx.emit(EMITEVENTS.ROW_EXPAND_CLICK, {
15197
+ row,
15198
+ column,
15199
+ index,
15200
+ rows,
15201
+ e
15202
+ });
15203
+ setRowExpand(row, !row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND]);
14912
15204
  });
14913
15205
  const handleScrollChanged = (args) => {
14914
- var _a2;
14915
- const preBottom = (_a2 = reactiveProp.pos.bottom) != null ? _a2 : 0;
15206
+ var _a;
15207
+ const preBottom = (_a = reactiveSchema.pos.bottom) != null ? _a : 0;
14916
15208
  const pagination2 = args[1];
14917
15209
  const {
14918
15210
  translateX,
14919
15211
  translateY,
14920
15212
  pos = {}
14921
15213
  } = pagination2;
14922
- reactiveProp.scrollTranslateY = translateY;
14923
- reactiveProp.scrollTranslateX = translateX;
14924
- reactiveProp.pos = pos;
15214
+ reactiveSchema.scrollTranslateY = translateY;
15215
+ reactiveSchema.scrollTranslateX = translateX;
15216
+ reactiveSchema.pos = pos;
14925
15217
  const {
14926
15218
  bottom: bottom2
14927
15219
  } = pos;
@@ -14948,6 +15240,9 @@ var Component$9 = defineComponent({
14948
15240
  observerIns = null;
14949
15241
  tableRender.destroy();
14950
15242
  });
15243
+ ctx.expose({
15244
+ setRowExpand
15245
+ });
14951
15246
  const tableBodyClass = __spreadProps(__spreadValues({}, contentClass), {
14952
15247
  "__is-empty": !pageData.length
14953
15248
  });
@@ -15970,11 +16265,11 @@ const tabNavEventProps = {
15970
16265
  },
15971
16266
  tabChange: {
15972
16267
  type: Function,
15973
- default: (name2) => name2
16268
+ default: (name) => name
15974
16269
  },
15975
16270
  tabRemove: {
15976
16271
  type: Function,
15977
- default: (name2) => name2
16272
+ default: (name) => name
15978
16273
  },
15979
16274
  tabSort: {
15980
16275
  type: Function,
@@ -16043,7 +16338,7 @@ var TabNav = defineComponent({
16043
16338
  return null;
16044
16339
  }
16045
16340
  const {
16046
- name: name2,
16341
+ name,
16047
16342
  label,
16048
16343
  closable,
16049
16344
  visible,
@@ -16053,7 +16348,7 @@ var TabNav = defineComponent({
16053
16348
  if (!visible) {
16054
16349
  return false;
16055
16350
  }
16056
- if (props.active === name2) {
16351
+ if (props.active === name) {
16057
16352
  hasFindActive = true;
16058
16353
  }
16059
16354
  const renderLabel = (label2) => {
@@ -16072,7 +16367,7 @@ var TabNav = defineComponent({
16072
16367
  return label2;
16073
16368
  };
16074
16369
  list.push({
16075
- name: name2,
16370
+ name,
16076
16371
  closable,
16077
16372
  visible,
16078
16373
  disabled,
@@ -16118,8 +16413,8 @@ var TabNav = defineComponent({
16118
16413
  }
16119
16414
  props.tabSort(dragStartIndex.value, index, sortType);
16120
16415
  },
16121
- handleTabChange(name2) {
16122
- props.tabChange(name2);
16416
+ handleTabChange(name) {
16417
+ props.tabChange(name);
16123
16418
  },
16124
16419
  handleTabRemove(index, panel) {
16125
16420
  props.tabRemove(index, panel);
@@ -16151,7 +16446,7 @@ var TabNav = defineComponent({
16151
16446
  return null;
16152
16447
  }
16153
16448
  const {
16154
- name: name2,
16449
+ name,
16155
16450
  disabled,
16156
16451
  tabLabel
16157
16452
  } = item;
@@ -16160,15 +16455,15 @@ var TabNav = defineComponent({
16160
16455
  if (disabled) {
16161
16456
  classNames.push("bk-tab-header--disabled");
16162
16457
  }
16163
- if (active === name2) {
16458
+ if (active === name) {
16164
16459
  classNames.push("bk-tab-header--active");
16165
16460
  }
16166
16461
  return classNames.join(" ");
16167
16462
  };
16168
16463
  const getValue = (curentValue, parentValue) => curentValue || parentValue;
16169
16464
  return createVNode("div", {
16170
- "key": name2,
16171
- "onClick": () => this.handleTabChange(name2),
16465
+ "key": name,
16466
+ "onClick": () => this.handleTabChange(name),
16172
16467
  "draggable": getValue(item.sortable, sortable),
16173
16468
  "onDragstart": (e) => dragstart(index, e),
16174
16469
  "onDragenter": (e) => {
@@ -16305,10 +16600,10 @@ var Tab = defineComponent({
16305
16600
  e
16306
16601
  });
16307
16602
  },
16308
- tabChange(name2) {
16309
- emit("change", name2);
16310
- emit("tab-change", name2);
16311
- emit("update:active", name2);
16603
+ tabChange(name) {
16604
+ emit("change", name);
16605
+ emit("tab-change", name);
16606
+ emit("update:active", name);
16312
16607
  },
16313
16608
  tabRemove(index, panel) {
16314
16609
  emit("remove", index, panel);
@@ -22137,144 +22432,6 @@ var useSearch = (props) => {
22137
22432
  isTreeUI
22138
22433
  };
22139
22434
  };
22140
- var rngBrowser = { exports: {} };
22141
- var getRandomValues = typeof crypto != "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != "undefined" && typeof window.msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto);
22142
- if (getRandomValues) {
22143
- var rnds8 = new Uint8Array(16);
22144
- rngBrowser.exports = function whatwgRNG() {
22145
- getRandomValues(rnds8);
22146
- return rnds8;
22147
- };
22148
- } else {
22149
- var rnds = new Array(16);
22150
- rngBrowser.exports = function mathRNG() {
22151
- for (var i = 0, r2; i < 16; i++) {
22152
- if ((i & 3) === 0)
22153
- r2 = Math.random() * 4294967296;
22154
- rnds[i] = r2 >>> ((i & 3) << 3) & 255;
22155
- }
22156
- return rnds;
22157
- };
22158
- }
22159
- var byteToHex = [];
22160
- for (var i = 0; i < 256; ++i) {
22161
- byteToHex[i] = (i + 256).toString(16).substr(1);
22162
- }
22163
- function bytesToUuid$2(buf, offset2) {
22164
- var i = offset2 || 0;
22165
- var bth = byteToHex;
22166
- return [
22167
- bth[buf[i++]],
22168
- bth[buf[i++]],
22169
- bth[buf[i++]],
22170
- bth[buf[i++]],
22171
- "-",
22172
- bth[buf[i++]],
22173
- bth[buf[i++]],
22174
- "-",
22175
- bth[buf[i++]],
22176
- bth[buf[i++]],
22177
- "-",
22178
- bth[buf[i++]],
22179
- bth[buf[i++]],
22180
- "-",
22181
- bth[buf[i++]],
22182
- bth[buf[i++]],
22183
- bth[buf[i++]],
22184
- bth[buf[i++]],
22185
- bth[buf[i++]],
22186
- bth[buf[i++]]
22187
- ].join("");
22188
- }
22189
- var bytesToUuid_1 = bytesToUuid$2;
22190
- var rng$1 = rngBrowser.exports;
22191
- var bytesToUuid$1 = bytesToUuid_1;
22192
- var _nodeId;
22193
- var _clockseq;
22194
- var _lastMSecs = 0;
22195
- var _lastNSecs = 0;
22196
- function v1$1(options, buf, offset2) {
22197
- var i = buf && offset2 || 0;
22198
- var b2 = buf || [];
22199
- options = options || {};
22200
- var node = options.node || _nodeId;
22201
- var clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq;
22202
- if (node == null || clockseq == null) {
22203
- var seedBytes = rng$1();
22204
- if (node == null) {
22205
- node = _nodeId = [
22206
- seedBytes[0] | 1,
22207
- seedBytes[1],
22208
- seedBytes[2],
22209
- seedBytes[3],
22210
- seedBytes[4],
22211
- seedBytes[5]
22212
- ];
22213
- }
22214
- if (clockseq == null) {
22215
- clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383;
22216
- }
22217
- }
22218
- var msecs = options.msecs !== void 0 ? options.msecs : new Date().getTime();
22219
- var nsecs = options.nsecs !== void 0 ? options.nsecs : _lastNSecs + 1;
22220
- var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4;
22221
- if (dt < 0 && options.clockseq === void 0) {
22222
- clockseq = clockseq + 1 & 16383;
22223
- }
22224
- if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === void 0) {
22225
- nsecs = 0;
22226
- }
22227
- if (nsecs >= 1e4) {
22228
- throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
22229
- }
22230
- _lastMSecs = msecs;
22231
- _lastNSecs = nsecs;
22232
- _clockseq = clockseq;
22233
- msecs += 122192928e5;
22234
- var tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296;
22235
- b2[i++] = tl >>> 24 & 255;
22236
- b2[i++] = tl >>> 16 & 255;
22237
- b2[i++] = tl >>> 8 & 255;
22238
- b2[i++] = tl & 255;
22239
- var tmh = msecs / 4294967296 * 1e4 & 268435455;
22240
- b2[i++] = tmh >>> 8 & 255;
22241
- b2[i++] = tmh & 255;
22242
- b2[i++] = tmh >>> 24 & 15 | 16;
22243
- b2[i++] = tmh >>> 16 & 255;
22244
- b2[i++] = clockseq >>> 8 | 128;
22245
- b2[i++] = clockseq & 255;
22246
- for (var n2 = 0; n2 < 6; ++n2) {
22247
- b2[i + n2] = node[n2];
22248
- }
22249
- return buf ? buf : bytesToUuid$1(b2);
22250
- }
22251
- var v1_1 = v1$1;
22252
- var rng = rngBrowser.exports;
22253
- var bytesToUuid = bytesToUuid_1;
22254
- function v4$1(options, buf, offset2) {
22255
- var i = buf && offset2 || 0;
22256
- if (typeof options == "string") {
22257
- buf = options === "binary" ? new Array(16) : null;
22258
- options = null;
22259
- }
22260
- options = options || {};
22261
- var rnds = options.random || (options.rng || rng)();
22262
- rnds[6] = rnds[6] & 15 | 64;
22263
- rnds[8] = rnds[8] & 63 | 128;
22264
- if (buf) {
22265
- for (var ii = 0; ii < 16; ++ii) {
22266
- buf[i + ii] = rnds[ii];
22267
- }
22268
- }
22269
- return buf || bytesToUuid(rnds);
22270
- }
22271
- var v4_1 = v4$1;
22272
- var v1 = v1_1;
22273
- var v4 = v4_1;
22274
- var uuid = v4;
22275
- uuid.v1 = v1;
22276
- uuid.v4 = v4;
22277
- var uuid_1 = uuid;
22278
22435
  var useTreeInit = (props) => {
22279
22436
  var _a;
22280
22437
  const getFlatdata = (props2, treeData = void 0, cachedSchema = []) => {
@@ -22949,8 +23106,7 @@ var FormItem = defineComponent({
22949
23106
  rules = props.rules;
22950
23107
  }
22951
23108
  rules = getTriggerRules(trigger, mergeRules(rules, getRulesFromProps(props)));
22952
- console.log(rules);
22953
- const value = form2.props.model[props.property];
23109
+ const value = lodash.exports.get(form2.props.model, props.property);
22954
23110
  const doValidate = (() => {
22955
23111
  let stepIndex = -1;
22956
23112
  return () => {