wargerm 0.5.39 → 0.6.1

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/index.esm.js CHANGED
@@ -1,5 +1,6 @@
1
- import React, { useRef, useEffect, useMemo, useState, useImperativeHandle, memo, forwardRef, createRef, useCallback } from 'react';
2
- import { cloneDeep, isEmpty } from 'lodash';
1
+ import React, { useRef, useEffect, useMemo, useState, useCallback, useImperativeHandle, memo, forwardRef, createRef } from 'react';
2
+ import { cloneDeep, uniqBy, isEmpty } from 'lodash-es';
3
+ import { useSyncExternalStore } from 'use-sync-external-store/shim';
3
4
  import 'antd/es/button/style';
4
5
  import _Button from 'antd/es/button';
5
6
  import 'antd/es/dropdown/style';
@@ -36,7 +37,6 @@ import moment from 'moment';
36
37
  import 'moment/locale/zh-cn';
37
38
  import 'antd/es/checkbox/style';
38
39
  import _Checkbox from 'antd/es/checkbox';
39
- import uniqBy from 'lodash/uniqBy';
40
40
  import 'antd/es/row/style';
41
41
  import _Row from 'antd/es/row';
42
42
  import 'antd/es/col/style';
@@ -542,6 +542,203 @@ function useEventEmitter(options) {
542
542
  return ref.current;
543
543
  }
544
544
 
545
+ var run = function run(fn) {
546
+ fn();
547
+ };
548
+
549
+ var __DEV__ = process.env.NODE_ENV !== 'production';
550
+
551
+ var create = function create(initStore) {
552
+ if (__DEV__ && typeof initStore !== 'function') {
553
+ throw new Error('Expected a function');
554
+ }
555
+
556
+ var store;
557
+ var listeners = new Set();
558
+
559
+ function getSetStore(s) {
560
+ if (typeof s === 'undefined') return store;
561
+ var partial = typeof s === 'function' ? s(store) : s;
562
+ store = _objectSpread2(_objectSpread2({}, store), partial);
563
+ run(function () {
564
+ return listeners.forEach(function (listener) {
565
+ return listener(partial);
566
+ });
567
+ });
568
+ }
569
+
570
+ store = initStore(getSetStore);
571
+ return function useStore() {
572
+ var proxy = useRef({});
573
+ var handler = useRef({});
574
+ var hasState = useRef(false);
575
+ var hasUpdate = useRef(false);
576
+
577
+ var _useState = useState(false),
578
+ _useState2 = _slicedToArray(_useState, 2),
579
+ setState = _useState2[1];
580
+
581
+ useMemo(function () {
582
+ handler.current = {
583
+ get: function get(target, key) {
584
+ var val = store[key];
585
+
586
+ if (typeof val !== 'function') {
587
+ hasState.current = true;
588
+ target[key] = val;
589
+ return target[key];
590
+ }
591
+
592
+ target[key] = new Proxy(val, {
593
+ get: function get(fn, fnKey) {
594
+ if (fnKey === 'loading' && !('loading' in fn)) {
595
+ fn.loading = false;
596
+ }
597
+
598
+ return fn[fnKey];
599
+ },
600
+ apply: function apply(fn, _this, args) {
601
+ var res = fn.apply(void 0, _toConsumableArray(args));
602
+
603
+ if (!('loading' in fn) || !res || typeof res.then !== 'function') {
604
+ target[key] = fn;
605
+ return res;
606
+ }
607
+
608
+ var setLoading = function setLoading(loading) {
609
+ target[key].loading = loading;
610
+ setState(function (s) {
611
+ return !s;
612
+ });
613
+ };
614
+
615
+ target[key] = function () {
616
+ var newRes = fn.apply(void 0, arguments);
617
+ setLoading(true);
618
+ return newRes.finally(function () {
619
+ return setLoading(false);
620
+ });
621
+ };
622
+
623
+ setLoading(true);
624
+ return res.finally(function () {
625
+ return setLoading(false);
626
+ });
627
+ }
628
+ });
629
+ return target[key];
630
+ },
631
+ set: function set(target, key, val) {
632
+ if (key in target && val !== target[key]) {
633
+ hasUpdate.current = true;
634
+ target[key] = val;
635
+ }
636
+
637
+ return true;
638
+ }
639
+ };
640
+ proxy.current = new Proxy({}, handler.current);
641
+ }, []);
642
+ useEffect(function () {
643
+ handler.current.get = function (target, key) {
644
+ return target[key];
645
+ };
646
+ }, []);
647
+ var subscribe = useCallback(function (update) {
648
+ if (!hasState.current) return function () {
649
+ return undefined;
650
+ };
651
+
652
+ var listener = function listener(partial) {
653
+ Object.assign(proxy.current, partial);
654
+
655
+ if (hasUpdate.current) {
656
+ hasUpdate.current = false;
657
+ update();
658
+ }
659
+ };
660
+
661
+ listeners.add(listener);
662
+ return function () {
663
+ return listeners.delete(listener);
664
+ };
665
+ }, []);
666
+ var getSnapshot = useCallback(function () {
667
+ return store;
668
+ }, []);
669
+ useSyncExternalStore(subscribe, getSnapshot);
670
+ return proxy.current;
671
+ };
672
+ };
673
+
674
+ create.config = function (_ref) {
675
+ var batch = _ref.batch;
676
+ run = batch;
677
+ };
678
+
679
+ var run$1 = function run(fn) {
680
+ fn();
681
+ };
682
+
683
+ var __DEV__$1 = process.env.NODE_ENV !== 'production';
684
+
685
+ var wmox = function wmox(state) {
686
+ if (__DEV__$1 && Object.prototype.toString.call(state) !== '[object Object]') {
687
+ throw new Error('object required');
688
+ }
689
+
690
+ var store = {};
691
+ Object.keys(state).forEach(function (key) {
692
+ if (typeof state[key] === 'function') {
693
+ return;
694
+ }
695
+
696
+ var listeners = new Set();
697
+ store[key] = {
698
+ subscribe: function subscribe(listener) {
699
+ listeners.add(listener);
700
+ return function () {
701
+ return listeners.delete(listener);
702
+ };
703
+ },
704
+ getSnapshot: function getSnapshot() {
705
+ return state[key];
706
+ },
707
+ setSnapshot: function setSnapshot(val) {
708
+ if (val !== state[key]) {
709
+ state[key] = val;
710
+ run$1(function () {
711
+ return listeners.forEach(function (listener) {
712
+ return listener();
713
+ });
714
+ });
715
+ }
716
+ },
717
+ useSnapshot: function useSnapshot() {
718
+ return useSyncExternalStore(store[key].subscribe, store[key].getSnapshot);
719
+ }
720
+ };
721
+ });
722
+ return new Proxy(state, {
723
+ get: function get(_, key) {
724
+ try {
725
+ return store[key].useSnapshot();
726
+ } catch (e) {
727
+ return state[key];
728
+ }
729
+ },
730
+ set: function set(_, key, val) {
731
+ store[key].setSnapshot(val);
732
+ return true;
733
+ }
734
+ });
735
+ };
736
+
737
+ wmox.config = function (_ref) {
738
+ var batch = _ref.batch;
739
+ run$1 = batch;
740
+ };
741
+
545
742
  var _excluded = ["multiple", "children", "disabled"];
546
743
 
547
744
  var WButton = function WButton(props) {
@@ -6819,6 +7016,610 @@ var index$6 = (function (_ref) {
6819
7016
  });
6820
7017
  });
6821
7018
 
7019
+ var _excluded$m = ["className", "frameStyle", "style", "direction", "children"];
7020
+ function FrameBox$1(_ref) {
7021
+ var _classnames;
7022
+
7023
+ var className = _ref.className,
7024
+ frameStyle = _ref.frameStyle,
7025
+ style = _ref.style,
7026
+ _ref$direction = _ref.direction,
7027
+ direction = _ref$direction === void 0 ? 'in' : _ref$direction,
7028
+ children = _ref.children,
7029
+ props = _objectWithoutProperties(_ref, _excluded$m);
7030
+
7031
+ return /*#__PURE__*/React.createElement("div", _objectSpread2({
7032
+ className: classnames((_classnames = {}, _defineProperty(_classnames, 'frame', true), _defineProperty(_classnames, className || '', true), _classnames)),
7033
+ style: style
7034
+ }, props), /*#__PURE__*/React.createElement("div", {
7035
+ style: _objectSpread2({
7036
+ transform: "translateY(".concat(direction == 'in' ? 0 : -100, "%)"),
7037
+ left: "".concat(direction == 'in' ? 0 : -1, "px)")
7038
+ }, frameStyle)
7039
+ }), /*#__PURE__*/React.createElement("div", {
7040
+ style: _objectSpread2({
7041
+ transform: "translateY(".concat(direction == 'in' ? 0 : -100, "%)"),
7042
+ right: "".concat(direction == 'in' ? 0 : -1, "px)")
7043
+ }, frameStyle)
7044
+ }), /*#__PURE__*/React.createElement("div", {
7045
+ style: _objectSpread2({
7046
+ transform: "translateY(".concat(direction == 'in' ? 0 : 100, "%)"),
7047
+ right: "".concat(direction == 'in' ? 0 : -1, "px)")
7048
+ }, frameStyle)
7049
+ }), /*#__PURE__*/React.createElement("div", {
7050
+ style: _objectSpread2({
7051
+ transform: "translateY(".concat(direction == 'in' ? 0 : 100, "%)"),
7052
+ left: "".concat(direction == 'in' ? 0 : -1, "px)")
7053
+ }, frameStyle)
7054
+ }), children);
7055
+ }
7056
+
7057
+ var _excluded$n = ["columns", "dataSource", "request", "onLoad", "params", "onSubmit", "rowKey", "onRow", "className", "rowClassName", "rowSelection", "style", "tbodyStyle", "thStyle", "border", "scroll", "pagination", "search", "frameBoxTable", "frameBoxDirection", "formRef", "none"];
7058
+ function NtTable(_ref) {
7059
+ var _formSearchRef$curren4, _classnames2, _columns$, _columns$2;
7060
+
7061
+ var columns = _ref.columns,
7062
+ tableList = _ref.dataSource,
7063
+ request = _ref.request,
7064
+ onLoad = _ref.onLoad,
7065
+ params = _ref.params,
7066
+ onSubmit = _ref.onSubmit,
7067
+ _ref$rowKey = _ref.rowKey,
7068
+ rowKey = _ref$rowKey === void 0 ? 'key' : _ref$rowKey,
7069
+ onRow = _ref.onRow,
7070
+ className = _ref.className,
7071
+ rowClassName = _ref.rowClassName,
7072
+ rowSelection = _ref.rowSelection,
7073
+ style = _ref.style,
7074
+ tbodyStyle = _ref.tbodyStyle,
7075
+ thStyle = _ref.thStyle,
7076
+ _ref$border = _ref.border,
7077
+ scroll = _ref.scroll,
7078
+ _ref$pagination = _ref.pagination,
7079
+ pagination = _ref$pagination === void 0 ? false : _ref$pagination,
7080
+ _ref$search = _ref.search,
7081
+ search = _ref$search === void 0 ? false : _ref$search,
7082
+ _ref$frameBoxTable = _ref.frameBoxTable,
7083
+ frameBoxTable = _ref$frameBoxTable === void 0 ? false : _ref$frameBoxTable,
7084
+ _ref$frameBoxDirectio = _ref.frameBoxDirection,
7085
+ frameBoxDirection = _ref$frameBoxDirectio === void 0 ? 'out' : _ref$frameBoxDirectio,
7086
+ formRef = _ref.formRef,
7087
+ none = _ref.none,
7088
+ props = _objectWithoutProperties(_ref, _excluded$n);
7089
+
7090
+ var _useState = useState(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || [])),
7091
+ _useState2 = _slicedToArray(_useState, 2),
7092
+ selectedRowKeys = _useState2[0],
7093
+ setSelectedKeys = _useState2[1];
7094
+
7095
+ var _useState3 = useState([]),
7096
+ _useState4 = _slicedToArray(_useState3, 2),
7097
+ selectedRows = _useState4[0],
7098
+ setSelectedRows = _useState4[1];
7099
+
7100
+ var onSelectAllChange = function onSelectAllChange(e) {
7101
+ if (e.target.checked) {
7102
+ setSelectedKeys(dataSource.map(function (record) {
7103
+ return typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey];
7104
+ }));
7105
+ setSelectedRows(function () {
7106
+ var _rowSelection$onSelec;
7107
+
7108
+ rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec = rowSelection.onSelectAll) === null || _rowSelection$onSelec === void 0 ? void 0 : _rowSelection$onSelec.call(rowSelection, e.target.checked, dataSource, dataSource);
7109
+ return dataSource;
7110
+ });
7111
+ } else {
7112
+ setSelectedKeys([]);
7113
+ setSelectedRows(function () {
7114
+ var _rowSelection$onSelec2;
7115
+
7116
+ rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec2 = rowSelection.onSelectAll) === null || _rowSelection$onSelec2 === void 0 ? void 0 : _rowSelection$onSelec2.call(rowSelection, e.target.checked, [], dataSource);
7117
+ return [];
7118
+ });
7119
+ }
7120
+ };
7121
+
7122
+ var _useState5 = useState({}),
7123
+ _useState6 = _slicedToArray(_useState5, 2),
7124
+ columnsFields = _useState6[0],
7125
+ setColumnsFields = _useState6[1];
7126
+
7127
+ var layerIndex = getArrayLayer(columns, 'children', 1);
7128
+
7129
+ var _useState7 = useState({}),
7130
+ _useState8 = _slicedToArray(_useState7, 2),
7131
+ formSearch = _useState8[0],
7132
+ setFormSearch = _useState8[1];
7133
+
7134
+ var formSearchRef = useRef(null);
7135
+ useEffect(function () {
7136
+ var _formSearchRef$curren;
7137
+
7138
+ if (formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren = formSearchRef.current) === null || _formSearchRef$curren === void 0 ? void 0 : _formSearchRef$curren.columnsFields) {
7139
+ var _formSearchRef$curren2;
7140
+
7141
+ setColumnsFields(formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren2 = formSearchRef.current) === null || _formSearchRef$curren2 === void 0 ? void 0 : _formSearchRef$curren2.columnsFields);
7142
+ }
7143
+
7144
+ if ((formSearchRef === null || formSearchRef === void 0 ? void 0 : formSearchRef.current) && formRef) {
7145
+ var _formSearchRef$curren3;
7146
+
7147
+ formRef.current = formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren3 = formSearchRef.current) === null || _formSearchRef$curren3 === void 0 ? void 0 : _formSearchRef$curren3.form;
7148
+ }
7149
+ }, [JSON.stringify(formSearchRef === null || formSearchRef === void 0 ? void 0 : (_formSearchRef$curren4 = formSearchRef.current) === null || _formSearchRef$curren4 === void 0 ? void 0 : _formSearchRef$curren4.columnsFields), formRef, formSearchRef]);
7150
+
7151
+ var flattenColumns = function flattenColumns(columns) {
7152
+ var arr = columns.reduce(function (pre, cur) {
7153
+ if (cur.children) {
7154
+ return pre.concat(flattenColumns(cur.children));
7155
+ }
7156
+
7157
+ return pre.concat(cur);
7158
+ }, []);
7159
+ return arr;
7160
+ };
7161
+
7162
+ var filterFormColumns = useMemo(function () {
7163
+ return flattenColumns(columns).filter(function (c) {
7164
+ return !c.hideInSearch;
7165
+ });
7166
+ }, [columns]);
7167
+ var filterColumns = useMemo(function () {
7168
+ return flattenColumns(columns).filter(function (c) {
7169
+ return !c.hideInTable;
7170
+ });
7171
+ }, [columns]);
7172
+
7173
+ var calcWidth = function calcWidth(columns) {
7174
+ return columns.reduce(function (pre, cur) {
7175
+ var width = cur.width;
7176
+
7177
+ if (width) {
7178
+ return pre + width;
7179
+ }
7180
+
7181
+ return pre;
7182
+ }, 0);
7183
+ };
7184
+
7185
+ var showColumns = columns.filter(function (c) {
7186
+ return !c.hideInTable;
7187
+ });
7188
+ var renderTh = useMemo(function () {
7189
+ var renderThFc = function renderThFc(columns, parentHeight, isChild) {
7190
+ var showColumns = columns.filter(function (c) {
7191
+ return !c.hideInTable;
7192
+ });
7193
+ return showColumns.map(function (c, index) {
7194
+ if (c.children) {
7195
+ return /*#__PURE__*/React.createElement("div", {
7196
+ className: "td",
7197
+ key: index,
7198
+ style: {
7199
+ width: c.width + 'px',
7200
+ flex: c.width ? '0 1 auto' : c.children.length,
7201
+ flexDirection: 'column',
7202
+ display: 'block',
7203
+ height: parentHeight + 'px',
7204
+ borderRight: c.children && isChild ? 'none' : '1px solid #3b5173'
7205
+ }
7206
+ }, /*#__PURE__*/React.createElement("div", {
7207
+ className: "td",
7208
+ style: {
7209
+ width: c.width + 'px',
7210
+ flex: c.width ? '0 1 auto' : c.children.length,
7211
+ borderBottom: '1px solid #3b5173',
7212
+ height: parentHeight / getArrayLayer(c.children, 'children', 2) + 'px'
7213
+ }
7214
+ }, c.title), /*#__PURE__*/React.createElement("div", {
7215
+ className: "td",
7216
+ style: {
7217
+ display: 'flex',
7218
+ width: '100%',
7219
+ height: parentHeight / getArrayLayer(c.children, 'children', 2) * getArrayLayer(c.children, 'children', 1) + 'px'
7220
+ }
7221
+ }, renderThFc(c.children, parentHeight / getArrayLayer(c.children, 'children', 2) * getArrayLayer(c.children, 'children', 1), true)));
7222
+ } else {
7223
+ return /*#__PURE__*/React.createElement("div", {
7224
+ key: c.dataIndex,
7225
+ style: _objectSpread2({
7226
+ width: c.width + 'px',
7227
+ flex: c.width ? '0 1 auto' : '1',
7228
+ height: !c.children ? '100%' : '32px',
7229
+ borderRight: index != showColumns.length - 1 && filterColumns.length !== showColumns.length ? '1px solid #3b5173' : 'none'
7230
+ }, c.fixed == 'left' ? {
7231
+ left: ((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) ? 56 : 6) + calcWidth(showColumns.slice(0, index - 2 > 0 ? index - 1 : 0))
7232
+ } : c.fixed == 'right' ? {
7233
+ right: calcWidth(showColumns.slice(index + 1))
7234
+ } : {}),
7235
+ className: "td ".concat(c.fixed == 'left' ? 'fixedLeft' : c.fixed == 'right' ? 'fixedRight' : '')
7236
+ }, c.title);
7237
+ }
7238
+ });
7239
+ };
7240
+
7241
+ return renderThFc(columns, layerIndex * 32);
7242
+ }, [columns]);
7243
+
7244
+ var renderTd = function renderTd(record) {
7245
+ var renderThFc = function renderThFc(columns) {
7246
+ var showColumns = columns.filter(function (c) {
7247
+ return !c.hideInTable;
7248
+ });
7249
+ return showColumns.map(function (c, index) {
7250
+ if (c.children) {
7251
+ return /*#__PURE__*/React.createElement("div", {
7252
+ className: "td",
7253
+ key: index,
7254
+ style: {
7255
+ width: c.width + 'px',
7256
+ flex: c.width ? '0 1 auto' : c.children.length,
7257
+ flexDirection: 'column',
7258
+ alignItems: 'center',
7259
+ overflow: 'hidden'
7260
+ }
7261
+ }, /*#__PURE__*/React.createElement("div", {
7262
+ className: "td",
7263
+ style: {
7264
+ width: '100%',
7265
+ alignItems: 'center'
7266
+ }
7267
+ }, renderThFc(c.children)));
7268
+ } else {
7269
+ if (c.showTitle) {
7270
+ var _columnsFields$c$data;
7271
+
7272
+ return /*#__PURE__*/React.createElement(_Tooltip, {
7273
+ key: c.dataIndex,
7274
+ placement: "top",
7275
+ title: record[c.dataIndex]
7276
+ }, /*#__PURE__*/React.createElement("div", {
7277
+ className: "td ".concat(c.fixed == 'left' ? 'fixedLeft' : c.fixed == 'right' ? 'fixedRight' : '', " ").concat(c.ellipsis ? ' ellipsis' : ''),
7278
+ style: _objectSpread2({
7279
+ width: c.width + 'px',
7280
+ flex: c.width ? '0 1 auto' : '1',
7281
+ overflow: 'hidden'
7282
+ }, c.fixed == 'left' ? {
7283
+ left: ((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) ? 56 : 6) + calcWidth(showColumns.slice(0, index - 2 > 0 ? index - 1 : 0))
7284
+ } : c.fixed == 'right' ? {
7285
+ right: calcWidth(showColumns.slice(index + 1))
7286
+ } : {})
7287
+ }, /*#__PURE__*/React.createElement("div", {
7288
+ style: {
7289
+ width: '100%',
7290
+ whiteSpace: 'nowrap',
7291
+ overflow: 'hidden',
7292
+ textOverflow: 'ellipsis'
7293
+ }
7294
+ }, c.render ? c.render(record[c.dataIndex], record, index) : columnsFields[c.dataIndex] ? (_columnsFields$c$data = columnsFields[c.dataIndex].find(function (item) {
7295
+ return item.value == record[c.dataIndex];
7296
+ })) === null || _columnsFields$c$data === void 0 ? void 0 : _columnsFields$c$data.label : record[c.dataIndex])));
7297
+ } else {
7298
+ var _columnsFields$c$data2, _columnsFields$c$data3;
7299
+
7300
+ return /*#__PURE__*/React.createElement("div", {
7301
+ key: c.dataIndex,
7302
+ className: "td ".concat(c.fixed == 'left' ? 'fixedLeft' : c.fixed == 'right' ? 'fixedRight' : '', " ").concat(c.ellipsis ? ' ellipsis' : ''),
7303
+ style: _objectSpread2({
7304
+ width: c.width + 'px',
7305
+ flex: c.width ? '0 1 auto' : '1',
7306
+ overflow: 'hidden'
7307
+ }, c.fixed == 'left' ? {
7308
+ left: ((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) ? 56 : 6) + calcWidth(showColumns.slice(0, index - 2 > 0 ? index - 1 : 0))
7309
+ } : c.fixed == 'right' ? {
7310
+ right: calcWidth(showColumns.slice(index + 1))
7311
+ } : {}),
7312
+ title: record[c.dataIndex]
7313
+ }, c.ellipsis ? /*#__PURE__*/React.createElement("div", {
7314
+ style: {
7315
+ width: '100%',
7316
+ whiteSpace: 'nowrap',
7317
+ overflow: 'hidden',
7318
+ textOverflow: 'ellipsis'
7319
+ }
7320
+ }, c.render ? c.render(record[c.dataIndex], record, index) : columnsFields[c.dataIndex] ? (_columnsFields$c$data2 = columnsFields[c.dataIndex].find(function (item) {
7321
+ return item.value == record[c.dataIndex];
7322
+ })) === null || _columnsFields$c$data2 === void 0 ? void 0 : _columnsFields$c$data2.label : record[c.dataIndex]) : c.render ? c.render(record[c.dataIndex], record, index) : columnsFields[c.dataIndex] ? (_columnsFields$c$data3 = columnsFields[c.dataIndex].find(function (item) {
7323
+ return item.value == record[c.dataIndex];
7324
+ })) === null || _columnsFields$c$data3 === void 0 ? void 0 : _columnsFields$c$data3.label : record[c.dataIndex]);
7325
+ }
7326
+ }
7327
+ });
7328
+ };
7329
+
7330
+ return renderThFc(columns);
7331
+ };
7332
+
7333
+ var renderTr = function renderTr(record, index, key) {
7334
+ var _ref2, _ref3;
7335
+
7336
+ return /*#__PURE__*/React.createElement("div", _objectSpread2({
7337
+ key: key,
7338
+ className: classnames(_defineProperty({
7339
+ tr: true
7340
+ }, typeof rowClassName === 'function' ? rowClassName(record, index) : '', true))
7341
+ }, typeof onRow === 'function' ? onRow(record, index) : {}), (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'checkbox' && /*#__PURE__*/React.createElement("div", {
7342
+ style: _objectSpread2({
7343
+ width: '50px',
7344
+ flex: '0 1 auto'
7345
+ }, showColumns[0].fixed == 'left' ? {
7346
+ left: 6
7347
+ } : {}),
7348
+ className: "td ".concat(showColumns[0].fixed == 'left' ? 'fixedLeft' : '')
7349
+ }, /*#__PURE__*/React.createElement(Index$4, {
7350
+ checked: (_ref2 = [].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(selectedRowKeys))) === null || _ref2 === void 0 ? void 0 : _ref2.includes(key),
7351
+ onClick: function onClick(e) {
7352
+ return e.stopPropagation();
7353
+ },
7354
+ onChange: function onChange(event) {
7355
+ setSelectedKeys(function (keys) {
7356
+ var rows = uniqBy([].concat(_toConsumableArray(selectedRows), [record]), typeof rowKey === 'function' ? rowKey(record) : rowKey);
7357
+
7358
+ if (event.target.checked) {
7359
+ var _rowSelection$onChang, _rowSelection$onSelec3;
7360
+
7361
+ setSelectedRows(rows);
7362
+ rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onChang = rowSelection.onChange) === null || _rowSelection$onChang === void 0 ? void 0 : _rowSelection$onChang.call(rowSelection, _toConsumableArray(new Set([].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(selectedRowKeys), [key]))), rows);
7363
+ rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec3 = rowSelection.onSelect) === null || _rowSelection$onSelec3 === void 0 ? void 0 : _rowSelection$onSelec3.call(rowSelection, record, event.target.checked, rows, event.nativeEvent);
7364
+ return _toConsumableArray(new Set([].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(keys), [key])));
7365
+ } else {
7366
+ var _rowSelection$onSelec4, _rowSelection$onChang2;
7367
+
7368
+ var selectedKeys = _toConsumableArray(new Set([].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(keys))));
7369
+
7370
+ var _index = selectedKeys.indexOf(key);
7371
+
7372
+ selectedKeys.splice(_index, 1);
7373
+ rows.splice(_index, 1);
7374
+ setSelectedRows(rows);
7375
+ rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec4 = rowSelection.onSelect) === null || _rowSelection$onSelec4 === void 0 ? void 0 : _rowSelection$onSelec4.call(rowSelection, record, event.target.checked, rows, event.nativeEvent);
7376
+ rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onChang2 = rowSelection.onChange) === null || _rowSelection$onChang2 === void 0 ? void 0 : _rowSelection$onChang2.call(rowSelection, selectedKeys, rows);
7377
+ return selectedKeys;
7378
+ }
7379
+ });
7380
+ }
7381
+ })), (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'radio' && /*#__PURE__*/React.createElement("div", {
7382
+ style: _objectSpread2({
7383
+ width: '50px',
7384
+ flex: '0 1 auto'
7385
+ }, showColumns[0].fixed == 'left' ? {
7386
+ left: 6
7387
+ } : {}),
7388
+ className: "td ".concat(showColumns[0].fixed == 'left' ? 'fixedLeft' : '')
7389
+ }, /*#__PURE__*/React.createElement(Index$3, {
7390
+ checked: (_ref3 = [].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(selectedRowKeys))) === null || _ref3 === void 0 ? void 0 : _ref3.includes(key),
7391
+ onClick: function onClick(e) {
7392
+ return e.stopPropagation();
7393
+ },
7394
+ onChange: function onChange(event) {
7395
+ var _rowSelection$onSelec5, _rowSelection$onChang3;
7396
+
7397
+ setSelectedKeys([key]);
7398
+ setSelectedRows([record]);
7399
+ rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec5 = rowSelection.onSelect) === null || _rowSelection$onSelec5 === void 0 ? void 0 : _rowSelection$onSelec5.call(rowSelection, record, event.target.checked, [record], event.nativeEvent);
7400
+ rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onChang3 = rowSelection.onChange) === null || _rowSelection$onChang3 === void 0 ? void 0 : _rowSelection$onChang3.call(rowSelection, _toConsumableArray(new Set([].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), [key]))), [record]);
7401
+ }
7402
+ })), renderTd(record));
7403
+ };
7404
+
7405
+ var _useState9 = useState([]),
7406
+ _useState10 = _slicedToArray(_useState9, 2),
7407
+ dataSource = _useState10[0],
7408
+ setDataSource = _useState10[1];
7409
+
7410
+ var _useState11 = useState(0),
7411
+ _useState12 = _slicedToArray(_useState11, 2),
7412
+ total = _useState12[0],
7413
+ setTotal = _useState12[1];
7414
+
7415
+ var _useState13 = useState({}),
7416
+ _useState14 = _slicedToArray(_useState13, 2),
7417
+ pageParams = _useState14[0],
7418
+ setPageParams = _useState14[1];
7419
+
7420
+ var _useState15 = useState(false),
7421
+ _useState16 = _slicedToArray(_useState15, 2),
7422
+ loading = _useState16[0],
7423
+ setLoading = _useState16[1];
7424
+
7425
+ var _useState17 = useState({
7426
+ total: total,
7427
+ pageSize: 20,
7428
+ size: 'small',
7429
+ current: 1,
7430
+ showLessItems: true,
7431
+ showTotal: function showTotal(total) {
7432
+ return "\u5171".concat(total, "\u6761\u6570\u636E");
7433
+ },
7434
+ onChange: function onChange(current, pageSize) {
7435
+ setPageParams({
7436
+ current: current,
7437
+ pageSize: pageSize
7438
+ });
7439
+ }
7440
+ }),
7441
+ _useState18 = _slicedToArray(_useState17, 2),
7442
+ paginationParams = _useState18[0],
7443
+ setpaginationParams = _useState18[1];
7444
+
7445
+ useEffect(function () {
7446
+ _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
7447
+ var requestParams, res;
7448
+ return regeneratorRuntime.wrap(function _callee$(_context) {
7449
+ while (1) {
7450
+ switch (_context.prev = _context.next) {
7451
+ case 0:
7452
+ if (!request) {
7453
+ _context.next = 15;
7454
+ break;
7455
+ }
7456
+
7457
+ setLoading(true);
7458
+ requestParams = {};
7459
+
7460
+ if (pagination) {
7461
+ requestParams.current = pagination.current || 1;
7462
+ requestParams.pageSize = pagination.pageSize || 20;
7463
+ }
7464
+
7465
+ requestParams = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, requestParams), pageParams), params), formSearch);
7466
+ _context.next = 7;
7467
+ return request(requestParams);
7468
+
7469
+ case 7:
7470
+ res = _context.sent;
7471
+ setLoading(false);
7472
+ onLoad && onLoad(res.data);
7473
+ setDataSource(res.data);
7474
+ setTotal(res.total || 0);
7475
+ setpaginationParams(function (c) {
7476
+ return _objectSpread2(_objectSpread2(_objectSpread2({}, c), {}, {
7477
+ total: res.total || res.data.length
7478
+ }, pagination), requestParams);
7479
+ });
7480
+ _context.next = 16;
7481
+ break;
7482
+
7483
+ case 15:
7484
+ setpaginationParams(function (c) {
7485
+ var obj = _objectSpread2(_objectSpread2(_objectSpread2({}, c), {}, {
7486
+ total: tableList && tableList.length || 0
7487
+ }, pagination), pageParams);
7488
+
7489
+ var current = obj.current,
7490
+ pageSize = obj.pageSize;
7491
+ setDataSource(tableList ? tableList.slice((current - 1) * pageSize, current * pageSize) : []);
7492
+ return obj;
7493
+ });
7494
+
7495
+ case 16:
7496
+ case "end":
7497
+ return _context.stop();
7498
+ }
7499
+ }
7500
+ }, _callee);
7501
+ }))();
7502
+ }, [params, pageParams, pagination, tableList, formSearch, columns]);
7503
+
7504
+ var onFormSubmit = function onFormSubmit(values) {
7505
+ onSubmit && onSubmit(values);
7506
+ setFormSearch(values);
7507
+ };
7508
+
7509
+ var onReset = function onReset() {
7510
+ var requestParams = {};
7511
+
7512
+ if (pagination) {
7513
+ requestParams.current = pagination.current || 1;
7514
+ requestParams.pageSize = pagination.pageSize || 20;
7515
+ }
7516
+
7517
+ setPageParams(requestParams);
7518
+ setFormSearch({});
7519
+ };
7520
+
7521
+ return /*#__PURE__*/React.createElement(_Spin, {
7522
+ spinning: loading
7523
+ }, /*#__PURE__*/React.createElement("div", {
7524
+ className: "form"
7525
+ }, search !== false && /*#__PURE__*/React.createElement(WForm$1, {
7526
+ ref: formSearchRef,
7527
+ search: _objectSpread2(_objectSpread2({
7528
+ labelWidth: 'auto',
7529
+ searchText: '查询',
7530
+ span: 6
7531
+ }, search), {}, {
7532
+ optionRender: function optionRender(searchConfig, formProps, dom) {
7533
+ // return [...dom.reverse()];
7534
+ return _toConsumableArray((search === null || search === void 0 ? void 0 : search.optionDomReverse) ? dom.reverse() : dom);
7535
+ }
7536
+ }),
7537
+ onSubmit: onFormSubmit,
7538
+ onReset: onReset,
7539
+ columns: filterFormColumns
7540
+ })), /*#__PURE__*/React.createElement("div", {
7541
+ className: classnames((_classnames2 = {
7542
+ container: true
7543
+ }, _defineProperty(_classnames2, 'w-table', true), _defineProperty(_classnames2, 'w-frame-box-table', frameBoxTable), _defineProperty(_classnames2, className || 'defalut-table', true), _classnames2))
7544
+ }, /*#__PURE__*/React.createElement("div", {
7545
+ className: "theader"
7546
+ }, /*#__PURE__*/React.createElement("div", {
7547
+ className: "th",
7548
+ style: _objectSpread2(_objectSpread2({}, thStyle), {}, {
7549
+ height: layerIndex * 32 + 'px'
7550
+ }, (scroll === null || scroll === void 0 ? void 0 : scroll.x) ? {
7551
+ width: scroll.x
7552
+ } : {})
7553
+ }, (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'checkbox' && /*#__PURE__*/React.createElement("div", {
7554
+ style: _objectSpread2({
7555
+ width: '50px',
7556
+ flex: '0 1 auto',
7557
+ height: '100%'
7558
+ }, showColumns[0].fixed == 'left' ? {
7559
+ left: 6
7560
+ } : {}),
7561
+ className: "td ".concat(((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.fixed) == 'left' ? 'fixedLeft' : '')
7562
+ }, /*#__PURE__*/React.createElement(Index$4, {
7563
+ checked: dataSource.every(function (record) {
7564
+ return selectedRowKeys.includes(typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey]);
7565
+ }),
7566
+ indeterminate: !dataSource.every(function (record) {
7567
+ return selectedRowKeys.includes(typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey]);
7568
+ }) && dataSource.some(function (record) {
7569
+ return selectedRowKeys.includes(typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey]);
7570
+ }),
7571
+ onChange: onSelectAllChange
7572
+ })), (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'radio' && /*#__PURE__*/React.createElement("div", {
7573
+ style: _objectSpread2({
7574
+ width: '50px',
7575
+ flex: '0 1 auto',
7576
+ height: '100%'
7577
+ }, showColumns[0].fixed == 'left' ? {
7578
+ left: 6
7579
+ } : {}),
7580
+ className: "td ".concat(((_columns$2 = columns[0]) === null || _columns$2 === void 0 ? void 0 : _columns$2.fixed) == 'left' ? 'fixedLeft' : '')
7581
+ }), renderTh)), /*#__PURE__*/React.createElement("div", {
7582
+ className: "tbodyContainer",
7583
+ style: _objectSpread2(_objectSpread2(_objectSpread2({}, (scroll === null || scroll === void 0 ? void 0 : scroll.x) ? {
7584
+ width: scroll.x
7585
+ } : {}), (scroll === null || scroll === void 0 ? void 0 : scroll.y) ? {
7586
+ height: scroll.y
7587
+ } : {}), {}, {
7588
+ overflow: 'auto'
7589
+ }, style)
7590
+ }, /*#__PURE__*/React.createElement("div", {
7591
+ className: "tbody",
7592
+ style: _objectSpread2({
7593
+ height: (style === null || style === void 0 ? void 0 : style.height) || (scroll === null || scroll === void 0 ? void 0 : scroll.y) ? "calc(".concat(style === null || style === void 0 ? void 0 : style.height, " - ").concat(52 + (pagination === false ? 0 : 42), "px)") : '200px'
7594
+ }, tbodyStyle)
7595
+ }, dataSource.length > 0 ? dataSource.map(function (record, index) {
7596
+ var key = typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey];
7597
+ return frameBoxTable ? /*#__PURE__*/React.createElement(FrameBox$1, {
7598
+ key: key,
7599
+ direction: frameBoxDirection,
7600
+ style: {
7601
+ width: '100%'
7602
+ }
7603
+ }, renderTr(record, index, key)) : renderTr(record, index, key);
7604
+ }) : /*#__PURE__*/React.createElement("div", {
7605
+ style: {
7606
+ width: '100%',
7607
+ height: '100%',
7608
+ display: 'flex',
7609
+ justifyContent: 'center',
7610
+ alignItems: 'center'
7611
+ }
7612
+ }, none || '暂无数据')))), _typeof(pagination) === 'object' && /*#__PURE__*/React.createElement(_Pagination, _objectSpread2({
7613
+ style: {
7614
+ textAlign: 'right',
7615
+ marginTop: '10px'
7616
+ }
7617
+ }, paginationParams)));
7618
+ }
7619
+ NtTable.defaultProps = {
7620
+ rowKey: 'key'
7621
+ };
7622
+
6822
7623
  /*
6823
7624
  * @Author: lijin
6824
7625
  * @Date: 2021-08-04 13:22:21
@@ -7601,10 +8402,10 @@ function WaterLevelCharts(config) {
7601
8402
  /*
7602
8403
  * @Author: lijin
7603
8404
  * @Date: 2021-09-09 11:02:54
7604
- * @LastEditTime: 2022-10-26 15:21:50
8405
+ * @LastEditTime: 2022-11-09 19:44:46
7605
8406
  * @LastEditors: lijin
7606
8407
  * @Description:
7607
- * @FilePath: \wargerm\src\index.ts
8408
+ * @FilePath: \wargem\wargerm-components\src\index.ts
7608
8409
  * 可以输入预定的版权声明、个性签名、空行等
7609
8410
  */
7610
8411
  console.log(REACT_APP_ENV, 'REACT_APP_ENV');
@@ -7614,4 +8415,4 @@ if (REACT_APP_ENV == 'development') {
7614
8415
  document.documentElement.setAttribute(COLOR_ATTR_NAME, 'nt');
7615
8416
  }
7616
8417
 
7617
- export { Index$a as AutoScroll, Index$c as Breadcrumb, WButton as Button, index$4 as Calendar, index$2 as Card, WCascader as Cascader, Index$4 as Checkbox, Index$9 as CountUp, Index$2 as DatePicker, DragBox, index as IconFont, Index as Input, WInputNumber as InputNumber, LineEcharts, Modal, ModalForm$1 as ModalForm, Modal$1 as ModalTips, Index$8 as Number, NumericInput, Index$3 as Radio, Select, Index$b as Swiper, WSwitch as Switch, index$3 as TabelCard, index$1 as Table, Index$7 as TreeSelect, Upload, index$6 as Video, index$5 as VideoPlayer, Index$6 as WDatePicker, WForm$1 as WForm, WaterLevelCharts, WebsocketHeart, useEventEmitter };
8418
+ export { Index$a as AutoScroll, Index$c as Breadcrumb, WButton as Button, index$4 as Calendar, index$2 as Card, WCascader as Cascader, Index$4 as Checkbox, Index$9 as CountUp, Index$2 as DatePicker, DragBox, index as IconFont, Index as Input, WInputNumber as InputNumber, LineEcharts, Modal, ModalForm$1 as ModalForm, Modal$1 as ModalTips, NtTable, Index$8 as Number, NumericInput, Index$3 as Radio, Select, Index$b as Swiper, WSwitch as Switch, index$3 as TabelCard, index$1 as Table, Index$7 as TreeSelect, Upload, index$6 as Video, index$5 as VideoPlayer, Index$6 as WDatePicker, WForm$1 as WForm, WaterLevelCharts, WebsocketHeart, useEventEmitter, create as whox, wmox };