1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.Row = undefined;
|
7 |
|
8 | var _indexEvents = require('./indexEvents');
|
9 |
|
10 | var _rowData = require('./row-data');
|
11 |
|
12 | var _rowGetData = require('./row-getData');
|
13 |
|
14 | var _rowGetMeta = require('./row-getMeta');
|
15 |
|
16 | var _rowGetSimpleData = require('./row-getSimpleData');
|
17 |
|
18 | var _rowInit = require('./row-init');
|
19 |
|
20 | var _rowMeta = require('./row-meta');
|
21 |
|
22 | var _rowRef = require('./row-ref');
|
23 |
|
24 | var _rowRowSelect = require('./row-rowSelect');
|
25 |
|
26 | var _rowSimpleData = require('./row-simpleData');
|
27 |
|
28 | var _rowUtil = require('./row-util');
|
29 |
|
30 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
31 |
|
32 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
33 |
|
34 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } |
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | var Row = function (_Events) {
|
41 | _inherits(Row, _Events);
|
42 |
|
43 | function Row(options) {
|
44 | _classCallCheck(this, Row);
|
45 |
|
46 | var _this = _possibleConstructorReturn(this, (Row.__proto__ || Object.getPrototypeOf(Row)).call(this));
|
47 |
|
48 | var self = _this;
|
49 | _this.rowId = options['id'] || Row.getRandomRowId();
|
50 | _this.status = Row.STATUS.NEW;
|
51 | _this.parent = options['parent'];
|
52 | _this.initValue = null;
|
53 | _this.data = {};
|
54 | _this.metaChange = {};
|
55 | _this.valueChange = {};
|
56 | _this.currentRowChange = ko.observable(1);
|
57 | _this.selected = ko.pureComputed({
|
58 | read: function read() {
|
59 | var index = this.parent.getRowIndex(this);
|
60 | var selectindices = this.parent.getSelectedIndices();
|
61 | return selectindices.indexOf(index) != -1;
|
62 | },
|
63 | owner: _this
|
64 |
|
65 | });
|
66 | _this.focused = ko.pureComputed({
|
67 | read: function read() {
|
68 | var index = this.parent.getRowIndex(this);
|
69 | var focusIndex = this.parent.getFocusIndex();
|
70 | return focusIndex == index;
|
71 | },
|
72 | owner: _this
|
73 |
|
74 | });
|
75 |
|
76 | _this.init();
|
77 | return _this;
|
78 | }
|
79 |
|
80 | return Row;
|
81 | }(_indexEvents.Events);
|
82 |
|
83 |
|
84 |
|
85 |
|
86 | Row.prototype.setValue = _rowData.setValue;
|
87 | Row.prototype.setChildValue = _rowData.setChildValue;
|
88 | Row.prototype.setChildSimpleDataByRowId = _rowData.setChildSimpleDataByRowId;
|
89 | Row.prototype.setData = _rowData.setData;
|
90 | Row.prototype.updateRow = _rowData.updateRow;
|
91 |
|
92 |
|
93 | Row.prototype.getValue = _rowGetData.getValue;
|
94 | Row.prototype.getChildValue = _rowGetData.getChildValue;
|
95 | Row.prototype.getData = _rowGetData.getData;
|
96 | Row.prototype.getEmptyData = _rowGetData.getEmptyData;
|
97 |
|
98 |
|
99 | Row.prototype.getMeta = _rowGetMeta.getMeta;
|
100 |
|
101 |
|
102 | Row.prototype.formatValueFun = _rowGetSimpleData.formatValueFun;
|
103 | Row.prototype.getSimpleData = _rowGetSimpleData.getSimpleData;
|
104 |
|
105 |
|
106 | Row.prototype.init = _rowInit.init;
|
107 |
|
108 |
|
109 | Row.prototype.setMeta = _rowMeta.setMeta;
|
110 |
|
111 |
|
112 | Row.prototype.ref = _rowRef.ref;
|
113 | Row.prototype.refMeta = _rowRef.refMeta;
|
114 | Row.prototype.refCombo = _rowRef.refCombo;
|
115 | Row.prototype.refDate = _rowRef.refDate;
|
116 | Row.prototype.refEnum = _rowRef.refEnum;
|
117 |
|
118 |
|
119 | Row.prototype.toggleSelect = _rowRowSelect.toggleSelect;
|
120 | Row.prototype.singleSelect = _rowRowSelect.singleSelect;
|
121 | Row.prototype.multiSelect = _rowRowSelect.multiSelect;
|
122 |
|
123 |
|
124 | Row.prototype.setSimpleData = _rowSimpleData.setSimpleData;
|
125 |
|
126 |
|
127 | Row.prototype.formatValue = _rowUtil.formatValue;
|
128 |
|
129 | Row.STATUS = {
|
130 | NORMAL: 'nrm',
|
131 | UPDATE: 'upd',
|
132 | NEW: 'new',
|
133 | DELETE: 'del',
|
134 | FALSE_DELETE: 'fdel'
|
135 | };
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 | Row.getRandomRowId = function () {
|
142 | var _id = setTimeout(function () {});
|
143 | return _id + '';
|
144 | };
|
145 |
|
146 | exports.Row = Row; |
\ | No newline at end of file |