@oiij/naive-ui 0.0.3 → 0.0.5
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/components/bubble/Bubble.vue.d.ts +1 -1
- package/dist/components/config-providers/ConfigProviders.vue.d.ts +1 -1
- package/dist/components/copy-button/CopyButton.vue.d.ts +1 -1
- package/dist/components/data-table-plus/DataTablePlus.vue.d.ts +59 -0
- package/dist/components/data-table-plus/index.d.ts +50 -0
- package/dist/components/icons/EosIconsThreeDotsLoading.vue.d.ts +2 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/preset-form/PresetForm.vue.d.ts +68 -0
- package/dist/components/preset-form/index.d.ts +15 -0
- package/dist/components/preset-input/PresetInput.vue.d.ts +20 -0
- package/dist/components/preset-input/index.d.ts +26 -0
- package/dist/components/preset-select/PresetSelect.vue.d.ts +51 -0
- package/dist/components/preset-select/index.d.ts +17 -0
- package/dist/components/remote-request/RemoteRequest.vue.d.ts +70 -0
- package/dist/components/remote-request/index.d.ts +2 -0
- package/dist/components/search-input/SearchInput.vue.d.ts +2074 -6
- package/dist/components/search-input/index.d.ts +1 -0
- package/dist/components/toggle-editor/ToggleEditor.vue.d.ts +1046 -0
- package/dist/components/toggle-editor/index.d.ts +1 -0
- package/dist/components/tooltip-button/TooltipButton.vue.d.ts +1 -1
- package/dist/components/type-writer/TypeWriter.vue.d.ts +1 -1
- package/dist/components.cjs +23 -23
- package/dist/components.js +4051 -2514
- package/dist/components.umd.cjs +22 -22
- package/dist/composables/useNaiveForm.cjs +7 -4
- package/dist/composables/useNaiveForm.d.cts +13 -14
- package/dist/composables/useNaiveForm.d.ts +13 -14
- package/dist/composables/useNaiveForm.js +8 -5
- package/package.json +13 -10
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const __vueuse_core = require_rolldown_runtime.__toESM(require("@vueuse/core"));
|
|
2
3
|
const vue = require_rolldown_runtime.__toESM(require("vue"));
|
|
3
4
|
|
|
4
5
|
//#region src/composables/useNaiveForm.ts
|
|
@@ -19,7 +20,7 @@ function clearObjectValues(obj, rules) {
|
|
|
19
20
|
}
|
|
20
21
|
function useNaiveForm(value, options) {
|
|
21
22
|
const { rules, clearRules } = options ?? {};
|
|
22
|
-
const formValue = (0, vue.reactive)(structuredClone(value));
|
|
23
|
+
const formValue = (0, vue.reactive)(value ? structuredClone((0, vue.toRaw)(value)) : {});
|
|
23
24
|
const formRules = rules;
|
|
24
25
|
const formRef = (0, vue.ref)();
|
|
25
26
|
const formProps = {
|
|
@@ -27,8 +28,9 @@ function useNaiveForm(value, options) {
|
|
|
27
28
|
model: formValue,
|
|
28
29
|
rules: formRules
|
|
29
30
|
};
|
|
31
|
+
const onValidatedEvent = (0, __vueuse_core.createEventHook)();
|
|
30
32
|
function validate() {
|
|
31
|
-
return formRef.value?.validate();
|
|
33
|
+
return formRef.value?.validate().then(() => onValidatedEvent.trigger((0, vue.toRaw)((0, vue.toValue)(formValue))));
|
|
32
34
|
}
|
|
33
35
|
function resetValidation() {
|
|
34
36
|
formRef.value?.restoreValidation();
|
|
@@ -47,13 +49,14 @@ function useNaiveForm(value, options) {
|
|
|
47
49
|
return {
|
|
48
50
|
formRef,
|
|
49
51
|
formValue: (0, vue.toRef)(formValue),
|
|
50
|
-
|
|
52
|
+
formRules,
|
|
51
53
|
formProps,
|
|
52
54
|
validate,
|
|
53
55
|
resetValidation,
|
|
54
56
|
resetForm,
|
|
55
57
|
reset,
|
|
56
|
-
clear
|
|
58
|
+
clear,
|
|
59
|
+
onValidated: onValidatedEvent.on
|
|
57
60
|
};
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as vue1 from "vue";
|
|
2
|
-
import
|
|
2
|
+
import { Ref } from "vue";
|
|
3
|
+
import * as _vueuse_core2 from "@vueuse/core";
|
|
3
4
|
import { FormInst, FormItemRule, FormRules } from "naive-ui";
|
|
4
5
|
|
|
5
6
|
//#region src/composables/useNaiveForm.d.ts
|
|
@@ -8,29 +9,27 @@ interface ClearRules {
|
|
|
8
9
|
number?: number | null;
|
|
9
10
|
boolean?: boolean | null;
|
|
10
11
|
}
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
-
interface NaiveFormOptions<T extends FormType> {
|
|
12
|
+
type NaiveFormRules<T extends Record<string, any>> = Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>;
|
|
13
|
+
interface NaiveFormOptions<T extends Record<string, any>> {
|
|
14
14
|
rules?: NaiveFormRules<T>;
|
|
15
15
|
clearRules?: ClearRules;
|
|
16
16
|
}
|
|
17
|
-
declare function useNaiveForm<T extends
|
|
18
|
-
formRef:
|
|
19
|
-
formValue:
|
|
20
|
-
|
|
17
|
+
declare function useNaiveForm<T extends Record<string, any>>(value?: T, options?: NaiveFormOptions<T>): {
|
|
18
|
+
formRef: Ref<FormInst | undefined, FormInst | undefined>;
|
|
19
|
+
formValue: Ref<T>;
|
|
20
|
+
formRules: Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>> | undefined;
|
|
21
21
|
formProps: {
|
|
22
|
-
ref:
|
|
22
|
+
ref: Ref<FormInst | undefined, FormInst | undefined>;
|
|
23
23
|
model: vue1.Reactive<T>;
|
|
24
|
-
rules:
|
|
24
|
+
rules: Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>> | undefined;
|
|
25
25
|
};
|
|
26
|
-
validate: () => Promise<
|
|
27
|
-
warnings: async_validator11.ValidateError[][] | undefined;
|
|
28
|
-
}> | undefined;
|
|
26
|
+
validate: () => Promise<unknown[]> | undefined;
|
|
29
27
|
resetValidation: () => void;
|
|
30
28
|
resetForm: () => void;
|
|
31
29
|
reset: () => void;
|
|
32
30
|
clear: () => void;
|
|
31
|
+
onValidated: _vueuse_core2.EventHookOn<[T]>;
|
|
33
32
|
};
|
|
34
|
-
type NaiveFormReturns = ReturnType<typeof useNaiveForm
|
|
33
|
+
type NaiveFormReturns<T extends Record<string, any>> = ReturnType<typeof useNaiveForm<T>>;
|
|
35
34
|
//#endregion
|
|
36
35
|
export { NaiveFormOptions, NaiveFormReturns, NaiveFormRules, useNaiveForm };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as _vueuse_core2 from "@vueuse/core";
|
|
1
2
|
import * as vue1 from "vue";
|
|
3
|
+
import { Ref } from "vue";
|
|
2
4
|
import { FormInst, FormItemRule, FormRules } from "naive-ui";
|
|
3
|
-
import * as async_validator11 from "async-validator";
|
|
4
5
|
|
|
5
6
|
//#region src/composables/useNaiveForm.d.ts
|
|
6
7
|
interface ClearRules {
|
|
@@ -8,29 +9,27 @@ interface ClearRules {
|
|
|
8
9
|
number?: number | null;
|
|
9
10
|
boolean?: boolean | null;
|
|
10
11
|
}
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
-
interface NaiveFormOptions<T extends FormType> {
|
|
12
|
+
type NaiveFormRules<T extends Record<string, any>> = Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>;
|
|
13
|
+
interface NaiveFormOptions<T extends Record<string, any>> {
|
|
14
14
|
rules?: NaiveFormRules<T>;
|
|
15
15
|
clearRules?: ClearRules;
|
|
16
16
|
}
|
|
17
|
-
declare function useNaiveForm<T extends
|
|
18
|
-
formRef:
|
|
19
|
-
formValue:
|
|
20
|
-
|
|
17
|
+
declare function useNaiveForm<T extends Record<string, any>>(value?: T, options?: NaiveFormOptions<T>): {
|
|
18
|
+
formRef: Ref<FormInst | undefined, FormInst | undefined>;
|
|
19
|
+
formValue: Ref<T>;
|
|
20
|
+
formRules: Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>> | undefined;
|
|
21
21
|
formProps: {
|
|
22
|
-
ref:
|
|
22
|
+
ref: Ref<FormInst | undefined, FormInst | undefined>;
|
|
23
23
|
model: vue1.Reactive<T>;
|
|
24
|
-
rules:
|
|
24
|
+
rules: Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>> | undefined;
|
|
25
25
|
};
|
|
26
|
-
validate: () => Promise<
|
|
27
|
-
warnings: async_validator11.ValidateError[][] | undefined;
|
|
28
|
-
}> | undefined;
|
|
26
|
+
validate: () => Promise<unknown[]> | undefined;
|
|
29
27
|
resetValidation: () => void;
|
|
30
28
|
resetForm: () => void;
|
|
31
29
|
reset: () => void;
|
|
32
30
|
clear: () => void;
|
|
31
|
+
onValidated: _vueuse_core2.EventHookOn<[T]>;
|
|
33
32
|
};
|
|
34
|
-
type NaiveFormReturns = ReturnType<typeof useNaiveForm
|
|
33
|
+
type NaiveFormReturns<T extends Record<string, any>> = ReturnType<typeof useNaiveForm<T>>;
|
|
35
34
|
//#endregion
|
|
36
35
|
export { NaiveFormOptions, NaiveFormReturns, NaiveFormRules, useNaiveForm };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createEventHook } from "@vueuse/core";
|
|
2
|
+
import { reactive, ref, toRaw, toRef, toValue } from "vue";
|
|
2
3
|
|
|
3
4
|
//#region src/composables/useNaiveForm.ts
|
|
4
5
|
function clearObjectValues(obj, rules) {
|
|
@@ -18,7 +19,7 @@ function clearObjectValues(obj, rules) {
|
|
|
18
19
|
}
|
|
19
20
|
function useNaiveForm(value, options) {
|
|
20
21
|
const { rules, clearRules } = options ?? {};
|
|
21
|
-
const formValue = reactive(structuredClone(value));
|
|
22
|
+
const formValue = reactive(value ? structuredClone(toRaw(value)) : {});
|
|
22
23
|
const formRules = rules;
|
|
23
24
|
const formRef = ref();
|
|
24
25
|
const formProps = {
|
|
@@ -26,8 +27,9 @@ function useNaiveForm(value, options) {
|
|
|
26
27
|
model: formValue,
|
|
27
28
|
rules: formRules
|
|
28
29
|
};
|
|
30
|
+
const onValidatedEvent = createEventHook();
|
|
29
31
|
function validate() {
|
|
30
|
-
return formRef.value?.validate();
|
|
32
|
+
return formRef.value?.validate().then(() => onValidatedEvent.trigger(toRaw(toValue(formValue))));
|
|
31
33
|
}
|
|
32
34
|
function resetValidation() {
|
|
33
35
|
formRef.value?.restoreValidation();
|
|
@@ -46,13 +48,14 @@ function useNaiveForm(value, options) {
|
|
|
46
48
|
return {
|
|
47
49
|
formRef,
|
|
48
50
|
formValue: toRef(formValue),
|
|
49
|
-
|
|
51
|
+
formRules,
|
|
50
52
|
formProps,
|
|
51
53
|
validate,
|
|
52
54
|
resetValidation,
|
|
53
55
|
resetForm,
|
|
54
56
|
reset,
|
|
55
|
-
clear
|
|
57
|
+
clear,
|
|
58
|
+
onValidated: onValidatedEvent.on
|
|
56
59
|
};
|
|
57
60
|
}
|
|
58
61
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oiij/naive-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"description": "Som Composable Functions And Components for Vue 3",
|
|
6
6
|
"author": "oiij",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,21 +44,24 @@
|
|
|
44
44
|
"naive-ui": "^2.41.0",
|
|
45
45
|
"prismjs": "^1.30.0",
|
|
46
46
|
"vue": "^3.5.13",
|
|
47
|
-
"
|
|
48
|
-
"@oiij/css-render": "0.0.
|
|
49
|
-
"@oiij/
|
|
47
|
+
"vue-hooks-plus": "^2.4.0",
|
|
48
|
+
"@oiij/css-render": "0.0.2",
|
|
49
|
+
"@oiij/markdown-it": "0.0.3",
|
|
50
|
+
"@oiij/use": "0.0.16"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@types/prismjs": "^1.26.5",
|
|
53
|
-
"@vueuse/core": "^13.
|
|
54
|
+
"@vueuse/core": "^13.4.0",
|
|
54
55
|
"async-validator": "^4.2.5",
|
|
55
56
|
"colord": "^2.9.3",
|
|
56
|
-
"naive-ui": "^2.
|
|
57
|
+
"naive-ui": "^2.42.0",
|
|
57
58
|
"prismjs": "^1.30.0",
|
|
58
|
-
"vue": "^3.5.
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"@oiij/
|
|
59
|
+
"vue": "^3.5.17",
|
|
60
|
+
"vue-component-type-helpers": "^2.2.10",
|
|
61
|
+
"vue-hooks-plus": "^2.4.0",
|
|
62
|
+
"@oiij/css-render": "0.0.2",
|
|
63
|
+
"@oiij/markdown-it": "0.0.3",
|
|
64
|
+
"@oiij/use": "0.0.16"
|
|
62
65
|
},
|
|
63
66
|
"publishConfig": {
|
|
64
67
|
"access": "public"
|