defaultSettings.js 54 KB

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