@skyfox2000/webui 1.6.14 → 1.6.16

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 (34) hide show
  1. package/lib/assets/modules/{baseLayout-C3MLMXao.js → baseLayout-BMmKe6uG.js} +3 -3
  2. package/lib/assets/modules/{file-upload-CUtR0hOH.js → file-upload-PgJYbXFi.js} +1 -1
  3. package/lib/assets/modules/{index-hkaalxUK.js → index-49mg7oK1.js} +2 -2
  4. package/lib/assets/modules/{index-DZBPuIFH.js → index-C1HOIrmy.js} +1 -1
  5. package/lib/assets/modules/{index-DnOFwC7U.js → index-Uwk0G5-g.js} +2 -2
  6. package/lib/assets/modules/{menuTabs-De95t73j.js → menuTabs-CFfCV8nu.js} +36 -36
  7. package/lib/assets/modules/{toolIcon-N4IrlKKJ.js → toolIcon-BQUcQlwr.js} +1 -1
  8. package/lib/assets/modules/{upload-template-BdldosL5.js → upload-template-BjZLQ1jo.js} +1101 -1098
  9. package/lib/assets/modules/{uploadList-DbCnFWuZ.js → uploadList-XdFuQYpu.js} +4 -4
  10. package/lib/es/AceEditor/index.js +3 -3
  11. package/lib/es/BasicLayout/index.js +2 -2
  12. package/lib/es/Error403/index.js +1 -1
  13. package/lib/es/Error404/index.js +1 -1
  14. package/lib/es/ExcelForm/index.js +52 -52
  15. package/lib/es/MenuLayout/index.js +2 -2
  16. package/lib/es/TemplateFile/index.js +4 -4
  17. package/lib/es/UploadForm/index.js +4 -4
  18. package/lib/locales/default.en-US.d.ts +1 -3
  19. package/lib/locales/default.zh-CN.d.ts +1 -3
  20. package/lib/webui.css +1 -1
  21. package/lib/webui.es.js +1300 -1297
  22. package/package.json +1 -1
  23. package/src/components/content/table/index.vue +3 -0
  24. package/src/components/form/input/index.vue +3 -3
  25. package/src/components/form/input/inputNumber.vue +2 -3
  26. package/src/components/form/input/inputPassword.vue +2 -3
  27. package/src/components/form/propEditor/index.vue +4 -6
  28. package/src/components/form/radio/index.vue +1 -1
  29. package/src/components/form/switch/index.vue +20 -8
  30. package/src/components/form/textarea/index.vue +2 -4
  31. package/src/components/form/timePicker/index.vue +2 -3
  32. package/src/components/form/upload/imageList.vue +7 -9
  33. package/src/locales/default.en-US.ts +4 -6
  34. package/src/locales/default.zh-CN.ts +4 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyfox2000/webui",
3
- "version": "1.6.14",
3
+ "version": "1.6.16",
4
4
  "description": "后台前端通用组件定义, 支持国际化",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -210,6 +210,9 @@ onMounted(async () => {
210
210
  :data-source="dataList" :loading="gridCtrl.isGridLoading.value" :columns="columns" :pagination="pagination"
211
211
  :row-selection="rowSelection" :scroll="props.scroll || { x: 700 }" :size="gridCtrl.tableSize.value" bordered
212
212
  v-bind="attrs">
213
+ <template #emptyText>
214
+ {{ $t('webui.common.noData') }}
215
+ </template>
213
216
  <template #bodyCell="bodyCell">
214
217
  <slot name="bodyCell" :column="bodyCell?.column" :record="bodyCell?.record"></slot>
215
218
  <template v-if="gridCtrl && bodyCell?.column?.dataIndex === 'enabled'">
@@ -2,8 +2,7 @@
2
2
  import { formValidate, useInputFactory } from '@/index';
3
3
  import { Input } from 'ant-design-vue';
4
4
  import { ref, watch, computed, useAttrs } from 'vue';
5
- import { useI18n } from 'vue-i18n';
6
- const { t } = useI18n();
5
+ import { $t } from '@/locales/index';
7
6
 
8
7
  const { editorCtrl, labelText, errInfo } = useInputFactory();
9
8
  const props = withDefaults(defineProps<{
@@ -76,7 +75,8 @@ const onClear = (e: any) => {
76
75
  errInfo?.errClass === 'error' && !$slots.addonBefore && !$slots.addonAfter
77
76
  ? '!border-red-300 shadow-[0_0_3px_0px_#ff4d4f]'
78
77
  : '',]" v-model:value="innerValue" autocomplete="new-password" :allow-clear="true"
79
- :placeholder="t('webui.common.placeholder', [labelText])" @blur="onBlur" @change="onClear" v-bind="filteredAttrs">
78
+ :placeholder="$t('webui.common.placeholder', [labelText])" @blur="onBlur" @change="onClear"
79
+ v-bind="filteredAttrs">
80
80
  <template #addonBefore v-if="$slots.addonBefore">
81
81
  <slot name="addonBefore"></slot>
82
82
  </template>
@@ -1,10 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  import { formValidate, useInputFactory } from '@/index';
3
3
  import { InputNumber } from 'ant-design-vue';
4
- import { useI18n } from 'vue-i18n';
4
+ import { $t } from '@/locales/index';
5
5
 
6
6
  const { editorCtrl, labelText, errInfo } = useInputFactory();
7
- const { t } = useI18n();
8
7
  const onBlur = () => {
9
8
  if (errInfo?.value.errClass && editorCtrl) {
10
9
  /// 重新开始验证
@@ -17,7 +16,7 @@ const onBlur = () => {
17
16
  :class="[errInfo?.errClass === 'error' ? 'error !border-red-300 shadow-[0_0_3px_0px_#ff4d4f]' : '']"
18
17
  @blur="onBlur"
19
18
  :allow-clear="false"
20
- :placeholder="t('webui.common.placeholder', [labelText])"
19
+ :placeholder="$t('webui.common.placeholder', [labelText])"
21
20
  class="w-[50%]"
22
21
  v-bind="$attrs"
23
22
  >
@@ -1,10 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  import { formValidate, useInputFactory } from '@/index';
3
3
  import { InputPassword } from 'ant-design-vue';
4
- import { useI18n } from 'vue-i18n';
4
+ import { $t } from '@/locales/index';
5
5
 
6
6
  const { editorCtrl, labelText, errInfo } = useInputFactory();
7
- const { t } = useI18n();
8
7
  const onBlur = () => {
9
8
  if (errInfo?.value.errClass && editorCtrl) {
10
9
  /// 重新开始验证
@@ -17,7 +16,7 @@ const onBlur = () => {
17
16
  :class="errInfo?.errClass === 'error' ? ['error', '!border-red-300', 'shadow-[0_0_3px_0px_#ff4d4f]'] : ''"
18
17
  :allow-clear="true"
19
18
  autocomplete="new-password"
20
- :placeholder="t('webui.common.placeholder', [labelText])"
19
+ :placeholder="$t('webui.common.placeholder', [labelText])"
21
20
  @blur="onBlur"
22
21
  v-bind="$attrs"
23
22
  />
@@ -2,7 +2,7 @@
2
2
  import { ref, watch } from 'vue';
3
3
  import { Input, Button } from 'ant-design-vue';
4
4
  import type { PropConfigItem } from '@/typings/form.d';
5
- import { useI18n } from 'vue-i18n';
5
+ import { $t } from '@/locales/index';
6
6
 
7
7
  const props = defineProps<{
8
8
  /**
@@ -86,8 +86,6 @@ watch(
86
86
  { immediate: true },
87
87
  );
88
88
 
89
- const { t } = useI18n();
90
-
91
89
  const updateConfig = () => {
92
90
  let newConfig: Record<string, string>;
93
91
 
@@ -144,7 +142,7 @@ const handleInputChange = () => {
144
142
  <div :class="[fieldWidth ? `w-[${fieldWidth}%]` : 'w-[33%]']">
145
143
  <Input v-if="!selectList || selectList.length === 0" v-model:value="item.field"
146
144
  :title="item.text || item.field" class="w-full"
147
- :placeholder="item.text || labelHolder || t('webui.components.form.propEditor.configName')"
145
+ :placeholder="item.text || labelHolder || $t('webui.components.form.propEditor.configName')"
148
146
  @input="handleInputChange" :disabled="!addMore" />
149
147
  <div v-else>
150
148
  <Input v-model:value="item.text" :title="item.text" :disabled="true" class="w-[100%]" />
@@ -154,14 +152,14 @@ const handleInputChange = () => {
154
152
  <div class="w-[3%]">=</div>
155
153
  <div :class="[fieldWidth ? `w-[${97 - fieldWidth}%]` : 'w-[64%]']">
156
154
  <Input v-model:value="item.value"
157
- :placeholder="valueHolder || t('webui.common.placeholder', [item.text || t('webui.components.form.propEditor.configValue')])"
155
+ :placeholder="valueHolder || $t('webui.common.placeholder', [item.text || $t('webui.components.form.propEditor.configValue')])"
158
156
  @input="handleInputChange" :title="item.value" />
159
157
  </div>
160
158
  </div>
161
159
  <Button v-if="addMore" @click="addNewLine"
162
160
  class="mt-1 w-[80px] !text-[12px] text-[#666] bg-[#e6f7ff] border-[#b3e0ff] hover:bg-[#b3e0ff] hover:border-[#8abeff]"
163
161
  size="small">
164
- {{ t('webui.components.form.propEditor.addConfigRow') }}
162
+ {{ $t('webui.components.form.propEditor.addConfigRow') }}
165
163
  </Button>
166
164
  </div>
167
165
  </template>
@@ -23,7 +23,7 @@ const props = defineProps({
23
23
  },
24
24
  nodata: {
25
25
  type: String,
26
- default: $t('webui.components.form.radio.noData'),
26
+ default: $t('webui.common.noData'),
27
27
  },
28
28
  /**
29
29
  * 换行数量
@@ -1,11 +1,10 @@
1
1
  <script setup lang="ts">
2
- import { ref, onMounted, onUnmounted, PropType, watch, shallowRef } from 'vue';
2
+ import { ref, onMounted, onUnmounted, PropType, watch, shallowRef, computed } from 'vue';
3
3
  import { formValidate, useInputFactory, OptionItemProps, loadOption, unloadOption, OptionCommProps } from '@/index';
4
4
  import { Switch } from 'ant-design-vue';
5
5
  import message from 'vue-m-message';
6
6
  import { useOptionFactory } from '@/utils/page';
7
- import { computed } from 'vue';
8
- import { useI18n } from 'vue-i18n';
7
+ import { $t, getLang } from '@/locales/index';
9
8
 
10
9
  const props = defineProps({
11
10
  ...OptionCommProps,
@@ -48,7 +47,6 @@ const emit = defineEmits<{
48
47
  }>();
49
48
 
50
49
  const { editorCtrl, errInfo } = useInputFactory();
51
- const { t } = useI18n();
52
50
 
53
51
  const customSize = computed(() => {
54
52
  switch (props.size) {
@@ -58,6 +56,19 @@ const customSize = computed(() => {
58
56
  return 'w-[58px]';
59
57
  }
60
58
  });
59
+
60
+ const isEn = computed(() => getLang() === 'en-US' || getLang() === 'en');
61
+
62
+ const checkedLabel = computed(() => {
63
+ const label = switchOptions.value[0]?.label || '';
64
+ return (isEn.value && label.toLowerCase() === 'enable') ? label.slice(0, 2) : label;
65
+ });
66
+
67
+ const uncheckedLabel = computed(() => {
68
+ const label = switchOptions.value[1]?.label || '';
69
+ return (isEn.value && label.toLowerCase() === 'disable') ? label.slice(0, 3) : label;
70
+ });
71
+
61
72
  const onChange = (checked: boolean | string | number) => {
62
73
  if (errInfo?.value.errClass && editorCtrl) {
63
74
  /// 重新开始验证
@@ -68,7 +79,7 @@ const onChange = (checked: boolean | string | number) => {
68
79
  onMounted(() => {
69
80
  if (!props.data || props.data.length != 2) {
70
81
  console.error('Switch组件: ', props.data);
71
- message.error(t('webui.components.form.switch.error'));
82
+ message.error($t('webui.components.form.switch.error'));
72
83
  return;
73
84
  }
74
85
  if (optionCtrl) loadOption(optionCtrl.autoload, optionCtrl, props);
@@ -83,8 +94,8 @@ onUnmounted(() => {
83
94
  errInfo?.errClass === 'error' ? 'error !border-red-300 shadow-[0_0_3px_0px_#ff4d4f]' : '',
84
95
  'bg-blue-300',
85
96
  customSize,
86
- ]" :checkedChildren="switchOptions[0].label" :checkedValue="switchOptions[0].value"
87
- :unCheckedChildren="switchOptions[1].label" :unCheckedValue="switchOptions[1].value" @change="onChange"
97
+ ]" :checkedChildren="checkedLabel" :checkedValue="switchOptions[0].value" :unCheckedChildren="uncheckedLabel"
98
+ :unCheckedValue="switchOptions[1].value" @change="onChange"
88
99
  v-bind="$attrs" />
89
100
  </template>
90
101
  <style>
@@ -92,4 +103,5 @@ onUnmounted(() => {
92
103
  .ant-switch-small .ant-switch-inner-unchecked {
93
104
  font-size: 10px !important;
94
105
  }
95
- </style>
106
+ </style>
107
+
@@ -1,9 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { formValidate, useInputFactory } from '@/index';
3
3
  import { Textarea } from 'ant-design-vue';
4
- import { useI18n } from 'vue-i18n';
5
- const { t } = useI18n();
6
-
4
+ import { $t } from '@/locales/index';
7
5
  const { editorCtrl, labelText, errInfo } = useInputFactory();
8
6
  const onBlur = () => {
9
7
  if (errInfo?.value.errClass && editorCtrl) {
@@ -16,7 +14,7 @@ const onBlur = () => {
16
14
  <Textarea
17
15
  :class="errInfo?.errClass === 'error' ? ['error', '!border-red-300', 'shadow-[0_0_3px_0px_#ff4d4f]'] : ''"
18
16
  :allow-clear="true"
19
- :placeholder="t('webui.common.placeholder', [labelText])"
17
+ :placeholder="$t('webui.common.placeholder', [labelText])"
20
18
  @blur="onBlur"
21
19
  @keyup.enter.native.stop
22
20
  @keydown.enter.native.stop
@@ -3,13 +3,12 @@ import { ref } from 'vue';
3
3
  import { TimePicker } from 'ant-design-vue';
4
4
  import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
5
5
  import { formValidate, useInputFactory } from '@/index';
6
- import { useI18n } from 'vue-i18n';
6
+ import { $t } from '@/locales/index';
7
7
  const props = defineProps<{
8
8
  valueFormat?: string;
9
9
  }>();
10
10
 
11
11
  const { editorCtrl, labelText, errInfo } = useInputFactory();
12
- const { t } = useI18n();
13
12
  const onBlur = () => {
14
13
  if (errInfo?.value.errClass && editorCtrl) {
15
14
  /// 重新开始验证
@@ -22,6 +21,6 @@ const timeFormat = ref<string>(props.valueFormat ?? 'HH:mm');
22
21
  <template>
23
22
  <TimePicker class="w-full"
24
23
  :class="[errInfo?.errClass === 'error' ? 'error !border-red-300 shadow-[0_0_3px_0px_#ff4d4f]' : '']"
25
- :placeholder="t('webui.common.pleaseSelect') + labelText" :locale="locale" :valueFormat="timeFormat"
24
+ :placeholder="$t('webui.common.pleaseSelect') + labelText" :locale="locale" :valueFormat="timeFormat"
26
25
  @blur="onBlur" />
27
26
  </template>
@@ -2,7 +2,7 @@
2
2
  import { ToolIcon } from '../../common';
3
3
  import { computed, ref, watch } from 'vue';
4
4
  import message from 'vue-m-message';
5
- import { useI18n } from 'vue-i18n';
5
+ import { $t } from '@/locales/index';
6
6
  import type { UploadProps } from 'ant-design-vue';
7
7
  import { Upload, Image } from 'ant-design-vue';
8
8
  import { UploadFile, path } from '@/index';
@@ -86,8 +86,6 @@ const props = withDefaults(defineProps<ImageListProps>(), {
86
86
 
87
87
  const inputFactory = useInputFactory();
88
88
  const { errInfo } = inputFactory;
89
- const { t } = useI18n();
90
-
91
89
  // Upload 组件的文件列表更新
92
90
  const displayList = ref<UploadFile[]>(props.fileList);
93
91
  // Upload 组件的内部文件列表
@@ -101,14 +99,14 @@ const validateFile = (file: File): boolean => {
101
99
  if (props.fileExt && props.fileExt.length > 0) {
102
100
  const extension = file.name.split('.').pop()?.toLowerCase() || '';
103
101
  if (!props.fileExt.includes(extension)) {
104
- message.error(t('webui.components.form.upload.unsupportedFileType'));
102
+ message.error($t('webui.components.form.upload.unsupportedFileType'));
105
103
  return false;
106
104
  }
107
105
  }
108
106
 
109
107
  // 文件大小验证
110
108
  if (file.size / 1024 / 1024 > props.maxFileSize) {
111
- message.error(t('webui.components.form.upload.fileSizeExceeded', [props.maxFileSize]));
109
+ message.error($t('webui.components.form.upload.fileSizeExceeded', [props.maxFileSize]));
112
110
  return false;
113
111
  }
114
112
 
@@ -161,7 +159,7 @@ const handleFileSelect = async (newFiles: any[]) => {
161
159
 
162
160
  // 检查是否达到最大数量限制
163
161
  if (isMaxCountReached()) {
164
- message.error(t('webui.components.form.upload.maxFileCount', [props.maxCount]));
162
+ message.error($t('webui.components.form.upload.maxFileCount', [props.maxCount]));
165
163
  hasError = true;
166
164
  break;
167
165
  }
@@ -260,7 +258,7 @@ const removeFile = (index: number) => {
260
258
  },
261
259
  }).then((res) => {
262
260
  if (res && res.status === ResStatus.SUCCESS) {
263
- message.success(t('webui.common.success'));
261
+ message.success($t('webui.common.success'));
264
262
  displayList.value.splice(index, 1);
265
263
  }
266
264
  });
@@ -342,12 +340,12 @@ const hoveredIndex = ref(-1);
342
340
  <div v-if="previewUrl" class="flex items-center text-white cursor-pointer hover:text-blue-400"
343
341
  @click="previewFile(index)">
344
342
  <ToolIcon icon="icon-eye" clickable />
345
- <span class="text-sm ml-1">{{ t('webui.components.form.upload.preview') }}</span>
343
+ <span class="text-sm ml-1">{{ $t('webui.components.form.upload.preview') }}</span>
346
344
  </div>
347
345
  <div v-if="showDelete !== false" class="flex items-center text-white cursor-pointer hover:text-red-400"
348
346
  @click="removeFile(index)">
349
347
  <ToolIcon icon="icon-new" :angle="45" clickable />
350
- <span class="text-sm ml-1">{{ t('webui.components.form.upload.delete') }}</span>
348
+ <span class="text-sm ml-1">{{ $t('webui.components.form.upload.delete') }}</span>
351
349
  </div>
352
350
  </div>
353
351
  </div>
@@ -38,7 +38,8 @@ export const defaultEnLocale = {
38
38
  "more": "More",
39
39
  "moreActions": "More Actions",
40
40
  "uploadSave": "Upload & Save",
41
- "dataLoading": "Loading data..."
41
+ "dataLoading": "Loading data...",
42
+ "noData": "No data"
42
43
  },
43
44
 
44
45
  "components": {
@@ -182,8 +183,7 @@ export const defaultEnLocale = {
182
183
  "delete": "Delete"
183
184
  },
184
185
  "select": {
185
- "pleaseSelect": "Please select {0}",
186
- "noData": "No data"
186
+ "pleaseSelect": "Please select {0}"
187
187
  },
188
188
  "aceEditor": {
189
189
  "title": "Code Editor",
@@ -206,7 +206,6 @@ export const defaultEnLocale = {
206
206
  "error": "Switch component must have exactly two options"
207
207
  },
208
208
  "radio": {
209
- "noData": "No data",
210
209
  "all": "All"
211
210
  },
212
211
  "autoComplete": {
@@ -219,8 +218,7 @@ export const defaultEnLocale = {
219
218
  "addConfigRow": "Add Row"
220
219
  },
221
220
  "transfer": {
222
- "pleaseInput": "Please enter {0}",
223
- "noData": "No data"
221
+ "pleaseInput": "Please enter {0}"
224
222
  }
225
223
  }
226
224
  },
@@ -38,7 +38,8 @@ export const defaultLocale = {
38
38
  "more": "更多",
39
39
  "moreActions": "更多操作",
40
40
  "uploadSave": "上传保存",
41
- "dataLoading": "数据加载中..."
41
+ "dataLoading": "数据加载中...",
42
+ "noData": "无数据"
42
43
  },
43
44
 
44
45
  "components": {
@@ -182,8 +183,7 @@ export const defaultLocale = {
182
183
  "delete": "删除"
183
184
  },
184
185
  "select": {
185
- "pleaseSelect": "请选择{0}",
186
- "noData": "无数据"
186
+ "pleaseSelect": "请选择{0}"
187
187
  },
188
188
  "aceEditor": {
189
189
  "title": "代码编辑器",
@@ -206,7 +206,6 @@ export const defaultLocale = {
206
206
  "error": "Switch组件必须有且只有两个选项"
207
207
  },
208
208
  "radio": {
209
- "noData": "无数据",
210
209
  "all": "全部"
211
210
  },
212
211
  "autoComplete": {
@@ -219,8 +218,7 @@ export const defaultLocale = {
219
218
  "addConfigRow": "新增配置行"
220
219
  },
221
220
  "transfer": {
222
- "pleaseInput": "请输入{0}",
223
- "noData": "无数据"
221
+ "pleaseInput": "请输入{0}"
224
222
  }
225
223
  },
226
224
  },