|
@@ -0,0 +1,272 @@
|
|
|
|
|
+import DagitalClock from './DagitalClock.vue'
|
|
|
|
|
+import icon from '../assets/icon/icon_32time2.svg'
|
|
|
|
|
+import type { IComponentModelConfig } from '../type'
|
|
|
|
|
+import i18n from '@/locales'
|
|
|
|
|
+import { flagOptions, stateOptions, stateList } from '@/constants'
|
|
|
|
|
+import defaultStyle from './style.json'
|
|
|
|
|
+import { dayjs } from 'element-plus'
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ label: i18n.global.t('dagitalClock'),
|
|
|
|
|
+ icon,
|
|
|
|
|
+ component: DagitalClock,
|
|
|
|
|
+ key: 'dagital_clock',
|
|
|
|
|
+ group: i18n.global.t('time'),
|
|
|
|
|
+ sort: 1,
|
|
|
|
|
+ defaultStyle,
|
|
|
|
|
+ parts: [
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'main',
|
|
|
|
|
+ stateList
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ defaultSchema: {
|
|
|
|
|
+ name: 'label',
|
|
|
|
|
+ props: {
|
|
|
|
|
+ x: 0,
|
|
|
|
|
+ y: 0,
|
|
|
|
|
+ width: 130,
|
|
|
|
|
+ height: 30,
|
|
|
|
|
+ flags: [
|
|
|
|
|
+ 'LV_OBJ_FLAG_CLICK_FOCUSABLE',
|
|
|
|
|
+ 'LV_OBJ_FLAG_SCROLLABLE',
|
|
|
|
|
+ 'LV_OBJ_FLAG_SCROLL_ELASTIC',
|
|
|
|
|
+ 'LV_OBJ_FLAG_SCROLL_MOMENTUM',
|
|
|
|
|
+ 'LV_OBJ_FLAG_SCROLL_CHAIN_HOR',
|
|
|
|
|
+ 'LV_OBJ_FLAG_SCROLL_CHAIN_VER',
|
|
|
|
|
+ 'LV_OBJ_FLAG_SCROLL_CHAIN',
|
|
|
|
|
+ 'LV_OBJ_FLAG_SCROLL_WITH_ARROW',
|
|
|
|
|
+ 'LV_OBJ_FLAG_SNAPPABLE',
|
|
|
|
|
+ 'LV_OBJ_FLAG_PRESS_LOCK',
|
|
|
|
|
+ 'LV_OBJ_FLAG_GESTURE_BUBBLE'
|
|
|
|
|
+ ],
|
|
|
|
|
+ states: [],
|
|
|
|
|
+ timeText: '09:30:50',
|
|
|
|
|
+ // 展示秒
|
|
|
|
|
+ showSecond: true,
|
|
|
|
|
+ // 上午/下午
|
|
|
|
|
+ showAmPm: false
|
|
|
|
|
+ },
|
|
|
|
|
+ styles: [
|
|
|
|
|
+ {
|
|
|
|
|
+ part: {
|
|
|
|
|
+ name: 'main',
|
|
|
|
|
+ state: 'default'
|
|
|
|
|
+ },
|
|
|
|
|
+ background: {
|
|
|
|
|
+ color: '#FFFFFF00',
|
|
|
|
|
+ image: {
|
|
|
|
|
+ imgId: '',
|
|
|
|
|
+ recolor: '#00000000',
|
|
|
|
|
+ alpha: 255
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ text: {
|
|
|
|
|
+ color: '#212121ff',
|
|
|
|
|
+ family: 'xx',
|
|
|
|
|
+ size: 16,
|
|
|
|
|
+ align: 'left',
|
|
|
|
|
+ decoration: 'none'
|
|
|
|
|
+ },
|
|
|
|
|
+ spacer: {
|
|
|
|
|
+ letterSpacing: 0
|
|
|
|
|
+ },
|
|
|
|
|
+ border: {
|
|
|
|
|
+ color: '#000000ff',
|
|
|
|
|
+ width: 0,
|
|
|
|
|
+ radius: 0,
|
|
|
|
|
+ side: ['all']
|
|
|
|
|
+ },
|
|
|
|
|
+ outline: {
|
|
|
|
|
+ color: '#000000ff',
|
|
|
|
|
+ width: 0,
|
|
|
|
|
+ pad: 0
|
|
|
|
|
+ },
|
|
|
|
|
+ padding: {
|
|
|
|
|
+ top: 0,
|
|
|
|
|
+ right: 0,
|
|
|
|
|
+ bottom: 0,
|
|
|
|
|
+ left: 0
|
|
|
|
|
+ },
|
|
|
|
|
+ shadow: {
|
|
|
|
|
+ color: '#2092f5ff',
|
|
|
|
|
+ offsetX: 0,
|
|
|
|
|
+ offsetY: 0,
|
|
|
|
|
+ spread: 0,
|
|
|
|
|
+ width: 0
|
|
|
|
|
+ },
|
|
|
|
|
+ transform: {
|
|
|
|
|
+ width: 0,
|
|
|
|
|
+ height: 0,
|
|
|
|
|
+ translateX: 0,
|
|
|
|
|
+ translateY: 0,
|
|
|
|
|
+ originX: 0,
|
|
|
|
|
+ originY: 0,
|
|
|
|
|
+ rotate: 0,
|
|
|
|
|
+ scale: 256
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ config: {
|
|
|
|
|
+ // 组件属性
|
|
|
|
|
+ props: [
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '名称',
|
|
|
|
|
+ field: 'name',
|
|
|
|
|
+ valueType: 'text',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ placeholder: '请输入名称',
|
|
|
|
|
+ type: 'text'
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '位置/大小',
|
|
|
|
|
+ valueType: 'group',
|
|
|
|
|
+ children: [
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '',
|
|
|
|
|
+ field: 'props.x',
|
|
|
|
|
+ valueType: 'number',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ span: 12,
|
|
|
|
|
+ min: -10000,
|
|
|
|
|
+ max: 10000
|
|
|
|
|
+ },
|
|
|
|
|
+ slots: { prefix: 'X' }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '',
|
|
|
|
|
+ field: 'props.y',
|
|
|
|
|
+ valueType: 'number',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ span: 12,
|
|
|
|
|
+ min: -10000,
|
|
|
|
|
+ max: 10000
|
|
|
|
|
+ },
|
|
|
|
|
+ slots: { prefix: 'Y' }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '',
|
|
|
|
|
+ field: 'props.width',
|
|
|
|
|
+ valueType: 'number',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ span: 12,
|
|
|
|
|
+ min: 1,
|
|
|
|
|
+ max: 10000
|
|
|
|
|
+ },
|
|
|
|
|
+ slots: { prefix: 'W' }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '',
|
|
|
|
|
+ field: 'props.height',
|
|
|
|
|
+ valueType: 'number',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ span: 12,
|
|
|
|
|
+ min: 1,
|
|
|
|
|
+ max: 10000
|
|
|
|
|
+ },
|
|
|
|
|
+ slots: { prefix: 'H' }
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '标识',
|
|
|
|
|
+ field: 'props.flags',
|
|
|
|
|
+ valueType: 'checkbox',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ options: flagOptions,
|
|
|
|
|
+ defaultCollapsed: true
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '状态',
|
|
|
|
|
+ field: 'props.states',
|
|
|
|
|
+ valueType: 'checkbox',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ options: stateOptions,
|
|
|
|
|
+ defaultCollapsed: true
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ coreProps: [
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '时间',
|
|
|
|
|
+ field: 'props.timeText',
|
|
|
|
|
+ valueType: 'time',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ arrowControl: true
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '展示秒',
|
|
|
|
|
+ field: 'props.showSecond',
|
|
|
|
|
+ valueType: 'switch'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '上午/下午',
|
|
|
|
|
+ field: 'props.showAmPm',
|
|
|
|
|
+ valueType: 'switch'
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ // 组件样式
|
|
|
|
|
+ styles: [
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '模块状态',
|
|
|
|
|
+ field: 'part',
|
|
|
|
|
+ valueType: 'part'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '背景',
|
|
|
|
|
+ field: 'background',
|
|
|
|
|
+ valueType: 'background'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '字体',
|
|
|
|
|
+ field: 'text',
|
|
|
|
|
+ valueType: 'font'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '间距',
|
|
|
|
|
+ field: 'spacer',
|
|
|
|
|
+ valueType: 'spacer',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ hideLineHeight: true
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '内边距',
|
|
|
|
|
+ field: 'padding',
|
|
|
|
|
+ valueType: 'padding'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '边框',
|
|
|
|
|
+ field: 'border',
|
|
|
|
|
+ valueType: 'border'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '轮廓',
|
|
|
|
|
+ field: 'outline',
|
|
|
|
|
+ valueType: 'outline'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '内边距',
|
|
|
|
|
+ field: 'padding',
|
|
|
|
|
+ valueType: 'padding'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '阴影',
|
|
|
|
|
+ field: 'shadow',
|
|
|
|
|
+ valueType: 'shadow'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '变换',
|
|
|
|
|
+ field: 'transform',
|
|
|
|
|
+ valueType: 'transform',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ showWH: true
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+} as IComponentModelConfig
|