@sybz-components/utils 1.0.10 → 1.0.12
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/base.cjs +2 -1
- package/dist/base.d.cts +6 -1
- package/dist/base.d.mts +6 -1
- package/dist/base.d.ts +6 -1
- package/dist/base.mjs +2 -1
- package/dist/codeStandard.cjs +108 -0
- package/dist/codeStandard.d.cts +17 -0
- package/dist/codeStandard.d.mts +17 -0
- package/dist/codeStandard.d.ts +17 -0
- package/dist/codeStandard.mjs +93 -0
- package/dist/confirmSemantic.d.cts +3 -1
- package/dist/confirmSemantic.d.mts +3 -1
- package/dist/confirmSemantic.d.ts +3 -1
- package/dist/format.cjs +2 -1
- package/dist/format.mjs +2 -1
- package/dist/http.cjs +20 -0
- package/dist/http.d.cts +66 -0
- package/dist/http.d.mts +66 -0
- package/dist/http.d.ts +66 -0
- package/dist/http.mjs +8 -0
- package/dist/index.cjs +12 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +3 -1
- package/dist/shared/{utils.V4Kpqes0.cjs → utils.-eWHeuS_.cjs} +134 -2
- package/dist/shared/{utils.JIlaBPw3.mjs → utils.S76wYqQ8.mjs} +129 -4
- package/dist/sybz-code-standard.cjs +119 -0
- package/dist/sybz-code-standard.d.cts +1 -0
- package/dist/sybz-code-standard.d.mts +1 -0
- package/dist/sybz-code-standard.d.ts +1 -0
- package/dist/sybz-code-standard.mjs +112 -0
- package/dist/theme.cjs +11 -0
- package/dist/theme.d.cts +12 -0
- package/dist/theme.d.mts +12 -0
- package/dist/theme.d.ts +12 -0
- package/dist/theme.mjs +8 -0
- package/dist/vite.cjs +8 -0
- package/dist/vite.d.cts +4 -1
- package/dist/vite.d.mts +4 -1
- package/dist/vite.d.ts +4 -1
- package/dist/vite.mjs +4 -0
- package/package.json +24 -2
package/dist/base.cjs
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
require('vue');
|
|
4
4
|
require('consola');
|
|
5
5
|
require('es-toolkit');
|
|
6
|
-
const format = require('./shared/utils.
|
|
6
|
+
const format = require('./shared/utils.-eWHeuS_.cjs');
|
|
7
7
|
require('./confirmSemantic.cjs');
|
|
8
8
|
require('element-plus');
|
|
9
|
+
require('axios');
|
|
9
10
|
require('./is.cjs');
|
|
10
11
|
|
|
11
12
|
|
package/dist/base.d.cts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { VNode, AppContext, Ref } from 'vue';
|
|
3
|
+
import { SybzComponentTheme } from './theme.cjs';
|
|
3
4
|
import { ConfirmVariant, ConfirmTarget } from './confirmSemantic.cjs';
|
|
4
5
|
import { MessageOptions, ElMessageBoxOptions, ElMessageBox } from 'element-plus';
|
|
6
|
+
import { CreateHttpOptions } from './http.cjs';
|
|
7
|
+
import 'axios';
|
|
5
8
|
|
|
6
9
|
type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
|
|
7
10
|
type StorageValue = unknown;
|
|
@@ -26,12 +29,14 @@ type MockValueOptionItem<T = any> = {
|
|
|
26
29
|
label: string;
|
|
27
30
|
value: T;
|
|
28
31
|
};
|
|
29
|
-
type UtilsTheme =
|
|
32
|
+
type UtilsTheme = SybzComponentTheme;
|
|
30
33
|
interface SybzUtilsConfig {
|
|
31
34
|
/**
|
|
32
35
|
* 工具函数的默认主题。
|
|
33
36
|
*/
|
|
34
37
|
theme?: UtilsTheme;
|
|
38
|
+
/** HTTP 客户端的全局配置,应用入口配置一次即可。 */
|
|
39
|
+
http?: CreateHttpOptions;
|
|
35
40
|
}
|
|
36
41
|
interface ToastOptions extends Partial<MessageOptions> {
|
|
37
42
|
/**
|
package/dist/base.d.mts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { VNode, AppContext, Ref } from 'vue';
|
|
3
|
+
import { SybzComponentTheme } from './theme.mjs';
|
|
3
4
|
import { ConfirmVariant, ConfirmTarget } from './confirmSemantic.mjs';
|
|
4
5
|
import { MessageOptions, ElMessageBoxOptions, ElMessageBox } from 'element-plus';
|
|
6
|
+
import { CreateHttpOptions } from './http.mjs';
|
|
7
|
+
import 'axios';
|
|
5
8
|
|
|
6
9
|
type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
|
|
7
10
|
type StorageValue = unknown;
|
|
@@ -26,12 +29,14 @@ type MockValueOptionItem<T = any> = {
|
|
|
26
29
|
label: string;
|
|
27
30
|
value: T;
|
|
28
31
|
};
|
|
29
|
-
type UtilsTheme =
|
|
32
|
+
type UtilsTheme = SybzComponentTheme;
|
|
30
33
|
interface SybzUtilsConfig {
|
|
31
34
|
/**
|
|
32
35
|
* 工具函数的默认主题。
|
|
33
36
|
*/
|
|
34
37
|
theme?: UtilsTheme;
|
|
38
|
+
/** HTTP 客户端的全局配置,应用入口配置一次即可。 */
|
|
39
|
+
http?: CreateHttpOptions;
|
|
35
40
|
}
|
|
36
41
|
interface ToastOptions extends Partial<MessageOptions> {
|
|
37
42
|
/**
|
package/dist/base.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { VNode, AppContext, Ref } from 'vue';
|
|
3
|
+
import { SybzComponentTheme } from './theme.js';
|
|
3
4
|
import { ConfirmVariant, ConfirmTarget } from './confirmSemantic.js';
|
|
4
5
|
import { MessageOptions, ElMessageBoxOptions, ElMessageBox } from 'element-plus';
|
|
6
|
+
import { CreateHttpOptions } from './http.js';
|
|
7
|
+
import 'axios';
|
|
5
8
|
|
|
6
9
|
type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
|
|
7
10
|
type StorageValue = unknown;
|
|
@@ -26,12 +29,14 @@ type MockValueOptionItem<T = any> = {
|
|
|
26
29
|
label: string;
|
|
27
30
|
value: T;
|
|
28
31
|
};
|
|
29
|
-
type UtilsTheme =
|
|
32
|
+
type UtilsTheme = SybzComponentTheme;
|
|
30
33
|
interface SybzUtilsConfig {
|
|
31
34
|
/**
|
|
32
35
|
* 工具函数的默认主题。
|
|
33
36
|
*/
|
|
34
37
|
theme?: UtilsTheme;
|
|
38
|
+
/** HTTP 客户端的全局配置,应用入口配置一次即可。 */
|
|
39
|
+
http?: CreateHttpOptions;
|
|
35
40
|
}
|
|
36
41
|
interface ToastOptions extends Partial<MessageOptions> {
|
|
37
42
|
/**
|
package/dist/base.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import 'vue';
|
|
2
2
|
import 'consola';
|
|
3
3
|
import 'es-toolkit';
|
|
4
|
-
export { $ as $toast, c as clearStorage, a as clone, b as configureUtils, d as confirm, e as copy, f as debounce, g as delay, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.
|
|
4
|
+
export { $ as $toast, c as clearStorage, a as clone, b as configureUtils, d as confirm, e as copy, f as debounce, g as delay, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.S76wYqQ8.mjs';
|
|
5
5
|
import './confirmSemantic.mjs';
|
|
6
6
|
import 'element-plus';
|
|
7
|
+
import 'axios';
|
|
7
8
|
import './is.mjs';
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const js = require('@eslint/js');
|
|
4
|
+
const tsPlugin = require('@typescript-eslint/eslint-plugin');
|
|
5
|
+
const tsParser = require('@typescript-eslint/parser');
|
|
6
|
+
const prettier = require('eslint-config-prettier');
|
|
7
|
+
const vue = require('eslint-plugin-vue');
|
|
8
|
+
const globals = require('globals');
|
|
9
|
+
const vueParser = require('vue-eslint-parser');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
12
|
+
|
|
13
|
+
const js__default = /*#__PURE__*/_interopDefaultCompat(js);
|
|
14
|
+
const tsPlugin__default = /*#__PURE__*/_interopDefaultCompat(tsPlugin);
|
|
15
|
+
const tsParser__default = /*#__PURE__*/_interopDefaultCompat(tsParser);
|
|
16
|
+
const prettier__default = /*#__PURE__*/_interopDefaultCompat(prettier);
|
|
17
|
+
const vue__default = /*#__PURE__*/_interopDefaultCompat(vue);
|
|
18
|
+
const globals__default = /*#__PURE__*/_interopDefaultCompat(globals);
|
|
19
|
+
const vueParser__default = /*#__PURE__*/_interopDefaultCompat(vueParser);
|
|
20
|
+
|
|
21
|
+
const sybzPrettierConfig = {
|
|
22
|
+
singleQuote: true,
|
|
23
|
+
semi: false,
|
|
24
|
+
trailingComma: "all",
|
|
25
|
+
printWidth: 120,
|
|
26
|
+
endOfLine: "lf",
|
|
27
|
+
htmlWhitespaceSensitivity: "ignore"
|
|
28
|
+
};
|
|
29
|
+
const sybzLintStagedConfig = {
|
|
30
|
+
"**/*.{js,jsx,ts,tsx,vue,mjs,cjs}": [
|
|
31
|
+
"sybz-code-standard prettier --write",
|
|
32
|
+
"sybz-code-standard eslint --fix --max-warnings=0"
|
|
33
|
+
],
|
|
34
|
+
"**/*.{css,scss,json,yaml,yml,html,md}": ["sybz-code-standard prettier --write"]
|
|
35
|
+
};
|
|
36
|
+
const baseEslintConfig = [
|
|
37
|
+
{
|
|
38
|
+
ignores: [
|
|
39
|
+
"node_modules/**",
|
|
40
|
+
"dist/**",
|
|
41
|
+
"dist-ssr/**",
|
|
42
|
+
"coverage/**",
|
|
43
|
+
"docs/.vitepress/cache/**",
|
|
44
|
+
"docs/.vitepress/dist/**",
|
|
45
|
+
"packages/*/dist/**",
|
|
46
|
+
".vitepress/**",
|
|
47
|
+
".codex-types-temp/**",
|
|
48
|
+
"*.tsbuildinfo",
|
|
49
|
+
"*.local"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
js__default.configs.recommended,
|
|
53
|
+
tsPlugin__default.configs["flat/base"],
|
|
54
|
+
...vue__default.configs["flat/recommended"],
|
|
55
|
+
{
|
|
56
|
+
files: ["**/*.{js,jsx,ts,tsx,cjs,mjs,vue}"],
|
|
57
|
+
languageOptions: {
|
|
58
|
+
ecmaVersion: "latest",
|
|
59
|
+
sourceType: "module",
|
|
60
|
+
globals: {
|
|
61
|
+
...globals__default.browser,
|
|
62
|
+
...globals__default.node,
|
|
63
|
+
...globals__default.es2021
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
rules: {
|
|
67
|
+
"no-console": "off",
|
|
68
|
+
"no-unused-vars": "off",
|
|
69
|
+
"vue/no-unused-vars": "off",
|
|
70
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
71
|
+
"vue/multi-word-component-names": "off",
|
|
72
|
+
"vue/no-template-shadow": "off",
|
|
73
|
+
"vue/attribute-hyphenation": ["warn", "always", { ignore: ["dangerouslyUseHTMLString"] }],
|
|
74
|
+
"vue/require-default-prop": "off"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
files: ["**/*.{ts,tsx,vue}"],
|
|
79
|
+
rules: {
|
|
80
|
+
"no-undef": "off",
|
|
81
|
+
"no-redeclare": "off"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
files: ["**/*.vue"],
|
|
86
|
+
languageOptions: {
|
|
87
|
+
parser: vueParser__default,
|
|
88
|
+
parserOptions: {
|
|
89
|
+
parser: tsParser__default,
|
|
90
|
+
ecmaVersion: "latest",
|
|
91
|
+
sourceType: "module",
|
|
92
|
+
ecmaFeatures: { jsx: true },
|
|
93
|
+
extraFileExtensions: [".vue"]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
];
|
|
98
|
+
const createSybzEslintConfig = (...extensions) => [
|
|
99
|
+
...baseEslintConfig,
|
|
100
|
+
...extensions,
|
|
101
|
+
prettier__default
|
|
102
|
+
];
|
|
103
|
+
const sybzEslintConfig = createSybzEslintConfig();
|
|
104
|
+
|
|
105
|
+
exports.createSybzEslintConfig = createSybzEslintConfig;
|
|
106
|
+
exports.sybzEslintConfig = sybzEslintConfig;
|
|
107
|
+
exports.sybzLintStagedConfig = sybzLintStagedConfig;
|
|
108
|
+
exports.sybzPrettierConfig = sybzPrettierConfig;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
import { Config } from 'prettier';
|
|
3
|
+
|
|
4
|
+
type SybzEslintConfig = Linter.Config;
|
|
5
|
+
/** 公司前端项目统一使用的 Prettier 配置。 */
|
|
6
|
+
declare const sybzPrettierConfig: Config;
|
|
7
|
+
/** 公司前端项目统一使用的 lint-staged 配置。 */
|
|
8
|
+
declare const sybzLintStagedConfig: Record<string, string[]>;
|
|
9
|
+
/**
|
|
10
|
+
* 创建公司统一的 ESLint flat config。项目级扩展会插入到 Prettier 兼容配置之前。
|
|
11
|
+
*/
|
|
12
|
+
declare const createSybzEslintConfig: (...extensions: Linter.Config[]) => Linter.Config[];
|
|
13
|
+
/** 公司前端项目默认的 ESLint flat config。 */
|
|
14
|
+
declare const sybzEslintConfig: SybzEslintConfig[];
|
|
15
|
+
|
|
16
|
+
export { createSybzEslintConfig, sybzEslintConfig, sybzLintStagedConfig, sybzPrettierConfig };
|
|
17
|
+
export type { SybzEslintConfig };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
import { Config } from 'prettier';
|
|
3
|
+
|
|
4
|
+
type SybzEslintConfig = Linter.Config;
|
|
5
|
+
/** 公司前端项目统一使用的 Prettier 配置。 */
|
|
6
|
+
declare const sybzPrettierConfig: Config;
|
|
7
|
+
/** 公司前端项目统一使用的 lint-staged 配置。 */
|
|
8
|
+
declare const sybzLintStagedConfig: Record<string, string[]>;
|
|
9
|
+
/**
|
|
10
|
+
* 创建公司统一的 ESLint flat config。项目级扩展会插入到 Prettier 兼容配置之前。
|
|
11
|
+
*/
|
|
12
|
+
declare const createSybzEslintConfig: (...extensions: Linter.Config[]) => Linter.Config[];
|
|
13
|
+
/** 公司前端项目默认的 ESLint flat config。 */
|
|
14
|
+
declare const sybzEslintConfig: SybzEslintConfig[];
|
|
15
|
+
|
|
16
|
+
export { createSybzEslintConfig, sybzEslintConfig, sybzLintStagedConfig, sybzPrettierConfig };
|
|
17
|
+
export type { SybzEslintConfig };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
import { Config } from 'prettier';
|
|
3
|
+
|
|
4
|
+
type SybzEslintConfig = Linter.Config;
|
|
5
|
+
/** 公司前端项目统一使用的 Prettier 配置。 */
|
|
6
|
+
declare const sybzPrettierConfig: Config;
|
|
7
|
+
/** 公司前端项目统一使用的 lint-staged 配置。 */
|
|
8
|
+
declare const sybzLintStagedConfig: Record<string, string[]>;
|
|
9
|
+
/**
|
|
10
|
+
* 创建公司统一的 ESLint flat config。项目级扩展会插入到 Prettier 兼容配置之前。
|
|
11
|
+
*/
|
|
12
|
+
declare const createSybzEslintConfig: (...extensions: Linter.Config[]) => Linter.Config[];
|
|
13
|
+
/** 公司前端项目默认的 ESLint flat config。 */
|
|
14
|
+
declare const sybzEslintConfig: SybzEslintConfig[];
|
|
15
|
+
|
|
16
|
+
export { createSybzEslintConfig, sybzEslintConfig, sybzLintStagedConfig, sybzPrettierConfig };
|
|
17
|
+
export type { SybzEslintConfig };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
3
|
+
import tsParser from '@typescript-eslint/parser';
|
|
4
|
+
import prettier from 'eslint-config-prettier';
|
|
5
|
+
import vue from 'eslint-plugin-vue';
|
|
6
|
+
import globals from 'globals';
|
|
7
|
+
import vueParser from 'vue-eslint-parser';
|
|
8
|
+
|
|
9
|
+
const sybzPrettierConfig = {
|
|
10
|
+
singleQuote: true,
|
|
11
|
+
semi: false,
|
|
12
|
+
trailingComma: "all",
|
|
13
|
+
printWidth: 120,
|
|
14
|
+
endOfLine: "lf",
|
|
15
|
+
htmlWhitespaceSensitivity: "ignore"
|
|
16
|
+
};
|
|
17
|
+
const sybzLintStagedConfig = {
|
|
18
|
+
"**/*.{js,jsx,ts,tsx,vue,mjs,cjs}": [
|
|
19
|
+
"sybz-code-standard prettier --write",
|
|
20
|
+
"sybz-code-standard eslint --fix --max-warnings=0"
|
|
21
|
+
],
|
|
22
|
+
"**/*.{css,scss,json,yaml,yml,html,md}": ["sybz-code-standard prettier --write"]
|
|
23
|
+
};
|
|
24
|
+
const baseEslintConfig = [
|
|
25
|
+
{
|
|
26
|
+
ignores: [
|
|
27
|
+
"node_modules/**",
|
|
28
|
+
"dist/**",
|
|
29
|
+
"dist-ssr/**",
|
|
30
|
+
"coverage/**",
|
|
31
|
+
"docs/.vitepress/cache/**",
|
|
32
|
+
"docs/.vitepress/dist/**",
|
|
33
|
+
"packages/*/dist/**",
|
|
34
|
+
".vitepress/**",
|
|
35
|
+
".codex-types-temp/**",
|
|
36
|
+
"*.tsbuildinfo",
|
|
37
|
+
"*.local"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
js.configs.recommended,
|
|
41
|
+
tsPlugin.configs["flat/base"],
|
|
42
|
+
...vue.configs["flat/recommended"],
|
|
43
|
+
{
|
|
44
|
+
files: ["**/*.{js,jsx,ts,tsx,cjs,mjs,vue}"],
|
|
45
|
+
languageOptions: {
|
|
46
|
+
ecmaVersion: "latest",
|
|
47
|
+
sourceType: "module",
|
|
48
|
+
globals: {
|
|
49
|
+
...globals.browser,
|
|
50
|
+
...globals.node,
|
|
51
|
+
...globals.es2021
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
rules: {
|
|
55
|
+
"no-console": "off",
|
|
56
|
+
"no-unused-vars": "off",
|
|
57
|
+
"vue/no-unused-vars": "off",
|
|
58
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
59
|
+
"vue/multi-word-component-names": "off",
|
|
60
|
+
"vue/no-template-shadow": "off",
|
|
61
|
+
"vue/attribute-hyphenation": ["warn", "always", { ignore: ["dangerouslyUseHTMLString"] }],
|
|
62
|
+
"vue/require-default-prop": "off"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
files: ["**/*.{ts,tsx,vue}"],
|
|
67
|
+
rules: {
|
|
68
|
+
"no-undef": "off",
|
|
69
|
+
"no-redeclare": "off"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
files: ["**/*.vue"],
|
|
74
|
+
languageOptions: {
|
|
75
|
+
parser: vueParser,
|
|
76
|
+
parserOptions: {
|
|
77
|
+
parser: tsParser,
|
|
78
|
+
ecmaVersion: "latest",
|
|
79
|
+
sourceType: "module",
|
|
80
|
+
ecmaFeatures: { jsx: true },
|
|
81
|
+
extraFileExtensions: [".vue"]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
];
|
|
86
|
+
const createSybzEslintConfig = (...extensions) => [
|
|
87
|
+
...baseEslintConfig,
|
|
88
|
+
...extensions,
|
|
89
|
+
prettier
|
|
90
|
+
];
|
|
91
|
+
const sybzEslintConfig = createSybzEslintConfig();
|
|
92
|
+
|
|
93
|
+
export { createSybzEslintConfig, sybzEslintConfig, sybzLintStagedConfig, sybzPrettierConfig };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { SybzComponentTheme } from './theme.cjs';
|
|
2
|
+
|
|
1
3
|
type ConfirmVariant = 'default' | 'delete' | 'warning';
|
|
2
4
|
type ConfirmTarget = string | number;
|
|
3
|
-
type ConfirmSemanticTheme =
|
|
5
|
+
type ConfirmSemanticTheme = SybzComponentTheme;
|
|
4
6
|
type ConfirmSemanticButtonType = 'default' | 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'text' | '';
|
|
5
7
|
interface ConfirmSemanticOptions {
|
|
6
8
|
variant?: ConfirmVariant;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { SybzComponentTheme } from './theme.mjs';
|
|
2
|
+
|
|
1
3
|
type ConfirmVariant = 'default' | 'delete' | 'warning';
|
|
2
4
|
type ConfirmTarget = string | number;
|
|
3
|
-
type ConfirmSemanticTheme =
|
|
5
|
+
type ConfirmSemanticTheme = SybzComponentTheme;
|
|
4
6
|
type ConfirmSemanticButtonType = 'default' | 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'text' | '';
|
|
5
7
|
interface ConfirmSemanticOptions {
|
|
6
8
|
variant?: ConfirmVariant;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { SybzComponentTheme } from './theme.js';
|
|
2
|
+
|
|
1
3
|
type ConfirmVariant = 'default' | 'delete' | 'warning';
|
|
2
4
|
type ConfirmTarget = string | number;
|
|
3
|
-
type ConfirmSemanticTheme =
|
|
5
|
+
type ConfirmSemanticTheme = SybzComponentTheme;
|
|
4
6
|
type ConfirmSemanticButtonType = 'default' | 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'text' | '';
|
|
5
7
|
interface ConfirmSemanticOptions {
|
|
6
8
|
variant?: ConfirmVariant;
|
package/dist/format.cjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const format = require('./shared/utils.
|
|
3
|
+
const format = require('./shared/utils.-eWHeuS_.cjs');
|
|
4
4
|
require('./is.cjs');
|
|
5
5
|
require('consola');
|
|
6
6
|
require('vue');
|
|
7
7
|
require('es-toolkit');
|
|
8
8
|
require('./confirmSemantic.cjs');
|
|
9
9
|
require('element-plus');
|
|
10
|
+
require('axios');
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
|
package/dist/format.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed } from './shared/utils.
|
|
1
|
+
export { z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed } from './shared/utils.S76wYqQ8.mjs';
|
|
2
2
|
import './is.mjs';
|
|
3
3
|
import 'consola';
|
|
4
4
|
import 'vue';
|
|
5
5
|
import 'es-toolkit';
|
|
6
6
|
import './confirmSemantic.mjs';
|
|
7
7
|
import 'element-plus';
|
|
8
|
+
import 'axios';
|
package/dist/http.cjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('axios');
|
|
4
|
+
const format = require('./shared/utils.-eWHeuS_.cjs');
|
|
5
|
+
require('vue');
|
|
6
|
+
require('consola');
|
|
7
|
+
require('es-toolkit');
|
|
8
|
+
require('./confirmSemantic.cjs');
|
|
9
|
+
require('element-plus');
|
|
10
|
+
require('./is.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.HttpError = format.HttpError;
|
|
15
|
+
exports.configureHttp = format.configureHttp;
|
|
16
|
+
exports.createHttp = format.createHttp;
|
|
17
|
+
Object.defineProperty(exports, "http", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return format.http; }
|
|
20
|
+
});
|
package/dist/http.d.cts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { CreateAxiosDefaults, AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
2
|
+
|
|
3
|
+
interface HttpRequestConfig<D = unknown> extends AxiosRequestConfig<D> {
|
|
4
|
+
rawResponse?: boolean;
|
|
5
|
+
skipAuth?: boolean;
|
|
6
|
+
/** 是否显示当前请求的错误提示;默认继承全局配置。 */
|
|
7
|
+
showErrorToast?: boolean;
|
|
8
|
+
/** 当前请求的自定义错误文案。 */
|
|
9
|
+
message?: string | ((error: HttpError) => string);
|
|
10
|
+
}
|
|
11
|
+
declare class HttpError<T = unknown> extends Error {
|
|
12
|
+
readonly status?: number;
|
|
13
|
+
readonly code?: string;
|
|
14
|
+
readonly data?: T;
|
|
15
|
+
readonly cause?: unknown;
|
|
16
|
+
constructor(message: string, options?: {
|
|
17
|
+
status?: number;
|
|
18
|
+
code?: string;
|
|
19
|
+
data?: T;
|
|
20
|
+
cause?: unknown;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
interface CreateHttpOptions<D = unknown> extends CreateAxiosDefaults<D> {
|
|
24
|
+
/** 返回 false 时视为业务失败;默认仅识别 success === false。 */
|
|
25
|
+
isBusinessSuccess?: (data: unknown, response: AxiosResponse<D>) => boolean;
|
|
26
|
+
/** 从后端返回体提取业务错误文案。 */
|
|
27
|
+
getBusinessMessage?: (data: unknown, fallback: string) => string;
|
|
28
|
+
/** 统一转换响应体,适用于 { data: ... } 等包装格式。 */
|
|
29
|
+
transformResponseData?: (data: D, response: AxiosResponse<D>) => unknown;
|
|
30
|
+
/** 是否自动使用 $toast.error 提示错误;默认 `true`。 */
|
|
31
|
+
showErrorToast?: boolean;
|
|
32
|
+
toast?: (message: string) => void;
|
|
33
|
+
normalizeError?: (error: unknown) => HttpError;
|
|
34
|
+
/** 统一获取请求令牌。 */
|
|
35
|
+
getToken?: () => string | undefined | null;
|
|
36
|
+
/** 请求发出前的统一处理。 */
|
|
37
|
+
onRequest?: (config: HttpRequestConfig) => HttpRequestConfig | void;
|
|
38
|
+
/** 响应成功后的统一处理。 */
|
|
39
|
+
onResponse?: (response: AxiosResponse) => void;
|
|
40
|
+
/** 响应失败后的统一处理,例如 401 跳转登录。 */
|
|
41
|
+
onError?: (error: HttpError, response?: AxiosResponse) => void | Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
type HttpClient = Omit<AxiosInstance, 'get' | 'post' | 'put' | 'patch' | 'delete'> & {
|
|
44
|
+
<T = unknown, D = unknown>(url: string, config?: HttpRequestConfig<D>): Promise<T>;
|
|
45
|
+
<T = unknown, D = unknown>(url: string, params?: unknown, config?: HttpRequestConfig<D>): Promise<T>;
|
|
46
|
+
send<T = unknown, D = unknown>(config: HttpRequestConfig<D> & {
|
|
47
|
+
rawResponse: true;
|
|
48
|
+
}): Promise<AxiosResponse<T>>;
|
|
49
|
+
send<T = unknown, D = unknown>(config: HttpRequestConfig<D> & {
|
|
50
|
+
rawResponse?: false;
|
|
51
|
+
}): Promise<T>;
|
|
52
|
+
get<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T>;
|
|
53
|
+
get<T = unknown>(url: string, params?: unknown, config?: HttpRequestConfig): Promise<T>;
|
|
54
|
+
post<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
|
|
55
|
+
put<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
|
|
56
|
+
patch<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
|
|
57
|
+
delete<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T>;
|
|
58
|
+
download(url: string, params?: unknown, config?: HttpRequestConfig): Promise<Blob>;
|
|
59
|
+
};
|
|
60
|
+
declare function createHttp<D = unknown>(options?: CreateHttpOptions<D>): HttpClient;
|
|
61
|
+
/** 全局 HTTP 客户端;通过 configureUtils({ http: ... }) 配置一次。 */
|
|
62
|
+
declare let http: HttpClient;
|
|
63
|
+
declare function configureHttp(options?: CreateHttpOptions): HttpClient;
|
|
64
|
+
|
|
65
|
+
export { HttpError, configureHttp, createHttp, http };
|
|
66
|
+
export type { CreateHttpOptions, HttpClient, HttpRequestConfig };
|
package/dist/http.d.mts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { CreateAxiosDefaults, AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
2
|
+
|
|
3
|
+
interface HttpRequestConfig<D = unknown> extends AxiosRequestConfig<D> {
|
|
4
|
+
rawResponse?: boolean;
|
|
5
|
+
skipAuth?: boolean;
|
|
6
|
+
/** 是否显示当前请求的错误提示;默认继承全局配置。 */
|
|
7
|
+
showErrorToast?: boolean;
|
|
8
|
+
/** 当前请求的自定义错误文案。 */
|
|
9
|
+
message?: string | ((error: HttpError) => string);
|
|
10
|
+
}
|
|
11
|
+
declare class HttpError<T = unknown> extends Error {
|
|
12
|
+
readonly status?: number;
|
|
13
|
+
readonly code?: string;
|
|
14
|
+
readonly data?: T;
|
|
15
|
+
readonly cause?: unknown;
|
|
16
|
+
constructor(message: string, options?: {
|
|
17
|
+
status?: number;
|
|
18
|
+
code?: string;
|
|
19
|
+
data?: T;
|
|
20
|
+
cause?: unknown;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
interface CreateHttpOptions<D = unknown> extends CreateAxiosDefaults<D> {
|
|
24
|
+
/** 返回 false 时视为业务失败;默认仅识别 success === false。 */
|
|
25
|
+
isBusinessSuccess?: (data: unknown, response: AxiosResponse<D>) => boolean;
|
|
26
|
+
/** 从后端返回体提取业务错误文案。 */
|
|
27
|
+
getBusinessMessage?: (data: unknown, fallback: string) => string;
|
|
28
|
+
/** 统一转换响应体,适用于 { data: ... } 等包装格式。 */
|
|
29
|
+
transformResponseData?: (data: D, response: AxiosResponse<D>) => unknown;
|
|
30
|
+
/** 是否自动使用 $toast.error 提示错误;默认 `true`。 */
|
|
31
|
+
showErrorToast?: boolean;
|
|
32
|
+
toast?: (message: string) => void;
|
|
33
|
+
normalizeError?: (error: unknown) => HttpError;
|
|
34
|
+
/** 统一获取请求令牌。 */
|
|
35
|
+
getToken?: () => string | undefined | null;
|
|
36
|
+
/** 请求发出前的统一处理。 */
|
|
37
|
+
onRequest?: (config: HttpRequestConfig) => HttpRequestConfig | void;
|
|
38
|
+
/** 响应成功后的统一处理。 */
|
|
39
|
+
onResponse?: (response: AxiosResponse) => void;
|
|
40
|
+
/** 响应失败后的统一处理,例如 401 跳转登录。 */
|
|
41
|
+
onError?: (error: HttpError, response?: AxiosResponse) => void | Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
type HttpClient = Omit<AxiosInstance, 'get' | 'post' | 'put' | 'patch' | 'delete'> & {
|
|
44
|
+
<T = unknown, D = unknown>(url: string, config?: HttpRequestConfig<D>): Promise<T>;
|
|
45
|
+
<T = unknown, D = unknown>(url: string, params?: unknown, config?: HttpRequestConfig<D>): Promise<T>;
|
|
46
|
+
send<T = unknown, D = unknown>(config: HttpRequestConfig<D> & {
|
|
47
|
+
rawResponse: true;
|
|
48
|
+
}): Promise<AxiosResponse<T>>;
|
|
49
|
+
send<T = unknown, D = unknown>(config: HttpRequestConfig<D> & {
|
|
50
|
+
rawResponse?: false;
|
|
51
|
+
}): Promise<T>;
|
|
52
|
+
get<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T>;
|
|
53
|
+
get<T = unknown>(url: string, params?: unknown, config?: HttpRequestConfig): Promise<T>;
|
|
54
|
+
post<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
|
|
55
|
+
put<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
|
|
56
|
+
patch<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
|
|
57
|
+
delete<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T>;
|
|
58
|
+
download(url: string, params?: unknown, config?: HttpRequestConfig): Promise<Blob>;
|
|
59
|
+
};
|
|
60
|
+
declare function createHttp<D = unknown>(options?: CreateHttpOptions<D>): HttpClient;
|
|
61
|
+
/** 全局 HTTP 客户端;通过 configureUtils({ http: ... }) 配置一次。 */
|
|
62
|
+
declare let http: HttpClient;
|
|
63
|
+
declare function configureHttp(options?: CreateHttpOptions): HttpClient;
|
|
64
|
+
|
|
65
|
+
export { HttpError, configureHttp, createHttp, http };
|
|
66
|
+
export type { CreateHttpOptions, HttpClient, HttpRequestConfig };
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { CreateAxiosDefaults, AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
2
|
+
|
|
3
|
+
interface HttpRequestConfig<D = unknown> extends AxiosRequestConfig<D> {
|
|
4
|
+
rawResponse?: boolean;
|
|
5
|
+
skipAuth?: boolean;
|
|
6
|
+
/** 是否显示当前请求的错误提示;默认继承全局配置。 */
|
|
7
|
+
showErrorToast?: boolean;
|
|
8
|
+
/** 当前请求的自定义错误文案。 */
|
|
9
|
+
message?: string | ((error: HttpError) => string);
|
|
10
|
+
}
|
|
11
|
+
declare class HttpError<T = unknown> extends Error {
|
|
12
|
+
readonly status?: number;
|
|
13
|
+
readonly code?: string;
|
|
14
|
+
readonly data?: T;
|
|
15
|
+
readonly cause?: unknown;
|
|
16
|
+
constructor(message: string, options?: {
|
|
17
|
+
status?: number;
|
|
18
|
+
code?: string;
|
|
19
|
+
data?: T;
|
|
20
|
+
cause?: unknown;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
interface CreateHttpOptions<D = unknown> extends CreateAxiosDefaults<D> {
|
|
24
|
+
/** 返回 false 时视为业务失败;默认仅识别 success === false。 */
|
|
25
|
+
isBusinessSuccess?: (data: unknown, response: AxiosResponse<D>) => boolean;
|
|
26
|
+
/** 从后端返回体提取业务错误文案。 */
|
|
27
|
+
getBusinessMessage?: (data: unknown, fallback: string) => string;
|
|
28
|
+
/** 统一转换响应体,适用于 { data: ... } 等包装格式。 */
|
|
29
|
+
transformResponseData?: (data: D, response: AxiosResponse<D>) => unknown;
|
|
30
|
+
/** 是否自动使用 $toast.error 提示错误;默认 `true`。 */
|
|
31
|
+
showErrorToast?: boolean;
|
|
32
|
+
toast?: (message: string) => void;
|
|
33
|
+
normalizeError?: (error: unknown) => HttpError;
|
|
34
|
+
/** 统一获取请求令牌。 */
|
|
35
|
+
getToken?: () => string | undefined | null;
|
|
36
|
+
/** 请求发出前的统一处理。 */
|
|
37
|
+
onRequest?: (config: HttpRequestConfig) => HttpRequestConfig | void;
|
|
38
|
+
/** 响应成功后的统一处理。 */
|
|
39
|
+
onResponse?: (response: AxiosResponse) => void;
|
|
40
|
+
/** 响应失败后的统一处理,例如 401 跳转登录。 */
|
|
41
|
+
onError?: (error: HttpError, response?: AxiosResponse) => void | Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
type HttpClient = Omit<AxiosInstance, 'get' | 'post' | 'put' | 'patch' | 'delete'> & {
|
|
44
|
+
<T = unknown, D = unknown>(url: string, config?: HttpRequestConfig<D>): Promise<T>;
|
|
45
|
+
<T = unknown, D = unknown>(url: string, params?: unknown, config?: HttpRequestConfig<D>): Promise<T>;
|
|
46
|
+
send<T = unknown, D = unknown>(config: HttpRequestConfig<D> & {
|
|
47
|
+
rawResponse: true;
|
|
48
|
+
}): Promise<AxiosResponse<T>>;
|
|
49
|
+
send<T = unknown, D = unknown>(config: HttpRequestConfig<D> & {
|
|
50
|
+
rawResponse?: false;
|
|
51
|
+
}): Promise<T>;
|
|
52
|
+
get<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T>;
|
|
53
|
+
get<T = unknown>(url: string, params?: unknown, config?: HttpRequestConfig): Promise<T>;
|
|
54
|
+
post<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
|
|
55
|
+
put<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
|
|
56
|
+
patch<T = unknown, D = unknown>(url: string, data?: D, config?: HttpRequestConfig<D>): Promise<T>;
|
|
57
|
+
delete<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T>;
|
|
58
|
+
download(url: string, params?: unknown, config?: HttpRequestConfig): Promise<Blob>;
|
|
59
|
+
};
|
|
60
|
+
declare function createHttp<D = unknown>(options?: CreateHttpOptions<D>): HttpClient;
|
|
61
|
+
/** 全局 HTTP 客户端;通过 configureUtils({ http: ... }) 配置一次。 */
|
|
62
|
+
declare let http: HttpClient;
|
|
63
|
+
declare function configureHttp(options?: CreateHttpOptions): HttpClient;
|
|
64
|
+
|
|
65
|
+
export { HttpError, configureHttp, createHttp, http };
|
|
66
|
+
export type { CreateHttpOptions, HttpClient, HttpRequestConfig };
|
package/dist/http.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import 'axios';
|
|
2
|
+
export { H as HttpError, G as configureHttp, I as createHttp, J as http } from './shared/utils.S76wYqQ8.mjs';
|
|
3
|
+
import 'vue';
|
|
4
|
+
import 'consola';
|
|
5
|
+
import 'es-toolkit';
|
|
6
|
+
import './confirmSemantic.mjs';
|
|
7
|
+
import 'element-plus';
|
|
8
|
+
import './is.mjs';
|