@stephenchenorg/astro 8.2.0 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/{index.js → index.mjs} +1 -2
- package/dist/form-validator/{index.d.ts → index.d.mts} +13 -13
- package/dist/pagination-vue-client-side/{index.d.ts → index.d.mts} +7 -7
- package/dist/query-params/{index.d.ts → index.d.mts} +6 -2
- package/dist/query-params/{index.js → index.mjs} +6 -4
- package/package.json +33 -33
- /package/dist/api/{index.d.ts → index.d.mts} +0 -0
- /package/dist/company-setting/{index.d.ts → index.d.mts} +0 -0
- /package/dist/company-setting/{index.js → index.mjs} +0 -0
- /package/dist/form-validator/{index.js → index.mjs} +0 -0
- /package/dist/image/{index.d.ts → index.d.mts} +0 -0
- /package/dist/image/{index.js → index.mjs} +0 -0
- /package/dist/page/{index.d.ts → index.d.mts} +0 -0
- /package/dist/page/{index.js → index.mjs} +0 -0
- /package/dist/pagination-astro/{index.d.ts → index.d.mts} +0 -0
- /package/dist/pagination-astro/{index.js → index.mjs} +0 -0
- /package/dist/pagination-vue-client-side/{index.js → index.mjs} +0 -0
- /package/dist/pagination-vue-server-side/{index.d.ts → index.d.mts} +0 -0
- /package/dist/pagination-vue-server-side/{index.js → index.mjs} +0 -0
|
@@ -117,8 +117,7 @@ function createGraphQLAPI(globalOptions) {
|
|
|
117
117
|
}
|
|
118
118
|
}).then((data) => resolve(data)).catch((error) => {
|
|
119
119
|
if (error instanceof GraphQLRequestError$1) {
|
|
120
|
-
const
|
|
121
|
-
const code = fieldError?.code;
|
|
120
|
+
const code = (error.fieldErrors?.[0])?.code;
|
|
122
121
|
const errorProps = {
|
|
123
122
|
code,
|
|
124
123
|
message: error.message,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue9 from "vue";
|
|
2
2
|
import { PropType, SlotsType } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/form-validator/types.d.ts
|
|
5
5
|
type FormErrors = Record<string, string[]>;
|
|
6
|
-
interface FormRule {
|
|
7
|
-
validate: (value:
|
|
6
|
+
interface FormRule<T = any> {
|
|
7
|
+
validate: (value: T, form: Record<string, any>) => boolean;
|
|
8
8
|
message: string;
|
|
9
|
-
when?: (value:
|
|
9
|
+
when?: (value: T, form: Record<string, any>) => boolean;
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/form-validator/FormValidator.d.ts
|
|
@@ -23,7 +23,7 @@ declare class FormValidator {
|
|
|
23
23
|
}
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region src/form-validator/components/FormField.d.ts
|
|
26
|
-
declare const FormField:
|
|
26
|
+
declare const FormField: vue9.DefineComponent<vue9.ExtractPropTypes<{
|
|
27
27
|
id: {
|
|
28
28
|
type: StringConstructor;
|
|
29
29
|
required: true;
|
|
@@ -32,9 +32,9 @@ declare const FormField: vue25.DefineComponent<vue25.ExtractPropTypes<{
|
|
|
32
32
|
type: PropType<FormRule[]>;
|
|
33
33
|
default: () => never[];
|
|
34
34
|
};
|
|
35
|
-
}>, () =>
|
|
35
|
+
}>, () => vue9.VNode<vue9.RendererNode, vue9.RendererElement, {
|
|
36
36
|
[key: string]: any;
|
|
37
|
-
}>[], {}, {}, {},
|
|
37
|
+
}>[], {}, {}, {}, vue9.ComponentOptionsMixin, vue9.ComponentOptionsMixin, {}, string, vue9.PublicProps, Readonly<vue9.ExtractPropTypes<{
|
|
38
38
|
id: {
|
|
39
39
|
type: StringConstructor;
|
|
40
40
|
required: true;
|
|
@@ -44,25 +44,25 @@ declare const FormField: vue25.DefineComponent<vue25.ExtractPropTypes<{
|
|
|
44
44
|
default: () => never[];
|
|
45
45
|
};
|
|
46
46
|
}>> & Readonly<{}>, {
|
|
47
|
-
rules: FormRule[];
|
|
47
|
+
rules: FormRule<any>[];
|
|
48
48
|
}, SlotsType<{
|
|
49
49
|
default: {
|
|
50
50
|
error: string | null;
|
|
51
51
|
};
|
|
52
|
-
}>, {}, {}, string,
|
|
52
|
+
}>, {}, {}, string, vue9.ComponentProvideOptions, true, {}, any>;
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region src/form-validator/components/FormValidatorProvider.d.ts
|
|
55
55
|
interface FormValidatorProviderExposed {
|
|
56
56
|
formValidator: () => FormValidator;
|
|
57
57
|
}
|
|
58
|
-
declare const FormValidatorProvider:
|
|
58
|
+
declare const FormValidatorProvider: vue9.DefineComponent<vue9.ExtractPropTypes<{
|
|
59
59
|
errors: {
|
|
60
60
|
type: PropType<FormErrors>;
|
|
61
61
|
default: () => {};
|
|
62
62
|
};
|
|
63
|
-
}>, () =>
|
|
63
|
+
}>, () => vue9.VNode<vue9.RendererNode, vue9.RendererElement, {
|
|
64
64
|
[key: string]: any;
|
|
65
|
-
}>[], {}, {}, {},
|
|
65
|
+
}>[], {}, {}, {}, vue9.ComponentOptionsMixin, vue9.ComponentOptionsMixin, {}, string, vue9.PublicProps, Readonly<vue9.ExtractPropTypes<{
|
|
66
66
|
errors: {
|
|
67
67
|
type: PropType<FormErrors>;
|
|
68
68
|
default: () => {};
|
|
@@ -73,7 +73,7 @@ declare const FormValidatorProvider: vue25.DefineComponent<vue25.ExtractPropType
|
|
|
73
73
|
default: {
|
|
74
74
|
errors: FormErrors;
|
|
75
75
|
};
|
|
76
|
-
}>, {}, {}, string,
|
|
76
|
+
}>, {}, {}, string, vue9.ComponentProvideOptions, true, {}, any>;
|
|
77
77
|
//#endregion
|
|
78
78
|
//#region src/form-validator/useFormValidator.d.ts
|
|
79
79
|
declare function useFormValidator(): FormValidator;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue29 from "vue";
|
|
2
2
|
import { MaybeRefOrGetter } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/pagination-vue-client-side/types.d.ts
|
|
@@ -16,12 +16,12 @@ declare function usePagination(options: {
|
|
|
16
16
|
visiblePages?: MaybeRefOrGetter<number | undefined>;
|
|
17
17
|
onChange?: (page: number) => void;
|
|
18
18
|
}): {
|
|
19
|
-
items:
|
|
20
|
-
showPagination:
|
|
21
|
-
canFirst:
|
|
22
|
-
canPrev:
|
|
23
|
-
canNext:
|
|
24
|
-
canLast:
|
|
19
|
+
items: vue29.ComputedRef<number[]>;
|
|
20
|
+
showPagination: vue29.ComputedRef<boolean>;
|
|
21
|
+
canFirst: vue29.ComputedRef<boolean>;
|
|
22
|
+
canPrev: vue29.ComputedRef<boolean>;
|
|
23
|
+
canNext: vue29.ComputedRef<boolean>;
|
|
24
|
+
canLast: vue29.ComputedRef<boolean>;
|
|
25
25
|
gotoFirst: () => void;
|
|
26
26
|
gotoPrev: () => void;
|
|
27
27
|
gotoNext: () => void;
|
|
@@ -22,6 +22,7 @@ declare global {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
interface QueryParamsUrlOptions {
|
|
25
|
+
mergeArray?: string[];
|
|
25
26
|
clear?: boolean;
|
|
26
27
|
transformParams?: (params: Record<string, any>) => Record<string, any>;
|
|
27
28
|
}
|
|
@@ -29,7 +30,10 @@ declare function queryParamsUrl(additionalParams: Record<string, any>, urlConfig
|
|
|
29
30
|
declare function parseQueryParams(search: string): qs.ParsedQuery<string>;
|
|
30
31
|
//#endregion
|
|
31
32
|
//#region src/query-params/utils.d.ts
|
|
32
|
-
|
|
33
|
+
interface MergeUrlParamsOptions {
|
|
34
|
+
mergeArray?: string[];
|
|
35
|
+
}
|
|
36
|
+
declare function mergeUrlParams<Params extends Record<string, any> = Record<string, any>>(baseParams: Params, userParams: Partial<Params>, options?: MergeUrlParamsOptions): Params;
|
|
33
37
|
declare function cleanParams(params: Record<string, any>, defaultParams: Record<string, any>): Record<string, any>;
|
|
34
38
|
//#endregion
|
|
35
|
-
export { QueryParamsUrlOptions, UrlConfig, cleanParams, createUrlConfig, mergeUrlParams, parseQueryParams, queryParamsUrl, urlConfigStore };
|
|
39
|
+
export { MergeUrlParamsOptions, QueryParamsUrlOptions, UrlConfig, cleanParams, createUrlConfig, mergeUrlParams, parseQueryParams, queryParamsUrl, urlConfigStore };
|
|
@@ -17,10 +17,12 @@ const urlConfigStore = atom({
|
|
|
17
17
|
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/query-params/utils.ts
|
|
20
|
-
function mergeUrlParams(baseParams, userParams) {
|
|
20
|
+
function mergeUrlParams(baseParams, userParams, options = {}) {
|
|
21
|
+
const { mergeArray = [] } = options;
|
|
21
22
|
return Object.keys(baseParams).reduce((result, key) => {
|
|
22
23
|
if (userParams[key] === null) result[key] = null;
|
|
23
|
-
else if (Array.isArray(baseParams[key])) result[key] = Array.from(new Set([...baseParams[key], ...userParams[key] || []]));
|
|
24
|
+
else if (Array.isArray(baseParams[key])) if (mergeArray.includes(key)) result[key] = Array.from(new Set([...baseParams[key], ...userParams[key] || []]));
|
|
25
|
+
else result[key] = userParams[key] || baseParams[key] || [];
|
|
24
26
|
else result[key] = typeof userParams[key] !== "undefined" ? userParams[key] : baseParams[key];
|
|
25
27
|
return result;
|
|
26
28
|
}, {});
|
|
@@ -39,11 +41,11 @@ function queryParamsUrl(additionalParams, urlConfig = {
|
|
|
39
41
|
baseUrl: "",
|
|
40
42
|
params: {}
|
|
41
43
|
}, options = {}) {
|
|
42
|
-
const { clear = false, transformParams } = options;
|
|
44
|
+
const { mergeArray = [], clear = false, transformParams } = options;
|
|
43
45
|
const config = typeof window !== "undefined" ? urlConfigStore.get() : urlConfig;
|
|
44
46
|
let params = {};
|
|
45
47
|
if (!clear) {
|
|
46
|
-
params = mergeUrlParams(config.params, additionalParams);
|
|
48
|
+
params = mergeUrlParams(config.params, additionalParams, { mergeArray });
|
|
47
49
|
if (transformParams) params = transformParams(params);
|
|
48
50
|
params = cleanParams(params, config.defaultParams || {});
|
|
49
51
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stephenchenorg/astro",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.4.0",
|
|
5
5
|
"description": "Stephenchenorg Astro 前端通用套件",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://stephenchenorg-astro.netlify.app",
|
|
@@ -20,43 +20,43 @@
|
|
|
20
20
|
],
|
|
21
21
|
"exports": {
|
|
22
22
|
"./api": {
|
|
23
|
-
"types": "./dist/api/index.d.
|
|
24
|
-
"import": "./dist/api/index.
|
|
23
|
+
"types": "./dist/api/index.d.mts",
|
|
24
|
+
"import": "./dist/api/index.mjs"
|
|
25
25
|
},
|
|
26
26
|
"./company-setting": {
|
|
27
|
-
"types": "./dist/company-setting/index.d.
|
|
28
|
-
"import": "./dist/company-setting/index.
|
|
27
|
+
"types": "./dist/company-setting/index.d.mts",
|
|
28
|
+
"import": "./dist/company-setting/index.mjs"
|
|
29
29
|
},
|
|
30
30
|
"./form-validator": {
|
|
31
|
-
"types": "./dist/form-validator/index.d.
|
|
32
|
-
"import": "./dist/form-validator/index.
|
|
31
|
+
"types": "./dist/form-validator/index.d.mts",
|
|
32
|
+
"import": "./dist/form-validator/index.mjs"
|
|
33
33
|
},
|
|
34
34
|
"./image": {
|
|
35
|
-
"types": "./dist/image/index.d.
|
|
36
|
-
"import": "./dist/image/index.
|
|
35
|
+
"types": "./dist/image/index.d.mts",
|
|
36
|
+
"import": "./dist/image/index.mjs"
|
|
37
37
|
},
|
|
38
38
|
"./image/components/Image.astro": "./dist/image/components/Image.astro",
|
|
39
39
|
"./image/components/ResponsiveImage.astro": "./dist/image/components/ResponsiveImage.astro",
|
|
40
40
|
"./page": {
|
|
41
|
-
"types": "./dist/page/index.d.
|
|
42
|
-
"import": "./dist/page/index.
|
|
41
|
+
"types": "./dist/page/index.d.mts",
|
|
42
|
+
"import": "./dist/page/index.mjs"
|
|
43
43
|
},
|
|
44
44
|
"./page/components/PageFieldRender.astro": "./dist/page/components/PageFieldRender.astro",
|
|
45
45
|
"./pagination-astro": {
|
|
46
|
-
"types": "./dist/pagination-astro/index.d.
|
|
47
|
-
"import": "./dist/pagination-astro/index.
|
|
46
|
+
"types": "./dist/pagination-astro/index.d.mts",
|
|
47
|
+
"import": "./dist/pagination-astro/index.mjs"
|
|
48
48
|
},
|
|
49
49
|
"./pagination-vue-client-side": {
|
|
50
|
-
"types": "./dist/pagination-vue-client-side/index.d.
|
|
51
|
-
"import": "./dist/pagination-vue-client-side/index.
|
|
50
|
+
"types": "./dist/pagination-vue-client-side/index.d.mts",
|
|
51
|
+
"import": "./dist/pagination-vue-client-side/index.mjs"
|
|
52
52
|
},
|
|
53
53
|
"./pagination-vue-server-side": {
|
|
54
|
-
"types": "./dist/pagination-vue-server-side/index.d.
|
|
55
|
-
"import": "./dist/pagination-vue-server-side/index.
|
|
54
|
+
"types": "./dist/pagination-vue-server-side/index.d.mts",
|
|
55
|
+
"import": "./dist/pagination-vue-server-side/index.mjs"
|
|
56
56
|
},
|
|
57
57
|
"./query-params": {
|
|
58
|
-
"types": "./dist/query-params/index.d.
|
|
59
|
-
"import": "./dist/query-params/index.
|
|
58
|
+
"types": "./dist/query-params/index.d.mts",
|
|
59
|
+
"import": "./dist/query-params/index.mjs"
|
|
60
60
|
},
|
|
61
61
|
"./query-params/components/ProvideUrlConfig.astro": "./dist/query-params/components/ProvideUrlConfig.astro"
|
|
62
62
|
},
|
|
@@ -96,23 +96,23 @@
|
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
98
98
|
"awesome-graphql-client": "^2.1.0",
|
|
99
|
-
"graphql": "^16.
|
|
99
|
+
"graphql": "^16.12.0",
|
|
100
100
|
"graphql-tag": "^2.12.6",
|
|
101
101
|
"nanostores": "^1.0.1",
|
|
102
|
-
"query-string": "^9.
|
|
102
|
+
"query-string": "^9.3.1"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@astrojs/check": "^0.9.
|
|
106
|
-
"@astrojs/vue": "^5.1.
|
|
107
|
-
"@ycs77/eslint-config": "^
|
|
108
|
-
"astro": "^5.
|
|
109
|
-
"bumpp": "^10.
|
|
110
|
-
"eslint": "^9.
|
|
111
|
-
"eslint-plugin-astro": "^1.
|
|
112
|
-
"eslint-plugin-astro-explicit-wrapper": "^1.0.
|
|
113
|
-
"tsdown": "^0.
|
|
114
|
-
"typescript": "^5.9.
|
|
115
|
-
"vitest": "^
|
|
116
|
-
"vue": "^3.5.
|
|
105
|
+
"@astrojs/check": "^0.9.5",
|
|
106
|
+
"@astrojs/vue": "^5.1.3",
|
|
107
|
+
"@ycs77/eslint-config": "^6.0.0",
|
|
108
|
+
"astro": "^5.15.9",
|
|
109
|
+
"bumpp": "^10.3.1",
|
|
110
|
+
"eslint": "^9.39.1",
|
|
111
|
+
"eslint-plugin-astro": "^1.5.0",
|
|
112
|
+
"eslint-plugin-astro-explicit-wrapper": "^1.0.5",
|
|
113
|
+
"tsdown": "^0.16.5",
|
|
114
|
+
"typescript": "^5.9.3",
|
|
115
|
+
"vitest": "^4.0.10",
|
|
116
|
+
"vue": "^3.5.24"
|
|
117
117
|
}
|
|
118
118
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|