core_ez-foundation.js

import { getHCmb, HCmb } from "../modules/academic/h-cmb";
import {
    getLinkedComboManager,
    LinkedComboManager,
} from "../utils/combo/linked-combo";
import { mkArg } from "../utils/common/mk-arg";
import { checkScdul } from "../modules/schedule/check-scdul";
import { traverseComponentTreeWithCallback } from "../utils/ui/traverse-component-tree-with-callback";
import { txFile } from "../utils/ezworks/tx-file";
import { replaceHaksaText } from "../modules/common/replace-haksa-text";

// dataset-utils
import { checkDuplicateRows } from "../utils/dataset/check-duplicate-rows";
import { getRowTracer } from "../utils/dataset/dataset-row-tracer";
import { initDatasetRowTracer } from "../utils/dataset/init-dataset-row-tracer";
import {
    filterRowsByCondition,
    removeRowsByCondition,
} from "../utils/dataset/remove-rows-by-condition";
import {
    forEachDataset,
    datasetForEach,
} from "../utils/dataset/for-each-dataset";
import { mapDatasetToArray } from "../utils/dataset/map-dataset-to-array";

// grid-utils
import { setupGridMultiCellCopy } from "../utils/grid/setup-grid-multi-cell-copy";
import { setupBetterInputGrid } from "../utils/grid/setup-better-input-grid";

// crypto-utils
import { generateUUIDv4 } from "../utils/crypto/generate-uuidv4";
import { encodeHex } from "../utils/crypto/encode-hex";
import { decodeHex } from "../utils/crypto/decode-hex";
import { sha256 } from "../utils/crypto/sha256";
import { revalidateAllRow } from "../utils/ezworks/revalidate-all-row";
import {
    vCheckBox,
    vDiv,
    vEdit,
    vPanel,
    vStatic,
    vTextArea,
} from "../utils/dynamic/primary-element";
import { render, useState, useRef } from "../utils/dynamic/render";
import { vStack } from "../utils/dynamic/component/v-stack";
import { v } from "../utils/dynamic/v-node";
import { findAncestorComponent } from "../utils/ui/find-ancestor-component";
import { validateEssentialComponents } from "../utils/ezworks/validate-essential-components";
import { prepareFileDelete } from "../utils/ezworks/prepare-file-delete";
import { parseBool } from "../utils/common/parse-bool";
import { getDormCmb } from "../modules/dormitory/dorm-cmb";
import React from "react";
import { createNexacroRoot } from "../utils/react-nexacro/root";
import {
    NxDiv,
    NxStatic,
    NxButton,
    NxEdit,
    NxTextArea,
    NxCheckBox,
    NxCombo,
    NxCalendar,
    NxSpin,
    NxGrid,
    NxTab,
    NxImage,
    NxProgressBar,
    NxListBox,
    NxPanel,
    NxStack,
    NxVBox,
    NxHBox,
    useNexacroDataset,
} from "../utils/react-nexacro/index";

if (!globalThis.HCmb) {
    globalThis.HCmb = HCmb;
}

if (!globalThis.LinkedComboManager) {
    globalThis.LinkedComboManager = LinkedComboManager;
}

if (!globalThis.EzFoundation) {
    /**
     * EzFoundation 클래스
     *
     * @namespace $f
     */
    globalThis.EzFoundation = function () {};

    // 외부 함수
    globalThis.EzFoundation.prototype.getHCmb = getHCmb;
    globalThis.EzFoundation.prototype.getLinkedComboManager =
        getLinkedComboManager;
    globalThis.EzFoundation.prototype.mkArg = mkArg;
    globalThis.EzFoundation.prototype.checkScdul = checkScdul;
    globalThis.EzFoundation.prototype.traverseComponentTreeWithCallback =
        traverseComponentTreeWithCallback;
    globalThis.EzFoundation.prototype.txFile = txFile;
    globalThis.EzFoundation.prototype.replaceHaksaText = replaceHaksaText;
    globalThis.EzFoundation.prototype.revalidateAllRow = revalidateAllRow;
    globalThis.EzFoundation.prototype.findAncestorComponent =
        findAncestorComponent;
    globalThis.EzFoundation.prototype.validateEssentialComponents =
        validateEssentialComponents;
    globalThis.EzFoundation.prototype.prepareFileDelete = prepareFileDelete;
    globalThis.EzFoundation.prototype.parseBool = parseBool;

    // Dataset Utils
    globalThis.EzFoundation.prototype.checkDuplicateRows = checkDuplicateRows;
    globalThis.EzFoundation.prototype.removeRowsByCondition =
        removeRowsByCondition;
    globalThis.EzFoundation.prototype.filterRowsByCondition =
        filterRowsByCondition;
    globalThis.EzFoundation.prototype.datasetForEach = datasetForEach;
    globalThis.EzFoundation.prototype.forEachDataset = forEachDataset;
    globalThis.EzFoundation.prototype.mapDatasetToArray = mapDatasetToArray;
    globalThis.EzFoundation.prototype.getRowTracer = getRowTracer;
    globalThis.EzFoundation.prototype.initDatasetRowTracer =
        initDatasetRowTracer;

    // Grid Utils
    globalThis.EzFoundation.prototype.setupGridMultiCellCopy =
        setupGridMultiCellCopy;
    globalThis.EzFoundation.prototype.setupBetterInputGrid =
        setupBetterInputGrid;

    // crypto-utils
    globalThis.EzFoundation.prototype.generateUUIDv4 = generateUUIDv4;
    globalThis.EzFoundation.prototype.encodeHex = encodeHex;
    globalThis.EzFoundation.prototype.decodeHex = decodeHex;
    globalThis.EzFoundation.prototype.sha256 = sha256;

    // 업무 모듈 (생활관)
    globalThis.EzFoundation.prototype.getDormCmb = getDormCmb;
}

if (!globalThis.$f) {
    globalThis.$f = new EzFoundation();
}

if (!globalThis.EzDynamicComponent) {
    globalThis.EzDynamicComponent = function () {};

    globalThis.EzDynamicComponent.prototype.render = render;
    globalThis.EzDynamicComponent.prototype.v = v;
    globalThis.EzDynamicComponent.prototype.useState = useState;
    globalThis.EzDynamicComponent.prototype.useRef = useRef;

    // dynamic-component
    globalThis.EzDynamicComponent.prototype.vDiv = vDiv;
    globalThis.EzDynamicComponent.prototype.vStatic = vStatic;
    globalThis.EzDynamicComponent.prototype.vStack = vStack;
    globalThis.EzDynamicComponent.prototype.vCheckBox = vCheckBox;
    globalThis.EzDynamicComponent.prototype.vEdit = vEdit;
    globalThis.EzDynamicComponent.prototype.vTextArea = vTextArea;
    globalThis.EzDynamicComponent.prototype.vPanel = vPanel;
}

if (!globalThis.$v) {
    globalThis.$v = new EzDynamicComponent();
}

if (!globalThis.$react) {
    globalThis.$react = {
        /**
         * @type {Object}
         */
        React: React,
        /**
         * @type {Function}
         */
        createNexacroRoot: createNexacroRoot,

        /**
         * @type {Function}
         */
        NxDiv: NxDiv,
        /**
         * @type {Function}
         */
        NxStatic: NxStatic,
        /**
         * @type {Function}
         */
        NxButton: NxButton,
        /**
         * @type {Function}
         */
        NxEdit: NxEdit,
        /**
         * @type {Function}
         */
        NxTextArea: NxTextArea,
        /**
         * @type {Function}
         */
        NxCheckBox: NxCheckBox,
        /**
         * @type {Function}
         */
        NxCombo: NxCombo,
        /**
         * @type {Function}
         */
        NxCalendar: NxCalendar,
        /**
         * @type {Function}
         */
        NxSpin: NxSpin,
        /**
         * @type {Function}
         */
        NxGrid: NxGrid,
        /**
         * @type {Function}
         */
        NxTab: NxTab,
        /**
         * @type {Function}
         */
        NxImage: NxImage,
        /**
         * @type {Function}
         */
        NxProgressBar: NxProgressBar,
        /**
         * @type {Function}
         */
        NxListBox: NxListBox,
        /**
         * @type {Function}
         */
        NxPanel: NxPanel,
        /**
         * @type {Function}
         */
        NxStack: NxStack,
        /**
         * @type {Function}
         */
        NxVBox: NxVBox,
        /**
         * @type {Function}
         */
        NxHBox: NxHBox,

        /**
         * @type {Function}
         */
        useNexacroDataset: useNexacroDataset,
    };
}