wlwy-package 4.0.0-beta.2 → 4.0.0-beta.21

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 (182) hide show
  1. package/dist/style.css +2 -1
  2. package/dist/types/axios/index.d.ts +6 -0
  3. package/dist/types/axios/service.d.ts +21 -0
  4. package/dist/types/axios/types/index.d.ts +32 -0
  5. package/dist/types/components/antd/index.d.ts +11 -0
  6. package/dist/types/components/antd/src/button.vue.d.ts +10 -0
  7. package/dist/types/components/antd/src/datePicker.vue.d.ts +16 -0
  8. package/dist/types/components/antd/src/descriptions-item.vue.d.ts +9 -0
  9. package/dist/types/components/antd/src/descriptions.vue.d.ts +6 -0
  10. package/dist/types/components/antd/src/modal.vue.d.ts +30 -0
  11. package/dist/types/components/antd/src/rangePicker.vue.d.ts +24 -0
  12. package/dist/types/components/antd/src/select.vue.d.ts +22 -0
  13. package/dist/types/components/antd/src/statistic.vue.d.ts +3 -0
  14. package/dist/types/components/antd/src/upload.vue.d.ts +40 -0
  15. package/dist/types/components/antd/type.d.ts +188 -0
  16. package/dist/types/components/common/index.d.ts +20 -0
  17. package/dist/types/components/common/src/Analysis.vue.d.ts +5 -0
  18. package/dist/types/components/common/src/Redirect.vue.d.ts +2 -0
  19. package/dist/types/components/common/src/configProvider.vue.d.ts +13 -0
  20. package/dist/types/components/common/src/copyable.vue.d.ts +16 -0
  21. package/dist/types/components/common/src/cropper.vue.d.ts +29 -0
  22. package/dist/types/components/common/src/dropdown.vue.d.ts +23 -0
  23. package/dist/types/components/common/src/noData.vue.d.ts +7 -0
  24. package/dist/types/components/common/src/page.vue.d.ts +38 -0
  25. package/dist/types/components/common/src/page404.vue.d.ts +11 -0
  26. package/dist/types/components/common/src/slashHeader.vue.d.ts +7 -0
  27. package/dist/types/components/common/src/upload-modal.vue.d.ts +43 -0
  28. package/dist/types/components/common/src/warehouseSelectGate.vue.d.ts +2 -0
  29. package/dist/types/components/common/type.d.ts +242 -0
  30. package/dist/types/components/form/business/index.d.ts +8 -0
  31. package/dist/types/components/form/business/src/channel.vue.d.ts +5 -0
  32. package/dist/types/components/form/business/src/country.vue.d.ts +3 -0
  33. package/dist/types/components/form/business/src/customer.vue.d.ts +6 -0
  34. package/dist/types/components/form/business/src/sku.vue.d.ts +16 -0
  35. package/dist/types/components/form/business/type.d.ts +39 -0
  36. package/dist/types/components/form/default/index.d.ts +39 -0
  37. package/dist/types/components/form/default/src/checkbox.vue.d.ts +22 -0
  38. package/dist/types/components/form/default/src/custom.vue.d.ts +14 -0
  39. package/dist/types/components/form/default/src/datePicker.vue.d.ts +5 -0
  40. package/dist/types/components/form/default/src/dateRange.vue.d.ts +10 -0
  41. package/dist/types/components/form/default/src/form.vue.d.ts +430 -0
  42. package/dist/types/components/form/default/src/formCol.vue.d.ts +16 -0
  43. package/dist/types/components/form/default/src/formItem.vue.d.ts +38 -0
  44. package/dist/types/components/form/default/src/formItemRest.vue.d.ts +2 -0
  45. package/dist/types/components/form/default/src/formMultiItem.vue.d.ts +31 -0
  46. package/dist/types/components/form/default/src/formMultiItemOption.vue.d.ts +14 -0
  47. package/dist/types/components/form/default/src/input.vue.d.ts +26 -0
  48. package/dist/types/components/form/default/src/inputI18n.vue.d.ts +14 -0
  49. package/dist/types/components/form/default/src/inputMatch.vue.d.ts +23 -0
  50. package/dist/types/components/form/default/src/inputNumber.vue.d.ts +16 -0
  51. package/dist/types/components/form/default/src/inputPassword.vue.d.ts +16 -0
  52. package/dist/types/components/form/default/src/inputTags.vue.d.ts +23 -0
  53. package/dist/types/components/form/default/src/numberRange.vue.d.ts +9 -0
  54. package/dist/types/components/form/default/src/radio.vue.d.ts +22 -0
  55. package/dist/types/components/form/default/src/select.vue.d.ts +27 -0
  56. package/dist/types/components/form/default/src/textarea.vue.d.ts +14 -0
  57. package/dist/types/components/form/default/src/timePicker.vue.d.ts +6 -0
  58. package/dist/types/components/form/default/src/upload-image.vue.d.ts +23 -0
  59. package/dist/types/components/form/default/src/upload.vue.d.ts +12 -0
  60. package/dist/types/components/form/default/type.d.ts +624 -0
  61. package/dist/types/components/form/index.d.ts +2 -0
  62. package/dist/types/components/form/type.d.ts +2 -0
  63. package/dist/types/components/icon/index.d.ts +4 -0
  64. package/dist/types/components/icon/src/icon.vue.d.ts +12 -0
  65. package/dist/types/components/icon/src/index.vue.d.ts +9 -0
  66. package/dist/types/components/icon/src/switch.vue.d.ts +18 -0
  67. package/dist/types/components/icon/type.d.ts +41 -0
  68. package/dist/types/components/index.d.ts +6 -0
  69. package/dist/types/components/layout/blank.vue.d.ts +2 -0
  70. package/dist/types/components/layout/index.d.ts +7 -0
  71. package/dist/types/components/layout/index.vue.d.ts +9 -0
  72. package/dist/types/components/layout/skeleton/button.vue.d.ts +8 -0
  73. package/dist/types/components/layout/skeleton/descriptions.vue.d.ts +18 -0
  74. package/dist/types/components/layout/skeleton/form.vue.d.ts +25 -0
  75. package/dist/types/components/layout/skeleton/list.vue.d.ts +2 -0
  76. package/dist/types/components/layout/skeleton/switch.vue.d.ts +2 -0
  77. package/dist/types/components/layout/skeleton/table.vue.d.ts +20 -0
  78. package/dist/types/components/layout/skeleton/utils.d.ts +88 -0
  79. package/dist/types/components/layout/src/footer.vue.d.ts +2 -0
  80. package/dist/types/components/layout/src/header/index.vue.d.ts +10 -0
  81. package/dist/types/components/layout/src/header/modules/download.vue.d.ts +6 -0
  82. package/dist/types/components/layout/src/header/modules/language.vue.d.ts +2 -0
  83. package/dist/types/components/layout/src/header/modules/password-modal.vue.d.ts +9 -0
  84. package/dist/types/components/layout/src/header/modules/topMenu.vue.d.ts +2 -0
  85. package/dist/types/components/layout/src/header/modules/warehouse.vue.d.ts +2 -0
  86. package/dist/types/components/layout/src/logo.vue.d.ts +2 -0
  87. package/dist/types/components/layout/src/siderMenu.vue.d.ts +2 -0
  88. package/dist/types/components/layout/src/subMenuItem.vue.d.ts +6 -0
  89. package/dist/types/components/layout/src/tabsNav.vue.d.ts +2 -0
  90. package/dist/types/components/layout/type.d.ts +17 -0
  91. package/dist/types/components/private/inputTags.vue.d.ts +21 -0
  92. package/dist/types/components/table/constants.d.ts +13 -0
  93. package/dist/types/components/table/index.d.ts +8 -0
  94. package/dist/types/components/table/resolveToolbarButtons.d.ts +16 -0
  95. package/dist/types/components/table/src/action-column.vue.d.ts +11 -0
  96. package/dist/types/components/table/src/column.vue.d.ts +119 -0
  97. package/dist/types/components/table/src/detail-search.vue.d.ts +31 -0
  98. package/dist/types/components/table/src/list-search.vue.d.ts +32 -0
  99. package/dist/types/components/table/src/pager.vue.d.ts +325 -0
  100. package/dist/types/components/table/src/search.vue.d.ts +44 -0
  101. package/dist/types/components/table/src/table.vue.d.ts +948 -0
  102. package/dist/types/components/table/src/toolbarButtons.vue.d.ts +18 -0
  103. package/dist/types/components/table/type.d.ts +354 -0
  104. package/dist/types/components/table/useWTableConfig.d.ts +38 -0
  105. package/dist/types/components/table/vxeDefaultConfig.d.ts +9 -0
  106. package/dist/types/components/table/warnDeprecated.d.ts +4 -0
  107. package/dist/types/config.d.ts +29 -0
  108. package/dist/types/directive/auth.d.ts +4 -0
  109. package/dist/types/directive/auths.d.ts +4 -0
  110. package/dist/types/directive/index.d.ts +6 -0
  111. package/dist/types/hooks/business/index.d.ts +5 -0
  112. package/dist/types/hooks/business/src/index.d.ts +5 -0
  113. package/dist/types/hooks/business/src/useCountryDict.d.ts +41 -0
  114. package/dist/types/hooks/business/src/useCurrencyDict.d.ts +29 -0
  115. package/dist/types/hooks/business/src/useCustomerDict.d.ts +41 -0
  116. package/dist/types/hooks/business/src/useWarehouseSelect.d.ts +15 -0
  117. package/dist/types/hooks/business/src/useWarehouseZoneDict.d.ts +29 -0
  118. package/dist/types/hooks/business/useBusinessDict.d.ts +13 -0
  119. package/dist/types/hooks/business/useDict.d.ts +35 -0
  120. package/dist/types/hooks/business/useDictRaw.d.ts +14 -0
  121. package/dist/types/hooks/index.d.ts +2 -0
  122. package/dist/types/hooks/private/index.d.ts +7 -0
  123. package/dist/types/hooks/private/src/useFormContext.d.ts +12 -0
  124. package/dist/types/hooks/private/src/useFormDefaultValue.d.ts +42 -0
  125. package/dist/types/hooks/private/src/useFormFieldRegister.d.ts +13 -0
  126. package/dist/types/hooks/private/src/useFormItemProps.d.ts +45 -0
  127. package/dist/types/hooks/private/src/useKey.d.ts +1 -0
  128. package/dist/types/hooks/private/src/useRenderCell.d.ts +71 -0
  129. package/dist/types/hooks/private/src/useTabsNav.d.ts +13 -0
  130. package/dist/types/hooks/web/index.d.ts +16 -0
  131. package/dist/types/hooks/web/key.d.ts +4 -0
  132. package/dist/types/hooks/web/src/useAffix.d.ts +19 -0
  133. package/dist/types/hooks/web/src/useCatchPreloadError.d.ts +6 -0
  134. package/dist/types/hooks/web/src/useCookie.d.ts +11 -0
  135. package/dist/types/hooks/web/src/useDate.d.ts +86 -0
  136. package/dist/types/hooks/web/src/useEnum.d.ts +28 -0
  137. package/dist/types/hooks/web/src/useExport.d.ts +4 -0
  138. package/dist/types/hooks/web/src/useForm.d.ts +1 -0
  139. package/dist/types/hooks/web/src/useI18n.d.ts +26 -0
  140. package/dist/types/hooks/web/src/useListPager.d.ts +37 -0
  141. package/dist/types/hooks/web/src/useLocale.d.ts +6 -0
  142. package/dist/types/hooks/web/src/useNProgress.d.ts +5 -0
  143. package/dist/types/hooks/web/src/useNavigate.d.ts +11 -0
  144. package/dist/types/hooks/web/src/usePageBack.d.ts +19 -0
  145. package/dist/types/hooks/web/src/useWindowSize.d.ts +8 -0
  146. package/dist/types/hooks/web/type.d.ts +70 -0
  147. package/dist/types/index.d.ts +21 -0
  148. package/dist/types/keys/index.d.ts +76 -0
  149. package/dist/types/keys/public.d.ts +0 -0
  150. package/dist/types/locales/enUs.d.ts +20 -0
  151. package/dist/types/locales/index.d.ts +4 -0
  152. package/dist/types/locales/zhCn.d.ts +20 -0
  153. package/dist/types/plugins/index.d.ts +1 -0
  154. package/dist/types/plugins/vueI18n/helper.d.ts +1 -0
  155. package/dist/types/plugins/vueI18n/index.d.ts +14 -0
  156. package/dist/types/setup/dayjs.d.ts +7 -0
  157. package/dist/types/setup/index.d.ts +3 -0
  158. package/dist/types/setup/vxe.d.ts +10 -0
  159. package/dist/types/store/index.d.ts +9 -0
  160. package/dist/types/store/modules/common.d.ts +30 -0
  161. package/dist/types/store/modules/dict.d.ts +126 -0
  162. package/dist/types/store/modules/language.d.ts +91 -0
  163. package/dist/types/store/modules/tagsNav.d.ts +83 -0
  164. package/dist/types/store/modules/userPermission.d.ts +59 -0
  165. package/dist/types/type.d.ts +53 -0
  166. package/dist/types/utils/config.d.ts +1 -0
  167. package/dist/types/utils/createRefInstanceProxy.d.ts +13 -0
  168. package/dist/types/utils/form.d.ts +9 -0
  169. package/dist/types/utils/formatCellValue.d.ts +88 -0
  170. package/dist/types/utils/getPrefixTitle.d.ts +5 -0
  171. package/dist/types/utils/index.d.ts +50 -0
  172. package/dist/types/utils/localStorage.d.ts +52 -0
  173. package/dist/types/utils/resolveDefaultValue.d.ts +12 -0
  174. package/dist/types/utils/type.d.ts +32 -0
  175. package/dist/wlwy-package.es.js +2 -10390
  176. package/package.json +22 -21
  177. package/dist/charts/index.es.js +0 -4
  178. package/dist/editor/index.es.js +0 -4
  179. package/dist/editor-core-BGPSxIdD.js +0 -21080
  180. package/dist/index-5P9J8Ohq.js +0 -9633
  181. package/dist/index-nd_lc6wA.js +0 -101
  182. package/dist/index.vue_vue_type_script_setup_true_lang-BHLjWGpQ.js +0 -73515
@@ -0,0 +1,35 @@
1
+ import type { OptionType } from '../../type';
2
+ /** 业务自定义字典缓存 key 前缀,与内置字典隔离 */
3
+ export declare const DICT_PRIVATE_PREFIX: "private_";
4
+ /** 公共组件内置业务字典基础名称(请通过 {@link useBusinessDict} / useXxxDict 使用) */
5
+ export type DictBasicNameType = 'warehouseZone' | 'country' | 'customer' | 'currency';
6
+ /**
7
+ * 字典缓存 key。
8
+ * - 内置名及其后缀(如 `country` / `country_xxx`):由内置 Hook 使用原始 key
9
+ * - 业务自定义:经 {@link useDict} 自动加上 {@link DICT_PRIVATE_PREFIX}
10
+ */
11
+ export type DictNameType = DictBasicNameType | (string & {});
12
+ /** 字典拉取配置 */
13
+ export type DictOptionType<T = unknown> = {
14
+ /** 远程请求,返回 `{ key, value, label, ... }` 选项列表 */
15
+ request: () => Promise<OptionType<T>[]>;
16
+ };
17
+ /** 将业务逻辑名转为实际缓存 key(已带前缀则不再套一层) */
18
+ export declare function toPrivateDictName(name: string): string;
19
+ /**
20
+ * 通用字典 Hook,供**业务项目自定义字典**使用:按名称读写缓存、按 code 查 label/item、清除缓存。
21
+ *
22
+ * 实际缓存 key 为 `private_${name}`(已带 `private_` 前缀则不再套一层),与内置字典隔离。
23
+ * 公共组件内置字典请使用 {@link useBusinessDict}(或 `useCountryDict` 等具体 Hook)。
24
+ *
25
+ * @param name 字典逻辑名称,可传任意 string
26
+ * @param option 拉取配置,需提供 `request`
27
+ * @returns `{ dict, getDict, getLabelByCode, getItemByCode, clearDict }`
28
+ */
29
+ export default function useDict<T = unknown>(name: string, option: DictOptionType<T>): {
30
+ dict: OptionType<T>[];
31
+ getDict: (reload?: boolean) => Promise<OptionType<T>[]>;
32
+ getLabelByValue: (value: OptionType<T>["value"]) => string | OptionType<T>["label"];
33
+ getItemByValue: (value: OptionType<T>["value"]) => OptionType<T> | undefined;
34
+ clearDict: (option?: boolean | import("../../type").ClearDictOption | undefined) => void;
35
+ };
@@ -0,0 +1,14 @@
1
+ import type { ClearDictOption, OptionType } from '../../type';
2
+ import type { DictNameType, DictOptionType } from './useDict';
3
+ /**
4
+ * 按原始缓存 key 读写字典(仅包内置 useXxxDict 使用,不自动加 `private_` 前缀)。
5
+ * 不经由 business/index 对外导出。
6
+ */
7
+ export declare function useDictRaw<T = unknown>(name: DictNameType, option: DictOptionType<T>): {
8
+ /** 与 store 共用同一数组引用,`getDict` / `clearDict` 后自动更新,解构后无需 `.value` */
9
+ dict: OptionType<T>[];
10
+ getDict: (reload?: boolean) => Promise<OptionType<T>[]>;
11
+ getLabelByValue: (value: OptionType<T>['value']) => OptionType<T>['label'] | string;
12
+ getItemByValue: (value: OptionType<T>['value']) => OptionType<T> | undefined;
13
+ clearDict: (option?: ClearDictOption | boolean) => void;
14
+ };
@@ -0,0 +1,2 @@
1
+ export * from './web';
2
+ export * from './business';
@@ -0,0 +1,7 @@
1
+ export { default as useRenderCell, toFormatCellOptions, resolveLegacyEnumMap, type RenderCellProps, type RenderCellFormatByType, type RenderCellFormatType, type RenderCellLegacyProps } from './src/useRenderCell';
2
+ export { default as useKey } from './src/useKey';
3
+ export { default as useFormItemProps } from './src/useFormItemProps';
4
+ export { default as useFormFieldRegister } from './src/useFormFieldRegister';
5
+ export { default as useFormDefaultValue, useMultiItemContext, type UseFormDefaultValueOptions } from './src/useFormDefaultValue';
6
+ export { default as useFormContext } from './src/useFormContext';
7
+ export { default as useTabsNav } from './src/useTabsNav';
@@ -0,0 +1,12 @@
1
+ import type { FormContext } from '../../../components/form/type';
2
+ import { type Ref } from 'vue';
3
+ export default function useFormContext<T = any>(): {
4
+ provideFormContext: (ctx: FormContext) => void;
5
+ injectFormContext: () => FormContext | undefined;
6
+ provideData: (data: Ref<T>) => void;
7
+ injectData: (defaultValue?: Ref<T>) => Ref<T> | undefined;
8
+ provideDetailsLoading: (loading: Ref<boolean>) => void;
9
+ injectDetailsLoading: (defaultValue?: boolean) => Ref<boolean>;
10
+ provideCardLoading: (loading: Ref<boolean>) => void;
11
+ injectCardLoading: (defaultValue?: boolean) => Ref<boolean>;
12
+ };
@@ -0,0 +1,42 @@
1
+ import type { DefaultValueType } from '../../../utils/type';
2
+ /**
3
+ * MultiItem 上下文能力(供表单控件统一使用):
4
+ * - `isInactive()`:处于 `w-form-multi-item` 内且当前不是本 Option
5
+ * - `registerClear()`:注册「切换离开本 Option」时的字段清理(多字段控件用)
6
+ *
7
+ * 不在 MultiItem 内时 `isInactive()` 恒为 false,`registerClear()` 为空实现。
8
+ */
9
+ export declare function useMultiItemContext(): {
10
+ isInactive: () => boolean;
11
+ registerClear: (clear: () => void) => void;
12
+ };
13
+ export type UseFormDefaultValueOptions<T> = {
14
+ /** defaultValue 取值(getter,保证读到最新 props) */
15
+ getDefaultValue: () => DefaultValueType<T> | undefined;
16
+ /** 目标字段是否为空(非 force 场景判定;异步解析完成后会再判一次) */
17
+ isEmpty: () => boolean;
18
+ /** 写入解析结果 */
19
+ write: (resolved: T) => void;
20
+ /**
21
+ * 其余回写:label / after 默认值、未传 defaultValue 时 force 写空值等。
22
+ * 与 defaultValue 回写一样受 MultiItem 守卫保护。
23
+ */
24
+ extra?: (force: boolean) => void;
25
+ /** 是否在挂载时写入默认值,默认 true */
26
+ applyOnMount?: boolean;
27
+ };
28
+ /**
29
+ * 表单默认值 + 搜索重置统一处理:
30
+ * - 挂载时写入默认值(非 force:仅当字段为空)
31
+ * - 在 `w-list-search` / `w-detail-search` 内注册重置回调(force:强制回写)
32
+ * - 处于 `w-form-multi-item` 内且非当前选中项时跳过回写(含异步 defaultValue 解析完成后,
33
+ * 避免 Search 清空又被 default-value 钩子写回)
34
+ *
35
+ * @see WSearchRegisterResetKey
36
+ * @see FormMultiItemContextKey
37
+ */
38
+ export declare function useFormDefaultValue<T>(options: UseFormDefaultValueOptions<T>): {
39
+ applyDefaultValue: (force?: boolean) => void;
40
+ isInactive: () => boolean;
41
+ };
42
+ export default useFormDefaultValue;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 向最近的搜索区(`w-search` / `w-list-search` / `w-detail-search`)上报本控件占用的 form 字段名。
3
+ *
4
+ * - 传入 getter(而非快照),字段名随 props 变化时无需重新注册
5
+ * - 不在搜索区内时为空实现,对详情 / 编辑等场景无副作用
6
+ * - 挂载时注册、卸载时取消;`w-form-multi-item` 下未激活的 Option 不挂载故不上报,
7
+ * 其字段由 MultiItem 自身上报全部 `option.model` 兜底
8
+ *
9
+ * @param getKeys 返回本控件占用的 form 字段名(如 `[model, startKey, endKey, labelModel]`)
10
+ * @see WSearchRegisterFieldKey
11
+ */
12
+ export declare function useFormFieldRegister(getKeys: () => string[]): void;
13
+ export default useFormFieldRegister;
@@ -0,0 +1,45 @@
1
+ import { type ComputedRef } from 'vue';
2
+ import { type FormItemProps } from 'ant-design-vue';
3
+ import type { FormItemXxProps } from '../../../components';
4
+ import type { CreateFormRulesPrompt } from '../../../utils/type';
5
+ import type { WFormItemProps } from '../../../components/form/type';
6
+ type PropsType = Partial<Pick<FormItemXxProps, 'form' | 'label' | 'disabled' | 'placeholder' | 'name' | 'model'>>;
7
+ export type UseFormItemPropsOptions = {
8
+ /** 缺省校验文案 / placeholder:enter → 请输入,select → 请选择 */
9
+ prompt?: CreateFormRulesPrompt;
10
+ };
11
+ type FormItemSlotsKeyType = keyof Pick<FormItemProps, 'label' | 'help' | 'extra'>;
12
+ type AttrMapType = {
13
+ formItem: Partial<FormItemProps & WFormItemProps>;
14
+ default: any;
15
+ };
16
+ type SlotMapType = {
17
+ formItem: Partial<Pick<FormItemProps, FormItemSlotsKeyType>>;
18
+ default: any;
19
+ };
20
+ /**
21
+ * 表单项公共 props 解析:拆分 formItem / 控件 attrs、解析 form / label / disabled / placeholder。
22
+ *
23
+ * 处于 `w-form-multi-item-option` 内时:
24
+ * - `model` 优先为 Option.model(覆盖 props.model),供非区间控件绑定字段
25
+ * - `label` 优先为 Option.label(覆盖 props.label),供 placeholder / collectLabel
26
+ * 区间类组件请继续使用自身 props.model / keys,勿依赖 model 覆盖做拆字段。
27
+ */
28
+ declare function useFormItemProps(props: PropsType, options?: UseFormItemPropsOptions): {
29
+ attrMap: ComputedRef<AttrMapType>;
30
+ slotMap: ComputedRef<SlotMapType>;
31
+ form: ComputedRef<any>;
32
+ /**
33
+ * 表单字段名。
34
+ * 在 MultiItemOption 内:Option.model;否则:props.model
35
+ */
36
+ model: ComputedRef<string>;
37
+ /**
38
+ * 展示 / 校验文案用 label(已 i18n)。
39
+ * 在 MultiItemOption 内:Option.label;否则:props.label
40
+ */
41
+ label: ComputedRef<string>;
42
+ disabled: ComputedRef<boolean>;
43
+ placeholder: ComputedRef<string>;
44
+ };
45
+ export default useFormItemProps;
@@ -0,0 +1 @@
1
+ export default function useKey(defaultValue?: string): string;
@@ -0,0 +1,71 @@
1
+ import { type DictBasicNameType } from '../../business';
2
+ import type { OptionType } from '../../../type';
3
+ import { type FormatCellBooleanOptions, type FormatCellEnumMap, type FormatCellEnumOptionsExtension, type FormatCellI18nOptions, type FormatCellNumberOptions, type FormatCellOptions, type FormatCellPercentOptions, type FormatCellTemporalOptions } from '../../../utils/formatCellValue';
4
+ type TemporalExtra = Pick<FormatCellTemporalOptions, 'format' | 'timeZone' | 'utc'>;
5
+ type FieldPath = string | number | string[] | number[];
6
+ /** 与 {@link FormatCellOptions} 对齐的按 `type` 区分的格式化 props */
7
+ export type RenderCellFormatByType = {
8
+ type?: 'raw';
9
+ } | ({
10
+ type: 'date';
11
+ } & TemporalExtra) | ({
12
+ type: 'time';
13
+ } & TemporalExtra) | ({
14
+ type: 'datetime';
15
+ } & TemporalExtra) | ({
16
+ type: 'number';
17
+ } & Pick<FormatCellNumberOptions, 'precision' | 'useGrouping'>) | ({
18
+ type: 'percent';
19
+ } & Pick<FormatCellPercentOptions, 'valueScale'>) | ({
20
+ type: 'boolean';
21
+ } & Pick<FormatCellBooleanOptions, 'trueText' | 'falseText'>) | ({
22
+ type: 'enum';
23
+ } & FormatCellEnumOptionsExtension & {
24
+ name?: string;
25
+ map?: FormatCellEnumMap;
26
+ }) | ({
27
+ type: 'i18n';
28
+ } & Pick<FormatCellI18nOptions, 'values'>)
29
+ /** 金额:等价于 `number` + 默认 `precision: 2` + 千分位;有 `precision` 时以传入为准 */
30
+ | ({
31
+ type: 'amount';
32
+ } & Pick<FormatCellNumberOptions, 'precision'>);
33
+ /** @deprecated 旧版平铺 props,由 {@link toFormatCellOptions} 自动映射 */
34
+ export type RenderCellLegacyProps = {
35
+ enum?: OptionType[] | Record<string, string> | string;
36
+ options?: OptionType[];
37
+ enumFieldNames?: {
38
+ label?: string;
39
+ value?: string;
40
+ };
41
+ fieldNames?: {
42
+ label?: string;
43
+ value?: string;
44
+ };
45
+ dictName?: DictBasicNameType;
46
+ /** 需配合 `type: 'number'` 使用 */
47
+ precision?: number;
48
+ };
49
+ export type RenderCellFormatType = NonNullable<RenderCellFormatByType['type']>;
50
+ export type RenderCellProps = {
51
+ field?: FieldPath;
52
+ /** 空值占位符,默认由 {@link formatCellValue} 处理为 `-` */
53
+ emptyPlaceholder?: string;
54
+ } & RenderCellFormatByType & Partial<RenderCellLegacyProps>;
55
+ export declare function resolveLegacyEnumMap(props: RenderCellProps, context: {
56
+ translate: (key: string) => string;
57
+ dictOptions?: OptionType[];
58
+ labelKey: string;
59
+ valueKey: string;
60
+ }): FormatCellEnumMap | undefined;
61
+ export declare function toFormatCellOptions(props: RenderCellProps, context?: {
62
+ enumMap?: FormatCellEnumMap;
63
+ translate?: (key: string) => string;
64
+ dictOptions?: OptionType[];
65
+ labelKey?: string;
66
+ valueKey?: string;
67
+ }): FormatCellOptions;
68
+ export default function useRenderCell(props: RenderCellProps): {
69
+ getRenderValue: (row?: Record<string, unknown>) => string | undefined;
70
+ };
71
+ export {};
@@ -0,0 +1,13 @@
1
+ import { type NavTabType } from '../../../store';
2
+ export default function useTabsNav(): {
3
+ initTabs: () => void;
4
+ addTabs: (route?: NavTabType) => void;
5
+ openLoading: () => void;
6
+ closeLoading: () => void;
7
+ closeAll: (callback?: Fn) => void;
8
+ closeLeft: (view?: NavTabType, callback?: Fn) => void;
9
+ closeRight: (view?: NavTabType, callback?: Fn) => void;
10
+ closeOther: (view?: NavTabType, callback?: Fn) => void;
11
+ closeCurrent: (view?: NavTabType, callback?: Fn) => void;
12
+ refreshPage: (view?: NavTabType, callback?: Fn) => Promise<void>;
13
+ };
@@ -0,0 +1,16 @@
1
+ export { default as useCatchPreloadError } from './src/useCatchPreloadError';
2
+ export { default as useCookie } from './src/useCookie';
3
+ export { default as useDate, type DateInput, type DateRange, type UseDateOptions, type RecentRangeOptions, type RangeOffsets, type RecentRangeN, } from './src/useDate';
4
+ export { default as useEnum } from './src/useEnum';
5
+ export { default as useExport } from './src/useExport';
6
+ export * from './src/useI18n';
7
+ export { default as useLocale } from './src/useLocale';
8
+ export { default as useNProgress } from './src/useNProgress';
9
+ export { default as useNavigate, type NavigatePushOptions } from './src/useNavigate';
10
+ export { default as useWindowSize } from './src/useWindowSize';
11
+ export { default as usePageBack, type PageBackHandler } from './src/usePageBack';
12
+ export { default as useListPager } from './src/useListPager';
13
+ /** @deprecated 请使用 useListPager */
14
+ export { default as useListResult } from './src/useListPager';
15
+ export { ListPagerKey } from './key';
16
+ export type { ListPageParams, ListPagerOptions, ListPagerContext, SetListPageParams, GetListPageParams, ResolveFromSearch, ResolveFromSearchOptions, } from './type';
@@ -0,0 +1,4 @@
1
+ import type { InjectionKey } from 'vue';
2
+ import type { ListPagerContext } from './type';
3
+ /** useListPager provide / w-list-search、w-table inject */
4
+ export declare const ListPagerKey: InjectionKey<ListPagerContext>;
@@ -0,0 +1,19 @@
1
+ type AffixOptions = {
2
+ /**
3
+ * 偏移量
4
+ * @default 0
5
+ */
6
+ offset?: number;
7
+ /**
8
+ * 滚动方向
9
+ * @default top
10
+ */
11
+ direction?: 'top' | 'bottom';
12
+ /**
13
+ * 滚动容器
14
+ * @default document.body
15
+ */
16
+ container?: () => HTMLElement;
17
+ };
18
+ export default function useAffix(target: () => HTMLElement, options?: AffixOptions): {};
19
+ export {};
@@ -0,0 +1,6 @@
1
+ type ErrorHandler = (event: Event) => void;
2
+ export default function useCatchPreloadError(handler?: ErrorHandler): {
3
+ catchPreloadError: () => void;
4
+ removeCatchPreloadError: () => void;
5
+ };
6
+ export {};
@@ -0,0 +1,11 @@
1
+ declare function getCookie(key: string): string;
2
+ declare function setCookie(key: string, value: string, options?: any): import("xe-utils").XECookie;
3
+ declare function removeCookie(key: string): number;
4
+ declare function getCookieAll(): import("xe-utils").XECookie;
5
+ export default function (): {
6
+ getCookie: typeof getCookie;
7
+ setCookie: typeof setCookie;
8
+ removeCookie: typeof removeCookie;
9
+ getCookieAll: typeof getCookieAll;
10
+ };
11
+ export {};
@@ -0,0 +1,86 @@
1
+ import dayjs, { type ConfigType, type Dayjs, type ManipulateType, type OpUnitType, type QUnitType } from '../../../setup/dayjs';
2
+ export type DateInput = ConfigType;
3
+ export type DateRange = [Dayjs, Dayjs];
4
+ type UseDateBaseOptions = {
5
+ /** 默认格式 */
6
+ format?: string;
7
+ /** 相对范围是否包含当前日,默认 true */
8
+ includeCurrent?: boolean;
9
+ };
10
+ export type UseDateOptions = (UseDateBaseOptions & {
11
+ /** 默认时区上下文(UTC);作用于 toDayjs / format / 日历边界等;与 timeZone 互斥 */
12
+ utc?: true;
13
+ timeZone?: never;
14
+ }) | (UseDateBaseOptions & {
15
+ /** 默认时区上下文(IANA);作用于 toDayjs / format / 日历边界等;与 utc 互斥 */
16
+ timeZone?: string;
17
+ utc?: never;
18
+ });
19
+ export type RecentRangeOptions = {
20
+ /** 是否包含当前日 */
21
+ includeCurrent?: boolean;
22
+ /** 基准日,默认今天 */
23
+ base?: DateInput;
24
+ /** 方向:forward=正向(往未来)、backward=反向(往过去),默认 backward */
25
+ direction?: 'forward' | 'backward';
26
+ };
27
+ /** 相对 base 的偏移元组 [起点偏移, 终点偏移];配合 direction:backward 时正=往过去,forward 时正=往未来 */
28
+ export type RangeOffsets = readonly [start: number, end: number];
29
+ export type RecentRangeN = number | RangeOffsets;
30
+ export declare const DEFAULT_DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
31
+ export declare const DEFAULT_DATE_FORMAT = "YYYY-MM-DD";
32
+ /**
33
+ * 日期工具 hook
34
+ * - 近 N 天:默认不含今天(如近 7 天 = today-7 ~ today);传 includeCurrent: true 则含今天共 N 天
35
+ * - 近 N 月 / 近 N 年:往前推 N 个单位,含当前日时再 +1 day(对齐表单预设语义)
36
+ * - options.utc / options.timeZone:默认时区上下文,作用于 toDayjs、format、parse、日历范围等
37
+ */
38
+ export default function useDate(options?: UseDateOptions): {
39
+ dayjs: typeof dayjs;
40
+ DEFAULT_DATETIME_FORMAT: string;
41
+ DEFAULT_DATE_FORMAT: string;
42
+ toDayjs: (value?: DateInput) => Dayjs;
43
+ format: (value?: DateInput, pattern?: string) => string;
44
+ formatUtc: (value?: DateInput, pattern?: string) => string;
45
+ formatTz: (value?: DateInput, timeZone?: string | undefined, pattern?: string) => string;
46
+ parse: (value: DateInput, pattern?: string) => Dayjs;
47
+ startOf: (value?: DateInput, unit?: OpUnitType) => Dayjs;
48
+ endOf: (value?: DateInput, unit?: OpUnitType) => Dayjs;
49
+ toTimestamp: (value?: DateInput) => number;
50
+ fromTimestamp: (ms: number) => Dayjs;
51
+ recentRange: (n: RecentRangeN, unit?: ManipulateType, opts?: RecentRangeOptions) => DateRange;
52
+ recentDays: (n: RecentRangeN, opts?: RecentRangeOptions) => DateRange;
53
+ recentMonths: (n: RecentRangeN, opts?: RecentRangeOptions) => DateRange;
54
+ recentYears: (n: RecentRangeN, opts?: RecentRangeOptions) => DateRange;
55
+ presets: {
56
+ last3Days: () => DateRange;
57
+ last7Days: () => DateRange;
58
+ last1Month: () => DateRange;
59
+ last3Months: () => DateRange;
60
+ last6Months: () => DateRange;
61
+ last1Year: () => DateRange;
62
+ last2Years: () => DateRange;
63
+ last3Years: () => DateRange;
64
+ last5Years: () => DateRange;
65
+ last10Years: () => DateRange;
66
+ };
67
+ today: () => DateRange;
68
+ yesterday: () => DateRange;
69
+ thisWeek: () => DateRange;
70
+ lastWeek: () => DateRange;
71
+ thisMonth: () => DateRange;
72
+ lastMonth: () => DateRange;
73
+ thisYear: () => DateRange;
74
+ lastYear: () => DateRange;
75
+ add: (value: DateInput, n: number, unit: ManipulateType) => Dayjs;
76
+ subtract: (value: DateInput, n: number, unit: ManipulateType) => Dayjs;
77
+ diff: (a: DateInput, b: DateInput, unit?: QUnitType | OpUnitType, float?: boolean) => number;
78
+ isBefore: (a: DateInput, b: DateInput, unit?: OpUnitType) => boolean;
79
+ isAfter: (a: DateInput, b: DateInput, unit?: OpUnitType) => boolean;
80
+ isSame: (a: DateInput, b: DateInput, unit?: OpUnitType) => boolean;
81
+ isBetween: (value: DateInput, start: DateInput, end: DateInput, unit?: OpUnitType | null, inclusivity?: '()' | '[]' | '[)' | '(]') => boolean;
82
+ toTimestampRange: (range: DateRange) => [number, number];
83
+ toFormatRange: (range: DateRange, pattern?: string) => [string, string];
84
+ toFormatRangeUtc: (range: DateRange, pattern?: string) => [string, string];
85
+ };
86
+ export {};
@@ -0,0 +1,28 @@
1
+ type CommonType = {
2
+ [key: string]: {
3
+ [key: string]: string;
4
+ };
5
+ };
6
+ type EnumType<T extends CommonType, K> = {
7
+ COMMON: T;
8
+ OPTION: K;
9
+ };
10
+ export declare const COMMON: {};
11
+ export declare const OPTION: {};
12
+ export default function useEnum<T extends CommonType, K>(options: EnumType<T, K>): {
13
+ enums: T;
14
+ enumMap: Map<keyof T, {
15
+ key: import("../../../type").KeyType;
16
+ value: import("../../../type").KeyType;
17
+ label: string;
18
+ disabled?: boolean | undefined;
19
+ }[]>;
20
+ getEnum: <T_1 extends keyof T, K_1 extends keyof T[T_1]>(name: T_1, keyTypeTransform?: "number" | "boolean" | "boolean2number" | "original") => {
21
+ key: keyof T[T_1];
22
+ value: keyof T[T_1];
23
+ label: string | T[T_1][K_1];
24
+ }[];
25
+ getEnumLable: <T_2 extends keyof T, K_2 extends keyof T[T_2]>(name: T_2, key: K_2) => string | K_2 | T[T_2][K_2];
26
+ getOption: (name: keyof K) => K[keyof K];
27
+ };
28
+ export {};
@@ -0,0 +1,4 @@
1
+ export default function useExport(): {
2
+ exportXls: (url: string, parames?: any, fileName?: string) => Promise<void>;
3
+ downloadFile: (url: string, fileName?: string) => void;
4
+ };
@@ -0,0 +1 @@
1
+ export default function useForm(): void;
@@ -0,0 +1,26 @@
1
+ type I18nGlobalTranslation = {
2
+ (key: string): string;
3
+ (key: string, locale: string): string;
4
+ (key: string, locale: string, list: unknown[]): string;
5
+ (key: string, locale: string, named: Record<string, unknown>): string;
6
+ (key: string, list: unknown[]): string;
7
+ (key: string, named: Record<string, unknown>): string;
8
+ };
9
+ type PlaceholderType = 'com_msg_062' | 'com_msg_063';
10
+ type PlaceholderFnType = (key: PlaceholderType, title: string) => string;
11
+ /**
12
+ * 国际化翻译hooks
13
+ * @param namespace 默认值 'lang'
14
+ * @return {*} {{
15
+ * t: I18nGlobalTranslation
16
+ * p: PlaceholderFnType
17
+ * }}
18
+ */
19
+ export declare const useI18n: (namespace?: string) => {
20
+ t: I18nGlobalTranslation;
21
+ p: PlaceholderFnType;
22
+ pleaseEnter: (title: string) => string;
23
+ pleaseSelect: (title: string) => string;
24
+ };
25
+ export declare const t: (key: string) => string;
26
+ export {};
@@ -0,0 +1,37 @@
1
+ import type { ListResult } from '../../../type';
2
+ import type { GetListPageParams, ListPagerOptions, ResolveFromSearch, SetListPageParams } from '../type';
3
+ /**
4
+ * 列表分页上下文:结果容器 + 乐观分页 + 搜索回第 1 页,并向子树 provide。
5
+ *
6
+ * ## 两套分页状态
7
+ * - `pageParams`:翻页 / 搜索立刻更新,`getPageParams()` 发请求用;pager UI 可先变
8
+ * - `listResult.current/size`:仅 `setListResult` 时与 `records` 一起更新(序号跟数据)
9
+ *
10
+ * ## 认主(避免嵌套 history 表误用父级 inject)
11
+ * - `w-list-search`:`form === ctx.query`
12
+ * - `w-table`:`listResult === ctx.listResult`
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const query = reactive({ status: undefined })
17
+ * const { listResult, setListResult, getPageParams } = useListPager({ query })
18
+ *
19
+ * async function fetchList() {
20
+ * const { current, size } = getPageParams()
21
+ * setListResult(await api({ ...query, current, size }))
22
+ * }
23
+ * ```
24
+ */
25
+ export default function useListPager<T = unknown>(_options?: ListPagerOptions): {
26
+ listResult: Readonly<{
27
+ records: import("@vue/reactivity").UnwrapRefSimple<T>[];
28
+ total: number;
29
+ current: number;
30
+ size: number;
31
+ pages: number;
32
+ }>;
33
+ setListResult: (result?: ListResult<T>) => void;
34
+ getPageParams: GetListPageParams;
35
+ setPageParams: SetListPageParams;
36
+ resolveFromSearch: ResolveFromSearch;
37
+ };
@@ -0,0 +1,6 @@
1
+ export default function (): {
2
+ getLanguage: () => string;
3
+ setLanguage: (value: string) => void;
4
+ removeLanguage: () => void;
5
+ isChinese: boolean;
6
+ };
@@ -0,0 +1,5 @@
1
+ import 'nprogress/nprogress.css';
2
+ export default function useNProgress(): {
3
+ start: () => void;
4
+ done: () => void;
5
+ };
@@ -0,0 +1,11 @@
1
+ export type NavigatePushOptions = {
2
+ /** 是否写入 sessionStorage(同标签刷新可恢复);默认 false,仅内存 */
3
+ session?: boolean;
4
+ };
5
+ export default function useNavigate<T = unknown>(): {
6
+ push: (target: string, data?: T, options?: NavigatePushOptions) => Promise<void | import("vue-router").NavigationFailure | undefined> | undefined;
7
+ state: import("vue").ComputedRef<T | undefined>;
8
+ takeState: <D = T>() => D | undefined;
9
+ route: import("vue-router").RouteLocationNormalizedLoadedGeneric;
10
+ router: import("vue-router").Router;
11
+ };
@@ -0,0 +1,19 @@
1
+ export type PageBackHandler = (reload?: boolean) => void;
2
+ /**
3
+ * 列表父页传入 handler 即 provide;子页 / w-page 不传参,一步拿到 pageBack。
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * // 父页
8
+ * usePageBack(toList)
9
+ * // 或
10
+ * const { pageBack } = usePageBack(toList)
11
+ *
12
+ * // 子页 / w-page
13
+ * const { pageBack } = usePageBack()
14
+ * pageBack(true)
15
+ * ```
16
+ */
17
+ export default function usePageBack(handler?: PageBackHandler): {
18
+ pageBack: PageBackHandler;
19
+ };
@@ -0,0 +1,8 @@
1
+ import type { UseWindowSizeType } from '../../../type';
2
+ export default function (scale?: UseWindowSizeType['NumType'], compared?: UseWindowSizeType['NumType'], comparedType?: UseWindowSizeType['ComparedType']): {
3
+ removeListener: () => void;
4
+ fullWidth: import("vue").Ref<number, number>;
5
+ fullHeight: import("vue").Ref<number, number>;
6
+ width: import("vue").Ref<number, number>;
7
+ height: import("vue").Ref<number, number>;
8
+ };
@@ -0,0 +1,70 @@
1
+ /**
2
+ * 列表分页参数(请求侧 / 乐观态)
3
+ */
4
+ export type ListPageParams = {
5
+ current: number;
6
+ size: number;
7
+ };
8
+ /**
9
+ * useListPager 入参
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const query = reactive({ ... })
14
+ * const { listResult, setListResult, getPageParams } = useListPager({ query })
15
+ * // <w-list-search v-model:form="query" />
16
+ * // <w-table :list-result="listResult" />
17
+ * ```
18
+ */
19
+ export interface ListPagerOptions {
20
+ /** 初始页码,默认 1 */
21
+ current?: number;
22
+ /** 初始每页条数,默认 10 */
23
+ size?: number;
24
+ /**
25
+ * 与 w-list-search 的 v-model:form 同一 reactive,用于认主。
26
+ * search 仅当 `form === query` 时才会调用 resolveFromSearch。
27
+ */
28
+ query?: object;
29
+ /**
30
+ * 搜索条件序列化(用于快照对比是否变化)。
31
+ * 默认:去掉 current/size/pages,跳过 undefined,Date 等走 valueOf。
32
+ */
33
+ serializeQuery?: (query: unknown) => string;
34
+ }
35
+ /** 写入乐观分页(不更新 listResult.current/size) */
36
+ export type SetListPageParams = (params: Partial<ListPageParams>) => void;
37
+ /** 读取当前请求用分页(翻页/搜索后、接口返回前即可用) */
38
+ export type GetListPageParams = () => ListPageParams;
39
+ export type ResolveFromSearchOptions = {
40
+ /** true:无论条件是否相对上次成功请求变化,都把 current 置为 1 */
41
+ force?: boolean;
42
+ };
43
+ /**
44
+ * 搜索前裁决页码:条件变化或 force 时 current=1,size 不变。
45
+ * 只改 pageParams,等 setListResult 后再写 listResult.current。
46
+ */
47
+ export type ResolveFromSearch = (form?: unknown, options?: ResolveFromSearchOptions) => void;
48
+ /**
49
+ * provide/inject 上下文(w-list-search / w-table 认主后消费)
50
+ *
51
+ * - listResult:与业务 `:list-result` 同一引用;current/size 表示「已展示数据」的页
52
+ * - pageParams:乐观分页,翻页/搜索立刻更新,供 getPageParams 与 pager UI
53
+ */
54
+ export type ListPagerContext = {
55
+ /** 认主用:与 w-list-search v-model:form 同一对象 */
56
+ query?: object;
57
+ /**
58
+ * 与 hook 返回值 / `:list-result` 同一引用。
59
+ * table 用 `props.listResult === ctx.listResult` 判断是否接管。
60
+ * current/size 仅在 setListResult 时与 records 一并更新。
61
+ */
62
+ listResult: object;
63
+ /**
64
+ * 请求用乐观分页(翻页、resolveFromSearch 立刻改)。
65
+ * table 绑定后 pager UI 跟随此对象;序号仍跟 listResult。
66
+ */
67
+ pageParams: ListPageParams;
68
+ setPageParams: SetListPageParams;
69
+ resolveFromSearch: ResolveFromSearch;
70
+ };