jrs-react 1.2.14 → 1.2.15

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