tntd 3.0.0-beta.10 → 3.0.0-beta.11
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/es/modal/style/confirm.less +6 -6
- package/es/query-form/Field/Checkbox.js +1 -1
- package/es/query-form/Field/Checkbox.js.map +1 -1
- package/es/query-form/Field/Composition/FieldPopover.js +53 -34
- package/es/query-form/Field/Composition/FieldPopover.js.map +1 -1
- package/es/query-form/Field/Composition/Select.js +17 -14
- package/es/query-form/Field/Composition/Select.js.map +1 -1
- package/es/query-form/Field/Composition/index.js +16 -105
- package/es/query-form/Field/Composition/index.js.map +1 -1
- package/es/query-form/Field/Composition/index.less +0 -1
- package/es/query-form/Field/Composition/utils.js +107 -0
- package/es/query-form/Field/Composition/utils.js.map +1 -1
- package/es/query-form/index.js +145 -319
- package/es/query-form/index.js.map +1 -1
- package/es/query-form/index.less +16 -56
- package/es/query-form2/Field/Checkbox.js +23 -0
- package/es/query-form2/Field/Checkbox.js.map +1 -0
- package/es/query-form2/Field/Composition/FieldPopover.js +308 -0
- package/es/query-form2/Field/Composition/FieldPopover.js.map +1 -0
- package/es/query-form2/Field/Composition/FieldPopover.less +35 -0
- package/es/query-form2/Field/Composition/Select.js +104 -0
- package/es/query-form2/Field/Composition/Select.js.map +1 -0
- package/es/query-form2/Field/Composition/index.js +299 -0
- package/es/query-form2/Field/Composition/index.js.map +1 -0
- package/es/query-form2/Field/Composition/index.less +114 -0
- package/es/query-form2/Field/Composition/utils.js +19 -0
- package/es/query-form2/Field/Composition/utils.js.map +1 -0
- package/es/query-form2/Field/Select.js +59 -0
- package/es/query-form2/Field/Select.js.map +1 -0
- package/es/query-form2/Field/SelectInput.js +87 -0
- package/es/query-form2/Field/SelectInput.js.map +1 -0
- package/es/query-form2/Field/fieldsMap.js +28 -0
- package/es/query-form2/Field/fieldsMap.js.map +1 -0
- package/es/query-form2/Field/index.js +117 -0
- package/es/query-form2/Field/index.js.map +1 -0
- package/es/query-form2/createActions.js +47 -0
- package/es/query-form2/createActions.js.map +1 -0
- package/es/query-form2/index.js +345 -0
- package/es/query-form2/index.js.map +1 -0
- package/es/query-form2/index.less +136 -0
- package/es/query-form2/useForm.js +6 -0
- package/es/query-form2/useForm.js.map +1 -0
- package/es/query-list-scene/QueryForm.js +1 -3
- package/es/query-list-scene/QueryForm.js.map +1 -1
- package/es/select/select.less +1 -0
- package/es/tag/color.less +28 -18
- package/es/tag/tag.less +42 -6
- package/lib/modal/style/confirm.less +6 -6
- package/lib/query-form/Field/Checkbox.js +1 -1
- package/lib/query-form/Field/Checkbox.js.map +1 -1
- package/lib/query-form/Field/Composition/FieldPopover.js +83 -65
- package/lib/query-form/Field/Composition/FieldPopover.js.map +1 -1
- package/lib/query-form/Field/Composition/Select.d.ts.map +1 -1
- package/lib/query-form/Field/Composition/Select.js +18 -15
- package/lib/query-form/Field/Composition/Select.js.map +1 -1
- package/lib/query-form/Field/Composition/index.d.ts +0 -4
- package/lib/query-form/Field/Composition/index.js +29 -121
- package/lib/query-form/Field/Composition/index.js.map +1 -1
- package/lib/query-form/Field/Composition/index.less +0 -1
- package/lib/query-form/Field/Composition/utils.d.ts +16 -0
- package/lib/query-form/Field/Composition/utils.d.ts.map +1 -1
- package/lib/query-form/Field/Composition/utils.js +114 -0
- package/lib/query-form/Field/Composition/utils.js.map +1 -1
- package/lib/query-form/index.d.ts +15 -24
- package/lib/query-form/index.d.ts.map +1 -1
- package/lib/query-form/index.js +164 -344
- package/lib/query-form/index.js.map +1 -1
- package/lib/query-form/index.less +16 -56
- package/lib/query-form2/Field/Checkbox.d.ts +8 -0
- package/lib/query-form2/Field/Checkbox.d.ts.map +1 -0
- package/lib/query-form2/Field/Checkbox.js +28 -0
- package/lib/query-form2/Field/Checkbox.js.map +1 -0
- package/lib/query-form2/Field/Composition/FieldPopover.d.ts +19 -0
- package/lib/query-form2/Field/Composition/FieldPopover.d.ts.map +1 -0
- package/lib/query-form2/Field/Composition/FieldPopover.js +347 -0
- package/lib/query-form2/Field/Composition/FieldPopover.js.map +1 -0
- package/lib/query-form2/Field/Composition/FieldPopover.less +35 -0
- package/lib/query-form2/Field/Composition/Select.d.ts +4 -0
- package/lib/query-form2/Field/Composition/Select.d.ts.map +1 -0
- package/lib/query-form2/Field/Composition/Select.js +128 -0
- package/lib/query-form2/Field/Composition/Select.js.map +1 -0
- package/lib/query-form2/Field/Composition/index.d.ts +14 -0
- package/lib/query-form2/Field/Composition/index.d.ts.map +1 -0
- package/lib/query-form2/Field/Composition/index.js +349 -0
- package/lib/query-form2/Field/Composition/index.js.map +1 -0
- package/lib/query-form2/Field/Composition/index.less +114 -0
- package/lib/query-form2/Field/Composition/utils.d.ts +6 -0
- package/lib/query-form2/Field/Composition/utils.d.ts.map +1 -0
- package/lib/query-form2/Field/Composition/utils.js +27 -0
- package/lib/query-form2/Field/Composition/utils.js.map +1 -0
- package/lib/query-form2/Field/Select.d.ts +4 -0
- package/lib/query-form2/Field/Select.d.ts.map +1 -0
- package/lib/query-form2/Field/Select.js +80 -0
- package/lib/query-form2/Field/Select.js.map +1 -0
- package/lib/query-form2/Field/SelectInput.d.ts +4 -0
- package/lib/query-form2/Field/SelectInput.d.ts.map +1 -0
- package/lib/query-form2/Field/SelectInput.js +100 -0
- package/lib/query-form2/Field/SelectInput.js.map +1 -0
- package/lib/query-form2/Field/fieldsMap.d.ts +27 -0
- package/lib/query-form2/Field/fieldsMap.d.ts.map +1 -0
- package/lib/query-form2/Field/fieldsMap.js +35 -0
- package/lib/query-form2/Field/fieldsMap.js.map +1 -0
- package/lib/query-form2/Field/index.d.ts +14 -0
- package/lib/query-form2/Field/index.d.ts.map +1 -0
- package/lib/query-form2/Field/index.js +147 -0
- package/lib/query-form2/Field/index.js.map +1 -0
- package/lib/query-form2/createActions.d.ts +14 -0
- package/lib/query-form2/createActions.d.ts.map +1 -0
- package/lib/query-form2/createActions.js +54 -0
- package/lib/query-form2/createActions.js.map +1 -0
- package/lib/query-form2/index.d.ts +36 -0
- package/lib/query-form2/index.d.ts.map +1 -0
- package/lib/query-form2/index.js +385 -0
- package/lib/query-form2/index.js.map +1 -0
- package/lib/query-form2/index.less +136 -0
- package/lib/query-form2/useForm.d.ts +13 -0
- package/lib/query-form2/useForm.d.ts.map +1 -0
- package/lib/query-form2/useForm.js +13 -0
- package/lib/query-form2/useForm.js.map +1 -0
- package/lib/query-list-scene/QueryForm.js +2 -3
- package/lib/query-list-scene/QueryForm.js.map +1 -1
- package/lib/select/select.less +1 -0
- package/lib/tag/color.less +28 -18
- package/lib/tag/tag.less +42 -6
- package/package.json +1 -1
|
@@ -13,11 +13,6 @@
|
|
|
13
13
|
|
|
14
14
|
.@{ant-prefix}-modal-body {
|
|
15
15
|
padding: @padding-base;
|
|
16
|
-
|
|
17
|
-
.anticon {
|
|
18
|
-
font-size: @heading-2-size;
|
|
19
|
-
margin-right: @margin-xs;
|
|
20
|
-
}
|
|
21
16
|
}
|
|
22
17
|
|
|
23
18
|
&-body-wrapper {
|
|
@@ -32,12 +27,17 @@
|
|
|
32
27
|
overflow: hidden;
|
|
33
28
|
color: @heading-color;
|
|
34
29
|
font-weight: 500;
|
|
35
|
-
font-size: @
|
|
30
|
+
font-size: @font-size-lg;
|
|
36
31
|
line-height: @heading-3-line-height;
|
|
37
32
|
font-family: PingFang SC;
|
|
38
33
|
margin: @margin-xxs 0;
|
|
39
34
|
}
|
|
40
35
|
|
|
36
|
+
.anticon {
|
|
37
|
+
font-size: @heading-2-size;
|
|
38
|
+
margin-right: @margin-xs;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
41
|
.@{confirm-prefix-cls}-content {
|
|
42
42
|
margin-top: @margin-xxs;
|
|
43
43
|
color: @text-color-secondary;
|
|
@@ -15,7 +15,7 @@ export default (_a => {
|
|
|
15
15
|
} = _a,
|
|
16
16
|
props = __rest(_a, ["value", "onChange"]);
|
|
17
17
|
return React.createElement(Checkbox, Object.assign({}, props, {
|
|
18
|
-
checked: value,
|
|
18
|
+
checked: !!value,
|
|
19
19
|
onChange: evt => {
|
|
20
20
|
onChange === null || onChange === void 0 ? void 0 : onChange(evt.target.checked);
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/query-form/Field/Checkbox.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AAErC,eAAe,CAAC,EAA6B,EAAE,EAAE;QAAjC,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,cAA3B,qBAA6B,CAAF;IAAO,OAAA,CAChD,oBAAC,QAAQ,oBACH,KAAK,IACT,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/query-form/Field/Checkbox.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AAErC,eAAe,CAAC,EAA6B,EAAE,EAAE;QAAjC,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,cAA3B,qBAA6B,CAAF;IAAO,OAAA,CAChD,oBAAC,QAAQ,oBACH,KAAK,IACT,OAAO,EAAE,CAAC,CAAC,KAAK,EAChB,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;YAChB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAChC,CAAC,IACD,CACH,CAAA;CAAA,CAAA","sourcesContent":["import React from 'react'\n\nimport Checkbox from '../../checkbox'\n\nexport default ({ value, onChange, ...props }) => (\n <Checkbox\n {...props}\n checked={!!value}\n onChange={(evt) => {\n onChange?.(evt.target.checked)\n }}\n />\n)\n"]}
|
|
@@ -11,7 +11,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
11
11
|
import React, { useEffect, useState, forwardRef, useImperativeHandle } from 'react';
|
|
12
12
|
import Popover from '../../../popover';
|
|
13
13
|
import SelectOpt from './Select';
|
|
14
|
-
import { highlightSubstring, getLabelFromOptions } from './utils';
|
|
14
|
+
import { highlightSubstring, getLabelFromOptions, getLabelByValue, formatLabel } from './utils';
|
|
15
15
|
import fieldsMap, { getFieldWidth } from '../fieldsMap';
|
|
16
16
|
import './FieldPopover.less';
|
|
17
17
|
const isInput = type => ['input', 'string', 'search', 'number', 'inputNumber'].includes(type);
|
|
@@ -42,8 +42,8 @@ const FieldPopover = (_a, ref) => {
|
|
|
42
42
|
if (!(copyValue === null || copyValue === void 0 ? void 0 : copyValue.find(v => v.key === props.name))) {
|
|
43
43
|
copyValue.push({
|
|
44
44
|
key: props.name,
|
|
45
|
-
value: type === 'array' ? [] :
|
|
46
|
-
closable:
|
|
45
|
+
value: type === 'array' ? [] : undefined,
|
|
46
|
+
closable: true,
|
|
47
47
|
label: (props.propsTitle || props.title || props.name) + ':'
|
|
48
48
|
});
|
|
49
49
|
}
|
|
@@ -62,13 +62,15 @@ const FieldPopover = (_a, ref) => {
|
|
|
62
62
|
onPropsClick
|
|
63
63
|
}));
|
|
64
64
|
const onSelectChange = (v, isMultiple) => {
|
|
65
|
-
var _a, _b, _c, _d, _e, _f
|
|
65
|
+
var _a, _b, _c, _d, _e, _f;
|
|
66
|
+
const propObj = (v === null || v === void 0 ? void 0 : v.propItem) || propItem || {};
|
|
66
67
|
const {
|
|
67
68
|
props: fieldProps
|
|
68
|
-
} =
|
|
69
|
+
} = propObj; // 直接搜索拿v.xx的值
|
|
69
70
|
const copyValue = _cloneDeep(value || []);
|
|
70
71
|
let index;
|
|
71
72
|
if (v === null || v === void 0 ? void 0 : v.propItem) {
|
|
73
|
+
// 模糊搜索
|
|
72
74
|
const _index = copyValue.findIndex(vv => {
|
|
73
75
|
var _a;
|
|
74
76
|
return vv.key === ((_a = v.propItem) === null || _a === void 0 ? void 0 : _a.name);
|
|
@@ -78,35 +80,48 @@ const FieldPopover = (_a, ref) => {
|
|
|
78
80
|
} else {
|
|
79
81
|
copyValue.push({
|
|
80
82
|
key: (_a = v.propItem) === null || _a === void 0 ? void 0 : _a.name,
|
|
81
|
-
value: isMultiple ? [] : ''
|
|
82
|
-
label: (((_b = v.propItem) === null || _b === void 0 ? void 0 : _b.propsTitle) || ((_c = v.propItem) === null || _c === void 0 ? void 0 : _c.title) || ((_d = v.propItem) === null || _d === void 0 ? void 0 : _d.name)) + ':'
|
|
83
|
+
value: isMultiple ? [] : ''
|
|
83
84
|
});
|
|
84
85
|
index = copyValue.length - 1;
|
|
85
86
|
}
|
|
86
87
|
setFieldItem(v.propItem);
|
|
87
88
|
} else {
|
|
89
|
+
// 选择值
|
|
88
90
|
index = copyValue.findIndex(v => v.key === (propItem === null || propItem === void 0 ? void 0 : propItem.name));
|
|
89
91
|
}
|
|
90
92
|
if (isMultiple) {
|
|
91
|
-
if (!((
|
|
92
|
-
copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + (v === null || v === void 0 ? void 0 : v.label);
|
|
93
|
+
if (!((_c = (_b = copyValue[index]) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
93
94
|
copyValue[index].value = [v === null || v === void 0 ? void 0 : v.value];
|
|
94
95
|
} else {
|
|
95
|
-
if (((
|
|
96
|
+
if (((_d = copyValue[index].value) === null || _d === void 0 ? void 0 : _d.indexOf(v.value)) > -1) {
|
|
96
97
|
copyValue[index].value = copyValue[index].value.filter(val => val !== v.value);
|
|
97
|
-
const regex = new RegExp(`\\|?${v.label}`, 'g'); //new RegExp(`\\|?${variable}`, 'g')
|
|
98
|
-
const result = copyValue[index].label.replace(regex, '');
|
|
99
|
-
copyValue[index].label = result;
|
|
100
98
|
} else {
|
|
101
99
|
copyValue[index].value.push(v.value);
|
|
102
|
-
copyValue[index].label += ' | ' + (v === null || v === void 0 ? void 0 : v.label);
|
|
103
100
|
}
|
|
104
101
|
}
|
|
102
|
+
// 如果是模糊搜索-展开多选项
|
|
103
|
+
if (v === null || v === void 0 ? void 0 : v.propItem) {
|
|
104
|
+
setFieldItem(v === null || v === void 0 ? void 0 : v.propItem);
|
|
105
|
+
setVisible(true);
|
|
106
|
+
setPopoverContent(true);
|
|
107
|
+
}
|
|
105
108
|
} else {
|
|
106
109
|
copyValue[index].value = v === null || v === void 0 ? void 0 : v.value;
|
|
107
|
-
copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + (v === null || v === void 0 ? void 0 : v.label);
|
|
108
110
|
close();
|
|
109
111
|
}
|
|
112
|
+
const labelPrefix = `${propObj.propsTitle || propObj.title || propObj.name}: `;
|
|
113
|
+
if (propObj.setLabel) {
|
|
114
|
+
copyValue[index].label = labelPrefix + propObj.setLabel(copyValue[index].value);
|
|
115
|
+
} else {
|
|
116
|
+
copyValue[index].label = labelPrefix + getLabelByValue({
|
|
117
|
+
value: copyValue[index].value,
|
|
118
|
+
options: ((_e = propObj.props) === null || _e === void 0 ? void 0 : _e.options) || v.options,
|
|
119
|
+
fieldNames: ((_f = propObj.props) === null || _f === void 0 ? void 0 : _f.fieldNames) || {
|
|
120
|
+
label: 'label',
|
|
121
|
+
value: 'value'
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
110
125
|
copyValue[index].closable = true;
|
|
111
126
|
onChange(copyValue, false, true);
|
|
112
127
|
(fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
|
|
@@ -117,7 +132,10 @@ const FieldPopover = (_a, ref) => {
|
|
|
117
132
|
type,
|
|
118
133
|
component,
|
|
119
134
|
props: fieldProps,
|
|
120
|
-
setLabel
|
|
135
|
+
setLabel,
|
|
136
|
+
propsTitle,
|
|
137
|
+
title,
|
|
138
|
+
name
|
|
121
139
|
} = propItem || {};
|
|
122
140
|
const {
|
|
123
141
|
options
|
|
@@ -125,11 +143,15 @@ const FieldPopover = (_a, ref) => {
|
|
|
125
143
|
const copyValue = _cloneDeep(value);
|
|
126
144
|
const index = copyValue.findIndex(v => v.key === (propItem === null || propItem === void 0 ? void 0 : propItem.name));
|
|
127
145
|
copyValue[index].value = args[0];
|
|
128
|
-
|
|
129
|
-
|
|
146
|
+
const labelPrefix = `${propsTitle || title || name}: `;
|
|
147
|
+
if (setLabel) {
|
|
148
|
+
// setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制
|
|
149
|
+
copyValue[index].label = labelPrefix + setLabel(args[0]);
|
|
150
|
+
} else if (type === 'date') {
|
|
151
|
+
copyValue[index].label = labelPrefix + args[1];
|
|
130
152
|
close();
|
|
131
153
|
} else if (type === 'dateRange') {
|
|
132
|
-
copyValue[index].label =
|
|
154
|
+
copyValue[index].label = labelPrefix + ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.join('~'));
|
|
133
155
|
if ((_b = args[1]) === null || _b === void 0 ? void 0 : _b[1]) {
|
|
134
156
|
close();
|
|
135
157
|
}
|
|
@@ -139,15 +161,10 @@ const FieldPopover = (_a, ref) => {
|
|
|
139
161
|
const label = getLabelFromOptions(key, options);
|
|
140
162
|
copyValue[index].label = `${label}: ${val}`;
|
|
141
163
|
} else if (type === 'checkbox') {
|
|
142
|
-
copyValue[index].label =
|
|
164
|
+
copyValue[index].label = labelPrefix + (args[0] ? locale.yes : locale.no);
|
|
143
165
|
close();
|
|
144
166
|
} else if (!type && component) {
|
|
145
|
-
|
|
146
|
-
// setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制
|
|
147
|
-
copyValue[index].label = setLabel(args[0]);
|
|
148
|
-
} else {
|
|
149
|
-
copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + (args[1] || args[0]);
|
|
150
|
-
}
|
|
167
|
+
copyValue[index].label = labelPrefix + (args[1] || args[0]);
|
|
151
168
|
close();
|
|
152
169
|
}
|
|
153
170
|
copyValue[index].closable = true;
|
|
@@ -156,7 +173,10 @@ const FieldPopover = (_a, ref) => {
|
|
|
156
173
|
};
|
|
157
174
|
const close = () => {
|
|
158
175
|
setVisible(false);
|
|
159
|
-
|
|
176
|
+
setTimeout(() => {
|
|
177
|
+
setFieldItem();
|
|
178
|
+
setPopoverContent(false);
|
|
179
|
+
}, 1);
|
|
160
180
|
};
|
|
161
181
|
const handleVisibleChange = () => {
|
|
162
182
|
if (!visible && !regex.test(searchText)) {
|
|
@@ -186,7 +206,7 @@ const FieldPopover = (_a, ref) => {
|
|
|
186
206
|
const target = sOptions === null || sOptions === void 0 ? void 0 : sOptions.find(item => {
|
|
187
207
|
const labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
|
|
188
208
|
const label = item instanceof Object ? item[labelKey] : item + '';
|
|
189
|
-
return (label
|
|
209
|
+
return (React.isValidElement(label) ? formatLabel(label) : label).indexOf(searchText) > -1;
|
|
190
210
|
});
|
|
191
211
|
if (target) {
|
|
192
212
|
bool2 = true;
|
|
@@ -200,7 +220,7 @@ const FieldPopover = (_a, ref) => {
|
|
|
200
220
|
setSearchTarget(undefined);
|
|
201
221
|
}
|
|
202
222
|
}, [fieldItems, searchText, propItem]);
|
|
203
|
-
const renderFirstOptions =
|
|
223
|
+
const renderFirstOptions = () => {
|
|
204
224
|
return React.createElement("div", null, (!searchText || (searchTarget === null || searchTarget === void 0 ? void 0 : searchTarget.propsTitle)) && React.createElement("label", null, locale.propTitle), React.createElement("ul", {
|
|
205
225
|
className: "ant-select-dropdown-menu"
|
|
206
226
|
}, fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.map(v => {
|
|
@@ -239,9 +259,7 @@ const FieldPopover = (_a, ref) => {
|
|
|
239
259
|
onPropsClick(v.props);
|
|
240
260
|
}
|
|
241
261
|
}, _propsTitle);
|
|
242
|
-
})), searchText && React.createElement("div", null, (searchTarget === null || searchTarget === void 0 ? void 0 : searchTarget.propsValue) && React.createElement("label", null, locale.propValue),
|
|
243
|
-
className: "ant-select-dropdown-menu"
|
|
244
|
-
}, fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.map(v => {
|
|
262
|
+
})), searchText && React.createElement("div", null, (searchTarget === null || searchTarget === void 0 ? void 0 : searchTarget.propsValue) && React.createElement("label", null, locale.propValue), fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.map(v => {
|
|
245
263
|
const {
|
|
246
264
|
name,
|
|
247
265
|
propsTitle,
|
|
@@ -249,7 +267,8 @@ const FieldPopover = (_a, ref) => {
|
|
|
249
267
|
props
|
|
250
268
|
} = v.props || {};
|
|
251
269
|
const target = value === null || value === void 0 ? void 0 : value.find(v => v.key === name);
|
|
252
|
-
if (type === 'select'
|
|
270
|
+
if (type === 'select') {
|
|
271
|
+
// && props?.options?.length > 0
|
|
253
272
|
return React.createElement(SelectOpt, Object.assign({
|
|
254
273
|
key: name
|
|
255
274
|
}, props, {
|
|
@@ -260,7 +279,7 @@ const FieldPopover = (_a, ref) => {
|
|
|
260
279
|
}));
|
|
261
280
|
}
|
|
262
281
|
return;
|
|
263
|
-
})))
|
|
282
|
+
})));
|
|
264
283
|
};
|
|
265
284
|
const renderSecondOptions = () => {
|
|
266
285
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldPopover.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/FieldPopover.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClC,OAAO,OAAO,MAAM,kBAAkB,CAAA;AACtC,OAAO,SAAS,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAE5B,OAAO,SAAS,EAAE,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACvD,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E,cAAc,EAAE,KAAK,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,IAAI,CACnG,CAAC,CAAC,CAAC,CACF,6BAAK,SAAS,EAAE,GAAG,SAAS,wBAAwB,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE;gBACvF,oBAAC,KAAK,kBACJ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,IAChB,UAAU,IACd,KAAK,kCACA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,KACpB,KAAK,EAAE,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,0CAAE,KAAK,KAAI,aAAa,CAAC,IAAI,CAAC,KAExD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,IACvB,CACE,CACP,CACG,CACP,CAAA;IACH,CAAC,CAAA;IAED,OAAO,CACL,oBAAC,OAAO,kBACN,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,QAAQ,EAClB,gBAAgB,EAAE,GAAG,SAAS,gBAAgB,EAC9C,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,mBAAmB,EAAE,EACvE,eAAe,EAAE,mBAAmB,IAChC,KAAK,GAER,QAAQ,CACD,CACX,CAAA;AACH,CAAC,CAAA;AACD,eAAe,UAAU,CAAC,YAAY,CAAC,CAAA","sourcesContent":["import React, { useEffect, useState, forwardRef, useImperativeHandle } from 'react'\nimport { cloneDeep } from 'lodash'\nimport Popover from '../../../popover'\nimport SelectOpt from './Select'\nimport { highlightSubstring, getLabelFromOptions } from './utils'\nimport { get } from 'lodash'\n\nimport fieldsMap, { getFieldWidth } from '../fieldsMap'\nimport './FieldPopover.less'\nconst isInput = (type) => ['input', 'string', 'search', 'number', 'inputNumber'].includes(type)\n\nconst FieldPopover = ({\n visible,\n setVisible,\n searchText,\n children,\n value,\n regex,\n fieldItems,\n propItem,\n setFieldItem,\n onChange,\n form,\n locale,\n clsPrefix,\n ...props\n}, ref) => {\n\n const [searchTarget, setSearchTarget] = useState(undefined)\n const [popoverContent, setPopoverContent] = useState(false)\n\n const onPropsClick = (props) => {\n const { type = 'input' } = props || {}\n const copyValue = cloneDeep(value)\n if (!copyValue?.find((v) => v.key === props.name)) {\n copyValue.push({\n key: props.name,\n value: type === 'array' ? [] : '',\n closable: false,\n label: (props.propsTitle || props.title || props.name) + ':',\n })\n }\n setFieldItem(props)\n if (isInput(type)) {\n const target = copyValue.find((v) => v.key === props.name)\n onChange(target, true)\n close()\n return\n }\n setVisible(true)\n setPopoverContent(true)\n onChange(copyValue)\n }\n\n useImperativeHandle(ref, () => ({\n onPropsClick,\n }))\n\n const onSelectChange = (v, isMultiple) => {\n const { props: fieldProps } = propItem || v?.propItem || {} // 直接搜索拿v.xx的值\n const copyValue = cloneDeep(value || [])\n let index\n if (v?.propItem) {\n const _index = copyValue.findIndex((vv) => vv.key === v.propItem?.name)\n if (_index > -1) {\n index = _index\n } else {\n copyValue.push({\n key: v.propItem?.name,\n value: isMultiple ? [] : '',\n label: (v.propItem?.propsTitle || v.propItem?.title || v.propItem?.name) + ':',\n })\n index = copyValue.length - 1\n }\n setFieldItem(v.propItem)\n } else {\n index = copyValue.findIndex((v) => v.key === propItem?.name)\n }\n\n if (isMultiple) {\n if (!copyValue[index]?.value?.length) {\n copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + v?.label\n copyValue[index].value = [v?.value]\n } else {\n if (copyValue[index].value?.indexOf(v.value) > -1) {\n copyValue[index].value = copyValue[index].value.filter((val) => val !== v.value)\n const regex = new RegExp(`\\\\|?${v.label}`, 'g') //new RegExp(`\\\\|?${variable}`, 'g')\n const result = copyValue[index].label.replace(regex, '')\n copyValue[index].label = result\n } else {\n copyValue[index].value.push(v.value)\n copyValue[index].label += ' | ' + v?.label\n }\n }\n } else {\n copyValue[index].value = v?.value\n copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + v?.label\n close()\n }\n copyValue[index].closable = true\n onChange(copyValue, false, true)\n fieldProps?.onChange && fieldProps.onChange(copyValue[index].value)\n }\n\n const onFieldChange = (...args) => {\n const { type, component, props: fieldProps, setLabel } = propItem || {}\n const { options } = fieldProps || {}\n const copyValue = cloneDeep(value)\n const index = copyValue.findIndex((v) => v.key === propItem?.name)\n copyValue[index].value = args[0]\n if (type === 'date') {\n copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + args[1]\n close()\n } else if (type === 'dateRange') {\n copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + args[1]?.join('~')\n \n if (args[1]?.[1]) {\n close()\n }\n } else if (type === 'selectInput') {\n const key = get(Object.keys(args[0]), '0')\n const val = get(args[0], key)\n const label = getLabelFromOptions(key, options)\n copyValue[index].label = `${label}: ${val}`\n } else if (type === 'checkbox') {\n copyValue[index].label = `${copyValue[index].label.match(/(.*:)/)[0]} ${args[0] ? local.Yes : local.No\n }`\n close()\n } else if (!type && component) {\n if (setLabel) {\n // setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制\n copyValue[index].label = setLabel(args[0])\n } else {\n copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + (args[1] || args[0])\n }\n close()\n }\n copyValue[index].closable = true\n onChange(copyValue, false, true)\n fieldProps?.onChange && fieldProps.onChange(copyValue[index].value)\n }\n\n const close = () => {\n setVisible(false)\n setPopoverContent(false)\n }\n const handleVisibleChange = () => {\n if (!visible && !regex.test(searchText)) {\n setVisible(true)\n } else {\n close()\n }\n }\n\n useEffect(() => {\n let bool1 = false, bool2 = false;\n \n if (searchText && !propItem) {\n fieldItems?.forEach((v) => {\n const { name, propsTitle, title, type, props } = v.props || {}\n const _propsTitle = propsTitle || title || name\n if (_propsTitle?.indexOf(searchText) > -1) {\n bool1 = true\n }\n const sOptions = type !== 'select' ? [] : props?.options || []\n const fieldNames = props?.fieldNames\n const target = sOptions?.find((item) => {\n const labelKey = fieldNames?.label || 'label'\n const label = item instanceof Object ? item[labelKey] : item + ''\n return label?.indexOf(searchText) > -1\n })\n if (target) {\n bool2 = true\n }\n })\n setSearchTarget(!bool2 && !bool1 ? null : { propsTitle: bool1, propsValue: bool2 })\n } else {\n setSearchTarget(undefined)\n }\n }, [fieldItems, searchText, propItem])\n\n const renderFirstOptions = (menu) => {\n return (\n <div>\n {(!searchText || searchTarget?.propsTitle) && <label>{locale.propTitle}</label>}\n <ul className=\"ant-select-dropdown-menu\">\n {fieldItems?.map((v) => {\n const { name, propsTitle, title, type, props } = v.props || {}\n const _propsTitle = propsTitle || title || name\n if (searchText) {\n if (_propsTitle?.indexOf(searchText) > -1) {\n return (\n <li\n className=\"ant-select-dropdown-menu-item\"\n key={name}\n value={name}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n onPropsClick(v.props)\n }}\n >\n <span\n dangerouslySetInnerHTML={{\n __html: highlightSubstring(_propsTitle, searchText),\n }}\n ></span>\n </li>\n )\n }\n return null\n }\n return (\n <li\n className=\"ant-select-dropdown-menu-item\"\n key={name}\n value={name}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n onPropsClick(v.props)\n }}\n >\n {_propsTitle}\n </li>\n )\n })}\n </ul>\n {/* 可以对下拉框值筛选 */}\n {searchText && (\n <div>\n {searchTarget?.propsValue && <label>{locale.propValue}</label>}\n <ul className=\"ant-select-dropdown-menu\">\n {fieldItems?.map((v) => {\n const { name, propsTitle, type, props } = v.props || {}\n const target = value?.find((v) => v.key === name)\n if (type === 'select' && props && props.options && props.options.length > 0) {\n return (\n <SelectOpt\n key={name}\n {...props}\n searchText={searchText}\n propItem={v.props}\n onChange={onSelectChange}\n value={target?.value}\n />\n )\n }\n return\n })}\n </ul>\n </div>\n )}\n </div>\n )\n }\n\n const renderSecondOptions = () => {\n const {\n name,\n propsTitle,\n title,\n type,\n className,\n component,\n props: fieldProps,\n } = propItem || {}\n const target = value?.find((v) => v.key === name)\n const Field = component || fieldsMap[type]\n return (\n <div onClick={(e) => e.stopPropagation()} className={className}>\n <label>{propsTitle || title || name}</label>\n {type === 'select' ? (\n <SelectOpt {...fieldProps} propItem={propItem} onChange={onSelectChange} value={target?.value} />\n ) : (\n <div className={`${clsPrefix}-field-popover-content`} onClick={(e) => e.stopPropagation()}>\n <Field\n form={form}\n value={target?.value}\n {...fieldProps}\n style={{\n ...fieldProps?.style,\n width: fieldProps?.style?.width || getFieldWidth(type),\n }}\n close={close}\n onChange={onFieldChange}\n />\n </div>\n )}\n </div>\n )\n }\n\n return (\n <Popover\n trigger=\"click\"\n visible={visible}\n placement=\"bottom\"\n overlayClassName={`${clsPrefix}-field-popover`}\n content={!popoverContent ? renderFirstOptions() : renderSecondOptions()}\n onVisibleChange={handleVisibleChange}\n {...props}\n >\n {children}\n </Popover>\n )\n}\nexport default forwardRef(FieldPopover)\n"]}
|
|
1
|
+
{"version":3,"file":"FieldPopover.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/FieldPopover.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClC,OAAO,OAAO,MAAM,kBAAkB,CAAA;AACtC,OAAO,SAAS,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC/F,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAE5B,OAAO,SAAS,EAAE,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,qBAAqB,CAAA;AAC5B,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QA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N,MAAM,CAAE,KAAK,IAChB,UAAU,IACd,KAAK,kCACA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,KACpB,KAAK,EAAE,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,0CAAE,KAAK,KAAI,aAAa,CAAC,IAAI,CAAC,KAExD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,IACvB,CACE,CACP,CACG,CACP,CAAA;IACH,CAAC,CAAA;IAED,OAAO,CACL,oBAAC,OAAO,kBACN,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,QAAQ,EAClB,gBAAgB,EAAE,GAAG,SAAS,gBAAgB,EAC9C,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,mBAAmB,EAAE,EACvE,eAAe,EAAE,mBAAmB,IAChC,KAAK,GAER,QAAQ,CACD,CACX,CAAA;AACH,CAAC,CAAA;AACD,eAAe,UAAU,CAAC,YAAY,CAAC,CAAA","sourcesContent":["import React, { useEffect, useState, forwardRef, useImperativeHandle } from 'react'\nimport { cloneDeep } from 'lodash'\nimport Popover from '../../../popover'\nimport SelectOpt from './Select'\nimport { highlightSubstring, getLabelFromOptions, getLabelByValue, formatLabel } from './utils'\nimport { get } from 'lodash'\n\nimport fieldsMap, { getFieldWidth } from '../fieldsMap'\nimport './FieldPopover.less'\nconst isInput = (type) => ['input', 'string', 'search', 'number', 'inputNumber'].includes(type)\n\nconst FieldPopover = (\n {\n visible,\n setVisible,\n searchText,\n children,\n value,\n regex,\n fieldItems,\n propItem,\n setFieldItem,\n onChange,\n form,\n locale,\n clsPrefix,\n ...props\n },\n ref\n) => {\n const [searchTarget, setSearchTarget] = useState(undefined)\n const [popoverContent, setPopoverContent] = useState(false)\n\n const onPropsClick = (props) => {\n const { type = 'input' } = props || {}\n const copyValue = cloneDeep(value)\n if (!copyValue?.find((v) => v.key === props.name)) {\n copyValue.push({\n key: props.name,\n value: type === 'array' ? [] : undefined,\n closable: true,\n label: (props.propsTitle || props.title || props.name) + ':',\n })\n }\n setFieldItem(props)\n if (isInput(type)) {\n const target = copyValue.find((v) => v.key === props.name)\n onChange(target, true)\n close()\n return\n }\n setVisible(true)\n setPopoverContent(true)\n onChange(copyValue)\n }\n\n useImperativeHandle(ref, () => ({\n onPropsClick,\n }))\n\n const onSelectChange = (v, isMultiple) => {\n const propObj = v?.propItem || propItem || {}\n const { props: fieldProps } = propObj // 直接搜索拿v.xx的值\n const copyValue = cloneDeep(value || [])\n let index\n if (v?.propItem) {\n // 模糊搜索\n const _index = copyValue.findIndex((vv) => vv.key === v.propItem?.name)\n if (_index > -1) {\n index = _index\n } else {\n copyValue.push({\n key: v.propItem?.name,\n value: isMultiple ? [] : '',\n })\n index = copyValue.length - 1\n }\n setFieldItem(v.propItem)\n } else {\n // 选择值\n index = copyValue.findIndex((v) => v.key === propItem?.name)\n }\n\n if (isMultiple) {\n if (!copyValue[index]?.value?.length) {\n copyValue[index].value = [v?.value]\n } else {\n if (copyValue[index].value?.indexOf(v.value) > -1) {\n copyValue[index].value = copyValue[index].value.filter((val) => val !== v.value)\n } else {\n copyValue[index].value.push(v.value)\n }\n }\n // 如果是模糊搜索-展开多选项\n if (v?.propItem) {\n setFieldItem(v?.propItem)\n setVisible(true)\n setPopoverContent(true)\n }\n } else {\n copyValue[index].value = v?.value\n close()\n }\n\n const labelPrefix = `${propObj.propsTitle || propObj.title || propObj.name}: `\n if (propObj.setLabel) {\n copyValue[index].label = labelPrefix + propObj.setLabel(copyValue[index].value)\n } else {\n copyValue[index].label =\n labelPrefix +\n getLabelByValue({\n value: copyValue[index].value,\n options: propObj.props?.options || v.options,\n fieldNames: propObj.props?.fieldNames || {\n label: 'label',\n value: 'value',\n },\n })\n }\n copyValue[index].closable = true\n onChange(copyValue, false, true)\n fieldProps?.onChange && fieldProps.onChange(copyValue[index].value)\n }\n\n const onFieldChange = (...args) => {\n const { type, component, props: fieldProps, setLabel, propsTitle, title, name } = propItem || {}\n const { options } = fieldProps || {}\n const copyValue = cloneDeep(value)\n const index = copyValue.findIndex((v) => v.key === propItem?.name)\n copyValue[index].value = args[0]\n const labelPrefix = `${propsTitle || title || name}: `\n if (setLabel) {\n // setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制\n copyValue[index].label = labelPrefix + setLabel(args[0])\n } else if (type === 'date') {\n copyValue[index].label = labelPrefix + args[1]\n close()\n } else if (type === 'dateRange') {\n copyValue[index].label = labelPrefix + args[1]?.join('~')\n if (args[1]?.[1]) {\n close()\n }\n } else if (type === 'selectInput') {\n const key = get(Object.keys(args[0]), '0')\n const val = get(args[0], key)\n const label = getLabelFromOptions(key, options)\n copyValue[index].label = `${label}: ${val}`\n } else if (type === 'checkbox') {\n copyValue[index].label = labelPrefix + (args[0] ? locale.yes : locale.no)\n close()\n } else if (!type && component) {\n copyValue[index].label = labelPrefix + (args[1] || args[0])\n close()\n }\n copyValue[index].closable = true\n onChange(copyValue, false, true)\n fieldProps?.onChange && fieldProps.onChange(copyValue[index].value)\n }\n\n const close = () => {\n setVisible(false)\n setTimeout(() => {\n setFieldItem()\n setPopoverContent(false)\n }, 1)\n }\n const handleVisibleChange = () => {\n if (!visible && !regex.test(searchText)) {\n setVisible(true)\n } else {\n close()\n }\n }\n\n useEffect(() => {\n let bool1 = false,\n bool2 = false\n\n if (searchText && !propItem) {\n fieldItems?.forEach((v) => {\n const { name, propsTitle, title, type, props } = v.props || {}\n const _propsTitle = propsTitle || title || name\n if (_propsTitle?.indexOf(searchText) > -1) {\n bool1 = true\n }\n const sOptions = type !== 'select' ? [] : props?.options || []\n const fieldNames = props?.fieldNames\n const target = sOptions?.find((item) => {\n const labelKey = fieldNames?.label || 'label'\n const label = item instanceof Object ? item[labelKey] : item + ''\n return (React.isValidElement(label) ? formatLabel(label) : label).indexOf(searchText) > -1\n })\n if (target) {\n bool2 = true\n }\n })\n setSearchTarget(!bool2 && !bool1 ? null : { propsTitle: bool1, propsValue: bool2 })\n } else {\n setSearchTarget(undefined)\n }\n }, [fieldItems, searchText, propItem])\n\n const renderFirstOptions = () => {\n return (\n <div>\n {(!searchText || searchTarget?.propsTitle) && <label>{locale.propTitle}</label>}\n <ul className=\"ant-select-dropdown-menu\">\n {fieldItems?.map((v) => {\n const { name, propsTitle, title, type, props } = v.props || {}\n const _propsTitle = propsTitle || title || name\n if (searchText) {\n if (_propsTitle?.indexOf(searchText) > -1) {\n return (\n <li\n className=\"ant-select-dropdown-menu-item\"\n key={name}\n value={name}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n onPropsClick(v.props)\n }}\n >\n <span\n dangerouslySetInnerHTML={{\n __html: highlightSubstring(_propsTitle, searchText),\n }}\n ></span>\n </li>\n )\n }\n return null\n }\n return (\n <li\n className=\"ant-select-dropdown-menu-item\"\n key={name}\n value={name}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n onPropsClick(v.props)\n }}\n >\n {_propsTitle}\n </li>\n )\n })}\n </ul>\n {/* 可以对下拉框值筛选 */}\n {searchText && (\n <div>\n {searchTarget?.propsValue && <label>{locale.propValue}</label>}\n {fieldItems?.map((v) => {\n const { name, propsTitle, type, props } = v.props || {}\n const target = value?.find((v) => v.key === name)\n if (type === 'select') {\n // && props?.options?.length > 0\n return (\n <SelectOpt\n key={name}\n {...props}\n searchText={searchText}\n propItem={v.props}\n onChange={onSelectChange}\n value={target?.value}\n />\n )\n }\n return\n })}\n </div>\n )}\n </div>\n )\n }\n\n const renderSecondOptions = () => {\n const {\n name,\n propsTitle,\n title,\n type,\n className,\n component,\n props: fieldProps,\n } = propItem || {}\n const target = value?.find((v) => v.key === name)\n const Field = component || fieldsMap[type]\n return (\n <div onClick={(e) => e.stopPropagation()} className={className}>\n <label>{propsTitle || title || name}</label>\n {type === 'select' ? (\n <SelectOpt\n {...fieldProps}\n propItem={propItem}\n onChange={onSelectChange}\n value={target?.value}\n />\n ) : (\n <div\n className={`${clsPrefix}-field-popover-content`}\n onClick={(e) => e.stopPropagation()}\n >\n <Field\n form={form}\n value={target?.value}\n {...fieldProps}\n style={{\n ...fieldProps?.style,\n width: fieldProps?.style?.width || getFieldWidth(type),\n }}\n close={close}\n onChange={onFieldChange}\n />\n </div>\n )}\n </div>\n )\n }\n\n return (\n <Popover\n trigger=\"click\"\n visible={visible}\n placement=\"bottom\"\n overlayClassName={`${clsPrefix}-field-popover`}\n content={!popoverContent ? renderFirstOptions() : renderSecondOptions()}\n onVisibleChange={handleVisibleChange}\n {...props}\n >\n {children}\n </Popover>\n )\n}\nexport default forwardRef(FieldPopover)\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _isArray from "lodash/isArray";
|
|
1
2
|
var __rest = this && this.__rest || function (s, e) {
|
|
2
3
|
var t = {};
|
|
3
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -9,7 +10,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
9
10
|
import React, { useState, useEffect } from 'react';
|
|
10
11
|
import classNames from 'classnames';
|
|
11
12
|
import Icon from '../../../icon';
|
|
12
|
-
import { highlightSubstring } from './utils';
|
|
13
|
+
import { highlightSubstring, formatLabel } from './utils';
|
|
13
14
|
export default (props => {
|
|
14
15
|
const {
|
|
15
16
|
options,
|
|
@@ -50,27 +51,29 @@ export default (props => {
|
|
|
50
51
|
const valueKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || 'value';
|
|
51
52
|
const value = item instanceof Object ? item[valueKey] : item;
|
|
52
53
|
const label = item instanceof Object ? item[labelKey] : item + '';
|
|
53
|
-
const
|
|
54
|
-
const isSelected =
|
|
54
|
+
const disabled = item instanceof Object ? item['disabled'] : false;
|
|
55
|
+
const isSelected = _isArray(_value) ? (_value === null || _value === void 0 ? void 0 : _value.indexOf(value)) > -1 : value === _value;
|
|
55
56
|
if (searchText) {
|
|
56
|
-
|
|
57
|
+
const isReactDom = React.isValidElement(label);
|
|
58
|
+
const _label = isReactDom ? formatLabel(label) : label;
|
|
59
|
+
if ((_label === null || _label === void 0 ? void 0 : _label.indexOf(searchText)) > -1) {
|
|
57
60
|
return React.createElement("li", {
|
|
58
61
|
className: classNames({
|
|
59
62
|
'ant-select-dropdown-menu-item': true,
|
|
60
|
-
'ant-select-dropdown-menu-item-selected': isSelected
|
|
63
|
+
'ant-select-dropdown-menu-item-selected': isSelected,
|
|
64
|
+
'ant-select-dropdown-menu-item-disabled': disabled
|
|
61
65
|
}),
|
|
62
66
|
key: value,
|
|
63
67
|
value: value,
|
|
64
68
|
onMouseDown: e => e.preventDefault(),
|
|
65
69
|
onClick: () => {
|
|
66
|
-
onValueChange({
|
|
70
|
+
!disabled && onValueChange({
|
|
67
71
|
value,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
propItem
|
|
72
|
+
propItem,
|
|
73
|
+
options: items
|
|
71
74
|
});
|
|
72
75
|
}
|
|
73
|
-
}, React.createElement("span", null, (propItem === null || propItem === void 0 ? void 0 : propItem.propsTitle) || (propItem === null || propItem === void 0 ? void 0 : propItem.name), ": "), React.createElement("span", {
|
|
76
|
+
}, React.createElement("span", null, (propItem === null || propItem === void 0 ? void 0 : propItem.propsTitle) || (propItem === null || propItem === void 0 ? void 0 : propItem.name), ": "), isReactDom ? React.createElement("span", null, label) : React.createElement("span", {
|
|
74
77
|
dangerouslySetInnerHTML: {
|
|
75
78
|
__html: highlightSubstring(label, searchText)
|
|
76
79
|
}
|
|
@@ -84,16 +87,16 @@ export default (props => {
|
|
|
84
87
|
return React.createElement("li", {
|
|
85
88
|
className: classNames({
|
|
86
89
|
'ant-select-dropdown-menu-item': true,
|
|
87
|
-
'ant-select-dropdown-menu-item-selected': isSelected
|
|
90
|
+
'ant-select-dropdown-menu-item-selected': isSelected,
|
|
91
|
+
'ant-select-dropdown-menu-item-disabled': disabled
|
|
88
92
|
}),
|
|
89
93
|
key: value,
|
|
90
94
|
value: value,
|
|
91
95
|
onMouseDown: e => e.preventDefault(),
|
|
92
96
|
onClick: () => {
|
|
93
|
-
onValueChange({
|
|
97
|
+
!disabled && onValueChange({
|
|
94
98
|
value,
|
|
95
|
-
|
|
96
|
-
optionProps
|
|
99
|
+
options: items
|
|
97
100
|
});
|
|
98
101
|
}
|
|
99
102
|
}, label, isSelected && React.createElement(Icon, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/Select.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/Select.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,IAAI,MAAM,eAAe,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEzD,eAAe,CAAC,KAAK,EAAE,EAAE;IACvB,MAAM,EACJ,OAAO,EACP,MAAM,EACN,QAAQ,GAAG,MAAM,EACjB,UAAU,GAAG;QACX,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,OAAO;KACf,EACD,QAAQ,EACR,QAAQ,EACR,KAAK,EAAE,MAAM,EACb,IAAI,EACJ,QAAQ,EACR,UAAU,KAER,KAAK,EADJ,IAAI,UACL,KAAK,EAfH,kHAeL,CAAQ,CAAA;IACT,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,OAAO,IAAI,EAAE,CAAC,CAAA;IAEjD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,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,OAAO,EAAC,SAAS,EAAC,0BAA0B,GAAG,CACtE,CACN,CAAA;aACF;YACD,OAAO,IAAI,CAAA;SACZ;QACD,OAAO,CACL,4BACE,SAAS,EAAE,UAAU,CAAC;gBACpB,+BAA+B,EAAE,IAAI;gBACrC,wCAAwC,EAAE,UAAU;gBACpD,wCAAwC,EAAE,QAAQ;aACnD,CAAC,EACF,GAAG,EAAE,KAAK,EACV,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,EACtC,OAAO,EAAE,GAAG,EAAE;gBACZ,CAAC,QAAQ,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA;YACvD,CAAC;YAEA,KAAK;YACL,UAAU,IAAI,oBAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,0BAA0B,GAAG,CACtE,CACN,CAAA;IACH,CAAC,CAAC,CACC,CACN,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React, { useState, useEffect } from 'react'\nimport { isArray } from 'lodash'\nimport classNames from 'classnames'\nimport Icon from '../../../icon'\nimport { highlightSubstring, formatLabel } from './utils'\n\nexport default (props) => {\n const {\n options,\n params,\n queryKey = 'name',\n fieldNames = {\n label: 'label',\n value: 'value',\n },\n loadData,\n onChange,\n value: _value,\n mode,\n propItem,\n searchText,\n ...rest\n } = props\n const [items, setItems] = useState(options || [])\n\n useEffect(() => {\n if (loadData) {\n loadData({\n [queryKey]: searchText,\n ...(params || {}),\n }).then((items) => {\n setItems(items)\n })\n }\n }, [params, searchText])\n\n useEffect(() => {\n setItems(options || [])\n }, [options])\n\n const onValueChange = (item) => {\n onChange(item, mode === 'multiple' || mode === 'tags')\n }\n\n return (\n <ul className=\"ant-select-dropdown-menu\">\n {items.map((item) => {\n const labelKey = fieldNames?.label || 'label'\n const valueKey = fieldNames?.value || 'value'\n const value = item instanceof Object ? item[valueKey] : item\n const label = item instanceof Object ? item[labelKey] : item + ''\n const disabled = item instanceof Object ? item['disabled'] : false\n\n const isSelected = isArray(_value) ? _value?.indexOf(value) > -1 : value === _value\n if (searchText) {\n const isReactDom = React.isValidElement(label)\n const _label = isReactDom ? formatLabel(label) : label\n if (_label?.indexOf(searchText) > -1) {\n return (\n <li\n className={classNames({\n 'ant-select-dropdown-menu-item': true,\n 'ant-select-dropdown-menu-item-selected': isSelected,\n 'ant-select-dropdown-menu-item-disabled': disabled,\n })}\n key={value}\n value={value}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n !disabled &&\n onValueChange({\n value,\n propItem,\n options: items,\n })\n }}\n >\n <span>{propItem?.propsTitle || propItem?.name}: </span>\n {isReactDom ? (\n <span>{label}</span>\n ) : (\n <span\n dangerouslySetInnerHTML={{\n __html: highlightSubstring(label, searchText),\n }}\n ></span>\n )}\n {isSelected && <Icon type=\"check\" className=\"ant-select-selected-icon\" />}\n </li>\n )\n }\n return null\n }\n return (\n <li\n className={classNames({\n 'ant-select-dropdown-menu-item': true,\n 'ant-select-dropdown-menu-item-selected': isSelected,\n 'ant-select-dropdown-menu-item-disabled': disabled,\n })}\n key={value}\n value={value}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n !disabled && onValueChange({ value, options: items })\n }}\n >\n {label}\n {isSelected && <Icon type=\"check\" className=\"ant-select-selected-icon\" />}\n </li>\n )\n })}\n </ul>\n )\n}\n"]}
|