@vuetkit/components 0.0.19 → 0.0.21
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 +38 -2
- package/dist/index.js +81 -2
- 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, NotificationOptions, 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, SegmentedProps, 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
|
|
|
@@ -37,6 +37,25 @@ interface DescriptionsOptions<T> extends DescriptionProps {
|
|
|
37
37
|
type DescriptionsReturnType = [Component];
|
|
38
38
|
declare function useDescriptions<T>(options: DescriptionsOptions<T>): import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>[];
|
|
39
39
|
//#endregion
|
|
40
|
+
//#region src/data/useSegmented/index.d.ts
|
|
41
|
+
type SegmentedOptionValue = string | number | boolean;
|
|
42
|
+
interface SegmentedColumn {
|
|
43
|
+
value?: SegmentedOptionValue;
|
|
44
|
+
label?: string;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
render?: (item: SegmentedColumn) => VNode;
|
|
47
|
+
}
|
|
48
|
+
interface SegmentedOptions<T> extends Partial<SegmentedProps> {
|
|
49
|
+
columns?: SegmentedColumn[];
|
|
50
|
+
service?: RequestService<T>;
|
|
51
|
+
params?: unknown;
|
|
52
|
+
formatData?: (data: T) => SegmentedColumn[];
|
|
53
|
+
defaultValue?: SegmentedOptionValue;
|
|
54
|
+
onChange?: (val: SegmentedOptionValue) => void;
|
|
55
|
+
}
|
|
56
|
+
type SegmentedReturnType = [Component, Ref<SegmentedOptionValue | undefined>];
|
|
57
|
+
declare function useSegmented<T>(options: SegmentedOptions<T>): SegmentedReturnType;
|
|
58
|
+
//#endregion
|
|
40
59
|
//#region src/feedback/useAsyncConfirm/index.d.ts
|
|
41
60
|
interface AsyncConfirmOptions {
|
|
42
61
|
title?: string;
|
|
@@ -134,6 +153,23 @@ declare function setDeepProperty(data: Recordable, propArr: string[], value: unk
|
|
|
134
153
|
declare function useForm(options: undefined): [null, Recordable];
|
|
135
154
|
declare function useForm<T extends object>(options: FormOptions<T>): FormReturnType<T>;
|
|
136
155
|
//#endregion
|
|
156
|
+
//#region src/navigation/useBreadcrumb/index.d.ts
|
|
157
|
+
type ElBreadcrumbProps = InstanceType<typeof ElBreadcrumb>['$props'];
|
|
158
|
+
interface BreadcrumbColumn {
|
|
159
|
+
label?: string;
|
|
160
|
+
to?: unknown;
|
|
161
|
+
replace?: boolean;
|
|
162
|
+
render?: (val: unknown) => VNode;
|
|
163
|
+
}
|
|
164
|
+
interface BreadcrumbOptions<T> extends Partial<ElBreadcrumbProps> {
|
|
165
|
+
items?: BreadcrumbColumn[];
|
|
166
|
+
service?: RequestService<T>;
|
|
167
|
+
params?: unknown;
|
|
168
|
+
formatData?: (data: T) => BreadcrumbColumn[];
|
|
169
|
+
}
|
|
170
|
+
type BreadcrumbReturnType = [Component];
|
|
171
|
+
declare function useBreadcrumb<T>(options: BreadcrumbOptions<T>): BreadcrumbReturnType;
|
|
172
|
+
//#endregion
|
|
137
173
|
//#region src/navigation/useDropdown/index.d.ts
|
|
138
174
|
type ElDropdownProps = InstanceType<typeof ElDropdown>['$props'];
|
|
139
175
|
interface DropdownItem {
|
|
@@ -291,4 +327,4 @@ interface TableOptions<T extends DefaultRow> extends TableProps<T> {
|
|
|
291
327
|
type TableReturn = [Component];
|
|
292
328
|
declare function useTable<T extends DefaultRow>(options: TableOptions<T>): TableReturn;
|
|
293
329
|
//#endregion
|
|
294
|
-
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, useNotification, useSteps, useTable, useTabs };
|
|
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 };
|
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, 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";
|
|
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";
|
|
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
|
|
@@ -111,6 +111,56 @@ function useDescriptions(options) {
|
|
|
111
111
|
})];
|
|
112
112
|
}
|
|
113
113
|
//#endregion
|
|
114
|
+
//#region src/data/useSegmented/index.ts
|
|
115
|
+
function useSegmented(options) {
|
|
116
|
+
const { columns = [], service, params, formatData, defaultValue, onChange, ...rest } = options;
|
|
117
|
+
const { data, loading } = service ? useRequest(service, {
|
|
118
|
+
defaultParams: params,
|
|
119
|
+
formatData: formatData || void 0
|
|
120
|
+
}) : {};
|
|
121
|
+
const modelValue = ref(defaultValue);
|
|
122
|
+
const segmentedColumns = computed(() => (data === null || data === void 0 ? void 0 : data.value) || columns);
|
|
123
|
+
return [defineComponent({
|
|
124
|
+
props: { modelValue: {
|
|
125
|
+
type: [
|
|
126
|
+
String,
|
|
127
|
+
Number,
|
|
128
|
+
Boolean
|
|
129
|
+
],
|
|
130
|
+
default: void 0
|
|
131
|
+
} },
|
|
132
|
+
setup(props, { slots, emit }) {
|
|
133
|
+
const hasCustomRender = computed(() => segmentedColumns.value.some((col) => col && typeof col === "object" && typeof col.render === "function"));
|
|
134
|
+
const renderDefault = (scope) => {
|
|
135
|
+
var _slots$default;
|
|
136
|
+
const item = scope === null || scope === void 0 ? void 0 : scope.item;
|
|
137
|
+
if (item && typeof item === "object" && typeof item.render === "function") return item.render(item);
|
|
138
|
+
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots, scope);
|
|
139
|
+
};
|
|
140
|
+
const handleChange = (val) => {
|
|
141
|
+
modelValue.value = val;
|
|
142
|
+
onChange === null || onChange === void 0 || onChange(val);
|
|
143
|
+
emit("change", val);
|
|
144
|
+
emit("update:modelValue", val);
|
|
145
|
+
};
|
|
146
|
+
return () => {
|
|
147
|
+
var _ref, _props$modelValue, _loading$value;
|
|
148
|
+
const finalModelValue = (_ref = (_props$modelValue = props.modelValue) !== null && _props$modelValue !== void 0 ? _props$modelValue : rest.modelValue) !== null && _ref !== void 0 ? _ref : modelValue.value;
|
|
149
|
+
const slotsObj = {};
|
|
150
|
+
if (hasCustomRender.value || slots.default) slotsObj.default = renderDefault;
|
|
151
|
+
return withDirectives(h(ElSegmented, {
|
|
152
|
+
...rest,
|
|
153
|
+
...props,
|
|
154
|
+
"options": segmentedColumns.value,
|
|
155
|
+
"modelValue": finalModelValue,
|
|
156
|
+
"onUpdate:modelValue": handleChange,
|
|
157
|
+
"onChange": handleChange
|
|
158
|
+
}, slotsObj), [[vLoading, (_loading$value = loading === null || loading === void 0 ? void 0 : loading.value) !== null && _loading$value !== void 0 ? _loading$value : false]]);
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}), modelValue];
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
114
164
|
//#region src/feedback/useMessage/index.ts
|
|
115
165
|
const DEFAULT_DURATION$1 = 3e3;
|
|
116
166
|
const DEFAULT_SHOW_CLOSE$1 = true;
|
|
@@ -473,6 +523,35 @@ function useForm(options) {
|
|
|
473
523
|
}];
|
|
474
524
|
}
|
|
475
525
|
//#endregion
|
|
526
|
+
//#region src/navigation/useBreadcrumb/index.ts
|
|
527
|
+
function useBreadcrumb(options) {
|
|
528
|
+
const { items = [], service, params, formatData, ...rest } = options;
|
|
529
|
+
const { data, loading } = service ? useRequest(service, {
|
|
530
|
+
defaultParams: params,
|
|
531
|
+
formatData: formatData || void 0
|
|
532
|
+
}) : {};
|
|
533
|
+
const breadcrumbColumns = computed(() => (data === null || data === void 0 ? void 0 : data.value) || items);
|
|
534
|
+
const renderBreadcrumbItem = (item) => {
|
|
535
|
+
return h(ElBreadcrumbItem, {
|
|
536
|
+
to: item.to,
|
|
537
|
+
replace: item.replace
|
|
538
|
+
}, { default: () => {
|
|
539
|
+
if (item === null || item === void 0 ? void 0 : item.render) return item.render(item);
|
|
540
|
+
return item.label || "";
|
|
541
|
+
} });
|
|
542
|
+
};
|
|
543
|
+
return [defineComponent({ setup(_, { slots }) {
|
|
544
|
+
return () => {
|
|
545
|
+
var _loading$value;
|
|
546
|
+
return withDirectives(h(ElBreadcrumb, { ...rest }, { default: () => {
|
|
547
|
+
if (slots.default) return slots.default();
|
|
548
|
+
if (!breadcrumbColumns.value.length) return "";
|
|
549
|
+
return breadcrumbColumns.value.map((item) => renderBreadcrumbItem(item));
|
|
550
|
+
} }), [[vLoading, (_loading$value = loading === null || loading === void 0 ? void 0 : loading.value) !== null && _loading$value !== void 0 ? _loading$value : false]]);
|
|
551
|
+
};
|
|
552
|
+
} })];
|
|
553
|
+
}
|
|
554
|
+
//#endregion
|
|
476
555
|
//#region src/navigation/useDropdown/index.ts
|
|
477
556
|
function useDropdown(options) {
|
|
478
557
|
const { items = [], service, params, formatData, defaultCommand, onCommand, onVisibleChange, onClick, ...rest } = options;
|
|
@@ -879,4 +958,4 @@ function useTable(options) {
|
|
|
879
958
|
})];
|
|
880
959
|
}
|
|
881
960
|
//#endregion
|
|
882
|
-
export { setDeepProperty, useAsyncConfirm, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useNotification, useSteps, useTable, useTabs };
|
|
961
|
+
export { setDeepProperty, useAsyncConfirm, useBreadcrumb, useCollapse, useDescriptions, useDialog, useDropdown, useForm, useMenu, useMessage, useNotification, useSegmented, 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.21",
|
|
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.21",
|
|
25
|
+
"@vuetkit/shared": "0.0.21"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsdown --config-loader tsx"
|