lanceJiang 1 éve
szülő
commit
15a4523ba3

+ 79 - 66
src/components/packages/formEditor/config.vue

@@ -7,91 +7,104 @@ import _ from 'lodash-es'
 import defaultProps from './defaultProps'
 import { globalConfig } from './componentsConfig'
 export default {
-  name: 'Everright-form-config'
+	name: 'EverrightFormConfig'
 }
 </script>
 <script setup>
 const emit = defineEmits(['listener'])
-const props = defineProps(_.merge({
-  field: {
-    type: [Object, String],
-    required: true
-  },
-  fields: {
-    type: Array,
-    default: () => ([])
-  }
-}, defaultProps))
+const props = defineProps(
+	_.merge(
+		{
+			field: {
+				type: [Object, String],
+				required: true
+			},
+			fields: {
+				type: Array,
+				default: () => []
+			}
+		},
+		defaultProps
+	)
+)
 const layout = {
-  pc: [],
-  mobile: []
+	pc: [],
+	mobile: []
 }
 const state = reactive({
-  store: [],
-  selected: {},
-  config: globalConfig,
-  platform: 'pc',
-  Namespace: 'formEditor',
-  validateStates: [],
-  data: {},
-  mode: 'config',
-  fields: props.fields,
-  logic: {}
+	store: [],
+	selected: {},
+	config: globalConfig,
+	platform: 'pc',
+	Namespace: 'formEditor',
+	validateStates: [],
+	data: {},
+	mode: 'config',
+	fields: props.fields,
+	logic: {}
 })
 const element = ref('')
 const ns = hooks.useNamespace('Main', state.Namespace)
 const loading = ref(false)
-const setSelection = (node) => {
-  let result = ''
-  if (node === 'root') {
-    result = state.config
-  } else {
-    if (node.type === 'inline') {
-      result = node.columns[0]
-    } else {
-      result = node
-    }
-  }
-  state.selected = result
+const setSelection = node => {
+	let result = ''
+	if (node === 'root') {
+		result = state.config
+	} else {
+		if (node.type === 'inline') {
+			result = node.columns[0]
+		} else {
+			result = node
+		}
+	}
+	state.selected = result
 }
-const switchPlatform = (platform) => {
-  state.platform = platform
+const switchPlatform = platform => {
+	state.platform = platform
 }
 const fireEvent = (type, data) => {
-  emit('listener', {
-    type,
-    data
-  })
+	emit('listener', {
+		type,
+		data
+	})
 }
 provide('Everright', {
-  state,
-  emit,
-  props,
-  setSelection,
-  switchPlatform,
-  fireEvent
-})
-watch(() => props.field, (newVal) => {
-  if (newVal !== 'root') {
-    state.store[0] = newVal
-    utils.addContext(newVal, state.store)
-  }
-  setSelection(newVal)
-}, {
-  immediate: true
+	state,
+	emit,
+	props,
+	setSelection,
+	switchPlatform,
+	fireEvent
 })
+watch(
+	() => props.field,
+	newVal => {
+		if (newVal !== 'root') {
+			state.store[0] = newVal
+			utils.addContext(newVal, state.store)
+		}
+		setSelection(newVal)
+	},
+	{
+		immediate: true
+	}
+)
 defineExpose({
-  switchPlatform (platform) {
-    state.platform = platform
-  }
-})
-watch(() => state.selected, (newVal) => {
-  fireEvent('changeParams', _.cloneDeep(newVal))
-}, {
-  deep: true,
-  immediate: true
+	switchPlatform(platform) {
+		state.platform = platform
+	}
 })
+watch(
+	() => state.selected,
+	newVal => {
+		fireEvent('changeParams', _.cloneDeep(newVal))
+	},
+	{
+		deep: true,
+		immediate: true
+	}
+)
 </script>
 <template>
-  <ConfigPanel mode="config"></ConfigPanel>
+	<ConfigPanel mode="config"></ConfigPanel>
 </template>

+ 53 - 53
src/components/packages/formEditor/defaultProps.js

@@ -1,56 +1,56 @@
 import { fieldsConfig, globalConfig } from './componentsConfig'
 export default {
-  fieldsConfig: {
-    type: Array,
-    default: () => fieldsConfig
-  },
-  globalConfig: {
-    type: Object,
-    default: () => globalConfig
-  },
-  lang: {
-    type: String,
-    default: 'zh-cn'
-  },
-  layoutType: {
-    type: Number,
-    default: 1
-  },
-  fileUploadURI: {
-    type: String
-  },
-  configPanelWidth: {
-    type: String,
-    default: '320px'
-  },
-  isShowCompleteButton: {
-    type: Boolean,
-    default: true
-  },
-  checkPropsBySelected: {
-    type: Function,
-    default: () => {}
-  },
-  quickImages: {
-    type: Array,
-    default: () => []
-  },
-  quickImageLimit: {
-    type: Number,
-    default: 5
-  },
-  quickColors: {
-    type: Array,
-    default: () => [
-      'rgba(255, 255, 255, 1)',
-      'rgba(249, 249, 249, 1)',
-      'rgba(233, 233, 233, 1)',
-      'rgba(254, 249, 210, 1)',
-      'rgba(253, 246, 236, 1)',
-      'rgba(254, 241, 241, 1)',
-      'rgba(236, 246, 255, 1)',
-      'rgba(235, 242, 244, 1)',
-      'rgba(240, 249, 236, 1)'
-    ]
-  }
+	fieldsConfig: {
+		type: Array,
+		default: () => fieldsConfig
+	},
+	globalConfig: {
+		type: Object,
+		default: () => globalConfig
+	},
+	lang: {
+		type: String,
+		default: 'zh-cn'
+	},
+	layoutType: {
+		type: Number,
+		default: 1
+	},
+	fileUploadURI: {
+		type: String
+	},
+	configPanelWidth: {
+		type: String,
+		default: '320px'
+	},
+	isShowCompleteButton: {
+		type: Boolean,
+		default: true
+	},
+	checkPropsBySelected: {
+		type: Function,
+		default: () => {}
+	},
+	quickImages: {
+		type: Array,
+		default: () => []
+	},
+	quickImageLimit: {
+		type: Number,
+		default: 5
+	},
+	quickColors: {
+		type: Array,
+		default: () => [
+			'rgba(255, 255, 255, 1)',
+			'rgba(249, 249, 249, 1)',
+			'rgba(233, 233, 233, 1)',
+			'rgba(254, 249, 210, 1)',
+			'rgba(253, 246, 236, 1)',
+			'rgba(254, 241, 241, 1)',
+			'rgba(236, 246, 255, 1)',
+			'rgba(235, 242, 244, 1)',
+			'rgba(240, 249, 236, 1)'
+		]
+	}
 }

+ 19 - 21
src/components/packages/formEditor/generatorData.js

@@ -1,25 +1,23 @@
 import locale from '@ER/formEditor/locale'
 import utils from '@ER/utils'
 export default function (node, isWrap = true, lang = 'zh-cn', isCreateLabel = true, eachBack) {
-  const newNode = isWrap
-    ? {
-        type: 'inline',
-        columns: [
-          node
-        ]
-      }
-    : node
-  const result = utils.wrapElement(newNode, eachBack && eachBack)
-  if (isCreateLabel) {
-    node.label = utils.transferData(lang, utils.transferLabelPath(node), locale)
-    // if (/^(input|textarea|number|radio|checkbox|select|time|date|rate|switch|slider|html|cascader|uploadfile|signature|region)$/.test()) {}
-    if (/^(select|cascader|region|date|time)$/.test(node.type)) {
-      node.options.placeholder = utils.transferData(lang, 'er.validateMsg.placeholder2', locale)
-    }
-    if (/^(input|textarea|html)$/.test(node.type)) {
-      node.options.placeholder = utils.transferData(lang, 'er.validateMsg.placeholder1', locale)
-    }
-    // node.options.placeholder
-  }
-  return result
+	const newNode = isWrap
+		? {
+				type: 'inline',
+				columns: [node]
+		  }
+		: node
+	const result = utils.wrapElement(newNode, eachBack && eachBack)
+	if (isCreateLabel) {
+		node.label = utils.transferData(lang, utils.transferLabelPath(node), locale)
+		// if (/^(input|textarea|number|radio|checkbox|select|time|date|rate|switch|slider|html|cascader|uploadfile|signature|region)$/.test()) {}
+		if (/^(select|cascader|region|date|time)$/.test(node.type)) {
+			node.options.placeholder = utils.transferData(lang, 'er.validateMsg.placeholder2', locale)
+		}
+		if (/^(input|textarea|html)$/.test(node.type)) {
+			node.options.placeholder = utils.transferData(lang, 'er.validateMsg.placeholder1', locale)
+		}
+		// node.options.placeholder
+	}
+	return result
 }

+ 5 - 12
src/components/packages/formEditor/index.js

@@ -6,15 +6,8 @@ import erGeneratorData from './generatorData'
 import * as erComponentsConfig from './componentsConfig'
 import utils from '@ER/utils'
 /*
-* er-form-editor
-* er-form-preview
-* er-form-configPanel
-* */
-export {
-  erFormEditor,
-  erFormPreview,
-  erFormConfig,
-  erGeneratorData,
-  erComponentsConfig,
-  utils
-}
+ * er-form-editor
+ * er-form-preview
+ * er-form-configPanel
+ * */
+export { erFormEditor, erFormPreview, erFormConfig, erGeneratorData, erComponentsConfig, utils }

+ 248 - 282
src/components/packages/formEditor/locale/en.js

@@ -1,286 +1,252 @@
 export default {
-  er: {
-    panels: {
-      config: 'Form Attribute'
-    },
-    fields: {
-      input: [
-        'Input',
-        'Email',
-        'ID number',
-        'Cellphone',
-        'URL'
-      ],
-      textarea: 'Textarea',
-      number: 'Number',
-      radio: 'Radio',
-      checkbox: 'Checkbox',
-      select: ['Select', 'Employee', 'Role', 'Department'],
-      time: 'Time',
-      date: 'Date',
-      rate: 'Rate',
-      switch: 'Switch',
-      slider: 'Slider',
-      html: 'Html',
+	er: {
+		panels: {
+			config: 'Form Attribute'
+		},
+		fields: {
+			input: ['Input', 'Email', 'ID number', 'Cellphone', 'URL'],
+			textarea: 'Textarea',
+			number: 'Number',
+			radio: 'Radio',
+			checkbox: 'Checkbox',
+			select: ['Select', 'Employee', 'Role', 'Department'],
+			time: 'Time',
+			date: 'Date',
+			rate: 'Rate',
+			switch: 'Switch',
+			slider: 'Slider',
+			html: 'Html',
 			cascader: ['Cascader', 'Depart'],
-      uploadfile: 'File',
-      signature: 'Signature',
-      region: 'Region',
-      grid: 'Grid',
-      table: 'Table',
-      tabs: 'Tabs',
-      collapse: 'Collapse',
-      divider: 'Divider',
-      container: 'Container',
-      field: 'Basic field',
-      defaultField: 'Default field',
-      subform: 'Sub-form'
-    },
-    layout: {
-      tabsCol: 'Tab panel',
-      col: 'Col',
-      collapseCol: 'Collapse panel',
-      td: 'td'
-    },
-    config: {
-      globalConfig: {
-        labelPosition: {
-          label: 'Label Position',
-          left: 'Left',
-          right: 'Right',
-          top: 'Top'
-        },
-        sync: {
-          label: 'Synchronize computer and mobile configurations',
-          warning: 'Data inconsistency, according to your choice of configuration'
-        },
-        componentSize: {
-          label: 'Size of Fields',
-          large: 'Large',
-          default: 'Default',
-          small: 'Small'
-        }
-      },
-      tabsLayout: {
-        style: {
-          label: 'Type',
-          options: [
-            'Default',
-            'Tabs',
-            'Border-Card'
-          ]
-        },
-        tabPosition: {
-          label: 'Tab position',
-          options: [
-            'Top',
-            'Bottom',
-            'Left',
-            'Right'
-          ]
-        }
-      },
-      borderComponent: {
-        borderLine: 'Border line',
-        borderWidth: 'Border width'
-      },
-      gridLayout: {
-        justify: {
-          label: 'Horizontal arrangement',
-          options: [
-            'Start',
-            'End',
-            'Center',
-            'Space around',
-            'Space between'
-          ]
-        }
-      },
-      dataComponent1: {
-        defaultLabel: 'Default value',
-        unique: 'Unique id',
-        name: 'Name',
-        operate: 'Operate',
-        add: 'Add'
-      },
-      dataComponent2: {
-        level: 'Level',
-        add: 'Add'
-      },
-      dataComponent3: {
-        panel: 'Panel',
-        add: 'Add'
-      },
-      propsPanel: {
-        title: 'Title',
-        titleWidth: 'Title width',
-        id: 'Id',
-        defaultContent: 'Default content',
-        placeholder: 'Placeholder',
-        brushColor: 'Brush color',
-        format: 'Format',
-        dateType: 'Date type',
-        layout: {
-          label: 'Layout',
-          options: [
-            'vertical',
-            'horizontal'
-          ]
-        },
-        contentPosition: {
-          label: 'Text position',
-          options: [
-            'Left',
-            'Center',
-            'Right'
-          ]
-        },
-        textareaHeight: 'Textarea height',
-        uploadfile: {
-          fileType: 'File type',
-          accept: '',
-          uploadLimit: 'Upload limit',
-          fileSize: 'File size'
-        },
-        prepend: 'Prepend',
-        append: 'Append',
-        step: 'Step',
-        precision: 'Precision',
-        region: {
-          label: 'Select range',
-          options: [
-            'Prov',
-            'City/Prov',
-            'County/City/Prov'
-          ]
-        },
-        trim: 'Trim',
-        wordLimit: 'Word limit',
-        dateRange: 'Date range',
-        accordion: 'Accordion',
-        showPassword: 'Password',
-        multiple: 'Multiple',
-        filterable: 'Search',
-        numberControls: {
-          label: 'Control button',
-          position: 'Button position',
-          options: [
-            'Horizontal',
-            'Vertical'
-          ]
-        },
-        allowHalf: 'Allow half',
-        alpha: 'Alpha',
-        anyNode: 'Select any node',
-        clearable: 'clearable',
-        star: 'Star',
-        setDefaultContent: 'Set default content'
-      }
-    },
-    public: {
-      confirm: 'Confirm',
-      cancel: 'Cancel',
-      button: 'Button',
-      text: 'Text',
-      color: 'Color',
-      backgroundColor: 'Background-color',
-      width: 'Width',
-      radius: 'Radius',
-      style: 'Style',
-      background: 'Background',
-      image: 'Image',
-      remove: 'Remove',
-      margin: 'Margin',
-      padding: 'Padding',
-      unit: 'Unit',
-      min: 'Min',
-      max: 'Max',
-      clear: 'Clear',
-      dataEntry: 'Data entry',
-      data: 'Data',
-      disabled: 'disabled',
-      back: 'Back',
-      save: 'Save',
-      reset: 'Reset',
-      add: 'Add'
-    },
-    validateMsg: {
-      required: 'Required',
-      limitWord: 'At least <%= min %> character',
-      email: 'Please enter the valid email address',
-      IdNumber: 'Please enter the valid ID number',
-      phone: 'Please enter the valid Phone number',
-      http: 'Please enter the valid Url',
-      fileSize: 'File size cannot exceed <%= size %> MB',
-      idUnique: 'ID must be unique',
+			uploadfile: 'File',
+			signature: 'Signature',
+			region: 'Region',
+			grid: 'Grid',
+			table: 'Table',
+			tabs: 'Tabs',
+			collapse: 'Collapse',
+			divider: 'Divider',
+			container: 'Container',
+			field: 'Basic field',
+			defaultField: 'Default field',
+			subform: 'Sub-form'
+		},
+		layout: {
+			tabsCol: 'Tab panel',
+			col: 'Col',
+			collapseCol: 'Collapse panel',
+			td: 'td'
+		},
+		config: {
+			globalConfig: {
+				labelPosition: {
+					label: 'Label Position',
+					left: 'Left',
+					right: 'Right',
+					top: 'Top'
+				},
+				sync: {
+					label: 'Synchronize computer and mobile configurations',
+					warning: 'Data inconsistency, according to your choice of configuration'
+				},
+				componentSize: {
+					label: 'Size of Fields',
+					large: 'Large',
+					default: 'Default',
+					small: 'Small'
+				}
+			},
+			tabsLayout: {
+				style: {
+					label: 'Type',
+					options: ['Default', 'Tabs', 'Border-Card']
+				},
+				tabPosition: {
+					label: 'Tab position',
+					options: ['Top', 'Bottom', 'Left', 'Right']
+				}
+			},
+			borderComponent: {
+				borderLine: 'Border line',
+				borderWidth: 'Border width'
+			},
+			gridLayout: {
+				justify: {
+					label: 'Horizontal arrangement',
+					options: ['Start', 'End', 'Center', 'Space around', 'Space between']
+				}
+			},
+			dataComponent1: {
+				defaultLabel: 'Default value',
+				unique: 'Unique id',
+				name: 'Name',
+				operate: 'Operate',
+				add: 'Add'
+			},
+			dataComponent2: {
+				level: 'Level',
+				add: 'Add'
+			},
+			dataComponent3: {
+				panel: 'Panel',
+				add: 'Add'
+			},
+			propsPanel: {
+				title: 'Title',
+				titleWidth: 'Title width',
+				id: 'Id',
+				defaultContent: 'Default content',
+				placeholder: 'Placeholder',
+				brushColor: 'Brush color',
+				format: 'Format',
+				dateType: 'Date type',
+				layout: {
+					label: 'Layout',
+					options: ['vertical', 'horizontal']
+				},
+				contentPosition: {
+					label: 'Text position',
+					options: ['Left', 'Center', 'Right']
+				},
+				textareaHeight: 'Textarea height',
+				uploadfile: {
+					fileType: 'File type',
+					accept: '',
+					uploadLimit: 'Upload limit',
+					fileSize: 'File size'
+				},
+				prepend: 'Prepend',
+				append: 'Append',
+				step: 'Step',
+				precision: 'Precision',
+				region: {
+					label: 'Select range',
+					options: ['Prov', 'City/Prov', 'County/City/Prov']
+				},
+				trim: 'Trim',
+				wordLimit: 'Word limit',
+				dateRange: 'Date range',
+				accordion: 'Accordion',
+				showPassword: 'Password',
+				multiple: 'Multiple',
+				filterable: 'Search',
+				numberControls: {
+					label: 'Control button',
+					position: 'Button position',
+					options: ['Horizontal', 'Vertical']
+				},
+				allowHalf: 'Allow half',
+				alpha: 'Alpha',
+				anyNode: 'Select any node',
+				clearable: 'clearable',
+				star: 'Star',
+				setDefaultContent: 'Set default content'
+			}
+		},
+		public: {
+			confirm: 'Confirm',
+			cancel: 'Cancel',
+			button: 'Button',
+			text: 'Text',
+			color: 'Color',
+			backgroundColor: 'Background-color',
+			width: 'Width',
+			radius: 'Radius',
+			style: 'Style',
+			background: 'Background',
+			image: 'Image',
+			remove: 'Remove',
+			margin: 'Margin',
+			padding: 'Padding',
+			unit: 'Unit',
+			min: 'Min',
+			max: 'Max',
+			clear: 'Clear',
+			dataEntry: 'Data entry',
+			data: 'Data',
+			disabled: 'disabled',
+			back: 'Back',
+			save: 'Save',
+			reset: 'Reset',
+			add: 'Add'
+		},
+		validateMsg: {
+			required: 'Required',
+			limitWord: 'At least <%= min %> character',
+			email: 'Please enter the valid email address',
+			IdNumber: 'Please enter the valid ID number',
+			phone: 'Please enter the valid Phone number',
+			http: 'Please enter the valid Url',
+			fileSize: 'File size cannot exceed <%= size %> MB',
+			idUnique: 'ID must be unique',
 			chartAndNumber: 'Only characters and Numbers',
-      placeholder1: 'Please enter',
-      placeholder2: 'Please select'
-    },
-    form: {
-      selectDate: 'Select date',
-      selectTime: 'Select time',
-      notFilled: 'Not filled',
-      filled: 'Filled',
-      addSignature: 'Add signature',
-      useSignature: 'Use signature',
-      uploading: 'uploading...',
-      uploadFailed: 'Fail to upload'
-    },
-    selection: {
-      insertLeft: 'Insert column left',
-      insertRight: 'Insert column right',
-      insertTop: 'Insert row before',
-      insertBottom: 'Insert row after',
-      mergeLeft: 'Merge left',
-      mergeRight: 'Merge right',
-      mergeRow: 'Merge row',
-      mergeTop: 'Merge on',
-      mergeBottom: 'Merge down',
-      mergeColumn: 'Merge column',
-      delRow: 'Delete row',
-      delColumn: 'Delete column',
-      splitColumn: 'Split column',
-      splitRow: 'Split row'
-    },
-    logic: {
-      filter: {
-        equal: 'Equal',
-        not_equal: 'Not equal',
-        contains: 'Contains',
-        not_contain: 'Not contain',
-        empty: 'Empty',
-        not_empty: 'Not empty',
-        greater_than: 'Greater than',
-        greater_than_equal: 'Greater than or equal to',
-        less_than: 'Less than',
-        less_than_equal: 'Less than or equal to',
-        between: 'Between',
-        one_of: 'Equal to one of',
-        not_one_of: 'Not equal to one of',
-        belong_one_of: 'Belong to one of',
-        not_belong_one_of: 'Not belong to one of',
-        on: 'On',
-        off: 'Off',
-        show: 'Show',
-        hide: 'Hide',
-        field: 'Field',
-        required: 'Required',
-        not_required: 'Not required',
-        readOnly: 'Readonly',
-        editable: 'Editable'
-      },
-      filterLabel: {
-        if: 'When the following conditions are met',
-        then: 'Then execute'
-      },
-      tabs: {
-        visible: 'Visible',
-        required: 'Required',
-        readOnly: 'Readonly'
-      },
-      button: 'Logic Control',
-      logicSuggests: 'It is detected that the attributes of the current field have changed, and in order to ensure the accuracy of logic control, the corresponding logic rules have been automatically deleted.'
-    }
-  }
+			placeholder1: 'Please enter',
+			placeholder2: 'Please select'
+		},
+		form: {
+			selectDate: 'Select date',
+			selectTime: 'Select time',
+			notFilled: 'Not filled',
+			filled: 'Filled',
+			addSignature: 'Add signature',
+			useSignature: 'Use signature',
+			uploading: 'uploading...',
+			uploadFailed: 'Fail to upload'
+		},
+		selection: {
+			insertLeft: 'Insert column left',
+			insertRight: 'Insert column right',
+			insertTop: 'Insert row before',
+			insertBottom: 'Insert row after',
+			mergeLeft: 'Merge left',
+			mergeRight: 'Merge right',
+			mergeRow: 'Merge row',
+			mergeTop: 'Merge on',
+			mergeBottom: 'Merge down',
+			mergeColumn: 'Merge column',
+			delRow: 'Delete row',
+			delColumn: 'Delete column',
+			splitColumn: 'Split column',
+			splitRow: 'Split row'
+		},
+		logic: {
+			filter: {
+				equal: 'Equal',
+				not_equal: 'Not equal',
+				contains: 'Contains',
+				not_contain: 'Not contain',
+				empty: 'Empty',
+				not_empty: 'Not empty',
+				greater_than: 'Greater than',
+				greater_than_equal: 'Greater than or equal to',
+				less_than: 'Less than',
+				less_than_equal: 'Less than or equal to',
+				between: 'Between',
+				one_of: 'Equal to one of',
+				not_one_of: 'Not equal to one of',
+				belong_one_of: 'Belong to one of',
+				not_belong_one_of: 'Not belong to one of',
+				on: 'On',
+				off: 'Off',
+				show: 'Show',
+				hide: 'Hide',
+				field: 'Field',
+				required: 'Required',
+				not_required: 'Not required',
+				readOnly: 'Readonly',
+				editable: 'Editable'
+			},
+			filterLabel: {
+				if: 'When the following conditions are met',
+				then: 'Then execute'
+			},
+			tabs: {
+				visible: 'Visible',
+				required: 'Required',
+				readOnly: 'Readonly'
+			},
+			button: 'Logic Control',
+			logicSuggests:
+				'It is detected that the attributes of the current field have changed, and in order to ensure the accuracy of logic control, the corresponding logic rules have been automatically deleted.'
+		}
+	}
 }

+ 2 - 2
src/components/packages/formEditor/locale/index.js

@@ -3,7 +3,7 @@ import _ from 'lodash-es'
 const importModules = import.meta.glob('./*.js', { import: 'default', eager: true })
 const modules = {}
 _.forIn(importModules, (func, path) => {
-  const re = /[a-zA-Z0-9_-]*(?=\.js)/g
-  modules[path.match(re)[0]] = func
+	const re = /[a-zA-Z0-9_-]*(?=\.js)/g
+	modules[path.match(re)[0]] = func
 })
 export default modules

+ 247 - 282
src/components/packages/formEditor/locale/zh-cn.js

@@ -1,286 +1,251 @@
 export default {
-  er: {
-    panels: {
-      config: '表单属性'
-    },
-    fields: {
-      input: [
-        '单行文本',
-        '邮箱',
-        '身份证号',
-        '手机号',
-        '网址'
-      ],
-      textarea: '多行文本',
-      number: '数字',
-      radio: '单选框',
-      checkbox: '复选框',
-      select: ['下拉框', '人员', '角色', '部门'],
-      time: '时间',
-      date: '日期',
-      rate: '评分',
-      switch: '开关',
-      slider: '滑块',
-      html: '富文本',
+	er: {
+		panels: {
+			config: '表单属性'
+		},
+		fields: {
+			input: ['单行文本', '邮箱', '身份证号', '手机号', '网址'],
+			textarea: '多行文本',
+			number: '数字',
+			radio: '单选框',
+			checkbox: '复选框',
+			select: ['下拉框', '人员', '角色', '部门'],
+			time: '时间',
+			date: '日期',
+			rate: '评分',
+			switch: '开关',
+			slider: '滑块',
+			html: '富文本',
 			cascader: ['级联框', '部门'],
-      uploadfile: '上传文件',
-      signature: '签名',
-      region: '省市区',
-      grid: '栅格布局',
-      table: '表格布局',
-      tabs: '标签页',
-      collapse: '折叠面板',
-      divider: '分割线',
-      container: '容器',
-      field: '基础字段',
-      defaultField: '预设字段',
-      subform: '子表单'
-    },
-    layout: {
-      tabsCol: '标签面板',
-      col: '栅格列',
-      collapseCol: '折叠子面板',
-      td: '单元格'
-    },
-    config: {
-      globalConfig: {
-        labelPosition: {
-          label: '标签对齐方式',
-          left: '左对齐',
-          right: '右对齐',
-          top: '顶部对齐'
-        },
-        sync: {
-          label: '同步设置电脑和移动端',
-          warning: '数据存在不一致,根据你的选择进行同步'
-        },
-        componentSize: {
-          label: '字段大小',
-          large: '大',
-          default: '中',
-          small: '小'
-        }
-      },
-      tabsLayout: {
-        style: {
-          label: '风格类型',
-          options: [
-            '默认',
-            '选项卡',
-            '卡片化'
-          ]
-        },
-        tabPosition: {
-          label: '选项卡位置',
-          options: [
-            '顶部',
-            '底部',
-            '左侧',
-            '右侧'
-          ]
-        }
-      },
-      borderComponent: {
-        borderLine: '边框线',
-        borderWidth: '边框宽度'
-      },
-      gridLayout: {
-        justify: {
-          label: '水平排列方式',
-          options: [
-            '左对齐',
-            '右对齐',
-            '居中',
-            '两侧间隔相等',
-            '两端对齐'
-          ]
-        }
-      },
-      dataComponent1: {
-        defaultLabel: '默认',
-        unique: '选项唯一标识',
-        name: '选项名称',
-        operate: '操作',
-        add: '添加选项'
-      },
-      dataComponent2: {
-        level: '级选项',
-        add: '添加选项'
-      },
-      dataComponent3: {
-        panel: '面板',
-        add: '添加面板'
-      },
-      propsPanel: {
-        title: '标题',
-        titleWidth: '宽度',
-        id: '字段标识',
-        defaultContent: '默认内容',
-        placeholder: '提示文字',
-        brushColor: '画笔颜色',
-        format: '显示格式',
-        dateType: '日期类型',
-        layout: {
-          label: '布局方式',
-          options: [
-            '纵向',
-            '横向'
-          ]
-        },
-        contentPosition: {
-          label: '文案位置',
-          options: [
-            '左侧',
-            '居中',
-            '右侧'
-          ]
-        },
-        textareaHeight: '文本域高度',
-        uploadfile: {
-          fileType: '文件类型',
-          accept: '',
-          uploadLimit: '上传个数限制',
-          fileSize: '文件大小'
-        },
-        prepend: '前缀',
-        append: '后缀',
-        step: '步长',
-        precision: '精度',
-        region: {
-          label: '选择范围',
-          options: [
-            '省',
-            '省/市',
-            '省/市/县'
-          ]
-        },
-        trim: '去除首尾空格',
-        wordLimit: '限定字符',
-        dateRange: '限定日期范围',
-        accordion: '手风琴',
-        showPassword: '作为密码',
-        multiple: '多选',
-        filterable: '搜索',
-        numberControls: {
-          label: '控制按钮',
-          position: '按钮位置',
-          options: [
-            '左右',
-            '上下'
-          ]
-        },
-        allowHalf: '半选',
-        alpha: '透明度',
-        anyNode: '选择任意节点',
-        clearable: '一键清除按钮',
-        star: '星星数',
-        setDefaultContent: '设置默认内容'
-      }
-    },
-    public: {
-      confirm: '确定',
-      cancel: '取消',
-      button: '按钮',
-      text: '文字',
-      color: '颜色',
-      backgroundColor: '背景颜色',
-      width: '宽度',
-      radius: '圆角',
-      style: '风格',
-      background: '背景',
-      image: '图片',
-      remove: '移除',
-      margin: '外边距',
-      padding: '内边距',
-      unit: '单位',
-      min: '最小',
-      max: '最大',
-      clear: '清空',
-      dataEntry: '录入数据',
-      data: '数据',
-      disabled: '禁用',
-      back: '返回',
-      save: '保存',
-      reset: '重置',
-      add: '添加'
-    },
-    validateMsg: {
-      required: '必填',
-      limitWord: '最少<%= min %>字符',
-      email: '请输入正确的邮箱地址',
-      IdNumber: '请输入正确的身份证号',
-      phone: '请输入正确的手机号',
-      http: '请输入正确的网址',
-      fileSize: '文件大小不能超过 <%= size %> MB',
-      idUnique: '字段标识重复',
+			uploadfile: '上传文件',
+			signature: '签名',
+			region: '省市区',
+			grid: '栅格布局',
+			table: '表格布局',
+			tabs: '标签页',
+			collapse: '折叠面板',
+			divider: '分割线',
+			container: '容器',
+			field: '基础字段',
+			defaultField: '预设字段',
+			subform: '子表单'
+		},
+		layout: {
+			tabsCol: '标签面板',
+			col: '栅格列',
+			collapseCol: '折叠子面板',
+			td: '单元格'
+		},
+		config: {
+			globalConfig: {
+				labelPosition: {
+					label: '标签对齐方式',
+					left: '左对齐',
+					right: '右对齐',
+					top: '顶部对齐'
+				},
+				sync: {
+					label: '同步设置电脑和移动端',
+					warning: '数据存在不一致,根据你的选择进行同步'
+				},
+				componentSize: {
+					label: '字段大小',
+					large: '大',
+					default: '中',
+					small: '小'
+				}
+			},
+			tabsLayout: {
+				style: {
+					label: '风格类型',
+					options: ['默认', '选项卡', '卡片化']
+				},
+				tabPosition: {
+					label: '选项卡位置',
+					options: ['顶部', '底部', '左侧', '右侧']
+				}
+			},
+			borderComponent: {
+				borderLine: '边框线',
+				borderWidth: '边框宽度'
+			},
+			gridLayout: {
+				justify: {
+					label: '水平排列方式',
+					options: ['左对齐', '右对齐', '居中', '两侧间隔相等', '两端对齐']
+				}
+			},
+			dataComponent1: {
+				defaultLabel: '默认',
+				unique: '选项唯一标识',
+				name: '选项名称',
+				operate: '操作',
+				add: '添加选项'
+			},
+			dataComponent2: {
+				level: '级选项',
+				add: '添加选项'
+			},
+			dataComponent3: {
+				panel: '面板',
+				add: '添加面板'
+			},
+			propsPanel: {
+				title: '标题',
+				titleWidth: '宽度',
+				id: '字段标识',
+				defaultContent: '默认内容',
+				placeholder: '提示文字',
+				brushColor: '画笔颜色',
+				format: '显示格式',
+				dateType: '日期类型',
+				layout: {
+					label: '布局方式',
+					options: ['纵向', '横向']
+				},
+				contentPosition: {
+					label: '文案位置',
+					options: ['左侧', '居中', '右侧']
+				},
+				textareaHeight: '文本域高度',
+				uploadfile: {
+					fileType: '文件类型',
+					accept: '',
+					uploadLimit: '上传个数限制',
+					fileSize: '文件大小'
+				},
+				prepend: '前缀',
+				append: '后缀',
+				step: '步长',
+				precision: '精度',
+				region: {
+					label: '选择范围',
+					options: ['省', '省/市', '省/市/县']
+				},
+				trim: '去除首尾空格',
+				wordLimit: '限定字符',
+				dateRange: '限定日期范围',
+				accordion: '手风琴',
+				showPassword: '作为密码',
+				multiple: '多选',
+				filterable: '搜索',
+				numberControls: {
+					label: '控制按钮',
+					position: '按钮位置',
+					options: ['左右', '上下']
+				},
+				allowHalf: '半选',
+				alpha: '透明度',
+				anyNode: '选择任意节点',
+				clearable: '一键清除按钮',
+				star: '星星数',
+				setDefaultContent: '设置默认内容'
+			}
+		},
+		public: {
+			confirm: '确定',
+			cancel: '取消',
+			button: '按钮',
+			text: '文字',
+			color: '颜色',
+			backgroundColor: '背景颜色',
+			width: '宽度',
+			radius: '圆角',
+			style: '风格',
+			background: '背景',
+			image: '图片',
+			remove: '移除',
+			margin: '外边距',
+			padding: '内边距',
+			unit: '单位',
+			min: '最小',
+			max: '最大',
+			clear: '清空',
+			dataEntry: '录入数据',
+			data: '数据',
+			disabled: '禁用',
+			back: '返回',
+			save: '保存',
+			reset: '重置',
+			add: '添加'
+		},
+		validateMsg: {
+			required: '必填',
+			limitWord: '最少<%= min %>字符',
+			email: '请输入正确的邮箱地址',
+			IdNumber: '请输入正确的身份证号',
+			phone: '请输入正确的手机号',
+			http: '请输入正确的网址',
+			fileSize: '文件大小不能超过 <%= size %> MB',
+			idUnique: '字段标识重复',
 			chartAndNumber: '字母数字组合',
-      placeholder1: '请输入',
-      placeholder2: '请选择'
-    },
-    form: {
-      selectDate: '选择日期',
-      selectTime: '选择时间',
-      notFilled: '未填写',
-      filled: '已填写',
-      addSignature: '添加签名',
-      useSignature: '使用签名',
-      uploading: '上传中...',
-      uploadFailed: '上传失败'
-    },
-    selection: {
-      insertLeft: '左插入列',
-      insertRight: '右插入列',
-      insertTop: '上插入行',
-      insertBottom: '下插入行',
-      mergeLeft: '向左合并',
-      mergeRight: '向右合并',
-      mergeRow: '合并整行',
-      mergeTop: '向上合并',
-      mergeBottom: '向下合并',
-      mergeColumn: '合并整列',
-      delRow: '删除整行',
-      delColumn: '删除整列',
-      splitColumn: '拆分成列',
-      splitRow: '拆分成行'
-    },
-    logic: {
-      filter: {
-        equal: '等于',
-        not_equal: '不等于',
-        contains: '包含',
-        not_contain: '不包含',
-        empty: '为空',
-        not_empty: '不为空',
-        greater_than: '大于',
-        greater_than_equal: '大于等于',
-        less_than: '小于',
-        less_than_equal: '小于等于',
-        between: '区间',
-        one_of: '等于其中之一',
-        not_one_of: '不等于其中之一',
-        belong_one_of: '属于其中之一',
-        not_belong_one_of: '不属于其中之一',
-        on: '开',
-        off: '关',
-        show: '显示',
-        hide: '隐藏',
-        field: '字段',
-        required: '必填',
-        not_required: '不必填',
-        readOnly: '只读',
-        editable: '可编辑'
-      },
-      filterLabel: {
-        if: '当满足以下条件时',
-        then: '则执行'
-      },
-      tabs: {
-        visible: '显隐',
-        required: '必填',
-        readOnly: '只读'
-      },
-      button: '逻辑控制',
-      logicSuggests: '检测到当前字段的属性发生了变动,为了保证逻辑控制的准确性,已自动删除了相应的逻辑规则。'
-    }
-  }
+			placeholder1: '请输入',
+			placeholder2: '请选择'
+		},
+		form: {
+			selectDate: '选择日期',
+			selectTime: '选择时间',
+			notFilled: '未填写',
+			filled: '已填写',
+			addSignature: '添加签名',
+			useSignature: '使用签名',
+			uploading: '上传中...',
+			uploadFailed: '上传失败'
+		},
+		selection: {
+			insertLeft: '左插入列',
+			insertRight: '右插入列',
+			insertTop: '上插入行',
+			insertBottom: '下插入行',
+			mergeLeft: '向左合并',
+			mergeRight: '向右合并',
+			mergeRow: '合并整行',
+			mergeTop: '向上合并',
+			mergeBottom: '向下合并',
+			mergeColumn: '合并整列',
+			delRow: '删除整行',
+			delColumn: '删除整列',
+			splitColumn: '拆分成列',
+			splitRow: '拆分成行'
+		},
+		logic: {
+			filter: {
+				equal: '等于',
+				not_equal: '不等于',
+				contains: '包含',
+				not_contain: '不包含',
+				empty: '为空',
+				not_empty: '不为空',
+				greater_than: '大于',
+				greater_than_equal: '大于等于',
+				less_than: '小于',
+				less_than_equal: '小于等于',
+				between: '区间',
+				one_of: '等于其中之一',
+				not_one_of: '不等于其中之一',
+				belong_one_of: '属于其中之一',
+				not_belong_one_of: '不属于其中之一',
+				on: '开',
+				off: '关',
+				show: '显示',
+				hide: '隐藏',
+				field: '字段',
+				required: '必填',
+				not_required: '不必填',
+				readOnly: '只读',
+				editable: '可编辑'
+			},
+			filterLabel: {
+				if: '当满足以下条件时',
+				then: '则执行'
+			},
+			tabs: {
+				visible: '显隐',
+				required: '必填',
+				readOnly: '只读'
+			},
+			button: '逻辑控制',
+			logicSuggests: '检测到当前字段的属性发生了变动,为了保证逻辑控制的准确性,已自动删除了相应的逻辑规则。'
+		}
+	}
 }

+ 2 - 2
src/components/packages/icon/svg/index.js

@@ -2,7 +2,7 @@ import _ from 'lodash-es'
 const importModules = import.meta.glob('./*.svg', { eager: true })
 const modules = {}
 _.forIn(importModules, (func, path) => {
-  const re = /[a-zA-Z0-9_-]*(?=\.svg)/g
-  modules[path.match(re)[0]] = func
+	const re = /[a-zA-Z0-9_-]*(?=\.svg)/g
+	modules[path.match(re)[0]] = func
 })
 export default modules