VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-sheet/demo/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-sheet/demo/test3.js
var _ = absol._;
var __ = o=> absol._(o).addTo(document.body);
var $ = absol.$;
window.data_module = {};
var typeList = require("https://absol.cf/libs/absol-form/demo/typelist.js");

var formData = {
    "app": "EZUI",
    "layout": {
        "tag": "Container",
        "colSpan": 1,
        "rowSpan": 1,
        "displayName": "",
        "id": "XTK4iV3ydEPmhqsK",
        "layout": "grid",
        "columns": 2,
        "columnGap": 20,
        "rowGap": 10,
        "alignItems": "center",
        "children": [
            {
                "tag": "Label",
                "colSpan": 1,
                "rowSpan": 1,
                "displayName": "Label:Tên",
                "id": "type_pay_sheet_name_label",
                "value": "Tên"
            },
            {
                "tag": "TextInput",
                "name": "title",
                "colSpan": 1,
                "rowSpan": 1,
                "displayName": "Tên",
                "width": "100%",
                "id": "type_pay_sheet_name",
                "value": ""
            },
            {
                "tag": "Label",
                "colSpan": 1,
                "rowSpan": 1,
                "displayName": "Label:Chu kỳ tính lương",
                "id": "type_pay_sheet_cycleid_label",
                "value": "Chu kỳ tính lương"
            },
            {
                "tag": "ComboBox",
                "name": "cycleid",
                "colSpan": 1,
                "rowSpan": 1,
                "displayName": "Chu kỳ tính lương",
                "width": "100%",
                "id": "type_pay_sheet_cycleid",
                "items": "= contentModule.loadListPrimaryTypeEnum(\"member_of_payroll_cycle\", \"ComboBox\")",
                "text": ""
            },
            {
                "tag": "Label",
                "colSpan": 1,
                "rowSpan": 1,
                "displayName": "Label:Ngày tính lương",
                "id": "type_pay_sheet_payroll_date_month_label",
                "value": "Ngày tính lương"
            },
            {
                "tag": "DateInput",
                "name": "payroll_date_month",
                "colSpan": 1,
                "rowSpan": 1,
                "displayName": "Ngày tính lương",
                "width": "100%",
                "id": "type_pay_sheet_payroll_date_month",
                "level": "month"
            },

            {
                "tag": "Label",
                "colSpan": 1,
                "rowSpan": 1,
                "displayName": "Label:Ngày tính lương",
                "id": "date_length_label",
                "value": "Thời gian"
            },
            {
                "tag": "NumberInput",
                "name": "date_length",
                "displayName": "Thời gian",
                "width": "100%",
                "id": "date_length",
                readOnly: true,
                value: 5
            },
            {
                tag:"DateInYear",
                name: 'date_in_year',
                displayName: "Ngày trong năm",
                isExtraField: true
            }
        ]
    },
    "blocks": [
        {
            tag:'Function',
            id: 'date_length_calc',
            args:['date'],
            body: `var prevMonth = absol.datetime.prevMonth(date); var curMonth = absol.datetime.beginOfMonth(date);return absol.datetime.compareDate(curMonth, prevMonth);`,
        }
    ],
    "lines": [
        {
            u: 'type_pay_sheet_payroll_date_month',
            v:'date_length_calc',
            uPin:'value',
            vPin: 'date',
        },
        {
            v: 'date_length',
            u:'date_length_calc',
            uPin:'result',
            vPin: 'value'
        }
    ],

};


var exampleData = {
    exampleTitle: "Bảng ví dụ",
    config: {},
    /*
    propertyNames: ['text_column', 'number_column', 'enum_column', 'rand'],
    propertyDescriptors: {
        text_column: {
            type: "text",
            text: "Cột Văn Bản",
            required: true
        },
        number_column: {
            type: "number",
            text: "Cột Số",
            required: true
        },
        enum_column: {
            type: "enum",
            text: "Cột Enum",
            required: true,
            items: [
                { value: 1, text: "Giá trị 1" },
                { value: 2, text: "Giá trị 2" },
                { value: 3, text: "Giá trị 3" }
            ]
        },
        rand:{
            type: "number",
            calc: "= number_column * random()",
        }
    },*/
    formSource: formData,

    records: [
        { text_column: "Dòng 1", number_column: 123 },
        { text_column: "Dòng 2", number_column: 456 },
        { text_column: "Dòng 3", number_column: 789 }
    ]
};
var fragment = new absol.Fragment();
_({
    tag: 'h3',
    child: { text: exampleData.exampleTitle }
}).addTo(document.body);

var context = {
    random: function (){
        return Math.floor(Math.random() * 1000);
    }
};

var editor = new absol.sheet.TableEditor(Object.assign({ fragment: fragment, context:context }, exampleData.config));
editor.on('change', function () {
    console.log(this.getData().records);
});
editor.getView().addClass("simple-table")
    .addStyle({
        width: 'auto'
    })
    .addTo(document.body);

editor.setData(absol.copyJSVariable(exampleData));


VaKeR 2022