@vuetkit/components 0.0.11 → 0.0.12

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/README.md CHANGED
@@ -10,6 +10,7 @@ Collection of business development Composable Components for Vue3 + ElementPlus
10
10
 
11
11
  - [useMessage](/components/src/feedback/useMessage/)
12
12
  - [useAsyncConfirm](/components/src/feedback/useAsyncConfirm/)
13
+ - [useDialog](/components/src/feedback/useDialog/)
13
14
 
14
15
  ### Form
15
16
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RequestService } from "@vuetkit/core";
2
- import { ComponentSize, FormRules, MessageProps, MessageType, PaginationProps, TableProps } from "element-plus";
2
+ import { ComponentSize, DialogProps, FormRules, MessageProps, MessageType, PaginationProps, TableProps } from "element-plus";
3
3
  import { CSSProperties, Component, MaybeRef, VNode } from "vue";
4
4
  import { TableColumnProps } from "element-plus/es/components/table/src/table-column/defaults.mjs";
5
5
 
@@ -20,6 +20,16 @@ declare function useAsyncConfirm(confirmService: RequestService, options: AsyncC
20
20
  confirm: (params?: unknown) => void;
21
21
  };
22
22
  //#endregion
23
+ //#region src/feedback/useDialog/index.d.ts
24
+ interface DialogOptions extends DialogProps {
25
+ title?: string;
26
+ }
27
+ type DialogReturn = [Component, {
28
+ open: () => void;
29
+ close: () => void;
30
+ }];
31
+ declare function useDialog(options: DialogOptions): DialogReturn;
32
+ //#endregion
23
33
  //#region src/feedback/useMessage/index.d.ts
24
34
  declare function useMessage(options?: MessageProps): {
25
35
  success: (message: string) => import("element-plus").MessageHandler;
@@ -104,4 +114,4 @@ interface TableOptions<T extends DefaultRow> extends TableProps<T> {
104
114
  type TableReturn = [Component];
105
115
  declare function useTable<T extends DefaultRow>(options: TableOptions<T>): TableReturn;
106
116
  //#endregion
107
- export { AsyncConfirmOptions, CustomRender, DefaultComponentKey, FormItemType, FormOptions, FormReturnType, FormRuleFn, FormSchema, PaginationOptions, Recordable, TableColumnOptions, TableOptions, TableReturn, setDeepProperty, useAsyncConfirm, useForm, useMessage, useTable };
117
+ export { AsyncConfirmOptions, CustomRender, DefaultComponentKey, FormItemType, FormOptions, FormReturnType, FormRuleFn, FormSchema, PaginationOptions, Recordable, TableColumnOptions, TableOptions, TableReturn, setDeepProperty, useAsyncConfirm, useDialog, useForm, useMessage, useTable };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { useRequest } from "@vuetkit/core";
2
- import { ElButton, ElCascader, ElCheckbox, ElCol, ElColorPicker, ElDatePicker, ElForm, ElFormItem, ElInput, ElInputNumber, ElInputOtp, ElMention, ElMessage, ElMessageBox, ElPagination, ElRadio, ElRate, ElRow, ElSelect, ElSelectV2, ElSlider, ElSwitch, ElTable, ElTableColumn, ElTimePicker, ElTimeSelect, ElTransfer, ElTreeSelect, ElUpload, vLoading } from "element-plus";
3
- import { isFunc, realObj } from "@vuetkit/shared";
2
+ import { ElButton, ElCascader, ElCheckbox, ElCol, ElColorPicker, ElDatePicker, ElDialog, ElForm, ElFormItem, ElInput, ElInputNumber, ElInputOtp, ElMention, ElMessage, ElMessageBox, ElPagination, ElRadio, ElRate, ElRow, ElScrollbar, ElSelect, ElSelectV2, ElSlider, ElSwitch, ElTable, ElTableColumn, ElTimePicker, ElTimeSelect, ElTransfer, ElTreeSelect, ElUpload, vLoading } from "element-plus";
4
3
  import { computed, defineComponent, h, nextTick, onMounted, reactive, ref, toValue, useTemplateRef, watch, withDirectives } from "vue";
4
+ import { isFunc, realObj } from "@vuetkit/shared";
5
5
  //#region src/feedback/useMessage/index.ts
6
6
  const DEFAULT_DURATION = 3e3;
7
7
  const DEFAULT_SHOW_CLOSE = true;
@@ -80,6 +80,50 @@ function useAsyncConfirm(confirmService, options) {
80
80
  };
81
81
  }
82
82
  //#endregion
83
+ //#region src/feedback/useDialog/index.ts
84
+ function useDialog(options) {
85
+ const { title = "Dialog Title" } = options;
86
+ const showDialog = ref(false);
87
+ const DialogComp = defineComponent((props, { slots }) => {
88
+ return () => {
89
+ return h(ElDialog, {
90
+ title,
91
+ "modelValue": showDialog.value,
92
+ "update:modelValue": (val) => showDialog.value = val,
93
+ ...props,
94
+ "before-close": () => {
95
+ showDialog.value = false;
96
+ }
97
+ }, {
98
+ default: () => {
99
+ return h(ElScrollbar, { maxHeight: "60vh" }, () => {
100
+ var _slots$default;
101
+ return h("div", { style: { marginRight: "15px" } }, (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots));
102
+ });
103
+ },
104
+ footer: () => {
105
+ var _slots$footer;
106
+ return (_slots$footer = slots.footer) === null || _slots$footer === void 0 ? void 0 : _slots$footer.call(slots);
107
+ },
108
+ header: () => {
109
+ var _slots$header;
110
+ return (_slots$header = slots.header) === null || _slots$header === void 0 ? void 0 : _slots$header.call(slots);
111
+ }
112
+ });
113
+ };
114
+ });
115
+ const open = () => {
116
+ showDialog.value = true;
117
+ };
118
+ const close = () => {
119
+ showDialog.value = false;
120
+ };
121
+ return [DialogComp, {
122
+ open,
123
+ close
124
+ }];
125
+ }
126
+ //#endregion
83
127
  //#region src/form/useForm/index.ts
84
128
  const defaultComponent = {
85
129
  "input": ElInput,
@@ -420,4 +464,4 @@ function useTable(options) {
420
464
  })];
421
465
  }
422
466
  //#endregion
423
- export { setDeepProperty, useAsyncConfirm, useForm, useMessage, useTable };
467
+ export { setDeepProperty, useAsyncConfirm, useDialog, useForm, useMessage, useTable };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vuetkit/components",
3
3
  "type": "module",
4
- "version": "0.0.11",
4
+ "version": "0.0.12",
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.11",
25
- "@vuetkit/shared": "0.0.11"
24
+ "@vuetkit/core": "0.0.12",
25
+ "@vuetkit/shared": "0.0.12"
26
26
  },
27
27
  "scripts": {
28
28
  "build": "tsdown --config-loader tsx"