tntd 3.0.66 → 3.0.67-beta.1

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.
Files changed (148) hide show
  1. package/es/color-picker/ColorPicker.js +3 -2
  2. package/es/color-picker/ColorPicker.js.map +1 -1
  3. package/es/form/style/index.less +5 -5
  4. package/es/index.less +0 -1
  5. package/es/modal/modal.js.map +1 -1
  6. package/es/query-form/Field/Checkbox.js +1 -1
  7. package/es/query-form/Field/Checkbox.js.map +1 -1
  8. package/es/query-form/Field/Composition/FieldPopover.js +363 -0
  9. package/es/query-form/Field/Composition/FieldPopover.js.map +1 -0
  10. package/es/query-form/Field/Composition/FieldPopover.less +41 -0
  11. package/es/query-form/Field/Composition/Select.js +157 -0
  12. package/es/query-form/Field/Composition/Select.js.map +1 -0
  13. package/es/query-form/Field/Composition/SelectInput.js +34 -0
  14. package/es/query-form/Field/Composition/SelectInput.js.map +1 -0
  15. package/es/query-form/Field/Composition/ValueTag.js +163 -0
  16. package/es/query-form/Field/Composition/ValueTag.js.map +1 -0
  17. package/es/query-form/Field/Composition/index.js +337 -0
  18. package/es/query-form/Field/Composition/index.js.map +1 -0
  19. package/es/query-form/Field/Composition/index.less +167 -0
  20. package/es/query-form/Field/Composition/utils.js +169 -0
  21. package/es/query-form/Field/Composition/utils.js.map +1 -0
  22. package/es/query-form/Field/SelectInput.js +16 -12
  23. package/es/query-form/Field/SelectInput.js.map +1 -1
  24. package/es/query-form/Field/fieldsMap.js +2 -2
  25. package/es/query-form/Field/fieldsMap.js.map +1 -1
  26. package/es/query-form/Field/index.js +2 -1
  27. package/es/query-form/Field/index.js.map +1 -1
  28. package/es/query-form/index.js +226 -357
  29. package/es/query-form/index.js.map +1 -1
  30. package/es/query-form/index.less +26 -77
  31. package/es/query-form-v2/index.less +133 -0
  32. package/es/query-list-scene/List.js +16 -3
  33. package/es/query-list-scene/List.js.map +1 -1
  34. package/es/query-list-scene/QueryForm.js +35 -13
  35. package/es/query-list-scene/QueryForm.js.map +1 -1
  36. package/es/query-list-scene/index.js +2 -1
  37. package/es/query-list-scene/index.js.map +1 -1
  38. package/es/scroll-bar/ScrollBar.js +8 -5
  39. package/es/scroll-bar/ScrollBar.js.map +1 -1
  40. package/es/table/hooks/use-column-setting.js.map +1 -1
  41. package/es/table/resizableTable/index.less +1 -1
  42. package/es/table/table.js +8 -2
  43. package/es/table/table.js.map +1 -1
  44. package/es/tntd-select/index.js.map +1 -1
  45. package/es/tntd-virtual-tree/index.js +0 -3
  46. package/es/tntd-virtual-tree/index.js.map +1 -1
  47. package/lib/color-picker/ColorPicker.d.ts +2 -1
  48. package/lib/color-picker/ColorPicker.d.ts.map +1 -1
  49. package/lib/color-picker/ColorPicker.js +3 -2
  50. package/lib/color-picker/ColorPicker.js.map +1 -1
  51. package/lib/form/style/index.less +5 -5
  52. package/lib/index.less +0 -1
  53. package/lib/modal/modal.d.ts.map +1 -1
  54. package/lib/modal/modal.js.map +1 -1
  55. package/lib/query-form/Field/Checkbox.js +1 -1
  56. package/lib/query-form/Field/Checkbox.js.map +1 -1
  57. package/lib/query-form/Field/Composition/FieldPopover.d.ts +19 -0
  58. package/lib/query-form/Field/Composition/FieldPopover.d.ts.map +1 -0
  59. package/lib/query-form/Field/Composition/FieldPopover.js +459 -0
  60. package/lib/query-form/Field/Composition/FieldPopover.js.map +1 -0
  61. package/lib/query-form/Field/Composition/FieldPopover.less +41 -0
  62. package/lib/query-form/Field/Composition/Select.d.ts +4 -0
  63. package/lib/query-form/Field/Composition/Select.d.ts.map +1 -0
  64. package/lib/query-form/Field/Composition/Select.js +253 -0
  65. package/lib/query-form/Field/Composition/Select.js.map +1 -0
  66. package/lib/query-form/Field/Composition/SelectInput.d.ts +3 -0
  67. package/lib/query-form/Field/Composition/SelectInput.d.ts.map +1 -0
  68. package/lib/query-form/Field/Composition/SelectInput.js +111 -0
  69. package/lib/query-form/Field/Composition/SelectInput.js.map +1 -0
  70. package/lib/query-form/Field/Composition/ValueTag.d.ts +13 -0
  71. package/lib/query-form/Field/Composition/ValueTag.d.ts.map +1 -0
  72. package/lib/query-form/Field/Composition/ValueTag.js +240 -0
  73. package/lib/query-form/Field/Composition/ValueTag.js.map +1 -0
  74. package/lib/query-form/Field/Composition/index.d.ts +15 -0
  75. package/lib/query-form/Field/Composition/index.d.ts.map +1 -0
  76. package/lib/query-form/Field/Composition/index.js +441 -0
  77. package/lib/query-form/Field/Composition/index.js.map +1 -0
  78. package/lib/query-form/Field/Composition/index.less +167 -0
  79. package/lib/query-form/Field/Composition/utils.d.ts +21 -0
  80. package/lib/query-form/Field/Composition/utils.d.ts.map +1 -0
  81. package/lib/query-form/Field/Composition/utils.js +173 -0
  82. package/lib/query-form/Field/Composition/utils.js.map +1 -0
  83. package/lib/query-form/Field/SelectInput.d.ts.map +1 -1
  84. package/lib/query-form/Field/SelectInput.js +16 -12
  85. package/lib/query-form/Field/SelectInput.js.map +1 -1
  86. package/lib/query-form/Field/fieldsMap.d.ts +6 -3
  87. package/lib/query-form/Field/fieldsMap.d.ts.map +1 -1
  88. package/lib/query-form/Field/fieldsMap.js +2 -2
  89. package/lib/query-form/Field/fieldsMap.js.map +1 -1
  90. package/lib/query-form/Field/index.d.ts.map +1 -1
  91. package/lib/query-form/Field/index.js +2 -1
  92. package/lib/query-form/Field/index.js.map +1 -1
  93. package/lib/query-form/index.d.ts +1 -36
  94. package/lib/query-form/index.d.ts.map +1 -1
  95. package/lib/query-form/index.js +262 -397
  96. package/lib/query-form/index.js.map +1 -1
  97. package/lib/query-form/index.less +26 -77
  98. package/lib/query-form-v2/index.less +133 -0
  99. package/lib/query-list-scene/List.d.ts.map +1 -1
  100. package/lib/query-list-scene/List.js +16 -3
  101. package/lib/query-list-scene/List.js.map +1 -1
  102. package/lib/query-list-scene/QueryForm.d.ts +5 -4
  103. package/lib/query-list-scene/QueryForm.d.ts.map +1 -1
  104. package/lib/query-list-scene/QueryForm.js +35 -13
  105. package/lib/query-list-scene/QueryForm.js.map +1 -1
  106. package/lib/query-list-scene/index.d.ts.map +1 -1
  107. package/lib/query-list-scene/index.js +2 -1
  108. package/lib/query-list-scene/index.js.map +1 -1
  109. package/lib/scroll-bar/ScrollBar.js +8 -5
  110. package/lib/scroll-bar/ScrollBar.js.map +1 -1
  111. package/lib/table/hooks/use-column-setting.d.ts +1 -0
  112. package/lib/table/hooks/use-column-setting.d.ts.map +1 -1
  113. package/lib/table/hooks/use-column-setting.js.map +1 -1
  114. package/lib/table/resizableTable/index.less +1 -1
  115. package/lib/table/table.d.ts.map +1 -1
  116. package/lib/table/table.js +8 -2
  117. package/lib/table/table.js.map +1 -1
  118. package/lib/tntd-select/index.d.ts.map +1 -1
  119. package/lib/tntd-select/index.js.map +1 -1
  120. package/lib/tntd-virtual-tree/index.js +0 -3
  121. package/lib/tntd-virtual-tree/index.js.map +1 -1
  122. package/package.json +3 -2
  123. package/es/checkbox/checkbox-group.js +0 -16
  124. package/es/checkbox/checkbox-group.js.map +0 -1
  125. package/es/radio/radio-group.js +0 -16
  126. package/es/radio/radio-group.js.map +0 -1
  127. package/es/steps/stepStyle/small.less +0 -5
  128. package/es/table/total-shower.js +0 -20
  129. package/es/table/total-shower.js.map +0 -1
  130. package/es/utils/simple-template.js +0 -19
  131. package/es/utils/simple-template.js.map +0 -1
  132. package/lib/checkbox/checkbox-group.d.ts +0 -8
  133. package/lib/checkbox/checkbox-group.d.ts.map +0 -1
  134. package/lib/checkbox/checkbox-group.js +0 -16
  135. package/lib/checkbox/checkbox-group.js.map +0 -1
  136. package/lib/radio/radio-group.d.ts +0 -8
  137. package/lib/radio/radio-group.d.ts.map +0 -1
  138. package/lib/radio/radio-group.js +0 -16
  139. package/lib/radio/radio-group.js.map +0 -1
  140. package/lib/steps/stepStyle/small.less +0 -5
  141. package/lib/table/total-shower.d.ts +0 -9
  142. package/lib/table/total-shower.d.ts.map +0 -1
  143. package/lib/table/total-shower.js +0 -20
  144. package/lib/table/total-shower.js.map +0 -1
  145. package/lib/utils/simple-template.d.ts +0 -9
  146. package/lib/utils/simple-template.d.ts.map +0 -1
  147. package/lib/utils/simple-template.js +0 -19
  148. package/lib/utils/simple-template.js.map +0 -1
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+
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); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _find2 = _interopRequireDefault(require("lodash/find"));
9
+ var _isArray2 = _interopRequireDefault(require("lodash/isArray"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _classnames = _interopRequireDefault(require("classnames"));
12
+ var _icon = _interopRequireDefault(require("../../../icon"));
13
+ var _ellipsis = _interopRequireDefault(require("../../../ellipsis"));
14
+ var _empty = _interopRequireDefault(require("../../../empty"));
15
+ var _utils = require("./utils");
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; }
28
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
29
+ var t = {};
30
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
31
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
32
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ };
36
+ var _default = exports["default"] = function _default(props) {
37
+ var options = props.options,
38
+ params = props.params,
39
+ _props$queryKey = props.queryKey,
40
+ queryKey = _props$queryKey === void 0 ? 'name' : _props$queryKey,
41
+ _props$fieldNames = props.fieldNames,
42
+ fieldNames = _props$fieldNames === void 0 ? {
43
+ label: 'label',
44
+ value: 'value'
45
+ } : _props$fieldNames,
46
+ loadData = props.loadData,
47
+ onChange = props.onChange,
48
+ _value = props.value,
49
+ mode = props.mode,
50
+ propItem = props.propItem,
51
+ searchText = props.searchText,
52
+ showEmpty = props.showEmpty,
53
+ rest = __rest(props, ["options", "params", "queryKey", "fieldNames", "loadData", "onChange", "value", "mode", "propItem", "searchText", "showEmpty"]);
54
+ var _useState = (0, _react.useState)(options || []),
55
+ _useState2 = _slicedToArray(_useState, 2),
56
+ items = _useState2[0],
57
+ setItems = _useState2[1];
58
+ (0, _react.useEffect)(function () {
59
+ if (loadData) {
60
+ loadData(Object.assign(_defineProperty({}, queryKey, searchText), params || {})).then(function (items) {
61
+ setItems(items);
62
+ });
63
+ }
64
+ }, [params, searchText]);
65
+ (0, _react.useEffect)(function () {
66
+ setItems(options || []);
67
+ }, [options]);
68
+ var onValueChange = function onValueChange(item) {
69
+ onChange(item, mode === 'multiple' || mode === 'tags');
70
+ };
71
+ var children = items.map(function (item) {
72
+ var labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
73
+ var valueKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || 'value';
74
+ var value = item instanceof Object ? item[valueKey] : item;
75
+ var label = item instanceof Object ? item[labelKey] : item + '';
76
+ var disabled = item instanceof Object ? item['disabled'] : false;
77
+ var isSelected = (0, _isArray2["default"])(_value) ? (_value === null || _value === void 0 ? void 0 : _value.indexOf(value)) > -1 : value === _value;
78
+ if (searchText) {
79
+ var isReactDom = _react["default"].isValidElement(label);
80
+ var _label = isReactDom ? (0, _utils.formatLabel)(label) : label;
81
+ if ((_label === null || _label === void 0 ? void 0 : _label.indexOf(searchText)) > -1) {
82
+ return _react["default"].createElement("li", {
83
+ className: (0, _classnames["default"])({
84
+ 'ant-select-dropdown-menu-item': true,
85
+ 'ant-select-dropdown-menu-item-selected': isSelected,
86
+ 'ant-select-dropdown-menu-item-disabled': disabled
87
+ }),
88
+ key: value,
89
+ value: value,
90
+ onMouseDown: function onMouseDown(e) {
91
+ return e.preventDefault();
92
+ },
93
+ onClick: function onClick() {
94
+ !disabled && onValueChange({
95
+ value: value,
96
+ propItem: propItem,
97
+ options: items
98
+ });
99
+ }
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", {
101
+ style: {
102
+ display: 'inline-block'
103
+ }
104
+ }, _react["default"].createElement(_ellipsis["default"], {
105
+ widthLimit: 220,
106
+ title: isReactDom ? _react["default"].createElement("span", null, label) : _react["default"].createElement("span", {
107
+ dangerouslySetInnerHTML: {
108
+ __html: (0, _utils.highlightSubstring)(label, searchText)
109
+ }
110
+ })
111
+ })), isSelected && _react["default"].createElement(_icon["default"], {
112
+ type: "check",
113
+ className: "ant-select-selected-icon"
114
+ }));
115
+ }
116
+ return null;
117
+ }
118
+ return _react["default"].createElement("li", {
119
+ className: (0, _classnames["default"])({
120
+ 'ant-select-dropdown-menu-item': true,
121
+ 'ant-select-dropdown-menu-item-selected': isSelected,
122
+ 'ant-select-dropdown-menu-item-disabled': disabled
123
+ }),
124
+ key: value,
125
+ value: value,
126
+ onMouseDown: function onMouseDown(e) {
127
+ return e.preventDefault();
128
+ },
129
+ onClick: function onClick() {
130
+ !disabled && onValueChange({
131
+ value: value,
132
+ options: items
133
+ });
134
+ }
135
+ }, _react["default"].createElement("span", {
136
+ style: {
137
+ display: 'inline-block'
138
+ }
139
+ }, _react["default"].createElement(_ellipsis["default"], {
140
+ widthLimit: 220,
141
+ title: label
142
+ })), isSelected && _react["default"].createElement(_icon["default"], {
143
+ type: "check",
144
+ className: "ant-select-selected-icon"
145
+ }));
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);
157
+ };
@@ -0,0 +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;AAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,IAAI,MAAM,eAAe,CAAA;AAChC,OAAO,QAAQ,MAAM,mBAAmB,CAAA;AACxC,OAAO,KAAK,MAAM,gBAAgB,CAAA;AAClC,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,EACV,SAAS,KAEP,KAAK,EADJ,IAAI,UACL,KAAK,EAhBH,+H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C,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"]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
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); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = SelectInput;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _SelectInput = _interopRequireDefault(require("../SelectInput"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
+ 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); }
12
+ 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; }
13
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
14
+ 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."); }
15
+ 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; } }
16
+ 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; }
17
+ 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; } }
18
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
19
+ function SelectInput(props) {
20
+ var value = props.value,
21
+ onChange = props.onChange;
22
+ var _useState = (0, _react.useState)(value),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ iValue = _useState2[0],
25
+ setIValue = _useState2[1];
26
+ (0, _react.useEffect)(function () {
27
+ setIValue(value);
28
+ }, [value]);
29
+ return _react["default"].createElement(_SelectInput["default"], Object.assign({}, props, {
30
+ value: iValue,
31
+ _onChange: onChange,
32
+ onChange: setIValue
33
+ }));
34
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectInput.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/SelectInput.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,eAAe,MAAM,gBAAgB,CAAA;AAE5C,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAK;IACvC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;IACjC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE3C,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,CAAC,KAAK,CAAC,CAAA;IAClB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,OAAO,oBAAC,eAAe,oBAAK,KAAK,IAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,IAAI,CAAA;AAChG,CAAC","sourcesContent":["import React, { useEffect, useState } from 'react'\nimport SelectInputBase from '../SelectInput'\n\nexport default function SelectInput(props) {\n const { value, onChange } = props\n const [iValue, setIValue] = useState(value)\n\n useEffect(() => {\n setIValue(value)\n }, [value])\n\n return <SelectInputBase {...props} value={iValue} _onChange={onChange} onChange={setIValue} />\n}\n"]}
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+
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); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = ValueTag;
8
+ var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
9
+ var _find2 = _interopRequireDefault(require("lodash/find"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _popover = _interopRequireDefault(require("../../../popover"));
12
+ var _tag = _interopRequireDefault(require("../../../tag"));
13
+ var _fieldsMap = _interopRequireDefault(require("../fieldsMap"));
14
+ var _SelectInput = _interopRequireDefault(require("./SelectInput"));
15
+ var _Select = _interopRequireDefault(require("./Select"));
16
+ var _utils = require("./utils");
17
+ require("./FieldPopover.less");
18
+ 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); }
19
+ 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; }
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
21
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
22
+ 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."); }
23
+ 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; } }
24
+ 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; }
25
+ 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; } }
26
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
27
+ function ValueTag(_ref) {
28
+ var item = _ref.item,
29
+ fieldItems = _ref.fieldItems,
30
+ locale = _ref.locale,
31
+ onDelete = _ref.onDelete,
32
+ value = _ref.value,
33
+ onChange = _ref.onChange,
34
+ clsPrefix = _ref.clsPrefix,
35
+ form = _ref.form,
36
+ handleTag = _ref.handleTag;
37
+ var _a;
38
+ var _useState = (0, _react.useState)(),
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ visible = _useState2[0],
41
+ setVisible = _useState2[1];
42
+ var propItem = ((_a = (0, _find2["default"])(fieldItems, function (it) {
43
+ var _a;
44
+ return ((_a = it.props) === null || _a === void 0 ? void 0 : _a.name) === item.key;
45
+ })) === null || _a === void 0 ? void 0 : _a.props) || {};
46
+ var name = propItem.name,
47
+ propsTitle = propItem.propsTitle,
48
+ title = propItem.title,
49
+ _propItem$type = propItem.type,
50
+ type = _propItem$type === void 0 ? 'input' : _propItem$type,
51
+ className = propItem.className,
52
+ component = propItem.component,
53
+ fieldProps = propItem.props,
54
+ _propItem$closable = propItem.closable,
55
+ closable = _propItem$closable === void 0 ? true : _propItem$closable;
56
+ var handleVisibleChange = function handleVisibleChange(visible) {
57
+ setVisible(visible);
58
+ };
59
+ var close = function close() {
60
+ setVisible(false);
61
+ };
62
+ var onFieldChange = function onFieldChange() {
63
+ var _a;
64
+ var copyValue = (0, _cloneDeep2["default"])(value);
65
+ var index = copyValue.findIndex(function (v) {
66
+ return v.key === name;
67
+ });
68
+ copyValue[index].value = arguments.length <= 0 ? undefined : arguments[0];
69
+ if (['date', 'checkbox'].includes(type) || type === 'dateRange' && ((_a = arguments.length <= 1 ? undefined : arguments[1]) === null || _a === void 0 ? void 0 : _a[1])) {
70
+ close();
71
+ }
72
+ onChange(copyValue, false, (arguments.length <= 0 ? undefined : arguments[0]) !== undefined, type !== 'selectInput');
73
+ (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
74
+ };
75
+ var onSelectChange = function onSelectChange(v, isMultiple) {
76
+ var _a, _b, _c;
77
+ var copyValue = (0, _cloneDeep2["default"])(value || []);
78
+ var index = copyValue.findIndex(function (v) {
79
+ return v.key === name;
80
+ });
81
+ if (isMultiple) {
82
+ if (!((_b = (_a = copyValue[index]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.length)) {
83
+ copyValue[index].value = [v === null || v === void 0 ? void 0 : v.value];
84
+ } else {
85
+ if (((_c = copyValue[index].value) === null || _c === void 0 ? void 0 : _c.indexOf(v.value)) > -1) {
86
+ copyValue[index].value = copyValue[index].value.filter(function (val) {
87
+ return val !== v.value;
88
+ });
89
+ } else {
90
+ copyValue[index].value.push(v.value);
91
+ }
92
+ }
93
+ } else {
94
+ copyValue[index].value = v === null || v === void 0 ? void 0 : v.value;
95
+ close();
96
+ }
97
+ onChange(copyValue, false, true);
98
+ (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
99
+ };
100
+ var renderSecondOptions = function renderSecondOptions() {
101
+ var _a;
102
+ var isSelectInput = type === 'selectInput';
103
+ var Field = isSelectInput ? _SelectInput["default"] : component || _fieldsMap["default"][type] || function () {
104
+ return null;
105
+ };
106
+ return _react["default"].createElement("div", {
107
+ onClick: function onClick(e) {
108
+ return e.stopPropagation();
109
+ },
110
+ className: className
111
+ }, _react["default"].createElement("label", null, propsTitle || title || name), type === 'select' ? _react["default"].createElement(_Select["default"], Object.assign({}, fieldProps, {
112
+ propItem: propItem,
113
+ onChange: onSelectChange,
114
+ value: item === null || item === void 0 ? void 0 : item.value,
115
+ showEmpty: true
116
+ })) : _react["default"].createElement("div", {
117
+ className: "".concat(clsPrefix, "-field-popover-content"),
118
+ onClick: function onClick(e) {
119
+ return e.stopPropagation();
120
+ }
121
+ }, _react["default"].createElement(Field, Object.assign({
122
+ form: form,
123
+ value: item === null || item === void 0 ? void 0 : item.value
124
+ }, fieldProps, {
125
+ style: Object.assign(Object.assign({}, fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style), {
126
+ width: ((_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style) === null || _a === void 0 ? void 0 : _a.width) || (isSelectInput ? '361px' : '250px')
127
+ }),
128
+ close: close,
129
+ onChange: onFieldChange,
130
+ name: name
131
+ }))));
132
+ };
133
+ var _isInput = (0, _utils.isInput)(type) && !component;
134
+ if ((item === null || item === void 0 ? void 0 : item.value) === undefined) {
135
+ return null;
136
+ }
137
+ return _react["default"].createElement(_popover["default"], {
138
+ trigger: "click",
139
+ visible: visible && !_isInput,
140
+ onVisibleChange: handleVisibleChange,
141
+ overlayClassName: "".concat(clsPrefix, "-field-popover"),
142
+ content: renderSecondOptions(),
143
+ placement: "bottomLeft"
144
+ }, _react["default"].createElement(_tag["default"], {
145
+ closable: !(closable === false || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.allowClear) === false),
146
+ onClick: function onClick(e) {
147
+ e.preventDefault();
148
+ e.stopPropagation();
149
+ if (!_isInput) {
150
+ setVisible(true);
151
+ } else {
152
+ handleTag((0, _cloneDeep2["default"])(item));
153
+ }
154
+ },
155
+ onClose: function onClose(e) {
156
+ return onDelete(item.key, e);
157
+ },
158
+ ellipsisOptions: {
159
+ widthLimit: '140px'
160
+ },
161
+ border: false
162
+ }, (0, _utils.getLabel)(item, fieldItems, locale)));
163
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValueTag.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/ValueTag.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,OAAO,MAAM,kBAAkB,CAAA;AACtC,OAAO,GAAG,MAAM,cAAc,CAAA;AAC9B,OAAO,SAAS,MAAM,cAAc,CAAA;AACpC,OAAO,WAAW,MAAM,eAAe,CAAA;AACvC,OAAO,SAAS,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,qBAAqB,CAAA;AAE5B,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,IAAI,EACJ,UAAU,EACV,MAAM,EACN,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,SAAS,GACV;;IACC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAE,CAAA;IAExC,MAAM,QAAQ,GAAG,CAAA,MAAA,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,WAAC,OAAA,CAAA,MAAA,EAAE,CAAC,KAAK,0CAAE,IAAI,MAAK,IAAI,CAAC,GAAG,CAAA,EAAA,CAAC,0CAAE,KAAK,KAAI,EAAE,CAAA;IACnF,MAAM,EACJ,IAAI,EACJ,UAAU,EACV,KAAK,EACL,IAAI,GAAG,OAAO,EACd,SAAS,EACT,SAAS,EACT,KAAK,EAAE,UAAU,EACjB,QAAQ,GAAG,IAAI,GAChB,GAAG,QAAQ,CAAA;IAEZ,MAAM,m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,OAAO,IAAI,CAAC,QAAQ,EAC7B,eAAe,EAAE,mBAAmB,EACpC,gBAAgB,EAAE,GAAG,SAAS,gBAAgB,EAC9C,OAAO,EAAE,mBAAmB,EAAE,EAC9B,SAAS,EAAC,YAAY;QAEtB,oBAAC,GAAG,IACF,QAAQ,EAAE,CAAC,CAAC,QAAQ,KAAK,KAAK,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,MAAK,KAAK,CAAC,EACnE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACb,CAAC,CAAC,cAAc,EAAE,CAAA;gBAClB,CAAC,CAAC,eAAe,EAAE,CAAA;gBACnB,IAAI,CAAC,QAAQ,EAAE;oBACb,UAAU,CAAC,IAAI,CAAC,CAAA;iBACjB;qBAAM;oBACL,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;iBAC3B;YACH,CAAC,EACD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,EACrC,eAAe,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,EACxC,MAAM,EAAE,KAAK,IAEZ,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,CAC/B,CACE,CACX,CAAA;AACH,CAAC","sourcesContent":["import React, { useState } from 'react'\nimport { find, cloneDeep } from 'lodash'\nimport Popover from '../../../popover'\nimport Tag from '../../../tag'\nimport fieldsMap from '../fieldsMap'\nimport SelectInput from './SelectInput'\nimport SelectOpt from './Select'\nimport { getLabel, isInput } from './utils'\nimport './FieldPopover.less'\n\nexport default function ValueTag({\n item,\n fieldItems,\n locale,\n onDelete,\n value,\n onChange,\n clsPrefix,\n form,\n handleTag,\n}) {\n const [visible, setVisible] = useState()\n\n const propItem = find(fieldItems, (it) => it.props?.name === item.key)?.props || {}\n const {\n name,\n propsTitle,\n title,\n type = 'input',\n className,\n component,\n props: fieldProps,\n closable = true,\n } = propItem\n\n const handleVisibleChange = (visible) => {\n setVisible(visible)\n }\n\n const close = () => {\n setVisible(false)\n }\n\n const onFieldChange = (...args) => {\n const copyValue = cloneDeep(value)\n const index = copyValue.findIndex((v) => v.key === 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 onSelectChange = (v, isMultiple) => {\n const copyValue = cloneDeep(value || [])\n let index = copyValue.findIndex((v) => v.key === name)\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 } 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 renderSecondOptions = () => {\n const isSelectInput = type === 'selectInput'\n const Field = isSelectInput ? SelectInput : 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 propItem={propItem}\n onChange={onSelectChange}\n value={item?.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={item?.value}\n {...fieldProps}\n style={{\n ...fieldProps?.style,\n width: fieldProps?.style?.width || (isSelectInput ? '361px' : '250px'),\n }}\n close={close}\n onChange={onFieldChange}\n name={name}\n />\n </div>\n )}\n </div>\n )\n }\n\n const _isInput = isInput(type) && !component\n\n if (item?.value === undefined) {\n return null\n }\n\n return (\n <Popover\n trigger=\"click\"\n visible={visible && !_isInput}\n onVisibleChange={handleVisibleChange}\n overlayClassName={`${clsPrefix}-field-popover`}\n content={renderSecondOptions()}\n placement=\"bottomLeft\"\n >\n <Tag\n closable={!(closable === false || fieldProps?.allowClear === false)}\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n if (!_isInput) {\n setVisible(true)\n } else {\n handleTag(cloneDeep(item))\n }\n }}\n onClose={(e) => onDelete(item.key, e)}\n ellipsisOptions={{ widthLimit: '140px' }}\n border={false}\n >\n {getLabel(item, fieldItems, locale)}\n </Tag>\n </Popover>\n )\n}\n"]}