@maxax/ui 1.1.18 → 1.1.20

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.
Files changed (46) hide show
  1. package/dist/component.d.ts.map +1 -1
  2. package/dist/components/basic-action-footer/BasicActionFooter.vue.d.ts +30 -0
  3. package/dist/components/basic-action-footer/BasicActionFooter.vue.d.ts.map +1 -0
  4. package/dist/components/basic-action-footer/context.d.ts +6 -0
  5. package/dist/components/basic-action-footer/context.d.ts.map +1 -0
  6. package/dist/components/basic-action-footer/index.d.ts +7 -0
  7. package/dist/components/basic-action-footer/index.d.ts.map +1 -0
  8. package/dist/components/basic-action-footer/interface.d.ts +18 -0
  9. package/dist/components/basic-action-footer/interface.d.ts.map +1 -0
  10. package/dist/components/basic-checkbox-group/BasicCheckboxGroup.d.ts +3 -3
  11. package/dist/components/basic-message-box/BasicMessageBox.vue.d.ts +4 -4
  12. package/dist/components/basic-overlay/BasicOverlay.d.ts +2 -2
  13. package/dist/components/basic-radio-group/BasicRadioGroup.d.ts +3 -3
  14. package/dist/components/basic-select/BasicSelect.vue.d.ts +1 -1
  15. package/dist/components/basic-upload/BasicUpload.d.ts +1 -1
  16. package/dist/components/index.d.ts +1 -0
  17. package/dist/components/index.d.ts.map +1 -1
  18. package/dist/components/tree/Tree.vue.d.ts +1 -1
  19. package/dist/components/tree-drop/TreeDrop.vue.d.ts +7 -7
  20. package/dist/components/tree-search/TreeSearch.vue.d.ts +4 -4
  21. package/dist/composable/index.d.ts +1 -1
  22. package/dist/composable/index.d.ts.map +1 -1
  23. package/dist/composable/{use-drawer.d.ts → use-drawer-modal.d.ts} +1 -1
  24. package/dist/composable/use-drawer-modal.d.ts.map +1 -0
  25. package/dist/index.cjs +1056 -971
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.mjs +1059 -974
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/locale/lang/en.d.ts.map +1 -1
  30. package/dist/locale/lang/zh-cn.d.ts.map +1 -1
  31. package/dist/locales.cjs +3 -2
  32. package/dist/locales.cjs.map +1 -1
  33. package/dist/locales.mjs +3 -2
  34. package/dist/locales.mjs.map +1 -1
  35. package/dist/theme-chalk/index.css +1 -1
  36. package/dist/theme-chalk/light.css +1 -1
  37. package/dist/types/basic.d.ts +2 -2
  38. package/dist/types/basic.d.ts.map +1 -1
  39. package/dist/{utils-BlU-30Gl.cjs → utils-CaGh1NhT.cjs} +3 -2
  40. package/dist/utils-CaGh1NhT.cjs.map +1 -0
  41. package/dist/{utils-BTs_N8qH.js → utils-Doo526pz.js} +3 -2
  42. package/dist/utils-Doo526pz.js.map +1 -0
  43. package/package.json +5 -4
  44. package/dist/composable/use-drawer.d.ts.map +0 -1
  45. package/dist/utils-BTs_N8qH.js.map +0 -1
  46. package/dist/utils-BlU-30Gl.cjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { camelize, isNumber, isString, removeClass, addClass, pascalCase, isClient as isClient$1, hasClass, withInstall, downloadFileStatic, isFunction, downloadFileByResponseData, guid, attrAccept as attrAccept$1, isElement, isObject as isObject$1, isUndefined, isBoolean, getSlot, isArray, deepMerge, cloneDeep as cloneDeep$2, classNames, call, isNull, getValueKey, tryConstructArray, isNil, tryDeconstructArray, tryDeconstructObject, isEmpty, isPascalCase, mergeArray, getStyle as getStyle$1, kebabCase, findNodeAll, calculate } from "@maxax/utils";
2
- import { shallowRef, shallowReadonly, onUnmounted, onMounted, nextTick, getCurrentScope, onScopeDispose, toValue, getCurrentInstance, watch, computed, unref, Fragment, isVNode, Comment, Text, watchEffect, onBeforeUnmount, inject, ref, isRef, toRaw, defineComponent, createElementBlock, openBlock, normalizeClass, createElementVNode, renderSlot, h, useAttrs, mergeProps, createBlock, createCommentVNode, withCtx, createTextVNode, toDisplayString, createVNode, useSlots, createSlots, useTemplateRef, normalizeStyle, provide, reactive, toRefs, resolveComponent, Transition, withDirectives, withModifiers, withKeys, resolveDynamicComponent, vShow, render as render$1, renderList, triggerRef, TransitionGroup, toRef, normalizeProps, guardReactiveProps, vModelText, createApp, mergeDefaults, toHandlers } from "vue";
1
+ import { camelize, isNumber, isString, removeClass, addClass, pascalCase, isClient as isClient$1, hasClass, withInstall, guid, isFunction, isElement, isObject as isObject$1, isUndefined, downloadFileStatic, downloadFileByResponseData, attrAccept as attrAccept$1, isBoolean, getSlot, isArray, deepMerge, cloneDeep as cloneDeep$2, classNames, call, isNull, getValueKey, tryConstructArray, isNil, tryDeconstructArray, tryDeconstructObject, isEmpty, isPascalCase, mergeArray, getStyle as getStyle$1, kebabCase, findNodeAll, calculate } from "@maxax/utils";
2
+ import { shallowRef, shallowReadonly, onUnmounted, onMounted, nextTick, getCurrentScope, onScopeDispose, toValue, getCurrentInstance, watch, computed, unref, Fragment, isVNode, Comment, Text, watchEffect, onBeforeUnmount, inject, ref, isRef, toRaw, defineComponent, createElementBlock, openBlock, normalizeClass, createElementVNode, renderSlot, h, useAttrs, mergeProps, createBlock, createCommentVNode, withCtx, createTextVNode, toDisplayString, createVNode, useSlots, createSlots, provide, reactive, toRefs, resolveComponent, Transition, withDirectives, withModifiers, normalizeStyle, withKeys, resolveDynamicComponent, vShow, render as render$1, useTemplateRef, renderList, triggerRef, TransitionGroup, toRef, normalizeProps, guardReactiveProps, vModelText, createApp, mergeDefaults, toHandlers } from "vue";
3
3
  import BScroll from "@better-scroll/core";
4
- import { NTooltip, NButton, NButtonGroup, NDropdown, NInput, NProgress, NModal, NSwitch, NCard, NCascader, NDatePicker, NDrawer, NDrawerContent, NSelect, NInputNumber, NUpload, NAutoComplete, NDynamicTags, NTreeSelect, NTimePicker, NCheckbox, NCheckboxGroup, NRadio, NRadioButton, NRadioGroup, NSlider, NTransfer, NDivider, NColorPicker, NRate, NCol, NFormItem, NForm, NRow, NPopover, NTabs, NTabPane, NScrollbar, NEmpty, NPagination, NSpin } from "naive-ui";
5
- import { b as buildLocaleContext, z as zhCN } from "./utils-BTs_N8qH.js";
4
+ import { NTooltip, NButton, NInput, NButtonGroup, NDropdown, NProgress, NModal, NSwitch, NCard, NCascader, NDatePicker, NDrawer, NDrawerContent, NSelect, NInputNumber, NUpload, NAutoComplete, NDynamicTags, NTreeSelect, NTimePicker, NCheckbox, NCheckboxGroup, NRadio, NRadioButton, NRadioGroup, NSlider, NTransfer, NDivider, NColorPicker, NRate, NCol, NFormItem, NForm, NRow, NPopover, NTabs, NTabPane, NScrollbar, NEmpty, NPagination, NSpin } from "naive-ui";
5
+ import { b as buildLocaleContext, z as zhCN } from "./utils-Doo526pz.js";
6
6
  import { merge, cloneDeep as cloneDeep$1, uniqBy, partition, get, omit, has, set, unset, isNumber as isNumber$1, isPlainObject, isBoolean as isBoolean$1, isFunction as isFunction$1, isArray as isArray$1, isString as isString$1, isEqual, concat } from "lodash-es";
7
7
  import { useBoolean, useMergedState as useMergedState$1, useEventListener as useEventListener$1, useBreakpoint } from "@maxax/hooks";
8
8
  import { format } from "date-fns";
@@ -813,7 +813,7 @@ function useBasicDrawerModal(params = {}) {
813
813
  const { t } = useLocale();
814
814
  const visibleRef = ref(false);
815
815
  const { bool: loadingRef, setTrue: showLoading, setFalse: hideLoading } = useBoolean();
816
- const typeRef = ref("add");
816
+ const typeRef = ref("other");
817
817
  const dataRef = ref({});
818
818
  const titleRef = computed(() => {
819
819
  return t(`max.basic.${typeRef.value}`) || "";
@@ -828,7 +828,7 @@ function useBasicDrawerModal(params = {}) {
828
828
  function hide() {
829
829
  var _a;
830
830
  visibleRef.value = false;
831
- typeRef.value = "add";
831
+ typeRef.value = "other";
832
832
  dataRef.value = {};
833
833
  (_a = params.onHide) == null ? void 0 : _a.call(params);
834
834
  }
@@ -1128,7 +1128,7 @@ const useZIndex = (zIndexOverrides) => {
1128
1128
  nextZIndex
1129
1129
  };
1130
1130
  };
1131
- const _sfc_main$Y = /* @__PURE__ */ defineComponent({
1131
+ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
1132
1132
  __name: "better-scroll",
1133
1133
  props: {
1134
1134
  options: {}
@@ -2854,7 +2854,7 @@ const Icon = defineComponent((props, { emit }) => {
2854
2854
  emits: ["load"]
2855
2855
  });
2856
2856
  const _hoisted_1$d = ["xlink:href"];
2857
- const _sfc_main$X = /* @__PURE__ */ defineComponent({
2857
+ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
2858
2858
  __name: "BasicSvgIcon",
2859
2859
  props: {
2860
2860
  icon: {},
@@ -2900,8 +2900,8 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
2900
2900
  };
2901
2901
  }
2902
2902
  });
2903
- const XBasicSvgIcon = withInstall(_sfc_main$X);
2904
- const _sfc_main$W = /* @__PURE__ */ defineComponent({
2903
+ const XBasicSvgIcon = withInstall(_sfc_main$Y);
2904
+ const _sfc_main$X = /* @__PURE__ */ defineComponent({
2905
2905
  ...{
2906
2906
  inheritAttrs: false
2907
2907
  },
@@ -2950,7 +2950,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
2950
2950
  };
2951
2951
  }
2952
2952
  });
2953
- const _sfc_main$V = /* @__PURE__ */ defineComponent({
2953
+ const _sfc_main$W = /* @__PURE__ */ defineComponent({
2954
2954
  __name: "full-screen",
2955
2955
  props: {
2956
2956
  full: { type: Boolean }
@@ -2958,7 +2958,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
2958
2958
  setup(__props) {
2959
2959
  const { t } = useLocale();
2960
2960
  return (_ctx, _cache) => {
2961
- return openBlock(), createBlock(_sfc_main$W, {
2961
+ return openBlock(), createBlock(_sfc_main$X, {
2962
2962
  key: String(__props.full),
2963
2963
  "tooltip-content": __props.full ? unref(t)("max.icon.fullscreenExit") : unref(t)("max.icon.fullscreen")
2964
2964
  }, {
@@ -2976,7 +2976,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
2976
2976
  };
2977
2977
  }
2978
2978
  });
2979
- const _sfc_main$U = /* @__PURE__ */ defineComponent({
2979
+ const _sfc_main$V = /* @__PURE__ */ defineComponent({
2980
2980
  __name: "icon-tooltip",
2981
2981
  props: {
2982
2982
  icon: { default: "mdi-help-circle" },
@@ -3016,7 +3016,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
3016
3016
  };
3017
3017
  }
3018
3018
  });
3019
- const _sfc_main$T = /* @__PURE__ */ defineComponent({
3019
+ const _sfc_main$U = /* @__PURE__ */ defineComponent({
3020
3020
  __name: "menu-toggler",
3021
3021
  props: {
3022
3022
  collapsed: { type: Boolean },
@@ -3042,7 +3042,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
3042
3042
  return icons[arrowIcon][collapsed];
3043
3043
  });
3044
3044
  return (_ctx, _cache) => {
3045
- return openBlock(), createBlock(_sfc_main$W, {
3045
+ return openBlock(), createBlock(_sfc_main$X, {
3046
3046
  key: String(__props.collapsed),
3047
3047
  "tooltip-content": __props.collapsed ? unref(t)("max.icon.expand") : unref(t)("max.icon.collapse"),
3048
3048
  "tooltip-placement": "bottom-start",
@@ -3056,7 +3056,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
3056
3056
  };
3057
3057
  }
3058
3058
  });
3059
- const _sfc_main$S = /* @__PURE__ */ defineComponent({
3059
+ const _sfc_main$T = /* @__PURE__ */ defineComponent({
3060
3060
  __name: "pin-toggler",
3061
3061
  props: {
3062
3062
  pin: { type: Boolean }
@@ -3066,7 +3066,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
3066
3066
  const { t } = useLocale();
3067
3067
  const icon = computed(() => props.pin ? "mdi-pin-off" : "mdi-pin");
3068
3068
  return (_ctx, _cache) => {
3069
- return openBlock(), createBlock(_sfc_main$W, {
3069
+ return openBlock(), createBlock(_sfc_main$X, {
3070
3070
  "tooltip-content": __props.pin ? unref(t)("max.icon.unpin") : unref(t)("max.icon.pin"),
3071
3071
  "tooltip-placement": "bottom-start",
3072
3072
  "z-index": 100
@@ -3079,7 +3079,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
3079
3079
  };
3080
3080
  }
3081
3081
  });
3082
- const _sfc_main$R = /* @__PURE__ */ defineComponent({
3082
+ const _sfc_main$S = /* @__PURE__ */ defineComponent({
3083
3083
  __name: "reload-button",
3084
3084
  props: {
3085
3085
  loading: { type: Boolean }
@@ -3088,7 +3088,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
3088
3088
  const { t } = useLocale();
3089
3089
  const { b } = useNamespace("reload-button");
3090
3090
  return (_ctx, _cache) => {
3091
- return openBlock(), createBlock(_sfc_main$W, {
3091
+ return openBlock(), createBlock(_sfc_main$X, {
3092
3092
  "tooltip-content": unref(t)("max.icon.reload")
3093
3093
  }, {
3094
3094
  default: withCtx(() => [
@@ -3102,47 +3102,14 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
3102
3102
  };
3103
3103
  }
3104
3104
  });
3105
- const XCommonBetterScroll = withInstall(_sfc_main$Y);
3106
- const XCommonButtonIcon = withInstall(_sfc_main$W);
3107
- const XCommonFullScreen = withInstall(_sfc_main$V);
3108
- const XCommonIconTooltip = withInstall(_sfc_main$U);
3109
- const XCommonMenuToggler = withInstall(_sfc_main$T);
3110
- const XCommonPinToggler = withInstall(_sfc_main$S);
3111
- const XCommonReloadButton = withInstall(_sfc_main$R);
3112
- const _sfc_main$Q = /* @__PURE__ */ defineComponent({
3113
- __name: "BasicArrow",
3114
- props: {
3115
- expand: { type: Boolean },
3116
- inset: { type: Boolean }
3117
- },
3118
- setup(__props) {
3119
- const props = __props;
3120
- const { b } = useNamespace("basic-arrow");
3121
- const getClass = computed(() => {
3122
- const { expand, inset } = props;
3123
- const prefixCls = b();
3124
- return [
3125
- prefixCls,
3126
- {
3127
- [`${prefixCls}--active`]: expand,
3128
- inset
3129
- }
3130
- ];
3131
- });
3132
- const getIcon = computed(() => {
3133
- return props.expand ? "ri:arrow-up-s-line" : "ri:arrow-down-s-line";
3134
- });
3135
- return (_ctx, _cache) => {
3136
- return openBlock(), createElementBlock("span", {
3137
- class: normalizeClass(getClass.value)
3138
- }, [
3139
- createVNode(unref(XBasicSvgIcon), { icon: getIcon.value }, null, 8, ["icon"])
3140
- ], 2);
3141
- };
3142
- }
3143
- });
3144
- const XBasicArrow = withInstall(_sfc_main$Q);
3145
- const _sfc_main$P = /* @__PURE__ */ defineComponent({
3105
+ const XCommonBetterScroll = withInstall(_sfc_main$Z);
3106
+ const XCommonButtonIcon = withInstall(_sfc_main$X);
3107
+ const XCommonFullScreen = withInstall(_sfc_main$W);
3108
+ const XCommonIconTooltip = withInstall(_sfc_main$V);
3109
+ const XCommonMenuToggler = withInstall(_sfc_main$U);
3110
+ const XCommonPinToggler = withInstall(_sfc_main$T);
3111
+ const XCommonReloadButton = withInstall(_sfc_main$S);
3112
+ const _sfc_main$R = /* @__PURE__ */ defineComponent({
3146
3113
  __name: "BasicButton",
3147
3114
  props: {
3148
3115
  size: {},
@@ -3197,548 +3164,189 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
3197
3164
  };
3198
3165
  }
3199
3166
  });
3200
- const XBasicButton = withInstall(_sfc_main$P);
3201
- const _sfc_main$O = /* @__PURE__ */ defineComponent({
3202
- __name: "BasicButtonCreate",
3203
- emits: ["click"],
3204
- setup(__props, { emit: __emit }) {
3205
- const emit = __emit;
3206
- const { t } = useLocale();
3207
- const attrs = useAttrs();
3208
- function onClickHandler() {
3209
- emit("click");
3210
- }
3211
- return (_ctx, _cache) => {
3212
- return openBlock(), createBlock(unref(XBasicButton), mergeProps({
3213
- icon: "ri-add-fill",
3214
- type: "primary"
3215
- }, unref(attrs), { onClick: onClickHandler }), {
3216
- default: withCtx(() => [
3217
- renderSlot(_ctx.$slots, "default", {}, () => [
3218
- createTextVNode(toDisplayString(unref(t)("max.basic.add")), 1)
3219
- ])
3220
- ]),
3221
- _: 3
3222
- }, 16);
3223
- };
3167
+ const XBasicButton = withInstall(_sfc_main$R);
3168
+ !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
3169
+ !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
3170
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
3171
+ const hasOwn = (val, key2) => hasOwnProperty.call(val, key2);
3172
+ const basicOverlayProps = {
3173
+ mask: {
3174
+ type: Boolean,
3175
+ default: true
3176
+ },
3177
+ customMaskEvent: Boolean,
3178
+ overlayClass: {
3179
+ type: [String, Array, Object]
3180
+ },
3181
+ zIndex: {
3182
+ type: [String, Number]
3224
3183
  }
3225
- });
3226
- const _sfc_main$N = /* @__PURE__ */ defineComponent({
3227
- __name: "BasicButtonDelete",
3184
+ };
3185
+ const BasicOverlay = /* @__PURE__ */ defineComponent({
3186
+ name: "XBasicOverlay",
3187
+ props: basicOverlayProps,
3228
3188
  emits: ["click"],
3229
- setup(__props, { emit: __emit }) {
3230
- const emit = __emit;
3231
- const { t } = useLocale();
3232
- const attrs = useAttrs();
3233
- function onClickHandler() {
3234
- emit("click");
3235
- }
3236
- return (_ctx, _cache) => {
3237
- return openBlock(), createBlock(unref(XBasicButton), mergeProps({
3238
- type: "error",
3239
- icon: "ri-delete-bin-5-fill"
3240
- }, unref(attrs), { onClick: onClickHandler }), {
3241
- default: withCtx(() => [
3242
- renderSlot(_ctx.$slots, "default", {}, () => [
3243
- createTextVNode(toDisplayString(unref(t)("max.basic.delete")), 1)
3244
- ])
3245
- ]),
3246
- _: 3
3247
- }, 16);
3189
+ setup(props, {
3190
+ emit,
3191
+ slots
3192
+ }) {
3193
+ const {
3194
+ b
3195
+ } = useNamespace("basic-overlay");
3196
+ const onMaskClick = (e) => {
3197
+ emit("click", e);
3248
3198
  };
3249
- }
3250
- });
3251
- const _sfc_main$M = /* @__PURE__ */ defineComponent({
3252
- __name: "BasicButtonDrop",
3253
- props: {
3254
- disabled: { type: Boolean },
3255
- icon: {},
3256
- options: { default: () => [] }
3257
- },
3258
- emits: ["click"],
3259
- setup(__props, { emit: __emit }) {
3260
- const props = __props;
3261
- const emit = __emit;
3262
- const { b, e } = useNamespace("basic-button-drop");
3263
- const cOptions = computed(() => {
3264
- var _a;
3265
- return ((_a = props.options) != null ? _a : []).map((option) => {
3266
- return option;
3267
- });
3268
- });
3269
- function handleSelect(key2) {
3270
- emit("click", key2);
3271
- }
3272
- function handleClick() {
3273
- if (cOptions.value.length === 0) {
3274
- return;
3275
- }
3276
- const defaultKey = cOptions.value[0].key;
3277
- emit("click", defaultKey);
3278
- }
3279
- return (_ctx, _cache) => {
3280
- return openBlock(), createBlock(unref(NButtonGroup), {
3281
- class: normalizeClass(unref(b)())
3282
- }, {
3283
- default: withCtx(() => [
3284
- createVNode(unref(XBasicButton), {
3285
- type: "primary",
3286
- icon: __props.icon,
3287
- disabled: __props.disabled,
3288
- class: normalizeClass(unref(e)("trigger-button")),
3289
- onClick: handleClick
3290
- }, {
3291
- default: withCtx(() => [
3292
- renderSlot(_ctx.$slots, "default")
3293
- ]),
3294
- _: 3
3295
- }, 8, ["icon", "disabled", "class"]),
3296
- createVNode(unref(NDropdown), {
3297
- trigger: "click",
3298
- options: cOptions.value,
3299
- onSelect: handleSelect
3300
- }, {
3301
- default: withCtx(() => [
3302
- createVNode(unref(XBasicButton), {
3303
- type: "primary",
3304
- icon: "ri:arrow-down-s-line",
3305
- class: normalizeClass(unref(e)("trigger-arrow"))
3306
- }, null, 8, ["class"])
3307
- ]),
3308
- _: 1
3309
- }, 8, ["options"])
3310
- ]),
3311
- _: 3
3312
- }, 8, ["class"]);
3199
+ const {
3200
+ onClick,
3201
+ onMousedown,
3202
+ onMouseup
3203
+ } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
3204
+ return () => {
3205
+ var _a, _b;
3206
+ return props.mask ? createVNode("div", {
3207
+ "class": [b(), props.overlayClass],
3208
+ "style": {
3209
+ zIndex: props.zIndex
3210
+ },
3211
+ "onClick": onClick,
3212
+ "onMousedown": onMousedown,
3213
+ "onMouseup": onMouseup
3214
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]) : createVNode("div", {
3215
+ "class": props.overlayClass,
3216
+ "style": {
3217
+ zIndex: props.zIndex,
3218
+ position: "fixed",
3219
+ top: "0px",
3220
+ right: "0px",
3221
+ bottom: "0px",
3222
+ left: "0px"
3223
+ }
3224
+ }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
3313
3225
  };
3314
3226
  }
3315
3227
  });
3316
- const _sfc_main$L = /* @__PURE__ */ defineComponent({
3317
- __name: "BasicButtonEdit",
3318
- emits: ["click"],
3319
- setup(__props, { emit: __emit }) {
3320
- const emit = __emit;
3321
- const { t } = useLocale();
3322
- const attrs = useAttrs();
3323
- function onClickHandler() {
3324
- emit("click");
3325
- }
3326
- return (_ctx, _cache) => {
3327
- return openBlock(), createBlock(unref(XBasicButton), mergeProps({
3328
- icon: "ri-edit-fill",
3329
- type: "primary"
3330
- }, unref(attrs), { onClick: onClickHandler }), {
3331
- default: withCtx(() => [
3332
- renderSlot(_ctx.$slots, "default", {}, () => [
3333
- createTextVNode(toDisplayString(unref(t)("max.basic.edit")), 1)
3334
- ])
3335
- ]),
3336
- _: 3
3337
- }, 16);
3338
- };
3228
+ const XBasicOverlay = withInstall(BasicOverlay);
3229
+ const configProviderKey = Symbol("config-provider");
3230
+ const globalConfig = ref();
3231
+ function useGlobalConfig(key2, defaultValue = void 0) {
3232
+ const config = getCurrentInstance() ? inject(configProviderKey, globalConfig) : globalConfig;
3233
+ if (key2) {
3234
+ return computed(() => {
3235
+ var _a, _b;
3236
+ return (_b = (_a = config.value) == null ? void 0 : _a[key2]) != null ? _b : defaultValue;
3237
+ });
3339
3238
  }
3340
- });
3341
- const _sfc_main$K = /* @__PURE__ */ defineComponent({
3342
- __name: "BasicButtonExport",
3343
- props: {
3344
- href: {},
3345
- exportApi: { type: Function },
3346
- beforeFetch: { type: Function },
3347
- afterFetch: { type: Function },
3348
- download: {},
3349
- origin: { type: Boolean },
3350
- onClick: { type: Function }
3351
- },
3352
- setup(__props) {
3353
- const props = __props;
3354
- const { t } = useLocale();
3355
- const attrs = useAttrs();
3356
- async function downloadFileRemote() {
3357
- if (!props.exportApi) return false;
3358
- const params = isFunction(props.beforeFetch) ? props.beforeFetch() : {};
3359
- const { response } = await props.exportApi(params);
3360
- if (response.data) {
3361
- downloadFileByResponseData(response);
3362
- }
3363
- props.afterFetch && props.afterFetch(response);
3364
- }
3365
- function onClickHandler() {
3366
- var _a;
3367
- if (props.origin) {
3368
- (_a = props.onClick) == null ? void 0 : _a.call(props);
3369
- return false;
3370
- }
3371
- if (!props.exportApi) {
3372
- downloadFileStatic(props.href, props.download);
3373
- return false;
3374
- }
3375
- downloadFileRemote();
3376
- }
3377
- return (_ctx, _cache) => {
3378
- return openBlock(), createBlock(unref(XBasicButton), mergeProps({
3379
- icon: "ri:export-line",
3380
- type: "primary"
3381
- }, unref(attrs), { onClick: onClickHandler }), {
3382
- default: withCtx(() => [
3383
- renderSlot(_ctx.$slots, "default", {}, () => [
3384
- createTextVNode(toDisplayString(unref(t)("max.basic.export")), 1)
3385
- ])
3386
- ]),
3387
- _: 3
3388
- }, 16);
3389
- };
3239
+ return config;
3240
+ }
3241
+ const provideGlobalConfig = (config, app, global = false) => {
3242
+ var _a;
3243
+ const inSetup = Boolean(getCurrentInstance());
3244
+ const oldConfig = inSetup ? useGlobalConfig() : void 0;
3245
+ const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? provide : void 0;
3246
+ if (!provideFn) return;
3247
+ const context = computed(() => {
3248
+ const cfg = unref(config);
3249
+ if (!(oldConfig == null ? void 0 : oldConfig.value)) return cfg;
3250
+ return merge(oldConfig.value, cfg);
3251
+ });
3252
+ provideFn(configProviderKey, context);
3253
+ provideFn(
3254
+ localeContextKey,
3255
+ computed(() => context.value.locale)
3256
+ );
3257
+ provideFn(
3258
+ namespaceContextKey,
3259
+ computed(() => context.value.namespace)
3260
+ );
3261
+ provideFn(
3262
+ zIndexContextKey,
3263
+ computed(() => context.value.zIndex)
3264
+ );
3265
+ provideFn(
3266
+ themeOverridesContextKey,
3267
+ computed(() => context.value.themeOverrides)
3268
+ );
3269
+ provideFn(
3270
+ iconLocalPrefixContextKey,
3271
+ computed(() => context.value.iconLocalPrefix)
3272
+ );
3273
+ if (global || !globalConfig.value) {
3274
+ globalConfig.value = context.value;
3390
3275
  }
3391
- });
3392
- const _sfc_main$J = /* @__PURE__ */ defineComponent({
3393
- __name: "BasicButtonExportDrop",
3394
- props: {
3395
- disabled: { type: Boolean },
3396
- icon: { default: "ri:export-line" },
3397
- options: { default: () => [
3398
- { label: "全部导出", key: "all" },
3399
- { label: "按选择条目导出", key: "select" }
3400
- ] }
3276
+ return context;
3277
+ };
3278
+ const useConfigProvider = (block) => {
3279
+ const config = useGlobalConfig();
3280
+ const ns = useNamespace(
3281
+ block,
3282
+ computed(() => {
3283
+ var _a;
3284
+ return ((_a = config.value) == null ? void 0 : _a.namespace) || DEFAULT_NAMESPACE;
3285
+ })
3286
+ );
3287
+ const locale = useLocale(computed(() => {
3288
+ var _a;
3289
+ return (_a = config.value) == null ? void 0 : _a.locale;
3290
+ }));
3291
+ const zIndex2 = useZIndex(computed(() => {
3292
+ var _a;
3293
+ return ((_a = config.value) == null ? void 0 : _a.zIndex) || DEFAULT_INITIAL_Z_INDEX;
3294
+ }));
3295
+ const themeOverrides = useThemeOverrides(computed(() => {
3296
+ var _a;
3297
+ return (_a = config.value) == null ? void 0 : _a.themeOverrides;
3298
+ }));
3299
+ provideGlobalConfig(computed(() => unref(config) || {}));
3300
+ return {
3301
+ ns,
3302
+ locale,
3303
+ zIndex: zIndex2,
3304
+ themeOverrides
3305
+ };
3306
+ };
3307
+ const configProviderProps = {
3308
+ /** 全局 z-index 值 */
3309
+ zIndex: Number,
3310
+ /** 全局语言 */
3311
+ locale: {
3312
+ type: Object
3401
3313
  },
3402
- emits: ["click"],
3403
- setup(__props, { emit: __emit }) {
3404
- const props = __props;
3405
- const emit = __emit;
3406
- const cOptions = computed(() => {
3314
+ /** 全局命名空间 */
3315
+ namespace: {
3316
+ type: String,
3317
+ default: DEFAULT_NAMESPACE
3318
+ },
3319
+ /** 本地全局图标前缀 */
3320
+ iconLocalPrefix: {
3321
+ type: String,
3322
+ default: DEFAULT_ICON_LOCAL_PREFIX
3323
+ },
3324
+ /** 全局主题覆盖 */
3325
+ themeOverrides: {
3326
+ type: Object
3327
+ }
3328
+ };
3329
+ const ConfigProvider = /* @__PURE__ */ defineComponent({
3330
+ name: "ConfigProvider",
3331
+ props: configProviderProps,
3332
+ setup(props, {
3333
+ slots
3334
+ }) {
3335
+ const config = provideGlobalConfig(props);
3336
+ return () => {
3407
3337
  var _a;
3408
- return ((_a = props.options) != null ? _a : []).map((option) => {
3409
- return option;
3410
- });
3411
- });
3412
- function handleClick(key2) {
3413
- emit("click", key2);
3414
- }
3415
- return (_ctx, _cache) => {
3416
- return openBlock(), createBlock(_sfc_main$M, {
3417
- icon: __props.icon,
3418
- options: cOptions.value,
3419
- onClick: handleClick
3420
- }, {
3421
- default: withCtx(() => [..._cache[0] || (_cache[0] = [
3422
- createTextVNode(" 导出 ", -1)
3423
- ])]),
3424
- _: 1
3425
- }, 8, ["icon", "options"]);
3338
+ return createVNode("div", {
3339
+ "class": "imax-config-provider",
3340
+ "data-config-provider": config
3341
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
3426
3342
  };
3427
3343
  }
3428
3344
  });
3429
- const _hoisted_1$c = ["multiple", "name", "accept"];
3430
- const _sfc_main$I = /* @__PURE__ */ defineComponent({
3431
- __name: "BasicButtonImport",
3432
- props: {
3433
- name: { default: "file" },
3434
- accept: { default: ".xlsx,.xls,.csv" },
3435
- multiple: { type: Boolean, default: false },
3436
- beforeUpload: { type: Function, default: void 0 }
3437
- },
3438
- emits: ["change"],
3439
- setup(__props, { emit: __emit }) {
3440
- const props = __props;
3441
- const emit = __emit;
3442
- const { t } = useLocale();
3443
- const attrs = useAttrs();
3444
- const uid2 = ref(guid());
3445
- const fileInputRef = useTemplateRef("fileInputRef");
3446
- function onClickHandler() {
3447
- var _a;
3448
- (_a = fileInputRef.value) == null ? void 0 : _a.click();
3449
- }
3450
- function reset() {
3451
- uid2.value = guid();
3452
- }
3453
- async function processFile(file, fileList) {
3454
- const { beforeUpload } = props;
3455
- let transformedFile = file;
3456
- if (beforeUpload) {
3457
- try {
3458
- transformedFile = await beforeUpload(file, fileList);
3459
- } catch (e) {
3460
- console.warn("max-ajax-uploader", e);
3461
- transformedFile = false;
3462
- }
3463
- if (transformedFile === false) {
3464
- return {
3465
- origin: file
3466
- };
3467
- }
3468
- }
3469
- return {
3470
- origin: file
3471
- };
3472
- }
3473
- function uploadFiles(files) {
3474
- const originFiles = [...files];
3475
- const postFiles = originFiles.map((file) => {
3476
- return processFile(file, originFiles);
3477
- });
3478
- Promise.all(postFiles).then((fileList) => {
3479
- if (fileList.length === 0) {
3480
- return;
3481
- }
3482
- const file = fileList[0].origin;
3483
- const po = new FormData();
3484
- po.append("file", file);
3485
- emit("change", { file: fileList[0].origin, files: fileList, param: po });
3486
- });
3487
- }
3488
- function onFileChange(e) {
3489
- const { accept } = props;
3490
- const { files } = e.target;
3491
- const acceptedFiles = [...files].filter((file) => attrAccept$1(file, accept));
3492
- uploadFiles(acceptedFiles);
3493
- reset();
3494
- }
3495
- const buttonStyle = computed(() => {
3496
- return {
3497
- display: "none"
3498
- };
3499
- });
3500
- return (_ctx, _cache) => {
3501
- return openBlock(), createBlock(unref(XBasicButton), mergeProps({
3502
- icon: "ri:import-line",
3503
- type: "primary"
3504
- }, unref(attrs), { onClick: onClickHandler }), {
3505
- default: withCtx(() => [
3506
- (openBlock(), createElementBlock("input", {
3507
- key: uid2.value,
3508
- ref_key: "fileInputRef",
3509
- ref: fileInputRef,
3510
- type: "file",
3511
- class: "hidden",
3512
- multiple: __props.multiple,
3513
- name: __props.name,
3514
- accept: __props.accept,
3515
- style: normalizeStyle(buttonStyle.value),
3516
- onChange: onFileChange
3517
- }, null, 44, _hoisted_1$c)),
3518
- renderSlot(_ctx.$slots, "default", {}, () => [
3519
- createTextVNode(toDisplayString(unref(t)("max.basic.import")), 1)
3520
- ])
3521
- ]),
3522
- _: 3
3523
- }, 16);
3524
- };
3525
- }
3526
- });
3527
- const _sfc_main$H = /* @__PURE__ */ defineComponent({
3528
- __name: "BasicButtonPrint",
3529
- emits: ["click"],
3530
- setup(__props, { emit: __emit }) {
3531
- const emit = __emit;
3532
- const { t } = useLocale();
3533
- const attrs = useAttrs();
3534
- function onClickHandler() {
3535
- emit("click");
3536
- }
3537
- return (_ctx, _cache) => {
3538
- return openBlock(), createBlock(unref(XBasicButton), mergeProps({
3539
- icon: "ri-printer-line",
3540
- type: "primary"
3541
- }, unref(attrs), { onClick: onClickHandler }), {
3542
- default: withCtx(() => [
3543
- renderSlot(_ctx.$slots, "default", {}, () => [
3544
- createTextVNode(toDisplayString(unref(t)("max.basic.print")), 1)
3545
- ])
3546
- ]),
3547
- _: 3
3548
- }, 16);
3549
- };
3550
- }
3551
- });
3552
- const XBasicButtonCreate = withInstall(_sfc_main$O);
3553
- const XBasicButtonEdit = withInstall(_sfc_main$L);
3554
- const XBasicButtonDelete = withInstall(_sfc_main$N);
3555
- const XBasicButtonExport = withInstall(_sfc_main$K);
3556
- const XBasicButtonImport = withInstall(_sfc_main$I);
3557
- const XBasicButtonPrint = withInstall(_sfc_main$H);
3558
- const XBasicButtonDrop = withInstall(_sfc_main$M);
3559
- const XBasicButtonExportDrop = withInstall(_sfc_main$J);
3560
- !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
3561
- !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
3562
- const hasOwnProperty = Object.prototype.hasOwnProperty;
3563
- const hasOwn = (val, key2) => hasOwnProperty.call(val, key2);
3564
- const basicOverlayProps = {
3565
- mask: {
3566
- type: Boolean,
3567
- default: true
3568
- },
3569
- customMaskEvent: Boolean,
3570
- overlayClass: {
3571
- type: [String, Array, Object]
3572
- },
3573
- zIndex: {
3574
- type: [String, Number]
3575
- }
3576
- };
3577
- const BasicOverlay = /* @__PURE__ */ defineComponent({
3578
- name: "XBasicOverlay",
3579
- props: basicOverlayProps,
3580
- emits: ["click"],
3581
- setup(props, {
3582
- emit,
3583
- slots
3584
- }) {
3585
- const {
3586
- b
3587
- } = useNamespace("basic-overlay");
3588
- const onMaskClick = (e) => {
3589
- emit("click", e);
3590
- };
3591
- const {
3592
- onClick,
3593
- onMousedown,
3594
- onMouseup
3595
- } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
3596
- return () => {
3597
- var _a, _b;
3598
- return props.mask ? createVNode("div", {
3599
- "class": [b(), props.overlayClass],
3600
- "style": {
3601
- zIndex: props.zIndex
3602
- },
3603
- "onClick": onClick,
3604
- "onMousedown": onMousedown,
3605
- "onMouseup": onMouseup
3606
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]) : createVNode("div", {
3607
- "class": props.overlayClass,
3608
- "style": {
3609
- zIndex: props.zIndex,
3610
- position: "fixed",
3611
- top: "0px",
3612
- right: "0px",
3613
- bottom: "0px",
3614
- left: "0px"
3615
- }
3616
- }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
3617
- };
3618
- }
3619
- });
3620
- const XBasicOverlay = withInstall(BasicOverlay);
3621
- const configProviderKey = Symbol("config-provider");
3622
- const globalConfig = ref();
3623
- function useGlobalConfig(key2, defaultValue = void 0) {
3624
- const config = getCurrentInstance() ? inject(configProviderKey, globalConfig) : globalConfig;
3625
- if (key2) {
3626
- return computed(() => {
3627
- var _a, _b;
3628
- return (_b = (_a = config.value) == null ? void 0 : _a[key2]) != null ? _b : defaultValue;
3629
- });
3630
- }
3631
- return config;
3632
- }
3633
- const provideGlobalConfig = (config, app, global = false) => {
3634
- var _a;
3635
- const inSetup = Boolean(getCurrentInstance());
3636
- const oldConfig = inSetup ? useGlobalConfig() : void 0;
3637
- const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? provide : void 0;
3638
- if (!provideFn) return;
3639
- const context = computed(() => {
3640
- const cfg = unref(config);
3641
- if (!(oldConfig == null ? void 0 : oldConfig.value)) return cfg;
3642
- return merge(oldConfig.value, cfg);
3643
- });
3644
- provideFn(configProviderKey, context);
3645
- provideFn(
3646
- localeContextKey,
3647
- computed(() => context.value.locale)
3648
- );
3649
- provideFn(
3650
- namespaceContextKey,
3651
- computed(() => context.value.namespace)
3652
- );
3653
- provideFn(
3654
- zIndexContextKey,
3655
- computed(() => context.value.zIndex)
3656
- );
3657
- provideFn(
3658
- themeOverridesContextKey,
3659
- computed(() => context.value.themeOverrides)
3660
- );
3661
- provideFn(
3662
- iconLocalPrefixContextKey,
3663
- computed(() => context.value.iconLocalPrefix)
3664
- );
3665
- if (global || !globalConfig.value) {
3666
- globalConfig.value = context.value;
3667
- }
3668
- return context;
3669
- };
3670
- const useConfigProvider = (block) => {
3671
- const config = useGlobalConfig();
3672
- const ns = useNamespace(
3673
- block,
3674
- computed(() => {
3675
- var _a;
3676
- return ((_a = config.value) == null ? void 0 : _a.namespace) || DEFAULT_NAMESPACE;
3677
- })
3678
- );
3679
- const locale = useLocale(computed(() => {
3680
- var _a;
3681
- return (_a = config.value) == null ? void 0 : _a.locale;
3682
- }));
3683
- const zIndex2 = useZIndex(computed(() => {
3684
- var _a;
3685
- return ((_a = config.value) == null ? void 0 : _a.zIndex) || DEFAULT_INITIAL_Z_INDEX;
3686
- }));
3687
- const themeOverrides = useThemeOverrides(computed(() => {
3688
- var _a;
3689
- return (_a = config.value) == null ? void 0 : _a.themeOverrides;
3690
- }));
3691
- provideGlobalConfig(computed(() => unref(config) || {}));
3692
- return {
3693
- ns,
3694
- locale,
3695
- zIndex: zIndex2,
3696
- themeOverrides
3697
- };
3698
- };
3699
- const configProviderProps = {
3700
- /** 全局 z-index 值 */
3701
- zIndex: Number,
3702
- /** 全局语言 */
3703
- locale: {
3704
- type: Object
3705
- },
3706
- /** 全局命名空间 */
3707
- namespace: {
3708
- type: String,
3709
- default: DEFAULT_NAMESPACE
3710
- },
3711
- /** 本地全局图标前缀 */
3712
- iconLocalPrefix: {
3713
- type: String,
3714
- default: DEFAULT_ICON_LOCAL_PREFIX
3715
- },
3716
- /** 全局主题覆盖 */
3717
- themeOverrides: {
3718
- type: Object
3719
- }
3720
- };
3721
- const ConfigProvider = /* @__PURE__ */ defineComponent({
3722
- name: "ConfigProvider",
3723
- props: configProviderProps,
3724
- setup(props, {
3725
- slots
3726
- }) {
3727
- const config = provideGlobalConfig(props);
3728
- return () => {
3729
- var _a;
3730
- return createVNode("div", {
3731
- "class": "imax-config-provider",
3732
- "data-config-provider": config
3733
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
3734
- };
3735
- }
3736
- });
3737
- const XConfigProvider = withInstall(ConfigProvider);
3738
- const basicMessageBoxProps = {
3739
- modal: {
3740
- type: Boolean,
3741
- default: true
3345
+ const XConfigProvider = withInstall(ConfigProvider);
3346
+ const basicMessageBoxProps = {
3347
+ modal: {
3348
+ type: Boolean,
3349
+ default: true
3742
3350
  },
3743
3351
  lockScroll: {
3744
3352
  type: Boolean,
@@ -3777,7 +3385,7 @@ const basicMessageBoxProps = {
3777
3385
  default: ""
3778
3386
  }
3779
3387
  };
3780
- const _sfc_main$G = defineComponent({
3388
+ const _sfc_main$Q = defineComponent({
3781
3389
  components: {
3782
3390
  NButton,
3783
3391
  NInput,
@@ -3903,414 +3511,889 @@ const _sfc_main$G = defineComponent({
3903
3511
  handleClose();
3904
3512
  }
3905
3513
  };
3906
- watch(
3907
- () => state.inputValue,
3908
- async (val) => {
3909
- await nextTick();
3910
- if (props.boxType === "prompt" && val !== null) {
3911
- validate();
3912
- }
3913
- },
3914
- { immediate: true }
3915
- );
3916
- watch(
3917
- () => visible.value,
3918
- (val) => {
3919
- var _a, _b;
3920
- if (val) {
3921
- if (props.boxType !== "prompt") {
3922
- if (state.autofocus) {
3923
- focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
3924
- } else {
3925
- focusStartRef.value = rootRef.value;
3926
- }
3927
- }
3928
- state.zIndex = nextZIndex();
3929
- }
3930
- if (props.boxType !== "prompt") return;
3931
- if (val) {
3932
- nextTick().then(() => {
3933
- var _a2;
3934
- if (inputRef.value && inputRef.value.$el) {
3935
- if (state.autofocus) {
3936
- focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
3937
- } else {
3938
- focusStartRef.value = rootRef.value;
3939
- }
3940
- }
3941
- });
3942
- } else {
3943
- state.editorErrorMessage = "";
3944
- state.validateError = false;
3514
+ watch(
3515
+ () => state.inputValue,
3516
+ async (val) => {
3517
+ await nextTick();
3518
+ if (props.boxType === "prompt" && val !== null) {
3519
+ validate();
3520
+ }
3521
+ },
3522
+ { immediate: true }
3523
+ );
3524
+ watch(
3525
+ () => visible.value,
3526
+ (val) => {
3527
+ var _a, _b;
3528
+ if (val) {
3529
+ if (props.boxType !== "prompt") {
3530
+ if (state.autofocus) {
3531
+ focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
3532
+ } else {
3533
+ focusStartRef.value = rootRef.value;
3534
+ }
3535
+ }
3536
+ state.zIndex = nextZIndex();
3537
+ }
3538
+ if (props.boxType !== "prompt") return;
3539
+ if (val) {
3540
+ nextTick().then(() => {
3541
+ var _a2;
3542
+ if (inputRef.value && inputRef.value.$el) {
3543
+ if (state.autofocus) {
3544
+ focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
3545
+ } else {
3546
+ focusStartRef.value = rootRef.value;
3547
+ }
3548
+ }
3549
+ });
3550
+ } else {
3551
+ state.editorErrorMessage = "";
3552
+ state.validateError = false;
3553
+ }
3554
+ }
3555
+ );
3556
+ const draggable = computed(() => props.draggable);
3557
+ const overflow = computed(() => props.overflow);
3558
+ useDraggable(rootRef, headerRef, draggable, overflow);
3559
+ onMounted(async () => {
3560
+ await nextTick();
3561
+ if (props.closeOnHashChange) {
3562
+ window.addEventListener("hashchange", doClose);
3563
+ }
3564
+ });
3565
+ onBeforeUnmount(() => {
3566
+ if (props.closeOnHashChange) {
3567
+ window.removeEventListener("hashchange", doClose);
3568
+ }
3569
+ });
3570
+ function doClose() {
3571
+ if (!visible.value) return;
3572
+ visible.value = false;
3573
+ nextTick().then(() => {
3574
+ if (state.action) emit("action", state.action);
3575
+ });
3576
+ }
3577
+ const handleWrapperClick = () => {
3578
+ if (props.closeOnClickModal) {
3579
+ handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
3580
+ }
3581
+ };
3582
+ const overlayEvent = useSameTarget(handleWrapperClick);
3583
+ const handleInputEnter = (ev) => {
3584
+ if (state.inputType !== "textarea") {
3585
+ ev.preventDefault();
3586
+ return handleAction("confirm");
3587
+ }
3588
+ };
3589
+ if (props.lockScroll) {
3590
+ useLockscreen(visible);
3591
+ }
3592
+ return {
3593
+ ...toRefs(state),
3594
+ ns,
3595
+ t,
3596
+ overlayEvent,
3597
+ visible,
3598
+ hasMessage,
3599
+ typeClass,
3600
+ contentId,
3601
+ inputId,
3602
+ iconComponent,
3603
+ confirmButtonClasses,
3604
+ themeOverridesRef,
3605
+ rootRef,
3606
+ focusStartRef,
3607
+ headerRef,
3608
+ inputRef,
3609
+ confirmRef,
3610
+ doClose,
3611
+ // for outside usage
3612
+ handleClose,
3613
+ // for out side usage
3614
+ onCloseRequested,
3615
+ handleWrapperClick,
3616
+ handleInputEnter,
3617
+ handleAction
3618
+ };
3619
+ }
3620
+ });
3621
+ const _export_sfc = (sfc, props) => {
3622
+ const target = sfc.__vccOpts || sfc;
3623
+ for (const [key2, val] of props) {
3624
+ target[key2] = val;
3625
+ }
3626
+ return target;
3627
+ };
3628
+ const _hoisted_1$c = ["aria-label", "aria-describedby"];
3629
+ const _hoisted_2$4 = ["id"];
3630
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
3631
+ const _component_BasicSvgIcon = resolveComponent("BasicSvgIcon");
3632
+ const _component_NInput = resolveComponent("NInput");
3633
+ const _component_NButton = resolveComponent("NButton");
3634
+ const _component_BasicOverlay = resolveComponent("BasicOverlay");
3635
+ return openBlock(), createBlock(Transition, {
3636
+ name: "fade-in-linear",
3637
+ onAfterLeave: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("vanish"))
3638
+ }, {
3639
+ default: withCtx(() => [
3640
+ withDirectives(createVNode(_component_BasicOverlay, {
3641
+ "z-index": _ctx.zIndex,
3642
+ "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
3643
+ mask: _ctx.modal
3644
+ }, {
3645
+ default: withCtx(() => [
3646
+ createElementVNode("div", {
3647
+ role: "dialog",
3648
+ "aria-label": _ctx.title,
3649
+ "aria-modal": "true",
3650
+ "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
3651
+ class: normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
3652
+ onClick: _cache[8] || (_cache[8] = (...args) => _ctx.overlayEvent.onClick && _ctx.overlayEvent.onClick(...args)),
3653
+ onMousedown: _cache[9] || (_cache[9] = (...args) => _ctx.overlayEvent.onMousedown && _ctx.overlayEvent.onMousedown(...args)),
3654
+ onMouseup: _cache[10] || (_cache[10] = (...args) => _ctx.overlayEvent.onMouseup && _ctx.overlayEvent.onMouseup(...args))
3655
+ }, [
3656
+ createElementVNode("div", {
3657
+ ref: "rootRef",
3658
+ class: normalizeClass([_ctx.ns.b(), _ctx.customClass, _ctx.ns.is("draggable", _ctx.draggable), { [_ctx.ns.m("center")]: _ctx.center }]),
3659
+ style: normalizeStyle(_ctx.customStyle),
3660
+ tabindex: "-1",
3661
+ onClick: _cache[7] || (_cache[7] = withModifiers(() => {
3662
+ }, ["stop"]))
3663
+ }, [
3664
+ _ctx.title !== null && _ctx.title !== void 0 ? (openBlock(), createElementBlock("div", {
3665
+ key: 0,
3666
+ ref: "headerRef",
3667
+ class: normalizeClass([_ctx.ns.e("header"), { "show-close": _ctx.showClose }])
3668
+ }, [
3669
+ createElementVNode("div", {
3670
+ class: normalizeClass(_ctx.ns.e("title"))
3671
+ }, [
3672
+ _ctx.iconComponent && _ctx.center ? (openBlock(), createBlock(_component_BasicSvgIcon, {
3673
+ key: 0,
3674
+ icon: _ctx.iconComponent,
3675
+ class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
3676
+ }, null, 8, ["icon", "class"])) : createCommentVNode("", true),
3677
+ createTextVNode(" " + toDisplayString(_ctx.title), 1)
3678
+ ], 2),
3679
+ _ctx.showClose ? (openBlock(), createElementBlock("button", {
3680
+ key: 0,
3681
+ type: "button",
3682
+ class: normalizeClass(_ctx.ns.e("headerbtn")),
3683
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel")),
3684
+ onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"]))
3685
+ }, [
3686
+ createElementVNode("span", {
3687
+ class: normalizeClass(_ctx.ns.e("close"))
3688
+ }, [
3689
+ createVNode(_component_BasicSvgIcon, { icon: "ri:close-line" })
3690
+ ], 2)
3691
+ ], 34)) : createCommentVNode("", true)
3692
+ ], 2)) : createCommentVNode("", true),
3693
+ createElementVNode("div", {
3694
+ id: _ctx.contentId,
3695
+ class: normalizeClass(_ctx.ns.e("content"))
3696
+ }, [
3697
+ createElementVNode("div", {
3698
+ class: normalizeClass(_ctx.ns.e("container"))
3699
+ }, [
3700
+ _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (openBlock(), createBlock(_component_BasicSvgIcon, {
3701
+ key: 0,
3702
+ icon: _ctx.iconComponent,
3703
+ class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
3704
+ }, null, 8, ["icon", "class"])) : createCommentVNode("", true),
3705
+ _ctx.hasMessage ? (openBlock(), createElementBlock("div", {
3706
+ key: 1,
3707
+ class: normalizeClass(_ctx.ns.e("message"))
3708
+ }, [
3709
+ renderSlot(_ctx.$slots, "default", {}, () => [
3710
+ !_ctx.dangerouslyUseHTMLString ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
3711
+ key: 0,
3712
+ for: _ctx.showInput ? _ctx.inputId : void 0
3713
+ }, {
3714
+ default: withCtx(() => [
3715
+ createTextVNode(toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1)
3716
+ ]),
3717
+ _: 1
3718
+ }, 8, ["for"])) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
3719
+ key: 1,
3720
+ for: _ctx.showInput ? _ctx.inputId : void 0,
3721
+ innerHTML: _ctx.message
3722
+ }, null, 8, ["for", "innerHTML"]))
3723
+ ])
3724
+ ], 2)) : createCommentVNode("", true)
3725
+ ], 2),
3726
+ withDirectives(createElementVNode("div", {
3727
+ class: normalizeClass(_ctx.ns.e("input"))
3728
+ }, [
3729
+ createVNode(_component_NInput, {
3730
+ id: _ctx.inputId,
3731
+ ref: "inputRef",
3732
+ value: _ctx.inputValue,
3733
+ "onUpdate:value": _cache[2] || (_cache[2] = ($event) => _ctx.inputValue = $event),
3734
+ "theme-overrides": _ctx.themeOverridesRef,
3735
+ type: _ctx.inputType,
3736
+ placeholder: _ctx.inputPlaceholder,
3737
+ "aria-invalid": _ctx.validateError,
3738
+ class: normalizeClass({ invalid: _ctx.validateError }),
3739
+ onKeydown: withKeys(_ctx.handleInputEnter, ["enter"])
3740
+ }, null, 8, ["id", "value", "theme-overrides", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
3741
+ createElementVNode("div", {
3742
+ class: normalizeClass(_ctx.ns.e("errormsg")),
3743
+ style: normalizeStyle({ visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden" })
3744
+ }, toDisplayString(_ctx.editorErrorMessage), 7)
3745
+ ], 2), [
3746
+ [vShow, _ctx.showInput]
3747
+ ])
3748
+ ], 10, _hoisted_2$4),
3749
+ createElementVNode("div", {
3750
+ class: normalizeClass(_ctx.ns.e("btns"))
3751
+ }, [
3752
+ _ctx.showCancelButton ? (openBlock(), createBlock(_component_NButton, {
3753
+ key: 0,
3754
+ "theme-overrides": _ctx.themeOverridesRef,
3755
+ loading: _ctx.cancelButtonLoading,
3756
+ class: normalizeClass([_ctx.cancelButtonClass]),
3757
+ round: _ctx.roundButton,
3758
+ onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleAction("cancel")),
3759
+ onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"]))
3760
+ }, {
3761
+ default: withCtx(() => [
3762
+ createTextVNode(toDisplayString(_ctx.cancelButtonText || _ctx.t("max.button.cancel")), 1)
3763
+ ]),
3764
+ _: 1
3765
+ }, 8, ["theme-overrides", "loading", "class", "round"])) : createCommentVNode("", true),
3766
+ withDirectives(createVNode(_component_NButton, {
3767
+ ref: "confirmRef",
3768
+ "theme-overrides": _ctx.themeOverridesRef,
3769
+ type: "primary",
3770
+ loading: _ctx.confirmButtonLoading,
3771
+ class: normalizeClass([_ctx.confirmButtonClasses]),
3772
+ round: _ctx.roundButton,
3773
+ disabled: _ctx.confirmButtonDisabled,
3774
+ onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleAction("confirm")),
3775
+ onKeydown: _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"]))
3776
+ }, {
3777
+ default: withCtx(() => [
3778
+ createTextVNode(toDisplayString(_ctx.confirmButtonText || _ctx.t("max.button.confirm")), 1)
3779
+ ]),
3780
+ _: 1
3781
+ }, 8, ["theme-overrides", "loading", "class", "round", "disabled"]), [
3782
+ [vShow, _ctx.showConfirmButton]
3783
+ ])
3784
+ ], 2)
3785
+ ], 6)
3786
+ ], 42, _hoisted_1$c)
3787
+ ]),
3788
+ _: 3
3789
+ }, 8, ["z-index", "overlay-class", "mask"]), [
3790
+ [vShow, _ctx.visible]
3791
+ ])
3792
+ ]),
3793
+ _: 3
3794
+ });
3795
+ }
3796
+ const MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["render", _sfc_render$2]]);
3797
+ const messageInstance = /* @__PURE__ */ new Map();
3798
+ const getAppendToElement = (props) => {
3799
+ let appendTo = document.body;
3800
+ if (props.appendTo) {
3801
+ if (isString(props.appendTo)) {
3802
+ appendTo = document.querySelector(props.appendTo);
3803
+ }
3804
+ if (isElement(props.appendTo)) {
3805
+ appendTo = props.appendTo;
3806
+ }
3807
+ if (!isElement(appendTo)) {
3808
+ console.warn("the appendTo option is not an HTMLElement. Falling back to document.body.");
3809
+ appendTo = document.body;
3810
+ }
3811
+ }
3812
+ return appendTo;
3813
+ };
3814
+ const initInstance = (props, container, appContext = null) => {
3815
+ const vnode = createVNode(MessageBoxConstructor, props, isFunction(props.message) || isVNode(props.message) ? { default: isFunction(props.message) ? props.message : () => props.message } : null);
3816
+ vnode.appContext = appContext;
3817
+ render$1(vnode, container);
3818
+ getAppendToElement(props).appendChild(container.firstElementChild);
3819
+ return vnode.component;
3820
+ };
3821
+ const genContainer = () => {
3822
+ return document.createElement("div");
3823
+ };
3824
+ const showMessage = (options, appContext) => {
3825
+ const container = genContainer();
3826
+ options.onVanish = () => {
3827
+ render$1(null, container);
3828
+ messageInstance.delete(vm);
3829
+ };
3830
+ options.onAction = (action) => {
3831
+ const currentMsg = messageInstance.get(vm);
3832
+ let resolve;
3833
+ if (options.showInput) {
3834
+ resolve = { value: vm.inputValue, action };
3835
+ } else {
3836
+ resolve = action;
3837
+ }
3838
+ if (options.callback) {
3839
+ options.callback(resolve, instance.proxy);
3840
+ } else if (action === "cancel" || action === "close") {
3841
+ if (options.distinguishCancelAndClose && action !== "cancel") {
3842
+ currentMsg.reject("close");
3843
+ } else {
3844
+ currentMsg.reject("cancel");
3845
+ }
3846
+ } else {
3847
+ currentMsg.resolve(resolve);
3848
+ }
3849
+ };
3850
+ const instance = initInstance(options, container, appContext);
3851
+ const vm = instance.proxy;
3852
+ for (const prop in options) {
3853
+ if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
3854
+ vm[prop] = options[prop];
3855
+ }
3856
+ }
3857
+ vm.visible = true;
3858
+ return vm;
3859
+ };
3860
+ function MessageBox(options, appContext = null) {
3861
+ if (!isClient$1) return Promise.reject();
3862
+ let callback;
3863
+ if (isString(options) || isVNode(options)) {
3864
+ options = {
3865
+ message: options
3866
+ };
3867
+ } else {
3868
+ callback = options.callback;
3869
+ }
3870
+ return new Promise((resolve, reject) => {
3871
+ const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
3872
+ messageInstance.set(vm, {
3873
+ options,
3874
+ callback,
3875
+ resolve,
3876
+ reject
3877
+ });
3878
+ });
3879
+ }
3880
+ const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
3881
+ const MESSAGE_BOX_DEFAULT_OPTS = {
3882
+ alert: { closeOnPressEscape: false, closeOnClickModal: false },
3883
+ confirm: { showCancelButton: true },
3884
+ prompt: { showCancelButton: true, showInput: true }
3885
+ };
3886
+ MESSAGE_BOX_VARIANTS.forEach((boxType) => {
3887
+ MessageBox[boxType] = messageBoxFactory(boxType);
3888
+ });
3889
+ function messageBoxFactory(boxType) {
3890
+ return (message, title, options, appContext) => {
3891
+ let titleOrOpts = "";
3892
+ if (isObject$1(title)) {
3893
+ options = title;
3894
+ titleOrOpts = "";
3895
+ } else if (isUndefined(title)) {
3896
+ titleOrOpts = "";
3897
+ } else {
3898
+ titleOrOpts = title;
3899
+ }
3900
+ return MessageBox(
3901
+ {
3902
+ title: titleOrOpts,
3903
+ message,
3904
+ type: "",
3905
+ ...MESSAGE_BOX_DEFAULT_OPTS[boxType],
3906
+ ...options,
3907
+ boxType
3908
+ },
3909
+ appContext
3910
+ );
3911
+ };
3912
+ }
3913
+ MessageBox.close = () => {
3914
+ messageInstance.forEach((_, vm) => {
3915
+ vm.doClose();
3916
+ });
3917
+ messageInstance.clear();
3918
+ };
3919
+ MessageBox._context = null;
3920
+ const $MessageBox = MessageBox;
3921
+ const XBasicMessageBox = $MessageBox;
3922
+ const _sfc_main$P = /* @__PURE__ */ defineComponent({
3923
+ __name: "BasicActionFooter",
3924
+ props: {
3925
+ showDeleteButton: { type: Boolean, default: false },
3926
+ showCancelButton: { type: Boolean, default: true },
3927
+ showConfirmButton: { type: Boolean, default: true },
3928
+ deleteText: { default: "删除" },
3929
+ confirmText: { default: "确定" },
3930
+ cancelText: { default: "取消" },
3931
+ loading: { type: Boolean, default: false }
3932
+ },
3933
+ emits: ["delete", "cancel", "confirm"],
3934
+ setup(__props, { emit: __emit }) {
3935
+ const props = __props;
3936
+ const emit = __emit;
3937
+ const { b, e } = useNamespace("basic-action-footer");
3938
+ const { t } = useLocale();
3939
+ function onDeleteClickHandler() {
3940
+ XBasicMessageBox.confirm(t("max.notification.delete"), t("max.basic.warning")).then(() => {
3941
+ emit("delete");
3942
+ }).catch(() => {
3943
+ });
3944
+ }
3945
+ function onCancelClickHandler() {
3946
+ emit("cancel");
3947
+ }
3948
+ function onConfirmClickHandler() {
3949
+ emit("confirm");
3950
+ }
3951
+ return (_ctx, _cache) => {
3952
+ return openBlock(), createElementBlock("span", {
3953
+ class: normalizeClass(unref(b)())
3954
+ }, [
3955
+ createElementVNode("span", {
3956
+ class: normalizeClass(unref(e)("left-buttons"))
3957
+ }, [
3958
+ renderSlot(_ctx.$slots, "left-left"),
3959
+ props.showDeleteButton ? (openBlock(), createBlock(unref(XBasicButton), {
3960
+ key: 0,
3961
+ type: "error",
3962
+ icon: "ri:delete-bin-line",
3963
+ loading: props.loading,
3964
+ onClick: onDeleteClickHandler
3965
+ }, {
3966
+ default: withCtx(() => [
3967
+ createTextVNode(toDisplayString(props.deleteText), 1)
3968
+ ]),
3969
+ _: 1
3970
+ }, 8, ["loading"])) : createCommentVNode("", true),
3971
+ renderSlot(_ctx.$slots, "left-right")
3972
+ ], 2),
3973
+ createElementVNode("span", {
3974
+ class: normalizeClass(unref(e)("right-buttons"))
3975
+ }, [
3976
+ renderSlot(_ctx.$slots, "right-left"),
3977
+ props.showCancelButton ? (openBlock(), createBlock(unref(XBasicButton), {
3978
+ key: 0,
3979
+ bordered: "",
3980
+ onClick: onCancelClickHandler
3981
+ }, {
3982
+ default: withCtx(() => [
3983
+ createTextVNode(toDisplayString(props.cancelText), 1)
3984
+ ]),
3985
+ _: 1
3986
+ })) : createCommentVNode("", true),
3987
+ props.showConfirmButton ? (openBlock(), createBlock(unref(XBasicButton), {
3988
+ key: 1,
3989
+ type: "primary",
3990
+ loading: props.loading,
3991
+ onClick: onConfirmClickHandler
3992
+ }, {
3993
+ default: withCtx(() => [
3994
+ createTextVNode(toDisplayString(props.confirmText), 1)
3995
+ ]),
3996
+ _: 1
3997
+ }, 8, ["loading"])) : createCommentVNode("", true),
3998
+ renderSlot(_ctx.$slots, "right-right")
3999
+ ], 2)
4000
+ ], 2);
4001
+ };
4002
+ }
4003
+ });
4004
+ const XBasicActionFooter = withInstall(_sfc_main$P);
4005
+ const _sfc_main$O = /* @__PURE__ */ defineComponent({
4006
+ __name: "BasicArrow",
4007
+ props: {
4008
+ expand: { type: Boolean },
4009
+ inset: { type: Boolean }
4010
+ },
4011
+ setup(__props) {
4012
+ const props = __props;
4013
+ const { b } = useNamespace("basic-arrow");
4014
+ const getClass = computed(() => {
4015
+ const { expand, inset } = props;
4016
+ const prefixCls = b();
4017
+ return [
4018
+ prefixCls,
4019
+ {
4020
+ [`${prefixCls}--active`]: expand,
4021
+ inset
3945
4022
  }
3946
- }
3947
- );
3948
- const draggable = computed(() => props.draggable);
3949
- const overflow = computed(() => props.overflow);
3950
- useDraggable(rootRef, headerRef, draggable, overflow);
3951
- onMounted(async () => {
3952
- await nextTick();
3953
- if (props.closeOnHashChange) {
3954
- window.addEventListener("hashchange", doClose);
3955
- }
4023
+ ];
3956
4024
  });
3957
- onBeforeUnmount(() => {
3958
- if (props.closeOnHashChange) {
3959
- window.removeEventListener("hashchange", doClose);
3960
- }
4025
+ const getIcon = computed(() => {
4026
+ return props.expand ? "ri:arrow-up-s-line" : "ri:arrow-down-s-line";
3961
4027
  });
3962
- function doClose() {
3963
- if (!visible.value) return;
3964
- visible.value = false;
3965
- nextTick().then(() => {
3966
- if (state.action) emit("action", state.action);
3967
- });
4028
+ return (_ctx, _cache) => {
4029
+ return openBlock(), createElementBlock("span", {
4030
+ class: normalizeClass(getClass.value)
4031
+ }, [
4032
+ createVNode(unref(XBasicSvgIcon), { icon: getIcon.value }, null, 8, ["icon"])
4033
+ ], 2);
4034
+ };
4035
+ }
4036
+ });
4037
+ const XBasicArrow = withInstall(_sfc_main$O);
4038
+ const _sfc_main$N = /* @__PURE__ */ defineComponent({
4039
+ __name: "BasicButtonCreate",
4040
+ emits: ["click"],
4041
+ setup(__props, { emit: __emit }) {
4042
+ const emit = __emit;
4043
+ const { t } = useLocale();
4044
+ const attrs = useAttrs();
4045
+ function onClickHandler() {
4046
+ emit("click");
3968
4047
  }
3969
- const handleWrapperClick = () => {
3970
- if (props.closeOnClickModal) {
3971
- handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
3972
- }
4048
+ return (_ctx, _cache) => {
4049
+ return openBlock(), createBlock(unref(XBasicButton), mergeProps({
4050
+ icon: "ri-add-fill",
4051
+ type: "primary"
4052
+ }, unref(attrs), { onClick: onClickHandler }), {
4053
+ default: withCtx(() => [
4054
+ renderSlot(_ctx.$slots, "default", {}, () => [
4055
+ createTextVNode(toDisplayString(unref(t)("max.basic.add")), 1)
4056
+ ])
4057
+ ]),
4058
+ _: 3
4059
+ }, 16);
3973
4060
  };
3974
- const overlayEvent = useSameTarget(handleWrapperClick);
3975
- const handleInputEnter = (ev) => {
3976
- if (state.inputType !== "textarea") {
3977
- ev.preventDefault();
3978
- return handleAction("confirm");
3979
- }
4061
+ }
4062
+ });
4063
+ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4064
+ __name: "BasicButtonDelete",
4065
+ emits: ["click"],
4066
+ setup(__props, { emit: __emit }) {
4067
+ const emit = __emit;
4068
+ const { t } = useLocale();
4069
+ const attrs = useAttrs();
4070
+ function onClickHandler() {
4071
+ emit("click");
4072
+ }
4073
+ return (_ctx, _cache) => {
4074
+ return openBlock(), createBlock(unref(XBasicButton), mergeProps({
4075
+ type: "error",
4076
+ icon: "ri-delete-bin-5-fill"
4077
+ }, unref(attrs), { onClick: onClickHandler }), {
4078
+ default: withCtx(() => [
4079
+ renderSlot(_ctx.$slots, "default", {}, () => [
4080
+ createTextVNode(toDisplayString(unref(t)("max.basic.delete")), 1)
4081
+ ])
4082
+ ]),
4083
+ _: 3
4084
+ }, 16);
3980
4085
  };
3981
- if (props.lockScroll) {
3982
- useLockscreen(visible);
4086
+ }
4087
+ });
4088
+ const _sfc_main$L = /* @__PURE__ */ defineComponent({
4089
+ __name: "BasicButtonDrop",
4090
+ props: {
4091
+ disabled: { type: Boolean },
4092
+ icon: {},
4093
+ options: { default: () => [] }
4094
+ },
4095
+ emits: ["click"],
4096
+ setup(__props, { emit: __emit }) {
4097
+ const props = __props;
4098
+ const emit = __emit;
4099
+ const { b, e } = useNamespace("basic-button-drop");
4100
+ const cOptions = computed(() => {
4101
+ var _a;
4102
+ return ((_a = props.options) != null ? _a : []).map((option) => {
4103
+ return option;
4104
+ });
4105
+ });
4106
+ function handleSelect(key2) {
4107
+ emit("click", key2);
3983
4108
  }
3984
- return {
3985
- ...toRefs(state),
3986
- ns,
3987
- t,
3988
- overlayEvent,
3989
- visible,
3990
- hasMessage,
3991
- typeClass,
3992
- contentId,
3993
- inputId,
3994
- iconComponent,
3995
- confirmButtonClasses,
3996
- themeOverridesRef,
3997
- rootRef,
3998
- focusStartRef,
3999
- headerRef,
4000
- inputRef,
4001
- confirmRef,
4002
- doClose,
4003
- // for outside usage
4004
- handleClose,
4005
- // for out side usage
4006
- onCloseRequested,
4007
- handleWrapperClick,
4008
- handleInputEnter,
4009
- handleAction
4109
+ function handleClick() {
4110
+ if (cOptions.value.length === 0) {
4111
+ return;
4112
+ }
4113
+ const defaultKey = cOptions.value[0].key;
4114
+ emit("click", defaultKey);
4115
+ }
4116
+ return (_ctx, _cache) => {
4117
+ return openBlock(), createBlock(unref(NButtonGroup), {
4118
+ class: normalizeClass(unref(b)())
4119
+ }, {
4120
+ default: withCtx(() => [
4121
+ createVNode(unref(XBasicButton), {
4122
+ type: "primary",
4123
+ icon: __props.icon,
4124
+ disabled: __props.disabled,
4125
+ class: normalizeClass(unref(e)("trigger-button")),
4126
+ onClick: handleClick
4127
+ }, {
4128
+ default: withCtx(() => [
4129
+ renderSlot(_ctx.$slots, "default")
4130
+ ]),
4131
+ _: 3
4132
+ }, 8, ["icon", "disabled", "class"]),
4133
+ createVNode(unref(NDropdown), {
4134
+ trigger: "click",
4135
+ options: cOptions.value,
4136
+ onSelect: handleSelect
4137
+ }, {
4138
+ default: withCtx(() => [
4139
+ createVNode(unref(XBasicButton), {
4140
+ type: "primary",
4141
+ icon: "ri:arrow-down-s-line",
4142
+ class: normalizeClass(unref(e)("trigger-arrow"))
4143
+ }, null, 8, ["class"])
4144
+ ]),
4145
+ _: 1
4146
+ }, 8, ["options"])
4147
+ ]),
4148
+ _: 3
4149
+ }, 8, ["class"]);
4010
4150
  };
4011
4151
  }
4012
4152
  });
4013
- const _export_sfc = (sfc, props) => {
4014
- const target = sfc.__vccOpts || sfc;
4015
- for (const [key2, val] of props) {
4016
- target[key2] = val;
4017
- }
4018
- return target;
4019
- };
4020
- const _hoisted_1$b = ["aria-label", "aria-describedby"];
4021
- const _hoisted_2$4 = ["id"];
4022
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
4023
- const _component_BasicSvgIcon = resolveComponent("BasicSvgIcon");
4024
- const _component_NInput = resolveComponent("NInput");
4025
- const _component_NButton = resolveComponent("NButton");
4026
- const _component_BasicOverlay = resolveComponent("BasicOverlay");
4027
- return openBlock(), createBlock(Transition, {
4028
- name: "fade-in-linear",
4029
- onAfterLeave: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("vanish"))
4030
- }, {
4031
- default: withCtx(() => [
4032
- withDirectives(createVNode(_component_BasicOverlay, {
4033
- "z-index": _ctx.zIndex,
4034
- "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
4035
- mask: _ctx.modal
4036
- }, {
4153
+ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4154
+ __name: "BasicButtonEdit",
4155
+ emits: ["click"],
4156
+ setup(__props, { emit: __emit }) {
4157
+ const emit = __emit;
4158
+ const { t } = useLocale();
4159
+ const attrs = useAttrs();
4160
+ function onClickHandler() {
4161
+ emit("click");
4162
+ }
4163
+ return (_ctx, _cache) => {
4164
+ return openBlock(), createBlock(unref(XBasicButton), mergeProps({
4165
+ icon: "ri-edit-fill",
4166
+ type: "primary"
4167
+ }, unref(attrs), { onClick: onClickHandler }), {
4037
4168
  default: withCtx(() => [
4038
- createElementVNode("div", {
4039
- role: "dialog",
4040
- "aria-label": _ctx.title,
4041
- "aria-modal": "true",
4042
- "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
4043
- class: normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
4044
- onClick: _cache[8] || (_cache[8] = (...args) => _ctx.overlayEvent.onClick && _ctx.overlayEvent.onClick(...args)),
4045
- onMousedown: _cache[9] || (_cache[9] = (...args) => _ctx.overlayEvent.onMousedown && _ctx.overlayEvent.onMousedown(...args)),
4046
- onMouseup: _cache[10] || (_cache[10] = (...args) => _ctx.overlayEvent.onMouseup && _ctx.overlayEvent.onMouseup(...args))
4047
- }, [
4048
- createElementVNode("div", {
4049
- ref: "rootRef",
4050
- class: normalizeClass([_ctx.ns.b(), _ctx.customClass, _ctx.ns.is("draggable", _ctx.draggable), { [_ctx.ns.m("center")]: _ctx.center }]),
4051
- style: normalizeStyle(_ctx.customStyle),
4052
- tabindex: "-1",
4053
- onClick: _cache[7] || (_cache[7] = withModifiers(() => {
4054
- }, ["stop"]))
4055
- }, [
4056
- _ctx.title !== null && _ctx.title !== void 0 ? (openBlock(), createElementBlock("div", {
4057
- key: 0,
4058
- ref: "headerRef",
4059
- class: normalizeClass([_ctx.ns.e("header"), { "show-close": _ctx.showClose }])
4060
- }, [
4061
- createElementVNode("div", {
4062
- class: normalizeClass(_ctx.ns.e("title"))
4063
- }, [
4064
- _ctx.iconComponent && _ctx.center ? (openBlock(), createBlock(_component_BasicSvgIcon, {
4065
- key: 0,
4066
- icon: _ctx.iconComponent,
4067
- class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
4068
- }, null, 8, ["icon", "class"])) : createCommentVNode("", true),
4069
- createTextVNode(" " + toDisplayString(_ctx.title), 1)
4070
- ], 2),
4071
- _ctx.showClose ? (openBlock(), createElementBlock("button", {
4072
- key: 0,
4073
- type: "button",
4074
- class: normalizeClass(_ctx.ns.e("headerbtn")),
4075
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel")),
4076
- onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"]))
4077
- }, [
4078
- createElementVNode("span", {
4079
- class: normalizeClass(_ctx.ns.e("close"))
4080
- }, [
4081
- createVNode(_component_BasicSvgIcon, { icon: "ri:close-line" })
4082
- ], 2)
4083
- ], 34)) : createCommentVNode("", true)
4084
- ], 2)) : createCommentVNode("", true),
4085
- createElementVNode("div", {
4086
- id: _ctx.contentId,
4087
- class: normalizeClass(_ctx.ns.e("content"))
4088
- }, [
4089
- createElementVNode("div", {
4090
- class: normalizeClass(_ctx.ns.e("container"))
4091
- }, [
4092
- _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (openBlock(), createBlock(_component_BasicSvgIcon, {
4093
- key: 0,
4094
- icon: _ctx.iconComponent,
4095
- class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
4096
- }, null, 8, ["icon", "class"])) : createCommentVNode("", true),
4097
- _ctx.hasMessage ? (openBlock(), createElementBlock("div", {
4098
- key: 1,
4099
- class: normalizeClass(_ctx.ns.e("message"))
4100
- }, [
4101
- renderSlot(_ctx.$slots, "default", {}, () => [
4102
- !_ctx.dangerouslyUseHTMLString ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
4103
- key: 0,
4104
- for: _ctx.showInput ? _ctx.inputId : void 0
4105
- }, {
4106
- default: withCtx(() => [
4107
- createTextVNode(toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1)
4108
- ]),
4109
- _: 1
4110
- }, 8, ["for"])) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
4111
- key: 1,
4112
- for: _ctx.showInput ? _ctx.inputId : void 0,
4113
- innerHTML: _ctx.message
4114
- }, null, 8, ["for", "innerHTML"]))
4115
- ])
4116
- ], 2)) : createCommentVNode("", true)
4117
- ], 2),
4118
- withDirectives(createElementVNode("div", {
4119
- class: normalizeClass(_ctx.ns.e("input"))
4120
- }, [
4121
- createVNode(_component_NInput, {
4122
- id: _ctx.inputId,
4123
- ref: "inputRef",
4124
- value: _ctx.inputValue,
4125
- "onUpdate:value": _cache[2] || (_cache[2] = ($event) => _ctx.inputValue = $event),
4126
- "theme-overrides": _ctx.themeOverridesRef,
4127
- type: _ctx.inputType,
4128
- placeholder: _ctx.inputPlaceholder,
4129
- "aria-invalid": _ctx.validateError,
4130
- class: normalizeClass({ invalid: _ctx.validateError }),
4131
- onKeydown: withKeys(_ctx.handleInputEnter, ["enter"])
4132
- }, null, 8, ["id", "value", "theme-overrides", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
4133
- createElementVNode("div", {
4134
- class: normalizeClass(_ctx.ns.e("errormsg")),
4135
- style: normalizeStyle({ visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden" })
4136
- }, toDisplayString(_ctx.editorErrorMessage), 7)
4137
- ], 2), [
4138
- [vShow, _ctx.showInput]
4139
- ])
4140
- ], 10, _hoisted_2$4),
4141
- createElementVNode("div", {
4142
- class: normalizeClass(_ctx.ns.e("btns"))
4143
- }, [
4144
- _ctx.showCancelButton ? (openBlock(), createBlock(_component_NButton, {
4145
- key: 0,
4146
- "theme-overrides": _ctx.themeOverridesRef,
4147
- loading: _ctx.cancelButtonLoading,
4148
- class: normalizeClass([_ctx.cancelButtonClass]),
4149
- round: _ctx.roundButton,
4150
- onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleAction("cancel")),
4151
- onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"]))
4152
- }, {
4153
- default: withCtx(() => [
4154
- createTextVNode(toDisplayString(_ctx.cancelButtonText || _ctx.t("max.button.cancel")), 1)
4155
- ]),
4156
- _: 1
4157
- }, 8, ["theme-overrides", "loading", "class", "round"])) : createCommentVNode("", true),
4158
- withDirectives(createVNode(_component_NButton, {
4159
- ref: "confirmRef",
4160
- "theme-overrides": _ctx.themeOverridesRef,
4161
- type: "primary",
4162
- loading: _ctx.confirmButtonLoading,
4163
- class: normalizeClass([_ctx.confirmButtonClasses]),
4164
- round: _ctx.roundButton,
4165
- disabled: _ctx.confirmButtonDisabled,
4166
- onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleAction("confirm")),
4167
- onKeydown: _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"]))
4168
- }, {
4169
- default: withCtx(() => [
4170
- createTextVNode(toDisplayString(_ctx.confirmButtonText || _ctx.t("max.button.confirm")), 1)
4171
- ]),
4172
- _: 1
4173
- }, 8, ["theme-overrides", "loading", "class", "round", "disabled"]), [
4174
- [vShow, _ctx.showConfirmButton]
4175
- ])
4176
- ], 2)
4177
- ], 6)
4178
- ], 42, _hoisted_1$b)
4169
+ renderSlot(_ctx.$slots, "default", {}, () => [
4170
+ createTextVNode(toDisplayString(unref(t)("max.basic.edit")), 1)
4171
+ ])
4179
4172
  ]),
4180
4173
  _: 3
4181
- }, 8, ["z-index", "overlay-class", "mask"]), [
4182
- [vShow, _ctx.visible]
4183
- ])
4184
- ]),
4185
- _: 3
4186
- });
4187
- }
4188
- const MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["render", _sfc_render$2]]);
4189
- const messageInstance = /* @__PURE__ */ new Map();
4190
- const getAppendToElement = (props) => {
4191
- let appendTo = document.body;
4192
- if (props.appendTo) {
4193
- if (isString(props.appendTo)) {
4194
- appendTo = document.querySelector(props.appendTo);
4174
+ }, 16);
4175
+ };
4176
+ }
4177
+ });
4178
+ const _sfc_main$J = /* @__PURE__ */ defineComponent({
4179
+ __name: "BasicButtonExport",
4180
+ props: {
4181
+ href: {},
4182
+ exportApi: { type: Function },
4183
+ beforeFetch: { type: Function },
4184
+ afterFetch: { type: Function },
4185
+ download: {},
4186
+ origin: { type: Boolean },
4187
+ onClick: { type: Function }
4188
+ },
4189
+ setup(__props) {
4190
+ const props = __props;
4191
+ const { t } = useLocale();
4192
+ const attrs = useAttrs();
4193
+ async function downloadFileRemote() {
4194
+ if (!props.exportApi) return false;
4195
+ const params = isFunction(props.beforeFetch) ? props.beforeFetch() : {};
4196
+ const { response } = await props.exportApi(params);
4197
+ if (response.data) {
4198
+ downloadFileByResponseData(response);
4199
+ }
4200
+ props.afterFetch && props.afterFetch(response);
4195
4201
  }
4196
- if (isElement(props.appendTo)) {
4197
- appendTo = props.appendTo;
4202
+ function onClickHandler() {
4203
+ var _a;
4204
+ if (props.origin) {
4205
+ (_a = props.onClick) == null ? void 0 : _a.call(props);
4206
+ return false;
4207
+ }
4208
+ if (!props.exportApi) {
4209
+ downloadFileStatic(props.href, props.download);
4210
+ return false;
4211
+ }
4212
+ downloadFileRemote();
4198
4213
  }
4199
- if (!isElement(appendTo)) {
4200
- console.warn("the appendTo option is not an HTMLElement. Falling back to document.body.");
4201
- appendTo = document.body;
4214
+ return (_ctx, _cache) => {
4215
+ return openBlock(), createBlock(unref(XBasicButton), mergeProps({
4216
+ icon: "ri:export-line",
4217
+ type: "primary"
4218
+ }, unref(attrs), { onClick: onClickHandler }), {
4219
+ default: withCtx(() => [
4220
+ renderSlot(_ctx.$slots, "default", {}, () => [
4221
+ createTextVNode(toDisplayString(unref(t)("max.basic.export")), 1)
4222
+ ])
4223
+ ]),
4224
+ _: 3
4225
+ }, 16);
4226
+ };
4227
+ }
4228
+ });
4229
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
4230
+ __name: "BasicButtonExportDrop",
4231
+ props: {
4232
+ disabled: { type: Boolean },
4233
+ icon: { default: "ri:export-line" },
4234
+ options: { default: () => [
4235
+ { label: "全部导出", key: "all" },
4236
+ { label: "按选择条目导出", key: "select" }
4237
+ ] }
4238
+ },
4239
+ emits: ["click"],
4240
+ setup(__props, { emit: __emit }) {
4241
+ const props = __props;
4242
+ const emit = __emit;
4243
+ const cOptions = computed(() => {
4244
+ var _a;
4245
+ return ((_a = props.options) != null ? _a : []).map((option) => {
4246
+ return option;
4247
+ });
4248
+ });
4249
+ function handleClick(key2) {
4250
+ emit("click", key2);
4202
4251
  }
4252
+ return (_ctx, _cache) => {
4253
+ return openBlock(), createBlock(_sfc_main$L, {
4254
+ icon: __props.icon,
4255
+ options: cOptions.value,
4256
+ onClick: handleClick
4257
+ }, {
4258
+ default: withCtx(() => [..._cache[0] || (_cache[0] = [
4259
+ createTextVNode(" 导出 ", -1)
4260
+ ])]),
4261
+ _: 1
4262
+ }, 8, ["icon", "options"]);
4263
+ };
4203
4264
  }
4204
- return appendTo;
4205
- };
4206
- const initInstance = (props, container, appContext = null) => {
4207
- const vnode = createVNode(MessageBoxConstructor, props, isFunction(props.message) || isVNode(props.message) ? { default: isFunction(props.message) ? props.message : () => props.message } : null);
4208
- vnode.appContext = appContext;
4209
- render$1(vnode, container);
4210
- getAppendToElement(props).appendChild(container.firstElementChild);
4211
- return vnode.component;
4212
- };
4213
- const genContainer = () => {
4214
- return document.createElement("div");
4215
- };
4216
- const showMessage = (options, appContext) => {
4217
- const container = genContainer();
4218
- options.onVanish = () => {
4219
- render$1(null, container);
4220
- messageInstance.delete(vm);
4221
- };
4222
- options.onAction = (action) => {
4223
- const currentMsg = messageInstance.get(vm);
4224
- let resolve;
4225
- if (options.showInput) {
4226
- resolve = { value: vm.inputValue, action };
4227
- } else {
4228
- resolve = action;
4265
+ });
4266
+ const _hoisted_1$b = ["multiple", "name", "accept"];
4267
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
4268
+ __name: "BasicButtonImport",
4269
+ props: {
4270
+ name: { default: "file" },
4271
+ accept: { default: ".xlsx,.xls,.csv" },
4272
+ multiple: { type: Boolean, default: false },
4273
+ beforeUpload: { type: Function, default: void 0 }
4274
+ },
4275
+ emits: ["change"],
4276
+ setup(__props, { emit: __emit }) {
4277
+ const props = __props;
4278
+ const emit = __emit;
4279
+ const { t } = useLocale();
4280
+ const attrs = useAttrs();
4281
+ const uid2 = ref(guid());
4282
+ const fileInputRef = useTemplateRef("fileInputRef");
4283
+ function onClickHandler() {
4284
+ var _a;
4285
+ (_a = fileInputRef.value) == null ? void 0 : _a.click();
4229
4286
  }
4230
- if (options.callback) {
4231
- options.callback(resolve, instance.proxy);
4232
- } else if (action === "cancel" || action === "close") {
4233
- if (options.distinguishCancelAndClose && action !== "cancel") {
4234
- currentMsg.reject("close");
4235
- } else {
4236
- currentMsg.reject("cancel");
4287
+ function reset() {
4288
+ uid2.value = guid();
4289
+ }
4290
+ async function processFile(file, fileList) {
4291
+ const { beforeUpload } = props;
4292
+ let transformedFile = file;
4293
+ if (beforeUpload) {
4294
+ try {
4295
+ transformedFile = await beforeUpload(file, fileList);
4296
+ } catch (e) {
4297
+ console.warn("max-ajax-uploader", e);
4298
+ transformedFile = false;
4299
+ }
4300
+ if (transformedFile === false) {
4301
+ return {
4302
+ origin: file
4303
+ };
4304
+ }
4237
4305
  }
4238
- } else {
4239
- currentMsg.resolve(resolve);
4306
+ return {
4307
+ origin: file
4308
+ };
4240
4309
  }
4241
- };
4242
- const instance = initInstance(options, container, appContext);
4243
- const vm = instance.proxy;
4244
- for (const prop in options) {
4245
- if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
4246
- vm[prop] = options[prop];
4310
+ function uploadFiles(files) {
4311
+ const originFiles = [...files];
4312
+ const postFiles = originFiles.map((file) => {
4313
+ return processFile(file, originFiles);
4314
+ });
4315
+ Promise.all(postFiles).then((fileList) => {
4316
+ if (fileList.length === 0) {
4317
+ return;
4318
+ }
4319
+ const file = fileList[0].origin;
4320
+ const po = new FormData();
4321
+ po.append("file", file);
4322
+ emit("change", { file: fileList[0].origin, files: fileList, param: po });
4323
+ });
4247
4324
  }
4248
- }
4249
- vm.visible = true;
4250
- return vm;
4251
- };
4252
- function MessageBox(options, appContext = null) {
4253
- if (!isClient$1) return Promise.reject();
4254
- let callback;
4255
- if (isString(options) || isVNode(options)) {
4256
- options = {
4257
- message: options
4325
+ function onFileChange(e) {
4326
+ const { accept } = props;
4327
+ const { files } = e.target;
4328
+ const acceptedFiles = [...files].filter((file) => attrAccept$1(file, accept));
4329
+ uploadFiles(acceptedFiles);
4330
+ reset();
4331
+ }
4332
+ const buttonStyle = computed(() => {
4333
+ return {
4334
+ display: "none"
4335
+ };
4336
+ });
4337
+ return (_ctx, _cache) => {
4338
+ return openBlock(), createBlock(unref(XBasicButton), mergeProps({
4339
+ icon: "ri:import-line",
4340
+ type: "primary"
4341
+ }, unref(attrs), { onClick: onClickHandler }), {
4342
+ default: withCtx(() => [
4343
+ (openBlock(), createElementBlock("input", {
4344
+ key: uid2.value,
4345
+ ref_key: "fileInputRef",
4346
+ ref: fileInputRef,
4347
+ type: "file",
4348
+ class: "hidden",
4349
+ multiple: __props.multiple,
4350
+ name: __props.name,
4351
+ accept: __props.accept,
4352
+ style: normalizeStyle(buttonStyle.value),
4353
+ onChange: onFileChange
4354
+ }, null, 44, _hoisted_1$b)),
4355
+ renderSlot(_ctx.$slots, "default", {}, () => [
4356
+ createTextVNode(toDisplayString(unref(t)("max.basic.import")), 1)
4357
+ ])
4358
+ ]),
4359
+ _: 3
4360
+ }, 16);
4258
4361
  };
4259
- } else {
4260
- callback = options.callback;
4261
4362
  }
4262
- return new Promise((resolve, reject) => {
4263
- const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
4264
- messageInstance.set(vm, {
4265
- options,
4266
- callback,
4267
- resolve,
4268
- reject
4269
- });
4270
- });
4271
- }
4272
- const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
4273
- const MESSAGE_BOX_DEFAULT_OPTS = {
4274
- alert: { closeOnPressEscape: false, closeOnClickModal: false },
4275
- confirm: { showCancelButton: true },
4276
- prompt: { showCancelButton: true, showInput: true }
4277
- };
4278
- MESSAGE_BOX_VARIANTS.forEach((boxType) => {
4279
- MessageBox[boxType] = messageBoxFactory(boxType);
4280
4363
  });
4281
- function messageBoxFactory(boxType) {
4282
- return (message, title, options, appContext) => {
4283
- let titleOrOpts = "";
4284
- if (isObject$1(title)) {
4285
- options = title;
4286
- titleOrOpts = "";
4287
- } else if (isUndefined(title)) {
4288
- titleOrOpts = "";
4289
- } else {
4290
- titleOrOpts = title;
4364
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
4365
+ __name: "BasicButtonPrint",
4366
+ emits: ["click"],
4367
+ setup(__props, { emit: __emit }) {
4368
+ const emit = __emit;
4369
+ const { t } = useLocale();
4370
+ const attrs = useAttrs();
4371
+ function onClickHandler() {
4372
+ emit("click");
4291
4373
  }
4292
- return MessageBox(
4293
- {
4294
- title: titleOrOpts,
4295
- message,
4296
- type: "",
4297
- ...MESSAGE_BOX_DEFAULT_OPTS[boxType],
4298
- ...options,
4299
- boxType
4300
- },
4301
- appContext
4302
- );
4303
- };
4304
- }
4305
- MessageBox.close = () => {
4306
- messageInstance.forEach((_, vm) => {
4307
- vm.doClose();
4308
- });
4309
- messageInstance.clear();
4310
- };
4311
- MessageBox._context = null;
4312
- const $MessageBox = MessageBox;
4313
- const XBasicMessageBox = $MessageBox;
4374
+ return (_ctx, _cache) => {
4375
+ return openBlock(), createBlock(unref(XBasicButton), mergeProps({
4376
+ icon: "ri-printer-line",
4377
+ type: "primary"
4378
+ }, unref(attrs), { onClick: onClickHandler }), {
4379
+ default: withCtx(() => [
4380
+ renderSlot(_ctx.$slots, "default", {}, () => [
4381
+ createTextVNode(toDisplayString(unref(t)("max.basic.print")), 1)
4382
+ ])
4383
+ ]),
4384
+ _: 3
4385
+ }, 16);
4386
+ };
4387
+ }
4388
+ });
4389
+ const XBasicButtonCreate = withInstall(_sfc_main$N);
4390
+ const XBasicButtonEdit = withInstall(_sfc_main$K);
4391
+ const XBasicButtonDelete = withInstall(_sfc_main$M);
4392
+ const XBasicButtonExport = withInstall(_sfc_main$J);
4393
+ const XBasicButtonImport = withInstall(_sfc_main$H);
4394
+ const XBasicButtonPrint = withInstall(_sfc_main$G);
4395
+ const XBasicButtonDrop = withInstall(_sfc_main$L);
4396
+ const XBasicButtonExportDrop = withInstall(_sfc_main$I);
4314
4397
  function _isSlot$3(s) {
4315
4398
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
4316
4399
  }
@@ -6928,7 +7011,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
6928
7011
  class: normalizeClass(basicTextClass.value),
6929
7012
  title: unref(isString)(unref(mergedValueRef)) ? unref(mergedValueRef) : void 0
6930
7013
  }, [
6931
- __props.icon ? (openBlock(), createBlock(_sfc_main$X, {
7014
+ __props.icon ? (openBlock(), createBlock(_sfc_main$Y, {
6932
7015
  key: 0,
6933
7016
  icon: __props.icon,
6934
7017
  class: normalizeClass(__props.iconClass),
@@ -27232,6 +27315,7 @@ const components = [
27232
27315
  XTreeSearch,
27233
27316
  XTreeDrop,
27234
27317
  XBasicViewBar,
27318
+ XBasicActionFooter,
27235
27319
  XBasicButtonGroup,
27236
27320
  XBasicUpload,
27237
27321
  XBasicUploadDragger,
@@ -27564,6 +27648,7 @@ export {
27564
27648
  VxePager2 as VxePager,
27565
27649
  VxeTable,
27566
27650
  VxeToolbar,
27651
+ XBasicActionFooter,
27567
27652
  XBasicArrow,
27568
27653
  XBasicButton,
27569
27654
  XBasicButtonCreate,