@flatbiz/antd 4.2.85 → 4.2.86

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 (56) hide show
  1. package/esm/button-operate/index.js +2 -1
  2. package/esm/button-operate/index.js.map +1 -1
  3. package/esm/button-wrapper/index.js +2 -1
  4. package/esm/button-wrapper/index.js.map +1 -1
  5. package/esm/card-wrapper/index.css +1 -0
  6. package/esm/card-wrapper/index.js +5 -0
  7. package/esm/card-wrapper/index.js.map +1 -0
  8. package/esm/config-provider-wrapper/index.js +2 -1
  9. package/esm/config-provider-wrapper/index.js.map +1 -1
  10. package/esm/create-drawer-wrapper-model/index.js.map +1 -1
  11. package/esm/create-modal-wrapper-model/index.js.map +1 -1
  12. package/esm/dialog-alert/index.js +2 -1
  13. package/esm/dialog-alert/index.js.map +1 -1
  14. package/esm/dialog-confirm/index.js +2 -1
  15. package/esm/dialog-confirm/index.js.map +1 -1
  16. package/esm/dialog-drawer/index.js +2 -1
  17. package/esm/dialog-drawer/index.js.map +1 -1
  18. package/esm/dialog-drawer-content/index.js +2 -1
  19. package/esm/dialog-drawer-content/index.js.map +1 -1
  20. package/esm/dialog-loading/index.js.map +1 -1
  21. package/esm/dialog-modal/index.js +2 -1
  22. package/esm/dialog-modal/index.js.map +1 -1
  23. package/esm/drawer-wrapper/index.js.map +1 -1
  24. package/esm/dropdown-menu-wrapper/index.js +2 -1
  25. package/esm/dropdown-menu-wrapper/index.js.map +1 -1
  26. package/esm/easy-table/index.js +2 -1
  27. package/esm/easy-table/index.js.map +1 -1
  28. package/esm/editable-table/index.js +10 -1
  29. package/esm/editable-table/index.js.map +1 -1
  30. package/esm/fba-app/index.css +1 -1
  31. package/esm/fba-app/index.js +3 -1
  32. package/esm/fba-app/index.js.map +1 -1
  33. package/esm/index-ac189a77.js +3 -0
  34. package/esm/index-ac189a77.js.map +1 -0
  35. package/esm/index.js +6 -5
  36. package/esm/label-value-layout/index.css +1 -1
  37. package/esm/label-value-layout/index.js +1 -1
  38. package/esm/label-value-layout/index.js.map +1 -1
  39. package/esm/local-loading/index.js.map +1 -1
  40. package/esm/pre-defined-class-name/index.css +1 -1
  41. package/esm/selector-wrapper/index.js +1 -1
  42. package/esm/selector-wrapper/index.js.map +1 -1
  43. package/esm/simple-layout/index.css +1 -1
  44. package/esm/simple-layout/index.js.map +1 -1
  45. package/esm/table-cell-render/index.js +2 -1
  46. package/esm/table-cell-render/index.js.map +1 -1
  47. package/esm/tag-list-select/index.js +1 -1
  48. package/esm/tag-list-select/index.js.map +1 -1
  49. package/esm/text-overflow-render/index.js +2 -1
  50. package/esm/text-overflow-render/index.js.map +1 -1
  51. package/esm/tips-title/index.css +1 -1
  52. package/esm/tree-wrapper/index.js +2 -1
  53. package/esm/tree-wrapper/index.js.map +1 -1
  54. package/esm/types/index.js.map +1 -1
  55. package/index.d.ts +144 -105
  56. package/package.json +4 -3
package/esm/index.js CHANGED
@@ -7,11 +7,13 @@ import './button-operate/index.css';
7
7
  import './button-wrapper/index.css';
8
8
  import './config-provider-wrapper/index.css';
9
9
  import './fba-hooks/index.css';
10
+ import './types/index.css';
10
11
  import './fba-utils/index.css';
11
12
  import './dropdown-menu-wrapper/index.css';
12
13
  import './dialog-confirm/index.css';
13
14
  import './dialog-modal/index.css';
14
15
  import './flex-layout/index.css';
16
+ import './card-wrapper/index.css';
15
17
  import './cascader-wrapper/index.css';
16
18
  import './request-status/index.css';
17
19
  import './check-list/index.css';
@@ -24,7 +26,6 @@ import './data-render/index.css';
24
26
  import './date-picker-wrapper/index.css';
25
27
  import './date-range-picker-wrapper/index.css';
26
28
  import './date-range-picker-wrapper-form-item/index.css';
27
- import './types/index.css';
28
29
  import './dialog-alert/index.css';
29
30
  import './dialog-drawer/index.css';
30
31
  import './dialog-drawer-content/index.css';
@@ -47,7 +48,10 @@ import './icon-wrapper/index.css';
47
48
  import './editable-field-provider/index.css';
48
49
  import './editable-table/index.css';
49
50
  import './selector-wrapper/index.css';
51
+ import './switch-wrapper/index.css';
50
52
  import './upload-wrapper/index.css';
53
+ import './table-cell-render/index.css';
54
+ import './tag-list-select/index.css';
51
55
  import './input-wrapper/index.css';
52
56
  import './input-text-area-wrapper/index.css';
53
57
  import './editor-wrapper/index.css';
@@ -80,9 +84,6 @@ import './selector-wrapper-simple/index.css';
80
84
  import './sms-count-down/index.css';
81
85
  import './styles/index.css';
82
86
  import './switch-confirm-wrapper/index.css';
83
- import './switch-wrapper/index.css';
84
- import './table-cell-render/index.css';
85
- import './tag-list-select/index.css';
86
87
  import './tabs-wrapper/index.css';
87
88
  import './tag-group/index.css';
88
89
  import './tag-wrapper/index.css';
@@ -96,5 +97,5 @@ import './tree-selector-wrapper/index.css';
96
97
  import './tree-wrapper/index.css';
97
98
  import './index.css';
98
99
  /*! @flatjs/forge MIT @flatbiz/antd */
99
- export{AmountFenInput}from"./amount-fen-input/index.js";export{AmountFenInputFormItem}from"./amount-fen-input-form-item/index.js";export{AnchorSteps}from"./anchor-steps/index.js";export{ButtonOperate,ButtonOperateItemContent}from"./button-operate/index.js";export{ButtonWrapper}from"./button-wrapper/index.js";export{CascaderWrapper}from"./cascader-wrapper/index.js";export{CheckList}from"./check-list/index.js";export{CheckboxWrapper}from"./checkbox-wrapper/index.js";export{ColorPickerWrapper}from"./color-picker-wrapper/index.js";export{ConfigProviderWrapper}from"./config-provider-wrapper/index.js";export{createDrawerWrapperModel}from"./create-drawer-wrapper-model/index.js";export{createModalWrapperModel}from"./create-modal-wrapper-model/index.js";export{CssNodeHover}from"./css-node-hover/index.js";export{DataRender}from"./data-render/index.js";export{DatePickerWrapper}from"./date-picker-wrapper/index.js";export{DateRangePickerWrapper}from"./date-range-picker-wrapper/index.js";export{DateRangePickerWrapperFormItem}from"./date-range-picker-wrapper-form-item/index.js";export{dialogAlert}from"./dialog-alert/index.js";export{dialogConfirm}from"./dialog-confirm/index.js";export{dialogDrawer}from"./dialog-drawer/index.js";export{DialogDrawerContent}from"./dialog-drawer-content/index.js";export{dialogLoading}from"./dialog-loading/index.js";export{dialogModal}from"./dialog-modal/index.js";export{DragCollapse}from"./drag-collapse/index.js";export{DragCollapseFormList}from"./drag-collapse-form-list/index.js";export{DragFormList}from"./drag-form-list/index.js";export{DragTable}from"./drag-table/index.js";export{DrawerWrapper}from"./drawer-wrapper/index.js";export{DropdownMenuWrapper}from"./dropdown-menu-wrapper/index.js";export{dynamicNode}from"./dynamic-node/index.js";export{EasyTable}from"./easy-table/index.js";export{EditableField}from"./editable-field/index.js";export{EditableFieldProvider}from"./editable-field-provider/index.js";export{EditableTable}from"./editable-table/index.js";export{EditorWrapper}from"./editor-wrapper/index.js";export{FbaApp}from"./fba-app/index.js";export{fbaHooks}from"./fba-hooks/index.js";export{fbaUtils}from"./fba-utils/index.js";export{FileImport}from"./file-import/index.js";export{FileSelect}from"./file-select/index.js";export{FlexLayout}from"./flex-layout/index.js";export{FormGrid}from"./form-grid/index.js";export{FormItemGroup}from"./form-item-group/index.js";export{FormItemHidden}from"./form-item-hidden/index.js";export{FormItemWrapper}from"./form-item-wrapper/index.js";export{FormListWrapper}from"./form-list-wrapper/index.js";export{Gap}from"./gap/index.js";export{IconWrapper}from"./icon-wrapper/index.js";export{InputSearchWrapper}from"./input-search-wrapper/index.js";export{InputTextAreaWrapper}from"./input-text-area-wrapper/index.js";export{InputWrapper}from"./input-wrapper/index.js";export{LabelValueLayout}from"./label-value-layout/index.js";export{LocalLoading}from"./local-loading/index.js";export{ModalAction}from"./modal-action/index.js";export{ModalWrapper}from"./modal-wrapper/index.js";export{PageFixedFooter}from"./page-fixed-footer/index.js";export{Page404}from"./page404/index.js";export{P as PaginationWrapper}from"./index-e98b9352.js";export{Permission}from"./permission/index.js";export{preDefinedClassName}from"./pre-defined-class-name/index.js";export{RadioGroupWrapper}from"./radio-group-wrapper/index.js";export{RelationTree}from"./relation-tree/index.js";export{RequestStatus}from"./request-status/index.js";export{RichTextEditor}from"./rich-text-editor/index.js";export{RichTextViewer}from"./rich-text-viewer/index.js";export{RollLocationCenter}from"./roll-location-center/index.js";export{RollLocationInView}from"./roll-location-in-view/index.js";export{RuleDescribe}from"./rule-describe/index.js";export{SearchMenu}from"./search-menu/index.js";export{SelectorWrapper}from"./selector-wrapper/index.js";export{SelectorWrapperSearch}from"./selector-wrapper-search/index.js";export{SelectorWrapperSimple}from"./selector-wrapper-simple/index.js";export{SimpleLayout}from"./simple-layout/index.js";export{SmsCountDown}from"./sms-count-down/index.js";export{styles}from"./styles/index.js";export{SwitchConfirmWrapper}from"./switch-confirm-wrapper/index.js";export{SwitchWrapper}from"./switch-wrapper/index.js";export{tableCellRender}from"./table-cell-render/index.js";export{TableScrollbar}from"./table-scrollbar/index.js";export{TableTitleTooltip}from"./table-title-tooltip/index.js";export{TabsWrapper}from"./tabs-wrapper/index.js";export{TagGroup}from"./tag-group/index.js";export{TagListSelect}from"./tag-list-select/index.js";export{TagWrapper}from"./tag-wrapper/index.js";export{TextCssEllipsis}from"./text-css-ellipsis/index.js";export{TextOverflowRender}from"./text-overflow-render/index.js";export{TimePickerWrapper}from"./time-picker-wrapper/index.js";export{TimeRangePickerWrapper}from"./time-range-picker-wrapper/index.js";export{TimeRangePickerWrapperFormItem}from"./time-range-picker-wrapper-form-item/index.js";export{TipsTitle}from"./tips-title/index.js";export{TipsWrapper}from"./tips-wrapper/index.js";export{TreeSelectorWrapper}from"./tree-selector-wrapper/index.js";export{TreeWrapper}from"./tree-wrapper/index.js";export{UploadWrapper}from"./upload-wrapper/index.js";import"./_rollupPluginBabelHelpers-fc015ef2.js";import"@flatbiz/utils";import"antd";import"react/jsx-runtime";import"@dimjs/utils/cjs/class-names";import"react";import"@ant-design/icons/es/icons/MoreOutlined";import"@dimjs/lang/cjs/is-undefined";import"@dimjs/lang/cjs/is-plain-object";import"@dimjs/lang/cjs/is-string";import"@dimjs/lang/cjs/is-promise";import"@wove/react/cjs/hooks";import"@ant-design/icons/es/icons/LoadingOutlined";import"@ant-design/icons/es/icons/RedoOutlined";import"@dimjs/utils/cjs/extend";import"@dimjs/model";import"@dimjs/model-react";import"@wove/react/cjs/create-ctx";import"@ant-design/icons/es/icons/CloseCircleOutlined";import"@flatbiz/antd";import"antd/es/locale/en_US";import"antd/es/locale/zh_CN";import"dayjs";import"dayjs/locale/en";import"dayjs/locale/zh-cn";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/localeData";import"dayjs/plugin/utc";import"dayjs/plugin/weekday";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/weekYear";import"./time-53b3f55f.js";import"@dimjs/lang/cjs/is-array";import"react-dom/client";import"./dom-4d04aa64.js";import"./context-1f2093c6.js";import"ahooks";import"@dimjs/utils/cjs/array";import"@dnd-kit/core";import"@dnd-kit/sortable";import"@ant-design/icons/es/icons/DragOutlined";import"@dnd-kit/utilities";import"@dnd-kit/modifiers";import"@ant-design/icons/es/icons/SaveOutlined";import"@ant-design/icons/es/icons/ExclamationCircleFilled";import"@ant-design/icons/es/icons/DownOutlined";import"@ant-design/icons/es/icons/UpOutlined";import"react-is";import"@ant-design/icons/es/icons/CloseOutlined";import"@ant-design/icons/es/icons/CheckOutlined";import"@dimjs/lang/cjs/is-number";import"@ant-design/icons/es/icons/EditOutlined";import"./context-25d0b686.js";import"@ant-design/icons/es/icons/PlusOutlined";import"@dimjs/lang/cjs/is-boolean";import"@ant-design/icons/es/icons/DeleteOutlined";import"@wove/react/cjs/editor";import"./use-responsive-point-21b8c601.js";import"@dimjs/lang/cjs/is-deep-equal";import"@tinymce/tinymce-react";import"@ant-design/icons/es/icons/PlusCircleOutlined";import"@ant-design/icons/es/icons/FullscreenOutlined";import"@dimjs/utils/cjs/get";import"@dimjs/utils/cjs/json";import"pubsub-js";import"@dimjs/lang/cjs/is-object";import"@dimjs/lang/cjs/is-empty";import"@ant-design/icons/es/icons/QuestionCircleOutlined";import"dayjs/plugin/isSameOrAfter";import"dayjs/plugin/isSameOrBefore";import"@ant-design/icons/es/icons/CaretDownFilled";import"dequal";import"@dimjs/utils/cjs/tree";import"react-dom";
100
+ export{AmountFenInput}from"./amount-fen-input/index.js";export{AmountFenInputFormItem}from"./amount-fen-input-form-item/index.js";export{AnchorSteps}from"./anchor-steps/index.js";export{ButtonOperate,ButtonOperateItemContent}from"./button-operate/index.js";export{ButtonWrapper}from"./button-wrapper/index.js";export{CardWrapper}from"./card-wrapper/index.js";export{CascaderWrapper}from"./cascader-wrapper/index.js";export{CheckList}from"./check-list/index.js";export{CheckboxWrapper}from"./checkbox-wrapper/index.js";export{ColorPickerWrapper}from"./color-picker-wrapper/index.js";export{ConfigProviderWrapper}from"./config-provider-wrapper/index.js";export{createDrawerWrapperModel}from"./create-drawer-wrapper-model/index.js";export{createModalWrapperModel}from"./create-modal-wrapper-model/index.js";export{CssNodeHover}from"./css-node-hover/index.js";export{DataRender}from"./data-render/index.js";export{DatePickerWrapper}from"./date-picker-wrapper/index.js";export{DateRangePickerWrapper}from"./date-range-picker-wrapper/index.js";export{DateRangePickerWrapperFormItem}from"./date-range-picker-wrapper-form-item/index.js";export{dialogAlert}from"./dialog-alert/index.js";export{dialogConfirm}from"./dialog-confirm/index.js";export{dialogDrawer}from"./dialog-drawer/index.js";export{DialogDrawerContent}from"./dialog-drawer-content/index.js";export{dialogLoading}from"./dialog-loading/index.js";export{dialogModal}from"./dialog-modal/index.js";export{DragCollapse}from"./drag-collapse/index.js";export{DragCollapseFormList}from"./drag-collapse-form-list/index.js";export{DragFormList}from"./drag-form-list/index.js";export{DragTable}from"./drag-table/index.js";export{DrawerWrapper}from"./drawer-wrapper/index.js";export{DropdownMenuWrapper}from"./dropdown-menu-wrapper/index.js";export{dynamicNode}from"./dynamic-node/index.js";export{EasyTable}from"./easy-table/index.js";export{EditableField}from"./editable-field/index.js";export{EditableFieldProvider}from"./editable-field-provider/index.js";export{EditableTable}from"./editable-table/index.js";export{EditorWrapper}from"./editor-wrapper/index.js";export{FbaApp}from"./fba-app/index.js";export{fbaHooks}from"./fba-hooks/index.js";export{fbaUtils}from"./fba-utils/index.js";export{FileImport}from"./file-import/index.js";export{FileSelect}from"./file-select/index.js";export{FlexLayout}from"./flex-layout/index.js";export{FormGrid}from"./form-grid/index.js";export{FormItemGroup}from"./form-item-group/index.js";export{FormItemHidden}from"./form-item-hidden/index.js";export{FormItemWrapper}from"./form-item-wrapper/index.js";export{FormListWrapper}from"./form-list-wrapper/index.js";export{Gap}from"./gap/index.js";export{IconWrapper}from"./icon-wrapper/index.js";export{InputSearchWrapper}from"./input-search-wrapper/index.js";export{InputTextAreaWrapper}from"./input-text-area-wrapper/index.js";export{InputWrapper}from"./input-wrapper/index.js";export{LabelValueLayout}from"./label-value-layout/index.js";export{LocalLoading}from"./local-loading/index.js";export{ModalAction}from"./modal-action/index.js";export{ModalWrapper}from"./modal-wrapper/index.js";export{PageFixedFooter}from"./page-fixed-footer/index.js";export{Page404}from"./page404/index.js";export{P as PaginationWrapper}from"./index-e98b9352.js";export{Permission}from"./permission/index.js";export{preDefinedClassName}from"./pre-defined-class-name/index.js";export{RadioGroupWrapper}from"./radio-group-wrapper/index.js";export{RelationTree}from"./relation-tree/index.js";export{RequestStatus}from"./request-status/index.js";export{RichTextEditor}from"./rich-text-editor/index.js";export{RichTextViewer}from"./rich-text-viewer/index.js";export{RollLocationCenter}from"./roll-location-center/index.js";export{RollLocationInView}from"./roll-location-in-view/index.js";export{RuleDescribe}from"./rule-describe/index.js";export{SearchMenu}from"./search-menu/index.js";export{SelectorWrapper}from"./selector-wrapper/index.js";export{SelectorWrapperSearch}from"./selector-wrapper-search/index.js";export{SelectorWrapperSimple}from"./selector-wrapper-simple/index.js";export{SimpleLayout}from"./simple-layout/index.js";export{SmsCountDown}from"./sms-count-down/index.js";export{styles}from"./styles/index.js";export{SwitchConfirmWrapper}from"./switch-confirm-wrapper/index.js";export{SwitchWrapper}from"./switch-wrapper/index.js";export{tableCellRender}from"./table-cell-render/index.js";export{TableScrollbar}from"./table-scrollbar/index.js";export{TableTitleTooltip}from"./table-title-tooltip/index.js";export{TabsWrapper}from"./tabs-wrapper/index.js";export{TagGroup}from"./tag-group/index.js";export{TagListSelect}from"./tag-list-select/index.js";export{TagWrapper}from"./tag-wrapper/index.js";export{TextCssEllipsis}from"./text-css-ellipsis/index.js";export{TextOverflowRender}from"./text-overflow-render/index.js";export{TimePickerWrapper}from"./time-picker-wrapper/index.js";export{TimeRangePickerWrapper}from"./time-range-picker-wrapper/index.js";export{TimeRangePickerWrapperFormItem}from"./time-range-picker-wrapper-form-item/index.js";export{TipsTitle}from"./tips-title/index.js";export{TipsWrapper}from"./tips-wrapper/index.js";export{TreeSelectorWrapper}from"./tree-selector-wrapper/index.js";export{TreeWrapper}from"./tree-wrapper/index.js";export{UploadWrapper}from"./upload-wrapper/index.js";import"./_rollupPluginBabelHelpers-fc015ef2.js";import"@flatbiz/utils";import"antd";import"react/jsx-runtime";import"@dimjs/utils/cjs/class-names";import"react";import"@ant-design/icons/es/icons/MoreOutlined";import"@dimjs/lang/cjs/is-undefined";import"@dimjs/lang/cjs/is-plain-object";import"@dimjs/lang/cjs/is-string";import"@dimjs/lang/cjs/is-promise";import"@wove/react/cjs/hooks";import"@ant-design/icons/es/icons/LoadingOutlined";import"@ant-design/icons/es/icons/RedoOutlined";import"@dimjs/utils/cjs/extend";import"@dimjs/model";import"@dimjs/model-react";import"@wove/react/cjs/create-ctx";import"@ant-design/icons/es/icons/CloseCircleOutlined";import"@flatbiz/antd";import"antd/es/locale/en_US";import"antd/es/locale/zh_CN";import"dayjs";import"dayjs/locale/en";import"dayjs/locale/zh-cn";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/localeData";import"dayjs/plugin/utc";import"dayjs/plugin/weekday";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/weekYear";import"./index-ac189a77.js";import"./time-53b3f55f.js";import"@dimjs/lang/cjs/is-array";import"react-dom/client";import"./dom-4d04aa64.js";import"./context-1f2093c6.js";import"ahooks";import"@dimjs/utils/cjs/array";import"@dnd-kit/core";import"@dnd-kit/sortable";import"@ant-design/icons/es/icons/DragOutlined";import"@dnd-kit/utilities";import"@dnd-kit/modifiers";import"@ant-design/icons/es/icons/SaveOutlined";import"@ant-design/icons/es/icons/ExclamationCircleFilled";import"@ant-design/icons/es/icons/DownOutlined";import"@ant-design/icons/es/icons/UpOutlined";import"react-is";import"@ant-design/icons/es/icons/CloseOutlined";import"@ant-design/icons/es/icons/CheckOutlined";import"@dimjs/lang/cjs/is-number";import"@ant-design/icons/es/icons/EditOutlined";import"./context-25d0b686.js";import"@ant-design/icons/es/icons/PlusOutlined";import"@dimjs/lang/cjs/is-boolean";import"@ant-design/icons/es/icons/DeleteOutlined";import"@wove/react/cjs/editor";import"./use-responsive-point-21b8c601.js";import"@dimjs/lang/cjs/is-deep-equal";import"@tinymce/tinymce-react";import"@ant-design/icons/es/icons/PlusCircleOutlined";import"@ant-design/icons/es/icons/FullscreenOutlined";import"@dimjs/utils/cjs/get";import"@dimjs/utils/cjs/json";import"pubsub-js";import"@dimjs/lang/cjs/is-object";import"@dimjs/lang/cjs/is-empty";import"@ant-design/icons/es/icons/QuestionCircleOutlined";import"dayjs/plugin/isSameOrAfter";import"dayjs/plugin/isSameOrBefore";import"@ant-design/icons/es/icons/CaretDownFilled";import"dequal";import"@dimjs/utils/cjs/tree";import"react-dom";
100
101
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- .v-label-value-layout .ant-descriptions-item-label{color:rgba(0,0,0,.45);flex-shrink:0;width:var(--v-label-value-layout-lWidth)}.v-label-value-layout .ant-descriptions-item{padding-bottom:8px}.v-label-value-layout .ant-descriptions-item-content{color:rgba(0,0,0,.85);font-weight:400}.v-label-value-layout.ant-descriptions-bordered .ant-descriptions-item-label{padding:8px 10px}.v-label-value-layout-border{border:1px solid #dedede;border-radius:5px;margin-top:20px;padding:10px 10px 2px}
1
+ .v-label-value-layout .ant-descriptions-item-label{color:rgba(0,0,0,.45);flex-shrink:0;width:var(--v-label-value-layout-Width)}.v-label-value-layout .ant-descriptions-item{padding-bottom:8px}.v-label-value-layout .ant-descriptions-item-content{color:rgba(0,0,0,.85);font-weight:400}.v-label-value-layout.ant-descriptions-bordered .ant-descriptions-item-label{padding:8px 10px}.v-label-value-layout-border{border:1px solid #dedede;border-radius:5px;margin-top:20px;padding:10px 10px 2px}.v-label-value-layout:not(.ant-descriptions-bordered) .ant-descriptions-item-label{display:inline-block;text-align:left}
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
2
  import './index.css';
3
3
  /*! @flatjs/forge MIT @flatbiz/antd */
4
- import{classNames as r}from"@dimjs/utils/cjs/class-names";import{_ as e}from"../_rollupPluginBabelHelpers-fc015ef2.js";import{getUuid as l}from"@flatbiz/utils";import{Descriptions as t}from"antd";import{useMemo as a}from"react";import{jsx as o}from"react/jsx-runtime";var n=function n(i){var u=i.labelWidth==="auto"?"auto":(i.labelWidth||120)+"px";var m=e({"--v-label-value-layout-lWidth":u},i.style);var s=r("v-label-value-layout",i.className);var p=a((function(){return i.options.filter((function(r){return!r.hidden}))}),[i.options]);p=p.map((function(r){return e({key:l()},r)}));return o(t,{column:i.column||1,bordered:i.bordered,size:"small",className:s,style:m,children:p.map((function(r){return o(t.Item,{label:r.label,span:r.span,children:r.value},r.key)}))})};export{n as LabelValueLayout};
4
+ import{classNames as r}from"@dimjs/utils/cjs/class-names";import{_ as e}from"../_rollupPluginBabelHelpers-fc015ef2.js";import{getUuid as l}from"@flatbiz/utils";import{Descriptions as t}from"antd";import{useMemo as a}from"react";import{jsx as o}from"react/jsx-runtime";var n=function n(i){var u=i.labelWidth==="auto"?"auto":(i.labelWidth||120)+"px";var m=e({"--v-label-value-layout-Width":u},i.style);var s=r("v-label-value-layout",i.className);var p=a((function(){var r=i.options.filter((function(r){return!r.hidden}));return r.map((function(r){return e({key:l()},r)}))}),[i.options]);return o(t,{column:i.column||1,bordered:i.bordered,size:"small",className:s,style:m,children:p.map((function(r){return o(t.Item,{label:r.label,span:r.span,children:r.value},r.key)}))})};export{n as LabelValueLayout};
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/label-value-layout/label-value-layout.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { getUuid } from '@flatbiz/utils';\nimport { Descriptions } from 'antd';\nimport { CSSProperties, ReactElement, useMemo } from 'react';\nimport './style.less';\n\nexport type LabelValueLayoutProps = {\n options: {\n key?: string | number;\n label: string | ReactElement;\n value?: string | number | ReactElement;\n span?: number;\n hidden?: boolean;\n }[];\n labelWidth?: number | 'auto';\n // 一行占几组,默认1\n column?: number;\n bordered?: boolean;\n className?: string;\n style?: CSSProperties;\n};\n\n/**\n * options[].span 是 Description.Item 的数量。 span={2} 会占用两个 DescriptionItem 的宽度\n * options[].hidden 是否隐藏 Description.Item\n */\nexport const LabelValueLayout = (props: LabelValueLayoutProps) => {\n const labelWidth = props.labelWidth === 'auto' ? 'auto' : `${props.labelWidth || 120}px`;\n const style = { '--v-label-value-layout-lWidth': labelWidth, ...props.style } as CSSProperties;\n const className = classNames('v-label-value-layout', props.className);\n\n let options = useMemo(() => {\n return props.options.filter((item) => !item.hidden);\n }, [props.options]);\n\n options = options.map((item) => {\n return { key: getUuid(), ...item };\n });\n\n return (\n <Descriptions\n column={props.column || 1}\n bordered={props.bordered}\n size=\"small\"\n className={className}\n style={style}\n >\n {options.map((item) => {\n return (\n <Descriptions.Item key={item.key} label={item.label} span={item.span}>\n {item.value}\n </Descriptions.Item>\n );\n })}\n </Descriptions>\n );\n};\n"],"names":["LabelValueLayout","props","labelWidth","style","_extends","className","_classNames","options","useMemo","filter","item","hidden","map","key","getUuid","_jsx","Descriptions","column","bordered","size","children","Item","label","span","value"],"mappings":";gRA0BaA,EAAmB,SAAnBA,EAAoBC,GAC/B,IAAMC,EAAaD,EAAMC,aAAe,OAAS,QAAYD,EAAMC,YAAc,KAAO,KACxF,IAAMC,EAAKC,EAAA,CAAK,gCAAiCF,GAAeD,EAAME,OACtE,IAAME,EAAYC,EAAW,uBAAwBL,EAAMI,WAE3D,IAAIE,EAAUC,GAAQ,WACpB,OAAOP,EAAMM,QAAQE,QAAO,SAACC,GAAI,OAAMA,EAAKC,SAC9C,GAAG,CAACV,EAAMM,UAEVA,EAAUA,EAAQK,KAAI,SAACF,GACrB,OAAAN,EAAA,CAASS,IAAKC,KAAcJ,EAC9B,IAEA,OACEK,EAACC,EAAY,CACXC,OAAQhB,EAAMgB,QAAU,EACxBC,SAAUjB,EAAMiB,SAChBC,KAAK,QACLd,UAAWA,EACXF,MAAOA,EAAMiB,SAEZb,EAAQK,KAAI,SAACF,GACZ,OACEK,EAACC,EAAaK,KAAI,CAAgBC,MAAOZ,EAAKY,MAAOC,KAAMb,EAAKa,KAAKH,SAClEV,EAAKc,OADgBd,EAAKG,SAOvC"}
1
+ {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/label-value-layout/label-value-layout.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { getUuid } from '@flatbiz/utils';\nimport { Descriptions } from 'antd';\nimport { CSSProperties, ReactElement, useMemo } from 'react';\nimport './style.less';\n\nexport type LabelValueLayoutProps = {\n options: {\n label: string | ReactElement;\n value?: string | number | ReactElement | null;\n span?: number;\n hidden?: boolean;\n }[];\n labelWidth?: number | 'auto';\n // 一行占几组,默认1\n column?: number;\n /** 添加边框 */\n bordered?: boolean;\n className?: string;\n style?: CSSProperties;\n};\n\n/**\n * options[].span 是 Description.Item 的数量。 span={2} 会占用两个 DescriptionItem 的宽度\n * options[].hidden 是否隐藏 Description.Item\n */\nexport const LabelValueLayout = (props: LabelValueLayoutProps) => {\n const labelWidth = props.labelWidth === 'auto' ? 'auto' : `${props.labelWidth || 120}px`;\n const style = { '--v-label-value-layout-Width': labelWidth, ...props.style } as CSSProperties;\n const className = classNames('v-label-value-layout', props.className);\n\n const options = useMemo(() => {\n const dataList = props.options.filter((item) => !item.hidden);\n return dataList.map((item) => {\n return { key: getUuid(), ...item };\n });\n }, [props.options]);\n\n return (\n <Descriptions\n column={props.column || 1}\n bordered={props.bordered}\n size=\"small\"\n className={className}\n style={style}\n >\n {options.map((item) => {\n return (\n <Descriptions.Item key={item.key} label={item.label} span={item.span}>\n {item.value}\n </Descriptions.Item>\n );\n })}\n </Descriptions>\n );\n};\n"],"names":["LabelValueLayout","props","labelWidth","style","_extends","className","_classNames","options","useMemo","dataList","filter","item","hidden","map","key","getUuid","_jsx","Descriptions","column","bordered","size","children","Item","label","span","value"],"mappings":";gRA0BaA,EAAmB,SAAnBA,EAAoBC,GAC/B,IAAMC,EAAaD,EAAMC,aAAe,OAAS,QAAYD,EAAMC,YAAc,KAAO,KACxF,IAAMC,EAAKC,EAAA,CAAK,+BAAgCF,GAAeD,EAAME,OACrE,IAAME,EAAYC,EAAW,uBAAwBL,EAAMI,WAE3D,IAAME,EAAUC,GAAQ,WACtB,IAAMC,EAAWR,EAAMM,QAAQG,QAAO,SAACC,GAAI,OAAMA,EAAKC,UACtD,OAAOH,EAASI,KAAI,SAACF,GACnB,OAAAP,EAAA,CAASU,IAAKC,KAAcJ,EAC9B,GACF,GAAG,CAACV,EAAMM,UAEV,OACES,EAACC,EAAY,CACXC,OAAQjB,EAAMiB,QAAU,EACxBC,SAAUlB,EAAMkB,SAChBC,KAAK,QACLf,UAAWA,EACXF,MAAOA,EAAMkB,SAEZd,EAAQM,KAAI,SAACF,GACZ,OACEK,EAACC,EAAaK,KAAI,CAAgBC,MAAOZ,EAAKY,MAAOC,KAAMb,EAAKa,KAAKH,SAClEV,EAAKc,OADgBd,EAAKG,SAOvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/local-loading/context.ts","@flatbiz/antd/src/local-loading/local-loading.tsx","@flatbiz/antd/src/local-loading/index.ts"],"sourcesContent":["import { TPlainObject } from '@flatbiz/utils';\nimport { createCtx } from '@wove/react';\n\nexport const [useLocalLoadingCtx, LocalLoadingCtxProvider] = createCtx<{\n onRequest: (params?: TPlainObject) => void;\n}>();\n","import { isDeepEqual } from '@dimjs/lang';\nimport { classNames } from '@dimjs/utils';\nimport { TAny, toArray, TPlainObject } from '@flatbiz/utils';\nimport { Button, Result, Spin } from 'antd';\nimport {\n CSSProperties,\n forwardRef,\n ReactElement,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { dynamicNode } from '../dynamic-node';\nimport { fbaHooks } from '../fba-hooks';\nimport { LocalLoadingCtxProvider } from './context';\nimport './style.less';\n\nexport type LocalLoadingServiceConfig = {\n onRequest: (params?: TAny) => Promise<TPlainObject>;\n params?: TPlainObject;\n /** 标记serviceConfig.params中无效参数,被设置的params key 不传入服务接口入参 */\n invalidParamKey?: string[];\n};\n\nexport interface LocalLoadingProps {\n /** 接口数据配置 */\n serviceConfig: LocalLoadingServiceConfig;\n /** children 为函数,参数【respData】为接口返回数据 */\n children: (respData?: TAny) => ReactElement;\n /**\n * 是否异步,默认:false\n * ```\n * true(异步):onRequest、react dom渲染同步执行\n * false(同步):onRequest有结果了才渲染 react dom\n * ```\n */\n isAsync?: boolean;\n /** 自定义异常渲染处理 */\n errorRender?: (error?: TAny) => ReactElement;\n /** loading高度,默认值:100;isAsync = true 无效 */\n loadingHeight?: number | string;\n className?: string;\n style?: CSSProperties;\n contentStyle?: CSSProperties;\n}\n\nexport type LocalLoadingRefApi = {\n onRefresh: (params?: TPlainObject) => void;\n};\n\n/**\n * 局部加载,包含接口数据处理逻辑\n * ```\n * 包括\n * 1. loading显示效果\n * 2. error显示效果\n * 3. 获取服务数据\n * 4. 当 serviceConfig.params 值与上一次值不相等时,会主动发起服务调用\n * ```\n * @param props\n * @returns\n */\nexport const LocalLoadingInner = forwardRef<LocalLoadingRefApi, LocalLoadingProps>((props, ref) => {\n const { serviceConfig, isAsync, children, errorRender } = props;\n const [status, setStatus] = useState<'success' | 'error' | 'init'>('init');\n const [respData, setRespData] = useState<TAny>();\n const loadingHeight = props.loadingHeight === undefined ? 100 : props.loadingHeight;\n const rootRef = useRef<HTMLDivElement>(null);\n const loadingKeyRef = useRef<string>();\n const errorRef = useRef<string>();\n\n const prevParams = fbaHooks.usePrevious(serviceConfig.params);\n\n // 用于直接发起接口调用,不能用于比较\n const serviceParams = useMemo(() => {\n if (!serviceConfig.params || toArray(serviceConfig.invalidParamKey).length === 0) {\n return serviceConfig.params;\n }\n const newParams = { ...serviceConfig.params };\n serviceConfig.invalidParamKey?.forEach((key) => {\n newParams[key] = undefined;\n });\n return newParams;\n }, [serviceConfig]);\n\n const openLoading = () => {\n errorRef.current = undefined;\n loadingKeyRef.current = dynamicNode.append({\n content: <Spin spinning={true}></Spin>,\n getContainer: () => {\n return rootRef.current as HTMLElement;\n },\n }).elementId;\n };\n\n const closeLoading = () => {\n dynamicNode.remove(loadingKeyRef.current);\n };\n\n const onInitRequest = async (params?: TPlainObject) => {\n try {\n openLoading();\n const respData = await serviceConfig.onRequest({\n ...serviceParams,\n ...params,\n });\n setStatus('success');\n setRespData(respData);\n } catch (error) {\n console.error(error);\n setStatus('error');\n errorRef.current = error.message;\n } finally {\n closeLoading();\n }\n };\n\n fbaHooks.useEffectCustomAsync(onInitRequest, []);\n\n fbaHooks.useEffectCustom(() => {\n if (prevParams) {\n if (!isDeepEqual(serviceConfig.params, prevParams)) {\n void onInitRequest();\n }\n }\n }, [prevParams, serviceConfig.params]);\n\n useImperativeHandle(ref, () => {\n return { onRefresh: onInitRequest };\n });\n\n if (status === 'error') {\n if (errorRender) {\n return errorRender(respData);\n }\n return (\n <LocalLoadingCtxProvider value={{ onRequest: onInitRequest }}>\n <div className=\"local-loading-error\">\n <div className=\"local-loading-area\" ref={rootRef}></div>\n <Result\n status=\"error\"\n subTitle={errorRef.current || '数据处理异常'}\n extra={[\n <Button\n type=\"primary\"\n ghost\n key=\"console\"\n size=\"small\"\n onClick={() => {\n setStatus('init');\n setTimeout(() => {\n void onInitRequest();\n }, 100);\n }}\n >\n 重新获取\n </Button>,\n ]}\n />\n </div>\n </LocalLoadingCtxProvider>\n );\n }\n\n if (status !== 'success' && !isAsync) {\n return (\n <div\n className=\"fba-local-loading-process\"\n style={{\n height: loadingHeight,\n display: 'flex',\n justifyContent: 'center',\n position: 'relative',\n backgroundColor: '#fff',\n }}\n >\n <div className=\"local-loading-area\" ref={rootRef}></div>\n </div>\n );\n }\n\n return (\n <LocalLoadingCtxProvider value={{ onRequest: onInitRequest }}>\n <div className={classNames('fba-local-loading', props.className)} style={props.style}>\n <div className=\"local-loading-area\" ref={rootRef}></div>\n <div className=\"local-loading-content\" style={props.contentStyle}>\n {children(respData)}\n </div>\n </div>\n </LocalLoadingCtxProvider>\n );\n});\n","import { TPlainObject } from '@flatbiz/utils';\nimport { fbaUtils } from '../fba-utils';\nimport { useLocalLoadingCtx } from './context';\nimport { LocalLoadingInner } from './local-loading';\n\n/**\n * 局部加载,包含接口数据处理逻辑\n * ```\n * 包括\n * 1. loading显示效果\n * 2. error显示效果\n * 3. 获取服务数据\n * 4. 当 serviceConfig.params 值与上一次值不相等时,会主动发起服务调用\n * ```\n */\nexport const LocalLoading = fbaUtils.attachPropertiesToComponent(LocalLoadingInner, {\n useLocalLoading: () => {\n const ctx = useLocalLoadingCtx();\n return {\n onRequest: (params?: TPlainObject) => {\n ctx.onRequest(params);\n },\n };\n },\n});\n"],"names":["_createCtx","_createCtx2","useLocalLoadingCtx","LocalLoadingCtxProvider","LocalLoadingInner","forwardRef","props","ref","serviceConfig","isAsync","children","errorRender","_useState","useState","status","setStatus","_useState2","respData","setRespData","loadingHeight","undefined","rootRef","useRef","loadingKeyRef","errorRef","prevParams","fbaHooks","usePrevious","params","serviceParams","useMemo","_serviceConfig$invali","toArray","invalidParamKey","length","newParams","_extends","forEach","key","openLoading","current","dynamicNode","append","content","_jsx","Spin","spinning","getContainer","elementId","closeLoading","remove","onInitRequest","Promise","$return","$error","$Try_1_Finally","$Try_1_Exit","$Try_1_Value","call","this","$boundEx","bind","_respData","$Try_1_Post","$Try_1_Catch","error","console","message","resolve","onRequest","then","$await_2","useEffectCustomAsync","useEffectCustom","_isDeepEqual","useImperativeHandle","onRefresh","value","_jsxs","className","Result","subTitle","extra","Button","type","ghost","size","onClick","setTimeout","style","height","display","justifyContent","position","backgroundColor","_classNames","contentStyle","LocalLoading","fbaUtils","attachPropertiesToComponent","useLocalLoading","ctx"],"mappings":";oxBAGO,IAAAA,EAAsDC,IAA/CC,EAAkBF,EAAA,GAAEG,EAAuBH,EAAA,GC4DlD,IAAMI,EAAoBC,GAAkD,SAACC,EAAOC,GACzF,IAAQC,EAAkDF,EAAlDE,cAAeC,EAAmCH,EAAnCG,QAASC,EAA0BJ,EAA1BI,SAAUC,EAAgBL,EAAhBK,YAC1C,IAAAC,EAA4BC,EAAuC,QAA5DC,EAAMF,EAAA,GAAEG,EAASH,EAAA,GACxB,IAAAI,EAAgCH,IAAzBI,EAAQD,EAAA,GAAEE,EAAWF,EAAA,GAC5B,IAAMG,EAAgBb,EAAMa,gBAAkBC,UAAY,IAAMd,EAAMa,cACtE,IAAME,EAAUC,EAAuB,MACvC,IAAMC,EAAgBD,IACtB,IAAME,EAAWF,IAEjB,IAAMG,EAAaC,EAASC,YAAYnB,EAAcoB,QAGtD,IAAMC,EAAgBC,GAAQ,WAAM,IAAAC,EAClC,IAAKvB,EAAcoB,QAAUI,EAAQxB,EAAcyB,iBAAiBC,SAAW,EAAG,CAChF,OAAO1B,EAAcoB,MACvB,CACA,IAAMO,EAASC,KAAQ5B,EAAcoB,SACrCG,EAAAvB,EAAcyB,kBAAe,UAAA,EAA7BF,EAA+BM,SAAQ,SAACC,GACtCH,EAAUG,GAAOlB,SACnB,IACA,OAAOe,CACT,GAAG,CAAC3B,IAEJ,IAAM+B,EAAc,SAAdA,IACJf,EAASgB,QAAUpB,UACnBG,EAAciB,QAAUC,EAAYC,OAAO,CACzCC,QAASC,EAACC,EAAI,CAACC,SAAU,OACzBC,aAAc,SAAAA,IACZ,OAAO1B,EAAQmB,OACjB,IACCQ,WAGL,IAAMC,EAAe,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AAC0E,MAAO,CAAER,UAAWlB,GAAgBzC,SAC3DoE,EAAA,MAAA,CAAKC,UAAU,sBAAqBrE,UAClCkC,EAAA,MAAA,CAAKmC,UAAU,qBAAqBxE,IAAKc,IACzCuB,EAACoC,EAAM,CACLlE,OAAO,QACPmE,SAAUzD,EAASgB,SAAW,SAC9B0C,MAAO,CACLtC,EAACuC,EAAM,CACLC,KAAK,UACLC,MAAK,KAELC,KAAK,QACLC,QAAS,SAAAA,IACPxE,EAAU,QACVyE,YAAW,gBACJrC,GACN,GAAE,IACH,EAAAzC,SACH,QARK,kBAgBlB,CAEA,GAAII,IAAW,YAAcL,EAAS,CACpC,OACEmC,EAAA,MAAA,CACEmC,UAAU,4BACVU,MAAO,CACLC,OAAQvE,EACRwE,QAAS,OACTC,eAAgB,SAChBC,SAAU,WACVC,gBAAiB,QACjBpF,SAEFkC,EAAA,MAAA,CAAKmC,UAAU,qBAAqBxE,IAAKc,KAG/C,CAEA,OACEuB,EAACzC,EAAuB,CAAC0E,MAAO,CAAER,UAAWlB,GAAgBzC,SAC3DoE,EAAA,MAAA,CAAKC,UAAWgB,EAAW,oBAAqBzF,EAAMyE,WAAYU,MAAOnF,EAAMmF,MAAM/E,UACnFkC,EAAA,MAAA,CAAKmC,UAAU,qBAAqBxE,IAAKc,IACzCuB,EAAA,MAAA,CAAKmC,UAAU,wBAAwBU,MAAOnF,EAAM0F,aAAatF,SAC9DA,EAASO,SAKpB,ICjLO,IAAMgF,EAAeC,EAASC,4BAA4B/F,EAAmB,CAClFgG,gBAAiB,SAAAA,IACf,IAAMC,EAAMnG,IACZ,MAAO,CACLmE,UAAW,SAAAA,EAACzC,GACVyE,EAAIhC,UAAUzC,EAChB,EAEJ"}
1
+ {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/local-loading/context.ts","@flatbiz/antd/src/local-loading/local-loading.tsx","@flatbiz/antd/src/local-loading/index.ts"],"sourcesContent":["import { TPlainObject } from '@flatbiz/utils';\nimport { createCtx } from '@wove/react';\n\nexport const [useLocalLoadingCtx, LocalLoadingCtxProvider] = createCtx<{\n onRequest: (params?: TPlainObject) => void;\n}>();\n","import { isDeepEqual } from '@dimjs/lang';\nimport { classNames } from '@dimjs/utils';\nimport { TAny, toArray, TPlainObject } from '@flatbiz/utils';\nimport { Button, Result, Spin } from 'antd';\nimport {\n CSSProperties,\n forwardRef,\n ReactElement,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { dynamicNode } from '../dynamic-node';\nimport { fbaHooks } from '../fba-hooks';\nimport { LocalLoadingCtxProvider } from './context';\nimport './style.less';\n\nexport type LocalLoadingServiceConfig = {\n onRequest: (params?: TAny) => Promise<TAny>;\n params?: TPlainObject;\n /** 标记serviceConfig.params中无效参数,被设置的params key 不传入服务接口入参 */\n invalidParamKey?: string[];\n};\n\nexport interface LocalLoadingProps {\n /** 接口数据配置 */\n serviceConfig: LocalLoadingServiceConfig;\n /** children 为函数,参数【respData】为接口返回数据 */\n children: (respData?: TAny) => ReactElement;\n /**\n * 是否异步,默认:false\n * ```\n * true(异步):onRequest、react dom渲染同步执行\n * false(同步):onRequest有结果了才渲染 react dom\n * ```\n */\n isAsync?: boolean;\n /** 自定义异常渲染处理 */\n errorRender?: (error?: TAny) => ReactElement;\n /** loading高度,默认值:100;isAsync = true 无效 */\n loadingHeight?: number | string;\n className?: string;\n style?: CSSProperties;\n contentStyle?: CSSProperties;\n}\n\nexport type LocalLoadingRefApi = {\n onRefresh: (params?: TPlainObject) => void;\n};\n\n/**\n * 局部加载,包含接口数据处理逻辑\n * ```\n * 包括\n * 1. loading显示效果\n * 2. error显示效果\n * 3. 获取服务数据\n * 4. 当 serviceConfig.params 值与上一次值不相等时,会主动发起服务调用\n * ```\n * @param props\n * @returns\n */\nexport const LocalLoadingInner = forwardRef<LocalLoadingRefApi, LocalLoadingProps>((props, ref) => {\n const { serviceConfig, isAsync, children, errorRender } = props;\n const [status, setStatus] = useState<'success' | 'error' | 'init'>('init');\n const [respData, setRespData] = useState<TAny>();\n const loadingHeight = props.loadingHeight === undefined ? 100 : props.loadingHeight;\n const rootRef = useRef<HTMLDivElement>(null);\n const loadingKeyRef = useRef<string>();\n const errorRef = useRef<string>();\n\n const prevParams = fbaHooks.usePrevious(serviceConfig.params);\n\n // 用于直接发起接口调用,不能用于比较\n const serviceParams = useMemo(() => {\n if (!serviceConfig.params || toArray(serviceConfig.invalidParamKey).length === 0) {\n return serviceConfig.params;\n }\n const newParams = { ...serviceConfig.params };\n serviceConfig.invalidParamKey?.forEach((key) => {\n newParams[key] = undefined;\n });\n return newParams;\n }, [serviceConfig]);\n\n const openLoading = () => {\n errorRef.current = undefined;\n loadingKeyRef.current = dynamicNode.append({\n content: <Spin spinning={true}></Spin>,\n getContainer: () => {\n return rootRef.current as HTMLElement;\n },\n }).elementId;\n };\n\n const closeLoading = () => {\n dynamicNode.remove(loadingKeyRef.current);\n };\n\n const onInitRequest = async (params?: TPlainObject) => {\n try {\n openLoading();\n const respData = await serviceConfig.onRequest({\n ...serviceParams,\n ...params,\n });\n setStatus('success');\n setRespData(respData);\n } catch (error) {\n console.error(error);\n setStatus('error');\n errorRef.current = error.message;\n } finally {\n closeLoading();\n }\n };\n\n fbaHooks.useEffectCustomAsync(onInitRequest, []);\n\n fbaHooks.useEffectCustom(() => {\n if (prevParams) {\n if (!isDeepEqual(serviceConfig.params, prevParams)) {\n void onInitRequest();\n }\n }\n }, [prevParams, serviceConfig.params]);\n\n useImperativeHandle(ref, () => {\n return { onRefresh: onInitRequest };\n });\n\n if (status === 'error') {\n if (errorRender) {\n return errorRender(respData);\n }\n return (\n <LocalLoadingCtxProvider value={{ onRequest: onInitRequest }}>\n <div className=\"local-loading-error\">\n <div className=\"local-loading-area\" ref={rootRef}></div>\n <Result\n status=\"error\"\n subTitle={errorRef.current || '数据处理异常'}\n extra={[\n <Button\n type=\"primary\"\n ghost\n key=\"console\"\n size=\"small\"\n onClick={() => {\n setStatus('init');\n setTimeout(() => {\n void onInitRequest();\n }, 100);\n }}\n >\n 重新获取\n </Button>,\n ]}\n />\n </div>\n </LocalLoadingCtxProvider>\n );\n }\n\n if (status !== 'success' && !isAsync) {\n return (\n <div\n className=\"fba-local-loading-process\"\n style={{\n height: loadingHeight,\n display: 'flex',\n justifyContent: 'center',\n position: 'relative',\n backgroundColor: '#fff',\n }}\n >\n <div className=\"local-loading-area\" ref={rootRef}></div>\n </div>\n );\n }\n\n return (\n <LocalLoadingCtxProvider value={{ onRequest: onInitRequest }}>\n <div className={classNames('fba-local-loading', props.className)} style={props.style}>\n <div className=\"local-loading-area\" ref={rootRef}></div>\n <div className=\"local-loading-content\" style={props.contentStyle}>\n {children(respData)}\n </div>\n </div>\n </LocalLoadingCtxProvider>\n );\n});\n","import { TPlainObject } from '@flatbiz/utils';\nimport { fbaUtils } from '../fba-utils';\nimport { useLocalLoadingCtx } from './context';\nimport { LocalLoadingInner } from './local-loading';\n\n/**\n * 局部加载,包含接口数据处理逻辑\n * ```\n * 包括\n * 1. loading显示效果\n * 2. error显示效果\n * 3. 获取服务数据\n * 4. 当 serviceConfig.params 值与上一次值不相等时,会主动发起服务调用\n * ```\n */\nexport const LocalLoading = fbaUtils.attachPropertiesToComponent(LocalLoadingInner, {\n useLocalLoading: () => {\n const ctx = useLocalLoadingCtx();\n return {\n onRequest: (params?: TPlainObject) => {\n ctx.onRequest(params);\n },\n };\n },\n});\n"],"names":["_createCtx","_createCtx2","useLocalLoadingCtx","LocalLoadingCtxProvider","LocalLoadingInner","forwardRef","props","ref","serviceConfig","isAsync","children","errorRender","_useState","useState","status","setStatus","_useState2","respData","setRespData","loadingHeight","undefined","rootRef","useRef","loadingKeyRef","errorRef","prevParams","fbaHooks","usePrevious","params","serviceParams","useMemo","_serviceConfig$invali","toArray","invalidParamKey","length","newParams","_extends","forEach","key","openLoading","current","dynamicNode","append","content","_jsx","Spin","spinning","getContainer","elementId","closeLoading","remove","onInitRequest","Promise","$return","$error","$Try_1_Finally","$Try_1_Exit","$Try_1_Value","call","this","$boundEx","bind","_respData","$Try_1_Post","$Try_1_Catch","error","console","message","resolve","onRequest","then","$await_2","useEffectCustomAsync","useEffectCustom","_isDeepEqual","useImperativeHandle","onRefresh","value","_jsxs","className","Result","subTitle","extra","Button","type","ghost","size","onClick","setTimeout","style","height","display","justifyContent","position","backgroundColor","_classNames","contentStyle","LocalLoading","fbaUtils","attachPropertiesToComponent","useLocalLoading","ctx"],"mappings":";oxBAGO,IAAAA,EAAsDC,IAA/CC,EAAkBF,EAAA,GAAEG,EAAuBH,EAAA,GC4DlD,IAAMI,EAAoBC,GAAkD,SAACC,EAAOC,GACzF,IAAQC,EAAkDF,EAAlDE,cAAeC,EAAmCH,EAAnCG,QAASC,EAA0BJ,EAA1BI,SAAUC,EAAgBL,EAAhBK,YAC1C,IAAAC,EAA4BC,EAAuC,QAA5DC,EAAMF,EAAA,GAAEG,EAASH,EAAA,GACxB,IAAAI,EAAgCH,IAAzBI,EAAQD,EAAA,GAAEE,EAAWF,EAAA,GAC5B,IAAMG,EAAgBb,EAAMa,gBAAkBC,UAAY,IAAMd,EAAMa,cACtE,IAAME,EAAUC,EAAuB,MACvC,IAAMC,EAAgBD,IACtB,IAAME,EAAWF,IAEjB,IAAMG,EAAaC,EAASC,YAAYnB,EAAcoB,QAGtD,IAAMC,EAAgBC,GAAQ,WAAM,IAAAC,EAClC,IAAKvB,EAAcoB,QAAUI,EAAQxB,EAAcyB,iBAAiBC,SAAW,EAAG,CAChF,OAAO1B,EAAcoB,MACvB,CACA,IAAMO,EAASC,KAAQ5B,EAAcoB,SACrCG,EAAAvB,EAAcyB,kBAAe,UAAA,EAA7BF,EAA+BM,SAAQ,SAACC,GACtCH,EAAUG,GAAOlB,SACnB,IACA,OAAOe,CACT,GAAG,CAAC3B,IAEJ,IAAM+B,EAAc,SAAdA,IACJf,EAASgB,QAAUpB,UACnBG,EAAciB,QAAUC,EAAYC,OAAO,CACzCC,QAASC,EAACC,EAAI,CAACC,SAAU,OACzBC,aAAc,SAAAA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Aa,CACf,OAAOA,EAAYM,EACrB,CACA,OACE2B,EAACzC,EAAuB,CAAC0E,MAAO,CAAER,UAAWlB,GAAgBzC,SAC3DoE,EAAA,MAAA,CAAKC,UAAU,sBAAqBrE,UAClCkC,EAAA,MAAA,CAAKmC,UAAU,qBAAqBxE,IAAKc,IACzCuB,EAACoC,EAAM,CACLlE,OAAO,QACPmE,SAAUzD,EAASgB,SAAW,SAC9B0C,MAAO,CACLtC,EAACuC,EAAM,CACLC,KAAK,UACLC,MAAK,KAELC,KAAK,QACLC,QAAS,SAAAA,IACPxE,EAAU,QACVyE,YAAW,gBACJrC,GACN,GAAE,IACH,EAAAzC,SACH,QARK,kBAgBlB,CAEA,GAAII,IAAW,YAAcL,EAAS,CACpC,OACEmC,EAAA,MAAA,CACEmC,UAAU,4BACVU,MAAO,CACLC,OAAQvE,EACRwE,QAAS,OACTC,eAAgB,SAChBC,SAAU,WACVC,gBAAiB,QACjBpF,SAEFkC,EAAA,MAAA,CAAKmC,UAAU,qBAAqBxE,IAAKc,KAG/C,CAEA,OACEuB,EAACzC,EAAuB,CAAC0E,MAAO,CAAER,UAAWlB,GAAgBzC,SAC3DoE,EAAA,MAAA,CAAKC,UAAWgB,EAAW,oBAAqBzF,EAAMyE,WAAYU,MAAOnF,EAAMmF,MAAM/E,UACnFkC,EAAA,MAAA,CAAKmC,UAAU,qBAAqBxE,IAAKc,IACzCuB,EAAA,MAAA,CAAKmC,UAAU,wBAAwBU,MAAOnF,EAAM0F,aAAatF,SAC9DA,EAASO,SAKpB,ICjLO,IAAMgF,EAAeC,EAASC,4BAA4B/F,EAAmB,CAClFgG,gBAAiB,SAAAA,IACf,IAAMC,EAAMnG,IACZ,MAAO,CACLmE,UAAW,SAAAA,EAACzC,GACVyE,EAAIhC,UAAUzC,EAChB,EAEJ"}
@@ -1 +1 @@
1
- .form-item-label-70.ant-form-item .ant-form-item-label{width:70px!important}.form-item-label-80.ant-form-item .ant-form-item-label{width:80px!important}.form-item-label-90.ant-form-item .ant-form-item-label{width:90px!important}.form-item-label-100.ant-form-item .ant-form-item-label{width:100px!important}.form-item-label-110.ant-form-item .ant-form-item-label{width:110px!important}.form-item-label-120.ant-form-item .ant-form-item-label{width:120px!important}.form-item-label-130.ant-form-item .ant-form-item-label{width:130px!important}.form-item-label-140.ant-form-item .ant-form-item-label{width:140px!important}.form-item-label-150.ant-form-item .ant-form-item-label{width:150px!important}.form-item-label-160.ant-form-item .ant-form-item-label{width:160px!important}.form-item-label-170.ant-form-item .ant-form-item-label{width:170px!important}.form-item-label-180.ant-form-item .ant-form-item-label{width:180px!important}.form-item-label-190.ant-form-item .ant-form-item-label{width:190px!important}.form-item-label-200.ant-form-item .ant-form-item-label{width:200px!important}.form-item-label-auto.ant-form-item .ant-form-item-label{width:auto!important}.form-item-label-align-left .ant-form-item-label{text-align:left}.form-item-label-align-right .ant-form-item-label{text-align:right}.ant-form-item.form-item-label-value-vertical>.ant-form-item-row{flex-direction:column}.ant-form-item.form-item-label-value-vertical>.ant-form-item-row>.ant-form-item-label{text-align:left;width:100%!important}.ant-form-item.form-item-label-value-vertical>.ant-form-item-row>.ant-form-item-control{flex:initial}.form-label-70 .ant-form-item-label{width:70px!important}.form-label-80 .ant-form-item-label{width:80px!important}.form-label-90 .ant-form-item-label{width:90px!important}.form-label-100 .ant-form-item-label{width:100px!important}.form-label-110 .ant-form-item-label{width:110px!important}.form-label-120 .ant-form-item-label{width:120px!important}.form-label-130 .ant-form-item-label{width:130px!important}.form-label-140 .ant-form-item-label{width:140px!important}.form-label-150 .ant-form-item-label{width:150px!important}.form-label-160 .ant-form-item-label{width:160px!important}.form-label-170 .ant-form-item-label{width:170px!important}.form-label-180 .ant-form-item-label{width:180px!important}.form-label-190 .ant-form-item-label{width:190px!important}.form-label-200 .ant-form-item-label{width:200px!important}.form-label-auto .ant-form-item-label{width:auto!important}.form-label-align-left .ant-form-item-label{text-align:left}.form-label-align-right .ant-form-item-label{text-align:right}.form-label-value-vertical .ant-form-item .ant-form-item-row{flex-direction:column}.form-label-value-vertical .ant-form-item .ant-form-item-label{text-align:left;width:100%}.form-label-value-vertical .ant-form-item .ant-form-item-control{flex:initial}.form-formitem-gap-15{margin-bottom:-15px}.form-formitem-gap-15 .ant-form-item{margin:0 0 15px}.form-formitem-gap-8{margin-bottom:-8px}.form-formitem-gap-8 .ant-form-item{margin:0 0 8px}.form-formitem-gap-5{margin-bottom:-5px}.form-formitem-gap-5 .ant-form-item{margin:0 0 5px}.form-formitem-gap-0{margin-bottom:0}.form-formitem-gap-0 .ant-form-item{margin:0}
1
+ .form-item-label-70.ant-form-item .ant-form-item-label{width:70px!important}.form-item-label-80.ant-form-item .ant-form-item-label{width:80px!important}.form-item-label-90.ant-form-item .ant-form-item-label{width:90px!important}.form-item-label-100.ant-form-item .ant-form-item-label{width:100px!important}.form-item-label-110.ant-form-item .ant-form-item-label{width:110px!important}.form-item-label-120.ant-form-item .ant-form-item-label{width:120px!important}.form-item-label-130.ant-form-item .ant-form-item-label{width:130px!important}.form-item-label-140.ant-form-item .ant-form-item-label{width:140px!important}.form-item-label-150.ant-form-item .ant-form-item-label{width:150px!important}.form-item-label-160.ant-form-item .ant-form-item-label{width:160px!important}.form-item-label-170.ant-form-item .ant-form-item-label{width:170px!important}.form-item-label-180.ant-form-item .ant-form-item-label{width:180px!important}.form-item-label-190.ant-form-item .ant-form-item-label{width:190px!important}.form-item-label-200.ant-form-item .ant-form-item-label{width:200px!important}.form-item-label-auto.ant-form-item .ant-form-item-label{width:auto!important}.form-item-label-align-left .ant-form-item-label{text-align:left}.form-item-label-align-right .ant-form-item-label{text-align:right}.ant-form-item.form-item-label-value-vertical>.ant-form-item-row{flex-direction:column}.ant-form-item.form-item-label-value-vertical>.ant-form-item-row>.ant-form-item-label{text-align:left;width:100%!important}.ant-form-item.form-item-label-value-vertical>.ant-form-item-row>.ant-form-item-control{flex:initial}.form-label-70 .ant-form-item-label{width:70px!important}.form-label-80 .ant-form-item-label{width:80px!important}.form-label-90 .ant-form-item-label{width:90px!important}.form-label-100 .ant-form-item-label{width:100px!important}.form-label-110 .ant-form-item-label{width:110px!important}.form-label-120 .ant-form-item-label{width:120px!important}.form-label-130 .ant-form-item-label{width:130px!important}.form-label-140 .ant-form-item-label{width:140px!important}.form-label-150 .ant-form-item-label{width:150px!important}.form-label-160 .ant-form-item-label{width:160px!important}.form-label-170 .ant-form-item-label{width:170px!important}.form-label-180 .ant-form-item-label{width:180px!important}.form-label-190 .ant-form-item-label{width:190px!important}.form-label-200 .ant-form-item-label{width:200px!important}.form-label-auto .ant-form-item-label{width:auto!important}.form-label-align-left .ant-form-item-label{text-align:left}.form-label-align-right .ant-form-item-label{text-align:right}.form-label-value-vertical .ant-form-item .ant-form-item-row{flex-direction:column}.form-label-value-vertical .ant-form-item .ant-form-item-label{text-align:left;width:100%}.form-label-value-vertical .ant-form-item .ant-form-item-control{flex:initial}.form-formitem-gap-15{margin-bottom:-15px}.form-formitem-gap-15 .ant-form-item{margin-bottom:15px}.form-formitem-gap-8{margin-bottom:-8px}.form-formitem-gap-8 .ant-form-item{margin-bottom:8px}.form-formitem-gap-5{margin-bottom:-5px}.form-formitem-gap-5 .ant-form-item{margin-bottom:5px}.form-formitem-gap-0,.form-formitem-gap-0 .ant-form-item{margin-bottom:0}
@@ -3,5 +3,5 @@ import './../request-status/index.css';
3
3
  import './../fba-hooks/index.css';
4
4
  import './index.css';
5
5
  /*! @flatjs/forge MIT @flatbiz/antd */
6
- import e from"@ant-design/icons/es/icons/RedoOutlined";import{isString as r}from"@dimjs/lang/cjs/is-string";import{hooks as n}from"@wove/react/cjs/hooks";import{a as t,_ as o}from"../_rollupPluginBabelHelpers-fc015ef2.js";import{isUndefinedOrNull as u,toArray as s,valueIsEqual as i,arrayFind as a}from"@flatbiz/utils";import{Select as l,Button as c}from"antd";import{useState as f,useMemo as v,useRef as d}from"react";import{RequestStatus as h}from"../request-status/index.js";import{isDeepEqual as m}from"@dimjs/lang/cjs/is-deep-equal";import{isArray as p}from"@dimjs/lang/cjs/is-array";import{get as g}from"@dimjs/utils/cjs/get";import{json as C}from"@dimjs/utils/cjs/json";import q from"pubsub-js";import{fbaHooks as w}from"../fba-hooks/index.js";import{isObject as _}from"@dimjs/lang/cjs/is-object";import{jsx as b,jsxs as y}from"react/jsx-runtime";import"@dimjs/utils/cjs/extend";import"../use-responsive-point-21b8c601.js";var j=function e(r){var n=r.cacheKey,t=r.serviceConfig,o=r.hasOuterSelectorList,s=r.outerSelectorList,i=r.onRespDataChange,a=r.onSelectorRequestError,l=r.onChange,c=r.useCache,d=r.fieldNames;var h=t==null?void 0:t.params;var _=(t==null?void 0:t.requiredParamsKeys)||[];var b=h&&Object.keys(h).length>0;var y=f(),j=y[0],R=y[1];var S=f(),L=S[0],P=S[1];var O=f(Date.now()),A=O[0],k=O[1];var x=v((function(){try{if(b){var e=JSON.stringify(C.sort(h));if(e==="{}"){return undefined}return e}}catch(e){}return undefined}),[b,h]);var E=""+x;var N=x+"_status";var D=n+"_"+E;var I=w.usePrevious(x);var K=w.usePrevious(h);var M=function e(r){if(t!=null&&t.onRequestResultAdapter){return t==null?void 0:t.onRequestResultAdapter(r)}if(d!=null&&d.list){var n=g(r,d==null?void 0:d.list);return p(n)?n:[]}return r};var B=function e(){var r;return(r=window["__selector_wrapper_"])==null?void 0:r[n]};var T=function e(){var r;return(r=B())==null?void 0:r[E]};var V=function e(){var r;return(r=B())==null?void 0:r[N]};var z=function e(r,t){if(!window["__selector_wrapper_"]){window["__selector_wrapper_"]={}}if(!window["__selector_wrapper_"][n]){window["__selector_wrapper_"][n]={}}window["__selector_wrapper_"][n][r]=t};var F=function e(r){z(N,r);P(r)};var H=function e(){return new Promise((function(e,r){var n,o;var u=function(n){try{console.error(n);F("request-error");R(undefined);setTimeout((function(){q.publish(D,{status:"request-error"})}));a==null?void 0:a(n);return e(Promise.reject())}catch(e){return r(e)}};try{F("request-progress");return Promise.resolve(t==null||t.onRequest==null?void 0:t.onRequest(h||{})).then((function(r){try{n=r;o=M(n)||[];z(E,o);F("request-success");setTimeout((function(){q.publish(D,{status:"request-success",respData:o})}));return e(o)}catch(e){return u(e)}}),u)}catch(e){u(e)}}))};w.useEffectCustomAsync((function(){return new Promise((function(e,r){var n,f,v,d,p,g;if(o){P("request-success");R(s);i==null?void 0:i(s);return e()}if(_.length>0){n=h?_.find((function(e){return u(h[e])})):true;if(n){R([]);P("no-dependencies-params");if(I){l==null?void 0:l(undefined)}return e()}if(c===false){if(m(h,K)){return e()}var C=function(){try{return e()}catch(e){return r(e)}};var w=function(e){try{console.error(e);P("request-error");R(undefined);a==null?void 0:a(e);return C()}catch(e){return r(e)}};try{P("request-progress");return Promise.resolve(t==null||t.onRequest==null?void 0:t.onRequest(h||{})).then((function(e){try{f=e;v=M(f)||[];P("request-success");R(v);i==null?void 0:i(v);return C()}catch(e){return w(e)}}),w)}catch(e){w(e)}}return b.call(this)}function b(){d=V();if(d==="request-success"){p=T();R(p);P(d);i==null?void 0:i(p);return e()}if(d==="request-progress"){P(d);q.subscribe(D,(function(e,r){var n=r.status,t=r.respData;if(n==="request-success"){P(n);R(t);i==null?void 0:i(t)}else{P("request-error");R(undefined)}}));return e()}var n=function(){try{return e()}catch(e){return r(e)}};var t=function(e){try{console.error(e);P("request-error");R(undefined);a==null?void 0:a(e);return n()}catch(e){return r(e)}};try{return Promise.resolve(H()).then((function(e){try{g=e;R(g);P("request-success");i==null?void 0:i(g);return n()}catch(e){return t(e)}}),t)}catch(e){t(e)}}return b.call(this)}))}),[h,s,A]);var J=function e(){k(Date.now())};return{requestStatus:L,stateSelectorList:j,serviceRequestParamsStringify:x,onRefreshRequest:J}};var R=function e(r,n){var t=s(r);t=t.map((function(e){if(_(e))return e[n];return e}));return t};var S=["serviceConfig","showAllOption","onSelectorListChange","onSelectorListAllChange","onSelectorRequestError","onLabelRenderAdapter","requestMessageConfig","selectorList","modelKey","fieldNames","value","labelInValue","useCache"];var L=function u(f){var m=f.serviceConfig,p=f.showAllOption,g=f.onSelectorListChange,C=f.onSelectorListAllChange,q=f.onSelectorRequestError,w=f.onLabelRenderAdapter,_=f.requestMessageConfig,L=f.selectorList,P=f.modelKey,O=f.fieldNames,A=f.value,k=f.labelInValue,x=f.useCache,E=t(f,S);var N=d(true);var D=f.hasOwnProperty("selectorList");var I=o({label:"label",value:"value",disabled:"disabled"},O);var K=I.label,M=I.value,B=I.disabled;var T=v((function(){var e;if(!p)return null;var r=p===true;return e={},e[K]=r?"全部":p.label,e[M]=r?"":p.value,e}),[K,M,p]);var V=i(f.mode,["multiple"]);var z=j({fieldNames:I,cacheKey:P,hasOuterSelectorList:D,onChange:f.onChange,serviceConfig:m,outerSelectorList:L,onRespDataChange:function e(r){if(N.current){g==null?void 0:g(r||[]);N.current=false}C==null?void 0:C(r||[])},onSelectorRequestError:q,useCache:x===undefined?true:x}),F=z.requestStatus,H=z.stateSelectorList,J=z.onRefreshRequest;var W=n.useCallbackRef((function(e){if(k){if(V){f.onChange==null?void 0:f.onChange(e,e)}else{f.onChange==null?void 0:f.onChange(e[0],e)}}else{var r=e.map((function(e){return e[M]}));if(V){f.onChange==null?void 0:f.onChange(r,e)}else{f.onChange==null?void 0:f.onChange(r[0],e[0])}}}));var G=n.useCallbackRef((function(e,r){if(!r)return f.onChange==null?void 0:f.onChange(undefined);var n=s(r);var t=[];n.forEach((function(e){if(p&&T&&e.value===T[M]){t.push(T)}else{var r=a(H||[],e.value,M);if(r){t.push(r)}}}));W(t)}));var Q=v((function(){if(F!=="request-success")return[];if(!H||H.length===0)return[];if(!T)return H;return[T].concat(H)}),[T,F,H]);var U=F==="request-progress";var X=v((function(){var e=R(A,M);return V?e:e[0]}),[V,M,A]);var Y=n.useCallbackRef((function(e,n){var t=s(n.children);var o="";t.forEach((function(e){if(r(e))o+=e}));return o.toLowerCase().indexOf(e.toLowerCase())>=0}));return b(l,o({showSearch:true,allowClear:true,dropdownMatchSelectWidth:false,filterOption:Y},E,{style:o({width:"100%"},f.style),value:X,loading:U,onChange:G,fieldNames:undefined,suffixIcon:F==="request-error"?b(e,{spin:U,onClick:J}):E.suffixIcon,notFoundContent:b(h,{status:F,loading:U,messageConfig:o({"request-init":"暂无数据"},_),errorButton:b(c,{type:"primary",onClick:J,children:"重新获取数据"})}),children:Q.map((function(e,r){var n=e[M];var t=e[K];return y(l.Option,{value:n,label:t,disabled:e[B],children:[f.showIcon?b("span",{className:"v-selector-item-icon",children:f.icon==null?void 0:f.icon(e,r)}):null,w?w(e):t]},n+"-"+r)}))}))};export{L as SelectorWrapper};
6
+ import e from"@ant-design/icons/es/icons/RedoOutlined";import{isString as r}from"@dimjs/lang/cjs/is-string";import{hooks as n}from"@wove/react/cjs/hooks";import{a as t,_ as o}from"../_rollupPluginBabelHelpers-fc015ef2.js";import{isUndefinedOrNull as u,toArray as s,valueIsEqual as i,arrayFind as a}from"@flatbiz/utils";import{Select as l,Button as c}from"antd";import{useState as f,useMemo as v,useRef as d}from"react";import{RequestStatus as h}from"../request-status/index.js";import{isDeepEqual as p}from"@dimjs/lang/cjs/is-deep-equal";import{isArray as m}from"@dimjs/lang/cjs/is-array";import{get as g}from"@dimjs/utils/cjs/get";import{json as C}from"@dimjs/utils/cjs/json";import q from"pubsub-js";import{fbaHooks as w}from"../fba-hooks/index.js";import{isObject as y}from"@dimjs/lang/cjs/is-object";import{jsx as _,jsxs as b}from"react/jsx-runtime";import"@dimjs/utils/cjs/extend";import"../use-responsive-point-21b8c601.js";var j=function e(r){var n=r.cacheKey,t=r.serviceConfig,o=r.hasOuterSelectorList,s=r.outerSelectorList,i=r.onRespDataChange,a=r.onSelectorRequestError,l=r.onChange,c=r.useCache,d=r.fieldNames;var h=t==null?void 0:t.params;var y=(t==null?void 0:t.requiredParamsKeys)||[];var _=h&&Object.keys(h).length>0;var b=f(),j=b[0],R=b[1];var S=f(),L=S[0],O=S[1];var P=f(Date.now()),A=P[0],k=P[1];var x=v((function(){try{if(_){var e=JSON.stringify(C.sort(h));if(e==="{}"){return undefined}return e}}catch(e){}return undefined}),[_,h]);var N=""+x;var E=x+"_status";var D=n+"_"+N;var I=w.usePrevious(x);var K=w.usePrevious(h);var M=function e(r){if(t!=null&&t.onRequestResultAdapter){return t==null?void 0:t.onRequestResultAdapter(r)}if(d!=null&&d.list){var n=g(r,d==null?void 0:d.list);return m(n)?n:[]}return r};var B=function e(){var r;return(r=window["__selector_wrapper_"])==null?void 0:r[n]};var J=function e(){var r;return(r=B())==null?void 0:r[N]};var T=function e(){var r;return(r=B())==null?void 0:r[E]};var V=function e(r,t){if(!window["__selector_wrapper_"]){window["__selector_wrapper_"]={}}if(!window["__selector_wrapper_"][n]){window["__selector_wrapper_"][n]={}}window["__selector_wrapper_"][n][r]=t};var z=function e(r){V(E,r);O(r)};var F=function e(){return new Promise((function(e,r){var n,o;var u=function(n){try{console.error(n);z("request-error");R(undefined);setTimeout((function(){q.publish(D,{status:"request-error"})}));a==null?void 0:a(n);return e(Promise.reject())}catch(e){return r(e)}};try{z("request-progress");return Promise.resolve(t==null||t.onRequest==null?void 0:t.onRequest(h||{})).then((function(r){try{n=r;o=M(n)||[];V(N,o);z("request-success");setTimeout((function(){q.publish(D,{status:"request-success",respData:o})}));return e(o)}catch(e){return u(e)}}),u)}catch(e){u(e)}}))};w.useEffectCustomAsync((function(){return new Promise((function(e,r){var n,f,v,d,m,g;if(o){O("request-success");R(s);i==null?void 0:i(s);return e()}if(y.length>0){n=h?y.find((function(e){return u(h[e])})):true;if(n){R([]);O("no-dependencies-params");if(I){l==null?void 0:l(undefined)}return e()}if(c===false){if(p(h,K)){return e()}var C=function(){try{return e()}catch(e){return r(e)}};var w=function(e){try{console.error(e);O("request-error");R(undefined);a==null?void 0:a(e);return C()}catch(e){return r(e)}};try{O("request-progress");return Promise.resolve(t==null||t.onRequest==null?void 0:t.onRequest(h||{})).then((function(e){try{f=e;v=M(f)||[];O("request-success");R(v);i==null?void 0:i(v);return C()}catch(e){return w(e)}}),w)}catch(e){w(e)}}return _.call(this)}function _(){d=T();if(d==="request-success"){m=J();R(m);O(d);i==null?void 0:i(m);return e()}if(d==="request-progress"){O(d);q.subscribe(D,(function(e,r){var n=r.status,t=r.respData;if(n==="request-success"){O(n);R(t);i==null?void 0:i(t)}else{O("request-error");R(undefined)}}));return e()}var n=function(){try{return e()}catch(e){return r(e)}};var t=function(e){try{console.error(e);O("request-error");R(undefined);a==null?void 0:a(e);return n()}catch(e){return r(e)}};try{return Promise.resolve(F()).then((function(e){try{g=e;R(g);O("request-success");i==null?void 0:i(g);return n()}catch(e){return t(e)}}),t)}catch(e){t(e)}}return _.call(this)}))}),[JSON.stringify(h),s,A]);var H=function e(){k(Date.now())};return{requestStatus:L,stateSelectorList:j,serviceRequestParamsStringify:x,onRefreshRequest:H}};var R=function e(r,n){var t=s(r);t=t.map((function(e){if(y(e))return e[n];return e}));return t};var S=["serviceConfig","showAllOption","onSelectorListChange","onSelectorListAllChange","onSelectorRequestError","onLabelRenderAdapter","requestMessageConfig","selectorList","modelKey","fieldNames","value","labelInValue","useCache"];var L=function u(f){var p=f.serviceConfig,m=f.showAllOption,g=f.onSelectorListChange,C=f.onSelectorListAllChange,q=f.onSelectorRequestError,w=f.onLabelRenderAdapter,y=f.requestMessageConfig,L=f.selectorList,O=f.modelKey,P=f.fieldNames,A=f.value,k=f.labelInValue,x=f.useCache,N=t(f,S);var E=d(true);var D=f.hasOwnProperty("selectorList");var I=o({label:"label",value:"value",disabled:"disabled"},P);var K=I.label,M=I.value,B=I.disabled;var J=v((function(){var e;if(!m)return null;var r=m===true;return e={},e[K]=r?"全部":m.label,e[M]=r?"":m.value,e}),[K,M,m]);var T=i(f.mode,["multiple"]);var V=j({fieldNames:I,cacheKey:O,hasOuterSelectorList:D,onChange:f.onChange,serviceConfig:p,outerSelectorList:L,onRespDataChange:function e(r){if(E.current){g==null?void 0:g(r||[]);E.current=false}C==null?void 0:C(r||[])},onSelectorRequestError:q,useCache:x===undefined?true:x}),z=V.requestStatus,F=V.stateSelectorList,H=V.onRefreshRequest;var W=n.useCallbackRef((function(e){if(k){if(T){f.onChange==null?void 0:f.onChange(e,e)}else{f.onChange==null?void 0:f.onChange(e[0],e)}}else{var r=e.map((function(e){return e[M]}));if(T){f.onChange==null?void 0:f.onChange(r,e)}else{f.onChange==null?void 0:f.onChange(r[0],e[0])}}}));var G=n.useCallbackRef((function(e,r){if(!r)return f.onChange==null?void 0:f.onChange(undefined);var n=s(r);var t=[];n.forEach((function(e){if(m&&J&&e.value===J[M]){t.push(J)}else{var r=a(F||[],e.value,M);if(r){t.push(r)}}}));W(t)}));var Q=v((function(){if(z!=="request-success")return[];if(!F||F.length===0)return[];if(!J)return F;return[J].concat(F)}),[J,z,F]);var U=z==="request-progress";var X=v((function(){var e=R(A,M);return T?e:e[0]}),[T,M,A]);var Y=n.useCallbackRef((function(e,n){var t=s(n.children);var o="";t.forEach((function(e){if(r(e))o+=e}));return o.toLowerCase().indexOf(e.toLowerCase())>=0}));return _(l,o({showSearch:true,allowClear:true,popupMatchSelectWidth:false,filterOption:Y},N,{style:o({width:"100%"},f.style),value:X,loading:U,onChange:G,fieldNames:undefined,suffixIcon:z==="request-error"?_(e,{spin:U,onClick:H}):N.suffixIcon,notFoundContent:_(h,{status:z,loading:U,messageConfig:o({"request-init":"暂无数据"},y),errorButton:_(c,{type:"primary",onClick:H,children:"重新获取数据"})}),children:Q.map((function(e,r){var n=e[M];var t=e[K];return b(l.Option,{value:n,label:t,disabled:e[B],children:[f.showIcon?_("span",{className:"v-selector-item-icon",children:f.icon==null?void 0:f.icon(e,r)}):null,w?w(e):t]},n+"-"+r)}))}))};export{L as SelectorWrapper};
7
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/selector-wrapper/use-request.ts","@flatbiz/antd/src/selector-wrapper/utils.ts","@flatbiz/antd/src/selector-wrapper/selector-wrapper.tsx"],"sourcesContent":["import { isArray, isDeepEqual } from '@dimjs/lang';\nimport { get, json } from '@dimjs/utils';\nimport { isUndefinedOrNull, TPlainObject } from '@flatbiz/utils';\nimport pubSub from 'pubsub-js';\nimport { useMemo, useState } from 'react';\nimport { fbaHooks } from '../fba-hooks';\nimport { TRequestStatus } from '../request-status';\nimport { SelectorServiceConfig, SelectorWrapperProps } from './types';\n\nexport const useRequest = (options: {\n cacheKey: string;\n serviceConfig?: SelectorServiceConfig;\n hasOuterSelectorList?: boolean;\n onChange?: SelectorWrapperProps['onChange'];\n outerSelectorList?: SelectorWrapperProps['selectorList'];\n onRespDataChange?: (dataList?: TPlainObject[]) => void;\n onSelectorRequestError?: SelectorWrapperProps['onSelectorRequestError'];\n useCache: boolean;\n fieldNames: SelectorWrapperProps['fieldNames'];\n}) => {\n const {\n cacheKey,\n serviceConfig,\n hasOuterSelectorList,\n outerSelectorList,\n onRespDataChange,\n onSelectorRequestError,\n onChange,\n useCache,\n fieldNames,\n } = options;\n const serviceRequestParams = serviceConfig?.params;\n const requiredParamsKeys = serviceConfig?.requiredParamsKeys || [];\n const hasServiceRequestParams = serviceRequestParams && Object.keys(serviceRequestParams).length > 0;\n\n const [stateSelectorList, setStateSelectorList] = useState<TPlainObject[]>();\n const [requestStatus, setRequestStatus] = useState<TRequestStatus>();\n const [refreshKey, setRefreshKey] = useState(Date.now());\n\n const serviceRequestParamsStringify = useMemo(() => {\n try {\n if (hasServiceRequestParams) {\n const sortDataStringify = JSON.stringify(json.sort(serviceRequestParams));\n if (sortDataStringify === '{}') {\n return undefined;\n }\n return sortDataStringify;\n }\n } catch (error) {}\n return undefined;\n }, [hasServiceRequestParams, serviceRequestParams]);\n // 将 undefined => 'undefined'\n const serviceRequestCahceKey = `${serviceRequestParamsStringify}`;\n const serviceRequestCahceStatusKey = `${serviceRequestParamsStringify}_status`;\n const pubSubKey = `${cacheKey}_${serviceRequestCahceKey}`;\n\n // 上一个参数值\n const prevServiceRequestParamsStringify = fbaHooks.usePrevious(serviceRequestParamsStringify);\n const prevParams = fbaHooks.usePrevious(serviceRequestParams);\n\n const serviceRespDataAdapter = (respData) => {\n if (serviceConfig?.onRequestResultAdapter) {\n return serviceConfig?.onRequestResultAdapter(respData as unknown as TPlainObject);\n }\n if (fieldNames?.list) {\n const result = get(respData, fieldNames?.list);\n return isArray(result) ? result : [];\n }\n return respData;\n };\n\n const getWindowCacheData = () => {\n return window['__selector_wrapper_']?.[cacheKey];\n };\n const getWindowCacheValue = () => {\n return getWindowCacheData()?.[serviceRequestCahceKey];\n };\n const getWindowCacheStatus = () => {\n return getWindowCacheData()?.[serviceRequestCahceStatusKey];\n };\n\n const setWindowCache = (key, value) => {\n if (!window['__selector_wrapper_']) {\n window['__selector_wrapper_'] = {};\n }\n if (!window['__selector_wrapper_'][cacheKey]) {\n window['__selector_wrapper_'][cacheKey] = {};\n }\n window['__selector_wrapper_'][cacheKey][key] = value;\n };\n\n const onChangeRequestStatus = (status: TRequestStatus) => {\n setWindowCache(serviceRequestCahceStatusKey, status);\n setRequestStatus(status);\n };\n\n const onRequest = async () => {\n try {\n onChangeRequestStatus('request-progress');\n\n const respData = await serviceConfig?.onRequest?.(serviceRequestParams || {});\n const respAdapterData = serviceRespDataAdapter(respData) || [];\n\n setWindowCache(serviceRequestCahceKey, respAdapterData);\n onChangeRequestStatus('request-success');\n setTimeout(() => {\n pubSub.publish(pubSubKey, {\n status: 'request-success',\n respData: respAdapterData,\n });\n });\n\n return respAdapterData;\n } catch (error) {\n console.error(error);\n onChangeRequestStatus('request-error');\n setStateSelectorList(undefined);\n setTimeout(() => {\n pubSub.publish(pubSubKey, {\n status: 'request-error',\n });\n });\n onSelectorRequestError?.(error);\n return Promise.reject();\n }\n };\n\n fbaHooks.useEffectCustomAsync(async () => {\n if (hasOuterSelectorList) {\n setRequestStatus('request-success');\n setStateSelectorList(outerSelectorList);\n onRespDataChange?.(outerSelectorList);\n return;\n }\n if (requiredParamsKeys.length > 0) {\n const isEmpty = serviceRequestParams\n ? requiredParamsKeys.find((key) => isUndefinedOrNull(serviceRequestParams[key]))\n : true;\n if (isEmpty) {\n // 当依赖项查询条件为空时,清空当前缓存数据\n setStateSelectorList([]);\n setRequestStatus('no-dependencies-params');\n /**\n * 怎么判断数据是从有到无的\n * 每一次 params 变少,只要 上一次 params 值存在,就应该清空 value 值\n */\n if (prevServiceRequestParamsStringify) {\n onChange?.(undefined);\n }\n return;\n }\n\n // 不使用缓存模式\n if (useCache === false) {\n // 判断参数是否发生变化\n if (isDeepEqual(serviceRequestParams, prevParams)) {\n return;\n }\n try {\n setRequestStatus('request-progress');\n const respData = await serviceConfig?.onRequest?.(serviceRequestParams || {});\n const respAdapterData = serviceRespDataAdapter(respData) || [];\n setRequestStatus('request-success');\n setStateSelectorList(respAdapterData);\n onRespDataChange?.(respAdapterData);\n } catch (error) {\n console.error(error);\n setRequestStatus('request-error');\n setStateSelectorList(undefined);\n onSelectorRequestError?.(error);\n }\n return;\n }\n }\n\n /**\n * 此处无法判断 调用props.onChange?.(undefined);\n * A、B、C\n * 例如:C依赖A、B,当外部只修改了一个元素,理论上应该应该清空C value 值(调用onChange(undefined)),如果此时外部直接回填A、B、C时,C无法回填成功;该场景只能在A、B的onChange事件中,清空C\n */\n // if (prevServiceRequestParamsStringify) {\n // props.onChange?.(undefined);\n // }\n\n const status = getWindowCacheStatus();\n if (status === 'request-success') {\n const dataList = getWindowCacheValue();\n setStateSelectorList(dataList);\n setRequestStatus(status);\n onRespDataChange?.(dataList);\n return;\n }\n if (status === 'request-progress') {\n setRequestStatus(status);\n pubSub.subscribe(pubSubKey, (_msg, { status, respData }) => {\n if (status === 'request-success') {\n setRequestStatus(status);\n setStateSelectorList(respData);\n onRespDataChange?.(respData);\n } else {\n setRequestStatus('request-error');\n setStateSelectorList(undefined);\n }\n });\n return;\n }\n try {\n const respAdapterData = await onRequest();\n setStateSelectorList(respAdapterData);\n setRequestStatus('request-success');\n onRespDataChange?.(respAdapterData);\n } catch (error) {\n console.error(error);\n setRequestStatus('request-error');\n setStateSelectorList(undefined);\n onSelectorRequestError?.(error);\n }\n }, [serviceRequestParams, outerSelectorList, refreshKey]);\n\n const onRefreshRequest = () => {\n setRefreshKey(Date.now());\n };\n\n return {\n requestStatus,\n stateSelectorList,\n serviceRequestParamsStringify,\n onRefreshRequest,\n };\n};\n","import { isObject } from '@dimjs/lang';\nimport { toArray } from '@flatbiz/utils';\n\n/**\n * value存在两种格式\n * 1. string | number;\n * 2. labelInValue 格式\n * @param data\n * @param labelInValueFieldNames\n * @returns\n */\nexport const getVauleList = (data, valueKey: string | number) => {\n let valueList = toArray<string | number>(data);\n valueList = valueList.map((item) => {\n if (isObject(item)) return item[valueKey];\n return item;\n });\n return valueList;\n};\n","import { arrayFind, TAny, toArray, TPlainObject, valueIsEqual } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { Button, Select } from 'antd';\nimport { useMemo, useRef } from 'react';\nimport './style.less';\n\nimport { RedoOutlined } from '@ant-design/icons';\nimport { isString } from '@dimjs/lang';\nimport { RequestStatus } from '../request-status';\nimport { SelectorWrapperProps } from './types';\nimport { useRequest } from './use-request';\nimport { getVauleList } from './utils';\nexport * from './types';\n/**\n * 选择器包装组件\n * ```\n * 1. 不支持搜索 + 调用服务模式\n * ```\n */\nexport const SelectorWrapper = (props: SelectorWrapperProps) => {\n const {\n serviceConfig,\n showAllOption,\n onSelectorListChange,\n onSelectorListAllChange,\n onSelectorRequestError,\n onLabelRenderAdapter,\n requestMessageConfig,\n selectorList: outerSelectorList,\n modelKey,\n fieldNames,\n value,\n labelInValue,\n useCache,\n ...otherProps\n } = props;\n\n const firstRenderSelectList = useRef(true);\n\n // props 是否存在 selectorList,selectorList = undefined 也算存在\n const hasOuterSelectorList = props.hasOwnProperty('selectorList');\n const mergeFieldNames = { label: 'label', value: 'value', disabled: 'disabled', ...fieldNames };\n\n const {\n label: optionsItemLabelField,\n value: optionsItemValueField,\n disabled: optionsItemDisabledField,\n } = mergeFieldNames;\n\n const allOptionConfig = useMemo(() => {\n if (!showAllOption) return null;\n const isTrue = showAllOption === true;\n return {\n [optionsItemLabelField]: isTrue ? '全部' : showAllOption.label,\n [optionsItemValueField]: isTrue ? '' : showAllOption.value,\n };\n }, [optionsItemLabelField, optionsItemValueField, showAllOption]);\n\n const isMultiple = valueIsEqual(props.mode, ['multiple']);\n\n const { requestStatus, stateSelectorList, onRefreshRequest } = useRequest({\n fieldNames: mergeFieldNames,\n cacheKey: modelKey,\n hasOuterSelectorList,\n onChange: props.onChange,\n serviceConfig,\n outerSelectorList,\n onRespDataChange: (dataList) => {\n if (firstRenderSelectList.current) {\n onSelectorListChange?.(dataList || []);\n firstRenderSelectList.current = false;\n }\n onSelectorListAllChange?.(dataList || []);\n },\n onSelectorRequestError,\n useCache: useCache === undefined ? true : useCache,\n });\n\n const onRespChange = hooks.useCallbackRef((selectedList: TPlainObject[]) => {\n if (labelInValue) {\n if (isMultiple) {\n props.onChange?.(selectedList, selectedList);\n } else {\n props.onChange?.(selectedList[0], selectedList);\n }\n } else {\n const valueList = selectedList.map((item) => item[optionsItemValueField]);\n if (isMultiple) {\n props.onChange?.(valueList, selectedList);\n } else {\n props.onChange?.(valueList[0], selectedList[0]);\n }\n }\n });\n\n const onInnerChange = hooks.useCallbackRef((_value, otherParams) => {\n if (!otherParams) return props.onChange?.(undefined);\n const selectedList = toArray<TAny>(otherParams);\n const targetList = [] as TPlainObject[];\n selectedList.forEach((item) => {\n if (showAllOption && allOptionConfig && item.value === allOptionConfig[optionsItemValueField]) {\n targetList.push(allOptionConfig);\n } else {\n const filterTarget = arrayFind(stateSelectorList || [], item.value, optionsItemValueField);\n if (filterTarget) {\n targetList.push(filterTarget);\n }\n }\n });\n onRespChange(targetList);\n });\n\n const selectorAllList = useMemo(() => {\n if (requestStatus !== 'request-success') return [];\n if (!stateSelectorList || stateSelectorList.length === 0) return [];\n if (!allOptionConfig) return stateSelectorList;\n return [allOptionConfig].concat(stateSelectorList);\n }, [allOptionConfig, requestStatus, stateSelectorList]);\n\n const loading = requestStatus === 'request-progress';\n\n const selectValue = useMemo(() => {\n const targetList = getVauleList(value, optionsItemValueField);\n return isMultiple ? targetList : targetList[0];\n }, [isMultiple, optionsItemValueField, value]);\n\n const filterOption = hooks.useCallbackRef((input: string, option) => {\n const children = toArray(option.children);\n let mergeString = '';\n children.forEach((item) => {\n if (isString(item)) mergeString += item;\n });\n return mergeString.toLowerCase().indexOf(input.toLowerCase()) >= 0;\n });\n\n return (\n <Select\n showSearch={true}\n allowClear={true}\n dropdownMatchSelectWidth={false}\n filterOption={filterOption}\n {...otherProps}\n style={{ width: '100%', ...props.style }}\n value={selectValue}\n loading={loading}\n onChange={onInnerChange}\n fieldNames={undefined}\n suffixIcon={\n requestStatus === 'request-error' ? (\n <RedoOutlined spin={loading} onClick={onRefreshRequest} />\n ) : (\n otherProps.suffixIcon\n )\n }\n notFoundContent={\n <RequestStatus\n status={requestStatus}\n loading={loading}\n messageConfig={{\n 'request-init': '暂无数据',\n ...requestMessageConfig,\n }}\n errorButton={\n <Button type=\"primary\" onClick={onRefreshRequest}>\n 重新获取数据\n </Button>\n }\n />\n }\n >\n {selectorAllList.map((item, index) => {\n const value = item[optionsItemValueField];\n const label = item[optionsItemLabelField];\n return (\n <Select.Option\n value={value}\n label={label}\n key={`${value}-${index}`}\n disabled={item[optionsItemDisabledField]}\n >\n {props.showIcon ? (\n <span className=\"v-selector-item-icon\">{props.icon?.(item, index)}</span>\n ) : null}\n {onLabelRenderAdapter ? onLabelRenderAdapter(item) : label}\n </Select.Option>\n );\n })}\n </Select>\n );\n};\n"],"names":["useRequest","options","cacheKey","serviceConfig","hasOuterSelectorList","outerSelectorList","onRespDataChange","onSelectorRequestError","onChange","useCache","fieldNames","serviceRequestParams","params","requiredParamsKeys","hasServiceRequestParams","Object","keys","length","_useState","useState","stateSelectorList","setStateSelectorList","_useState2","requestStatus","setRequestStatus","_useState3","Date","now","refreshKey","setRefreshKey","serviceRequestParamsStringify","useMemo","sortDataStringify","JSON","stringify","_json","sort","undefined","error","serviceRequestCahceKey","serviceRequestCahceStatusKey","pubSubKey","prevServiceRequestParamsStringify","fbaHooks","usePrevious","prevParams","serviceRespDataAdapter","respData","onRequestResultAdapter","list","result","_get","_isArray","getWindowCacheData","_window$__selector_wr","window","getWindowCacheValue","_getWindowCacheData","getWindowCacheStatus","_getWindowCacheData2","setWindowCache","key","value","onChangeRequestStatus","status","onRequest","Promise","$return","$error","respAdapterData","$Try_2_Catch","console","setTimeout","pubSub","publish","reject","$boundEx","resolve","then","$await_7","useEffectCustomAsync","isEmpty","_dataList","_respAdapterData","find","isUndefinedOrNull","_isDeepEqual","$Try_3_Post","$Try_3_Catch","$await_8","$If_5","call","this","dataList","subscribe","_msg","_ref","$Try_4_Post","$Try_4_Catch","$await_9","onRefreshRequest","getVauleList","data","valueKey","valueList","toArray","map","item","_isObject","SelectorWrapper","props","showAllOption","onSelectorListChange","onSelectorListAllChange","onLabelRenderAdapter","requestMessageConfig","selectorList","modelKey","labelInValue","otherProps","_objectWithoutPropertiesLoose","_excluded","firstRenderSelectList","useRef","hasOwnProperty","mergeFieldNames","_extends","label","disabled","optionsItemLabelField","optionsItemValueField","optionsItemDisabledField","allOptionConfig","isTrue","isMultiple","valueIsEqual","mode","_useRequest","current","onRespChange","_hooks","useCallbackRef","selectedList","onInnerChange","_value","otherParams","targetList","forEach","push","filterTarget","arrayFind","selectorAllList","concat","loading","selectValue","filterOption","input","option","children","mergeString","_isString","toLowerCase","indexOf","_jsx","Select","showSearch","allowClear","dropdownMatchSelectWidth","style","width","suffixIcon","_RedoOutlined","spin","onClick","notFoundContent","RequestStatus","messageConfig","errorButton","Button","type","index","_jsxs","Option","showIcon","className","icon"],"mappings":";k6BASO,IAAMA,EAAa,SAAbA,EAAcC,GAWzB,IACEC,EASED,EATFC,SACAC,EAQEF,EARFE,cACAC,EAOEH,EAPFG,qBACAC,EAMEJ,EANFI,kBACAC,EAKEL,EALFK,iBACAC,EAIEN,EAJFM,uBACAC,EAGEP,EAHFO,SACAC,EAEER,EAFFQ,SACAC,EACET,EADFS,WAEF,IAAMC,EAAuBR,GAAAA,UAAAA,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yE,GAC1B,IAAMtH,EAAQ6C,EAAKuB,GACnB,IAAMH,EAAQpB,EAAKsB,GACnB,OACEoD,EAACjB,EAAOkB,OAAM,CACZxH,MAAOA,EACPiE,MAAOA,EAEPC,SAAUrB,EAAKwB,GAA0B2B,SAExChD,CAAAA,EAAMyE,SACLpB,EAAA,OAAA,CAAMqB,UAAU,uBAAsB1B,SAAEhD,EAAM2E,MAAI,UAAA,EAAV3E,EAAM2E,KAAO9E,EAAMyE,KACzD,KACHlE,EAAuBA,EAAqBP,GAAQoB,IAN7CjE,EAASsH,IAAAA,QAY7B"}
1
+ {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/selector-wrapper/use-request.ts","@flatbiz/antd/src/selector-wrapper/utils.ts","@flatbiz/antd/src/selector-wrapper/selector-wrapper.tsx"],"sourcesContent":["import { isArray, isDeepEqual } from '@dimjs/lang';\nimport { get, json } from '@dimjs/utils';\nimport { isUndefinedOrNull, TPlainObject } from '@flatbiz/utils';\nimport pubSub from 'pubsub-js';\nimport { useMemo, useState } from 'react';\nimport { fbaHooks } from '../fba-hooks';\nimport { TRequestStatus } from '../request-status';\nimport { SelectorServiceConfig, SelectorWrapperProps } from './types';\n\nexport const useRequest = (options: {\n cacheKey: string;\n serviceConfig?: SelectorServiceConfig;\n hasOuterSelectorList?: boolean;\n onChange?: SelectorWrapperProps['onChange'];\n outerSelectorList?: SelectorWrapperProps['selectorList'];\n onRespDataChange?: (dataList?: TPlainObject[]) => void;\n onSelectorRequestError?: SelectorWrapperProps['onSelectorRequestError'];\n useCache: boolean;\n fieldNames: SelectorWrapperProps['fieldNames'];\n}) => {\n const {\n cacheKey,\n serviceConfig,\n hasOuterSelectorList,\n outerSelectorList,\n onRespDataChange,\n onSelectorRequestError,\n onChange,\n useCache,\n fieldNames,\n } = options;\n const serviceRequestParams = serviceConfig?.params;\n const requiredParamsKeys = serviceConfig?.requiredParamsKeys || [];\n const hasServiceRequestParams = serviceRequestParams && Object.keys(serviceRequestParams).length > 0;\n\n const [stateSelectorList, setStateSelectorList] = useState<TPlainObject[]>();\n const [requestStatus, setRequestStatus] = useState<TRequestStatus>();\n const [refreshKey, setRefreshKey] = useState(Date.now());\n\n const serviceRequestParamsStringify = useMemo(() => {\n try {\n if (hasServiceRequestParams) {\n const sortDataStringify = JSON.stringify(json.sort(serviceRequestParams));\n if (sortDataStringify === '{}') {\n return undefined;\n }\n return sortDataStringify;\n }\n } catch (error) {}\n return undefined;\n }, [hasServiceRequestParams, serviceRequestParams]);\n // 将 undefined => 'undefined'\n const serviceRequestCahceKey = `${serviceRequestParamsStringify}`;\n const serviceRequestCahceStatusKey = `${serviceRequestParamsStringify}_status`;\n const pubSubKey = `${cacheKey}_${serviceRequestCahceKey}`;\n\n // 上一个参数值\n const prevServiceRequestParamsStringify = fbaHooks.usePrevious(serviceRequestParamsStringify);\n const prevParams = fbaHooks.usePrevious(serviceRequestParams);\n\n const serviceRespDataAdapter = (respData) => {\n if (serviceConfig?.onRequestResultAdapter) {\n return serviceConfig?.onRequestResultAdapter(respData as unknown as TPlainObject);\n }\n if (fieldNames?.list) {\n const result = get(respData, fieldNames?.list);\n return isArray(result) ? result : [];\n }\n return respData;\n };\n\n const getWindowCacheData = () => {\n return window['__selector_wrapper_']?.[cacheKey];\n };\n const getWindowCacheValue = () => {\n return getWindowCacheData()?.[serviceRequestCahceKey];\n };\n const getWindowCacheStatus = () => {\n return getWindowCacheData()?.[serviceRequestCahceStatusKey];\n };\n\n const setWindowCache = (key, value) => {\n if (!window['__selector_wrapper_']) {\n window['__selector_wrapper_'] = {};\n }\n if (!window['__selector_wrapper_'][cacheKey]) {\n window['__selector_wrapper_'][cacheKey] = {};\n }\n window['__selector_wrapper_'][cacheKey][key] = value;\n };\n\n const onChangeRequestStatus = (status: TRequestStatus) => {\n setWindowCache(serviceRequestCahceStatusKey, status);\n setRequestStatus(status);\n };\n\n const onRequest = async () => {\n try {\n onChangeRequestStatus('request-progress');\n\n const respData = await serviceConfig?.onRequest?.(serviceRequestParams || {});\n const respAdapterData = serviceRespDataAdapter(respData) || [];\n\n setWindowCache(serviceRequestCahceKey, respAdapterData);\n onChangeRequestStatus('request-success');\n setTimeout(() => {\n pubSub.publish(pubSubKey, {\n status: 'request-success',\n respData: respAdapterData,\n });\n });\n\n return respAdapterData;\n } catch (error) {\n console.error(error);\n onChangeRequestStatus('request-error');\n setStateSelectorList(undefined);\n setTimeout(() => {\n pubSub.publish(pubSubKey, {\n status: 'request-error',\n });\n });\n onSelectorRequestError?.(error);\n return Promise.reject();\n }\n };\n\n fbaHooks.useEffectCustomAsync(async () => {\n if (hasOuterSelectorList) {\n setRequestStatus('request-success');\n setStateSelectorList(outerSelectorList);\n onRespDataChange?.(outerSelectorList);\n return;\n }\n if (requiredParamsKeys.length > 0) {\n const isEmpty = serviceRequestParams\n ? requiredParamsKeys.find((key) => isUndefinedOrNull(serviceRequestParams[key]))\n : true;\n if (isEmpty) {\n // 当依赖项查询条件为空时,清空当前缓存数据\n setStateSelectorList([]);\n setRequestStatus('no-dependencies-params');\n /**\n * 怎么判断数据是从有到无的\n * 每一次 params 变少,只要 上一次 params 值存在,就应该清空 value 值\n */\n if (prevServiceRequestParamsStringify) {\n onChange?.(undefined);\n }\n return;\n }\n\n // 不使用缓存模式\n if (useCache === false) {\n // 判断参数是否发生变化\n if (isDeepEqual(serviceRequestParams, prevParams)) {\n return;\n }\n try {\n setRequestStatus('request-progress');\n const respData = await serviceConfig?.onRequest?.(serviceRequestParams || {});\n const respAdapterData = serviceRespDataAdapter(respData) || [];\n setRequestStatus('request-success');\n setStateSelectorList(respAdapterData);\n onRespDataChange?.(respAdapterData);\n } catch (error) {\n console.error(error);\n setRequestStatus('request-error');\n setStateSelectorList(undefined);\n onSelectorRequestError?.(error);\n }\n return;\n }\n }\n\n /**\n * 此处无法判断 调用props.onChange?.(undefined);\n * A、B、C\n * 例如:C依赖A、B,当外部只修改了一个元素,理论上应该应该清空C value 值(调用onChange(undefined)),如果此时外部直接回填A、B、C时,C无法回填成功;该场景只能在A、B的onChange事件中,清空C\n */\n // if (prevServiceRequestParamsStringify) {\n // props.onChange?.(undefined);\n // }\n\n const status = getWindowCacheStatus();\n if (status === 'request-success') {\n const dataList = getWindowCacheValue();\n setStateSelectorList(dataList);\n setRequestStatus(status);\n onRespDataChange?.(dataList);\n return;\n }\n if (status === 'request-progress') {\n setRequestStatus(status);\n pubSub.subscribe(pubSubKey, (_msg, { status, respData }) => {\n if (status === 'request-success') {\n setRequestStatus(status);\n setStateSelectorList(respData);\n onRespDataChange?.(respData);\n } else {\n setRequestStatus('request-error');\n setStateSelectorList(undefined);\n }\n });\n return;\n }\n try {\n const respAdapterData = await onRequest();\n setStateSelectorList(respAdapterData);\n setRequestStatus('request-success');\n onRespDataChange?.(respAdapterData);\n } catch (error) {\n console.error(error);\n setRequestStatus('request-error');\n setStateSelectorList(undefined);\n onSelectorRequestError?.(error);\n }\n }, [JSON.stringify(serviceRequestParams), outerSelectorList, refreshKey]);\n\n const onRefreshRequest = () => {\n setRefreshKey(Date.now());\n };\n\n return {\n requestStatus,\n stateSelectorList,\n serviceRequestParamsStringify,\n onRefreshRequest,\n };\n};\n","import { isObject } from '@dimjs/lang';\nimport { toArray } from '@flatbiz/utils';\n\n/**\n * value存在两种格式\n * 1. string | number;\n * 2. labelInValue 格式\n * @param data\n * @param labelInValueFieldNames\n * @returns\n */\nexport const getVauleList = (data, valueKey: string | number) => {\n let valueList = toArray<string | number>(data);\n valueList = valueList.map((item) => {\n if (isObject(item)) return item[valueKey];\n return item;\n });\n return valueList;\n};\n","import { arrayFind, TAny, toArray, TPlainObject, valueIsEqual } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { Button, Select } from 'antd';\nimport { useMemo, useRef } from 'react';\nimport './style.less';\n\nimport { RedoOutlined } from '@ant-design/icons';\nimport { isString } from '@dimjs/lang';\nimport { RequestStatus } from '../request-status';\nimport { SelectorWrapperProps } from './types';\nimport { useRequest } from './use-request';\nimport { getVauleList } from './utils';\nexport * from './types';\n/**\n * 选择器包装组件\n * ```\n * 1. 不支持搜索 + 调用服务模式\n * ```\n */\nexport const SelectorWrapper = (props: SelectorWrapperProps) => {\n const {\n serviceConfig,\n showAllOption,\n onSelectorListChange,\n onSelectorListAllChange,\n onSelectorRequestError,\n onLabelRenderAdapter,\n requestMessageConfig,\n selectorList: outerSelectorList,\n modelKey,\n fieldNames,\n value,\n labelInValue,\n useCache,\n ...otherProps\n } = props;\n\n const firstRenderSelectList = useRef(true);\n\n // props 是否存在 selectorList,selectorList = undefined 也算存在\n const hasOuterSelectorList = props.hasOwnProperty('selectorList');\n const mergeFieldNames = {\n label: 'label',\n value: 'value',\n disabled: 'disabled',\n ...fieldNames,\n };\n\n const {\n label: optionsItemLabelField,\n value: optionsItemValueField,\n disabled: optionsItemDisabledField,\n } = mergeFieldNames;\n\n const allOptionConfig = useMemo(() => {\n if (!showAllOption) return null;\n const isTrue = showAllOption === true;\n return {\n [optionsItemLabelField]: isTrue ? '全部' : showAllOption.label,\n [optionsItemValueField]: isTrue ? '' : showAllOption.value,\n };\n }, [optionsItemLabelField, optionsItemValueField, showAllOption]);\n\n const isMultiple = valueIsEqual(props.mode, ['multiple']);\n\n const { requestStatus, stateSelectorList, onRefreshRequest } = useRequest({\n fieldNames: mergeFieldNames,\n cacheKey: modelKey,\n hasOuterSelectorList,\n onChange: props.onChange,\n serviceConfig,\n outerSelectorList,\n onRespDataChange: (dataList) => {\n if (firstRenderSelectList.current) {\n onSelectorListChange?.(dataList || []);\n firstRenderSelectList.current = false;\n }\n onSelectorListAllChange?.(dataList || []);\n },\n onSelectorRequestError,\n useCache: useCache === undefined ? true : useCache,\n });\n\n const onRespChange = hooks.useCallbackRef((selectedList: TPlainObject[]) => {\n if (labelInValue) {\n if (isMultiple) {\n props.onChange?.(selectedList, selectedList);\n } else {\n props.onChange?.(selectedList[0], selectedList);\n }\n } else {\n const valueList = selectedList.map((item) => item[optionsItemValueField]);\n if (isMultiple) {\n props.onChange?.(valueList, selectedList);\n } else {\n props.onChange?.(valueList[0], selectedList[0]);\n }\n }\n });\n\n const onInnerChange = hooks.useCallbackRef((_value, otherParams) => {\n if (!otherParams) return props.onChange?.(undefined);\n const selectedList = toArray<TAny>(otherParams);\n const targetList = [] as TPlainObject[];\n selectedList.forEach((item) => {\n if (showAllOption && allOptionConfig && item.value === allOptionConfig[optionsItemValueField]) {\n targetList.push(allOptionConfig);\n } else {\n const filterTarget = arrayFind(stateSelectorList || [], item.value, optionsItemValueField);\n if (filterTarget) {\n targetList.push(filterTarget);\n }\n }\n });\n onRespChange(targetList);\n });\n\n const selectorAllList = useMemo(() => {\n if (requestStatus !== 'request-success') return [];\n if (!stateSelectorList || stateSelectorList.length === 0) return [];\n if (!allOptionConfig) return stateSelectorList;\n return [allOptionConfig].concat(stateSelectorList);\n }, [allOptionConfig, requestStatus, stateSelectorList]);\n\n const loading = requestStatus === 'request-progress';\n\n const selectValue = useMemo(() => {\n const targetList = getVauleList(value, optionsItemValueField);\n return isMultiple ? targetList : targetList[0];\n }, [isMultiple, optionsItemValueField, value]);\n\n const filterOption = hooks.useCallbackRef((input: string, option) => {\n const children = toArray(option.children);\n let mergeString = '';\n children.forEach((item) => {\n if (isString(item)) mergeString += item;\n });\n return mergeString.toLowerCase().indexOf(input.toLowerCase()) >= 0;\n });\n\n return (\n <Select\n showSearch={true}\n allowClear={true}\n popupMatchSelectWidth={false}\n filterOption={filterOption}\n {...otherProps}\n style={{ width: '100%', ...props.style }}\n value={selectValue}\n loading={loading}\n onChange={onInnerChange}\n fieldNames={undefined}\n suffixIcon={\n requestStatus === 'request-error' ? (\n <RedoOutlined spin={loading} onClick={onRefreshRequest} />\n ) : (\n otherProps.suffixIcon\n )\n }\n notFoundContent={\n <RequestStatus\n status={requestStatus}\n loading={loading}\n messageConfig={{\n 'request-init': '暂无数据',\n ...requestMessageConfig,\n }}\n errorButton={\n <Button type=\"primary\" onClick={onRefreshRequest}>\n 重新获取数据\n </Button>\n }\n />\n }\n >\n {selectorAllList.map((item, index) => {\n const value = item[optionsItemValueField];\n const label = item[optionsItemLabelField];\n return (\n <Select.Option\n value={value}\n label={label}\n key={`${value}-${index}`}\n disabled={item[optionsItemDisabledField]}\n >\n {props.showIcon ? (\n <span className=\"v-selector-item-icon\">{props.icon?.(item, index)}</span>\n ) : null}\n {onLabelRenderAdapter ? onLabelRenderAdapter(item) : label}\n </Select.Option>\n );\n })}\n </Select>\n );\n};\n"],"names":["useRequest","options","cacheKey","serviceConfig","hasOuterSelectorList","outerSelectorList","onRespDataChange","onSelectorRequestError","onChange","useCache","fieldNames","serviceRequestParams","params","requiredParamsKeys","hasServiceRequestParams","Object","keys","length","_useState","useState","stateSelectorList","setStateSelectorList","_useState2","requestStatus","setRequestStatus","_useState3","Date","now","refreshKey","setRefreshKey","serviceRequestParamsStringify","useMemo","sortDataStringify","JSON","stringify","_json","sort","undefined","error","serviceRequestCahceKey","serviceRequestCahceStatusKey","pubSubKey","prevServiceRequestParamsStringify","fbaHooks","usePrevious","prevParams","serviceRespDataAdapter","respData","onRequestResultAdapter","list","result","_get","_isArray","getWindowCacheData","_window$__selector_wr","window","getWindowCacheValue","_getWindowCacheData","getWindowCacheStatus","_getWindowCacheData2","setWindowCache","key","value","onChangeRequestStatus","status","onRequest","Promise","$return","$error","respAdapterData","$Try_2_Catch","console","setTimeout","pubSub","publish","reject","$boundEx","resolve","then","$await_7","useEffectCustomAsync","isEmpty","_dataList","_respAdapterData","find","isUndefinedOrNull","_isDeepEqual","$Try_3_Post","$Try_3_Catch","$await_8","$If_5","call","this","dataList","subscribe","_msg","_ref","$Try_4_Post","$Try_4_Catch","$await_9","onRefreshRequest","getVauleList","data","valueKey","valueList","toArray","map","item","_isObject","SelectorWrapper","props","showAllOption","onSelectorListChange","onSelectorListAllChange","onLabelRenderAdapter","requestMessageConfig","selectorList","modelKey","labelInValue","otherProps","_objectWithoutPropertiesLoose","_excluded","firstRenderSelectList","useRef","hasOwnProperty","mergeFieldNames","_extends","label","disabled","optionsItemLabelField","optionsItemValueField","optionsItemDisabledField","allOptionConfig","isTrue","isMultiple","valueIsEqual","mode","_useRequest","current","onRespChange","_hooks","useCallbackRef","selectedList","onInnerChange","_value","otherParams","targetList","forEach","push","filterTarget","arrayFind","selectorAllList","concat","loading","selectValue","filterOption","input","option","children","mergeString","_isString","toLowerCase","indexOf","_jsx","Select","showSearch","allowClear","popupMatchSelectWidth","style","width","suffixIcon","_RedoOutlined","spin","onClick","notFoundContent","RequestStatus","messageConfig","errorButton","Button","type","index","_jsxs","Option","showIcon","className","icon"],"mappings":";k6BASO,IAAMA,EAAa,SAAbA,EAAcC,GAWzB,IACEC,EASED,EATFC,SACAC,EAQEF,EARFE,cACAC,EAOEH,EAPFG,qBACAC,EAMEJ,EANFI,kBACAC,EAKEL,EALFK,iBACAC,EAIEN,EAJFM,uBACAC,EAGEP,EAHFO,SACAC,EAEER,EAFFQ,SACAC,EACET,EADFS,WAEF,IAAMC,EAAuBR,GAAAA,UAAAA,EAAAA,EAAeS,OAC5C,IAAMC,GAAqBV,eAAAA,EAAeU,qBAAsB,GAChE,IAAMC,EAA0BH,GAAwBI,OAAOC,KAAKL,GAAsBM,OAAS,EAEnG,IAAAC,EAAkDC,IAA3CC,EAAiBF,EAAA,GAAEG,EAAoBH,EAAA,GAC9C,IAAAI,EAA0CH,IAAnCI,EAAaD,EAAA,GAAEE,EAAgBF,EAAA,GACtC,IAAAG,EAAoCN,EAASO,KAAKC,OAA3CC,EAAUH,EAAA,GAAEI,EAAaJ,EAAA,GAEhC,IAAMK,EAAgCC,GAAQ,WAC5C,IACE,GAAIjB,EAAyB,CAC3B,IAAMkB,EAAoBC,KAAKC,UAAUC,EAAKC,KAAKzB,IACnD,GAAIqB,IAAsB,KAAM,CAC9B,OAAOK,SACT,CACA,OAAOL,CACT,CACF,CAAE,MAAOM,GAAQ,CACjB,OAAOD,SACT,GAAG,CAACvB,EAAyBH,IAE7B,IAAM4B,KAA4BT,EAClC,IAAMU,EAAkCV,EAAsC,U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ACxC,GAChB,GAAIqD,EAASrD,GAAOoD,GAAepD,CACrC,IACA,OAAOoD,EAAYE,cAAcC,QAAQN,EAAMK,gBAAkB,CACnE,IAEA,OACEE,EAACC,EAAMtC,EAAA,CACLuC,WAAY,KACZC,WAAY,KACZC,sBAAuB,MACvBZ,aAAcA,GACVpC,EAAU,CACdiD,MAAK1C,EAAA,CAAI2C,MAAO,QAAW3D,EAAM0D,OACjC1G,MAAO4F,EACPD,QAASA,EACTjJ,SAAUuI,EACVrI,WAAY2B,UACZqI,WACEnJ,IAAkB,gBAChB4I,EAAAQ,EAAA,CAAcC,KAAMnB,EAASoB,QAASzE,IAEtCmB,EAAWmD,WAGfI,gBACEX,EAACY,EAAa,CACZ/G,OAAQzC,EACRkI,QAASA,EACTuB,cAAalD,EAAA,CACX,eAAgB,QACbX,GAEL8D,YACEd,EAACe,EAAM,CAACC,KAAK,UAAUN,QAASzE,EAAiB0D,SAAC,aAKvDA,SAEAP,EAAgB7C,KAAI,SAACC,EAAMyE,GAC1B,IAAMtH,EAAQ6C,EAAKuB,GACnB,IAAMH,EAAQpB,EAAKsB,GACnB,OACEoD,EAACjB,EAAOkB,OAAM,CACZxH,MAAOA,EACPiE,MAAOA,EAEPC,SAAUrB,EAAKwB,GAA0B2B,SAExChD,CAAAA,EAAMyE,SACLpB,EAAA,OAAA,CAAMqB,UAAU,uBAAsB1B,SAAEhD,EAAM2E,MAAI,UAAA,EAAV3E,EAAM2E,KAAO9E,EAAMyE,KACzD,KACHlE,EAAuBA,EAAqBP,GAAQoB,IAN7CjE,EAASsH,IAAAA,QAY7B"}
@@ -1 +1 @@
1
- .simple-layout{background-color:#fff;border-radius:6px;padding:15px}.simple-layout>.simple-layout-content>.ant-form{margin-bottom:-15px}.simple-layout>.simple-layout-content>.ant-form .ant-form-item{margin:0 0 15px}.simple-layout>.simple-layout-content>.ant-form .ant-form-item-label{width:82px}.simple-layout>.simple-layout-content>.ant-form .ant-form-item-label.ant-col-auto{width:auto}.simple-layout .ant-table-thead>tr>th{background:#f6f6f6}.simple-layout .ant-descriptions-item{padding-bottom:10px}.simple-layout .ant-descriptions-item-label{color:#999}.simple-layout .ant-table-pagination.ant-pagination{margin:16px 0 0}.simple-layout .simple-layout-content{position:relative}.simple-layout .simple-layout-content>.ant-row:last-child{margin-bottom:0}.simple-layout .simple-layout-content>.ant-row:last-child .ant-upload-list{padding-bottom:15px}.simple-layout .simple-layout-content>.ant-descriptions:not(.ant-descriptions-bordered):last-child{margin-bottom:-10px}.simple-layout .v-tree-wrapper-tree{padding:5px 0 0}.simple-layout-title-sign{padding-left:10px;position:relative}.simple-layout-title-sign:before{background:var(--simple-layout-colorPrimary);border-radius:3px;content:"";height:14px;left:0;margin-top:-7px;position:absolute;top:50%;width:3px}.simple-layout-title{color:rgba(0,0,0,.85);font-size:16px;font-weight:500;overflow:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap}.simple-layout-title+.simple-layout-content,.simple-layout-title-sign+.simple-layout-content{margin-top:10px}.simple-layout-desc{color:rgba(0,0,0,.55);font-size:12px}.simple-layout+.simple-layout,.simple-layout-desc+.simple-layout-content{margin-top:10px}.simple-layout+.ant-divider{margin:0 0 15px}.simple-layout-formlabel-left .ant-form-item-label{text-align:left}.simple-layout-tight.simple-layout{margin-top:0;padding:0}.simple-layout-title-extra-space{justify-content:space-between;width:100%}.simple-layout-title-fixed{display:flex;flex-direction:column;height:100%;overflow:hidden}.simple-layout-title-fixed>.simple-layout-content{flex:1;overflow-y:auto}.simple-layout-small.simple-layout{padding:8px 15px}.simple-layout-small.simple-layout>.simple-layout-content>.ant-form{margin-bottom:-8px}.simple-layout-small.simple-layout>.simple-layout-content>.ant-form .ant-form-item{margin:0 0 8px}
1
+ .simple-layout{background-color:#fff;border-radius:6px;padding:15px}.simple-layout>.simple-layout-content>.ant-form[class^="form-formitem-gap-*"]{margin-bottom:-15px}.simple-layout>.simple-layout-content>.ant-form[class^="form-formitem-gap-*"] .ant-form-item{margin:0 0 15px}.simple-layout>.simple-layout-content>.ant-form[class^="form-formitem-gap-*"] .ant-form-item-label{width:82px}.simple-layout>.simple-layout-content>.ant-form[class^="form-formitem-gap-*"] .ant-form-item-label.ant-col-auto{width:auto}.simple-layout .ant-table-thead>tr>th{background:#f6f6f6}.simple-layout .ant-descriptions-item{padding-bottom:10px}.simple-layout .ant-descriptions-item-label{color:#999}.simple-layout .ant-table-pagination.ant-pagination{margin:16px 0 0}.simple-layout .simple-layout-content{position:relative}.simple-layout .simple-layout-content>.ant-row:last-child{margin-bottom:0}.simple-layout .simple-layout-content>.ant-row:last-child .ant-upload-list{padding-bottom:15px}.simple-layout .simple-layout-content>.ant-descriptions:not(.ant-descriptions-bordered):last-child{margin-bottom:-10px}.simple-layout .v-tree-wrapper-tree{padding:5px 0 0}.simple-layout-title-sign{padding-left:10px;position:relative}.simple-layout-title-sign:before{background:var(--simple-layout-colorPrimary);border-radius:3px;content:"";height:14px;left:0;margin-top:-7px;position:absolute;top:50%;width:3px}.simple-layout-title{color:rgba(0,0,0,.85);font-size:16px;font-weight:500;overflow:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap}.simple-layout-title+.simple-layout-content,.simple-layout-title-sign+.simple-layout-content{margin-top:10px}.simple-layout-desc{color:rgba(0,0,0,.55);font-size:12px}.simple-layout+.simple-layout,.simple-layout-desc+.simple-layout-content{margin-top:10px}.simple-layout+.ant-divider{margin:0 0 15px}.simple-layout-formlabel-left .ant-form-item-label{text-align:left}.simple-layout-tight.simple-layout{margin-top:0;padding:0}.simple-layout-title-extra-space{justify-content:space-between;width:100%}.simple-layout-title-fixed{display:flex;flex-direction:column;height:100%;overflow:hidden}.simple-layout-title-fixed>.simple-layout-content{flex:1;overflow-y:auto}.simple-layout-small.simple-layout{padding:8px 15px}.simple-layout-small.simple-layout>.simple-layout-content>.ant-form[class^="form-formitem-gap-*"]{margin-bottom:-8px}.simple-layout-small.simple-layout>.simple-layout-content>.ant-form[class^="form-formitem-gap-*"] .ant-form-item{margin:0 0 8px}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/simple-layout/simple-layout.tsx"],"sourcesContent":["import { isArray } from '@dimjs/lang';\nimport { classNames, extend } from '@dimjs/utils';\nimport { Space } from 'antd';\nimport { CSSProperties, Fragment, ReactElement, ReactNode } from 'react';\nimport { fbaHooks } from '../fba-hooks';\nimport './style.less';\n\nexport type SimpleLayoutProps = {\n className?: string;\n style?: CSSProperties;\n title?: string | ReactElement;\n desc?: string | ReactElement | string[] | ReactElement[];\n formLabelAlign?: 'left' | 'right';\n /**\n * layoutType 布局类型\n * ```\n * 1. layer:分层布局\n * 2. tight:紧凑布局(没有外边距)\n * ```\n */\n layoutType?: 'layer' | 'tight';\n titleLeftLine?: boolean;\n titleStyle?: CSSProperties;\n contentStyle?: CSSProperties;\n /** 优先级大于 style padding */\n padding?: CSSProperties['padding'];\n /** 优先级大于 style width */\n width?: CSSProperties['width'];\n children?: ReactNode | ReactNode[];\n titleExtra?: string | ReactElement;\n hidden?: boolean;\n titleFixed?: boolean;\n /**\n * 间距尺寸\n * 1. default = 15\n * 2. small = 8\n */\n size?: 'default' | 'small';\n onClick?: (event) => void;\n};\n\n/**\n * 简单布局\n * @param props\n * @returns\n * ```\n * 1. layoutType 布局类型\n * layer:分层布局\n * tight:紧凑布局(没有外边距)\n * ```\n */\nexport const SimpleLayout = (props: SimpleLayoutProps) => {\n const labelAlign = props.formLabelAlign || 'right';\n const className = classNames(\n 'simple-layout',\n {\n 'simple-layout-tight': props.layoutType === 'tight',\n 'simple-layout-formlabel-left': labelAlign === 'left',\n 'simple-layout-title-fixed': props.titleFixed,\n 'simple-layout-small': props.size === 'small',\n },\n props.className,\n );\n\n const theme = fbaHooks.useThemeToken();\n const style = extend({ '--simple-layout-colorPrimary': theme.colorPrimary }, props.style, {\n padding: props.padding,\n width: props.width,\n });\n\n if (props.hidden) return <Fragment />;\n\n return (\n <div className={className} style={style} onClick={props.onClick}>\n {props.title && props.titleExtra ? (\n <div\n className={classNames({ 'simple-layout-title-sign': props.titleLeftLine })}\n style={props.titleStyle}\n >\n <Space className=\"simple-layout-title-extra-space\">\n <div className=\"simple-layout-title\">{props.title}</div>\n <div className=\"simple-layout-title-extra\">{props.titleExtra}</div>\n </Space>\n </div>\n ) : null}\n {props.title && !props.titleExtra ? (\n <div\n className={classNames('simple-layout-title', {\n 'simple-layout-title-sign': props.titleLeftLine,\n })}\n style={props.titleStyle}\n >\n {props.title}\n </div>\n ) : null}\n {props.desc && !isArray(props.desc) ? <div className=\"simple-layout-desc\">{props.desc}</div> : null}\n {props.desc && isArray(props.desc) ? (\n <div className=\"simple-layout-desc\">\n <Space direction=\"vertical\" size={5}>\n {(props.desc as string[]).map((item, index) => {\n return <Fragment key={index}>{item}</Fragment>;\n })}\n </Space>\n </div>\n ) : null}\n {props.children ? (\n <div className=\"simple-layout-content\" style={props.contentStyle}>\n {props.children}\n </div>\n ) : null}\n </div>\n );\n};\n\nSimpleLayout.defaultProps = {\n titleLeftLine: true,\n layoutType: 'layer',\n};\n"],"names":["SimpleLayout","props","labelAlign","formLabelAlign","className","_classNames","layoutType","titleFixed","size","theme","fbaHooks","useThemeToken","style","_extend","colorPrimary","padding","width","hidden","_jsx","Fragment","_jsxs","onClick","children","title","titleExtra","titleLeftLine","titleStyle","Space","desc","_isArray","direction","map","item","index","contentStyle","defaultProps"],"mappings":";8bAmDaA,EAAe,SAAfA,EAAgBC,GAC3B,IAAMC,EAAaD,EAAME,gBAAkB,QAC3C,IAAMC,EAAYC,EAChB,gBACA,CACE,sBAAuBJ,EAAMK,aAAe,QAC5C,+BAAgCJ,IAAe,OAC/C,4BAA6BD,EAAMM,WACnC,sBAAuBN,EAAMO,OAAS,SAExCP,EAAMG,WAGR,IAAMK,EAAQC,EAASC,gBACvB,IAAMC,EAAQC,EAAO,CAAE,+BAAgCJ,EAAMK,cAAgBb,EAAMW,MAAO,CACxFG,QAASd,EAAMc,QACfC,MAAOf,EAAMe,QAGf,GAAIf,EAAMgB,OAAQ,OAAOC,EAACC,EAAQ,CAAE,GAEpC,OACEC,EAAA,MAAA,CAAKhB,UAAWA,EAAWQ,MAAOA,EAAOS,QAASpB,EAAMoB,QAAQC,SAAA,CAC7DrB,EAAMsB,OAAStB,EAAMuB,WACpBN,EAAA,MAAA,CACEd,UAAWC,EAAW,CAAE,2BAA4BJ,EAAMwB,gBAC1Db,MAAOX,EAAMyB,WAAWJ,SAExBF,EAACO,EAAK,CAACvB,UAAU,kCAAiCkB,UAChDJ,EAAA,MAAA,CAAKd,UAAU,sBAAqBkB,SAAErB,EAAMsB,QAC5CL,EAAA,MAAA,CAAKd,UAAU,4BAA2BkB,SAAErB,EAAMuB,kBAGpD,KACHvB,EAAMsB,QAAUtB,EAAMuB,WACrBN,EAAA,MAAA,CACEd,UAAWC,EAAW,sBAAuB,CAC3C,2BAA4BJ,EAAMwB,gBAEpCb,MAAOX,EAAMyB,WAAWJ,SAEvBrB,EAAMsB,QAEP,KACHtB,EAAM2B,OAASC,EAAQ5B,EAAM2B,MAAQV,EAAA,MAAA,CAAKd,UAAU,qBAAoBkB,SAAErB,EAAM2B,OAAc,KAC9F3B,EAAM2B,MAAQC,EAAQ5B,EAAM2B,MAC3BV,EAAA,MAAA,CAAKd,UAAU,qBAAoBkB,SACjCJ,EAACS,EAAK,CAACG,UAAU,WAAWtB,KAAM,EAAEc,SAChCrB,EAAM2B,KAAkBG,KAAI,SAACC,EAAMC,GACnC,OAAOf,EAACC,EAAQ,CAAAG,SAAcU,GAARC,UAI1B,KACHhC,EAAMqB,SACLJ,EAAA,MAAA,CAAKd,UAAU,wBAAwBQ,MAAOX,EAAMiC,aAAaZ,SAC9DrB,EAAMqB,WAEP,OAGV,EAEAtB,EAAamC,aAAe,CAC1BV,cAAe,KACfnB,WAAY"}
1
+ {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/simple-layout/simple-layout.tsx"],"sourcesContent":["import { isArray } from '@dimjs/lang';\nimport { classNames, extend } from '@dimjs/utils';\nimport { Space } from 'antd';\nimport { CSSProperties, Fragment, ReactElement, ReactNode } from 'react';\nimport { fbaHooks } from '../fba-hooks';\nimport './style.less';\n\nexport type SimpleLayoutProps = {\n className?: string;\n style?: CSSProperties;\n title?: string | ReactElement;\n desc?: string | ReactElement | string[] | ReactElement[];\n /**\n * @deprecated 已过期,请使用form className 属性 preDefinedClassName.form.xxx\n */\n formLabelAlign?: 'left' | 'right';\n /**\n * layoutType 布局类型\n * ```\n * 1. layer:分层布局\n * 2. tight:紧凑布局(没有外边距)\n * ```\n */\n layoutType?: 'layer' | 'tight';\n titleLeftLine?: boolean;\n titleStyle?: CSSProperties;\n contentStyle?: CSSProperties;\n /** 优先级大于 style padding */\n padding?: CSSProperties['padding'];\n /** 优先级大于 style width */\n width?: CSSProperties['width'];\n children?: ReactNode | ReactNode[];\n titleExtra?: string | ReactElement;\n hidden?: boolean;\n titleFixed?: boolean;\n /**\n * 间距尺寸\n * 1. default = 15\n * 2. small = 8\n */\n size?: 'default' | 'small';\n onClick?: (event) => void;\n};\n\n/**\n * 简单布局\n * @param props\n * @returns\n * ```\n * 1. layoutType 布局类型\n * layer:分层布局\n * tight:紧凑布局(没有外边距)\n * ```\n */\nexport const SimpleLayout = (props: SimpleLayoutProps) => {\n const labelAlign = props.formLabelAlign || 'right';\n const className = classNames(\n 'simple-layout',\n {\n 'simple-layout-tight': props.layoutType === 'tight',\n 'simple-layout-formlabel-left': labelAlign === 'left',\n 'simple-layout-title-fixed': props.titleFixed,\n 'simple-layout-small': props.size === 'small',\n },\n props.className,\n );\n\n const theme = fbaHooks.useThemeToken();\n const style = extend({ '--simple-layout-colorPrimary': theme.colorPrimary }, props.style, {\n padding: props.padding,\n width: props.width,\n });\n\n if (props.hidden) return <Fragment />;\n\n return (\n <div className={className} style={style} onClick={props.onClick}>\n {props.title && props.titleExtra ? (\n <div\n className={classNames({ 'simple-layout-title-sign': props.titleLeftLine })}\n style={props.titleStyle}\n >\n <Space className=\"simple-layout-title-extra-space\">\n <div className=\"simple-layout-title\">{props.title}</div>\n <div className=\"simple-layout-title-extra\">{props.titleExtra}</div>\n </Space>\n </div>\n ) : null}\n {props.title && !props.titleExtra ? (\n <div\n className={classNames('simple-layout-title', {\n 'simple-layout-title-sign': props.titleLeftLine,\n })}\n style={props.titleStyle}\n >\n {props.title}\n </div>\n ) : null}\n {props.desc && !isArray(props.desc) ? <div className=\"simple-layout-desc\">{props.desc}</div> : null}\n {props.desc && isArray(props.desc) ? (\n <div className=\"simple-layout-desc\">\n <Space direction=\"vertical\" size={5}>\n {(props.desc as string[]).map((item, index) => {\n return <Fragment key={index}>{item}</Fragment>;\n })}\n </Space>\n </div>\n ) : null}\n {props.children ? (\n <div className=\"simple-layout-content\" style={props.contentStyle}>\n {props.children}\n </div>\n ) : null}\n </div>\n );\n};\n\nSimpleLayout.defaultProps = {\n titleLeftLine: true,\n layoutType: 'layer',\n};\n"],"names":["SimpleLayout","props","labelAlign","formLabelAlign","className","_classNames","layoutType","titleFixed","size","theme","fbaHooks","useThemeToken","style","_extend","colorPrimary","padding","width","hidden","_jsx","Fragment","_jsxs","onClick","children","title","titleExtra","titleLeftLine","titleStyle","Space","desc","_isArray","direction","map","item","index","contentStyle","defaultProps"],"mappings":";8bAsDaA,EAAe,SAAfA,EAAgBC,GAC3B,IAAMC,EAAaD,EAAME,gBAAkB,QAC3C,IAAMC,EAAYC,EAChB,gBACA,CACE,sBAAuBJ,EAAMK,aAAe,QAC5C,+BAAgCJ,IAAe,OAC/C,4BAA6BD,EAAMM,WACnC,sBAAuBN,EAAMO,OAAS,SAExCP,EAAMG,WAGR,IAAMK,EAAQC,EAASC,gBACvB,IAAMC,EAAQC,EAAO,CAAE,+BAAgCJ,EAAMK,cAAgBb,EAAMW,MAAO,CACxFG,QAASd,EAAMc,QACfC,MAAOf,EAAMe,QAGf,GAAIf,EAAMgB,OAAQ,OAAOC,EAACC,EAAQ,CAAE,GAEpC,OACEC,EAAA,MAAA,CAAKhB,UAAWA,EAAWQ,MAAOA,EAAOS,QAASpB,EAAMoB,QAAQC,SAAA,CAC7DrB,EAAMsB,OAAStB,EAAMuB,WACpBN,EAAA,MAAA,CACEd,UAAWC,EAAW,CAAE,2BAA4BJ,EAAMwB,gBAC1Db,MAAOX,EAAMyB,WAAWJ,SAExBF,EAACO,EAAK,CAACvB,UAAU,kCAAiCkB,UAChDJ,EAAA,MAAA,CAAKd,UAAU,sBAAqBkB,SAAErB,EAAMsB,QAC5CL,EAAA,MAAA,CAAKd,UAAU,4BAA2BkB,SAAErB,EAAMuB,kBAGpD,KACHvB,EAAMsB,QAAUtB,EAAMuB,WACrBN,EAAA,MAAA,CACEd,UAAWC,EAAW,sBAAuB,CAC3C,2BAA4BJ,EAAMwB,gBAEpCb,MAAOX,EAAMyB,WAAWJ,SAEvBrB,EAAMsB,QAEP,KACHtB,EAAM2B,OAASC,EAAQ5B,EAAM2B,MAAQV,EAAA,MAAA,CAAKd,UAAU,qBAAoBkB,SAAErB,EAAM2B,OAAc,KAC9F3B,EAAM2B,MAAQC,EAAQ5B,EAAM2B,MAC3BV,EAAA,MAAA,CAAKd,UAAU,qBAAoBkB,SACjCJ,EAACS,EAAK,CAACG,UAAU,WAAWtB,KAAM,EAAEc,SAChCrB,EAAM2B,KAAkBG,KAAI,SAACC,EAAMC,GACnC,OAAOf,EAACC,EAAQ,CAAAG,SAAcU,GAARC,UAI1B,KACHhC,EAAMqB,SACLJ,EAAA,MAAA,CAAKd,UAAU,wBAAwBQ,MAAOX,EAAMiC,aAAaZ,SAC9DrB,EAAMqB,WAEP,OAGV,EAEAtB,EAAamC,aAAe,CAC1BV,cAAe,KACfnB,WAAY"}
@@ -3,6 +3,7 @@ import './../button-operate/index.css';
3
3
  import './../button-wrapper/index.css';
4
4
  import './../config-provider-wrapper/index.css';
5
5
  import './../fba-hooks/index.css';
6
+ import './../types/index.css';
6
7
  import './../fba-utils/index.css';
7
8
  import './../dropdown-menu-wrapper/index.css';
8
9
  import './../dialog-confirm/index.css';
@@ -11,5 +12,5 @@ import './../flex-layout/index.css';
11
12
  import './../tag-list-select/index.css';
12
13
  import './index.css';
13
14
  /*! @flatjs/forge MIT @flatbiz/antd */
14
- import{isString as r}from"@dimjs/lang/cjs/is-string";import{isObject as e}from"@dimjs/lang/cjs/is-object";import{get as n}from"@dimjs/utils/cjs/get";import{isPlainObject as t}from"@dimjs/lang/cjs/is-plain-object";import{_ as i}from"../_rollupPluginBabelHelpers-fc015ef2.js";import{isEmpty as o}from"@dimjs/lang/cjs/is-empty";import{isNumber as a,isUndefinedOrNull as l,getStrByteLen as u,cutString as s,flatbizDate as c,flatbizPrice as d}from"@flatbiz/utils";import{Tooltip as m,Space as f,Badge as p}from"antd";import{Fragment as v}from"react";import{ButtonOperate as j}from"../button-operate/index.js";import{TagListSelect as g}from"../tag-list-select/index.js";import{jsx as x}from"react/jsx-runtime";import"@ant-design/icons/es/icons/MoreOutlined";import"@dimjs/lang/cjs/is-undefined";import"@dimjs/utils/cjs/class-names";import"@dimjs/lang/cjs/is-promise";import"@wove/react/cjs/hooks";import"../button-wrapper/index.js";import"@ant-design/icons/es/icons/LoadingOutlined";import"../config-provider-wrapper/index.js";import"antd/es/locale/en_US";import"antd/es/locale/zh_CN";import"dayjs";import"dayjs/locale/en";import"dayjs/locale/zh-cn";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/localeData";import"dayjs/plugin/utc";import"dayjs/plugin/weekday";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/weekYear";import"../fba-hooks/index.js";import"@dimjs/lang/cjs/is-array";import"../use-responsive-point-21b8c601.js";import"../fba-utils/index.js";import"../dropdown-menu-wrapper/index.js";import"@ant-design/icons/es/icons/ExclamationCircleFilled";import"../dialog-confirm/index.js";import"../dialog-modal/index.js";import"ahooks";import"react-dom/client";import"../flex-layout/index.js";var h=function r(e,n){return function(r){if(o(r)||r==="")return n;if(a(r))return r;var t=r.toString();var i=l(e)?10:e;var c=u(t);if(c<=i*2){return t}return x(m,{placement:"topLeft",title:t,children:s(t,i*2)})}};var b=function r(e){return function(r,n,t){var o=e(n,t);return x(j,i({},o))}};var y=function r(e,n){return function(r){if(o(r)||r==="")return n;try{return c.format(new Date(r),e)}catch(e){return r||n}}};var w=function r(e,n){return function(r,t,i){if(n&&e){return(e-1)*n+i+1}return i+1}};var C=function r(e){return function(r,n,t){var i=(e==null?void 0:e())||{},o=i.pageNo,a=i.pageSize;if(a&&o){return(o-1)*a+t+1}return t+1}};var k=function r(e,n){return function(r){return x(g,{dataList:e,colorMap:n,value:r,forceMatch:false})}};var N=function r(i,o){return function(r){if(t(r)){var a=n(r,i,o);if(!a)return"";if(e(a))return JSON.stringify(a);return a}return r||o}};var O=function r(e){return function(r){if(l(r)||r===""){if(l(e==null?void 0:e.defaultValue))return undefined;if(a(e==null?void 0:e.defaultValue)){return x("span",{className:"table-fen-color",children:d.format(e==null?void 0:e.defaultValue)})}return x("span",{className:"table-fen-color",children:e==null?void 0:e.defaultValue})}if(!a(r))return r;var n=d.fen2yuan(r);return x("span",{className:"table-fen-color",children:d.format(n,e==null?void 0:e.defaultValue,{separator:(e==null?void 0:e.separator)||false})})}};var S=function e(n){return function(e,t){var i=n==null?void 0:n(t);if(!i)return x(v,{children:e});var o=l(i.showData)?true:i.showData;var a=l(i.notOverflowShowExtra)?true:i.notOverflowShowExtra;var u=l(i.showMaxNumber)?10:i.showMaxNumber;var c=i.extraPosition?i.extraPosition:"after";var d=r(e)?s(e,u*2):e;if(i.extra&&o){if(d===e&&!a){return e}var m=[x("span",{children:d},"1"),x(v,{children:i.extra},"2")];var p=c==="before"?m.reverse():m;return x(f,{onClick:i.onClick,style:{cursor:i.onClick?"pointer":undefined},size:5,children:p.map((function(r,e){return x(v,{children:r},e)}))})}return x("span",{onClick:i.onClick,children:i.extra})}};var z=function r(e,n){return function(r){var t=e.find((function(e){return e.value===r}));if(t)return x(p,{color:(t==null?void 0:t.color)||(n==null?void 0:n[r])||"rgba(0, 0, 0, 0.25)",text:t==null?void 0:t.label});return r}};var M={extraContentRender:S,indexCell:w,serialNumberCell:C,dateCell:y,operateCell:b,tooltipCell:h,selectorCell:k,objectCell:N,fen2yuanCell:O,badgeCell:z};export{M as tableCellRender};
15
+ import{isString as r}from"@dimjs/lang/cjs/is-string";import{isObject as e}from"@dimjs/lang/cjs/is-object";import{get as n}from"@dimjs/utils/cjs/get";import{isPlainObject as t}from"@dimjs/lang/cjs/is-plain-object";import{_ as i}from"../_rollupPluginBabelHelpers-fc015ef2.js";import{isEmpty as o}from"@dimjs/lang/cjs/is-empty";import{isNumber as a,isUndefinedOrNull as l,getStrByteLen as u,cutString as s,flatbizDate as c,flatbizPrice as d}from"@flatbiz/utils";import{Tooltip as m,Space as f,Badge as p}from"antd";import{Fragment as j}from"react";import{ButtonOperate as v}from"../button-operate/index.js";import{TagListSelect as g}from"../tag-list-select/index.js";import{jsx as x}from"react/jsx-runtime";import"@ant-design/icons/es/icons/MoreOutlined";import"@dimjs/lang/cjs/is-undefined";import"@dimjs/utils/cjs/class-names";import"@dimjs/lang/cjs/is-promise";import"@wove/react/cjs/hooks";import"../button-wrapper/index.js";import"@ant-design/icons/es/icons/LoadingOutlined";import"../config-provider-wrapper/index.js";import"antd/es/locale/en_US";import"antd/es/locale/zh_CN";import"dayjs";import"dayjs/locale/en";import"dayjs/locale/zh-cn";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/localeData";import"dayjs/plugin/utc";import"dayjs/plugin/weekday";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/weekYear";import"../fba-hooks/index.js";import"@dimjs/lang/cjs/is-array";import"../use-responsive-point-21b8c601.js";import"../index-ac189a77.js";import"@dimjs/utils/cjs/extend";import"../fba-utils/index.js";import"../dropdown-menu-wrapper/index.js";import"@ant-design/icons/es/icons/ExclamationCircleFilled";import"../dialog-confirm/index.js";import"../dialog-modal/index.js";import"ahooks";import"react-dom/client";import"../flex-layout/index.js";var h=function r(e,n){return function(r){if(o(r)||r==="")return n;if(a(r))return r;var t=r.toString();var i=l(e)?10:e;var c=u(t);if(c<=i*2){return t}return x(m,{placement:"topLeft",title:t,children:s(t,i*2)})}};var b=function r(e){return function(r,n,t){var o=e(n,t);return x(v,i({},o))}};var y=function r(e,n){return function(r){if(o(r)||r==="")return n;try{return c.format(new Date(r),e)}catch(e){return r||n}}};var w=function r(e,n){return function(r,t,i){if(n&&e){return(e-1)*n+i+1}return i+1}};var C=function r(e){return function(r,n,t){var i=(e==null?void 0:e())||{},o=i.pageNo,a=i.pageSize;if(a&&o){return(o-1)*a+t+1}return t+1}};var k=function r(e,n){return function(r){if(!r)return null;return x(g,{dataList:e,colorMap:n,value:r,forceMatch:false})}};var N=function r(i,o){return function(r){if(t(r)){var a=n(r,i,o);if(!a)return"";if(e(a))return JSON.stringify(a);return a}return r||o}};var O=function r(e){return function(r){if(l(r)||r===""){if(l(e==null?void 0:e.defaultValue))return undefined;if(a(e==null?void 0:e.defaultValue)){return x("span",{className:"table-fen-color",children:d.format(e==null?void 0:e.defaultValue)})}return x("span",{className:"table-fen-color",children:e==null?void 0:e.defaultValue})}if(!a(r))return r;var n=d.fen2yuan(r);return x("span",{className:"table-fen-color",children:d.format(n,e==null?void 0:e.defaultValue,{separator:(e==null?void 0:e.separator)||false})})}};var S=function e(n){return function(e,t){var i=n==null?void 0:n(t);if(!i)return x(j,{children:e});var o=l(i.showData)?true:i.showData;var a=l(i.notOverflowShowExtra)?true:i.notOverflowShowExtra;var u=l(i.showMaxNumber)?10:i.showMaxNumber;var c=i.extraPosition?i.extraPosition:"after";var d=r(e)?s(e,u*2):e;if(i.extra&&o){if(d===e&&!a){return e}var m=[x("span",{children:d},"1"),x(j,{children:i.extra},"2")];var p=c==="before"?m.reverse():m;return x(f,{onClick:i.onClick,style:{cursor:i.onClick?"pointer":undefined},size:5,children:p.map((function(r,e){return x(j,{children:r},e)}))})}return x("span",{onClick:i.onClick,children:i.extra})}};var z=function r(e,n){return function(r){if(!r)return null;var t=e.find((function(e){return e.value===r}));if(t)return x(p,{color:(t==null?void 0:t.color)||(n==null?void 0:n[r])||"rgba(0, 0, 0, 0.25)",text:t==null?void 0:t.label});return r}};var M={extraContentRender:S,indexCell:w,serialNumberCell:C,dateCell:y,operateCell:b,tooltipCell:h,selectorCell:k,objectCell:N,fen2yuanCell:O,badgeCell:z};export{M as tableCellRender};
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/table-cell-render/cell-render.tsx"],"sourcesContent":["import { isEmpty, isObject, isPlainObject, isString } from '@dimjs/lang';\nimport { get } from '@dimjs/utils';\nimport {\n cutString,\n DateFormatType,\n flatbizDate,\n flatbizPrice,\n getStrByteLen,\n isNumber,\n isUndefinedOrNull,\n TAny,\n TPlainObject,\n} from '@flatbiz/utils';\nimport { Badge, Space, Tooltip } from 'antd';\nimport { Fragment, ReactElement } from 'react';\nimport { ButtonOperate, ButtonOperateProps } from '../button-operate';\nimport { TagListSelect, TagListSelectProps, TagListSelectValue } from '../tag-list-select';\nimport './style.less';\n\nconst tableColumnTooltipRender = (showMaxNumber?: number, defaultValue?: string) => {\n return (value: string | number) => {\n if (isEmpty(value) || value === '') return defaultValue;\n if (isNumber(value)) return value;\n const colunmText = value.toString();\n const maxNumber = (isUndefinedOrNull(showMaxNumber) ? 10 : showMaxNumber) as number;\n const strByteLen = getStrByteLen(colunmText);\n if (strByteLen <= maxNumber * 2) {\n return colunmText;\n }\n return (\n <Tooltip placement=\"topLeft\" title={colunmText}>\n {cutString(colunmText, maxNumber * 2)}\n </Tooltip>\n );\n };\n};\n\nconst tableColumnOperateRender = (options: (item: TAny, index: number) => ButtonOperateProps) => {\n return (_value: string | number, record, index: number) => {\n const operateProps = options(record, index);\n return <ButtonOperate {...operateProps} />;\n };\n};\n\nconst tableColumnDateRender = (dateFormatType?: DateFormatType, defaultValue?: string) => {\n return (value: string | number) => {\n if (isEmpty(value) || value === '') return defaultValue;\n try {\n return flatbizDate.format(new Date(value), dateFormatType);\n } catch (error) {\n return value || defaultValue;\n }\n };\n};\n\n/**\n * table 索引展示,如果存在pageSize、pageNo参数可分页展示索引,否则每页都从1开始\n * @param pageSize\n * @param pageNo\n * @returns\n */\nconst tableColumnIndexRender = (pageNo?: number, pageSize?: number) => {\n return (_value, _record, index: number) => {\n if (pageSize && pageNo) {\n return (pageNo - 1) * pageSize + index + 1;\n }\n return index + 1;\n };\n};\nconst tableColumnIndexRender2 = (method?: () => { pageNo?: number; pageSize?: number }) => {\n return (_value, _record, index: number) => {\n const { pageNo, pageSize } = method?.() || {};\n if (pageSize && pageNo) {\n return (pageNo - 1) * pageSize + index + 1;\n }\n return index + 1;\n };\n};\n\nconst tableColumnSelectorRender = (\n selectorList: TagListSelectProps['dataList'],\n colorMap?: TagListSelectProps['colorMap'],\n) => {\n return (value: string | number) => {\n return <TagListSelect dataList={selectorList} colorMap={colorMap} value={value} forceMatch={false} />;\n };\n};\n\nconst tableColumnObjectRender = (key: string, defaultValue?: string) => {\n return (value?: TPlainObject) => {\n if (isPlainObject(value)) {\n const target = get(value, key, defaultValue);\n if (!target) return '';\n if (isObject(target)) return JSON.stringify(target);\n return target;\n }\n return value || defaultValue;\n };\n};\n\nconst tableColumnFen2yuanCellRender = (options?: {\n /** 是否显示分隔符,默认值:false */\n separator?: boolean;\n defaultValue?: string | number;\n}) => {\n return (value?: string | number) => {\n if (isUndefinedOrNull(value) || value === '') {\n if (isUndefinedOrNull(options?.defaultValue)) return undefined;\n if (isNumber(options?.defaultValue as string | number)) {\n return <span className=\"table-fen-color\">{flatbizPrice.format(options?.defaultValue)}</span>;\n }\n return <span className=\"table-fen-color\">{options?.defaultValue}</span>;\n }\n if (!isNumber(value as number | string)) return value;\n const amount = flatbizPrice.fen2yuan(value);\n return (\n <span className=\"table-fen-color\">\n {flatbizPrice.format(amount, options?.defaultValue, { separator: options?.separator || false })}\n </span>\n );\n };\n};\n\ntype TableColumnIconRenderProps = {\n /** 额外内容,一般为Icon */\n extra: ReactElement;\n extraPosition?: 'before' | 'after';\n onClick?: (e) => void;\n /** 是否显示原单元格数据,默认值:true */\n showData?: boolean;\n /** 溢出显示【...】, 最大长度(默认:20个字节) */\n showMaxNumber?: number;\n /** 未溢出显示【extra】配置,默认值:true */\n notOverflowShowExtra?: boolean;\n};\n\nconst tableColumnExtraContentRender = (handle: (item: TPlainObject) => TableColumnIconRenderProps) => {\n return (value: TAny, item: TPlainObject) => {\n const options = handle?.(item);\n if (!options) return <Fragment>{value}</Fragment>;\n const showData = isUndefinedOrNull(options.showData) ? true : options.showData;\n const notOverflowShowExtra = isUndefinedOrNull(options.notOverflowShowExtra)\n ? true\n : options.notOverflowShowExtra;\n const showMaxNumber = isUndefinedOrNull(options.showMaxNumber) ? 10 : (options.showMaxNumber as number);\n const extraPosition = options.extraPosition ? options.extraPosition : 'after';\n const renderValue = isString(value) ? cutString(value, showMaxNumber * 2) : value;\n\n if (options.extra && showData) {\n if (renderValue === value && !notOverflowShowExtra) {\n return value;\n }\n const spaceContent = [<span key=\"1\">{renderValue}</span>, <Fragment key=\"2\">{options.extra}</Fragment>];\n const spaceContentRender = extraPosition === 'before' ? spaceContent.reverse() : spaceContent;\n return (\n <Space onClick={options.onClick} style={{ cursor: options.onClick ? 'pointer' : undefined }} size={5}>\n {spaceContentRender.map((item, index) => {\n return <Fragment key={index}>{item}</Fragment>;\n })}\n </Space>\n );\n }\n return <span onClick={options.onClick}>{options.extra}</span>;\n };\n};\n\nconst tableColumnBadgeRender = (\n selectorList: { label: string; value: TagListSelectValue; color?: string }[],\n colorMap?: Record<string | string, string>,\n) => {\n return (value: string | number) => {\n const target = selectorList.find((item) => item.value === value);\n if (target)\n return (\n <Badge color={target?.color || colorMap?.[value] || 'rgba(0, 0, 0, 0.25)'} text={target?.label} />\n );\n return value;\n };\n};\n\nexport const tableCellRender = {\n /**\n * 表格单元格 拼接额外内容渲染\n * ```\n * 1. extra 额外内容\n * 2. showData 是否显示原单元格数据,默认值:true\n * 3. showMaxNumber 显示最大长度,作用于原单元格字符串数据\n * ```\n */\n extraContentRender: tableColumnExtraContentRender,\n /**\n * table 索引展示,如果存在pageSize、pageNo参数可分页展示索引,否则每页都从1开始\n * @deprecated 已过时 4.3.0版本移除,请使用 serialNumberCell\n */\n indexCell: tableColumnIndexRender,\n /**\n * table 序号展示,如果存在pageSize、pageNo参数可分页展示累加序号,否则每页都从1开始\n * ```\n * render: tableCellRender.serialNumberCell(() => {\n * return { pageNo,pageSize };\n * }),\n * ```\n */\n serialNumberCell: tableColumnIndexRender2,\n /**\n * 表格日期格式数据渲染,默认格式:YYYY-MM-DD\n * ```\n * dateFormatType: 日期格式\n * ```\n */\n dateCell: tableColumnDateRender,\n /**\n * table操作栏目渲染\n * ```\n * 使用方式\n * tableCellRender.operateCell((item) => ({\n * operateList: [\n * {\n * text: '编辑',\n * onClick: onItemOperate.bind(null, 'update', item),\n * permission: SystemAdminPermissionEnum.system_admin_edit,\n * },\n * {\n * text: '删除',\n * needConfirm: true,\n * confirmMessage: '确定要删除吗?',\n * onClick: onItemOperate.bind(null, 'delete', item),\n * permission: SystemAdminPermissionEnum.system_admin_delete,\n * },\n * ],\n * }))\n * ```\n */\n operateCell: tableColumnOperateRender,\n /**\n * 实现字段超出隐藏,默认长度10个字符\n * ```\n * 1. showMaxNumber: 显示最大长度\n * 2. 会讲字符转出字节进行计算显示\n * ```\n */\n tooltipCell: tableColumnTooltipRender,\n /**\n * ```\n * 独立使用\n * tableCellRender.selectorCell([{ label: '已开启', value: 1 }])(value)\n * tableCellRender.selectorCell([{ label: '已开启', value: 1, color: '#108ee9' }])(value)\n * tableCellRender.selectorCell([{ label: '已开启', value: 1 }], { 1: '#108ee9' })(value)\n *\n * 结合table column render 使用\n * render: tableCellRender.selectorCell([{ label: '已开启', value: 1 ])\n * render: (value) => {\n * return tableCellRender.selectorCell([{ label: '已开启', value: 1 ])(value)\n * }\n * ```\n */\n selectorCell: tableColumnSelectorRender,\n /**\n * 单元格对象数据处理,支持多级处理\n * ```\n * tableCellRender.objectCell('a.b.c')\n * ```\n */\n objectCell: tableColumnObjectRender,\n /**\n * 分金额展示,入参分,显示元(默认添加千分位)\n * ```\n * 可配置\n * 1. separator:是否显示千分位分隔符,默认值:false\n * 2. defaultValue:当值为空默认展示\n *\n * 例如:\n * fen2yuanCell()(100090) => 1000.90\n * fen2yuanCell({separator: true})(100090) => 1,000.90\n * fen2yuanCell()('abc') => abc\n * fen2yuanCell({defaultValue: '--'})('') => --\n * fen2yuanCell()('') => undefined\n * fen2yuanCell({ defaultValue: 0 })('') => 0.00\n * ```\n */\n fen2yuanCell: tableColumnFen2yuanCellRender,\n /**\n * 单元格徽标展示数据\n * ```\n * 1. badge 默认颜色:灰色rgba(0, 0, 0, 0.25)\n *\n * 独立使用\n * tableCellRender.badgeCell([{ label: '已开启', value: 1 ])(value)\n * tableCellRender.badgeCell([{ label: '已开启', value: 1, color: '#108ee9' }])(value)\n * tableCellRender.badgeCell([{ label: '已开启', value: 1 }], { 1: '#108ee9' })(value)\n *\n * 结合table column render 使用\n * render: tableCellRender.badgeCell([{ label: '已开启', value: 1 ])\n * render: (value) => {\n * return tableCellRender.badgeCell([{ label: '已开启', value: 1 ])(value)\n * }\n * ```\n */\n badgeCell: tableColumnBadgeRender,\n};\n"],"names":["tableColumnTooltipRender","showMaxNumber","defaultValue","value","_isEmpty","isNumber","colunmText","toString","maxNumber","isUndefinedOrNull","strByteLen","getStrByteLen","_jsx","Tooltip","placement","title","children","cutString","tableColumnOperateRender","options","_value","record","index","operateProps","ButtonOperate","_extends","tableColumnDateRender","dateFormatType","flatbizDate","format","Date","error","tableColumnIndexRender","pageNo","pageSize","_record","tableColumnIndexRender2","method","_ref","tableColumnSelectorRender","selectorList","colorMap","TagListSelect","dataList","forceMatch","tableColumnObjectRender","key","_isPlainObject","target","_get","_isObject","JSON","stringify","tableColumnFen2yuanCellRender","undefined","className","flatbizPrice","amount","fen2yuan","separator","tableColumnExtraContentRender","handle","item","Fragment","showData","notOverflowShowExtra","extraPosition","renderValue","_isString","extra","spaceContent","spaceContentRender","reverse","Space","onClick","style","cursor","size","map","tableColumnBadgeRender","find","Badge","color","text","label","tableCellRender","extraContentRender","indexCell","serialNumberCell","dateCell","operateCell","tooltipCell","selectorCell","objectCell","fen2yuanCell","badgeCell"],"mappings":";itDAmBA,IAAMA,EAA2B,SAA3BA,EAA4BC,EAAwBC,GACxD,OAAO,SAACC,GACN,GAAIC,EAAQD,IAAUA,IAAU,GAAI,OAAOD,EAC3C,GAAIG,EAASF,GAAQ,OAAOA,EAC5B,IAAMG,EAAaH,EAAMI,WACzB,IAAMC,EAAaC,EAAkBR,GAAiB,GAAKA,EAC3D,IAAMS,EAAaC,EAAcL,GACjC,GAAII,GAAcF,EAAY,EAAG,CAC/B,OAAOF,CACT,CACA,OACEM,EAACC,EAAO,CAACC,UAAU,UAAUC,MAAOT,EAAWU,SAC5CC,EAAUX,EAAYE,EAAY,KAI3C,EAEA,IAAMU,EAA2B,SAA3BA,EAA4BC,GAChC,OAAO,SAACC,EAAyBC,EAAQC,GACvC,IAAMC,EAAeJ,EAAQE,EAAQC,GACrC,OAAOV,EAACY,EAAaC,EAAKF,CAAAA,EAAAA,IAE9B,EAEA,IAAMG,EAAwB,SAAxBA,EAAyBC,EAAiCzB,GAC9D,OAAO,SAACC,GACN,GAAIC,EAAQD,IAAUA,IAAU,GAAI,OAAOD,EAC3C,IACE,OAAO0B,EAAYC,OAAO,IAAIC,KAAK3B,GAAQwB,EAC5C,CAAC,MAAOI,GACP,OAAO5B,GAASD,CAClB,EAEJ,EAQA,IAAM8B,EAAyB,SAAzBA,EAA0BC,EAAiBC,GAC/C,OAAO,SAACd,EAAQe,EAASb,GACvB,GAAIY,GAAYD,EAAQ,CACtB,OAAQA,EAAS,GAAKC,EAAWZ,EAAQ,CAC3C,CACA,OAAOA,EAAQ,EAEnB,EACA,IAAMc,EAA0B,SAA1BA,EAA2BC,GAC/B,OAAO,SAACjB,EAAQe,EAASb,GACvB,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K,CAACC,OAAOlC,GAAM,UAAA,EAANA,EAAQkC,SAASzC,eAAAA,EAAWtC,KAAU,sBAAuBgF,KAAMnC,GAAAA,UAAAA,EAAAA,EAAQoC,QAE7F,OAAOjF,EAEX,EAEO,IAAMkF,EAAkB,CAS7BC,mBAAoB1B,EAKpB2B,UAAWvD,EASXwD,iBAAkBpD,EAOlBqD,SAAU/D,EAuBVgE,YAAaxE,EAQbyE,YAAa3F,EAeb4F,aAAcrD,EAOdsD,WAAYhD,EAiBZiD,aAAczC,EAkBd0C,UAAWhB"}
1
+ {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/table-cell-render/cell-render.tsx"],"sourcesContent":["import { isEmpty, isObject, isPlainObject, isString } from '@dimjs/lang';\nimport { get } from '@dimjs/utils';\nimport {\n cutString,\n DateFormatType,\n flatbizDate,\n flatbizPrice,\n getStrByteLen,\n isNumber,\n isUndefinedOrNull,\n TAny,\n TPlainObject,\n} from '@flatbiz/utils';\nimport { Badge, Space, Tooltip } from 'antd';\nimport { Fragment, ReactElement } from 'react';\nimport { ButtonOperate, ButtonOperateProps } from '../button-operate';\nimport { TagListSelect, TagListSelectProps, TagListSelectValue } from '../tag-list-select';\nimport './style.less';\n\nconst tableColumnTooltipRender = (showMaxNumber?: number, defaultValue?: string) => {\n return (value: string | number) => {\n if (isEmpty(value) || value === '') return defaultValue;\n if (isNumber(value)) return value;\n const colunmText = value.toString();\n const maxNumber = (isUndefinedOrNull(showMaxNumber) ? 10 : showMaxNumber) as number;\n const strByteLen = getStrByteLen(colunmText);\n if (strByteLen <= maxNumber * 2) {\n return colunmText;\n }\n return (\n <Tooltip placement=\"topLeft\" title={colunmText}>\n {cutString(colunmText, maxNumber * 2)}\n </Tooltip>\n );\n };\n};\n\nconst tableColumnOperateRender = (options: (item: TAny, index: number) => ButtonOperateProps) => {\n return (_value: string | number, record, index: number) => {\n const operateProps = options(record, index);\n return <ButtonOperate {...operateProps} />;\n };\n};\n\nconst tableColumnDateRender = (dateFormatType?: DateFormatType, defaultValue?: string) => {\n return (value: string | number) => {\n if (isEmpty(value) || value === '') return defaultValue;\n try {\n return flatbizDate.format(new Date(value), dateFormatType);\n } catch (error) {\n return value || defaultValue;\n }\n };\n};\n\n/**\n * table 索引展示,如果存在pageSize、pageNo参数可分页展示索引,否则每页都从1开始\n * @param pageSize\n * @param pageNo\n * @returns\n */\nconst tableColumnIndexRender = (pageNo?: number, pageSize?: number) => {\n return (_value, _record, index: number) => {\n if (pageSize && pageNo) {\n return (pageNo - 1) * pageSize + index + 1;\n }\n return index + 1;\n };\n};\nconst tableColumnIndexRender2 = (method?: () => { pageNo?: number; pageSize?: number }) => {\n return (_value, _record, index: number) => {\n const { pageNo, pageSize } = method?.() || {};\n if (pageSize && pageNo) {\n return (pageNo - 1) * pageSize + index + 1;\n }\n return index + 1;\n };\n};\n\nconst tableColumnSelectorRender = (\n selectorList: TagListSelectProps['dataList'],\n colorMap?: TagListSelectProps['colorMap'],\n) => {\n return (value?: TAny) => {\n if (!value) return null;\n return <TagListSelect dataList={selectorList} colorMap={colorMap} value={value} forceMatch={false} />;\n };\n};\n\nconst tableColumnObjectRender = (key: string, defaultValue?: string) => {\n return (value?: TPlainObject) => {\n if (isPlainObject(value)) {\n const target = get(value, key, defaultValue);\n if (!target) return '';\n if (isObject(target)) return JSON.stringify(target);\n return target;\n }\n return value || defaultValue;\n };\n};\n\nconst tableColumnFen2yuanCellRender = (options?: {\n /** 是否显示分隔符,默认值:false */\n separator?: boolean;\n defaultValue?: string | number;\n}) => {\n return (value?: string | number) => {\n if (isUndefinedOrNull(value) || value === '') {\n if (isUndefinedOrNull(options?.defaultValue)) return undefined;\n if (isNumber(options?.defaultValue as string | number)) {\n return <span className=\"table-fen-color\">{flatbizPrice.format(options?.defaultValue)}</span>;\n }\n return <span className=\"table-fen-color\">{options?.defaultValue}</span>;\n }\n if (!isNumber(value as number | string)) return value;\n const amount = flatbizPrice.fen2yuan(value);\n return (\n <span className=\"table-fen-color\">\n {flatbizPrice.format(amount, options?.defaultValue, { separator: options?.separator || false })}\n </span>\n );\n };\n};\n\ntype TableColumnIconRenderProps = {\n /** 额外内容,一般为Icon */\n extra: ReactElement;\n extraPosition?: 'before' | 'after';\n onClick?: (e) => void;\n /** 是否显示原单元格数据,默认值:true */\n showData?: boolean;\n /** 溢出显示【...】, 最大长度(默认:20个字节) */\n showMaxNumber?: number;\n /** 未溢出显示【extra】配置,默认值:true */\n notOverflowShowExtra?: boolean;\n};\n\nconst tableColumnExtraContentRender = (handle: (item: TPlainObject) => TableColumnIconRenderProps) => {\n return (value: TAny, item: TPlainObject) => {\n const options = handle?.(item);\n if (!options) return <Fragment>{value}</Fragment>;\n const showData = isUndefinedOrNull(options.showData) ? true : options.showData;\n const notOverflowShowExtra = isUndefinedOrNull(options.notOverflowShowExtra)\n ? true\n : options.notOverflowShowExtra;\n const showMaxNumber = isUndefinedOrNull(options.showMaxNumber) ? 10 : (options.showMaxNumber as number);\n const extraPosition = options.extraPosition ? options.extraPosition : 'after';\n const renderValue = isString(value) ? cutString(value, showMaxNumber * 2) : value;\n\n if (options.extra && showData) {\n if (renderValue === value && !notOverflowShowExtra) {\n return value;\n }\n const spaceContent = [<span key=\"1\">{renderValue}</span>, <Fragment key=\"2\">{options.extra}</Fragment>];\n const spaceContentRender = extraPosition === 'before' ? spaceContent.reverse() : spaceContent;\n return (\n <Space onClick={options.onClick} style={{ cursor: options.onClick ? 'pointer' : undefined }} size={5}>\n {spaceContentRender.map((item, index) => {\n return <Fragment key={index}>{item}</Fragment>;\n })}\n </Space>\n );\n }\n return <span onClick={options.onClick}>{options.extra}</span>;\n };\n};\n\nconst tableColumnBadgeRender = (\n selectorList: { label: string; value: TagListSelectValue; color?: string }[],\n colorMap?: Record<string | string, string>,\n) => {\n return (value?: TAny) => {\n if (!value) return null;\n const target = selectorList.find((item) => item.value === value);\n if (target)\n return (\n <Badge color={target?.color || colorMap?.[value] || 'rgba(0, 0, 0, 0.25)'} text={target?.label} />\n );\n return value;\n };\n};\n\nexport const tableCellRender = {\n /**\n * 表格单元格 拼接额外内容渲染\n * ```\n * 1. extra 额外内容\n * 2. showData 是否显示原单元格数据,默认值:true\n * 3. showMaxNumber 显示最大长度,作用于原单元格字符串数据\n * ```\n */\n extraContentRender: tableColumnExtraContentRender,\n /**\n * table 索引展示,如果存在pageSize、pageNo参数可分页展示索引,否则每页都从1开始\n * @deprecated 已过时 4.3.0版本移除,请使用 serialNumberCell\n */\n indexCell: tableColumnIndexRender,\n /**\n * table 序号展示,如果存在pageSize、pageNo参数可分页展示累加序号,否则每页都从1开始\n * ```\n * render: tableCellRender.serialNumberCell(() => {\n * return { pageNo,pageSize };\n * }),\n * ```\n */\n serialNumberCell: tableColumnIndexRender2,\n /**\n * 表格日期格式数据渲染,默认格式:YYYY-MM-DD\n * ```\n * dateFormatType: 日期格式\n * ```\n */\n dateCell: tableColumnDateRender,\n /**\n * table操作栏目渲染\n * ```\n * 使用方式\n * tableCellRender.operateCell((item) => ({\n * operateList: [\n * {\n * text: '编辑',\n * onClick: onItemOperate.bind(null, 'update', item),\n * permission: SystemAdminPermissionEnum.system_admin_edit,\n * },\n * {\n * text: '删除',\n * needConfirm: true,\n * confirmMessage: '确定要删除吗?',\n * onClick: onItemOperate.bind(null, 'delete', item),\n * permission: SystemAdminPermissionEnum.system_admin_delete,\n * },\n * ],\n * }))\n * ```\n */\n operateCell: tableColumnOperateRender,\n /**\n * 实现字段超出隐藏,默认长度10个字符\n * ```\n * 1. showMaxNumber: 显示最大长度\n * 2. 会讲字符转出字节进行计算显示\n * ```\n */\n tooltipCell: tableColumnTooltipRender,\n /**\n * ```\n * 独立使用\n * tableCellRender.selectorCell([{ label: '已开启', value: 1 }])(value)\n * tableCellRender.selectorCell([{ label: '已开启', value: 1, color: '#108ee9' }])(value)\n * tableCellRender.selectorCell([{ label: '已开启', value: 1 }], { 1: '#108ee9' })(value)\n *\n * 结合table column render 使用\n * render: tableCellRender.selectorCell([{ label: '已开启', value: 1 ])\n * render: (value) => {\n * return tableCellRender.selectorCell([{ label: '已开启', value: 1 ])(value)\n * }\n *\n * 其中value值可以是单个值或者数组;例如:'1' 或者 ['1', '2']\n * ```\n */\n selectorCell: tableColumnSelectorRender,\n /**\n * 单元格对象数据处理,支持多级处理\n * ```\n * tableCellRender.objectCell('a.b.c')\n * ```\n */\n objectCell: tableColumnObjectRender,\n /**\n * 分金额展示,入参分,显示元(默认添加千分位)\n * ```\n * 可配置\n * 1. separator:是否显示千分位分隔符,默认值:false\n * 2. defaultValue:当值为空默认展示\n *\n * 例如:\n * fen2yuanCell()(100090) => 1000.90\n * fen2yuanCell({separator: true})(100090) => 1,000.90\n * fen2yuanCell()('abc') => abc\n * fen2yuanCell({defaultValue: '--'})('') => --\n * fen2yuanCell()('') => undefined\n * fen2yuanCell({ defaultValue: 0 })('') => 0.00\n * ```\n */\n fen2yuanCell: tableColumnFen2yuanCellRender,\n /**\n * 单元格徽标展示数据\n * ```\n * 1. badge 默认颜色:灰色rgba(0, 0, 0, 0.25)\n *\n * 独立使用\n * tableCellRender.badgeCell([{ label: '已开启', value: 1 ])(value)\n * tableCellRender.badgeCell([{ label: '已开启', value: 1, color: '#108ee9' }])(value)\n * tableCellRender.badgeCell([{ label: '已开启', value: 1 }], { 1: '#108ee9' })(value)\n *\n * 结合table column render 使用\n * render: tableCellRender.badgeCell([{ label: '已开启', value: 1 ])\n * render: (value) => {\n * return tableCellRender.badgeCell([{ label: '已开启', value: 1 ])(value)\n * }\n * ```\n */\n badgeCell: tableColumnBadgeRender,\n};\n"],"names":["tableColumnTooltipRender","showMaxNumber","defaultValue","value","_isEmpty","isNumber","colunmText","toString","maxNumber","isUndefinedOrNull","strByteLen","getStrByteLen","_jsx","Tooltip","placement","title","children","cutString","tableColumnOperateRender","options","_value","record","index","operateProps","ButtonOperate","_extends","tableColumnDateRender","dateFormatType","flatbizDate","format","Date","error","tableColumnIndexRender","pageNo","pageSize","_record","tableColumnIndexRender2","method","_ref","tableColumnSelectorRender","selectorList","colorMap","TagListSelect","dataList","forceMatch","tableColumnObjectRender","key","_isPlainObject","target","_get","_isObject","JSON","stringify","tableColumnFen2yuanCellRender","undefined","className","flatbizPrice","amount","fen2yuan","separator","tableColumnExtraContentRender","handle","item","Fragment","showData","notOverflowShowExtra","extraPosition","renderValue","_isString","extra","spaceContent","spaceContentRender","reverse","Space","onClick","style","cursor","size","map","tableColumnBadgeRender","find","Badge","color","text","label","tableCellRender","extraContentRender","indexCell","serialNumberCell","dateCell","operateCell","tooltipCell","selectorCell","objectCell","fen2yuanCell","badgeCell"],"mappings":";8wDAmBA,IAAMA,EAA2B,SAA3BA,EAA4BC,EAAwBC,GACxD,OAAO,SAACC,GACN,GAAIC,EAAQD,IAAUA,IAAU,GAAI,OAAOD,EAC3C,GAAIG,EAASF,GAAQ,OAAOA,EAC5B,IAAMG,EAAaH,EAAMI,WACzB,IAAMC,EAAaC,EAAkBR,GAAiB,GAAKA,EAC3D,IAAMS,EAAaC,EAAcL,GACjC,GAAII,GAAcF,EAAY,EAAG,CAC/B,OAAOF,CACT,CACA,OACEM,EAACC,EAAO,CAACC,UAAU,UAAUC,MAAOT,EAAWU,SAC5CC,EAAUX,EAAYE,EAAY,KAI3C,EAEA,IAAMU,EAA2B,SAA3BA,EAA4BC,GAChC,OAAO,SAACC,EAAyBC,EAAQC,GACvC,IAAMC,EAAeJ,EAAQE,EAAQC,GACrC,OAAOV,EAACY,EAAaC,EAAKF,CAAAA,EAAAA,IAE9B,EAEA,IAAMG,EAAwB,SAAxBA,EAAyBC,EAAiCzB,GAC9D,OAAO,SAACC,GACN,GAAIC,EAAQD,IAAUA,IAAU,GAAI,OAAOD,EAC3C,IACE,OAAO0B,EAAYC,OAAO,IAAIC,KAAK3B,GAAQwB,EAC5C,CAAC,MAAOI,GACP,OAAO5B,GAASD,CAClB,EAEJ,EAQA,IAAM8B,EAAyB,SAAzBA,EAA0BC,EAAiBC,GAC/C,OAAO,SAACd,EAAQe,EAASb,GACvB,GAAIY,GAAYD,E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AAQkD,QAEpD,EAEA,IAAMU,EAAyB,SAAzBA,EACJvC,EACAC,GAEA,OAAO,SAACtC,GACN,IAAKA,EAAO,OAAO,KACnB,IAAM6C,EAASR,EAAawC,MAAK,SAAClB,GAAI,OAAKA,EAAK3D,QAAUA,KAC1D,GAAI6C,EACF,OACEpC,EAACqE,EAAK,CAACC,OAAOlC,GAAM,UAAA,EAANA,EAAQkC,SAASzC,eAAAA,EAAWtC,KAAU,sBAAuBgF,KAAMnC,GAAAA,UAAAA,EAAAA,EAAQoC,QAE7F,OAAOjF,EAEX,EAEO,IAAMkF,EAAkB,CAS7BC,mBAAoB1B,EAKpB2B,UAAWvD,EASXwD,iBAAkBpD,EAOlBqD,SAAU/D,EAuBVgE,YAAaxE,EAQbyE,YAAa3F,EAiBb4F,aAAcrD,EAOdsD,WAAYhD,EAiBZiD,aAAczC,EAkBd0C,UAAWhB"}
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
2
  import './index.css';
3
3
  /*! @flatjs/forge MIT @flatbiz/antd */
4
- import{isUndefinedOrNull as r,valueIsEqual as l}from"@flatbiz/utils";import{Tag as a}from"antd";import{useMemo as e,Fragment as t}from"react";import{jsx as o}from"react/jsx-runtime";var n=function n(u){var i=e((function(){if(r(u.value)){return null}if(!u.dataList||u.dataList.length===0){return{label:""+u.value}}var a=u.dataList.find((function(r){return l(r.value,u.value)||r.label===u.value}));if(a){var e;return{label:a.label,color:((e=u.colorMap)==null?void 0:e[String(a.value)])||a.color}}if(u.forceMatch){return undefined}return{label:""+u.value}}),[u.colorMap,u.dataList,u.forceMatch,u.value]);if(!i){return o(t,{children:u.value})}return o(t,{children:i!=null&&i.color?o(a,{color:i.color,children:i.label}):i==null?void 0:i.label})};n.defaultProps={forceMatch:false};export{n as TagListSelect};
4
+ import{toArray as r,isUndefinedOrNull as e,valueIsEqual as n}from"@flatbiz/utils";import{Tag as l}from"antd";import{useMemo as t,Fragment as a}from"react";import{jsx as o}from"react/jsx-runtime";var i=function i(u){var f=r(u.value);var c=t((function(){if(e(u.value)){return[]}return f.map((function(r){var e;var l=(e=u.dataList)==null?void 0:e.find((function(e){return n(e.value,r)||e.label===r}));if(l){var t;return{label:l.label,color:((t=u.colorMap)==null?void 0:t[String(l.value)])||l.color,value:r}}if(u.forceMatch){return undefined}return{label:""+r,color:undefined,value:r}})).filter(Boolean)}),[u.colorMap,u.dataList,u.forceMatch,u.value,f]);if(c.length===0){return o(a,{children:u.value})}var d=c.find((function(r){return!!(r!=null&&r.color)}));if(d){return o(a,{children:c.map((function(r,e){return o(l,{color:r.color,style:e===c.length-1?{margin:"0"}:undefined,children:r.label},e)}))})}return o(a,{children:c.map((function(r){return r.label})).join(",")})};i.defaultProps={forceMatch:false};export{i as TagListSelect};
5
5
  //# sourceMappingURL=index.js.map