@vuetkit/components 0.0.18 → 0.0.20
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 +29 -2
- package/dist/index.js +83 -6
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestService } from "@vuetkit/core";
|
|
2
|
-
import { CollapseItemProps, CollapseModelValue, CollapseProps, ComponentSize, DescriptionItemProps, DescriptionProps, DialogProps, ElDropdown, ElMenu, FormRules, MessageProps, MessageType, PaginationProps, 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, StepProps, StepsProps, TabPaneName, TableProps, TabsPaneContext, TabsProps } from "element-plus";
|
|
3
3
|
import { CSSProperties, Component, MaybeRef, Ref, VNode } from "vue";
|
|
4
4
|
import { TableColumnProps } from "element-plus/es/components/table/src/table-column/defaults.mjs";
|
|
5
5
|
|
|
@@ -73,6 +73,16 @@ declare function useMessage(options?: MessageProps): {
|
|
|
73
73
|
closeAll: () => void;
|
|
74
74
|
};
|
|
75
75
|
//#endregion
|
|
76
|
+
//#region src/feedback/useNotification/index.d.ts
|
|
77
|
+
declare function useNotification(options?: NotificationOptions): {
|
|
78
|
+
primary: (message: string, title?: string) => import("element-plus").NotificationHandle;
|
|
79
|
+
success: (message: string, title?: string) => import("element-plus").NotificationHandle;
|
|
80
|
+
error: (message: string, title?: string) => import("element-plus").NotificationHandle;
|
|
81
|
+
warning: (message: string, title?: string) => import("element-plus").NotificationHandle;
|
|
82
|
+
info: (message: string, title?: string) => import("element-plus").NotificationHandle;
|
|
83
|
+
closeAll: () => void;
|
|
84
|
+
};
|
|
85
|
+
//#endregion
|
|
76
86
|
//#region src/form/useForm/index.d.ts
|
|
77
87
|
type CustomRender = (...args: unknown[]) => unknown;
|
|
78
88
|
type Recordable = Record<string, unknown>;
|
|
@@ -124,6 +134,23 @@ declare function setDeepProperty(data: Recordable, propArr: string[], value: unk
|
|
|
124
134
|
declare function useForm(options: undefined): [null, Recordable];
|
|
125
135
|
declare function useForm<T extends object>(options: FormOptions<T>): FormReturnType<T>;
|
|
126
136
|
//#endregion
|
|
137
|
+
//#region src/navigation/useBreadcrumb/index.d.ts
|
|
138
|
+
type ElBreadcrumbProps = InstanceType<typeof ElBreadcrumb>['$props'];
|
|
139
|
+
interface BreadcrumbColumn {
|
|
140
|
+
label?: string;
|
|
141
|
+
to?: unknown;
|
|
142
|
+
replace?: boolean;
|
|
143
|
+
render?: (val: unknown) => VNode;
|
|
144
|
+
}
|
|
145
|
+
interface BreadcrumbOptions<T> extends Partial<ElBreadcrumbProps> {
|
|
146
|
+
items?: BreadcrumbColumn[];
|
|
147
|
+
service?: RequestService<T>;
|
|
148
|
+
params?: unknown;
|
|
149
|
+
formatData?: (data: T) => BreadcrumbColumn[];
|
|
150
|
+
}
|
|
151
|
+
type BreadcrumbReturnType = [Component];
|
|
152
|
+
declare function useBreadcrumb<T>(options: BreadcrumbOptions<T>): BreadcrumbReturnType;
|
|
153
|
+
//#endregion
|
|
127
154
|
//#region src/navigation/useDropdown/index.d.ts
|
|
128
155
|
type ElDropdownProps = InstanceType<typeof ElDropdown>['$props'];
|
|
129
156
|
interface DropdownItem {
|
|
@@ -281,4 +308,4 @@ interface TableOptions<T extends DefaultRow> extends TableProps<T> {
|
|
|
281
308
|
type TableReturn = [Component];
|
|
282
309
|
declare function useTable<T extends DefaultRow>(options: TableOptions<T>): TableReturn;
|
|
283
310
|
//#endregion
|
|
284
|
-
export { AsyncConfirmOptions, CollapseColumn, CollapseOptions, CollapseReturnType, CustomRender, DefaultComponentKey, DescriptionsColumn, DescriptionsOptions, DescriptionsReturnType, DropdownItem, DropdownOptions, DropdownReturnType, FormItemType, FormOptions, FormReturnType, FormRuleFn, FormSchema, MenuColumn, MenuOptions, MenuReturnType, PaginationOptions, Recordable, StepsColumn, StepsOptions, StepsReturnType, TableColumnOptions, TableOptions, TableReturn, TabsColumn, TabsOptions, TabsReturnType, setDeepProperty, useAsyncConfirm, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useSteps, useTable, useTabs };
|
|
311
|
+
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, StepsColumn, StepsOptions, StepsReturnType, TableColumnOptions, TableOptions, TableReturn, TabsColumn, TabsOptions, TabsReturnType, setDeepProperty, useAsyncConfirm, useBreadcrumb, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useNotification, useSteps, useTable, useTabs };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRequest } from "@vuetkit/core";
|
|
2
|
-
import { 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, ElPagination, ElRadio, ElRate, ElRow, ElScrollbar, 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, ElSelect, ElSelectV2, ElSlider, ElStep, ElSteps, ElSubMenu, ElSwitch, ElTabPane, ElTable, ElTableColumn, ElTabs, ElTimePicker, ElTimeSelect, ElTransfer, ElTreeSelect, 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
|
|
@@ -112,16 +112,16 @@ function useDescriptions(options) {
|
|
|
112
112
|
}
|
|
113
113
|
//#endregion
|
|
114
114
|
//#region src/feedback/useMessage/index.ts
|
|
115
|
-
const DEFAULT_DURATION = 3e3;
|
|
116
|
-
const DEFAULT_SHOW_CLOSE = true;
|
|
115
|
+
const DEFAULT_DURATION$1 = 3e3;
|
|
116
|
+
const DEFAULT_SHOW_CLOSE$1 = true;
|
|
117
117
|
const DEFAULT_PLAIN = true;
|
|
118
118
|
const DEFAULT_GROUPING = true;
|
|
119
119
|
function useMessage(options = {}) {
|
|
120
120
|
var _options$duration, _options$showClose, _options$plain, _options$grouping;
|
|
121
121
|
const mergedOptions = {
|
|
122
122
|
...options,
|
|
123
|
-
duration: (_options$duration = options.duration) !== null && _options$duration !== void 0 ? _options$duration : DEFAULT_DURATION,
|
|
124
|
-
showClose: (_options$showClose = options.showClose) !== null && _options$showClose !== void 0 ? _options$showClose : DEFAULT_SHOW_CLOSE,
|
|
123
|
+
duration: (_options$duration = options.duration) !== null && _options$duration !== void 0 ? _options$duration : DEFAULT_DURATION$1,
|
|
124
|
+
showClose: (_options$showClose = options.showClose) !== null && _options$showClose !== void 0 ? _options$showClose : DEFAULT_SHOW_CLOSE$1,
|
|
125
125
|
plain: (_options$plain = options.plain) !== null && _options$plain !== void 0 ? _options$plain : DEFAULT_PLAIN,
|
|
126
126
|
grouping: (_options$grouping = options.grouping) !== null && _options$grouping !== void 0 ? _options$grouping : DEFAULT_GROUPING
|
|
127
127
|
};
|
|
@@ -233,6 +233,54 @@ function useDialog(options) {
|
|
|
233
233
|
}];
|
|
234
234
|
}
|
|
235
235
|
//#endregion
|
|
236
|
+
//#region src/feedback/useNotification/index.ts
|
|
237
|
+
const DEFAULT_DURATION = 4500;
|
|
238
|
+
const DEFAULT_SHOW_CLOSE = true;
|
|
239
|
+
const DEFAULT_POSITION = "top-right";
|
|
240
|
+
function useNotification(options = {}) {
|
|
241
|
+
var _options$duration, _options$showClose, _options$position;
|
|
242
|
+
const mergedOptions = {
|
|
243
|
+
...options,
|
|
244
|
+
duration: (_options$duration = options.duration) !== null && _options$duration !== void 0 ? _options$duration : DEFAULT_DURATION,
|
|
245
|
+
showClose: (_options$showClose = options.showClose) !== null && _options$showClose !== void 0 ? _options$showClose : DEFAULT_SHOW_CLOSE,
|
|
246
|
+
position: (_options$position = options.position) !== null && _options$position !== void 0 ? _options$position : DEFAULT_POSITION
|
|
247
|
+
};
|
|
248
|
+
function createNotification(message, type, title) {
|
|
249
|
+
return ElNotification({
|
|
250
|
+
...mergedOptions,
|
|
251
|
+
message,
|
|
252
|
+
type,
|
|
253
|
+
title: title !== null && title !== void 0 ? title : mergedOptions.title
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function closeAll() {
|
|
257
|
+
ElNotification.closeAll();
|
|
258
|
+
}
|
|
259
|
+
function primary(message, title) {
|
|
260
|
+
return createNotification(message, "primary", title);
|
|
261
|
+
}
|
|
262
|
+
function success(message, title) {
|
|
263
|
+
return createNotification(message, "success", title);
|
|
264
|
+
}
|
|
265
|
+
function error(message, title) {
|
|
266
|
+
return createNotification(message, "error", title);
|
|
267
|
+
}
|
|
268
|
+
function warning(message, title) {
|
|
269
|
+
return createNotification(message, "warning", title);
|
|
270
|
+
}
|
|
271
|
+
function info(message, title) {
|
|
272
|
+
return createNotification(message, "info", title);
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
primary,
|
|
276
|
+
success,
|
|
277
|
+
error,
|
|
278
|
+
warning,
|
|
279
|
+
info,
|
|
280
|
+
closeAll
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
//#endregion
|
|
236
284
|
//#region src/form/useForm/index.ts
|
|
237
285
|
const defaultComponent = {
|
|
238
286
|
"input": ElInput,
|
|
@@ -425,6 +473,35 @@ function useForm(options) {
|
|
|
425
473
|
}];
|
|
426
474
|
}
|
|
427
475
|
//#endregion
|
|
476
|
+
//#region src/navigation/useBreadcrumb/index.ts
|
|
477
|
+
function useBreadcrumb(options) {
|
|
478
|
+
const { items = [], service, params, formatData, ...rest } = options;
|
|
479
|
+
const { data, loading } = service ? useRequest(service, {
|
|
480
|
+
defaultParams: params,
|
|
481
|
+
formatData: formatData || void 0
|
|
482
|
+
}) : {};
|
|
483
|
+
const breadcrumbColumns = computed(() => (data === null || data === void 0 ? void 0 : data.value) || items);
|
|
484
|
+
const renderBreadcrumbItem = (item) => {
|
|
485
|
+
return h(ElBreadcrumbItem, {
|
|
486
|
+
to: item.to,
|
|
487
|
+
replace: item.replace
|
|
488
|
+
}, { default: () => {
|
|
489
|
+
if (item === null || item === void 0 ? void 0 : item.render) return item.render(item);
|
|
490
|
+
return item.label || "";
|
|
491
|
+
} });
|
|
492
|
+
};
|
|
493
|
+
return [defineComponent({ setup(_, { slots }) {
|
|
494
|
+
return () => {
|
|
495
|
+
var _loading$value;
|
|
496
|
+
return withDirectives(h(ElBreadcrumb, { ...rest }, { default: () => {
|
|
497
|
+
if (slots.default) return slots.default();
|
|
498
|
+
if (!breadcrumbColumns.value.length) return "";
|
|
499
|
+
return breadcrumbColumns.value.map((item) => renderBreadcrumbItem(item));
|
|
500
|
+
} }), [[vLoading, (_loading$value = loading === null || loading === void 0 ? void 0 : loading.value) !== null && _loading$value !== void 0 ? _loading$value : false]]);
|
|
501
|
+
};
|
|
502
|
+
} })];
|
|
503
|
+
}
|
|
504
|
+
//#endregion
|
|
428
505
|
//#region src/navigation/useDropdown/index.ts
|
|
429
506
|
function useDropdown(options) {
|
|
430
507
|
const { items = [], service, params, formatData, defaultCommand, onCommand, onVisibleChange, onClick, ...rest } = options;
|
|
@@ -831,4 +908,4 @@ function useTable(options) {
|
|
|
831
908
|
})];
|
|
832
909
|
}
|
|
833
910
|
//#endregion
|
|
834
|
-
export { setDeepProperty, useAsyncConfirm, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useSteps, useTable, useTabs };
|
|
911
|
+
export { setDeepProperty, useAsyncConfirm, useBreadcrumb, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useNotification, useSteps, useTable, useTabs };
|
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.20",
|
|
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.20",
|
|
25
|
+
"@vuetkit/shared": "0.0.20"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsdown --config-loader tsx"
|