vap1 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Box/Box.js +75 -42
- package/components/Box/SelectBar.js +51 -24
- package/components/Box/_register.d.ts +4 -0
- package/components/Box/_register.js +10 -8
- package/components/Box/index.js +1 -1
- package/components/Lists/SList.js +76 -48
- package/components/SearchBar/ActionButtons.js +75 -42
- package/components/SearchBar/ByField.js +80 -52
- package/components/SearchBar/ByKeyword.js +44 -17
- package/components/SearchBar/SearchField.js +8 -8
- package/components/SearchBar/SearchTags.js +4 -4
- package/components/SearchBar/_register.js +9 -8
- package/components/SearchBar/index.js +22 -11
- package/components/Tables/ApiTable.d.ts +1 -1
- package/components/Tables/ApiTable.js +19 -8
- package/components/Tables/ApiTableModal.d.ts +1 -1
- package/components/Tables/ApiTableModal.js +40 -13
- package/components/Tables/Components/ActionBar.js +53 -26
- package/components/Tables/Components/Actions.js +40 -29
- package/components/Tables/Components/Summary.js +2 -2
- package/components/Tables/Components/index.js +3 -3
- package/components/Tables/STable.js +21 -10
- package/components/Tables/TopTable.d.ts +3 -2
- package/components/Tables/TopTable.js +64 -37
- package/components/Tables/TopTableModal.js +21 -10
- package/components/Tables/Util.d.ts +2 -2
- package/components/Tables/Util.js +11 -9
- package/components/Tables/VTable.d.ts +2 -2
- package/components/Tables/VTable.js +137 -65
- package/components/Tables/index.d.ts +7 -2
- package/components/Tables/index.js +5 -5
- package/components/TreeSelect/BaseTreeSelect.js +81 -45
- package/components/TreeSelect/DTreeSelect.js +191 -66
- package/components/TreeSelect/FTreeSelect.js +67 -20
- package/components/TreeSelect/STreeSelect.js +22 -11
- package/components/Trees/ActionTree.js +562 -431
- package/components/Trees/BaseTree.js +85 -38
- package/components/Trees/COTree/COButton.js +48 -21
- package/components/Trees/COTree/COSelect.js +31 -20
- package/components/Trees/COTree/COTree.js +223 -107
- package/components/Trees/COTree/COTreeUtil.js +160 -115
- package/components/Trees/DTree.js +139 -68
- package/components/Trees/FTree.js +76 -29
- package/components/Trees/STree.js +59 -23
- package/components/UForm/FormWrapper.js +70 -53
- package/components/UForm/UDescriptions.js +38 -38
- package/components/UForm/UForm.js +240 -135
- package/components/UForm/UFormModal.js +99 -44
- package/components/UForm/UInfo.js +33 -22
- package/components/UForm/UInfoModal.js +31 -20
- package/components/UForm/UModal.js +40 -13
- package/components/UForm/_FormUtils.js +29 -18
- package/components/UForm/_input.js +75 -39
- package/components/UForm/_register.js +11 -9
- package/components/UForm/index.d.ts +5 -0
- package/components/Upload/UploadFile.js +38 -11
- package/components/Upload/UploadImage.js +50 -23
- package/components/Upload/UploadModal.js +149 -84
- package/components/Upload/useUpload.js +35 -19
- package/components/_RegisterUtil.js +20 -8
- package/components/_adapt/Alert.js +20 -9
- package/components/_adapt/Breadcrumb.js +18 -7
- package/components/_adapt/Button.js +24 -13
- package/components/_adapt/Col.js +34 -23
- package/components/_adapt/Collapse.js +21 -10
- package/components/_adapt/ColorPicker.js +55 -28
- package/components/_adapt/ConfigProvider.js +14 -3
- package/components/_adapt/Drawer.js +18 -7
- package/components/_adapt/Dropdown.js +23 -12
- package/components/_adapt/FloatButton.js +21 -10
- package/components/_adapt/Icon.js +18 -7
- package/components/_adapt/Input.js +17 -6
- package/components/_adapt/InputNumber.js +16 -5
- package/components/_adapt/Layout.js +84 -28
- package/components/_adapt/Menu.js +28 -17
- package/components/_adapt/Modal.js +72 -25
- package/components/_adapt/Pagination.js +14 -3
- package/components/_adapt/Popconfirm.js +17 -6
- package/components/_adapt/Popover.js +17 -6
- package/components/_adapt/Progress.js +42 -11
- package/components/_adapt/Radio.js +21 -10
- package/components/_adapt/Row.js +18 -7
- package/components/_adapt/Select.js +54 -43
- package/components/_adapt/Slider.js +1 -1
- package/components/_adapt/Space.js +2 -2
- package/components/_adapt/Table.js +16 -5
- package/components/_adapt/Tabs.js +17 -6
- package/components/_adapt/Tag.js +19 -8
- package/components/_adapt/Tooltip.js +15 -4
- package/components/_adapt/TreeSelect.js +18 -7
- package/components/_adapt/notification.js +1 -1
- package/components/_adapt/todo/Image.js +2 -2
- package/components/_adapt/todo/NotEffectOnV15.js +1 -1
- package/components/_adapt/todo/Segmented.js +2 -2
- package/components/_adapt/utils.js +28 -8
- package/components/_common/AutoComplete.js +101 -34
- package/components/_common/CountUp.js +30 -14
- package/components/_common/DateRange.js +36 -20
- package/components/_common/HighLight.js +22 -6
- package/components/_common/I18N.js +27 -2
- package/components/_common/Loading.js +25 -9
- package/components/_common/MonthRange.js +26 -26
- package/components/_common/PromiseLabel.js +68 -15
- package/components/_common/Role.js +2 -2
- package/components/_common/Upagination.js +45 -34
- package/components/_setup/Const.js +2 -2
- package/components/_setup/I18N/enUS.js +2 -2
- package/components/_setup/I18N/zhCN.js +3 -3
- package/components/_setup/I18N/zhHK.js +2 -2
- package/components/_setup/ICON/IconTypes.js +2 -2
- package/components/_setup/SearchField/SearchFieldAdvance.js +22 -11
- package/components/_setup/SearchField/SearchFieldDate.js +114 -77
- package/components/_setup/SearchField/SearchFieldInput.js +21 -10
- package/components/_setup/SearchField/SearchFieldSelect.js +55 -44
- package/components/_setup/SearchField/SearchFieldTree.js +63 -52
- package/components/_setup/SelectBar/SelectList.js +21 -10
- package/components/_setup/SelectBar/SelectTree.js +17 -6
- package/components/_setup/UForm/UFormAdvanceInput.js +105 -78
- package/components/_setup/UForm/UFormCOTree.js +21 -10
- package/components/_setup/UForm/UFormCrontab.js +51 -35
- package/components/_setup/UForm/UFormDate.js +158 -122
- package/components/_setup/UForm/UFormInput.js +110 -73
- package/components/_setup/UForm/UFormJSON.js +95 -57
- package/components/_setup/UForm/UFormJSONTable.js +79 -41
- package/components/_setup/UForm/UFormOrg.js +112 -48
- package/components/_setup/UForm/UFormRole.js +31 -20
- package/components/_setup/UForm/UFormSelect.js +106 -79
- package/components/_setup/UForm/UFormTree.js +52 -41
- package/components/_setup/UForm/UFormUpload.js +62 -34
- package/components/_setup/UForm/_utils.js +9 -9
- package/deps/JsonView.js +18 -7
- package/deps/SpringBoot.js +1 -1
- package/deps/SpringCloud.js +4 -4
- package/deps/_editor/advance/_Image.js +33 -20
- package/deps/_editor/base/Element.js +28 -17
- package/deps/_editor/base/Leaf.js +18 -7
- package/deps/_editor/base/Support.js +4 -4
- package/deps/_editor/i18n.js +1 -1
- package/deps/_editor/tools/Button.js +31 -19
- package/deps/_editor/tools/ToolBar.js +3 -3
- package/deps/_editor/tools/_BlockButton.js +49 -27
- package/deps/_editor/tools/_InsertButton.js +32 -28
- package/deps/_editor/tools/_MarkButton.js +15 -14
- package/deps/_editor/tools/_TxtButton.js +90 -58
- package/deps/api-audit.js +1 -1
- package/deps/echarts.js +58 -17
- package/deps/editor.js +52 -26
- package/deps/registerEditor.js +18 -7
- package/hooks/_list.js +1 -1
- package/hooks/useAjax.js +43 -19
- package/hooks/useAjaxAction.js +57 -20
- package/hooks/useAjaxQuery.js +121 -51
- package/hooks/useApi.js +35 -8
- package/hooks/useApiBase.js +291 -184
- package/hooks/useApiGlobal.js +40 -13
- package/hooks/useApp.js +4 -4
- package/hooks/useArray.js +114 -52
- package/hooks/useDefault.js +19 -3
- package/hooks/useDoLoad.js +25 -9
- package/hooks/useEffectFunction.js +4 -3
- package/hooks/useEffectOnce.js +5 -5
- package/hooks/useError.js +21 -5
- package/hooks/useFirstMountState.js +3 -3
- package/hooks/useGenkey.js +7 -7
- package/hooks/useGetSet.js +9 -9
- package/hooks/useGlobal.js +58 -29
- package/hooks/useHover.js +25 -9
- package/hooks/useMemoPromise.js +62 -22
- package/hooks/useModals.js +71 -36
- package/hooks/useMountedState.js +6 -6
- package/hooks/useOpenState.js +26 -10
- package/hooks/usePromise.js +15 -13
- package/hooks/useQueue.js +35 -8
- package/hooks/useSetState.js +25 -8
- package/hooks/useStateList.js +30 -18
- package/hooks/useSyncExternalStore.js +31 -15
- package/hooks/useToggle.js +6 -3
- package/hooks/useUnmountPromise.js +11 -11
- package/hooks/useUpdate.js +20 -4
- package/hooks/useUpdateEffect.js +5 -5
- package/login/Base65.js +15 -14
- package/login/Password.js +91 -38
- package/login/SM4.js +50 -49
- package/login/cems/index.js +2 -2
- package/login/jit/index.js +16 -71
- package/login/jit/pnxclient.js +6 -4
- package/login/vap/index.js +1 -1
- package/login/xrtx/index.js +2 -2
- package/package.json +1 -1
- package/screen/Comment.js +16 -5
- package/screen/Page.js +14 -14
- package/screen/render.js +2 -2
- package/uform/FormEditor.js +44 -27
- package/uform/FormViewer.js +30 -19
- package/uform/hooks/useEditor.js +83 -47
- package/uform/hooks/useForm.js +2 -2
- package/uform/index.js +10 -10
- package/uform/inputs/_advance.js +12 -12
- package/uform/inputs/_date.js +63 -52
- package/uform/inputs/_input.js +49 -38
- package/uform/inputs/_select.js +53 -42
- package/uform/inputs/_specific.js +33 -22
- package/uform/inputs/index.js +5 -5
- package/uform/inputs/register.d.ts +8 -0
- package/uform/inputs/register.js +14 -14
- package/uform/panel/Editor/GroupEditor.js +31 -31
- package/uform/panel/Editor/ListEditor.js +22 -22
- package/uform/panel/Editor/_FieldItems.js +16 -16
- package/uform/panel/Editor/_GroupCollapse.js +9 -9
- package/uform/panel/Editor/_GroupDefault.js +9 -9
- package/uform/panel/Editor/_GroupStep.js +18 -18
- package/uform/panel/Editor/_GroupTab.js +16 -16
- package/uform/panel/Editor/index.js +17 -17
- package/uform/panel/Items/index.js +22 -11
- package/uform/panel/Propreties/CanvasProperties.js +14 -14
- package/uform/panel/Propreties/Component/FieldPlugin.js +5 -5
- package/uform/panel/Propreties/Component/LinkAsyncFunction.js +22 -47
- package/uform/panel/Propreties/Component/LinkSyncFunction.js +20 -43
- package/uform/panel/Propreties/Component/Links.js +40 -29
- package/uform/panel/Propreties/Component/OptionTable.js +97 -52
- package/uform/panel/Propreties/Component/RegexpModal.js +11 -11
- package/uform/panel/Propreties/Component/Validate.js +35 -24
- package/uform/panel/Propreties/Component/ValidateAsyncFunction.js +13 -24
- package/uform/panel/Propreties/Component/ValidateSyncFunction.js +15 -38
- package/uform/panel/Propreties/FieldOptions.js +78 -44
- package/uform/panel/Propreties/FieldProperties.js +47 -20
- package/uform/panel/Propreties/GroupProperties.js +9 -9
- package/uform/panel/Propreties/_ItemAdvance.js +37 -26
- package/uform/panel/Propreties/_ItemBase.js +72 -21
- package/uform/panel/Propreties/_ItemLink.js +20 -9
- package/uform/panel/Propreties/_ItemValidate.js +33 -22
- package/uform/plugins/index.js +7 -7
- package/uform/schema.d.ts +6 -1
- package/uform/utils/Convert.js +137 -94
- package/uform/utils/SchemaConvert.js +43 -68
- package/uform/utils/arr.js +106 -75
- package/utils/Ajax.d.ts +1 -11
- package/utils/Ajax.js +154 -68
- package/utils/ArrayUtil.js +14 -12
- package/utils/CacheUtil.js +19 -13
- package/utils/Const.js +13 -13
- package/utils/CustomApp.js +15 -10
- package/utils/EventUtil.js +78 -14
- package/utils/Format.js +59 -38
- package/utils/Global.js +8 -8
- package/utils/Logger.js +56 -11
- package/utils/PageUtil.d.ts +12 -6
- package/utils/PageUtil.js +105 -35
- package/utils/Renders/ApiGetRender.js +187 -100
- package/utils/Renders/ApiPostRender.js +123 -69
- package/utils/Renders/DateRender.js +9 -9
- package/utils/Renders/DictRender.js +82 -55
- package/utils/Renders/FileRender.js +34 -12
- package/utils/Renders/ListRender.js +21 -21
- package/utils/Renders/NumberRender.js +14 -13
- package/utils/Renders/StatusRender.js +20 -20
- package/utils/Renders/StringRender.js +17 -17
- package/utils/Renders/_define.d.ts +2 -2
- package/utils/Renders/_define.js +7 -7
- package/utils/StringUtil.js +98 -67
- package/utils/TreeUtil.js +71 -20
- package/utils/VAP.js +14 -14
- package/utils/XHR.js +27 -11
- package/utils/_AjaxUtil.d.ts +10 -0
- package/utils/_AjaxUtil.js +35 -12
- package/utils/_Support.d.ts +2 -2
- package/utils/_Support.js +26 -26
- package/utils/i18n.js +78 -44
- package/utils/index.d.ts +9 -1
- package/utils/index.js +34 -5
- package/utils/screenful.js +84 -31
- package/widget/index.js +4 -4
package/components/Box/Box.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -22,27 +33,43 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
33
|
__setModuleDefault(result, mod);
|
|
23
34
|
return result;
|
|
24
35
|
};
|
|
36
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
37
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
38
|
+
if (!m) return o;
|
|
39
|
+
var i = m.call(o), r, ar = [], e;
|
|
40
|
+
try {
|
|
41
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
42
|
+
}
|
|
43
|
+
catch (error) { e = { error: error }; }
|
|
44
|
+
finally {
|
|
45
|
+
try {
|
|
46
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
47
|
+
}
|
|
48
|
+
finally { if (e) throw e.error; }
|
|
49
|
+
}
|
|
50
|
+
return ar;
|
|
51
|
+
};
|
|
25
52
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
53
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
54
|
};
|
|
28
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
56
|
exports.Box = exports.useBox = void 0;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
var react_1 = __importStar(require("react"));
|
|
58
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
59
|
+
var Layout_1 = require("../_adapt/Layout");
|
|
60
|
+
var hooks_1 = require("../../hooks");
|
|
61
|
+
var SelectBar_1 = require("./SelectBar");
|
|
62
|
+
var SearchBar_1 = require("../SearchBar");
|
|
63
|
+
var Upagination_1 = require("../_common/Upagination");
|
|
64
|
+
var utils_1 = require("../../utils");
|
|
65
|
+
var _register_1 = require("./_register");
|
|
66
|
+
var HEIGHT_OMIT = 'ubox-omit';
|
|
67
|
+
var getParentByClassName = function (el, clazz) {
|
|
41
68
|
if (el.classList.contains(clazz))
|
|
42
69
|
return el;
|
|
43
70
|
return getParentByClassName(el.parentElement, clazz);
|
|
44
71
|
};
|
|
45
|
-
|
|
72
|
+
var BoxContext = (0, react_1.createContext)(null);
|
|
46
73
|
/**
|
|
47
74
|
* 说明:如果需要使用 useBox 获取BOX内部状态
|
|
48
75
|
* 必须自行手动再包一层 否则无法使用,
|
|
@@ -62,20 +89,20 @@ const BoxContext = (0, react_1.createContext)(null);
|
|
|
62
89
|
*
|
|
63
90
|
* return <Box><Child/></Box>
|
|
64
91
|
* */
|
|
65
|
-
|
|
92
|
+
var useBox = function () { return (0, react_1.useContext)(BoxContext); };
|
|
66
93
|
exports.useBox = useBox;
|
|
67
|
-
exports.Box = (0, react_1.forwardRef)((props, ref)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
94
|
+
exports.Box = (0, react_1.forwardRef)(function (props, ref) {
|
|
95
|
+
var app = (0, hooks_1.useApp)();
|
|
96
|
+
var _a = __read((0, hooks_1.useSetState)(null), 2), state = _a[0], setState = _a[1];
|
|
97
|
+
var _layoutRef = (0, react_1.useRef)(null); // 向下兼容
|
|
98
|
+
var domId = (0, react_1.useMemo)(function () { return utils_1.StringUtil.genKey(); }, []); // 向下兼容
|
|
99
|
+
var rootRef = (0, react_1.useRef)(null);
|
|
100
|
+
var contextRef = (0, react_1.useRef)(null);
|
|
101
|
+
var selectRef = (0, react_1.useRef)(null);
|
|
102
|
+
var className = ['c-box'];
|
|
76
103
|
if (props.nobg)
|
|
77
104
|
className.push('c-box-nobg');
|
|
78
|
-
|
|
105
|
+
var style = __assign({}, props.style);
|
|
79
106
|
className.push(props.mode ? ('c-box-' + props.mode) : 'c-box-common');
|
|
80
107
|
if (props.mode == 'inner') {
|
|
81
108
|
if (rootRef.current == null) {
|
|
@@ -83,7 +110,7 @@ exports.Box = (0, react_1.forwardRef)((props, ref) => {
|
|
|
83
110
|
style.display = 'none';
|
|
84
111
|
}
|
|
85
112
|
else {
|
|
86
|
-
|
|
113
|
+
var container = getParentByClassName(rootRef.current.parentElement, 'c-box');
|
|
87
114
|
style.height = Math.floor(container.parentElement.getBoundingClientRect().height);
|
|
88
115
|
}
|
|
89
116
|
}
|
|
@@ -95,32 +122,32 @@ exports.Box = (0, react_1.forwardRef)((props, ref) => {
|
|
|
95
122
|
style.height = '100%';
|
|
96
123
|
}
|
|
97
124
|
}
|
|
98
|
-
(0, react_1.useEffect)(()
|
|
125
|
+
(0, react_1.useEffect)(function () {
|
|
99
126
|
if (state && state.height && contextRef && contextRef.current) {
|
|
100
127
|
contextRef.current.style.height = (state.height + 'px');
|
|
101
128
|
}
|
|
102
129
|
}, [state === null || state === void 0 ? void 0 : state.height]);
|
|
103
|
-
|
|
130
|
+
var resize = function () {
|
|
104
131
|
if (props.mode == undefined || props.mode == 'common' || app == null) {
|
|
105
132
|
if (state === null)
|
|
106
133
|
setState({});
|
|
107
134
|
return;
|
|
108
135
|
}
|
|
109
136
|
;
|
|
110
|
-
|
|
137
|
+
var el = rootRef.current;
|
|
111
138
|
if (!el)
|
|
112
139
|
return;
|
|
113
140
|
document.body.classList.add('v-resizing');
|
|
114
|
-
|
|
141
|
+
var total = el.getBoundingClientRect().height;
|
|
115
142
|
if (props.mode == 'inner') {
|
|
116
143
|
total = el.parentElement.parentElement.getBoundingClientRect().height;
|
|
117
144
|
}
|
|
118
|
-
|
|
145
|
+
var children = el.children;
|
|
119
146
|
if (el.children.length == 1 && el.children.item(0).classList.contains('ubox-content')) {
|
|
120
147
|
children = el.children.item(0).children;
|
|
121
148
|
}
|
|
122
|
-
for (
|
|
123
|
-
|
|
149
|
+
for (var i = 0, _i = children.length; i < _i; i++) {
|
|
150
|
+
var child = children.item(i);
|
|
124
151
|
if (child.classList.contains(HEIGHT_OMIT)) {
|
|
125
152
|
total -= child.getBoundingClientRect().height;
|
|
126
153
|
}
|
|
@@ -128,39 +155,45 @@ exports.Box = (0, react_1.forwardRef)((props, ref) => {
|
|
|
128
155
|
setState({ height: Math.floor(total) });
|
|
129
156
|
document.body.classList.remove('v-resizing');
|
|
130
157
|
};
|
|
131
|
-
(0, react_1.useEffect)(()
|
|
132
|
-
(0, react_1.useImperativeHandle)(ref, ()
|
|
133
|
-
(0, react_1.useLayoutEffect)(()
|
|
158
|
+
(0, react_1.useEffect)(function () { setTimeout(resize, 2); }, [app === null || app === void 0 ? void 0 : app.theme.contentHeight]);
|
|
159
|
+
(0, react_1.useImperativeHandle)(ref, function () { return ({ resize: resize }); }, []);
|
|
160
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
134
161
|
setTimeout(resize, 5);
|
|
135
162
|
}, []);
|
|
136
|
-
|
|
163
|
+
var paginationProps = {};
|
|
137
164
|
// if (props.pagination && props.mode == 'inner') {
|
|
138
165
|
// paginationProps.hideOnSinglePage = true;
|
|
139
166
|
// }
|
|
140
167
|
return react_1.default.createElement(Layout_1.Layout, { id: domId, className: utils_1.StringUtil.className(className, props.className), style: style, ref: _layoutRef },
|
|
141
|
-
props.selectBar && (0, _register_1.getSelectBar)(props.selectBar.type) != null && react_1.default.createElement(SelectBar_1.SelectBar,
|
|
142
|
-
|
|
168
|
+
props.selectBar && (0, _register_1.getSelectBar)(props.selectBar.type) != null && react_1.default.createElement(SelectBar_1.SelectBar, __assign({}, props.selectBar, { ref: selectRef, onSelect: function () {
|
|
169
|
+
var args = [];
|
|
170
|
+
for (var _a = 0; _a < arguments.length; _a++) {
|
|
171
|
+
args[_a] = arguments[_a];
|
|
172
|
+
}
|
|
173
|
+
return setState({ selected: args });
|
|
174
|
+
} })),
|
|
175
|
+
react_1.default.createElement(Layout_1.Layout.Content, { style: { overflow: props.overflowAuto ? 'auto' : 'hidden' }, ref: function () {
|
|
143
176
|
if (_layoutRef.current == null) {
|
|
144
|
-
|
|
177
|
+
var layout = document.getElementById(domId);
|
|
145
178
|
if (layout) {
|
|
146
179
|
_layoutRef.current = layout;
|
|
147
180
|
}
|
|
148
181
|
}
|
|
149
182
|
if (_layoutRef.current != null) {
|
|
150
|
-
|
|
183
|
+
var el = lodash_1.default.find(_layoutRef.current.children, function (item) { return lodash_1.default.toLower(item.tagName) == 'main'; });
|
|
151
184
|
if (el != null)
|
|
152
185
|
rootRef.current = el;
|
|
153
186
|
}
|
|
154
187
|
} },
|
|
155
188
|
(props.searchBar ||
|
|
156
189
|
(props.actionBar && ((lodash_1.default.isArray(props.actionBar) && props.actionBar.length > 0)
|
|
157
|
-
|| (!lodash_1.default.isArray(props.actionBar) && react_1.default.isValidElement(props.actionBar))))) && react_1.default.createElement(SearchBar_1.SearchBar,
|
|
190
|
+
|| (!lodash_1.default.isArray(props.actionBar) && react_1.default.isValidElement(props.actionBar))))) && react_1.default.createElement(SearchBar_1.SearchBar, __assign({}, props.searchBar, { default: props.default, className: HEIGHT_OMIT, onExpand: function (isExpand) {
|
|
158
191
|
resize();
|
|
159
192
|
if (lodash_1.default.isFunction(props.searchBar.onExpand)) {
|
|
160
193
|
props.searchBar.onExpand(isExpand);
|
|
161
194
|
}
|
|
162
195
|
} }), props.actionBar ? (lodash_1.default.isArray(props.actionBar) ? react_1.default.createElement(SearchBar_1.SearchBar.ActionButtons, { buttons: props.actionBar }) : props.actionBar) : []),
|
|
163
|
-
react_1.default.createElement(BoxContext.Provider, { value: { state, resize, root: contextRef, selectRef } },
|
|
196
|
+
react_1.default.createElement(BoxContext.Provider, { value: { state: state, resize: resize, root: contextRef, selectRef: selectRef } },
|
|
164
197
|
react_1.default.createElement("div", { className: 'ubox-content', ref: contextRef }, state != null && props.children)),
|
|
165
|
-
props.pagination && react_1.default.createElement(Upagination_1.UPagination,
|
|
198
|
+
props.pagination && react_1.default.createElement(Upagination_1.UPagination, __assign({}, paginationProps, props.pagination, { className: HEIGHT_OMIT }))));
|
|
166
199
|
});
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -22,25 +33,41 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
33
|
__setModuleDefault(result, mod);
|
|
23
34
|
return result;
|
|
24
35
|
};
|
|
36
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
37
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
38
|
+
if (!m) return o;
|
|
39
|
+
var i = m.call(o), r, ar = [], e;
|
|
40
|
+
try {
|
|
41
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
42
|
+
}
|
|
43
|
+
catch (error) { e = { error: error }; }
|
|
44
|
+
finally {
|
|
45
|
+
try {
|
|
46
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
47
|
+
}
|
|
48
|
+
finally { if (e) throw e.error; }
|
|
49
|
+
}
|
|
50
|
+
return ar;
|
|
51
|
+
};
|
|
25
52
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
53
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
54
|
};
|
|
28
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
56
|
exports.SelectBar = void 0;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
exports.SelectBar = (0, react_1.forwardRef)((props, ref)
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
var react_1 = __importStar(require("react"));
|
|
58
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
59
|
+
var antd_1 = require("antd");
|
|
60
|
+
var hooks_1 = require("../../hooks");
|
|
61
|
+
var utils_1 = require("../../utils");
|
|
62
|
+
var _register_1 = require("./_register");
|
|
63
|
+
var Const_1 = require("../_setup/Const");
|
|
64
|
+
var Icon_1 = require("../_adapt/Icon");
|
|
65
|
+
exports.SelectBar = (0, react_1.forwardRef)(function (props, ref) {
|
|
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];
|
|
41
68
|
// const setKeyword = _.debounce(_setKeyword, 100);
|
|
42
|
-
|
|
43
|
-
(0, react_1.useLayoutEffect)(()
|
|
69
|
+
var component = (0, _register_1.getSelectBar)(props.type);
|
|
70
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
44
71
|
if (lodash_1.default.isFunction(props.onSelectCollapse)) {
|
|
45
72
|
props.onSelectCollapse(collapsed);
|
|
46
73
|
}
|
|
@@ -51,24 +78,24 @@ exports.SelectBar = (0, react_1.forwardRef)((props, ref) => {
|
|
|
51
78
|
}
|
|
52
79
|
if (props.roleCode && !utils_1.PageUtil.hasRole(props.roleCode))
|
|
53
80
|
return utils_1.Const.NONE;
|
|
54
|
-
|
|
55
|
-
|
|
81
|
+
var width = lodash_1.default.isNumber(props.width) ? props.width : 250;
|
|
82
|
+
var renderContent = function () {
|
|
56
83
|
if (props.type == 'custom') {
|
|
57
84
|
if (!lodash_1.default.has(props, 'content')) {
|
|
58
85
|
return utils_1.Const.NONE;
|
|
59
86
|
}
|
|
60
87
|
// @ts-ignore
|
|
61
|
-
return react_1.default.createElement(props.content,
|
|
88
|
+
return react_1.default.createElement(props.content, __assign({}, props, { collapsed: collapsed, searchValue: keyword }));
|
|
62
89
|
}
|
|
63
|
-
return react_1.default.createElement(component.component,
|
|
90
|
+
return react_1.default.createElement(component.component, __assign({}, props, { collapsed: collapsed, searchValue: keyword, ref: ref }));
|
|
64
91
|
};
|
|
65
92
|
if (props.title === false)
|
|
66
93
|
return react_1.default.createElement(antd_1.Layout.Sider, { collapsed: false, width: width }, renderContent());
|
|
67
|
-
|
|
68
|
-
|
|
94
|
+
var title = utils_1.i18n.getText(props.ik, props.title);
|
|
95
|
+
var SearchAction = function (props) {
|
|
69
96
|
if (props.roleCode && !utils_1.PageUtil.hasRole(props.roleCode))
|
|
70
97
|
return utils_1.Const.NONE;
|
|
71
|
-
|
|
98
|
+
var iconProps = { type: props.icon, };
|
|
72
99
|
if (props.ik) {
|
|
73
100
|
iconProps.title = utils_1.i18n.txt(props.ik);
|
|
74
101
|
}
|
|
@@ -76,9 +103,9 @@ exports.SelectBar = (0, react_1.forwardRef)((props, ref) => {
|
|
|
76
103
|
iconProps.title = props.title;
|
|
77
104
|
}
|
|
78
105
|
if (props.confirm == null)
|
|
79
|
-
return react_1.default.createElement(Icon_1.Icon,
|
|
106
|
+
return react_1.default.createElement(Icon_1.Icon, __assign({}, iconProps, { onClick: props.onClick }));
|
|
80
107
|
return react_1.default.createElement(antd_1.Popconfirm, { placement: "right", title: props.confirm, onConfirm: props.onClick },
|
|
81
|
-
react_1.default.createElement(Icon_1.Icon,
|
|
108
|
+
react_1.default.createElement(Icon_1.Icon, __assign({}, iconProps, { evt: true })));
|
|
82
109
|
};
|
|
83
110
|
return react_1.default.createElement(antd_1.Layout.Sider, { className: 'c-selectbar-' + utils_1.GLOBAL.CONFIG.BOX.SELECT_CLOSE, collapsed: collapsed, collapsedWidth: utils_1.GLOBAL.CONFIG.BOX.SELECT_CLOSE == 2 ? 0 : 6, width: width },
|
|
84
111
|
react_1.default.createElement("div", { className: 'c-selectbar-closed', onClick: setCollapsed, title: utils_1.i18n.txt(Const_1.V.TXT_EXPAND) }),
|
|
@@ -86,8 +113,8 @@ exports.SelectBar = (0, react_1.forwardRef)((props, ref) => {
|
|
|
86
113
|
react_1.default.createElement("div", { className: 'c-selectbar-head' },
|
|
87
114
|
react_1.default.createElement("div", { className: 'c-selectbar-title' },
|
|
88
115
|
react_1.default.createElement(Icon_1.Icon, { type: "left-circle", title: utils_1.i18n.txt(Const_1.V.TXT_COLLAPSE), onClick: setCollapsed }),
|
|
89
|
-
props.filter && react_1.default.createElement("input", { onChange: evt
|
|
116
|
+
props.filter && react_1.default.createElement("input", { onChange: function (evt) { return utils_1.PageUtil.stopEvent(evt, function () { return setKeyword(evt.target.value); }); }, value: keyword, placeholder: utils_1.i18n.getText(props.ik, props.title) }),
|
|
90
117
|
!props.filter && react_1.default.createElement("span", null, title)),
|
|
91
|
-
react_1.default.createElement("div", { className: 'c-selectbar-action' }, (props.actions || []).map(item
|
|
118
|
+
react_1.default.createElement("div", { className: 'c-selectbar-action' }, (props.actions || []).map(function (item) { return react_1.default.createElement(SearchAction, __assign({}, item)); }))),
|
|
92
119
|
react_1.default.createElement("div", { className: 'c-selectbar-body' }, renderContent())));
|
|
93
120
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSelectBar = exports.registerSelectBar = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
var _Support_1 = require("../../utils/_Support");
|
|
5
|
+
var StringUtil_1 = require("../../utils/StringUtil");
|
|
6
|
+
var _RegisterUtil_1 = require("../_RegisterUtil");
|
|
7
|
+
var _C_SELECT_BAR = (0, _Support_1.globalDefault)('_C_SELECT_BAR', new Map());
|
|
8
|
+
var DEFAULT = { canSearch: false };
|
|
9
9
|
/**
|
|
10
10
|
* @param type
|
|
11
11
|
* 类型名称, 支持: VTable,STable,ApiTalbe,DataTable,Box
|
|
@@ -16,12 +16,14 @@ const DEFAULT = { canSearch: false };
|
|
|
16
16
|
* @param forceOverWrite
|
|
17
17
|
* 强制覆盖掉已注册的组件,默认重复注册相同的类型时,后注册的不能生效,使用 true 后,强㓡覆盖掉之前注册的组件
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
var registerSelectBar = function (type, component, options, forceOverWrite) {
|
|
20
|
+
if (options === void 0) { options = null; }
|
|
21
|
+
if (forceOverWrite === void 0) { forceOverWrite = false; }
|
|
20
22
|
(0, _RegisterUtil_1.register)(_C_SELECT_BAR, type, DEFAULT, component, options, forceOverWrite);
|
|
21
23
|
};
|
|
22
24
|
exports.registerSelectBar = registerSelectBar;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
var getSelectBar = function (type) {
|
|
26
|
+
var key = (0, StringUtil_1.trimLower)(type);
|
|
25
27
|
if (_C_SELECT_BAR.has(key))
|
|
26
28
|
return _C_SELECT_BAR.get(key);
|
|
27
29
|
return null;
|
package/components/Box/index.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -22,34 +33,50 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
33
|
__setModuleDefault(result, mod);
|
|
23
34
|
return result;
|
|
24
35
|
};
|
|
36
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
37
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
38
|
+
if (!m) return o;
|
|
39
|
+
var i = m.call(o), r, ar = [], e;
|
|
40
|
+
try {
|
|
41
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
42
|
+
}
|
|
43
|
+
catch (error) { e = { error: error }; }
|
|
44
|
+
finally {
|
|
45
|
+
try {
|
|
46
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
47
|
+
}
|
|
48
|
+
finally { if (e) throw e.error; }
|
|
49
|
+
}
|
|
50
|
+
return ar;
|
|
51
|
+
};
|
|
25
52
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
53
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
54
|
};
|
|
28
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
56
|
exports.SList = void 0;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
57
|
+
var react_1 = __importStar(require("react"));
|
|
58
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
59
|
+
var utils_1 = require("../../utils");
|
|
60
|
+
var Icon_1 = require("../_adapt/Icon");
|
|
61
|
+
var HighLight_1 = require("../_common/HighLight");
|
|
62
|
+
var antd_1 = require("antd");
|
|
63
|
+
var Item = function (props) { return react_1.default.createElement("div", { className: 'v-select-list-item', title: props.title }, props.children); };
|
|
64
|
+
var ItemIcon = function (props) {
|
|
65
|
+
var value = props.value;
|
|
39
66
|
if (lodash_1.default.isString(value)) {
|
|
40
67
|
return react_1.default.createElement(Icon_1.Icon, { className: 'v-select-list-item-icon', type: value });
|
|
41
68
|
}
|
|
42
69
|
if (lodash_1.default.isPlainObject(value)) {
|
|
43
|
-
|
|
44
|
-
if (!lodash_1.default.isString(
|
|
70
|
+
var props_1 = __assign({}, value);
|
|
71
|
+
if (!lodash_1.default.isString(props_1.type) || props_1.type == null || props_1.type == '')
|
|
45
72
|
return utils_1.Const.NONE;
|
|
46
|
-
if (
|
|
47
|
-
|
|
73
|
+
if (props_1.className) {
|
|
74
|
+
props_1.className = props_1.className + ' v-select-list-item-icon';
|
|
48
75
|
}
|
|
49
76
|
else {
|
|
50
|
-
|
|
77
|
+
props_1.className = 'v-select-list-item-icon';
|
|
51
78
|
}
|
|
52
|
-
return react_1.default.createElement(Icon_1.Icon,
|
|
79
|
+
return react_1.default.createElement(Icon_1.Icon, __assign({}, props_1));
|
|
53
80
|
}
|
|
54
81
|
if (react_1.default.isValidElement(value)) {
|
|
55
82
|
return value;
|
|
@@ -57,22 +84,22 @@ const ItemIcon = props => {
|
|
|
57
84
|
return utils_1.Const.NONE;
|
|
58
85
|
//
|
|
59
86
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return (item, searchValue)
|
|
87
|
+
var buildRenderByRender = function (props) {
|
|
88
|
+
var titleField = props.titleField, renders = props.renders;
|
|
89
|
+
var hasIcon = lodash_1.default.isFunction(renders.icon);
|
|
90
|
+
var hasAction = lodash_1.default.isFunction(renders.action);
|
|
91
|
+
var hasValue = !hasAction && lodash_1.default.isFunction(renders.value);
|
|
92
|
+
return function (item, searchValue) { return react_1.default.createElement(Item, { title: item[titleField] },
|
|
66
93
|
hasIcon && react_1.default.createElement(ItemIcon, { value: renders.icon(item, searchValue) }),
|
|
67
94
|
react_1.default.createElement("span", { className: 'v-select-list-item-title' }, renders.title(item, searchValue)),
|
|
68
95
|
hasAction && react_1.default.createElement("span", { className: 'v-select-list-item-action' }, renders.action(item, searchValue)),
|
|
69
|
-
hasValue && react_1.default.createElement("span", { className: 'v-select-list-item-value' }, renders.value(item, searchValue)));
|
|
96
|
+
hasValue && react_1.default.createElement("span", { className: 'v-select-list-item-value' }, renders.value(item, searchValue))); };
|
|
70
97
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return (item, searchValue)
|
|
98
|
+
var buildRenderByField = function (props) {
|
|
99
|
+
var iconField = props.iconField || null;
|
|
100
|
+
var valueField = props.valueField || null;
|
|
101
|
+
var titleField = props.titleField;
|
|
102
|
+
return function (item, searchValue) {
|
|
76
103
|
if (searchValue) {
|
|
77
104
|
return react_1.default.createElement(Item, { title: item[titleField] },
|
|
78
105
|
(iconField && item[iconField]) && react_1.default.createElement(Icon_1.Icon, { className: 'v-select-list-item-icon', type: item[iconField] }),
|
|
@@ -87,29 +114,30 @@ const buildRenderByField = (props) => {
|
|
|
87
114
|
};
|
|
88
115
|
};
|
|
89
116
|
// export const SList: React.FC<SListPorps> = memo((props) => {
|
|
90
|
-
exports.SList = (0, react_1.memo)((props)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
117
|
+
exports.SList = (0, react_1.memo)(function (props) {
|
|
118
|
+
var searchValue = props.searchValue, onSelect = props.onSelect, keyField = props.keyField;
|
|
119
|
+
var _a = __read((0, react_1.useState)((lodash_1.default.has(props, 'list') && lodash_1.default.isArray(props.list)) ? props.list : []), 2), list = _a[0], setList = _a[1];
|
|
120
|
+
var _b = __read((0, react_1.useState)(null), 2), selected = _b[0], setSelected = _b[1];
|
|
121
|
+
var render = (0, react_1.useMemo)(function () {
|
|
95
122
|
if (lodash_1.default.isFunction(props.itemRender))
|
|
96
123
|
return props.itemRender;
|
|
97
124
|
if (lodash_1.default.has(props, 'renders') && lodash_1.default.isFunction(props.renders.title))
|
|
98
125
|
return buildRenderByRender(props);
|
|
99
126
|
return buildRenderByField(props);
|
|
100
127
|
}, []);
|
|
101
|
-
(0, react_1.useLayoutEffect)(()
|
|
102
|
-
|
|
128
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
129
|
+
var all = (lodash_1.default.has(props, 'list') && lodash_1.default.isArray(props.list)) ? props.list : [];
|
|
103
130
|
if (searchValue == null || searchValue == '') {
|
|
104
131
|
setList(all);
|
|
105
132
|
return;
|
|
106
133
|
}
|
|
107
|
-
setList(lodash_1.default.filter(all, item
|
|
108
|
-
|
|
134
|
+
setList(lodash_1.default.filter(all, function (item) {
|
|
135
|
+
var title = lodash_1.default.toLower(item[props.titleField]);
|
|
109
136
|
return title.indexOf(searchValue) >= 0;
|
|
110
137
|
}));
|
|
111
138
|
}, [searchValue, props.list]);
|
|
112
|
-
(0, react_1.useLayoutEffect)(()
|
|
139
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
140
|
+
var _a;
|
|
113
141
|
if (list == null || list.length == 0) {
|
|
114
142
|
if (selected != null)
|
|
115
143
|
setSelected(null);
|
|
@@ -118,12 +146,12 @@ exports.SList = (0, react_1.memo)((props) => {
|
|
|
118
146
|
if (!props.mustSelect)
|
|
119
147
|
return;
|
|
120
148
|
if (selected != null) {
|
|
121
|
-
|
|
149
|
+
var find = lodash_1.default.find(list, (_a = {}, _a[keyField] = selected, _a));
|
|
122
150
|
if (find != null) {
|
|
123
151
|
return;
|
|
124
152
|
}
|
|
125
153
|
}
|
|
126
|
-
|
|
154
|
+
var item = list[0];
|
|
127
155
|
if (lodash_1.default.isFunction(props.mustSelect)) {
|
|
128
156
|
item = props.mustSelect(list);
|
|
129
157
|
}
|
|
@@ -134,9 +162,9 @@ exports.SList = (0, react_1.memo)((props) => {
|
|
|
134
162
|
setSelected(item[keyField]);
|
|
135
163
|
onSelect(item[keyField], item);
|
|
136
164
|
}, [list]);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
165
|
+
var listProps = (0, react_1.useMemo)(function () {
|
|
166
|
+
var clazz = ['c-selectbar-list'];
|
|
167
|
+
var listProps = { size: "small", style: props.style };
|
|
140
168
|
if (lodash_1.default.isFunction(props.onSelect))
|
|
141
169
|
clazz.push('c-selectbar-list-canselect');
|
|
142
170
|
if (props.className)
|
|
@@ -144,21 +172,21 @@ exports.SList = (0, react_1.memo)((props) => {
|
|
|
144
172
|
listProps.className = clazz.join(' ');
|
|
145
173
|
return listProps;
|
|
146
174
|
}, [props.className]);
|
|
147
|
-
|
|
175
|
+
var renderItem = function (item) {
|
|
148
176
|
if (!lodash_1.default.isFunction(props.onSelect))
|
|
149
177
|
return react_1.default.createElement(antd_1.List.Item, null, render(item, searchValue));
|
|
150
|
-
return react_1.default.createElement(antd_1.List.Item, { className: item[keyField] == selected ? 'c-selectbar-list-selected' : '', onClick: evt
|
|
178
|
+
return react_1.default.createElement(antd_1.List.Item, { className: item[keyField] == selected ? 'c-selectbar-list-selected' : '', onClick: function (evt) {
|
|
151
179
|
utils_1.PageUtil.stopEvent(evt);
|
|
152
180
|
setSelected(item[keyField]);
|
|
153
181
|
onSelect(item[keyField], item);
|
|
154
182
|
} }, render(item, searchValue));
|
|
155
183
|
};
|
|
156
|
-
return react_1.default.createElement(antd_1.List,
|
|
157
|
-
}, (prev, next)
|
|
184
|
+
return react_1.default.createElement(antd_1.List, __assign({}, listProps, { dataSource: list, renderItem: renderItem }));
|
|
185
|
+
}, function (prev, next) {
|
|
158
186
|
if (prev.searchValue != next.searchValue)
|
|
159
187
|
return false;
|
|
160
|
-
|
|
161
|
-
|
|
188
|
+
var plist = (lodash_1.default.has(prev, 'list') && lodash_1.default.isArray(prev.list)) ? prev.list : [];
|
|
189
|
+
var nlist = (lodash_1.default.has(next, 'list') && lodash_1.default.isArray(next.list)) ? next.list : [];
|
|
162
190
|
if (plist.length != nlist.length)
|
|
163
191
|
return false;
|
|
164
192
|
return plist == nlist;
|