fit2cloud-ui-plus 1.1.18 → 1.2.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.
@@ -1,10 +1,10 @@
1
- import { computed, isRef, ref, unref } from 'vue'
2
- import { get } from 'lodash-unified'
1
+ import {computed, isRef, ref, unref} from 'vue'
2
+ import {get} from 'lodash-unified'
3
3
  import Chinese from '@/locale/lang/zh-cn'
4
- import { useGlobalConfig } from '@/hooks'
5
- import type { MaybeRef } from '@vueuse/core'
6
- import type { Ref } from 'vue'
7
- import type { Language } from '@/locale'
4
+ import {useGlobalConfig} from '@/hooks'
5
+ import type {MaybeRef} from '@vueuse/core'
6
+ import type {Ref} from 'vue'
7
+ import type {Language} from '@/locale'
8
8
 
9
9
  export type TranslatorOption = Record<string, string | number>
10
10
  export type Translator = (path: string, option?: TranslatorOption) => string
@@ -16,18 +16,22 @@ export type LocaleContext = {
16
16
 
17
17
  export const buildTranslator =
18
18
  (locale: MaybeRef<Language>): Translator =>
19
- (path, option) =>
20
- translate(path, option, unref(locale))
19
+ (path, option) =>
20
+ translate(path, option, unref(locale))
21
21
 
22
22
  export const translate = (
23
23
  path: string,
24
24
  option: undefined | TranslatorOption,
25
25
  locale: Language
26
- ): string =>
27
- (get(locale, path, path) as string).replace(
28
- /\{(\w+)\}/g,
29
- (_, key) => `${option?.[key] ?? `{${key}}`}`
30
- )
26
+ ): string => {
27
+ if (!i18nHandler) {
28
+ return (get(locale, path, path) as string).replace(
29
+ /\{(\w+)\}/g,
30
+ (_, key) => `${option?.[key] ?? `{${key}}`}`
31
+ )
32
+ }
33
+ return i18nHandler(path);
34
+ }
31
35
 
32
36
  export const buildLocaleContext = (
33
37
  locale: MaybeRef<Language>
@@ -45,3 +49,9 @@ export const useLocale = () => {
45
49
  const locale = useGlobalConfig('locale')
46
50
  return buildLocaleContext(computed(() => locale.value || Chinese))
47
51
  }
52
+
53
+ let i18nHandler: Function;
54
+
55
+ export const i18n = (fn: Function | undefined) => {
56
+ i18nHandler = fn || i18nHandler;
57
+ };
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import PackageJSON from "../package.json"
2
2
 
3
3
  import type {App} from 'vue'
4
- import {GlobalConfig, provideGlobalConfig} from "@/hooks";
4
+ import {GlobalConfig, i18n, provideGlobalConfig} from "@/hooks";
5
5
 
6
6
  const components = import.meta.globEager('@/components/*/index.ts');
7
7
 
@@ -10,6 +10,7 @@ const install = (app: App, config: GlobalConfig): void => {
10
10
  let component = components[key].default;
11
11
  app.use(component)
12
12
  })
13
+ i18n(config.i18n)
13
14
  provideGlobalConfig(config)
14
15
  }
15
16
 
@@ -1,6 +1,10 @@
1
1
  export { default as en } from './lang/en'
2
2
  export { default as zhCn } from './lang/zh-cn'
3
3
  export { default as zhTw } from './lang/zh-tw'
4
+ export { default as ja } from './lang/ja'
5
+ export { default as ms } from './lang/ms'
6
+ export { default as ru } from './lang/ru'
7
+ export { default as ptBr } from './lang/pt-br'
4
8
 
5
9
  export type TranslatePair = {
6
10
  [key: string]: string | string[] | TranslatePair
@@ -0,0 +1,59 @@
1
+ export default {
2
+ name: 'ja',
3
+ fu: {
4
+ filter_bar: {
5
+ filter: "フィルター",
6
+ results: "件の結果",
7
+ clear: "条件をクリア",
8
+ drawer_title: "フィルター条件",
9
+ cancel: "キャンセル",
10
+ search: "検索",
11
+ refresh: "リフレッシュ",
12
+ select_all: "すべて選択",
13
+ more: "もっと見る"
14
+ },
15
+ search_bar: {
16
+ search: "検索",
17
+ adv_search: "高度な検索",
18
+ ok: "確定",
19
+ cancel: "キャンセル",
20
+ please_select: "選択してください",
21
+ please_input: "入力してください",
22
+ like: "を含む",
23
+ not_like: "含まない",
24
+ in: "に属する",
25
+ not_in: "に属さない",
26
+ gt: "より大きい",
27
+ ge: "以上",
28
+ lt: "より小さい",
29
+ le: "以下",
30
+ eq: "等しい",
31
+ ne: "等しくない",
32
+ between: "の間",
33
+ select_date: '日付を選択',
34
+ start_date: '開始日',
35
+ end_date: '終了日',
36
+ select_date_time: '日時を選択',
37
+ start_date_time: '開始日時',
38
+ end_date_time: '終了日時',
39
+ range_separator: "から",
40
+ data_time_error: "開始日は終了日より後にすることはできません",
41
+ clean: "クリア",
42
+ refresh: "リフレッシュ",
43
+ },
44
+ table: {
45
+ ok: "確定",
46
+ cancel: "キャンセル",
47
+ custom_table_fields: "フィールドを選択",
48
+ custom_table_fields_desc: "固定フィールドは選択範囲外で、ドラッグして順序をカスタマイズできます",
49
+ custom_table_rows: "オプション列",
50
+ more: "もっと"
51
+ },
52
+ steps: {
53
+ cancel: "キャンセル",
54
+ next: "次へ",
55
+ prev: "前へ",
56
+ finish: "完了",
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,59 @@
1
+ export default {
2
+ name: 'ms',
3
+ fu: {
4
+ filter_bar: {
5
+ filter: "Penapis",
6
+ results: "keputusan",
7
+ clear: "Kosongkan syarat",
8
+ drawer_title: "Syarat Penapisan",
9
+ cancel: "Batal",
10
+ search: "Cari",
11
+ refresh: "Segar semula",
12
+ select_all: "Pilih Semua",
13
+ more: "Lagi"
14
+ },
15
+ search_bar: {
16
+ search: "Cari",
17
+ adv_search: "Carian Lanjutan",
18
+ ok: "Sahkan",
19
+ cancel: "Batal",
20
+ please_select: "Sila pilih",
21
+ please_input: "Sila masukkan",
22
+ like: "Mengandungi",
23
+ not_like: "Tidak mengandungi",
24
+ in: "Termasuk dalam",
25
+ not_in: "Tidak termasuk dalam",
26
+ gt: "Lebih besar daripada",
27
+ ge: "Lebih besar atau sama dengan",
28
+ lt: "Kurang daripada",
29
+ le: "Kurang atau sama dengan",
30
+ eq: "Sama dengan",
31
+ ne: "Tidak sama dengan",
32
+ between: "Antara",
33
+ select_date: 'Pilih tarikh',
34
+ start_date: 'Tarikh mula',
35
+ end_date: 'Tarikh tamat',
36
+ select_date_time: 'Pilih tarikh dan masa',
37
+ start_date_time: 'Tarikh dan masa mula',
38
+ end_date_time: 'Tarikh dan masa tamat',
39
+ range_separator: "hingga",
40
+ data_time_error: "Tarikh mula tidak boleh lebih besar daripada tarikh tamat",
41
+ clean: "Kosongkan",
42
+ refresh: "Segar semula",
43
+ },
44
+ table: {
45
+ ok: "Sahkan",
46
+ cancel: "Batal",
47
+ custom_table_fields: "Suai Medan Jadual",
48
+ custom_table_fields_desc: "Medan tetap tidak boleh dipilih. Seret untuk menyesuaikan susunan.",
49
+ custom_table_rows: "Lajur Pilihan",
50
+ more: "Lagi"
51
+ },
52
+ steps: {
53
+ cancel: "Batal",
54
+ next: "Seterusnya",
55
+ prev: "Sebelumnya",
56
+ finish: "Selesai",
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,59 @@
1
+ export default {
2
+ name: 'pt-br',
3
+ fu: {
4
+ filter_bar: {
5
+ filter: "Filtrar",
6
+ results: "resultados",
7
+ clear: "Limpar filtros",
8
+ drawer_title: "Filtros",
9
+ cancel: "Cancelar",
10
+ search: "Pesquisar",
11
+ refresh: "Atualizar",
12
+ select_all: "Selecionar todos",
13
+ more: "Mais"
14
+ },
15
+ search_bar: {
16
+ search: "Pesquisar",
17
+ adv_search: "Pesquisa avançada",
18
+ ok: "Confirmar",
19
+ cancel: "Cancelar",
20
+ please_select: "Selecione",
21
+ please_input: "Digite",
22
+ like: "Contém",
23
+ not_like: "Não contém",
24
+ in: "Está em",
25
+ not_in: "Não está em",
26
+ gt: "Maior que",
27
+ ge: "Maior ou igual a",
28
+ lt: "Menor que",
29
+ le: "Menor ou igual a",
30
+ eq: "Igual a",
31
+ ne: "Diferente de",
32
+ between: "Entre",
33
+ select_date: 'Selecionar data',
34
+ start_date: 'Data inicial',
35
+ end_date: 'Data final',
36
+ select_date_time: 'Selecionar data e hora',
37
+ start_date_time: 'Data e hora inicial',
38
+ end_date_time: 'Data e hora final',
39
+ range_separator: "até",
40
+ data_time_error: "A data inicial não pode ser maior que a data final",
41
+ clean: "Limpar",
42
+ refresh: "Atualizar",
43
+ },
44
+ table: {
45
+ ok: "Confirmar",
46
+ cancel: "Cancelar",
47
+ custom_table_fields: "Selecione o campo",
48
+ custom_table_fields_desc: "Campos fixos não estão disponíveis para seleção. Arraste para personalizar a ordem.",
49
+ custom_table_rows: "Colunas de opções",
50
+ more: "Mais"
51
+ },
52
+ steps: {
53
+ cancel: "Cancelar",
54
+ next: "Próximo",
55
+ prev: "Anterior",
56
+ finish: "Concluir",
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,59 @@
1
+ export default {
2
+ name: 'ru',
3
+ fu: {
4
+ filter_bar: {
5
+ filter: "Фильтр",
6
+ results: "результатов",
7
+ clear: "Очистить условия",
8
+ drawer_title: "Условия фильтрации",
9
+ cancel: "Отмена",
10
+ search: "Поиск",
11
+ refresh: "Обновить",
12
+ select_all: "Выбрать все",
13
+ more: "Еще"
14
+ },
15
+ search_bar: {
16
+ search: "Поиск",
17
+ adv_search: "Расширенный поиск",
18
+ ok: "ОК",
19
+ cancel: "Отмена",
20
+ please_select: "Пожалуйста, выберите",
21
+ please_input: "Пожалуйста, введите",
22
+ like: "Содержит",
23
+ not_like: "Не содержит",
24
+ in: "Входит в",
25
+ not_in: "Не входит в",
26
+ gt: "Больше",
27
+ ge: "Больше или равно",
28
+ lt: "Меньше",
29
+ le: "Меньше или равно",
30
+ eq: "Равно",
31
+ ne: "Не равно",
32
+ between: "Между",
33
+ select_date: 'Выбрать дату',
34
+ start_date: 'Начальная дата',
35
+ end_date: 'Конечная дата',
36
+ select_date_time: 'Выбрать дату и время',
37
+ start_date_time: 'Начальная дата и время',
38
+ end_date_time: 'Конечная дата и время',
39
+ range_separator: "до",
40
+ data_time_error: "Начальная дата не может быть больше конечной",
41
+ clean: "Очистить",
42
+ refresh: "Обновить",
43
+ },
44
+ table: {
45
+ ok: "ОК",
46
+ cancel: "Отмена",
47
+ custom_table_fields: "Выберите поле",
48
+ custom_table_fields_desc: "Фиксированные поля не доступны для выбора, можно перетаскивать для изменения порядка",
49
+ custom_table_rows: "Столбцы с опциями",
50
+ more: "Еще"
51
+ },
52
+ steps: {
53
+ cancel: "Отмена",
54
+ next: "Следующий шаг",
55
+ prev: "Предыдущий шаг",
56
+ finish: "Завершить",
57
+ }
58
+ }
59
+ }
@@ -44,7 +44,7 @@ export default {
44
44
  table: {
45
45
  ok: "确定",
46
46
  cancel: "取消",
47
- custom_table_fields: "自定义表格字段",
47
+ custom_table_fields: "选择字段",
48
48
  custom_table_fields_desc: "固定字段不在选择范围,可拖拽自定义顺序",
49
49
  custom_table_rows: "选项列",
50
50
  more: "更多"
@@ -44,7 +44,7 @@ export default {
44
44
  table: {
45
45
  ok: "確定",
46
46
  cancel: "取消",
47
- custom_table_fields: "自定義表格字段",
47
+ custom_table_fields: "選項字段",
48
48
  custom_table_fields_desc: "固定欄位不在選擇範圍,可拖拽自定義順序",
49
49
  custom_table_rows: "選項列",
50
50
  more: "更多"
@@ -76,11 +76,13 @@
76
76
  font-size: 14px;
77
77
  line-height: 22px;
78
78
  height: 22px;
79
- min-width: 76px;
80
- max-width: 76px;
81
79
  color: var(--fu-filter-bar-color);
82
80
  cursor: pointer;
83
81
  margin-left: 6px;
82
+
83
+ & > i.el-icon {
84
+ margin-right: 4px;
85
+ }
84
86
  }
85
87
 
86
88
  @include e(drawer) {