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.
Files changed (125) hide show
  1. package/es/modal/style/confirm.less +6 -6
  2. package/es/query-form/Field/Checkbox.js +1 -1
  3. package/es/query-form/Field/Checkbox.js.map +1 -1
  4. package/es/query-form/Field/Composition/FieldPopover.js +53 -34
  5. package/es/query-form/Field/Composition/FieldPopover.js.map +1 -1
  6. package/es/query-form/Field/Composition/Select.js +17 -14
  7. package/es/query-form/Field/Composition/Select.js.map +1 -1
  8. package/es/query-form/Field/Composition/index.js +16 -105
  9. package/es/query-form/Field/Composition/index.js.map +1 -1
  10. package/es/query-form/Field/Composition/index.less +0 -1
  11. package/es/query-form/Field/Composition/utils.js +107 -0
  12. package/es/query-form/Field/Composition/utils.js.map +1 -1
  13. package/es/query-form/index.js +145 -319
  14. package/es/query-form/index.js.map +1 -1
  15. package/es/query-form/index.less +16 -56
  16. package/es/query-form2/Field/Checkbox.js +23 -0
  17. package/es/query-form2/Field/Checkbox.js.map +1 -0
  18. package/es/query-form2/Field/Composition/FieldPopover.js +308 -0
  19. package/es/query-form2/Field/Composition/FieldPopover.js.map +1 -0
  20. package/es/query-form2/Field/Composition/FieldPopover.less +35 -0
  21. package/es/query-form2/Field/Composition/Select.js +104 -0
  22. package/es/query-form2/Field/Composition/Select.js.map +1 -0
  23. package/es/query-form2/Field/Composition/index.js +299 -0
  24. package/es/query-form2/Field/Composition/index.js.map +1 -0
  25. package/es/query-form2/Field/Composition/index.less +114 -0
  26. package/es/query-form2/Field/Composition/utils.js +19 -0
  27. package/es/query-form2/Field/Composition/utils.js.map +1 -0
  28. package/es/query-form2/Field/Select.js +59 -0
  29. package/es/query-form2/Field/Select.js.map +1 -0
  30. package/es/query-form2/Field/SelectInput.js +87 -0
  31. package/es/query-form2/Field/SelectInput.js.map +1 -0
  32. package/es/query-form2/Field/fieldsMap.js +28 -0
  33. package/es/query-form2/Field/fieldsMap.js.map +1 -0
  34. package/es/query-form2/Field/index.js +117 -0
  35. package/es/query-form2/Field/index.js.map +1 -0
  36. package/es/query-form2/createActions.js +47 -0
  37. package/es/query-form2/createActions.js.map +1 -0
  38. package/es/query-form2/index.js +345 -0
  39. package/es/query-form2/index.js.map +1 -0
  40. package/es/query-form2/index.less +136 -0
  41. package/es/query-form2/useForm.js +6 -0
  42. package/es/query-form2/useForm.js.map +1 -0
  43. package/es/query-list-scene/QueryForm.js +1 -3
  44. package/es/query-list-scene/QueryForm.js.map +1 -1
  45. package/es/select/select.less +1 -0
  46. package/es/tag/color.less +28 -18
  47. package/es/tag/tag.less +42 -6
  48. package/lib/modal/style/confirm.less +6 -6
  49. package/lib/query-form/Field/Checkbox.js +1 -1
  50. package/lib/query-form/Field/Checkbox.js.map +1 -1
  51. package/lib/query-form/Field/Composition/FieldPopover.js +83 -65
  52. package/lib/query-form/Field/Composition/FieldPopover.js.map +1 -1
  53. package/lib/query-form/Field/Composition/Select.d.ts.map +1 -1
  54. package/lib/query-form/Field/Composition/Select.js +18 -15
  55. package/lib/query-form/Field/Composition/Select.js.map +1 -1
  56. package/lib/query-form/Field/Composition/index.d.ts +0 -4
  57. package/lib/query-form/Field/Composition/index.js +29 -121
  58. package/lib/query-form/Field/Composition/index.js.map +1 -1
  59. package/lib/query-form/Field/Composition/index.less +0 -1
  60. package/lib/query-form/Field/Composition/utils.d.ts +16 -0
  61. package/lib/query-form/Field/Composition/utils.d.ts.map +1 -1
  62. package/lib/query-form/Field/Composition/utils.js +114 -0
  63. package/lib/query-form/Field/Composition/utils.js.map +1 -1
  64. package/lib/query-form/index.d.ts +15 -24
  65. package/lib/query-form/index.d.ts.map +1 -1
  66. package/lib/query-form/index.js +164 -344
  67. package/lib/query-form/index.js.map +1 -1
  68. package/lib/query-form/index.less +16 -56
  69. package/lib/query-form2/Field/Checkbox.d.ts +8 -0
  70. package/lib/query-form2/Field/Checkbox.d.ts.map +1 -0
  71. package/lib/query-form2/Field/Checkbox.js +28 -0
  72. package/lib/query-form2/Field/Checkbox.js.map +1 -0
  73. package/lib/query-form2/Field/Composition/FieldPopover.d.ts +19 -0
  74. package/lib/query-form2/Field/Composition/FieldPopover.d.ts.map +1 -0
  75. package/lib/query-form2/Field/Composition/FieldPopover.js +347 -0
  76. package/lib/query-form2/Field/Composition/FieldPopover.js.map +1 -0
  77. package/lib/query-form2/Field/Composition/FieldPopover.less +35 -0
  78. package/lib/query-form2/Field/Composition/Select.d.ts +4 -0
  79. package/lib/query-form2/Field/Composition/Select.d.ts.map +1 -0
  80. package/lib/query-form2/Field/Composition/Select.js +128 -0
  81. package/lib/query-form2/Field/Composition/Select.js.map +1 -0
  82. package/lib/query-form2/Field/Composition/index.d.ts +14 -0
  83. package/lib/query-form2/Field/Composition/index.d.ts.map +1 -0
  84. package/lib/query-form2/Field/Composition/index.js +349 -0
  85. package/lib/query-form2/Field/Composition/index.js.map +1 -0
  86. package/lib/query-form2/Field/Composition/index.less +114 -0
  87. package/lib/query-form2/Field/Composition/utils.d.ts +6 -0
  88. package/lib/query-form2/Field/Composition/utils.d.ts.map +1 -0
  89. package/lib/query-form2/Field/Composition/utils.js +27 -0
  90. package/lib/query-form2/Field/Composition/utils.js.map +1 -0
  91. package/lib/query-form2/Field/Select.d.ts +4 -0
  92. package/lib/query-form2/Field/Select.d.ts.map +1 -0
  93. package/lib/query-form2/Field/Select.js +80 -0
  94. package/lib/query-form2/Field/Select.js.map +1 -0
  95. package/lib/query-form2/Field/SelectInput.d.ts +4 -0
  96. package/lib/query-form2/Field/SelectInput.d.ts.map +1 -0
  97. package/lib/query-form2/Field/SelectInput.js +100 -0
  98. package/lib/query-form2/Field/SelectInput.js.map +1 -0
  99. package/lib/query-form2/Field/fieldsMap.d.ts +27 -0
  100. package/lib/query-form2/Field/fieldsMap.d.ts.map +1 -0
  101. package/lib/query-form2/Field/fieldsMap.js +35 -0
  102. package/lib/query-form2/Field/fieldsMap.js.map +1 -0
  103. package/lib/query-form2/Field/index.d.ts +14 -0
  104. package/lib/query-form2/Field/index.d.ts.map +1 -0
  105. package/lib/query-form2/Field/index.js +147 -0
  106. package/lib/query-form2/Field/index.js.map +1 -0
  107. package/lib/query-form2/createActions.d.ts +14 -0
  108. package/lib/query-form2/createActions.d.ts.map +1 -0
  109. package/lib/query-form2/createActions.js +54 -0
  110. package/lib/query-form2/createActions.js.map +1 -0
  111. package/lib/query-form2/index.d.ts +36 -0
  112. package/lib/query-form2/index.d.ts.map +1 -0
  113. package/lib/query-form2/index.js +385 -0
  114. package/lib/query-form2/index.js.map +1 -0
  115. package/lib/query-form2/index.less +136 -0
  116. package/lib/query-form2/useForm.d.ts +13 -0
  117. package/lib/query-form2/useForm.d.ts.map +1 -0
  118. package/lib/query-form2/useForm.js +13 -0
  119. package/lib/query-form2/useForm.js.map +1 -0
  120. package/lib/query-list-scene/QueryForm.js +2 -3
  121. package/lib/query-list-scene/QueryForm.js.map +1 -1
  122. package/lib/select/select.less +1 -0
  123. package/lib/tag/color.less +28 -18
  124. package/lib/tag/tag.less +42 -6
  125. package/package.json +1 -1
@@ -1,76 +1,36 @@
1
1
  .tnt-queryform {
2
- display: flex;
2
+ &-top {
3
+ display: flex;
4
+ &-body {
5
+ flex: 1;
6
+ .ant-btn {
7
+ margin-right: 10px;
8
+ }
9
+ }
10
+ }
11
+
12
+ &-bottom {
13
+ margin-bottom: @margin-sm;
14
+ }
3
15
 
4
16
  &-extra {
5
- line-height: 32px;
17
+ // line-height: 32px;
6
18
  margin-left: @margin-sm;
7
19
  & > * {
8
20
  margin-left: @margin-xs;
9
21
  }
10
22
  }
11
23
 
12
- &-actions {
13
- align-items: center;
14
- display: inline-block;
15
- height: 32px;
16
- line-height: 32px;
17
- position: absolute;
18
- right: 0;
19
-
20
- & > *:not(.expand-link) {
21
- margin-right: 10px;
22
- }
23
- & > .expand-link {
24
- padding: 0;
25
- margin-right: 0;
26
- }
27
- & > .ant-badge {
28
- .tnt-icon {
29
- margin-right: @margin-xs;
30
- }
31
- }
32
- }
33
-
34
24
  .ant-form {
35
- display: inline-block;
36
- margin-bottom: @margin-sm;
37
- display: flex;
38
- flex: 1;
25
+ // margin-bottom: @margin-sm;
39
26
  &.ant-form-inline {
40
27
  flex-wrap: unset;
41
28
  position: relative;
42
29
  }
43
30
 
44
- & > div:nth-child(1) {
45
- height: 32px;
46
- overflow: hidden;
47
- .ant-form-item-label {
48
- label {
49
- // bottom: 4px;
50
- }
51
- }
52
- }
53
-
54
- &.expanded {
55
- & > div:nth-child(1) {
56
- height: auto !important;
57
- }
58
- }
59
-
60
- &.showMore {
61
- & > div:nth-child(1) {
62
- .ant-form-item {
63
- margin-bottom: @margin-sm;
64
- }
65
- }
66
- }
67
-
68
- & > div:nth-child(2) {
69
- display: flex;
70
- }
71
-
72
31
  &.ant-form-inline .ant-form-item {
73
32
  margin-right: 10px;
33
+ margin-bottom: @margin-sm;
74
34
  display: inline-block;
75
35
  }
76
36
 
@@ -0,0 +1,8 @@
1
+ declare function _default({ value, onChange, ...props }: {
2
+ [x: string]: any;
3
+ value: any;
4
+ onChange: any;
5
+ }): React.JSX.Element;
6
+ export default _default;
7
+ import React from "react";
8
+ //# sourceMappingURL=Checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/query-form2/Field/Checkbox.js"],"names":[],"mappings":"AAIe;;;;sBAQd"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _checkbox = _interopRequireDefault(require("../../checkbox"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
13
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
14
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
15
+ }
16
+ return t;
17
+ };
18
+ var _default = exports["default"] = function _default(_a) {
19
+ var value = _a.value,
20
+ _onChange = _a.onChange,
21
+ props = __rest(_a, ["value", "onChange"]);
22
+ return _react["default"].createElement(_checkbox["default"], Object.assign({}, props, {
23
+ checked: value,
24
+ onChange: function onChange(evt) {
25
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(evt.target.checked);
26
+ }
27
+ }));
28
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/query-form2/Field/Checkbox.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAyB;AAEzB,8DAAqC;AAErC,kBAAe,CAAC,EAA6B,EAAE,EAAE;QAAjC,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,cAA3B,qBAA6B,CAAF;IAAO,OAAA,CAChD,8BAAC,kBAAQ,oBACH,KAAK,IACT,OAAO,EAAE,KAAK,EACd,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"]}
@@ -0,0 +1,19 @@
1
+ declare var _default: React.ForwardRefExoticComponent<Pick<{
2
+ [x: string]: any;
3
+ visible: any;
4
+ setVisible: any;
5
+ searchText: any;
6
+ children: any;
7
+ value: any;
8
+ regex: any;
9
+ fieldItems: any;
10
+ propItem: any;
11
+ setFieldItem: any;
12
+ onChange: any;
13
+ form: any;
14
+ locale: any;
15
+ clsPrefix: any;
16
+ }, string | number> & React.RefAttributes<any>>;
17
+ export default _default;
18
+ import React from "react";
19
+ //# sourceMappingURL=FieldPopover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldPopover.d.ts","sourceRoot":"","sources":["../../../../src/query-form2/Field/Composition/FieldPopover.js"],"names":[],"mappings":""}
@@ -0,0 +1,347 @@
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 _get2 = _interopRequireDefault(require("lodash/get"));
9
+ var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _popover = _interopRequireDefault(require("../../../popover"));
12
+ var _Select = _interopRequireDefault(require("./Select"));
13
+ var _utils = require("./utils");
14
+ var _fieldsMap = _interopRequireWildcard(require("../fieldsMap"));
15
+ require("./FieldPopover.less");
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(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20
+ 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."); }
21
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
22
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
23
+ 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; } }
24
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
28
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
29
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
30
+ }
31
+ return t;
32
+ };
33
+ var isInput = function isInput(type) {
34
+ return ['input', 'string', 'search', 'number', 'inputNumber'].includes(type);
35
+ };
36
+ var FieldPopover = function FieldPopover(_a, ref) {
37
+ var visible = _a.visible,
38
+ setVisible = _a.setVisible,
39
+ searchText = _a.searchText,
40
+ children = _a.children,
41
+ value = _a.value,
42
+ regex = _a.regex,
43
+ fieldItems = _a.fieldItems,
44
+ propItem = _a.propItem,
45
+ setFieldItem = _a.setFieldItem,
46
+ onChange = _a.onChange,
47
+ form = _a.form,
48
+ locale = _a.locale,
49
+ clsPrefix = _a.clsPrefix,
50
+ props = __rest(_a, ["visible", "setVisible", "searchText", "children", "value", "regex", "fieldItems", "propItem", "setFieldItem", "onChange", "form", "locale", "clsPrefix"]);
51
+ var _useState = (0, _react.useState)(undefined),
52
+ _useState2 = _slicedToArray(_useState, 2),
53
+ searchTarget = _useState2[0],
54
+ setSearchTarget = _useState2[1];
55
+ var _useState3 = (0, _react.useState)(false),
56
+ _useState4 = _slicedToArray(_useState3, 2),
57
+ popoverContent = _useState4[0],
58
+ setPopoverContent = _useState4[1];
59
+ var onPropsClick = function onPropsClick(props) {
60
+ var _ref = props || {},
61
+ _ref$type = _ref.type,
62
+ type = _ref$type === void 0 ? 'input' : _ref$type;
63
+ var copyValue = (0, _cloneDeep2["default"])(value);
64
+ if (!(copyValue === null || copyValue === void 0 ? void 0 : copyValue.find(function (v) {
65
+ return v.key === props.name;
66
+ }))) {
67
+ copyValue.push({
68
+ key: props.name,
69
+ value: type === 'array' ? [] : '',
70
+ closable: false,
71
+ label: (props.propsTitle || props.title || props.name) + ':'
72
+ });
73
+ }
74
+ setFieldItem(props);
75
+ if (isInput(type)) {
76
+ var target = copyValue.find(function (v) {
77
+ return v.key === props.name;
78
+ });
79
+ onChange(target, true);
80
+ close();
81
+ return;
82
+ }
83
+ setVisible(true);
84
+ setPopoverContent(true);
85
+ onChange(copyValue);
86
+ };
87
+ (0, _react.useImperativeHandle)(ref, function () {
88
+ return {
89
+ onPropsClick: onPropsClick
90
+ };
91
+ });
92
+ var onSelectChange = function onSelectChange(v, isMultiple) {
93
+ var _a, _b, _c, _d, _e, _f, _g;
94
+ var _ref2 = propItem || (v === null || v === void 0 ? void 0 : v.propItem) || {},
95
+ fieldProps = _ref2.props; // 直接搜索拿v.xx的值
96
+ var copyValue = (0, _cloneDeep2["default"])(value || []);
97
+ var index;
98
+ if (v === null || v === void 0 ? void 0 : v.propItem) {
99
+ var _index = copyValue.findIndex(function (vv) {
100
+ var _a;
101
+ return vv.key === ((_a = v.propItem) === null || _a === void 0 ? void 0 : _a.name);
102
+ });
103
+ if (_index > -1) {
104
+ index = _index;
105
+ } else {
106
+ copyValue.push({
107
+ key: (_a = v.propItem) === null || _a === void 0 ? void 0 : _a.name,
108
+ value: isMultiple ? [] : '',
109
+ 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)) + ':'
110
+ });
111
+ index = copyValue.length - 1;
112
+ }
113
+ setFieldItem(v.propItem);
114
+ } else {
115
+ index = copyValue.findIndex(function (v) {
116
+ return v.key === (propItem === null || propItem === void 0 ? void 0 : propItem.name);
117
+ });
118
+ }
119
+ if (isMultiple) {
120
+ if (!((_f = (_e = copyValue[index]) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.length)) {
121
+ copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + (v === null || v === void 0 ? void 0 : v.label);
122
+ copyValue[index].value = [v === null || v === void 0 ? void 0 : v.value];
123
+ } else {
124
+ if (((_g = copyValue[index].value) === null || _g === void 0 ? void 0 : _g.indexOf(v.value)) > -1) {
125
+ copyValue[index].value = copyValue[index].value.filter(function (val) {
126
+ return val !== v.value;
127
+ });
128
+ var _regex = new RegExp("\\|?".concat(v.label), 'g'); //new RegExp(`\\|?${variable}`, 'g')
129
+ var result = copyValue[index].label.replace(_regex, '');
130
+ copyValue[index].label = result;
131
+ } else {
132
+ copyValue[index].value.push(v.value);
133
+ copyValue[index].label += ' | ' + (v === null || v === void 0 ? void 0 : v.label);
134
+ }
135
+ }
136
+ } else {
137
+ copyValue[index].value = v === null || v === void 0 ? void 0 : v.value;
138
+ copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + (v === null || v === void 0 ? void 0 : v.label);
139
+ close();
140
+ }
141
+ copyValue[index].closable = true;
142
+ onChange(copyValue, false, true);
143
+ (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
144
+ };
145
+ var onFieldChange = function onFieldChange() {
146
+ var _a, _b;
147
+ var _ref3 = propItem || {},
148
+ type = _ref3.type,
149
+ component = _ref3.component,
150
+ fieldProps = _ref3.props,
151
+ setLabel = _ref3.setLabel;
152
+ var _ref4 = fieldProps || {},
153
+ options = _ref4.options;
154
+ var copyValue = (0, _cloneDeep2["default"])(value);
155
+ var index = copyValue.findIndex(function (v) {
156
+ return v.key === (propItem === null || propItem === void 0 ? void 0 : propItem.name);
157
+ });
158
+ copyValue[index].value = arguments.length <= 0 ? undefined : arguments[0];
159
+ if (type === 'date') {
160
+ copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + (arguments.length <= 1 ? undefined : arguments[1]);
161
+ close();
162
+ } else if (type === 'dateRange') {
163
+ copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + ((_a = arguments.length <= 1 ? undefined : arguments[1]) === null || _a === void 0 ? void 0 : _a.join('~'));
164
+ if ((_b = arguments.length <= 1 ? undefined : arguments[1]) === null || _b === void 0 ? void 0 : _b[1]) {
165
+ close();
166
+ }
167
+ } else if (type === 'selectInput') {
168
+ var key = (0, _get2["default"])(Object.keys(arguments.length <= 0 ? undefined : arguments[0]), '0');
169
+ var val = (0, _get2["default"])(arguments.length <= 0 ? undefined : arguments[0], key);
170
+ var label = (0, _utils.getLabelFromOptions)(key, options);
171
+ copyValue[index].label = "".concat(label, ": ").concat(val);
172
+ } else if (type === 'checkbox') {
173
+ copyValue[index].label = "".concat(copyValue[index].label.match(/(.*:)/)[0], " ").concat((arguments.length <= 0 ? undefined : arguments[0]) ? local.Yes : local.No);
174
+ close();
175
+ } else if (!type && component) {
176
+ if (setLabel) {
177
+ // setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制
178
+ copyValue[index].label = setLabel(arguments.length <= 0 ? undefined : arguments[0]);
179
+ } else {
180
+ copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + ((arguments.length <= 1 ? undefined : arguments[1]) || (arguments.length <= 0 ? undefined : arguments[0]));
181
+ }
182
+ close();
183
+ }
184
+ copyValue[index].closable = true;
185
+ onChange(copyValue, false, true);
186
+ (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
187
+ };
188
+ var close = function close() {
189
+ setVisible(false);
190
+ setPopoverContent(false);
191
+ };
192
+ var handleVisibleChange = function handleVisibleChange() {
193
+ if (!visible && !regex.test(searchText)) {
194
+ setVisible(true);
195
+ } else {
196
+ close();
197
+ }
198
+ };
199
+ (0, _react.useEffect)(function () {
200
+ var bool1 = false,
201
+ bool2 = false;
202
+ if (searchText && !propItem) {
203
+ fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.forEach(function (v) {
204
+ var _ref5 = v.props || {},
205
+ name = _ref5.name,
206
+ propsTitle = _ref5.propsTitle,
207
+ title = _ref5.title,
208
+ type = _ref5.type,
209
+ props = _ref5.props;
210
+ var _propsTitle = propsTitle || title || name;
211
+ if ((_propsTitle === null || _propsTitle === void 0 ? void 0 : _propsTitle.indexOf(searchText)) > -1) {
212
+ bool1 = true;
213
+ }
214
+ var sOptions = type !== 'select' ? [] : (props === null || props === void 0 ? void 0 : props.options) || [];
215
+ var fieldNames = props === null || props === void 0 ? void 0 : props.fieldNames;
216
+ var target = sOptions === null || sOptions === void 0 ? void 0 : sOptions.find(function (item) {
217
+ var labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
218
+ var label = item instanceof Object ? item[labelKey] : item + '';
219
+ return (label === null || label === void 0 ? void 0 : label.indexOf(searchText)) > -1;
220
+ });
221
+ if (target) {
222
+ bool2 = true;
223
+ }
224
+ });
225
+ setSearchTarget(!bool2 && !bool1 ? null : {
226
+ propsTitle: bool1,
227
+ propsValue: bool2
228
+ });
229
+ } else {
230
+ setSearchTarget(undefined);
231
+ }
232
+ }, [fieldItems, searchText, propItem]);
233
+ var renderFirstOptions = function renderFirstOptions(menu) {
234
+ return _react["default"].createElement("div", null, (!searchText || (searchTarget === null || searchTarget === void 0 ? void 0 : searchTarget.propsTitle)) && _react["default"].createElement("label", null, locale.propTitle), _react["default"].createElement("ul", {
235
+ className: "ant-select-dropdown-menu"
236
+ }, fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.map(function (v) {
237
+ var _ref6 = v.props || {},
238
+ name = _ref6.name,
239
+ propsTitle = _ref6.propsTitle,
240
+ title = _ref6.title,
241
+ type = _ref6.type,
242
+ props = _ref6.props;
243
+ var _propsTitle = propsTitle || title || name;
244
+ if (searchText) {
245
+ if ((_propsTitle === null || _propsTitle === void 0 ? void 0 : _propsTitle.indexOf(searchText)) > -1) {
246
+ return _react["default"].createElement("li", {
247
+ className: "ant-select-dropdown-menu-item",
248
+ key: name,
249
+ value: name,
250
+ onMouseDown: function onMouseDown(e) {
251
+ return e.preventDefault();
252
+ },
253
+ onClick: function onClick() {
254
+ onPropsClick(v.props);
255
+ }
256
+ }, _react["default"].createElement("span", {
257
+ dangerouslySetInnerHTML: {
258
+ __html: (0, _utils.highlightSubstring)(_propsTitle, searchText)
259
+ }
260
+ }));
261
+ }
262
+ return null;
263
+ }
264
+ return _react["default"].createElement("li", {
265
+ className: "ant-select-dropdown-menu-item",
266
+ key: name,
267
+ value: name,
268
+ onMouseDown: function onMouseDown(e) {
269
+ return e.preventDefault();
270
+ },
271
+ onClick: function onClick() {
272
+ onPropsClick(v.props);
273
+ }
274
+ }, _propsTitle);
275
+ })), searchText && _react["default"].createElement("div", null, (searchTarget === null || searchTarget === void 0 ? void 0 : searchTarget.propsValue) && _react["default"].createElement("label", null, locale.propValue), _react["default"].createElement("ul", {
276
+ className: "ant-select-dropdown-menu"
277
+ }, fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.map(function (v) {
278
+ var _ref7 = v.props || {},
279
+ name = _ref7.name,
280
+ propsTitle = _ref7.propsTitle,
281
+ type = _ref7.type,
282
+ props = _ref7.props;
283
+ var target = value === null || value === void 0 ? void 0 : value.find(function (v) {
284
+ return v.key === name;
285
+ });
286
+ if (type === 'select' && props && props.options && props.options.length > 0) {
287
+ return _react["default"].createElement(_Select["default"], Object.assign({
288
+ key: name
289
+ }, props, {
290
+ searchText: searchText,
291
+ propItem: v.props,
292
+ onChange: onSelectChange,
293
+ value: target === null || target === void 0 ? void 0 : target.value
294
+ }));
295
+ }
296
+ return;
297
+ }))));
298
+ };
299
+ var renderSecondOptions = function renderSecondOptions() {
300
+ var _a;
301
+ var _ref8 = propItem || {},
302
+ name = _ref8.name,
303
+ propsTitle = _ref8.propsTitle,
304
+ title = _ref8.title,
305
+ type = _ref8.type,
306
+ className = _ref8.className,
307
+ component = _ref8.component,
308
+ fieldProps = _ref8.props;
309
+ var target = value === null || value === void 0 ? void 0 : value.find(function (v) {
310
+ return v.key === name;
311
+ });
312
+ var Field = component || _fieldsMap["default"][type];
313
+ return _react["default"].createElement("div", {
314
+ onClick: function onClick(e) {
315
+ return e.stopPropagation();
316
+ },
317
+ className: className
318
+ }, _react["default"].createElement("label", null, propsTitle || title || name), type === 'select' ? _react["default"].createElement(_Select["default"], Object.assign({}, fieldProps, {
319
+ propItem: propItem,
320
+ onChange: onSelectChange,
321
+ value: target === null || target === void 0 ? void 0 : target.value
322
+ })) : _react["default"].createElement("div", {
323
+ className: "".concat(clsPrefix, "-field-popover-content"),
324
+ onClick: function onClick(e) {
325
+ return e.stopPropagation();
326
+ }
327
+ }, _react["default"].createElement(Field, Object.assign({
328
+ form: form,
329
+ value: target === null || target === void 0 ? void 0 : target.value
330
+ }, fieldProps, {
331
+ style: Object.assign(Object.assign({}, fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style), {
332
+ width: ((_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style) === null || _a === void 0 ? void 0 : _a.width) || (0, _fieldsMap.getFieldWidth)(type)
333
+ }),
334
+ close: close,
335
+ onChange: onFieldChange
336
+ }))));
337
+ };
338
+ return _react["default"].createElement(_popover["default"], Object.assign({
339
+ trigger: "click",
340
+ visible: visible,
341
+ placement: "bottom",
342
+ overlayClassName: "".concat(clsPrefix, "-field-popover"),
343
+ content: !popoverContent ? renderFirstOptions() : renderSecondOptions(),
344
+ onVisibleChange: handleVisibleChange
345
+ }, props), children);
346
+ };
347
+ var _default = exports["default"] = (0, _react.forwardRef)(FieldPopover);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldPopover.js","sourceRoot":"","sources":["../../../../src/query-form2/Field/Composition/FieldPopover.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAmF;AACnF,mCAAkC;AAClC,+DAAsC;AACtC,sDAAgC;AAChC,mCAAiE;AACjE,mCAA4B;AAE5B,0DAAuD;AACvD,+BAA4B;AAC5B,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AAE/F,MAAM,YAAY,GAAG,CAAC,EAerB,EAAE,GAAG,EAAE,EAAE;QAfY,EACpB,OAAO,EACP,UAAU,EACV,UAAU,EACV,QAAQ,EACR,KAAK,EACL,KAAK,EACL,UAAU,EACV,QAAQ,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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,IAAA,yBAAa,EAAC,IAAI,CAAC,KAExD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,IACvB,CACE,CACP,CACG,CACP,CAAA;IACH,CAAC,CAAA;IAED,OAAO,CACL,8BAAC,iBAAO,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,kBAAe,IAAA,kBAAU,EAAC,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"]}
@@ -0,0 +1,35 @@
1
+ .tnt-queryform-field-popover {
2
+ min-width: 280px;
3
+ .ant-popover-inner-content {
4
+ padding: @padding-sm 0;
5
+ }
6
+ .ant-calendar-picker {
7
+ margin: @margin-xxs 0;
8
+ }
9
+ label {
10
+ color: tint(@text-color, 50%);
11
+ margin-bottom: @margin-xs;
12
+ display: block;
13
+ padding: 0 @padding-sm;
14
+ }
15
+ .ant-select-dropdown-menu {
16
+ &-item {
17
+ padding: @padding-xxs @padding-sm;
18
+ &:hover {
19
+ background-color: @bg-color-quaternary;
20
+ }
21
+ }
22
+ }
23
+ &-content {
24
+ padding: @padding-xxs @padding-sm;
25
+ }
26
+ .ant-select-selected-icon {
27
+ position: absolute;
28
+ right: @margin-base;
29
+ top: @margin-xs;
30
+ color: @blue-6;
31
+ }
32
+ .tnt-highlight {
33
+ color: @blue-6;
34
+ }
35
+ }
@@ -0,0 +1,4 @@
1
+ declare function _default(props: any): React.JSX.Element;
2
+ export default _default;
3
+ import React from "react";
4
+ //# sourceMappingURL=Select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/query-form2/Field/Composition/Select.js"],"names":[],"mappings":"AAMe,yDA+Fd"}