vue2-excel-grid 2.8.9 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-excel-grid",
3
- "version": "2.8.9",
3
+ "version": "2.9.0",
4
4
  "description": "Excel-style grid component for Vue 2.6.14 with virtual scrolling",
5
5
  "license": "MIT",
6
6
  "author": "Fozilbek Raimberdiyev",
@@ -244,8 +244,8 @@
244
244
  class="eg-header-cell"
245
245
  :class="[
246
246
  { 'eg-header-group': cell.isGroup, 'eg-header-cell--drag-source': colDrag.active && cell._firstLeafFlatIndex >= colDrag.sourceFirstLeaf && cell._firstLeafFlatIndex < colDrag.sourceFirstLeaf + colDrag.sourceLeafCount },
247
- cell.column && cell.column.overflowTitle === 'truncate' ? 'eg-header-cell--truncate' : '',
248
- cell.column && cell.column.overflowTitle === 'wrap' ? 'eg-header-cell--wrap' : ''
247
+ cell.column && (cell.column.overflowTitle || overflowTitle) === 'truncate' ? 'eg-header-cell--truncate' : '',
248
+ cell.column && (cell.column.overflowTitle || overflowTitle) === 'wrap' ? 'eg-header-cell--wrap' : ''
249
249
  ]"
250
250
  :data-fi="!cell.isGroup ? cell.column._flatIndex : undefined"
251
251
  :data-start="cell.isGroup ? cell._firstLeafFlatIndex : undefined"
@@ -254,7 +254,7 @@
254
254
  @mousedown="onColHeaderMouseDown($event, cell)"
255
255
  @dblclick="onColHeaderDblClick($event, cell)"
256
256
  @contextmenu.prevent="onColHeaderContextMenu($event, cell)"
257
- @mouseenter="cell.column && cell.column.overflowTitle === 'truncate' ? _showTooltip(cell.column.title, $event.currentTarget) : null"
257
+ @mouseenter="cell.column && (cell.column.overflowTitle || overflowTitle) === 'truncate' ? _showTooltip(cell.column.title, $event.currentTarget) : null"
258
258
  @mouseleave="_hideTooltip"
259
259
  >
260
260
  <span class="eg-header-title">
@@ -342,8 +342,8 @@
342
342
  class="eg-header-cell"
343
343
  :class="[
344
344
  { 'eg-header-group': cell.isGroup, 'eg-header-cell--drag-source': colDrag.active && cell._firstLeafFlatIndex >= colDrag.sourceFirstLeaf && cell._firstLeafFlatIndex < colDrag.sourceFirstLeaf + colDrag.sourceLeafCount },
345
- cell.column && cell.column.overflowTitle === 'truncate' ? 'eg-header-cell--truncate' : '',
346
- cell.column && cell.column.overflowTitle === 'wrap' ? 'eg-header-cell--wrap' : ''
345
+ cell.column && (cell.column.overflowTitle || overflowTitle) === 'truncate' ? 'eg-header-cell--truncate' : '',
346
+ cell.column && (cell.column.overflowTitle || overflowTitle) === 'wrap' ? 'eg-header-cell--wrap' : ''
347
347
  ]"
348
348
  :data-fi="!cell.isGroup ? cell.column._flatIndex : undefined"
349
349
  :data-start="cell.isGroup ? cell._firstLeafFlatIndex : undefined"
@@ -352,7 +352,7 @@
352
352
  @mousedown="onColHeaderMouseDown($event, cell)"
353
353
  @dblclick="onColHeaderDblClick($event, cell)"
354
354
  @contextmenu.prevent="onColHeaderContextMenu($event, cell)"
355
- @mouseenter="cell.column && cell.column.overflowTitle === 'truncate' ? _showTooltip(cell.column.title, $event.currentTarget) : null"
355
+ @mouseenter="cell.column && (cell.column.overflowTitle || overflowTitle) === 'truncate' ? _showTooltip(cell.column.title, $event.currentTarget) : null"
356
356
  @mouseleave="_hideTooltip"
357
357
  >
358
358
  <span class="eg-header-title">
@@ -437,8 +437,8 @@
437
437
  class="eg-header-cell"
438
438
  :class="[
439
439
  { 'eg-header-group': cell.isGroup, 'eg-header-cell--drag-source': colDrag.active && cell._firstLeafFlatIndex >= colDrag.sourceFirstLeaf && cell._firstLeafFlatIndex < colDrag.sourceFirstLeaf + colDrag.sourceLeafCount },
440
- cell.column && cell.column.overflowTitle === 'truncate' ? 'eg-header-cell--truncate' : '',
441
- cell.column && cell.column.overflowTitle === 'wrap' ? 'eg-header-cell--wrap' : ''
440
+ cell.column && (cell.column.overflowTitle || overflowTitle) === 'truncate' ? 'eg-header-cell--truncate' : '',
441
+ cell.column && (cell.column.overflowTitle || overflowTitle) === 'wrap' ? 'eg-header-cell--wrap' : ''
442
442
  ]"
443
443
  :data-fi="!cell.isGroup ? cell.column._flatIndex : undefined"
444
444
  :data-start="cell.isGroup ? cell._firstLeafFlatIndex : undefined"
@@ -447,7 +447,7 @@
447
447
  @mousedown="onColHeaderMouseDown($event, cell)"
448
448
  @dblclick="onColHeaderDblClick($event, cell)"
449
449
  @contextmenu.prevent="onColHeaderContextMenu($event, cell)"
450
- @mouseenter="cell.column && cell.column.overflowTitle === 'truncate' ? _showTooltip(cell.column.title, $event.currentTarget) : null"
450
+ @mouseenter="cell.column && (cell.column.overflowTitle || overflowTitle) === 'truncate' ? _showTooltip(cell.column.title, $event.currentTarget) : null"
451
451
  @mouseleave="_hideTooltip"
452
452
  >
453
453
  <span class="eg-header-title">
@@ -1072,6 +1072,19 @@ const ExcelGridComponent = {
1072
1072
  /** Array of row objects keyed by columns[].key */
1073
1073
  data: { type: Array, default: () => [] },
1074
1074
 
1075
+ /**
1076
+ * Sarlavhalardagi matn sig'may qolganda uning qanday harakatlanishini belgilaydi
1077
+ * (barcha ustunlar uchun umumiy qoida). Ustun (column) sozlamalarida
1078
+ * xuddi shu nomli xususiyat mavjud bo'lsa, ustun sozlamasi inobatga olinadi.
1079
+ * @type {String}
1080
+ * @default 'no-overflow'
1081
+ */
1082
+ overflowTitle: {
1083
+ type: String,
1084
+ default: 'no-overflow',
1085
+ validator: v => ['no-overflow', 'truncate', 'wrap'].includes(v)
1086
+ },
1087
+
1075
1088
  /**
1076
1089
  * Column definitions (may be nested via children[]).
1077
1090
  *
@@ -2842,7 +2855,7 @@ const ExcelGridComponent = {
2842
2855
  },
2843
2856
  _calcHeaderHeight() {
2844
2857
  if (!this.leafCols) return
2845
- const wrapCols = this.leafCols.filter(c => c.overflowTitle === 'wrap')
2858
+ const wrapCols = this.leafCols.filter(c => (c.overflowTitle || this.overflowTitle) === 'wrap')
2846
2859
  if (wrapCols.length === 0) {
2847
2860
  if (this.calculatedHeaderHeight !== null) this.calculatedHeaderHeight = null
2848
2861
  return
package/src/index.js CHANGED
@@ -8,7 +8,19 @@ export { ExcelGrid, EgCheckbox, EgSelect, EgTreeSelect, version }
8
8
 
9
9
  export default {
10
10
  version,
11
- install(Vue) {
11
+ install(Vue, options = {}) {
12
+ if (options && typeof options === 'object') {
13
+ Object.keys(options).forEach(key => {
14
+ if (ExcelGrid.props && ExcelGrid.props[key] !== undefined) {
15
+ const val = options[key]
16
+ if (typeof ExcelGrid.props[key] !== 'object') {
17
+ // Convert to object notation if it was just a constructor like `props: { fitColumns: Boolean }`
18
+ ExcelGrid.props[key] = { type: ExcelGrid.props[key] }
19
+ }
20
+ ExcelGrid.props[key].default = (val !== null && typeof val === 'object') ? () => val : val
21
+ }
22
+ })
23
+ }
12
24
  Vue.component('Vue2ExcelGrid', ExcelGrid)
13
25
  Vue.component('Vue2EgCheckbox', EgCheckbox)
14
26
  Vue.component('Vue2EgSelect', EgSelect)