@maxax/ui 1.1.43 → 1.1.45
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/components/basic-tree/BasicTree.vue.d.ts +200 -193
- package/dist/components/basic-tree/BasicTree.vue.d.ts.map +1 -1
- package/dist/components/basic-tree/constants.d.ts +2 -2
- package/dist/components/basic-tree/constants.d.ts.map +1 -1
- package/dist/components/basic-tree/interface.d.ts +10 -6
- package/dist/components/basic-tree/interface.d.ts.map +1 -1
- package/dist/composable/use-event-bus.d.ts +2 -0
- package/dist/composable/use-event-bus.d.ts.map +1 -0
- package/dist/index.cjs +29 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +35 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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, getTransitionProps, collapseMotion, getTransitionGroupProps } from "@maxax/utils";
|
|
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, Comment, Text, triggerRef, TransitionGroup } from "vue";
|
|
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";
|
|
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";
|
|
5
5
|
import { merge, cloneDeep as cloneDeep$1, uniqBy, isBoolean as isBoolean$1, isFunction as isFunction$1, isArray as isArray$1, isString as isString$1, isEqual, get, concat, omit, has, set, unset, isNumber as isNumber$1, isPlainObject, partition } from "lodash-es";
|
|
@@ -2263,8 +2263,8 @@ function requireMapTree() {
|
|
|
2263
2263
|
return rest;
|
|
2264
2264
|
});
|
|
2265
2265
|
}
|
|
2266
|
-
var
|
|
2267
|
-
mapTree_1 =
|
|
2266
|
+
var mapTree2 = helperCreateTreeFunc(mapTreeItem);
|
|
2267
|
+
mapTree_1 = mapTree2;
|
|
2268
2268
|
return mapTree_1;
|
|
2269
2269
|
}
|
|
2270
2270
|
var filterTree_1;
|
|
@@ -5772,7 +5772,7 @@ function requireXeUtils() {
|
|
|
5772
5772
|
var toTreeArray = requireToTreeArray();
|
|
5773
5773
|
var findTree = requireFindTree();
|
|
5774
5774
|
var eachTree = requireEachTree();
|
|
5775
|
-
var
|
|
5775
|
+
var mapTree2 = requireMapTree();
|
|
5776
5776
|
var filterTree = requireFilterTree();
|
|
5777
5777
|
var searchTree = requireSearchTree();
|
|
5778
5778
|
var arrayIndexOf = requireArrayIndexOf();
|
|
@@ -5951,7 +5951,7 @@ function requireXeUtils() {
|
|
|
5951
5951
|
toTreeArray,
|
|
5952
5952
|
findTree,
|
|
5953
5953
|
eachTree,
|
|
5954
|
-
mapTree,
|
|
5954
|
+
mapTree: mapTree2,
|
|
5955
5955
|
filterTree,
|
|
5956
5956
|
searchTree,
|
|
5957
5957
|
// base
|
|
@@ -30451,25 +30451,30 @@ const XTreeSearch = withInstall(_sfc_main$7);
|
|
|
30451
30451
|
const DEFAULT_TRANSFORM_CONFIG = {
|
|
30452
30452
|
id: "id",
|
|
30453
30453
|
pid: "parentId",
|
|
30454
|
-
children: "children"
|
|
30455
|
-
labelField: "deptName",
|
|
30456
|
-
valueField: "id"
|
|
30454
|
+
children: "children"
|
|
30457
30455
|
};
|
|
30458
30456
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
30459
30457
|
__name: "BasicTree",
|
|
30460
|
-
props: {
|
|
30458
|
+
props: /* @__PURE__ */ mergeModels({
|
|
30459
|
+
modelValue: {},
|
|
30461
30460
|
immediate: { type: Boolean, default: true },
|
|
30462
30461
|
api: {},
|
|
30463
30462
|
beforeFetch: {},
|
|
30464
30463
|
afterFetch: {},
|
|
30465
30464
|
transform: { default: () => DEFAULT_TRANSFORM_CONFIG },
|
|
30466
30465
|
listField: {},
|
|
30467
|
-
treeConfig: {}
|
|
30468
|
-
|
|
30469
|
-
|
|
30466
|
+
treeConfig: {},
|
|
30467
|
+
labelField: {},
|
|
30468
|
+
valueField: {}
|
|
30469
|
+
}, {
|
|
30470
|
+
"modelValue": {},
|
|
30471
|
+
"modelModifiers": {}
|
|
30472
|
+
}),
|
|
30473
|
+
emits: /* @__PURE__ */ mergeModels(["update:modelValue", "load", "expand", "check", "uncheck", "select", "unselect", "set-data", "check-change", "selected-change", "checked-change", "click", "node-dblclick", "node-right-click", "node-dragstart", "node-dragenter", "node-dragover", "node-dragleave", "node-drop"], ["update:modelValue"]),
|
|
30470
30474
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
30471
30475
|
const props = __props;
|
|
30472
30476
|
const emit = __emit;
|
|
30477
|
+
const modelValue = useModel(__props, "modelValue");
|
|
30473
30478
|
const slots = useSlots();
|
|
30474
30479
|
const { b, e } = useNamespace("basic-tree");
|
|
30475
30480
|
const treeRef = useTemplateRef("treeRef");
|
|
@@ -30495,8 +30500,16 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
30495
30500
|
}));
|
|
30496
30501
|
const treeArray = ref([]);
|
|
30497
30502
|
const loading = ref(true);
|
|
30503
|
+
function formatterTreeData(data) {
|
|
30504
|
+
return mapTree(data, {
|
|
30505
|
+
conversion: (node) => {
|
|
30506
|
+
node.data = node;
|
|
30507
|
+
return node;
|
|
30508
|
+
}
|
|
30509
|
+
});
|
|
30510
|
+
}
|
|
30498
30511
|
async function fetch2() {
|
|
30499
|
-
const { api, beforeFetch, afterFetch, transform, listField = "resultList" } = props;
|
|
30512
|
+
const { api, beforeFetch, afterFetch, transform, listField = "resultList", valueField = "value", labelField = "label" } = props;
|
|
30500
30513
|
if (!api) return;
|
|
30501
30514
|
loading.value = true;
|
|
30502
30515
|
const params = beforeFetch ? await beforeFetch() : {};
|
|
@@ -30505,11 +30518,12 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
30505
30518
|
let resultItems = isArrayResult ? res.data : get(res.data, listField);
|
|
30506
30519
|
resultItems = afterFetch ? await afterFetch(resultItems) : resultItems;
|
|
30507
30520
|
if (transform) {
|
|
30508
|
-
resultItems = listToTree(resultItems, { ...transform || {} });
|
|
30521
|
+
resultItems = listToTree(resultItems, { ...transform || {}, valueField, labelField });
|
|
30509
30522
|
}
|
|
30510
|
-
|
|
30523
|
+
const treeData = formatterTreeData(resultItems);
|
|
30524
|
+
setTreeData(treeData);
|
|
30511
30525
|
loading.value = false;
|
|
30512
|
-
emit("load",
|
|
30526
|
+
emit("load", treeData);
|
|
30513
30527
|
}
|
|
30514
30528
|
function getTreeData() {
|
|
30515
30529
|
return treeArray.value || [];
|
|
@@ -30543,7 +30557,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
30543
30557
|
}, [
|
|
30544
30558
|
createVNode(unref(XTreeSearch), mergeProps({
|
|
30545
30559
|
ref_key: "treeRef",
|
|
30546
|
-
ref: treeRef
|
|
30560
|
+
ref: treeRef,
|
|
30561
|
+
modelValue: modelValue.value,
|
|
30562
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)
|
|
30547
30563
|
}, treeConfig.value, toHandlers(unref(treeListeners))), createSlots({ _: 2 }, [
|
|
30548
30564
|
renderList(Object.keys(unref(slots)), (slot) => {
|
|
30549
30565
|
return {
|
|
@@ -30553,7 +30569,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
30553
30569
|
])
|
|
30554
30570
|
};
|
|
30555
30571
|
})
|
|
30556
|
-
]), 1040)
|
|
30572
|
+
]), 1040, ["modelValue"])
|
|
30557
30573
|
], 2)), [
|
|
30558
30574
|
[unref(vLoading), loading.value]
|
|
30559
30575
|
])
|