@lingxiteam/ebe-utils 0.2.22 → 0.2.23

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 (144) hide show
  1. package/lib/h5public/yarn.lock +7 -8
  2. package/lib/pcpublic/src/components/pcfactory/src/Button/index.tsx +11 -10
  3. package/lib/pcpublic/src/components/pcfactory/src/Card/CardTitle/index.tsx +31 -24
  4. package/lib/pcpublic/src/components/pcfactory/src/Card/index.tsx +32 -14
  5. package/lib/pcpublic/src/components/pcfactory/src/Card/useExtendBtn.tsx +85 -48
  6. package/lib/pcpublic/src/components/pcfactory/src/ChartLine/ChartLine.tsx +24 -6
  7. package/lib/pcpublic/src/components/pcfactory/src/ChartLine/PropsType.ts +31 -5
  8. package/lib/pcpublic/src/components/pcfactory/src/ChartLine/index.tsx +3 -2
  9. package/lib/pcpublic/src/components/pcfactory/src/ChartLine/loader.tsx +1 -1
  10. package/lib/pcpublic/src/components/pcfactory/src/Form/Form.tsx +153 -129
  11. package/lib/pcpublic/src/components/pcfactory/src/Form/index.tsx +2 -5
  12. package/lib/pcpublic/src/components/pcfactory/src/Form/useFormStatus.ts +8 -4
  13. package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/LXPieChart.tsx +15 -3
  14. package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/PropsType.ts +4 -3
  15. package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/index.tsx +1 -1
  16. package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/loader.tsx +1 -1
  17. package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/LXRadarChat.tsx +18 -4
  18. package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/PropsType.ts +2 -1
  19. package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/index.tsx +1 -1
  20. package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/loader.tsx +1 -1
  21. package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +7 -2
  22. package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/index.tsx +60 -26
  23. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +62 -55
  24. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditor.tsx +2 -6
  25. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditorMain.tsx +5 -5
  26. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/index.tsx +9 -2
  27. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/loader.ts +1 -1
  28. package/lib/pcpublic/src/components/pcfactory/src/Select/index.tsx +145 -66
  29. package/lib/pcpublic/src/components/pcfactory/src/Select/selectUtils.ts +13 -9
  30. package/lib/pcpublic/src/components/pcfactory/src/Table/BodyCell/index.tsx +36 -26
  31. package/lib/pcpublic/src/components/pcfactory/src/Table/EditComponent/index.tsx +69 -94
  32. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/GhostTag/index.tsx +12 -5
  33. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Hyperlink/index.tsx +9 -5
  34. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PointTag/index.tsx +11 -5
  35. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureColourFill/index.tsx +11 -5
  36. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureFadeColourTag/index.tsx +14 -7
  37. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Thumbnail/index.tsx +30 -31
  38. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +89 -41
  39. package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/HeaderCellTitle/index.tsx +25 -12
  40. package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/index.tsx +12 -5
  41. package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/PopoverWrapper.tsx +220 -0
  42. package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/SingleBtn.tsx +39 -32
  43. package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/index.tsx +178 -148
  44. package/lib/pcpublic/src/components/pcfactory/src/Table/Table.tsx +439 -0
  45. package/lib/pcpublic/src/components/pcfactory/src/Table/TableHead/index.tsx +159 -72
  46. package/lib/pcpublic/src/components/pcfactory/src/Table/TableSummaryRow/index.tsx +12 -20
  47. package/lib/pcpublic/src/components/pcfactory/src/Table/constant.ts +3 -0
  48. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/index.ts +4 -4
  49. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +32 -28
  50. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCheckStrict.ts +44 -57
  51. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +306 -276
  52. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCommon.ts +9 -6
  53. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +30 -21
  54. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +33 -27
  55. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFilter.tsx +84 -77
  56. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFormatCell.tsx +33 -16
  57. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/usePagination.ts +15 -5
  58. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +33 -33
  59. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +13 -5
  60. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useScroll.ts +94 -28
  61. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSelection.ts +108 -99
  62. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSort.ts +8 -5
  63. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +27 -43
  64. package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +73 -394
  65. package/lib/pcpublic/src/components/pcfactory/src/Table/loader.tsx +15 -0
  66. package/lib/pcpublic/src/components/pcfactory/src/Table/types/OperationCell.d.ts +2 -2
  67. package/lib/pcpublic/src/components/pcfactory/src/Table/types/event.d.ts +12 -8
  68. package/lib/pcpublic/src/components/pcfactory/src/Table/types/headerCell.d.ts +2 -1
  69. package/lib/pcpublic/src/components/pcfactory/src/Table/types/prop.d.ts +24 -11
  70. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/SequenceId.ts +2 -1
  71. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/index.ts +90 -82
  72. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/indexedDBHelper.ts +9 -22
  73. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/translate.ts +59 -0
  74. package/lib/pcpublic/src/components/pcfactory/src/Transfer/Transfer.tsx +644 -0
  75. package/lib/pcpublic/src/components/pcfactory/src/Transfer/index.tsx +49 -637
  76. package/lib/pcpublic/src/components/pcfactory/src/Transfer/loader.tsx +11 -0
  77. package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeEllipsisIcon.tsx +38 -0
  78. package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeNodeMenu/index.tsx +34 -35
  79. package/lib/pcpublic/src/components/pcfactory/src/Tree/index.tsx +213 -149
  80. package/lib/pcpublic/src/components/pcfactory/src/TreeSelect/index.tsx +47 -43
  81. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/TreeTable.tsx +264 -0
  82. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/index.ts +4 -1
  83. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useCMDAction.ts +9 -3
  84. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useExpandable.tsx +9 -3
  85. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/index.tsx +52 -191
  86. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/loader.tsx +16 -0
  87. package/lib/pcpublic/src/components/pcfactory/src/assets/index.tsx +34 -0
  88. package/lib/pcpublic/src/components/pcfactory/src/assets/svg/quadrate.tsx +20 -0
  89. package/lib/pcpublic/src/components/pcfactory/src/assets/svg/roundness.tsx +14 -0
  90. package/lib/pcpublic/src/components/pcfactory/src/assets/svg/semicircle.tsx +15 -0
  91. package/lib/pcpublic/src/components/pcfactory/src/assets/svg/verticalLine.tsx +12 -0
  92. package/lib/pcpublic/src/components/pcfactory/src/styles/common.less +17 -0
  93. package/lib/pcpublic/src/components/pcfactory/src/styles/components/Card.less +57 -11
  94. package/lib/pcpublic/src/components/pcfactory/src/styles/components/Form.less +101 -12
  95. package/lib/pcpublic/src/components/pcfactory/src/styles/components/ModalSelect.less +6 -0
  96. package/lib/pcpublic/src/components/pcfactory/src/styles/components/Select.less +70 -6
  97. package/lib/pcpublic/src/components/pcfactory/src/utils/ChannelContainer.tsx +20 -14
  98. package/lib/pcpublic/src/components/pcfactory/src/utils/ChildRender.ts +6 -8
  99. package/lib/pcpublic/src/components/pcfactory/src/utils/CustomModule.tsx +4 -6
  100. package/lib/pcpublic/src/components/pcfactory/src/utils/DummyFormContext.ts +9 -13
  101. package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/empty.tsx +5 -17
  102. package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/index.tsx +3 -3
  103. package/lib/pcpublic/src/components/pcfactory/src/utils/Holidays.ts +11 -39
  104. package/lib/pcpublic/src/components/pcfactory/src/utils/HolidaysFormat.ts +83 -0
  105. package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/index.tsx +47 -0
  106. package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/scheduler.ts +74 -0
  107. package/lib/pcpublic/src/components/pcfactory/src/utils/LoaderHelper.tsx +4 -1
  108. package/lib/pcpublic/src/components/pcfactory/src/utils/Spin/index.tsx +8 -7
  109. package/lib/pcpublic/src/components/pcfactory/src/utils/WithSyncValue.ts +25 -23
  110. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/index.ts +10 -7
  111. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMap.ts +9 -6
  112. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMemoizedFn.ts +4 -1
  113. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/usePersistFn.ts +17 -0
  114. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSafeState.ts +2 -2
  115. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSetState.ts +7 -5
  116. package/lib/pcpublic/src/components/pcfactory/src/utils/common.ts +23 -50
  117. package/lib/pcpublic/src/components/pcfactory/src/utils/constant.ts +53 -57
  118. package/lib/pcpublic/src/components/pcfactory/src/utils/dynamicUtils/DynamicContext.tsx +12 -17
  119. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormContext.tsx +22 -12
  120. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormFields.tsx +50 -19
  121. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/WrapperContainer.tsx +58 -37
  122. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/cmdHelper.ts +33 -30
  123. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/common.ts +2 -0
  124. package/lib/pcpublic/src/components/pcfactory/src/utils/generatorDisabledCallback.ts +121 -113
  125. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCommonImperativeHandle.ts +16 -14
  126. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCompState.tsx +1 -1
  127. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDataMask.ts +7 -2
  128. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDoubleClick.ts +3 -1
  129. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useFuncExpExecute.ts +16 -14
  130. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useGetStaticAttrData.ts +9 -3
  131. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useHiddenStyle.ts +4 -5
  132. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInit.ts +11 -0
  133. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInitReactQuill.ts +3 -1
  134. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useListenState.ts +1 -0
  135. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useLocale.ts +5 -3
  136. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/usePrintMode.tsx +2 -2
  137. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useRules.ts +1 -1
  138. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useTestHelper.ts +2 -0
  139. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useToggleBoolean.ts +8 -4
  140. package/lib/pcpublic/src/components/pcfactory/src/utils/index.ts +10 -10
  141. package/lib/pcpublic/src/components/pcfactory/src/utils/polyfill.js +29 -31
  142. package/lib/pcpublic/src/components/pcfactory/src/utils/renderReadOnly.tsx +29 -26
  143. package/lib/public/public/iconfont.js +1 -0
  144. package/package.json +2 -2
@@ -1,30 +1,20 @@
1
- import { CheckOutlined } from '@ant-design/icons';
2
- import { EngineBaseProps } from '@lingxiteam/types';
3
1
  import { Select as AntdSelect, Tag } from 'antd';
4
2
  import type { SelectProps } from 'antd/es/select';
5
- import classNames from 'classnames';
6
- import { isEqual } from 'lodash';
3
+ import { CheckOutlined } from '@lingxiteam/icons';
7
4
  import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
5
+ import { renderCommonList } from '../utils/renderReadOnly';
6
+ import { useFuncExpExecute } from '../utils/hooks/useFuncExpExecute';
8
7
  import { FormFields, getFieldsProps, useCommonImperativeHandle, useForm } from '../utils';
9
- import { useMemoizedFn } from '../utils/ahooks';
10
- import CustomModule from '../utils/CustomModule';
11
8
  import EmptyComp from '../utils/Empty';
12
- import { useFuncExpExecute } from '../utils/hooks/useFuncExpExecute';
13
- import { useLocale } from '../utils/hooks/useLocale';
14
- import { renderCommonList } from '../utils/renderReadOnly';
15
9
  import SpinComp from '../utils/Spin';
16
- import {
17
- checkIfSelectedAll,
18
- CHECK_ALL_VALUE,
19
- getChangeSelectData,
20
- getRules,
21
- getSelectedAllData,
22
- handleDataSource,
23
- handleFormValue,
24
- isLabelInValue,
25
- localFilterOption,
26
- transformValueType,
27
- } from './selectUtils';
10
+ import { useMemoizedFn } from '../utils/ahooks';
11
+ import classNames from 'classnames';
12
+ import { useLocale } from '../utils/hooks/useLocale';
13
+ import { CHECK_ALL_VALUE, handleFormValue, isLabelInValue, localFilterOption, getSelectedAllData, transformValueType, getRules, getChangeSelectData, checkIfSelectedAll, handleDataSource } from './selectUtils';
14
+ import CustomModule from '../utils/CustomModule';
15
+ import { EngineBaseProps } from '@lingxiteam/types';
16
+ import { isEqual } from 'lodash';
17
+
28
18
 
29
19
  export interface MySelectProps extends EngineBaseProps {
30
20
  value?: any;
@@ -75,7 +65,7 @@ export interface MySelectProps extends EngineBaseProps {
75
65
  tipWidth?: string; // 提示自定义的宽度
76
66
  tipHeight?: string; // 提示自定义的高度
77
67
  getEngineApis: any;
78
- checkedAll?: boolean; // 下拉多选时是否支持全选
68
+ checkedAll?: boolean;// 下拉多选时是否支持全选
79
69
 
80
70
  /**
81
71
  * 是否输入触发,默认fasel,也就是回车键触发, 为true的时候表示实时搜索
@@ -93,6 +83,7 @@ const WrapperSelect: React.FC<WrapperSelectProps> = ({ children }) =>
93
83
  className: `${SELECT_WRAPPER_CLASSNAME} ${children.props.className || ''}`,
94
84
  });
95
85
 
86
+
96
87
  const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
97
88
  const {
98
89
  value: originValue,
@@ -154,7 +145,13 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
154
145
  return _defaultValue;
155
146
  }, []);
156
147
 
157
- const { sandBoxSafeRun, sandBoxLoadModule, onlySyncValue, compatConfig, dataState } = getEngineApis() || {};
148
+ const {
149
+ sandBoxSafeRun,
150
+ sandBoxLoadModule,
151
+ onlySyncValue,
152
+ compatConfig,
153
+ dataState,
154
+ } = getEngineApis() || {};
158
155
  const { getLocale, lang } = useLocale(getEngineApis());
159
156
  const CHECK_ALL_TEXT = getLocale?.('all', '全选');
160
157
  const funcExpExecute = useFuncExpExecute(sandBoxSafeRun, getLocale);
@@ -182,10 +179,17 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
182
179
 
183
180
  // FIX: 兼容旧逻辑 通过表单设置值时表单项的值需要预处理,否则会导致值和预想的值不一致
184
181
  if (formContext.inForm) {
185
- formContext.preproccessSetFormValues(props.fieldName, v => handleFormValue(v, props.mode));
182
+ formContext.preproccessSetFormValues(props.fieldName, (v) => handleFormValue(v, props.mode));
186
183
  }
187
184
 
188
- const { required, disabled, finalRules, setExtendRules, formFieldsRef, readOnly } = useCommonImperativeHandle(ref, props, {
185
+ const {
186
+ required,
187
+ disabled,
188
+ finalRules,
189
+ setExtendRules,
190
+ formFieldsRef,
191
+ readOnly,
192
+ } = useCommonImperativeHandle(ref, props, {
189
193
  clearValue: [],
190
194
  getSelectedData: () => {
191
195
  return getChangeSelectData(dataSource, value, mode);
@@ -237,7 +241,9 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
237
241
  setDataSource(newData);
238
242
  }, [JSON.stringify(propsDataSource)]);
239
243
 
240
- const renderEmpty = useMemo(() => <EmptyComp getLocale={getLocale} dataState={dataState} clsName="pcfactory-empty-small" />, [dataState]);
244
+ const renderEmpty = useMemo(() => (
245
+ <EmptyComp getLocale={getLocale} dataState={dataState} clsName="pcfactory-empty-small" />
246
+ ), [dataState]);
241
247
 
242
248
  // 远程过滤搜索
243
249
  const onRemoteFilter = async (searchText: string) => {
@@ -270,13 +276,13 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
270
276
  defaultActiveFirstOption: false,
271
277
  showSearch: true,
272
278
  filterOption: false,
273
- onKeyDown: e => {
279
+ onKeyDown: (e) => {
274
280
  // 兼容旧浏览器使用keyCode
275
281
  if (e.key === 'Enter' || e.keyCode === 13) {
276
282
  onRemoteFilter(searchTextRef?.current || '');
277
283
  }
278
284
  },
279
- onSearch: input => {
285
+ onSearch: (input) => {
280
286
  try {
281
287
  // setSearchText(input);
282
288
  searchTextRef.current = input;
@@ -301,9 +307,26 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
301
307
  }, [filter, dataState]);
302
308
 
303
309
  const renderGengelContent = (c: any, data: any) => {
304
- const { color, backgroundColor, remarkTextColor, remarkList = [] } = data?.options || {};
310
+ const {
311
+ color,
312
+ backgroundColor,
313
+ remarkTextColor,
314
+ remarkList = [],
315
+ isBaseText,
316
+ isShallowPrimary,
317
+ isPrimary,
318
+ isSubText,
319
+ tempTextColorType,
320
+ } = data?.options || {};
321
+ const style: React.CSSProperties = {};
305
322
  let label = (
306
- <div className="ued-select-item-label" style={{ color }}>
323
+ <div
324
+ className={classNames({
325
+ 'ued-select-item-label': true,
326
+ 'ued-select-item-primary': tempTextColorType === 'PRIMARY_COLOR',
327
+ })}
328
+ style={!tempTextColorType ? { color } : {}}
329
+ >
307
330
  {c.label}
308
331
  </div>
309
332
  );
@@ -312,8 +335,20 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
312
335
  switch (mType) {
313
336
  case 'lightBackground':
314
337
  case 'darkBackground':
338
+ if (!isBaseText) {
339
+ style.color = color;
340
+ }
341
+ if (!isShallowPrimary && !isPrimary) {
342
+ style.backgroundColor = backgroundColor;
343
+ }
315
344
  label = (
316
- <div className={`ued-select-item-label ued-select-item-${mType}`} style={{ color, backgroundColor }}>
345
+ <div
346
+ className={classNames({
347
+ 'ued-select-item-label': true,
348
+ [`ued-select-item-${mType}`]: true,
349
+ })}
350
+ style={style}
351
+ >
317
352
  {c.label}
318
353
  </div>
319
354
  );
@@ -323,9 +358,12 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
323
358
  case 'otherDarkBackground':
324
359
  if (remarkList.length) {
325
360
  remarkList
326
- .filter((r: any) => !!r.label)
361
+ .filter((r: any) => !!r.label || r.isBind)
327
362
  .forEach((row: any) => {
328
- if (row.value || row.label) {
363
+ if (row.isBind) {
364
+ const binName = sandBoxSafeRun(row.value, { row: c });
365
+ remark += `${binName || row.value} | `;
366
+ } else if (row.value || row.label) {
329
367
  if (c[row.value]) {
330
368
  remark += `${c[row.value]} | `;
331
369
  } else if (c[row.label]) {
@@ -337,13 +375,32 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
337
375
  remark = remark.substring(0, remark.length - 3);
338
376
  }
339
377
  }
378
+ if (!tempTextColorType && !isBaseText) {
379
+ style.color = color;
380
+ }
381
+ if (!isShallowPrimary && !isPrimary) {
382
+ style.backgroundColor = backgroundColor;
383
+ }
340
384
  label = (
341
385
  <div className="ued-select-item-column">
342
- <div className={`ued-select-item-label ued-select-item-${mType}`} style={{ color, backgroundColor }}>
386
+ <div
387
+ className={classNames({
388
+ 'ued-select-item-label': true,
389
+ [`ued-select-item-${mType}`]: true,
390
+ 'ued-select-item-primary': tempTextColorType === 'PRIMARY_COLOR',
391
+ })}
392
+ style={style}
393
+ >
343
394
  {c.label}
344
395
  </div>
345
396
  {!!remark.length && (
346
- <div className="ued-select-item-remark" style={{ color: remarkTextColor }}>
397
+ <div
398
+ className={classNames({
399
+ 'ued-select-item-remark': true,
400
+ 'ued-select-item-primary-remark-color': tempTextColorType === 'PRIMARY_COLOR',
401
+ })}
402
+ style={isSubText ? {} : { color: remarkTextColor }}
403
+ >
347
404
  {remark}
348
405
  </div>
349
406
  )}
@@ -352,7 +409,13 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
352
409
  break;
353
410
  default:
354
411
  }
355
- return <div className="ued-select-item">{label}</div>;
412
+ return (
413
+ <div
414
+ className="ued-select-item"
415
+ >
416
+ {label}
417
+ </div>
418
+ );
356
419
  };
357
420
 
358
421
  const renderLabel = (c: any, index: number) => {
@@ -454,12 +517,7 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
454
517
 
455
518
  const extraProps = {
456
519
  // 选中数据时过滤掉全选
457
- tagRender: (p: any) =>
458
- p?.value !== CHECK_ALL_VALUE ? (
459
- <Tag {...p} className="ued-select-checked-tag">
460
- {p?.label}
461
- </Tag>
462
- ) : null,
520
+ tagRender: (p: any) => (p?.value !== CHECK_ALL_VALUE ? <Tag {...p} className="ued-select-checked-tag">{p?.label}</Tag> : null),
463
521
  ...restProps,
464
522
  };
465
523
 
@@ -484,7 +542,7 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
484
542
  >
485
543
  <div
486
544
  className="ued-check-all-content"
487
- onClick={e => {
545
+ onClick={(e) => {
488
546
  e.stopPropagation();
489
547
  handleCheckedAll();
490
548
  }}
@@ -531,17 +589,39 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
531
589
 
532
590
  const handleCheckedAll = () => {
533
591
  if (hasCheckAll) {
534
- const localFilterData = dataSource.filter(d => localFilterOption(searchTextRef.current, d));
592
+ const localFilterData = dataSource.filter((d) => localFilterOption(searchTextRef.current, d));
535
593
  const data = getSelectedAllData(!isCheckedAll, localFilterData, value, max);
536
594
  handleOnChange(data);
537
595
  }
538
596
  };
539
597
 
598
+ const tagRender = (props: any) => {
599
+ const { label, closable, onClose } = props;
600
+ const { color, backgroundColor } = customRenderLabel?.options || {};
601
+ return (
602
+ <Tag
603
+ className={classNames({
604
+ 'ued-multiple-select-tag': !customRenderLabel?.type && !customRenderLabel?.jsx,
605
+ lightBackground: customRenderLabel?.type === 'lightBackground',
606
+ darkBackground: customRenderLabel?.type === 'darkBackground',
607
+ jsx: customRenderLabel?.jsx,
608
+ })}
609
+ style={{ backgroundColor, color }}
610
+ // color={value}
611
+ // onMouseDown={onPreventMouseDown}
612
+ closable={closable}
613
+ onClose={onClose}
614
+ >
615
+ {label}
616
+ </Tag>
617
+ );
618
+ };
619
+
540
620
  return (
541
621
  <FormFields
542
622
  {...getFieldsProps(props)}
543
623
  wrapperClassName={SELECT_WRAPPER_CLASSNAME}
544
- render={val => renderCommonList(val, dataSource)}
624
+ render={(val) => renderCommonList(val, dataSource)}
545
625
  required={required}
546
626
  disabled={disabled}
547
627
  ref={formFieldsRef}
@@ -555,18 +635,19 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
555
635
  <AntdSelect
556
636
  showArrow
557
637
  {...restProps}
558
- // value无值时不配置value属性,避免defaultValue渲染失败
638
+ // value无值时不配置value属性,避免defaultValue渲染失败
559
639
  defaultValue={defaultValue}
560
640
  {...extraProps}
561
641
  {...filterObject}
562
642
  value={value}
563
643
  open={open}
564
644
  mode={mode}
645
+ tagRender={tagRender}
565
646
  optionLabelProp="label"
566
647
  notFoundContent={searching ? <SpinComp dataState={dataState} /> : renderEmpty}
567
- onChange={v => {
648
+ onChange={(v) => {
568
649
  if (filter === 'local' && searchTextRef.current) {
569
- // 点击时需要重置过滤条件
650
+ // 点击时需要重置过滤条件
570
651
  handleLocalSearch('');
571
652
  }
572
653
  // 单选选完要关闭
@@ -577,7 +658,7 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
577
658
 
578
659
  handleOnChange(v);
579
660
  }}
580
- onClick={e => {
661
+ onClick={(e) => {
581
662
  let targetParent = (e?.target as HTMLBaseElement)?.parentNode;
582
663
  const curretTarget = e?.currentTarget;
583
664
  while (targetParent && targetParent !== curretTarget) {
@@ -597,9 +678,9 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
597
678
  handleAfterClose();
598
679
  }}
599
680
  onClear={() => {
600
- // setOpen(false);
681
+ // setOpen(false);
601
682
  if (searchTextRef.current) {
602
- // 需要置空搜索值
683
+ // 需要置空搜索值
603
684
  searchTextRef.current = '';
604
685
  resetRemoteFilter();
605
686
  }
@@ -607,21 +688,19 @@ const Select = React.forwardRef<any, MySelectProps>((props, ref) => {
607
688
  >
608
689
  {renderCheckAll()}
609
690
  {/* 远程过滤searching时展示notFoundContent内的loading */}
610
- {searching
611
- ? []
612
- : (dataSource || []).map((c: any, index: number) => {
613
- return (
614
- <AntdSelect.Option
615
- label={renderLabel(c, index)}
616
- title={c.label}
617
- key={c.value || Math.random()}
618
- value={transformValueType(c.value, value ?? [])}
619
- disabled={rangeLimit && rangeLimit.length > 0 && !rangeLimit.includes(+c.value)}
620
- >
621
- {renderOption(c, index)}
622
- </AntdSelect.Option>
623
- );
624
- })}
691
+ {searching ? [] : (dataSource || []).map((c: any, index: number) => {
692
+ return (
693
+ <AntdSelect.Option
694
+ label={renderLabel(c, index)}
695
+ title={c.label}
696
+ key={c.value || Math.random()}
697
+ value={transformValueType(c.value, value ?? [])}
698
+ disabled={rangeLimit && rangeLimit.length > 0 && !rangeLimit.includes(+c.value)}
699
+ >
700
+ {renderOption(c, index)}
701
+ </AntdSelect.Option>
702
+ );
703
+ })}
625
704
  </AntdSelect>
626
705
  </FormFields>
627
706
  );
@@ -1,5 +1,8 @@
1
+
2
+
1
3
  export const CHECK_ALL_VALUE = 'LING_XI_CHECK_ALL';
2
4
 
5
+
3
6
  const typeFn: any = {
4
7
  string: String,
5
8
  number: Number,
@@ -32,13 +35,17 @@ export const localFilterOption = (input: string = '', option: any) => {
32
35
  // 判断data类型是不是是labelInValue格式
33
36
  export const isLabelInValue = (data: any) => {
34
37
  if (Object.prototype.toString.call(data) === '[object Object]') {
35
- if (Object.keys(data).includes('label') && (Object.keys(data).includes('value') || Object.keys(data).includes('key'))) {
38
+ if (Object.keys(data).includes('label') &&
39
+ (Object.keys(data).includes('value') || Object.keys(data).includes('key'))) {
36
40
  return true;
37
41
  }
38
42
  } else if (Object.prototype.toString.call(data) === '[object Array]' && data.length) {
39
43
  let isLabelInValueCount = 0;
40
44
  data.forEach((v: any) => {
41
- if (Object.keys(v).includes('label') && (Object.keys(v).includes('value') || Object.keys(v).includes('key'))) {
45
+ if (
46
+ Object.keys(v).includes('label') &&
47
+ (Object.keys(v).includes('value') || Object.keys(v).includes('key'))
48
+ ) {
42
49
  isLabelInValueCount += 1;
43
50
  }
44
51
  });
@@ -83,6 +90,7 @@ export const transformValueType = (v: any, curVal: any) => {
83
90
  return v;
84
91
  };
85
92
 
93
+
86
94
  export const getRules = (min?: number, max?: number, getLocale?: any) => {
87
95
  if (!min && !max) {
88
96
  return [];
@@ -97,11 +105,7 @@ export const getRules = (min?: number, max?: number, getLocale?: any) => {
97
105
  });
98
106
  }
99
107
  if (max) {
100
- maxMsg.push({
101
- type: 'array',
102
- max,
103
- message: getLocale?.('CheckboxGroup.maxRule', { max }),
104
- });
108
+ maxMsg.push({ type: 'array', max, message: getLocale?.('CheckboxGroup.maxRule', { max }) });
105
109
  }
106
110
  return [...minMsg, ...maxMsg];
107
111
  };
@@ -116,7 +120,7 @@ export const getChangeSelectData = (dataSource: any[], val: string[] | Object, m
116
120
  return undefined;
117
121
  }
118
122
  const sltData = dataSource.find((c: any) => c.value?.toString() === v?.toString());
119
- return sltData ? [sltData] : undefined;
123
+ return (sltData ? [sltData] : undefined);
120
124
  };
121
125
 
122
126
  export const getSelectedAllData = (checked: boolean, dataSource: any[], value: any[], max?: number) => {
@@ -178,7 +182,7 @@ export const checkIfSelectedAll = (dataSource: any[], value: any[], filterValue:
178
182
  * @param labelKey
179
183
  * @returns
180
184
  */
181
- export const handleDataSource = (dataSource: any[], appendDataSoure?: any[] | Object, valueKey?: string, labelKey?: string) => {
185
+ export const handleDataSource = (dataSource: any[], appendDataSoure?: any[] | Object, valueKey?: string, labelKey?: string,) => {
182
186
  const valueKeys: any = [];
183
187
  let newDataSoure: any[] = [];
184
188
  if (Array.isArray(dataSource)) {
@@ -1,32 +1,32 @@
1
- import _ from 'lodash';
2
1
  import React from 'react';
2
+ import { MyBodyCellProps } from '../types/bodyCell';
3
+ import FormatCell from '../FormatCell';
3
4
  import {
4
- BODY_CELL_MODE_ED,
5
- OPERATOR_ENDS_WITH,
5
+ SET_ROW_SPECIAL_CELL_BACKGROUND_COLOR,
6
+ SET_ROW_SPECIAL_CELL_CONTENT_STYLE,
7
+ RELATION_OR,
6
8
  OPERATOR_EQUAL,
9
+ OPERATOR_NOT_EQUAL,
7
10
  OPERATOR_GREATER_THAN,
8
- OPERATOR_INCLUDE,
9
11
  OPERATOR_LESS_THAN,
10
- OPERATOR_NOT_EQUAL,
12
+ OPERATOR_INCLUDE,
11
13
  OPERATOR_NOT_INCLUDE,
12
- OPERATOR_NOT_NULL,
13
- OPERATOR_NULL,
14
14
  OPERATOR_STARTS_WITH,
15
- RELATION_OR,
15
+ OPERATOR_ENDS_WITH,
16
+ OPERATOR_NULL,
17
+ OPERATOR_NOT_NULL,
18
+ BODY_CELL_MODE_ED,
16
19
  SET_ROW_ALL_CELL_BACKGROUND_COLOR,
17
20
  SET_ROW_ALL_CELL_CONTENT_STYLE,
18
- SET_ROW_SPECIAL_CELL_BACKGROUND_COLOR,
19
- SET_ROW_SPECIAL_CELL_CONTENT_STYLE,
20
21
  } from '../constant';
21
- import FormatCell from '../FormatCell';
22
- import { MyBodyCellProps } from '../types/bodyCell';
22
+ import _ from 'lodash';
23
23
  import type { ContentStyle } from '../types/contentStyle';
24
24
 
25
25
  const validateCondition = (data: any, row: any) => {
26
26
  const { code, operator, value } = data;
27
27
 
28
28
  const toStringVal = (val: any) => `${val}`;
29
- const toNumberVal = (val: any) => (!isNaN(Number(val)) ? Number(val) : toStringVal(val));
29
+ const toNumberVal = (val: any) => !isNaN(Number(val)) ? Number(val) : toStringVal(val);
30
30
 
31
31
  switch (operator) {
32
32
  case OPERATOR_EQUAL:
@@ -67,7 +67,10 @@ const validateCondition = (data: any, row: any) => {
67
67
  }
68
68
  };
69
69
 
70
- const collectCondition: (data: string | any[], record: any) => any = (data: string | any[], record: any) => {
70
+ const collectCondition: (data: string | any[], record: any) => any = (
71
+ data: string | any[],
72
+ record: any,
73
+ ) => {
71
74
  if (!data || !data?.length) {
72
75
  return true;
73
76
  }
@@ -90,7 +93,7 @@ const collectCondition: (data: string | any[], record: any) => any = (data: stri
90
93
  return valid;
91
94
  };
92
95
 
93
- const MyBodyCell: React.FC<MyBodyCellProps> = props => {
96
+ const MyBodyCell: React.FC<MyBodyCellProps> = (props) => {
94
97
  const {
95
98
  mode,
96
99
  editable,
@@ -108,6 +111,7 @@ const MyBodyCell: React.FC<MyBodyCellProps> = props => {
108
111
  ...restProps
109
112
  } = props;
110
113
 
114
+
111
115
  const commonCellOnClick = () => {
112
116
  if (onTableCellClick) {
113
117
  onTableCellClick(record, _.get(record, dataIndex), dataIndex, index);
@@ -117,11 +121,7 @@ const MyBodyCell: React.FC<MyBodyCellProps> = props => {
117
121
  // 编辑单元格和扩展单元格忽略样式
118
122
  if (editable || isExtend) {
119
123
  if (editable) {
120
- return (
121
- <td {...restProps}>
122
- <div className="ued-table-edit-cell">{children}</div>
123
- </td>
124
- );
124
+ return <td {...restProps}><div className="ued-table-edit-cell">{children}</div></td>;
125
125
  }
126
126
  return <td {...restProps}>{children}</td>;
127
127
  }
@@ -160,7 +160,12 @@ const MyBodyCell: React.FC<MyBodyCellProps> = props => {
160
160
  } = item;
161
161
 
162
162
  // 背景相关
163
- if ([SET_ROW_ALL_CELL_BACKGROUND_COLOR, SET_ROW_SPECIAL_CELL_BACKGROUND_COLOR].includes(formatStyle)) {
163
+ if (
164
+ [
165
+ SET_ROW_ALL_CELL_BACKGROUND_COLOR,
166
+ SET_ROW_SPECIAL_CELL_BACKGROUND_COLOR,
167
+ ].includes(formatStyle)
168
+ ) {
164
169
  /**
165
170
  * 1、属于列单元格的单元格背景样式,需要多判断是否为当前列
166
171
  * 2、运行态时,单元格背景样式配置符合条件才生效
@@ -185,7 +190,10 @@ const MyBodyCell: React.FC<MyBodyCellProps> = props => {
185
190
  }
186
191
  } else if (
187
192
  // 内容相关
188
- [SET_ROW_ALL_CELL_CONTENT_STYLE, SET_ROW_SPECIAL_CELL_CONTENT_STYLE].includes(formatStyle)
193
+ [
194
+ SET_ROW_ALL_CELL_CONTENT_STYLE,
195
+ SET_ROW_SPECIAL_CELL_CONTENT_STYLE,
196
+ ].includes(formatStyle)
189
197
  ) {
190
198
  // 当存在 contentType 时,表明是新版的内容样式,如果有自定义函数,则内容样式都不生效
191
199
  if (typeof contentType === 'string' && isCustomRendering) {
@@ -244,6 +252,7 @@ const MyBodyCell: React.FC<MyBodyCellProps> = props => {
244
252
  }
245
253
  }
246
254
 
255
+
247
256
  return (
248
257
  <FormatCell
249
258
  bgColorStyle={bgColorStyle}
@@ -257,15 +266,16 @@ const MyBodyCell: React.FC<MyBodyCellProps> = props => {
257
266
  commonCellClick={commonCellOnClick}
258
267
  mode={mode}
259
268
  width={width}
260
- >
261
- {children}
269
+ >{children}
262
270
  </FormatCell>
263
271
  );
264
272
  }
265
273
 
266
274
  return (
267
- <td {...restProps} onClick={commonCellOnClick}>
268
- {children}
275
+ <td
276
+ {...restProps}
277
+ onClick={commonCellOnClick}
278
+ >{children}
269
279
  </td>
270
280
  );
271
281
  };