jrs-react 1.2.14 → 1.2.16

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.js CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var styled = require('styled-components');
7
+ var client = require('react-dom/client');
7
8
 
8
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
10
 
@@ -3543,6 +3544,8 @@ class JRSubmit extends React__default["default"].Component {
3543
3544
  const fullnamList = fullname.split('.');
3544
3545
  return this.#getValueByName(fullnamList, this[this.from]?.value);
3545
3546
  } else {
3547
+ // po('ssssssssssssssssssssssssssssssssssssssssss')
3548
+ // 忘記為甚麼這樣寫了 XDD
3546
3549
  return flexType(this[this.from]?.value, this, null, null);
3547
3550
  }
3548
3551
  }
@@ -3698,7 +3701,7 @@ class JRSubmit extends React__default["default"].Component {
3698
3701
  }
3699
3702
  }
3700
3703
 
3701
- const FreeType$1 = ({
3704
+ const FreeType = ({
3702
3705
  tag: Tag,
3703
3706
  config,
3704
3707
  me,
@@ -3722,7 +3725,7 @@ const FreeType$1 = ({
3722
3725
  }, config);
3723
3726
  }
3724
3727
  };
3725
- const StyledJRFrame$1 = styled__default["default"].div`
3728
+ const StyledJRFrame = styled__default["default"].div`
3726
3729
  display:flex;
3727
3730
  flex:1;
3728
3731
  overflow:hidden;
@@ -3765,36 +3768,36 @@ const StyledJRFrame$1 = styled__default["default"].div`
3765
3768
  `;
3766
3769
  class JRFrame extends JRSubmit {
3767
3770
  renderer() {
3768
- return /*#__PURE__*/React__default["default"].createElement(StyledJRFrame$1, {
3771
+ return /*#__PURE__*/React__default["default"].createElement(StyledJRFrame, {
3769
3772
  id: this.props.id,
3770
3773
  style: this.props.style,
3771
3774
  className: `${this.props.className} jr-frame`
3772
- }, /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
3775
+ }, /*#__PURE__*/React__default["default"].createElement(FreeType, {
3773
3776
  tag: "div",
3774
3777
  config: this.props.start,
3775
3778
  me: this,
3776
3779
  className: 'start'
3777
- }), /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
3780
+ }), /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(FreeType, {
3778
3781
  tag: "header",
3779
3782
  config: this.props.top,
3780
3783
  me: this
3781
- }), /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
3784
+ }), /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(FreeType, {
3782
3785
  tag: "div",
3783
3786
  config: this.props.left,
3784
3787
  me: this,
3785
3788
  className: 'left'
3786
3789
  }), /*#__PURE__*/React__default["default"].createElement("main", {
3787
3790
  className: 'body'
3788
- }, this.renderMe?.() ?? this.props.children), /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
3791
+ }, this.renderMe?.() ?? this.props.children), /*#__PURE__*/React__default["default"].createElement(FreeType, {
3789
3792
  tag: "div",
3790
3793
  config: this.props.right,
3791
3794
  me: this,
3792
3795
  className: 'right'
3793
- })), /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
3796
+ })), /*#__PURE__*/React__default["default"].createElement(FreeType, {
3794
3797
  tag: "footer",
3795
3798
  config: this.props.bottom,
3796
3799
  me: this
3797
- })), /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
3800
+ })), /*#__PURE__*/React__default["default"].createElement(FreeType, {
3798
3801
  tag: "div",
3799
3802
  config: this.props.end,
3800
3803
  me: this,
@@ -3803,1291 +3806,1502 @@ class JRFrame extends JRSubmit {
3803
3806
  }
3804
3807
  }
3805
3808
 
3806
- const StyledSlider$1 = styled__default["default"].div`
3807
- position: absolute;
3808
- top: 0;
3809
- right: 0;
3810
- height:100%;
3811
- width:6px;
3809
+ var _path;
3810
+ function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
3811
+ var SvgX = function SvgX(props) {
3812
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
3813
+ xmlns: "http://www.w3.org/2000/svg",
3814
+ width: 24,
3815
+ height: 24,
3816
+ fill: "none",
3817
+ stroke: "currentColor",
3818
+ strokeLinecap: "round",
3819
+ strokeLinejoin: "round",
3820
+ strokeWidth: 2,
3821
+ viewBox: "0 0 24 24"
3822
+ }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
3823
+ d: "M18 6 6 18M6 6l12 12"
3824
+ })));
3825
+ };
3826
+
3827
+ function JRButton({
3828
+ icon,
3829
+ children,
3830
+ ...props
3831
+ }) {
3832
+ return /*#__PURE__*/React__default["default"].createElement("button", props, icon, children);
3833
+ }
3834
+
3835
+ const StyledTitle = styled__default["default"].div`
3836
+ overflow: hidden;
3837
+ display: flex;
3838
+ border-radius: var(--jr-window-radius) var(--jr-window-radius) 0 0;
3839
+ background:#464646;
3840
+ color: white;
3841
+ display: flex;
3842
+ align-items: center;
3843
+ min-height: min-content;
3844
+ XX&:active{
3845
+ cursor: grabbing;
3846
+ }
3847
+
3848
+ -webkit-user-select: none;
3849
+ -khtml-user-select: none;
3850
+ -moz-user-select: none;
3851
+ -o-user-select: none;
3812
3852
  user-select: none;
3813
- &.resizing:hover,&.resizing{
3814
- border-right:1px dashed black;
3853
+
3854
+ > .title{
3855
+
3856
+ flex: 1;
3857
+ padding:2px 0 2px 8px;
3858
+ text-overflow: ellipsis;
3859
+ overflow: hidden;
3860
+ white-space: nowrap;
3815
3861
  }
3816
- &:hover{
3817
- cursor: col-resize;
3818
- border-right:1px dashed gray;
3862
+ > nav{
3863
+ display: flex;
3864
+ align-items: anchor-center;
3865
+
3866
+
3867
+ >button{
3868
+ outline: unset;
3869
+ display:flex;
3870
+ align-items: center;
3871
+ justify-content: center;
3872
+ border: unset;
3873
+ background: unset;
3874
+ cursor: pointer;
3875
+ width:32px;
3876
+ height:32px;
3877
+ xborder:1px solid green;
3878
+ padding: 0;
3879
+ margin: 0;
3880
+ &:hover{
3881
+ background: #bbbbbb;
3882
+ color:white;
3883
+ }
3884
+ >svg{
3885
+ color:#bababa;
3886
+ width:14px;
3887
+ height:14px;
3888
+ cursor: pointer;
3889
+ stroke-width: 3;
3890
+ }
3891
+ }
3892
+ >button.danger:hover{
3893
+ background: red;
3894
+ >svg{
3895
+ color:white;
3896
+ }
3897
+ }
3819
3898
  }
3820
3899
  `;
3821
- class Slider$1 extends React__default["default"].Component {
3822
- constructor() {
3823
- super();
3824
- this.sliderRef = /*#__PURE__*/React__default["default"].createRef();
3825
- }
3900
+ class TitleBar extends React__default["default"].Component {
3901
+ pos1 = 0;
3902
+ pos2 = 0;
3903
+ pos3 = 0;
3904
+ pos4 = 0;
3905
+ x = 0;
3906
+ y = 0;
3907
+ remember = e => {
3908
+ po('remember');
3909
+ const {
3910
+ clientX,
3911
+ clientY
3912
+ } = e;
3913
+ const {
3914
+ x,
3915
+ y,
3916
+ width,
3917
+ height
3918
+ } = this.props.windowRef.current.getBoundingClientRect();
3919
+ this.props.window.orgHeight = height;
3920
+ this.props.window.orgWidth = width;
3921
+ this.props.window.orgTop = y;
3922
+ this.props.window.orgLeft = x;
3923
+ this.props.window.orgXd = clientX - x;
3924
+ this.props.window.orgBodyOverflow = document.body.style.overflow;
3925
+ };
3926
+ adjustScreen = e => {
3927
+ po('double click adjustScreen');
3928
+ e.preventDefault();
3929
+ const {
3930
+ x,
3931
+ y,
3932
+ width,
3933
+ height
3934
+ } = this.props.windowRef.current.getBoundingClientRect();
3935
+ if (y > 1 - this.props.thick) {
3936
+ this.remember(e);
3937
+ this.fullScreen(e);
3938
+ } else {
3939
+ this.floatScreen(e);
3940
+ }
3941
+ };
3942
+ floatScreen = e => {
3943
+ po('floatScreen');
3944
+ this.props.windowRef.current;
3945
+ this.props.windowRef.current.style.transition = 'var(--transition-x-y), left .05s ease-in';
3946
+ this.props.windowRef.current.style.left = `${this.props.window.orgLeft}px`;
3947
+ this.props.windowRef.current.style.top = `${this.props.window.orgTop}px`;
3948
+ this.props.windowRef.current.style.width = `${this.props.window.orgWidth}px`;
3949
+ this.props.windowRef.current.style.height = `${this.props.window.orgHeight}px`;
3950
+ document.body.style.overflow = this.props.window.orgBodyOverflow;
3951
+ };
3952
+ fullScreen = e => {
3953
+ po('fullScreen', this.props.thick);
3954
+ this.props.windowRef.current.style.transition = 'var(--transition-x-y), left .05s ease-in';
3955
+ this.props.windowRef.current.style.left = `${-this.props.thick}px`;
3956
+ this.props.windowRef.current.style.top = `${-this.props.thick}px`;
3957
+ this.props.windowRef.current.style.width = `calc(100vw + ${this.props.thick * 2}px)`; //`${window.innerWidth+(this.props.thick*2)}px`
3958
+ this.props.windowRef.current.style.height = `calc(100vh + ${this.props.thick * 2}px)`; //`${window.innerHeight+(this.props.thick*2)}px`
3959
+
3960
+ setTimeout(() => {
3961
+ document.body.style.overflow = 'hidden';
3962
+ this.props.windowRef.current.style.transition = 'unset';
3963
+ }, 50);
3964
+ };
3826
3965
  stop = e => {
3827
- this.sliderRef.current.classList.remove('resizing');
3966
+ po('stop');
3967
+ e.preventDefault();
3968
+ if (this.moved) {
3969
+ const {
3970
+ height: titleBarHeight
3971
+ } = this.props.titleBarRef.current.getBoundingClientRect();
3972
+ const {
3973
+ x,
3974
+ y,
3975
+ width,
3976
+ height
3977
+ } = this.props.windowRef.current.getBoundingClientRect();
3978
+ if (y < 1 - this.props.thick) this.fullScreen(e);
3979
+ if (y > window.innerHeight - titleBarHeight) this.props.windowRef.current.style.top = `${window.innerHeight - titleBarHeight}px`;
3980
+ if (x + width - this.props.thick < 0) this.props.windowRef.current.style.left = 0;
3981
+ if (x > window.innerWidth) this.props.windowRef.current.style.left = `${window.innerWidth - width}px`;
3982
+ }
3828
3983
  document.body.style.cursor = 'default';
3829
3984
  window.removeEventListener('mousemove', this.move);
3830
3985
  window.removeEventListener('mouseup', this.stop);
3986
+ window.removeEventListener('mousemove', this.preMove);
3831
3987
  };
3832
- move = ({
3833
- clientX
3834
- }) => {
3835
- const {
3836
- th,
3837
- selectedCols,
3838
- widthRates
3839
- } = this.data;
3988
+ move = e => {
3989
+ po('move');
3990
+ e.preventDefault();
3991
+ this.moved = true;
3840
3992
  const {
3841
- left
3842
- } = th.getBoundingClientRect();
3843
- const min = left + 10;
3844
- const x = clientX >= min ? clientX : min;
3845
- const width = x - left;
3846
- selectedCols.forEach((col, index) => {
3847
- const _width = Math.round(width / 100 * widthRates[index]);
3848
- col.style.width = _width + 'px';
3849
- });
3850
- };
3851
- start(thPRef, column) {
3852
- const selectedCols = [...this.props.table.colGroupRef.current.children].slice(column.columnNo, column.columnNo + (column.colSpan ?? 1));
3853
- const totalWidth = selectedCols.reduce((aco, {
3854
- offsetWidth
3855
- }) => aco + offsetWidth, 0);
3856
- const widthRates = selectedCols.map(({
3857
- offsetWidth
3858
- }) => {
3859
- return 100 * (offsetWidth / totalWidth);
3860
- });
3861
- this.data = {
3862
- selectedCols,
3863
- th: thPRef.current,
3864
- widthRates
3865
- };
3866
- this.sliderRef.current.classList.add('resizing');
3867
- document.body.style.cursor = 'col-resize';
3868
- window.addEventListener('mousemove', this.move);
3869
- window.addEventListener('mouseup', this.stop);
3870
- }
3871
- render() {
3872
- const column = this.props.column;
3873
- return /*#__PURE__*/React__default["default"].createElement(StyledSlider$1, {
3874
- ref: this.sliderRef,
3875
- onMouseDown: e => {
3876
- this.start(this.props.thRef, column);
3877
- }
3878
- });
3879
- }
3880
- }
3993
+ clientX,
3994
+ clientY
3995
+ } = e;
3996
+ const y = clientY < 1 ? 0 : clientY;
3997
+ this.pos1 = this.pos3 - clientX;
3998
+ this.pos2 = this.pos4 - y;
3999
+ this.pos3 = clientX;
4000
+ this.pos4 = y;
4001
+ const w = this.props.windowRef.current;
4002
+ this.y = w.offsetTop - this.pos2;
4003
+ this.x = w.offsetLeft - this.pos1;
3881
4004
 
3882
- const Colgroup = ({
3883
- leafColumns,
3884
- colGroupRef
3885
- }) => {
3886
- return /*#__PURE__*/React__default["default"].createElement("colgroup", {
3887
- ref: colGroupRef
3888
- }, leafColumns?.map((_column, index) => {
3889
- const {
3890
- width,
3891
- ...column
3892
- } = _column;
3893
- const style = {
3894
- width
3895
- };
3896
- return /*#__PURE__*/React__default["default"].createElement("col", {
3897
- style: style,
3898
- key: index
3899
- });
3900
- }));
3901
- };
3902
- const Ths$1 = ({
3903
- deep,
3904
- rowColumn,
3905
- rowIndex,
3906
- table
3907
- }) => {
3908
- return rowColumn?.map((column, colIndex) => {
3909
- const thRef = /*#__PURE__*/React__default["default"].createRef();
3910
- return /*#__PURE__*/React__default["default"].createElement("th", {
3911
- key: colIndex,
3912
- ref: thRef,
3913
- colSpan: column.colSpan,
3914
- rowSpan: column.rowSpan ?? (column.isLeaf && deep > rowIndex ? deep - rowIndex + 1 : null)
3915
- }, flexType(column.label, table), (table.props.resizableColumns === undefined || table.props.resizableColumns) && /*#__PURE__*/React__default["default"].createElement(Slider$1, {
3916
- table: table,
3917
- thRef: thRef,
3918
- column: column
3919
- }));
3920
- });
3921
- };
3922
- const HeadTrs = ({
3923
- columns: _columns,
3924
- trClassName,
3925
- table
3926
- }) => {
3927
- const columns = Array.isArray(_columns?.[0]) ? _columns : [_columns];
3928
- return columns?.map((rowColumn, rowIndex) => {
3929
- return /*#__PURE__*/React__default["default"].createElement("tr", {
3930
- className: trClassName,
3931
- key: rowIndex
3932
- }, /*#__PURE__*/React__default["default"].createElement(Ths$1, {
3933
- deep: columns.length - 1,
3934
- rowColumn: rowColumn,
3935
- rowIndex: rowIndex,
3936
- table: table
3937
- }));
3938
- });
3939
- };
3940
- const THead = ({
3941
- columns,
3942
- leafColumns,
3943
- table
3944
- }) => {
3945
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("thead", null, /*#__PURE__*/React__default["default"].createElement(HeadTrs, {
3946
- columns: columns,
3947
- table: table
3948
- })), /*#__PURE__*/React__default["default"].createElement(Colgroup, {
3949
- leafColumns: leafColumns,
3950
- colGroupRef: table.colGroupRef
3951
- }));
3952
- };
3953
- const FootThs = ({
3954
- table,
3955
- groupData,
3956
- groupIndex,
3957
- deep,
3958
- columns,
3959
- rowIndex
3960
- }) => {
3961
- return columns?.map((column, colIndex) => {
3962
- // let content
3963
- // if(type){
3964
- // content='type'
3965
- // }else if(render){
3966
-
3967
- // content=render?.bind(table)({groupData,groupIndex,ths:111})
3968
- // }else{
3969
- // content=column.label
4005
+ // if(this.props.window.orgWidth){
4006
+ // w.style.width=`${this.props.window.orgWidth}px`
4007
+ // this.props.window.orgWidth=null
3970
4008
  // }
3971
- let style = flexType(column.style, table, {}, {});
3972
- const content = whatType(column, table, column.label);
3973
- return /*#__PURE__*/React__default["default"].createElement("th", {
3974
- style: style,
3975
- colSpan: column.colSpan,
3976
- rowSpan: column.rowSpan
3977
- }, content);
3978
- });
3979
- };
3980
- const TFoot = ({
3981
- table,
3982
- columns
3983
- }) => {
3984
- const trs = columns?.map((rowColumn, rowIndex) => {
3985
- return /*#__PURE__*/React__default["default"].createElement("tr", {
3986
- key: rowIndex
3987
- }, /*#__PURE__*/React__default["default"].createElement(FootThs, {
3988
- columns: rowColumn,
3989
- table: table
3990
- }));
3991
- });
3992
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("tfoot", null, trs));
3993
- };
3994
-
3995
- function _extends$1() {
3996
- return _extends$1 = Object.assign ? Object.assign.bind() : function (n) {
3997
- for (var e = 1; e < arguments.length; e++) {
3998
- var t = arguments[e];
3999
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
4000
- }
4001
- return n;
4002
- }, _extends$1.apply(null, arguments);
4003
- }
4004
-
4005
- styled__default["default"].tbody`
4006
- th{
4007
- height:4px;
4008
- background:#c6c6c6;
4009
- }
4010
- `;
4011
-
4012
- ////////////////////////////////////////////////////////////////////////////
4013
4009
 
4014
- const Ths = ({
4015
- table,
4016
- groupData,
4017
- groupIndex,
4018
- deep,
4019
- rowColumn,
4020
- rowIndex
4021
- }) => {
4022
- return rowColumn?.map(({
4023
- style: _style,
4024
- align,
4025
- type,
4026
- render,
4027
- ...column
4028
- }, colIndex) => {
4029
- const style = flexType(_style, table, {}, {});
4030
- let content;
4031
- if (type) {
4032
- content = 'type';
4033
- } else if (render) {
4034
- content = render?.bind(table)({
4035
- groupData,
4036
- groupIndex,
4037
- ths: 111
4038
- });
4010
+ this.y = this.y < -this.props.thick ? -this.props.thick : this.y;
4011
+ w.style.transition = 'unset';
4012
+ w.style.top = `${this.y}px`;
4013
+ w.style.left = `${this.x}px`;
4014
+ };
4015
+ preMove = e => {
4016
+ console.clear();
4017
+ po('preMove');
4018
+ const w = this.props.windowRef.current;
4019
+ const {
4020
+ clientX,
4021
+ clientY,
4022
+ ...oe
4023
+ } = e;
4024
+ po('e', e);
4025
+ const {
4026
+ x,
4027
+ y,
4028
+ width,
4029
+ height
4030
+ } = w.getBoundingClientRect();
4031
+ po('width', width);
4032
+ if (y <= -this.props.thick) ;
4033
+ w.style.transition = 'left .05s ease-in, height .05s ease-in';
4034
+ if (y <= 0) {
4035
+ // contt browserWidth=
4036
+ const w1 = window.innerWidth - this.props.thick * 2;
4037
+ const x1 = clientX;
4038
+ const w2 = this.props.window.orgWidth - 32;
4039
+ const x2 = x1 / w1 * w2;
4040
+ // po('xp' , x2)
4041
+ w.style.left = `${clientX - x2}px`;
4042
+ w.style.width = `${this.props.window.orgWidth}px`;
4043
+ w.style.height = `${this.props.window.orgHeight}px`;
4039
4044
  } else {
4040
- content = column.label;
4045
+ this.remember(e);
4041
4046
  }
4042
- // style.textAlign=align
4043
- return /*#__PURE__*/React__default["default"].createElement("th", {
4044
- key: colIndex,
4045
- style: {
4046
- textAlign: align,
4047
- ...style
4047
+ document.body.style.cursor = 'grabbing';
4048
+ document.body.style.overflow = this.props.window.orgBodyOverflow;
4049
+ setTimeout(() => {
4050
+ window.addEventListener('mousemove', this.move);
4051
+ }, 50);
4052
+ window.removeEventListener('mousemove', this.preMove);
4053
+ };
4054
+ start(e) {
4055
+ po('start');
4056
+ e.preventDefault();
4057
+ this.moved = false;
4058
+ this.pos3 = e.clientX;
4059
+ this.pos4 = e.clientY;
4060
+ this.props.windowRef.current.style.transition = 'var(--transition-x-y)';
4061
+ window.addEventListener('mousemove', this.preMove);
4062
+ window.addEventListener('mouseup', this.stop);
4063
+ }
4064
+ onDoubleClick() {
4065
+ po('onDoubleClick');
4066
+ }
4067
+ render() {
4068
+ return /*#__PURE__*/React__default["default"].createElement(StyledTitle, {
4069
+ ref: this.props.titleBarRef,
4070
+ draggable: "false",
4071
+ onMouseDown: e => {
4072
+ this.start(e);
4048
4073
  },
4049
- colSpan: column.colSpan,
4050
- rowSpan: column.isLeaf && deep > rowIndex ? deep - rowIndex + 1 : null
4051
- }, content);
4052
- });
4053
- };
4054
- const GroupColumns = ({
4055
- table,
4056
- columns: _columns,
4057
- trClassName,
4058
- groupData,
4059
- tbodyIndex
4060
- }) => {
4061
- const columns = Array.isArray(_columns?.[0]) ? _columns : [_columns];
4062
- return columns?.map((rowColumn, rowIndex) => {
4063
- return /*#__PURE__*/React__default["default"].createElement("tr", {
4064
- className: trClassName,
4065
- key: rowIndex
4066
- }, /*#__PURE__*/React__default["default"].createElement(Ths, {
4067
- table: table,
4068
- groupData: groupData,
4069
- groupIndex: tbodyIndex,
4070
- deep: columns.length - 1,
4071
- rowColumn: rowColumn,
4072
- rowIndex: rowIndex
4073
- }));
4074
- });
4075
- };
4076
- styled__default["default"].tr`
4077
- z-index: 1;
4078
- XXposition: sticky;
4079
- XXtop: 50px;
4080
- th{
4081
- text-align: left;
4082
- border:1px solid #222222;
4083
- }
4084
- `;
4085
- const GroupHeader = props => {
4086
- return /*#__PURE__*/React__default["default"].createElement(GroupColumns, _extends$1({
4087
- trClassName: 'jr-group-header'
4088
- }, props));
4089
- };
4090
- styled__default["default"].tr`
4091
- th{
4092
- border:1px solid #222222;
4093
- text-align: left;
4094
- }
4095
- `;
4096
- const GroupFooter = props => {
4097
- return /*#__PURE__*/React__default["default"].createElement(GroupColumns, _extends$1({
4098
- trClassName: 'jr-group-footer'
4099
- }, props));
4100
- };
4074
+ onDoubleClick: this.adjustScreen
4075
+ }, /*#__PURE__*/React__default["default"].createElement(FreeType, {
4076
+ tag: "div",
4077
+ config: this.props.title ?? '',
4078
+ me: this.props.window,
4079
+ className: 'title'
4080
+ }), /*#__PURE__*/React__default["default"].createElement("nav", null, this.props.window.props.setOpen ? /*#__PURE__*/React__default["default"].createElement(JRButton, {
4081
+ icon: /*#__PURE__*/React__default["default"].createElement(SvgX, null),
4082
+ className: 'danger',
4083
+ onClick: e => {
4084
+ e.stopPropagation();
4085
+ if (this.props.window.orgBodyOverflow != null) {
4086
+ document.body.style.overflow = this.props.window.orgBodyOverflow;
4087
+ }
4088
+ this.props.window.props.setOpen(false);
4089
+ },
4090
+ onMouseDown: e => {
4091
+ e.stopPropagation();
4092
+ }
4093
+ }) : null));
4094
+ }
4095
+ }
4101
4096
 
4102
- ////////////////////////////////////////////////////////////////////////////
4103
- const Td = ({
4104
- column: _column,
4105
- record,
4106
- tbodyIndex,
4107
- trIndex,
4108
- tdIndex,
4109
- table
4110
- }) => {
4111
- let content;
4112
- const {
4113
- style: _style,
4114
- align,
4115
- vAlign = 'baseline',
4116
- type,
4117
- typeStyle: _typeStyle,
4118
- render,
4119
- setValue,
4120
- getValue,
4121
- onChange: _onChange,
4122
- funcProps,
4123
- ...column
4124
- } = _column;
4125
- const onChange = inputValue => {
4126
- const targetValue = inputValue?.target?.value ?? inputValue;
4127
- setValue(record, targetValue);
4128
- table.setValue(table.getValue());
4129
- };
4130
- const value = getValue(record);
4131
- let style = render ? {} : flexType(_style, table, {
4132
- value,
4133
- record
4134
- }, {});
4135
- const setStyle = _style => {
4136
- style = _style;
4137
- };
4138
- setStyle.bind(table);
4139
- render?.bind(table);
4140
- if (type) {
4141
- const typeStyle = flexType(_typeStyle, table, {
4142
- record
4143
- }, {});
4144
- content = /*#__PURE__*/React__default["default"].createElement(type, {
4145
- onChange: _onChange ? e => {
4146
- _onChange?.bind(table)(e, {
4147
- value,
4148
- onChange,
4149
- me: content
4150
- });
4151
- } : onChange,
4152
- value,
4153
- style: typeStyle,
4154
- render,
4155
- ...column,
4156
- ...funcProps?.bind(table)({
4157
- value
4158
- })
4159
- });
4160
- } else if (render) {
4161
- content = render({
4162
- index: trIndex,
4163
- groupIndex: tbodyIndex,
4164
- value,
4165
- record,
4166
- onChange,
4167
- setStyle
4168
- });
4169
- } else {
4170
- content = value;
4097
+ const directions = ['n', 'e', 's', 'w', 'nww', 'nnw', 'nne', 'nee', 'sse', 'see', 'sww', 'ssw'];
4098
+ class Sliders extends React__default["default"].Component {
4099
+ render() {
4100
+ return directions.map((direction, index) => /*#__PURE__*/React__default["default"].createElement(Slider$1, {
4101
+ direction: direction,
4102
+ thick: this.props.thick,
4103
+ windowRef: this.props.windowRef,
4104
+ window: this.props.window,
4105
+ titleBarRef: this.props.titleBarRef,
4106
+ key: index
4107
+ }));
4171
4108
  }
4172
- return /*#__PURE__*/React__default["default"].createElement("td", {
4173
- colSpan: style.colSpan,
4174
- rowSpan: style.rowSpan,
4175
- style: {
4176
- textAlign: align,
4177
- verticalAlign: vAlign,
4178
- ...style
4179
- },
4180
- key: tdIndex
4181
- }, content);
4182
- };
4183
- const Tds = ({
4184
- leafColumns,
4185
- record,
4186
- table,
4187
- tbodyIndex,
4188
- trIndex
4189
- }) => {
4190
- return leafColumns?.map((column, tdIndex) => {
4191
- return /*#__PURE__*/React__default["default"].createElement(Td, {
4192
- column: column,
4193
- key: tdIndex,
4194
- record: record,
4195
- table: table,
4196
- tbodyIndex: tbodyIndex,
4197
- trIndex: trIndex,
4198
- tdIndex: tdIndex
4199
- });
4200
- });
4201
- };
4202
- ////////////////////////////////////////////////////////////////////////////
4109
+ }
4110
+ const StyledSlider$1 = styled__default["default"].div`
4111
+ Xborder:1px solid ${({
4112
+ $direction: {
4113
+ color
4114
+ }
4115
+ }) => color};
4116
+ Xbackground:${({
4117
+ $direction: {
4118
+ color
4119
+ }
4120
+ }) => color};
4121
+ position: absolute;
4122
+ top: ${({
4123
+ $direction: {
4124
+ top
4125
+ }
4126
+ }) => top};
4127
+ bottom: ${({
4128
+ $direction: {
4129
+ bottom
4130
+ }
4131
+ }) => bottom};
4132
+ right: ${({
4133
+ $direction: {
4134
+ right
4135
+ }
4136
+ }) => right};
4137
+ left: ${({
4138
+ $direction: {
4139
+ left
4140
+ }
4141
+ }) => left};
4142
+ height: ${({
4143
+ $direction: {
4144
+ height
4145
+ }
4146
+ }) => height};
4147
+ width: ${({
4148
+ $direction: {
4149
+ width
4150
+ }
4151
+ }) => width};
4152
+ cursor: ${({
4153
+ $direction: {
4154
+ cursor
4155
+ }
4156
+ }) => cursor};
4203
4157
 
4204
- const TBody = ({
4205
- groupData,
4206
- groupHeader,
4207
- leafColumns,
4208
- groupFooter,
4209
- table,
4210
- tbodyIndex
4211
- }) => {
4212
- const neededProps = {
4213
- table,
4214
- tbodyIndex
4215
- };
4216
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("tbody", {
4217
- key: `tbody${tbodyIndex}`
4218
- }, groupData?.length > 0 && /*#__PURE__*/React__default["default"].createElement(GroupHeader, _extends$1({
4219
- groupData: groupData,
4220
- columns: groupHeader
4221
- }, neededProps)), groupData?.map?.((record, trIndex) => {
4222
- const onRowClick = table.props.onRowClick?.bind(table);
4223
- return /*#__PURE__*/React__default["default"].createElement("tr", {
4224
- key: trIndex,
4225
- onClick: () => {
4226
- onRowClick?.({
4227
- record,
4228
- index: trIndex,
4229
- groupIndex: tbodyIndex
4230
- });
4231
- }
4232
- }, /*#__PURE__*/React__default["default"].createElement(Tds, _extends$1({
4233
- record: record,
4234
- trIndex: trIndex
4235
- }, neededProps, {
4236
- leafColumns: leafColumns
4237
- })));
4238
- }), groupData?.length > 0 && /*#__PURE__*/React__default["default"].createElement(GroupFooter, _extends$1({
4239
- groupData: groupData,
4240
- columns: groupFooter
4241
- }, neededProps))));
4242
- };
4243
- const TBodies = ({
4244
- groupHeader,
4245
- leafColumns,
4246
- groupFooter,
4247
- dataSource: _dataSource,
4248
- table
4249
- }) => {
4250
- // po('--TBodies--')
4251
- const isGroupDataType = Array.isArray(_dataSource?.[0]);
4252
- const dataSource = isGroupDataType ? _dataSource : [_dataSource];
4158
+ -webkit-user-select: none;
4159
+ -khtml-user-select: none;
4160
+ -moz-user-select: none;
4161
+ -o-user-select: none;
4162
+ user-select: none;
4253
4163
 
4254
- // po('dataSource',dataSource)
4255
- return dataSource?.map((groupData, tbodyIndex, c) => {
4256
- return /*#__PURE__*/React__default["default"].createElement(TBody, {
4257
- key: `tbody${tbodyIndex}`,
4258
- table: table
4259
- // dataSource={dataSource}
4260
- // dataGroup={groupData}
4261
- ,
4262
- groupData: groupData,
4263
- tbodyIndex: tbodyIndex,
4264
- groupHeader: groupHeader,
4265
- leafColumns: leafColumns,
4266
- groupFooter: groupFooter
4267
- });
4268
- });
4269
- };
4270
-
4271
- const StyledJRTable = styled__default["default"].div`
4272
- --column-bd-color:#cccccc;
4273
- --column-b-color:#eeeeee;
4274
- --column-b-hover-color:#ffffff;
4275
-
4276
- position: relative;
4277
- background: var(--column-b-color);
4278
- border:1px solid var(--column-bd-color);
4279
-
4280
- display:flex;
4281
- flex-direction: column;
4282
- flex:1;
4283
- overflow: overlay;
4284
-
4285
-
4286
-
4287
-
4288
- &.row-highlightable{
4289
- tbody{
4290
- tr:not(.jr-group-header,.jr-group-footer):hover{
4291
- background:var(--column-b-hover-color);
4292
- cursor: pointer;
4293
- transition: background-color .8s;
4294
- td{
4295
- color:black;
4296
- transition:color .8s;
4297
- }
4298
-
4299
- }
4300
- }
4301
- }
4302
-
4303
- table{
4304
- Xheight: 100%;
4305
- min-width:100%;
4306
- width: max-content;
4307
- border-spacing: 0;
4308
-
4309
- thead{
4310
- position: sticky;
4311
- top: 0;
4312
-
4313
- th{
4314
- position: relative;
4315
- padding: 2px 6px;
4316
- background: linear-gradient(180deg, rgba(227, 227, 226, 1) 0%, rgba(255, 255, 255, 1) 25%, rgba(210, 210, 210, 1) 100%);
4317
- box-shadow: 2px 2px 2px 0 #ffffffd6 inset, -1px -1px 2px 0px #8a847dbf inset;
4318
- color: #525252;
4319
- white-space: nowrap;
4320
- }
4321
- }
4322
-
4323
- tfoot{
4324
- position: sticky;
4325
- bottom: -1px;
4326
-
4327
- Xtr:nth-child(1){
4328
- th{
4329
- Xborder-top:1px solid var(--column-bd-color);
4330
- }
4331
- }
4332
- Xth:nth-child(1){
4333
- Xborder-left:1px solid var(--column-bd-color);
4334
- }
4335
-
4336
- th{
4337
- height:32px;
4338
- padding: 4px;
4339
- background: #e4e4e4;
4340
- xbackground: linear-gradient(180deg, rgba(227, 227, 226, 1) 0%, rgba(255, 255, 255, 1) 25%, rgba(210, 210, 210, 1) 100%);
4341
- xbox-shadow: 2px 2px 2px 0 #ffffffd6 inset, -1px -1px 2px 0px #8a847dbf inset;
4342
- color: #525252;
4343
- white-space: nowrap;
4344
-
4345
- border-left:2px solid #f4f4f4;
4346
- border-top:2px solid #f4f4f4;
4347
- border-right:2px solid var(--column-bd-color);
4348
- border-bottom:2px solid var(--column-bd-color);
4349
- }
4350
- }
4351
-
4352
- tbody{
4353
- tr{
4354
- transition: background .3s linear;
4355
- background:var(--column-b-color);
4356
- a:#ededed;
4357
- th{
4358
- color:#444444;
4359
- }
4360
- td{
4361
- border-bottom: 1px solid var(--column-bd-color);
4362
- color:#2e2e2e;
4363
- padding: 4px;
4364
- }
4365
- }
4366
- tr:hover{
4367
- background:var(--column-b-hover-color);
4368
-
4369
- }
4370
-
4371
- tr.jr-group-header
4372
- ,tr.jr-group-footer{
4373
- text-align:left;
4374
- background:#dddbdb;
4375
-
4376
- th{
4377
- border-bottom: 1px solid var(--column-bd-color);
4378
- border-right: 1px solid var(--column-bd-color);
4379
- padding: 4px 8px;
4380
- }
4381
- }
4382
- }
4383
- tbody.empty-tbody{
4384
- td{
4385
- border:10px solid red;
4386
- }
4387
- }
4388
- }
4389
-
4390
-
4391
-
4392
-
4393
- > .empty{
4394
- user-select: none;
4395
- color:#848484;
4396
- height:100%;
4397
- flex:1;
4398
- display:flex;
4399
- justify-content: center;
4400
- align-items: center;
4401
-
4402
-
4403
- }
4404
-
4405
- > .empty::after{
4406
- content:'無資料';
4407
- position: block;
4164
+ `;
4165
+ class Slider$1 extends React__default["default"].Component {
4166
+ width = '3px';
4167
+ borderWidth = 'px';
4168
+ borderLong = 5;
4169
+ constructor(props) {
4170
+ super(props);
4171
+ this.sliderRef = /*#__PURE__*/React__default["default"].createRef();
4172
+ }
4173
+ directions = {
4174
+ n: {
4175
+ top: 0,
4176
+ color: 'red',
4177
+ width: '100%',
4178
+ height: `${this.props.thick}px`,
4179
+ cursor: 'n-resize',
4180
+ resize: props => {
4181
+ this.resizeN(props);
4182
+ }
4183
+ },
4184
+ e: {
4185
+ color: 'yellow',
4186
+ right: 0,
4187
+ width: `${this.props.thick}px`,
4188
+ height: '100%',
4189
+ cursor: 'e-resize',
4190
+ resize: props => {
4191
+ this.resizeE(props);
4192
+ }
4193
+ },
4194
+ s: {
4195
+ color: 'blue',
4196
+ bottom: 0,
4197
+ width: '100%',
4198
+ height: `${this.props.thick}px`,
4199
+ cursor: 's-resize',
4200
+ resize: props => {
4201
+ this.resizeS(props);
4202
+ }
4203
+ },
4204
+ w: {
4205
+ color: 'green',
4206
+ left: 0,
4207
+ width: `${this.props.thick}px`,
4208
+ height: '100%',
4209
+ cursor: 'w-resize',
4210
+ resize: props => {
4211
+ this.resizeW(props);
4212
+ }
4213
+ },
4214
+ nw: {
4215
+ top: 0,
4216
+ left: 0,
4217
+ color: 'blue',
4218
+ width: `${this.borderLong}px`,
4219
+ height: `${this.borderLong}px`,
4220
+ cursor: 'nw-resize',
4221
+ resize: props => {
4222
+ this.resizeN(props);
4223
+ this.resizeW(props);
4224
+ }
4225
+ },
4226
+ nww: {
4227
+ top: 0,
4228
+ left: 0,
4229
+ color: 'blue',
4230
+ width: `${this.props.thick + this.borderLong}px`,
4231
+ height: `${this.props.thick}px`,
4232
+ cursor: 'nw-resize',
4233
+ resize: props => {
4234
+ this.resizeN(props);
4235
+ this.resizeW(props);
4236
+ }
4237
+ },
4238
+ nnw: {
4239
+ top: 0,
4240
+ left: 0,
4241
+ color: 'blue',
4242
+ width: `${this.props.thick}px`,
4243
+ height: `${this.props.thick + this.borderLong}px`,
4244
+ cursor: 'nw-resize',
4245
+ resize: props => {
4246
+ this.resizeN(props);
4247
+ this.resizeW(props);
4248
+ }
4249
+ },
4250
+ nne: {
4251
+ top: 0,
4252
+ right: 0,
4253
+ color: 'green',
4254
+ width: `${this.props.thick + this.borderLong}px`,
4255
+ height: `${this.props.thick}px`,
4256
+ cursor: 'ne-resize',
4257
+ resize: props => {
4258
+ this.resizeN(props);
4259
+ this.resizeE(props);
4260
+ }
4261
+ },
4262
+ nee: {
4263
+ top: 0,
4264
+ right: 0,
4265
+ color: 'green',
4266
+ width: `${this.props.thick}px`,
4267
+ height: `${this.props.thick + this.borderLong}px`,
4268
+ cursor: 'ne-resize',
4269
+ resize: props => {
4270
+ this.resizeN(props);
4271
+ this.resizeE(props);
4272
+ }
4273
+ },
4274
+ sse: {
4275
+ color: 'red',
4276
+ right: 0,
4277
+ bottom: 0,
4278
+ width: `${this.props.thick + this.borderLong}px`,
4279
+ height: `${this.props.thick}px`,
4280
+ cursor: 'se-resize',
4281
+ resize: props => {
4282
+ this.resizeS(props);
4283
+ this.resizeE(props);
4284
+ }
4285
+ },
4286
+ see: {
4287
+ color: 'red',
4288
+ right: 0,
4289
+ bottom: 0,
4290
+ width: `${this.props.thick}px`,
4291
+ height: `${this.props.thick + this.borderLong}px`,
4292
+ cursor: 'se-resize',
4293
+ resize: props => {
4294
+ this.resizeS(props);
4295
+ this.resizeE(props);
4296
+ }
4297
+ },
4298
+ ssw: {
4299
+ color: 'yellow',
4300
+ bottom: 0,
4301
+ left: 0,
4302
+ width: `${this.props.thick + this.borderLong}px`,
4303
+ height: `${this.props.thick}px`,
4304
+ cursor: 'sw-resize',
4305
+ resize: props => {
4306
+ this.resizeS(props);
4307
+ this.resizeW(props);
4308
+ }
4309
+ },
4310
+ sww: {
4311
+ color: 'yellow',
4312
+ bottom: 0,
4313
+ left: 0,
4314
+ width: `${this.props.thick}px`,
4315
+ height: `${this.props.thick + this.borderLong}px`,
4316
+ cursor: 'sw-resize',
4317
+ resize: props => {
4318
+ this.resizeS(props);
4319
+ this.resizeW(props);
4320
+ }
4408
4321
  }
4409
-
4410
- `;
4411
-
4412
- var _path;
4413
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4414
- var SvgX = function SvgX(props) {
4415
- return /*#__PURE__*/React__namespace.createElement("svg", _extends({
4416
- xmlns: "http://www.w3.org/2000/svg",
4417
- width: 24,
4418
- height: 24,
4419
- fill: "none",
4420
- stroke: "currentColor",
4421
- strokeLinecap: "round",
4422
- strokeLinejoin: "round",
4423
- strokeWidth: 2,
4424
- viewBox: "0 0 24 24"
4425
- }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
4426
- d: "M18 6 6 18M6 6l12 12"
4427
- })));
4428
- };
4429
-
4430
- function JRButton({
4431
- icon,
4432
- children,
4433
- ...props
4434
- }) {
4435
- return /*#__PURE__*/React__default["default"].createElement("button", props, icon, children);
4436
- }
4437
-
4438
- const StyledTitle = styled__default["default"].div`
4439
- overflow: hidden;
4440
- display: flex;
4441
- border-radius: var(--jr-window-radius) var(--jr-window-radius) 0 0;
4442
- background:#464646;
4443
- color: white;
4444
- display: flex;
4445
- align-items: center;
4446
- min-height: min-content;
4447
- XX&:active{
4448
- cursor: grabbing;
4322
+ };
4323
+ resizeN = ({
4324
+ window,
4325
+ cursorY,
4326
+ startY,
4327
+ startHeight,
4328
+ titleBarHeight
4329
+ }) => {
4330
+ let y = cursorY - this.props.thick;
4331
+ if (y < 0) y = 0;
4332
+ let height = startHeight + (startY - y);
4333
+ if (height < titleBarHeight + this.props.thick * 2) {
4334
+ height = titleBarHeight + this.props.thick * 2;
4335
+ y = startY + startHeight - titleBarHeight - this.props.thick * 2;
4449
4336
  }
4450
-
4451
- -webkit-user-select: none;
4452
- -khtml-user-select: none;
4453
- -moz-user-select: none;
4454
- -o-user-select: none;
4455
- user-select: none;
4456
-
4457
- > .title{
4458
-
4459
- flex: 1;
4460
- padding:2px 0 2px 8px;
4461
- text-overflow: ellipsis;
4462
- overflow: hidden;
4463
- white-space: nowrap;
4337
+ window.style.top = `${y}px`;
4338
+ window.style.height = `${height}px`;
4339
+ };
4340
+ resizeE = ({
4341
+ window,
4342
+ clientX,
4343
+ left,
4344
+ titleBarHeight
4345
+ }) => {
4346
+ let width = clientX - left - this.props.thick;
4347
+ if (width < titleBarHeight) width = titleBarHeight;
4348
+ window.style.width = `${width + this.props.thick * 2}px`;
4349
+ };
4350
+ resizeS = ({
4351
+ window,
4352
+ clientY,
4353
+ top,
4354
+ titleBarHeight
4355
+ }) => {
4356
+ let height = clientY - top - this.props.thick;
4357
+ if (height < titleBarHeight) height = titleBarHeight;
4358
+ window.style.height = `${height + this.props.thick * 2}px`;
4359
+ };
4360
+ resizeW = ({
4361
+ window,
4362
+ cursorX,
4363
+ startX,
4364
+ startWidth,
4365
+ titleBarHeight
4366
+ }) => {
4367
+ let x = cursorX - this.props.thick;
4368
+ if (x < 0) x = 0;
4369
+ let width = startWidth + (startX - x);
4370
+ if (width < titleBarHeight + this.props.thick * 2) {
4371
+ width = titleBarHeight + this.props.thick * 2;
4372
+ x = startX + startWidth - titleBarHeight - this.props.thick * 2;
4464
4373
  }
4465
- > nav{
4466
- display: flex;
4467
- align-items: anchor-center;
4468
-
4469
-
4470
- >button{
4471
- outline: unset;
4472
- display:flex;
4473
- align-items: center;
4474
- justify-content: center;
4475
- border: unset;
4476
- background: unset;
4477
- cursor: pointer;
4478
- width:32px;
4479
- height:32px;
4480
- xborder:1px solid green;
4481
- padding: 0;
4482
- margin: 0;
4483
- &:hover{
4484
- background: #bbbbbb;
4485
- color:white;
4486
- }
4487
- >svg{
4488
- color:#bababa;
4489
- width:14px;
4490
- height:14px;
4491
- cursor: pointer;
4492
- stroke-width: 3;
4493
- }
4494
- }
4495
- >button.danger:hover{
4496
- background: red;
4497
- >svg{
4498
- color:white;
4499
- }
4500
- }
4374
+ window.style.left = `${x}px`;
4375
+ window.style.width = `${width}px`;
4376
+ };
4377
+ stop = e => {
4378
+ e.preventDefault();
4379
+ const {
4380
+ height: titleBarHeight
4381
+ } = this.props.titleBarRef.current.getBoundingClientRect();
4382
+ const {
4383
+ x,
4384
+ y,
4385
+ width,
4386
+ height
4387
+ } = this.props.windowRef.current.getBoundingClientRect();
4388
+ this.props.windowRef.current.style.transition = 'var(--transition-x-y)';
4389
+ if (y == 0 && this.data.direction.indexOf('n') > -1) {
4390
+ this.props.window.orgHeight = height;
4391
+ this.props.windowRef.current.style.height = `${window.innerHeight}px`;
4501
4392
  }
4502
- `;
4503
- class TitleBar extends React__default["default"].Component {
4504
- pos1 = 0;
4505
- pos2 = 0;
4506
- pos3 = 0;
4507
- pos4 = 0;
4508
- x = 0;
4509
- y = 0;
4510
- remember = e => {
4511
- po('remember');
4393
+ if (y > window.innerHeight) this.props.windowRef.current.style.top = `${window.innerHeight - titleBarHeight}px`;
4394
+ if (x + width - this.props.thick < 0) this.props.windowRef.current.style.left = 0;
4395
+ if (x > window.innerWidth) this.props.windowRef.current.style.left = `${window.innerWidth - width}px`;
4396
+ document.body.style.cursor = 'default';
4397
+ window.removeEventListener('mousemove', this.move);
4398
+ window.removeEventListener('mousemove', this.preMove);
4399
+ window.removeEventListener('mouseup', this.stop);
4400
+ };
4401
+ move = e => {
4402
+ e.preventDefault();
4403
+ this.props.windowRef.current.style.transition = 'unset';
4512
4404
  const {
4513
4405
  clientX,
4514
- clientY
4406
+ clientY,
4407
+ x: cursorX,
4408
+ y: cursorY
4515
4409
  } = e;
4410
+ const window = this.props.windowRef.current;
4411
+ const {
4412
+ left,
4413
+ top
4414
+ } = window.getBoundingClientRect();
4415
+ let {
4416
+ x: startX,
4417
+ width: startWidth,
4418
+ y: startY,
4419
+ height: startHeight,
4420
+ titleBarHeight
4421
+ } = this.data;
4422
+ this.directions[this.props.direction].resize({
4423
+ window,
4424
+ titleBarHeight,
4425
+ clientX,
4426
+ cursorX,
4427
+ startX,
4428
+ startWidth,
4429
+ left,
4430
+ clientY,
4431
+ cursorY,
4432
+ startY,
4433
+ startHeight,
4434
+ top
4435
+ });
4436
+ };
4437
+ preMove = () => {
4438
+ if (this.props.direction.indexOf('n') > -1) {
4439
+ this.props.windowRef.current.style.height = `${this.props.window.orgHeight}px`;
4440
+ this.data.height = this.props.window.orgHeight;
4441
+ this.props.window.orgHeight = null;
4442
+ }
4443
+ window.removeEventListener('mousemove', this.preMove);
4444
+ setTimeout(() => {
4445
+ window.addEventListener('mousemove', this.move);
4446
+ }, 100);
4447
+ };
4448
+ start = (e, direction) => {
4449
+ e.preventDefault();
4516
4450
  const {
4451
+ height: titleBarHeight
4452
+ } = this.props.titleBarRef.current.getBoundingClientRect();
4453
+ let {
4517
4454
  x,
4518
4455
  y,
4519
4456
  width,
4520
4457
  height
4521
4458
  } = 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 {
4459
+ if (this.props.direction.indexOf('s') > -1) {
4460
+ this.props.window.orgHeight = null;
4461
+ }
4462
+ this.data = {
4533
4463
  x,
4534
4464
  y,
4535
4465
  width,
4536
- height
4537
- } = this.props.windowRef.current.getBoundingClientRect();
4538
- if (y > 1 - this.props.thick) {
4539
- this.remember(e);
4540
- this.fullScreen(e);
4466
+ height,
4467
+ titleBarHeight,
4468
+ direction
4469
+ };
4470
+ document.body.style.cursor = this.directions[this.props.direction].cursor;
4471
+ if (this.props.window.orgHeight) {
4472
+ window.addEventListener('mousemove', this.preMove);
4541
4473
  } else {
4542
- this.floatScreen(e);
4474
+ window.addEventListener('mousemove', this.move);
4543
4475
  }
4476
+ window.addEventListener('mouseup', this.stop);
4544
4477
  };
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`
4478
+ render() {
4479
+ return /*#__PURE__*/React__default["default"].createElement(StyledSlider$1, {
4480
+ $direction: this.directions[this.props.direction],
4481
+ $padding: this.props.padding,
4482
+ onMouseDown: e => {
4483
+ this.start(e, this.props.direction);
4484
+ }
4485
+ });
4486
+ }
4487
+ }
4562
4488
 
4563
- setTimeout(() => {
4564
- document.body.style.overflow = 'hidden';
4565
- this.props.windowRef.current.style.transition = 'unset';
4566
- }, 50);
4489
+ function styleInject(css, ref) {
4490
+ if ( ref === void 0 ) ref = {};
4491
+ var insertAt = ref.insertAt;
4492
+
4493
+ if (!css || typeof document === 'undefined') { return; }
4494
+
4495
+ var head = document.head || document.getElementsByTagName('head')[0];
4496
+ var style = document.createElement('style');
4497
+ style.type = 'text/css';
4498
+
4499
+ if (insertAt === 'top') {
4500
+ if (head.firstChild) {
4501
+ head.insertBefore(style, head.firstChild);
4502
+ } else {
4503
+ head.appendChild(style);
4504
+ }
4505
+ } else {
4506
+ head.appendChild(style);
4507
+ }
4508
+
4509
+ if (style.styleSheet) {
4510
+ style.styleSheet.cssText = css;
4511
+ } else {
4512
+ style.appendChild(document.createTextNode(css));
4513
+ }
4514
+ }
4515
+
4516
+ 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}";
4517
+ var style = {"test":"Style-module_test__LrdEc","withMask":"Style-module_withMask__LPcai"};
4518
+ styleInject(css_248z);
4519
+
4520
+ const StyledJRWindow = styled__default["default"].div`
4521
+ --jr-window-radius:3px;
4522
+ --padding-child:8px;
4523
+ --transition-x-y:height .05s ease-in, width .05s ease-in;
4524
+ xborder:1px solid gray;
4525
+ position: fixed;
4526
+ padding: ${({
4527
+ $thick
4528
+ }) => $thick}px;
4529
+ border-radius: var(--jr-window-radius);
4530
+ user-select: text;
4531
+
4532
+ top: ${({
4533
+ $y
4534
+ }) => $y}px;
4535
+ left: ${({
4536
+ $x
4537
+ }) => $x}px;
4538
+ width: ${({
4539
+ $width = 300
4540
+ }) => `${$width}px`};
4541
+ height: ${({
4542
+ $height = 300
4543
+ }) => `${$height}px`};
4544
+ overflow: hidden;
4545
+ z-index: 2;
4546
+
4547
+ display: flex;
4548
+ flex-direction: column;
4549
+ overflow: hidden;
4550
+
4551
+ > main{
4552
+ border-radius: var(--jr-window-radius);
4553
+ box-shadow: 0px 0px 5px 1px gray;
4554
+ display: flex;
4555
+ flex-direction: column;
4556
+ overflow: hidden;
4557
+ flex:1;
4558
+ > main {
4559
+ Xpadding:var(--padding-child);
4560
+ overflow: overlay;
4561
+ flex:1;
4562
+ display: flex;
4563
+ min-height:32px;
4564
+ }
4565
+ }
4566
+
4567
+ `;
4568
+ class JRWindow extends JRFrame {
4569
+ x = 0;
4570
+ y = 0;
4571
+ width = 300;
4572
+ height = 300;
4573
+ padding = 1;
4574
+ thick = 5;
4575
+ constructor(props) {
4576
+ super(props);
4577
+ this.ref = /*#__PURE__*/React__default["default"].createRef();
4578
+ this.titleBarRef = /*#__PURE__*/React__default["default"].createRef();
4579
+ this.init();
4580
+ }
4581
+ addMaskToTarget = target => {
4582
+ this.mask = document.createElement('div');
4583
+ this.mask.style.background = '#868686cc';
4584
+ this.mask.style.position = 'absolute';
4585
+ this.mask.style.top = '0';
4586
+ this.mask.style.left = '0';
4587
+ this.mask.style.right = '0';
4588
+ this.mask.style.bottom = '0';
4589
+ this.mask.style.borderRadius = 'inherit';
4590
+ this.mask.style.height = '10000px';
4591
+ this.mask.style.width = '10000px';
4592
+ target.appendChild(this.mask);
4593
+ po('style.mask', style.mask);
4594
+ po('addMask+++++++++++++++++++++++++++');
4567
4595
  };
4568
- stop = e => {
4569
- po('stop');
4570
- e.preventDefault();
4571
- if (this.moved) {
4572
- const {
4573
- height: titleBarHeight
4574
- } = this.props.titleBarRef.current.getBoundingClientRect();
4575
- const {
4576
- x,
4577
- y,
4578
- width,
4579
- height
4580
- } = this.props.windowRef.current.getBoundingClientRect();
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`;
4583
- if (x + width - this.props.thick < 0) this.props.windowRef.current.style.left = 0;
4584
- if (x > window.innerWidth) this.props.windowRef.current.style.left = `${window.innerWidth - width}px`;
4596
+ removeMaskFromTarget = () => {
4597
+ po('removeMask-----------------------');
4598
+ this.mask.remove();
4599
+ };
4600
+ maskOnTarget(on) {
4601
+ po('typeof this.props.maskOn', typeof this.props.maskOn);
4602
+ const target = typeof this.props.maskOn === 'object' ? this.props.maskOn : typeof this.props.maskOn === 'string' ? document.getElementById(this.props.maskOn) : document.body;
4603
+
4604
+ // this[on?'addMaskToTarget':'removeMaskFromTarget'](target)
4605
+ target?.classList[on ? 'add' : 'remove']('withMask');
4606
+ }
4607
+ componentDidMount() {
4608
+ super.componentDidMount();
4609
+ if (this.props.maskOn && this.props.open) {
4610
+ this.maskOnTarget(this.props.open);
4611
+ }
4612
+ if (this.props.open) {
4613
+ this.open();
4614
+ }
4615
+ }
4616
+ open() {
4617
+ this.props.onOpen?.bind(this)();
4618
+ }
4619
+ close() {
4620
+ this.props.onClose?.bind(this)();
4621
+ }
4622
+ componentDidUpdate(prevProps, prevState, snapshot) {
4623
+ if (this.props.popup === true) {
4624
+ if (this.props.open && prevProps.open === false) {
4625
+ this.open();
4626
+ } else if (this.props.open === false && prevProps.open) {
4627
+ this.close();
4628
+ }
4629
+ if (this.props.maskOn && this.props.open != prevProps.open) {
4630
+ this.maskOnTarget(this.props.open);
4631
+ }
4632
+ }
4633
+ }
4634
+ init() {
4635
+ this.height = window.innerHeight >= (this.props.height ?? this.height) ? this.props.height ?? this.height : window.innerHeight;
4636
+ this.width = window.innerWidth >= (this.props.width ?? this.width) ? this.props.width ?? this.width : window.innerWidth;
4637
+ this.x = this.props.x ?? (window.innerWidth - (this.width ?? 300)) / 2;
4638
+ this.y = this.props.y ?? (window.innerHeight - (this.height ?? 300)) / 2;
4639
+ }
4640
+ renderer() {
4641
+ return this.props.popup === true ? this.props.open ? /*#__PURE__*/React__default["default"].createElement(StyledJRWindow, {
4642
+ ref: this.ref,
4643
+ className: `jr-window ${this.props.className ?? ''}`,
4644
+ $x: this.x,
4645
+ $y: this.y,
4646
+ $width: this.width,
4647
+ $height: this.height,
4648
+ $thick: this.thick
4649
+ }, /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(TitleBar, {
4650
+ titleBarRef: this.titleBarRef,
4651
+ windowRef: this.ref,
4652
+ window: this,
4653
+ title: this.props.title,
4654
+ thick: this.thick
4655
+ }), /*#__PURE__*/React__default["default"].createElement("main", null, super.renderer())), /*#__PURE__*/React__default["default"].createElement(Sliders, {
4656
+ thick: this.thick,
4657
+ windowRef: this.ref,
4658
+ window: this,
4659
+ titleBarRef: this.titleBarRef
4660
+ })) : '' : super.renderer();
4661
+ }
4662
+ }
4663
+
4664
+ const StyledSlider = styled__default["default"].div`
4665
+ position: absolute;
4666
+ top: 0;
4667
+ right: 0;
4668
+ height:100%;
4669
+ width:6px;
4670
+ user-select: none;
4671
+ &.resizing:hover,&.resizing{
4672
+ border-right:1px dashed black;
4673
+ }
4674
+ &:hover{
4675
+ cursor: col-resize;
4676
+ border-right:1px dashed gray;
4585
4677
  }
4678
+ `;
4679
+ class Slider extends React__default["default"].Component {
4680
+ constructor() {
4681
+ super();
4682
+ this.sliderRef = /*#__PURE__*/React__default["default"].createRef();
4683
+ }
4684
+ stop = e => {
4685
+ this.sliderRef.current.classList.remove('resizing');
4586
4686
  document.body.style.cursor = 'default';
4587
4687
  window.removeEventListener('mousemove', this.move);
4588
4688
  window.removeEventListener('mouseup', this.stop);
4589
- window.removeEventListener('mousemove', this.preMove);
4590
- };
4591
- move = e => {
4592
- po('move');
4593
- e.preventDefault();
4594
- this.moved = true;
4595
- const {
4596
- clientX,
4597
- clientY
4598
- } = e;
4599
- const y = clientY < 1 ? 0 : clientY;
4600
- this.pos1 = this.pos3 - clientX;
4601
- this.pos2 = this.pos4 - y;
4602
- this.pos3 = clientX;
4603
- this.pos4 = y;
4604
- const w = this.props.windowRef.current;
4605
- this.y = w.offsetTop - this.pos2;
4606
- this.x = w.offsetLeft - this.pos1;
4607
-
4608
- // if(this.props.window.orgWidth){
4609
- // w.style.width=`${this.props.window.orgWidth}px`
4610
- // this.props.window.orgWidth=null
4611
- // }
4612
-
4613
- this.y = this.y < -this.props.thick ? -this.props.thick : this.y;
4614
- w.style.transition = 'unset';
4615
- w.style.top = `${this.y}px`;
4616
- w.style.left = `${this.x}px`;
4617
4689
  };
4618
- preMove = e => {
4619
- console.clear();
4620
- po('preMove');
4621
- const w = this.props.windowRef.current;
4690
+ move = ({
4691
+ clientX
4692
+ }) => {
4622
4693
  const {
4623
- clientX,
4624
- clientY,
4625
- ...oe
4626
- } = e;
4627
- po('e', e);
4694
+ th,
4695
+ selectedCols,
4696
+ widthRates
4697
+ } = this.data;
4628
4698
  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`;
4646
- w.style.height = `${this.props.window.orgHeight}px`;
4647
- } else {
4648
- this.remember(e);
4649
- }
4650
- document.body.style.cursor = 'grabbing';
4651
- document.body.style.overflow = this.props.window.orgBodyOverflow;
4652
- setTimeout(() => {
4653
- window.addEventListener('mousemove', this.move);
4654
- }, 50);
4655
- window.removeEventListener('mousemove', this.preMove);
4699
+ left
4700
+ } = th.getBoundingClientRect();
4701
+ const min = left + 10;
4702
+ const x = clientX >= min ? clientX : min;
4703
+ const width = x - left;
4704
+ selectedCols.forEach((col, index) => {
4705
+ const _width = Math.round(width / 100 * widthRates[index]);
4706
+ col.style.width = _width + 'px';
4707
+ });
4656
4708
  };
4657
- start(e) {
4658
- po('start');
4659
- e.preventDefault();
4660
- this.moved = false;
4661
- this.pos3 = e.clientX;
4662
- this.pos4 = e.clientY;
4663
- this.props.windowRef.current.style.transition = 'var(--transition-x-y)';
4664
- window.addEventListener('mousemove', this.preMove);
4709
+ start(thPRef, column) {
4710
+ const selectedCols = [...this.props.table.colGroupRef.current.children].slice(column.columnNo, column.columnNo + (column.colSpan ?? 1));
4711
+ const totalWidth = selectedCols.reduce((aco, {
4712
+ offsetWidth
4713
+ }) => aco + offsetWidth, 0);
4714
+ const widthRates = selectedCols.map(({
4715
+ offsetWidth
4716
+ }) => {
4717
+ return 100 * (offsetWidth / totalWidth);
4718
+ });
4719
+ this.data = {
4720
+ selectedCols,
4721
+ th: thPRef.current,
4722
+ widthRates
4723
+ };
4724
+ this.sliderRef.current.classList.add('resizing');
4725
+ document.body.style.cursor = 'col-resize';
4726
+ window.addEventListener('mousemove', this.move);
4665
4727
  window.addEventListener('mouseup', this.stop);
4666
4728
  }
4667
- onDoubleClick() {
4668
- po('onDoubleClick');
4669
- }
4670
4729
  render() {
4671
- return /*#__PURE__*/React__default["default"].createElement(StyledTitle, {
4672
- ref: this.props.titleBarRef,
4673
- draggable: "false",
4674
- onMouseDown: e => {
4675
- this.start(e);
4676
- },
4677
- onDoubleClick: this.adjustScreen
4678
- }, /*#__PURE__*/React__default["default"].createElement(FreeType$1, {
4679
- tag: "div",
4680
- config: this.props.title ?? '',
4681
- me: this.props.window,
4682
- className: 'title'
4683
- }), /*#__PURE__*/React__default["default"].createElement("nav", null, this.props.window.props.setOpen ? /*#__PURE__*/React__default["default"].createElement(JRButton, {
4684
- icon: /*#__PURE__*/React__default["default"].createElement(SvgX, null),
4685
- className: 'danger',
4686
- onClick: e => {
4687
- e.stopPropagation();
4688
- if (this.props.window.orgBodyOverflow != null) {
4689
- document.body.style.overflow = this.props.window.orgBodyOverflow;
4690
- }
4691
- this.props.window.props.setOpen(false);
4692
- },
4730
+ const column = this.props.column;
4731
+ return /*#__PURE__*/React__default["default"].createElement(StyledSlider, {
4732
+ ref: this.sliderRef,
4693
4733
  onMouseDown: e => {
4694
- e.stopPropagation();
4734
+ this.start(this.props.thRef, column);
4695
4735
  }
4696
- }) : null));
4736
+ });
4697
4737
  }
4698
4738
  }
4699
4739
 
4700
- const directions = ['n', 'e', 's', 'w', 'nww', 'nnw', 'nne', 'nee', 'sse', 'see', 'sww', 'ssw'];
4701
- class Sliders extends React__default["default"].Component {
4702
- render() {
4703
- return directions.map((direction, index) => /*#__PURE__*/React__default["default"].createElement(Slider, {
4704
- direction: direction,
4705
- thick: this.props.thick,
4706
- windowRef: this.props.windowRef,
4707
- window: this.props.window,
4708
- titleBarRef: this.props.titleBarRef,
4740
+ const Colgroup = ({
4741
+ leafColumns,
4742
+ colGroupRef
4743
+ }) => {
4744
+ return /*#__PURE__*/React__default["default"].createElement("colgroup", {
4745
+ ref: colGroupRef
4746
+ }, leafColumns?.map((_column, index) => {
4747
+ const {
4748
+ width,
4749
+ ...column
4750
+ } = _column;
4751
+ const style = {
4752
+ width
4753
+ };
4754
+ return /*#__PURE__*/React__default["default"].createElement("col", {
4755
+ style: style,
4709
4756
  key: index
4757
+ });
4758
+ }));
4759
+ };
4760
+ const Ths$1 = ({
4761
+ deep,
4762
+ rowColumn,
4763
+ rowIndex,
4764
+ table
4765
+ }) => {
4766
+ return rowColumn?.map((column, colIndex) => {
4767
+ const thRef = /*#__PURE__*/React__default["default"].createRef();
4768
+ return /*#__PURE__*/React__default["default"].createElement("th", {
4769
+ key: colIndex,
4770
+ ref: thRef,
4771
+ colSpan: column.colSpan,
4772
+ rowSpan: column.rowSpan ?? (column.isLeaf && deep > rowIndex ? deep - rowIndex + 1 : null)
4773
+ }, flexType(column.label, table), (table.props.resizableColumns === undefined || table.props.resizableColumns) && /*#__PURE__*/React__default["default"].createElement(Slider, {
4774
+ table: table,
4775
+ thRef: thRef,
4776
+ column: column
4777
+ }));
4778
+ });
4779
+ };
4780
+ const HeadTrs = ({
4781
+ columns: _columns,
4782
+ trClassName,
4783
+ table
4784
+ }) => {
4785
+ const columns = Array.isArray(_columns?.[0]) ? _columns : [_columns];
4786
+ return columns?.map((rowColumn, rowIndex) => {
4787
+ return /*#__PURE__*/React__default["default"].createElement("tr", {
4788
+ className: trClassName,
4789
+ key: rowIndex
4790
+ }, /*#__PURE__*/React__default["default"].createElement(Ths$1, {
4791
+ deep: columns.length - 1,
4792
+ rowColumn: rowColumn,
4793
+ rowIndex: rowIndex,
4794
+ table: table
4795
+ }));
4796
+ });
4797
+ };
4798
+ const THead = ({
4799
+ columns,
4800
+ leafColumns,
4801
+ table
4802
+ }) => {
4803
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("thead", null, /*#__PURE__*/React__default["default"].createElement(HeadTrs, {
4804
+ columns: columns,
4805
+ table: table
4806
+ })), /*#__PURE__*/React__default["default"].createElement(Colgroup, {
4807
+ leafColumns: leafColumns,
4808
+ colGroupRef: table.colGroupRef
4809
+ }));
4810
+ };
4811
+ const FootThs = ({
4812
+ table,
4813
+ groupData,
4814
+ groupIndex,
4815
+ deep,
4816
+ columns,
4817
+ rowIndex
4818
+ }) => {
4819
+ return columns?.map((column, colIndex) => {
4820
+ // let content
4821
+ // if(type){
4822
+ // content='type'
4823
+ // }else if(render){
4824
+
4825
+ // content=render?.bind(table)({groupData,groupIndex,ths:111})
4826
+ // }else{
4827
+ // content=column.label
4828
+ // }
4829
+ let style = flexType(column.style, table, {}, {});
4830
+ const content = whatType(column, table, column.label);
4831
+ return /*#__PURE__*/React__default["default"].createElement("th", {
4832
+ style: style,
4833
+ colSpan: column.colSpan,
4834
+ rowSpan: column.rowSpan
4835
+ }, content);
4836
+ });
4837
+ };
4838
+ const TFoot = ({
4839
+ table,
4840
+ columns
4841
+ }) => {
4842
+ const trs = columns?.map((rowColumn, rowIndex) => {
4843
+ return /*#__PURE__*/React__default["default"].createElement("tr", {
4844
+ key: rowIndex
4845
+ }, /*#__PURE__*/React__default["default"].createElement(FootThs, {
4846
+ columns: rowColumn,
4847
+ table: table
4710
4848
  }));
4711
- }
4712
- }
4713
- const StyledSlider = styled__default["default"].div`
4714
- Xborder:1px solid ${({
4715
- $direction: {
4716
- color
4717
- }
4718
- }) => color};
4719
- Xbackground:${({
4720
- $direction: {
4721
- color
4722
- }
4723
- }) => color};
4724
- position: absolute;
4725
- top: ${({
4726
- $direction: {
4727
- top
4728
- }
4729
- }) => top};
4730
- bottom: ${({
4731
- $direction: {
4732
- bottom
4733
- }
4734
- }) => bottom};
4735
- right: ${({
4736
- $direction: {
4737
- right
4738
- }
4739
- }) => right};
4740
- left: ${({
4741
- $direction: {
4742
- left
4743
- }
4744
- }) => left};
4745
- height: ${({
4746
- $direction: {
4747
- height
4748
- }
4749
- }) => height};
4750
- width: ${({
4751
- $direction: {
4752
- width
4753
- }
4754
- }) => width};
4755
- cursor: ${({
4756
- $direction: {
4757
- cursor
4758
- }
4759
- }) => cursor};
4849
+ });
4850
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("tfoot", null, trs));
4851
+ };
4760
4852
 
4761
- -webkit-user-select: none;
4762
- -khtml-user-select: none;
4763
- -moz-user-select: none;
4764
- -o-user-select: none;
4765
- user-select: none;
4853
+ function _extends() {
4854
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
4855
+ for (var e = 1; e < arguments.length; e++) {
4856
+ var t = arguments[e];
4857
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
4858
+ }
4859
+ return n;
4860
+ }, _extends.apply(null, arguments);
4861
+ }
4766
4862
 
4863
+ styled__default["default"].tbody`
4864
+ th{
4865
+ height:4px;
4866
+ background:#c6c6c6;
4867
+ }
4767
4868
  `;
4768
- class Slider extends React__default["default"].Component {
4769
- width = '3px';
4770
- borderWidth = 'px';
4771
- borderLong = 5;
4772
- constructor(props) {
4773
- super(props);
4774
- this.sliderRef = /*#__PURE__*/React__default["default"].createRef();
4775
- }
4776
- directions = {
4777
- n: {
4778
- top: 0,
4779
- color: 'red',
4780
- width: '100%',
4781
- height: `${this.props.thick}px`,
4782
- cursor: 'n-resize',
4783
- resize: props => {
4784
- this.resizeN(props);
4785
- }
4786
- },
4787
- e: {
4788
- color: 'yellow',
4789
- right: 0,
4790
- width: `${this.props.thick}px`,
4791
- height: '100%',
4792
- cursor: 'e-resize',
4793
- resize: props => {
4794
- this.resizeE(props);
4795
- }
4796
- },
4797
- s: {
4798
- color: 'blue',
4799
- bottom: 0,
4800
- width: '100%',
4801
- height: `${this.props.thick}px`,
4802
- cursor: 's-resize',
4803
- resize: props => {
4804
- this.resizeS(props);
4805
- }
4806
- },
4807
- w: {
4808
- color: 'green',
4809
- left: 0,
4810
- width: `${this.props.thick}px`,
4811
- height: '100%',
4812
- cursor: 'w-resize',
4813
- resize: props => {
4814
- this.resizeW(props);
4815
- }
4816
- },
4817
- nw: {
4818
- top: 0,
4819
- left: 0,
4820
- color: 'blue',
4821
- width: `${this.borderLong}px`,
4822
- height: `${this.borderLong}px`,
4823
- cursor: 'nw-resize',
4824
- resize: props => {
4825
- this.resizeN(props);
4826
- this.resizeW(props);
4827
- }
4828
- },
4829
- nww: {
4830
- top: 0,
4831
- left: 0,
4832
- color: 'blue',
4833
- width: `${this.props.thick + this.borderLong}px`,
4834
- height: `${this.props.thick}px`,
4835
- cursor: 'nw-resize',
4836
- resize: props => {
4837
- this.resizeN(props);
4838
- this.resizeW(props);
4839
- }
4840
- },
4841
- nnw: {
4842
- top: 0,
4843
- left: 0,
4844
- color: 'blue',
4845
- width: `${this.props.thick}px`,
4846
- height: `${this.props.thick + this.borderLong}px`,
4847
- cursor: 'nw-resize',
4848
- resize: props => {
4849
- this.resizeN(props);
4850
- this.resizeW(props);
4851
- }
4852
- },
4853
- nne: {
4854
- top: 0,
4855
- right: 0,
4856
- color: 'green',
4857
- width: `${this.props.thick + this.borderLong}px`,
4858
- height: `${this.props.thick}px`,
4859
- cursor: 'ne-resize',
4860
- resize: props => {
4861
- this.resizeN(props);
4862
- this.resizeE(props);
4863
- }
4864
- },
4865
- nee: {
4866
- top: 0,
4867
- right: 0,
4868
- color: 'green',
4869
- width: `${this.props.thick}px`,
4870
- height: `${this.props.thick + this.borderLong}px`,
4871
- cursor: 'ne-resize',
4872
- resize: props => {
4873
- this.resizeN(props);
4874
- this.resizeE(props);
4875
- }
4876
- },
4877
- sse: {
4878
- color: 'red',
4879
- right: 0,
4880
- bottom: 0,
4881
- width: `${this.props.thick + this.borderLong}px`,
4882
- height: `${this.props.thick}px`,
4883
- cursor: 'se-resize',
4884
- resize: props => {
4885
- this.resizeS(props);
4886
- this.resizeE(props);
4887
- }
4888
- },
4889
- see: {
4890
- color: 'red',
4891
- right: 0,
4892
- bottom: 0,
4893
- width: `${this.props.thick}px`,
4894
- height: `${this.props.thick + this.borderLong}px`,
4895
- cursor: 'se-resize',
4896
- resize: props => {
4897
- this.resizeS(props);
4898
- this.resizeE(props);
4899
- }
4900
- },
4901
- ssw: {
4902
- color: 'yellow',
4903
- bottom: 0,
4904
- left: 0,
4905
- width: `${this.props.thick + this.borderLong}px`,
4906
- height: `${this.props.thick}px`,
4907
- cursor: 'sw-resize',
4908
- resize: props => {
4909
- this.resizeS(props);
4910
- this.resizeW(props);
4911
- }
4912
- },
4913
- sww: {
4914
- color: 'yellow',
4915
- bottom: 0,
4916
- left: 0,
4917
- width: `${this.props.thick}px`,
4918
- height: `${this.props.thick + this.borderLong}px`,
4919
- cursor: 'sw-resize',
4920
- resize: props => {
4921
- this.resizeS(props);
4922
- this.resizeW(props);
4923
- }
4869
+
4870
+ ////////////////////////////////////////////////////////////////////////////
4871
+
4872
+ const Ths = ({
4873
+ table,
4874
+ groupData,
4875
+ groupIndex,
4876
+ deep,
4877
+ rowColumn,
4878
+ rowIndex
4879
+ }) => {
4880
+ return rowColumn?.map(({
4881
+ style: _style,
4882
+ align,
4883
+ type,
4884
+ render,
4885
+ ...column
4886
+ }, colIndex) => {
4887
+ const style = flexType(_style, table, {}, {});
4888
+ let content;
4889
+ if (type) {
4890
+ content = 'type';
4891
+ } else if (render) {
4892
+ content = render?.bind(table)({
4893
+ groupData,
4894
+ groupIndex,
4895
+ ths: 111
4896
+ });
4897
+ } else {
4898
+ content = column.label;
4924
4899
  }
4925
- };
4926
- resizeN = ({
4927
- window,
4928
- cursorY,
4929
- startY,
4930
- startHeight,
4931
- titleBarHeight
4932
- }) => {
4933
- let y = cursorY - this.props.thick;
4934
- if (y < 0) y = 0;
4935
- let height = startHeight + (startY - y);
4936
- if (height < titleBarHeight + this.props.thick * 2) {
4937
- height = titleBarHeight + this.props.thick * 2;
4938
- y = startY + startHeight - titleBarHeight - this.props.thick * 2;
4900
+ // style.textAlign=align
4901
+ return /*#__PURE__*/React__default["default"].createElement("th", {
4902
+ key: colIndex,
4903
+ style: {
4904
+ textAlign: align,
4905
+ ...style
4906
+ },
4907
+ colSpan: column.colSpan,
4908
+ rowSpan: column.isLeaf && deep > rowIndex ? deep - rowIndex + 1 : null
4909
+ }, content);
4910
+ });
4911
+ };
4912
+ const GroupColumns = ({
4913
+ table,
4914
+ columns: _columns,
4915
+ trClassName,
4916
+ groupData,
4917
+ tbodyIndex
4918
+ }) => {
4919
+ const columns = Array.isArray(_columns?.[0]) ? _columns : [_columns];
4920
+ return columns?.map((rowColumn, rowIndex) => {
4921
+ return /*#__PURE__*/React__default["default"].createElement("tr", {
4922
+ className: trClassName,
4923
+ key: rowIndex
4924
+ }, /*#__PURE__*/React__default["default"].createElement(Ths, {
4925
+ table: table,
4926
+ groupData: groupData,
4927
+ groupIndex: tbodyIndex,
4928
+ deep: columns.length - 1,
4929
+ rowColumn: rowColumn,
4930
+ rowIndex: rowIndex
4931
+ }));
4932
+ });
4933
+ };
4934
+ styled__default["default"].tr`
4935
+ z-index: 1;
4936
+ XXposition: sticky;
4937
+ XXtop: 50px;
4938
+ th{
4939
+ text-align: left;
4940
+ border:1px solid #222222;
4939
4941
  }
4940
- window.style.top = `${y}px`;
4941
- window.style.height = `${height}px`;
4942
- };
4943
- resizeE = ({
4944
- window,
4945
- clientX,
4946
- left,
4947
- titleBarHeight
4948
- }) => {
4949
- let width = clientX - left - this.props.thick;
4950
- if (width < titleBarHeight) width = titleBarHeight;
4951
- window.style.width = `${width + this.props.thick * 2}px`;
4952
- };
4953
- resizeS = ({
4954
- window,
4955
- clientY,
4956
- top,
4957
- titleBarHeight
4958
- }) => {
4959
- let height = clientY - top - this.props.thick;
4960
- if (height < titleBarHeight) height = titleBarHeight;
4961
- window.style.height = `${height + this.props.thick * 2}px`;
4962
- };
4963
- resizeW = ({
4964
- window,
4965
- cursorX,
4966
- startX,
4967
- startWidth,
4968
- titleBarHeight
4969
- }) => {
4970
- let x = cursorX - this.props.thick;
4971
- if (x < 0) x = 0;
4972
- let width = startWidth + (startX - x);
4973
- if (width < titleBarHeight + this.props.thick * 2) {
4974
- width = titleBarHeight + this.props.thick * 2;
4975
- x = startX + startWidth - titleBarHeight - this.props.thick * 2;
4942
+ `;
4943
+ const GroupHeader = props => {
4944
+ return /*#__PURE__*/React__default["default"].createElement(GroupColumns, _extends({
4945
+ trClassName: 'jr-group-header'
4946
+ }, props));
4947
+ };
4948
+ styled__default["default"].tr`
4949
+ th{
4950
+ border:1px solid #222222;
4951
+ text-align: left;
4976
4952
  }
4977
- window.style.left = `${x}px`;
4978
- window.style.width = `${width}px`;
4953
+ `;
4954
+ const GroupFooter = props => {
4955
+ return /*#__PURE__*/React__default["default"].createElement(GroupColumns, _extends({
4956
+ trClassName: 'jr-group-footer'
4957
+ }, props));
4958
+ };
4959
+
4960
+ ////////////////////////////////////////////////////////////////////////////
4961
+ const Td = ({
4962
+ column: _column,
4963
+ record,
4964
+ tbodyIndex,
4965
+ trIndex,
4966
+ tdIndex,
4967
+ table
4968
+ }) => {
4969
+ let content;
4970
+ const {
4971
+ style: _style,
4972
+ align,
4973
+ vAlign = 'baseline',
4974
+ type,
4975
+ typeStyle: _typeStyle,
4976
+ render,
4977
+ setValue,
4978
+ getValue,
4979
+ onChange: _onChange,
4980
+ funcProps,
4981
+ ...column
4982
+ } = _column;
4983
+ const onChange = inputValue => {
4984
+ const targetValue = inputValue?.target?.value ?? inputValue;
4985
+ setValue(record, targetValue);
4986
+ table.setValue(table.getValue());
4979
4987
  };
4980
- stop = e => {
4981
- e.preventDefault();
4982
- const {
4983
- height: titleBarHeight
4984
- } = this.props.titleBarRef.current.getBoundingClientRect();
4985
- const {
4986
- x,
4987
- y,
4988
- width,
4989
- height
4990
- } = this.props.windowRef.current.getBoundingClientRect();
4991
- this.props.windowRef.current.style.transition = 'var(--transition-x-y)';
4992
- if (y == 0 && this.data.direction.indexOf('n') > -1) {
4993
- this.props.window.orgHeight = height;
4994
- this.props.windowRef.current.style.height = `${window.innerHeight}px`;
4995
- }
4996
- if (y > window.innerHeight) this.props.windowRef.current.style.top = `${window.innerHeight - titleBarHeight}px`;
4997
- if (x + width - this.props.thick < 0) this.props.windowRef.current.style.left = 0;
4998
- if (x > window.innerWidth) this.props.windowRef.current.style.left = `${window.innerWidth - width}px`;
4999
- document.body.style.cursor = 'default';
5000
- window.removeEventListener('mousemove', this.move);
5001
- window.removeEventListener('mousemove', this.preMove);
5002
- window.removeEventListener('mouseup', this.stop);
4988
+ const value = getValue(record);
4989
+ let style = render ? {} : flexType(_style, table, {
4990
+ value,
4991
+ record
4992
+ }, {});
4993
+ const setStyle = _style => {
4994
+ style = _style;
5003
4995
  };
5004
- move = e => {
5005
- e.preventDefault();
5006
- this.props.windowRef.current.style.transition = 'unset';
5007
- const {
5008
- clientX,
5009
- clientY,
5010
- x: cursorX,
5011
- y: cursorY
5012
- } = e;
5013
- const window = this.props.windowRef.current;
5014
- const {
5015
- left,
5016
- top
5017
- } = window.getBoundingClientRect();
5018
- let {
5019
- x: startX,
5020
- width: startWidth,
5021
- y: startY,
5022
- height: startHeight,
5023
- titleBarHeight
5024
- } = this.data;
5025
- this.directions[this.props.direction].resize({
5026
- window,
5027
- titleBarHeight,
5028
- clientX,
5029
- cursorX,
5030
- startX,
5031
- startWidth,
5032
- left,
5033
- clientY,
5034
- cursorY,
5035
- startY,
5036
- startHeight,
5037
- top
4996
+ setStyle.bind(table);
4997
+ render?.bind(table);
4998
+ if (type) {
4999
+ const typeStyle = flexType(_typeStyle, table, {
5000
+ record
5001
+ }, {});
5002
+ content = /*#__PURE__*/React__default["default"].createElement(type, {
5003
+ onChange: _onChange ? e => {
5004
+ _onChange?.bind(table)(e, {
5005
+ value,
5006
+ onChange,
5007
+ me: content
5008
+ });
5009
+ } : onChange,
5010
+ value,
5011
+ style: typeStyle,
5012
+ render,
5013
+ ...column,
5014
+ ...funcProps?.bind(table)({
5015
+ value
5016
+ })
5017
+ });
5018
+ } else if (render) {
5019
+ content = render({
5020
+ index: trIndex,
5021
+ groupIndex: tbodyIndex,
5022
+ value,
5023
+ record,
5024
+ onChange,
5025
+ setStyle
5026
+ });
5027
+ } else {
5028
+ content = value;
5029
+ }
5030
+ return /*#__PURE__*/React__default["default"].createElement("td", {
5031
+ colSpan: style.colSpan,
5032
+ rowSpan: style.rowSpan,
5033
+ style: {
5034
+ textAlign: align,
5035
+ verticalAlign: vAlign,
5036
+ ...style
5037
+ },
5038
+ key: tdIndex
5039
+ }, content);
5040
+ };
5041
+ const Tds = ({
5042
+ leafColumns,
5043
+ record,
5044
+ table,
5045
+ tbodyIndex,
5046
+ trIndex
5047
+ }) => {
5048
+ return leafColumns?.map((column, tdIndex) => {
5049
+ return /*#__PURE__*/React__default["default"].createElement(Td, {
5050
+ column: column,
5051
+ key: tdIndex,
5052
+ record: record,
5053
+ table: table,
5054
+ tbodyIndex: tbodyIndex,
5055
+ trIndex: trIndex,
5056
+ tdIndex: tdIndex
5038
5057
  });
5058
+ });
5059
+ };
5060
+ ////////////////////////////////////////////////////////////////////////////
5061
+
5062
+ const TBody = ({
5063
+ groupData,
5064
+ groupHeader,
5065
+ leafColumns,
5066
+ groupFooter,
5067
+ table,
5068
+ tbodyIndex
5069
+ }) => {
5070
+ const neededProps = {
5071
+ table,
5072
+ tbodyIndex
5039
5073
  };
5040
- preMove = () => {
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;
5074
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("tbody", {
5075
+ key: `tbody${tbodyIndex}`
5076
+ }, groupData?.length > 0 && /*#__PURE__*/React__default["default"].createElement(GroupHeader, _extends({
5077
+ groupData: groupData,
5078
+ columns: groupHeader
5079
+ }, neededProps)), groupData?.map?.((record, trIndex) => {
5080
+ const onRowClick = table.props.onRowClick?.bind(table);
5081
+ return /*#__PURE__*/React__default["default"].createElement("tr", {
5082
+ key: trIndex,
5083
+ onClick: () => {
5084
+ onRowClick?.({
5085
+ record,
5086
+ index: trIndex,
5087
+ groupIndex: tbodyIndex
5088
+ });
5089
+ }
5090
+ }, /*#__PURE__*/React__default["default"].createElement(Tds, _extends({
5091
+ record: record,
5092
+ trIndex: trIndex
5093
+ }, neededProps, {
5094
+ leafColumns: leafColumns
5095
+ })));
5096
+ }), groupData?.length > 0 && /*#__PURE__*/React__default["default"].createElement(GroupFooter, _extends({
5097
+ groupData: groupData,
5098
+ columns: groupFooter
5099
+ }, neededProps))));
5100
+ };
5101
+ const TBodies = ({
5102
+ groupHeader,
5103
+ leafColumns,
5104
+ groupFooter,
5105
+ dataSource: _dataSource,
5106
+ table
5107
+ }) => {
5108
+ // po('--TBodies--')
5109
+ const isGroupDataType = Array.isArray(_dataSource?.[0]);
5110
+ const dataSource = isGroupDataType ? _dataSource : [_dataSource];
5111
+
5112
+ // po('dataSource',dataSource)
5113
+ return dataSource?.map((groupData, tbodyIndex, c) => {
5114
+ return /*#__PURE__*/React__default["default"].createElement(TBody, {
5115
+ key: `tbody${tbodyIndex}`,
5116
+ table: table
5117
+ // dataSource={dataSource}
5118
+ // dataGroup={groupData}
5119
+ ,
5120
+ groupData: groupData,
5121
+ tbodyIndex: tbodyIndex,
5122
+ groupHeader: groupHeader,
5123
+ leafColumns: leafColumns,
5124
+ groupFooter: groupFooter
5125
+ });
5126
+ });
5127
+ };
5128
+
5129
+ const StyledJRTable = styled__default["default"].div`
5130
+ --column-bd-color:#cccccc;
5131
+ --column-b-color:#eeeeee;
5132
+ --column-b-hover-color:#ffffff;
5133
+
5134
+ position: relative;
5135
+ background: var(--column-b-color);
5136
+ border:1px solid var(--column-bd-color);
5137
+
5138
+ display:flex;
5139
+ flex-direction: column;
5140
+ flex:1;
5141
+ overflow: overlay;
5142
+
5143
+
5144
+
5145
+
5146
+ &.row-highlightable{
5147
+ tbody{
5148
+ tr:not(.jr-group-header,.jr-group-footer):hover{
5149
+ background:var(--column-b-hover-color);
5150
+ cursor: pointer;
5151
+ transition: background-color .8s;
5152
+ td{
5153
+ color:black;
5154
+ transition:color .8s;
5155
+ }
5156
+
5157
+ }
5158
+ }
5045
5159
  }
5046
- window.removeEventListener('mousemove', this.preMove);
5047
- setTimeout(() => {
5048
- window.addEventListener('mousemove', this.move);
5049
- }, 100);
5050
- };
5051
- start = (e, direction) => {
5052
- e.preventDefault();
5053
- const {
5054
- height: titleBarHeight
5055
- } = this.props.titleBarRef.current.getBoundingClientRect();
5056
- let {
5057
- x,
5058
- y,
5059
- width,
5060
- height
5061
- } = this.props.windowRef.current.getBoundingClientRect();
5062
- if (this.props.direction.indexOf('s') > -1) {
5063
- this.props.window.orgHeight = null;
5160
+
5161
+ table{
5162
+ Xheight: 100%;
5163
+ min-width:100%;
5164
+ width: max-content;
5165
+ border-spacing: 0;
5166
+
5167
+ thead{
5168
+ position: sticky;
5169
+ top: 0;
5170
+
5171
+ th{
5172
+ position: relative;
5173
+ padding: 2px 6px;
5174
+ background: linear-gradient(180deg, rgba(227, 227, 226, 1) 0%, rgba(255, 255, 255, 1) 25%, rgba(210, 210, 210, 1) 100%);
5175
+ box-shadow: 2px 2px 2px 0 #ffffffd6 inset, -1px -1px 2px 0px #8a847dbf inset;
5176
+ color: #525252;
5177
+ white-space: nowrap;
5178
+ }
5179
+ }
5180
+
5181
+ tfoot{
5182
+ position: sticky;
5183
+ bottom: -1px;
5184
+
5185
+ Xtr:nth-child(1){
5186
+ th{
5187
+ Xborder-top:1px solid var(--column-bd-color);
5188
+ }
5189
+ }
5190
+ Xth:nth-child(1){
5191
+ Xborder-left:1px solid var(--column-bd-color);
5192
+ }
5193
+
5194
+ th{
5195
+ height:32px;
5196
+ padding: 4px;
5197
+ background: #e4e4e4;
5198
+ xbackground: linear-gradient(180deg, rgba(227, 227, 226, 1) 0%, rgba(255, 255, 255, 1) 25%, rgba(210, 210, 210, 1) 100%);
5199
+ xbox-shadow: 2px 2px 2px 0 #ffffffd6 inset, -1px -1px 2px 0px #8a847dbf inset;
5200
+ color: #525252;
5201
+ white-space: nowrap;
5202
+
5203
+ border-left:2px solid #f4f4f4;
5204
+ border-top:2px solid #f4f4f4;
5205
+ border-right:2px solid var(--column-bd-color);
5206
+ border-bottom:2px solid var(--column-bd-color);
5207
+ }
5208
+ }
5209
+
5210
+ tbody{
5211
+ tr{
5212
+ transition: background .3s linear;
5213
+ background:var(--column-b-color);
5214
+ a:#ededed;
5215
+ th{
5216
+ color:#444444;
5217
+ }
5218
+ td{
5219
+ border-bottom: 1px solid var(--column-bd-color);
5220
+ color:#2e2e2e;
5221
+ padding: 4px;
5222
+ }
5223
+ }
5224
+ tr:hover{
5225
+ background:var(--column-b-hover-color);
5226
+
5227
+ }
5228
+
5229
+ tr.jr-group-header
5230
+ ,tr.jr-group-footer{
5231
+ text-align:left;
5232
+ background:#dddbdb;
5233
+
5234
+ th{
5235
+ border-bottom: 1px solid var(--column-bd-color);
5236
+ border-right: 1px solid var(--column-bd-color);
5237
+ padding: 4px 8px;
5238
+ }
5239
+ }
5240
+ }
5241
+ tbody.empty-tbody{
5242
+ td{
5243
+ border:10px solid red;
5244
+ }
5245
+ }
5246
+ }
5247
+
5248
+
5249
+
5250
+
5251
+ > .empty{
5252
+ user-select: none;
5253
+ color:#848484;
5254
+ height:100%;
5255
+ flex:1;
5256
+ display:flex;
5257
+ justify-content: center;
5258
+ align-items: center;
5259
+
5260
+
5261
+ }
5262
+
5263
+ > .empty::after{
5264
+ content:'無資料';
5265
+ position: block;
5266
+ }
5267
+
5268
+ `;
5269
+
5270
+ styled__default["default"].div`
5271
+ display:flex;
5272
+ flex:1;
5273
+ overflow:hidden;
5274
+
5275
+ > *{
5276
+ Xborder:1px solid gray;
5064
5277
  }
5065
- this.data = {
5066
- x,
5067
- y,
5068
- width,
5069
- height,
5070
- titleBarHeight,
5071
- direction
5072
- };
5073
- document.body.style.cursor = this.directions[this.props.direction].cursor;
5074
- if (this.props.window.orgHeight) {
5075
- window.addEventListener('mousemove', this.preMove);
5076
- } else {
5077
- window.addEventListener('mousemove', this.move);
5278
+ >main{
5279
+ display:flex;
5280
+ flex:1;
5281
+ overflow:overlay;
5282
+ flex-direction: column;
5283
+ > *{
5284
+ XXborder:1px solid gray;
5285
+ XXmin-height:30px;
5286
+ }
5287
+
5288
+ >header{
5289
+ XXborder:1px solid red;
5290
+ XXoverflow: overlay;
5291
+ }
5292
+ >main{
5293
+ display:flex;
5294
+ flex:1;
5295
+ overflow:hidden;
5296
+ }
5297
+ >footer{
5298
+ XXborder:1px solid blue;
5299
+ overflow: overlay;
5300
+ }
5301
+
5078
5302
  }
5079
- window.addEventListener('mouseup', this.stop);
5080
- };
5081
- render() {
5082
- return /*#__PURE__*/React__default["default"].createElement(StyledSlider, {
5083
- $direction: this.directions[this.props.direction],
5084
- $padding: this.props.padding,
5085
- onMouseDown: e => {
5086
- this.start(e, this.props.direction);
5087
- }
5088
- });
5089
- }
5090
- }
5303
+
5304
+ `;
5091
5305
 
5092
5306
  const StyleJRFields = styled__default["default"].main`
5093
5307
  --column-bd-color:#cccccc;
@@ -5491,270 +5705,44 @@ class JRFields extends JRWindow {
5491
5705
  key: `f${index}`,
5492
5706
  style: _style,
5493
5707
  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
- })));
5511
- }
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);
5515
- });
5516
- }
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;
5537
- }
5538
- `;
5539
- class JRInput extends React__default["default"].Component {
5540
- setValue(value) {
5541
- this.props?.onChange?.(value);
5542
- }
5543
- render() {
5544
- return /*#__PURE__*/React__default["default"].createElement(StyledInput, null, this.input());
5545
- }
5546
- }
5547
-
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);
5561
- } else {
5562
- head.appendChild(style);
5563
- }
5564
- } else {
5565
- head.appendChild(style);
5566
- }
5567
-
5568
- if (style.styleSheet) {
5569
- style.styleSheet.cssText = css;
5570
- } else {
5571
- style.appendChild(document.createTextNode(css));
5572
- }
5573
- }
5574
-
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;
5605
-
5606
- display: flex;
5607
- flex-direction: column;
5608
- overflow: hidden;
5609
-
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;
5623
- }
5624
- }
5625
-
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;
5662
-
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();
5673
- }
5674
- }
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
- }
5708
+ $labelWidth: column.labelProps?.width ?? this.props.labelProps?.width ?? '120px',
5709
+ $valueWidth: column.valueProps?.width ?? this.props.valueProps?.width ?? '1fr'
5710
+ }, label != null && /*#__PURE__*/React__default["default"].createElement(StyledColumnLabel, {
5711
+ style: labelStyle,
5712
+ $required: column.required,
5713
+ className: 'label',
5714
+ $layout: layout,
5715
+ $colon: colon
5716
+ }, label), content, /*#__PURE__*/React__default["default"].createElement(StyledColumnFooter, {
5717
+ $layout: layout
5718
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
5719
+ className: "left"
5720
+ }, this.getTestValue(_parentName.join('.'))?.msg?.map(msg => {
5721
+ return msg;
5722
+ })), /*#__PURE__*/React__default["default"].createElement("div", {
5723
+ className: "right"
5724
+ })));
5692
5725
  }
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;
5726
+ createColumns(parentValue, columns, parentName, fullname, labelProps) {
5727
+ return columns?.map((column, index) => {
5728
+ return this.createColumn(parentValue, column, index, parentName, column.name ? [...fullname, column.name] : fullname, labelProps);
5729
+ });
5698
5730
  }
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();
5731
+ renderMe() {
5732
+ return /*#__PURE__*/React__default["default"].createElement(StyleJRFields, {
5733
+ className: 'jr-fields',
5734
+ style: this.props.typeStyle
5735
+ }, /*#__PURE__*/React__default["default"].createElement(StyledGrid, {
5736
+ cols: this.props.cols,
5737
+ style: this.props.gridStyle,
5738
+ className: 'jr-grid',
5739
+ $gap: this.props.gap
5740
+ }, 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)));
5720
5741
  }
5721
5742
  }
5722
5743
 
5723
- styled__default["default"].div`
5724
- display:flex;
5725
- flex:1;
5726
- overflow:hidden;
5727
-
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
- }
5740
-
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
- }
5754
-
5755
- }
5756
-
5757
- `;
5744
+ // export const FFields=JRFrameHOC(JRFields)
5745
+ // export const WFields=JRWindowHOC(FFields)
5758
5746
 
5759
5747
  styled__default["default"].div`
5760
5748
  --jr-window-radius:3px;
@@ -6043,95 +6031,15 @@ class JRTable extends JRWindow {
6043
6031
  // export const FTable=JRFrameHOC(JRTable)
6044
6032
  // export const WTable=JRWindowHOC(JRTable)
6045
6033
 
6046
- const StyledJRFrame = styled__default["default"].div`
6047
- display:flex;
6048
- flex:1;
6049
- overflow:hidden;
6050
-
6051
- > *{
6052
- Xborder:1px solid gray;
6053
- }
6054
- >main{
6055
- display:flex;
6056
- flex:1;
6057
- overflow:overlay;
6058
- flex-direction: column;
6059
- > *{
6060
- XXborder:1px solid gray;
6061
- min-height:30px;
6062
- }
6063
-
6064
- >header{
6065
- XXborder:1px solid red;
6066
- XXoverflow: overlay;
6067
- }
6068
- >main{
6069
- display:flex;
6070
- flex:1;
6071
- overflow:hidden;
6072
- }
6073
- >footer{
6074
- XXborder:1px solid blue;
6075
- overflow: overlay;
6076
- }
6077
-
6078
- }
6079
-
6034
+ const StyledJRTest = styled__default["default"].div`
6035
+
6080
6036
  `;
6081
- const FreeType = ({
6082
- tag: Tag,
6083
- config,
6084
- me,
6085
- className
6086
- }) => {
6087
- if (typeof config === 'function') {
6088
- let style;
6089
- const setStyle = function (_style) {
6090
- style = _style;
6091
- };
6092
- const content = config.bind(me)({
6093
- setStyle
6094
- });
6095
- return /*#__PURE__*/React__default["default"].createElement(Tag, {
6096
- className: className,
6097
- style: style
6098
- }, content);
6099
- }
6100
- };
6101
6037
  class JRTestReact extends JRSubmit {
6102
6038
  renderer() {
6103
- return /*#__PURE__*/React__default["default"].createElement(StyledJRFrame, {
6039
+ return /*#__PURE__*/React__default["default"].createElement(StyledJRTest, {
6104
6040
  style: this.props.style,
6105
6041
  className: `${this.props.className} jr-frame`
6106
- }, /*#__PURE__*/React__default["default"].createElement(FreeType, {
6107
- tag: "div",
6108
- config: this.props.start,
6109
- me: this,
6110
- className: 'start'
6111
- }), /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(FreeType, {
6112
- tag: "header",
6113
- config: this.props.top,
6114
- me: this
6115
- }), /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(FreeType, {
6116
- tag: "div",
6117
- config: this.props.left,
6118
- me: this,
6119
- className: 'left'
6120
- }), this.renderMe(), /*#__PURE__*/React__default["default"].createElement(FreeType, {
6121
- tag: "div",
6122
- config: this.props.right,
6123
- me: this,
6124
- className: 'right'
6125
- })), /*#__PURE__*/React__default["default"].createElement(FreeType, {
6126
- tag: "footer",
6127
- config: this.props.bottom,
6128
- me: this
6129
- })), /*#__PURE__*/React__default["default"].createElement(FreeType, {
6130
- tag: "div",
6131
- config: this.props.end,
6132
- me: this,
6133
- className: 'end'
6134
- }));
6042
+ });
6135
6043
  }
6136
6044
  renderMe() {
6137
6045
  return /*#__PURE__*/React__default["default"].createElement("div", {
@@ -6142,9 +6050,228 @@ class JRTestReact extends JRSubmit {
6142
6050
  }
6143
6051
  }
6144
6052
 
6053
+ class AlertWindow extends JRWindow {
6054
+ renderMe() {
6055
+ return this.getValue()?.message;
6056
+ }
6057
+ }
6058
+ const StyledAlert = styled__default["default"](AlertWindow)`
6059
+ .body{
6060
+ display: flex;
6061
+ align-items: center;
6062
+ padding: 20px;
6063
+ }
6064
+
6065
+ footer{
6066
+ display: flex;
6067
+ justify-content: end;
6068
+ padding: 8px;
6069
+ }
6070
+ `;
6071
+ function JRAlertWindow({
6072
+ title,
6073
+ message,
6074
+ container,
6075
+ ...props
6076
+ }) {
6077
+ const [open, setOpen] = React.useState(true);
6078
+ return /*#__PURE__*/React__default["default"].createElement(StyledAlert, _extends({
6079
+ initValue: {
6080
+ message
6081
+ },
6082
+ width: 440,
6083
+ height: 180,
6084
+ maskOn: 'play'
6085
+ }, props, {
6086
+ open: open,
6087
+ setOpen: setOpen,
6088
+ popup: true,
6089
+ title: title ?? ''
6090
+ // onOpen={()=>{
6091
+ // po('Open+++++++++++++++++')
6092
+ // }}
6093
+ ,
6094
+ onClose: () => {
6095
+ container.remove();
6096
+ },
6097
+ bottom: function () {
6098
+ return /*#__PURE__*/React__default["default"].createElement("button", {
6099
+ onClick: () => {
6100
+ setOpen(false);
6101
+ }
6102
+ }, "OK");
6103
+ }
6104
+ }), message);
6105
+ }
6106
+ function JRAlert(props) {
6107
+ const body = document.body;
6108
+ const containerId = 'jr-alert-div';
6109
+ let container = document.getElementById(containerId);
6110
+ if (container == null) {
6111
+ container = document.createElement('div');
6112
+ container.id = containerId;
6113
+ body.appendChild(container);
6114
+ }
6115
+ const jrAlerDiv = document.createElement('div');
6116
+ container.appendChild(jrAlerDiv);
6117
+ client.createRoot(jrAlerDiv).render(/*#__PURE__*/React__default["default"].createElement(JRAlertWindow, _extends({}, props, {
6118
+ container: jrAlerDiv
6119
+ })));
6120
+ }
6121
+
6122
+ const StyledInput = styled__default["default"].div`
6123
+ display:flex;
6124
+ input:focus{
6125
+ outline: none;
6126
+ }
6127
+ `;
6128
+ class JRInput extends React__default["default"].Component {
6129
+ setValue(value) {
6130
+ this.props?.onChange?.(value);
6131
+ }
6132
+ render() {
6133
+ return /*#__PURE__*/React__default["default"].createElement(StyledInput, null, this.input());
6134
+ }
6135
+ }
6136
+
6137
+ class JROptions extends JRSubmit {
6138
+ get optionsFrom() {
6139
+ return this.props.options === undefined ? 'state' : 'props';
6140
+ }
6141
+ setOptions(options) {
6142
+ if (this.props.setOptions) {
6143
+ this.props.setOptions(options);
6144
+ } else {
6145
+ this.setState({
6146
+ options: options
6147
+ });
6148
+ }
6149
+ }
6150
+ getOptions() {
6151
+ return this[this.optionsFrom]?.options;
6152
+ }
6153
+ setRes(isSuccess, response, config) {
6154
+ if (isSuccess) {
6155
+ const options = config.formatValue?.bind(this)(response.data) ?? response.data;
6156
+ response.data = options;
6157
+ this.setOptions(options);
6158
+ }
6159
+ }
6160
+ }
6161
+
6162
+ const StyledOption = styled__default["default"].option`
6163
+ `;
6164
+ const StyledSelect = styled__default["default"].select`
6165
+ ${({
6166
+ size,
6167
+ multiple
6168
+ }) => `${size == 1 || size == undefined && multiple != true ? 'height:30px;' : ''}`}
6169
+ width: 100%;
6170
+
6171
+ option{
6172
+ padding: 4px;
6173
+ height: 25px;
6174
+ display: flex;
6175
+ align-items: center;
6176
+ }
6177
+ `;
6178
+ class JRSelect extends JROptions {
6179
+ renderer() {
6180
+ const {
6181
+ showBlank,
6182
+ valueName = 'id',
6183
+ labelName = 'name',
6184
+ multiple,
6185
+ size
6186
+ } = this.props;
6187
+ const options = [...(this.getOptions() ?? [])];
6188
+ if (multiple != true && showBlank != false) options.unshift({
6189
+ [valueName]: '',
6190
+ [labelName]: ''
6191
+ });
6192
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(StyledSelect, {
6193
+ value: this.getValue() ?? (multiple ? [] : ''),
6194
+ className: 'jr-select',
6195
+ onChange: e => {
6196
+ if (multiple) {
6197
+ const selectedIndex = [...e.target.selectedOptions].map(option => option.index);
6198
+ this.setValue(selectedIndex.length ? selectedIndex.map(index => options[index][valueName]) : null);
6199
+ } else {
6200
+ const selectedIndex = e.target.selectedOptions[0].index;
6201
+ this.setValue(selectedIndex ? options[selectedIndex][valueName] : null);
6202
+ }
6203
+ },
6204
+ size: size,
6205
+ multiple: multiple
6206
+ }, options.map((record, key) => {
6207
+ const props = {
6208
+ value: record[valueName],
6209
+ key: key
6210
+ };
6211
+ if (multiple && this.getValue()?.indexOf(record[valueName]) > -1 || this.getValue() == record[valueName]) {
6212
+ props.className = 'selected';
6213
+ }
6214
+ return /*#__PURE__*/React__default["default"].createElement(StyledOption, props, record[labelName]);
6215
+ })));
6216
+ }
6217
+ }
6218
+
6219
+ const StyledPick = styled__default["default"].div`
6220
+ >label{
6221
+ white-space: nowrap;
6222
+ display: inline-flex;
6223
+ align-items: center;
6224
+ height: 30px;
6225
+ padding-right: 12px;
6226
+ }
6227
+ `;
6228
+
6229
+ class JRCheckbox extends JROptions {
6230
+ renderer() {
6231
+ const {
6232
+ valueName = 'value',
6233
+ labelName = 'label'
6234
+ } = this.props;
6235
+ const multiple = Array.isArray(this.getOptions() ?? []);
6236
+ const options = multiple ? this.getOptions() : [this.getOptions()];
6237
+ const value = multiple ? [...(this.getValue() ?? [])] : this.getValue();
6238
+ const checked = multiple ? checkValue => {
6239
+ return value.indexOf(checkValue) > -1;
6240
+ } : checkValue => {
6241
+ return checkValue == value;
6242
+ };
6243
+ return /*#__PURE__*/React__default["default"].createElement(StyledPick, {
6244
+ className: 'jr-checkbox'
6245
+ }, options?.map((record, key) => {
6246
+ const recordValue = record[valueName];
6247
+ return /*#__PURE__*/React__default["default"].createElement("label", {
6248
+ key: key
6249
+ }, /*#__PURE__*/React__default["default"].createElement("input", {
6250
+ type: 'checkbox',
6251
+ multiple: multiple,
6252
+ value: recordValue,
6253
+ checked: checked(recordValue),
6254
+ onChange: multiple ? e => {
6255
+ if (e.target.checked) {
6256
+ value.push(recordValue);
6257
+ } else {
6258
+ value.splice(value.indexOf(recordValue), 1);
6259
+ }
6260
+ this.setValue(value.length ? value : null);
6261
+ } : e => {
6262
+ this.setValue(e.target.checked ? recordValue : null);
6263
+ }
6264
+ }), record[labelName]);
6265
+ }));
6266
+ }
6267
+ }
6268
+
6269
+ exports.JRAlert = JRAlert;
6145
6270
  exports.JRButton = JRButton;
6271
+ exports.JRCheckbox = JRCheckbox;
6146
6272
  exports.JRFields = JRFields;
6147
6273
  exports.JRFrame = JRFrame;
6274
+ exports.JRSelect = JRSelect;
6148
6275
  exports.JRSubmit = JRSubmit;
6149
6276
  exports.JRTable = JRTable;
6150
6277
  exports.JRTestReact = JRTestReact;