yuliang преди 3 години
родител
ревизия
ce2dfcc07b
променени са 6 файла, в които са добавени 120 реда и са изтрити 0 реда
  1. 20 0
      src/Defaults.ts
  2. 23 0
      src/controls/input/checkbox.js
  3. 23 0
      src/controls/input/checkboxgroup.js
  4. 23 0
      src/controls/input/radio.js
  5. 23 0
      src/controls/input/radiogroup.js
  6. 8 0
      src/init.ts

+ 20 - 0
src/Defaults.ts

@@ -26,6 +26,26 @@ export const numberfield = {
     labelWidth: 70,
 }
 
+export const checkbox = {
+    labelAlign: 'right',
+    labelWidth: 70,
+}
+
+export const checkboxgroup = {
+    labelAlign: 'right',
+    labelWidth: 70,
+}
+
+export const radio = {
+    labelAlign: 'right',
+    labelWidth: 70,
+}
+
+export const radiogroup = {
+    labelAlign: 'right',
+    labelWidth: 70,
+}
+
 export const grid = {
     border: true,
     columnLines: true,

+ 23 - 0
src/controls/input/checkbox.js

@@ -0,0 +1,23 @@
+import _ from 'lodash'
+import {baseConfig} from "../base";
+import {checkbox} from "../../Defaults";
+
+export default function () {
+
+    const cc = Ext.form.field.Checkbox.prototype.constructor
+    const {initComponent} = Ext.form.field.Checkbox.prototype
+    Ext.form.field.Checkbox.override({
+        constructor(config) {
+            const newConfig = _.defaultsDeep({
+                // 强制属性
+
+            }, baseConfig(config, 'col-item'), config, checkbox)
+
+            cc.call(this, newConfig)
+        },
+
+        initComponent() {
+            initComponent.call(this)
+        },
+    });
+}

+ 23 - 0
src/controls/input/checkboxgroup.js

@@ -0,0 +1,23 @@
+import _ from 'lodash'
+import {baseConfig} from "../base";
+import {checkboxgroup} from "../../Defaults";
+
+export default function () {
+
+    const cc = Ext.form.CheckboxGroup.prototype.constructor
+    const {initComponent} = Ext.form.CheckboxGroup.prototype
+    Ext.form.CheckboxGroup.override({
+        constructor(config) {
+            const newConfig = _.defaultsDeep({
+                // 强制属性
+
+            }, baseConfig(config, 'col-item'), config, checkboxgroup)
+
+            cc.call(this, newConfig)
+        },
+
+        initComponent() {
+            initComponent.call(this)
+        },
+    });
+}

+ 23 - 0
src/controls/input/radio.js

@@ -0,0 +1,23 @@
+import _ from 'lodash'
+import {baseConfig} from "../base";
+import {radio} from "../../Defaults";
+
+export default function () {
+
+    const cc = Ext.form.field.Radio.prototype.constructor
+    const {initComponent} = Ext.form.field.Radio.prototype
+    Ext.form.field.Radio.override({
+        constructor(config) {
+            const newConfig = _.defaultsDeep({
+                // 强制属性
+
+            }, baseConfig(config, 'col-item'), config, radio)
+
+            cc.call(this, newConfig)
+        },
+
+        initComponent() {
+            initComponent.call(this)
+        },
+    });
+}

+ 23 - 0
src/controls/input/radiogroup.js

@@ -0,0 +1,23 @@
+import _ from 'lodash'
+import {baseConfig} from "../base";
+import {radiogroup} from "../../Defaults";
+
+export default function () {
+
+    const cc = Ext.form.RadioGroup.prototype.constructor
+    const {initComponent} = Ext.form.RadioGroup.prototype
+    Ext.form.RadioGroup.override({
+        constructor(config) {
+            const newConfig = _.defaultsDeep({
+                // 强制属性
+
+            }, baseConfig(config, 'col-item'), config, radiogroup)
+
+            cc.call(this, newConfig)
+        },
+
+        initComponent() {
+            initComponent.call(this)
+        },
+    });
+}

+ 8 - 0
src/init.ts

@@ -10,6 +10,10 @@ import initCombo from './controls/input/combo'
 import initSearch from './controls/input/search'
 import initDate from './controls/input/datefield'
 import initNumber from './controls/input/numberfield'
+import initCheckbox from './controls/input/checkbox'
+import initCheckboxGroup from './controls/input/checkboxgroup'
+import initRadio from './controls/input/radio'
+import initRadioGroup from './controls/input/radiogroup'
 import initRows from './controls/rows'
 import initCols from './controls/cols'
 import initButton from './controls/button'
@@ -112,4 +116,8 @@ export function init() {
     initSearch()
     initDate()
     initNumber()
+    initCheckbox()
+    initCheckboxGroup()
+    initRadio()
+    initRadioGroup()
 }