@oiij/naive-ui 0.0.71 → 0.0.73

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.
Files changed (28) hide show
  1. package/dist/components/data-table-plus/DataTablePlus.js +11 -11
  2. package/dist/components/data-table-plus/DataTablePlus.vue.d.ts +11 -11
  3. package/dist/components/index.d.ts +1 -1
  4. package/dist/components/loading-provider/LoadingProvider.vue.d.ts +2 -2
  5. package/dist/components/preset-form/PresetForm.js +13 -12
  6. package/dist/components/preset-form/PresetForm.vue.d.ts +23 -14
  7. package/dist/components/preset-form/index.d.ts +5 -5
  8. package/dist/components/preset-input/PresetInput.vue.d.ts +3 -3
  9. package/dist/components/preset-picker/PresetPicker.vue.d.ts +4 -4
  10. package/dist/components/preset-select/PresetSelect.js +9 -9
  11. package/dist/components/preset-select/PresetSelect.vue.d.ts +4 -4
  12. package/dist/components/remote-request/RemoteRequest.js +8 -8
  13. package/dist/components/remote-request/RemoteRequest.vue.d.ts +9 -9
  14. package/dist/components/search-input/SearchInput.vue.d.ts +4 -4
  15. package/dist/components/toggle-input/ToggleInput.vue.d.ts +4 -4
  16. package/dist/components/tooltip-button/TooltipButton.vue.d.ts +4 -4
  17. package/dist/components/transition/BaseTransition.vue.d.ts +2 -2
  18. package/dist/components/type-writer/TypeWriter.js +10 -7
  19. package/dist/components/type-writer/TypeWriter.vue.d.ts +4 -4
  20. package/dist/components.d.ts +2 -2
  21. package/dist/composables/index.d.ts +2 -2
  22. package/dist/composables/use-data-request.js +18 -18
  23. package/dist/composables/use-naive-form.d.ts +13 -12
  24. package/dist/composables/use-naive-form.js +22 -18
  25. package/dist/composables/use-naive-theme.d.ts +10 -10
  26. package/dist/composables/use-naive-theme.js +12 -16
  27. package/dist/index.d.ts +3 -3
  28. package/package.json +13 -13
@@ -113,26 +113,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
113
113
  requestOptions: __props.requestOptions,
114
114
  requestPlugins: __props.requestPlugins
115
115
  });
116
- onBefore((params$1) => {
117
- emit("before", params$1);
116
+ onBefore((params) => {
117
+ emit("before", params);
118
118
  });
119
- onSuccess((data$1, params$1) => {
120
- emit("success", data$1, params$1);
121
- onSuccessEffect(data$1, params$1);
119
+ onSuccess((data, params) => {
120
+ emit("success", data, params);
121
+ onSuccessEffect(data, params);
122
122
  });
123
- onError((err, params$1) => {
124
- emit("error", err, params$1);
123
+ onError((err, params) => {
124
+ emit("error", err, params);
125
125
  });
126
- onFinally((params$1, data$1, err) => {
127
- emit("finally", params$1, data$1, err);
126
+ onFinally((params, data, err) => {
127
+ emit("finally", params, data, err);
128
128
  });
129
129
  const scrollX = computed(() => {
130
130
  return __props.columns?.reduce((pre, cur) => {
131
131
  return pre + Number(cur.width ?? 100);
132
132
  }, 0);
133
133
  });
134
- function onSuccessEffect(data$1, _params) {
135
- data$1[_fields.list]?.forEach((f) => {
134
+ function onSuccessEffect(data, _params) {
135
+ data[_fields.list]?.forEach((f) => {
136
136
  if (!_dataCache.some((s) => s?.[_fields.rowKey] === f?.[_fields.rowKey])) _dataCache.push(f);
137
137
  });
138
138
  if (columnsReactive) {
@@ -2,12 +2,12 @@ import { DataObject, UseDataRequestPagination } from "../../composables/use-data
2
2
  import { DataTablePlusEmits, DataTablePlusExpose, DataTablePlusProps } from "./index.js";
3
3
  import "../../composables/index.js";
4
4
  import * as _vueuse_core31 from "@vueuse/core";
5
- import * as vue63 from "vue";
5
+ import * as vue69 from "vue";
6
6
  import { DataTableBaseColumn, DataTableFilterState, DataTableInst, DataTableSortState } from "naive-ui";
7
7
 
8
8
  //#region src/components/data-table-plus/DataTablePlus.vue.d.ts
9
9
  declare const __VLS_export: <P extends DataObject, D extends DataObject, R extends DataObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
10
- props: vue63.PublicProps & __VLS_PrettifyLocal<DataTablePlusProps<P, D, R> & {
10
+ props: vue69.PublicProps & __VLS_PrettifyLocal<DataTablePlusProps<P, D, R> & {
11
11
  onSuccess?: ((data: D, params: P[]) => any) | undefined;
12
12
  onError?: ((err: Error, params: P[]) => any) | undefined;
13
13
  onLoad?: ((row: R) => any) | undefined;
@@ -29,7 +29,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
29
29
  }> & (typeof globalThis extends {
30
30
  __VLS_PROPS_FALLBACK: infer P_1;
31
31
  } ? P_1 : {});
32
- expose: (exposed: vue63.ShallowUnwrapRef<DataTablePlusExpose<P, D, R>>) => void;
32
+ expose: (exposed: vue69.ShallowUnwrapRef<DataTablePlusExpose<P, D, R>>) => void;
33
33
  attrs: any;
34
34
  slots: {
35
35
  header?: (props: {
@@ -46,7 +46,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
46
46
  filters: DataTableFilterState | undefined;
47
47
  sorters: Record<string, DataTableSortState> | undefined;
48
48
  dataTableRef: DataTableInst | null;
49
- pagination: vue63.Ref<{
49
+ pagination: vue69.Ref<{
50
50
  page: number;
51
51
  pageSize: number;
52
52
  itemCount: number;
@@ -86,7 +86,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
86
86
  filters: DataTableFilterState | undefined;
87
87
  sorters: Record<string, DataTableSortState> | undefined;
88
88
  dataTableRef: DataTableInst | null;
89
- pagination: vue63.Ref<{
89
+ pagination: vue69.Ref<{
90
90
  page: number;
91
91
  pageSize: number;
92
92
  itemCount: number;
@@ -124,7 +124,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
124
124
  filters: DataTableFilterState | undefined;
125
125
  sorters: Record<string, DataTableSortState> | undefined;
126
126
  dataTableRef: DataTableInst | null;
127
- pagination: vue63.Ref<{
127
+ pagination: vue69.Ref<{
128
128
  page: number;
129
129
  pageSize: number;
130
130
  itemCount: number;
@@ -162,7 +162,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
162
162
  filters: DataTableFilterState | undefined;
163
163
  sorters: Record<string, DataTableSortState> | undefined;
164
164
  dataTableRef: DataTableInst | null;
165
- pagination: vue63.Ref<{
165
+ pagination: vue69.Ref<{
166
166
  page: number;
167
167
  pageSize: number;
168
168
  itemCount: number;
@@ -200,7 +200,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
200
200
  filters: DataTableFilterState | undefined;
201
201
  sorters: Record<string, DataTableSortState> | undefined;
202
202
  dataTableRef: DataTableInst | null;
203
- pagination: vue63.Ref<{
203
+ pagination: vue69.Ref<{
204
204
  page: number;
205
205
  pageSize: number;
206
206
  itemCount: number;
@@ -238,7 +238,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
238
238
  filters: DataTableFilterState | undefined;
239
239
  sorters: Record<string, DataTableSortState> | undefined;
240
240
  dataTableRef: DataTableInst | null;
241
- pagination: vue63.Ref<{
241
+ pagination: vue69.Ref<{
242
242
  page: number;
243
243
  pageSize: number;
244
244
  itemCount: number;
@@ -276,7 +276,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
276
276
  filters: DataTableFilterState | undefined;
277
277
  sorters: Record<string, DataTableSortState> | undefined;
278
278
  dataTableRef: DataTableInst | null;
279
- pagination: vue63.Ref<{
279
+ pagination: vue69.Ref<{
280
280
  page: number;
281
281
  pageSize: number;
282
282
  itemCount: number;
@@ -301,7 +301,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
301
301
  }) => any;
302
302
  };
303
303
  emit: DataTablePlusEmits<P, D, R>;
304
- }>) => vue63.VNode & {
304
+ }>) => vue69.VNode & {
305
305
  __ctx?: Awaited<typeof __VLS_setup>;
306
306
  };
307
307
  declare const _default: typeof __VLS_export;
@@ -6,7 +6,7 @@ import { _default as _default$2 } from "./data-table-plus/DataTablePlus.vue.js";
6
6
  import { ClassStyle, DataTablePlusEmits, DataTablePlusExpose, DataTablePlusFields, DataTablePlusInst, DataTablePlusProps } from "./data-table-plus/index.js";
7
7
  import { _default as _default$3 } from "./loading-provider/LoadingProvider.vue.js";
8
8
  import { LoadingProviderInst, LoadingProviderProps, loadingProviderInjectionKey } from "./loading-provider/index.js";
9
- import { NaiveFormRules } from "../composables/use-naive-form.js";
9
+ import { UseNaiveFormRules } from "../composables/use-naive-form.js";
10
10
  import { _default as _default$4 } from "./config-providers/ConfigProviders.vue.js";
11
11
  import { ConfigProvidersProps } from "./config-providers/index.js";
12
12
  import { _default as _default$5 } from "./copy-button/CopyButton.vue.js";
@@ -1,5 +1,5 @@
1
1
  import { LoadingProviderProps } from "./index.js";
2
- import * as vue23 from "vue";
2
+ import * as vue33 from "vue";
3
3
 
4
4
  //#region src/components/loading-provider/LoadingProvider.vue.d.ts
5
5
  declare var __VLS_26: {}, __VLS_29: {}, __VLS_31: {};
@@ -10,7 +10,7 @@ type __VLS_Slots = {} & {
10
10
  } & {
11
11
  default?: (props: typeof __VLS_31) => any;
12
12
  };
13
- declare const __VLS_base: vue23.DefineComponent<LoadingProviderProps, {}, {}, {}, {}, vue23.ComponentOptionsMixin, vue23.ComponentOptionsMixin, {}, string, vue23.PublicProps, Readonly<LoadingProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, vue23.ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_base: vue33.DefineComponent<LoadingProviderProps, {}, {}, {}, {}, vue33.ComponentOptionsMixin, vue33.ComponentOptionsMixin, {}, string, vue33.PublicProps, Readonly<LoadingProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, vue33.ComponentProvideOptions, false, {}, any>;
14
14
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
15
  declare const _default: typeof __VLS_export;
16
16
  type __VLS_WithSlots<T, S> = T & {
@@ -9,7 +9,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
9
9
  __name: "PresetForm",
10
10
  props: {
11
11
  options: {},
12
- values: {},
12
+ value: {},
13
13
  rules: {},
14
14
  clearRules: {},
15
15
  formProps: {},
@@ -18,7 +18,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
18
18
  emits: ["validated"],
19
19
  setup(__props, { expose: __expose, emit: __emit }) {
20
20
  const emit = __emit;
21
- const { formValue, formRules, formRef, formProps: _formProps, setValue, validate, resetValidation, resetForm, reset, clear, onValidated } = useNaiveForm(useTemplateRef("form-ref"), __props.values, {
21
+ const { formValueRef, formRulesRef, formInstRef, formProps: _formProps, setValue, validate, resetValidation, resetForm, reset, clear, onValidated } = useNaiveForm(useTemplateRef("form-ref"), {
22
+ value: __props.value,
22
23
  rules: __props.rules,
23
24
  clearRules: __props.clearRules
24
25
  });
@@ -36,9 +37,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
37
  if (key) setValue({ [key]: val });
37
38
  }
38
39
  const expose = {
39
- formRef,
40
- formValue,
41
- formRules,
40
+ formInstRef,
41
+ formValueRef,
42
+ formRulesRef,
42
43
  formProps: _formProps,
43
44
  setValue,
44
45
  validate,
@@ -51,9 +52,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
51
52
  const templateBind = computed(() => {
52
53
  return {
53
54
  ...expose,
54
- formRef: toValue(formRef),
55
- formValue: toValue(formValue),
56
- formRules: toValue(formRules),
55
+ formRef: toValue(formInstRef),
56
+ formValue: toValue(formValueRef),
57
+ formRules: toValue(formRulesRef),
57
58
  formProps: toValue(_formProps)
58
59
  };
59
60
  });
@@ -61,8 +62,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
61
62
  return (_ctx, _cache) => {
62
63
  return openBlock(), createBlock(unref(NForm), mergeProps({
63
64
  ref: "form-ref",
64
- model: unref(formValue),
65
- rules: unref(formRules)
65
+ model: unref(formValueRef),
66
+ rules: unref(formRulesRef)
66
67
  }, __props.formProps), {
67
68
  default: withCtx(() => [
68
69
  renderSlot(_ctx.$slots, "header", normalizeProps(guardReactiveProps(templateBind.value))),
@@ -91,7 +92,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
91
92
  })), { key: 0 })) : (openBlock(), createBlock(unref(PresetInput_default), {
92
93
  key: 1,
93
94
  options: opt,
94
- value: key ? unref(formValue)[key] : void 0,
95
+ value: key ? unref(formValueRef)[key] : void 0,
95
96
  "onUpdate:value": (val) => onPresetInputUpdate(val, key)
96
97
  }, null, 8, [
97
98
  "options",
@@ -143,7 +144,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
143
144
  })), { key: 0 })) : (openBlock(), createBlock(unref(PresetInput_default), {
144
145
  key: 1,
145
146
  options: opt,
146
- value: key ? unref(formValue)[key] : void 0,
147
+ value: key ? unref(formValueRef)[key] : void 0,
147
148
  "onUpdate:value": (val) => onPresetInputUpdate(val, key)
148
149
  }, null, 8, [
149
150
  "options",
@@ -1,19 +1,19 @@
1
1
  import { DataObject } from "../../composables/use-data-request.js";
2
2
  import { PresetFormExpose, PresetFormProps } from "./index.js";
3
- import * as _vueuse_core4 from "@vueuse/core";
4
- import * as vue33 from "vue";
3
+ import * as _vueuse_core8 from "@vueuse/core";
4
+ import * as vue48 from "vue";
5
5
  import * as naive_ui0 from "naive-ui";
6
6
  import { FormInst } from "naive-ui";
7
7
  import * as async_validator0 from "async-validator";
8
8
 
9
9
  //#region src/components/preset-form/PresetForm.vue.d.ts
10
10
  declare const __VLS_export: <V extends DataObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
11
- props: vue33.PublicProps & __VLS_PrettifyLocal<PresetFormProps<V> & {
11
+ props: vue48.PublicProps & __VLS_PrettifyLocal<PresetFormProps<V> & {
12
12
  onValidated?: ((val: V) => any) | undefined;
13
13
  }> & (typeof globalThis extends {
14
14
  __VLS_PROPS_FALLBACK: infer P;
15
15
  } ? P : {});
16
- expose: (exposed: vue33.ShallowUnwrapRef<PresetFormExpose<V>>) => void;
16
+ expose: (exposed: vue48.ShallowUnwrapRef<PresetFormExpose<V>>) => void;
17
17
  attrs: any;
18
18
  slots: {
19
19
  header?: (props: {
@@ -21,9 +21,12 @@ declare const __VLS_export: <V extends DataObject>(__VLS_props: NonNullable<Awai
21
21
  formValue: V;
22
22
  formRules: Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>;
23
23
  formProps: {
24
- model: vue33.Reactive<V>;
25
- rules: vue33.Reactive<Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
24
+ model: vue48.Reactive<V>;
25
+ rules: vue48.Reactive<Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
26
26
  };
27
+ formInstRef: Readonly<vue48.ShallowRef<FormInst | null>>;
28
+ formValueRef: vue48.Ref<V, V>;
29
+ formRulesRef: vue48.Ref<Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>, Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
27
30
  setValue: (_value: Partial<V>) => void;
28
31
  validate: () => Promise<{
29
32
  warnings?: async_validator0.ValidateError[][];
@@ -32,7 +35,7 @@ declare const __VLS_export: <V extends DataObject>(__VLS_props: NonNullable<Awai
32
35
  resetForm: () => void;
33
36
  reset: () => void;
34
37
  clear: () => void;
35
- onValidated: _vueuse_core4.EventHookOn<[V]>;
38
+ onValidated: _vueuse_core8.EventHookOn<[V]>;
36
39
  }) => any;
37
40
  } & {
38
41
  default?: (props: {
@@ -40,9 +43,12 @@ declare const __VLS_export: <V extends DataObject>(__VLS_props: NonNullable<Awai
40
43
  formValue: V;
41
44
  formRules: Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>;
42
45
  formProps: {
43
- model: vue33.Reactive<V>;
44
- rules: vue33.Reactive<Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
46
+ model: vue48.Reactive<V>;
47
+ rules: vue48.Reactive<Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
45
48
  };
49
+ formInstRef: Readonly<vue48.ShallowRef<FormInst | null>>;
50
+ formValueRef: vue48.Ref<V, V>;
51
+ formRulesRef: vue48.Ref<Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>, Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
46
52
  setValue: (_value: Partial<V>) => void;
47
53
  validate: () => Promise<{
48
54
  warnings?: async_validator0.ValidateError[][];
@@ -51,7 +57,7 @@ declare const __VLS_export: <V extends DataObject>(__VLS_props: NonNullable<Awai
51
57
  resetForm: () => void;
52
58
  reset: () => void;
53
59
  clear: () => void;
54
- onValidated: _vueuse_core4.EventHookOn<[V]>;
60
+ onValidated: _vueuse_core8.EventHookOn<[V]>;
55
61
  }) => any;
56
62
  } & {
57
63
  footer?: (props: {
@@ -59,9 +65,12 @@ declare const __VLS_export: <V extends DataObject>(__VLS_props: NonNullable<Awai
59
65
  formValue: V;
60
66
  formRules: Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>;
61
67
  formProps: {
62
- model: vue33.Reactive<V>;
63
- rules: vue33.Reactive<Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
68
+ model: vue48.Reactive<V>;
69
+ rules: vue48.Reactive<Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
64
70
  };
71
+ formInstRef: Readonly<vue48.ShallowRef<FormInst | null>>;
72
+ formValueRef: vue48.Ref<V, V>;
73
+ formRulesRef: vue48.Ref<Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>, Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
65
74
  setValue: (_value: Partial<V>) => void;
66
75
  validate: () => Promise<{
67
76
  warnings?: async_validator0.ValidateError[][];
@@ -70,11 +79,11 @@ declare const __VLS_export: <V extends DataObject>(__VLS_props: NonNullable<Awai
70
79
  resetForm: () => void;
71
80
  reset: () => void;
72
81
  clear: () => void;
73
- onValidated: _vueuse_core4.EventHookOn<[V]>;
82
+ onValidated: _vueuse_core8.EventHookOn<[V]>;
74
83
  }) => any;
75
84
  };
76
85
  emit: (e: "validated", val: V) => void;
77
- }>) => vue33.VNode & {
86
+ }>) => vue48.VNode & {
78
87
  __ctx?: Awaited<typeof __VLS_setup>;
79
88
  };
80
89
  declare const _default: typeof __VLS_export;
@@ -1,6 +1,6 @@
1
1
  import { DataObject } from "../../composables/use-data-request.js";
2
2
  import { ClassStyle } from "../data-table-plus/index.js";
3
- import { NaiveFormClearRules, NaiveFormReturns, NaiveFormRules } from "../../composables/use-naive-form.js";
3
+ import { UseNaiveFormClearRules, UseNaiveFormReturns, UseNaiveFormRules } from "../../composables/use-naive-form.js";
4
4
  import { PresetInputOptions } from "../preset-input/index.js";
5
5
  import { _default } from "./PresetForm.vue.js";
6
6
  import { VNode } from "vue";
@@ -8,7 +8,7 @@ import { FormItemProps, FormItemRule, FormProps, FormRules, GridItemProps, GridP
8
8
  import { ComponentExposed } from "vue-component-type-helpers";
9
9
 
10
10
  //#region src/components/preset-form/index.d.ts
11
- type PresetFormExpose<V extends DataObject = DataObject> = NaiveFormReturns<V>;
11
+ type PresetFormExpose<V extends DataObject = DataObject> = UseNaiveFormReturns<V>;
12
12
  type PresetFormOptionItem<V extends DataObject = DataObject> = PresetInputOptions & {
13
13
  key?: keyof V;
14
14
  label?: string | (() => string);
@@ -25,9 +25,9 @@ type PresetFormOptionItem<V extends DataObject = DataObject> = PresetInputOption
25
25
  type PresetFormOptions<V extends DataObject = DataObject> = PresetFormOptionItem<V>[];
26
26
  type PresetFormProps<V extends DataObject = DataObject> = {
27
27
  options?: PresetFormOptions<V>;
28
- values?: V;
29
- rules?: NaiveFormRules<V>;
30
- clearRules?: NaiveFormClearRules;
28
+ value?: V;
29
+ rules?: UseNaiveFormRules<V>;
30
+ clearRules?: UseNaiveFormClearRules;
31
31
  formProps?: FormProps & ClassStyle;
32
32
  gridProps?: GridProps & ClassStyle;
33
33
  };
@@ -1,9 +1,9 @@
1
1
  import { PresetInputProps } from "./index.js";
2
- import * as vue52 from "vue";
2
+ import * as vue46 from "vue";
3
3
 
4
4
  //#region src/components/preset-input/PresetInput.vue.d.ts
5
5
  declare const __VLS_export: <V>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
6
- props: vue52.PublicProps & __VLS_PrettifyLocal<PresetInputProps<V> & {
6
+ props: vue46.PublicProps & __VLS_PrettifyLocal<PresetInputProps<V> & {
7
7
  "onUpdate:value"?: ((val?: V | undefined) => any) | undefined;
8
8
  }> & (typeof globalThis extends {
9
9
  __VLS_PROPS_FALLBACK: infer P;
@@ -12,7 +12,7 @@ declare const __VLS_export: <V>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
12
12
  attrs: any;
13
13
  slots: {};
14
14
  emit: (e: "update:value", val?: V) => void;
15
- }>) => vue52.VNode & {
15
+ }>) => vue46.VNode & {
16
16
  __ctx?: Awaited<typeof __VLS_setup>;
17
17
  };
18
18
  declare const _default: typeof __VLS_export;
@@ -1,11 +1,11 @@
1
1
  import { DataObject } from "../../composables/use-data-request.js";
2
2
  import { PresetPickerEmits, PresetPickerExpose, PresetPickerProps, PresetPickerValue } from "./index.js";
3
- import * as vue57 from "vue";
3
+ import * as vue79 from "vue";
4
4
  import { DataTableColumns } from "naive-ui";
5
5
 
6
6
  //#region src/components/preset-picker/PresetPicker.vue.d.ts
7
7
  declare const __VLS_export: <V extends PresetPickerValue, R extends DataObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
8
- props: vue57.PublicProps & __VLS_PrettifyLocal<PresetPickerProps<V, R> & {
8
+ props: vue79.PublicProps & __VLS_PrettifyLocal<PresetPickerProps<V, R> & {
9
9
  onClose?: (() => any) | undefined;
10
10
  "onUpdate:value"?: ((val: V | null, raw: R | R[] | null) => any) | undefined;
11
11
  onAfterEnter?: (() => any) | undefined;
@@ -18,7 +18,7 @@ declare const __VLS_export: <V extends PresetPickerValue, R extends DataObject>(
18
18
  }> & (typeof globalThis extends {
19
19
  __VLS_PROPS_FALLBACK: infer P;
20
20
  } ? P : {});
21
- expose: (exposed: vue57.ShallowUnwrapRef<PresetPickerExpose<R>>) => void;
21
+ expose: (exposed: vue79.ShallowUnwrapRef<PresetPickerExpose<R>>) => void;
22
22
  attrs: any;
23
23
  slots: {
24
24
  'button-icon'?: (props: {}) => any;
@@ -54,7 +54,7 @@ declare const __VLS_export: <V extends PresetPickerValue, R extends DataObject>(
54
54
  'modal-close'?: (props: {}) => any;
55
55
  };
56
56
  emit: PresetPickerEmits<V, R>;
57
- }>) => vue57.VNode & {
57
+ }>) => vue79.VNode & {
58
58
  __ctx?: Awaited<typeof __VLS_setup>;
59
59
  };
60
60
  declare const _default: typeof __VLS_export;
@@ -74,20 +74,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
74
74
  requestOptions: __props.requestOptions,
75
75
  requestPlugins: __props.requestPlugins
76
76
  });
77
- onBefore((params$1) => {
78
- emit("before", params$1);
77
+ onBefore((params) => {
78
+ emit("before", params);
79
79
  });
80
- onSuccess((data$1, params$1) => {
81
- emit("success", data$1, params$1);
82
- data$1?.[_fields.list]?.forEach((f) => {
80
+ onSuccess((data, params) => {
81
+ emit("success", data, params);
82
+ data?.[_fields.list]?.forEach((f) => {
83
83
  if (!_dataCache.some((s) => s?.[_fields.rowKey] === f?.[_fields.rowKey])) _dataCache.push(f);
84
84
  });
85
85
  });
86
- onError((err, params$1) => {
87
- emit("error", err, params$1);
86
+ onError((err, params) => {
87
+ emit("error", err, params);
88
88
  });
89
- onFinally((params$1, data$1, err) => {
90
- emit("finally", params$1, data$1, err);
89
+ onFinally((params, data, err) => {
90
+ emit("finally", params, data, err);
91
91
  });
92
92
  const optionsReactive = computed(() => {
93
93
  return typeof __props.optionFormat === "function" ? list.value.map((m) => __props.optionFormat(m)).filter((f) => !!f) : list.value.map((m) => {
@@ -1,12 +1,12 @@
1
1
  import { DataObject, UseDataRequestPagination } from "../../composables/use-data-request.js";
2
2
  import { PresetSelectEmits, PresetSelectExpose, PresetSelectProps, PresetSelectValue } from "./index.js";
3
3
  import * as _vueuse_core11 from "@vueuse/core";
4
- import * as vue60 from "vue";
4
+ import * as vue66 from "vue";
5
5
  import { SelectInst, SelectOption } from "naive-ui";
6
6
 
7
7
  //#region src/components/preset-select/PresetSelect.vue.d.ts
8
8
  declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject, D extends DataObject, R extends DataObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
9
- props: vue60.PublicProps & __VLS_PrettifyLocal<PresetSelectProps<V, P, D, R> & {
9
+ props: vue66.PublicProps & __VLS_PrettifyLocal<PresetSelectProps<V, P, D, R> & {
10
10
  onSuccess?: ((data: D, params: P[]) => any) | undefined;
11
11
  onError?: ((err: Error, params: P[]) => any) | undefined;
12
12
  onClear?: (() => any) | undefined;
@@ -23,7 +23,7 @@ declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject,
23
23
  }> & (typeof globalThis extends {
24
24
  __VLS_PROPS_FALLBACK: infer P_1;
25
25
  } ? P_1 : {});
26
- expose: (exposed: vue60.ShallowUnwrapRef<PresetSelectExpose<P, D, R>>) => void;
26
+ expose: (exposed: vue66.ShallowUnwrapRef<PresetSelectExpose<P, D, R>>) => void;
27
27
  attrs: any;
28
28
  slots: {
29
29
  header?: (props: {
@@ -162,7 +162,7 @@ declare const __VLS_export: <V extends PresetSelectValue, P extends DataObject,
162
162
  }) => any;
163
163
  };
164
164
  emit: PresetSelectEmits<V, P, D, R>;
165
- }>) => vue60.VNode & {
165
+ }>) => vue66.VNode & {
166
166
  __ctx?: Awaited<typeof __VLS_setup>;
167
167
  };
168
168
  declare const _default: typeof __VLS_export;
@@ -34,17 +34,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
34
34
  requestOptions: __props.requestOptions,
35
35
  requestPlugins: __props.requestPlugins
36
36
  });
37
- onBefore((params$1) => {
38
- emit("before", params$1);
37
+ onBefore((params) => {
38
+ emit("before", params);
39
39
  });
40
- onSuccess((data$1, params$1) => {
41
- emit("success", data$1, params$1);
40
+ onSuccess((data, params) => {
41
+ emit("success", data, params);
42
42
  });
43
- onError((err, params$1) => {
44
- emit("error", err, params$1);
43
+ onError((err, params) => {
44
+ emit("error", err, params);
45
45
  });
46
- onFinally((params$1, data$1, err) => {
47
- emit("finally", params$1, data$1, err);
46
+ onFinally((params, data, err) => {
47
+ emit("finally", params, data, err);
48
48
  });
49
49
  const expose = {
50
50
  loading,
@@ -1,11 +1,11 @@
1
1
  import { DataObject, UseDataRequestPagination } from "../../composables/use-data-request.js";
2
2
  import { RemoteRequestEmits, RemoteRequestExpose, RemoteRequestProps } from "./index.js";
3
- import * as _vueuse_core7 from "@vueuse/core";
4
- import * as vue54 from "vue";
3
+ import * as _vueuse_core4 from "@vueuse/core";
4
+ import * as vue38 from "vue";
5
5
 
6
6
  //#region src/components/remote-request/RemoteRequest.vue.d.ts
7
7
  declare const __VLS_export: <P extends DataObject, D extends DataObject, R extends DataObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
8
- props: vue54.PublicProps & __VLS_PrettifyLocal<RemoteRequestProps<P, D> & {
8
+ props: vue38.PublicProps & __VLS_PrettifyLocal<RemoteRequestProps<P, D> & {
9
9
  onSuccess?: ((data: D, params: P[]) => any) | undefined;
10
10
  onError?: ((err: Error, params: P[]) => any) | undefined;
11
11
  onFinally?: ((params: P[], data?: D | undefined, err?: Error | undefined) => any) | undefined;
@@ -13,7 +13,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
13
13
  }> & (typeof globalThis extends {
14
14
  __VLS_PROPS_FALLBACK: infer P_1;
15
15
  } ? P_1 : {});
16
- expose: (exposed: vue54.ShallowUnwrapRef<RemoteRequestExpose<P, D, R>>) => void;
16
+ expose: (exposed: vue38.ShallowUnwrapRef<RemoteRequestExpose<P, D, R>>) => void;
17
17
  attrs: any;
18
18
  slots: {
19
19
  default?: (props: {
@@ -36,14 +36,14 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
36
36
  setParams: (_params: Partial<P>) => void;
37
37
  runParams: (_params: Partial<P>) => void;
38
38
  runParamsAsync: (_params: Partial<P>) => Promise<D>;
39
- onBefore: _vueuse_core7.EventHookOn<[P[]]>;
40
- onSuccess: _vueuse_core7.EventHookOn<[D, P[]]>;
41
- onError: _vueuse_core7.EventHookOn<[Error, P[]]>;
42
- onFinally: _vueuse_core7.EventHookOn<[P[], D | undefined, Error | undefined]>;
39
+ onBefore: _vueuse_core4.EventHookOn<[P[]]>;
40
+ onSuccess: _vueuse_core4.EventHookOn<[D, P[]]>;
41
+ onError: _vueuse_core4.EventHookOn<[Error, P[]]>;
42
+ onFinally: _vueuse_core4.EventHookOn<[P[], D | undefined, Error | undefined]>;
43
43
  }) => any;
44
44
  };
45
45
  emit: RemoteRequestEmits<P, D>;
46
- }>) => vue54.VNode & {
46
+ }>) => vue38.VNode & {
47
47
  __ctx?: Awaited<typeof __VLS_setup>;
48
48
  };
49
49
  declare const _default: typeof __VLS_export;
@@ -1,5 +1,5 @@
1
1
  import { SearchInputProps } from "./index.js";
2
- import * as vue42 from "vue";
2
+ import * as vue23 from "vue";
3
3
 
4
4
  //#region src/components/search-input/SearchInput.vue.d.ts
5
5
  declare var __VLS_19: {}, __VLS_21: {}, __VLS_28: {
@@ -15,11 +15,11 @@ type __VLS_Slots = {} & {
15
15
  } & {
16
16
  'button-icon'?: (props: typeof __VLS_39) => any;
17
17
  };
18
- declare const __VLS_base: vue42.DefineComponent<SearchInputProps, {}, {}, {}, {}, vue42.ComponentOptionsMixin, vue42.ComponentOptionsMixin, {} & {
18
+ declare const __VLS_base: vue23.DefineComponent<SearchInputProps, {}, {}, {}, {}, vue23.ComponentOptionsMixin, vue23.ComponentOptionsMixin, {} & {
19
19
  "update:value": (v: string | null | undefined) => any;
20
- }, string, vue42.PublicProps, Readonly<SearchInputProps> & Readonly<{
20
+ }, string, vue23.PublicProps, Readonly<SearchInputProps> & Readonly<{
21
21
  "onUpdate:value"?: ((v: string | null | undefined) => any) | undefined;
22
- }>, {}, {}, {}, {}, string, vue42.ComponentProvideOptions, false, {}, any>;
22
+ }>, {}, {}, {}, {}, string, vue23.ComponentProvideOptions, false, {}, any>;
23
23
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
24
24
  declare const _default: typeof __VLS_export;
25
25
  type __VLS_WithSlots<T, S> = T & {
@@ -1,5 +1,5 @@
1
1
  import { ClassStyle } from "../data-table-plus/index.js";
2
- import * as vue8 from "vue";
2
+ import * as vue13 from "vue";
3
3
  import { InputProps } from "naive-ui";
4
4
 
5
5
  //#region src/components/toggle-input/ToggleInput.vue.d.ts
@@ -27,14 +27,14 @@ type __VLS_Slots = {} & {
27
27
  } & {
28
28
  default?: (props: typeof __VLS_13) => any;
29
29
  };
30
- declare const __VLS_base: vue8.DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, vue8.ComponentOptionsMixin, vue8.ComponentOptionsMixin, {
30
+ declare const __VLS_base: vue13.DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, vue13.ComponentOptionsMixin, vue13.ComponentOptionsMixin, {
31
31
  "update:value": (value: string | number | undefined) => any;
32
32
  } & {
33
33
  trigger: () => any;
34
- }, string, vue8.PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
34
+ }, string, vue13.PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
35
35
  "onUpdate:value"?: ((value: string | number | undefined) => any) | undefined;
36
36
  onTrigger?: (() => any) | undefined;
37
- }>, {}, {}, {}, {}, string, vue8.ComponentProvideOptions, false, {}, any>;
37
+ }>, {}, {}, {}, {}, string, vue13.ComponentProvideOptions, false, {}, any>;
38
38
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
39
39
  declare const _default: typeof __VLS_export;
40
40
  type __VLS_WithSlots<T, S> = T & {
@@ -1,5 +1,5 @@
1
1
  import { TooltipButtonProps } from "./index.js";
2
- import * as vue13 from "vue";
2
+ import * as vue8 from "vue";
3
3
 
4
4
  //#region src/components/tooltip-button/TooltipButton.vue.d.ts
5
5
  declare var __VLS_17: {}, __VLS_20: {}, __VLS_22: {};
@@ -10,11 +10,11 @@ type __VLS_Slots = {} & {
10
10
  } & {
11
11
  tooltip?: (props: typeof __VLS_22) => any;
12
12
  };
13
- declare const __VLS_base: vue13.DefineComponent<TooltipButtonProps, {}, {}, {}, {}, vue13.ComponentOptionsMixin, vue13.ComponentOptionsMixin, {} & {
13
+ declare const __VLS_base: vue8.DefineComponent<TooltipButtonProps, {}, {}, {}, {}, vue8.ComponentOptionsMixin, vue8.ComponentOptionsMixin, {} & {
14
14
  click: (ev: MouseEvent) => any;
15
- }, string, vue13.PublicProps, Readonly<TooltipButtonProps> & Readonly<{
15
+ }, string, vue8.PublicProps, Readonly<TooltipButtonProps> & Readonly<{
16
16
  onClick?: ((ev: MouseEvent) => any) | undefined;
17
- }>, {}, {}, {}, {}, string, vue13.ComponentProvideOptions, false, {}, any>;
17
+ }>, {}, {}, {}, {}, string, vue8.ComponentProvideOptions, false, {}, any>;
18
18
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
19
  declare const _default: typeof __VLS_export;
20
20
  type __VLS_WithSlots<T, S> = T & {
@@ -1,12 +1,12 @@
1
1
  import { TransitionProps as TransitionProps$1 } from "./index.js";
2
- import * as vue47 from "vue";
2
+ import * as vue41 from "vue";
3
3
 
4
4
  //#region src/components/transition/BaseTransition.vue.d.ts
5
5
  declare var __VLS_7: {};
6
6
  type __VLS_Slots = {} & {
7
7
  default?: (props: typeof __VLS_7) => any;
8
8
  };
9
- declare const __VLS_base: vue47.DefineComponent<TransitionProps$1, {}, {}, {}, {}, vue47.ComponentOptionsMixin, vue47.ComponentOptionsMixin, {}, string, vue47.PublicProps, Readonly<TransitionProps$1> & Readonly<{}>, {}, {}, {}, {}, string, vue47.ComponentProvideOptions, false, {}, any>;
9
+ declare const __VLS_base: vue41.DefineComponent<TransitionProps$1, {}, {}, {}, {}, vue41.ComponentOptionsMixin, vue41.ComponentOptionsMixin, {}, string, vue41.PublicProps, Readonly<TransitionProps$1> & Readonly<{}>, {}, {}, {}, {}, string, vue41.ComponentProvideOptions, false, {}, any>;
10
10
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
11
11
  declare const _default: typeof __VLS_export;
12
12
  type __VLS_WithSlots<T, S> = T & {
@@ -43,14 +43,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43
43
  onStop((v) => {
44
44
  emit("stop", v);
45
45
  });
46
- const { html } = useMarkdownIt(void 0, typedValue, {
47
- html: true,
48
- linkify: true,
49
- typographer: true,
50
- breaks: true,
51
- highlight
46
+ const { htmlRef } = useMarkdownIt(void 0, {
47
+ value: typedValue,
48
+ markdownItOptions: {
49
+ html: true,
50
+ linkify: true,
51
+ typographer: true,
52
+ breaks: true,
53
+ highlight
54
+ }
52
55
  });
53
- const renderValue = computed(() => __props.markdown ? html.value : typedValue.value);
56
+ const renderValue = computed(() => __props.markdown ? htmlRef.value : typedValue.value);
54
57
  return (_ctx, _cache) => {
55
58
  return openBlock(), createBlock(unref(NEl), {
56
59
  tag: "div",
@@ -1,22 +1,22 @@
1
1
  import { TypeWriterProps } from "./index.js";
2
- import * as vue73 from "vue";
2
+ import * as vue82 from "vue";
3
3
 
4
4
  //#region src/components/type-writer/TypeWriter.vue.d.ts
5
- declare const __VLS_export: vue73.DefineComponent<TypeWriterProps, {}, {}, {}, {}, vue73.ComponentOptionsMixin, vue73.ComponentOptionsMixin, {} & {
5
+ declare const __VLS_export: vue82.DefineComponent<TypeWriterProps, {}, {}, {}, {}, vue82.ComponentOptionsMixin, vue82.ComponentOptionsMixin, {} & {
6
6
  start: () => any;
7
7
  update: (v: {
8
8
  index: number;
9
9
  value: string;
10
10
  }) => any;
11
11
  stop: (v: string) => any;
12
- }, string, vue73.PublicProps, Readonly<TypeWriterProps> & Readonly<{
12
+ }, string, vue82.PublicProps, Readonly<TypeWriterProps> & Readonly<{
13
13
  onStart?: (() => any) | undefined;
14
14
  onUpdate?: ((v: {
15
15
  index: number;
16
16
  value: string;
17
17
  }) => any) | undefined;
18
18
  onStop?: ((v: string) => any) | undefined;
19
- }>, {}, {}, {}, {}, string, vue73.ComponentProvideOptions, false, {}, any>;
19
+ }>, {}, {}, {}, {}, string, vue82.ComponentProvideOptions, false, {}, any>;
20
20
  declare const _default: typeof __VLS_export;
21
21
  //#endregion
22
22
  export { _default };
@@ -6,7 +6,7 @@ import { _default as _default$2 } from "./components/data-table-plus/DataTablePl
6
6
  import { ClassStyle, DataTablePlusEmits, DataTablePlusExpose, DataTablePlusFields, DataTablePlusInst, DataTablePlusProps } from "./components/data-table-plus/index.js";
7
7
  import { _default as _default$3 } from "./components/loading-provider/LoadingProvider.vue.js";
8
8
  import { LoadingProviderInst, LoadingProviderProps, loadingProviderInjectionKey } from "./components/loading-provider/index.js";
9
- import { NaiveFormRules } from "./composables/use-naive-form.js";
9
+ import { UseNaiveFormRules } from "./composables/use-naive-form.js";
10
10
  import { _default } from "./components/config-providers/ConfigProviders.vue.js";
11
11
  import { ConfigProvidersProps } from "./components/config-providers/index.js";
12
12
  import { _default as _default$1 } from "./components/copy-button/CopyButton.vue.js";
@@ -28,4 +28,4 @@ import { _default as _default$13 } from "./components/type-writer/TypeWriter.vue
28
28
  import { TypeWriterProps } from "./components/type-writer/index.js";
29
29
  import "./components/index.js";
30
30
  import { ComponentAttrs, ComponentEmit, ComponentExposed, ComponentProps, ComponentSlots } from "vue-component-type-helpers";
31
- export { ArrayAwareType, ClassStyle, ComponentAttrs, ComponentEmit, ComponentExposed, ComponentProps, ComponentSlots, ConfigProvidersProps, CopyButtonProps, DataTablePlusEmits, DataTablePlusExpose, DataTablePlusFields, DataTablePlusInst, DataTablePlusProps, LoadingProviderInst, LoadingProviderProps, _default as NConfigProviders, _default$1 as NCopyButton, _default$2 as NDataTablePlus, _default$3 as NLoadingProvider, _default$4 as NPresetForm, _default$5 as NPresetInput, _default$6 as NPresetPicker, _default$7 as NPresetSelect, _default$8 as NRemoteRequest, _default$9 as NSearchInput, _default$10 as NToggleInput, _default$11 as NTooltipButton, _default$12 as NTransition, _default$13 as NTypeWriter, NaiveFormRules, OptionFormat, PresetFormExpose, PresetFormInst, PresetFormOptionItem, PresetFormOptions, PresetFormProps, PresetInputOptions, PresetInputProps, PresetInputType, PresetPickerEmits, PresetPickerExpose, PresetPickerInst, PresetPickerProps, PresetPickerValue, PresetSelectEmits, PresetSelectExpose, PresetSelectFields, PresetSelectInst, PresetSelectProps, PresetSelectValue, RemoteRequestEmits, RemoteRequestExpose, RemoteRequestFields, RemoteRequestInst, RemoteRequestProps, SearchInputProps, TooltipButtonProps, TransitionProps, TypeWriterProps, loadingProviderInjectionKey };
31
+ export { ArrayAwareType, ClassStyle, ComponentAttrs, ComponentEmit, ComponentExposed, ComponentProps, ComponentSlots, ConfigProvidersProps, CopyButtonProps, DataTablePlusEmits, DataTablePlusExpose, DataTablePlusFields, DataTablePlusInst, DataTablePlusProps, LoadingProviderInst, LoadingProviderProps, _default as NConfigProviders, _default$1 as NCopyButton, _default$2 as NDataTablePlus, _default$3 as NLoadingProvider, _default$4 as NPresetForm, _default$5 as NPresetInput, _default$6 as NPresetPicker, _default$7 as NPresetSelect, _default$8 as NRemoteRequest, _default$9 as NSearchInput, _default$10 as NToggleInput, _default$11 as NTooltipButton, _default$12 as NTransition, _default$13 as NTypeWriter, OptionFormat, PresetFormExpose, PresetFormInst, PresetFormOptionItem, PresetFormOptions, PresetFormProps, PresetInputOptions, PresetInputProps, PresetInputType, PresetPickerEmits, PresetPickerExpose, PresetPickerInst, PresetPickerProps, PresetPickerValue, PresetSelectEmits, PresetSelectExpose, PresetSelectFields, PresetSelectInst, PresetSelectProps, PresetSelectValue, RemoteRequestEmits, RemoteRequestExpose, RemoteRequestFields, RemoteRequestInst, RemoteRequestProps, SearchInputProps, TooltipButtonProps, TransitionProps, TypeWriterProps, UseNaiveFormRules, loadingProviderInjectionKey };
@@ -1,4 +1,4 @@
1
1
  import { DataObject, DataRequestFields, UseDataRequestOptions, UseDataRequestPagination, UseDataRequestReturns, useDataRequest } from "./use-data-request.js";
2
2
  import { useLoading } from "./use-loading.js";
3
- import { NaiveFormClearRules, NaiveFormOptions, NaiveFormReturns, NaiveFormRules, useNaiveForm } from "./use-naive-form.js";
4
- import { NaiveThemeOptions, NaiveThemeReturns, useNaiveTheme } from "./use-naive-theme.js";
3
+ import { UseNaiveFormClearRules, UseNaiveFormOptions, UseNaiveFormReturns, UseNaiveFormRules, useNaiveForm } from "./use-naive-form.js";
4
+ import { UseNaiveThemeOptions, UseNaiveThemeReturns, useNaiveTheme } from "./use-naive-theme.js";
@@ -29,33 +29,33 @@ function useDataRequest(api, options) {
29
29
  }],
30
30
  manual,
31
31
  ...requestOptions,
32
- onBefore: (params$1) => {
33
- requestOptions?.onBefore?.(params$1);
34
- onBeforeEvent.trigger(params$1);
32
+ onBefore: (params) => {
33
+ requestOptions?.onBefore?.(params);
34
+ onBeforeEvent.trigger(params);
35
35
  },
36
- onSuccess: (data$1, params$1) => {
37
- requestOptions?.onSuccess?.(data$1, params$1);
38
- onSuccessEvent.trigger(data$1, params$1);
39
- if (_fields.page in params$1?.[0]) {
40
- const _page = Number(params$1?.[0][_fields.page]);
36
+ onSuccess: (data, params) => {
37
+ requestOptions?.onSuccess?.(data, params);
38
+ onSuccessEvent.trigger(data, params);
39
+ if (_fields.page in params?.[0]) {
40
+ const _page = Number(params?.[0][_fields.page]);
41
41
  if (!Number.isNaN(_page)) pagination.value.page = _page;
42
42
  }
43
- if (_fields.pageSize in params$1?.[0]) {
44
- const _pageSize = Number(params$1?.[0][_fields.pageSize]);
43
+ if (_fields.pageSize in params?.[0]) {
44
+ const _pageSize = Number(params?.[0][_fields.pageSize]);
45
45
  if (!Number.isNaN(_pageSize)) pagination.value.pageSize = _pageSize;
46
46
  }
47
- if (_fields.count in data$1) {
48
- const _count = Number(data$1[_fields.count]);
47
+ if (_fields.count in data) {
48
+ const _count = Number(data[_fields.count]);
49
49
  if (!Number.isNaN(_count)) pagination.value.itemCount = _count;
50
50
  }
51
51
  },
52
- onError: (err, params$1) => {
53
- requestOptions?.onError?.(err, params$1);
54
- onErrorEvent.trigger(err, params$1);
52
+ onError: (err, params) => {
53
+ requestOptions?.onError?.(err, params);
54
+ onErrorEvent.trigger(err, params);
55
55
  },
56
- onFinally: (params$1, data$1, err) => {
57
- requestOptions?.onFinally?.(params$1, data$1, err);
58
- onFinallyEvent.trigger(params$1, data$1, err);
56
+ onFinally: (params, data, err) => {
57
+ requestOptions?.onFinally?.(params, data, err);
58
+ onFinallyEvent.trigger(params, data, err);
59
59
  }
60
60
  }, requestPlugins);
61
61
  const list = computed(() => data.value?.[_fields.list] ?? []);
@@ -1,25 +1,26 @@
1
1
  import { DataObject } from "./use-data-request.js";
2
2
  import * as _vueuse_core3 from "@vueuse/core";
3
3
  import * as vue5 from "vue";
4
- import { Ref, TemplateRef } from "vue";
4
+ import { MaybeRefOrGetter, Ref, TemplateRef } from "vue";
5
5
  import { FormInst, FormItemRule, FormRules } from "naive-ui";
6
6
  import { ValidateError } from "async-validator";
7
7
 
8
8
  //#region src/composables/use-naive-form.d.ts
9
- type NaiveFormClearRules = {
9
+ type UseNaiveFormClearRules = {
10
10
  string?: string | null;
11
11
  number?: number | null;
12
12
  boolean?: boolean | null;
13
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;
14
+ type UseNaiveFormRules<T extends DataObject> = Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>;
15
+ type UseNaiveFormOptions<T extends DataObject> = {
16
+ value?: MaybeRefOrGetter<T>;
17
+ rules?: MaybeRefOrGetter<UseNaiveFormRules<T>>;
18
+ clearRules?: UseNaiveFormClearRules;
18
19
  };
19
- declare function useNaiveForm<T extends DataObject = DataObject>(formRef: TemplateRef<FormInst>, value?: T | Ref<T>, options?: NaiveFormOptions<T>): {
20
- formRef: Readonly<vue5.ShallowRef<FormInst | null>>;
21
- formValue: Ref<T, T>;
22
- formRules: Ref<Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>, Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>>;
20
+ declare function useNaiveForm<T extends DataObject = DataObject>(formInstRef: TemplateRef<FormInst>, options?: UseNaiveFormOptions<T>): {
21
+ formInstRef: Readonly<vue5.ShallowRef<FormInst | null>>;
22
+ formValueRef: Ref<T, T>;
23
+ formRulesRef: Ref<Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>, Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>>;
23
24
  formProps: {
24
25
  model: vue5.Reactive<T>;
25
26
  rules: vue5.Reactive<Partial<Record<keyof T, FormRules | FormItemRule | FormItemRule[]>>>;
@@ -34,6 +35,6 @@ declare function useNaiveForm<T extends DataObject = DataObject>(formRef: Templa
34
35
  clear: () => void;
35
36
  onValidated: _vueuse_core3.EventHookOn<[T]>;
36
37
  };
37
- type NaiveFormReturns<T extends DataObject = DataObject> = ReturnType<typeof useNaiveForm<T>>;
38
+ type UseNaiveFormReturns<T extends DataObject = DataObject> = ReturnType<typeof useNaiveForm<T>>;
38
39
  //#endregion
39
- export { NaiveFormClearRules, NaiveFormOptions, NaiveFormReturns, NaiveFormRules, useNaiveForm };
40
+ export { UseNaiveFormClearRules, UseNaiveFormOptions, UseNaiveFormReturns, UseNaiveFormRules, useNaiveForm };
@@ -1,5 +1,5 @@
1
1
  import { createEventHook } from "@vueuse/core";
2
- import { reactive, ref, toRaw, toValue } from "vue";
2
+ import { reactive, ref, toRaw, toValue, watchEffect } from "vue";
3
3
  import { cloneDeep } from "es-toolkit/object";
4
4
 
5
5
  //#region src/composables/use-naive-form.ts
@@ -30,47 +30,51 @@ function deepMerge(target = {}, source = {}) {
30
30
  }
31
31
  return target;
32
32
  }
33
- function useNaiveForm(formRef, value, options) {
34
- const { rules, clearRules } = options ?? {};
35
- const cacheValue = cloneDeep(toValue(value));
36
- const formValue = ref(toValue(value ?? {}));
37
- const formRules = ref(toValue(rules) ?? {});
33
+ function useNaiveForm(formInstRef, options) {
34
+ const { value, rules, clearRules } = options ?? {};
35
+ const cacheValue = cloneDeep(toValue(value) ?? {});
36
+ const formValueRef = ref(toValue(value) ?? {});
37
+ watchEffect(() => {
38
+ formValueRef.value = toValue(value) ?? {};
39
+ });
40
+ const formRulesRef = ref(toValue(rules));
41
+ watchEffect(() => formRulesRef.value = toValue(rules) ?? {});
38
42
  const formProps = {
39
- model: reactive(formValue.value),
40
- rules: reactive(formRules.value)
43
+ model: reactive(formValueRef.value),
44
+ rules: reactive(formRulesRef.value)
41
45
  };
42
46
  const onValidatedEvent = createEventHook();
43
47
  function setValue(_value) {
44
- Object.assign(formValue.value, _value);
48
+ Object.assign(formValueRef.value, _value);
45
49
  }
46
50
  function validate() {
47
51
  return new Promise((resolve, reject) => {
48
- if (!formRef.value) return reject(/* @__PURE__ */ new Error("useNaiveForm: formRef is not found."));
49
- formRef.value.validate().then((res) => {
50
- onValidatedEvent.trigger(toRaw(toValue(formValue)));
52
+ if (!formInstRef.value) return reject(/* @__PURE__ */ new Error("useNaiveForm: formInstRef is not found."));
53
+ formInstRef.value.validate().then((res) => {
54
+ onValidatedEvent.trigger(toRaw(toValue(formValueRef)));
51
55
  return resolve(res);
52
56
  }).catch(reject);
53
57
  });
54
58
  }
55
59
  function resetValidation() {
56
- formRef.value?.restoreValidation();
60
+ formInstRef.value?.restoreValidation();
57
61
  }
58
62
  function clear() {
59
- clearObjectValues(formValue.value, clearRules);
63
+ clearObjectValues(formValueRef.value, clearRules);
60
64
  }
61
65
  function resetForm() {
62
66
  clear();
63
67
  const _cacheValue = cloneDeep(cacheValue);
64
- deepMerge(formValue.value, _cacheValue);
68
+ deepMerge(formValueRef.value, _cacheValue);
65
69
  }
66
70
  function reset() {
67
71
  resetValidation();
68
72
  resetForm();
69
73
  }
70
74
  return {
71
- formRef,
72
- formValue,
73
- formRules,
75
+ formInstRef,
76
+ formValueRef,
77
+ formRulesRef,
74
78
  formProps,
75
79
  setValue,
76
80
  validate,
@@ -1,5 +1,5 @@
1
1
  import { Colors } from "./_helper.js";
2
- import { ComputedRef, Ref } from "vue";
2
+ import { ComputedRef, MaybeRefOrGetter, Ref } from "vue";
3
3
  import { GlobalThemeOverrides, NDateLocale, zhCN } from "naive-ui";
4
4
  import * as naive_ui_es_themes_interface0 from "naive-ui/es/themes/interface";
5
5
 
@@ -9,19 +9,19 @@ type Locales<T extends string = string> = Record<T, {
9
9
  dateLocale: NDateLocale;
10
10
  locale: typeof zhCN;
11
11
  }>;
12
- type NaiveThemeOptions<T extends string> = {
13
- language?: T | Ref<T>;
14
- darkMode?: boolean | Ref<boolean>;
12
+ type UseNaiveThemeOptions<T extends string> = {
13
+ language?: MaybeRefOrGetter<T>;
14
+ darkMode?: MaybeRefOrGetter<boolean>;
15
15
  colors?: Colors;
16
16
  globalThemeOverrides?: GlobalThemeOverrides;
17
17
  locales?: Partial<Locales<T>>;
18
18
  darkColors?: Colors | ((colors: Colors) => Colors);
19
19
  };
20
- declare function useNaiveTheme<T extends string>(options?: NaiveThemeOptions<T>): {
21
- language: Ref<T, T>;
22
- darkMode: Ref<boolean | undefined, boolean | undefined>;
20
+ declare function useNaiveTheme<T extends string>(options?: UseNaiveThemeOptions<T>): {
21
+ languageRef: Ref<T | undefined, T | undefined>;
22
+ darkModeRef: Ref<boolean | undefined, boolean | undefined>;
23
23
  theme: ComputedRef<naive_ui_es_themes_interface0.BuiltInGlobalTheme | undefined>;
24
- colors: Ref<{
24
+ colorsRef: Ref<{
25
25
  primary?: string | undefined;
26
26
  info?: string | undefined;
27
27
  success?: string | undefined;
@@ -46,6 +46,6 @@ declare function useNaiveTheme<T extends string>(options?: NaiveThemeOptions<T>)
46
46
  locale: ComputedRef<Locales<T>[T]>;
47
47
  setColor: (v: Partial<Colors>) => void;
48
48
  };
49
- type NaiveThemeReturns = ReturnType<typeof useNaiveTheme>;
49
+ type UseNaiveThemeReturns = ReturnType<typeof useNaiveTheme>;
50
50
  //#endregion
51
- export { NaiveThemeOptions, NaiveThemeReturns, useNaiveTheme };
51
+ export { UseNaiveThemeOptions, UseNaiveThemeReturns, useNaiveTheme };
@@ -16,18 +16,14 @@ const naiveLocaleMap = {
16
16
  }
17
17
  };
18
18
  function useNaiveTheme(options) {
19
- const { language = "zh-CN", darkMode, colors, globalThemeOverrides, locales, darkColors } = options ?? {};
19
+ const { language, darkMode, colors, globalThemeOverrides, locales, darkColors } = options ?? {};
20
20
  const languageRef = ref(toValue(language));
21
- watchEffect(() => {
22
- languageRef.value = toValue(language);
23
- });
21
+ watchEffect(() => languageRef.value = toValue(language));
24
22
  const darkModeRef = ref(toValue(darkMode));
25
- watchEffect(() => {
26
- darkModeRef.value = toValue(darkMode);
27
- });
23
+ watchEffect(() => darkModeRef.value = toValue(darkMode));
28
24
  const { common, ...extra } = globalThemeOverrides ?? {};
29
25
  const colorsRef = ref({ ...colors });
30
- const themeColorsRef = computed(() => {
26
+ const themeColors = computed(() => {
31
27
  if (darkModeRef.value) {
32
28
  if (typeof darkColors === "function") {
33
29
  const darkColorsResult = darkColors(colorsRef.value);
@@ -54,7 +50,7 @@ function useNaiveTheme(options) {
54
50
  return darkModeRef?.value ? darkTheme : void 0;
55
51
  });
56
52
  const themeOverrides = computed(() => {
57
- const { primary, info, success, warning, error } = getColors(themeColorsRef.value);
53
+ const { primary, info, success, warning, error } = getColors(themeColors.value);
58
54
  return {
59
55
  common: {
60
56
  primaryColor: primary?.color,
@@ -82,19 +78,19 @@ function useNaiveTheme(options) {
82
78
  ...extra
83
79
  };
84
80
  });
85
- const _locales = {
81
+ const localesMerge = {
86
82
  ...naiveLocaleMap,
87
83
  ...locales
88
84
  };
89
85
  return {
90
- language: languageRef,
91
- darkMode: darkModeRef,
86
+ languageRef,
87
+ darkModeRef,
92
88
  theme,
93
- colors: colorsRef,
94
- themeColors: themeColorsRef,
89
+ colorsRef,
90
+ themeColors,
95
91
  themeOverrides,
96
- locales: _locales,
97
- locale: computed(() => _locales[languageRef.value] ?? naiveLocaleMap["zh-CN"]),
92
+ locales: localesMerge,
93
+ locale: computed(() => localesMerge[languageRef.value ?? "zh-CN"] ?? naiveLocaleMap["zh-CN"]),
98
94
  setColor
99
95
  };
100
96
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DataObject, DataRequestFields, UseDataRequestOptions, UseDataRequestPagination, UseDataRequestReturns, useDataRequest } from "./composables/use-data-request.js";
2
2
  import { useLoading } from "./composables/use-loading.js";
3
- import { NaiveFormClearRules, NaiveFormOptions, NaiveFormReturns, NaiveFormRules, useNaiveForm } from "./composables/use-naive-form.js";
4
- import { NaiveThemeOptions, NaiveThemeReturns, useNaiveTheme } from "./composables/use-naive-theme.js";
3
+ import { UseNaiveFormClearRules, UseNaiveFormOptions, UseNaiveFormReturns, UseNaiveFormRules, useNaiveForm } from "./composables/use-naive-form.js";
4
+ import { UseNaiveThemeOptions, UseNaiveThemeReturns, useNaiveTheme } from "./composables/use-naive-theme.js";
5
5
  import "./composables/index.js";
6
- export { DataObject, DataRequestFields, NaiveFormClearRules, NaiveFormOptions, NaiveFormReturns, NaiveFormRules, NaiveThemeOptions, NaiveThemeReturns, UseDataRequestOptions, UseDataRequestPagination, UseDataRequestReturns, useDataRequest, useLoading, useNaiveForm, useNaiveTheme };
6
+ export { DataObject, DataRequestFields, UseDataRequestOptions, UseDataRequestPagination, UseDataRequestReturns, UseNaiveFormClearRules, UseNaiveFormOptions, UseNaiveFormReturns, UseNaiveFormRules, UseNaiveThemeOptions, UseNaiveThemeReturns, useDataRequest, useLoading, 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.71",
4
+ "version": "0.0.73",
5
5
  "description": "Some Composable Functions And Components for Vue 3",
6
6
  "author": "oiij",
7
7
  "license": "MIT",
@@ -39,30 +39,30 @@
39
39
  "@vueuse/core": "^14.1.0",
40
40
  "async-validator": "^4.2.5",
41
41
  "colord": "^2.9.3",
42
- "es-toolkit": "^1.43.0",
42
+ "es-toolkit": "^1.44.0",
43
43
  "naive-ui": "^2.43.2",
44
44
  "prismjs": "^1.30.0",
45
- "vue": "^3.5.26",
46
- "vue-component-type-helpers": "^3.2.1",
45
+ "vue": "^3.5.27",
46
+ "vue-component-type-helpers": "^3.2.4",
47
47
  "vue-hooks-plus": "^2.4.1",
48
- "@oiij/markdown-it": "0.0.10",
49
- "@oiij/css-render": "0.0.9",
50
- "@oiij/use": "0.0.37"
48
+ "@oiij/css-render": "0.0.10",
49
+ "@oiij/markdown-it": "0.0.11",
50
+ "@oiij/use": "0.0.42"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/prismjs": "^1.26.5",
54
54
  "@vueuse/core": "^14.1.0",
55
55
  "async-validator": "^4.2.5",
56
56
  "colord": "^2.9.3",
57
- "es-toolkit": "^1.43.0",
57
+ "es-toolkit": "^1.44.0",
58
58
  "naive-ui": "^2.43.2",
59
59
  "prismjs": "^1.30.0",
60
- "vue": "^3.5.26",
61
- "vue-component-type-helpers": "^3.2.1",
60
+ "vue": "^3.5.27",
61
+ "vue-component-type-helpers": "^3.2.4",
62
62
  "vue-hooks-plus": "^2.4.1",
63
- "@oiij/css-render": "0.0.9",
64
- "@oiij/markdown-it": "0.0.10",
65
- "@oiij/use": "0.0.37"
63
+ "@oiij/css-render": "0.0.10",
64
+ "@oiij/markdown-it": "0.0.11",
65
+ "@oiij/use": "0.0.42"
66
66
  },
67
67
  "publishConfig": {
68
68
  "access": "public"