@maxax/ui 1.1.73 → 1.1.75

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 (30) hide show
  1. package/dist/components/basic-button-group/BasicButtonGroup.vue.d.ts +8 -1
  2. package/dist/components/basic-button-group/BasicButtonGroup.vue.d.ts.map +1 -1
  3. package/dist/components/basic-button-group/components/ButtonGroupItem.vue.d.ts.map +1 -1
  4. package/dist/components/basic-button-group/hooks/use-button-group-schema.d.ts.map +1 -1
  5. package/dist/components/basic-button-group/types/button-group.d.ts +4 -0
  6. package/dist/components/basic-button-group/types/button-group.d.ts.map +1 -1
  7. package/dist/components/basic-button-group/types/component.d.ts +3 -1
  8. package/dist/components/basic-button-group/types/component.d.ts.map +1 -1
  9. package/dist/components/basic-edit-batch/components/EditBatchItem.vue.d.ts.map +1 -1
  10. package/dist/components/basic-form/components/FormItem.vue.d.ts.map +1 -1
  11. package/dist/index.cjs +95 -34
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.mjs +95 -34
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/locale/lang/en.d.ts.map +1 -1
  16. package/dist/locale/lang/zh-cn.d.ts.map +1 -1
  17. package/dist/locales.cjs +32 -2
  18. package/dist/locales.cjs.map +1 -1
  19. package/dist/locales.mjs +32 -2
  20. package/dist/locales.mjs.map +1 -1
  21. package/dist/theme-chalk/components/basicButtonGroup.scss +17 -1
  22. package/dist/theme-chalk/index.css +1 -1
  23. package/dist/theme-chalk/light.css +1 -1
  24. package/dist/{zh-cn-56c_PDSF.cjs → zh-cn-BdENqlAc.cjs} +4 -2
  25. package/dist/zh-cn-BdENqlAc.cjs.map +1 -0
  26. package/dist/{zh-cn-BiMi9UU7.js → zh-cn-KPfh6ZPA.js} +4 -2
  27. package/dist/zh-cn-KPfh6ZPA.js.map +1 -0
  28. package/package.json +4 -4
  29. package/dist/zh-cn-56c_PDSF.cjs.map +0 -1
  30. package/dist/zh-cn-BiMi9UU7.js.map +0 -1
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import dayjs from "dayjs";
11
11
  import { useBoolean, useMergedState as useMergedState$1, useEventListener as useEventListener$1, useBreakpoint } from "@maxax/hooks";
12
12
  import { format } from "date-fns";
13
13
  import elementResizeDetectorMaker from "element-resize-detector";
14
- import { z as zhCN } from "./zh-cn-BiMi9UU7.js";
14
+ import { z as zhCN } from "./zh-cn-KPfh6ZPA.js";
15
15
  function tryOnScopeDispose(fn, failSilently) {
16
16
  if (getCurrentScope()) {
17
17
  onScopeDispose(fn, failSilently);
@@ -7853,20 +7853,21 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
7853
7853
  return createVNode("span", null, [getLabel]);
7854
7854
  }
7855
7855
  function renderComponent() {
7856
+ var _a;
7856
7857
  const {
7857
7858
  renderComponentContent
7858
7859
  } = props.schema;
7859
7860
  const {
7860
7861
  size
7861
7862
  } = props.buttonGroupProps;
7863
+ const icon = (_a = props.schema.icon) != null ? _a : unref(getComponentsProps).icon;
7862
7864
  const propsData = {
7863
- clearable: true,
7864
7865
  size,
7865
- type: "primary",
7866
7866
  ...unref(getComponentsProps),
7867
7867
  disabled: unref(getDisable),
7868
7868
  loading: unref(getLoading)
7869
7869
  };
7870
+ delete propsData.icon;
7870
7871
  const on = {
7871
7872
  onClick: (ev) => {
7872
7873
  if (!props.schema.validate) {
@@ -7907,18 +7908,25 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
7907
7908
  ...propsData,
7908
7909
  ...on
7909
7910
  };
7911
+ const iconSlot = icon ? {
7912
+ icon: () => createVNode(XBasicSvgIcon, {
7913
+ "icon": icon
7914
+ }, null)
7915
+ } : {};
7910
7916
  if (!renderComponentContent) {
7911
- let _slot;
7912
- return createVNode(NButton, compAttr, _isSlot$3(_slot = renderButtonLabel()) ? _slot : {
7913
- default: () => [_slot]
7917
+ return createVNode(NButton, compAttr, {
7918
+ default: () => renderButtonLabel(),
7919
+ ...iconSlot
7914
7920
  });
7915
7921
  }
7916
7922
  const compSlot = isFunction$1(renderComponentContent) ? {
7917
7923
  ...renderComponentContent(unref(getValues), {
7918
7924
  disabled: unref(getDisable)
7919
- })
7925
+ }),
7926
+ ...iconSlot
7920
7927
  } : {
7921
- default: () => renderComponentContent
7928
+ default: () => renderComponentContent,
7929
+ ...iconSlot
7922
7930
  };
7923
7931
  return createVNode(NButton, compAttr, _isSlot$3(compSlot) ? compSlot : {
7924
7932
  default: () => [compSlot]
@@ -8074,9 +8082,24 @@ function useButtonGroupEvents({ getSchema, schemaRef }) {
8074
8082
  setSchema
8075
8083
  };
8076
8084
  }
8085
+ const DEFAULT_RETURN_BUTTON_SCHEMA = {
8086
+ field: "buttonReturn",
8087
+ component: "Button",
8088
+ label: () => t("max.basic.back"),
8089
+ message: () => t("max.basic.confirmReturn"),
8090
+ confirm: () => window.history.back(),
8091
+ componentProps: {
8092
+ type: "default",
8093
+ bordered: true
8094
+ }
8095
+ };
8077
8096
  function useButtonGroupSchema({ getProps, schemaRef }) {
8078
8097
  const getSchema = computed(() => {
8079
- const schemas = cloneDeep$2(unref(schemaRef) || unref(getProps).schemas || []);
8098
+ const props = unref(getProps);
8099
+ const schemas = cloneDeep$2(unref(schemaRef) || props.schemas || []);
8100
+ if (props.showReturnButton && !schemas.some((schema) => schema.field === DEFAULT_RETURN_BUTTON_SCHEMA.field)) {
8101
+ schemas.unshift(cloneDeep$2(DEFAULT_RETURN_BUTTON_SCHEMA));
8102
+ }
8080
8103
  return schemas;
8081
8104
  });
8082
8105
  return { getSchema };
@@ -8084,18 +8107,20 @@ function useButtonGroupSchema({ getProps, schemaRef }) {
8084
8107
  const _sfc_main$G = /* @__PURE__ */ defineComponent({
8085
8108
  __name: "BasicButtonGroup",
8086
8109
  props: {
8087
- showReturnButton: { type: Boolean },
8110
+ showReturnButton: { type: Boolean, default: true },
8088
8111
  size: {},
8089
8112
  disabled: { type: Boolean },
8090
8113
  readonly: { type: Boolean },
8091
8114
  schemas: { default: () => [] },
8092
8115
  mergeDynamicData: {},
8116
+ placement: { default: "left" },
8093
8117
  compact: { type: Boolean }
8094
8118
  },
8095
8119
  emits: ["click"],
8096
8120
  setup(__props, { expose: __expose, emit: __emit }) {
8097
8121
  const props = __props;
8098
8122
  const { t: t2 } = useLocale();
8123
+ const { e } = useNamespace("basic-button-group");
8099
8124
  const attrs = useAttrs();
8100
8125
  const schemaRef = ref(null);
8101
8126
  ref(null);
@@ -8111,6 +8136,14 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
8111
8136
  schemaRef
8112
8137
  });
8113
8138
  const getBindValue = computed(() => ({ ...omit$1(attrs, ["data-max-id"]), ...unref(getProps) }));
8139
+ const getLeftSchema = computed(() => unref(getSchema).filter((schema) => {
8140
+ var _a;
8141
+ return ((_a = schema.placement) != null ? _a : unref(getProps).placement) === "left";
8142
+ }));
8143
+ const getRightSchema = computed(() => unref(getSchema).filter((schema) => {
8144
+ var _a;
8145
+ return ((_a = schema.placement) != null ? _a : unref(getProps).placement) === "right";
8146
+ }));
8114
8147
  watch(
8115
8148
  () => props.schemas,
8116
8149
  (schemas) => {
@@ -8140,12 +8173,9 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
8140
8173
  function handleClick({ values: values2 }) {
8141
8174
  var _a;
8142
8175
  const { field, schema } = values2;
8143
- if (field === "buttonReturn") {
8144
- window.history.back();
8145
- return;
8146
- }
8147
- if (schema.message) {
8148
- XBasicMessageBox.confirm(schema.message, t2("max.basic.warning"), schema.messageBoxProps || {}).then(() => {
8176
+ const message = isFunction$1(schema.message) ? schema.message(values2) : schema.message;
8177
+ if (message) {
8178
+ XBasicMessageBox.confirm(message, t2("max.basic.warning"), schema.messageBoxProps || {}).then(() => {
8149
8179
  var _a2;
8150
8180
  (_a2 = schema.confirm) == null ? void 0 : _a2.call(schema, { field, schema, action: "confirm" });
8151
8181
  }).catch(() => {
@@ -8161,24 +8191,55 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
8161
8191
  });
8162
8192
  return (_ctx, _cache) => {
8163
8193
  return openBlock(), createElementBlock("div", mergeProps({ class: unref(getWrapperClass) }, getBindValue.value), [
8164
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getSchema), (schema) => {
8165
- return openBlock(), createBlock(_sfc_main$H, {
8166
- key: schema.field,
8167
- schema,
8168
- "button-group-action-type": buttonGroupActionType,
8169
- "button-group-props": getProps.value,
8170
- onClick: handleClick
8171
- }, createSlots({ _: 2 }, [
8172
- renderList(Object.keys(unref(slots)), (item) => {
8173
- return {
8174
- name: item,
8175
- fn: withCtx((data) => [
8176
- renderSlot(_ctx.$slots, item, mergeProps({ ref_for: true }, data || {}))
8177
- ])
8178
- };
8179
- })
8180
- ]), 1032, ["schema", "button-group-props"]);
8181
- }), 128))
8194
+ createElementVNode("div", {
8195
+ class: normalizeClass(unref(e)("left"))
8196
+ }, [
8197
+ renderSlot(_ctx.$slots, "left-left"),
8198
+ (openBlock(true), createElementBlock(Fragment, null, renderList(getLeftSchema.value, (schema) => {
8199
+ return openBlock(), createBlock(_sfc_main$H, {
8200
+ key: schema.field,
8201
+ schema,
8202
+ "button-group-action-type": buttonGroupActionType,
8203
+ "button-group-props": getProps.value,
8204
+ onClick: handleClick
8205
+ }, createSlots({ _: 2 }, [
8206
+ renderList(Object.keys(unref(slots)), (item) => {
8207
+ return {
8208
+ name: item,
8209
+ fn: withCtx((data) => [
8210
+ renderSlot(_ctx.$slots, item, mergeProps({ ref_for: true }, data || {}))
8211
+ ])
8212
+ };
8213
+ })
8214
+ ]), 1032, ["schema", "button-group-props"]);
8215
+ }), 128)),
8216
+ renderSlot(_ctx.$slots, "left-right")
8217
+ ], 2),
8218
+ getRightSchema.value.length || unref(slots)["right-left"] || unref(slots)["right-right"] ? (openBlock(), createElementBlock("div", {
8219
+ key: 0,
8220
+ class: normalizeClass(unref(e)("right"))
8221
+ }, [
8222
+ renderSlot(_ctx.$slots, "right-left"),
8223
+ (openBlock(true), createElementBlock(Fragment, null, renderList(getRightSchema.value, (schema) => {
8224
+ return openBlock(), createBlock(_sfc_main$H, {
8225
+ key: schema.field,
8226
+ schema,
8227
+ "button-group-action-type": buttonGroupActionType,
8228
+ "button-group-props": getProps.value,
8229
+ onClick: handleClick
8230
+ }, createSlots({ _: 2 }, [
8231
+ renderList(Object.keys(unref(slots)), (item) => {
8232
+ return {
8233
+ name: item,
8234
+ fn: withCtx((data) => [
8235
+ renderSlot(_ctx.$slots, item, mergeProps({ ref_for: true }, data || {}))
8236
+ ])
8237
+ };
8238
+ })
8239
+ ]), 1032, ["schema", "button-group-props"]);
8240
+ }), 128)),
8241
+ renderSlot(_ctx.$slots, "right-right")
8242
+ ], 2)) : createCommentVNode("", true)
8182
8243
  ], 16);
8183
8244
  };
8184
8245
  }