jrs-react 1.2.13 → 1.2.14
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 +1015 -727
- package/build/index.js +1015 -727
- package/index.html +2 -2
- package/package.json +3 -2
- package/public/alert.json +4 -0
- package/public/data.json +10 -0
- package/public/data2.json +19 -0
- package/public/list.json +99 -0
- package/src/app/App.css +25 -3
- package/src/app/App.jsx +22 -1
- package/src/app/alert/AlertApp.jsx +92 -0
- package/src/app/axios/AxiosApp.jsx +71 -0
- package/src/app/fields/FieldsApp.jsx +22 -6
- package/src/app/fields/fieldsConfig.jsx +227 -1
- package/src/app/fields/tryHOC.jsx +21 -0
- package/src/app/fields/validator.jsx +217 -0
- package/src/app/index.css +1 -1
- package/src/app/table/tableConfig.jsx +4 -1
- package/src/app/test/index.jsx +8 -0
- package/src/app/window/WindowApp.jsx +120 -83
- package/src/components/JRAlert/index.jsx +71 -0
- package/src/components/JRFields/JRFields.jsx +178 -129
- package/src/components/JRFields/StyleJRFields.jsx +2 -3
- package/src/components/JRFields/Validators.jsx +33 -0
- package/src/components/JRFrame/JRFrame.jsx +12 -7
- package/src/components/JRFrame/JRFrameHOC.jsx +61 -0
- package/src/components/JRInput/JRInput.jsx +3 -2
- package/src/components/JRS.jsx +4 -0
- package/src/components/JRSubmit.jsx +1 -3
- package/src/components/JRTable/JRTable.jsx +10 -7
- package/src/components/JRTable/StyledJRTable.jsx +8 -0
- package/src/components/JRTable/THead.jsx +1 -1
- package/src/components/JRWindow/JRWindow.jsx +73 -15
- package/src/components/JRWindow/JRWindowHOC.jsx +114 -0
- package/src/components/JRWindow/Slider.jsx +8 -3
- package/src/components/JRWindow/Style.module.css +35 -0
- package/src/components/JRWindow/TitleBar.jsx +116 -33
- package/src/main.jsx +2 -1
- package/src/components/JRUtil.jsx +0 -1
package/build/index.js
CHANGED
|
@@ -3502,7 +3502,7 @@ class JRSubmit extends React__default["default"].Component {
|
|
|
3502
3502
|
}
|
|
3503
3503
|
setRawValue(rawValue) {
|
|
3504
3504
|
this.setState({
|
|
3505
|
-
rawValue: JSON.parse(JSON.stringify(rawValue
|
|
3505
|
+
rawValue: rawValue != null ? JSON.parse(JSON.stringify(rawValue)) : null
|
|
3506
3506
|
});
|
|
3507
3507
|
}
|
|
3508
3508
|
reset() {
|
|
@@ -3510,8 +3510,6 @@ class JRSubmit extends React__default["default"].Component {
|
|
|
3510
3510
|
}
|
|
3511
3511
|
setValue(value, reset = false) {
|
|
3512
3512
|
if (this.props.onChange) {
|
|
3513
|
-
po('name', this.props.name);
|
|
3514
|
-
po('onChange', value);
|
|
3515
3513
|
this.props.onChange(value);
|
|
3516
3514
|
} else {
|
|
3517
3515
|
this.setState({
|
|
@@ -3735,7 +3733,7 @@ const StyledJRFrame$1 = styled__default["default"].div`
|
|
|
3735
3733
|
>main{
|
|
3736
3734
|
display:flex;
|
|
3737
3735
|
flex:1;
|
|
3738
|
-
overflow:
|
|
3736
|
+
overflow:hidden;
|
|
3739
3737
|
flex-direction: column;
|
|
3740
3738
|
> *{
|
|
3741
3739
|
XXborder:1px solid gray;
|
|
@@ -3750,6 +3748,13 @@ const StyledJRFrame$1 = styled__default["default"].div`
|
|
|
3750
3748
|
display:flex;
|
|
3751
3749
|
flex:1;
|
|
3752
3750
|
overflow:hidden;
|
|
3751
|
+
|
|
3752
|
+
>main{
|
|
3753
|
+
display:flex;
|
|
3754
|
+
flex:1;
|
|
3755
|
+
overflow: overlay;
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3753
3758
|
}
|
|
3754
3759
|
>footer{
|
|
3755
3760
|
XXborder:1px solid blue;
|
|
@@ -3757,11 +3762,11 @@ const StyledJRFrame$1 = styled__default["default"].div`
|
|
|
3757
3762
|
}
|
|
3758
3763
|
|
|
3759
3764
|
}
|
|
3760
|
-
|
|
3761
3765
|
`;
|
|
3762
3766
|
class JRFrame extends JRSubmit {
|
|
3763
3767
|
renderer() {
|
|
3764
3768
|
return /*#__PURE__*/React__default["default"].createElement(StyledJRFrame$1, {
|
|
3769
|
+
id: this.props.id,
|
|
3765
3770
|
style: this.props.style,
|
|
3766
3771
|
className: `${this.props.className} jr-frame`
|
|
3767
3772
|
}, /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
|
|
@@ -3778,7 +3783,9 @@ class JRFrame extends JRSubmit {
|
|
|
3778
3783
|
config: this.props.left,
|
|
3779
3784
|
me: this,
|
|
3780
3785
|
className: 'left'
|
|
3781
|
-
}),
|
|
3786
|
+
}), /*#__PURE__*/React__default["default"].createElement("main", {
|
|
3787
|
+
className: 'body'
|
|
3788
|
+
}, this.renderMe?.() ?? this.props.children), /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
|
|
3782
3789
|
tag: "div",
|
|
3783
3790
|
config: this.props.right,
|
|
3784
3791
|
me: this,
|
|
@@ -3794,9 +3801,6 @@ class JRFrame extends JRSubmit {
|
|
|
3794
3801
|
className: 'end'
|
|
3795
3802
|
}));
|
|
3796
3803
|
}
|
|
3797
|
-
// renderMe(){
|
|
3798
|
-
// return <div style={{flex:1}}>Render me</div>
|
|
3799
|
-
// }
|
|
3800
3804
|
}
|
|
3801
3805
|
|
|
3802
3806
|
const StyledSlider$1 = styled__default["default"].div`
|
|
@@ -3908,7 +3912,7 @@ const Ths$1 = ({
|
|
|
3908
3912
|
ref: thRef,
|
|
3909
3913
|
colSpan: column.colSpan,
|
|
3910
3914
|
rowSpan: column.rowSpan ?? (column.isLeaf && deep > rowIndex ? deep - rowIndex + 1 : null)
|
|
3911
|
-
}, flexType(column.label, table), table.props.resizableColumns ===
|
|
3915
|
+
}, flexType(column.label, table), (table.props.resizableColumns === undefined || table.props.resizableColumns) && /*#__PURE__*/React__default["default"].createElement(Slider$1, {
|
|
3912
3916
|
table: table,
|
|
3913
3917
|
thRef: thRef,
|
|
3914
3918
|
column: column
|
|
@@ -4394,7 +4398,15 @@ const StyledJRTable = styled__default["default"].div`
|
|
|
4394
4398
|
display:flex;
|
|
4395
4399
|
justify-content: center;
|
|
4396
4400
|
align-items: center;
|
|
4401
|
+
|
|
4402
|
+
|
|
4397
4403
|
}
|
|
4404
|
+
|
|
4405
|
+
> .empty::after{
|
|
4406
|
+
content:'無資料';
|
|
4407
|
+
position: block;
|
|
4408
|
+
}
|
|
4409
|
+
|
|
4398
4410
|
`;
|
|
4399
4411
|
|
|
4400
4412
|
var _path;
|
|
@@ -4427,9 +4439,12 @@ const StyledTitle = styled__default["default"].div`
|
|
|
4427
4439
|
overflow: hidden;
|
|
4428
4440
|
display: flex;
|
|
4429
4441
|
border-radius: var(--jr-window-radius) var(--jr-window-radius) 0 0;
|
|
4430
|
-
background
|
|
4431
|
-
color:
|
|
4432
|
-
|
|
4442
|
+
background:#464646;
|
|
4443
|
+
color: white;
|
|
4444
|
+
display: flex;
|
|
4445
|
+
align-items: center;
|
|
4446
|
+
min-height: min-content;
|
|
4447
|
+
XX&:active{
|
|
4433
4448
|
cursor: grabbing;
|
|
4434
4449
|
}
|
|
4435
4450
|
|
|
@@ -4453,6 +4468,7 @@ const StyledTitle = styled__default["default"].div`
|
|
|
4453
4468
|
|
|
4454
4469
|
|
|
4455
4470
|
>button{
|
|
4471
|
+
outline: unset;
|
|
4456
4472
|
display:flex;
|
|
4457
4473
|
align-items: center;
|
|
4458
4474
|
justify-content: center;
|
|
@@ -4469,10 +4485,11 @@ const StyledTitle = styled__default["default"].div`
|
|
|
4469
4485
|
color:white;
|
|
4470
4486
|
}
|
|
4471
4487
|
>svg{
|
|
4472
|
-
color
|
|
4488
|
+
color:#bababa;
|
|
4473
4489
|
width:14px;
|
|
4474
4490
|
height:14px;
|
|
4475
4491
|
cursor: pointer;
|
|
4492
|
+
stroke-width: 3;
|
|
4476
4493
|
}
|
|
4477
4494
|
}
|
|
4478
4495
|
>button.danger:hover{
|
|
@@ -4490,13 +4507,68 @@ class TitleBar extends React__default["default"].Component {
|
|
|
4490
4507
|
pos4 = 0;
|
|
4491
4508
|
x = 0;
|
|
4492
4509
|
y = 0;
|
|
4510
|
+
remember = e => {
|
|
4511
|
+
po('remember');
|
|
4512
|
+
const {
|
|
4513
|
+
clientX,
|
|
4514
|
+
clientY
|
|
4515
|
+
} = e;
|
|
4516
|
+
const {
|
|
4517
|
+
x,
|
|
4518
|
+
y,
|
|
4519
|
+
width,
|
|
4520
|
+
height
|
|
4521
|
+
} = this.props.windowRef.current.getBoundingClientRect();
|
|
4522
|
+
this.props.window.orgHeight = height;
|
|
4523
|
+
this.props.window.orgWidth = width;
|
|
4524
|
+
this.props.window.orgTop = y;
|
|
4525
|
+
this.props.window.orgLeft = x;
|
|
4526
|
+
this.props.window.orgXd = clientX - x;
|
|
4527
|
+
this.props.window.orgBodyOverflow = document.body.style.overflow;
|
|
4528
|
+
};
|
|
4529
|
+
adjustScreen = e => {
|
|
4530
|
+
po('double click adjustScreen');
|
|
4531
|
+
e.preventDefault();
|
|
4532
|
+
const {
|
|
4533
|
+
x,
|
|
4534
|
+
y,
|
|
4535
|
+
width,
|
|
4536
|
+
height
|
|
4537
|
+
} = this.props.windowRef.current.getBoundingClientRect();
|
|
4538
|
+
if (y > 1 - this.props.thick) {
|
|
4539
|
+
this.remember(e);
|
|
4540
|
+
this.fullScreen(e);
|
|
4541
|
+
} else {
|
|
4542
|
+
this.floatScreen(e);
|
|
4543
|
+
}
|
|
4544
|
+
};
|
|
4545
|
+
floatScreen = e => {
|
|
4546
|
+
po('floatScreen');
|
|
4547
|
+
this.props.windowRef.current;
|
|
4548
|
+
this.props.windowRef.current.style.transition = 'var(--transition-x-y), left .05s ease-in';
|
|
4549
|
+
this.props.windowRef.current.style.left = `${this.props.window.orgLeft}px`;
|
|
4550
|
+
this.props.windowRef.current.style.top = `${this.props.window.orgTop}px`;
|
|
4551
|
+
this.props.windowRef.current.style.width = `${this.props.window.orgWidth}px`;
|
|
4552
|
+
this.props.windowRef.current.style.height = `${this.props.window.orgHeight}px`;
|
|
4553
|
+
document.body.style.overflow = this.props.window.orgBodyOverflow;
|
|
4554
|
+
};
|
|
4555
|
+
fullScreen = e => {
|
|
4556
|
+
po('fullScreen', this.props.thick);
|
|
4557
|
+
this.props.windowRef.current.style.transition = 'var(--transition-x-y), left .05s ease-in';
|
|
4558
|
+
this.props.windowRef.current.style.left = `${-this.props.thick}px`;
|
|
4559
|
+
this.props.windowRef.current.style.top = `${-this.props.thick}px`;
|
|
4560
|
+
this.props.windowRef.current.style.width = `calc(100vw + ${this.props.thick * 2}px)`; //`${window.innerWidth+(this.props.thick*2)}px`
|
|
4561
|
+
this.props.windowRef.current.style.height = `calc(100vh + ${this.props.thick * 2}px)`; //`${window.innerHeight+(this.props.thick*2)}px`
|
|
4562
|
+
|
|
4563
|
+
setTimeout(() => {
|
|
4564
|
+
document.body.style.overflow = 'hidden';
|
|
4565
|
+
this.props.windowRef.current.style.transition = 'unset';
|
|
4566
|
+
}, 50);
|
|
4567
|
+
};
|
|
4493
4568
|
stop = e => {
|
|
4569
|
+
po('stop');
|
|
4494
4570
|
e.preventDefault();
|
|
4495
4571
|
if (this.moved) {
|
|
4496
|
-
const {
|
|
4497
|
-
clientX,
|
|
4498
|
-
clientY
|
|
4499
|
-
} = e;
|
|
4500
4572
|
const {
|
|
4501
4573
|
height: titleBarHeight
|
|
4502
4574
|
} = this.props.titleBarRef.current.getBoundingClientRect();
|
|
@@ -4506,26 +4578,18 @@ class TitleBar extends React__default["default"].Component {
|
|
|
4506
4578
|
width,
|
|
4507
4579
|
height
|
|
4508
4580
|
} = this.props.windowRef.current.getBoundingClientRect();
|
|
4509
|
-
if (y < 1)
|
|
4510
|
-
|
|
4511
|
-
this.props.windowRef.current.style.left = `${-this.props.thick}px`;
|
|
4512
|
-
this.props.windowRef.current.style.width = `calc(100vw + ${this.props.thick * 2}px)`; //`${window.innerWidth+(this.props.thick*2)}px`
|
|
4513
|
-
this.props.windowRef.current.style.height = `calc(100vh + ${this.props.thick * 2}px)`; //`${window.innerHeight+(this.props.thick*2)}px`
|
|
4514
|
-
|
|
4515
|
-
this.props.window.orgHeight = height;
|
|
4516
|
-
this.props.window.orgWidth = width;
|
|
4517
|
-
this.props.window.orgXd = clientX - x;
|
|
4518
|
-
}
|
|
4519
|
-
if (y > window.innerHeight) this.props.windowRef.current.style.top = `${window.innerHeight - titleBarHeight}px`;
|
|
4581
|
+
if (y < 1 - this.props.thick) this.fullScreen(e);
|
|
4582
|
+
if (y > window.innerHeight - titleBarHeight) this.props.windowRef.current.style.top = `${window.innerHeight - titleBarHeight}px`;
|
|
4520
4583
|
if (x + width - this.props.thick < 0) this.props.windowRef.current.style.left = 0;
|
|
4521
4584
|
if (x > window.innerWidth) this.props.windowRef.current.style.left = `${window.innerWidth - width}px`;
|
|
4522
|
-
document.body.style.cursor = 'default';
|
|
4523
4585
|
}
|
|
4586
|
+
document.body.style.cursor = 'default';
|
|
4524
4587
|
window.removeEventListener('mousemove', this.move);
|
|
4525
4588
|
window.removeEventListener('mouseup', this.stop);
|
|
4526
4589
|
window.removeEventListener('mousemove', this.preMove);
|
|
4527
4590
|
};
|
|
4528
4591
|
move = e => {
|
|
4592
|
+
po('move');
|
|
4529
4593
|
e.preventDefault();
|
|
4530
4594
|
this.moved = true;
|
|
4531
4595
|
const {
|
|
@@ -4540,55 +4604,77 @@ class TitleBar extends React__default["default"].Component {
|
|
|
4540
4604
|
const w = this.props.windowRef.current;
|
|
4541
4605
|
this.y = w.offsetTop - this.pos2;
|
|
4542
4606
|
this.x = w.offsetLeft - this.pos1;
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
}
|
|
4607
|
+
|
|
4608
|
+
// if(this.props.window.orgWidth){
|
|
4609
|
+
// w.style.width=`${this.props.window.orgWidth}px`
|
|
4610
|
+
// this.props.window.orgWidth=null
|
|
4611
|
+
// }
|
|
4612
|
+
|
|
4550
4613
|
this.y = this.y < -this.props.thick ? -this.props.thick : this.y;
|
|
4551
4614
|
w.style.transition = 'unset';
|
|
4552
4615
|
w.style.top = `${this.y}px`;
|
|
4553
4616
|
w.style.left = `${this.x}px`;
|
|
4554
4617
|
};
|
|
4555
4618
|
preMove = e => {
|
|
4619
|
+
console.clear();
|
|
4620
|
+
po('preMove');
|
|
4556
4621
|
const w = this.props.windowRef.current;
|
|
4557
4622
|
const {
|
|
4558
4623
|
clientX,
|
|
4559
|
-
clientY
|
|
4624
|
+
clientY,
|
|
4625
|
+
...oe
|
|
4560
4626
|
} = e;
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4627
|
+
po('e', e);
|
|
4628
|
+
const {
|
|
4629
|
+
x,
|
|
4630
|
+
y,
|
|
4631
|
+
width,
|
|
4632
|
+
height
|
|
4633
|
+
} = w.getBoundingClientRect();
|
|
4634
|
+
po('width', width);
|
|
4635
|
+
if (y <= -this.props.thick) ;
|
|
4636
|
+
w.style.transition = 'left .05s ease-in, height .05s ease-in';
|
|
4637
|
+
if (y <= 0) {
|
|
4638
|
+
// contt browserWidth=
|
|
4639
|
+
const w1 = window.innerWidth - this.props.thick * 2;
|
|
4640
|
+
const x1 = clientX;
|
|
4641
|
+
const w2 = this.props.window.orgWidth - 32;
|
|
4642
|
+
const x2 = x1 / w1 * w2;
|
|
4643
|
+
// po('xp' , x2)
|
|
4644
|
+
w.style.left = `${clientX - x2}px`;
|
|
4645
|
+
w.style.width = `${this.props.window.orgWidth}px`;
|
|
4566
4646
|
w.style.height = `${this.props.window.orgHeight}px`;
|
|
4567
|
-
|
|
4647
|
+
} else {
|
|
4648
|
+
this.remember(e);
|
|
4568
4649
|
}
|
|
4569
|
-
|
|
4650
|
+
document.body.style.cursor = 'grabbing';
|
|
4651
|
+
document.body.style.overflow = this.props.window.orgBodyOverflow;
|
|
4570
4652
|
setTimeout(() => {
|
|
4571
4653
|
window.addEventListener('mousemove', this.move);
|
|
4572
|
-
},
|
|
4654
|
+
}, 50);
|
|
4573
4655
|
window.removeEventListener('mousemove', this.preMove);
|
|
4574
4656
|
};
|
|
4575
4657
|
start(e) {
|
|
4658
|
+
po('start');
|
|
4576
4659
|
e.preventDefault();
|
|
4577
4660
|
this.moved = false;
|
|
4578
4661
|
this.pos3 = e.clientX;
|
|
4579
4662
|
this.pos4 = e.clientY;
|
|
4580
4663
|
this.props.windowRef.current.style.transition = 'var(--transition-x-y)';
|
|
4581
|
-
document.body.style.cursor = 'grabbing';
|
|
4582
4664
|
window.addEventListener('mousemove', this.preMove);
|
|
4583
4665
|
window.addEventListener('mouseup', this.stop);
|
|
4584
4666
|
}
|
|
4667
|
+
onDoubleClick() {
|
|
4668
|
+
po('onDoubleClick');
|
|
4669
|
+
}
|
|
4585
4670
|
render() {
|
|
4586
4671
|
return /*#__PURE__*/React__default["default"].createElement(StyledTitle, {
|
|
4587
4672
|
ref: this.props.titleBarRef,
|
|
4588
4673
|
draggable: "false",
|
|
4589
4674
|
onMouseDown: e => {
|
|
4590
4675
|
this.start(e);
|
|
4591
|
-
}
|
|
4676
|
+
},
|
|
4677
|
+
onDoubleClick: this.adjustScreen
|
|
4592
4678
|
}, /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
|
|
4593
4679
|
tag: "div",
|
|
4594
4680
|
config: this.props.title ?? '',
|
|
@@ -4597,8 +4683,15 @@ class TitleBar extends React__default["default"].Component {
|
|
|
4597
4683
|
}), /*#__PURE__*/React__default["default"].createElement("nav", null, this.props.window.props.setOpen ? /*#__PURE__*/React__default["default"].createElement(JRButton, {
|
|
4598
4684
|
icon: /*#__PURE__*/React__default["default"].createElement(SvgX, null),
|
|
4599
4685
|
className: 'danger',
|
|
4600
|
-
onClick:
|
|
4686
|
+
onClick: e => {
|
|
4687
|
+
e.stopPropagation();
|
|
4688
|
+
if (this.props.window.orgBodyOverflow != null) {
|
|
4689
|
+
document.body.style.overflow = this.props.window.orgBodyOverflow;
|
|
4690
|
+
}
|
|
4601
4691
|
this.props.window.props.setOpen(false);
|
|
4692
|
+
},
|
|
4693
|
+
onMouseDown: e => {
|
|
4694
|
+
e.stopPropagation();
|
|
4602
4695
|
}
|
|
4603
4696
|
}) : null));
|
|
4604
4697
|
}
|
|
@@ -4945,9 +5038,11 @@ class Slider extends React__default["default"].Component {
|
|
|
4945
5038
|
});
|
|
4946
5039
|
};
|
|
4947
5040
|
preMove = () => {
|
|
4948
|
-
this.props.
|
|
4949
|
-
|
|
4950
|
-
|
|
5041
|
+
if (this.props.direction.indexOf('n') > -1) {
|
|
5042
|
+
this.props.windowRef.current.style.height = `${this.props.window.orgHeight}px`;
|
|
5043
|
+
this.data.height = this.props.window.orgHeight;
|
|
5044
|
+
this.props.window.orgHeight = null;
|
|
5045
|
+
}
|
|
4951
5046
|
window.removeEventListener('mousemove', this.preMove);
|
|
4952
5047
|
setTimeout(() => {
|
|
4953
5048
|
window.addEventListener('mousemove', this.move);
|
|
@@ -4964,6 +5059,9 @@ class Slider extends React__default["default"].Component {
|
|
|
4964
5059
|
width,
|
|
4965
5060
|
height
|
|
4966
5061
|
} = this.props.windowRef.current.getBoundingClientRect();
|
|
5062
|
+
if (this.props.direction.indexOf('s') > -1) {
|
|
5063
|
+
this.props.window.orgHeight = null;
|
|
5064
|
+
}
|
|
4967
5065
|
this.data = {
|
|
4968
5066
|
x,
|
|
4969
5067
|
y,
|
|
@@ -4991,770 +5089,960 @@ class Slider extends React__default["default"].Component {
|
|
|
4991
5089
|
}
|
|
4992
5090
|
}
|
|
4993
5091
|
|
|
4994
|
-
const
|
|
4995
|
-
--
|
|
4996
|
-
--
|
|
4997
|
-
--
|
|
4998
|
-
xborder:1px solid gray;
|
|
4999
|
-
position: fixed;
|
|
5000
|
-
padding: ${({
|
|
5001
|
-
$thick
|
|
5002
|
-
}) => $thick}px;
|
|
5003
|
-
border-radius: var(--jr-window-radius);
|
|
5004
|
-
|
|
5005
|
-
top: ${({
|
|
5006
|
-
$y
|
|
5007
|
-
}) => $y}px;
|
|
5008
|
-
left: ${({
|
|
5009
|
-
$x
|
|
5010
|
-
}) => $x}px;
|
|
5011
|
-
width: ${({
|
|
5012
|
-
$width = 300
|
|
5013
|
-
}) => `${$width}px`};
|
|
5014
|
-
height: ${({
|
|
5015
|
-
$height = 300
|
|
5016
|
-
}) => `${$height}px`};
|
|
5017
|
-
overflow: hidden;
|
|
5092
|
+
const StyleJRFields = styled__default["default"].main`
|
|
5093
|
+
--column-bd-color:#cccccc;
|
|
5094
|
+
--column-b-color:unset;
|
|
5095
|
+
--column-b-hover-color:#ffffff;
|
|
5018
5096
|
|
|
5019
|
-
display: flex;
|
|
5020
5097
|
flex-direction: column;
|
|
5021
|
-
|
|
5098
|
+
flex:1;
|
|
5099
|
+
overflow: overlay;
|
|
5022
5100
|
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
overflow: overlay;
|
|
5035
|
-
flex:1;
|
|
5036
|
-
display: flex;
|
|
5037
|
-
}
|
|
5038
|
-
}
|
|
5039
|
-
|
|
5040
|
-
@container (min-width: 700px) {
|
|
5041
|
-
&{
|
|
5042
|
-
border: 1px solid red;
|
|
5101
|
+
color:#525252;
|
|
5102
|
+
|
|
5103
|
+
>.jr-grid{
|
|
5104
|
+
padding: 10px;
|
|
5105
|
+
.jr-column{
|
|
5106
|
+
> .label{
|
|
5107
|
+
color:#525252;
|
|
5108
|
+
text-wrap: nowrap;
|
|
5109
|
+
font-weight: bold;
|
|
5110
|
+
}
|
|
5111
|
+
> .jr-column-value{
|
|
5043
5112
|
}
|
|
5113
|
+
}
|
|
5044
5114
|
}
|
|
5045
5115
|
`;
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5116
|
+
|
|
5117
|
+
function required(value) {
|
|
5118
|
+
return value == null || value == '' || value.trim?.() == '' ? 'This is required' : true;
|
|
5119
|
+
}
|
|
5120
|
+
function max(value, colum) {
|
|
5121
|
+
return value == null ? true : typeof value === 'string' && value.length > colum.max ? `Length can not more than ${colum.max}` : Array.isArray(value) && value.length > colum.max ? `Length can not more than ${colum.max}` : typeof value === 'number' && value > colum.max ? `Length can not more than ${colum.max}` : true;
|
|
5122
|
+
}
|
|
5123
|
+
function min(value, colum) {
|
|
5124
|
+
return value = typeof value === 'string' && colum.min > value.length ? `Length can not less than ${colum.min}` : Array.isArray(value) && colum.min > value.length ? `Length can not less than ${colum.min}` : typeof value === 'number' && colum.min > value ? `Can not less than ${colum.min}` : true;
|
|
5125
|
+
}
|
|
5126
|
+
|
|
5127
|
+
// import JRSubmit from "../JRSubmit";
|
|
5128
|
+
// import { JRWindowHOC } from "../JRWindow/JRWindowHOC";
|
|
5129
|
+
// import { JRFrameHOC } from "../JRFrame/JRFrameHOC";
|
|
5130
|
+
|
|
5131
|
+
function checkMap(_name, inputValue, mapValue, nameList) {
|
|
5132
|
+
if (nameList.length) {
|
|
5133
|
+
const name = nameList.shift();
|
|
5134
|
+
if (typeof mapValue[name] != 'object') {
|
|
5135
|
+
mapValue[name] = {};
|
|
5062
5136
|
}
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
this.width = window.innerWidth >= (this.props.width ?? this.width) ? this.props.width ?? this.width : window.innerWidth;
|
|
5067
|
-
this.x = this.props.x ?? (window.innerWidth - (this.width ?? 300)) / 2;
|
|
5068
|
-
this.y = this.props.y ?? (window.innerHeight - (this.height ?? 300)) / 2;
|
|
5069
|
-
}
|
|
5070
|
-
renderer() {
|
|
5071
|
-
return this.props.popup === true ? this.props.open === true ? /*#__PURE__*/React__default["default"].createElement(StyledJRWindow, {
|
|
5072
|
-
ref: this.ref,
|
|
5073
|
-
className: `jr-window ${this.props.className ?? ''}`,
|
|
5074
|
-
$x: this.x,
|
|
5075
|
-
$y: this.y,
|
|
5076
|
-
$width: this.width,
|
|
5077
|
-
$height: this.height,
|
|
5078
|
-
$thick: this.thick
|
|
5079
|
-
}, /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(TitleBar, {
|
|
5080
|
-
titleBarRef: this.titleBarRef,
|
|
5081
|
-
windowRef: this.ref,
|
|
5082
|
-
window: this,
|
|
5083
|
-
title: this.props.title,
|
|
5084
|
-
thick: this.thick
|
|
5085
|
-
}), /*#__PURE__*/React__default["default"].createElement("main", null, super.renderer())), /*#__PURE__*/React__default["default"].createElement(Sliders, {
|
|
5086
|
-
thick: this.thick,
|
|
5087
|
-
windowRef: this.ref,
|
|
5088
|
-
window: this,
|
|
5089
|
-
titleBarRef: this.titleBarRef
|
|
5090
|
-
})) : '' : super.renderer();
|
|
5137
|
+
checkMap(_name, inputValue, mapValue[name], nameList);
|
|
5138
|
+
} else {
|
|
5139
|
+
mapValue[_name] = inputValue;
|
|
5091
5140
|
}
|
|
5092
5141
|
}
|
|
5142
|
+
styled__default["default"].div`
|
|
5143
|
+
overflow: auto;
|
|
5144
|
+
flex:1;
|
|
5145
|
+
`;
|
|
5146
|
+
const StyledGrid = styled__default["default"].div`
|
|
5147
|
+
display: grid;
|
|
5148
|
+
grid: ${({
|
|
5149
|
+
grid,
|
|
5150
|
+
cols,
|
|
5151
|
+
children
|
|
5152
|
+
}) => grid ? grid : `auto / ${Array(cols ?? 1).fill().map(() => "1fr").join(" ")}`};
|
|
5093
5153
|
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5154
|
+
gap: ${({
|
|
5155
|
+
$gap
|
|
5156
|
+
}) => $gap};
|
|
5157
|
+
`;
|
|
5158
|
+
styled__default["default"].div`
|
|
5159
|
+
`;
|
|
5160
|
+
const StyledColumn = styled__default["default"].div`
|
|
5161
|
+
flex:1;
|
|
5162
|
+
display: grid;
|
|
5163
|
+
|
|
5164
|
+
${({
|
|
5165
|
+
$layout,
|
|
5166
|
+
$labelWidth,
|
|
5167
|
+
$hasLabel,
|
|
5168
|
+
$valueWidth
|
|
5169
|
+
}) => {
|
|
5170
|
+
if ($layout == 'v') {
|
|
5171
|
+
return `grid: auto 1fr / 1fr;`;
|
|
5098
5172
|
} else {
|
|
5099
|
-
return
|
|
5173
|
+
return `grid: 1fr / ${$hasLabel ? $labelWidth : ''} ${$valueWidth};`;
|
|
5100
5174
|
}
|
|
5101
|
-
}
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5175
|
+
}}
|
|
5176
|
+
`;
|
|
5177
|
+
const StyledColumnLabel = styled__default["default"].div`
|
|
5178
|
+
${({
|
|
5179
|
+
$layout
|
|
5180
|
+
}) => {
|
|
5181
|
+
if ($layout == 'v') {
|
|
5182
|
+
return `text-align: start;`;
|
|
5109
5183
|
} else {
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
class JRTable extends JRWindow {
|
|
5114
|
-
constructor(props) {
|
|
5115
|
-
super(props);
|
|
5116
|
-
this.colGroupRef = /*#__PURE__*/React__default["default"].createRef();
|
|
5117
|
-
}
|
|
5118
|
-
UNSAFE_componentWillMount() {
|
|
5119
|
-
this.setColumns(this.props.columns ?? []);
|
|
5184
|
+
return `text-align: end;
|
|
5185
|
+
padding: 3px 8px;
|
|
5186
|
+
`;
|
|
5120
5187
|
}
|
|
5188
|
+
}}
|
|
5121
5189
|
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5190
|
+
${({
|
|
5191
|
+
$required
|
|
5192
|
+
}) => {
|
|
5193
|
+
if ($required !== undefined && $required) return `
|
|
5194
|
+
&:not(:empty)::before{
|
|
5195
|
+
padding-right:4px;
|
|
5196
|
+
color:red;
|
|
5197
|
+
content:'*';
|
|
5198
|
+
}
|
|
5199
|
+
`;
|
|
5200
|
+
}}
|
|
5201
|
+
|
|
5202
|
+
${({
|
|
5203
|
+
$colon
|
|
5204
|
+
}) => {
|
|
5205
|
+
if ($colon) {
|
|
5206
|
+
return `
|
|
5207
|
+
&:not(:empty)::after{
|
|
5208
|
+
content:'${$colon}';
|
|
5209
|
+
}
|
|
5210
|
+
`;
|
|
5125
5211
|
}
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
// type:Checkbox
|
|
5146
|
-
// ,funcProps({value}){
|
|
5147
|
-
// po('fffffffffffff',value)
|
|
5148
|
-
// return {
|
|
5149
|
-
// align:'center'
|
|
5150
|
-
// ,checked:value
|
|
5151
|
-
// }
|
|
5152
|
-
// }
|
|
5153
|
-
// // ,label:'A'
|
|
5154
|
-
// ,onChange(e,{value,onChange,me}){
|
|
5155
|
-
// onChange(e.target.checked)
|
|
5156
|
-
// }
|
|
5157
|
-
// ,...props
|
|
5158
|
-
// }
|
|
5212
|
+
}}
|
|
5213
|
+
|
|
5214
|
+
`;
|
|
5215
|
+
const StyledColumnValue = styled__default["default"].main`
|
|
5216
|
+
flex:1;
|
|
5217
|
+
flex-direction: column;
|
|
5218
|
+
overflow: hidden;
|
|
5219
|
+
padding: 4px 0;
|
|
5220
|
+
|
|
5221
|
+
text-align: start;
|
|
5222
|
+
${({
|
|
5223
|
+
$validateValue
|
|
5224
|
+
}) => {
|
|
5225
|
+
if ($validateValue != null) {
|
|
5226
|
+
return `
|
|
5227
|
+
> * {
|
|
5228
|
+
xborder:1px solid red;
|
|
5229
|
+
}
|
|
5230
|
+
`;
|
|
5159
5231
|
}
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
}
|
|
5177
|
-
});
|
|
5178
|
-
},
|
|
5179
|
-
align: 'center',
|
|
5180
|
-
name,
|
|
5181
|
-
label() {
|
|
5182
|
-
return /*#__PURE__*/React__default["default"].createElement("button", {
|
|
5183
|
-
onClick: () => {
|
|
5184
|
-
const value = this.props.delete.value ?? this.getDataSource()?.filter(record => record[name]).map(record => sendValue ? record[sendValue] : record);
|
|
5185
|
-
const callback = this.props.delete.callback ?? function (a, b, c) {
|
|
5186
|
-
this.reload();
|
|
5187
|
-
};
|
|
5188
|
-
this.delete({
|
|
5189
|
-
value: sendName ? {
|
|
5190
|
-
[sendName]: value
|
|
5191
|
-
} : value,
|
|
5192
|
-
callback,
|
|
5193
|
-
...props
|
|
5194
|
-
});
|
|
5195
|
-
}
|
|
5196
|
-
}, "\u522A\u9664");
|
|
5197
|
-
},
|
|
5198
|
-
...props
|
|
5199
|
-
};
|
|
5232
|
+
}}
|
|
5233
|
+
`;
|
|
5234
|
+
const StyledColumnFooter = styled__default["default"].div`
|
|
5235
|
+
&:has(.left:empty):has(.right:empty)
|
|
5236
|
+
{
|
|
5237
|
+
border:1px solid blue;
|
|
5238
|
+
display: none;
|
|
5239
|
+
}
|
|
5240
|
+
|
|
5241
|
+
${({
|
|
5242
|
+
$layout
|
|
5243
|
+
}) => {
|
|
5244
|
+
if ($layout == 'v') {
|
|
5245
|
+
return ``;
|
|
5246
|
+
} else {
|
|
5247
|
+
return `grid-column-start:2;`;
|
|
5200
5248
|
}
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5249
|
+
}}
|
|
5250
|
+
height:25px;
|
|
5251
|
+
color:#ff6060;
|
|
5252
|
+
|
|
5253
|
+
display: flex;
|
|
5254
|
+
justify-content: space-between;
|
|
5255
|
+
|
|
5256
|
+
.left:{
|
|
5257
|
+
xflex:1;
|
|
5258
|
+
}
|
|
5259
|
+
.right{
|
|
5260
|
+
color:gray;
|
|
5261
|
+
xflex:1;
|
|
5262
|
+
}
|
|
5263
|
+
`;
|
|
5264
|
+
class JRFields extends JRWindow {
|
|
5265
|
+
UNSAFE_componentWillMount() {
|
|
5266
|
+
this.#initValidatorValue();
|
|
5267
|
+
}
|
|
5268
|
+
reset() {
|
|
5269
|
+
this.clearTestValue();
|
|
5270
|
+
super.reset();
|
|
5271
|
+
}
|
|
5272
|
+
setValue(value, reset) {
|
|
5273
|
+
super.setValue(value, reset);
|
|
5274
|
+
if (reset) {
|
|
5275
|
+
this.clearTestValue();
|
|
5276
|
+
}
|
|
5277
|
+
}
|
|
5278
|
+
//Validate-----------------------------------------------------------------------------------
|
|
5279
|
+
#initValidatorValue() {
|
|
5280
|
+
if (this.validateValueFrom == 'state') {
|
|
5281
|
+
this.setState({
|
|
5282
|
+
validatorValue: {}
|
|
5217
5283
|
});
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5284
|
+
}
|
|
5285
|
+
}
|
|
5286
|
+
get testValueFrom() {
|
|
5287
|
+
return this.props.testValue === undefined ? 'state' : 'props';
|
|
5288
|
+
}
|
|
5289
|
+
clearTestValue() {
|
|
5290
|
+
this.setTestValue({});
|
|
5291
|
+
}
|
|
5292
|
+
setTestValue(testValue, name) {
|
|
5293
|
+
if (this.testValueFrom == 'state') {
|
|
5294
|
+
if (name) {
|
|
5295
|
+
const newTestValue = this.getTestValue();
|
|
5296
|
+
newTestValue[name] = testValue;
|
|
5297
|
+
this.setState({
|
|
5298
|
+
testValue: {
|
|
5299
|
+
...this.getTestValue(),
|
|
5300
|
+
...testValue
|
|
5226
5301
|
}
|
|
5227
|
-
};
|
|
5228
|
-
column.getValue = function (record) {
|
|
5229
|
-
return _names.reduce((acc, name) => {
|
|
5230
|
-
return acc?.[name];
|
|
5231
|
-
}, record);
|
|
5232
|
-
};
|
|
5302
|
+
});
|
|
5233
5303
|
} else {
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
};
|
|
5237
|
-
column.getValue = function (record) {
|
|
5238
|
-
return record[column.name];
|
|
5239
|
-
};
|
|
5304
|
+
this.setState({
|
|
5305
|
+
testValue
|
|
5306
|
+
});
|
|
5240
5307
|
}
|
|
5241
|
-
|
|
5242
|
-
|
|
5308
|
+
}
|
|
5309
|
+
}
|
|
5310
|
+
getTestValue(fullname) {
|
|
5311
|
+
if (fullname) {
|
|
5312
|
+
return this.state?.testValue?.[fullname];
|
|
5313
|
+
} else {
|
|
5314
|
+
return this.state?.testValue;
|
|
5315
|
+
}
|
|
5316
|
+
}
|
|
5317
|
+
#validateField(column, fullNameArray, testValue, value) {
|
|
5318
|
+
const {
|
|
5319
|
+
name,
|
|
5320
|
+
validators: _validators,
|
|
5321
|
+
columns,
|
|
5322
|
+
type
|
|
5323
|
+
} = column;
|
|
5324
|
+
const fullName = fullNameArray.join('.');
|
|
5325
|
+
const validators = _validators ? [..._validators] : [];
|
|
5326
|
+
if (column.required) {
|
|
5327
|
+
validators.push(required);
|
|
5328
|
+
}
|
|
5329
|
+
if (column.max) {
|
|
5330
|
+
validators.push(max);
|
|
5331
|
+
}
|
|
5332
|
+
if (column.min) {
|
|
5333
|
+
validators.push(min);
|
|
5334
|
+
}
|
|
5335
|
+
if (validators.length) {
|
|
5336
|
+
testValue[fullName] = {
|
|
5337
|
+
isValid: null,
|
|
5338
|
+
msg: []
|
|
5243
5339
|
};
|
|
5340
|
+
const promises = [];
|
|
5341
|
+
for (let i = 0; i < validators.length; i++) {
|
|
5342
|
+
const validator = validators[i].bind(this)(value, column);
|
|
5343
|
+
if (validator?.then) {
|
|
5344
|
+
promises.push(validator);
|
|
5345
|
+
} else if (typeof validator == 'string') {
|
|
5346
|
+
promises.push(Promise.reject(validator));
|
|
5347
|
+
break;
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
return Promise.all(promises).then(reason => {
|
|
5351
|
+
testValue[fullName].isValid = true;
|
|
5352
|
+
return Promise.resolve(reason);
|
|
5353
|
+
}).catch(reason => {
|
|
5354
|
+
testValue[fullName].msg.push(reason);
|
|
5355
|
+
testValue[fullName].isValid = false;
|
|
5356
|
+
return Promise.reject(reason);
|
|
5357
|
+
});
|
|
5358
|
+
}
|
|
5359
|
+
}
|
|
5360
|
+
#validators(_columns, validators, names, testValue, value) {
|
|
5361
|
+
return _columns?.reduce((aco, column) => {
|
|
5362
|
+
const {
|
|
5363
|
+
name,
|
|
5364
|
+
validators,
|
|
5365
|
+
columns,
|
|
5366
|
+
type
|
|
5367
|
+
} = column;
|
|
5368
|
+
const fullNameArray = name ? [...names, name] : names;
|
|
5369
|
+
fullNameArray.join('.');
|
|
5370
|
+
{
|
|
5371
|
+
// 要的 if(this.getTestValue(fullName)?.isValid==null){//執行過的不再執行
|
|
5372
|
+
const validate = this.#validateField(column, fullNameArray, testValue, name ? value?.[name] : value);
|
|
5373
|
+
if (validate) {
|
|
5374
|
+
aco.push(validate);
|
|
5375
|
+
}
|
|
5376
|
+
}
|
|
5377
|
+
if (columns && type == undefined) {
|
|
5378
|
+
this.#validators(columns, aco, fullNameArray, testValue, name ? value?.[name] : value);
|
|
5379
|
+
}
|
|
5380
|
+
return aco;
|
|
5381
|
+
}, validators);
|
|
5382
|
+
}
|
|
5383
|
+
validate(value) {
|
|
5384
|
+
console.clear();
|
|
5385
|
+
const validators = [];
|
|
5386
|
+
const testValue = this.getTestValue() ?? {};
|
|
5387
|
+
this.#validators(this.getColumns(), validators, [], testValue, value !== undefined ? value : this.getValue());
|
|
5388
|
+
return Promise.all(validators).then(msg => {
|
|
5389
|
+
this.setTestValue(testValue);
|
|
5390
|
+
return Promise.resolve();
|
|
5391
|
+
}).catch(msg => {
|
|
5392
|
+
this.setTestValue(testValue);
|
|
5393
|
+
return Promise.reject();
|
|
5394
|
+
});
|
|
5395
|
+
}
|
|
5396
|
+
|
|
5397
|
+
//--------------------------------------------------------------------------------------
|
|
5398
|
+
get columnsFrom() {
|
|
5399
|
+
return this.props.initColumns !== undefined ? 'state' : 'props';
|
|
5400
|
+
}
|
|
5401
|
+
getColumns() {
|
|
5402
|
+
return this[this.columnsFrom]?.columns;
|
|
5403
|
+
}
|
|
5404
|
+
//-------------------------------------------------------------------------------------------
|
|
5405
|
+
|
|
5406
|
+
createColumn(parentValue, {
|
|
5407
|
+
type,
|
|
5408
|
+
name,
|
|
5409
|
+
colSpan,
|
|
5410
|
+
rowSpan,
|
|
5411
|
+
style,
|
|
5412
|
+
typeStyle: _typeStyle,
|
|
5413
|
+
columnStyle,
|
|
5414
|
+
...column
|
|
5415
|
+
}, index, parentName, fullnameArray, labelProps) {
|
|
5416
|
+
const value = name ? parentValue?.[name] : parentValue;
|
|
5417
|
+
const gap = column.gap ?? this.props.gap;
|
|
5418
|
+
const label = column.label;
|
|
5419
|
+
const _style = flexType(style, this, {}, {});
|
|
5420
|
+
const _columnStyle = flexType(columnStyle, this, {}, {});
|
|
5421
|
+
if (colSpan) _style.gridColumn = `span ${colSpan}`;
|
|
5422
|
+
if (rowSpan) _style.gridRow = `span ${rowSpan}`;
|
|
5423
|
+
let content;
|
|
5424
|
+
const onChange = inputValue => {
|
|
5425
|
+
const targetValue = inputValue?.target?.value ?? inputValue;
|
|
5426
|
+
try {
|
|
5427
|
+
parentValue[name] = targetValue;
|
|
5428
|
+
this.setValue({
|
|
5429
|
+
...this.getValue()
|
|
5430
|
+
});
|
|
5431
|
+
} catch (e) {
|
|
5432
|
+
const _value = this.getValue() ?? {};
|
|
5433
|
+
checkMap(name, targetValue, _value, [...parentName]);
|
|
5434
|
+
this.setValue(_value);
|
|
5435
|
+
}
|
|
5436
|
+
const testValue = this.getTestValue() ?? {};
|
|
5437
|
+
this.#validateField(column, fullnameArray, testValue, targetValue)?.then(() => {
|
|
5438
|
+
this.setTestValue(testValue);
|
|
5439
|
+
}).catch(() => {
|
|
5440
|
+
this.setTestValue(testValue);
|
|
5441
|
+
});
|
|
5442
|
+
};
|
|
5443
|
+
const _parentName = [...parentName];
|
|
5444
|
+
if (name !== undefined) {
|
|
5445
|
+
_parentName.push(name);
|
|
5446
|
+
}
|
|
5447
|
+
if (type) {
|
|
5448
|
+
const typeStyle = flexType(_typeStyle, this, null);
|
|
5449
|
+
content = /*#__PURE__*/React__default["default"].createElement(StyledColumnValue, {
|
|
5450
|
+
className: 'jr-column-value',
|
|
5451
|
+
style: {
|
|
5452
|
+
gridColumn: label == null ? 'span 2' : null,
|
|
5453
|
+
..._columnStyle
|
|
5454
|
+
}
|
|
5455
|
+
}, /*#__PURE__*/React__default["default"].createElement(type, {
|
|
5456
|
+
value: value,
|
|
5457
|
+
onChange,
|
|
5458
|
+
record: parentValue,
|
|
5459
|
+
style: {
|
|
5460
|
+
width: '100%',
|
|
5461
|
+
...typeStyle
|
|
5462
|
+
},
|
|
5463
|
+
...column
|
|
5464
|
+
}));
|
|
5465
|
+
} else if (column.columns) {
|
|
5466
|
+
content = /*#__PURE__*/React__default["default"].createElement(StyledGrid, {
|
|
5467
|
+
cols: column.cols,
|
|
5468
|
+
className: 'jr-grid',
|
|
5469
|
+
$gap: gap,
|
|
5470
|
+
style: _columnStyle
|
|
5471
|
+
}, this.createColumns(value, column.columns, _parentName, fullnameArray, column.labelProps ?? this.props.labelProps));
|
|
5472
|
+
} else if (name || column.render) {
|
|
5473
|
+
content = /*#__PURE__*/React__default["default"].createElement(StyledColumnValue, {
|
|
5474
|
+
className: 'jr-column-value',
|
|
5475
|
+
style: {
|
|
5476
|
+
gridColumn: label == null ? 'span 2' : null,
|
|
5477
|
+
padding: column.render ? '4px 0' : null
|
|
5478
|
+
}
|
|
5479
|
+
}, column.render ? column.render.bind(this)({
|
|
5480
|
+
onChange,
|
|
5481
|
+
value: value,
|
|
5482
|
+
record: this.getValue()
|
|
5483
|
+
}) : typeof value === 'object' ? JSON.stringify(value) : value);
|
|
5244
5484
|
}
|
|
5485
|
+
const layout = labelProps?.layout;
|
|
5486
|
+
const colon = labelProps?.colon === undefined ? ':' : labelProps.colon;
|
|
5487
|
+
const labelStyle = column.labelProps?.style ?? this.props.labelProps?.style ?? {};
|
|
5488
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledColumn, {
|
|
5489
|
+
$layout: layout,
|
|
5490
|
+
$hasLabel: label != null,
|
|
5491
|
+
key: `f${index}`,
|
|
5492
|
+
style: _style,
|
|
5493
|
+
className: 'jr-column',
|
|
5494
|
+
$labelWidth: column.labelProps?.width ?? this.props.labelProps?.width ?? '120px',
|
|
5495
|
+
$valueWidth: column.valueProps?.width ?? this.props.valueProps?.width ?? '1fr'
|
|
5496
|
+
}, label != null && /*#__PURE__*/React__default["default"].createElement(StyledColumnLabel, {
|
|
5497
|
+
style: labelStyle,
|
|
5498
|
+
$required: column.required,
|
|
5499
|
+
className: 'label',
|
|
5500
|
+
$layout: layout,
|
|
5501
|
+
$colon: colon
|
|
5502
|
+
}, label), content, /*#__PURE__*/React__default["default"].createElement(StyledColumnFooter, {
|
|
5503
|
+
$layout: layout
|
|
5504
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5505
|
+
className: "left"
|
|
5506
|
+
}, this.getTestValue(_parentName.join('.'))?.msg?.map(msg => {
|
|
5507
|
+
return msg;
|
|
5508
|
+
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5509
|
+
className: "right"
|
|
5510
|
+
})));
|
|
5245
5511
|
}
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
result.push([]);
|
|
5250
|
-
}
|
|
5251
|
-
}
|
|
5252
|
-
let _lastColSpan = lastColSpan;
|
|
5253
|
-
const childrenLength = columns?.reduce((acc, column) => {
|
|
5254
|
-
const c = this.initColumn(column, level, result, leafColumns, names, _lastColSpan);
|
|
5255
|
-
acc.colSpan += c.colSpan;
|
|
5256
|
-
_lastColSpan += c.colSpan;
|
|
5257
|
-
return acc;
|
|
5258
|
-
}, {
|
|
5259
|
-
colSpan: 0
|
|
5512
|
+
createColumns(parentValue, columns, parentName, fullname, labelProps) {
|
|
5513
|
+
return columns?.map((column, index) => {
|
|
5514
|
+
return this.createColumn(parentValue, column, index, parentName, column.name ? [...fullname, column.name] : fullname, labelProps);
|
|
5260
5515
|
});
|
|
5261
|
-
return childrenLength;
|
|
5262
5516
|
}
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5517
|
+
renderMe() {
|
|
5518
|
+
return /*#__PURE__*/React__default["default"].createElement(StyleJRFields, {
|
|
5519
|
+
className: 'jr-fields',
|
|
5520
|
+
style: this.props.typeStyle
|
|
5521
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledGrid, {
|
|
5522
|
+
cols: this.props.cols,
|
|
5523
|
+
style: this.props.gridStyle,
|
|
5524
|
+
className: 'jr-grid',
|
|
5525
|
+
$gap: this.props.gap
|
|
5526
|
+
}, this.createColumns(this.props.dataSourceName ? this.getValue()?.[this.props.dataSourceName] : this.getValue(), this.props.columns, this.props.dataSourceName ? [this.props.dataSourceName] : [], this.props.dataSourceName ? [this.props.dataSourceName] : [], this.props.labelProps)));
|
|
5527
|
+
}
|
|
5528
|
+
}
|
|
5529
|
+
|
|
5530
|
+
// export const FFields=JRFrameHOC(JRFields)
|
|
5531
|
+
// export const WFields=JRWindowHOC(FFields)
|
|
5532
|
+
|
|
5533
|
+
const StyledInput = styled__default["default"].div`
|
|
5534
|
+
display:flex;
|
|
5535
|
+
input:focus{
|
|
5536
|
+
outline: none;
|
|
5267
5537
|
}
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
this.setState({
|
|
5273
|
-
columns,
|
|
5274
|
-
leafColumns
|
|
5275
|
-
});
|
|
5538
|
+
`;
|
|
5539
|
+
class JRInput extends React__default["default"].Component {
|
|
5540
|
+
setValue(value) {
|
|
5541
|
+
this.props?.onChange?.(value);
|
|
5276
5542
|
}
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
getDataSource() {
|
|
5280
|
-
return this.props.dataSourceName ? this.getValue()?.[this.props.dataSourceName] : this.getValue();
|
|
5543
|
+
render() {
|
|
5544
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledInput, null, this.input());
|
|
5281
5545
|
}
|
|
5282
|
-
|
|
5283
|
-
//group 還沒有考慮到
|
|
5546
|
+
}
|
|
5284
5547
|
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5548
|
+
function styleInject(css, ref) {
|
|
5549
|
+
if ( ref === void 0 ) ref = {};
|
|
5550
|
+
var insertAt = ref.insertAt;
|
|
5551
|
+
|
|
5552
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
5553
|
+
|
|
5554
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
5555
|
+
var style = document.createElement('style');
|
|
5556
|
+
style.type = 'text/css';
|
|
5557
|
+
|
|
5558
|
+
if (insertAt === 'top') {
|
|
5559
|
+
if (head.firstChild) {
|
|
5560
|
+
head.insertBefore(style, head.firstChild);
|
|
5292
5561
|
} else {
|
|
5293
|
-
|
|
5294
|
-
this.setValue({
|
|
5295
|
-
[this.props.dataSourceName]: [record]
|
|
5296
|
-
});
|
|
5562
|
+
head.appendChild(style);
|
|
5297
5563
|
}
|
|
5564
|
+
} else {
|
|
5565
|
+
head.appendChild(style);
|
|
5298
5566
|
}
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
}
|
|
5303
|
-
|
|
5304
|
-
renderMe() {
|
|
5305
|
-
return /*#__PURE__*/React__default["default"].createElement(StyledJRTable, {
|
|
5306
|
-
className: `${this.props.className ?? ''} jr-table ${this.props.onRowClick ? 'row-highlightable' : ''}`
|
|
5307
|
-
}, /*#__PURE__*/React__default["default"].createElement("table", {
|
|
5308
|
-
className: 'jr-table-table'
|
|
5309
|
-
}, /*#__PURE__*/React__default["default"].createElement(TBodies, {
|
|
5310
|
-
table: this,
|
|
5311
|
-
leafColumns: this.state.leafColumns,
|
|
5312
|
-
groupHeader: this.props.groupHeader,
|
|
5313
|
-
groupFooter: this.props.groupFooter,
|
|
5314
|
-
dataSource: this.getDataSource(),
|
|
5315
|
-
onRowClick: this.props.onRowClick
|
|
5316
|
-
}), /*#__PURE__*/React__default["default"].createElement(TFoot, {
|
|
5317
|
-
columns: this.props.footColumns,
|
|
5318
|
-
table: this
|
|
5319
|
-
}), /*#__PURE__*/React__default["default"].createElement(THead, {
|
|
5320
|
-
columns: this.state.columns,
|
|
5321
|
-
leafColumns: this.state.leafColumns,
|
|
5322
|
-
table: this
|
|
5323
|
-
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5324
|
-
className: 'empty'
|
|
5325
|
-
}, this.noData() && '無資料'));
|
|
5567
|
+
|
|
5568
|
+
if (style.styleSheet) {
|
|
5569
|
+
style.styleSheet.cssText = css;
|
|
5570
|
+
} else {
|
|
5571
|
+
style.appendChild(document.createTextNode(css));
|
|
5326
5572
|
}
|
|
5327
5573
|
}
|
|
5328
5574
|
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5575
|
+
var css_248z = ".Style-module_test__LrdEc{border:1px solid red;color:red}.Style-module_withMask__LPcai{overflow:hidden!important;position:relative;user-select:none;&:after{a:#868686cc;background:#868686cc;border-radius:inherit;bottom:0;content:\"\";height:10000px;left:0;position:absolute;right:0;top:0;width:10000px}}mask{background:#868686cc;border-radius:inherit;bottom:0;height:10000px;left:0;position:absolute;right:0;top:0;width:10000px}";
|
|
5576
|
+
var style = {"test":"Style-module_test__LrdEc","withMask":"Style-module_withMask__LPcai"};
|
|
5577
|
+
styleInject(css_248z);
|
|
5578
|
+
|
|
5579
|
+
const StyledJRWindow = styled__default["default"].div`
|
|
5580
|
+
--jr-window-radius:3px;
|
|
5581
|
+
--padding-child:8px;
|
|
5582
|
+
--transition-x-y:height .05s ease-in, width .05s ease-in;
|
|
5583
|
+
xborder:1px solid gray;
|
|
5584
|
+
position: fixed;
|
|
5585
|
+
padding: ${({
|
|
5586
|
+
$thick
|
|
5587
|
+
}) => $thick}px;
|
|
5588
|
+
border-radius: var(--jr-window-radius);
|
|
5589
|
+
user-select: text;
|
|
5590
|
+
|
|
5591
|
+
top: ${({
|
|
5592
|
+
$y
|
|
5593
|
+
}) => $y}px;
|
|
5594
|
+
left: ${({
|
|
5595
|
+
$x
|
|
5596
|
+
}) => $x}px;
|
|
5597
|
+
width: ${({
|
|
5598
|
+
$width = 300
|
|
5599
|
+
}) => `${$width}px`};
|
|
5600
|
+
height: ${({
|
|
5601
|
+
$height = 300
|
|
5602
|
+
}) => `${$height}px`};
|
|
5603
|
+
overflow: hidden;
|
|
5604
|
+
z-index: 2;
|
|
5333
5605
|
|
|
5606
|
+
display: flex;
|
|
5334
5607
|
flex-direction: column;
|
|
5335
|
-
|
|
5336
|
-
overflow: overlay;
|
|
5337
|
-
padding: 10px;
|
|
5608
|
+
overflow: hidden;
|
|
5338
5609
|
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5610
|
+
> main{
|
|
5611
|
+
border-radius: var(--jr-window-radius);
|
|
5612
|
+
box-shadow: 0px 0px 5px 1px gray;
|
|
5613
|
+
display: flex;
|
|
5614
|
+
flex-direction: column;
|
|
5615
|
+
overflow: hidden;
|
|
5616
|
+
flex:1;
|
|
5617
|
+
> main {
|
|
5618
|
+
Xpadding:var(--padding-child);
|
|
5619
|
+
overflow: overlay;
|
|
5620
|
+
flex:1;
|
|
5621
|
+
display: flex;
|
|
5622
|
+
min-height:32px;
|
|
5351
5623
|
}
|
|
5352
5624
|
}
|
|
5625
|
+
|
|
5353
5626
|
`;
|
|
5627
|
+
class JRWindow extends JRFrame {
|
|
5628
|
+
x = 0;
|
|
5629
|
+
y = 0;
|
|
5630
|
+
width = 300;
|
|
5631
|
+
height = 300;
|
|
5632
|
+
padding = 1;
|
|
5633
|
+
thick = 5;
|
|
5634
|
+
constructor(props) {
|
|
5635
|
+
super(props);
|
|
5636
|
+
this.ref = /*#__PURE__*/React__default["default"].createRef();
|
|
5637
|
+
this.titleBarRef = /*#__PURE__*/React__default["default"].createRef();
|
|
5638
|
+
this.init();
|
|
5639
|
+
}
|
|
5640
|
+
addMaskToTarget = target => {
|
|
5641
|
+
this.mask = document.createElement('div');
|
|
5642
|
+
this.mask.style.background = '#868686cc';
|
|
5643
|
+
this.mask.style.position = 'absolute';
|
|
5644
|
+
this.mask.style.top = '0';
|
|
5645
|
+
this.mask.style.left = '0';
|
|
5646
|
+
this.mask.style.right = '0';
|
|
5647
|
+
this.mask.style.bottom = '0';
|
|
5648
|
+
this.mask.style.borderRadius = 'inherit';
|
|
5649
|
+
this.mask.style.height = '10000px';
|
|
5650
|
+
this.mask.style.width = '10000px';
|
|
5651
|
+
target.appendChild(this.mask);
|
|
5652
|
+
po('style.mask', style.mask);
|
|
5653
|
+
po('addMask+++++++++++++++++++++++++++');
|
|
5654
|
+
};
|
|
5655
|
+
removeMaskFromTarget = () => {
|
|
5656
|
+
po('removeMask-----------------------');
|
|
5657
|
+
this.mask.remove();
|
|
5658
|
+
};
|
|
5659
|
+
maskOnTarget(on) {
|
|
5660
|
+
po('typeof this.props.maskOn', typeof this.props.maskOn);
|
|
5661
|
+
const target = typeof this.props.maskOn === 'object' ? this.props.maskOn : typeof this.props.maskOn === 'string' ? document.getElementById(this.props.maskOn) : document.body;
|
|
5354
5662
|
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5663
|
+
// this[on?'addMaskToTarget':'removeMaskFromTarget'](target)
|
|
5664
|
+
target?.classList[on ? 'add' : 'remove']('withMask');
|
|
5665
|
+
}
|
|
5666
|
+
componentDidMount() {
|
|
5667
|
+
super.componentDidMount();
|
|
5668
|
+
if (this.props.maskOn && this.props.open) {
|
|
5669
|
+
this.maskOnTarget(this.props.open);
|
|
5670
|
+
}
|
|
5671
|
+
if (this.props.open) {
|
|
5672
|
+
this.open();
|
|
5360
5673
|
}
|
|
5361
|
-
checkMap(_name, inputValue, mapValue[name], nameList);
|
|
5362
|
-
} else {
|
|
5363
|
-
mapValue[_name] = inputValue;
|
|
5364
5674
|
}
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5675
|
+
open() {
|
|
5676
|
+
this.props.onOpen?.bind(this)();
|
|
5677
|
+
}
|
|
5678
|
+
close() {
|
|
5679
|
+
this.props.onClose?.bind(this)();
|
|
5680
|
+
}
|
|
5681
|
+
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
5682
|
+
if (this.props.popup === true) {
|
|
5683
|
+
if (this.props.open && prevProps.open === false) {
|
|
5684
|
+
this.open();
|
|
5685
|
+
} else if (this.props.open === false && prevProps.open) {
|
|
5686
|
+
this.close();
|
|
5687
|
+
}
|
|
5688
|
+
if (this.props.maskOn && this.props.open != prevProps.open) {
|
|
5689
|
+
this.maskOnTarget(this.props.open);
|
|
5690
|
+
}
|
|
5691
|
+
}
|
|
5692
|
+
}
|
|
5693
|
+
init() {
|
|
5694
|
+
this.height = window.innerHeight >= (this.props.height ?? this.height) ? this.props.height ?? this.height : window.innerHeight;
|
|
5695
|
+
this.width = window.innerWidth >= (this.props.width ?? this.width) ? this.props.width ?? this.width : window.innerWidth;
|
|
5696
|
+
this.x = this.props.x ?? (window.innerWidth - (this.width ?? 300)) / 2;
|
|
5697
|
+
this.y = this.props.y ?? (window.innerHeight - (this.height ?? 300)) / 2;
|
|
5698
|
+
}
|
|
5699
|
+
renderer() {
|
|
5700
|
+
return this.props.popup === true ? this.props.open ? /*#__PURE__*/React__default["default"].createElement(StyledJRWindow, {
|
|
5701
|
+
ref: this.ref,
|
|
5702
|
+
className: `jr-window ${this.props.className ?? ''}`,
|
|
5703
|
+
$x: this.x,
|
|
5704
|
+
$y: this.y,
|
|
5705
|
+
$width: this.width,
|
|
5706
|
+
$height: this.height,
|
|
5707
|
+
$thick: this.thick
|
|
5708
|
+
}, /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(TitleBar, {
|
|
5709
|
+
titleBarRef: this.titleBarRef,
|
|
5710
|
+
windowRef: this.ref,
|
|
5711
|
+
window: this,
|
|
5712
|
+
title: this.props.title,
|
|
5713
|
+
thick: this.thick
|
|
5714
|
+
}), /*#__PURE__*/React__default["default"].createElement("main", null, super.renderer())), /*#__PURE__*/React__default["default"].createElement(Sliders, {
|
|
5715
|
+
thick: this.thick,
|
|
5716
|
+
windowRef: this.ref,
|
|
5717
|
+
window: this,
|
|
5718
|
+
titleBarRef: this.titleBarRef
|
|
5719
|
+
})) : '' : super.renderer();
|
|
5720
|
+
}
|
|
5721
|
+
}
|
|
5377
5722
|
|
|
5378
|
-
gap: ${({
|
|
5379
|
-
$gap
|
|
5380
|
-
}) => $gap};
|
|
5381
|
-
`;
|
|
5382
5723
|
styled__default["default"].div`
|
|
5383
|
-
|
|
5384
|
-
const StyledColumn = styled__default["default"].div`
|
|
5724
|
+
display:flex;
|
|
5385
5725
|
flex:1;
|
|
5386
|
-
|
|
5726
|
+
overflow:hidden;
|
|
5387
5727
|
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
}
|
|
5400
|
-
`;
|
|
5401
|
-
const StyledColumnLabel = styled__default["default"].div`
|
|
5402
|
-
${({
|
|
5403
|
-
$layout
|
|
5404
|
-
}) => {
|
|
5405
|
-
if ($layout == 'v') {
|
|
5406
|
-
return `text-align: start;`;
|
|
5407
|
-
} else {
|
|
5408
|
-
return `text-align: end;`;
|
|
5409
|
-
}
|
|
5410
|
-
}}
|
|
5728
|
+
> *{
|
|
5729
|
+
Xborder:1px solid gray;
|
|
5730
|
+
}
|
|
5731
|
+
>main{
|
|
5732
|
+
display:flex;
|
|
5733
|
+
flex:1;
|
|
5734
|
+
overflow:overlay;
|
|
5735
|
+
flex-direction: column;
|
|
5736
|
+
> *{
|
|
5737
|
+
XXborder:1px solid gray;
|
|
5738
|
+
XXmin-height:30px;
|
|
5739
|
+
}
|
|
5411
5740
|
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5741
|
+
>header{
|
|
5742
|
+
XXborder:1px solid red;
|
|
5743
|
+
XXoverflow: overlay;
|
|
5744
|
+
}
|
|
5745
|
+
>main{
|
|
5746
|
+
display:flex;
|
|
5747
|
+
flex:1;
|
|
5748
|
+
overflow:hidden;
|
|
5749
|
+
}
|
|
5750
|
+
>footer{
|
|
5751
|
+
XXborder:1px solid blue;
|
|
5752
|
+
overflow: overlay;
|
|
5753
|
+
}
|
|
5423
5754
|
|
|
5424
|
-
|
|
5425
|
-
$colon
|
|
5426
|
-
}) => {
|
|
5427
|
-
if ($colon) {
|
|
5428
|
-
return `
|
|
5429
|
-
&:not(:empty)::after{
|
|
5430
|
-
content:'${$colon}';
|
|
5431
|
-
}
|
|
5432
|
-
`;
|
|
5433
|
-
}
|
|
5434
|
-
}}
|
|
5755
|
+
}
|
|
5435
5756
|
|
|
5436
5757
|
`;
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5758
|
+
|
|
5759
|
+
styled__default["default"].div`
|
|
5760
|
+
--jr-window-radius:3px;
|
|
5761
|
+
--padding-child:8px;
|
|
5762
|
+
--transition-x-y:height .05s ease-in, width .05s ease-in;
|
|
5763
|
+
xborder:1px solid gray;
|
|
5764
|
+
position: fixed;
|
|
5765
|
+
padding: ${({
|
|
5766
|
+
$thick
|
|
5767
|
+
}) => $thick}px;
|
|
5768
|
+
border-radius: var(--jr-window-radius);
|
|
5769
|
+
|
|
5770
|
+
top: ${({
|
|
5771
|
+
$y
|
|
5772
|
+
}) => $y}px;
|
|
5773
|
+
left: ${({
|
|
5774
|
+
$x
|
|
5775
|
+
}) => $x}px;
|
|
5776
|
+
width: ${({
|
|
5777
|
+
$width = 300
|
|
5778
|
+
}) => `${$width}px`};
|
|
5779
|
+
height: ${({
|
|
5780
|
+
$height = 300
|
|
5781
|
+
}) => `${$height}px`};
|
|
5782
|
+
overflow: hidden;
|
|
5783
|
+
|
|
5784
|
+
display: flex;
|
|
5440
5785
|
flex-direction: column;
|
|
5441
5786
|
overflow: hidden;
|
|
5787
|
+
|
|
5788
|
+
> main{
|
|
5789
|
+
border-radius: var(--jr-window-radius);
|
|
5790
|
+
box-shadow: 0px 0px 5px 1px gray;
|
|
5791
|
+
Xbackground: white;
|
|
5792
|
+
display: flex;
|
|
5793
|
+
flex-direction: column;
|
|
5794
|
+
overflow: hidden;
|
|
5795
|
+
flex:1;
|
|
5796
|
+
> main {
|
|
5797
|
+
background: white;
|
|
5798
|
+
Xpadding:var(--padding-child);
|
|
5799
|
+
overflow: overlay;
|
|
5800
|
+
flex:1;
|
|
5801
|
+
display: flex;
|
|
5802
|
+
}
|
|
5803
|
+
}
|
|
5442
5804
|
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
}
|
|
5447
|
-
|
|
5448
|
-
return `
|
|
5449
|
-
> * {
|
|
5450
|
-
xborder:1px solid red;
|
|
5451
|
-
}
|
|
5452
|
-
`;
|
|
5453
|
-
}
|
|
5454
|
-
}}
|
|
5805
|
+
@container (min-width: 700px) {
|
|
5806
|
+
&{
|
|
5807
|
+
border: 1px solid red;
|
|
5808
|
+
}
|
|
5809
|
+
}
|
|
5455
5810
|
`;
|
|
5456
5811
|
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
const valueString = (str = '', value = {}) => {
|
|
5464
|
-
return Array.from(new Set(str.match(/[^{}]+(?=})/g))).reduce((aco, name) => {
|
|
5465
|
-
return aco.replace(new RegExp(`\\{${name}\\}`, "g"), value?.[name] ?? `{${name}}`);
|
|
5466
|
-
}, String(str));
|
|
5467
|
-
};
|
|
5468
|
-
const ColumnMessage = ({
|
|
5469
|
-
value = {},
|
|
5470
|
-
record
|
|
5471
|
-
}) => {
|
|
5472
|
-
if (value.isValid === false) {
|
|
5473
|
-
return valueString(value.msg, record);
|
|
5812
|
+
const getMapObject = (map, names) => {
|
|
5813
|
+
const name = names.shift(names);
|
|
5814
|
+
if (names.length) {
|
|
5815
|
+
return getMapObject(map?.[name], names);
|
|
5816
|
+
} else {
|
|
5817
|
+
return map;
|
|
5474
5818
|
}
|
|
5475
5819
|
};
|
|
5476
|
-
const
|
|
5477
|
-
|
|
5478
|
-
|
|
5820
|
+
const setMapObject = (map, names, value) => {
|
|
5821
|
+
const name = names.shift(names);
|
|
5822
|
+
if (names?.length) {
|
|
5823
|
+
if (typeof map[name] != 'object') {
|
|
5824
|
+
map[name] = {};
|
|
5479
5825
|
}
|
|
5480
|
-
|
|
5481
|
-
$layout
|
|
5482
|
-
}) => {
|
|
5483
|
-
if ($layout == 'v') {
|
|
5484
|
-
return ``;
|
|
5826
|
+
setMapObject(map[name], names, value);
|
|
5485
5827
|
} else {
|
|
5486
|
-
|
|
5828
|
+
map[name] = value;
|
|
5829
|
+
}
|
|
5830
|
+
};
|
|
5831
|
+
class JRTable extends JRWindow {
|
|
5832
|
+
constructor(props) {
|
|
5833
|
+
super(props);
|
|
5834
|
+
this.colGroupRef = /*#__PURE__*/React__default["default"].createRef();
|
|
5835
|
+
}
|
|
5836
|
+
UNSAFE_componentWillMount() {
|
|
5837
|
+
this.setColumns(this.props.columns ?? []);
|
|
5487
5838
|
}
|
|
5488
|
-
}}
|
|
5489
|
-
height:25px;
|
|
5490
|
-
color:#ff6060;
|
|
5491
|
-
|
|
5492
|
-
display: flex;
|
|
5493
|
-
justify-content: space-between;
|
|
5494
5839
|
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5840
|
+
//------------------------------------------------------------------------------------
|
|
5841
|
+
checkableColumn(props) {
|
|
5842
|
+
return {
|
|
5843
|
+
//方法1
|
|
5844
|
+
render({
|
|
5845
|
+
value,
|
|
5846
|
+
onChange
|
|
5847
|
+
}) {
|
|
5848
|
+
return /*#__PURE__*/React__default["default"].createElement("checkbox", {
|
|
5849
|
+
checked: value,
|
|
5850
|
+
onChange: e => {
|
|
5851
|
+
onChange(e.target.checked);
|
|
5852
|
+
}
|
|
5853
|
+
});
|
|
5854
|
+
},
|
|
5855
|
+
align: 'center',
|
|
5856
|
+
name: 'checked',
|
|
5857
|
+
...props
|
|
5858
|
+
};
|
|
5859
|
+
// return {//方法2
|
|
5860
|
+
// type:Checkbox
|
|
5861
|
+
// ,funcProps({value}){
|
|
5862
|
+
// po('fffffffffffff',value)
|
|
5863
|
+
// return {
|
|
5864
|
+
// align:'center'
|
|
5865
|
+
// ,checked:value
|
|
5866
|
+
// }
|
|
5867
|
+
// }
|
|
5868
|
+
// // ,label:'A'
|
|
5869
|
+
// ,onChange(e,{value,onChange,me}){
|
|
5870
|
+
// onChange(e.target.checked)
|
|
5871
|
+
// }
|
|
5872
|
+
// ,...props
|
|
5873
|
+
// }
|
|
5874
|
+
}
|
|
5875
|
+
deletableColumn({
|
|
5876
|
+
name = 'deletable',
|
|
5877
|
+
sendValue,
|
|
5878
|
+
sendName,
|
|
5879
|
+
valueName,
|
|
5880
|
+
...props
|
|
5881
|
+
}) {
|
|
5507
5882
|
return {
|
|
5508
|
-
|
|
5883
|
+
render({
|
|
5884
|
+
value,
|
|
5885
|
+
onChange
|
|
5886
|
+
}) {
|
|
5887
|
+
return /*#__PURE__*/React__default["default"].createElement("checkbox", {
|
|
5888
|
+
checked: value,
|
|
5889
|
+
onChange: e => {
|
|
5890
|
+
onChange(e.target.checked);
|
|
5891
|
+
}
|
|
5892
|
+
});
|
|
5893
|
+
},
|
|
5894
|
+
align: 'center',
|
|
5895
|
+
name,
|
|
5896
|
+
label() {
|
|
5897
|
+
return /*#__PURE__*/React__default["default"].createElement("button", {
|
|
5898
|
+
onClick: () => {
|
|
5899
|
+
const value = this.props.delete.value ?? this.getDataSource()?.filter(record => record[name]).map(record => sendValue ? record[sendValue] : record);
|
|
5900
|
+
const callback = this.props.delete.callback ?? function (a, b, c) {
|
|
5901
|
+
this.reload();
|
|
5902
|
+
};
|
|
5903
|
+
this.delete({
|
|
5904
|
+
value: sendName ? {
|
|
5905
|
+
[sendName]: value
|
|
5906
|
+
} : value,
|
|
5907
|
+
callback,
|
|
5908
|
+
...props
|
|
5909
|
+
});
|
|
5910
|
+
}
|
|
5911
|
+
}, "\u522A\u9664");
|
|
5912
|
+
},
|
|
5913
|
+
...props
|
|
5509
5914
|
};
|
|
5510
5915
|
}
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5916
|
+
initColumn(column, level, result, leafColumns, names, lastColSpan) {
|
|
5917
|
+
const isBranch = column.type === undefined && column?.columns && column?.columns.length;
|
|
5918
|
+
const _names = column.name ? [...names, column.name] : names;
|
|
5919
|
+
if (isBranch) {
|
|
5920
|
+
if (column.label !== null) result[level].push(column);
|
|
5921
|
+
const c = this.initColumns(column.columns, level + (column.label !== null ? 1 : 0) + (column.rowSpan != null ? column.rowSpan - 1 : 0), result, leafColumns, _names, lastColSpan);
|
|
5922
|
+
column.colSpan = c.colSpan;
|
|
5923
|
+
column.columnNo = lastColSpan;
|
|
5924
|
+
return {
|
|
5925
|
+
colSpan: column.colSpan
|
|
5926
|
+
};
|
|
5927
|
+
} else {
|
|
5928
|
+
column.columnNo = lastColSpan;
|
|
5929
|
+
result[level].push({
|
|
5930
|
+
...column,
|
|
5931
|
+
isLeaf: true
|
|
5932
|
+
});
|
|
5933
|
+
leafColumns.push(column);
|
|
5934
|
+
column.names = _names;
|
|
5935
|
+
if (_names?.length > 1) {
|
|
5936
|
+
column.setValue = function (record, value) {
|
|
5937
|
+
try {
|
|
5938
|
+
getMapObject(record, [..._names])[column.name] = value;
|
|
5939
|
+
} catch {
|
|
5940
|
+
setMapObject(record, [..._names], value);
|
|
5941
|
+
}
|
|
5942
|
+
};
|
|
5943
|
+
column.getValue = function (record) {
|
|
5944
|
+
return _names.reduce((acc, name) => {
|
|
5945
|
+
return acc?.[name];
|
|
5946
|
+
}, record);
|
|
5947
|
+
};
|
|
5948
|
+
} else {
|
|
5949
|
+
column.setValue = function (record, value) {
|
|
5950
|
+
record[column.name] = value;
|
|
5951
|
+
};
|
|
5952
|
+
column.getValue = function (record) {
|
|
5953
|
+
return record[column.name];
|
|
5954
|
+
};
|
|
5955
|
+
}
|
|
5956
|
+
return {
|
|
5957
|
+
colSpan: 1
|
|
5536
5958
|
};
|
|
5537
5959
|
}
|
|
5538
5960
|
}
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
columns,
|
|
5544
|
-
...column
|
|
5545
|
-
}, index) => {
|
|
5546
|
-
no += 1;
|
|
5547
|
-
const fullnameList = name ? [..._fullnameList, name] : _fullnameList;
|
|
5548
|
-
const fullname = fullnameList.join('.');
|
|
5549
|
-
this.#findValidator(acc, fullname, column);
|
|
5550
|
-
if (type == null && columns) {
|
|
5551
|
-
this.#loopColumnsForValidateValue(no, fullnameList, columns, `${tab}\t`, result);
|
|
5961
|
+
initColumns(columns, level, result, leafColumns, names, lastColSpan) {
|
|
5962
|
+
for (let i = result.length; i <= level; i++) {
|
|
5963
|
+
if (!result[i]) {
|
|
5964
|
+
result.push([]);
|
|
5552
5965
|
}
|
|
5966
|
+
}
|
|
5967
|
+
let _lastColSpan = lastColSpan;
|
|
5968
|
+
const childrenLength = columns?.reduce((acc, column) => {
|
|
5969
|
+
const c = this.initColumn(column, level, result, leafColumns, names, _lastColSpan);
|
|
5970
|
+
acc.colSpan += c.colSpan;
|
|
5971
|
+
_lastColSpan += c.colSpan;
|
|
5553
5972
|
return acc;
|
|
5554
|
-
},
|
|
5555
|
-
|
|
5556
|
-
}
|
|
5557
|
-
clearValidateValue() {
|
|
5558
|
-
Object.values(this.getValidateValue()).forEach(v => v.isValid = null);
|
|
5559
|
-
}
|
|
5560
|
-
#initValidateValue() {
|
|
5561
|
-
const columns = this.getColumns();
|
|
5562
|
-
const validateValue = this.#loopColumnsForValidateValue(0, this.props.dataSourceName ? [this.props.dataSourceName] : [], columns, '', {});
|
|
5563
|
-
this.setState({
|
|
5564
|
-
validateValue
|
|
5973
|
+
}, {
|
|
5974
|
+
colSpan: 0
|
|
5565
5975
|
});
|
|
5976
|
+
return childrenLength;
|
|
5566
5977
|
}
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
value,
|
|
5572
|
-
record
|
|
5573
|
-
});
|
|
5574
|
-
if (result) {
|
|
5575
|
-
validateConfig.isValid = false;
|
|
5576
|
-
validateConfig.msg = result.msg;
|
|
5577
|
-
break;
|
|
5578
|
-
}
|
|
5978
|
+
setColumns([..._columns]) {
|
|
5979
|
+
if (this.props.checkable) _columns.unshift(this.checkableColumn(this.props.checkable));
|
|
5980
|
+
if (this.props.deletable) {
|
|
5981
|
+
_columns.unshift(this.deletableColumn(this.props.deletable));
|
|
5579
5982
|
}
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
this.#exeValidateConfig(validateConfig, this.getValue(fullname), this.getValue());
|
|
5585
|
-
});
|
|
5983
|
+
const columns = [];
|
|
5984
|
+
const leafColumns = [];
|
|
5985
|
+
this.initColumns(_columns, 0, columns, leafColumns, [], 0);
|
|
5986
|
+
// po('initColumns',initColumns)
|
|
5586
5987
|
this.setState({
|
|
5587
|
-
|
|
5988
|
+
columns,
|
|
5989
|
+
leafColumns
|
|
5588
5990
|
});
|
|
5589
5991
|
}
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
if (fullname === undefined) {
|
|
5595
|
-
return this[this.validateValueFrom]?.validateValue;
|
|
5596
|
-
} else {
|
|
5597
|
-
return this[this.validateValueFrom]?.validateValue?.[fullname];
|
|
5598
|
-
}
|
|
5599
|
-
}
|
|
5600
|
-
setValidateValue(validateValue) {
|
|
5601
|
-
if (this.props.setValidateValue) {
|
|
5602
|
-
this.props.setValidateValue(validateValue);
|
|
5603
|
-
} else {
|
|
5604
|
-
this.setState({
|
|
5605
|
-
validateValue
|
|
5606
|
-
});
|
|
5607
|
-
}
|
|
5608
|
-
}
|
|
5609
|
-
createValidator({
|
|
5610
|
-
required
|
|
5611
|
-
}) {
|
|
5612
|
-
const validators = [];
|
|
5613
|
-
if (required === true && required.value) {
|
|
5614
|
-
validators.push(requiredValidator);
|
|
5615
|
-
}
|
|
5616
|
-
return validators;
|
|
5617
|
-
}
|
|
5618
|
-
//--------------------------------------------------------------------------------------
|
|
5619
|
-
get columnsFrom() {
|
|
5620
|
-
return this.props.initColumns !== undefined ? 'state' : 'props';
|
|
5621
|
-
}
|
|
5622
|
-
getColumns() {
|
|
5623
|
-
return this[this.columnsFrom]?.columns;
|
|
5992
|
+
//------------------------------------------------------------------------------------
|
|
5993
|
+
setDataSource(dataSource) {}
|
|
5994
|
+
getDataSource() {
|
|
5995
|
+
return this.props.dataSourceName ? this.getValue()?.[this.props.dataSourceName] : this.getValue();
|
|
5624
5996
|
}
|
|
5625
|
-
|
|
5997
|
+
add(record, index = this.getDataSource()?.length ?? 0, group) {
|
|
5998
|
+
//group 還沒有考慮到
|
|
5626
5999
|
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
name,
|
|
5633
|
-
colSpan,
|
|
5634
|
-
rowSpan,
|
|
5635
|
-
style,
|
|
5636
|
-
typeStyle: _typeStyle,
|
|
5637
|
-
required,
|
|
5638
|
-
...column
|
|
5639
|
-
}, index, parentName, fullname) {
|
|
5640
|
-
const value = name ? parentValue?.[name] : parentValue;
|
|
5641
|
-
const gap = column.gap ?? this.props.gap;
|
|
5642
|
-
const label = column.label;
|
|
5643
|
-
const _style = flexType(style, this, {}, {});
|
|
5644
|
-
if (colSpan) _style.gridColumn = `span ${colSpan}`;
|
|
5645
|
-
if (rowSpan) _style.gridRow = `span ${rowSpan}`;
|
|
5646
|
-
let content;
|
|
5647
|
-
this.createValidator({
|
|
5648
|
-
required,
|
|
5649
|
-
column
|
|
5650
|
-
});
|
|
5651
|
-
const fn = fullname.join('.');
|
|
5652
|
-
const onChange = inputValue => {
|
|
5653
|
-
const targetValue = inputValue?.target?.value ?? inputValue;
|
|
5654
|
-
try {
|
|
5655
|
-
parentValue[name] = targetValue;
|
|
5656
|
-
this.setValue({
|
|
5657
|
-
...this.getValue()
|
|
5658
|
-
});
|
|
5659
|
-
} catch (e) {
|
|
5660
|
-
const _value = this.getValue() ?? {};
|
|
5661
|
-
checkMap(name, targetValue, _value, [...parentName]);
|
|
5662
|
-
this.setValue(_value);
|
|
6000
|
+
if (this.getDataSource()) {
|
|
6001
|
+
if (group === undefined) {
|
|
6002
|
+
this.getDataSource().splice(index, 0, record); //.push(record)
|
|
6003
|
+
} else {
|
|
6004
|
+
this.getDataSource()[group].splice(index, 0, record); //.push(record)
|
|
5663
6005
|
}
|
|
5664
|
-
|
|
5665
|
-
}
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
}
|
|
5670
|
-
if (type) {
|
|
5671
|
-
const typeStyle = flexType(_typeStyle, this, null);
|
|
5672
|
-
content = /*#__PURE__*/React__default["default"].createElement(StyledColumnValue, {
|
|
5673
|
-
className: 'jr-column-value',
|
|
5674
|
-
style: {
|
|
5675
|
-
gridColumn: label == null ? 'span 2' : null
|
|
5676
|
-
}
|
|
5677
|
-
}, /*#__PURE__*/React__default["default"].createElement(type, {
|
|
5678
|
-
value: value,
|
|
5679
|
-
onChange,
|
|
5680
|
-
record: parentValue,
|
|
5681
|
-
style: {
|
|
5682
|
-
width: '100%',
|
|
5683
|
-
...typeStyle
|
|
5684
|
-
},
|
|
5685
|
-
...column
|
|
5686
|
-
}));
|
|
5687
|
-
} else if (column.columns) {
|
|
5688
|
-
content = /*#__PURE__*/React__default["default"].createElement(StyledGrid, {
|
|
5689
|
-
cols: column.cols,
|
|
5690
|
-
className: 'jr-grid',
|
|
5691
|
-
$gap: gap
|
|
5692
|
-
}, this.createColumns(value, column.columns, _parentName, fullname));
|
|
5693
|
-
} else if (name || column.render) {
|
|
5694
|
-
content = /*#__PURE__*/React__default["default"].createElement(StyledColumnValue, {
|
|
5695
|
-
className: 'jr-column-value',
|
|
5696
|
-
style: {
|
|
5697
|
-
gridColumn: label == null ? 'span 2' : null,
|
|
5698
|
-
padding: column.render ? '4px 0' : null
|
|
5699
|
-
}
|
|
5700
|
-
}, column.render ? column.render.bind(this)({
|
|
5701
|
-
onChange,
|
|
5702
|
-
value: value,
|
|
5703
|
-
record: this.getValue()
|
|
5704
|
-
}) : typeof value === 'object' ? JSON.stringify(value) : value);
|
|
6006
|
+
this.setValue(this.getValue());
|
|
6007
|
+
} else {
|
|
6008
|
+
this.setValue(this.props.dataSourceName ? {
|
|
6009
|
+
[this.props.dataSourceName]: [record]
|
|
6010
|
+
} : [record]);
|
|
5705
6011
|
}
|
|
5706
|
-
const layout = column.labelProps?.layout === undefined ? this.props.labelProps?.layout : column.labelProps?.layout;
|
|
5707
|
-
const labelStyle = column.labelProps?.style ?? this.props.labelProps?.style ?? {};
|
|
5708
|
-
return /*#__PURE__*/React__default["default"].createElement(StyledColumn, {
|
|
5709
|
-
$layout: layout,
|
|
5710
|
-
$hasLabel: label != null,
|
|
5711
|
-
key: `f${index}`,
|
|
5712
|
-
style: _style,
|
|
5713
|
-
className: 'jr-column',
|
|
5714
|
-
$labelWidth: column.labelProps?.width ?? this.props.labelProps?.width ?? '120px',
|
|
5715
|
-
$valueWidth: column.valueProps?.width ?? this.props.valueProps?.width ?? '1fr'
|
|
5716
|
-
}, label != null && /*#__PURE__*/React__default["default"].createElement(StyledColumnLabel, {
|
|
5717
|
-
style: labelStyle,
|
|
5718
|
-
$required: required,
|
|
5719
|
-
className: 'label',
|
|
5720
|
-
$layout: layout,
|
|
5721
|
-
$colon: column.labelProps?.colon === undefined ? this.colon : column.labelProps?.colon
|
|
5722
|
-
}, label), content, this.props.debugMode && /*#__PURE__*/React__default["default"].createElement(StyledColumnFooter, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5723
|
-
className: "left"
|
|
5724
|
-
}, /*#__PURE__*/React__default["default"].createElement(ColumnMessage, {
|
|
5725
|
-
value: this.getValidateValue(_parentName.join('.')),
|
|
5726
|
-
record: this.getValue()
|
|
5727
|
-
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5728
|
-
className: "right"
|
|
5729
|
-
}))
|
|
5730
|
-
// validateValue?.[name]!==undefined && <StyledColumnFooter $layout={layout}>
|
|
5731
|
-
// {/* {validateValue?.[name]?.$message} */}
|
|
5732
|
-
// <ColumnMessage value={validateValue?.[name]}/>
|
|
5733
|
-
// </StyledColumnFooter>
|
|
5734
|
-
);
|
|
5735
6012
|
}
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
});
|
|
6013
|
+
noData() {
|
|
6014
|
+
const data = this.getDataSource();
|
|
6015
|
+
return data == null || data.length == 0;
|
|
5740
6016
|
}
|
|
6017
|
+
//------------------------------------------------------------------------------------
|
|
5741
6018
|
renderMe() {
|
|
5742
|
-
return /*#__PURE__*/React__default["default"].createElement(
|
|
5743
|
-
className: 'jr-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
6019
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledJRTable, {
|
|
6020
|
+
className: `${this.props.className ?? ''} jr-table ${this.props.onRowClick ? 'row-highlightable' : ''}`
|
|
6021
|
+
}, /*#__PURE__*/React__default["default"].createElement("table", {
|
|
6022
|
+
className: 'jr-table-table'
|
|
6023
|
+
}, /*#__PURE__*/React__default["default"].createElement(TBodies, {
|
|
6024
|
+
table: this,
|
|
6025
|
+
leafColumns: this.state.leafColumns,
|
|
6026
|
+
groupHeader: this.props.groupHeader,
|
|
6027
|
+
groupFooter: this.props.groupFooter,
|
|
6028
|
+
dataSource: this.getDataSource(),
|
|
6029
|
+
onRowClick: this.props.onRowClick
|
|
6030
|
+
}), /*#__PURE__*/React__default["default"].createElement(TFoot, {
|
|
6031
|
+
columns: this.props.footColumns,
|
|
6032
|
+
table: this
|
|
6033
|
+
}), /*#__PURE__*/React__default["default"].createElement(THead, {
|
|
6034
|
+
columns: this.state.columns,
|
|
6035
|
+
leafColumns: this.state.leafColumns,
|
|
6036
|
+
table: this
|
|
6037
|
+
})), this.noData() && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6038
|
+
className: 'empty'
|
|
6039
|
+
}));
|
|
5751
6040
|
}
|
|
5752
|
-
|
|
5753
|
-
// render(){
|
|
5754
|
-
// return this.renderMe()
|
|
5755
|
-
// }
|
|
5756
6041
|
}
|
|
5757
6042
|
|
|
6043
|
+
// export const FTable=JRFrameHOC(JRTable)
|
|
6044
|
+
// export const WTable=JRWindowHOC(JRTable)
|
|
6045
|
+
|
|
5758
6046
|
const StyledJRFrame = styled__default["default"].div`
|
|
5759
6047
|
display:flex;
|
|
5760
6048
|
flex:1;
|