bkui-vue 0.0.1-beta.56 → 0.0.1-beta.57

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
@@ -9275,69 +9275,18 @@ var Component$m = defineComponent({
9275
9275
  });
9276
9276
  const BkCollaspe = withInstall(Component$m);
9277
9277
  const propsMixin$1 = {
9278
- isShow: {
9279
- type: Boolean,
9280
- default: false
9281
- },
9282
- width: {
9283
- type: [Number, String],
9284
- default: "50%"
9285
- },
9286
- height: {
9287
- type: [Number, String],
9288
- default: "50%"
9289
- },
9290
- customClass: {
9291
- type: [Array, String],
9292
- default: ""
9293
- },
9294
- scrollable: {
9295
- type: Boolean,
9296
- default: true
9297
- },
9298
- showMask: {
9299
- type: Boolean,
9300
- default: true
9301
- },
9302
- closeIcon: {
9303
- type: Boolean,
9304
- default: true
9305
- },
9306
- escClose: {
9307
- type: Boolean,
9308
- default: true
9309
- },
9310
- maskClose: {
9311
- type: Boolean,
9312
- default: true
9313
- },
9314
- fullscreen: {
9315
- type: Boolean,
9316
- default: false
9317
- },
9318
- size: {
9319
- type: String,
9320
- default: "normal",
9321
- validator: (value) => {
9322
- const dialogSize = ["normal", "small", "medium", "large"];
9323
- if (dialogSize.indexOf(value) < 0) {
9324
- console.error(`dialogSize property is not valid: '${value}',\u3010${dialogSize.join(" | ")}\u3011`);
9325
- return false;
9326
- }
9327
- return true;
9328
- }
9329
- },
9330
- renderDirective: {
9331
- type: String,
9332
- default: "show",
9333
- validator: (value) => {
9334
- if (["show", "if"].indexOf(value) < 0) {
9335
- console.error(`type render-directive is not valid: '${value}'`);
9336
- return false;
9337
- }
9338
- return true;
9339
- }
9340
- }
9278
+ isShow: PropTypes.bool.def(false),
9279
+ width: PropTypes.string || PropTypes.number,
9280
+ height: PropTypes.string || PropTypes.number,
9281
+ customClass: PropTypes.string || PropTypes.array,
9282
+ scrollable: PropTypes.bool.def(true),
9283
+ showMask: PropTypes.bool.def(true),
9284
+ closeIcon: PropTypes.bool.def(true),
9285
+ escClose: PropTypes.bool.def(true),
9286
+ maskClose: PropTypes.bool.def(true),
9287
+ fullscreen: PropTypes.bool.def(false),
9288
+ size: PropTypes.commonType(["normal", "small", "medium", "large"], "size").def("normal"),
9289
+ draggable: PropTypes.bool.def(true)
9341
9290
  };
9342
9291
  var Component$l = defineComponent({
9343
9292
  name: "Modal",
@@ -9389,7 +9338,7 @@ var Component$l = defineComponent({
9389
9338
  render() {
9390
9339
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
9391
9340
  return createVNode("div", {
9392
- "class": ["bk-modal-wrapper", this.size, this.customClass, this.fullscreen ? "bk-model-fullscreen" : ""],
9341
+ "class": ["bk-modal-wrapper", this.customClass],
9393
9342
  "style": this.compStyle
9394
9343
  }, [this.isShow ? createVNode("div", {
9395
9344
  "class": "bk-modal-body"
@@ -9413,96 +9362,119 @@ var Component$k = defineComponent({
9413
9362
  BkButton
9414
9363
  },
9415
9364
  props: __spreadProps(__spreadValues({}, propsMixin$1), {
9416
- width: {
9417
- type: [Number, String],
9418
- default: null
9419
- },
9420
- height: {
9421
- type: [Number, String],
9422
- default: null
9423
- },
9424
- confirmText: {
9425
- type: String,
9426
- default: "\u786E\u5B9A"
9427
- },
9428
- cancelText: {
9429
- type: String,
9430
- default: "\u53D6\u6D88"
9431
- },
9432
- title: {
9433
- type: String,
9434
- default: "Title"
9435
- },
9436
- headerAlign: {
9437
- type: String,
9438
- default: "left",
9439
- validator: (value) => {
9440
- const textAlign = ["left", "center", "right"];
9441
- if (textAlign.indexOf(value) < 0) {
9442
- console.error(`headerAlign property is not valid: '${value}',\u3010${textAlign.join(" | ")}\u3011`);
9443
- return false;
9444
- }
9445
- return true;
9365
+ width: PropTypes.string.def("null") || PropTypes.number.def(),
9366
+ height: PropTypes.string.def("null") || PropTypes.number.def(),
9367
+ confirmText: PropTypes.string.def("\u786E\u5B9A"),
9368
+ cancelText: PropTypes.string.def("\u53D6\u6D88"),
9369
+ title: PropTypes.string.def("title"),
9370
+ headerAlign: PropTypes.commonType(["left", "center", "right"], "headerAlign").def("left"),
9371
+ footerAlign: PropTypes.commonType(["left", "center", "right"], "footerAlign").def("right"),
9372
+ theme: PropTypes.commonType(["primary", "warning", "success", "danger"], "theme").def("primary"),
9373
+ isLoading: PropTypes.bool.def(false)
9374
+ }),
9375
+ emits: ["closed", "update:isShow", "confirm"],
9376
+ setup(props, {
9377
+ emit
9378
+ }) {
9379
+ const data2 = reactive({
9380
+ positionX: 0,
9381
+ positionY: 0,
9382
+ moveStyle: {
9383
+ top: "",
9384
+ left: ""
9446
9385
  }
9447
- },
9448
- footerAlign: {
9449
- type: String,
9450
- default: "right",
9451
- validator: (value) => {
9452
- const textAlign = ["left", "center", "right"];
9453
- if (textAlign.indexOf(value) < 0) {
9454
- console.error(`footerAlign property is not valid: '${value}',\u3010${textAlign.join(" | ")}\u3011`);
9455
- return false;
9456
- }
9457
- return true;
9386
+ });
9387
+ onMounted(() => {
9388
+ if (props.escClose) {
9389
+ addEventListener("keydown", escCloseHandler);
9458
9390
  }
9459
- },
9460
- theme: {
9461
- type: String,
9462
- default: "primary",
9463
- validator: (value) => {
9464
- if (["primary", "warning", "success", "danger"].indexOf(value) < 0) {
9465
- console.error(`theme property is not valid: '${value}'`);
9466
- return false;
9467
- }
9468
- return true;
9391
+ });
9392
+ onBeforeUnmount(() => {
9393
+ if (props.escClose) {
9394
+ removeEventListener("keydown", escCloseHandler);
9469
9395
  }
9470
- }
9471
- }),
9472
- emits: ["closed", "update:isShow", "confirm"],
9473
- mounted() {
9474
- if (this.escClose) {
9475
- addEventListener("keydown", this.escCloseHandler);
9476
- }
9477
- },
9478
- beforeDestory() {
9479
- if (this.escClose) {
9480
- removeEventListener("keydown", this.escCloseHandler);
9481
- }
9482
- },
9483
- methods: {
9484
- handleClose() {
9485
- this.$emit("update:isShow", false);
9486
- this.$emit("closed");
9487
- },
9488
- handleConfirm() {
9489
- this.$emit("update:isShow", false);
9490
- this.$emit("confirm");
9491
- },
9492
- escCloseHandler(e) {
9493
- if (this.isShow && this.closeIcon) {
9396
+ });
9397
+ watch(() => props.isShow, (val) => {
9398
+ if (!val) {
9399
+ data2.moveStyle = {
9400
+ top: "50%",
9401
+ left: "50%"
9402
+ };
9403
+ data2.positionX = 0;
9404
+ data2.positionY = 0;
9405
+ }
9406
+ });
9407
+ const handleClose = () => {
9408
+ emit("update:isShow", false);
9409
+ emit("closed");
9410
+ };
9411
+ const handleConfirm = () => {
9412
+ emit("update:isShow", false);
9413
+ emit("confirm");
9414
+ };
9415
+ const escCloseHandler = (e) => {
9416
+ if (props.isShow && props.closeIcon) {
9494
9417
  if (e.keyCode === 27) {
9495
- this.handleClose();
9418
+ handleClose();
9496
9419
  }
9497
9420
  }
9498
- }
9421
+ };
9422
+ const moveHandler = (e) => {
9423
+ if (props.fullscreen) {
9424
+ return false;
9425
+ }
9426
+ const odiv = e.target;
9427
+ const parentHeight = e.currentTarget.parentNode.parentNode.offsetHeight;
9428
+ const parentWidth = e.currentTarget.parentNode.parentNode.offsetWidth;
9429
+ let disX;
9430
+ let disY;
9431
+ if (data2.positionX !== 0 && data2.positionY !== 0) {
9432
+ disX = e.clientX - data2.positionX;
9433
+ disY = e.clientY - data2.positionY;
9434
+ } else {
9435
+ disX = e.clientX - odiv.offsetLeft;
9436
+ disY = e.clientY - odiv.offsetTop;
9437
+ }
9438
+ document.onmousemove = (e2) => {
9439
+ const boxLeft = window.innerWidth - parentWidth;
9440
+ const boxTop = window.innerHeight - parentHeight;
9441
+ let left2 = e2.clientX - disX;
9442
+ let top2 = e2.clientY - disY;
9443
+ if (boxLeft / 2 - left2 <= 0) {
9444
+ left2 = boxLeft / 2;
9445
+ } else if (boxLeft / 2 + left2 <= 0) {
9446
+ left2 = -boxLeft / 2;
9447
+ }
9448
+ if (boxTop / 2 - top2 <= 0) {
9449
+ top2 = boxTop / 2;
9450
+ } else if (boxTop / 2 + top2 <= 0) {
9451
+ top2 = -boxTop / 2;
9452
+ }
9453
+ data2.positionX = left2;
9454
+ data2.positionY = top2;
9455
+ data2.moveStyle.left = `calc(50% + ${left2}px)`;
9456
+ data2.moveStyle.top = `calc(50% + ${top2}px)`;
9457
+ };
9458
+ document.onmouseup = () => {
9459
+ document.onmousemove = null;
9460
+ document.onmouseup = null;
9461
+ };
9462
+ };
9463
+ return {
9464
+ data: data2,
9465
+ handleClose,
9466
+ handleConfirm,
9467
+ escCloseHandler,
9468
+ moveHandler
9469
+ };
9499
9470
  },
9500
9471
  render() {
9501
9472
  const dialogSlot = {
9502
9473
  header: () => {
9503
9474
  var _a, _b, _c;
9504
9475
  return [createVNode("div", {
9505
- "class": "bk-dialog-tool"
9476
+ "class": ["bk-dialog-tool", this.fullscreen || !this.draggable ? "" : "move", this.draggable ? "content-dragging" : ""],
9477
+ "onMousedown": this.moveHandler
9506
9478
  }, [createVNode("span", {
9507
9479
  "class": ["bk-dialog-close", this.closeIcon ? "" : "close-icon"],
9508
9480
  "onClick": this.handleClose
@@ -9524,7 +9496,8 @@ var Component$k = defineComponent({
9524
9496
  "style": `text-align: ${this.footerAlign}`
9525
9497
  }, [(_c = (_b = (_a = this.$slots).footer) == null ? void 0 : _b.call(_a)) != null ? _c : createVNode(Fragment, null, [createVNode(BkButton, {
9526
9498
  "onClick": this.handleConfirm,
9527
- "theme": this.theme
9499
+ "theme": this.theme,
9500
+ "loading": this.isLoading
9528
9501
  }, {
9529
9502
  default: () => [this.confirmText]
9530
9503
  }), createVNode(BkButton, {
@@ -9537,7 +9510,8 @@ var Component$k = defineComponent({
9537
9510
  };
9538
9511
  const className = `bk-dialog-wrapper ${this.scrollable ? "scroll-able" : ""}`;
9539
9512
  return createVNode(BkModal, mergeProps(this.$props, {
9540
- "class": className
9513
+ "class": [className, this.fullscreen ? "bk-model-fullscreen" : this.size],
9514
+ "style": this.data.moveStyle
9541
9515
  }), _isSlot$4(dialogSlot) ? dialogSlot : {
9542
9516
  default: () => [dialogSlot]
9543
9517
  });
@@ -13393,10 +13367,10 @@ const useClass = (props, root) => {
13393
13367
  const contentClass = classes({
13394
13368
  [resolveClassName("table-body")]: true
13395
13369
  });
13396
- const footerClass = classes({
13370
+ const footerClass = computed(() => classes({
13397
13371
  [resolveClassName("table-footer")]: true,
13398
13372
  ["is-hidden"]: !props.pagination || !props.data.length
13399
- });
13373
+ }));
13400
13374
  const wrapperStyle = computed(() => ({
13401
13375
  minHeight: resolveNumberOrStringToPix(props.minHeight, "auto")
13402
13376
  }));
@@ -13532,7 +13506,7 @@ var Component$4 = defineComponent({
13532
13506
  "class": resolveClassName("table-fixed")
13533
13507
  }, null)
13534
13508
  }), createVNode("div", {
13535
- "class": footerClass
13509
+ "class": footerClass.value
13536
13510
  }, [props.pagination && props.data.length && tableRender.renderTableFooter(localPagination.value)])]);
13537
13511
  }
13538
13512
  });