handsontable
Version:
Handsontable is a JavaScript Data Grid available for React, Angular and Vue.
62 lines (60 loc) • 2.46 kB
JavaScript
import "core-js/modules/es.error.cause.js";
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { extend } from "../../../helpers/object.mjs";
import { extendByMetaType } from "../utils.mjs";
/**
* 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) │
* +-------------+.
*/
export default class TableMeta {
constructor(globalMeta) {
/**
* Main object (instance of the internal TableMeta class from GlobalMeta), holder for all settings defined in the table scope.
*
* @type {TableMeta}
*/
_defineProperty(this, "meta", void 0);
const MetaCtor = globalMeta.getMetaConstructor();
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) {
extend(this.meta, settings);
extendByMetaType(this.meta, settings, settings);
}
}