@vuetkit/components 0.0.21 → 0.0.22
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.d.ts +20 -4
- package/dist/index.js +43 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RequestService } from "@vuetkit/core";
|
|
2
|
-
import { CollapseItemProps, CollapseModelValue, CollapseProps, ComponentSize, DescriptionItemProps, DescriptionProps, DialogProps, ElBreadcrumb, ElDropdown, ElMenu, FormRules, MessageProps, MessageType, NotificationOptions, PaginationProps, SegmentedProps, StepProps, StepsProps, TabPaneName, TableProps, TabsPaneContext, TabsProps } from "element-plus";
|
|
2
|
+
import { CollapseItemProps, CollapseModelValue, CollapseProps, ComponentSize, DescriptionItemProps, DescriptionProps, DialogProps, ElBreadcrumb, ElDropdown, ElMenu, FormRules, MessageProps, MessageType, NotificationOptions, PaginationProps, SegmentedProps, StepProps, StepsProps, TabPaneName, TableProps, TabsPaneContext, TabsProps, TreeV2Instance } from "element-plus";
|
|
3
3
|
import { CSSProperties, Component, MaybeRef, Ref, VNode } from "vue";
|
|
4
|
+
import { TreeNode, TreeNodeData, TreeProps } from "element-plus/es/components/tree-v2/src/types";
|
|
4
5
|
import { TableColumnProps } from "element-plus/es/components/table/src/table-column/defaults.mjs";
|
|
5
6
|
|
|
6
7
|
//#region src/data/useCollapse/index.d.ts
|
|
@@ -56,6 +57,21 @@ interface SegmentedOptions<T> extends Partial<SegmentedProps> {
|
|
|
56
57
|
type SegmentedReturnType = [Component, Ref<SegmentedOptionValue | undefined>];
|
|
57
58
|
declare function useSegmented<T>(options: SegmentedOptions<T>): SegmentedReturnType;
|
|
58
59
|
//#endregion
|
|
60
|
+
//#region src/data/useTreeV2/index.d.ts
|
|
61
|
+
interface TreeV2Column extends TreeNodeData {
|
|
62
|
+
children?: TreeV2Column[];
|
|
63
|
+
render?: (node: TreeNode, data: TreeNodeData) => VNode;
|
|
64
|
+
}
|
|
65
|
+
interface TreeV2Options<T> extends Omit<TreeProps, 'data'> {
|
|
66
|
+
data?: TreeV2Column[];
|
|
67
|
+
service?: RequestService<T>;
|
|
68
|
+
params?: unknown;
|
|
69
|
+
formatData?: (data: T) => TreeV2Column[];
|
|
70
|
+
render?: (node: TreeNode, data: TreeNodeData) => VNode;
|
|
71
|
+
}
|
|
72
|
+
type TreeV2ReturnType = [Component, Ref<TreeV2Instance | undefined>];
|
|
73
|
+
declare function useTreeV2<T>(options: TreeV2Options<T>): TreeV2ReturnType;
|
|
74
|
+
//#endregion
|
|
59
75
|
//#region src/feedback/useAsyncConfirm/index.d.ts
|
|
60
76
|
interface AsyncConfirmOptions {
|
|
61
77
|
title?: string;
|
|
@@ -285,14 +301,14 @@ interface TabsOptions<T> extends Partial<TabsProps> {
|
|
|
285
301
|
type TabsReturnType = [Component, Ref<string | number>];
|
|
286
302
|
declare function useTabs<T>(options: TabsOptions<T>): (Ref<string | number, string | number> | import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
287
303
|
modelValue: {
|
|
288
|
-
type: (
|
|
304
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
289
305
|
default: undefined;
|
|
290
306
|
};
|
|
291
307
|
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
292
308
|
[key: string]: any;
|
|
293
309
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
294
310
|
modelValue: {
|
|
295
|
-
type: (
|
|
311
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
296
312
|
default: undefined;
|
|
297
313
|
};
|
|
298
314
|
}>> & Readonly<{}>, {
|
|
@@ -327,4 +343,4 @@ interface TableOptions<T extends DefaultRow> extends TableProps<T> {
|
|
|
327
343
|
type TableReturn = [Component];
|
|
328
344
|
declare function useTable<T extends DefaultRow>(options: TableOptions<T>): TableReturn;
|
|
329
345
|
//#endregion
|
|
330
|
-
export { AsyncConfirmOptions, BreadcrumbColumn, BreadcrumbOptions, BreadcrumbReturnType, CollapseColumn, CollapseOptions, CollapseReturnType, CustomRender, DefaultComponentKey, DescriptionsColumn, DescriptionsOptions, DescriptionsReturnType, DropdownItem, DropdownOptions, DropdownReturnType, FormItemType, FormOptions, FormReturnType, FormRuleFn, FormSchema, MenuColumn, MenuOptions, MenuReturnType, PaginationOptions, Recordable, SegmentedColumn, SegmentedOptionValue, SegmentedOptions, SegmentedReturnType, StepsColumn, StepsOptions, StepsReturnType, TableColumnOptions, TableOptions, TableReturn, TabsColumn, TabsOptions, TabsReturnType, setDeepProperty, useAsyncConfirm, useBreadcrumb, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useNotification, useSegmented, useSteps, useTable, useTabs };
|
|
346
|
+
export { AsyncConfirmOptions, BreadcrumbColumn, BreadcrumbOptions, BreadcrumbReturnType, CollapseColumn, CollapseOptions, CollapseReturnType, CustomRender, DefaultComponentKey, DescriptionsColumn, DescriptionsOptions, DescriptionsReturnType, DropdownItem, DropdownOptions, DropdownReturnType, FormItemType, FormOptions, FormReturnType, FormRuleFn, FormSchema, MenuColumn, MenuOptions, MenuReturnType, PaginationOptions, Recordable, SegmentedColumn, SegmentedOptionValue, SegmentedOptions, SegmentedReturnType, StepsColumn, StepsOptions, StepsReturnType, TableColumnOptions, TableOptions, TableReturn, TabsColumn, TabsOptions, TabsReturnType, TreeV2Column, TreeV2Options, TreeV2ReturnType, setDeepProperty, useAsyncConfirm, useBreadcrumb, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useNotification, useSegmented, useSteps, useTable, useTabs, useTreeV2 };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRequest } from "@vuetkit/core";
|
|
2
|
-
import { ElBreadcrumb, ElBreadcrumbItem, ElButton, ElCascader, ElCheckbox, ElCol, ElCollapse, ElCollapseItem, ElColorPicker, ElDatePicker, ElDescriptions, ElDescriptionsItem, ElDialog, ElDropdown, ElDropdownItem, ElDropdownMenu, ElForm, ElFormItem, ElInput, ElInputNumber, ElInputOtp, ElMention, ElMenu, ElMenuItem, ElMenuItemGroup, ElMessage, ElMessageBox, ElNotification, ElPagination, ElRadio, ElRate, ElRow, ElScrollbar, ElSegmented, ElSelect, ElSelectV2, ElSlider, ElStep, ElSteps, ElSubMenu, ElSwitch, ElTabPane, ElTable, ElTableColumn, ElTabs, ElTimePicker, ElTimeSelect, ElTransfer, ElTreeSelect, ElUpload, vLoading } from "element-plus";
|
|
2
|
+
import { ElBreadcrumb, ElBreadcrumbItem, ElButton, ElCascader, ElCheckbox, ElCol, ElCollapse, ElCollapseItem, ElColorPicker, ElDatePicker, ElDescriptions, ElDescriptionsItem, ElDialog, ElDropdown, ElDropdownItem, ElDropdownMenu, ElForm, ElFormItem, ElInput, ElInputNumber, ElInputOtp, ElMention, ElMenu, ElMenuItem, ElMenuItemGroup, ElMessage, ElMessageBox, ElNotification, ElPagination, ElRadio, ElRate, ElRow, ElScrollbar, ElSegmented, ElSelect, ElSelectV2, ElSlider, ElStep, ElSteps, ElSubMenu, ElSwitch, ElTabPane, ElTable, ElTableColumn, ElTabs, ElTimePicker, ElTimeSelect, ElTransfer, ElTreeSelect, ElTreeV2, ElUpload, vLoading } from "element-plus";
|
|
3
3
|
import { computed, defineComponent, h, nextTick, onMounted, reactive, ref, toValue, useTemplateRef, watch, withDirectives } from "vue";
|
|
4
4
|
import { isFunc, realObj } from "@vuetkit/shared";
|
|
5
5
|
//#region src/data/useCollapse/index.ts
|
|
@@ -161,6 +161,47 @@ function useSegmented(options) {
|
|
|
161
161
|
}), modelValue];
|
|
162
162
|
}
|
|
163
163
|
//#endregion
|
|
164
|
+
//#region src/data/useTreeV2/index.ts
|
|
165
|
+
function useTreeV2(options) {
|
|
166
|
+
const { data = [], service, params, formatData, render, ...rest } = options;
|
|
167
|
+
const { data: resData, loading } = service ? useRequest(service, {
|
|
168
|
+
defaultParams: params,
|
|
169
|
+
formatData: formatData || void 0
|
|
170
|
+
}) : {};
|
|
171
|
+
const treeData = computed(() => (resData === null || resData === void 0 ? void 0 : resData.value) || data);
|
|
172
|
+
const treeRef = ref();
|
|
173
|
+
return [defineComponent((props, { slots }) => {
|
|
174
|
+
const renderNodeContent = (node, nodeData) => {
|
|
175
|
+
const columnRender = nodeData.render;
|
|
176
|
+
if (typeof columnRender === "function") return columnRender(node, nodeData);
|
|
177
|
+
if (typeof render === "function") return render(node, nodeData);
|
|
178
|
+
};
|
|
179
|
+
return () => {
|
|
180
|
+
var _loading$value;
|
|
181
|
+
return withDirectives(h(ElTreeV2, {
|
|
182
|
+
...rest,
|
|
183
|
+
...props,
|
|
184
|
+
ref: treeRef,
|
|
185
|
+
data: treeData.value
|
|
186
|
+
}, {
|
|
187
|
+
default: ({ node, data: nodeData }) => {
|
|
188
|
+
if (slots.default) return slots.default({
|
|
189
|
+
node,
|
|
190
|
+
data: nodeData
|
|
191
|
+
});
|
|
192
|
+
const content = renderNodeContent(node, nodeData);
|
|
193
|
+
if (content) return content;
|
|
194
|
+
return h("span", {}, node.label);
|
|
195
|
+
},
|
|
196
|
+
empty: () => {
|
|
197
|
+
var _slots$empty;
|
|
198
|
+
return (_slots$empty = slots.empty) === null || _slots$empty === void 0 ? void 0 : _slots$empty.call(slots);
|
|
199
|
+
}
|
|
200
|
+
}), [[vLoading, (_loading$value = loading === null || loading === void 0 ? void 0 : loading.value) !== null && _loading$value !== void 0 ? _loading$value : false]]);
|
|
201
|
+
};
|
|
202
|
+
}), treeRef];
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
164
205
|
//#region src/feedback/useMessage/index.ts
|
|
165
206
|
const DEFAULT_DURATION$1 = 3e3;
|
|
166
207
|
const DEFAULT_SHOW_CLOSE$1 = true;
|
|
@@ -958,4 +999,4 @@ function useTable(options) {
|
|
|
958
999
|
})];
|
|
959
1000
|
}
|
|
960
1001
|
//#endregion
|
|
961
|
-
export { setDeepProperty, useAsyncConfirm, useBreadcrumb, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useNotification, useSegmented, useSteps, useTable, useTabs };
|
|
1002
|
+
export { setDeepProperty, useAsyncConfirm, useBreadcrumb, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useNotification, useSegmented, useSteps, useTable, useTabs, useTreeV2 };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuetkit/components",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.22",
|
|
5
5
|
"description": "Collection of business development components for Vue3 projects",
|
|
6
6
|
"author": "Kalu5",
|
|
7
7
|
"license": "MIT",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"vue": "^3.5.35"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@vuetkit/
|
|
25
|
-
"@vuetkit/
|
|
24
|
+
"@vuetkit/shared": "0.0.22",
|
|
25
|
+
"@vuetkit/core": "0.0.22"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsdown --config-loader tsx"
|