tntd 3.0.37 → 3.0.38
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/query-form/Field/Composition/FieldPopover.js +12 -88
- package/es/query-form/Field/Composition/FieldPopover.js.map +1 -1
- package/es/query-form/Field/Composition/Select.js +30 -115
- package/es/query-form/Field/Composition/Select.js.map +1 -1
- package/es/query-form/Field/Composition/ValueTag.js +13 -89
- package/es/query-form/Field/Composition/ValueTag.js.map +1 -1
- package/es/query-form/Field/Composition/index.js +17 -121
- package/es/query-form/Field/Composition/utils.js +1 -5
- package/es/scroll-bar/Bar.js +10 -87
- package/es/scroll-bar/Context.js +1 -5
- package/es/scroll-bar/ScrollBar.js +4 -39
- package/es/scroll-bar/Thumb.js +10 -87
- package/es/scroll-bar/index.js +1 -5
- package/es/scroll-bar/util.js +4 -31
- package/es/tntd-virtual-tree/index.less +1 -2
- package/lib/query-form/Field/Composition/FieldPopover.js +2 -1
- 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 +17 -6
- package/lib/query-form/Field/Composition/Select.js.map +1 -1
- package/lib/query-form/Field/Composition/ValueTag.d.ts.map +1 -1
- package/lib/query-form/Field/Composition/ValueTag.js +3 -2
- package/lib/query-form/Field/Composition/ValueTag.js.map +1 -1
- package/lib/tntd-virtual-tree/index.less +1 -2
- package/package.json +1 -1
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) {
|
|
4
|
-
"@babel/helpers - typeof";
|
|
5
|
-
|
|
6
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7
|
-
return typeof o;
|
|
8
|
-
} : function (o) {
|
|
9
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
10
|
-
}, _typeof(o);
|
|
11
|
-
}
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
4
|
Object.defineProperty(exports, "__esModule", {
|
|
13
5
|
value: true
|
|
14
6
|
});
|
|
@@ -24,84 +16,15 @@ var _Select = _interopRequireDefault(require("./Select"));
|
|
|
24
16
|
var _utils = require("./utils");
|
|
25
17
|
var _fieldsMap = _interopRequireDefault(require("../fieldsMap"));
|
|
26
18
|
require("./FieldPopover.less");
|
|
27
|
-
function _getRequireWildcardCache(e) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
function
|
|
36
|
-
if (!r && e && e.__esModule) return e;
|
|
37
|
-
if (null === e || "object" != _typeof(e) && "function" != typeof e) return {
|
|
38
|
-
"default": e
|
|
39
|
-
};
|
|
40
|
-
var t = _getRequireWildcardCache(r);
|
|
41
|
-
if (t && t.has(e)) return t.get(e);
|
|
42
|
-
var n = {
|
|
43
|
-
__proto__: null
|
|
44
|
-
},
|
|
45
|
-
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
46
|
-
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
47
|
-
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
48
|
-
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
49
|
-
}
|
|
50
|
-
return n["default"] = e, t && t.set(e, n), n;
|
|
51
|
-
}
|
|
52
|
-
function _interopRequireDefault(e) {
|
|
53
|
-
return e && e.__esModule ? e : {
|
|
54
|
-
"default": e
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function _slicedToArray(r, e) {
|
|
58
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
59
|
-
}
|
|
60
|
-
function _nonIterableRest() {
|
|
61
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
62
|
-
}
|
|
63
|
-
function _unsupportedIterableToArray(r, a) {
|
|
64
|
-
if (r) {
|
|
65
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
66
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
67
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function _arrayLikeToArray(r, a) {
|
|
71
|
-
(null == a || a > r.length) && (a = r.length);
|
|
72
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
73
|
-
return n;
|
|
74
|
-
}
|
|
75
|
-
function _iterableToArrayLimit(r, l) {
|
|
76
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
77
|
-
if (null != t) {
|
|
78
|
-
var e,
|
|
79
|
-
n,
|
|
80
|
-
i,
|
|
81
|
-
u,
|
|
82
|
-
a = [],
|
|
83
|
-
f = !0,
|
|
84
|
-
o = !1;
|
|
85
|
-
try {
|
|
86
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
87
|
-
if (Object(t) !== t) return;
|
|
88
|
-
f = !1;
|
|
89
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
90
|
-
} catch (r) {
|
|
91
|
-
o = !0, n = r;
|
|
92
|
-
} finally {
|
|
93
|
-
try {
|
|
94
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
95
|
-
} finally {
|
|
96
|
-
if (o) throw n;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return a;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
function _arrayWithHoles(r) {
|
|
103
|
-
if (Array.isArray(r)) return r;
|
|
104
|
-
}
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
22
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
25
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
26
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
105
28
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
106
29
|
var t = {};
|
|
107
30
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -389,7 +312,8 @@ var FieldPopover = function FieldPopover(_a, ref) {
|
|
|
389
312
|
searchText: searchText,
|
|
390
313
|
propItem: propItem,
|
|
391
314
|
onChange: onSelectChange,
|
|
392
|
-
value: target === null || target === void 0 ? void 0 : target.value
|
|
315
|
+
value: target === null || target === void 0 ? void 0 : target.value,
|
|
316
|
+
showEmpty: true
|
|
393
317
|
})) : _react["default"].createElement("div", {
|
|
394
318
|
className: "".concat(clsPrefix, "-field-popover-content"),
|
|
395
319
|
onClick: function onClick(e) {
|
|
@@ -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,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACt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mCAAQ,UAAU,IAAI,KAAK,IAAI,IAAI,CAAS;YAC3C,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CACnB,oBAAC,SAAS,oBACJ,UAAU,IACd,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,IACpB,CACH,CAAC,CAAC,CAAC,CACF,6BACE,SAAS,EAAE,GAAG,SAAS,wBAAwB,EAC/C,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE;gBAEnC,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,OAAO,KAE5C,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,IAAI,IACV,CACE,CACP,CACG,CACP,CAAA;IACH,CAAC,CAAA;IAED,OAAO,CACL,oBAAC,OAAO,kBACN,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,OAAO,EAChB,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, filter, find } from 'lodash'\nimport { Empty } from '../../../empty'\nimport Popover from '../../../popover'\nimport Ellipsis from '../../../ellipsis'\nimport SelectOpt from './Select'\nimport { highlightSubstring, formatLabel, isInput } from './utils'\nimport fieldsMap from '../fieldsMap'\nimport './FieldPopover.less'\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', component } = 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 })\n }\n setFieldItem(props)\n if (isInput(type) && !component) {\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 onChange(copyValue, false, true)\n fieldProps?.onChange && fieldProps.onChange(copyValue[index].value)\n }\n\n const onFieldChange = (...args) => {\n const { type = 'input', component, props: fieldProps } = propItem || {}\n const copyValue = cloneDeep(value)\n const index = copyValue.findIndex((v) => v.key === propItem?.name)\n copyValue[index].value = args[0]\n if (['date', 'checkbox'].includes(type) || (type === 'dateRange' && args[1]?.[1])) {\n close()\n }\n onChange(copyValue, false, args[0] !== undefined, type !== 'selectInput')\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 = 'input', 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 const firstItems = searchText\n ? filter(fieldItems, (v) => {\n const { name, propsTitle, title } = v.props || {}\n const _propsTitle = propsTitle || title || name\n return _propsTitle?.indexOf(searchText) > -1\n })\n : fieldItems\n const secondItems = searchText\n ? filter(fieldItems, (v) => {\n const { type = 'input', props } = v.props || {}\n const { options, loadData, fieldNames } = props || {}\n return (\n type === 'select' &&\n !loadData &&\n !!find(options, (item) => {\n const labelKey = fieldNames?.label || 'label'\n const label = item instanceof Object ? item[labelKey] : item + ''\n const isReactDom = React.isValidElement(label)\n const _label = isReactDom ? formatLabel(label) : label\n return _label?.indexOf(searchText) > -1\n })\n )\n })\n : []\n return (\n <div>\n {firstItems.length > 0 && (\n <>\n {(!searchText || searchTarget?.propsTitle) && <label>{locale.propTitle}</label>}\n <ul className=\"ant-select-dropdown-menu\">\n {firstItems.map((v) => {\n const { name, propsTitle, title, type, props } = v.props || {}\n const _propsTitle = propsTitle || title || name\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 <Ellipsis\n widthLimit={220}\n title={\n searchText ? (\n <span\n dangerouslySetInnerHTML={{\n __html: highlightSubstring(_propsTitle, searchText),\n }}\n />\n ) : (\n _propsTitle\n )\n }\n />\n </li>\n )\n })}\n </ul>\n </>\n )}\n\n {/* 可以对下拉框值筛选 */}\n {secondItems.length > 0 && (\n <div>\n {searchTarget?.propsValue && <label>{locale.propValue}</label>}\n {fieldItems?.map((v) => {\n const { name, type = 'input', props } = v.props || {}\n const target = value?.find((v) => v.key === name)\n if (type === 'select') {\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 {!firstItems.length && !secondItems.length && <Empty size=\"mini\" />}\n </div>\n )\n }\n\n const renderSecondOptions = () => {\n const {\n name,\n propsTitle,\n title,\n type = 'input',\n className,\n component,\n props: fieldProps,\n } = propItem || {}\n const target = value?.find((v) => v.key === name)\n const Field = component || fieldsMap[type] || (() => null)\n return (\n <div onClick={(e) => e.stopPropagation()} className={className}>\n <label>{propsTitle || title || name}</label>\n {type === 'select' ? (\n <SelectOpt\n {...fieldProps}\n searchText={searchText}\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 || '250px',\n }}\n close={close}\n onChange={onFieldChange}\n name={name}\n />\n </div>\n )}\n </div>\n )\n }\n\n return (\n <Popover\n trigger=\"click\"\n visible={visible}\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,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,OAAO,MAAM,kBAAkB,CAAA;AACtC,OAAO,QAAQ,MAAM,mBAAmB,CAAA;AACxC,OAAO,SAAS,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAClE,OAAO,SAAS,MAAM,cAAc,CAAA;AACpC,OAAO,qBAAqB,CAAA;AAE5B,MAAM,YAAY,GAAG,CACnB,EAeC,EACD,GAAG,EACH,EAAE;QAjBF,EACE,OAAO,EACP,UAAU,EACV,UAAU,EACV,QAAQ,EACR,KAAK,EACL,KAAK,EACL,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,SAAS,O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ACV,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,OAAO,KAE5C,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,IAAI,IACV,CACE,CACP,CACG,CACP,CAAA;IACH,CAAC,CAAA;IAED,OAAO,CACL,oBAAC,OAAO,kBACN,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,OAAO,EAChB,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, filter, find } from 'lodash'\nimport { Empty } from '../../../empty'\nimport Popover from '../../../popover'\nimport Ellipsis from '../../../ellipsis'\nimport SelectOpt from './Select'\nimport { highlightSubstring, formatLabel, isInput } from './utils'\nimport fieldsMap from '../fieldsMap'\nimport './FieldPopover.less'\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', component } = 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 })\n }\n setFieldItem(props)\n if (isInput(type) && !component) {\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 onChange(copyValue, false, true)\n fieldProps?.onChange && fieldProps.onChange(copyValue[index].value)\n }\n\n const onFieldChange = (...args) => {\n const { type = 'input', component, props: fieldProps } = propItem || {}\n const copyValue = cloneDeep(value)\n const index = copyValue.findIndex((v) => v.key === propItem?.name)\n copyValue[index].value = args[0]\n if (['date', 'checkbox'].includes(type) || (type === 'dateRange' && args[1]?.[1])) {\n close()\n }\n onChange(copyValue, false, args[0] !== undefined, type !== 'selectInput')\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 = 'input', 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 const firstItems = searchText\n ? filter(fieldItems, (v) => {\n const { name, propsTitle, title } = v.props || {}\n const _propsTitle = propsTitle || title || name\n return _propsTitle?.indexOf(searchText) > -1\n })\n : fieldItems\n const secondItems = searchText\n ? filter(fieldItems, (v) => {\n const { type = 'input', props } = v.props || {}\n const { options, loadData, fieldNames } = props || {}\n return (\n type === 'select' &&\n !loadData &&\n !!find(options, (item) => {\n const labelKey = fieldNames?.label || 'label'\n const label = item instanceof Object ? item[labelKey] : item + ''\n const isReactDom = React.isValidElement(label)\n const _label = isReactDom ? formatLabel(label) : label\n return _label?.indexOf(searchText) > -1\n })\n )\n })\n : []\n return (\n <div>\n {firstItems.length > 0 && (\n <>\n {(!searchText || searchTarget?.propsTitle) && <label>{locale.propTitle}</label>}\n <ul className=\"ant-select-dropdown-menu\">\n {firstItems.map((v) => {\n const { name, propsTitle, title, type, props } = v.props || {}\n const _propsTitle = propsTitle || title || name\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 <Ellipsis\n widthLimit={220}\n title={\n searchText ? (\n <span\n dangerouslySetInnerHTML={{\n __html: highlightSubstring(_propsTitle, searchText),\n }}\n />\n ) : (\n _propsTitle\n )\n }\n />\n </li>\n )\n })}\n </ul>\n </>\n )}\n\n {/* 可以对下拉框值筛选 */}\n {secondItems.length > 0 && (\n <div>\n {searchTarget?.propsValue && <label>{locale.propValue}</label>}\n {fieldItems?.map((v) => {\n const { name, type = 'input', props } = v.props || {}\n const target = value?.find((v) => v.key === name)\n if (type === 'select') {\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 {!firstItems.length && !secondItems.length && <Empty size=\"mini\" />}\n </div>\n )\n }\n\n const renderSecondOptions = () => {\n const {\n name,\n propsTitle,\n title,\n type = 'input',\n className,\n component,\n props: fieldProps,\n } = propItem || {}\n const target = value?.find((v) => v.key === name)\n const Field = component || fieldsMap[type] || (() => null)\n return (\n <div onClick={(e) => e.stopPropagation()} className={className}>\n <label>{propsTitle || title || name}</label>\n {type === 'select' ? (\n <SelectOpt\n {...fieldProps}\n searchText={searchText}\n propItem={propItem}\n onChange={onSelectChange}\n value={target?.value}\n showEmpty\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 || '250px',\n }}\n close={close}\n onChange={onFieldChange}\n name={name}\n />\n </div>\n )}\n </div>\n )\n }\n\n return (\n <Popover\n trigger=\"click\"\n visible={visible}\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,124 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) {
|
|
4
|
-
"@babel/helpers - typeof";
|
|
5
|
-
|
|
6
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7
|
-
return typeof o;
|
|
8
|
-
} : function (o) {
|
|
9
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
10
|
-
}, _typeof(o);
|
|
11
|
-
}
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
4
|
Object.defineProperty(exports, "__esModule", {
|
|
13
5
|
value: true
|
|
14
6
|
});
|
|
15
7
|
exports["default"] = void 0;
|
|
8
|
+
var _find2 = _interopRequireDefault(require("lodash/find"));
|
|
16
9
|
var _isArray2 = _interopRequireDefault(require("lodash/isArray"));
|
|
17
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
12
|
var _icon = _interopRequireDefault(require("../../../icon"));
|
|
20
13
|
var _ellipsis = _interopRequireDefault(require("../../../ellipsis"));
|
|
14
|
+
var _empty = _interopRequireDefault(require("../../../empty"));
|
|
21
15
|
var _utils = require("./utils");
|
|
22
|
-
function _getRequireWildcardCache(e) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
var t = _getRequireWildcardCache(r);
|
|
36
|
-
if (t && t.has(e)) return t.get(e);
|
|
37
|
-
var n = {
|
|
38
|
-
__proto__: null
|
|
39
|
-
},
|
|
40
|
-
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
|
-
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
42
|
-
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
43
|
-
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
44
|
-
}
|
|
45
|
-
return n["default"] = e, t && t.set(e, n), n;
|
|
46
|
-
}
|
|
47
|
-
function _interopRequireDefault(e) {
|
|
48
|
-
return e && e.__esModule ? e : {
|
|
49
|
-
"default": e
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function _defineProperty(e, r, t) {
|
|
53
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
54
|
-
value: t,
|
|
55
|
-
enumerable: !0,
|
|
56
|
-
configurable: !0,
|
|
57
|
-
writable: !0
|
|
58
|
-
}) : e[r] = t, e;
|
|
59
|
-
}
|
|
60
|
-
function _toPropertyKey(t) {
|
|
61
|
-
var i = _toPrimitive(t, "string");
|
|
62
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
63
|
-
}
|
|
64
|
-
function _toPrimitive(t, r) {
|
|
65
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
66
|
-
var e = t[Symbol.toPrimitive];
|
|
67
|
-
if (void 0 !== e) {
|
|
68
|
-
var i = e.call(t, r || "default");
|
|
69
|
-
if ("object" != _typeof(i)) return i;
|
|
70
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
71
|
-
}
|
|
72
|
-
return ("string" === r ? String : Number)(t);
|
|
73
|
-
}
|
|
74
|
-
function _slicedToArray(r, e) {
|
|
75
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
76
|
-
}
|
|
77
|
-
function _nonIterableRest() {
|
|
78
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
79
|
-
}
|
|
80
|
-
function _unsupportedIterableToArray(r, a) {
|
|
81
|
-
if (r) {
|
|
82
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
83
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
84
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function _arrayLikeToArray(r, a) {
|
|
88
|
-
(null == a || a > r.length) && (a = r.length);
|
|
89
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
90
|
-
return n;
|
|
91
|
-
}
|
|
92
|
-
function _iterableToArrayLimit(r, l) {
|
|
93
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
94
|
-
if (null != t) {
|
|
95
|
-
var e,
|
|
96
|
-
n,
|
|
97
|
-
i,
|
|
98
|
-
u,
|
|
99
|
-
a = [],
|
|
100
|
-
f = !0,
|
|
101
|
-
o = !1;
|
|
102
|
-
try {
|
|
103
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
104
|
-
if (Object(t) !== t) return;
|
|
105
|
-
f = !1;
|
|
106
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
107
|
-
} catch (r) {
|
|
108
|
-
o = !0, n = r;
|
|
109
|
-
} finally {
|
|
110
|
-
try {
|
|
111
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
112
|
-
} finally {
|
|
113
|
-
if (o) throw n;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return a;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function _arrayWithHoles(r) {
|
|
120
|
-
if (Array.isArray(r)) return r;
|
|
121
|
-
}
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
19
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
21
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
25
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
26
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
122
28
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
123
29
|
var t = {};
|
|
124
30
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -143,7 +49,8 @@ var _default = exports["default"] = function _default(props) {
|
|
|
143
49
|
mode = props.mode,
|
|
144
50
|
propItem = props.propItem,
|
|
145
51
|
searchText = props.searchText,
|
|
146
|
-
|
|
52
|
+
showEmpty = props.showEmpty,
|
|
53
|
+
rest = __rest(props, ["options", "params", "queryKey", "fieldNames", "loadData", "onChange", "value", "mode", "propItem", "searchText", "showEmpty"]);
|
|
147
54
|
var _useState = (0, _react.useState)(options || []),
|
|
148
55
|
_useState2 = _slicedToArray(_useState, 2),
|
|
149
56
|
items = _useState2[0],
|
|
@@ -161,9 +68,7 @@ var _default = exports["default"] = function _default(props) {
|
|
|
161
68
|
var onValueChange = function onValueChange(item) {
|
|
162
69
|
onChange(item, mode === 'multiple' || mode === 'tags');
|
|
163
70
|
};
|
|
164
|
-
|
|
165
|
-
className: "ant-select-dropdown-menu"
|
|
166
|
-
}, items.map(function (item) {
|
|
71
|
+
var children = items.map(function (item) {
|
|
167
72
|
var labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
|
|
168
73
|
var valueKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || 'value';
|
|
169
74
|
var value = item instanceof Object ? item[valueKey] : item;
|
|
@@ -192,7 +97,7 @@ var _default = exports["default"] = function _default(props) {
|
|
|
192
97
|
options: items
|
|
193
98
|
});
|
|
194
99
|
}
|
|
195
|
-
}, _react["default"].createElement("span", null, (propItem === null || propItem === void 0 ? void 0 : propItem.propsTitle) || (propItem === null || propItem === void 0 ? void 0 : propItem.name), ": "), _react["default"].createElement("span", {
|
|
100
|
+
}, !showEmpty && _react["default"].createElement("span", null, (propItem === null || propItem === void 0 ? void 0 : propItem.propsTitle) || (propItem === null || propItem === void 0 ? void 0 : propItem.name), ": "), _react["default"].createElement("span", {
|
|
196
101
|
style: {
|
|
197
102
|
display: 'inline-block'
|
|
198
103
|
}
|
|
@@ -238,5 +143,15 @@ var _default = exports["default"] = function _default(props) {
|
|
|
238
143
|
type: "check",
|
|
239
144
|
className: "ant-select-selected-icon"
|
|
240
145
|
}));
|
|
241
|
-
})
|
|
146
|
+
});
|
|
147
|
+
if (showEmpty && !(0, _find2["default"])(children, function (it) {
|
|
148
|
+
return !!it;
|
|
149
|
+
})) {
|
|
150
|
+
children = _react["default"].createElement(_empty["default"], {
|
|
151
|
+
size: "mini"
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return _react["default"].createElement("ul", {
|
|
155
|
+
className: "ant-select-dropdown-menu"
|
|
156
|
+
}, children);
|
|
242
157
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/Select.js"],"names":[],"mappings":";;;;;;;;;;;AAAA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O,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;YAED,8BAAM,KAAK,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;gBACtC,oBAAC,QAAQ,IAAC,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,GAAI,CACtC;YACN,UAAU,IAAI,oBAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,0BAA0B,GAAG,CACtE,CACN,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;QAC9C,QAAQ,GAAG,oBAAC,KAAK,IAAC,IAAI,EAAC,MAAM,GAAG,CAAA;KACjC;IAED,OAAO,4BAAI,SAAS,EAAC,0BAA0B,IAAE,QAAQ,CAAM,CAAA;AACjE,CAAC,CAAA","sourcesContent":["import React, { useState, useEffect } from 'react'\nimport { isArray, find } from 'lodash'\nimport classNames from 'classnames'\nimport Icon from '../../../icon'\nimport Ellipsis from '../../../ellipsis'\nimport Empty from '../../../empty'\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 showEmpty,\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 let children = 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 {!showEmpty && <span>{propItem?.propsTitle || propItem?.name}: </span>}\n <span style={{ display: 'inline-block' }}>\n <Ellipsis\n widthLimit={220}\n title={\n isReactDom ? (\n <span>{label}</span>\n ) : (\n <span\n dangerouslySetInnerHTML={{\n __html: highlightSubstring(label, searchText),\n }}\n ></span>\n )\n }\n />\n </span>\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 <span style={{ display: 'inline-block' }}>\n <Ellipsis widthLimit={220} title={label} />\n </span>\n {isSelected && <Icon type=\"check\" className=\"ant-select-selected-icon\" />}\n </li>\n )\n })\n\n if (showEmpty && !find(children, (it) => !!it)) {\n children = <Empty size=\"mini\" />\n }\n\n return <ul className=\"ant-select-dropdown-menu\">{children}</ul>\n}\n"]}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) {
|
|
4
|
-
"@babel/helpers - typeof";
|
|
5
|
-
|
|
6
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7
|
-
return typeof o;
|
|
8
|
-
} : function (o) {
|
|
9
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
10
|
-
}, _typeof(o);
|
|
11
|
-
}
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
4
|
Object.defineProperty(exports, "__esModule", {
|
|
13
5
|
value: true
|
|
14
6
|
});
|
|
@@ -22,84 +14,15 @@ var _fieldsMap = _interopRequireDefault(require("../fieldsMap"));
|
|
|
22
14
|
var _Select = _interopRequireDefault(require("./Select"));
|
|
23
15
|
var _utils = require("./utils");
|
|
24
16
|
require("./FieldPopover.less");
|
|
25
|
-
function _getRequireWildcardCache(e) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
function
|
|
34
|
-
if (!r && e && e.__esModule) return e;
|
|
35
|
-
if (null === e || "object" != _typeof(e) && "function" != typeof e) return {
|
|
36
|
-
"default": e
|
|
37
|
-
};
|
|
38
|
-
var t = _getRequireWildcardCache(r);
|
|
39
|
-
if (t && t.has(e)) return t.get(e);
|
|
40
|
-
var n = {
|
|
41
|
-
__proto__: null
|
|
42
|
-
},
|
|
43
|
-
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
44
|
-
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
45
|
-
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
46
|
-
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
47
|
-
}
|
|
48
|
-
return n["default"] = e, t && t.set(e, n), n;
|
|
49
|
-
}
|
|
50
|
-
function _interopRequireDefault(e) {
|
|
51
|
-
return e && e.__esModule ? e : {
|
|
52
|
-
"default": e
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function _slicedToArray(r, e) {
|
|
56
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
57
|
-
}
|
|
58
|
-
function _nonIterableRest() {
|
|
59
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
60
|
-
}
|
|
61
|
-
function _unsupportedIterableToArray(r, a) {
|
|
62
|
-
if (r) {
|
|
63
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
64
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
65
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function _arrayLikeToArray(r, a) {
|
|
69
|
-
(null == a || a > r.length) && (a = r.length);
|
|
70
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
71
|
-
return n;
|
|
72
|
-
}
|
|
73
|
-
function _iterableToArrayLimit(r, l) {
|
|
74
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
75
|
-
if (null != t) {
|
|
76
|
-
var e,
|
|
77
|
-
n,
|
|
78
|
-
i,
|
|
79
|
-
u,
|
|
80
|
-
a = [],
|
|
81
|
-
f = !0,
|
|
82
|
-
o = !1;
|
|
83
|
-
try {
|
|
84
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
85
|
-
if (Object(t) !== t) return;
|
|
86
|
-
f = !1;
|
|
87
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
88
|
-
} catch (r) {
|
|
89
|
-
o = !0, n = r;
|
|
90
|
-
} finally {
|
|
91
|
-
try {
|
|
92
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
93
|
-
} finally {
|
|
94
|
-
if (o) throw n;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return a;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function _arrayWithHoles(r) {
|
|
101
|
-
if (Array.isArray(r)) return r;
|
|
102
|
-
}
|
|
17
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
20
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
21
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
23
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
24
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
25
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
103
26
|
function ValueTag(_ref) {
|
|
104
27
|
var item = _ref.item,
|
|
105
28
|
fieldItems = _ref.fieldItems,
|
|
@@ -185,7 +108,8 @@ function ValueTag(_ref) {
|
|
|
185
108
|
}, _react["default"].createElement("label", null, propsTitle || title || name), type === 'select' ? _react["default"].createElement(_Select["default"], Object.assign({}, fieldProps, {
|
|
186
109
|
propItem: propItem,
|
|
187
110
|
onChange: onSelectChange,
|
|
188
|
-
value: item === null || item === void 0 ? void 0 : item.value
|
|
111
|
+
value: item === null || item === void 0 ? void 0 : item.value,
|
|
112
|
+
showEmpty: true
|
|
189
113
|
})) : _react["default"].createElement("div", {
|
|
190
114
|
className: "".concat(clsPrefix, "-field-popover-content"),
|
|
191
115
|
onClick: function onClick(e) {
|
|
@@ -215,7 +139,7 @@ function ValueTag(_ref) {
|
|
|
215
139
|
content: renderSecondOptions(),
|
|
216
140
|
placement: "bottomLeft"
|
|
217
141
|
}, _react["default"].createElement(_tag["default"], {
|
|
218
|
-
closable: closable,
|
|
142
|
+
closable: !(closable === false || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.allowClear) === false),
|
|
219
143
|
onClick: function onClick(e) {
|
|
220
144
|
e.preventDefault();
|
|
221
145
|
e.stopPropagation();
|