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