@lm_fe/core 0.1.201 → 0.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.
@@ -0,0 +1,736 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
+ import _typeof from "@babel/runtime/helpers/typeof";
6
+ var _excluded = ["key_name", "parentid"],
7
+ _excluded2 = ["type"],
8
+ _excluded3 = ["type"];
9
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
+ import { StyleProvider, legacyLogicalPropertiesTransformer } from '@ant-design/cssinjs';
13
+ import { OkButton, MyIcon, MyLazyComponent, MountMchcModal as MountMchcModal$1 } from '@lm_fe/components_m';
14
+ import { mchcEnv, mchcConfig, mchcEvent, mchcUtils, mchcMacro, mchcLogger, mchcBoot, mchcDriver, mchcRouterContainer__, MchcRouterContainer } from '@lm_fe/env';
15
+ import { mchcModal__, safe_navigate, MountMchcModal } from '@lm_fe/pages';
16
+ import { fubaoRoutes } from '@lm_fe/pages-fubao';
17
+ import { mchcRoutes } from '@lm_fe/pages-mchc';
18
+ import { SMchc_Common, SLocal_Version, SMchc_User } from '@lm_fe/service';
19
+ import { request, AppEnv, appEnv, assign, shake, makeEventStore } from '@lm_fe/utils';
20
+ import React, { useEffect, useState, useRef } from 'react';
21
+ import ReactDOM from 'react-dom/client';
22
+ import { useHistory, BrowserRouter } from 'react-router-dom';
23
+ import { Space, Modal, message, notification, theme, ConfigProvider } from 'antd';
24
+ import zhCN from 'antd/lib/locale/zh_CN';
25
+ import { use_provoke } from '@lm_fe/provoke';
26
+ var isImplemented$1 = function isImplemented() {
27
+ return Object.prototype.hasOwnProperty.call(Node.prototype, 'getRootNode');
28
+ };
29
+ var getRootNodePolyfill = {
30
+ exports: {}
31
+ };
32
+ (function (module) {
33
+ // Node getRootNode(optional GetRootNodeOptions options);
34
+
35
+ /**
36
+ * Returns the context object’s shadow-including root if options’s composed is true.
37
+ * Returns the context object’s root otherwise.
38
+ *
39
+ * The root of an object is itself, if its parent is null, or else it is the root of its parent.
40
+ *
41
+ * The shadow-including root of an object is its root’s host’s shadow-including root,
42
+ * if the object’s root is a shadow root, and its root otherwise.
43
+ *
44
+ * https://dom.spec.whatwg.org/#dom-node-getrootnode
45
+ *
46
+ * @memberof Node.prototype
47
+ * @param {!Object} [opt = {}] - Options.
48
+ * @param {!boolean} [opt.composed] - See above description.
49
+ * @returns {!Node} The root node.
50
+ */
51
+ function getRootNode(opt) {
52
+ var composed = _typeof(opt) === 'object' && Boolean(opt.composed);
53
+ return composed ? getShadowIncludingRoot(this) : getRoot(this);
54
+ }
55
+ function getShadowIncludingRoot(node) {
56
+ var root = getRoot(node);
57
+ if (isShadowRoot(root)) {
58
+ return getShadowIncludingRoot(root.host);
59
+ }
60
+ return root;
61
+ }
62
+ function getRoot(node) {
63
+ if (node.parentNode != null) {
64
+ return getRoot(node.parentNode);
65
+ }
66
+ return node;
67
+ }
68
+ function isShadowRoot(node) {
69
+ return node.nodeName === '#document-fragment' && node.constructor.name === 'ShadowRoot';
70
+ }
71
+ if (module.exports) {
72
+ module.exports = getRootNode;
73
+ }
74
+ })(getRootNodePolyfill);
75
+ var isImplemented = isImplemented$1;
76
+ if (!isImplemented()) {
77
+ Object.defineProperty(Node.prototype, 'getRootNode', {
78
+ enumerable: false,
79
+ configurable: false,
80
+ value: getRootNodePolyfill.exports
81
+ });
82
+ }
83
+ function styleInject(css, ref) {
84
+ if (ref === void 0) ref = {};
85
+ var insertAt = ref.insertAt;
86
+ if (!css || typeof document === 'undefined') {
87
+ return;
88
+ }
89
+ var head = document.head || document.getElementsByTagName('head')[0];
90
+ var style = document.createElement('style');
91
+ style.type = 'text/css';
92
+ if (insertAt === 'top') {
93
+ if (head.firstChild) {
94
+ head.insertBefore(style, head.firstChild);
95
+ } else {
96
+ head.appendChild(style);
97
+ }
98
+ } else {
99
+ head.appendChild(style);
100
+ }
101
+ if (style.styleSheet) {
102
+ style.styleSheet.cssText = css;
103
+ } else {
104
+ style.appendChild(document.createTextNode(css));
105
+ }
106
+ }
107
+ var css_248z = ".ReloadButton-module_wrap__zHGF0 {\n cursor: pointer;\n position: fixed;\n top: -20px;\n right: 50%;\n z-index: 9999;\n opacity: 0.8;\n transition: all 0.2s;\n transform: translateX(50%);\n}\n.ReloadButton-module_wrap__zHGF0:hover {\n top: 0;\n opacity: 1;\n padding: 0;\n margin: 0;\n}\n.ReloadButton-module_tools__wDqiC {\n border: 2px solid #fff;\n border-top: none;\n border-bottom-left-radius: 6px;\n border-bottom-right-radius: 6px;\n overflow: hidden;\n}\n.ReloadButton-module_pull__YbHMc {\n margin-top: -6px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ReloadButton-module_pull-icon__ir6lr {\n border: 2px solid #fff;\n border-top: none;\n height: 12px;\n line-height: 12px;\n text-align: center;\n width: 36px;\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n overflow: hidden;\n}\n";
108
+ var styles = {
109
+ "wrap": "ReloadButton-module_wrap__zHGF0",
110
+ "tools": "ReloadButton-module_tools__wDqiC",
111
+ "pull": "ReloadButton-module_pull__YbHMc",
112
+ "pull-icon": "ReloadButton-module_pull-icon__ir6lr"
113
+ };
114
+ styleInject(css_248z);
115
+ var NewListPage = function NewListPage(props) {
116
+ useEffect(function () {}, []);
117
+ return /*#__PURE__*/React.createElement(OkButton, {
118
+ btn_text: "\u65B0\u589E\u5217\u8868\u9875",
119
+ size: 'small',
120
+ type: 'primary',
121
+ onClick: function onClick() {
122
+ mchcModal__.open('modal_form', {
123
+ width: '20vw',
124
+ styles: {
125
+ body: {
126
+ height: '20vh'
127
+ }
128
+ },
129
+ modal_data: {
130
+ targetLabelCol: 6,
131
+ onSubmit: function onSubmit(_ref, old_data) {
132
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
133
+ var key_name, parentid, others, key, res;
134
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
135
+ while (1) switch (_context.prev = _context.next) {
136
+ case 0:
137
+ key_name = _ref.key_name, parentid = _ref.parentid, others = _objectWithoutProperties(_ref, _excluded);
138
+ key = "/happy/config-table/list2/".concat(key_name);
139
+ _context.next = 4;
140
+ return request.get('/api/permissions', {
141
+ params: {
142
+ 'key.equals': key
143
+ }
144
+ });
145
+ case 4:
146
+ res = _context.sent;
147
+ if (!res.data.length) {
148
+ _context.next = 8;
149
+ break;
150
+ }
151
+ mchcEnv.warning('已存在');
152
+ return _context.abrupt("return");
153
+ case 8:
154
+ _context.next = 10;
155
+ return request.post('/api/permissions', _objectSpread({
156
+ key: key,
157
+ parentid: parentid !== null && parentid !== void 0 ? parentid : 0,
158
+ type: 'route'
159
+ }, others));
160
+ case 10:
161
+ safe_navigate(key);
162
+ case 11:
163
+ case "end":
164
+ return _context.stop();
165
+ }
166
+ }, _callee);
167
+ }))();
168
+ },
169
+ formDescriptions: [{
170
+ inputType: 'MA',
171
+ name: 'key_name',
172
+ label: '配置标识',
173
+ required: true,
174
+ layout: '1'
175
+ }, {
176
+ inputType: 'MA',
177
+ name: 'name',
178
+ label: '菜单标题',
179
+ required: true,
180
+ layout: '1'
181
+ }, {
182
+ inputType: 'MS',
183
+ name: 'parentid',
184
+ label: '菜单父级',
185
+ layout: '1',
186
+ inputProps: {
187
+ marshal: 0,
188
+ fetch_options: {
189
+ url: '/api/permissions?size=999&parentid.equals=0&active.equals=true&type.equals=menu',
190
+ valueKey: 'id',
191
+ labelKey: 'name'
192
+ }
193
+ }
194
+ }]
195
+ }
196
+ });
197
+ },
198
+ icon: /*#__PURE__*/React.createElement(MyIcon, {
199
+ value: 'SettingOutlined'
200
+ })
201
+ });
202
+ };
203
+ var ReloadButton = function ReloadButton(props) {
204
+ var sys_theme = use_provoke(function (s) {
205
+ return s.sys_theme;
206
+ });
207
+ var _useState = useState(),
208
+ _useState2 = _slicedToArray(_useState, 2),
209
+ show = _useState2[0],
210
+ setShow = _useState2[1];
211
+ var handleOpenModal = function handleOpenModal(url) {
212
+ mchcModal__.open('modal_page', {
213
+ modal_data: {
214
+ route_conf: {
215
+ url: url
216
+ }
217
+ }
218
+ });
219
+ };
220
+ useEffect(function () {
221
+ setTimeout(function () {
222
+ if (mchcConfig.get('顶部工具栏隐藏') || !mchcEnv.token) return;
223
+ setShow(true);
224
+ }, 600);
225
+ return function () {};
226
+ }, []);
227
+ if (!show) return null;
228
+ return /*#__PURE__*/React.createElement("div", {
229
+ className: styles['wrap']
230
+ }, /*#__PURE__*/React.createElement("div", {
231
+ className: styles['tools'],
232
+ style: {
233
+ display: 'flex',
234
+ justifyContent: 'center',
235
+ alignItems: 'center'
236
+ }
237
+ }, /*#__PURE__*/React.createElement(Space.Compact, null, mchcEnv.isAdmin ? /*#__PURE__*/React.createElement(OkButton, {
238
+ title: "\u7CFB\u7EDF\u914D\u7F6E",
239
+ size: 'small',
240
+ type: 'primary',
241
+ onClick: function onClick() {
242
+ return handleOpenModal('/system-config');
243
+ },
244
+ icon: /*#__PURE__*/React.createElement(MyIcon, {
245
+ value: 'SettingOutlined'
246
+ })
247
+ }, "\u7CFB\u7EDF\u914D\u7F6E") : null, mchcEnv.isAdmin ? /*#__PURE__*/React.createElement(NewListPage, null) : null, mchcEnv.isAdmin ? /*#__PURE__*/React.createElement(OkButton, {
248
+ title: "\u914D\u7F6E\u7EC3\u4E60",
249
+ size: 'small',
250
+ type: 'primary',
251
+ onClick: function onClick() {
252
+ return handleOpenModal('/test');
253
+ },
254
+ icon: /*#__PURE__*/React.createElement(MyIcon, {
255
+ value: 'SettingOutlined'
256
+ })
257
+ }, "\u914D\u7F6E\u7EC3\u4E60") : null, /*#__PURE__*/React.createElement(OkButton, {
258
+ title: "\u5237\u65B0\u7F13\u5B58",
259
+ onClick: function onClick() {
260
+ request.get('/api/clearCache', {
261
+ successText: '清除成功'
262
+ });
263
+ },
264
+ size: 'small',
265
+ type: 'primary',
266
+ icon: /*#__PURE__*/React.createElement(MyIcon, {
267
+ value: 'CoffeeOutlined'
268
+ })
269
+ }, "\u5237\u65B0\u7F13\u5B58"), /*#__PURE__*/React.createElement(OkButton, {
270
+ title: "\u77E5\u8BC6\u5E93",
271
+ onClick: function onClick() {
272
+ return handleOpenModal('/knowledge/list');
273
+ },
274
+ size: 'small',
275
+ type: 'primary',
276
+ icon: /*#__PURE__*/React.createElement(MyIcon, {
277
+ value: 'QuestionOutlined',
278
+ size: 12
279
+ })
280
+ }, "\u77E5\u8BC6\u5E93"), /*#__PURE__*/React.createElement(OkButton, {
281
+ title: "\u5B55\u518C\u7BA1\u7406",
282
+ onClick: function onClick() {
283
+ return handleOpenModal('/prenatal-visit/pregnancy/list');
284
+ },
285
+ size: 'small',
286
+ type: 'primary',
287
+ icon: /*#__PURE__*/React.createElement(MyIcon, {
288
+ value: 'GlobalOutlined',
289
+ size: 12
290
+ })
291
+ }, "\u5B55\u518C\u7BA1\u7406"), /*#__PURE__*/React.createElement(OkButton, {
292
+ title: "\u91CD\u65B0\u8FDB\u5165",
293
+ onClick: function onClick() {
294
+ return mchcEnv.reload();
295
+ },
296
+ size: 'small',
297
+ type: 'primary',
298
+ icon: /*#__PURE__*/React.createElement(MyIcon, {
299
+ value: 'ReloadOutlined',
300
+ size: 12
301
+ })
302
+ }, "\u91CD\u65B0\u8FDB\u5165"))), /*#__PURE__*/React.createElement("div", {
303
+ className: styles['pull'],
304
+ style: {}
305
+ }, /*#__PURE__*/React.createElement("span", {
306
+ className: styles['pull-icon'],
307
+ style: {
308
+ color: '#fff',
309
+ background: sys_theme.colorPrimary
310
+ }
311
+ }, "\u2014")));
312
+ };
313
+ function checkLogin() {
314
+ _checkLogin_Inner();
315
+ }
316
+ var failedCount$1 = 0;
317
+ var _checkLogin_Inner = function checkLogin_Inner() {
318
+ SMchc_Common.checkLogin().then(function (isNew) {})["catch"](function (e) {
319
+ if (++failedCount$1 > 0) {
320
+ _checkLogin_Inner = function checkLogin_Inner() {};
321
+ }
322
+ });
323
+ };
324
+ function checkVersion() {
325
+ _checkVersion_Inner();
326
+ }
327
+ var failedCount = 0;
328
+ var _checkVersion_Inner = function checkVersion_Inner() {
329
+ SLocal_Version.checkVersion().then(function (isNew) {
330
+ if (isNew) {
331
+ newVersionHandler();
332
+ }
333
+ })["catch"](function (e) {
334
+ if (++failedCount > 2) {
335
+ _checkVersion_Inner = function checkVersion_Inner() {};
336
+ }
337
+ });
338
+ };
339
+ function newVersionHandler() {
340
+ var key = "newVersionHandler";
341
+ var btn = /*#__PURE__*/React.createElement(OkButton, {
342
+ style: {
343
+ cursor: 'pointer'
344
+ },
345
+ onClick: function onClick() {
346
+ return location.reload();
347
+ }
348
+ }, "\u786E\u5B9A");
349
+ mchcEvent.emit('notify', {
350
+ type: 'success',
351
+ message: '消息通知',
352
+ description: '系统检测到新版本🚀,是否立即更新?',
353
+ btn: btn,
354
+ key: key,
355
+ duration: 2000,
356
+ placement: 'bottomRight',
357
+ onClose: close
358
+ });
359
+ }
360
+ function use_task() {
361
+ var disabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
362
+ var _use_provoke = use_provoke(),
363
+ fetch_user = _use_provoke.fetch_user,
364
+ fetch_sys_config = _use_provoke.fetch_sys_config,
365
+ sys_theme = _use_provoke.sys_theme;
366
+ var history = useHistory();
367
+ useEffect(function () {
368
+ mchcUtils.setGlobalHistory(function () {
369
+ return history;
370
+ });
371
+ fetch_user_info();
372
+ fetch_sys_config();
373
+ }, []);
374
+ function fetch_user_info() {
375
+ var in_login_page = location.pathname.includes('/login');
376
+ if (!mchcEnv.is_single) fetch_user().then(function () {
377
+ if (in_login_page) mchcEnv.reload('/');
378
+ })["catch"](function (e) {});
379
+ }
380
+ useEffect(function () {
381
+ if (!disabled) {
382
+ var minute = 60 * 1000;
383
+ setInterval(fetch_user_info, 5 * minute);
384
+ setInterval(checkVersion, 2 * minute);
385
+ setInterval(checkLogin, .5 * minute);
386
+ }
387
+ return function () {};
388
+ }, []);
389
+ return {
390
+ sys_theme: sys_theme
391
+ };
392
+ }
393
+ var PUBLIC_PATH = mchcMacro.PUBLIC_PATH,
394
+ HOST_URL = mchcMacro.HOST_URL,
395
+ API_PREFIX = mchcMacro.API_PREFIX;
396
+ var baseApiUrl = location.origin;
397
+ request.on('message', function (status, msg, response) {
398
+ if (status) {
399
+ mchcEnv.success(msg);
400
+ } else {
401
+ mchcEnv.warning(msg);
402
+ }
403
+ });
404
+ request.spawn({
405
+ config: {
406
+ baseURL: "".concat(AppEnv.client_mode ? HOST_URL : baseApiUrl).concat(API_PREFIX),
407
+ timeout: 240000,
408
+ headers: {
409
+ 'Content-Type': 'application/json;charset=UTF-8'
410
+ }
411
+ }
412
+ });
413
+ request.on('request', function (req) {
414
+ request.token = mchcEnv.token;
415
+ });
416
+ request.on('response', function (response) {
417
+ var headers = response.headers;
418
+ var config = response.config;
419
+ var url = config.url;
420
+ var isSameOrigin = url !== null && url !== void 0 && url.startsWith('http') ? new URL(url).origin === location.origin : true;
421
+ if (isSameOrigin) {
422
+ var token = headers['Authorization'] || headers['authorization'];
423
+ if (token) {
424
+ mchcEnv.token = token;
425
+ appEnv.token = token;
426
+ }
427
+ }
428
+ });
429
+ request.on('error', function (err_wrapper) {
430
+ var _error$config, _error$response, _error$response2;
431
+ var error = err_wrapper.error,
432
+ msg = err_wrapper.msg;
433
+ if ((error === null || error === void 0 || (_error$config = error.config) === null || _error$config === void 0 ? void 0 : _error$config.url) === '/api/desklogin') {
434
+ return;
435
+ }
436
+ var _window$location = window.location,
437
+ pathname = _window$location.pathname,
438
+ search = _window$location.search;
439
+ var code = error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status;
440
+ var req_url = error === null || error === void 0 || (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.config.url;
441
+ if (code === 401 && !mchcEnv.is_single) {
442
+ // 未登录、token失效处理方法
443
+ if (!pathname.includes('/login') && req_url !== '/api/authenticate') {
444
+ Modal.destroyAll();
445
+ mchcEvent.emit('confirm', {
446
+ type: 'info',
447
+ title: '温馨的提示',
448
+ content: msg !== null && msg !== void 0 ? msg : '您未登陆账户或登录已超时,请重新登录...',
449
+ centered: true,
450
+ okText: '确定',
451
+ onOk: function onOk() {
452
+ mchcEnv.logout();
453
+ window.location.href = "".concat(mchcMacro.PUBLIC_PATH, "login?redirectTo=").concat(pathname).concat(search);
454
+ }
455
+ });
456
+ }
457
+ }
458
+ });
459
+ function MessageHolder() {
460
+ var _message$useMessage = message.useMessage(),
461
+ _message$useMessage2 = _slicedToArray(_message$useMessage, 2),
462
+ messageApi = _message$useMessage2[0],
463
+ messageHolder = _message$useMessage2[1];
464
+ var _Modal$useModal = Modal.useModal(),
465
+ _Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
466
+ modalApi = _Modal$useModal2[0],
467
+ modalHolder = _Modal$useModal2[1];
468
+ var _notification$useNoti = notification.useNotification(),
469
+ _notification$useNoti2 = _slicedToArray(_notification$useNoti, 2),
470
+ notiApi = _notification$useNoti2[0],
471
+ notiHolder = _notification$useNoti2[1];
472
+ useEffect(function () {
473
+ var rm1 = mchcEvent.on_rm('toast', function (_ref2) {
474
+ var msg = _ref2.msg,
475
+ type = _ref2.type,
476
+ duration = _ref2.duration,
477
+ cb = _ref2.cb;
478
+ messageApi[type](msg, duration, cb);
479
+ });
480
+ var rm2 = mchcEvent.on_rm('confirm', function (e) {
481
+ mchcLogger.log('confirm', e);
482
+ var type = e.type,
483
+ modal_props = _objectWithoutProperties(e, _excluded2);
484
+ modalApi[type](modal_props);
485
+ });
486
+ var rm3 = mchcEvent.on_rm('notify', function (e) {
487
+ mchcLogger.log('notify', e);
488
+ var type = e.type,
489
+ modal_props = _objectWithoutProperties(e, _excluded3);
490
+ notiApi[type](modal_props);
491
+ });
492
+ return function () {
493
+ rm1();
494
+ rm2();
495
+ rm3();
496
+ };
497
+ }, []);
498
+ return /*#__PURE__*/React.createElement(React.Fragment, null, messageHolder, modalHolder, notiHolder);
499
+ }
500
+ function theme_config(sys_theme) {
501
+ var _conf$components, _conf$components2;
502
+ var colorPrimary = sys_theme.colorPrimary,
503
+ colorBorder = sys_theme.colorBorder,
504
+ darkTheme = sys_theme.darkTheme,
505
+ compact = sys_theme.compact,
506
+ fontSize = sys_theme.fontSize,
507
+ cus_fontBold = sys_theme.cus_fontBold,
508
+ bg_color = sys_theme.bg_color,
509
+ colors = sys_theme.colors,
510
+ colorTextDisabled = sys_theme.colorTextDisabled,
511
+ colorTextPlaceholder = sys_theme.colorTextPlaceholder,
512
+ colorBgContainerDisabled = sys_theme.colorBgContainerDisabled,
513
+ labelColor = sys_theme.labelColor,
514
+ rowHoverBg = sys_theme.rowHoverBg,
515
+ labelFontSize = sys_theme.labelFontSize;
516
+ var algorithm = [];
517
+ if (cus_fontBold) {
518
+ import('./core.src.env.js');
519
+ }
520
+ if (darkTheme) {
521
+ algorithm.push(theme.darkAlgorithm);
522
+ }
523
+ if (compact) {
524
+ algorithm.push(theme.compactAlgorithm);
525
+ }
526
+ var conf = {
527
+ token: {
528
+ colorPrimary: colorPrimary
529
+ },
530
+ components: {
531
+ Input: {},
532
+ Message: {},
533
+ Card: {},
534
+ Tabs: {
535
+ horizontalMargin: compact ? '0 0 6px 0' : '0 0 12px 0',
536
+ verticalItemPadding: compact ? '2px 6px' : '4px 12px'
537
+ },
538
+ Button: {
539
+ colorLink: colorPrimary
540
+ },
541
+ Form: {
542
+ itemMarginBottom: compact ? 4 : 8
543
+ },
544
+ Table: {
545
+ cellPaddingBlock: 4,
546
+ cellPaddingBlockMD: 4,
547
+ cellPaddingBlockSM: 4,
548
+ cellPaddingInline: 2,
549
+ cellPaddingInlineMD: 2,
550
+ cellPaddingInlineSM: 2,
551
+ // cellPaddingBlock: compact ? 2 : 4,
552
+ // cellPaddingBlockMD: compact ? 2 : 4,
553
+ // cellPaddingBlockSM: compact ? 2 : 4,
554
+ // cellPaddingInline: compact ? 2 : 4,
555
+ // cellPaddingInlineMD: compact ? 2 : 4,
556
+ // cellPaddingInlineSM: compact ? 2 : 4,
557
+ headerBg: darkTheme ? bg_color : '#eee'
558
+ },
559
+ Segmented: {
560
+ // itemActiveBg: colorPrimary,
561
+ itemSelectedBg: colors === null || colors === void 0 ? void 0 : colors.light[0]
562
+ // trackBg: colorPrimary,
563
+ },
564
+ Layout: {
565
+ headerBg: darkTheme ? undefined : colorPrimary
566
+ }
567
+ },
568
+ algorithm: algorithm
569
+ };
570
+ conf.token = safe_extend(conf.token, {
571
+ colorTextDisabled: colorTextDisabled,
572
+ colorBgContainerDisabled: colorBgContainerDisabled,
573
+ colorTextPlaceholder: colorTextPlaceholder,
574
+ colorBorder: colorBorder,
575
+ fontSize: fontSize
576
+ });
577
+ conf.components.Table = safe_extend((_conf$components = conf.components) === null || _conf$components === void 0 ? void 0 : _conf$components.Table, {
578
+ borderColor: colorBorder,
579
+ rowHoverBg: rowHoverBg
580
+ });
581
+ conf.components.Form = safe_extend((_conf$components2 = conf.components) === null || _conf$components2 === void 0 ? void 0 : _conf$components2.Form, {
582
+ labelColor: labelColor,
583
+ labelFontSize: labelFontSize
584
+ });
585
+ return conf;
586
+ }
587
+ function safe_extend(src, target) {
588
+ if (!src) return target;
589
+ if (!target) return src;
590
+ return assign(src, shake(target));
591
+ }
592
+ var globalStore = makeEventStore(appEnv.appName);
593
+ function passwordLogin(_x) {
594
+ return _passwordLogin.apply(this, arguments);
595
+ }
596
+ function _passwordLogin() {
597
+ _passwordLogin = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
598
+ var user;
599
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
600
+ while (1) switch (_context2.prev = _context2.next) {
601
+ case 0:
602
+ _context2.next = 2;
603
+ return SMchc_Common.fk_login(data);
604
+ case 2:
605
+ _context2.next = 4;
606
+ return SMchc_User.getOne(data.username);
607
+ case 4:
608
+ user = _context2.sent;
609
+ globalStore.bus.data = {
610
+ user: user,
611
+ loggedIn: true
612
+ };
613
+ case 6:
614
+ case "end":
615
+ return _context2.stop();
616
+ }
617
+ }, _callee2);
618
+ }));
619
+ return _passwordLogin.apply(this, arguments);
620
+ }
621
+ function logout() {
622
+ return _logout.apply(this, arguments);
623
+ }
624
+ function _logout() {
625
+ _logout = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
626
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
627
+ while (1) switch (_context3.prev = _context3.next) {
628
+ case 0:
629
+ appEnv.removeToken();
630
+ globalStore.bus.data = {
631
+ user: undefined,
632
+ loggedIn: false
633
+ };
634
+ case 2:
635
+ case "end":
636
+ return _context3.stop();
637
+ }
638
+ }, _callee3);
639
+ }));
640
+ return _logout.apply(this, arguments);
641
+ }
642
+ function boot(_x2) {
643
+ return _boot.apply(this, arguments);
644
+ }
645
+ function _boot() {
646
+ _boot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(config) {
647
+ var name, app, App, _config$routesData, routesData, taskDisabled, store, r_node, _app;
648
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
649
+ while (1) switch (_context4.prev = _context4.next) {
650
+ case 0:
651
+ name = config.name, app = config.app, App = config.App, _config$routesData = config.routesData, routesData = _config$routesData === void 0 ? {} : _config$routesData, taskDisabled = config.taskDisabled, store = config.store;
652
+ _context4.next = 3;
653
+ return mchcBoot({
654
+ name: name,
655
+ store: store
656
+ });
657
+ case 3:
658
+ mchcDriver.connect();
659
+ mchcRouterContainer__.init(routesData, mchcRoutes, fubaoRoutes);
660
+ r_node = App ? /*#__PURE__*/React.createElement(App, {
661
+ routerContainer: mchcRouterContainer__
662
+ }) : null;
663
+ _app = app !== null && app !== void 0 ? app : r_node;
664
+ ReactDOM.createRoot(document.getElementById('root')).render(/*#__PURE__*/React.createElement(BrowserRouter, {
665
+ basename: mchcMacro.PUBLIC_PATH
666
+ }, /*#__PURE__*/React.createElement(Shell, {
667
+ node: _app,
668
+ taskDisabled: taskDisabled
669
+ })));
670
+ case 8:
671
+ case "end":
672
+ return _context4.stop();
673
+ }
674
+ }, _callee4);
675
+ }));
676
+ return _boot.apply(this, arguments);
677
+ }
678
+ function Shell(props) {
679
+ var node = props.node,
680
+ taskDisabled = props.taskDisabled;
681
+ var _use_task = use_task(taskDisabled),
682
+ sys_theme = _use_task.sys_theme;
683
+ return /*#__PURE__*/React.createElement(StyleProvider, {
684
+ hashPriority: "high",
685
+ transformers: [legacyLogicalPropertiesTransformer]
686
+ }, /*#__PURE__*/React.createElement(ConfigProvider, {
687
+ locale: zhCN,
688
+ theme: theme_config(sys_theme)
689
+ }, /*#__PURE__*/React.createElement(ReloadButton, null), node, /*#__PURE__*/React.createElement(MyLazyComponent, {
690
+ fallback: ''
691
+ }, /*#__PURE__*/React.createElement(MountMchcModal, null), /*#__PURE__*/React.createElement(MountMchcModal$1, null), /*#__PURE__*/React.createElement(MessageHolder, null))));
692
+ }
693
+ function useEventStore(store) {
694
+ var _useState3 = useState(_objectSpread({}, store.bus.data)),
695
+ _useState4 = _slicedToArray(_useState3, 2),
696
+ _data = _useState4[0],
697
+ set_data = _useState4[1];
698
+ var ref = useRef(new Set('*'));
699
+ var flag = useRef(false);
700
+ var keys = useRef(Object.keys(store.bus.data));
701
+ useEffect(function () {
702
+ var cb = function cb(k, data) {
703
+ if (ref.current.has(k)) {
704
+ set_data(data);
705
+ }
706
+ };
707
+ store.bus.on('change', cb);
708
+ return function () {
709
+ store.bus.off('change', cb);
710
+ };
711
+ }, [store]);
712
+ function setPropertyGuard() {
713
+ flag.current || Object.defineProperties(_data, keys.current.reduce(function (a, k) {
714
+ return Object.assign(a, _defineProperty({}, k, {
715
+ get: function get() {
716
+ ref.current.add(k);
717
+ return store.bus.data[k];
718
+ }
719
+ }));
720
+ }, {}));
721
+ flag.current = true;
722
+ }
723
+ setPropertyGuard();
724
+ return _data;
725
+ }
726
+ function set_global_ret(m, name) {
727
+ return window[name] = m;
728
+ }
729
+ var mchc_env = set_global_ret(mchcEnv, 'mchc_env');
730
+ var mchc_modal = set_global_ret(mchcModal__, 'mchc_modal');
731
+ var mchc_macro = set_global_ret(mchcMacro, 'mchc_macro');
732
+ var mchc_event = set_global_ret(mchcEvent, 'mchc_event');
733
+ var mchc_routes = set_global_ret(mchcRoutes, 'mchc_routes');
734
+ var mchc_routes_container = set_global_ret(mchcRouterContainer__, 'mchc_routes_container');
735
+ var Mchc_Router_Container = set_global_ret(MchcRouterContainer, 'Mchc_Router_Container');
736
+ export { Mchc_Router_Container as M, mchc_modal as a, boot as b, mchc_macro as c, mchc_event as d, mchc_routes as e, mchc_routes_container as f, globalStore as g, logout as l, mchc_env as m, passwordLogin as p, styleInject as s, useEventStore as u };