Browse Source

DESIGN 支持

yuliang 4 years ago
parent
commit
73c3256abe

+ 17 - 0
src/controls/button.js

@@ -0,0 +1,17 @@
+import _ from 'lodash'
+import $ from 'jquery'
+
+export default function () {
+  /**
+   *
+   */
+  const ct = Ext.button.Button.prototype.constructor
+  Ext.button.Button.override({
+    constructor: function (config) {
+      const newConfig = _.defaultsDeep({}, config, {
+        cls: ['yvan_design']
+      })
+      ct.call(this, newConfig)
+    }
+  });
+}

+ 21 - 0
src/controls/container.js

@@ -0,0 +1,21 @@
+import _ from 'lodash'
+import $ from 'jquery'
+
+export default function () {
+  /**
+   *
+   */
+  const ct = Ext.container.Container.prototype.constructor
+  Ext.container.Container.override({
+    constructor: function (config) {
+      if (config.xtype === "container") {
+        const newConfig = _.defaultsDeep({}, config, {
+          cls: ['yvan_design', 'design_cols_container']
+        })
+        ct.call(this, newConfig)
+      } else {
+        ct.call(this, config)
+      }
+    }
+  });
+}

+ 17 - 0
src/controls/splitter.js

@@ -0,0 +1,17 @@
+import _ from 'lodash'
+import $ from 'jquery'
+
+export default function () {
+  /**
+   *
+   */
+  const ct = Ext.resizer.Splitter.prototype.constructor
+  Ext.resizer.Splitter.override({
+    constructor: function (config) {
+      const newConfig = _.defaultsDeep({}, config, {
+        cls: ['yvan_design', 'design_rows_container']
+      })
+      ct.call(this, newConfig)
+    }
+  });
+}

+ 17 - 0
src/controls/toolbar/tbfill.js

@@ -0,0 +1,17 @@
+import _ from 'lodash'
+import $ from 'jquery'
+
+export default function () {
+  /**
+   *
+   */
+  const ct = Ext.toolbar.Fill.prototype.constructor
+  Ext.toolbar.Fill.override({
+    constructor: function (config) {
+      const newConfig = _.defaultsDeep({}, config, {
+        cls: ['yvan_design']
+      })
+      ct.call(this, newConfig)
+    }
+  });
+}

+ 17 - 0
src/controls/toolbar/tbseparator.js

@@ -0,0 +1,17 @@
+import _ from 'lodash'
+import $ from 'jquery'
+
+export default function () {
+  /**
+   *
+   */
+  const ct = Ext.toolbar.Separator.prototype.constructor
+  Ext.toolbar.Separator.override({
+    constructor: function (config) {
+      const newConfig = _.defaultsDeep({}, config, {
+        cls: ['yvan_design']
+      })
+      ct.call(this, newConfig)
+    }
+  });
+}

+ 21 - 0
src/controls/toolbar/toolbar.js

@@ -0,0 +1,21 @@
+import _ from 'lodash'
+import $ from 'jquery'
+import initTbFill from './tbfill'
+import initTbSeparator from './tbseparator'
+
+export default function () {
+  /**
+   *
+   */
+  const ct = Ext.toolbar.Toolbar.prototype.constructor
+  Ext.toolbar.Toolbar.override({
+    constructor: function (config) {
+      const newConfig = _.defaultsDeep({}, config, {
+        cls: ['yvan_design', 'design_cols_container']
+      })
+      ct.call(this, newConfig)
+    }
+  });
+  initTbFill();
+  initTbSeparator();
+}

+ 6 - 0
src/init.ts

@@ -1,6 +1,9 @@
 import _ from 'lodash'
 import initMainTab from './controls/MainTab'
 import initTextfield from './controls/textfield'
+import initToolbar from './controls/toolbar/toolbar'
+import initContainer from './controls/container'
+import initSplitter from './controls/splitter'
 
 export function init() {
     // 引入 filters 过滤插件
@@ -52,4 +55,7 @@ export function init() {
 
     initMainTab()
     initTextfield()
+    initToolbar()
+    initContainer()
+    initSplitter()
 }