vap1 0.3.6 → 0.3.8
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/components/Box/SelectBar.d.ts +4 -0
- package/components/Box/SelectBar.js +1 -1
- package/components/SearchBar/ByField.d.ts +6 -3
- package/components/SearchBar/ByField.js +5 -5
- package/components/SearchBar/ByKeyword.js +7 -1
- package/components/UForm/_input.js +2 -2
- package/components/Upload/UploadImage.d.ts +1 -0
- package/components/Upload/UploadImage.js +6 -5
- package/components/_adapt/Tabs.d.ts +15 -0
- package/components/_adapt/Tabs.js +38 -3
- package/components/_common/CountUp.d.ts +3 -1
- package/components/_common/CountUp.js +5 -1
- package/deps/app-audit/ESTable.js +1 -0
- package/deps/app-audit/LookUp.d.ts +27 -0
- package/deps/app-audit/LookUp.js +324 -0
- package/deps/app-audit/index.d.ts +1 -0
- package/deps/app-audit/index.js +7 -0
- package/deps/app-data/Const.d.ts +6 -0
- package/deps/app-data/Const.js +10 -0
- package/deps/app-data/SourceTable.js +137 -0
- package/deps/{apis → app-data}/useSource.js +18 -8
- package/deps/editor/Article.d.ts +20 -0
- package/deps/editor/Article.js +53 -0
- package/deps/editor/Editor.d.ts +43 -0
- package/deps/editor/Editor.js +110 -0
- package/deps/editor/EditorModal.d.ts +32 -0
- package/deps/editor/EditorModal.js +89 -0
- package/deps/editor/index.d.ts +4 -0
- package/deps/editor/index.js +9 -0
- package/deps/{registerEditor.js → editor/registerEditor.js} +4 -4
- package/deps/editor/support/buttons/ImageButton.d.ts +5 -0
- package/deps/editor/support/buttons/ImageButton.js +138 -0
- package/deps/editor/support/buttons/index.d.ts +1 -0
- package/deps/editor/support/buttons/index.js +5 -0
- package/deps/editor/support/element/ImageElement.d.ts +3 -0
- package/deps/editor/support/element/ImageElement.js +228 -0
- package/deps/editor/support/element/TableElement.d.ts +0 -0
- package/deps/editor/support/element/TableElement.js +0 -0
- package/deps/editor/support/element/VideoElement.d.ts +0 -0
- package/deps/editor/support/element/VideoElement.js +0 -0
- package/deps/editor/support/element/_Base.d.ts +9 -0
- package/deps/editor/support/element/_Base.js +9 -0
- package/deps/editor/support/element/_Element.d.ts +2 -0
- package/deps/{_editor/base/Element.js → editor/support/element/_Element.js} +9 -6
- package/deps/editor/support/element/_Leaf.d.ts +3 -0
- package/deps/{_editor/base/Leaf.js → editor/support/element/_Leaf.js} +2 -2
- package/deps/editor/support/index.d.ts +4 -0
- package/deps/editor/support/index.js +89 -0
- package/deps/{_editor → editor}/tools/Button.d.ts +1 -1
- package/deps/{_editor → editor}/tools/Button.js +7 -3
- package/deps/{_editor → editor}/tools/ToolBar.d.ts +1 -1
- package/deps/{_editor → editor}/tools/ToolBar.js +1 -1
- package/deps/{_editor → editor}/tools/_BlockButton.d.ts +1 -1
- package/deps/{_editor → editor}/tools/_BlockButton.js +3 -3
- package/deps/{_editor → editor}/tools/_InsertButton.d.ts +1 -2
- package/deps/editor/tools/_InsertButton.js +36 -0
- package/deps/{_editor → editor}/tools/_MarkButton.d.ts +1 -1
- package/deps/{_editor → editor}/tools/_MarkButton.js +4 -4
- package/deps/{_editor → editor}/tools/_TxtButton.d.ts +1 -1
- package/deps/{_editor → editor}/tools/_TxtButton.js +37 -50
- package/deps/{_editor/base → editor}/types.d.ts +47 -56
- package/deps/editor/types.js +2 -0
- package/deps/editor/utils/ParseHtml.d.ts +0 -0
- package/deps/editor/utils/index.d.ts +7 -0
- package/deps/editor/utils/index.js +60 -0
- package/hooks/_list.d.ts +2 -1
- package/hooks/useAjaxQuery.d.ts +7 -3
- package/hooks/useAjaxQuery.js +46 -25
- package/hooks/useApiBase.js +25 -26
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/uform/FormViewer.d.ts +6 -6
- package/uform/hooks/useEditor.js +0 -1
- package/utils/Format.d.ts +8 -1
- package/utils/Format.js +10 -2
- package/utils/Global.d.ts +4 -0
- package/utils/Global.js +1 -0
- package/utils/TipUtil.d.ts +4 -0
- package/utils/TipUtil.js +6 -4
- package/deps/_editor/advance/_Image.d.ts +0 -2
- package/deps/_editor/advance/_Image.js +0 -102
- package/deps/_editor/base/Element.d.ts +0 -5
- package/deps/_editor/base/Leaf.d.ts +0 -3
- package/deps/_editor/base/Support.d.ts +0 -2
- package/deps/_editor/base/Support.js +0 -78
- package/deps/_editor/base/types.js +0 -10
- package/deps/_editor/tools/_InsertButton.js +0 -69
- package/deps/api-audit.d.ts +0 -1
- package/deps/api-audit.js +0 -6
- package/deps/api-data.js +0 -1
- package/deps/editor.d.ts +0 -34
- package/deps/editor.js +0 -137
- /package/deps/{_editor/advance/_Audio.d.ts → app-audit/ESTable.d.ts} +0 -0
- /package/deps/{_editor/advance/_Table.d.ts → app-data/SourceTable.d.ts} +0 -0
- /package/deps/{apis → app-data}/useSource.d.ts +0 -0
- /package/deps/{_editor → editor}/i18n.d.ts +0 -0
- /package/deps/{_editor → editor}/i18n.js +0 -0
- /package/deps/{registerEditor.d.ts → editor/registerEditor.d.ts} +0 -0
- /package/deps/{_editor/advance/_Video.d.ts → editor/support/buttons/AudioButton.d.ts} +0 -0
- /package/deps/{_editor/advance/_Audio.js → editor/support/buttons/AudioButton.js} +0 -0
- /package/deps/{_editor/utils/ParseHtml.d.ts → editor/support/buttons/TableButton.d.ts} +0 -0
- /package/deps/{_editor/advance/_Table.js → editor/support/buttons/TableButton.js} +0 -0
- /package/deps/{api-data.d.ts → editor/support/buttons/VideoButton.d.ts} +0 -0
- /package/deps/{_editor/advance/_Video.js → editor/support/buttons/VideoButton.js} +0 -0
- /package/deps/{_editor → editor}/utils/ParseHtml.js +0 -0
|
@@ -64,7 +64,7 @@ var _i18n_1 = require("../_i18n");
|
|
|
64
64
|
var Icon_1 = require("../_adapt/Icon");
|
|
65
65
|
exports.SelectBar = (0, react_1.forwardRef)(function (props, ref) {
|
|
66
66
|
var _a = __read((0, react_1.useState)(null), 2), keyword = _a[0], setKeyword = _a[1];
|
|
67
|
-
var _b = __read((0, hooks_1.useToggle)(false), 2), collapsed = _b[0], setCollapsed = _b[1];
|
|
67
|
+
var _b = __read((0, hooks_1.useToggle)(props.defaultCollapse || false), 2), collapsed = _b[0], setCollapsed = _b[1];
|
|
68
68
|
// const setKeyword = _.debounce(_setKeyword, 100);
|
|
69
69
|
var component = (0, _register_1.getSelectBar)(props.type);
|
|
70
70
|
(0, react_1.useLayoutEffect)(function () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { SearchBarByFieldProps } from './index';
|
|
2
|
+
import type { FC, RefAttributes, ForwardRefExoticComponent } from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* 仅内容使用
|
|
5
5
|
*/
|
|
@@ -17,6 +17,9 @@ type InnerSearchBarByFieldProps = SearchBarByFieldProps & {
|
|
|
17
17
|
*/
|
|
18
18
|
__innnerPopup?: boolean;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
21
|
-
|
|
20
|
+
export type InnerSearchBarByFieldRef = {
|
|
21
|
+
clear: () => void;
|
|
22
|
+
};
|
|
23
|
+
export declare const InnerSearchBarByField: ForwardRefExoticComponent<InnerSearchBarByFieldProps & RefAttributes<InnerSearchBarByFieldRef>>;
|
|
24
|
+
export declare const SearchBarByField: FC<SearchBarByFieldProps>;
|
|
22
25
|
export {};
|
|
@@ -63,11 +63,11 @@ var utils_1 = require("../../utils");
|
|
|
63
63
|
var _i18n_1 = require("../_i18n");
|
|
64
64
|
var SearchField_1 = require("./SearchField");
|
|
65
65
|
var _register_1 = require("./_register");
|
|
66
|
-
|
|
66
|
+
exports.InnerSearchBarByField = (0, react_1.forwardRef)(function (props, ref) {
|
|
67
67
|
var isAwaysExpand = utils_1.GLOBAL.CONFIG.SEARCHBAR.AWAYS_EXPAND || props.__innerExpand;
|
|
68
68
|
var _a = __read((0, react_1.useState)(props.default || {}), 2), data = _a[0], setData = _a[1];
|
|
69
69
|
var _b = __read((0, react_1.useState)(isAwaysExpand), 2), isExpand = _b[0], _setIsExpand = _b[1];
|
|
70
|
-
var clear = function () { return setData(function (prev) {
|
|
70
|
+
var clear = (0, react_1.useCallback)(function () { return setData(function (prev) {
|
|
71
71
|
var data = {};
|
|
72
72
|
lodash_1.default.keys(prev).map(function (item) {
|
|
73
73
|
data[item] = null;
|
|
@@ -76,7 +76,8 @@ var InnerSearchBarByField = function (props) {
|
|
|
76
76
|
return lodash_1.default.extend({}, data, props.default);
|
|
77
77
|
}
|
|
78
78
|
return data;
|
|
79
|
-
}); };
|
|
79
|
+
}); }, []);
|
|
80
|
+
(0, react_1.useImperativeHandle)(ref, function () { return ({ clear: clear }); }, []);
|
|
80
81
|
var search = function () { return props.onSearch(data); };
|
|
81
82
|
var setIsExpand = function (isExpand) {
|
|
82
83
|
if (isAwaysExpand)
|
|
@@ -240,7 +241,6 @@ var InnerSearchBarByField = function (props) {
|
|
|
240
241
|
rowRender(layout.rows[0]),
|
|
241
242
|
btnRender(layout.rows.length, isExpand)),
|
|
242
243
|
isExpand && moreRender(layout)));
|
|
243
|
-
};
|
|
244
|
-
exports.InnerSearchBarByField = InnerSearchBarByField;
|
|
244
|
+
});
|
|
245
245
|
var SearchBarByField = function (props) { return react_1.default.createElement(exports.InnerSearchBarByField, __assign({}, props)); };
|
|
246
246
|
exports.SearchBarByField = SearchBarByField;
|
|
@@ -60,6 +60,7 @@ var _i18n_1 = require("../_i18n");
|
|
|
60
60
|
var SearchBarByKeyword = function (props) {
|
|
61
61
|
var _a = __read((0, react_1.useState)(false), 2), open = _a[0], setOpen = _a[1];
|
|
62
62
|
var spanRef = (0, react_1.useRef)(null);
|
|
63
|
+
var barRef = (0, react_1.useRef)(null);
|
|
63
64
|
var inputProps = (0, react_1.useMemo)(function () {
|
|
64
65
|
var searchProps = {
|
|
65
66
|
className: "c-searchbar-keyword",
|
|
@@ -73,6 +74,11 @@ var SearchBarByKeyword = function (props) {
|
|
|
73
74
|
}
|
|
74
75
|
return searchProps;
|
|
75
76
|
}, []);
|
|
77
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
78
|
+
if (open && barRef && barRef.current && utils_1.GLOBAL.CONFIG.SEARCHBAR.POPUP_CLEAR_ONOPEN) {
|
|
79
|
+
barRef.current.clear();
|
|
80
|
+
}
|
|
81
|
+
}, [open]);
|
|
76
82
|
var suffixProps = {};
|
|
77
83
|
if (props.fields && props.fields.length) {
|
|
78
84
|
suffixProps.suffix = react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -80,7 +86,7 @@ var SearchBarByKeyword = function (props) {
|
|
|
80
86
|
react_1.default.createElement(Popover_1.Popover, { open: open, onOpenChange: setOpen, trigger: "click", placement: "bottom", content: react_1.default.createElement(react_1.default.Fragment, null,
|
|
81
87
|
react_1.default.createElement("h3", null, utils_1.i18n.txt(_i18n_1.V.INPUT_SEARCH_ADVANCE)),
|
|
82
88
|
react_1.default.createElement("div", { className: 'c-searchbar' },
|
|
83
|
-
react_1.default.createElement(ByField_1.InnerSearchBarByField, __assign({}, props, { __innerExpand: true, __innerOutside: true, __innnerPopup: true, onSearch: function (param) {
|
|
89
|
+
react_1.default.createElement(ByField_1.InnerSearchBarByField, __assign({}, props, { ref: barRef, __innerExpand: true, __innerOutside: true, __innnerPopup: true, onSearch: function (param) {
|
|
84
90
|
props.onSearch(param);
|
|
85
91
|
setOpen(false);
|
|
86
92
|
} })))), overlayClassName: 'c-searchbar-keyword-more', getPopupContainer: function (triggerNode) { return utils_1.PageUtil.getParentByClassName(triggerNode, 'c-searchbar'); } }));
|
|
@@ -142,9 +142,9 @@ var builderApiTableSerletor = function (options, nameIdx) { return function (pro
|
|
|
142
142
|
};
|
|
143
143
|
return react_1.default.createElement(react_1.default.Fragment, null,
|
|
144
144
|
values[0] != undefined ? react_1.default.createElement(Button_1.Button, __assign({}, params, { onClick: function () { return setOpen(true); } }), getTip(values)) : react_1.default.createElement(Button_1.Button, __assign({}, params, { icon: 'select', onClick: function () { return setOpen(true); } }), (0, exports.getPlaceholder)(field, true)),
|
|
145
|
-
react_1.default.createElement(Tables_1.ApiTableModal, { title: options.title,
|
|
145
|
+
react_1.default.createElement(Tables_1.ApiTableModal, __assign({ title: options.title, searchBar: options.searchBar, width: options.width || 720 }, field.config, { api: options.api, columns: __spreadArray(__spreadArray([], __read(options.columns), false), [
|
|
146
146
|
Tables_1.ApiTable.COL_OPERACTION({ render: function (data) { return react_1.default.createElement(Tables_1.ApiTable.ACTION, { title: "\u9009\u62E9", icon: "select", onClick: function () { return onSelect(data); } }); } })
|
|
147
|
-
], false),
|
|
147
|
+
], false), open: open, onCancel: function () { return setOpen(false); } })));
|
|
148
148
|
}; };
|
|
149
149
|
/**
|
|
150
150
|
* 快速注册 一个 弹出ApiTable 的选择组件
|
|
@@ -64,7 +64,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
64
64
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
65
65
|
};
|
|
66
66
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67
|
-
exports.UploadImage = void 0;
|
|
67
|
+
exports.UploadImage = exports.getImageUrl = void 0;
|
|
68
68
|
var react_1 = __importStar(require("react"));
|
|
69
69
|
var lodash_1 = __importDefault(require("lodash"));
|
|
70
70
|
var antd_1 = require("antd");
|
|
@@ -81,6 +81,7 @@ var getImageUrl = function (uri) {
|
|
|
81
81
|
return utils_1.PageUtil.resolveURL(uri);
|
|
82
82
|
return utils_1.GLOBAL.CONFIG.UPLOAD.PREVIEW + uri;
|
|
83
83
|
};
|
|
84
|
+
exports.getImageUrl = getImageUrl;
|
|
84
85
|
var ImagePreview = function (props) {
|
|
85
86
|
var state = props.state, width = props.width, height = props.height, showPreview = props.showPreview;
|
|
86
87
|
var _a = __read((0, hooks_1.useToggle)(), 2), open = _a[0], show = _a[1];
|
|
@@ -88,8 +89,8 @@ var ImagePreview = function (props) {
|
|
|
88
89
|
if (lodash_1.default.isFunction(props.preview))
|
|
89
90
|
return props.preview(state.info);
|
|
90
91
|
if (lodash_1.default.isString(state.info))
|
|
91
|
-
return getImageUrl(state.info);
|
|
92
|
-
return getImageUrl(state.info.guid || state.info.fileId);
|
|
92
|
+
return (0, exports.getImageUrl)(state.info);
|
|
93
|
+
return (0, exports.getImageUrl)(state.info.guid || state.info.fileId);
|
|
93
94
|
}, [state.info]);
|
|
94
95
|
var divProps = (0, react_1.useMemo)(function () {
|
|
95
96
|
var param = {
|
|
@@ -231,8 +232,8 @@ var UploadImage = function (props) {
|
|
|
231
232
|
}
|
|
232
233
|
if (state.info == null) {
|
|
233
234
|
return react_1.default.createElement("div", { style: { height: height }, className: 'c-upload-img-root' },
|
|
234
|
-
react_1.default.createElement(antd_1.Upload, __assign({}, uploadProps, { onChange: onChange, style: { width: width, height: height }, disabled: state.uploading }),
|
|
235
|
-
react_1.default.createElement("div", { style: { width: width, height: height } },
|
|
235
|
+
react_1.default.createElement(antd_1.Upload, __assign({}, uploadProps, { onChange: onChange, style: { width: width, height: height, }, disabled: state.uploading }),
|
|
236
|
+
react_1.default.createElement("div", { style: { width: width, height: height, display: "flex", justifyContent: 'center', alignItems: 'center' } },
|
|
236
237
|
react_1.default.createElement("div", { className: 'c-upload-placehoder' },
|
|
237
238
|
react_1.default.createElement(Icon_1.Icon, { type: state.uploading ? 'loading' : 'plus' }),
|
|
238
239
|
react_1.default.createElement("span", { className: "c-upload-img-text" }, utils_1.i18n.getText(props.ik, props.label, _i18n_1.V.UPLOAD_PIC))))),
|
|
@@ -7,7 +7,22 @@ export interface Tab extends Omit<AntdTabPaneProps, 'tab'> {
|
|
|
7
7
|
label: React.ReactNode;
|
|
8
8
|
}
|
|
9
9
|
export type TabsProps = AntdTabsProps & {
|
|
10
|
+
/**
|
|
11
|
+
* antd5:建议直接使用 items 传入
|
|
12
|
+
*/
|
|
10
13
|
items?: Tab[];
|
|
14
|
+
/**
|
|
15
|
+
* 隐藏最左边的 Border
|
|
16
|
+
*/
|
|
17
|
+
hideLeftBorder?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 隐藏上边的 Border
|
|
20
|
+
*/
|
|
21
|
+
hideTopBorder?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 隐藏左边的间隙
|
|
24
|
+
*/
|
|
25
|
+
hideLeftSpace?: boolean;
|
|
11
26
|
};
|
|
12
27
|
type TabComponent = ExoticComponent<PropsWithChildren<TabsProps>> & {
|
|
13
28
|
TabPane: typeof AntdTabs.TabPane;
|
|
@@ -10,19 +10,54 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
13
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
38
|
};
|
|
16
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
40
|
exports.Tabs = void 0;
|
|
18
|
-
var react_1 =
|
|
41
|
+
var react_1 = __importStar(require("react"));
|
|
19
42
|
var lodash_1 = __importDefault(require("lodash"));
|
|
20
43
|
var antd_1 = require("antd");
|
|
21
44
|
var _Tabs = function (props) {
|
|
45
|
+
var className = (0, react_1.useMemo)(function () {
|
|
46
|
+
var clazz = [];
|
|
47
|
+
if (props.className)
|
|
48
|
+
clazz.push(props.className);
|
|
49
|
+
if (props.hideLeftBorder)
|
|
50
|
+
clazz.push('tabs-hide-l');
|
|
51
|
+
if (props.hideTopBorder)
|
|
52
|
+
clazz.push('tabs-hide-t');
|
|
53
|
+
if (props.hideLeftSpace)
|
|
54
|
+
clazz.push('tabs-hide-ls');
|
|
55
|
+
return clazz.join(' ');
|
|
56
|
+
}, [props.className]);
|
|
22
57
|
if (props.children == null && lodash_1.default.isArray(props.items) && props.items.length > 0) {
|
|
23
|
-
return react_1.default.createElement(antd_1.Tabs, __assign({}, props), props.items.map(function (item) { return react_1.default.createElement(antd_1.Tabs.TabPane, __assign({}, item, { tab: item.label })); }));
|
|
58
|
+
return react_1.default.createElement(antd_1.Tabs, __assign({}, props, { className: className }), props.items.map(function (item) { return react_1.default.createElement(antd_1.Tabs.TabPane, __assign({}, item, { tab: item.label })); }));
|
|
24
59
|
}
|
|
25
|
-
return react_1.default.createElement(antd_1.Tabs, __assign({}, props));
|
|
60
|
+
return react_1.default.createElement(antd_1.Tabs, __assign({}, props, { className: className }));
|
|
26
61
|
};
|
|
27
62
|
exports.Tabs = _Tabs;
|
|
28
63
|
exports.Tabs.TabPane = antd_1.Tabs.TabPane;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { NumberFormat, FractionDigits } from '../../utils/Format';
|
|
3
|
+
type FormatFunction = (number: any) => string;
|
|
3
4
|
export type CountUpProps = {
|
|
4
5
|
/**
|
|
5
6
|
* 自定义样式
|
|
@@ -20,7 +21,7 @@ export type CountUpProps = {
|
|
|
20
21
|
/**
|
|
21
22
|
* 样式
|
|
22
23
|
*/
|
|
23
|
-
format?: NumberFormat;
|
|
24
|
+
format?: NumberFormat | FormatFunction;
|
|
24
25
|
/**
|
|
25
26
|
* pos 仅在 int-fixed 与 digtal 模式下有效
|
|
26
27
|
* int-fixed
|
|
@@ -36,3 +37,4 @@ export type CountUpProps = {
|
|
|
36
37
|
* 数据变化组件
|
|
37
38
|
*/
|
|
38
39
|
export declare const CountUp: React.FC<CountUpProps>;
|
|
40
|
+
export {};
|
|
@@ -62,7 +62,11 @@ var loop = function (from, to, el, format, startTime, ms) {
|
|
|
62
62
|
var CountUp = function (props) {
|
|
63
63
|
var el = (0, react_1.useRef)(null);
|
|
64
64
|
var ms = lodash_1.default.isNumber(props.ms) ? props.ms : 800;
|
|
65
|
-
var format = (0,
|
|
65
|
+
var format = (0, react_1.useMemo)(function () {
|
|
66
|
+
if (lodash_1.default.isFunction(props.format))
|
|
67
|
+
return props.format;
|
|
68
|
+
return (0, Format_1.getFormater)(props.format, props.pos);
|
|
69
|
+
}, [props.format]);
|
|
66
70
|
var _a = __read((0, react_1.useState)({ lastTime: Date.now(), lastValue: props.initValue || 0 }), 2), state = _a[0], setState = _a[1];
|
|
67
71
|
var start = function (from, to) {
|
|
68
72
|
setState({ lastTime: Date.now(), lastValue: to });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { PlainObject, UFormField } from "../../index";
|
|
3
|
+
type LookUp = {
|
|
4
|
+
title: string;
|
|
5
|
+
id: number;
|
|
6
|
+
type: string;
|
|
7
|
+
code: string;
|
|
8
|
+
value: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const useLookup: () => {
|
|
12
|
+
lookupLoading: boolean;
|
|
13
|
+
update: (data: PlainObject) => Promise<void>;
|
|
14
|
+
getLookups: (codes: string[]) => LookUp[];
|
|
15
|
+
getLookupsByType: (type: string) => LookUp[];
|
|
16
|
+
getLookupData: (fields: UFormField[]) => PlainObject;
|
|
17
|
+
changeSaveData: (data: any) => {};
|
|
18
|
+
};
|
|
19
|
+
type LookUpModalProps = {
|
|
20
|
+
title?: string;
|
|
21
|
+
open: boolean;
|
|
22
|
+
fields: UFormField[];
|
|
23
|
+
onCancel: () => void;
|
|
24
|
+
};
|
|
25
|
+
export declare const LookUpInfo: React.FC<LookUpModalProps>;
|
|
26
|
+
export declare const LookUpModal: React.FC<LookUpModalProps>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
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;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
62
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
63
|
+
if (!m) return o;
|
|
64
|
+
var i = m.call(o), r, ar = [], e;
|
|
65
|
+
try {
|
|
66
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
67
|
+
}
|
|
68
|
+
catch (error) { e = { error: error }; }
|
|
69
|
+
finally {
|
|
70
|
+
try {
|
|
71
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
72
|
+
}
|
|
73
|
+
finally { if (e) throw e.error; }
|
|
74
|
+
}
|
|
75
|
+
return ar;
|
|
76
|
+
};
|
|
77
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
78
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
79
|
+
if (ar || !(i in from)) {
|
|
80
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
81
|
+
ar[i] = from[i];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
85
|
+
};
|
|
86
|
+
var __values = (this && this.__values) || function(o) {
|
|
87
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
88
|
+
if (m) return m.call(o);
|
|
89
|
+
if (o && typeof o.length === "number") return {
|
|
90
|
+
next: function () {
|
|
91
|
+
if (o && i >= o.length) o = void 0;
|
|
92
|
+
return { value: o && o[i++], done: !o };
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
96
|
+
};
|
|
97
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
98
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
99
|
+
};
|
|
100
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
101
|
+
exports.LookUpModal = exports.LookUpInfo = exports.useLookup = void 0;
|
|
102
|
+
var react_1 = __importStar(require("react"));
|
|
103
|
+
var index_1 = require("../../index");
|
|
104
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
105
|
+
var hooks_1 = require("../../hooks");
|
|
106
|
+
var utils_1 = require("../../utils");
|
|
107
|
+
var useLookup = function () {
|
|
108
|
+
var _a = __read((0, hooks_1.useGlobal)('lookup', {
|
|
109
|
+
loading: true,
|
|
110
|
+
TypeInfoMap: new Map(),
|
|
111
|
+
CodeInfoMap: new Map()
|
|
112
|
+
}, {
|
|
113
|
+
share: true
|
|
114
|
+
}), 3), state = _a[0], setState = _a[1], loaded = _a[2];
|
|
115
|
+
var reflush = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
116
|
+
var resp, groups, TypeInfoMap, CodeInfoMap;
|
|
117
|
+
return __generator(this, function (_a) {
|
|
118
|
+
switch (_a.label) {
|
|
119
|
+
case 0: return [4 /*yield*/, utils_1.Ajax.POST('/api-audit/lookup', { "count_": 999, "status": 1 })];
|
|
120
|
+
case 1:
|
|
121
|
+
resp = _a.sent();
|
|
122
|
+
groups = lodash_1.default.groupBy(resp.list, 'type');
|
|
123
|
+
TypeInfoMap = new Map();
|
|
124
|
+
CodeInfoMap = new Map();
|
|
125
|
+
lodash_1.default.keys(groups).map(function (type) {
|
|
126
|
+
var arr = groups[type] || [];
|
|
127
|
+
var infoMap = new Map();
|
|
128
|
+
arr.map(function (item) {
|
|
129
|
+
infoMap.set(item.code, item);
|
|
130
|
+
CodeInfoMap.set(item.code, item);
|
|
131
|
+
});
|
|
132
|
+
TypeInfoMap.set(type, infoMap);
|
|
133
|
+
setState({ TypeInfoMap: TypeInfoMap, CodeInfoMap: CodeInfoMap, loading: false });
|
|
134
|
+
});
|
|
135
|
+
return [2 /*return*/];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}); };
|
|
139
|
+
var getLookupsByType = (0, react_1.useCallback)(function (type) {
|
|
140
|
+
var map = state.TypeInfoMap.get(type);
|
|
141
|
+
if (map == null)
|
|
142
|
+
return [];
|
|
143
|
+
return __spreadArray([], __read(map.values()), false);
|
|
144
|
+
}, [state]);
|
|
145
|
+
var getLookups = (0, react_1.useCallback)(function (codes) {
|
|
146
|
+
var looks = [];
|
|
147
|
+
codes.map(function (item) {
|
|
148
|
+
var ptn = (item || '').split('.').map(lodash_1.default.trim);
|
|
149
|
+
if (ptn.length == 1) {
|
|
150
|
+
var look = state.CodeInfoMap.get(ptn[0]);
|
|
151
|
+
if (look == null) {
|
|
152
|
+
console.warn("\u6CA1\u6709\u627E\u5230\u914D\u7F6E : ".concat(item));
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
looks.push(look);
|
|
156
|
+
}
|
|
157
|
+
else if (ptn.length >= 2) {
|
|
158
|
+
var type = state.TypeInfoMap.get(ptn[0]);
|
|
159
|
+
if (type == null) {
|
|
160
|
+
console.warn("\u6CA1\u6709\u627E\u5230\u914D\u7F6E : ".concat(item));
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
var look = type.get(ptn[1]);
|
|
164
|
+
if (look == null) {
|
|
165
|
+
console.warn("\u6CA1\u6709\u627E\u5230\u914D\u7F6E : ".concat(item));
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
looks.push(look);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
return looks;
|
|
172
|
+
}, [state]);
|
|
173
|
+
var getLookupData = (0, react_1.useCallback)(function (fields) {
|
|
174
|
+
var e_1, _a, _b, _c;
|
|
175
|
+
var data = {};
|
|
176
|
+
try {
|
|
177
|
+
for (var fields_1 = __values(fields), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
|
|
178
|
+
var field = fields_1_1.value;
|
|
179
|
+
var lookups = getLookups([field.field]);
|
|
180
|
+
if (lookups.length == 0)
|
|
181
|
+
continue;
|
|
182
|
+
var lookup = lookups[0];
|
|
183
|
+
// if(field.field.indexOf('.'))
|
|
184
|
+
var ptns = field.field.split('.');
|
|
185
|
+
var assignField = ptns[ptns.length - 1];
|
|
186
|
+
switch (field.type) {
|
|
187
|
+
case 'number':
|
|
188
|
+
case 'slider':
|
|
189
|
+
if (ptns.length > 1) {
|
|
190
|
+
if (data[ptns[0]]) {
|
|
191
|
+
data[ptns[0]][ptns[1]] = parseInt(lookup.value);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
data[ptns[0]] = (_b = {}, _b[ptns[1]] = parseInt(lookup.value), _b);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
data[assignField] = parseInt(lookup.value);
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
default:
|
|
202
|
+
if (ptns.length > 1) {
|
|
203
|
+
if (data[ptns[0]]) {
|
|
204
|
+
data[ptns[0]][ptns[1]] = lookup.value;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
data[ptns[0]] = (_c = {}, _c[ptns[1]] = lookup.value, _c);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
data[assignField] = lookup.value;
|
|
212
|
+
}
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
218
|
+
finally {
|
|
219
|
+
try {
|
|
220
|
+
if (fields_1_1 && !fields_1_1.done && (_a = fields_1.return)) _a.call(fields_1);
|
|
221
|
+
}
|
|
222
|
+
finally { if (e_1) throw e_1.error; }
|
|
223
|
+
}
|
|
224
|
+
return data;
|
|
225
|
+
}, [state]);
|
|
226
|
+
var changeSaveData = function (data) {
|
|
227
|
+
var changedData = {};
|
|
228
|
+
var _loop_1 = function (key) {
|
|
229
|
+
if (lodash_1.default.isObjectLike(data[key])) {
|
|
230
|
+
changedData[key] = data[key];
|
|
231
|
+
lodash_1.default.keys(data[key]).forEach(function (itemKey) {
|
|
232
|
+
changedData[itemKey] = data[key][itemKey];
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
if (!changedData[key]) {
|
|
237
|
+
changedData[key] = data[key];
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
for (var key in data) {
|
|
242
|
+
_loop_1(key);
|
|
243
|
+
}
|
|
244
|
+
return changedData;
|
|
245
|
+
};
|
|
246
|
+
(0, react_1.useEffect)(function () {
|
|
247
|
+
if (loaded)
|
|
248
|
+
return;
|
|
249
|
+
reflush();
|
|
250
|
+
}, []);
|
|
251
|
+
var update = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
252
|
+
var params, paramsCodeArr, lookups;
|
|
253
|
+
return __generator(this, function (_a) {
|
|
254
|
+
switch (_a.label) {
|
|
255
|
+
case 0:
|
|
256
|
+
params = [];
|
|
257
|
+
paramsCodeArr = [];
|
|
258
|
+
lookups = getLookups(lodash_1.default.keys(data));
|
|
259
|
+
// 更新旧值
|
|
260
|
+
lodash_1.default.keys(data).map(function (key) {
|
|
261
|
+
var find = lodash_1.default.find(lookups, function (item) { return (item.code == key) || ("".concat(item.type, ".").concat(item.code) == key); });
|
|
262
|
+
if (find) {
|
|
263
|
+
paramsCodeArr.push({ code: key });
|
|
264
|
+
if (data[key] != find.value) {
|
|
265
|
+
params.push({ id: find.id, value: data[key] });
|
|
266
|
+
}
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
// 设置新值--对象类型
|
|
271
|
+
lodash_1.default.keys(data).map(function (key) {
|
|
272
|
+
var objValue = data[key];
|
|
273
|
+
if (lodash_1.default.isObjectLike(objValue)) {
|
|
274
|
+
for (var itemKey in objValue) {
|
|
275
|
+
if (!lodash_1.default.find(paramsCodeArr, { code: itemKey })) {
|
|
276
|
+
params.push({ type: key, code: itemKey, value: objValue[itemKey] });
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
// 设置新智--简单类型
|
|
282
|
+
lodash_1.default.keys(data).map(function (key) {
|
|
283
|
+
var objValue = data[key];
|
|
284
|
+
if (!lodash_1.default.isObjectLike(objValue)) {
|
|
285
|
+
if (!lodash_1.default.find(paramsCodeArr, { code: key }) && !lodash_1.default.find(params, { code: key })) {
|
|
286
|
+
params.push({ code: key, value: data[key] });
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
if (params.length == 0) {
|
|
291
|
+
index_1.message.success('配置修改成功');
|
|
292
|
+
return [2 /*return*/];
|
|
293
|
+
}
|
|
294
|
+
return [4 /*yield*/, utils_1.Ajax.WHEN.apply(utils_1.Ajax, __spreadArray([], __read(params.map(function (param) { return utils_1.Ajax.PATCH('/api-audit/lookup', param); })), false))];
|
|
295
|
+
case 1:
|
|
296
|
+
_a.sent();
|
|
297
|
+
index_1.message.success('配置修改成功');
|
|
298
|
+
reflush();
|
|
299
|
+
return [2 /*return*/];
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}); };
|
|
303
|
+
return { lookupLoading: state.loading, update: update, getLookups: getLookups, getLookupsByType: getLookupsByType, getLookupData: getLookupData, changeSaveData: changeSaveData };
|
|
304
|
+
};
|
|
305
|
+
exports.useLookup = useLookup;
|
|
306
|
+
var LookUpInfo = function (props) {
|
|
307
|
+
var getLookupData = (0, exports.useLookup)().getLookupData;
|
|
308
|
+
var data = getLookupData(props.fields);
|
|
309
|
+
return react_1.default.createElement(index_1.UInfoModal, { open: props.open, fields: props.fields, data: data, onCancel: props.onCancel, title: props.title || '配置详情', onOk: props.onCancel });
|
|
310
|
+
};
|
|
311
|
+
exports.LookUpInfo = LookUpInfo;
|
|
312
|
+
var LookUpModal = function (props) {
|
|
313
|
+
var _a = (0, exports.useLookup)(), getLookupData = _a.getLookupData, update = _a.update, changeSaveData = _a.changeSaveData;
|
|
314
|
+
var data = getLookupData(props.fields);
|
|
315
|
+
var save = function (saveData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
316
|
+
return __generator(this, function (_a) {
|
|
317
|
+
update(changeSaveData(saveData));
|
|
318
|
+
props.onCancel();
|
|
319
|
+
return [2 /*return*/];
|
|
320
|
+
});
|
|
321
|
+
}); };
|
|
322
|
+
return react_1.default.createElement(index_1.UFormModal, { isEdit: true, data: data, open: props.open, onCancel: props.onCancel, title: props.title || '配置', onOk: save, fields: props.fields });
|
|
323
|
+
};
|
|
324
|
+
exports.LookUpModal = LookUpModal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useLookup, LookUpInfo, LookUpModal } from './LookUp';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LookUpModal = exports.LookUpInfo = exports.useLookup = void 0;
|
|
4
|
+
var LookUp_1 = require("./LookUp");
|
|
5
|
+
Object.defineProperty(exports, "useLookup", { enumerable: true, get: function () { return LookUp_1.useLookup; } });
|
|
6
|
+
Object.defineProperty(exports, "LookUpInfo", { enumerable: true, get: function () { return LookUp_1.LookUpInfo; } });
|
|
7
|
+
Object.defineProperty(exports, "LookUpModal", { enumerable: true, get: function () { return LookUp_1.LookUpModal; } });
|