@yanqirenshi/table.wbs 0.0.14 → 0.0.16

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.
@@ -0,0 +1,17 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(node -e \"console.log\\(require\\('./node_modules/react/package.json'\\).version\\)\")",
5
+ "Bash(npm install *)",
6
+ "Bash(npm test *)",
7
+ "Bash(git stash *)",
8
+ "Bash(npm view *)",
9
+ "Bash(npx react-scripts *)",
10
+ "Bash(SKIP_PREFLIGHT_CHECK=true CI=true npx react-scripts test --watchAll=false)",
11
+ "Bash(SKIP_PREFLIGHT_CHECK=true CI=true npx react-scripts build)",
12
+ "Bash(SKIP_PREFLIGHT_CHECK=true BROWSER=none npx react-scripts start)",
13
+ "Bash(kill %1)",
14
+ "Bash(wait)"
15
+ ]
16
+ }
17
+ }
package/README.md CHANGED
@@ -1,3 +1,103 @@
1
1
  # table.WBS
2
2
 
3
+ ## Usage
4
+
3
5
  See: examples/
6
+
7
+ ### (1) Code
8
+
9
+ ```
10
+ import React from 'react';
11
+
12
+ import WBSTable from '@yanqirenshi/table.wbs';
13
+
14
+ import * as WBS_DATA from './data.js';
15
+
16
+ export default function Example() {
17
+ const columns = [
18
+ {
19
+ label: 'Code',
20
+ leveling: true,
21
+ required: true,
22
+ contents: (c, d) => {
23
+ return <>{d._id}</>;
24
+ }
25
+ },
26
+ {
27
+ label: 'Name',
28
+ required: true,
29
+ contents: (c, d) => {
30
+ return <span>{d.label}</span>;
31
+ },
32
+ },
33
+ {
34
+ label: 'Description',
35
+ contents: (c, d) => {
36
+ return d.description;
37
+ }
38
+ },
39
+ ];
40
+
41
+ const wbs_source = {
42
+ projects: WBS_DATA.PROJECTS,
43
+ wbs: WBS_DATA.WBS,
44
+ workpackages: WBS_DATA.WORKPACKAGES,
45
+ edges: WBS_DATA.EDGES,
46
+ };
47
+
48
+ const options = {}; // or null
49
+ const style_table = { fontSize: '16px' }; // or null
50
+ return (
51
+ <div style={{padding: '33px'}}>
52
+ <WBSTable source={wbs_source}
53
+ columns={columns}
54
+ options={options}
55
+ style={style_table}/>
56
+ </div>
57
+ );
58
+ }
59
+ ```
60
+
61
+ ### (2) Data
62
+
63
+ ```
64
+ export const PROJECTS = [
65
+ {
66
+ _id: 1,
67
+ _class: 'PROJECT',
68
+ label: 'a',
69
+ }
70
+ ];
71
+ export const WBS = [
72
+ {
73
+ _id: 10,
74
+ _class: 'WBS',
75
+ label: 'b',
76
+ }
77
+ ];
78
+ export const WORKPACKAGES = [
79
+ {
80
+ _id: 100,
81
+ _class: 'WORKPACKAGE',
82
+ label: 'c',
83
+ }
84
+ ];
85
+
86
+ let i = 10000000;
87
+ export const EDGES = [
88
+ {
89
+ _id: i++,
90
+ from_id: 1,
91
+ from_class: 'PROJECT',
92
+ to_id: 10,
93
+ to_class: 'WBS',
94
+ },
95
+ {
96
+ _id: i++,
97
+ from_id: 10,
98
+ from_class: 'WBS',
99
+ to_id: 100,
100
+ to_class: 'WORKPACKAGE',
101
+ },
102
+ ];
103
+ ```
package/dist/WBSTable.js CHANGED
@@ -71,6 +71,11 @@ function WBSTable(props) {
71
71
  filter_wp = _useState12[0],
72
72
  setFilterWp = _useState12[1];
73
73
 
74
+ var _useState13 = (0, _react.useState)(false),
75
+ _useState14 = _slicedToArray(_useState13, 2),
76
+ bilding = _useState14[0],
77
+ setBilding = _useState14[1];
78
+
74
79
  var data = props.source;
75
80
  var options = props.options;
76
81
  var start_id = props.start_id;
@@ -82,14 +87,16 @@ function WBSTable(props) {
82
87
  while (1) {
83
88
  switch (_context.prev = _context.next) {
84
89
  case 0:
90
+ setBilding(true);
85
91
  setRecords(colon.build({
86
92
  data: data,
87
93
  options: options,
88
94
  start_id: start_id,
89
95
  flatten: true
90
96
  }));
97
+ setBilding(false);
91
98
 
92
- case 1:
99
+ case 3:
93
100
  case "end":
94
101
  return _context.stop();
95
102
  }
@@ -134,6 +141,13 @@ function WBSTable(props) {
134
141
  if (_download) _download();
135
142
  }
136
143
  };
144
+ var style_loading = {
145
+ width: '100%',
146
+ height: 333,
147
+ display: 'flex',
148
+ justifyContent: 'center',
149
+ alignItems: 'center'
150
+ };
137
151
  return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(Comps.Controller, {
138
152
  open: chooser_column,
139
153
  visible_wp: visible_wp,
@@ -147,7 +161,14 @@ function WBSTable(props) {
147
161
  }, /*#__PURE__*/_react["default"].createElement(Comps.ChooserColumn, {
148
162
  columns: columns,
149
163
  callbacks: callbacks
150
- }))), /*#__PURE__*/_react["default"].createElement("table", {
164
+ }))), bilding && /*#__PURE__*/_react["default"].createElement("div", {
165
+ style: style_loading
166
+ }, /*#__PURE__*/_react["default"].createElement("p", {
167
+ style: {
168
+ fontSize: 33,
169
+ color: '#888'
170
+ }
171
+ }, "Waiting for ........")), !bilding && /*#__PURE__*/_react["default"].createElement("table", {
151
172
  className: "table is-fullwidth is-striped is-narrow is-hoverable",
152
173
  style: style
153
174
  }, /*#__PURE__*/_react["default"].createElement(Comps.THead, {
Binary file