@maxax/ui 1.1.48 → 1.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { addUnit, pascalCase, isClient as isClient$1, hasClass, addClass, getScrollbarWidth, getStyle, removeClass, isNumber, withInstall, guid, isFunction, isString, isElement, isObject as isObject$1, isUndefined, downloadFileStatic, downloadFileByResponseData, attrAccept as attrAccept$1, isBoolean, getSlot, isArray, deepMerge, cloneDeep as cloneDeep$2, mergeArray, findNodeAll, calculate, call, isNull, getValueKey, classNames, tryConstructArray, isNil, tryDeconstructArray, tryDeconstructObject, isEmpty, isPascalCase, kebabCase, listToTree, mapTree, getTransitionProps, collapseMotion, getTransitionGroupProps } from "@maxax/utils";
1
+ import { addUnit, pascalCase, isClient as isClient$1, hasClass, addClass, getScrollbarWidth, getStyle, removeClass, isNumber, withInstall, guid, isFunction, isString, isElement, isObject as isObject$1, isUndefined, downloadFileStatic, downloadFileByResponseData, attrAccept as attrAccept$1, isBoolean, getSlot, isArray, deepMerge, cloneDeep as cloneDeep$2, mergeArray, findNodeAll, calculate, listToTree, call, isNull, getValueKey, classNames, tryConstructArray, isNil, tryDeconstructArray, tryDeconstructObject, isEmpty, isPascalCase, kebabCase, mapTree, getTransitionProps, collapseMotion, getTransitionGroupProps } from "@maxax/utils";
2
2
  import { shallowRef, shallowReadonly, onUnmounted, onMounted, nextTick, getCurrentScope, onScopeDispose, toValue, getCurrentInstance, watch, computed, unref, watchEffect, onBeforeUnmount, reactive, ref, inject, isRef, toRaw, defineComponent, createElementBlock, openBlock, normalizeClass, createElementVNode, renderSlot, h, useAttrs, mergeProps, Fragment, createBlock, createCommentVNode, withCtx, createTextVNode, toDisplayString, createVNode, useSlots, createSlots, provide, toRefs, resolveComponent, Transition, withDirectives, withModifiers, normalizeStyle, withKeys, resolveDynamicComponent, vShow, isVNode, render as render$1, useTemplateRef, renderList, normalizeProps, guardReactiveProps, toRef, vModelText, createApp, toHandlers, mergeDefaults, mergeModels, useModel, Comment, Text, triggerRef, TransitionGroup } from "vue";
3
3
  import BScroll from "@better-scroll/core";
4
4
  import { NTooltip, NButton, NInput, NButtonGroup, NDropdown, NModal, NProgress, NCard, NCascader, NDatePicker, NDrawer, NDrawerContent, NSelect, NInputNumber, NUpload, NAutoComplete, NDynamicTags, NTreeSelect, NTimePicker, NSwitch, NCheckbox, NCheckboxGroup, NRadio, NRadioButton, NRadioGroup, NSlider, NTransfer, NDivider, NColorPicker, NRate, NCol, NFormItem, NForm, NRow, NPopover, NTabs, NTabPane, NScrollbar, NEmpty, NPagination, NSpin } from "naive-ui";
@@ -12067,7 +12067,14 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
12067
12067
  afterFetch: {},
12068
12068
  handleSearchInfoFn: {},
12069
12069
  searchInfo: {},
12070
- fetchSetting: { default: () => ({ listField: "resultList" }) }
12070
+ fetchSetting: { default: () => ({ listField: "resultList" }) },
12071
+ transform: {},
12072
+ labelField: {},
12073
+ valueField: {},
12074
+ cascaderConfig: {},
12075
+ "onUpdate:value": {},
12076
+ onUpdateValue: {},
12077
+ onChange: {}
12071
12078
  },
12072
12079
  setup(__props, { expose: __expose }) {
12073
12080
  const props = __props;
@@ -12083,6 +12090,9 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
12083
12090
  const data = unref(dataSourceRef);
12084
12091
  return data.length > 0 ? data : props.options;
12085
12092
  });
12093
+ const cascaderConfig = computed(() => ({
12094
+ ...props.cascaderConfig || {}
12095
+ }));
12086
12096
  watch(
12087
12097
  () => props.searchInfo,
12088
12098
  () => {
@@ -12091,7 +12101,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
12091
12101
  { deep: true, immediate: props.immediate }
12092
12102
  );
12093
12103
  async function fetch2(opt) {
12094
- const { api, dynamicApi, searchInfo, fetchSetting, beforeFetch, afterFetch, handleSearchInfoFn } = props;
12104
+ const { api, dynamicApi, searchInfo, fetchSetting, beforeFetch, afterFetch, handleSearchInfoFn, transform, valueField, labelField } = props;
12095
12105
  if (!api && !dynamicApi || loading.value) return;
12096
12106
  try {
12097
12107
  loading.value = true;
@@ -12110,6 +12120,9 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
12110
12120
  if (afterFetch && isFunction(afterFetch)) {
12111
12121
  resultItems = await afterFetch(resultItems) || resultItems;
12112
12122
  }
12123
+ if (transform) {
12124
+ resultItems = listToTree(resultItems, { ...transform || {}, valueField, labelField });
12125
+ }
12113
12126
  dataSourceRef.value = resultItems;
12114
12127
  } catch (error) {
12115
12128
  console.error(error);
@@ -12150,7 +12163,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
12150
12163
  createElementVNode("div", {
12151
12164
  class: normalizeClass(unref(b)())
12152
12165
  }, null, 2),
12153
- createVNode(unref(NCascader), mergeProps(_ctx.$attrs, {
12166
+ createVNode(unref(NCascader), mergeProps(cascaderConfig.value, {
12154
12167
  value: unref(mergedValueRef),
12155
12168
  options: getOptions.value,
12156
12169
  class: unref(b)(),