UNPKG

chowa

Version:

UI component library based on React

35 lines (34 loc) 1.08 kB
/** * @license chowa v1.1.3 * * Copyright (c) Chowa Techonlogies Co.,Ltd.(http://www.chowa.cn). * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../utils"); function perfectDataIndex(data) { return data.map((record, index) => { return Object.assign(Object.assign({}, record), { index: utils_1.isExist(record.index) ? record.index : index }); }); } exports.perfectDataIndex = perfectDataIndex; function compuntedSelectedIndexs(selectedIndexs, result) { const sourceSelectedIndexs = []; const targetSelectedIndexs = []; selectedIndexs.forEach((index) => { if (result.includes(index)) { targetSelectedIndexs.push(index); } else { sourceSelectedIndexs.push(index); } }); return { targetSelectedIndexs, sourceSelectedIndexs }; } exports.compuntedSelectedIndexs = compuntedSelectedIndexs;