dtable-ui-component 4.4.0 → 4.4.2
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/lib/CollaboratorEditor/index.js +26 -4
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +2 -1
- package/lib/DTableCommonAddTool/index.css +25 -0
- package/lib/DTableCommonAddTool/index.js +24 -0
- package/lib/DTableFiltersPopover/constants/index.js +65 -0
- package/lib/DTableFiltersPopover/index.css +39 -0
- package/lib/DTableFiltersPopover/index.js +216 -0
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +145 -0
- package/lib/DTableFiltersPopover/utils/index.js +452 -0
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.css +0 -0
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +106 -0
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +89 -0
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +89 -0
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +167 -0
- package/lib/DTableFiltersPopover/widgets/filter-item.js +677 -0
- package/lib/DTableFiltersPopover/widgets/filter-list/index.css +321 -0
- package/lib/DTableFiltersPopover/widgets/filter-list/index.js +125 -0
- package/lib/DTableFiltersPopover/widgets/rate-item.js +72 -0
- package/lib/DTablePopover/index.js +1 -1
- package/lib/Department-editor/constants.js +10 -0
- package/lib/Department-editor/department-multiple-select/index.css +67 -0
- package/lib/Department-editor/department-multiple-select/index.js +143 -0
- package/lib/Department-editor/department-single-select.js +263 -0
- package/lib/Department-editor/index.css +117 -0
- package/lib/Department-editor/index.js +99 -0
- package/lib/Department-editor/selected-departments/index.css +26 -0
- package/lib/Department-editor/selected-departments/index.js +81 -0
- package/lib/Department-editor/utils.js +29 -0
- package/lib/constants/index.js +4 -1
- package/lib/hooks/common-hooks.js +21 -0
- package/lib/index.js +4 -1
- package/lib/lang/index.js +67 -3
- package/lib/locals/en.js +69 -1
- package/lib/locals/zh-CN.js +68 -1
- package/lib/select-editor/mb-select-editor-popover/index.css +1 -1
- package/lib/select-editor/mb-select-editor-popover/index.js +1 -1
- package/lib/utils/dayjs.js +4 -0
- package/lib/utils/event-bus.js +28 -0
- package/lib/utils/utils.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { DEPARTMENT_SELECT_RANGE_MAP } from 'dtable-utils';
|
|
3
|
+
import { DEPARTMENT_SELECT_RANGE_OPTIONS } from '../constants';
|
|
4
|
+
import { getLocale } from '../../lang';
|
|
5
|
+
import './index.css';
|
|
6
|
+
function SelectedDepartments(props) {
|
|
7
|
+
const {
|
|
8
|
+
value,
|
|
9
|
+
removeDepartment,
|
|
10
|
+
isShowRemoveIcon,
|
|
11
|
+
departments
|
|
12
|
+
} = props;
|
|
13
|
+
const idDepartmentMap = useMemo(() => {
|
|
14
|
+
let idDepartmentMap = {};
|
|
15
|
+
departments.forEach(department => {
|
|
16
|
+
idDepartmentMap[department.id] = department;
|
|
17
|
+
});
|
|
18
|
+
return idDepartmentMap;
|
|
19
|
+
}, [departments]);
|
|
20
|
+
const dom = Array.isArray(value) ? value.map((content, index) => {
|
|
21
|
+
if ([DEPARTMENT_SELECT_RANGE_MAP.CURRENT_USER_DEPARTMENT, DEPARTMENT_SELECT_RANGE_MAP.CURRENT_USER_DEPARTMENT_AND_SUB].includes(content)) {
|
|
22
|
+
const name = getLocale(DEPARTMENT_SELECT_RANGE_OPTIONS.find(option => option.type === content).name);
|
|
23
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
key: "department-".concat(index),
|
|
25
|
+
className: "department mr-1"
|
|
26
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
27
|
+
className: "department-name text-truncate",
|
|
28
|
+
title: name,
|
|
29
|
+
"aria-label": name
|
|
30
|
+
}, name));
|
|
31
|
+
}
|
|
32
|
+
const department = idDepartmentMap[content];
|
|
33
|
+
if (department) {
|
|
34
|
+
const {
|
|
35
|
+
name
|
|
36
|
+
} = department;
|
|
37
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
key: "department-".concat(index),
|
|
39
|
+
className: "department mr-1"
|
|
40
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: "department-avatar-container d-flex align-items-center justify-content-center"
|
|
42
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
43
|
+
className: "dtable-font dtable-icon-department-single-selection"
|
|
44
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
45
|
+
className: "department-name text-truncate",
|
|
46
|
+
title: name,
|
|
47
|
+
"aria-label": name
|
|
48
|
+
}, name), isShowRemoveIcon && /*#__PURE__*/React.createElement("span", {
|
|
49
|
+
className: "remove-container"
|
|
50
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
51
|
+
className: "remove-icon",
|
|
52
|
+
onClick: event => removeDepartment(event, content)
|
|
53
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
54
|
+
className: "dtable-font dtable-icon-fork-number department-remove-icon"
|
|
55
|
+
}))));
|
|
56
|
+
}
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
key: "department-".concat(index),
|
|
59
|
+
className: "department empty-department mr-1"
|
|
60
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: "department-avatar-container d-flex align-items-center justify-content-center"
|
|
62
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
63
|
+
className: "dtable-font dtable-icon-department-single-selection"
|
|
64
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
65
|
+
className: "department-name"
|
|
66
|
+
}, getLocale('Deleted_department')), isShowRemoveIcon && /*#__PURE__*/React.createElement("span", {
|
|
67
|
+
className: "remove-container"
|
|
68
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
69
|
+
className: "remove-icon",
|
|
70
|
+
onClick: event => removeDepartment(event, content)
|
|
71
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
72
|
+
className: "dtable-font dtable-icon-fork-number department-remove-icon"
|
|
73
|
+
}))));
|
|
74
|
+
}) : null;
|
|
75
|
+
return dom;
|
|
76
|
+
}
|
|
77
|
+
SelectedDepartments.defaultProps = {
|
|
78
|
+
isShowRemoveIcon: false,
|
|
79
|
+
departments: []
|
|
80
|
+
};
|
|
81
|
+
export default SelectedDepartments;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const searchDepartments = (departments, searchValue) => {
|
|
2
|
+
const validSearchValue = searchValue ? searchValue.trim().toLowerCase() : '';
|
|
3
|
+
const validDepartments = Array.isArray(departments) ? departments : [];
|
|
4
|
+
if (!validSearchValue) return validDepartments;
|
|
5
|
+
return validDepartments.filter(department => {
|
|
6
|
+
const {
|
|
7
|
+
name
|
|
8
|
+
} = department;
|
|
9
|
+
if (!name) return false;
|
|
10
|
+
return name.toString().toLowerCase().indexOf(validSearchValue) > -1;
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export const getNormalizedDepartments = function (departments) {
|
|
14
|
+
let canExpand = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
15
|
+
let parentIdMap = {};
|
|
16
|
+
for (let i = 0; i < departments.length; i++) {
|
|
17
|
+
let item = departments[i];
|
|
18
|
+
parentIdMap[item.parent_id] = true;
|
|
19
|
+
}
|
|
20
|
+
return departments.map(depart => {
|
|
21
|
+
const hasChild = canExpand && !!parentIdMap[depart.id];
|
|
22
|
+
const isExpanded = depart.parent_id === -1 ? true : false;
|
|
23
|
+
return {
|
|
24
|
+
...depart,
|
|
25
|
+
hasChild,
|
|
26
|
+
isExpanded
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
};
|
package/lib/constants/index.js
CHANGED
|
@@ -19,4 +19,7 @@ const DATE_TYPES = {
|
|
|
19
19
|
const SIMPLE_CELL_COLUMNS = [CellType.TEXT, CellType.NUMBER, CellType.DATE, CellType.CTIME, CellType.MTIME, CellType.AUTO_NUMBER, CellType.URL, CellType.EMAIL, CellType.DURATION, CellType.CHECKBOX, CellType.RATE];
|
|
20
20
|
const ARRAY_FORMAT_COLUMNS = [CellType.IMAGE, CellType.FILE, CellType.MULTIPLE_SELECT, CellType.COLLABORATOR];
|
|
21
21
|
const SIMPLE_CELL_FORMULA_RESULTS = [FORMULA_RESULT_TYPE.NUMBER, FORMULA_RESULT_TYPE.STRING, FORMULA_RESULT_TYPE.DATE, FORMULA_RESULT_TYPE.BOOL];
|
|
22
|
-
|
|
22
|
+
const EVENT_BUS_TYPE = {
|
|
23
|
+
OPEN_SELECT: 'open-select'
|
|
24
|
+
};
|
|
25
|
+
export { CellType, NUMBER_TYPES, DATE_TYPES, FORMULA_RESULT_TYPE, SIMPLE_CELL_COLUMNS, ARRAY_FORMAT_COLUMNS, SIMPLE_CELL_FORMULA_RESULTS, EVENT_BUS_TYPE };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export const useClickOutside = (_ref, deps) => {
|
|
3
|
+
let {
|
|
4
|
+
currDOM,
|
|
5
|
+
onClickOutside
|
|
6
|
+
} = _ref;
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const onMousedown = event => {
|
|
9
|
+
if (currDOM && event && currDOM.contains(event.target)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
onClickOutside && onClickOutside(event);
|
|
13
|
+
};
|
|
14
|
+
document.addEventListener('mousedown', onMousedown);
|
|
15
|
+
return () => {
|
|
16
|
+
document.removeEventListener('mousedown', onMousedown);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line
|
|
20
|
+
}, deps || []);
|
|
21
|
+
};
|
package/lib/index.js
CHANGED
|
@@ -70,4 +70,7 @@ export { default as ModalPortal } from './ModalPortal';
|
|
|
70
70
|
export { default as RoleStatusEditor } from './RoleStatusEditor';
|
|
71
71
|
|
|
72
72
|
// setting
|
|
73
|
-
export { default as FieldDisplaySetting } from './FieldDisplaySetting';
|
|
73
|
+
export { default as FieldDisplaySetting } from './FieldDisplaySetting';
|
|
74
|
+
|
|
75
|
+
// popover
|
|
76
|
+
export { default as DTableFiltersPopover } from './DTableFiltersPopover';
|
package/lib/lang/index.js
CHANGED
|
@@ -2,17 +2,26 @@ import de from '../locals/de';
|
|
|
2
2
|
import en from '../locals/en';
|
|
3
3
|
import fr from '../locals/fr';
|
|
4
4
|
import zh_CN from '../locals/zh-CN';
|
|
5
|
+
const zhCN = require('@seafile/seafile-calendar/lib/locale/zh_CN');
|
|
6
|
+
const zhTW = require('@seafile/seafile-calendar/lib/locale/zh_TW');
|
|
7
|
+
const enUS = require('@seafile/seafile-calendar/lib/locale/en_US');
|
|
8
|
+
const frFR = require('@seafile/seafile-calendar/lib/locale/fr_FR');
|
|
9
|
+
const deDE = require('@seafile/seafile-calendar/lib/locale/de_DE');
|
|
10
|
+
const esES = require('@seafile/seafile-calendar/lib/locale/es_ES');
|
|
11
|
+
const plPL = require('@seafile/seafile-calendar/lib/locale/pl_PL');
|
|
12
|
+
const csCZ = require('@seafile/seafile-calendar/lib/locale/cs_CZ');
|
|
13
|
+
const ruRU = require('@seafile/seafile-calendar/lib/locale/ru_RU');
|
|
5
14
|
let langData = {
|
|
6
15
|
'de': de,
|
|
7
16
|
'en': en,
|
|
8
17
|
'fr': fr,
|
|
9
18
|
'zh-cn': zh_CN
|
|
10
19
|
};
|
|
11
|
-
|
|
20
|
+
let LANGUAGE = 'en';
|
|
12
21
|
let LANGUAGE_MAP = langData[LANGUAGE];
|
|
13
22
|
export function setLocale(args) {
|
|
14
|
-
|
|
15
|
-
LANGUAGE_MAP = langData[
|
|
23
|
+
LANGUAGE = typeof args === 'string' ? args : LANGUAGE;
|
|
24
|
+
LANGUAGE_MAP = langData[LANGUAGE];
|
|
16
25
|
}
|
|
17
26
|
export function getLocale(key, def) {
|
|
18
27
|
if (!key) return def;
|
|
@@ -40,4 +49,59 @@ export function substitute(str, obj) {
|
|
|
40
49
|
return val;
|
|
41
50
|
}
|
|
42
51
|
return '';
|
|
52
|
+
}
|
|
53
|
+
export function translateCalendar() {
|
|
54
|
+
const locale = LANGUAGE ? LANGUAGE : 'en';
|
|
55
|
+
let language;
|
|
56
|
+
switch (locale) {
|
|
57
|
+
case 'zh-cn':
|
|
58
|
+
language = zhCN;
|
|
59
|
+
break;
|
|
60
|
+
case 'zh-tw':
|
|
61
|
+
language = zhTW;
|
|
62
|
+
break;
|
|
63
|
+
case 'en':
|
|
64
|
+
language = enUS;
|
|
65
|
+
break;
|
|
66
|
+
case 'fr':
|
|
67
|
+
language = frFR;
|
|
68
|
+
break;
|
|
69
|
+
case 'de':
|
|
70
|
+
language = deDE;
|
|
71
|
+
break;
|
|
72
|
+
case 'es':
|
|
73
|
+
language = esES;
|
|
74
|
+
break;
|
|
75
|
+
case 'es-ar':
|
|
76
|
+
language = esES;
|
|
77
|
+
break;
|
|
78
|
+
case 'es-mx':
|
|
79
|
+
language = esES;
|
|
80
|
+
break;
|
|
81
|
+
case 'pl':
|
|
82
|
+
language = plPL;
|
|
83
|
+
break;
|
|
84
|
+
case 'cs':
|
|
85
|
+
language = csCZ;
|
|
86
|
+
break;
|
|
87
|
+
case 'ru':
|
|
88
|
+
language = ruRU;
|
|
89
|
+
break;
|
|
90
|
+
default:
|
|
91
|
+
language = enUS;
|
|
92
|
+
}
|
|
93
|
+
return language;
|
|
94
|
+
}
|
|
95
|
+
export function getMobileDatePickerLocale() {
|
|
96
|
+
return {
|
|
97
|
+
DatePickerLocale: {
|
|
98
|
+
year: getLocale('Year'),
|
|
99
|
+
month: getLocale('Month'),
|
|
100
|
+
day: getLocale('Day'),
|
|
101
|
+
hour: getLocale('Hour'),
|
|
102
|
+
minute: getLocale('Minute')
|
|
103
|
+
},
|
|
104
|
+
okText: getLocale('Done'),
|
|
105
|
+
dismissText: getLocale('Cancel')
|
|
106
|
+
};
|
|
43
107
|
}
|
package/lib/locals/en.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable quotes */
|
|
1
2
|
const en = {
|
|
2
3
|
Add_an_option: 'Add an option',
|
|
3
4
|
Find_an_option: 'Find a option',
|
|
@@ -16,6 +17,73 @@ const en = {
|
|
|
16
17
|
Are_you_sure_you_want_to_delete_this_file: 'Are you sure you want to delete this file?',
|
|
17
18
|
Are_you_sure_you_want_to_delete_this_image: 'Are you sure you want to delete this image?',
|
|
18
19
|
Cancel: 'Cancel',
|
|
19
|
-
Delete: 'Delete'
|
|
20
|
+
Delete: 'Delete',
|
|
21
|
+
Find_a_department: 'Find a department',
|
|
22
|
+
No_departments_available: 'No departments available',
|
|
23
|
+
Current_user_department: 'Current user\'s department',
|
|
24
|
+
Current_user_department_and_sub: 'Current user\'s department and sub-departments',
|
|
25
|
+
Specific_departments: 'Specific departments',
|
|
26
|
+
Deleted_department: 'Deleted department',
|
|
27
|
+
Add_filter: 'Add filter',
|
|
28
|
+
Submit: 'Submit',
|
|
29
|
+
No_filters: 'No filters',
|
|
30
|
+
Select_an_option: 'Select an option',
|
|
31
|
+
Add_collaborator: 'Add collaborator',
|
|
32
|
+
Add_a_creator: 'Add a creator',
|
|
33
|
+
Add_a_last_modifier: 'Add a last modifier',
|
|
34
|
+
Invalid_filter: 'Invalid filter',
|
|
35
|
+
Find_column: 'Find column',
|
|
36
|
+
No_results: 'No results',
|
|
37
|
+
'Select_option(s)': 'Select option(s)',
|
|
38
|
+
"contains": "contains",
|
|
39
|
+
"does_not_contain": "does not contain",
|
|
40
|
+
"is": "is",
|
|
41
|
+
"is_not": "is not",
|
|
42
|
+
"equal": "\u003d",
|
|
43
|
+
"not_equal": "\u2260",
|
|
44
|
+
"less": "\u003C",
|
|
45
|
+
"greater": "\u003E",
|
|
46
|
+
"less_or_equal": "\u2264",
|
|
47
|
+
"greater_or_equal": "\u2265",
|
|
48
|
+
"is_empty": "is empty",
|
|
49
|
+
"is_not_empty": "is not empty",
|
|
50
|
+
"is_within": "is within",
|
|
51
|
+
"is_before": "is before",
|
|
52
|
+
"is_after": "is after",
|
|
53
|
+
"is_on_or_before": "is on or before",
|
|
54
|
+
"is_on_or_after": "is on or after",
|
|
55
|
+
"has_any_of": "has any of",
|
|
56
|
+
"has_all_of": "has all of",
|
|
57
|
+
"has_none_of": "has none of",
|
|
58
|
+
"is_exactly": "is exactly",
|
|
59
|
+
"is_current_user_ID": "is current user's ID",
|
|
60
|
+
"Current_date": "Current date",
|
|
61
|
+
"Specific_date": "Specific date",
|
|
62
|
+
"x_days_before_current_date": "x days before current date",
|
|
63
|
+
"x_days_after_current_date": "x days after current date",
|
|
64
|
+
"is_any_of": "is any of",
|
|
65
|
+
"is_none_of": "is none of",
|
|
66
|
+
"include_me": "include the current user",
|
|
67
|
+
"today": "today",
|
|
68
|
+
"tomorrow": "tomorrow",
|
|
69
|
+
"yesterday": "yesterday",
|
|
70
|
+
"one_week_ago": "one week ago",
|
|
71
|
+
"one_week_from_now": "one week from now",
|
|
72
|
+
"one_month_ago": "one month ago",
|
|
73
|
+
"one_month_from_now": "one month from now",
|
|
74
|
+
"number_of_days_ago": "number of days ago",
|
|
75
|
+
"number_of_days_from_now": "number of days from now",
|
|
76
|
+
"exact_date": "exact date",
|
|
77
|
+
"the_past_week": "last week",
|
|
78
|
+
"the_past_month": "last month",
|
|
79
|
+
"the_past_year": "last year",
|
|
80
|
+
"the_next_week": "the next week",
|
|
81
|
+
"the_next_month": "the next month",
|
|
82
|
+
"the_next_year": "the next year",
|
|
83
|
+
"the_next_numbers_of_days": "the next numbers of days",
|
|
84
|
+
"the_past_numbers_of_days": "the past numbers of days",
|
|
85
|
+
"this_week": "this week",
|
|
86
|
+
"this_month": "this month",
|
|
87
|
+
"this_year": "this year"
|
|
20
88
|
};
|
|
21
89
|
export default en;
|
package/lib/locals/zh-CN.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable quotes */
|
|
1
2
|
const zh_CN = {
|
|
2
3
|
Add_an_option: '添加一个选项',
|
|
3
4
|
Find_an_option: '查找标签',
|
|
@@ -16,6 +17,72 @@ const zh_CN = {
|
|
|
16
17
|
Are_you_sure_you_want_to_delete_this_file: '你确定要删除此文件吗?',
|
|
17
18
|
Are_you_sure_you_want_to_delete_this_image: '你确定要删除此图片吗?',
|
|
18
19
|
Cancel: '取消',
|
|
19
|
-
Delete: '删除'
|
|
20
|
+
Delete: '删除',
|
|
21
|
+
Find_a_department: "查找部门",
|
|
22
|
+
Current_user_department: "当前用户的部门",
|
|
23
|
+
Current_user_department_and_sub: "当前用户的部门和子部门",
|
|
24
|
+
Specific_departments: "具体部门",
|
|
25
|
+
Deleted_department: "已经删除的部门",
|
|
26
|
+
Add_filter: '添加过滤',
|
|
27
|
+
Submit: '提交',
|
|
28
|
+
No_filters: '没有过滤条件',
|
|
29
|
+
Select_an_option: '选择标签',
|
|
30
|
+
Add_collaborator: '添加协作人',
|
|
31
|
+
Add_a_creator: '增加创建者',
|
|
32
|
+
Add_a_last_modifier: '增加最后修改者',
|
|
33
|
+
Invalid_filter: '无效的过滤器',
|
|
34
|
+
Find_column: '查找列',
|
|
35
|
+
No_results: '没有结果',
|
|
36
|
+
'Select_option(s)': '选择标签',
|
|
37
|
+
"contains": "包含",
|
|
38
|
+
"does_not_contain": "不包含",
|
|
39
|
+
"is": "是",
|
|
40
|
+
"is_not": "不是",
|
|
41
|
+
"equal": "=",
|
|
42
|
+
"not_equal": "≠",
|
|
43
|
+
"less": "<",
|
|
44
|
+
"greater": ">",
|
|
45
|
+
"less_or_equal": "≤",
|
|
46
|
+
"greater_or_equal": "≥",
|
|
47
|
+
"is_empty": "是空",
|
|
48
|
+
"is_not_empty": "不是空",
|
|
49
|
+
"is_within": "在某段时间内",
|
|
50
|
+
"is_before": "在某天之前",
|
|
51
|
+
"is_after": "在某天之后",
|
|
52
|
+
"is_on_or_before": "在某天或之前",
|
|
53
|
+
"is_on_or_after": "在某天或之后",
|
|
54
|
+
"has_any_of": "包含其中一个",
|
|
55
|
+
"has_all_of": "包含所有",
|
|
56
|
+
"has_none_of": "不包含",
|
|
57
|
+
"is_exactly": "精确筛选",
|
|
58
|
+
"is_current_user_ID": "是当前用户的 ID",
|
|
59
|
+
"Current_date": "当前日期",
|
|
60
|
+
"Specific_date": "指定日期",
|
|
61
|
+
"x_days_before_current_date": "当前日期的前 X 天",
|
|
62
|
+
"x_days_after_current_date": "当前日期的后 X 天",
|
|
63
|
+
"is_any_of": "是任意一个...",
|
|
64
|
+
"is_none_of": "不是任意一个...",
|
|
65
|
+
"include_me": "包括当前用户",
|
|
66
|
+
"today": "今天",
|
|
67
|
+
"tomorrow": "明天",
|
|
68
|
+
"yesterday": "昨天",
|
|
69
|
+
"one_week_ago": "一周前",
|
|
70
|
+
"one_week_from_now": "一周后",
|
|
71
|
+
"one_month_ago": "一个月前",
|
|
72
|
+
"one_month_from_now": "一个月后",
|
|
73
|
+
"number_of_days_ago": "特定天数前",
|
|
74
|
+
"number_of_days_from_now": "特定天数后",
|
|
75
|
+
"exact_date": "精确日期",
|
|
76
|
+
"the_past_week": "上个星期",
|
|
77
|
+
"the_past_month": "上个月",
|
|
78
|
+
"the_past_year": "去年",
|
|
79
|
+
"the_next_week": "下个星期",
|
|
80
|
+
"the_next_month": "下个月",
|
|
81
|
+
"the_next_year": "下一年",
|
|
82
|
+
"the_next_numbers_of_days": "今天之后的指定天数",
|
|
83
|
+
"the_past_numbers_of_days": "今天之前的指定天数",
|
|
84
|
+
"this_week": "这个星期",
|
|
85
|
+
"this_month": "这个月",
|
|
86
|
+
"this_year": "今年"
|
|
20
87
|
};
|
|
21
88
|
export default zh_CN;
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
transition: translateY(1px);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
.dtable-ui-mb-select-editor-body .mb-create-select-item .add-new-option {
|
|
122
|
+
.dtable-ui-mb-select-editor-body .mb-create-select-item .dtable-ui-add-new-option {
|
|
123
123
|
font-size: 14px;
|
|
124
124
|
font-weight: 500px;
|
|
125
125
|
}
|
|
@@ -176,7 +176,7 @@ class MBSelectEditorPopover extends React.Component {
|
|
|
176
176
|
}, /*#__PURE__*/React.createElement("i", {
|
|
177
177
|
className: "dtable-font dtable-icon-add-table"
|
|
178
178
|
}), /*#__PURE__*/React.createElement("span", {
|
|
179
|
-
className: "add-new-option"
|
|
179
|
+
className: "dtable-ui-add-new-option"
|
|
180
180
|
}, "".concat(getLocale('Add_an_option'), " ").concat(searchVal)))));
|
|
181
181
|
}
|
|
182
182
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class EventBus {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.subscribers = {};
|
|
4
|
+
}
|
|
5
|
+
subscribe(type, handler) {
|
|
6
|
+
if (!this.subscribers[type]) {
|
|
7
|
+
this.subscribers[type] = [];
|
|
8
|
+
}
|
|
9
|
+
const handlers = this.subscribers[type];
|
|
10
|
+
handlers.push(handler);
|
|
11
|
+
return () => {
|
|
12
|
+
const index = handlers.indexOf(handler);
|
|
13
|
+
if (index > -1) {
|
|
14
|
+
handlers.splice(index, 1);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
dispatch(type) {
|
|
19
|
+
for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
20
|
+
data[_key - 1] = arguments[_key];
|
|
21
|
+
}
|
|
22
|
+
const handlers = this.subscribers[type];
|
|
23
|
+
if (Array.isArray(handlers)) {
|
|
24
|
+
handlers.forEach(handler => handler(...data));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export default new EventBus();
|
package/lib/utils/utils.js
CHANGED
|
@@ -37,4 +37,9 @@ export const downloadFile = downloadUrl => {
|
|
|
37
37
|
iframe.style.display = 'none';
|
|
38
38
|
iframe.src = downloadUrl;
|
|
39
39
|
document.body.appendChild(iframe);
|
|
40
|
+
};
|
|
41
|
+
export const getEventClassName = e => {
|
|
42
|
+
// svg mouseEvent event.target.className is an object
|
|
43
|
+
if (!e || !e.target) return '';
|
|
44
|
+
return e.target.getAttribute('class') || '';
|
|
40
45
|
};
|