next-ui3 1.0.0

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 (282) hide show
  1. package/README.md +1 -0
  2. package/dist/index.css +1 -0
  3. package/dist/index.full.min.js +43 -0
  4. package/dist/index.full.min.mjs +43 -0
  5. package/dist/locale/zh-cn.min.js +1 -0
  6. package/dist/locale/zh-cn.min.mjs +1 -0
  7. package/dist/utils/index.min.js +1 -0
  8. package/dist/utils/index.min.mjs +1 -0
  9. package/es/component.d.ts +3 -0
  10. package/es/components/_base/config/presetComponents.d.ts +2 -0
  11. package/es/components/_base/config/presetFileUploader.d.ts +2 -0
  12. package/es/components/_base/next.d.ts +1 -0
  13. package/es/components/_base/types/index.d.ts +59 -0
  14. package/es/components/autocomplete/index.d.ts +2 -0
  15. package/es/components/autocomplete/src/index.vue.d.ts +264 -0
  16. package/es/components/building/index.d.ts +2 -0
  17. package/es/components/building/src/index.vue.d.ts +28 -0
  18. package/es/components/cascader/index.d.ts +2 -0
  19. package/es/components/cascader/src/index.vue.d.ts +1191 -0
  20. package/es/components/checkbox/index.d.ts +2 -0
  21. package/es/components/checkbox/src/index.vue.d.ts +85 -0
  22. package/es/components/checkbox-group/index.d.ts +2 -0
  23. package/es/components/checkbox-group/src/index.vue.d.ts +105 -0
  24. package/es/components/date-picker/index.d.ts +2 -0
  25. package/es/components/date-picker/src/QuarterPicker.vue.d.ts +96 -0
  26. package/es/components/date-picker/src/SemiAnnualPicker.vue.d.ts +91 -0
  27. package/es/components/date-picker/src/index.vue.d.ts +417 -0
  28. package/es/components/empty/index.d.ts +2 -0
  29. package/es/components/empty/src/index.vue.d.ts +52 -0
  30. package/es/components/enum-tag/index.d.ts +2 -0
  31. package/es/components/enum-tag/src/index.vue.d.ts +32 -0
  32. package/es/components/file-select/index.d.ts +2 -0
  33. package/es/components/file-select/src/index.vue.d.ts +67 -0
  34. package/es/components/filter/index.d.ts +2 -0
  35. package/es/components/filter/src/index.vue.d.ts +268 -0
  36. package/es/components/flex-text/index.d.ts +2 -0
  37. package/es/components/flex-text/src/index.vue.d.ts +63 -0
  38. package/es/components/form/index.d.ts +2 -0
  39. package/es/components/form/src/index.vue.d.ts +248 -0
  40. package/es/components/index.d.ts +28 -0
  41. package/es/components/input/index.d.ts +2 -0
  42. package/es/components/input/src/index.vue.d.ts +471 -0
  43. package/es/components/input-number/index.d.ts +2 -0
  44. package/es/components/input-number/src/index.vue.d.ts +522 -0
  45. package/es/components/input-password/index.d.ts +2 -0
  46. package/es/components/input-password/src/index.vue.d.ts +457 -0
  47. package/es/components/mask-text/index.d.ts +2 -0
  48. package/es/components/mask-text/src/index.vue.d.ts +30 -0
  49. package/es/components/pagination/index.d.ts +2 -0
  50. package/es/components/pagination/src/index.vue.d.ts +51 -0
  51. package/es/components/radio-group/index.d.ts +2 -0
  52. package/es/components/radio-group/src/CustomRadioGroup.vue.d.ts +63 -0
  53. package/es/components/radio-group/src/FlexRadioGroup.vue.d.ts +43 -0
  54. package/es/components/radio-group/src/index.vue.d.ts +94 -0
  55. package/es/components/remote-cascader/index.d.ts +2 -0
  56. package/es/components/remote-cascader/src/index.vue.d.ts +47 -0
  57. package/es/components/remote-select/index.d.ts +4 -0
  58. package/es/components/remote-select/src/DictSelect.vue.d.ts +176 -0
  59. package/es/components/remote-select/src/EnumSelect.vue.d.ts +176 -0
  60. package/es/components/remote-select/src/index.vue.d.ts +63 -0
  61. package/es/components/remote-tree-select/index.d.ts +2 -0
  62. package/es/components/remote-tree-select/src/index.vue.d.ts +52 -0
  63. package/es/components/remote-tree-select/src/old.vue.d.ts +123 -0
  64. package/es/components/search/index.d.ts +2 -0
  65. package/es/components/search/src/index.vue.d.ts +33 -0
  66. package/es/components/select/index.d.ts +2 -0
  67. package/es/components/select/src/index.vue.d.ts +639 -0
  68. package/es/components/table/index.d.ts +2 -0
  69. package/es/components/table/src/index.vue.d.ts +643 -0
  70. package/es/components/table/src/utils.d.ts +11 -0
  71. package/es/components/tree-panel/index.d.ts +2 -0
  72. package/es/components/tree-panel/src/index.vue.d.ts +994 -0
  73. package/es/components/tree-select/index.d.ts +2 -0
  74. package/es/components/tree-select/src/index.vue.d.ts +135 -0
  75. package/es/components/upload/index.d.ts +3 -0
  76. package/es/components/upload/src/ImageUpload.vue.d.ts +52 -0
  77. package/es/components/upload/src/index.vue.d.ts +559 -0
  78. package/es/constants/aria.d.ts +17 -0
  79. package/es/constants/event.d.ts +3 -0
  80. package/es/constants/index.d.ts +3 -0
  81. package/es/constants/key.d.ts +1 -0
  82. package/es/defaults.d.ts +5 -0
  83. package/es/directives/index.d.ts +1 -0
  84. package/es/directives/size-ob/index.d.ts +12 -0
  85. package/es/hooks/index.d.ts +12 -0
  86. package/es/hooks/use-dict-loader/index.d.ts +10 -0
  87. package/es/hooks/use-enums/index.d.ts +5 -0
  88. package/es/hooks/use-global-config/index.d.ts +22 -0
  89. package/es/hooks/use-list/index.d.ts +57 -0
  90. package/es/hooks/use-loader/index.d.ts +18 -0
  91. package/es/hooks/use-locale/index.d.ts +16 -0
  92. package/es/hooks/use-resettable/index.d.ts +4 -0
  93. package/es/hooks/use-size/index.d.ts +8 -0
  94. package/es/hooks/use-table/index.d.ts +19 -0
  95. package/es/hooks/use-toast/index.d.ts +18 -0
  96. package/es/hooks/use-upload-config/index.d.ts +24 -0
  97. package/es/hooks/use-vmodel/index.d.ts +3 -0
  98. package/es/index.d.ts +9 -0
  99. package/es/locale/index.d.ts +8 -0
  100. package/es/locale/lang/zh-cn.d.ts +9 -0
  101. package/es/locales.d.ts +1 -0
  102. package/es/make-installer.d.ts +6 -0
  103. package/es/utils/array.d.ts +26 -0
  104. package/es/utils/biz.d.ts +10 -0
  105. package/es/utils/compress.d.ts +14 -0
  106. package/es/utils/debounce.d.ts +13 -0
  107. package/es/utils/dom/index.d.ts +1 -0
  108. package/es/utils/enum.d.ts +22 -0
  109. package/es/utils/format.d.ts +28 -0
  110. package/es/utils/functions.d.ts +7 -0
  111. package/es/utils/html.d.ts +12 -0
  112. package/es/utils/index.d.ts +18 -0
  113. package/es/utils/install.d.ts +4 -0
  114. package/es/utils/object.d.ts +42 -0
  115. package/es/utils/rand.d.ts +1 -0
  116. package/es/utils/stream.d.ts +5 -0
  117. package/es/utils/string.d.ts +4 -0
  118. package/es/utils/timer.d.ts +17 -0
  119. package/es/utils/tree.d.ts +44 -0
  120. package/es/utils/types.d.ts +25 -0
  121. package/es/utils/url.d.ts +9 -0
  122. package/es/version.d.ts +1 -0
  123. package/global.d.ts +11 -0
  124. package/lib/component.d.ts +3 -0
  125. package/lib/components/_base/config/presetComponents.d.ts +2 -0
  126. package/lib/components/_base/config/presetFileUploader.d.ts +2 -0
  127. package/lib/components/_base/next.d.ts +1 -0
  128. package/lib/components/_base/types/index.d.ts +59 -0
  129. package/lib/components/autocomplete/index.d.ts +2 -0
  130. package/lib/components/autocomplete/src/index.vue.d.ts +264 -0
  131. package/lib/components/building/index.d.ts +2 -0
  132. package/lib/components/building/src/index.vue.d.ts +28 -0
  133. package/lib/components/cascader/index.d.ts +2 -0
  134. package/lib/components/cascader/src/index.vue.d.ts +1191 -0
  135. package/lib/components/checkbox/index.d.ts +2 -0
  136. package/lib/components/checkbox/src/index.vue.d.ts +85 -0
  137. package/lib/components/checkbox-group/index.d.ts +2 -0
  138. package/lib/components/checkbox-group/src/index.vue.d.ts +105 -0
  139. package/lib/components/date-picker/index.d.ts +2 -0
  140. package/lib/components/date-picker/src/QuarterPicker.vue.d.ts +96 -0
  141. package/lib/components/date-picker/src/SemiAnnualPicker.vue.d.ts +91 -0
  142. package/lib/components/date-picker/src/index.vue.d.ts +417 -0
  143. package/lib/components/empty/index.d.ts +2 -0
  144. package/lib/components/empty/src/index.vue.d.ts +52 -0
  145. package/lib/components/enum-tag/index.d.ts +2 -0
  146. package/lib/components/enum-tag/src/index.vue.d.ts +32 -0
  147. package/lib/components/file-select/index.d.ts +2 -0
  148. package/lib/components/file-select/src/index.vue.d.ts +67 -0
  149. package/lib/components/filter/index.d.ts +2 -0
  150. package/lib/components/filter/src/index.vue.d.ts +268 -0
  151. package/lib/components/flex-text/index.d.ts +2 -0
  152. package/lib/components/flex-text/src/index.vue.d.ts +63 -0
  153. package/lib/components/form/index.d.ts +2 -0
  154. package/lib/components/form/src/index.vue.d.ts +248 -0
  155. package/lib/components/index.d.ts +28 -0
  156. package/lib/components/input/index.d.ts +2 -0
  157. package/lib/components/input/src/index.vue.d.ts +471 -0
  158. package/lib/components/input-number/index.d.ts +2 -0
  159. package/lib/components/input-number/src/index.vue.d.ts +522 -0
  160. package/lib/components/input-password/index.d.ts +2 -0
  161. package/lib/components/input-password/src/index.vue.d.ts +457 -0
  162. package/lib/components/mask-text/index.d.ts +2 -0
  163. package/lib/components/mask-text/src/index.vue.d.ts +30 -0
  164. package/lib/components/pagination/index.d.ts +2 -0
  165. package/lib/components/pagination/src/index.vue.d.ts +51 -0
  166. package/lib/components/radio-group/index.d.ts +2 -0
  167. package/lib/components/radio-group/src/CustomRadioGroup.vue.d.ts +63 -0
  168. package/lib/components/radio-group/src/FlexRadioGroup.vue.d.ts +43 -0
  169. package/lib/components/radio-group/src/index.vue.d.ts +94 -0
  170. package/lib/components/remote-cascader/index.d.ts +2 -0
  171. package/lib/components/remote-cascader/src/index.vue.d.ts +47 -0
  172. package/lib/components/remote-select/index.d.ts +4 -0
  173. package/lib/components/remote-select/src/DictSelect.vue.d.ts +176 -0
  174. package/lib/components/remote-select/src/EnumSelect.vue.d.ts +176 -0
  175. package/lib/components/remote-select/src/index.vue.d.ts +63 -0
  176. package/lib/components/remote-tree-select/index.d.ts +2 -0
  177. package/lib/components/remote-tree-select/src/index.vue.d.ts +52 -0
  178. package/lib/components/remote-tree-select/src/old.vue.d.ts +123 -0
  179. package/lib/components/search/index.d.ts +2 -0
  180. package/lib/components/search/src/index.vue.d.ts +33 -0
  181. package/lib/components/select/index.d.ts +2 -0
  182. package/lib/components/select/src/index.vue.d.ts +639 -0
  183. package/lib/components/table/index.d.ts +2 -0
  184. package/lib/components/table/src/index.vue.d.ts +643 -0
  185. package/lib/components/table/src/utils.d.ts +11 -0
  186. package/lib/components/tree-panel/index.d.ts +2 -0
  187. package/lib/components/tree-panel/src/index.vue.d.ts +994 -0
  188. package/lib/components/tree-select/index.d.ts +2 -0
  189. package/lib/components/tree-select/src/index.vue.d.ts +135 -0
  190. package/lib/components/upload/index.d.ts +3 -0
  191. package/lib/components/upload/src/ImageUpload.vue.d.ts +52 -0
  192. package/lib/components/upload/src/index.vue.d.ts +559 -0
  193. package/lib/constants/aria.d.ts +17 -0
  194. package/lib/constants/event.d.ts +3 -0
  195. package/lib/constants/index.d.ts +3 -0
  196. package/lib/constants/key.d.ts +1 -0
  197. package/lib/defaults.d.ts +5 -0
  198. package/lib/directives/index.d.ts +1 -0
  199. package/lib/directives/size-ob/index.d.ts +12 -0
  200. package/lib/hooks/index.d.ts +12 -0
  201. package/lib/hooks/use-dict-loader/index.d.ts +10 -0
  202. package/lib/hooks/use-enums/index.d.ts +5 -0
  203. package/lib/hooks/use-global-config/index.d.ts +22 -0
  204. package/lib/hooks/use-list/index.d.ts +57 -0
  205. package/lib/hooks/use-loader/index.d.ts +18 -0
  206. package/lib/hooks/use-locale/index.d.ts +16 -0
  207. package/lib/hooks/use-resettable/index.d.ts +4 -0
  208. package/lib/hooks/use-size/index.d.ts +8 -0
  209. package/lib/hooks/use-table/index.d.ts +19 -0
  210. package/lib/hooks/use-toast/index.d.ts +18 -0
  211. package/lib/hooks/use-upload-config/index.d.ts +24 -0
  212. package/lib/hooks/use-vmodel/index.d.ts +3 -0
  213. package/lib/index.d.ts +9 -0
  214. package/lib/locale/index.d.ts +8 -0
  215. package/lib/locale/lang/zh-cn.d.ts +9 -0
  216. package/lib/locales.d.ts +1 -0
  217. package/lib/make-installer.d.ts +6 -0
  218. package/lib/utils/array.d.ts +26 -0
  219. package/lib/utils/biz.d.ts +10 -0
  220. package/lib/utils/compress.d.ts +14 -0
  221. package/lib/utils/debounce.d.ts +13 -0
  222. package/lib/utils/dom/index.d.ts +1 -0
  223. package/lib/utils/enum.d.ts +22 -0
  224. package/lib/utils/format.d.ts +28 -0
  225. package/lib/utils/functions.d.ts +7 -0
  226. package/lib/utils/html.d.ts +12 -0
  227. package/lib/utils/index.d.ts +18 -0
  228. package/lib/utils/install.d.ts +4 -0
  229. package/lib/utils/object.d.ts +42 -0
  230. package/lib/utils/rand.d.ts +1 -0
  231. package/lib/utils/stream.d.ts +5 -0
  232. package/lib/utils/string.d.ts +4 -0
  233. package/lib/utils/timer.d.ts +17 -0
  234. package/lib/utils/tree.d.ts +44 -0
  235. package/lib/utils/types.d.ts +25 -0
  236. package/lib/utils/url.d.ts +9 -0
  237. package/lib/version.d.ts +1 -0
  238. package/package.json +85 -0
  239. package/theme-chalk/base.css +1 -0
  240. package/theme-chalk/dark/css-vars.css +0 -0
  241. package/theme-chalk/el-building.css +1 -0
  242. package/theme-chalk/el-cascader.css +1 -0
  243. package/theme-chalk/el-checkbox-group.css +1 -0
  244. package/theme-chalk/el-date-picker.css +1 -0
  245. package/theme-chalk/el-empty.css +1 -0
  246. package/theme-chalk/el-file-select.css +1 -0
  247. package/theme-chalk/el-filter.css +1 -0
  248. package/theme-chalk/el-flex-text.css +1 -0
  249. package/theme-chalk/el-form.css +1 -0
  250. package/theme-chalk/el-image-upload.css +1 -0
  251. package/theme-chalk/el-input-number.css +1 -0
  252. package/theme-chalk/el-mask-text.css +1 -0
  253. package/theme-chalk/el-radio-group.css +1 -0
  254. package/theme-chalk/el-search.css +1 -0
  255. package/theme-chalk/el-select.css +1 -0
  256. package/theme-chalk/el-table.css +1 -0
  257. package/theme-chalk/el-tree-panel.css +1 -0
  258. package/theme-chalk/el-tree-select.css +1 -0
  259. package/theme-chalk/el-upload.css +1 -0
  260. package/theme-chalk/index.css +1 -0
  261. package/theme-chalk/src/base.scss +11 -0
  262. package/theme-chalk/src/building.scss +6 -0
  263. package/theme-chalk/src/cascader.scss +36 -0
  264. package/theme-chalk/src/checkbox-group.scss +16 -0
  265. package/theme-chalk/src/dark/css-vars.scss +0 -0
  266. package/theme-chalk/src/date-picker.scss +40 -0
  267. package/theme-chalk/src/empty.scss +82 -0
  268. package/theme-chalk/src/file-select.scss +94 -0
  269. package/theme-chalk/src/filter.scss +119 -0
  270. package/theme-chalk/src/flex-text.scss +31 -0
  271. package/theme-chalk/src/form.scss +10 -0
  272. package/theme-chalk/src/image-upload.scss +25 -0
  273. package/theme-chalk/src/index.scss +20 -0
  274. package/theme-chalk/src/input-number.scss +16 -0
  275. package/theme-chalk/src/mask-text.scss +8 -0
  276. package/theme-chalk/src/radio-group.scss +204 -0
  277. package/theme-chalk/src/search.scss +5 -0
  278. package/theme-chalk/src/select.scss +14 -0
  279. package/theme-chalk/src/table.scss +24 -0
  280. package/theme-chalk/src/tree-panel.scss +113 -0
  281. package/theme-chalk/src/tree-select.scss +14 -0
  282. package/theme-chalk/src/upload.scss +86 -0
@@ -0,0 +1,3 @@
1
+ export * from './aria';
2
+ export * from './event';
3
+ export * from './key';
@@ -0,0 +1 @@
1
+ export declare const INSTALLED_KEY: unique symbol;
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ version: string;
3
+ install: (app: import("vue").App, options?: import("next-ui/es/hooks").IConfigProviderContext) => void;
4
+ };
5
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default as SizeOb } from './size-ob';
@@ -0,0 +1,12 @@
1
+ type IElementSize = {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ type IResizeHandler = (size: IElementSize) => any;
6
+ declare const _default: {
7
+ mounted(el: Element, binding: {
8
+ value: IResizeHandler;
9
+ }): void;
10
+ unmounted(el: Element): void;
11
+ };
12
+ export default _default;
@@ -0,0 +1,12 @@
1
+ export * from './use-vmodel';
2
+ export * from './use-resettable';
3
+ export * from './use-size';
4
+ export * from './use-toast';
5
+ export * from './use-loader';
6
+ export * from './use-list';
7
+ export * from './use-table';
8
+ export * from './use-dict-loader';
9
+ export * from './use-enums';
10
+ export * from './use-upload-config';
11
+ export * from './use-locale';
12
+ export * from './use-global-config';
@@ -0,0 +1,10 @@
1
+ import { InjectionKey, Ref } from 'vue';
2
+ export type IDictItem = {
3
+ value: string;
4
+ label: string;
5
+ };
6
+ export type IDictLoader = (dictKey: string) => Promise<{
7
+ data: IDictItem[];
8
+ }>;
9
+ export declare const dictLoaderContextKey: InjectionKey<Ref<IDictLoader | undefined>>;
10
+ export declare const useDictLoader: () => Ref<IDictLoader | undefined>;
@@ -0,0 +1,5 @@
1
+ import { InjectionKey, Ref } from 'vue';
2
+ import { type Enum } from 'next-ui/es/utils';
3
+ export type IEnums = Record<string, Enum>;
4
+ export declare const enumsContextKey: InjectionKey<Ref<IEnums | undefined>>;
5
+ export declare const useEnums: () => Ref<IEnums | undefined>;
@@ -0,0 +1,22 @@
1
+ import { App, InjectionKey, Ref } from 'vue';
2
+ import { type IEnums } from '../use-enums';
3
+ import { type IDictLoader } from '../use-dict-loader';
4
+ import { type IUploadConfig } from '../use-upload-config';
5
+ import type { Language } from 'next-ui/es/locale';
6
+ type MaybeRef<T> = T | Ref<T>;
7
+ export type IConfigProviderContext = Partial<{
8
+ locale: Language;
9
+ enums: IEnums;
10
+ dictLoader: IDictLoader;
11
+ upload: IUploadConfig;
12
+ }>;
13
+ export declare const configProviderContextKey: InjectionKey<Ref<IConfigProviderContext>>;
14
+ export declare function useGlobalConfig<K extends keyof IConfigProviderContext, D extends IConfigProviderContext[K]>(key: K, defaultValue?: D): Ref<Exclude<IConfigProviderContext[K], undefined> | D>;
15
+ export declare function useGlobalConfig(): Ref<IConfigProviderContext>;
16
+ export declare const provideGlobalConfig: (config: MaybeRef<IConfigProviderContext>, app: App) => import("vue").ComputedRef<Partial<{
17
+ locale: Language;
18
+ enums: IEnums;
19
+ dictLoader: IDictLoader;
20
+ upload: IUploadConfig;
21
+ }>> | undefined;
22
+ export {};
@@ -0,0 +1,57 @@
1
+ import { Ref } from 'vue';
2
+ type MaybeRef<T> = T | Ref<T>;
3
+ export type ISortProps = {
4
+ prop?: string;
5
+ order?: 'ascending' | 'descending';
6
+ };
7
+ export type IListOptions = {
8
+ queryParams?: MaybeRef<any>;
9
+ extraParams?: MaybeRef<any>;
10
+ defaultSort?: MaybeRef<ISortProps | null>;
11
+ preRequest?: (params: {
12
+ queryParams: any;
13
+ extraParams: any;
14
+ sortParams: any;
15
+ current: number;
16
+ size: number;
17
+ }) => any;
18
+ request: (params: any) => Promise<{
19
+ data: {
20
+ total: number;
21
+ records: any[];
22
+ };
23
+ }>;
24
+ postRequest?: (data: any) => any;
25
+ queryFormatter?: (key: string, value: any) => any;
26
+ sortFormatter?: (key: string) => string | undefined;
27
+ autoLoad?: boolean;
28
+ currentPage?: number;
29
+ pageSize?: number;
30
+ currentPageKey?: string;
31
+ pageSizeKey?: string;
32
+ };
33
+ export declare const useList: (options: IListOptions) => {
34
+ state: {
35
+ loading: boolean;
36
+ loaded: boolean;
37
+ loadError: string;
38
+ data: any[];
39
+ };
40
+ sortProps: Ref<{
41
+ prop?: string | undefined;
42
+ order?: ("ascending" | "descending") | undefined;
43
+ } | null | undefined>;
44
+ pager: {
45
+ current: number;
46
+ size: number;
47
+ total: number;
48
+ };
49
+ loadData: (opts?: {
50
+ silently?: boolean;
51
+ }) => Promise<void>;
52
+ search: () => void;
53
+ onSort: ({ prop, order }: any) => void;
54
+ onCurrentChange: (current: number) => void;
55
+ onSizeChange: (size: number) => void;
56
+ };
57
+ export {};
@@ -0,0 +1,18 @@
1
+ export type ILoaderProps = {
2
+ request: () => Promise<{
3
+ data: any;
4
+ }>;
5
+ postRequest?: (data: any) => any;
6
+ autoLoad?: boolean;
7
+ };
8
+ export declare const useLoader: (options: ILoaderProps) => {
9
+ state: {
10
+ loading: boolean;
11
+ loaded: boolean;
12
+ loadError: string;
13
+ data: null;
14
+ };
15
+ loadData: (opts?: {
16
+ silently?: boolean;
17
+ }) => Promise<void>;
18
+ };
@@ -0,0 +1,16 @@
1
+ import type { InjectionKey, Ref } from 'vue';
2
+ import type { Language } from 'next-ui/es/locale';
3
+ export type TranslatorOption = Record<string, string | number>;
4
+ export type Translator = (path: string, option?: TranslatorOption) => string;
5
+ export type LocaleContext = {
6
+ locale: Ref<Language>;
7
+ lang: Ref<string>;
8
+ t: Translator;
9
+ };
10
+ type MaybeRef<T> = T | Ref<T>;
11
+ export declare const buildTranslator: (locale: MaybeRef<Language>) => Translator;
12
+ export declare const translate: (path: string, option: undefined | TranslatorOption, locale: Language) => string;
13
+ export declare const buildLocaleContext: (locale: MaybeRef<Language>) => LocaleContext;
14
+ export declare const localeContextKey: InjectionKey<Ref<Language | undefined>>;
15
+ export declare const useLocale: (localeOverrides?: Ref<Language | undefined>) => LocaleContext;
16
+ export {};
@@ -0,0 +1,4 @@
1
+ import { UnwrapRef } from 'vue';
2
+ import { deepClone } from 'next-ui/es/utils';
3
+ export declare function useResettableRef<T>(value: T | (() => T), clone?: typeof deepClone): readonly [import("vue").Ref<UnwrapRef<T>>, () => void];
4
+ export declare function useResettableReactive<T extends object>(value: T | (() => T), clone?: typeof deepClone): readonly [import("vue").UnwrapNestedRefs<T>, () => void];
@@ -0,0 +1,8 @@
1
+ export type ISize = {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ export declare const useSize: (computedFn?: (s: ISize) => Partial<ISize>) => {
6
+ width: import("vue").ComputedRef<number>;
7
+ height: import("vue").ComputedRef<number>;
8
+ };
@@ -0,0 +1,19 @@
1
+ import { Ref } from 'vue';
2
+ import type { TableInstance } from 'element-plus';
3
+ export declare const useTableSelectable: (tableRef: Ref<TableInstance>) => {
4
+ selectedItems: Ref<any[]>;
5
+ isSelected: import("vue").ComputedRef<boolean>;
6
+ onSelect: (selection: any[]) => void;
7
+ setSelection: (selection: any[] | any) => void;
8
+ removeSelection: (selection: any[] | any) => void;
9
+ clearSelection: () => void;
10
+ };
11
+ export declare const useTableCheckable: (tableRef: Ref<TableInstance & {
12
+ toggleCurrentRow: (row: any) => void;
13
+ }>) => {
14
+ currentItem: Ref<any>;
15
+ isChecked: import("vue").ComputedRef<boolean>;
16
+ onCheck: (item: any) => void;
17
+ setCurrentItem: (item?: any) => void;
18
+ toggleCurrentItem: (item: any) => void;
19
+ };
@@ -0,0 +1,18 @@
1
+ export type IToastOptions = {
2
+ type?: 'success' | 'error' | 'warning' | 'info' | 'loading';
3
+ message: string;
4
+ duration?: number;
5
+ };
6
+ declare class Toast {
7
+ el: HTMLElement | undefined;
8
+ timer: any;
9
+ show(opts: IToastOptions): void;
10
+ success(opts: string | IToastOptions): void;
11
+ error(opts: string | IToastOptions): void;
12
+ warning(opts: string | IToastOptions): void;
13
+ info(opts: string | IToastOptions): void;
14
+ loading(opts: string | IToastOptions): void;
15
+ close(): void;
16
+ }
17
+ export declare const useToast: () => Toast;
18
+ export {};
@@ -0,0 +1,24 @@
1
+ import { InjectionKey, Ref } from 'vue';
2
+ import type { UploadProgressEvent } from 'element-plus';
3
+ export type IUploadOptions = {
4
+ file: File;
5
+ filename?: string;
6
+ url?: string;
7
+ data?: Record<string, any>;
8
+ headers?: Record<string, any>;
9
+ onProgress?: (progressEvent: UploadProgressEvent, file: File) => any;
10
+ };
11
+ export type IUploadFile = {
12
+ uid?: string | number;
13
+ name: string;
14
+ url: string;
15
+ };
16
+ export type IFileUploader = (opts: IUploadOptions) => Promise<{
17
+ data: IUploadFile;
18
+ }>;
19
+ export type IUploadConfig = {
20
+ uploader?: IFileUploader;
21
+ formatUrl?: (url?: string) => string;
22
+ };
23
+ export declare const uploadConfigContextKey: InjectionKey<Ref<IUploadConfig | undefined>>;
24
+ export declare const useUploadConfig: () => Ref<IUploadConfig | undefined>;
@@ -0,0 +1,3 @@
1
+ export declare const useVModel: (props: {
2
+ [key: string]: any;
3
+ }, propName: string, emit: Function) => import("vue").WritableComputedRef<any>;
package/lib/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import installer from './defaults';
2
+ export * from 'next-ui/es/components';
3
+ export * from 'next-ui/es/constants';
4
+ export * from 'next-ui/es/directives';
5
+ export * from 'next-ui/es/hooks';
6
+ export * from './make-installer';
7
+ export declare const install: (app: import("vue").App, options?: import("next-ui/es/hooks").IConfigProviderContext) => void;
8
+ export declare const version: string;
9
+ export default installer;
@@ -0,0 +1,8 @@
1
+ export { default as zhCn } from './lang/zh-cn';
2
+ export type TranslatePair = {
3
+ [key: string]: string | string[] | TranslatePair;
4
+ };
5
+ export type Language = {
6
+ name: string;
7
+ nt: TranslatePair;
8
+ };
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ name: string;
3
+ nt: {
4
+ input: {
5
+ label: string;
6
+ };
7
+ };
8
+ };
9
+ export default _default;
@@ -0,0 +1 @@
1
+ export * from 'next-ui/es/locale';
@@ -0,0 +1,6 @@
1
+ import { IConfigProviderContext } from 'next-ui/es/hooks';
2
+ import type { App, Plugin } from '@vue/runtime-core';
3
+ export declare const makeInstaller: (components?: Plugin[]) => {
4
+ version: string;
5
+ install: (app: App, options?: IConfigProviderContext) => void;
6
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 比较数组的变更
3
+ * @param oldData 旧数组
4
+ * @param newData 新数组
5
+ * @param fn 数据唯一标识
6
+ * @returns
7
+ */
8
+ export declare function arrayDiff(oldData: any, newData: any, fn?: string | ((it: any) => string)): {
9
+ changed: boolean;
10
+ removed: boolean;
11
+ added: boolean;
12
+ removedItems: any[];
13
+ addedItems: any[];
14
+ };
15
+ /**
16
+ * 生成新的数组,不包含指定的值
17
+ */
18
+ export declare const without: (array: any[], ...values: any[]) => any[];
19
+ /**
20
+ * 转数组
21
+ */
22
+ export declare const toArray: (val: any) => any[];
23
+ /**
24
+ * 分组
25
+ */
26
+ export declare const groupBy: <T>(data: T[], fn: keyof T | ((it: T) => string)) => Record<string, T[]>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 通用表单错误处理
3
+ */
4
+ export declare function handleFormValidateError(options?: {
5
+ el?: HTMLElement;
6
+ msg?: string;
7
+ }): void;
8
+ export declare function copyText(text: string, options?: any): Promise<void>;
9
+ export declare function openPage(url: string, ...args: any): void;
10
+ export declare function parseAreaCode(areaCode: string): string[];
@@ -0,0 +1,14 @@
1
+ export declare const compressImage: (options: {
2
+ file: File;
3
+ quality?: number;
4
+ mimeType?: string;
5
+ maxWidth?: number;
6
+ maxHeight?: number;
7
+ width?: number;
8
+ height?: number;
9
+ minWidth?: number;
10
+ minHeight?: number;
11
+ convertSize?: number;
12
+ loose?: boolean;
13
+ redressOrientation?: boolean;
14
+ }) => Promise<unknown> | File;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 函数防抖
3
+ */
4
+ export declare function debounce(func: Function, wait: number, options?: {
5
+ leading?: boolean;
6
+ maxWait?: number;
7
+ trailing?: boolean;
8
+ }): {
9
+ (...args: any[]): any;
10
+ cancel: () => void;
11
+ flush: () => any;
12
+ pending: () => boolean;
13
+ };
@@ -0,0 +1 @@
1
+ export declare const hasClass: (el: Element, cls: string) => boolean;
@@ -0,0 +1,22 @@
1
+ export type IEnumItem = {
2
+ key?: string;
3
+ value: string | number;
4
+ label: string;
5
+ props?: any;
6
+ };
7
+ export declare class Enum {
8
+ [key: string]: any;
9
+ _enumItems: Record<string, IEnumItem>;
10
+ constructor(data?: IEnumItem[] | Record<string, IEnumItem>);
11
+ add(key: string, { value, label, props }: IEnumItem): this;
12
+ keys(): string[];
13
+ [Symbol.iterator](): Generator<IEnumItem, void, unknown>;
14
+ getItem(value: string | number): IEnumItem;
15
+ getLabel(value: string | number): string;
16
+ getProps(value: string | number): any;
17
+ filter(fn: (item: IEnumItem, key: any) => boolean): Enum;
18
+ clone(): Enum;
19
+ set(key: string, o: Partial<IEnumItem>): this;
20
+ remove(key: string): this;
21
+ forEach(fn: (item: IEnumItem, key: string) => any): void;
22
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * 格式化日期
3
+ */
4
+ export declare function formatDate(time: number | string | Date, fmt?: string | undefined): string;
5
+ /**
6
+ * 格式化数字
7
+ */
8
+ export declare function formatNumber(value: string | number, options?: {
9
+ minPrecision?: number;
10
+ maxPrecision?: number;
11
+ decimalPoint?: string;
12
+ thousandSeparator?: string;
13
+ grouping?: number;
14
+ }): string;
15
+ /**
16
+ * 格式化区间
17
+ */
18
+ export declare function formatInterval(arr: any[], x?: string): string;
19
+ /**
20
+ * 格式化字节数
21
+ * @param bytes 字节数
22
+ * @returns
23
+ */
24
+ export declare function formatBytes(bytes: number): string;
25
+ /**
26
+ * 格式化为标准的 css 尺寸
27
+ */
28
+ export declare function formatPx(val: string | number): string | number;
@@ -0,0 +1,7 @@
1
+ export declare const looseEqual: (a: any, b: any) => boolean;
2
+ export declare const arrayEquals: (arrayA: any, arrayB: any) => boolean;
3
+ export declare const isEqual: (value1: any, value2: any) => boolean;
4
+ /**
5
+ * 打开项目内部页面(处理子目录部署的情况)
6
+ * @param url
7
+ */
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 编码 HTML 实体
3
+ * @param text
4
+ * @returns
5
+ */
6
+ export declare function encodeHTMLEntities(text: string): string;
7
+ /**
8
+ * 解码 HTML 实体
9
+ * @param text
10
+ * @returns
11
+ */
12
+ export declare function decodeHTMLEntities(text: string): string;
@@ -0,0 +1,18 @@
1
+ export * from './install';
2
+ export * from './functions';
3
+ export * from './types';
4
+ export * from './array';
5
+ export * from './object';
6
+ export * from './tree';
7
+ export * from './string';
8
+ export * from './format';
9
+ export * from './timer';
10
+ export * from './rand';
11
+ export * from './url';
12
+ export * from './html';
13
+ export * from './stream';
14
+ export * from './debounce';
15
+ export * from './biz';
16
+ export * from './enum';
17
+ export * from './dom';
18
+ export * from './compress';
@@ -0,0 +1,4 @@
1
+ import { Plugin } from 'vue';
2
+ type SFCWithInstall<T> = T & Plugin;
3
+ export declare const withInstall: <T, E extends Record<string, any>>(main: T, extra?: E) => (SFCWithInstall<T> & E) | undefined;
4
+ export {};
@@ -0,0 +1,42 @@
1
+ /**
2
+ * 生成新的对象,仅包含指定的键
3
+ * @param {Object} object
4
+ * @param {String[] | String} keys
5
+ * @param {...String} otherKeys
6
+ * @returns {Object}
7
+ */
8
+ export declare const pick: (object: any, keys: string[] | string, ...otherKeys: string[]) => any;
9
+ /**
10
+ * 生成新的对象,不包含指定的键
11
+ * @param {Object} object
12
+ * @param {String[] | String} keys
13
+ * @param {...String} otherKeys
14
+ * @returns {Object}
15
+ */
16
+ export declare const omit: (object: any, keys: string[] | string, ...otherKeys: string[]) => any;
17
+ /**
18
+ * 用目标对象中的属性值更新源对象,但不会增加源对象中不存在的属性
19
+ */
20
+ export declare const assign: (src: object, ...dests: any[]) => object;
21
+ export declare function deepAssign(target: any, ...sources: any[]): object;
22
+ /**
23
+ * 排除空字段
24
+ */
25
+ export declare const omitEmpty: (object: any) => any;
26
+ export declare function deepClone(data: any): any;
27
+ /**
28
+ * 解析 JSON 字符串
29
+ * @param json 字符串
30
+ * @param defaultValue 默认值
31
+ * @returns
32
+ */
33
+ export declare function parseJson(json: string, defaultValue?: any): any;
34
+ export declare function setProperty(obj: any, prop: string, value: any): void;
35
+ export declare function getProperty(obj: any, prop: string): any;
36
+ /**
37
+ * 合并默认属性配置和自定义属性配置
38
+ * @param options 默认属性配置对象
39
+ * @param props 自定义属性配置对象
40
+ * @returns 合并后的属性配置对象
41
+ */
42
+ export declare const mergeDefaultOptions: (options: any, props: any) => any;
@@ -0,0 +1 @@
1
+ export declare const getRandInt: (min: number, max: number) => number;
@@ -0,0 +1,5 @@
1
+ export declare const downloadFile: (options: {
2
+ url?: string;
3
+ blob?: Blob;
4
+ filename?: string;
5
+ }) => void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 将驼峰转下换线分隔
3
+ */
4
+ export declare function toUnderscore(name: string): string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 休眠指定时长
3
+ * @param ms 毫秒
4
+ * @returns
5
+ */
6
+ export declare const sleep: (ms: number) => Promise<undefined>;
7
+ /**
8
+ * 确保任务至少在指定时间后完成
9
+ * @param task 任务方法
10
+ * @param ms 毫秒
11
+ * @returns
12
+ */
13
+ export declare const runAtLeastTime: (task: () => any, ms: number) => Promise<any>;
14
+ export declare const createTimer: () => {
15
+ delayTo: (ms: number) => Promise<void>;
16
+ };
17
+ export declare const delayWhen: (fn: () => boolean, atLeast?: number) => Promise<unknown>;
@@ -0,0 +1,44 @@
1
+ type WithChildren<T> = T & {
2
+ children?: WithChildren<T>[];
3
+ };
4
+ /**
5
+ * 构建树
6
+ */
7
+ export declare function buildTree<T>(data: T[], options?: any): WithChildren<T>[];
8
+ /**
9
+ * 过滤树
10
+ */
11
+ export declare function filterTree<T>(tree: WithChildren<T>[], fn: (o: T) => boolean): WithChildren<T>[];
12
+ /**
13
+ * 递归树查找节点
14
+ */
15
+ export declare function findNode<T extends {
16
+ children?: T[];
17
+ }>(tree: T[], fn: (o: T) => boolean): T | null | undefined;
18
+ /**
19
+ * 递归在树中查找满足条件节点的父节点及index
20
+ */
21
+ export declare function findParentAndIndex<T extends {
22
+ children?: T[];
23
+ }>(tree: T[], fn: (o: T) => boolean): {
24
+ found: boolean;
25
+ parent: any;
26
+ index: number;
27
+ };
28
+ export declare function walkTree<T extends {
29
+ children?: T[];
30
+ }>(tree: T[], fn: (o: T, p: T | null) => any): void;
31
+ /**
32
+ * 将树结构转为一维数组
33
+ * @param tree
34
+ */
35
+ export declare function flatTree<T extends {
36
+ children?: T[];
37
+ }>(tree: T[]): T[];
38
+ /**
39
+ * 原位递归更新某字段的值 + 所有子孙节点的值
40
+ */
41
+ export declare function combineByField<T extends {
42
+ children?: T[];
43
+ }>(tree: T[], srcField: string, destField?: string): void;
44
+ export {};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * 是否是对象
3
+ */
4
+ export declare function isObject(value: any): boolean;
5
+ export declare function isPlainObject(obj: any): boolean;
6
+ export declare function isEmpty(val: any): boolean;
7
+ /**
8
+ * 当前是否在 iframe 中
9
+ * @returns 是否在 iframe 中
10
+ */
11
+ export declare function isIframe(): boolean;
12
+ /**
13
+ * 判断是否是 Blob 对象
14
+ * @param val
15
+ * @returns 是否是 Blob 对象
16
+ */
17
+ export declare function isBlob(val: any): boolean;
18
+ export declare function isImage(filename: string): boolean;
19
+ /**
20
+ * 判断子类是否是继承自基类
21
+ * @param childClass 子类
22
+ * @param baseClass 基类
23
+ * @returns
24
+ */
25
+ export declare function isChildClassOf(childClass: any, baseClass: any): boolean;
@@ -0,0 +1,9 @@
1
+ export declare function urlToDataURL(url: string): Promise<unknown>;
2
+ export declare function fileToDataURL(file: File): Promise<string>;
3
+ export declare function fileToObjectURL(file: File): string;
4
+ /**
5
+ * 构建URL
6
+ * @param url
7
+ * @param params
8
+ */
9
+ export declare function buildUrl(url: string | URL, params?: Record<string, any>): string;
@@ -0,0 +1 @@
1
+ export declare const version = "1.0.0";