ydb-components-material 0.1.15 → 0.1.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.
Files changed (46) hide show
  1. package/build/docs/404.html +3 -3
  2. package/build/docs/_demos/:uuid +3 -3
  3. package/build/docs/colorful-button.html +3 -3
  4. package/build/docs/colorful-input.html +3 -3
  5. package/build/docs/index.html +3 -3
  6. package/build/docs/static/upload.5b48382d.svg +1 -0
  7. package/build/docs/{umi.c704ae1d.css → umi.04e1542b.css} +1 -1
  8. package/build/docs/umi.6c098144.js +1 -0
  9. package/build/docs/~demos/:uuid.html +3 -3
  10. package/build/docs/~demos/colorful-button-demo.html +3 -3
  11. package/build/docs/~demos/colorful-input-demo.html +3 -3
  12. package/build/lowcode/assets-daily.json +11 -11
  13. package/build/lowcode/assets-dev.json +2 -2
  14. package/build/lowcode/assets-prod.json +11 -11
  15. package/build/lowcode/index.js +1 -1
  16. package/build/lowcode/meta.js +1 -1
  17. package/build/lowcode/preview.js +8 -8
  18. package/build/lowcode/render/default/view.css +1 -1
  19. package/build/lowcode/render/default/view.js +1 -1
  20. package/build/lowcode/view.css +1 -1
  21. package/build/lowcode/view.js +1 -1
  22. package/dist/BizComps.css +1 -1
  23. package/dist/BizComps.js +1 -1
  24. package/dist/BizComps.js.map +1 -1
  25. package/es/components/file-item/icon/upload.svg +1 -0
  26. package/es/components/file-item/index.d.ts +10 -3
  27. package/es/components/file-item/index.js +120 -100
  28. package/es/components/file-item/index.scss +239 -226
  29. package/es/components/scene-tree/index.d.ts +1 -0
  30. package/es/components/scene-tree/index.js +24 -19
  31. package/lib/components/file-item/icon/upload.svg +1 -0
  32. package/lib/components/file-item/index.d.ts +10 -3
  33. package/lib/components/file-item/index.js +120 -100
  34. package/lib/components/file-item/index.scss +239 -226
  35. package/lib/components/scene-tree/index.d.ts +1 -0
  36. package/lib/components/scene-tree/index.js +24 -19
  37. package/lowcode/file-item/meta.ts +123 -18
  38. package/lowcode/scene-tree/meta.ts +15 -1
  39. package/lowcode_es/file-item/meta.js +115 -17
  40. package/lowcode_es/meta.js +1 -1
  41. package/lowcode_es/scene-tree/meta.js +13 -0
  42. package/lowcode_lib/file-item/meta.js +115 -17
  43. package/lowcode_lib/meta.js +1 -1
  44. package/lowcode_lib/scene-tree/meta.js +13 -0
  45. package/package.json +3 -3
  46. package/build/docs/umi.3311dca9.js +0 -1
@@ -1,295 +1,308 @@
1
- .file_item {
2
- border-radius: 8px;
3
- opacity: 1;
4
- background: #F7F7F7;
5
- padding: 12px;
6
-
7
- .file {
8
- display: flex;
9
- justify-content: space-between;
10
- align-items: center;
1
+ .file_main {
2
+ .file_name {
3
+ font-size: 14px;
4
+ font-weight: 500;
5
+ color: #323232;
6
+ margin-bottom: 8px;
7
+ }
8
+ .file_tip {
9
+ font-size: 12px;
10
+ color: #999999;
11
11
  margin-bottom: 12px;
12
+ }
13
+ .file_item {
14
+ border-radius: 8px;
15
+ opacity: 1;
16
+ background: #F7F7F7;
17
+ padding: 12px;
12
18
 
13
- .file_img {
14
- width: 80px;
15
- height: 80px;
16
- border-radius: 4px;
17
- position: relative;
18
- border-radius: 8px;
19
- position: relative;
19
+ .file {
20
20
  display: flex;
21
- justify-content: center;
21
+ justify-content: space-between;
22
22
  align-items: center;
23
- background: #fff;
24
- font-size: 12px;
25
- color: #666666;
26
- flex-direction: column;
23
+ margin-bottom: 12px;
27
24
 
28
- .filed {
25
+ .file_img {
26
+ width: 80px;
27
+ height: 80px;
28
+ border-radius: 4px;
29
+ position: relative;
30
+ border-radius: 8px;
31
+ position: relative;
29
32
  display: flex;
30
33
  justify-content: center;
31
34
  align-items: center;
35
+ background: #fff;
36
+ font-size: 12px;
37
+ color: #666666;
32
38
  flex-direction: column;
33
- }
34
39
 
35
- .small_img {
36
- width: 24px;
37
- height: 24px;
40
+ .filed {
41
+ display: flex;
42
+ justify-content: center;
43
+ align-items: center;
44
+ flex-direction: column;
45
+ }
38
46
 
39
- }
47
+ .small_img {
48
+ width: 24px;
49
+ height: 24px;
40
50
 
41
- .add {
42
- display: flex;
43
- flex-direction: column;
44
- justify-content: center;
45
- align-items: center;
46
- .add_icon {
47
- width: 14px;
48
- margin-left: -5px;
49
51
  }
50
- color: #1678FF;
51
- }
52
52
 
53
- .del {
54
- position: absolute;
55
- width: 16px;
56
- height: 16px;
57
- top: -6px;
58
- right: -6px;
59
- z-index: 9;
60
- }
53
+ .add {
54
+ display: flex;
55
+ flex-direction: column;
56
+ justify-content: center;
57
+ align-items: center;
58
+ .add_icon {
59
+ width: 14px;
60
+ margin-left: -5px;
61
+ }
62
+ color: #1678FF;
63
+ }
61
64
 
62
- .error_msg {
63
- position: absolute;
64
- top: 30px;
65
- right: 22px;
66
- }
65
+ .del {
66
+ position: absolute;
67
+ width: 16px;
68
+ height: 16px;
69
+ top: -6px;
70
+ right: -6px;
71
+ z-index: 9;
72
+ }
67
73
 
68
- .mask {
69
- // display: none !important;
70
- border-radius: 8px;
71
- position: absolute;
72
- top: 0;
73
- left: 0;
74
- width: 100%;
75
- height: 100%;
76
- // opacity: 0.5;
77
- background: #2222227d;
78
- display: flex;
79
- justify-content: center;
80
- align-items: center;
81
- color: #fff;
82
- z-index: 8;
74
+ .error_msg {
75
+ position: absolute;
76
+ top: 30px;
77
+ right: 22px;
78
+ }
83
79
 
84
- .checked {
80
+ .mask {
81
+ // display: none !important;
82
+ border-radius: 8px;
83
+ position: absolute;
84
+ top: 0;
85
+ left: 0;
86
+ width: 100%;
87
+ height: 100%;
88
+ // opacity: 0.5;
89
+ background: #2222227d;
85
90
  display: flex;
91
+ justify-content: center;
86
92
  align-items: center;
93
+ color: #fff;
94
+ z-index: 8;
87
95
 
88
- img {
89
- width: 14px;
90
- height: 14px;
91
- margin-right: 3px;
96
+ .checked {
97
+ display: flex;
98
+ align-items: center;
99
+
100
+ img {
101
+ width: 14px;
102
+ height: 14px;
103
+ margin-right: 3px;
104
+ }
92
105
  }
93
106
  }
94
107
  }
95
- }
96
108
 
97
- .operation {
98
- .btn {
99
- display: flex;
100
- flex-direction: row;
109
+ .operation {
110
+ .btn {
111
+ display: flex;
112
+ flex-direction: row;
113
+
114
+ .img_btn {
115
+ margin-left: 8px;
116
+ width: 68px;
117
+ height: 26px;
118
+ border-radius: 4px;
119
+ opacity: 1;
120
+ box-sizing: border-box;
121
+ border: 1px solid #1678FF;
122
+ color: #1678FF;
123
+ font-size: 13px;
124
+ line-height: 26px;
125
+ text-align: center;
126
+ cursor: pointer;
127
+ }
101
128
 
102
- .img_btn {
129
+ }
130
+ .operation_btn {
131
+ cursor: pointer;
103
132
  margin-left: 8px;
104
133
  width: 68px;
105
134
  height: 26px;
106
135
  border-radius: 4px;
107
136
  opacity: 1;
108
137
  box-sizing: border-box;
109
- border: 1px solid #1678FF;
110
- color: #1678FF;
138
+ background: linear-gradient(90deg, #73AEFF 0%, #1678FF 100%);
139
+ color: #fff;
111
140
  font-size: 13px;
112
141
  line-height: 26px;
113
142
  text-align: center;
114
- cursor: pointer;
115
143
  }
116
-
117
- }
118
- .operation_btn {
119
- cursor: pointer;
120
- margin-left: 8px;
121
- width: 68px;
122
- height: 26px;
123
- border-radius: 4px;
124
- opacity: 1;
125
- box-sizing: border-box;
126
- background: linear-gradient(90deg, #73AEFF 0%, #1678FF 100%);
127
- color: #fff;
128
- font-size: 13px;
129
- line-height: 26px;
130
- text-align: center;
131
144
  }
132
145
  }
133
- }
134
-
135
- .file_item_bottom {
136
- border-top: 1px solid #EAEAEA;
137
- display: flex;
138
- display: flex;
139
- justify-content: space-evenly;
140
- align-items: center;
141
- padding-top: 12px;
142
-
143
- .line {
144
- width: 1px;
145
- height: 20px;
146
- background-color: #EAEAEA;
147
- }
148
146
 
149
- .icon_text {
147
+ .file_item_bottom {
148
+ border-top: 1px solid #EAEAEA;
150
149
  display: flex;
150
+ display: flex;
151
+ justify-content: space-evenly;
151
152
  align-items: center;
152
- font-size: 14px;
153
- color: #1678FF;
153
+ padding-top: 12px;
154
+
155
+ .line {
156
+ width: 1px;
157
+ height: 20px;
158
+ background-color: #EAEAEA;
159
+ }
160
+
161
+ .icon_text {
162
+ display: flex;
163
+ align-items: center;
164
+ font-size: 14px;
165
+ color: #1678FF;
154
166
 
155
- img {
156
- width: 16px;
157
- height: 11px;
158
- margin-right: 5px;
167
+ img {
168
+ width: 16px;
169
+ height: 11px;
170
+ margin-right: 5px;
159
171
 
172
+ }
160
173
  }
161
174
  }
162
- }
163
175
 
164
- .img_view {
165
- position: absolute;
166
- top: 0;
167
- left: 0;
168
- width: 100%;
169
- height: 100%;
170
- background-color: rgba(0, 0, 0, 0.5);
171
- display: flex;
172
- justify-content: center;
173
- align-items: center;
174
-
175
- .close {
176
- width: 17px;
177
- height: 17px;
178
- color: #fff;
176
+ .img_view {
179
177
  position: absolute;
180
- top: 40px;
181
- right: 20px;
182
- }
183
-
184
- .view {
178
+ top: 0;
179
+ left: 0;
185
180
  width: 100%;
186
- height: auto;
187
- }
188
- }
181
+ height: 100%;
182
+ background-color: rgba(0, 0, 0, 0.5);
183
+ display: flex;
184
+ justify-content: center;
185
+ align-items: center;
189
186
 
190
- .material_lib {
191
- width: 100%;
192
- height: 100%;
193
- position: absolute;
194
- top: 0;
195
- left: 0;
196
- z-index: 999;
197
- background-color: rgba(0, 0, 0, 0.5);
187
+ .close {
188
+ width: 17px;
189
+ height: 17px;
190
+ color: #fff;
191
+ position: absolute;
192
+ top: 40px;
193
+ right: 20px;
194
+ }
195
+
196
+ .view {
197
+ width: 100%;
198
+ height: auto;
199
+ }
200
+ }
198
201
 
199
- .material_lib_content {
202
+ .material_lib {
200
203
  width: 100%;
204
+ height: 100%;
201
205
  position: absolute;
202
- bottom: 0;
206
+ top: 0;
203
207
  left: 0;
204
- background-color: #fff;
205
- border-radius: 16px 16px 0px 0px;
206
-
207
- .material_lib_title {
208
- font-size: 16px;
209
- color: #333333;
210
- line-height: 54px;
211
- text-align: center;
212
- }
213
-
214
- .tips {
215
- padding: 12px;
216
- background: #FFF6E8;
217
- font-size: 14px;
218
- line-height: 24px;
219
- color: #F29655;
220
- display: flex;
221
- align-items: flex-start;
222
-
223
- img {
224
- width: 14px;
225
- height: 14px;
226
- margin-right: 8px;
227
- margin-top: 5px;
228
- }
229
- }
208
+ z-index: 999;
209
+ background-color: rgba(0, 0, 0, 0.5);
230
210
 
231
- .list {
232
- padding: 12px 12px 0 12px;
211
+ .material_lib_content {
233
212
  width: 100%;
234
- background-color: #F5F5F5;
235
- margin-bottom: 64px;
236
- max-height: 300px;
237
- overflow: auto;
213
+ position: absolute;
214
+ bottom: 0;
215
+ left: 0;
216
+ background-color: #fff;
217
+ border-radius: 16px 16px 0px 0px;
238
218
 
239
- .item {
240
- padding: 16px 12px;
241
- border-radius: 8px;
242
- background: #FFF;
243
- display: flex;
244
- align-items: center;
219
+ .material_lib_title {
220
+ font-size: 16px;
245
221
  color: #333333;
222
+ line-height: 54px;
223
+ text-align: center;
224
+ }
225
+
226
+ .tips {
227
+ padding: 12px;
228
+ background: #FFF6E8;
246
229
  font-size: 14px;
247
- width: 100%;
248
- margin-bottom: 12px;
230
+ line-height: 24px;
231
+ color: #F29655;
232
+ display: flex;
233
+ align-items: flex-start;
234
+
235
+ img {
236
+ width: 14px;
237
+ height: 14px;
238
+ margin-right: 8px;
239
+ margin-top: 5px;
240
+ }
241
+ }
249
242
 
250
- .preview_icon {
251
- margin-left: auto;
243
+ .list {
244
+ padding: 12px 12px 0 12px;
245
+ width: 100%;
246
+ background-color: #F5F5F5;
247
+ margin-bottom: 64px;
248
+ max-height: 300px;
249
+ overflow: auto;
250
+
251
+ .item {
252
+ padding: 16px 12px;
253
+ border-radius: 8px;
254
+ background: #FFF;
252
255
  display: flex;
253
256
  align-items: center;
254
- color: #1678FF;
255
-
256
- img {
257
- width: 16px;
258
- margin-right: 4px;
257
+ color: #333333;
258
+ font-size: 14px;
259
+ width: 100%;
260
+ margin-bottom: 12px;
261
+
262
+ .preview_icon {
263
+ margin-left: auto;
264
+ display: flex;
265
+ align-items: center;
266
+ color: #1678FF;
267
+
268
+ img {
269
+ width: 16px;
270
+ margin-right: 4px;
271
+ }
259
272
  }
260
273
  }
261
274
  }
262
- }
263
-
264
- .bottom_btn {
265
- background-color: #fff;
266
- height: 64px;
267
- display: flex;
268
- align-items: center;
269
- justify-content: space-around;
270
- position: fixed;
271
- bottom: 0;
272
- left: 0;
273
- right: 0;
274
-
275
- .btn {
276
- width: 169px;
277
- height: 40px;
278
- border-radius: 50px;
279
- font-size: 16px;
280
- line-height: 40px;
281
- text-align: center;
282
- }
283
275
 
284
- .cancel {
276
+ .bottom_btn {
285
277
  background-color: #fff;
286
- border: 1px solid #E7E7E7;
287
- color: #333;
288
- }
278
+ height: 64px;
279
+ display: flex;
280
+ align-items: center;
281
+ justify-content: space-around;
282
+ position: fixed;
283
+ bottom: 0;
284
+ left: 0;
285
+ right: 0;
286
+
287
+ .btn {
288
+ width: 169px;
289
+ height: 40px;
290
+ border-radius: 50px;
291
+ font-size: 16px;
292
+ line-height: 40px;
293
+ text-align: center;
294
+ }
289
295
 
290
- .ok {
291
- background: linear-gradient(90deg, #73AEFF 0%, #1678FF 100%);
292
- color: #fff;
296
+ .cancel {
297
+ background-color: #fff;
298
+ border: 1px solid #E7E7E7;
299
+ color: #333;
300
+ }
301
+
302
+ .ok {
303
+ background: linear-gradient(90deg, #73AEFF 0%, #1678FF 100%);
304
+ color: #fff;
305
+ }
293
306
  }
294
307
  }
295
308
  }
@@ -5,6 +5,7 @@ export interface SceneTreeProps {
5
5
  */
6
6
  dataSource?: object;
7
7
  style?: object;
8
+ valChange?: (value: any) => void;
8
9
  }
9
10
  declare const SceneTree: React.FC<SceneTreeProps>;
10
11
  export default SceneTree;
@@ -18,7 +18,8 @@ var RadioGroup = _radio["default"].Group;
18
18
  var SceneTree = function SceneTree(_ref) {
19
19
  var dataSource = _ref.dataSource,
20
20
  _ref$style = _ref.style,
21
- style = _ref$style === void 0 ? {} : _ref$style;
21
+ style = _ref$style === void 0 ? {} : _ref$style,
22
+ valChange = _ref.valChange;
22
23
  var _useState = (0, _react.useState)(function () {
23
24
  console.log('---', dataSource);
24
25
  if (dataSource) {
@@ -122,19 +123,22 @@ var SceneTree = function SceneTree(_ref) {
122
123
  // }
123
124
 
124
125
  var onValChange = function onValChange(val, e) {
125
- var targetId = +e.target.id;
126
+ console.log('====', e.target);
127
+ var targetId = e.target.id.split('+')[0];
128
+ var targetPId = e.target.id.split('+')[1];
129
+ console.log(targetId, targetPId);
126
130
 
127
- // 根据ID查找节点的辅助函数
128
- var _findNodeById = function findNodeById(currentNode, id) {
129
- console.log('currentNode', currentNode, id);
130
- if (currentNode.id === id) {
131
+ // 根据id和pid找到对应的题目节点
132
+ var _findNodeById = function findNodeById(currentNode, id, pid) {
133
+ console.log('currentNode', currentNode, id, pid);
134
+ if (String(currentNode.id) === id && String(currentNode.pid) === pid) {
131
135
  return currentNode;
132
136
  }
133
137
  if (currentNode.options) {
134
138
  for (var _iterator = _createForOfIteratorHelperLoose(currentNode.options), _step; !(_step = _iterator()).done;) {
135
139
  var child = _step.value;
136
140
  console.log('child', child);
137
- var found = _findNodeById(child, id);
141
+ var found = _findNodeById(child, id, pid);
138
142
  console.log('found', found);
139
143
  if (found) return found;
140
144
  }
@@ -142,34 +146,33 @@ var SceneTree = function SceneTree(_ref) {
142
146
  if (currentNode.children) {
143
147
  for (var _iterator2 = _createForOfIteratorHelperLoose(currentNode.children), _step2; !(_step2 = _iterator2()).done;) {
144
148
  var _child = _step2.value;
145
- var _found = _findNodeById(_child, id);
149
+ var _found = _findNodeById(_child, id, pid);
146
150
  if (_found) return _found;
147
151
  }
148
152
  }
149
153
  return null;
150
154
  };
151
155
  // 在源数据中找到对应的题目
152
- var targetNodeOfOriginTree = _findNodeById(dataSource, targetId);
156
+ var targetNodeOfOriginTree = _findNodeById(dataSource, targetId, targetPId);
153
157
  console.log('targetNodeOfOriginTree', targetNodeOfOriginTree);
154
158
  // 找到题目下选中的那个选项
155
159
  var targetOption = targetNodeOfOriginTree.options.find(function (item) {
156
160
  return item.value === val;
157
161
  });
158
162
  // 拿到选中选项的子题目
159
- var targetNodeChildList = targetOption.children.map(function (item) {
163
+ var targetNodeChildList = (targetOption.children || []).map(function (item) {
160
164
  delete item.children;
165
+ delete item.value;
161
166
  return item;
162
167
  });
163
168
  // 找到当前树中对应的那个题目
164
- var targetNodeOfCurTree = _findNodeById(curTree, targetId);
169
+ var targetNodeOfCurTree = _findNodeById(curTree, targetId, targetPId);
165
170
  // 把子题目添加到当前树中
166
171
  targetNodeOfCurTree.children = targetNodeChildList;
167
172
  targetNodeOfCurTree.value = val;
168
- console.log('targetNode', targetNodeOfOriginTree);
169
- console.log('curTree', curTree);
173
+ targetNodeOfCurTree.optionName = targetOption.name;
170
174
  setCurTree((0, _extends2["default"])({}, curTree));
171
- // console.log('target', findNodeById(dataSource, targetId))
172
- console.log('val', val, e, targetId);
175
+ valChange(curTree);
173
176
  };
174
177
  var _TreeNode = function TreeNode(_ref2) {
175
178
  var node = _ref2.node;
@@ -178,7 +181,7 @@ var SceneTree = function SceneTree(_ref) {
178
181
  label: node.title,
179
182
  required: true,
180
183
  style: {
181
- borderBottom: node.children ? '1px solid #EEEEEE' : '',
184
+ borderBottom: node.children && node.children.length ? '1px solid #EEEEEE' : '',
182
185
  paddingBottom: node.children ? '16px' : ''
183
186
  }
184
187
  }, /*#__PURE__*/React.createElement(RadioGroup, {
@@ -187,11 +190,13 @@ var SceneTree = function SceneTree(_ref) {
187
190
  "aria-labelledby": "groupId"
188
191
  }, node.options.map(function (option) {
189
192
  return /*#__PURE__*/React.createElement(_radio["default"], {
190
- id: option.pid,
193
+ id: option.pid + "+" + node.pid,
194
+ key: option.id + node.pid + option.value,
191
195
  value: option.value
192
196
  }, option.name);
193
- }))), node.children && node.children.map(function (item) {
197
+ }))), node.children && (node.children || []).map(function (item) {
194
198
  return /*#__PURE__*/React.createElement(_TreeNode, {
199
+ key: item.id + item.pid,
195
200
  node: item
196
201
  });
197
202
  }));
@@ -199,7 +204,7 @@ var SceneTree = function SceneTree(_ref) {
199
204
  return /*#__PURE__*/React.createElement("div", {
200
205
  className: "SceneTree",
201
206
  style: style
202
- }, curTree && curTree.title ? /*#__PURE__*/React.createElement(_TreeNode, {
207
+ }, curTree ? /*#__PURE__*/React.createElement(_TreeNode, {
203
208
  node: curTree
204
209
  }) : null);
205
210
  };