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.
- package/dist/style.css +2 -1
- package/dist/types/axios/index.d.ts +6 -0
- package/dist/types/axios/service.d.ts +21 -0
- package/dist/types/axios/types/index.d.ts +32 -0
- package/dist/types/components/antd/index.d.ts +11 -0
- package/dist/types/components/antd/src/button.vue.d.ts +10 -0
- package/dist/types/components/antd/src/datePicker.vue.d.ts +16 -0
- package/dist/types/components/antd/src/descriptions-item.vue.d.ts +9 -0
- package/dist/types/components/antd/src/descriptions.vue.d.ts +6 -0
- package/dist/types/components/antd/src/modal.vue.d.ts +30 -0
- package/dist/types/components/antd/src/rangePicker.vue.d.ts +24 -0
- package/dist/types/components/antd/src/select.vue.d.ts +22 -0
- package/dist/types/components/antd/src/statistic.vue.d.ts +3 -0
- package/dist/types/components/antd/src/upload.vue.d.ts +40 -0
- package/dist/types/components/antd/type.d.ts +188 -0
- package/dist/types/components/common/index.d.ts +20 -0
- package/dist/types/components/common/src/Analysis.vue.d.ts +5 -0
- package/dist/types/components/common/src/Redirect.vue.d.ts +2 -0
- package/dist/types/components/common/src/configProvider.vue.d.ts +13 -0
- package/dist/types/components/common/src/copyable.vue.d.ts +16 -0
- package/dist/types/components/common/src/cropper.vue.d.ts +29 -0
- package/dist/types/components/common/src/dropdown.vue.d.ts +23 -0
- package/dist/types/components/common/src/noData.vue.d.ts +7 -0
- package/dist/types/components/common/src/page.vue.d.ts +38 -0
- package/dist/types/components/common/src/page404.vue.d.ts +11 -0
- package/dist/types/components/common/src/slashHeader.vue.d.ts +7 -0
- package/dist/types/components/common/src/upload-modal.vue.d.ts +43 -0
- package/dist/types/components/common/src/warehouseSelectGate.vue.d.ts +2 -0
- package/dist/types/components/common/type.d.ts +242 -0
- package/dist/types/components/form/business/index.d.ts +8 -0
- package/dist/types/components/form/business/src/channel.vue.d.ts +5 -0
- package/dist/types/components/form/business/src/country.vue.d.ts +3 -0
- package/dist/types/components/form/business/src/customer.vue.d.ts +6 -0
- package/dist/types/components/form/business/src/sku.vue.d.ts +16 -0
- package/dist/types/components/form/business/type.d.ts +39 -0
- package/dist/types/components/form/default/index.d.ts +39 -0
- package/dist/types/components/form/default/src/checkbox.vue.d.ts +22 -0
- package/dist/types/components/form/default/src/custom.vue.d.ts +14 -0
- package/dist/types/components/form/default/src/datePicker.vue.d.ts +5 -0
- package/dist/types/components/form/default/src/dateRange.vue.d.ts +10 -0
- package/dist/types/components/form/default/src/form.vue.d.ts +430 -0
- package/dist/types/components/form/default/src/formCol.vue.d.ts +16 -0
- package/dist/types/components/form/default/src/formItem.vue.d.ts +38 -0
- package/dist/types/components/form/default/src/formItemRest.vue.d.ts +2 -0
- package/dist/types/components/form/default/src/formMultiItem.vue.d.ts +31 -0
- package/dist/types/components/form/default/src/formMultiItemOption.vue.d.ts +14 -0
- package/dist/types/components/form/default/src/input.vue.d.ts +26 -0
- package/dist/types/components/form/default/src/inputI18n.vue.d.ts +14 -0
- package/dist/types/components/form/default/src/inputMatch.vue.d.ts +23 -0
- package/dist/types/components/form/default/src/inputNumber.vue.d.ts +16 -0
- package/dist/types/components/form/default/src/inputPassword.vue.d.ts +16 -0
- package/dist/types/components/form/default/src/inputTags.vue.d.ts +23 -0
- package/dist/types/components/form/default/src/numberRange.vue.d.ts +9 -0
- package/dist/types/components/form/default/src/radio.vue.d.ts +22 -0
- package/dist/types/components/form/default/src/select.vue.d.ts +27 -0
- package/dist/types/components/form/default/src/textarea.vue.d.ts +14 -0
- package/dist/types/components/form/default/src/timePicker.vue.d.ts +6 -0
- package/dist/types/components/form/default/src/upload-image.vue.d.ts +23 -0
- package/dist/types/components/form/default/src/upload.vue.d.ts +12 -0
- package/dist/types/components/form/default/type.d.ts +624 -0
- package/dist/types/components/form/index.d.ts +2 -0
- package/dist/types/components/form/type.d.ts +2 -0
- package/dist/types/components/icon/index.d.ts +4 -0
- package/dist/types/components/icon/src/icon.vue.d.ts +12 -0
- package/dist/types/components/icon/src/index.vue.d.ts +9 -0
- package/dist/types/components/icon/src/switch.vue.d.ts +18 -0
- package/dist/types/components/icon/type.d.ts +41 -0
- package/dist/types/components/index.d.ts +6 -0
- package/dist/types/components/layout/blank.vue.d.ts +2 -0
- package/dist/types/components/layout/index.d.ts +7 -0
- package/dist/types/components/layout/index.vue.d.ts +9 -0
- package/dist/types/components/layout/skeleton/button.vue.d.ts +8 -0
- package/dist/types/components/layout/skeleton/descriptions.vue.d.ts +18 -0
- package/dist/types/components/layout/skeleton/form.vue.d.ts +25 -0
- package/dist/types/components/layout/skeleton/list.vue.d.ts +2 -0
- package/dist/types/components/layout/skeleton/switch.vue.d.ts +2 -0
- package/dist/types/components/layout/skeleton/table.vue.d.ts +20 -0
- package/dist/types/components/layout/skeleton/utils.d.ts +88 -0
- package/dist/types/components/layout/src/footer.vue.d.ts +2 -0
- package/dist/types/components/layout/src/header/index.vue.d.ts +10 -0
- package/dist/types/components/layout/src/header/modules/download.vue.d.ts +6 -0
- package/dist/types/components/layout/src/header/modules/language.vue.d.ts +2 -0
- package/dist/types/components/layout/src/header/modules/password-modal.vue.d.ts +9 -0
- package/dist/types/components/layout/src/header/modules/topMenu.vue.d.ts +2 -0
- package/dist/types/components/layout/src/header/modules/warehouse.vue.d.ts +2 -0
- package/dist/types/components/layout/src/logo.vue.d.ts +2 -0
- package/dist/types/components/layout/src/siderMenu.vue.d.ts +2 -0
- package/dist/types/components/layout/src/subMenuItem.vue.d.ts +6 -0
- package/dist/types/components/layout/src/tabsNav.vue.d.ts +2 -0
- package/dist/types/components/layout/type.d.ts +17 -0
- package/dist/types/components/private/inputTags.vue.d.ts +21 -0
- package/dist/types/components/table/constants.d.ts +13 -0
- package/dist/types/components/table/index.d.ts +8 -0
- package/dist/types/components/table/resolveToolbarButtons.d.ts +16 -0
- package/dist/types/components/table/src/action-column.vue.d.ts +11 -0
- package/dist/types/components/table/src/column.vue.d.ts +119 -0
- package/dist/types/components/table/src/detail-search.vue.d.ts +31 -0
- package/dist/types/components/table/src/list-search.vue.d.ts +32 -0
- package/dist/types/components/table/src/pager.vue.d.ts +325 -0
- package/dist/types/components/table/src/search.vue.d.ts +44 -0
- package/dist/types/components/table/src/table.vue.d.ts +948 -0
- package/dist/types/components/table/src/toolbarButtons.vue.d.ts +18 -0
- package/dist/types/components/table/type.d.ts +354 -0
- package/dist/types/components/table/useWTableConfig.d.ts +38 -0
- package/dist/types/components/table/vxeDefaultConfig.d.ts +9 -0
- package/dist/types/components/table/warnDeprecated.d.ts +4 -0
- package/dist/types/config.d.ts +29 -0
- package/dist/types/directive/auth.d.ts +4 -0
- package/dist/types/directive/auths.d.ts +4 -0
- package/dist/types/directive/index.d.ts +6 -0
- package/dist/types/hooks/business/index.d.ts +5 -0
- package/dist/types/hooks/business/src/index.d.ts +5 -0
- package/dist/types/hooks/business/src/useCountryDict.d.ts +41 -0
- package/dist/types/hooks/business/src/useCurrencyDict.d.ts +29 -0
- package/dist/types/hooks/business/src/useCustomerDict.d.ts +41 -0
- package/dist/types/hooks/business/src/useWarehouseSelect.d.ts +15 -0
- package/dist/types/hooks/business/src/useWarehouseZoneDict.d.ts +29 -0
- package/dist/types/hooks/business/useBusinessDict.d.ts +13 -0
- package/dist/types/hooks/business/useDict.d.ts +35 -0
- package/dist/types/hooks/business/useDictRaw.d.ts +14 -0
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/private/index.d.ts +7 -0
- package/dist/types/hooks/private/src/useFormContext.d.ts +12 -0
- package/dist/types/hooks/private/src/useFormDefaultValue.d.ts +42 -0
- package/dist/types/hooks/private/src/useFormFieldRegister.d.ts +13 -0
- package/dist/types/hooks/private/src/useFormItemProps.d.ts +45 -0
- package/dist/types/hooks/private/src/useKey.d.ts +1 -0
- package/dist/types/hooks/private/src/useRenderCell.d.ts +71 -0
- package/dist/types/hooks/private/src/useTabsNav.d.ts +13 -0
- package/dist/types/hooks/web/index.d.ts +16 -0
- package/dist/types/hooks/web/key.d.ts +4 -0
- package/dist/types/hooks/web/src/useAffix.d.ts +19 -0
- package/dist/types/hooks/web/src/useCatchPreloadError.d.ts +6 -0
- package/dist/types/hooks/web/src/useCookie.d.ts +11 -0
- package/dist/types/hooks/web/src/useDate.d.ts +86 -0
- package/dist/types/hooks/web/src/useEnum.d.ts +28 -0
- package/dist/types/hooks/web/src/useExport.d.ts +4 -0
- package/dist/types/hooks/web/src/useForm.d.ts +1 -0
- package/dist/types/hooks/web/src/useI18n.d.ts +26 -0
- package/dist/types/hooks/web/src/useListPager.d.ts +37 -0
- package/dist/types/hooks/web/src/useLocale.d.ts +6 -0
- package/dist/types/hooks/web/src/useNProgress.d.ts +5 -0
- package/dist/types/hooks/web/src/useNavigate.d.ts +11 -0
- package/dist/types/hooks/web/src/usePageBack.d.ts +19 -0
- package/dist/types/hooks/web/src/useWindowSize.d.ts +8 -0
- package/dist/types/hooks/web/type.d.ts +70 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/keys/index.d.ts +76 -0
- package/dist/types/keys/public.d.ts +0 -0
- package/dist/types/locales/enUs.d.ts +20 -0
- package/dist/types/locales/index.d.ts +4 -0
- package/dist/types/locales/zhCn.d.ts +20 -0
- package/dist/types/plugins/index.d.ts +1 -0
- package/dist/types/plugins/vueI18n/helper.d.ts +1 -0
- package/dist/types/plugins/vueI18n/index.d.ts +14 -0
- package/dist/types/setup/dayjs.d.ts +7 -0
- package/dist/types/setup/index.d.ts +3 -0
- package/dist/types/setup/vxe.d.ts +10 -0
- package/dist/types/store/index.d.ts +9 -0
- package/dist/types/store/modules/common.d.ts +30 -0
- package/dist/types/store/modules/dict.d.ts +126 -0
- package/dist/types/store/modules/language.d.ts +91 -0
- package/dist/types/store/modules/tagsNav.d.ts +83 -0
- package/dist/types/store/modules/userPermission.d.ts +59 -0
- package/dist/types/type.d.ts +53 -0
- package/dist/types/utils/config.d.ts +1 -0
- package/dist/types/utils/createRefInstanceProxy.d.ts +13 -0
- package/dist/types/utils/form.d.ts +9 -0
- package/dist/types/utils/formatCellValue.d.ts +88 -0
- package/dist/types/utils/getPrefixTitle.d.ts +5 -0
- package/dist/types/utils/index.d.ts +50 -0
- package/dist/types/utils/localStorage.d.ts +52 -0
- package/dist/types/utils/resolveDefaultValue.d.ts +12 -0
- package/dist/types/utils/type.d.ts +32 -0
- package/dist/wlwy-package.es.js +2 -10390
- package/package.json +22 -21
- package/dist/charts/index.es.js +0 -4
- package/dist/editor/index.es.js +0 -4
- package/dist/editor-core-BGPSxIdD.js +0 -21080
- package/dist/index-5P9J8Ohq.js +0 -9633
- package/dist/index-nd_lc6wA.js +0 -101
- package/dist/index.vue_vue_type_script_setup_true_lang-BHLjWGpQ.js +0 -73515
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CreateFormRulesOptions, CreateFormRulesPrompt, FormRules } from './type';
|
|
2
|
+
export declare function resolveRequiredMessage(prompt: CreateFormRulesPrompt, label?: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* 批量生成表单必填校验规则(ant-design-vue Form rules)
|
|
5
|
+
*
|
|
6
|
+
* - 未传 `prompt` 时不生成必填 message(有 prompt 才按 label 拼「请输入/请选择」)
|
|
7
|
+
* - `type: 'string' | 'boolean'` 忽略;其余 type / len / max / min / pattern 另生成约束规则
|
|
8
|
+
*/
|
|
9
|
+
export declare function createFormRules(options: CreateFormRulesOptions): FormRules;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export interface FormatCellTemporalOptions {
|
|
2
|
+
/** dayjs 格式串;未传则用各 `type` 默认 */
|
|
3
|
+
format?: string;
|
|
4
|
+
/** IANA 时区,如 `Asia/Shanghai`;未传则按本地时区;有 `utc: true` 时忽略 */
|
|
5
|
+
timeZone?: string;
|
|
6
|
+
/** 按 UTC 格式化;优先级高于 timeZone */
|
|
7
|
+
utc?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface FormatCellDateOnlyOptions extends FormatCellTemporalOptions {
|
|
10
|
+
type: 'date';
|
|
11
|
+
}
|
|
12
|
+
export interface FormatCellTimeOnlyOptions extends FormatCellTemporalOptions {
|
|
13
|
+
type: 'time';
|
|
14
|
+
}
|
|
15
|
+
export interface FormatCellDateTimeOptions extends FormatCellTemporalOptions {
|
|
16
|
+
type: 'datetime';
|
|
17
|
+
}
|
|
18
|
+
export interface FormatCellRawOptions {
|
|
19
|
+
type: 'raw';
|
|
20
|
+
}
|
|
21
|
+
export interface FormatCellNumberOptions {
|
|
22
|
+
type: 'number';
|
|
23
|
+
/** 小数位数:0 为整数,1 为一位小数,以此类推 */
|
|
24
|
+
precision?: number;
|
|
25
|
+
/** 是否使用千分位分组;未传则跟随 `Intl.NumberFormat` 默认(通常为 true) */
|
|
26
|
+
useGrouping?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface FormatCellPercentOptions {
|
|
29
|
+
type: 'percent';
|
|
30
|
+
/** `ratio`:`0.12` → 12%;`hundred`:`12` → 12% */
|
|
31
|
+
valueScale?: 'ratio' | 'hundred';
|
|
32
|
+
}
|
|
33
|
+
export interface FormatCellBooleanOptions {
|
|
34
|
+
type: 'boolean';
|
|
35
|
+
trueText?: string;
|
|
36
|
+
falseText?: string;
|
|
37
|
+
}
|
|
38
|
+
/** 枚举项(`map` 为数组时的元素形状) */
|
|
39
|
+
export interface FormatCellEnumEntry {
|
|
40
|
+
key: string | number;
|
|
41
|
+
text: string | number;
|
|
42
|
+
}
|
|
43
|
+
/** 枚举查表数据:`Record` 或 `{ key, text }[]` */
|
|
44
|
+
export type FormatCellEnumMap = Record<string, string> | FormatCellEnumEntry[];
|
|
45
|
+
/**
|
|
46
|
+
* 宿主可对 `type: 'enum'` 的选项做声明合并扩展(勿在本接口上写必填字段,否则与合并语义冲突)。
|
|
47
|
+
*
|
|
48
|
+
* `name` 的强类型约束请通过 {@link useEnum} 的 `formatCell` 使用 `keyof R`。
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* declare module 'wlwy-package' {
|
|
53
|
+
* interface FormatCellEnumOptionsExtension {
|
|
54
|
+
* columnKey?: string
|
|
55
|
+
* }
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export interface FormatCellEnumOptionsExtension {
|
|
60
|
+
}
|
|
61
|
+
export interface FormatCellEnumOptions extends FormatCellEnumOptionsExtension {
|
|
62
|
+
type: 'enum';
|
|
63
|
+
/** 枚举名;仅 `useEnum().formatCell` 解析,需配合注册表。与 `map` 同时存在时忽略 */
|
|
64
|
+
name?: string;
|
|
65
|
+
/** 查表数据;未传时须由 `useEnum` 根据 `name` 注入 */
|
|
66
|
+
map?: FormatCellEnumMap;
|
|
67
|
+
}
|
|
68
|
+
/** 将 {@link FormatCellEnumMap} 规范为 `Record<string, string>` */
|
|
69
|
+
export declare function normalizeEnumMap(map: FormatCellEnumMap): Record<string, string>;
|
|
70
|
+
export interface FormatCellI18nOptions {
|
|
71
|
+
type: 'i18n';
|
|
72
|
+
/** vue-i18n 插值参数 */
|
|
73
|
+
values?: Record<string, unknown>;
|
|
74
|
+
}
|
|
75
|
+
export type FormatCellOptions = FormatCellRawOptions | FormatCellDateOnlyOptions | FormatCellTimeOnlyOptions | FormatCellDateTimeOptions | FormatCellNumberOptions | FormatCellPercentOptions | FormatCellBooleanOptions | FormatCellEnumOptions | FormatCellI18nOptions;
|
|
76
|
+
/** 非「空单元格」场景:非法日期/数字等原样展示 */
|
|
77
|
+
export declare function preserveRawCellValue(value: unknown): string;
|
|
78
|
+
/**
|
|
79
|
+
* 单元格格式化核心:不包含「空值 → placeholder」逻辑,调用方需先处理占位或与 {@link formatCellValue} 配合使用。
|
|
80
|
+
*/
|
|
81
|
+
export declare function formatCellValueCore(value: unknown, options: FormatCellOptions): string;
|
|
82
|
+
/**
|
|
83
|
+
* 表格/描述列表等场景的单元格格式化:按 `options.type` 输出字符串;
|
|
84
|
+
* 无法识别为日期/数字等时 **原样字符串化**,不使用 `Invalid Date`。
|
|
85
|
+
*
|
|
86
|
+
* @param emptyPlaceholder 空值占位符,默认 `-`;日期/时间类型额外将 `0` / `'0'` 视为空
|
|
87
|
+
*/
|
|
88
|
+
export declare function formatCellValue(value: unknown, options: FormatCellOptions, emptyPlaceholder?: string): string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { PickMultipleResult, TargetsType } from './type';
|
|
2
|
+
export type { PickMultipleFn, MaybePromise, DefaultValueType, CreateFormRulesOptions, CreateFormRulesField, CreateFormRulesPrompt, FormRule, FormRules, } from './type';
|
|
3
|
+
export { createFormRules } from './form';
|
|
4
|
+
export { resolveDefaultValue, whenDefaultValueResolved, isEmptyFormValue } from './resolveDefaultValue';
|
|
5
|
+
export { createRefInstanceProxy, type CreateRefInstanceProxyOptions } from './createRefInstanceProxy';
|
|
6
|
+
export { getTitle } from './getPrefixTitle';
|
|
7
|
+
export { formatCellValue, formatCellValueCore, normalizeEnumMap, preserveRawCellValue, type FormatCellOptions, type FormatCellEnumMap, type FormatCellEnumEntry, type FormatCellEnumOptionsExtension, type FormatCellTemporalOptions, type FormatCellDateOnlyOptions, type FormatCellTimeOnlyOptions, type FormatCellDateTimeOptions, type FormatCellRawOptions, type FormatCellNumberOptions, type FormatCellPercentOptions, type FormatCellBooleanOptions, type FormatCellEnumOptions, type FormatCellI18nOptions, } from './formatCellValue';
|
|
8
|
+
/**
|
|
9
|
+
* 列表语言翻译
|
|
10
|
+
*
|
|
11
|
+
* @template T
|
|
12
|
+
* @param {Array<T>} list
|
|
13
|
+
* @param {string} [fChild='children']
|
|
14
|
+
* @param {string} [fCode='languageCode']
|
|
15
|
+
* @return {*} {Array<T>}
|
|
16
|
+
*/
|
|
17
|
+
export declare function listTranslation<T>(list: Array<T>, fChild?: string, fCode?: string): Array<T>;
|
|
18
|
+
/**
|
|
19
|
+
* 新开浏览器标签页
|
|
20
|
+
*
|
|
21
|
+
* @export
|
|
22
|
+
* @param {string} url
|
|
23
|
+
*/
|
|
24
|
+
export declare function newWin(url: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* 判断是否是外链
|
|
27
|
+
*
|
|
28
|
+
* @export
|
|
29
|
+
* @param {string} url
|
|
30
|
+
* @return {*}
|
|
31
|
+
*/
|
|
32
|
+
export declare function isExternalLink(url: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Object key值横杠转驼峰
|
|
35
|
+
* @param obj
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
export declare function kebabToCamel<T extends Record<string, any>>(obj: T): {
|
|
39
|
+
[K in keyof T as K extends `${infer Prefix}-${infer Rest}` ? `${Prefix}${Capitalize<Rest>}` : K]?: T[K];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* 收集多个对象属性
|
|
43
|
+
*
|
|
44
|
+
* @template T
|
|
45
|
+
* @template K
|
|
46
|
+
* @param {T} obj
|
|
47
|
+
* @param {TargetsType<T, K>} targets
|
|
48
|
+
* @return {*} {PickMultipleResult<T, K>}
|
|
49
|
+
*/
|
|
50
|
+
export declare function pickMultiple<T extends object, K extends string>(obj: T, targets: TargetsType<T, K>): PickMultipleResult<T, K>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** 仓库信息 */
|
|
2
|
+
export type WarehouseProp = {
|
|
3
|
+
warehouseId: number;
|
|
4
|
+
warehouseCode: string;
|
|
5
|
+
nameZh: string;
|
|
6
|
+
nameEn: string;
|
|
7
|
+
};
|
|
8
|
+
/** 按 platformCode 映射的仓库 ID 集合 */
|
|
9
|
+
type WarehouseIdsProp = {
|
|
10
|
+
[key: string]: WarehouseProp['warehouseId'];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* 读取 localStorage 中全部仓库 ID 映射
|
|
14
|
+
* @returns platformCode → warehouseId;解析失败时返回 `{}`
|
|
15
|
+
*/
|
|
16
|
+
export declare function getWarehouseIdObj(): WarehouseIdsProp;
|
|
17
|
+
/**
|
|
18
|
+
* 根据当前仓库 ID,从仓库选择字典取仓库编码
|
|
19
|
+
* @returns 仓库编码;无当前仓库或字典无匹配项时为 `undefined`
|
|
20
|
+
*/
|
|
21
|
+
export declare function getWarehouseCode(): WarehouseProp['warehouseCode'] | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* 根据当前仓库 ID,从仓库选择字典取仓库名称
|
|
24
|
+
* @returns 仓库名称;无当前仓库或字典无匹配项时为 `undefined`
|
|
25
|
+
*/
|
|
26
|
+
export declare function getWarehouseName(): string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* 获取当前 platformCode 对应的仓库 ID
|
|
29
|
+
* @returns 仓库 ID;无 platformCode 或未配置时为 `undefined`
|
|
30
|
+
*/
|
|
31
|
+
export declare function getWarehouseId(): WarehouseProp['warehouseId'] | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* 写入当前 platformCode 对应的仓库 ID
|
|
34
|
+
* @param id 仓库 ID
|
|
35
|
+
* @remarks 无 platformCode 时提示错误并刷新页面
|
|
36
|
+
*/
|
|
37
|
+
export declare function setWarehouseId(id: WarehouseProp['warehouseId']): void;
|
|
38
|
+
/** 清除 localStorage 中全部仓库 ID 映射 */
|
|
39
|
+
export declare function removeWarehouseId(): void;
|
|
40
|
+
/**
|
|
41
|
+
* 写入平台编码
|
|
42
|
+
* @param code 平台编码
|
|
43
|
+
*/
|
|
44
|
+
export declare function setPlatformCode(code: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* 读取平台编码
|
|
47
|
+
* @returns 平台编码;未设置时为 `null`
|
|
48
|
+
*/
|
|
49
|
+
export declare function getPlatformCode(): string | null;
|
|
50
|
+
/** 清除平台编码 */
|
|
51
|
+
export declare function removePlatformCode(): void;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DefaultValueType, MaybePromise } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* 解析 defaultValue:支持静态值、Promise、同步/异步函数。
|
|
4
|
+
* 同步值原样返回(不进入微任务);仅 Promise 结果保持异步。
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveDefaultValue<T>(value: DefaultValueType<T> | undefined): MaybePromise<T | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* 将解析结果交给 apply:同步立即执行,异步完成后执行。
|
|
9
|
+
*/
|
|
10
|
+
export declare function whenDefaultValueResolved<T>(value: DefaultValueType<T> | undefined, apply: (resolved: T) => void): void | Promise<void>;
|
|
11
|
+
/** 表单字段是否视为空(用于判断是否写入 defaultValue) */
|
|
12
|
+
export declare function isEmptyFormValue(val: unknown): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Rule } from 'ant-design-vue/es/form';
|
|
2
|
+
export type TargetsType<T extends object, K extends string> = Record<K, (keyof T)[]>;
|
|
3
|
+
export type ResultKeysType<K extends string> = K | 'default';
|
|
4
|
+
export type PickMultipleResult<T extends object, K extends string> = {
|
|
5
|
+
[key in ResultKeysType<K>]: Partial<T>;
|
|
6
|
+
};
|
|
7
|
+
export type PickMultipleFn = <T extends object, K extends string>(obj: T, targets: TargetsType<T, K>) => PickMultipleResult<T, K>;
|
|
8
|
+
/** T 或 Promise<T> */
|
|
9
|
+
export type MaybePromise<T> = T | Promise<T>;
|
|
10
|
+
/**
|
|
11
|
+
* 表单字段默认值:静态值 | Promise | 同步/异步工厂函数
|
|
12
|
+
* 解析后的结果类型为 T
|
|
13
|
+
*/
|
|
14
|
+
export type DefaultValueType<T> = MaybePromise<T> | (() => MaybePromise<T>);
|
|
15
|
+
/** 默认校验文案:enter=请输入,select=请选择 */
|
|
16
|
+
export type CreateFormRulesPrompt = 'enter' | 'select';
|
|
17
|
+
export type CreateFormRulesField = {
|
|
18
|
+
name: string;
|
|
19
|
+
/** `string` / `boolean` 不生成 type 约束;其余 type 与 len/max/min/pattern 另生成约束规则 */
|
|
20
|
+
type?: 'string' | 'number' | 'boolean' | 'array' | 'url' | 'email' | 'date' | 'hex';
|
|
21
|
+
/** 必填文案类型;未传则不生成 message */
|
|
22
|
+
prompt?: CreateFormRulesPrompt;
|
|
23
|
+
label?: string;
|
|
24
|
+
len?: number;
|
|
25
|
+
max?: number;
|
|
26
|
+
min?: number;
|
|
27
|
+
pattern?: RegExp;
|
|
28
|
+
trigger?: 'blur' | 'change';
|
|
29
|
+
};
|
|
30
|
+
export type CreateFormRulesOptions = Array<string | CreateFormRulesField>;
|
|
31
|
+
export type FormRule = Rule;
|
|
32
|
+
export type FormRules = Record<string, Rule[]>;
|