@vuetkit/components 0.0.21 → 0.0.23
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 +34 -2
- package/dist/index.js +84 -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, RenderContentContext, SegmentedProps, StepProps, StepsProps, TabPaneName, TableProps, TabsPaneContext, TabsProps, TreeComponentProps, TreeInstance, TreeNodeData, TreeV2Instance } from "element-plus";
|
|
3
3
|
import { CSSProperties, Component, MaybeRef, Ref, VNode } from "vue";
|
|
4
|
+
import { TreeNode, TreeNodeData as TreeNodeData$1, 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,37 @@ 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/useTree/index.d.ts
|
|
61
|
+
type TreeNode$1 = RenderContentContext['node'];
|
|
62
|
+
interface TreeColumn extends TreeNodeData {
|
|
63
|
+
children?: TreeColumn[];
|
|
64
|
+
render?: (node: TreeNode$1, data: TreeNodeData) => VNode;
|
|
65
|
+
}
|
|
66
|
+
interface TreeOptions<T> extends Partial<Omit<TreeComponentProps, 'data'>> {
|
|
67
|
+
data?: TreeColumn[];
|
|
68
|
+
service?: RequestService<T>;
|
|
69
|
+
params?: unknown;
|
|
70
|
+
formatData?: (data: T) => TreeColumn[];
|
|
71
|
+
render?: (node: TreeNode$1, data: TreeNodeData) => VNode;
|
|
72
|
+
}
|
|
73
|
+
type TreeReturnType = [Component, Ref<TreeInstance | undefined>];
|
|
74
|
+
declare function useTree<T>(options: TreeOptions<T>): TreeReturnType;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/data/useTreeV2/index.d.ts
|
|
77
|
+
interface TreeV2Column extends TreeNodeData$1 {
|
|
78
|
+
children?: TreeV2Column[];
|
|
79
|
+
render?: (node: TreeNode, data: TreeNodeData$1) => VNode;
|
|
80
|
+
}
|
|
81
|
+
interface TreeV2Options<T> extends Omit<TreeProps, 'data'> {
|
|
82
|
+
data?: TreeV2Column[];
|
|
83
|
+
service?: RequestService<T>;
|
|
84
|
+
params?: unknown;
|
|
85
|
+
formatData?: (data: T) => TreeV2Column[];
|
|
86
|
+
render?: (node: TreeNode, data: TreeNodeData$1) => VNode;
|
|
87
|
+
}
|
|
88
|
+
type TreeV2ReturnType = [Component, Ref<TreeV2Instance | undefined>];
|
|
89
|
+
declare function useTreeV2<T>(options: TreeV2Options<T>): TreeV2ReturnType;
|
|
90
|
+
//#endregion
|
|
59
91
|
//#region src/feedback/useAsyncConfirm/index.d.ts
|
|
60
92
|
interface AsyncConfirmOptions {
|
|
61
93
|
title?: string;
|
|
@@ -327,4 +359,4 @@ interface TableOptions<T extends DefaultRow> extends TableProps<T> {
|
|
|
327
359
|
type TableReturn = [Component];
|
|
328
360
|
declare function useTable<T extends DefaultRow>(options: TableOptions<T>): TableReturn;
|
|
329
361
|
//#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 };
|
|
362
|
+
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, TreeColumn, TreeOptions, TreeReturnType, TreeV2Column, TreeV2Options, TreeV2ReturnType, setDeepProperty, useAsyncConfirm, useBreadcrumb, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useNotification, useSegmented, useSteps, useTable, useTabs, useTree, 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, ElTree, 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,88 @@ function useSegmented(options) {
|
|
|
161
161
|
}), modelValue];
|
|
162
162
|
}
|
|
163
163
|
//#endregion
|
|
164
|
+
//#region src/data/useTree/index.ts
|
|
165
|
+
function useTree(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(ElTree, {
|
|
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
|
|
205
|
+
//#region src/data/useTreeV2/index.ts
|
|
206
|
+
function useTreeV2(options) {
|
|
207
|
+
const { data = [], service, params, formatData, render, ...rest } = options;
|
|
208
|
+
const { data: resData, loading } = service ? useRequest(service, {
|
|
209
|
+
defaultParams: params,
|
|
210
|
+
formatData: formatData || void 0
|
|
211
|
+
}) : {};
|
|
212
|
+
const treeData = computed(() => (resData === null || resData === void 0 ? void 0 : resData.value) || data);
|
|
213
|
+
const treeRef = ref();
|
|
214
|
+
return [defineComponent((props, { slots }) => {
|
|
215
|
+
const renderNodeContent = (node, nodeData) => {
|
|
216
|
+
const columnRender = nodeData.render;
|
|
217
|
+
if (typeof columnRender === "function") return columnRender(node, nodeData);
|
|
218
|
+
if (typeof render === "function") return render(node, nodeData);
|
|
219
|
+
};
|
|
220
|
+
return () => {
|
|
221
|
+
var _loading$value;
|
|
222
|
+
return withDirectives(h(ElTreeV2, {
|
|
223
|
+
...rest,
|
|
224
|
+
...props,
|
|
225
|
+
ref: treeRef,
|
|
226
|
+
data: treeData.value
|
|
227
|
+
}, {
|
|
228
|
+
default: ({ node, data: nodeData }) => {
|
|
229
|
+
if (slots.default) return slots.default({
|
|
230
|
+
node,
|
|
231
|
+
data: nodeData
|
|
232
|
+
});
|
|
233
|
+
const content = renderNodeContent(node, nodeData);
|
|
234
|
+
if (content) return content;
|
|
235
|
+
return h("span", {}, node.label);
|
|
236
|
+
},
|
|
237
|
+
empty: () => {
|
|
238
|
+
var _slots$empty;
|
|
239
|
+
return (_slots$empty = slots.empty) === null || _slots$empty === void 0 ? void 0 : _slots$empty.call(slots);
|
|
240
|
+
}
|
|
241
|
+
}), [[vLoading, (_loading$value = loading === null || loading === void 0 ? void 0 : loading.value) !== null && _loading$value !== void 0 ? _loading$value : false]]);
|
|
242
|
+
};
|
|
243
|
+
}), treeRef];
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
164
246
|
//#region src/feedback/useMessage/index.ts
|
|
165
247
|
const DEFAULT_DURATION$1 = 3e3;
|
|
166
248
|
const DEFAULT_SHOW_CLOSE$1 = true;
|
|
@@ -958,4 +1040,4 @@ function useTable(options) {
|
|
|
958
1040
|
})];
|
|
959
1041
|
}
|
|
960
1042
|
//#endregion
|
|
961
|
-
export { setDeepProperty, useAsyncConfirm, useBreadcrumb, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useNotification, useSegmented, useSteps, useTable, useTabs };
|
|
1043
|
+
export { setDeepProperty, useAsyncConfirm, useBreadcrumb, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useNotification, useSegmented, useSteps, useTable, useTabs, useTree, 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.23",
|
|
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/core": "0.0.
|
|
25
|
-
"@vuetkit/shared": "0.0.
|
|
24
|
+
"@vuetkit/core": "0.0.23",
|
|
25
|
+
"@vuetkit/shared": "0.0.23"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsdown --config-loader tsx"
|