@onehat/data 1.20.7 → 1.20.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/e2e/Property/Time.cy.js +3 -2
- package/cypress/e2e/Repository/Repository.cy.js +2 -2
- package/package.json +1 -1
- package/src/Repository/Ajax.js +2 -2
- package/src/Repository/OneBuild.js +3 -3
- package/src/Repository/OneBuild2.js +3 -3
- package/src/Repository/Repository.js +2 -2
- package/src/Util/Formatters.js +3 -3
- package/src/Util/Parsers.js +1 -1
|
@@ -18,9 +18,10 @@ describe('TimeProperty', function() {
|
|
|
18
18
|
describe('parse', function() {
|
|
19
19
|
|
|
20
20
|
it('parse HH:mm:ss', function() {
|
|
21
|
-
const
|
|
21
|
+
const time = '02:23:23';
|
|
22
|
+
const parsed = this.property.parse(time);
|
|
22
23
|
expect(parsed.isValid()).to.be.true;
|
|
23
|
-
expect(parsed.format('HH:mm:ss')).to.be.eq(
|
|
24
|
+
expect(parsed.format('HH:mm:ss')).to.be.eq(time);
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
});
|
|
@@ -1302,7 +1302,7 @@ describe('Repository Base', function() {
|
|
|
1302
1302
|
})();
|
|
1303
1303
|
});
|
|
1304
1304
|
|
|
1305
|
-
it('
|
|
1305
|
+
it('loadRootNodes', function() {
|
|
1306
1306
|
(async () => {
|
|
1307
1307
|
const repository = await creatRepository();
|
|
1308
1308
|
repository.assembleTreeNodes();
|
|
@@ -1310,7 +1310,7 @@ describe('Repository Base', function() {
|
|
|
1310
1310
|
const
|
|
1311
1311
|
id1 = repository.getById(1);
|
|
1312
1312
|
|
|
1313
|
-
const rootNodes = repository.
|
|
1313
|
+
const rootNodes = repository.loadRootNodes();
|
|
1314
1314
|
expect(rootNodes).to.be.eql([id1]);
|
|
1315
1315
|
|
|
1316
1316
|
destoryRepository(repository);
|
package/package.json
CHANGED
package/src/Repository/Ajax.js
CHANGED
|
@@ -385,8 +385,8 @@ class AjaxRepository extends Repository {
|
|
|
385
385
|
* @fires beforeLoad,changeData,load,error
|
|
386
386
|
*/
|
|
387
387
|
load = async (params, callback = null) => {
|
|
388
|
-
if (this.isTree && this.
|
|
389
|
-
return this.
|
|
388
|
+
if (this.isTree && this.loadRootNodes) {
|
|
389
|
+
return this.loadRootNodes();
|
|
390
390
|
}
|
|
391
391
|
if (this.isDestroyed) {
|
|
392
392
|
this.throwError('this.load is no longer valid. Repository has been destroyed.');
|
|
@@ -179,7 +179,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
179
179
|
|
|
180
180
|
if (this.isLoaded && !this.eventsPaused) {
|
|
181
181
|
if (this.isTree) {
|
|
182
|
-
return this.
|
|
182
|
+
return this.loadRootNodes(1);
|
|
183
183
|
} else {
|
|
184
184
|
return this.reload();
|
|
185
185
|
}
|
|
@@ -204,7 +204,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
204
204
|
if (!this.eventsPaused) {
|
|
205
205
|
if (this.isLoaded && this.isAutoLoad) {
|
|
206
206
|
if (this.isTree) {
|
|
207
|
-
return this.
|
|
207
|
+
return this.loadRootNodes(1).then(() => {
|
|
208
208
|
this.emit('changeSorters');
|
|
209
209
|
});
|
|
210
210
|
} else {
|
|
@@ -583,7 +583,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
583
583
|
return this._send('POST', this.name + '/getNodes', data)
|
|
584
584
|
.then((result) => {
|
|
585
585
|
if (this.debugMode) {
|
|
586
|
-
console.log('Response for
|
|
586
|
+
console.log('Response for loadRootNodes', result);
|
|
587
587
|
}
|
|
588
588
|
|
|
589
589
|
if (this.isDestroyed) {
|
|
@@ -179,7 +179,7 @@ class OneBuild2Repository extends AjaxRepository {
|
|
|
179
179
|
|
|
180
180
|
if (this.isLoaded && !this.eventsPaused) {
|
|
181
181
|
if (this.isTree) {
|
|
182
|
-
return this.
|
|
182
|
+
return this.loadRootNodes(1);
|
|
183
183
|
} else {
|
|
184
184
|
return this.reload();
|
|
185
185
|
}
|
|
@@ -204,7 +204,7 @@ class OneBuild2Repository extends AjaxRepository {
|
|
|
204
204
|
if (!this.eventsPaused) {
|
|
205
205
|
if (this.isLoaded && this.isAutoLoad) {
|
|
206
206
|
if (this.isTree) {
|
|
207
|
-
return this.
|
|
207
|
+
return this.loadRootNodes(1).then(() => {
|
|
208
208
|
this.emit('changeSorters');
|
|
209
209
|
});
|
|
210
210
|
} else {
|
|
@@ -583,7 +583,7 @@ class OneBuild2Repository extends AjaxRepository {
|
|
|
583
583
|
return this._send('POST', this.name + '/getNodes', data)
|
|
584
584
|
.then((result) => {
|
|
585
585
|
if (this.debugMode) {
|
|
586
|
-
console.log('Response for
|
|
586
|
+
console.log('Response for loadRootNodes', result);
|
|
587
587
|
}
|
|
588
588
|
|
|
589
589
|
if (this.isDestroyed) {
|
|
@@ -2081,10 +2081,10 @@ export default class Repository extends EventEmitter {
|
|
|
2081
2081
|
/**
|
|
2082
2082
|
* Gets the root TreeNodes
|
|
2083
2083
|
*/
|
|
2084
|
-
|
|
2084
|
+
loadRootNodes = () => {
|
|
2085
2085
|
this.ensureTree();
|
|
2086
2086
|
if (this.isDestroyed) {
|
|
2087
|
-
this.throwError('this.
|
|
2087
|
+
this.throwError('this.loadRootNodes is no longer valid. Repository has been destroyed.');
|
|
2088
2088
|
return;
|
|
2089
2089
|
}
|
|
2090
2090
|
|
package/src/Util/Formatters.js
CHANGED
|
@@ -106,9 +106,9 @@ class Formatters {
|
|
|
106
106
|
return moment(value).format(format);
|
|
107
107
|
}
|
|
108
108
|
if (!_.isNil(value)) {
|
|
109
|
-
const
|
|
110
|
-
if (!_.isNil(
|
|
111
|
-
return
|
|
109
|
+
const m = moment(value, format);
|
|
110
|
+
if (!_.isNil(m)) {
|
|
111
|
+
return m.format(format);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
return null;
|
package/src/Util/Parsers.js
CHANGED