jrs-react 1.2.23 → 1.2.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jrs-react",
3
- "version": "1.2.23",
3
+ "version": "1.2.24",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.es.js",
@@ -1,6 +1,8 @@
1
1
  import styled from "styled-components";
2
2
 
3
3
  export const StyleJRFields=styled.main`
4
+
5
+
4
6
  --column-bd-color:#cccccc;
5
7
  --column-b-color:unset;
6
8
  --column-b-hover-color:#ffffff;
@@ -10,12 +12,13 @@ export const StyleJRFields=styled.main`
10
12
  overflow: overlay;
11
13
 
12
14
  color:#525252;
15
+ height: 100%;
13
16
 
14
17
  >.jr-grid{
15
18
  padding: 10px;
16
19
  .jr-column{
17
20
  > .label{
18
- color:#525252;
21
+ color:#2e2e2e;
19
22
  text-wrap: nowrap;
20
23
  font-weight: bold;
21
24
  }
@@ -44,8 +44,9 @@ const StyledJRFrame=styled.div`
44
44
  overflow:hidden;
45
45
 
46
46
  >main{
47
- display:flex;
48
- flex:1;
47
+ width:100%;
48
+ xdisplay:flex;
49
+ xflex:1;
49
50
  overflow: overlay;
50
51
  }
51
52
 
@@ -60,7 +61,7 @@ const StyledJRFrame=styled.div`
60
61
 
61
62
  export default class JRFrame extends JRSubmit {
62
63
  renderer(){
63
- return <StyledJRFrame id={this.props.id} style={this.props.style} className={`${this.props.className} jr-frame`} >
64
+ return <StyledJRFrame id={this.props.id} style={this.props.style} className={`jr-frame`} >
64
65
  <FreeType tag='div' config={this.props.start} me={this} className={'start'}/>
65
66
  <main>
66
67
  <FreeType tag='header' config={this.props.top} me={this}/>
@@ -4,6 +4,8 @@ import { po } from "../JRUtils"
4
4
  import styled from "styled-components"
5
5
 
6
6
  const StyledMask = styled.dialog`
7
+
8
+
7
9
  display:none;
8
10
  &:open{
9
11
  display:flex;
@@ -42,8 +44,16 @@ const StyledMask = styled.dialog`
42
44
  .cs-loader-inner {
43
45
  transform: translateY(-30%);
44
46
  width: calc(100% - 200xpx);
47
+
45
48
  }
46
49
 
50
+
51
+ animation: opc .4s ;
52
+ @keyframes opc {
53
+ 0% {opacity: 0;background: transparent;visibility:hidden;}
54
+ 20% {opacity: 1;background: #000000aa; visibility: visible;}
55
+ }
56
+
47
57
  .cs-loader-inner label {
48
58
  font-size: 20px;
49
59
  opacity: 0;
@@ -121,7 +131,7 @@ const StyledMask = styled.dialog`
121
131
 
122
132
  export default function JRMask({id='jr-mask'}){
123
133
  return <StyledMask id={id} className={'jr-mask'}>
124
- <div id={'jr-mask-msg'} ></div>
134
+ <div id={`${id}-msg`} ></div>
125
135
  <div className="cs-loader-inner">
126
136
  <label>●</label>
127
137
  <label>●</label>
@@ -163,12 +173,13 @@ class Mask extends JRHTML{
163
173
  renderMsg(){
164
174
  this.msgDiv.removeAllHijos()
165
175
  if(this.msg.length){
166
- this.msgDiv.agregarHijo(
167
- new JRHTML({
168
- yo:'div'
169
- ,textContent:this.msg[this.msg.length-1].msg
170
- })
171
- )
176
+ this.msgDiv.html=this.msg[this.msg.length-1].msg
177
+ // this.msgDiv.agregarHijo(
178
+ // new JRHTML({
179
+ // yo:'div'
180
+ // ,textContent:this.msg[this.msg.length-1].msg
181
+ // })
182
+ // )
172
183
  if(!this.yo.open){
173
184
  this.yo.showModal()
174
185
  }
@@ -182,20 +193,22 @@ export function showMask(msg,maskTarget,whichMask){
182
193
  const jrMask=document.getElementById('jr-mask')
183
194
  const jrMaskMsg=document.getElementById('jr-mask-msg')
184
195
 
185
- if(!jrMask.maskDiv){
186
- jrMask.maskDiv=new Mask({
187
- yo:jrMask
188
- ,msgDiv:new JRHTML({
189
- yo:jrMaskMsg
190
- })
191
- ,listeners:{
192
- keydown(e){
193
- if (e.key === 'Escape') {
194
- e.preventDefault();
196
+ if((jrMask && jrMaskMsg)){
197
+ if(!jrMask.maskDiv){
198
+ jrMask.maskDiv=new Mask({
199
+ yo:jrMask
200
+ ,msgDiv:new JRHTML({
201
+ yo:jrMaskMsg
202
+ })
203
+ ,listeners:{
204
+ keydown(e){
205
+ if (e.key === 'Escape') {
206
+ e.preventDefault();
207
+ }
195
208
  }
196
209
  }
197
- }
198
- })
210
+ })
211
+ }
212
+ return jrMask.maskDiv.addMsg(msg)
199
213
  }
200
- return jrMask.maskDiv.addMsg(msg)
201
214
  }
@@ -142,7 +142,6 @@ export default class JRSubmit extends React.Component {
142
142
  const fullnamList=fullname.split('.')
143
143
  return this.#getValueByName(fullnamList,this[this.from]?.value)
144
144
  }else{
145
- // po('ssssssssssssssssssssssssssssssssssssssssss')
146
145
  // 忘記為甚麼這樣寫了 XDD
147
146
  return flexType(this[this.from]?.value,this,null,null)
148
147
  }
@@ -218,9 +217,7 @@ export default class JRSubmit extends React.Component {
218
217
  }
219
218
 
220
219
  submit(config){
221
- // const me=this
222
- // displaySpinner({mask:config.mask})
223
- // this.setState({loading:true})//拿掉可能會有問題, 先觀察看看
220
+ this.setState({loading:true})
224
221
  if(config.mask) config.removeMaskFunction=showMask(config.mask,null,'jr-mask')
225
222
 
226
223
  let _payload
@@ -251,11 +248,7 @@ export default class JRSubmit extends React.Component {
251
248
  this.handleResponse(res,_payload,config)
252
249
  })
253
250
  .finally(()=> {
254
- // this.setState({loading:false})
255
- // displaySpinner({mask:false})
256
- // setTimeout(()=>{
257
- config.removeMaskFunction?.()
258
- // },random(4000,1000))
251
+ config.removeMaskFunction?.()
259
252
  })
260
253
  }
261
254
 
@@ -284,8 +277,8 @@ export default class JRSubmit extends React.Component {
284
277
  }
285
278
 
286
279
  showMessage(success,message){
287
- // po('success',success)
288
- // po('message',message)
280
+ po('success',success)
281
+ po('message',message)
289
282
  }
290
283
 
291
284
  renderer(){
@@ -293,8 +286,6 @@ export default class JRSubmit extends React.Component {
293
286
  }
294
287
 
295
288
  render() {
296
- return this.props.cover!=null && this.state?.lodaing
297
- ?<Cover>{flexType(this.props.cover,this,null,null)}</Cover>
298
- :this.renderer()
289
+ return this.renderer()
299
290
  }
300
291
  }
@@ -207,7 +207,7 @@ export default class JRTable extends JRWindow {
207
207
  renderMe(){
208
208
 
209
209
  return<StyledJRTable
210
- className={`${this.props.className??''} jr-table ${this.props.onRowClick?'row-highlightable':''}`}
210
+ className={`jr-table ${this.props.onRowClick?'row-highlightable':''}`}
211
211
  >
212
212
  <table className={'jr-table-table'}>
213
213
  <TBodies
@@ -2,8 +2,8 @@ import styled from "styled-components";
2
2
 
3
3
  export const StyledJRTable=styled.div`
4
4
  --column-bd-color:#cccccc;
5
- --column-b-color:#eeeeee;
6
- --column-b-hover-color:#ffffff;
5
+ --column-b-color:#ffffff;
6
+ --column-b-hover-color:#eeeeee;
7
7
 
8
8
  position: relative;
9
9
  background: var(--column-b-color);
@@ -13,7 +13,7 @@ export const StyledJRTable=styled.div`
13
13
  flex-direction: column;
14
14
  flex:1;
15
15
  overflow: overlay;
16
-
16
+ height:100%;
17
17
 
18
18
 
19
19
 
@@ -43,7 +43,7 @@ export const StyledJRTable=styled.div`
43
43
  top: 0;
44
44
 
45
45
  th{
46
- position: relative;
46
+ xposition: relative;
47
47
  padding: 2px 6px;
48
48
  background: linear-gradient(180deg, rgba(227, 227, 226, 1) 0%, rgba(255, 255, 255, 1) 25%, rgba(210, 210, 210, 1) 100%);
49
49
  box-shadow: 2px 2px 2px 0 #ffffffd6 inset, -1px -1px 2px 0px #8a847dbf inset;
@@ -8,6 +8,8 @@ import style from './Style.module.css'
8
8
 
9
9
 
10
10
  const StyledJRWindow=styled.div`
11
+ z-index:1;
12
+
11
13
  --jr-window-radius:3px;
12
14
  --padding-child:8px;
13
15
  --transition-x-y:height .05s ease-in, width .05s ease-in;
@@ -15,36 +17,35 @@ const StyledJRWindow=styled.div`
15
17
  position: fixed;
16
18
  padding: ${({$thick})=>$thick}px;
17
19
  border-radius: var(--jr-window-radius);
18
- user-select: text;
20
+ user-select: text;
19
21
 
20
22
  top: ${({$y})=>$y}px;
21
23
  left: ${({$x})=>$x}px;
22
24
  width: ${({$width=300})=>`${$width}px`};
23
25
  height: ${({$height=300})=>`${$height}px`};
24
26
  overflow: hidden;
25
- z-index: 2;
26
27
 
27
28
  display: flex;
28
29
  flex-direction: column;
29
30
  overflow: hidden;
31
+ color:#2e2e2e;
30
32
 
31
33
  > main{
32
34
  border-radius: var(--jr-window-radius);
35
+ background:#ffffff;;
33
36
  box-shadow: 0px 0px 5px 1px gray;
34
37
  display: flex;
35
38
  flex-direction: column;
36
39
  overflow: hidden;
37
40
  flex:1;
38
41
  > main {
39
- Xpadding:var(--padding-child);
40
42
  overflow: overlay;
41
43
  flex:1;
42
44
  display: flex;
43
- min-height:32px;
44
45
  }
45
46
  }
46
-
47
47
  `
48
+
48
49
  export default class JRWindow extends JRFrame {
49
50
  x=0
50
51
  y=0
@@ -80,12 +81,11 @@ export default class JRWindow extends JRFrame {
80
81
  this.mask.remove()
81
82
  }
82
83
 
83
- maskOnTarget(on){
84
- po('typeof this.props.maskOn',typeof this.props.maskOn)
85
- const target=(typeof this.props.maskOn)==='object'
86
- ?this.props.maskOn
87
- :typeof this.props.maskOn ==='string'
88
- ?document.getElementById(this.props.maskOn)
84
+ backdropOn(on){
85
+ const target=(typeof this.props.backdrop)==='object'
86
+ ?this.props.backdrop
87
+ :typeof this.props.backdrop ==='string'
88
+ ?document.getElementById(this.props.backdrop)
89
89
  :document.body
90
90
 
91
91
  // this[on?'addMaskToTarget':'removeMaskFromTarget'](target)
@@ -94,8 +94,8 @@ export default class JRWindow extends JRFrame {
94
94
 
95
95
  componentDidMount(){
96
96
  super.componentDidMount()
97
- if(this.props.maskOn && this.props.open){
98
- this.maskOnTarget(this.props.open)
97
+ if(this.props.backdrop && this.props.open){
98
+ this.backdropOn(this.props.open)
99
99
  }
100
100
 
101
101
  if(this.props.open){
@@ -117,8 +117,8 @@ export default class JRWindow extends JRFrame {
117
117
  }else if(this.props.open===false && prevProps.open){
118
118
  this.close()
119
119
  }
120
- if(this.props.maskOn && this.props.open!=prevProps.open){
121
- this.maskOnTarget(this.props.open)
120
+ if(this.props.backdrop && this.props.open!=prevProps.open){
121
+ this.backdropOn(this.props.open)
122
122
  }
123
123
  }
124
124
  }
@@ -133,6 +133,12 @@ export default class JRWindow extends JRFrame {
133
133
  return this.props.popup===true
134
134
  ?this.props.open
135
135
  ?<StyledJRWindow
136
+
137
+ // role="dialog"
138
+ // aria-labelledby="dialog1Title"
139
+ // aria-describedby="dialog1Desc"
140
+
141
+ rule={'dialog'}
136
142
  ref={this.ref}
137
143
  className={`jr-window ${this.props.className??''}`}
138
144
  $x={this.x}
@@ -236,7 +236,8 @@ class Slider extends React.Component {
236
236
 
237
237
  this.props.windowRef.current.style.transition='var(--transition-x-y)'
238
238
  if(y==0 && this.data.direction.indexOf('n')>-1){
239
- this.props.window.orgHeight=height
239
+ this.props.window.orgSHeight=height
240
+
240
241
  this.props.windowRef.current.style.height=`${window.innerHeight}px`
241
242
  }
242
243
  if(y>window.innerHeight)this.props.windowRef.current.style.top = `${window.innerHeight-titleBarHeight}px`
@@ -263,10 +264,11 @@ class Slider extends React.Component {
263
264
  }
264
265
  preMove=()=>{
265
266
  if(this.props.direction.indexOf('n')>-1){
266
- this.props.windowRef.current.style.height=`${this.props.window.orgHeight}px`
267
- this.data.height=this.props.window.orgHeight
268
- this.props.window.orgHeight=null
267
+ this.props.windowRef.current.style.height=`${this.props.window.orgSHeight}px`
268
+ this.data.height=this.props.window.orgSHeight
269
+ this.props.window.orgSHeight=null
269
270
  }
271
+
270
272
  window.removeEventListener('mousemove',this.preMove)
271
273
  setTimeout(()=>{
272
274
  window.addEventListener('mousemove',this.move)
@@ -276,9 +278,9 @@ class Slider extends React.Component {
276
278
  e.preventDefault()
277
279
  const {height:titleBarHeight}=this.props.titleBarRef.current.getBoundingClientRect()
278
280
  let {x,y,width,height}=this.props.windowRef.current.getBoundingClientRect()
279
-
281
+ this.props.window.orgHeight=height
280
282
  if(this.props.direction.indexOf('s')>-1){
281
- this.props.window.orgHeight=null
283
+ this.props.window.orgSHeight=null
282
284
  }
283
285
  this.data={
284
286
  x,y
@@ -288,7 +290,7 @@ class Slider extends React.Component {
288
290
  ,direction
289
291
  }
290
292
  document.body.style.cursor=this.directions[this.props.direction].cursor
291
- if(this.props.window.orgHeight){
293
+ if(this.props.window.orgSHeight){
292
294
  window.addEventListener('mousemove',this.preMove)
293
295
  }else{
294
296
  window.addEventListener('mousemove',this.move)
@@ -190,7 +190,7 @@ export default class TitleBar extends React.Component{
190
190
  }else{
191
191
  this.remember(e)
192
192
  }
193
-
193
+ this.props.window.orgSHeight=null
194
194
  document.body.style.cursor='grabbing'
195
195
  document.body.style.overflow=this.props.window.orgBodyOverflow
196
196
 
package/src/index.js CHANGED
@@ -5,7 +5,7 @@ import JRTable from './components/JRTable/JRTable'
5
5
  import JRFields from './components/JRFields/JRFields'
6
6
  import JRTestReact from './components/JRTest'
7
7
  import JRButton from './components/JRInput/JRButton'
8
- import JRAlert from './components/JRAlert'
8
+ import JRAlert from './components/JRAlert/JRAlert'
9
9
  import JRSelect from './components/JRInput/JRSelect'
10
10
  import JRCheckbox from './components/JRInput/JRCheckbox'
11
11
  import JRRadio from './components/JRInput/JRRadio'