@cloudtower/eagle 0.22.38 → 0.23.0
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/components/TableForm/Columns/AffixColumn.d.ts +1 -1
- package/dist/components/TableForm/Columns/CheckboxColumn.d.ts +6 -3
- package/dist/components/TableForm/Columns/InputColumn.d.ts +3 -3
- package/dist/components/TableForm/Columns/TextColumn.d.ts +1 -1
- package/dist/components/TableForm/Columns/index.d.ts +15 -13
- package/dist/components/TableForm/types.d.ts +27 -12
- package/dist/esm/index.js +260 -138
- package/dist/esm/stats1.html +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/spec/type.d.ts +2 -0
- package/dist/style.css +1884 -1809
- package/dist/umd/index.js +258 -135
- 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,
|
|
16
|
+
import { XmarkRemove16SecondaryIcon, XmarkRemove16RegularRedIcon, HandlePoint816SecondaryIcon, HandlePoint816BlueIcon, 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';
|
|
@@ -3636,6 +3636,15 @@ const AffixColumnHeaderCell = ({ data, column, onChange, onBlur }) => {
|
|
|
3636
3636
|
) : void 0);
|
|
3637
3637
|
};
|
|
3638
3638
|
|
|
3639
|
+
const CheckboxColumnHeaderCell = ({ onChange }) => {
|
|
3640
|
+
const _onChange = useCallback(
|
|
3641
|
+
(e) => {
|
|
3642
|
+
onChange(e.target.checked, true);
|
|
3643
|
+
},
|
|
3644
|
+
[onChange]
|
|
3645
|
+
);
|
|
3646
|
+
return /* @__PURE__ */ React.createElement(Checkbox$1, { onChange: _onChange });
|
|
3647
|
+
};
|
|
3639
3648
|
const CheckboxColumnBodyCell = ({ data, column, index, onChange }) => {
|
|
3640
3649
|
const value = data[index][column.key] === void 0 ? column.defaultValue : data[index][column.key];
|
|
3641
3650
|
const _onChange = useCallback(
|
|
@@ -3773,11 +3782,7 @@ const TextColumnHeaderCell = ({
|
|
|
3773
3782
|
column.subTitle
|
|
3774
3783
|
);
|
|
3775
3784
|
};
|
|
3776
|
-
const TextColumnBodyCell = ({
|
|
3777
|
-
data,
|
|
3778
|
-
column,
|
|
3779
|
-
index
|
|
3780
|
-
}) => {
|
|
3785
|
+
const TextColumnBodyCell = ({ data, column, index }) => {
|
|
3781
3786
|
const text = column.displayText || data[index][column.key];
|
|
3782
3787
|
const CellDescription = useMemo(() => {
|
|
3783
3788
|
var _a, _b;
|
|
@@ -3806,7 +3811,7 @@ const ColumnHeaderImpls = {
|
|
|
3806
3811
|
input: InputColumnHeaderCell,
|
|
3807
3812
|
password: InputColumnHeaderCell,
|
|
3808
3813
|
affix: AffixColumnHeaderCell,
|
|
3809
|
-
checkbox:
|
|
3814
|
+
checkbox: CheckboxColumnHeaderCell
|
|
3810
3815
|
};
|
|
3811
3816
|
const ColumnBodyImpls = {
|
|
3812
3817
|
text: TextColumnBodyCell,
|
|
@@ -3826,10 +3831,17 @@ const FormItem = props => {
|
|
|
3826
3831
|
return /* @__PURE__ */React.createElement(Form.Item, {
|
|
3827
3832
|
className: FormItemStyle,
|
|
3828
3833
|
validateStatus,
|
|
3829
|
-
help: validateStatus ? message :
|
|
3834
|
+
help: validateStatus && message ? message : void 0
|
|
3830
3835
|
}, children);
|
|
3831
3836
|
};
|
|
3832
3837
|
|
|
3838
|
+
var ValidateTriggerType = /* @__PURE__ */ ((ValidateTriggerType2) => {
|
|
3839
|
+
ValidateTriggerType2[ValidateTriggerType2["Normal"] = 0] = "Normal";
|
|
3840
|
+
ValidateTriggerType2[ValidateTriggerType2["Aggressive"] = 1] = "Aggressive";
|
|
3841
|
+
ValidateTriggerType2[ValidateTriggerType2["Lazy"] = 2] = "Lazy";
|
|
3842
|
+
return ValidateTriggerType2;
|
|
3843
|
+
})(ValidateTriggerType || {});
|
|
3844
|
+
|
|
3833
3845
|
var __defProp$5 = Object.defineProperty;
|
|
3834
3846
|
var __defProps$5 = Object.defineProperties;
|
|
3835
3847
|
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
@@ -3852,40 +3864,77 @@ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
|
3852
3864
|
const TableFormBodyCell = (props) => {
|
|
3853
3865
|
const {
|
|
3854
3866
|
column,
|
|
3855
|
-
disabled,
|
|
3856
3867
|
index: rowIndex,
|
|
3857
3868
|
data,
|
|
3858
|
-
onChange,
|
|
3859
3869
|
latestData,
|
|
3870
|
+
validateTriggerType,
|
|
3860
3871
|
isRowError,
|
|
3861
|
-
|
|
3872
|
+
getRowValidateResult,
|
|
3873
|
+
disabled,
|
|
3874
|
+
onChange,
|
|
3875
|
+
onBlur,
|
|
3876
|
+
validateAll
|
|
3862
3877
|
} = props;
|
|
3878
|
+
const [validateResult, setValidateResult] = useState();
|
|
3879
|
+
const isTouched = useRef(false);
|
|
3863
3880
|
const width = typeof column.width === "number" ? column.width + "px" : column.width;
|
|
3864
|
-
const
|
|
3865
|
-
(
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
);
|
|
3869
|
-
|
|
3881
|
+
const triggerValidate = useCallback(
|
|
3882
|
+
(currentValue) => {
|
|
3883
|
+
var _a;
|
|
3884
|
+
const value = currentValue || data[rowIndex][column.key];
|
|
3885
|
+
const rowData = __spreadProps$5(__spreadValues$5({}, data[rowIndex]), { [column.key]: value });
|
|
3886
|
+
const rowValidateRes = getRowValidateResult(rowData);
|
|
3887
|
+
if (rowValidateRes) {
|
|
3888
|
+
return;
|
|
3889
|
+
}
|
|
3890
|
+
const result = (_a = column.validator) == null ? void 0 : _a.call(column, {
|
|
3891
|
+
value,
|
|
3892
|
+
rowIndex,
|
|
3893
|
+
rowData: data[rowIndex]
|
|
3894
|
+
});
|
|
3895
|
+
const isError = result ? typeof result === "string" : false;
|
|
3896
|
+
setValidateResult({ msg: result || "", isError });
|
|
3870
3897
|
},
|
|
3871
|
-
[
|
|
3898
|
+
[data, column, rowIndex, getRowValidateResult]
|
|
3872
3899
|
);
|
|
3900
|
+
useEffect(() => {
|
|
3901
|
+
if (validateAll) {
|
|
3902
|
+
isTouched.current = true;
|
|
3903
|
+
triggerValidate();
|
|
3904
|
+
}
|
|
3905
|
+
}, [validateAll, triggerValidate]);
|
|
3906
|
+
const _onChange = (value, data2) => {
|
|
3907
|
+
const newData = data2.map(
|
|
3908
|
+
(row, i) => i === rowIndex ? __spreadProps$5(__spreadValues$5({}, row), { [column.key]: value }) : row
|
|
3909
|
+
);
|
|
3910
|
+
onChange == null ? void 0 : onChange(newData, rowIndex, column.key);
|
|
3911
|
+
if (validateTriggerType === ValidateTriggerType.Normal && isTouched.current || validateTriggerType === ValidateTriggerType.Aggressive) {
|
|
3912
|
+
triggerValidate(value);
|
|
3913
|
+
}
|
|
3914
|
+
};
|
|
3873
3915
|
const _onBlur = useCallback(() => {
|
|
3916
|
+
isTouched.current = true;
|
|
3917
|
+
triggerValidate();
|
|
3874
3918
|
onBlur == null ? void 0 : onBlur(data, rowIndex, column.key);
|
|
3875
|
-
}, [rowIndex, column, onBlur, data]);
|
|
3919
|
+
}, [rowIndex, column, onBlur, data, triggerValidate]);
|
|
3876
3920
|
const renderDefaultComponent = () => {
|
|
3877
3921
|
if (!column.type)
|
|
3878
3922
|
return null;
|
|
3879
3923
|
const CellComponent = ColumnBodyImpls[column.type];
|
|
3880
3924
|
return /* @__PURE__ */ React.createElement(
|
|
3881
3925
|
CellComponent,
|
|
3882
|
-
|
|
3883
|
-
|
|
3926
|
+
{
|
|
3927
|
+
disabled,
|
|
3928
|
+
data,
|
|
3929
|
+
index: rowIndex,
|
|
3930
|
+
latestData,
|
|
3931
|
+
column,
|
|
3932
|
+
visible: props.visible,
|
|
3884
3933
|
onChange: (val) => {
|
|
3885
3934
|
_onChange(val, data);
|
|
3886
3935
|
},
|
|
3887
3936
|
onBlur: _onBlur
|
|
3888
|
-
}
|
|
3937
|
+
}
|
|
3889
3938
|
);
|
|
3890
3939
|
};
|
|
3891
3940
|
const Cell = column.render ? column.render({
|
|
@@ -3910,24 +3959,6 @@ const TableFormBodyCell = (props) => {
|
|
|
3910
3959
|
})) || null;
|
|
3911
3960
|
return typeof Result === "string" ? /* @__PURE__ */ React.createElement("p", { className: cx(Typo.Label.l4_regular, "cell-description") }, Result) : Result;
|
|
3912
3961
|
}, [rowIndex, data, latestData, column]);
|
|
3913
|
-
const validateResult = useMemo(() => {
|
|
3914
|
-
var _a;
|
|
3915
|
-
if (isRowError) {
|
|
3916
|
-
return {
|
|
3917
|
-
msg: "",
|
|
3918
|
-
isError: true
|
|
3919
|
-
};
|
|
3920
|
-
}
|
|
3921
|
-
const value = data[rowIndex][column.key];
|
|
3922
|
-
const result = (_a = column.validator) == null ? void 0 : _a.call(column, {
|
|
3923
|
-
value,
|
|
3924
|
-
rowIndex,
|
|
3925
|
-
rowData: data[rowIndex]
|
|
3926
|
-
});
|
|
3927
|
-
if (typeof result === "string" && result) {
|
|
3928
|
-
return { msg: result, isError: true };
|
|
3929
|
-
}
|
|
3930
|
-
}, [data, column, rowIndex, isRowError]);
|
|
3931
3962
|
return /* @__PURE__ */ React.createElement(
|
|
3932
3963
|
"div",
|
|
3933
3964
|
{
|
|
@@ -3941,8 +3972,8 @@ const TableFormBodyCell = (props) => {
|
|
|
3941
3972
|
/* @__PURE__ */ React.createElement(
|
|
3942
3973
|
FormItem,
|
|
3943
3974
|
{
|
|
3944
|
-
validateStatus: (validateResult == null ? void 0 : validateResult.isError) ? "error" : "",
|
|
3945
|
-
message:
|
|
3975
|
+
validateStatus: isRowError || (validateResult == null ? void 0 : validateResult.isError) ? "error" : "",
|
|
3976
|
+
message: isRowError ? "" : validateResult == null ? void 0 : validateResult.msg
|
|
3946
3977
|
},
|
|
3947
3978
|
Cell
|
|
3948
3979
|
),
|
|
@@ -3976,24 +4007,35 @@ const TableFormRow = (props) => {
|
|
|
3976
4007
|
latestData,
|
|
3977
4008
|
disabled,
|
|
3978
4009
|
passwordVisible,
|
|
3979
|
-
|
|
4010
|
+
deleteConfig,
|
|
3980
4011
|
draggable,
|
|
3981
4012
|
rowIndex,
|
|
3982
4013
|
provided,
|
|
3983
4014
|
snapshot,
|
|
4015
|
+
validateTriggerType = ValidateTriggerType.Normal,
|
|
3984
4016
|
updateData,
|
|
3985
4017
|
onBodyBlur,
|
|
3986
4018
|
renderRowDescription,
|
|
3987
|
-
rowValidator
|
|
4019
|
+
rowValidator,
|
|
4020
|
+
validateAll
|
|
3988
4021
|
} = props;
|
|
3989
4022
|
const rowData = data[rowIndex];
|
|
3990
|
-
const
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
4023
|
+
const [rowError, setRowError] = useState();
|
|
4024
|
+
const deleteRow = useCallback(
|
|
4025
|
+
(index, data2) => {
|
|
4026
|
+
const newData = [...data2];
|
|
4027
|
+
newData.splice(index, 1);
|
|
4028
|
+
updateData(newData);
|
|
4029
|
+
},
|
|
4030
|
+
[updateData]
|
|
4031
|
+
);
|
|
4032
|
+
const RowActions = useMemo(() => {
|
|
4033
|
+
var _a;
|
|
4034
|
+
const isRowDeleteDisabled = (_a = deleteConfig == null ? void 0 : deleteConfig.specifyRowDeleteDisabled) == null ? void 0 : _a.call(
|
|
4035
|
+
deleteConfig,
|
|
4036
|
+
rowIndex,
|
|
4037
|
+
data
|
|
4038
|
+
);
|
|
3997
4039
|
const DeleteIcon = /* @__PURE__ */ React.createElement(
|
|
3998
4040
|
Icon,
|
|
3999
4041
|
{
|
|
@@ -4003,20 +4045,21 @@ const TableFormRow = (props) => {
|
|
|
4003
4045
|
onClick: () => {
|
|
4004
4046
|
if (isRowDeleteDisabled)
|
|
4005
4047
|
return;
|
|
4006
|
-
deleteRow(
|
|
4048
|
+
deleteRow(rowIndex, data);
|
|
4007
4049
|
}
|
|
4008
4050
|
}
|
|
4009
4051
|
);
|
|
4010
4052
|
const FinalRenderIcon = isRowDeleteDisabled ? DeleteIcon : /* @__PURE__ */ React.createElement(Tooltip, { title: parrotI18n.t("components.remove") }, DeleteIcon);
|
|
4011
|
-
return deletable ? [FinalRenderIcon] : void 0;
|
|
4012
|
-
};
|
|
4013
|
-
const
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4053
|
+
return (deleteConfig == null ? void 0 : deleteConfig.deletable) ? [FinalRenderIcon] : void 0;
|
|
4054
|
+
}, [rowIndex, deleteConfig, data, deleteRow]);
|
|
4055
|
+
const getRowValidateResult = useCallback(
|
|
4056
|
+
(rowData2) => {
|
|
4057
|
+
const result = rowValidator == null ? void 0 : rowValidator(rowIndex, rowData2);
|
|
4058
|
+
setRowError(result);
|
|
4059
|
+
return result;
|
|
4060
|
+
},
|
|
4061
|
+
[rowValidator, rowIndex]
|
|
4062
|
+
);
|
|
4020
4063
|
const Cells = columns.map((col) => {
|
|
4021
4064
|
return /* @__PURE__ */ React.createElement(
|
|
4022
4065
|
TableFormBodyCell,
|
|
@@ -4030,7 +4073,10 @@ const TableFormRow = (props) => {
|
|
|
4030
4073
|
onChange: updateData,
|
|
4031
4074
|
onBlur: onBodyBlur,
|
|
4032
4075
|
visible: passwordVisible,
|
|
4033
|
-
|
|
4076
|
+
validateTriggerType,
|
|
4077
|
+
isRowError: !!rowError,
|
|
4078
|
+
getRowValidateResult,
|
|
4079
|
+
validateAll
|
|
4034
4080
|
}
|
|
4035
4081
|
);
|
|
4036
4082
|
});
|
|
@@ -4060,11 +4106,11 @@ const TableFormRow = (props) => {
|
|
|
4060
4106
|
"eagle-table-form-row",
|
|
4061
4107
|
(snapshot == null ? void 0 : snapshot.isDragging) && "isDragging"
|
|
4062
4108
|
),
|
|
4063
|
-
actions:
|
|
4109
|
+
actions: RowActions
|
|
4064
4110
|
},
|
|
4065
4111
|
DraggableHandle,
|
|
4066
4112
|
Cells,
|
|
4067
|
-
|
|
4113
|
+
rowError ? /* @__PURE__ */ React.createElement("p", { className: cx(Typo.Label.l4_regular, "row-error-message") }, rowError) : null,
|
|
4068
4114
|
RowDescription
|
|
4069
4115
|
);
|
|
4070
4116
|
};
|
|
@@ -4132,7 +4178,7 @@ const BatchInputListHeaderCell = (props) => {
|
|
|
4132
4178
|
const [errMsg, setErrMsg] = useState();
|
|
4133
4179
|
const width = Number.isNaN(Number(column.width)) ? column.width : column.width + "px";
|
|
4134
4180
|
const headerOnChange = useCallback(
|
|
4135
|
-
(value) => {
|
|
4181
|
+
(value, shouldUpdateData = false) => {
|
|
4136
4182
|
var _a;
|
|
4137
4183
|
const err = (_a = column.validator) == null ? void 0 : _a.call(column, { value, isHeader: true });
|
|
4138
4184
|
setErrMsg(err || void 0);
|
|
@@ -4142,7 +4188,7 @@ const BatchInputListHeaderCell = (props) => {
|
|
|
4142
4188
|
[column.key]: shouldAutoIncrease && typeof value === "string" ? increaseLastNumber(value, rowIndex) : value
|
|
4143
4189
|
});
|
|
4144
4190
|
});
|
|
4145
|
-
onChange == null ? void 0 : onChange(newData, column.key);
|
|
4191
|
+
onChange == null ? void 0 : onChange(newData, column.key, shouldUpdateData);
|
|
4146
4192
|
},
|
|
4147
4193
|
[onChange, data, column]
|
|
4148
4194
|
);
|
|
@@ -4178,14 +4224,14 @@ const BatchInputListHeaderCell = (props) => {
|
|
|
4178
4224
|
visibility: column.hidden ? "hidden" : "visible"
|
|
4179
4225
|
}
|
|
4180
4226
|
},
|
|
4181
|
-
/* @__PURE__ */ React.createElement(
|
|
4227
|
+
/* @__PURE__ */ React.createElement("p", { className: cx(Typo.Label.l3_bold_title, TitleStyle) }, column.title),
|
|
4228
|
+
disableBatchFilling ? null : /* @__PURE__ */ React.createElement(
|
|
4182
4229
|
FormItem,
|
|
4183
4230
|
{
|
|
4184
4231
|
validateStatus: typeof errMsg === "string" && errMsg ? "error" : "",
|
|
4185
4232
|
message: errMsg || void 0
|
|
4186
4233
|
},
|
|
4187
|
-
|
|
4188
|
-
disableBatchFilling ? null : renderCell()
|
|
4234
|
+
renderCell()
|
|
4189
4235
|
)
|
|
4190
4236
|
);
|
|
4191
4237
|
};
|
|
@@ -4212,16 +4258,18 @@ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
|
4212
4258
|
const DEFAULT_ROW_COUNT = 3;
|
|
4213
4259
|
const TableForm = React.forwardRef(
|
|
4214
4260
|
({
|
|
4215
|
-
defaultData,
|
|
4261
|
+
defaultData = [],
|
|
4216
4262
|
columns,
|
|
4217
4263
|
disabled,
|
|
4218
4264
|
rowAddConfig,
|
|
4219
|
-
|
|
4265
|
+
deleteConfig,
|
|
4220
4266
|
size = "default",
|
|
4221
4267
|
className,
|
|
4222
4268
|
draggable,
|
|
4223
4269
|
disableBatchFilling = false,
|
|
4224
4270
|
rowSplitType = "border",
|
|
4271
|
+
validateTriggerType,
|
|
4272
|
+
maxHeight,
|
|
4225
4273
|
renderRowDescription,
|
|
4226
4274
|
rowValidator,
|
|
4227
4275
|
onHeaderChange,
|
|
@@ -4229,12 +4277,10 @@ const TableForm = React.forwardRef(
|
|
|
4229
4277
|
onBodyChange,
|
|
4230
4278
|
onBodyBlur
|
|
4231
4279
|
}, ref) => {
|
|
4232
|
-
const
|
|
4233
|
-
return defaultData || [...Array(DEFAULT_ROW_COUNT)].map(() => genEmptyRow(columns));
|
|
4234
|
-
}, [defaultData, columns]);
|
|
4235
|
-
const [data, setData] = useState(treatedDefaultData);
|
|
4280
|
+
const [data, setData] = useState(defaultData);
|
|
4236
4281
|
const [passwordVisible, setPasswordVisible] = useState(false);
|
|
4237
|
-
const [latestData, setLatestData] = useState(
|
|
4282
|
+
const [latestData, setLatestData] = useState(defaultData);
|
|
4283
|
+
const [validateAll, setValidateAll] = useState(false);
|
|
4238
4284
|
const updateData = useCallback(
|
|
4239
4285
|
(value, rowIndex, columnKey) => {
|
|
4240
4286
|
setLatestData(value);
|
|
@@ -4243,12 +4289,23 @@ const TableForm = React.forwardRef(
|
|
|
4243
4289
|
},
|
|
4244
4290
|
[onBodyChange]
|
|
4245
4291
|
);
|
|
4292
|
+
useLayoutEffect(() => {
|
|
4293
|
+
if (defaultData.length === 0) {
|
|
4294
|
+
updateData(
|
|
4295
|
+
[...Array(DEFAULT_ROW_COUNT)].map(() => genEmptyRow(columns))
|
|
4296
|
+
);
|
|
4297
|
+
}
|
|
4298
|
+
}, []);
|
|
4246
4299
|
const handleBatchChange = useCallback(
|
|
4247
|
-
(newData, columnKey) => {
|
|
4300
|
+
(newData, columnKey, shouldUpdateData) => {
|
|
4248
4301
|
setLatestData(newData);
|
|
4249
4302
|
onHeaderChange == null ? void 0 : onHeaderChange(newData, columnKey);
|
|
4303
|
+
if (shouldUpdateData) {
|
|
4304
|
+
setData(newData);
|
|
4305
|
+
onBodyChange == null ? void 0 : onBodyChange(newData, void 0, columnKey);
|
|
4306
|
+
}
|
|
4250
4307
|
},
|
|
4251
|
-
[onHeaderChange]
|
|
4308
|
+
[onHeaderChange, onBodyChange]
|
|
4252
4309
|
);
|
|
4253
4310
|
const handleBatchBlur = useCallback(
|
|
4254
4311
|
(key, error) => {
|
|
@@ -4273,6 +4330,9 @@ const TableForm = React.forwardRef(
|
|
|
4273
4330
|
() => ({
|
|
4274
4331
|
setData: (data2) => {
|
|
4275
4332
|
updateData(data2);
|
|
4333
|
+
},
|
|
4334
|
+
validateWholeFields() {
|
|
4335
|
+
setValidateAll(true);
|
|
4276
4336
|
}
|
|
4277
4337
|
}),
|
|
4278
4338
|
[updateData]
|
|
@@ -4293,31 +4353,46 @@ const TableForm = React.forwardRef(
|
|
|
4293
4353
|
}
|
|
4294
4354
|
);
|
|
4295
4355
|
});
|
|
4296
|
-
|
|
4297
|
-
|
|
4356
|
+
const tableFormWrapperStyle = useMemo(
|
|
4357
|
+
() => maxHeight ? {
|
|
4358
|
+
maxHeight: typeof maxHeight === "number" ? maxHeight + "px" : maxHeight
|
|
4359
|
+
} : void 0,
|
|
4360
|
+
[]
|
|
4361
|
+
);
|
|
4362
|
+
return /* @__PURE__ */ React.createElement("div", { className }, /* @__PURE__ */ React.createElement(
|
|
4363
|
+
TableFormWrapper,
|
|
4298
4364
|
{
|
|
4299
|
-
className:
|
|
4300
|
-
|
|
4365
|
+
className: `table-form row-split-by-${rowSplitType}`,
|
|
4366
|
+
style: tableFormWrapperStyle
|
|
4301
4367
|
},
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4368
|
+
/* @__PURE__ */ React.createElement(List, { size, className: `size-${size}` }, /* @__PURE__ */ React.createElement(
|
|
4369
|
+
List.Item,
|
|
4370
|
+
{
|
|
4371
|
+
className: "eagle-table-form-header",
|
|
4372
|
+
actions: (deleteConfig == null ? void 0 : deleteConfig.deletable) ? [/* @__PURE__ */ React.createElement(React.Fragment, null)] : void 0
|
|
4373
|
+
},
|
|
4374
|
+
draggable ? /* @__PURE__ */ React.createElement(DraggableHandleWrapper, null) : null,
|
|
4375
|
+
headerCells
|
|
4376
|
+
), /* @__PURE__ */ React.createElement(
|
|
4377
|
+
TableFormBodyRows,
|
|
4378
|
+
{
|
|
4379
|
+
data,
|
|
4380
|
+
latestData,
|
|
4381
|
+
columns,
|
|
4382
|
+
passwordVisible,
|
|
4383
|
+
deleteConfig,
|
|
4384
|
+
disabled,
|
|
4385
|
+
draggable,
|
|
4386
|
+
rowSplitType,
|
|
4387
|
+
validateTriggerType,
|
|
4388
|
+
onBodyBlur,
|
|
4389
|
+
updateData,
|
|
4390
|
+
renderRowDescription,
|
|
4391
|
+
rowValidator,
|
|
4392
|
+
validateAll
|
|
4393
|
+
}
|
|
4394
|
+
))
|
|
4395
|
+
), (rowAddConfig == null ? void 0 : rowAddConfig.addible) ? /* @__PURE__ */ React.createElement(
|
|
4321
4396
|
AddRowButton,
|
|
4322
4397
|
{
|
|
4323
4398
|
config: rowAddConfig,
|
|
@@ -4329,7 +4404,7 @@ const TableForm = React.forwardRef(
|
|
|
4329
4404
|
}
|
|
4330
4405
|
);
|
|
4331
4406
|
|
|
4332
|
-
const
|
|
4407
|
+
const allTimeZones = uniqBy(TimeZones.reduce((sum, zone) => {
|
|
4333
4408
|
const utcZones = zone.utc.map(utc => {
|
|
4334
4409
|
return {
|
|
4335
4410
|
abbr: zone.abbr,
|
|
@@ -4339,31 +4414,51 @@ const flatTimeZones = sortBy(uniqBy(TimeZones.reduce((sum, zone) => {
|
|
|
4339
4414
|
};
|
|
4340
4415
|
});
|
|
4341
4416
|
return sum.concat(utcZones);
|
|
4342
|
-
}, []), "value")
|
|
4417
|
+
}, []), "value");
|
|
4418
|
+
const timeZoneGroups = (() => {
|
|
4419
|
+
const groupedTimeZones = groupBy(allTimeZones, tz => tz.value.split("/")[0]);
|
|
4420
|
+
delete groupedTimeZones["CST6CDT"];
|
|
4421
|
+
delete groupedTimeZones["MST7MDT"];
|
|
4422
|
+
delete groupedTimeZones["PST8PDT"];
|
|
4423
|
+
delete groupedTimeZones["Etc"];
|
|
4424
|
+
return sortBy(toPairs(groupedTimeZones).map(([key, tzs]) => {
|
|
4425
|
+
return [key, sortBy(tzs, "value")];
|
|
4426
|
+
}), "0");
|
|
4427
|
+
})();
|
|
4343
4428
|
const SelectStyle = "s1fc623g";
|
|
4344
|
-
const
|
|
4345
|
-
const
|
|
4346
|
-
const
|
|
4429
|
+
const DropdownStyle = "da3mx0o";
|
|
4430
|
+
const OptionWrapperStyle = cx("onr9gzt", Typo.Label.l3_regular);
|
|
4431
|
+
const OptionFirstLineStyle = cx("oiy0apc", Typo.Label.l3_regular);
|
|
4432
|
+
const OptionSecondLineStyle = cx("of4y382", Typo.Label.l4_regular);
|
|
4433
|
+
const TagStyle = "t19903l9";
|
|
4347
4434
|
const BrowserTimeValue = "browser_time_zone";
|
|
4435
|
+
const DefaultTimeValue = "default_time_zone";
|
|
4348
4436
|
const browserTzName = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
4349
|
-
const browserTz =
|
|
4437
|
+
const browserTz = allTimeZones.find(tz => tz.value === browserTzName) || allTimeZones[0];
|
|
4350
4438
|
const TimeZoneSelect = props => {
|
|
4351
4439
|
const {
|
|
4352
4440
|
value,
|
|
4353
4441
|
onChange,
|
|
4354
4442
|
disabled,
|
|
4355
4443
|
defaultUseBrowserTime,
|
|
4356
|
-
className
|
|
4444
|
+
className,
|
|
4445
|
+
placeholder,
|
|
4446
|
+
defaultOptionValue
|
|
4357
4447
|
} = props;
|
|
4358
4448
|
const [innerValue, setInnerValue] = useState(value);
|
|
4449
|
+
const defaultTz = useMemo(() => {
|
|
4450
|
+
return allTimeZones.find(tz => tz.value === defaultOptionValue);
|
|
4451
|
+
}, [defaultOptionValue]);
|
|
4359
4452
|
const _onChange = useCallback(val => {
|
|
4360
4453
|
setInnerValue(val);
|
|
4361
4454
|
if (val === BrowserTimeValue) {
|
|
4362
4455
|
onChange(browserTzName);
|
|
4456
|
+
} else if (val === DefaultTimeValue && defaultTz) {
|
|
4457
|
+
onChange(defaultTz == null ? void 0 : defaultTz.value);
|
|
4363
4458
|
} else {
|
|
4364
4459
|
onChange(val);
|
|
4365
4460
|
}
|
|
4366
|
-
}, [onChange]);
|
|
4461
|
+
}, [defaultTz, onChange]);
|
|
4367
4462
|
useEffect(() => {
|
|
4368
4463
|
if (defaultUseBrowserTime && !value) {
|
|
4369
4464
|
setInnerValue(BrowserTimeValue);
|
|
@@ -4372,12 +4467,28 @@ const TimeZoneSelect = props => {
|
|
|
4372
4467
|
}, []);
|
|
4373
4468
|
useEffect(() => {
|
|
4374
4469
|
if (innerValue === BrowserTimeValue && value === browserTzName) return;
|
|
4470
|
+
if (innerValue === DefaultTimeValue && value === (defaultTz == null ? void 0 : defaultTz.value)) return;
|
|
4375
4471
|
if (innerValue === value) return;
|
|
4376
4472
|
setInnerValue(value);
|
|
4377
|
-
}, [innerValue, value]);
|
|
4473
|
+
}, [defaultTz == null ? void 0 : defaultTz.value, innerValue, value]);
|
|
4474
|
+
const timeZoneOptionGroups = timeZoneGroups.map(([key, timezones]) => {
|
|
4475
|
+
return /* @__PURE__ */React.createElement(Select$1.OptGroup, {
|
|
4476
|
+
label: key.toUpperCase()
|
|
4477
|
+
}, timezones.map(zone => {
|
|
4478
|
+
return /* @__PURE__ */React.createElement(Select$1.Option, {
|
|
4479
|
+
label: zone.value,
|
|
4480
|
+
value: zone.value,
|
|
4481
|
+
className: OptionWrapperStyle
|
|
4482
|
+
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4483
|
+
key: zone.value,
|
|
4484
|
+
timeZone: zone
|
|
4485
|
+
}));
|
|
4486
|
+
}));
|
|
4487
|
+
});
|
|
4378
4488
|
return /* @__PURE__ */React.createElement(Select, {
|
|
4379
4489
|
className: cx(SelectStyle, className),
|
|
4380
|
-
|
|
4490
|
+
dropdownClassName: DropdownStyle,
|
|
4491
|
+
placeholder: /* @__PURE__ */React.createElement("span", null, placeholder || parrotI18n.t("components.time_zone_select_placeholder")),
|
|
4381
4492
|
value: innerValue,
|
|
4382
4493
|
onChange: _onChange,
|
|
4383
4494
|
showSearch: true,
|
|
@@ -4387,53 +4498,64 @@ const TimeZoneSelect = props => {
|
|
|
4387
4498
|
},
|
|
4388
4499
|
optionLabelProp: "label",
|
|
4389
4500
|
input: {}
|
|
4390
|
-
}, /* @__PURE__ */React.createElement(Select$1.Option, {
|
|
4501
|
+
}, defaultTz ? /* @__PURE__ */React.createElement(Select$1.Option, {
|
|
4502
|
+
value: DefaultTimeValue,
|
|
4503
|
+
label: `${parrotI18n.t("components.default_time_zone")} (${getUTCOffsetText(defaultTz.offset)})`,
|
|
4504
|
+
className: OptionWrapperStyle
|
|
4505
|
+
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4506
|
+
key: DefaultTimeValue,
|
|
4507
|
+
customLabel: parrotI18n.t("components.default_time_zone"),
|
|
4508
|
+
timeZone: defaultTz
|
|
4509
|
+
})) : void 0, /* @__PURE__ */React.createElement(Select$1.Option, {
|
|
4391
4510
|
value: BrowserTimeValue,
|
|
4392
|
-
label: parrotI18n.t("components.browser_time_zone")
|
|
4511
|
+
label: `${parrotI18n.t("components.browser_time_zone")} (${getUTCOffsetText(browserTz.offset)})`,
|
|
4393
4512
|
className: OptionWrapperStyle
|
|
4394
4513
|
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4395
4514
|
key: BrowserTimeValue,
|
|
4396
|
-
|
|
4515
|
+
customLabel: parrotI18n.t("components.browser_time_zone"),
|
|
4397
4516
|
timeZone: browserTz
|
|
4398
4517
|
})), /* @__PURE__ */React.createElement(Select$1.Option, {
|
|
4399
4518
|
value: "UTC",
|
|
4400
4519
|
className: OptionWrapperStyle
|
|
4401
4520
|
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4402
4521
|
key: "utc",
|
|
4522
|
+
customLabel: parrotI18n.t("components.coorddinated_universal_time"),
|
|
4403
4523
|
timeZone: {
|
|
4404
4524
|
value: "UTC",
|
|
4405
4525
|
text: "UTC",
|
|
4406
4526
|
offset: 0,
|
|
4407
|
-
abbr: "
|
|
4527
|
+
abbr: "GMT"
|
|
4408
4528
|
}
|
|
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
|
-
}));
|
|
4529
|
+
})), timeZoneOptionGroups);
|
|
4419
4530
|
};
|
|
4531
|
+
function getUTCOffsetText(offset) {
|
|
4532
|
+
if (offset === 0) {
|
|
4533
|
+
return "UTC";
|
|
4534
|
+
} else if (offset < 0) {
|
|
4535
|
+
return `UTC${offset}:00`;
|
|
4536
|
+
} else {
|
|
4537
|
+
return `UTC+${offset}:00`;
|
|
4538
|
+
}
|
|
4539
|
+
}
|
|
4420
4540
|
const TimeZoneOption = ({
|
|
4421
4541
|
timeZone,
|
|
4422
|
-
|
|
4542
|
+
customLabel
|
|
4423
4543
|
}) => {
|
|
4424
|
-
let tagText =
|
|
4425
|
-
if (timeZone.offset === 0) {
|
|
4426
|
-
tagText = "UTC";
|
|
4427
|
-
} else if (timeZone.offset < 0) {
|
|
4428
|
-
tagText = `UTC${timeZone.offset}:00`;
|
|
4429
|
-
} else {
|
|
4430
|
-
tagText = `UTC+${timeZone.offset}:00`;
|
|
4431
|
-
}
|
|
4544
|
+
let tagText = getUTCOffsetText(timeZone.offset);
|
|
4432
4545
|
return /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement("div", {
|
|
4433
4546
|
className: OptionFirstLineStyle
|
|
4434
|
-
}, /* @__PURE__ */React.createElement("span",
|
|
4547
|
+
}, /* @__PURE__ */React.createElement("span", {
|
|
4548
|
+
className: "timezone-title"
|
|
4549
|
+
}, customLabel || timeZone.value), /* @__PURE__ */React.createElement(Tag, {
|
|
4550
|
+
className: cx("timezone-tag", TagStyle)
|
|
4551
|
+
}, tagText)), /* @__PURE__ */React.createElement("div", {
|
|
4435
4552
|
className: OptionSecondLineStyle
|
|
4436
|
-
}, /* @__PURE__ */React.createElement("span", null, timeZone.text, ", ", timeZone.abbr)
|
|
4553
|
+
}, /* @__PURE__ */React.createElement("span", null, timeZone.text, ", ", timeZone.abbr), /* @__PURE__ */React.createElement(Icon, {
|
|
4554
|
+
className: "selected-icon",
|
|
4555
|
+
src: CheckmarkDoneSuccessCorrect16BlueIcon,
|
|
4556
|
+
iconHeight: 16,
|
|
4557
|
+
iconWidth: 16
|
|
4558
|
+
})));
|
|
4437
4559
|
};
|
|
4438
4560
|
|
|
4439
4561
|
function getAntdKit() {
|
|
@@ -4674,4 +4796,4 @@ const useUIKit = () => {
|
|
|
4674
4796
|
return useContext(kitContext);
|
|
4675
4797
|
};
|
|
4676
4798
|
|
|
4677
|
-
export { Architecture, Button, ButtonStyle, EntityAsyncStatus, FailedLoad, Icon, InputTagItem, KitStoreProvider, ModalActions, ModalStack, TaskStatus, Typo, UIKitProvider, UIKitStore, UserSource, antdKit, closeModal, createBatchMessageMethods, kitContext, popModal, pushModal, tableStyleCover, tickFormatter, useElementsSize, useKitDispatch, useKitSelector, useUIKit };
|
|
4799
|
+
export { Architecture, Button, ButtonStyle, EntityAsyncStatus, FailedLoad, Icon, InputTagItem, KitStoreProvider, ModalActions, ModalStack, TaskStatus, Typo, UIKitProvider, UIKitStore, UserSource, ValidateTriggerType, antdKit, closeModal, createBatchMessageMethods, kitContext, popModal, pushModal, tableStyleCover, tickFormatter, useElementsSize, useKitDispatch, useKitSelector, useUIKit };
|