@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/umd/index.js
CHANGED
|
@@ -3620,6 +3620,15 @@
|
|
|
3620
3620
|
) : void 0);
|
|
3621
3621
|
};
|
|
3622
3622
|
|
|
3623
|
+
const CheckboxColumnHeaderCell = ({ onChange }) => {
|
|
3624
|
+
const _onChange = React.useCallback(
|
|
3625
|
+
(e) => {
|
|
3626
|
+
onChange(e.target.checked, true);
|
|
3627
|
+
},
|
|
3628
|
+
[onChange]
|
|
3629
|
+
);
|
|
3630
|
+
return /* @__PURE__ */ React.createElement(antd.Checkbox, { onChange: _onChange });
|
|
3631
|
+
};
|
|
3623
3632
|
const CheckboxColumnBodyCell = ({ data, column, index, onChange }) => {
|
|
3624
3633
|
const value = data[index][column.key] === void 0 ? column.defaultValue : data[index][column.key];
|
|
3625
3634
|
const _onChange = React.useCallback(
|
|
@@ -3757,11 +3766,7 @@
|
|
|
3757
3766
|
column.subTitle
|
|
3758
3767
|
);
|
|
3759
3768
|
};
|
|
3760
|
-
const TextColumnBodyCell = ({
|
|
3761
|
-
data,
|
|
3762
|
-
column,
|
|
3763
|
-
index
|
|
3764
|
-
}) => {
|
|
3769
|
+
const TextColumnBodyCell = ({ data, column, index }) => {
|
|
3765
3770
|
const text = column.displayText || data[index][column.key];
|
|
3766
3771
|
const CellDescription = React.useMemo(() => {
|
|
3767
3772
|
var _a, _b;
|
|
@@ -3790,7 +3795,7 @@
|
|
|
3790
3795
|
input: InputColumnHeaderCell,
|
|
3791
3796
|
password: InputColumnHeaderCell,
|
|
3792
3797
|
affix: AffixColumnHeaderCell,
|
|
3793
|
-
checkbox:
|
|
3798
|
+
checkbox: CheckboxColumnHeaderCell
|
|
3794
3799
|
};
|
|
3795
3800
|
const ColumnBodyImpls = {
|
|
3796
3801
|
text: TextColumnBodyCell,
|
|
@@ -3810,10 +3815,17 @@
|
|
|
3810
3815
|
return /* @__PURE__ */React.createElement(antd.Form.Item, {
|
|
3811
3816
|
className: FormItemStyle,
|
|
3812
3817
|
validateStatus,
|
|
3813
|
-
help: validateStatus ? message :
|
|
3818
|
+
help: validateStatus && message ? message : void 0
|
|
3814
3819
|
}, children);
|
|
3815
3820
|
};
|
|
3816
3821
|
|
|
3822
|
+
var ValidateTriggerType = /* @__PURE__ */ ((ValidateTriggerType2) => {
|
|
3823
|
+
ValidateTriggerType2[ValidateTriggerType2["Normal"] = 0] = "Normal";
|
|
3824
|
+
ValidateTriggerType2[ValidateTriggerType2["Aggressive"] = 1] = "Aggressive";
|
|
3825
|
+
ValidateTriggerType2[ValidateTriggerType2["Lazy"] = 2] = "Lazy";
|
|
3826
|
+
return ValidateTriggerType2;
|
|
3827
|
+
})(ValidateTriggerType || {});
|
|
3828
|
+
|
|
3817
3829
|
var __defProp$5 = Object.defineProperty;
|
|
3818
3830
|
var __defProps$5 = Object.defineProperties;
|
|
3819
3831
|
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
@@ -3836,40 +3848,77 @@
|
|
|
3836
3848
|
const TableFormBodyCell = (props) => {
|
|
3837
3849
|
const {
|
|
3838
3850
|
column,
|
|
3839
|
-
disabled,
|
|
3840
3851
|
index: rowIndex,
|
|
3841
3852
|
data,
|
|
3842
|
-
onChange,
|
|
3843
3853
|
latestData,
|
|
3854
|
+
validateTriggerType,
|
|
3844
3855
|
isRowError,
|
|
3845
|
-
|
|
3856
|
+
getRowValidateResult,
|
|
3857
|
+
disabled,
|
|
3858
|
+
onChange,
|
|
3859
|
+
onBlur,
|
|
3860
|
+
validateAll
|
|
3846
3861
|
} = props;
|
|
3862
|
+
const [validateResult, setValidateResult] = React.useState();
|
|
3863
|
+
const isTouched = React.useRef(false);
|
|
3847
3864
|
const width = typeof column.width === "number" ? column.width + "px" : column.width;
|
|
3848
|
-
const
|
|
3849
|
-
(
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
);
|
|
3853
|
-
|
|
3865
|
+
const triggerValidate = React.useCallback(
|
|
3866
|
+
(currentValue) => {
|
|
3867
|
+
var _a;
|
|
3868
|
+
const value = currentValue || data[rowIndex][column.key];
|
|
3869
|
+
const rowData = __spreadProps$5(__spreadValues$5({}, data[rowIndex]), { [column.key]: value });
|
|
3870
|
+
const rowValidateRes = getRowValidateResult(rowData);
|
|
3871
|
+
if (rowValidateRes) {
|
|
3872
|
+
return;
|
|
3873
|
+
}
|
|
3874
|
+
const result = (_a = column.validator) == null ? void 0 : _a.call(column, {
|
|
3875
|
+
value,
|
|
3876
|
+
rowIndex,
|
|
3877
|
+
rowData: data[rowIndex]
|
|
3878
|
+
});
|
|
3879
|
+
const isError = result ? typeof result === "string" : false;
|
|
3880
|
+
setValidateResult({ msg: result || "", isError });
|
|
3854
3881
|
},
|
|
3855
|
-
[
|
|
3882
|
+
[data, column, rowIndex, getRowValidateResult]
|
|
3856
3883
|
);
|
|
3884
|
+
React.useEffect(() => {
|
|
3885
|
+
if (validateAll) {
|
|
3886
|
+
isTouched.current = true;
|
|
3887
|
+
triggerValidate();
|
|
3888
|
+
}
|
|
3889
|
+
}, [validateAll, triggerValidate]);
|
|
3890
|
+
const _onChange = (value, data2) => {
|
|
3891
|
+
const newData = data2.map(
|
|
3892
|
+
(row, i) => i === rowIndex ? __spreadProps$5(__spreadValues$5({}, row), { [column.key]: value }) : row
|
|
3893
|
+
);
|
|
3894
|
+
onChange == null ? void 0 : onChange(newData, rowIndex, column.key);
|
|
3895
|
+
if (validateTriggerType === ValidateTriggerType.Normal && isTouched.current || validateTriggerType === ValidateTriggerType.Aggressive) {
|
|
3896
|
+
triggerValidate(value);
|
|
3897
|
+
}
|
|
3898
|
+
};
|
|
3857
3899
|
const _onBlur = React.useCallback(() => {
|
|
3900
|
+
isTouched.current = true;
|
|
3901
|
+
triggerValidate();
|
|
3858
3902
|
onBlur == null ? void 0 : onBlur(data, rowIndex, column.key);
|
|
3859
|
-
}, [rowIndex, column, onBlur, data]);
|
|
3903
|
+
}, [rowIndex, column, onBlur, data, triggerValidate]);
|
|
3860
3904
|
const renderDefaultComponent = () => {
|
|
3861
3905
|
if (!column.type)
|
|
3862
3906
|
return null;
|
|
3863
3907
|
const CellComponent = ColumnBodyImpls[column.type];
|
|
3864
3908
|
return /* @__PURE__ */ React.createElement(
|
|
3865
3909
|
CellComponent,
|
|
3866
|
-
|
|
3867
|
-
|
|
3910
|
+
{
|
|
3911
|
+
disabled,
|
|
3912
|
+
data,
|
|
3913
|
+
index: rowIndex,
|
|
3914
|
+
latestData,
|
|
3915
|
+
column,
|
|
3916
|
+
visible: props.visible,
|
|
3868
3917
|
onChange: (val) => {
|
|
3869
3918
|
_onChange(val, data);
|
|
3870
3919
|
},
|
|
3871
3920
|
onBlur: _onBlur
|
|
3872
|
-
}
|
|
3921
|
+
}
|
|
3873
3922
|
);
|
|
3874
3923
|
};
|
|
3875
3924
|
const Cell = column.render ? column.render({
|
|
@@ -3894,24 +3943,6 @@
|
|
|
3894
3943
|
})) || null;
|
|
3895
3944
|
return typeof Result === "string" ? /* @__PURE__ */ React.createElement("p", { className: core.cx(Typo.Label.l4_regular, "cell-description") }, Result) : Result;
|
|
3896
3945
|
}, [rowIndex, data, latestData, column]);
|
|
3897
|
-
const validateResult = React.useMemo(() => {
|
|
3898
|
-
var _a;
|
|
3899
|
-
if (isRowError) {
|
|
3900
|
-
return {
|
|
3901
|
-
msg: "",
|
|
3902
|
-
isError: true
|
|
3903
|
-
};
|
|
3904
|
-
}
|
|
3905
|
-
const value = data[rowIndex][column.key];
|
|
3906
|
-
const result = (_a = column.validator) == null ? void 0 : _a.call(column, {
|
|
3907
|
-
value,
|
|
3908
|
-
rowIndex,
|
|
3909
|
-
rowData: data[rowIndex]
|
|
3910
|
-
});
|
|
3911
|
-
if (typeof result === "string" && result) {
|
|
3912
|
-
return { msg: result, isError: true };
|
|
3913
|
-
}
|
|
3914
|
-
}, [data, column, rowIndex, isRowError]);
|
|
3915
3946
|
return /* @__PURE__ */ React.createElement(
|
|
3916
3947
|
"div",
|
|
3917
3948
|
{
|
|
@@ -3925,8 +3956,8 @@
|
|
|
3925
3956
|
/* @__PURE__ */ React.createElement(
|
|
3926
3957
|
FormItem,
|
|
3927
3958
|
{
|
|
3928
|
-
validateStatus: (validateResult == null ? void 0 : validateResult.isError) ? "error" : "",
|
|
3929
|
-
message:
|
|
3959
|
+
validateStatus: isRowError || (validateResult == null ? void 0 : validateResult.isError) ? "error" : "",
|
|
3960
|
+
message: isRowError ? "" : validateResult == null ? void 0 : validateResult.msg
|
|
3930
3961
|
},
|
|
3931
3962
|
Cell
|
|
3932
3963
|
),
|
|
@@ -3960,24 +3991,35 @@
|
|
|
3960
3991
|
latestData,
|
|
3961
3992
|
disabled,
|
|
3962
3993
|
passwordVisible,
|
|
3963
|
-
|
|
3994
|
+
deleteConfig,
|
|
3964
3995
|
draggable,
|
|
3965
3996
|
rowIndex,
|
|
3966
3997
|
provided,
|
|
3967
3998
|
snapshot,
|
|
3999
|
+
validateTriggerType = ValidateTriggerType.Normal,
|
|
3968
4000
|
updateData,
|
|
3969
4001
|
onBodyBlur,
|
|
3970
4002
|
renderRowDescription,
|
|
3971
|
-
rowValidator
|
|
4003
|
+
rowValidator,
|
|
4004
|
+
validateAll
|
|
3972
4005
|
} = props;
|
|
3973
4006
|
const rowData = data[rowIndex];
|
|
3974
|
-
const
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
4007
|
+
const [rowError, setRowError] = React.useState();
|
|
4008
|
+
const deleteRow = React.useCallback(
|
|
4009
|
+
(index, data2) => {
|
|
4010
|
+
const newData = [...data2];
|
|
4011
|
+
newData.splice(index, 1);
|
|
4012
|
+
updateData(newData);
|
|
4013
|
+
},
|
|
4014
|
+
[updateData]
|
|
4015
|
+
);
|
|
4016
|
+
const RowActions = React.useMemo(() => {
|
|
4017
|
+
var _a;
|
|
4018
|
+
const isRowDeleteDisabled = (_a = deleteConfig == null ? void 0 : deleteConfig.specifyRowDeleteDisabled) == null ? void 0 : _a.call(
|
|
4019
|
+
deleteConfig,
|
|
4020
|
+
rowIndex,
|
|
4021
|
+
data
|
|
4022
|
+
);
|
|
3981
4023
|
const DeleteIcon = /* @__PURE__ */ React.createElement(
|
|
3982
4024
|
Icon,
|
|
3983
4025
|
{
|
|
@@ -3987,20 +4029,21 @@
|
|
|
3987
4029
|
onClick: () => {
|
|
3988
4030
|
if (isRowDeleteDisabled)
|
|
3989
4031
|
return;
|
|
3990
|
-
deleteRow(
|
|
4032
|
+
deleteRow(rowIndex, data);
|
|
3991
4033
|
}
|
|
3992
4034
|
}
|
|
3993
4035
|
);
|
|
3994
4036
|
const FinalRenderIcon = isRowDeleteDisabled ? DeleteIcon : /* @__PURE__ */ React.createElement(Tooltip, { title: parrot.parrotI18n.t("components.remove") }, DeleteIcon);
|
|
3995
|
-
return deletable ? [FinalRenderIcon] : void 0;
|
|
3996
|
-
};
|
|
3997
|
-
const
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4037
|
+
return (deleteConfig == null ? void 0 : deleteConfig.deletable) ? [FinalRenderIcon] : void 0;
|
|
4038
|
+
}, [rowIndex, deleteConfig, data, deleteRow]);
|
|
4039
|
+
const getRowValidateResult = React.useCallback(
|
|
4040
|
+
(rowData2) => {
|
|
4041
|
+
const result = rowValidator == null ? void 0 : rowValidator(rowIndex, rowData2);
|
|
4042
|
+
setRowError(result);
|
|
4043
|
+
return result;
|
|
4044
|
+
},
|
|
4045
|
+
[rowValidator, rowIndex]
|
|
4046
|
+
);
|
|
4004
4047
|
const Cells = columns.map((col) => {
|
|
4005
4048
|
return /* @__PURE__ */ React.createElement(
|
|
4006
4049
|
TableFormBodyCell,
|
|
@@ -4014,7 +4057,10 @@
|
|
|
4014
4057
|
onChange: updateData,
|
|
4015
4058
|
onBlur: onBodyBlur,
|
|
4016
4059
|
visible: passwordVisible,
|
|
4017
|
-
|
|
4060
|
+
validateTriggerType,
|
|
4061
|
+
isRowError: !!rowError,
|
|
4062
|
+
getRowValidateResult,
|
|
4063
|
+
validateAll
|
|
4018
4064
|
}
|
|
4019
4065
|
);
|
|
4020
4066
|
});
|
|
@@ -4044,11 +4090,11 @@
|
|
|
4044
4090
|
"eagle-table-form-row",
|
|
4045
4091
|
(snapshot == null ? void 0 : snapshot.isDragging) && "isDragging"
|
|
4046
4092
|
),
|
|
4047
|
-
actions:
|
|
4093
|
+
actions: RowActions
|
|
4048
4094
|
},
|
|
4049
4095
|
DraggableHandle,
|
|
4050
4096
|
Cells,
|
|
4051
|
-
|
|
4097
|
+
rowError ? /* @__PURE__ */ React.createElement("p", { className: core.cx(Typo.Label.l4_regular, "row-error-message") }, rowError) : null,
|
|
4052
4098
|
RowDescription
|
|
4053
4099
|
);
|
|
4054
4100
|
};
|
|
@@ -4116,7 +4162,7 @@
|
|
|
4116
4162
|
const [errMsg, setErrMsg] = React.useState();
|
|
4117
4163
|
const width = Number.isNaN(Number(column.width)) ? column.width : column.width + "px";
|
|
4118
4164
|
const headerOnChange = React.useCallback(
|
|
4119
|
-
(value) => {
|
|
4165
|
+
(value, shouldUpdateData = false) => {
|
|
4120
4166
|
var _a;
|
|
4121
4167
|
const err = (_a = column.validator) == null ? void 0 : _a.call(column, { value, isHeader: true });
|
|
4122
4168
|
setErrMsg(err || void 0);
|
|
@@ -4126,7 +4172,7 @@
|
|
|
4126
4172
|
[column.key]: shouldAutoIncrease && typeof value === "string" ? increaseLastNumber(value, rowIndex) : value
|
|
4127
4173
|
});
|
|
4128
4174
|
});
|
|
4129
|
-
onChange == null ? void 0 : onChange(newData, column.key);
|
|
4175
|
+
onChange == null ? void 0 : onChange(newData, column.key, shouldUpdateData);
|
|
4130
4176
|
},
|
|
4131
4177
|
[onChange, data, column]
|
|
4132
4178
|
);
|
|
@@ -4162,14 +4208,14 @@
|
|
|
4162
4208
|
visibility: column.hidden ? "hidden" : "visible"
|
|
4163
4209
|
}
|
|
4164
4210
|
},
|
|
4165
|
-
/* @__PURE__ */ React.createElement(
|
|
4211
|
+
/* @__PURE__ */ React.createElement("p", { className: core.cx(Typo.Label.l3_bold_title, TitleStyle) }, column.title),
|
|
4212
|
+
disableBatchFilling ? null : /* @__PURE__ */ React.createElement(
|
|
4166
4213
|
FormItem,
|
|
4167
4214
|
{
|
|
4168
4215
|
validateStatus: typeof errMsg === "string" && errMsg ? "error" : "",
|
|
4169
4216
|
message: errMsg || void 0
|
|
4170
4217
|
},
|
|
4171
|
-
|
|
4172
|
-
disableBatchFilling ? null : renderCell()
|
|
4218
|
+
renderCell()
|
|
4173
4219
|
)
|
|
4174
4220
|
);
|
|
4175
4221
|
};
|
|
@@ -4196,16 +4242,18 @@
|
|
|
4196
4242
|
const DEFAULT_ROW_COUNT = 3;
|
|
4197
4243
|
const TableForm = React.forwardRef(
|
|
4198
4244
|
({
|
|
4199
|
-
defaultData,
|
|
4245
|
+
defaultData = [],
|
|
4200
4246
|
columns,
|
|
4201
4247
|
disabled,
|
|
4202
4248
|
rowAddConfig,
|
|
4203
|
-
|
|
4249
|
+
deleteConfig,
|
|
4204
4250
|
size = "default",
|
|
4205
4251
|
className,
|
|
4206
4252
|
draggable,
|
|
4207
4253
|
disableBatchFilling = false,
|
|
4208
4254
|
rowSplitType = "border",
|
|
4255
|
+
validateTriggerType,
|
|
4256
|
+
maxHeight,
|
|
4209
4257
|
renderRowDescription,
|
|
4210
4258
|
rowValidator,
|
|
4211
4259
|
onHeaderChange,
|
|
@@ -4213,12 +4261,10 @@
|
|
|
4213
4261
|
onBodyChange,
|
|
4214
4262
|
onBodyBlur
|
|
4215
4263
|
}, ref) => {
|
|
4216
|
-
const
|
|
4217
|
-
return defaultData || [...Array(DEFAULT_ROW_COUNT)].map(() => genEmptyRow(columns));
|
|
4218
|
-
}, [defaultData, columns]);
|
|
4219
|
-
const [data, setData] = React.useState(treatedDefaultData);
|
|
4264
|
+
const [data, setData] = React.useState(defaultData);
|
|
4220
4265
|
const [passwordVisible, setPasswordVisible] = React.useState(false);
|
|
4221
|
-
const [latestData, setLatestData] = React.useState(
|
|
4266
|
+
const [latestData, setLatestData] = React.useState(defaultData);
|
|
4267
|
+
const [validateAll, setValidateAll] = React.useState(false);
|
|
4222
4268
|
const updateData = React.useCallback(
|
|
4223
4269
|
(value, rowIndex, columnKey) => {
|
|
4224
4270
|
setLatestData(value);
|
|
@@ -4227,12 +4273,23 @@
|
|
|
4227
4273
|
},
|
|
4228
4274
|
[onBodyChange]
|
|
4229
4275
|
);
|
|
4276
|
+
React.useLayoutEffect(() => {
|
|
4277
|
+
if (defaultData.length === 0) {
|
|
4278
|
+
updateData(
|
|
4279
|
+
[...Array(DEFAULT_ROW_COUNT)].map(() => genEmptyRow(columns))
|
|
4280
|
+
);
|
|
4281
|
+
}
|
|
4282
|
+
}, []);
|
|
4230
4283
|
const handleBatchChange = React.useCallback(
|
|
4231
|
-
(newData, columnKey) => {
|
|
4284
|
+
(newData, columnKey, shouldUpdateData) => {
|
|
4232
4285
|
setLatestData(newData);
|
|
4233
4286
|
onHeaderChange == null ? void 0 : onHeaderChange(newData, columnKey);
|
|
4287
|
+
if (shouldUpdateData) {
|
|
4288
|
+
setData(newData);
|
|
4289
|
+
onBodyChange == null ? void 0 : onBodyChange(newData, void 0, columnKey);
|
|
4290
|
+
}
|
|
4234
4291
|
},
|
|
4235
|
-
[onHeaderChange]
|
|
4292
|
+
[onHeaderChange, onBodyChange]
|
|
4236
4293
|
);
|
|
4237
4294
|
const handleBatchBlur = React.useCallback(
|
|
4238
4295
|
(key, error) => {
|
|
@@ -4257,6 +4314,9 @@
|
|
|
4257
4314
|
() => ({
|
|
4258
4315
|
setData: (data2) => {
|
|
4259
4316
|
updateData(data2);
|
|
4317
|
+
},
|
|
4318
|
+
validateWholeFields() {
|
|
4319
|
+
setValidateAll(true);
|
|
4260
4320
|
}
|
|
4261
4321
|
}),
|
|
4262
4322
|
[updateData]
|
|
@@ -4277,31 +4337,46 @@
|
|
|
4277
4337
|
}
|
|
4278
4338
|
);
|
|
4279
4339
|
});
|
|
4280
|
-
|
|
4281
|
-
|
|
4340
|
+
const tableFormWrapperStyle = React.useMemo(
|
|
4341
|
+
() => maxHeight ? {
|
|
4342
|
+
maxHeight: typeof maxHeight === "number" ? maxHeight + "px" : maxHeight
|
|
4343
|
+
} : void 0,
|
|
4344
|
+
[]
|
|
4345
|
+
);
|
|
4346
|
+
return /* @__PURE__ */ React.createElement("div", { className }, /* @__PURE__ */ React.createElement(
|
|
4347
|
+
TableFormWrapper,
|
|
4282
4348
|
{
|
|
4283
|
-
className:
|
|
4284
|
-
|
|
4349
|
+
className: `table-form row-split-by-${rowSplitType}`,
|
|
4350
|
+
style: tableFormWrapperStyle
|
|
4285
4351
|
},
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4352
|
+
/* @__PURE__ */ React.createElement(antd.List, { size, className: `size-${size}` }, /* @__PURE__ */ React.createElement(
|
|
4353
|
+
antd.List.Item,
|
|
4354
|
+
{
|
|
4355
|
+
className: "eagle-table-form-header",
|
|
4356
|
+
actions: (deleteConfig == null ? void 0 : deleteConfig.deletable) ? [/* @__PURE__ */ React.createElement(React.Fragment, null)] : void 0
|
|
4357
|
+
},
|
|
4358
|
+
draggable ? /* @__PURE__ */ React.createElement(DraggableHandleWrapper, null) : null,
|
|
4359
|
+
headerCells
|
|
4360
|
+
), /* @__PURE__ */ React.createElement(
|
|
4361
|
+
TableFormBodyRows,
|
|
4362
|
+
{
|
|
4363
|
+
data,
|
|
4364
|
+
latestData,
|
|
4365
|
+
columns,
|
|
4366
|
+
passwordVisible,
|
|
4367
|
+
deleteConfig,
|
|
4368
|
+
disabled,
|
|
4369
|
+
draggable,
|
|
4370
|
+
rowSplitType,
|
|
4371
|
+
validateTriggerType,
|
|
4372
|
+
onBodyBlur,
|
|
4373
|
+
updateData,
|
|
4374
|
+
renderRowDescription,
|
|
4375
|
+
rowValidator,
|
|
4376
|
+
validateAll
|
|
4377
|
+
}
|
|
4378
|
+
))
|
|
4379
|
+
), (rowAddConfig == null ? void 0 : rowAddConfig.addible) ? /* @__PURE__ */ React.createElement(
|
|
4305
4380
|
AddRowButton,
|
|
4306
4381
|
{
|
|
4307
4382
|
config: rowAddConfig,
|
|
@@ -4313,7 +4388,7 @@
|
|
|
4313
4388
|
}
|
|
4314
4389
|
);
|
|
4315
4390
|
|
|
4316
|
-
const
|
|
4391
|
+
const allTimeZones = _.uniqBy(TimeZones.reduce((sum, zone) => {
|
|
4317
4392
|
const utcZones = zone.utc.map(utc => {
|
|
4318
4393
|
return {
|
|
4319
4394
|
abbr: zone.abbr,
|
|
@@ -4323,31 +4398,51 @@
|
|
|
4323
4398
|
};
|
|
4324
4399
|
});
|
|
4325
4400
|
return sum.concat(utcZones);
|
|
4326
|
-
}, []), "value")
|
|
4401
|
+
}, []), "value");
|
|
4402
|
+
const timeZoneGroups = (() => {
|
|
4403
|
+
const groupedTimeZones = _.groupBy(allTimeZones, tz => tz.value.split("/")[0]);
|
|
4404
|
+
delete groupedTimeZones["CST6CDT"];
|
|
4405
|
+
delete groupedTimeZones["MST7MDT"];
|
|
4406
|
+
delete groupedTimeZones["PST8PDT"];
|
|
4407
|
+
delete groupedTimeZones["Etc"];
|
|
4408
|
+
return _.sortBy(_.toPairs(groupedTimeZones).map(([key, tzs]) => {
|
|
4409
|
+
return [key, _.sortBy(tzs, "value")];
|
|
4410
|
+
}), "0");
|
|
4411
|
+
})();
|
|
4327
4412
|
const SelectStyle = "s1fc623g";
|
|
4328
|
-
const
|
|
4329
|
-
const
|
|
4330
|
-
const
|
|
4413
|
+
const DropdownStyle = "da3mx0o";
|
|
4414
|
+
const OptionWrapperStyle = core.cx("onr9gzt", Typo.Label.l3_regular);
|
|
4415
|
+
const OptionFirstLineStyle = core.cx("oiy0apc", Typo.Label.l3_regular);
|
|
4416
|
+
const OptionSecondLineStyle = core.cx("of4y382", Typo.Label.l4_regular);
|
|
4417
|
+
const TagStyle = "t19903l9";
|
|
4331
4418
|
const BrowserTimeValue = "browser_time_zone";
|
|
4419
|
+
const DefaultTimeValue = "default_time_zone";
|
|
4332
4420
|
const browserTzName = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
4333
|
-
const browserTz =
|
|
4421
|
+
const browserTz = allTimeZones.find(tz => tz.value === browserTzName) || allTimeZones[0];
|
|
4334
4422
|
const TimeZoneSelect = props => {
|
|
4335
4423
|
const {
|
|
4336
4424
|
value,
|
|
4337
4425
|
onChange,
|
|
4338
4426
|
disabled,
|
|
4339
4427
|
defaultUseBrowserTime,
|
|
4340
|
-
className
|
|
4428
|
+
className,
|
|
4429
|
+
placeholder,
|
|
4430
|
+
defaultOptionValue
|
|
4341
4431
|
} = props;
|
|
4342
4432
|
const [innerValue, setInnerValue] = React.useState(value);
|
|
4433
|
+
const defaultTz = React.useMemo(() => {
|
|
4434
|
+
return allTimeZones.find(tz => tz.value === defaultOptionValue);
|
|
4435
|
+
}, [defaultOptionValue]);
|
|
4343
4436
|
const _onChange = React.useCallback(val => {
|
|
4344
4437
|
setInnerValue(val);
|
|
4345
4438
|
if (val === BrowserTimeValue) {
|
|
4346
4439
|
onChange(browserTzName);
|
|
4440
|
+
} else if (val === DefaultTimeValue && defaultTz) {
|
|
4441
|
+
onChange(defaultTz == null ? void 0 : defaultTz.value);
|
|
4347
4442
|
} else {
|
|
4348
4443
|
onChange(val);
|
|
4349
4444
|
}
|
|
4350
|
-
}, [onChange]);
|
|
4445
|
+
}, [defaultTz, onChange]);
|
|
4351
4446
|
React.useEffect(() => {
|
|
4352
4447
|
if (defaultUseBrowserTime && !value) {
|
|
4353
4448
|
setInnerValue(BrowserTimeValue);
|
|
@@ -4356,12 +4451,28 @@
|
|
|
4356
4451
|
}, []);
|
|
4357
4452
|
React.useEffect(() => {
|
|
4358
4453
|
if (innerValue === BrowserTimeValue && value === browserTzName) return;
|
|
4454
|
+
if (innerValue === DefaultTimeValue && value === (defaultTz == null ? void 0 : defaultTz.value)) return;
|
|
4359
4455
|
if (innerValue === value) return;
|
|
4360
4456
|
setInnerValue(value);
|
|
4361
|
-
}, [innerValue, value]);
|
|
4457
|
+
}, [defaultTz == null ? void 0 : defaultTz.value, innerValue, value]);
|
|
4458
|
+
const timeZoneOptionGroups = timeZoneGroups.map(([key, timezones]) => {
|
|
4459
|
+
return /* @__PURE__ */React.createElement(antd.Select.OptGroup, {
|
|
4460
|
+
label: key.toUpperCase()
|
|
4461
|
+
}, timezones.map(zone => {
|
|
4462
|
+
return /* @__PURE__ */React.createElement(antd.Select.Option, {
|
|
4463
|
+
label: zone.value,
|
|
4464
|
+
value: zone.value,
|
|
4465
|
+
className: OptionWrapperStyle
|
|
4466
|
+
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4467
|
+
key: zone.value,
|
|
4468
|
+
timeZone: zone
|
|
4469
|
+
}));
|
|
4470
|
+
}));
|
|
4471
|
+
});
|
|
4362
4472
|
return /* @__PURE__ */React.createElement(Select, {
|
|
4363
4473
|
className: core.cx(SelectStyle, className),
|
|
4364
|
-
|
|
4474
|
+
dropdownClassName: DropdownStyle,
|
|
4475
|
+
placeholder: /* @__PURE__ */React.createElement("span", null, placeholder || parrot.parrotI18n.t("components.time_zone_select_placeholder")),
|
|
4365
4476
|
value: innerValue,
|
|
4366
4477
|
onChange: _onChange,
|
|
4367
4478
|
showSearch: true,
|
|
@@ -4371,53 +4482,64 @@
|
|
|
4371
4482
|
},
|
|
4372
4483
|
optionLabelProp: "label",
|
|
4373
4484
|
input: {}
|
|
4374
|
-
}, /* @__PURE__ */React.createElement(antd.Select.Option, {
|
|
4485
|
+
}, defaultTz ? /* @__PURE__ */React.createElement(antd.Select.Option, {
|
|
4486
|
+
value: DefaultTimeValue,
|
|
4487
|
+
label: `${parrot.parrotI18n.t("components.default_time_zone")} (${getUTCOffsetText(defaultTz.offset)})`,
|
|
4488
|
+
className: OptionWrapperStyle
|
|
4489
|
+
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4490
|
+
key: DefaultTimeValue,
|
|
4491
|
+
customLabel: parrot.parrotI18n.t("components.default_time_zone"),
|
|
4492
|
+
timeZone: defaultTz
|
|
4493
|
+
})) : void 0, /* @__PURE__ */React.createElement(antd.Select.Option, {
|
|
4375
4494
|
value: BrowserTimeValue,
|
|
4376
|
-
label: parrot.parrotI18n.t("components.browser_time_zone")
|
|
4495
|
+
label: `${parrot.parrotI18n.t("components.browser_time_zone")} (${getUTCOffsetText(browserTz.offset)})`,
|
|
4377
4496
|
className: OptionWrapperStyle
|
|
4378
4497
|
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4379
4498
|
key: BrowserTimeValue,
|
|
4380
|
-
|
|
4499
|
+
customLabel: parrot.parrotI18n.t("components.browser_time_zone"),
|
|
4381
4500
|
timeZone: browserTz
|
|
4382
4501
|
})), /* @__PURE__ */React.createElement(antd.Select.Option, {
|
|
4383
4502
|
value: "UTC",
|
|
4384
4503
|
className: OptionWrapperStyle
|
|
4385
4504
|
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4386
4505
|
key: "utc",
|
|
4506
|
+
customLabel: parrot.parrotI18n.t("components.coorddinated_universal_time"),
|
|
4387
4507
|
timeZone: {
|
|
4388
4508
|
value: "UTC",
|
|
4389
4509
|
text: "UTC",
|
|
4390
4510
|
offset: 0,
|
|
4391
|
-
abbr: "
|
|
4511
|
+
abbr: "GMT"
|
|
4392
4512
|
}
|
|
4393
|
-
})),
|
|
4394
|
-
return /* @__PURE__ */React.createElement(antd.Select.Option, {
|
|
4395
|
-
label: zone.value,
|
|
4396
|
-
value: zone.value,
|
|
4397
|
-
className: OptionWrapperStyle
|
|
4398
|
-
}, /* @__PURE__ */React.createElement(TimeZoneOption, {
|
|
4399
|
-
key: zone.value,
|
|
4400
|
-
timeZone: zone
|
|
4401
|
-
}));
|
|
4402
|
-
}));
|
|
4513
|
+
})), timeZoneOptionGroups);
|
|
4403
4514
|
};
|
|
4515
|
+
function getUTCOffsetText(offset) {
|
|
4516
|
+
if (offset === 0) {
|
|
4517
|
+
return "UTC";
|
|
4518
|
+
} else if (offset < 0) {
|
|
4519
|
+
return `UTC${offset}:00`;
|
|
4520
|
+
} else {
|
|
4521
|
+
return `UTC+${offset}:00`;
|
|
4522
|
+
}
|
|
4523
|
+
}
|
|
4404
4524
|
const TimeZoneOption = ({
|
|
4405
4525
|
timeZone,
|
|
4406
|
-
|
|
4526
|
+
customLabel
|
|
4407
4527
|
}) => {
|
|
4408
|
-
let tagText =
|
|
4409
|
-
if (timeZone.offset === 0) {
|
|
4410
|
-
tagText = "UTC";
|
|
4411
|
-
} else if (timeZone.offset < 0) {
|
|
4412
|
-
tagText = `UTC${timeZone.offset}:00`;
|
|
4413
|
-
} else {
|
|
4414
|
-
tagText = `UTC+${timeZone.offset}:00`;
|
|
4415
|
-
}
|
|
4528
|
+
let tagText = getUTCOffsetText(timeZone.offset);
|
|
4416
4529
|
return /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement("div", {
|
|
4417
4530
|
className: OptionFirstLineStyle
|
|
4418
|
-
}, /* @__PURE__ */React.createElement("span",
|
|
4531
|
+
}, /* @__PURE__ */React.createElement("span", {
|
|
4532
|
+
className: "timezone-title"
|
|
4533
|
+
}, customLabel || timeZone.value), /* @__PURE__ */React.createElement(antd.Tag, {
|
|
4534
|
+
className: core.cx("timezone-tag", TagStyle)
|
|
4535
|
+
}, tagText)), /* @__PURE__ */React.createElement("div", {
|
|
4419
4536
|
className: OptionSecondLineStyle
|
|
4420
|
-
}, /* @__PURE__ */React.createElement("span", null, timeZone.text, ", ", timeZone.abbr)
|
|
4537
|
+
}, /* @__PURE__ */React.createElement("span", null, timeZone.text, ", ", timeZone.abbr), /* @__PURE__ */React.createElement(Icon, {
|
|
4538
|
+
className: "selected-icon",
|
|
4539
|
+
src: iconsReact.CheckmarkDoneSuccessCorrect16BlueIcon,
|
|
4540
|
+
iconHeight: 16,
|
|
4541
|
+
iconWidth: 16
|
|
4542
|
+
})));
|
|
4421
4543
|
};
|
|
4422
4544
|
|
|
4423
4545
|
function getAntdKit() {
|
|
@@ -4681,6 +4803,7 @@
|
|
|
4681
4803
|
exports.UIKitProvider = UIKitProvider;
|
|
4682
4804
|
exports.UIKitStore = UIKitStore;
|
|
4683
4805
|
exports.UserSource = UserSource;
|
|
4806
|
+
exports.ValidateTriggerType = ValidateTriggerType;
|
|
4684
4807
|
exports.antdKit = antdKit;
|
|
4685
4808
|
exports.closeModal = closeModal;
|
|
4686
4809
|
exports.createBatchMessageMethods = createBatchMessageMethods;
|