@titaui/pc 1.11.3 → 1.11.4-2

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 (81) hide show
  1. package/lib/components/button/icon-btn/index.js +17 -8
  2. package/lib/components/drop-selector/index.js +25 -10
  3. package/lib/components/dynamic/constant.js +2 -1
  4. package/lib/components/dynamic/dynamic-item/dynamic-interview/img/wifi.svg +24 -0
  5. package/lib/components/dynamic/dynamic-item/dynamic-interview/index.css +51 -0
  6. package/lib/components/dynamic/dynamic-item/dynamic-interview/index.js +51 -0
  7. package/lib/components/dynamic/dynamic-item/dynamic-interview/interview-content.js +65 -0
  8. package/lib/components/dynamic/dynamic-item/dynamic-interview-share/img/wifi.svg +24 -0
  9. package/lib/components/dynamic/dynamic-item/dynamic-interview-share/index.css +61 -0
  10. package/lib/components/dynamic/dynamic-item/dynamic-interview-share/index.js +54 -0
  11. package/lib/components/dynamic/dynamic-item/dynamic-interview-share/interview-content.js +69 -0
  12. package/lib/components/dynamic/dynamic-item/index.js +17 -0
  13. package/lib/components/form/form-fields/date/index.css +24 -0
  14. package/lib/components/form/form-fields/date/index.js +98 -0
  15. package/lib/components/form/form-fields/user/index.css +1 -1
  16. package/lib/components/form/index.js +10 -3
  17. package/lib/components/menus/export-modules/interview-menus/constant.js +30 -0
  18. package/lib/components/menus/export-modules/interview-menus/handle-highlight.js +63 -0
  19. package/lib/components/menus/export-modules/interview-menus/index.js +126 -0
  20. package/lib/components/menus/index.js +11 -5
  21. package/lib/components/picker/components/panels/date-panel/date-body.js +116 -0
  22. package/lib/components/picker/components/panels/date-panel/date-head.js +66 -0
  23. package/lib/components/picker/components/panels/date-panel/index.css +14 -0
  24. package/lib/components/picker/components/panels/date-panel/index.js +49 -0
  25. package/lib/components/picker/components/panels/month-panel/index.css +27 -0
  26. package/lib/components/picker/components/panels/month-panel/index.js +63 -0
  27. package/lib/components/picker/components/panels/month-panel/month-body.js +87 -0
  28. package/lib/components/picker/components/panels/month-panel/month-head.js +47 -0
  29. package/lib/components/picker/components/panels/panel-body/index.js +53 -0
  30. package/lib/components/picker/components/panels/panel-head/index.js +48 -0
  31. package/lib/components/picker/components/panels/year-panel/index.css +23 -0
  32. package/lib/components/picker/components/panels/year-panel/index.js +65 -0
  33. package/lib/components/picker/components/panels/year-panel/year-body.js +92 -0
  34. package/lib/components/picker/components/panels/year-panel/year-head.js +35 -0
  35. package/lib/components/picker/components/picker-trigger/index.css +42 -0
  36. package/lib/components/picker/components/picker-trigger/index.js +94 -0
  37. package/lib/components/picker/context.js +15 -0
  38. package/lib/components/picker/index.css +121 -0
  39. package/lib/components/picker/index.js +13 -0
  40. package/lib/components/picker/picker-panels.js +182 -0
  41. package/lib/components/picker/picker.js +132 -0
  42. package/lib/components/picker/type.js +5 -0
  43. package/lib/components/picker/utils.js +28 -0
  44. package/lib/components/task-tree/helper.js +61 -0
  45. package/lib/components/task-tree/images/P1.svg +15 -0
  46. package/lib/components/task-tree/images/P2.svg +15 -0
  47. package/lib/components/task-tree/images/P3.svg +15 -0
  48. package/lib/components/task-tree/images/P4.svg +15 -0
  49. package/lib/components/task-tree/images/P5.svg +15 -0
  50. package/lib/components/task-tree/images/arrow.svg +9 -0
  51. package/lib/components/task-tree/images/empty-131.png +0 -0
  52. package/lib/components/task-tree/images/followed.svg +33 -0
  53. package/lib/components/task-tree/images/nice.svg +108 -0
  54. package/lib/components/task-tree/images/struc12.png +0 -0
  55. package/lib/components/task-tree/images/struc2.png +0 -0
  56. package/lib/components/task-tree/images/xialat-s.svg +13 -0
  57. package/lib/components/task-tree/index.js +27 -0
  58. package/lib/components/task-tree/mock.js +944 -0
  59. package/lib/components/task-tree/precls.js +8 -0
  60. package/lib/components/task-tree/request-apis.js +88 -0
  61. package/lib/components/task-tree/task-item-node/constant.js +45 -0
  62. package/lib/components/task-tree/task-item-node/e-empty.js +29 -0
  63. package/lib/components/task-tree/task-item-node/e-project.js +195 -0
  64. package/lib/components/task-tree/task-item-node/e-status-dropdown.js +94 -0
  65. package/lib/components/task-tree/task-item-node/e-task.js +431 -0
  66. package/lib/components/task-tree/task-item-node/get-process-color.js +62 -0
  67. package/lib/components/task-tree/task-item-node/index.css +290 -0
  68. package/lib/components/task-tree/task-item-node/task-node-render.js +43 -0
  69. package/lib/components/task-tree/task-tree.css +8 -0
  70. package/lib/components/task-tree/task-tree.js +49 -0
  71. package/lib/components/time-picker/index.css +117 -0
  72. package/lib/components/time-picker/index.js +13 -0
  73. package/lib/components/time-picker/time-picker-selector.js +138 -0
  74. package/lib/components/time-picker/time-picker.js +324 -0
  75. package/lib/components/time-picker/timer-picker-input.js +94 -0
  76. package/lib/components/time-picker/utils.js +52 -0
  77. package/lib/index.js +24 -0
  78. package/lib/pages/aha2021/index.js +5 -1
  79. package/lib/utils/hooks.js +72 -0
  80. package/package.json +1 -1
  81. package/yarn-error.log +22184 -0
@@ -0,0 +1,290 @@
1
+ .titaui-task-tree__e-task-node {
2
+ display: flex;
3
+ align-items: center;
4
+ padding: 2px 0;
5
+ width: 100%;
6
+ }
7
+
8
+ .titaui-task-tree__e-task-node-prefix {
9
+ position: relative;
10
+ top: 2px;
11
+ display: inline-block;
12
+ width: 21px;
13
+ vertical-align: top;
14
+ }
15
+
16
+ .titaui-task-tree__e-task-node-prefix .tu-icon-jiantou-right:before {
17
+ color: #89919f;
18
+ }
19
+
20
+ .titaui-task-tree__e-task-node-title {
21
+ height: 22px;
22
+ font-size: 14px;
23
+ font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
24
+ color: #3f4755;
25
+ line-height: 22px;
26
+ overflow: hidden;
27
+ white-space: nowrap;
28
+ word-break: keep-all;
29
+ padding-top: 1px;
30
+ flex: 1;
31
+ }
32
+
33
+ .titaui-task-tree__e-task-node-priority {
34
+ display: inline-block;
35
+ margin-right: 4px;
36
+ vertical-align: top;
37
+ }
38
+
39
+ .titaui-task-tree__e-task-node-priority > span {
40
+ position: relative;
41
+ top: 1px;
42
+ display: inline-block;
43
+ vertical-align: text-bottom;
44
+ height: 16px;
45
+ width: 16px;
46
+ }
47
+
48
+ .titaui-task-tree__e-task-node-priority-p1 {
49
+ background: url(../images/P1.svg) transparent no-repeat 50% 50%;
50
+ }
51
+
52
+ .titaui-task-tree__e-task-node-priority-p2 {
53
+ background: url(../images/P2.svg) transparent no-repeat 50% 50%;
54
+ }
55
+
56
+ .titaui-task-tree__e-task-node-priority-p3 {
57
+ background: url(../images/P3.svg) transparent no-repeat 50% 50%;
58
+ }
59
+
60
+ .titaui-task-tree__e-task-node-priority-p4 {
61
+ background: url(../images/P4.svg) transparent no-repeat 50% 50%;
62
+ }
63
+
64
+ .titaui-task-tree__e-task-node-priority-p5 {
65
+ background: url(../images/P5.svg) transparent no-repeat 50% 50%;
66
+ }
67
+
68
+ .titaui-task-tree__e-task-node-actions {
69
+ display: flex;
70
+ align-items: center;
71
+ float: right;
72
+ }
73
+
74
+ .titaui-task-tree__e-task-node-actions-user {
75
+ display: inline-block;
76
+ width: 64px;
77
+ margin-left: 16px;
78
+ }
79
+
80
+ .titaui-task-tree__e-task-node-actions-date {
81
+ font-size: 12px;
82
+ font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
83
+ color: #89919f;
84
+ line-height: 18px;
85
+ display: inline-flex;
86
+ align-items: center;
87
+ justify-content: flex-end;
88
+ box-sizing: border-box;
89
+ width: 78px;
90
+ height: 26px;
91
+ padding: 4px;
92
+ text-align: left;
93
+ line-height: 26px;
94
+ }
95
+
96
+ .titaui-task-tree__e-task-node-actions-date > span {
97
+ vertical-align: text-bottom;
98
+ }
99
+
100
+ .titaui-task-tree__e-task-node-actions-progress {
101
+ position: relative;
102
+ top: 3px;
103
+ color: #89919f;
104
+ cursor: auto;
105
+ width: 64px;
106
+ margin-left: 16px;
107
+ margin-right: 4px;
108
+ }
109
+
110
+ .titaui-task-tree__e-task-node-actions-progress .tooltip-text-wrapper {
111
+ margin-left: 4px;
112
+ }
113
+
114
+ .titaui-task-tree__e-task-node-actions-connect {
115
+ display: inline-block;
116
+ color: #cccccc;
117
+ margin-left: 27px;
118
+ margin-right: 10px;
119
+ }
120
+
121
+ .titaui-task-tree__e-task-node-actions-connect:hover {
122
+ color: #2879ff;
123
+ }
124
+
125
+ .titaui-task-tree__e-task-node-select-priority {
126
+ display: inline-block;
127
+ width: 16px;
128
+ height: 16px;
129
+ margin-right: 10px;
130
+ vertical-align: text-bottom;
131
+ }
132
+
133
+ .titaui-task-tree__e-project-node {
134
+ position: relative;
135
+ display: flex;
136
+ align-items: center;
137
+ width: 100%;
138
+ padding: 2px 0;
139
+ }
140
+
141
+ .titaui-task-tree__e-project-node-prefix {
142
+ display: inline-block;
143
+ font-size: 14px;
144
+ width: 21px;
145
+ color: #89919f;
146
+ line-height: 1;
147
+ }
148
+
149
+ .titaui-task-tree__e-project-node-title {
150
+ display: inline-flex;
151
+ font-size: 14px;
152
+ font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
153
+ color: #3f4755;
154
+ line-height: 22px;
155
+ overflow: hidden;
156
+ white-space: nowrap;
157
+ word-break: keep-all;
158
+ flex: 1;
159
+ }
160
+
161
+ .titaui-task-tree__e-project-node-title-name {
162
+ overflow: hidden;
163
+ }
164
+
165
+ .titaui-task-tree__e-project-node-title-approvaling {
166
+ display: inline-flex;
167
+ align-items: center;
168
+ justify-content: center;
169
+ min-width: 36px;
170
+ padding: 0 6px;
171
+ height: 20px;
172
+ font-size: 12px;
173
+ font-weight: 400;
174
+ color: #f05e5e;
175
+ background: rgba(240, 94, 94, 0.1);
176
+ border-radius: 10px;
177
+ margin-left: 8px;
178
+ }
179
+
180
+ .titaui-task-tree__e-project-node-gray {
181
+ color: #bfc7d5 !important;
182
+ }
183
+
184
+ .titaui-task-tree__e-project-node-priority {
185
+ display: inline-block;
186
+ margin-right: 4px;
187
+ vertical-align: top;
188
+ }
189
+
190
+ .titaui-task-tree__e-project-node-priority > span {
191
+ position: relative;
192
+ top: 1px;
193
+ display: inline-block;
194
+ vertical-align: text-bottom;
195
+ height: 16px;
196
+ width: 16px;
197
+ }
198
+
199
+ .titaui-task-tree__e-project-node-priority-p1 {
200
+ background: url(../images/P1.svg) transparent no-repeat 50% 50%;
201
+ }
202
+
203
+ .titaui-task-tree__e-project-node-priority-p2 {
204
+ background: url(../images/P2.svg) transparent no-repeat 50% 50%;
205
+ }
206
+
207
+ .titaui-task-tree__e-project-node-priority-p3 {
208
+ background: url(../images/P3.svg) transparent no-repeat 50% 50%;
209
+ }
210
+
211
+ .titaui-task-tree__e-project-node-priority-p4 {
212
+ background: url(../images/P4.svg) transparent no-repeat 50% 50%;
213
+ }
214
+
215
+ .titaui-task-tree__e-project-node-priority-p5 {
216
+ background: url(../images/P5.svg) transparent no-repeat 50% 50%;
217
+ }
218
+
219
+ .titaui-task-tree__e-project-node-actions {
220
+ display: flex;
221
+ align-items: center;
222
+ float: right;
223
+ }
224
+
225
+ .titaui-task-tree__e-project-node-actions-user {
226
+ display: inline-block;
227
+ width: 64px;
228
+ margin-left: 16px;
229
+ }
230
+
231
+ .titaui-task-tree__e-project-node-actions-date {
232
+ font-size: 12px;
233
+ font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
234
+ color: #89919f;
235
+ line-height: 18px;
236
+ display: inline-flex;
237
+ align-items: center;
238
+ justify-content: flex-end;
239
+ box-sizing: border-box;
240
+ width: 78px;
241
+ height: 26px;
242
+ padding: 4px;
243
+ text-align: left;
244
+ line-height: 26px;
245
+ }
246
+
247
+ .titaui-task-tree__e-project-node-actions-date > span {
248
+ vertical-align: text-bottom;
249
+ }
250
+
251
+ .titaui-task-tree__e-project-node-actions-progress {
252
+ position: relative;
253
+ top: 3px;
254
+ color: #89919f;
255
+ cursor: auto;
256
+ width: 64px;
257
+ margin-left: 16px;
258
+ margin-right: 4px;
259
+ }
260
+
261
+ .titaui-task-tree__e-project-node-actions-progress .tooltip-text-wrapper {
262
+ margin-left: 4px;
263
+ }
264
+
265
+ .titaui-task-tree__e-project-node-actions-connect {
266
+ display: inline-block;
267
+ color: #cccccc;
268
+ margin-left: 27px;
269
+ margin-right: 10px;
270
+ }
271
+
272
+ .titaui-task-tree__e-project-node-actions-connect:hover {
273
+ color: #2879ff;
274
+ }
275
+
276
+ .titaui-task-tree__e-empty-node {
277
+ font-size: 12px;
278
+ font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
279
+ color: #a4acb9;
280
+ line-height: 18px;
281
+ padding-left: 12px;
282
+ }
283
+
284
+ .titaui-task-tree__e-empty-node:hover {
285
+ cursor: text;
286
+ }
287
+
288
+ .e-node-status-icon {
289
+ color: #89919f;
290
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _eTask = _interopRequireDefault(require("./e-task"));
11
+
12
+ var _eProject = _interopRequireDefault(require("./e-project"));
13
+
14
+ var _eEmpty = _interopRequireDefault(require("./e-empty"));
15
+
16
+ require("./index.css");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
20
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
+
22
+ var _default = function _default(node, level) {
23
+ switch (node.nodeType) {
24
+ case "e-task":
25
+ return /*#__PURE__*/_react["default"].createElement(_eTask["default"], _extends({}, node, {
26
+ level: level
27
+ }));
28
+
29
+ case "e-project":
30
+ return /*#__PURE__*/_react["default"].createElement(_eProject["default"], _extends({}, node, {
31
+ level: level
32
+ }));
33
+
34
+ case "e-empty":
35
+ return /*#__PURE__*/_react["default"].createElement(_eEmpty["default"], _extends({}, node, {
36
+ level: level
37
+ }));
38
+
39
+ default:
40
+ }
41
+ };
42
+
43
+ exports["default"] = _default;
@@ -0,0 +1,8 @@
1
+ .titaui-task-tree {
2
+ position: relative;
3
+ overflow: hidden;
4
+ }
5
+
6
+ .titaui-task-tree .rc-tree-treenode-switcher-close:hover {
7
+ background: #F7F8FA;
8
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _taskNodeRender = _interopRequireDefault(require("./task-item-node/task-node-render"));
11
+
12
+ var _tree = _interopRequireDefault(require("../tree"));
13
+
14
+ var _precls = _interopRequireDefault(require("./precls"));
15
+
16
+ require("./task-tree.css");
17
+
18
+ var _excluded = ["dataSource", "defaultExpandedKeys", "draggable"];
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
+
22
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
+
24
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
+
26
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
27
+
28
+ var TaskTree = function TaskTree(props) {
29
+ var dataSource = props.dataSource,
30
+ defaultExpandedKeys = props.defaultExpandedKeys,
31
+ _props$draggable = props.draggable,
32
+ draggable = _props$draggable === void 0 ? false : _props$draggable,
33
+ restProps = _objectWithoutProperties(props, _excluded);
34
+
35
+ return /*#__PURE__*/_react["default"].createElement("div", {
36
+ className: _precls["default"]
37
+ }, /*#__PURE__*/_react["default"].createElement(_tree["default"], _extends({
38
+ draggable: draggable,
39
+ defaultExpandedKeys: defaultExpandedKeys,
40
+ treeData: dataSource,
41
+ titleRender: _taskNodeRender["default"],
42
+ allowDrop: function allowDrop() {
43
+ return true;
44
+ }
45
+ }, restProps)));
46
+ };
47
+
48
+ var _default = TaskTree;
49
+ exports["default"] = _default;
@@ -0,0 +1,117 @@
1
+ .tita-ui__time-picker-trigger {
2
+ width: 100px;
3
+ height: 32px;
4
+ padding: 0 12px;
5
+ font-size: 13px;
6
+ font-weight: 400;
7
+ line-height: 18px;
8
+ border: 1px solid #e9ecf0;
9
+ border-radius: 8px;
10
+ transition: all 0.3s ease;
11
+ background: #ffffff;
12
+ box-sizing: border-box;
13
+ color: #3f4755;
14
+ display: flex;
15
+ align-items: center;
16
+ }
17
+
18
+ .tita-ui__time-picker-trigger:hover {
19
+ border-color: #2879ff;
20
+ }
21
+
22
+ .tita-ui__time-picker-trigger--disabled {
23
+ cursor: not-allowed;
24
+ }
25
+
26
+ .tita-ui__time-picker-trigger--disabled .tita-ui__time-picker-input {
27
+ cursor: not-allowed;
28
+ }
29
+
30
+ .tita-ui__time-picker-trigger--disabled:hover {
31
+ border-color: #e9ecf0;
32
+ }
33
+
34
+ .tita-ui__time-picker-inputs {
35
+ flex: 1;
36
+ }
37
+
38
+ .tita-ui__time-picker-inputs--placeholder input,
39
+ .tita-ui__time-picker-inputs--placeholder span {
40
+ text-shadow: 0 0 0 #bfc7d5;
41
+ color: transparent;
42
+ }
43
+
44
+ .tita-ui__time-picker-input {
45
+ width: 16px;
46
+ padding: 0;
47
+ text-shadow: 0 0 0 #3f4755;
48
+ border: none;
49
+ color: transparent;
50
+ outline: none;
51
+ text-align: right;
52
+ }
53
+
54
+ .tita-ui__time-picker-input.active {
55
+ background-color: #2879ff;
56
+ text-shadow: 0 0 0 #ffffff;
57
+ }
58
+
59
+ .tita-ui__time-picker-input::selection {
60
+ background-color: transparent;
61
+ }
62
+
63
+ .tita-ui__time-picker-icon {
64
+ font-size: 16px;
65
+ cursor: pointer;
66
+ }
67
+
68
+ .tita-ui__time-picker-icon:hover {
69
+ color: #2879ff;
70
+ }
71
+
72
+ .tita-ui__time-picker-menu {
73
+ width: 100px;
74
+ border-radius: 8px;
75
+ box-shadow: 0px 4px 12px 0px rgba(127, 145, 180, 0.1);
76
+ background: #ffffff;
77
+ box-sizing: border-box;
78
+ }
79
+
80
+ .tita-ui__time-picker-menu-item {
81
+ margin: 0;
82
+ padding: 7px 12px;
83
+ font-size: 14px;
84
+ font-weight: 400;
85
+ line-height: 18px;
86
+ color: #3f4755;
87
+ cursor: pointer;
88
+ }
89
+
90
+ .tita-ui__time-picker-menu-item:hover {
91
+ color: #2879ff;
92
+ background: #f7f8fa;
93
+ }
94
+
95
+ .tita-ui__time-picker-menu-item.active {
96
+ color: #2879ff;
97
+ }
98
+
99
+ .tita-ui__time-picker-menu-item--sticky {
100
+ height: 16px;
101
+ border-radius: 8px;
102
+ background-color: #ffffff;
103
+ position: sticky;
104
+ z-index: 10;
105
+ }
106
+
107
+ .tita-ui__time-picker-menu-item--sticky.top {
108
+ top: 0;
109
+ }
110
+
111
+ .tita-ui__time-picker-menu-item--sticky.bottom {
112
+ bottom: 0;
113
+ }
114
+
115
+ .tita-ui__time-picker-menu-item--sticky.shadow {
116
+ box-shadow: 0px 0px 8px 0px #e9eef3;
117
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _timePicker = _interopRequireDefault(require("./time-picker"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = _timePicker["default"];
13
+ exports["default"] = _default;
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
14
+ var _popup = _interopRequireDefault(require("../popup"));
15
+
16
+ var _scrollbar = _interopRequireDefault(require("../scrollbar"));
17
+
18
+ var _utils = require("./utils");
19
+
20
+ var _excluded = ["children", "popupStyle", "timeData", "timeSetting", "visibleSetting"];
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
+
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+
26
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
+
28
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
29
+
30
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
+
32
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
+
34
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
35
+
36
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
37
+
38
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
39
+
40
+ var PICKERITEM_HEIGHT = 32;
41
+
42
+ var TimePickerSelector = function TimePickerSelector(props) {
43
+ var children = props.children,
44
+ popupStyle = props.popupStyle,
45
+ _props$timeData = props.timeData,
46
+ hours = _props$timeData.hours,
47
+ minutes = _props$timeData.minutes,
48
+ _props$timeSetting = props.timeSetting,
49
+ hour = _props$timeSetting.hour,
50
+ minute = _props$timeSetting.minute,
51
+ setTime = _props$timeSetting.setTime,
52
+ _props$visibleSetting = props.visibleSetting,
53
+ visible = _props$visibleSetting.visible,
54
+ setVisible = _props$visibleSetting.setVisible,
55
+ restProps = _objectWithoutProperties(props, _excluded);
56
+
57
+ var pickerMenuRef = (0, _react.useRef)();
58
+ var pickerMenuItemActiveIndexRef = (0, _react.useRef)(0);
59
+ var timerRef = (0, _react.useRef)();
60
+
61
+ var onItemClickHandler = function onItemClickHandler(time) {
62
+ // setHour(hour);
63
+ // setMinute(minute);
64
+ setTime(time);
65
+ setVisible(false);
66
+ };
67
+
68
+ var renderContent = function renderContent() {
69
+ return /*#__PURE__*/_react["default"].createElement("div", {
70
+ className: "".concat(_utils.TimePickerClass, "-menu")
71
+ }, /*#__PURE__*/_react["default"].createElement(_scrollbar["default"], {
72
+ style: {
73
+ maxHeight: 192
74
+ }
75
+ }, /*#__PURE__*/_react["default"].createElement("p", {
76
+ className: "".concat(_utils.TimePickerClass, "-menu-item--sticky top")
77
+ }), hours.map(function (h, hIndex) {
78
+ return minutes.map(function (m, mIndex) {
79
+ var isCurrentTime = Number(h) === Number(hour) && Number(m) === Number(minute);
80
+
81
+ if (isCurrentTime) {
82
+ pickerMenuItemActiveIndexRef.current = hIndex + mIndex + 1 + hIndex * (minutes.length - 1);
83
+ }
84
+
85
+ var time = "".concat(h, ":").concat(m);
86
+ return (
87
+ /*#__PURE__*/
88
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
89
+ _react["default"].createElement("p", {
90
+ className: (0, _classnames["default"])("".concat(_utils.TimePickerClass, "-menu-item"), {
91
+ active: isCurrentTime
92
+ }),
93
+ key: m,
94
+ onClick: function onClick() {
95
+ return onItemClickHandler(time);
96
+ }
97
+ }, time)
98
+ );
99
+ });
100
+ }), /*#__PURE__*/_react["default"].createElement("p", {
101
+ className: "".concat(_utils.TimePickerClass, "-menu-item--sticky bottom")
102
+ })));
103
+ };
104
+
105
+ (0, _react.useEffect)(function () {
106
+ timerRef.current = setTimeout(function () {
107
+ if (visible && pickerMenuRef.current) {
108
+ pickerMenuRef.current.scrollTop = pickerMenuItemActiveIndexRef.current * PICKERITEM_HEIGHT - PICKERITEM_HEIGHT; // 32: pickerItem height, 23: pickerMenu paddingTop + pickerItem paddingTop
109
+ }
110
+ }, 10);
111
+ return function () {
112
+ clearTimeout(timerRef.current);
113
+ };
114
+ }, [visible]);
115
+ return /*#__PURE__*/_react["default"].createElement(_popup["default"], _extends({
116
+ popup: renderContent(),
117
+ popupVisible: visible,
118
+ onPopupVisibleChange: setVisible,
119
+ popupStyle: _objectSpread(_objectSpread({}, popupStyle), {}, {
120
+ zIndex: 2000
121
+ })
122
+ }, restProps), children);
123
+ };
124
+
125
+ TimePickerSelector.defaultProps = {
126
+ children: null,
127
+ popupStyle: {},
128
+ popupAlign: {
129
+ offset: [0, 0],
130
+ overflow: {
131
+ adjustX: true,
132
+ adjustY: true
133
+ },
134
+ targetOffset: [0, 0]
135
+ }
136
+ };
137
+ var _default = TimePickerSelector;
138
+ exports["default"] = _default;