@maxax/ui 1.1.31 → 1.1.33

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.
@@ -1 +1 @@
1
- {"version":3,"file":"BasicButtonExportMax.vue.d.ts","sourceRoot":"","sources":["../../../src/components/basic-button-export-max/BasicButtonExportMax.vue"],"names":[],"mappings":"AA8GA,OAAO,KAAK,EAA6B,yBAAyB,EAAE,MAAM,aAAa,CAAA;;;;;;;;;;;;;;AAkPvF,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"BasicButtonExportMax.vue.d.ts","sourceRoot":"","sources":["../../../src/components/basic-button-export-max/BasicButtonExportMax.vue"],"names":[],"mappings":"AAkIA,OAAO,KAAK,EAA6B,yBAAyB,EAAE,MAAM,aAAa,CAAA;;;;;;;;;;;;;;AAkQvF,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
package/dist/index.cjs CHANGED
@@ -4,7 +4,7 @@ const utils = require("@maxax/utils");
4
4
  const vue = require("vue");
5
5
  const BScroll = require("@better-scroll/core");
6
6
  const naiveUi = require("naive-ui");
7
- const utils$1 = require("./utils-o29LtjNO.cjs");
7
+ const utils$1 = require("./utils-Di7K635D.cjs");
8
8
  const lodashEs = require("lodash-es");
9
9
  const vxePcUi = require("vxe-pc-ui");
10
10
  const vxeTable = require("vxe-table");
@@ -4394,7 +4394,256 @@ const XBasicButtonImport = utils.withInstall(_sfc_main$K);
4394
4394
  const XBasicButtonPrint = utils.withInstall(_sfc_main$J);
4395
4395
  const XBasicButtonDrop = utils.withInstall(_sfc_main$O);
4396
4396
  const XBasicButtonExportDrop = utils.withInstall(_sfc_main$L);
4397
+ const _hoisted_1$a = ["id"];
4398
+ const _hoisted_2$3 = ["textContent"];
4399
+ const _hoisted_3 = { key: 0 };
4400
+ const _hoisted_4 = ["innerHTML"];
4397
4401
  const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
4402
+ __name: "BasicNotification",
4403
+ props: {
4404
+ customClass: { default: "" },
4405
+ dangerouslyUseHTMLString: { type: Boolean },
4406
+ duration: { default: 4500 },
4407
+ icon: {},
4408
+ id: { default: "" },
4409
+ message: {},
4410
+ offset: { default: 0 },
4411
+ onClick: { type: Function, default: () => void 0 },
4412
+ onClose: {},
4413
+ position: { default: "top-right" },
4414
+ showClose: { type: Boolean, default: true },
4415
+ title: { default: "" },
4416
+ type: { default: "" },
4417
+ zIndex: {}
4418
+ },
4419
+ emits: ["destroy"],
4420
+ setup(__props, { expose: __expose, emit: __emit }) {
4421
+ const props = __props;
4422
+ const emit = __emit;
4423
+ const { ns, zIndex: zIndex2 } = useConfigProvider("basic-notification");
4424
+ const { nextZIndex, currentZIndex } = zIndex2;
4425
+ const visible = vue.ref(false);
4426
+ let timer;
4427
+ const iconMap = {
4428
+ success: "ri:checkbox-circle-line",
4429
+ error: "ri:close-circle-line",
4430
+ info: "ri:information-line",
4431
+ warning: "ri:error-warning-line"
4432
+ };
4433
+ const typeClass = vue.computed(() => {
4434
+ const type = props.type;
4435
+ return type && iconMap[props.type] ? ns.m(type) : "";
4436
+ });
4437
+ const iconComponent = vue.computed(() => {
4438
+ if (!props.type) return props.icon;
4439
+ return iconMap[props.type] || props.icon;
4440
+ });
4441
+ const horizontalClass = vue.computed(() => props.position.endsWith("right") ? "right" : "left");
4442
+ const verticalProperty = vue.computed(() => props.position.startsWith("top") ? "top" : "bottom");
4443
+ const positionStyle = vue.computed(() => {
4444
+ var _a;
4445
+ return {
4446
+ [verticalProperty.value]: `${props.offset}px`,
4447
+ zIndex: (_a = props.zIndex) != null ? _a : currentZIndex.value
4448
+ };
4449
+ });
4450
+ function startTimer() {
4451
+ if (props.duration > 0) {
4452
+ ({ stop: timer } = useTimeoutFn(() => {
4453
+ if (visible.value) close2();
4454
+ }, props.duration));
4455
+ }
4456
+ }
4457
+ function clearTimer() {
4458
+ timer == null ? void 0 : timer();
4459
+ }
4460
+ function close2() {
4461
+ visible.value = false;
4462
+ }
4463
+ function onKeydown({ code }) {
4464
+ if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {
4465
+ clearTimer();
4466
+ } else if (code === EVENT_CODE.esc) {
4467
+ if (visible.value) {
4468
+ close2();
4469
+ }
4470
+ } else {
4471
+ startTimer();
4472
+ }
4473
+ }
4474
+ vue.onMounted(() => {
4475
+ startTimer();
4476
+ nextZIndex();
4477
+ visible.value = true;
4478
+ });
4479
+ useEventListener(document, "keydown", onKeydown);
4480
+ __expose({
4481
+ visible,
4482
+ /** @description close notification */
4483
+ close: close2
4484
+ });
4485
+ return (_ctx, _cache) => {
4486
+ return vue.openBlock(), vue.createBlock(vue.Transition, {
4487
+ name: "imax-notification-fade",
4488
+ onBeforeLeave: __props.onClose,
4489
+ onAfterLeave: _cache[1] || (_cache[1] = ($event) => emit("destroy"))
4490
+ }, {
4491
+ default: vue.withCtx(() => [
4492
+ vue.withDirectives(vue.createElementVNode("div", {
4493
+ id: __props.id,
4494
+ class: vue.normalizeClass([vue.unref(ns).b(), __props.customClass, horizontalClass.value]),
4495
+ style: vue.normalizeStyle(positionStyle.value),
4496
+ role: "alert",
4497
+ onMouseenter: clearTimer,
4498
+ onMouseleave: startTimer,
4499
+ onClick: _cache[0] || (_cache[0] = //@ts-ignore
4500
+ (...args) => __props.onClick && __props.onClick(...args))
4501
+ }, [
4502
+ iconComponent.value ? (vue.openBlock(), vue.createBlock(vue.unref(XBasicSvgIcon), {
4503
+ key: 0,
4504
+ class: vue.normalizeClass([vue.unref(ns).e("icon"), typeClass.value]),
4505
+ icon: iconComponent.value
4506
+ }, null, 8, ["class", "icon"])) : vue.createCommentVNode("", true),
4507
+ vue.createElementVNode("div", {
4508
+ class: vue.normalizeClass(vue.unref(ns).e("group"))
4509
+ }, [
4510
+ vue.createElementVNode("h2", {
4511
+ class: vue.normalizeClass(vue.unref(ns).e("title")),
4512
+ textContent: vue.toDisplayString(__props.title)
4513
+ }, null, 10, _hoisted_2$3),
4514
+ vue.withDirectives(vue.createElementVNode("div", {
4515
+ class: vue.normalizeClass(vue.unref(ns).e("content")),
4516
+ style: vue.normalizeStyle(!!__props.title ? void 0 : { margin: 0 })
4517
+ }, [
4518
+ vue.renderSlot(_ctx.$slots, "default", {}, () => [
4519
+ !__props.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_3, vue.toDisplayString(__props.message), 1)) : (vue.openBlock(), vue.createElementBlock("p", {
4520
+ key: 1,
4521
+ innerHTML: __props.message
4522
+ }, null, 8, _hoisted_4))
4523
+ ])
4524
+ ], 6), [
4525
+ [vue.vShow, __props.message]
4526
+ ]),
4527
+ vue.createElementVNode("span", {
4528
+ onClick: vue.withModifiers(close2, ["stop"])
4529
+ }, [
4530
+ __props.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(XBasicSvgIcon), {
4531
+ key: 0,
4532
+ class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
4533
+ icon: "ri:close-line"
4534
+ }, null, 8, ["class"])) : vue.createCommentVNode("", true)
4535
+ ])
4536
+ ], 2)
4537
+ ], 46, _hoisted_1$a), [
4538
+ [vue.vShow, visible.value]
4539
+ ])
4540
+ ]),
4541
+ _: 3
4542
+ }, 8, ["onBeforeLeave"]);
4543
+ };
4544
+ }
4545
+ });
4546
+ const notificationTypes = ["success", "info", "warning", "error"];
4547
+ const notifications = {
4548
+ "top-left": [],
4549
+ "top-right": [],
4550
+ "bottom-left": [],
4551
+ "bottom-right": []
4552
+ };
4553
+ const GAP_SIZE = 16;
4554
+ let seed = 1;
4555
+ const notify = (options, context) => {
4556
+ if (!utils.isClient) return { close: () => void 0 };
4557
+ if (utils.isString(options) || vue.isVNode(options)) {
4558
+ options = { message: options };
4559
+ }
4560
+ const position = (options == null ? void 0 : options.position) || "top-right";
4561
+ let verticalOffset = (options == null ? void 0 : options.offset) || 0;
4562
+ notifications[position].forEach(({ vm: vm2 }) => {
4563
+ var _a;
4564
+ verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
4565
+ });
4566
+ verticalOffset += GAP_SIZE;
4567
+ const id = `notification_${seed++}`;
4568
+ const userOnClose = options == null ? void 0 : options.onClose;
4569
+ const props = {
4570
+ ...options,
4571
+ offset: verticalOffset,
4572
+ id,
4573
+ onClose: () => {
4574
+ close(id, position, userOnClose);
4575
+ }
4576
+ };
4577
+ let appendTo = document.body;
4578
+ if (utils.isElement(options == null ? void 0 : options.appendTo)) {
4579
+ appendTo = options == null ? void 0 : options.appendTo;
4580
+ } else if (utils.isString(options == null ? void 0 : options.appendTo)) {
4581
+ appendTo = document.querySelector(options == null ? void 0 : options.appendTo);
4582
+ }
4583
+ if (!utils.isElement(appendTo)) {
4584
+ console.warn("the appendTo option is not an HTMLElement. Falling back to document.body.");
4585
+ appendTo = document.body;
4586
+ }
4587
+ const container = document.createElement("div");
4588
+ const vm = vue.createVNode(_sfc_main$I, props, utils.isFunction(props.message) ? props.message : vue.isVNode(props.message) ? () => props.message : null);
4589
+ vm.appContext = utils.isUndefined(context) ? notify._context : context;
4590
+ vm.props.onDestroy = () => {
4591
+ vue.render(null, container);
4592
+ };
4593
+ vue.render(vm, container);
4594
+ notifications[position].push({ vm });
4595
+ appendTo.appendChild(container.firstElementChild);
4596
+ return {
4597
+ // instead of calling the onClose function directly, setting this value so that we can have the full lifecycle
4598
+ // for out component, so that all closing steps will not be skipped.
4599
+ close: () => {
4600
+ vm.component.exposed.visible.value = false;
4601
+ }
4602
+ };
4603
+ };
4604
+ notificationTypes.forEach((type) => {
4605
+ notify[type] = (options = {}, appContext) => {
4606
+ if (utils.isString(options) || vue.isVNode(options)) {
4607
+ options = {
4608
+ message: options
4609
+ };
4610
+ }
4611
+ return notify({ ...options, type }, appContext);
4612
+ };
4613
+ });
4614
+ function close(id, position, userOnClose) {
4615
+ const orientedNotifications = notifications[position];
4616
+ const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
4617
+ var _a;
4618
+ return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
4619
+ });
4620
+ if (idx === -1) return;
4621
+ const { vm } = orientedNotifications[idx];
4622
+ if (!vm) return;
4623
+ userOnClose == null ? void 0 : userOnClose(vm);
4624
+ const removedHeight = vm.el.offsetHeight;
4625
+ const verticalPos = (position == null ? void 0 : position.split("-")[0]) || "top";
4626
+ orientedNotifications.splice(idx, 1);
4627
+ const len = orientedNotifications.length;
4628
+ if (len < 1) return;
4629
+ for (let i = idx; i < len; i++) {
4630
+ const { el, component } = orientedNotifications[i].vm;
4631
+ const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
4632
+ component.props.offset = pos;
4633
+ }
4634
+ }
4635
+ function closeAll() {
4636
+ for (const orientedNotifications of Object.values(notifications)) {
4637
+ orientedNotifications.forEach(({ vm }) => {
4638
+ vm.component.exposed.visible.value = false;
4639
+ });
4640
+ }
4641
+ }
4642
+ notify.closeAll = closeAll;
4643
+ notify._context = null;
4644
+ const $Notification = notify;
4645
+ const XBasicNotification = $Notification;
4646
+ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
4398
4647
  __name: "BasicButtonExportMax",
4399
4648
  props: {
4400
4649
  drop: { type: Boolean, default: true },
@@ -4407,14 +4656,14 @@ const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
4407
4656
  exportApi: {},
4408
4657
  beforeFetch: {},
4409
4658
  afterFetch: {},
4410
- showProgress: { type: Boolean, default: true }
4659
+ showProgress: { type: Boolean, default: false }
4411
4660
  },
4412
4661
  emits: ["click"],
4413
4662
  setup(__props, { emit: __emit }) {
4414
4663
  const props = __props;
4415
4664
  const emit = __emit;
4416
4665
  const { b } = useNamespace("basic-button-export-max");
4417
- const { b: bm, e: em } = useNamespace("basic-button-export-max-modal");
4666
+ const { b: bm, e: em } = useNamespace("basic-button-em-modal");
4418
4667
  const progressVisible = vue.ref(false);
4419
4668
  const progressPercent = vue.ref(0);
4420
4669
  const attrs = vue.useAttrs();
@@ -4425,8 +4674,20 @@ const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
4425
4674
  return option;
4426
4675
  });
4427
4676
  });
4428
- function getFetchParams(key2) {
4429
- return props.beforeFetch ? props.beforeFetch(key2) : {};
4677
+ async function runBeforeFetchGuard(key2) {
4678
+ if (!props.beforeFetch || !utils.isFunction(props.beforeFetch)) return { pass: true, params: {} };
4679
+ try {
4680
+ const result = await props.beforeFetch(key2);
4681
+ if (result === false) return { pass: false, params: {} };
4682
+ if (utils.isString(result) && result) {
4683
+ XBasicNotification.error(result);
4684
+ return { pass: false, params: {} };
4685
+ }
4686
+ return { pass: true, params: result || {} };
4687
+ } catch (error) {
4688
+ console.error(error);
4689
+ return { pass: false, params: {} };
4690
+ }
4430
4691
  }
4431
4692
  function getFetchApi(key2) {
4432
4693
  var _a;
@@ -4442,8 +4703,9 @@ const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
4442
4703
  }
4443
4704
  async function trigger(key2) {
4444
4705
  const api = getFetchApi(key2);
4445
- const params = getFetchParams(key2);
4446
4706
  if (!api) return;
4707
+ const { pass, params } = await runBeforeFetchGuard(key2);
4708
+ if (!pass) return;
4447
4709
  if (props.showProgress) {
4448
4710
  progressPercent.value = 0;
4449
4711
  progressVisible.value = true;
@@ -4465,7 +4727,6 @@ const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
4465
4727
  trigger("max");
4466
4728
  }
4467
4729
  return (_ctx, _cache) => {
4468
- const _component_XBasicButton = vue.resolveComponent("XBasicButton");
4469
4730
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
4470
4731
  __props.drop ? (vue.openBlock(), vue.createBlock(_sfc_main$O, vue.mergeProps({
4471
4732
  key: 0,
@@ -4479,7 +4740,7 @@ const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
4479
4740
  ])
4480
4741
  ]),
4481
4742
  _: 3
4482
- }, 16, ["icon", "options", "class"])) : (vue.openBlock(), vue.createBlock(_component_XBasicButton, vue.mergeProps({
4743
+ }, 16, ["icon", "options", "class"])) : (vue.openBlock(), vue.createBlock(vue.unref(XBasicButton), vue.mergeProps({
4483
4744
  key: 1,
4484
4745
  icon: __props.icon,
4485
4746
  type: "primary"
@@ -4495,32 +4756,35 @@ const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
4495
4756
  show: progressVisible.value,
4496
4757
  "onUpdate:show": _cache[0] || (_cache[0] = ($event) => progressVisible.value = $event),
4497
4758
  closable: false,
4498
- preset: "card",
4499
- class: vue.normalizeClass(vue.unref(bm)())
4759
+ "mask-closable": false,
4760
+ "show-mask": false
4500
4761
  }, {
4501
4762
  default: vue.withCtx(() => [
4502
4763
  vue.createElementVNode("div", {
4503
- class: vue.normalizeClass(vue.unref(em)("progress-content"))
4764
+ class: vue.normalizeClass(vue.unref(bm)())
4504
4765
  }, [
4505
- vue.createVNode(vue.unref(naiveUi.NProgress), {
4506
- type: "line",
4507
- percentage: progressPercent.value,
4508
- "indicator-placement": "inside"
4509
- }, null, 8, ["percentage"]),
4510
- vue.createElementVNode("p", null, vue.toDisplayString(vue.unref(t)("max.basic.exportingTip")), 1)
4766
+ vue.createElementVNode("div", {
4767
+ class: vue.normalizeClass(vue.unref(em)("content"))
4768
+ }, [
4769
+ vue.createVNode(vue.unref(naiveUi.NProgress), {
4770
+ type: "circle",
4771
+ percentage: progressPercent.value
4772
+ }, null, 8, ["percentage"]),
4773
+ vue.createElementVNode("p", null, vue.toDisplayString(vue.unref(t)("max.basic.downloading")), 1)
4774
+ ], 2)
4511
4775
  ], 2)
4512
4776
  ]),
4513
4777
  _: 1
4514
- }, 8, ["show", "class"])
4778
+ }, 8, ["show"])
4515
4779
  ], 64);
4516
4780
  };
4517
4781
  }
4518
4782
  });
4519
- const XBasicButtonExportMax = utils.withInstall(_sfc_main$I);
4783
+ const XBasicButtonExportMax = utils.withInstall(_sfc_main$H);
4520
4784
  function _isSlot$3(s) {
4521
4785
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
4522
4786
  }
4523
- const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
4787
+ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
4524
4788
  name: "ButtonGroupItem",
4525
4789
  props: {
4526
4790
  schema: {
@@ -4873,7 +5137,7 @@ function useButtonGroupSchema({ getProps, schemaRef }) {
4873
5137
  });
4874
5138
  return { getSchema };
4875
5139
  }
4876
- const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
5140
+ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
4877
5141
  __name: "BasicButtonGroup",
4878
5142
  props: {
4879
5143
  showReturnButton: { type: Boolean },
@@ -4954,7 +5218,7 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
4954
5218
  return (_ctx, _cache) => {
4955
5219
  return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({ class: vue.unref(getWrapperClass) }, getBindValue.value), [
4956
5220
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(getSchema), (schema) => {
4957
- return vue.openBlock(), vue.createBlock(_sfc_main$H, {
5221
+ return vue.openBlock(), vue.createBlock(_sfc_main$G, {
4958
5222
  key: schema.field,
4959
5223
  schema,
4960
5224
  "button-group-action-type": buttonGroupActionType,
@@ -4975,256 +5239,7 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
4975
5239
  };
4976
5240
  }
4977
5241
  });
4978
- const XBasicButtonGroup = utils.withInstall(_sfc_main$G);
4979
- const _hoisted_1$a = ["id"];
4980
- const _hoisted_2$3 = ["textContent"];
4981
- const _hoisted_3 = { key: 0 };
4982
- const _hoisted_4 = ["innerHTML"];
4983
- const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
4984
- __name: "BasicNotification",
4985
- props: {
4986
- customClass: { default: "" },
4987
- dangerouslyUseHTMLString: { type: Boolean },
4988
- duration: { default: 4500 },
4989
- icon: {},
4990
- id: { default: "" },
4991
- message: {},
4992
- offset: { default: 0 },
4993
- onClick: { type: Function, default: () => void 0 },
4994
- onClose: {},
4995
- position: { default: "top-right" },
4996
- showClose: { type: Boolean, default: true },
4997
- title: { default: "" },
4998
- type: { default: "" },
4999
- zIndex: {}
5000
- },
5001
- emits: ["destroy"],
5002
- setup(__props, { expose: __expose, emit: __emit }) {
5003
- const props = __props;
5004
- const emit = __emit;
5005
- const { ns, zIndex: zIndex2 } = useConfigProvider("basic-notification");
5006
- const { nextZIndex, currentZIndex } = zIndex2;
5007
- const visible = vue.ref(false);
5008
- let timer;
5009
- const iconMap = {
5010
- success: "ri:checkbox-circle-line",
5011
- error: "ri:close-circle-line",
5012
- info: "ri:information-line",
5013
- warning: "ri:error-warning-line"
5014
- };
5015
- const typeClass = vue.computed(() => {
5016
- const type = props.type;
5017
- return type && iconMap[props.type] ? ns.m(type) : "";
5018
- });
5019
- const iconComponent = vue.computed(() => {
5020
- if (!props.type) return props.icon;
5021
- return iconMap[props.type] || props.icon;
5022
- });
5023
- const horizontalClass = vue.computed(() => props.position.endsWith("right") ? "right" : "left");
5024
- const verticalProperty = vue.computed(() => props.position.startsWith("top") ? "top" : "bottom");
5025
- const positionStyle = vue.computed(() => {
5026
- var _a;
5027
- return {
5028
- [verticalProperty.value]: `${props.offset}px`,
5029
- zIndex: (_a = props.zIndex) != null ? _a : currentZIndex.value
5030
- };
5031
- });
5032
- function startTimer() {
5033
- if (props.duration > 0) {
5034
- ({ stop: timer } = useTimeoutFn(() => {
5035
- if (visible.value) close2();
5036
- }, props.duration));
5037
- }
5038
- }
5039
- function clearTimer() {
5040
- timer == null ? void 0 : timer();
5041
- }
5042
- function close2() {
5043
- visible.value = false;
5044
- }
5045
- function onKeydown({ code }) {
5046
- if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {
5047
- clearTimer();
5048
- } else if (code === EVENT_CODE.esc) {
5049
- if (visible.value) {
5050
- close2();
5051
- }
5052
- } else {
5053
- startTimer();
5054
- }
5055
- }
5056
- vue.onMounted(() => {
5057
- startTimer();
5058
- nextZIndex();
5059
- visible.value = true;
5060
- });
5061
- useEventListener(document, "keydown", onKeydown);
5062
- __expose({
5063
- visible,
5064
- /** @description close notification */
5065
- close: close2
5066
- });
5067
- return (_ctx, _cache) => {
5068
- return vue.openBlock(), vue.createBlock(vue.Transition, {
5069
- name: "imax-notification-fade",
5070
- onBeforeLeave: __props.onClose,
5071
- onAfterLeave: _cache[1] || (_cache[1] = ($event) => emit("destroy"))
5072
- }, {
5073
- default: vue.withCtx(() => [
5074
- vue.withDirectives(vue.createElementVNode("div", {
5075
- id: __props.id,
5076
- class: vue.normalizeClass([vue.unref(ns).b(), __props.customClass, horizontalClass.value]),
5077
- style: vue.normalizeStyle(positionStyle.value),
5078
- role: "alert",
5079
- onMouseenter: clearTimer,
5080
- onMouseleave: startTimer,
5081
- onClick: _cache[0] || (_cache[0] = //@ts-ignore
5082
- (...args) => __props.onClick && __props.onClick(...args))
5083
- }, [
5084
- iconComponent.value ? (vue.openBlock(), vue.createBlock(vue.unref(XBasicSvgIcon), {
5085
- key: 0,
5086
- class: vue.normalizeClass([vue.unref(ns).e("icon"), typeClass.value]),
5087
- icon: iconComponent.value
5088
- }, null, 8, ["class", "icon"])) : vue.createCommentVNode("", true),
5089
- vue.createElementVNode("div", {
5090
- class: vue.normalizeClass(vue.unref(ns).e("group"))
5091
- }, [
5092
- vue.createElementVNode("h2", {
5093
- class: vue.normalizeClass(vue.unref(ns).e("title")),
5094
- textContent: vue.toDisplayString(__props.title)
5095
- }, null, 10, _hoisted_2$3),
5096
- vue.withDirectives(vue.createElementVNode("div", {
5097
- class: vue.normalizeClass(vue.unref(ns).e("content")),
5098
- style: vue.normalizeStyle(!!__props.title ? void 0 : { margin: 0 })
5099
- }, [
5100
- vue.renderSlot(_ctx.$slots, "default", {}, () => [
5101
- !__props.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_3, vue.toDisplayString(__props.message), 1)) : (vue.openBlock(), vue.createElementBlock("p", {
5102
- key: 1,
5103
- innerHTML: __props.message
5104
- }, null, 8, _hoisted_4))
5105
- ])
5106
- ], 6), [
5107
- [vue.vShow, __props.message]
5108
- ]),
5109
- vue.createElementVNode("span", {
5110
- onClick: vue.withModifiers(close2, ["stop"])
5111
- }, [
5112
- __props.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(XBasicSvgIcon), {
5113
- key: 0,
5114
- class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
5115
- icon: "ri:close-line"
5116
- }, null, 8, ["class"])) : vue.createCommentVNode("", true)
5117
- ])
5118
- ], 2)
5119
- ], 46, _hoisted_1$a), [
5120
- [vue.vShow, visible.value]
5121
- ])
5122
- ]),
5123
- _: 3
5124
- }, 8, ["onBeforeLeave"]);
5125
- };
5126
- }
5127
- });
5128
- const notificationTypes = ["success", "info", "warning", "error"];
5129
- const notifications = {
5130
- "top-left": [],
5131
- "top-right": [],
5132
- "bottom-left": [],
5133
- "bottom-right": []
5134
- };
5135
- const GAP_SIZE = 16;
5136
- let seed = 1;
5137
- const notify = (options, context) => {
5138
- if (!utils.isClient) return { close: () => void 0 };
5139
- if (utils.isString(options) || vue.isVNode(options)) {
5140
- options = { message: options };
5141
- }
5142
- const position = (options == null ? void 0 : options.position) || "top-right";
5143
- let verticalOffset = (options == null ? void 0 : options.offset) || 0;
5144
- notifications[position].forEach(({ vm: vm2 }) => {
5145
- var _a;
5146
- verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
5147
- });
5148
- verticalOffset += GAP_SIZE;
5149
- const id = `notification_${seed++}`;
5150
- const userOnClose = options == null ? void 0 : options.onClose;
5151
- const props = {
5152
- ...options,
5153
- offset: verticalOffset,
5154
- id,
5155
- onClose: () => {
5156
- close(id, position, userOnClose);
5157
- }
5158
- };
5159
- let appendTo = document.body;
5160
- if (utils.isElement(options == null ? void 0 : options.appendTo)) {
5161
- appendTo = options == null ? void 0 : options.appendTo;
5162
- } else if (utils.isString(options == null ? void 0 : options.appendTo)) {
5163
- appendTo = document.querySelector(options == null ? void 0 : options.appendTo);
5164
- }
5165
- if (!utils.isElement(appendTo)) {
5166
- console.warn("the appendTo option is not an HTMLElement. Falling back to document.body.");
5167
- appendTo = document.body;
5168
- }
5169
- const container = document.createElement("div");
5170
- const vm = vue.createVNode(_sfc_main$F, props, utils.isFunction(props.message) ? props.message : vue.isVNode(props.message) ? () => props.message : null);
5171
- vm.appContext = utils.isUndefined(context) ? notify._context : context;
5172
- vm.props.onDestroy = () => {
5173
- vue.render(null, container);
5174
- };
5175
- vue.render(vm, container);
5176
- notifications[position].push({ vm });
5177
- appendTo.appendChild(container.firstElementChild);
5178
- return {
5179
- // instead of calling the onClose function directly, setting this value so that we can have the full lifecycle
5180
- // for out component, so that all closing steps will not be skipped.
5181
- close: () => {
5182
- vm.component.exposed.visible.value = false;
5183
- }
5184
- };
5185
- };
5186
- notificationTypes.forEach((type) => {
5187
- notify[type] = (options = {}, appContext) => {
5188
- if (utils.isString(options) || vue.isVNode(options)) {
5189
- options = {
5190
- message: options
5191
- };
5192
- }
5193
- return notify({ ...options, type }, appContext);
5194
- };
5195
- });
5196
- function close(id, position, userOnClose) {
5197
- const orientedNotifications = notifications[position];
5198
- const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
5199
- var _a;
5200
- return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
5201
- });
5202
- if (idx === -1) return;
5203
- const { vm } = orientedNotifications[idx];
5204
- if (!vm) return;
5205
- userOnClose == null ? void 0 : userOnClose(vm);
5206
- const removedHeight = vm.el.offsetHeight;
5207
- const verticalPos = (position == null ? void 0 : position.split("-")[0]) || "top";
5208
- orientedNotifications.splice(idx, 1);
5209
- const len = orientedNotifications.length;
5210
- if (len < 1) return;
5211
- for (let i = idx; i < len; i++) {
5212
- const { el, component } = orientedNotifications[i].vm;
5213
- const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
5214
- component.props.offset = pos;
5215
- }
5216
- }
5217
- function closeAll() {
5218
- for (const orientedNotifications of Object.values(notifications)) {
5219
- orientedNotifications.forEach(({ vm }) => {
5220
- vm.component.exposed.visible.value = false;
5221
- });
5222
- }
5223
- }
5224
- notify.closeAll = closeAll;
5225
- notify._context = null;
5226
- const $Notification = notify;
5227
- const XBasicNotification = $Notification;
5242
+ const XBasicButtonGroup = utils.withInstall(_sfc_main$F);
5228
5243
  const ROW_KEY$1 = "_MAX_ROW_KEY";
5229
5244
  const PAGE_SIZE_OPTIONS$1 = [10, 50, 80, 100];
5230
5245
  const PAGE_SIZE$1 = 10;