@qn-pandora/pandora-component 4.2.0 → 4.3.1
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/CHANGELOG.json +41 -1
- package/CHANGELOG.md +16 -2
- package/es/components/DateTimePicker/Base/index.d.ts +6 -1
- package/es/components/DateTimePicker/Base/index.js +44 -17
- package/es/components/DateTimePicker/Base/relativeTimePicker.js +10 -7
- package/es/components/DateTimePicker/constants.d.ts +57 -1
- package/es/components/DateTimePicker/constants.js +3 -5
- package/es/components/DateTimePicker/time.js +2 -2
- package/es/components/DateTimePicker/transform.d.ts +5 -1
- package/es/components/DateTimePicker/transform.js +3 -2
- package/es/components/Drawer/CloseIcon/index.d.ts +1 -0
- package/es/components/Drawer/CloseIcon/index.js +2 -2
- package/es/components/Drawer/index.d.ts +2 -0
- package/es/components/Drawer/index.js +30 -23
- package/es/components/Drawer/style.css +3 -0
- package/es/components/Drawer/style.less +4 -0
- package/es/constants/language/modal/en.js +3 -1
- package/es/constants/language/modal/type.d.ts +2 -0
- package/es/constants/language/modal/zh.js +3 -1
- package/es/index.css +49 -46
- package/es/index.less +4 -4
- package/es/style/theme.less +5 -0
- package/lib/components/DateTimePicker/Base/index.d.ts +6 -1
- package/lib/components/DateTimePicker/Base/index.js +43 -16
- package/lib/components/DateTimePicker/Base/relativeTimePicker.js +8 -5
- package/lib/components/DateTimePicker/constants.d.ts +57 -1
- package/lib/components/DateTimePicker/constants.js +3 -5
- package/lib/components/DateTimePicker/time.js +1 -1
- package/lib/components/DateTimePicker/transform.d.ts +5 -1
- package/lib/components/DateTimePicker/transform.js +3 -2
- package/lib/components/Drawer/CloseIcon/index.d.ts +1 -0
- package/lib/components/Drawer/CloseIcon/index.js +2 -2
- package/lib/components/Drawer/index.d.ts +2 -0
- package/lib/components/Drawer/index.js +29 -22
- package/lib/components/Drawer/style.css +3 -0
- package/lib/components/Drawer/style.less +4 -0
- package/lib/constants/language/modal/en.js +3 -1
- package/lib/constants/language/modal/type.d.ts +2 -0
- package/lib/constants/language/modal/zh.js +3 -1
- package/lib/index.css +3337 -3334
- package/lib/index.less +4 -4
- package/lib/style/theme.less +5 -0
- package/package.json +3 -3
package/es/index.css
CHANGED
@@ -5173,6 +5173,9 @@ textarea.ant-input {
|
|
5173
5173
|
color: #333;
|
5174
5174
|
font-size: 14px;
|
5175
5175
|
}
|
5176
|
+
.pandora-sdk-drawer-no-mask {
|
5177
|
+
background-color: #d9d9d9;
|
5178
|
+
}
|
5176
5179
|
.ant-upload {
|
5177
5180
|
-webkit-box-sizing: border-box;
|
5178
5181
|
box-sizing: border-box;
|
@@ -13199,6 +13202,12 @@ textarea.ant-pagination-options-quick-jumper input {
|
|
13199
13202
|
.pandora-sdk-tree-select-dropdown .ant-empty {
|
13200
13203
|
text-align: center;
|
13201
13204
|
}
|
13205
|
+
.pandora-sdk-card-search-input {
|
13206
|
+
min-width: 200px;
|
13207
|
+
}
|
13208
|
+
.pandora-sdk-card-search-input i {
|
13209
|
+
color: #bfbfbf;
|
13210
|
+
}
|
13202
13211
|
.ant-row {
|
13203
13212
|
display: -webkit-box;
|
13204
13213
|
display: -ms-flexbox;
|
@@ -19088,12 +19097,6 @@ textarea.ant-pagination-options-quick-jumper input {
|
|
19088
19097
|
.pandora-sdk-card-row-extra button {
|
19089
19098
|
min-width: 80px;
|
19090
19099
|
}
|
19091
|
-
.pandora-sdk-card-search-input {
|
19092
|
-
min-width: 200px;
|
19093
|
-
}
|
19094
|
-
.pandora-sdk-card-search-input i {
|
19095
|
-
color: #bfbfbf;
|
19096
|
-
}
|
19097
19100
|
.ant-picker {
|
19098
19101
|
-webkit-box-sizing: border-box;
|
19099
19102
|
box-sizing: border-box;
|
@@ -20410,6 +20413,18 @@ _:-ms-fullscreen .ant-picker-range-wrapper .ant-picker-year-panel .ant-picker-ce
|
|
20410
20413
|
.pandora-sdk-modal-close-icon:hover {
|
20411
20414
|
background: #f4f5f6;
|
20412
20415
|
}
|
20416
|
+
.pandora-sdk-popover-inline-list {
|
20417
|
+
display: inline-block;
|
20418
|
+
vertical-align: middle;
|
20419
|
+
}
|
20420
|
+
.pandora-sdk-popover-inline-list .pandora-sdk-popover-inline-item {
|
20421
|
+
display: inline-block;
|
20422
|
+
height: 100%;
|
20423
|
+
margin-right: 12px;
|
20424
|
+
}
|
20425
|
+
.pandora-sdk-popover-inline-list .pandora-sdk-popover-inline-item i {
|
20426
|
+
color: #2c6dd2;
|
20427
|
+
}
|
20413
20428
|
.pandora-sdk-item {
|
20414
20429
|
color: #2c6dd2;
|
20415
20430
|
cursor: pointer;
|
@@ -20432,18 +20447,6 @@ _:-ms-fullscreen .ant-picker-range-wrapper .ant-picker-year-panel .ant-picker-ce
|
|
20432
20447
|
color: inherit;
|
20433
20448
|
cursor: inherit;
|
20434
20449
|
}
|
20435
|
-
.pandora-sdk-popover-inline-list {
|
20436
|
-
display: inline-block;
|
20437
|
-
vertical-align: middle;
|
20438
|
-
}
|
20439
|
-
.pandora-sdk-popover-inline-list .pandora-sdk-popover-inline-item {
|
20440
|
-
display: inline-block;
|
20441
|
-
height: 100%;
|
20442
|
-
margin-right: 12px;
|
20443
|
-
}
|
20444
|
-
.pandora-sdk-popover-inline-list .pandora-sdk-popover-inline-item i {
|
20445
|
-
color: #2c6dd2;
|
20446
|
-
}
|
20447
20450
|
.pandora-sdk-popover-item {
|
20448
20451
|
display: inline-block;
|
20449
20452
|
line-height: 18px;
|
@@ -20726,34 +20729,6 @@ _:-ms-fullscreen .ant-picker-range-wrapper .ant-picker-year-panel .ant-picker-ce
|
|
20726
20729
|
.pandora-sdk-transfer-list-body .pandora-sdk-transfer-mb10 {
|
20727
20730
|
margin-bottom: 10px;
|
20728
20731
|
}
|
20729
|
-
.pandora-sdk-panel-title {
|
20730
|
-
display: -webkit-box;
|
20731
|
-
display: -ms-flexbox;
|
20732
|
-
display: flex;
|
20733
|
-
-webkit-box-pack: justify;
|
20734
|
-
-ms-flex-pack: justify;
|
20735
|
-
justify-content: space-between;
|
20736
|
-
font-size: 12px;
|
20737
|
-
color: #42526e;
|
20738
|
-
cursor: pointer;
|
20739
|
-
padding-bottom: 16px;
|
20740
|
-
border-bottom: 1px solid #d9d9d9;
|
20741
|
-
}
|
20742
|
-
.pandora-sdk-panel-title .icon {
|
20743
|
-
font-size: 14px;
|
20744
|
-
}
|
20745
|
-
.pandora-sdk-panel-content {
|
20746
|
-
padding: 20px 0 0 0;
|
20747
|
-
}
|
20748
|
-
.pandora-sdk-panel-hidden {
|
20749
|
-
display: none;
|
20750
|
-
}
|
20751
|
-
.pandora-sdk-panel {
|
20752
|
-
margin-bottom: 20px;
|
20753
|
-
}
|
20754
|
-
.pandora-sdk-panel-disable {
|
20755
|
-
cursor: default;
|
20756
|
-
}
|
20757
20732
|
.pandora-sdk-datetime-mobile-pick-range-preset-head {
|
20758
20733
|
display: -webkit-box;
|
20759
20734
|
display: -ms-flexbox;
|
@@ -20790,3 +20765,31 @@ _:-ms-fullscreen .ant-picker-range-wrapper .ant-picker-year-panel .ant-picker-ce
|
|
20790
20765
|
border-radius: 2px;
|
20791
20766
|
border: 2px solid #939393;
|
20792
20767
|
}
|
20768
|
+
.pandora-sdk-panel-title {
|
20769
|
+
display: -webkit-box;
|
20770
|
+
display: -ms-flexbox;
|
20771
|
+
display: flex;
|
20772
|
+
-webkit-box-pack: justify;
|
20773
|
+
-ms-flex-pack: justify;
|
20774
|
+
justify-content: space-between;
|
20775
|
+
font-size: 12px;
|
20776
|
+
color: #42526e;
|
20777
|
+
cursor: pointer;
|
20778
|
+
padding-bottom: 16px;
|
20779
|
+
border-bottom: 1px solid #d9d9d9;
|
20780
|
+
}
|
20781
|
+
.pandora-sdk-panel-title .icon {
|
20782
|
+
font-size: 14px;
|
20783
|
+
}
|
20784
|
+
.pandora-sdk-panel-content {
|
20785
|
+
padding: 20px 0 0 0;
|
20786
|
+
}
|
20787
|
+
.pandora-sdk-panel-hidden {
|
20788
|
+
display: none;
|
20789
|
+
}
|
20790
|
+
.pandora-sdk-panel {
|
20791
|
+
margin-bottom: 20px;
|
20792
|
+
}
|
20793
|
+
.pandora-sdk-panel-disable {
|
20794
|
+
cursor: default;
|
20795
|
+
}
|
package/es/index.less
CHANGED
@@ -32,14 +32,14 @@
|
|
32
32
|
@import './components/Timeline/style.less';
|
33
33
|
@import './components/Transfer/style.less';
|
34
34
|
@import './components/TreeSelector/style.less';
|
35
|
-
@import './components/Card/RowExtra/style.less';
|
36
35
|
@import './components/Card/SearchInput/style.less';
|
36
|
+
@import './components/Card/RowExtra/style.less';
|
37
37
|
@import './components/DateTimePicker/Base/style.less';
|
38
38
|
@import './components/DateTimePicker/BaseMobile/style.less';
|
39
39
|
@import './components/DateTimePicker/DisplayInput/style.less';
|
40
40
|
@import './components/Drawer/CloseIcon/style.less';
|
41
|
-
@import './components/OptionList/OptionItem/style.less';
|
42
41
|
@import './components/OptionList/InlineOptionList/style.less';
|
42
|
+
@import './components/OptionList/OptionItem/style.less';
|
43
43
|
@import './components/OptionList/PopoverOptionList/style.less';
|
44
44
|
@import './components/Steps/ControlButton/style.less';
|
45
45
|
@import './components/Table/ColumnSetting/style.less';
|
@@ -49,5 +49,5 @@
|
|
49
49
|
@import './components/Timeline/TimelineItem/style.less';
|
50
50
|
@import './components/Transfer/List/style.less';
|
51
51
|
@import './components/Transfer/ListBody/style.less';
|
52
|
-
@import './components/DateTimePicker/
|
53
|
-
@import './components/DateTimePicker/
|
52
|
+
@import './components/DateTimePicker/BaseMobile/Absolute/style.less';
|
53
|
+
@import './components/DateTimePicker/Collapse/Panel/style.less';
|
package/es/style/theme.less
CHANGED
@@ -391,6 +391,7 @@
|
|
391
391
|
@close-icon-hover-color: #f4f5f6;
|
392
392
|
|
393
393
|
@agent-markdown-scorll-bar-color: #c9cdd4;
|
394
|
+
@agent-scene-icon-color: #c9cdd4;
|
394
395
|
@agent-markdown-header-background-color: rgb(52, 53, 65);
|
395
396
|
@agent-box-shadow-color: rgba(53, 53, 53, 0.07);
|
396
397
|
@agent-cursor-color: #282828;
|
@@ -398,8 +399,12 @@
|
|
398
399
|
@agent-example-desc-color: #595959;
|
399
400
|
@agent-input-border-color: #e9e9e9;
|
400
401
|
@agent-border-color: #e8e8e8;
|
402
|
+
@agent-scene-name-color: #86909c;
|
401
403
|
@background-color-fa: #fafafa;
|
402
404
|
@background-color-f5: #f5f5f5;
|
403
405
|
@background-color-f4: #f4f5f6;
|
404
406
|
@background-linear-color: rgba(244, 245, 246, 0);
|
405
407
|
@background-color-e2: #e2e4e6;
|
408
|
+
@color-error-bg: #fff2f0;
|
409
|
+
@color-error: #fd4345;
|
410
|
+
@agent-scene-background-color: rgba(0, 0, 0, 0.06);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import * as moment from 'moment';
|
3
3
|
import { ICompositedTime } from './relativeTimePicker';
|
4
|
-
import { EPresetMode, IPreset, RangePreset, IRelativeTime, IQuarterTime, IBaseProps, TimeType } from '../constants';
|
4
|
+
import { EPresetMode, IPreset, RangePreset, IRelativeTime, IQuarterTime, IBaseProps, TimeType, IRelativeTimeUnit } from '../constants';
|
5
5
|
declare enum RelativeInvalid {
|
6
6
|
Valid = 0,
|
7
7
|
From = 1,
|
@@ -51,6 +51,11 @@ export default class Base extends React.Component<IBaseProps, any> {
|
|
51
51
|
getYears(): number[];
|
52
52
|
constructor(props: IBaseProps);
|
53
53
|
UNSAFE_componentWillReceiveProps(nextProps: IBaseProps): void;
|
54
|
+
getRelativeMap(relativeTimeUnits: IRelativeTimeUnit[]): IKeyValues<{
|
55
|
+
text: string;
|
56
|
+
value: string;
|
57
|
+
time: (num: number) => moment.Moment;
|
58
|
+
}>;
|
54
59
|
isRelativeTimeValidFunc(from: ICompositedTime, to: ICompositedTime): boolean;
|
55
60
|
getAllPresetItems(): JSX.Element[];
|
56
61
|
handlePresetClick(preset: IPreset): void;
|
@@ -83,17 +83,22 @@ exports.RELATIVE_DEFAULT_VALUE = {
|
|
83
83
|
var Base = /** @class */ (function (_super) {
|
84
84
|
__extends(Base, _super);
|
85
85
|
function Base(props) {
|
86
|
+
var _a, _b, _c, _d;
|
86
87
|
var _this = _super.call(this, props) || this;
|
87
88
|
_this.range = [undefined, undefined];
|
88
89
|
_this.rangePreset = constants_1.RangePreset.BetweenTime;
|
89
90
|
_this.relative = {
|
90
91
|
from: {
|
91
|
-
num:
|
92
|
-
|
92
|
+
num: ((_a = _this.props.defaultRelativeValue) === null || _a === void 0 ? void 0 : _a.from.num) ||
|
93
|
+
exports.RELATIVE_DEFAULT_VALUE.FROM_NUM,
|
94
|
+
unit: ((_b = _this.props.defaultRelativeValue) === null || _b === void 0 ? void 0 : _b.from.unit) ||
|
95
|
+
exports.RELATIVE_DEFAULT_VALUE.FROM_UNIT
|
93
96
|
},
|
94
97
|
to: {
|
95
|
-
num:
|
96
|
-
|
98
|
+
num: ((_c = _this.props.defaultRelativeValue) === null || _c === void 0 ? void 0 : _c.to.num) ||
|
99
|
+
exports.RELATIVE_DEFAULT_VALUE.TO_NUM,
|
100
|
+
unit: ((_d = _this.props.defaultRelativeValue) === null || _d === void 0 ? void 0 : _d.to.unit) ||
|
101
|
+
exports.RELATIVE_DEFAULT_VALUE.TO_UNIT
|
97
102
|
}
|
98
103
|
};
|
99
104
|
_this.relativeTimeInValid = RelativeInvalid.Valid;
|
@@ -245,9 +250,21 @@ var Base = /** @class */ (function (_super) {
|
|
245
250
|
}
|
246
251
|
}
|
247
252
|
};
|
253
|
+
Base.prototype.getRelativeMap = function (relativeTimeUnits) {
|
254
|
+
var res = {};
|
255
|
+
relativeTimeUnits.forEach(function (relative) {
|
256
|
+
res[relative.value] = relative;
|
257
|
+
});
|
258
|
+
return res;
|
259
|
+
};
|
248
260
|
Base.prototype.isRelativeTimeValidFunc = function (from, to) {
|
249
|
-
var
|
250
|
-
var
|
261
|
+
var _a = this.props, relativeTimeUnits = _a.relativeTimeUnits, relativeStartTimeUnits = _a.relativeStartTimeUnits, relativeEndTimeUnits = _a.relativeEndTimeUnits;
|
262
|
+
var start = relativeStartTimeUnits || relativeTimeUnits || constants_1.RELATIVE_TIME_UNITS;
|
263
|
+
var end = relativeEndTimeUnits || relativeTimeUnits || constants_1.RELATIVE_TIME_UNITS;
|
264
|
+
var startRelativeMap = this.getRelativeMap(start);
|
265
|
+
var endRelativeMap = this.getRelativeMap(end);
|
266
|
+
var fromDate = startRelativeMap["" + from.unit].time(from.num).valueOf();
|
267
|
+
var toDate = endRelativeMap["" + to.unit].time(to.num).valueOf();
|
251
268
|
return fromDate < toDate;
|
252
269
|
};
|
253
270
|
Base.prototype.getAllPresetItems = function () {
|
@@ -274,14 +291,14 @@ var Base = /** @class */ (function (_super) {
|
|
274
291
|
}
|
275
292
|
};
|
276
293
|
Base.prototype.handlePickerOk = function () {
|
277
|
-
var
|
294
|
+
var _a = this.props, onChange = _a.onChange, showTime = _a.showTime;
|
278
295
|
if (onChange) {
|
279
296
|
var start = this.range[0];
|
280
297
|
var end = this.range[1];
|
281
298
|
onChange(new time_2.default({
|
282
299
|
// 赋值时将毫秒数清零
|
283
|
-
start: start === null || start === void 0 ? void 0 : start.milliseconds(0),
|
284
|
-
end: end === null || end === void 0 ? void 0 : end.milliseconds(0),
|
300
|
+
start: showTime === false ? start === null || start === void 0 ? void 0 : start.startOf('day') : start === null || start === void 0 ? void 0 : start.milliseconds(0),
|
301
|
+
end: showTime === false ? end === null || end === void 0 ? void 0 : end.startOf('day') : end === null || end === void 0 ? void 0 : end.milliseconds(0),
|
285
302
|
rangePreset: this.rangePreset
|
286
303
|
}));
|
287
304
|
}
|
@@ -340,22 +357,26 @@ var Base = /** @class */ (function (_super) {
|
|
340
357
|
};
|
341
358
|
Base.prototype.renderRelativeContent = function () {
|
342
359
|
var _a;
|
360
|
+
var _b, _c, _d, _e;
|
343
361
|
var locale = this.context.locale;
|
344
|
-
var fromNum = _.get(this.relative, 'from.num',
|
345
|
-
|
346
|
-
var
|
347
|
-
|
362
|
+
var fromNum = _.get(this.relative, 'from.num', ((_b = this.props.defaultRelativeValue) === null || _b === void 0 ? void 0 : _b.from.num) ||
|
363
|
+
exports.RELATIVE_DEFAULT_VALUE.FROM_NUM);
|
364
|
+
var fromUnit = _.get(this.relative, 'from.unit', ((_c = this.props.defaultRelativeValue) === null || _c === void 0 ? void 0 : _c.from.unit) ||
|
365
|
+
exports.RELATIVE_DEFAULT_VALUE.FROM_UNIT);
|
366
|
+
var toNum = _.get(this.relative, 'to.num', ((_d = this.props.defaultRelativeValue) === null || _d === void 0 ? void 0 : _d.to.num) || exports.RELATIVE_DEFAULT_VALUE.TO_NUM);
|
367
|
+
var toUnit = _.get(this.relative, 'to.unit', ((_e = this.props.defaultRelativeValue) === null || _e === void 0 ? void 0 : _e.to.unit) || exports.RELATIVE_DEFAULT_VALUE.TO_UNIT);
|
368
|
+
var _f = this.props, relativeStartTimeUnits = _f.relativeStartTimeUnits, relativeEndTimeUnits = _f.relativeEndTimeUnits, relativeTimeUnits = _f.relativeTimeUnits;
|
348
369
|
if (!this.isRangePicker()) {
|
349
370
|
return (React.createElement("div", { className: style_1.SDK_PREFIX + "-datetime-pick-content" },
|
350
371
|
React.createElement("div", { className: style_1.SDK_PREFIX + "-datetime-pick-relative-container" },
|
351
|
-
React.createElement(relativeTimePicker_1.default, { className: style_1.SDK_PREFIX + "-datetime-pick-relative", num: fromNum, unit: fromUnit, onChange: this.handleRetiveTimeFromChange, relativeTimeUnits:
|
372
|
+
React.createElement(relativeTimePicker_1.default, { className: style_1.SDK_PREFIX + "-datetime-pick-relative", num: fromNum, unit: fromUnit, onChange: this.handleRetiveTimeFromChange, relativeTimeUnits: relativeStartTimeUnits || relativeTimeUnits }),
|
352
373
|
React.createElement(Button_1.default, { disabled: !this.isRelativeTimeValid, className: style_1.SDK_PREFIX + "-datetime-pick-relative-confirm", onClick: this.handleRelativeChange }, language_1.formatString(type_1.DateTimeLocale.confirm, locale)))));
|
353
374
|
}
|
354
375
|
return (React.createElement("div", { className: style_1.SDK_PREFIX + "-datetime-pick-content" },
|
355
376
|
React.createElement("div", { className: style_1.SDK_PREFIX + "-datetime-pick-relative-container" },
|
356
|
-
React.createElement(relativeTimePicker_1.default, { className: style_1.SDK_PREFIX + "-datetime-pick-relative-timepicker", num: fromNum, unit: fromUnit, onChange: this.handleRetiveTimeFromChange, relativeTimeUnits:
|
377
|
+
React.createElement(relativeTimePicker_1.default, { className: style_1.SDK_PREFIX + "-datetime-pick-relative-timepicker", num: fromNum, unit: fromUnit, onChange: this.handleRetiveTimeFromChange, relativeTimeUnits: relativeStartTimeUnits || relativeTimeUnits, withoutNow: true }),
|
357
378
|
React.createElement("span", { className: style_1.SDK_PREFIX + "-datetime-pick-relative-container-to" }, language_1.formatString(type_1.DateTimeLocale.to, locale)),
|
358
|
-
React.createElement(relativeTimePicker_1.default, { className: style_1.SDK_PREFIX + "-datetime-pick-relative-timepicker", num: toNum, unit: toUnit, onChange: this.handleRetiveTimeToChange, relativeTimeUnits:
|
379
|
+
React.createElement(relativeTimePicker_1.default, { className: style_1.SDK_PREFIX + "-datetime-pick-relative-timepicker", num: toNum, unit: toUnit, onChange: this.handleRetiveTimeToChange, relativeTimeUnits: relativeEndTimeUnits || relativeTimeUnits })),
|
359
380
|
React.createElement("div", { className: classnames_1.default(style_1.SDK_PREFIX + "-datetime-pick-relative-footer", (_a = {},
|
360
381
|
_a[style_1.SDK_PREFIX + "-datetime-pick-relative-footer-witNow"] = toUnit === constants_1.RelativeUnitValue.NowStatic,
|
361
382
|
_a)) },
|
@@ -533,6 +554,12 @@ var Base = /** @class */ (function (_super) {
|
|
533
554
|
__metadata("design:paramtypes", [Object]),
|
534
555
|
__metadata("design:returntype", void 0)
|
535
556
|
], Base.prototype, "setRelative", null);
|
557
|
+
__decorate([
|
558
|
+
bind_1.default,
|
559
|
+
__metadata("design:type", Function),
|
560
|
+
__metadata("design:paramtypes", [Array]),
|
561
|
+
__metadata("design:returntype", void 0)
|
562
|
+
], Base.prototype, "getRelativeMap", null);
|
536
563
|
__decorate([
|
537
564
|
bind_1.default,
|
538
565
|
__metadata("design:type", Function),
|
@@ -72,16 +72,19 @@ var RetiveTimePicker = /** @class */ (function (_super) {
|
|
72
72
|
return _this.containerRef.current || document.body;
|
73
73
|
};
|
74
74
|
_this.shouldShowInput = function () {
|
75
|
-
var
|
76
|
-
|
75
|
+
var _a;
|
76
|
+
var _b = _this.props, unit = _b.unit, relativeTimeUnits = _b.relativeTimeUnits;
|
77
|
+
return (unit !== constants_1.RelativeUnitValue.Now &&
|
78
|
+
unit !== constants_1.RelativeUnitValue.NowStatic &&
|
79
|
+
((_a = lodash_1.find(relativeTimeUnits || constants_1.RELATIVE_TIME_UNITS, function (item) { return item.value === unit; })) === null || _a === void 0 ? void 0 : _a.static) !== true);
|
77
80
|
};
|
78
81
|
return _this;
|
79
82
|
}
|
80
83
|
RetiveTimePicker.prototype.render = function () {
|
81
|
-
var _a = this.props, num = _a.num, unit = _a.unit, className = _a.className, withoutNow = _a.withoutNow;
|
84
|
+
var _a = this.props, num = _a.num, unit = _a.unit, className = _a.className, withoutNow = _a.withoutNow, relativeTimeUnits = _a.relativeTimeUnits;
|
82
85
|
var locale = this.context.locale;
|
83
|
-
var options =
|
84
|
-
constants_1.
|
86
|
+
var options = relativeTimeUnits ||
|
87
|
+
constants_1.RELATIVE_TIME_UNITS.map(function (option) {
|
85
88
|
return {
|
86
89
|
text: language_1.formatString(option.text, locale),
|
87
90
|
value: option.value,
|
@@ -32,6 +32,28 @@ export interface IPreset {
|
|
32
32
|
export interface IRelativeTimeUnit {
|
33
33
|
text: string;
|
34
34
|
value: string;
|
35
|
+
/**
|
36
|
+
* 是否是一个能完整表达的静态时间,例如昨天、前天、上个月,不需要用户再额外输入数字
|
37
|
+
*
|
38
|
+
* 例:
|
39
|
+
* 像两天前,或者几天前,需要用户输入一个数字来确定具体的时间,就是不完整时间。
|
40
|
+
* {
|
41
|
+
text: '天前',
|
42
|
+
value: 'day',
|
43
|
+
static: false,
|
44
|
+
time: (num: number) => moment().startOf('day').subtract(num, 'days')
|
45
|
+
}
|
46
|
+
*
|
47
|
+
|
48
|
+
* 像 昨天、前天、上个月,不需要用户再额外输入数字。
|
49
|
+
* {
|
50
|
+
text: '昨天',
|
51
|
+
value: 'yesterday',
|
52
|
+
static: true,
|
53
|
+
time: (_: number) => moment().startOf('day').subtract(1, 'days')
|
54
|
+
}
|
55
|
+
*/
|
56
|
+
static?: boolean;
|
35
57
|
time: (num: number) => moment.Moment;
|
36
58
|
}
|
37
59
|
export declare const defaultPresets: IPreset[];
|
@@ -55,10 +77,32 @@ export declare enum RelativeUnitValue {
|
|
55
77
|
Quarter = "Q",
|
56
78
|
Year = "y"
|
57
79
|
}
|
58
|
-
export declare const
|
80
|
+
export declare const RELATIVE_TIME_UNITS: IRelativeTimeUnit[];
|
59
81
|
export declare const relativeTimeUnitsWithoutNowStatic: {
|
60
82
|
text: string;
|
61
83
|
value: string;
|
84
|
+
/**
|
85
|
+
* 是否是一个能完整表达的静态时间,例如昨天、前天、上个月,不需要用户再额外输入数字
|
86
|
+
*
|
87
|
+
* 例:
|
88
|
+
* 像两天前,或者几天前,需要用户输入一个数字来确定具体的时间,就是不完整时间。
|
89
|
+
* {
|
90
|
+
text: '天前',
|
91
|
+
value: 'day',
|
92
|
+
static: false,
|
93
|
+
time: (num: number) => moment().startOf('day').subtract(num, 'days')
|
94
|
+
}
|
95
|
+
*
|
96
|
+
|
97
|
+
* 像 昨天、前天、上个月,不需要用户再额外输入数字。
|
98
|
+
* {
|
99
|
+
text: '昨天',
|
100
|
+
value: 'yesterday',
|
101
|
+
static: true,
|
102
|
+
time: (_: number) => moment().startOf('day').subtract(1, 'days')
|
103
|
+
}
|
104
|
+
*/
|
105
|
+
static?: boolean | undefined;
|
62
106
|
time: (num: number) => moment.Moment;
|
63
107
|
}[];
|
64
108
|
export declare const relativeMap: IKeyValues<{
|
@@ -114,6 +158,14 @@ export interface IBaseProps {
|
|
114
158
|
* 预设
|
115
159
|
*/
|
116
160
|
presets?: IPreset[];
|
161
|
+
/**
|
162
|
+
* 自定义相对时间单位(开始)
|
163
|
+
*/
|
164
|
+
relativeStartTimeUnits?: IRelativeTimeUnit[];
|
165
|
+
/**
|
166
|
+
* 自定义相对时间单位(结束)
|
167
|
+
*/
|
168
|
+
relativeEndTimeUnits?: IRelativeTimeUnit[];
|
117
169
|
/**
|
118
170
|
* 自定义相对时间单位
|
119
171
|
*/
|
@@ -196,6 +248,10 @@ export interface IBaseProps {
|
|
196
248
|
* 语言
|
197
249
|
*/
|
198
250
|
locale?: string;
|
251
|
+
/**
|
252
|
+
* 默认的相对时间
|
253
|
+
*/
|
254
|
+
defaultRelativeValue?: IRelativeTime;
|
199
255
|
}
|
200
256
|
export interface ITimeRange {
|
201
257
|
relative?: IRelativeTime;
|
@@ -247,7 +247,7 @@ var RelativeUnitValue;
|
|
247
247
|
RelativeUnitValue["Quarter"] = "Q";
|
248
248
|
RelativeUnitValue["Year"] = "y";
|
249
249
|
})(RelativeUnitValue = exports.RelativeUnitValue || (exports.RelativeUnitValue = {}));
|
250
|
-
exports.
|
250
|
+
exports.RELATIVE_TIME_UNITS = [
|
251
251
|
{
|
252
252
|
text: type_1.DateTimeLocale.relative.now,
|
253
253
|
value: RelativeUnitValue.Now,
|
@@ -299,15 +299,13 @@ exports.relativeTimeUnits = [
|
|
299
299
|
time: function (num) { return moment_1.default().subtract(num, 'years'); }
|
300
300
|
}
|
301
301
|
];
|
302
|
-
exports.relativeTimeUnitsWithoutNowStatic = exports.
|
303
|
-
.filter(function (item) { return item.value !== RelativeUnitValue.NowStatic; })
|
304
|
-
.map(function (item) {
|
302
|
+
exports.relativeTimeUnitsWithoutNowStatic = exports.RELATIVE_TIME_UNITS.filter(function (item) { return item.value !== RelativeUnitValue.NowStatic; }).map(function (item) {
|
305
303
|
return item.value === RelativeUnitValue.Now
|
306
304
|
? __assign(__assign({}, item), { text: type_1.DateTimeLocale.relative.now_text }) : __assign({}, item);
|
307
305
|
});
|
308
306
|
exports.relativeMap = (function () {
|
309
307
|
var res = {};
|
310
|
-
exports.
|
308
|
+
exports.RELATIVE_TIME_UNITS.forEach(function (relative) {
|
311
309
|
res[relative.value] = relative;
|
312
310
|
});
|
313
311
|
return res;
|
@@ -39,7 +39,7 @@ var Time = /** @class */ (function () {
|
|
39
39
|
this.isPointPicker = options.isPointPicker;
|
40
40
|
this.quarterTime = time.quarterTime;
|
41
41
|
this.presetMap = this.getPresetMap(lodash_1.isEmpty(options.presets) ? constants_1.defaultPresets : options.presets);
|
42
|
-
this.relativeMap = this.getRelativeMap(lodash_1.isEmpty(options.relatives) ? constants_1.
|
42
|
+
this.relativeMap = this.getRelativeMap(lodash_1.isEmpty(options.relatives) ? constants_1.RELATIVE_TIME_UNITS : options.relatives);
|
43
43
|
}
|
44
44
|
Time.toMoment = function (time) {
|
45
45
|
try {
|
@@ -4,7 +4,11 @@ export declare function transformToTime(time: ITimeRange): ITime;
|
|
4
4
|
export declare function transformToTimeRange(time: ITime): ITimeRange;
|
5
5
|
export declare function getTimeShiftUnit(time: string): TimeShiftUnit.Second | TimeShiftUnit;
|
6
6
|
export declare function getRelativeTime(timeShift: string, time: moment.Moment): moment.Moment | undefined;
|
7
|
-
export declare function calcFullTime(time?: ITimeRange
|
7
|
+
export declare function calcFullTime(time?: ITimeRange, options?: {
|
8
|
+
presets?: any;
|
9
|
+
relatives?: any;
|
10
|
+
isPointPicker?: boolean;
|
11
|
+
}): {
|
8
12
|
start: number | undefined;
|
9
13
|
end: number | undefined;
|
10
14
|
} | undefined;
|
@@ -68,12 +68,13 @@ function getRelativeTime(timeShift, time) {
|
|
68
68
|
}
|
69
69
|
}
|
70
70
|
exports.getRelativeTime = getRelativeTime;
|
71
|
-
function calcFullTime(time) {
|
71
|
+
function calcFullTime(time, options) {
|
72
|
+
if (options === void 0) { options = {}; }
|
72
73
|
if (!time) {
|
73
74
|
return;
|
74
75
|
}
|
75
76
|
var timeShift = time.timeShift;
|
76
|
-
var _a = new time_1.default(transformToTime(time)).toDate(), start = _a.start, end = _a.end;
|
77
|
+
var _a = new time_1.default(transformToTime(time), options).toDate(), start = _a.start, end = _a.end;
|
77
78
|
var relativeStart = timeShift && start ? getRelativeTime(timeShift, start) : start;
|
78
79
|
var relativeEnd = timeShift && end ? getRelativeTime(timeShift, end) : end;
|
79
80
|
return {
|
@@ -20,8 +20,8 @@ var language_1 = require("../../../utils/language");
|
|
20
20
|
var type_1 = require("../../../constants/language/modal/type");
|
21
21
|
exports.CloseIcon = function (props) {
|
22
22
|
var locale = react_1.useContext(config_provider_1.ConfigContext).locale;
|
23
|
-
var className = props.className, onClick = props.onClick;
|
24
|
-
return (react_1.default.createElement(antd_1.Tooltip, { title: language_1.formatString(type_1.ModalLocale.close_tooltip, locale) },
|
23
|
+
var className = props.className, onClick = props.onClick, getPopupContainer = props.getPopupContainer;
|
24
|
+
return (react_1.default.createElement(antd_1.Tooltip, { title: language_1.formatString(type_1.ModalLocale.close_tooltip, locale), getPopupContainer: getPopupContainer },
|
25
25
|
react_1.default.createElement(pandora_component_icons_1.Close, { className: classnames_1.default(style_1.SDK_PREFIX + "-modal-close-icon", className), onClick: onClick })));
|
26
26
|
};
|
27
27
|
exports.default = exports.CloseIcon;
|
@@ -78,6 +78,7 @@ export declare class Drawer extends React.Component<React.PropsWithChildren<IDra
|
|
78
78
|
realWidth: React.ReactText;
|
79
79
|
isFullscreen: boolean;
|
80
80
|
throttleMouseMove: import("lodash").DebouncedFunc<(e: any) => void>;
|
81
|
+
static contextType: React.Context<import("antd/es/config-provider").ConfigConsumerProps>;
|
81
82
|
get closable(): boolean | undefined;
|
82
83
|
get extra(): JSX.Element;
|
83
84
|
setIsResizing(isResizing?: boolean): void;
|
@@ -89,6 +90,7 @@ export declare class Drawer extends React.Component<React.PropsWithChildren<IDra
|
|
89
90
|
onMouseMove(e: any): void;
|
90
91
|
onMouseClick(e: MouseEvent): void;
|
91
92
|
initWidth(width?: string | number, size?: string): React.ReactText;
|
93
|
+
handleClose(e: EventType | null): void;
|
92
94
|
componentDidMount(): void;
|
93
95
|
UNSAFE_componentWillUpdate(nextProps: Readonly<React.PropsWithChildren<IDrawerProps>>): void;
|
94
96
|
componentWillUnmount(): void;
|