tntd 3.0.0-beta.19 → 3.0.0-beta.20

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 (157) hide show
  1. package/es/array-input/index.js +57 -42
  2. package/es/array-input/index.js.map +1 -1
  3. package/es/array-input/index.less +4 -1
  4. package/es/locale/en_US.js +3 -0
  5. package/es/locale/en_US.js.map +1 -1
  6. package/es/locale/zh_CN.js +3 -0
  7. package/es/locale/zh_CN.js.map +1 -1
  8. package/es/table/expand.less +12 -14
  9. package/es/table/hooks/use-expand-fixed.js +4 -2
  10. package/es/table/hooks/use-expand-fixed.js.map +1 -1
  11. package/es/table/table.js +15 -82
  12. package/es/table/table.js.map +1 -1
  13. package/es/tntd-action/Action.js +1 -1
  14. package/es/tntd-action/Action.js.map +1 -1
  15. package/lib/array-input/index.d.ts +1 -12
  16. package/lib/array-input/index.d.ts.map +1 -1
  17. package/lib/array-input/index.js +62 -55
  18. package/lib/array-input/index.js.map +1 -1
  19. package/lib/array-input/index.less +4 -1
  20. package/lib/locale/default.d.ts +3 -0
  21. package/lib/locale/default.d.ts.map +1 -1
  22. package/lib/locale/en_US.d.ts +3 -0
  23. package/lib/locale/en_US.d.ts.map +1 -1
  24. package/lib/locale/en_US.js +3 -0
  25. package/lib/locale/en_US.js.map +1 -1
  26. package/lib/locale/zh_CN.d.ts +3 -0
  27. package/lib/locale/zh_CN.d.ts.map +1 -1
  28. package/lib/locale/zh_CN.js +3 -0
  29. package/lib/locale/zh_CN.js.map +1 -1
  30. package/lib/table/expand.less +12 -14
  31. package/lib/table/hooks/use-expand-fixed.d.ts.map +1 -1
  32. package/lib/table/hooks/use-expand-fixed.js +6 -4
  33. package/lib/table/hooks/use-expand-fixed.js.map +1 -1
  34. package/lib/table/table.d.ts +1 -2
  35. package/lib/table/table.d.ts.map +1 -1
  36. package/lib/table/table.js +15 -78
  37. package/lib/table/table.js.map +1 -1
  38. package/lib/tntd-action/Action.d.ts +1 -1
  39. package/lib/tntd-action/Action.js +1 -1
  40. package/lib/tntd-action/Action.js.map +1 -1
  41. package/package.json +2 -2
  42. package/es/array-input/1.png +0 -1
  43. package/es/array-input/111.gif +0 -0
  44. package/es/array-input/icon.js +0 -25
  45. package/es/array-input/icon.js.map +0 -1
  46. package/es/query-form/Field/Composition/FieldPopover.js +0 -328
  47. package/es/query-form/Field/Composition/FieldPopover.js.map +0 -1
  48. package/es/query-form/Field/Composition/FieldPopover.less +0 -35
  49. package/es/query-form/Field/Composition/Select.js +0 -107
  50. package/es/query-form/Field/Composition/Select.js.map +0 -1
  51. package/es/query-form/Field/Composition/index.js +0 -210
  52. package/es/query-form/Field/Composition/index.js.map +0 -1
  53. package/es/query-form/Field/Composition/index.less +0 -114
  54. package/es/query-form/Field/Composition/utils.js +0 -132
  55. package/es/query-form/Field/Composition/utils.js.map +0 -1
  56. package/es/query-form2/Field/Checkbox.js +0 -23
  57. package/es/query-form2/Field/Checkbox.js.map +0 -1
  58. package/es/query-form2/Field/Composition/FieldPopover.js +0 -308
  59. package/es/query-form2/Field/Composition/FieldPopover.js.map +0 -1
  60. package/es/query-form2/Field/Composition/FieldPopover.less +0 -35
  61. package/es/query-form2/Field/Composition/Select.js +0 -104
  62. package/es/query-form2/Field/Composition/Select.js.map +0 -1
  63. package/es/query-form2/Field/Composition/index.js +0 -299
  64. package/es/query-form2/Field/Composition/index.js.map +0 -1
  65. package/es/query-form2/Field/Composition/index.less +0 -114
  66. package/es/query-form2/Field/Composition/utils.js +0 -19
  67. package/es/query-form2/Field/Composition/utils.js.map +0 -1
  68. package/es/query-form2/Field/Select.js +0 -59
  69. package/es/query-form2/Field/Select.js.map +0 -1
  70. package/es/query-form2/Field/SelectInput.js +0 -87
  71. package/es/query-form2/Field/SelectInput.js.map +0 -1
  72. package/es/query-form2/Field/fieldsMap.js +0 -28
  73. package/es/query-form2/Field/fieldsMap.js.map +0 -1
  74. package/es/query-form2/Field/index.js +0 -117
  75. package/es/query-form2/Field/index.js.map +0 -1
  76. package/es/query-form2/createActions.js +0 -47
  77. package/es/query-form2/createActions.js.map +0 -1
  78. package/es/query-form2/index.js +0 -345
  79. package/es/query-form2/index.js.map +0 -1
  80. package/es/query-form2/index.less +0 -136
  81. package/es/query-form2/useForm.js +0 -6
  82. package/es/query-form2/useForm.js.map +0 -1
  83. package/lib/array-input/1.png +0 -1
  84. package/lib/array-input/111.gif +0 -0
  85. package/lib/array-input/icon.d.ts +0 -4
  86. package/lib/array-input/icon.d.ts.map +0 -1
  87. package/lib/array-input/icon.js +0 -32
  88. package/lib/array-input/icon.js.map +0 -1
  89. package/lib/query-form/Field/Composition/FieldPopover.d.ts +0 -19
  90. package/lib/query-form/Field/Composition/FieldPopover.d.ts.map +0 -1
  91. package/lib/query-form/Field/Composition/FieldPopover.js +0 -368
  92. package/lib/query-form/Field/Composition/FieldPopover.js.map +0 -1
  93. package/lib/query-form/Field/Composition/FieldPopover.less +0 -35
  94. package/lib/query-form/Field/Composition/Select.d.ts +0 -4
  95. package/lib/query-form/Field/Composition/Select.d.ts.map +0 -1
  96. package/lib/query-form/Field/Composition/Select.js +0 -131
  97. package/lib/query-form/Field/Composition/Select.js.map +0 -1
  98. package/lib/query-form/Field/Composition/index.d.ts +0 -10
  99. package/lib/query-form/Field/Composition/index.d.ts.map +0 -1
  100. package/lib/query-form/Field/Composition/index.js +0 -257
  101. package/lib/query-form/Field/Composition/index.js.map +0 -1
  102. package/lib/query-form/Field/Composition/index.less +0 -114
  103. package/lib/query-form/Field/Composition/utils.d.ts +0 -22
  104. package/lib/query-form/Field/Composition/utils.d.ts.map +0 -1
  105. package/lib/query-form/Field/Composition/utils.js +0 -147
  106. package/lib/query-form/Field/Composition/utils.js.map +0 -1
  107. package/lib/query-form2/Field/Checkbox.d.ts +0 -8
  108. package/lib/query-form2/Field/Checkbox.d.ts.map +0 -1
  109. package/lib/query-form2/Field/Checkbox.js +0 -28
  110. package/lib/query-form2/Field/Checkbox.js.map +0 -1
  111. package/lib/query-form2/Field/Composition/FieldPopover.d.ts +0 -19
  112. package/lib/query-form2/Field/Composition/FieldPopover.d.ts.map +0 -1
  113. package/lib/query-form2/Field/Composition/FieldPopover.js +0 -347
  114. package/lib/query-form2/Field/Composition/FieldPopover.js.map +0 -1
  115. package/lib/query-form2/Field/Composition/FieldPopover.less +0 -35
  116. package/lib/query-form2/Field/Composition/Select.d.ts +0 -4
  117. package/lib/query-form2/Field/Composition/Select.d.ts.map +0 -1
  118. package/lib/query-form2/Field/Composition/Select.js +0 -128
  119. package/lib/query-form2/Field/Composition/Select.js.map +0 -1
  120. package/lib/query-form2/Field/Composition/index.d.ts +0 -14
  121. package/lib/query-form2/Field/Composition/index.d.ts.map +0 -1
  122. package/lib/query-form2/Field/Composition/index.js +0 -349
  123. package/lib/query-form2/Field/Composition/index.js.map +0 -1
  124. package/lib/query-form2/Field/Composition/index.less +0 -114
  125. package/lib/query-form2/Field/Composition/utils.d.ts +0 -6
  126. package/lib/query-form2/Field/Composition/utils.d.ts.map +0 -1
  127. package/lib/query-form2/Field/Composition/utils.js +0 -27
  128. package/lib/query-form2/Field/Composition/utils.js.map +0 -1
  129. package/lib/query-form2/Field/Select.d.ts +0 -4
  130. package/lib/query-form2/Field/Select.d.ts.map +0 -1
  131. package/lib/query-form2/Field/Select.js +0 -80
  132. package/lib/query-form2/Field/Select.js.map +0 -1
  133. package/lib/query-form2/Field/SelectInput.d.ts +0 -4
  134. package/lib/query-form2/Field/SelectInput.d.ts.map +0 -1
  135. package/lib/query-form2/Field/SelectInput.js +0 -100
  136. package/lib/query-form2/Field/SelectInput.js.map +0 -1
  137. package/lib/query-form2/Field/fieldsMap.d.ts +0 -27
  138. package/lib/query-form2/Field/fieldsMap.d.ts.map +0 -1
  139. package/lib/query-form2/Field/fieldsMap.js +0 -35
  140. package/lib/query-form2/Field/fieldsMap.js.map +0 -1
  141. package/lib/query-form2/Field/index.d.ts +0 -14
  142. package/lib/query-form2/Field/index.d.ts.map +0 -1
  143. package/lib/query-form2/Field/index.js +0 -147
  144. package/lib/query-form2/Field/index.js.map +0 -1
  145. package/lib/query-form2/createActions.d.ts +0 -14
  146. package/lib/query-form2/createActions.d.ts.map +0 -1
  147. package/lib/query-form2/createActions.js +0 -54
  148. package/lib/query-form2/createActions.js.map +0 -1
  149. package/lib/query-form2/index.d.ts +0 -36
  150. package/lib/query-form2/index.d.ts.map +0 -1
  151. package/lib/query-form2/index.js +0 -385
  152. package/lib/query-form2/index.js.map +0 -1
  153. package/lib/query-form2/index.less +0 -136
  154. package/lib/query-form2/useForm.d.ts +0 -13
  155. package/lib/query-form2/useForm.d.ts.map +0 -1
  156. package/lib/query-form2/useForm.js +0 -13
  157. package/lib/query-form2/useForm.js.map +0 -1
@@ -1,136 +0,0 @@
1
- .tnt-queryform {
2
- display: flex;
3
-
4
- &-extra {
5
- line-height: 32px;
6
- margin-left: @margin-sm;
7
- & > * {
8
- margin-left: @margin-xs;
9
- }
10
- }
11
-
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
- .ant-form {
35
- display: inline-block;
36
- margin-bottom: @margin-sm;
37
- display: flex;
38
- flex: 1;
39
- &.ant-form-inline {
40
- flex-wrap: unset;
41
- position: relative;
42
- }
43
-
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
- &.ant-form-inline .ant-form-item {
73
- margin-right: 10px;
74
- display: inline-block;
75
- }
76
-
77
- .ant-form-item-control {
78
- // min-width: 160px;
79
- line-height: unset;
80
- .ant-calendar-picker-input {
81
- padding: 0 @padding-sm;
82
- }
83
- .ant-form-item-children {
84
- & > .ant-input,
85
- & > .ant-input-affix-wrapper {
86
- width: 160px;
87
- // width: 200px;
88
- }
89
- }
90
- }
91
- }
92
-
93
- &-drawer {
94
- margin-top: @margin-xxl;
95
- &.large-size {
96
- margin-top: 60px;
97
- }
98
-
99
- &.ant-drawer.ant-drawer-open {
100
- .ant-drawer-mask {
101
- opacity: 0;
102
- background: unset;
103
- }
104
- }
105
- .ant-drawer-body {
106
- .ant-form-item {
107
- display: block;
108
- margin-right: 0;
109
- margin-bottom: @margin-md;
110
- width: 100%;
111
- }
112
- .ant-form-item-label {
113
- display: block;
114
- text-align: left;
115
- line-height: 22px;
116
- margin-bottom: 10px;
117
- }
118
- .ant-form-item-control-wrapper,
119
- .ant-form-item-control,
120
- .ant-calendar-picker,
121
- .ant-input {
122
- min-width: 100%;
123
- width: 100%;
124
- }
125
-
126
- & > .ant-btn {
127
- display: block;
128
- width: 100%;
129
- margin-bottom: 10px;
130
- &.ant-btn-primary {
131
- margin-top: @margin-md;
132
- }
133
- }
134
- }
135
- }
136
- }
@@ -1,6 +0,0 @@
1
- import { useRef } from 'react';
2
- import createActions from './createActions';
3
- export default function useForm() {
4
- const form = useRef(createActions());
5
- return [form.current];
6
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"useForm.js","sourceRoot":"","sources":["../../src/query-form2/useForm.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC9B,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAE3C,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC,CAAA;IAEpC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACvB,CAAC","sourcesContent":["import { useRef } from 'react'\nimport createActions from './createActions'\n\nexport default function useForm() {\n const form = useRef(createActions())\n\n return [form.current]\n}\n"]}
@@ -1 +0,0 @@
1
- <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1715845363423" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="19285" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M421.472 96c-95.904 0-172.8 78.88-172.8 175.104 0 96.224 76.896 175.104 172.8 175.104 95.936 0 172.8-78.88 172.8-175.104 0-96.224-76.864-175.104-172.8-175.104z m-108.8 175.104C312.672 209.28 361.92 160 421.472 160c59.616 0 108.8 49.28 108.8 111.104 0 61.856-49.184 111.104-108.8 111.104-59.584 0-108.8-49.248-108.8-111.104z" p-id="19286"></path><path d="M320 544a192 192 0 0 0-192 192v96a64 64 0 0 0 64 64h384a32 32 0 1 0 0-64H192v-96a128 128 0 0 1 128-128h256a32 32 0 1 0 0-64h-256zM672 672a32 32 0 1 0 0 64h192a32 32 0 1 0 0-64h-192z" p-id="19287"></path></svg>
Binary file
@@ -1,4 +0,0 @@
1
- export const plusIcon: React.JSX.Element;
2
- export const deleteIcon: React.JSX.Element;
3
- import React from "react";
4
- //# sourceMappingURL=icon.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/array-input/icon.js"],"names":[],"mappings":"AAEA,yCAaC;AAED,2CAYC"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.plusIcon = exports.deleteIcon = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
- var plusIcon = exports.plusIcon = _react["default"].createElement("svg", {
10
- viewBox: "64 64 896 896",
11
- focusable: "false",
12
- "data-icon": "plus-circle",
13
- width: "1em",
14
- height: "1em",
15
- fill: "currentColor",
16
- "aria-hidden": "true"
17
- }, _react["default"].createElement("path", {
18
- d: "M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"
19
- }), _react["default"].createElement("path", {
20
- d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"
21
- }));
22
- var deleteIcon = exports.deleteIcon = _react["default"].createElement("svg", {
23
- viewBox: "64 64 896 896",
24
- focusable: "false",
25
- "data-icon": "delete",
26
- width: "1em",
27
- height: "1em",
28
- fill: "currentColor",
29
- "aria-hidden": "true"
30
- }, _react["default"].createElement("path", {
31
- d: "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"
32
- }));
@@ -1 +0,0 @@
1
- {"version":3,"file":"icon.js","sourceRoot":"","sources":["../../src/array-input/icon.js"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAEZ,QAAA,QAAQ,GAAG,CACtB,uCACE,OAAO,EAAC,eAAe,EACvB,SAAS,EAAC,OAAO,eACP,aAAa,EACvB,KAAK,EAAC,KAAK,EACX,MAAM,EAAC,KAAK,EACZ,IAAI,EAAC,cAAc,iBACP,MAAM;IAElB,wCAAM,CAAC,EAAC,2LAA2L,GAAQ;IAC3M,wCAAM,CAAC,EAAC,+KAA+K,GAAQ,CAC3L,CACP,CAAA;AAEY,QAAA,UAAU,GAAG,CACxB,uCACE,OAAO,EAAC,eAAe,EACvB,SAAS,EAAC,OAAO,eACP,QAAQ,EAClB,KAAK,EAAC,KAAK,EACX,MAAM,EAAC,KAAK,EACZ,IAAI,EAAC,cAAc,iBACP,MAAM;IAElB,wCAAM,CAAC,EAAC,qVAAqV,GAAQ,CACjW,CACP,CAAA","sourcesContent":["import React from 'react'\n\nexport const plusIcon = (\n <svg\n viewBox=\"64 64 896 896\"\n focusable=\"false\"\n data-icon=\"plus-circle\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path d=\"M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z\"></path>\n <path d=\"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z\"></path>\n </svg>\n)\n\nexport const deleteIcon = (\n <svg\n viewBox=\"64 64 896 896\"\n focusable=\"false\"\n data-icon=\"delete\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path d=\"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z\"></path>\n </svg>\n)\n"]}
@@ -1,19 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"FieldPopover.d.ts","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/FieldPopover.js"],"names":[],"mappings":""}
@@ -1,368 +0,0 @@
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 = _interopRequireDefault(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
- component = _ref.component;
64
- var copyValue = (0, _cloneDeep2["default"])(value);
65
- if (!(copyValue === null || copyValue === void 0 ? void 0 : copyValue.find(function (v) {
66
- return v.key === props.name;
67
- }))) {
68
- copyValue.push({
69
- key: props.name,
70
- value: type === 'array' ? [] : undefined,
71
- closable: true,
72
- label: (props.propsTitle || props.title || props.name) + ':'
73
- });
74
- }
75
- setFieldItem(props);
76
- if (isInput(type) && !component) {
77
- var target = copyValue.find(function (v) {
78
- return v.key === props.name;
79
- });
80
- onChange(target, true);
81
- close();
82
- return;
83
- }
84
- setVisible(true);
85
- setPopoverContent(true);
86
- onChange(copyValue);
87
- };
88
- (0, _react.useImperativeHandle)(ref, function () {
89
- return {
90
- onPropsClick: onPropsClick
91
- };
92
- });
93
- var onSelectChange = function onSelectChange(v, isMultiple) {
94
- var _a, _b, _c, _d, _e, _f;
95
- var propObj = (v === null || v === void 0 ? void 0 : v.propItem) || propItem || {};
96
- var fieldProps = propObj.props; // 直接搜索拿v.xx的值
97
- var copyValue = (0, _cloneDeep2["default"])(value || []);
98
- var index;
99
- if (v === null || v === void 0 ? void 0 : v.propItem) {
100
- // 模糊搜索
101
- var _index = copyValue.findIndex(function (vv) {
102
- var _a;
103
- return vv.key === ((_a = v.propItem) === null || _a === void 0 ? void 0 : _a.name);
104
- });
105
- if (_index > -1) {
106
- index = _index;
107
- } else {
108
- copyValue.push({
109
- key: (_a = v.propItem) === null || _a === void 0 ? void 0 : _a.name,
110
- value: isMultiple ? [] : ''
111
- });
112
- index = copyValue.length - 1;
113
- }
114
- setFieldItem(v.propItem);
115
- } else {
116
- // 选择值
117
- index = copyValue.findIndex(function (v) {
118
- return v.key === (propItem === null || propItem === void 0 ? void 0 : propItem.name);
119
- });
120
- }
121
- if (isMultiple) {
122
- if (!((_c = (_b = copyValue[index]) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.length)) {
123
- copyValue[index].value = [v === null || v === void 0 ? void 0 : v.value];
124
- } else {
125
- if (((_d = copyValue[index].value) === null || _d === void 0 ? void 0 : _d.indexOf(v.value)) > -1) {
126
- copyValue[index].value = copyValue[index].value.filter(function (val) {
127
- return val !== v.value;
128
- });
129
- } else {
130
- copyValue[index].value.push(v.value);
131
- }
132
- }
133
- // 如果是模糊搜索-展开多选项
134
- if (v === null || v === void 0 ? void 0 : v.propItem) {
135
- setFieldItem(v === null || v === void 0 ? void 0 : v.propItem);
136
- setVisible(true);
137
- setPopoverContent(true);
138
- }
139
- } else {
140
- copyValue[index].value = v === null || v === void 0 ? void 0 : v.value;
141
- close();
142
- }
143
- var labelPrefix = "".concat(propObj.propsTitle || propObj.title || propObj.name, ": ");
144
- if (propObj.setLabel) {
145
- copyValue[index].label = labelPrefix + propObj.setLabel(copyValue[index].value);
146
- } else {
147
- copyValue[index].label = labelPrefix + (0, _utils.getLabelByValue)({
148
- value: copyValue[index].value,
149
- options: ((_e = propObj.props) === null || _e === void 0 ? void 0 : _e.options) || v.options,
150
- fieldNames: ((_f = propObj.props) === null || _f === void 0 ? void 0 : _f.fieldNames) || {
151
- label: 'label',
152
- value: 'value'
153
- }
154
- });
155
- }
156
- copyValue[index].closable = true;
157
- onChange(copyValue, false, true);
158
- (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
159
- };
160
- var onFieldChange = function onFieldChange() {
161
- var _a, _b;
162
- var _ref2 = propItem || {},
163
- type = _ref2.type,
164
- component = _ref2.component,
165
- fieldProps = _ref2.props,
166
- setLabel = _ref2.setLabel,
167
- propsTitle = _ref2.propsTitle,
168
- title = _ref2.title,
169
- name = _ref2.name;
170
- var _ref3 = fieldProps || {},
171
- options = _ref3.options;
172
- var copyValue = (0, _cloneDeep2["default"])(value);
173
- var index = copyValue.findIndex(function (v) {
174
- return v.key === (propItem === null || propItem === void 0 ? void 0 : propItem.name);
175
- });
176
- copyValue[index].value = arguments.length <= 0 ? undefined : arguments[0];
177
- var labelPrefix = "".concat(propsTitle || title || name, ": ");
178
- if (setLabel) {
179
- // setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制
180
- copyValue[index].label = labelPrefix + setLabel(arguments.length <= 0 ? undefined : arguments[0]);
181
- } else if (type === 'date') {
182
- copyValue[index].label = labelPrefix + (arguments.length <= 1 ? undefined : arguments[1]);
183
- close();
184
- } else if (type === 'dateRange') {
185
- copyValue[index].label = labelPrefix + ((_a = arguments.length <= 1 ? undefined : arguments[1]) === null || _a === void 0 ? void 0 : _a.join('~'));
186
- if ((_b = arguments.length <= 1 ? undefined : arguments[1]) === null || _b === void 0 ? void 0 : _b[1]) {
187
- close();
188
- }
189
- } else if (type === 'selectInput') {
190
- var key = (0, _get2["default"])(Object.keys(arguments.length <= 0 ? undefined : arguments[0]), '0');
191
- var val = (0, _get2["default"])(arguments.length <= 0 ? undefined : arguments[0], key);
192
- var label = (0, _utils.getLabelFromOptions)(key, options);
193
- copyValue[index].label = "".concat(label, ": ").concat(val);
194
- } else if (type === 'checkbox') {
195
- copyValue[index].label = labelPrefix + ((arguments.length <= 0 ? undefined : arguments[0]) ? locale.yes : locale.no);
196
- close();
197
- } else if (!type && component) {
198
- copyValue[index].label = labelPrefix + ((arguments.length <= 1 ? undefined : arguments[1]) || (arguments.length <= 0 ? undefined : arguments[0]));
199
- close();
200
- }
201
- copyValue[index].closable = true;
202
- onChange(copyValue, false, true);
203
- (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
204
- };
205
- var close = function close() {
206
- setVisible(false);
207
- setTimeout(function () {
208
- setFieldItem();
209
- setPopoverContent(false);
210
- }, 1);
211
- };
212
- var handleVisibleChange = function handleVisibleChange() {
213
- if (!visible && !regex.test(searchText)) {
214
- setVisible(true);
215
- } else {
216
- close();
217
- }
218
- };
219
- (0, _react.useEffect)(function () {
220
- var bool1 = false,
221
- bool2 = false;
222
- if (searchText && !propItem) {
223
- fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.forEach(function (v) {
224
- var _ref4 = v.props || {},
225
- name = _ref4.name,
226
- propsTitle = _ref4.propsTitle,
227
- title = _ref4.title,
228
- type = _ref4.type,
229
- props = _ref4.props;
230
- var _propsTitle = propsTitle || title || name;
231
- if ((_propsTitle === null || _propsTitle === void 0 ? void 0 : _propsTitle.indexOf(searchText)) > -1) {
232
- bool1 = true;
233
- }
234
- var sOptions = type !== 'select' ? [] : (props === null || props === void 0 ? void 0 : props.options) || [];
235
- var fieldNames = props === null || props === void 0 ? void 0 : props.fieldNames;
236
- var target = sOptions === null || sOptions === void 0 ? void 0 : sOptions.find(function (item) {
237
- var labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
238
- var label = item instanceof Object ? item[labelKey] : item + '';
239
- return (_react["default"].isValidElement(label) ? (0, _utils.formatLabel)(label) : label).indexOf(searchText) > -1;
240
- });
241
- if (target) {
242
- bool2 = true;
243
- }
244
- });
245
- setSearchTarget(!bool2 && !bool1 ? null : {
246
- propsTitle: bool1,
247
- propsValue: bool2
248
- });
249
- } else {
250
- setSearchTarget(undefined);
251
- }
252
- }, [fieldItems, searchText, propItem]);
253
- var renderFirstOptions = function renderFirstOptions() {
254
- 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", {
255
- className: "ant-select-dropdown-menu"
256
- }, fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.map(function (v) {
257
- var _ref5 = v.props || {},
258
- name = _ref5.name,
259
- propsTitle = _ref5.propsTitle,
260
- title = _ref5.title,
261
- type = _ref5.type,
262
- props = _ref5.props;
263
- var _propsTitle = propsTitle || title || name;
264
- if (searchText) {
265
- if ((_propsTitle === null || _propsTitle === void 0 ? void 0 : _propsTitle.indexOf(searchText)) > -1) {
266
- return _react["default"].createElement("li", {
267
- className: "ant-select-dropdown-menu-item",
268
- key: name,
269
- value: name,
270
- onMouseDown: function onMouseDown(e) {
271
- return e.preventDefault();
272
- },
273
- onClick: function onClick() {
274
- onPropsClick(v.props);
275
- }
276
- }, _react["default"].createElement("span", {
277
- dangerouslySetInnerHTML: {
278
- __html: (0, _utils.highlightSubstring)(_propsTitle, searchText)
279
- }
280
- }));
281
- }
282
- return null;
283
- }
284
- return _react["default"].createElement("li", {
285
- className: "ant-select-dropdown-menu-item",
286
- key: name,
287
- value: name,
288
- onMouseDown: function onMouseDown(e) {
289
- return e.preventDefault();
290
- },
291
- onClick: function onClick() {
292
- onPropsClick(v.props);
293
- }
294
- }, _propsTitle);
295
- })), searchText && _react["default"].createElement("div", null, (searchTarget === null || searchTarget === void 0 ? void 0 : searchTarget.propsValue) && _react["default"].createElement("label", null, locale.propValue), fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.map(function (v) {
296
- var _ref6 = v.props || {},
297
- name = _ref6.name,
298
- propsTitle = _ref6.propsTitle,
299
- type = _ref6.type,
300
- props = _ref6.props;
301
- var target = value === null || value === void 0 ? void 0 : value.find(function (v) {
302
- return v.key === name;
303
- });
304
- if (type === 'select') {
305
- // && props?.options?.length > 0
306
- return _react["default"].createElement(_Select["default"], Object.assign({
307
- key: name
308
- }, props, {
309
- searchText: searchText,
310
- propItem: v.props,
311
- onChange: onSelectChange,
312
- value: target === null || target === void 0 ? void 0 : target.value
313
- }));
314
- }
315
- return;
316
- })));
317
- };
318
- var renderSecondOptions = function renderSecondOptions() {
319
- var _a;
320
- var _ref7 = propItem || {},
321
- name = _ref7.name,
322
- propsTitle = _ref7.propsTitle,
323
- title = _ref7.title,
324
- type = _ref7.type,
325
- className = _ref7.className,
326
- component = _ref7.component,
327
- fieldProps = _ref7.props;
328
- var target = value === null || value === void 0 ? void 0 : value.find(function (v) {
329
- return v.key === name;
330
- });
331
- var Field = component || _fieldsMap["default"][type] || function () {
332
- return null;
333
- };
334
- return _react["default"].createElement("div", {
335
- onClick: function onClick(e) {
336
- return e.stopPropagation();
337
- },
338
- className: className
339
- }, _react["default"].createElement("label", null, propsTitle || title || name), type === 'select' ? _react["default"].createElement(_Select["default"], Object.assign({}, fieldProps, {
340
- propItem: propItem,
341
- onChange: onSelectChange,
342
- value: target === null || target === void 0 ? void 0 : target.value
343
- })) : _react["default"].createElement("div", {
344
- className: "".concat(clsPrefix, "-field-popover-content"),
345
- onClick: function onClick(e) {
346
- return e.stopPropagation();
347
- }
348
- }, _react["default"].createElement(Field, Object.assign({
349
- form: form,
350
- value: target === null || target === void 0 ? void 0 : target.value
351
- }, fieldProps, {
352
- style: Object.assign(Object.assign({}, fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style), {
353
- width: ((_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style) === null || _a === void 0 ? void 0 : _a.width) || '250px'
354
- }),
355
- close: close,
356
- onChange: onFieldChange
357
- }))));
358
- };
359
- return _react["default"].createElement(_popover["default"], Object.assign({
360
- trigger: "click",
361
- visible: visible,
362
- placement: "bottom",
363
- overlayClassName: "".concat(clsPrefix, "-field-popover"),
364
- content: !popoverContent ? renderFirstOptions() : renderSecondOptions(),
365
- onVisibleChange: handleVisibleChange
366
- }, props), children);
367
- };
368
- var _default = exports["default"] = (0, _react.forwardRef)(FieldPopover);
@@ -1 +0,0 @@
1
- {"version":3,"file":"FieldPopover.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/FieldPopover.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAmF;AACnF,mCAAkC;AAClC,+DAAsC;AACtC,sDAAgC;AAChC,mCAA+F;AAC/F,mCAA4B;AAE5B,6DAAuD;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,CACnB,EAeC,EACD,GAAG,EACH,EAAE;QAjBF,EACE,OAAO,EACP,UAAU,EACV,UAAU,EACV,QAAQ,EACR,KAAK,EACL,KAAK,EACL,UAAU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AU,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,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, getLabelByValue, formatLabel } from './utils'\nimport { get } from 'lodash'\n\nimport fieldsMap, { getFieldWidth } from '../fieldsMap'\nimport './FieldPopover.less'\nconst isInput = (type) => ['input', 'string', 'search', 'number', 'inputNumber'].includes(type)\n\nconst FieldPopover = (\n {\n visible,\n setVisible,\n searchText,\n children,\n value,\n regex,\n fieldItems,\n propItem,\n setFieldItem,\n onChange,\n form,\n locale,\n clsPrefix,\n ...props\n },\n ref\n) => {\n const [searchTarget, setSearchTarget] = useState(undefined)\n const [popoverContent, setPopoverContent] = useState(false)\n\n const onPropsClick = (props) => {\n const { type = 'input', 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 closable: true,\n label: (props.propsTitle || props.title || props.name) + ':',\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\n const labelPrefix = `${propObj.propsTitle || propObj.title || propObj.name}: `\n if (propObj.setLabel) {\n copyValue[index].label = labelPrefix + propObj.setLabel(copyValue[index].value)\n } else {\n copyValue[index].label =\n labelPrefix +\n getLabelByValue({\n value: copyValue[index].value,\n options: propObj.props?.options || v.options,\n fieldNames: propObj.props?.fieldNames || {\n label: 'label',\n value: 'value',\n },\n })\n }\n copyValue[index].closable = true\n onChange(copyValue, false, true)\n fieldProps?.onChange && fieldProps.onChange(copyValue[index].value)\n }\n\n const onFieldChange = (...args) => {\n const { type, component, props: fieldProps, setLabel, propsTitle, title, name } = propItem || {}\n const { options } = fieldProps || {}\n const copyValue = cloneDeep(value)\n const index = copyValue.findIndex((v) => v.key === propItem?.name)\n copyValue[index].value = args[0]\n const labelPrefix = `${propsTitle || title || name}: `\n if (setLabel) {\n // setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制\n copyValue[index].label = labelPrefix + setLabel(args[0])\n } else if (type === 'date') {\n copyValue[index].label = labelPrefix + args[1]\n close()\n } else if (type === 'dateRange') {\n copyValue[index].label = labelPrefix + args[1]?.join('~')\n if (args[1]?.[1]) {\n close()\n }\n } else if (type === 'selectInput') {\n const key = get(Object.keys(args[0]), '0')\n const val = get(args[0], key)\n const label = getLabelFromOptions(key, options)\n copyValue[index].label = `${label}: ${val}`\n } else if (type === 'checkbox') {\n copyValue[index].label = labelPrefix + (args[0] ? locale.yes : locale.no)\n close()\n } else if (!type && component) {\n copyValue[index].label = labelPrefix + (args[1] || args[0])\n close()\n }\n copyValue[index].closable = true\n onChange(copyValue, false, true)\n fieldProps?.onChange && fieldProps.onChange(copyValue[index].value)\n }\n\n const close = () => {\n setVisible(false)\n setTimeout(() => {\n setFieldItem()\n setPopoverContent(false)\n }, 1)\n }\n const handleVisibleChange = () => {\n if (!visible && !regex.test(searchText)) {\n setVisible(true)\n } else {\n close()\n }\n }\n\n useEffect(() => {\n let bool1 = false,\n bool2 = false\n\n if (searchText && !propItem) {\n fieldItems?.forEach((v) => {\n const { name, propsTitle, title, type, props } = v.props || {}\n const _propsTitle = propsTitle || title || name\n if (_propsTitle?.indexOf(searchText) > -1) {\n bool1 = true\n }\n const sOptions = type !== 'select' ? [] : props?.options || []\n const fieldNames = props?.fieldNames\n const target = sOptions?.find((item) => {\n const labelKey = fieldNames?.label || 'label'\n const label = item instanceof Object ? item[labelKey] : item + ''\n return (React.isValidElement(label) ? formatLabel(label) : label).indexOf(searchText) > -1\n })\n if (target) {\n bool2 = true\n }\n })\n setSearchTarget(!bool2 && !bool1 ? null : { propsTitle: bool1, propsValue: bool2 })\n } else {\n setSearchTarget(undefined)\n }\n }, [fieldItems, searchText, propItem])\n\n const renderFirstOptions = () => {\n return (\n <div>\n {(!searchText || searchTarget?.propsTitle) && <label>{locale.propTitle}</label>}\n <ul className=\"ant-select-dropdown-menu\">\n {fieldItems?.map((v) => {\n const { name, propsTitle, title, type, props } = v.props || {}\n const _propsTitle = propsTitle || title || name\n if (searchText) {\n if (_propsTitle?.indexOf(searchText) > -1) {\n return (\n <li\n className=\"ant-select-dropdown-menu-item\"\n key={name}\n value={name}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n onPropsClick(v.props)\n }}\n >\n <span\n dangerouslySetInnerHTML={{\n __html: highlightSubstring(_propsTitle, searchText),\n }}\n ></span>\n </li>\n )\n }\n return null\n }\n return (\n <li\n className=\"ant-select-dropdown-menu-item\"\n key={name}\n value={name}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n onPropsClick(v.props)\n }}\n >\n {_propsTitle}\n </li>\n )\n })}\n </ul>\n {/* 可以对下拉框值筛选 */}\n {searchText && (\n <div>\n {searchTarget?.propsValue && <label>{locale.propValue}</label>}\n {fieldItems?.map((v) => {\n const { name, propsTitle, type, props } = v.props || {}\n const target = value?.find((v) => v.key === name)\n if (type === 'select') {\n // && props?.options?.length > 0\n return (\n <SelectOpt\n key={name}\n {...props}\n searchText={searchText}\n propItem={v.props}\n onChange={onSelectChange}\n value={target?.value}\n />\n )\n }\n return\n })}\n </div>\n )}\n </div>\n )\n }\n\n const renderSecondOptions = () => {\n const {\n name,\n propsTitle,\n title,\n type,\n className,\n component,\n props: fieldProps,\n } = propItem || {}\n const target = value?.find((v) => v.key === name)\n const Field = component || fieldsMap[type] || (() => 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={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 />\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"]}