jrs-react 1.2.4 → 1.2.6
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 +11 -20
- package/build/index.js +11 -20
- package/index.html +13 -0
- package/package.json +14 -3
- package/public/data.json +9 -0
- package/public/list.json +20 -0
- package/public/vite.svg +1 -0
- package/src/app/App.css +8 -0
- package/src/app/App.jsx +17 -0
- package/src/app/fields/FieldsApp.jsx +12 -0
- package/src/app/fields/fieldsConfig.jsx +137 -0
- package/src/app/index.css +42 -0
- package/src/app/table/TableApp.jsx +10 -0
- package/src/app/table/tableConfig.jsx +86 -0
- package/src/app/window/WindowApp.jsx +84 -0
- package/src/assets/react.svg +1 -0
- package/src/components/JRFields/JRFields.jsx +11 -16
- package/src/components/JRFields/StyleJRFields.jsx +7 -10
- package/src/components/JRFrame/JRFrame.jsx +9 -6
- package/src/components/JRInput/JRInput.jsx +18 -0
- package/src/components/JRInput/JRSelect.jsx +19 -0
- package/src/components/JRInput/JRText.jsx +12 -3
- package/src/components/JRSubmit.jsx +4 -3
- package/src/components/JRTable/JRTable.jsx +3 -2
- package/src/components/JRTable/Slider.jsx +1 -1
- package/src/components/JRTable/StyledJRTable.jsx +1 -2
- package/src/components/JRTable/TBodies.jsx +1 -1
- package/src/components/JRWindow/JRWindow.jsx +110 -0
- package/src/components/JRWindow/Slider.jsx +251 -0
- package/src/components/JRWindow/TitleBar.jsx +84 -0
- package/src/main.jsx +6 -0
- package/vite.config.js +7 -0
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:
|
|
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
|
|
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
|
-
|
|
7432
|
-
|
|
7433
|
-
label{
|
|
7427
|
+
> .label{
|
|
7434
7428
|
color:#525252;
|
|
7435
7429
|
text-wrap: nowrap;
|
|
7436
|
-
padding:
|
|
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
|
-
|
|
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:
|
|
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
|
|
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
|
-
|
|
7440
|
-
|
|
7441
|
-
label{
|
|
7435
|
+
> .label{
|
|
7442
7436
|
color:#525252;
|
|
7443
7437
|
text-wrap: nowrap;
|
|
7444
|
-
padding:
|
|
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
|
-
|
|
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/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + React</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body style="background: black;color:gray;">
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jrs-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"module": "build/index.es.js",
|
|
@@ -8,19 +8,30 @@
|
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"build": "rollup -c",
|
|
10
10
|
"storybook": "storybook dev -p 6006",
|
|
11
|
-
"build-storybook": "storybook build"
|
|
11
|
+
"build-storybook": "storybook build",
|
|
12
|
+
"vite": "vite"
|
|
12
13
|
},
|
|
13
14
|
"author": "JorenLai",
|
|
14
15
|
"license": "MIT",
|
|
15
16
|
"dependencies": {
|
|
17
|
+
"@eslint/js": "^9.21.0",
|
|
16
18
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
17
19
|
"@rollup/plugin-json": "^6.1.0",
|
|
20
|
+
"@types/react": "^19.0.10",
|
|
21
|
+
"@types/react-dom": "^19.0.4",
|
|
22
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
18
23
|
"antd": "^5.12.5",
|
|
19
24
|
"axios": "^1.6.2",
|
|
25
|
+
"eslint": "^9.21.0",
|
|
26
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
27
|
+
"eslint-plugin-react-refresh": "^0.4.19",
|
|
28
|
+
"globals": "^15.15.0",
|
|
20
29
|
"react": "^18.2.0",
|
|
21
30
|
"react-dom": "^18.2.0",
|
|
31
|
+
"react-router-dom": "^7.4.0",
|
|
22
32
|
"rollup-plugin-node-resolve": "^5.2.0",
|
|
23
|
-
"styled-components": "^6.1.15"
|
|
33
|
+
"styled-components": "^6.1.15",
|
|
34
|
+
"vite": "^6.2.0"
|
|
24
35
|
},
|
|
25
36
|
"devDependencies": {
|
|
26
37
|
"@babel/core": "^7.26.10",
|
package/public/data.json
ADDED
package/public/list.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name":"Joren"
|
|
4
|
+
,"phone":"097459999"
|
|
5
|
+
,"address":{
|
|
6
|
+
"no":"23"
|
|
7
|
+
,"street":"Jalan Indah"
|
|
8
|
+
,"country":"Malaysia"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
,{
|
|
12
|
+
"name":"John"
|
|
13
|
+
,"phone":"0124873737"
|
|
14
|
+
,"address":{
|
|
15
|
+
"no":"36"
|
|
16
|
+
,"street":"景興路"
|
|
17
|
+
,"country":"台灣"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
]
|
package/public/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/src/app/App.css
ADDED
package/src/app/App.jsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BrowserRouter, Route, Routes } from 'react-router-dom'
|
|
2
|
+
import './App.css'
|
|
3
|
+
import TableApp from './table/TableApp'
|
|
4
|
+
import FieldsApp from './fields/FieldsApp'
|
|
5
|
+
import WindowApp from './window/WindowApp'
|
|
6
|
+
|
|
7
|
+
function App() {
|
|
8
|
+
return <BrowserRouter>
|
|
9
|
+
<Routes>
|
|
10
|
+
<Route path="/table" element={<TableApp/>}/>
|
|
11
|
+
<Route path="/fields" element={<FieldsApp/>}/>
|
|
12
|
+
<Route path="/window" element={<WindowApp/>}/>
|
|
13
|
+
</Routes>
|
|
14
|
+
</BrowserRouter>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default App
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import JRFields from "../../components/JRFields/JRFields";
|
|
3
|
+
import JRText from "../../components/JRInput/JRText";
|
|
4
|
+
import JRTable from "../../components/JRTable/JRTable";
|
|
5
|
+
import { fieldsConfig } from "./fieldsConfig";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export default function FieldsApp() {
|
|
9
|
+
return <JRFields
|
|
10
|
+
{...fieldsConfig}
|
|
11
|
+
/>
|
|
12
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Input } from "antd";
|
|
2
|
+
import JRFields from "../../components/JRFields/JRFields";
|
|
3
|
+
import JRSelect from "../../components/JRInput/JRSelect";
|
|
4
|
+
import JRText from "../../components/JRInput/JRText";
|
|
5
|
+
import JRTable from "../../components/JRTable/JRTable";
|
|
6
|
+
import { po } from "../../components/JRUtils";
|
|
7
|
+
|
|
8
|
+
export const fieldsConfig={
|
|
9
|
+
popup:true
|
|
10
|
+
,mask:true
|
|
11
|
+
,width:'700px'
|
|
12
|
+
,height:'500px'
|
|
13
|
+
|
|
14
|
+
,get:{
|
|
15
|
+
url:'data.json'
|
|
16
|
+
,autoRun:true
|
|
17
|
+
,successMessage:'YES'
|
|
18
|
+
,mask:'Loading'
|
|
19
|
+
}
|
|
20
|
+
,style:{
|
|
21
|
+
padding:'18px'
|
|
22
|
+
,background:'black'
|
|
23
|
+
,gap:'20px'
|
|
24
|
+
}
|
|
25
|
+
,typeStyle:{
|
|
26
|
+
padding:'8px'
|
|
27
|
+
,background:'#eeeeee'
|
|
28
|
+
}
|
|
29
|
+
,columns:[
|
|
30
|
+
{name:'name',label:'姓名',type:JRText}
|
|
31
|
+
,{name:'birthday',label:'生日',type:Input}
|
|
32
|
+
,{name:'phone',label:'電話號碼',type:JRTable
|
|
33
|
+
,top({setStyle}){
|
|
34
|
+
return <>
|
|
35
|
+
<button
|
|
36
|
+
onClick={()=>{
|
|
37
|
+
this.get()
|
|
38
|
+
}}
|
|
39
|
+
>Get</button>
|
|
40
|
+
<button
|
|
41
|
+
onClick={()=>{
|
|
42
|
+
this.reset()
|
|
43
|
+
}}
|
|
44
|
+
>Reset</button>
|
|
45
|
+
</>
|
|
46
|
+
}
|
|
47
|
+
,bottom({setStyle}){
|
|
48
|
+
setStyle({color:'green',border:'1px solid green',height:'140px',overflow: 'overlay'})
|
|
49
|
+
return<div style={{
|
|
50
|
+
display: 'flex'
|
|
51
|
+
,justifyContent: 'space-around'
|
|
52
|
+
}}>
|
|
53
|
+
<pre style={{flex:1}}>
|
|
54
|
+
{JSON.stringify(this.getValue(),4,4)}
|
|
55
|
+
</pre>
|
|
56
|
+
<pre style={{flex:1}}>
|
|
57
|
+
{JSON.stringify(this.rawValue,4,4)}
|
|
58
|
+
</pre>
|
|
59
|
+
</div>
|
|
60
|
+
}
|
|
61
|
+
,get:{
|
|
62
|
+
url:'list.json'
|
|
63
|
+
}
|
|
64
|
+
,colSpan:2
|
|
65
|
+
,resizableColumns:true
|
|
66
|
+
,typeStyle:{
|
|
67
|
+
height:'300px'
|
|
68
|
+
}
|
|
69
|
+
,columns:[
|
|
70
|
+
{name:'name',label:'電信公司'}
|
|
71
|
+
,{name:'phone',label:'號碼',type:JRText}
|
|
72
|
+
,{
|
|
73
|
+
name:'address'
|
|
74
|
+
,label:'地址'
|
|
75
|
+
,type:JRFields
|
|
76
|
+
,labelProps:{
|
|
77
|
+
width:'min-content'
|
|
78
|
+
,style:{
|
|
79
|
+
paddingLeft:'20px'
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
,columns:[
|
|
83
|
+
{name:'no',label:'門牌',type:JRText}
|
|
84
|
+
,{name:'street',label:'街',type:JRText}
|
|
85
|
+
,{name:'country',label:'國家',type:JRSelect}
|
|
86
|
+
,{name:'p',label:'郵區',type:JRText}
|
|
87
|
+
]
|
|
88
|
+
,cols:4
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
// ,{
|
|
93
|
+
// name:'address'
|
|
94
|
+
// ,label:'地址'
|
|
95
|
+
// ,type:JRFields
|
|
96
|
+
// ,colSpan:2
|
|
97
|
+
// ,columns:[
|
|
98
|
+
// {name:'no',label:'號碼',type:JRText}
|
|
99
|
+
// ,{name:'street',label:'街',type:JRText}
|
|
100
|
+
// ,{name:'country',label:'國家',type:JRText}
|
|
101
|
+
// ]
|
|
102
|
+
// ,cols:1
|
|
103
|
+
// }
|
|
104
|
+
// ,{name:'email',label:'電子郵件',type:JRText}
|
|
105
|
+
// ,{name:'account',label:'帳號'}
|
|
106
|
+
]
|
|
107
|
+
,cols:2
|
|
108
|
+
,right({setStyle}){
|
|
109
|
+
setStyle({color:'green',border:'1px solid green',width:'100px',whiteSpace:'pre',overflow: 'overlay'})
|
|
110
|
+
return <>
|
|
111
|
+
<button
|
|
112
|
+
onClick={()=>{
|
|
113
|
+
this.get()
|
|
114
|
+
}}
|
|
115
|
+
>Get</button>
|
|
116
|
+
<button
|
|
117
|
+
onClick={()=>{
|
|
118
|
+
this.reset()
|
|
119
|
+
}}
|
|
120
|
+
>Reset</button>
|
|
121
|
+
</>
|
|
122
|
+
}
|
|
123
|
+
,bottom({setStyle}){
|
|
124
|
+
setStyle({color:'gray',border:'1px solid blue',whiteSpace:'pre',overflow: 'overlay'})
|
|
125
|
+
return <div style={{
|
|
126
|
+
display: 'flex'
|
|
127
|
+
,justifyContent: 'space-around'
|
|
128
|
+
}}>
|
|
129
|
+
<pre>
|
|
130
|
+
{JSON.stringify(this.getValue(),4,4)}
|
|
131
|
+
</pre>
|
|
132
|
+
<pre>
|
|
133
|
+
{JSON.stringify(this.rawValue,4,4)}
|
|
134
|
+
</pre>
|
|
135
|
+
</div>
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
a {
|
|
6
|
+
font-weight: 500;
|
|
7
|
+
color: #646cff;
|
|
8
|
+
text-decoration: inherit;
|
|
9
|
+
}
|
|
10
|
+
a:hover {
|
|
11
|
+
color: #535bf2;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
h1 {
|
|
18
|
+
line-height: 1.1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
button {
|
|
22
|
+
}
|
|
23
|
+
button:hover {
|
|
24
|
+
border-color: #646cff;
|
|
25
|
+
}
|
|
26
|
+
button:focus,
|
|
27
|
+
button:focus-visible {
|
|
28
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@media (prefers-color-scheme: light) {
|
|
32
|
+
:root {
|
|
33
|
+
color: #213547;
|
|
34
|
+
background-color: #ffffff;
|
|
35
|
+
}
|
|
36
|
+
a:hover {
|
|
37
|
+
color: #747bff;
|
|
38
|
+
}
|
|
39
|
+
button {
|
|
40
|
+
background-color: #f9f9f9;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import JRFields from "../../components/JRFields/JRFields";
|
|
2
|
+
import JRText from "../../components/JRInput/JRText";
|
|
3
|
+
import JRTable from "../../components/JRTable/JRTable";
|
|
4
|
+
import { tableConfig } from "./tableConfig";
|
|
5
|
+
|
|
6
|
+
export default function TableApp() {
|
|
7
|
+
return <JRTable
|
|
8
|
+
{...tableConfig}
|
|
9
|
+
/>
|
|
10
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import JRText from "../../components/JRInput/JRText";
|
|
2
|
+
|
|
3
|
+
export const tableConfig={
|
|
4
|
+
popup:true
|
|
5
|
+
,height:500
|
|
6
|
+
,width:600
|
|
7
|
+
,get:{
|
|
8
|
+
url:'list.json'
|
|
9
|
+
,autoRun:true
|
|
10
|
+
,successMessage:'YES'
|
|
11
|
+
,mask:'Loading'
|
|
12
|
+
}
|
|
13
|
+
,columns:[
|
|
14
|
+
{name:'Test',label:'1'
|
|
15
|
+
,rowSpan:4
|
|
16
|
+
,columns:[
|
|
17
|
+
{name:'Test21',label:'1_1'
|
|
18
|
+
,columns:[
|
|
19
|
+
{name:'Test21',label:'1_1_1',xdescribewidth:'20%'}
|
|
20
|
+
,{name:'Test21',label:'1_1_2',xwidth:'20%'}
|
|
21
|
+
,{name:'Test21',label:'1_1_3',xwidth:'20%'}
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
,{name:'Test22',label:'1_2',xwidth:'30%'}
|
|
26
|
+
,{name:'Test22',label:'1_3',xwidth:'30%'}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
,{name:'Test2',label:'2'
|
|
31
|
+
,columns:[
|
|
32
|
+
{name:'Test21',label:'2_1'}
|
|
33
|
+
,{name:'Test21',label:'2_2'
|
|
34
|
+
,rowSpan:4
|
|
35
|
+
,columns:[
|
|
36
|
+
{name:'Test21',label:'2_2_1'}
|
|
37
|
+
,{name:'Test21',label:'2_2_2'}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
,{name:'Test',label:'3'
|
|
44
|
+
,columns:[
|
|
45
|
+
{name:'Test21',label:'3_1'}
|
|
46
|
+
,{name:'Test22',label:'3_2'}
|
|
47
|
+
,{name:'Test22',label:'3_3'
|
|
48
|
+
,columns:[
|
|
49
|
+
{name:'Test21',label:'3_3_1'}
|
|
50
|
+
,{name:'Test21',label:'3_3_2'
|
|
51
|
+
,columns:[
|
|
52
|
+
{name:'Test21',label:'3_3_2_1'}
|
|
53
|
+
,{name:'Test21',label:'3_3_2_2'
|
|
54
|
+
,columns:[
|
|
55
|
+
{name:'Test21',label:'3_3_2_2_1'
|
|
56
|
+
,columns:[
|
|
57
|
+
{name:'Test21',label:'3_3_2_2_1_1'}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
,{name:'Test2',label:'4'
|
|
71
|
+
,columns:[
|
|
72
|
+
{name:'Test21',label:'4_1'}
|
|
73
|
+
,{name:'Test21',label:'4_2'
|
|
74
|
+
,columns:[
|
|
75
|
+
{name:'Test21',label:'4_2_1'}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
,{name:'Test2',label:'5'}
|
|
81
|
+
// ,{name:'Test2',label:'6'}
|
|
82
|
+
// ,{name:'Test2',label:'7'}
|
|
83
|
+
// ,{name:'Test2',label:'8'}
|
|
84
|
+
]
|
|
85
|
+
,resizableColumns:true
|
|
86
|
+
}
|