jrs-react 1.2.4 → 1.2.5

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
@@ -7086,7 +7086,7 @@ const StyledJRTable = styled.div`
7086
7086
 
7087
7087
  th{
7088
7088
  position: relative;
7089
- height:32px;
7089
+ height:24px;
7090
7090
  padding: 4px;
7091
7091
  background: linear-gradient(180deg, rgba(227, 227, 226, 1) 0%, rgba(255, 255, 255, 1) 25%, rgba(210, 210, 210, 1) 100%);
7092
7092
  box-shadow: 2px 2px 2px 0 #ffffffd6 inset, -1px -1px 2px 0px #8a847dbf inset;
@@ -7413,7 +7413,7 @@ class JRTable extends JRFrame {
7413
7413
 
7414
7414
  const StyleJRFields = styled.main`
7415
7415
  --column-bd-color:#cccccc;
7416
- --column-b-color:#eeeeee;
7416
+ --column-b-color:unset;
7417
7417
  --column-b-hover-color:#ffffff;
7418
7418
 
7419
7419
  flex-direction: column;
@@ -7421,21 +7421,17 @@ const StyleJRFields = styled.main`
7421
7421
  overflow: overlay;
7422
7422
 
7423
7423
  color:#525252;
7424
- XXXborder: 1px solid #a0a0a0;
7425
- background: var(--column-b-color);
7426
7424
 
7427
7425
  >.jr-grid{
7428
- background:var(--column-b-color);
7429
-
7430
7426
  .jr-column{
7431
- padding: 6px;
7432
-
7433
- label{
7427
+ > .label{
7434
7428
  color:#525252;
7435
7429
  text-wrap: nowrap;
7436
- padding: 4px 10px 4px 0;
7430
+ padding: 3px 8px;
7437
7431
  font-weight: bold;
7438
7432
  }
7433
+ > .jr-column-value{
7434
+ }
7439
7435
  }
7440
7436
  }
7441
7437
  `;
@@ -7523,8 +7519,9 @@ const StyledColumnLabel = styled.label`
7523
7519
 
7524
7520
  `;
7525
7521
  const StyledColumnValue = styled.main`
7526
- Xflex:1;
7522
+ flex:1;
7527
7523
  Xdisplay:flex;
7524
+ flex-direction: column;
7528
7525
  overflow: hidden;
7529
7526
 
7530
7527
  text-align: start;
@@ -7633,7 +7630,6 @@ class JRFields extends JRFrame {
7633
7630
  no += 1;
7634
7631
  const fullnameList = name ? [..._fullnameList, name] : _fullnameList;
7635
7632
  const fullname = fullnameList.join('.');
7636
- // po(`${no} - ${tab}fn= ${fullname}`)
7637
7633
  this.#findValidator(acc, fullname, column);
7638
7634
  if (type == null && columns) {
7639
7635
  this.#loopColumnsForValidateValue(no, fullnameList, columns, `${tab}\t`, result);
@@ -7725,17 +7721,12 @@ class JRFields extends JRFrame {
7725
7721
  required,
7726
7722
  ...column
7727
7723
  }, index, parentName, fullname) {
7728
- // po('----------------------------------------')
7729
- // po('parentName',parentName)
7730
- // po('fullname',fullname)
7731
7724
  const value = name ? parentValue?.[name] : parentValue;
7732
7725
  const gap = column.gap ?? this.props.gap;
7733
7726
  const label = column.label;
7734
7727
  const _style = flexType(style, this, {}, {});
7735
7728
  if (colSpan) _style.gridColumn = `span ${colSpan}`;
7736
7729
  if (rowSpan) _style.gridRow = `span ${rowSpan}`;
7737
- // Object.assign(_style,style)
7738
-
7739
7730
  let content;
7740
7731
  this.createValidator({
7741
7732
  required,
@@ -7744,7 +7735,6 @@ class JRFields extends JRFrame {
7744
7735
  const fn = fullname.join('.');
7745
7736
  const onChange = inputValue => {
7746
7737
  const targetValue = inputValue?.target?.value ?? inputValue;
7747
- // po('===Form onChange===',targetValue)
7748
7738
  try {
7749
7739
  parentValue[name] = targetValue;
7750
7740
  this.setValue({
@@ -7832,12 +7822,13 @@ class JRFields extends JRFrame {
7832
7822
  }
7833
7823
  renderMe() {
7834
7824
  return /*#__PURE__*/React.createElement(StyleJRFields, {
7835
- className: 'jr-fields'
7825
+ className: 'jr-fields',
7826
+ style: this.props.typeStyle
7836
7827
  }, /*#__PURE__*/React.createElement(StyledGrid, {
7837
7828
  cols: this.props.cols,
7838
7829
  style: this.props.gridStyle,
7839
7830
  className: 'jr-grid',
7840
- $gap: this.props.gap
7831
+ $gap: this.props.gap ?? '8px'
7841
7832
  }, this.createColumns(this.props.dataSourceName ? this.getValue()?.[this.props.dataSourceName] : this.getValue(), this.props.columns, this.props.dataSourceName ? [this.props.dataSourceName] : [], this.props.dataSourceName ? [this.props.dataSourceName] : [])));
7842
7833
  }
7843
7834
 
package/build/index.js CHANGED
@@ -7094,7 +7094,7 @@ const StyledJRTable = styled__default["default"].div`
7094
7094
 
7095
7095
  th{
7096
7096
  position: relative;
7097
- height:32px;
7097
+ height:24px;
7098
7098
  padding: 4px;
7099
7099
  background: linear-gradient(180deg, rgba(227, 227, 226, 1) 0%, rgba(255, 255, 255, 1) 25%, rgba(210, 210, 210, 1) 100%);
7100
7100
  box-shadow: 2px 2px 2px 0 #ffffffd6 inset, -1px -1px 2px 0px #8a847dbf inset;
@@ -7421,7 +7421,7 @@ class JRTable extends JRFrame {
7421
7421
 
7422
7422
  const StyleJRFields = styled__default["default"].main`
7423
7423
  --column-bd-color:#cccccc;
7424
- --column-b-color:#eeeeee;
7424
+ --column-b-color:unset;
7425
7425
  --column-b-hover-color:#ffffff;
7426
7426
 
7427
7427
  flex-direction: column;
@@ -7429,21 +7429,17 @@ const StyleJRFields = styled__default["default"].main`
7429
7429
  overflow: overlay;
7430
7430
 
7431
7431
  color:#525252;
7432
- XXXborder: 1px solid #a0a0a0;
7433
- background: var(--column-b-color);
7434
7432
 
7435
7433
  >.jr-grid{
7436
- background:var(--column-b-color);
7437
-
7438
7434
  .jr-column{
7439
- padding: 6px;
7440
-
7441
- label{
7435
+ > .label{
7442
7436
  color:#525252;
7443
7437
  text-wrap: nowrap;
7444
- padding: 4px 10px 4px 0;
7438
+ padding: 3px 8px;
7445
7439
  font-weight: bold;
7446
7440
  }
7441
+ > .jr-column-value{
7442
+ }
7447
7443
  }
7448
7444
  }
7449
7445
  `;
@@ -7531,8 +7527,9 @@ const StyledColumnLabel = styled__default["default"].label`
7531
7527
 
7532
7528
  `;
7533
7529
  const StyledColumnValue = styled__default["default"].main`
7534
- Xflex:1;
7530
+ flex:1;
7535
7531
  Xdisplay:flex;
7532
+ flex-direction: column;
7536
7533
  overflow: hidden;
7537
7534
 
7538
7535
  text-align: start;
@@ -7641,7 +7638,6 @@ class JRFields extends JRFrame {
7641
7638
  no += 1;
7642
7639
  const fullnameList = name ? [..._fullnameList, name] : _fullnameList;
7643
7640
  const fullname = fullnameList.join('.');
7644
- // po(`${no} - ${tab}fn= ${fullname}`)
7645
7641
  this.#findValidator(acc, fullname, column);
7646
7642
  if (type == null && columns) {
7647
7643
  this.#loopColumnsForValidateValue(no, fullnameList, columns, `${tab}\t`, result);
@@ -7733,17 +7729,12 @@ class JRFields extends JRFrame {
7733
7729
  required,
7734
7730
  ...column
7735
7731
  }, index, parentName, fullname) {
7736
- // po('----------------------------------------')
7737
- // po('parentName',parentName)
7738
- // po('fullname',fullname)
7739
7732
  const value = name ? parentValue?.[name] : parentValue;
7740
7733
  const gap = column.gap ?? this.props.gap;
7741
7734
  const label = column.label;
7742
7735
  const _style = flexType(style, this, {}, {});
7743
7736
  if (colSpan) _style.gridColumn = `span ${colSpan}`;
7744
7737
  if (rowSpan) _style.gridRow = `span ${rowSpan}`;
7745
- // Object.assign(_style,style)
7746
-
7747
7738
  let content;
7748
7739
  this.createValidator({
7749
7740
  required,
@@ -7752,7 +7743,6 @@ class JRFields extends JRFrame {
7752
7743
  const fn = fullname.join('.');
7753
7744
  const onChange = inputValue => {
7754
7745
  const targetValue = inputValue?.target?.value ?? inputValue;
7755
- // po('===Form onChange===',targetValue)
7756
7746
  try {
7757
7747
  parentValue[name] = targetValue;
7758
7748
  this.setValue({
@@ -7840,12 +7830,13 @@ class JRFields extends JRFrame {
7840
7830
  }
7841
7831
  renderMe() {
7842
7832
  return /*#__PURE__*/React.createElement(StyleJRFields, {
7843
- className: 'jr-fields'
7833
+ className: 'jr-fields',
7834
+ style: this.props.typeStyle
7844
7835
  }, /*#__PURE__*/React.createElement(StyledGrid, {
7845
7836
  cols: this.props.cols,
7846
7837
  style: this.props.gridStyle,
7847
7838
  className: 'jr-grid',
7848
- $gap: this.props.gap
7839
+ $gap: this.props.gap ?? '8px'
7849
7840
  }, this.createColumns(this.props.dataSourceName ? this.getValue()?.[this.props.dataSourceName] : this.getValue(), this.props.columns, this.props.dataSourceName ? [this.props.dataSourceName] : [], this.props.dataSourceName ? [this.props.dataSourceName] : [])));
7850
7841
  }
7851
7842
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jrs-react",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.es.js",
@@ -0,0 +1,7 @@
1
+ {
2
+ "name":"Joren"
3
+ ,"phone":[
4
+ {"no":"0948272834","name":"中華電信"}
5
+ ,{"no":"0987304555","name":"遠傳"}
6
+ ]
7
+ }
@@ -0,0 +1,18 @@
1
+ [
2
+ {
3
+ "name":"Joren"
4
+ ,"address":{
5
+ "no":"23"
6
+ ,"street":"Jalan Indah"
7
+ ,"country":"Malaysia"
8
+ }
9
+ }
10
+ ,{
11
+ "name":"John"
12
+ ,"address":{
13
+ "no":"36"
14
+ ,"street":"景興路"
15
+ ,"country":"台灣"
16
+ }
17
+ }
18
+ ]
@@ -80,8 +80,9 @@ const StyledColumnLabel=styled.label`
80
80
 
81
81
  `
82
82
  const StyledColumnValue=styled.main`
83
- Xflex:1;
83
+ flex:1;
84
84
  Xdisplay:flex;
85
+ flex-direction: column;
85
86
  overflow: hidden;
86
87
 
87
88
  text-align: start;
@@ -186,7 +187,6 @@ export default class JRFields extends JRFrame {
186
187
  no+=1
187
188
  const fullnameList=name?[..._fullnameList,name]:_fullnameList
188
189
  const fullname=fullnameList.join('.')
189
- // po(`${no} - ${tab}fn= ${fullname}`)
190
190
  this.#findValidator(acc,fullname,column)
191
191
  if(type==null&&columns){
192
192
  this.#loopColumnsForValidateValue(no,fullnameList,columns,`${tab}\t`,result)
@@ -264,7 +264,8 @@ export default class JRFields extends JRFrame {
264
264
  createColumn(
265
265
  parentValue
266
266
  ,{
267
- type,name,colSpan,rowSpan,style
267
+ type,name,colSpan,rowSpan
268
+ ,style
268
269
  ,typeStyle:_typeStyle
269
270
  ,required
270
271
  ,...column
@@ -273,9 +274,6 @@ export default class JRFields extends JRFrame {
273
274
  ,parentName
274
275
  ,fullname
275
276
  ){
276
- // po('----------------------------------------')
277
- // po('parentName',parentName)
278
- // po('fullname',fullname)
279
277
  const value=name?parentValue?.[name]:parentValue
280
278
 
281
279
  const gap=column.gap??this.props.gap
@@ -283,7 +281,6 @@ export default class JRFields extends JRFrame {
283
281
  const _style=flexType(style,this,{},{})
284
282
  if (colSpan) _style.gridColumn = `span ${colSpan}`
285
283
  if (rowSpan) _style.gridRow = `span ${rowSpan}`
286
- // Object.assign(_style,style)
287
284
 
288
285
 
289
286
  let content
@@ -293,7 +290,6 @@ export default class JRFields extends JRFrame {
293
290
  const fn=fullname.join('.')
294
291
  const onChange=(inputValue)=>{
295
292
  const targetValue=inputValue?.target?.value ?? inputValue
296
- // po('===Form onChange===',targetValue)
297
293
  try{
298
294
  parentValue[name]=targetValue
299
295
  this.setValue({...this.getValue()})
@@ -403,8 +399,8 @@ export default class JRFields extends JRFrame {
403
399
 
404
400
 
405
401
  renderMe(){
406
- return <StyleJRFields className={'jr-fields'}>
407
- <StyledGrid cols={this.props.cols} style={this.props.gridStyle} className={'jr-grid'} $gap={this.props.gap}>
402
+ return <StyleJRFields className={'jr-fields'} style={this.props.typeStyle}>
403
+ <StyledGrid cols={this.props.cols} style={this.props.gridStyle} className={'jr-grid'} $gap={this.props.gap??'8px'}>
408
404
  {
409
405
  this.createColumns(
410
406
  this.props.dataSourceName?this.getValue()?.[this.props.dataSourceName]:this.getValue()
@@ -2,7 +2,7 @@ import styled from "styled-components";
2
2
 
3
3
  export const StyleJRFields=styled.main`
4
4
  --column-bd-color:#cccccc;
5
- --column-b-color:#eeeeee;
5
+ --column-b-color:unset;
6
6
  --column-b-hover-color:#ffffff;
7
7
 
8
8
  flex-direction: column;
@@ -10,21 +10,17 @@ export const StyleJRFields=styled.main`
10
10
  overflow: overlay;
11
11
 
12
12
  color:#525252;
13
- XXXborder: 1px solid #a0a0a0;
14
- background: var(--column-b-color);
15
13
 
16
14
  >.jr-grid{
17
- background:var(--column-b-color);
18
-
19
15
  .jr-column{
20
- padding: 6px;
21
-
22
- label{
16
+ > .label{
23
17
  color:#525252;
24
18
  text-wrap: nowrap;
25
- padding: 4px 10px 4px 0;
19
+ padding: 3px 8px;
26
20
  font-weight: bold;
27
21
  }
22
+ > .jr-column-value{
23
+ }
28
24
  }
29
25
  }
30
26
  `
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import styled from "styled-components";
3
+
4
+
5
+
6
+ const StyledInput=styled.div`
7
+ display:flex;
8
+ `
9
+ export default class JRInput extends React.Component{
10
+ setValue(value){
11
+ this.props?.onChange?.(value)
12
+ }
13
+ render(){
14
+ return <StyledInput>
15
+ {this.input()}
16
+ </StyledInput>
17
+ }
18
+ }
@@ -1,7 +1,17 @@
1
1
  import React from "react";
2
+ import { po } from "../JRUtils";
3
+ import JRInput from "./JRInput";
2
4
 
3
- export default class JRText extends React.Component{
4
- render(){
5
- return <input value={this.props.value}/>
5
+ export default class JRText extends JRInput{
6
+ input(){
7
+ return <input value={this.props.value}
8
+ style={{
9
+ height: '24px'
10
+ ,width: '100%'
11
+ }}
12
+ onChange={(e)=>{
13
+ this.setValue(e.target.value)
14
+ }}
15
+ />
6
16
  }
7
17
  }
@@ -44,7 +44,7 @@ export const StyledJRTable=styled.div`
44
44
 
45
45
  th{
46
46
  position: relative;
47
- height:32px;
47
+ height:24px;
48
48
  padding: 4px;
49
49
  background: linear-gradient(180deg, rgba(227, 227, 226, 1) 0%, rgba(255, 255, 255, 1) 25%, rgba(210, 210, 210, 1) 100%);
50
50
  box-shadow: 2px 2px 2px 0 #ffffffd6 inset, -1px -1px 2px 0px #8a847dbf inset;