@maxax/ui 1.1.43 → 1.1.44
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 +9 -3
- 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 +9 -5
- 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
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { TreeOption } from 'naive-ui';
|
|
2
2
|
import { BasicTreeProps } from './interface';
|
|
3
|
+
type __VLS_Props = BasicTreeProps;
|
|
4
|
+
type __VLS_PublicProps = {
|
|
5
|
+
modelValue?: any[];
|
|
6
|
+
} & __VLS_Props;
|
|
3
7
|
declare function __VLS_template(): any;
|
|
4
8
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
5
|
-
declare const __VLS_component: import('vue').DefineComponent<
|
|
9
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
6
10
|
treeRef: Readonly<import('vue').ShallowRef<({
|
|
7
11
|
$: import('vue').ComponentInternalInstance;
|
|
8
12
|
$data: {};
|
|
@@ -483,6 +487,7 @@ declare const __VLS_component: import('vue').DefineComponent<BasicTreeProps, {
|
|
|
483
487
|
load: (args_0: any[]) => any;
|
|
484
488
|
select: (args_0: import('..').TreeNode) => any;
|
|
485
489
|
expand: (args_0: import('..').TreeNode) => any;
|
|
490
|
+
"update:modelValue": (...args: unknown[]) => any;
|
|
486
491
|
check: (args_0: import('..').TreeNode) => any;
|
|
487
492
|
"set-data": () => any;
|
|
488
493
|
unselect: (args_0: import('..').TreeNode) => any;
|
|
@@ -497,11 +502,12 @@ declare const __VLS_component: import('vue').DefineComponent<BasicTreeProps, {
|
|
|
497
502
|
"node-dragleave": (args_0: import('..').TreeNode, args_1: DragEvent) => any;
|
|
498
503
|
"node-drop": (args_0: import('..').TreeNode, args_1: DragEvent) => any;
|
|
499
504
|
"check-change": (args_0: import('..').TreeNode, args_1: boolean) => any;
|
|
500
|
-
}, string, import('vue').PublicProps, Readonly<
|
|
505
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
501
506
|
onClick?: ((args_0: import('..').TreeNode, args_1: Event) => any) | undefined;
|
|
502
507
|
onLoad?: ((args_0: any[]) => any) | undefined;
|
|
503
508
|
onSelect?: ((args_0: import('..').TreeNode) => any) | undefined;
|
|
504
509
|
onExpand?: ((args_0: import('..').TreeNode) => any) | undefined;
|
|
510
|
+
"onUpdate:modelValue"?: ((...args: unknown[]) => any) | undefined;
|
|
505
511
|
onCheck?: ((args_0: import('..').TreeNode) => any) | undefined;
|
|
506
512
|
"onSet-data"?: (() => any) | undefined;
|
|
507
513
|
onUnselect?: ((args_0: import('..').TreeNode) => any) | undefined;
|
|
@@ -518,7 +524,7 @@ declare const __VLS_component: import('vue').DefineComponent<BasicTreeProps, {
|
|
|
518
524
|
"onCheck-change"?: ((args_0: import('..').TreeNode, args_1: boolean) => any) | undefined;
|
|
519
525
|
}>, {
|
|
520
526
|
immediate: boolean;
|
|
521
|
-
transform: import('./interface').
|
|
527
|
+
transform: import('./interface').BasicTreeTransformOption | null;
|
|
522
528
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, any, any>;
|
|
523
529
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
524
530
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicTree.vue.d.ts","sourceRoot":"","sources":["../../../src/components/basic-tree/Bas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,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const DEFAULT_TRANSFORM_CONFIG:
|
|
1
|
+
import { BasicTreeTransformOption } from './interface';
|
|
2
|
+
export declare const DEFAULT_TRANSFORM_CONFIG: BasicTreeTransformOption;
|
|
3
3
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/basic-tree/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/basic-tree/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAE3D,eAAO,MAAM,wBAAwB,EAAE,wBAItC,CAAA"}
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import { Fn, KeyValueType } from '@maxax/types';
|
|
2
2
|
import { TreeOption } from 'naive-ui';
|
|
3
3
|
import { TreeInstance, TreeNode, TreeNodeKeyType, TreeProps } from '../tree';
|
|
4
|
-
export interface
|
|
4
|
+
export interface BasicTreeTransformOption {
|
|
5
5
|
id: string;
|
|
6
6
|
children: string;
|
|
7
7
|
pid: string;
|
|
8
|
-
valueField: KeyValueType;
|
|
9
|
-
labelField: KeyValueType;
|
|
10
8
|
}
|
|
11
9
|
export interface BasicTreeProps {
|
|
10
|
+
modelValue?: any[];
|
|
12
11
|
immediate?: boolean;
|
|
13
12
|
api?: Fn;
|
|
14
13
|
beforeFetch?: Fn;
|
|
15
14
|
afterFetch?: Fn;
|
|
16
|
-
transform?:
|
|
15
|
+
transform?: BasicTreeTransformOption | null;
|
|
17
16
|
listField?: string;
|
|
18
|
-
treeConfig?: Omit<TreeProps, 'data'>;
|
|
17
|
+
treeConfig?: Omit<TreeProps, 'data' | 'keyField' | 'titleField'>;
|
|
18
|
+
/** 节点标题字段 */
|
|
19
|
+
labelField?: KeyValueType;
|
|
20
|
+
/** 节点唯一标识字段 */
|
|
21
|
+
valueField?: KeyValueType;
|
|
19
22
|
}
|
|
20
23
|
export interface BasicTreeEmits {
|
|
24
|
+
'update:modelValue': [value: any[]];
|
|
21
25
|
load: [any[]];
|
|
22
26
|
expand: [TreeNode];
|
|
23
27
|
check: [TreeNode];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/components/basic-tree/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEjF,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/components/basic-tree/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEjF,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,cAAc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,gBAAgB,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;IACvC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;IACvC,eAAe,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;IACtC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;IACvC,WAAW,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,IAAI,CAAA;IACzC,WAAW,EAAE,MAAM,UAAU,EAAE,CAAA;IAC/B,QAAQ,EAAE,MAAM,YAAY,GAAG,IAAI,CAAA;IACnC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-event-bus.d.ts","sourceRoot":"","sources":["../../src/composable/use-event-bus.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,yEAGvB,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -30451,25 +30451,30 @@ const XTreeSearch = utils.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__ */ vue.defineComponent({
|
|
30459
30457
|
__name: "BasicTree",
|
|
30460
|
-
props: {
|
|
30458
|
+
props: /* @__PURE__ */ vue.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__ */ vue.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 = vue.useModel(__props, "modelValue");
|
|
30473
30478
|
const slots = vue.useSlots();
|
|
30474
30479
|
const { b, e } = useNamespace("basic-tree");
|
|
30475
30480
|
const treeRef = vue.useTemplateRef("treeRef");
|
|
@@ -30495,8 +30500,16 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
30495
30500
|
}));
|
|
30496
30501
|
const treeArray = vue.ref([]);
|
|
30497
30502
|
const loading = vue.ref(true);
|
|
30503
|
+
function formatterTreeData(data) {
|
|
30504
|
+
return utils.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__ */ vue.defineComponent({
|
|
|
30505
30518
|
let resultItems = isArrayResult ? res.data : lodashEs.get(res.data, listField);
|
|
30506
30519
|
resultItems = afterFetch ? await afterFetch(resultItems) : resultItems;
|
|
30507
30520
|
if (transform) {
|
|
30508
|
-
resultItems = utils.listToTree(resultItems, { ...transform || {} });
|
|
30521
|
+
resultItems = utils.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__ */ vue.defineComponent({
|
|
|
30543
30557
|
}, [
|
|
30544
30558
|
vue.createVNode(vue.unref(XTreeSearch), vue.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, vue.toHandlers(vue.unref(treeListeners))), vue.createSlots({ _: 2 }, [
|
|
30548
30564
|
vue.renderList(Object.keys(vue.unref(slots)), (slot) => {
|
|
30549
30565
|
return {
|
|
@@ -30553,7 +30569,7 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
30553
30569
|
])
|
|
30554
30570
|
};
|
|
30555
30571
|
})
|
|
30556
|
-
]), 1040)
|
|
30572
|
+
]), 1040, ["modelValue"])
|
|
30557
30573
|
], 2)), [
|
|
30558
30574
|
[vue.unref(vLoading), loading.value]
|
|
30559
30575
|
])
|