ns-base-module 1.0.0
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/LICENSE +21 -0
- package/README.md +20 -0
- package/dist/Button/AntdIconButton.d.ts +11 -0
- package/dist/Button/AntdIconButton.d.ts.map +1 -0
- package/dist/Button/AntdIconButton.js +22 -0
- package/dist/Button/ConfigButton.d.ts +18 -0
- package/dist/Button/ConfigButton.d.ts.map +1 -0
- package/dist/Button/ConfigButton.js +78 -0
- package/dist/Button/index.d.ts +8 -0
- package/dist/Button/index.d.ts.map +1 -0
- package/dist/Button/index.js +19 -0
- package/dist/ClassFilter/index.d.ts +11 -0
- package/dist/ClassFilter/index.d.ts.map +1 -0
- package/dist/ClassFilter/index.js +119 -0
- package/dist/ClassFilter/indexVertical.d.ts +10 -0
- package/dist/ClassFilter/indexVertical.d.ts.map +1 -0
- package/dist/ClassFilter/indexVertical.js +69 -0
- package/dist/ClassFilter/util.d.ts +17 -0
- package/dist/ClassFilter/util.d.ts.map +1 -0
- package/dist/ClassFilter/util.js +135 -0
- package/dist/CopyCol/index.d.ts +4 -0
- package/dist/CopyCol/index.d.ts.map +1 -0
- package/dist/CopyCol/index.js +57 -0
- package/dist/Entry/EntryCriteria.d.ts +17 -0
- package/dist/Entry/EntryCriteria.d.ts.map +1 -0
- package/dist/Entry/EntryCriteria.js +138 -0
- package/dist/Entry/EntryItem.d.ts +34 -0
- package/dist/Entry/EntryItem.d.ts.map +1 -0
- package/dist/Entry/EntryItem.js +757 -0
- package/dist/Entry/components/Checkbox.d.ts +12 -0
- package/dist/Entry/components/Checkbox.d.ts.map +1 -0
- package/dist/Entry/components/Checkbox.js +15 -0
- package/dist/Entry/components/ChooseModalTable.d.ts +15 -0
- package/dist/Entry/components/ChooseModalTable.d.ts.map +1 -0
- package/dist/Entry/components/ChooseModalTable.js +407 -0
- package/dist/Entry/components/Condition.d.ts +9 -0
- package/dist/Entry/components/Condition.d.ts.map +1 -0
- package/dist/Entry/components/Condition.js +30 -0
- package/dist/Entry/components/DatePicker.d.ts +12 -0
- package/dist/Entry/components/DatePicker.d.ts.map +1 -0
- package/dist/Entry/components/DatePicker.js +12 -0
- package/dist/Entry/components/Etable2Modal.d.ts +4 -0
- package/dist/Entry/components/Etable2Modal.d.ts.map +1 -0
- package/dist/Entry/components/Etable2Modal.js +122 -0
- package/dist/Entry/components/Express.d.ts +8 -0
- package/dist/Entry/components/Express.d.ts.map +1 -0
- package/dist/Entry/components/Express.js +30 -0
- package/dist/Entry/components/GroupInput.d.ts +13 -0
- package/dist/Entry/components/GroupInput.d.ts.map +1 -0
- package/dist/Entry/components/GroupInput.js +77 -0
- package/dist/Entry/components/ImageText.d.ts +13 -0
- package/dist/Entry/components/ImageText.d.ts.map +1 -0
- package/dist/Entry/components/ImageText.js +235 -0
- package/dist/Entry/components/Input.d.ts +27 -0
- package/dist/Entry/components/Input.d.ts.map +1 -0
- package/dist/Entry/components/Input.js +86 -0
- package/dist/Entry/components/InputNumber.d.ts +18 -0
- package/dist/Entry/components/InputNumber.d.ts.map +1 -0
- package/dist/Entry/components/InputNumber.js +111 -0
- package/dist/Entry/components/InputNumberRange.d.ts +10 -0
- package/dist/Entry/components/InputNumberRange.d.ts.map +1 -0
- package/dist/Entry/components/InputNumberRange.js +58 -0
- package/dist/Entry/components/ListSelect.d.ts +15 -0
- package/dist/Entry/components/ListSelect.d.ts.map +1 -0
- package/dist/Entry/components/ListSelect.js +110 -0
- package/dist/Entry/components/ObjectSelect.d.ts +14 -0
- package/dist/Entry/components/ObjectSelect.d.ts.map +1 -0
- package/dist/Entry/components/ObjectSelect.js +91 -0
- package/dist/Entry/components/Progress.d.ts +11 -0
- package/dist/Entry/components/Progress.d.ts.map +1 -0
- package/dist/Entry/components/Progress.js +63 -0
- package/dist/Entry/components/Radio.d.ts +15 -0
- package/dist/Entry/components/Radio.d.ts.map +1 -0
- package/dist/Entry/components/Radio.js +17 -0
- package/dist/Entry/components/Select.d.ts +29 -0
- package/dist/Entry/components/Select.d.ts.map +1 -0
- package/dist/Entry/components/Select.js +113 -0
- package/dist/Entry/components/Switch.d.ts +6 -0
- package/dist/Entry/components/Switch.d.ts.map +1 -0
- package/dist/Entry/components/Switch.js +19 -0
- package/dist/Entry/components/TagsDatePicker.d.ts +7 -0
- package/dist/Entry/components/TagsDatePicker.d.ts.map +1 -0
- package/dist/Entry/components/TagsDatePicker.js +229 -0
- package/dist/Entry/components/TimePicker.d.ts +6 -0
- package/dist/Entry/components/TimePicker.d.ts.map +1 -0
- package/dist/Entry/components/TimePicker.js +6 -0
- package/dist/Entry/components/TreeSelect.d.ts +6 -0
- package/dist/Entry/components/TreeSelect.d.ts.map +1 -0
- package/dist/Entry/components/TreeSelect.js +18 -0
- package/dist/Entry/components/index.scss +97 -0
- package/dist/Entry/components/utils.d.ts +1 -0
- package/dist/Entry/components/utils.d.ts.map +1 -0
- package/dist/Entry/components/utils.js +6 -0
- package/dist/Entry/data.d.ts +133 -0
- package/dist/Entry/index.d.ts +54 -0
- package/dist/Entry/index.d.ts.map +1 -0
- package/dist/Entry/index.js +45 -0
- package/dist/FilterPopover/Filter.d.ts +24 -0
- package/dist/FilterPopover/Filter.d.ts.map +1 -0
- package/dist/FilterPopover/Filter.js +370 -0
- package/dist/FilterPopover/FilterClearIcon.d.ts +8 -0
- package/dist/FilterPopover/FilterClearIcon.d.ts.map +1 -0
- package/dist/FilterPopover/FilterClearIcon.js +45 -0
- package/dist/FilterPopover/index.d.ts +20 -0
- package/dist/FilterPopover/index.d.ts.map +1 -0
- package/dist/FilterPopover/index.js +136 -0
- package/dist/Icon/IconCreate.d.ts +11 -0
- package/dist/Icon/IconCreate.d.ts.map +1 -0
- package/dist/Icon/IconCreate.js +22 -0
- package/dist/Icon/index.d.ts +6 -0
- package/dist/Icon/index.d.ts.map +1 -0
- package/dist/Icon/index.js +22 -0
- package/dist/WidgetConfig/index.d.ts +40 -0
- package/dist/WidgetConfig/index.d.ts.map +1 -0
- package/dist/WidgetConfig/index.js +129 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/test/index.d.ts +4 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +7 -0
- package/dist/umd/ns-base-module.min.js +1 -0
- package/dist/utils/cache.d.ts +17 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +127 -0
- package/dist/utils/enum.d.ts +22 -0
- package/dist/utils/enum.d.ts.map +1 -0
- package/dist/utils/enum.js +37 -0
- package/dist/utils/language.d.ts +241 -0
- package/dist/utils/language.d.ts.map +1 -0
- package/dist/utils/language.js +247 -0
- package/dist/utils/request.d.ts +15 -0
- package/dist/utils/request.d.ts.map +1 -0
- package/dist/utils/request.js +180 -0
- package/dist/utils/utils.d.ts +113 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +462 -0
- package/package.json +97 -0
- package/style/basics.scss +671 -0
- package/style/components/ClassFilter.scss +69 -0
- package/style/components/FilterPopover.scss +34 -0
- package/style/components/index.scss +2 -0
- package/style/default.scss +1219 -0
- package/style/index.scss +1 -0
- package/style/mixins/index.scss +28 -0
- package/style/mixins/libs/tint.scss +23 -0
- package/style/variables.scss +684 -0
- package/types/Action.d.ts +43 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Express.d.ts","sourceRoot":"","sources":["Express.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAK/D,UAAU,YAAa,SAAQ,iBAAiB;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAWnC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var _excluded = ["style", "value", "onChange"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import Input from "./Input";
|
|
7
|
+
import { ExpressModal } from '@/components/v2/Modal';
|
|
8
|
+
var TextArea = Input.TextArea;
|
|
9
|
+
var Express = function Express(_ref) {
|
|
10
|
+
var style = _ref.style,
|
|
11
|
+
value = _ref.value,
|
|
12
|
+
_onChange = _ref.onChange,
|
|
13
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
style: style
|
|
16
|
+
}, /*#__PURE__*/React.createElement(TextArea, {
|
|
17
|
+
style: {
|
|
18
|
+
width: 'calc(100% - 50px)',
|
|
19
|
+
marginRight: 5
|
|
20
|
+
},
|
|
21
|
+
value: value,
|
|
22
|
+
onChange: function onChange(e) {
|
|
23
|
+
return _onChange && _onChange(e.target.value);
|
|
24
|
+
}
|
|
25
|
+
}), /*#__PURE__*/React.createElement(ExpressModal, _extends({
|
|
26
|
+
value: value,
|
|
27
|
+
onChange: _onChange
|
|
28
|
+
}, props)));
|
|
29
|
+
};
|
|
30
|
+
export default Express;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface GroupInputProps {
|
|
3
|
+
label1?: string;
|
|
4
|
+
desc1?: string;
|
|
5
|
+
label2?: string;
|
|
6
|
+
desc2?: string;
|
|
7
|
+
value?: Record<string, any>;
|
|
8
|
+
onChange?: (nextValues?: any) => void;
|
|
9
|
+
onSearch?: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare const GroupInput: React.FC<GroupInputProps>;
|
|
12
|
+
export default GroupInput;
|
|
13
|
+
//# sourceMappingURL=GroupInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupInput.d.ts","sourceRoot":"","sources":["GroupInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAMtC,MAAM,WAAW,eAAe;IAE9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5B,QAAQ,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA6DzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import React, { useRef } from 'react';
|
|
8
|
+
import { Input } from 'antd';
|
|
9
|
+
// import { queryAsyncApi } from '@/services/config';
|
|
10
|
+
|
|
11
|
+
var Search = Input.Search;
|
|
12
|
+
var GroupInput = function GroupInput(_ref) {
|
|
13
|
+
var label1 = _ref.label1,
|
|
14
|
+
label2 = _ref.label2,
|
|
15
|
+
desc1 = _ref.desc1,
|
|
16
|
+
desc2 = _ref.desc2,
|
|
17
|
+
value = _ref.value,
|
|
18
|
+
onChange = _ref.onChange,
|
|
19
|
+
onSearch = _ref.onSearch;
|
|
20
|
+
var ref1 = useRef(null);
|
|
21
|
+
var ref2 = useRef(null);
|
|
22
|
+
// const [value, setValue] = useState({ group_input_1: '', group_input_2: '' });
|
|
23
|
+
|
|
24
|
+
var onChangeValue = function onChangeValue(_code, e) {
|
|
25
|
+
onChange === null || onChange === void 0 || onChange(_objectSpread(_objectSpread({}, value), {}, _defineProperty({}, _code, e.target.value)));
|
|
26
|
+
};
|
|
27
|
+
var onAllSearch = function onAllSearch() {
|
|
28
|
+
var _ref1$current, _ref1$current$focus;
|
|
29
|
+
// if (api && onSetResult && code)
|
|
30
|
+
// queryAsyncApi(api, {
|
|
31
|
+
// method: 'post',
|
|
32
|
+
// data: {
|
|
33
|
+
// [code]: value,
|
|
34
|
+
// },
|
|
35
|
+
// }).then((res) => {
|
|
36
|
+
// if (res?.code == 200) {
|
|
37
|
+
// onSetResult(res?.data);
|
|
38
|
+
// onChange?.({ group_input_1: '', group_input_2: '' });
|
|
39
|
+
// return;
|
|
40
|
+
// }
|
|
41
|
+
// message.error(res?.msg);
|
|
42
|
+
// });
|
|
43
|
+
onSearch === null || onSearch === void 0 || onSearch();
|
|
44
|
+
ref1 === null || ref1 === void 0 || (_ref1$current = ref1.current) === null || _ref1$current === void 0 || (_ref1$current$focus = _ref1$current.focus) === null || _ref1$current$focus === void 0 || _ref1$current$focus.call(_ref1$current);
|
|
45
|
+
};
|
|
46
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
style: {
|
|
48
|
+
display: 'inline-block',
|
|
49
|
+
width: '50%'
|
|
50
|
+
}
|
|
51
|
+
}, /*#__PURE__*/React.createElement("span", null, label1), /*#__PURE__*/React.createElement(Search, {
|
|
52
|
+
ref: ref1,
|
|
53
|
+
placeholder: desc1,
|
|
54
|
+
value: value === null || value === void 0 ? void 0 : value.group_input_1,
|
|
55
|
+
onChange: function onChange(e) {
|
|
56
|
+
return onChangeValue('group_input_1', e);
|
|
57
|
+
},
|
|
58
|
+
onSearch: function onSearch() {
|
|
59
|
+
var _ref2$current, _ref2$current$focus;
|
|
60
|
+
return ref2 === null || ref2 === void 0 || (_ref2$current = ref2.current) === null || _ref2$current === void 0 || (_ref2$current$focus = _ref2$current.focus) === null || _ref2$current$focus === void 0 ? void 0 : _ref2$current$focus.call(_ref2$current);
|
|
61
|
+
}
|
|
62
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
style: {
|
|
64
|
+
display: 'inline-block',
|
|
65
|
+
width: '50%'
|
|
66
|
+
}
|
|
67
|
+
}, /*#__PURE__*/React.createElement("span", null, label2), /*#__PURE__*/React.createElement(Search, {
|
|
68
|
+
ref: ref2,
|
|
69
|
+
placeholder: desc2,
|
|
70
|
+
value: value === null || value === void 0 ? void 0 : value.group_input_2,
|
|
71
|
+
onChange: function onChange(e) {
|
|
72
|
+
return onChangeValue('group_input_2', e);
|
|
73
|
+
},
|
|
74
|
+
onSearch: onAllSearch
|
|
75
|
+
})));
|
|
76
|
+
};
|
|
77
|
+
export default GroupInput;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.scss";
|
|
3
|
+
export interface ImageTextProps {
|
|
4
|
+
configs: any[];
|
|
5
|
+
dataSource: any[];
|
|
6
|
+
width?: number;
|
|
7
|
+
colSpan?: number;
|
|
8
|
+
menuCode?: string;
|
|
9
|
+
onReload?: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare const CardWithPage: React.FC<ImageTextProps>;
|
|
12
|
+
export default CardWithPage;
|
|
13
|
+
//# sourceMappingURL=ImageText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageText.d.ts","sourceRoot":"","sources":["ImageText.tsx"],"names":[],"mappings":"AAOA,OAAO,KAA8B,MAAM,OAAO,CAAC;AASnD,OAAO,cAAc,CAAC;AAGtB,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,UAAU,EAAE,GAAG,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAuOD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAkD1C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
|
+
/*
|
|
9
|
+
* @description:
|
|
10
|
+
* @author chenchangfu
|
|
11
|
+
* Copyright (c) 2019, AUTHOR. All rights reserved.
|
|
12
|
+
* AUTHOR PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
|
13
|
+
*/
|
|
14
|
+
import { Form, Tooltip } from "antd";
|
|
15
|
+
import React, { useEffect, useState } from "react";
|
|
16
|
+
import { dynamicPath, formatData } from "../../../../utils/utils";
|
|
17
|
+
|
|
18
|
+
// import { EntryItem, EntryType } from '@/components/v2/Entry';
|
|
19
|
+
|
|
20
|
+
import { InfoCircleOutlined } from "@ant-design/icons";
|
|
21
|
+
import { get, isArray, isString } from "lodash";
|
|
22
|
+
import { EntryItem, EntryType } from "../../Entry";
|
|
23
|
+
import "./index.scss";
|
|
24
|
+
var interpret = require("aexpr");
|
|
25
|
+
var formatDataJsx = function formatDataJsx(field, dataSource_) {
|
|
26
|
+
var _dataSource_$field$co, _field$entryAttr, _field$entryAttr4, _field$entryAttr5;
|
|
27
|
+
var interpretJsx = (_dataSource_$field$co = dataSource_[field.code.toString()]) === null || _dataSource_$field$co === void 0 ? void 0 : _dataSource_$field$co.toString();
|
|
28
|
+
if (((_field$entryAttr = field.entryAttr) === null || _field$entryAttr === void 0 || (_field$entryAttr = _field$entryAttr.dataFormat) === null || _field$entryAttr === void 0 ? void 0 : _field$entryAttr.length) > 0) {
|
|
29
|
+
var _field$entryAttr2;
|
|
30
|
+
var dataLength = field === null || field === void 0 || (_field$entryAttr2 = field.entryAttr) === null || _field$entryAttr2 === void 0 || (_field$entryAttr2 = _field$entryAttr2.dataFormat) === null || _field$entryAttr2 === void 0 ? void 0 : _field$entryAttr2.length;
|
|
31
|
+
for (var ind = 0; ind < dataLength; ind++) {
|
|
32
|
+
var _field$entryAttr3;
|
|
33
|
+
var element = field === null || field === void 0 || (_field$entryAttr3 = field.entryAttr) === null || _field$entryAttr3 === void 0 ? void 0 : _field$entryAttr3.dataFormat[ind];
|
|
34
|
+
if (isString(element.compute) && interpret(element.compute, dataSource_ || {})) {
|
|
35
|
+
var _dataSource_$field$co2;
|
|
36
|
+
var _ref = element.style || {},
|
|
37
|
+
bgColor = _ref.bgColor,
|
|
38
|
+
color = _ref.color,
|
|
39
|
+
fontWeight = _ref.fontWeight;
|
|
40
|
+
// console.log('bgColor, color, fontWeight', bgColor, color, fontWeight);
|
|
41
|
+
interpretJsx = /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
style: {
|
|
43
|
+
backgroundColor: bgColor,
|
|
44
|
+
color: color,
|
|
45
|
+
fontWeight: fontWeight
|
|
46
|
+
}
|
|
47
|
+
}, formatData((_dataSource_$field$co2 = dataSource_[field.code.toString()]) === null || _dataSource_$field$co2 === void 0 ? void 0 : _dataSource_$field$co2.toString(), element));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if ((!((_field$entryAttr4 = field.entryAttr) !== null && _field$entryAttr4 !== void 0 && _field$entryAttr4.dataFormat) || ((_field$entryAttr5 = field.entryAttr) === null || _field$entryAttr5 === void 0 || (_field$entryAttr5 = _field$entryAttr5.dataFormat) === null || _field$entryAttr5 === void 0 ? void 0 : _field$entryAttr5.lenght) < 1) && field.dataFormat) {
|
|
52
|
+
interpretJsx = formatData(dataSource_[field.code.toString()], field.dataFormat);
|
|
53
|
+
}
|
|
54
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "ns-form-item"
|
|
56
|
+
}, interpretJsx);
|
|
57
|
+
};
|
|
58
|
+
var Open = function Open(params, record) {
|
|
59
|
+
window.open(dynamicPath(params, record || {}));
|
|
60
|
+
};
|
|
61
|
+
var Jump = function Jump(params, record) {
|
|
62
|
+
history.push(dynamicPath(params, record || {}));
|
|
63
|
+
};
|
|
64
|
+
var detailRender = function detailRender(config, dataSource, colSpan) {
|
|
65
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "right-wrapper"
|
|
67
|
+
}, config === null || config === void 0 ? void 0 : config.map(function (col) {
|
|
68
|
+
var _col$frontProperties, _col$frontProperties2, _col$frontProperties3, _col$frontProperties4, _col$frontProperties5, _col$frontProperties6, _col$frontProperties7, _col$frontProperties8, _col$frontProperties9, _col$frontProperties10, _col$renderEntryAttr;
|
|
69
|
+
return col.renderEntryType != "Image" &&
|
|
70
|
+
/*#__PURE__*/
|
|
71
|
+
// <Col span={24 / colSpan} key={col.code.toString()}>
|
|
72
|
+
React.createElement(Form.Item, {
|
|
73
|
+
// style={{ display: 'inline-block', width: 'calc(100% - 20px)' }}
|
|
74
|
+
label: (col.label || col.description) && /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
style: {
|
|
76
|
+
textAlign: col === null || col === void 0 || (_col$frontProperties = col.frontProperties) === null || _col$frontProperties === void 0 || (_col$frontProperties = _col$frontProperties.label) === null || _col$frontProperties === void 0 ? void 0 : _col$frontProperties.textAlign,
|
|
77
|
+
width: "100%",
|
|
78
|
+
color: "#red"
|
|
79
|
+
}
|
|
80
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
81
|
+
style: {
|
|
82
|
+
color: "#8C8C8C" || (col === null || col === void 0 || (_col$frontProperties2 = col.frontProperties) === null || _col$frontProperties2 === void 0 || (_col$frontProperties2 = _col$frontProperties2.label) === null || _col$frontProperties2 === void 0 ? void 0 : _col$frontProperties2.color),
|
|
83
|
+
fontSize: col === null || col === void 0 || (_col$frontProperties3 = col.frontProperties) === null || _col$frontProperties3 === void 0 || (_col$frontProperties3 = _col$frontProperties3.label) === null || _col$frontProperties3 === void 0 ? void 0 : _col$frontProperties3.fontSize,
|
|
84
|
+
fontWeight: col !== null && col !== void 0 && (_col$frontProperties4 = col.frontProperties) !== null && _col$frontProperties4 !== void 0 && (_col$frontProperties4 = _col$frontProperties4.label) !== null && _col$frontProperties4 !== void 0 && _col$frontProperties4.fontWeight ? 700 : undefined,
|
|
85
|
+
fontStyle: col !== null && col !== void 0 && (_col$frontProperties5 = col.frontProperties) !== null && _col$frontProperties5 !== void 0 && (_col$frontProperties5 = _col$frontProperties5.label) !== null && _col$frontProperties5 !== void 0 && _col$frontProperties5.fontStyle ? "italic" : undefined
|
|
86
|
+
}
|
|
87
|
+
}, col.label), col.description && /*#__PURE__*/React.createElement(Tooltip, {
|
|
88
|
+
placement: "topLeft",
|
|
89
|
+
title: col.description
|
|
90
|
+
}, /*#__PURE__*/React.createElement(InfoCircleOutlined, {
|
|
91
|
+
className: "proTableDesc",
|
|
92
|
+
style: {
|
|
93
|
+
marginLeft: 4,
|
|
94
|
+
color: "#888"
|
|
95
|
+
}
|
|
96
|
+
}))),
|
|
97
|
+
valuePropName: col.entryType == EntryType.Switch || col.entryType == EntryType.Checkbox ? "checked" : "value"
|
|
98
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
style: {
|
|
100
|
+
textAlign: col === null || col === void 0 || (_col$frontProperties6 = col.frontProperties) === null || _col$frontProperties6 === void 0 || (_col$frontProperties6 = _col$frontProperties6.value) === null || _col$frontProperties6 === void 0 ? void 0 : _col$frontProperties6.textAlign,
|
|
101
|
+
color: col === null || col === void 0 || (_col$frontProperties7 = col.frontProperties) === null || _col$frontProperties7 === void 0 || (_col$frontProperties7 = _col$frontProperties7.value) === null || _col$frontProperties7 === void 0 ? void 0 : _col$frontProperties7.color,
|
|
102
|
+
fontSize: col === null || col === void 0 || (_col$frontProperties8 = col.frontProperties) === null || _col$frontProperties8 === void 0 || (_col$frontProperties8 = _col$frontProperties8.value) === null || _col$frontProperties8 === void 0 ? void 0 : _col$frontProperties8.fontSize,
|
|
103
|
+
fontWeight: col !== null && col !== void 0 && (_col$frontProperties9 = col.frontProperties) !== null && _col$frontProperties9 !== void 0 && (_col$frontProperties9 = _col$frontProperties9.value) !== null && _col$frontProperties9 !== void 0 && _col$frontProperties9.fontWeight ? 700 : undefined,
|
|
104
|
+
fontStyle: col !== null && col !== void 0 && (_col$frontProperties10 = col.frontProperties) !== null && _col$frontProperties10 !== void 0 && (_col$frontProperties10 = _col$frontProperties10.value) !== null && _col$frontProperties10 !== void 0 && _col$frontProperties10.fontStyle ? "italic" : undefined,
|
|
105
|
+
width: "100%",
|
|
106
|
+
overflow: "auto"
|
|
107
|
+
}
|
|
108
|
+
}, [EntryType.Switch, EntryType.SwitchRead,
|
|
109
|
+
// EntryType.Image,
|
|
110
|
+
EntryType.EditorPreview, EntryType.JsonRead, EntryType.TimelineModal, EntryType.Link, EntryType.Tag, EntryType.Tags, EntryType.Tree, EntryType.Steps, EntryType.QRCode, EntryType.Barcode, EntryType.OpenBrowser, EntryType.FileUpload, EntryType.ColorPicker].includes(col.renderEntryType) ? /*#__PURE__*/React.createElement(EntryItem, _extends({
|
|
111
|
+
type: col.renderEntryType
|
|
112
|
+
// disabled={true}
|
|
113
|
+
,
|
|
114
|
+
width: col.width,
|
|
115
|
+
value: dataSource[col.code.toString()]
|
|
116
|
+
}, col.renderEntryAttr || {}, {
|
|
117
|
+
params: (_col$renderEntryAttr = col.renderEntryAttr) !== null && _col$renderEntryAttr !== void 0 && _col$renderEntryAttr.relationField ? dataSource[col.renderEntryAttr.relationField] : undefined
|
|
118
|
+
// menuCode={menuCode}
|
|
119
|
+
// onJump={onJump}
|
|
120
|
+
// onSelectSubmit={(nextValues: any) =>
|
|
121
|
+
// onSelectSubmit(col.entryAttr?.chooseFields, nextValues)
|
|
122
|
+
// }
|
|
123
|
+
// onComputeExp={() => {
|
|
124
|
+
// onComputeExp(col, isEmpty(formValues) ? dataSource : formValues, form);
|
|
125
|
+
// }}
|
|
126
|
+
,
|
|
127
|
+
dataFormat: col.dataFormat
|
|
128
|
+
// classNmae={`formValues[col.code + 'Enum']formValues[col.code + 'Enum']+ ${formValues}+${col.code}`}
|
|
129
|
+
|
|
130
|
+
// valueEnum={
|
|
131
|
+
// formValues && formValues[col.code + 'Enum']
|
|
132
|
+
// ? formValues[col.code + 'Enum']
|
|
133
|
+
// : col.dictItems
|
|
134
|
+
// }
|
|
135
|
+
,
|
|
136
|
+
onJump: function onJump() {
|
|
137
|
+
var _col$entryAttr;
|
|
138
|
+
return Jump === null || Jump === void 0 ? void 0 : Jump({
|
|
139
|
+
config: {
|
|
140
|
+
path: col === null || col === void 0 || (_col$entryAttr = col.entryAttr) === null || _col$entryAttr === void 0 ? void 0 : _col$entryAttr.path
|
|
141
|
+
}
|
|
142
|
+
}, dataSource);
|
|
143
|
+
},
|
|
144
|
+
onOpen: function onOpen() {
|
|
145
|
+
var _col$entryAttr2;
|
|
146
|
+
var _path = (col === null || col === void 0 || (_col$entryAttr2 = col.entryAttr) === null || _col$entryAttr2 === void 0 ? void 0 : _col$entryAttr2.path) || get(col, "renderEntryAttr.path", "");
|
|
147
|
+
Open === null || Open === void 0 || Open({
|
|
148
|
+
config: {
|
|
149
|
+
path: _path
|
|
150
|
+
}
|
|
151
|
+
}, dataSource);
|
|
152
|
+
},
|
|
153
|
+
entryAttr: col.entryAttr,
|
|
154
|
+
disabled: (col === null || col === void 0 ? void 0 : col.entryType) == "ColorPicker" ? true : undefined,
|
|
155
|
+
format: "rgb"
|
|
156
|
+
})) : formatDataJsx(col, dataSource)));
|
|
157
|
+
}
|
|
158
|
+
// </Col>
|
|
159
|
+
))));
|
|
160
|
+
};
|
|
161
|
+
var verticalLayout = function verticalLayout(colSpan) {
|
|
162
|
+
var md = 24 / colSpan;
|
|
163
|
+
return {
|
|
164
|
+
xs: 24,
|
|
165
|
+
sm: 12,
|
|
166
|
+
md: md,
|
|
167
|
+
lg: md,
|
|
168
|
+
xl: md,
|
|
169
|
+
xxl: md
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
var horizontalLayout = function horizontalLayout(colSpan) {
|
|
173
|
+
var md = 24 / colSpan;
|
|
174
|
+
return {
|
|
175
|
+
xs: 24,
|
|
176
|
+
sm: 12,
|
|
177
|
+
md: md,
|
|
178
|
+
lg: md,
|
|
179
|
+
xl: md,
|
|
180
|
+
xxl: md
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
var CardWithPage = function CardWithPage(_ref2) {
|
|
184
|
+
var configs = _ref2.configs,
|
|
185
|
+
_ref2$dataSource = _ref2.dataSource,
|
|
186
|
+
dataSource = _ref2$dataSource === void 0 ? [] : _ref2$dataSource,
|
|
187
|
+
width = _ref2.width,
|
|
188
|
+
_ref2$colSpan = _ref2.colSpan,
|
|
189
|
+
colSpan = _ref2$colSpan === void 0 ? 3 : _ref2$colSpan,
|
|
190
|
+
onReload = _ref2.onReload;
|
|
191
|
+
// console.log('dataSourcedataSource', dataSource);
|
|
192
|
+
var _useState = useState(),
|
|
193
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
194
|
+
imagesConfig = _useState2[0],
|
|
195
|
+
setImagesConfig = _useState2[1];
|
|
196
|
+
useEffect(function () {
|
|
197
|
+
for (var i = 0; i <= configs.length; i++) {
|
|
198
|
+
var _configs$i;
|
|
199
|
+
if (((_configs$i = configs[i]) === null || _configs$i === void 0 ? void 0 : _configs$i.entryType) == "Image") {
|
|
200
|
+
console.log("configs[i]", configs[i]);
|
|
201
|
+
setImagesConfig(configs[i]);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}, [JSON.stringify(configs)]);
|
|
206
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
207
|
+
className: "image-text"
|
|
208
|
+
}, isArray(dataSource) && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (d) {
|
|
209
|
+
return (
|
|
210
|
+
/*#__PURE__*/
|
|
211
|
+
// <Col
|
|
212
|
+
// {...(configs.layout == 'vertical'
|
|
213
|
+
// ? verticalLayout(colSpan)
|
|
214
|
+
// : horizontalLayout(colSpan))}
|
|
215
|
+
// onClick={() => onJump(d)}
|
|
216
|
+
// >
|
|
217
|
+
React.createElement("div", {
|
|
218
|
+
className: "card-list-item",
|
|
219
|
+
style: {
|
|
220
|
+
width: width + "px"
|
|
221
|
+
}
|
|
222
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
223
|
+
className: "item-img"
|
|
224
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
225
|
+
src: "".concat(d[imagesConfig === null || imagesConfig === void 0 ? void 0 : imagesConfig.code])
|
|
226
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
227
|
+
className: "item-desc"
|
|
228
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
229
|
+
className: "item-body"
|
|
230
|
+
}, detailRender(configs, d, colSpan))))
|
|
231
|
+
// </Col>
|
|
232
|
+
);
|
|
233
|
+
}))));
|
|
234
|
+
};
|
|
235
|
+
export default CardWithPage;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { InputProps } from 'antd';
|
|
3
|
+
import type { TextAreaProps, SearchProps, PasswordProps } from 'antd/lib/input';
|
|
4
|
+
interface InputCellType extends InputProps {
|
|
5
|
+
defaultValue: string;
|
|
6
|
+
onBlur: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
}
|
|
8
|
+
declare type TextAreaCellType = {
|
|
9
|
+
defaultValue: string;
|
|
10
|
+
onBlur: (e: any) => void;
|
|
11
|
+
};
|
|
12
|
+
declare const InputWrapper: {
|
|
13
|
+
(props: InputProps): React.JSX.Element;
|
|
14
|
+
TextArea: (props: TextAreaProps) => React.JSX.Element;
|
|
15
|
+
Search: (props: SearchProps) => React.JSX.Element;
|
|
16
|
+
Password: (props: PasswordProps) => React.JSX.Element;
|
|
17
|
+
InputBlur: React.FC<InputCellType>;
|
|
18
|
+
TextAreaBlur: React.FC<TextAreaCellType>;
|
|
19
|
+
};
|
|
20
|
+
declare const TextArea: (props: TextAreaProps) => React.JSX.Element;
|
|
21
|
+
declare const Search: (props: SearchProps) => React.JSX.Element;
|
|
22
|
+
declare const Password: (props: PasswordProps) => React.JSX.Element;
|
|
23
|
+
declare const InputBlur: React.FC<InputCellType>;
|
|
24
|
+
export default InputWrapper;
|
|
25
|
+
export { TextArea, Search, Password, InputBlur };
|
|
26
|
+
export type { InputProps, TextAreaProps };
|
|
27
|
+
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEhF,UAAU,aAAc,SAAQ,UAAU;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC1D;AAED,aAAK,gBAAgB,GAAG;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAC1B,CAAC;AAMF,QAAA,MAAM,YAAY;YAAW,UAAU;sBAId,aAAa;oBAIf,WAAW;sBAIT,aAAa;;;CAVrC,CAAC;AAEF,QAAA,MAAM,QAAQ,UAAW,aAAa,sBAErC,CAAC;AAEF,QAAA,MAAM,MAAM,UAAW,WAAW,sBAEjC,CAAC;AAEF,QAAA,MAAM,QAAQ,UAAW,aAAa,sBAErC,CAAC;AAEF,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAYtC,CAAC;AAsBF,eAAe,YAAY,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
var _excluded = ["defaultValue", "onBlur"],
|
|
2
|
+
_excluded2 = ["defaultValue", "onBlur"];
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
12
|
+
import React, { useState, useEffect } from 'react';
|
|
13
|
+
import { Input } from 'antd';
|
|
14
|
+
var TextAreaWrapper = Input.TextArea;
|
|
15
|
+
var SearchWrapper = Input.Search;
|
|
16
|
+
var PasswordWrapper = Input.Password;
|
|
17
|
+
var InputWrapper = function InputWrapper(props) {
|
|
18
|
+
var _props$className;
|
|
19
|
+
return /*#__PURE__*/React.createElement(Input, _extends({
|
|
20
|
+
allowClear: true
|
|
21
|
+
}, props, {
|
|
22
|
+
className: "disabled-input ".concat((_props$className = props === null || props === void 0 ? void 0 : props.className) !== null && _props$className !== void 0 ? _props$className : '')
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
var TextArea = function TextArea(props) {
|
|
26
|
+
return /*#__PURE__*/React.createElement(TextAreaWrapper, props);
|
|
27
|
+
};
|
|
28
|
+
var Search = function Search(props) {
|
|
29
|
+
return /*#__PURE__*/React.createElement(SearchWrapper, props);
|
|
30
|
+
};
|
|
31
|
+
var Password = function Password(props) {
|
|
32
|
+
return /*#__PURE__*/React.createElement(PasswordWrapper, props);
|
|
33
|
+
};
|
|
34
|
+
var InputBlur = function InputBlur(_ref) {
|
|
35
|
+
var defaultValue = _ref.defaultValue,
|
|
36
|
+
onBlur = _ref.onBlur,
|
|
37
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
38
|
+
var _useState = useState(undefined),
|
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
+
value = _useState2[0],
|
|
41
|
+
setValue = _useState2[1];
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
if (defaultValue) {
|
|
44
|
+
setValue(defaultValue);
|
|
45
|
+
}
|
|
46
|
+
}, [defaultValue]);
|
|
47
|
+
var onChange = function onChange(e) {
|
|
48
|
+
var _e$target;
|
|
49
|
+
setValue(e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value);
|
|
50
|
+
};
|
|
51
|
+
return /*#__PURE__*/React.createElement(InputWrapper, _extends({}, props, {
|
|
52
|
+
value: value,
|
|
53
|
+
onChange: onChange,
|
|
54
|
+
onBlur: onBlur
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
var TextAreaBlur = function TextAreaBlur(_ref2) {
|
|
58
|
+
var defaultValue = _ref2.defaultValue,
|
|
59
|
+
onBlur = _ref2.onBlur,
|
|
60
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
61
|
+
var _useState3 = useState(undefined),
|
|
62
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
63
|
+
value = _useState4[0],
|
|
64
|
+
setValue = _useState4[1];
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
if (defaultValue) {
|
|
67
|
+
setValue(defaultValue);
|
|
68
|
+
}
|
|
69
|
+
}, [defaultValue]);
|
|
70
|
+
var onChange = function onChange(e) {
|
|
71
|
+
var _e$target2;
|
|
72
|
+
setValue(e === null || e === void 0 || (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value);
|
|
73
|
+
};
|
|
74
|
+
return /*#__PURE__*/React.createElement(TextArea, _extends({}, props, {
|
|
75
|
+
value: value,
|
|
76
|
+
onChange: onChange,
|
|
77
|
+
onBlur: onBlur
|
|
78
|
+
}));
|
|
79
|
+
};
|
|
80
|
+
InputWrapper.TextArea = TextArea;
|
|
81
|
+
InputWrapper.Search = Search;
|
|
82
|
+
InputWrapper.Password = Password;
|
|
83
|
+
InputWrapper.InputBlur = InputBlur;
|
|
84
|
+
InputWrapper.TextAreaBlur = TextAreaBlur;
|
|
85
|
+
export default InputWrapper;
|
|
86
|
+
export { TextArea, Search, Password, InputBlur };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { InputNumberProps } from 'antd';
|
|
3
|
+
interface InputCellType extends Omit<InputNumberProps, 'onBlur'> {
|
|
4
|
+
defaultValue: number;
|
|
5
|
+
onBlur: (e: string | number | null) => void;
|
|
6
|
+
roundSave: string;
|
|
7
|
+
}
|
|
8
|
+
declare const InputNumberWrapper: {
|
|
9
|
+
(props: InputNumberProps<import("rc-input-number").ValueType> & {
|
|
10
|
+
onComputeExp: ((e: string | number | null) => void) | undefined;
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
InputNumberBlur: React.FC<InputCellType>;
|
|
13
|
+
};
|
|
14
|
+
declare const InputNumberBlur: React.FC<InputCellType>;
|
|
15
|
+
export default InputNumberWrapper;
|
|
16
|
+
export { InputNumberBlur };
|
|
17
|
+
export type { InputNumberProps };
|
|
18
|
+
//# sourceMappingURL=InputNumber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputNumber.d.ts","sourceRoot":"","sources":["InputNumber.tsx"],"names":[],"mappings":"AAYA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AAG7C,UAAU,aAAc,SAAQ,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC;IAC9D,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,kBAAkB;;2BAED,MAAM,GAAG,MAAM,GAAG,IAAI,KAAK,IAAI;;;CAYrD,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAiE5C,CAAC;AAIF,eAAe,kBAAkB,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
var _excluded = ["defaultValue", "onBlur"];
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11
|
+
/*
|
|
12
|
+
* @description:
|
|
13
|
+
* @author chenchangfu
|
|
14
|
+
* Copyright (c) 2019, AUTHOR. All rights reserved.
|
|
15
|
+
* AUTHOR PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
|
16
|
+
*/
|
|
17
|
+
/*
|
|
18
|
+
* @description:
|
|
19
|
+
* @author chenchangfu
|
|
20
|
+
* Copyright (c) 2019, AUTHOR. All rights reserved.
|
|
21
|
+
* AUTHOR PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
|
22
|
+
*/
|
|
23
|
+
import React, { useState, useEffect } from 'react';
|
|
24
|
+
import { InputNumber } from 'antd';
|
|
25
|
+
var InputNumberWrapper = function InputNumberWrapper(props) {
|
|
26
|
+
var onBlur = function onBlur(value) {
|
|
27
|
+
if (props.onBlur) {
|
|
28
|
+
props.onBlur(value);
|
|
29
|
+
}
|
|
30
|
+
if (props.onComputeExp) {
|
|
31
|
+
props.onComputeExp(value);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return /*#__PURE__*/React.createElement(InputNumber, _extends({
|
|
35
|
+
controls: false
|
|
36
|
+
}, props, {
|
|
37
|
+
onBlur: onBlur
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
var InputNumberBlur = function InputNumberBlur(_ref) {
|
|
41
|
+
var defaultValue = _ref.defaultValue,
|
|
42
|
+
onBlur = _ref.onBlur,
|
|
43
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
44
|
+
// console.log(props);
|
|
45
|
+
var _useState = useState(undefined),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
value = _useState2[0],
|
|
48
|
+
setValue = _useState2[1];
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
setValue(defaultValue);
|
|
51
|
+
}, [defaultValue]);
|
|
52
|
+
var onChange = function onChange(e) {
|
|
53
|
+
setValue(e);
|
|
54
|
+
};
|
|
55
|
+
var onBlurHandle = function onBlurHandle(e) {
|
|
56
|
+
var _e$target, _e$target2, _e$target$value, _e$target3;
|
|
57
|
+
if ((e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value) == '' || !(e !== null && e !== void 0 && (_e$target2 = e.target) !== null && _e$target2 !== void 0 && _e$target2.value)) {
|
|
58
|
+
onBlur === null || onBlur === void 0 || onBlur(null);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
// let patrn = /^\d+(\.\d+)?$/;
|
|
62
|
+
// let patrn = new RegExp('[^\\d{1,}\\.?\\d{1,' + props.precision + '}]', 'g');
|
|
63
|
+
// console.log(Number(e.target.value.replace(/[^\d\.?\d{1,}]/g, '')).toFixed(3), props.precision);
|
|
64
|
+
var abs = Number((_e$target$value = e === null || e === void 0 || (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.value) !== null && _e$target$value !== void 0 ? _e$target$value : 0) < 0 ? -1 : 1;
|
|
65
|
+
var val = Number(e.target.value.replace(/[^\d\.?\d{1,}]/g, '')) * abs;
|
|
66
|
+
if (e.target.value.toString()) {
|
|
67
|
+
// console.log(val, abs, 'val');
|
|
68
|
+
// console.log(e.target.value, 'e.target.value ');
|
|
69
|
+
|
|
70
|
+
// console.log(e.target.value, props?.min);
|
|
71
|
+
if (props !== null && props !== void 0 && props.min && val < (props === null || props === void 0 ? void 0 : props.min)) {
|
|
72
|
+
val = props.min;
|
|
73
|
+
} else if (props.max && val > (props === null || props === void 0 ? void 0 : props.max)) {
|
|
74
|
+
val = props.max;
|
|
75
|
+
} else {
|
|
76
|
+
if (props.roundSave) {
|
|
77
|
+
switch (props.roundSave) {
|
|
78
|
+
case 'up':
|
|
79
|
+
val = Math.ceil(val);
|
|
80
|
+
break;
|
|
81
|
+
case 'down':
|
|
82
|
+
val = Math.floor(val);
|
|
83
|
+
break;
|
|
84
|
+
case 'halfUp':
|
|
85
|
+
val = Number(val.toFixed(props.precision));
|
|
86
|
+
break;
|
|
87
|
+
default:
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
val = Number(val.toFixed(props.precision));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (!val && val != 0) {
|
|
96
|
+
onBlur === null || onBlur === void 0 || onBlur(null);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
onBlur === null || onBlur === void 0 || onBlur(val);
|
|
100
|
+
};
|
|
101
|
+
// console.log(defaultValue, value, props);
|
|
102
|
+
return /*#__PURE__*/React.createElement(InputNumberWrapper, _extends({}, props, {
|
|
103
|
+
value: value,
|
|
104
|
+
onChange: onChange,
|
|
105
|
+
onBlur: onBlurHandle,
|
|
106
|
+
onPressEnter: onBlurHandle
|
|
107
|
+
}));
|
|
108
|
+
};
|
|
109
|
+
InputNumberWrapper.InputNumberBlur = InputNumberBlur;
|
|
110
|
+
export default InputNumberWrapper;
|
|
111
|
+
export { InputNumberBlur };
|