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

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
  };
@@ -11156,10 +11159,10 @@ var Component$u = defineComponent({
11156
11159
  },
11157
11160
  computed: {
11158
11161
  dialogWidth() {
11159
- return /^\d+$/.test(`${this.width}`) ? `${this.width}px` : this.width;
11162
+ return /^\d+\.?\d*$/.test(`${this.width}`) ? `${this.width}px` : this.width;
11160
11163
  },
11161
11164
  dialogHeight() {
11162
- return /^\d+$/.test(`${this.height}`) ? `${this.height}px` : this.height;
11165
+ return /^\d+\.?\d*$/.test(`${this.height}`) ? `${this.height}px` : this.height;
11163
11166
  },
11164
11167
  compStyle() {
11165
11168
  return {
@@ -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);
@@ -13618,13 +13627,20 @@ var usePopperId = (props2, prefix = "#") => {
13618
13627
  }
13619
13628
  };
13620
13629
  const resolveCommonBoundary = () => {
13621
- if (!/^body$/i.test(props2.boundary) && typeof props2.boundary === "string") {
13622
- if (!isAvailableId(props2.boundary)) {
13623
- console.error("props.boundary is not available selector");
13624
- resolvedBoundary = "body";
13630
+ if (!/^body$/i.test(props2.boundary)) {
13631
+ if (typeof props2.boundary === "string") {
13632
+ if (!isAvailableId(props2.boundary)) {
13633
+ console.error("props.boundary is not available selector");
13634
+ resolvedBoundary = "body";
13635
+ return;
13636
+ }
13637
+ resolvedBoundary = props2.boundary;
13638
+ return;
13639
+ }
13640
+ if (isElement(props2.boundary)) {
13641
+ resolvedBoundary = props2.boundary;
13625
13642
  return;
13626
13643
  }
13627
- resolvedBoundary = props2.boundary;
13628
13644
  }
13629
13645
  };
13630
13646
  resolveBoundary(resolveParentBoundary);
@@ -17481,7 +17497,9 @@ const EMIT_EVENT_TYPES = {
17481
17497
  ["settingChange"]: EMPTY$1,
17482
17498
  ["scrollBottom"]: EMPTY$1,
17483
17499
  ["cellClick"]: EMPTY$1,
17484
- ["cellDblclick"]: EMPTY$1
17500
+ ["cellDblclick"]: EMPTY$1,
17501
+ ["rowMouseEnter"]: EMPTY$1,
17502
+ ["rowMouseLeave"]: EMPTY$1
17485
17503
  };
17486
17504
  const TABLE_ROW_ATTRIBUTE = {
17487
17505
  ROW_INDEX: "__$table_row_index",
@@ -17673,7 +17691,8 @@ const tableProps = {
17673
17691
  }),
17674
17692
  observerResize: PropTypes.bool.def(true),
17675
17693
  align: TableAlign,
17676
- headerAlign: TableAlign
17694
+ headerAlign: TableAlign,
17695
+ prependStyle: PropTypes.style().def({})
17677
17696
  };
17678
17697
  var Column = defineComponent({
17679
17698
  name: "TableColumn",
@@ -17805,7 +17824,7 @@ var usePagination = (props2, indexData) => {
17805
17824
  const resetStartEndIndex = () => {
17806
17825
  if (!props2.pagination || props2.remotePagination) {
17807
17826
  startIndex.value = 0;
17808
- endIndex.value = props2.data.length;
17827
+ endIndex.value = indexData.length;
17809
17828
  return;
17810
17829
  }
17811
17830
  startIndex.value = (pagination2.current - 1) * pagination2.limit;
@@ -17819,7 +17838,7 @@ var usePagination = (props2, indexData) => {
17819
17838
  };
17820
17839
  const filter = (sourceData, filterFn) => {
17821
17840
  if (typeof filterFn === "function") {
17822
- const filterVals = sourceData.filter((row, index2) => filterFn(row, index2, props2.data));
17841
+ const filterVals = sourceData.filter((row, index2) => filterFn(row, index2, indexData));
17823
17842
  sourceData.length = 0;
17824
17843
  sourceData.push(...filterVals);
17825
17844
  }
@@ -17849,7 +17868,7 @@ var usePagination = (props2, indexData) => {
17849
17868
  return;
17850
17869
  }
17851
17870
  localPagination.value = props2.remotePagination ? pagination2 : __spreadProps(__spreadValues({}, pagination2), {
17852
- count: props2.data.length
17871
+ count: indexData.length
17853
17872
  });
17854
17873
  };
17855
17874
  return {
@@ -20168,6 +20187,7 @@ class TableRender {
20168
20187
  default: () => [createVNode("tr", {
20169
20188
  "style": rowStyle,
20170
20189
  "class": rowClass,
20190
+ "data-key": rowKey,
20171
20191
  "onClick": (e) => this.handleRowClick(e, row, rowIndex, rows),
20172
20192
  "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows),
20173
20193
  "onMouseenter": (e) => this.handleRowEnter(e, row, rowIndex, rows),
@@ -20931,12 +20951,13 @@ const useInit = (props2, targetColumns) => {
20931
20951
  const initIndexData = (keepLocalAction = false) => {
20932
20952
  let preRowId = null;
20933
20953
  const skipConfig = {};
20954
+ const resolvedData = props2.data.map((d2) => __spreadValues({ [TABLE_ROW_ATTRIBUTE.ROW_UID]: uuid_1.v4() }, d2));
20934
20955
  if (neepColspanOrRowspan.value || needSelection.value || needExpand.value || needIndexColumn.value) {
20935
- const copyData = props2.data.map((item, index2) => {
20956
+ const copyData = resolvedData.map((item, index2) => {
20936
20957
  const rowId = getRowKey(item, props2, index2);
20937
20958
  preRowId = rowId;
20938
20959
  const target = __spreadProps(__spreadValues({}, item), {
20939
- [TABLE_ROW_ATTRIBUTE.ROW_UID]: rowId,
20960
+ [TABLE_ROW_ATTRIBUTE.ROW_UID]: item[TABLE_ROW_ATTRIBUTE.ROW_UID] || rowId,
20940
20961
  [TABLE_ROW_ATTRIBUTE.ROW_SOURCE_DATA]: __spreadValues({}, item)
20941
20962
  });
20942
20963
  if (neepColspanOrRowspan.value) {
@@ -20962,7 +20983,7 @@ const useInit = (props2, targetColumns) => {
20962
20983
  return;
20963
20984
  }
20964
20985
  indexData.length = 0;
20965
- indexData.push(...props2.data);
20986
+ indexData.push(...resolvedData);
20966
20987
  };
20967
20988
  const isRowChecked = (isRowCheckEnable, selectedAll, item, index2) => {
20968
20989
  const isChecked = resolveSelection(item, item[TABLE_ROW_ATTRIBUTE.ROW_UID], index2);
@@ -21397,6 +21418,19 @@ var Component$f = defineComponent({
21397
21418
  scrollXName: "",
21398
21419
  scrollYName: ""
21399
21420
  });
21421
+ const prependStyle = computed(() => __spreadValues({
21422
+ position: "sticky",
21423
+ top: 0,
21424
+ zIndex: 2
21425
+ }, props2.prependStyle || {}));
21426
+ const renderPrepend = () => {
21427
+ if (ctx.slots.prepend) {
21428
+ return createVNode("div", {
21429
+ "style": prependStyle.value
21430
+ }, [ctx.slots.prepend()]);
21431
+ }
21432
+ return null;
21433
+ };
21400
21434
  return () => {
21401
21435
  var _a, _b;
21402
21436
  return createVNode("div", {
@@ -21422,7 +21456,8 @@ var Component$f = defineComponent({
21422
21456
  "rowKey": props2.rowKey,
21423
21457
  "enabled": props2.virtualEnabled
21424
21458
  }), {
21425
- default: (scope) => tableRender.renderTableBodySchema(scope.data || props2.data),
21459
+ beforeContent: () => renderPrepend(),
21460
+ default: (scope) => tableRender.renderTableBodySchema(scope.data || pageData),
21426
21461
  afterSection: () => createVNode("div", {
21427
21462
  "class": fixedBottomBorder.value
21428
21463
  }, null)
@@ -30094,7 +30129,8 @@ const treeProps = {
30094
30129
  nodeContentAction: PropTypes.oneOfType([
30095
30130
  PropTypes.arrayOf(j("nodeContentActionType", {}).def(NodeContentActionEnum.CLICK)),
30096
30131
  PropTypes.func.def(() => ["selected"])
30097
- ]).def(["selected", "expand", "click"])
30132
+ ]).def(["selected", "expand", "click"]),
30133
+ keepSlotData: PropTypes.bool.def(false)
30098
30134
  };
30099
30135
  var useEmpty = (props2, {
30100
30136
  slots
@@ -30187,6 +30223,10 @@ var useNodeAttribute = (flatData, props2) => {
30187
30223
  const extendNodeAttr = (item) => __spreadProps(__spreadValues({}, item), {
30188
30224
  [NODE_ATTRIBUTES.TREE_NODE_ATTR]: resolveScopedSlotParam(item)
30189
30225
  });
30226
+ const extendNodeScopedData = (item) => ({
30227
+ data: item,
30228
+ attributes: resolveScopedSlotParam(item)
30229
+ });
30190
30230
  return {
30191
30231
  getSchemaVal: getSchemaVal2,
30192
30232
  getNodeAttr: getNodeAttr2,
@@ -30211,7 +30251,8 @@ var useNodeAttribute = (flatData, props2) => {
30211
30251
  resolveScopedSlotParam,
30212
30252
  setTreeNodeLoading,
30213
30253
  extendNodeAttr,
30214
- getChildNodes
30254
+ getChildNodes,
30255
+ extendNodeScopedData
30215
30256
  };
30216
30257
  };
30217
30258
  const DEFAULT_LEVLE_LINE = "1px dashed #c3cdd7";
@@ -30390,7 +30431,8 @@ var useNodeAction = (props2, ctx, flatData, _renderData, schemaValues, initOptio
30390
30431
  isNodeChecked,
30391
30432
  getParentNode: getParentNode2,
30392
30433
  resolveScopedSlotParam,
30393
- extendNodeAttr
30434
+ extendNodeAttr,
30435
+ extendNodeScopedData
30394
30436
  } = useNodeAttribute(flatData, props2);
30395
30437
  const {
30396
30438
  registerNextLoop
@@ -30427,18 +30469,18 @@ var useNodeAction = (props2, ctx, flatData, _renderData, schemaValues, initOptio
30427
30469
  };
30428
30470
  const getLoadingIcon = (item) => {
30429
30471
  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) : "";
30472
+ return ((_c = (_b = (_a = ctx.slots).nodeLoading) == null ? void 0 : _b.call(_a, getScopedSlotData(item))) != null ? _c : isNodeLoading(item)) ? createVNode(spinner, null, null) : "";
30431
30473
  };
30432
30474
  const getActionIcon = (item) => {
30433
30475
  if (ctx.slots.nodeAction) {
30434
- return ctx.slots.nodeAction(extendNodeAttr(item));
30476
+ return ctx.slots.nodeAction(getScopedSlotData(item));
30435
30477
  }
30436
30478
  let prefixFnVal = null;
30437
30479
  if (isNodeLoading(item)) {
30438
30480
  return getLoadingIcon(item);
30439
30481
  }
30440
30482
  if (typeof props2.prefixIcon === "function") {
30441
- prefixFnVal = props2.prefixIcon(extendNodeAttr(item), "node_action");
30483
+ prefixFnVal = props2.prefixIcon(getScopedSlotData(item), "node_action");
30442
30484
  if (prefixFnVal !== "default") {
30443
30485
  return renderPrefixVal(prefixFnVal);
30444
30486
  }
@@ -30459,11 +30501,11 @@ var useNodeAction = (props2, ctx, flatData, _renderData, schemaValues, initOptio
30459
30501
  return null;
30460
30502
  }
30461
30503
  if (ctx.slots.nodeType) {
30462
- return ctx.slots.nodeType(extendNodeAttr(item));
30504
+ return ctx.slots.nodeType(getScopedSlotData(item));
30463
30505
  }
30464
30506
  let prefixFnVal = null;
30465
30507
  if (typeof props2.prefixIcon === "function") {
30466
- prefixFnVal = props2.prefixIcon(extendNodeAttr(item), "node_type");
30508
+ prefixFnVal = props2.prefixIcon(getScopedSlotData(item), "node_type");
30467
30509
  if (prefixFnVal !== "default") {
30468
30510
  return renderPrefixVal(prefixFnVal);
30469
30511
  }
@@ -30679,8 +30721,24 @@ var useNodeAction = (props2, ctx, flatData, _renderData, schemaValues, initOptio
30679
30721
  "style": getNodeLineStyle(maxDeep - index2)
30680
30722
  }, null));
30681
30723
  };
30724
+ const renderNodeSlots = (item) => {
30725
+ var _a, _b, _c, _d;
30726
+ if (ctx.slots.node) {
30727
+ return (_b = (_a = ctx.slots).node) == null ? void 0 : _b.call(_a, getScopedSlotData(item));
30728
+ }
30729
+ if (ctx.slots.default) {
30730
+ return (_d = (_c = ctx.slots).default) == null ? void 0 : _d.call(_c, extendNodeScopedData(item));
30731
+ }
30732
+ return [getLabel(item, props2)];
30733
+ };
30734
+ const getScopedSlotData = (item) => {
30735
+ if (props2.keepSlotData) {
30736
+ return extendNodeScopedData(item);
30737
+ }
30738
+ return extendNodeAttr(item);
30739
+ };
30682
30740
  const renderTreeNode = (item) => {
30683
- var _a, _b, _c, _d, _e;
30741
+ var _a, _b;
30684
30742
  return createVNode("div", {
30685
30743
  "data-tree-node": getNodeId(item),
30686
30744
  "key": getNodeId(item),
@@ -30696,7 +30754,7 @@ var useNodeAction = (props2, ctx, flatData, _renderData, schemaValues, initOptio
30696
30754
  "class": resolveClassName("node-content")
30697
30755
  }, [[getCheckboxRender(item), getNodePrefixIcon(item)], createVNode("span", {
30698
30756
  "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)])]);
30757
+ }, [renderNodeSlots(item)]), (_b = (_a = ctx.slots).nodeAppend) == null ? void 0 : _b.call(_a, getScopedSlotData(item))]), getVirtualLines(item)])]);
30700
30758
  };
30701
30759
  return {
30702
30760
  renderTreeNode,