@xfu0401/form-generator 1.0.21 → 1.0.22
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/package.json +1 -1
- package/.eslintrc.js +0 -48
- package/@xfu0401/form-generator/package.json +0 -62
- package/LICENSE +0 -127
- package/README.md +0 -268
- package/babel.config.js +0 -22
- package/public/favicon.ico +0 -0
- package/public/img/show/PixPin_2024-07-17_16-25-59.gif +0 -0
- package/public/img/show/PixPin_2024-07-17_16-33-51.png +0 -0
- package/public/img/show/file.png +0 -0
- package/public/img/show/image.png +0 -0
- package/public/img/show/pc/347/253/257/346/270/262/346/237/223.png +0 -0
- package/public/img/show/pc/347/253/257/350/257/246/346/203/205.png +0 -0
- package/public/img/show//344/272/213/344/273/266.png +0 -0
- package/public/img/show//345/205/250/345/261/200/344/272/213/344/273/266.png +0 -0
- package/public/img/show//345/205/250/345/261/200/346/240/267/345/274/217.png +0 -0
- package/public/img/show//346/240/267/345/274/217/345/261/236/346/200/247.png +0 -0
- package/public/img/show//347/247/273/345/212/250/347/253/257/346/270/262/346/237/223.png +0 -0
- package/public/img/show//347/247/273/345/212/250/347/253/257/350/257/246/346/203/205.png +0 -0
- package/public/img/show//347/274/226/350/276/221/345/231/2502.png +0 -0
- package/public/img/show//347/274/226/350/276/221/345/231/2503.png +0 -0
- package/public/img/show//347/274/226/350/276/221/345/231/2504.png +0 -0
- package/public/img/temp//344/270/273/344/273/216/350/241/250/345/215/225.jpg +0 -0
- package/public/img/temp//345/210/206/347/273/204/350/241/250/345/215/225.jpg +0 -0
- package/public/img/temp//345/215/225/345/210/227/350/241/250/345/215/225.jpg +0 -0
- package/public/img/temp//345/233/272/345/256/232/350/241/250/346/240/274/350/241/250/345/215/225.jpg +0 -0
- package/public/img/temp//345/244/232/345/210/227/350/241/250/345/215/225.jpg +0 -0
- package/public/img/temp//346/240/207/347/255/276/351/241/265/350/241/250/345/215/225.jpg +0 -0
- package/public/index.html +0 -25
- package/public/static/js/config.js +0 -2
- package/src/App.vue +0 -18
- package/src/api/data.js +0 -52
- package/src/components/Layout/Layout.vue +0 -28
- package/src/components/Layout/LeftMenu.vue +0 -46
- package/src/components/SvgIcon/index.vue +0 -43
- package/src/components/code/Code.vue +0 -98
- package/src/components/common/FGDialog.vue +0 -100
- package/src/components/editor/CodeDialog.vue +0 -68
- package/src/components/editor/CodeEditor.vue +0 -191
- package/src/components/editor/CodeJson.vue +0 -130
- package/src/components/editor/CssEditor.vue +0 -84
- package/src/components/editor/EventEditor.vue +0 -84
- package/src/components/editor/JsonDialog.vue +0 -55
- package/src/components/editor/JsonEditor.vue +0 -58
- package/src/components/editor/components/EditorLeft.vue +0 -138
- package/src/components/fileComs/ExportExcel.vue +0 -49
- package/src/components/fileComs/ExportJson.vue +0 -52
- package/src/components/fileComs/ImportExcel.vue +0 -96
- package/src/components/fileComs/ImportJson.vue +0 -65
- package/src/components/formGenerator/components/formExport.vue +0 -52
- package/src/components/formGenerator/components/formGeneratorAttrField.vue +0 -1113
- package/src/components/formGenerator/components/formGeneratorAttrForm.vue +0 -98
- package/src/components/formGenerator/components/formGeneratorCom.vue +0 -108
- package/src/components/formGenerator/components/formGeneratorOutline.vue +0 -159
- package/src/components/formGenerator/components/formGeneratorTemp.vue +0 -77
- package/src/components/formGenerator/components/formImport.vue +0 -62
- package/src/components/formGenerator/components/formPreview.vue +0 -102
- package/src/components/formGenerator/configComponents/DataConfig.vue +0 -156
- package/src/components/formGenerator/configComponents/DataDialog.vue +0 -188
- package/src/components/formGenerator/configComponents/EventConfig.vue +0 -56
- package/src/components/formGenerator/configComponents/PageConfig.vue +0 -55
- package/src/components/formGenerator/configComponents/RegConfig.vue +0 -105
- package/src/components/formGenerator/configComponents/ShadowConfig.vue +0 -95
- package/src/components/formGenerator/configComponents/SpaceConfig.vue +0 -187
- package/src/components/formGenerator/configComponents/StyleConfig.vue +0 -258
- package/src/components/formGenerator/configComponents/TableConfig.vue +0 -75
- package/src/components/formGenerator/configComponents/TableHead.vue +0 -141
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formButton.vue +0 -25
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formDivider.vue +0 -49
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formHtml.vue +0 -37
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formLink.vue +0 -26
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formNotice.vue +0 -118
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formRemark.vue +0 -29
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formSwipe.vue +0 -39
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formTable.vue +0 -130
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formTableExport.vue +0 -311
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formTag.vue +0 -30
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formText.vue +0 -27
- package/src/components/formGenerator/formComponents/pcComponents/assistComs/formTree.vue +0 -47
- package/src/components/formGenerator/formComponents/pcComponents/components/emptyTips.vue +0 -24
- package/src/components/formGenerator/formComponents/pcComponents/components/esignDialog.vue +0 -86
- package/src/components/formGenerator/formComponents/pcComponents/components/filesShow.vue +0 -121
- package/src/components/formGenerator/formComponents/pcComponents/components/imageShow.vue +0 -148
- package/src/components/formGenerator/formComponents/pcComponents/components/nameShow.vue +0 -54
- package/src/components/formGenerator/formComponents/pcComponents/components/tableOptions.vue +0 -56
- package/src/components/formGenerator/formComponents/pcComponents/components/tableStyle.vue +0 -58
- package/src/components/formGenerator/formComponents/pcComponents/components/userPicker.vue +0 -440
- package/src/components/formGenerator/formComponents/pcComponents/inputComs/formAutocomplete.vue +0 -79
- package/src/components/formGenerator/formComponents/pcComponents/inputComs/formInput.vue +0 -56
- package/src/components/formGenerator/formComponents/pcComponents/inputComs/formInputNumber.vue +0 -51
- package/src/components/formGenerator/formComponents/pcComponents/inputComs/formRichText.vue +0 -138
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formCard.vue +0 -35
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formCollapse.vue +0 -79
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formRowContainer.vue +0 -337
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formSteps.vue +0 -90
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formSub.vue +0 -219
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formTableContainer.vue +0 -277
- package/src/components/formGenerator/formComponents/pcComponents/layoutComs/formTabsContainer.vue +0 -65
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formCascader.vue +0 -62
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formCheckboxGroup.vue +0 -70
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formColorPicker.vue +0 -39
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formDatePicker.vue +0 -43
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formDaterangePicker.vue +0 -40
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formImage.vue +0 -235
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formOrgPicker.vue +0 -131
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formRadioGroup.vue +0 -59
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formRate.vue +0 -50
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formSelect.vue +0 -62
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formSelectHis.vue +0 -66
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formSelectProject.vue +0 -62
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formSignature.vue +0 -98
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formSlider.vue +0 -46
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formSwitch.vue +0 -37
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formTimePicker.vue +0 -41
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formTimerangePicker.vue +0 -40
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formUpload.vue +0 -253
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formUploadTemp.vue +0 -82
- package/src/components/formGenerator/formComponents/pcComponents/selectComs/formUserPicker.vue +0 -142
- package/src/components/formGenerator/formComponents/pcForm.vue +0 -155
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formButton.vue +0 -36
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formDivider.vue +0 -41
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formHtml.vue +0 -37
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formLink.vue +0 -49
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formNotice.vue +0 -43
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formRemark.vue +0 -39
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formSwipe.vue +0 -34
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formTable.vue +0 -132
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formTableExport.vue +0 -268
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formTag.vue +0 -147
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formText.vue +0 -27
- package/src/components/formGenerator/formComponents/phoneComponents/assistComs/formTree.vue +0 -21
- package/src/components/formGenerator/formComponents/phoneComponents/components/cascaderPicker.vue +0 -81
- package/src/components/formGenerator/formComponents/phoneComponents/components/datePicker.vue +0 -101
- package/src/components/formGenerator/formComponents/phoneComponents/components/esignDialog.vue +0 -156
- package/src/components/formGenerator/formComponents/phoneComponents/components/filesShow.vue +0 -128
- package/src/components/formGenerator/formComponents/phoneComponents/components/imageShow.vue +0 -123
- package/src/components/formGenerator/formComponents/phoneComponents/components/nameShow.vue +0 -84
- package/src/components/formGenerator/formComponents/phoneComponents/components/orgPicker.vue +0 -343
- package/src/components/formGenerator/formComponents/phoneComponents/components/tableShow.vue +0 -149
- package/src/components/formGenerator/formComponents/phoneComponents/components/textShow.vue +0 -25
- package/src/components/formGenerator/formComponents/phoneComponents/components/timePicker.vue +0 -90
- package/src/components/formGenerator/formComponents/phoneComponents/inputComs/formAutocomplete.vue +0 -163
- package/src/components/formGenerator/formComponents/phoneComponents/inputComs/formInput.vue +0 -111
- package/src/components/formGenerator/formComponents/phoneComponents/inputComs/formInputNumber.vue +0 -65
- package/src/components/formGenerator/formComponents/phoneComponents/inputComs/formRichText.vue +0 -147
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formCard.vue +0 -59
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formCollapse.vue +0 -71
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formRowContainer.vue +0 -94
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formSteps.vue +0 -112
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formSub.vue +0 -130
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formTableContainer.vue +0 -93
- package/src/components/formGenerator/formComponents/phoneComponents/layoutComs/formTabsContainer.vue +0 -64
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formCascader.vue +0 -210
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formCheckboxGroup.vue +0 -86
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formColorPicker.vue +0 -63
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formDatePicker.vue +0 -100
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formDateRangePicker.vue +0 -136
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formImage.vue +0 -278
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formOrgPicker.vue +0 -107
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formRadioGroup.vue +0 -93
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formRate.vue +0 -85
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formSelect.vue +0 -138
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formSelectHis.vue +0 -142
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formSelectProject.vue +0 -138
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formSignature.vue +0 -108
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formSlider.vue +0 -79
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formSwitch.vue +0 -88
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formTimePicker.vue +0 -112
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formTimeRangePicker.vue +0 -155
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formUpload.vue +0 -310
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formUploadTemp.vue +0 -81
- package/src/components/formGenerator/formComponents/phoneComponents/selectComs/formUserPicker.vue +0 -114
- package/src/components/formGenerator/formComponents/phoneForm.vue +0 -134
- package/src/components/formGenerator/formGenerator.vue +0 -401
- package/src/components/formGenerator/styles/generator.scss +0 -271
- package/src/components/formGenerator/styles/index.scss +0 -136
- package/src/components/formGenerator/styles/left-coms.scss +0 -57
- package/src/components/formGenerator/styles/phone.scss +0 -269
- package/src/components/formGenerator/styles/theme.scss +0 -5
- package/src/components/formGenerator/utils/attribute.js +0 -107
- package/src/components/formGenerator/utils/comMixins.js +0 -148
- package/src/components/formGenerator/utils/component.js +0 -26
- package/src/components/formGenerator/utils/config.js +0 -1730
- package/src/components/formGenerator/utils/event.js +0 -82
- package/src/components/formGenerator/utils/formEvent.js +0 -43
- package/src/components/formGenerator/utils/index.js +0 -666
- package/src/components/formGenerator/utils/rules.js +0 -17
- package/src/components/formGenerator/utils/style.js +0 -75
- package/src/components/formGenerator/utils/table.js +0 -317
- package/src/components/formGenerator/utils/temps.js +0 -15303
- package/src/components/huComponents/FGBreadNav.vue +0 -86
- package/src/components/huComponents/FGCheckCell.vue +0 -107
- package/src/components/huComponents/FGCheckList.vue +0 -318
- package/src/components/huComponents/FGCheckPopUp.vue +0 -164
- package/src/components/huComponents/FGIconsDialog.vue +0 -124
- package/src/components/huComponents/FGNameImg.vue +0 -147
- package/src/components/huComponents/FGOptions.vue +0 -118
- package/src/components/huComponents/FGSelect.vue +0 -46
- package/src/components/huComponents/FGTreeNode.vue +0 -103
- package/src/components/huComponents/FGTreeNodeDialog.vue +0 -89
- package/src/components/huComponents/InputColor.vue +0 -117
- package/src/components/huComponents/InputNumber.vue +0 -78
- package/src/components/huComponents/LayoutTree.vue +0 -67
- package/src/components/huComponents/MenuButton.vue +0 -57
- package/src/components/index.js +0 -14
- package/src/icons/index.js +0 -10
- package/src/icons/svg/active.svg +0 -1
- package/src/icons/svg/addSold.svg +0 -1
- package/src/icons/svg/analyse.svg +0 -1
- package/src/icons/svg/button.svg +0 -1
- package/src/icons/svg/card.svg +0 -1
- package/src/icons/svg/cascader.svg +0 -1
- package/src/icons/svg/checkbox.svg +0 -1
- package/src/icons/svg/collapse.svg +0 -1
- package/src/icons/svg/color.svg +0 -1
- package/src/icons/svg/component.svg +0 -1
- package/src/icons/svg/date-range.svg +0 -1
- package/src/icons/svg/date.svg +0 -1
- package/src/icons/svg/default-dept.svg +0 -9
- package/src/icons/svg/default-role.svg +0 -5
- package/src/icons/svg/default-user.svg +0 -16
- package/src/icons/svg/dept.svg +0 -1
- package/src/icons/svg/divider.svg +0 -1
- package/src/icons/svg/ellipsis.svg +0 -2
- package/src/icons/svg/html.svg +0 -1
- package/src/icons/svg/image.svg +0 -1
- package/src/icons/svg/input.svg +0 -1
- package/src/icons/svg/link.svg +0 -1
- package/src/icons/svg/mp4.svg +0 -19
- package/src/icons/svg/notice.svg +0 -1
- package/src/icons/svg/noview.svg +0 -1
- package/src/icons/svg/number.svg +0 -1
- package/src/icons/svg/password.svg +0 -1
- package/src/icons/svg/pdf.svg +0 -18
- package/src/icons/svg/person.svg +0 -1
- package/src/icons/svg/png.svg +0 -18
- package/src/icons/svg/ppt.svg +0 -19
- package/src/icons/svg/process.svg +0 -1
- package/src/icons/svg/radio.svg +0 -1
- package/src/icons/svg/rate.svg +0 -1
- package/src/icons/svg/remark.svg +0 -1
- package/src/icons/svg/rich-text.svg +0 -1
- package/src/icons/svg/row.svg +0 -1
- package/src/icons/svg/select.svg +0 -1
- package/src/icons/svg/signature.svg +0 -1
- package/src/icons/svg/slider.svg +0 -1
- package/src/icons/svg/steps.svg +0 -1
- package/src/icons/svg/sub.svg +0 -1
- package/src/icons/svg/swipe.svg +0 -1
- package/src/icons/svg/switch.svg +0 -1
- package/src/icons/svg/table-edit.svg +0 -1
- package/src/icons/svg/table.svg +0 -1
- package/src/icons/svg/table2.svg +0 -1
- package/src/icons/svg/table3.svg +0 -1
- package/src/icons/svg/tabs.svg +0 -1
- package/src/icons/svg/tag.svg +0 -1
- package/src/icons/svg/text.svg +0 -1
- package/src/icons/svg/textarea.svg +0 -1
- package/src/icons/svg/time-range.svg +0 -1
- package/src/icons/svg/time.svg +0 -1
- package/src/icons/svg/tree.svg +0 -1
- package/src/icons/svg/unknow.svg +0 -20
- package/src/icons/svg/upload.svg +0 -1
- package/src/icons/svg/view.svg +0 -1
- package/src/icons/svg/word.svg +0 -20
- package/src/icons/svg/xlsx.svg +0 -18
- package/src/icons/svg/zip.svg +0 -20
- package/src/images/phone_bg.png +0 -0
- package/src/main.js +0 -26
- package/src/package/FGDesigner.vue +0 -114
- package/src/package/FGPcForm.vue +0 -100
- package/src/package/FGPcShow.vue +0 -69
- package/src/package/FGPhoneForm.vue +0 -106
- package/src/package/FGPhoneShow.vue +0 -69
- package/src/package/common/init.js +0 -23
- package/src/package/common/initPc.js +0 -26
- package/src/package/common/initPhone.js +0 -28
- package/src/package/common/mixins.js +0 -57
- package/src/package/index.js +0 -40
- package/src/plugins/richEditor/richEditorPc.vue +0 -478
- package/src/plugins/richEditor/richEditorPhone.vue +0 -520
- package/src/plugins/voiceTxtarea/voiceTxtarea.vue +0 -115
- package/src/router.js +0 -111
- package/src/store/index.js +0 -14
- package/src/store/modules/app.js +0 -54
- package/src/store/modules/user.js +0 -23
- package/src/style/color.scss +0 -10
- package/src/style/main.scss +0 -78
- package/src/utils/comsData.js +0 -279
- package/src/utils/defaultValue.js +0 -2288
- package/src/utils/drawingDefalut.js +0 -2749
- package/src/utils/iconData.js +0 -283
- package/src/utils/index.js +0 -6
- package/src/utils/progress.js +0 -96
- package/src/utils/request.js +0 -41
- package/src/views/coms/components/Attributes.vue +0 -28
- package/src/views/coms/components/ELink.vue +0 -23
- package/src/views/coms/components/Events.vue +0 -20
- package/src/views/coms/components/Example.vue +0 -42
- package/src/views/coms/components/Methods.vue +0 -20
- package/src/views/coms/components/VLink.vue +0 -23
- package/src/views/coms/comsDesiger.vue +0 -224
- package/src/views/coms/comsFormPc.vue +0 -76
- package/src/views/coms/comsFormPhone.vue +0 -103
- package/src/views/coms/comsShowPc.vue +0 -56
- package/src/views/coms/comsShowPhone.vue +0 -89
- package/src/views/config/components/configCell.vue +0 -111
- package/src/views/config/config.vue +0 -84
- package/src/views/demo/demo.vue +0 -235
- package/src/views/demo/demo2.vue +0 -131
- package/src/views/demo/table.js +0 -321
- package/src/views/document/index.vue +0 -140
- package/src/views/form/create.vue +0 -44
- package/vue.config.js +0 -72
- /package/{@xfu0401/form-generator/demo.html → demo.html} +0 -0
- /package/{@xfu0401/form-generator/form-generator.common.js → form-generator.common.js} +0 -0
- /package/{@xfu0401/form-generator/form-generator.common.js.map → form-generator.common.js.map} +0 -0
- /package/{@xfu0401/form-generator/form-generator.css → form-generator.css} +0 -0
- /package/{@xfu0401/form-generator/form-generator.umd.js → form-generator.umd.js} +0 -0
- /package/{@xfu0401/form-generator/form-generator.umd.js.map → form-generator.umd.js.map} +0 -0
- /package/{@xfu0401/form-generator/form-generator.umd.min.js → form-generator.umd.min.js} +0 -0
- /package/{@xfu0401/form-generator/form-generator.umd.min.js.map → form-generator.umd.min.js.map} +0 -0
- /package/{@xfu0401/form-generator/static → static}/fonts/element-icons.535877f5.woff +0 -0
- /package/{@xfu0401/form-generator/static → static}/fonts/element-icons.732389de.ttf +0 -0
- /package/{@xfu0401/form-generator/static → static}/img/phone_bg.7ead1463.png +0 -0
|
@@ -1,666 +0,0 @@
|
|
|
1
|
-
import { inputComponents } from "./config"
|
|
2
|
-
import store from "@/store"
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 生成一个永不重复的 key
|
|
6
|
-
* @param { Number } randomLength
|
|
7
|
-
*/
|
|
8
|
-
export function getUuiKey(randomLength = 5) {
|
|
9
|
-
return Number(Math.random().toString().substr(2, randomLength) + Date.now()).toString(36)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// 给需要添加的控件添加自定义属性,即补充完整属性
|
|
13
|
-
export function createFormItem(item) {
|
|
14
|
-
if (!item) return item
|
|
15
|
-
const config = item.__config__ || {};
|
|
16
|
-
config.formId = `field${getUuiKey()}`; // 表单项id
|
|
17
|
-
if (!config.formKeyDisabled) {
|
|
18
|
-
if (!config.formKey) {
|
|
19
|
-
config.formKey = `${config.formId}`; // 表单标识符
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (item.id) item.id = getUuiKey()
|
|
24
|
-
// 根据容器布局类型设置不同的属性
|
|
25
|
-
// layout 布局型组件
|
|
26
|
-
if (config.tagType == 'layout') {
|
|
27
|
-
// 布局型组件
|
|
28
|
-
config.componentName = config.label || config.componentName;
|
|
29
|
-
!Array.isArray(item.children) && (item.children = []);
|
|
30
|
-
delete config.label; // 布局型组件无需配置label属性
|
|
31
|
-
} else {
|
|
32
|
-
item.__vModel__ = config.formId; // 字段名称
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (Array.isArray(item.children)) {
|
|
36
|
-
item.children = item.children.map((childItem) =>
|
|
37
|
-
createFormItem(childItem)
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return item;
|
|
42
|
-
}
|
|
43
|
-
// 更新修改后的表单列表,list-完整表单,value更新的表单项数据
|
|
44
|
-
export function updateForm(list, newValue) {
|
|
45
|
-
const formId = newValue.__config__?.formId;
|
|
46
|
-
const index = list.findIndex(
|
|
47
|
-
item => item.__config__.formId == formId
|
|
48
|
-
);
|
|
49
|
-
if (index > -1) {
|
|
50
|
-
// 在显示列表中找到选中的表单项,将修改后的内容更新在列表中
|
|
51
|
-
list.splice(index, 1, deepClone(newValue));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
// 根据不同表单项设置不同样式,isBorder-是否存在边框
|
|
55
|
-
export function changClass(item, currentData, formConf,) {
|
|
56
|
-
return {
|
|
57
|
-
"drawing-item-edit": true,
|
|
58
|
-
"drawing-item-hover": true,
|
|
59
|
-
"drawing-row-item":
|
|
60
|
-
formConf.unFocusedComponentBorder &&
|
|
61
|
-
item.__config__.formId != currentData?.__config__?.formId,
|
|
62
|
-
// "active-from-item":
|
|
63
|
-
// item.__config__.formId == currentData?.__config__?.formId &&
|
|
64
|
-
// !isRowCon,
|
|
65
|
-
"Fg-active": store.state.app.activeId == item.__config__?.formId,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// 1. 根据是否必填添加对应的必填校验(此处为了错误状态的中文显示)
|
|
70
|
-
// 2. 将“正则校验”属性中添加的规则中的字符串转为正则表达式(纯字符串无法识别)
|
|
71
|
-
export function formRules(item) {
|
|
72
|
-
if (item.disabled || item.readonly || item.onlyShow || item.isHide) return []
|
|
73
|
-
let ruleList = [];
|
|
74
|
-
// 添加必填的校验文字
|
|
75
|
-
if (item.__config__.required) {
|
|
76
|
-
ruleList.push({ required: true, message: `${item.__config__.label}不能为空` })
|
|
77
|
-
}
|
|
78
|
-
if (item.__config__.regList && item.__config__.regList.length) {
|
|
79
|
-
ruleList = ruleList.concat(formRulesReg(item.__config__.regList))
|
|
80
|
-
}
|
|
81
|
-
return ruleList
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// 将规则中的字符串转为正则表达式
|
|
85
|
-
export function formRulesReg(rules) {
|
|
86
|
-
let ruleList = [];
|
|
87
|
-
rules.forEach(rule => {
|
|
88
|
-
let obj = deepClone(rule);
|
|
89
|
-
let str = rule.pattern;
|
|
90
|
-
if (str[0] == "/" && str[str.length - 1] == "/") {
|
|
91
|
-
str = str.slice(1, str.length - 1);
|
|
92
|
-
}
|
|
93
|
-
// 需要将字符串转为正则字面量,不然无法识别
|
|
94
|
-
obj.pattern = new RegExp(str);
|
|
95
|
-
ruleList.push(obj);
|
|
96
|
-
});
|
|
97
|
-
return ruleList;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export function isNumberStr(str) {
|
|
101
|
-
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// 深拷贝对象
|
|
105
|
-
export function deepClone(obj) {
|
|
106
|
-
const _toString = Object.prototype.toString
|
|
107
|
-
|
|
108
|
-
// null, undefined, non-object, function
|
|
109
|
-
if (!obj || typeof obj !== 'object') {
|
|
110
|
-
return obj
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// DOM Node
|
|
114
|
-
if (obj.nodeType && 'cloneNode' in obj) {
|
|
115
|
-
return obj.cloneNode(true)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Date
|
|
119
|
-
if (_toString.call(obj) === '[object Date]') {
|
|
120
|
-
return new Date(obj.getTime())
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// RegExp
|
|
124
|
-
if (_toString.call(obj) === '[object RegExp]') {
|
|
125
|
-
const flags = []
|
|
126
|
-
if (obj.global) { flags.push('g') }
|
|
127
|
-
if (obj.multiline) { flags.push('m') }
|
|
128
|
-
if (obj.ignoreCase) { flags.push('i') }
|
|
129
|
-
|
|
130
|
-
return new RegExp(obj.source, flags.join(''))
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const result = Array.isArray(obj) ? [] : obj.constructor ? new obj.constructor() : {}
|
|
134
|
-
|
|
135
|
-
for (const key in obj) {
|
|
136
|
-
result[key] = deepClone(obj[key])
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return result
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// 将一个对象的每一个属性名都转换为驼峰命名,该对象存在多层嵌套
|
|
143
|
-
export function toCamelCase(obj) {
|
|
144
|
-
if (typeof obj === 'object' && obj !== null) {
|
|
145
|
-
let newObj = {};
|
|
146
|
-
if (Array.isArray(obj)) {
|
|
147
|
-
newObj = [];
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
for (const key in obj) {
|
|
151
|
-
if (obj.hasOwnProperty(key)) {
|
|
152
|
-
const camelCaseKey = toCamelCaseString(key);
|
|
153
|
-
newObj[camelCaseKey] = toCamelCase(obj[key]);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return newObj;
|
|
158
|
-
} else {
|
|
159
|
-
return obj;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
// 将字符串转换为驼峰命名法(CamelCase)
|
|
163
|
-
export function toCamelCaseString(str) {
|
|
164
|
-
return str.replace(/-([a-z])/g, function (g) {
|
|
165
|
-
return g[1].toUpperCase();
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
// 根据id查找对应树结构节点路径 tree:树结构;id: 对应节点;path:每次保存相应路径的节点
|
|
172
|
-
export function getPathById(tree, id, props = { text: 'text', value: 'value', children: 'children' }, path) {
|
|
173
|
-
if (!path) {
|
|
174
|
-
path = []
|
|
175
|
-
}
|
|
176
|
-
for (let i = 0; i < tree.length; i++) {
|
|
177
|
-
let tempPath = [...path]
|
|
178
|
-
tempPath.push(tree[i])
|
|
179
|
-
if (tree[i][props.value] === id) {
|
|
180
|
-
return tempPath
|
|
181
|
-
}
|
|
182
|
-
if (tree[i][props.children]) {
|
|
183
|
-
const reuslt = getPathById(tree[i][props.children], id, props, tempPath)
|
|
184
|
-
if (reuslt) {
|
|
185
|
-
return reuslt
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// 对文件名进行处理,将文件名称和后缀名分割开
|
|
192
|
-
export function formatFile(fileName) {
|
|
193
|
-
let file = {
|
|
194
|
-
name: '',
|
|
195
|
-
ext: '', // 后缀名
|
|
196
|
-
typeName: '', // 后缀名类型名称
|
|
197
|
-
}
|
|
198
|
-
const index = fileName?.lastIndexOf('.')
|
|
199
|
-
if (index == -1) {
|
|
200
|
-
file.name = fileName
|
|
201
|
-
} else {
|
|
202
|
-
file.name = fileName.substring(0, index)
|
|
203
|
-
file.ext = fileName.substring(index + 1, fileName.length)
|
|
204
|
-
file.typeName = getFileType(file.ext).name
|
|
205
|
-
file.svg = getFileType(file.ext).svg
|
|
206
|
-
}
|
|
207
|
-
return file
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// 根据后缀名得到该文件的类型,为文档/图片/音频/视频
|
|
211
|
-
export function getFileType(ext) {
|
|
212
|
-
const fileType = [
|
|
213
|
-
{
|
|
214
|
-
name: '文档',
|
|
215
|
-
type: ["doc", "docx"],
|
|
216
|
-
svg: 'word',
|
|
217
|
-
}, {
|
|
218
|
-
name: '表格',
|
|
219
|
-
type: ["xls", "xlsx",],
|
|
220
|
-
svg: 'xlsx'
|
|
221
|
-
}, {
|
|
222
|
-
name: '演示文稿',
|
|
223
|
-
type: ["ppt", "pptx",],
|
|
224
|
-
svg: "ppt",
|
|
225
|
-
}, {
|
|
226
|
-
name: 'pdf',
|
|
227
|
-
type: ["pdf",],
|
|
228
|
-
svg: "pdf",
|
|
229
|
-
}, {
|
|
230
|
-
name: '压缩包',
|
|
231
|
-
type: ["rar", "zip",],
|
|
232
|
-
svg: 'zip'
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: '图片',
|
|
236
|
-
type: ["jpg", "jpeg", "png", "bmp", "gif"],
|
|
237
|
-
svg: 'png',
|
|
238
|
-
}, {
|
|
239
|
-
name: '视频',
|
|
240
|
-
type: ["mp4", "mov", "wmv", "flv", "avi", "3gp"],
|
|
241
|
-
svg: 'mp4'
|
|
242
|
-
}
|
|
243
|
-
]
|
|
244
|
-
let type = {
|
|
245
|
-
name: '',
|
|
246
|
-
svg: 'unknow'
|
|
247
|
-
}
|
|
248
|
-
fileType.forEach(el => {
|
|
249
|
-
const index = el.type.findIndex(v => v === ext)
|
|
250
|
-
if (index > -1) {
|
|
251
|
-
type.name = el.name
|
|
252
|
-
type.svg = el.svg
|
|
253
|
-
}
|
|
254
|
-
})
|
|
255
|
-
|
|
256
|
-
return type
|
|
257
|
-
}
|
|
258
|
-
// 遍历树,对树的节点进行操作,该树为数组结构
|
|
259
|
-
export function traverseTree(tree, fun) {
|
|
260
|
-
for (let i = 0; i < tree.length; i++) {
|
|
261
|
-
const currentNode = tree[i];
|
|
262
|
-
// 处理当前节点
|
|
263
|
-
if (fun) fun(currentNode)
|
|
264
|
-
// 如果当前节点有子节点,递归遍历子节点
|
|
265
|
-
if (currentNode && Array.isArray(currentNode.children) && currentNode.children.length > 0) {
|
|
266
|
-
traverseTree(currentNode.children, fun);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
// 去掉树中为null的节点 nodes=Array
|
|
271
|
-
export function cleanTree(nodes) {
|
|
272
|
-
return nodes.filter(node => {
|
|
273
|
-
// 如果节点是对象且包含 children 属性,则递归清理
|
|
274
|
-
if (node && typeof node === 'object' && node.children) {
|
|
275
|
-
node.children = cleanTree(node.children); // 递归调用 cleanTree
|
|
276
|
-
return true; // 返回 true 以保留节点
|
|
277
|
-
}
|
|
278
|
-
// 如果节点不是 null,则保留节点
|
|
279
|
-
return node !== null;
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
// 将树结构转为数组
|
|
285
|
-
export function treeToArray(tree, children = 'children') {
|
|
286
|
-
let treeData = JSON.parse(JSON.stringify(tree))
|
|
287
|
-
let ary = []
|
|
288
|
-
treeData.forEach(item => {
|
|
289
|
-
if (item[children]) {
|
|
290
|
-
ary.push(item)
|
|
291
|
-
if (item[children].length > 0) {
|
|
292
|
-
ary.push(...treeToArray(item[children], children))
|
|
293
|
-
}
|
|
294
|
-
} else {
|
|
295
|
-
ary.push(item)
|
|
296
|
-
}
|
|
297
|
-
delete item[children]
|
|
298
|
-
})
|
|
299
|
-
return ary
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
export function getOptionsText(defaultValue, options, props = { label: 'label', value: 'value' }) {
|
|
304
|
-
// const options = item.__slot__.options
|
|
305
|
-
// const defaultValue = item.__config__.defaultValue
|
|
306
|
-
let text = ''
|
|
307
|
-
if (defaultValue) {
|
|
308
|
-
const arr = Array.isArray(defaultValue) ? defaultValue : defaultValue.split(",")
|
|
309
|
-
text = options.filter(item => arr.includes(item[props.value])).map(item => item[props.label]).join(",")
|
|
310
|
-
}
|
|
311
|
-
return text
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// 2. 时间区间
|
|
315
|
-
export function getDateText(item) {
|
|
316
|
-
let text = item.__config__.defaultValue
|
|
317
|
-
if (Array.isArray(item.__config__.defaultValue)) {
|
|
318
|
-
text = `${item.__config__.defaultValue[0]} ${item["rangeSeparator"]} ${item.__config__.defaultValue[1]}`
|
|
319
|
-
}
|
|
320
|
-
return text
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
export function formTreeToArray(tree) {
|
|
324
|
-
let treeData = deepClone(tree);
|
|
325
|
-
let ary = [];
|
|
326
|
-
treeData.forEach((item) => {
|
|
327
|
-
if (!item) return
|
|
328
|
-
if (item.children) {
|
|
329
|
-
// ary.push(item);
|
|
330
|
-
if (item.children.length > 0) {
|
|
331
|
-
ary.push(...formTreeToArray(item.children));
|
|
332
|
-
}
|
|
333
|
-
} else {
|
|
334
|
-
ary.push(item);
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
return ary;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
// 表单校验
|
|
341
|
-
export function validateForm(data) {
|
|
342
|
-
let errorMsg = [] // 用于存储错误提示
|
|
343
|
-
// 1. 平铺表单,去除行容器
|
|
344
|
-
const list = formTreeToArray(data)
|
|
345
|
-
// 2. 存储所有表单标题
|
|
346
|
-
// const labels = list.map(item => item.__config__.label)
|
|
347
|
-
list.forEach(item => {
|
|
348
|
-
if (item) {
|
|
349
|
-
const label = item?.__config__?.label
|
|
350
|
-
// 3-1. 校验标题不能为空
|
|
351
|
-
if (!label) {
|
|
352
|
-
const name = inputComponents.find(itemm => itemm.__config__.tag === item.__config__.tag)?.__config__?.label
|
|
353
|
-
errorMsg.push(`${name}标题不能为空`)
|
|
354
|
-
}
|
|
355
|
-
// 3-2. 表单名称不允许重复
|
|
356
|
-
const labels = list.filter(itemm => itemm.__config__.label === label)
|
|
357
|
-
if (label && labels.length > 1) {
|
|
358
|
-
errorMsg.push(`${label}标题名称重复`)
|
|
359
|
-
}
|
|
360
|
-
// 3.3 多选、单选、下拉选框、级联选择器选项不能为空
|
|
361
|
-
const options = item.__slot__?.options || item.options || null
|
|
362
|
-
if (options && options.length === 0) {
|
|
363
|
-
errorMsg.push(`${label}未设置选项`)
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
})
|
|
367
|
-
errorMsg = [...new Set(errorMsg)]
|
|
368
|
-
|
|
369
|
-
if (errorMsg.length) {
|
|
370
|
-
return { valid: false, errorMsg }
|
|
371
|
-
}
|
|
372
|
-
return { valid: true, errorMsg }
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// 根据 keyName 求两个数组的交集,keyName为数组内对象的属性名称
|
|
376
|
-
export function intersectionFun(arr1, arr2, keyName = 'value') {
|
|
377
|
-
const arr3 = arr1.map(item => item[keyName])
|
|
378
|
-
const arr4 = arr2.filter(x => new Set(arr3).has(x[keyName]))
|
|
379
|
-
return arr4
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
// 根据 keyName 求两个数组的差集,keyName为数组内对象的属性名称
|
|
383
|
-
export function differenceSetFun(arr1, arr2, keyName = 'value') {
|
|
384
|
-
let arr3 = arr1.filter(v => {
|
|
385
|
-
return arr2.every(e => e[keyName] != v[keyName]);
|
|
386
|
-
});
|
|
387
|
-
return arr3
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
// 根据 keyName 求两个数组的并集,keyName为数组内对象的属性名称
|
|
391
|
-
export function unionFun(arr1, arr2, keyName = 'value') {
|
|
392
|
-
let arr3 = arr1.concat(arr2)
|
|
393
|
-
let obj = []
|
|
394
|
-
let result = arr3.reduce((prev, cur) => {
|
|
395
|
-
obj[cur[keyName]] ? '' : obj[cur[keyName]] = true && prev.push(cur)
|
|
396
|
-
return prev
|
|
397
|
-
}, [])
|
|
398
|
-
return result
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
// 根据key和value将值填入到表单当中
|
|
402
|
-
export function setFormValue(list, form) {
|
|
403
|
-
list.forEach(item => {
|
|
404
|
-
if (form && form[item.__config__.formId]) {
|
|
405
|
-
item.__config__.defaultValue = form[item.__config__.formId]
|
|
406
|
-
}
|
|
407
|
-
if (item && item.children && item.children.length) {
|
|
408
|
-
item.children = setFormValue(item.children, form)
|
|
409
|
-
}
|
|
410
|
-
})
|
|
411
|
-
return list
|
|
412
|
-
}
|
|
413
|
-
// 将object对象转为array的对象
|
|
414
|
-
export function objectToArray(object) {
|
|
415
|
-
let array = [];
|
|
416
|
-
for (const key in object) {
|
|
417
|
-
const value = object[key];
|
|
418
|
-
array.push({ key, value, type: typeof value });
|
|
419
|
-
}
|
|
420
|
-
return array;
|
|
421
|
-
}
|
|
422
|
-
// 将array数据转为object的数据
|
|
423
|
-
export function arrayToObject(array) {
|
|
424
|
-
let obj = {}
|
|
425
|
-
for (let index = 0; index < array.length; index++) {
|
|
426
|
-
const element = array[index];
|
|
427
|
-
console.log(element);
|
|
428
|
-
obj[element.key] = element.value
|
|
429
|
-
}
|
|
430
|
-
return obj
|
|
431
|
-
}
|
|
432
|
-
// 转base64码
|
|
433
|
-
export function getBase64(file) {
|
|
434
|
-
return new Promise((resolve, reject) => {
|
|
435
|
-
const reader = new FileReader();
|
|
436
|
-
let fileResult = "";
|
|
437
|
-
reader.readAsDataURL(file);
|
|
438
|
-
// 开始转
|
|
439
|
-
reader.onload = () => {
|
|
440
|
-
fileResult = reader.result;
|
|
441
|
-
};
|
|
442
|
-
// 转 失败
|
|
443
|
-
reader.onerror = (error) => {
|
|
444
|
-
reject(error);
|
|
445
|
-
};
|
|
446
|
-
// 转 结束
|
|
447
|
-
reader.onloadend = () => {
|
|
448
|
-
resolve(fileResult);
|
|
449
|
-
};
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
// 获取颜色的r/g/b数值
|
|
454
|
-
export function getRGBNum(color) {
|
|
455
|
-
const type = detectColorFormat(color)
|
|
456
|
-
let colorObj = {}
|
|
457
|
-
switch (type) {
|
|
458
|
-
case "RGB":
|
|
459
|
-
colorObj = rgbToRGB(color)
|
|
460
|
-
break
|
|
461
|
-
case "HEX":
|
|
462
|
-
colorObj = hexToRGB(color)
|
|
463
|
-
break
|
|
464
|
-
case "HSL":
|
|
465
|
-
break
|
|
466
|
-
default:
|
|
467
|
-
// colorObj = nameToRGB(color)
|
|
468
|
-
break
|
|
469
|
-
}
|
|
470
|
-
return colorObj
|
|
471
|
-
}
|
|
472
|
-
// color:#fff000
|
|
473
|
-
export function hexToRGB(color) {
|
|
474
|
-
const r = parseInt(color.slice(1, 3), 16);
|
|
475
|
-
const g = parseInt(color.slice(3, 5), 16);
|
|
476
|
-
const b = parseInt(color.slice(5, 7), 16);
|
|
477
|
-
return { r, g, b };
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// color:red
|
|
481
|
-
export function nameToRGB(color) {
|
|
482
|
-
}
|
|
483
|
-
// color:rgb(255,255,0)
|
|
484
|
-
export function rgbToRGB(color) {
|
|
485
|
-
// 正则表达式匹配 RGB 格式的颜色字符串
|
|
486
|
-
const rgbRegex = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/;
|
|
487
|
-
const matches = color.match(rgbRegex);
|
|
488
|
-
if (matches) {
|
|
489
|
-
return {
|
|
490
|
-
r: parseInt(matches[1], 10),
|
|
491
|
-
g: parseInt(matches[2], 10),
|
|
492
|
-
b: parseInt(matches[3], 10)
|
|
493
|
-
};
|
|
494
|
-
} else {
|
|
495
|
-
throw new Error('Invalid RGB color format');
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
export function detectColorFormat(color) {
|
|
500
|
-
// 正则表达式匹配 RGB 格式
|
|
501
|
-
const rgbRegex = /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/;
|
|
502
|
-
// 正则表达式匹配十六进制格式(包括3位和6位)
|
|
503
|
-
const hexRegex = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
504
|
-
// 正则表达式匹配 HSL 格式
|
|
505
|
-
const hslRegex = /^hsl\((\d{1,3}),\s*(\d{1,3})%,\s*(\d{1,3})%\)$/;
|
|
506
|
-
|
|
507
|
-
if (rgbRegex.test(color)) {
|
|
508
|
-
return 'RGB';
|
|
509
|
-
} else if (hexRegex.test(color)) {
|
|
510
|
-
return 'HEX';
|
|
511
|
-
} else if (hslRegex.test(color)) {
|
|
512
|
-
return 'HSL';
|
|
513
|
-
} else {
|
|
514
|
-
return 'Unknown';
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
export function flattenObject(obj) {
|
|
519
|
-
const result = {};
|
|
520
|
-
|
|
521
|
-
function flatten(currentObj, parentKey) {
|
|
522
|
-
for (const key in currentObj) {
|
|
523
|
-
if (currentObj.hasOwnProperty(key)) {
|
|
524
|
-
const fullKey = key;
|
|
525
|
-
if (typeof currentObj[key] === 'object' && currentObj[key] !== null && !Array.isArray(currentObj[key])) {
|
|
526
|
-
flatten(currentObj[key], fullKey);
|
|
527
|
-
} else {
|
|
528
|
-
result[fullKey] = currentObj[key];
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
flatten(obj);
|
|
534
|
-
return result;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
// 合并两个对象,保留两个对象存在值的属性
|
|
538
|
-
export function mergeObjects(obj1, obj2) {
|
|
539
|
-
const result = { ...obj1 }; // 创建一个obj1的浅拷贝
|
|
540
|
-
// 遍历obj2的所有属性
|
|
541
|
-
for (const key in obj2) {
|
|
542
|
-
if (obj2.hasOwnProperty(key)) {
|
|
543
|
-
// 检查obj2中的属性值是否不是空字符串
|
|
544
|
-
if (obj2[key] !== "") {
|
|
545
|
-
result[key] = obj2[key]; // 如果不是,则覆盖或添加到结果对象中
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
return result;
|
|
550
|
-
}
|
|
551
|
-
// 从Base64编码到File对象
|
|
552
|
-
export function base64ToFile(dataURL, filename) {
|
|
553
|
-
let arr = dataURL?.split?.(",");
|
|
554
|
-
let youType = arr[0].match(/:(.*?);/)[1];
|
|
555
|
-
let bstr = atob(arr[1]),
|
|
556
|
-
n = bstr.length,
|
|
557
|
-
u8arr = new Uint8Array(n);
|
|
558
|
-
while (n--) {
|
|
559
|
-
u8arr[n] = bstr.charCodeAt(n);
|
|
560
|
-
}
|
|
561
|
-
return new File([u8arr], filename + "." + youType.split("/")[1], {
|
|
562
|
-
type: youType,
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
//数组元素互换位置
|
|
567
|
-
export function swapArray(arr, index1, index2) {
|
|
568
|
-
arr[index1] = arr.splice(index2, 1, arr[index1])[0];
|
|
569
|
-
return arr;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
// 将CSS代码格式的字符串转换为对象
|
|
573
|
-
export function cssToObject(cssString) {
|
|
574
|
-
const obj = {};
|
|
575
|
-
const rules = cssString.split(';'); // 分割字符串为规则数组
|
|
576
|
-
rules.forEach(rule => {
|
|
577
|
-
if (rule.trim()) {
|
|
578
|
-
const [property, value] = rule.split(':').map(s => s.trim());
|
|
579
|
-
if (property && value) {
|
|
580
|
-
obj[property] = value;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
return obj;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
// 将配置的css样式转为代码可识别格式
|
|
588
|
-
export function handleStyle(style, fontObj) {
|
|
589
|
-
if (!style) return {}
|
|
590
|
-
const className = style.className
|
|
591
|
-
let styleObj = deepClone(flattenObject(style))
|
|
592
|
-
const cssList = store.state.app.cssList
|
|
593
|
-
const cssSelect = cssList.filter(itemm => className?.includes(itemm.name))
|
|
594
|
-
const cssString = cssSelect.map(itemm => itemm.code).join("")
|
|
595
|
-
const cssObject = cssToObject(cssString);
|
|
596
|
-
// 合并对象
|
|
597
|
-
const mergeObj = mergeObjects(fontObj, mergeObjects(cssObject, styleObj))
|
|
598
|
-
const font = {
|
|
599
|
-
color: mergeObj.color,
|
|
600
|
-
"textAlign": mergeObj.textAlign,
|
|
601
|
-
"lineHeight": mergeObj.lineHeight,
|
|
602
|
-
"fontSize": mergeObj.fontSize,
|
|
603
|
-
"fontWeight": mergeObj.fontWeight,
|
|
604
|
-
"letterSpacing": mergeObj.letterSpacing,
|
|
605
|
-
"textDecorationLine": mergeObj.textDecorationLine,
|
|
606
|
-
"textDecorationColor": mergeObj.textDecorationColor,
|
|
607
|
-
"textDecorationStyle": mergeObj.textDecorationStyle,
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
return { ...mergeObj, font }
|
|
611
|
-
// let styleStr1 = cssSelect.map(itemm => itemm.code).join("")
|
|
612
|
-
// const styleStr2 = Object.entries(styleObj)
|
|
613
|
-
// .map(([key, value]) => `${key}:${value}`)
|
|
614
|
-
// .join(';');
|
|
615
|
-
// return styleStr1 + styleStr2
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
// 获取当前组件绑定事件的代码 eventName事件名称 event参数 item 组件配置
|
|
619
|
-
export function getEventCode() {
|
|
620
|
-
|
|
621
|
-
}
|
|
622
|
-
// 触发自定义事件 eventName事件名称 event参数 item 组件配置,self this指针
|
|
623
|
-
export function handleEvent(eventName, event, item, self) {
|
|
624
|
-
if (item && item.event) {
|
|
625
|
-
const eventList = store.state.app.eventList // 全局事件列表
|
|
626
|
-
let eventFun = deepClone(item.event)
|
|
627
|
-
// 获取选中的全局事件
|
|
628
|
-
const eventSelect = eventList.filter(itemm => eventFun.eventName?.includes(itemm.name))
|
|
629
|
-
eventSelect.forEach(item => {
|
|
630
|
-
eventFun[item.name].code = eventFun[item.name].code || item.code
|
|
631
|
-
})
|
|
632
|
-
// console.log(eventName, event, eventFun);
|
|
633
|
-
if (eventFun && eventFun[eventName]) {
|
|
634
|
-
// name:方法名 params:参数 code 方法执行代码
|
|
635
|
-
const { name, params, code } = eventFun[eventName] || {};
|
|
636
|
-
if (code) {
|
|
637
|
-
// 使用 new Function 执行传入的代码字符串
|
|
638
|
-
const func = new Function(params, code);
|
|
639
|
-
func.call(self, event);
|
|
640
|
-
// console.log("🚀 ~ ~ ", item.__config__?.label, " ~ ~ 🚀")
|
|
641
|
-
// func(event);
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
// 获取请求参数数据
|
|
648
|
-
export function getRequestData(dataObj) {
|
|
649
|
-
// 请求数据类型 JSON/FormData
|
|
650
|
-
if (dataObj.reDataType == 'FormData') {
|
|
651
|
-
return getFormData(dataObj.request)
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
return dataObj.request
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
// 获取FormData数据
|
|
658
|
-
export function getFormData(obj) {
|
|
659
|
-
if (!obj) return obj
|
|
660
|
-
let formData = new FormData()
|
|
661
|
-
for (const key in obj) {
|
|
662
|
-
formData.append(key, obj[key]);
|
|
663
|
-
}
|
|
664
|
-
return formData
|
|
665
|
-
}
|
|
666
|
-
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// 内置的正则校验规则
|
|
2
|
-
export default [
|
|
3
|
-
{ label: '手机号码', value: '/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$/' },
|
|
4
|
-
{ label: '座机号码', value: '/^(0\\d{2,3})-?(\\d{7,8})$/' },
|
|
5
|
-
{ label: '电子邮箱', value: '/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/' },
|
|
6
|
-
{ label: '身份证号码(普通校验)', value: '/(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)/' },
|
|
7
|
-
{ label: '身份证号码(精准校验18位)', value: '/^[1-9]\\d{5}(19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$/' },
|
|
8
|
-
{ label: '身份证号码(精准校验15位)', value: '/^[1-9]\\d{5}\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{2}[0-9Xx]$/' },
|
|
9
|
-
{ label: 'QQ号码', value: '/^[1-9][0-9]\\d{4,9}$/' },
|
|
10
|
-
{ label: '邮政编码', value: '/^[1-9]\\d{5}$/' },
|
|
11
|
-
// { label: '', value: '' },
|
|
12
|
-
// { label: '', value: '' },
|
|
13
|
-
// { label: '', value: '' },
|
|
14
|
-
// { label: '', value: '' },
|
|
15
|
-
// { label: '', value: '' },
|
|
16
|
-
|
|
17
|
-
]
|