defaultSettings.js 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023
  1. 'use strict';
  2. exports.__esModule = true;
  3. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  4. var _mixed = require('./helpers/mixed');
  5. /**
  6. * @alias Options
  7. * @constructor
  8. * @description
  9. * ## Constructor options
  10. *
  11. * Constructor options are applied using an object literal passed as a second argument to the Handsontable constructor.
  12. *
  13. * ```js
  14. * var hot = new Handsontable(document.getElementById('example1'), {
  15. * data: myArray,
  16. * width: 400,
  17. * height: 300
  18. * });
  19. * ```
  20. *
  21. * ---
  22. * ## Cascading configuration
  23. *
  24. * Handsontable 0.9 and newer is using *Cascading Configuration*, which is a fast way to provide configuration options
  25. * for the entire table, including its columns and particular cells.
  26. *
  27. * Consider the following example:
  28. * ```js
  29. * var hot = new Handsontable(document.getElementById('example'), {
  30. * readOnly: true,
  31. * columns: [
  32. * {readOnly: false},
  33. * {},
  34. * {}
  35. * ],
  36. * cells: function (row, col, prop) {
  37. * var cellProperties = {};
  38. *
  39. * if (row === 0 && col === 0) {
  40. * cellProperties.readOnly = true;
  41. * }
  42. *
  43. * return cellProperties;
  44. * }
  45. * });
  46. * ```
  47. *
  48. * The above notation will result in all TDs being *read only*, except for first column TDs which will be *editable*, except for the TD in top left corner which will still be *read only*.
  49. *
  50. * ### The Cascading Configuration model
  51. *
  52. * ##### 1. Constructor
  53. *
  54. * Configuration options that are provided using first-level `handsontable(container, {option: "value"})` and `updateSettings` method.
  55. *
  56. * ##### 2. Columns
  57. *
  58. * Configuration options that are provided using second-level object `handsontable(container, {columns: {option: "value"}]})`
  59. *
  60. * ##### 3. Cells
  61. *
  62. * Configuration options that are provided using second-level function `handsontable(container, {cells: function: (row, col, prop){ }})`
  63. *
  64. * ---
  65. * ## Architecture performance
  66. *
  67. * The Cascading Configuration model is based on prototypical inheritance. It is much faster and memory efficient compared
  68. * to the previous model that used jQuery extend. See: [http://jsperf.com/extending-settings](http://jsperf.com/extending-settings).
  69. *
  70. * ---
  71. * __Important notice:__ In order for the data separation to work properly, make sure that each instance of Handsontable has a unique `id`.
  72. */
  73. function DefaultSettings() {};
  74. DefaultSettings.prototype = {
  75. /**
  76. * @description
  77. * Initial data source that will be bound to the data grid __by reference__ (editing data grid alters the data source).
  78. * Can be declared as an Array of Arrays, Array of Objects or a Function.
  79. *
  80. * See [Understanding binding as reference](http://docs.handsontable.com/tutorial-data-binding.html#page-reference).
  81. *
  82. * @type {Array|Function}
  83. * @default undefined
  84. */
  85. data: void 0,
  86. /**
  87. * @description
  88. * Defines the structure of a new row when data source is an array of objects.
  89. *
  90. * See [data-schema](http://docs.handsontable.com/tutorial-data-sources.html#page-data-schema) for examples.
  91. *
  92. * @type {Object}
  93. * @default undefined
  94. */
  95. dataSchema: void 0,
  96. /**
  97. * Width of the grid. Can be a value or a function that returns a value.
  98. *
  99. * @type {Number|Function}
  100. * @default undefined
  101. */
  102. width: void 0,
  103. /**
  104. * Height of the grid. Can be a number or a function that returns a number.
  105. *
  106. * @type {Number|Function}
  107. * @default undefined
  108. */
  109. height: void 0,
  110. /**
  111. * @description
  112. * Initial number of rows.
  113. *
  114. * __Notice:__ This option only has effect in Handsontable constructor and only if `data` option is not provided
  115. *
  116. * @type {Number}
  117. * @default 5
  118. */
  119. startRows: 5,
  120. /**
  121. * @description
  122. * Initial number of columns.
  123. *
  124. * __Notice:__ This option only has effect in Handsontable constructor and only if `data` option is not provided
  125. *
  126. * @type {Number}
  127. * @default 5
  128. */
  129. startCols: 5,
  130. /**
  131. * Setting `true` or `false` will enable or disable the default row headers (1, 2, 3).
  132. * You can also define an array `['One', 'Two', 'Three', ...]` or a function to define the headers.
  133. * If a function is set the index of the row is passed as a parameter.
  134. *
  135. * @type {Boolean|Array|Function}
  136. * @default null
  137. * @example
  138. * ```js
  139. * ...
  140. * // as boolean
  141. * rowHeaders: true,
  142. * ...
  143. *
  144. * ...
  145. * // as array
  146. * rowHeaders: [1, 2, 3],
  147. * ...
  148. *
  149. * ...
  150. * // as function
  151. * rowHeaders: function(index) {
  152. * return index + ': AB';
  153. * },
  154. * ...
  155. * ```
  156. */
  157. rowHeaders: void 0,
  158. /**
  159. * Setting `true` or `false` will enable or disable the default column headers (A, B, C).
  160. * You can also define an array `['One', 'Two', 'Three', ...]` or a function to define the headers.
  161. * If a function is set, then the index of the column is passed as a parameter.
  162. *
  163. * @type {Boolean|Array|Function}
  164. * @default null
  165. * @example
  166. * ```js
  167. * ...
  168. * // as boolean
  169. * colHeaders: true,
  170. * ...
  171. *
  172. * ...
  173. * // as array
  174. * colHeaders: ['A', 'B', 'C'],
  175. * ...
  176. *
  177. * ...
  178. * // as function
  179. * colHeaders: function(index) {
  180. * return index + ': AB';
  181. * },
  182. * ...
  183. * ```
  184. */
  185. colHeaders: null,
  186. /**
  187. * Defines column widths in pixels. Accepts number, string (that will be converted to a number),
  188. * array of numbers (if you want to define column width separately for each column) or a
  189. * function (if you want to set column width dynamically on each render).
  190. *
  191. * @type {Array|Function|Number|String}
  192. * @default undefined
  193. */
  194. colWidths: void 0,
  195. /**
  196. * Defines row heights in pixels. Accepts numbers, strings (that will be converted into a number),
  197. * array of numbers (if you want to define row height separately for each row) or a
  198. * function (if you want to set row height dynamically on each render).
  199. *
  200. * @type {Array|Function|Number|String}
  201. * @default undefined
  202. */
  203. rowHeights: void 0,
  204. /**
  205. * @description
  206. * Defines the cell properties and data binding for certain columns.
  207. *
  208. * __Notice:__ Using this option sets a fixed number of columns (options `startCols`, `minCols`, `maxCols` will be ignored).
  209. *
  210. * See [documentation -> datasources.html](http://docs.handsontable.com/tutorial-data-sources.html#page-nested) for examples.
  211. *
  212. * @type {Array}
  213. * @default undefined
  214. * @example
  215. * ```js
  216. * ...
  217. * columns: [
  218. * {
  219. * // column options for the first column
  220. * type: 'numeric',
  221. * format: '0,0.00 $'
  222. * },
  223. * {
  224. * // column options for the second column
  225. * type: 'text',
  226. * readOnly: true
  227. * }
  228. * ],
  229. * ...
  230. * ```
  231. */
  232. columns: void 0,
  233. /**
  234. * @description
  235. * Defines the cell properties for given `row`, `col`, `prop` coordinates.
  236. * Any constructor or column option may be overwritten for a particular cell (row/column combination)
  237. * using the `cells` property in the Handsontable constructor.
  238. *
  239. * __Note:__ Parameters `row` and `col` always represent __physical indexes__. Example below show how to execute
  240. * operations based on the __visual__ representation of Handsontable.
  241. *
  242. * @type {Function}
  243. * @default undefined
  244. * @example
  245. * ```js
  246. * ...
  247. * cells: function (row, col, prop) {
  248. * var cellProperties = {};
  249. * var visualRowIndex = this.instance.toVisualRow(row);
  250. * var visualColIndex = this.instance.toVisualColumn(col);
  251. *
  252. * if (visualRowIndex === 0 && visualColIndex === 0) {
  253. * cellProperties.readOnly = true;
  254. * }
  255. *
  256. * return cellProperties;
  257. * },
  258. * ...
  259. * ```
  260. */
  261. cells: void 0,
  262. /**
  263. * Any constructor or column option may be overwritten for a particular cell (row/column combination), using `cell`
  264. * array passed to the Handsontable constructor.
  265. *
  266. * @type {Array}
  267. * @default []
  268. * @example
  269. * ```js
  270. * ...
  271. * cell: [
  272. * {row: 0, col: 0, readOnly: true}
  273. * ],
  274. * ...
  275. * ```
  276. */
  277. cell: [],
  278. /**
  279. * @description
  280. * If `true`, enables the {@link Comments} plugin, which enables an option to apply cell comments through the context menu
  281. * (configurable with context menu keys `commentsAddEdit`, `commentsRemove`).
  282. *
  283. * To initialize Handsontable with predefined comments, provide cell coordinates and comment text values in a form of an array.
  284. *
  285. * See [Comments](http://docs.handsontable.com/demo-comments_.html) demo for examples.
  286. *
  287. * @since 0.11.0
  288. * @type {Boolean|Array}
  289. * @default false
  290. * @example
  291. * ```js
  292. * ...
  293. * comments: [{row: 1, col: 1, comment: {value: "Test comment"}}],
  294. * ...
  295. * ```
  296. */
  297. comments: false,
  298. /**
  299. * @description
  300. * If `true`, enables the Custom Borders plugin, which enables an option to apply custom borders through the context menu (configurable with context menu key `borders`).
  301. *
  302. * To initialize Handsontable with predefined custom borders, provide cell coordinates and border styles in a form of an array.
  303. *
  304. * See [Custom Borders](http://docs.handsontable.com/demo-custom-borders.html) demo for examples.
  305. *
  306. * @since 0.11.0
  307. * @type {Boolean|Array}
  308. * @default false
  309. * @example
  310. * ```js
  311. * ...
  312. * customBorders: [
  313. * {range: {
  314. * from: {row: 1, col: 1},
  315. * to: {row: 3, col: 4}},
  316. * left: {},
  317. * right: {},
  318. * top: {},
  319. * bottom: {}
  320. * }
  321. * ],
  322. * ...
  323. *
  324. * // or
  325. * ...
  326. * customBorders: [
  327. * {row: 2, col: 2, left: {width: 2, color: 'red'},
  328. * right: {width: 1, color: 'green'}, top: '', bottom: ''}
  329. * ],
  330. * ...
  331. * ```
  332. */
  333. customBorders: false,
  334. /**
  335. * Minimum number of rows. At least that number of rows will be created during initialization.
  336. *
  337. * @type {Number}
  338. * @default 0
  339. */
  340. minRows: 0,
  341. /**
  342. * Minimum number of columns. At least that number of columns will be created during initialization.
  343. *
  344. * @type {Number}
  345. * @default 0
  346. */
  347. minCols: 0,
  348. /**
  349. * Maximum number of rows. If set to a value lower than the initial row count, the data will be trimmed to the provided value as the number of rows.
  350. *
  351. * @type {Number}
  352. * @default Infinity
  353. */
  354. maxRows: Infinity,
  355. /**
  356. * Maximum number of cols. If set to a value lower than the initial col count, the data will be trimmed to the provided value as the number of cols.
  357. *
  358. * @type {Number}
  359. * @default Infinity
  360. */
  361. maxCols: Infinity,
  362. /**
  363. * When set to 1 (or more), Handsontable will add a new row at the end of grid if there are no more empty rows.
  364. * (unless the number of rows exceeds the one set in the `maxRows` property)
  365. *
  366. * @type {Number}
  367. * @default 0
  368. */
  369. minSpareRows: 0,
  370. /**
  371. * When set to 1 (or more), Handsontable will add a new column at the end of grid if there are no more empty columns.
  372. * (unless the number of rows exceeds the one set in the `maxCols` property)
  373. *
  374. * @type {Number}
  375. * @default 0
  376. */
  377. minSpareCols: 0,
  378. /**
  379. * If set to `false`, there won't be an option to insert new rows in the Context Menu.
  380. *
  381. * @type {Boolean}
  382. * @default true
  383. */
  384. allowInsertRow: true,
  385. /**
  386. * If set to `false`, there won't be an option to insert new columns in the Context Menu.
  387. *
  388. * @type {Boolean}
  389. * @default true
  390. */
  391. allowInsertColumn: true,
  392. /**
  393. * If set to `false`, there won't be an option to remove rows in the Context Menu.
  394. *
  395. * @type {Boolean}
  396. * @default true
  397. */
  398. allowRemoveRow: true,
  399. /**
  400. * If set to `false`, there won't be an option to remove columns in the Context Menu.
  401. *
  402. * @type {Boolean}
  403. * @default true
  404. */
  405. allowRemoveColumn: true,
  406. /**
  407. * If true, selection of multiple cells using keyboard or mouse is allowed.
  408. *
  409. * @type {Boolean}
  410. * @default true
  411. */
  412. multiSelect: true,
  413. /**
  414. * Enables the fill handle (drag-down and copy-down) functionality, which shows a small rectangle in bottom
  415. * right corner of the selected area, that let's you expand values to the adjacent cells.
  416. *
  417. * Possible values: `true` (to enable in all directions), `'vertical'` or `'horizontal'` (to enable in one direction),
  418. * `false` (to disable completely). Setting to `true` enables the fillHandle plugin.
  419. *
  420. * Since 0.23.0 you can pass object to plugin which allows you to add more options for this functionality. If `autoInsertRow`
  421. * option is `true`, fill-handler will create new rows till it reaches the last row. It is enabled by default.
  422. *
  423. * @example
  424. * ```js
  425. * ...
  426. * fillHandle: true // enable plugin in all directions and with autoInsertRow as true
  427. * ...
  428. * // or
  429. * ...
  430. * fillHandle: 'vertical' // enable plugin in vertical direction and with autoInsertRow as true
  431. * ...
  432. * // or
  433. * ...
  434. * fillHandle: { // enable plugin in both directions and with autoInsertRow as false
  435. * autoInsertRow: false,
  436. * }
  437. * // or
  438. * ...
  439. * fillHandle: { // enable plugin in vertical direction and with autoInsertRow as false
  440. * autoInsertRow: false,
  441. * direction: 'vertical' // 'vertical' or 'horizontal'
  442. * }
  443. * ```
  444. *
  445. * @type {Boolean|String|Object}
  446. * @default true
  447. */
  448. fillHandle: true,
  449. /**
  450. * Allows to specify the number of fixed (or *frozen*) rows at the top of the table.
  451. *
  452. * @type {Number}
  453. * @default 0
  454. * @example
  455. * ```js
  456. * fixedRowsTop: 3 // This would freeze the top 3 rows of the table.
  457. * ```
  458. */
  459. fixedRowsTop: 0,
  460. /**
  461. * Allows to specify the number of fixed (or *frozen*) rows at the bottom of the table.
  462. *
  463. * @pro
  464. * @type {Number}
  465. * @default 0
  466. * @example
  467. * ```js
  468. * fixedRowsBottom: 3 // This would freeze the top 3 rows of the table.
  469. * ```
  470. */
  471. fixedRowsBottom: 0,
  472. /**
  473. * Allows to specify the number of fixed (or *frozen*) columns on the left of the table.
  474. *
  475. * @type {Number}
  476. * @default 0
  477. * @example
  478. * ```js
  479. * fixedColumnsLeft: 3 // This would freeze the top 3 rows of the table.
  480. * ```
  481. */
  482. fixedColumnsLeft: 0,
  483. /**
  484. * If `true`, mouse click outside the grid will deselect the current selection.
  485. * Can be a function that takes the click event target and returns a boolean.
  486. *
  487. * @type {Boolean|Function}
  488. * @default true
  489. */
  490. outsideClickDeselects: true,
  491. /**
  492. * If `true`, <kbd>ENTER</kbd> begins editing mode (like in Google Docs). If `false`, <kbd>ENTER</kbd> moves to next
  493. * row (like Excel) and adds a new row if necessary. <kbd>TAB</kbd> adds new column if necessary.
  494. *
  495. * @type {Boolean}
  496. * @default true
  497. */
  498. enterBeginsEditing: true,
  499. /**
  500. * Defines the cursor movement after <kbd>ENTER</kbd> was pressed (<kbd>SHIFT</kbd> + <kbd>ENTER</kbd> uses a negative vector).
  501. * Can be an object or a function that returns an object. The event argument passed to the function
  502. * is a DOM Event object received after the <kbd>ENTER</kbd> key has been pressed. This event object can be used to check
  503. * whether user pressed <kbd>ENTER</kbd> or <kbd>SHIFT</kbd> + <kbd>ENTER</kbd>.
  504. *
  505. * @type {Object|Function}
  506. * @default {row: 1, col: 0}
  507. */
  508. enterMoves: { row: 1, col: 0 },
  509. /**
  510. * Defines the cursor movement after <kbd>TAB</kbd> is pressed (<kbd>SHIFT</kbd> + <kbd>TAB</kbd> uses a negative vector).
  511. * Can be an object or a function that returns an object. The event argument passed to the function
  512. * is a DOM Event object received after the <kbd>TAB</kbd> key has been pressed. This event object can be used to check
  513. * whether user pressed <kbd>TAB</kbd> or <kbd>SHIFT</kbd> + <kbd>TAB</kbd>.
  514. *
  515. * @type {Object}
  516. * @default {row: 0, col: 1}
  517. */
  518. tabMoves: { row: 0, col: 1 },
  519. /**
  520. * If `true`, pressing <kbd>TAB</kbd> or right arrow in the last column will move to first column in next row.
  521. *
  522. * @type {Boolean}
  523. * @default false
  524. */
  525. autoWrapRow: false,
  526. /**
  527. * If `true`, pressing <kbd>ENTER</kbd> or down arrow in the last row will move to the first row in the next column.
  528. *
  529. * @type {Boolean}
  530. * @default false
  531. */
  532. autoWrapCol: false,
  533. /**
  534. * Maximum number of rows than can be copied to clipboard using <kbd>CTRL</kbd> + <kbd>C</kbd>.
  535. *
  536. * @type {Number}
  537. * @default 1000
  538. */
  539. copyRowsLimit: 1000,
  540. /**
  541. * Maximum number of columns than can be copied to clipboard using <kbd>CTRL</kbd> + <kbd>C</kbd>.
  542. *
  543. * @type {Number}
  544. * @default 1000
  545. */
  546. copyColsLimit: 1000,
  547. /**
  548. * @description
  549. * Defines paste (<kbd>CTRL</kbd> + <kbd>V</kbd>) behavior.
  550. * * Default value `"overwrite"` will paste clipboard value over current selection.
  551. * * When set to `"shift_down"`, clipboard data will be pasted in place of current selection, while all selected cells are moved down.
  552. * * When set to `"shift_right"`, clipboard data will be pasted in place of current selection, while all selected cells are moved right.
  553. *
  554. * @type {String}
  555. * @default 'overwrite'
  556. */
  557. pasteMode: 'overwrite',
  558. /**
  559. * @description
  560. * Turns on saving the state of column sorting, column positions and column sizes in local storage.
  561. *
  562. * You can save any sort of data in local storage to preserve table state between page reloads.
  563. * In order to enable data storage mechanism, `persistentState` option must be set to `true` (you can set it
  564. * either during Handsontable initialization or using the `updateSettings` method). When `persistentState` is enabled it exposes 3 hooks:
  565. *
  566. * __persistentStateSave__ (key: String, value: Mixed)
  567. *
  568. * * Saves value under given key in browser local storage.
  569. *
  570. * __persistentStateLoad__ (key: String, valuePlaceholder: Object)
  571. *
  572. * * Loads `value`, saved under given key, form browser local storage. The loaded `value` will be saved in `valuePlaceholder.value`
  573. * (this is due to specific behaviour of `Hooks.run()` method). If no value have been saved under key `valuePlaceholder.value`
  574. * will be `undefined`.
  575. *
  576. * __persistentStateReset__ (key: String)
  577. *
  578. * * Clears the value saved under `key`. If no `key` is given, all values associated with table will be cleared.
  579. *
  580. * __Note:__ The main reason behind using `persistentState` hooks rather than regular LocalStorage API is that it
  581. * ensures separation of data stored by multiple Handsontable instances. In other words, if you have two (or more)
  582. * instances of Handsontable on one page, data saved by one instance won't be accessible by the second instance.
  583. * Those two instances can store data under the same key and no data would be overwritten.
  584. *
  585. * __Important:__ In order for the data separation to work properly, make sure that each instance of Handsontable has a unique `id`.
  586. *
  587. * @type {Boolean}
  588. * @default false
  589. */
  590. persistentState: void 0,
  591. /**
  592. * Class name for all visible rows in the current selection.
  593. *
  594. * @type {String}
  595. * @default undefined
  596. * @example
  597. * ```js
  598. * currentRowClassName: 'currentRow' // This will add a 'currentRow' class name to appropriate table cells.
  599. * ```
  600. */
  601. currentRowClassName: void 0,
  602. /**
  603. * Class name for all visible columns in the current selection.
  604. *
  605. * @type {String}
  606. * @default undefined
  607. * @example
  608. * ```js
  609. * currentColClassName: 'currentColumn' // This will add a 'currentColumn' class name to appropriate table cells.
  610. * ```
  611. */
  612. currentColClassName: void 0,
  613. /**
  614. * Class name for all visible headers in current selection.
  615. *
  616. * @type {String}
  617. * @since 0.27.0
  618. * @default 'ht__highlight'
  619. * @example
  620. * ```js
  621. * currentHeaderClassName: 'ht__highlight' // This will add a 'ht__highlight' class name to appropriate table headers.
  622. * ```
  623. */
  624. currentHeaderClassName: 'ht__highlight',
  625. /**
  626. * Class name for the Handsontable container element.
  627. *
  628. * @type {String|Array}
  629. * @default undefined
  630. */
  631. className: void 0,
  632. /**
  633. * Class name for all tables inside container element.
  634. *
  635. * @since 0.17.0
  636. * @type {String|Array}
  637. * @default undefined
  638. */
  639. tableClassName: void 0,
  640. /**
  641. * @description
  642. * Defines how the columns react, when the declared table width is different than the calculated sum of all column widths.
  643. * [See more](http://docs.handsontable.com/demo-stretching.html) mode. Possible values:
  644. * * `'none'` Disable stretching
  645. * * `'last'` Stretch only the last column
  646. * * `'all'` Stretch all the columns evenly
  647. *
  648. * @type {String}
  649. * @default 'none'
  650. */
  651. stretchH: 'none',
  652. /**
  653. * Lets you overwrite the default `isEmptyRow` method, which checks if row at the provided index is empty.
  654. *
  655. * @type {Function}
  656. * @param {Number} row
  657. * @returns {Boolean}
  658. */
  659. isEmptyRow: function isEmptyRow(row) {
  660. var col, colLen, value, meta;
  661. for (col = 0, colLen = this.countCols(); col < colLen; col++) {
  662. value = this.getDataAtCell(row, col);
  663. if (value !== '' && value !== null && (0, _mixed.isDefined)(value)) {
  664. if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
  665. meta = this.getCellMeta(row, col);
  666. return isObjectEquals(this.getSchema()[meta.prop], value);
  667. }
  668. return false;
  669. }
  670. }
  671. return true;
  672. },
  673. /**
  674. * Lets you overwrite the default `isEmptyCol` method, which checks if column at the provided index is empty.
  675. *
  676. * @type {Function}
  677. * @param {Number} col
  678. * @returns {Boolean}
  679. */
  680. isEmptyCol: function isEmptyCol(col) {
  681. var row, rowLen, value;
  682. for (row = 0, rowLen = this.countRows(); row < rowLen; row++) {
  683. value = this.getDataAtCell(row, col);
  684. if (value !== '' && value !== null && (0, _mixed.isDefined)(value)) {
  685. return false;
  686. }
  687. }
  688. return true;
  689. },
  690. /**
  691. * When set to `true`, the table is re-rendered when it is detected that it was made visible in DOM.
  692. *
  693. * @type {Boolean}
  694. * @default true
  695. */
  696. observeDOMVisibility: true,
  697. /**
  698. * If set to `true`, Handsontable will accept values that were marked as invalid by the cell `validator`.
  699. * It will result with *invalid* cells being treated as *valid* (will save the *invalid* value into the Handsontable data source).
  700. * If set to `false`, Handsontable will *not* accept the invalid values and won't allow the user to close the editor.
  701. * This option will be particularly useful when used with the Autocomplete's `strict` mode.
  702. *
  703. * @type {Boolean}
  704. * @default true
  705. * @since 0.9.5
  706. */
  707. allowInvalid: true,
  708. /**
  709. * If set to `true`, Handsontable will accept values that are empty (`null`, `undefined` or `''`).
  710. * If set to `false`, Handsontable will *not* accept the empty values and mark cell as invalid.
  711. *
  712. * @example
  713. * ```js
  714. * ...
  715. * allowEmpty: true // allow empty values for all cells (whole table)
  716. * ...
  717. * // or
  718. * ...
  719. * columns: [
  720. * // allow empty values only for 'date' column
  721. * {data: 'date', dateFormat: 'DD/MM/YYYY', allowEmpty: true}
  722. * ]
  723. * ...
  724. * ```
  725. *
  726. * @type {Boolean}
  727. * @default true
  728. * @since 0.23.0
  729. */
  730. allowEmpty: true,
  731. /**
  732. * CSS class name for cells that did not pass validation.
  733. *
  734. * @type {String}
  735. * @default 'htInvalid'
  736. */
  737. invalidCellClassName: 'htInvalid',
  738. /**
  739. * When set to an non-empty string, displayed as the cell content for empty cells. If a value of a different type is provided,
  740. * it will be stringified and applied as a string.
  741. *
  742. * @type {Mixed}
  743. * @default false
  744. */
  745. placeholder: false,
  746. /**
  747. * CSS class name for cells that have a placeholder in use.
  748. *
  749. * @type {String}
  750. * @default 'htPlaceholder'
  751. */
  752. placeholderCellClassName: 'htPlaceholder',
  753. /**
  754. * CSS class name for read-only cells.
  755. *
  756. * @type {String}
  757. * @default 'htDimmed'
  758. */
  759. readOnlyCellClassName: 'htDimmed',
  760. /**
  761. * @description
  762. * If a string is provided, it may be one of the following predefined values:
  763. * * `autocomplete`,
  764. * * `checkbox`,
  765. * * `html`,
  766. * * `numeric`,
  767. * * `password`.
  768. * * `text`.
  769. *
  770. * Or you can [register](http://docs.handsontable.com/demo-custom-renderers.html) the custom renderer under specified name and use
  771. * its name as an alias in your configuration.
  772. *
  773. * If a function is provided, it will receive the following arguments:
  774. * ```js
  775. * function(instance, TD, row, col, prop, value, cellProperties) {}
  776. * ```
  777. *
  778. * You can read more about custom renderes [in the documentation](http://docs.handsontable.com/demo-custom-renderers.html).
  779. *
  780. * @example
  781. * ```js
  782. * ...
  783. * Handsontable.renderers.registerRenderer('my.renderer', function(instance, TD, row, col, prop, value, cellProperties) {
  784. * TD.innerHTML = value;
  785. * });
  786. * ...
  787. * columns: [
  788. * {
  789. * editor: 'select',
  790. * renderer: 'autocomplete' // as string
  791. * },
  792. * {
  793. * renderer: 'my.renderer' // custom renderer as an alias
  794. * },
  795. * {
  796. * // renderer as custom function
  797. * renderer: function(hotInstance, TD, row, col, prop, value, cellProperties) {
  798. * TD.style.color = 'blue';
  799. * TD.innerHTML = value;
  800. * }
  801. * }
  802. * ]
  803. * ...
  804. * ```
  805. *
  806. * @type {String|Function}
  807. * @default undefined
  808. */
  809. renderer: void 0,
  810. /**
  811. * CSS class name added to the commented cells.
  812. *
  813. * @type {String}
  814. * @default 'htCommentCell'
  815. */
  816. commentedCellClassName: 'htCommentCell',
  817. /**
  818. * If set to `true`, it enables the browser's native selection of a fragment of the text within a single cell, between adjacent cells or in a whole table.
  819. * If set to `'cell'`, it enables the possibility of selecting a fragment of the text within a single cell's body.
  820. *
  821. * @type {Boolean|String}
  822. * @default false
  823. */
  824. fragmentSelection: false,
  825. /**
  826. * @description
  827. * Make cell [read only](http://docs.handsontable.com/demo-read-only.html).
  828. *
  829. * @type {Boolean}
  830. * @default false
  831. */
  832. readOnly: false,
  833. /**
  834. * @description
  835. * When added to a `column` property, it skips the column on paste and pastes the data on the next column to the right.
  836. *
  837. * @type {Boolean}
  838. * @default false
  839. */
  840. skipColumnOnPaste: false,
  841. /**
  842. * @description
  843. * Setting to true enables the search plugin (see [demo](http://docs.handsontable.com/demo-search-for-values.html)).
  844. *
  845. * @type {Boolean}
  846. * @default false
  847. */
  848. search: false,
  849. /**
  850. * @description
  851. * Shortcut to define the combination of the cell renderer, editor and validator for the column, cell or whole table.
  852. *
  853. * Possible values:
  854. * * [autocomplete](http://docs.handsontable.com/demo-autocomplete.html)
  855. * * [checkbox](http://docs.handsontable.com/demo-checkbox.html)
  856. * * [date](http://docs.handsontable.com/demo-date.html)
  857. * * [dropdown](http://docs.handsontable.com/demo-dropdown.html)
  858. * * [handsontable](http://docs.handsontable.com/demo-handsontable.html)
  859. * * [numeric](http://docs.handsontable.com/demo-numeric.html)
  860. * * [password](http://docs.handsontable.com/demo-password.html)
  861. * * text
  862. * * [time](http://docs.handsontable.com/demo-time.html)
  863. *
  864. * Or you can register the custom cell type under specified name and use
  865. * its name as an alias in your configuration.
  866. *
  867. * @example
  868. * ```js
  869. * ...
  870. * Handsontable.cellTypes.registerCellType('my.type', {
  871. * editor: MyEditorClass,
  872. * renderer: function(hot, td, row, col, prop, value, cellProperties) {
  873. * td.innerHTML = value;
  874. * },
  875. * validator: function(value, callback) {
  876. * callback(value === 'foo' ? true : false);
  877. * }
  878. * });
  879. * ...
  880. * columns: [
  881. * {
  882. * type: 'text'
  883. * },
  884. * {
  885. * type: 'my.type' // an alias to custom type
  886. * },
  887. * {
  888. * type: 'checkbox'
  889. * }
  890. * ]
  891. * ...
  892. * ```
  893. *
  894. * @type {String}
  895. * @default 'text'
  896. */
  897. type: 'text',
  898. /**
  899. * @description
  900. * Make cell copyable (pressing <kbd>CTRL</kbd> + <kbd>C</kbd> on your keyboard moves its value to system clipboard).
  901. *
  902. * __Note:__ this setting is `false` by default for cells with type `password`.
  903. *
  904. * @type {Boolean}
  905. * @default true
  906. * @since 0.10.2
  907. */
  908. copyable: true,
  909. /**
  910. * Defines the editor for the table/column/cell.
  911. *
  912. * If a string is provided, it may be one of the following predefined values:
  913. * * [autocomplete](http://docs.handsontable.com/demo-autocomplete.html)
  914. * * [checkbox](http://docs.handsontable.com/demo-checkbox.html)
  915. * * [date](http://docs.handsontable.com/demo-date.html)
  916. * * [dropdown](http://docs.handsontable.com/demo-dropdown.html)
  917. * * [handsontable](http://docs.handsontable.com/demo-handsontable.html)
  918. * * [mobile](http://docs.handsontable.com/demo-mobiles-and-tablets.html)
  919. * * [password](http://docs.handsontable.com/demo-password.html)
  920. * * [select](http://docs.handsontable.com/demo-select.html)
  921. * * text
  922. *
  923. * Or you can [register](http://docs.handsontable.com/tutorial-cell-editor.html#registering-an-editor) the custom editor under specified name and use
  924. * its name as an alias in your configuration.
  925. *
  926. * To disable cell editing completely set `editor` property to `false`.
  927. *
  928. * @example
  929. * ```js
  930. * ...
  931. * columns: [
  932. * {
  933. * editor: 'select'
  934. * },
  935. * {
  936. * editor: false
  937. * }
  938. * ]
  939. * ...
  940. * ```
  941. *
  942. * @type {String|Function|Boolean}
  943. * @default 'text'
  944. */
  945. editor: void 0,
  946. /**
  947. * @description
  948. * Autocomplete definitions. See [autocomplete demo](http://docs.handsontable.com/demo-autocomplete.html) for examples and definitions.
  949. *
  950. * @type {Array}
  951. * @default undefined
  952. */
  953. autoComplete: void 0,
  954. /**
  955. * Control number of choices for the autocomplete (or dropdown) typed cells. After exceeding it, a scrollbar for the dropdown list of choices will appear.
  956. *
  957. * @since 0.18.0
  958. * @type {Number}
  959. * @default 10
  960. */
  961. visibleRows: 10,
  962. /**
  963. * Makes autocomplete or dropdown width the same as the edited cell width. If `false` then editor will be scaled
  964. * according to its content.
  965. *
  966. * @since 0.17.0
  967. * @type {Boolean}
  968. * @default true
  969. */
  970. trimDropdown: true,
  971. /**
  972. * Setting to true enables the debug mode, currently used to test the correctness of the row and column
  973. * header fixed positioning on a layer above the master table.
  974. *
  975. * @type {Boolean}
  976. * @default false
  977. */
  978. debug: false,
  979. /**
  980. * When set to `true`, the text of the cell content is wrapped if it does not fit in the fixed column width.
  981. *
  982. * @type {Boolean}
  983. * @default true
  984. * @since 0.11.0
  985. */
  986. wordWrap: true,
  987. /**
  988. * CSS class name added to cells with cell meta `wordWrap: false`.
  989. *
  990. * @type {String}
  991. * @default 'htNoWrap'
  992. * @since 0.11.0
  993. */
  994. noWordWrapClassName: 'htNoWrap',
  995. /**
  996. * @description
  997. * Defines if the right-click context menu should be enabled. Context menu allows to create new row or
  998. * column at any place in the grid among [other features](http://docs.handsontable.com/demo-context-menu.html).
  999. * Possible values:
  1000. * * `true` (to enable default options),
  1001. * * `false` (to disable completely)
  1002. *
  1003. * or array of any available strings:
  1004. * * `["row_above", "row_below", "col_left", "col_right",
  1005. * "remove_row", "remove_col", "---------", "undo", "redo"]`.
  1006. *
  1007. * See [the context menu demo](http://docs.handsontable.com/demo-context-menu.html) for examples.
  1008. *
  1009. * @example
  1010. * ```js
  1011. * ...
  1012. * // as a boolean
  1013. * contextMenu: true
  1014. * ...
  1015. * // as a array
  1016. * contextMenu: ['row_above', 'row_below', '--------', 'undo', 'redo']
  1017. * ...
  1018. * ```
  1019. *
  1020. * @type {Boolean|Array|Object}
  1021. * @default undefined
  1022. */
  1023. contextMenu: void 0,
  1024. /**
  1025. * @description
  1026. * Defines new actions copy/paste for context menu. This functionality is dependent on ZeroClipboard from which you
  1027. * should pass the swf file path under `swfPath` object key.
  1028. *
  1029. * @example
  1030. * ```js
  1031. * ...
  1032. * contextMenuCopyPaste: {swfPath: '[path to file]'}
  1033. * ...
  1034. * ```
  1035. *
  1036. * @type {Object}
  1037. */
  1038. contextMenuCopyPaste: void 0,
  1039. /**
  1040. * @description
  1041. * Disable or enable the copy/paste functionality.
  1042. *
  1043. * @example
  1044. * ```js
  1045. * ...
  1046. * copyPaste: false,
  1047. * ...
  1048. * ```
  1049. *
  1050. * @type {Boolean}
  1051. * @default undefined
  1052. */
  1053. copyPaste: void 0,
  1054. /**
  1055. * If `true`, undo/redo functionality is enabled.
  1056. *
  1057. * @type {Boolean}
  1058. * @default undefined
  1059. */
  1060. undo: void 0,
  1061. /**
  1062. * @description
  1063. * Turns on [Column sorting](http://docs.handsontable.com/demo-sorting-data.html).
  1064. * Can be either a boolean (true/false) or an object with a declared sorting options. See the below example:
  1065. *
  1066. * @example
  1067. * ```js
  1068. * ...
  1069. * // as boolean
  1070. * columnSorting: true
  1071. * ...
  1072. * // as a object with initial order (sort ascending column at index 2)
  1073. * columnSorting: {
  1074. * column: 2,
  1075. * sortOrder: true, // true = ascending, false = descending, undefined = original order
  1076. * sortEmptyCells: true // true = the table sorts empty cells, false = the table moves all empty cells to the end of the table
  1077. * }
  1078. * ...
  1079. * ```
  1080. *
  1081. * @type {Boolean|Object}
  1082. * @default undefined
  1083. */
  1084. columnSorting: void 0,
  1085. /**
  1086. * @description
  1087. * Turns on [Manual column move](http://docs.handsontable.com/demo-moving-rows-and-columns.html), if set to a boolean or define initial
  1088. * column order, if set to an array of column indexes.
  1089. *
  1090. * @example
  1091. * ```js
  1092. * ...
  1093. * // as boolean
  1094. * manualColumnMove: true
  1095. * ...
  1096. * // as a array with initial order (move column index at 0 to 1 and move column index at 1 to 4)
  1097. * manualColumnMove: [1, 4]
  1098. * ...
  1099. * ```
  1100. *
  1101. * @type {Boolean|Array}
  1102. * @default undefined
  1103. */
  1104. manualColumnMove: void 0,
  1105. /**
  1106. * @description
  1107. * Turns on [Manual column resize](http://docs.handsontable.com/demo-resizing.html), if set to a boolean or define initial
  1108. * column resized widths, if set to an array of numbers.
  1109. *
  1110. * @example
  1111. * ```js
  1112. * ...
  1113. * // as boolean
  1114. * manualColumnResize: true
  1115. * ...
  1116. * // as a array with initial widths (column at 0 index has 40px and column at 1 index has 50px)
  1117. * manualColumnResize: [40, 50]
  1118. * ...
  1119. * ```
  1120. *
  1121. * @type {Boolean|Array}
  1122. * @default undefined
  1123. */
  1124. manualColumnResize: void 0,
  1125. /**
  1126. * @description
  1127. * Turns on [Manual row move](http://docs.handsontable.com/demo-moving-rows-and-columns.html), if set to a boolean or define initial
  1128. * row order, if set to an array of row indexes.
  1129. *
  1130. * @example
  1131. * ```js
  1132. * ...
  1133. * // as boolean
  1134. * manualRowMove: true
  1135. * ...
  1136. * // as a array with initial order (move row index at 0 to 1 and move row index at 1 to 4)
  1137. * manualRowMove: [1, 4]
  1138. * ...
  1139. * ```
  1140. *
  1141. * @type {Boolean|Array}
  1142. * @default undefined
  1143. * @since 0.11.0
  1144. */
  1145. manualRowMove: void 0,
  1146. /**
  1147. * @description
  1148. * Turns on [Manual row resize](http://docs.handsontable.com/demo-resizing.html), if set to a boolean or define initial
  1149. * row resized heights, if set to an array of numbers.
  1150. *
  1151. * @example
  1152. * ```js
  1153. * ...
  1154. * // as boolean
  1155. * manualRowResize: true
  1156. * ...
  1157. * // as a array with initial heights (row at 0 index has 40px and row at 1 index has 50px)
  1158. * manualRowResize: [40, 50]
  1159. * ...
  1160. * ```
  1161. *
  1162. * @type {Boolean|Array}
  1163. * @default undefined
  1164. * @since 0.11.0
  1165. */
  1166. manualRowResize: void 0,
  1167. /**
  1168. * @description
  1169. * If set to `true`, it enables a possibility to merge cells. If set to an array of objects, it merges the cells provided in the objects (see the example below).
  1170. * [More information on the demo page.](http://docs.handsontable.com/demo-merge-cells.html)
  1171. *
  1172. * @example
  1173. * ```js
  1174. * // enables the mergeCells plugin:
  1175. * margeCells: true
  1176. * ...
  1177. * // declares a list of merged sections:
  1178. * mergeCells: [
  1179. * {row: 1, col: 1, rowspan: 3, colspan: 3}, // rowspan and colspan properties declare the width and height of a merged section in cells
  1180. * {row: 3, col: 4, rowspan: 2, colspan: 2},
  1181. * {row: 5, col: 6, rowspan: 3, colspan: 3}
  1182. * ]
  1183. * ```
  1184. * @type {Boolean|Array}
  1185. * @default false
  1186. */
  1187. mergeCells: false,
  1188. /**
  1189. * Number of rows to be rendered outside of the visible part of the table.
  1190. * By default, it's set to `'auto'`, which makes Handsontable to attempt to calculate the best offset performance-wise.
  1191. *
  1192. * You may test out different values to find the best one that works for your specific implementation.
  1193. *
  1194. * @type {Number|String}
  1195. * @default 'auto'
  1196. */
  1197. viewportRowRenderingOffset: 'auto',
  1198. /**
  1199. * Number of columns to be rendered outside of the visible part of the table.
  1200. * By default, it's set to `'auto'`, which makes Handsontable try calculating the best offset performance-wise.
  1201. *
  1202. * You may experiment with the value to find the one that works best for your specific implementation.
  1203. *
  1204. * @type {Number|String}
  1205. * @default 'auto'
  1206. */
  1207. viewportColumnRenderingOffset: 'auto',
  1208. /**
  1209. * A function, regular expression or a string, which will be used in the process of cell validation.
  1210. * If a function is used, be sure to execute the callback argument with either `true` (`callback(true)`) if the validation passed
  1211. * or with `false` (`callback(false)`), if the validation failed.
  1212. * Note, that `this` in the function points to the `cellProperties` object.
  1213. *
  1214. * If a string is provided, it may be one of the following predefined values:
  1215. * * `autocomplete`,
  1216. * * `date`,
  1217. * * `numeric`,
  1218. * * `time`.
  1219. *
  1220. * Or you can [register](http://docs.handsontable.com/demo-data-validation.html) the validator function under specified name and use
  1221. * its name as an alias in your configuration.
  1222. *
  1223. * See more [in the demo](http://docs.handsontable.com/demo-data-validation.html).
  1224. *
  1225. * @example
  1226. * ```js
  1227. * // as a function
  1228. * columns: [
  1229. * {
  1230. * validator: function(value, callback) { // validation rules }
  1231. * }
  1232. * ]
  1233. * ...
  1234. * // as a regexp
  1235. * columns: [
  1236. * {
  1237. * validator: /^[0-9]$/ // regular expression
  1238. * }
  1239. * ]
  1240. * // as a string
  1241. * columns: [
  1242. * {
  1243. * validator: 'numeric'
  1244. * }
  1245. * ]
  1246. * ```
  1247. * @type {Function|RegExp|String}
  1248. * @default undefined
  1249. * @since 0.9.5
  1250. */
  1251. validator: void 0,
  1252. /**
  1253. * @description
  1254. * Disable visual cells selection.
  1255. *
  1256. * Possible values:
  1257. * * `true` - Disables any type of visual selection (current and area selection),
  1258. * * `false` - Enables any type of visual selection. This is default value.
  1259. * * `current` - Disables the selection of a currently selected cell, the area selection is still present.
  1260. * * `area` - Disables the area selection, the currently selected cell selection is still present.
  1261. *
  1262. * @type {Boolean|String|Array}
  1263. * @default false
  1264. * @since 0.13.2
  1265. * @example
  1266. * ```js
  1267. * ...
  1268. * // as boolean
  1269. * disableVisualSelection: true,
  1270. * ...
  1271. *
  1272. * ...
  1273. * // as string ('current' or 'area')
  1274. * disableVisualSelection: 'current',
  1275. * ...
  1276. *
  1277. * ...
  1278. * // as array
  1279. * disableVisualSelection: ['current', 'area'],
  1280. * ...
  1281. * ```
  1282. */
  1283. disableVisualSelection: false,
  1284. /**
  1285. * @description
  1286. * Set whether to display the current sorting order indicator (a triangle icon in the column header, specifying the sorting order).
  1287. *
  1288. * @type {Boolean}
  1289. * @default false
  1290. * @since 0.15.0-beta3
  1291. */
  1292. sortIndicator: void 0,
  1293. /**
  1294. * Disable or enable ManualColumnFreeze plugin.
  1295. *
  1296. * @type {Boolean}
  1297. * @default false
  1298. */
  1299. manualColumnFreeze: void 0,
  1300. /**
  1301. * @description
  1302. * Defines whether Handsontable should trim the whitespace at the beginning and the end of the cell contents.
  1303. *
  1304. * @type {Boolean}
  1305. * @default true
  1306. */
  1307. trimWhitespace: true,
  1308. settings: void 0,
  1309. /**
  1310. * @description
  1311. * Defines data source for Autocomplete or Dropdown cell types.
  1312. *
  1313. * @example
  1314. * ```js
  1315. * ...
  1316. * // source as a array
  1317. * columns: [{
  1318. * type: 'autocomplete',
  1319. * source: ['A', 'B', 'C', 'D']
  1320. * }]
  1321. * ...
  1322. * // source as a function
  1323. * columns: [{
  1324. * type: 'autocomplete',
  1325. * source: function(query, callback) {
  1326. * fetch('http://example.com/query?q=' + query, function(response) {
  1327. * callback(response.items);
  1328. * })
  1329. * }
  1330. * }]
  1331. * ...
  1332. * ```
  1333. *
  1334. * @type {Array|Function}
  1335. * @default undefined
  1336. */
  1337. source: void 0,
  1338. /**
  1339. * @description
  1340. * Defines the column header name.
  1341. *
  1342. * @example
  1343. * ```js
  1344. * ...
  1345. * columns: [{
  1346. * title: 'First name',
  1347. * type: 'text',
  1348. * },
  1349. * {
  1350. * title: 'Last name',
  1351. * type: 'text',
  1352. * }]
  1353. * ...
  1354. * ```
  1355. *
  1356. * @type {String}
  1357. * @default undefined
  1358. */
  1359. title: void 0,
  1360. /**
  1361. * Data template for `'checkbox'` type when checkbox is checked.
  1362. *
  1363. * @example
  1364. * ```js
  1365. * checkedTemplate: 'good'
  1366. *
  1367. * // if a checkbox-typed cell is checked, then getDataAtCell(x,y), where x and y are the coordinates of the cell
  1368. * // will return 'good'.
  1369. * ```
  1370. * @type {Boolean|String}
  1371. * @default true
  1372. */
  1373. checkedTemplate: void 0,
  1374. /**
  1375. * Data template for `'checkbox'` type when checkbox is unchecked.
  1376. *
  1377. * @example
  1378. * ```js
  1379. * uncheckedTemplate: 'bad'
  1380. *
  1381. * // if a checkbox-typed cell is not checked, then getDataAtCell(x,y), where x and y are the coordinates of the cell
  1382. * // will return 'bad'.
  1383. * ```
  1384. * @type {Boolean|String}
  1385. * @default false
  1386. */
  1387. uncheckedTemplate: void 0,
  1388. /**
  1389. * @description
  1390. * Object which describes if renderer should create checkbox element with label element as a parent. Option desired for
  1391. * [checkbox](http://docs.handsontable.com/demo-checkbox.html)-typed cells.
  1392. *
  1393. * By default the [checkbox](http://docs.handsontable.com/demo-checkbox.html) renderer renders the checkbox without a label.
  1394. *
  1395. * Possible object properties:
  1396. * * `property` - Defines the property name of the data object, which will to be used as a label.
  1397. * (eg. `label: {property: 'name.last'}`). This option works only if data was passed as an array of objects.
  1398. * * `position` - String which describes where to place the label text (before or after checkbox element).
  1399. * Valid values are `'before'` and '`after`' (defaults to `'after'`).
  1400. * * `value` - String or a Function which will be used as label text.
  1401. *
  1402. * @example
  1403. * ```js
  1404. * ...
  1405. * columns: [{
  1406. * type: 'checkbox',
  1407. * label: {position: 'after', value: 'My label: '}
  1408. * }]
  1409. * ...
  1410. * ```
  1411. *
  1412. * @since 0.19.0
  1413. * @type {Object}
  1414. * @default undefined
  1415. */
  1416. label: void 0,
  1417. /**
  1418. * Display format. See [numbrojs](http://numbrojs.com). This option is desired for
  1419. * [numeric](http://docs.handsontable.com/demo-numeric.html)-typed cells.
  1420. *
  1421. * Since 0.26.0 Handsontable uses [numbro](http://numbrojs.com/) as a main library for numbers formatting.
  1422. *
  1423. * @example
  1424. * ```js
  1425. * ...
  1426. * columns: [{
  1427. * type: 'numeric',
  1428. * format: '0,00'
  1429. * }]
  1430. * ...
  1431. * ```
  1432. *
  1433. * @type {String}
  1434. * @default '0'
  1435. */
  1436. format: void 0,
  1437. /**
  1438. * Language display format. See [numbrojs](http://numbrojs.com/languages.html#supported-languages). This option is desired for
  1439. * [numeric](http://docs.handsontable.com/demo-numeric.html)-typed cells.
  1440. *
  1441. * Since 0.26.0 Handsontable uses [numbro](http://numbrojs.com/) as a main library for numbers formatting.
  1442. *
  1443. * @example
  1444. * ```js
  1445. * ...
  1446. * columns: [{
  1447. * type: 'numeric',
  1448. * language: 'en-US'
  1449. * }]
  1450. * ...
  1451. * ```
  1452. *
  1453. * @type {String}
  1454. * @default 'en-US'
  1455. */
  1456. language: void 0,
  1457. /**
  1458. * @description
  1459. * Data source for [select](http://docs.handsontable.com/demo-select.html)-typed cells.
  1460. *
  1461. * @example
  1462. * ```js
  1463. * ...
  1464. * columns: [{
  1465. * editor: 'select',
  1466. * selectOptions: ['A', 'B', 'C'],
  1467. * }]
  1468. * ...
  1469. * ```
  1470. *
  1471. * @type {Array}
  1472. */
  1473. selectOptions: void 0,
  1474. /**
  1475. * Enables or disables the autoColumnSize plugin. Default value is `undefined`, which has the same effect as `true`.
  1476. * Disabling this plugin can increase performance, as no size-related calculations would be done.
  1477. *
  1478. * Column width calculations are divided into sync and async part. Each of this parts has their own advantages and
  1479. * disadvantages. Synchronous calculations are faster but they block the browser UI, while the slower asynchronous operations don't
  1480. * block the browser UI.
  1481. *
  1482. * To configure the sync/async distribution, you can pass an absolute value (number of columns) or a percentage value.
  1483. * `syncLimit` option is available since 0.16.0.
  1484. *
  1485. * You can also use the `useHeaders` option to take the column headers with into calculation.
  1486. *
  1487. * @example
  1488. * ```js
  1489. * ...
  1490. * // as a number (300 columns in sync, rest async)
  1491. * autoColumnSize: {syncLimit: 300},
  1492. * ...
  1493. *
  1494. * ...
  1495. * // as a string (percent)
  1496. * autoColumnSize: {syncLimit: '40%'},
  1497. * ...
  1498. *
  1499. * ...
  1500. * // use headers width while calculation the column width
  1501. * autoColumnSize: {useHeaders: true},
  1502. * ...
  1503. *
  1504. * ```
  1505. *
  1506. * @type {Object|Boolean}
  1507. * @default {syncLimit: 50}
  1508. */
  1509. autoColumnSize: void 0,
  1510. /**
  1511. * Enables or disables autoRowSize plugin. Default value is `undefined`, which has the same effect as `false` (disabled).
  1512. * Enabling this plugin can decrease performance, as size-related calculations would be performed.
  1513. *
  1514. * Row height calculations are divided into sync and async stages. Each of these stages has their own advantages and
  1515. * disadvantages. Synchronous calculations are faster but they block the browser UI, while the slower asynchronous operations don't
  1516. * block the browser UI.
  1517. *
  1518. * To configure the sync/async distribution, you can pass an absolute value (number of columns) or a percentage value.
  1519. * `syncLimit` options is available since 0.16.0.
  1520. *
  1521. * @example
  1522. * ```js
  1523. * ...
  1524. * // as number (300 columns in sync, rest async)
  1525. * autoRowSize: {syncLimit: 300},
  1526. * ...
  1527. *
  1528. * ...
  1529. * // as string (percent)
  1530. * autoRowSize: {syncLimit: '40%'},
  1531. * ...
  1532. * ```
  1533. * @type {Object|Boolean}
  1534. * @default {syncLimit: 1000}
  1535. */
  1536. autoRowSize: void 0,
  1537. /**
  1538. * Date validation format.
  1539. *
  1540. * Option desired for `'date'` - typed cells.
  1541. *
  1542. * @example
  1543. * ```js
  1544. * ...
  1545. * columns: [{
  1546. * type: 'date',
  1547. * dateFormat: 'MM/DD/YYYY'
  1548. * }]
  1549. * ...
  1550. * ```
  1551. *
  1552. * @type {String}
  1553. * @default 'DD/MM/YYYY'
  1554. */
  1555. dateFormat: void 0,
  1556. /**
  1557. * If `true` then dates will be automatically formatted to match the desired format.
  1558. *
  1559. * Option desired for `'date'`-typed typed cells.
  1560. *
  1561. * @example
  1562. * ```js
  1563. * ...
  1564. * columns: [{
  1565. * type: 'date',
  1566. * dateFormat: 'YYYY-MM-DD',
  1567. * correctFormat: true
  1568. * }]
  1569. * ...
  1570. * ```
  1571. *
  1572. * @type {Boolean}
  1573. * @default false
  1574. */
  1575. correctFormat: false,
  1576. /**
  1577. * Definition of default value which will fill the empty cells.
  1578. *
  1579. * Option desired for `'date'`-typed cells.
  1580. *
  1581. * @example
  1582. * ```js
  1583. * ...
  1584. * columns: [{
  1585. * type: 'date',
  1586. * defaultData: '2015-02-02'
  1587. * }]
  1588. * ...
  1589. * ```
  1590. *
  1591. * @type {String}
  1592. */
  1593. defaultDate: void 0,
  1594. /**
  1595. * If set to `true`, the value entered into the cell must match (case-sensitive) the autocomplete source. Otherwise, cell won't pass the validation.
  1596. * When filtering the autocomplete source list, the editor will be working in case-insensitive mode.
  1597. *
  1598. * Option desired for `autocomplete`-typed cells.
  1599. *
  1600. * @example
  1601. * ```js
  1602. * ...
  1603. * columns: [{
  1604. * type: 'autocomplete',
  1605. * source: ['A', 'B', 'C'],
  1606. * strict: true
  1607. * }]
  1608. * ...
  1609. * ```
  1610. *
  1611. * @type {Boolean}
  1612. */
  1613. strict: void 0,
  1614. /**
  1615. * @description
  1616. * If typed `true`, data defined in `source` of the autocomplete or dropdown cell will be treated as HTML.
  1617. *
  1618. * __Warning:__ Enabling this option can cause serious XSS vulnerabilities.
  1619. *
  1620. * Option desired for `'autocomplete'`-typed cells.
  1621. * @example
  1622. * ```js
  1623. * ...
  1624. * columns: [{
  1625. * type: 'autocomplete',
  1626. * allowHtml: true,
  1627. * source: ['<b>foo</b>', '<b>bar</b>']
  1628. * }]
  1629. * ...
  1630. * ```
  1631. * @type {Boolean}
  1632. * @default false
  1633. */
  1634. allowHtml: false,
  1635. /**
  1636. * If typed `true` then virtual rendering mechanism for handsontable will be disabled.
  1637. *
  1638. * @type {Boolean}
  1639. */
  1640. renderAllRows: void 0,
  1641. /**
  1642. * Prevents table to overlap outside the parent element. If `'horizontal'` option is chosen then table will appear horizontal
  1643. * scrollbar in case where parent's width is narrower then table's width.
  1644. *
  1645. * Possible values:
  1646. * * `false` - Disables functionality (Default option).
  1647. * * `horizontal` - Prevents horizontal overflow table.
  1648. * * `vertical` - Prevents vertical overflow table (Not implemented yet).
  1649. *
  1650. * @since 0.20.3
  1651. * @example
  1652. * ```js
  1653. * ...
  1654. * preventOverflow: 'horizontal'
  1655. * ...
  1656. * ```
  1657. *
  1658. * @type {String|Boolean}
  1659. */
  1660. preventOverflow: false,
  1661. /**
  1662. * @description
  1663. * Plugin allowing binding the table rows with their headers.
  1664. * If the plugin is enabled, the table row headers will "stick" to the rows, when they are hidden/moved. Basically, if at the initialization
  1665. * row 0 has a header titled "A", it will have it no matter what you do with the table.
  1666. *
  1667. * @pro
  1668. * @since 1.0.0-beta1
  1669. * @type {Boolean|String}
  1670. * @example
  1671. *
  1672. * ```js
  1673. * ...
  1674. * var hot = new Handsontable(document.getElementById('example'), {
  1675. * date: getData(),
  1676. * bindRowsWithHeaders: true
  1677. * });
  1678. * ...
  1679. * ```
  1680. *
  1681. */
  1682. bindRowsWithHeaders: void 0,
  1683. /**
  1684. * @description
  1685. * The CollapsibleColumns plugin allows collapsing of columns, covered by a header with the `colspan` property defined.
  1686. *
  1687. * Clicking the "collapse/expand" button collapses (or expands) all "child" headers except the first one.
  1688. *
  1689. * Setting the `collapsibleColumns` property to `true` will display a "collapse/expand" button in every header with a defined
  1690. * `colspan` property.
  1691. *
  1692. * To limit this functionality to a smaller group of headers, define the `collapsibleColumns` property as an array of objects, as in
  1693. * the example below.
  1694. *
  1695. * @pro
  1696. * @since 1.0.0-beta1
  1697. * @type {Boolean|Array}
  1698. * @example
  1699. * ```js
  1700. * ...
  1701. * collapsibleColumns: [
  1702. * {row: -4, col: 1, collapsible: true},
  1703. * {row: -3, col: 5, collapsible: true}
  1704. * ]
  1705. * ...
  1706. * // or
  1707. * ...
  1708. * collapsibleColumns: true
  1709. * ...
  1710. * ```
  1711. */
  1712. collapsibleColumns: void 0,
  1713. /**
  1714. * @description
  1715. * Allows making pre-defined calculations on the cell values and display the results within Handsontable.
  1716. * See the demo for more information.
  1717. *
  1718. * @pro
  1719. * @since 1.0.0-beta1
  1720. * @type {Object}
  1721. */
  1722. columnSummary: void 0,
  1723. /**
  1724. * This plugin allows adding a configurable dropdown menu to the table's column headers.
  1725. * The dropdown menu acts like the Context Menu, but is triggered by clicking the button in the header.
  1726. *
  1727. * @pro
  1728. * @since 1.0.0-beta1
  1729. * @type {Boolean|Object|Array}
  1730. */
  1731. dropdownMenu: void 0,
  1732. /**
  1733. * The filters plugin.
  1734. * It allows filtering the table data either by the built-in component or with the API.
  1735. *
  1736. * @pro
  1737. * @since 1.0.0-beta1
  1738. * @type {Boolean}
  1739. */
  1740. filters: void 0,
  1741. /**
  1742. * It allows Handsontable to process formula expressions defined in the provided data.
  1743. *
  1744. * @pro
  1745. * @since 1.7.0
  1746. * @type {Boolean}
  1747. */
  1748. formulas: void 0,
  1749. /**
  1750. * @description
  1751. * GanttChart plugin enables a possibility to create a Gantt chart using a Handsontable instance.
  1752. * In this case, the whole table becomes read-only.
  1753. *
  1754. * @pro
  1755. * @since 1.0.0-beta1
  1756. * @type {Object}
  1757. */
  1758. ganttChart: void 0,
  1759. /**
  1760. * @description
  1761. * Allows adding a tooltip to the table headers.
  1762. *
  1763. * Available options:
  1764. * * the `rows` property defines if tooltips should be added to row headers,
  1765. * * the `columns` property defines if tooltips should be added to column headers,
  1766. * * the `onlyTrimmed` property defines if tooltips should be added only to headers, which content is trimmed by the header itself (the content being wider then the header).
  1767. *
  1768. * @pro
  1769. * @since 1.0.0-beta1
  1770. * @type {Boolean|Object}
  1771. */
  1772. headerTooltips: void 0,
  1773. /**
  1774. * Plugin allowing hiding of certain columns.
  1775. *
  1776. * @pro
  1777. * @since 1.0.0-beta1
  1778. * @type {Boolean|Object}
  1779. */
  1780. hiddenColumns: void 0,
  1781. /**
  1782. * @description
  1783. * Plugin allowing hiding of certain rows.
  1784. *
  1785. * @pro
  1786. * @since 1.0.0-beta1
  1787. * @type {Boolean|Object}
  1788. */
  1789. hiddenRows: void 0,
  1790. /**
  1791. * @description
  1792. * Allows creating a nested header structure, using the HTML's colspan attribute.
  1793. *
  1794. * @pro
  1795. * @since 1.0.0-beta1
  1796. * @type {Array}
  1797. */
  1798. nestedHeaders: void 0,
  1799. /**
  1800. * @description
  1801. * Plugin allowing hiding of certain rows.
  1802. *
  1803. * @pro
  1804. * @since 1.0.0-beta1
  1805. * @type {Boolean|Array}
  1806. */
  1807. trimRows: void 0,
  1808. /**
  1809. * @description
  1810. * Allows setting a custom width of the row headers. You can provide a number or an array of widths, if many row header levels are defined.
  1811. *
  1812. * @since 0.22.0
  1813. * @type {Number|Array}
  1814. */
  1815. rowHeaderWidth: void 0,
  1816. /**
  1817. * @description
  1818. * Allows setting a custom height of the column headers. You can provide a number or an array of heights, if many column header levels are defined.
  1819. *
  1820. * @since 0.22.0
  1821. * @type {Number|Array}
  1822. */
  1823. columnHeaderHeight: void 0,
  1824. /**
  1825. * @description
  1826. * Enabling this plugin switches table into one-way data binding where changes are applied into data source (from outside table)
  1827. * will be automatically reflected in the table.
  1828. *
  1829. * For every data change [afterChangesObserved](Hooks.html#event:afterChangesObserved) hook will be fired.
  1830. *
  1831. * @type {Boolean}
  1832. * @default false
  1833. */
  1834. observeChanges: void 0,
  1835. /**
  1836. * @description
  1837. * When passed to the `column` property, allows specifying a custom sorting function for the desired column.
  1838. *
  1839. * @since 0.24.0
  1840. * @type {Function}
  1841. * @example
  1842. * ```js
  1843. * columns: [
  1844. * {
  1845. * sortFunction: function(sortOrder) {
  1846. * return function(a, b) {
  1847. * // sorting function body.
  1848. * //
  1849. * // Function parameters:
  1850. * // sortOrder: If true, the order is ascending, if false - descending. undefined = original order
  1851. * // a, b: Two compared elements. These are 2-element arrays, with the first element being the row index, the second - cell value.
  1852. * }
  1853. * }
  1854. * }
  1855. * ]
  1856. * ```
  1857. */
  1858. sortFunction: void 0,
  1859. /**
  1860. * If defined as 'true', the Autocomplete's suggestion list would be sorted by relevance (the closer to the left the match is, the higher the suggestion).
  1861. *
  1862. * Option desired for cells of the `'autocomplete'` type.
  1863. *
  1864. * @type {Boolean}
  1865. * @default true
  1866. */
  1867. sortByRelevance: true,
  1868. /**
  1869. * If defined as 'true', when the user types into the input area the Autocomplete's suggestion list is updated to only
  1870. * include those choices starting with what has been typed; if defined as 'false' all suggestions remain shown, with
  1871. * those matching what has been typed marked in bold.
  1872. *
  1873. * @type {Boolean}
  1874. * @default true
  1875. */
  1876. filter: true,
  1877. /**
  1878. * If defined as 'true', filtering in the Autocomplete Editor will be case-sensitive.
  1879. *
  1880. * @type {Boolean}
  1881. * @default: false
  1882. */
  1883. filteringCaseSensitive: false
  1884. };
  1885. exports.default = DefaultSettings;