62 lines
1.8 KiB
JavaScript
62 lines
1.8 KiB
JavaScript
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
var _object = require("../../../helpers/object");
|
|
var _utils = require("../utils");
|
|
/**
|
|
* The table meta object is a layer that keeps all settings of the Handsontable that was passed in
|
|
* the constructor. That layer contains all default settings inherited from the GlobalMeta layer
|
|
* merged with settings passed by the developer. Adding, removing, or changing property in that
|
|
* object has no direct reflection on any other layers.
|
|
*
|
|
* +-------------+.
|
|
* │ GlobalMeta │
|
|
* │ (prototype) │
|
|
* +-------------+\
|
|
* │ \
|
|
* │ \
|
|
* \│/ _\|
|
|
* +-------------+ +-------------+.
|
|
* │ TableMeta │ │ ColumnMeta │
|
|
* │ (instance) │ │ (prototype) │
|
|
* +-------------+ +-------------+.
|
|
* │
|
|
* │
|
|
* \│/
|
|
* +-------------+.
|
|
* │ CellMeta │
|
|
* │ (instance) │
|
|
* +-------------+.
|
|
*/
|
|
class TableMeta {
|
|
constructor(globalMeta) {
|
|
const MetaCtor = globalMeta.getMetaConstructor();
|
|
|
|
/**
|
|
* Main object (instance of the internal TableMeta class from GlobalMeta), holder for all settings defined in the table scope.
|
|
*
|
|
* @type {TableMeta}
|
|
*/
|
|
this.meta = new MetaCtor();
|
|
}
|
|
|
|
/**
|
|
* Gets settings object for this layer.
|
|
*
|
|
* @returns {TableMeta}
|
|
*/
|
|
getMeta() {
|
|
return this.meta;
|
|
}
|
|
|
|
/**
|
|
* Updates table settings object by merging settings with the current state.
|
|
*
|
|
* @param {object} settings An object to merge with.
|
|
*/
|
|
updateMeta(settings) {
|
|
(0, _object.extend)(this.meta, settings);
|
|
(0, _utils.extendByMetaType)(this.meta, settings, settings);
|
|
}
|
|
}
|
|
exports.default = TableMeta; |