bkui-vue 0.0.1-beta.454 → 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,
@@ -31753,6 +31804,7 @@ var FormItem = defineComponent({
31753
31804
  }
31754
31805
  });
31755
31806
  const BkForm = withInstallProps(Form, { FormItem, ComposeFormItem });
31807
+ const containerKey = Symbol("containerProps");
31756
31808
  const colProps = {
31757
31809
  span: PropTypes.number.def(1),
31758
31810
  offset: PropTypes.number.def(0),
@@ -31768,7 +31820,7 @@ var Col = defineComponent({
31768
31820
  col,
31769
31821
  gutter,
31770
31822
  flex
31771
- } = inject("containerProps");
31823
+ } = inject(containerKey);
31772
31824
  const {
31773
31825
  span,
31774
31826
  offset: offset2,
@@ -31819,7 +31871,7 @@ var Container = defineComponent({
31819
31871
  flex,
31820
31872
  extCls
31821
31873
  } = props2;
31822
- provide("containerProps", {
31874
+ provide(containerKey, {
31823
31875
  col,
31824
31876
  gutter,
31825
31877
  flex
@@ -31851,7 +31903,7 @@ var Row = defineComponent({
31851
31903
  col,
31852
31904
  gutter,
31853
31905
  flex
31854
- } = inject("containerProps");
31906
+ } = inject(containerKey);
31855
31907
  provide("containerProps", {
31856
31908
  col,
31857
31909
  gutter,
@@ -32028,18 +32080,32 @@ var CascaderPanel = defineComponent({
32028
32080
  menus.list = menus.list.slice(0, 1);
32029
32081
  activePath.value = [];
32030
32082
  }
32031
- value.forEach((id) => {
32083
+ expandByNodeList(value);
32084
+ checkValue.value = value;
32085
+ };
32086
+ const expandByNodeList = (value) => {
32087
+ let targetList = [];
32088
+ if (store.config.multiple) {
32089
+ for (const subArray of value) {
32090
+ if (subArray.length > targetList.length) {
32091
+ targetList = subArray;
32092
+ }
32093
+ }
32094
+ } else {
32095
+ targetList = value;
32096
+ }
32097
+ targetList.forEach((id) => {
32032
32098
  const node = store.getNodeById(id);
32033
32099
  nodeExpandHandler(node);
32034
32100
  });
32035
- checkValue.value = value;
32036
32101
  };
32037
32102
  const nodeCheckHandler = (node) => {
32038
32103
  if (node.isDisabled) {
32039
32104
  return;
32040
32105
  }
32041
32106
  if (node.config.multiple) {
32042
- checkValue.value = store.getCheckedNodes().map((node2) => node2.path);
32107
+ const targets = store.config.checkAnyLevel ? store.getCheckedNodes() : store.getCheckedLeafNodes();
32108
+ checkValue.value = targets.map((node2) => node2.path);
32043
32109
  } else {
32044
32110
  checkValue.value = node.path;
32045
32111
  }
@@ -32148,6 +32214,7 @@ var CascaderPanel = defineComponent({
32148
32214
  panelWidth,
32149
32215
  panelHeight,
32150
32216
  searchPanelEvents,
32217
+ expandByNodeList,
32151
32218
  noDataText
32152
32219
  };
32153
32220
  },
@@ -32290,15 +32357,13 @@ class Node$1 {
32290
32357
  this.isIndeterminate = checkedNum !== totalNum && checkedNum > 0;
32291
32358
  }
32292
32359
  setNodeCheck(status) {
32293
- if (this.checked !== status) {
32294
- if (this.config.checkAnyLevel) {
32295
- this.checked = status;
32296
- return;
32297
- }
32298
- this.broadcast("check", status);
32299
- this.setCheckState(status);
32300
- this.emit("check");
32360
+ if (this.config.checkAnyLevel) {
32361
+ this.checked = status;
32362
+ return;
32301
32363
  }
32364
+ this.broadcast("check", status);
32365
+ this.setCheckState(status);
32366
+ this.emit("check");
32302
32367
  }
32303
32368
  calculateNodesPath() {
32304
32369
  const nodes = [this];
@@ -32331,14 +32396,14 @@ class Store {
32331
32396
  }
32332
32397
  clearChecked() {
32333
32398
  this.getFlattedNodes().forEach((node) => {
32334
- node.checked = false;
32399
+ node.setNodeCheck(false);
32335
32400
  node.isIndeterminate = false;
32336
32401
  });
32337
32402
  }
32338
32403
  removeTag(tag2) {
32339
32404
  this.getFlattedNodes().find((node) => {
32340
32405
  if (arrayEqual(tag2, node.path)) {
32341
- node.checked = false;
32406
+ node.setNodeCheck(false);
32342
32407
  return true;
32343
32408
  }
32344
32409
  return false;
@@ -32349,17 +32414,20 @@ class Store {
32349
32414
  }
32350
32415
  setNodesCheck(nodes) {
32351
32416
  this.getFlattedNodes().forEach((node) => {
32352
- node.checked = false;
32417
+ node.setNodeCheck(false);
32353
32418
  const checkedNode = nodes.find((nodeValue) => arrayEqual(node.path, nodeValue));
32354
32419
  if (checkedNode) {
32355
32420
  const currentNode = this.getNodeByValue(checkedNode);
32356
- currentNode.checked = true;
32421
+ currentNode.setNodeCheck(true);
32357
32422
  }
32358
32423
  });
32359
32424
  }
32360
32425
  getCheckedNodes() {
32361
32426
  return this.getFlattedNodes().filter((node) => node.checked);
32362
32427
  }
32428
+ getCheckedLeafNodes() {
32429
+ return this.getFlattedNodes().filter((node) => node.isLeaf && node.checked);
32430
+ }
32363
32431
  getNodeByValue(value) {
32364
32432
  var _a;
32365
32433
  const nodes = this.getFlattedNodes().filter((node) => arrayEqual(node.path, value));
@@ -32462,22 +32530,18 @@ var Component$8 = defineComponent({
32462
32530
  var _a;
32463
32531
  if (multiple) {
32464
32532
  store.value.setNodesCheck(val);
32465
- selectedTags.value = store.value.getCheckedNodes().map((node) => ({
32466
- text: getShowText(node),
32467
- key: node.id
32533
+ selectedTags.value = store.value.getCheckedNodes().filter((node2) => store.value.config.checkAnyLevel || node2.isLeaf).map((node2) => ({
32534
+ text: getShowText(node2),
32535
+ key: node2.id
32468
32536
  }));
32469
32537
  selectedText.value = selectedTags.value.map((item) => item.text).join(", ");
32470
32538
  return;
32471
32539
  }
32472
- !props2.checkAnyLevel && ((_a = popover2 == null ? void 0 : popover2.value) == null ? void 0 : _a.hide());
32473
- if (val.length === 0) {
32474
- selectedText.value = "";
32475
- } else {
32476
- const node = store.value.getNodeByValue(val);
32477
- if (!node)
32478
- return;
32479
- selectedText.value = getShowText(node);
32540
+ if (!props2.checkAnyLevel) {
32541
+ (_a = popover2 == null ? void 0 : popover2.value) == null ? void 0 : _a.hide();
32480
32542
  }
32543
+ const node = store.value.getNodeByValue(val);
32544
+ selectedText.value = node ? getShowText(node) : "";
32481
32545
  updateSearchKey();
32482
32546
  };
32483
32547
  const handleClear = (e) => {