custom-variant-form 2.3.0 → 2.3.2
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/README.md +2 -180
- package/package.json +4 -29
- package/dist/build/css/app.911b9dc4.css +0 -1
- package/dist/build/css/chunk-vendors.a16c4353.css +0 -1
- package/dist/build/favicon.ico +0 -0
- package/dist/build/fonts/element-icons.535877f5.woff +0 -0
- package/dist/build/fonts/element-icons.732389de.ttf +0 -0
- package/dist/build/index.html +0 -1
- package/dist/build/js/app.dd7f94a2.js +0 -1
- package/dist/build/js/chunk-vendors.1519ed31.js +0 -80
- package/dist/build/report.html +0 -53
- package/dist/lib/VFormDesigner.common-report.html +0 -53
- package/dist/lib/VFormDesigner.common.js +0 -85865
- package/dist/lib/VFormDesigner.common.js.map +0 -1
- package/dist/lib/VFormDesigner.umd-report.html +0 -53
- package/dist/lib/VFormDesigner.umd.js +0 -85875
- package/dist/lib/VFormDesigner.umd.js.map +0 -1
- package/dist/lib/VFormDesigner.umd.min-report.html +0 -53
- package/dist/lib/demo.html +0 -10
- package/dist/lib-render/VFormRender.common-report.html +0 -53
- package/dist/lib-render/VFormRender.common.js +0 -46164
- package/dist/lib-render/VFormRender.common.js.map +0 -1
- package/dist/lib-render/VFormRender.umd-report.html +0 -53
- package/dist/lib-render/VFormRender.umd.js +0 -46174
- package/dist/lib-render/VFormRender.umd.js.map +0 -1
- package/dist/lib-render/VFormRender.umd.min-report.html +0 -53
- package/dist/lib-render/demo.html +0 -10
- package/install-render.js +0 -29
- package/install.js +0 -41
- package/src/App.vue +0 -45
- package/src/assets/ft-images/t1.png +0 -0
- package/src/assets/ft-images/t2.png +0 -0
- package/src/assets/ft-images/t3.png +0 -0
- package/src/assets/ft-images/t4.png +0 -0
- package/src/assets/ft-images/t5.png +0 -0
- package/src/assets/ft-images/t6.png +0 -0
- package/src/assets/ft-images/t7.png +0 -0
- package/src/assets/ft-images/t8.png +0 -0
- package/src/assets/vform-logo.png +0 -0
- package/src/components/code-editor/index.vue +0 -134
- package/src/components/form-designer/designer.js +0 -962
- package/src/components/form-designer/form-widget/container-widget/container-wrapper.vue +0 -107
- package/src/components/form-designer/form-widget/container-widget/containerMixin.js +0 -93
- package/src/components/form-designer/form-widget/container-widget/grid-col-widget.vue +0 -314
- package/src/components/form-designer/form-widget/container-widget/grid-widget.vue +0 -93
- package/src/components/form-designer/form-widget/container-widget/index.js +0 -24
- package/src/components/form-designer/form-widget/container-widget/tab-widget.vue +0 -123
- package/src/components/form-designer/form-widget/container-widget/table-cell-widget.vue +0 -347
- package/src/components/form-designer/form-widget/container-widget/table-widget.vue +0 -116
- package/src/components/form-designer/form-widget/field-widget/button-widget.vue +0 -87
- package/src/components/form-designer/form-widget/field-widget/cascader-widget.vue +0 -120
- package/src/components/form-designer/form-widget/field-widget/checkbox-widget.vue +0 -105
- package/src/components/form-designer/form-widget/field-widget/color-widget.vue +0 -99
- package/src/components/form-designer/form-widget/field-widget/date-range-widget.vue +0 -104
- package/src/components/form-designer/form-widget/field-widget/date-widget.vue +0 -103
- package/src/components/form-designer/form-widget/field-widget/divider-widget.vue +0 -83
- package/src/components/form-designer/form-widget/field-widget/fieldMixin.js +0 -613
- package/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue +0 -313
- package/src/components/form-designer/form-widget/field-widget/form-item-wrapper.vue +0 -331
- package/src/components/form-designer/form-widget/field-widget/html-text-widget.vue +0 -82
- package/src/components/form-designer/form-widget/field-widget/index.js +0 -10
- package/src/components/form-designer/form-widget/field-widget/input-widget.vue +0 -112
- package/src/components/form-designer/form-widget/field-widget/number-widget.vue +0 -103
- package/src/components/form-designer/form-widget/field-widget/picture-upload-widget.vue +0 -280
- package/src/components/form-designer/form-widget/field-widget/radio-widget.vue +0 -105
- package/src/components/form-designer/form-widget/field-widget/rate-widget.vue +0 -102
- package/src/components/form-designer/form-widget/field-widget/rich-editor-widget.vue +0 -123
- package/src/components/form-designer/form-widget/field-widget/select-widget.vue +0 -123
- package/src/components/form-designer/form-widget/field-widget/slider-widget.vue +0 -100
- package/src/components/form-designer/form-widget/field-widget/slot-widget.vue +0 -102
- package/src/components/form-designer/form-widget/field-widget/static-content-wrapper.vue +0 -196
- package/src/components/form-designer/form-widget/field-widget/static-text-widget.vue +0 -83
- package/src/components/form-designer/form-widget/field-widget/switch-widget.vue +0 -101
- package/src/components/form-designer/form-widget/field-widget/textarea-widget.vue +0 -99
- package/src/components/form-designer/form-widget/field-widget/time-range-widget.vue +0 -104
- package/src/components/form-designer/form-widget/field-widget/time-widget.vue +0 -103
- package/src/components/form-designer/form-widget/index.vue +0 -272
- package/src/components/form-designer/index.vue +0 -500
- package/src/components/form-designer/refMixinDesign.js +0 -28
- package/src/components/form-designer/setting-panel/form-setting.vue +0 -354
- package/src/components/form-designer/setting-panel/index.vue +0 -367
- package/src/components/form-designer/setting-panel/option-items-setting.vue +0 -234
- package/src/components/form-designer/setting-panel/property-editor/allowCreate-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/appendButton-editor.vue +0 -28
- package/src/components/form-designer/setting-panel/property-editor/appendButtonDisabled-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/automaticDropdown-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/border-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/buttonIcon-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/buttonStyle-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/clearable-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/columnWidth-editor.vue +0 -26
- package/src/components/form-designer/setting-panel/property-editor/container-grid/colHeight-editor.vue +0 -28
- package/src/components/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue +0 -81
- package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-offset-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-pull-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-push-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-responsive-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-span-editor.vue +0 -48
- package/src/components/form-designer/setting-panel/property-editor/container-sub-form/showBlankRow-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/container-sub-form/showRowNumber-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/container-sub-form/sub-form-labelAlign-editor.vue +0 -36
- package/src/components/form-designer/setting-panel/property-editor/container-tab/tab-customClass-editor.vue +0 -119
- package/src/components/form-designer/setting-panel/property-editor/container-table-cell/cellHeight-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/container-table-cell/cellWidth-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/container-table-cell/wordBreak-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/customClass-editor.vue +0 -40
- package/src/components/form-designer/setting-panel/property-editor/defaultValue-editor.vue +0 -25
- package/src/components/form-designer/setting-panel/property-editor/disabled-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/displayStyle-editor.vue +0 -26
- package/src/components/form-designer/setting-panel/property-editor/editable-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/endPlaceholder-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/event-handler/eventMixin.js +0 -12
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onAppendButtonClick-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onBeforeUpload-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onBlur-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onChange-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onClick-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onCreated-editor.vue +0 -31
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onFileRemove.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onFocus-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onInput-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onMounted-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onRemoteQuery-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onSubFormRowAdd-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onSubFormRowChange-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onSubFormRowDelete-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onSubFormRowInsert-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onUploadError-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onUploadSuccess-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onValidate-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/field-button/button-type-editor.vue +0 -32
- package/src/components/form-designer/setting-panel/property-editor/field-button/circle-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-button/icon-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-button/plain-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/field-button/round-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-cascader/cascader-defaultValue-editor.vue +0 -18
- package/src/components/form-designer/setting-panel/property-editor/field-cascader/cascader-multiple-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/field-cascader/checkStrictly-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-cascader/showAllLevels-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-checkbox/checkbox-defaultValue-editor.vue +0 -18
- package/src/components/form-designer/setting-panel/property-editor/field-color/color-defaultValue-editor.vue +0 -25
- package/src/components/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +0 -26
- package/src/components/form-designer/setting-panel/property-editor/field-date/date-format-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/field-date/date-type-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/field-date/date-valueFormat-editor.vue +0 -26
- package/src/components/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultValue-editor.vue +0 -26
- package/src/components/form-designer/setting-panel/property-editor/field-date-range/date-range-format-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/field-date-range/date-range-type-editor.vue +0 -27
- package/src/components/form-designer/setting-panel/property-editor/field-date-range/date-range-valueFormat-editor.vue +0 -26
- package/src/components/form-designer/setting-panel/property-editor/field-divider/contentPosition-editor.vue +0 -27
- package/src/components/form-designer/setting-panel/property-editor/field-file-upload/file-upload-fileTypes-editor.vue +0 -44
- package/src/components/form-designer/setting-panel/property-editor/field-html-text/htmlContent-editor.vue +0 -29
- package/src/components/form-designer/setting-panel/property-editor/field-number/controlsPosition-editor.vue +0 -27
- package/src/components/form-designer/setting-panel/property-editor/field-picture-upload/picture-upload-fileTypes-editor.vue +0 -44
- package/src/components/form-designer/setting-panel/property-editor/field-radio/radio-defaultValue-editor.vue +0 -18
- package/src/components/form-designer/setting-panel/property-editor/field-rate/allowHalf-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-rate/highThreshold-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/field-rate/lowThreshold-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue +0 -26
- package/src/components/form-designer/setting-panel/property-editor/field-rate/rate-max-editor.vue +0 -25
- package/src/components/form-designer/setting-panel/property-editor/field-rate/showScore-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-rate/showText-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-select/select-defaultValue-editor.vue +0 -18
- package/src/components/form-designer/setting-panel/property-editor/field-slider/range-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-slider/showStops-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-slider/vertical-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-static-text/fontSize-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-static-text/preWrap-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-static-text/textContent-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-switch/activeColor-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-switch/activeText-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-switch/inactiveColor-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-switch/inactiveText-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-switch/switch-defaultValue-editor.vue +0 -25
- package/src/components/form-designer/setting-panel/property-editor/field-switch/switchWidth-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +0 -26
- package/src/components/form-designer/setting-panel/property-editor/field-time/time-format-editor.vue +0 -27
- package/src/components/form-designer/setting-panel/property-editor/field-time-range/time-range-defaultValue-editor.vue +0 -26
- package/src/components/form-designer/setting-panel/property-editor/field-time-range/time-range-format-editor.vue +0 -27
- package/src/components/form-designer/setting-panel/property-editor/fileMaxSize-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/filterable-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/hidden-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/index.js +0 -10
- package/src/components/form-designer/setting-panel/property-editor/label-editor.vue +0 -30
- package/src/components/form-designer/setting-panel/property-editor/labelAlign-editor.vue +0 -42
- package/src/components/form-designer/setting-panel/property-editor/labelHidden-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/labelIconClass-editor.vue +0 -28
- package/src/components/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +0 -37
- package/src/components/form-designer/setting-panel/property-editor/labelTooltip-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/labelWidth-editor.vue +0 -25
- package/src/components/form-designer/setting-panel/property-editor/limit-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/max-editor.vue +0 -39
- package/src/components/form-designer/setting-panel/property-editor/maxLength-editor.vue +0 -40
- package/src/components/form-designer/setting-panel/property-editor/min-editor.vue +0 -40
- package/src/components/form-designer/setting-panel/property-editor/minLength-editor.vue +0 -41
- package/src/components/form-designer/setting-panel/property-editor/multiple-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/multipleLimit-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/multipleSelect-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/name-editor.vue +0 -89
- package/src/components/form-designer/setting-panel/property-editor/optionItems-editor.vue +0 -28
- package/src/components/form-designer/setting-panel/property-editor/placeholder-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/precision-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/prefixIcon-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/propertyMixin.js +0 -55
- package/src/components/form-designer/setting-panel/property-editor/readonly-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/remote-editor.vue +0 -25
- package/src/components/form-designer/setting-panel/property-editor/required-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/requiredHint-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/rows-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/showFileList-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/showPassword-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/showWordLimit-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/size-editor.vue +0 -38
- package/src/components/form-designer/setting-panel/property-editor/startPlaceholder-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/step-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/suffixIcon-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/textAlign-editor.vue +0 -35
- package/src/components/form-designer/setting-panel/property-editor/type-editor.vue +0 -33
- package/src/components/form-designer/setting-panel/property-editor/uploadTip-editor.vue +0 -24
- package/src/components/form-designer/setting-panel/property-editor/uploadURL-editor.vue +0 -28
- package/src/components/form-designer/setting-panel/property-editor/validation-editor.vue +0 -48
- package/src/components/form-designer/setting-panel/property-editor/validationHint-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor/withCredentials-editor.vue +0 -23
- package/src/components/form-designer/setting-panel/property-editor-factory.js +0 -173
- package/src/components/form-designer/setting-panel/propertyRegister.js +0 -215
- package/src/components/form-designer/toolbar-panel/index.vue +0 -886
- package/src/components/form-designer/widget-panel/index.vue +0 -394
- package/src/components/form-designer/widget-panel/templatesConfig.js +0 -58
- package/src/components/form-designer/widget-panel/widgetsConfig.js +0 -934
- package/src/components/form-render/container-item/container-item-wrapper.vue +0 -37
- package/src/components/form-render/container-item/containerItemMixin.js +0 -221
- package/src/components/form-render/container-item/grid-col-item.vue +0 -126
- package/src/components/form-render/container-item/grid-item.vue +0 -59
- package/src/components/form-render/container-item/index.js +0 -24
- package/src/components/form-render/container-item/sub-form-item.vue +0 -417
- package/src/components/form-render/container-item/tab-item.vue +0 -99
- package/src/components/form-render/container-item/table-cell-item.vue +0 -72
- package/src/components/form-render/container-item/table-item.vue +0 -70
- package/src/components/form-render/index.vue +0 -721
- package/src/components/form-render/refMixin.js +0 -30
- package/src/components/svg-icon/index.vue +0 -49
- package/src/components/v-table/index.vue +0 -106
- package/src/extension/components/tag/index.js +0 -9
- package/src/extension/components/tag/tag-item.vue +0 -49
- package/src/extension/components/tag/tag-schema.js +0 -33
- package/src/extension/components/tag/tag-widget.vue +0 -53
- package/src/extension/extension-helper.js +0 -23
- package/src/extension/extension-loader.js +0 -174
- package/src/extension/samples/alert/alert-widget.vue +0 -72
- package/src/extension/samples/card/card-item.vue +0 -100
- package/src/extension/samples/card/card-widget.vue +0 -132
- package/src/extension/samples/extension-schema.js +0 -36
- package/src/extension/samples/extension-sfc-generator.js +0 -50
- package/src/iconfont/iconfont.css +0 -29
- package/src/iconfont/iconfont.eot +0 -0
- package/src/iconfont/iconfont.js +0 -1
- package/src/iconfont/iconfont.json +0 -37
- package/src/iconfont/iconfont.svg +0 -35
- package/src/iconfont/iconfont.ttf +0 -0
- package/src/iconfont/iconfont.woff +0 -0
- package/src/iconfont/iconfont.woff2 +0 -0
- package/src/icons/index.js +0 -3
- package/src/icons/svg/alert.svg +0 -1
- package/src/icons/svg/button.svg +0 -1
- package/src/icons/svg/card.svg +0 -1
- package/src/icons/svg/cascader-field.svg +0 -1
- package/src/icons/svg/checkbox-field.svg +0 -1
- package/src/icons/svg/color-field.svg +0 -1
- package/src/icons/svg/custom-component.svg +0 -1
- package/src/icons/svg/data-table.svg +0 -1
- package/src/icons/svg/date-field.svg +0 -1
- package/src/icons/svg/date-range-field.svg +0 -1
- package/src/icons/svg/divider.svg +0 -1
- package/src/icons/svg/document.svg +0 -1
- package/src/icons/svg/drag.svg +0 -1
- package/src/icons/svg/file-upload-field.svg +0 -1
- package/src/icons/svg/github.svg +0 -1
- package/src/icons/svg/grid.svg +0 -1
- package/src/icons/svg/html-text.svg +0 -1
- package/src/icons/svg/node-tree.svg +0 -1
- package/src/icons/svg/number-field.svg +0 -1
- package/src/icons/svg/picture-upload-field.svg +0 -1
- package/src/icons/svg/radio-field.svg +0 -1
- package/src/icons/svg/rate-field.svg +0 -1
- package/src/icons/svg/redo.svg +0 -1
- package/src/icons/svg/rich-editor-field.svg +0 -1
- package/src/icons/svg/section.svg +0 -1
- package/src/icons/svg/select-field.svg +0 -1
- package/src/icons/svg/slider-field.svg +0 -1
- package/src/icons/svg/slot-component.svg +0 -1
- package/src/icons/svg/slot-field.svg +0 -1
- package/src/icons/svg/static-text.svg +0 -1
- package/src/icons/svg/sub-form.svg +0 -1
- package/src/icons/svg/switch-field.svg +0 -1
- package/src/icons/svg/tab.svg +0 -1
- package/src/icons/svg/table.svg +0 -1
- package/src/icons/svg/tag-field.svg +0 -4
- package/src/icons/svg/text-field.svg +0 -1
- package/src/icons/svg/textarea-field.svg +0 -1
- package/src/icons/svg/time-field.svg +0 -1
- package/src/icons/svg/time-range-field.svg +0 -1
- package/src/icons/svg/undo.svg +0 -1
- package/src/icons/svg/vue-sfc.svg +0 -1
- package/src/lang/en-US.js +0 -354
- package/src/lang/en-US_extension.js +0 -35
- package/src/lang/en-US_render.js +0 -38
- package/src/lang/zh-CN.js +0 -354
- package/src/lang/zh-CN_extension.js +0 -35
- package/src/lang/zh-CN_render.js +0 -38
- package/src/main.js +0 -29
- package/src/styles/global.scss +0 -108
- package/src/styles/index.scss +0 -15
- package/src/utils/beautifierLoader.js +0 -77
- package/src/utils/code-generator.js +0 -91
- package/src/utils/config.js +0 -9
- package/src/utils/debug-console.js +0 -7
- package/src/utils/directive.js +0 -74
- package/src/utils/emitter.js +0 -34
- package/src/utils/format.js +0 -214
- package/src/utils/i18n.js +0 -95
- package/src/utils/sfc-generator.js +0 -583
- package/src/utils/smart-vue-i18n/index.js +0 -56
- package/src/utils/smart-vue-i18n/utils.js +0 -47
- package/src/utils/util.js +0 -376
- package/src/utils/validators.js +0 -127
- package/src/utils/vue2js-generator.js +0 -144
- package/src/utils/vue3js-generator.js +0 -70
- /package/dist/{lib/VFormDesigner.css → VFormDesigner.css} +0 -0
- /package/dist/{lib/VFormDesigner.umd.min.js → VFormDesigner.umd.min.js} +0 -0
- /package/dist/{lib-render/VFormRender.css → VFormRender.css} +0 -0
- /package/dist/{lib-render/VFormRender.umd.min.js → VFormRender.umd.min.js} +0 -0
|
@@ -1,962 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* author: vformAdmin
|
|
3
|
-
* email: vdpadmin@163.com
|
|
4
|
-
* website: https://www.vform666.com
|
|
5
|
-
* date: 2021.08.18
|
|
6
|
-
* remark: 如果要分发VForm源码,需在本文件顶部保留此文件头信息!!
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import {deepClone, generateId, getDefaultFormConfig, overwriteObj} from "@/utils/util"
|
|
10
|
-
import {containers, advancedFields, basicFields, customFields} from "@/components/form-designer/widget-panel/widgetsConfig.js"
|
|
11
|
-
import {VARIANT_FORM_VERSION} from "@/utils/config"
|
|
12
|
-
|
|
13
|
-
export function createDesigner(vueInstance) {
|
|
14
|
-
let defaultFormConfig = deepClone( getDefaultFormConfig() )
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
widgetList: [],
|
|
18
|
-
formConfig: {cssCode: ''},
|
|
19
|
-
|
|
20
|
-
selectedId: null,
|
|
21
|
-
selectedWidget: null,
|
|
22
|
-
selectedWidgetName: null, //选中组件名称(唯一)
|
|
23
|
-
vueInstance: vueInstance,
|
|
24
|
-
|
|
25
|
-
formWidget: null, //表单设计容器
|
|
26
|
-
|
|
27
|
-
cssClassList: [], //自定义样式列表
|
|
28
|
-
|
|
29
|
-
historyData: {
|
|
30
|
-
index: -1, //index: 0,
|
|
31
|
-
maxStep: 20,
|
|
32
|
-
steps: [],
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
initDesigner(resetFormJson) {
|
|
36
|
-
this.widgetList = []
|
|
37
|
-
this.formConfig = deepClone(defaultFormConfig)
|
|
38
|
-
|
|
39
|
-
//输出版本信息和语雀链接
|
|
40
|
-
console.info(`%cVariantForm %cVer${VARIANT_FORM_VERSION} %chttps://www.yuque.com/visualdev/vform`,
|
|
41
|
-
"color:#409EFF;font-size: 22px;font-weight:bolder",
|
|
42
|
-
"color:#999;font-size: 12px",
|
|
43
|
-
"color:#333"
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
if (!resetFormJson) {
|
|
47
|
-
this.initHistoryData()
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
clearDesigner(skipHistoryChange) {
|
|
52
|
-
let emptyWidgetListFlag = (this.widgetList.length === 0)
|
|
53
|
-
this.widgetList = []
|
|
54
|
-
this.selectedId = null
|
|
55
|
-
this.selectedWidgetName = null
|
|
56
|
-
this.selectedWidget = {} //this.selectedWidget = null
|
|
57
|
-
overwriteObj(this.formConfig, defaultFormConfig) //
|
|
58
|
-
|
|
59
|
-
if (!!skipHistoryChange) {
|
|
60
|
-
//什么也不做!!
|
|
61
|
-
} else if (!emptyWidgetListFlag) {
|
|
62
|
-
this.emitHistoryChange()
|
|
63
|
-
} else {
|
|
64
|
-
this.saveCurrentHistoryStep()
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
loadPresetCssCode(preCssCode) {
|
|
69
|
-
if ((this.formConfig.cssCode === '') && !!preCssCode) {
|
|
70
|
-
this.formConfig.cssCode = preCssCode
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
getLayoutType() {
|
|
75
|
-
return this.formConfig.layoutType || 'PC'
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
changeLayoutType(newType) {
|
|
79
|
-
this.formConfig.layoutType = newType
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
getImportTemplate() {
|
|
83
|
-
return {
|
|
84
|
-
widgetList: [],
|
|
85
|
-
// formConfig: deepClone(this.formConfig)
|
|
86
|
-
formConfig: deepClone(defaultFormConfig)
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
loadFormJson(formJson) {
|
|
91
|
-
let modifiedFlag = false
|
|
92
|
-
|
|
93
|
-
if (!!formJson && !!formJson.widgetList) {
|
|
94
|
-
this.formWidget.clearWidgetRefList()
|
|
95
|
-
this.widgetList = formJson.widgetList
|
|
96
|
-
modifiedFlag = true
|
|
97
|
-
}
|
|
98
|
-
if (!!formJson && !!formJson.formConfig) {
|
|
99
|
-
//this.formConfig = importObj.formConfig
|
|
100
|
-
overwriteObj(this.formConfig, formJson.formConfig) /* 用=赋值,会导致inject依赖注入的formConfig属性变成非响应式 */
|
|
101
|
-
modifiedFlag = true
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (modifiedFlag) {
|
|
105
|
-
this.emitEvent('form-json-imported', []) // 通知其他组件
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return modifiedFlag
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
setSelected(selected) {
|
|
112
|
-
if (!selected) {
|
|
113
|
-
this.clearSelected()
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
this.selectedWidget = selected
|
|
118
|
-
if (!!selected.id) {
|
|
119
|
-
this.selectedId = selected.id
|
|
120
|
-
this.selectedWidgetName = selected.options.name
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
updateSelectedWidgetNameAndLabel(selectedWidget, newName, newLabel) {
|
|
125
|
-
this.selectedWidgetName = newName
|
|
126
|
-
//selectedWidget.options.name = newName //此行多余
|
|
127
|
-
if (!!newLabel && (Object.keys(selectedWidget.options).indexOf('label') > -1)) {
|
|
128
|
-
selectedWidget.options.label = newLabel
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
clearSelected() {
|
|
133
|
-
this.selectedId = null
|
|
134
|
-
this.selectedWidgetName = null
|
|
135
|
-
this.selectedWidget = {} //this.selectedWidget = null
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
checkWidgetMove(evt) { /* Only field widget can be dragged into sub-form */
|
|
139
|
-
if (!!evt.draggedContext && !!evt.draggedContext.element) {
|
|
140
|
-
let wgCategory = evt.draggedContext.element.category
|
|
141
|
-
let wgType = evt.draggedContext.element.type
|
|
142
|
-
if (!!evt.to) {
|
|
143
|
-
if ((evt.to.className === 'sub-form-table') && (wgCategory === 'container')) {
|
|
144
|
-
//this.$message.info(this.vueInstance.i18nt('designer.hint.onlyFieldWidgetAcceptable'))
|
|
145
|
-
return false
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return true
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
checkFieldMove(evt) {
|
|
154
|
-
if (!!evt.draggedContext && !!evt.draggedContext.element) {
|
|
155
|
-
let wgCategory = evt.draggedContext.element.category
|
|
156
|
-
let wgType = evt.draggedContext.element.type + ''
|
|
157
|
-
//console.log('wgType======', wgType)
|
|
158
|
-
if (!!evt.to) {
|
|
159
|
-
if ((evt.to.className === 'sub-form-table') && (wgType === 'slot')) {
|
|
160
|
-
//this.$message.info(this.vueInstance.i18nt('designer.hint.onlyFieldWidgetAcceptable'))
|
|
161
|
-
return false
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return true
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* 追加表格新行
|
|
171
|
-
* @param widget
|
|
172
|
-
*/
|
|
173
|
-
appendTableRow(widget) {
|
|
174
|
-
let rowIdx = widget.rows.length//确定插入行位置
|
|
175
|
-
let newRow = deepClone(widget.rows[widget.rows.length - 1])
|
|
176
|
-
newRow.id = 'table-row-' + generateId()
|
|
177
|
-
newRow.merged = false
|
|
178
|
-
newRow.cols.forEach(col => {
|
|
179
|
-
col.id = 'table-cell-' + generateId()
|
|
180
|
-
col.options.name = col.id
|
|
181
|
-
col.merged = false
|
|
182
|
-
col.options.colspan = 1
|
|
183
|
-
col.options.rowspan = 1
|
|
184
|
-
col.widgetList.length = 0
|
|
185
|
-
})
|
|
186
|
-
widget.rows.splice(rowIdx, 0, newRow)
|
|
187
|
-
|
|
188
|
-
this.emitHistoryChange()
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* 追加表格新列
|
|
193
|
-
* @param widget
|
|
194
|
-
*/
|
|
195
|
-
appendTableCol(widget) {
|
|
196
|
-
let colIdx = widget.rows[0].cols.length //确定插入列位置
|
|
197
|
-
widget.rows.forEach(row => {
|
|
198
|
-
let newCol = deepClone(this.getContainerByType('table-cell'))
|
|
199
|
-
newCol.id = 'table-cell-' + generateId()
|
|
200
|
-
newCol.options.name = newCol.id
|
|
201
|
-
newCol.merged = false
|
|
202
|
-
newCol.options.colspan = 1
|
|
203
|
-
newCol.options.rowspan = 1
|
|
204
|
-
newCol.widgetList.length = 0
|
|
205
|
-
row.cols.splice(colIdx, 0, newCol)
|
|
206
|
-
})
|
|
207
|
-
|
|
208
|
-
this.emitHistoryChange()
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
insertTableRow(widget, insertPos, cloneRowIdx, curCol, aboveFlag) {
|
|
212
|
-
let newRowIdx = !!aboveFlag ? insertPos : (insertPos + 1) //初步确定插入行位置
|
|
213
|
-
if (!aboveFlag) { //继续向下寻找同列第一个未被合并的单元格
|
|
214
|
-
let tmpRowIdx = newRowIdx
|
|
215
|
-
let rowFoundFlag = false
|
|
216
|
-
while (tmpRowIdx < widget.rows.length) {
|
|
217
|
-
if (!widget.rows[tmpRowIdx].cols[curCol].merged) {
|
|
218
|
-
newRowIdx = tmpRowIdx
|
|
219
|
-
rowFoundFlag = true
|
|
220
|
-
break
|
|
221
|
-
} else {
|
|
222
|
-
tmpRowIdx++
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if (!rowFoundFlag) {
|
|
227
|
-
newRowIdx = widget.rows.length
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
let newRow = deepClone( widget.rows[cloneRowIdx] )
|
|
232
|
-
newRow.id = 'table-row-' + generateId()
|
|
233
|
-
newRow.merged = false
|
|
234
|
-
newRow.cols.forEach(col => {
|
|
235
|
-
col.id = 'table-cell-' + generateId()
|
|
236
|
-
col.options.name = col.id
|
|
237
|
-
col.merged = false
|
|
238
|
-
col.options.colspan = 1
|
|
239
|
-
col.options.rowspan = 1
|
|
240
|
-
col.widgetList.length = 0
|
|
241
|
-
})
|
|
242
|
-
widget.rows.splice(newRowIdx, 0, newRow)
|
|
243
|
-
|
|
244
|
-
let colNo = 0
|
|
245
|
-
while ((newRowIdx < widget.rows.length - 1) && (colNo < widget.rows[0].cols.length)) { //越界判断
|
|
246
|
-
const cellOfNextRow = widget.rows[newRowIdx + 1].cols[colNo]
|
|
247
|
-
const rowMerged = cellOfNextRow.merged //确定插入位置下一行的单元格是否为合并单元格
|
|
248
|
-
if (!!rowMerged) {
|
|
249
|
-
let rowArray = widget.rows
|
|
250
|
-
let unMergedCell = {}
|
|
251
|
-
let startRowIndex = null
|
|
252
|
-
for (let i = newRowIdx; i >= 0; i--) { //查找该行已合并的主单元格
|
|
253
|
-
if (!rowArray[i].cols[colNo].merged && (rowArray[i].cols[colNo].options.rowspan > 1)) {
|
|
254
|
-
startRowIndex = i
|
|
255
|
-
unMergedCell = rowArray[i].cols[colNo]
|
|
256
|
-
break
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (!!unMergedCell.options) { //如果有符合条件的unMergedCell
|
|
261
|
-
let newRowspan = unMergedCell.options.rowspan + 1
|
|
262
|
-
this.setPropsOfMergedRows(widget.rows, startRowIndex, colNo, unMergedCell.options.colspan, newRowspan)
|
|
263
|
-
colNo += unMergedCell.options.colspan
|
|
264
|
-
} else {
|
|
265
|
-
colNo += 1
|
|
266
|
-
}
|
|
267
|
-
} else {
|
|
268
|
-
//colNo += 1
|
|
269
|
-
colNo += cellOfNextRow.options.colspan || 1
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
this.emitHistoryChange()
|
|
274
|
-
},
|
|
275
|
-
|
|
276
|
-
insertTableCol(widget, insertPos, curRow, leftFlag) {
|
|
277
|
-
let newColIdx = !!leftFlag ? insertPos : (insertPos + 1) //初步确定插入列位置
|
|
278
|
-
if (!leftFlag) { //继续向右寻找同行第一个未被合并的单元格
|
|
279
|
-
let tmpColIdx = newColIdx
|
|
280
|
-
let colFoundFlag = false
|
|
281
|
-
while (tmpColIdx < widget.rows[curRow].cols.length) {
|
|
282
|
-
if (!widget.rows[curRow].cols[tmpColIdx].merged) {
|
|
283
|
-
newColIdx = tmpColIdx
|
|
284
|
-
colFoundFlag = true
|
|
285
|
-
break
|
|
286
|
-
} else {
|
|
287
|
-
tmpColIdx++
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
if (!colFoundFlag) {
|
|
291
|
-
newColIdx = widget.rows[curRow].cols.length
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
widget.rows.forEach(row => {
|
|
297
|
-
let newCol = deepClone(this.getContainerByType('table-cell'))
|
|
298
|
-
newCol.id = 'table-cell-' + generateId()
|
|
299
|
-
newCol.options.name = newCol.id
|
|
300
|
-
newCol.merged = false
|
|
301
|
-
newCol.options.colspan = 1
|
|
302
|
-
newCol.options.rowspan = 1
|
|
303
|
-
newCol.widgetList.length = 0
|
|
304
|
-
row.cols.splice(newColIdx, 0, newCol)
|
|
305
|
-
})
|
|
306
|
-
|
|
307
|
-
let rowNo = 0
|
|
308
|
-
while((newColIdx < widget.rows[0].cols.length - 1) && (rowNo < widget.rows.length)) { //越界判断
|
|
309
|
-
const cellOfNextCol = widget.rows[rowNo].cols[newColIdx + 1]
|
|
310
|
-
const colMerged = cellOfNextCol.merged //确定插入位置右侧列的单元格是否为合并单元格
|
|
311
|
-
if (!!colMerged) {
|
|
312
|
-
let colArray = widget.rows[rowNo].cols
|
|
313
|
-
let unMergedCell = {}
|
|
314
|
-
let startColIndex = null
|
|
315
|
-
for (let i = newColIdx; i >= 0; i--) { //查找该行已合并的主单元格
|
|
316
|
-
if (!colArray[i].merged && (colArray[i].options.colspan > 1)) {
|
|
317
|
-
startColIndex = i
|
|
318
|
-
unMergedCell = colArray[i]
|
|
319
|
-
break
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if (!!unMergedCell.options) { //如果有符合条件的unMergedCell
|
|
324
|
-
let newColspan = unMergedCell.options.colspan + 1
|
|
325
|
-
this.setPropsOfMergedCols(widget.rows, rowNo, startColIndex, newColspan, unMergedCell.options.rowspan)
|
|
326
|
-
rowNo += unMergedCell.options.rowspan
|
|
327
|
-
} else {
|
|
328
|
-
rowNo += 1
|
|
329
|
-
}
|
|
330
|
-
} else {
|
|
331
|
-
//rowNo += 1
|
|
332
|
-
rowNo += cellOfNextCol.options.rowspan || 1
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
this.emitHistoryChange()
|
|
337
|
-
},
|
|
338
|
-
|
|
339
|
-
setPropsOfMergedCols(rowArray, startRowIndex, startColIndex, newColspan, rowspan) {
|
|
340
|
-
for (let i = startRowIndex; i < startRowIndex + rowspan; i++) {
|
|
341
|
-
for (let j = startColIndex; j < startColIndex + newColspan; j++) {
|
|
342
|
-
if ((i === startRowIndex) && (j === startColIndex)) {
|
|
343
|
-
rowArray[i].cols[j].options.colspan = newColspan //合并后的主单元格
|
|
344
|
-
continue
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
rowArray[i].cols[j].merged = true
|
|
348
|
-
rowArray[i].cols[j].options.colspan = newColspan
|
|
349
|
-
rowArray[i].cols[j].widgetList = []
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
|
|
354
|
-
setPropsOfMergedRows(rowArray, startRowIndex, startColIndex, colspan, newRowspan) {
|
|
355
|
-
for (let i = startRowIndex; i < startRowIndex + newRowspan; i++) {
|
|
356
|
-
for (let j = startColIndex; j < startColIndex + colspan; j++) {
|
|
357
|
-
if ((i === startRowIndex) && (j === startColIndex)) {
|
|
358
|
-
rowArray[i].cols[j].options.rowspan = newRowspan
|
|
359
|
-
continue
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
rowArray[i].cols[j].merged = true
|
|
363
|
-
rowArray[i].cols[j].options.rowspan = newRowspan
|
|
364
|
-
rowArray[i].cols[j].widgetList = []
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
},
|
|
368
|
-
|
|
369
|
-
setPropsOfSplitCol(rowArray, startRowIndex, startColIndex, colspan, rowspan) {
|
|
370
|
-
for (let i = startRowIndex; i < startRowIndex + rowspan; i++) {
|
|
371
|
-
for (let j = startColIndex; j < startColIndex + colspan; j++) {
|
|
372
|
-
rowArray[i].cols[j].merged = false;
|
|
373
|
-
rowArray[i].cols[j].options.rowspan = 1
|
|
374
|
-
rowArray[i].cols[j].options.colspan = 1
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
|
|
379
|
-
setPropsOfSplitRow(rowArray, startRowIndex, startColIndex, colspan, rowspan) {
|
|
380
|
-
for (let i = startRowIndex; i < startRowIndex + rowspan; i++) {
|
|
381
|
-
for (let j = startColIndex; j < startColIndex + colspan; j++) {
|
|
382
|
-
rowArray[i].cols[j].merged = false;
|
|
383
|
-
rowArray[i].cols[j].options.rowspan = 1
|
|
384
|
-
rowArray[i].cols[j].options.colspan = 1
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
},
|
|
388
|
-
|
|
389
|
-
mergeTableCol(rowArray, colArray, curRow, curCol, leftFlag, cellWidget) {
|
|
390
|
-
let mergedColIdx = !!leftFlag ? curCol : curCol + colArray[curCol].options.colspan
|
|
391
|
-
|
|
392
|
-
// let remainedColIdx = !!leftFlag ? curCol - colArray[curCol - 1].options.colspan : curCol
|
|
393
|
-
let remainedColIdx = !!leftFlag ? curCol - 1 : curCol
|
|
394
|
-
if (!!leftFlag) { //继续向左寻找同行未被合并的第一个单元格
|
|
395
|
-
let tmpColIdx = remainedColIdx
|
|
396
|
-
while (tmpColIdx >= 0) {
|
|
397
|
-
if (!rowArray[curRow].cols[tmpColIdx].merged) {
|
|
398
|
-
remainedColIdx = tmpColIdx
|
|
399
|
-
break;
|
|
400
|
-
} else {
|
|
401
|
-
tmpColIdx--
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
if (!!colArray[mergedColIdx].widgetList && (colArray[mergedColIdx].widgetList.length > 0)) { //保留widgetList
|
|
407
|
-
if (!colArray[remainedColIdx].widgetList || (colArray[remainedColIdx].widgetList.length === 0)) {
|
|
408
|
-
colArray[remainedColIdx].widgetList = deepClone(colArray[mergedColIdx].widgetList)
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
let newColspan = colArray[mergedColIdx].options.colspan * 1 + colArray[remainedColIdx].options.colspan * 1
|
|
413
|
-
this.setPropsOfMergedCols(rowArray, curRow, remainedColIdx, newColspan, cellWidget.options.rowspan)
|
|
414
|
-
|
|
415
|
-
this.emitHistoryChange()
|
|
416
|
-
},
|
|
417
|
-
|
|
418
|
-
mergeTableWholeRow(rowArray, colArray, rowIndex, colIndex) { //需要考虑操作的行存在已合并的单元格!!
|
|
419
|
-
//整行所有单元格行高不一致不可合并!!
|
|
420
|
-
let startRowspan = rowArray[rowIndex].cols[0].options.rowspan
|
|
421
|
-
let unmatchedFlag = false
|
|
422
|
-
for (let i = 1; i < rowArray[rowIndex].cols.length; i++) {
|
|
423
|
-
if (rowArray[rowIndex].cols[i].options.rowspan !== startRowspan) {
|
|
424
|
-
unmatchedFlag = true
|
|
425
|
-
break;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
if (unmatchedFlag) {
|
|
429
|
-
this.vueInstance.$message.info(this.vueInstance.i18nt('designer.hint.rowspanNotConsistentForMergeEntireRow'))
|
|
430
|
-
return
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
let widgetListCols = colArray.filter((colItem) => {
|
|
434
|
-
return !colItem.merged && !!colItem.widgetList && (colItem.widgetList.length > 0)
|
|
435
|
-
})
|
|
436
|
-
if (!!widgetListCols && (widgetListCols.length > 0)) { //保留widgetList
|
|
437
|
-
if ((widgetListCols[0].id !== colArray[0].id) && (!colArray[0].widgetList ||
|
|
438
|
-
colArray[0].widgetList.length <= 0)) {
|
|
439
|
-
colArray[0].widgetList = deepClone( widgetListCols[0].widgetList )
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
this.setPropsOfMergedCols(rowArray, rowIndex, 0, colArray.length, colArray[colIndex].options.rowspan)
|
|
444
|
-
|
|
445
|
-
this.emitHistoryChange()
|
|
446
|
-
},
|
|
447
|
-
|
|
448
|
-
mergeTableRow(rowArray, curRow, curCol, aboveFlag, cellWidget) {
|
|
449
|
-
let mergedRowIdx = !!aboveFlag ? curRow : curRow + cellWidget.options.rowspan
|
|
450
|
-
|
|
451
|
-
//let remainedRowIdx = !!aboveFlag ? curRow - cellWidget.options.rowspan : curRow
|
|
452
|
-
let remainedRowIdx = !!aboveFlag ? curRow - 1 : curRow
|
|
453
|
-
if (!!aboveFlag) { //继续向上寻找同列未被合并的第一个单元格
|
|
454
|
-
let tmpRowIdx = remainedRowIdx
|
|
455
|
-
while (tmpRowIdx >= 0) {
|
|
456
|
-
if (!rowArray[tmpRowIdx].cols[curCol].merged) {
|
|
457
|
-
remainedRowIdx = tmpRowIdx
|
|
458
|
-
break;
|
|
459
|
-
} else {
|
|
460
|
-
tmpRowIdx--
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
if (!!rowArray[mergedRowIdx].cols[curCol].widgetList && (rowArray[mergedRowIdx].cols[curCol].widgetList.length > 0)) { //保留widgetList
|
|
466
|
-
if (!rowArray[remainedRowIdx].cols[curCol].widgetList || (rowArray[remainedRowIdx].cols[curCol].widgetList.length === 0)) {
|
|
467
|
-
rowArray[remainedRowIdx].cols[curCol].widgetList = deepClone(rowArray[mergedRowIdx].cols[curCol].widgetList)
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
let newRowspan = rowArray[mergedRowIdx].cols[curCol].options.rowspan * 1 + rowArray[remainedRowIdx].cols[curCol].options.rowspan * 1
|
|
472
|
-
this.setPropsOfMergedRows(rowArray, remainedRowIdx, curCol, cellWidget.options.colspan, newRowspan)
|
|
473
|
-
|
|
474
|
-
this.emitHistoryChange()
|
|
475
|
-
},
|
|
476
|
-
|
|
477
|
-
mergeTableWholeCol(rowArray, colArray, rowIndex, colIndex) { //需要考虑操作的列存在已合并的单元格!!
|
|
478
|
-
//整列所有单元格列宽不一致不可合并!!
|
|
479
|
-
let startColspan = rowArray[0].cols[colIndex].options.colspan
|
|
480
|
-
let unmatchedFlag = false
|
|
481
|
-
for (let i = 1; i < rowArray.length; i++) {
|
|
482
|
-
if (rowArray[i].cols[colIndex].options.colspan !== startColspan) {
|
|
483
|
-
unmatchedFlag = true
|
|
484
|
-
break;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
if (unmatchedFlag) {
|
|
488
|
-
this.vueInstance.$message.info(this.vueInstance.i18nt('designer.hint.colspanNotConsistentForMergeEntireColumn'))
|
|
489
|
-
return
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
let widgetListCols = []
|
|
493
|
-
rowArray.forEach(rowItem => {
|
|
494
|
-
let tempCell = rowItem.cols[colIndex]
|
|
495
|
-
if (!tempCell.merged && !!tempCell.widgetList && (tempCell.widgetList.length > 0)) {
|
|
496
|
-
widgetListCols.push(tempCell)
|
|
497
|
-
}
|
|
498
|
-
})
|
|
499
|
-
|
|
500
|
-
let firstCellOfCol = rowArray[0].cols[colIndex]
|
|
501
|
-
if (!!widgetListCols && (widgetListCols.length > 0)) { //保留widgetList
|
|
502
|
-
if ((widgetListCols[0].id !== firstCellOfCol.id) && (!firstCellOfCol.widgetList ||
|
|
503
|
-
firstCellOfCol.widgetList.length <= 0)) {
|
|
504
|
-
firstCellOfCol.widgetList = deepClone( widgetListCols[0].widgetList )
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
this.setPropsOfMergedRows(rowArray, 0, colIndex, firstCellOfCol.options.colspan, rowArray.length)
|
|
509
|
-
|
|
510
|
-
this.emitHistoryChange()
|
|
511
|
-
},
|
|
512
|
-
|
|
513
|
-
undoMergeTableCol(rowArray, rowIndex, colIndex, colspan, rowspan) {
|
|
514
|
-
this.setPropsOfSplitCol(rowArray, rowIndex, colIndex, colspan, rowspan)
|
|
515
|
-
|
|
516
|
-
this.emitHistoryChange()
|
|
517
|
-
},
|
|
518
|
-
|
|
519
|
-
undoMergeTableRow(rowArray, rowIndex, colIndex, colspan, rowspan) {
|
|
520
|
-
this.setPropsOfSplitRow(rowArray, rowIndex, colIndex, colspan, rowspan)
|
|
521
|
-
|
|
522
|
-
this.emitHistoryChange()
|
|
523
|
-
},
|
|
524
|
-
|
|
525
|
-
deleteTableWholeCol(rowArray, colIndex) { //需考虑删除的是合并列!!
|
|
526
|
-
let onlyOneColFlag = true
|
|
527
|
-
rowArray.forEach(ri => {
|
|
528
|
-
if (ri.cols[0].options.colspan !== rowArray[0].cols.length) {
|
|
529
|
-
onlyOneColFlag = false
|
|
530
|
-
}
|
|
531
|
-
})
|
|
532
|
-
//仅剩一列则不可删除!!
|
|
533
|
-
if (onlyOneColFlag) {
|
|
534
|
-
this.vueInstance.$message.info(this.vueInstance.i18nt('designer.hint.lastColCannotBeDeleted'))
|
|
535
|
-
return
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
//整列所有单元格列宽不一致不可删除!!
|
|
539
|
-
let startColspan = rowArray[0].cols[colIndex].options.colspan
|
|
540
|
-
let unmatchedFlag = false
|
|
541
|
-
for (let i = 1; i < rowArray.length; i++) {
|
|
542
|
-
if (rowArray[i].cols[colIndex].options.colspan !== startColspan) {
|
|
543
|
-
unmatchedFlag = true
|
|
544
|
-
break;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
if (unmatchedFlag) {
|
|
548
|
-
this.vueInstance.$message.info(this.vueInstance.i18nt('designer.hint.colspanNotConsistentForDeleteEntireColumn'))
|
|
549
|
-
return
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
rowArray.forEach((rItem) => {
|
|
553
|
-
rItem.cols.splice(colIndex, startColspan)
|
|
554
|
-
})
|
|
555
|
-
|
|
556
|
-
this.emitHistoryChange()
|
|
557
|
-
},
|
|
558
|
-
|
|
559
|
-
deleteTableWholeRow(rowArray, rowIndex) { //需考虑删除的是合并行!!
|
|
560
|
-
let onlyOneRowFlag = true
|
|
561
|
-
rowArray[0].cols.forEach(ci => {
|
|
562
|
-
if (ci.options.rowspan !== rowArray.length) {
|
|
563
|
-
onlyOneRowFlag = false
|
|
564
|
-
}
|
|
565
|
-
})
|
|
566
|
-
//仅剩一行则不可删除!!
|
|
567
|
-
if (onlyOneRowFlag) {
|
|
568
|
-
this.vueInstance.$message.info(this.vueInstance.i18nt('designer.hint.lastRowCannotBeDeleted'))
|
|
569
|
-
return
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
//整行所有单元格行高不一致不可删除!!
|
|
573
|
-
let startRowspan = rowArray[rowIndex].cols[0].options.rowspan
|
|
574
|
-
let unmatchedFlag = false
|
|
575
|
-
for (let i = 1; i < rowArray[rowIndex].cols.length; i++) {
|
|
576
|
-
if (rowArray[rowIndex].cols[i].options.rowspan !== startRowspan) {
|
|
577
|
-
unmatchedFlag = true
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
if (unmatchedFlag) {
|
|
582
|
-
this.vueInstance.$message.info(this.vueInstance.i18nt('designer.hint.rowspanNotConsistentForDeleteEntireRow'))
|
|
583
|
-
return
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
rowArray.splice(rowIndex, startRowspan)
|
|
587
|
-
|
|
588
|
-
this.emitHistoryChange()
|
|
589
|
-
},
|
|
590
|
-
|
|
591
|
-
getContainerByType(typeName) {
|
|
592
|
-
let allWidgets = [...containers, ...basicFields, ...advancedFields, ...customFields]
|
|
593
|
-
let foundCon = null
|
|
594
|
-
allWidgets.forEach(con => {
|
|
595
|
-
if (!!con.category && !!con.type && (con.type === typeName)) {
|
|
596
|
-
foundCon = con
|
|
597
|
-
}
|
|
598
|
-
})
|
|
599
|
-
|
|
600
|
-
return foundCon
|
|
601
|
-
},
|
|
602
|
-
|
|
603
|
-
getFieldWidgetByType(typeName) {
|
|
604
|
-
let allWidgets = [...containers, ...basicFields, ...advancedFields, ...customFields]
|
|
605
|
-
let foundWidget = null
|
|
606
|
-
allWidgets.forEach(widget => {
|
|
607
|
-
if (!!!widget.category && !!widget.type && (widget.type === typeName)) {
|
|
608
|
-
foundWidget = widget
|
|
609
|
-
}
|
|
610
|
-
})
|
|
611
|
-
|
|
612
|
-
return foundWidget
|
|
613
|
-
},
|
|
614
|
-
|
|
615
|
-
hasConfig(widget, configName) {
|
|
616
|
-
let originalWidget = null
|
|
617
|
-
if (!!widget.category) {
|
|
618
|
-
originalWidget = this.getContainerByType(widget.type)
|
|
619
|
-
} else {
|
|
620
|
-
originalWidget = this.getFieldWidgetByType(widget.type)
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
if (!originalWidget || !originalWidget.options) {
|
|
624
|
-
return false
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
return Object.keys(originalWidget.options).indexOf(configName) > -1
|
|
628
|
-
},
|
|
629
|
-
|
|
630
|
-
upgradeWidgetConfig(oldWidget) {
|
|
631
|
-
let newWidget = null
|
|
632
|
-
if (!!oldWidget.category) {
|
|
633
|
-
newWidget = this.getContainerByType(oldWidget.type)
|
|
634
|
-
} else {
|
|
635
|
-
newWidget = this.getFieldWidgetByType(oldWidget.type)
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
if (!newWidget || !newWidget.options) {
|
|
639
|
-
return
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
Object.keys(newWidget.options).forEach(ck => {
|
|
643
|
-
if (!oldWidget.hasOwnProperty(ck)) {
|
|
644
|
-
oldWidget.options[ck] = deepClone(newWidget.options[ck])
|
|
645
|
-
}
|
|
646
|
-
})
|
|
647
|
-
},
|
|
648
|
-
|
|
649
|
-
upgradeFormConfig(oldFormConfig) {
|
|
650
|
-
Object.keys(this.formConfig).forEach(fc => {
|
|
651
|
-
if (!oldFormConfig.hasOwnProperty(fc)) {
|
|
652
|
-
oldFormConfig[fc] = deepClone(this.formConfig[fc])
|
|
653
|
-
}
|
|
654
|
-
})
|
|
655
|
-
},
|
|
656
|
-
|
|
657
|
-
cloneGridCol(widget, parentWidget) {
|
|
658
|
-
let newGridCol = deepClone(this.getContainerByType('grid-col'))
|
|
659
|
-
newGridCol.options.span = widget.options.span
|
|
660
|
-
let tmpId = generateId()
|
|
661
|
-
newGridCol.id = 'grid-col-' + tmpId
|
|
662
|
-
newGridCol.options.name = 'gridCol' + tmpId
|
|
663
|
-
|
|
664
|
-
parentWidget.cols.push(newGridCol)
|
|
665
|
-
},
|
|
666
|
-
|
|
667
|
-
cloneContainer(containWidget) {
|
|
668
|
-
if (containWidget.type === 'grid') {
|
|
669
|
-
let newGrid = deepClone(this.getContainerByType('grid'))
|
|
670
|
-
newGrid.id = newGrid.type + generateId()
|
|
671
|
-
newGrid.options.name = newGrid.id
|
|
672
|
-
containWidget.cols.forEach(gridCol => {
|
|
673
|
-
let newGridCol = deepClone(this.getContainerByType('grid-col'))
|
|
674
|
-
let tmpId = generateId()
|
|
675
|
-
newGridCol.id = 'grid-col-' + tmpId
|
|
676
|
-
newGridCol.options.name = 'gridCol' + tmpId
|
|
677
|
-
newGridCol.options.span = gridCol.options.span
|
|
678
|
-
newGrid.cols.push(newGridCol)
|
|
679
|
-
})
|
|
680
|
-
|
|
681
|
-
return newGrid
|
|
682
|
-
} else if (containWidget.type === 'table') {
|
|
683
|
-
let newTable = deepClone(this.getContainerByType('table'))
|
|
684
|
-
newTable.id = newTable.type + generateId()
|
|
685
|
-
newTable.options.name = newTable.id
|
|
686
|
-
containWidget.rows.forEach(tRow => {
|
|
687
|
-
let newRow = deepClone(tRow)
|
|
688
|
-
newRow.id = 'table-row-' + generateId()
|
|
689
|
-
newRow.cols.forEach(col => {
|
|
690
|
-
col.id = 'table-cell-' + generateId()
|
|
691
|
-
col.options.name = col.id
|
|
692
|
-
col.widgetList = [] //清空组件列表
|
|
693
|
-
})
|
|
694
|
-
newTable.rows.push(newRow)
|
|
695
|
-
})
|
|
696
|
-
|
|
697
|
-
return newTable
|
|
698
|
-
} else { //其他容器组件不支持clone操作
|
|
699
|
-
return null
|
|
700
|
-
}
|
|
701
|
-
},
|
|
702
|
-
|
|
703
|
-
moveUpWidget(parentList, indexOfParentList) {
|
|
704
|
-
if (!!parentList) {
|
|
705
|
-
if (indexOfParentList === 0) {
|
|
706
|
-
this.vueInstance.$message(this.vueInstance.i18nt('designer.hint.moveUpFirstChildHint'))
|
|
707
|
-
return
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
let tempWidget = parentList[indexOfParentList]
|
|
711
|
-
parentList.splice(indexOfParentList, 1)
|
|
712
|
-
parentList.splice(indexOfParentList - 1, 0, tempWidget)
|
|
713
|
-
}
|
|
714
|
-
},
|
|
715
|
-
|
|
716
|
-
moveDownWidget(parentList, indexOfParentList) {
|
|
717
|
-
if (!!parentList) {
|
|
718
|
-
if (indexOfParentList === parentList.length - 1) {
|
|
719
|
-
this.vueInstance.$message(this.vueInstance.i18nt('designer.hint.moveDownLastChildHint'))
|
|
720
|
-
return
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
let tempWidget = parentList[indexOfParentList]
|
|
724
|
-
parentList.splice(indexOfParentList, 1)
|
|
725
|
-
parentList.splice(indexOfParentList + 1, 0, tempWidget)
|
|
726
|
-
}
|
|
727
|
-
},
|
|
728
|
-
|
|
729
|
-
copyNewFieldWidget(origin) {
|
|
730
|
-
let newWidget = deepClone(origin)
|
|
731
|
-
let tempId = generateId()
|
|
732
|
-
newWidget.id = newWidget.type.replace(/-/g, '') + tempId
|
|
733
|
-
newWidget.options.name = newWidget.id
|
|
734
|
-
newWidget.options.label = newWidget.options.label || newWidget.type.toLowerCase()
|
|
735
|
-
|
|
736
|
-
delete newWidget.displayName
|
|
737
|
-
return newWidget
|
|
738
|
-
},
|
|
739
|
-
|
|
740
|
-
copyNewContainerWidget(origin) {
|
|
741
|
-
let newCon = deepClone(origin)
|
|
742
|
-
newCon.id = newCon.type.replace(/-/g, '') + generateId()
|
|
743
|
-
newCon.options.name = newCon.id
|
|
744
|
-
if (newCon.type === 'grid') {
|
|
745
|
-
let newCol = deepClone( this.getContainerByType('grid-col') )
|
|
746
|
-
let tmpId = generateId()
|
|
747
|
-
newCol.id = 'grid-col-' + tmpId
|
|
748
|
-
newCol.options.name = 'gridCol' + tmpId
|
|
749
|
-
newCon.cols.push(newCol)
|
|
750
|
-
//
|
|
751
|
-
newCol = deepClone(newCol)
|
|
752
|
-
tmpId = generateId()
|
|
753
|
-
newCol.id = 'grid-col-' + tmpId
|
|
754
|
-
newCol.options.name = 'gridCol' + tmpId
|
|
755
|
-
newCon.cols.push(newCol)
|
|
756
|
-
} else if (newCon.type === 'table') {
|
|
757
|
-
let newRow = {cols: []}
|
|
758
|
-
newRow.id = 'table-row-' + generateId()
|
|
759
|
-
newRow.merged = false
|
|
760
|
-
let newCell = deepClone( this.getContainerByType('table-cell') )
|
|
761
|
-
newCell.id = 'table-cell-' + generateId()
|
|
762
|
-
newCell.options.name = newCell.id
|
|
763
|
-
newCell.merged = false
|
|
764
|
-
newCell.options.colspan = 1
|
|
765
|
-
newCell.options.rowspan = 1
|
|
766
|
-
newRow.cols.push(newCell)
|
|
767
|
-
newCon.rows.push(newRow)
|
|
768
|
-
} else if (newCon.type === 'tab') {
|
|
769
|
-
let newTabPane = deepClone( this.getContainerByType('tab-pane') )
|
|
770
|
-
newTabPane.id = 'tab-pane-' + generateId()
|
|
771
|
-
newTabPane.options.name = 'tab1'
|
|
772
|
-
newTabPane.options.label = 'tab 1'
|
|
773
|
-
newCon.tabs.push(newTabPane)
|
|
774
|
-
}
|
|
775
|
-
//newCon.options.customClass = []
|
|
776
|
-
|
|
777
|
-
delete newCon.displayName
|
|
778
|
-
return newCon
|
|
779
|
-
},
|
|
780
|
-
|
|
781
|
-
addContainerByDbClick(container) {
|
|
782
|
-
let newCon = this.copyNewContainerWidget(container)
|
|
783
|
-
this.widgetList.push(newCon)
|
|
784
|
-
this.setSelected(newCon)
|
|
785
|
-
},
|
|
786
|
-
|
|
787
|
-
addFieldByDbClick(widget) {
|
|
788
|
-
let newWidget = this.copyNewFieldWidget(widget)
|
|
789
|
-
if (!!this.selectedWidget && this.selectedWidget.type === 'tab') {
|
|
790
|
-
//获取当前激活的tabPane
|
|
791
|
-
let activeTab = this.selectedWidget.tabs[0]
|
|
792
|
-
this.selectedWidget.tabs.forEach(tabPane => {
|
|
793
|
-
if (!!tabPane.options.active) {
|
|
794
|
-
activeTab = tabPane
|
|
795
|
-
}
|
|
796
|
-
})
|
|
797
|
-
|
|
798
|
-
!!activeTab && activeTab.widgetList.push(newWidget)
|
|
799
|
-
} else if (!!this.selectedWidget && !!this.selectedWidget.widgetList) {
|
|
800
|
-
this.selectedWidget.widgetList.push(newWidget)
|
|
801
|
-
} else {
|
|
802
|
-
this.widgetList.push(newWidget)
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
this.setSelected(newWidget)
|
|
806
|
-
this.emitHistoryChange()
|
|
807
|
-
},
|
|
808
|
-
|
|
809
|
-
deleteColOfGrid(gridWidget, colIdx) {
|
|
810
|
-
if (!!gridWidget && !!gridWidget.cols) {
|
|
811
|
-
gridWidget.cols.splice(colIdx, 1)
|
|
812
|
-
}
|
|
813
|
-
},
|
|
814
|
-
|
|
815
|
-
addNewColOfGrid(gridWidget) {
|
|
816
|
-
const cols = gridWidget.cols
|
|
817
|
-
let newGridCol = deepClone(this.getContainerByType('grid-col'))
|
|
818
|
-
let tmpId = generateId()
|
|
819
|
-
newGridCol.id = 'grid-col-' + tmpId
|
|
820
|
-
newGridCol.options.name = 'gridCol' + tmpId
|
|
821
|
-
if ((!!cols) && (cols.length > 0)) {
|
|
822
|
-
let spanSum = 0
|
|
823
|
-
cols.forEach((col) => {
|
|
824
|
-
spanSum += col.options.span
|
|
825
|
-
})
|
|
826
|
-
|
|
827
|
-
if (spanSum >= 24) {
|
|
828
|
-
//this.$message.info('列栅格之和超出24')
|
|
829
|
-
console.log('列栅格之和超出24')
|
|
830
|
-
gridWidget.cols.push(newGridCol)
|
|
831
|
-
} else {
|
|
832
|
-
newGridCol.options.span = (24 - spanSum) > 12 ? 12 : (24 - spanSum)
|
|
833
|
-
gridWidget.cols.push(newGridCol)
|
|
834
|
-
}
|
|
835
|
-
} else {
|
|
836
|
-
gridWidget.cols = [newGridCol]
|
|
837
|
-
}
|
|
838
|
-
},
|
|
839
|
-
|
|
840
|
-
addTabPaneOfTabs(tabsWidget) {
|
|
841
|
-
const tabPanes = tabsWidget.tabs
|
|
842
|
-
let newTabPane = deepClone( this.getContainerByType('tab-pane') )
|
|
843
|
-
newTabPane.id = 'tab-pane-' + generateId()
|
|
844
|
-
newTabPane.options.name = newTabPane.id
|
|
845
|
-
newTabPane.options.label = 'tab ' + (tabPanes.length + 1)
|
|
846
|
-
tabPanes.push(newTabPane)
|
|
847
|
-
},
|
|
848
|
-
|
|
849
|
-
deleteTabPaneOfTabs(tabsWidget, tpIdx) {
|
|
850
|
-
tabsWidget.tabs.splice(tpIdx, 1)
|
|
851
|
-
},
|
|
852
|
-
|
|
853
|
-
emitEvent(evtName, evtData) { //用于兄弟组件发射事件
|
|
854
|
-
this.vueInstance.$emit(evtName, evtData)
|
|
855
|
-
},
|
|
856
|
-
|
|
857
|
-
handleEvent(evtName, callback) { //用于兄弟组件接收事件
|
|
858
|
-
this.vueInstance.$on(evtName, (data) => callback(data))
|
|
859
|
-
},
|
|
860
|
-
|
|
861
|
-
setCssClassList(cssClassList) {
|
|
862
|
-
this.cssClassList = cssClassList
|
|
863
|
-
},
|
|
864
|
-
|
|
865
|
-
getCssClassList() {
|
|
866
|
-
return this.cssClassList
|
|
867
|
-
},
|
|
868
|
-
|
|
869
|
-
registerFormWidget(formWidget) {
|
|
870
|
-
this.formWidget = formWidget
|
|
871
|
-
},
|
|
872
|
-
|
|
873
|
-
initHistoryData() {
|
|
874
|
-
this.loadFormContentFromStorage()
|
|
875
|
-
this.historyData.index++
|
|
876
|
-
this.historyData.steps[this.historyData.index] = ({
|
|
877
|
-
widgetList: deepClone(this.widgetList),
|
|
878
|
-
formConfig: deepClone(this.formConfig)
|
|
879
|
-
})
|
|
880
|
-
},
|
|
881
|
-
|
|
882
|
-
emitHistoryChange() {
|
|
883
|
-
//console.log('------------', 'Form history changed!')
|
|
884
|
-
|
|
885
|
-
if (this.historyData.index === this.historyData.maxStep - 1) {
|
|
886
|
-
this.historyData.steps.shift()
|
|
887
|
-
} else {
|
|
888
|
-
this.historyData.index++
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
this.historyData.steps[this.historyData.index] = ({
|
|
892
|
-
widgetList: deepClone(this.widgetList),
|
|
893
|
-
formConfig: deepClone(this.formConfig)
|
|
894
|
-
})
|
|
895
|
-
|
|
896
|
-
this.saveFormContentToStorage()
|
|
897
|
-
|
|
898
|
-
if (this.historyData.index < this.historyData.steps.length - 1) {
|
|
899
|
-
this.historyData.steps = this.historyData.steps.slice(0, this.historyData.index + 1)
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
//console.log('history', this.historyData.index)
|
|
903
|
-
},
|
|
904
|
-
|
|
905
|
-
saveCurrentHistoryStep() {
|
|
906
|
-
this.historyData.steps[this.historyData.index] = deepClone({
|
|
907
|
-
widgetList: this.widgetList,
|
|
908
|
-
formConfig: this.formConfig
|
|
909
|
-
})
|
|
910
|
-
|
|
911
|
-
this.saveFormContentToStorage()
|
|
912
|
-
},
|
|
913
|
-
|
|
914
|
-
undoHistoryStep() {
|
|
915
|
-
if (this.historyData.index !== 0) {
|
|
916
|
-
this.historyData.index--
|
|
917
|
-
}
|
|
918
|
-
//console.log('undo', this.historyData.index)
|
|
919
|
-
|
|
920
|
-
this.widgetList = deepClone(this.historyData.steps[this.historyData.index].widgetList)
|
|
921
|
-
this.formConfig = deepClone(this.historyData.steps[this.historyData.index].formConfig)
|
|
922
|
-
},
|
|
923
|
-
|
|
924
|
-
redoHistoryStep() {
|
|
925
|
-
if (this.historyData.index !== (this.historyData.steps.length - 1)) {
|
|
926
|
-
this.historyData.index++
|
|
927
|
-
}
|
|
928
|
-
//console.log('redo', this.historyData.index)
|
|
929
|
-
|
|
930
|
-
this.widgetList = deepClone(this.historyData.steps[this.historyData.index].widgetList)
|
|
931
|
-
this.formConfig = deepClone(this.historyData.steps[this.historyData.index].formConfig)
|
|
932
|
-
},
|
|
933
|
-
|
|
934
|
-
undoEnabled() {
|
|
935
|
-
return (this.historyData.index > 0) && (this.historyData.steps.length > 0)
|
|
936
|
-
},
|
|
937
|
-
|
|
938
|
-
redoEnabled() {
|
|
939
|
-
return this.historyData.index < (this.historyData.steps.length - 1)
|
|
940
|
-
},
|
|
941
|
-
|
|
942
|
-
saveFormContentToStorage() {
|
|
943
|
-
window.localStorage.setItem('widget__list__backup', JSON.stringify(this.widgetList))
|
|
944
|
-
window.localStorage.setItem('form__config__backup', JSON.stringify(this.formConfig))
|
|
945
|
-
},
|
|
946
|
-
|
|
947
|
-
loadFormContentFromStorage() {
|
|
948
|
-
let widgetListBackup = window.localStorage.getItem('widget__list__backup')
|
|
949
|
-
if (!!widgetListBackup) {
|
|
950
|
-
this.widgetList = JSON.parse(widgetListBackup)
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
let formConfigBackup = window.localStorage.getItem('form__config__backup')
|
|
954
|
-
if (!!formConfigBackup) {
|
|
955
|
-
//this.formConfig = JSON.parse(formConfigBackup)
|
|
956
|
-
overwriteObj(this.formConfig, JSON.parse(formConfigBackup)) /* 用=赋值,会导致inject依赖注入的formConfig属性变成非响应式 */
|
|
957
|
-
}
|
|
958
|
-
},
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
}
|
|
962
|
-
}
|