jrs-react 1.2.29 → 1.2.30
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/build/index.es.js +29 -40
- package/build/index.js +29 -39
- package/package.json +1 -1
- package/src/components/JRFrame/JRFrame.jsx +3 -12
- package/src/components/JRInput/JValue.jsx +30 -0
- package/src/components/JRMask/JRMask.jsx +0 -3
- package/src/components/JRSubmit.jsx +23 -13
- package/src/components/JRTable/TBodies.jsx +37 -49
- package/src/index.js +2 -3
package/build/index.es.js
CHANGED
|
@@ -3576,7 +3576,6 @@ function JRDialogMask({
|
|
|
3576
3576
|
function JRDivMask({
|
|
3577
3577
|
id = 'jr-mask'
|
|
3578
3578
|
}) {
|
|
3579
|
-
// po(`create JRDivMask id=${id}`)
|
|
3580
3579
|
return /*#__PURE__*/React__default.createElement(StyledDivMask, {
|
|
3581
3580
|
id: id
|
|
3582
3581
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -3631,8 +3630,6 @@ class Mask extends JRHTML {
|
|
|
3631
3630
|
}
|
|
3632
3631
|
function showMask(msg, maskId = 'jr-mask') {
|
|
3633
3632
|
const jrMask = document.getElementById(maskId);
|
|
3634
|
-
// po(`showMask find id=${maskId}`)
|
|
3635
|
-
// po('jrMask',jrMask)
|
|
3636
3633
|
if (jrMask) {
|
|
3637
3634
|
const jrMaskMsg = document.getElementById(`${maskId}-msg`);
|
|
3638
3635
|
if (!jrMask.maskDiv) {
|
|
@@ -3885,15 +3882,13 @@ class JRSubmit extends React__default.Component {
|
|
|
3885
3882
|
return axiosSubmit[method](url, params1, params2);
|
|
3886
3883
|
}
|
|
3887
3884
|
})().then(res => {
|
|
3888
|
-
// setTimeout(()=>{
|
|
3889
3885
|
this.handleResponse(res, _payload, config);
|
|
3890
|
-
// config.removeMaskFunction?.()
|
|
3891
|
-
// },random(2000,1000))
|
|
3892
3886
|
}).catch(res => {
|
|
3893
3887
|
this.handleResponse(res, _payload, config);
|
|
3894
|
-
}).finally(() => {
|
|
3895
|
-
config.removeMaskFunction?.();
|
|
3896
3888
|
});
|
|
3889
|
+
// .finally(()=> {
|
|
3890
|
+
// config.removeMaskFunction?.()
|
|
3891
|
+
// })
|
|
3897
3892
|
}
|
|
3898
3893
|
handleResponse = (response, payload, config) => {
|
|
3899
3894
|
if (Array.isArray(response)) {
|
|
@@ -3911,12 +3906,23 @@ class JRSubmit extends React__default.Component {
|
|
|
3911
3906
|
response = config?.response?.bind(this)(response, payload) ?? response;
|
|
3912
3907
|
const isSuccess = response.status >= 200 && response.status <= 299;
|
|
3913
3908
|
this.setRes(isSuccess, response, config);
|
|
3914
|
-
|
|
3915
|
-
|
|
3909
|
+
if (config.delay != null) {
|
|
3910
|
+
setTimeout(() => {
|
|
3911
|
+
this.showMessage(isSuccess, isSuccess ? config.successMessage : config.failedMessage);
|
|
3912
|
+
config.callback?.bind(this)(isSuccess, response, payload);
|
|
3913
|
+
config.removeMaskFunction?.();
|
|
3914
|
+
}, config.delay);
|
|
3915
|
+
} else {
|
|
3916
|
+
this.showMessage(isSuccess, isSuccess ? config.successMessage : config.failedMessage);
|
|
3917
|
+
config.callback?.bind(this)(isSuccess, response, payload);
|
|
3918
|
+
config.removeMaskFunction?.();
|
|
3919
|
+
}
|
|
3916
3920
|
};
|
|
3917
3921
|
showMessage(success, message) {
|
|
3918
|
-
|
|
3919
|
-
|
|
3922
|
+
if (message) {
|
|
3923
|
+
po('success', success);
|
|
3924
|
+
po('message', message);
|
|
3925
|
+
}
|
|
3920
3926
|
}
|
|
3921
3927
|
renderer() {
|
|
3922
3928
|
return;
|
|
@@ -3956,22 +3962,15 @@ const StyledJRFrame = styled.div`
|
|
|
3956
3962
|
flex:1;
|
|
3957
3963
|
overflow:hidden;
|
|
3958
3964
|
|
|
3959
|
-
> *{
|
|
3960
|
-
Xborder:1px solid gray;
|
|
3961
|
-
}
|
|
3962
3965
|
>main{
|
|
3963
3966
|
display:flex;
|
|
3964
3967
|
flex:1;
|
|
3965
3968
|
overflow:hidden;
|
|
3966
3969
|
flex-direction: column;
|
|
3967
3970
|
> *{
|
|
3968
|
-
XXborder:1px solid gray;
|
|
3969
|
-
XXmin-height:30px;
|
|
3970
3971
|
}
|
|
3971
3972
|
|
|
3972
3973
|
>header{
|
|
3973
|
-
XXborder:1px solid red;
|
|
3974
|
-
XXoverflow: overlay;
|
|
3975
3974
|
}
|
|
3976
3975
|
>main{
|
|
3977
3976
|
display:flex;
|
|
@@ -3981,13 +3980,12 @@ const StyledJRFrame = styled.div`
|
|
|
3981
3980
|
>main{
|
|
3982
3981
|
width:100%;
|
|
3983
3982
|
xdisplay:flex;
|
|
3984
|
-
|
|
3983
|
+
flex:1;
|
|
3985
3984
|
overflow: overlay;
|
|
3986
3985
|
}
|
|
3987
3986
|
|
|
3988
3987
|
}
|
|
3989
3988
|
>footer{
|
|
3990
|
-
XXborder:1px solid blue;
|
|
3991
3989
|
overflow: overlay;
|
|
3992
3990
|
}
|
|
3993
3991
|
|
|
@@ -4000,7 +3998,7 @@ class JRFrame extends JRSubmit {
|
|
|
4000
3998
|
type,
|
|
4001
3999
|
props
|
|
4002
4000
|
} = this.props.mask;
|
|
4003
|
-
this.maskId = `mask-${this.rid}`;
|
|
4001
|
+
this.maskId = `mask-${props.id ?? this.rid}`;
|
|
4004
4002
|
return /*#__PURE__*/React__default.createElement(type, {
|
|
4005
4003
|
...props,
|
|
4006
4004
|
id: this.maskId
|
|
@@ -5127,7 +5125,6 @@ const Ths = ({
|
|
|
5127
5125
|
} else {
|
|
5128
5126
|
content = column.label;
|
|
5129
5127
|
}
|
|
5130
|
-
// style.textAlign=align
|
|
5131
5128
|
return /*#__PURE__*/React__default.createElement("th", {
|
|
5132
5129
|
key: colIndex,
|
|
5133
5130
|
style: {
|
|
@@ -5220,11 +5217,6 @@ const Td = ({
|
|
|
5220
5217
|
value,
|
|
5221
5218
|
record
|
|
5222
5219
|
}, {});
|
|
5223
|
-
const setStyle = _style => {
|
|
5224
|
-
style = _style;
|
|
5225
|
-
};
|
|
5226
|
-
setStyle.bind(table);
|
|
5227
|
-
render?.bind(table);
|
|
5228
5220
|
if (type) {
|
|
5229
5221
|
const typeStyle = flexType(_typeStyle, table, {
|
|
5230
5222
|
record
|
|
@@ -5239,14 +5231,17 @@ const Td = ({
|
|
|
5239
5231
|
} : onChange,
|
|
5240
5232
|
value,
|
|
5241
5233
|
style: typeStyle,
|
|
5242
|
-
render,
|
|
5234
|
+
render: render?.bind(table),
|
|
5243
5235
|
...column,
|
|
5244
5236
|
...funcProps?.bind(table)({
|
|
5245
5237
|
value
|
|
5246
5238
|
})
|
|
5247
5239
|
});
|
|
5248
5240
|
} else if (render) {
|
|
5249
|
-
|
|
5241
|
+
const setStyle = _style => {
|
|
5242
|
+
style = _style;
|
|
5243
|
+
};
|
|
5244
|
+
content = render.bind(table)({
|
|
5250
5245
|
index: trIndex,
|
|
5251
5246
|
groupIndex: tbodyIndex,
|
|
5252
5247
|
value,
|
|
@@ -5301,7 +5296,7 @@ const TBody = ({
|
|
|
5301
5296
|
table,
|
|
5302
5297
|
tbodyIndex
|
|
5303
5298
|
};
|
|
5304
|
-
return /*#__PURE__*/React__default.createElement(
|
|
5299
|
+
return /*#__PURE__*/React__default.createElement("tbody", {
|
|
5305
5300
|
key: `tbody${tbodyIndex}`
|
|
5306
5301
|
}, groupData?.length > 0 && /*#__PURE__*/React__default.createElement(GroupHeader, _extends({
|
|
5307
5302
|
groupData: groupData,
|
|
@@ -5326,7 +5321,7 @@ const TBody = ({
|
|
|
5326
5321
|
}), groupData?.length > 0 && /*#__PURE__*/React__default.createElement(GroupFooter, _extends({
|
|
5327
5322
|
groupData: groupData,
|
|
5328
5323
|
columns: groupFooter
|
|
5329
|
-
}, neededProps)))
|
|
5324
|
+
}, neededProps)));
|
|
5330
5325
|
};
|
|
5331
5326
|
const TBodies = ({
|
|
5332
5327
|
groupHeader,
|
|
@@ -5335,18 +5330,12 @@ const TBodies = ({
|
|
|
5335
5330
|
dataSource: _dataSource,
|
|
5336
5331
|
table
|
|
5337
5332
|
}) => {
|
|
5338
|
-
// po('--TBodies--')
|
|
5339
5333
|
const isGroupDataType = Array.isArray(_dataSource?.[0]);
|
|
5340
5334
|
const dataSource = isGroupDataType ? _dataSource : [_dataSource];
|
|
5341
|
-
|
|
5342
|
-
// po('dataSource',dataSource)
|
|
5343
5335
|
return dataSource?.map((groupData, tbodyIndex, c) => {
|
|
5344
5336
|
return /*#__PURE__*/React__default.createElement(TBody, {
|
|
5345
5337
|
key: `tbody${tbodyIndex}`,
|
|
5346
|
-
table: table
|
|
5347
|
-
// dataSource={dataSource}
|
|
5348
|
-
// dataGroup={groupData}
|
|
5349
|
-
,
|
|
5338
|
+
table: table,
|
|
5350
5339
|
groupData: groupData,
|
|
5351
5340
|
tbodyIndex: tbodyIndex,
|
|
5352
5341
|
groupHeader: groupHeader,
|
|
@@ -6549,4 +6538,4 @@ class JRText extends JRInput {
|
|
|
6549
6538
|
}
|
|
6550
6539
|
}
|
|
6551
6540
|
|
|
6552
|
-
export { JRAlert, JRButton, JRCheckbox, JRDivMask, JRFields, JRFrame, JRDialogMask as JRMask, JRRadio, JRSelect, JRSubmit, JRTable, JRTestReact, JRText, JRWindow, random, showMask };
|
|
6541
|
+
export { JRAlert, JRButton, JRCheckbox, JRDivMask, JRFields, JRFrame, JRDialogMask as JRMask, JRRadio, JRSelect, JRSubmit, JRTable, JRTestReact, JRText, JRWindow, po, random, showMask };
|
package/build/index.js
CHANGED
|
@@ -3603,7 +3603,6 @@ function JRDialogMask({
|
|
|
3603
3603
|
function JRDivMask({
|
|
3604
3604
|
id = 'jr-mask'
|
|
3605
3605
|
}) {
|
|
3606
|
-
// po(`create JRDivMask id=${id}`)
|
|
3607
3606
|
return /*#__PURE__*/React__default["default"].createElement(StyledDivMask, {
|
|
3608
3607
|
id: id
|
|
3609
3608
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -3658,8 +3657,6 @@ class Mask extends JRHTML {
|
|
|
3658
3657
|
}
|
|
3659
3658
|
function showMask(msg, maskId = 'jr-mask') {
|
|
3660
3659
|
const jrMask = document.getElementById(maskId);
|
|
3661
|
-
// po(`showMask find id=${maskId}`)
|
|
3662
|
-
// po('jrMask',jrMask)
|
|
3663
3660
|
if (jrMask) {
|
|
3664
3661
|
const jrMaskMsg = document.getElementById(`${maskId}-msg`);
|
|
3665
3662
|
if (!jrMask.maskDiv) {
|
|
@@ -3912,15 +3909,13 @@ class JRSubmit extends React__default["default"].Component {
|
|
|
3912
3909
|
return axiosSubmit[method](url, params1, params2);
|
|
3913
3910
|
}
|
|
3914
3911
|
})().then(res => {
|
|
3915
|
-
// setTimeout(()=>{
|
|
3916
3912
|
this.handleResponse(res, _payload, config);
|
|
3917
|
-
// config.removeMaskFunction?.()
|
|
3918
|
-
// },random(2000,1000))
|
|
3919
3913
|
}).catch(res => {
|
|
3920
3914
|
this.handleResponse(res, _payload, config);
|
|
3921
|
-
}).finally(() => {
|
|
3922
|
-
config.removeMaskFunction?.();
|
|
3923
3915
|
});
|
|
3916
|
+
// .finally(()=> {
|
|
3917
|
+
// config.removeMaskFunction?.()
|
|
3918
|
+
// })
|
|
3924
3919
|
}
|
|
3925
3920
|
handleResponse = (response, payload, config) => {
|
|
3926
3921
|
if (Array.isArray(response)) {
|
|
@@ -3938,12 +3933,23 @@ class JRSubmit extends React__default["default"].Component {
|
|
|
3938
3933
|
response = config?.response?.bind(this)(response, payload) ?? response;
|
|
3939
3934
|
const isSuccess = response.status >= 200 && response.status <= 299;
|
|
3940
3935
|
this.setRes(isSuccess, response, config);
|
|
3941
|
-
|
|
3942
|
-
|
|
3936
|
+
if (config.delay != null) {
|
|
3937
|
+
setTimeout(() => {
|
|
3938
|
+
this.showMessage(isSuccess, isSuccess ? config.successMessage : config.failedMessage);
|
|
3939
|
+
config.callback?.bind(this)(isSuccess, response, payload);
|
|
3940
|
+
config.removeMaskFunction?.();
|
|
3941
|
+
}, config.delay);
|
|
3942
|
+
} else {
|
|
3943
|
+
this.showMessage(isSuccess, isSuccess ? config.successMessage : config.failedMessage);
|
|
3944
|
+
config.callback?.bind(this)(isSuccess, response, payload);
|
|
3945
|
+
config.removeMaskFunction?.();
|
|
3946
|
+
}
|
|
3943
3947
|
};
|
|
3944
3948
|
showMessage(success, message) {
|
|
3945
|
-
|
|
3946
|
-
|
|
3949
|
+
if (message) {
|
|
3950
|
+
po('success', success);
|
|
3951
|
+
po('message', message);
|
|
3952
|
+
}
|
|
3947
3953
|
}
|
|
3948
3954
|
renderer() {
|
|
3949
3955
|
return;
|
|
@@ -3983,22 +3989,15 @@ const StyledJRFrame = styled__default["default"].div`
|
|
|
3983
3989
|
flex:1;
|
|
3984
3990
|
overflow:hidden;
|
|
3985
3991
|
|
|
3986
|
-
> *{
|
|
3987
|
-
Xborder:1px solid gray;
|
|
3988
|
-
}
|
|
3989
3992
|
>main{
|
|
3990
3993
|
display:flex;
|
|
3991
3994
|
flex:1;
|
|
3992
3995
|
overflow:hidden;
|
|
3993
3996
|
flex-direction: column;
|
|
3994
3997
|
> *{
|
|
3995
|
-
XXborder:1px solid gray;
|
|
3996
|
-
XXmin-height:30px;
|
|
3997
3998
|
}
|
|
3998
3999
|
|
|
3999
4000
|
>header{
|
|
4000
|
-
XXborder:1px solid red;
|
|
4001
|
-
XXoverflow: overlay;
|
|
4002
4001
|
}
|
|
4003
4002
|
>main{
|
|
4004
4003
|
display:flex;
|
|
@@ -4008,13 +4007,12 @@ const StyledJRFrame = styled__default["default"].div`
|
|
|
4008
4007
|
>main{
|
|
4009
4008
|
width:100%;
|
|
4010
4009
|
xdisplay:flex;
|
|
4011
|
-
|
|
4010
|
+
flex:1;
|
|
4012
4011
|
overflow: overlay;
|
|
4013
4012
|
}
|
|
4014
4013
|
|
|
4015
4014
|
}
|
|
4016
4015
|
>footer{
|
|
4017
|
-
XXborder:1px solid blue;
|
|
4018
4016
|
overflow: overlay;
|
|
4019
4017
|
}
|
|
4020
4018
|
|
|
@@ -4027,7 +4025,7 @@ class JRFrame extends JRSubmit {
|
|
|
4027
4025
|
type,
|
|
4028
4026
|
props
|
|
4029
4027
|
} = this.props.mask;
|
|
4030
|
-
this.maskId = `mask-${this.rid}`;
|
|
4028
|
+
this.maskId = `mask-${props.id ?? this.rid}`;
|
|
4031
4029
|
return /*#__PURE__*/React__default["default"].createElement(type, {
|
|
4032
4030
|
...props,
|
|
4033
4031
|
id: this.maskId
|
|
@@ -5154,7 +5152,6 @@ const Ths = ({
|
|
|
5154
5152
|
} else {
|
|
5155
5153
|
content = column.label;
|
|
5156
5154
|
}
|
|
5157
|
-
// style.textAlign=align
|
|
5158
5155
|
return /*#__PURE__*/React__default["default"].createElement("th", {
|
|
5159
5156
|
key: colIndex,
|
|
5160
5157
|
style: {
|
|
@@ -5247,11 +5244,6 @@ const Td = ({
|
|
|
5247
5244
|
value,
|
|
5248
5245
|
record
|
|
5249
5246
|
}, {});
|
|
5250
|
-
const setStyle = _style => {
|
|
5251
|
-
style = _style;
|
|
5252
|
-
};
|
|
5253
|
-
setStyle.bind(table);
|
|
5254
|
-
render?.bind(table);
|
|
5255
5247
|
if (type) {
|
|
5256
5248
|
const typeStyle = flexType(_typeStyle, table, {
|
|
5257
5249
|
record
|
|
@@ -5266,14 +5258,17 @@ const Td = ({
|
|
|
5266
5258
|
} : onChange,
|
|
5267
5259
|
value,
|
|
5268
5260
|
style: typeStyle,
|
|
5269
|
-
render,
|
|
5261
|
+
render: render?.bind(table),
|
|
5270
5262
|
...column,
|
|
5271
5263
|
...funcProps?.bind(table)({
|
|
5272
5264
|
value
|
|
5273
5265
|
})
|
|
5274
5266
|
});
|
|
5275
5267
|
} else if (render) {
|
|
5276
|
-
|
|
5268
|
+
const setStyle = _style => {
|
|
5269
|
+
style = _style;
|
|
5270
|
+
};
|
|
5271
|
+
content = render.bind(table)({
|
|
5277
5272
|
index: trIndex,
|
|
5278
5273
|
groupIndex: tbodyIndex,
|
|
5279
5274
|
value,
|
|
@@ -5328,7 +5323,7 @@ const TBody = ({
|
|
|
5328
5323
|
table,
|
|
5329
5324
|
tbodyIndex
|
|
5330
5325
|
};
|
|
5331
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
5326
|
+
return /*#__PURE__*/React__default["default"].createElement("tbody", {
|
|
5332
5327
|
key: `tbody${tbodyIndex}`
|
|
5333
5328
|
}, groupData?.length > 0 && /*#__PURE__*/React__default["default"].createElement(GroupHeader, _extends({
|
|
5334
5329
|
groupData: groupData,
|
|
@@ -5353,7 +5348,7 @@ const TBody = ({
|
|
|
5353
5348
|
}), groupData?.length > 0 && /*#__PURE__*/React__default["default"].createElement(GroupFooter, _extends({
|
|
5354
5349
|
groupData: groupData,
|
|
5355
5350
|
columns: groupFooter
|
|
5356
|
-
}, neededProps)))
|
|
5351
|
+
}, neededProps)));
|
|
5357
5352
|
};
|
|
5358
5353
|
const TBodies = ({
|
|
5359
5354
|
groupHeader,
|
|
@@ -5362,18 +5357,12 @@ const TBodies = ({
|
|
|
5362
5357
|
dataSource: _dataSource,
|
|
5363
5358
|
table
|
|
5364
5359
|
}) => {
|
|
5365
|
-
// po('--TBodies--')
|
|
5366
5360
|
const isGroupDataType = Array.isArray(_dataSource?.[0]);
|
|
5367
5361
|
const dataSource = isGroupDataType ? _dataSource : [_dataSource];
|
|
5368
|
-
|
|
5369
|
-
// po('dataSource',dataSource)
|
|
5370
5362
|
return dataSource?.map((groupData, tbodyIndex, c) => {
|
|
5371
5363
|
return /*#__PURE__*/React__default["default"].createElement(TBody, {
|
|
5372
5364
|
key: `tbody${tbodyIndex}`,
|
|
5373
|
-
table: table
|
|
5374
|
-
// dataSource={dataSource}
|
|
5375
|
-
// dataGroup={groupData}
|
|
5376
|
-
,
|
|
5365
|
+
table: table,
|
|
5377
5366
|
groupData: groupData,
|
|
5378
5367
|
tbodyIndex: tbodyIndex,
|
|
5379
5368
|
groupHeader: groupHeader,
|
|
@@ -6590,5 +6579,6 @@ exports.JRTable = JRTable;
|
|
|
6590
6579
|
exports.JRTestReact = JRTestReact;
|
|
6591
6580
|
exports.JRText = JRText;
|
|
6592
6581
|
exports.JRWindow = JRWindow;
|
|
6582
|
+
exports.po = po;
|
|
6593
6583
|
exports.random = random;
|
|
6594
6584
|
exports.showMask = showMask;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import JRSubmit from "../JRSubmit";
|
|
4
|
-
import {
|
|
4
|
+
import { random } from "../JRUtils";
|
|
5
5
|
|
|
6
6
|
export const FreeType=({tag:Tag,config,me,className})=>{
|
|
7
7
|
if(typeof config==='function'){
|
|
@@ -23,22 +23,15 @@ const StyledJRFrame=styled.div`
|
|
|
23
23
|
flex:1;
|
|
24
24
|
overflow:hidden;
|
|
25
25
|
|
|
26
|
-
> *{
|
|
27
|
-
Xborder:1px solid gray;
|
|
28
|
-
}
|
|
29
26
|
>main{
|
|
30
27
|
display:flex;
|
|
31
28
|
flex:1;
|
|
32
29
|
overflow:hidden;
|
|
33
30
|
flex-direction: column;
|
|
34
31
|
> *{
|
|
35
|
-
XXborder:1px solid gray;
|
|
36
|
-
XXmin-height:30px;
|
|
37
32
|
}
|
|
38
33
|
|
|
39
34
|
>header{
|
|
40
|
-
XXborder:1px solid red;
|
|
41
|
-
XXoverflow: overlay;
|
|
42
35
|
}
|
|
43
36
|
>main{
|
|
44
37
|
display:flex;
|
|
@@ -48,13 +41,12 @@ const StyledJRFrame=styled.div`
|
|
|
48
41
|
>main{
|
|
49
42
|
width:100%;
|
|
50
43
|
xdisplay:flex;
|
|
51
|
-
|
|
44
|
+
flex:1;
|
|
52
45
|
overflow: overlay;
|
|
53
46
|
}
|
|
54
47
|
|
|
55
48
|
}
|
|
56
49
|
>footer{
|
|
57
|
-
XXborder:1px solid blue;
|
|
58
50
|
overflow: overlay;
|
|
59
51
|
}
|
|
60
52
|
|
|
@@ -65,7 +57,7 @@ export default class JRFrame extends JRSubmit {
|
|
|
65
57
|
mask=this.props.mask
|
|
66
58
|
?()=>{
|
|
67
59
|
const {type,props}=this.props.mask
|
|
68
|
-
this.maskId=`mask-${this.rid}`
|
|
60
|
+
this.maskId=`mask-${props.id??this.rid}`
|
|
69
61
|
return React.createElement(
|
|
70
62
|
type
|
|
71
63
|
,{
|
|
@@ -77,7 +69,6 @@ export default class JRFrame extends JRSubmit {
|
|
|
77
69
|
:null
|
|
78
70
|
renderer(){
|
|
79
71
|
return <StyledJRFrame id={this.props.id} style={this.props.style} className={`jr-frame`} >
|
|
80
|
-
|
|
81
72
|
<FreeType tag='div' config={this.props.start} me={this} className={'start'}/>
|
|
82
73
|
<main>
|
|
83
74
|
<FreeType tag='header' config={this.props.top} me={this}/>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled from "styled-components"
|
|
2
|
+
|
|
3
|
+
const StyleJValue=styled.div`
|
|
4
|
+
background: #efefef;
|
|
5
|
+
border-width: 1px;
|
|
6
|
+
border-style: solid;
|
|
7
|
+
border-color: #d9d9d9;
|
|
8
|
+
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 3px 11px;
|
|
12
|
+
color: rgba(0, 0, 0, 0.88);
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
line-height: 1.5714285714285714;
|
|
15
|
+
list-style: none;
|
|
16
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
|
17
|
+
position: relative;
|
|
18
|
+
display: inline-block;
|
|
19
|
+
width: 100%;
|
|
20
|
+
min-width: 0;
|
|
21
|
+
border-radius: 6px;
|
|
22
|
+
transition: all 0.2s;
|
|
23
|
+
min-height:30px;
|
|
24
|
+
`
|
|
25
|
+
export default function JValue({value,record,menu,render,style,align='align',...param}){
|
|
26
|
+
const _value=render?.({value,record}) ?? value
|
|
27
|
+
return <StyleJValue style={{textAlign:align,...style}}>
|
|
28
|
+
{_value}
|
|
29
|
+
</StyleJValue>
|
|
30
|
+
}
|
|
@@ -154,7 +154,6 @@ export default function JRDialogMask({id='jr-mask'}){
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
export function JRDivMask({id='jr-mask'}){
|
|
157
|
-
// po(`create JRDivMask id=${id}`)
|
|
158
157
|
return <StyledDivMask id={id}>
|
|
159
158
|
<div id={`${id}-msg`} >MSG</div>
|
|
160
159
|
<div className="cs-loader-inner">
|
|
@@ -216,8 +215,6 @@ class Mask extends JRHTML{
|
|
|
216
215
|
|
|
217
216
|
export function showMask(msg,maskId='jr-mask'){
|
|
218
217
|
const jrMask=document.getElementById(maskId)
|
|
219
|
-
// po(`showMask find id=${maskId}`)
|
|
220
|
-
// po('jrMask',jrMask)
|
|
221
218
|
if((jrMask)){
|
|
222
219
|
const jrMaskMsg=document.getElementById(`${maskId}-msg`)
|
|
223
220
|
if(!jrMask.maskDiv){
|
|
@@ -32,7 +32,7 @@ export default class JRSubmit extends React.Component {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
componentDidMount()
|
|
35
|
+
componentDidMount(){
|
|
36
36
|
this.#methods
|
|
37
37
|
.filter((method) => this[method] && this.props[method] && this.props[method].autoRun)
|
|
38
38
|
.forEach((method) => {
|
|
@@ -249,17 +249,14 @@ export default class JRSubmit extends React.Component {
|
|
|
249
249
|
}
|
|
250
250
|
})()
|
|
251
251
|
.then((res)=>{
|
|
252
|
-
|
|
253
|
-
this.handleResponse(res,_payload,config)
|
|
254
|
-
// config.removeMaskFunction?.()
|
|
255
|
-
// },random(2000,1000))
|
|
252
|
+
this.handleResponse(res,_payload,config)
|
|
256
253
|
})
|
|
257
254
|
.catch((res)=>{
|
|
258
255
|
this.handleResponse(res,_payload,config)
|
|
259
256
|
})
|
|
260
|
-
.finally(()=> {
|
|
261
|
-
config.removeMaskFunction?.()
|
|
262
|
-
})
|
|
257
|
+
// .finally(()=> {
|
|
258
|
+
// config.removeMaskFunction?.()
|
|
259
|
+
// })
|
|
263
260
|
}
|
|
264
261
|
|
|
265
262
|
handleResponse=(response,payload,config)=>{
|
|
@@ -280,14 +277,27 @@ export default class JRSubmit extends React.Component {
|
|
|
280
277
|
const isSuccess = response.status >= 200 && response.status <= 299
|
|
281
278
|
|
|
282
279
|
this.setRes(isSuccess,response,config)
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
280
|
+
|
|
281
|
+
if(config.delay!=null){
|
|
282
|
+
setTimeout(()=>{
|
|
283
|
+
this.showMessage(isSuccess,isSuccess?config.successMessage:config.failedMessage)
|
|
284
|
+
config.callback?.bind(this)(isSuccess,response,payload)
|
|
285
|
+
config.removeMaskFunction?.()
|
|
286
|
+
},config.delay)
|
|
287
|
+
}else{
|
|
288
|
+
this.showMessage(isSuccess,isSuccess?config.successMessage:config.failedMessage)
|
|
289
|
+
config.callback?.bind(this)(isSuccess,response,payload)
|
|
290
|
+
config.removeMaskFunction?.()
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
|
|
286
294
|
}
|
|
287
295
|
|
|
288
296
|
showMessage(success,message){
|
|
289
|
-
|
|
290
|
-
|
|
297
|
+
if(message){
|
|
298
|
+
po('success',success)
|
|
299
|
+
po('message',message)
|
|
300
|
+
}
|
|
291
301
|
}
|
|
292
302
|
|
|
293
303
|
renderer(){
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
-
import { flexType
|
|
2
|
+
import { flexType } from "../JRUtils"
|
|
3
3
|
import styled from "styled-components"
|
|
4
4
|
|
|
5
5
|
const StyledSeparator=styled.tbody`
|
|
@@ -31,7 +31,6 @@ const Ths=({table,groupData,groupIndex,deep,rowColumn,rowIndex})=>{
|
|
|
31
31
|
}else{
|
|
32
32
|
content=column.label
|
|
33
33
|
}
|
|
34
|
-
// style.textAlign=align
|
|
35
34
|
return <th key={colIndex}
|
|
36
35
|
|
|
37
36
|
style={{textAlign:align,...style}}
|
|
@@ -101,15 +100,10 @@ const Td=({column:_column,record,tbodyIndex,trIndex,tdIndex,table})=>{
|
|
|
101
100
|
setValue(record,targetValue)
|
|
102
101
|
table.setValue(table.getValue())
|
|
103
102
|
}
|
|
104
|
-
|
|
105
103
|
|
|
106
104
|
const value=getValue(record)
|
|
107
105
|
let style=render?{}:flexType(_style,table,{value,record},{})
|
|
108
|
-
|
|
109
|
-
style=_style
|
|
110
|
-
}
|
|
111
|
-
setStyle.bind(table)
|
|
112
|
-
render?.bind(table)
|
|
106
|
+
|
|
113
107
|
if(type){
|
|
114
108
|
const typeStyle=flexType(_typeStyle,table,{record},{})
|
|
115
109
|
|
|
@@ -121,13 +115,16 @@ const Td=({column:_column,record,tbodyIndex,trIndex,tdIndex,table})=>{
|
|
|
121
115
|
:onChange
|
|
122
116
|
,value
|
|
123
117
|
,style:typeStyle
|
|
124
|
-
,render
|
|
118
|
+
,render:render?.bind(table)
|
|
125
119
|
,...column
|
|
126
120
|
,...funcProps?.bind(table)({value})
|
|
127
121
|
|
|
128
122
|
})
|
|
129
123
|
}else if(render){
|
|
130
|
-
|
|
124
|
+
const setStyle=(_style)=>{
|
|
125
|
+
style=_style
|
|
126
|
+
}
|
|
127
|
+
content=render.bind(table)({index:trIndex,groupIndex:tbodyIndex,value,record,onChange,setStyle})
|
|
131
128
|
}else{
|
|
132
129
|
content=value
|
|
133
130
|
}
|
|
@@ -146,7 +143,6 @@ const Td=({column:_column,record,tbodyIndex,trIndex,tdIndex,table})=>{
|
|
|
146
143
|
}
|
|
147
144
|
const Tds=({leafColumns,record,table,tbodyIndex,trIndex})=>{
|
|
148
145
|
return leafColumns?.map((column,tdIndex)=>{
|
|
149
|
-
|
|
150
146
|
return <Td
|
|
151
147
|
column={column}
|
|
152
148
|
key={tdIndex}
|
|
@@ -162,59 +158,51 @@ const Tds=({leafColumns,record,table,tbodyIndex,trIndex})=>{
|
|
|
162
158
|
|
|
163
159
|
|
|
164
160
|
const TBody=({groupData,groupHeader,leafColumns,groupFooter,table,tbodyIndex})=>{
|
|
165
|
-
|
|
166
161
|
const neededProps={table,tbodyIndex}
|
|
167
|
-
return
|
|
168
|
-
<
|
|
169
|
-
{
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
{
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
{
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
/>}
|
|
162
|
+
return <tbody key={`tbody${tbodyIndex}`}>
|
|
163
|
+
{(groupData?.length >0 ) && <GroupHeader
|
|
164
|
+
groupData={groupData}
|
|
165
|
+
columns={groupHeader}
|
|
166
|
+
{...neededProps}
|
|
167
|
+
/>}
|
|
168
|
+
{
|
|
169
|
+
groupData?.map?.((record,trIndex)=>{
|
|
170
|
+
const onRowClick=table.props.onRowClick?.bind(table)
|
|
171
|
+
return <tr key={trIndex}
|
|
172
|
+
onClick={()=>{
|
|
173
|
+
onRowClick?.({record,index:trIndex,groupIndex:tbodyIndex})
|
|
174
|
+
}}
|
|
175
|
+
>
|
|
176
|
+
<Tds
|
|
177
|
+
record={record}
|
|
178
|
+
trIndex={trIndex}
|
|
179
|
+
|
|
180
|
+
{...neededProps}
|
|
181
|
+
leafColumns={leafColumns}
|
|
182
|
+
/>
|
|
183
|
+
</tr>
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
{(groupData?.length > 0) && <GroupFooter
|
|
187
|
+
groupData={groupData}
|
|
188
|
+
columns={groupFooter}
|
|
189
|
+
{...neededProps}
|
|
190
|
+
/>}
|
|
197
191
|
|
|
198
|
-
|
|
199
|
-
{/* {(dataSource.length > (tbodyIndex+1)) && <Separator length={leafColumns.length} key={`sp-${tbodyIndex}`}></Separator>} */}
|
|
200
|
-
</>
|
|
192
|
+
</tbody>
|
|
201
193
|
}
|
|
202
194
|
|
|
203
195
|
export const TBodies=({groupHeader,leafColumns,groupFooter,dataSource:_dataSource,table})=>{
|
|
204
|
-
// po('--TBodies--')
|
|
205
196
|
const isGroupDataType=Array.isArray(_dataSource?.[0])
|
|
206
197
|
|
|
207
198
|
const dataSource=isGroupDataType
|
|
208
199
|
?_dataSource
|
|
209
200
|
:[_dataSource]
|
|
210
201
|
|
|
211
|
-
// po('dataSource',dataSource)
|
|
212
202
|
return dataSource?.map((groupData,tbodyIndex,c)=>{
|
|
213
203
|
return <TBody
|
|
214
204
|
key={`tbody${tbodyIndex}`}
|
|
215
205
|
table={table}
|
|
216
|
-
// dataSource={dataSource}
|
|
217
|
-
// dataGroup={groupData}
|
|
218
206
|
groupData={groupData}
|
|
219
207
|
tbodyIndex={tbodyIndex}
|
|
220
208
|
|
package/src/index.js
CHANGED
|
@@ -11,13 +11,12 @@ import JRCheckbox from './components/JRInput/JRCheckbox'
|
|
|
11
11
|
import JRRadio from './components/JRInput/JRRadio'
|
|
12
12
|
import JRText from './components/JRInput/JRText'
|
|
13
13
|
import JRMask,{JRDivMask,showMask} from './components/JRMask/JRMask'
|
|
14
|
-
import {random} from './components/JRUtils'
|
|
14
|
+
import {random,po} from './components/JRUtils'
|
|
15
15
|
export {
|
|
16
16
|
JRTestReact
|
|
17
17
|
,JRSubmit,JRFrame,JRWindow,JRTable,JRFields,JRAlert
|
|
18
18
|
,JRButton
|
|
19
19
|
,JRText,JRSelect,JRCheckbox,JRRadio
|
|
20
20
|
,JRMask,JRDivMask,showMask
|
|
21
|
-
,random
|
|
22
|
-
|
|
21
|
+
,random,po
|
|
23
22
|
}
|