theme-aria-debug.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. Ext.define('Ext.theme.neptune.Component', {
  2. override: 'Ext.Component',
  3. initComponent: function() {
  4. this.callParent();
  5. if (this.dock && this.border === undefined) {
  6. this.border = false;
  7. }
  8. },
  9. privates: {
  10. initStyles: function() {
  11. var me = this,
  12. hasOwnBorder = me.hasOwnProperty('border'),
  13. border = me.border;
  14. if (me.dock) {
  15. // prevent the superclass method from setting the border style. We want to
  16. // allow dock layout to decide which borders to suppress.
  17. me.border = null;
  18. }
  19. me.callParent(arguments);
  20. if (hasOwnBorder) {
  21. me.border = border;
  22. } else {
  23. delete me.border;
  24. }
  25. }
  26. }
  27. }, function() {
  28. Ext.namespace('Ext.theme.is').Neptune = true;
  29. Ext.theme.name = 'Neptune';
  30. });
  31. Ext.define('Ext.theme.aria.Component', {
  32. override: 'Ext.Component'
  33. }, function() {
  34. Ext.namespace('Ext.theme.is').Aria = true;
  35. Ext.theme.name = 'Aria';
  36. });
  37. Ext.define('Ext.theme.neptune.resizer.Splitter', {
  38. override: 'Ext.resizer.Splitter',
  39. size: 8
  40. });
  41. Ext.define('Ext.theme.neptune.toolbar.Toolbar', {
  42. override: 'Ext.toolbar.Toolbar',
  43. usePlainButtons: false,
  44. border: false
  45. });
  46. Ext.define('Ext.theme.neptune.layout.component.Dock', {
  47. override: 'Ext.layout.component.Dock',
  48. /**
  49. * This table contains the border removal classes indexed by the sum of the edges to
  50. * remove. Each edge is assigned a value:
  51. *
  52. * * `left` = 1
  53. * * `bottom` = 2
  54. * * `right` = 4
  55. * * `top` = 8
  56. *
  57. * @private
  58. */
  59. noBorderClassTable: [
  60. 0,
  61. // TRBL
  62. Ext.baseCSSPrefix + 'noborder-l',
  63. // 0001 = 1
  64. Ext.baseCSSPrefix + 'noborder-b',
  65. // 0010 = 2
  66. Ext.baseCSSPrefix + 'noborder-bl',
  67. // 0011 = 3
  68. Ext.baseCSSPrefix + 'noborder-r',
  69. // 0100 = 4
  70. Ext.baseCSSPrefix + 'noborder-rl',
  71. // 0101 = 5
  72. Ext.baseCSSPrefix + 'noborder-rb',
  73. // 0110 = 6
  74. Ext.baseCSSPrefix + 'noborder-rbl',
  75. // 0111 = 7
  76. Ext.baseCSSPrefix + 'noborder-t',
  77. // 1000 = 8
  78. Ext.baseCSSPrefix + 'noborder-tl',
  79. // 1001 = 9
  80. Ext.baseCSSPrefix + 'noborder-tb',
  81. // 1010 = 10
  82. Ext.baseCSSPrefix + 'noborder-tbl',
  83. // 1011 = 11
  84. Ext.baseCSSPrefix + 'noborder-tr',
  85. // 1100 = 12
  86. Ext.baseCSSPrefix + 'noborder-trl',
  87. // 1101 = 13
  88. Ext.baseCSSPrefix + 'noborder-trb',
  89. // 1110 = 14
  90. Ext.baseCSSPrefix + 'noborder-trbl'
  91. ],
  92. // 1111 = 15
  93. /**
  94. * The numeric values assigned to each edge indexed by the `dock` config value.
  95. * @private
  96. */
  97. edgeMasks: {
  98. top: 8,
  99. right: 4,
  100. bottom: 2,
  101. left: 1
  102. },
  103. handleItemBorders: function() {
  104. var me = this,
  105. edges = 0,
  106. maskT = 8,
  107. maskR = 4,
  108. maskB = 2,
  109. maskL = 1,
  110. owner = me.owner,
  111. bodyBorder = owner.bodyBorder,
  112. ownerBorder = owner.border,
  113. collapsed = me.collapsed,
  114. edgeMasks = me.edgeMasks,
  115. noBorderCls = me.noBorderClassTable,
  116. dockedItemsGen = owner.dockedItems.generation,
  117. b, borderCls, docked, edgesTouched, i, ln, item, dock, lastValue, mask, addCls, removeCls;
  118. if (me.initializedBorders === dockedItemsGen) {
  119. return;
  120. }
  121. addCls = [];
  122. removeCls = [];
  123. borderCls = me.getBorderCollapseTable();
  124. noBorderCls = me.getBorderClassTable ? me.getBorderClassTable() : noBorderCls;
  125. me.initializedBorders = dockedItemsGen;
  126. // Borders have to be calculated using expanded docked item collection.
  127. me.collapsed = false;
  128. docked = me.getDockedItems('visual');
  129. me.collapsed = collapsed;
  130. for (i = 0 , ln = docked.length; i < ln; i++) {
  131. item = docked[i];
  132. if (item.ignoreBorderManagement) {
  133. // headers in framed panels ignore border management, so we do not want
  134. // to set "satisfied" on the edge in question
  135. continue;
  136. }
  137. dock = item.dock;
  138. mask = edgesTouched = 0;
  139. addCls.length = 0;
  140. removeCls.length = 0;
  141. if (dock !== 'bottom') {
  142. if (edges & maskT) {
  143. // if (not touching the top edge)
  144. b = item.border;
  145. } else {
  146. b = ownerBorder;
  147. if (b !== false) {
  148. edgesTouched += maskT;
  149. }
  150. }
  151. if (b === false) {
  152. mask += maskT;
  153. }
  154. }
  155. if (dock !== 'left') {
  156. if (edges & maskR) {
  157. // if (not touching the right edge)
  158. b = item.border;
  159. } else {
  160. b = ownerBorder;
  161. if (b !== false) {
  162. edgesTouched += maskR;
  163. }
  164. }
  165. if (b === false) {
  166. mask += maskR;
  167. }
  168. }
  169. if (dock !== 'top') {
  170. if (edges & maskB) {
  171. // if (not touching the bottom edge)
  172. b = item.border;
  173. } else {
  174. b = ownerBorder;
  175. if (b !== false) {
  176. edgesTouched += maskB;
  177. }
  178. }
  179. if (b === false) {
  180. mask += maskB;
  181. }
  182. }
  183. if (dock !== 'right') {
  184. if (edges & maskL) {
  185. // if (not touching the left edge)
  186. b = item.border;
  187. } else {
  188. b = ownerBorder;
  189. if (b !== false) {
  190. edgesTouched += maskL;
  191. }
  192. }
  193. if (b === false) {
  194. mask += maskL;
  195. }
  196. }
  197. if ((lastValue = item.lastBorderMask) !== mask) {
  198. item.lastBorderMask = mask;
  199. if (lastValue) {
  200. removeCls[0] = noBorderCls[lastValue];
  201. }
  202. if (mask) {
  203. addCls[0] = noBorderCls[mask];
  204. }
  205. }
  206. if ((lastValue = item.lastBorderCollapse) !== edgesTouched) {
  207. item.lastBorderCollapse = edgesTouched;
  208. if (lastValue) {
  209. removeCls[removeCls.length] = borderCls[lastValue];
  210. }
  211. if (edgesTouched) {
  212. addCls[addCls.length] = borderCls[edgesTouched];
  213. }
  214. }
  215. if (removeCls.length) {
  216. item.removeCls(removeCls);
  217. }
  218. if (addCls.length) {
  219. item.addCls(addCls);
  220. }
  221. // mask can use += but edges must use |= because there can be multiple items
  222. // on an edge but the mask is reset per item
  223. edges |= edgeMasks[dock];
  224. }
  225. // = T, R, B or L (8, 4, 2 or 1)
  226. mask = edgesTouched = 0;
  227. addCls.length = 0;
  228. removeCls.length = 0;
  229. if (edges & maskT) {
  230. // if (not touching the top edge)
  231. b = bodyBorder;
  232. } else {
  233. b = ownerBorder;
  234. if (b !== false) {
  235. edgesTouched += maskT;
  236. }
  237. }
  238. if (b === false) {
  239. mask += maskT;
  240. }
  241. if (edges & maskR) {
  242. // if (not touching the right edge)
  243. b = bodyBorder;
  244. } else {
  245. b = ownerBorder;
  246. if (b !== false) {
  247. edgesTouched += maskR;
  248. }
  249. }
  250. if (b === false) {
  251. mask += maskR;
  252. }
  253. if (edges & maskB) {
  254. // if (not touching the bottom edge)
  255. b = bodyBorder;
  256. } else {
  257. b = ownerBorder;
  258. if (b !== false) {
  259. edgesTouched += maskB;
  260. }
  261. }
  262. if (b === false) {
  263. mask += maskB;
  264. }
  265. if (edges & maskL) {
  266. // if (not touching the left edge)
  267. b = bodyBorder;
  268. } else {
  269. b = ownerBorder;
  270. if (b !== false) {
  271. edgesTouched += maskL;
  272. }
  273. }
  274. if (b === false) {
  275. mask += maskL;
  276. }
  277. if ((lastValue = me.lastBodyBorderMask) !== mask) {
  278. me.lastBodyBorderMask = mask;
  279. if (lastValue) {
  280. removeCls[0] = noBorderCls[lastValue];
  281. }
  282. if (mask) {
  283. addCls[0] = noBorderCls[mask];
  284. }
  285. }
  286. if ((lastValue = me.lastBodyBorderCollapse) !== edgesTouched) {
  287. me.lastBodyBorderCollapse = edgesTouched;
  288. if (lastValue) {
  289. removeCls[removeCls.length] = borderCls[lastValue];
  290. }
  291. if (edgesTouched) {
  292. addCls[addCls.length] = borderCls[edgesTouched];
  293. }
  294. }
  295. if (removeCls.length) {
  296. owner.removeBodyCls(removeCls);
  297. }
  298. if (addCls.length) {
  299. owner.addBodyCls(addCls);
  300. }
  301. },
  302. onRemove: function(item) {
  303. var me = this,
  304. lastBorderMask = item.lastBorderMask,
  305. lastBorderCollapse = item.lastBorderCollapse;
  306. if (!item.destroyed && !item.ignoreBorderManagement) {
  307. if (lastBorderMask) {
  308. item.lastBorderMask = 0;
  309. item.removeCls(me.noBorderClassTable[lastBorderMask]);
  310. }
  311. if (lastBorderCollapse) {
  312. item.lastBorderCollapse = 0;
  313. item.removeCls(me.getBorderCollapseTable()[lastBorderCollapse]);
  314. }
  315. }
  316. me.callParent([
  317. item
  318. ]);
  319. }
  320. });
  321. Ext.define('Ext.theme.neptune.panel.Panel', {
  322. override: 'Ext.panel.Panel',
  323. border: false,
  324. bodyBorder: false,
  325. initBorderProps: Ext.emptyFn,
  326. initBodyBorder: function() {
  327. // The superclass method converts a truthy bodyBorder into a number and sets
  328. // an inline border-width style on the body element. This prevents that from
  329. // happening if borderBody === true so that the body will get its border-width
  330. // the stylesheet.
  331. if (this.bodyBorder !== true) {
  332. this.callParent();
  333. }
  334. }
  335. });
  336. Ext.define('Ext.theme.neptune.container.ButtonGroup', {
  337. override: 'Ext.container.ButtonGroup',
  338. usePlainButtons: false
  339. });
  340. Ext.define('Ext.theme.neptune.toolbar.Paging', {
  341. override: 'Ext.toolbar.Paging',
  342. defaultButtonUI: 'plain-toolbar',
  343. inputItemWidth: 40
  344. });
  345. Ext.define('Ext.theme.neptune.picker.Month', {
  346. override: 'Ext.picker.Month',
  347. // Monthpicker contains logic that reduces the margins of the month items if it detects
  348. // that the text has wrapped. This can happen in the classic theme in certain
  349. // locales such as zh_TW. In order to work around this, Month picker measures
  350. // the month items to see if the height is greater than "measureMaxHeight".
  351. // In neptune the height of the items is larger, so we must increase this value.
  352. // While the actual height of the month items in neptune is 24px, we will only
  353. // determine that the text has wrapped if the height of the item exceeds 36px.
  354. // this allows theme developers some leeway to increase the month item size in
  355. // a neptune-derived theme.
  356. measureMaxHeight: 36
  357. });
  358. Ext.define('Ext.theme.neptune.form.field.HtmlEditor', {
  359. override: 'Ext.form.field.HtmlEditor',
  360. defaultButtonUI: 'plain-toolbar'
  361. });
  362. Ext.define('Ext.theme.neptune.panel.Table', {
  363. override: 'Ext.panel.Table',
  364. lockableBodyBorder: true,
  365. initComponent: function() {
  366. var me = this;
  367. me.callParent();
  368. if (!me.hasOwnProperty('bodyBorder') && !me.hideHeaders && (me.lockableBodyBorder || !me.lockable)) {
  369. me.bodyBorder = true;
  370. }
  371. }
  372. });
  373. Ext.define('Ext.theme.neptune.grid.RowEditor', {
  374. override: 'Ext.grid.RowEditor',
  375. buttonUI: 'default-toolbar'
  376. });
  377. Ext.define('Ext.theme.neptune.grid.column.RowNumberer', {
  378. override: 'Ext.grid.column.RowNumberer',
  379. width: 25
  380. });
  381. Ext.define('Ext.theme.neptune.menu.Separator', {
  382. override: 'Ext.menu.Separator',
  383. border: true
  384. });
  385. Ext.define('Ext.theme.neptune.menu.Menu', {
  386. override: 'Ext.menu.Menu',
  387. showSeparator: false
  388. });
  389. Ext.define('Ext.theme.aria.selection.CheckboxModel', {
  390. override: 'Ext.selection.CheckboxModel',
  391. headerWidth: 28
  392. });