/**
 * amis-ui v6.12.0-beta.0
 * Copyright 2018-2025 fex
 */

import { __extends } from 'tslib';
import React__default from 'react';
import { themeable } from 'amis-core';
import JsBarcode from 'jsbarcode';

/**
 * @file 基于实现 bar code
 */
var BarCode = /** @class */ (function (_super) {
    __extends(BarCode, _super);
    function BarCode(props) {
        var _this = _super.call(this, props) || this;
        _this.dom = React__default.createRef();
        return _this;
    }
    BarCode.prototype.componentDidUpdate = function (prevProps) {
        if (this.props.value !== prevProps.value ||
            JSON.stringify(this.props.options) !== JSON.stringify(prevProps.options)) {
            this.renderBarCode();
        }
    };
    BarCode.prototype.renderBarCode = function () {
        if (this.dom.current) {
            JsBarcode(this.dom.current, this.props.value, this.props.options);
        }
    };
    BarCode.prototype.componentDidMount = function () {
        this.renderBarCode();
    };
    BarCode.prototype.render = function () {
        return React__default.createElement("img", { ref: this.dom });
    };
    return BarCode;
}(React__default.Component));
var BarCode$1 = themeable(BarCode);

export { BarCode, BarCode$1 as default };
