@oiij/naive-ui 0.0.63 → 0.0.65
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/_virtual/_/plugin-vue/export-helper.js +9 -0
- package/dist/components/_utils/cssr-bem.js +7 -0
- package/dist/components/_utils/prismjs.js +16 -0
- package/dist/components/bubble/Bubble.js +67 -0
- package/dist/components/bubble/Bubble.vue.d.ts +51 -46
- package/dist/components/bubble/bubble.cssr.js +23 -0
- package/dist/components/bubble/index.d.ts +19 -15
- package/dist/components/config-providers/ConfigProviders.js +78 -0
- package/dist/components/config-providers/ConfigProviders.vue.d.ts +37 -33
- package/dist/components/config-providers/index.d.ts +28 -24
- package/dist/components/copy-button/CopyButton.js +50 -0
- package/dist/components/copy-button/CopyButton.vue.d.ts +36 -30
- package/dist/components/copy-button/index.d.ts +13 -9
- package/dist/components/data-table-plus/DataTablePlus.js +374 -0
- package/dist/components/data-table-plus/DataTablePlus.vue.d.ts +365 -260
- package/dist/components/data-table-plus/index.d.ts +54 -48
- package/dist/components/full-loading/FullLoading.js +70 -0
- package/dist/components/full-loading/FullLoading.vue.d.ts +36 -32
- package/dist/components/full-loading/full-loading.cssr.js +22 -0
- package/dist/components/full-loading/index.d.ts +16 -12
- package/dist/components/icons/MageArrowUp.js +29 -0
- package/dist/components/icons/MageCopyFill.js +21 -0
- package/dist/components/icons/MageMultiplyCircleFill.js +21 -0
- package/dist/components/icons/MageSearch.js +25 -0
- package/dist/components/index.d.ts +31 -15
- package/dist/components/preset-form/PresetForm.js +176 -0
- package/dist/components/preset-form/PresetForm.vue.d.ts +82 -74
- package/dist/components/preset-form/_utils.js +16 -0
- package/dist/components/preset-form/index.d.ts +34 -29
- package/dist/components/preset-input/PresetInput.js +87 -0
- package/dist/components/preset-input/PresetInput.vue.d.ts +20 -15
- package/dist/components/preset-input/index.d.ts +147 -145
- package/dist/components/preset-picker/PresetPicker.js +209 -0
- package/dist/components/preset-picker/PresetPicker.vue.d.ts +62 -49
- package/dist/components/preset-picker/index.d.ts +55 -49
- package/dist/components/preset-select/PresetSelect.js +274 -0
- package/dist/components/preset-select/PresetSelect.vue.d.ts +190 -180
- package/dist/components/preset-select/index.d.ts +44 -38
- package/dist/components/remote-request/RemoteRequest.js +90 -0
- package/dist/components/remote-request/RemoteRequest.vue.d.ts +55 -49
- package/dist/components/remote-request/index.d.ts +23 -17
- package/dist/components/search-input/SearchInput.js +85 -0
- package/dist/components/search-input/SearchInput.vue.d.ts +48 -2332
- package/dist/components/search-input/index.d.ts +16 -12
- package/dist/components/toggle-editor/ToggleEditor.js +44 -0
- package/dist/components/toggle-editor/ToggleEditor.vue.d.ts +18 -1157
- package/dist/components/toggle-editor/index.d.ts +1 -1
- package/dist/components/tooltip-button/TooltipButton.js +31 -0
- package/dist/components/tooltip-button/TooltipButton.vue.d.ts +33 -28
- package/dist/components/tooltip-button/index.d.ts +11 -7
- package/dist/components/transition/BaseTransition.js +30 -0
- package/dist/components/transition/BaseTransition.vue.d.ts +23 -21
- package/dist/components/transition/index.d.ts +10 -6
- package/dist/components/transition/transition.cssr.js +20 -0
- package/dist/components/type-writer/TypeWriter.js +72 -0
- package/dist/components/type-writer/TypeWriter.vue.d.ts +34 -29
- package/dist/components/type-writer/index.d.ts +12 -8
- package/dist/components/type-writer/type-writer.cssr.js +27 -0
- package/dist/components.d.ts +33 -1
- package/dist/components.js +18 -7910
- package/dist/composables/useDataRequest.d.ts +1 -1
- package/dist/composables/useNaiveForm.d.ts +3 -4
- package/dist/composables/useNaiveForm.js +1 -3
- package/dist/composables/useNaiveTheme.js +1 -1
- package/package.json +20 -22
- package/dist/_virtual/rolldown_runtime.cjs +0 -25
- package/dist/components/_utils/cssr-bem.d.ts +0 -1
- package/dist/components/_utils/index.d.ts +0 -2
- package/dist/components/_utils/prismjs.d.ts +0 -1
- package/dist/components/bubble/bubble.cssr.d.ts +0 -2
- package/dist/components/full-loading/full-loading.cssr.d.ts +0 -2
- package/dist/components/icons/MageArrowUp.vue.d.ts +0 -2
- package/dist/components/icons/MageCopyFill.vue.d.ts +0 -2
- package/dist/components/icons/MageMultiplyCircleFill.vue.d.ts +0 -2
- package/dist/components/icons/MageSearch.vue.d.ts +0 -2
- package/dist/components/preset-form/_utils.d.ts +0 -8
- package/dist/components/transition/transition.cssr.d.ts +0 -13
- package/dist/components/type-writer/type-writer.cssr.d.ts +0 -2
- package/dist/components.cjs +0 -42
- package/dist/components.umd.cjs +0 -42
- package/dist/composables/_helper.cjs +0 -29
- package/dist/composables/_helper.d.cts +0 -10
- package/dist/composables/useDataRequest.cjs +0 -105
- package/dist/composables/useDataRequest.d.cts +0 -61
- package/dist/composables/useNaiveForm.cjs +0 -92
- package/dist/composables/useNaiveForm.d.cts +0 -40
- package/dist/composables/useNaiveTheme.cjs +0 -89
- package/dist/composables/useNaiveTheme.d.cts +0 -171
- package/dist/index.cjs +0 -7
- package/dist/index.d.cts +0 -4
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let colord = require("colord");
|
|
3
|
-
colord = require_rolldown_runtime.__toESM(colord);
|
|
4
|
-
|
|
5
|
-
//#region src/composables/_helper.ts
|
|
6
|
-
function getStatusColor(color) {
|
|
7
|
-
if (!color) return void 0;
|
|
8
|
-
const baseColor = (0, colord.colord)(color);
|
|
9
|
-
if (!baseColor.isValid()) return void 0;
|
|
10
|
-
return {
|
|
11
|
-
color,
|
|
12
|
-
hover: baseColor.lighten(.1).toHex(),
|
|
13
|
-
pressed: baseColor.darken(.1).toHex(),
|
|
14
|
-
suppl: baseColor.lighten(.1).toHex()
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function getColors(colors) {
|
|
18
|
-
const { primary, info, success, warning, error } = colors ?? {};
|
|
19
|
-
return {
|
|
20
|
-
primary: getStatusColor(primary),
|
|
21
|
-
info: getStatusColor(info),
|
|
22
|
-
success: getStatusColor(success),
|
|
23
|
-
warning: getStatusColor(warning),
|
|
24
|
-
error: getStatusColor(error)
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
exports.getColors = getColors;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __vueuse_core = require("@vueuse/core");
|
|
3
|
-
__vueuse_core = require_rolldown_runtime.__toESM(__vueuse_core);
|
|
4
|
-
let vue = require("vue");
|
|
5
|
-
vue = require_rolldown_runtime.__toESM(vue);
|
|
6
|
-
let vue_hooks_plus_es_useRequest = require("vue-hooks-plus/es/useRequest");
|
|
7
|
-
vue_hooks_plus_es_useRequest = require_rolldown_runtime.__toESM(vue_hooks_plus_es_useRequest);
|
|
8
|
-
|
|
9
|
-
//#region src/composables/useDataRequest.ts
|
|
10
|
-
function useDataRequest(api, options) {
|
|
11
|
-
const { defaultParams, manual, fields, requestOptions, requestPlugins } = options ?? {};
|
|
12
|
-
const _fields = {
|
|
13
|
-
page: "page",
|
|
14
|
-
pageSize: "pageSize",
|
|
15
|
-
list: "list",
|
|
16
|
-
count: "count",
|
|
17
|
-
...fields
|
|
18
|
-
};
|
|
19
|
-
const pagination = (0, vue.ref)({
|
|
20
|
-
page: defaultParams?.[_fields.page] ?? 1,
|
|
21
|
-
pageSize: defaultParams?.[_fields.pageSize] ?? 10,
|
|
22
|
-
itemCount: 0
|
|
23
|
-
});
|
|
24
|
-
const onBeforeEvent = (0, __vueuse_core.createEventHook)();
|
|
25
|
-
const onSuccessEvent = (0, __vueuse_core.createEventHook)();
|
|
26
|
-
const onErrorEvent = (0, __vueuse_core.createEventHook)();
|
|
27
|
-
const onFinallyEvent = (0, __vueuse_core.createEventHook)();
|
|
28
|
-
const { loading, data, error, params, run, runAsync, refresh, refreshAsync, cancel, mutate } = (0, vue_hooks_plus_es_useRequest.default)(api, {
|
|
29
|
-
defaultParams: [{
|
|
30
|
-
[_fields.page]: pagination.value.page,
|
|
31
|
-
[_fields.pageSize]: pagination.value.pageSize,
|
|
32
|
-
...defaultParams
|
|
33
|
-
}],
|
|
34
|
-
manual,
|
|
35
|
-
...requestOptions,
|
|
36
|
-
onBefore: (params$1) => {
|
|
37
|
-
requestOptions?.onBefore?.(params$1);
|
|
38
|
-
onBeforeEvent.trigger(params$1);
|
|
39
|
-
},
|
|
40
|
-
onSuccess: (data$1, params$1) => {
|
|
41
|
-
requestOptions?.onSuccess?.(data$1, params$1);
|
|
42
|
-
onSuccessEvent.trigger(data$1, params$1);
|
|
43
|
-
if (_fields.page in params$1?.[0]) {
|
|
44
|
-
const _page = Number(params$1?.[0][_fields.page]);
|
|
45
|
-
if (!Number.isNaN(_page)) pagination.value.page = _page;
|
|
46
|
-
}
|
|
47
|
-
if (_fields.pageSize in params$1?.[0]) {
|
|
48
|
-
const _pageSize = Number(params$1?.[0][_fields.pageSize]);
|
|
49
|
-
if (!Number.isNaN(_pageSize)) pagination.value.pageSize = _pageSize;
|
|
50
|
-
}
|
|
51
|
-
if (_fields.count in data$1) {
|
|
52
|
-
const _count = Number(data$1[_fields.count]);
|
|
53
|
-
if (!Number.isNaN(_count)) pagination.value.itemCount = _count;
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
onError: (err, params$1) => {
|
|
57
|
-
requestOptions?.onError?.(err, params$1);
|
|
58
|
-
onErrorEvent.trigger(err, params$1);
|
|
59
|
-
},
|
|
60
|
-
onFinally: (params$1, data$1, err) => {
|
|
61
|
-
requestOptions?.onFinally?.(params$1, data$1, err);
|
|
62
|
-
onFinallyEvent.trigger(params$1, data$1, err);
|
|
63
|
-
}
|
|
64
|
-
}, requestPlugins);
|
|
65
|
-
const list = (0, vue.computed)(() => data.value?.[_fields.list] ?? []);
|
|
66
|
-
function setParams(_params) {
|
|
67
|
-
Object.assign(params.value?.[0], _params);
|
|
68
|
-
}
|
|
69
|
-
function runParams(_params) {
|
|
70
|
-
return run({
|
|
71
|
-
...params.value?.[0],
|
|
72
|
-
..._params
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
function runParamsAsync(_params) {
|
|
76
|
-
return runAsync({
|
|
77
|
-
...params.value?.[0],
|
|
78
|
-
..._params
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
loading,
|
|
83
|
-
data,
|
|
84
|
-
error,
|
|
85
|
-
params,
|
|
86
|
-
list,
|
|
87
|
-
pagination,
|
|
88
|
-
run,
|
|
89
|
-
runAsync,
|
|
90
|
-
refresh,
|
|
91
|
-
refreshAsync,
|
|
92
|
-
cancel,
|
|
93
|
-
mutate,
|
|
94
|
-
setParams,
|
|
95
|
-
runParams,
|
|
96
|
-
runParamsAsync,
|
|
97
|
-
onBefore: onBeforeEvent.on,
|
|
98
|
-
onSuccess: onSuccessEvent.on,
|
|
99
|
-
onError: onErrorEvent.on,
|
|
100
|
-
onFinally: onFinallyEvent.on
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
//#endregion
|
|
105
|
-
exports.useDataRequest = useDataRequest;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import * as vue0 from "vue";
|
|
2
|
-
import * as _vueuse_core0 from "@vueuse/core";
|
|
3
|
-
import { UseRequestOptions, UseRequestPlugin } from "vue-hooks-plus/es/useRequest/types";
|
|
4
|
-
|
|
5
|
-
//#region src/composables/useDataRequest.d.ts
|
|
6
|
-
type DataObject = Record<string, any>;
|
|
7
|
-
type DataRequestFields = Record<string, string | undefined> & {
|
|
8
|
-
page?: string;
|
|
9
|
-
pageSize?: string;
|
|
10
|
-
list?: string;
|
|
11
|
-
count?: string;
|
|
12
|
-
rowKey?: string;
|
|
13
|
-
};
|
|
14
|
-
type UseDataRequestOptions<P extends DataObject = DataObject, D extends DataObject = DataObject> = {
|
|
15
|
-
defaultParams?: Partial<P>;
|
|
16
|
-
manual?: boolean;
|
|
17
|
-
fields?: DataRequestFields;
|
|
18
|
-
requestOptions?: UseRequestOptions<D, P[]>;
|
|
19
|
-
requestPlugins?: UseRequestPlugin<D, P[]>[];
|
|
20
|
-
};
|
|
21
|
-
type UseDataRequestPagination = {
|
|
22
|
-
page: number;
|
|
23
|
-
pageSize: number;
|
|
24
|
-
itemCount: number;
|
|
25
|
-
};
|
|
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<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
|
-
page: number;
|
|
34
|
-
pageSize: number;
|
|
35
|
-
itemCount: number;
|
|
36
|
-
}, {
|
|
37
|
-
page: number;
|
|
38
|
-
pageSize: number;
|
|
39
|
-
itemCount: number;
|
|
40
|
-
} | {
|
|
41
|
-
page: number;
|
|
42
|
-
pageSize: number;
|
|
43
|
-
itemCount: number;
|
|
44
|
-
}>;
|
|
45
|
-
run: (...params: P[]) => void;
|
|
46
|
-
runAsync: (...params: P[]) => Promise<D>;
|
|
47
|
-
refresh: () => void;
|
|
48
|
-
refreshAsync: () => Promise<D>;
|
|
49
|
-
cancel: () => void;
|
|
50
|
-
mutate: (data?: D | ((oldData?: D | undefined) => D | undefined) | undefined) => void;
|
|
51
|
-
setParams: (_params: Partial<P>) => void;
|
|
52
|
-
runParams: (_params: Partial<P>) => void;
|
|
53
|
-
runParamsAsync: (_params: Partial<P>) => Promise<D>;
|
|
54
|
-
onBefore: _vueuse_core0.EventHookOn<[P[]]>;
|
|
55
|
-
onSuccess: _vueuse_core0.EventHookOn<[D, P[]]>;
|
|
56
|
-
onError: _vueuse_core0.EventHookOn<[Error, P[]]>;
|
|
57
|
-
onFinally: _vueuse_core0.EventHookOn<[P[], D | undefined, Error | undefined]>;
|
|
58
|
-
};
|
|
59
|
-
type UseDataRequestReturns<P extends DataObject = DataObject, D extends DataObject = DataObject, R extends DataObject = DataObject> = ReturnType<typeof useDataRequest<P, D, R>>;
|
|
60
|
-
//#endregion
|
|
61
|
-
export { DataObject, DataRequestFields, UseDataRequestOptions, UseDataRequestPagination, UseDataRequestReturns, useDataRequest };
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __vueuse_core = require("@vueuse/core");
|
|
3
|
-
__vueuse_core = require_rolldown_runtime.__toESM(__vueuse_core);
|
|
4
|
-
let vue = require("vue");
|
|
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);
|
|
8
|
-
|
|
9
|
-
//#region src/composables/useNaiveForm.ts
|
|
10
|
-
function isObject(value) {
|
|
11
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12
|
-
}
|
|
13
|
-
function clearObjectValues(obj, rules) {
|
|
14
|
-
const { string: _string = "", number: _number = null, boolean: _boolean = false } = rules ?? {};
|
|
15
|
-
if (Array.isArray(obj)) {
|
|
16
|
-
obj.length = 0;
|
|
17
|
-
return obj;
|
|
18
|
-
}
|
|
19
|
-
if (typeof obj === "object" && obj !== null) {
|
|
20
|
-
for (const key in obj) if (Object.prototype.hasOwnProperty.call(obj, key)) obj[key] = clearObjectValues(obj[key], rules);
|
|
21
|
-
return obj;
|
|
22
|
-
}
|
|
23
|
-
if (typeof obj === "string") return _string;
|
|
24
|
-
if (typeof obj === "number") return _number;
|
|
25
|
-
if (typeof obj === "boolean") return _boolean;
|
|
26
|
-
return obj;
|
|
27
|
-
}
|
|
28
|
-
function deepMerge(target = {}, source = {}) {
|
|
29
|
-
for (const key in source) if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
30
|
-
const sourceValue = source[key];
|
|
31
|
-
const targetValue = target[key];
|
|
32
|
-
if (isObject(sourceValue) && isObject(targetValue)) deepMerge(targetValue, sourceValue);
|
|
33
|
-
else target[key] = sourceValue;
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
}
|
|
37
|
-
function useNaiveForm(value, options) {
|
|
38
|
-
const { rules, clearRules } = options ?? {};
|
|
39
|
-
const cacheValue = (0, es_toolkit_object.cloneDeep)((0, vue.toValue)(value));
|
|
40
|
-
const formValue = (0, vue.ref)((0, vue.toValue)(value ?? {}));
|
|
41
|
-
const formRules = (0, vue.ref)((0, vue.toValue)(rules) ?? {});
|
|
42
|
-
const formRef = (0, vue.ref)();
|
|
43
|
-
const formProps = {
|
|
44
|
-
ref: formRef,
|
|
45
|
-
model: (0, vue.reactive)(formValue.value),
|
|
46
|
-
rules: (0, vue.reactive)(formRules.value)
|
|
47
|
-
};
|
|
48
|
-
const onValidatedEvent = (0, __vueuse_core.createEventHook)();
|
|
49
|
-
function setValue(_value) {
|
|
50
|
-
Object.assign(formValue.value, _value);
|
|
51
|
-
}
|
|
52
|
-
function validate() {
|
|
53
|
-
return new Promise((resolve, reject) => {
|
|
54
|
-
if (!formRef.value) return reject(/* @__PURE__ */ new Error("useNaiveForm: formRef is not found."));
|
|
55
|
-
formRef.value.validate().then((res) => {
|
|
56
|
-
onValidatedEvent.trigger((0, vue.toRaw)((0, vue.toValue)(formValue)));
|
|
57
|
-
return resolve(res);
|
|
58
|
-
}).catch(reject);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function resetValidation() {
|
|
62
|
-
formRef.value?.restoreValidation();
|
|
63
|
-
}
|
|
64
|
-
function clear() {
|
|
65
|
-
clearObjectValues(formValue.value, clearRules);
|
|
66
|
-
}
|
|
67
|
-
function resetForm() {
|
|
68
|
-
clear();
|
|
69
|
-
const _cacheValue = (0, es_toolkit_object.cloneDeep)(cacheValue);
|
|
70
|
-
deepMerge(formValue.value, _cacheValue);
|
|
71
|
-
}
|
|
72
|
-
function reset() {
|
|
73
|
-
resetValidation();
|
|
74
|
-
resetForm();
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
formRef,
|
|
78
|
-
formValue,
|
|
79
|
-
formRules,
|
|
80
|
-
formProps,
|
|
81
|
-
setValue,
|
|
82
|
-
validate,
|
|
83
|
-
resetValidation,
|
|
84
|
-
resetForm,
|
|
85
|
-
reset,
|
|
86
|
-
clear,
|
|
87
|
-
onValidated: onValidatedEvent.on
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
//#endregion
|
|
92
|
-
exports.useNaiveForm = useNaiveForm;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { DataObject } from "./useDataRequest.cjs";
|
|
2
|
-
import * as vue5 from "vue";
|
|
3
|
-
import { Ref } from "vue";
|
|
4
|
-
import * as _vueuse_core3 from "@vueuse/core";
|
|
5
|
-
import { ValidateError } from "async-validator";
|
|
6
|
-
import { FormInst, FormItemRule, FormRules } from "naive-ui";
|
|
7
|
-
|
|
8
|
-
//#region src/composables/useNaiveForm.d.ts
|
|
9
|
-
type NaiveFormClearRules = {
|
|
10
|
-
string?: string | null;
|
|
11
|
-
number?: number | null;
|
|
12
|
-
boolean?: boolean | null;
|
|
13
|
-
};
|
|
14
|
-
type NaiveFormRules<T extends DataObject> = Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>;
|
|
15
|
-
type NaiveFormOptions<T extends DataObject> = {
|
|
16
|
-
rules?: NaiveFormRules<T> | Ref<NaiveFormRules<T>>;
|
|
17
|
-
clearRules?: NaiveFormClearRules;
|
|
18
|
-
};
|
|
19
|
-
declare function useNaiveForm<T extends DataObject = DataObject>(value?: T | Ref<T>, options?: NaiveFormOptions<T>): {
|
|
20
|
-
formRef: Ref<FormInst | undefined, FormInst | undefined>;
|
|
21
|
-
formValue: Ref<T, T>;
|
|
22
|
-
formRules: Ref<Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>, Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>>;
|
|
23
|
-
formProps: {
|
|
24
|
-
ref: Ref<FormInst | undefined, FormInst | undefined>;
|
|
25
|
-
model: vue5.Reactive<T>;
|
|
26
|
-
rules: vue5.Reactive<Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>>;
|
|
27
|
-
};
|
|
28
|
-
setValue: (_value: Partial<T>) => void;
|
|
29
|
-
validate: () => Promise<{
|
|
30
|
-
warnings?: ValidateError[][];
|
|
31
|
-
}>;
|
|
32
|
-
resetValidation: () => void;
|
|
33
|
-
resetForm: () => void;
|
|
34
|
-
reset: () => void;
|
|
35
|
-
clear: () => void;
|
|
36
|
-
onValidated: _vueuse_core3.EventHookOn<[T]>;
|
|
37
|
-
};
|
|
38
|
-
type NaiveFormReturns<T extends DataObject = DataObject> = ReturnType<typeof useNaiveForm<T>>;
|
|
39
|
-
//#endregion
|
|
40
|
-
export { NaiveFormClearRules, NaiveFormOptions, NaiveFormReturns, NaiveFormRules, useNaiveForm };
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require__helper = require('./_helper.cjs');
|
|
3
|
-
let vue = require("vue");
|
|
4
|
-
vue = require_rolldown_runtime.__toESM(vue);
|
|
5
|
-
let naive_ui = require("naive-ui");
|
|
6
|
-
naive_ui = require_rolldown_runtime.__toESM(naive_ui);
|
|
7
|
-
|
|
8
|
-
//#region src/composables/useNaiveTheme.ts
|
|
9
|
-
const naiveLocaleMap = {
|
|
10
|
-
"zh-CN": {
|
|
11
|
-
name: "简体中文",
|
|
12
|
-
dateLocale: naive_ui.dateZhCN,
|
|
13
|
-
locale: naive_ui.zhCN
|
|
14
|
-
},
|
|
15
|
-
"en-US": {
|
|
16
|
-
name: "English",
|
|
17
|
-
dateLocale: naive_ui.dateEnUS,
|
|
18
|
-
locale: naive_ui.enUS
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
function useNaiveTheme(options) {
|
|
22
|
-
const { language, darkMode, colors, globalThemeOverrides } = options ?? {};
|
|
23
|
-
const languageRef = (0, vue.ref)((0, vue.toValue)(language));
|
|
24
|
-
(0, vue.watchEffect)(() => {
|
|
25
|
-
languageRef.value = (0, vue.toValue)(language);
|
|
26
|
-
});
|
|
27
|
-
const darkModeRef = (0, vue.ref)((0, vue.toValue)(darkMode));
|
|
28
|
-
(0, vue.watchEffect)(() => {
|
|
29
|
-
darkModeRef.value = (0, vue.toValue)(darkMode);
|
|
30
|
-
});
|
|
31
|
-
const { common,...extra } = globalThemeOverrides ?? {};
|
|
32
|
-
const colorRef = (0, vue.ref)({ ...colors });
|
|
33
|
-
function setColor(v) {
|
|
34
|
-
colorRef.value = {
|
|
35
|
-
...colorRef.value,
|
|
36
|
-
...v
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
language: languageRef,
|
|
41
|
-
darkMode: darkModeRef,
|
|
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
|
-
}),
|
|
83
|
-
color: colorRef,
|
|
84
|
-
setColor
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
//#endregion
|
|
89
|
-
exports.useNaiveTheme = useNaiveTheme;
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { Colors } from "./_helper.cjs";
|
|
2
|
-
import { ComputedRef, Ref } from "vue";
|
|
3
|
-
import { GlobalThemeOverrides, NDateLocale } from "naive-ui";
|
|
4
|
-
import * as naive_ui_es_themes_interface0 from "naive-ui/es/themes/interface";
|
|
5
|
-
|
|
6
|
-
//#region src/composables/useNaiveTheme.d.ts
|
|
7
|
-
interface NaiveThemeOptions {
|
|
8
|
-
language?: string | Ref<string>;
|
|
9
|
-
darkMode?: boolean | Ref<boolean>;
|
|
10
|
-
colors?: Colors;
|
|
11
|
-
globalThemeOverrides?: GlobalThemeOverrides;
|
|
12
|
-
}
|
|
13
|
-
declare function useNaiveTheme(options?: NaiveThemeOptions): {
|
|
14
|
-
language: Ref<string | undefined, string | undefined>;
|
|
15
|
-
darkMode: Ref<boolean | undefined, boolean | undefined>;
|
|
16
|
-
theme: ComputedRef<naive_ui_es_themes_interface0.BuiltInGlobalTheme | undefined>;
|
|
17
|
-
themeOverrides: ComputedRef<GlobalThemeOverrides>;
|
|
18
|
-
locale: ComputedRef<{
|
|
19
|
-
name: string;
|
|
20
|
-
global: {
|
|
21
|
-
undo: string;
|
|
22
|
-
redo: string;
|
|
23
|
-
confirm: string;
|
|
24
|
-
clear: string;
|
|
25
|
-
};
|
|
26
|
-
Popconfirm: {
|
|
27
|
-
positiveText: string;
|
|
28
|
-
negativeText: string;
|
|
29
|
-
};
|
|
30
|
-
Cascader: {
|
|
31
|
-
placeholder: string;
|
|
32
|
-
loading: string;
|
|
33
|
-
loadingRequiredMessage: (label: string) => string;
|
|
34
|
-
};
|
|
35
|
-
Time: {
|
|
36
|
-
dateFormat: string;
|
|
37
|
-
dateTimeFormat: string;
|
|
38
|
-
};
|
|
39
|
-
DatePicker: {
|
|
40
|
-
yearFormat: string;
|
|
41
|
-
monthFormat: string;
|
|
42
|
-
dayFormat: string;
|
|
43
|
-
yearTypeFormat: string;
|
|
44
|
-
monthTypeFormat: string;
|
|
45
|
-
dateFormat: string;
|
|
46
|
-
dateTimeFormat: string;
|
|
47
|
-
quarterFormat: string;
|
|
48
|
-
weekFormat: string;
|
|
49
|
-
clear: string;
|
|
50
|
-
now: string;
|
|
51
|
-
confirm: string;
|
|
52
|
-
selectTime: string;
|
|
53
|
-
selectDate: string;
|
|
54
|
-
datePlaceholder: string;
|
|
55
|
-
datetimePlaceholder: string;
|
|
56
|
-
monthPlaceholder: string;
|
|
57
|
-
yearPlaceholder: string;
|
|
58
|
-
quarterPlaceholder: string;
|
|
59
|
-
weekPlaceholder: string;
|
|
60
|
-
startDatePlaceholder: string;
|
|
61
|
-
endDatePlaceholder: string;
|
|
62
|
-
startDatetimePlaceholder: string;
|
|
63
|
-
endDatetimePlaceholder: string;
|
|
64
|
-
startMonthPlaceholder: string;
|
|
65
|
-
endMonthPlaceholder: string;
|
|
66
|
-
monthBeforeYear: boolean;
|
|
67
|
-
firstDayOfWeek: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
68
|
-
today: string;
|
|
69
|
-
};
|
|
70
|
-
DataTable: {
|
|
71
|
-
checkTableAll: string;
|
|
72
|
-
uncheckTableAll: string;
|
|
73
|
-
confirm: string;
|
|
74
|
-
clear: string;
|
|
75
|
-
};
|
|
76
|
-
LegacyTransfer: {
|
|
77
|
-
sourceTitle: string;
|
|
78
|
-
targetTitle: string;
|
|
79
|
-
};
|
|
80
|
-
Transfer: {
|
|
81
|
-
selectAll: string;
|
|
82
|
-
unselectAll: string;
|
|
83
|
-
clearAll: string;
|
|
84
|
-
total: (num: number) => string;
|
|
85
|
-
selected: (num: number) => string;
|
|
86
|
-
};
|
|
87
|
-
Empty: {
|
|
88
|
-
description: string;
|
|
89
|
-
};
|
|
90
|
-
Select: {
|
|
91
|
-
placeholder: string;
|
|
92
|
-
};
|
|
93
|
-
TimePicker: {
|
|
94
|
-
placeholder: string;
|
|
95
|
-
positiveText: string;
|
|
96
|
-
negativeText: string;
|
|
97
|
-
now: string;
|
|
98
|
-
clear: string;
|
|
99
|
-
};
|
|
100
|
-
Pagination: {
|
|
101
|
-
goto: string;
|
|
102
|
-
selectionSuffix: string;
|
|
103
|
-
};
|
|
104
|
-
DynamicTags: {
|
|
105
|
-
add: string;
|
|
106
|
-
};
|
|
107
|
-
Log: {
|
|
108
|
-
loading: string;
|
|
109
|
-
};
|
|
110
|
-
Input: {
|
|
111
|
-
placeholder: string;
|
|
112
|
-
};
|
|
113
|
-
InputNumber: {
|
|
114
|
-
placeholder: string;
|
|
115
|
-
};
|
|
116
|
-
DynamicInput: {
|
|
117
|
-
create: string;
|
|
118
|
-
};
|
|
119
|
-
ThemeEditor: {
|
|
120
|
-
title: string;
|
|
121
|
-
clearAllVars: string;
|
|
122
|
-
clearSearch: string;
|
|
123
|
-
filterCompName: string;
|
|
124
|
-
filterVarName: string;
|
|
125
|
-
import: string;
|
|
126
|
-
export: string;
|
|
127
|
-
restore: string;
|
|
128
|
-
};
|
|
129
|
-
Image: {
|
|
130
|
-
tipPrevious: string;
|
|
131
|
-
tipNext: string;
|
|
132
|
-
tipCounterclockwise: string;
|
|
133
|
-
tipClockwise: string;
|
|
134
|
-
tipZoomOut: string;
|
|
135
|
-
tipZoomIn: string;
|
|
136
|
-
tipDownload: string;
|
|
137
|
-
tipClose: string;
|
|
138
|
-
tipOriginalSize: string;
|
|
139
|
-
};
|
|
140
|
-
Heatmap: {
|
|
141
|
-
less: string;
|
|
142
|
-
more: string;
|
|
143
|
-
monthFormat: string;
|
|
144
|
-
weekdayFormat: string;
|
|
145
|
-
};
|
|
146
|
-
}>;
|
|
147
|
-
dateLocale: ComputedRef<NDateLocale>;
|
|
148
|
-
color: Ref<{
|
|
149
|
-
primary?: string | undefined;
|
|
150
|
-
info?: string | undefined;
|
|
151
|
-
success?: string | undefined;
|
|
152
|
-
warning?: string | undefined;
|
|
153
|
-
error?: string | undefined;
|
|
154
|
-
}, {
|
|
155
|
-
primary?: string;
|
|
156
|
-
info?: string;
|
|
157
|
-
success?: string;
|
|
158
|
-
warning?: string;
|
|
159
|
-
error?: string;
|
|
160
|
-
} | {
|
|
161
|
-
primary?: string | undefined;
|
|
162
|
-
info?: string | undefined;
|
|
163
|
-
success?: string | undefined;
|
|
164
|
-
warning?: string | undefined;
|
|
165
|
-
error?: string | undefined;
|
|
166
|
-
}>;
|
|
167
|
-
setColor: (v: Partial<Colors>) => void;
|
|
168
|
-
};
|
|
169
|
-
type NaiveThemeReturns = ReturnType<typeof useNaiveTheme>;
|
|
170
|
-
//#endregion
|
|
171
|
-
export { NaiveThemeReturns, useNaiveTheme };
|
package/dist/index.cjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const require_useDataRequest = require('./composables/useDataRequest.cjs');
|
|
2
|
-
const require_useNaiveForm = require('./composables/useNaiveForm.cjs');
|
|
3
|
-
const require_useNaiveTheme = require('./composables/useNaiveTheme.cjs');
|
|
4
|
-
|
|
5
|
-
exports.useDataRequest = require_useDataRequest.useDataRequest;
|
|
6
|
-
exports.useNaiveForm = require_useNaiveForm.useNaiveForm;
|
|
7
|
-
exports.useNaiveTheme = require_useNaiveTheme.useNaiveTheme;
|
package/dist/index.d.cts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { DataObject, DataRequestFields, UseDataRequestOptions, UseDataRequestPagination, UseDataRequestReturns, useDataRequest } from "./composables/useDataRequest.cjs";
|
|
2
|
-
import { NaiveFormClearRules, NaiveFormOptions, NaiveFormReturns, NaiveFormRules, useNaiveForm } from "./composables/useNaiveForm.cjs";
|
|
3
|
-
import { NaiveThemeReturns, useNaiveTheme } from "./composables/useNaiveTheme.cjs";
|
|
4
|
-
export { DataObject, DataRequestFields, NaiveFormClearRules, NaiveFormOptions, NaiveFormReturns, NaiveFormRules, NaiveThemeReturns, UseDataRequestOptions, UseDataRequestPagination, UseDataRequestReturns, useDataRequest, useNaiveForm, useNaiveTheme };
|