dtable-ui-component 4.4.3-2 → 4.4.3-alpha1
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/AutoNumberFormatter/index.js +7 -14
- package/lib/ButtonFormatter/index.js +9 -16
- package/lib/CTimeFormatter/index.js +9 -16
- package/lib/CheckboxEditor/index.js +8 -15
- package/lib/CheckboxFormatter/index.js +8 -15
- package/lib/CollaboratorEditor/index.js +21 -29
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +25 -32
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +18 -25
- package/lib/CollaboratorFormatter/index.js +12 -19
- package/lib/CollaboratorItem/index.js +10 -17
- package/lib/CreatorFormatter/index.js +12 -19
- package/lib/DTableCommonAddTool/index.js +6 -13
- package/lib/DTableCustomizeCollaboratorSelect/index.js +18 -26
- package/lib/DTableCustomizeSelect/index.js +15 -23
- package/lib/DTableFiltersPopover/constants/index.js +33 -38
- package/lib/DTableFiltersPopover/index.js +31 -38
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +46 -53
- package/lib/DTableFiltersPopover/utils/index.js +99 -128
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +26 -34
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +25 -33
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +26 -34
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +26 -34
- package/lib/DTableFiltersPopover/widgets/filter-item.js +120 -128
- package/lib/DTableFiltersPopover/widgets/filter-list/index.js +18 -26
- package/lib/DTableFiltersPopover/widgets/rate-item.js +8 -15
- package/lib/DTablePopover/index.js +8 -15
- package/lib/DTablePopover/utils.js +2 -9
- package/lib/DTableRadio/index.js +10 -17
- package/lib/DTableSearchInput/index.js +13 -21
- package/lib/DTableSearchInput/utils.js +2 -9
- package/lib/DTableSelect/dtable-select-label.js +6 -13
- package/lib/DTableSelect/index.js +10 -18
- package/lib/DTableSelect/utils.js +10 -20
- package/lib/DTableSwitch/index.js +7 -14
- package/lib/DateEditor/index.js +22 -30
- package/lib/DateEditor/mb-date-editor-popover/index.js +47 -55
- package/lib/DateEditor/pc-date-editor-popover.js +20 -27
- package/lib/DateFormatter/index.js +9 -16
- package/lib/Department-editor/constants.js +1 -7
- package/lib/Department-editor/department-multiple-select/index.js +24 -32
- package/lib/Department-editor/department-single-select.js +33 -41
- package/lib/Department-editor/index.js +14 -22
- package/lib/Department-editor/selected-departments/index.js +25 -32
- package/lib/Department-editor/utils.js +3 -11
- package/lib/DepartmentSingleSelectFormatter/index.js +9 -16
- package/lib/DigitalSignFormatter/index.js +15 -23
- package/lib/DigitalSignFormatter/utils.js +3 -11
- package/lib/DurationFormatter/index.js +9 -16
- package/lib/EditEditorButton/index.js +5 -12
- package/lib/EmailFormatter/index.js +7 -14
- package/lib/FieldDisplaySetting/field-item.js +14 -21
- package/lib/FieldDisplaySetting/index.js +19 -27
- package/lib/FileEditor/index.js +8 -15
- package/lib/FileEditor/pc-files-addition/index.js +0 -1
- package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
- package/lib/FileEditor/pc-files-preview/index.js +0 -1
- package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
- package/lib/FileFormatter/index.js +11 -19
- package/lib/FileItemFormatter/index.js +6 -14
- package/lib/FileItemFormatter/utils.js +2 -9
- package/lib/FileUploader/index.js +4 -11
- package/lib/FormulaFormatter/cell-value-validator.js +18 -24
- package/lib/FormulaFormatter/index.js +32 -39
- package/lib/FormulaFormatter/utils.js +13 -29
- package/lib/GeolocationFormatter/index.js +9 -16
- package/lib/HtmlLongTextFormatter/index.js +9 -17
- package/lib/HtmlLongTextFormatter/markdown2html.js +47 -0
- package/lib/HtmlLongTextFormatter/unified/index.js +400 -0
- package/lib/HtmlLongTextFormatter/vfile/core.js +155 -0
- package/lib/HtmlLongTextFormatter/vfile/index.js +40 -0
- package/lib/ImageFormatter/images-lazy-load.js +9 -16
- package/lib/ImageFormatter/index.js +16 -24
- package/lib/ImageFormatter/utils.js +2 -9
- package/lib/ImagePreviewerLightbox/index.js +12 -19
- package/lib/ImagePreviewerLightbox/utils.js +3 -11
- package/lib/LastModifierFormatter/index.js +12 -19
- package/lib/LinkEditor/index.js +25 -33
- package/lib/LinkEditor/link-editor-option.js +8 -15
- package/lib/LinkEditor/mb-link-editor-popover/index.js +23 -30
- package/lib/LinkEditor/pc-link-editor-popover/index.js +17 -24
- package/lib/LinkFormatter/index.js +13 -20
- package/lib/Loading/index.js +4 -11
- package/lib/LongTextFormatter/index.js +6 -13
- package/lib/MBEditorHeader/index.js +7 -14
- package/lib/MTimeFormatter/index.js +9 -16
- package/lib/ModalPortal/index.js +5 -12
- package/lib/MultipleSelectEditor/index.js +17 -25
- package/lib/MultipleSelectFormatter/index.js +10 -17
- package/lib/NotificationPopover/index.js +16 -24
- package/lib/NumberEditor/index.js +18 -25
- package/lib/NumberFormatter/index.js +9 -16
- package/lib/RateFormatter/index.js +8 -15
- package/lib/RoleStatusEditor/index.js +14 -22
- package/lib/RowExpandEmailFormatter/index.js +10 -17
- package/lib/RowExpandFileFormatter/index.js +8 -16
- package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +18 -27
- package/lib/RowExpandFormatter/index.js +78 -86
- package/lib/RowExpandFormulaFormatter/index.js +34 -42
- package/lib/RowExpandImageFormatter/index.js +10 -19
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +18 -27
- package/lib/RowExpandImageFormatter/utils.js +2 -9
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +7 -16
- package/lib/RowExpandLinkFormatter/index.js +37 -46
- package/lib/RowExpandLinkFormatter/utils.js +6 -17
- package/lib/RowExpandLinkFormatter/value-display-utils.js +5 -12
- package/lib/RowExpandRateFormatter/index.js +8 -15
- package/lib/RowExpandUrlFormatter/index.js +14 -21
- package/lib/SelectItem/index.js +4 -12
- package/lib/SelectOptionGroup/KeyCodes.js +1 -7
- package/lib/SelectOptionGroup/index.js +33 -32
- package/lib/SelectOptionGroup/option.js +4 -19
- package/lib/SimpleLongTextFormatter/index.js +20 -27
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +1 -7
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +8 -15
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +7 -14
- package/lib/SingleSelectEditor/index.js +18 -26
- package/lib/SingleSelectFormatter/index.js +9 -16
- package/lib/TextEditor/index.js +7 -14
- package/lib/TextFormatter/index.js +7 -14
- package/lib/UrlFormatter/index.js +7 -14
- package/lib/cellFormatterFactory/index.js +4 -11
- package/lib/common/ClickOutside.js +4 -12
- package/lib/common/delete-tip.js +12 -20
- package/lib/common/modal-portal.js +5 -13
- package/lib/constants/index.js +9 -28
- package/lib/data/dtable-value.js +6 -11
- package/lib/formatterConfig/base-formatter-config.js +46 -53
- package/lib/formatterConfig/index.js +9 -16
- package/lib/hooks/common-hooks.js +4 -11
- package/lib/index.js +75 -432
- package/lib/lang/index.js +13 -24
- package/lib/locals/de.js +1 -7
- package/lib/locals/en.js +1 -7
- package/lib/locals/fr.js +1 -7
- package/lib/locals/zh-CN.js +1 -7
- package/lib/select-editor/index.js +4 -27
- package/lib/select-editor/mb-select-editor-popover/index.js +33 -41
- package/lib/select-editor/pc-select-editor-popover/index.js +19 -26
- package/lib/select-editor/select-editor-option.js +8 -15
- package/lib/toaster/alert.js +11 -18
- package/lib/toaster/index.js +3 -10
- package/lib/toaster/toast.js +8 -16
- package/lib/toaster/toastManager.js +5 -13
- package/lib/toaster/toaster.js +7 -15
- package/lib/utils/dayjs.js +4 -11
- package/lib/utils/editor-utils.js +5 -15
- package/lib/utils/event-bus.js +1 -7
- package/lib/utils/utils.js +6 -17
- package/package.json +77 -63
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _dtableUtils = require("dtable-utils");
|
|
12
|
-
var _filterItem = _interopRequireDefault(require("../filter-item"));
|
|
13
|
-
var _utils = require("../../utils");
|
|
14
|
-
require("./index.css");
|
|
15
|
-
class FiltersList extends _react.Component {
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { CellType, FILTER_COLUMN_OPTIONS, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, ValidateFilter } from 'dtable-utils';
|
|
4
|
+
import FilterItem from '../filter-item';
|
|
5
|
+
import { getColumnByKey, FilterItemUtils } from '../../utils';
|
|
6
|
+
import './index.css';
|
|
7
|
+
class FiltersList extends Component {
|
|
16
8
|
constructor(props) {
|
|
17
9
|
super(props);
|
|
18
10
|
this.updateFilter = (filterIndex, updatedFilter) => {
|
|
@@ -30,7 +22,7 @@ class FiltersList extends _react.Component {
|
|
|
30
22
|
};
|
|
31
23
|
this.getConjunctionOptions = () => {
|
|
32
24
|
if (!this.conjunctionOptions) {
|
|
33
|
-
this.conjunctionOptions =
|
|
25
|
+
this.conjunctionOptions = FilterItemUtils.generatorConjunctionOptions();
|
|
34
26
|
}
|
|
35
27
|
return this.conjunctionOptions;
|
|
36
28
|
};
|
|
@@ -45,17 +37,17 @@ class FiltersList extends _react.Component {
|
|
|
45
37
|
let {
|
|
46
38
|
type
|
|
47
39
|
} = column;
|
|
48
|
-
if (data && (type ===
|
|
40
|
+
if (data && (type === CellType.LINK || FORMULA_COLUMN_TYPES_MAP[type] && data.result_type === FORMULA_RESULT_TYPE.ARRAY)) {
|
|
49
41
|
type = data.array_type;
|
|
50
42
|
}
|
|
51
|
-
return Object.prototype.hasOwnProperty.call(
|
|
43
|
+
return Object.prototype.hasOwnProperty.call(FILTER_COLUMN_OPTIONS, type);
|
|
52
44
|
});
|
|
53
45
|
};
|
|
54
46
|
this.getColumnOptions = () => {
|
|
55
47
|
if (!this.columnOptions) {
|
|
56
48
|
const filterColumns = this.getFilterColumns();
|
|
57
49
|
this.columnOptions = filterColumns.map(column => {
|
|
58
|
-
return
|
|
50
|
+
return FilterItemUtils.generatorColumnOption(column);
|
|
59
51
|
});
|
|
60
52
|
}
|
|
61
53
|
return this.columnOptions;
|
|
@@ -73,7 +65,7 @@ class FiltersList extends _react.Component {
|
|
|
73
65
|
} = this.props;
|
|
74
66
|
const conjunctionOptions = this.getConjunctionOptions();
|
|
75
67
|
const columnOptions = this.getColumnOptions();
|
|
76
|
-
return /*#__PURE__*/
|
|
68
|
+
return /*#__PURE__*/React.createElement(FilterItem, {
|
|
77
69
|
key: index,
|
|
78
70
|
isLocked: isLocked,
|
|
79
71
|
roleId: roleId,
|
|
@@ -110,13 +102,13 @@ class FiltersList extends _react.Component {
|
|
|
110
102
|
columns
|
|
111
103
|
} = this.props;
|
|
112
104
|
const isEmpty = filters.length === 0;
|
|
113
|
-
return /*#__PURE__*/
|
|
114
|
-
className: (
|
|
105
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: classnames('filters-list', {
|
|
115
107
|
'empty-filters-container': isEmpty
|
|
116
108
|
}, {
|
|
117
109
|
[className]: className
|
|
118
110
|
})
|
|
119
|
-
}, isEmpty && /*#__PURE__*/
|
|
111
|
+
}, isEmpty && /*#__PURE__*/React.createElement("div", {
|
|
120
112
|
className: "empty-filters-list"
|
|
121
113
|
}, emptyPlaceholder), !isEmpty && filters.map((filter, index) => {
|
|
122
114
|
const {
|
|
@@ -124,10 +116,10 @@ class FiltersList extends _react.Component {
|
|
|
124
116
|
} = filter;
|
|
125
117
|
const {
|
|
126
118
|
error_message
|
|
127
|
-
} =
|
|
128
|
-
const filterColumn =
|
|
119
|
+
} = ValidateFilter.validateColumn(column_key, columns);
|
|
120
|
+
const filterColumn = getColumnByKey(columns, column_key) || {};
|
|
129
121
|
return this.renderFilterItem(filter, index, error_message, filterColumn);
|
|
130
122
|
}));
|
|
131
123
|
}
|
|
132
124
|
}
|
|
133
|
-
|
|
125
|
+
export default FiltersList;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactstrap = require("reactstrap");
|
|
10
|
-
class RateItem extends _react.default.Component {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UncontrolledTooltip } from 'reactstrap';
|
|
3
|
+
class RateItem extends React.Component {
|
|
11
4
|
constructor(props) {
|
|
12
5
|
super(props);
|
|
13
6
|
this.onMouseEnterRateItem = () => {
|
|
@@ -29,7 +22,7 @@ class RateItem extends _react.default.Component {
|
|
|
29
22
|
onChangeRateNumber(rateItemIndex);
|
|
30
23
|
}
|
|
31
24
|
};
|
|
32
|
-
this.tooltipRef =
|
|
25
|
+
this.tooltipRef = React.createRef();
|
|
33
26
|
this.state = {
|
|
34
27
|
isOpen: false
|
|
35
28
|
};
|
|
@@ -61,19 +54,19 @@ class RateItem extends _react.default.Component {
|
|
|
61
54
|
opacity: 0.4
|
|
62
55
|
};
|
|
63
56
|
}
|
|
64
|
-
return /*#__PURE__*/
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
65
58
|
onMouseEnter: this.onMouseEnterRateItem,
|
|
66
59
|
onMouseLeave: this.onMouseLeaveRateItem,
|
|
67
60
|
style: style,
|
|
68
61
|
onClick: this.onChangeRateNumber,
|
|
69
62
|
className: "rate-item ".concat(value >= rateItemIndex ? 'rate-item-active' : '')
|
|
70
|
-
}, /*#__PURE__*/
|
|
63
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
71
64
|
className: "dtable-font ".concat(rateShowType),
|
|
72
65
|
ref: this.tooltipRef
|
|
73
|
-
}), editable && /*#__PURE__*/
|
|
66
|
+
}), editable && /*#__PURE__*/React.createElement(UncontrolledTooltip, {
|
|
74
67
|
placement: "bottom",
|
|
75
68
|
target: this.tooltipRef
|
|
76
69
|
}, rateItemIndex));
|
|
77
70
|
}
|
|
78
71
|
}
|
|
79
|
-
|
|
72
|
+
export default RateItem;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactstrap = require("reactstrap");
|
|
10
|
-
var _utils = require("../utils/utils");
|
|
11
|
-
class DTablePopover extends _react.default.Component {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Popover } from 'reactstrap';
|
|
3
|
+
import { getEventClassName } from '../utils/utils';
|
|
4
|
+
class DTablePopover extends React.Component {
|
|
12
5
|
constructor() {
|
|
13
6
|
super(...arguments);
|
|
14
7
|
this.dtablePopoverRef = null;
|
|
@@ -35,7 +28,7 @@ class DTablePopover extends _react.default.Component {
|
|
|
35
28
|
canHideDTablePopover
|
|
36
29
|
} = this.props;
|
|
37
30
|
if (!canHideDTablePopover) return;
|
|
38
|
-
if (this.dtablePopoverRef && e &&
|
|
31
|
+
if (this.dtablePopoverRef && e && getEventClassName(e).indexOf('popover') === -1 && !this.dtablePopoverRef.contains(e.target)) {
|
|
39
32
|
this.props.hideDTablePopover(e);
|
|
40
33
|
}
|
|
41
34
|
};
|
|
@@ -62,7 +55,7 @@ class DTablePopover extends _react.default.Component {
|
|
|
62
55
|
modifiers,
|
|
63
56
|
placement
|
|
64
57
|
} = this.props;
|
|
65
|
-
return /*#__PURE__*/
|
|
58
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
66
59
|
placement: placement,
|
|
67
60
|
isOpen: true,
|
|
68
61
|
target: target,
|
|
@@ -71,7 +64,7 @@ class DTablePopover extends _react.default.Component {
|
|
|
71
64
|
innerClassName: innerClassName,
|
|
72
65
|
className: popoverClassName,
|
|
73
66
|
modifiers: modifiers
|
|
74
|
-
}, /*#__PURE__*/
|
|
67
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
75
68
|
ref: ref => this.dtablePopoverRef = ref,
|
|
76
69
|
onClick: this.onPopoverInsideClick
|
|
77
70
|
}, this.props.children));
|
|
@@ -82,4 +75,4 @@ DTablePopover.defaultProps = {
|
|
|
82
75
|
hideArrow: true,
|
|
83
76
|
canHideDTablePopover: true
|
|
84
77
|
};
|
|
85
|
-
|
|
78
|
+
export default DTablePopover;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getEventClassName = void 0;
|
|
7
|
-
const getEventClassName = e => {
|
|
1
|
+
export const getEventClassName = e => {
|
|
8
2
|
// svg mouseEvent event.target.className is an object
|
|
9
3
|
if (!e || !e.target) return '';
|
|
10
4
|
return e.target.getAttribute('class') || '';
|
|
11
|
-
};
|
|
12
|
-
exports.getEventClassName = getEventClassName;
|
|
5
|
+
};
|
package/lib/DTableRadio/index.js
CHANGED
|
@@ -1,35 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
require("./index.css");
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import './index.css';
|
|
11
4
|
function DTableRadio(props) {
|
|
12
5
|
const {
|
|
13
6
|
className
|
|
14
7
|
} = props;
|
|
15
|
-
return /*#__PURE__*/
|
|
16
|
-
className: (
|
|
8
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
9
|
+
className: classnames('dtable-radio w-100 align-items-center', {
|
|
17
10
|
'dtable-radio-disable': props.disabled,
|
|
18
11
|
[className]: className
|
|
19
12
|
})
|
|
20
|
-
}, /*#__PURE__*/
|
|
13
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
21
14
|
type: "radio",
|
|
22
15
|
className: "dtable-radio-input position-absolute",
|
|
23
16
|
checked: props.isChecked,
|
|
24
17
|
onChange: props.disabled ? () => {} : props.onCheckedChange,
|
|
25
18
|
name: props.name,
|
|
26
19
|
value: props.value
|
|
27
|
-
}), /*#__PURE__*/
|
|
28
|
-
className: (
|
|
20
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
21
|
+
className: classnames('dtable-radio-indicator position-relative', {
|
|
29
22
|
'dtable-radio-selected-indicator': props.isChecked,
|
|
30
23
|
'dtable-radio-indicator-disable': props.disabled
|
|
31
24
|
})
|
|
32
|
-
}), /*#__PURE__*/
|
|
25
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
33
26
|
className: "dtable-radio-description text-truncate ml-2"
|
|
34
27
|
}, props.label));
|
|
35
28
|
}
|
|
@@ -38,4 +31,4 @@ DTableRadio.defaultProps = {
|
|
|
38
31
|
name: 'dtable-radio-input',
|
|
39
32
|
onCheckedChange: () => {}
|
|
40
33
|
};
|
|
41
|
-
|
|
34
|
+
export default DTableRadio;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _utils = require("./utils");
|
|
12
|
-
class DtableSearchInput extends _react.Component {
|
|
1
|
+
import React, { Component, Fragment } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { isFunction } from './utils';
|
|
4
|
+
class DtableSearchInput extends Component {
|
|
13
5
|
constructor(props) {
|
|
14
6
|
super(props);
|
|
15
7
|
this.onCompositionStart = () => {
|
|
@@ -66,17 +58,17 @@ class DtableSearchInput extends _react.Component {
|
|
|
66
58
|
const {
|
|
67
59
|
ClearIndicator
|
|
68
60
|
} = components;
|
|
69
|
-
if (
|
|
70
|
-
return
|
|
61
|
+
if (React.isValidElement(ClearIndicator)) {
|
|
62
|
+
return React.cloneElement(ClearIndicator, {
|
|
71
63
|
clearValue: this.clearSearch
|
|
72
64
|
});
|
|
73
|
-
} else if (
|
|
74
|
-
return /*#__PURE__*/
|
|
65
|
+
} else if (isFunction(ClearIndicator)) {
|
|
66
|
+
return /*#__PURE__*/React.createElement(ClearIndicator, {
|
|
75
67
|
clearValue: this.clearSearch
|
|
76
68
|
});
|
|
77
69
|
}
|
|
78
|
-
return /*#__PURE__*/
|
|
79
|
-
className: (
|
|
70
|
+
return /*#__PURE__*/React.createElement("i", {
|
|
71
|
+
className: classnames('search-text-clear input-icon-addon', clearClassName),
|
|
80
72
|
onClick: this.clearSearch
|
|
81
73
|
}, "\xD7");
|
|
82
74
|
};
|
|
@@ -111,10 +103,10 @@ class DtableSearchInput extends _react.Component {
|
|
|
111
103
|
const {
|
|
112
104
|
searchValue
|
|
113
105
|
} = this.state;
|
|
114
|
-
return /*#__PURE__*/
|
|
106
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("input", {
|
|
115
107
|
type: "text",
|
|
116
108
|
value: searchValue,
|
|
117
|
-
className: (
|
|
109
|
+
className: classnames('form-control', className),
|
|
118
110
|
onChange: this.onChange,
|
|
119
111
|
autoFocus: autoFocus,
|
|
120
112
|
placeholder: placeholder,
|
|
@@ -132,4 +124,4 @@ DtableSearchInput.defaultProps = {
|
|
|
132
124
|
disabled: false,
|
|
133
125
|
value: ''
|
|
134
126
|
};
|
|
135
|
-
|
|
127
|
+
export default DtableSearchInput;
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isFunction = void 0;
|
|
7
|
-
const isFunction = functionToCheck => {
|
|
1
|
+
export const isFunction = functionToCheck => {
|
|
8
2
|
const getType = {};
|
|
9
3
|
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
10
|
-
};
|
|
11
|
-
exports.isFunction = isFunction;
|
|
4
|
+
};
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
require("./dtable-select-label.css");
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './dtable-select-label.css';
|
|
10
3
|
function DTableSelectLabel(_ref) {
|
|
11
4
|
let {
|
|
12
5
|
classname,
|
|
13
6
|
name,
|
|
14
7
|
isSelect
|
|
15
8
|
} = _ref;
|
|
16
|
-
return /*#__PURE__*/
|
|
9
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
17
10
|
className: "".concat(classname, " w-100 d-flex justify-content-between")
|
|
18
|
-
}, /*#__PURE__*/
|
|
11
|
+
}, /*#__PURE__*/React.createElement("span", null, name), isSelect && /*#__PURE__*/React.createElement("div", {
|
|
19
12
|
className: "dtable-select-check-icon"
|
|
20
|
-
}, /*#__PURE__*/
|
|
13
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
21
14
|
className: "dtable-font dtable-icon-check-mark"
|
|
22
15
|
})));
|
|
23
16
|
}
|
|
@@ -26,4 +19,4 @@ DTableSelectLabel.defaultProps = {
|
|
|
26
19
|
name: '',
|
|
27
20
|
isSelect: false
|
|
28
21
|
};
|
|
29
|
-
|
|
22
|
+
export default DTableSelectLabel;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactSelect = _interopRequireDefault(require("react-select"));
|
|
10
|
-
var _utils = require("./utils");
|
|
11
|
-
class DTableSelect extends _react.default.Component {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Select from 'react-select';
|
|
3
|
+
import { MenuSelectStyle, DropdownIndicator, ClearIndicator, MenuList, Option } from './utils';
|
|
4
|
+
export default class DTableSelect extends React.Component {
|
|
12
5
|
render() {
|
|
13
6
|
const {
|
|
14
7
|
options,
|
|
@@ -27,18 +20,18 @@ class DTableSelect extends _react.default.Component {
|
|
|
27
20
|
form,
|
|
28
21
|
customFilterOption
|
|
29
22
|
} = this.props;
|
|
30
|
-
return /*#__PURE__*/
|
|
23
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
31
24
|
value: value,
|
|
32
25
|
onChange: onChange,
|
|
33
26
|
options: options,
|
|
34
27
|
isMulti: isMulti,
|
|
35
28
|
classNamePrefix: classNamePrefix,
|
|
36
|
-
styles: style ||
|
|
29
|
+
styles: style || MenuSelectStyle,
|
|
37
30
|
components: {
|
|
38
|
-
Option
|
|
39
|
-
DropdownIndicator
|
|
40
|
-
MenuList
|
|
41
|
-
ClearIndicator
|
|
31
|
+
Option,
|
|
32
|
+
DropdownIndicator,
|
|
33
|
+
MenuList,
|
|
34
|
+
ClearIndicator
|
|
42
35
|
},
|
|
43
36
|
placeholder: placeholder,
|
|
44
37
|
isSearchable: isSearchable,
|
|
@@ -57,7 +50,6 @@ class DTableSelect extends _react.default.Component {
|
|
|
57
50
|
});
|
|
58
51
|
}
|
|
59
52
|
}
|
|
60
|
-
exports.default = DTableSelect;
|
|
61
53
|
DTableSelect.defaultProps = {
|
|
62
54
|
options: [],
|
|
63
55
|
value: {},
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.Option = exports.MenuSelectStyle = exports.MenuList = exports.DropdownIndicator = exports.ClearIndicator = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactSelect = require("react-select");
|
|
10
|
-
const MenuSelectStyle = exports.MenuSelectStyle = {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { components } from 'react-select';
|
|
3
|
+
const MenuSelectStyle = {
|
|
11
4
|
option: (provided, state) => {
|
|
12
5
|
const {
|
|
13
6
|
isDisabled,
|
|
@@ -37,14 +30,13 @@ const MenuSelectStyle = exports.MenuSelectStyle = {
|
|
|
37
30
|
indicatorSeparator: () => {}
|
|
38
31
|
};
|
|
39
32
|
const DropdownIndicator = props => {
|
|
40
|
-
return
|
|
33
|
+
return components.DropdownIndicator && /*#__PURE__*/React.createElement(components.DropdownIndicator, props, /*#__PURE__*/React.createElement("span", {
|
|
41
34
|
className: "dtable-font dtable-icon-drop-down",
|
|
42
35
|
style: {
|
|
43
36
|
fontSize: '12px'
|
|
44
37
|
}
|
|
45
38
|
}));
|
|
46
39
|
};
|
|
47
|
-
exports.DropdownIndicator = DropdownIndicator;
|
|
48
40
|
const ClearIndicator = _ref => {
|
|
49
41
|
let {
|
|
50
42
|
innerProps,
|
|
@@ -58,17 +50,15 @@ const ClearIndicator = _ref => {
|
|
|
58
50
|
...innerProps,
|
|
59
51
|
onMouseDown
|
|
60
52
|
};
|
|
61
|
-
return /*#__PURE__*/
|
|
53
|
+
return /*#__PURE__*/React.createElement(components.ClearIndicator, props);
|
|
62
54
|
};
|
|
63
|
-
|
|
64
|
-
const MenuList = props => /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
+
const MenuList = props => /*#__PURE__*/React.createElement("div", {
|
|
65
56
|
onClick: e => e.nativeEvent.stopImmediatePropagation(),
|
|
66
57
|
onMouseDown: e => e.nativeEvent.stopImmediatePropagation()
|
|
67
|
-
}, /*#__PURE__*/
|
|
68
|
-
exports.MenuList = MenuList;
|
|
58
|
+
}, /*#__PURE__*/React.createElement(components.MenuList, props, props.children));
|
|
69
59
|
const Option = props => {
|
|
70
|
-
return /*#__PURE__*/
|
|
60
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
71
61
|
style: props.data.style
|
|
72
|
-
}, /*#__PURE__*/
|
|
62
|
+
}, /*#__PURE__*/React.createElement(components.Option, props));
|
|
73
63
|
};
|
|
74
|
-
|
|
64
|
+
export { MenuSelectStyle, DropdownIndicator, ClearIndicator, MenuList, Option };
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
1
|
+
import React from 'react';
|
|
9
2
|
function DtableSwitch(props) {
|
|
10
3
|
const {
|
|
11
4
|
onChange,
|
|
@@ -14,21 +7,21 @@ function DtableSwitch(props) {
|
|
|
14
7
|
disabled,
|
|
15
8
|
switchClassName
|
|
16
9
|
} = props;
|
|
17
|
-
return /*#__PURE__*/
|
|
10
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
18
11
|
className: "dtable-switch position-relative ".concat(switchClassName || '')
|
|
19
|
-
}, /*#__PURE__*/
|
|
12
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
20
13
|
className: "custom-switch"
|
|
21
|
-
}, /*#__PURE__*/
|
|
14
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
22
15
|
className: "custom-switch-input",
|
|
23
16
|
type: "checkbox",
|
|
24
17
|
checked: checked,
|
|
25
18
|
onChange: onChange,
|
|
26
19
|
name: "custom-switch-checkbox",
|
|
27
20
|
disabled: disabled
|
|
28
|
-
}), /*#__PURE__*/
|
|
21
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
29
22
|
className: "custom-switch-description text-truncate"
|
|
30
|
-
}, placeholder), /*#__PURE__*/
|
|
23
|
+
}, placeholder), /*#__PURE__*/React.createElement("span", {
|
|
31
24
|
className: "custom-switch-indicator"
|
|
32
25
|
})));
|
|
33
26
|
}
|
|
34
|
-
|
|
27
|
+
export default DtableSwitch;
|
package/lib/DateEditor/index.js
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
12
|
-
var _dtableUtils = require("dtable-utils");
|
|
13
|
-
var _pcDateEditorPopover = _interopRequireDefault(require("./pc-date-editor-popover"));
|
|
14
|
-
var _mbDateEditorPopover = _interopRequireDefault(require("./mb-date-editor-popover"));
|
|
15
|
-
require("dayjs/locale/zh-cn");
|
|
16
|
-
require("dayjs/locale/en-gb");
|
|
17
|
-
require("./index.css");
|
|
18
|
-
class DateEditor extends _react.default.Component {
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import MediaQuery from 'react-responsive';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import { getDateDisplayString } from 'dtable-utils';
|
|
5
|
+
import PCDateEditorPopover from './pc-date-editor-popover';
|
|
6
|
+
import MBDateEditorPopover from './mb-date-editor-popover';
|
|
7
|
+
import 'dayjs/locale/zh-cn';
|
|
8
|
+
import 'dayjs/locale/en-gb';
|
|
9
|
+
import './index.css';
|
|
10
|
+
class DateEditor extends React.Component {
|
|
19
11
|
constructor(props) {
|
|
20
12
|
super(props);
|
|
21
13
|
this.getDateFormat = () => {
|
|
@@ -74,7 +66,7 @@ class DateEditor extends _react.default.Component {
|
|
|
74
66
|
value,
|
|
75
67
|
lang
|
|
76
68
|
} = this.props;
|
|
77
|
-
|
|
69
|
+
dayjs.locale(lang);
|
|
78
70
|
let dateFormat = this.getDateFormat();
|
|
79
71
|
this.setState({
|
|
80
72
|
isDateInit: true,
|
|
@@ -85,11 +77,11 @@ class DateEditor extends _react.default.Component {
|
|
|
85
77
|
}
|
|
86
78
|
render() {
|
|
87
79
|
if (!this.state.isDateInit) {
|
|
88
|
-
return /*#__PURE__*/
|
|
80
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
89
81
|
className: "cell-editor date-editor"
|
|
90
|
-
}, /*#__PURE__*/
|
|
82
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
91
83
|
className: "date-editor-container"
|
|
92
|
-
}, /*#__PURE__*/
|
|
84
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
93
85
|
className: "control-form"
|
|
94
86
|
})));
|
|
95
87
|
}
|
|
@@ -103,24 +95,24 @@ class DateEditor extends _react.default.Component {
|
|
|
103
95
|
dateFormat,
|
|
104
96
|
showHourAndMinute
|
|
105
97
|
} = this.state;
|
|
106
|
-
return /*#__PURE__*/
|
|
98
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
107
99
|
className: "cell-editor dtable-ui-date-editor"
|
|
108
|
-
}, !isPopoverShow && /*#__PURE__*/
|
|
100
|
+
}, !isPopoverShow && /*#__PURE__*/React.createElement("div", {
|
|
109
101
|
className: "dtable-ui-date-editor-container"
|
|
110
|
-
}, /*#__PURE__*/
|
|
102
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
111
103
|
className: "form-control",
|
|
112
104
|
onClick: this.onDateEditorToggle
|
|
113
|
-
},
|
|
105
|
+
}, getDateDisplayString(newValue, dateFormat))), isPopoverShow && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(MediaQuery, {
|
|
114
106
|
query: '(min-width: 768px)'
|
|
115
|
-
}, /*#__PURE__*/
|
|
107
|
+
}, /*#__PURE__*/React.createElement(PCDateEditorPopover, {
|
|
116
108
|
lang: lang,
|
|
117
109
|
value: newValue,
|
|
118
110
|
dateFormat: dateFormat,
|
|
119
111
|
showHourAndMinute: showHourAndMinute,
|
|
120
112
|
onValueChanged: this.onValueChanged
|
|
121
|
-
})), /*#__PURE__*/
|
|
113
|
+
})), /*#__PURE__*/React.createElement(MediaQuery, {
|
|
122
114
|
query: '(max-width: 767.8px)'
|
|
123
|
-
}, /*#__PURE__*/
|
|
115
|
+
}, /*#__PURE__*/React.createElement(MBDateEditorPopover, {
|
|
124
116
|
isReadOnly: this.props.isReadOnly,
|
|
125
117
|
lang: lang,
|
|
126
118
|
value: newValue,
|
|
@@ -137,4 +129,4 @@ DateEditor.defaultProps = {
|
|
|
137
129
|
value: '',
|
|
138
130
|
lang: 'en'
|
|
139
131
|
};
|
|
140
|
-
|
|
132
|
+
export default DateEditor;
|