@vunk/form 2.17.2 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/components/date-picker-range/index.cjs +10 -3
  2. package/components/date-picker-range/index.mjs +10 -3
  3. package/components/date-picker-range/src/ctx.d.ts +2 -2
  4. package/components/date-picker-range/src/index.vue.d.ts +8 -5
  5. package/components/dialog-input-collection/index.cjs +55 -33
  6. package/components/dialog-input-collection/index.mjs +48 -26
  7. package/components/dialog-input-collection/src/dialog-form.vue.d.ts +1 -0
  8. package/components/dialog-input-collection/src/index.vue.d.ts +2 -0
  9. package/components/download-plus/index.cjs +24 -13
  10. package/components/download-plus/index.mjs +25 -14
  11. package/components/download-plus/src/index.vue.d.ts +1 -0
  12. package/components/esri-input-geojson/index.cjs +12 -7
  13. package/components/esri-input-geojson/index.mjs +12 -7
  14. package/components/esri-input-geojson/src/ctx.d.ts +1 -1
  15. package/components/esri-input-geojson/src/index.vue.d.ts +4 -3
  16. package/components/form-item/index.cjs +17 -14
  17. package/components/form-item/index.mjs +18 -15
  18. package/components/input-collection/index.cjs +11 -6
  19. package/components/input-collection/index.mjs +6 -1
  20. package/components/input-collection/src/core.vue.d.ts +1 -0
  21. package/components/input-link/index.cjs +19 -9
  22. package/components/input-link/index.mjs +16 -6
  23. package/components/input-link/src/ctx.d.ts +3 -3
  24. package/components/input-link/src/index.vue.d.ts +9 -6
  25. package/components/radio/src/index.vue.d.ts +2 -2
  26. package/components/radio/src/option.vue.d.ts +1 -1
  27. package/components/radio/src/wraper.vue.d.ts +1 -1
  28. package/components/tables-select/index.cjs +6 -3
  29. package/components/tables-select/index.mjs +6 -3
  30. package/components/tables-select/src/index.vue.d.ts +1 -0
  31. package/components/upload/index.cjs +39 -26
  32. package/components/upload/index.mjs +38 -25
  33. package/components/upload/src/ctx.d.ts +1 -1
  34. package/components/upload/src/file.vue.d.ts +4 -3
  35. package/components/upload/src/index.vue.d.ts +7 -5
  36. package/components/upload/src/wraper.vue.d.ts +2 -2
  37. package/components/upload-plus/index.cjs +56 -37
  38. package/components/upload-plus/index.mjs +57 -38
  39. package/components/upload-plus/src/index.vue.d.ts +1 -0
  40. package/components/var-datetime-picker/index.cjs +18 -15
  41. package/components/var-datetime-picker/index.mjs +18 -15
  42. package/components/var-datetime-picker/src/index.vue.d.ts +1 -0
  43. package/composables/element-plus/index.cjs +23 -0
  44. package/composables/element-plus/index.d.ts +1 -0
  45. package/composables/element-plus/index.mjs +21 -0
  46. package/composables/element-plus/useLocale.d.ts +8 -0
  47. package/index.d.ts +1 -0
  48. package/index.esm.js +1 -0
  49. package/locale/index.cjs +110 -0
  50. package/locale/index.d.ts +2 -0
  51. package/locale/index.mjs +107 -0
  52. package/locale/lang/en.d.ts +53 -0
  53. package/locale/lang/index.cjs +2 -0
  54. package/locale/lang/index.d.ts +0 -0
  55. package/locale/lang/index.mjs +1 -0
  56. package/locale/lang/zh-cn.d.ts +53 -0
  57. package/package.json +16 -1
@@ -0,0 +1,21 @@
1
+ import { useLocale as useLocale$1 } from 'element-plus';
2
+
3
+ const translateFallback = (fallback, option) => {
4
+ return fallback.replace(
5
+ /\{(\w+)\}/g,
6
+ (_, key) => `${option?.[key] ?? `{${key}}`}`
7
+ );
8
+ };
9
+ const useLocale = (localeOverrides) => {
10
+ const locale = useLocale$1(localeOverrides);
11
+ const tr = (path, fallback, option) => {
12
+ const value = locale.t(path, option);
13
+ return value === path ? translateFallback(fallback, option) : value;
14
+ };
15
+ return {
16
+ ...locale,
17
+ tr
18
+ };
19
+ };
20
+
21
+ export { useLocale };
@@ -0,0 +1,8 @@
1
+ import type { LocaleContext, TranslatorOption } from 'element-plus/es/hooks/use-locale';
2
+ import type { Language } from 'element-plus/es/locale';
3
+ import type { Ref } from 'vue';
4
+ export type TranslateWithFallback = (path: string, fallback: string, option?: TranslatorOption) => string;
5
+ export type LocaleContextWithFallback = LocaleContext & {
6
+ tr: TranslateWithFallback;
7
+ };
8
+ export declare const useLocale: (localeOverrides?: Ref<Language | undefined>) => LocaleContextWithFallback;
package/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare const install: (app: import("vue").App) => void;
3
3
  export default installer;
4
4
  export * from '@vunk/form/shared';
5
5
  export * from '@vunk/form/composables';
6
+ export * from '@vunk/form/locale';
6
7
  export * from '@vunk/form/components/form-item-renderer';
7
8
  export * from '@vunk/form/components/form-item-renderer-template';
8
9
  export * from '@vunk/form/components/templates-default';
package/index.esm.js CHANGED
@@ -8,6 +8,7 @@ import { VkfTemplatesLayout } from '@vunk/form/components/templates-layout';
8
8
  export * from '@vunk/form/components/templates-layout';
9
9
  export * from '@vunk/form/shared';
10
10
  export * from '@vunk/form/composables';
11
+ export * from '@vunk/form/locale';
11
12
  export * from '@vunk/form/components/templates-default';
12
13
  export * from '@vunk/form/components/form-item';
13
14
  export * from '@vunk/form/components/input';
@@ -0,0 +1,110 @@
1
+ 'use strict';
2
+
3
+ const en = {
4
+ vkf: {
5
+ common: {
6
+ operations: "Operations",
7
+ pause: "Pause",
8
+ upload: "Upload",
9
+ download: "Download"
10
+ },
11
+ dialogInputCollection: {
12
+ operations: "Operations",
13
+ add: "Add",
14
+ deleteConfirm: "Delete this item?"
15
+ },
16
+ downloadPlus: {
17
+ unknownFile: "Unknown file",
18
+ downloadFailed: "Download failed"
19
+ },
20
+ esriInputGeojson: {
21
+ dialogEditTitle: "Draw feature",
22
+ saveSuccess: "Saved successfully",
23
+ uploadSuccess: "Uploaded successfully"
24
+ },
25
+ formItem: {
26
+ defaultField: "This field",
27
+ required: "{label} is required",
28
+ pattern: "Enter {label}: {pattern}"
29
+ },
30
+ inputCollection: {
31
+ operations: "Operations"
32
+ },
33
+ inputLink: {
34
+ label: "Backfill URL",
35
+ placeholder: "Paste the file download URL here after uploading",
36
+ referenceLabel: "Reference URL",
37
+ invalidUrl: "Please enter a valid URL"
38
+ },
39
+ upload: {
40
+ selectFile: "Select file",
41
+ empty: "No file",
42
+ exceedConfirm: "The file limit has been exceeded. Replace existing files with the new files?",
43
+ download: "Download"
44
+ },
45
+ uploadPlus: {
46
+ selectFile: "Select file",
47
+ uploadSuccess: "Uploaded successfully",
48
+ uploadFailed: "Upload failed",
49
+ merge: "Merge",
50
+ mergeFailed: "Merge failed",
51
+ uploaded: "Uploaded"
52
+ }
53
+ }
54
+ };
55
+
56
+ const zhCn = {
57
+ vkf: {
58
+ common: {
59
+ operations: "\u64CD\u4F5C",
60
+ pause: "\u6682\u505C",
61
+ upload: "\u4E0A\u4F20",
62
+ download: "\u4E0B\u8F7D"
63
+ },
64
+ dialogInputCollection: {
65
+ operations: "\u64CD\u4F5C",
66
+ add: "\u6DFB\u52A0",
67
+ deleteConfirm: "\u786E\u5B9A\u5220\u9664\u5417\uFF1F"
68
+ },
69
+ downloadPlus: {
70
+ unknownFile: "\u672A\u77E5\u6587\u4EF6",
71
+ downloadFailed: "\u4E0B\u8F7D\u5931\u8D25"
72
+ },
73
+ esriInputGeojson: {
74
+ dialogEditTitle: "\u7ED8\u5236\u56FE\u6591",
75
+ saveSuccess: "\u4FDD\u5B58\u6210\u529F",
76
+ uploadSuccess: "\u4E0A\u4F20\u6210\u529F"
77
+ },
78
+ formItem: {
79
+ defaultField: "\u8BE5\u5B57\u6BB5",
80
+ required: "{label}\u4E0D\u80FD\u4E3A\u7A7A",
81
+ pattern: "\u8F93\u5165 {label} {pattern}"
82
+ },
83
+ inputCollection: {
84
+ operations: "\u64CD\u4F5C"
85
+ },
86
+ inputLink: {
87
+ label: "\u56DE\u586B\u5730\u5740",
88
+ placeholder: "\u4E0A\u4F20\u6587\u4EF6\u540E, \u5C06\u6587\u4EF6\u4E0B\u8F7D\u5730\u5740\u7C98\u8D34\u5230\u6B64\u5904",
89
+ referenceLabel: "\u53C2\u8003\u5730\u5740",
90
+ invalidUrl: "\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u94FE\u63A5\u5730\u5740"
91
+ },
92
+ upload: {
93
+ selectFile: "\u9009\u62E9\u6587\u4EF6",
94
+ empty: "\u6682\u65E0",
95
+ exceedConfirm: "\u5DF2\u8D85\u8FC7\u6700\u5927\u4E0A\u4F20\u6570\u91CF\u9650\u5236\uFF0C\u662F\u5426\u4F7F\u7528\u65B0\u6587\u4EF6\u91CD\u65B0\u4E0A\u4F20\uFF1F",
96
+ download: "\u4E0B\u8F7D"
97
+ },
98
+ uploadPlus: {
99
+ selectFile: "\u8BF7\u9009\u62E9\u6587\u4EF6",
100
+ uploadSuccess: "\u4E0A\u4F20\u6210\u529F",
101
+ uploadFailed: "\u4E0A\u4F20\u5931\u8D25",
102
+ merge: "\u5408\u5E76",
103
+ mergeFailed: "\u5408\u5E76\u5931\u8D25",
104
+ uploaded: "\u5DF2\u4F20"
105
+ }
106
+ }
107
+ };
108
+
109
+ exports.en = en;
110
+ exports.zhCn = zhCn;
@@ -0,0 +1,2 @@
1
+ export { default as en } from './lang/en';
2
+ export { default as zhCn } from './lang/zh-cn';
@@ -0,0 +1,107 @@
1
+ const en = {
2
+ vkf: {
3
+ common: {
4
+ operations: "Operations",
5
+ pause: "Pause",
6
+ upload: "Upload",
7
+ download: "Download"
8
+ },
9
+ dialogInputCollection: {
10
+ operations: "Operations",
11
+ add: "Add",
12
+ deleteConfirm: "Delete this item?"
13
+ },
14
+ downloadPlus: {
15
+ unknownFile: "Unknown file",
16
+ downloadFailed: "Download failed"
17
+ },
18
+ esriInputGeojson: {
19
+ dialogEditTitle: "Draw feature",
20
+ saveSuccess: "Saved successfully",
21
+ uploadSuccess: "Uploaded successfully"
22
+ },
23
+ formItem: {
24
+ defaultField: "This field",
25
+ required: "{label} is required",
26
+ pattern: "Enter {label}: {pattern}"
27
+ },
28
+ inputCollection: {
29
+ operations: "Operations"
30
+ },
31
+ inputLink: {
32
+ label: "Backfill URL",
33
+ placeholder: "Paste the file download URL here after uploading",
34
+ referenceLabel: "Reference URL",
35
+ invalidUrl: "Please enter a valid URL"
36
+ },
37
+ upload: {
38
+ selectFile: "Select file",
39
+ empty: "No file",
40
+ exceedConfirm: "The file limit has been exceeded. Replace existing files with the new files?",
41
+ download: "Download"
42
+ },
43
+ uploadPlus: {
44
+ selectFile: "Select file",
45
+ uploadSuccess: "Uploaded successfully",
46
+ uploadFailed: "Upload failed",
47
+ merge: "Merge",
48
+ mergeFailed: "Merge failed",
49
+ uploaded: "Uploaded"
50
+ }
51
+ }
52
+ };
53
+
54
+ const zhCn = {
55
+ vkf: {
56
+ common: {
57
+ operations: "\u64CD\u4F5C",
58
+ pause: "\u6682\u505C",
59
+ upload: "\u4E0A\u4F20",
60
+ download: "\u4E0B\u8F7D"
61
+ },
62
+ dialogInputCollection: {
63
+ operations: "\u64CD\u4F5C",
64
+ add: "\u6DFB\u52A0",
65
+ deleteConfirm: "\u786E\u5B9A\u5220\u9664\u5417\uFF1F"
66
+ },
67
+ downloadPlus: {
68
+ unknownFile: "\u672A\u77E5\u6587\u4EF6",
69
+ downloadFailed: "\u4E0B\u8F7D\u5931\u8D25"
70
+ },
71
+ esriInputGeojson: {
72
+ dialogEditTitle: "\u7ED8\u5236\u56FE\u6591",
73
+ saveSuccess: "\u4FDD\u5B58\u6210\u529F",
74
+ uploadSuccess: "\u4E0A\u4F20\u6210\u529F"
75
+ },
76
+ formItem: {
77
+ defaultField: "\u8BE5\u5B57\u6BB5",
78
+ required: "{label}\u4E0D\u80FD\u4E3A\u7A7A",
79
+ pattern: "\u8F93\u5165 {label} {pattern}"
80
+ },
81
+ inputCollection: {
82
+ operations: "\u64CD\u4F5C"
83
+ },
84
+ inputLink: {
85
+ label: "\u56DE\u586B\u5730\u5740",
86
+ placeholder: "\u4E0A\u4F20\u6587\u4EF6\u540E, \u5C06\u6587\u4EF6\u4E0B\u8F7D\u5730\u5740\u7C98\u8D34\u5230\u6B64\u5904",
87
+ referenceLabel: "\u53C2\u8003\u5730\u5740",
88
+ invalidUrl: "\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u94FE\u63A5\u5730\u5740"
89
+ },
90
+ upload: {
91
+ selectFile: "\u9009\u62E9\u6587\u4EF6",
92
+ empty: "\u6682\u65E0",
93
+ exceedConfirm: "\u5DF2\u8D85\u8FC7\u6700\u5927\u4E0A\u4F20\u6570\u91CF\u9650\u5236\uFF0C\u662F\u5426\u4F7F\u7528\u65B0\u6587\u4EF6\u91CD\u65B0\u4E0A\u4F20\uFF1F",
94
+ download: "\u4E0B\u8F7D"
95
+ },
96
+ uploadPlus: {
97
+ selectFile: "\u8BF7\u9009\u62E9\u6587\u4EF6",
98
+ uploadSuccess: "\u4E0A\u4F20\u6210\u529F",
99
+ uploadFailed: "\u4E0A\u4F20\u5931\u8D25",
100
+ merge: "\u5408\u5E76",
101
+ mergeFailed: "\u5408\u5E76\u5931\u8D25",
102
+ uploaded: "\u5DF2\u4F20"
103
+ }
104
+ }
105
+ };
106
+
107
+ export { en, zhCn };
@@ -0,0 +1,53 @@
1
+ declare const en: {
2
+ vkf: {
3
+ common: {
4
+ operations: string;
5
+ pause: string;
6
+ upload: string;
7
+ download: string;
8
+ };
9
+ dialogInputCollection: {
10
+ operations: string;
11
+ add: string;
12
+ deleteConfirm: string;
13
+ };
14
+ downloadPlus: {
15
+ unknownFile: string;
16
+ downloadFailed: string;
17
+ };
18
+ esriInputGeojson: {
19
+ dialogEditTitle: string;
20
+ saveSuccess: string;
21
+ uploadSuccess: string;
22
+ };
23
+ formItem: {
24
+ defaultField: string;
25
+ required: string;
26
+ pattern: string;
27
+ };
28
+ inputCollection: {
29
+ operations: string;
30
+ };
31
+ inputLink: {
32
+ label: string;
33
+ placeholder: string;
34
+ referenceLabel: string;
35
+ invalidUrl: string;
36
+ };
37
+ upload: {
38
+ selectFile: string;
39
+ empty: string;
40
+ exceedConfirm: string;
41
+ download: string;
42
+ };
43
+ uploadPlus: {
44
+ selectFile: string;
45
+ uploadSuccess: string;
46
+ uploadFailed: string;
47
+ merge: string;
48
+ mergeFailed: string;
49
+ uploaded: string;
50
+ };
51
+ };
52
+ };
53
+ export default en;
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
File without changes
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,53 @@
1
+ declare const zhCn: {
2
+ vkf: {
3
+ common: {
4
+ operations: string;
5
+ pause: string;
6
+ upload: string;
7
+ download: string;
8
+ };
9
+ dialogInputCollection: {
10
+ operations: string;
11
+ add: string;
12
+ deleteConfirm: string;
13
+ };
14
+ downloadPlus: {
15
+ unknownFile: string;
16
+ downloadFailed: string;
17
+ };
18
+ esriInputGeojson: {
19
+ dialogEditTitle: string;
20
+ saveSuccess: string;
21
+ uploadSuccess: string;
22
+ };
23
+ formItem: {
24
+ defaultField: string;
25
+ required: string;
26
+ pattern: string;
27
+ };
28
+ inputCollection: {
29
+ operations: string;
30
+ };
31
+ inputLink: {
32
+ label: string;
33
+ placeholder: string;
34
+ referenceLabel: string;
35
+ invalidUrl: string;
36
+ };
37
+ upload: {
38
+ selectFile: string;
39
+ empty: string;
40
+ exceedConfirm: string;
41
+ download: string;
42
+ };
43
+ uploadPlus: {
44
+ selectFile: string;
45
+ uploadSuccess: string;
46
+ uploadFailed: string;
47
+ merge: string;
48
+ mergeFailed: string;
49
+ uploaded: string;
50
+ };
51
+ };
52
+ };
53
+ export default zhCn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/form",
3
- "version": "2.17.2",
3
+ "version": "2.18.0",
4
4
  "description": "",
5
5
  "main": "index.esm.js",
6
6
  "scripts": {
@@ -80,11 +80,26 @@
80
80
  "types": "./shared/const/index.d.ts",
81
81
  "require": "./shared/const/index.cjs"
82
82
  },
83
+ "./locale": {
84
+ "import": "./locale/index.mjs",
85
+ "types": "./locale/index.d.ts",
86
+ "require": "./locale/index.cjs"
87
+ },
88
+ "./locale/lang": {
89
+ "import": "./locale/lang/index.mjs",
90
+ "types": "./locale/lang/index.d.ts",
91
+ "require": "./locale/lang/index.cjs"
92
+ },
83
93
  "./composables": {
84
94
  "import": "./composables/index.mjs",
85
95
  "types": "./composables/index.d.ts",
86
96
  "require": "./composables/index.cjs"
87
97
  },
98
+ "./composables/element-plus": {
99
+ "import": "./composables/element-plus/index.mjs",
100
+ "types": "./composables/element-plus/index.d.ts",
101
+ "require": "./composables/element-plus/index.cjs"
102
+ },
88
103
  "./components": {
89
104
  "import": "./components/index.mjs",
90
105
  "types": "./components/index.d.ts",