@arim-aisdc/public-components 2.3.2 → 2.3.4

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.
@@ -5,7 +5,7 @@
5
5
  .btnContainer {
6
6
  width: 100%;
7
7
  text-align: right;
8
- margin-top: 12px !important;
8
+ // margin-top: 12px !important;
9
9
  padding-top: 0 !important;
10
10
  }
11
11
 
@@ -351,7 +351,8 @@ var QueryFilter = function QueryFilter(_ref, ref) {
351
351
  }),
352
352
  placeholder: item.inputTips,
353
353
  allowClear: item === null || item === void 0 ? void 0 : item.allowClear,
354
- presets: item === null || item === void 0 ? void 0 : item.presets
354
+ presets: item === null || item === void 0 ? void 0 : item.presets,
355
+ picker: item === null || item === void 0 ? void 0 : item.picker
355
356
  });
356
357
  break;
357
358
  case FormItemType.DateRang:
@@ -1,22 +1,34 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1
7
  import { DatePicker } from 'antd';
2
8
  import dayjs from 'dayjs';
3
9
  import { defaultDateFormat } from "../index";
4
10
  import "./index.less";
11
+ import { useTranslation } from "../../../../../hooks/useTranslation";
5
12
  import { jsx as _jsx } from "react/jsx-runtime";
6
13
  var defaultRangePresets = [{
7
14
  label: '最近7天',
15
+ code: 'last7Days',
8
16
  value: [dayjs().add(-7, 'd'), dayjs()]
9
17
  }, {
10
18
  label: '最近一个月',
19
+ code: 'lastMonth',
11
20
  value: [dayjs().add(-1, 'M'), dayjs()]
12
21
  }, {
13
22
  label: '最近三个月',
23
+ code: 'last3Months',
14
24
  value: [dayjs().add(-3, 'M'), dayjs()]
15
25
  }, {
16
26
  label: '最近半年',
27
+ code: 'last6Months',
17
28
  value: [dayjs().add(-6, 'M'), dayjs()]
18
29
  }, {
19
30
  label: '最近一年',
31
+ code: 'lastYear',
20
32
  value: [dayjs().add(-1, 'y'), dayjs()]
21
33
  }];
22
34
  var defaultTimeRange = [dayjs('00:00:00', 'HH:mm:ss'), dayjs('23:59:59', 'HH:mm:ss')];
@@ -25,11 +37,18 @@ export var DateRange = function DateRange(_ref) {
25
37
  value = _ref.value,
26
38
  columnDef = _ref.columnDef,
27
39
  manualFiltering = _ref.manualFiltering;
40
+ var _useTranslation = useTranslation(),
41
+ _useTranslation2 = _slicedToArray(_useTranslation, 1),
42
+ t = _useTranslation2[0];
28
43
  var _ref2 = columnDef.filterComProps || {},
29
44
  _ref2$format = _ref2.format,
30
45
  format = _ref2$format === void 0 ? defaultDateFormat : _ref2$format,
31
46
  _ref2$rangePresets = _ref2.rangePresets,
32
- rangePresets = _ref2$rangePresets === void 0 ? defaultRangePresets : _ref2$rangePresets,
47
+ rangePresets = _ref2$rangePresets === void 0 ? t.tA(defaultRangePresets, {
48
+ labelKey: 'label',
49
+ fieldKey: 'code',
50
+ groupPrefix: 'global.text'
51
+ }) : _ref2$rangePresets,
33
52
  showTime = _ref2.showTime,
34
53
  _ref2$picker = _ref2.picker,
35
54
  picker = _ref2$picker === void 0 ? 'date' : _ref2$picker;
@@ -116,8 +135,10 @@ export var DateRange = function DateRange(_ref) {
116
135
  showTime: showTime === true ? {
117
136
  defaultValue: defaultTimeRange
118
137
  } : showTime,
119
- format: format,
120
- placeholder: ['开始时间', '结束时间'],
138
+ format: format
139
+ // placeholder={['开始时间', '结束时间']}
140
+ ,
141
+ placeholder: [t('global.placeholder.startTime'), t('global.placeholder.endTime')],
121
142
  picker: picker,
122
143
  onChange: onChangeDateRange,
123
144
  allowEmpty: [true, true],
@@ -17,6 +17,7 @@ import { DateRange } from "./DateRange";
17
17
  import MultipleSelect from "./MultipleSelect";
18
18
  import NumberRange from "./NumberRange";
19
19
  import SingleSelect from "./SingleSelect";
20
+ import { useTranslation } from "../../../../hooks/useTranslation";
20
21
  import { jsx as _jsx } from "react/jsx-runtime";
21
22
  var Filter = function Filter(_ref) {
22
23
  var column = _ref.column,
@@ -151,6 +152,9 @@ var Filter = function Filter(_ref) {
151
152
  }, []);
152
153
  var filterComponent = function filterComponent(type) {
153
154
  var _columnDef$filterComP, _columnDef$filterComP2, _columnDef$filterComP3;
155
+ var _useTranslation = useTranslation(),
156
+ _useTranslation2 = _slicedToArray(_useTranslation, 1),
157
+ t = _useTranslation2[0];
154
158
  switch (type) {
155
159
  case FilterType.Date:
156
160
  case FilterType.DateRange:
@@ -241,7 +245,7 @@ var Filter = function Filter(_ref) {
241
245
  },
242
246
  allowClear: true,
243
247
  value: columnFilterValue,
244
- placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57\u641C\u7D22"
248
+ placeholder: t('global.placeholder.input')
245
249
  })
246
250
  });
247
251
  case FilterType.SingleSelect:
@@ -8,6 +8,7 @@ import { useUpdateEffect } from 'ahooks';
8
8
  import { Button, Checkbox, Input, Spin } from 'antd';
9
9
  import { useMemo, useState } from 'react';
10
10
  import "./index.less";
11
+ import { useTranslation } from "../../../../../hooks/useTranslation";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
  import { Fragment as _Fragment } from "react/jsx-runtime";
13
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -26,6 +27,9 @@ var MultipleSelect = function MultipleSelect(_ref) {
26
27
  _useState2 = _slicedToArray(_useState, 2),
27
28
  innerValue = _useState2[0],
28
29
  setInnerValue = _useState2[1];
30
+ var _useTranslation = useTranslation(),
31
+ _useTranslation2 = _slicedToArray(_useTranslation, 1),
32
+ t = _useTranslation2[0];
29
33
 
30
34
  // 前端搜索输入值
31
35
  var _useState3 = useState(''),
@@ -87,7 +91,7 @@ var MultipleSelect = function MultipleSelect(_ref) {
87
91
  children: [/*#__PURE__*/_jsx("div", {
88
92
  className: "header",
89
93
  children: /*#__PURE__*/_jsx(Input, {
90
- placeholder: "\u8F93\u5165\u641C\u7D22",
94
+ placeholder: t('global.placeholder.input'),
91
95
  onChange: handleInputChange
92
96
  })
93
97
  }), /*#__PURE__*/_jsx("div", {
@@ -100,7 +104,7 @@ var MultipleSelect = function MultipleSelect(_ref) {
100
104
  indeterminate: indeterminate,
101
105
  onChange: onCheckAllChange,
102
106
  checked: checkAll,
103
- children: "\u5168\u9009"
107
+ children: t('global.setting.selectAll')
104
108
  }), /*#__PURE__*/_jsx(CheckboxGroup, {
105
109
  options: finalOptions,
106
110
  value: innerValue,
@@ -112,11 +116,11 @@ var MultipleSelect = function MultipleSelect(_ref) {
112
116
  children: [/*#__PURE__*/_jsx(Button, {
113
117
  type: "text",
114
118
  onClick: handleReset,
115
- children: "\u91CD\u7F6E"
119
+ children: t('global.button.reset')
116
120
  }), /*#__PURE__*/_jsx(Button, {
117
121
  type: "primary",
118
122
  onClick: handleConfirm,
119
- children: "\u786E\u5B9A"
123
+ children: t('global.button.confirm')
120
124
  })]
121
125
  })]
122
126
  });
@@ -8,10 +8,14 @@ import { Button, InputNumber } from 'antd';
8
8
  import React, { useState } from 'react';
9
9
  import { noValue } from "../../../utils";
10
10
  import "./index.less";
11
+ import { useTranslation } from "../../../../../hooks/useTranslation";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
14
  var NumberRange = function NumberRange(props) {
14
15
  var _column$getFacetedMin, _column$getFacetedMin2, _columnDef$cell, _column$getFacetedMin3, _column$getFacetedMin4, _columnDef$cell2;
16
+ var _useTranslation = useTranslation(),
17
+ _useTranslation2 = _slicedToArray(_useTranslation, 1),
18
+ t = _useTranslation2[0];
15
19
  var column = props.column,
16
20
  onChange = props.onChange,
17
21
  propsValue = props.value,
@@ -53,7 +57,7 @@ var NumberRange = function NumberRange(props) {
53
57
  children: [/*#__PURE__*/_jsxs("div", {
54
58
  className: "table-filter-number-range-body",
55
59
  children: [/*#__PURE__*/_jsx(InputNumber, {
56
- placeholder: "".concat((_column$getFacetedMin = column.getFacetedMinMaxValues()) !== null && _column$getFacetedMin !== void 0 && _column$getFacetedMin[0] ? "(".concat((_column$getFacetedMin2 = column.getFacetedMinMaxValues()) === null || _column$getFacetedMin2 === void 0 ? void 0 : _column$getFacetedMin2[0], ")") : '请输入'),
60
+ placeholder: "".concat((_column$getFacetedMin = column.getFacetedMinMaxValues()) !== null && _column$getFacetedMin !== void 0 && _column$getFacetedMin[0] ? "(".concat((_column$getFacetedMin2 = column.getFacetedMinMaxValues()) === null || _column$getFacetedMin2 === void 0 ? void 0 : _column$getFacetedMin2[0], ")") : t('global.placeholder.input')),
57
61
  onChange: function onChange(value) {
58
62
  return changeRange(value, 'min');
59
63
  },
@@ -71,7 +75,7 @@ var NumberRange = function NumberRange(props) {
71
75
  className: "horizontal-line"
72
76
  })
73
77
  }), /*#__PURE__*/_jsx(InputNumber, {
74
- placeholder: "".concat((_column$getFacetedMin3 = column.getFacetedMinMaxValues()) !== null && _column$getFacetedMin3 !== void 0 && _column$getFacetedMin3[1] ? "(".concat((_column$getFacetedMin4 = column.getFacetedMinMaxValues()) === null || _column$getFacetedMin4 === void 0 ? void 0 : _column$getFacetedMin4[1], ")") : '请输入'),
78
+ placeholder: "".concat((_column$getFacetedMin3 = column.getFacetedMinMaxValues()) !== null && _column$getFacetedMin3 !== void 0 && _column$getFacetedMin3[1] ? "(".concat((_column$getFacetedMin4 = column.getFacetedMinMaxValues()) === null || _column$getFacetedMin4 === void 0 ? void 0 : _column$getFacetedMin4[1], ")") : t('global.placeholder.input')),
75
79
  onChange: function onChange(value) {
76
80
  return changeRange(value, 'max');
77
81
  },
@@ -86,11 +90,11 @@ var NumberRange = function NumberRange(props) {
86
90
  children: [/*#__PURE__*/_jsx(Button, {
87
91
  type: "text",
88
92
  onClick: handleReset,
89
- children: "\u91CD\u7F6E"
93
+ children: t('global.button.reset')
90
94
  }), /*#__PURE__*/_jsx(Button, {
91
95
  type: "primary",
92
96
  onClick: handleConfirm,
93
- children: "\u786E\u5B9A"
97
+ children: t('global.button.confirm')
94
98
  })]
95
99
  })]
96
100
  });
@@ -8,6 +8,7 @@ import { useUpdateEffect } from 'ahooks';
8
8
  import { Button, Input, Spin } from 'antd';
9
9
  import { useMemo, useState } from 'react';
10
10
  import "./index.less";
11
+ import { useTranslation } from "../../../../../hooks/useTranslation";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
14
  var SingleSelect = function SingleSelect(_ref) {
@@ -24,6 +25,9 @@ var SingleSelect = function SingleSelect(_ref) {
24
25
  _useState2 = _slicedToArray(_useState, 2),
25
26
  innerValue = _useState2[0],
26
27
  setInnerValue = _useState2[1];
28
+ var _useTranslation = useTranslation(),
29
+ _useTranslation2 = _slicedToArray(_useTranslation, 1),
30
+ t = _useTranslation2[0];
27
31
 
28
32
  // 前端搜索输入值
29
33
  var _useState3 = useState(''),
@@ -72,7 +76,7 @@ var SingleSelect = function SingleSelect(_ref) {
72
76
  children: [/*#__PURE__*/_jsx("div", {
73
77
  className: "header",
74
78
  children: /*#__PURE__*/_jsx(Input, {
75
- placeholder: "\u8F93\u5165\u641C\u7D22",
79
+ placeholder: t('global.placeholder.input'),
76
80
  onChange: handleInputChange
77
81
  })
78
82
  }), /*#__PURE__*/_jsx("div", {
@@ -95,11 +99,11 @@ var SingleSelect = function SingleSelect(_ref) {
95
99
  children: [/*#__PURE__*/_jsx(Button, {
96
100
  type: "text",
97
101
  onClick: handleReset,
98
- children: "\u91CD\u7F6E"
102
+ children: t('global.button.reset')
99
103
  }), /*#__PURE__*/_jsx(Button, {
100
104
  type: "primary",
101
105
  onClick: handleConfirm,
102
- children: "\u786E\u5B9A"
106
+ children: t('global.button.confirm')
103
107
  })]
104
108
  })]
105
109
  });
@@ -12,5 +12,5 @@ type TranslateOptions = {
12
12
  labelKey: string;
13
13
  groupPrefix?: string;
14
14
  };
15
- export declare const useTranslation: (locales?: Record<string, Omit<Locale, 'locale' extends keyof Locale ? never : 'locale'>>) => [LocaleFunction, getLocaleCode: string, switchLocale: (lang: string) => void];
15
+ export declare const useTranslation: (locales?: Record<string, Omit<Locale, 'locale' extends keyof Locale ? never : 'locale'>>) => [LocaleFunction, getLocaleCode: string];
16
16
  export {};
@@ -188,8 +188,5 @@ export var useTranslation = function useTranslation(locales) {
188
188
  // return localeCode ?? defaultLocaleData.locale; // 提供默认值
189
189
  return localeCode;
190
190
  }, [fullLocale]);
191
- var switchLocale = React.useMemo(function () {
192
- return fullLocale.switchLocale;
193
- }, [fullLocale]);
194
- return [enhancedLocaleFunction, getLocaleCode, switchLocale];
191
+ return [enhancedLocaleFunction, getLocaleCode];
195
192
  };
@@ -2,17 +2,49 @@ var localeValues = {
2
2
  locale: 'en_US',
3
3
  // locales for globals
4
4
  global: {
5
- placeholder: {},
5
+ setting: {
6
+ "oneRow": "1 Row",
7
+ "twoRow": "2 Rows",
8
+ "threeRow": "3 Rows",
9
+ "pinToTail": "Pin to Tail",
10
+ "unpin": "Unpin",
11
+ "pinToHead": "Pin to Head",
12
+ "showFilter": "Show Filter",
13
+ "headerRowNum": "Header Row Number",
14
+ "selectAll": "Select All",
15
+ "reset": "Reset"
16
+ },
17
+ placeholder: {
18
+ startTime: 'Start Time',
19
+ endTime: 'End Time',
20
+ input: 'Please Input'
21
+ },
6
22
  button: {
7
- cancel: '取消',
8
- confirm: '确定'
23
+ reset: 'Reset',
24
+ cancel: 'Cancel',
25
+ confirm: 'Confirm'
9
26
  },
10
27
  text: {
11
- emptyText: 'no data'
28
+ emptyText: 'No Data Available',
29
+ last7Days: 'Last 7 Days',
30
+ lastMonth: 'Last Month',
31
+ last3Months: 'Last 3 Months',
32
+ last6Months: 'Last 6 Months',
33
+ lastYear: 'Last Year'
34
+ },
35
+ message: {
36
+ confirmDeleteTitle: 'Are you sure you want to delete this information?',
37
+ confirmDeleteSubTitle: 'Deletion may not be reversible. Please proceed with caution!',
38
+ deleting: 'Deleting',
39
+ actioning: '{0}ing',
40
+ successAction: '{0} Successful',
41
+ deleteSuccess: 'Deletion Successful'
12
42
  },
13
- message: {},
14
43
  pagination: {
15
- total: '{0}'
44
+ total: 'Total {0} items',
45
+ totalInfo: '{0} items / Total {1} items',
46
+ perPage: 'Per Page',
47
+ pieces: 'items'
16
48
  }
17
49
  }
18
50
  };
@@ -2,17 +2,49 @@ var localeValues = {
2
2
  locale: 'vi_VN',
3
3
  // locales for globals
4
4
  global: {
5
- placeholder: {},
5
+ setting: {
6
+ "oneRow": "1 dòng",
7
+ "twoRow": "2 dòng",
8
+ "threeRow": "3 dòng",
9
+ "pinToTail": "Cố định cuối cột",
10
+ "unpin": "Không cố định",
11
+ "pinToHead": "Cố định đầu cột",
12
+ "showFilter": "Hiển thị bộ lọc",
13
+ "headerRowNum": "Số dòng tiêu đề",
14
+ "selectAll": "Chọn tất cả",
15
+ "reset": "Đặt lại"
16
+ },
17
+ placeholder: {
18
+ startTime: 'Thời gian bắt đầu',
19
+ endTime: 'Thời gian kết thúc',
20
+ input: 'Vui lòng nhập'
21
+ },
6
22
  button: {
7
- cancel: '取消',
8
- confirm: '确定'
23
+ reset: 'Đặt lại',
24
+ cancel: 'Hủy',
25
+ confirm: 'Xác nhận'
9
26
  },
10
27
  text: {
11
- emptyText: '暂无数据'
28
+ emptyText: 'Không có dữ liệu',
29
+ last7Days: '7 ngày qua',
30
+ lastMonth: 'Tháng trước',
31
+ last3Months: '3 tháng qua',
32
+ last6Months: '6 tháng qua',
33
+ lastYear: 'Năm trước'
34
+ },
35
+ message: {
36
+ confirmDeleteTitle: 'Bạn có chắc muốn xóa thông tin này không?',
37
+ confirmDeleteSubTitle: 'Việc xóa có thể không thể khôi phục. Vui lòng thận trọng!',
38
+ deleting: 'Đang xóa',
39
+ actioning: 'Đang {0}',
40
+ successAction: '{0} thành công',
41
+ deleteSuccess: 'Xóa thành công'
12
42
  },
13
- message: {},
14
43
  pagination: {
15
- total: '{0}'
44
+ total: 'Tổng {0} mục',
45
+ totalInfo: '{0} mục / Tổng {1} mục',
46
+ perPage: 'Mỗi trang',
47
+ pieces: 'mục'
16
48
  }
17
49
  }
18
50
  };
@@ -14,14 +14,23 @@ var localeValues = {
14
14
  "selectAll": "全选",
15
15
  "reset": "重置"
16
16
  },
17
- placeholder: {},
17
+ placeholder: {
18
+ startTime: '开始时间',
19
+ endTime: '结束时间',
20
+ input: '请输入'
21
+ },
18
22
  button: {
19
23
  reset: '重置',
20
24
  cancel: '取消',
21
25
  confirm: '确定'
22
26
  },
23
27
  text: {
24
- emptyText: '暂无数据'
28
+ emptyText: '暂无数据',
29
+ last7Days: '最近7天',
30
+ lastMonth: '最近一个月',
31
+ last3Months: '最近三个月',
32
+ last6Months: '最近半年',
33
+ lastYear: '最近一年'
25
34
  },
26
35
  message: {
27
36
  confirmDeleteTitle: '确认删除这条信息吗?',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "2.3.2",
3
+ "version": "2.3.4",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",