wargerm 0.2.22 → 0.2.23
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/Cascader/index.d.ts +8 -0
- package/dist/components/Swiper/index.d.ts +4 -1
- package/dist/components/WForm/index.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +993 -100
- package/dist/index.js +993 -98
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -40,6 +40,8 @@ var _Checkbox = require('antd/es/checkbox');
|
|
40
40
|
require('antd/es/tree-select/style');
|
41
41
|
var _TreeSelect = require('antd/es/tree-select');
|
42
42
|
var uniqBy = require('lodash/uniqBy');
|
43
|
+
require('antd/es/cascader/style');
|
44
|
+
var _Cascader = require('antd/es/cascader');
|
43
45
|
var CountUp = require('react-countup');
|
44
46
|
var react = require('swiper/react');
|
45
47
|
var SwiperCore = require('swiper');
|
@@ -48,6 +50,9 @@ var _Breadcrumb = require('antd/es/breadcrumb');
|
|
48
50
|
var ReactDOM = require('react-dom');
|
49
51
|
require('antd/es/modal/style');
|
50
52
|
var _Modal = require('antd/es/modal');
|
53
|
+
require('antd/es/config-provider/style');
|
54
|
+
require('antd/es/config-provider');
|
55
|
+
require('antd/es/locale/zh_CN');
|
51
56
|
var ProTable = require('@ant-design/pro-table');
|
52
57
|
|
53
58
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
@@ -72,6 +77,7 @@ var _Radio__default = /*#__PURE__*/_interopDefaultLegacy(_Radio);
|
|
72
77
|
var _Checkbox__default = /*#__PURE__*/_interopDefaultLegacy(_Checkbox);
|
73
78
|
var _TreeSelect__default = /*#__PURE__*/_interopDefaultLegacy(_TreeSelect);
|
74
79
|
var uniqBy__default = /*#__PURE__*/_interopDefaultLegacy(uniqBy);
|
80
|
+
var _Cascader__default = /*#__PURE__*/_interopDefaultLegacy(_Cascader);
|
75
81
|
var CountUp__default = /*#__PURE__*/_interopDefaultLegacy(CountUp);
|
76
82
|
var SwiperCore__default = /*#__PURE__*/_interopDefaultLegacy(SwiperCore);
|
77
83
|
var _Breadcrumb__default = /*#__PURE__*/_interopDefaultLegacy(_Breadcrumb);
|
@@ -7628,7 +7634,60 @@ RangePicker$2.defaultProps = {};
|
|
7628
7634
|
var Index$6 = WDatePicker$1;
|
7629
7635
|
Index$6.RangePicker = RangePicker$2;
|
7630
7636
|
|
7631
|
-
var _excluded$6 = ["
|
7637
|
+
var _excluded$6 = ["request", "options", "onLoad", "value", "onChange"];
|
7638
|
+
|
7639
|
+
var WCascader = function WCascader(props) {
|
7640
|
+
var request = props.request,
|
7641
|
+
options = props.options,
|
7642
|
+
onLoad = props.onLoad,
|
7643
|
+
value = props.value,
|
7644
|
+
_onChange = props.onChange,
|
7645
|
+
extraProps = _objectWithoutProperties(props, _excluded$6);
|
7646
|
+
|
7647
|
+
var _useState = React.useState(null),
|
7648
|
+
_useState2 = _slicedToArray(_useState, 2),
|
7649
|
+
resList = _useState2[0],
|
7650
|
+
setResList = _useState2[1];
|
7651
|
+
|
7652
|
+
React.useEffect(function () {
|
7653
|
+
_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
7654
|
+
var res;
|
7655
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
7656
|
+
while (1) {
|
7657
|
+
switch (_context.prev = _context.next) {
|
7658
|
+
case 0:
|
7659
|
+
if (!request) {
|
7660
|
+
_context.next = 6;
|
7661
|
+
break;
|
7662
|
+
}
|
7663
|
+
|
7664
|
+
_context.next = 3;
|
7665
|
+
return request();
|
7666
|
+
|
7667
|
+
case 3:
|
7668
|
+
res = _context.sent;
|
7669
|
+
setResList(res);
|
7670
|
+
onLoad && onLoad(res);
|
7671
|
+
|
7672
|
+
case 6:
|
7673
|
+
case "end":
|
7674
|
+
return _context.stop();
|
7675
|
+
}
|
7676
|
+
}
|
7677
|
+
}, _callee);
|
7678
|
+
}))();
|
7679
|
+
}, [JSON.stringify(resList)]);
|
7680
|
+
return /*#__PURE__*/React__default['default'].createElement(_Cascader__default['default'], _objectSpread2({
|
7681
|
+
value: typeof value === 'string' ? [value] : value,
|
7682
|
+
onChange: function onChange(v, options) {
|
7683
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(v, options);
|
7684
|
+
},
|
7685
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
7686
|
+
options: request ? resList : options
|
7687
|
+
}, extraProps));
|
7688
|
+
};
|
7689
|
+
|
7690
|
+
var _excluded$7 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "onFormChange", "onSubmit", "onReset"];
|
7632
7691
|
var RangePicker$3 = Index$6.RangePicker;
|
7633
7692
|
|
7634
7693
|
var WForm = function WForm(props, ref) {
|
@@ -7642,7 +7701,7 @@ var WForm = function WForm(props, ref) {
|
|
7642
7701
|
onFormChange = props.onFormChange,
|
7643
7702
|
onSubmit = props.onSubmit,
|
7644
7703
|
onReset = props.onReset,
|
7645
|
-
extraProps = _objectWithoutProperties(props, _excluded$
|
7704
|
+
extraProps = _objectWithoutProperties(props, _excluded$7);
|
7646
7705
|
|
7647
7706
|
var _Form$useForm = _Form__default['default'].useForm(),
|
7648
7707
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
@@ -7728,7 +7787,7 @@ var WForm = function WForm(props, ref) {
|
|
7728
7787
|
});
|
7729
7788
|
}
|
7730
7789
|
}, c.fieldProps), _extraProps))));
|
7731
|
-
} else if (c.valueType == '
|
7790
|
+
} else if (c.valueType == 'cascader') {
|
7732
7791
|
var _extraProps2 = {};
|
7733
7792
|
|
7734
7793
|
if (c.request) {
|
@@ -7756,16 +7815,53 @@ var WForm = function WForm(props, ref) {
|
|
7756
7815
|
name: c.dataIndex,
|
7757
7816
|
label: c.title,
|
7758
7817
|
labelCol: _labelCol
|
7818
|
+
}), /*#__PURE__*/React__default['default'].createElement(WCascader, _objectSpread2(_objectSpread2({
|
7819
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
7820
|
+
disabled: disabled,
|
7821
|
+
onLoad: function onLoad(opt) {
|
7822
|
+
setColumnsFields(function (preColumnsFields) {
|
7823
|
+
return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, opt));
|
7824
|
+
});
|
7825
|
+
}
|
7826
|
+
}, c.fieldProps), _extraProps2))));
|
7827
|
+
} else if (c.valueType == 'treeSelect') {
|
7828
|
+
var _extraProps3 = {};
|
7829
|
+
|
7830
|
+
if (c.request) {
|
7831
|
+
_extraProps3.request = c.request;
|
7832
|
+
}
|
7833
|
+
|
7834
|
+
var _labelCol2 = {};
|
7835
|
+
|
7836
|
+
if (search && search.labelWidth) {
|
7837
|
+
_labelCol2.style = {
|
7838
|
+
width: search.labelWidth
|
7839
|
+
};
|
7840
|
+
}
|
7841
|
+
|
7842
|
+
return /*#__PURE__*/React__default['default'].createElement(_Col__default['default'], _objectSpread2(_objectSpread2({
|
7843
|
+
style: {
|
7844
|
+
paddingLeft: '12px',
|
7845
|
+
paddingRight: '12px'
|
7846
|
+
}
|
7847
|
+
}, colProps), {}, {
|
7848
|
+
key: c.dataIndex
|
7849
|
+
}), /*#__PURE__*/React__default['default'].createElement(_Form__default['default'].Item, _objectSpread2(_objectSpread2({
|
7850
|
+
initialValue: c.initialValue
|
7851
|
+
}, c.formItemProps), {}, {
|
7852
|
+
name: c.dataIndex,
|
7853
|
+
label: c.title,
|
7854
|
+
labelCol: _labelCol2
|
7759
7855
|
}), /*#__PURE__*/React__default['default'].createElement(Index$5, _objectSpread2(_objectSpread2({
|
7760
7856
|
disabled: disabled,
|
7761
7857
|
placeholder: "\u8BF7\u9009\u62E9",
|
7762
7858
|
onLoad: function onLoad(opt) {}
|
7763
|
-
}, c.fieldProps),
|
7859
|
+
}, c.fieldProps), _extraProps3))));
|
7764
7860
|
} else if (c.valueType && ['date', 'dateTime', 'dateMonth', 'dateYear'].includes(c.valueType)) {
|
7765
|
-
var
|
7861
|
+
var _labelCol3 = {};
|
7766
7862
|
|
7767
7863
|
if (search && search.labelWidth) {
|
7768
|
-
|
7864
|
+
_labelCol3.style = {
|
7769
7865
|
width: search.labelWidth
|
7770
7866
|
};
|
7771
7867
|
}
|
@@ -7805,16 +7901,16 @@ var WForm = function WForm(props, ref) {
|
|
7805
7901
|
}, c.formItemProps), {}, {
|
7806
7902
|
name: c.dataIndex,
|
7807
7903
|
label: c.title,
|
7808
|
-
labelCol:
|
7904
|
+
labelCol: _labelCol3
|
7809
7905
|
}), /*#__PURE__*/React__default['default'].createElement(Index$6, _objectSpread2(_objectSpread2(_objectSpread2({
|
7810
7906
|
disabled: disabled,
|
7811
7907
|
placeholder: "\u8BF7\u8F93\u5165"
|
7812
7908
|
}, picker), showTime), c.fieldProps))));
|
7813
7909
|
} else if (c.valueType === 'dateRange' || c.valueType === 'dateTimeRange') {
|
7814
|
-
var
|
7910
|
+
var _labelCol4 = {};
|
7815
7911
|
|
7816
7912
|
if (search && search.labelWidth) {
|
7817
|
-
|
7913
|
+
_labelCol4.style = {
|
7818
7914
|
width: search.labelWidth
|
7819
7915
|
};
|
7820
7916
|
}
|
@@ -7841,7 +7937,7 @@ var WForm = function WForm(props, ref) {
|
|
7841
7937
|
}, c.formItemProps), {}, {
|
7842
7938
|
name: c.dataIndex,
|
7843
7939
|
label: c.title,
|
7844
|
-
labelCol:
|
7940
|
+
labelCol: _labelCol4
|
7845
7941
|
}), /*#__PURE__*/React__default['default'].createElement(RangePicker$3, _objectSpread2(_objectSpread2({
|
7846
7942
|
disabled: disabled
|
7847
7943
|
}, _showTime), c.fieldProps))));
|
@@ -7868,10 +7964,10 @@ var WForm = function WForm(props, ref) {
|
|
7868
7964
|
setColumnsFields(function (preColumnsFields) {
|
7869
7965
|
return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, options));
|
7870
7966
|
});
|
7871
|
-
var
|
7967
|
+
var _labelCol5 = {};
|
7872
7968
|
|
7873
7969
|
if (search && search.labelWidth) {
|
7874
|
-
|
7970
|
+
_labelCol5.style = {
|
7875
7971
|
width: search.labelWidth
|
7876
7972
|
};
|
7877
7973
|
}
|
@@ -7888,7 +7984,7 @@ var WForm = function WForm(props, ref) {
|
|
7888
7984
|
}, c.formItemProps), {}, {
|
7889
7985
|
name: c.dataIndex,
|
7890
7986
|
label: c.title,
|
7891
|
-
labelCol:
|
7987
|
+
labelCol: _labelCol5
|
7892
7988
|
}), /*#__PURE__*/React__default['default'].createElement(Index$4.Group, _objectSpread2({
|
7893
7989
|
disabled: disabled,
|
7894
7990
|
options: options
|
@@ -7917,10 +8013,10 @@ var WForm = function WForm(props, ref) {
|
|
7917
8013
|
setColumnsFields(function (preColumnsFields) {
|
7918
8014
|
return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, _options));
|
7919
8015
|
});
|
7920
|
-
var
|
8016
|
+
var _labelCol6 = {};
|
7921
8017
|
|
7922
8018
|
if (search && search.labelWidth) {
|
7923
|
-
|
8019
|
+
_labelCol6.style = {
|
7924
8020
|
width: search.labelWidth
|
7925
8021
|
};
|
7926
8022
|
}
|
@@ -7946,7 +8042,7 @@ var WForm = function WForm(props, ref) {
|
|
7946
8042
|
}, c.formItemProps), {}, {
|
7947
8043
|
name: c.dataIndex,
|
7948
8044
|
label: c.title,
|
7949
|
-
labelCol:
|
8045
|
+
labelCol: _labelCol6
|
7950
8046
|
}), /*#__PURE__*/React__default['default'].createElement(Index$3.Group, _objectSpread2(_objectSpread2({
|
7951
8047
|
disabled: disabled
|
7952
8048
|
}, radioButtonProps), {}, {
|
@@ -7966,10 +8062,10 @@ var WForm = function WForm(props, ref) {
|
|
7966
8062
|
}
|
7967
8063
|
}
|
7968
8064
|
|
7969
|
-
var
|
8065
|
+
var _labelCol7 = {};
|
7970
8066
|
|
7971
8067
|
if (search && search.labelWidth) {
|
7972
|
-
|
8068
|
+
_labelCol7.style = {
|
7973
8069
|
width: search.labelWidth
|
7974
8070
|
};
|
7975
8071
|
} // if (columnsFieldsRef.current) {
|
@@ -7993,15 +8089,15 @@ var WForm = function WForm(props, ref) {
|
|
7993
8089
|
}, c.formItemProps), {}, {
|
7994
8090
|
name: c.dataIndex,
|
7995
8091
|
label: c.title,
|
7996
|
-
labelCol:
|
8092
|
+
labelCol: _labelCol7
|
7997
8093
|
}), /*#__PURE__*/React__default['default'].createElement(WSwitch, _objectSpread2({
|
7998
8094
|
disabled: disabled
|
7999
8095
|
}, c.fieldProps))));
|
8000
8096
|
} else if (c.valueType === 'digit') {
|
8001
|
-
var
|
8097
|
+
var _labelCol8 = {};
|
8002
8098
|
|
8003
8099
|
if (search && search.labelWidth) {
|
8004
|
-
|
8100
|
+
_labelCol8.style = {
|
8005
8101
|
width: search.labelWidth
|
8006
8102
|
};
|
8007
8103
|
}
|
@@ -8018,16 +8114,16 @@ var WForm = function WForm(props, ref) {
|
|
8018
8114
|
}, c.formItemProps), {}, {
|
8019
8115
|
name: c.dataIndex,
|
8020
8116
|
label: c.title,
|
8021
|
-
labelCol:
|
8117
|
+
labelCol: _labelCol8
|
8022
8118
|
}), /*#__PURE__*/React__default['default'].createElement(NumericInput, _objectSpread2({
|
8023
8119
|
disabled: disabled,
|
8024
8120
|
placeholder: "\u8BF7\u8F93\u5165\u53C2\u6570(double/int)"
|
8025
8121
|
}, c.fieldProps))));
|
8026
8122
|
} else if (c.renderFormItem) {
|
8027
|
-
var
|
8123
|
+
var _labelCol9 = {};
|
8028
8124
|
|
8029
8125
|
if (search && search.labelWidth) {
|
8030
|
-
|
8126
|
+
_labelCol9.style = {
|
8031
8127
|
width: search.labelWidth
|
8032
8128
|
};
|
8033
8129
|
}
|
@@ -8050,13 +8146,13 @@ var WForm = function WForm(props, ref) {
|
|
8050
8146
|
}, c.formItemProps), {}, {
|
8051
8147
|
name: c.dataIndex,
|
8052
8148
|
label: c.title,
|
8053
|
-
labelCol:
|
8149
|
+
labelCol: _labelCol9
|
8054
8150
|
}), baseitem)) : null;
|
8055
8151
|
} else if (c.valueType === 'textarea') {
|
8056
|
-
var
|
8152
|
+
var _labelCol10 = {};
|
8057
8153
|
|
8058
8154
|
if (search && search.labelWidth) {
|
8059
|
-
|
8155
|
+
_labelCol10.style = {
|
8060
8156
|
width: search.labelWidth
|
8061
8157
|
};
|
8062
8158
|
}
|
@@ -8073,17 +8169,17 @@ var WForm = function WForm(props, ref) {
|
|
8073
8169
|
}, c.formItemProps), {}, {
|
8074
8170
|
name: c.dataIndex,
|
8075
8171
|
label: c.title,
|
8076
|
-
labelCol:
|
8172
|
+
labelCol: _labelCol10
|
8077
8173
|
}), /*#__PURE__*/React__default['default'].createElement(Index.TextArea, _objectSpread2({
|
8078
8174
|
rows: 4,
|
8079
8175
|
disabled: disabled,
|
8080
8176
|
placeholder: "\u8BF7\u8F93\u5165"
|
8081
8177
|
}, c.fieldProps))));
|
8082
8178
|
} else if (c.valueType === 'inputNumber') {
|
8083
|
-
var
|
8179
|
+
var _labelCol11 = {};
|
8084
8180
|
|
8085
8181
|
if (search && search.labelWidth) {
|
8086
|
-
|
8182
|
+
_labelCol11.style = {
|
8087
8183
|
width: search.labelWidth
|
8088
8184
|
};
|
8089
8185
|
}
|
@@ -8100,16 +8196,16 @@ var WForm = function WForm(props, ref) {
|
|
8100
8196
|
}, c.formItemProps), {}, {
|
8101
8197
|
name: c.dataIndex,
|
8102
8198
|
label: c.title,
|
8103
|
-
labelCol:
|
8199
|
+
labelCol: _labelCol11
|
8104
8200
|
}), /*#__PURE__*/React__default['default'].createElement(WInputNumber, _objectSpread2({
|
8105
8201
|
disabled: disabled,
|
8106
8202
|
placeholder: "\u8BF7\u8F93\u5165"
|
8107
8203
|
}, c.fieldProps))));
|
8108
8204
|
} else {
|
8109
|
-
var
|
8205
|
+
var _labelCol12 = {};
|
8110
8206
|
|
8111
8207
|
if (search && search.labelWidth) {
|
8112
|
-
|
8208
|
+
_labelCol12.style = {
|
8113
8209
|
width: search.labelWidth
|
8114
8210
|
};
|
8115
8211
|
}
|
@@ -8126,7 +8222,7 @@ var WForm = function WForm(props, ref) {
|
|
8126
8222
|
}, c.formItemProps), {}, {
|
8127
8223
|
name: c.dataIndex,
|
8128
8224
|
label: c.title,
|
8129
|
-
labelCol:
|
8225
|
+
labelCol: _labelCol12
|
8130
8226
|
}), /*#__PURE__*/React__default['default'].createElement(Index, _objectSpread2({
|
8131
8227
|
disabled: disabled,
|
8132
8228
|
placeholder: "\u8BF7\u8F93\u5165"
|
@@ -8150,12 +8246,12 @@ var WForm = function WForm(props, ref) {
|
|
8150
8246
|
}
|
8151
8247
|
|
8152
8248
|
if (c.valueType == 'select') {
|
8153
|
-
var
|
8249
|
+
var _extraProps4 = {};
|
8154
8250
|
|
8155
8251
|
if (c.request) {
|
8156
|
-
|
8252
|
+
_extraProps4.request = c.request;
|
8157
8253
|
} else if (c.valueEnum) {
|
8158
|
-
|
8254
|
+
_extraProps4.valueEnum = c.valueEnum;
|
8159
8255
|
}
|
8160
8256
|
|
8161
8257
|
var labelCol = {};
|
@@ -8190,18 +8286,55 @@ var WForm = function WForm(props, ref) {
|
|
8190
8286
|
return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, opt));
|
8191
8287
|
});
|
8192
8288
|
}
|
8193
|
-
}, c.fieldProps),
|
8289
|
+
}, c.fieldProps), _extraProps4))));
|
8290
|
+
} else if (c.valueType == 'cascader') {
|
8291
|
+
var _extraProps5 = {};
|
8292
|
+
|
8293
|
+
if (c.request) {
|
8294
|
+
_extraProps5.request = c.request;
|
8295
|
+
}
|
8296
|
+
|
8297
|
+
var _labelCol13 = {};
|
8298
|
+
|
8299
|
+
if (search && search.labelWidth) {
|
8300
|
+
_labelCol13.style = {
|
8301
|
+
width: search.labelWidth
|
8302
|
+
};
|
8303
|
+
}
|
8304
|
+
|
8305
|
+
return /*#__PURE__*/React__default['default'].createElement(_Col__default['default'], _objectSpread2(_objectSpread2({
|
8306
|
+
style: {
|
8307
|
+
paddingLeft: '12px',
|
8308
|
+
paddingRight: '12px'
|
8309
|
+
}
|
8310
|
+
}, colProps), {}, {
|
8311
|
+
key: c.dataIndex
|
8312
|
+
}), /*#__PURE__*/React__default['default'].createElement(_Form__default['default'].Item, _objectSpread2(_objectSpread2({
|
8313
|
+
initialValue: c.initialValue
|
8314
|
+
}, c.formItemProps), {}, {
|
8315
|
+
name: c.dataIndex,
|
8316
|
+
label: c.title,
|
8317
|
+
labelCol: _labelCol13
|
8318
|
+
}), /*#__PURE__*/React__default['default'].createElement(WCascader, _objectSpread2(_objectSpread2({
|
8319
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
8320
|
+
disabled: disabled,
|
8321
|
+
onLoad: function onLoad(opt) {
|
8322
|
+
setColumnsFields(function (preColumnsFields) {
|
8323
|
+
return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, opt));
|
8324
|
+
});
|
8325
|
+
}
|
8326
|
+
}, c.fieldProps), _extraProps5))));
|
8194
8327
|
} else if (c.valueType == 'treeSelect') {
|
8195
|
-
var
|
8328
|
+
var _extraProps6 = {};
|
8196
8329
|
|
8197
8330
|
if (c.request) {
|
8198
|
-
|
8331
|
+
_extraProps6.request = c.request;
|
8199
8332
|
}
|
8200
8333
|
|
8201
|
-
var
|
8334
|
+
var _labelCol14 = {};
|
8202
8335
|
|
8203
8336
|
if (search && search.labelWidth) {
|
8204
|
-
|
8337
|
+
_labelCol14.style = {
|
8205
8338
|
width: search.labelWidth
|
8206
8339
|
};
|
8207
8340
|
}
|
@@ -8218,17 +8351,17 @@ var WForm = function WForm(props, ref) {
|
|
8218
8351
|
}, c.formItemProps), {}, {
|
8219
8352
|
name: c.dataIndex,
|
8220
8353
|
label: c.title,
|
8221
|
-
labelCol:
|
8354
|
+
labelCol: _labelCol14
|
8222
8355
|
}), /*#__PURE__*/React__default['default'].createElement(Index$5, _objectSpread2(_objectSpread2({
|
8223
8356
|
disabled: disabled,
|
8224
8357
|
placeholder: "\u8BF7\u9009\u62E9",
|
8225
8358
|
onLoad: function onLoad(opt) {}
|
8226
|
-
}, c.fieldProps),
|
8359
|
+
}, c.fieldProps), _extraProps6))));
|
8227
8360
|
} else if (c.valueType && ['date', 'dateTime', 'dateMonth', 'dateYear'].includes(c.valueType)) {
|
8228
|
-
var
|
8361
|
+
var _labelCol15 = {};
|
8229
8362
|
|
8230
8363
|
if (search && search.labelWidth) {
|
8231
|
-
|
8364
|
+
_labelCol15.style = {
|
8232
8365
|
width: search.labelWidth
|
8233
8366
|
};
|
8234
8367
|
}
|
@@ -8268,16 +8401,16 @@ var WForm = function WForm(props, ref) {
|
|
8268
8401
|
}, c.formItemProps), {}, {
|
8269
8402
|
name: c.dataIndex,
|
8270
8403
|
label: c.title,
|
8271
|
-
labelCol:
|
8404
|
+
labelCol: _labelCol15
|
8272
8405
|
}), /*#__PURE__*/React__default['default'].createElement(Index$6, _objectSpread2(_objectSpread2(_objectSpread2({
|
8273
8406
|
disabled: disabled,
|
8274
8407
|
placeholder: "\u8BF7\u8F93\u5165"
|
8275
8408
|
}, picker), showTime), c.fieldProps))));
|
8276
8409
|
} else if (c.valueType === 'dateRange' || c.valueType === 'dateTimeRange') {
|
8277
|
-
var
|
8410
|
+
var _labelCol16 = {};
|
8278
8411
|
|
8279
8412
|
if (search && search.labelWidth) {
|
8280
|
-
|
8413
|
+
_labelCol16.style = {
|
8281
8414
|
width: search.labelWidth
|
8282
8415
|
};
|
8283
8416
|
}
|
@@ -8304,7 +8437,7 @@ var WForm = function WForm(props, ref) {
|
|
8304
8437
|
}, c.formItemProps), {}, {
|
8305
8438
|
name: c.dataIndex,
|
8306
8439
|
label: c.title,
|
8307
|
-
labelCol:
|
8440
|
+
labelCol: _labelCol16
|
8308
8441
|
}), /*#__PURE__*/React__default['default'].createElement(RangePicker$3, _objectSpread2(_objectSpread2({
|
8309
8442
|
disabled: disabled
|
8310
8443
|
}, _showTime2), c.fieldProps))));
|
@@ -8331,10 +8464,10 @@ var WForm = function WForm(props, ref) {
|
|
8331
8464
|
setColumnsFields(function (preColumnsFields) {
|
8332
8465
|
return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, options));
|
8333
8466
|
});
|
8334
|
-
var
|
8467
|
+
var _labelCol17 = {};
|
8335
8468
|
|
8336
8469
|
if (search && search.labelWidth) {
|
8337
|
-
|
8470
|
+
_labelCol17.style = {
|
8338
8471
|
width: search.labelWidth
|
8339
8472
|
};
|
8340
8473
|
}
|
@@ -8351,7 +8484,7 @@ var WForm = function WForm(props, ref) {
|
|
8351
8484
|
}, c.formItemProps), {}, {
|
8352
8485
|
name: c.dataIndex,
|
8353
8486
|
label: c.title,
|
8354
|
-
labelCol:
|
8487
|
+
labelCol: _labelCol17
|
8355
8488
|
}), /*#__PURE__*/React__default['default'].createElement(Index$4.Group, _objectSpread2({
|
8356
8489
|
disabled: disabled,
|
8357
8490
|
options: options
|
@@ -8380,10 +8513,10 @@ var WForm = function WForm(props, ref) {
|
|
8380
8513
|
setColumnsFields(function (preColumnsFields) {
|
8381
8514
|
return _objectSpread2(_objectSpread2({}, preColumnsFields), {}, _defineProperty({}, c.dataIndex, _options3));
|
8382
8515
|
});
|
8383
|
-
var
|
8516
|
+
var _labelCol18 = {};
|
8384
8517
|
|
8385
8518
|
if (search && search.labelWidth) {
|
8386
|
-
|
8519
|
+
_labelCol18.style = {
|
8387
8520
|
width: search.labelWidth
|
8388
8521
|
};
|
8389
8522
|
}
|
@@ -8409,7 +8542,7 @@ var WForm = function WForm(props, ref) {
|
|
8409
8542
|
}, c.formItemProps), {}, {
|
8410
8543
|
name: c.dataIndex,
|
8411
8544
|
label: c.title,
|
8412
|
-
labelCol:
|
8545
|
+
labelCol: _labelCol18
|
8413
8546
|
}), /*#__PURE__*/React__default['default'].createElement(Index$3.Group, _objectSpread2(_objectSpread2({
|
8414
8547
|
disabled: disabled
|
8415
8548
|
}, radioButtonProps), {}, {
|
@@ -8429,10 +8562,10 @@ var WForm = function WForm(props, ref) {
|
|
8429
8562
|
}
|
8430
8563
|
}
|
8431
8564
|
|
8432
|
-
var
|
8565
|
+
var _labelCol19 = {};
|
8433
8566
|
|
8434
8567
|
if (search && search.labelWidth) {
|
8435
|
-
|
8568
|
+
_labelCol19.style = {
|
8436
8569
|
width: search.labelWidth
|
8437
8570
|
};
|
8438
8571
|
} // if (columnsFieldsRef.current) {
|
@@ -8456,15 +8589,15 @@ var WForm = function WForm(props, ref) {
|
|
8456
8589
|
}, c.formItemProps), {}, {
|
8457
8590
|
name: c.dataIndex,
|
8458
8591
|
label: c.title,
|
8459
|
-
labelCol:
|
8592
|
+
labelCol: _labelCol19
|
8460
8593
|
}), /*#__PURE__*/React__default['default'].createElement(WSwitch, _objectSpread2({
|
8461
8594
|
disabled: disabled
|
8462
8595
|
}, c.fieldProps))));
|
8463
8596
|
} else if (c.valueType === 'digit') {
|
8464
|
-
var
|
8597
|
+
var _labelCol20 = {};
|
8465
8598
|
|
8466
8599
|
if (search && search.labelWidth) {
|
8467
|
-
|
8600
|
+
_labelCol20.style = {
|
8468
8601
|
width: search.labelWidth
|
8469
8602
|
};
|
8470
8603
|
}
|
@@ -8481,16 +8614,16 @@ var WForm = function WForm(props, ref) {
|
|
8481
8614
|
}, c.formItemProps), {}, {
|
8482
8615
|
name: c.dataIndex,
|
8483
8616
|
label: c.title,
|
8484
|
-
labelCol:
|
8617
|
+
labelCol: _labelCol20
|
8485
8618
|
}), /*#__PURE__*/React__default['default'].createElement(NumericInput, _objectSpread2({
|
8486
8619
|
disabled: disabled,
|
8487
8620
|
placeholder: "\u8BF7\u8F93\u5165\u53C2\u6570(double/int)"
|
8488
8621
|
}, c.fieldProps))));
|
8489
8622
|
} else if (c.renderFormItem) {
|
8490
|
-
var
|
8623
|
+
var _labelCol21 = {};
|
8491
8624
|
|
8492
8625
|
if (search && search.labelWidth) {
|
8493
|
-
|
8626
|
+
_labelCol21.style = {
|
8494
8627
|
width: search.labelWidth
|
8495
8628
|
};
|
8496
8629
|
}
|
@@ -8513,13 +8646,13 @@ var WForm = function WForm(props, ref) {
|
|
8513
8646
|
}, c.formItemProps), {}, {
|
8514
8647
|
name: c.dataIndex,
|
8515
8648
|
label: c.title,
|
8516
|
-
labelCol:
|
8649
|
+
labelCol: _labelCol21
|
8517
8650
|
}), baseitem)) : null;
|
8518
8651
|
} else if (c.valueType === 'textarea') {
|
8519
|
-
var
|
8652
|
+
var _labelCol22 = {};
|
8520
8653
|
|
8521
8654
|
if (search && search.labelWidth) {
|
8522
|
-
|
8655
|
+
_labelCol22.style = {
|
8523
8656
|
width: search.labelWidth
|
8524
8657
|
};
|
8525
8658
|
}
|
@@ -8536,17 +8669,17 @@ var WForm = function WForm(props, ref) {
|
|
8536
8669
|
}, c.formItemProps), {}, {
|
8537
8670
|
name: c.dataIndex,
|
8538
8671
|
label: c.title,
|
8539
|
-
labelCol:
|
8672
|
+
labelCol: _labelCol22
|
8540
8673
|
}), /*#__PURE__*/React__default['default'].createElement(Index.TextArea, _objectSpread2({
|
8541
8674
|
rows: 4,
|
8542
8675
|
disabled: disabled,
|
8543
8676
|
placeholder: "\u8BF7\u8F93\u5165"
|
8544
8677
|
}, c.fieldProps))));
|
8545
8678
|
} else if (c.valueType === 'inputNumber') {
|
8546
|
-
var
|
8679
|
+
var _labelCol23 = {};
|
8547
8680
|
|
8548
8681
|
if (search && search.labelWidth) {
|
8549
|
-
|
8682
|
+
_labelCol23.style = {
|
8550
8683
|
width: search.labelWidth
|
8551
8684
|
};
|
8552
8685
|
}
|
@@ -8563,16 +8696,16 @@ var WForm = function WForm(props, ref) {
|
|
8563
8696
|
}, c.formItemProps), {}, {
|
8564
8697
|
name: c.dataIndex,
|
8565
8698
|
label: c.title,
|
8566
|
-
labelCol:
|
8699
|
+
labelCol: _labelCol23
|
8567
8700
|
}), /*#__PURE__*/React__default['default'].createElement(WInputNumber, _objectSpread2({
|
8568
8701
|
disabled: disabled,
|
8569
8702
|
placeholder: "\u8BF7\u8F93\u5165"
|
8570
8703
|
}, c.fieldProps))));
|
8571
8704
|
} else {
|
8572
|
-
var
|
8705
|
+
var _labelCol24 = {};
|
8573
8706
|
|
8574
8707
|
if (search && search.labelWidth) {
|
8575
|
-
|
8708
|
+
_labelCol24.style = {
|
8576
8709
|
width: search.labelWidth
|
8577
8710
|
};
|
8578
8711
|
}
|
@@ -8589,7 +8722,7 @@ var WForm = function WForm(props, ref) {
|
|
8589
8722
|
}, c.formItemProps), {}, {
|
8590
8723
|
name: c.dataIndex,
|
8591
8724
|
label: c.title,
|
8592
|
-
labelCol:
|
8725
|
+
labelCol: _labelCol24
|
8593
8726
|
}), /*#__PURE__*/React__default['default'].createElement(Index, _objectSpread2({
|
8594
8727
|
disabled: disabled,
|
8595
8728
|
placeholder: "\u8BF7\u8F93\u5165"
|
@@ -8732,7 +8865,7 @@ var WForm = function WForm(props, ref) {
|
|
8732
8865
|
|
8733
8866
|
var WForm$1 = /*#__PURE__*/React__default['default'].forwardRef(WForm);
|
8734
8867
|
|
8735
|
-
var _excluded$
|
8868
|
+
var _excluded$8 = ["height", "width", "count", "style", "numberStyle"],
|
8736
8869
|
_excluded2$2 = ["count", "numberCount", "width", "height", "marginRight"];
|
8737
8870
|
|
8738
8871
|
var Number = function Number(_ref) {
|
@@ -8742,7 +8875,7 @@ var Number = function Number(_ref) {
|
|
8742
8875
|
count = _ref$count === void 0 ? 0 : _ref$count,
|
8743
8876
|
style = _ref.style,
|
8744
8877
|
numberStyle = _ref.numberStyle,
|
8745
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
8878
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
8746
8879
|
|
8747
8880
|
// 上次的值
|
8748
8881
|
var _useState = React.useState(0),
|
@@ -8906,12 +9039,12 @@ var Index$7 = function Index(props) {
|
|
8906
9039
|
}));
|
8907
9040
|
};
|
8908
9041
|
|
8909
|
-
var _excluded$
|
9042
|
+
var _excluded$9 = ["duration"];
|
8910
9043
|
|
8911
9044
|
var Index$8 = function Index(props) {
|
8912
9045
|
var _props$duration = props.duration,
|
8913
9046
|
duration = _props$duration === void 0 ? 2.75 : _props$duration,
|
8914
|
-
extraProps = _objectWithoutProperties(props, _excluded$
|
9047
|
+
extraProps = _objectWithoutProperties(props, _excluded$9);
|
8915
9048
|
return /*#__PURE__*/React__default['default'].createElement(CountUp__default['default'], _objectSpread2({
|
8916
9049
|
duration: duration
|
8917
9050
|
}, extraProps));
|
@@ -8919,7 +9052,7 @@ var Index$8 = function Index(props) {
|
|
8919
9052
|
|
8920
9053
|
Index$8.defaultProps = {};
|
8921
9054
|
|
8922
|
-
var _excluded$
|
9055
|
+
var _excluded$a = ["list", "render", "partSize"];
|
8923
9056
|
|
8924
9057
|
function AutoScroll(props) {
|
8925
9058
|
var inner1 = React.useRef();
|
@@ -9003,7 +9136,7 @@ var Index$9 = function Index(_ref) {
|
|
9003
9136
|
render = _ref.render,
|
9004
9137
|
_ref$partSize = _ref.partSize,
|
9005
9138
|
partSize = _ref$partSize === void 0 ? 4 : _ref$partSize,
|
9006
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
9139
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$a);
|
9007
9140
|
|
9008
9141
|
{
|
9009
9142
|
var _useState = React.useState([]),
|
@@ -9080,16 +9213,19 @@ var Index$9 = function Index(_ref) {
|
|
9080
9213
|
}
|
9081
9214
|
};
|
9082
9215
|
|
9083
|
-
var _excluded$
|
9216
|
+
var _excluded$b = ["data", "onClick", "slidesPerView", "rowKey", "onSwiperChange", "renderItem"];
|
9084
9217
|
|
9085
9218
|
SwiperCore__default['default'].use([SwiperCore.Pagination, SwiperCore.Navigation, SwiperCore.Autoplay]);
|
9086
9219
|
|
9087
9220
|
var Index$a = function Index(props) {
|
9088
9221
|
var data = props.data,
|
9089
9222
|
_onClick = props.onClick,
|
9090
|
-
|
9223
|
+
_props$slidesPerView = props.slidesPerView,
|
9224
|
+
slidesPerView = _props$slidesPerView === void 0 ? 4 : _props$slidesPerView,
|
9225
|
+
rowKey = props.rowKey,
|
9226
|
+
onSwiperChange = props.onSwiperChange,
|
9091
9227
|
renderItem = props.renderItem,
|
9092
|
-
extraProps = _objectWithoutProperties(props, _excluded$
|
9228
|
+
extraProps = _objectWithoutProperties(props, _excluded$b);
|
9093
9229
|
|
9094
9230
|
var _useState = React.useState(null),
|
9095
9231
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -9108,8 +9244,11 @@ var Index$a = function Index(props) {
|
|
9108
9244
|
// }
|
9109
9245
|
// onClick && onClick(swiper, event);
|
9110
9246
|
// }}
|
9247
|
+
onSlideChange: function onSlideChange(swiper) {
|
9248
|
+
onSwiperChange && onSwiperChange(swiper.realIndex, data[swiper.realIndex]);
|
9249
|
+
},
|
9111
9250
|
className: "mySwiper",
|
9112
|
-
slidesPerView:
|
9251
|
+
slidesPerView: slidesPerView,
|
9113
9252
|
spaceBetween: 30,
|
9114
9253
|
loop: true,
|
9115
9254
|
loopFillGroupWithBlank: true,
|
@@ -9117,7 +9256,7 @@ var Index$a = function Index(props) {
|
|
9117
9256
|
navigation: true
|
9118
9257
|
}, extraProps), data.map(function (item, index) {
|
9119
9258
|
return /*#__PURE__*/React__default['default'].createElement(react.SwiperSlide, {
|
9120
|
-
key: index
|
9259
|
+
key: rowKey ? item[rowKey] : index
|
9121
9260
|
}, function (_ref) {
|
9122
9261
|
var isActive = _ref.isActive;
|
9123
9262
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
@@ -9127,7 +9266,7 @@ var Index$a = function Index(props) {
|
|
9127
9266
|
},
|
9128
9267
|
onClick: function onClick(event) {
|
9129
9268
|
if (controlledSwiper) {
|
9130
|
-
if (controlledSwiper.clickedIndex -
|
9269
|
+
if (controlledSwiper.clickedIndex - slidesPerView > data.length) {
|
9131
9270
|
controlledSwiper.slideNext();
|
9132
9271
|
} else {
|
9133
9272
|
controlledSwiper.clickedIndex && controlledSwiper.slideTo(controlledSwiper.clickedIndex);
|
@@ -9737,7 +9876,7 @@ function createBrowserHistory(props) {
|
|
9737
9876
|
return history;
|
9738
9877
|
}
|
9739
9878
|
|
9740
|
-
var _excluded$
|
9879
|
+
var _excluded$c = ["routes", "className"];
|
9741
9880
|
var history = createBrowserHistory();
|
9742
9881
|
|
9743
9882
|
function itemRender(route, params, routes, paths) {
|
@@ -9755,7 +9894,7 @@ function itemRender(route, params, routes, paths) {
|
|
9755
9894
|
var Index$b = function Index(_ref) {
|
9756
9895
|
var routes = _ref.routes,
|
9757
9896
|
className = _ref.className,
|
9758
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
9897
|
+
props = _objectWithoutProperties(_ref, _excluded$c);
|
9759
9898
|
|
9760
9899
|
return /*#__PURE__*/React__default['default'].createElement(_Breadcrumb__default['default'], _objectSpread2({
|
9761
9900
|
className: className || 'default',
|
@@ -9765,7 +9904,7 @@ var Index$b = function Index(_ref) {
|
|
9765
9904
|
}, props));
|
9766
9905
|
};
|
9767
9906
|
|
9768
|
-
var _excluded$
|
9907
|
+
var _excluded$d = ["title", "className", "headerTail", "headerCenter"];
|
9769
9908
|
|
9770
9909
|
var Index$c = function Index(_ref) {
|
9771
9910
|
var _classNames;
|
@@ -9775,7 +9914,7 @@ var Index$c = function Index(_ref) {
|
|
9775
9914
|
className = _ref$className === void 0 ? 'default' : _ref$className,
|
9776
9915
|
headerTail = _ref.headerTail,
|
9777
9916
|
headerCenter = _ref.headerCenter,
|
9778
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
9917
|
+
props = _objectWithoutProperties(_ref, _excluded$d);
|
9779
9918
|
|
9780
9919
|
return /*#__PURE__*/React__default['default'].createElement("div", _objectSpread2({
|
9781
9920
|
className: classnames__default['default']((_classNames = {}, _defineProperty(_classNames, 'card-container', true), _defineProperty(_classNames, className, true), _classNames))
|
@@ -9882,7 +10021,7 @@ function DialogModel(props) {
|
|
9882
10021
|
return renderChildren;
|
9883
10022
|
}
|
9884
10023
|
|
9885
|
-
var _excluded$
|
10024
|
+
var _excluded$e = ["visible"];
|
9886
10025
|
|
9887
10026
|
var Modal = /*#__PURE__*/function (_React$PureComponent) {
|
9888
10027
|
_inherits(Modal, _React$PureComponent);
|
@@ -10016,7 +10155,7 @@ Modal.show = function (config) {
|
|
10016
10155
|
manager.setShow = setShow;
|
10017
10156
|
|
10018
10157
|
var visible = props.visible,
|
10019
|
-
trueProps = _objectWithoutProperties(props, _excluded$
|
10158
|
+
trueProps = _objectWithoutProperties(props, _excluded$e);
|
10020
10159
|
|
10021
10160
|
React.useEffect(function () {
|
10022
10161
|
manager.mounted = true;
|
@@ -10040,7 +10179,7 @@ Modal.hidden = function () {
|
|
10040
10179
|
ModalContainer[modelSysbol] && ModalContainer[modelSysbol].hidden();
|
10041
10180
|
};
|
10042
10181
|
|
10043
|
-
var _excluded$
|
10182
|
+
var _excluded$f = ["columns", "extraColumns", "search", "visible", "setVisible", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange"];
|
10044
10183
|
|
10045
10184
|
var ModalForm = function ModalForm(props, ref) {
|
10046
10185
|
var columns = props.columns,
|
@@ -10054,7 +10193,7 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10054
10193
|
title = props.title,
|
10055
10194
|
record = props.record,
|
10056
10195
|
onFormChange = props.onFormChange,
|
10057
|
-
extraProps = _objectWithoutProperties(props, _excluded$
|
10196
|
+
extraProps = _objectWithoutProperties(props, _excluded$f);
|
10058
10197
|
|
10059
10198
|
var formRef = React.useRef(null);
|
10060
10199
|
|
@@ -10185,7 +10324,748 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10185
10324
|
|
10186
10325
|
var ModalForm$1 = /*#__PURE__*/React__default['default'].forwardRef(ModalForm);
|
10187
10326
|
|
10188
|
-
|
10327
|
+
function _defineProperty$1(obj, key, value) {
|
10328
|
+
if (key in obj) {
|
10329
|
+
Object.defineProperty(obj, key, {
|
10330
|
+
value: value,
|
10331
|
+
enumerable: true,
|
10332
|
+
configurable: true,
|
10333
|
+
writable: true
|
10334
|
+
});
|
10335
|
+
} else {
|
10336
|
+
obj[key] = value;
|
10337
|
+
}
|
10338
|
+
|
10339
|
+
return obj;
|
10340
|
+
}
|
10341
|
+
|
10342
|
+
function ownKeys$1(object, enumerableOnly) {
|
10343
|
+
var keys = Object.keys(object);
|
10344
|
+
|
10345
|
+
if (Object.getOwnPropertySymbols) {
|
10346
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
10347
|
+
|
10348
|
+
if (enumerableOnly) {
|
10349
|
+
symbols = symbols.filter(function (sym) {
|
10350
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
10351
|
+
});
|
10352
|
+
}
|
10353
|
+
|
10354
|
+
keys.push.apply(keys, symbols);
|
10355
|
+
}
|
10356
|
+
|
10357
|
+
return keys;
|
10358
|
+
}
|
10359
|
+
|
10360
|
+
function _objectSpread2$1(target) {
|
10361
|
+
for (var i = 1; i < arguments.length; i++) {
|
10362
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
10363
|
+
|
10364
|
+
if (i % 2) {
|
10365
|
+
ownKeys$1(Object(source), true).forEach(function (key) {
|
10366
|
+
_defineProperty$1(target, key, source[key]);
|
10367
|
+
});
|
10368
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
10369
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
10370
|
+
} else {
|
10371
|
+
ownKeys$1(Object(source)).forEach(function (key) {
|
10372
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
10373
|
+
});
|
10374
|
+
}
|
10375
|
+
}
|
10376
|
+
|
10377
|
+
return target;
|
10378
|
+
}
|
10379
|
+
|
10380
|
+
function _arrayLikeToArray$1(arr, len) {
|
10381
|
+
if (len == null || len > arr.length) len = arr.length;
|
10382
|
+
|
10383
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
10384
|
+
arr2[i] = arr[i];
|
10385
|
+
}
|
10386
|
+
|
10387
|
+
return arr2;
|
10388
|
+
}
|
10389
|
+
|
10390
|
+
function _unsupportedIterableToArray$1(o, minLen) {
|
10391
|
+
if (!o) return;
|
10392
|
+
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
|
10393
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
10394
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
10395
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
10396
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
|
10397
|
+
}
|
10398
|
+
|
10399
|
+
function _createForOfIteratorHelper$1(o, allowArrayLike) {
|
10400
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
10401
|
+
|
10402
|
+
if (!it) {
|
10403
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") {
|
10404
|
+
if (it) o = it;
|
10405
|
+
var i = 0;
|
10406
|
+
|
10407
|
+
var F = function F() {};
|
10408
|
+
|
10409
|
+
return {
|
10410
|
+
s: F,
|
10411
|
+
n: function n() {
|
10412
|
+
if (i >= o.length) return {
|
10413
|
+
done: true
|
10414
|
+
};
|
10415
|
+
return {
|
10416
|
+
done: false,
|
10417
|
+
value: o[i++]
|
10418
|
+
};
|
10419
|
+
},
|
10420
|
+
e: function e(_e) {
|
10421
|
+
throw _e;
|
10422
|
+
},
|
10423
|
+
f: F
|
10424
|
+
};
|
10425
|
+
}
|
10426
|
+
|
10427
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
10428
|
+
}
|
10429
|
+
|
10430
|
+
var normalCompletion = true,
|
10431
|
+
didErr = false,
|
10432
|
+
err;
|
10433
|
+
return {
|
10434
|
+
s: function s() {
|
10435
|
+
it = it.call(o);
|
10436
|
+
},
|
10437
|
+
n: function n() {
|
10438
|
+
var step = it.next();
|
10439
|
+
normalCompletion = step.done;
|
10440
|
+
return step;
|
10441
|
+
},
|
10442
|
+
e: function e(_e2) {
|
10443
|
+
didErr = true;
|
10444
|
+
err = _e2;
|
10445
|
+
},
|
10446
|
+
f: function f() {
|
10447
|
+
try {
|
10448
|
+
if (!normalCompletion && it["return"] != null) it["return"]();
|
10449
|
+
} finally {
|
10450
|
+
if (didErr) throw err;
|
10451
|
+
}
|
10452
|
+
}
|
10453
|
+
};
|
10454
|
+
}
|
10455
|
+
|
10456
|
+
/*! *****************************************************************************
|
10457
|
+
Copyright (c) Microsoft Corporation.
|
10458
|
+
|
10459
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
10460
|
+
purpose with or without fee is hereby granted.
|
10461
|
+
|
10462
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
10463
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
10464
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
10465
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
10466
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
10467
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
10468
|
+
PERFORMANCE OF THIS SOFTWARE.
|
10469
|
+
***************************************************************************** */
|
10470
|
+
|
10471
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
10472
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
10473
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
10474
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
10475
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
10476
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
10477
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
10478
|
+
});
|
10479
|
+
}
|
10480
|
+
|
10481
|
+
function __generator(thisArg, body) {
|
10482
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
10483
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
10484
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
10485
|
+
function step(op) {
|
10486
|
+
if (f) throw new TypeError("Generator is already executing.");
|
10487
|
+
while (_) try {
|
10488
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
10489
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
10490
|
+
switch (op[0]) {
|
10491
|
+
case 0: case 1: t = op; break;
|
10492
|
+
case 4: _.label++; return { value: op[1], done: false };
|
10493
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
10494
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
10495
|
+
default:
|
10496
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
10497
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
10498
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
10499
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
10500
|
+
if (t[2]) _.ops.pop();
|
10501
|
+
_.trys.pop(); continue;
|
10502
|
+
}
|
10503
|
+
op = body.call(thisArg, _);
|
10504
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
10505
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
10506
|
+
}
|
10507
|
+
}
|
10508
|
+
|
10509
|
+
var noop = function () { };
|
10510
|
+
// Using noop() as the undefined value as undefined can possibly be replaced
|
10511
|
+
// by something else. Prettier ignore and extra parentheses are necessary here
|
10512
|
+
// to ensure that tsc doesn't remove the __NOINLINE__ comment.
|
10513
|
+
// prettier-ignore
|
10514
|
+
var UNDEFINED = ( /*#__NOINLINE__*/noop());
|
10515
|
+
var OBJECT = Object;
|
10516
|
+
var isUndefined$1 = function (v) { return v === UNDEFINED; };
|
10517
|
+
var isFunction$1 = function (v) { return typeof v == 'function'; };
|
10518
|
+
var mergeObjects = function (a, b) { return OBJECT.assign({}, a, b); };
|
10519
|
+
var STR_UNDEFINED = 'undefined';
|
10520
|
+
var hasWindow = function () { return typeof window != STR_UNDEFINED; };
|
10521
|
+
var hasDocument = function () { return typeof document != STR_UNDEFINED; };
|
10522
|
+
|
10523
|
+
// use WeakMap to store the object->key mapping
|
10524
|
+
// so the objects can be garbage collected.
|
10525
|
+
// WeakMap uses a hashtable under the hood, so the lookup
|
10526
|
+
// complexity is almost O(1).
|
10527
|
+
var table = new WeakMap();
|
10528
|
+
// counter of the key
|
10529
|
+
var counter = 0;
|
10530
|
+
// A stable hash implementation that supports:
|
10531
|
+
// - Fast and ensures unique hash properties
|
10532
|
+
// - Handles unserializable values
|
10533
|
+
// - Handles object key ordering
|
10534
|
+
// - Generates short results
|
10535
|
+
//
|
10536
|
+
// This is not a serialization function, and the result is not guaranteed to be
|
10537
|
+
// parsible.
|
10538
|
+
var stableHash = function (arg) {
|
10539
|
+
var type = typeof arg;
|
10540
|
+
var constructor = arg && arg.constructor;
|
10541
|
+
var isDate = constructor == Date;
|
10542
|
+
var result;
|
10543
|
+
var index;
|
10544
|
+
if (OBJECT(arg) === arg && !isDate && constructor != RegExp) {
|
10545
|
+
// Object/function, not null/date/regexp. Use WeakMap to store the id first.
|
10546
|
+
// If it's already hashed, directly return the result.
|
10547
|
+
result = table.get(arg);
|
10548
|
+
if (result)
|
10549
|
+
return result;
|
10550
|
+
// Store the hash first for circular reference detection before entering the
|
10551
|
+
// recursive `stableHash` calls.
|
10552
|
+
// For other objects like set and map, we use this id directly as the hash.
|
10553
|
+
result = ++counter + '~';
|
10554
|
+
table.set(arg, result);
|
10555
|
+
if (constructor == Array) {
|
10556
|
+
// Array.
|
10557
|
+
result = '@';
|
10558
|
+
for (index = 0; index < arg.length; index++) {
|
10559
|
+
result += stableHash(arg[index]) + ',';
|
10560
|
+
}
|
10561
|
+
table.set(arg, result);
|
10562
|
+
}
|
10563
|
+
if (constructor == OBJECT) {
|
10564
|
+
// Object, sort keys.
|
10565
|
+
result = '#';
|
10566
|
+
var keys = OBJECT.keys(arg).sort();
|
10567
|
+
while (!isUndefined$1((index = keys.pop()))) {
|
10568
|
+
if (!isUndefined$1(arg[index])) {
|
10569
|
+
result += index + ':' + stableHash(arg[index]) + ',';
|
10570
|
+
}
|
10571
|
+
}
|
10572
|
+
table.set(arg, result);
|
10573
|
+
}
|
10574
|
+
}
|
10575
|
+
else {
|
10576
|
+
result = isDate
|
10577
|
+
? arg.toJSON()
|
10578
|
+
: type == 'symbol'
|
10579
|
+
? arg.toString()
|
10580
|
+
: type == 'string'
|
10581
|
+
? JSON.stringify(arg)
|
10582
|
+
: '' + arg;
|
10583
|
+
}
|
10584
|
+
return result;
|
10585
|
+
};
|
10586
|
+
|
10587
|
+
/**
|
10588
|
+
* Due to bug https://bugs.chromium.org/p/chromium/issues/detail?id=678075,
|
10589
|
+
* it's not reliable to detect if the browser is currently online or offline
|
10590
|
+
* based on `navigator.onLine`.
|
10591
|
+
* As a work around, we always assume it's online on first load, and change
|
10592
|
+
* the status upon `online` or `offline` events.
|
10593
|
+
*/
|
10594
|
+
var online = true;
|
10595
|
+
var isOnline = function () { return online; };
|
10596
|
+
var hasWin = hasWindow();
|
10597
|
+
var hasDoc = hasDocument();
|
10598
|
+
// For node and React Native, `add/removeEventListener` doesn't exist on window.
|
10599
|
+
var onWindowEvent = hasWin && window.addEventListener
|
10600
|
+
? window.addEventListener.bind(window)
|
10601
|
+
: noop;
|
10602
|
+
var onDocumentEvent = hasDoc ? document.addEventListener.bind(document) : noop;
|
10603
|
+
var offWindowEvent = hasWin && window.removeEventListener
|
10604
|
+
? window.removeEventListener.bind(window)
|
10605
|
+
: noop;
|
10606
|
+
var offDocumentEvent = hasDoc
|
10607
|
+
? document.removeEventListener.bind(document)
|
10608
|
+
: noop;
|
10609
|
+
var isVisible = function () {
|
10610
|
+
var visibilityState = hasDoc && document.visibilityState;
|
10611
|
+
if (!isUndefined$1(visibilityState)) {
|
10612
|
+
return visibilityState !== 'hidden';
|
10613
|
+
}
|
10614
|
+
return true;
|
10615
|
+
};
|
10616
|
+
var initFocus = function (cb) {
|
10617
|
+
// focus revalidate
|
10618
|
+
onDocumentEvent('visibilitychange', cb);
|
10619
|
+
onWindowEvent('focus', cb);
|
10620
|
+
return function () {
|
10621
|
+
offDocumentEvent('visibilitychange', cb);
|
10622
|
+
offWindowEvent('focus', cb);
|
10623
|
+
};
|
10624
|
+
};
|
10625
|
+
var initReconnect = function (cb) {
|
10626
|
+
// revalidate on reconnected
|
10627
|
+
var onOnline = function () {
|
10628
|
+
online = true;
|
10629
|
+
cb();
|
10630
|
+
};
|
10631
|
+
// nothing to revalidate, just update the status
|
10632
|
+
var onOffline = function () {
|
10633
|
+
online = false;
|
10634
|
+
};
|
10635
|
+
onWindowEvent('online', onOnline);
|
10636
|
+
onWindowEvent('offline', onOffline);
|
10637
|
+
return function () {
|
10638
|
+
offWindowEvent('online', onOnline);
|
10639
|
+
offWindowEvent('offline', onOffline);
|
10640
|
+
};
|
10641
|
+
};
|
10642
|
+
var preset = {
|
10643
|
+
isOnline: isOnline,
|
10644
|
+
isVisible: isVisible
|
10645
|
+
};
|
10646
|
+
var defaultConfigOptions = {
|
10647
|
+
initFocus: initFocus,
|
10648
|
+
initReconnect: initReconnect
|
10649
|
+
};
|
10650
|
+
|
10651
|
+
var IS_SERVER = !hasWindow() || 'Deno' in window;
|
10652
|
+
// React currently throws a warning when using useLayoutEffect on the server.
|
10653
|
+
// To get around it, we can conditionally useEffect on the server (no-op) and
|
10654
|
+
// useLayoutEffect in the browser.
|
10655
|
+
var useIsomorphicLayoutEffect = IS_SERVER ? React.useEffect : React.useLayoutEffect;
|
10656
|
+
// This assignment is to extend the Navigator type to use effectiveType.
|
10657
|
+
var navigatorConnection = typeof navigator !== 'undefined' &&
|
10658
|
+
navigator.connection;
|
10659
|
+
// Adjust the config based on slow connection status (<= 70Kbps).
|
10660
|
+
var slowConnection = !IS_SERVER &&
|
10661
|
+
navigatorConnection &&
|
10662
|
+
(['slow-2g', '2g'].includes(navigatorConnection.effectiveType) ||
|
10663
|
+
navigatorConnection.saveData);
|
10664
|
+
|
10665
|
+
var serialize = function (key) {
|
10666
|
+
if (isFunction$1(key)) {
|
10667
|
+
try {
|
10668
|
+
key = key();
|
10669
|
+
}
|
10670
|
+
catch (err) {
|
10671
|
+
// dependencies not ready
|
10672
|
+
key = '';
|
10673
|
+
}
|
10674
|
+
}
|
10675
|
+
var args = [].concat(key);
|
10676
|
+
// If key is not falsy, or not an empty array, hash it.
|
10677
|
+
key =
|
10678
|
+
typeof key == 'string'
|
10679
|
+
? key
|
10680
|
+
: (Array.isArray(key)
|
10681
|
+
? key.length
|
10682
|
+
: key)
|
10683
|
+
? stableHash(key)
|
10684
|
+
: '';
|
10685
|
+
var errorKey = key ? '$err$' + key : '';
|
10686
|
+
var isValidatingKey = key ? '$req$' + key : '';
|
10687
|
+
return [key, args, errorKey, isValidatingKey];
|
10688
|
+
};
|
10689
|
+
|
10690
|
+
// Global state used to deduplicate requests and store listeners
|
10691
|
+
var SWRGlobalState = new WeakMap();
|
10692
|
+
|
10693
|
+
var FOCUS_EVENT = 0;
|
10694
|
+
var RECONNECT_EVENT = 1;
|
10695
|
+
var MUTATE_EVENT = 2;
|
10696
|
+
|
10697
|
+
var broadcastState = function (cache, key, data, error, isValidating, revalidate) {
|
10698
|
+
var _a = SWRGlobalState.get(cache), EVENT_REVALIDATORS = _a[0], STATE_UPDATERS = _a[1], CONCURRENT_PROMISES = _a[4], CONCURRENT_PROMISES_TS = _a[5];
|
10699
|
+
var revalidators = EVENT_REVALIDATORS[key];
|
10700
|
+
var updaters = STATE_UPDATERS[key] || [];
|
10701
|
+
// Always update states of all hooks.
|
10702
|
+
for (var i = 0; i < updaters.length; ++i) {
|
10703
|
+
updaters[i](data, error, isValidating);
|
10704
|
+
}
|
10705
|
+
// If we also need to revalidate, only do it for the first hook.
|
10706
|
+
if (revalidate) {
|
10707
|
+
// Invalidate the key by deleting the concurrent request markers so new
|
10708
|
+
// requests will not be deduped.
|
10709
|
+
delete CONCURRENT_PROMISES[key];
|
10710
|
+
delete CONCURRENT_PROMISES_TS[key];
|
10711
|
+
if (revalidators && revalidators[0]) {
|
10712
|
+
return revalidators[0](MUTATE_EVENT).then(function () {
|
10713
|
+
return cache.get(key);
|
10714
|
+
});
|
10715
|
+
}
|
10716
|
+
}
|
10717
|
+
return cache.get(key);
|
10718
|
+
};
|
10719
|
+
|
10720
|
+
// Global timestamp.
|
10721
|
+
var __timestamp = 0;
|
10722
|
+
var getTimestamp = function () { return ++__timestamp; };
|
10723
|
+
|
10724
|
+
var internalMutate = function () {
|
10725
|
+
var args = [];
|
10726
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
10727
|
+
args[_i] = arguments[_i];
|
10728
|
+
}
|
10729
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
10730
|
+
var cache, _key, revalidate, _data, _a, key, keyErr, _b, MUTATION_TS, MUTATION_END_TS, data, error, beforeMutationTs, res;
|
10731
|
+
return __generator(this, function (_c) {
|
10732
|
+
switch (_c.label) {
|
10733
|
+
case 0:
|
10734
|
+
cache = args[0], _key = args[1];
|
10735
|
+
revalidate = args[3] !== false;
|
10736
|
+
_data = args[2];
|
10737
|
+
_a = serialize(_key), key = _a[0], keyErr = _a[2];
|
10738
|
+
if (!key)
|
10739
|
+
return [2 /*return*/];
|
10740
|
+
_b = SWRGlobalState.get(cache), MUTATION_TS = _b[2], MUTATION_END_TS = _b[3];
|
10741
|
+
// If there is no new data provided, revalidate the key with current state.
|
10742
|
+
if (args.length < 3) {
|
10743
|
+
// Revalidate and broadcast state.
|
10744
|
+
return [2 /*return*/, broadcastState(cache, key, cache.get(key), cache.get(keyErr), UNDEFINED, revalidate)];
|
10745
|
+
}
|
10746
|
+
beforeMutationTs = (MUTATION_TS[key] = getTimestamp());
|
10747
|
+
MUTATION_END_TS[key] = 0;
|
10748
|
+
if (isFunction$1(_data)) {
|
10749
|
+
// `_data` is a function, call it passing current cache value.
|
10750
|
+
try {
|
10751
|
+
_data = _data(cache.get(key));
|
10752
|
+
}
|
10753
|
+
catch (err) {
|
10754
|
+
// If it throws an error synchronously, we shouldn't update the cache.
|
10755
|
+
error = err;
|
10756
|
+
}
|
10757
|
+
}
|
10758
|
+
if (!(_data && isFunction$1(_data.then))) return [3 /*break*/, 2];
|
10759
|
+
return [4 /*yield*/, _data.catch(function (err) {
|
10760
|
+
error = err;
|
10761
|
+
})
|
10762
|
+
// Check if other mutations have occurred since we've started this mutation.
|
10763
|
+
// If there's a race we don't update cache or broadcast the change,
|
10764
|
+
// just return the data.
|
10765
|
+
];
|
10766
|
+
case 1:
|
10767
|
+
// This means that the mutation is async, we need to check timestamps to
|
10768
|
+
// avoid race conditions.
|
10769
|
+
data = _c.sent();
|
10770
|
+
// Check if other mutations have occurred since we've started this mutation.
|
10771
|
+
// If there's a race we don't update cache or broadcast the change,
|
10772
|
+
// just return the data.
|
10773
|
+
if (beforeMutationTs !== MUTATION_TS[key]) {
|
10774
|
+
if (error)
|
10775
|
+
throw error;
|
10776
|
+
return [2 /*return*/, data];
|
10777
|
+
}
|
10778
|
+
return [3 /*break*/, 3];
|
10779
|
+
case 2:
|
10780
|
+
data = _data;
|
10781
|
+
_c.label = 3;
|
10782
|
+
case 3:
|
10783
|
+
// Only update cached data if there's no error. Data can be `undefined` here.
|
10784
|
+
if (!error) {
|
10785
|
+
cache.set(key, data);
|
10786
|
+
}
|
10787
|
+
// Always update or reset the error.
|
10788
|
+
cache.set(keyErr, error);
|
10789
|
+
// Reset the timestamp to mark the mutation has ended.
|
10790
|
+
MUTATION_END_TS[key] = getTimestamp();
|
10791
|
+
return [4 /*yield*/, broadcastState(cache, key, data, error, UNDEFINED, revalidate)
|
10792
|
+
// Throw error or return data
|
10793
|
+
];
|
10794
|
+
case 4:
|
10795
|
+
res = _c.sent();
|
10796
|
+
// Throw error or return data
|
10797
|
+
if (error)
|
10798
|
+
throw error;
|
10799
|
+
return [2 /*return*/, res];
|
10800
|
+
}
|
10801
|
+
});
|
10802
|
+
});
|
10803
|
+
};
|
10804
|
+
|
10805
|
+
var revalidateAllKeys = function (revalidators, type) {
|
10806
|
+
for (var key in revalidators) {
|
10807
|
+
if (revalidators[key][0])
|
10808
|
+
revalidators[key][0](type);
|
10809
|
+
}
|
10810
|
+
};
|
10811
|
+
var initCache = function (provider, options) {
|
10812
|
+
// The global state for a specific provider will be used to deduplicate
|
10813
|
+
// requests and store listeners. As well as a mutate function that bound to
|
10814
|
+
// the cache.
|
10815
|
+
// Provider's global state might be already initialized. Let's try to get the
|
10816
|
+
// global state associated with the provider first.
|
10817
|
+
if (!SWRGlobalState.has(provider)) {
|
10818
|
+
var opts = mergeObjects(defaultConfigOptions, options);
|
10819
|
+
// If there's no global state bound to the provider, create a new one with the
|
10820
|
+
// new mutate function.
|
10821
|
+
var EVENT_REVALIDATORS = {};
|
10822
|
+
var mutate = internalMutate.bind(UNDEFINED, provider);
|
10823
|
+
var unmount = noop;
|
10824
|
+
// Update the state if it's new, or the provider has been extended.
|
10825
|
+
SWRGlobalState.set(provider, [
|
10826
|
+
EVENT_REVALIDATORS,
|
10827
|
+
{},
|
10828
|
+
{},
|
10829
|
+
{},
|
10830
|
+
{},
|
10831
|
+
{},
|
10832
|
+
mutate
|
10833
|
+
]);
|
10834
|
+
// This is a new provider, we need to initialize it and setup DOM events
|
10835
|
+
// listeners for `focus` and `reconnect` actions.
|
10836
|
+
if (!IS_SERVER) {
|
10837
|
+
var releaseFocus_1 = opts.initFocus(revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, FOCUS_EVENT));
|
10838
|
+
var releaseReconnect_1 = opts.initReconnect(revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, RECONNECT_EVENT));
|
10839
|
+
unmount = function () {
|
10840
|
+
releaseFocus_1 && releaseFocus_1();
|
10841
|
+
releaseReconnect_1 && releaseReconnect_1();
|
10842
|
+
// When un-mounting, we need to remove the cache provider from the state
|
10843
|
+
// storage too because it's a side-effect. Otherwise when re-mounting we
|
10844
|
+
// will not re-register those event listeners.
|
10845
|
+
SWRGlobalState.delete(provider);
|
10846
|
+
};
|
10847
|
+
}
|
10848
|
+
// We might want to inject an extra layer on top of `provider` in the future,
|
10849
|
+
// such as key serialization, auto GC, etc.
|
10850
|
+
// For now, it's just a `Map` interface without any modifications.
|
10851
|
+
return [provider, mutate, unmount];
|
10852
|
+
}
|
10853
|
+
return [provider, SWRGlobalState.get(provider)[6]];
|
10854
|
+
};
|
10855
|
+
|
10856
|
+
// error retry
|
10857
|
+
var onErrorRetry = function (_, __, config, revalidate, opts) {
|
10858
|
+
if (!preset.isVisible()) {
|
10859
|
+
// If it's hidden, stop. It will auto revalidate when refocusing.
|
10860
|
+
return;
|
10861
|
+
}
|
10862
|
+
var maxRetryCount = config.errorRetryCount;
|
10863
|
+
var currentRetryCount = opts.retryCount;
|
10864
|
+
// Exponential backoff
|
10865
|
+
var timeout = ~~((Math.random() + 0.5) *
|
10866
|
+
(1 << (currentRetryCount < 8 ? currentRetryCount : 8))) * config.errorRetryInterval;
|
10867
|
+
if (!isUndefined$1(maxRetryCount) && currentRetryCount > maxRetryCount) {
|
10868
|
+
return;
|
10869
|
+
}
|
10870
|
+
setTimeout(revalidate, timeout, opts);
|
10871
|
+
};
|
10872
|
+
// Default cache provider
|
10873
|
+
var _a = initCache(new Map()), cache = _a[0], mutate = _a[1];
|
10874
|
+
// Default config
|
10875
|
+
var defaultConfig = mergeObjects({
|
10876
|
+
// events
|
10877
|
+
onLoadingSlow: noop,
|
10878
|
+
onSuccess: noop,
|
10879
|
+
onError: noop,
|
10880
|
+
onErrorRetry: onErrorRetry,
|
10881
|
+
onDiscarded: noop,
|
10882
|
+
// switches
|
10883
|
+
revalidateOnFocus: true,
|
10884
|
+
revalidateOnReconnect: true,
|
10885
|
+
revalidateIfStale: true,
|
10886
|
+
shouldRetryOnError: true,
|
10887
|
+
// timeouts
|
10888
|
+
errorRetryInterval: slowConnection ? 10000 : 5000,
|
10889
|
+
focusThrottleInterval: 5 * 1000,
|
10890
|
+
dedupingInterval: 2 * 1000,
|
10891
|
+
loadingTimeout: slowConnection ? 5000 : 3000,
|
10892
|
+
// providers
|
10893
|
+
compare: function (currentData, newData) {
|
10894
|
+
return stableHash(currentData) == stableHash(newData);
|
10895
|
+
},
|
10896
|
+
isPaused: function () { return false; },
|
10897
|
+
cache: cache,
|
10898
|
+
mutate: mutate,
|
10899
|
+
fallback: {}
|
10900
|
+
},
|
10901
|
+
// use web preset by default
|
10902
|
+
preset);
|
10903
|
+
|
10904
|
+
var mergeConfigs$1 = function (a, b) {
|
10905
|
+
// Need to create a new object to avoid mutating the original here.
|
10906
|
+
var v = mergeObjects(a, b);
|
10907
|
+
// If two configs are provided, merge their `use` and `fallback` options.
|
10908
|
+
if (b) {
|
10909
|
+
var u1 = a.use, f1 = a.fallback;
|
10910
|
+
var u2 = b.use, f2 = b.fallback;
|
10911
|
+
if (u1 && u2) {
|
10912
|
+
v.use = u1.concat(u2);
|
10913
|
+
}
|
10914
|
+
if (f1 && f2) {
|
10915
|
+
v.fallback = mergeObjects(f1, f2);
|
10916
|
+
}
|
10917
|
+
}
|
10918
|
+
return v;
|
10919
|
+
};
|
10920
|
+
|
10921
|
+
var SWRConfigContext = React.createContext({});
|
10922
|
+
var SWRConfig$1 = function (props) {
|
10923
|
+
var value = props.value;
|
10924
|
+
// Extend parent context values and middleware.
|
10925
|
+
var extendedConfig = mergeConfigs$1(React.useContext(SWRConfigContext), value);
|
10926
|
+
// Should not use the inherited provider.
|
10927
|
+
var provider = value && value.provider;
|
10928
|
+
// Use a lazy initialized state to create the cache on first access.
|
10929
|
+
var cacheContext = React.useState(function () {
|
10930
|
+
return provider
|
10931
|
+
? initCache(provider(extendedConfig.cache || cache), value)
|
10932
|
+
: UNDEFINED;
|
10933
|
+
})[0];
|
10934
|
+
// Override the cache if a new provider is given.
|
10935
|
+
if (cacheContext) {
|
10936
|
+
extendedConfig.cache = cacheContext[0];
|
10937
|
+
extendedConfig.mutate = cacheContext[1];
|
10938
|
+
}
|
10939
|
+
// Unsubscribe events.
|
10940
|
+
useIsomorphicLayoutEffect(function () { return (cacheContext ? cacheContext[2] : UNDEFINED); }, []);
|
10941
|
+
return React.createElement(SWRConfigContext.Provider, mergeObjects(props, {
|
10942
|
+
value: extendedConfig
|
10943
|
+
}));
|
10944
|
+
};
|
10945
|
+
var SWRConfig = OBJECT.defineProperty(SWRConfig$1, 'default', {
|
10946
|
+
value: defaultConfig
|
10947
|
+
});
|
10948
|
+
|
10949
|
+
var zhCN = {
|
10950
|
+
moneySymbol: '¥',
|
10951
|
+
form: {
|
10952
|
+
lightFilter: {
|
10953
|
+
more: '更多筛选',
|
10954
|
+
clear: '清除',
|
10955
|
+
confirm: '确认',
|
10956
|
+
itemUnit: '项'
|
10957
|
+
}
|
10958
|
+
},
|
10959
|
+
tableForm: {
|
10960
|
+
search: '查询',
|
10961
|
+
reset: '重置',
|
10962
|
+
submit: '提交',
|
10963
|
+
collapsed: '展开',
|
10964
|
+
expand: '收起',
|
10965
|
+
inputPlaceholder: '请输入',
|
10966
|
+
selectPlaceholder: '请选择'
|
10967
|
+
},
|
10968
|
+
alert: {
|
10969
|
+
clear: '取消选择',
|
10970
|
+
selected: '已选择',
|
10971
|
+
item: '项'
|
10972
|
+
},
|
10973
|
+
pagination: {
|
10974
|
+
total: {
|
10975
|
+
range: '第',
|
10976
|
+
total: '条/总共',
|
10977
|
+
item: '条'
|
10978
|
+
}
|
10979
|
+
},
|
10980
|
+
tableToolBar: {
|
10981
|
+
leftPin: '固定在列首',
|
10982
|
+
rightPin: '固定在列尾',
|
10983
|
+
noPin: '不固定',
|
10984
|
+
leftFixedTitle: '固定在左侧',
|
10985
|
+
rightFixedTitle: '固定在右侧',
|
10986
|
+
noFixedTitle: '不固定',
|
10987
|
+
reset: '重置',
|
10988
|
+
columnDisplay: '列展示',
|
10989
|
+
columnSetting: '列设置',
|
10990
|
+
fullScreen: '全屏',
|
10991
|
+
exitFullScreen: '退出全屏',
|
10992
|
+
reload: '刷新',
|
10993
|
+
density: '密度',
|
10994
|
+
densityDefault: '正常',
|
10995
|
+
densityLarger: '默认',
|
10996
|
+
densityMiddle: '中等',
|
10997
|
+
densitySmall: '紧凑'
|
10998
|
+
},
|
10999
|
+
editableTable: {
|
11000
|
+
action: {
|
11001
|
+
save: '保存',
|
11002
|
+
cancel: '取消',
|
11003
|
+
delete: '删除'
|
11004
|
+
}
|
11005
|
+
},
|
11006
|
+
switch: {
|
11007
|
+
open: '打开',
|
11008
|
+
close: '关闭'
|
11009
|
+
},
|
11010
|
+
loginForm: {
|
11011
|
+
submitText: '登录'
|
11012
|
+
}
|
11013
|
+
};
|
11014
|
+
|
11015
|
+
function get$3(source, path, defaultValue) {
|
11016
|
+
// a[3].b -> a.3.b
|
11017
|
+
var paths = path.replace(/\[(\d+)\]/g, '.$1').split('.');
|
11018
|
+
var result = source;
|
11019
|
+
var message = defaultValue; // eslint-disable-next-line no-restricted-syntax
|
11020
|
+
|
11021
|
+
var _iterator = _createForOfIteratorHelper$1(paths),
|
11022
|
+
_step;
|
11023
|
+
|
11024
|
+
try {
|
11025
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
11026
|
+
var p = _step.value;
|
11027
|
+
message = Object(result)[p];
|
11028
|
+
result = Object(result)[p];
|
11029
|
+
|
11030
|
+
if (message === undefined) {
|
11031
|
+
return defaultValue;
|
11032
|
+
}
|
11033
|
+
}
|
11034
|
+
} catch (err) {
|
11035
|
+
_iterator.e(err);
|
11036
|
+
} finally {
|
11037
|
+
_iterator.f();
|
11038
|
+
}
|
11039
|
+
|
11040
|
+
return message;
|
11041
|
+
}
|
11042
|
+
/**
|
11043
|
+
* 创建一个操作函数
|
11044
|
+
*
|
11045
|
+
* @param locale
|
11046
|
+
* @param localeMap
|
11047
|
+
*/
|
11048
|
+
|
11049
|
+
|
11050
|
+
var createIntl = function createIntl(locale, localeMap) {
|
11051
|
+
return {
|
11052
|
+
getMessage: function getMessage(id, defaultMessage) {
|
11053
|
+
return get$3(localeMap, id, defaultMessage) || defaultMessage;
|
11054
|
+
},
|
11055
|
+
locale: locale
|
11056
|
+
};
|
11057
|
+
};
|
11058
|
+
var zhCNIntl = createIntl('zh_CN', zhCN);
|
11059
|
+
var ConfigContext = /*#__PURE__*/React__default['default'].createContext({
|
11060
|
+
intl: _objectSpread2$1(_objectSpread2$1({}, zhCNIntl), {}, {
|
11061
|
+
locale: 'default'
|
11062
|
+
}),
|
11063
|
+
valueTypeMap: {}
|
11064
|
+
});
|
11065
|
+
var ConfigConsumer = ConfigContext.Consumer,
|
11066
|
+
ConfigProvider = ConfigContext.Provider;
|
11067
|
+
|
11068
|
+
var _excluded$g = ["columns", "extraColumns", "request", "modalFormSearch", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig"],
|
10189
11069
|
_excluded2$3 = ["actionMethod"];
|
10190
11070
|
|
10191
11071
|
var TabelCard = function TabelCard(props, ref) {
|
@@ -10200,7 +11080,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10200
11080
|
onFormChange = props.onFormChange,
|
10201
11081
|
modalConfig = props.modalConfig,
|
10202
11082
|
optionColumnConfig = props.optionColumnConfig,
|
10203
|
-
extraProps = _objectWithoutProperties(props, _excluded$
|
11083
|
+
extraProps = _objectWithoutProperties(props, _excluded$g);
|
10204
11084
|
|
10205
11085
|
var actionRef = React.useRef();
|
10206
11086
|
var formRef = React.useRef(null);
|
@@ -10529,6 +11409,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10529
11409
|
}
|
10530
11410
|
});
|
10531
11411
|
}, [actionRef]);
|
11412
|
+
var values = React.useContext(ConfigContext);
|
10532
11413
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ModalForm$1, _objectSpread2(_objectSpread2({
|
10533
11414
|
ref: formRef,
|
10534
11415
|
title: modalFormConfig.type || '新增',
|
@@ -10583,7 +11464,20 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10583
11464
|
|
10584
11465
|
return true;
|
10585
11466
|
})
|
10586
|
-
})), /*#__PURE__*/React__default['default'].createElement(
|
11467
|
+
})), /*#__PURE__*/React__default['default'].createElement(ConfigContext.Provider, {
|
11468
|
+
value: _objectSpread2(_objectSpread2({}, values), {}, {
|
11469
|
+
valueTypeMap: {
|
11470
|
+
treeSelect: {
|
11471
|
+
render: function render(text) {
|
11472
|
+
return /*#__PURE__*/React__default['default'].createElement("span", null, text);
|
11473
|
+
},
|
11474
|
+
renderFormItem: function renderFormItem(text, props) {
|
11475
|
+
return /*#__PURE__*/React__default['default'].createElement(Index$5, _objectSpread2(_objectSpread2({}, props), props === null || props === void 0 ? void 0 : props.fieldProps));
|
11476
|
+
}
|
11477
|
+
}
|
11478
|
+
}
|
11479
|
+
})
|
11480
|
+
}, /*#__PURE__*/React__default['default'].createElement(ProTable__default['default'], _objectSpread2({
|
10587
11481
|
actionRef: actionRef,
|
10588
11482
|
rowKey: "id",
|
10589
11483
|
bordered: true,
|
@@ -10624,7 +11518,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10624
11518
|
pagination: {
|
10625
11519
|
pageSize: 20
|
10626
11520
|
}
|
10627
|
-
}, extraProps)));
|
11521
|
+
}, extraProps))));
|
10628
11522
|
};
|
10629
11523
|
|
10630
11524
|
var index$1 = /*#__PURE__*/React__default['default'].forwardRef(TabelCard);
|
@@ -10633,6 +11527,7 @@ exports.AutoScroll = Index$9;
|
|
10633
11527
|
exports.Breadcrumb = Index$b;
|
10634
11528
|
exports.Button = WButton;
|
10635
11529
|
exports.Card = Index$c;
|
11530
|
+
exports.Cascader = WCascader;
|
10636
11531
|
exports.Checkbox = Index$4;
|
10637
11532
|
exports.CountUp = Index$8;
|
10638
11533
|
exports.DatePicker = Index$2;
|