amis-rev-ui 6.13.0
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.
- package/LICENSE +201 -0
- package/esm/HTMLFilterContext.d.ts +3 -0
- package/esm/HTMLFilterContext.js +10 -0
- package/esm/components/404.js +35 -0
- package/esm/components/Alert.js +266 -0
- package/esm/components/Alert2.js +58 -0
- package/esm/components/AlphabetIndexer.d.ts +11 -0
- package/esm/components/AlphabetIndexer.js +48 -0
- package/esm/components/AnchorNav.js +153 -0
- package/esm/components/AnchorNavSection.d.ts +2 -0
- package/esm/components/AnchorNavSection.js +7 -0
- package/esm/components/ArrayInput.js +146 -0
- package/esm/components/AsideNav.js +133 -0
- package/esm/components/AssociatedSelection.js +107 -0
- package/esm/components/AutoFoldedList.js +124 -0
- package/esm/components/AutoSizer.d.ts +2 -0
- package/esm/components/AutoSizer.js +8 -0
- package/esm/components/Avatar.js +126 -0
- package/esm/components/Badge.d.ts +20 -0
- package/esm/components/Badge.js +154 -0
- package/esm/components/BaiduMapPicker.js +366 -0
- package/esm/components/BarCode.js +42 -0
- package/esm/components/Breadcrumb.js +160 -0
- package/esm/components/Button.js +64 -0
- package/esm/components/CalendarMobile.js +538 -0
- package/esm/components/Card.js +88 -0
- package/esm/components/Cascader.js +515 -0
- package/esm/components/ChainedDropdownSelection.js +104 -0
- package/esm/components/ChainedSelection.js +184 -0
- package/esm/components/Checkbox.js +87 -0
- package/esm/components/CityArea.js +190 -0
- package/esm/components/CityDB.d.ts +13 -0
- package/esm/components/CityDB.js +3942 -0
- package/esm/components/CodeMirror.d.ts +29 -0
- package/esm/components/CodeMirror.js +140 -0
- package/esm/components/Collapse.js +184 -0
- package/esm/components/CollapseGroup.js +117 -0
- package/esm/components/ColorPicker.js +259 -0
- package/esm/components/Combo.js +212 -0
- package/esm/components/ConditionBuilder.d.ts +2 -0
- package/esm/components/ConditionBuilder.js +7 -0
- package/esm/components/ConfirmBox.js +128 -0
- package/esm/components/ContextMenu.js +310 -0
- package/esm/components/DatePicker.js +716 -0
- package/esm/components/DateRangePicker.js +1385 -0
- package/esm/components/DiffEditor.d.ts +21 -0
- package/esm/components/DiffEditor.js +119 -0
- package/esm/components/DndContainer.js +25 -0
- package/esm/components/Drawer.js +272 -0
- package/esm/components/DropDownSelection.js +77 -0
- package/esm/components/DropdownContextMenus.js +93 -0
- package/esm/components/Editor.js +238 -0
- package/esm/components/Form.d.ts +31 -0
- package/esm/components/Form.js +84 -0
- package/esm/components/FormField.js +78 -0
- package/esm/components/FormulaPicker.d.ts +2 -0
- package/esm/components/FormulaPicker.js +7 -0
- package/esm/components/GaodeMapPicker.js +204 -0
- package/esm/components/GridNav.d.ts +53 -0
- package/esm/components/GridNav.js +125 -0
- package/esm/components/GridNavItem.d.ts +2 -0
- package/esm/components/GridNavItem.js +7 -0
- package/esm/components/GroupedSelection.js +138 -0
- package/esm/components/HeadCellDropDown.d.ts +2 -0
- package/esm/components/HeadCellDropDown.js +7 -0
- package/esm/components/HorizontalScroll.d.ts +74 -0
- package/esm/components/HorizontalScroll.js +271 -0
- package/esm/components/Html.js +55 -0
- package/esm/components/Icon.d.ts +2 -0
- package/esm/components/Icon.js +7 -0
- package/esm/components/ImageGallery.js +396 -0
- package/esm/components/Input.d.ts +18 -0
- package/esm/components/Input.js +75 -0
- package/esm/components/InputBox.js +99 -0
- package/esm/components/InputBoxWithSuggestion.js +70 -0
- package/esm/components/InputJSONSchema.d.ts +2 -0
- package/esm/components/InputJSONSchema.js +7 -0
- package/esm/components/InputTable.js +176 -0
- package/esm/components/JSONSchemaEditor.d.ts +2 -0
- package/esm/components/JSONSchemaEditor.js +7 -0
- package/esm/components/Layout.js +60 -0
- package/esm/components/Link.js +44 -0
- package/esm/components/ListGroup.js +31 -0
- package/esm/components/ListMenu.js +62 -0
- package/esm/components/LocationPicker.js +208 -0
- package/esm/components/Markdown.d.ts +25 -0
- package/esm/components/Markdown.js +70 -0
- package/esm/components/Menu.d.ts +2 -0
- package/esm/components/Menu.js +7 -0
- package/esm/components/MixedInput.js +88 -0
- package/esm/components/MobileDevTool.d.ts +12 -0
- package/esm/components/MobileDevTool.js +312 -0
- package/esm/components/Modal.js +261 -0
- package/esm/components/ModalManager.d.ts +16 -0
- package/esm/components/ModalManager.js +42 -0
- package/esm/components/MultilineText.js +90 -0
- package/esm/components/NumberInput.js +274 -0
- package/esm/components/OverflowTpl.js +100 -0
- package/esm/components/Pagination.js +377 -0
- package/esm/components/PdfViewer.js +83 -0
- package/esm/components/Picker.js +73 -0
- package/esm/components/PickerColumn.js +276 -0
- package/esm/components/PickerContainer.js +157 -0
- package/esm/components/PopOverContainer.d.ts +59 -0
- package/esm/components/PopOverContainer.js +148 -0
- package/esm/components/PopUp.js +85 -0
- package/esm/components/Progress.js +136 -0
- package/esm/components/PullRefresh.js +172 -0
- package/esm/components/Radios.js +129 -0
- package/esm/components/Range.js +516 -0
- package/esm/components/Rating.js +341 -0
- package/esm/components/ResultBox.js +195 -0
- package/esm/components/ResultList.js +253 -0
- package/esm/components/ResultTableList.js +152 -0
- package/esm/components/ResultTreeList.js +241 -0
- package/esm/components/RichText.d.ts +48 -0
- package/esm/components/RichText.js +271 -0
- package/esm/components/SearchBox.js +298 -0
- package/esm/components/Select.js +814 -0
- package/esm/components/SelectMobile.d.ts +38 -0
- package/esm/components/SelectMobile.js +369 -0
- package/esm/components/Selection.js +166 -0
- package/esm/components/Shape.js +429 -0
- package/esm/components/Signature.js +294 -0
- package/esm/components/Slider.js +140 -0
- package/esm/components/SparkLine.js +62 -0
- package/esm/components/Spinner.js +202 -0
- package/esm/components/Steps.js +76 -0
- package/esm/components/Switch.js +73 -0
- package/esm/components/Tab.d.ts +2 -0
- package/esm/components/Tab.js +7 -0
- package/esm/components/Table.d.ts +2 -0
- package/esm/components/Table.js +7 -0
- package/esm/components/TableSelection.js +169 -0
- package/esm/components/Tabs.js +607 -0
- package/esm/components/TabsTransfer.js +221 -0
- package/esm/components/TabsTransferPicker.js +81 -0
- package/esm/components/Tag.js +137 -0
- package/esm/components/Textarea.js +146 -0
- package/esm/components/Timeline.js +60 -0
- package/esm/components/TimelineItem.js +101 -0
- package/esm/components/Tinymce.d.ts +66 -0
- package/esm/components/Tinymce.js +634 -0
- package/esm/components/TitleBar.js +48 -0
- package/esm/components/Toast.js +247 -0
- package/esm/components/Tooltip.js +36 -0
- package/esm/components/TooltipWrapper.js +180 -0
- package/esm/components/Transfer.js +485 -0
- package/esm/components/TransferDropDown.js +98 -0
- package/esm/components/TransferPicker.js +98 -0
- package/esm/components/TransferSearch.js +100 -0
- package/esm/components/Tree.js +1256 -0
- package/esm/components/TreeSelection.js +201 -0
- package/esm/components/UserSelect.js +674 -0
- package/esm/components/UserTabSelect.js +227 -0
- package/esm/components/VerificationCode.js +172 -0
- package/esm/components/VirtualList.d.ts +2 -0
- package/esm/components/VirtualList.js +7 -0
- package/esm/components/WithRemoteConfig.d.ts +70 -0
- package/esm/components/WithRemoteConfig.js +301 -0
- package/esm/components/WithStore.d.ts +13 -0
- package/esm/components/WithStore.js +48 -0
- package/esm/components/calendar/Calendar.d.ts +83 -0
- package/esm/components/calendar/Calendar.js +529 -0
- package/esm/components/calendar/CalendarContainer.d.ts +10 -0
- package/esm/components/calendar/CalendarContainer.js +27 -0
- package/esm/components/calendar/DaysView.js +528 -0
- package/esm/components/calendar/MonthsView.js +175 -0
- package/esm/components/calendar/QuartersView.js +125 -0
- package/esm/components/calendar/TimeView.js +559 -0
- package/esm/components/calendar/YearsView.js +122 -0
- package/esm/components/condition-builder/Expression.js +121 -0
- package/esm/components/condition-builder/Field.js +32 -0
- package/esm/components/condition-builder/Func.js +75 -0
- package/esm/components/condition-builder/Group.js +196 -0
- package/esm/components/condition-builder/GroupOrItem.js +107 -0
- package/esm/components/condition-builder/InputSwitch.js +28 -0
- package/esm/components/condition-builder/Item.js +233 -0
- package/esm/components/condition-builder/Value.js +115 -0
- package/esm/components/condition-builder/config.d.ts +36 -0
- package/esm/components/condition-builder/config.js +120 -0
- package/esm/components/condition-builder/index.js +242 -0
- package/esm/components/condition-builder/types.d.ts +116 -0
- package/esm/components/formula/CodeEditor.js +99 -0
- package/esm/components/formula/Editor.js +446 -0
- package/esm/components/formula/FuncList.js +64 -0
- package/esm/components/formula/Input.js +141 -0
- package/esm/components/formula/Picker.js +454 -0
- package/esm/components/formula/VariableList.js +185 -0
- package/esm/components/formula/plugin.d.ts +51 -0
- package/esm/components/formula/plugin.js +445 -0
- package/esm/components/icons.d.ts +61 -0
- package/esm/components/icons.js +458 -0
- package/esm/components/index.d.ts +138 -0
- package/esm/components/json-schema/Array.d.ts +3 -0
- package/esm/components/json-schema/Array.js +129 -0
- package/esm/components/json-schema/Item.d.ts +5 -0
- package/esm/components/json-schema/Item.js +63 -0
- package/esm/components/json-schema/Object.d.ts +5 -0
- package/esm/components/json-schema/Object.js +272 -0
- package/esm/components/json-schema/index.js +29 -0
- package/esm/components/menu/MenuContext.d.ts +82 -0
- package/esm/components/menu/MenuContext.js +25 -0
- package/esm/components/menu/MenuItem.js +112 -0
- package/esm/components/menu/PanelMenu.js +68 -0
- package/esm/components/menu/SubMenu.js +137 -0
- package/esm/components/menu/index.js +368 -0
- package/esm/components/schema-editor/Array.d.ts +11 -0
- package/esm/components/schema-editor/Array.js +84 -0
- package/esm/components/schema-editor/Common.d.ts +61 -0
- package/esm/components/schema-editor/Common.js +162 -0
- package/esm/components/schema-editor/Item.d.ts +8 -0
- package/esm/components/schema-editor/Item.js +24 -0
- package/esm/components/schema-editor/Object.d.ts +51 -0
- package/esm/components/schema-editor/Object.js +294 -0
- package/esm/components/schema-editor/SchemaVariableList.js +74 -0
- package/esm/components/schema-editor/SchemaVariableListPicker.js +34 -0
- package/esm/components/schema-editor/index.js +122 -0
- package/esm/components/table/Cell.d.ts +36 -0
- package/esm/components/table/Cell.js +43 -0
- package/esm/components/table/ColGroup.d.ts +24 -0
- package/esm/components/table/ColGroup.js +77 -0
- package/esm/components/table/Head.d.ts +45 -0
- package/esm/components/table/Head.js +150 -0
- package/esm/components/table/HeadCellDropDown.js +54 -0
- package/esm/components/table/HeadCellFilter.js +130 -0
- package/esm/components/table/HeadCellSelect.js +51 -0
- package/esm/components/table/HeadCellSort.js +88 -0
- package/esm/components/table/ItemActionsWrapper.d.ts +10 -0
- package/esm/components/table/ItemActionsWrapper.js +29 -0
- package/esm/components/table/Row.d.ts +56 -0
- package/esm/components/table/Row.js +224 -0
- package/esm/components/table/SummaryRow.d.ts +28 -0
- package/esm/components/table/SummaryRow.js +73 -0
- package/esm/components/table/index.js +1095 -0
- package/esm/components/table/util.d.ts +25 -0
- package/esm/components/table/util.js +279 -0
- package/esm/components/virtual-list/AutoSizer.d.ts +19 -0
- package/esm/components/virtual-list/AutoSizer.js +48 -0
- package/esm/components/virtual-list/SizeAndPositionManager.d.ts +70 -0
- package/esm/components/virtual-list/SizeAndPositionManager.js +216 -0
- package/esm/components/virtual-list/constants.d.ts +34 -0
- package/esm/components/virtual-list/constants.js +45 -0
- package/esm/components/virtual-list/index.d.ts +98 -0
- package/esm/components/virtual-list/index.js +288 -0
- package/esm/components/withBadge.d.ts +2 -0
- package/esm/components/withBadge.js +7 -0
- package/esm/hooks/index.d.ts +8 -0
- package/esm/hooks/use-click-away.d.ts +12 -0
- package/esm/hooks/use-click-away.js +55 -0
- package/esm/hooks/use-on-screen.d.ts +2 -0
- package/esm/hooks/use-on-screen.js +28 -0
- package/esm/hooks/use-set-state.d.ts +2 -0
- package/esm/hooks/use-set-state.js +19 -0
- package/esm/hooks/use-sub-form.d.ts +4 -0
- package/esm/hooks/use-sub-form.js +39 -0
- package/esm/hooks/use-touch.d.ts +16 -0
- package/esm/hooks/use-touch.js +77 -0
- package/esm/hooks/use-update-effect.d.ts +3 -0
- package/esm/hooks/use-update-effect.js +21 -0
- package/esm/hooks/use-validation-resolver.d.ts +7 -0
- package/esm/hooks/use-validation-resolver.js +115 -0
- package/esm/icons/alert-danger.svg.js +22 -0
- package/esm/icons/alert-info.svg.js +22 -0
- package/esm/icons/alert-success.svg.js +22 -0
- package/esm/icons/alert-warning.svg.js +22 -0
- package/esm/icons/arrow-double-left.svg.js +24 -0
- package/esm/icons/arrow-double-right.svg.js +24 -0
- package/esm/icons/back.svg.js +21 -0
- package/esm/icons/calendar.svg.js +31 -0
- package/esm/icons/caret.svg.js +21 -0
- package/esm/icons/check.svg.js +21 -0
- package/esm/icons/clock.svg.js +29 -0
- package/esm/icons/close-small.svg.js +24 -0
- package/esm/icons/close.svg.js +21 -0
- package/esm/icons/cloud-upload.svg.js +22 -0
- package/esm/icons/column-filter.svg.js +22 -0
- package/esm/icons/columns.svg.js +21 -0
- package/esm/icons/compress-alt.svg.js +21 -0
- package/esm/icons/copy.svg.js +26 -0
- package/esm/icons/date.svg.js +26 -0
- package/esm/icons/department.svg.js +52 -0
- package/esm/icons/desk-empty.svg.js +73 -0
- package/esm/icons/dot.svg.js +36 -0
- package/esm/icons/down-arrow-bold.svg.js +22 -0
- package/esm/icons/down.svg.js +23 -0
- package/esm/icons/download.svg.js +24 -0
- package/esm/icons/drag-bar.svg.js +53 -0
- package/esm/icons/drag.svg.js +22 -0
- package/esm/icons/edit.svg.js +21 -0
- package/esm/icons/ellipsis-v.svg.js +21 -0
- package/esm/icons/enter.svg.js +20 -0
- package/esm/icons/exchange.svg.js +21 -0
- package/esm/icons/expand-alt.svg.js +21 -0
- package/esm/icons/fail.svg.js +31 -0
- package/esm/icons/file.svg.js +22 -0
- package/esm/icons/filter.svg.js +21 -0
- package/esm/icons/folder.svg.js +24 -0
- package/esm/icons/fullscreen.svg.js +21 -0
- package/esm/icons/function.svg.js +21 -0
- package/esm/icons/home.svg.js +21 -0
- package/esm/icons/if.svg.js +21 -0
- package/esm/icons/image.svg.js +20 -0
- package/esm/icons/info-circle.svg.js +21 -0
- package/esm/icons/info.svg.js +27 -0
- package/esm/icons/input-clear.svg.js +20 -0
- package/esm/icons/invisible.svg.js +22 -0
- package/esm/icons/left-arrow.svg.js +23 -0
- package/esm/icons/loading-outline.svg.js +21 -0
- package/esm/icons/location.svg.js +20 -0
- package/esm/icons/menu.svg.js +20 -0
- package/esm/icons/minus.svg.js +21 -0
- package/esm/icons/move.svg.js +22 -0
- package/esm/icons/mute.svg.js +21 -0
- package/esm/icons/new-edit.svg.js +22 -0
- package/esm/icons/pause.svg.js +21 -0
- package/esm/icons/pencil.svg.js +21 -0
- package/esm/icons/play.svg.js +20 -0
- package/esm/icons/plus-cicle.svg.js +20 -0
- package/esm/icons/plus-fine.svg.js +21 -0
- package/esm/icons/plus.svg.js +21 -0
- package/esm/icons/post.svg.js +48 -0
- package/esm/icons/question-mark.svg.js +26 -0
- package/esm/icons/question.svg.js +21 -0
- package/esm/icons/question2.svg.js +34 -0
- package/esm/icons/redo.svg.js +21 -0
- package/esm/icons/refresh.svg.js +21 -0
- package/esm/icons/reload.svg.js +21 -0
- package/esm/icons/remove.svg.js +21 -0
- package/esm/icons/retry.svg.js +24 -0
- package/esm/icons/right-arrow-bold.svg.js +21 -0
- package/esm/icons/right-arrow.svg.js +23 -0
- package/esm/icons/right-double-arrow.svg.js +22 -0
- package/esm/icons/role.svg.js +43 -0
- package/esm/icons/rotate-left.svg.js +22 -0
- package/esm/icons/rotate-right.svg.js +22 -0
- package/esm/icons/rotate-screen.svg.js +21 -0
- package/esm/icons/scale-origin.svg.js +24 -0
- package/esm/icons/schedule.svg.js +24 -0
- package/esm/icons/search.svg.js +21 -0
- package/esm/icons/setting.svg.js +21 -0
- package/esm/icons/slider-handle-icon.svg.js +22 -0
- package/esm/icons/sort-asc.svg.js +21 -0
- package/esm/icons/sort-default.svg.js +21 -0
- package/esm/icons/sort-desc.svg.js +21 -0
- package/esm/icons/star.svg.js +21 -0
- package/esm/icons/status-close.svg.js +23 -0
- package/esm/icons/steps-finsh.svg.js +22 -0
- package/esm/icons/sub-plus.svg.js +20 -0
- package/esm/icons/success.svg.js +29 -0
- package/esm/icons/transparent.svg.js +38 -0
- package/esm/icons/trash.svg.js +22 -0
- package/esm/icons/tree-down.svg.js +21 -0
- package/esm/icons/undo-normal.svg.js +25 -0
- package/esm/icons/undo.svg.js +21 -0
- package/esm/icons/unfullscreen.svg.js +21 -0
- package/esm/icons/upload.svg.js +21 -0
- package/esm/icons/user-remove.svg.js +33 -0
- package/esm/icons/view.svg.js +22 -0
- package/esm/icons/volume.svg.js +24 -0
- package/esm/icons/warning-mark.svg.js +22 -0
- package/esm/icons/warning.svg.js +21 -0
- package/esm/icons/window-restore.svg.js +21 -0
- package/esm/icons/zoom-in.svg.js +21 -0
- package/esm/icons/zoom-out.svg.js +21 -0
- package/esm/index.d.ts +16 -0
- package/esm/index.js +157 -0
- package/esm/locale/de-DE.d.ts +1 -0
- package/esm/locale/de-DE.js +423 -0
- package/esm/locale/en-US.d.ts +1 -0
- package/esm/locale/en-US.js +429 -0
- package/esm/locale/zh-CN.d.ts +1 -0
- package/esm/locale/zh-CN.js +438 -0
- package/esm/themes/ang.d.ts +3 -0
- package/esm/themes/ang.js +15 -0
- package/esm/themes/antd.d.ts +1 -0
- package/esm/themes/antd.js +42 -0
- package/esm/themes/cxd.d.ts +3 -0
- package/esm/themes/cxd.js +455 -0
- package/esm/themes/dark.d.ts +3 -0
- package/esm/themes/dark.js +23 -0
- package/esm/themes/default.d.ts +4 -0
- package/esm/utils/index.d.ts +2 -0
- package/esm/utils/smoothSignature.d.ts +86 -0
- package/esm/utils/vectorComputed.d.ts +20 -0
- package/esm/utils/vectorComputed.js +75 -0
- package/esm/withRemoteConfig.d.ts +2 -0
- package/esm/withRemoteConfig.js +7 -0
- package/esm/withStore.d.ts +2 -0
- package/esm/withStore.js +7 -0
- package/lib/HTMLFilterContext.d.ts +3 -0
- package/lib/components/AlphabetIndexer.d.ts +11 -0
- package/lib/components/AnchorNavSection.d.ts +2 -0
- package/lib/components/AutoSizer.d.ts +2 -0
- package/lib/components/Badge.d.ts +20 -0
- package/lib/components/BarCode.js +44 -0
- package/lib/components/CityDB.d.ts +13 -0
- package/lib/components/CityDB.js +3945 -0
- package/lib/components/CodeMirror.d.ts +29 -0
- package/lib/components/ColorPicker.js +267 -0
- package/lib/components/ConditionBuilder.d.ts +2 -0
- package/lib/components/DiffEditor.d.ts +21 -0
- package/lib/components/Form.d.ts +31 -0
- package/lib/components/FormulaPicker.d.ts +2 -0
- package/lib/components/GridNav.d.ts +53 -0
- package/lib/components/GridNavItem.d.ts +2 -0
- package/lib/components/HeadCellDropDown.d.ts +2 -0
- package/lib/components/HorizontalScroll.d.ts +74 -0
- package/lib/components/Icon.d.ts +2 -0
- package/lib/components/Input.d.ts +18 -0
- package/lib/components/InputJSONSchema.d.ts +2 -0
- package/lib/components/JSONSchemaEditor.d.ts +2 -0
- package/lib/components/Markdown.d.ts +25 -0
- package/lib/components/Markdown.js +76 -0
- package/lib/components/Menu.d.ts +2 -0
- package/lib/components/MobileDevTool.d.ts +12 -0
- package/lib/components/ModalManager.d.ts +16 -0
- package/lib/components/PdfViewer.js +83 -0
- package/lib/components/PopOverContainer.d.ts +59 -0
- package/lib/components/RichText.d.ts +48 -0
- package/lib/components/RichText.js +275 -0
- package/lib/components/SelectMobile.d.ts +38 -0
- package/lib/components/Tab.d.ts +2 -0
- package/lib/components/Table.d.ts +2 -0
- package/lib/components/Tinymce.d.ts +66 -0
- package/lib/components/Tinymce.js +641 -0
- package/lib/components/VirtualList.d.ts +2 -0
- package/lib/components/WithRemoteConfig.d.ts +70 -0
- package/lib/components/WithStore.d.ts +13 -0
- package/lib/components/calendar/Calendar.d.ts +83 -0
- package/lib/components/calendar/CalendarContainer.d.ts +10 -0
- package/lib/components/condition-builder/config.d.ts +36 -0
- package/lib/components/condition-builder/types.d.ts +116 -0
- package/lib/components/formula/plugin.d.ts +51 -0
- package/lib/components/icons.d.ts +61 -0
- package/lib/components/index.d.ts +138 -0
- package/lib/components/json-schema/Array.d.ts +3 -0
- package/lib/components/json-schema/Item.d.ts +5 -0
- package/lib/components/json-schema/Object.d.ts +5 -0
- package/lib/components/menu/MenuContext.d.ts +82 -0
- package/lib/components/schema-editor/Array.d.ts +11 -0
- package/lib/components/schema-editor/Common.d.ts +61 -0
- package/lib/components/schema-editor/Item.d.ts +8 -0
- package/lib/components/schema-editor/Object.d.ts +51 -0
- package/lib/components/table/Cell.d.ts +36 -0
- package/lib/components/table/ColGroup.d.ts +24 -0
- package/lib/components/table/Head.d.ts +45 -0
- package/lib/components/table/ItemActionsWrapper.d.ts +10 -0
- package/lib/components/table/Row.d.ts +56 -0
- package/lib/components/table/SummaryRow.d.ts +28 -0
- package/lib/components/table/util.d.ts +25 -0
- package/lib/components/virtual-list/AutoSizer.d.ts +19 -0
- package/lib/components/virtual-list/SizeAndPositionManager.d.ts +70 -0
- package/lib/components/virtual-list/constants.d.ts +34 -0
- package/lib/components/virtual-list/index.d.ts +98 -0
- package/lib/components/withBadge.d.ts +2 -0
- package/lib/helper.css +47762 -0
- package/lib/hooks/index.d.ts +8 -0
- package/lib/hooks/use-click-away.d.ts +12 -0
- package/lib/hooks/use-on-screen.d.ts +2 -0
- package/lib/hooks/use-set-state.d.ts +2 -0
- package/lib/hooks/use-sub-form.d.ts +4 -0
- package/lib/hooks/use-touch.d.ts +16 -0
- package/lib/hooks/use-update-effect.d.ts +3 -0
- package/lib/hooks/use-validation-resolver.d.ts +7 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +28 -0
- package/lib/locale/de-DE.d.ts +1 -0
- package/lib/locale/en-US.d.ts +1 -0
- package/lib/locale/zh-CN.d.ts +1 -0
- package/lib/scss/helper.scss.js +12 -0
- package/lib/scss/themes/ang.scss.js +12 -0
- package/lib/scss/themes/antd.scss.js +12 -0
- package/lib/scss/themes/cxd.scss.js +12 -0
- package/lib/scss/themes/dark.scss.js +12 -0
- package/lib/scss/themes/default.scss.js +12 -0
- package/lib/themes/ang.css +45895 -0
- package/lib/themes/ang.d.ts +3 -0
- package/lib/themes/antd.css +45882 -0
- package/lib/themes/antd.d.ts +1 -0
- package/lib/themes/cxd.css +45871 -0
- package/lib/themes/cxd.d.ts +3 -0
- package/lib/themes/dark.css +45902 -0
- package/lib/themes/dark.d.ts +3 -0
- package/lib/themes/default.css +45871 -0
- package/lib/themes/default.d.ts +4 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/smoothSignature.d.ts +86 -0
- package/lib/utils/vectorComputed.d.ts +20 -0
- package/lib/withRemoteConfig.d.ts +2 -0
- package/lib/withStore.d.ts +2 -0
- package/package.json +158 -0
- package/scss/README.md +9 -0
- package/scss/_components.scss +4346 -0
- package/scss/_functions.scss +137 -0
- package/scss/_mixins.scss +805 -0
- package/scss/_properties.scss +898 -0
- package/scss/_thirds.scss +12 -0
- package/scss/_utilities.scss +1757 -0
- package/scss/_variables.scss +439 -0
- package/scss/base/_animate.scss +84 -0
- package/scss/base/_common.scss +19 -0
- package/scss/base/_normalize.scss +376 -0
- package/scss/base/_reset.scss +18 -0
- package/scss/base/_typography.scss +79 -0
- package/scss/components/_alert.scss +123 -0
- package/scss/components/_anchor-nav.scss +158 -0
- package/scss/components/_app.scss +46 -0
- package/scss/components/_array-input.scss +107 -0
- package/scss/components/_audio.scss +146 -0
- package/scss/components/_auto-folder.scss +40 -0
- package/scss/components/_avatar.scss +55 -0
- package/scss/components/_badge.scss +145 -0
- package/scss/components/_barcode.scss +6 -0
- package/scss/components/_breadcrumb.scss +110 -0
- package/scss/components/_button-group.scss +165 -0
- package/scss/components/_button.scss +871 -0
- package/scss/components/_calendar.scss +442 -0
- package/scss/components/_card.scss +389 -0
- package/scss/components/_card2.scss +28 -0
- package/scss/components/_cards.scss +221 -0
- package/scss/components/_carousel.scss +292 -0
- package/scss/components/_cascader.scss +157 -0
- package/scss/components/_chart.scss +22 -0
- package/scss/components/_city-area.scss +37 -0
- package/scss/components/_code.scss +10 -0
- package/scss/components/_collapse-group.scss +83 -0
- package/scss/components/_collapse.scss +245 -0
- package/scss/components/_color.scss +17 -0
- package/scss/components/_column-toggler.scss +261 -0
- package/scss/components/_condition-builder.scss +521 -0
- package/scss/components/_context-menu.scss +204 -0
- package/scss/components/_copyable.scss +10 -0
- package/scss/components/_crud.scss +195 -0
- package/scss/components/_crud2.scss +345 -0
- package/scss/components/_debug.scss +259 -0
- package/scss/components/_divider.scss +81 -0
- package/scss/components/_drawer.scss +393 -0
- package/scss/components/_dropdown-context-menus.scss +27 -0
- package/scss/components/_dropdown.scss +159 -0
- package/scss/components/_each.scss +7 -0
- package/scss/components/_formula.scss +723 -0
- package/scss/components/_grid-nav.scss +128 -0
- package/scss/components/_horizontal-scroll.scss +51 -0
- package/scss/components/_icon.scss +4 -0
- package/scss/components/_image-gallery.scss +331 -0
- package/scss/components/_images.scss +650 -0
- package/scss/components/_input-box.scss +111 -0
- package/scss/components/_json-schema-editor.scss +149 -0
- package/scss/components/_json-schema.scss +166 -0
- package/scss/components/_json.scss +7 -0
- package/scss/components/_link.scss +22 -0
- package/scss/components/_list-menu.scss +114 -0
- package/scss/components/_list.scss +313 -0
- package/scss/components/_log.scss +169 -0
- package/scss/components/_mapping.scss +6 -0
- package/scss/components/_markdown.scss +266 -0
- package/scss/components/_menu.scss +795 -0
- package/scss/components/_mobile-dev-tool.scss +175 -0
- package/scss/components/_modal.scss +282 -0
- package/scss/components/_multiline-text.scss +20 -0
- package/scss/components/_nav.scss +45 -0
- package/scss/components/_overflow-tpl.scss +5 -0
- package/scss/components/_page.scss +198 -0
- package/scss/components/_pagination.scss +403 -0
- package/scss/components/_panel.scss +263 -0
- package/scss/components/_pdf_viewer.scss +47 -0
- package/scss/components/_picker-columns.scss +140 -0
- package/scss/components/_popover.scss +54 -0
- package/scss/components/_popoverable.scss +100 -0
- package/scss/components/_popup.scss +171 -0
- package/scss/components/_portlet.scss +51 -0
- package/scss/components/_print.scss +13 -0
- package/scss/components/_progress.scss +165 -0
- package/scss/components/_property.scss +47 -0
- package/scss/components/_pull-refresh.scss +30 -0
- package/scss/components/_quick-edit.scss +53 -0
- package/scss/components/_remark.scss +58 -0
- package/scss/components/_result-box.scss +380 -0
- package/scss/components/_search-box.scss +267 -0
- package/scss/components/_service.scss +3 -0
- package/scss/components/_shape.scss +19 -0
- package/scss/components/_signature.scss +98 -0
- package/scss/components/_slider.scss +27 -0
- package/scss/components/_sparkline.scss +18 -0
- package/scss/components/_spinner.scss +214 -0
- package/scss/components/_status.scss +118 -0
- package/scss/components/_steps.scss +481 -0
- package/scss/components/_table.scss +1234 -0
- package/scss/components/_table2.scss +1066 -0
- package/scss/components/_tabs.scss +1410 -0
- package/scss/components/_tag.scss +191 -0
- package/scss/components/_timeline.scss +572 -0
- package/scss/components/_toast.scss +342 -0
- package/scss/components/_tooltip.scss +340 -0
- package/scss/components/_tpl.scss +51 -0
- package/scss/components/_verificationCode.scss +33 -0
- package/scss/components/_video.scss +38 -0
- package/scss/components/_wizard.scss +287 -0
- package/scss/components/_wrapper.scss +26 -0
- package/scss/components/form/_chained-select.scss +10 -0
- package/scss/components/form/_checks.scss +433 -0
- package/scss/components/form/_city.scss +33 -0
- package/scss/components/form/_color.scss +148 -0
- package/scss/components/form/_combo.scss +360 -0
- package/scss/components/form/_date-range.scss +332 -0
- package/scss/components/form/_date.scss +807 -0
- package/scss/components/form/_editor.scss +139 -0
- package/scss/components/form/_excel.scss +150 -0
- package/scss/components/form/_fieldset.scss +202 -0
- package/scss/components/form/_file.scss +308 -0
- package/scss/components/form/_form.scss +936 -0
- package/scss/components/form/_group.scss +116 -0
- package/scss/components/form/_icon-picker.scss +113 -0
- package/scss/components/form/_icon-select.scss +245 -0
- package/scss/components/form/_image.scss +359 -0
- package/scss/components/form/_input-group.scss +213 -0
- package/scss/components/form/_input-table.scss +17 -0
- package/scss/components/form/_list.scss +225 -0
- package/scss/components/form/_location.scss +210 -0
- package/scss/components/form/_matrix.scss +7 -0
- package/scss/components/form/_nested-select.scss +149 -0
- package/scss/components/form/_number.scss +633 -0
- package/scss/components/form/_picker.scss +237 -0
- package/scss/components/form/_qr-code.scss +4 -0
- package/scss/components/form/_range.scss +438 -0
- package/scss/components/form/_rating.scss +94 -0
- package/scss/components/form/_repeat.scss +40 -0
- package/scss/components/form/_result-list.scss +98 -0
- package/scss/components/form/_rich-text.scss +163 -0
- package/scss/components/form/_select.scss +712 -0
- package/scss/components/form/_selection.scss +485 -0
- package/scss/components/form/_sub-form.scss +118 -0
- package/scss/components/form/_switch.scss +228 -0
- package/scss/components/form/_tag.scss +146 -0
- package/scss/components/form/_text.scss +508 -0
- package/scss/components/form/_textarea.scss +78 -0
- package/scss/components/form/_tinymce.scss +6 -0
- package/scss/components/form/_transfer.scss +624 -0
- package/scss/components/form/_tree-select.scss +47 -0
- package/scss/components/form/_tree.scss +458 -0
- package/scss/components/form/_user-select.scss +643 -0
- package/scss/components/react-datetime.scss +267 -0
- package/scss/helper/background/_background-color.md +131 -0
- package/scss/helper/background/_background-color.scss +214 -0
- package/scss/helper/border/_border-color.md +109 -0
- package/scss/helper/border/_border-color.scss +178 -0
- package/scss/helper/border/_border-radius.md +86 -0
- package/scss/helper/border/_border-radius.scss +152 -0
- package/scss/helper/border/_border-style.md +11 -0
- package/scss/helper/border/_border-style.scss +40 -0
- package/scss/helper/border/_border-width.md +31 -0
- package/scss/helper/border/_border-width.scss +72 -0
- package/scss/helper/box-alignment/_align-content.md +12 -0
- package/scss/helper/box-alignment/_align-content.scss +44 -0
- package/scss/helper/box-alignment/_align-items.md +11 -0
- package/scss/helper/box-alignment/_align-items.scss +41 -0
- package/scss/helper/box-alignment/_align-self.md +11 -0
- package/scss/helper/box-alignment/_align-self.scss +40 -0
- package/scss/helper/box-alignment/_justify-content.md +12 -0
- package/scss/helper/box-alignment/_justify-content.scss +44 -0
- package/scss/helper/box-alignment/_justify-items.md +11 -0
- package/scss/helper/box-alignment/_justify-items.scss +40 -0
- package/scss/helper/box-alignment/_justify-self.md +11 -0
- package/scss/helper/box-alignment/_justify-self.scss +40 -0
- package/scss/helper/box-alignment/_place-content.md +13 -0
- package/scss/helper/box-alignment/_place-content.scss +48 -0
- package/scss/helper/box-alignment/_place-items.md +11 -0
- package/scss/helper/box-alignment/_place-items.scss +40 -0
- package/scss/helper/box-alignment/_place-self.md +11 -0
- package/scss/helper/box-alignment/_place-self.scss +40 -0
- package/scss/helper/effect/_box-shadow.md +16 -0
- package/scss/helper/effect/_box-shadow.scss +74 -0
- package/scss/helper/effect/_opacity.md +21 -0
- package/scss/helper/effect/_opacity.scss +66 -0
- package/scss/helper/flex/_direction.md +10 -0
- package/scss/helper/flex/_direction.scss +41 -0
- package/scss/helper/flex/_flex.md +10 -0
- package/scss/helper/flex/_flex.scss +38 -0
- package/scss/helper/flex/_grow.md +8 -0
- package/scss/helper/flex/_grow.scss +28 -0
- package/scss/helper/flex/_order.md +20 -0
- package/scss/helper/flex/_order.scss +56 -0
- package/scss/helper/flex/_shrink.md +8 -0
- package/scss/helper/flex/_shrink.scss +27 -0
- package/scss/helper/flex/_wrap.md +9 -0
- package/scss/helper/flex/_wrap.scss +36 -0
- package/scss/helper/grid/_auto-columns.md +10 -0
- package/scss/helper/grid/_auto-columns.scss +38 -0
- package/scss/helper/grid/_auto-flow.md +10 -0
- package/scss/helper/grid/_auto-flow.scss +38 -0
- package/scss/helper/grid/_auto-rows.md +10 -0
- package/scss/helper/grid/_auto-rows.scss +38 -0
- package/scss/helper/grid/_column-start-end.md +48 -0
- package/scss/helper/grid/_column-start-end.scss +201 -0
- package/scss/helper/grid/_columns.md +19 -0
- package/scss/helper/grid/_columns.scss +74 -0
- package/scss/helper/grid/_gap.md +117 -0
- package/scss/helper/grid/_gap.scss +154 -0
- package/scss/helper/grid/_row-start-end.md +48 -0
- package/scss/helper/grid/_row-start-end.scss +201 -0
- package/scss/helper/grid/_rows.md +13 -0
- package/scss/helper/grid/_rows.scss +50 -0
- package/scss/helper/layout/_box-sizing.md +35 -0
- package/scss/helper/layout/_box-sizing.scss +51 -0
- package/scss/helper/layout/_clear.md +27 -0
- package/scss/helper/layout/_clear.scss +56 -0
- package/scss/helper/layout/_display.md +41 -0
- package/scss/helper/layout/_display.scss +82 -0
- package/scss/helper/layout/_float.md +47 -0
- package/scss/helper/layout/_float.scss +71 -0
- package/scss/helper/layout/_overflow.md +34 -0
- package/scss/helper/layout/_overflow.scss +85 -0
- package/scss/helper/layout/_position.md +27 -0
- package/scss/helper/layout/_position.scss +55 -0
- package/scss/helper/layout/_top-right-bottom-left.md +150 -0
- package/scss/helper/layout/_top-right-bottom-left.scss +292 -0
- package/scss/helper/layout/_visibility.md +21 -0
- package/scss/helper/layout/_visibility.scss +42 -0
- package/scss/helper/layout/_z-index.md +37 -0
- package/scss/helper/layout/_z-index.scss +67 -0
- package/scss/helper/sizing/_height.md +103 -0
- package/scss/helper/sizing/_height.scss +161 -0
- package/scss/helper/sizing/_width.md +109 -0
- package/scss/helper/sizing/_width.scss +174 -0
- package/scss/helper/spacing/_margin.md +527 -0
- package/scss/helper/spacing/_margin.scss +821 -0
- package/scss/helper/spacing/_padding.md +265 -0
- package/scss/helper/spacing/_padding.scss +394 -0
- package/scss/helper/spacing/_space-between.md +155 -0
- package/scss/helper/spacing/_space-between.scss +224 -0
- package/scss/helper/typography/_font-family.md +9 -0
- package/scss/helper/typography/_font-family.scss +28 -0
- package/scss/helper/typography/_font-size.md +19 -0
- package/scss/helper/typography/_font-size.scss +40 -0
- package/scss/helper/typography/_font-style.md +8 -0
- package/scss/helper/typography/_font-style.scss +31 -0
- package/scss/helper/typography/_font-weight.md +15 -0
- package/scss/helper/typography/_font-weight.scss +49 -0
- package/scss/helper/typography/_letter-spacing.md +12 -0
- package/scss/helper/typography/_letter-spacing.scss +43 -0
- package/scss/helper/typography/_line-height.md +20 -0
- package/scss/helper/typography/_line-height.scss +59 -0
- package/scss/helper/typography/_list-style-type.md +11 -0
- package/scss/helper/typography/_list-style-type.scss +43 -0
- package/scss/helper/typography/_text-align.md +10 -0
- package/scss/helper/typography/_text-align.scss +34 -0
- package/scss/helper/typography/_text-color.md +110 -0
- package/scss/helper/typography/_text-color.scss +184 -0
- package/scss/helper/typography/_text-decoration.md +9 -0
- package/scss/helper/typography/_text-decoration.scss +34 -0
- package/scss/helper/typography/_text-overflow.md +9 -0
- package/scss/helper/typography/_text-overflow.scss +40 -0
- package/scss/helper/typography/_text-transform.md +10 -0
- package/scss/helper/typography/_text-transform.scss +40 -0
- package/scss/helper/typography/_vertical-align.md +12 -0
- package/scss/helper/typography/_vertical-align.scss +44 -0
- package/scss/helper/typography/_whitespace.md +11 -0
- package/scss/helper/typography/_whitespace.scss +42 -0
- package/scss/helper/typography/_word-break.md +9 -0
- package/scss/helper/typography/_word-break.scss +36 -0
- package/scss/helper.scss +72 -0
- package/scss/layout/_aside.scss +361 -0
- package/scss/layout/_grid.scss +173 -0
- package/scss/layout/_hbox.scss +127 -0
- package/scss/layout/_header.scss +0 -0
- package/scss/layout/_layout.scss +492 -0
- package/scss/layout/_vbox.scss +38 -0
- package/scss/themes/_ang-variables.scss +224 -0
- package/scss/themes/_antd-variables.scss +238 -0
- package/scss/themes/_common.scss +157 -0
- package/scss/themes/_cxd-variables.scss +222 -0
- package/scss/themes/_dark-variables.scss +229 -0
- package/scss/themes/ang-ie11.scss +1 -0
- package/scss/themes/ang.scss +27 -0
- package/scss/themes/antd-ie11.scss +1 -0
- package/scss/themes/antd.scss +5 -0
- package/scss/themes/cxd-ie11.scss +1 -0
- package/scss/themes/cxd.scss +5 -0
- package/scss/themes/dark-ie11.scss +1 -0
- package/scss/themes/dark.scss +34 -0
- package/scss/themes/default.scss +2 -0
- package/scss/themes/extract-antd-color.py +27 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-rev-ui v6.13.0
|
|
3
|
+
* Copyright 2018-2026 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { __extends, __awaiter, __generator, __spreadArray, __read, __assign, __rest, __decorate, __metadata } from 'tslib';
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import { eachTree, parse, resolveVariableAndFilterForAsync, autobind, uncontrollable, themeable, localeable } from 'amis-rev-core';
|
|
9
|
+
import { editorFactory } from './plugin.js';
|
|
10
|
+
import FuncList from './FuncList.js';
|
|
11
|
+
import VariableList from './VariableList.js';
|
|
12
|
+
import { toast } from '../Toast.js';
|
|
13
|
+
import Switch from '../Switch.js';
|
|
14
|
+
import CodeEditor from './CodeEditor.js';
|
|
15
|
+
import { getFunctionsDoc } from 'amis-rev-formula';
|
|
16
|
+
import Transition, { EXITED, EXITING, ENTERING } from 'react-transition-group/Transition';
|
|
17
|
+
import MonacoEditor from '../Editor.js';
|
|
18
|
+
import debounce from 'lodash/debounce';
|
|
19
|
+
|
|
20
|
+
var _a;
|
|
21
|
+
var collapseStyles = (_a = {},
|
|
22
|
+
_a[EXITED] = 'out',
|
|
23
|
+
_a[EXITING] = 'out',
|
|
24
|
+
_a[ENTERING] = 'in',
|
|
25
|
+
_a);
|
|
26
|
+
var FormulaEditor = /** @class */ (function (_super) {
|
|
27
|
+
__extends(FormulaEditor, _super);
|
|
28
|
+
function FormulaEditor(props) {
|
|
29
|
+
var _this = _super.call(this, props) || this;
|
|
30
|
+
_this.state = {
|
|
31
|
+
focused: false,
|
|
32
|
+
isCodeMode: false,
|
|
33
|
+
showRunPanel: false,
|
|
34
|
+
expandTree: false,
|
|
35
|
+
functions: _this.props.functions,
|
|
36
|
+
runContext: '{\n}',
|
|
37
|
+
runResult: '',
|
|
38
|
+
runValid: false
|
|
39
|
+
};
|
|
40
|
+
_this.unmounted = false;
|
|
41
|
+
_this.editor = React__default.createRef();
|
|
42
|
+
_this.runCode = debounce(_this.runCode.bind(_this), 250, {
|
|
43
|
+
leading: false,
|
|
44
|
+
trailing: true
|
|
45
|
+
});
|
|
46
|
+
return _this;
|
|
47
|
+
}
|
|
48
|
+
FormulaEditor.buildFunctions = function (functions, functionsFilter) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
var builtInFunctions, customFunctions, functionList;
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0: return [4 /*yield*/, getFunctionsDoc()];
|
|
54
|
+
case 1:
|
|
55
|
+
builtInFunctions = _a.sent();
|
|
56
|
+
customFunctions = Array.isArray(functions) ? functions : [];
|
|
57
|
+
functionList = __spreadArray(__spreadArray([], __read(builtInFunctions), false), __read(customFunctions), false);
|
|
58
|
+
if (functionsFilter) {
|
|
59
|
+
return [2 /*return*/, functionsFilter(functionList)];
|
|
60
|
+
}
|
|
61
|
+
return [2 /*return*/, functionList];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
FormulaEditor.replaceStrByIndex = function (str, idx, key, replaceKey) {
|
|
67
|
+
var from = str.slice(0, idx);
|
|
68
|
+
var left = str.slice(idx);
|
|
69
|
+
return from + left.replace(key, replaceKey);
|
|
70
|
+
};
|
|
71
|
+
FormulaEditor.getRegExpByMode = function (evalMode, key) {
|
|
72
|
+
var reg = evalMode
|
|
73
|
+
? "\\b".concat(key, "\\b")
|
|
74
|
+
: "\\$\\{[^\\{\\}]*\\b".concat(key, "\\b[^\\{\\}]*\\}");
|
|
75
|
+
return new RegExp(reg);
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* 干不掉,太多地方使用了,但是要废弃了。
|
|
79
|
+
* 不要用了,输入框也换成 codemirror 了,本身就支持高亮
|
|
80
|
+
* @deprecated
|
|
81
|
+
* @param value
|
|
82
|
+
* @param variables
|
|
83
|
+
* @param evalMode
|
|
84
|
+
* @returns
|
|
85
|
+
*/
|
|
86
|
+
FormulaEditor.highlightValue = function (value, variables, evalMode, sourceCode) {
|
|
87
|
+
if (evalMode === void 0) { evalMode = true; }
|
|
88
|
+
if (sourceCode === void 0) { sourceCode = true; }
|
|
89
|
+
if (!Array.isArray(variables) || !variables.length || !value) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (typeof value !== 'string') {
|
|
93
|
+
try {
|
|
94
|
+
value = JSON.stringify(value);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error('[amis][formula] given value is not a string');
|
|
98
|
+
value = '';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
var varMap = {};
|
|
102
|
+
eachTree(variables, function (item) {
|
|
103
|
+
var _a;
|
|
104
|
+
if (item.value) {
|
|
105
|
+
var key = item.value;
|
|
106
|
+
varMap[key] = (_a = item.path) !== null && _a !== void 0 ? _a : item.label;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
var vars = Object.keys(varMap)
|
|
110
|
+
.filter(function (item) { return item; })
|
|
111
|
+
.sort(function (a, b) { return b.length - a.length; });
|
|
112
|
+
var content = value || '';
|
|
113
|
+
var html = '';
|
|
114
|
+
// 标记方法调用
|
|
115
|
+
html = content.replace(/([A-Z]+)\s*\(/g, function (_, func, pos) {
|
|
116
|
+
return _ === null || _ === void 0 ? void 0 : _.replace(func, "<span class=\"c-func\">".concat(func, "</span>"));
|
|
117
|
+
});
|
|
118
|
+
var REPLACE_KEY = 'AMIS_FORMULA_REPLACE_KEY';
|
|
119
|
+
vars.forEach(function (v) {
|
|
120
|
+
var from = 0;
|
|
121
|
+
var idx = -1;
|
|
122
|
+
while (~(idx = content.indexOf(v, from))) {
|
|
123
|
+
var encodeHtml = FormulaEditor.replaceStrByIndex(html, idx, v, REPLACE_KEY);
|
|
124
|
+
var reg = FormulaEditor.getRegExpByMode(evalMode, REPLACE_KEY);
|
|
125
|
+
// 如果匹配到则高亮,没有匹配到替换成原值
|
|
126
|
+
if (reg.test(encodeHtml)) {
|
|
127
|
+
html = encodeHtml.replace(REPLACE_KEY, "<span class=\"c-field\">".concat(sourceCode ? v : varMap[v], "</span>"));
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
html = encodeHtml.replace(REPLACE_KEY, v);
|
|
131
|
+
}
|
|
132
|
+
from = idx + v.length;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return { html: html };
|
|
136
|
+
};
|
|
137
|
+
FormulaEditor.prototype.componentDidMount = function () {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
139
|
+
var functionList, unMerged_1, functions;
|
|
140
|
+
return __generator(this, function (_a) {
|
|
141
|
+
switch (_a.label) {
|
|
142
|
+
case 0: return [4 /*yield*/, FormulaEditor.buildFunctions()];
|
|
143
|
+
case 1:
|
|
144
|
+
functionList = _a.sent();
|
|
145
|
+
if (this.unmounted || !Array.isArray(functionList)) {
|
|
146
|
+
return [2 /*return*/];
|
|
147
|
+
}
|
|
148
|
+
if (!this.state.functions) {
|
|
149
|
+
this.setState({
|
|
150
|
+
functions: functionList
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
unMerged_1 = functionList.concat();
|
|
155
|
+
functions = this.state.functions
|
|
156
|
+
.map(function (group) {
|
|
157
|
+
var idx = unMerged_1.findIndex(function (item) { return item.groupName === group.groupName; });
|
|
158
|
+
if (~idx) {
|
|
159
|
+
var item = unMerged_1.splice(idx, 1)[0];
|
|
160
|
+
return __assign(__assign({}, group), { items: group.items
|
|
161
|
+
.concat(item.items)
|
|
162
|
+
.filter(function (item, index, list) {
|
|
163
|
+
// 过滤掉重复的函数
|
|
164
|
+
return list.findIndex(function (i) { return i.name === item.name; }) === index;
|
|
165
|
+
}) });
|
|
166
|
+
}
|
|
167
|
+
return group;
|
|
168
|
+
})
|
|
169
|
+
.concat(unMerged_1);
|
|
170
|
+
this.setState({
|
|
171
|
+
functions: functions
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return [2 /*return*/];
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
FormulaEditor.prototype.componentDidUpdate = function (prevProps) {
|
|
180
|
+
if (prevProps.functions !== this.props.functions) {
|
|
181
|
+
this.setState({
|
|
182
|
+
functions: this.props.functions
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
FormulaEditor.prototype.componentWillUnmount = function () {
|
|
187
|
+
this.unmounted = true;
|
|
188
|
+
this.runCode.cancel();
|
|
189
|
+
};
|
|
190
|
+
FormulaEditor.prototype.handleFocus = function () {
|
|
191
|
+
this.setState({
|
|
192
|
+
focused: true
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
FormulaEditor.prototype.handleBlur = function () {
|
|
196
|
+
this.setState({
|
|
197
|
+
focused: false
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
FormulaEditor.prototype.getEditor = function () {
|
|
201
|
+
var ref = this.editor.current;
|
|
202
|
+
while (ref === null || ref === void 0 ? void 0 : ref.getWrappedInstance) {
|
|
203
|
+
ref = ref.getWrappedInstance();
|
|
204
|
+
}
|
|
205
|
+
return ref;
|
|
206
|
+
};
|
|
207
|
+
FormulaEditor.prototype.insertValue = function (value, type) {
|
|
208
|
+
var _a;
|
|
209
|
+
(_a = this.getEditor()) === null || _a === void 0 ? void 0 : _a.insertContent(value, type);
|
|
210
|
+
};
|
|
211
|
+
FormulaEditor.prototype.validate = function () {
|
|
212
|
+
var value = this.props.value;
|
|
213
|
+
try {
|
|
214
|
+
value
|
|
215
|
+
? parse(value, {
|
|
216
|
+
evalMode: this.props.evalMode
|
|
217
|
+
})
|
|
218
|
+
: null;
|
|
219
|
+
}
|
|
220
|
+
catch (e) {
|
|
221
|
+
return e.message;
|
|
222
|
+
}
|
|
223
|
+
return;
|
|
224
|
+
};
|
|
225
|
+
FormulaEditor.prototype.handleFunctionSelect = function (item) {
|
|
226
|
+
var _a;
|
|
227
|
+
(_a = this.getEditor()) === null || _a === void 0 ? void 0 : _a.insertContent("".concat(item.name), 'func');
|
|
228
|
+
};
|
|
229
|
+
FormulaEditor.prototype.handleVariableSelect = function (item) {
|
|
230
|
+
var _a;
|
|
231
|
+
var selfVariableName = this.props.selfVariableName;
|
|
232
|
+
if (item &&
|
|
233
|
+
item.value &&
|
|
234
|
+
selfVariableName &&
|
|
235
|
+
selfVariableName === item.value) {
|
|
236
|
+
toast.warning('不能使用当前变量[self],避免循环引用。');
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (!item.value) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
(_a = this.getEditor()) === null || _a === void 0 ? void 0 : _a.insertContent(item.isMember
|
|
243
|
+
? item.value
|
|
244
|
+
: {
|
|
245
|
+
key: item.value,
|
|
246
|
+
name: item.label,
|
|
247
|
+
path: item.path
|
|
248
|
+
// chunks: item.chunks
|
|
249
|
+
}, item.isMember ? undefined : 'variable', 'cm-field', !this.state.isCodeMode);
|
|
250
|
+
};
|
|
251
|
+
FormulaEditor.prototype.handleOnChange = function (value) {
|
|
252
|
+
var onChange = this.props.onChange;
|
|
253
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
254
|
+
this.runCode();
|
|
255
|
+
};
|
|
256
|
+
FormulaEditor.prototype.editorFactory = function (dom, cm) {
|
|
257
|
+
var _a = this.props; _a.editorOptions; var rest = __rest(_a, ["editorOptions"]);
|
|
258
|
+
return editorFactory(dom, cm, rest, {
|
|
259
|
+
lineWrapping: true, // 自动换行
|
|
260
|
+
autoFocus: true
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
FormulaEditor.prototype.handleIsCodeModeChange = function (showCode) {
|
|
264
|
+
var _this = this;
|
|
265
|
+
// 重置一下value
|
|
266
|
+
// this.getEditor()?.setValue(this.getEditor()?.getValue());
|
|
267
|
+
// 非源码模式,则mark一下
|
|
268
|
+
// !showCode && this.getEditor()?.autoMarkText();
|
|
269
|
+
this.setState({ isCodeMode: showCode }, function () { var _a; return (_a = _this.getEditor()) === null || _a === void 0 ? void 0 : _a.setDisableAutoMark(showCode ? true : false); });
|
|
270
|
+
};
|
|
271
|
+
FormulaEditor.prototype.toggleRunPanel = function () {
|
|
272
|
+
this.setState({
|
|
273
|
+
showRunPanel: !this.state.showRunPanel
|
|
274
|
+
}, this.runCode);
|
|
275
|
+
};
|
|
276
|
+
FormulaEditor.prototype.handleRunContextChange = function (value) {
|
|
277
|
+
this.setState({ runContext: value }, this.runCode);
|
|
278
|
+
};
|
|
279
|
+
FormulaEditor.prototype.runCode = function () {
|
|
280
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
281
|
+
var value, runContext, code, result, e_1;
|
|
282
|
+
return __generator(this, function (_a) {
|
|
283
|
+
switch (_a.label) {
|
|
284
|
+
case 0:
|
|
285
|
+
value = this.props.value || '';
|
|
286
|
+
if (!this.state.showRunPanel) {
|
|
287
|
+
return [2 /*return*/];
|
|
288
|
+
}
|
|
289
|
+
_a.label = 1;
|
|
290
|
+
case 1:
|
|
291
|
+
_a.trys.push([1, 3, , 4]);
|
|
292
|
+
// 因为 resolveVariableAndFilterForAsync 不会报语法错误
|
|
293
|
+
parse(value, {
|
|
294
|
+
evalMode: this.props.evalMode
|
|
295
|
+
});
|
|
296
|
+
runContext = JSON.parse(this.state.runContext);
|
|
297
|
+
code = this.props.evalMode ? "${".concat(value, "}") : value;
|
|
298
|
+
return [4 /*yield*/, resolveVariableAndFilterForAsync(code, runContext)];
|
|
299
|
+
case 2:
|
|
300
|
+
result = _a.sent();
|
|
301
|
+
this.unmounted ||
|
|
302
|
+
this.setState({
|
|
303
|
+
runValid: true,
|
|
304
|
+
runResult: JSON.stringify(result)
|
|
305
|
+
});
|
|
306
|
+
return [3 /*break*/, 4];
|
|
307
|
+
case 3:
|
|
308
|
+
e_1 = _a.sent();
|
|
309
|
+
this.unmounted ||
|
|
310
|
+
this.setState({
|
|
311
|
+
runValid: false,
|
|
312
|
+
runResult: e_1.message
|
|
313
|
+
});
|
|
314
|
+
return [3 /*break*/, 4];
|
|
315
|
+
case 4: return [2 /*return*/];
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
FormulaEditor.prototype.handleExpandTreeChange = function (expand) {
|
|
321
|
+
this.setState({ expandTree: expand });
|
|
322
|
+
};
|
|
323
|
+
FormulaEditor.prototype.render = function () {
|
|
324
|
+
var _this = this;
|
|
325
|
+
var _a = this.props, header = _a.header, value = _a.value, variables = _a.variables, variableMode = _a.variableMode, __ = _a.translate, cx = _a.classnames, variableClassName = _a.variableClassName, functionClassName = _a.functionClassName, classPrefix = _a.classPrefix, selfVariableName = _a.selfVariableName, evalMode = _a.evalMode, simplifyMemberOprs = _a.simplifyMemberOprs, _b = _a.enableRunPanel, enableRunPanel = _b === void 0 ? true : _b;
|
|
326
|
+
var _c = this.state, focused = _c.focused, isCodeMode = _c.isCodeMode, showRunPanel = _c.showRunPanel, expandTree = _c.expandTree, functions = _c.functions, runContext = _c.runContext, runResult = _c.runResult, runValid = _c.runValid;
|
|
327
|
+
return (React__default.createElement("div", { className: cx("FormulaEditor", {
|
|
328
|
+
'is-focused': focused
|
|
329
|
+
}) },
|
|
330
|
+
React__default.createElement("section", { className: cx('FormulaEditor-settings') },
|
|
331
|
+
React__default.createElement(FuncList, { className: functionClassName, title: __('FormulaEditor.function'), data: functions || [], onSelect: this.handleFunctionSelect }),
|
|
332
|
+
React__default.createElement("div", { className: cx("FormulaEditor-content") },
|
|
333
|
+
React__default.createElement("header", { className: cx("FormulaEditor-header") },
|
|
334
|
+
__(header || 'FormulaEditor.title'),
|
|
335
|
+
enableRunPanel ? (React__default.createElement("div", { className: cx("FormulaEditor-header-toolbar m-l") },
|
|
336
|
+
React__default.createElement("span", null, __('FormulaEditor.run')),
|
|
337
|
+
React__default.createElement(Switch, { value: showRunPanel, onChange: this.toggleRunPanel }))) : null,
|
|
338
|
+
React__default.createElement("div", { className: cx("FormulaEditor-header-toolbar") },
|
|
339
|
+
React__default.createElement("span", null, __('FormulaEditor.sourceMode')),
|
|
340
|
+
React__default.createElement(Switch, { value: isCodeMode, onChange: this.handleIsCodeModeChange }))),
|
|
341
|
+
React__default.createElement(CodeEditor, { evalMode: evalMode, functions: functions, variables: variables, className: cx('FormulaEditor-editor'), value: value, onChange: this.handleOnChange, ref: this.editor, onFocus: this.handleFocus, onBlur: this.handleBlur, autoFocus: true }),
|
|
342
|
+
React__default.createElement(Transition, { mountOnEnter: true, unmountOnExit: true, key: "run-panel", in: showRunPanel, timeout: 300 }, function (status) {
|
|
343
|
+
return (React__default.createElement("div", { className: cx("FormulaEditor-runPanel", collapseStyles[status]) },
|
|
344
|
+
React__default.createElement("div", { className: cx("FormulaEditor-runPanel-context") },
|
|
345
|
+
React__default.createElement("header", null, __('FormulaEditor.runContext')),
|
|
346
|
+
React__default.createElement("div", null,
|
|
347
|
+
React__default.createElement(MonacoEditor, { value: runContext, onChange: _this.handleRunContextChange, language: "json", options: {
|
|
348
|
+
tabSize: 2,
|
|
349
|
+
lineNumbers: false
|
|
350
|
+
} }))),
|
|
351
|
+
React__default.createElement("div", { className: cx("FormulaEditor-runPanel-result", runValid ? '' : 'is-error') },
|
|
352
|
+
React__default.createElement("header", null, __('FormulaEditor.runResult')),
|
|
353
|
+
React__default.createElement("div", null, runResult))));
|
|
354
|
+
})),
|
|
355
|
+
React__default.createElement("div", { className: cx('FormulaEditor-panel', 'right') },
|
|
356
|
+
variableMode !== 'tabs' ? (React__default.createElement("div", { className: cx('FormulaEditor-panel-header') },
|
|
357
|
+
__('FormulaEditor.variable'),
|
|
358
|
+
variableMode === 'tree' ? (React__default.createElement("div", { className: cx("FormulaEditor-header-toolbar") },
|
|
359
|
+
React__default.createElement("span", null, __('FormulaEditor.toggleAll')),
|
|
360
|
+
React__default.createElement(Switch, { value: expandTree, onChange: this.handleExpandTreeChange }))) : null)) : null,
|
|
361
|
+
React__default.createElement("div", { className: cx('FormulaEditor-panel-body', variableMode && "FormulaEditor-panel-body--".concat(variableMode)) },
|
|
362
|
+
React__default.createElement(VariableList, { classPrefix: classPrefix, className: cx('FormulaEditor-VariableList', 'FormulaEditor-VariableList-root', variableClassName), expandTree: expandTree, selectMode: variableMode, data: variables, onSelect: this.handleVariableSelect, selfVariableName: selfVariableName, simplifyMemberOprs: simplifyMemberOprs }))))));
|
|
363
|
+
};
|
|
364
|
+
FormulaEditor.defaultProps = {
|
|
365
|
+
variables: [],
|
|
366
|
+
evalMode: true
|
|
367
|
+
};
|
|
368
|
+
__decorate([
|
|
369
|
+
autobind,
|
|
370
|
+
__metadata("design:type", Function),
|
|
371
|
+
__metadata("design:paramtypes", []),
|
|
372
|
+
__metadata("design:returntype", void 0)
|
|
373
|
+
], FormulaEditor.prototype, "handleFocus", null);
|
|
374
|
+
__decorate([
|
|
375
|
+
autobind,
|
|
376
|
+
__metadata("design:type", Function),
|
|
377
|
+
__metadata("design:paramtypes", []),
|
|
378
|
+
__metadata("design:returntype", void 0)
|
|
379
|
+
], FormulaEditor.prototype, "handleBlur", null);
|
|
380
|
+
__decorate([
|
|
381
|
+
autobind,
|
|
382
|
+
__metadata("design:type", Function),
|
|
383
|
+
__metadata("design:paramtypes", [Object, String]),
|
|
384
|
+
__metadata("design:returntype", void 0)
|
|
385
|
+
], FormulaEditor.prototype, "insertValue", null);
|
|
386
|
+
__decorate([
|
|
387
|
+
autobind,
|
|
388
|
+
__metadata("design:type", Function),
|
|
389
|
+
__metadata("design:paramtypes", []),
|
|
390
|
+
__metadata("design:returntype", void 0)
|
|
391
|
+
], FormulaEditor.prototype, "validate", null);
|
|
392
|
+
__decorate([
|
|
393
|
+
autobind,
|
|
394
|
+
__metadata("design:type", Function),
|
|
395
|
+
__metadata("design:paramtypes", [Object]),
|
|
396
|
+
__metadata("design:returntype", void 0)
|
|
397
|
+
], FormulaEditor.prototype, "handleFunctionSelect", null);
|
|
398
|
+
__decorate([
|
|
399
|
+
autobind,
|
|
400
|
+
__metadata("design:type", Function),
|
|
401
|
+
__metadata("design:paramtypes", [Object]),
|
|
402
|
+
__metadata("design:returntype", void 0)
|
|
403
|
+
], FormulaEditor.prototype, "handleVariableSelect", null);
|
|
404
|
+
__decorate([
|
|
405
|
+
autobind,
|
|
406
|
+
__metadata("design:type", Function),
|
|
407
|
+
__metadata("design:paramtypes", [Object]),
|
|
408
|
+
__metadata("design:returntype", void 0)
|
|
409
|
+
], FormulaEditor.prototype, "handleOnChange", null);
|
|
410
|
+
__decorate([
|
|
411
|
+
autobind,
|
|
412
|
+
__metadata("design:type", Function),
|
|
413
|
+
__metadata("design:paramtypes", [HTMLElement, Object]),
|
|
414
|
+
__metadata("design:returntype", void 0)
|
|
415
|
+
], FormulaEditor.prototype, "editorFactory", null);
|
|
416
|
+
__decorate([
|
|
417
|
+
autobind,
|
|
418
|
+
__metadata("design:type", Function),
|
|
419
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
420
|
+
__metadata("design:returntype", void 0)
|
|
421
|
+
], FormulaEditor.prototype, "handleIsCodeModeChange", null);
|
|
422
|
+
__decorate([
|
|
423
|
+
autobind,
|
|
424
|
+
__metadata("design:type", Function),
|
|
425
|
+
__metadata("design:paramtypes", []),
|
|
426
|
+
__metadata("design:returntype", void 0)
|
|
427
|
+
], FormulaEditor.prototype, "toggleRunPanel", null);
|
|
428
|
+
__decorate([
|
|
429
|
+
autobind,
|
|
430
|
+
__metadata("design:type", Function),
|
|
431
|
+
__metadata("design:paramtypes", [String]),
|
|
432
|
+
__metadata("design:returntype", void 0)
|
|
433
|
+
], FormulaEditor.prototype, "handleRunContextChange", null);
|
|
434
|
+
__decorate([
|
|
435
|
+
autobind,
|
|
436
|
+
__metadata("design:type", Function),
|
|
437
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
438
|
+
__metadata("design:returntype", void 0)
|
|
439
|
+
], FormulaEditor.prototype, "handleExpandTreeChange", null);
|
|
440
|
+
return FormulaEditor;
|
|
441
|
+
}(React__default.Component));
|
|
442
|
+
var Editor = uncontrollable(themeable(localeable(FormulaEditor)), {
|
|
443
|
+
value: 'onChange'
|
|
444
|
+
}, ['validate']);
|
|
445
|
+
|
|
446
|
+
export { FormulaEditor, Editor as default };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-rev-ui v6.13.0
|
|
3
|
+
* Copyright 2018-2026 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { __read, __assign } from 'tslib';
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import { themeable } from 'amis-rev-core';
|
|
9
|
+
import Collapse from '../Collapse.js';
|
|
10
|
+
import CollapseGroup from '../CollapseGroup.js';
|
|
11
|
+
import SearchBox from '../SearchBox.js';
|
|
12
|
+
import TooltipWrapper from '../TooltipWrapper.js';
|
|
13
|
+
import { Icon } from '../icons.js';
|
|
14
|
+
|
|
15
|
+
function FuncList(props) {
|
|
16
|
+
var _a;
|
|
17
|
+
var title = props.title, className = props.className, cx = props.classnames, bodyClassName = props.bodyClassName, descClassName = props.descClassName, mobileUI = props.mobileUI;
|
|
18
|
+
var _b = __read(React__default.useState(''), 2), term = _b[0], setTerm = _b[1];
|
|
19
|
+
var _c = __read(React__default.useState(props.data), 2), filteredFuncs = _c[0], setFiteredFuncs = _c[1];
|
|
20
|
+
var _d = __read(React__default.useState(null), 2), activeFunc = _d[0], setActiveFunc = _d[1];
|
|
21
|
+
var onSearch = React__default.useCallback(function (term) {
|
|
22
|
+
term = term.trim();
|
|
23
|
+
var filtered = props.data
|
|
24
|
+
.map(function (item) {
|
|
25
|
+
return __assign(__assign({}, item), { items: term
|
|
26
|
+
? item.items.filter(function (item) { return ~item.name.indexOf(term.toUpperCase()); })
|
|
27
|
+
: item.items });
|
|
28
|
+
})
|
|
29
|
+
.filter(function (item) { return item.items.length; });
|
|
30
|
+
setFiteredFuncs(filtered);
|
|
31
|
+
}, [props.data]);
|
|
32
|
+
React__default.useEffect(function () {
|
|
33
|
+
onSearch(term);
|
|
34
|
+
}, [props.data]);
|
|
35
|
+
return (React__default.createElement("div", { className: cx('FormulaEditor-panel', 'left', className) },
|
|
36
|
+
React__default.createElement("div", { className: cx('FormulaEditor-FuncList', (activeFunc === null || activeFunc === void 0 ? void 0 : activeFunc.name) ? 'withDoc' : '') },
|
|
37
|
+
React__default.createElement("div", { className: cx('FormulaEditor-panel-header') }, title),
|
|
38
|
+
React__default.createElement("div", { className: cx('FormulaEditor-panel-body') },
|
|
39
|
+
React__default.createElement("div", { className: cx('FormulaEditor-FuncList-searchBox') },
|
|
40
|
+
React__default.createElement(SearchBox, { value: term, onChange: setTerm, mini: false, onSearch: onSearch, mobileUI: mobileUI })),
|
|
41
|
+
React__default.createElement("div", { className: cx('FormulaEditor-FuncList-body', bodyClassName) },
|
|
42
|
+
React__default.createElement(CollapseGroup, { className: cx('FormulaEditor-FuncList-collapseGroup'), defaultActiveKey: (_a = filteredFuncs[0]) === null || _a === void 0 ? void 0 : _a.groupName, expandIcon: React__default.createElement(Icon, { cx: cx, icon: "fa fa-chevron-right FormulaEditor-FuncList-expandIcon", className: "Icon" }), accordion: true }, filteredFuncs.map(function (item) { return (React__default.createElement(Collapse, { className: cx('FormulaEditor-FuncList-collapse'), headingClassName: cx('FormulaEditor-FuncList-groupTitle'), bodyClassName: cx('FormulaEditor-FuncList-groupBody'), propKey: item.groupName, header: item.groupName, key: item.groupName }, item.items.map(function (item) { return (React__default.createElement("div", { className: cx('FormulaEditor-FuncList-item', {
|
|
43
|
+
'is-active': item.name === (activeFunc === null || activeFunc === void 0 ? void 0 : activeFunc.name)
|
|
44
|
+
}), onMouseEnter: function () { return setActiveFunc(item); }, onClick: function () { var _a; return (_a = props.onSelect) === null || _a === void 0 ? void 0 : _a.call(props, item); }, key: item.name }, item.name)); }))); }))))),
|
|
45
|
+
(activeFunc === null || activeFunc === void 0 ? void 0 : activeFunc.name) ? (React__default.createElement("div", { className: cx('FormulaEditor-FuncDoc') },
|
|
46
|
+
React__default.createElement("div", { className: cx('FormulaEditor-panel-header') }, (activeFunc === null || activeFunc === void 0 ? void 0 : activeFunc.name) || ''),
|
|
47
|
+
React__default.createElement("div", { className: cx('FormulaEditor-panel-body') },
|
|
48
|
+
React__default.createElement("div", { className: cx('FormulaEditor-FuncList-doc', descClassName) }, activeFunc ? (React__default.createElement(React__default.Fragment, null,
|
|
49
|
+
Array.isArray(activeFunc.params) ? (React__default.createElement("pre", null,
|
|
50
|
+
React__default.createElement(TooltipWrapper, { placement: "top", tooltip: {
|
|
51
|
+
children: function () { return (React__default.createElement("table", { className: cx('FormulaEditor-FuncList-doc-example', 'Table-table') },
|
|
52
|
+
React__default.createElement("thead", null,
|
|
53
|
+
React__default.createElement("tr", null, ['参数名称', '类型', '描述'].map(function (name, index) { return (React__default.createElement("th", { key: index }, name)); }))),
|
|
54
|
+
React__default.createElement("tbody", null, activeFunc.params.map(function (param, index) { return (React__default.createElement("tr", { key: index },
|
|
55
|
+
React__default.createElement("td", null, param.name),
|
|
56
|
+
React__default.createElement("td", null, param.type),
|
|
57
|
+
React__default.createElement("td", null, param.description))); })))); }
|
|
58
|
+
}, trigger: "hover" },
|
|
59
|
+
React__default.createElement("code", null, activeFunc.example)))) : null,
|
|
60
|
+
React__default.createElement("div", { className: cx('FormulaEditor-FuncList-doc-desc') }, activeFunc.description))) : null)))) : null));
|
|
61
|
+
}
|
|
62
|
+
var FuncList$1 = themeable(FuncList);
|
|
63
|
+
|
|
64
|
+
export { FuncList, FuncList$1 as default };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-rev-ui v6.13.0
|
|
3
|
+
* Copyright 2018-2026 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { __assign } from 'tslib';
|
|
7
|
+
import React__default, { useCallback } from 'react';
|
|
8
|
+
import pick from 'lodash/pick';
|
|
9
|
+
import { themeable, localeable, uncontrollable, isExpression } from 'amis-rev-core';
|
|
10
|
+
import { SelectWithRemoteOptions } from '../Select.js';
|
|
11
|
+
import NumberInput from '../NumberInput.js';
|
|
12
|
+
import DatePicker from '../DatePicker.js';
|
|
13
|
+
import Tag from '../Tag.js';
|
|
14
|
+
import CodeEditor from './CodeEditor.js';
|
|
15
|
+
import InputBox from '../InputBox.js';
|
|
16
|
+
import omit from 'lodash/omit';
|
|
17
|
+
|
|
18
|
+
var FormulaInput = function (props, ref) {
|
|
19
|
+
var _a, _b, _c;
|
|
20
|
+
var __ = props.translate, className = props.className, cx = props.classnames, placeholder = props.placeholder, borderMode = props.borderMode, evalMode = props.evalMode; props.mixedMode; var value = props.value, variables = props.variables, functions = props.functions, _d = props.inputSettings, inputSettings = _d === void 0 ? { type: 'text' } : _d, popOverContainer = props.popOverContainer, onChange = props.onChange, customInputRender = props.customInputRender;
|
|
21
|
+
var schemaType = inputSettings.type;
|
|
22
|
+
/** 自上层共享的属性 */
|
|
23
|
+
var sharedProps = pick(props, ['disabled', 'clearable', 'data']);
|
|
24
|
+
var pipInValue = useCallback(function (value) {
|
|
25
|
+
/** 数据来源可能是从 query中下发的(CRUD查询表头),导致数字或者布尔值被转为 string 格式,这里预处理一下 */
|
|
26
|
+
if (schemaType === 'number') {
|
|
27
|
+
value = isNaN(+value) ? value : +value;
|
|
28
|
+
}
|
|
29
|
+
else if (schemaType === 'boolean') {
|
|
30
|
+
value = value === 'true' ? true : value === 'false' ? false : value;
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}, [schemaType]);
|
|
34
|
+
var pipOutValue = useCallback(function (origin) {
|
|
35
|
+
var result = origin;
|
|
36
|
+
if (origin === undefined) {
|
|
37
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(result);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (schemaType === 'boolean') {
|
|
41
|
+
result = origin.value;
|
|
42
|
+
}
|
|
43
|
+
else if (schemaType === 'select') {
|
|
44
|
+
var _a = inputSettings.joinValues, joinValues = _a === void 0 ? true : _a, extractValue = inputSettings.extractValue, delimiter = inputSettings.delimiter, multiple = inputSettings.multiple, _b = inputSettings.valueField, valueField_1 = _b === void 0 ? 'value' : _b;
|
|
45
|
+
if (joinValues) {
|
|
46
|
+
if (multiple) {
|
|
47
|
+
result = Array.isArray(origin)
|
|
48
|
+
? origin.map(function (item) { return item[valueField_1]; }).join(delimiter)
|
|
49
|
+
: origin
|
|
50
|
+
? origin[valueField_1]
|
|
51
|
+
: '';
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
result = origin ? origin[valueField_1] : '';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else if (extractValue) {
|
|
58
|
+
if (multiple) {
|
|
59
|
+
result = Array.isArray(origin)
|
|
60
|
+
? origin.map(function (item) { return item[valueField_1]; })
|
|
61
|
+
: origin
|
|
62
|
+
? [origin[valueField_1 || 'value']]
|
|
63
|
+
: [];
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
result = origin ? origin[valueField_1] : '';
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(result);
|
|
71
|
+
}, [schemaType, onChange, inputSettings]);
|
|
72
|
+
var cmptValue = pipInValue(value !== null && value !== void 0 ? value : inputSettings.defaultValue);
|
|
73
|
+
var isExpr = isExpression(cmptValue);
|
|
74
|
+
if (!isExpr && schemaType === 'number') {
|
|
75
|
+
return (React__default.createElement(NumberInput, __assign({}, sharedProps, { className: cx(className, 'FormulaPicker-input-number'), borderMode: "none", placeholder: __(placeholder !== null && placeholder !== void 0 ? placeholder : 'NumberInput.placeholder'), step: inputSettings.step, min: inputSettings.minimum, max: inputSettings.maximum, precision: inputSettings.precision, value: cmptValue, onChange: pipOutValue })));
|
|
76
|
+
}
|
|
77
|
+
else if (!isExpr && schemaType === 'date') {
|
|
78
|
+
return (React__default.createElement(DatePicker, __assign({}, sharedProps, { className: cx(className, 'FormulaPicker-input-date'), borderMode: "none", closeOnSelect: true, placeholder: __(placeholder !== null && placeholder !== void 0 ? placeholder : 'Date.placeholder'), format: inputSettings.format || 'YYYY-MM-DD', inputFormat: inputSettings.inputFormat || 'YYYY-MM-DD', timeFormat: "", popOverContainer: popOverContainer, value: cmptValue, onChange: pipOutValue })));
|
|
79
|
+
}
|
|
80
|
+
else if (!isExpr && schemaType === 'time') {
|
|
81
|
+
return (React__default.createElement(DatePicker, __assign({}, sharedProps, { className: cx(className, 'FormulaPicker-input-time'), viewMode: "time", borderMode: "none", closeOnSelect: true, placeholder: __(placeholder !== null && placeholder !== void 0 ? placeholder : 'Time.placeholder'), format: inputSettings.format || 'HH:mm', inputFormat: inputSettings.inputFormat || 'HH:mm', dateFormat: "", timeFormat: inputSettings.format || 'HH:mm', popOverContainer: popOverContainer, value: cmptValue, onChange: pipOutValue })));
|
|
82
|
+
}
|
|
83
|
+
else if (!isExpr && schemaType === 'datetime') {
|
|
84
|
+
return (React__default.createElement(DatePicker, __assign({}, sharedProps, { className: cx(className, 'FormulaPicker-input-datetime'), borderMode: "none", closeOnSelect: true, placeholder: __(placeholder !== null && placeholder !== void 0 ? placeholder : 'Time.placeholder'), format: inputSettings.format || '', inputFormat: inputSettings.inputFormat || 'YYYY-MM-DD HH:mm', timeFormat: inputSettings.timeFormat || 'HH:mm', popOverContainer: popOverContainer, value: cmptValue, onChange: pipOutValue })));
|
|
85
|
+
}
|
|
86
|
+
else if (!isExpr && (schemaType === 'select' || schemaType === 'boolean')) {
|
|
87
|
+
return (React__default.createElement(SelectWithRemoteOptions, __assign({}, sharedProps, { className: cx(className, "FormulaPicker-input-".concat(schemaType)), borderMode: "none", multiple: schemaType === 'boolean' ? false : inputSettings.multiple, options: schemaType === 'boolean'
|
|
88
|
+
? [
|
|
89
|
+
{
|
|
90
|
+
label: __((_a = inputSettings === null || inputSettings === void 0 ? void 0 : inputSettings.trueLabel) !== null && _a !== void 0 ? _a : 'FormulaInput.True'),
|
|
91
|
+
value: true
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: __((_b = inputSettings === null || inputSettings === void 0 ? void 0 : inputSettings.falseLabel) !== null && _b !== void 0 ? _b : 'FormulaInput.False'),
|
|
95
|
+
value: false
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
: (_c = inputSettings.options) !== null && _c !== void 0 ? _c : [], source: inputSettings.source, value: pipInValue(value), renderValueLabel: function (option) {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
var label = (_b = (_a = option.label) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '';
|
|
101
|
+
return schemaType === 'boolean' || !inputSettings.multiple ? (React__default.createElement(Tag, { label: label, className: cx('rounded') })) : (React__default.createElement(React__default.Fragment, null, label));
|
|
102
|
+
}, onChange: pipOutValue })));
|
|
103
|
+
}
|
|
104
|
+
else if (!isExpr && schemaType === 'custom' && customInputRender) {
|
|
105
|
+
return customInputRender({
|
|
106
|
+
value: cmptValue,
|
|
107
|
+
onChange: pipOutValue,
|
|
108
|
+
inputSettings: inputSettings,
|
|
109
|
+
className: "FormulaPicker-input-custom"
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
else if (!isExpr &&
|
|
113
|
+
schemaType &&
|
|
114
|
+
schemaType != 'text' &&
|
|
115
|
+
customInputRender) {
|
|
116
|
+
return customInputRender({
|
|
117
|
+
value: cmptValue,
|
|
118
|
+
onChange: pipOutValue,
|
|
119
|
+
inputSettings: {
|
|
120
|
+
value: omit(inputSettings, [
|
|
121
|
+
'label',
|
|
122
|
+
'operators',
|
|
123
|
+
'defaultOp',
|
|
124
|
+
'defaultValue'
|
|
125
|
+
])
|
|
126
|
+
},
|
|
127
|
+
className: "FormulaPicker-input-custom"
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
return (React__default.createElement(InputBox, { className: cx('FormulaPicker-input'), inputRender: function (_a) {
|
|
132
|
+
var value = _a.value, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, placeholder = _a.placeholder;
|
|
133
|
+
return (React__default.createElement(CodeEditor, { singleLine: true, value: value, onChange: onChange, onFocus: onFocus, onBlur: onBlur, functions: functions, variables: variables, evalMode: evalMode, placeholder: placeholder }));
|
|
134
|
+
}, borderMode: borderMode, value: cmptValue, onChange: pipOutValue, placeholder: __(placeholder !== null && placeholder !== void 0 ? placeholder : 'placeholder.enter') }));
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
var FormulaInput$1 = themeable(localeable(uncontrollable(React__default.forwardRef(FormulaInput), {
|
|
138
|
+
value: 'onChange'
|
|
139
|
+
})));
|
|
140
|
+
|
|
141
|
+
export { FormulaInput$1 as default };
|