bkui-vue 0.0.1-beta.101 → 0.0.1-beta.104

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
@@ -10936,6 +10936,7 @@ const PopoverProps = __spreadValues({
10936
10936
  zIndex: PropTypes.number.def(void 0),
10937
10937
  disableTeleport: PropTypes.bool.def(false),
10938
10938
  autoPlacement: PropTypes.bool.def(false),
10939
+ autoVisibility: PropTypes.bool.def(true),
10939
10940
  disableOutsideClick: PropTypes.bool.def(false)
10940
10941
  }, EventProps$1);
10941
10942
  var Reference = defineComponent({
@@ -12197,14 +12198,27 @@ var useFloating = (props, ctx, refReference, refContent, refArrow) => {
12197
12198
  elArrow
12198
12199
  };
12199
12200
  };
12200
- const resolvePopOptions = (elArrow) => ({
12201
- placement: props.placement,
12202
- middleware: [inline(), offset(props.offset), props.autoPlacement ? autoPlacement() : flip(), shift({
12201
+ const resolvePopOptions = (elArrow) => {
12202
+ const middleware = [offset(props.offset), shift({
12203
12203
  padding: props.padding
12204
12204
  }), arrow({
12205
12205
  element: elArrow
12206
- }), hide()]
12207
- });
12206
+ })];
12207
+ const options = {
12208
+ placement: props.placement,
12209
+ middleware
12210
+ };
12211
+ if (props.autoPlacement) {
12212
+ middleware.push(autoPlacement());
12213
+ } else {
12214
+ middleware.unshift(inline());
12215
+ middleware.push(flip());
12216
+ }
12217
+ if (props.autoVisibility) {
12218
+ options.middleware.push(hide());
12219
+ }
12220
+ return options;
12221
+ };
12208
12222
  const resolveTargetElement = (target) => {
12209
12223
  if (target instanceof HTMLElement) {
12210
12224
  return target;
@@ -12220,6 +12234,119 @@ var useFloating = (props, ctx, refReference, refContent, refArrow) => {
12220
12234
  }, out), {});
12221
12235
  const contentClass = `${customThemeCls}`;
12222
12236
  let cleanup = null;
12237
+ const getRoundPixelVal = (val) => {
12238
+ const dpr = window.devicePixelRatio || 1;
12239
+ return Math.round(val * dpr) / dpr || 0;
12240
+ };
12241
+ const isElementFullScreen = () => document.fullscreenElement !== null;
12242
+ const updatePopContentStyle = (elContent, x2, y2, resolvedPlacement, middlewareData, elReference) => {
12243
+ const {
12244
+ left: left2,
12245
+ top: top2
12246
+ } = elReference.getBoundingClientRect();
12247
+ const resolveFullscreenOffsetX = (xValue) => {
12248
+ if (["left", "right"].includes(resolvedPlacement)) {
12249
+ return getRoundPixelVal(xValue);
12250
+ }
12251
+ return left2;
12252
+ };
12253
+ const resolveFullscreenOffsetY = (yValue) => {
12254
+ if (["top", "bottom"].includes(resolvedPlacement)) {
12255
+ return getRoundPixelVal(yValue);
12256
+ }
12257
+ return top2;
12258
+ };
12259
+ const getOffsetX = () => {
12260
+ if (isElementFullScreen()) {
12261
+ return resolveFullscreenOffsetX(x2);
12262
+ }
12263
+ return getRoundPixelVal(x2);
12264
+ };
12265
+ const getOffsetY = () => {
12266
+ if (isElementFullScreen()) {
12267
+ return resolveFullscreenOffsetY(y2);
12268
+ }
12269
+ return getRoundPixelVal(y2);
12270
+ };
12271
+ Object.assign(elContent.style, {
12272
+ left: "0",
12273
+ top: "0",
12274
+ transform: `translate3d(${getOffsetX()}px,${getOffsetY()}px,0)`
12275
+ });
12276
+ if (props.autoVisibility) {
12277
+ const {
12278
+ referenceHidden
12279
+ } = middlewareData.hide;
12280
+ Object.assign(elContent.style, {
12281
+ visibility: referenceHidden ? "hidden" : "visible"
12282
+ });
12283
+ }
12284
+ };
12285
+ const updateArrowStyle = (elArrow, resolvedPlacement, middlewareData, elReference) => {
12286
+ const {
12287
+ left: left2,
12288
+ top: top2,
12289
+ bottom: bottom2,
12290
+ right: right2
12291
+ } = elReference.getBoundingClientRect();
12292
+ if (props.arrow) {
12293
+ const {
12294
+ x: arrowX,
12295
+ y: arrowY
12296
+ } = middlewareData.arrow;
12297
+ const staticPrefix = {
12298
+ top: 1,
12299
+ right: -1,
12300
+ bottom: -1,
12301
+ left: 1
12302
+ }[resolvedPlacement];
12303
+ const getStaticSidePos = (val, pos, defaultVal) => {
12304
+ var _a, _b;
12305
+ const staticSide = (_b = (_a = {
12306
+ x: {
12307
+ left: "right",
12308
+ right: "left"
12309
+ },
12310
+ y: {
12311
+ top: "bottom",
12312
+ bottom: "top"
12313
+ }
12314
+ }[pos]) == null ? void 0 : _a[resolvedPlacement]) != null ? _b : defaultVal;
12315
+ return [val, staticSide];
12316
+ };
12317
+ const getFullScreenOffset = (arrowValue) => {
12318
+ if (isElementFullScreen()) {
12319
+ if (["left", "right"].includes(resolvedPlacement)) {
12320
+ return getRoundPixelVal((bottom2 - top2) / 2) - 2;
12321
+ }
12322
+ if (["top", "bottom"].includes(resolvedPlacement)) {
12323
+ return getRoundPixelVal((right2 - left2) / 2) - 2;
12324
+ }
12325
+ }
12326
+ return isNumber(arrowValue) ? getRoundPixelVal(arrowValue) : 0;
12327
+ };
12328
+ const getOffsetX = () => {
12329
+ if (["left", "right"].includes(resolvedPlacement)) {
12330
+ return staticPrefix * 4;
12331
+ }
12332
+ return getFullScreenOffset(arrowX);
12333
+ };
12334
+ const getOffsetY = () => {
12335
+ if (["top", "bottom"].includes(resolvedPlacement)) {
12336
+ return staticPrefix * 4;
12337
+ }
12338
+ return getFullScreenOffset(arrowY);
12339
+ };
12340
+ elArrow.setAttribute("data-arrow", resolvedPlacement);
12341
+ const [offsetX, xPos] = getStaticSidePos(getOffsetX(), "x", "left");
12342
+ const [offsetY, yPos] = getStaticSidePos(getOffsetY(), "y", "top");
12343
+ Object.assign(elArrow.style, {
12344
+ [xPos]: "0",
12345
+ [yPos]: "0",
12346
+ transform: `translate(${offsetX}px,${offsetY}px) rotate(45deg)`
12347
+ });
12348
+ }
12349
+ };
12223
12350
  const updatePopover = () => {
12224
12351
  const {
12225
12352
  elReference,
@@ -12239,35 +12366,13 @@ var useFloating = (props, ctx, refReference, refContent, refArrow) => {
12239
12366
  Object.keys(customTheme).forEach((key) => {
12240
12367
  elContent.setAttribute(key, customTheme[key]);
12241
12368
  });
12242
- const {
12243
- referenceHidden
12244
- } = middlewareData.hide;
12245
- Object.assign(elContent.style, {
12246
- left: `${x2}px`,
12247
- top: `${y2}px`,
12248
- visibility: referenceHidden ? "hidden" : "visible"
12249
- });
12250
- if (props.arrow) {
12251
- const {
12252
- x: arrowX,
12253
- y: arrowY
12254
- } = middlewareData.arrow;
12255
- const placementStr = placement.split("-")[0];
12256
- const staticSide = {
12257
- top: "bottom",
12258
- right: "left",
12259
- bottom: "top",
12260
- left: "right"
12261
- }[placementStr];
12262
- elArrow.setAttribute("data-arrow", placementStr);
12263
- Object.assign(elArrow.style, {
12264
- left: isNumber(arrowX) ? `${arrowX}px` : "",
12265
- top: isNumber(arrowY) ? `${arrowY}px` : "",
12266
- right: "",
12267
- bottom: "",
12268
- [staticSide]: "-4px"
12269
- });
12369
+ const placementStr = placement.split("-")[0];
12370
+ let resolvedPlacement = placementStr;
12371
+ if (!["left", "right", "top", "bottom"].includes(placementStr)) {
12372
+ resolvedPlacement = "top";
12270
12373
  }
12374
+ updatePopContentStyle(elContent, x2, y2, resolvedPlacement, middlewareData, elReference);
12375
+ updateArrowStyle(elArrow, resolvedPlacement, middlewareData, elReference);
12271
12376
  });
12272
12377
  });
12273
12378
  };
@@ -12332,6 +12437,7 @@ var useFloating = (props, ctx, refReference, refContent, refArrow) => {
12332
12437
  updatePopover,
12333
12438
  triggerPopover,
12334
12439
  resolvePopElements,
12440
+ isElementFullScreen,
12335
12441
  localIsShow,
12336
12442
  cleanup
12337
12443
  };
@@ -12370,9 +12476,9 @@ var Component$n = defineComponent({
12370
12476
  const {
12371
12477
  content,
12372
12478
  theme,
12373
- disableTeleport,
12374
12479
  width,
12375
- height
12480
+ height,
12481
+ disableTeleport
12376
12482
  } = props;
12377
12483
  const refReference = ref();
12378
12484
  const refContent = ref();
@@ -12385,6 +12491,7 @@ var Component$n = defineComponent({
12385
12491
  resolveTriggerEvents,
12386
12492
  updatePopover,
12387
12493
  resolvePopElements,
12494
+ isElementFullScreen,
12388
12495
  cleanup
12389
12496
  } = useFloating(props, ctx, refReference, refContent, refArrow);
12390
12497
  const show = () => {
@@ -12461,7 +12568,6 @@ var Component$n = defineComponent({
12461
12568
  } = usePopperId();
12462
12569
  const boundary = typeof props.boundary === "string" ? props.boundary : prefixId;
12463
12570
  const handleClickOutside = (_e) => {
12464
- console.log("handleClickOutside", localIsShow.value);
12465
12571
  ctx.emit(EMITEVENTS$1.CLICK_OUTSIDE, {
12466
12572
  isShow: localIsShow.value
12467
12573
  });
@@ -12472,6 +12578,7 @@ var Component$n = defineComponent({
12472
12578
  hide2();
12473
12579
  }
12474
12580
  };
12581
+ const transBoundary = computed(() => !isElementFullScreen() && !disableTeleport);
12475
12582
  return {
12476
12583
  boundary,
12477
12584
  arrow: props.arrow,
@@ -12480,7 +12587,7 @@ var Component$n = defineComponent({
12480
12587
  refArrow,
12481
12588
  content,
12482
12589
  theme,
12483
- disableTeleport,
12590
+ transBoundary,
12484
12591
  width,
12485
12592
  height,
12486
12593
  handleClickOutside
@@ -12496,7 +12603,7 @@ var Component$n = defineComponent({
12496
12603
  }
12497
12604
  }), createVNode(Teleport, {
12498
12605
  "to": this.boundary,
12499
- "disabled": this.disableTeleport
12606
+ "disabled": !this.transBoundary
12500
12607
  }, {
12501
12608
  default: () => [withDirectives(createVNode(Content, {
12502
12609
  "ref": "refContent",
@@ -15534,6 +15641,13 @@ var Component$c = defineComponent({
15534
15641
  }
15535
15642
  });
15536
15643
  const BkPagination = withInstall(Component$c);
15644
+ var TableRow = defineComponent({
15645
+ name: "TableRow",
15646
+ render() {
15647
+ var _a, _b;
15648
+ return createVNode(Fragment, null, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]);
15649
+ }
15650
+ });
15537
15651
  var BodyEmpty = defineComponent({
15538
15652
  name: "BodyEmpty",
15539
15653
  props: {
@@ -16182,7 +16296,7 @@ class TableRender {
16182
16296
  this.reactiveProp = reactiveProp;
16183
16297
  this.colgroups = colgroups;
16184
16298
  this.plugins = new TablePlugins(props, ctx);
16185
- this.uuid = random(8);
16299
+ this.uuid = uuid_1.v4();
16186
16300
  this.events = /* @__PURE__ */ new Map();
16187
16301
  }
16188
16302
  get propActiveCols() {
@@ -16232,7 +16346,8 @@ class TableRender {
16232
16346
  }
16233
16347
  return createVNode("table", {
16234
16348
  "cellpadding": 0,
16235
- "cellspacing": 0
16349
+ "cellspacing": 0,
16350
+ "data-table-uuid": this.uuid
16236
16351
  }, [this.renderColGroup(), this.renderTBody(rows)]);
16237
16352
  }
16238
16353
  renderTableFooter(options) {
@@ -16364,15 +16479,17 @@ class TableRender {
16364
16479
  } = getFixedColumnStyleResolve();
16365
16480
  return createVNode("thead", {
16366
16481
  "style": rowStyle
16367
- }, [createVNode("tr", null, [this.filterColgroups.map((column, index) => createVNode("th", mergeProps({
16368
- "colspan": 1,
16369
- "rowspan": 1,
16370
- "class": this.getHeadColumnClass(column, index),
16371
- "style": resolveFixedColumnStyle(column, fixedoffset),
16372
- "onClick": () => this.handleColumnHeadClick(index)
16373
- }, resolveEventListener(column)), [createVNode("div", {
16374
- "class": "cell"
16375
- }, [renderHeadCell(column, index)])]))])]);
16482
+ }, [createVNode(TableRow, null, {
16483
+ default: () => [createVNode("tr", null, [this.filterColgroups.map((column, index) => createVNode("th", mergeProps({
16484
+ "colspan": 1,
16485
+ "rowspan": 1,
16486
+ "class": this.getHeadColumnClass(column, index),
16487
+ "style": resolveFixedColumnStyle(column, fixedoffset),
16488
+ "onClick": () => this.handleColumnHeadClick(index)
16489
+ }, resolveEventListener(column)), [createVNode("div", {
16490
+ "class": "cell"
16491
+ }, [renderHeadCell(column, index)])]))])]
16492
+ })]);
16376
16493
  }
16377
16494
  renderTBody(rows) {
16378
16495
  const {
@@ -16387,49 +16504,60 @@ class TableRender {
16387
16504
  resolveFixedColumnStyle,
16388
16505
  fixedoffset
16389
16506
  } = getFixedColumnStyleResolve();
16390
- return [createVNode("tr", {
16391
- "style": rowStyle,
16392
- "class": rowClass,
16393
- "key": row[TABLE_ROW_ATTRIBUTE.ROW_UID],
16394
- "onClick": (e) => this.handleRowClick(e, row, rowIndex, rows),
16395
- "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows)
16396
- }, [this.filterColgroups.map((column, index) => {
16397
- const cellStyle = [resolveFixedColumnStyle(column, fixedoffset), ...formatPropAsArray(this.props.cellStyle, [column, index, row, rowIndex, this])];
16398
- const cellClass = [this.getColumnClass(column, index), ...formatPropAsArray(this.props.cellClass, [column, index, row, rowIndex, this]), {
16399
- "expand-row": row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND]
16400
- }];
16401
- const tdCtxClass = {
16402
- cell: true,
16403
- "expand-cell": column.type === "expand"
16404
- };
16405
- const cellKey = `__CELL_${rowIndex}_${index}`;
16406
- return createVNode("td", {
16407
- "key": cellKey,
16408
- "class": cellClass,
16409
- "style": cellStyle,
16410
- "colspan": 1,
16411
- "rowspan": 1
16412
- }, [createVNode("div", {
16413
- "class": tdCtxClass
16414
- }, [this.renderCell(row, column, rowIndex, rows)])]);
16415
- })]), this.renderExpandRow(row, rowClass)];
16507
+ const rowKey = `${this.uuid}-${row[TABLE_ROW_ATTRIBUTE.ROW_UID]}`;
16508
+ return [createVNode(TableRow, {
16509
+ "key": rowKey
16510
+ }, {
16511
+ default: () => [createVNode("tr", {
16512
+ "style": rowStyle,
16513
+ "class": rowClass,
16514
+ "onClick": (e) => this.handleRowClick(e, row, rowIndex, rows),
16515
+ "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows)
16516
+ }, [this.filterColgroups.map((column, index) => {
16517
+ const cellStyle = [resolveFixedColumnStyle(column, fixedoffset), ...formatPropAsArray(this.props.cellStyle, [column, index, row, rowIndex, this])];
16518
+ const cellClass = [this.getColumnClass(column, index), ...formatPropAsArray(this.props.cellClass, [column, index, row, rowIndex, this]), {
16519
+ "expand-row": row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND]
16520
+ }];
16521
+ const tdCtxClass = {
16522
+ cell: true,
16523
+ "expand-cell": column.type === "expand"
16524
+ };
16525
+ const cellKey = `__CELL_${rowIndex}_${index}`;
16526
+ return createVNode("td", {
16527
+ "class": cellClass,
16528
+ "style": cellStyle,
16529
+ "key": cellKey,
16530
+ "colspan": 1,
16531
+ "rowspan": 1
16532
+ }, [createVNode("div", {
16533
+ "class": tdCtxClass
16534
+ }, [this.renderCell(row, column, rowIndex, rows)])]);
16535
+ })])]
16536
+ }), this.renderExpandRow(row, rowClass)];
16416
16537
  })]);
16417
16538
  }
16418
16539
  renderExpandRow(row, rowClass) {
16419
- var _a, _b, _c;
16420
16540
  const isExpand = !!row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND];
16421
16541
  if (isExpand) {
16422
16542
  const resovledClass = [...rowClass, {
16423
16543
  row_expend: true
16424
16544
  }];
16425
- return createVNode("tr", {
16426
- "class": resovledClass
16427
- }, [createVNode("td", {
16428
- "colspan": this.filterColgroups.length,
16429
- "rowspan": 1
16430
- }, [(_c = (_b = (_a = this.context.slots).expandRow) == null ? void 0 : _b.call(_a, row)) != null ? _c : createVNode("div", {
16431
- "class": "expand-cell-ctx"
16432
- }, [createTextVNode("Expand Row")])])]);
16545
+ const rowKey = `${this.uuid}-${row[TABLE_ROW_ATTRIBUTE.ROW_UID]}_expand`;
16546
+ return createVNode(TableRow, {
16547
+ "key": rowKey
16548
+ }, {
16549
+ default: () => {
16550
+ var _a, _b, _c;
16551
+ return [createVNode("tr", {
16552
+ "class": resovledClass
16553
+ }, [createVNode("td", {
16554
+ "colspan": this.filterColgroups.length,
16555
+ "rowspan": 1
16556
+ }, [(_c = (_b = (_a = this.context.slots).expandRow) == null ? void 0 : _b.call(_a, row)) != null ? _c : createVNode("div", {
16557
+ "class": "expand-cell-ctx"
16558
+ }, [createTextVNode("Expand Row")])])])];
16559
+ }
16560
+ });
16433
16561
  }
16434
16562
  }
16435
16563
  handleRowClick(e, row, index, rows) {
@@ -18546,7 +18674,13 @@ const Message$1 = (constructor, options) => {
18546
18674
  };
18547
18675
  render(vm, container2);
18548
18676
  instances[position].push(vm);
18549
- document.body.appendChild(container2.firstElementChild);
18677
+ let target;
18678
+ if (vm.props.getContainer && isElement$2(vm.props.getContainer)) {
18679
+ target = vm.props.getContainer;
18680
+ } else {
18681
+ target = document.body;
18682
+ }
18683
+ target.appendChild(container2.firstElementChild);
18550
18684
  };
18551
18685
  function close(id, position, spacing, userOnClose) {
18552
18686
  userOnClose == null ? void 0 : userOnClose();
@@ -18575,7 +18709,8 @@ const messageProps = {
18575
18709
  offsetY: PropTypes.number.def(30),
18576
18710
  spacing: PropTypes.number.def(10),
18577
18711
  extCls: PropTypes.string.def(""),
18578
- onClose: PropTypes.func
18712
+ onClose: PropTypes.func,
18713
+ getContainer: PropTypes.instanceOf(HTMLElement)
18579
18714
  };
18580
18715
  var MessageConstructor = defineComponent({
18581
18716
  name: "Message",
@@ -18586,9 +18721,11 @@ var MessageConstructor = defineComponent({
18586
18721
  }) {
18587
18722
  const classNames = computed(() => ["bk-message", `bk-message-${props.theme}`, `${props.extCls}`]);
18588
18723
  const zIndex = bkZIndexManager.getMessageNextIndex();
18724
+ const isGetContainer = computed(() => props.getContainer && isElement$2(props.getContainer));
18589
18725
  const styles = computed(() => ({
18590
18726
  top: `${props.offsetY}px`,
18591
- zIndex
18727
+ zIndex,
18728
+ position: isGetContainer.value ? "absolute" : "fixed"
18592
18729
  }));
18593
18730
  const visible = ref(false);
18594
18731
  let timer = null;