@cloudtower/eagle 0.22.38 → 0.22.40
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/dist/esm/index.js +73 -28
- package/dist/esm/stats1.html +1 -1
- package/dist/spec/type.d.ts +2 -0
- package/dist/style.css +1014 -964
- package/dist/umd/index.js +71 -26
- package/dist/umd/stats1.html +1 -1
- package/package.json +5 -5
package/dist/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Alert as Alert$1, Badge as Badge$1, Button as Button$1, Tooltip as Tool
|
|
|
2
2
|
export { Col, Row } from 'antd';
|
|
3
3
|
import React, { useState, useMemo, useRef, useCallback, useEffect, Fragment, useLayoutEffect, createContext, memo, useImperativeHandle, useContext } from 'react';
|
|
4
4
|
import cs from 'classnames';
|
|
5
|
-
import _, { sortBy,
|
|
5
|
+
import _, { uniqBy, groupBy, sortBy, toPairs } from 'lodash';
|
|
6
6
|
import { parrotI18n } from '@cloudtower/parrot';
|
|
7
7
|
export * from '@cloudtower/parrot';
|
|
8
8
|
import { cx } from '@linaria/core';
|
|
@@ -13,7 +13,7 @@ import { isElement } from 'react-is';
|
|
|
13
13
|
import { CloseCircleFilled, CheckOutlined, SearchOutlined, PlusOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons';
|
|
14
14
|
import { combineReducers, createStore } from 'redux';
|
|
15
15
|
import { createDispatchHook, createSelectorHook, Provider } from 'react-redux';
|
|
16
|
-
import { HandlePoint816SecondaryIcon, HandlePoint816BlueIcon, XmarkRemove16SecondaryIcon, XmarkRemove16RegularRedIcon } from '@cloudtower/icons-react';
|
|
16
|
+
import { HandlePoint816SecondaryIcon, HandlePoint816BlueIcon, XmarkRemove16SecondaryIcon, XmarkRemove16RegularRedIcon, CheckmarkDoneSuccessCorrect16BlueIcon } from '@cloudtower/icons-react';
|
|
17
17
|
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
18
18
|
import TimeZones from 'timezones.json';
|
|
19
19
|
import { withTranslation } from 'react-i18next';
|
|
@@ -4329,7 +4329,7 @@ const TableForm = React.forwardRef(
|
|
|
4329
4329
|
}
|
|
4330
4330
|
);
|
|
4331
4331
|
|
|
4332
|
-
const
|
|
4332
|
+
const allTimeZones = uniqBy(TimeZones.reduce((sum, zone) => {
|
|
4333
4333
|
const utcZones = zone.utc.map(utc => {
|
|
4334
4334
|
return {
|
|
4335
4335
|
abbr: zone.abbr,
|
|
@@ -4339,31 +4339,51 @@ const flatTimeZones = sortBy(uniqBy(TimeZones.reduce((sum, zone) => {
|
|
|
4339
4339
|
};
|
|
4340
4340
|
});
|
|
4341
4341
|
return sum.concat(utcZones);
|
|
4342
|
-
}, []), "value")
|
|
4342
|
+
}, []), "value");
|
|
4343
|
+
const timeZoneGroups = (() => {
|
|
4344
|
+
const groupedTimeZones = groupBy(allTimeZones, tz => tz.value.split("/")[0]);
|
|
4345
|
+
delete groupedTimeZones["CST6CDT"];
|
|
4346
|
+
delete groupedTimeZones["MST7MDT"];
|
|
4347
|
+
delete groupedTimeZones["PST8PDT"];
|
|
4348
|
+
delete groupedTimeZones["Etc"];
|
|
4349
|
+
return sortBy(toPairs(groupedTimeZones).map(([key, tzs]) => {
|
|
4350
|
+
return [key, sortBy(tzs, "value")];
|
|
4351
|
+
}), "0");
|
|
4352
|
+
})();
|
|
4343
4353
|
const SelectStyle = "s1fc623g";
|
|
4344
|
-
const
|
|
4345
|
-
const
|
|
4346
|
-
const
|
|
4354
|
+
const DropdownStyle = "da3mx0o";
|
|
4355
|
+
const OptionWrapperStyle = cx("onr9gzt", Typo.Label.l3_regular);
|
|
4356
|
+
const OptionFirstLineStyle = cx("oiy0apc", Typo.Label.l3_regular);
|
|
4357
|
+
const OptionSecondLineStyle = cx("of4y382", Typo.Label.l4_regular);
|
|
4358
|
+
const TagStyle = "t19903l9";
|
|
4347
4359
|
const BrowserTimeValue = "browser_time_zone";
|
|
4360
|
+
const DefaultTimeValue = "default_time_zone";
|
|
4348
4361
|
const browserTzName = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
4349
|
-
const browserTz =
|
|
4362
|
+
const browserTz = allTimeZones.find(tz => tz.value === browserTzName) || allTimeZones[0];
|
|
4350
4363
|
const TimeZoneSelect = props => {
|
|
4351
4364
|
const {
|
|
4352
4365
|
value,
|
|
4353
4366
|
onChange,
|
|
4354
4367
|
disabled,
|
|
4355
4368
|
defaultUseBrowserTime,
|
|
4356
|
-
className
|
|
4369
|
+
className,
|
|
4370
|
+
placeholder,
|
|
4371
|
+
defaultOptionValue
|
|
4357
4372
|
} = props;
|
|
4358
4373
|
const [innerValue, setInnerValue] = useState(value);
|
|
4374
|
+
const defaultTz = useMemo(() => {
|
|
4375
|
+
return allTimeZones.find(tz => tz.value === defaultOptionValue);
|
|
4376
|
+
}, [defaultOptionValue]);
|
|
4359
4377
|
const _onChange = useCallback(val => {
|
|
4360
4378
|
setInnerValue(val);
|
|
4361
4379
|
if (val === BrowserTimeValue) {
|
|
4362
4380
|
onChange(browserTzName);
|
|
4381
|
+
} else if (val === DefaultTimeValue && defaultTz) {
|
|
4382
|
+
onChange(defaultTz == null ? void 0 : defaultTz.value);
|
|
4363
4383
|
} else {
|
|
4364
4384
|
onChange(val);
|
|
4365
4385
|
}
|
|
4366
|
-
}, [onChange]);
|
|
4386
|
+
}, [defaultTz, onChange]);
|
|
4367
4387
|
useEffect(() => {
|
|
4368
4388
|
if (defaultUseBrowserTime && !value) {
|
|
4369
4389
|
setInnerValue(BrowserTimeValue);
|
|
@@ -4372,12 +4392,28 @@ const TimeZoneSelect = props => {
|
|
|
4372
4392
|
}, []);
|
|
4373
4393
|
useEffect(() => {
|
|
4374
4394
|
if (innerValue === BrowserTimeValue && value === browserTzName) return;
|
|
4395
|
+
if (innerValue === DefaultTimeValue && value === (defaultTz == null ? void 0 : defaultTz.value)) return;
|
|
4375
4396
|
if (innerValue === value) return;
|
|
4376
4397
|
setInnerValue(value);
|
|
4377
|
-
}, [innerValue, value]);
|
|
4398
|
+
}, [defaultTz == null ? void 0 : defaultTz.value, innerValue, value]);
|
|
4399
|
+
const timeZoneOptionGroups = timeZoneGroups.map(([key, timezones]) => {
|
|
4400
|
+
return /* @__PURE__ */React.createElement(Select$1.OptGroup, {
|
|
4401
|
+
label: key.toUpperCase()
|
|
4402
|
+
}, timezones.map(zone => {
|
|
4403
|
+
return /* @__PURE__ */React.createElement(Select$1.Option, {
|
|
4404
|
+
label: zone.value,
|
|
4405
|
+
value: zone.value,
|
|
4406
|
+
className: OptionWrapperStyle
|
|
4407
|
+
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4408
|
+
key: zone.value,
|
|
4409
|
+
timeZone: zone
|
|
4410
|
+
}));
|
|
4411
|
+
}));
|
|
4412
|
+
});
|
|
4378
4413
|
return /* @__PURE__ */React.createElement(Select, {
|
|
4379
4414
|
className: cx(SelectStyle, className),
|
|
4380
|
-
|
|
4415
|
+
dropdownClassName: DropdownStyle,
|
|
4416
|
+
placeholder: /* @__PURE__ */React.createElement("span", null, placeholder || parrotI18n.t("components.time_zone_select_placeholder")),
|
|
4381
4417
|
value: innerValue,
|
|
4382
4418
|
onChange: _onChange,
|
|
4383
4419
|
showSearch: true,
|
|
@@ -4387,39 +4423,39 @@ const TimeZoneSelect = props => {
|
|
|
4387
4423
|
},
|
|
4388
4424
|
optionLabelProp: "label",
|
|
4389
4425
|
input: {}
|
|
4390
|
-
}, /* @__PURE__ */React.createElement(Select$1.Option, {
|
|
4426
|
+
}, defaultTz ? /* @__PURE__ */React.createElement(Select$1.Option, {
|
|
4427
|
+
value: DefaultTimeValue,
|
|
4428
|
+
label: parrotI18n.t("components.default_time_zone"),
|
|
4429
|
+
className: OptionWrapperStyle
|
|
4430
|
+
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4431
|
+
key: DefaultTimeValue,
|
|
4432
|
+
customLabel: parrotI18n.t("components.default_time_zone"),
|
|
4433
|
+
timeZone: defaultTz
|
|
4434
|
+
})) : void 0, /* @__PURE__ */React.createElement(Select$1.Option, {
|
|
4391
4435
|
value: BrowserTimeValue,
|
|
4392
4436
|
label: parrotI18n.t("components.browser_time_zone"),
|
|
4393
4437
|
className: OptionWrapperStyle
|
|
4394
4438
|
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4395
4439
|
key: BrowserTimeValue,
|
|
4396
|
-
|
|
4440
|
+
customLabel: parrotI18n.t("components.browser_time_zone"),
|
|
4397
4441
|
timeZone: browserTz
|
|
4398
4442
|
})), /* @__PURE__ */React.createElement(Select$1.Option, {
|
|
4399
4443
|
value: "UTC",
|
|
4400
4444
|
className: OptionWrapperStyle
|
|
4401
4445
|
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4402
4446
|
key: "utc",
|
|
4447
|
+
customLabel: parrotI18n.t("components.coorddinated_universal_time"),
|
|
4403
4448
|
timeZone: {
|
|
4404
4449
|
value: "UTC",
|
|
4405
4450
|
text: "UTC",
|
|
4406
4451
|
offset: 0,
|
|
4407
|
-
abbr: "
|
|
4452
|
+
abbr: "GMT"
|
|
4408
4453
|
}
|
|
4409
|
-
})),
|
|
4410
|
-
return /* @__PURE__ */React.createElement(Select$1.Option, {
|
|
4411
|
-
label: zone.value,
|
|
4412
|
-
value: zone.value,
|
|
4413
|
-
className: OptionWrapperStyle
|
|
4414
|
-
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4415
|
-
key: zone.value,
|
|
4416
|
-
timeZone: zone
|
|
4417
|
-
}));
|
|
4418
|
-
}));
|
|
4454
|
+
})), timeZoneOptionGroups);
|
|
4419
4455
|
};
|
|
4420
4456
|
const TimeZoneOption = ({
|
|
4421
4457
|
timeZone,
|
|
4422
|
-
|
|
4458
|
+
customLabel
|
|
4423
4459
|
}) => {
|
|
4424
4460
|
let tagText = "";
|
|
4425
4461
|
if (timeZone.offset === 0) {
|
|
@@ -4431,9 +4467,18 @@ const TimeZoneOption = ({
|
|
|
4431
4467
|
}
|
|
4432
4468
|
return /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement("div", {
|
|
4433
4469
|
className: OptionFirstLineStyle
|
|
4434
|
-
}, /* @__PURE__ */React.createElement("span",
|
|
4470
|
+
}, /* @__PURE__ */React.createElement("span", {
|
|
4471
|
+
className: "timezone-title"
|
|
4472
|
+
}, customLabel || timeZone.value), /* @__PURE__ */React.createElement(Tag, {
|
|
4473
|
+
className: cx("timezone-tag", TagStyle)
|
|
4474
|
+
}, tagText)), /* @__PURE__ */React.createElement("div", {
|
|
4435
4475
|
className: OptionSecondLineStyle
|
|
4436
|
-
}, /* @__PURE__ */React.createElement("span", null, timeZone.text, ", ", timeZone.abbr)
|
|
4476
|
+
}, /* @__PURE__ */React.createElement("span", null, timeZone.text, ", ", timeZone.abbr), /* @__PURE__ */React.createElement(Icon, {
|
|
4477
|
+
className: "selected-icon",
|
|
4478
|
+
src: CheckmarkDoneSuccessCorrect16BlueIcon,
|
|
4479
|
+
iconHeight: 16,
|
|
4480
|
+
iconWidth: 16
|
|
4481
|
+
})));
|
|
4437
4482
|
};
|
|
4438
4483
|
|
|
4439
4484
|
function getAntdKit() {
|