@oiij/naive-ui 0.0.60 → 0.0.62
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.cjs +23 -23
- package/dist/components.js +3059 -2908
- package/dist/components.umd.cjs +25 -25
- package/dist/composables/index.d.ts +3 -0
- package/dist/composables/useDataRequest.d.ts +7 -7
- package/dist/composables/useNaiveForm.cjs +4 -2
- package/dist/composables/useNaiveForm.d.ts +5 -5
- package/dist/composables/useNaiveForm.js +3 -2
- package/dist/composables/useNaiveTheme.cjs +41 -45
- package/dist/composables/useNaiveTheme.js +41 -45
- package/dist/index.d.ts +1 -0
- package/package.json +14 -12
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DataObject, DataRequestFields, UseDataRequestOptions, UseDataRequestPagination, UseDataRequestReturns, useDataRequest } from "./useDataRequest.js";
|
|
2
|
+
import { NaiveFormClearRules, NaiveFormOptions, NaiveFormReturns, NaiveFormRules, useNaiveForm } from "./useNaiveForm.js";
|
|
3
|
+
import { NaiveThemeReturns, useNaiveTheme } from "./useNaiveTheme.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _vueuse_core0 from "@vueuse/core";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue0 from "vue";
|
|
3
3
|
import { UseRequestOptions, UseRequestPlugin } from "vue-hooks-plus/es/useRequest/types";
|
|
4
4
|
|
|
5
5
|
//#region src/composables/useDataRequest.d.ts
|
|
@@ -24,12 +24,12 @@ type UseDataRequestPagination = {
|
|
|
24
24
|
itemCount: number;
|
|
25
25
|
};
|
|
26
26
|
declare function useDataRequest<P extends DataObject = DataObject, D extends DataObject = DataObject, R extends DataObject = DataObject>(api: (...args: P[]) => Promise<D>, options?: UseDataRequestOptions<P, D>): {
|
|
27
|
-
loading: Readonly<
|
|
28
|
-
data: Readonly<
|
|
29
|
-
error: Readonly<
|
|
30
|
-
params: Readonly<
|
|
31
|
-
list:
|
|
32
|
-
pagination:
|
|
27
|
+
loading: Readonly<vue0.Ref<boolean, boolean>>;
|
|
28
|
+
data: Readonly<vue0.Ref<D | undefined, D | undefined>>;
|
|
29
|
+
error: Readonly<vue0.Ref<Error | undefined, Error | undefined>>;
|
|
30
|
+
params: Readonly<vue0.Ref<[] | P[], [] | P[]>>;
|
|
31
|
+
list: vue0.ComputedRef<R[]>;
|
|
32
|
+
pagination: vue0.Ref<{
|
|
33
33
|
page: number;
|
|
34
34
|
pageSize: number;
|
|
35
35
|
itemCount: number;
|
|
@@ -3,6 +3,8 @@ let __vueuse_core = require("@vueuse/core");
|
|
|
3
3
|
__vueuse_core = require_rolldown_runtime.__toESM(__vueuse_core);
|
|
4
4
|
let vue = require("vue");
|
|
5
5
|
vue = require_rolldown_runtime.__toESM(vue);
|
|
6
|
+
let es_toolkit_object = require("es-toolkit/object");
|
|
7
|
+
es_toolkit_object = require_rolldown_runtime.__toESM(es_toolkit_object);
|
|
6
8
|
|
|
7
9
|
//#region src/composables/useNaiveForm.ts
|
|
8
10
|
function isObject(value) {
|
|
@@ -34,7 +36,7 @@ function deepMerge(target = {}, source = {}) {
|
|
|
34
36
|
}
|
|
35
37
|
function useNaiveForm(value, options) {
|
|
36
38
|
const { rules, clearRules } = options ?? {};
|
|
37
|
-
const cacheValue =
|
|
39
|
+
const cacheValue = (0, es_toolkit_object.cloneDeep)((0, vue.toValue)(value));
|
|
38
40
|
const formValue = (0, vue.ref)((0, vue.toValue)(value ?? {}));
|
|
39
41
|
const formRules = (0, vue.ref)((0, vue.toValue)(rules) ?? {});
|
|
40
42
|
const formRef = (0, vue.ref)();
|
|
@@ -64,7 +66,7 @@ function useNaiveForm(value, options) {
|
|
|
64
66
|
}
|
|
65
67
|
function resetForm() {
|
|
66
68
|
clear();
|
|
67
|
-
const _cacheValue =
|
|
69
|
+
const _cacheValue = (0, es_toolkit_object.cloneDeep)(cacheValue);
|
|
68
70
|
deepMerge(formValue.value, _cacheValue);
|
|
69
71
|
}
|
|
70
72
|
function reset() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataObject } from "./useDataRequest.js";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _vueuse_core3 from "@vueuse/core";
|
|
3
|
+
import * as vue5 from "vue";
|
|
4
4
|
import { Ref } from "vue";
|
|
5
5
|
import { FormInst, FormItemRule, FormRules } from "naive-ui";
|
|
6
6
|
import { ValidateError } from "async-validator";
|
|
@@ -22,8 +22,8 @@ declare function useNaiveForm<T extends DataObject = DataObject>(value?: T | Ref
|
|
|
22
22
|
formRules: Ref<Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>, Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>>;
|
|
23
23
|
formProps: {
|
|
24
24
|
ref: Ref<FormInst | undefined, FormInst | undefined>;
|
|
25
|
-
model:
|
|
26
|
-
rules:
|
|
25
|
+
model: vue5.Reactive<T>;
|
|
26
|
+
rules: vue5.Reactive<Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>>;
|
|
27
27
|
};
|
|
28
28
|
setValue: (_value: Partial<T>) => void;
|
|
29
29
|
validate: () => Promise<{
|
|
@@ -33,7 +33,7 @@ declare function useNaiveForm<T extends DataObject = DataObject>(value?: T | Ref
|
|
|
33
33
|
resetForm: () => void;
|
|
34
34
|
reset: () => void;
|
|
35
35
|
clear: () => void;
|
|
36
|
-
onValidated:
|
|
36
|
+
onValidated: _vueuse_core3.EventHookOn<[T]>;
|
|
37
37
|
};
|
|
38
38
|
type NaiveFormReturns<T extends DataObject = DataObject> = ReturnType<typeof useNaiveForm<T>>;
|
|
39
39
|
//#endregion
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createEventHook } from "@vueuse/core";
|
|
2
2
|
import { reactive, ref, toRaw, toValue } from "vue";
|
|
3
|
+
import { cloneDeep } from "es-toolkit/object";
|
|
3
4
|
|
|
4
5
|
//#region src/composables/useNaiveForm.ts
|
|
5
6
|
function isObject(value) {
|
|
@@ -31,7 +32,7 @@ function deepMerge(target = {}, source = {}) {
|
|
|
31
32
|
}
|
|
32
33
|
function useNaiveForm(value, options) {
|
|
33
34
|
const { rules, clearRules } = options ?? {};
|
|
34
|
-
const cacheValue =
|
|
35
|
+
const cacheValue = cloneDeep(toValue(value));
|
|
35
36
|
const formValue = ref(toValue(value ?? {}));
|
|
36
37
|
const formRules = ref(toValue(rules) ?? {});
|
|
37
38
|
const formRef = ref();
|
|
@@ -61,7 +62,7 @@ function useNaiveForm(value, options) {
|
|
|
61
62
|
}
|
|
62
63
|
function resetForm() {
|
|
63
64
|
clear();
|
|
64
|
-
const _cacheValue =
|
|
65
|
+
const _cacheValue = cloneDeep(cacheValue);
|
|
65
66
|
deepMerge(formValue.value, _cacheValue);
|
|
66
67
|
}
|
|
67
68
|
function reset() {
|
|
@@ -36,54 +36,50 @@ function useNaiveTheme(options) {
|
|
|
36
36
|
...v
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
const theme = (0, vue.computed)(() => {
|
|
40
|
-
return darkModeRef?.value ? naive_ui.darkTheme : void 0;
|
|
41
|
-
});
|
|
42
|
-
const themeOverrides = (0, vue.computed)(() => {
|
|
43
|
-
const { primary, info, success, warning, error } = require__helper.getColors(colorRef.value);
|
|
44
|
-
return {
|
|
45
|
-
common: {
|
|
46
|
-
bodyColor: darkModeRef?.value ? "#1f1f1f" : "#f5f5f5",
|
|
47
|
-
primaryColor: primary?.color,
|
|
48
|
-
primaryColorHover: primary?.hover,
|
|
49
|
-
primaryColorPressed: primary?.pressed,
|
|
50
|
-
primaryColorSuppl: primary?.suppl,
|
|
51
|
-
infoColor: info?.color,
|
|
52
|
-
infoColorHover: info?.hover,
|
|
53
|
-
infoColorPressed: info?.pressed,
|
|
54
|
-
infoColorSuppl: info?.suppl,
|
|
55
|
-
successColor: success?.color,
|
|
56
|
-
successColorHover: success?.hover,
|
|
57
|
-
successColorPressed: success?.pressed,
|
|
58
|
-
successColorSuppl: success?.suppl,
|
|
59
|
-
warningColor: warning?.color,
|
|
60
|
-
warningColorHover: warning?.hover,
|
|
61
|
-
warningColorPressed: warning?.pressed,
|
|
62
|
-
warningColorSuppl: warning?.suppl,
|
|
63
|
-
errorColor: error?.color,
|
|
64
|
-
errorColorHover: error?.hover,
|
|
65
|
-
errorColorPressed: error?.pressed,
|
|
66
|
-
errorColorSuppl: error?.suppl,
|
|
67
|
-
...common
|
|
68
|
-
},
|
|
69
|
-
...extra
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
const locale = (0, vue.computed)(() => {
|
|
73
|
-
if (!languageRef?.value || !naiveLocaleMap[languageRef.value]) return naiveLocaleMap["zh-CN"].locale;
|
|
74
|
-
return naiveLocaleMap[languageRef.value].locale;
|
|
75
|
-
});
|
|
76
|
-
const dateLocale = (0, vue.computed)(() => {
|
|
77
|
-
if (!languageRef?.value || !naiveLocaleMap[languageRef.value]) return naiveLocaleMap["zh-CN"].dateLocale;
|
|
78
|
-
return naiveLocaleMap[languageRef.value].dateLocale;
|
|
79
|
-
});
|
|
80
39
|
return {
|
|
81
40
|
language: languageRef,
|
|
82
41
|
darkMode: darkModeRef,
|
|
83
|
-
theme,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
42
|
+
theme: (0, vue.computed)(() => {
|
|
43
|
+
return darkModeRef?.value ? naive_ui.darkTheme : void 0;
|
|
44
|
+
}),
|
|
45
|
+
themeOverrides: (0, vue.computed)(() => {
|
|
46
|
+
const { primary, info, success, warning, error } = require__helper.getColors(colorRef.value);
|
|
47
|
+
return {
|
|
48
|
+
common: {
|
|
49
|
+
bodyColor: darkModeRef?.value ? "#1f1f1f" : "#f5f5f5",
|
|
50
|
+
primaryColor: primary?.color,
|
|
51
|
+
primaryColorHover: primary?.hover,
|
|
52
|
+
primaryColorPressed: primary?.pressed,
|
|
53
|
+
primaryColorSuppl: primary?.suppl,
|
|
54
|
+
infoColor: info?.color,
|
|
55
|
+
infoColorHover: info?.hover,
|
|
56
|
+
infoColorPressed: info?.pressed,
|
|
57
|
+
infoColorSuppl: info?.suppl,
|
|
58
|
+
successColor: success?.color,
|
|
59
|
+
successColorHover: success?.hover,
|
|
60
|
+
successColorPressed: success?.pressed,
|
|
61
|
+
successColorSuppl: success?.suppl,
|
|
62
|
+
warningColor: warning?.color,
|
|
63
|
+
warningColorHover: warning?.hover,
|
|
64
|
+
warningColorPressed: warning?.pressed,
|
|
65
|
+
warningColorSuppl: warning?.suppl,
|
|
66
|
+
errorColor: error?.color,
|
|
67
|
+
errorColorHover: error?.hover,
|
|
68
|
+
errorColorPressed: error?.pressed,
|
|
69
|
+
errorColorSuppl: error?.suppl,
|
|
70
|
+
...common
|
|
71
|
+
},
|
|
72
|
+
...extra
|
|
73
|
+
};
|
|
74
|
+
}),
|
|
75
|
+
locale: (0, vue.computed)(() => {
|
|
76
|
+
if (!languageRef?.value || !naiveLocaleMap[languageRef.value]) return naiveLocaleMap["zh-CN"].locale;
|
|
77
|
+
return naiveLocaleMap[languageRef.value].locale;
|
|
78
|
+
}),
|
|
79
|
+
dateLocale: (0, vue.computed)(() => {
|
|
80
|
+
if (!languageRef?.value || !naiveLocaleMap[languageRef.value]) return naiveLocaleMap["zh-CN"].dateLocale;
|
|
81
|
+
return naiveLocaleMap[languageRef.value].dateLocale;
|
|
82
|
+
}),
|
|
87
83
|
color: colorRef,
|
|
88
84
|
setColor
|
|
89
85
|
};
|
|
@@ -33,54 +33,50 @@ function useNaiveTheme(options) {
|
|
|
33
33
|
...v
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
const theme = computed(() => {
|
|
37
|
-
return darkModeRef?.value ? darkTheme : void 0;
|
|
38
|
-
});
|
|
39
|
-
const themeOverrides = computed(() => {
|
|
40
|
-
const { primary, info, success, warning, error } = getColors(colorRef.value);
|
|
41
|
-
return {
|
|
42
|
-
common: {
|
|
43
|
-
bodyColor: darkModeRef?.value ? "#1f1f1f" : "#f5f5f5",
|
|
44
|
-
primaryColor: primary?.color,
|
|
45
|
-
primaryColorHover: primary?.hover,
|
|
46
|
-
primaryColorPressed: primary?.pressed,
|
|
47
|
-
primaryColorSuppl: primary?.suppl,
|
|
48
|
-
infoColor: info?.color,
|
|
49
|
-
infoColorHover: info?.hover,
|
|
50
|
-
infoColorPressed: info?.pressed,
|
|
51
|
-
infoColorSuppl: info?.suppl,
|
|
52
|
-
successColor: success?.color,
|
|
53
|
-
successColorHover: success?.hover,
|
|
54
|
-
successColorPressed: success?.pressed,
|
|
55
|
-
successColorSuppl: success?.suppl,
|
|
56
|
-
warningColor: warning?.color,
|
|
57
|
-
warningColorHover: warning?.hover,
|
|
58
|
-
warningColorPressed: warning?.pressed,
|
|
59
|
-
warningColorSuppl: warning?.suppl,
|
|
60
|
-
errorColor: error?.color,
|
|
61
|
-
errorColorHover: error?.hover,
|
|
62
|
-
errorColorPressed: error?.pressed,
|
|
63
|
-
errorColorSuppl: error?.suppl,
|
|
64
|
-
...common
|
|
65
|
-
},
|
|
66
|
-
...extra
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
const locale = computed(() => {
|
|
70
|
-
if (!languageRef?.value || !naiveLocaleMap[languageRef.value]) return naiveLocaleMap["zh-CN"].locale;
|
|
71
|
-
return naiveLocaleMap[languageRef.value].locale;
|
|
72
|
-
});
|
|
73
|
-
const dateLocale = computed(() => {
|
|
74
|
-
if (!languageRef?.value || !naiveLocaleMap[languageRef.value]) return naiveLocaleMap["zh-CN"].dateLocale;
|
|
75
|
-
return naiveLocaleMap[languageRef.value].dateLocale;
|
|
76
|
-
});
|
|
77
36
|
return {
|
|
78
37
|
language: languageRef,
|
|
79
38
|
darkMode: darkModeRef,
|
|
80
|
-
theme
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
39
|
+
theme: computed(() => {
|
|
40
|
+
return darkModeRef?.value ? darkTheme : void 0;
|
|
41
|
+
}),
|
|
42
|
+
themeOverrides: computed(() => {
|
|
43
|
+
const { primary, info, success, warning, error } = getColors(colorRef.value);
|
|
44
|
+
return {
|
|
45
|
+
common: {
|
|
46
|
+
bodyColor: darkModeRef?.value ? "#1f1f1f" : "#f5f5f5",
|
|
47
|
+
primaryColor: primary?.color,
|
|
48
|
+
primaryColorHover: primary?.hover,
|
|
49
|
+
primaryColorPressed: primary?.pressed,
|
|
50
|
+
primaryColorSuppl: primary?.suppl,
|
|
51
|
+
infoColor: info?.color,
|
|
52
|
+
infoColorHover: info?.hover,
|
|
53
|
+
infoColorPressed: info?.pressed,
|
|
54
|
+
infoColorSuppl: info?.suppl,
|
|
55
|
+
successColor: success?.color,
|
|
56
|
+
successColorHover: success?.hover,
|
|
57
|
+
successColorPressed: success?.pressed,
|
|
58
|
+
successColorSuppl: success?.suppl,
|
|
59
|
+
warningColor: warning?.color,
|
|
60
|
+
warningColorHover: warning?.hover,
|
|
61
|
+
warningColorPressed: warning?.pressed,
|
|
62
|
+
warningColorSuppl: warning?.suppl,
|
|
63
|
+
errorColor: error?.color,
|
|
64
|
+
errorColorHover: error?.hover,
|
|
65
|
+
errorColorPressed: error?.pressed,
|
|
66
|
+
errorColorSuppl: error?.suppl,
|
|
67
|
+
...common
|
|
68
|
+
},
|
|
69
|
+
...extra
|
|
70
|
+
};
|
|
71
|
+
}),
|
|
72
|
+
locale: computed(() => {
|
|
73
|
+
if (!languageRef?.value || !naiveLocaleMap[languageRef.value]) return naiveLocaleMap["zh-CN"].locale;
|
|
74
|
+
return naiveLocaleMap[languageRef.value].locale;
|
|
75
|
+
}),
|
|
76
|
+
dateLocale: computed(() => {
|
|
77
|
+
if (!languageRef?.value || !naiveLocaleMap[languageRef.value]) return naiveLocaleMap["zh-CN"].dateLocale;
|
|
78
|
+
return naiveLocaleMap[languageRef.value].dateLocale;
|
|
79
|
+
}),
|
|
84
80
|
color: colorRef,
|
|
85
81
|
setColor
|
|
86
82
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DataObject, DataRequestFields, UseDataRequestOptions, UseDataRequestPagination, UseDataRequestReturns, useDataRequest } from "./composables/useDataRequest.js";
|
|
2
2
|
import { NaiveFormClearRules, NaiveFormOptions, NaiveFormReturns, NaiveFormRules, useNaiveForm } from "./composables/useNaiveForm.js";
|
|
3
3
|
import { NaiveThemeReturns, useNaiveTheme } from "./composables/useNaiveTheme.js";
|
|
4
|
+
import "./composables/index.js";
|
|
4
5
|
export { DataObject, DataRequestFields, NaiveFormClearRules, NaiveFormOptions, NaiveFormReturns, NaiveFormRules, NaiveThemeReturns, UseDataRequestOptions, UseDataRequestPagination, UseDataRequestReturns, useDataRequest, useNaiveForm, useNaiveTheme };
|
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.62",
|
|
5
5
|
"description": "Some Composable Functions And Components for Vue 3",
|
|
6
6
|
"author": "oiij",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,30 +38,32 @@
|
|
|
38
38
|
"package.json"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@vueuse/core": "^
|
|
41
|
+
"@vueuse/core": "^14.0.0",
|
|
42
42
|
"async-validator": "^4.2.5",
|
|
43
43
|
"colord": "^2.9.3",
|
|
44
|
+
"es-toolkit": "^1.41.0",
|
|
44
45
|
"naive-ui": "^2.43.1",
|
|
45
46
|
"prismjs": "^1.30.0",
|
|
46
|
-
"vue": "^3.5.
|
|
47
|
+
"vue": "^3.5.22",
|
|
47
48
|
"vue-hooks-plus": "^2.4.1",
|
|
48
|
-
"@oiij/
|
|
49
|
-
"@oiij/
|
|
50
|
-
"@oiij/use": "0.0.
|
|
49
|
+
"@oiij/markdown-it": "0.0.7",
|
|
50
|
+
"@oiij/css-render": "0.0.5",
|
|
51
|
+
"@oiij/use": "0.0.26"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@types/prismjs": "^1.26.5",
|
|
54
|
-
"@vueuse/core": "^
|
|
55
|
+
"@vueuse/core": "^14.0.0",
|
|
55
56
|
"async-validator": "^4.2.5",
|
|
56
57
|
"colord": "^2.9.3",
|
|
58
|
+
"es-toolkit": "^1.41.0",
|
|
57
59
|
"naive-ui": "^2.43.1",
|
|
58
60
|
"prismjs": "^1.30.0",
|
|
59
|
-
"vue": "^3.5.
|
|
60
|
-
"vue-component-type-helpers": "^3.
|
|
61
|
+
"vue": "^3.5.22",
|
|
62
|
+
"vue-component-type-helpers": "^3.1.2",
|
|
61
63
|
"vue-hooks-plus": "^2.4.1",
|
|
62
|
-
"@oiij/css-render": "0.0.
|
|
63
|
-
"@oiij/use": "0.0.
|
|
64
|
-
"@oiij/markdown-it": "0.0.
|
|
64
|
+
"@oiij/css-render": "0.0.5",
|
|
65
|
+
"@oiij/use": "0.0.26",
|
|
66
|
+
"@oiij/markdown-it": "0.0.7"
|
|
65
67
|
},
|
|
66
68
|
"publishConfig": {
|
|
67
69
|
"access": "public"
|