wargerm 0.5.2 → 0.5.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.
- package/dist/components/Table/example/demo1.d.ts +3 -0
- package/dist/components/Table/example/demo2.d.ts +3 -0
- package/dist/components/Table/example/demo3.d.ts +3 -0
- package/dist/components/Table/example/demo4.d.ts +3 -0
- package/dist/components/Table/example/demo5.d.ts +3 -0
- package/dist/components/WForm/index.d.ts +1 -0
- package/dist/components/useEventEmitter/example/demo1.d.ts +2 -0
- package/dist/hooks/useEventEmitter.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +118 -17
- package/dist/index.js +116 -14
- package/dist/utils/event.d.ts +15 -0
- package/package.json +88 -88
@@ -16,6 +16,7 @@ export interface ColumnProps {
|
|
16
16
|
valueType?: 'text' | 'textarea' | 'inputNumber' | 'select' | 'treeSelect' | 'date' | 'dateTime' | 'dateMonth' | 'dateYear' | 'dateRange' | 'dateTimeRange' | 'checkbox' | 'radio' | 'radioButton' | 'switch' | 'digit' | 'cascader';
|
17
17
|
valueEnum?: Record<string, any>;
|
18
18
|
options?: Record<string, any>[];
|
19
|
+
useFirstIteminitialValue?: boolean;
|
19
20
|
fieldProps?: Record<string, any>;
|
20
21
|
formItemProps?: Record<string, any>;
|
21
22
|
order?: number;
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import './styles/index-dark.less';
|
2
2
|
import './styles/index-light.less';
|
3
|
+
export { default as useEventEmitter } from '@/hooks/useEventEmitter';
|
3
4
|
export { default as Button } from './components/Button';
|
4
5
|
export { default as IconFont } from './components/IconFont';
|
5
6
|
export { default as Input } from './components/Input';
|
package/dist/index.esm.js
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
import React, { useRef, useEffect, useMemo, memo, useState, useImperativeHandle, forwardRef, createRef, useCallback } from 'react';
|
2
|
+
import { cloneDeep, isEmpty } from 'lodash';
|
1
3
|
import 'antd/es/button/style';
|
2
4
|
import _Button from 'antd/es/button';
|
3
5
|
import 'antd/es/dropdown/style';
|
4
6
|
import _Dropdown from 'antd/es/dropdown';
|
5
7
|
import 'antd/es/menu/style';
|
6
8
|
import _Menu from 'antd/es/menu';
|
7
|
-
import React, { memo, useState, useEffect, useMemo, useImperativeHandle, useRef, forwardRef, createRef, useCallback } from 'react';
|
8
9
|
import { createFromIconfontCN, SearchOutlined, ReloadOutlined, CloseCircleOutlined, PlusOutlined, EllipsisOutlined, ExclamationCircleOutlined, EyeOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons';
|
9
10
|
import 'antd/es/input/style';
|
10
11
|
import _Input from 'antd/es/input';
|
@@ -38,7 +39,7 @@ import 'antd/es/tree-select/style';
|
|
38
39
|
import _TreeSelect from 'antd/es/tree-select';
|
39
40
|
import 'antd/es/cascader/style';
|
40
41
|
import _Cascader from 'antd/es/cascader';
|
41
|
-
import cloneDeep from 'lodash/cloneDeep';
|
42
|
+
import cloneDeep$1 from 'lodash/cloneDeep';
|
42
43
|
import CountUp from 'react-countup';
|
43
44
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
44
45
|
import SwiperCore, { Pagination, Navigation, Autoplay, Virtual } from 'swiper';
|
@@ -51,7 +52,6 @@ import ProTable from '@ant-design/pro-table';
|
|
51
52
|
import Player from 'xgplayer';
|
52
53
|
import FlvPlayer from 'xgplayer-flv.js';
|
53
54
|
import HlsJsPlayer from 'xgplayer-hls.js';
|
54
|
-
import { isEmpty } from 'lodash';
|
55
55
|
import ReactEChartsCore from 'echarts-for-react/lib/core';
|
56
56
|
import * as echarts from 'echarts/core';
|
57
57
|
import { use, registerTheme, graphic } from 'echarts/core';
|
@@ -441,6 +441,91 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
441
441
|
};
|
442
442
|
}
|
443
443
|
|
444
|
+
var EventEmitter = /*#__PURE__*/_createClass(function EventEmitter() {
|
445
|
+
var _this = this;
|
446
|
+
|
447
|
+
_classCallCheck(this, EventEmitter);
|
448
|
+
|
449
|
+
this.subscriptions = new Map();
|
450
|
+
|
451
|
+
this.useSubscription = function (event, listener) {
|
452
|
+
var callbackRef = useRef();
|
453
|
+
useEffect(function () {
|
454
|
+
callbackRef.current = listener;
|
455
|
+
|
456
|
+
function subscription(val) {
|
457
|
+
if (callbackRef.current) {
|
458
|
+
callbackRef.current(val);
|
459
|
+
}
|
460
|
+
}
|
461
|
+
|
462
|
+
_this.subscriptions.set(event, subscription);
|
463
|
+
|
464
|
+
return function () {
|
465
|
+
_this.subscriptions.delete(event);
|
466
|
+
};
|
467
|
+
}, []);
|
468
|
+
};
|
469
|
+
|
470
|
+
this.emit = function (event) {
|
471
|
+
if (typeof event === 'string' || typeof event === 'number') {
|
472
|
+
var subscriptionValuesCallback = _this.subscriptions.get(event);
|
473
|
+
|
474
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
475
|
+
args[_key - 1] = arguments[_key];
|
476
|
+
}
|
477
|
+
|
478
|
+
subscriptionValuesCallback === null || subscriptionValuesCallback === void 0 ? void 0 : subscriptionValuesCallback({
|
479
|
+
params: cloneDeep(args),
|
480
|
+
event: event
|
481
|
+
});
|
482
|
+
} else throw new TypeError('event must be string or number !');
|
483
|
+
};
|
484
|
+
|
485
|
+
this.removeListener = function (event) {
|
486
|
+
_this.subscriptions.delete(event);
|
487
|
+
};
|
488
|
+
|
489
|
+
this.clear = function () {
|
490
|
+
_this.subscriptions.clear();
|
491
|
+
};
|
492
|
+
|
493
|
+
this.clear();
|
494
|
+
});
|
495
|
+
|
496
|
+
var eventEmitterOverall = new EventEmitter();
|
497
|
+
|
498
|
+
/*
|
499
|
+
* @Author: lijin
|
500
|
+
* @Date: 2022-07-22 14:29:31
|
501
|
+
* @LastEditTime: 2022-07-22 14:29:31
|
502
|
+
* @LastEditors: lijin
|
503
|
+
* @Description:
|
504
|
+
* @FilePath: \wargerm-components\src\hooks\useEventEmitter.tsx
|
505
|
+
* 可以输入预定的版权声明、个性签名、空行等
|
506
|
+
*/
|
507
|
+
function useEventEmitter(options) {
|
508
|
+
var ref = useRef();
|
509
|
+
var eventEmitterOptions = useMemo(function () {
|
510
|
+
return options !== null && options !== void 0 ? options : {
|
511
|
+
global: false
|
512
|
+
};
|
513
|
+
}, [options]);
|
514
|
+
|
515
|
+
if (!ref.current) {
|
516
|
+
ref.current = eventEmitterOptions.global ? ref.current = eventEmitterOverall : ref.current = new EventEmitter();
|
517
|
+
}
|
518
|
+
|
519
|
+
useEffect(function () {
|
520
|
+
return function () {
|
521
|
+
var _ref$current;
|
522
|
+
|
523
|
+
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.clear();
|
524
|
+
};
|
525
|
+
}, []);
|
526
|
+
return ref.current;
|
527
|
+
}
|
528
|
+
|
444
529
|
var _excluded = ["multiple", "children", "disabled"];
|
445
530
|
|
446
531
|
var WButton = function WButton(props) {
|
@@ -546,10 +631,10 @@ Index$3.Group = _Checkbox.Group;
|
|
546
631
|
/*
|
547
632
|
* @Author: lijin
|
548
633
|
* @Date: 2021-10-27 22:18:49
|
549
|
-
* @LastEditTime: 2022-
|
550
|
-
* @LastEditors:
|
634
|
+
* @LastEditTime: 2022-07-22 15:17:01
|
635
|
+
* @LastEditors: lijin
|
551
636
|
* @Description:
|
552
|
-
* @FilePath: \wargerm\src\utils\index.ts
|
637
|
+
* @FilePath: \wargerm-components\src\utils\index.ts
|
553
638
|
* 可以输入预定的版权声明、个性签名、空行等
|
554
639
|
*/
|
555
640
|
|
@@ -6791,12 +6876,12 @@ var WForm = function WForm(props, ref) {
|
|
6791
6876
|
columnsFields = _useState4[0],
|
6792
6877
|
setColumnsFields = _useState4[1];
|
6793
6878
|
|
6794
|
-
var filterFormColumns = cloneDeep(columns).filter(function (c) {
|
6879
|
+
var filterFormColumns = cloneDeep$1(columns).filter(function (c) {
|
6795
6880
|
return !c.hideInSearch || disabledHideInSearch;
|
6796
6881
|
}).sort(function (a, b) {
|
6797
6882
|
return (b.order || 0) - (a.order || 0);
|
6798
6883
|
});
|
6799
|
-
var filterExtraFormColumns = cloneDeep(extraColumns || []).filter(function (c) {
|
6884
|
+
var filterExtraFormColumns = cloneDeep$1(extraColumns || []).filter(function (c) {
|
6800
6885
|
return !c.hideInSearch || disabledHideInSearch;
|
6801
6886
|
}).sort(function (a, b) {
|
6802
6887
|
return (b.order || 0) - (a.order || 0);
|
@@ -6857,6 +6942,12 @@ var WForm = function WForm(props, ref) {
|
|
6857
6942
|
setColumnsFields(function (preColumnsFields) {
|
6858
6943
|
return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, opt));
|
6859
6944
|
});
|
6945
|
+
|
6946
|
+
if (c.useFirstIteminitialValue) {
|
6947
|
+
var _form$setFieldsValue, _opt$0$value, _opt$;
|
6948
|
+
|
6949
|
+
form === null || form === void 0 ? void 0 : (_form$setFieldsValue = form.setFieldsValue) === null || _form$setFieldsValue === void 0 ? void 0 : _form$setFieldsValue.call(form, _defineProperty({}, c.dataIndex, (_opt$0$value = opt === null || opt === void 0 ? void 0 : (_opt$ = opt[0]) === null || _opt$ === void 0 ? void 0 : _opt$.value) !== null && _opt$0$value !== void 0 ? _opt$0$value : ''));
|
6950
|
+
}
|
6860
6951
|
}
|
6861
6952
|
}, c.fieldProps), _extraProps))));
|
6862
6953
|
} else if (c.valueType == 'cascader') {
|
@@ -7324,6 +7415,12 @@ var WForm = function WForm(props, ref) {
|
|
7324
7415
|
setColumnsFields(function (preColumnsFields) {
|
7325
7416
|
return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, opt));
|
7326
7417
|
});
|
7418
|
+
|
7419
|
+
if (c.useFirstIteminitialValue) {
|
7420
|
+
var _form$setFieldsValue2, _opt$0$value2, _opt$2;
|
7421
|
+
|
7422
|
+
form === null || form === void 0 ? void 0 : (_form$setFieldsValue2 = form.setFieldsValue) === null || _form$setFieldsValue2 === void 0 ? void 0 : _form$setFieldsValue2.call(form, _defineProperty({}, c.dataIndex, (_opt$0$value2 = opt === null || opt === void 0 ? void 0 : (_opt$2 = opt[0]) === null || _opt$2 === void 0 ? void 0 : _opt$2.value) !== null && _opt$0$value2 !== void 0 ? _opt$0$value2 : ''));
|
7423
|
+
}
|
7327
7424
|
}
|
7328
7425
|
}, c.fieldProps), _extraProps4))));
|
7329
7426
|
} else if (c.valueType == 'cascader') {
|
@@ -7803,7 +7900,7 @@ var WForm = function WForm(props, ref) {
|
|
7803
7900
|
};
|
7804
7901
|
|
7805
7902
|
var setFieldsValue = function setFieldsValue(record) {
|
7806
|
-
var _form$
|
7903
|
+
var _form$setFieldsValue4;
|
7807
7904
|
|
7808
7905
|
var setFieldsValues = _objectSpread2({}, record);
|
7809
7906
|
|
@@ -7819,7 +7916,7 @@ var WForm = function WForm(props, ref) {
|
|
7819
7916
|
return false;
|
7820
7917
|
}
|
7821
7918
|
});
|
7822
|
-
form === null || form === void 0 ? void 0 : (_form$
|
7919
|
+
form === null || form === void 0 ? void 0 : (_form$setFieldsValue4 = form.setFieldsValue) === null || _form$setFieldsValue4 === void 0 ? void 0 : _form$setFieldsValue4.call(form, setFieldsValues);
|
7823
7920
|
};
|
7824
7921
|
|
7825
7922
|
useImperativeHandle(ref, function () {
|
@@ -8351,7 +8448,7 @@ function Table(_ref) {
|
|
8351
8448
|
}
|
8352
8449
|
}, _callee);
|
8353
8450
|
}))();
|
8354
|
-
}, [params, pageParams, pagination, tableList, formSearch, columns]);
|
8451
|
+
}, [JSON.stringify(params), JSON.stringify(pageParams), JSON.stringify(pagination), JSON.stringify(tableList), formSearch, JSON.stringify(columns)]);
|
8355
8452
|
|
8356
8453
|
var onFormSubmit = function onFormSubmit(values) {
|
8357
8454
|
onSubmit && onSubmit(values);
|
@@ -10560,7 +10657,7 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10560
10657
|
|
10561
10658
|
var ModalForm$1 = /*#__PURE__*/React.forwardRef(ModalForm);
|
10562
10659
|
|
10563
|
-
var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
|
10660
|
+
var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "fliterAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
|
10564
10661
|
|
10565
10662
|
var TabelCard = function TabelCard(props, ref) {
|
10566
10663
|
var columns = props.columns,
|
@@ -10569,6 +10666,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10569
10666
|
modalFormSearch = props.modalFormSearch,
|
10570
10667
|
search = props.search,
|
10571
10668
|
tableAction = props.tableAction,
|
10669
|
+
fliterAction = props.fliterAction,
|
10572
10670
|
renderTableBar = props.renderTableBar,
|
10573
10671
|
className = props.className,
|
10574
10672
|
style = props.style,
|
@@ -10773,10 +10871,13 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10773
10871
|
|
10774
10872
|
var tableActionDom = function tableActionDom(record, index) {
|
10775
10873
|
var showMoreNum = (optionColumnConfig === null || optionColumnConfig === void 0 ? void 0 : optionColumnConfig.showMoreNum) || 0;
|
10874
|
+
var tableActionList = (tableAction === null || tableAction === void 0 ? void 0 : tableAction.filter(function (v) {
|
10875
|
+
return fliterAction ? fliterAction(record, v) : true;
|
10876
|
+
})) || [];
|
10776
10877
|
|
10777
|
-
if (tableAction && showMoreNum > 0 && showMoreNum <
|
10778
|
-
var tableAction1 =
|
10779
|
-
var tableAction2 =
|
10878
|
+
if (tableAction && showMoreNum > 0 && showMoreNum < tableActionList.length) {
|
10879
|
+
var tableAction1 = tableActionList === null || tableActionList === void 0 ? void 0 : tableActionList.slice(0, showMoreNum);
|
10880
|
+
var tableAction2 = tableActionList === null || tableActionList === void 0 ? void 0 : tableActionList.slice(showMoreNum);
|
10780
10881
|
var menu = /*#__PURE__*/React.createElement(_Menu, null, tableAction2.map(function (item, i) {
|
10781
10882
|
var _actionHandler$item$t2;
|
10782
10883
|
|
@@ -10828,7 +10929,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10828
10929
|
key: "more"
|
10829
10930
|
}, /*#__PURE__*/React.createElement(EllipsisOutlined, null)))]);
|
10830
10931
|
} else {
|
10831
|
-
return
|
10932
|
+
return tableActionList === null || tableActionList === void 0 ? void 0 : tableActionList.map(function (item, i) {
|
10832
10933
|
var _actionHandler$item$t6;
|
10833
10934
|
|
10834
10935
|
var btn = actionConfig[item.type];
|
@@ -12533,4 +12634,4 @@ function WaterLevelCharts(config) {
|
|
12533
12634
|
});
|
12534
12635
|
}
|
12535
12636
|
|
12536
|
-
export { Index$9 as AutoScroll, Index$b as Breadcrumb, WButton as Button, index$2 as Card, WCascader as Cascader, Index$3 as Checkbox, Index$8 as CountUp, Index$1 as DatePicker, DragBox, index as IconFont, Index as Input, WInputNumber as InputNumber, LineEcharts, Modal, ModalForm$1 as ModalForm, Modal$1 as ModalTips, Index$7 as Number, NumericInput, Index$2 as Radio, Select, Index$a as Swiper, WSwitch as Switch, index$3 as TabelCard, index$1 as Table, Index$6 as TreeSelect, index$5 as Video, index$4 as VideoPlayer, Index$5 as WDatePicker, WForm$1 as WForm, WaterLevelCharts, WebsocketHeart };
|
12637
|
+
export { Index$9 as AutoScroll, Index$b as Breadcrumb, WButton as Button, index$2 as Card, WCascader as Cascader, Index$3 as Checkbox, Index$8 as CountUp, Index$1 as DatePicker, DragBox, index as IconFont, Index as Input, WInputNumber as InputNumber, LineEcharts, Modal, ModalForm$1 as ModalForm, Modal$1 as ModalTips, Index$7 as Number, NumericInput, Index$2 as Radio, Select, Index$a as Swiper, WSwitch as Switch, index$3 as TabelCard, index$1 as Table, Index$6 as TreeSelect, index$5 as Video, index$4 as VideoPlayer, Index$5 as WDatePicker, WForm$1 as WForm, WaterLevelCharts, WebsocketHeart, useEventEmitter };
|
package/dist/index.js
CHANGED
@@ -2,13 +2,14 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
+
var React = require('react');
|
6
|
+
var lodash = require('lodash');
|
5
7
|
require('antd/es/button/style');
|
6
8
|
var _Button = require('antd/es/button');
|
7
9
|
require('antd/es/dropdown/style');
|
8
10
|
var _Dropdown = require('antd/es/dropdown');
|
9
11
|
require('antd/es/menu/style');
|
10
12
|
var _Menu = require('antd/es/menu');
|
11
|
-
var React = require('react');
|
12
13
|
var icons = require('@ant-design/icons');
|
13
14
|
require('antd/es/input/style');
|
14
15
|
var _Input = require('antd/es/input');
|
@@ -55,7 +56,6 @@ var ProTable = require('@ant-design/pro-table');
|
|
55
56
|
var Player = require('xgplayer');
|
56
57
|
var FlvPlayer = require('xgplayer-flv.js');
|
57
58
|
var HlsJsPlayer = require('xgplayer-hls.js');
|
58
|
-
var lodash = require('lodash');
|
59
59
|
var ReactEChartsCore = require('echarts-for-react/lib/core');
|
60
60
|
var echarts = require('echarts/core');
|
61
61
|
var charts = require('echarts/charts');
|
@@ -84,10 +84,10 @@ function _interopNamespace(e) {
|
|
84
84
|
return Object.freeze(n);
|
85
85
|
}
|
86
86
|
|
87
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
87
88
|
var _Button__default = /*#__PURE__*/_interopDefaultLegacy(_Button);
|
88
89
|
var _Dropdown__default = /*#__PURE__*/_interopDefaultLegacy(_Dropdown);
|
89
90
|
var _Menu__default = /*#__PURE__*/_interopDefaultLegacy(_Menu);
|
90
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
91
91
|
var _Input__default = /*#__PURE__*/_interopDefaultLegacy(_Input);
|
92
92
|
var _InputNumber__default = /*#__PURE__*/_interopDefaultLegacy(_InputNumber);
|
93
93
|
var _Pagination__default = /*#__PURE__*/_interopDefaultLegacy(_Pagination);
|
@@ -500,6 +500,91 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
500
500
|
};
|
501
501
|
}
|
502
502
|
|
503
|
+
var EventEmitter = /*#__PURE__*/_createClass(function EventEmitter() {
|
504
|
+
var _this = this;
|
505
|
+
|
506
|
+
_classCallCheck(this, EventEmitter);
|
507
|
+
|
508
|
+
this.subscriptions = new Map();
|
509
|
+
|
510
|
+
this.useSubscription = function (event, listener) {
|
511
|
+
var callbackRef = React.useRef();
|
512
|
+
React.useEffect(function () {
|
513
|
+
callbackRef.current = listener;
|
514
|
+
|
515
|
+
function subscription(val) {
|
516
|
+
if (callbackRef.current) {
|
517
|
+
callbackRef.current(val);
|
518
|
+
}
|
519
|
+
}
|
520
|
+
|
521
|
+
_this.subscriptions.set(event, subscription);
|
522
|
+
|
523
|
+
return function () {
|
524
|
+
_this.subscriptions.delete(event);
|
525
|
+
};
|
526
|
+
}, []);
|
527
|
+
};
|
528
|
+
|
529
|
+
this.emit = function (event) {
|
530
|
+
if (typeof event === 'string' || typeof event === 'number') {
|
531
|
+
var subscriptionValuesCallback = _this.subscriptions.get(event);
|
532
|
+
|
533
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
534
|
+
args[_key - 1] = arguments[_key];
|
535
|
+
}
|
536
|
+
|
537
|
+
subscriptionValuesCallback === null || subscriptionValuesCallback === void 0 ? void 0 : subscriptionValuesCallback({
|
538
|
+
params: lodash.cloneDeep(args),
|
539
|
+
event: event
|
540
|
+
});
|
541
|
+
} else throw new TypeError('event must be string or number !');
|
542
|
+
};
|
543
|
+
|
544
|
+
this.removeListener = function (event) {
|
545
|
+
_this.subscriptions.delete(event);
|
546
|
+
};
|
547
|
+
|
548
|
+
this.clear = function () {
|
549
|
+
_this.subscriptions.clear();
|
550
|
+
};
|
551
|
+
|
552
|
+
this.clear();
|
553
|
+
});
|
554
|
+
|
555
|
+
var eventEmitterOverall = new EventEmitter();
|
556
|
+
|
557
|
+
/*
|
558
|
+
* @Author: lijin
|
559
|
+
* @Date: 2022-07-22 14:29:31
|
560
|
+
* @LastEditTime: 2022-07-22 14:29:31
|
561
|
+
* @LastEditors: lijin
|
562
|
+
* @Description:
|
563
|
+
* @FilePath: \wargerm-components\src\hooks\useEventEmitter.tsx
|
564
|
+
* 可以输入预定的版权声明、个性签名、空行等
|
565
|
+
*/
|
566
|
+
function useEventEmitter(options) {
|
567
|
+
var ref = React.useRef();
|
568
|
+
var eventEmitterOptions = React.useMemo(function () {
|
569
|
+
return options !== null && options !== void 0 ? options : {
|
570
|
+
global: false
|
571
|
+
};
|
572
|
+
}, [options]);
|
573
|
+
|
574
|
+
if (!ref.current) {
|
575
|
+
ref.current = eventEmitterOptions.global ? ref.current = eventEmitterOverall : ref.current = new EventEmitter();
|
576
|
+
}
|
577
|
+
|
578
|
+
React.useEffect(function () {
|
579
|
+
return function () {
|
580
|
+
var _ref$current;
|
581
|
+
|
582
|
+
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.clear();
|
583
|
+
};
|
584
|
+
}, []);
|
585
|
+
return ref.current;
|
586
|
+
}
|
587
|
+
|
503
588
|
var _excluded = ["multiple", "children", "disabled"];
|
504
589
|
|
505
590
|
var WButton = function WButton(props) {
|
@@ -605,10 +690,10 @@ Index$3.Group = _Checkbox__default['default'].Group;
|
|
605
690
|
/*
|
606
691
|
* @Author: lijin
|
607
692
|
* @Date: 2021-10-27 22:18:49
|
608
|
-
* @LastEditTime: 2022-
|
609
|
-
* @LastEditors:
|
693
|
+
* @LastEditTime: 2022-07-22 15:17:01
|
694
|
+
* @LastEditors: lijin
|
610
695
|
* @Description:
|
611
|
-
* @FilePath: \wargerm\src\utils\index.ts
|
696
|
+
* @FilePath: \wargerm-components\src\utils\index.ts
|
612
697
|
* 可以输入预定的版权声明、个性签名、空行等
|
613
698
|
*/
|
614
699
|
|
@@ -6916,6 +7001,12 @@ var WForm = function WForm(props, ref) {
|
|
6916
7001
|
setColumnsFields(function (preColumnsFields) {
|
6917
7002
|
return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, opt));
|
6918
7003
|
});
|
7004
|
+
|
7005
|
+
if (c.useFirstIteminitialValue) {
|
7006
|
+
var _form$setFieldsValue, _opt$0$value, _opt$;
|
7007
|
+
|
7008
|
+
form === null || form === void 0 ? void 0 : (_form$setFieldsValue = form.setFieldsValue) === null || _form$setFieldsValue === void 0 ? void 0 : _form$setFieldsValue.call(form, _defineProperty({}, c.dataIndex, (_opt$0$value = opt === null || opt === void 0 ? void 0 : (_opt$ = opt[0]) === null || _opt$ === void 0 ? void 0 : _opt$.value) !== null && _opt$0$value !== void 0 ? _opt$0$value : ''));
|
7009
|
+
}
|
6919
7010
|
}
|
6920
7011
|
}, c.fieldProps), _extraProps))));
|
6921
7012
|
} else if (c.valueType == 'cascader') {
|
@@ -7383,6 +7474,12 @@ var WForm = function WForm(props, ref) {
|
|
7383
7474
|
setColumnsFields(function (preColumnsFields) {
|
7384
7475
|
return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, opt));
|
7385
7476
|
});
|
7477
|
+
|
7478
|
+
if (c.useFirstIteminitialValue) {
|
7479
|
+
var _form$setFieldsValue2, _opt$0$value2, _opt$2;
|
7480
|
+
|
7481
|
+
form === null || form === void 0 ? void 0 : (_form$setFieldsValue2 = form.setFieldsValue) === null || _form$setFieldsValue2 === void 0 ? void 0 : _form$setFieldsValue2.call(form, _defineProperty({}, c.dataIndex, (_opt$0$value2 = opt === null || opt === void 0 ? void 0 : (_opt$2 = opt[0]) === null || _opt$2 === void 0 ? void 0 : _opt$2.value) !== null && _opt$0$value2 !== void 0 ? _opt$0$value2 : ''));
|
7482
|
+
}
|
7386
7483
|
}
|
7387
7484
|
}, c.fieldProps), _extraProps4))));
|
7388
7485
|
} else if (c.valueType == 'cascader') {
|
@@ -7862,7 +7959,7 @@ var WForm = function WForm(props, ref) {
|
|
7862
7959
|
};
|
7863
7960
|
|
7864
7961
|
var setFieldsValue = function setFieldsValue(record) {
|
7865
|
-
var _form$
|
7962
|
+
var _form$setFieldsValue4;
|
7866
7963
|
|
7867
7964
|
var setFieldsValues = _objectSpread2({}, record);
|
7868
7965
|
|
@@ -7878,7 +7975,7 @@ var WForm = function WForm(props, ref) {
|
|
7878
7975
|
return false;
|
7879
7976
|
}
|
7880
7977
|
});
|
7881
|
-
form === null || form === void 0 ? void 0 : (_form$
|
7978
|
+
form === null || form === void 0 ? void 0 : (_form$setFieldsValue4 = form.setFieldsValue) === null || _form$setFieldsValue4 === void 0 ? void 0 : _form$setFieldsValue4.call(form, setFieldsValues);
|
7882
7979
|
};
|
7883
7980
|
|
7884
7981
|
React.useImperativeHandle(ref, function () {
|
@@ -8410,7 +8507,7 @@ function Table(_ref) {
|
|
8410
8507
|
}
|
8411
8508
|
}, _callee);
|
8412
8509
|
}))();
|
8413
|
-
}, [params, pageParams, pagination, tableList, formSearch, columns]);
|
8510
|
+
}, [JSON.stringify(params), JSON.stringify(pageParams), JSON.stringify(pagination), JSON.stringify(tableList), formSearch, JSON.stringify(columns)]);
|
8414
8511
|
|
8415
8512
|
var onFormSubmit = function onFormSubmit(values) {
|
8416
8513
|
onSubmit && onSubmit(values);
|
@@ -10619,7 +10716,7 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10619
10716
|
|
10620
10717
|
var ModalForm$1 = /*#__PURE__*/React__default['default'].forwardRef(ModalForm);
|
10621
10718
|
|
10622
|
-
var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
|
10719
|
+
var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "fliterAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
|
10623
10720
|
|
10624
10721
|
var TabelCard = function TabelCard(props, ref) {
|
10625
10722
|
var columns = props.columns,
|
@@ -10628,6 +10725,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10628
10725
|
modalFormSearch = props.modalFormSearch,
|
10629
10726
|
search = props.search,
|
10630
10727
|
tableAction = props.tableAction,
|
10728
|
+
fliterAction = props.fliterAction,
|
10631
10729
|
renderTableBar = props.renderTableBar,
|
10632
10730
|
className = props.className,
|
10633
10731
|
style = props.style,
|
@@ -10832,10 +10930,13 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10832
10930
|
|
10833
10931
|
var tableActionDom = function tableActionDom(record, index) {
|
10834
10932
|
var showMoreNum = (optionColumnConfig === null || optionColumnConfig === void 0 ? void 0 : optionColumnConfig.showMoreNum) || 0;
|
10933
|
+
var tableActionList = (tableAction === null || tableAction === void 0 ? void 0 : tableAction.filter(function (v) {
|
10934
|
+
return fliterAction ? fliterAction(record, v) : true;
|
10935
|
+
})) || [];
|
10835
10936
|
|
10836
|
-
if (tableAction && showMoreNum > 0 && showMoreNum <
|
10837
|
-
var tableAction1 =
|
10838
|
-
var tableAction2 =
|
10937
|
+
if (tableAction && showMoreNum > 0 && showMoreNum < tableActionList.length) {
|
10938
|
+
var tableAction1 = tableActionList === null || tableActionList === void 0 ? void 0 : tableActionList.slice(0, showMoreNum);
|
10939
|
+
var tableAction2 = tableActionList === null || tableActionList === void 0 ? void 0 : tableActionList.slice(showMoreNum);
|
10839
10940
|
var menu = /*#__PURE__*/React__default['default'].createElement(_Menu__default['default'], null, tableAction2.map(function (item, i) {
|
10840
10941
|
var _actionHandler$item$t2;
|
10841
10942
|
|
@@ -10887,7 +10988,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10887
10988
|
key: "more"
|
10888
10989
|
}, /*#__PURE__*/React__default['default'].createElement(icons.EllipsisOutlined, null)))]);
|
10889
10990
|
} else {
|
10890
|
-
return
|
10991
|
+
return tableActionList === null || tableActionList === void 0 ? void 0 : tableActionList.map(function (item, i) {
|
10891
10992
|
var _actionHandler$item$t6;
|
10892
10993
|
|
10893
10994
|
var btn = actionConfig[item.type];
|
@@ -12623,3 +12724,4 @@ exports.WDatePicker = Index$5;
|
|
12623
12724
|
exports.WForm = WForm$1;
|
12624
12725
|
exports.WaterLevelCharts = WaterLevelCharts;
|
12625
12726
|
exports.WebsocketHeart = WebsocketHeart;
|
12727
|
+
exports.useEventEmitter = useEventEmitter;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
declare type SubscriptionParams<T = any> = {
|
2
|
+
params: T;
|
3
|
+
event: string | number;
|
4
|
+
};
|
5
|
+
declare type Subscription<T> = ({ params, event }: SubscriptionParams<T>) => void;
|
6
|
+
declare class EventEmitter<T> {
|
7
|
+
private subscriptions;
|
8
|
+
constructor();
|
9
|
+
useSubscription: (event: string, listener?: Subscription<T> | undefined) => void;
|
10
|
+
emit: (event: string | number, ...args: T extends any[] ? any[] : any) => void;
|
11
|
+
removeListener: (event: string) => void;
|
12
|
+
clear: () => void;
|
13
|
+
}
|
14
|
+
declare const eventEmitterOverall: EventEmitter<unknown>;
|
15
|
+
export { EventEmitter, eventEmitterOverall };
|
package/package.json
CHANGED
@@ -1,88 +1,88 @@
|
|
1
|
-
{
|
2
|
-
"private": false,
|
3
|
-
"name": "wargerm",
|
4
|
-
"version": "0.5.
|
5
|
-
"scripts": {
|
6
|
-
"dev": "dumi dev",
|
7
|
-
"docs:build": "dumi build",
|
8
|
-
"docs:deploy": "gh-pages -d docs-dist",
|
9
|
-
"build": "father-build",
|
10
|
-
"deploy": "npm run docs:build && npm run docs:deploy",
|
11
|
-
"release": "npm run build && npm publish",
|
12
|
-
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
|
13
|
-
"test": "umi-test",
|
14
|
-
"test:coverage": "umi-test --coverage"
|
15
|
-
},
|
16
|
-
"main": "dist/index.js",
|
17
|
-
"module": "dist/index.esm.js",
|
18
|
-
"unpkg": "dist/index.umd.min.js",
|
19
|
-
"typings": "dist/index.d.ts",
|
20
|
-
"author": "jinly2",
|
21
|
-
"license": "MIT",
|
22
|
-
"keywords": [
|
23
|
-
"React",
|
24
|
-
"Component"
|
25
|
-
],
|
26
|
-
"gitHooks": {
|
27
|
-
"pre-commit": "lint-staged"
|
28
|
-
},
|
29
|
-
"repository": {
|
30
|
-
"type": "git",
|
31
|
-
"url": "http://code.eblssmart.com/platform/web/wargerm-components.git",
|
32
|
-
"branch": "main"
|
33
|
-
},
|
34
|
-
"files": [
|
35
|
-
"dist",
|
36
|
-
"es",
|
37
|
-
"lib",
|
38
|
-
"index.css"
|
39
|
-
],
|
40
|
-
"lint-staged": {
|
41
|
-
"*.{js,jsx,less,md,json}": [
|
42
|
-
"prettier --write"
|
43
|
-
],
|
44
|
-
"*.ts?(x)": [
|
45
|
-
"prettier --parser=typescript --write"
|
46
|
-
]
|
47
|
-
},
|
48
|
-
"dependencies": {
|
49
|
-
"@ant-design/pro-form": "^1.49.3",
|
50
|
-
"@ant-design/pro-table": "^2.58.1",
|
51
|
-
"animate.css": "^4.1.1",
|
52
|
-
"react-countup": "^6.0.0",
|
53
|
-
"react-dom": "^17.0.2",
|
54
|
-
"echarts": "^5.2.2",
|
55
|
-
"echarts-for-react": "^3.0.2",
|
56
|
-
"swiper": "^6.7.0",
|
57
|
-
"xgplayer": "^2.31.6",
|
58
|
-
"xgplayer-flv": "^2.5.1",
|
59
|
-
"xgplayer-flv.js": "^2.3.0",
|
60
|
-
"xgplayer-hls": "^2.5.2",
|
61
|
-
"xgplayer-hls.js": "^2.6.1"
|
62
|
-
},
|
63
|
-
"peerDependencies": {
|
64
|
-
"@ant-design/icons": ">=4.2.0",
|
65
|
-
"antd": ">=4.7.0",
|
66
|
-
"classnames": ">=2.2.0",
|
67
|
-
"echarts": "^5.2.2",
|
68
|
-
"echarts-for-react": "^3.0.2",
|
69
|
-
"lodash": ">=4.0.0",
|
70
|
-
"react": ">=17.0.0"
|
71
|
-
},
|
72
|
-
"devDependencies": {
|
73
|
-
"@ant-design/icons": "^4.6.4",
|
74
|
-
"@types/lodash": "^4.14.173",
|
75
|
-
"@types/react-dom": "^17.0.11",
|
76
|
-
"@umijs/test": "^3.0.5",
|
77
|
-
"antd": "^4.16.13",
|
78
|
-
"babel-plugin-import": "^1.13.3",
|
79
|
-
"classnames": "^2.3.1",
|
80
|
-
"dumi": "^1.1.31",
|
81
|
-
"father-build": "^1.19.1",
|
82
|
-
"gh-pages": "^3.0.0",
|
83
|
-
"lint-staged": "^10.0.7",
|
84
|
-
"prettier": "^1.19.1",
|
85
|
-
"react": "^16.12.0",
|
86
|
-
"yorkie": "^2.0.0"
|
87
|
-
}
|
88
|
-
}
|
1
|
+
{
|
2
|
+
"private": false,
|
3
|
+
"name": "wargerm",
|
4
|
+
"version": "0.5.5",
|
5
|
+
"scripts": {
|
6
|
+
"dev": "dumi dev",
|
7
|
+
"docs:build": "dumi build",
|
8
|
+
"docs:deploy": "gh-pages -d docs-dist",
|
9
|
+
"build": "father-build",
|
10
|
+
"deploy": "npm run docs:build && npm run docs:deploy",
|
11
|
+
"release": "npm run build && npm publish",
|
12
|
+
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
|
13
|
+
"test": "umi-test",
|
14
|
+
"test:coverage": "umi-test --coverage"
|
15
|
+
},
|
16
|
+
"main": "dist/index.js",
|
17
|
+
"module": "dist/index.esm.js",
|
18
|
+
"unpkg": "dist/index.umd.min.js",
|
19
|
+
"typings": "dist/index.d.ts",
|
20
|
+
"author": "jinly2",
|
21
|
+
"license": "MIT",
|
22
|
+
"keywords": [
|
23
|
+
"React",
|
24
|
+
"Component"
|
25
|
+
],
|
26
|
+
"gitHooks": {
|
27
|
+
"pre-commit": "lint-staged"
|
28
|
+
},
|
29
|
+
"repository": {
|
30
|
+
"type": "git",
|
31
|
+
"url": "http://code.eblssmart.com/platform/web/wargerm-components.git",
|
32
|
+
"branch": "main"
|
33
|
+
},
|
34
|
+
"files": [
|
35
|
+
"dist",
|
36
|
+
"es",
|
37
|
+
"lib",
|
38
|
+
"index.css"
|
39
|
+
],
|
40
|
+
"lint-staged": {
|
41
|
+
"*.{js,jsx,less,md,json}": [
|
42
|
+
"prettier --write"
|
43
|
+
],
|
44
|
+
"*.ts?(x)": [
|
45
|
+
"prettier --parser=typescript --write"
|
46
|
+
]
|
47
|
+
},
|
48
|
+
"dependencies": {
|
49
|
+
"@ant-design/pro-form": "^1.49.3",
|
50
|
+
"@ant-design/pro-table": "^2.58.1",
|
51
|
+
"animate.css": "^4.1.1",
|
52
|
+
"react-countup": "^6.0.0",
|
53
|
+
"react-dom": "^17.0.2",
|
54
|
+
"echarts": "^5.2.2",
|
55
|
+
"echarts-for-react": "^3.0.2",
|
56
|
+
"swiper": "^6.7.0",
|
57
|
+
"xgplayer": "^2.31.6",
|
58
|
+
"xgplayer-flv": "^2.5.1",
|
59
|
+
"xgplayer-flv.js": "^2.3.0",
|
60
|
+
"xgplayer-hls": "^2.5.2",
|
61
|
+
"xgplayer-hls.js": "^2.6.1"
|
62
|
+
},
|
63
|
+
"peerDependencies": {
|
64
|
+
"@ant-design/icons": ">=4.2.0",
|
65
|
+
"antd": ">=4.7.0",
|
66
|
+
"classnames": ">=2.2.0",
|
67
|
+
"echarts": "^5.2.2",
|
68
|
+
"echarts-for-react": "^3.0.2",
|
69
|
+
"lodash": ">=4.0.0",
|
70
|
+
"react": ">=17.0.0"
|
71
|
+
},
|
72
|
+
"devDependencies": {
|
73
|
+
"@ant-design/icons": "^4.6.4",
|
74
|
+
"@types/lodash": "^4.14.173",
|
75
|
+
"@types/react-dom": "^17.0.11",
|
76
|
+
"@umijs/test": "^3.0.5",
|
77
|
+
"antd": "^4.16.13",
|
78
|
+
"babel-plugin-import": "^1.13.3",
|
79
|
+
"classnames": "^2.3.1",
|
80
|
+
"dumi": "^1.1.31",
|
81
|
+
"father-build": "^1.19.1",
|
82
|
+
"gh-pages": "^3.0.0",
|
83
|
+
"lint-staged": "^10.0.7",
|
84
|
+
"prettier": "^1.19.1",
|
85
|
+
"react": "^16.12.0",
|
86
|
+
"yorkie": "^2.0.0"
|
87
|
+
}
|
88
|
+
}
|