amis-editor 4.1.0-beta.28 → 5.2.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/component/BaseControl.d.ts +1831 -0
- package/lib/component/BaseControl.js +366 -0
- package/{dist/component/base → lib/component}/InputComponentName.d.ts +1 -1
- package/lib/component/InputComponentName.js +44 -0
- package/{dist → lib}/component/TableViewEditor.d.ts +2 -2
- package/lib/component/TableViewEditor.js +528 -0
- package/lib/event-action/actions.d.ts +3 -0
- package/lib/event-action/actions.js +188 -0
- package/lib/event-action/schema.d.ts +13 -0
- package/lib/event-action/schema.js +134 -0
- package/{dist → lib}/index.d.ts +26 -33
- package/lib/index.js +181 -0
- package/{dist → lib}/plugin/Alert.d.ts +5 -3
- package/lib/plugin/Alert.js +113 -0
- package/lib/plugin/AnchorNav.d.ts +48 -0
- package/lib/plugin/AnchorNav.js +297 -0
- package/{dist → lib}/plugin/Audio.d.ts +1 -1
- package/lib/plugin/Audio.js +157 -0
- package/{dist → lib}/plugin/Avatar.d.ts +11 -2
- package/lib/plugin/Avatar.js +305 -0
- package/{dist → lib}/plugin/Breadcrumb.d.ts +1 -1
- package/lib/plugin/Breadcrumb.js +116 -0
- package/{dist → lib}/plugin/Button.d.ts +7 -3
- package/lib/plugin/Button.js +297 -0
- package/lib/plugin/ButtonGroup.d.ts +39 -0
- package/lib/plugin/ButtonGroup.js +139 -0
- package/{dist → lib}/plugin/ButtonToolbar.d.ts +5 -11
- package/lib/plugin/ButtonToolbar.js +89 -0
- package/{dist → lib}/plugin/CRUD.d.ts +3 -1
- package/lib/plugin/CRUD.js +1528 -0
- package/{dist → lib}/plugin/Card.d.ts +1 -1
- package/lib/plugin/Card.js +233 -0
- package/{dist → lib}/plugin/Cards.d.ts +1 -1
- package/lib/plugin/Cards.js +254 -0
- package/{dist → lib}/plugin/Carousel.d.ts +1 -1
- package/lib/plugin/Carousel.js +358 -0
- package/{dist → lib}/plugin/Chart.d.ts +3 -1
- package/lib/plugin/Chart.js +192 -0
- package/{dist → lib}/plugin/CodeView.d.ts +1 -1
- package/lib/plugin/CodeView.js +68 -0
- package/{dist → lib}/plugin/Collapse.d.ts +2 -1
- package/lib/plugin/Collapse.js +138 -0
- package/{dist → lib}/plugin/CollapseGroup.d.ts +29 -5
- package/lib/plugin/CollapseGroup.js +237 -0
- package/{dist → lib}/plugin/Container.d.ts +3 -2
- package/lib/plugin/Container.js +100 -0
- package/{dist → lib}/plugin/Custom.d.ts +1 -1
- package/lib/plugin/Custom.js +109 -0
- package/{dist → lib}/plugin/CustomRegion.d.ts +1 -1
- package/lib/plugin/CustomRegion.js +154 -0
- package/{dist → lib}/plugin/Date.d.ts +1 -1
- package/lib/plugin/Date.js +82 -0
- package/{dist → lib}/plugin/Datetime.d.ts +1 -1
- package/lib/plugin/Datetime.js +77 -0
- package/{dist → lib}/plugin/Dialog.d.ts +13 -3
- package/lib/plugin/Dialog.js +214 -0
- package/{dist → lib}/plugin/Divider.d.ts +1 -1
- package/lib/plugin/Divider.js +49 -0
- package/{dist → lib}/plugin/Drawer.d.ts +13 -3
- package/lib/plugin/Drawer.js +240 -0
- package/{dist → lib}/plugin/DropDownButton.d.ts +12 -11
- package/lib/plugin/DropDownButton.js +229 -0
- package/{dist → lib}/plugin/Each.d.ts +1 -1
- package/lib/plugin/Each.js +131 -0
- package/{dist → lib}/plugin/Flex.d.ts +1 -1
- package/lib/plugin/Flex.js +203 -0
- package/{dist → lib}/plugin/Form/ButtonGroupSelect.d.ts +7 -2
- package/lib/plugin/Form/ButtonGroupSelect.js +161 -0
- package/{dist → lib}/plugin/Form/ButtonToolbar.d.ts +8 -7
- package/lib/plugin/Form/ButtonToolbar.js +107 -0
- package/{dist → lib}/plugin/Form/ChainedSelect.d.ts +8 -2
- package/lib/plugin/Form/ChainedSelect.js +183 -0
- package/{dist → lib}/plugin/Form/Checkbox.d.ts +7 -2
- package/lib/plugin/Form/Checkbox.js +174 -0
- package/{dist → lib}/plugin/Form/Checkboxes.d.ts +8 -2
- package/lib/plugin/Form/Checkboxes.js +213 -0
- package/lib/plugin/Form/CodeEditor.d.ts +25 -0
- package/lib/plugin/Form/CodeEditor.js +201 -0
- package/{dist → lib}/plugin/Form/Combo.d.ts +4 -1
- package/lib/plugin/Form/Combo.js +546 -0
- package/{dist → lib}/plugin/Form/ConditionBuilder.d.ts +1 -1
- package/lib/plugin/Form/ConditionBuilder.js +302 -0
- package/{dist → lib}/plugin/Form/Control.d.ts +6 -2
- package/lib/plugin/Form/Control.js +88 -0
- package/{dist → lib}/plugin/Form/DiffEditor.d.ts +8 -2
- package/lib/plugin/Form/DiffEditor.js +204 -0
- package/{dist → lib}/plugin/Form/FieldSet.d.ts +1 -1
- package/lib/plugin/Form/FieldSet.js +152 -0
- package/{dist → lib}/plugin/Form/Form.d.ts +7 -1
- package/lib/plugin/Form/Form.js +846 -0
- package/lib/plugin/Form/Formula.d.ts +27 -0
- package/lib/plugin/Form/Formula.js +82 -0
- package/{dist → lib}/plugin/Form/Group.d.ts +1 -1
- package/lib/plugin/Form/Group.js +252 -0
- package/{dist → lib}/plugin/Form/Hidden.d.ts +1 -1
- package/lib/plugin/Form/Hidden.js +58 -0
- package/{dist → lib}/plugin/Form/InputArray.d.ts +1 -1
- package/lib/plugin/Form/InputArray.js +181 -0
- package/{dist → lib}/plugin/Form/InputCity.d.ts +6 -2
- package/lib/plugin/Form/InputCity.js +139 -0
- package/{dist → lib}/plugin/Form/InputColor.d.ts +20 -18
- package/lib/plugin/Form/InputColor.js +295 -0
- package/lib/plugin/Form/InputDate.d.ts +26 -0
- package/lib/plugin/Form/InputDate.js +357 -0
- package/lib/plugin/Form/InputDateRange.d.ts +26 -0
- package/lib/plugin/Form/InputDateRange.js +350 -0
- package/{dist → lib}/plugin/Form/InputDateTime.d.ts +4 -4
- package/lib/plugin/Form/InputDateTime.js +50 -0
- package/lib/plugin/Form/InputDateTimeRange.d.ts +20 -0
- package/lib/plugin/Form/InputDateTimeRange.js +51 -0
- package/{dist → lib}/plugin/Form/InputEmail.d.ts +1 -0
- package/lib/plugin/Form/InputEmail.js +45 -0
- package/lib/plugin/Form/InputExcel.d.ts +23 -0
- package/lib/plugin/Form/InputExcel.js +121 -0
- package/{dist → lib}/plugin/Form/InputFile.d.ts +7 -3
- package/lib/plugin/Form/InputFile.js +354 -0
- package/{dist → lib}/plugin/Form/InputGroup.d.ts +1 -1
- package/lib/plugin/Form/InputGroup.js +100 -0
- package/{dist → lib}/plugin/Form/InputImage.d.ts +6 -2
- package/lib/plugin/Form/InputImage.js +271 -0
- package/{dist → lib}/plugin/Form/InputKV.d.ts +7 -1
- package/lib/plugin/Form/InputKV.js +129 -0
- package/{dist → lib}/plugin/Form/InputMonth.d.ts +1 -0
- package/lib/plugin/Form/InputMonth.js +48 -0
- package/{dist → lib}/plugin/Form/InputMonthRange.d.ts +4 -4
- package/lib/plugin/Form/InputMonthRange.js +51 -0
- package/{dist → lib}/plugin/Form/InputNumber.d.ts +7 -2
- package/lib/plugin/Form/InputNumber.js +263 -0
- package/{dist → lib}/plugin/Form/InputPassword.d.ts +1 -0
- package/lib/plugin/Form/InputPassword.js +45 -0
- package/{dist → lib}/plugin/Form/InputQuarter.d.ts +1 -0
- package/lib/plugin/Form/InputQuarter.js +48 -0
- package/{dist → lib}/plugin/Form/InputQuarterRange.d.ts +4 -4
- package/lib/plugin/Form/InputQuarterRange.js +51 -0
- package/{dist → lib}/plugin/Form/InputRange.d.ts +7 -2
- package/lib/plugin/Form/InputRange.js +292 -0
- package/lib/plugin/Form/InputRating.d.ts +25 -0
- package/lib/plugin/Form/InputRating.js +357 -0
- package/{dist → lib}/plugin/Form/InputRepeat.d.ts +1 -1
- package/lib/plugin/Form/InputRepeat.js +65 -0
- package/{dist → lib}/plugin/Form/InputRichText.d.ts +1 -1
- package/lib/plugin/Form/InputRichText.js +193 -0
- package/{dist → lib}/plugin/Form/InputSubForm.d.ts +1 -1
- package/lib/plugin/Form/InputSubForm.js +160 -0
- package/{dist → lib}/plugin/Form/InputTable.d.ts +1 -1
- package/lib/plugin/Form/InputTable.js +400 -0
- package/{dist → lib}/plugin/Form/InputTag.d.ts +6 -2
- package/lib/plugin/Form/InputTag.js +155 -0
- package/lib/plugin/Form/InputText.d.ts +42 -0
- package/lib/plugin/Form/InputText.js +328 -0
- package/{dist → lib}/plugin/Form/InputTime.d.ts +3 -3
- package/lib/plugin/Form/InputTime.js +48 -0
- package/{dist/plugin/Form/InputDateTimeRange.d.ts → lib/plugin/Form/InputTimeRange.d.ts} +4 -4
- package/lib/plugin/Form/InputTimeRange.js +51 -0
- package/{dist → lib}/plugin/Form/InputTree.d.ts +6 -2
- package/lib/plugin/Form/InputTree.js +375 -0
- package/{dist → lib}/plugin/Form/InputURL.d.ts +1 -0
- package/lib/plugin/Form/InputURL.js +46 -0
- package/{dist → lib}/plugin/Form/InputYear.d.ts +1 -0
- package/lib/plugin/Form/InputYear.js +48 -0
- package/{dist/plugin/Form/InputDate.d.ts → lib/plugin/Form/InputYearRange.d.ts} +4 -4
- package/lib/plugin/Form/InputYearRange.js +51 -0
- package/{dist → lib}/plugin/Form/Item.d.ts +2 -2
- package/lib/plugin/Form/Item.js +265 -0
- package/{dist → lib}/plugin/Form/ListSelect.d.ts +6 -2
- package/lib/plugin/Form/ListSelect.js +130 -0
- package/{dist/plugin/Form/InputDateRange.d.ts → lib/plugin/Form/LocationPicker.d.ts} +5 -6
- package/lib/plugin/Form/LocationPicker.js +74 -0
- package/{dist → lib}/plugin/Form/MatrixCheckboxes.d.ts +7 -2
- package/lib/plugin/Form/MatrixCheckboxes.js +234 -0
- package/{dist → lib}/plugin/Form/NestedSelect.d.ts +8 -2
- package/lib/plugin/Form/NestedSelect.js +328 -0
- package/{dist → lib}/plugin/Form/Picker.d.ts +1 -1
- package/lib/plugin/Form/Picker.js +169 -0
- package/{dist → lib}/plugin/Form/Radios.d.ts +7 -2
- package/lib/plugin/Form/Radios.js +189 -0
- package/{dist → lib}/plugin/Form/Select.d.ts +7 -2
- package/lib/plugin/Form/Select.js +304 -0
- package/{dist → lib}/plugin/Form/Static.d.ts +4 -3
- package/lib/plugin/Form/Static.js +312 -0
- package/{dist → lib}/plugin/Form/Switch.d.ts +7 -2
- package/lib/plugin/Form/Switch.js +219 -0
- package/{dist → lib}/plugin/Form/TabsTransfer.d.ts +5 -2
- package/lib/plugin/Form/TabsTransfer.js +348 -0
- package/{dist → lib}/plugin/Form/Textarea.d.ts +8 -2
- package/lib/plugin/Form/Textarea.js +190 -0
- package/{dist → lib}/plugin/Form/Transfer.d.ts +5 -2
- package/lib/plugin/Form/Transfer.js +414 -0
- package/{dist → lib}/plugin/Form/TreeSelect.d.ts +6 -2
- package/lib/plugin/Form/TreeSelect.js +375 -0
- package/{dist → lib}/plugin/Form/UUID.d.ts +1 -1
- package/lib/plugin/Form/UUID.js +55 -0
- package/{dist → lib}/plugin/Grid.d.ts +2 -2
- package/lib/plugin/Grid.js +680 -0
- package/{dist → lib}/plugin/HBox.d.ts +2 -2
- package/lib/plugin/HBox.js +594 -0
- package/{dist → lib}/plugin/IFrame.d.ts +6 -5
- package/lib/plugin/IFrame.js +94 -0
- package/{dist → lib}/plugin/Image.d.ts +1 -1
- package/lib/plugin/Image.js +264 -0
- package/{dist → lib}/plugin/Images.d.ts +1 -1
- package/lib/plugin/Images.js +214 -0
- package/{dist → lib}/plugin/Json.d.ts +1 -1
- package/lib/plugin/Json.js +82 -0
- package/{dist → lib}/plugin/Link.d.ts +2 -1
- package/lib/plugin/Link.js +120 -0
- package/{dist → lib}/plugin/List.d.ts +1 -1
- package/lib/plugin/List.js +220 -0
- package/{dist → lib}/plugin/ListItem.d.ts +1 -1
- package/lib/plugin/ListItem.js +195 -0
- package/{dist → lib}/plugin/Log.d.ts +1 -1
- package/lib/plugin/Log.js +62 -0
- package/{dist → lib}/plugin/Mapping.d.ts +1 -1
- package/lib/plugin/Mapping.js +149 -0
- package/{dist → lib}/plugin/Markdown.d.ts +1 -1
- package/lib/plugin/Markdown.js +58 -0
- package/lib/plugin/Nav.d.ts +48 -0
- package/lib/plugin/Nav.js +181 -0
- package/{dist → lib}/plugin/Operation.d.ts +1 -1
- package/lib/plugin/Operation.js +84 -0
- package/{dist → lib}/plugin/Others/Action.d.ts +6 -2
- package/lib/plugin/Others/Action.js +350 -0
- package/{dist → lib}/plugin/Others/TableCell.d.ts +1 -1
- package/lib/plugin/Others/TableCell.js +393 -0
- package/{dist → lib}/plugin/Page.d.ts +7 -4
- package/lib/plugin/Page.js +363 -0
- package/lib/plugin/Pagination.d.ts +51 -0
- package/lib/plugin/Pagination.js +247 -0
- package/{dist → lib}/plugin/Panel.d.ts +1 -1
- package/lib/plugin/Panel.js +222 -0
- package/{dist → lib}/plugin/Plain.d.ts +1 -1
- package/lib/plugin/Plain.js +88 -0
- package/{dist → lib}/plugin/Progress.d.ts +6 -2
- package/lib/plugin/Progress.js +258 -0
- package/{dist → lib}/plugin/Property.d.ts +1 -1
- package/lib/plugin/Property.js +147 -0
- package/{dist → lib}/plugin/QRCode.d.ts +1 -1
- package/lib/plugin/QRCode.js +107 -0
- package/{dist → lib}/plugin/Reset.d.ts +0 -0
- package/lib/plugin/Reset.js +38 -0
- package/{dist → lib}/plugin/Service.d.ts +4 -1
- package/lib/plugin/Service.js +217 -0
- package/{dist → lib}/plugin/Sparkline.d.ts +1 -1
- package/lib/plugin/Sparkline.js +50 -0
- package/{dist → lib}/plugin/Status.d.ts +1 -1
- package/lib/plugin/Status.js +86 -0
- package/{dist → lib}/plugin/Steps.d.ts +1 -1
- package/lib/plugin/Steps.js +136 -0
- package/{dist → lib}/plugin/Submit.d.ts +0 -0
- package/lib/plugin/Submit.js +38 -0
- package/{dist → lib}/plugin/Table.d.ts +7 -2
- package/lib/plugin/Table.js +594 -0
- package/{dist → lib}/plugin/TableView.d.ts +1 -1
- package/lib/plugin/TableView.js +744 -0
- package/{dist → lib}/plugin/Tabs.d.ts +33 -2
- package/lib/plugin/Tabs.js +429 -0
- package/{dist → lib}/plugin/Tasks.d.ts +1 -1
- package/lib/plugin/Tasks.js +263 -0
- package/{dist → lib}/plugin/Time.d.ts +1 -1
- package/lib/plugin/Time.js +77 -0
- package/{dist → lib}/plugin/TooltipWrapper.d.ts +11 -1
- package/lib/plugin/TooltipWrapper.js +281 -0
- package/{dist → lib}/plugin/Tpl.d.ts +3 -2
- package/lib/plugin/Tpl.js +183 -0
- package/{dist → lib}/plugin/Video.d.ts +1 -1
- package/lib/plugin/Video.js +140 -0
- package/{dist → lib}/plugin/WebComponent.d.ts +1 -1
- package/lib/plugin/WebComponent.js +70 -0
- package/{dist → lib}/plugin/Wizard.d.ts +5 -2
- package/lib/plugin/Wizard.js +799 -0
- package/{dist → lib}/plugin/Wrapper.d.ts +1 -1
- package/lib/plugin/Wrapper.js +136 -0
- package/lib/renderer/APIControl.d.ts +7526 -0
- package/lib/renderer/APIControl.js +791 -0
- package/lib/renderer/BadgeControl.d.ts +133 -0
- package/lib/renderer/BadgeControl.js +290 -0
- package/lib/renderer/DataBindingControl.d.ts +14 -0
- package/lib/renderer/DataBindingControl.js +91 -0
- package/lib/renderer/DataMappingControl.d.ts +11 -0
- package/lib/renderer/DataMappingControl.js +73 -0
- package/lib/renderer/DataPickerControl.d.ts +13 -0
- package/lib/renderer/DataPickerControl.js +83 -0
- package/lib/renderer/DateShortCutControl.d.ts +83 -0
- package/lib/renderer/DateShortCutControl.js +254 -0
- package/lib/renderer/FormulaControl.d.ts +96 -0
- package/lib/renderer/FormulaControl.js +324 -0
- package/{dist/component/Control → lib/renderer}/OptionControl.d.ts +25 -36
- package/lib/renderer/OptionControl.js +672 -0
- package/{dist/component/Control → lib/renderer}/PopoverEdit.d.ts +4 -4
- package/lib/renderer/RangePartsControl.d.ts +91 -0
- package/lib/renderer/RangePartsControl.js +392 -0
- package/lib/renderer/StatusControl.d.ts +39 -0
- package/lib/renderer/StatusControl.js +171 -0
- package/lib/renderer/SwitchMoreControl.d.ts +222 -0
- package/lib/renderer/SwitchMoreControl.js +302 -0
- package/lib/renderer/ValidationControl.d.ts +65 -0
- package/lib/renderer/ValidationControl.js +279 -0
- package/lib/renderer/ValidationItem.d.ts +46 -0
- package/lib/renderer/ValidationItem.js +147 -0
- package/lib/renderer/style-control/Background.d.ts +17 -0
- package/lib/renderer/style-control/Background.js +493 -0
- package/lib/renderer/style-control/Border.d.ts +18 -0
- package/lib/renderer/style-control/Border.js +191 -0
- package/lib/renderer/style-control/BoxModel.d.ts +17 -0
- package/lib/renderer/style-control/BoxModel.js +73 -0
- package/lib/renderer/style-control/BoxShadow.d.ts +18 -0
- package/lib/renderer/style-control/BoxShadow.js +125 -0
- package/lib/renderer/style-control/Display.d.ts +14 -0
- package/lib/renderer/style-control/Display.js +233 -0
- package/lib/renderer/style-control/Font.d.ts +16 -0
- package/lib/renderer/style-control/Font.js +239 -0
- package/lib/renderer/style-control/font-family.d.ts +11 -0
- package/lib/renderer/style-control/font-family.js +149 -0
- package/lib/renderer/style-control/transformation.d.ts +29 -0
- package/lib/renderer/style-control/transformation.js +84 -0
- package/lib/renderer/style-control/types.d.ts +8 -0
- package/lib/tpl/api.d.ts +1 -0
- package/lib/tpl/api.js +378 -0
- package/lib/tpl/common.d.ts +1 -0
- package/lib/tpl/common.js +808 -0
- package/lib/tpl/horizontal.d.ts +1 -0
- package/lib/tpl/horizontal.js +260 -0
- package/lib/tpl/index.d.ts +7 -0
- package/lib/tpl/options.d.ts +1 -0
- package/lib/tpl/options.js +265 -0
- package/{dist/component/schemaTpl.d.ts → lib/tpl/style.d.ts} +0 -4
- package/lib/tpl/style.js +372 -0
- package/lib/tpl/validations.d.ts +1 -0
- package/lib/tpl/validations.js +568 -0
- package/lib/util.d.ts +23 -0
- package/lib/util.js +64 -0
- package/lib/validator.d.ts +62 -0
- package/lib/validator.js +417 -0
- package/package.json +36 -29
- package/dist/cebfe0bc5a1dbde02da1.svg +0 -10
- package/dist/compat.d.ts +0 -30
- package/dist/component/Breadcrumb.d.ts +0 -33
- package/dist/component/ClassNameControl.d.ts +0 -31
- package/dist/component/CommonConfigWrapper.d.ts +0 -6
- package/dist/component/ContainerWrapper.d.ts +0 -12
- package/dist/component/Control/APIControl.d.ts +0 -504
- package/dist/component/Control/ValidationControl.d.ts +0 -30
- package/dist/component/Editor.d.ts +0 -81
- package/dist/component/HighlightBox.d.ts +0 -29
- package/dist/component/IFrameBridge.d.ts +0 -32
- package/dist/component/IFramePreview.d.ts +0 -37
- package/dist/component/MiniEditor.d.ts +0 -9
- package/dist/component/NodeWrapper.d.ts +0 -20
- package/dist/component/Panel/AMisCodeEditor.d.ts +0 -37
- package/dist/component/Panel/AvailableRenderersPanel.d.ts +0 -10
- package/dist/component/Panel/CodeEditorPanel.d.ts +0 -6
- package/dist/component/Panel/ContextMenuPanel.d.ts +0 -8
- package/dist/component/Panel/DrawerPanel.d.ts +0 -15
- package/dist/component/Panel/DrawerRendererPanel.d.ts +0 -15
- package/dist/component/Panel/InsertSubRendererPanel.d.ts +0 -11
- package/dist/component/Panel/LeftPanels.d.ts +0 -20
- package/dist/component/Panel/Outline.d.ts +0 -18
- package/dist/component/Panel/RenderersPanel.d.ts +0 -31
- package/dist/component/Panel/RightPanels.d.ts +0 -21
- package/dist/component/Panel/TargetNamePanel.d.ts +0 -7
- package/dist/component/PopOverForm.d.ts +0 -22
- package/dist/component/Preview.d.ts +0 -66
- package/dist/component/RegionHLBox.d.ts +0 -20
- package/dist/component/RegionWrapper.d.ts +0 -196
- package/dist/component/RendererThumb.d.ts +0 -22
- package/dist/component/ScaffoldModal.d.ts +0 -24
- package/dist/component/SubEditor.d.ts +0 -67
- package/dist/component/VRenderer.d.ts +0 -181
- package/dist/component/base/BackTop.d.ts +0 -26
- package/dist/component/base/ErrorRenderer.d.ts +0 -4
- package/dist/component/base/SearchCustomRendererPanel.d.ts +0 -15
- package/dist/component/base/SearchPanel.d.ts +0 -83
- package/dist/component/base/SearchRendererPanel.d.ts +0 -19
- package/dist/component/base/WidthDraggableBtn.d.ts +0 -16
- package/dist/component/base/WidthDraggableContainer.d.ts +0 -2
- package/dist/component/remarkTpl.d.ts +0 -150
- package/dist/dnd/default.d.ts +0 -47
- package/dist/dnd/index.d.ts +0 -119
- package/dist/dnd/interface.d.ts +0 -14
- package/dist/dnd/position-h.d.ts +0 -7
- package/dist/env.d.ts +0 -5
- package/dist/exports.d.ts +0 -8
- package/dist/exports.min.js +0 -1
- package/dist/icons/index.d.ts +0 -2
- package/dist/index.min.js +0 -1
- package/dist/manager.d.ts +0 -456
- package/dist/mocker.d.ts +0 -1
- package/dist/plugin/AnchorNav.d.ts +0 -67
- package/dist/plugin/ButtonGroup.d.ts +0 -60
- package/dist/plugin/ErrorRenderer.d.ts +0 -7
- package/dist/plugin/Form/CodeEditor.d.ts +0 -40
- package/dist/plugin/Form/Formula.d.ts +0 -51
- package/dist/plugin/Form/InputExcel.d.ts +0 -58
- package/dist/plugin/Form/InputRating.d.ts +0 -19
- package/dist/plugin/Form/InputText.d.ts +0 -20
- package/dist/plugin/Form/LocationPicker.d.ts +0 -48
- package/dist/plugin/Nav.d.ts +0 -163
- package/dist/plugin/Others/BasicToolbar.d.ts +0 -11
- package/dist/plugin/Others/DataDebug.d.ts +0 -19
- package/dist/plugin/Others/Unknown.d.ts +0 -5
- package/dist/plugin/Panel/AvailableRenderers.d.ts +0 -8
- package/dist/plugin/Panel/Code.d.ts +0 -9
- package/dist/plugin/Panel/Name.d.ts +0 -8
- package/dist/plugin/Panel/Outline.d.ts +0 -8
- package/dist/plugin.d.ts +0 -601
- package/dist/store/editor.d.ts +0 -1003
- package/dist/store/node.d.ts +0 -265
- package/dist/style.css +0 -1
- package/dist/util.d.ts +0 -72
- package/src/component/schemaTpl.tsx +0 -2157
- package/src/plugin/Alert.tsx +0 -87
- package/src/plugin/AnchorNav.tsx +0 -233
- package/src/plugin/Audio.tsx +0 -161
- package/src/plugin/Avatar.tsx +0 -77
- package/src/plugin/Breadcrumb.tsx +0 -107
- package/src/plugin/Button.tsx +0 -283
- package/src/plugin/ButtonGroup.tsx +0 -88
- package/src/plugin/ButtonToolbar.tsx +0 -89
- package/src/plugin/CRUD.tsx +0 -1835
- package/src/plugin/Card.tsx +0 -290
- package/src/plugin/Cards.tsx +0 -318
- package/src/plugin/Carousel.tsx +0 -386
- package/src/plugin/Chart.tsx +0 -218
- package/src/plugin/CodeView.tsx +0 -60
- package/src/plugin/Collapse.tsx +0 -143
- package/src/plugin/CollapseGroup.tsx +0 -167
- package/src/plugin/Container.tsx +0 -44
- package/src/plugin/Custom.tsx +0 -128
- package/src/plugin/CustomRegion.tsx +0 -156
- package/src/plugin/Date.tsx +0 -81
- package/src/plugin/Datetime.tsx +0 -75
- package/src/plugin/Dialog.tsx +0 -178
- package/src/plugin/Divider.tsx +0 -36
- package/src/plugin/Drawer.tsx +0 -217
- package/src/plugin/DropDownButton.tsx +0 -237
- package/src/plugin/Each.tsx +0 -155
- package/src/plugin/ErrorRenderer.tsx +0 -15
- package/src/plugin/Flex.tsx +0 -156
- package/src/plugin/Form/ButtonGroupSelect.tsx +0 -86
- package/src/plugin/Form/ButtonToolbar.tsx +0 -121
- package/src/plugin/Form/ChainedSelect.tsx +0 -70
- package/src/plugin/Form/Checkbox.tsx +0 -87
- package/src/plugin/Form/Checkboxes.tsx +0 -167
- package/src/plugin/Form/CodeEditor.tsx +0 -91
- package/src/plugin/Form/Combo.tsx +0 -582
- package/src/plugin/Form/ConditionBuilder.tsx +0 -324
- package/src/plugin/Form/Control.tsx +0 -139
- package/src/plugin/Form/DiffEditor.tsx +0 -117
- package/src/plugin/Form/FieldSet.tsx +0 -175
- package/src/plugin/Form/Form.tsx +0 -692
- package/src/plugin/Form/Formula.tsx +0 -91
- package/src/plugin/Form/Group.tsx +0 -300
- package/src/plugin/Form/Hidden.tsx +0 -56
- package/src/plugin/Form/InputArray.tsx +0 -228
- package/src/plugin/Form/InputCity.tsx +0 -93
- package/src/plugin/Form/InputColor.tsx +0 -123
- package/src/plugin/Form/InputDate.tsx +0 -175
- package/src/plugin/Form/InputDateRange.tsx +0 -225
- package/src/plugin/Form/InputDateTime.tsx +0 -183
- package/src/plugin/Form/InputDateTimeRange.tsx +0 -221
- package/src/plugin/Form/InputEmail.tsx +0 -33
- package/src/plugin/Form/InputExcel.tsx +0 -85
- package/src/plugin/Form/InputFile.tsx +0 -228
- package/src/plugin/Form/InputGroup.tsx +0 -105
- package/src/plugin/Form/InputImage.tsx +0 -277
- package/src/plugin/Form/InputKV.tsx +0 -72
- package/src/plugin/Form/InputMonth.tsx +0 -35
- package/src/plugin/Form/InputMonthRange.tsx +0 -195
- package/src/plugin/Form/InputNumber.tsx +0 -97
- package/src/plugin/Form/InputPassword.tsx +0 -33
- package/src/plugin/Form/InputQuarter.tsx +0 -35
- package/src/plugin/Form/InputQuarterRange.tsx +0 -195
- package/src/plugin/Form/InputRange.tsx +0 -121
- package/src/plugin/Form/InputRating.tsx +0 -78
- package/src/plugin/Form/InputRepeat.tsx +0 -69
- package/src/plugin/Form/InputRichText.tsx +0 -197
- package/src/plugin/Form/InputSubForm.tsx +0 -198
- package/src/plugin/Form/InputTable.tsx +0 -434
- package/src/plugin/Form/InputTag.tsx +0 -81
- package/src/plugin/Form/InputText.tsx +0 -186
- package/src/plugin/Form/InputTime.tsx +0 -95
- package/src/plugin/Form/InputTree.tsx +0 -240
- package/src/plugin/Form/InputURL.tsx +0 -34
- package/src/plugin/Form/InputYear.tsx +0 -35
- package/src/plugin/Form/Item.tsx +0 -327
- package/src/plugin/Form/ListSelect.tsx +0 -84
- package/src/plugin/Form/LocationPicker.tsx +0 -75
- package/src/plugin/Form/MatrixCheckboxes.tsx +0 -147
- package/src/plugin/Form/NestedSelect.tsx +0 -222
- package/src/plugin/Form/Picker.tsx +0 -217
- package/src/plugin/Form/Radios.tsx +0 -130
- package/src/plugin/Form/Select.tsx +0 -233
- package/src/plugin/Form/Static.tsx +0 -335
- package/src/plugin/Form/Switch.tsx +0 -118
- package/src/plugin/Form/TabsTransfer.tsx +0 -270
- package/src/plugin/Form/Textarea.tsx +0 -94
- package/src/plugin/Form/Transfer.tsx +0 -379
- package/src/plugin/Form/TreeSelect.tsx +0 -263
- package/src/plugin/Form/UUID.tsx +0 -48
- package/src/plugin/Grid.tsx +0 -799
- package/src/plugin/HBox.tsx +0 -727
- package/src/plugin/IFrame.tsx +0 -72
- package/src/plugin/Image.tsx +0 -318
- package/src/plugin/Images.tsx +0 -238
- package/src/plugin/Json.tsx +0 -76
- package/src/plugin/Link.tsx +0 -95
- package/src/plugin/List.tsx +0 -281
- package/src/plugin/ListItem.tsx +0 -233
- package/src/plugin/Log.tsx +0 -52
- package/src/plugin/Mapping.tsx +0 -156
- package/src/plugin/Markdown.tsx +0 -47
- package/src/plugin/Nav.tsx +0 -186
- package/src/plugin/Operation.tsx +0 -97
- package/src/plugin/Others/Action.tsx +0 -428
- package/src/plugin/Others/BasicToolbar.tsx +0 -591
- package/src/plugin/Others/DataDebug.tsx +0 -134
- package/src/plugin/Others/TableCell.tsx +0 -480
- package/src/plugin/Others/Unknown.tsx +0 -37
- package/src/plugin/Page.tsx +0 -308
- package/src/plugin/Panel/AvailableRenderers.tsx +0 -41
- package/src/plugin/Panel/Code.tsx +0 -44
- package/src/plugin/Panel/Name.tsx +0 -26
- package/src/plugin/Panel/Outline.tsx +0 -40
- package/src/plugin/Panel.tsx +0 -243
- package/src/plugin/Plain.tsx +0 -91
- package/src/plugin/Progress.tsx +0 -132
- package/src/plugin/Property.tsx +0 -139
- package/src/plugin/QRCode.tsx +0 -98
- package/src/plugin/Reset.tsx +0 -23
- package/src/plugin/Service.tsx +0 -167
- package/src/plugin/Sparkline.tsx +0 -40
- package/src/plugin/Status.tsx +0 -78
- package/src/plugin/Steps.tsx +0 -140
- package/src/plugin/Submit.tsx +0 -23
- package/src/plugin/Table.tsx +0 -440
- package/src/plugin/TableView.tsx +0 -711
- package/src/plugin/Tabs.tsx +0 -364
- package/src/plugin/Tasks.tsx +0 -276
- package/src/plugin/Time.tsx +0 -75
- package/src/plugin/TooltipWrapper.tsx +0 -193
- package/src/plugin/Tpl.tsx +0 -162
- package/src/plugin/Video.tsx +0 -160
- package/src/plugin/WebComponent.tsx +0 -56
- package/src/plugin/Wizard.tsx +0 -743
- package/src/plugin/Wrapper.tsx +0 -107
- package/src/plugin.ts +0 -1049
- package/static/Code-hover.png +0 -0
- package/static/Code.png +0 -0
- package/static/Outline-hover.png +0 -0
- package/static/Outline.png +0 -0
- package/static/Renderers-hover.png +0 -0
- package/static/Renderers.png +0 -0
- package/static/side_hide_left.svg +0 -10
package/src/plugin/TableView.tsx
DELETED
@@ -1,711 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @file table view 组件的可视化编辑
|
3
|
-
*/
|
4
|
-
|
5
|
-
import {Button} from 'amis';
|
6
|
-
import React from 'react';
|
7
|
-
import {registerEditorPlugin} from '../manager';
|
8
|
-
import {
|
9
|
-
BaseEventContext,
|
10
|
-
BasePlugin,
|
11
|
-
BasicPanelItem,
|
12
|
-
BasicToolbarItem,
|
13
|
-
BuildPanelEventContext,
|
14
|
-
RegionConfig,
|
15
|
-
RendererInfo,
|
16
|
-
VRendererConfig
|
17
|
-
} from '../plugin';
|
18
|
-
import {getSchemaTpl} from '../component/schemaTpl';
|
19
|
-
import {VRenderer} from '../component/VRenderer';
|
20
|
-
import {TableViewEditor} from '../component/TableViewEditor';
|
21
|
-
import {TableViewSchema, TdObject} from 'amis/lib/renderers/TableView';
|
22
|
-
import {JSONGetById, JSONPipeOut} from '../util';
|
23
|
-
import {RegionWrapper as Region} from '../component/RegionWrapper';
|
24
|
-
|
25
|
-
/**
|
26
|
-
* 尚未实现的功能:
|
27
|
-
* * 按列删除,需要将一些 colspan 减一
|
28
|
-
* * 水平/垂直拆分单元格,增加周围节点的 colspan 和 rowspan
|
29
|
-
*/
|
30
|
-
|
31
|
-
// td 节点模板
|
32
|
-
const TD_TEMPLATE = {
|
33
|
-
body: {
|
34
|
-
type: 'tpl',
|
35
|
-
tpl: '---'
|
36
|
-
}
|
37
|
-
} as {body: {type: 'tpl'}};
|
38
|
-
|
39
|
-
/**
|
40
|
-
* 遍历表格,算出每个单元格在最终渲染时的实际行和列,后续许多操作都需要以这个作为依据
|
41
|
-
* 比如插入列的时候,不能根据单元格在数组的位置,而是要根据单元格实际渲染时所属列
|
42
|
-
*/
|
43
|
-
function getCellRealPosition(table: TableViewSchema) {
|
44
|
-
if (!table) {
|
45
|
-
return {
|
46
|
-
trs: []
|
47
|
-
};
|
48
|
-
}
|
49
|
-
// 记录有哪些行列被合并了,这样后续计算的时候就要跳过这些行列
|
50
|
-
const spannedCell: boolean[][] = [];
|
51
|
-
const trs = table.trs || [];
|
52
|
-
|
53
|
-
let currentRow = 0; // 当前渲染的实际行
|
54
|
-
for (const tr of trs) {
|
55
|
-
const tds = tr.tds || [];
|
56
|
-
|
57
|
-
let currentCol = 0; // 当前渲染的实际列
|
58
|
-
for (const td of tds) {
|
59
|
-
// 跳过被合并的行
|
60
|
-
while (spannedCell[currentRow] && spannedCell[currentRow][currentCol]) {
|
61
|
-
currentCol = currentCol + 1;
|
62
|
-
}
|
63
|
-
const rowspan = td.rowspan || 1;
|
64
|
-
const colspan = td.colspan || 1;
|
65
|
-
// 标记后续行合并情况
|
66
|
-
if (rowspan > 1 || colspan > 1) {
|
67
|
-
for (let i = 0; i < rowspan; i++) {
|
68
|
-
const spanRow = currentRow + i;
|
69
|
-
if (!spannedCell[spanRow]) {
|
70
|
-
spannedCell[spanRow] = [];
|
71
|
-
}
|
72
|
-
for (let j = 0; j < colspan; j++) {
|
73
|
-
const spanCol = currentCol + j;
|
74
|
-
spannedCell[spanRow][spanCol] = true;
|
75
|
-
}
|
76
|
-
}
|
77
|
-
}
|
78
|
-
(td as any).$$row = currentRow;
|
79
|
-
(td as any).$$col = currentCol;
|
80
|
-
currentCol = currentCol + 1;
|
81
|
-
}
|
82
|
-
|
83
|
-
currentRow = currentRow + 1;
|
84
|
-
}
|
85
|
-
return table;
|
86
|
-
}
|
87
|
-
|
88
|
-
export class TableViewPlugin extends BasePlugin {
|
89
|
-
// 关联渲染器名字
|
90
|
-
rendererName = 'table-view';
|
91
|
-
$schema = '/schemas/TableViewSchema.json';
|
92
|
-
|
93
|
-
// 组件名称
|
94
|
-
name = '表格视图';
|
95
|
-
isBaseComponent = true;
|
96
|
-
icon = 'fa fa-columns';
|
97
|
-
description = '表格类型的展现';
|
98
|
-
docLink = '/amis/zh-CN/components/table-view';
|
99
|
-
tags = ['容器'];
|
100
|
-
scaffold = {
|
101
|
-
type: 'table-view',
|
102
|
-
trs: [
|
103
|
-
{
|
104
|
-
background: '#F7F7F7',
|
105
|
-
tds: [
|
106
|
-
{
|
107
|
-
body: {
|
108
|
-
type: 'tpl',
|
109
|
-
tpl: '地区'
|
110
|
-
}
|
111
|
-
},
|
112
|
-
{
|
113
|
-
body: {
|
114
|
-
type: 'tpl',
|
115
|
-
tpl: '城市'
|
116
|
-
}
|
117
|
-
},
|
118
|
-
{
|
119
|
-
body: {
|
120
|
-
type: 'tpl',
|
121
|
-
tpl: '销量'
|
122
|
-
}
|
123
|
-
}
|
124
|
-
]
|
125
|
-
},
|
126
|
-
{
|
127
|
-
tds: [
|
128
|
-
{
|
129
|
-
rowspan: 2,
|
130
|
-
body: {
|
131
|
-
type: 'tpl',
|
132
|
-
tpl: '华北'
|
133
|
-
}
|
134
|
-
},
|
135
|
-
{
|
136
|
-
body: {
|
137
|
-
type: 'tpl',
|
138
|
-
tpl: '北京'
|
139
|
-
}
|
140
|
-
},
|
141
|
-
{
|
142
|
-
body: {
|
143
|
-
type: 'tpl',
|
144
|
-
tpl: '${beijing}'
|
145
|
-
}
|
146
|
-
}
|
147
|
-
]
|
148
|
-
},
|
149
|
-
{
|
150
|
-
tds: [
|
151
|
-
{
|
152
|
-
body: {
|
153
|
-
type: 'tpl',
|
154
|
-
tpl: '天津'
|
155
|
-
}
|
156
|
-
},
|
157
|
-
{
|
158
|
-
body: {
|
159
|
-
type: 'tpl',
|
160
|
-
tpl: '${tianjing}'
|
161
|
-
}
|
162
|
-
}
|
163
|
-
]
|
164
|
-
}
|
165
|
-
]
|
166
|
-
};
|
167
|
-
previewSchema = {
|
168
|
-
...this.scaffold
|
169
|
-
};
|
170
|
-
|
171
|
-
regions: Array<RegionConfig> = [
|
172
|
-
{
|
173
|
-
key: 'body',
|
174
|
-
label: '内容区',
|
175
|
-
renderMethod: 'renderTdBody',
|
176
|
-
preferTag: '展示'
|
177
|
-
}
|
178
|
-
];
|
179
|
-
|
180
|
-
panelTitle = '表格视图';
|
181
|
-
panelBody = [
|
182
|
-
getSchemaTpl('tabs', [
|
183
|
-
{
|
184
|
-
title: '常规',
|
185
|
-
body: [
|
186
|
-
{type: 'input-text', label: '宽度', name: 'width', clearable: true},
|
187
|
-
{
|
188
|
-
type: 'input-text',
|
189
|
-
label: '默认内边距',
|
190
|
-
name: 'padding',
|
191
|
-
clearable: true
|
192
|
-
},
|
193
|
-
{
|
194
|
-
type: 'switch',
|
195
|
-
name: 'border',
|
196
|
-
mode: 'inline',
|
197
|
-
className: 'w-full',
|
198
|
-
label: '是否显示边框'
|
199
|
-
},
|
200
|
-
{
|
201
|
-
label: '边框颜色',
|
202
|
-
type: 'input-color',
|
203
|
-
name: 'borderColor'
|
204
|
-
}
|
205
|
-
]
|
206
|
-
},
|
207
|
-
{
|
208
|
-
title: '外观',
|
209
|
-
body: [getSchemaTpl('className'), getSchemaTpl('style')]
|
210
|
-
},
|
211
|
-
{
|
212
|
-
title: '显隐',
|
213
|
-
body: [getSchemaTpl('visible')]
|
214
|
-
}
|
215
|
-
])
|
216
|
-
];
|
217
|
-
|
218
|
-
fieldWrapperResolve = (dom: HTMLElement) => dom;
|
219
|
-
|
220
|
-
overrides = {
|
221
|
-
renderTd(this: any, td: any, colIndex: number, rowIndex: number) {
|
222
|
-
const dom = this.super(td, colIndex, rowIndex);
|
223
|
-
const info: RendererInfo = this.props.$$editor;
|
224
|
-
|
225
|
-
if (!info || !td.$$id) {
|
226
|
-
return dom;
|
227
|
-
}
|
228
|
-
|
229
|
-
const plugin = info.plugin as TableViewPlugin;
|
230
|
-
const id = td.$$id;
|
231
|
-
return (
|
232
|
-
<VRenderer
|
233
|
-
plugin={info.plugin}
|
234
|
-
renderer={info.renderer}
|
235
|
-
key={id}
|
236
|
-
$schema="/schemas/TdObject.json"
|
237
|
-
hostId={info.id}
|
238
|
-
memberIndex={colIndex} // TODO: colIndex 其实不对,需要增加 schema filter 功能来让插件能
|
239
|
-
name={`${`单元格 ${rowIndex + 1},${colIndex + 1}`}`}
|
240
|
-
id={id}
|
241
|
-
draggable={false}
|
242
|
-
wrapperResolve={plugin.fieldWrapperResolve}
|
243
|
-
schemaPath={`${info.schemaPath}/td`}
|
244
|
-
path={`${this.props.$path}/tr/${rowIndex}/td/${colIndex}`}
|
245
|
-
data={this.props.data}
|
246
|
-
children={dom}
|
247
|
-
/>
|
248
|
-
);
|
249
|
-
},
|
250
|
-
renderTr(this: any, tr: any, rowIndex: number) {
|
251
|
-
const dom = this.super(tr, rowIndex);
|
252
|
-
const info: RendererInfo = this.props.$$editor;
|
253
|
-
|
254
|
-
if (!info || !tr.$$id) {
|
255
|
-
return dom;
|
256
|
-
}
|
257
|
-
|
258
|
-
const plugin = info.plugin as TableViewPlugin;
|
259
|
-
const id = tr.$$id;
|
260
|
-
return (
|
261
|
-
<VRenderer
|
262
|
-
plugin={info.plugin}
|
263
|
-
renderer={info.renderer}
|
264
|
-
key={id}
|
265
|
-
$schema="/schemas/TrObject.json"
|
266
|
-
hostId={info.id}
|
267
|
-
memberIndex={rowIndex}
|
268
|
-
name={`${`行 ${rowIndex + 1}`}`}
|
269
|
-
id={id}
|
270
|
-
draggable={false}
|
271
|
-
wrapperResolve={plugin.fieldWrapperResolve}
|
272
|
-
schemaPath={`${info.schemaPath}/tr`}
|
273
|
-
path={`${this.props.$path}/tr/${rowIndex}`}
|
274
|
-
data={this.props.data}
|
275
|
-
children={dom}
|
276
|
-
/>
|
277
|
-
);
|
278
|
-
}
|
279
|
-
};
|
280
|
-
|
281
|
-
tdVRendererConfig: VRendererConfig = {
|
282
|
-
panelTitle: '单元格',
|
283
|
-
panelBodyCreator: (context: BaseEventContext) => {
|
284
|
-
return [
|
285
|
-
{
|
286
|
-
label: '单元格背景色',
|
287
|
-
type: 'input-color',
|
288
|
-
name: 'background'
|
289
|
-
},
|
290
|
-
{
|
291
|
-
label: '文字颜色',
|
292
|
-
type: 'input-color',
|
293
|
-
name: 'color'
|
294
|
-
},
|
295
|
-
{
|
296
|
-
type: 'switch',
|
297
|
-
name: 'bold',
|
298
|
-
mode: 'inline',
|
299
|
-
className: 'w-full',
|
300
|
-
label: '文字加粗'
|
301
|
-
},
|
302
|
-
{
|
303
|
-
type: 'input-number',
|
304
|
-
name: 'padding',
|
305
|
-
label: '内边距'
|
306
|
-
},
|
307
|
-
{
|
308
|
-
type: 'select',
|
309
|
-
name: 'align',
|
310
|
-
label: '水平对齐',
|
311
|
-
options: [
|
312
|
-
{
|
313
|
-
label: '左',
|
314
|
-
value: 'left'
|
315
|
-
},
|
316
|
-
{
|
317
|
-
label: '中',
|
318
|
-
value: 'center'
|
319
|
-
},
|
320
|
-
{
|
321
|
-
label: '右',
|
322
|
-
value: 'right'
|
323
|
-
}
|
324
|
-
]
|
325
|
-
},
|
326
|
-
{
|
327
|
-
type: 'select',
|
328
|
-
name: 'valign',
|
329
|
-
label: '垂直对齐',
|
330
|
-
options: [
|
331
|
-
{
|
332
|
-
label: '顶',
|
333
|
-
value: 'top'
|
334
|
-
},
|
335
|
-
{
|
336
|
-
label: '中',
|
337
|
-
value: 'middle'
|
338
|
-
},
|
339
|
-
{
|
340
|
-
label: '底',
|
341
|
-
value: 'bottom'
|
342
|
-
}
|
343
|
-
]
|
344
|
-
},
|
345
|
-
{
|
346
|
-
type: 'input-number',
|
347
|
-
name: 'rowspan',
|
348
|
-
label: '跨几行'
|
349
|
-
},
|
350
|
-
{
|
351
|
-
type: 'input-number',
|
352
|
-
name: 'colspan',
|
353
|
-
label: '跨几列'
|
354
|
-
},
|
355
|
-
getSchemaTpl('style')
|
356
|
-
];
|
357
|
-
}
|
358
|
-
};
|
359
|
-
|
360
|
-
trVRendererConfig: VRendererConfig = {
|
361
|
-
panelTitle: ' 行',
|
362
|
-
panelBodyCreator: (context: BaseEventContext) => {
|
363
|
-
return [
|
364
|
-
{
|
365
|
-
label: '行背景色',
|
366
|
-
type: 'input-color',
|
367
|
-
name: 'background'
|
368
|
-
},
|
369
|
-
{
|
370
|
-
label: '行高度',
|
371
|
-
type: 'input-number',
|
372
|
-
name: 'height'
|
373
|
-
}
|
374
|
-
];
|
375
|
-
}
|
376
|
-
};
|
377
|
-
|
378
|
-
renderRenderer(props: any) {
|
379
|
-
const $$editor = props.$$editor;
|
380
|
-
const renderer = $$editor.renderer;
|
381
|
-
const schema = props.$schema;
|
382
|
-
getCellRealPosition(schema);
|
383
|
-
return (
|
384
|
-
<TableViewEditor schema={schema} manager={this.manager}>
|
385
|
-
<renderer.component {...props} />
|
386
|
-
</TableViewEditor>
|
387
|
-
);
|
388
|
-
}
|
389
|
-
|
390
|
-
// 根据路径判断是选中单元格还是行
|
391
|
-
buildEditorPanel(
|
392
|
-
context: BuildPanelEventContext,
|
393
|
-
panels: Array<BasicPanelItem>
|
394
|
-
) {
|
395
|
-
super.buildEditorPanel(context, panels);
|
396
|
-
if (context.info.schemaPath.endsWith('/td')) {
|
397
|
-
panels.push({
|
398
|
-
key: 'td',
|
399
|
-
order: 100,
|
400
|
-
icon: this.tdVRendererConfig.panelIcon || 'fa fa-tablet',
|
401
|
-
title: this.tdVRendererConfig.panelTitle || '格子',
|
402
|
-
render: this.manager.makeSchemaFormRender({
|
403
|
-
controls: this.tdVRendererConfig.panelControlsCreator
|
404
|
-
? this.tdVRendererConfig.panelControlsCreator(context)
|
405
|
-
: this.tdVRendererConfig.panelControls!,
|
406
|
-
body: this.tdVRendererConfig.panelBodyCreator
|
407
|
-
? this.tdVRendererConfig.panelBodyCreator(context)
|
408
|
-
: this.tdVRendererConfig.panelBody!
|
409
|
-
})
|
410
|
-
});
|
411
|
-
} else if (context.info.schemaPath.endsWith('/tr')) {
|
412
|
-
panels.push({
|
413
|
-
key: 'tr',
|
414
|
-
order: 100,
|
415
|
-
icon: this.trVRendererConfig.panelIcon || 'fa fa-tablet',
|
416
|
-
title: this.trVRendererConfig.panelTitle || '格子',
|
417
|
-
render: this.manager.makeSchemaFormRender({
|
418
|
-
controls: this.trVRendererConfig.panelControlsCreator
|
419
|
-
? this.trVRendererConfig.panelControlsCreator(context)
|
420
|
-
: this.trVRendererConfig.panelControls!,
|
421
|
-
body: this.trVRendererConfig.panelBodyCreator
|
422
|
-
? this.trVRendererConfig.panelBodyCreator(context)
|
423
|
-
: this.trVRendererConfig.panelBody!
|
424
|
-
})
|
425
|
-
});
|
426
|
-
}
|
427
|
-
}
|
428
|
-
|
429
|
-
/**
|
430
|
-
* 插入行,需要处理前面有 rowspan 的情况
|
431
|
-
*
|
432
|
-
* +---+---+---+
|
433
|
-
* | a | b | c |
|
434
|
-
* + +---+---+
|
435
|
-
* | | d | e |
|
436
|
-
* + +---+---+
|
437
|
-
* | | f | g |
|
438
|
-
* +---+---+---+
|
439
|
-
*
|
440
|
-
* 比如在 d 位置的前面插入行,需要将 a 的 rowspan 加一,然后再插入两个单元格
|
441
|
-
*/
|
442
|
-
insertRow(tdId: string, position: 'above' | 'below') {
|
443
|
-
const store = this.manager.store;
|
444
|
-
const paths = store.getNodePathById(tdId);
|
445
|
-
const tableId = paths[paths.length - 3].id;
|
446
|
-
const table = store.getSchema(tableId);
|
447
|
-
getCellRealPosition(table);
|
448
|
-
|
449
|
-
const td = JSONGetById(table, tdId);
|
450
|
-
|
451
|
-
if (!td) {
|
452
|
-
console.warn('找不到对应的 td id');
|
453
|
-
return;
|
454
|
-
}
|
455
|
-
|
456
|
-
let insertRow = td.$$row;
|
457
|
-
if (position === 'below') {
|
458
|
-
insertRow = insertRow + 1;
|
459
|
-
}
|
460
|
-
|
461
|
-
// 通过第一行来确认表格一共多少列
|
462
|
-
const firstRow = table.trs[0];
|
463
|
-
const firstRowLastTd = firstRow.tds[firstRow.tds.length - 1];
|
464
|
-
if (!firstRowLastTd) {
|
465
|
-
console.warn('第一列没内容');
|
466
|
-
return;
|
467
|
-
}
|
468
|
-
let colSize = firstRowLastTd.$$col + (firstRowLastTd.colspan || 1);
|
469
|
-
let insertIndex = table.trs.length;
|
470
|
-
for (let trIndex = 0; trIndex < table.trs.length; trIndex++) {
|
471
|
-
for (const td of table.trs[trIndex].tds || []) {
|
472
|
-
const tdRow = td.$$row;
|
473
|
-
const rowspan = td.rowspan || 1;
|
474
|
-
const colspan = td.colspan || 1;
|
475
|
-
// 如果覆盖到要插入的行,则增加 rowspan,并在这个插入的行中减去对应
|
476
|
-
if (rowspan > 1) {
|
477
|
-
const isOverlapping = tdRow + rowspan > insertRow;
|
478
|
-
if (isOverlapping) {
|
479
|
-
td.rowspan = rowspan + 1;
|
480
|
-
colSize = colSize - colspan;
|
481
|
-
}
|
482
|
-
}
|
483
|
-
if (tdRow === insertRow) {
|
484
|
-
insertIndex = trIndex;
|
485
|
-
break;
|
486
|
-
}
|
487
|
-
}
|
488
|
-
}
|
489
|
-
|
490
|
-
const insertTds = [];
|
491
|
-
for (let i = 0; i < colSize; i++) {
|
492
|
-
insertTds.push(TD_TEMPLATE);
|
493
|
-
}
|
494
|
-
table.trs.splice(insertIndex, 0, {tds: insertTds});
|
495
|
-
this.manager.store.changeValueById(tableId, table);
|
496
|
-
}
|
497
|
-
|
498
|
-
/**
|
499
|
-
* 插入列
|
500
|
-
*
|
501
|
-
* +---+---+---+
|
502
|
-
* | a | b |
|
503
|
-
* + +---+
|
504
|
-
* | | c |
|
505
|
-
* +---+---+---+
|
506
|
-
* | d | e | f |
|
507
|
-
* +---+---+---+
|
508
|
-
*
|
509
|
-
* 比如在 c 位置左侧插入列,应该将 a 的 colspan 加一,然后在最后一行增加一个单元格
|
510
|
-
*/
|
511
|
-
insertCol(tdId: string, position: 'left' | 'right') {
|
512
|
-
const store = this.manager.store;
|
513
|
-
const paths = store.getNodePathById(tdId);
|
514
|
-
const tableId = paths[paths.length - 3].id;
|
515
|
-
const table = store.getSchema(tableId);
|
516
|
-
getCellRealPosition(table);
|
517
|
-
const td = JSONGetById(table, tdId);
|
518
|
-
if (!td) {
|
519
|
-
console.warn('找不到对应的 td id');
|
520
|
-
return;
|
521
|
-
}
|
522
|
-
|
523
|
-
let insertCol = td.$$col;
|
524
|
-
if (position === 'right') {
|
525
|
-
insertCol = insertCol + 1;
|
526
|
-
}
|
527
|
-
|
528
|
-
for (const tr of table.trs || []) {
|
529
|
-
const tds = tr.tds || [];
|
530
|
-
let isInserted = false;
|
531
|
-
for (let tdIndex = 0; tdIndex < tds.length; tdIndex++) {
|
532
|
-
const td = tds[tdIndex];
|
533
|
-
const tdColspan = td.colspan || 1;
|
534
|
-
const tdCol = td.$$col;
|
535
|
-
// 如果要插入的行被覆盖了,则对节点加一并跳过插入
|
536
|
-
if (tdColspan > 1) {
|
537
|
-
const isOverlapping = tdCol + tdColspan > insertCol;
|
538
|
-
if (isOverlapping) {
|
539
|
-
td.colspan = tdColspan + 1;
|
540
|
-
isInserted = true;
|
541
|
-
break;
|
542
|
-
}
|
543
|
-
}
|
544
|
-
if (insertCol <= tdCol) {
|
545
|
-
tds.splice(tdIndex, 0, TD_TEMPLATE);
|
546
|
-
isInserted = true;
|
547
|
-
break;
|
548
|
-
}
|
549
|
-
}
|
550
|
-
// 如果没找到对应的节点,那可能是插入到最后一条或者这一列节点数量不够,此时就要插入到最后
|
551
|
-
if (!isInserted) {
|
552
|
-
tds.push(TD_TEMPLATE);
|
553
|
-
}
|
554
|
-
}
|
555
|
-
this.manager.store.changeValueById(tableId, table);
|
556
|
-
}
|
557
|
-
|
558
|
-
/**
|
559
|
-
* 拆分有跨行或跨列的单元格
|
560
|
-
*
|
561
|
-
* +---+---+---+
|
562
|
-
* | a | b |
|
563
|
-
* + +---+
|
564
|
-
* | | c |
|
565
|
-
* +---+---+---+
|
566
|
-
* | d | e | f |
|
567
|
-
* +---+---+---+
|
568
|
-
*
|
569
|
-
* 比如拆分 a,最后要变成
|
570
|
-
*
|
571
|
-
* +---+---+---+
|
572
|
-
* | a | g | b |
|
573
|
-
* +---+---+---+
|
574
|
-
* | h | i | c |
|
575
|
-
* +---+---+---+
|
576
|
-
* | d | e | f |
|
577
|
-
* +---+---+---+
|
578
|
-
*
|
579
|
-
* 因此要新增 g、h、i 三个单元格
|
580
|
-
*/
|
581
|
-
splitCell(tdId: string) {
|
582
|
-
const store = this.manager.store;
|
583
|
-
const paths = store.getNodePathById(tdId);
|
584
|
-
const tableId = paths[paths.length - 3].id;
|
585
|
-
const table = store.getSchema(tableId);
|
586
|
-
getCellRealPosition(table);
|
587
|
-
const td = JSONGetById(table, tdId);
|
588
|
-
if (!td) {
|
589
|
-
console.warn('找不到对应的 td id');
|
590
|
-
return;
|
591
|
-
}
|
592
|
-
|
593
|
-
const rowspan = td.rowspan || 1;
|
594
|
-
const colspan = td.colspan || 1;
|
595
|
-
|
596
|
-
// 将这个单元格的跨行和跨列都设置为 1
|
597
|
-
td.colspan = 1;
|
598
|
-
td.rowspan = 1;
|
599
|
-
|
600
|
-
// 算出需要补充哪些单元格及位置
|
601
|
-
const tdRow = td.$$row;
|
602
|
-
const tdCol = td.$$col;
|
603
|
-
const insertTds = [];
|
604
|
-
for (var i = 0; i < rowspan; i++) {
|
605
|
-
for (var j = 0; j < colspan; j++) {
|
606
|
-
// 跳过第一个,也就是这个单元格自己的位置
|
607
|
-
if (i === 0 && j === 0) {
|
608
|
-
continue;
|
609
|
-
}
|
610
|
-
insertTds.push({row: tdRow + i, col: tdCol + j});
|
611
|
-
}
|
612
|
-
}
|
613
|
-
|
614
|
-
// 需要将列大的放前面,主要是因为后面需要反向遍历才能动态删数据
|
615
|
-
insertTds.sort((a: any, b: any) => {
|
616
|
-
return b.col - a.col;
|
617
|
-
});
|
618
|
-
|
619
|
-
for (const tr of table.trs) {
|
620
|
-
for (let tdIndex = 0; tdIndex < tr.tds.length; tdIndex++) {
|
621
|
-
const td = tr.tds[tdIndex];
|
622
|
-
const currentRow = td.$$row;
|
623
|
-
const currentCol = td.$$col;
|
624
|
-
let insertIndex = insertTds.length;
|
625
|
-
while (insertIndex--) {
|
626
|
-
const insertTd = insertTds[insertIndex];
|
627
|
-
if (currentRow === insertTd.row) {
|
628
|
-
if (insertTd.col <= currentCol) {
|
629
|
-
tr.tds.splice(tdIndex, 0, TD_TEMPLATE);
|
630
|
-
} else {
|
631
|
-
tr.tds.push(TD_TEMPLATE);
|
632
|
-
}
|
633
|
-
insertTds.splice(insertIndex, 1);
|
634
|
-
}
|
635
|
-
}
|
636
|
-
}
|
637
|
-
}
|
638
|
-
|
639
|
-
// 如果前面有单元格找不到位置,那意味着是下面这种情况,这个单元格跨两行且是最后一行
|
640
|
-
// 这时 table.tr 其实只有一行数据,需要在添加一行数据
|
641
|
-
// +---+---+
|
642
|
-
// | a |
|
643
|
-
// + +
|
644
|
-
// | |
|
645
|
-
// +---+---+
|
646
|
-
if (insertTds.length) {
|
647
|
-
const newTds = [];
|
648
|
-
for (var i = 0; i < insertTds.length; i++) {
|
649
|
-
newTds.push(TD_TEMPLATE);
|
650
|
-
}
|
651
|
-
table.trs.push({tds: newTds});
|
652
|
-
}
|
653
|
-
|
654
|
-
this.manager.store.changeValueById(tableId, table);
|
655
|
-
}
|
656
|
-
|
657
|
-
buildEditorToolbar(
|
658
|
-
{schema, info}: BaseEventContext,
|
659
|
-
toolbars: Array<BasicToolbarItem>
|
660
|
-
) {
|
661
|
-
if (info.schemaPath.endsWith('/td')) {
|
662
|
-
const tdId = schema.$$id;
|
663
|
-
toolbars.push({
|
664
|
-
icon: 'fa fa-chevron-left',
|
665
|
-
order: 100,
|
666
|
-
tooltip: '左侧新增列',
|
667
|
-
onClick: () => {
|
668
|
-
this.insertCol(tdId, 'left');
|
669
|
-
}
|
670
|
-
});
|
671
|
-
toolbars.push({
|
672
|
-
icon: 'fa fa-chevron-down',
|
673
|
-
order: 100,
|
674
|
-
tooltip: '下方新增行',
|
675
|
-
onClick: () => {
|
676
|
-
this.insertRow(tdId, 'below');
|
677
|
-
}
|
678
|
-
});
|
679
|
-
toolbars.push({
|
680
|
-
icon: 'fa fa-chevron-up',
|
681
|
-
order: 100,
|
682
|
-
tooltip: '上方新增行',
|
683
|
-
onClick: () => {
|
684
|
-
this.insertRow(tdId, 'above');
|
685
|
-
}
|
686
|
-
});
|
687
|
-
toolbars.push({
|
688
|
-
icon: 'fa fa-chevron-right',
|
689
|
-
order: 100,
|
690
|
-
tooltip: '右侧新增列',
|
691
|
-
onClick: () => {
|
692
|
-
this.insertCol(tdId, 'right');
|
693
|
-
}
|
694
|
-
});
|
695
|
-
const colspan = schema.colspan || 1;
|
696
|
-
const rowspan = schema.rowspan || 1;
|
697
|
-
if (colspan > 1 || rowspan > 1) {
|
698
|
-
toolbars.push({
|
699
|
-
icon: 'fa fa-columns',
|
700
|
-
order: 100,
|
701
|
-
tooltip: '拆分单元格',
|
702
|
-
onClick: () => {
|
703
|
-
this.splitCell(tdId);
|
704
|
-
}
|
705
|
-
});
|
706
|
-
}
|
707
|
-
}
|
708
|
-
}
|
709
|
-
}
|
710
|
-
|
711
|
-
registerEditorPlugin(TableViewPlugin);
|