bkui-vue 0.0.1-beta.455 → 0.0.1-beta.456

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
@@ -10393,11 +10393,6 @@ var Component$x = defineComponent({
10393
10393
  var _a2;
10394
10394
  isFocused.value = false;
10395
10395
  ctx.emit(EVENTS$2.BLUR, e);
10396
- if (isNumberInput.value && Number.isInteger(parseInt(e.target.value, 10)) && (e.target.value > props2.max || e.target.value < props2.min)) {
10397
- const val = e.target.value > props2.max ? props2.max : props2.min;
10398
- ctx.emit(EVENTS$2.UPDATE, val);
10399
- ctx.emit(EVENTS$2.CHANGE, val);
10400
- }
10401
10396
  if (props2.withValidate) {
10402
10397
  (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur");
10403
10398
  }
@@ -10412,6 +10407,14 @@ var Component$x = defineComponent({
10412
10407
  return;
10413
10408
  if (eventName === EVENTS$2.INPUT) {
10414
10409
  ctx.emit(EVENTS$2.UPDATE, e.target.value);
10410
+ } else if (eventName === EVENTS$2.CHANGE && isNumberInput.value) {
10411
+ const val = parseInt(e.target.value, 10);
10412
+ if (val > props2.max || val < props2.min) {
10413
+ const limitVal = val > props2.max ? props2.max : props2.min;
10414
+ ctx.emit(EVENTS$2.UPDATE, limitVal, e);
10415
+ ctx.emit(eventName, limitVal, e);
10416
+ return;
10417
+ }
10415
10418
  }
10416
10419
  ctx.emit(eventName, e.target.value, e);
10417
10420
  };
@@ -11361,10 +11364,16 @@ var Dialog = defineComponent({
11361
11364
  }
11362
11365
  emit("value-change", val);
11363
11366
  });
11364
- const handleClose = () => {
11365
- emit("update:isShow", false);
11366
- emit("closed");
11367
- isModalShow.value = false;
11367
+ const handleClose = async () => {
11368
+ let shouldClose = true;
11369
+ if (typeof props2.beforeClose === "function") {
11370
+ shouldClose = await props2.beforeClose();
11371
+ }
11372
+ if (shouldClose) {
11373
+ emit("update:isShow", false);
11374
+ emit("closed");
11375
+ isModalShow.value = false;
11376
+ }
11368
11377
  };
11369
11378
  const handleConfirm = () => {
11370
11379
  emit("update:isShow", false);
@@ -17481,7 +17490,9 @@ const EMIT_EVENT_TYPES = {
17481
17490
  ["settingChange"]: EMPTY$1,
17482
17491
  ["scrollBottom"]: EMPTY$1,
17483
17492
  ["cellClick"]: EMPTY$1,
17484
- ["cellDblclick"]: EMPTY$1
17493
+ ["cellDblclick"]: EMPTY$1,
17494
+ ["rowMouseEnter"]: EMPTY$1,
17495
+ ["rowMouseLeave"]: EMPTY$1
17485
17496
  };
17486
17497
  const TABLE_ROW_ATTRIBUTE = {
17487
17498
  ROW_INDEX: "__$table_row_index",
@@ -17673,7 +17684,8 @@ const tableProps = {
17673
17684
  }),
17674
17685
  observerResize: PropTypes.bool.def(true),
17675
17686
  align: TableAlign,
17676
- headerAlign: TableAlign
17687
+ headerAlign: TableAlign,
17688
+ prependStyle: PropTypes.style().def({})
17677
17689
  };
17678
17690
  var Column = defineComponent({
17679
17691
  name: "TableColumn",
@@ -17805,7 +17817,7 @@ var usePagination = (props2, indexData) => {
17805
17817
  const resetStartEndIndex = () => {
17806
17818
  if (!props2.pagination || props2.remotePagination) {
17807
17819
  startIndex.value = 0;
17808
- endIndex.value = props2.data.length;
17820
+ endIndex.value = indexData.length;
17809
17821
  return;
17810
17822
  }
17811
17823
  startIndex.value = (pagination2.current - 1) * pagination2.limit;
@@ -17819,7 +17831,7 @@ var usePagination = (props2, indexData) => {
17819
17831
  };
17820
17832
  const filter = (sourceData, filterFn) => {
17821
17833
  if (typeof filterFn === "function") {
17822
- const filterVals = sourceData.filter((row, index2) => filterFn(row, index2, props2.data));
17834
+ const filterVals = sourceData.filter((row, index2) => filterFn(row, index2, indexData));
17823
17835
  sourceData.length = 0;
17824
17836
  sourceData.push(...filterVals);
17825
17837
  }
@@ -17849,7 +17861,7 @@ var usePagination = (props2, indexData) => {
17849
17861
  return;
17850
17862
  }
17851
17863
  localPagination.value = props2.remotePagination ? pagination2 : __spreadProps(__spreadValues({}, pagination2), {
17852
- count: props2.data.length
17864
+ count: indexData.length
17853
17865
  });
17854
17866
  };
17855
17867
  return {
@@ -20168,6 +20180,7 @@ class TableRender {
20168
20180
  default: () => [createVNode("tr", {
20169
20181
  "style": rowStyle,
20170
20182
  "class": rowClass,
20183
+ "data-key": rowKey,
20171
20184
  "onClick": (e) => this.handleRowClick(e, row, rowIndex, rows),
20172
20185
  "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows),
20173
20186
  "onMouseenter": (e) => this.handleRowEnter(e, row, rowIndex, rows),
@@ -20931,12 +20944,13 @@ const useInit = (props2, targetColumns) => {
20931
20944
  const initIndexData = (keepLocalAction = false) => {
20932
20945
  let preRowId = null;
20933
20946
  const skipConfig = {};
20947
+ const resolvedData = props2.data.map((d2) => __spreadValues({ [TABLE_ROW_ATTRIBUTE.ROW_UID]: uuid_1.v4() }, d2));
20934
20948
  if (neepColspanOrRowspan.value || needSelection.value || needExpand.value || needIndexColumn.value) {
20935
- const copyData = props2.data.map((item, index2) => {
20949
+ const copyData = resolvedData.map((item, index2) => {
20936
20950
  const rowId = getRowKey(item, props2, index2);
20937
20951
  preRowId = rowId;
20938
20952
  const target = __spreadProps(__spreadValues({}, item), {
20939
- [TABLE_ROW_ATTRIBUTE.ROW_UID]: rowId,
20953
+ [TABLE_ROW_ATTRIBUTE.ROW_UID]: item[TABLE_ROW_ATTRIBUTE.ROW_UID] || rowId,
20940
20954
  [TABLE_ROW_ATTRIBUTE.ROW_SOURCE_DATA]: __spreadValues({}, item)
20941
20955
  });
20942
20956
  if (neepColspanOrRowspan.value) {
@@ -20962,7 +20976,7 @@ const useInit = (props2, targetColumns) => {
20962
20976
  return;
20963
20977
  }
20964
20978
  indexData.length = 0;
20965
- indexData.push(...props2.data);
20979
+ indexData.push(...resolvedData);
20966
20980
  };
20967
20981
  const isRowChecked = (isRowCheckEnable, selectedAll, item, index2) => {
20968
20982
  const isChecked = resolveSelection(item, item[TABLE_ROW_ATTRIBUTE.ROW_UID], index2);
@@ -21397,6 +21411,19 @@ var Component$f = defineComponent({
21397
21411
  scrollXName: "",
21398
21412
  scrollYName: ""
21399
21413
  });
21414
+ const prependStyle = computed(() => __spreadValues({
21415
+ position: "sticky",
21416
+ top: 0,
21417
+ zIndex: 2
21418
+ }, props2.prependStyle || {}));
21419
+ const renderPrepend = () => {
21420
+ if (ctx.slots.prepend) {
21421
+ return createVNode("div", {
21422
+ "style": prependStyle.value
21423
+ }, [ctx.slots.prepend()]);
21424
+ }
21425
+ return null;
21426
+ };
21400
21427
  return () => {
21401
21428
  var _a, _b;
21402
21429
  return createVNode("div", {
@@ -21422,7 +21449,8 @@ var Component$f = defineComponent({
21422
21449
  "rowKey": props2.rowKey,
21423
21450
  "enabled": props2.virtualEnabled
21424
21451
  }), {
21425
- default: (scope) => tableRender.renderTableBodySchema(scope.data || props2.data),
21452
+ beforeContent: () => renderPrepend(),
21453
+ default: (scope) => tableRender.renderTableBodySchema(scope.data || pageData),
21426
21454
  afterSection: () => createVNode("div", {
21427
21455
  "class": fixedBottomBorder.value
21428
21456
  }, null)
@@ -30094,7 +30122,8 @@ const treeProps = {
30094
30122
  nodeContentAction: PropTypes.oneOfType([
30095
30123
  PropTypes.arrayOf(j("nodeContentActionType", {}).def(NodeContentActionEnum.CLICK)),
30096
30124
  PropTypes.func.def(() => ["selected"])
30097
- ]).def(["selected", "expand", "click"])
30125
+ ]).def(["selected", "expand", "click"]),
30126
+ keepSlotData: PropTypes.bool.def(false)
30098
30127
  };
30099
30128
  var useEmpty = (props2, {
30100
30129
  slots
@@ -30187,6 +30216,10 @@ var useNodeAttribute = (flatData, props2) => {
30187
30216
  const extendNodeAttr = (item) => __spreadProps(__spreadValues({}, item), {
30188
30217
  [NODE_ATTRIBUTES.TREE_NODE_ATTR]: resolveScopedSlotParam(item)
30189
30218
  });
30219
+ const extendNodeScopedData = (item) => ({
30220
+ data: item,
30221
+ attributes: resolveScopedSlotParam(item)
30222
+ });
30190
30223
  return {
30191
30224
  getSchemaVal: getSchemaVal2,
30192
30225
  getNodeAttr: getNodeAttr2,
@@ -30211,7 +30244,8 @@ var useNodeAttribute = (flatData, props2) => {
30211
30244
  resolveScopedSlotParam,
30212
30245
  setTreeNodeLoading,
30213
30246
  extendNodeAttr,
30214
- getChildNodes
30247
+ getChildNodes,
30248
+ extendNodeScopedData
30215
30249
  };
30216
30250
  };
30217
30251
  const DEFAULT_LEVLE_LINE = "1px dashed #c3cdd7";
@@ -30390,7 +30424,8 @@ var useNodeAction = (props2, ctx, flatData, _renderData, schemaValues, initOptio
30390
30424
  isNodeChecked,
30391
30425
  getParentNode: getParentNode2,
30392
30426
  resolveScopedSlotParam,
30393
- extendNodeAttr
30427
+ extendNodeAttr,
30428
+ extendNodeScopedData
30394
30429
  } = useNodeAttribute(flatData, props2);
30395
30430
  const {
30396
30431
  registerNextLoop
@@ -30427,18 +30462,18 @@ var useNodeAction = (props2, ctx, flatData, _renderData, schemaValues, initOptio
30427
30462
  };
30428
30463
  const getLoadingIcon = (item) => {
30429
30464
  var _a, _b, _c;
30430
- return ((_c = (_b = (_a = ctx.slots).nodeLoading) == null ? void 0 : _b.call(_a, extendNodeAttr(item))) != null ? _c : isNodeLoading(item)) ? createVNode(spinner, null, null) : "";
30465
+ return ((_c = (_b = (_a = ctx.slots).nodeLoading) == null ? void 0 : _b.call(_a, getScopedSlotData(item))) != null ? _c : isNodeLoading(item)) ? createVNode(spinner, null, null) : "";
30431
30466
  };
30432
30467
  const getActionIcon = (item) => {
30433
30468
  if (ctx.slots.nodeAction) {
30434
- return ctx.slots.nodeAction(extendNodeAttr(item));
30469
+ return ctx.slots.nodeAction(getScopedSlotData(item));
30435
30470
  }
30436
30471
  let prefixFnVal = null;
30437
30472
  if (isNodeLoading(item)) {
30438
30473
  return getLoadingIcon(item);
30439
30474
  }
30440
30475
  if (typeof props2.prefixIcon === "function") {
30441
- prefixFnVal = props2.prefixIcon(extendNodeAttr(item), "node_action");
30476
+ prefixFnVal = props2.prefixIcon(getScopedSlotData(item), "node_action");
30442
30477
  if (prefixFnVal !== "default") {
30443
30478
  return renderPrefixVal(prefixFnVal);
30444
30479
  }
@@ -30459,11 +30494,11 @@ var useNodeAction = (props2, ctx, flatData, _renderData, schemaValues, initOptio
30459
30494
  return null;
30460
30495
  }
30461
30496
  if (ctx.slots.nodeType) {
30462
- return ctx.slots.nodeType(extendNodeAttr(item));
30497
+ return ctx.slots.nodeType(getScopedSlotData(item));
30463
30498
  }
30464
30499
  let prefixFnVal = null;
30465
30500
  if (typeof props2.prefixIcon === "function") {
30466
- prefixFnVal = props2.prefixIcon(extendNodeAttr(item), "node_type");
30501
+ prefixFnVal = props2.prefixIcon(getScopedSlotData(item), "node_type");
30467
30502
  if (prefixFnVal !== "default") {
30468
30503
  return renderPrefixVal(prefixFnVal);
30469
30504
  }
@@ -30679,8 +30714,24 @@ var useNodeAction = (props2, ctx, flatData, _renderData, schemaValues, initOptio
30679
30714
  "style": getNodeLineStyle(maxDeep - index2)
30680
30715
  }, null));
30681
30716
  };
30717
+ const renderNodeSlots = (item) => {
30718
+ var _a, _b, _c, _d;
30719
+ if (ctx.slots.node) {
30720
+ return (_b = (_a = ctx.slots).node) == null ? void 0 : _b.call(_a, getScopedSlotData(item));
30721
+ }
30722
+ if (ctx.slots.default) {
30723
+ return (_d = (_c = ctx.slots).default) == null ? void 0 : _d.call(_c, extendNodeScopedData(item));
30724
+ }
30725
+ return [getLabel(item, props2)];
30726
+ };
30727
+ const getScopedSlotData = (item) => {
30728
+ if (props2.keepSlotData) {
30729
+ return extendNodeScopedData(item);
30730
+ }
30731
+ return extendNodeAttr(item);
30732
+ };
30682
30733
  const renderTreeNode = (item) => {
30683
- var _a, _b, _c, _d, _e;
30734
+ var _a, _b;
30684
30735
  return createVNode("div", {
30685
30736
  "data-tree-node": getNodeId(item),
30686
30737
  "key": getNodeId(item),
@@ -30696,7 +30747,7 @@ var useNodeAction = (props2, ctx, flatData, _renderData, schemaValues, initOptio
30696
30747
  "class": resolveClassName("node-content")
30697
30748
  }, [[getCheckboxRender(item), getNodePrefixIcon(item)], createVNode("span", {
30698
30749
  "class": resolveClassName("node-text")
30699
- }, [(_c = (_b = (_a = ctx.slots).node) == null ? void 0 : _b.call(_a, extendNodeAttr(item))) != null ? _c : [getLabel(item, props2)]]), (_e = (_d = ctx.slots).nodeAppend) == null ? void 0 : _e.call(_d, extendNodeAttr(item))]), getVirtualLines(item)])]);
30750
+ }, [renderNodeSlots(item)]), (_b = (_a = ctx.slots).nodeAppend) == null ? void 0 : _b.call(_a, getScopedSlotData(item))]), getVirtualLines(item)])]);
30700
30751
  };
30701
30752
  return {
30702
30753
  renderTreeNode,