Skip to content

Commit 6bda2b0

Browse files
committed
refactor(antdv): 优化代码
1 parent c70863d commit 6bda2b0

File tree

6 files changed

+109
-103
lines changed

6 files changed

+109
-103
lines changed

packages/lib/vue3/vue3-form-ant/dist/vue3-form-ant.esm.js

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11859,9 +11859,6 @@ var UploadWidget = {
1185911859
}
1186011860
};
1186111861

11862-
/**
11863-
* Created by Liu.Jun on 2020/5/17 10:41 下午.
11864-
*/
1186511862
var widgetComponents = {
1186611863
CheckboxesWidget: moduleValeComponent,
1186711864
RadioWidget: moduleValeComponent$1,
@@ -11871,6 +11868,37 @@ var widgetComponents = {
1187111868
DateTimePickerWidget: moduleValeComponent$4,
1187211869
UploadWidget: UploadWidget,
1187311870
InputWidget: modelValueComponent('a-input'),
11871+
ColorWidget: {
11872+
setup: function setup(props, _ref) {
11873+
var attrs = _ref.attrs;
11874+
return function () {
11875+
return h(widgetComponents.InputWidget, _objectSpread2(_objectSpread2({}, attrs), {}, {
11876+
style: _objectSpread2(_objectSpread2({}, attrs.style || {}), {}, {
11877+
maxWidth: '180px'
11878+
})
11879+
}), {
11880+
addonAfter: function addonAfter() {
11881+
return h('input', {
11882+
disabled: attrs.disabled,
11883+
readonly: attrs.readonly,
11884+
value: attrs.modelValue,
11885+
onInput: function onInput(e) {
11886+
attrs['onUpdate:modelValue'](e.target.value);
11887+
},
11888+
onChange: function onChange(e) {
11889+
attrs['onUpdate:modelValue'](e.target.value);
11890+
},
11891+
type: 'color',
11892+
style: {
11893+
padding: '0',
11894+
width: '50px'
11895+
}
11896+
});
11897+
}
11898+
});
11899+
};
11900+
}
11901+
},
1187411902
TextAreaWidget: modelValueComponent('a-textarea'),
1187511903
InputNumberWidget: modelValueComponent('a-input-number'),
1187611904
AutoCompleteWidget: modelValueComponent('a-auto-complete'),
@@ -11881,6 +11909,9 @@ var widgetComponents = {
1188111909
})
1188211910
};
1188311911

11912+
/**
11913+
* Created by Liu.Jun on 2020/4/21 18:23.
11914+
*/
1188411915
var InputWidget = widgetComponents.InputWidget,
1188511916
InputNumberWidget = widgetComponents.InputNumberWidget,
1188611917
SwitchWidget = widgetComponents.SwitchWidget,
@@ -11889,7 +11920,8 @@ var InputWidget = widgetComponents.InputWidget,
1188911920
SelectWidget = widgetComponents.SelectWidget,
1189011921
TimePickerWidget = widgetComponents.TimePickerWidget,
1189111922
DatePickerWidget = widgetComponents.DatePickerWidget,
11892-
DateTimePickerWidget = widgetComponents.DateTimePickerWidget;
11923+
DateTimePickerWidget = widgetComponents.DateTimePickerWidget,
11924+
ColorWidget = widgetComponents.ColorWidget;
1189311925
var WIDGET_MAP = {
1189411926
types: {
1189511927
boolean: SwitchWidget,
@@ -11898,37 +11930,7 @@ var WIDGET_MAP = {
1189811930
integer: InputNumberWidget
1189911931
},
1190011932
formats: {
11901-
color: {
11902-
setup: function setup(props, _ref) {
11903-
var attrs = _ref.attrs;
11904-
return function () {
11905-
return h(InputWidget, _objectSpread2(_objectSpread2({}, attrs), {}, {
11906-
style: _objectSpread2(_objectSpread2({}, attrs.style || {}), {}, {
11907-
maxWidth: '180px'
11908-
})
11909-
}), {
11910-
addonAfter: function addonAfter() {
11911-
return h('input', {
11912-
disabled: attrs.disabled,
11913-
readonly: attrs.readonly,
11914-
value: attrs.modelValue,
11915-
onInput: function onInput(e) {
11916-
attrs['onUpdate:modelValue'](e.target.value);
11917-
},
11918-
onChange: function onChange(e) {
11919-
attrs['onUpdate:modelValue'](e.target.value);
11920-
},
11921-
type: 'color',
11922-
style: {
11923-
padding: '0',
11924-
width: '50px'
11925-
}
11926-
});
11927-
}
11928-
});
11929-
};
11930-
}
11931-
},
11933+
color: ColorWidget,
1193211934
time: TimePickerWidget,
1193311935
// 20:20:39+00:00
1193411936
date: DatePickerWidget,

packages/lib/vue3/vue3-form-ant/dist/vue3-form-ant.esm.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/lib/vue3/vue3-form-ant/dist/vue3-form-ant.umd.js

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11863,9 +11863,6 @@
1186311863
}
1186411864
};
1186511865

11866-
/**
11867-
* Created by Liu.Jun on 2020/5/17 10:41 下午.
11868-
*/
1186911866
var widgetComponents = {
1187011867
CheckboxesWidget: moduleValeComponent,
1187111868
RadioWidget: moduleValeComponent$1,
@@ -11875,6 +11872,37 @@
1187511872
DateTimePickerWidget: moduleValeComponent$4,
1187611873
UploadWidget: UploadWidget,
1187711874
InputWidget: modelValueComponent('a-input'),
11875+
ColorWidget: {
11876+
setup: function setup(props, _ref) {
11877+
var attrs = _ref.attrs;
11878+
return function () {
11879+
return Vue.h(widgetComponents.InputWidget, _objectSpread2(_objectSpread2({}, attrs), {}, {
11880+
style: _objectSpread2(_objectSpread2({}, attrs.style || {}), {}, {
11881+
maxWidth: '180px'
11882+
})
11883+
}), {
11884+
addonAfter: function addonAfter() {
11885+
return Vue.h('input', {
11886+
disabled: attrs.disabled,
11887+
readonly: attrs.readonly,
11888+
value: attrs.modelValue,
11889+
onInput: function onInput(e) {
11890+
attrs['onUpdate:modelValue'](e.target.value);
11891+
},
11892+
onChange: function onChange(e) {
11893+
attrs['onUpdate:modelValue'](e.target.value);
11894+
},
11895+
type: 'color',
11896+
style: {
11897+
padding: '0',
11898+
width: '50px'
11899+
}
11900+
});
11901+
}
11902+
});
11903+
};
11904+
}
11905+
},
1187811906
TextAreaWidget: modelValueComponent('a-textarea'),
1187911907
InputNumberWidget: modelValueComponent('a-input-number'),
1188011908
AutoCompleteWidget: modelValueComponent('a-auto-complete'),
@@ -11885,6 +11913,9 @@
1188511913
})
1188611914
};
1188711915

11916+
/**
11917+
* Created by Liu.Jun on 2020/4/21 18:23.
11918+
*/
1188811919
var InputWidget = widgetComponents.InputWidget,
1188911920
InputNumberWidget = widgetComponents.InputNumberWidget,
1189011921
SwitchWidget = widgetComponents.SwitchWidget,
@@ -11893,7 +11924,8 @@
1189311924
SelectWidget = widgetComponents.SelectWidget,
1189411925
TimePickerWidget = widgetComponents.TimePickerWidget,
1189511926
DatePickerWidget = widgetComponents.DatePickerWidget,
11896-
DateTimePickerWidget = widgetComponents.DateTimePickerWidget;
11927+
DateTimePickerWidget = widgetComponents.DateTimePickerWidget,
11928+
ColorWidget = widgetComponents.ColorWidget;
1189711929
var WIDGET_MAP = {
1189811930
types: {
1189911931
boolean: SwitchWidget,
@@ -11902,37 +11934,7 @@
1190211934
integer: InputNumberWidget
1190311935
},
1190411936
formats: {
11905-
color: {
11906-
setup: function setup(props, _ref) {
11907-
var attrs = _ref.attrs;
11908-
return function () {
11909-
return Vue.h(InputWidget, _objectSpread2(_objectSpread2({}, attrs), {}, {
11910-
style: _objectSpread2(_objectSpread2({}, attrs.style || {}), {}, {
11911-
maxWidth: '180px'
11912-
})
11913-
}), {
11914-
addonAfter: function addonAfter() {
11915-
return Vue.h('input', {
11916-
disabled: attrs.disabled,
11917-
readonly: attrs.readonly,
11918-
value: attrs.modelValue,
11919-
onInput: function onInput(e) {
11920-
attrs['onUpdate:modelValue'](e.target.value);
11921-
},
11922-
onChange: function onChange(e) {
11923-
attrs['onUpdate:modelValue'](e.target.value);
11924-
},
11925-
type: 'color',
11926-
style: {
11927-
padding: '0',
11928-
width: '50px'
11929-
}
11930-
});
11931-
}
11932-
});
11933-
};
11934-
}
11935-
},
11937+
color: ColorWidget,
1193611938
time: TimePickerWidget,
1193711939
// 20:20:39+00:00
1193811940
date: DatePickerWidget,

packages/lib/vue3/vue3-form-ant/dist/vue3-form-ant.umd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/lib/vue3/vue3-form-ant/src/config/widgets/WIDGET_MAP.js

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
// widget 组件对应elementUi 配置表
66

7-
import { h } from 'vue';
87
import widgetComponents from './index';
98

109
const {
@@ -16,7 +15,8 @@ const {
1615
SelectWidget,
1716
TimePickerWidget,
1817
DatePickerWidget,
19-
DateTimePickerWidget
18+
DateTimePickerWidget,
19+
ColorWidget
2020
} = widgetComponents;
2121

2222
export default {
@@ -27,34 +27,7 @@ export default {
2727
integer: InputNumberWidget,
2828
},
2929
formats: {
30-
color: {
31-
setup(props, { attrs }) {
32-
return () => h(InputWidget, {
33-
...attrs,
34-
style: {
35-
...attrs.style || {},
36-
maxWidth: '180px'
37-
}
38-
}, {
39-
addonAfter: () => h('input', {
40-
disabled: attrs.disabled,
41-
readonly: attrs.readonly,
42-
value: attrs.modelValue,
43-
onInput(e) {
44-
attrs['onUpdate:modelValue'](e.target.value);
45-
},
46-
onChange(e) {
47-
attrs['onUpdate:modelValue'](e.target.value);
48-
},
49-
type: 'color',
50-
style: {
51-
padding: '0',
52-
width: '50px'
53-
}
54-
})
55-
});
56-
}
57-
},
30+
color: ColorWidget,
5831
time: TimePickerWidget, // 20:20:39+00:00
5932
date: DatePickerWidget, // 2018-11-13
6033
'date-time': DateTimePickerWidget, // 2018-11-13T20:20:39+00:00

packages/lib/vue3/vue3-form-ant/src/config/widgets/index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Created by Liu.Jun on 2020/5/17 10:41 下午.
33
*/
44

5+
import { h } from 'vue';
56
import CheckboxesWidget from './CheckboxesWidget';
67
import RadioWidget from './RadioWidget';
78
import SelectWidget from './SelectWidget';
@@ -21,6 +22,34 @@ const widgetComponents = {
2122
DateTimePickerWidget,
2223
UploadWidget,
2324
InputWidget: modelValueComponent('a-input'),
25+
ColorWidget: {
26+
setup(props, { attrs }) {
27+
return () => h(widgetComponents.InputWidget, {
28+
...attrs,
29+
style: {
30+
...attrs.style || {},
31+
maxWidth: '180px'
32+
}
33+
}, {
34+
addonAfter: () => h('input', {
35+
disabled: attrs.disabled,
36+
readonly: attrs.readonly,
37+
value: attrs.modelValue,
38+
onInput(e) {
39+
attrs['onUpdate:modelValue'](e.target.value);
40+
},
41+
onChange(e) {
42+
attrs['onUpdate:modelValue'](e.target.value);
43+
},
44+
type: 'color',
45+
style: {
46+
padding: '0',
47+
width: '50px'
48+
}
49+
})
50+
});
51+
}
52+
},
2453
TextAreaWidget: modelValueComponent('a-textarea'),
2554
InputNumberWidget: modelValueComponent('a-input-number'),
2655
AutoCompleteWidget: modelValueComponent('a-auto-complete'),

0 commit comments

Comments
 (0)