diff --git a/e2e/app.e2e-spec.js b/e2e/app.e2e-spec.js new file mode 100644 index 0000000000..0e2a51d09c --- /dev/null +++ b/e2e/app.e2e-spec.js @@ -0,0 +1,16 @@ +import { ProtractorPage } from './app.po'; +describe('protractor App', function () { + var page; + beforeEach(function () { + page = new ProtractorPage(); + }); + it('should display translated title "DSpace Angular :: Home"', function () { + page.navigateTo(); + expect(page.getPageTitleText()).toEqual('DSpace Angular :: Home'); + }); + it('should contain a news section', function () { + page.navigateTo(); + expect(page.getHomePageNewsText()).toBeDefined(); + }); +}); +//# sourceMappingURL=app.e2e-spec.js.map \ No newline at end of file diff --git a/e2e/app.e2e-spec.js.map b/e2e/app.e2e-spec.js.map new file mode 100644 index 0000000000..e6eb55bcfc --- /dev/null +++ b/e2e/app.e2e-spec.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.e2e-spec.js","sourceRoot":"","sources":["app.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,QAAQ,CAAC,gBAAgB,EAAE;IACzB,IAAI,IAAoB,CAAC;IAEzB,UAAU,CAAC;QACT,IAAI,GAAG,IAAI,cAAc,EAAE,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE;QAC7D,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,MAAM,CAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE;QAClC,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,MAAM,CAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/e2e/app.po.js b/e2e/app.po.js new file mode 100644 index 0000000000..40f8494e0b --- /dev/null +++ b/e2e/app.po.js @@ -0,0 +1,17 @@ +import { browser, element, by } from 'protractor'; +var ProtractorPage = /** @class */ (function () { + function ProtractorPage() { + } + ProtractorPage.prototype.navigateTo = function () { + return browser.get('/'); + }; + ProtractorPage.prototype.getPageTitleText = function () { + return browser.getTitle(); + }; + ProtractorPage.prototype.getHomePageNewsText = function () { + return element(by.xpath('//ds-home-news')).getText(); + }; + return ProtractorPage; +}()); +export { ProtractorPage }; +//# sourceMappingURL=app.po.js.map \ No newline at end of file diff --git a/e2e/app.po.js.map b/e2e/app.po.js.map new file mode 100644 index 0000000000..e7438ddf69 --- /dev/null +++ b/e2e/app.po.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.po.js","sourceRoot":"","sources":["app.po.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAElD;IAAA;IAYA,CAAC;IAXC,mCAAU,GAAV;QACE,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,yCAAgB,GAAhB;QACE,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;IAED,4CAAmB,GAAnB;QACE,OAAO,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACvD,CAAC;IACH,qBAAC;AAAD,CAAC,AAZD,IAYC"} \ No newline at end of file diff --git a/e2e/pagenotfound/pagenotfound.e2e-spec.js b/e2e/pagenotfound/pagenotfound.e2e-spec.js new file mode 100644 index 0000000000..4797f221f1 --- /dev/null +++ b/e2e/pagenotfound/pagenotfound.e2e-spec.js @@ -0,0 +1,16 @@ +import { ProtractorPage } from './pagenotfound.po'; +describe('protractor PageNotFound', function () { + var page; + beforeEach(function () { + page = new ProtractorPage(); + }); + it('should contain element ds-pagenotfound when navigating to page that doesnt exist', function () { + page.navigateToNonExistingPage(); + expect(page.elementTagExists('ds-pagenotfound')).toEqual(true); + }); + it('should not contain element ds-pagenotfound when navigating to existing page', function () { + page.navigateToExistingPage(); + expect(page.elementTagExists('ds-pagenotfound')).toEqual(false); + }); +}); +//# sourceMappingURL=pagenotfound.e2e-spec.js.map \ No newline at end of file diff --git a/e2e/pagenotfound/pagenotfound.e2e-spec.js.map b/e2e/pagenotfound/pagenotfound.e2e-spec.js.map new file mode 100644 index 0000000000..867ac9c7a1 --- /dev/null +++ b/e2e/pagenotfound/pagenotfound.e2e-spec.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pagenotfound.e2e-spec.js","sourceRoot":"","sources":["pagenotfound.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,QAAQ,CAAC,yBAAyB,EAAE;IAClC,IAAI,IAAoB,CAAC;IAEzB,UAAU,CAAC;QACT,IAAI,GAAG,IAAI,cAAc,EAAE,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kFAAkF,EAAE;QACrF,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACjC,MAAM,CAAM,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6EAA6E,EAAE;QAChF,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC9B,MAAM,CAAM,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/e2e/pagenotfound/pagenotfound.po.js b/e2e/pagenotfound/pagenotfound.po.js new file mode 100644 index 0000000000..7fa85382c6 --- /dev/null +++ b/e2e/pagenotfound/pagenotfound.po.js @@ -0,0 +1,19 @@ +import { browser, element, by } from 'protractor'; +var ProtractorPage = /** @class */ (function () { + function ProtractorPage() { + this.HOMEPAGE = '/home'; + this.NONEXISTINGPAGE = '/e9019a69-d4f1-4773-b6a3-bd362caa46f2'; + } + ProtractorPage.prototype.navigateToNonExistingPage = function () { + return browser.get(this.NONEXISTINGPAGE); + }; + ProtractorPage.prototype.navigateToExistingPage = function () { + return browser.get(this.HOMEPAGE); + }; + ProtractorPage.prototype.elementTagExists = function (tag) { + return element(by.tagName(tag)).isPresent(); + }; + return ProtractorPage; +}()); +export { ProtractorPage }; +//# sourceMappingURL=pagenotfound.po.js.map \ No newline at end of file diff --git a/e2e/pagenotfound/pagenotfound.po.js.map b/e2e/pagenotfound/pagenotfound.po.js.map new file mode 100644 index 0000000000..3b611061ad --- /dev/null +++ b/e2e/pagenotfound/pagenotfound.po.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pagenotfound.po.js","sourceRoot":"","sources":["pagenotfound.po.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAElD;IAAA;QACE,aAAQ,GAAG,OAAO,CAAC;QACnB,oBAAe,GAAG,uCAAuC,CAAC;IAa5D,CAAC;IAXC,kDAAyB,GAAzB;QACE,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;IACD,+CAAsB,GAAtB;QACE,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED,yCAAgB,GAAhB,UAAiB,GAAW;QAC1B,OAAO,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAC9C,CAAC;IAEH,qBAAC;AAAD,CAAC,AAfD,IAeC"} \ No newline at end of file diff --git a/e2e/search-page/search-page.e2e-spec.js b/e2e/search-page/search-page.e2e-spec.js new file mode 100644 index 0000000000..a8da0836a2 --- /dev/null +++ b/e2e/search-page/search-page.e2e-spec.js @@ -0,0 +1,47 @@ +import { ProtractorPage } from './search-page.po'; +import { browser } from 'protractor'; +describe('protractor SearchPage', function () { + var page; + beforeEach(function () { + page = new ProtractorPage(); + }); + it('should contain query value when navigating to page with query parameter', function () { + var queryString = 'Interesting query string'; + page.navigateToSearchWithQueryParameter(queryString); + page.getCurrentQuery().then(function (query) { + expect(query).toEqual(queryString); + }); + }); + it('should have right scope selected when navigating to page with scope parameter', function () { + var scope = page.getRandomScopeOption(); + scope.then(function (scopeString) { + page.navigateToSearchWithScopeParameter(scopeString); + page.getCurrentScope().then(function (s) { + expect(s).toEqual(scopeString); + }); + }); + }); + it('should redirect to the correct url when scope was set and submit button was triggered', function () { + var scope = page.getRandomScopeOption(); + scope.then(function (scopeString) { + page.setCurrentScope(scopeString); + page.submitSearchForm(); + browser.wait(function () { + return browser.getCurrentUrl().then(function (url) { + return url.indexOf('scope=' + encodeURI(scopeString)) !== -1; + }); + }); + }); + }); + it('should redirect to the correct url when query was set and submit button was triggered', function () { + var queryString = 'Another interesting query string'; + page.setCurrentQuery(queryString); + page.submitSearchForm(); + browser.wait(function () { + return browser.getCurrentUrl().then(function (url) { + return url.indexOf('query=' + encodeURI(queryString)) !== -1; + }); + }); + }); +}); +//# sourceMappingURL=search-page.e2e-spec.js.map \ No newline at end of file diff --git a/e2e/search-page/search-page.e2e-spec.js.map b/e2e/search-page/search-page.e2e-spec.js.map new file mode 100644 index 0000000000..e577c19321 --- /dev/null +++ b/e2e/search-page/search-page.e2e-spec.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-page.e2e-spec.js","sourceRoot":"","sources":["search-page.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,QAAQ,CAAC,uBAAuB,EAAE;IAChC,IAAI,IAAoB,CAAC;IAEzB,UAAU,CAAC;QACT,IAAI,GAAG,IAAI,cAAc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,CAAC;IAEH,EAAE,CAAC,uFAAuF,EAAE;QAC1F,IAAM,WAAW,GAAG,kCAAkC,CAAC;QACvD,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAClC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC;YACX,OAAO,OAAO,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,UAAC,GAAW;gBAC9C,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;YAC/D,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/e2e/search-page/search-page.po.js b/e2e/search-page/search-page.po.js new file mode 100644 index 0000000000..e834451d9d --- /dev/null +++ b/e2e/search-page/search-page.po.js @@ -0,0 +1,42 @@ +import { browser, element, by, protractor } from 'protractor'; +var ProtractorPage = /** @class */ (function () { + function ProtractorPage() { + this.SEARCH = '/search'; + } + ProtractorPage.prototype.navigateToSearch = function () { + return browser.get(this.SEARCH); + }; + ProtractorPage.prototype.navigateToSearchWithQueryParameter = function (query) { + return browser.get(this.SEARCH + '?query=' + query); + }; + ProtractorPage.prototype.navigateToSearchWithScopeParameter = function (scope) { + return browser.get(this.SEARCH + '?scope=' + scope); + }; + ProtractorPage.prototype.getCurrentScope = function () { + var scopeSelect = element(by.css('#search-form select')); + browser.wait(protractor.ExpectedConditions.presenceOf(scopeSelect), 10000); + return scopeSelect.getAttribute('value'); + }; + ProtractorPage.prototype.getCurrentQuery = function () { + return element(by.css('#search-form input')).getAttribute('value'); + }; + ProtractorPage.prototype.setCurrentScope = function (scope) { + element(by.css('option[value="' + scope + '"]')).click(); + }; + ProtractorPage.prototype.setCurrentQuery = function (query) { + element(by.css('input[name="query"]')).sendKeys(query); + }; + ProtractorPage.prototype.submitSearchForm = function () { + element(by.css('button.search-button')).click(); + }; + ProtractorPage.prototype.getRandomScopeOption = function () { + var options = element(by.css('select[name="scope"]')).all(by.tagName('option')); + return options.count().then(function (c) { + var index = Math.floor(Math.random() * (c - 1)); + return options.get(index + 1).getAttribute('value'); + }); + }; + return ProtractorPage; +}()); +export { ProtractorPage }; +//# sourceMappingURL=search-page.po.js.map \ No newline at end of file diff --git a/e2e/search-page/search-page.po.js.map b/e2e/search-page/search-page.po.js.map new file mode 100644 index 0000000000..c027e980ae --- /dev/null +++ b/e2e/search-page/search-page.po.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-page.po.js","sourceRoot":"","sources":["search-page.po.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG9D;IAAA;QACE,WAAM,GAAG,SAAS,CAAC;IA4CrB,CAAC;IA1CC,yCAAgB,GAAhB;QACE,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,2DAAkC,GAAlC,UAAmC,KAAa;QAC9C,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,2DAAkC,GAAlC,UAAmC,KAAa;QAC9C,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,wCAAe,GAAf;QACE,IAAM,WAAW,GAAG,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAC3D,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,CAAC;QAC3E,OAAO,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,wCAAe,GAAf;QACE,OAAO,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC;IAED,wCAAe,GAAf,UAAgB,KAAa;QAC3B,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,gBAAgB,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IAC3D,CAAC;IAED,wCAAe,GAAf,UAAgB,KAAa;QAC3B,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzD,CAAC;IAED,yCAAgB,GAAhB;QACE,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IAClD,CAAC;IAED,6CAAoB,GAApB;QACE,IAAM,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QAClF,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,UAAC,CAAS;YACpC,IAAM,KAAK,GAAW,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC1D,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC;IAEH,qBAAC;AAAD,CAAC,AA7CD,IA6CC"} \ No newline at end of file diff --git a/src/app/+admin/admin-registries/admin-registries-routing.module.js b/src/app/+admin/admin-registries/admin-registries-routing.module.js new file mode 100644 index 0000000000..21d2fa3be4 --- /dev/null +++ b/src/app/+admin/admin-registries/admin-registries-routing.module.js @@ -0,0 +1,24 @@ +import * as tslib_1 from "tslib"; +import { MetadataRegistryComponent } from './metadata-registry/metadata-registry.component'; +import { RouterModule } from '@angular/router'; +import { NgModule } from '@angular/core'; +import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component'; +import { BitstreamFormatsComponent } from './bitstream-formats/bitstream-formats.component'; +var AdminRegistriesRoutingModule = /** @class */ (function () { + function AdminRegistriesRoutingModule() { + } + AdminRegistriesRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { path: 'metadata', component: MetadataRegistryComponent, data: { title: 'admin.registries.metadata.title' } }, + { path: 'metadata/:schemaName', component: MetadataSchemaComponent, data: { title: 'admin.registries.schema.title' } }, + { path: 'bitstream-formats', component: BitstreamFormatsComponent, data: { title: 'admin.registries.bitstream-formats.title' } }, + ]) + ] + }) + ], AdminRegistriesRoutingModule); + return AdminRegistriesRoutingModule; +}()); +export { AdminRegistriesRoutingModule }; +//# sourceMappingURL=admin-registries-routing.module.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-registries/admin-registries-routing.module.js.map b/src/app/+admin/admin-registries/admin-registries-routing.module.js.map new file mode 100644 index 0000000000..23fb9e2097 --- /dev/null +++ b/src/app/+admin/admin-registries/admin-registries-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"admin-registries-routing.module.js","sourceRoot":"","sources":["admin-registries-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAW5F;IAAA;IAEA,CAAC;IAFY,4BAA4B;QATxC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,yBAAyB,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,iCAAiC,EAAE,EAAE;oBAC9G,EAAE,IAAI,EAAE,sBAAsB,EAAE,SAAS,EAAE,uBAAuB,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,+BAA+B,EAAE,EAAE;oBACtH,EAAE,IAAI,EAAE,mBAAmB,EAAE,SAAS,EAAE,yBAAyB,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,0CAA0C,EAAE,EAAE;iBACjI,CAAC;aACH;SACF,CAAC;OACW,4BAA4B,CAExC;IAAD,mCAAC;CAAA,AAFD,IAEC;SAFY,4BAA4B"} \ No newline at end of file diff --git a/src/app/+admin/admin-registries/admin-registries.module.js b/src/app/+admin/admin-registries/admin-registries.module.js new file mode 100644 index 0000000000..b0b9c923c7 --- /dev/null +++ b/src/app/+admin/admin-registries/admin-registries.module.js @@ -0,0 +1,38 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { MetadataRegistryComponent } from './metadata-registry/metadata-registry.component'; +import { AdminRegistriesRoutingModule } from './admin-registries-routing.module'; +import { CommonModule } from '@angular/common'; +import { MetadataSchemaComponent } from './metadata-schema/metadata-schema.component'; +import { RouterModule } from '@angular/router'; +import { TranslateModule } from '@ngx-translate/core'; +import { BitstreamFormatsComponent } from './bitstream-formats/bitstream-formats.component'; +import { SharedModule } from '../../shared/shared.module'; +import { MetadataSchemaFormComponent } from './metadata-registry/metadata-schema-form/metadata-schema-form.component'; +import { MetadataFieldFormComponent } from './metadata-schema/metadata-field-form/metadata-field-form.component'; +var AdminRegistriesModule = /** @class */ (function () { + function AdminRegistriesModule() { + } + AdminRegistriesModule = tslib_1.__decorate([ + NgModule({ + imports: [ + CommonModule, + SharedModule, + RouterModule, + TranslateModule, + AdminRegistriesRoutingModule + ], + declarations: [ + MetadataRegistryComponent, + MetadataSchemaComponent, + BitstreamFormatsComponent, + MetadataSchemaFormComponent, + MetadataFieldFormComponent + ], + entryComponents: [] + }) + ], AdminRegistriesModule); + return AdminRegistriesModule; +}()); +export { AdminRegistriesModule }; +//# sourceMappingURL=admin-registries.module.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-registries/admin-registries.module.js.map b/src/app/+admin/admin-registries/admin-registries.module.js.map new file mode 100644 index 0000000000..5ad26e5906 --- /dev/null +++ b/src/app/+admin/admin-registries/admin-registries.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"admin-registries.module.js","sourceRoot":"","sources":["admin-registries.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yEAAyE,CAAC;AACtH,OAAO,EAAC,0BAA0B,EAAC,MAAM,qEAAqE,CAAC;AAqB/G;IAAA;IAEA,CAAC;IAFY,qBAAqB;QAnBjC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY;gBACZ,YAAY;gBACZ,YAAY;gBACZ,eAAe;gBACf,4BAA4B;aAC7B;YACD,YAAY,EAAE;gBACZ,yBAAyB;gBACzB,uBAAuB;gBACvB,yBAAyB;gBACzB,2BAA2B;gBAC3B,0BAA0B;aAC3B;YACD,eAAe,EAAE,EAEhB;SACF,CAAC;OACW,qBAAqB,CAEjC;IAAD,4BAAC;CAAA,AAFD,IAEC;SAFY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.js b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.js new file mode 100644 index 0000000000..ab7f6f1699 --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.js @@ -0,0 +1,45 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { RegistryService } from '../../../core/registry/registry.service'; +import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; +/** + * This component renders a list of bitstream formats + */ +var BitstreamFormatsComponent = /** @class */ (function () { + function BitstreamFormatsComponent(registryService) { + this.registryService = registryService; + /** + * The current pagination configuration for the page + * Currently simply renders all bitstream formats + */ + this.config = Object.assign(new PaginationComponentOptions(), { + id: 'registry-bitstreamformats-pagination', + pageSize: 10000 + }); + this.updateFormats(); + } + /** + * When the page is changed, make sure to update the list of bitstreams to match the new page + * @param event The page change event + */ + BitstreamFormatsComponent.prototype.onPageChange = function (event) { + this.config.currentPage = event; + this.updateFormats(); + }; + /** + * Method to update the bitstream formats that are shown + */ + BitstreamFormatsComponent.prototype.updateFormats = function () { + this.bitstreamFormats = this.registryService.getBitstreamFormats(this.config); + }; + BitstreamFormatsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-bitstream-formats', + templateUrl: './bitstream-formats.component.html' + }), + tslib_1.__metadata("design:paramtypes", [RegistryService]) + ], BitstreamFormatsComponent); + return BitstreamFormatsComponent; +}()); +export { BitstreamFormatsComponent }; +//# sourceMappingURL=bitstream-formats.component.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.js.map b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.js.map new file mode 100644 index 0000000000..5480f7c8e8 --- /dev/null +++ b/src/app/+admin/admin-registries/bitstream-formats/bitstream-formats.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bitstream-formats.component.js","sourceRoot":"","sources":["bitstream-formats.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAK1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,+DAA+D,CAAC;AAE3G;;GAEG;AAKH;IAgBE,mCAAoB,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;QATpD;;;WAGG;QACH,WAAM,GAA+B,MAAM,CAAC,MAAM,CAAC,IAAI,0BAA0B,EAAE,EAAE;YACnF,EAAE,EAAE,sCAAsC;YAC1C,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;QAGD,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,gDAAY,GAAZ,UAAa,KAAK;QAChB,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAED;;OAEG;IACK,iDAAa,GAArB;QACE,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChF,CAAC;IAlCU,yBAAyB;QAJrC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,WAAW,EAAE,oCAAoC;SAClD,CAAC;iDAiBqC,eAAe;OAhBzC,yBAAyB,CAmCrC;IAAD,gCAAC;CAAA,AAnCD,IAmCC;SAnCY,yBAAyB"} \ No newline at end of file diff --git a/src/app/+admin/admin-registries/metadata-registry/metadata-registry.actions.js b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.actions.js new file mode 100644 index 0000000000..540669f467 --- /dev/null +++ b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.actions.js @@ -0,0 +1,129 @@ +import { type } from '../../../shared/ngrx/type'; +/** + * For each action type in an action group, make a simple + * enum object for all of this group's action types. + * + * The 'type' utility function coerces strings into string + * literal types and runs a simple check to guarantee all + * action types in the application are unique. + */ +export var MetadataRegistryActionTypes = { + EDIT_SCHEMA: type('dspace/metadata-registry/EDIT_SCHEMA'), + CANCEL_EDIT_SCHEMA: type('dspace/metadata-registry/CANCEL_SCHEMA'), + SELECT_SCHEMA: type('dspace/metadata-registry/SELECT_SCHEMA'), + DESELECT_SCHEMA: type('dspace/metadata-registry/DESELECT_SCHEMA'), + DESELECT_ALL_SCHEMA: type('dspace/metadata-registry/DESELECT_ALL_SCHEMA'), + EDIT_FIELD: type('dspace/metadata-registry/EDIT_FIELD'), + CANCEL_EDIT_FIELD: type('dspace/metadata-registry/CANCEL_FIELD'), + SELECT_FIELD: type('dspace/metadata-registry/SELECT_FIELD'), + DESELECT_FIELD: type('dspace/metadata-registry/DESELECT_FIELD'), + DESELECT_ALL_FIELD: type('dspace/metadata-registry/DESELECT_ALL_FIELD') +}; +/* tslint:disable:max-classes-per-file */ +/** + * Used to edit a metadata schema in the metadata registry + */ +var MetadataRegistryEditSchemaAction = /** @class */ (function () { + function MetadataRegistryEditSchemaAction(registry) { + this.type = MetadataRegistryActionTypes.EDIT_SCHEMA; + this.schema = registry; + } + return MetadataRegistryEditSchemaAction; +}()); +export { MetadataRegistryEditSchemaAction }; +/** + * Used to cancel the editing of a metadata schema in the metadata registry + */ +var MetadataRegistryCancelSchemaAction = /** @class */ (function () { + function MetadataRegistryCancelSchemaAction() { + this.type = MetadataRegistryActionTypes.CANCEL_EDIT_SCHEMA; + } + return MetadataRegistryCancelSchemaAction; +}()); +export { MetadataRegistryCancelSchemaAction }; +/** + * Used to select a single metadata schema in the metadata registry + */ +var MetadataRegistrySelectSchemaAction = /** @class */ (function () { + function MetadataRegistrySelectSchemaAction(registry) { + this.type = MetadataRegistryActionTypes.SELECT_SCHEMA; + this.schema = registry; + } + return MetadataRegistrySelectSchemaAction; +}()); +export { MetadataRegistrySelectSchemaAction }; +/** + * Used to deselect a single metadata schema in the metadata registry + */ +var MetadataRegistryDeselectSchemaAction = /** @class */ (function () { + function MetadataRegistryDeselectSchemaAction(registry) { + this.type = MetadataRegistryActionTypes.DESELECT_SCHEMA; + this.schema = registry; + } + return MetadataRegistryDeselectSchemaAction; +}()); +export { MetadataRegistryDeselectSchemaAction }; +/** + * Used to deselect all metadata schemas in the metadata registry + */ +var MetadataRegistryDeselectAllSchemaAction = /** @class */ (function () { + function MetadataRegistryDeselectAllSchemaAction() { + this.type = MetadataRegistryActionTypes.DESELECT_ALL_SCHEMA; + } + return MetadataRegistryDeselectAllSchemaAction; +}()); +export { MetadataRegistryDeselectAllSchemaAction }; +/** + * Used to edit a metadata field in the metadata registry + */ +var MetadataRegistryEditFieldAction = /** @class */ (function () { + function MetadataRegistryEditFieldAction(registry) { + this.type = MetadataRegistryActionTypes.EDIT_FIELD; + this.field = registry; + } + return MetadataRegistryEditFieldAction; +}()); +export { MetadataRegistryEditFieldAction }; +/** + * Used to cancel the editing of a metadata field in the metadata registry + */ +var MetadataRegistryCancelFieldAction = /** @class */ (function () { + function MetadataRegistryCancelFieldAction() { + this.type = MetadataRegistryActionTypes.CANCEL_EDIT_FIELD; + } + return MetadataRegistryCancelFieldAction; +}()); +export { MetadataRegistryCancelFieldAction }; +/** + * Used to select a single metadata field in the metadata registry + */ +var MetadataRegistrySelectFieldAction = /** @class */ (function () { + function MetadataRegistrySelectFieldAction(registry) { + this.type = MetadataRegistryActionTypes.SELECT_FIELD; + this.field = registry; + } + return MetadataRegistrySelectFieldAction; +}()); +export { MetadataRegistrySelectFieldAction }; +/** + * Used to deselect a single metadata field in the metadata registry + */ +var MetadataRegistryDeselectFieldAction = /** @class */ (function () { + function MetadataRegistryDeselectFieldAction(registry) { + this.type = MetadataRegistryActionTypes.DESELECT_FIELD; + this.field = registry; + } + return MetadataRegistryDeselectFieldAction; +}()); +export { MetadataRegistryDeselectFieldAction }; +/** + * Used to deselect all metadata fields in the metadata registry + */ +var MetadataRegistryDeselectAllFieldAction = /** @class */ (function () { + function MetadataRegistryDeselectAllFieldAction() { + this.type = MetadataRegistryActionTypes.DESELECT_ALL_FIELD; + } + return MetadataRegistryDeselectAllFieldAction; +}()); +export { MetadataRegistryDeselectAllFieldAction }; +//# sourceMappingURL=metadata-registry.actions.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-registries/metadata-registry/metadata-registry.actions.js.map b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.actions.js.map new file mode 100644 index 0000000000..4cc11db8c4 --- /dev/null +++ b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata-registry.actions.js","sourceRoot":"","sources":["metadata-registry.actions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAIjD;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,2BAA2B,GAAG;IAEzC,WAAW,EAAE,IAAI,CAAC,sCAAsC,CAAC;IACzD,kBAAkB,EAAE,IAAI,CAAC,wCAAwC,CAAC;IAClE,aAAa,EAAE,IAAI,CAAC,wCAAwC,CAAC;IAC7D,eAAe,EAAE,IAAI,CAAC,0CAA0C,CAAC;IACjE,mBAAmB,EAAE,IAAI,CAAC,8CAA8C,CAAC;IAEzE,UAAU,EAAE,IAAI,CAAC,qCAAqC,CAAC;IACvD,iBAAiB,EAAE,IAAI,CAAC,uCAAuC,CAAC;IAChE,YAAY,EAAE,IAAI,CAAC,uCAAuC,CAAC;IAC3D,cAAc,EAAE,IAAI,CAAC,yCAAyC,CAAC;IAC/D,kBAAkB,EAAE,IAAI,CAAC,6CAA6C,CAAC;CACxE,CAAC;AAEF,yCAAyC;AACzC;;GAEG;AACH;IAKE,0CAAY,QAAwB;QAJpC,SAAI,GAAG,2BAA2B,CAAC,WAAW,CAAC;QAK7C,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;IACzB,CAAC;IACH,uCAAC;AAAD,CAAC,AARD,IAQC;;A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;;AAED;;GAEG;AACH;IAAA;QACE,SAAI,GAAG,2BAA2B,CAAC,kBAAkB,CAAC;IACxD,CAAC;IAAD,6CAAC;AAAD,CAAC,AAFD,IAEC"} \ No newline at end of file diff --git a/src/app/+admin/admin-registries/metadata-registry/metadata-registry.component.js b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.component.js new file mode 100644 index 0000000000..e7375bc94a --- /dev/null +++ b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.component.js @@ -0,0 +1,161 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { RegistryService } from '../../../core/registry/registry.service'; +import { combineLatest as observableCombineLatest } from 'rxjs'; +import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; +import { map, take } from 'rxjs/operators'; +import { hasValue } from '../../../shared/empty.util'; +import { zip } from 'rxjs/internal/observable/zip'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { Router } from '@angular/router'; +import { TranslateService } from '@ngx-translate/core'; +var MetadataRegistryComponent = /** @class */ (function () { + function MetadataRegistryComponent(registryService, notificationsService, router, translateService) { + this.registryService = registryService; + this.notificationsService = notificationsService; + this.router = router; + this.translateService = translateService; + /** + * Pagination config used to display the list of metadata schemas + */ + this.config = Object.assign(new PaginationComponentOptions(), { + id: 'registry-metadataschemas-pagination', + pageSize: 25 + }); + this.updateSchemas(); + } + /** + * Event triggered when the user changes page + * @param event + */ + MetadataRegistryComponent.prototype.onPageChange = function (event) { + this.config.currentPage = event; + this.updateSchemas(); + }; + /** + * Update the list of schemas by fetching it from the rest api or cache + */ + MetadataRegistryComponent.prototype.updateSchemas = function () { + this.metadataSchemas = this.registryService.getMetadataSchemas(this.config); + }; + /** + * Force-update the list of schemas by first clearing the cache related to metadata schemas, then performing + * a new REST call + */ + MetadataRegistryComponent.prototype.forceUpdateSchemas = function () { + this.registryService.clearMetadataSchemaRequests().subscribe(); + this.updateSchemas(); + }; + /** + * Start editing the selected metadata schema + * @param schema + */ + MetadataRegistryComponent.prototype.editSchema = function (schema) { + var _this = this; + this.getActiveSchema().pipe(take(1)).subscribe(function (activeSchema) { + if (schema === activeSchema) { + _this.registryService.cancelEditMetadataSchema(); + } + else { + _this.registryService.editMetadataSchema(schema); + } + }); + }; + /** + * Checks whether the given metadata schema is active (being edited) + * @param schema + */ + MetadataRegistryComponent.prototype.isActive = function (schema) { + return this.getActiveSchema().pipe(map(function (activeSchema) { return schema === activeSchema; })); + }; + /** + * Gets the active metadata schema (being edited) + */ + MetadataRegistryComponent.prototype.getActiveSchema = function () { + return this.registryService.getActiveMetadataSchema(); + }; + /** + * Select a metadata schema within the list (checkbox) + * @param schema + * @param event + */ + MetadataRegistryComponent.prototype.selectMetadataSchema = function (schema, event) { + event.target.checked ? + this.registryService.selectMetadataSchema(schema) : + this.registryService.deselectMetadataSchema(schema); + }; + /** + * Checks whether a given metadata schema is selected in the list (checkbox) + * @param schema + */ + MetadataRegistryComponent.prototype.isSelected = function (schema) { + return this.registryService.getSelectedMetadataSchemas().pipe(map(function (schemas) { return schemas.find(function (selectedSchema) { return selectedSchema === schema; }) != null; })); + }; + /** + * Delete all the selected metadata schemas + */ + MetadataRegistryComponent.prototype.deleteSchemas = function () { + var _this = this; + this.registryService.getSelectedMetadataSchemas().pipe(take(1)).subscribe(function (schemas) { + var tasks$ = []; + for (var _i = 0, schemas_1 = schemas; _i < schemas_1.length; _i++) { + var schema = schemas_1[_i]; + if (hasValue(schema.id)) { + tasks$.push(_this.registryService.deleteMetadataSchema(schema.id)); + } + } + zip.apply(void 0, tasks$).subscribe(function (responses) { + var successResponses = responses.filter(function (response) { return response.isSuccessful; }); + var failedResponses = responses.filter(function (response) { return !response.isSuccessful; }); + if (successResponses.length > 0) { + _this.showNotification(true, successResponses.length); + } + if (failedResponses.length > 0) { + _this.showNotification(false, failedResponses.length); + } + _this.registryService.deselectAllMetadataSchema(); + _this.registryService.cancelEditMetadataSchema(); + _this.forceUpdateSchemas(); + }); + }); + }; + /** + * Show notifications for an amount of deleted metadata schemas + * @param success Whether or not the notification should be a success message (error message when false) + * @param amount The amount of deleted metadata schemas + */ + MetadataRegistryComponent.prototype.showNotification = function (success, amount) { + var _this = this; + var prefix = 'admin.registries.schema.notification'; + var suffix = success ? 'success' : 'failure'; + var messages = observableCombineLatest(this.translateService.get(success ? prefix + "." + suffix : prefix + "." + suffix), this.translateService.get(prefix + ".deleted." + suffix, { amount: amount })); + messages.subscribe(function (_a) { + var head = _a[0], content = _a[1]; + if (success) { + _this.notificationsService.success(head, content); + } + else { + _this.notificationsService.error(head, content); + } + }); + }; + MetadataRegistryComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-metadata-registry', + templateUrl: './metadata-registry.component.html', + styleUrls: ['./metadata-registry.component.scss'] + }) + /** + * A component used for managing all existing metadata schemas within the repository. + * The admin can create, edit or delete metadata schemas here. + */ + , + tslib_1.__metadata("design:paramtypes", [RegistryService, + NotificationsService, + Router, + TranslateService]) + ], MetadataRegistryComponent); + return MetadataRegistryComponent; +}()); +export { MetadataRegistryComponent }; +//# sourceMappingURL=metadata-registry.component.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-registries/metadata-registry/metadata-registry.component.js.map b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.component.js.map new file mode 100644 index 0000000000..4709bbe3ae --- /dev/null +++ b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata-registry.component.js","sourceRoot":"","sources":["metadata-registry.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAc,aAAa,IAAI,uBAAuB,EAAE,MAAM,MAAM,CAAC;AAI5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,+DAA+D,CAAC;AAC3G,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAA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OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QAC/C,IAAM,QAAQ,GAAG,uBAAuB,CACtC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAI,MAAM,SAAI,MAAQ,CAAC,CAAC,CAAI,MAAM,SAAI,MAAQ,CAAC,EAClF,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAI,MAAM,iBAAY,MAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAC7E,CAAC;QACF,QAAQ,CAAC,SAAS,CAAC,UAAC,EAAe;gBAAd,YAAI,EAAE,eAAO;YAChC,IAAI,OAAO,EAAE;gBACX,KAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;aACjD;iBAAM;gBACL,KAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;aAC/C;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAnJU,yBAAyB;QATrC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,WAAW,EAAE,oCAAoC;YACjD,SAAS,EAAE,CAAC,oCAAoC,CAAC;SAClD,CAAC;QACF;;;WAGG;;iDAgBoC,eAAe;YACV,oBAAoB;YAClC,MAAM;YACI,gBAAgB;OAlB3C,yBAAyB,CAoJrC;IAAD,gCAAC;CAAA,AApJD,IAoJC;SApJY,yBAAyB"} \ No newline at end of file diff --git a/src/app/+admin/admin-registries/metadata-registry/metadata-registry.reducers.js b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.reducers.js new file mode 100644 index 0000000000..338a4ef513 --- /dev/null +++ b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.reducers.js @@ -0,0 +1,73 @@ +import { MetadataRegistryActionTypes } from './metadata-registry.actions'; +/** + * The initial state. + */ +var initialState = { + editSchema: null, + selectedSchemas: [], + editField: null, + selectedFields: [] +}; +/** + * Reducer that handles MetadataRegistryActions to modify metadata schema and/or field states + * @param state The current MetadataRegistryState + * @param action The MetadataRegistryAction to perform on the state + */ +export function metadataRegistryReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case MetadataRegistryActionTypes.EDIT_SCHEMA: { + return Object.assign({}, state, { + editSchema: action.schema + }); + } + case MetadataRegistryActionTypes.CANCEL_EDIT_SCHEMA: { + return Object.assign({}, state, { + editSchema: null + }); + } + case MetadataRegistryActionTypes.SELECT_SCHEMA: { + return Object.assign({}, state, { + selectedSchemas: state.selectedSchemas.concat([action.schema]) + }); + } + case MetadataRegistryActionTypes.DESELECT_SCHEMA: { + return Object.assign({}, state, { + selectedSchemas: state.selectedSchemas.filter(function (selectedSchema) { return selectedSchema !== action.schema; }) + }); + } + case MetadataRegistryActionTypes.DESELECT_ALL_SCHEMA: { + return Object.assign({}, state, { + selectedSchemas: [] + }); + } + case MetadataRegistryActionTypes.EDIT_FIELD: { + return Object.assign({}, state, { + editField: action.field + }); + } + case MetadataRegistryActionTypes.CANCEL_EDIT_FIELD: { + return Object.assign({}, state, { + editField: null + }); + } + case MetadataRegistryActionTypes.SELECT_FIELD: { + return Object.assign({}, state, { + selectedFields: state.selectedFields.concat([action.field]) + }); + } + case MetadataRegistryActionTypes.DESELECT_FIELD: { + return Object.assign({}, state, { + selectedFields: state.selectedFields.filter(function (selectedField) { return selectedField !== action.field; }) + }); + } + case MetadataRegistryActionTypes.DESELECT_ALL_FIELD: { + return Object.assign({}, state, { + selectedFields: [] + }); + } + default: + return state; + } +} +//# sourceMappingURL=metadata-registry.reducers.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-registries/metadata-registry/metadata-registry.reducers.js.map b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.reducers.js.map new file mode 100644 index 0000000000..db41e0cbf1 --- /dev/null +++ b/src/app/+admin/admin-registries/metadata-registry/metadata-registry.reducers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata-registry.reducers.js","sourceRo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AAE,EAAE,KAAK,EAAE;gBAC9B,eAAe,EAAE,EAAE;aACpB,CAAC,CAAC;SACJ;QAED,KAAK,2BAA2B,CAAC,UAAU,CAAC,CAAC;YAC3C,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,SAAS,EAAG,MAA0C,CAAC,KAAK;aAC7D,CAAC,CAAC;SACJ;QAED,KAAK,2BAA2B,CAAC,iBAAiB,CAAC,CAAC;YAClD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;SACJ;QAED,KAAK,2BAA2B,CAAC,YAAY,CAAC,CAAC;YAC7C,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,cAAc,EAAM,KAAK,CAAC,cAAc,SAAG,MAA4C,CAAC,KAAK,EAAC;aAC/F,CAAC,CAAC;SACJ;QAED,KAAK,2BAA2B,CAAC,cAAc,CAAC,CAAC;YAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CACzC,UAAC,aAAa,IAAK,OAAA,aAAa,KAAM,MAA8C,CAAC,KAAK,EAAvE,CAAuE,CAC3F;aACF,CAAC,CAAC;SACJ;QAED,KAAK,2BAA2B,CAAC,kBAAkB,CAAC,CAAC;YACnD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,cAAc,EAAE,EAAE;aACnB,CAAC,CAAC;SACJ;QAED;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC"} \ No newline at end of file diff --git a/src/app/+admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.js b/src/app/+admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.js new file mode 100644 index 0000000000..59985cbe3e --- /dev/null +++ b/src/app/+admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.js @@ -0,0 +1,148 @@ +import * as tslib_1 from "tslib"; +import { Component, EventEmitter, Output } from '@angular/core'; +import { DynamicInputModel } from '@ng-dynamic-forms/core'; +import { RegistryService } from '../../../../core/registry/registry.service'; +import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service'; +import { take } from 'rxjs/operators'; +import { MetadataSchema } from '../../../../core/metadata/metadataschema.model'; +import { TranslateService } from '@ngx-translate/core'; +import { combineLatest } from 'rxjs/internal/observable/combineLatest'; +var MetadataSchemaFormComponent = /** @class */ (function () { + function MetadataSchemaFormComponent(registryService, formBuilderService, translateService) { + this.registryService = registryService; + this.formBuilderService = formBuilderService; + this.translateService = translateService; + /** + * A unique id used for ds-form + */ + this.formId = 'metadata-schema-form'; + /** + * The prefix for all messages related to this form + */ + this.messagePrefix = 'admin.registries.metadata.form'; + /** + * Layout used for structuring the form inputs + */ + this.formLayout = { + name: { + grid: { + host: 'col col-sm-6 d-inline-block' + } + }, + namespace: { + grid: { + host: 'col col-sm-6 d-inline-block' + } + } + }; + /** + * An EventEmitter that's fired whenever the form is being submitted + */ + this.submitForm = new EventEmitter(); + } + MetadataSchemaFormComponent.prototype.ngOnInit = function () { + var _this = this; + combineLatest(this.translateService.get(this.messagePrefix + ".name"), this.translateService.get(this.messagePrefix + ".namespace")).subscribe(function (_a) { + var name = _a[0], namespace = _a[1]; + _this.name = new DynamicInputModel({ + id: 'name', + label: name, + name: 'name', + validators: { + required: null, + pattern: '^[^ ,_]{1,32}$' + }, + required: true, + }); + _this.namespace = new DynamicInputModel({ + id: 'namespace', + label: namespace, + name: 'namespace', + validators: { + required: null, + }, + required: true, + }); + _this.formModel = [ + _this.namespace, + _this.name + ]; + _this.formGroup = _this.formBuilderService.createFormGroup(_this.formModel); + _this.registryService.getActiveMetadataSchema().subscribe(function (schema) { + _this.formGroup.patchValue({ + name: schema != null ? schema.prefix : '', + namespace: schema != null ? schema.namespace : '' + }); + }); + }); + }; + /** + * Stop editing the currently selected metadata schema + */ + MetadataSchemaFormComponent.prototype.onCancel = function () { + this.registryService.cancelEditMetadataSchema(); + }; + /** + * Submit the form + * When the schema has an id attached -> Edit the schema + * When the schema has no id attached -> Create new schema + * Emit the updated/created schema using the EventEmitter submitForm + */ + MetadataSchemaFormComponent.prototype.onSubmit = function () { + var _this = this; + this.registryService.getActiveMetadataSchema().pipe(take(1)).subscribe(function (schema) { + var values = { + prefix: _this.name.value, + namespace: _this.namespace.value + }; + if (schema == null) { + _this.registryService.createOrUpdateMetadataSchema(Object.assign(new MetadataSchema(), values)).subscribe(function (newSchema) { + _this.submitForm.emit(newSchema); + }); + } + else { + _this.registryService.createOrUpdateMetadataSchema(Object.assign(new MetadataSchema(), { + id: schema.id, + prefix: (values.prefix ? values.prefix : schema.prefix), + namespace: (values.namespace ? values.namespace : schema.namespace) + })).subscribe(function (updatedSchema) { + _this.submitForm.emit(updatedSchema); + }); + } + _this.clearFields(); + }); + }; + /** + * Reset all input-fields to be empty + */ + MetadataSchemaFormComponent.prototype.clearFields = function () { + this.formGroup.patchValue({ + prefix: '', + namespace: '' + }); + }; + /** + * Cancel the current edit when component is destroyed + */ + MetadataSchemaFormComponent.prototype.ngOnDestroy = function () { + this.onCancel(); + }; + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], MetadataSchemaFormComponent.prototype, "submitForm", void 0); + MetadataSchemaFormComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-metadata-schema-form', + templateUrl: './metadata-schema-form.component.html' + }) + /** + * A form used for creating and editing metadata schemas + */ + , + tslib_1.__metadata("design:paramtypes", [RegistryService, FormBuilderService, TranslateService]) + ], MetadataSchemaFormComponent); + return MetadataSchemaFormComponent; +}()); +export { MetadataSchemaFormComponent }; +//# sourceMappingURL=metadata-schema-form.component.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.js.map b/src/app/+admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.js.map new file mode 100644 index 0000000000..c5afef8b25 --- /dev/null +++ b/src/app/+admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata-schema-form.component.js","sourceRoot":"","sources":["metadata-schema-form.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAqB,MAAM,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAIL,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC1F,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AASvE;IAqDE,qCAAmB,eAAgC,EAAU,kBAAsC,EAAU,gBAAkC;QAA5H,oBAAe,GAAf,eAAe,CAAiB;QAAU,uBAAkB,GAAlB,kBAAkB,CAAoB;QAAU,qBAAgB,GAAhB,gBAAgB,CAAkB;QAnD/I;;WAEG;QACH,WAAM,GAAG,sBAAsB,CAAC;QAEhC;;WAEG;QACH,kBAAa,GAAG,gCAAgC,CAAC;QAiBjD;;WAEG;QACH,eAAU,GAAsB;YAC9B,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ,IAAI,EAAE,6BAA6B;iBACpC;aACF;YACD,SAAS,EAAE;gBACT,IAAI,EAAE;oBACJ,IAAI,EAAE,6BAA6B;iBACpC;aACF;SACF,CAAC;QAOF;;WAEG;QACO,eAAU,GAAsB,IAAI,YAAY,EAAE,CAAC;IAG7D,CAAC;IAED,8CAAQ,GAAR;QAAA,iBAoCC;QAnCC,aAAa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AW,EAAE,CAAC;QACrB,CAAC,CACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,iDAAW,GAAX;QACE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;YACxB,MAAM,EAAE,EAAE;YACV,SAAS,EAAE,EAAE;SACd,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,iDAAW,GAAX;QACE,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAhGS;QAAT,MAAM,EAAE;0CAAa,YAAY;mEAA2B;IAnDlD,2BAA2B;QAPvC,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,WAAW,EAAE,uCAAuC;SACrD,CAAC;QACF;;WAEG;;iDAsDmC,eAAe,EAA8B,kBAAkB,EAA4B,gBAAgB;OArDpI,2BAA2B,CAoJvC;IAAD,kCAAC;CAAA,AApJD,IAoJC;SApJY,2BAA2B"} \ No newline at end of file diff --git a/src/app/+admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.js b/src/app/+admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.js new file mode 100644 index 0000000000..08e6ee00f3 --- /dev/null +++ b/src/app/+admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.js @@ -0,0 +1,172 @@ +import * as tslib_1 from "tslib"; +import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { MetadataSchema } from '../../../../core/metadata/metadataschema.model'; +import { DynamicInputModel } from '@ng-dynamic-forms/core'; +import { RegistryService } from '../../../../core/registry/registry.service'; +import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service'; +import { MetadataField } from '../../../../core/metadata/metadatafield.model'; +import { take } from 'rxjs/operators'; +import { TranslateService } from '@ngx-translate/core'; +import { combineLatest } from 'rxjs/internal/observable/combineLatest'; +var MetadataFieldFormComponent = /** @class */ (function () { + function MetadataFieldFormComponent(registryService, formBuilderService, translateService) { + this.registryService = registryService; + this.formBuilderService = formBuilderService; + this.translateService = translateService; + /** + * A unique id used for ds-form + */ + this.formId = 'metadata-field-form'; + /** + * The prefix for all messages related to this form + */ + this.messagePrefix = 'admin.registries.schema.form'; + /** + * Layout used for structuring the form inputs + */ + this.formLayout = { + element: { + grid: { + host: 'col col-sm-6 d-inline-block' + } + }, + qualifier: { + grid: { + host: 'col col-sm-6 d-inline-block' + } + }, + scopeNote: { + grid: { + host: 'col col-sm-12 d-inline-block' + } + } + }; + /** + * An EventEmitter that's fired whenever the form is being submitted + */ + this.submitForm = new EventEmitter(); + } + /** + * Initialize the component, setting up the necessary Models for the dynamic form + */ + MetadataFieldFormComponent.prototype.ngOnInit = function () { + var _this = this; + combineLatest(this.translateService.get(this.messagePrefix + ".element"), this.translateService.get(this.messagePrefix + ".qualifier"), this.translateService.get(this.messagePrefix + ".scopenote")).subscribe(function (_a) { + var element = _a[0], qualifier = _a[1], scopenote = _a[2]; + _this.element = new DynamicInputModel({ + id: 'element', + label: element, + name: 'element', + validators: { + required: null, + }, + required: true, + }); + _this.qualifier = new DynamicInputModel({ + id: 'qualifier', + label: qualifier, + name: 'qualifier', + required: false, + }); + _this.scopeNote = new DynamicInputModel({ + id: 'scopeNote', + label: scopenote, + name: 'scopeNote', + required: false, + }); + _this.formModel = [ + _this.element, + _this.qualifier, + _this.scopeNote + ]; + _this.formGroup = _this.formBuilderService.createFormGroup(_this.formModel); + _this.registryService.getActiveMetadataField().subscribe(function (field) { + _this.formGroup.patchValue({ + element: field != null ? field.element : '', + qualifier: field != null ? field.qualifier : '', + scopeNote: field != null ? field.scopeNote : '' + }); + }); + }); + }; + /** + * Stop editing the currently selected metadata field + */ + MetadataFieldFormComponent.prototype.onCancel = function () { + this.registryService.cancelEditMetadataField(); + }; + /** + * Submit the form + * When the field has an id attached -> Edit the field + * When the field has no id attached -> Create new field + * Emit the updated/created field using the EventEmitter submitForm + */ + MetadataFieldFormComponent.prototype.onSubmit = function () { + var _this = this; + this.registryService.getActiveMetadataField().pipe(take(1)).subscribe(function (field) { + var values = { + schema: _this.metadataSchema, + element: _this.element.value, + qualifier: _this.qualifier.value, + scopeNote: _this.scopeNote.value + }; + if (field == null) { + _this.registryService.createOrUpdateMetadataField(Object.assign(new MetadataField(), values)).subscribe(function (newField) { + _this.submitForm.emit(newField); + }); + } + else { + _this.registryService.createOrUpdateMetadataField(Object.assign(new MetadataField(), { + id: field.id, + schema: _this.metadataSchema, + element: (values.element ? values.element : field.element), + qualifier: (values.qualifier ? values.qualifier : field.qualifier), + scopeNote: (values.scopeNote ? values.scopeNote : field.scopeNote) + })).subscribe(function (updatedField) { + _this.submitForm.emit(updatedField); + }); + } + _this.clearFields(); + }); + }; + /** + * Reset all input-fields to be empty + */ + MetadataFieldFormComponent.prototype.clearFields = function () { + this.formGroup.patchValue({ + element: '', + qualifier: '', + scopeNote: '' + }); + }; + /** + * Cancel the current edit when component is destroyed + */ + MetadataFieldFormComponent.prototype.ngOnDestroy = function () { + this.onCancel(); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", MetadataSchema) + ], MetadataFieldFormComponent.prototype, "metadataSchema", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], MetadataFieldFormComponent.prototype, "submitForm", void 0); + MetadataFieldFormComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-metadata-field-form', + templateUrl: './metadata-field-form.component.html' + }) + /** + * A form used for creating and editing metadata fields + */ + , + tslib_1.__metadata("design:paramtypes", [RegistryService, + FormBuilderService, + TranslateService]) + ], MetadataFieldFormComponent); + return MetadataFieldFormComponent; +}()); +export { MetadataFieldFormComponent }; +//# sourceMappingURL=metadata-field-form.component.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.js.map b/src/app/+admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.js.map new file mode 100644 index 0000000000..2740582d91 --- /dev/null +++ b/src/app/+admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.js.map @@ -0,0 +1 @@ +{"version":3,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.js b/src/app/+admin/admin-registries/metadata-schema/metadata-schema.component.js new file mode 100644 index 0000000000..6af9dcde0a --- /dev/null +++ b/src/app/+admin/admin-registries/metadata-schema/metadata-schema.component.js @@ -0,0 +1,182 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { RegistryService } from '../../../core/registry/registry.service'; +import { ActivatedRoute, Router } from '@angular/router'; +import { combineLatest as observableCombineLatest } from 'rxjs'; +import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; +import { map, take } from 'rxjs/operators'; +import { hasValue } from '../../../shared/empty.util'; +import { zip } from 'rxjs/internal/observable/zip'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { TranslateService } from '@ngx-translate/core'; +var MetadataSchemaComponent = /** @class */ (function () { + function MetadataSchemaComponent(registryService, route, notificationsService, router, translateService) { + this.registryService = registryService; + this.route = route; + this.notificationsService = notificationsService; + this.router = router; + this.translateService = translateService; + /** + * Pagination config used to display the list of metadata fields + */ + this.config = Object.assign(new PaginationComponentOptions(), { + id: 'registry-metadatafields-pagination', + pageSize: 25, + pageSizeOptions: [25, 50, 100, 200] + }); + } + MetadataSchemaComponent.prototype.ngOnInit = function () { + var _this = this; + this.route.params.subscribe(function (params) { + _this.initialize(params); + }); + }; + /** + * Initialize the component using the params within the url (schemaName) + * @param params + */ + MetadataSchemaComponent.prototype.initialize = function (params) { + this.metadataSchema = this.registryService.getMetadataSchemaByName(params.schemaName); + this.updateFields(); + }; + /** + * Event triggered when the user changes page + * @param event + */ + MetadataSchemaComponent.prototype.onPageChange = function (event) { + this.config.currentPage = event; + this.updateFields(); + }; + /** + * Update the list of fields by fetching it from the rest api or cache + */ + MetadataSchemaComponent.prototype.updateFields = function () { + var _this = this; + this.metadataSchema.subscribe(function (schemaData) { + var schema = schemaData.payload; + _this.metadataFields = _this.registryService.getMetadataFieldsBySchema(schema, _this.config); + _this.namespace = { namespace: schemaData.payload.namespace }; + }); + }; + /** + * Force-update the list of fields by first clearing the cache related to metadata fields, then performing + * a new REST call + */ + MetadataSchemaComponent.prototype.forceUpdateFields = function () { + this.registryService.clearMetadataFieldRequests().subscribe(); + this.updateFields(); + }; + /** + * Start editing the selected metadata field + * @param field + */ + MetadataSchemaComponent.prototype.editField = function (field) { + var _this = this; + this.getActiveField().pipe(take(1)).subscribe(function (activeField) { + if (field === activeField) { + _this.registryService.cancelEditMetadataField(); + } + else { + _this.registryService.editMetadataField(field); + } + }); + }; + /** + * Checks whether the given metadata field is active (being edited) + * @param field + */ + MetadataSchemaComponent.prototype.isActive = function (field) { + return this.getActiveField().pipe(map(function (activeField) { return field === activeField; })); + }; + /** + * Gets the active metadata field (being edited) + */ + MetadataSchemaComponent.prototype.getActiveField = function () { + return this.registryService.getActiveMetadataField(); + }; + /** + * Select a metadata field within the list (checkbox) + * @param field + * @param event + */ + MetadataSchemaComponent.prototype.selectMetadataField = function (field, event) { + event.target.checked ? + this.registryService.selectMetadataField(field) : + this.registryService.deselectMetadataField(field); + }; + /** + * Checks whether a given metadata field is selected in the list (checkbox) + * @param field + */ + MetadataSchemaComponent.prototype.isSelected = function (field) { + return this.registryService.getSelectedMetadataFields().pipe(map(function (fields) { return fields.find(function (selectedField) { return selectedField === field; }) != null; })); + }; + /** + * Delete all the selected metadata fields + */ + MetadataSchemaComponent.prototype.deleteFields = function () { + var _this = this; + this.registryService.getSelectedMetadataFields().pipe(take(1)).subscribe(function (fields) { + var tasks$ = []; + for (var _i = 0, fields_1 = fields; _i < fields_1.length; _i++) { + var field = fields_1[_i]; + if (hasValue(field.id)) { + tasks$.push(_this.registryService.deleteMetadataField(field.id)); + } + } + zip.apply(void 0, tasks$).subscribe(function (responses) { + var successResponses = responses.filter(function (response) { return response.isSuccessful; }); + var failedResponses = responses.filter(function (response) { return !response.isSuccessful; }); + if (successResponses.length > 0) { + _this.showNotification(true, successResponses.length); + } + if (failedResponses.length > 0) { + _this.showNotification(false, failedResponses.length); + } + _this.registryService.deselectAllMetadataField(); + _this.registryService.cancelEditMetadataField(); + _this.forceUpdateFields(); + }); + }); + }; + /** + * Show notifications for an amount of deleted metadata fields + * @param success Whether or not the notification should be a success message (error message when false) + * @param amount The amount of deleted metadata fields + */ + MetadataSchemaComponent.prototype.showNotification = function (success, amount) { + var _this = this; + var prefix = 'admin.registries.schema.notification'; + var suffix = success ? 'success' : 'failure'; + var messages = observableCombineLatest(this.translateService.get(success ? prefix + "." + suffix : prefix + "." + suffix), this.translateService.get(prefix + ".field.deleted." + suffix, { amount: amount })); + messages.subscribe(function (_a) { + var head = _a[0], content = _a[1]; + if (success) { + _this.notificationsService.success(head, content); + } + else { + _this.notificationsService.error(head, content); + } + }); + }; + MetadataSchemaComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-metadata-schema', + templateUrl: './metadata-schema.component.html', + styleUrls: ['./metadata-schema.component.scss'] + }) + /** + * A component used for managing all existing metadata fields within the current metadata schema. + * The admin can create, edit or delete metadata fields here. + */ + , + tslib_1.__metadata("design:paramtypes", [RegistryService, + ActivatedRoute, + NotificationsService, + Router, + TranslateService]) + ], MetadataSchemaComponent); + return MetadataSchemaComponent; +}()); +export { MetadataSchemaComponent }; +//# sourceMappingURL=metadata-schema.component.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-registries/metadata-schema/metadata-schema.component.js.map b/src/app/+admin/admin-registries/metadata-schema/metadata-schema.component.js.map new file mode 100644 index 0000000000..3cacdfd42f --- /dev/null +++ b/src/app/+admin/admin-registries/metadata-schema/metadata-schema.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata-schema.component.js","sourceRoot":"","sources":["metadata-schema.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAc,aAAa,IAAI,uBAAuB,EAAE,MAAM,MAAM,CAA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AC,oBAAoB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;aACjD;iBAAM;gBACL,KAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;aAC/C;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAlLU,uBAAuB;QATnC,SAAS,CAAC;YACT,QAAQ,EAAE,oBAAoB;YAC9B,WAAW,EAAE,kCAAkC;YAC/C,SAAS,EAAE,CAAC,kCAAkC,CAAC;SAChD,CAAC;QACF;;;WAGG;;iDA2BoC,eAAe;YACzB,cAAc;YACC,oBAAoB;YAClC,MAAM;YACI,gBAAgB;OA9B3C,uBAAuB,CAmLnC;IAAD,8BAAC;CAAA,AAnLD,IAmLC;SAnLY,uBAAuB"} \ No newline at end of file diff --git a/src/app/+admin/admin-routing.module.js b/src/app/+admin/admin-routing.module.js new file mode 100644 index 0000000000..07919572fd --- /dev/null +++ b/src/app/+admin/admin-routing.module.js @@ -0,0 +1,22 @@ +import * as tslib_1 from "tslib"; +import { RouterModule } from '@angular/router'; +import { NgModule } from '@angular/core'; +var AdminRoutingModule = /** @class */ (function () { + function AdminRoutingModule() { + } + AdminRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { + path: 'registries', + loadChildren: './admin-registries/admin-registries.module#AdminRegistriesModule' + } + ]) + ] + }) + ], AdminRoutingModule); + return AdminRoutingModule; +}()); +export { AdminRoutingModule }; +//# sourceMappingURL=admin-routing.module.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-routing.module.js.map b/src/app/+admin/admin-routing.module.js.map new file mode 100644 index 0000000000..d54c058020 --- /dev/null +++ b/src/app/+admin/admin-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"admin-routing.module.js","sourceRoot":"","sources":["admin-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAYzC;IAAA;IAEA,CAAC;IAFY,kBAAkB;QAV9B,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB;wBACE,IAAI,EAAE,YAAY;wBAClB,YAAY,EAAE,kEAAkE;qBACjF;iBACF,CAAC;aACH;SACF,CAAC;OACW,kBAAkB,CAE9B;IAAD,yBAAC;CAAA,AAFD,IAEC;SAFY,kBAAkB"} \ No newline at end of file diff --git a/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.js b/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.js new file mode 100644 index 0000000000..659213e583 --- /dev/null +++ b/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.js @@ -0,0 +1,40 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject, Injector } from '@angular/core'; +import { MenuSectionComponent } from '../../../shared/menu/menu-section/menu-section.component'; +import { MenuID } from '../../../shared/menu/initial-menus-state'; +import { MenuService } from '../../../shared/menu/menu.service'; +import { rendersSectionForMenu } from '../../../shared/menu/menu-section.decorator'; +import { MenuSection } from '../../../shared/menu/menu.reducer'; +/** + * Represents a non-expandable section in the admin sidebar + */ +var AdminSidebarSectionComponent = /** @class */ (function (_super) { + tslib_1.__extends(AdminSidebarSectionComponent, _super); + function AdminSidebarSectionComponent(menuSection, menuService, injector) { + var _this = _super.call(this, menuSection, menuService, injector) || this; + _this.menuService = menuService; + _this.injector = injector; + /** + * This section resides in the Admin Sidebar + */ + _this.menuID = MenuID.ADMIN; + _this.itemModel = menuSection.model; + return _this; + } + AdminSidebarSectionComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + }; + AdminSidebarSectionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-admin-sidebar-section', + templateUrl: './admin-sidebar-section.component.html', + styleUrls: ['./admin-sidebar-section.component.scss'], + }), + rendersSectionForMenu(MenuID.ADMIN, false), + tslib_1.__param(0, Inject('sectionDataProvider')), + tslib_1.__metadata("design:paramtypes", [MenuSection, MenuService, Injector]) + ], AdminSidebarSectionComponent); + return AdminSidebarSectionComponent; +}(MenuSectionComponent)); +export { AdminSidebarSectionComponent }; +//# sourceMappingURL=admin-sidebar-section.component.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.js.map b/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.js.map new file mode 100644 index 0000000000..76944432ae --- /dev/null +++ b/src/app/+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"admin-sidebar-section.component.js","sourceRoot":"","sources":["admin-sidebar-section.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAU,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEpF,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE;;GAEG;AAQH;IAAkD,wDAAoB;IAOpE,sCAA2C,WAAwB,EAAY,WAAwB,EAAY,QAAkB;QAArI,YACE,kBAAM,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAC,SAE1C;QAH8E,iBAAW,GAAX,WAAW,CAAa;QAAY,cAAQ,GAAR,QAAQ,CAAU;QALrI;;WAEG;QACH,YAAM,GAAW,MAAM,CAAC,KAAK,CAAC;QAI5B,KAAI,CAAC,SAAS,GAAG,WAAW,CAAC,KAA0B,CAAC;;IAC1D,CAAC;IAED,+CAAQ,GAAR;QACE,iBAAM,QAAQ,WAAE,CAAC;IACnB,CAAC;IAdU,4BAA4B;QAPxC,SAAS,CAAC;YACT,QAAQ,EAAE,0BAA0B;YACpC,WAAW,EAAE,wCAAwC;YACrD,SAAS,EAAE,CAAC,wCAAwC,CAAC;SAEtD,CAAC;QACD,qBAAqB,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC;QAQ5B,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;iDAAc,WAAW,EAAyB,WAAW,EAAsB,QAAQ;OAP1H,4BAA4B,CAexC;IAAD,mCAAC;CAAA,AAfD,CAAkD,oBAAoB,GAerE;SAfY,4BAA4B"} \ No newline at end of file diff --git a/src/app/+admin/admin-sidebar/admin-sidebar.component.js b/src/app/+admin/admin-sidebar/admin-sidebar.component.js new file mode 100644 index 0000000000..0cd799b210 --- /dev/null +++ b/src/app/+admin/admin-sidebar/admin-sidebar.component.js @@ -0,0 +1,490 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector } from '@angular/core'; +import { slideHorizontal, slideSidebar } from '../../shared/animations/slide'; +import { CSSVariableService } from '../../shared/sass-helper/sass-helper.service'; +import { MenuService } from '../../shared/menu/menu.service'; +import { MenuID, MenuItemType } from '../../shared/menu/initial-menus-state'; +import { MenuComponent } from '../../shared/menu/menu.component'; +import { AuthService } from '../../core/auth/auth.service'; +import { first, map } from 'rxjs/operators'; +import { combineLatest as combineLatestObservable } from 'rxjs'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { CreateCommunityParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component'; +import { CreateCollectionParentSelectorComponent } from '../../shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component'; +import { EditItemSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component'; +import { EditCommunitySelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component'; +import { EditCollectionSelectorComponent } from '../../shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component'; +/** + * Component representing the admin sidebar + */ +var AdminSidebarComponent = /** @class */ (function (_super) { + tslib_1.__extends(AdminSidebarComponent, _super); + function AdminSidebarComponent(menuService, injector, variableService, authService, modalService) { + var _this = _super.call(this, menuService, injector) || this; + _this.menuService = menuService; + _this.injector = injector; + _this.variableService = variableService; + _this.authService = authService; + _this.modalService = modalService; + /** + * The menu ID of the Navbar is PUBLIC + * @type {MenuID.ADMIN} + */ + _this.menuID = MenuID.ADMIN; + /** + * Is true when the sidebar is open, is false when the sidebar is animating or closed + * @type {boolean} + */ + _this.sidebarOpen = true; // Open in UI, animation finished + /** + * Is true when the sidebar is closed, is false when the sidebar is animating or open + * @type {boolean} + */ + _this.sidebarClosed = !_this.sidebarOpen; // Closed in UI, animation finished + return _this; + } + /** + * Set and calculate all initial values of the instance variables + */ + AdminSidebarComponent.prototype.ngOnInit = function () { + var _this = this; + this.createMenu(); + _super.prototype.ngOnInit.call(this); + this.sidebarWidth = this.variableService.getVariable('sidebarItemsWidth'); + this.authService.isAuthenticated() + .subscribe(function (loggedIn) { + if (loggedIn) { + _this.menuService.showMenu(_this.menuID); + } + }); + this.menuCollapsed.pipe(first()) + .subscribe(function (collapsed) { + _this.sidebarOpen = !collapsed; + _this.sidebarClosed = collapsed; + }); + this.sidebarExpanded = combineLatestObservable(this.menuCollapsed, this.menuPreviewCollapsed) + .pipe(map(function (_a) { + var collapsed = _a[0], previewCollapsed = _a[1]; + return (!collapsed || !previewCollapsed); + })); + }; + /** + * Initialize all menu sections and items for this menu + */ + AdminSidebarComponent.prototype.createMenu = function () { + var _this = this; + var menuList = [ + /* News */ + { + id: 'new', + active: false, + visible: true, + model: { + type: MenuItemType.TEXT, + text: 'menu.section.new' + }, + icon: 'plus-circle', + index: 0 + }, + { + id: 'new_community', + parentID: 'new', + active: false, + visible: true, + model: { + type: MenuItemType.ONCLICK, + text: 'menu.section.new_community', + function: function () { + _this.modalService.open(CreateCommunityParentSelectorComponent); + } + }, + }, + { + id: 'new_collection', + parentID: 'new', + active: false, + visible: true, + model: { + type: MenuItemType.ONCLICK, + text: 'menu.section.new_collection', + function: function () { + _this.modalService.open(CreateCollectionParentSelectorComponent); + } + }, + }, + { + id: 'new_item', + parentID: 'new', + active: false, + visible: true, + // model: { + // type: MenuItemType.ONCLICK, + // text: 'menu.section.new_item', + // function: () => { + // this.modalService.open(CreateItemParentSelectorComponent); + // } + // } as OnClickMenuItemModel, + model: { + type: MenuItemType.LINK, + text: 'menu.section.new_item', + link: '/submit' + }, + }, + { + id: 'new_item_version', + parentID: 'new', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.new_item_version', + link: '' + }, + }, + /* Edit */ + { + id: 'edit', + active: false, + visible: true, + model: { + type: MenuItemType.TEXT, + text: 'menu.section.edit' + }, + icon: 'pencil-alt', + index: 1 + }, + { + id: 'edit_community', + parentID: 'edit', + active: false, + visible: true, + model: { + type: MenuItemType.ONCLICK, + text: 'menu.section.edit_community', + function: function () { + _this.modalService.open(EditCommunitySelectorComponent); + } + }, + }, + { + id: 'edit_collection', + parentID: 'edit', + active: false, + visible: true, + model: { + type: MenuItemType.ONCLICK, + text: 'menu.section.edit_collection', + function: function () { + _this.modalService.open(EditCollectionSelectorComponent); + } + }, + }, + { + id: 'edit_item', + parentID: 'edit', + active: false, + visible: true, + model: { + type: MenuItemType.ONCLICK, + text: 'menu.section.edit_item', + function: function () { + _this.modalService.open(EditItemSelectorComponent); + } + }, + }, + /* Import */ + { + id: 'import', + active: false, + visible: true, + model: { + type: MenuItemType.TEXT, + text: 'menu.section.import' + }, + icon: 'sign-in-alt', + index: 2 + }, + { + id: 'import_metadata', + parentID: 'import', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.import_metadata', + link: '' + }, + }, + { + id: 'import_batch', + parentID: 'import', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.import_batch', + link: '' + }, + }, + /* Export */ + { + id: 'export', + active: false, + visible: true, + model: { + type: MenuItemType.TEXT, + text: 'menu.section.export' + }, + icon: 'sign-out-alt', + index: 3 + }, + { + id: 'export_community', + parentID: 'export', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.export_community', + link: '' + }, + }, + { + id: 'export_collection', + parentID: 'export', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.export_collection', + link: '' + }, + }, + { + id: 'export_item', + parentID: 'export', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.export_item', + link: '' + }, + }, { + id: 'export_metadata', + parentID: 'export', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.export_metadata', + link: '' + }, + }, + /* Access Control */ + { + id: 'access_control', + active: false, + visible: true, + model: { + type: MenuItemType.TEXT, + text: 'menu.section.access_control' + }, + icon: 'key', + index: 4 + }, + { + id: 'access_control_people', + parentID: 'access_control', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.access_control_people', + link: '' + }, + }, + { + id: 'access_control_groups', + parentID: 'access_control', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.access_control_groups', + link: '' + }, + }, + { + id: 'access_control_authorizations', + parentID: 'access_control', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.access_control_authorizations', + link: '' + }, + }, + /* Search */ + { + id: 'find', + active: false, + visible: true, + model: { + type: MenuItemType.TEXT, + text: 'menu.section.find' + }, + icon: 'search', + index: 5 + }, + { + id: 'find_items', + parentID: 'find', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.find_items', + link: '/search' + }, + }, + { + id: 'find_withdrawn_items', + parentID: 'find', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.find_withdrawn_items', + link: '' + }, + }, + { + id: 'find_private_items', + parentID: 'find', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.find_private_items', + link: '' + }, + }, + /* Registries */ + { + id: 'registries', + active: false, + visible: true, + model: { + type: MenuItemType.TEXT, + text: 'menu.section.registries' + }, + icon: 'list', + index: 6 + }, + { + id: 'registries_metadata', + parentID: 'registries', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.registries_metadata', + link: 'admin/registries/metadata' + }, + }, + { + id: 'registries_format', + parentID: 'registries', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.registries_format', + link: 'admin/registries/bitstream-formats' + }, + }, + /* Curation tasks */ + { + id: 'curation_tasks', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.curation_task', + link: '' + }, + icon: 'filter', + index: 7 + }, + /* Statistics */ + { + id: 'statistics_task', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.statistics_task', + link: '' + }, + icon: 'chart-bar', + index: 8 + }, + /* Control Panel */ + { + id: 'control_panel', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.control_panel', + link: '' + }, + icon: 'cogs', + index: 9 + }, + ]; + menuList.forEach(function (menuSection) { return _this.menuService.addSection(_this.menuID, menuSection); }); + }; + /** + * Method to change this.collapsed to false when the slide animation ends and is sliding open + * @param event The animation event + */ + AdminSidebarComponent.prototype.startSlide = function (event) { + if (event.toState === 'expanded') { + this.sidebarClosed = false; + } + else if (event.toState === 'collapsed') { + this.sidebarOpen = false; + } + }; + /** + * Method to change this.collapsed to false when the slide animation ends and is sliding open + * @param event The animation event + */ + AdminSidebarComponent.prototype.finishSlide = function (event) { + if (event.fromState === 'expanded') { + this.sidebarClosed = true; + } + else if (event.fromState === 'collapsed') { + this.sidebarOpen = true; + } + }; + AdminSidebarComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-admin-sidebar', + templateUrl: './admin-sidebar.component.html', + styleUrls: ['./admin-sidebar.component.scss'], + animations: [slideHorizontal, slideSidebar] + }), + tslib_1.__metadata("design:paramtypes", [MenuService, + Injector, + CSSVariableService, + AuthService, + NgbModal]) + ], AdminSidebarComponent); + return AdminSidebarComponent; +}(MenuComponent)); +export { AdminSidebarComponent }; +//# sourceMappingURL=admin-sidebar.component.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-sidebar/admin-sidebar.component.js.map b/src/app/+admin/admin-sidebar/admin-sidebar.component.js.map new file mode 100644 index 0000000000..7c602f91a3 --- /dev/null +++ b/src/app/+admin/admin-sidebar/admin-sidebar.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"admin-sidebar.component.js","sourceRoot":"","sources":["admin-sidebar.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAU,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGjE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAE,MAAM,MAAM,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,sCAAsC,EAAE,MAAM,sHAAsH,CAAC;AAE9K,OAAO,EAAE,uCAAuC,EAAE,MAAM,wHAAwH,CAAC;AACjL,OAAO,EAAE,yBAAyB,EAAE,MAAM,0FAA0F,CAAC;AACrI,OAAO,EAAE,8BAA8B,EAAE,MAAM,oGAAoG,CAAC;AACpJ,OAAO,EAAE,+BAA+B,EAAE,MAAM,sGAAsG,CAAC;AAEvJ;;GAEG;AAOH;IAA2C,iDAAa;IA6BtD,+BAAsB,WAAwB,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;YAC7C,SAAS,EAAE,CAAC,gCAAgC,CAAC;YAC7C,UAAU,EAAE,CAAC,eAAe,EAAE,YAAY,CAAC;SAC5C,CAAC;iDA8BmC,WAAW;YACd,QAAQ;YACH,kBAAkB;YACtB,WAAW;YACV,QAAQ;OAjC/B,qBAAqB,CAydjC;IAAD,4BAAC;CAAA,AAzdD,CAA2C,aAAa,GAydvD;SAzdY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.js b/src/app/+admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.js new file mode 100644 index 0000000000..2de22e1eb7 --- /dev/null +++ b/src/app/+admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.js @@ -0,0 +1,58 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject, Injector } from '@angular/core'; +import { rotate } from '../../../shared/animations/rotate'; +import { AdminSidebarSectionComponent } from '../admin-sidebar-section/admin-sidebar-section.component'; +import { slide } from '../../../shared/animations/slide'; +import { CSSVariableService } from '../../../shared/sass-helper/sass-helper.service'; +import { bgColor } from '../../../shared/animations/bgColor'; +import { MenuID } from '../../../shared/menu/initial-menus-state'; +import { MenuService } from '../../../shared/menu/menu.service'; +import { combineLatest as combineLatestObservable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { rendersSectionForMenu } from '../../../shared/menu/menu-section.decorator'; +/** + * Represents a expandable section in the sidebar + */ +var ExpandableAdminSidebarSectionComponent = /** @class */ (function (_super) { + tslib_1.__extends(ExpandableAdminSidebarSectionComponent, _super); + function ExpandableAdminSidebarSectionComponent(menuSection, menuService, variableService, injector) { + var _this = _super.call(this, menuSection, menuService, injector) || this; + _this.menuService = menuService; + _this.variableService = variableService; + _this.injector = injector; + /** + * This section resides in the Admin Sidebar + */ + _this.menuID = MenuID.ADMIN; + return _this; + } + /** + * Set initial values for instance variables + */ + ExpandableAdminSidebarSectionComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + this.sidebarActiveBg = this.variableService.getVariable('adminSidebarActiveBg'); + this.sidebarCollapsed = this.menuService.isMenuCollapsed(this.menuID); + this.sidebarPreviewCollapsed = this.menuService.isMenuPreviewCollapsed(this.menuID); + this.expanded = combineLatestObservable(this.active, this.sidebarCollapsed, this.sidebarPreviewCollapsed) + .pipe(map(function (_a) { + var active = _a[0], sidebarCollapsed = _a[1], sidebarPreviewCollapsed = _a[2]; + return (active && (!sidebarCollapsed || !sidebarPreviewCollapsed)); + })); + }; + ExpandableAdminSidebarSectionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-expandable-admin-sidebar-section', + templateUrl: './expandable-admin-sidebar-section.component.html', + styleUrls: ['./expandable-admin-sidebar-section.component.scss'], + animations: [rotate, slide, bgColor] + }), + rendersSectionForMenu(MenuID.ADMIN, true), + tslib_1.__param(0, Inject('sectionDataProvider')), + tslib_1.__metadata("design:paramtypes", [Object, MenuService, + CSSVariableService, Injector]) + ], ExpandableAdminSidebarSectionComponent); + return ExpandableAdminSidebarSectionComponent; +}(AdminSidebarSectionComponent)); +export { ExpandableAdminSidebarSectionComponent }; +//# sourceMappingURL=expandable-admin-sidebar-section.component.js.map \ No newline at end of file diff --git a/src/app/+admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.js.map b/src/app/+admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.js.map new file mode 100644 index 0000000000..9eb67f11e4 --- /dev/null +++ b/src/app/+admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"expandable-admin-sidebar-section.component.js","sourceRoot":"","sources":["expandable-admin-sidebar-section.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAU,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D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,gBAAgB,EAAE,IAAI,CAAC,uBAAuB,CAAC;aACtG,IAAI,CACH,GAAG,CAAC,UAAC,EAAmD;gBAAlD,cAAM,EAAE,wBAAgB,EAAE,+BAAuB;YAAM,OAAA,CAAC,MAAM,IAAI,CAAC,CAAC,gBAAgB,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAA3D,CAA2D,CAAC,CAC1H,CAAC;IACN,CAAC;IA5CU,sCAAsC;QARlD,SAAS,CAAC;YACT,QAAQ,EAAE,qCAAqC;YAC/C,WAAW,EAAE,mDAAmD;YAChE,SAAS,EAAE,CAAC,mDAAmD,CAAC;YAChE,UAAU,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC;SACrC,CAAC;QAED,qBAAqB,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC;QA4B3B,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;yDAAqC,WAAW;YACrD,kBAAkB,EAAsB,QAAQ;OA5B1E,sCAAsC,CA6ClD;IAAD,6CAAC;CAAA,AA7CD,CAA4D,4BAA4B,GA6CvF;SA7CY,sCAAsC"} \ No newline at end of file diff --git a/src/app/+admin/admin.module.js b/src/app/+admin/admin.module.js new file mode 100644 index 0000000000..1fb1780ff6 --- /dev/null +++ b/src/app/+admin/admin.module.js @@ -0,0 +1,21 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { AdminRegistriesModule } from './admin-registries/admin-registries.module'; +import { AdminRoutingModule } from './admin-routing.module'; +import { SharedModule } from '../shared/shared.module'; +var AdminModule = /** @class */ (function () { + function AdminModule() { + } + AdminModule = tslib_1.__decorate([ + NgModule({ + imports: [ + AdminRegistriesModule, + AdminRoutingModule, + SharedModule, + ], + }) + ], AdminModule); + return AdminModule; +}()); +export { AdminModule }; +//# sourceMappingURL=admin.module.js.map \ No newline at end of file diff --git a/src/app/+admin/admin.module.js.map b/src/app/+admin/admin.module.js.map new file mode 100644 index 0000000000..9bb27d056d --- /dev/null +++ b/src/app/+admin/admin.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"admin.module.js","sourceRoot":"","sources":["admin.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AASvD;IAAA;IAEA,CAAC;IAFY,WAAW;QAPvB,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,qBAAqB;gBACrB,kBAAkB;gBAClB,YAAY;aACb;SACF,CAAC;OACW,WAAW,CAEvB;IAAD,kBAAC;CAAA,AAFD,IAEC;SAFY,WAAW"} \ No newline at end of file diff --git a/src/app/+browse-by/+browse-by-date-page/browse-by-date-page.component.js b/src/app/+browse-by/+browse-by-date-page/browse-by-date-page.component.js new file mode 100644 index 0000000000..ac6269177e --- /dev/null +++ b/src/app/+browse-by/+browse-by-date-page/browse-by-date-page.component.js @@ -0,0 +1,119 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, Inject } from '@angular/core'; +import { BrowseByMetadataPageComponent, browseParamsToOptions } from '../+browse-by-metadata-page/browse-by-metadata-page.component'; +import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model'; +import { combineLatest as observableCombineLatest } from 'rxjs/internal/observable/combineLatest'; +import { hasValue, isNotEmpty } from '../../shared/empty.util'; +import { ActivatedRoute, Router } from '@angular/router'; +import { BrowseService } from '../../core/browse/browse.service'; +import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service'; +import { GLOBAL_CONFIG } from '../../../config'; +import { StartsWithType } from '../../shared/starts-with/starts-with-decorator'; +var BrowseByDatePageComponent = /** @class */ (function (_super) { + tslib_1.__extends(BrowseByDatePageComponent, _super); + function BrowseByDatePageComponent(config, route, browseService, dsoService, router, cdRef) { + var _this = _super.call(this, route, browseService, dsoService, router) || this; + _this.config = config; + _this.route = route; + _this.browseService = browseService; + _this.dsoService = dsoService; + _this.router = router; + _this.cdRef = cdRef; + /** + * The default metadata-field to use for determining the lower limit of the StartsWith dropdown options + */ + _this.defaultMetadataField = 'dc.date.issued'; + return _this; + } + BrowseByDatePageComponent.prototype.ngOnInit = function () { + var _this = this; + this.startsWithType = StartsWithType.date; + this.updatePage(new BrowseEntrySearchOptions(null, this.paginationConfig, this.sortConfig)); + this.subs.push(observableCombineLatest(this.route.params, this.route.queryParams, this.route.data, function (params, queryParams, data) { + return Object.assign({}, params, queryParams, data); + }) + .subscribe(function (params) { + var metadataField = params.metadataField || _this.defaultMetadataField; + _this.metadata = params.metadata || _this.defaultMetadata; + _this.startsWith = +params.startsWith || params.startsWith; + var searchOptions = browseParamsToOptions(params, Object.assign({}), _this.sortConfig, _this.metadata); + _this.updatePageWithItems(searchOptions, _this.value); + _this.updateParent(params.scope); + _this.updateStartsWithOptions(_this.metadata, metadataField, params.scope); + })); + }; + /** + * Update the StartsWith options + * In this implementation, it creates a list of years starting from now, going all the way back to the earliest + * date found on an item within this scope. The further back in time, the bigger the change in years become to avoid + * extremely long lists with a one-year difference. + * To determine the change in years, the config found under GlobalConfig.BrowseBy is used for this. + * @param definition The metadata definition to fetch the first item for + * @param metadataField The metadata field to fetch the earliest date from (expects a date field) + * @param scope The scope under which to fetch the earliest item for + */ + BrowseByDatePageComponent.prototype.updateStartsWithOptions = function (definition, metadataField, scope) { + var _this = this; + this.subs.push(this.browseService.getFirstItemFor(definition, scope).subscribe(function (firstItemRD) { + var lowerLimit = _this.config.browseBy.defaultLowerLimit; + if (hasValue(firstItemRD.payload)) { + var date = firstItemRD.payload.firstMetadataValue(metadataField); + if (hasValue(date) && hasValue(+date.split('-')[0])) { + lowerLimit = +date.split('-')[0]; + } + } + var options = []; + var currentYear = new Date().getFullYear(); + var oneYearBreak = Math.floor((currentYear - _this.config.browseBy.oneYearLimit) / 5) * 5; + var fiveYearBreak = Math.floor((currentYear - _this.config.browseBy.fiveYearLimit) / 10) * 10; + if (lowerLimit <= fiveYearBreak) { + lowerLimit -= 10; + } + else if (lowerLimit <= oneYearBreak) { + lowerLimit -= 5; + } + else { + lowerLimit -= 1; + } + var i = currentYear; + while (i > lowerLimit) { + options.push(i); + if (i <= fiveYearBreak) { + i -= 10; + } + else if (i <= oneYearBreak) { + i -= 5; + } + else { + i--; + } + } + if (isNotEmpty(options)) { + _this.startsWithOptions = options; + _this.cdRef.detectChanges(); + } + })); + }; + BrowseByDatePageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-browse-by-date-page', + styleUrls: ['../+browse-by-metadata-page/browse-by-metadata-page.component.scss'], + templateUrl: '../+browse-by-metadata-page/browse-by-metadata-page.component.html' + }) + /** + * Component for browsing items by metadata definition of type 'date' + * A metadata definition is a short term used to describe one or multiple metadata fields. + * An example would be 'dateissued' for 'dc.date.issued' + */ + , + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ActivatedRoute, + BrowseService, + DSpaceObjectDataService, + Router, + ChangeDetectorRef]) + ], BrowseByDatePageComponent); + return BrowseByDatePageComponent; +}(BrowseByMetadataPageComponent)); +export { BrowseByDatePageComponent }; +//# sourceMappingURL=browse-by-date-page.component.js.map \ No newline at end of file diff --git a/src/app/+browse-by/+browse-by-date-page/browse-by-date-page.component.js.map b/src/app/+browse-by/+browse-by-date-page/browse-by-date-page.component.js.map new file mode 100644 index 0000000000..2307b06672 --- /dev/null +++ b/src/app/+browse-by/+browse-by-date-page/browse-by-date-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-by-date-page.component.js","sourceRoot":"","sources":["browse-by-date-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACtB,MAAM,+DAA+D,CAAC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IAAI,UAAU,CAAC,OAAO,CAAC,EAAE;gBACvB,KAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC;gBACjC,KAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;aAC5B;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAtFU,yBAAyB;QAVrC,SAAS,CAAC;YACT,QAAQ,EAAE,wBAAwB;YAClC,SAAS,EAAE,CAAC,oEAAoE,CAAC;YACjF,WAAW,EAAE,oEAAoE;SAClF,CAAC;QACF;;;;WAIG;;QAQmB,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACL,cAAc;YACN,aAAa;YAChB,uBAAuB;YAC3B,MAAM;YACP,iBAAiB;OAZ1C,yBAAyB,CAwFrC;IAAD,gCAAC;CAAA,AAxFD,CAA+C,6BAA6B,GAwF3E;SAxFY,yBAAyB"} \ No newline at end of file diff --git a/src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.js b/src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.js new file mode 100644 index 0000000000..8b628ed6e6 --- /dev/null +++ b/src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.js @@ -0,0 +1,208 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest } from 'rxjs'; +import { Component } from '@angular/core'; +import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model'; +import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; +import { ActivatedRoute, Router } from '@angular/router'; +import { hasValue, isNotEmpty } from '../../shared/empty.util'; +import { BrowseService } from '../../core/browse/browse.service'; +import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model'; +import { getSucceededRemoteData } from '../../core/shared/operators'; +import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service'; +import { take } from 'rxjs/operators'; +import { StartsWithType } from '../../shared/starts-with/starts-with-decorator'; +var BrowseByMetadataPageComponent = /** @class */ (function () { + function BrowseByMetadataPageComponent(route, browseService, dsoService, router) { + this.route = route; + this.browseService = browseService; + this.dsoService = dsoService; + this.router = router; + /** + * The pagination config used to display the values + */ + this.paginationConfig = Object.assign(new PaginationComponentOptions(), { + id: 'browse-by-metadata-pagination', + currentPage: 1, + pageSize: 20 + }); + /** + * The sorting config used to sort the values (defaults to Ascending) + */ + this.sortConfig = new SortOptions('default', SortDirection.ASC); + /** + * List of subscriptions + */ + this.subs = []; + /** + * The default metadata definition to resort to when none is provided + */ + this.defaultMetadata = 'author'; + /** + * The current metadata definition + */ + this.metadata = this.defaultMetadata; + /** + * The type of StartsWith options to render + * Defaults to text + */ + this.startsWithType = StartsWithType.text; + /** + * The value we're browing items for + * - When the value is not empty, we're browsing items + * - When the value is empty, we're browsing browse-entries (values for the given metadata definition) + */ + this.value = ''; + } + BrowseByMetadataPageComponent.prototype.ngOnInit = function () { + var _this = this; + this.updatePage(new BrowseEntrySearchOptions(null, this.paginationConfig, this.sortConfig)); + this.subs.push(observableCombineLatest(this.route.params, this.route.queryParams, function (params, queryParams) { + return Object.assign({}, params, queryParams); + }) + .subscribe(function (params) { + _this.metadata = params.metadata || _this.defaultMetadata; + _this.value = +params.value || params.value || ''; + _this.startsWith = +params.startsWith || params.startsWith; + var searchOptions = browseParamsToOptions(params, _this.paginationConfig, _this.sortConfig, _this.metadata); + if (isNotEmpty(_this.value)) { + _this.updatePageWithItems(searchOptions, _this.value); + } + else { + _this.updatePage(searchOptions); + } + _this.updateParent(params.scope); + })); + this.updateStartsWithTextOptions(); + }; + /** + * Update the StartsWith options with text values + * It adds the value "0-9" as well as all letters from A to Z + */ + BrowseByMetadataPageComponent.prototype.updateStartsWithTextOptions = function () { + this.startsWithOptions = ['0-9'].concat('ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('')); + }; + /** + * Updates the current page with searchOptions + * @param searchOptions Options to narrow down your search: + * { metadata: string + * pagination: PaginationComponentOptions, + * sort: SortOptions, + * scope: string } + */ + BrowseByMetadataPageComponent.prototype.updatePage = function (searchOptions) { + this.browseEntries$ = this.browseService.getBrowseEntriesFor(searchOptions); + this.items$ = undefined; + }; + /** + * Updates the current page with searchOptions and display items linked to the given value + * @param searchOptions Options to narrow down your search: + * { metadata: string + * pagination: PaginationComponentOptions, + * sort: SortOptions, + * scope: string } + * @param value The value of the browse-entry to display items for + */ + BrowseByMetadataPageComponent.prototype.updatePageWithItems = function (searchOptions, value) { + this.items$ = this.browseService.getBrowseItemsFor(value, searchOptions); + }; + /** + * Update the parent Community or Collection using their scope + * @param scope The UUID of the Community or Collection to fetch + */ + BrowseByMetadataPageComponent.prototype.updateParent = function (scope) { + if (hasValue(scope)) { + this.parent$ = this.dsoService.findById(scope).pipe(getSucceededRemoteData()); + } + }; + /** + * Navigate to the previous page + */ + BrowseByMetadataPageComponent.prototype.goPrev = function () { + var _this = this; + if (this.items$) { + this.items$.pipe(take(1)).subscribe(function (items) { + _this.items$ = _this.browseService.getPrevBrowseItems(items); + }); + } + else if (this.browseEntries$) { + this.browseEntries$.pipe(take(1)).subscribe(function (entries) { + _this.browseEntries$ = _this.browseService.getPrevBrowseEntries(entries); + }); + } + }; + /** + * Navigate to the next page + */ + BrowseByMetadataPageComponent.prototype.goNext = function () { + var _this = this; + if (this.items$) { + this.items$.pipe(take(1)).subscribe(function (items) { + _this.items$ = _this.browseService.getNextBrowseItems(items); + }); + } + else if (this.browseEntries$) { + this.browseEntries$.pipe(take(1)).subscribe(function (entries) { + _this.browseEntries$ = _this.browseService.getNextBrowseEntries(entries); + }); + } + }; + /** + * Change the page size + * @param size + */ + BrowseByMetadataPageComponent.prototype.pageSizeChange = function (size) { + this.router.navigate([], { + queryParams: Object.assign({ pageSize: size }), + queryParamsHandling: 'merge' + }); + }; + /** + * Change the sorting direction + * @param direction + */ + BrowseByMetadataPageComponent.prototype.sortDirectionChange = function (direction) { + this.router.navigate([], { + queryParams: Object.assign({ sortDirection: direction }), + queryParamsHandling: 'merge' + }); + }; + BrowseByMetadataPageComponent.prototype.ngOnDestroy = function () { + this.subs.filter(function (sub) { return hasValue(sub); }).forEach(function (sub) { return sub.unsubscribe(); }); + }; + BrowseByMetadataPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-browse-by-metadata-page', + styleUrls: ['./browse-by-metadata-page.component.scss'], + templateUrl: './browse-by-metadata-page.component.html' + }) + /** + * Component for browsing (items) by metadata definition + * A metadata definition is a short term used to describe one or multiple metadata fields. + * An example would be 'author' for 'dc.contributor.*' + */ + , + tslib_1.__metadata("design:paramtypes", [ActivatedRoute, + BrowseService, + DSpaceObjectDataService, + Router]) + ], BrowseByMetadataPageComponent); + return BrowseByMetadataPageComponent; +}()); +export { BrowseByMetadataPageComponent }; +/** + * Function to transform query and url parameters into searchOptions used to fetch browse entries or items + * @param params URL and query parameters + * @param paginationConfig Pagination configuration + * @param sortConfig Sorting configuration + * @param metadata Optional metadata definition to fetch browse entries/items for + */ +export function browseParamsToOptions(params, paginationConfig, sortConfig, metadata) { + return new BrowseEntrySearchOptions(metadata, Object.assign({}, paginationConfig, { + currentPage: +params.page || paginationConfig.currentPage, + pageSize: +params.pageSize || paginationConfig.pageSize + }), Object.assign({}, sortConfig, { + direction: params.sortDirection || sortConfig.direction, + field: params.sortField || sortConfig.field + }), +params.startsWith || params.startsWith, params.scope); +} +//# sourceMappingURL=browse-by-metadata-page.component.js.map \ No newline at end of file diff --git a/src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.js.map b/src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.js.map new file mode 100644 index 0000000000..8f0d92ed65 --- /dev/null +++ b/src/app/+browse-by/+browse-by-metadata-page/browse-by-metadata-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-by-metadata-page.component.js","sourceRoot":"","sources":["browse-by-metadata-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,aAAa,IAAI,uBAAuB,EAAsD,MAAM,MAAM,CAAC;AACnH,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAGlD,OAA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,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,WAAW,EAAE,EAAjB,CAAiB,CAAC,CAAC;IAC/E,CAAC;IAxMU,6BAA6B;QAVzC,SAAS,CAAC;YACT,QAAQ,EAAE,4BAA4B;YACtC,SAAS,EAAE,CAAC,0CAA0C,CAAC;YACvD,WAAW,EAAE,0CAA0C;SACxD,CAAC;QACF;;;;WAIG;;iDAuEmC,cAAc;YACN,aAAa;YAChB,uBAAuB;YAC3B,MAAM;OAzEhC,6BAA6B,CA0MzC;IAAD,oCAAC;CAAA,AA1MD,IA0MC;SA1MY,6BAA6B;AA4M1C;;;;;;GAMG;AACH,MAAM,gCAAgC,MAAW,EACX,gBAA4C,EAC5C,UAAuB,EACvB,QAAiB;IACrD,OAAO,IAAI,wBAAwB,CACjC,QAAQ,EACR,MAAM,CAAC,MAAM,CAAC,EAAE,EACd,gBAAgB,EAChB;QACE,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,gBAAgB,CAAC,WAAW;QACzD,QAAQ,EAAE,CAAC,MAAM,CAAC,QAAQ,IAAI,gBAAgB,CAAC,QAAQ;KACxD,CACF,EACD,MAAM,CAAC,MAAM,CAAC,EAAE,EACd,UAAU,EACV;QACE,SAAS,EAAE,MAAM,CAAC,aAAa,IAAI,UAAU,CAAC,SAAS;QACvD,KAAK,EAAE,MAAM,CAAC,SAAS,IAAI,UAAU,CAAC,KAAK;KAC5C,CACF,EACD,CAAC,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,EACvC,MAAM,CAAC,KAAK,CACb,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.js b/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.js new file mode 100644 index 0000000000..5898e56095 --- /dev/null +++ b/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.js @@ -0,0 +1,56 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest } from 'rxjs'; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { hasValue } from '../../shared/empty.util'; +import { BrowseByMetadataPageComponent, browseParamsToOptions } from '../+browse-by-metadata-page/browse-by-metadata-page.component'; +import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model'; +import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service'; +import { BrowseService } from '../../core/browse/browse.service'; +import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; +var BrowseByTitlePageComponent = /** @class */ (function (_super) { + tslib_1.__extends(BrowseByTitlePageComponent, _super); + function BrowseByTitlePageComponent(route, browseService, dsoService, router) { + var _this = _super.call(this, route, browseService, dsoService, router) || this; + _this.route = route; + _this.browseService = browseService; + _this.dsoService = dsoService; + _this.router = router; + return _this; + } + BrowseByTitlePageComponent.prototype.ngOnInit = function () { + var _this = this; + this.sortConfig = new SortOptions('dc.title', SortDirection.ASC); + this.updatePage(new BrowseEntrySearchOptions(null, this.paginationConfig, this.sortConfig)); + this.subs.push(observableCombineLatest(this.route.params, this.route.queryParams, this.route.data, function (params, queryParams, data) { + return Object.assign({}, params, queryParams, data); + }) + .subscribe(function (params) { + _this.metadata = params.metadata || _this.defaultMetadata; + _this.updatePageWithItems(browseParamsToOptions(params, _this.paginationConfig, _this.sortConfig, _this.metadata), undefined); + _this.updateParent(params.scope); + })); + this.updateStartsWithTextOptions(); + }; + BrowseByTitlePageComponent.prototype.ngOnDestroy = function () { + this.subs.filter(function (sub) { return hasValue(sub); }).forEach(function (sub) { return sub.unsubscribe(); }); + }; + BrowseByTitlePageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-browse-by-title-page', + styleUrls: ['../+browse-by-metadata-page/browse-by-metadata-page.component.scss'], + templateUrl: '../+browse-by-metadata-page/browse-by-metadata-page.component.html' + }) + /** + * Component for browsing items by title (dc.title) + */ + , + tslib_1.__metadata("design:paramtypes", [ActivatedRoute, + BrowseService, + DSpaceObjectDataService, + Router]) + ], BrowseByTitlePageComponent); + return BrowseByTitlePageComponent; +}(BrowseByMetadataPageComponent)); +export { BrowseByTitlePageComponent }; +//# sourceMappingURL=browse-by-title-page.component.js.map \ No newline at end of file diff --git a/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.js.map b/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.js.map new file mode 100644 index 0000000000..885e2fa159 --- /dev/null +++ b/src/app/+browse-by/+browse-by-title-page/browse-by-title-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-by-title-page.component.js","sourceRoot":"","sources":["browse-by-title-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAE,MAAM,MAAM,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACtB,MAAM,+DAA+D,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAUxF;IAAgD,sDAA6B;IAE3E,oCAA6B,KAAqB,EACrB,aAA4B,EAC5B,UAAmC,EACnC,MAAc;QAH3C,YAIE,kBAAM,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,CAAC,SAChD;QAL4B,WAAK,GAAL,KAAK,CAAgB;QACrB,mBAAa,GAAb,aAAa,CAAe;QAC5B,gBAAU,GAAV,UAAU,CAAyB;QACnC,YAAM,GAAN,MAAM,CAAQ;;IAE3C,CAAC;IAED,6CAAQ,GAAR;QAAA,i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B;YACnC,SAAS,EAAE,CAAC,oEAAoE,CAAC;YACjF,WAAW,EAAE,oEAAoE;SAClF,CAAC;QACF;;WAEG;;iDAGmC,cAAc;YACN,aAAa;YAChB,uBAAuB;YAC3B,MAAM;OALhC,0BAA0B,CAgCtC;IAAD,iCAAC;CAAA,AAhCD,CAAgD,6BAA6B,GAgC5E;SAhCY,0BAA0B"} \ No newline at end of file diff --git a/src/app/+browse-by/browse-by-guard.js b/src/app/+browse-by/browse-by-guard.js new file mode 100644 index 0000000000..b717ee1353 --- /dev/null +++ b/src/app/+browse-by/browse-by-guard.js @@ -0,0 +1,57 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { DSpaceObjectDataService } from '../core/data/dspace-object-data.service'; +import { hasValue } from '../shared/empty.util'; +import { map } from 'rxjs/operators'; +import { getSucceededRemoteData } from '../core/shared/operators'; +import { TranslateService } from '@ngx-translate/core'; +import { of as observableOf } from 'rxjs'; +var BrowseByGuard = /** @class */ (function () { + function BrowseByGuard(dsoService, translate) { + this.dsoService = dsoService; + this.translate = translate; + } + BrowseByGuard.prototype.canActivate = function (route, state) { + var _this = this; + var title = route.data.title; + var metadata = route.params.metadata || route.queryParams.metadata || route.data.metadata; + var metadataField = route.data.metadataField; + var scope = route.queryParams.scope; + var value = route.queryParams.value; + var metadataTranslated = this.translate.instant('browse.metadata.' + metadata); + if (hasValue(scope)) { + var dsoAndMetadata$ = this.dsoService.findById(scope).pipe(getSucceededRemoteData()); + return dsoAndMetadata$.pipe(map(function (dsoRD) { + var name = dsoRD.payload.name; + route.data = _this.createData(title, metadata, metadataField, name, metadataTranslated, value); + return true; + })); + } + else { + route.data = this.createData(title, metadata, metadataField, '', metadataTranslated, value); + return observableOf(true); + } + }; + BrowseByGuard.prototype.createData = function (title, metadata, metadataField, collection, field, value) { + return { + title: title, + metadata: metadata, + metadataField: metadataField, + collection: collection, + field: field, + value: hasValue(value) ? "\"" + value + "\"" : '' + }; + }; + BrowseByGuard = tslib_1.__decorate([ + Injectable() + /** + * A guard taking care of the correct route.data being set for the Browse-By components + */ + , + tslib_1.__metadata("design:paramtypes", [DSpaceObjectDataService, + TranslateService]) + ], BrowseByGuard); + return BrowseByGuard; +}()); +export { BrowseByGuard }; +//# sourceMappingURL=browse-by-guard.js.map \ No newline at end of file diff --git a/src/app/+browse-by/browse-by-guard.js.map b/src/app/+browse-by/browse-by-guard.js.map new file mode 100644 index 0000000000..9d5ad93e14 --- /dev/null +++ b/src/app/+browse-by/browse-by-guard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-by-guard.js","sourceRoot":"","sources":["browse-by-guard.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAM1C;IAEE,uBAAsB,UAAmC,EACnC,SAA2B;QAD3B,eAAU,GAAV,UAAU,CAAyB;QACnC,cAAS,GAAT,SAAS,CAAkB;IACjD,CAAC;IAED,mCAAW,GAAX,UAAY,KAA6B,EAAE,KAA0B;QAArE,iBAoBC;QAnBC,IAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;QAC/B,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC5F,IAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC;QAC/C,IAAM,KAAK,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AC;IArCU,aAAa;QAJzB,UAAU,EAAE;QACb;;WAEG;;iDAGiC,uBAAuB;YACxB,gBAAgB;OAHtC,aAAa,CAsCzB;IAAD,oBAAC;CAAA,AAtCD,IAsCC;SAtCY,aAAa"} \ No newline at end of file diff --git a/src/app/+browse-by/browse-by-routing.module.js b/src/app/+browse-by/browse-by-routing.module.js new file mode 100644 index 0000000000..18bc2d39be --- /dev/null +++ b/src/app/+browse-by/browse-by-routing.module.js @@ -0,0 +1,25 @@ +import * as tslib_1 from "tslib"; +import { RouterModule } from '@angular/router'; +import { NgModule } from '@angular/core'; +import { BrowseByTitlePageComponent } from './+browse-by-title-page/browse-by-title-page.component'; +import { BrowseByMetadataPageComponent } from './+browse-by-metadata-page/browse-by-metadata-page.component'; +import { BrowseByDatePageComponent } from './+browse-by-date-page/browse-by-date-page.component'; +import { BrowseByGuard } from './browse-by-guard'; +var BrowseByRoutingModule = /** @class */ (function () { + function BrowseByRoutingModule() { + } + BrowseByRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { path: 'title', component: BrowseByTitlePageComponent, canActivate: [BrowseByGuard], data: { metadata: 'title', title: 'browse.title' } }, + { path: 'dateissued', component: BrowseByDatePageComponent, canActivate: [BrowseByGuard], data: { metadata: 'dateissued', metadataField: 'dc.date.issued', title: 'browse.title' } }, + { path: ':metadata', component: BrowseByMetadataPageComponent, canActivate: [BrowseByGuard], data: { title: 'browse.title' } } + ]) + ] + }) + ], BrowseByRoutingModule); + return BrowseByRoutingModule; +}()); +export { BrowseByRoutingModule }; +//# sourceMappingURL=browse-by-routing.module.js.map \ No newline at end of file diff --git a/src/app/+browse-by/browse-by-routing.module.js.map b/src/app/+browse-by/browse-by-routing.module.js.map new file mode 100644 index 0000000000..f30accd10a --- /dev/null +++ b/src/app/+browse-by/browse-by-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-by-routing.module.js","sourceRoot":"","sources":["browse-by-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,6BAA6B,EAAE,MAAM,8DAA8D,CAAC;AAC7G,OAAO,EAAE,yBAAyB,EAAE,MAAM,sDAAsD,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAWlD;IAAA;IAEA,CAAC;IAFY,qBAAqB;QATjC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,0BAA0B,EAAE,WAAW,EAAE,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;oBAC1I,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,yBAAyB,EAAE,WAAW,EAAE,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;oBACpL,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,6BAA6B,EAAE,WAAW,EAAE,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;iBAC/H,CAAC;aACH;SACF,CAAC;OACW,qBAAqB,CAEjC;IAAD,4BAAC;CAAA,AAFD,IAEC;SAFY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+browse-by/browse-by.module.js b/src/app/+browse-by/browse-by.module.js new file mode 100644 index 0000000000..4853ba7d8d --- /dev/null +++ b/src/app/+browse-by/browse-by.module.js @@ -0,0 +1,37 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { BrowseByTitlePageComponent } from './+browse-by-title-page/browse-by-title-page.component'; +import { ItemDataService } from '../core/data/item-data.service'; +import { SharedModule } from '../shared/shared.module'; +import { BrowseByRoutingModule } from './browse-by-routing.module'; +import { BrowseService } from '../core/browse/browse.service'; +import { BrowseByMetadataPageComponent } from './+browse-by-metadata-page/browse-by-metadata-page.component'; +import { BrowseByDatePageComponent } from './+browse-by-date-page/browse-by-date-page.component'; +import { BrowseByGuard } from './browse-by-guard'; +var BrowseByModule = /** @class */ (function () { + function BrowseByModule() { + } + BrowseByModule = tslib_1.__decorate([ + NgModule({ + imports: [ + BrowseByRoutingModule, + CommonModule, + SharedModule + ], + declarations: [ + BrowseByTitlePageComponent, + BrowseByMetadataPageComponent, + BrowseByDatePageComponent + ], + providers: [ + ItemDataService, + BrowseService, + BrowseByGuard + ] + }) + ], BrowseByModule); + return BrowseByModule; +}()); +export { BrowseByModule }; +//# sourceMappingURL=browse-by.module.js.map \ No newline at end of file diff --git a/src/app/+browse-by/browse-by.module.js.map b/src/app/+browse-by/browse-by.module.js.map new file mode 100644 index 0000000000..849859a17b --- /dev/null +++ b/src/app/+browse-by/browse-by.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-by.module.js","sourceRoot":"","sources":["browse-by.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,8DAA8D,CAAC;AAC7G,OAAO,EAAE,yBAAyB,EAAE,MAAM,sDAAsD,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAmBlD;IAAA;IAEA,CAAC;IAFY,cAAc;QAjB1B,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,qBAAqB;gBACrB,YAAY;gBACZ,YAAY;aACb;YACD,YAAY,EAAE;gBACZ,0BAA0B;gBAC1B,6BAA6B;gBAC7B,yBAAyB;aAC1B;YACD,SAAS,EAAE;gBACT,eAAe;gBACf,aAAa;gBACb,aAAa;aACd;SACF,CAAC;OACW,cAAc,CAE1B;IAAD,qBAAC;CAAA,AAFD,IAEC;SAFY,cAAc"} \ No newline at end of file diff --git a/src/app/+collection-page/collection-form/collection-form.component.js b/src/app/+collection-page/collection-form/collection-form.component.js new file mode 100644 index 0000000000..dcedd039e1 --- /dev/null +++ b/src/app/+collection-page/collection-form/collection-form.component.js @@ -0,0 +1,79 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core'; +import { ResourceType } from '../../core/shared/resource-type'; +import { Collection } from '../../core/shared/collection.model'; +import { ComColFormComponent } from '../../shared/comcol-forms/comcol-form/comcol-form.component'; +/** + * Form used for creating and editing collections + */ +var CollectionFormComponent = /** @class */ (function (_super) { + tslib_1.__extends(CollectionFormComponent, _super); + function CollectionFormComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * @type {Collection} A new collection when a collection is being created, an existing Input collection when a collection is being edited + */ + _this.dso = new Collection(); + /** + * @type {ResourceType.Collection} This is a collection-type form + */ + _this.type = ResourceType.Collection; + /** + * The dynamic form fields used for creating/editing a collection + * @type {(DynamicInputModel | DynamicTextAreaModel)[]} + */ + _this.formModel = [ + new DynamicInputModel({ + id: 'title', + name: 'dc.title', + required: true, + validators: { + required: null + }, + errorMessages: { + required: 'Please enter a name for this title' + }, + }), + new DynamicTextAreaModel({ + id: 'description', + name: 'dc.description', + }), + new DynamicTextAreaModel({ + id: 'abstract', + name: 'dc.description.abstract', + }), + new DynamicTextAreaModel({ + id: 'rights', + name: 'dc.rights', + }), + new DynamicTextAreaModel({ + id: 'tableofcontents', + name: 'dc.description.tableofcontents', + }), + new DynamicTextAreaModel({ + id: 'license', + name: 'dc.rights.license', + }), + new DynamicTextAreaModel({ + id: 'provenance', + name: 'dc.description.provenance', + }), + ]; + return _this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Collection) + ], CollectionFormComponent.prototype, "dso", void 0); + CollectionFormComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-collection-form', + styleUrls: ['../../shared/comcol-forms/comcol-form/comcol-form.component.scss'], + templateUrl: '../../shared/comcol-forms/comcol-form/comcol-form.component.html' + }) + ], CollectionFormComponent); + return CollectionFormComponent; +}(ComColFormComponent)); +export { CollectionFormComponent }; +//# sourceMappingURL=collection-form.component.js.map \ No newline at end of file diff --git a/src/app/+collection-page/collection-form/collection-form.component.js.map b/src/app/+collection-page/collection-form/collection-form.component.js.map new file mode 100644 index 0000000000..d561e71f40 --- /dev/null +++ b/src/app/+collection-page/collection-form/collection-form.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collection-form.component.js","sourceRoot":"","sources":["collection-form.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAC;AAElG;;GAEG;AAMH;IAA6C,mDAA+B;IAL5E;QAAA,qEAyDC;QAnDC;;WAEG;QACM,SAAG,GAAe,IAAI,UAAU,EAAE,CAAC;QAE5C;;WAEG;QACO,UAAI,GAAG,YAAY,CAAC,UAAU,CAAC;QAEzC;;;WAGG;QACH,eAAS,GAA8B;YACrC,IAAI,iBAAiB,CAAC;gBACpB,EAAE,EAAE,OAAO;gBACX,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;gBACd,UAAU,EAAE;oBACV,QAAQ,EAAE,IAAI;iBACf;gBACD,aAAa,EAAE;oBACb,QAAQ,EAAE,oCAAoC;iBAC/C;aACF,CAAC;YACF,IAAI,oBAAoB,CAAC;gBACvB,EAAE,EAAE,aAAa;gBACjB,IAAI,EAAE,gBAAgB;aACvB,CAAC;YACF,IAAI,oBAAoB,CAAC;gBACvB,EAAE,EAAE,UAAU;gBACd,IAAI,EAAE,yBAAyB;aAChC,CAAC;YACF,IAAI,oBAAoB,CAAC;gBACvB,EAAE,EAAE,QAAQ;gBACZ,IAAI,EAAE,WAAW;aAClB,CAAC;YACF,IAAI,oBAAoB,CAAC;gBACvB,EAAE,EAAE,iBAAiB;gBACrB,IAAI,EAAE,gCAAgC;aACvC,CAAC;YACF,IAAI,oBAAoB,CAAC;gBACvB,EAAE,EAAE,SAAS;gBACb,IAAI,EAAE,mBAAmB;aAC1B,CAAC;YACF,IAAI,oBAAoB,CAAC;gBACvB,EAAE,EAAE,YAAY;gBAChB,IAAI,EAAE,2BAA2B;aAClC,CAAC;SACH,CAAC;;IACJ,CAAC;IAhDU;QAAR,KAAK,EAAE;0CAAM,UAAU;wDAAoB;IAJjC,uBAAuB;QALnC,SAAS,CAAC;YACT,QAAQ,EAAE,oBAAoB;YAC9B,SAAS,EAAE,CAAC,kEAAkE,CAAC;YAC/E,WAAW,EAAE,kEAAkE;SAChF,CAAC;OACW,uBAAuB,CAoDnC;IAAD,8BAAC;CAAA,AApDD,CAA6C,mBAAmB,GAoD/D;SApDY,uBAAuB"} \ No newline at end of file diff --git a/src/app/+collection-page/collection-page-routing.module.js b/src/app/+collection-page/collection-page-routing.module.js new file mode 100644 index 0000000000..5f6eca2d75 --- /dev/null +++ b/src/app/+collection-page/collection-page-routing.module.js @@ -0,0 +1,74 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { CollectionPageComponent } from './collection-page.component'; +import { CollectionPageResolver } from './collection-page.resolver'; +import { CreateCollectionPageComponent } from './create-collection-page/create-collection-page.component'; +import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; +import { EditCollectionPageComponent } from './edit-collection-page/edit-collection-page.component'; +import { CreateCollectionPageGuard } from './create-collection-page/create-collection-page.guard'; +import { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component'; +import { URLCombiner } from '../core/url-combiner/url-combiner'; +import { getCollectionModulePath } from '../app-routing.module'; +export var COLLECTION_PARENT_PARAMETER = 'parent'; +export function getCollectionPageRoute(collectionId) { + return new URLCombiner(getCollectionModulePath(), collectionId).toString(); +} +export function getCollectionEditPath(id) { + return new URLCombiner(getCollectionModulePath(), COLLECTION_EDIT_PATH.replace(/:id/, id)).toString(); +} +export function getCollectionCreatePath() { + return new URLCombiner(getCollectionModulePath(), COLLECTION_CREATE_PATH).toString(); +} +var COLLECTION_CREATE_PATH = 'create'; +var COLLECTION_EDIT_PATH = ':id/edit'; +var CollectionPageRoutingModule = /** @class */ (function () { + function CollectionPageRoutingModule() { + } + CollectionPageRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { + path: COLLECTION_CREATE_PATH, + component: CreateCollectionPageComponent, + canActivate: [AuthenticatedGuard, CreateCollectionPageGuard] + }, + { + path: COLLECTION_EDIT_PATH, + pathMatch: 'full', + component: EditCollectionPageComponent, + canActivate: [AuthenticatedGuard], + resolve: { + dso: CollectionPageResolver + } + }, + { + path: ':id/delete', + pathMatch: 'full', + component: DeleteCollectionPageComponent, + canActivate: [AuthenticatedGuard], + resolve: { + dso: CollectionPageResolver + } + }, + { + path: ':id', + component: CollectionPageComponent, + pathMatch: 'full', + resolve: { + collection: CollectionPageResolver + } + } + ]) + ], + providers: [ + CollectionPageResolver, + CreateCollectionPageGuard + ] + }) + ], CollectionPageRoutingModule); + return CollectionPageRoutingModule; +}()); +export { CollectionPageRoutingModule }; +//# sourceMappingURL=collection-page-routing.module.js.map \ No newline at end of file diff --git a/src/app/+collection-page/collection-page-routing.module.js.map b/src/app/+collection-page/collection-page-routing.module.js.map new file mode 100644 index 0000000000..bc3a317829 --- /dev/null +++ b/src/app/+collection-page/collection-page-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collection-page-routing.module.js","sourceRoot":"","sources":["collection-page-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,2DAA2D,CAAC;AAC1G,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,6BAA6B,EAAE,MAAM,2DAA2D,CAAC;AAC1G,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,CAAC,IAAM,2BAA2B,GAAG,QAAQ,CAAC;AAEpD,MAAM,iCAAiC,YAAoB;IACzD,OAAO,IAAI,WAAW,CAAC,uBAAuB,EAAE,EAAE,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC7E,CAAC;AAED,MAAM,gCAAgC,EAAU;IAC9C,OAAO,IAAI,WAAW,CAAC,uBAAuB,EAAE,EAAE,oBAAoB,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;AACvG,CAAC;AAED,MAAM;IACJ,OAAO,IAAI,WAAW,CAAC,uBAAuB,EAAE,EAAE,sBAAsB,CAAC,CAAC,QAAQ,EAAE,CAAA;AACtF,CAAC;AAED,IAAM,sBAAsB,GAAG,QAAQ,CAAC;AACxC,IAAM,oBAAoB,GAAG,UAAU,CAAC;AA2CxC;IAAA;IAEA,CAAC;IAFY,2BAA2B;QAzCvC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB;wBACE,IAAI,EAAE,sBAAsB;wBAC5B,SAAS,EAAE,6BAA6B;wBACxC,WAAW,EAAE,CAAC,kBAAkB,EAAE,yBAAyB,CAAC;qBAC7D;oBACD;wBACE,IAAI,EAAE,oBAAoB;wBAC1B,SAAS,EAAE,MAAM;wBACjB,SAAS,EAAE,2BAA2B;wBACtC,WAAW,EAAE,CAAC,kBAAkB,CAAC;wBACjC,OAAO,EAAE;4BACP,GAAG,EAAE,sBAAsB;yBAC5B;qBACF;oBACD;wBACE,IAAI,EAAE,YAAY;wBAClB,SAAS,EAAE,MAAM;wBACjB,SAAS,EAAE,6BAA6B;wBACxC,WAAW,EAAE,CAAC,kBAAkB,CAAC;wBACjC,OAAO,EAAE;4BACP,GAAG,EAAE,sBAAsB;yBAC5B;qBACF;oBACD;wBACE,IAAI,EAAE,KAAK;wBACX,SAAS,EAAE,uBAAuB;wBAClC,SAAS,EAAE,MAAM;wBACjB,OAAO,EAAE;4BACP,UAAU,EAAE,sBAAsB;yBACnC;qBACF;iBACF,CAAC;aACH;YACD,SAAS,EAAE;gBACT,sBAAsB;gBACtB,yBAAyB;aAC1B;SACF,CAAC;OACW,2BAA2B,CAEvC;IAAD,kCAAC;CAAA,AAFD,IAEC;SAFY,2BAA2B"} \ No newline at end of file diff --git a/src/app/+collection-page/collection-page.component.js b/src/app/+collection-page/collection-page.component.js new file mode 100644 index 0000000000..a742e85a08 --- /dev/null +++ b/src/app/+collection-page/collection-page.component.js @@ -0,0 +1,84 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { BehaviorSubject } from 'rxjs'; +import { filter, flatMap, map, startWith, switchMap, take } from 'rxjs/operators'; +import { PaginatedSearchOptions } from '../+search-page/paginated-search-options.model'; +import { SearchService } from '../+search-page/search-service/search.service'; +import { SortDirection, SortOptions } from '../core/cache/models/sort-options.model'; +import { CollectionDataService } from '../core/data/collection-data.service'; +import { MetadataService } from '../core/metadata/metadata.service'; +import { DSpaceObjectType } from '../core/shared/dspace-object-type.model'; +import { getSucceededRemoteData, redirectToPageNotFoundOn404, toDSpaceObjectListRD } from '../core/shared/operators'; +import { fadeIn, fadeInOut } from '../shared/animations/fade'; +import { hasValue, isNotEmpty } from '../shared/empty.util'; +import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model'; +var CollectionPageComponent = /** @class */ (function () { + function CollectionPageComponent(collectionDataService, searchService, metadata, route, router) { + this.collectionDataService = collectionDataService; + this.searchService = searchService; + this.metadata = metadata; + this.route = route; + this.router = router; + this.paginationConfig = new PaginationComponentOptions(); + this.paginationConfig.id = 'collection-page-pagination'; + this.paginationConfig.pageSize = 5; + this.paginationConfig.currentPage = 1; + this.sortConfig = new SortOptions('dc.date.accessioned', SortDirection.DESC); + } + CollectionPageComponent.prototype.ngOnInit = function () { + var _this = this; + this.collectionRD$ = this.route.data.pipe(map(function (data) { return data.collection; }), redirectToPageNotFoundOn404(this.router), take(1)); + this.logoRD$ = this.collectionRD$.pipe(map(function (rd) { return rd.payload; }), filter(function (collection) { return hasValue(collection); }), flatMap(function (collection) { return collection.logo; })); + this.paginationChanges$ = new BehaviorSubject({ + paginationConfig: this.paginationConfig, + sortConfig: this.sortConfig + }); + this.itemRD$ = this.paginationChanges$.pipe(switchMap(function (dto) { return _this.collectionRD$.pipe(getSucceededRemoteData(), map(function (rd) { return rd.payload.id; }), switchMap(function (id) { + return _this.searchService.search(new PaginatedSearchOptions({ + scope: id, + pagination: dto.paginationConfig, + sort: dto.sortConfig, + dsoType: DSpaceObjectType.ITEM + })).pipe(toDSpaceObjectListRD()); + }), startWith(undefined) // Make sure switching pages shows loading component + ); })); + this.route.queryParams.pipe(take(1)).subscribe(function (params) { + _this.metadata.processRemoteData(_this.collectionRD$); + _this.onPaginationChange(params); + }); + }; + CollectionPageComponent.prototype.isNotEmpty = function (object) { + return isNotEmpty(object); + }; + CollectionPageComponent.prototype.onPaginationChange = function (event) { + this.paginationConfig.currentPage = +event.page || this.paginationConfig.currentPage; + this.paginationConfig.pageSize = +event.pageSize || this.paginationConfig.pageSize; + this.sortConfig.direction = event.sortDirection || this.sortConfig.direction; + this.sortConfig.field = event.sortField || this.sortConfig.field; + this.paginationChanges$.next({ + paginationConfig: this.paginationConfig, + sortConfig: this.sortConfig + }); + }; + CollectionPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-collection-page', + styleUrls: ['./collection-page.component.scss'], + templateUrl: './collection-page.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + animations: [ + fadeIn, + fadeInOut + ] + }), + tslib_1.__metadata("design:paramtypes", [CollectionDataService, + SearchService, + MetadataService, + ActivatedRoute, + Router]) + ], CollectionPageComponent); + return CollectionPageComponent; +}()); +export { CollectionPageComponent }; +//# sourceMappingURL=collection-page.component.js.map \ No newline at end of file diff --git a/src/app/+collection-page/collection-page.component.js.map b/src/app/+collection-page/collection-page.component.js.map new file mode 100644 index 0000000000..b8afa2f9eb --- /dev/null +++ b/src/app/+collection-page/collection-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collection-page.component.js","sourceRoot":"","sources":["collection-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBA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5B,CAAC,CAAC;IACL,CAAC;IAhFU,uBAAuB;QAVnC,SAAS,CAAC;YACT,QAAQ,EAAE,oBAAoB;YAC9B,SAAS,EAAE,CAAC,kCAAkC,CAAC;YAC/C,WAAW,EAAE,kCAAkC;YAC/C,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,UAAU,EAAE;gBACV,MAAM;gBACN,SAAS;aACV;SACF,CAAC;iDAaiC,qBAAqB;YAC7B,aAAa;YAClB,eAAe;YAClB,cAAc;YACb,MAAM;OAhBb,uBAAuB,CAiFnC;IAAD,8BAAC;CAAA,AAjFD,IAiFC;SAjFY,uBAAuB"} \ No newline at end of file diff --git a/src/app/+collection-page/collection-page.module.js b/src/app/+collection-page/collection-page.module.js new file mode 100644 index 0000000000..a120a2afc2 --- /dev/null +++ b/src/app/+collection-page/collection-page.module.js @@ -0,0 +1,37 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { SharedModule } from '../shared/shared.module'; +import { CollectionPageComponent } from './collection-page.component'; +import { CollectionPageRoutingModule } from './collection-page-routing.module'; +import { CreateCollectionPageComponent } from './create-collection-page/create-collection-page.component'; +import { CollectionFormComponent } from './collection-form/collection-form.component'; +import { EditCollectionPageComponent } from './edit-collection-page/edit-collection-page.component'; +import { DeleteCollectionPageComponent } from './delete-collection-page/delete-collection-page.component'; +import { SearchService } from '../+search-page/search-service/search.service'; +var CollectionPageModule = /** @class */ (function () { + function CollectionPageModule() { + } + CollectionPageModule = tslib_1.__decorate([ + NgModule({ + imports: [ + CommonModule, + SharedModule, + CollectionPageRoutingModule + ], + declarations: [ + CollectionPageComponent, + CreateCollectionPageComponent, + EditCollectionPageComponent, + DeleteCollectionPageComponent, + CollectionFormComponent + ], + providers: [ + SearchService + ] + }) + ], CollectionPageModule); + return CollectionPageModule; +}()); +export { CollectionPageModule }; +//# sourceMappingURL=collection-page.module.js.map \ No newline at end of file diff --git a/src/app/+collection-page/collection-page.module.js.map b/src/app/+collection-page/collection-page.module.js.map new file mode 100644 index 0000000000..d22adee8b0 --- /dev/null +++ b/src/app/+collection-page/collection-page.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collection-page.module.js","sourceRoot":"","sources":["collection-page.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,2DAA2D,CAAC;AAC1G,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACpG,OAAO,EAAE,6BAA6B,EAAE,MAAM,2DAA2D,CAAC;AAC1G,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAmB9E;IAAA;IAEA,CAAC;IAFY,oBAAoB;QAjBhC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY;gBACZ,YAAY;gBACZ,2BAA2B;aAC5B;YACD,YAAY,EAAE;gBACZ,uBAAuB;gBACvB,6BAA6B;gBAC7B,2BAA2B;gBAC3B,6BAA6B;gBAC7B,uBAAuB;aACxB;YACD,SAAS,EAAE;gBACT,aAAa;aACd;SACF,CAAC;OACW,oBAAoB,CAEhC;IAAD,2BAAC;CAAA,AAFD,IAEC;SAFY,oBAAoB"} \ No newline at end of file diff --git a/src/app/+collection-page/collection-page.resolver.js b/src/app/+collection-page/collection-page.resolver.js new file mode 100644 index 0000000000..c89a239f95 --- /dev/null +++ b/src/app/+collection-page/collection-page.resolver.js @@ -0,0 +1,30 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { CollectionDataService } from '../core/data/collection-data.service'; +import { find } from 'rxjs/operators'; +import { hasValue } from '../shared/empty.util'; +/** + * This class represents a resolver that requests a specific collection before the route is activated + */ +var CollectionPageResolver = /** @class */ (function () { + function CollectionPageResolver(collectionService) { + this.collectionService = collectionService; + } + /** + * Method for resolving a collection based on the parameters in the current route + * @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot + * @param {RouterStateSnapshot} state The current RouterStateSnapshot + * @returns Observable<> Emits the found collection based on the parameters in the current route, + * or an error if something went wrong + */ + CollectionPageResolver.prototype.resolve = function (route, state) { + return this.collectionService.findById(route.params.id).pipe(find(function (RD) { return hasValue(RD.error) || RD.hasSucceeded; })); + }; + CollectionPageResolver = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [CollectionDataService]) + ], CollectionPageResolver); + return CollectionPageResolver; +}()); +export { CollectionPageResolver }; +//# sourceMappingURL=collection-page.resolver.js.map \ No newline at end of file diff --git a/src/app/+collection-page/collection-page.resolver.js.map b/src/app/+collection-page/collection-page.resolver.js.map new file mode 100644 index 0000000000..3dfba260e5 --- /dev/null +++ b/src/app/+collection-page/collection-page.resolver.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collection-page.resolver.js","sourceRoot":"","sources":["collection-page.resolver.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD;;GAEG;AAEH;IACE,gCAAoB,iBAAwC;QAAxC,sBAAiB,GAAjB,iBAAiB,CAAuB;IAC5D,CAAC;IAED;;;;;;OAMG;IACH,wCAAO,GAAP,UAAQ,KAA6B,EAAE,KAA0B;QAC/D,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAC1D,IAAI,CAAC,UAAC,EAAE,IAAK,OAAA,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,YAAY,EAArC,CAAqC,CAAC,CACpD,CAAC;IACJ,CAAC;IAfU,sBAAsB;QADlC,UAAU,EAAE;iDAE4B,qBAAqB;OADjD,sBAAsB,CAgBlC;IAAD,6BAAC;CAAA,AAhBD,IAgBC;SAhBY,sBAAsB"} \ No newline at end of file diff --git a/src/app/+collection-page/create-collection-page/create-collection-page.component.js b/src/app/+collection-page/create-collection-page/create-collection-page.component.js new file mode 100644 index 0000000000..8f97a4ea87 --- /dev/null +++ b/src/app/+collection-page/create-collection-page/create-collection-page.component.js @@ -0,0 +1,36 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { CommunityDataService } from '../../core/data/community-data.service'; +import { RouteService } from '../../shared/services/route.service'; +import { Router } from '@angular/router'; +import { CreateComColPageComponent } from '../../shared/comcol-forms/create-comcol-page/create-comcol-page.component'; +import { CollectionDataService } from '../../core/data/collection-data.service'; +/** + * Component that represents the page where a user can create a new Collection + */ +var CreateCollectionPageComponent = /** @class */ (function (_super) { + tslib_1.__extends(CreateCollectionPageComponent, _super); + function CreateCollectionPageComponent(communityDataService, collectionDataService, routeService, router) { + var _this = _super.call(this, collectionDataService, communityDataService, routeService, router) || this; + _this.communityDataService = communityDataService; + _this.collectionDataService = collectionDataService; + _this.routeService = routeService; + _this.router = router; + _this.frontendURL = '/collections/'; + return _this; + } + CreateCollectionPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-create-collection', + styleUrls: ['./create-collection-page.component.scss'], + templateUrl: './create-collection-page.component.html' + }), + tslib_1.__metadata("design:paramtypes", [CommunityDataService, + CollectionDataService, + RouteService, + Router]) + ], CreateCollectionPageComponent); + return CreateCollectionPageComponent; +}(CreateComColPageComponent)); +export { CreateCollectionPageComponent }; +//# sourceMappingURL=create-collection-page.component.js.map \ No newline at end of file diff --git a/src/app/+collection-page/create-collection-page/create-collection-page.component.js.map b/src/app/+collection-page/create-collection-page/create-collection-page.component.js.map new file mode 100644 index 0000000000..2535e67a1e --- /dev/null +++ b/src/app/+collection-page/create-collection-page/create-collection-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create-collection-page.component.js","sourceRoot":"","sources":["create-collection-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2EAA2E,CAAC;AAEtH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF;;GAEG;AAMH;IAAmD,yDAAqC;IAGtF,uCACY,oBAA0C,EAC1C,qBAA4C,EAC5C,YAA0B,EAC1B,MAAc;QAJ1B,YAME,kBAAM,qBAAqB,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,CAAC,SACzE;QANW,0BAAoB,GAApB,oBAAoB,CAAsB;QAC1C,2BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,kBAAY,GAAZ,YAAY,CAAc;QAC1B,YAAM,GAAN,MAAM,CAAQ;QANhB,iBAAW,GAAG,eAAe,CAAC;;IASxC,CAAC;IAVU,6BAA6B;QALzC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,SAAS,EAAE,CAAC,yCAAyC,CAAC;YACtD,WAAW,EAAE,yCAAyC;SACvD,CAAC;iDAKkC,oBAAoB;YACnB,qBAAqB;YAC9B,YAAY;YAClB,MAAM;OAPf,6BAA6B,CAWzC;IAAD,oCAAC;CAAA,AAXD,CAAmD,yBAAyB,GAW3E;SAXY,6BAA6B"} \ No newline at end of file diff --git a/src/app/+collection-page/create-collection-page/create-collection-page.guard.js b/src/app/+collection-page/create-collection-page/create-collection-page.guard.js new file mode 100644 index 0000000000..41d75851c9 --- /dev/null +++ b/src/app/+collection-page/create-collection-page/create-collection-page.guard.js @@ -0,0 +1,45 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { Router } from '@angular/router'; +import { hasNoValue, hasValue } from '../../shared/empty.util'; +import { CommunityDataService } from '../../core/data/community-data.service'; +import { getFinishedRemoteData } from '../../core/shared/operators'; +import { map, tap } from 'rxjs/operators'; +import { of as observableOf } from 'rxjs'; +/** + * Prevent creation of a collection without a parent community provided + * @class CreateCollectionPageGuard + */ +var CreateCollectionPageGuard = /** @class */ (function () { + function CreateCollectionPageGuard(router, communityService) { + this.router = router; + this.communityService = communityService; + } + /** + * True when either a parent ID query parameter has been provided and the parent ID resolves to a valid parent community + * Reroutes to a 404 page when the page cannot be activated + * @method canActivate + */ + CreateCollectionPageGuard.prototype.canActivate = function (route, state) { + var _this = this; + var parentID = route.queryParams.parent; + if (hasNoValue(parentID)) { + this.router.navigate(['/404']); + return observableOf(false); + } + var parent = this.communityService.findById(parentID) + .pipe(getFinishedRemoteData()); + return parent.pipe(map(function (communityRD) { return hasValue(communityRD) && communityRD.hasSucceeded && hasValue(communityRD.payload); }), tap(function (isValid) { + if (!isValid) { + _this.router.navigate(['/404']); + } + })); + }; + CreateCollectionPageGuard = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Router, CommunityDataService]) + ], CreateCollectionPageGuard); + return CreateCollectionPageGuard; +}()); +export { CreateCollectionPageGuard }; +//# sourceMappingURL=create-collection-page.guard.js.map \ No newline at end of file diff --git a/src/app/+collection-page/create-collection-page/create-collection-page.guard.js.map b/src/app/+collection-page/create-collection-page/create-collection-page.guard.js.map new file mode 100644 index 0000000000..77d53f7057 --- /dev/null +++ b/src/app/+collection-page/create-collection-page/create-collection-page.guard.js.map @@ -0,0 +1 @@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AG,CAAC,UAAC,OAAgB;YACnB,IAAI,CAAC,OAAO,EAAE;gBACZ,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;aAChC;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IA5BU,yBAAyB;QADrC,UAAU,EAAE;iDAEwB,MAAM,EAA4B,oBAAoB;OAD9E,yBAAyB,CA6BrC;IAAD,gCAAC;CAAA,AA7BD,IA6BC;SA7BY,yBAAyB"} \ No newline at end of file diff --git a/src/app/+collection-page/delete-collection-page/delete-collection-page.component.js b/src/app/+collection-page/delete-collection-page/delete-collection-page.component.js new file mode 100644 index 0000000000..c665f0f566 --- /dev/null +++ b/src/app/+collection-page/delete-collection-page/delete-collection-page.component.js @@ -0,0 +1,38 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { DeleteComColPageComponent } from '../../shared/comcol-forms/delete-comcol-page/delete-comcol-page.component'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { CollectionDataService } from '../../core/data/collection-data.service'; +import { TranslateService } from '@ngx-translate/core'; +/** + * Component that represents the page where a user can delete an existing Collection + */ +var DeleteCollectionPageComponent = /** @class */ (function (_super) { + tslib_1.__extends(DeleteCollectionPageComponent, _super); + function DeleteCollectionPageComponent(dsoDataService, router, route, notifications, translate) { + var _this = _super.call(this, dsoDataService, router, route, notifications, translate) || this; + _this.dsoDataService = dsoDataService; + _this.router = router; + _this.route = route; + _this.notifications = notifications; + _this.translate = translate; + _this.frontendURL = '/collections/'; + return _this; + } + DeleteCollectionPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-delete-collection', + styleUrls: ['./delete-collection-page.component.scss'], + templateUrl: './delete-collection-page.component.html' + }), + tslib_1.__metadata("design:paramtypes", [CollectionDataService, + Router, + ActivatedRoute, + NotificationsService, + TranslateService]) + ], DeleteCollectionPageComponent); + return DeleteCollectionPageComponent; +}(DeleteComColPageComponent)); +export { DeleteCollectionPageComponent }; +//# sourceMappingURL=delete-collection-page.component.js.map \ No newline at end of file diff --git a/src/app/+collection-page/delete-collection-page/delete-collection-page.component.js.map b/src/app/+collection-page/delete-collection-page/delete-collection-page.component.js.map new file mode 100644 index 0000000000..00071e93c9 --- /dev/null +++ b/src/app/+collection-page/delete-collection-page/delete-collection-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"delete-collection-page.component.js","sourceRoot":"","sources":["delete-collection-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2EAA2E,CAAC;AACtH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;GAEG;AAMH;IAAmD,yDAAqC;IAGtF,uCACY,cAAqC,EACrC,MAAc,EACd,KAAqB,EACrB,aAAmC,EACnC,SAA2B;QALvC,YAOE,kBAAM,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,CAAC,SAC/D;QAPW,oBAAc,GAAd,cAAc,CAAuB;QACrC,YAAM,GAAN,MAAM,CAAQ;QACd,WAAK,GAAL,KAAK,CAAgB;QACrB,mBAAa,GAAb,aAAa,CAAsB;QACnC,eAAS,GAAT,SAAS,CAAkB;QAP7B,iBAAW,GAAG,eAAe,CAAC;;IAUxC,CAAC;IAXU,6BAA6B;QALzC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,SAAS,EAAE,CAAC,yCAAyC,CAAC;YACtD,WAAW,EAAE,yCAAyC;SACvD,CAAC;iDAK4B,qBAAqB;YAC7B,MAAM;YACP,cAAc;YACN,oBAAoB;YACxB,gBAAgB;OAR5B,6BAA6B,CAYzC;IAAD,oCAAC;CAAA,AAZD,CAAmD,yBAAyB,GAY3E;SAZY,6BAA6B"} \ No newline at end of file diff --git a/src/app/+collection-page/edit-collection-page/edit-collection-page.component.js b/src/app/+collection-page/edit-collection-page/edit-collection-page.component.js new file mode 100644 index 0000000000..501fbe6684 --- /dev/null +++ b/src/app/+collection-page/edit-collection-page/edit-collection-page.component.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { EditComColPageComponent } from '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component'; +import { CollectionDataService } from '../../core/data/collection-data.service'; +/** + * Component that represents the page where a user can edit an existing Collection + */ +var EditCollectionPageComponent = /** @class */ (function (_super) { + tslib_1.__extends(EditCollectionPageComponent, _super); + function EditCollectionPageComponent(collectionDataService, router, route) { + var _this = _super.call(this, collectionDataService, router, route) || this; + _this.collectionDataService = collectionDataService; + _this.router = router; + _this.route = route; + _this.frontendURL = '/collections/'; + return _this; + } + EditCollectionPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-edit-collection', + styleUrls: ['./edit-collection-page.component.scss'], + templateUrl: './edit-collection-page.component.html' + }), + tslib_1.__metadata("design:paramtypes", [CollectionDataService, + Router, + ActivatedRoute]) + ], EditCollectionPageComponent); + return EditCollectionPageComponent; +}(EditComColPageComponent)); +export { EditCollectionPageComponent }; +//# sourceMappingURL=edit-collection-page.component.js.map \ No newline at end of file diff --git a/src/app/+collection-page/edit-collection-page/edit-collection-page.component.js.map b/src/app/+collection-page/edit-collection-page/edit-collection-page.component.js.map new file mode 100644 index 0000000000..a16ce783da --- /dev/null +++ b/src/app/+collection-page/edit-collection-page/edit-collection-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-collection-page.component.js","sourceRoot":"","sources":["edit-collection-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uEAAuE,CAAC;AAEhH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF;;GAEG;AAMH;IAAiD,uDAAmC;IAGlF,qCACY,qBAA4C,EAC5C,MAAc,EACd,KAAqB;QAHjC,YAKE,kBAAM,qBAAqB,EAAE,MAAM,EAAE,KAAK,CAAC,SAC5C;QALW,2BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,YAAM,GAAN,MAAM,CAAQ;QACd,WAAK,GAAL,KAAK,CAAgB;QALvB,iBAAW,GAAG,eAAe,CAAC;;IAQxC,CAAC;IATU,2BAA2B;QALvC,SAAS,CAAC;YACT,QAAQ,EAAE,oBAAoB;YAC9B,SAAS,EAAE,CAAC,uCAAuC,CAAC;YACpD,WAAW,EAAE,uCAAuC;SACrD,CAAC;iDAKmC,qBAAqB;YACpC,MAAM;YACP,cAAc;OANtB,2BAA2B,CAUvC;IAAD,kCAAC;CAAA,AAVD,CAAiD,uBAAuB,GAUvE;SAVY,2BAA2B"} \ No newline at end of file diff --git a/src/app/+community-page/community-form/community-form.component.js b/src/app/+community-page/community-form/community-form.component.js new file mode 100644 index 0000000000..1e3a3ff52e --- /dev/null +++ b/src/app/+community-page/community-form/community-form.component.js @@ -0,0 +1,71 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core'; +import { Community } from '../../core/shared/community.model'; +import { ResourceType } from '../../core/shared/resource-type'; +import { ComColFormComponent } from '../../shared/comcol-forms/comcol-form/comcol-form.component'; +/** + * Form used for creating and editing communities + */ +var CommunityFormComponent = /** @class */ (function (_super) { + tslib_1.__extends(CommunityFormComponent, _super); + function CommunityFormComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * @type {Community} A new community when a community is being created, an existing Input community when a community is being edited + */ + _this.dso = new Community(); + /** + * @type {ResourceType.Community} This is a community-type form + */ + _this.type = ResourceType.Community; + /** + * The dynamic form fields used for creating/editing a community + * @type {(DynamicInputModel | DynamicTextAreaModel)[]} + */ + _this.formModel = [ + new DynamicInputModel({ + id: 'title', + name: 'dc.title', + required: true, + validators: { + required: null + }, + errorMessages: { + required: 'Please enter a name for this title' + }, + }), + new DynamicTextAreaModel({ + id: 'description', + name: 'dc.description', + }), + new DynamicTextAreaModel({ + id: 'abstract', + name: 'dc.description.abstract', + }), + new DynamicTextAreaModel({ + id: 'rights', + name: 'dc.rights', + }), + new DynamicTextAreaModel({ + id: 'tableofcontents', + name: 'dc.description.tableofcontents', + }), + ]; + return _this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Community) + ], CommunityFormComponent.prototype, "dso", void 0); + CommunityFormComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-community-form', + styleUrls: ['../../shared/comcol-forms/comcol-form/comcol-form.component.scss'], + templateUrl: '../../shared/comcol-forms/comcol-form/comcol-form.component.html' + }) + ], CommunityFormComponent); + return CommunityFormComponent; +}(ComColFormComponent)); +export { CommunityFormComponent }; +//# sourceMappingURL=community-form.component.js.map \ No newline at end of file diff --git a/src/app/+community-page/community-form/community-form.component.js.map b/src/app/+community-page/community-form/community-form.component.js.map new file mode 100644 index 0000000000..1c01094432 --- /dev/null +++ b/src/app/+community-page/community-form/community-form.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-form.component.js","sourceRoot":"","sources":["community-form.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAC;AAElG;;GAEG;AAMH;IAA4C,kDAA8B;IAL1E;QAAA,qEAiDC;QA3CC;;WAEG;QACM,SAAG,GAAc,IAAI,SAAS,EAAE,CAAC;QAE1C;;WAEG;QACO,UAAI,GAAG,YAAY,CAAC,SAAS,CAAC;QAExC;;;WAGG;QACH,eAAS,GAA8B;YACrC,IAAI,iBAAiB,CAAC;gBACpB,EAAE,EAAE,OAAO;gBACX,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;gBACd,UAAU,EAAE;oBACV,QAAQ,EAAE,IAAI;iBACf;gBACD,aAAa,EAAE;oBACb,QAAQ,EAAE,oCAAoC;iBAC/C;aACF,CAAC;YACF,IAAI,oBAAoB,CAAC;gBACvB,EAAE,EAAE,aAAa;gBACjB,IAAI,EAAE,gBAAgB;aACvB,CAAC;YACF,IAAI,oBAAoB,CAAC;gBACvB,EAAE,EAAE,UAAU;gBACd,IAAI,EAAE,yBAAyB;aAChC,CAAC;YACF,IAAI,oBAAoB,CAAC;gBACvB,EAAE,EAAE,QAAQ;gBACZ,IAAI,EAAE,WAAW;aAClB,CAAC;YACF,IAAI,oBAAoB,CAAC;gBACvB,EAAE,EAAE,iBAAiB;gBACrB,IAAI,EAAE,gCAAgC;aACvC,CAAC;SACH,CAAC;;IACJ,CAAC;IAxCU;QAAR,KAAK,EAAE;0CAAM,SAAS;uDAAmB;IAJ/B,sBAAsB;QALlC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,SAAS,EAAE,CAAC,kEAAkE,CAAC;YAC/E,WAAW,EAAE,kEAAkE;SAChF,CAAC;OACW,sBAAsB,CA4ClC;IAAD,6BAAC;CAAA,AA5CD,CAA4C,mBAAmB,GA4C9D;SA5CY,sBAAsB"} \ No newline at end of file diff --git a/src/app/+community-page/community-page-routing.module.js b/src/app/+community-page/community-page-routing.module.js new file mode 100644 index 0000000000..90e57901b1 --- /dev/null +++ b/src/app/+community-page/community-page-routing.module.js @@ -0,0 +1,74 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { CommunityPageComponent } from './community-page.component'; +import { CommunityPageResolver } from './community-page.resolver'; +import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component'; +import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; +import { EditCommunityPageComponent } from './edit-community-page/edit-community-page.component'; +import { CreateCommunityPageGuard } from './create-community-page/create-community-page.guard'; +import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component'; +import { URLCombiner } from '../core/url-combiner/url-combiner'; +import { getCommunityModulePath } from '../app-routing.module'; +export var COMMUNITY_PARENT_PARAMETER = 'parent'; +export function getCommunityPageRoute(communityId) { + return new URLCombiner(getCommunityModulePath(), communityId).toString(); +} +export function getCommunityEditPath(id) { + return new URLCombiner(getCommunityModulePath(), COMMUNITY_EDIT_PATH.replace(/:id/, id)).toString(); +} +export function getCommunityCreatePath() { + return new URLCombiner(getCommunityModulePath(), COMMUNITY_CREATE_PATH).toString(); +} +var COMMUNITY_CREATE_PATH = 'create'; +var COMMUNITY_EDIT_PATH = ':id/edit'; +var CommunityPageRoutingModule = /** @class */ (function () { + function CommunityPageRoutingModule() { + } + CommunityPageRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { + path: COMMUNITY_CREATE_PATH, + component: CreateCommunityPageComponent, + canActivate: [AuthenticatedGuard, CreateCommunityPageGuard] + }, + { + path: COMMUNITY_EDIT_PATH, + pathMatch: 'full', + component: EditCommunityPageComponent, + canActivate: [AuthenticatedGuard], + resolve: { + dso: CommunityPageResolver + } + }, + { + path: ':id/delete', + pathMatch: 'full', + component: DeleteCommunityPageComponent, + canActivate: [AuthenticatedGuard], + resolve: { + dso: CommunityPageResolver + } + }, + { + path: ':id', + component: CommunityPageComponent, + pathMatch: 'full', + resolve: { + community: CommunityPageResolver + } + } + ]) + ], + providers: [ + CommunityPageResolver, + CreateCommunityPageGuard + ] + }) + ], CommunityPageRoutingModule); + return CommunityPageRoutingModule; +}()); +export { CommunityPageRoutingModule }; +//# sourceMappingURL=community-page-routing.module.js.map \ No newline at end of file diff --git a/src/app/+community-page/community-page-routing.module.js.map b/src/app/+community-page/community-page-routing.module.js.map new file mode 100644 index 0000000000..068f814986 --- /dev/null +++ b/src/app/+community-page/community-page-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-page-routing.module.js","sourceRoot":"","sources":["community-page-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AAC/F,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,CAAC,IAAM,0BAA0B,GAAG,QAAQ,CAAC;AAEnD,MAAM,gCAAgC,WAAmB;IACvD,OAAO,IAAI,WAAW,CAAC,sBAAsB,EAAE,EAAE,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC3E,CAAC;AAED,MAAM,+BAA+B,EAAU;IAC7C,OAAO,IAAI,WAAW,CAAC,sBAAsB,EAAE,EAAE,mBAAmB,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;AACrG,CAAC;AAED,MAAM;IACJ,OAAO,IAAI,WAAW,CAAC,sBAAsB,EAAE,EAAE,qBAAqB,CAAC,CAAC,QAAQ,EAAE,CAAA;AACpF,CAAC;AAED,IAAM,qBAAqB,GAAG,QAAQ,CAAC;AACvC,IAAM,mBAAmB,GAAG,UAAU,CAAC;AA2CvC;IAAA;IAEA,CAAC;IAFY,0BAA0B;QAzCtC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB;wBACE,IAAI,EAAE,qBAAqB;wBAC3B,SAAS,EAAE,4BAA4B;wBACvC,WAAW,EAAE,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;qBAC5D;oBACD;wBACE,IAAI,EAAE,mBAAmB;wBACzB,SAAS,EAAE,MAAM;wBACjB,SAAS,EAAE,0BAA0B;wBACrC,WAAW,EAAE,CAAC,kBAAkB,CAAC;wBACjC,OAAO,EAAE;4BACP,GAAG,EAAE,qBAAqB;yBAC3B;qBACF;oBACD;wBACE,IAAI,EAAE,YAAY;wBAClB,SAAS,EAAE,MAAM;wBACjB,SAAS,EAAE,4BAA4B;wBACvC,WAAW,EAAE,CAAC,kBAAkB,CAAC;wBACjC,OAAO,EAAE;4BACP,GAAG,EAAE,qBAAqB;yBAC3B;qBACF;oBACD;wBACE,IAAI,EAAE,KAAK;wBACX,SAAS,EAAE,sBAAsB;wBACjC,SAAS,EAAE,MAAM;wBACjB,OAAO,EAAE;4BACP,SAAS,EAAE,qBAAqB;yBACjC;qBACF;iBACF,CAAC;aACH;YACD,SAAS,EAAE;gBACT,qBAAqB;gBACrB,wBAAwB;aACzB;SACF,CAAC;OACW,0BAA0B,CAEtC;IAAD,iCAAC;CAAA,AAFD,IAEC;SAFY,0BAA0B"} \ No newline at end of file diff --git a/src/app/+community-page/community-page.component.js b/src/app/+community-page/community-page.component.js new file mode 100644 index 0000000000..bc42786fb2 --- /dev/null +++ b/src/app/+community-page/community-page.component.js @@ -0,0 +1,41 @@ +import * as tslib_1 from "tslib"; +import { mergeMap, filter, map } from 'rxjs/operators'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { CommunityDataService } from '../core/data/community-data.service'; +import { MetadataService } from '../core/metadata/metadata.service'; +import { fadeInOut } from '../shared/animations/fade'; +import { hasValue } from '../shared/empty.util'; +import { redirectToPageNotFoundOn404 } from '../core/shared/operators'; +var CommunityPageComponent = /** @class */ (function () { + function CommunityPageComponent(communityDataService, metadata, route, router) { + this.communityDataService = communityDataService; + this.metadata = metadata; + this.route = route; + this.router = router; + } + CommunityPageComponent.prototype.ngOnInit = function () { + this.communityRD$ = this.route.data.pipe(map(function (data) { return data.community; }), redirectToPageNotFoundOn404(this.router)); + this.logoRD$ = this.communityRD$.pipe(map(function (rd) { return rd.payload; }), filter(function (community) { return hasValue(community); }), mergeMap(function (community) { return community.logo; })); + }; + CommunityPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-community-page', + styleUrls: ['./community-page.component.scss'], + templateUrl: './community-page.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + animations: [fadeInOut] + }) + /** + * This component represents a detail page for a single community + */ + , + tslib_1.__metadata("design:paramtypes", [CommunityDataService, + MetadataService, + ActivatedRoute, + Router]) + ], CommunityPageComponent); + return CommunityPageComponent; +}()); +export { CommunityPageComponent }; +//# sourceMappingURL=community-page.component.js.map \ No newline at end of file diff --git a/src/app/+community-page/community-page.component.js.map b/src/app/+community-page/community-page.component.js.map new file mode 100644 index 0000000000..07d717eb39 --- /dev/null +++ b/src/app/+community-page/community-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-page.component.js","sourceRoot":"","sources":["community-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAq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AW,EAAE,iCAAiC;YAC9C,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC;QACF;;WAEG;;iDAY+B,oBAAoB;YAChC,eAAe;YAClB,cAAc;YACb,MAAM;OAdb,sBAAsB,CA8BlC;IAAD,6BAAC;CAAA,AA9BD,IA8BC;SA9BY,sBAAsB"} \ No newline at end of file diff --git a/src/app/+community-page/community-page.module.js b/src/app/+community-page/community-page.module.js new file mode 100644 index 0000000000..539cd88251 --- /dev/null +++ b/src/app/+community-page/community-page.module.js @@ -0,0 +1,37 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { SharedModule } from '../shared/shared.module'; +import { CommunityPageComponent } from './community-page.component'; +import { CommunityPageSubCollectionListComponent } from './sub-collection-list/community-page-sub-collection-list.component'; +import { CommunityPageRoutingModule } from './community-page-routing.module'; +import { CommunityPageSubCommunityListComponent } from './sub-community-list/community-page-sub-community-list.component'; +import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component'; +import { CommunityFormComponent } from './community-form/community-form.component'; +import { EditCommunityPageComponent } from './edit-community-page/edit-community-page.component'; +import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component'; +var CommunityPageModule = /** @class */ (function () { + function CommunityPageModule() { + } + CommunityPageModule = tslib_1.__decorate([ + NgModule({ + imports: [ + CommonModule, + SharedModule, + CommunityPageRoutingModule + ], + declarations: [ + CommunityPageComponent, + CommunityPageSubCollectionListComponent, + CommunityPageSubCommunityListComponent, + CreateCommunityPageComponent, + EditCommunityPageComponent, + DeleteCommunityPageComponent, + CommunityFormComponent + ] + }) + ], CommunityPageModule); + return CommunityPageModule; +}()); +export { CommunityPageModule }; +//# sourceMappingURL=community-page.module.js.map \ No newline at end of file diff --git a/src/app/+community-page/community-page.module.js.map b/src/app/+community-page/community-page.module.js.map new file mode 100644 index 0000000000..cb88b79c67 --- /dev/null +++ b/src/app/+community-page/community-page.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-page.module.js","sourceRoot":"","sources":["community-page.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,uCAAuC,EAAE,MAAM,oEAAoE,CAAC;AAC7H,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAC,sCAAsC,EAAC,MAAM,kEAAkE,CAAC;AACxH,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AACvG,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AAmBvG;IAAA;IAEA,CAAC;IAFY,mBAAmB;QAjB/B,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY;gBACZ,YAAY;gBACZ,0BAA0B;aAC3B;YACD,YAAY,EAAE;gBACZ,sBAAsB;gBACtB,uCAAuC;gBACvC,sCAAsC;gBACtC,4BAA4B;gBAC5B,0BAA0B;gBAC1B,4BAA4B;gBAC5B,sBAAsB;aACvB;SACF,CAAC;OAEW,mBAAmB,CAE/B;IAAD,0BAAC;CAAA,AAFD,IAEC;SAFY,mBAAmB"} \ No newline at end of file diff --git a/src/app/+community-page/community-page.resolver.js b/src/app/+community-page/community-page.resolver.js new file mode 100644 index 0000000000..0396229374 --- /dev/null +++ b/src/app/+community-page/community-page.resolver.js @@ -0,0 +1,30 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { CommunityDataService } from '../core/data/community-data.service'; +import { find } from 'rxjs/operators'; +import { hasValue } from '../shared/empty.util'; +/** + * This class represents a resolver that requests a specific community before the route is activated + */ +var CommunityPageResolver = /** @class */ (function () { + function CommunityPageResolver(communityService) { + this.communityService = communityService; + } + /** + * Method for resolving a community based on the parameters in the current route + * @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot + * @param {RouterStateSnapshot} state The current RouterStateSnapshot + * @returns Observable<> Emits the found community based on the parameters in the current route, + * or an error if something went wrong + */ + CommunityPageResolver.prototype.resolve = function (route, state) { + return this.communityService.findById(route.params.id).pipe(find(function (RD) { return hasValue(RD.error) || RD.hasSucceeded; })); + }; + CommunityPageResolver = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [CommunityDataService]) + ], CommunityPageResolver); + return CommunityPageResolver; +}()); +export { CommunityPageResolver }; +//# sourceMappingURL=community-page.resolver.js.map \ No newline at end of file diff --git a/src/app/+community-page/community-page.resolver.js.map b/src/app/+community-page/community-page.resolver.js.map new file mode 100644 index 0000000000..0eb94034bf --- /dev/null +++ b/src/app/+community-page/community-page.resolver.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-page.resolver.js","sourceRoot":"","sources":["community-page.resolver.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD;;GAEG;AAEH;IACE,+BAAoB,gBAAsC;QAAtC,qBAAgB,GAAhB,gBAAgB,CAAsB;IAC1D,CAAC;IAED;;;;;;OAMG;IACH,uCAAO,GAAP,UAAQ,KAA6B,EAAE,KAA0B;QAC/D,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CACzD,IAAI,CAAC,UAAC,EAAE,IAAK,OAAA,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,YAAY,EAArC,CAAqC,CAAC,CACpD,CAAC;IACJ,CAAC;IAfU,qBAAqB;QADjC,UAAU,EAAE;iDAE2B,oBAAoB;OAD/C,qBAAqB,CAgBjC;IAAD,4BAAC;CAAA,AAhBD,IAgBC;SAhBY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+community-page/create-community-page/create-community-page.component.js b/src/app/+community-page/create-community-page/create-community-page.component.js new file mode 100644 index 0000000000..ffab1ff99d --- /dev/null +++ b/src/app/+community-page/create-community-page/create-community-page.component.js @@ -0,0 +1,33 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { CommunityDataService } from '../../core/data/community-data.service'; +import { RouteService } from '../../shared/services/route.service'; +import { Router } from '@angular/router'; +import { CreateComColPageComponent } from '../../shared/comcol-forms/create-comcol-page/create-comcol-page.component'; +/** + * Component that represents the page where a user can create a new Community + */ +var CreateCommunityPageComponent = /** @class */ (function (_super) { + tslib_1.__extends(CreateCommunityPageComponent, _super); + function CreateCommunityPageComponent(communityDataService, routeService, router) { + var _this = _super.call(this, communityDataService, communityDataService, routeService, router) || this; + _this.communityDataService = communityDataService; + _this.routeService = routeService; + _this.router = router; + _this.frontendURL = '/communities/'; + return _this; + } + CreateCommunityPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-create-community', + styleUrls: ['./create-community-page.component.scss'], + templateUrl: './create-community-page.component.html' + }), + tslib_1.__metadata("design:paramtypes", [CommunityDataService, + RouteService, + Router]) + ], CreateCommunityPageComponent); + return CreateCommunityPageComponent; +}(CreateComColPageComponent)); +export { CreateCommunityPageComponent }; +//# sourceMappingURL=create-community-page.component.js.map \ No newline at end of file diff --git a/src/app/+community-page/create-community-page/create-community-page.component.js.map b/src/app/+community-page/create-community-page/create-community-page.component.js.map new file mode 100644 index 0000000000..8b942217e7 --- /dev/null +++ b/src/app/+community-page/create-community-page/create-community-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create-community-page.component.js","sourceRoot":"","sources":["create-community-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2EAA2E,CAAC;AAEtH;;GAEG;AAMH;IAAkD,wDAAoC;IAGpF,sCACY,oBAA0C,EAC1C,YAA0B,EAC1B,MAAc;QAH1B,YAKE,kBAAM,oBAAoB,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,CAAC,SACxE;QALW,0BAAoB,GAApB,oBAAoB,CAAsB;QAC1C,kBAAY,GAAZ,YAAY,CAAc;QAC1B,YAAM,GAAN,MAAM,CAAQ;QALhB,iBAAW,GAAG,eAAe,CAAC;;IAQxC,CAAC;IATU,4BAA4B;QALxC,SAAS,CAAC;YACT,QAAQ,EAAE,qBAAqB;YAC/B,SAAS,EAAE,CAAC,wCAAwC,CAAC;YACrD,WAAW,EAAE,wCAAwC;SACtD,CAAC;iDAKkC,oBAAoB;YAC5B,YAAY;YAClB,MAAM;OANf,4BAA4B,CAUxC;IAAD,mCAAC;CAAA,AAVD,CAAkD,yBAAyB,GAU1E;SAVY,4BAA4B"} \ No newline at end of file diff --git a/src/app/+community-page/create-community-page/create-community-page.guard.js b/src/app/+community-page/create-community-page/create-community-page.guard.js new file mode 100644 index 0000000000..13ca3f2f3f --- /dev/null +++ b/src/app/+community-page/create-community-page/create-community-page.guard.js @@ -0,0 +1,44 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { Router } from '@angular/router'; +import { hasNoValue, hasValue } from '../../shared/empty.util'; +import { CommunityDataService } from '../../core/data/community-data.service'; +import { getFinishedRemoteData } from '../../core/shared/operators'; +import { map, tap } from 'rxjs/operators'; +import { of as observableOf } from 'rxjs'; +/** + * Prevent creation of a community with an invalid parent community provided + * @class CreateCommunityPageGuard + */ +var CreateCommunityPageGuard = /** @class */ (function () { + function CreateCommunityPageGuard(router, communityService) { + this.router = router; + this.communityService = communityService; + } + /** + * True when either NO parent ID query parameter has been provided, or the parent ID resolves to a valid parent community + * Reroutes to a 404 page when the page cannot be activated + * @method canActivate + */ + CreateCommunityPageGuard.prototype.canActivate = function (route, state) { + var _this = this; + var parentID = route.queryParams.parent; + if (hasNoValue(parentID)) { + return observableOf(true); + } + var parent = this.communityService.findById(parentID) + .pipe(getFinishedRemoteData()); + return parent.pipe(map(function (communityRD) { return hasValue(communityRD) && communityRD.hasSucceeded && hasValue(communityRD.payload); }), tap(function (isValid) { + if (!isValid) { + _this.router.navigate(['/404']); + } + })); + }; + CreateCommunityPageGuard = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Router, CommunityDataService]) + ], CreateCommunityPageGuard); + return CreateCommunityPageGuard; +}()); +export { CreateCommunityPageGuard }; +//# sourceMappingURL=create-community-page.guard.js.map \ No newline at end of file diff --git a/src/app/+community-page/create-community-page/create-community-page.guard.js.map b/src/app/+community-page/create-community-page/create-community-page.guard.js.map new file mode 100644 index 0000000000..4ce6534e18 --- /dev/null +++ b/src/app/+community-page/create-community-page/create-community-page.guard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create-community-page.guard.js","sourceRoot":"","sources":["create-community-page.guard.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAuC,MAAM,EAAuB,MAAM,iBAAiB,CAAC;AAEnG,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAG9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAEtD;;;GAGG;AAEH;IACE,kCAA2B,MAAc,EAAU,gBAAsC;QAA9D,WAAM,GAAN,MAAM,CAAQ;QAAU,qBAAgB,GAAhB,gBAAgB,CAAsB;IACzF,CAAC;IAED;;;;OAIG;IACH,8CAAW,GAAX,UAAY,KAA6B,EAAE,KAA0B;QAArE,iBAmBC;QAlBC,IAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC;QAC1C,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;YACxB,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;SAC3B;QAED,IAAM,MAAM,GAAsC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC;aACvF,IAAI,CACH,qBAAqB,EAAE,CACxB,CAAC;QAEJ,OAAO,MAAM,CAAC,IAAI,CAChB,GAAG,CAAC,UAAC,WAAkC,IAAK,OAAA,QAAQ,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,YAAY,IAAI,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,EAAlF,CAAkF,CAAC,EAC/H,GAAG,CAAC,UAAC,OAAgB;YACnB,IAAI,CAAC,OAAO,EAAE;gBACZ,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;aAChC;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IA5BU,wBAAwB;QADpC,UAAU,EAAE;iDAEwB,MAAM,EAA4B,oBAAoB;OAD9E,wBAAwB,CA6BpC;IAAD,+BAAC;CAAA,AA7BD,IA6BC;SA7BY,wBAAwB"} \ No newline at end of file diff --git a/src/app/+community-page/delete-community-page/delete-community-page.component.js b/src/app/+community-page/delete-community-page/delete-community-page.component.js new file mode 100644 index 0000000000..d440855302 --- /dev/null +++ b/src/app/+community-page/delete-community-page/delete-community-page.component.js @@ -0,0 +1,38 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { CommunityDataService } from '../../core/data/community-data.service'; +import { ActivatedRoute, Router } from '@angular/router'; +import { DeleteComColPageComponent } from '../../shared/comcol-forms/delete-comcol-page/delete-comcol-page.component'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { TranslateService } from '@ngx-translate/core'; +/** + * Component that represents the page where a user can delete an existing Community + */ +var DeleteCommunityPageComponent = /** @class */ (function (_super) { + tslib_1.__extends(DeleteCommunityPageComponent, _super); + function DeleteCommunityPageComponent(dsoDataService, router, route, notifications, translate) { + var _this = _super.call(this, dsoDataService, router, route, notifications, translate) || this; + _this.dsoDataService = dsoDataService; + _this.router = router; + _this.route = route; + _this.notifications = notifications; + _this.translate = translate; + _this.frontendURL = '/communities/'; + return _this; + } + DeleteCommunityPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-delete-community', + styleUrls: ['./delete-community-page.component.scss'], + templateUrl: './delete-community-page.component.html' + }), + tslib_1.__metadata("design:paramtypes", [CommunityDataService, + Router, + ActivatedRoute, + NotificationsService, + TranslateService]) + ], DeleteCommunityPageComponent); + return DeleteCommunityPageComponent; +}(DeleteComColPageComponent)); +export { DeleteCommunityPageComponent }; +//# sourceMappingURL=delete-community-page.component.js.map \ No newline at end of file diff --git a/src/app/+community-page/delete-community-page/delete-community-page.component.js.map b/src/app/+community-page/delete-community-page/delete-community-page.component.js.map new file mode 100644 index 0000000000..33e1b40085 --- /dev/null +++ b/src/app/+community-page/delete-community-page/delete-community-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"delete-community-page.component.js","sourceRoot":"","sources":["delete-community-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2EAA2E,CAAC;AACtH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;GAEG;AAMH;IAAkD,wDAAoC;IAGpF,sCACY,cAAoC,EACpC,MAAc,EACd,KAAqB,EACrB,aAAmC,EACnC,SAA2B;QALvC,YAOE,kBAAM,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,CAAC,SAC/D;QAPW,oBAAc,GAAd,cAAc,CAAsB;QACpC,YAAM,GAAN,MAAM,CAAQ;QACd,WAAK,GAAL,KAAK,CAAgB;QACrB,mBAAa,GAAb,aAAa,CAAsB;QACnC,eAAS,GAAT,SAAS,CAAkB;QAP7B,iBAAW,GAAG,eAAe,CAAC;;IAUxC,CAAC;IAXU,4BAA4B;QALxC,SAAS,CAAC;YACT,QAAQ,EAAE,qBAAqB;YAC/B,SAAS,EAAE,CAAC,wCAAwC,CAAC;YACrD,WAAW,EAAE,wCAAwC;SACtD,CAAC;iDAK4B,oBAAoB;YAC5B,MAAM;YACP,cAAc;YACN,oBAAoB;YACxB,gBAAgB;OAR5B,4BAA4B,CAYxC;IAAD,mCAAC;CAAA,AAZD,CAAkD,yBAAyB,GAY1E;SAZY,4BAA4B"} \ No newline at end of file diff --git a/src/app/+community-page/edit-community-page/edit-community-page.component.js b/src/app/+community-page/edit-community-page/edit-community-page.component.js new file mode 100644 index 0000000000..0f35b2512d --- /dev/null +++ b/src/app/+community-page/edit-community-page/edit-community-page.component.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { CommunityDataService } from '../../core/data/community-data.service'; +import { ActivatedRoute, Router } from '@angular/router'; +import { EditComColPageComponent } from '../../shared/comcol-forms/edit-comcol-page/edit-comcol-page.component'; +/** + * Component that represents the page where a user can edit an existing Community + */ +var EditCommunityPageComponent = /** @class */ (function (_super) { + tslib_1.__extends(EditCommunityPageComponent, _super); + function EditCommunityPageComponent(communityDataService, router, route) { + var _this = _super.call(this, communityDataService, router, route) || this; + _this.communityDataService = communityDataService; + _this.router = router; + _this.route = route; + _this.frontendURL = '/communities/'; + return _this; + } + EditCommunityPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-edit-community', + styleUrls: ['./edit-community-page.component.scss'], + templateUrl: './edit-community-page.component.html' + }), + tslib_1.__metadata("design:paramtypes", [CommunityDataService, + Router, + ActivatedRoute]) + ], EditCommunityPageComponent); + return EditCommunityPageComponent; +}(EditComColPageComponent)); +export { EditCommunityPageComponent }; +//# sourceMappingURL=edit-community-page.component.js.map \ No newline at end of file diff --git a/src/app/+community-page/edit-community-page/edit-community-page.component.js.map b/src/app/+community-page/edit-community-page/edit-community-page.component.js.map new file mode 100644 index 0000000000..c887e94a53 --- /dev/null +++ b/src/app/+community-page/edit-community-page/edit-community-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-community-page.component.js","sourceRoot":"","sources":["edit-community-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uEAAuE,CAAC;AAEhH;;GAEG;AAMH;IAAgD,sDAAkC;IAGhF,oCACY,oBAA0C,EAC1C,MAAc,EACd,KAAqB;QAHjC,YAKE,kBAAM,oBAAoB,EAAE,MAAM,EAAE,KAAK,CAAC,SAC3C;QALW,0BAAoB,GAApB,oBAAoB,CAAsB;QAC1C,YAAM,GAAN,MAAM,CAAQ;QACd,WAAK,GAAL,KAAK,CAAgB;QALvB,iBAAW,GAAG,eAAe,CAAC;;IAQxC,CAAC;IATU,0BAA0B;QALtC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,SAAS,EAAE,CAAC,sCAAsC,CAAC;YACnD,WAAW,EAAE,sCAAsC;SACpD,CAAC;iDAKkC,oBAAoB;YAClC,MAAM;YACP,cAAc;OANtB,0BAA0B,CAUtC;IAAD,iCAAC;CAAA,AAVD,CAAgD,uBAAuB,GAUtE;SAVY,0BAA0B"} \ No newline at end of file diff --git a/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.js b/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.js new file mode 100644 index 0000000000..fc4b186bcc --- /dev/null +++ b/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.js @@ -0,0 +1,26 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Community } from '../../core/shared/community.model'; +import { fadeIn } from '../../shared/animations/fade'; +var CommunityPageSubCollectionListComponent = /** @class */ (function () { + function CommunityPageSubCollectionListComponent() { + } + CommunityPageSubCollectionListComponent.prototype.ngOnInit = function () { + this.subCollectionsRDObs = this.community.collections; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Community) + ], CommunityPageSubCollectionListComponent.prototype, "community", void 0); + CommunityPageSubCollectionListComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-community-page-sub-collection-list', + styleUrls: ['./community-page-sub-collection-list.component.scss'], + templateUrl: './community-page-sub-collection-list.component.html', + animations: [fadeIn] + }) + ], CommunityPageSubCollectionListComponent); + return CommunityPageSubCollectionListComponent; +}()); +export { CommunityPageSubCollectionListComponent }; +//# sourceMappingURL=community-page-sub-collection-list.component.js.map \ No newline at end of file diff --git a/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.js.map b/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.js.map new file mode 100644 index 0000000000..c0755b38ff --- /dev/null +++ b/src/app/+community-page/sub-collection-list/community-page-sub-collection-list.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-page-sub-collection-list.component.js","sourceRoot":"","sources":["community-page-sub-collection-list.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAKzD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAStD;IAAA;IAOA,CAAC;IAHC,0DAAQ,GAAR;QACE,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;IACxD,CAAC;IALQ;QAAR,KAAK,EAAE;0CAAY,SAAS;8EAAC;IADnB,uCAAuC;QANnD,SAAS,CAAC;YACT,QAAQ,EAAE,uCAAuC;YACjD,SAAS,EAAE,CAAC,qDAAqD,CAAC;YAClE,WAAW,EAAE,qDAAqD;YAClE,UAAU,EAAC,CAAC,MAAM,CAAC;SACpB,CAAC;OACW,uCAAuC,CAOnD;IAAD,8CAAC;CAAA,AAPD,IAOC;SAPY,uCAAuC"} \ No newline at end of file diff --git a/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.js b/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.js new file mode 100644 index 0000000000..ca0cda801f --- /dev/null +++ b/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Community } from '../../core/shared/community.model'; +import { fadeIn } from '../../shared/animations/fade'; +var CommunityPageSubCommunityListComponent = /** @class */ (function () { + /** + * Component to render the sub-communities of a Community + */ + function CommunityPageSubCommunityListComponent() { + } + CommunityPageSubCommunityListComponent.prototype.ngOnInit = function () { + this.subCommunitiesRDObs = this.community.subcommunities; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Community) + ], CommunityPageSubCommunityListComponent.prototype, "community", void 0); + CommunityPageSubCommunityListComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-community-page-sub-community-list', + styleUrls: ['./community-page-sub-community-list.component.scss'], + templateUrl: './community-page-sub-community-list.component.html', + animations: [fadeIn] + }) + /** + * Component to render the sub-communities of a Community + */ + ], CommunityPageSubCommunityListComponent); + return CommunityPageSubCommunityListComponent; +}()); +export { CommunityPageSubCommunityListComponent }; +//# sourceMappingURL=community-page-sub-community-list.component.js.map \ No newline at end of file diff --git a/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.js.map b/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.js.map new file mode 100644 index 0000000000..83b0940e12 --- /dev/null +++ b/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-page-sub-community-list.component.js","sourceRoot":"","sources":["community-page-sub-community-list.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAGzD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAatD;IAHA;;OAEG;IACH;IAOA,CAAC;IAHC,yDAAQ,GAAR;QACE,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;IAC3D,CAAC;IALQ;QAAR,KAAK,EAAE;0CAAY,SAAS;6EAAC;IADnB,sCAAsC;QATlD,SAAS,CAAC;YACT,QAAQ,EAAE,sCAAsC;YAChD,SAAS,EAAE,CAAC,oDAAoD,CAAC;YACjE,WAAW,EAAE,oDAAoD;YACjE,UAAU,EAAC,CAAC,MAAM,CAAC;SACpB,CAAC;QACF;;WAEG;OACU,sCAAsC,CAOlD;IAAD,6CAAC;CAAA,AAPD,IAOC;SAPY,sCAAsC"} \ No newline at end of file diff --git a/src/app/+home-page/home-news/home-news.component.js b/src/app/+home-page/home-news/home-news.component.js new file mode 100644 index 0000000000..12efdd2381 --- /dev/null +++ b/src/app/+home-page/home-news/home-news.component.js @@ -0,0 +1,22 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +var HomeNewsComponent = /** @class */ (function () { + /** + * Component to render the news section on the home page + */ + function HomeNewsComponent() { + } + HomeNewsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-home-news', + styleUrls: ['./home-news.component.scss'], + templateUrl: './home-news.component.html' + }) + /** + * Component to render the news section on the home page + */ + ], HomeNewsComponent); + return HomeNewsComponent; +}()); +export { HomeNewsComponent }; +//# sourceMappingURL=home-news.component.js.map \ No newline at end of file diff --git a/src/app/+home-page/home-news/home-news.component.js.map b/src/app/+home-page/home-news/home-news.component.js.map new file mode 100644 index 0000000000..3f9db2ee72 --- /dev/null +++ b/src/app/+home-page/home-news/home-news.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"home-news.component.js","sourceRoot":"","sources":["home-news.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAW1C;IAHA;;OAEG;IACH;IAEA,CAAC;IAFY,iBAAiB;QAT7B,SAAS,CAAC;YACT,QAAQ,EAAE,cAAc;YACxB,SAAS,EAAE,CAAC,4BAA4B,CAAC;YACzC,WAAW,EAAE,4BAA4B;SAC1C,CAAC;QAEF;;WAEG;OACU,iBAAiB,CAE7B;IAAD,wBAAC;CAAA,AAFD,IAEC;SAFY,iBAAiB"} \ No newline at end of file diff --git a/src/app/+home-page/home-page-routing.module.js b/src/app/+home-page/home-page-routing.module.js new file mode 100644 index 0000000000..8da63d71ee --- /dev/null +++ b/src/app/+home-page/home-page-routing.module.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { HomePageComponent } from './home-page.component'; +var HomePageRoutingModule = /** @class */ (function () { + function HomePageRoutingModule() { + } + HomePageRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: HomePageComponent, pathMatch: 'full', data: { title: 'home.title' } } + ]) + ] + }) + ], HomePageRoutingModule); + return HomePageRoutingModule; +}()); +export { HomePageRoutingModule }; +//# sourceMappingURL=home-page-routing.module.js.map \ No newline at end of file diff --git a/src/app/+home-page/home-page-routing.module.js.map b/src/app/+home-page/home-page-routing.module.js.map new file mode 100644 index 0000000000..0399763fc2 --- /dev/null +++ b/src/app/+home-page/home-page-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"home-page-routing.module.js","sourceRoot":"","sources":["home-page-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAS1D;IAAA;IAAqC,CAAC;IAAzB,qBAAqB;QAPjC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;iBAC7F,CAAC;aACH;SACF,CAAC;OACW,qBAAqB,CAAI;IAAD,4BAAC;CAAA,AAAtC,IAAsC;SAAzB,qBAAqB"} \ No newline at end of file diff --git a/src/app/+home-page/home-page.component.js b/src/app/+home-page/home-page.component.js new file mode 100644 index 0000000000..2b848cda4d --- /dev/null +++ b/src/app/+home-page/home-page.component.js @@ -0,0 +1,16 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +var HomePageComponent = /** @class */ (function () { + function HomePageComponent() { + } + HomePageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-home-page', + styleUrls: ['./home-page.component.scss'], + templateUrl: './home-page.component.html' + }) + ], HomePageComponent); + return HomePageComponent; +}()); +export { HomePageComponent }; +//# sourceMappingURL=home-page.component.js.map \ No newline at end of file diff --git a/src/app/+home-page/home-page.component.js.map b/src/app/+home-page/home-page.component.js.map new file mode 100644 index 0000000000..af97770d9b --- /dev/null +++ b/src/app/+home-page/home-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"home-page.component.js","sourceRoot":"","sources":["home-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAO1C;IAAA;IACA,CAAC;IADY,iBAAiB;QAL7B,SAAS,CAAC;YACT,QAAQ,EAAE,cAAc;YACxB,SAAS,EAAE,CAAC,4BAA4B,CAAC;YACzC,WAAW,EAAE,4BAA4B;SAC1C,CAAC;OACW,iBAAiB,CAC7B;IAAD,wBAAC;CAAA,AADD,IACC;SADY,iBAAiB"} \ No newline at end of file diff --git a/src/app/+home-page/home-page.module.js b/src/app/+home-page/home-page.module.js new file mode 100644 index 0000000000..d751a3636f --- /dev/null +++ b/src/app/+home-page/home-page.module.js @@ -0,0 +1,29 @@ +import * as tslib_1 from "tslib"; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { SharedModule } from '../shared/shared.module'; +import { HomeNewsComponent } from './home-news/home-news.component'; +import { HomePageRoutingModule } from './home-page-routing.module'; +import { HomePageComponent } from './home-page.component'; +import { TopLevelCommunityListComponent } from './top-level-community-list/top-level-community-list.component'; +var HomePageModule = /** @class */ (function () { + function HomePageModule() { + } + HomePageModule = tslib_1.__decorate([ + NgModule({ + imports: [ + CommonModule, + SharedModule, + HomePageRoutingModule + ], + declarations: [ + HomePageComponent, + TopLevelCommunityListComponent, + HomeNewsComponent, + ] + }) + ], HomePageModule); + return HomePageModule; +}()); +export { HomePageModule }; +//# sourceMappingURL=home-page.module.js.map \ No newline at end of file diff --git a/src/app/+home-page/home-page.module.js.map b/src/app/+home-page/home-page.module.js.map new file mode 100644 index 0000000000..ccc83d3a93 --- /dev/null +++ b/src/app/+home-page/home-page.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"home-page.module.js","sourceRoot":"","sources":["home-page.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,8BAA8B,EAAE,MAAM,+DAA+D,CAAC;AAc/G;IAAA;IAEA,CAAC;IAFY,cAAc;QAZ1B,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY;gBACZ,YAAY;gBACZ,qBAAqB;aACtB;YACD,YAAY,EAAE;gBACZ,iBAAiB;gBACjB,8BAA8B;gBAC9B,iBAAiB;aAClB;SACF,CAAC;OACW,cAAc,CAE1B;IAAD,qBAAC;CAAA,AAFD,IAEC;SAFY,cAAc"} \ No newline at end of file diff --git a/src/app/+home-page/top-level-community-list/top-level-community-list.component.js b/src/app/+home-page/top-level-community-list/top-level-community-list.component.js new file mode 100644 index 0000000000..b5cce1cade --- /dev/null +++ b/src/app/+home-page/top-level-community-list/top-level-community-list.component.js @@ -0,0 +1,65 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { BehaviorSubject } from 'rxjs'; +import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; +import { CommunityDataService } from '../../core/data/community-data.service'; +import { fadeInOut } from '../../shared/animations/fade'; +import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model'; +import { take } from 'rxjs/operators'; +/** + * this component renders the Top-Level Community list + */ +var TopLevelCommunityListComponent = /** @class */ (function () { + function TopLevelCommunityListComponent(cds) { + this.cds = cds; + /** + * A list of remote data objects of all top communities + */ + this.communitiesRD$ = new BehaviorSubject({}); + this.config = new PaginationComponentOptions(); + this.config.id = 'top-level-pagination'; + this.config.pageSize = 5; + this.config.currentPage = 1; + this.sortConfig = new SortOptions('dc.title', SortDirection.ASC); + } + TopLevelCommunityListComponent.prototype.ngOnInit = function () { + this.updatePage(); + }; + /** + * Called when one of the pagination settings is changed + * @param event The new pagination data + */ + TopLevelCommunityListComponent.prototype.onPaginationChange = function (event) { + this.config.currentPage = event.page; + this.config.pageSize = event.pageSize; + this.sortConfig.field = event.sortField; + this.sortConfig.direction = event.sortDirection; + this.updatePage(); + }; + /** + * Update the list of top communities + */ + TopLevelCommunityListComponent.prototype.updatePage = function () { + var _this = this; + this.cds.findTop({ + currentPage: this.config.currentPage, + elementsPerPage: this.config.pageSize, + sort: { field: this.sortConfig.field, direction: this.sortConfig.direction } + }).pipe(take(1)).subscribe(function (results) { + _this.communitiesRD$.next(results); + }); + }; + TopLevelCommunityListComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-top-level-community-list', + styleUrls: ['./top-level-community-list.component.scss'], + templateUrl: './top-level-community-list.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + animations: [fadeInOut] + }), + tslib_1.__metadata("design:paramtypes", [CommunityDataService]) + ], TopLevelCommunityListComponent); + return TopLevelCommunityListComponent; +}()); +export { TopLevelCommunityListComponent }; +//# sourceMappingURL=top-level-community-list.component.js.map \ No newline at end of file diff --git a/src/app/+home-page/top-level-community-list/top-level-community-list.component.js.map b/src/app/+home-page/top-level-community-list/top-level-community-list.component.js.map new file mode 100644 index 0000000000..2b88ba2755 --- /dev/null +++ b/src/app/+home-page/top-level-community-list/top-level-community-list.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"top-level-community-list.component.js","sourceRoot":"","sources":["top-level-community-list.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAc,MAAM,MAAM,CAAC;AACnD,OAAO,EAAE,aA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CAAC;YACf,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;YACpC,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YACrC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE;SAC7E,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,UAAC,OAAO;YACjC,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;IAnDU,8BAA8B;QAR1C,SAAS,CAAC;YACT,QAAQ,EAAE,6BAA6B;YACvC,SAAS,EAAE,CAAC,2CAA2C,CAAC;YACxD,WAAW,EAAE,2CAA2C;YACxD,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC;iDAkByB,oBAAoB;OAhBlC,8BAA8B,CAoD1C;IAAD,qCAAC;CAAA,AApDD,IAoDC;SApDY,8BAA8B"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/edit-item-operators.js b/src/app/+item-page/edit-item-page/edit-item-operators.js new file mode 100644 index 0000000000..c2df697b4c --- /dev/null +++ b/src/app/+item-page/edit-item-page/edit-item-operators.js @@ -0,0 +1,12 @@ +import { first } from 'rxjs/operators'; +import { getAllSucceededRemoteData } from '../../core/shared/operators'; +/** + * Return first Observable of a RemoteData object that complies to the provided predicate + * @param predicate + */ +export var findSuccessfulAccordingTo = function (predicate) { + return function (source) { + return source.pipe(getAllSucceededRemoteData(), first(predicate)); + }; +}; +//# sourceMappingURL=edit-item-operators.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/edit-item-operators.js.map b/src/app/+item-page/edit-item-page/edit-item-operators.js.map new file mode 100644 index 0000000000..978b047b60 --- /dev/null +++ b/src/app/+item-page/edit-item-page/edit-item-operators.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-item-operators.js","sourceRoot":"","sources":["edit-item-operators.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAC;AAEtE;;;GAGG;AACH,MAAM,CAAC,IAAM,yBAAyB,GAAG,UAAI,SAAyC;IACpF,OAAA,UAAC,MAAiC;QAChC,OAAA,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,EACrC,KAAK,CAAC,SAAS,CAAC,CAAC;IADnB,CACmB;AAFrB,CAEqB,CAAC"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/edit-item-page.component.js b/src/app/+item-page/edit-item-page/edit-item-page.component.js new file mode 100644 index 0000000000..66db98092f --- /dev/null +++ b/src/app/+item-page/edit-item-page/edit-item-page.component.js @@ -0,0 +1,49 @@ +import * as tslib_1 from "tslib"; +import { fadeIn, fadeInOut } from '../../shared/animations/fade'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { map } from 'rxjs/operators'; +import { isNotEmpty } from '../../shared/empty.util'; +import { getItemPageRoute } from '../item-page-routing.module'; +var EditItemPageComponent = /** @class */ (function () { + function EditItemPageComponent(route, router) { + var _this = this; + this.route = route; + this.router = router; + this.router.events.subscribe(function () { + _this.currentPage = _this.route.snapshot.firstChild.routeConfig.path; + }); + } + EditItemPageComponent.prototype.ngOnInit = function () { + this.pages = this.route.routeConfig.children + .map(function (child) { return child.path; }) + .filter(function (path) { return isNotEmpty(path); }); // ignore reroutes + this.itemRD$ = this.route.data.pipe(map(function (data) { return data.item; })); + }; + /** + * Get the item page url + * @param item The item for which the url is requested + */ + EditItemPageComponent.prototype.getItemPage = function (item) { + return getItemPageRoute(item.id); + }; + EditItemPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-edit-item-page', + templateUrl: './edit-item-page.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + animations: [ + fadeIn, + fadeInOut + ] + }) + /** + * Page component for editing an item + */ + , + tslib_1.__metadata("design:paramtypes", [ActivatedRoute, Router]) + ], EditItemPageComponent); + return EditItemPageComponent; +}()); +export { EditItemPageComponent }; +//# sourceMappingURL=edit-item-page.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/edit-item-page.component.js.map b/src/app/+item-page/edit-item-page/edit-item-page.component.js.map new file mode 100644 index 0000000000..4aa3f73f47 --- /dev/null +++ b/src/app/+item-page/edit-item-page/edit-item-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-item-page.component.js","sourceRoot":"","sources":["edit-item-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAIzD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAc/D;IAiBE,+BAAoB,KAAqB,EAAU,MAAc;QAAjE,iBAIC;QAJmB,UAAK,GAAL,KAAK,CAAgB;QAAU,WAAM,GAAN,MAAM,CAAQ;QAC/D,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;YAC3B,KAAI,CAAC,WAAW,GAAG,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC;QACrE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,wCAAQ,GAAR;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ;aACzC,GAAG,CAAC,UAAC,KAAU,IAAK,OAAA,KAAK,CAAC,IAAI,EAAV,CAAU,CAAC;aAC/B,MAAM,CAAC,UAAC,IAAY,IAAK,OAAA,UAAU,CAAC,IAAI,CAAC,EAAhB,CAAgB,CAAC,CAAC,CAAC,kBAAkB;QACjE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,IAAI,EAAT,CAAS,CAAC,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACH,2CAAW,GAAX,UAAY,IAAU;QACpB,OAAO,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAClC,CAAC;IApCU,qBAAqB;QAZjC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,WAAW,EAAE,iCAAiC;YAC9C,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,UAAU,EAAE;gBACV,MAAM;gBACN,SAAS;aACV;SACF,CAAC;QACF;;WAEG;;iDAkB0B,cAAc,EAAkB,MAAM;OAjBtD,qBAAqB,CAqCjC;IAAD,4BAAC;CAAA,AArCD,IAqCC;SArCY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/edit-item-page.module.js b/src/app/+item-page/edit-item-page/edit-item-page.module.js new file mode 100644 index 0000000000..e2bde7edc4 --- /dev/null +++ b/src/app/+item-page/edit-item-page/edit-item-page.module.js @@ -0,0 +1,52 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { SharedModule } from '../../shared/shared.module'; +import { EditItemPageRoutingModule } from './edit-item-page.routing.module'; +import { EditItemPageComponent } from './edit-item-page.component'; +import { ItemStatusComponent } from './item-status/item-status.component'; +import { ItemOperationComponent } from './item-operation/item-operation.component'; +import { ModifyItemOverviewComponent } from './modify-item-overview/modify-item-overview.component'; +import { ItemWithdrawComponent } from './item-withdraw/item-withdraw.component'; +import { ItemReinstateComponent } from './item-reinstate/item-reinstate.component'; +import { AbstractSimpleItemActionComponent } from './simple-item-action/abstract-simple-item-action.component'; +import { ItemPrivateComponent } from './item-private/item-private.component'; +import { ItemPublicComponent } from './item-public/item-public.component'; +import { ItemDeleteComponent } from './item-delete/item-delete.component'; +import { ItemMetadataComponent } from './item-metadata/item-metadata.component'; +import { EditInPlaceFieldComponent } from './item-metadata/edit-in-place-field/edit-in-place-field.component'; +import { ItemBitstreamsComponent } from './item-bitstreams/item-bitstreams.component'; +/** + * Module that contains all components related to the Edit Item page administrator functionality + */ +var EditItemPageModule = /** @class */ (function () { + function EditItemPageModule() { + } + EditItemPageModule = tslib_1.__decorate([ + NgModule({ + imports: [ + CommonModule, + SharedModule, + EditItemPageRoutingModule + ], + declarations: [ + EditItemPageComponent, + ItemOperationComponent, + AbstractSimpleItemActionComponent, + ModifyItemOverviewComponent, + ItemWithdrawComponent, + ItemReinstateComponent, + ItemPrivateComponent, + ItemPublicComponent, + ItemDeleteComponent, + ItemStatusComponent, + ItemMetadataComponent, + ItemBitstreamsComponent, + EditInPlaceFieldComponent + ] + }) + ], EditItemPageModule); + return EditItemPageModule; +}()); +export { EditItemPageModule }; +//# sourceMappingURL=edit-item-page.module.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/edit-item-page.module.js.map b/src/app/+item-page/edit-item-page/edit-item-page.module.js.map new file mode 100644 index 0000000000..430f30c211 --- /dev/null +++ b/src/app/+item-page/edit-item-page/edit-item-page.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-item-page.module.js","sourceRoot":"","sources":["edit-item-page.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,iCAAiC,EAAE,MAAM,4DAA4D,CAAC;AAC/G,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mEAAmE,CAAC;AAC9G,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAEtF;;GAEG;AAuBH;IAAA;IAEA,CAAC;IAFY,kBAAkB;QAtB9B,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY;gBACZ,YAAY;gBACZ,yBAAyB;aAC1B;YACD,YAAY,EAAE;gBACZ,qBAAqB;gBACrB,sBAAsB;gBACtB,iCAAiC;gBACjC,2BAA2B;gBAC3B,qBAAqB;gBACrB,sBAAsB;gBACtB,oBAAoB;gBACpB,mBAAmB;gBACnB,mBAAmB;gBACnB,mBAAmB;gBACnB,qBAAqB;gBACrB,uBAAuB;gBACvB,yBAAyB;aAC1B;SACF,CAAC;OACW,kBAAkB,CAE9B;IAAD,yBAAC;CAAA,AAFD,IAEC;SAFY,kBAAkB"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/edit-item-page.routing.module.js b/src/app/+item-page/edit-item-page/edit-item-page.routing.module.js new file mode 100644 index 0000000000..1893e5e894 --- /dev/null +++ b/src/app/+item-page/edit-item-page/edit-item-page.routing.module.js @@ -0,0 +1,114 @@ +import * as tslib_1 from "tslib"; +import { ItemPageResolver } from '../item-page.resolver'; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { EditItemPageComponent } from './edit-item-page.component'; +import { ItemWithdrawComponent } from './item-withdraw/item-withdraw.component'; +import { ItemReinstateComponent } from './item-reinstate/item-reinstate.component'; +import { ItemPrivateComponent } from './item-private/item-private.component'; +import { ItemPublicComponent } from './item-public/item-public.component'; +import { ItemDeleteComponent } from './item-delete/item-delete.component'; +import { ItemStatusComponent } from './item-status/item-status.component'; +import { ItemMetadataComponent } from './item-metadata/item-metadata.component'; +import { ItemBitstreamsComponent } from './item-bitstreams/item-bitstreams.component'; +var ITEM_EDIT_WITHDRAW_PATH = 'withdraw'; +var ITEM_EDIT_REINSTATE_PATH = 'reinstate'; +var ITEM_EDIT_PRIVATE_PATH = 'private'; +var ITEM_EDIT_PUBLIC_PATH = 'public'; +var ITEM_EDIT_DELETE_PATH = 'delete'; +/** + * Routing module that handles the routing for the Edit Item page administrator functionality + */ +var EditItemPageRoutingModule = /** @class */ (function () { + function EditItemPageRoutingModule() { + } + EditItemPageRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { + path: '', + component: EditItemPageComponent, + resolve: { + item: ItemPageResolver + }, + children: [ + { + path: '', + redirectTo: 'status', + }, + { + path: 'status', + component: ItemStatusComponent, + data: { title: 'item.edit.tabs.status.title' } + }, + { + path: 'bitstreams', + component: ItemBitstreamsComponent, + data: { title: 'item.edit.tabs.bitstreams.title' } + }, + { + path: 'metadata', + component: ItemMetadataComponent, + data: { title: 'item.edit.tabs.metadata.title' } + }, + { + path: 'view', + /* TODO - change when view page exists */ + component: ItemBitstreamsComponent, + data: { title: 'item.edit.tabs.view.title' } + }, + { + path: 'curate', + /* TODO - change when curate page exists */ + component: ItemBitstreamsComponent, + data: { title: 'item.edit.tabs.curate.title' } + }, + ] + }, + { + path: ITEM_EDIT_WITHDRAW_PATH, + component: ItemWithdrawComponent, + resolve: { + item: ItemPageResolver + } + }, + { + path: ITEM_EDIT_REINSTATE_PATH, + component: ItemReinstateComponent, + resolve: { + item: ItemPageResolver + } + }, + { + path: ITEM_EDIT_PRIVATE_PATH, + component: ItemPrivateComponent, + resolve: { + item: ItemPageResolver + } + }, + { + path: ITEM_EDIT_PUBLIC_PATH, + component: ItemPublicComponent, + resolve: { + item: ItemPageResolver + } + }, + { + path: ITEM_EDIT_DELETE_PATH, + component: ItemDeleteComponent, + resolve: { + item: ItemPageResolver + } + } + ]) + ], + providers: [ + ItemPageResolver, + ] + }) + ], EditItemPageRoutingModule); + return EditItemPageRoutingModule; +}()); +export { EditItemPageRoutingModule }; +//# sourceMappingURL=edit-item-page.routing.module.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/edit-item-page.routing.module.js.map b/src/app/+item-page/edit-item-page/edit-item-page.routing.module.js.map new file mode 100644 index 0000000000..85c2e5f787 --- /dev/null +++ b/src/app/+item-page/edit-item-page/edit-item-page.routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-item-page.routing.module.js","sourceRoot":"","sources":["edit-item-page.routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC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ACE,IAAI,EAAE,QAAQ;gCACd,2CAA2C;gCAC3C,SAAS,EAAE,uBAAuB;gCAClC,IAAI,EAAE,EAAE,KAAK,EAAE,6BAA6B,EAAE;6BAC/C;yBACF;qBACF;oBACD;wBACE,IAAI,EAAE,uBAAuB;wBAC7B,SAAS,EAAE,qBAAqB;wBAChC,OAAO,EAAE;4BACP,IAAI,EAAE,gBAAgB;yBACvB;qBACF;oBACD;wBACE,IAAI,EAAE,wBAAwB;wBAC9B,SAAS,EAAE,sBAAsB;wBACjC,OAAO,EAAE;4BACP,IAAI,EAAE,gBAAgB;yBACvB;qBACF;oBACD;wBACE,IAAI,EAAE,sBAAsB;wBAC5B,SAAS,EAAE,oBAAoB;wBAC/B,OAAO,EAAE;4BACP,IAAI,EAAE,gBAAgB;yBACvB;qBACF;oBACD;wBACE,IAAI,EAAE,qBAAqB;wBAC3B,SAAS,EAAE,mBAAmB;wBAC9B,OAAO,EAAE;4BACP,IAAI,EAAE,gBAAgB;yBACvB;qBACF;oBACD;wBACE,IAAI,EAAE,qBAAqB;wBAC3B,SAAS,EAAE,mBAAmB;wBAC9B,OAAO,EAAE;4BACP,IAAI,EAAE,gBAAgB;yBACvB;qBACF;iBAAC,CAAC;aACN;YACD,SAAS,EAAE;gBACT,gBAAgB;aACjB;SACF,CAAC;OACW,yBAAyB,CAErC;IAAD,gCAAC;CAAA,AAFD,IAEC;SAFY,yBAAyB"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-bitstreams/item-bitstreams.component.js b/src/app/+item-page/edit-item-page/item-bitstreams/item-bitstreams.component.js new file mode 100644 index 0000000000..38c0841ba8 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-bitstreams/item-bitstreams.component.js @@ -0,0 +1,22 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +var ItemBitstreamsComponent = /** @class */ (function () { + /** + * Component for displaying an item's bitstreams edit page + */ + function ItemBitstreamsComponent() { + } + ItemBitstreamsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-bitstreams', + styleUrls: ['./item-bitstreams.component.scss'], + templateUrl: './item-bitstreams.component.html', + }) + /** + * Component for displaying an item's bitstreams edit page + */ + ], ItemBitstreamsComponent); + return ItemBitstreamsComponent; +}()); +export { ItemBitstreamsComponent }; +//# sourceMappingURL=item-bitstreams.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-bitstreams/item-bitstreams.component.js.map b/src/app/+item-page/edit-item-page/item-bitstreams/item-bitstreams.component.js.map new file mode 100644 index 0000000000..3398c40f25 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-bitstreams/item-bitstreams.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-bitstreams.component.js","sourceRoot":"","sources":["item-bitstreams.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAU1C;IAHA;;OAEG;IACH;IAEA,CAAC;IAFY,uBAAuB;QARnC,SAAS,CAAC;YACT,QAAQ,EAAE,oBAAoB;YAC9B,SAAS,EAAE,CAAC,kCAAkC,CAAC;YAC/C,WAAW,EAAE,kCAAkC;SAChD,CAAC;QACF;;WAEG;OACU,uBAAuB,CAEnC;IAAD,8BAAC;CAAA,AAFD,IAEC;SAFY,uBAAuB"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-delete/item-delete.component.js b/src/app/+item-page/edit-item-page/item-delete/item-delete.component.js new file mode 100644 index 0000000000..bc12c6d8ec --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-delete/item-delete.component.js @@ -0,0 +1,48 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { first } from 'rxjs/operators'; +import { AbstractSimpleItemActionComponent } from '../simple-item-action/abstract-simple-item-action.component'; +import { getItemEditPath } from '../../item-page-routing.module'; +var ItemDeleteComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemDeleteComponent, _super); + function ItemDeleteComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.messageKey = 'delete'; + return _this; + } + /** + * Perform the delete action to the item + */ + ItemDeleteComponent.prototype.performAction = function () { + var _this = this; + this.itemDataService.delete(this.item).pipe(first()).subscribe(function (succeeded) { + _this.notify(succeeded); + }); + }; + /** + * When the item is successfully delete, navigate to the homepage, otherwise navigate back to the item edit page + * @param response + */ + ItemDeleteComponent.prototype.notify = function (succeeded) { + if (succeeded) { + this.notificationsService.success(this.translateService.get('item.edit.' + this.messageKey + '.success')); + this.router.navigate(['']); + } + else { + this.notificationsService.error(this.translateService.get('item.edit.' + this.messageKey + '.error')); + this.router.navigate([getItemEditPath(this.item.id)]); + } + }; + ItemDeleteComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-delete', + templateUrl: '../simple-item-action/abstract-simple-item-action.component.html' + }) + /** + * Component responsible for rendering the item delete page + */ + ], ItemDeleteComponent); + return ItemDeleteComponent; +}(AbstractSimpleItemActionComponent)); +export { ItemDeleteComponent }; +//# sourceMappingURL=item-delete.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-delete/item-delete.component.js.map b/src/app/+item-page/edit-item-page/item-delete/item-delete.component.js.map new file mode 100644 index 0000000000..41b8303672 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-delete/item-delete.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-delete.component.js","sourceRoot":"","sources":["item-delete.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,iCAAiC,EAAE,MAAM,6DAA6D,CAAC;AAChH,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAUjE;IAAyC,+CAAiC;IAP1E;QAAA,qEAmCC;QA1BW,gBAAU,GAAG,QAAQ,CAAC;;IA0BlC,CAAC;IAxBC;;OAEG;IACH,2CAAa,GAAb;QAAA,iBAMC;QALC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,CAC5D,UAAC,SAAkB;YACjB,KAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACzB,CAAC,CACF,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,oCAAM,GAAN,UAAO,SAAkB;QACvB,IAAI,SAAS,EAAE;YACb,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC;YAC1G,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC5B;aAAM;YACL,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC;YACtG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SACvD;IACH,CAAC;IA3BU,mBAAmB;QAP/B,SAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,kEAAkE;SAChF,CAAC;QACF;;WAEG;OACU,mBAAmB,CA4B/B;IAAD,0BAAC;CAAA,AA5BD,CAAyC,iCAAiC,GA4BzE;SA5BY,mBAAmB"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-metadata/edit-in-place-field/edit-in-place-field.component.js b/src/app/+item-page/edit-item-page/item-metadata/edit-in-place-field/edit-in-place-field.component.js new file mode 100644 index 0000000000..714a487ce3 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-metadata/edit-in-place-field/edit-in-place-field.component.js @@ -0,0 +1,159 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { hasValue, isNotEmpty } from '../../../../shared/empty.util'; +import { RegistryService } from '../../../../core/registry/registry.service'; +import { cloneDeep } from 'lodash'; +import { BehaviorSubject, of as observableOf } from 'rxjs'; +import { map, take } from 'rxjs/operators'; +import { FieldChangeType } from '../../../../core/data/object-updates/object-updates.actions'; +import { ObjectUpdatesService } from '../../../../core/data/object-updates/object-updates.service'; +var EditInPlaceFieldComponent = /** @class */ (function () { + function EditInPlaceFieldComponent(metadataFieldService, objectUpdatesService) { + this.metadataFieldService = metadataFieldService; + this.objectUpdatesService = objectUpdatesService; + /** + * The current suggestions for the metadatafield when editing + */ + this.metadataFieldSuggestions = new BehaviorSubject([]); + } + /** + * Sets up an observable that keeps track of the current editable and valid state of this field + */ + EditInPlaceFieldComponent.prototype.ngOnInit = function () { + this.editable = this.objectUpdatesService.isEditable(this.url, this.metadata.uuid); + this.valid = this.objectUpdatesService.isValid(this.url, this.metadata.uuid); + }; + /** + * Sends a new change update for this field to the object updates service + */ + EditInPlaceFieldComponent.prototype.update = function (ngModel) { + this.objectUpdatesService.saveChangeFieldUpdate(this.url, this.metadata); + if (hasValue(ngModel)) { + this.checkValidity(ngModel); + } + }; + /** + * Method to check the validity of a form control + * @param ngModel + */ + EditInPlaceFieldComponent.prototype.checkValidity = function (ngModel) { + ngModel.control.setValue(ngModel.viewModel); + ngModel.control.updateValueAndValidity(); + this.objectUpdatesService.setValidFieldUpdate(this.url, this.metadata.uuid, ngModel.control.valid); + }; + /** + * Sends a new editable state for this field to the service to change it + * @param editable The new editable state for this field + */ + EditInPlaceFieldComponent.prototype.setEditable = function (editable) { + this.objectUpdatesService.setEditableFieldUpdate(this.url, this.metadata.uuid, editable); + }; + /** + * Sends a new remove update for this field to the object updates service + */ + EditInPlaceFieldComponent.prototype.remove = function () { + this.objectUpdatesService.saveRemoveFieldUpdate(this.url, this.metadata); + }; + /** + * Notifies the object updates service that the updates for the current field can be removed + */ + EditInPlaceFieldComponent.prototype.removeChangesFromField = function () { + this.objectUpdatesService.removeSingleFieldUpdate(this.url, this.metadata.uuid); + }; + /** + * Sets the current metadatafield based on the fieldUpdate input field + */ + EditInPlaceFieldComponent.prototype.ngOnChanges = function () { + this.metadata = cloneDeep(this.fieldUpdate.field); + }; + /** + * Requests all metadata fields that contain the query string in their key + * Then sets all found metadata fields as metadataFieldSuggestions + * @param query The query to look for + */ + EditInPlaceFieldComponent.prototype.findMetadataFieldSuggestions = function (query) { + var _this = this; + if (isNotEmpty(query)) { + this.metadataFieldService.queryMetadataFields(query).pipe( + // getSucceededRemoteData(), + take(1), map(function (data) { return data.payload.page; })).subscribe(function (fields) { return _this.metadataFieldSuggestions.next(fields.map(function (field) { + return { + displayValue: field.toString().split('.').join('.​'), + value: field.toString() + }; + })); }); + } + else { + this.metadataFieldSuggestions.next([]); + } + }; + /** + * Check if a user should be allowed to edit this field + * @return an observable that emits true when the user should be able to edit this field and false when they should not + */ + EditInPlaceFieldComponent.prototype.canSetEditable = function () { + var _this = this; + return this.editable.pipe(map(function (editable) { + if (editable) { + return false; + } + else { + return _this.fieldUpdate.changeType !== FieldChangeType.REMOVE; + } + })); + }; + /** + * Check if a user should be allowed to disabled editing this field + * @return an observable that emits true when the user should be able to disable editing this field and false when they should not + */ + EditInPlaceFieldComponent.prototype.canSetUneditable = function () { + return this.editable; + }; + /** + * Check if a user should be allowed to remove this field + * @return an observable that emits true when the user should be able to remove this field and false when they should not + */ + EditInPlaceFieldComponent.prototype.canRemove = function () { + return observableOf(this.fieldUpdate.changeType !== FieldChangeType.REMOVE && this.fieldUpdate.changeType !== FieldChangeType.ADD); + }; + /** + * Check if a user should be allowed to undo changes to this field + * @return an observable that emits true when the user should be able to undo changes to this field and false when they should not + */ + EditInPlaceFieldComponent.prototype.canUndo = function () { + var _this = this; + return this.editable.pipe(map(function (editable) { return _this.fieldUpdate.changeType >= 0 || editable; })); + }; + EditInPlaceFieldComponent.prototype.isNotEmpty = function (value) { + return isNotEmpty(value); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], EditInPlaceFieldComponent.prototype, "fieldUpdate", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], EditInPlaceFieldComponent.prototype, "url", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], EditInPlaceFieldComponent.prototype, "metadataFields", void 0); + EditInPlaceFieldComponent = tslib_1.__decorate([ + Component({ + // tslint:disable-next-line:component-selector + selector: '[ds-edit-in-place-field]', + styleUrls: ['./edit-in-place-field.component.scss'], + templateUrl: './edit-in-place-field.component.html', + }) + /** + * Component that displays a single metadatum of an item on the edit page + */ + , + tslib_1.__metadata("design:paramtypes", [RegistryService, + ObjectUpdatesService]) + ], EditInPlaceFieldComponent); + return EditInPlaceFieldComponent; +}()); +export { EditInPlaceFieldComponent }; +//# sourceMappingURL=edit-in-place-field.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-metadata/edit-in-place-field/edit-in-place-field.component.js.map b/src/app/+item-page/edit-item-page/item-metadata/edit-in-place-field/edit-in-place-field.component.js.map new file mode 100644 index 0000000000..c54ec9f493 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-metadata/edit-in-place-field/edit-in-place-field.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-in-place-field.component.js","sourceRoot":"","sources":["edit-in-place-field.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,eAAe,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACvE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gB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,CAAC;YACnD,WAAW,EAAE,sCAAsC;SACpD,CAAC;QACF;;WAEG;;iDAsC+B,eAAe;YACf,oBAAoB;OAtCzC,yBAAyB,CA0KrC;IAAD,gCAAC;CAAA,AA1KD,IA0KC;SA1KY,yBAAyB"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.js b/src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.js new file mode 100644 index 0000000000..f9a20872c9 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.js @@ -0,0 +1,186 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { ItemDataService } from '../../../core/data/item-data.service'; +import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service'; +import { ActivatedRoute, Router } from '@angular/router'; +import { cloneDeep } from 'lodash'; +import { first, map, switchMap, take, tap } from 'rxjs/operators'; +import { getSucceededRemoteData } from '../../../core/shared/operators'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { GLOBAL_CONFIG } from '../../../../config'; +import { TranslateService } from '@ngx-translate/core'; +import { RegistryService } from '../../../core/registry/registry.service'; +import { MetadatumViewModel } from '../../../core/shared/metadata.models'; +import { Metadata } from '../../../core/shared/metadata.utils'; +var ItemMetadataComponent = /** @class */ (function () { + function ItemMetadataComponent(itemService, objectUpdatesService, router, notificationsService, translateService, EnvConfig, route, metadataFieldService) { + this.itemService = itemService; + this.objectUpdatesService = objectUpdatesService; + this.router = router; + this.notificationsService = notificationsService; + this.translateService = translateService; + this.EnvConfig = EnvConfig; + this.route = route; + this.metadataFieldService = metadataFieldService; + /** + * Prefix for this component's notification translate keys + */ + this.notificationsPrefix = 'item.edit.metadata.notifications.'; + } + /** + * Set up and initialize all fields + */ + ItemMetadataComponent.prototype.ngOnInit = function () { + var _this = this; + this.metadataFields$ = this.findMetadataFields(); + this.route.parent.data.pipe(map(function (data) { return data.item; })) + .pipe(first(), map(function (data) { return data.payload; })).subscribe(function (item) { + _this.item = item; + }); + this.discardTimeOut = this.EnvConfig.item.edit.undoTimeout; + this.url = this.router.url; + if (this.url.indexOf('?') > 0) { + this.url = this.url.substr(0, this.url.indexOf('?')); + } + this.hasChanges().pipe(first()).subscribe(function (hasChanges) { + if (!hasChanges) { + _this.initializeOriginalFields(); + } + else { + _this.checkLastModified(); + } + }); + this.updates$ = this.objectUpdatesService.getFieldUpdates(this.url, this.item.metadataAsList); + }; + /** + * Sends a new add update for a field to the object updates service + * @param metadata The metadata to add, if no parameter is supplied, create a new Metadatum + */ + ItemMetadataComponent.prototype.add = function (metadata) { + if (metadata === void 0) { metadata = new MetadatumViewModel(); } + this.objectUpdatesService.saveAddFieldUpdate(this.url, metadata); + }; + /** + * Request the object updates service to discard all current changes to this item + * Shows a notification to remind the user that they can undo this + */ + ItemMetadataComponent.prototype.discard = function () { + var undoNotification = this.notificationsService.info(this.getNotificationTitle('discarded'), this.getNotificationContent('discarded'), { timeOut: this.discardTimeOut }); + this.objectUpdatesService.discardFieldUpdates(this.url, undoNotification); + }; + /** + * Request the object updates service to undo discarding all changes to this item + */ + ItemMetadataComponent.prototype.reinstate = function () { + this.objectUpdatesService.reinstateFieldUpdates(this.url); + }; + /** + * Sends all initial values of this item to the object updates service + */ + ItemMetadataComponent.prototype.initializeOriginalFields = function () { + this.objectUpdatesService.initialize(this.url, this.item.metadataAsList, this.item.lastModified); + }; + /** + * Prevent unnecessary rerendering so fields don't lose focus + */ + ItemMetadataComponent.prototype.trackUpdate = function (index, update) { + return update && update.field ? update.field.uuid : undefined; + }; + /** + * Requests all current metadata for this item and requests the item service to update the item + * Makes sure the new version of the item is rendered on the page + */ + ItemMetadataComponent.prototype.submit = function () { + var _this = this; + this.isValid().pipe(first()).subscribe(function (isValid) { + if (isValid) { + var metadata$ = _this.objectUpdatesService.getUpdatedFields(_this.url, _this.item.metadataAsList); + metadata$.pipe(first(), switchMap(function (metadata) { + var updatedItem = Object.assign(cloneDeep(_this.item), { metadata: Metadata.toMetadataMap(metadata) }); + return _this.itemService.update(updatedItem); + }), tap(function () { return _this.itemService.commitUpdates(); }), getSucceededRemoteData()).subscribe(function (rd) { + _this.item = rd.payload; + _this.initializeOriginalFields(); + _this.updates$ = _this.objectUpdatesService.getFieldUpdates(_this.url, _this.item.metadataAsList); + _this.notificationsService.success(_this.getNotificationTitle('saved'), _this.getNotificationContent('saved')); + }); + } + else { + _this.notificationsService.error(_this.getNotificationTitle('invalid'), _this.getNotificationContent('invalid')); + } + }); + }; + /** + * Checks whether or not there are currently updates for this item + */ + ItemMetadataComponent.prototype.hasChanges = function () { + return this.objectUpdatesService.hasUpdates(this.url); + }; + /** + * Checks whether or not the item is currently reinstatable + */ + ItemMetadataComponent.prototype.isReinstatable = function () { + return this.objectUpdatesService.isReinstatable(this.url); + }; + /** + * Checks if the current item is still in sync with the version in the store + * If it's not, a notification is shown and the changes are removed + */ + ItemMetadataComponent.prototype.checkLastModified = function () { + var _this = this; + var currentVersion = this.item.lastModified; + this.objectUpdatesService.getLastModified(this.url).pipe(first()).subscribe(function (updateVersion) { + if (updateVersion.getDate() !== currentVersion.getDate()) { + _this.notificationsService.warning(_this.getNotificationTitle('outdated'), _this.getNotificationContent('outdated')); + _this.initializeOriginalFields(); + } + }); + }; + /** + * Check if the current page is entirely valid + */ + ItemMetadataComponent.prototype.isValid = function () { + return this.objectUpdatesService.isValidPage(this.url); + }; + /** + * Get translated notification title + * @param key + */ + ItemMetadataComponent.prototype.getNotificationTitle = function (key) { + return this.translateService.instant(this.notificationsPrefix + key + '.title'); + }; + /** + * Get translated notification content + * @param key + */ + ItemMetadataComponent.prototype.getNotificationContent = function (key) { + return this.translateService.instant(this.notificationsPrefix + key + '.content'); + }; + /** + * Method to request all metadata fields and convert them to a list of strings + */ + ItemMetadataComponent.prototype.findMetadataFields = function () { + return this.metadataFieldService.getAllMetadataFields().pipe(getSucceededRemoteData(), take(1), map(function (remoteData$) { return remoteData$.payload.page.map(function (field) { return field.toString(); }); })); + }; + ItemMetadataComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-metadata', + styleUrls: ['./item-metadata.component.scss'], + templateUrl: './item-metadata.component.html', + }) + /** + * Component for displaying an item's metadata edit page + */ + , + tslib_1.__param(5, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [ItemDataService, + ObjectUpdatesService, + Router, + NotificationsService, + TranslateService, Object, ActivatedRoute, + RegistryService]) + ], ItemMetadataComponent); + return ItemMetadataComponent; +}()); +export { ItemMetadataComponent }; +//# sourceMappingURL=item-metadata.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.js.map b/src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.js.map new file mode 100644 index 0000000000..2efc5bc4e1 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-metadata.component.js","sourceRoot":"","sources":["item-metadata.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAOnC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAgB,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MA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SAzMY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-operation/item-operation.component.js b/src/app/+item-page/edit-item-page/item-operation/item-operation.component.js new file mode 100644 index 0000000000..ac6cc8378a --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-operation/item-operation.component.js @@ -0,0 +1,26 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { ItemOperation } from './itemOperation.model'; +var ItemOperationComponent = /** @class */ (function () { + /** + * Operation that can be performed on an item + */ + function ItemOperationComponent() { + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", ItemOperation) + ], ItemOperationComponent.prototype, "operation", void 0); + ItemOperationComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-operation', + templateUrl: './item-operation.component.html' + }) + /** + * Operation that can be performed on an item + */ + ], ItemOperationComponent); + return ItemOperationComponent; +}()); +export { ItemOperationComponent }; +//# sourceMappingURL=item-operation.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-operation/item-operation.component.js.map b/src/app/+item-page/edit-item-page/item-operation/item-operation.component.js.map new file mode 100644 index 0000000000..b19f8a3412 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-operation/item-operation.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-operation.component.js","sourceRoot":"","sources":["item-operation.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AASpD;IAHA;;OAEG;IACH;IAIA,CAAC;IAFU;QAAR,KAAK,EAAE;0CAAY,aAAa;6DAAC;IAFvB,sBAAsB;QAPlC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,WAAW,EAAE,iCAAiC;SAC/C,CAAC;QACF;;WAEG;OACU,sBAAsB,CAIlC;IAAD,6BAAC;CAAA,AAJD,IAIC;SAJY,sBAAsB"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-operation/itemOperation.model.js b/src/app/+item-page/edit-item-page/item-operation/itemOperation.model.js new file mode 100644 index 0000000000..582d03e091 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-operation/itemOperation.model.js @@ -0,0 +1,21 @@ +/** + * Represents an item operation used on the edit item page with a key, an operation URL to which will be navigated + * when performing the action and an option to disable the operation. + */ +var ItemOperation = /** @class */ (function () { + function ItemOperation(operationKey, operationUrl) { + this.operationKey = operationKey; + this.operationUrl = operationUrl; + this.setDisabled(false); + } + /** + * Set whether this operation should be disabled + * @param disabled + */ + ItemOperation.prototype.setDisabled = function (disabled) { + this.disabled = disabled; + }; + return ItemOperation; +}()); +export { ItemOperation }; +//# sourceMappingURL=itemOperation.model.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-operation/itemOperation.model.js.map b/src/app/+item-page/edit-item-page/item-operation/itemOperation.model.js.map new file mode 100644 index 0000000000..302a9610f4 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-operation/itemOperation.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"itemOperation.model.js","sourceRoot":"","sources":["itemOperation.model.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IAME,uBAAY,YAAoB,EAAE,YAAoB;QACpD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,mCAAW,GAAX,UAAY,QAAiB;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEH,oBAAC;AAAD,CAAC,AApBD,IAoBC"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-private/item-private.component.js b/src/app/+item-page/edit-item-page/item-private/item-private.component.js new file mode 100644 index 0000000000..95d003f645 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-private/item-private.component.js @@ -0,0 +1,34 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { first } from 'rxjs/operators'; +import { AbstractSimpleItemActionComponent } from '../simple-item-action/abstract-simple-item-action.component'; +var ItemPrivateComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemPrivateComponent, _super); + function ItemPrivateComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.messageKey = 'private'; + _this.predicate = function (rd) { return !rd.payload.isDiscoverable; }; + return _this; + } + /** + * Perform the make private action to the item + */ + ItemPrivateComponent.prototype.performAction = function () { + var _this = this; + this.itemDataService.setDiscoverable(this.item.id, false).pipe(first()).subscribe(function (response) { + _this.processRestResponse(response); + }); + }; + ItemPrivateComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-private', + templateUrl: '../simple-item-action/abstract-simple-item-action.component.html' + }) + /** + * Component responsible for rendering the make item private page + */ + ], ItemPrivateComponent); + return ItemPrivateComponent; +}(AbstractSimpleItemActionComponent)); +export { ItemPrivateComponent }; +//# sourceMappingURL=item-private.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-private/item-private.component.js.map b/src/app/+item-page/edit-item-page/item-private/item-private.component.js.map new file mode 100644 index 0000000000..71ff598e2e --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-private/item-private.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-private.component.js","sourceRoot":"","sources":["item-private.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,iCAAiC,EAAE,MAAM,6DAA6D,CAAC;AAYhH;IAA0C,gDAAiC;IAP3E;QAAA,qEAsBC;QAbW,gBAAU,GAAG,SAAS,CAAC;QACvB,eAAS,GAAG,UAAC,EAAoB,IAAK,OAAA,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,EAA1B,CAA0B,CAAC;;IAY7E,CAAC;IAVC;;OAEG;IACH,4CAAa,GAAb;QAAA,iBAMC;QALC,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,CAC/E,UAAC,QAAsB;YACrB,KAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC,CACF,CAAC;IACJ,CAAC;IAdU,oBAAoB;QAPhC,SAAS,CAAC;YACT,QAAQ,EAAE,iBAAiB;YAC3B,WAAW,EAAE,kEAAkE;SAChF,CAAC;QACF;;WAEG;OACU,oBAAoB,CAehC;IAAD,2BAAC;CAAA,AAfD,CAA0C,iCAAiC,GAe1E;SAfY,oBAAoB"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-public/item-public.component.js b/src/app/+item-page/edit-item-page/item-public/item-public.component.js new file mode 100644 index 0000000000..34d76abab2 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-public/item-public.component.js @@ -0,0 +1,34 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { first } from 'rxjs/operators'; +import { AbstractSimpleItemActionComponent } from '../simple-item-action/abstract-simple-item-action.component'; +var ItemPublicComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemPublicComponent, _super); + function ItemPublicComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.messageKey = 'public'; + _this.predicate = function (rd) { return rd.payload.isDiscoverable; }; + return _this; + } + /** + * Perform the make public action to the item + */ + ItemPublicComponent.prototype.performAction = function () { + var _this = this; + this.itemDataService.setDiscoverable(this.item.id, true).pipe(first()).subscribe(function (response) { + _this.processRestResponse(response); + }); + }; + ItemPublicComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-public', + templateUrl: '../simple-item-action/abstract-simple-item-action.component.html' + }) + /** + * Component responsible for rendering the make item public page + */ + ], ItemPublicComponent); + return ItemPublicComponent; +}(AbstractSimpleItemActionComponent)); +export { ItemPublicComponent }; +//# sourceMappingURL=item-public.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-public/item-public.component.js.map b/src/app/+item-page/edit-item-page/item-public/item-public.component.js.map new file mode 100644 index 0000000000..9a71a24c7f --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-public/item-public.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-public.component.js","sourceRoot":"","sources":["item-public.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,iCAAiC,EAAE,MAAM,6DAA6D,CAAC;AAYhH;IAAyC,+CAAiC;IAP1E;QAAA,qEAsBC;QAbW,gBAAU,GAAG,QAAQ,CAAC;QACtB,eAAS,GAAG,UAAC,EAAoB,IAAK,OAAA,EAAE,CAAC,OAAO,CAAC,cAAc,EAAzB,CAAyB,CAAC;;IAY5E,CAAC;IAVC;;OAEG;IACH,2CAAa,GAAb;QAAA,iBAMC;QALC,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,CAC9E,UAAC,QAAsB;YACrB,KAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC,CACF,CAAC;IACJ,CAAC;IAdU,mBAAmB;QAP/B,SAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,kEAAkE;SAChF,CAAC;QACF;;WAEG;OACU,mBAAmB,CAe/B;IAAD,0BAAC;CAAA,AAfD,CAAyC,iCAAiC,GAezE;SAfY,mBAAmB"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.js b/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.js new file mode 100644 index 0000000000..470c381f5d --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.js @@ -0,0 +1,34 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { first } from 'rxjs/operators'; +import { AbstractSimpleItemActionComponent } from '../simple-item-action/abstract-simple-item-action.component'; +var ItemReinstateComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemReinstateComponent, _super); + function ItemReinstateComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.messageKey = 'reinstate'; + _this.predicate = function (rd) { return !rd.payload.isWithdrawn; }; + return _this; + } + /** + * Perform the reinstate action to the item + */ + ItemReinstateComponent.prototype.performAction = function () { + var _this = this; + this.itemDataService.setWithDrawn(this.item.id, false).pipe(first()).subscribe(function (response) { + _this.processRestResponse(response); + }); + }; + ItemReinstateComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-reinstate', + templateUrl: '../simple-item-action/abstract-simple-item-action.component.html' + }) + /** + * Component responsible for rendering the Item Reinstate page + */ + ], ItemReinstateComponent); + return ItemReinstateComponent; +}(AbstractSimpleItemActionComponent)); +export { ItemReinstateComponent }; +//# sourceMappingURL=item-reinstate.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.js.map b/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.js.map new file mode 100644 index 0000000000..367f0a837a --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-reinstate.component.js","sourceRoot":"","sources":["item-reinstate.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,iCAAiC,EAAE,MAAM,6DAA6D,CAAC;AAYhH;IAA4C,kDAAiC;IAP7E;QAAA,qEAsBC;QAbW,gBAAU,GAAG,WAAW,CAAC;QACzB,eAAS,GAAG,UAAC,EAAoB,IAAK,OAAA,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,EAAvB,CAAuB,CAAC;;IAY1E,CAAC;IAVC;;OAEG;IACH,8CAAa,GAAb;QAAA,iBAMC;QALC,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,CAC5E,UAAC,QAAsB;YACrB,KAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC,CACF,CAAC;IACJ,CAAC;IAdU,sBAAsB;QAPlC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,WAAW,EAAE,kEAAkE;SAChF,CAAC;QACF;;WAEG;OACU,sBAAsB,CAelC;IAAD,6BAAC;CAAA,AAfD,CAA4C,iCAAiC,GAe5E;SAfY,sBAAsB"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-status/item-status.component.js b/src/app/+item-page/edit-item-page/item-status/item-status.component.js new file mode 100644 index 0000000000..b85b66ff05 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-status/item-status.component.js @@ -0,0 +1,76 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { fadeIn, fadeInOut } from '../../../shared/animations/fade'; +import { ActivatedRoute } from '@angular/router'; +import { ItemOperation } from '../item-operation/itemOperation.model'; +import { first, map } from 'rxjs/operators'; +import { getItemEditPath, getItemPageRoute } from '../../item-page-routing.module'; +var ItemStatusComponent = /** @class */ (function () { + function ItemStatusComponent(route) { + this.route = route; + } + ItemStatusComponent.prototype.ngOnInit = function () { + var _this = this; + this.itemRD$ = this.route.parent.data.pipe(map(function (data) { return data.item; })); + this.itemRD$.pipe(first(), map(function (data) { return data.payload; })).subscribe(function (item) { + _this.statusData = Object.assign({ + id: item.id, + handle: item.handle, + lastModified: item.lastModified + }); + _this.statusDataKeys = Object.keys(_this.statusData); + /* + The key is used to build messages + i18n example: 'item.edit.tabs.status.buttons..label' + The value is supposed to be a href for the button + */ + _this.operations = []; + if (item.isWithdrawn) { + _this.operations.push(new ItemOperation('reinstate', _this.getCurrentUrl(item) + '/reinstate')); + } + else { + _this.operations.push(new ItemOperation('withdraw', _this.getCurrentUrl(item) + '/withdraw')); + } + if (item.isDiscoverable) { + _this.operations.push(new ItemOperation('private', _this.getCurrentUrl(item) + '/private')); + } + else { + _this.operations.push(new ItemOperation('public', _this.getCurrentUrl(item) + '/public')); + } + _this.operations.push(new ItemOperation('delete', _this.getCurrentUrl(item) + '/delete')); + }); + }; + /** + * Get the url to the simple item page + * @returns {string} url + */ + ItemStatusComponent.prototype.getItemPage = function (item) { + return getItemPageRoute(item.id); + }; + /** + * Get the current url without query params + * @returns {string} url + */ + ItemStatusComponent.prototype.getCurrentUrl = function (item) { + return getItemEditPath(item.id); + }; + ItemStatusComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-status', + templateUrl: './item-status.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + animations: [ + fadeIn, + fadeInOut + ] + }) + /** + * Component for displaying an item's status + */ + , + tslib_1.__metadata("design:paramtypes", [ActivatedRoute]) + ], ItemStatusComponent); + return ItemStatusComponent; +}()); +export { ItemStatusComponent }; +//# sourceMappingURL=item-status.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-status/item-status.component.js.map b/src/app/+item-page/edit-item-page/item-status/item-status.component.js.map new file mode 100644 index 0000000000..fdb5deeb72 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-status/item-status.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-status.component.js","sourceRoot":"","sources":["item-status.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,SAAS,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/edit-item-page/item-withdraw/item-withdraw.component.js new file mode 100644 index 0000000000..0fc78dfbc4 --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.js @@ -0,0 +1,34 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { first } from 'rxjs/operators'; +import { AbstractSimpleItemActionComponent } from '../simple-item-action/abstract-simple-item-action.component'; +var ItemWithdrawComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemWithdrawComponent, _super); + function ItemWithdrawComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.messageKey = 'withdraw'; + _this.predicate = function (rd) { return rd.payload.isWithdrawn; }; + return _this; + } + /** + * Perform the withdraw action to the item + */ + ItemWithdrawComponent.prototype.performAction = function () { + var _this = this; + this.itemDataService.setWithDrawn(this.item.id, true).pipe(first()).subscribe(function (response) { + _this.processRestResponse(response); + }); + }; + ItemWithdrawComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-withdraw', + templateUrl: '../simple-item-action/abstract-simple-item-action.component.html' + }) + /** + * Component responsible for rendering the Item Withdraw page + */ + ], ItemWithdrawComponent); + return ItemWithdrawComponent; +}(AbstractSimpleItemActionComponent)); +export { ItemWithdrawComponent }; +//# sourceMappingURL=item-withdraw.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.js.map b/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.js.map new file mode 100644 index 0000000000..ab69e37d3a --- /dev/null +++ b/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-withdraw.component.js","sourceRoot":"","sources":["item-withdraw.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,iCAAiC,EAAE,MAAM,6DAA6D,CAAC;AAYhH;IAA2C,iDAAiC;IAP5E;QAAA,qEAsBC;QAbW,gBAAU,GAAG,UAAU,CAAC;QACxB,eAAS,GAAG,UAAC,EAAoB,IAAK,OAAA,EAAE,CAAC,OAAO,CAAC,WAAW,EAAtB,CAAsB,CAAC;;IAYzE,CAAC;IAVC;;OAEG;IACH,6CAAa,GAAb;QAAA,iBAMC;QALC,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,CAC3E,UAAC,QAAsB;YACrB,KAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC,CACF,CAAC;IACJ,CAAC;IAdU,qBAAqB;QAPjC,SAAS,CAAC;YACT,QAAQ,EAAE,kBAAkB;YAC5B,WAAW,EAAE,kEAAkE;SAChF,CAAC;QACF;;WAEG;OACU,qBAAqB,CAejC;IAAD,4BAAC;CAAA,AAfD,CAA2C,iCAAiC,GAe3E;SAfY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/modify-item-overview/modify-item-overview.component.js b/src/app/+item-page/edit-item-page/modify-item-overview/modify-item-overview.component.js new file mode 100644 index 0000000000..29d7d1b974 --- /dev/null +++ b/src/app/+item-page/edit-item-page/modify-item-overview/modify-item-overview.component.js @@ -0,0 +1,29 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../core/shared/item.model'; +var ModifyItemOverviewComponent = /** @class */ (function () { + /** + * Component responsible for rendering a table containing the metadatavalues from the to be edited item + */ + function ModifyItemOverviewComponent() { + } + ModifyItemOverviewComponent.prototype.ngOnInit = function () { + this.metadata = this.item.metadata; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], ModifyItemOverviewComponent.prototype, "item", void 0); + ModifyItemOverviewComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-modify-item-overview', + templateUrl: './modify-item-overview.component.html' + }) + /** + * Component responsible for rendering a table containing the metadatavalues from the to be edited item + */ + ], ModifyItemOverviewComponent); + return ModifyItemOverviewComponent; +}()); +export { ModifyItemOverviewComponent }; +//# sourceMappingURL=modify-item-overview.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/modify-item-overview/modify-item-overview.component.js.map b/src/app/+item-page/edit-item-page/modify-item-overview/modify-item-overview.component.js.map new file mode 100644 index 0000000000..fb94baa3be --- /dev/null +++ b/src/app/+item-page/edit-item-page/modify-item-overview/modify-item-overview.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"modify-item-overview.component.js","sourceRoot":"","sources":["modify-item-overview.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,KAAK,EAAS,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,IAAI,EAAC,MAAM,iCAAiC,CAAC;AAUrD;IAHA;;OAEG;IACH;IAQA,CAAC;IAHC,8CAAQ,GAAR;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;IACrC,CAAC;IALQ;QAAR,KAAK,EAAE;0CAAO,IAAI;6DAAC;IAFT,2BAA2B;QAPvC,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,WAAW,EAAE,uCAAuC;SACrD,CAAC;QACF;;WAEG;OACU,2BAA2B,CAQvC;IAAD,kCAAC;CAAA,AARD,IAQC;SARY,2BAA2B"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.js b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.js new file mode 100644 index 0000000000..3ff17e9605 --- /dev/null +++ b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.js @@ -0,0 +1,72 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { ItemDataService } from '../../../core/data/item-data.service'; +import { TranslateService } from '@ngx-translate/core'; +import { getSucceededRemoteData } from '../../../core/shared/operators'; +import { first, map } from 'rxjs/operators'; +import { findSuccessfulAccordingTo } from '../edit-item-operators'; +import { getItemEditPath } from '../../item-page-routing.module'; +/** + * Component to render and handle simple item edit actions such as withdrawal and reinstatement. + * This component is not meant to be used itself but to be extended. + */ +var AbstractSimpleItemActionComponent = /** @class */ (function () { + function AbstractSimpleItemActionComponent(route, router, notificationsService, itemDataService, translateService) { + this.route = route; + this.router = router; + this.notificationsService = notificationsService; + this.itemDataService = itemDataService; + this.translateService = translateService; + } + AbstractSimpleItemActionComponent.prototype.ngOnInit = function () { + var _this = this; + this.itemRD$ = this.route.data.pipe(map(function (data) { return data.item; }), getSucceededRemoteData()); + this.itemRD$.pipe(first()).subscribe(function (rd) { + _this.item = rd.payload; + }); + this.confirmMessage = 'item.edit.' + this.messageKey + '.confirm'; + this.cancelMessage = 'item.edit.' + this.messageKey + '.cancel'; + this.headerMessage = 'item.edit.' + this.messageKey + '.header'; + this.descriptionMessage = 'item.edit.' + this.messageKey + '.description'; + }; + /** + * Perform the operation linked to this action + */ + AbstractSimpleItemActionComponent.prototype.performAction = function () { + // Overwrite in subclasses + }; + ; + /** + * Process the response obtained during the performAction method and navigate back to the edit page + * @param response from the action in the performAction method + */ + AbstractSimpleItemActionComponent.prototype.processRestResponse = function (response) { + var _this = this; + if (response.isSuccessful) { + this.itemDataService.findById(this.item.id).pipe(findSuccessfulAccordingTo(this.predicate)).subscribe(function () { + _this.notificationsService.success(_this.translateService.get('item.edit.' + _this.messageKey + '.success')); + _this.router.navigate([getItemEditPath(_this.item.id)]); + }); + } + else { + this.notificationsService.error(this.translateService.get('item.edit.' + this.messageKey + '.error')); + this.router.navigate([getItemEditPath(this.item.id)]); + } + }; + AbstractSimpleItemActionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-simple-action', + templateUrl: './abstract-simple-item-action.component.html' + }), + tslib_1.__metadata("design:paramtypes", [ActivatedRoute, + Router, + NotificationsService, + ItemDataService, + TranslateService]) + ], AbstractSimpleItemActionComponent); + return AbstractSimpleItemActionComponent; +}()); +export { AbstractSimpleItemActionComponent }; +//# sourceMappingURL=abstract-simple-item-action.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.js.map b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.js.map new file mode 100644 index 0000000000..9b2ef7e6a2 --- /dev/null +++ b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-simple-item-action.component.js","sourceRoot":"","sources":["abstract-simple-item-action.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAoB,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAE,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAC,oBAAoB,EAAC,MAAM,qDAAqD,CAAC;AACzF,OAAO,EAAC,eAAe,EAAC,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAIrD,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAC,KAAK,EAAE,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAG/D;;;GAGG;AAKH;IAaE,2CAAsB,KAAqB,EACrB,MAAc,EACd,oBAA0C,EAC1C,eAAgC,EAChC,gBAAkC;QAJlC,UAAK,GAAL,KAAK,CAAgB;QACrB,WAAM,GAAN,MAAM,CAAQ;QACd,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,oBAAe,GAAf,eAAe,CAAiB;QAChC,qBAAgB,GAAhB,gBAAgB,CAAkB;IACxD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,CAAC,CAAC,eAAe,CAAC,KAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC;YACtG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SACvD;IACH,CAAC;IA3DU,iCAAiC;QAJ7C,SAAS,CAAC;YACT,QAAQ,EAAE,kBAAkB;YAC5B,WAAW,EAAE,8CAA8C;SAC5D,CAAC;iDAc6B,cAAc;YACb,MAAM;YACQ,oBAAoB;YACzB,eAAe;YACd,gBAAgB;OAjB7C,iCAAiC,CA6D7C;IAAD,wCAAC;CAAA,AA7DD,IA6DC;SA7DY,iCAAiC"} \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.js b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.js new file mode 100644 index 0000000000..d24aeddd3d --- /dev/null +++ b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.js @@ -0,0 +1,129 @@ +import * as tslib_1 from "tslib"; +import { async, TestBed } from '@angular/core/testing'; +import { Item } from '../../../core/shared/item.model'; +import { RouterStub } from '../../../shared/testing/router-stub'; +import { CommonModule } from '@angular/common'; +import { RouterTestingModule } from '@angular/router/testing'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { ActivatedRoute, Router } from '@angular/router'; +import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { ItemDataService } from '../../../core/data/item-data.service'; +import { RemoteData } from '../../../core/data/remote-data'; +import { AbstractSimpleItemActionComponent } from './abstract-simple-item-action.component'; +import { By } from '@angular/platform-browser'; +import { of as observableOf } from 'rxjs'; +import { getItemEditPath } from '../../item-page-routing.module'; +import { RestResponse } from '../../../core/cache/response.models'; +/** + * Test component that implements the AbstractSimpleItemActionComponent used to test the + * AbstractSimpleItemActionComponent component + */ +var MySimpleItemActionComponent = /** @class */ (function (_super) { + tslib_1.__extends(MySimpleItemActionComponent, _super); + function MySimpleItemActionComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.messageKey = 'myEditAction'; + _this.predicate = function (rd) { return rd.payload.isWithdrawn; }; + return _this; + } + MySimpleItemActionComponent.prototype.performAction = function () { + // do nothing + }; + MySimpleItemActionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-simple-action', + templateUrl: './abstract-simple-item-action.component.html' + }) + ], MySimpleItemActionComponent); + return MySimpleItemActionComponent; +}(AbstractSimpleItemActionComponent)); +export { MySimpleItemActionComponent }; +var comp; +var fixture; +var mockItem; +var itemPageUrl; +var routerStub; +var mockItemDataService; +var routeStub; +var notificationsServiceStub; +var successfulRestResponse; +var failRestResponse; +describe('AbstractSimpleItemActionComponent', function () { + beforeEach(async(function () { + mockItem = Object.assign(new Item(), { + id: 'fake-id', + handle: 'fake/handle', + lastModified: '2018', + isWithdrawn: true + }); + itemPageUrl = "fake-url/" + mockItem.id; + routerStub = Object.assign(new RouterStub(), { + url: itemPageUrl + "/edit" + }); + mockItemDataService = jasmine.createSpyObj({ + findById: observableOf(new RemoteData(false, false, true, undefined, mockItem)) + }); + routeStub = { + data: observableOf({ + item: new RemoteData(false, false, true, null, { + id: 'fake-id' + }) + }) + }; + notificationsServiceStub = new NotificationsServiceStub(); + TestBed.configureTestingModule({ + imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()], + declarations: [MySimpleItemActionComponent], + providers: [ + { provide: ActivatedRoute, useValue: routeStub }, + { provide: Router, useValue: routerStub }, + { provide: ItemDataService, useValue: mockItemDataService }, + { provide: NotificationsService, useValue: notificationsServiceStub }, + ], schemas: [ + CUSTOM_ELEMENTS_SCHEMA + ] + }).compileComponents(); + })); + beforeEach(function () { + successfulRestResponse = new RestResponse(true, 200, 'OK'); + failRestResponse = new RestResponse(false, 500, 'Internal Server Error'); + fixture = TestBed.createComponent(MySimpleItemActionComponent); + comp = fixture.componentInstance; + fixture.detectChanges(); + }); + afterEach(function () { + fixture.destroy(); + comp = null; + }); + it('should render a page with messages based on the provided messageKey', function () { + var header = fixture.debugElement.query(By.css('h2')).nativeElement; + expect(header.innerHTML).toContain('item.edit.myEditAction.header'); + var description = fixture.debugElement.query(By.css('p')).nativeElement; + expect(description.innerHTML).toContain('item.edit.myEditAction.description'); + var confirmButton = fixture.debugElement.query(By.css('button.perform-action')).nativeElement; + expect(confirmButton.innerHTML).toContain('item.edit.myEditAction.confirm'); + var cancelButton = fixture.debugElement.query(By.css('button.cancel')).nativeElement; + expect(cancelButton.innerHTML).toContain('item.edit.myEditAction.cancel'); + }); + it('should perform action when the button is clicked', function () { + spyOn(comp, 'performAction'); + var performButton = fixture.debugElement.query(By.css('.perform-action')); + performButton.triggerEventHandler('click', null); + expect(comp.performAction).toHaveBeenCalled(); + }); + it('should process a RestResponse to navigate and display success notification', function () { + comp.processRestResponse(successfulRestResponse); + expect(notificationsServiceStub.success).toHaveBeenCalled(); + expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditPath(mockItem.id)]); + }); + it('should process a RestResponse to navigate and display success notification', function () { + comp.processRestResponse(failRestResponse); + expect(notificationsServiceStub.error).toHaveBeenCalled(); + expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditPath(mockItem.id)]); + }); +}); +//# sourceMappingURL=abstract-simple-item-action.component.spec.js.map \ No newline at end of file diff --git a/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.js.map b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.js.map new file mode 100644 index 0000000000..00ef61cb27 --- /dev/null +++ b/src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-simple-item-action.component.spec.js","sourceRoot":"","sources":["abstract-simple-item-action.component.spec.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAoB,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,gCA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AAC;QAC5E,aAAa,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAEjD,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4EAA4E,EAAE;QAC/E,IAAI,CAAC,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;QAEjD,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAC5D,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4EAA4E,EAAE;QAC/E,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;QAE3C,MAAM,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAC1D,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AAEL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/+item-page/field-components/collections/collections.component.js b/src/app/+item-page/field-components/collections/collections.component.js new file mode 100644 index 0000000000..e5aa6e770f --- /dev/null +++ b/src/app/+item-page/field-components/collections/collections.component.js @@ -0,0 +1,40 @@ +import * as tslib_1 from "tslib"; +import { map } from 'rxjs/operators'; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../core/shared/item.model'; +import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service'; +/** + * This component renders the parent collections section of the item + * inside a 'ds-metadata-field-wrapper' component. + */ +var CollectionsComponent = /** @class */ (function () { + function CollectionsComponent(rdbs) { + this.rdbs = rdbs; + this.label = 'item.page.collections'; + this.separator = '
'; + } + CollectionsComponent.prototype.ngOnInit = function () { + // this.collections = this.item.parents.payload; + // TODO: this should use parents, but the collections + // for an Item aren't returned by the REST API yet, + // only the owning collection + this.collections = this.item.owner.pipe(map(function (rd) { return [rd.payload]; })); + }; + CollectionsComponent.prototype.hasSucceeded = function () { + return this.item.owner.pipe(map(function (rd) { return rd.hasSucceeded; })); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], CollectionsComponent.prototype, "item", void 0); + CollectionsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-page-collections', + templateUrl: './collections.component.html' + }), + tslib_1.__metadata("design:paramtypes", [RemoteDataBuildService]) + ], CollectionsComponent); + return CollectionsComponent; +}()); +export { CollectionsComponent }; +//# sourceMappingURL=collections.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/field-components/collections/collections.component.js.map b/src/app/+item-page/field-components/collections/collections.component.js.map new file mode 100644 index 0000000000..7f40f64d6c --- /dev/null +++ b/src/app/+item-page/field-components/collections/collections.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collections.component.js","sourceRoot":"","sources":["collections.component.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAIzD,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AAGhG;;;GAGG;AAMH;IAUE,8BAAoB,IAA4B;QAA5B,SAAI,GAAJ,IAAI,CAAwB;QANhD,UAAK,GAAG,uBAAuB,CAAC;QAEhC,cAAS,GAAG,OAAO,CAAC;IAMpB,CAAC;IAED,uCAAQ,GAAR;QACE,kDAAkD;QAElD,qDAAqD;QACrD,mDAAmD;QACnD,6BAA6B;QAC7B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,EAA0B,IAAK,OAAA,CAAC,EAAE,CAAC,OAAO,CAAC,EAAZ,CAAY,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED,2CAAY,GAAZ;QACE,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,EAA0B,IAAK,OAAA,EAAE,CAAC,YAAY,EAAf,CAAe,CAAC,CAAC,CAAC;IACpF,CAAC;IAvBQ;QAAR,KAAK,EAAE;0CAAO,IAAI;sDAAC;IAFT,oBAAoB;QAJhC,SAAS,CAAC;YACT,QAAQ,EAAE,0BAA0B;YACpC,WAAW,EAAE,8BAA8B;SAC5C,CAAC;iDAW0B,sBAAsB;OAVrC,oBAAoB,CA2BhC;IAAD,2BAAC;CAAA,AA3BD,IA2BC;SA3BY,oBAAoB"} \ No newline at end of file diff --git a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.js b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.js new file mode 100644 index 0000000000..fa01685529 --- /dev/null +++ b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.js @@ -0,0 +1,31 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { hasNoValue } from '../../../shared/empty.util'; +/** + * This component renders any content inside this wrapper. + * The wrapper prints a label before the content (if available) + */ +var MetadataFieldWrapperComponent = /** @class */ (function () { + function MetadataFieldWrapperComponent() { + } + /** + * Make hasNoValue() available in the template + */ + MetadataFieldWrapperComponent.prototype.hasNoValue = function (o) { + return hasNoValue(o); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], MetadataFieldWrapperComponent.prototype, "label", void 0); + MetadataFieldWrapperComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-metadata-field-wrapper', + styleUrls: ['./metadata-field-wrapper.component.scss'], + templateUrl: './metadata-field-wrapper.component.html' + }) + ], MetadataFieldWrapperComponent); + return MetadataFieldWrapperComponent; +}()); +export { MetadataFieldWrapperComponent }; +//# sourceMappingURL=metadata-field-wrapper.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.js.map b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.js.map new file mode 100644 index 0000000000..2742660ca9 --- /dev/null +++ b/src/app/+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata-field-wrapper.component.js","sourceRoot":"","sources":["metadata-field-wrapper.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD;;;GAGG;AAMH;IAAA;IAaA,CAAC;IANC;;OAEG;IACH,kDAAU,GAAV,UAAW,CAAM;QACf,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAPQ;QAAR,KAAK,EAAE;;gEAAe;IALZ,6BAA6B;QALzC,SAAS,CAAC;YACT,QAAQ,EAAE,2BAA2B;YACrC,SAAS,EAAE,CAAC,yCAAyC,CAAC;YACtD,WAAW,EAAE,yCAAyC;SACvD,CAAC;OACW,6BAA6B,CAazC;IAAD,oCAAC;CAAA,AAbD,IAaC;SAbY,6BAA6B"} \ No newline at end of file diff --git a/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.js b/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.js new file mode 100644 index 0000000000..b82b95572f --- /dev/null +++ b/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.js @@ -0,0 +1,42 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { MetadataValuesComponent } from '../metadata-values/metadata-values.component'; +/** + * This component renders the configured 'values' into the ds-metadata-field-wrapper component as a link. + * It puts the given 'separator' between each two values + * and creates an 'a' tag for each value, + * using the 'linktext' as it's value (if it exists) + * and using the values as the 'href' attribute (and as value of the tag when no 'linktext' is defined) + */ +var MetadataUriValuesComponent = /** @class */ (function (_super) { + tslib_1.__extends(MetadataUriValuesComponent, _super); + function MetadataUriValuesComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], MetadataUriValuesComponent.prototype, "linktext", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], MetadataUriValuesComponent.prototype, "mdValues", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], MetadataUriValuesComponent.prototype, "separator", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], MetadataUriValuesComponent.prototype, "label", void 0); + MetadataUriValuesComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-metadata-uri-values', + styleUrls: ['./metadata-uri-values.component.scss'], + templateUrl: './metadata-uri-values.component.html' + }) + ], MetadataUriValuesComponent); + return MetadataUriValuesComponent; +}(MetadataValuesComponent)); +export { MetadataUriValuesComponent }; +//# sourceMappingURL=metadata-uri-values.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.js.map b/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.js.map new file mode 100644 index 0000000000..a3fa56a34f --- /dev/null +++ b/src/app/+item-page/field-components/metadata-uri-values/metadata-uri-values.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata-uri-values.component.js","sourceRoot":"","sources":["metadata-uri-values.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAGvF;;;;;;GAMG;AAMH;IAAgD,sDAAuB;IAAvE;;IAsBA,CAAC;IAhBU;QAAR,KAAK,EAAE;;gEAAe;IAKd;QAAR,KAAK,EAAE;;gEAA2B;IAK1B;QAAR,KAAK,EAAE;;iEAAmB;IAKlB;QAAR,KAAK,EAAE;;6DAAe;IArBZ,0BAA0B;QALtC,SAAS,CAAC;YACT,QAAQ,EAAE,wBAAwB;YAClC,SAAS,EAAE,CAAC,sCAAsC,CAAC;YACnD,WAAW,EAAE,sCAAsC;SACpD,CAAC;OACW,0BAA0B,CAsBtC;IAAD,iCAAC;CAAA,AAtBD,CAAgD,uBAAuB,GAsBtE;SAtBY,0BAA0B"} \ No newline at end of file diff --git a/src/app/+item-page/field-components/metadata-values/metadata-values.component.js b/src/app/+item-page/field-components/metadata-values/metadata-values.component.js new file mode 100644 index 0000000000..34e5520561 --- /dev/null +++ b/src/app/+item-page/field-components/metadata-values/metadata-values.component.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +/** + * This component renders the configured 'values' into the ds-metadata-field-wrapper component. + * It puts the given 'separator' between each two values. + */ +var MetadataValuesComponent = /** @class */ (function () { + function MetadataValuesComponent() { + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], MetadataValuesComponent.prototype, "mdValues", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], MetadataValuesComponent.prototype, "separator", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], MetadataValuesComponent.prototype, "label", void 0); + MetadataValuesComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-metadata-values', + styleUrls: ['./metadata-values.component.scss'], + templateUrl: './metadata-values.component.html' + }) + ], MetadataValuesComponent); + return MetadataValuesComponent; +}()); +export { MetadataValuesComponent }; +//# sourceMappingURL=metadata-values.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/field-components/metadata-values/metadata-values.component.js.map b/src/app/+item-page/field-components/metadata-values/metadata-values.component.js.map new file mode 100644 index 0000000000..5a6bf32478 --- /dev/null +++ b/src/app/+item-page/field-components/metadata-values/metadata-values.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata-values.component.js","sourceRoot":"","sources":["metadata-values.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGjD;;;GAGG;AAMH;IAAA;IAiBA,CAAC;IAZU;QAAR,KAAK,EAAE;;6DAA2B;IAK1B;QAAR,KAAK,EAAE;;8DAAmB;IAKlB;QAAR,KAAK,EAAE;;0DAAe;IAfZ,uBAAuB;QALnC,SAAS,CAAC;YACT,QAAQ,EAAE,oBAAoB;YAC9B,SAAS,EAAE,CAAC,kCAAkC,CAAC;YAC/C,WAAW,EAAE,kCAAkC;SAChD,CAAC;OACW,uBAAuB,CAiBnC;IAAD,8BAAC;CAAA,AAjBD,IAiBC;SAjBY,uBAAuB"} \ No newline at end of file diff --git a/src/app/+item-page/full/field-components/file-section/full-file-section.component.js b/src/app/+item-page/full/field-components/file-section/full-file-section.component.js new file mode 100644 index 0000000000..17521d2a84 --- /dev/null +++ b/src/app/+item-page/full/field-components/file-section/full-file-section.component.js @@ -0,0 +1,50 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest } from 'rxjs'; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../../core/shared/item.model'; +import { FileSectionComponent } from '../../../simple/field-components/file-section/file-section.component'; +import { map } from 'rxjs/operators'; +/** + * This component renders the file section of the item + * inside a 'ds-metadata-field-wrapper' component. + */ +var FullFileSectionComponent = /** @class */ (function (_super) { + tslib_1.__extends(FullFileSectionComponent, _super); + function FullFileSectionComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.thumbnails = new Map(); + return _this; + } + FullFileSectionComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + }; + FullFileSectionComponent.prototype.initialize = function () { + var _this = this; + var originals = this.item.getFiles(); + var licenses = this.item.getBitstreamsByBundleName('LICENSE'); + this.bitstreamsObs = observableCombineLatest(originals, licenses).pipe(map(function (_a) { + var o = _a[0], l = _a[1]; + return o.concat(l); + })); + this.bitstreamsObs.subscribe(function (files) { + return files.forEach(function (original) { + var thumbnail = _this.item.getThumbnailForOriginal(original); + _this.thumbnails.set(original.id, thumbnail); + }); + }); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], FullFileSectionComponent.prototype, "item", void 0); + FullFileSectionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-page-full-file-section', + styleUrls: ['./full-file-section.component.scss'], + templateUrl: './full-file-section.component.html' + }) + ], FullFileSectionComponent); + return FullFileSectionComponent; +}(FileSectionComponent)); +export { FullFileSectionComponent }; +//# sourceMappingURL=full-file-section.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/full/field-components/file-section/full-file-section.component.js.map b/src/app/+item-page/full/field-components/file-section/full-file-section.component.js.map new file mode 100644 index 0000000000..034e5ed744 --- /dev/null +++ b/src/app/+item-page/full/field-components/file-section/full-file-section.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"full-file-section.component.js","sourceRoot":"","sources":["full-file-section.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAc,MAAM,MAAM,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAGzD,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sEAAsE,CAAC;AAC5G,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC;;;GAGG;AAOH;IAA8C,oDAAoB;IALlE;QAAA,qEAkCC;QArBC,gBAAU,GAAuC,IAAI,GAAG,EAAE,CAAC;;IAqB7D,CAAC;IAnBC,2CAAQ,GAAR;QACE,iBAAM,QAAQ,WAAE,CAAC;IACnB,CAAC;IAED,6CAAU,GAAV;QAAA,iBAaC;QAZC,IAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACvC,IAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,aAAa,GAAG,uBAAuB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,EAAM;gBAAL,SAAC,EAAE,SAAC;YAAM,OAAI,CAAC,QAAK,CAAC;QAAX,CAAY,CAAC,CAAC,CAAC;QACtG,IAAI,CAAC,aAAa,CAAC,SAAS,CAC1B,UAAC,KAAK;YACJ,OAAA,KAAK,CAAC,OAAO,CACX,UAAC,QAAQ;gBACP,IAAM,SAAS,GAA0B,KAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;gBACrF,KAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;YAC9C,CAAC,CACF;QALD,CAKC,CACJ,CAAA;IACH,CAAC;IAzBQ;QAAR,KAAK,EAAE;0CAAO,IAAI;0DAAC;IAFT,wBAAwB;QALpC,SAAS,CAAC;YACT,QAAQ,EAAE,gCAAgC;YAC1C,SAAS,EAAE,CAAC,oCAAoC,CAAC;YACjD,WAAW,EAAE,oCAAoC;SAClD,CAAC;OACW,wBAAwB,CA6BpC;IAAD,+BAAC;CAAA,AA7BD,CAA8C,oBAAoB,GA6BjE;SA7BY,wBAAwB"} \ No newline at end of file diff --git a/src/app/+item-page/full/full-item-page.component.js b/src/app/+item-page/full/full-item-page.component.js new file mode 100644 index 0000000000..a4392e855b --- /dev/null +++ b/src/app/+item-page/full/full-item-page.component.js @@ -0,0 +1,38 @@ +import * as tslib_1 from "tslib"; +import { filter, map } from 'rxjs/operators'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { ItemPageComponent } from '../simple/item-page.component'; +import { ItemDataService } from '../../core/data/item-data.service'; +import { MetadataService } from '../../core/metadata/metadata.service'; +import { fadeInOut } from '../../shared/animations/fade'; +import { hasValue } from '../../shared/empty.util'; +/** + * This component renders a simple item page. + * The route parameter 'id' is used to request the item it represents. + * All fields of the item that should be displayed, are defined in its template. + */ +var FullItemPageComponent = /** @class */ (function (_super) { + tslib_1.__extends(FullItemPageComponent, _super); + function FullItemPageComponent(route, router, items, metadataService) { + return _super.call(this, route, router, items, metadataService) || this; + } + /*** AoT inheritance fix, will hopefully be resolved in the near future **/ + FullItemPageComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + this.metadata$ = this.itemRD$.pipe(map(function (rd) { return rd.payload; }), filter(function (item) { return hasValue(item); }), map(function (item) { return item.metadata; })); + }; + FullItemPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-full-item-page', + styleUrls: ['./full-item-page.component.scss'], + templateUrl: './full-item-page.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + animations: [fadeInOut] + }), + tslib_1.__metadata("design:paramtypes", [ActivatedRoute, Router, ItemDataService, MetadataService]) + ], FullItemPageComponent); + return FullItemPageComponent; +}(ItemPageComponent)); +export { FullItemPageComponent }; +//# sourceMappingURL=full-item-page.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/full/full-item-page.component.js.map b/src/app/+item-page/full/full-item-page.component.js.map new file mode 100644 index 0000000000..56adea9a53 --- /dev/null +++ b/src/app/+item-page/full/full-item-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"full-item-page.component.js","sourceRoot":"","sources":["full-item-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAE,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAIzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAKpE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD;;;;GAIG;AASH;IAA2C,iDAAiB;IAM1D,+BAAY,KAAqB,EAAE,MAAc,EAAE,KAAsB,EAAE,eAAgC;eACzG,kBAAM,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,CAAC;IAC9C,CAAC;IAED,2EAA2E;IAC3E,wCAAQ,GAAR;QACE,iBAAM,QAAQ,WAAE,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAChC,GAAG,CAAC,UAAC,EAAoB,IAAK,OAAA,EAAE,CAAC,OAAO,EAAV,CAAU,CAAC,EACzC,MAAM,CAAC,UAAC,IAAU,IAAK,OAAA,QAAQ,CAAC,IAAI,CAAC,EAAd,CAAc,CAAC,EACtC,GAAG,CAAC,UAAC,IAAU,IAAK,OAAA,IAAI,CAAC,QAAQ,EAAb,CAAa,CAAC,CAAE,CAAC;IACzC,CAAC;IAjBU,qBAAqB;QAPjC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,SAAS,EAAE,CAAC,iCAAiC,CAAC;YAC9C,WAAW,EAAE,iCAAiC;YAC9C,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC;iDAOmB,cAAc,EAAU,MAAM,EAAS,eAAe,EAAmB,eAAe;OANhG,qBAAqB,CAkBjC;IAAD,4BAAC;CAAA,AAlBD,CAA2C,iBAAiB,GAkB3D;SAlBY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+item-page/item-page-routing.module.js b/src/app/+item-page/item-page-routing.module.js new file mode 100644 index 0000000000..180fa894cb --- /dev/null +++ b/src/app/+item-page/item-page-routing.module.js @@ -0,0 +1,54 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { ItemPageComponent } from './simple/item-page.component'; +import { FullItemPageComponent } from './full/full-item-page.component'; +import { ItemPageResolver } from './item-page.resolver'; +import { URLCombiner } from '../core/url-combiner/url-combiner'; +import { getItemModulePath } from '../app-routing.module'; +import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; +export function getItemPageRoute(itemId) { + return new URLCombiner(getItemModulePath(), itemId).toString(); +} +export function getItemEditPath(id) { + return new URLCombiner(getItemModulePath(), ITEM_EDIT_PATH.replace(/:id/, id)).toString(); +} +var ITEM_EDIT_PATH = ':id/edit'; +var ItemPageRoutingModule = /** @class */ (function () { + function ItemPageRoutingModule() { + } + ItemPageRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { + path: ':id', + component: ItemPageComponent, + pathMatch: 'full', + resolve: { + item: ItemPageResolver + } + }, + { + path: ':id/full', + component: FullItemPageComponent, + resolve: { + item: ItemPageResolver + } + }, + { + path: ITEM_EDIT_PATH, + loadChildren: './edit-item-page/edit-item-page.module#EditItemPageModule', + canActivate: [AuthenticatedGuard] + }, + ]) + ], + providers: [ + ItemPageResolver, + ] + }) + ], ItemPageRoutingModule); + return ItemPageRoutingModule; +}()); +export { ItemPageRoutingModule }; +//# sourceMappingURL=item-page-routing.module.js.map \ No newline at end of file diff --git a/src/app/+item-page/item-page-routing.module.js.map b/src/app/+item-page/item-page-routing.module.js.map new file mode 100644 index 0000000000..d22d886dce --- /dev/null +++ b/src/app/+item-page/item-page-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-page-routing.module.js","sourceRoot":"","sources":["item-page-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8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app/+item-page/item-page.module.js b/src/app/+item-page/item-page.module.js new file mode 100644 index 0000000000..2b7e17d5c3 --- /dev/null +++ b/src/app/+item-page/item-page.module.js @@ -0,0 +1,84 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { SharedModule } from './../shared/shared.module'; +import { GenericItemPageFieldComponent } from './simple/field-components/specific-field/generic/generic-item-page-field.component'; +import { ItemPageComponent } from './simple/item-page.component'; +import { ItemPageRoutingModule } from './item-page-routing.module'; +import { MetadataUriValuesComponent } from './field-components/metadata-uri-values/metadata-uri-values.component'; +import { ItemPageAuthorFieldComponent } from './simple/field-components/specific-field/author/item-page-author-field.component'; +import { ItemPageDateFieldComponent } from './simple/field-components/specific-field/date/item-page-date-field.component'; +import { ItemPageAbstractFieldComponent } from './simple/field-components/specific-field/abstract/item-page-abstract-field.component'; +import { ItemPageUriFieldComponent } from './simple/field-components/specific-field/uri/item-page-uri-field.component'; +import { ItemPageTitleFieldComponent } from './simple/field-components/specific-field/title/item-page-title-field.component'; +import { ItemPageFieldComponent } from './simple/field-components/specific-field/item-page-field.component'; +import { FileSectionComponent } from './simple/field-components/file-section/file-section.component'; +import { CollectionsComponent } from './field-components/collections/collections.component'; +import { FullItemPageComponent } from './full/full-item-page.component'; +import { FullFileSectionComponent } from './full/field-components/file-section/full-file-section.component'; +import { RelatedItemsComponent } from './simple/related-items/related-items-component'; +import { SearchPageModule } from '../+search-page/search-page.module'; +import { PublicationComponent } from './simple/item-types/publication/publication.component'; +import { PersonComponent } from './simple/item-types/person/person.component'; +import { OrgunitComponent } from './simple/item-types/orgunit/orgunit.component'; +import { ProjectComponent } from './simple/item-types/project/project.component'; +import { JournalComponent } from './simple/item-types/journal/journal.component'; +import { JournalVolumeComponent } from './simple/item-types/journal-volume/journal-volume.component'; +import { JournalIssueComponent } from './simple/item-types/journal-issue/journal-issue.component'; +import { ItemComponent } from './simple/item-types/shared/item.component'; +import { EditItemPageModule } from './edit-item-page/edit-item-page.module'; +import { MetadataRepresentationListComponent } from './simple/metadata-representation-list/metadata-representation-list.component'; +import { RelatedEntitiesSearchComponent } from './simple/related-entities/related-entities-search/related-entities-search.component'; +var ItemPageModule = /** @class */ (function () { + function ItemPageModule() { + } + ItemPageModule = tslib_1.__decorate([ + NgModule({ + imports: [ + CommonModule, + SharedModule, + EditItemPageModule, + ItemPageRoutingModule, + SearchPageModule + ], + declarations: [ + ItemPageComponent, + FullItemPageComponent, + MetadataUriValuesComponent, + ItemPageAuthorFieldComponent, + ItemPageDateFieldComponent, + ItemPageAbstractFieldComponent, + ItemPageUriFieldComponent, + ItemPageTitleFieldComponent, + ItemPageFieldComponent, + FileSectionComponent, + CollectionsComponent, + FullFileSectionComponent, + PublicationComponent, + ProjectComponent, + OrgunitComponent, + PersonComponent, + RelatedItemsComponent, + ItemComponent, + GenericItemPageFieldComponent, + JournalComponent, + JournalIssueComponent, + JournalVolumeComponent, + MetadataRepresentationListComponent, + RelatedEntitiesSearchComponent + ], + entryComponents: [ + PublicationComponent, + ProjectComponent, + OrgunitComponent, + PersonComponent, + JournalComponent, + JournalIssueComponent, + JournalVolumeComponent + ] + }) + ], ItemPageModule); + return ItemPageModule; +}()); +export { ItemPageModule }; +//# sourceMappingURL=item-page.module.js.map \ No newline at end of file diff --git a/src/app/+item-page/item-page.module.js.map b/src/app/+item-page/item-page.module.js.map new file mode 100644 index 0000000000..1ce9a77657 --- /dev/null +++ b/src/app/+item-page/item-page.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-page.module.js","sourceRoot":"","sources":["item-page.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oFAAoF,CAAC;AAEnI,OAAO,EAAE,iBAAiB,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M,wCAAwC,CAAC;AAC5E,OAAO,EAAE,mCAAmC,EAAE,MAAM,8EAA8E,CAAC;AACnI,OAAO,EAAE,8BAA8B,EAAE,MAAM,qFAAqF,CAAC;AA8CrI;IAAA;IAEA,CAAC;IAFY,cAAc;QA5C1B,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY;gBACZ,YAAY;gBACZ,kBAAkB;gBAClB,qBAAqB;gBACrB,gBAAgB;aACjB;YACD,YAAY,EAAE;gBACZ,iBAAiB;gBACjB,qBAAqB;gBACrB,0BAA0B;gBAC1B,4BAA4B;gBAC5B,0BAA0B;gBAC1B,8BAA8B;gBAC9B,yBAAyB;gBACzB,2BAA2B;gBAC3B,sBAAsB;gBACtB,oBAAoB;gBACpB,oBAAoB;gBACpB,wBAAwB;gBACxB,oBAAoB;gBACpB,gBAAgB;gBAChB,gBAAgB;gBAChB,eAAe;gBACf,qBAAqB;gBACrB,aAAa;gBACb,6BAA6B;gBAC7B,gBAAgB;gBAChB,qBAAqB;gBACrB,sBAAsB;gBACtB,mCAAmC;gBACnC,8BAA8B;aAC/B;YACD,eAAe,EAAE;gBACf,oBAAoB;gBACpB,gBAAgB;gBAChB,gBAAgB;gBAChB,eAAe;gBACf,gBAAgB;gBAChB,qBAAqB;gBACrB,sBAAsB;aACvB;SACF,CAAC;OACW,cAAc,CAE1B;IAAD,qBAAC;CAAA,AAFD,IAEC;SAFY,cAAc"} \ No newline at end of file diff --git a/src/app/+item-page/item-page.resolver.js b/src/app/+item-page/item-page.resolver.js new file mode 100644 index 0000000000..4d3a9401e4 --- /dev/null +++ b/src/app/+item-page/item-page.resolver.js @@ -0,0 +1,31 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { ItemDataService } from '../core/data/item-data.service'; +import { hasValue } from '../shared/empty.util'; +import { find } from 'rxjs/operators'; +/** + * This class represents a resolver that requests a specific item before the route is activated + */ +var ItemPageResolver = /** @class */ (function () { + function ItemPageResolver(itemService) { + this.itemService = itemService; + } + /** + * Method for resolving an item based on the parameters in the current route + * @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot + * @param {RouterStateSnapshot} state The current RouterStateSnapshot + * @returns Observable<> Emits the found item based on the parameters in the current route, + * or an error if something went wrong + */ + ItemPageResolver.prototype.resolve = function (route, state) { + return this.itemService.findById(route.params.id) + .pipe(find(function (RD) { return hasValue(RD.error) || RD.hasSucceeded; })); + }; + ItemPageResolver = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [ItemDataService]) + ], ItemPageResolver); + return ItemPageResolver; +}()); +export { ItemPageResolver }; +//# sourceMappingURL=item-page.resolver.js.map \ No newline at end of file diff --git a/src/app/+item-page/item-page.resolver.js.map b/src/app/+item-page/item-page.resolver.js.map new file mode 100644 index 0000000000..87eabedf05 --- /dev/null +++ b/src/app/+item-page/item-page.resolver.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-page.resolver.js","sourceRoot":"","sources":["item-page.resolver.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC;;GAEG;AAEH;IACE,0BAAoB,WAA4B;QAA5B,gBAAW,GAAX,WAAW,CAAiB;IAChD,CAAC;IAED;;;;;;OAMG;IACH,kCAAO,GAAP,UAAQ,KAA6B,EAAE,KAA0B;QAC/D,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;aAC9C,IAAI,CACH,IAAI,CAAC,UAAC,EAAE,IAAK,OAAA,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,YAAY,EAArC,CAAqC,CAAC,CACpD,CAAC;IACN,CAAC;IAhBU,gBAAgB;QAD5B,UAAU,EAAE;iDAEsB,eAAe;OADrC,gBAAgB,CAiB5B;IAAD,uBAAC;CAAA,AAjBD,IAiBC;SAjBY,gBAAgB"} \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/file-section/file-section.component.js b/src/app/+item-page/simple/field-components/file-section/file-section.component.js new file mode 100644 index 0000000000..68e9e5da35 --- /dev/null +++ b/src/app/+item-page/simple/field-components/file-section/file-section.component.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../../core/shared/item.model'; +/** + * This component renders the file section of the item + * inside a 'ds-metadata-field-wrapper' component. + */ +var FileSectionComponent = /** @class */ (function () { + function FileSectionComponent() { + this.label = 'item.page.files'; + this.separator = '
'; + } + FileSectionComponent.prototype.ngOnInit = function () { + this.initialize(); + }; + FileSectionComponent.prototype.initialize = function () { + this.bitstreamsObs = this.item.getFiles(); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], FileSectionComponent.prototype, "item", void 0); + FileSectionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-page-file-section', + templateUrl: './file-section.component.html' + }) + ], FileSectionComponent); + return FileSectionComponent; +}()); +export { FileSectionComponent }; +//# sourceMappingURL=file-section.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/file-section/file-section.component.js.map b/src/app/+item-page/simple/field-components/file-section/file-section.component.js.map new file mode 100644 index 0000000000..8a183516b2 --- /dev/null +++ b/src/app/+item-page/simple/field-components/file-section/file-section.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"file-section.component.js","sourceRoot":"","sources":["file-section.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAIzD,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D;;;GAGG;AAKH;IAJA;QAQE,UAAK,GAAG,iBAAiB,CAAC;QAE1B,cAAS,GAAG,OAAO,CAAC;IAYtB,CAAC;IARC,uCAAQ,GAAR;QACE,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED,yCAAU,GAAV;QACE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC5C,CAAC;IAdQ;QAAR,KAAK,EAAE;0CAAO,IAAI;sDAAC;IAFT,oBAAoB;QAJhC,SAAS,CAAC;YACT,QAAQ,EAAE,2BAA2B;YACrC,WAAW,EAAE,+BAA+B;SAC7C,CAAC;OACW,oBAAoB,CAkBhC;IAAD,2BAAC;CAAA,AAlBD,IAkBC;SAlBY,oBAAoB"} \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/abstract/item-page-abstract-field.component.js b/src/app/+item-page/simple/field-components/specific-field/abstract/item-page-abstract-field.component.js new file mode 100644 index 0000000000..0465ab5242 --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/abstract/item-page-abstract-field.component.js @@ -0,0 +1,38 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../../../core/shared/item.model'; +import { ItemPageFieldComponent } from '../item-page-field.component'; +var ItemPageAbstractFieldComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemPageAbstractFieldComponent, _super); + function ItemPageAbstractFieldComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * Fields (schema.element.qualifier) used to render their values. + * In this component, we want to display values for metadata 'dc.description.abstract' + */ + _this.fields = [ + 'dc.description.abstract' + ]; + /** + * Label i18n key for the rendered metadata + */ + _this.label = 'item.page.abstract'; + return _this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], ItemPageAbstractFieldComponent.prototype, "item", void 0); + ItemPageAbstractFieldComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-page-abstract-field', + templateUrl: '../item-page-field.component.html' + }) + /** + * This component is used for displaying the abstract (dc.description.abstract) of an item + */ + ], ItemPageAbstractFieldComponent); + return ItemPageAbstractFieldComponent; +}(ItemPageFieldComponent)); +export { ItemPageAbstractFieldComponent }; +//# sourceMappingURL=item-page-abstract-field.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/abstract/item-page-abstract-field.component.js.map b/src/app/+item-page/simple/field-components/specific-field/abstract/item-page-abstract-field.component.js.map new file mode 100644 index 0000000000..12f6d277a6 --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/abstract/item-page-abstract-field.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-page-abstract-field.component.js","sourceRoot":"","sources":["item-page-abstract-field.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAStE;IAAoD,0DAAsB;IAP1E;QAAA,qEAiCC;QAbG;;;WAGG;QACH,YAAM,GAAa;YACf,yBAAyB;SAC5B,CAAC;QAEF;;WAEG;QACH,WAAK,GAAG,oBAAoB,CAAC;;IAEjC,CAAC;IArBY;QAAR,KAAK,EAAE;0CAAO,IAAI;gEAAC;IALX,8BAA8B;QAP1C,SAAS,CAAC;YACP,QAAQ,EAAE,6BAA6B;YACvC,WAAW,EAAE,mCAAmC;SACnD,CAAC;QACF;;WAEG;OACU,8BAA8B,CA0B1C;IAAD,qCAAC;CAAA,AA1BD,CAAoD,sBAAsB,GA0BzE;SA1BY,8BAA8B"} \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/author/item-page-author-field.component.js b/src/app/+item-page/simple/field-components/specific-field/author/item-page-author-field.component.js new file mode 100644 index 0000000000..b551a43564 --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/author/item-page-author-field.component.js @@ -0,0 +1,40 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../../../core/shared/item.model'; +import { ItemPageFieldComponent } from '../item-page-field.component'; +var ItemPageAuthorFieldComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemPageAuthorFieldComponent, _super); + function ItemPageAuthorFieldComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * Fields (schema.element.qualifier) used to render their values. + * In this component, we want to display values for metadata 'dc.contributor.author', 'dc.creator' and 'dc.contributor' + */ + _this.fields = [ + 'dc.contributor.author', + 'dc.creator', + 'dc.contributor' + ]; + /** + * Label i18n key for the rendered metadata + */ + _this.label = 'item.page.author'; + return _this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], ItemPageAuthorFieldComponent.prototype, "item", void 0); + ItemPageAuthorFieldComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-page-author-field', + templateUrl: '../item-page-field.component.html' + }) + /** + * This component is used for displaying the author (dc.contributor.author, dc.creator and dc.contributor) metadata of an item + */ + ], ItemPageAuthorFieldComponent); + return ItemPageAuthorFieldComponent; +}(ItemPageFieldComponent)); +export { ItemPageAuthorFieldComponent }; +//# sourceMappingURL=item-page-author-field.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/author/item-page-author-field.component.js.map b/src/app/+item-page/simple/field-components/specific-field/author/item-page-author-field.component.js.map new file mode 100644 index 0000000000..6195e969b9 --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/author/item-page-author-field.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-page-author-field.component.js","sourceRoot":"","sources":["item-page-author-field.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAStE;IAAkD,wDAAsB;IAPxE;QAAA,qEAmCC;QAfC;;;WAGG;QACH,YAAM,GAAa;YACjB,uBAAuB;YACvB,YAAY;YACZ,gBAAgB;SACjB,CAAC;QAEF;;WAEG;QACH,WAAK,GAAG,kBAAkB,CAAC;;IAE7B,CAAC;IAvBU;QAAR,KAAK,EAAE;0CAAO,IAAI;8DAAC;IALT,4BAA4B;QAPxC,SAAS,CAAC;YACT,QAAQ,EAAE,2BAA2B;YACrC,WAAW,EAAE,mCAAmC;SACjD,CAAC;QACF;;WAEG;OACU,4BAA4B,CA4BxC;IAAD,mCAAC;CAAA,AA5BD,CAAkD,sBAAsB,GA4BvE;SA5BY,4BAA4B"} \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/date/item-page-date-field.component.js b/src/app/+item-page/simple/field-components/specific-field/date/item-page-date-field.component.js new file mode 100644 index 0000000000..e2634843b7 --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/date/item-page-date-field.component.js @@ -0,0 +1,43 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../../../core/shared/item.model'; +import { ItemPageFieldComponent } from '../item-page-field.component'; +var ItemPageDateFieldComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemPageDateFieldComponent, _super); + function ItemPageDateFieldComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * Separator string between multiple values of the metadata fields defined + * @type {string} + */ + _this.separator = ', '; + /** + * Fields (schema.element.qualifier) used to render their values. + * In this component, we want to display values for metadata 'dc.date.issued' + */ + _this.fields = [ + 'dc.date.issued' + ]; + /** + * Label i18n key for the rendered metadata + */ + _this.label = 'item.page.date'; + return _this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], ItemPageDateFieldComponent.prototype, "item", void 0); + ItemPageDateFieldComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-page-date-field', + templateUrl: '../item-page-field.component.html' + }) + /** + * This component is used for displaying the issue date (dc.date.issued) metadata of an item + */ + ], ItemPageDateFieldComponent); + return ItemPageDateFieldComponent; +}(ItemPageFieldComponent)); +export { ItemPageDateFieldComponent }; +//# sourceMappingURL=item-page-date-field.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/date/item-page-date-field.component.js.map b/src/app/+item-page/simple/field-components/specific-field/date/item-page-date-field.component.js.map new file mode 100644 index 0000000000..081f0efca1 --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/date/item-page-date-field.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-page-date-field.component.js","sourceRoot":"","sources":["item-page-date-field.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAStE;IAAgD,sDAAsB;IAPtE;QAAA,qEAiCC;QAnBG;;;WAGG;QACH,eAAS,GAAG,IAAI,CAAC;QAEjB;;;WAGG;QACH,YAAM,GAAa;YACf,gBAAgB;SACnB,CAAC;QAEF;;WAEG;QACH,WAAK,GAAG,gBAAgB,CAAC;;IAE7B,CAAC;IArBY;QAAR,KAAK,EAAE;0CAAO,IAAI;4DAAC;IALX,0BAA0B;QAPtC,SAAS,CAAC;YACP,QAAQ,EAAE,yBAAyB;YACnC,WAAW,EAAE,mCAAmC;SACnD,CAAC;QACF;;WAEG;OACU,0BAA0B,CA0BtC;IAAD,iCAAC;CAAA,AA1BD,CAAgD,sBAAsB,GA0BrE;SA1BY,0BAA0B"} \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.js b/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.js new file mode 100644 index 0000000000..17df38ec6a --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.js @@ -0,0 +1,45 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../../../core/shared/item.model'; +import { ItemPageFieldComponent } from '../item-page-field.component'; +var GenericItemPageFieldComponent = /** @class */ (function (_super) { + tslib_1.__extends(GenericItemPageFieldComponent, _super); + /** + * This component can be used to represent metadata on a simple item page. + * It is the most generic way of displaying metadata values + * It expects 4 parameters: The item, a seperator, the metadata keys and an i18n key + */ + function GenericItemPageFieldComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], GenericItemPageFieldComponent.prototype, "item", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], GenericItemPageFieldComponent.prototype, "separator", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], GenericItemPageFieldComponent.prototype, "fields", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], GenericItemPageFieldComponent.prototype, "label", void 0); + GenericItemPageFieldComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-generic-item-page-field', + templateUrl: '../item-page-field.component.html' + }) + /** + * This component can be used to represent metadata on a simple item page. + * It is the most generic way of displaying metadata values + * It expects 4 parameters: The item, a seperator, the metadata keys and an i18n key + */ + ], GenericItemPageFieldComponent); + return GenericItemPageFieldComponent; +}(ItemPageFieldComponent)); +export { GenericItemPageFieldComponent }; +//# sourceMappingURL=generic-item-page-field.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.js.map b/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.js.map new file mode 100644 index 0000000000..ec14171019 --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"generic-item-page-field.component.js","sourceRoot":"","sources":["generic-item-page-field.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAWtE;IAAmD,yDAAsB;IALzE;;;;OAIG;IACH;;IAuBA,CAAC;IAlBU;QAAR,KAAK,EAAE;0CAAO,IAAI;+DAAC;IAMX;QAAR,KAAK,EAAE;;oEAAmB;IAKlB;QAAR,KAAK,EAAE;;iEAAkB;IAKjB;QAAR,KAAK,EAAE;;gEAAe;IArBZ,6BAA6B;QATzC,SAAS,CAAC;YACT,QAAQ,EAAE,4BAA4B;YACtC,WAAW,EAAE,mCAAmC;SACjD,CAAC;QACF;;;;WAIG;OACU,6BAA6B,CAuBzC;IAAD,oCAAC;CAAA,AAvBD,CAAmD,sBAAsB,GAuBxE;SAvBY,6BAA6B"} \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.js b/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.js new file mode 100644 index 0000000000..8e6486e9a9 --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.js @@ -0,0 +1,29 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../../core/shared/item.model'; +/** + * This component can be used to represent metadata on a simple item page. + * It expects one input parameter of type Item to which the metadata belongs. + * This class can be extended to print certain metadata. + */ +var ItemPageFieldComponent = /** @class */ (function () { + function ItemPageFieldComponent() { + /** + * Separator string between multiple values of the metadata fields defined + * @type {string} + */ + this.separator = '
'; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], ItemPageFieldComponent.prototype, "item", void 0); + ItemPageFieldComponent = tslib_1.__decorate([ + Component({ + templateUrl: './item-page-field.component.html' + }) + ], ItemPageFieldComponent); + return ItemPageFieldComponent; +}()); +export { ItemPageFieldComponent }; +//# sourceMappingURL=item-page-field.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.js.map b/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.js.map new file mode 100644 index 0000000000..c1aca673a6 --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-page-field.component.js","sourceRoot":"","sources":["item-page-field.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D;;;;GAIG;AAKH;IAHA;QAoBI;;;WAGG;QACH,cAAS,GAAG,OAAO,CAAC;IAExB,CAAC;IAlBY;QAAR,KAAK,EAAE;0CAAO,IAAI;wDAAC;IALX,sBAAsB;QAHlC,SAAS,CAAC;YACP,WAAW,EAAE,kCAAkC;SAClD,CAAC;OACW,sBAAsB,CAuBlC;IAAD,6BAAC;CAAA,AAvBD,IAuBC;SAvBY,sBAAsB"} \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/title/item-page-title-field.component.js b/src/app/+item-page/simple/field-components/specific-field/title/item-page-title-field.component.js new file mode 100644 index 0000000000..7f2a131cd1 --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/title/item-page-title-field.component.js @@ -0,0 +1,34 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../../../core/shared/item.model'; +import { ItemPageFieldComponent } from '../item-page-field.component'; +var ItemPageTitleFieldComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemPageTitleFieldComponent, _super); + function ItemPageTitleFieldComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * Fields (schema.element.qualifier) used to render their values. + * In this component, we want to display values for metadata 'dc.title' + */ + _this.fields = [ + 'dc.title' + ]; + return _this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], ItemPageTitleFieldComponent.prototype, "item", void 0); + ItemPageTitleFieldComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-page-title-field', + templateUrl: './item-page-title-field.component.html' + }) + /** + * This component is used for displaying the title (dc.title) of an item + */ + ], ItemPageTitleFieldComponent); + return ItemPageTitleFieldComponent; +}(ItemPageFieldComponent)); +export { ItemPageTitleFieldComponent }; +//# sourceMappingURL=item-page-title-field.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/title/item-page-title-field.component.js.map b/src/app/+item-page/simple/field-components/specific-field/title/item-page-title-field.component.js.map new file mode 100644 index 0000000000..c2ea12c81c --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/title/item-page-title-field.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-page-title-field.component.js","sourceRoot":"","sources":["item-page-title-field.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAStE;IAAiD,uDAAsB;IAPvE;QAAA,qEA4BC;QARG;;;WAGG;QACH,YAAM,GAAa;YACf,UAAU;SACb,CAAC;;IAEN,CAAC;IAhBY;QAAR,KAAK,EAAE;0CAAO,IAAI;6DAAC;IALX,2BAA2B;QAPvC,SAAS,CAAC;YACP,QAAQ,EAAE,0BAA0B;YACpC,WAAW,EAAE,wCAAwC;SACxD,CAAC;QACF;;WAEG;OACU,2BAA2B,CAqBvC;IAAD,kCAAC;CAAA,AArBD,CAAiD,sBAAsB,GAqBtE;SArBY,2BAA2B"} \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/uri/item-page-uri-field.component.js b/src/app/+item-page/simple/field-components/specific-field/uri/item-page-uri-field.component.js new file mode 100644 index 0000000000..5375baa440 --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/uri/item-page-uri-field.component.js @@ -0,0 +1,38 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../../../core/shared/item.model'; +import { ItemPageFieldComponent } from '../item-page-field.component'; +var ItemPageUriFieldComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemPageUriFieldComponent, _super); + function ItemPageUriFieldComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * Fields (schema.element.qualifier) used to render their values. + * In this component, we want to display values for metadata 'dc.identifier.uri' + */ + _this.fields = [ + 'dc.identifier.uri' + ]; + /** + * Label i18n key for the rendered metadata + */ + _this.label = 'item.page.uri'; + return _this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], ItemPageUriFieldComponent.prototype, "item", void 0); + ItemPageUriFieldComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-page-uri-field', + templateUrl: './item-page-uri-field.component.html' + }) + /** + * This component is used for displaying the uri (dc.identifier.uri) metadata of an item + */ + ], ItemPageUriFieldComponent); + return ItemPageUriFieldComponent; +}(ItemPageFieldComponent)); +export { ItemPageUriFieldComponent }; +//# sourceMappingURL=item-page-uri-field.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/field-components/specific-field/uri/item-page-uri-field.component.js.map b/src/app/+item-page/simple/field-components/specific-field/uri/item-page-uri-field.component.js.map new file mode 100644 index 0000000000..19a60b8c67 --- /dev/null +++ b/src/app/+item-page/simple/field-components/specific-field/uri/item-page-uri-field.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-page-uri-field.component.js","sourceRoot":"","sources":["item-page-uri-field.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAStE;IAA+C,qDAAsB;IAPrE;QAAA,qEAiCC;QAbC;;;WAGG;QACH,YAAM,GAAa;YACjB,mBAAmB;SACpB,CAAC;QAEF;;WAEG;QACH,WAAK,GAAG,eAAe,CAAC;;IAE1B,CAAC;IArBU;QAAR,KAAK,EAAE;0CAAO,IAAI;2DAAC;IALT,yBAAyB;QAPrC,SAAS,CAAC;YACT,QAAQ,EAAE,wBAAwB;YAClC,WAAW,EAAE,sCAAsC;SACpD,CAAC;QACF;;WAEG;OACU,yBAAyB,CA0BrC;IAAD,gCAAC;CAAA,AA1BD,CAA+C,sBAAsB,GA0BpE;SA1BY,yBAAyB"} \ No newline at end of file diff --git a/src/app/+item-page/simple/item-page.component.js b/src/app/+item-page/simple/item-page.component.js new file mode 100644 index 0000000000..13a0b9d906 --- /dev/null +++ b/src/app/+item-page/simple/item-page.component.js @@ -0,0 +1,46 @@ +import * as tslib_1 from "tslib"; +import { map } from 'rxjs/operators'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { ItemDataService } from '../../core/data/item-data.service'; +import { MetadataService } from '../../core/metadata/metadata.service'; +import { fadeInOut } from '../../shared/animations/fade'; +import { redirectToPageNotFoundOn404 } from '../../core/shared/operators'; +import { ItemViewMode } from '../../shared/items/item-type-decorator'; +/** + * This component renders a simple item page. + * The route parameter 'id' is used to request the item it represents. + * All fields of the item that should be displayed, are defined in its template. + */ +var ItemPageComponent = /** @class */ (function () { + function ItemPageComponent(route, router, items, metadataService) { + this.route = route; + this.router = router; + this.items = items; + this.metadataService = metadataService; + /** + * The view-mode we're currently on + */ + this.viewMode = ItemViewMode.Full; + } + ItemPageComponent.prototype.ngOnInit = function () { + this.itemRD$ = this.route.data.pipe(map(function (data) { return data.item; }), redirectToPageNotFoundOn404(this.router)); + this.metadataService.processRemoteData(this.itemRD$); + }; + ItemPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-page', + styleUrls: ['./item-page.component.scss'], + templateUrl: './item-page.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + animations: [fadeInOut] + }), + tslib_1.__metadata("design:paramtypes", [ActivatedRoute, + Router, + ItemDataService, + MetadataService]) + ], ItemPageComponent); + return ItemPageComponent; +}()); +export { ItemPageComponent }; +//# sourceMappingURL=item-page.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/item-page.component.js.map b/src/app/+item-page/simple/item-page.component.js.map new file mode 100644 index 0000000000..71d03e30b8 --- /dev/null +++ b/src/app/+item-page/simple/item-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-page.component.js","sourceRoot":"","sources":["item-page.component.ts"],"names":[],"mappings":";AACA,OAAO,EAAoB,GAAG,EAAa,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAMpE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE;;;;GAIG;AAQH;IAiBE,2BACU,KAAqB,EACrB,MAAc,EACd,KAAsB,EACtB,eAAgC;QAHhC,UAAK,GAAL,KAAK,CAAgB;QACrB,WAAM,GAAN,MAAM,CAAQ;QACd,UAAK,GAAL,KAAK,CAAiB;QACtB,oBAAe,GAAf,eAAe,CAAiB;QAT1C;;WAEG;QACH,aAAQ,GAAG,YAAY,CAAC,IAAI,CAAC;IAOzB,CAAC;IAEL,oCAAQ,GAAR;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CACjC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,IAAwB,EAA7B,CAA6B,CAAC,EAC5C,2BAA2B,CAAC,IAAI,CAAC,MAAM,CAAC,CACzC,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IA9BU,iBAAiB;QAP7B,SAAS,CAAC;YACT,QAAQ,EAAE,cAAc;YACxB,SAAS,EAAE,CAAC,4BAA4B,CAAC;YACzC,WAAW,EAAE,4BAA4B;YACzC,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC;iDAmBiB,cAAc;YACb,MAAM;YACP,eAAe;YACL,eAAe;OArB/B,iBAAiB,CA+B7B;IAAD,wBAAC;CAAA,AA/BD,IA+BC;SA/BY,iBAAiB"} \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.js b/src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.js new file mode 100644 index 0000000000..7067f2b92f --- /dev/null +++ b/src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.js @@ -0,0 +1,43 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { ItemDataService } from '../../../../core/data/item-data.service'; +import { Item } from '../../../../core/shared/item.model'; +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; +import { isNotEmpty } from '../../../../shared/empty.util'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; +var JournalIssueComponent = /** @class */ (function (_super) { + tslib_1.__extends(JournalIssueComponent, _super); + function JournalIssueComponent(item, ids) { + var _this = _super.call(this, item) || this; + _this.item = item; + _this.ids = ids; + return _this; + } + JournalIssueComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + if (isNotEmpty(this.resolvedRelsAndTypes$)) { + this.volumes$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isJournalVolumeOfIssue'), relationsToItems(this.item.id, this.ids)); + this.publications$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isPublicationOfJournalIssue'), relationsToItems(this.item.id, this.ids)); + } + }; + JournalIssueComponent = tslib_1.__decorate([ + rendersItemType('JournalIssue', ItemViewMode.Full), + Component({ + selector: 'ds-journal-issue', + styleUrls: ['./journal-issue.component.scss'], + templateUrl: './journal-issue.component.html' + }) + /** + * The component for displaying metadata and relations of an item of the type Journal Issue + */ + , + tslib_1.__param(0, Inject(ITEM)), + tslib_1.__metadata("design:paramtypes", [Item, + ItemDataService]) + ], JournalIssueComponent); + return JournalIssueComponent; +}(ItemComponent)); +export { JournalIssueComponent }; +//# sourceMappingURL=journal-issue.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.js.map b/src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.js.map new file mode 100644 index 0000000000..32e7878a23 --- /dev/null +++ b/src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"journal-issue.component.js","sourceRoot":"","sources":["journal-issue.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAE,IAAI,EAAE,MAAM,gEAAgE,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAWlG;IAA2C,iDAAa;IAWtD,+BACuB,IAAU,EACvB,GAAoB;QAF9B,YAIE,kBAAM,IAAI,CAAC,SACZ;QAJsB,UAAI,GAAJ,IAAI,CAAM;QACvB,SAAG,GAAH,GAAG,CAAiB;;IAG9B,CAAC;IACD,wCAAQ,GAAR;QACE,iBAAM,QAAQ,WAAE,CAAC;QAEjB,IAAI,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,EAAE;YAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAC7C,0BAA0B,CAAC,wBAAwB,CAAC,EACpD,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CACzC,CAAC;YACF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAClD,0BAA0B,CAAC,6BAA6B,CAAC,EACzD,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CACzC,CAAC;SACH;IACH,CAAC;IA9BU,qBAAqB;QATjC,eAAe,CAAC,cAAc,EAAE,YAAY,CAAC,IAAI,CAAC;QAClD,SAAS,CAAC;YACT,QAAQ,EAAE,kBAAkB;YAC5B,SAAS,EAAE,CAAC,gCAAgC,CAAC;YAC7C,WAAW,EAAE,gCAAgC;SAC9C,CAAC;QACF;;WAEG;;QAaE,mBAAA,MAAM,CAAC,IAAI,CAAC,CAAA;iDAAc,IAAI;YAClB,eAAe;OAbnB,qBAAqB,CA+BjC;IAAD,4BAAC;CAAA,AA/BD,CAA2C,aAAa,GA+BvD;SA/BY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.js b/src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.js new file mode 100644 index 0000000000..4c5985eb6f --- /dev/null +++ b/src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.js @@ -0,0 +1,43 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { ItemDataService } from '../../../../core/data/item-data.service'; +import { Item } from '../../../../core/shared/item.model'; +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; +import { isNotEmpty } from '../../../../shared/empty.util'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; +var JournalVolumeComponent = /** @class */ (function (_super) { + tslib_1.__extends(JournalVolumeComponent, _super); + function JournalVolumeComponent(item, ids) { + var _this = _super.call(this, item) || this; + _this.item = item; + _this.ids = ids; + return _this; + } + JournalVolumeComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + if (isNotEmpty(this.resolvedRelsAndTypes$)) { + this.journals$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isJournalOfVolume'), relationsToItems(this.item.id, this.ids)); + this.issues$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isIssueOfJournalVolume'), relationsToItems(this.item.id, this.ids)); + } + }; + JournalVolumeComponent = tslib_1.__decorate([ + rendersItemType('JournalVolume', ItemViewMode.Full), + Component({ + selector: 'ds-journal-volume', + styleUrls: ['./journal-volume.component.scss'], + templateUrl: './journal-volume.component.html' + }) + /** + * The component for displaying metadata and relations of an item of the type Journal Volume + */ + , + tslib_1.__param(0, Inject(ITEM)), + tslib_1.__metadata("design:paramtypes", [Item, + ItemDataService]) + ], JournalVolumeComponent); + return JournalVolumeComponent; +}(ItemComponent)); +export { JournalVolumeComponent }; +//# sourceMappingURL=journal-volume.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.js.map b/src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.js.map new file mode 100644 index 0000000000..f058ca29d1 --- /dev/null +++ b/src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"journal-volume.component.js","sourceRoot":"","sources":["journal-volume.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE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SAAS,EAAE,CAAC,iCAAiC,CAAC;YAC9C,WAAW,EAAE,iCAAiC;SAC/C,CAAC;QACF;;WAEG;;QAaE,mBAAA,MAAM,CAAC,IAAI,CAAC,CAAA;iDAAc,IAAI;YAClB,eAAe;OAbnB,sBAAsB,CA+BlC;IAAD,6BAAC;CAAA,AA/BD,CAA4C,aAAa,GA+BxD;SA/BY,sBAAsB"} \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/journal/journal.component.js b/src/app/+item-page/simple/item-types/journal/journal.component.js new file mode 100644 index 0000000000..8c528e7910 --- /dev/null +++ b/src/app/+item-page/simple/item-types/journal/journal.component.js @@ -0,0 +1,42 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { ItemDataService } from '../../../../core/data/item-data.service'; +import { Item } from '../../../../core/shared/item.model'; +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; +import { isNotEmpty } from '../../../../shared/empty.util'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; +var JournalComponent = /** @class */ (function (_super) { + tslib_1.__extends(JournalComponent, _super); + function JournalComponent(item, ids) { + var _this = _super.call(this, item) || this; + _this.item = item; + _this.ids = ids; + return _this; + } + JournalComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + if (isNotEmpty(this.resolvedRelsAndTypes$)) { + this.volumes$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isVolumeOfJournal'), relationsToItems(this.item.id, this.ids)); + } + }; + JournalComponent = tslib_1.__decorate([ + rendersItemType('Journal', ItemViewMode.Full), + Component({ + selector: 'ds-journal', + styleUrls: ['./journal.component.scss'], + templateUrl: './journal.component.html' + }) + /** + * The component for displaying metadata and relations of an item of the type Journal + */ + , + tslib_1.__param(0, Inject(ITEM)), + tslib_1.__metadata("design:paramtypes", [Item, + ItemDataService]) + ], JournalComponent); + return JournalComponent; +}(ItemComponent)); +export { JournalComponent }; +//# sourceMappingURL=journal.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/journal/journal.component.js.map b/src/app/+item-page/simple/item-types/journal/journal.component.js.map new file mode 100644 index 0000000000..48133a11ad --- /dev/null +++ b/src/app/+item-page/simple/item-types/journal/journal.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"journal.component.js","sourceRoot":"","sources":["journal.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAE,IAAI,EAAE,MAAM,gEAAgE,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAWlG;IAAsC,4CAAa;IAMjD,0BACuB,IAAU,EACvB,GAAoB;QAF9B,YAIE,kBAAM,IAAI,CAAC,SACZ;QAJsB,UAAI,GAAJ,IAAI,CAAM;QACvB,SAAG,GAAH,GAAG,CAAiB;;IAG9B,CAAC;IACD,mCAAQ,GAAR;QACE,iBAAM,QAAQ,WAAE,CAAC;QAEjB,IAAI,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,EAAE;YAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAC7C,0BAA0B,CAAC,mBAAmB,CAAC,EAC/C,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CACzC,CAAC;SACH;IACH,CAAC;IArBU,gBAAgB;QAT5B,eAAe,CAAC,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC;QAC7C,SAAS,CAAC;YACT,QAAQ,EAAE,YAAY;YACtB,SAAS,EAAE,CAAC,0BAA0B,CAAC;YACvC,WAAW,EAAE,0BAA0B;SACxC,CAAC;QACF;;WAEG;;QAQE,mBAAA,MAAM,CAAC,IAAI,CAAC,CAAA;iDAAc,IAAI;YAClB,eAAe;OARnB,gBAAgB,CAsB5B;IAAD,uBAAC;CAAA,AAtBD,CAAsC,aAAa,GAsBlD;SAtBY,gBAAgB"} \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/orgunit/orgunit.component.js b/src/app/+item-page/simple/item-types/orgunit/orgunit.component.js new file mode 100644 index 0000000000..b83f97d0dd --- /dev/null +++ b/src/app/+item-page/simple/item-types/orgunit/orgunit.component.js @@ -0,0 +1,44 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { ItemDataService } from '../../../../core/data/item-data.service'; +import { Item } from '../../../../core/shared/item.model'; +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; +import { isNotEmpty } from '../../../../shared/empty.util'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; +var OrgunitComponent = /** @class */ (function (_super) { + tslib_1.__extends(OrgunitComponent, _super); + function OrgunitComponent(item, ids) { + var _this = _super.call(this, item) || this; + _this.item = item; + _this.ids = ids; + return _this; + } + OrgunitComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + if (isNotEmpty(this.resolvedRelsAndTypes$)) { + this.people$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isPersonOfOrgUnit'), relationsToItems(this.item.id, this.ids)); + this.projects$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isProjectOfOrgUnit'), relationsToItems(this.item.id, this.ids)); + this.publications$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isPublicationOfOrgUnit'), relationsToItems(this.item.id, this.ids)); + } + }; + OrgunitComponent = tslib_1.__decorate([ + rendersItemType('OrgUnit', ItemViewMode.Full), + Component({ + selector: 'ds-orgunit', + styleUrls: ['./orgunit.component.scss'], + templateUrl: './orgunit.component.html' + }) + /** + * The component for displaying metadata and relations of an item of the type Organisation Unit + */ + , + tslib_1.__param(0, Inject(ITEM)), + tslib_1.__metadata("design:paramtypes", [Item, + ItemDataService]) + ], OrgunitComponent); + return OrgunitComponent; +}(ItemComponent)); +export { OrgunitComponent }; +//# sourceMappingURL=orgunit.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/orgunit/orgunit.component.js.map b/src/app/+item-page/simple/item-types/orgunit/orgunit.component.js.map new file mode 100644 index 0000000000..f49ad6c787 --- /dev/null +++ b/src/app/+item-page/simple/item-types/orgunit/orgunit.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"orgunit.component.js","sourceRoot":"","sources":["orgunit.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAU,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAE,IAAI,EAAE,MAAM,gEAAgE,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAWlG;IAAsC,4CAAa;IAgBjD,0BACuB,IAAU,EACvB,GAAoB;QAF9B,YAIE,kBAAM,IAAI,CAAC,SACZ;QAJsB,UAAI,GAAJ,IAAI,CAAM;QACvB,SAAG,GAAH,GAAG,CAAiB;;IAG9B,CAAC;IAED,mCAAQ,GAAR;QACE,iBAAM,QAAQ,WAAE,CAAC;QAEjB,IAAI,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,EAAE;YAC1C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAC5C,0BAA0B,CAAC,mBAAmB,CAAC,EAC/C,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CACzC,CAAC;YAEF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAC9C,0BAA0B,CAAC,oBAAoB,CAAC,EAChD,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CACzC,CAAC;YAEF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAClD,0BAA0B,CAAC,wBAAwB,CAAC,EACpD,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CACzC,CAAC;SACH;IACH,CAAC;IA1CU,gBAAgB;QAT5B,eAAe,CAAC,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC;QAC7C,SAAS,CAAC;YACT,QAAQ,EAAE,YAAY;YACtB,SAAS,EAAE,CAAC,0BAA0B,CAAC;YACvC,WAAW,EAAE,0BAA0B;SACxC,CAAC;QACF;;WAEG;;QAkBE,mBAAA,MAAM,CAAC,IAAI,CAAC,CAAA;iDAAc,IAAI;YAClB,eAAe;OAlBnB,gBAAgB,CA0CzB;IAAD,uBAAC;CAAA,AA1CJ,CAAsC,aAAa,GA0C/C;SA1CS,gBAAgB"} \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/person/person.component.js b/src/app/+item-page/simple/item-types/person/person.component.js new file mode 100644 index 0000000000..d9743160b2 --- /dev/null +++ b/src/app/+item-page/simple/item-types/person/person.component.js @@ -0,0 +1,50 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { of as observableOf } from 'rxjs'; +import { ItemDataService } from '../../../../core/data/item-data.service'; +import { Item } from '../../../../core/shared/item.model'; +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; +import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service'; +import { isNotEmpty } from '../../../../shared/empty.util'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; +var PersonComponent = /** @class */ (function (_super) { + tslib_1.__extends(PersonComponent, _super); + function PersonComponent(item, ids, fixedFilterService) { + var _this = _super.call(this, item) || this; + _this.item = item; + _this.ids = ids; + _this.fixedFilterService = fixedFilterService; + return _this; + } + PersonComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + if (isNotEmpty(this.resolvedRelsAndTypes$)) { + this.publications$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isPublicationOfAuthor'), relationsToItems(this.item.id, this.ids)); + this.projects$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isProjectOfPerson'), relationsToItems(this.item.id, this.ids)); + this.orgUnits$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isOrgUnitOfPerson'), relationsToItems(this.item.id, this.ids)); + this.fixedFilterQuery = this.fixedFilterService.getQueryByRelations('isAuthorOfPublication', this.item.id); + this.fixedFilter$ = observableOf('publication'); + } + }; + PersonComponent = tslib_1.__decorate([ + rendersItemType('Person', ItemViewMode.Full), + Component({ + selector: 'ds-person', + styleUrls: ['./person.component.scss'], + templateUrl: './person.component.html' + }) + /** + * The component for displaying metadata and relations of an item of the type Person + */ + , + tslib_1.__param(0, Inject(ITEM)), + tslib_1.__metadata("design:paramtypes", [Item, + ItemDataService, + SearchFixedFilterService]) + ], PersonComponent); + return PersonComponent; +}(ItemComponent)); +export { PersonComponent }; +//# sourceMappingURL=person.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/person/person.component.js.map b/src/app/+item-page/simple/item-types/person/person.component.js.map new file mode 100644 index 0000000000..66f27ec1bc --- /dev/null +++ b/src/app/+item-page/simple/item-types/person/person.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"person.component.js","sourceRoot":"","sources":["person.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAgB,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAE,IAAI,EAAE,MAAM,gEAAgE,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mFAAmF,CAAC;AAC7H,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAWlG;IAAqC,2CAAa;IA0BhD,yBACuB,IAAU,EACvB,GAAoB,EACpB,kBAA4C;QAHtD,YAKE,kBAAM,IAAI,CAAC,SACZ;QALsB,UAAI,GAAJ,IAAI,CAAM;QACvB,SAAG,GAAH,GAAG,CAAiB;QACpB,wBAAkB,GAAlB,kBAAkB,CAA0B;;IAGtD,CAAC;IACD,kCAAQ,GAAR;QACE,iBAAM,QAAQ,WAAE,CAAC;QAEjB,IAAI,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,EAAE;YAC1C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAClD,0BAA0B,CAAC,uBAAuB,CAAC,EACnD,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CACzC,CAAC;YAEF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAC9C,0BAA0B,CAAC,mBAAmB,CAAC,EAC/C,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CACzC,CAAC;YAEF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAC9C,0BAA0B,CAAC,mBAAmB,CAAC,EAC/C,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CACzC,CAAC;YAEF,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,uBAAuB,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC3G,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;SACjD;IACH,CAAC;IAvDU,eAAe;QAT3B,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC;QAC5C,SAAS,CAAC;YACT,QAAQ,EAAE,WAAW;YACrB,SAAS,EAAE,CAAC,yBAAyB,CAAC;YACtC,WAAW,EAAE,yBAAyB;SACvC,CAAC;QACF;;WAEG;;QA4BE,mBAAA,MAAM,CAAC,IAAI,CAAC,CAAA;iDAAc,IAAI;YAClB,eAAe;YACA,wBAAwB;OA7B3C,eAAe,CAwD3B;IAAD,sBAAC;CAAA,AAxDD,CAAqC,aAAa,GAwDjD;SAxDY,eAAe"} \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/project/project.component.js b/src/app/+item-page/simple/item-types/project/project.component.js new file mode 100644 index 0000000000..c90aaf4a78 --- /dev/null +++ b/src/app/+item-page/simple/item-types/project/project.component.js @@ -0,0 +1,45 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { ItemDataService } from '../../../../core/data/item-data.service'; +import { Item } from '../../../../core/shared/item.model'; +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; +import { isNotEmpty } from '../../../../shared/empty.util'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; +var ProjectComponent = /** @class */ (function (_super) { + tslib_1.__extends(ProjectComponent, _super); + function ProjectComponent(item, ids) { + var _this = _super.call(this, item) || this; + _this.item = item; + _this.ids = ids; + return _this; + } + ProjectComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + if (isNotEmpty(this.resolvedRelsAndTypes$)) { + this.contributors$ = this.buildRepresentations('OrgUnit', 'project.contributor.other', this.ids); + this.people$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isPersonOfProject'), relationsToItems(this.item.id, this.ids)); + this.publications$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isPublicationOfProject'), relationsToItems(this.item.id, this.ids)); + this.orgUnits$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isOrgUnitOfProject'), relationsToItems(this.item.id, this.ids)); + } + }; + ProjectComponent = tslib_1.__decorate([ + rendersItemType('Project', ItemViewMode.Full), + Component({ + selector: 'ds-project', + styleUrls: ['./project.component.scss'], + templateUrl: './project.component.html' + }) + /** + * The component for displaying metadata and relations of an item of the type Project + */ + , + tslib_1.__param(0, Inject(ITEM)), + tslib_1.__metadata("design:paramtypes", [Item, + ItemDataService]) + ], ProjectComponent); + return ProjectComponent; +}(ItemComponent)); +export { ProjectComponent }; +//# sourceMappingURL=project.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/project/project.component.js.map b/src/app/+item-page/simple/item-types/project/project.component.js.map new file mode 100644 index 0000000000..698e52bbdd --- /dev/null +++ b/src/app/+item-page/simple/item-types/project/project.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"project.component.js","sourceRoot":"","sources":["project.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAU,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAE,IAAI,EAAE,MAAM,gEAAgE,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAWlG;IAAsC,4CAAa;IAqBjD,0BACuB,IAAU,EACvB,GAAoB;QAF9B,YAIE,kBAAM,IAAI,CAAC,SACZ;QAJsB,UAAI,GAAJ,IAAI,CAAM;QACvB,SAAG,GAAH,GAAG,CAAiB;;IAG9B,CAAC;IAED,mCAAQ,GAAR;QACE,iBAAM,QAAQ,WAAE,CAAC;QAEjB,IAAI,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,EAAE;YAC1C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,2BAA2B,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAEjG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAC5C,0BAA0B,CAAC,mBAAmB,CAAC,EAC/C,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CACzC,CAAC;YAEF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAClD,0BAA0B,CAAC,wBAAwB,CAAC,EACpD,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CACzC,CAAC;YAEF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAC9C,0BAA0B,CAAC,oBAAoB,CAAC,EAChD,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CACzC,CAAC;SACH;IACH,CAAC;IAjDU,gBAAgB;QAT5B,eAAe,CAAC,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC;QAC7C,SAAS,CAAC;YACT,QAAQ,EAAE,YAAY;YACtB,SAAS,EAAE,CAAC,0BAA0B,CAAC;YACvC,WAAW,EAAE,0BAA0B;SACxC,CAAC;QACF;;WAEG;;QAuBE,mBAAA,MAAM,CAAC,IAAI,CAAC,CAAA;iDAAc,IAAI;YAClB,eAAe;OAvBnB,gBAAgB,CAkD5B;IAAD,uBAAC;CAAA,AAlDD,CAAsC,aAAa,GAkDlD;SAlDY,gBAAgB"} \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/publication/publication.component.js b/src/app/+item-page/simple/item-types/publication/publication.component.js new file mode 100644 index 0000000000..637eebce78 --- /dev/null +++ b/src/app/+item-page/simple/item-types/publication/publication.component.js @@ -0,0 +1,42 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, Component, Inject } from '@angular/core'; +import { ItemDataService } from '../../../../core/data/item-data.service'; +import { Item } from '../../../../core/shared/item.model'; +import { DEFAULT_ITEM_TYPE, ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; +var PublicationComponent = /** @class */ (function (_super) { + tslib_1.__extends(PublicationComponent, _super); + function PublicationComponent(item, ids) { + var _this = _super.call(this, item) || this; + _this.item = item; + _this.ids = ids; + return _this; + } + PublicationComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + if (this.resolvedRelsAndTypes$) { + this.authors$ = this.buildRepresentations('Person', 'dc.contributor.author', this.ids); + this.projects$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isProjectOfPublication'), relationsToItems(this.item.id, this.ids)); + this.orgUnits$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isOrgUnitOfPublication'), relationsToItems(this.item.id, this.ids)); + this.journalIssues$ = this.resolvedRelsAndTypes$.pipe(filterRelationsByTypeLabel('isJournalIssueOfPublication'), relationsToItems(this.item.id, this.ids)); + } + }; + PublicationComponent = tslib_1.__decorate([ + rendersItemType('Publication', ItemViewMode.Full), + rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Full), + Component({ + selector: 'ds-publication', + styleUrls: ['./publication.component.scss'], + templateUrl: './publication.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + }), + tslib_1.__param(0, Inject(ITEM)), + tslib_1.__metadata("design:paramtypes", [Item, + ItemDataService]) + ], PublicationComponent); + return PublicationComponent; +}(ItemComponent)); +export { PublicationComponent }; +//# sourceMappingURL=publication.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/publication/publication.component.js.map b/src/app/+item-page/simple/item-types/publication/publication.component.js.map new file mode 100644 index 0000000000..6698442ee8 --- /dev/null +++ b/src/app/+item-page/simple/item-types/publication/publication.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"publication.component.js","sourceRoot":"","sources":["publication.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,EAAU,MAAM,eAAe,CAAC;AAEnF,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;A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G,CAAC,CACzC,CAAC;SAEH;IACH,CAAC;IAnDU,oBAAoB;QARhC,eAAe,CAAC,aAAa,EAAE,YAAY,CAAC,IAAI,CAAC;QACjD,eAAe,CAAC,iBAAiB,EAAE,YAAY,CAAC,IAAI,CAAC;QACrD,SAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,CAAC,8BAA8B,CAAC;YAC3C,WAAW,EAAE,8BAA8B;YAC3C,eAAe,EAAE,uBAAuB,CAAC,MAAM;SAChD,CAAC;QAuBG,mBAAA,MAAM,CAAC,IAAI,CAAC,CAAA;iDAAc,IAAI;YAClB,eAAe;OAvBnB,oBAAoB,CAoDhC;IAAD,2BAAC;CAAA,AApDD,CAA0C,aAAa,GAoDtD;SApDY,oBAAoB"} \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/shared/item-relationships-utils.js b/src/app/+item-page/simple/item-types/shared/item-relationships-utils.js new file mode 100644 index 0000000000..becf6c21c4 --- /dev/null +++ b/src/app/+item-page/simple/item-types/shared/item-relationships-utils.js @@ -0,0 +1,103 @@ +import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-representation/item/item-metadata-representation.model'; +import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model'; +import { MetadataValue } from '../../../../core/shared/metadata.models'; +import { getSucceededRemoteData } from '../../../../core/shared/operators'; +import { hasValue } from '../../../../shared/empty.util'; +import { distinctUntilChanged, flatMap, map } from 'rxjs/operators'; +import { of as observableOf, zip as observableZip } from 'rxjs'; +/** + * Operator for comparing arrays using a mapping function + * The mapping function should turn the source array into an array of basic types, so that the array can + * be compared using these basic types. + * For example: "(o) => o.id" will compare the two arrays by comparing their content by id. + * @param mapFn Function for mapping the arrays + */ +export var compareArraysUsing = function (mapFn) { + return function (a, b) { + if (!Array.isArray(a) || !Array.isArray(b)) { + return false; + } + var aIds = a.map(mapFn); + var bIds = b.map(mapFn); + return aIds.length === bIds.length && + aIds.every(function (e) { return bIds.includes(e); }) && + bIds.every(function (e) { return aIds.includes(e); }); + }; +}; +/** + * Operator for comparing arrays using the object's ids + */ +export var compareArraysUsingIds = function () { + return compareArraysUsing(function (t) { return hasValue(t) ? t.id : undefined; }); +}; +/** + * Fetch the relationships which match the type label given + * @param {string} label Type label + * @returns {(source: Observable<[Relationship[] , RelationshipType[]]>) => Observable} + */ +export var filterRelationsByTypeLabel = function (label) { + return function (source) { + return source.pipe(map(function (_a) { + var relsCurrentPage = _a[0], relTypesCurrentPage = _a[1]; + return relsCurrentPage.filter(function (rel, idx) { + return hasValue(relTypesCurrentPage[idx]) && (relTypesCurrentPage[idx].leftLabel === label || + relTypesCurrentPage[idx].rightLabel === label); + }); + }), distinctUntilChanged(compareArraysUsingIds())); + }; +}; +/** + * Operator for turning a list of relationships into a list of the relevant items + * @param {string} thisId The item's id of which the relations belong to + * @param {ItemDataService} ids The ItemDataService to fetch items from the REST API + * @returns {(source: Observable) => Observable} + */ +export var relationsToItems = function (thisId, ids) { + return function (source) { + return source.pipe(flatMap(function (rels) { + return observableZip.apply(void 0, rels.map(function (rel) { + var queryId = rel.leftId; + if (rel.leftId === thisId) { + queryId = rel.rightId; + } + return ids.findById(queryId); + })); + }), map(function (arr) { + return arr + .filter(function (d) { return d.hasSucceeded; }) + .map(function (d) { return d.payload; }); + }), distinctUntilChanged(compareArraysUsingIds())); + }; +}; +/** + * Operator for turning a list of relationships into a list of metadatarepresentations given the original metadata + * @param parentId The id of the parent item + * @param itemType The type of relation this list resembles (for creating representations) + * @param metadata The list of original Metadatum objects + * @param ids The ItemDataService to use for fetching Items from the Rest API + */ +export var relationsToRepresentations = function (parentId, itemType, metadata, ids) { + return function (source) { + return source.pipe(flatMap(function (rels) { + return observableZip.apply(void 0, metadata + .map(function (metadatum) { return Object.assign(new MetadataValue(), metadatum); }) + .map(function (metadatum) { + if (metadatum.isVirtual) { + var matchingRels = rels.filter(function (rel) { return ('' + rel.id) === metadatum.virtualValue; }); + if (matchingRels.length > 0) { + var matchingRel = matchingRels[0]; + var queryId = matchingRel.leftId; + if (matchingRel.leftId === parentId) { + queryId = matchingRel.rightId; + } + return ids.findById(queryId).pipe(getSucceededRemoteData(), map(function (d) { return Object.assign(new ItemMetadataRepresentation(), d.payload); })); + } + } + else { + return observableOf(Object.assign(new MetadatumRepresentation(itemType), metadatum)); + } + })); + })); + }; +}; +//# sourceMappingURL=item-relationships-utils.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/shared/item-relationships-utils.js.map b/src/app/+item-page/simple/item-types/shared/item-relationships-utils.js.map new file mode 100644 index 0000000000..a11c9dbf1c --- /dev/null +++ b/src/app/+item-page/simple/item-types/shared/item-relationships-utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-relationships-utils.js","sourceRoot":"","sources":["item-relationships-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yFAAyF,CAAC;AAErI,OAAO,EAAE,uBAAuB,EAAE,MAAM,0FAA0F,CAAC;AACnI,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAIzD,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,GAAG,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAKhE;;;;;;GAMG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAAI,KAAoB;IACxD,OAAA,UAAC,CAAM,EAAE,CAAM;QACb,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAC3C,OAAO,KAAK,CAAA;SACb;QAED,IAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,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,GAAG,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC,YAAY,EAAxC,CAAwC,CAAC,CAAC;oBAClG,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;wBAC3B,IAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;wBACpC,IAAI,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC;wBACjC,IAAI,WAAW,CAAC,MAAM,KAAK,QAAQ,EAAE;4BACnC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;yBAC/B;wBACD,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAC/B,sBAAsB,EAAE,EACxB,GAAG,CAAC,UAAC,CAAmB,IAAK,OAAA,MAAM,CAAC,MAAM,CAAC,IAAI,0BAA0B,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,EAA1D,CAA0D,CAAC,CACzF,CAAC;qBACH;iBACF;qBAAM;oBACL,OAAO,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,uBAAuB,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;iBACtF;YACH,CAAC,CAAC;QApBN,CAqBC,CACF,CACF;IAzBD,CAyBC;AA1BH,CA0BG,CAAC"} \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/shared/item.component.js b/src/app/+item-page/simple/item-types/shared/item.component.js new file mode 100644 index 0000000000..de31db6666 --- /dev/null +++ b/src/app/+item-page/simple/item-types/shared/item.component.js @@ -0,0 +1,53 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { combineLatest as observableCombineLatest, zip as observableZip } from 'rxjs'; +import { distinctUntilChanged, filter, flatMap, map } from 'rxjs/operators'; +import { Item } from '../../../../core/shared/item.model'; +import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/shared/operators'; +import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; +import { compareArraysUsingIds, relationsToRepresentations } from './item-relationships-utils'; +var ItemComponent = /** @class */ (function () { + function ItemComponent(item) { + this.item = item; + } + ItemComponent.prototype.ngOnInit = function () { + var relationships$ = this.item.relationships; + if (relationships$) { + var relsCurrentPage$ = relationships$.pipe(filter(function (rd) { return rd.hasSucceeded; }), getRemoteDataPayload(), map(function (pl) { return pl.page; }), distinctUntilChanged(compareArraysUsingIds())); + var relTypesCurrentPage$ = relsCurrentPage$.pipe(flatMap(function (rels) { + return observableZip.apply(void 0, rels.map(function (rel) { return rel.relationshipType; })).pipe(map(function (_a) { + var arr = _a.slice(0); + return arr.map(function (d) { return d.payload; }); + })); + }), distinctUntilChanged(compareArraysUsingIds())); + this.resolvedRelsAndTypes$ = observableCombineLatest(relsCurrentPage$, relTypesCurrentPage$); + } + }; + /** + * Build a list of MetadataRepresentations for the current item. This combines all metadata and relationships of a + * certain type. + * @param itemType The type of item we're building representations of. Used for matching templates. + * @param metadataField The metadata field that resembles the item type. + * @param itemDataService ItemDataService to turn relations into items. + */ + ItemComponent.prototype.buildRepresentations = function (itemType, metadataField, itemDataService) { + var metadata = this.item.findMetadataSortedByPlace(metadataField); + var relsCurrentPage$ = this.item.relationships.pipe(getSucceededRemoteData(), getRemoteDataPayload(), map(function (pl) { return pl.page; }), distinctUntilChanged(compareArraysUsingIds())); + return relsCurrentPage$.pipe(relationsToRepresentations(this.item.id, itemType, metadata, itemDataService)); + }; + ItemComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item', + template: '' + }) + /** + * A generic component for displaying metadata and relations of an item + */ + , + tslib_1.__param(0, Inject(ITEM)), + tslib_1.__metadata("design:paramtypes", [Item]) + ], ItemComponent); + return ItemComponent; +}()); +export { ItemComponent }; +//# sourceMappingURL=item.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/item-types/shared/item.component.js.map b/src/app/+item-page/simple/item-types/shared/item.component.js.map new file mode 100644 index 0000000000..cc6aad248b --- /dev/null +++ b/src/app/+item-page/simple/item-types/shared/item.component.js.map @@ -0,0 +1 @@ +{"version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BAAM;oBAA2C,OAAA,GAAG,CAAC,GAAG,CAAC,UAAC,CAA+B,IAAK,OAAA,CAAC,CAAC,OAAO,EAAT,CAAS,CAAC;gBAAvD,CAAuD,CAAC,CAChH;YAFD,CAEC,CACF,EACD,oBAAoB,CAAC,qBAAqB,EAAE,CAAC,CAC9C,CAAC;YAEF,IAAI,CAAC,qBAAqB,GAAG,uBAAuB,CAClD,gBAAgB,EAChB,oBAAoB,CACrB,CAAC;SACH;IACH,CAAC;IAED;;;;;;OAMG;IACH,4CAAoB,GAApB,UAAqB,QAAgB,EAAE,aAAqB,EAAE,eAAgC;QAC5F,IAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,aAAa,CAAC,CAAC;QACpE,IAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CACnD,sBAAsB,EAAE,EACxB,oBAAoB,EAAE,EACtB,GAAG,CAAC,UAAC,EAA+B,IAAK,OAAA,EAAE,CAAC,IAAI,EAAP,CAAO,CAAC,EACjD,oBAAoB,CAAC,qBAAqB,EAAE,CAAC,CAC9C,CAAC;QAEF,OAAO,gBAAgB,CAAC,IAAI,CAC1B,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,CAAC,CAC9E,CAAC;IACJ,CAAC;IAvDU,aAAa;QAPzB,SAAS,CAAC;YACT,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE,EAAE;SACb,CAAC;QACF;;WAEG;;QAQE,mBAAA,MAAM,CAAC,IAAI,CAAC,CAAA;iDAAc,IAAI;OAPtB,aAAa,CAyDzB;IAAD,oBAAC;CAAA,AAzDD,IAyDC;SAzDY,aAAa"} \ No newline at end of file diff --git a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.js b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.js new file mode 100644 index 0000000000..91ce6bc391 --- /dev/null +++ b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.js @@ -0,0 +1,33 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { ItemViewMode } from '../../../shared/items/item-type-decorator'; +var MetadataRepresentationListComponent = /** @class */ (function () { + function MetadataRepresentationListComponent() { + /** + * The view-mode we're currently on + * @type {ElementViewMode} + */ + this.viewMode = ItemViewMode.Metadata; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], MetadataRepresentationListComponent.prototype, "representations", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], MetadataRepresentationListComponent.prototype, "label", void 0); + MetadataRepresentationListComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-metadata-representation-list', + templateUrl: './metadata-representation-list.component.html' + }) + /** + * This component is used for displaying metadata + * It expects a list of MetadataRepresentation objects and a label to put on top of the list + */ + ], MetadataRepresentationListComponent); + return MetadataRepresentationListComponent; +}()); +export { MetadataRepresentationListComponent }; +//# sourceMappingURL=metadata-representation-list.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.js.map b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.js.map new file mode 100644 index 0000000000..d09bca3bb1 --- /dev/null +++ b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata-representation-list.component.js","sourceRoot":"","sources":["metadata-representation-list.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAUzE;IARA;QAmBE;;;WAGG;QACH,aAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC;IACnC,CAAC;IAZU;QAAR,KAAK,EAAE;;gFAA2C;IAK1C;QAAR,KAAK,EAAE;;sEAAe;IATZ,mCAAmC;QAR/C,SAAS,CAAC;YACT,QAAQ,EAAE,iCAAiC;YAC3C,WAAW,EAAE,+CAA+C;SAC7D,CAAC;QACF;;;WAGG;OACU,mCAAmC,CAgB/C;IAAD,0CAAC;CAAA,AAhBD,IAgBC;SAhBY,mCAAmC"} \ No newline at end of file diff --git a/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.js b/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.js new file mode 100644 index 0000000000..4ac1ddc54a --- /dev/null +++ b/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.js @@ -0,0 +1,65 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../../core/shared/item.model'; +import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service'; +import { isNotEmpty } from '../../../../shared/empty.util'; +import { of } from 'rxjs/internal/observable/of'; +var RelatedEntitiesSearchComponent = /** @class */ (function () { + function RelatedEntitiesSearchComponent(fixedFilterService) { + this.fixedFilterService = fixedFilterService; + /** + * Whether or not the search bar and title should be displayed (defaults to true) + * @type {boolean} + */ + this.searchEnabled = true; + /** + * The ratio of the sidebar's width compared to the search results (1-12) (defaults to 4) + * @type {number} + */ + this.sideBarWidth = 4; + } + RelatedEntitiesSearchComponent.prototype.ngOnInit = function () { + if (isNotEmpty(this.relationType) && isNotEmpty(this.item)) { + this.fixedFilter = this.fixedFilterService.getFilterByRelation(this.relationType, this.item.id); + } + if (isNotEmpty(this.relationEntityType)) { + this.fixedFilter$ = of(this.relationEntityType); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], RelatedEntitiesSearchComponent.prototype, "relationType", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], RelatedEntitiesSearchComponent.prototype, "item", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], RelatedEntitiesSearchComponent.prototype, "relationEntityType", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], RelatedEntitiesSearchComponent.prototype, "searchEnabled", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], RelatedEntitiesSearchComponent.prototype, "sideBarWidth", void 0); + RelatedEntitiesSearchComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-related-entities-search', + templateUrl: './related-entities-search.component.html' + }) + /** + * A component to show related items as search results. + * Related items can be facetted, or queried using an + * optional search box. + */ + , + tslib_1.__metadata("design:paramtypes", [SearchFixedFilterService]) + ], RelatedEntitiesSearchComponent); + return RelatedEntitiesSearchComponent; +}()); +export { RelatedEntitiesSearchComponent }; +//# sourceMappingURL=related-entities-search.component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.js.map b/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.js.map new file mode 100644 index 0000000000..f09324c7e3 --- /dev/null +++ b/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"related-entities-search.component.js","sourceRoot":"","sources":["related-entities-search.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mFAAmF,CAAC;AAC7H,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AAWjD;IAmCE,wCAAoB,kBAA4C;QAA5C,uBAAkB,GAAlB,kBAAkB,CAA0B;QAfhE;;;WAGG;QACM,kBAAa,GAAG,IAAI,CAAC;QAE9B;;;WAGG;QACM,iBAAY,GAAG,CAAC,CAAC;IAM1B,CAAC;IAED,iDAAQ,GAAR;QACE,IAAI,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAC1D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACjG;QACD,IAAI,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE;YACvC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;SACjD;IACH,CAAC;IAvCQ;QAAR,KAAK,EAAE;;wEAAsB;IAKrB;QAAR,KAAK,EAAE;0CAAO,IAAI;gEAAC;IAOX;QAAR,KAAK,EAAE;;8EAA4B;IAM3B;QAAR,KAAK,EAAE;;yEAAsB;IAMrB;QAAR,KAAK,EAAE;;wEAAkB;IA9Bf,8BAA8B;QAT1C,SAAS,CAAC;YACT,QAAQ,EAAE,4BAA4B;YACtC,WAAW,EAAE,0CAA0C;SACxD,CAAC;QACF;;;;WAIG;;iDAoCuC,wBAAwB;OAnCrD,8BAA8B,CA+C1C;IAAD,qCAAC;CAAA,AA/CD,IA+CC;SA/CY,8BAA8B"} \ No newline at end of file diff --git a/src/app/+item-page/simple/related-items/related-items-component.js b/src/app/+item-page/simple/related-items/related-items-component.js new file mode 100644 index 0000000000..291213a01a --- /dev/null +++ b/src/app/+item-page/simple/related-items/related-items-component.js @@ -0,0 +1,34 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { ItemViewMode } from '../../../shared/items/item-type-decorator'; +var RelatedItemsComponent = /** @class */ (function () { + function RelatedItemsComponent() { + /** + * The view-mode we're currently on + * @type {ElementViewMode} + */ + this.viewMode = ItemViewMode.Element; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], RelatedItemsComponent.prototype, "items", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], RelatedItemsComponent.prototype, "label", void 0); + RelatedItemsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-related-items', + styleUrls: ['./related-items.component.scss'], + templateUrl: './related-items.component.html' + }) + /** + * This component is used for displaying relations between items + * It expects a list of items to display and a label to put on top + */ + ], RelatedItemsComponent); + return RelatedItemsComponent; +}()); +export { RelatedItemsComponent }; +//# sourceMappingURL=related-items-component.js.map \ No newline at end of file diff --git a/src/app/+item-page/simple/related-items/related-items-component.js.map b/src/app/+item-page/simple/related-items/related-items-component.js.map new file mode 100644 index 0000000000..38a3f95374 --- /dev/null +++ b/src/app/+item-page/simple/related-items/related-items-component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"related-items-component.js","sourceRoot":"","sources":["related-items-component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAWzE;IATA;QAoBE;;;WAGG;QACH,aAAQ,GAAG,YAAY,CAAC,OAAO,CAAC;IAClC,CAAC;IAZU;QAAR,KAAK,EAAE;;wDAAe;IAKd;QAAR,KAAK,EAAE;;wDAAe;IATZ,qBAAqB;QATjC,SAAS,CAAC;YACT,QAAQ,EAAE,kBAAkB;YAC5B,SAAS,EAAE,CAAC,gCAAgC,CAAC;YAC7C,WAAW,EAAE,gCAAgC;SAC9C,CAAC;QACF;;;WAGG;OACU,qBAAqB,CAgBjC;IAAD,4BAAC;CAAA,AAhBD,IAgBC;SAhBY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+login-page/login-page-routing.module.js b/src/app/+login-page/login-page-routing.module.js new file mode 100644 index 0000000000..5f1a44d159 --- /dev/null +++ b/src/app/+login-page/login-page-routing.module.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { LoginPageComponent } from './login-page.component'; +var LoginPageRoutingModule = /** @class */ (function () { + function LoginPageRoutingModule() { + } + LoginPageRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', pathMatch: 'full', component: LoginPageComponent, data: { title: 'login.title' } } + ]) + ] + }) + ], LoginPageRoutingModule); + return LoginPageRoutingModule; +}()); +export { LoginPageRoutingModule }; +//# sourceMappingURL=login-page-routing.module.js.map \ No newline at end of file diff --git a/src/app/+login-page/login-page-routing.module.js.map b/src/app/+login-page/login-page-routing.module.js.map new file mode 100644 index 0000000000..adbe2f99c6 --- /dev/null +++ b/src/app/+login-page/login-page-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"login-page-routing.module.js","sourceRoot":"","sources":["login-page-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAS5D;IAAA;IAAsC,CAAC;IAA1B,sBAAsB;QAPlC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAG,SAAS,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE;iBAChG,CAAC;aACH;SACF,CAAC;OACW,sBAAsB,CAAI;IAAD,6BAAC;CAAA,AAAvC,IAAuC;SAA1B,sBAAsB"} \ No newline at end of file diff --git a/src/app/+login-page/login-page.component.js b/src/app/+login-page/login-page.component.js new file mode 100644 index 0000000000..e8575bf49a --- /dev/null +++ b/src/app/+login-page/login-page.component.js @@ -0,0 +1,78 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { combineLatest as observableCombineLatest } from 'rxjs'; +import { filter, take } from 'rxjs/operators'; +import { Store } from '@ngrx/store'; +import { AddAuthenticationMessageAction, AuthenticatedAction, AuthenticationSuccessAction, ResetAuthenticationMessagesAction } from '../core/auth/auth.actions'; +import { hasValue, isNotEmpty } from '../shared/empty.util'; +import { AuthTokenInfo } from '../core/auth/models/auth-token-info.model'; +import { isAuthenticated } from '../core/auth/selectors'; +/** + * This component represents the login page + */ +var LoginPageComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {ActivatedRoute} route + * @param {Store} store + */ + function LoginPageComponent(route, store) { + this.route = route; + this.store = store; + } + /** + * Initialize instance variables + */ + LoginPageComponent.prototype.ngOnInit = function () { + var _this = this; + var queryParamsObs = this.route.queryParams; + var authenticated = this.store.select(isAuthenticated); + this.sub = observableCombineLatest(queryParamsObs, authenticated).pipe(filter(function (_a) { + var params = _a[0], auth = _a[1]; + return isNotEmpty(params.token) || isNotEmpty(params.expired); + }), take(1)).subscribe(function (_a) { + var params = _a[0], auth = _a[1]; + var token = params.token; + var authToken; + if (!auth) { + if (isNotEmpty(token)) { + authToken = new AuthTokenInfo(token); + _this.store.dispatch(new AuthenticatedAction(authToken)); + } + else if (isNotEmpty(params.expired)) { + _this.store.dispatch(new AddAuthenticationMessageAction('auth.messages.expired')); + } + } + else { + if (isNotEmpty(token)) { + authToken = new AuthTokenInfo(token); + _this.store.dispatch(new AuthenticationSuccessAction(authToken)); + } + } + }); + }; + /** + * Unsubscribe from subscription + */ + LoginPageComponent.prototype.ngOnDestroy = function () { + if (hasValue(this.sub)) { + this.sub.unsubscribe(); + } + // Clear all authentication messages when leaving login page + this.store.dispatch(new ResetAuthenticationMessagesAction()); + }; + LoginPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-login-page', + styleUrls: ['./login-page.component.scss'], + templateUrl: './login-page.component.html' + }), + tslib_1.__metadata("design:paramtypes", [ActivatedRoute, + Store]) + ], LoginPageComponent); + return LoginPageComponent; +}()); +export { LoginPageComponent }; +//# sourceMappingURL=login-page.component.js.map \ No newline at end of file diff --git a/src/app/+login-page/login-page.component.js.map b/src/app/+login-page/login-page.component.js.map new file mode 100644 index 0000000000..011a82cb4d --- /dev/null +++ b/src/app/+login-page/login-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"login-page.component.js","sourceRoot":"","sources":["login-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAgB,MAAM,MAAM,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,EACnB,2BAA2B,EAC3B,iCAAiC,EAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;GAEG;AAMH;IAQE;;;;;OAKG;IACH,4BAAoB,KAAqB,EACrB,KAAsB;QADtB,UAAK,GAAL,KAAK,CAAgB;QACrB,UAAK,GAAL,KAAK,CAAiB;IAAG,CAAC;IAE9C;;OAEG;IACH,qCAAQ,GAAR;QAAA,iBAuBC;QAtBC,IAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QAC9C,IAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACzD,IAAI,CAAC,GAAG,GAAG,uBAAuB,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC,IAAI,CACpE,MAAM,CAAC,UAAC,EAAc;gBAAb,cAAM,EAAE,YAAI;YAAM,OAAA,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,OAAO,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AkB,CAuD9B;IAAD,yBAAC;CAAA,AAvDD,IAuDC;SAvDY,kBAAkB"} \ No newline at end of file diff --git a/src/app/+login-page/login-page.module.js b/src/app/+login-page/login-page.module.js new file mode 100644 index 0000000000..ddbe2e7613 --- /dev/null +++ b/src/app/+login-page/login-page.module.js @@ -0,0 +1,25 @@ +import * as tslib_1 from "tslib"; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { SharedModule } from '../shared/shared.module'; +import { LoginPageComponent } from './login-page.component'; +import { LoginPageRoutingModule } from './login-page-routing.module'; +var LoginPageModule = /** @class */ (function () { + function LoginPageModule() { + } + LoginPageModule = tslib_1.__decorate([ + NgModule({ + imports: [ + LoginPageRoutingModule, + CommonModule, + SharedModule, + ], + declarations: [ + LoginPageComponent + ] + }) + ], LoginPageModule); + return LoginPageModule; +}()); +export { LoginPageModule }; +//# sourceMappingURL=login-page.module.js.map \ No newline at end of file diff --git a/src/app/+login-page/login-page.module.js.map b/src/app/+login-page/login-page.module.js.map new file mode 100644 index 0000000000..ace808e89e --- /dev/null +++ b/src/app/+login-page/login-page.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"login-page.module.js","sourceRoot":"","sources":["login-page.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAYrE;IAAA;IAEA,CAAC;IAFY,eAAe;QAV3B,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,sBAAsB;gBACtB,YAAY;gBACZ,YAAY;aACb;YACD,YAAY,EAAE;gBACZ,kBAAkB;aACnB;SACF,CAAC;OACW,eAAe,CAE3B;IAAD,sBAAC;CAAA,AAFD,IAEC;SAFY,eAAe"} \ No newline at end of file diff --git a/src/app/+logout-page/logout-page-routing.module.js b/src/app/+logout-page/logout-page-routing.module.js new file mode 100644 index 0000000000..781089bb22 --- /dev/null +++ b/src/app/+logout-page/logout-page-routing.module.js @@ -0,0 +1,26 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { LogoutPageComponent } from './logout-page.component'; +import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; +var LogoutPageRoutingModule = /** @class */ (function () { + function LogoutPageRoutingModule() { + } + LogoutPageRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { + canActivate: [AuthenticatedGuard], + path: '', + component: LogoutPageComponent, + data: { title: 'logout.title' } + } + ]) + ] + }) + ], LogoutPageRoutingModule); + return LogoutPageRoutingModule; +}()); +export { LogoutPageRoutingModule }; +//# sourceMappingURL=logout-page-routing.module.js.map \ No newline at end of file diff --git a/src/app/+logout-page/logout-page-routing.module.js.map b/src/app/+logout-page/logout-page-routing.module.js.map new file mode 100644 index 0000000000..18127e387f --- /dev/null +++ b/src/app/+logout-page/logout-page-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"logout-page-routing.module.js","sourceRoot":"","sources":["logout-page-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AActE;IAAA;IAAuC,CAAC;IAA3B,uBAAuB;QAZnC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB;wBACE,WAAW,EAAE,CAAC,kBAAkB,CAAC;wBACjC,IAAI,EAAE,EAAE;wBACR,SAAS,EAAE,mBAAmB;wBAC9B,IAAI,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE;qBAChC;iBACF,CAAC;aACH;SACF,CAAC;OACW,uBAAuB,CAAI;IAAD,8BAAC;CAAA,AAAxC,IAAwC;SAA3B,uBAAuB"} \ No newline at end of file diff --git a/src/app/+logout-page/logout-page.component.js b/src/app/+logout-page/logout-page.component.js new file mode 100644 index 0000000000..472ad78915 --- /dev/null +++ b/src/app/+logout-page/logout-page.component.js @@ -0,0 +1,16 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +var LogoutPageComponent = /** @class */ (function () { + function LogoutPageComponent() { + } + LogoutPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-logout-page', + styleUrls: ['./logout-page.component.scss'], + templateUrl: './logout-page.component.html' + }) + ], LogoutPageComponent); + return LogoutPageComponent; +}()); +export { LogoutPageComponent }; +//# sourceMappingURL=logout-page.component.js.map \ No newline at end of file diff --git a/src/app/+logout-page/logout-page.component.js.map b/src/app/+logout-page/logout-page.component.js.map new file mode 100644 index 0000000000..8c633c70b3 --- /dev/null +++ b/src/app/+logout-page/logout-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"logout-page.component.js","sourceRoot":"","sources":["logout-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAO1C;IAAA;IAEA,CAAC;IAFY,mBAAmB;QAL/B,SAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,CAAC,8BAA8B,CAAC;YAC3C,WAAW,EAAE,8BAA8B;SAC5C,CAAC;OACW,mBAAmB,CAE/B;IAAD,0BAAC;CAAA,AAFD,IAEC;SAFY,mBAAmB"} \ No newline at end of file diff --git a/src/app/+logout-page/logout-page.module.js b/src/app/+logout-page/logout-page.module.js new file mode 100644 index 0000000000..cfe66270c9 --- /dev/null +++ b/src/app/+logout-page/logout-page.module.js @@ -0,0 +1,25 @@ +import * as tslib_1 from "tslib"; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { SharedModule } from '../shared/shared.module'; +import { LogoutPageComponent } from './logout-page.component'; +import { LogoutPageRoutingModule } from './logout-page-routing.module'; +var LogoutPageModule = /** @class */ (function () { + function LogoutPageModule() { + } + LogoutPageModule = tslib_1.__decorate([ + NgModule({ + imports: [ + LogoutPageRoutingModule, + CommonModule, + SharedModule, + ], + declarations: [ + LogoutPageComponent + ] + }) + ], LogoutPageModule); + return LogoutPageModule; +}()); +export { LogoutPageModule }; +//# sourceMappingURL=logout-page.module.js.map \ No newline at end of file diff --git a/src/app/+logout-page/logout-page.module.js.map b/src/app/+logout-page/logout-page.module.js.map new file mode 100644 index 0000000000..b3f715b52a --- /dev/null +++ b/src/app/+logout-page/logout-page.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"logout-page.module.js","sourceRoot":"","sources":["logout-page.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAYvE;IAAA;IAEA,CAAC;IAFY,gBAAgB;QAV5B,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,uBAAuB;gBACvB,YAAY;gBACZ,YAAY;aACb;YACD,YAAY,EAAE;gBACZ,mBAAmB;aACpB;SACF,CAAC;OACW,gBAAgB,CAE5B;IAAD,uBAAC;CAAA,AAFD,IAEC;SAFY,gBAAgB"} \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-configuration-value-type.js b/src/app/+my-dspace-page/my-dspace-configuration-value-type.js new file mode 100644 index 0000000000..b376f30f32 --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-configuration-value-type.js @@ -0,0 +1,6 @@ +export var MyDSpaceConfigurationValueType; +(function (MyDSpaceConfigurationValueType) { + MyDSpaceConfigurationValueType["Workspace"] = "workspace"; + MyDSpaceConfigurationValueType["Workflow"] = "workflow"; +})(MyDSpaceConfigurationValueType || (MyDSpaceConfigurationValueType = {})); +//# sourceMappingURL=my-dspace-configuration-value-type.js.map \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-configuration-value-type.js.map b/src/app/+my-dspace-page/my-dspace-configuration-value-type.js.map new file mode 100644 index 0000000000..b9a6659d3d --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-configuration-value-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace-configuration-value-type.js","sourceRoot":"","sources":["my-dspace-configuration-value-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,8BAGX;AAHD,WAAY,8BAA8B;IACxC,yDAAuB,CAAA;IACvB,uDAAqB,CAAA;AACvB,CAAC,EAHW,8BAA8B,KAA9B,8BAA8B,QAGzC"} \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-configuration.service.js b/src/app/+my-dspace-page/my-dspace-configuration.service.js new file mode 100644 index 0000000000..05cb9192fd --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-configuration.service.js @@ -0,0 +1,110 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { combineLatest } from 'rxjs'; +import { first, map } from 'rxjs/operators'; +import { MyDSpaceConfigurationValueType } from './my-dspace-configuration-value-type'; +import { RoleService } from '../core/roles/role.service'; +import { SearchConfigurationService } from '../+search-page/search-service/search-configuration.service'; +import { RouteService } from '../shared/services/route.service'; +import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model'; +import { SortDirection, SortOptions } from '../core/cache/models/sort-options.model'; +import { SearchFixedFilterService } from '../+search-page/search-filters/search-filter/search-fixed-filter.service'; +/** + * Service that performs all actions that have to do with the current mydspace configuration + */ +var MyDSpaceConfigurationService = /** @class */ (function (_super) { + tslib_1.__extends(MyDSpaceConfigurationService, _super); + /** + * Initialize class + * + * @param {roleService} roleService + * @param {SearchFixedFilterService} fixedFilterService + * @param {RouteService} routeService + * @param {ActivatedRoute} route + */ + function MyDSpaceConfigurationService(roleService, fixedFilterService, routeService, route) { + var _this = _super.call(this, routeService, fixedFilterService, route) || this; + _this.roleService = roleService; + _this.fixedFilterService = fixedFilterService; + _this.routeService = routeService; + _this.route = route; + /** + * Default pagination settings + */ + _this.defaultPagination = Object.assign(new PaginationComponentOptions(), { + id: 'mydspace-page', + pageSize: 10, + currentPage: 1 + }); + /** + * Default sort settings + */ + _this.defaultSort = new SortOptions('dc.date.issued', SortDirection.DESC); + /** + * Default configuration parameter setting + */ + _this.defaultConfiguration = 'workspace'; + /** + * Default scope setting + */ + _this.defaultScope = ''; + /** + * Default query setting + */ + _this.defaultQuery = ''; + // override parent class initialization + _this._defaults = null; + _this.initDefaults(); + _this.isSubmitter$ = _this.roleService.isSubmitter(); + _this.isController$ = _this.roleService.isController(); + _this.isAdmin$ = _this.roleService.isAdmin(); + return _this; + } + /** + * Returns the list of available configuration depend on the user role + * + * @return {Observable} + * Emits the available configuration list + */ + MyDSpaceConfigurationService.prototype.getAvailableConfigurationTypes = function () { + return combineLatest(this.isSubmitter$, this.isController$, this.isAdmin$).pipe(first(), map(function (_a) { + var isSubmitter = _a[0], isController = _a[1], isAdmin = _a[2]; + var availableConf = []; + if (isSubmitter) { + availableConf.push(MyDSpaceConfigurationValueType.Workspace); + } + if (isController || isAdmin) { + availableConf.push(MyDSpaceConfigurationValueType.Workflow); + } + return availableConf; + })); + }; + /** + * Returns the select options for the available configuration list + * + * @return {Observable} + * Emits the select options list + */ + MyDSpaceConfigurationService.prototype.getAvailableConfigurationOptions = function () { + return this.getAvailableConfigurationTypes().pipe(first(), map(function (availableConfigurationTypes) { + var configurationOptions = []; + availableConfigurationTypes.forEach(function (type) { + var value = type; + var label = "mydspace.show." + value; + configurationOptions.push({ value: value, label: label }); + }); + return configurationOptions; + })); + }; + MyDSpaceConfigurationService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RoleService, + SearchFixedFilterService, + RouteService, + ActivatedRoute]) + ], MyDSpaceConfigurationService); + return MyDSpaceConfigurationService; +}(SearchConfigurationService)); +export { MyDSpaceConfigurationService }; +//# sourceMappingURL=my-dspace-configuration.service.js.map \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-configuration.service.js.map b/src/app/+my-dspace-page/my-dspace-configuration.service.js.map new file mode 100644 index 0000000000..77d772a3c0 --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-configuration.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace-configuration.service.js","sourceRoot":"","sources":["my-dspace-configuration.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAc,MAAM,MAAM,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,6DAA6D,CAAC;AACzG,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yDAAyD,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0EAA0E,CAAC;AAEpH;;GAEG;AAEH;IAAkD,wDAA0B;IAkC1E;;;;;;;OAOG;IACH,sCAAsB,WAAwB,EACxB,kBAA4C,EAC5C,YAA0B,EAC1B,KAAqB;QA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ACf,aAAa,CAAC,IAAI,CAAC,8BAA8B,CAAC,SAAS,CAAC,CAAC;aAC9D;YACD,IAAI,YAAY,IAAI,OAAO,EAAE;gBAC3B,aAAa,CAAC,IAAI,CAAC,8BAA8B,CAAC,QAAQ,CAAC,CAAC;aAC7D;YACD,OAAO,aAAa,CAAC;QACvB,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAED;;;;;OAKG;IACI,uEAAgC,GAAvC;QACE,OAAO,IAAI,CAAC,8BAA8B,EAAE,CAAC,IAAI,CAC/C,KAAK,EAAE,EACP,GAAG,CAAC,UAAC,2BAA6D;YAChE,IAAM,oBAAoB,GAAgC,EAAE,CAAC;YAC7D,2BAA2B,CAAC,OAAO,CAAC,UAAC,IAAI;gBACvC,IAAM,KAAK,GAAG,IAAI,CAAC;gBACnB,IAAM,KAAK,GAAG,mBAAiB,KAAO,CAAC;gBACvC,oBAAoB,CAAC,IAAI,CAAC,EAAE,KAAK,OAAA,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;YACH,OAAO,oBAAoB,CAAC;QAC9B,CAAC,CAAC,CACH,CAAA;IACH,CAAC;IAlGU,4BAA4B;QADxC,UAAU,EAAE;iDA2CwB,WAAW;YACJ,wBAAwB;YAC9B,YAAY;YACnB,cAAc;OA7ChC,4BAA4B,CAoGxC;IAAD,mCAAC;CAAA,AApGD,CAAkD,0BAA0B,GAoG3E;SApGY,4BAA4B"} \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.js b/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.js new file mode 100644 index 0000000000..a9e7c20e2f --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.js @@ -0,0 +1,110 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, EventEmitter, Output } from '@angular/core'; +import { first } from 'rxjs/operators'; +import { Store } from '@ngrx/store'; +import { TranslateService } from '@ngx-translate/core'; +import { AuthService } from '../../core/auth/auth.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { NotificationOptions } from '../../shared/notifications/models/notification-options.model'; +import { HALEndpointService } from '../../core/shared/hal-endpoint.service'; +import { NotificationType } from '../../shared/notifications/models/notification-type'; +import { hasValue } from '../../shared/empty.util'; +/** + * This component represents the whole mydspace page header + */ +var MyDSpaceNewSubmissionComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {AuthService} authService + * @param {ChangeDetectorRef} changeDetectorRef + * @param {HALEndpointService} halService + * @param {NotificationsService} notificationsService + * @param {Store} store + * @param {TranslateService} translate + */ + function MyDSpaceNewSubmissionComponent(authService, changeDetectorRef, halService, notificationsService, store, translate) { + this.authService = authService; + this.changeDetectorRef = changeDetectorRef; + this.halService = halService; + this.notificationsService = notificationsService; + this.store = store; + this.translate = translate; + this.uploadEnd = new EventEmitter(); + /** + * The UploaderOptions object + */ + this.uploadFilesOptions = { + url: '', + authToken: null, + disableMultipart: false, + itemAlias: null + }; + } + /** + * Initialize url and Bearer token + */ + MyDSpaceNewSubmissionComponent.prototype.ngOnInit = function () { + var _this = this; + this.sub = this.halService.getEndpoint('workspaceitems').pipe(first()).subscribe(function (url) { + _this.uploadFilesOptions.url = url; + _this.uploadFilesOptions.authToken = _this.authService.buildAuthHeader(); + _this.changeDetectorRef.detectChanges(); + }); + }; + /** + * Method called when file upload is completed to notify upload status + */ + MyDSpaceNewSubmissionComponent.prototype.onCompleteItem = function (res) { + if (res && res._embedded && res._embedded.workspaceitems && res._embedded.workspaceitems.length > 0) { + var workspaceitems = res._embedded.workspaceitems; + this.uploadEnd.emit(workspaceitems); + if (workspaceitems.length === 1) { + var options = new NotificationOptions(); + options.timeOut = 0; + var link = '/workspaceitems/' + workspaceitems[0].id + '/edit'; + this.notificationsService.notificationWithAnchor(NotificationType.Success, options, link, 'mydspace.general.text-here', 'mydspace.upload.upload-successful', 'here'); + } + else if (workspaceitems.length > 1) { + this.notificationsService.success(null, this.translate.get('mydspace.upload.upload-multiple-successful', { qty: workspaceitems.length })); + } + } + else { + this.notificationsService.error(null, this.translate.get('mydspace.upload.upload-failed')); + } + }; + /** + * Method called on file upload error + */ + MyDSpaceNewSubmissionComponent.prototype.onUploadError = function () { + this.notificationsService.error(null, this.translate.get('mydspace.upload.upload-failed')); + }; + /** + * Unsubscribe from the subscription + */ + MyDSpaceNewSubmissionComponent.prototype.ngOnDestroy = function () { + if (hasValue(this.sub)) { + this.sub.unsubscribe(); + } + }; + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], MyDSpaceNewSubmissionComponent.prototype, "uploadEnd", void 0); + MyDSpaceNewSubmissionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-my-dspace-new-submission', + styleUrls: ['./my-dspace-new-submission.component.scss'], + templateUrl: './my-dspace-new-submission.component.html' + }), + tslib_1.__metadata("design:paramtypes", [AuthService, + ChangeDetectorRef, + HALEndpointService, + NotificationsService, + Store, + TranslateService]) + ], MyDSpaceNewSubmissionComponent); + return MyDSpaceNewSubmissionComponent; +}()); +export { MyDSpaceNewSubmissionComponent }; +//# sourceMappingURL=my-dspace-new-submission.component.js.map \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.js.map b/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.js.map new file mode 100644 index 0000000000..2f9653bc44 --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace-new-submission.component.js","sourceRoot":"","sources":["my-dspace-new-submission.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAqB,MAAM,EAAE,MAAM,eAAe,CAAC;AAGtG,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,C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CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED;;OAEG;IACH,oDAAW,GAAX;QACE,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;SACxB;IACH,CAAC;IAzFS;QAAT,MAAM,EAAE;;qEAAqE;IADnE,8BAA8B;QAL1C,SAAS,CAAC;YACT,QAAQ,EAAE,6BAA6B;YACvC,SAAS,EAAE,CAAC,2CAA2C,CAAC;YACxD,WAAW,EAAE,2CAA2C;SACzD,CAAC;iDA6BiC,WAAW;YACL,iBAAiB;YACxB,kBAAkB;YACR,oBAAoB;YACnC,KAAK;YACD,gBAAgB;OAjCpC,8BAA8B,CA2F1C;IAAD,qCAAC;CAAA,AA3FD,IA2FC;SA3FY,8BAA8B"} \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-page-routing.module.js b/src/app/+my-dspace-page/my-dspace-page-routing.module.js new file mode 100644 index 0000000000..b99e2dd359 --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-page-routing.module.js @@ -0,0 +1,34 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { MyDSpacePageComponent } from './my-dspace-page.component'; +import { MyDSpaceGuard } from './my-dspace.guard'; +var MyDspacePageRoutingModule = /** @class */ (function () { + /** + * This module defines the default component to load when navigating to the mydspace page path. + */ + function MyDspacePageRoutingModule() { + } + MyDspacePageRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { + path: '', + component: MyDSpacePageComponent, + data: { title: 'mydspace.title' }, + canActivate: [ + MyDSpaceGuard + ] + } + ]) + ] + }) + /** + * This module defines the default component to load when navigating to the mydspace page path. + */ + ], MyDspacePageRoutingModule); + return MyDspacePageRoutingModule; +}()); +export { MyDspacePageRoutingModule }; +//# sourceMappingURL=my-dspace-page-routing.module.js.map \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-page-routing.module.js.map b/src/app/+my-dspace-page/my-dspace-page-routing.module.js.map new file mode 100644 index 0000000000..7cb2103924 --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-page-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace-page-routing.module.js","sourceRoot":"","sources":["my-dspace-page-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAmBlD;IAHA;;OAEG;IACH;IACA,CAAC;IADY,yBAAyB;QAjBrC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB;wBACE,IAAI,EAAE,EAAE;wBACR,SAAS,EAAE,qBAAqB;wBAChC,IAAI,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE;wBACjC,WAAW,EAAE;4BACX,aAAa;yBACd;qBACF;iBACF,CAAC;aACH;SACF,CAAC;QACF;;WAEG;OACU,yBAAyB,CACrC;IAAD,gCAAC;CAAA,AADD,IACC;SADY,yBAAyB"} \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-page.component.js b/src/app/+my-dspace-page/my-dspace-page.component.js new file mode 100644 index 0000000000..cdd72e6d47 --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-page.component.js @@ -0,0 +1,125 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, Component, Inject, InjectionToken, Input } from '@angular/core'; +import { BehaviorSubject } from 'rxjs'; +import { switchMap, tap, } from 'rxjs/operators'; +import { pushInOut } from '../shared/animations/push'; +import { HostWindowService } from '../shared/host-window.service'; +import { SearchService } from '../+search-page/search-service/search.service'; +import { SearchSidebarService } from '../+search-page/search-sidebar/search-sidebar.service'; +import { hasValue } from '../shared/empty.util'; +import { getSucceededRemoteData } from '../core/shared/operators'; +import { MyDSpaceResponseParsingService } from '../core/data/mydspace-response-parsing.service'; +import { RoleType } from '../core/roles/role-types'; +import { MyDSpaceConfigurationService } from './my-dspace-configuration.service'; +import { ViewMode } from '../core/shared/view-mode.model'; +import { MyDSpaceRequest } from '../core/data/request.models'; +export var MYDSPACE_ROUTE = '/mydspace'; +export var SEARCH_CONFIG_SERVICE = new InjectionToken('searchConfigurationService'); +/** + * This component represents the whole mydspace page + */ +var MyDSpacePageComponent = /** @class */ (function () { + function MyDSpacePageComponent(service, sidebarService, windowService, searchConfigService) { + this.service = service; + this.sidebarService = sidebarService; + this.windowService = windowService; + this.searchConfigService = searchConfigService; + /** + * True when the search component should show results on the current page + */ + this.inPlaceSearch = true; + /** + * The current search results + */ + this.resultsRD$ = new BehaviorSubject(null); + /** + * Variable for enumeration RoleType + */ + this.roleTypeEnum = RoleType; + /** + * List of available view mode + */ + this.viewModeList = [ViewMode.List, ViewMode.Detail]; + this.isXsOrSm$ = this.windowService.isXsOrSm(); + this.service.setServiceOptions(MyDSpaceResponseParsingService, MyDSpaceRequest); + } + /** + * Initialize available configuration list + * + * Listening to changes in the paginated search options + * If something changes, update the search results + * + * Listen to changes in the scope + * If something changes, update the list of scopes for the dropdown + */ + MyDSpacePageComponent.prototype.ngOnInit = function () { + var _this = this; + this.configurationList$ = this.searchConfigService.getAvailableConfigurationOptions(); + this.searchOptions$ = this.searchConfigService.paginatedSearchOptions; + this.sub = this.searchOptions$.pipe(tap(function () { return _this.resultsRD$.next(null); }), switchMap(function (options) { return _this.service.search(options).pipe(getSucceededRemoteData()); })) + .subscribe(function (results) { + _this.resultsRD$.next(results); + }); + this.scopeListRD$ = this.searchConfigService.getCurrentScope('').pipe(switchMap(function (scopeId) { return _this.service.getScopes(scopeId); })); + }; + /** + * Set the sidebar to a collapsed state + */ + MyDSpacePageComponent.prototype.closeSidebar = function () { + this.sidebarService.collapse(); + }; + /** + * Set the sidebar to an expanded state + */ + MyDSpacePageComponent.prototype.openSidebar = function () { + this.sidebarService.expand(); + }; + /** + * Check if the sidebar is collapsed + * @returns {Observable} emits true if the sidebar is currently collapsed, false if it is expanded + */ + MyDSpacePageComponent.prototype.isSidebarCollapsed = function () { + return this.sidebarService.isCollapsed; + }; + /** + * @returns {string} The base path to the search page + */ + MyDSpacePageComponent.prototype.getSearchLink = function () { + return this.service.getSearchLink(); + }; + /** + * Unsubscribe from the subscription + */ + MyDSpacePageComponent.prototype.ngOnDestroy = function () { + if (hasValue(this.sub)) { + this.sub.unsubscribe(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], MyDSpacePageComponent.prototype, "inPlaceSearch", void 0); + MyDSpacePageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-my-dspace-page', + styleUrls: ['./my-dspace-page.component.scss'], + templateUrl: './my-dspace-page.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + animations: [pushInOut], + providers: [ + { + provide: SEARCH_CONFIG_SERVICE, + useClass: MyDSpaceConfigurationService + } + ] + }), + tslib_1.__param(3, Inject(SEARCH_CONFIG_SERVICE)), + tslib_1.__metadata("design:paramtypes", [SearchService, + SearchSidebarService, + HostWindowService, + MyDSpaceConfigurationService]) + ], MyDSpacePageComponent); + return MyDSpacePageComponent; +}()); +export { MyDSpacePageComponent }; +//# sourceMappingURL=my-dspace-page.component.js.map \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-page.component.js.map b/src/app/+my-dspace-page/my-dspace-page.component.js.map new file mode 100644 index 0000000000..cb4c79b8d6 --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace-page.component.js","sourceRoot":"","sources":["my-dspace-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,uBAAuB,EAC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IAChC,CAAC;IAED;;OAEG;IACI,2CAAW,GAAlB;QACE,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,kDAAkB,GAAzB;QACE,OAAO,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,6CAAa,GAApB;QACE,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,2CAAW,GAAX;QACE,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;SACxB;IACH,CAAC;IA/GQ;QAAR,KAAK,EAAE;;gEAAsB;IALnB,qBAAqB;QAbjC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,SAAS,EAAE,CAAC,iCAAiC,CAAC;YAC9C,WAAW,EAAE,iCAAiC;YAC9C,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,UAAU,EAAE,CAAC,SAAS,CAAC;YACvB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,qBAAqB;oBAC9B,QAAQ,EAAE,4BAA4B;iBACvC;aACF;SACF,CAAC;QAmDa,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;iDAHb,aAAa;YACN,oBAAoB;YACrB,iBAAiB;YACmB,4BAA4B;OAlDxF,qBAAqB,CAqHjC;IAAD,4BAAC;CAAA,AArHD,IAqHC;SArHY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-page.module.js b/src/app/+my-dspace-page/my-dspace-page.module.js new file mode 100644 index 0000000000..8467c7193c --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-page.module.js @@ -0,0 +1,75 @@ +import * as tslib_1 from "tslib"; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { SharedModule } from '../shared/shared.module'; +import { MyDspacePageRoutingModule } from './my-dspace-page-routing.module'; +import { MyDSpacePageComponent } from './my-dspace-page.component'; +import { SearchPageModule } from '../+search-page/search-page.module'; +import { MyDSpaceResultsComponent } from './my-dspace-results/my-dspace-results.component'; +import { WorkspaceitemMyDSpaceResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component'; +import { ItemMyDSpaceResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/item-my-dspace-result/item-my-dspace-result-list-element.component'; +import { WorkflowitemMyDSpaceResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component'; +import { ClaimedMyDSpaceResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component'; +import { PoolMyDSpaceResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component'; +import { MyDSpaceNewSubmissionComponent } from './my-dspace-new-submission/my-dspace-new-submission.component'; +import { ItemMyDSpaceResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/item-my-dspace-result/item-my-dspace-result-detail-element.component'; +import { WorkspaceitemMyDSpaceResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component'; +import { WorkflowitemMyDSpaceResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component'; +import { ClaimedMyDSpaceResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component'; +import { PoolMyDSpaceResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-lement.component'; +import { MyDSpaceGuard } from './my-dspace.guard'; +import { MyDSpaceConfigurationService } from './my-dspace-configuration.service'; +var MyDSpacePageModule = /** @class */ (function () { + /** + * This module handles all components that are necessary for the mydspace page + */ + function MyDSpacePageModule() { + } + MyDSpacePageModule = tslib_1.__decorate([ + NgModule({ + imports: [ + CommonModule, + SharedModule, + MyDspacePageRoutingModule, + SearchPageModule + ], + declarations: [ + MyDSpacePageComponent, + MyDSpaceResultsComponent, + ItemMyDSpaceResultListElementComponent, + WorkspaceitemMyDSpaceResultListElementComponent, + WorkflowitemMyDSpaceResultListElementComponent, + ClaimedMyDSpaceResultListElementComponent, + PoolMyDSpaceResultListElementComponent, + ItemMyDSpaceResultDetailElementComponent, + WorkspaceitemMyDSpaceResultDetailElementComponent, + WorkflowitemMyDSpaceResultDetailElementComponent, + ClaimedMyDSpaceResultDetailElementComponent, + PoolMyDSpaceResultDetailElementComponent, + MyDSpaceNewSubmissionComponent + ], + providers: [ + MyDSpaceGuard, + MyDSpaceConfigurationService + ], + entryComponents: [ + ItemMyDSpaceResultListElementComponent, + WorkspaceitemMyDSpaceResultListElementComponent, + WorkflowitemMyDSpaceResultListElementComponent, + ClaimedMyDSpaceResultListElementComponent, + PoolMyDSpaceResultListElementComponent, + ItemMyDSpaceResultDetailElementComponent, + WorkspaceitemMyDSpaceResultDetailElementComponent, + WorkflowitemMyDSpaceResultDetailElementComponent, + ClaimedMyDSpaceResultDetailElementComponent, + PoolMyDSpaceResultDetailElementComponent + ] + }) + /** + * This module handles all components that are necessary for the mydspace page + */ + ], MyDSpacePageModule); + return MyDSpacePageModule; +}()); +export { MyDSpacePageModule }; +//# sourceMappingURL=my-dspace-page.module.js.map \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-page.module.js.map b/src/app/+my-dspace-page/my-dspace-page.module.js.map new file mode 100644 index 0000000000..ce351275b3 --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-page.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace-page.module.js","sourceRoot":"","sources":["my-dspace-page.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE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B,wBAAwB;gBACxB,sCAAsC;gBACtC,+CAA+C;gBAC/C,8CAA8C;gBAC9C,yCAAyC;gBACzC,sCAAsC;gBACtC,wCAAwC;gBACxC,iDAAiD;gBACjD,gDAAgD;gBAChD,2CAA2C;gBAC3C,wCAAwC;gBACxC,8BAA8B;aAC/B;YACD,SAAS,EAAE;gBACT,aAAa;gBACb,4BAA4B;aAC7B;YACD,eAAe,EAAE;gBACf,sCAAsC;gBACtC,+CAA+C;gBAC/C,8CAA8C;gBAC9C,yCAAyC;gBACzC,sCAAsC;gBACtC,wCAAwC;gBACxC,iDAAiD;gBACjD,gDAAgD;gBAChD,2CAA2C;gBAC3C,wCAAwC;aACzC;SACF,CAAC;QAEF;;WAEG;OACU,kBAAkB,CAE9B;IAAD,yBAAC;CAAA,AAFD,IAEC;SAFY,kBAAkB"} \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-result.model.js b/src/app/+my-dspace-page/my-dspace-result.model.js new file mode 100644 index 0000000000..ad78c4dda3 --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-result.model.js @@ -0,0 +1,10 @@ +/** + * Represents a search result object of a certain () DSpaceObject + */ +var MyDSpaceResult = /** @class */ (function () { + function MyDSpaceResult() { + } + return MyDSpaceResult; +}()); +export { MyDSpaceResult }; +//# sourceMappingURL=my-dspace-result.model.js.map \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-result.model.js.map b/src/app/+my-dspace-page/my-dspace-result.model.js.map new file mode 100644 index 0000000000..d0b3965ec7 --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-result.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace-result.model.js","sourceRoot":"","sources":["my-dspace-result.model.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAAA;IAWA,CAAC;IAAD,qBAAC;AAAD,CAAC,AAXD,IAWC"} \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.js b/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.js new file mode 100644 index 0000000000..25c023bcc2 --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.js @@ -0,0 +1,49 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { RemoteData } from '../../core/data/remote-data'; +import { fadeIn, fadeInOut } from '../../shared/animations/fade'; +import { SearchOptions } from '../../+search-page/search-options.model'; +import { ViewMode } from '../../core/shared/view-mode.model'; +import { isEmpty } from '../../shared/empty.util'; +/** + * Component that represents all results for mydspace page + */ +var MyDSpaceResultsComponent = /** @class */ (function () { + function MyDSpaceResultsComponent() { + /** + * A boolean representing if search results entry are separated by a line + */ + this.hasBorder = true; + } + /** + * Check if mydspace search results are loading + */ + MyDSpaceResultsComponent.prototype.isLoading = function () { + return !this.searchResults || isEmpty(this.searchResults) || this.searchResults.isLoading; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", RemoteData) + ], MyDSpaceResultsComponent.prototype, "searchResults", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SearchOptions) + ], MyDSpaceResultsComponent.prototype, "searchConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], MyDSpaceResultsComponent.prototype, "viewMode", void 0); + MyDSpaceResultsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-my-dspace-results', + templateUrl: './my-dspace-results.component.html', + animations: [ + fadeIn, + fadeInOut + ] + }) + ], MyDSpaceResultsComponent); + return MyDSpaceResultsComponent; +}()); +export { MyDSpaceResultsComponent }; +//# sourceMappingURL=my-dspace-results.component.js.map \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.js.map b/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.js.map new file mode 100644 index 0000000000..30f1ba499f --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace-results.component.js","sourceRoot":"","sources":["my-dspace-results.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD;;GAEG;AASH;IARA;QAyBE;;WAEG;QACH,cAAS,GAAG,IAAI,CAAC;IAQnB,CAAC;IANC;;OAEG;IACH,4CAAS,GAAT;QACE,OAAO,CAAC,IAAI,CAAC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC;IAC5F,CAAC;IAtBQ;QAAR,KAAK,EAAE;0CAAgB,UAAU;mEAA8C;IAKvE;QAAR,KAAK,EAAE;0CAAe,aAAa;kEAAC;IAK5B;QAAR,KAAK,EAAE;;8DAAoB;IAfjB,wBAAwB;QARpC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,WAAW,EAAE,oCAAoC;YACjD,UAAU,EAAE;gBACV,MAAM;gBACN,SAAS;aACV;SACF,CAAC;OACW,wBAAwB,CA4BpC;IAAD,+BAAC;CAAA,AA5BD,IA4BC;SA5BY,wBAAwB"} \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace.guard.js b/src/app/+my-dspace-page/my-dspace.guard.js new file mode 100644 index 0000000000..764b202b44 --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace.guard.js @@ -0,0 +1,58 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { Router } from '@angular/router'; +import { first, map } from 'rxjs/operators'; +import { isEmpty } from '../shared/empty.util'; +import { MYDSPACE_ROUTE } from './my-dspace-page.component'; +import { MyDSpaceConfigurationService } from './my-dspace-configuration.service'; +/** + * Prevent unauthorized activating and loading of mydspace configuration + * @class MyDSpaceGuard + */ +var MyDSpaceGuard = /** @class */ (function () { + /** + * @constructor + */ + function MyDSpaceGuard(configurationService, router) { + this.configurationService = configurationService; + this.router = router; + } + /** + * True when configuration is valid + * @method canActivate + */ + MyDSpaceGuard.prototype.canActivate = function (route, state) { + var _this = this; + return this.configurationService.getAvailableConfigurationTypes().pipe(first(), map(function (configurationList) { return _this.validateConfigurationParam(route.queryParamMap.get('configuration'), configurationList); })); + }; + /** + * Check if the given configuration is present in the list of those available + * + * @param configuration + * the configuration to validate + * @param configurationList + * the list of available configuration + * + */ + MyDSpaceGuard.prototype.validateConfigurationParam = function (configuration, configurationList) { + var configurationDefault = configurationList[0]; + if (isEmpty(configuration) || !configurationList.includes(configuration)) { + // If configuration param is empty or is not included in available configurations redirect to a default configuration value + var navigationExtras = { + queryParams: { configuration: configurationDefault } + }; + this.router.navigate([MYDSPACE_ROUTE], navigationExtras); + return false; + } + else { + return true; + } + }; + MyDSpaceGuard = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [MyDSpaceConfigurationService, Router]) + ], MyDSpaceGuard); + return MyDSpaceGuard; +}()); +export { MyDSpaceGuard }; +//# sourceMappingURL=my-dspace.guard.js.map \ No newline at end of file diff --git a/src/app/+my-dspace-page/my-dspace.guard.js.map b/src/app/+my-dspace-page/my-dspace.guard.js.map new file mode 100644 index 0000000000..4d5a62145c --- /dev/null +++ b/src/app/+my-dspace-page/my-dspace.guard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace.guard.js","sourceRoot":"","sources":["my-dspace.guard.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAyD,MAAM,EAAuB,MAAM,iBAAiB,CAAC;AAGrH,OAAO,EAAE,KAAK,E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,MAAM;OALnF,aAAa,CAyCzB;IAAD,oBAAC;CAAA,AAzCD,IAyCC;SAzCY,aAAa"} \ No newline at end of file diff --git a/src/app/+search-page/filtered-search-page.component.js b/src/app/+search-page/filtered-search-page.component.js new file mode 100644 index 0000000000..88508309bf --- /dev/null +++ b/src/app/+search-page/filtered-search-page.component.js @@ -0,0 +1,64 @@ +import * as tslib_1 from "tslib"; +import { HostWindowService } from '../shared/host-window.service'; +import { SearchService } from './search-service/search.service'; +import { SearchSidebarService } from './search-sidebar/search-sidebar.service'; +import { SearchPageComponent } from './search-page.component'; +import { ChangeDetectionStrategy, Component, Inject, Input } from '@angular/core'; +import { pushInOut } from '../shared/animations/push'; +import { RouteService } from '../shared/services/route.service'; +import { SearchConfigurationService } from './search-service/search-configuration.service'; +import { SEARCH_CONFIG_SERVICE } from '../+my-dspace-page/my-dspace-page.component'; +/** + * This component renders a simple item page. + * The route parameter 'id' is used to request the item it represents. + * All fields of the item that should be displayed, are defined in its template. + */ +var FilteredSearchPageComponent = /** @class */ (function (_super) { + tslib_1.__extends(FilteredSearchPageComponent, _super); + function FilteredSearchPageComponent(service, sidebarService, windowService, searchConfigService, routeService) { + var _this = _super.call(this, service, sidebarService, windowService, searchConfigService, routeService) || this; + _this.service = service; + _this.sidebarService = sidebarService; + _this.windowService = windowService; + _this.searchConfigService = searchConfigService; + _this.routeService = routeService; + return _this; + } + /** + * Get the current paginated search options after updating the fixed filter using the fixedFilterQuery input + * This is to make sure the fixed filter is included in the paginated search options, as it is not part of any + * query or route parameters + * @returns {Observable} + */ + FilteredSearchPageComponent.prototype.getSearchOptions = function () { + this.searchConfigService.updateFixedFilter(this.fixedFilterQuery); + return this.searchConfigService.paginatedSearchOptions; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], FilteredSearchPageComponent.prototype, "fixedFilterQuery", void 0); + FilteredSearchPageComponent = tslib_1.__decorate([ + Component({ selector: 'ds-filtered-search-page', + styleUrls: ['./search-page.component.scss'], + templateUrl: './search-page.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + animations: [pushInOut], + providers: [ + { + provide: SEARCH_CONFIG_SERVICE, + useClass: SearchConfigurationService + } + ] + }), + tslib_1.__param(3, Inject(SEARCH_CONFIG_SERVICE)), + tslib_1.__metadata("design:paramtypes", [SearchService, + SearchSidebarService, + HostWindowService, + SearchConfigurationService, + RouteService]) + ], FilteredSearchPageComponent); + return FilteredSearchPageComponent; +}(SearchPageComponent)); +export { FilteredSearchPageComponent }; +//# sourceMappingURL=filtered-search-page.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/filtered-search-page.component.js.map b/src/app/+search-page/filtered-search-page.component.js.map new file mode 100644 index 0000000000..6d20938921 --- /dev/null +++ b/src/app/+search-page/filtered-search-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filtered-search-page.component.js","sourceRoot":"","sources":["filtered-search-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAG3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEpF;;;;GAIG;AAcH;IAAiD,uDAAmB;IAQlE,qCAAsB,OAAsB,EACtB,cAAoC,EACpC,aAAgC,EACJ,mBAA+C,EAC3E,YAA0B;QAJhD,YAKE,kBAAM,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,YAAY,CAAC,SACjF;QANqB,aAAO,GAAP,OAAO,CAAe;QACtB,oBAAc,GAAd,cAAc,CAAsB;QACpC,mBAAa,GAAb,aAAa,CAAmB;QACJ,yBAAmB,GAAnB,mBAAmB,CAA4B;QAC3E,kBAAY,GAAZ,YAAY,CAAc;;IAEhD,CAAC;IAED;;;;;OAKG;IACO,sDAAgB,GAA1B;QACE,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC,mBAAmB,CAAC,sBAAsB,CAAC;IACzD,CAAC;IAnBQ;QAAR,KAAK,EAAE;;yEAA0B;IANvB,2BAA2B;QAbvC,SAAS,CAAC,EAAC,QAAQ,EAAE,yBAAyB;YAC7C,SAAS,EAAE,CAAC,8BAA8B,CAAC;YAC3C,WAAW,EAAE,8BAA8B;YAC3C,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,UAAU,EAAE,CAAC,SAAS,CAAC;YACvB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,qBAAqB;oBAC9B,QAAQ,EAAE,0BAA0B;iBACrC;aACF;SACF,CAAC;QAaa,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;iDAHX,aAAa;YACN,oBAAoB;YACrB,iBAAiB;YACiB,0BAA0B;YAC7D,YAAY;OAZrC,2BAA2B,CA2BvC;IAAD,kCAAC;CAAA,AA3BD,CAAiD,mBAAmB,GA2BnE;SA3BY,2BAA2B"} \ No newline at end of file diff --git a/src/app/+search-page/filtered-search-page.guard.js b/src/app/+search-page/filtered-search-page.guard.js new file mode 100644 index 0000000000..bdcd16be92 --- /dev/null +++ b/src/app/+search-page/filtered-search-page.guard.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +var FilteredSearchPageGuard = /** @class */ (function () { + /** + * Assemble the correct i18n key for the filtered search page's title depending on the current route's filter parameter + * and title data. + * The format of the key will be "{title}{filter}.title" with: + * - title: The prefix of the key stored in route.data + * - filter: The current filter stored in route.params + */ + function FilteredSearchPageGuard() { + } + FilteredSearchPageGuard.prototype.canActivate = function (route, state) { + var filter = route.params.filter; + var newTitle = route.data.title + filter + '.title'; + route.data = { title: newTitle }; + return true; + }; + FilteredSearchPageGuard = tslib_1.__decorate([ + Injectable() + /** + * Assemble the correct i18n key for the filtered search page's title depending on the current route's filter parameter + * and title data. + * The format of the key will be "{title}{filter}.title" with: + * - title: The prefix of the key stored in route.data + * - filter: The current filter stored in route.params + */ + ], FilteredSearchPageGuard); + return FilteredSearchPageGuard; +}()); +export { FilteredSearchPageGuard }; +//# sourceMappingURL=filtered-search-page.guard.js.map \ No newline at end of file diff --git a/src/app/+search-page/filtered-search-page.guard.js.map b/src/app/+search-page/filtered-search-page.guard.js.map new file mode 100644 index 0000000000..8d79db77c6 --- /dev/null +++ b/src/app/+search-page/filtered-search-page.guard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filtered-search-page.guard.js","sourceRoot":"","sources":["filtered-search-page.guard.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAY3C;IAPA;;;;;;OAMG;IACH;IAWA,CAAC;IAVC,6CAAW,GAAX,UACE,KAA6B,EAC7B,KAA0B;QAC1B,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;QAEnC,IAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;QAEtD,KAAK,CAAC,IAAI,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAVU,uBAAuB;QARnC,UAAU,EAAE;QACb;;;;;;WAMG;OACU,uBAAuB,CAWnC;IAAD,8BAAC;CAAA,AAXD,IAWC;SAXY,uBAAuB"} \ No newline at end of file diff --git a/src/app/+search-page/normalized-search-result.model.js b/src/app/+search-page/normalized-search-result.model.js new file mode 100644 index 0000000000..e2eb112dcc --- /dev/null +++ b/src/app/+search-page/normalized-search-result.model.js @@ -0,0 +1,21 @@ +import * as tslib_1 from "tslib"; +import { autoserialize } from 'cerialize'; +import { MetadataMap } from '../core/shared/metadata.models'; +/** + * Represents a normalized version of a search result object of a certain DSpaceObject + */ +var NormalizedSearchResult = /** @class */ (function () { + function NormalizedSearchResult() { + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedSearchResult.prototype, "indexableObject", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", MetadataMap) + ], NormalizedSearchResult.prototype, "hitHighlights", void 0); + return NormalizedSearchResult; +}()); +export { NormalizedSearchResult }; +//# sourceMappingURL=normalized-search-result.model.js.map \ No newline at end of file diff --git a/src/app/+search-page/normalized-search-result.model.js.map b/src/app/+search-page/normalized-search-result.model.js.map new file mode 100644 index 0000000000..93ab151537 --- /dev/null +++ b/src/app/+search-page/normalized-search-result.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-search-result.model.js","sourceRoot":"","sources":["normalized-search-result.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAmB,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAG7D;;GAEG;AACH;IAAA;IAaA,CAAC;IARC;QADC,aAAa;;mEACU;IAMxB;QADC,aAAa;0CACC,WAAW;iEAAC;IAE7B,6BAAC;CAAA,AAbD,IAaC;SAbY,sBAAsB"} \ No newline at end of file diff --git a/src/app/+search-page/paginated-search-options.model.js b/src/app/+search-page/paginated-search-options.model.js new file mode 100644 index 0000000000..1fb02b758b --- /dev/null +++ b/src/app/+search-page/paginated-search-options.model.js @@ -0,0 +1,35 @@ +import * as tslib_1 from "tslib"; +import { isNotEmpty } from '../shared/empty.util'; +import { SearchOptions } from './search-options.model'; +/** + * This model class represents all parameters needed to request information about a certain page of a search request, in a certain order + */ +var PaginatedSearchOptions = /** @class */ (function (_super) { + tslib_1.__extends(PaginatedSearchOptions, _super); + function PaginatedSearchOptions(options) { + var _this = _super.call(this, options) || this; + _this.pagination = options.pagination; + _this.sort = options.sort; + return _this; + } + /** + * Method to generate the URL that can be used to request a certain page with specific sort options + * @param {string} url The URL to the REST endpoint + * @param {string[]} args A list of query arguments that should be included in the URL + * @returns {string} URL with all paginated search options and passed arguments as query parameters + */ + PaginatedSearchOptions.prototype.toRestUrl = function (url, args) { + if (args === void 0) { args = []; } + if (isNotEmpty(this.sort)) { + args.push("sort=" + this.sort.field + "," + this.sort.direction); + } + if (isNotEmpty(this.pagination)) { + args.push("page=" + (this.pagination.currentPage - 1)); + args.push("size=" + this.pagination.pageSize); + } + return _super.prototype.toRestUrl.call(this, url, args); + }; + return PaginatedSearchOptions; +}(SearchOptions)); +export { PaginatedSearchOptions }; +//# sourceMappingURL=paginated-search-options.model.js.map \ No newline at end of file diff --git a/src/app/+search-page/paginated-search-options.model.js.map b/src/app/+search-page/paginated-search-options.model.js.map new file mode 100644 index 0000000000..0f76a75ef4 --- /dev/null +++ b/src/app/+search-page/paginated-search-options.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"paginated-search-options.model.js","sourceRoot":"","sources":["paginated-search-options.model.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIvD;;GAEG;AACH;IAA4C,kDAAa;IAIvD,gCAAY,OAAuM;QAAnN,YACE,kBAAM,OAAO,CAAC,SAGf;QAFC,KAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,KAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;;IAC3B,CAAC;IAED;;;;;OAKG;IACH,0CAAS,GAAT,UAAU,GAAW,EAAE,IAAmB;QAAnB,qBAAA,EAAA,SAAmB;QACxC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACzB,IAAI,CAAC,IAAI,CAAC,UAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,SAAI,IAAI,CAAC,IAAI,CAAC,SAAW,CAAC,CAAC;SAC7D;QACD,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YAC/B,IAAI,CAAC,IAAI,CAAC,WAAQ,IAAI,CAAC,UAAU,CAAC,WAAW,GAAG,CAAC,CAAE,CAAC,CAAC;YACrD,IAAI,CAAC,IAAI,CAAC,UAAQ,IAAI,CAAC,UAAU,CAAC,QAAU,CAAC,CAAC;SAC/C;QACD,OAAO,iBAAM,SAAS,YAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IACH,6BAAC;AAAD,CAAC,AA1BD,CAA4C,aAAa,GA0BxD"} \ No newline at end of file diff --git a/src/app/+search-page/search-filter.model.js b/src/app/+search-page/search-filter.model.js new file mode 100644 index 0000000000..09d992cdda --- /dev/null +++ b/src/app/+search-page/search-filter.model.js @@ -0,0 +1,19 @@ +/** + * Represents a search filter + */ +import { hasValue } from '../shared/empty.util'; +var SearchFilter = /** @class */ (function () { + function SearchFilter(key, values, operator) { + this.key = key; + this.values = values; + if (hasValue(operator)) { + this.operator = operator; + } + else { + this.operator = 'query'; + } + } + return SearchFilter; +}()); +export { SearchFilter }; +//# sourceMappingURL=search-filter.model.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filter.model.js.map b/src/app/+search-page/search-filter.model.js.map new file mode 100644 index 0000000000..3ea619f211 --- /dev/null +++ b/src/app/+search-page/search-filter.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-filter.model.js","sourceRoot":"","sources":["search-filter.model.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD;IAKE,sBAAY,GAAW,EAAE,MAAgB,EAAE,QAAiB;QAC1D,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC1B;aAAM;YACL,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;SACzB;IACH,CAAC;IACH,mBAAC;AAAD,CAAC,AAdD,IAcC"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-authority-filter/search-authority-filter.component.js b/src/app/+search-page/search-filters/search-filter/search-authority-filter/search-authority-filter.component.js new file mode 100644 index 0000000000..c60af10c9d --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-authority-filter/search-authority-filter.component.js @@ -0,0 +1,41 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { FilterType } from '../../../search-service/filter-type.model'; +import { facetLoad, SearchFacetFilterComponent } from '../search-facet-filter/search-facet-filter.component'; +import { renderFacetFor } from '../search-filter-type-decorator'; +var SearchAuthorityFilterComponent = /** @class */ (function (_super) { + tslib_1.__extends(SearchAuthorityFilterComponent, _super); + function SearchAuthorityFilterComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * TODO to review after https://github.com/DSpace/dspace-angular/issues/368 is resolved + * Retrieve facet value from search link + */ + SearchAuthorityFilterComponent.prototype.getFacetValue = function (facet) { + var search = facet.search; + var hashes = search.slice(search.indexOf('?') + 1).split('&'); + var params = {}; + hashes.map(function (hash) { + var _a = hash.split('='), key = _a[0], val = _a[1]; + params[key] = decodeURIComponent(val); + }); + return params[this.filterConfig.paramName]; + }; + SearchAuthorityFilterComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-authority-filter', + styleUrls: ['./search-authority-filter.component.scss'], + templateUrl: './search-authority-filter.component.html', + animations: [facetLoad] + }) + /** + * Component that represents an authority facet for a specific filter configuration + */ + , + renderFacetFor(FilterType.authority) + ], SearchAuthorityFilterComponent); + return SearchAuthorityFilterComponent; +}(SearchFacetFilterComponent)); +export { SearchAuthorityFilterComponent }; +//# sourceMappingURL=search-authority-filter.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-authority-filter/search-authority-filter.component.js.map b/src/app/+search-page/search-filters/search-filter/search-authority-filter/search-authority-filter.component.js.map new file mode 100644 index 0000000000..dece0f17bf --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-authority-filter/search-authority-filter.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-authority-filter.component.js","sourceRoot":"","sources":["search-authority-filter.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,sDAAsD,CAAC;AAC7G,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAcjE;IAAoD,0DAA0B;IAA9E;;IAiBA,CAAC;IAfC;;;OAGG;IACO,sDAAa,GAAvB,UAAwB,KAAiB;QACvC,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,IAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAChE,IAAM,MAAM,GAAG,EAAE,CAAC;QAClB,MAAM,CAAC,GAAG,CAAC,UAAC,IAAI;YACR,IAAA,oBAA4B,EAA3B,WAAG,EAAE,WAAG,CAAoB;YACnC,MAAM,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;QACvC,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;IAhBU,8BAA8B;QAX1C,SAAS,CAAC;YACT,QAAQ,EAAE,4BAA4B;YACtC,SAAS,EAAE,CAAC,0CAA0C,CAAC;YACvD,WAAW,EAAE,0CAA0C;YACvD,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC;QAEF;;WAEG;;QACF,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC;OACxB,8BAA8B,CAiB1C;IAAD,qCAAC;CAAA,AAjBD,CAAoD,0BAA0B,GAiB7E;SAjBY,8BAA8B"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.js b/src/app/+search-page/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.js new file mode 100644 index 0000000000..13c8bf6667 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { FilterType } from '../../../search-service/filter-type.model'; +import { renderFacetFor } from '../search-filter-type-decorator'; +import { facetLoad, SearchFacetFilterComponent } from '../search-facet-filter/search-facet-filter.component'; +var SearchBooleanFilterComponent = /** @class */ (function (_super) { + tslib_1.__extends(SearchBooleanFilterComponent, _super); + function SearchBooleanFilterComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + SearchBooleanFilterComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-boolean-filter', + styleUrls: ['./search-boolean-filter.component.scss'], + templateUrl: './search-boolean-filter.component.html', + animations: [facetLoad] + }) + /** + * Component that represents a boolean facet for a specific filter configuration + */ + , + renderFacetFor(FilterType.boolean) + ], SearchBooleanFilterComponent); + return SearchBooleanFilterComponent; +}(SearchFacetFilterComponent)); +export { SearchBooleanFilterComponent }; +//# sourceMappingURL=search-boolean-filter.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.js.map b/src/app/+search-page/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.js.map new file mode 100644 index 0000000000..7f1313439a --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-boolean-filter.component.js","sourceRoot":"","sources":["search-boolean-filter.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EACL,SAAS,EACT,0BAA0B,EAC3B,MAAM,sDAAsD,CAAC;AAa9D;IAAkD,wDAA0B;IAA5E;;IACA,CAAC;IADY,4BAA4B;QAXxC,SAAS,CAAC;YACT,QAAQ,EAAE,0BAA0B;YACpC,SAAS,EAAE,CAAC,wCAAwC,CAAC;YACrD,WAAW,EAAE,wCAAwC;YACrD,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC;QAEF;;WAEG;;QACF,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC;OACtB,4BAA4B,CACxC;IAAD,mCAAC;CAAA,AADD,CAAkD,0BAA0B,GAC3E;SADY,4BAA4B"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.js b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.js new file mode 100644 index 0000000000..df9ea204fd --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.js @@ -0,0 +1,119 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest, Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { Component, Input } from '@angular/core'; +import { Router } from '@angular/router'; +import { FacetValue } from '../../../../search-service/facet-value.model'; +import { SearchFilterConfig } from '../../../../search-service/search-filter-config.model'; +import { SearchService } from '../../../../search-service/search.service'; +import { SearchFilterService } from '../../search-filter.service'; +import { SearchConfigurationService } from '../../../../search-service/search-configuration.service'; +import { hasValue } from '../../../../../shared/empty.util'; +import { FilterType } from '../../../../search-service/filter-type.model'; +var SearchFacetOptionComponent = /** @class */ (function () { + function SearchFacetOptionComponent(searchService, filterService, searchConfigService, router) { + this.searchService = searchService; + this.filterService = filterService; + this.searchConfigService = searchConfigService; + this.router = router; + } + /** + * Initializes all observable instance variables and starts listening to them + */ + SearchFacetOptionComponent.prototype.ngOnInit = function () { + var _this = this; + this.isVisible = this.isChecked().pipe(map(function (checked) { return !checked; })); + this.sub = observableCombineLatest(this.selectedValues$, this.searchConfigService.searchOptions) + .subscribe(function (_a) { + var selectedValues = _a[0], searchOptions = _a[1]; + _this.updateAddParams(selectedValues); + }); + }; + /** + * Checks if a value for this filter is currently active + */ + SearchFacetOptionComponent.prototype.isChecked = function () { + return this.filterService.isFilterActiveWithValue(this.filterConfig.paramName, this.getFacetValue()); + }; + /** + * @returns {string} The base path to the search page, or the current page when inPlaceSearch is true + */ + SearchFacetOptionComponent.prototype.getSearchLink = function () { + if (this.inPlaceSearch) { + return './'; + } + return this.searchService.getSearchLink(); + }; + /** + * Calculates the parameters that should change if a given value for this filter would be added to the active filters + * @param {string[]} selectedValues The values that are currently selected for this filter + */ + SearchFacetOptionComponent.prototype.updateAddParams = function (selectedValues) { + var _a; + this.addQueryParams = (_a = {}, + _a[this.filterConfig.paramName] = selectedValues.map(function (facetValue) { return facetValue.label; }).concat([this.getFacetValue()]), + _a.page = 1, + _a); + }; + /** + * TODO to review after https://github.com/DSpace/dspace-angular/issues/368 is resolved + * Retrieve facet value related to facet type + */ + SearchFacetOptionComponent.prototype.getFacetValue = function () { + if (this.filterConfig.type === FilterType.authority) { + var search = this.filterValue.search; + var hashes = search.slice(search.indexOf('?') + 1).split('&'); + var params_1 = {}; + hashes.map(function (hash) { + var _a = hash.split('='), key = _a[0], val = _a[1]; + params_1[key] = decodeURIComponent(val); + }); + return params_1[this.filterConfig.paramName]; + } + else { + return this.filterValue.value; + } + }; + /** + * Make sure the subscription is unsubscribed from when this component is destroyed + */ + SearchFacetOptionComponent.prototype.ngOnDestroy = function () { + if (hasValue(this.sub)) { + this.sub.unsubscribe(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FacetValue) + ], SearchFacetOptionComponent.prototype, "filterValue", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SearchFilterConfig) + ], SearchFacetOptionComponent.prototype, "filterConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Observable) + ], SearchFacetOptionComponent.prototype, "selectedValues$", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchFacetOptionComponent.prototype, "inPlaceSearch", void 0); + SearchFacetOptionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-facet-option', + styleUrls: ['./search-facet-option.component.scss'], + templateUrl: './search-facet-option.component.html', + }) + /** + * Represents a single option in a filter facet + */ + , + tslib_1.__metadata("design:paramtypes", [SearchService, + SearchFilterService, + SearchConfigurationService, + Router]) + ], SearchFacetOptionComponent); + return SearchFacetOptionComponent; +}()); +export { SearchFacetOptionComponent }; +//# sourceMappingURL=search-facet-option.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.js.map b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.js.map new file mode 100644 index 0000000000..7288ceb481 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-facet-option.component.js","sourceRoot":"","sources":["search-facet-option.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAE,UAAU,EAAgB,MAAM,MAAM,CAAC;AAC1F,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAq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G,CAAC,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;SACxB;IACH,CAAC;IAzGQ;QAAR,KAAK,EAAE;0CAAc,UAAU;mEAAC;IAKxB;QAAR,KAAK,EAAE;0CAAe,kBAAkB;oEAAC;IAKjC;QAAR,KAAK,EAAE;0CAAkB,UAAU;uEAAe;IAK1C;QAAR,KAAK,EAAE;;qEAAe;IAnBZ,0BAA0B;QATtC,SAAS,CAAC;YACT,QAAQ,EAAE,wBAAwB;YAClC,SAAS,EAAE,CAAC,sCAAsC,CAAC;YACnD,WAAW,EAAE,sCAAsC;SACpD,CAAC;QAEF;;WAEG;;iDAqCoC,aAAa;YACb,mBAAmB;YACb,0BAA0B;YACvC,MAAM;OAvCzB,0BAA0B,CA8GtC;IAAD,iCAAC;CAAA,AA9GD,IA8GC;SA9GY,0BAA0B"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.js b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.js new file mode 100644 index 0000000000..96439ed56f --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.js @@ -0,0 +1,97 @@ +import * as tslib_1 from "tslib"; +import { map } from 'rxjs/operators'; +import { Component, Input } from '@angular/core'; +import { Router } from '@angular/router'; +import { FacetValue } from '../../../../search-service/facet-value.model'; +import { SearchFilterConfig } from '../../../../search-service/search-filter-config.model'; +import { SearchService } from '../../../../search-service/search.service'; +import { SearchFilterService } from '../../search-filter.service'; +import { RANGE_FILTER_MAX_SUFFIX, RANGE_FILTER_MIN_SUFFIX } from '../../search-range-filter/search-range-filter.component'; +import { SearchConfigurationService } from '../../../../search-service/search-configuration.service'; +import { hasValue } from '../../../../../shared/empty.util'; +var rangeDelimiter = '-'; +var SearchFacetRangeOptionComponent = /** @class */ (function () { + function SearchFacetRangeOptionComponent(searchService, filterService, searchConfigService, router) { + this.searchService = searchService; + this.filterService = filterService; + this.searchConfigService = searchConfigService; + this.router = router; + } + /** + * Initializes all observable instance variables and starts listening to them + */ + SearchFacetRangeOptionComponent.prototype.ngOnInit = function () { + var _this = this; + this.isVisible = this.isChecked().pipe(map(function (checked) { return !checked; })); + this.sub = this.searchConfigService.searchOptions.subscribe(function () { + _this.updateChangeParams(); + }); + }; + /** + * Checks if a value for this filter is currently active + */ + SearchFacetRangeOptionComponent.prototype.isChecked = function () { + return this.filterService.isFilterActiveWithValue(this.filterConfig.paramName, this.filterValue.value); + }; + /** + * @returns {string} The base path to the search page, or the current page when inPlaceSearch is true + */ + SearchFacetRangeOptionComponent.prototype.getSearchLink = function () { + if (this.inPlaceSearch) { + return './'; + } + return this.searchService.getSearchLink(); + }; + /** + * Calculates the parameters that should change if a given values for this range filter would be changed + */ + SearchFacetRangeOptionComponent.prototype.updateChangeParams = function () { + var _a; + var parts = this.filterValue.value.split(rangeDelimiter); + var min = parts.length > 1 ? parts[0].trim() : this.filterValue.value; + var max = parts.length > 1 ? parts[1].trim() : this.filterValue.value; + this.changeQueryParams = (_a = {}, + _a[this.filterConfig.paramName + RANGE_FILTER_MIN_SUFFIX] = [min], + _a[this.filterConfig.paramName + RANGE_FILTER_MAX_SUFFIX] = [max], + _a.page = 1, + _a); + }; + /** + * Make sure the subscription is unsubscribed from when this component is destroyed + */ + SearchFacetRangeOptionComponent.prototype.ngOnDestroy = function () { + if (hasValue(this.sub)) { + this.sub.unsubscribe(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FacetValue) + ], SearchFacetRangeOptionComponent.prototype, "filterValue", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SearchFilterConfig) + ], SearchFacetRangeOptionComponent.prototype, "filterConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchFacetRangeOptionComponent.prototype, "inPlaceSearch", void 0); + SearchFacetRangeOptionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-facet-range-option', + styleUrls: ['./search-facet-range-option.component.scss'], + templateUrl: './search-facet-range-option.component.html', + }) + /** + * Represents a single option in a range filter facet + */ + , + tslib_1.__metadata("design:paramtypes", [SearchService, + SearchFilterService, + SearchConfigurationService, + Router]) + ], SearchFacetRangeOptionComponent); + return SearchFacetRangeOptionComponent; +}()); +export { SearchFacetRangeOptionComponent }; +//# sourceMappingURL=search-facet-range-option.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.js.map b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.js.map new file mode 100644 index 0000000000..1be8dad372 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-facet-range-option.component.js","sourceRoot":"","sources":["search-facet-range-option.component.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,yDAAyD,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yDAAyD,CAAC;AACrG,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE5D,IAAM,cAAc,GAAG,GAAG,CAAC;AAW3B;IA+BE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,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;QACxE,IAAI,CAAC,iBAAiB;YACpB,GAAC,IAAI,CAAC,YAAY,CAAC,SAAS,GAAG,uBAAuB,IAAG,CAAC,GAAG,CAAC;YAC9D,GAAC,IAAI,CAAC,YAAY,CAAC,SAAS,GAAG,uBAAuB,IAAG,CAAC,GAAG,CAAC;YAC9D,OAAI,GAAE,CAAC;eACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,qDAAW,GAAX;QACE,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;SACxB;IACH,CAAC;IAlFQ;QAAR,KAAK,EAAE;0CAAc,UAAU;wEAAC;IAKxB;QAAR,KAAK,EAAE;0CAAe,kBAAkB;yEAAC;IAKjC;QAAR,KAAK,EAAE;;0EAAe;IAdZ,+BAA+B;QAT3C,SAAS,CAAC;YACT,QAAQ,EAAE,8BAA8B;YACxC,SAAS,EAAE,CAAC,4CAA4C,CAAC;YACzD,WAAW,EAAE,4CAA4C;SAC1D,CAAC;QAEF;;WAEG;;iDAgCoC,aAAa;YACb,mBAAmB;YACb,0BAA0B;YACvC,MAAM;OAlCzB,+BAA+B,CAuF3C;IAAD,sCAAC;CAAA,AAvFD,IAuFC;SAvFY,+BAA+B"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.js b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.js new file mode 100644 index 0000000000..4696e08d7f --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.js @@ -0,0 +1,114 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest, Observable } from 'rxjs'; +import { Component, Input } from '@angular/core'; +import { Router } from '@angular/router'; +import { SearchFilterConfig } from '../../../../search-service/search-filter-config.model'; +import { SearchService } from '../../../../search-service/search.service'; +import { SearchFilterService } from '../../search-filter.service'; +import { hasValue } from '../../../../../shared/empty.util'; +import { SearchConfigurationService } from '../../../../search-service/search-configuration.service'; +import { FacetValue } from '../../../../search-service/facet-value.model'; +import { FilterType } from '../../../../search-service/filter-type.model'; +var SearchFacetSelectedOptionComponent = /** @class */ (function () { + function SearchFacetSelectedOptionComponent(searchService, filterService, searchConfigService, router) { + this.searchService = searchService; + this.filterService = filterService; + this.searchConfigService = searchConfigService; + this.router = router; + } + /** + * Initializes all observable instance variables and starts listening to them + */ + SearchFacetSelectedOptionComponent.prototype.ngOnInit = function () { + var _this = this; + this.sub = observableCombineLatest(this.selectedValues$, this.searchConfigService.searchOptions) + .subscribe(function (_a) { + var selectedValues = _a[0], searchOptions = _a[1]; + _this.updateRemoveParams(selectedValues); + }); + }; + /** + * @returns {string} The base path to the search page, or the current page when inPlaceSearch is true + */ + SearchFacetSelectedOptionComponent.prototype.getSearchLink = function () { + if (this.inPlaceSearch) { + return './'; + } + return this.searchService.getSearchLink(); + }; + /** + * Calculates the parameters that should change if a given value for this filter would be removed from the active filters + * @param {string[]} selectedValues The values that are currently selected for this filter + */ + SearchFacetSelectedOptionComponent.prototype.updateRemoveParams = function (selectedValues) { + var _this = this; + var _a; + this.removeQueryParams = (_a = {}, + _a[this.filterConfig.paramName] = selectedValues + .filter(function (facetValue) { return facetValue.label !== _this.selectedValue.label; }) + .map(function (facetValue) { return _this.getFacetValue(facetValue); }), + _a.page = 1, + _a); + }; + /** + * TODO to review after https://github.com/DSpace/dspace-angular/issues/368 is resolved + * Retrieve facet value related to facet type + */ + SearchFacetSelectedOptionComponent.prototype.getFacetValue = function (facetValue) { + if (this.filterConfig.type === FilterType.authority) { + var search = facetValue.search; + var hashes = search.slice(search.indexOf('?') + 1).split('&'); + var params_1 = {}; + hashes.map(function (hash) { + var _a = hash.split('='), key = _a[0], val = _a[1]; + params_1[key] = decodeURIComponent(val); + }); + return params_1[this.filterConfig.paramName]; + } + else { + return facetValue.value; + } + }; + /** + * Make sure the subscription is unsubscribed from when this component is destroyed + */ + SearchFacetSelectedOptionComponent.prototype.ngOnDestroy = function () { + if (hasValue(this.sub)) { + this.sub.unsubscribe(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FacetValue) + ], SearchFacetSelectedOptionComponent.prototype, "selectedValue", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SearchFilterConfig) + ], SearchFacetSelectedOptionComponent.prototype, "filterConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Observable) + ], SearchFacetSelectedOptionComponent.prototype, "selectedValues$", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchFacetSelectedOptionComponent.prototype, "inPlaceSearch", void 0); + SearchFacetSelectedOptionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-facet-selected-option', + styleUrls: ['./search-facet-selected-option.component.scss'], + templateUrl: './search-facet-selected-option.component.html', + }) + /** + * Represents a single selected option in a filter facet + */ + , + tslib_1.__metadata("design:paramtypes", [SearchService, + SearchFilterService, + SearchConfigurationService, + Router]) + ], SearchFacetSelectedOptionComponent); + return SearchFacetSelectedOptionComponent; +}()); +export { SearchFacetSelectedOptionComponent }; +//# sourceMappingURL=search-facet-selected-option.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.js.map b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.js.map new file mode 100644 index 0000000000..c4abc53a8f --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-facet-selected-option.component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AG,CAAC,WAAW,EAAE,CAAC;SACxB;IACH,CAAC;IA9FQ;QAAR,KAAK,EAAE;0CAAgB,UAAU;6EAAC;IAK1B;QAAR,KAAK,EAAE;0CAAe,kBAAkB;4EAAC;IAKjC;QAAR,KAAK,EAAE;0CAAkB,UAAU;+EAAe;IAK1C;QAAR,KAAK,EAAE;;6EAAe;IAnBZ,kCAAkC;QAT9C,SAAS,CAAC;YACT,QAAQ,EAAE,iCAAiC;YAC3C,SAAS,EAAE,CAAC,+CAA+C,CAAC;YAC5D,WAAW,EAAE,+CAA+C;SAC7D,CAAC;QAEF;;WAEG;;iDAgCoC,aAAa;YACb,mBAAmB;YACb,0BAA0B;YACvC,MAAM;OAlCzB,kCAAkC,CAmG9C;IAAD,yCAAC;CAAA,AAnGD,IAmGC;SAnGY,kCAAkC"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-wrapper/search-facet-filter-wrapper.component.js b/src/app/+search-page/search-filters/search-filter/search-facet-filter-wrapper/search-facet-filter-wrapper.component.js new file mode 100644 index 0000000000..4568cd59d5 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-wrapper/search-facet-filter-wrapper.component.js @@ -0,0 +1,53 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector, Input } from '@angular/core'; +import { renderFilterType } from '../search-filter-type-decorator'; +import { SearchFilterConfig } from '../../../search-service/search-filter-config.model'; +import { FILTER_CONFIG, IN_PLACE_SEARCH } from '../search-filter.service'; +var SearchFacetFilterWrapperComponent = /** @class */ (function () { + function SearchFacetFilterWrapperComponent(injector) { + this.injector = injector; + } + /** + * Initialize and add the filter config to the injector + */ + SearchFacetFilterWrapperComponent.prototype.ngOnInit = function () { + var _this = this; + this.searchFilter = this.getSearchFilter(); + this.objectInjector = Injector.create({ + providers: [ + { provide: FILTER_CONFIG, useFactory: function () { return (_this.filterConfig); }, deps: [] }, + { provide: IN_PLACE_SEARCH, useFactory: function () { return (_this.inPlaceSearch); }, deps: [] } + ], + parent: this.injector + }); + }; + /** + * Find the correct component based on the filter config's type + */ + SearchFacetFilterWrapperComponent.prototype.getSearchFilter = function () { + var type = this.filterConfig.type; + return renderFilterType(type); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SearchFilterConfig) + ], SearchFacetFilterWrapperComponent.prototype, "filterConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchFacetFilterWrapperComponent.prototype, "inPlaceSearch", void 0); + SearchFacetFilterWrapperComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-facet-filter-wrapper', + templateUrl: './search-facet-filter-wrapper.component.html' + }) + /** + * Wrapper component that renders a specific facet filter based on the filter config's type + */ + , + tslib_1.__metadata("design:paramtypes", [Injector]) + ], SearchFacetFilterWrapperComponent); + return SearchFacetFilterWrapperComponent; +}()); +export { SearchFacetFilterWrapperComponent }; +//# sourceMappingURL=search-facet-filter-wrapper.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter-wrapper/search-facet-filter-wrapper.component.js.map b/src/app/+search-page/search-filters/search-filter/search-facet-filter-wrapper/search-facet-filter-wrapper.component.js.map new file mode 100644 index 0000000000..3a9d5693bf --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter-wrapper/search-facet-filter-wrapper.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-facet-filter-wrapper.component.js","sourceRoot":"","sources":["search-facet-filter-wrapper.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAY1E;IAoBE,2CAAoB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IACtC,CAAC;IAED;;OAEG;IACH,oDAAQ,GAAR;QAAA,iBASC;QARC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAC3C,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;YACpC,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,cAAM,OAAA,CAAC,KAAI,CAAC,YAAY,CAAC,EAAnB,CAAmB,EAAE,IAAI,EAAE,EAAE,EAAE;gBAC3E,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,cAAM,OAAA,CAAC,KAAI,CAAC,aAAa,CAAC,EAApB,CAAoB,EAAE,IAAI,EAAE,EAAE,EAAE;aAC/E;YACD,MAAM,EAAE,IAAI,CAAC,QAAQ;SACtB,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,2DAAe,GAAvB;QACE,IAAM,IAAI,GAAe,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;QAChD,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAvCQ;QAAR,KAAK,EAAE;0CAAe,kBAAkB;2EAAC;IAKjC;QAAR,KAAK,EAAE;;4EAAe;IATZ,iCAAiC;QAR7C,SAAS,CAAC;YACT,QAAQ,EAAE,gCAAgC;YAC1C,WAAW,EAAE,8CAA8C;SAC5D,CAAC;QAEF;;WAEG;;iDAqB6B,QAAQ;OApB3B,iCAAiC,CA4C7C;IAAD,wCAAC;CAAA,AA5CD,IA4CC;SA5CY,iCAAiC"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.js b/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.js new file mode 100644 index 0000000000..b81b89113b --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.js @@ -0,0 +1,268 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest, of as observableOf, BehaviorSubject } from 'rxjs'; +import { switchMap, distinctUntilChanged, map, take, tap } from 'rxjs/operators'; +import { animate, state, style, transition, trigger } from '@angular/animations'; +import { Component, Inject } from '@angular/core'; +import { Router } from '@angular/router'; +import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service'; +import { RemoteData } from '../../../../core/data/remote-data'; +import { hasNoValue, hasValue, isNotEmpty } from '../../../../shared/empty.util'; +import { EmphasizePipe } from '../../../../shared/utils/emphasize.pipe'; +import { FacetValue } from '../../../search-service/facet-value.model'; +import { SearchFilterConfig } from '../../../search-service/search-filter-config.model'; +import { SearchService } from '../../../search-service/search.service'; +import { FILTER_CONFIG, IN_PLACE_SEARCH, SearchFilterService } from '../search-filter.service'; +import { SearchConfigurationService } from '../../../search-service/search-configuration.service'; +import { getSucceededRemoteData } from '../../../../core/shared/operators'; +import { SEARCH_CONFIG_SERVICE } from '../../../../+my-dspace-page/my-dspace-page.component'; +var SearchFacetFilterComponent = /** @class */ (function () { + function SearchFacetFilterComponent(searchService, filterService, rdbs, router, searchConfigService, inPlaceSearch, filterConfig) { + this.searchService = searchService; + this.filterService = filterService; + this.rdbs = rdbs; + this.router = router; + this.searchConfigService = searchConfigService; + this.inPlaceSearch = inPlaceSearch; + this.filterConfig = filterConfig; + /** + * Emits true if the current page is also the last page available + */ + this.isLastPage$ = new BehaviorSubject(false); + /** + * List of subscriptions to unsubscribe from + */ + this.subs = []; + /** + * Emits the result values for this filter found by the current filter query + */ + this.filterSearchResults = observableOf([]); + this.collapseNextUpdate = true; + /** + * State of the requested facets used to time the animation + */ + this.animationState = 'loading'; + } + /** + * Initializes all observable instance variables and starts listening to them + */ + SearchFacetFilterComponent.prototype.ngOnInit = function () { + var _this = this; + this.filterValues$ = new BehaviorSubject(new RemoteData(true, false, undefined, undefined, undefined)); + this.currentPage = this.getCurrentPage().pipe(distinctUntilChanged()); + this.searchOptions$ = this.searchConfigService.searchOptions; + this.subs.push(this.searchOptions$.subscribe(function () { return _this.updateFilterValueList(); })); + var facetValues$ = observableCombineLatest(this.searchOptions$, this.currentPage).pipe(map(function (_a) { + var options = _a[0], page = _a[1]; + return { options: options, page: page }; + }), switchMap(function (_a) { + var options = _a.options, page = _a.page; + return _this.searchService.getFacetValuesFor(_this.filterConfig, page, options) + .pipe(getSucceededRemoteData(), map(function (results) { + return { + values: observableOf(results), + page: page + }; + })); + })); + var filterValues = []; + this.subs.push(facetValues$.subscribe(function (facetOutcome) { + var newValues$ = facetOutcome.values; + if (_this.collapseNextUpdate) { + _this.showFirstPageOnly(); + facetOutcome.page = 1; + _this.collapseNextUpdate = false; + } + if (facetOutcome.page === 1) { + filterValues = []; + } + filterValues = filterValues.concat([newValues$]); + _this.subs.push(_this.rdbs.aggregate(filterValues).pipe(tap(function (rd) { + _this.selectedValues$ = _this.filterService.getSelectedValuesForFilter(_this.filterConfig).pipe(map(function (selectedValues) { + return selectedValues.map(function (value) { + var fValue = [].concat.apply([], rd.payload.map(function (page) { return page.page; })).find(function (facetValue) { return facetValue.value === value; }); + if (hasValue(fValue)) { + return fValue; + } + return Object.assign(new FacetValue(), { label: value, value: value }); + }); + })); + })).subscribe(function (rd) { + _this.animationState = 'ready'; + _this.filterValues$.next(rd); + })); + _this.subs.push(newValues$.pipe(take(1)).subscribe(function (rd) { + _this.isLastPage$.next(hasNoValue(rd.payload.next)); + })); + })); + }; + /** + * Prepare for refreshing the values of this filter + */ + SearchFacetFilterComponent.prototype.updateFilterValueList = function () { + this.animationState = 'loading'; + this.collapseNextUpdate = true; + this.filter = ''; + }; + /** + * Checks if a value for this filter is currently active + */ + SearchFacetFilterComponent.prototype.isChecked = function (value) { + return this.filterService.isFilterActiveWithValue(this.filterConfig.paramName, value.value); + }; + /** + * @returns {string} The base path to the search page, or the current page when inPlaceSearch is true + */ + SearchFacetFilterComponent.prototype.getSearchLink = function () { + if (this.inPlaceSearch) { + return './'; + } + return this.searchService.getSearchLink(); + }; + /** + * @returns {string[]} The base path to the search page, or the current page when inPlaceSearch is true, split in separate pieces + */ + SearchFacetFilterComponent.prototype.getSearchLinkParts = function () { + if (this.inPlaceSearch) { + return []; + } + return this.getSearchLink().split('/'); + }; + /** + * Show the next page as well + */ + SearchFacetFilterComponent.prototype.showMore = function () { + this.filterService.incrementPage(this.filterConfig.name); + }; + /** + * Make sure only the first page is shown + */ + SearchFacetFilterComponent.prototype.showFirstPageOnly = function () { + this.filterService.resetPage(this.filterConfig.name); + }; + /** + * @returns {Observable} The current page of this filter + */ + SearchFacetFilterComponent.prototype.getCurrentPage = function () { + return this.filterService.getPage(this.filterConfig.name); + }; + /** + * @returns {string} the current URL + */ + SearchFacetFilterComponent.prototype.getCurrentUrl = function () { + return this.router.url; + }; + /** + * Submits a new active custom value to the filter from the input field + * @param data The string from the input field + */ + SearchFacetFilterComponent.prototype.onSubmit = function (data) { + var _this = this; + this.selectedValues$.pipe(take(1)).subscribe(function (selectedValues) { + var _a; + if (isNotEmpty(data)) { + _this.router.navigate(_this.getSearchLinkParts(), { + queryParams: (_a = {}, + _a[_this.filterConfig.paramName] = selectedValues.map(function (facet) { return _this.getFacetValue(facet); }).concat([ + data + ]), + _a), + queryParamsHandling: 'merge' + }); + _this.filter = ''; + } + _this.filterSearchResults = observableOf([]); + }); + }; + /** + * On click, set the input's value to the clicked data + * @param data The value of the option that was clicked + */ + SearchFacetFilterComponent.prototype.onClick = function (data) { + this.filter = data; + }; + /** + * For usage of the hasValue function in the template + */ + SearchFacetFilterComponent.prototype.hasValue = function (o) { + return hasValue(o); + }; + /** + * Unsubscribe from all subscriptions + */ + SearchFacetFilterComponent.prototype.ngOnDestroy = function () { + this.subs + .filter(function (sub) { return hasValue(sub); }) + .forEach(function (sub) { return sub.unsubscribe(); }); + }; + /** + * Updates the found facet value suggestions for a given query + * Transforms the found values into display values + * @param data The query for which is being searched + */ + SearchFacetFilterComponent.prototype.findSuggestions = function (data) { + var _this = this; + if (isNotEmpty(data)) { + this.searchOptions$.pipe(take(1)).subscribe(function (options) { + _this.filterSearchResults = _this.searchService.getFacetValuesFor(_this.filterConfig, 1, options, data.toLowerCase()) + .pipe(getSucceededRemoteData(), map(function (rd) { + return rd.payload.page.map(function (facet) { + return { + displayValue: _this.getDisplayValue(facet, data), + value: _this.getFacetValue(facet) + }; + }); + })); + }); + } + else { + this.filterSearchResults = observableOf([]); + } + }; + /** + * Retrieve facet value + */ + SearchFacetFilterComponent.prototype.getFacetValue = function (facet) { + return facet.value; + }; + /** + * Transforms the facet value string, so if the query matches part of the value, it's emphasized in the value + * @param {FacetValue} facet The value of the facet as returned by the server + * @param {string} query The query that was used to search facet values + * @returns {string} The facet value with the query part emphasized + */ + SearchFacetFilterComponent.prototype.getDisplayValue = function (facet, query) { + return new EmphasizePipe().transform(facet.value, query) + ' (' + facet.count + ')'; + }; + /** + * Prevent unnecessary rerendering + */ + SearchFacetFilterComponent.prototype.trackUpdate = function (index, value) { + return value ? value.search : undefined; + }; + SearchFacetFilterComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-facet-filter', + template: "", + }) + /** + * Super class for all different representations of facets + */ + , + tslib_1.__param(4, Inject(SEARCH_CONFIG_SERVICE)), + tslib_1.__param(5, Inject(IN_PLACE_SEARCH)), + tslib_1.__param(6, Inject(FILTER_CONFIG)), + tslib_1.__metadata("design:paramtypes", [SearchService, + SearchFilterService, + RemoteDataBuildService, + Router, + SearchConfigurationService, Boolean, SearchFilterConfig]) + ], SearchFacetFilterComponent); + return SearchFacetFilterComponent; +}()); +export { SearchFacetFilterComponent }; +export var facetLoad = trigger('facetLoad', [ + state('ready', style({ opacity: 1 })), + state('loading', style({ opacity: 0 })), + transition('loading <=> ready', animate(100)), +]); +//# sourceMappingURL=search-facet-filter.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.js.map b/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.js.map new file mode 100644 index 0000000000..bdc01cd6f9 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-facet-filter/search-facet-filter.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-facet-filter.component.js","sourceRoot":"","sources":["search-facet-filter.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,IAAI,uBAAuB,EACxC,EAAE,IAAI,YAAY,EAClB,eAAe,EAIhB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,GAAG,EAAE,IAAI,EAAW,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,EAAqB,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2DAA2D,CAAC;AAEnG,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,sDAAsD,CAAC;AAClG,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sDAAsD,CAAC;AAU7F;IA+CE,oCAAsB,aAA4B,EAC5B,aAAkC,EAClC,IAA4B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A0B;AAmSvC,MAAM,CAAC,IAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE;IAC5C,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IACrC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IACvC,UAAU,CAAC,mBAAmB,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;CAC9C,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-filter-type-decorator.js b/src/app/+search-page/search-filters/search-filter/search-filter-type-decorator.js new file mode 100644 index 0000000000..93c6385690 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-filter-type-decorator.js @@ -0,0 +1,26 @@ +/** + * Contains the mapping between a facet component and a FilterType + */ +var filterTypeMap = new Map(); +/** + * Sets the mapping for a facet component in relation to a filter type + * @param {FilterType} type The type for which the matching component is mapped + * @returns Decorator function that performs the actual mapping on initialization of the facet component + */ +export function renderFacetFor(type) { + return function decorator(objectElement) { + if (!objectElement) { + return; + } + filterTypeMap.set(type, objectElement); + }; +} +/** + * Requests the matching facet component based on a given filter type + * @param {FilterType} type The filter type for which the facet component is requested + * @returns The facet component's constructor that matches the given filter type + */ +export function renderFilterType(type) { + return filterTypeMap.get(type); +} +//# sourceMappingURL=search-filter-type-decorator.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-filter-type-decorator.js.map b/src/app/+search-page/search-filters/search-filter/search-filter-type-decorator.js.map new file mode 100644 index 0000000000..8158a42178 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-filter-type-decorator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-filter-type-decorator.js","sourceRoot":"","sources":["search-filter-type-decorator.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,IAAM,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;AAEhC;;;;GAIG;AACH,MAAM,yBAAyB,IAAgB;IAC7C,OAAO,mBAAmB,aAAkB;QAC1C,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO;SACR;QACD,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACzC,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,2BAA2B,IAAgB;IAC/C,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-filter.actions.js b/src/app/+search-page/search-filters/search-filter/search-filter.actions.js new file mode 100644 index 0000000000..e71accb843 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-filter.actions.js @@ -0,0 +1,125 @@ +import * as tslib_1 from "tslib"; +import { type } from '../../../shared/ngrx/type'; +/** + * For each action type in an action group, make a simple + * enum object for all of this group's action types. + * + * The 'type' utility function coerces strings into string + * literal types and runs a simple check to guarantee all + * action types in the application are unique. + */ +export var SearchFilterActionTypes = { + COLLAPSE: type('dspace/search-filter/COLLAPSE'), + INITIALIZE: type('dspace/search-filter/INITIALIZE'), + EXPAND: type('dspace/search-filter/EXPAND'), + TOGGLE: type('dspace/search-filter/TOGGLE'), + DECREMENT_PAGE: type('dspace/search-filter/DECREMENT_PAGE'), + INCREMENT_PAGE: type('dspace/search-filter/INCREMENT_PAGE'), + RESET_PAGE: type('dspace/search-filter/RESET_PAGE') +}; +var SearchFilterAction = /** @class */ (function () { + /** + * Initialize with the filter's name + * @param {string} name of the filter + */ + function SearchFilterAction(name) { + this.filterName = name; + } + return SearchFilterAction; +}()); +export { SearchFilterAction }; +/* tslint:disable:max-classes-per-file */ +/** + * Used to collapse a filter + */ +var SearchFilterCollapseAction = /** @class */ (function (_super) { + tslib_1.__extends(SearchFilterCollapseAction, _super); + function SearchFilterCollapseAction() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = SearchFilterActionTypes.COLLAPSE; + return _this; + } + return SearchFilterCollapseAction; +}(SearchFilterAction)); +export { SearchFilterCollapseAction }; +/** + * Used to expand a filter + */ +var SearchFilterExpandAction = /** @class */ (function (_super) { + tslib_1.__extends(SearchFilterExpandAction, _super); + function SearchFilterExpandAction() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = SearchFilterActionTypes.EXPAND; + return _this; + } + return SearchFilterExpandAction; +}(SearchFilterAction)); +export { SearchFilterExpandAction }; +/** + * Used to collapse a filter when it's expanded and expand it when it's collapsed + */ +var SearchFilterToggleAction = /** @class */ (function (_super) { + tslib_1.__extends(SearchFilterToggleAction, _super); + function SearchFilterToggleAction() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = SearchFilterActionTypes.TOGGLE; + return _this; + } + return SearchFilterToggleAction; +}(SearchFilterAction)); +export { SearchFilterToggleAction }; +/** + * Used to set the initial state of a filter + */ +var SearchFilterInitializeAction = /** @class */ (function (_super) { + tslib_1.__extends(SearchFilterInitializeAction, _super); + function SearchFilterInitializeAction(filter) { + var _this = _super.call(this, filter.name) || this; + _this.type = SearchFilterActionTypes.INITIALIZE; + _this.initiallyExpanded = filter.isOpenByDefault; + return _this; + } + return SearchFilterInitializeAction; +}(SearchFilterAction)); +export { SearchFilterInitializeAction }; +/** + * Used to set the state of a filter to the previous page + */ +var SearchFilterDecrementPageAction = /** @class */ (function (_super) { + tslib_1.__extends(SearchFilterDecrementPageAction, _super); + function SearchFilterDecrementPageAction() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = SearchFilterActionTypes.DECREMENT_PAGE; + return _this; + } + return SearchFilterDecrementPageAction; +}(SearchFilterAction)); +export { SearchFilterDecrementPageAction }; +/** + * Used to set the state of a filter to the next page + */ +var SearchFilterIncrementPageAction = /** @class */ (function (_super) { + tslib_1.__extends(SearchFilterIncrementPageAction, _super); + function SearchFilterIncrementPageAction() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = SearchFilterActionTypes.INCREMENT_PAGE; + return _this; + } + return SearchFilterIncrementPageAction; +}(SearchFilterAction)); +export { SearchFilterIncrementPageAction }; +/** + * Used to set the state of a filter to the first page + */ +var SearchFilterResetPageAction = /** @class */ (function (_super) { + tslib_1.__extends(SearchFilterResetPageAction, _super); + function SearchFilterResetPageAction() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = SearchFilterActionTypes.RESET_PAGE; + return _this; + } + return SearchFilterResetPageAction; +}(SearchFilterAction)); +export { SearchFilterResetPageAction }; +/* tslint:enable:max-classes-per-file */ +//# sourceMappingURL=search-filter.actions.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-filter.actions.js.map b/src/app/+search-page/search-filters/search-filter/search-filter.actions.js.map new file mode 100644 index 0000000000..93f1be5b65 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-filter.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-filter.actions.js","sourceRoot":"","sources":["search-filter.actions.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAGjD;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,uBAAuB,GAAG;IACrC,QAAQ,EAAE,IAAI,CAAC,+BAA+B,CAAC;IAC/C,UAAU,EAAE,IAAI,CAAC,iCAAiC,CAAC;IACnD,MAAM,EAAE,IAAI,CAAC,6BAA6B,CAAC;IAC3C,MAAM,EAAE,IAAI,CAAC,6BAA6B,CAAC;IAC3C,cAAc,EAAE,IAAI,CAAC,qCAAqC,CAAC;IAC3D,cAAc,EAAE,IAAI,CAAC,qCAAqC,CAAC;IAC3D,UAAU,EAAE,IAAI,CAAC,iCAAiC,CAAC;CACpD,CAAC;AAEF;IAWE;;;OAGG;IACH,4BAAY,IAAY;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACzB,CAAC;IACH,yBAAC;AAAD,CAAC,AAlBD,IAkBC;;AAED,yCAAyC;AACzC;;GAEG;AACH;IAAgD,sDAAkB;IAAlE;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AAwC"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-filter.component.js b/src/app/+search-page/search-filters/search-filter/search-filter.component.js new file mode 100644 index 0000000000..c0e2b075b6 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-filter.component.js @@ -0,0 +1,128 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject, Input } from '@angular/core'; +import { of as observableOf } from 'rxjs'; +import { filter, map, startWith, switchMap, take } from 'rxjs/operators'; +import { SearchFilterConfig } from '../../search-service/search-filter-config.model'; +import { SearchFilterService } from './search-filter.service'; +import { slide } from '../../../shared/animations/slide'; +import { isNotEmpty } from '../../../shared/empty.util'; +import { SearchService } from '../../search-service/search.service'; +import { SearchConfigurationService } from '../../search-service/search-configuration.service'; +import { SEARCH_CONFIG_SERVICE } from '../../../+my-dspace-page/my-dspace-page.component'; +var SearchFilterComponent = /** @class */ (function () { + function SearchFilterComponent(filterService, searchService, searchConfigService) { + this.filterService = filterService; + this.searchService = searchService; + this.searchConfigService = searchConfigService; + /** + * True when the filter is 100% collapsed in the UI + */ + this.closed = true; + } + /** + * Requests the current set values for this filter + * If the filter config is open by default OR the filter has at least one value, the filter should be initially expanded + * Else, the filter should initially be collapsed + */ + SearchFilterComponent.prototype.ngOnInit = function () { + var _this = this; + this.selectedValues$ = this.getSelectedValues(); + this.active$ = this.isActive(); + this.collapsed$ = this.isCollapsed(); + this.initializeFilter(); + this.selectedValues$.pipe(take(1)).subscribe(function (selectedValues) { + if (isNotEmpty(selectedValues)) { + _this.filterService.expand(_this.filter.name); + } + }); + }; + /** + * Changes the state for this filter to collapsed when it's expanded and to expanded it when it's collapsed + */ + SearchFilterComponent.prototype.toggle = function () { + this.filterService.toggle(this.filter.name); + }; + /** + * Checks if the filter is currently collapsed + * @returns {Observable} Emits true when the current state of the filter is collapsed, false when it's expanded + */ + SearchFilterComponent.prototype.isCollapsed = function () { + return this.filterService.isCollapsed(this.filter.name); + }; + /** + * Sets the initial state of the filter + */ + SearchFilterComponent.prototype.initializeFilter = function () { + this.filterService.initializeFilter(this.filter); + }; + /** + * @returns {Observable} Emits a list of all values that are currently active for this filter + */ + SearchFilterComponent.prototype.getSelectedValues = function () { + return this.filterService.getSelectedValuesForFilter(this.filter); + }; + /** + * Method to change this.collapsed to false when the slide animation ends and is sliding open + * @param event The animation event + */ + SearchFilterComponent.prototype.finishSlide = function (event) { + if (event.fromState === 'collapsed') { + this.closed = false; + } + }; + /** + * Method to change this.collapsed to true when the slide animation starts and is sliding closed + * @param event The animation event + */ + SearchFilterComponent.prototype.startSlide = function (event) { + if (event.toState === 'collapsed') { + this.closed = true; + } + }; + /** + * Check if a given filter is supposed to be shown or not + * @returns {Observable} Emits true whenever a given filter config should be shown + */ + SearchFilterComponent.prototype.isActive = function () { + var _this = this; + return this.selectedValues$.pipe(switchMap(function (isActive) { + if (isNotEmpty(isActive)) { + return observableOf(true); + } + else { + return _this.searchConfigService.searchOptions.pipe(switchMap(function (options) { + return _this.searchService.getFacetValuesFor(_this.filter, 1, options).pipe(filter(function (RD) { return !RD.isLoading; }), map(function (valuesRD) { + return valuesRD.payload.totalElements > 0; + })); + })); + } + }), startWith(true)); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SearchFilterConfig) + ], SearchFilterComponent.prototype, "filter", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchFilterComponent.prototype, "inPlaceSearch", void 0); + SearchFilterComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-filter', + styleUrls: ['./search-filter.component.scss'], + templateUrl: './search-filter.component.html', + animations: [slide], + }) + /** + * Represents a part of the filter section for a single type of filter + */ + , + tslib_1.__param(2, Inject(SEARCH_CONFIG_SERVICE)), + tslib_1.__metadata("design:paramtypes", [SearchFilterService, + SearchService, + SearchConfigurationService]) + ], SearchFilterComponent); + return SearchFilterComponent; +}()); +export { SearchFilterComponent }; +//# sourceMappingURL=search-filter.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-filter.component.js.map b/src/app/+search-page/search-filters/search-filter/search-filter.component.js.map new file mode 100644 index 0000000000..5487ebcfd9 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-filter.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-filter.component.js","sourceRoot":"","sources":["search-filter.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAEjE,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,MAAM,EAAS,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEhF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,mDAAmD,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAY1F;IA+BE,+BACU,aAAkC,EAClC,aAA4B,EACG,mBAA+C;QAF9E,kBAAa,GAAb,aAAa,CAAqB;QAClC,kBAAa,GAAb,aAAa,CAAe;QACG,wBAAmB,GAAnB,mBAAmB,CAA4B;QAvBxF;;WAEG;QACH,WAAM,GAAG,IAAI,CAAC;IAqBd,CAAC;IAED;;;;OAIG;IACH,wCAAQ,GAAR;QAAA,iBAUC;QATC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAChD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,UA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e,CAAC,IAAI,CAC9B,SAAS,CAAC,UAAC,QAAQ;YACjB,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;gBACxB,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;aAC3B;iBAAM;gBACL,OAAO,KAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,IAAI,CAChD,SAAS,CAAC,UAAC,OAAO;oBACd,OAAO,KAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,KAAI,CAAC,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CACvE,MAAM,CAAC,UAAC,EAAE,IAAK,OAAA,CAAC,EAAE,CAAC,SAAS,EAAb,CAAa,CAAC,EAC7B,GAAG,CAAC,UAAC,QAAQ;wBACX,OAAO,QAAQ,CAAC,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;oBAC3C,CAAC,CAAC,CAAE,CAAA;gBACR,CAAC,CACF,CAAC,CAAA;aACL;QACH,CAAC,CAAC,EACF,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACrB,CAAC;IAzHQ;QAAR,KAAK,EAAE;0CAAS,kBAAkB;yDAAC;IAK3B;QAAR,KAAK,EAAE;;gEAAe;IATZ,qBAAqB;QAVjC,SAAS,CAAC;YACT,QAAQ,EAAE,kBAAkB;YAC5B,SAAS,EAAE,CAAC,gCAAgC,CAAC;YAC7C,WAAW,EAAE,gCAAgC;YAC7C,UAAU,EAAE,CAAC,KAAK,CAAC;SACpB,CAAC;QAEF;;WAEG;;QAmCE,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;iDAFP,mBAAmB;YACnB,aAAa;YACwB,0BAA0B;OAlC7E,qBAAqB,CA8HjC;IAAD,4BAAC;CAAA,AA9HD,IA8HC;SA9HY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-filter.reducer.js b/src/app/+search-page/search-filters/search-filter/search-filter.reducer.js new file mode 100644 index 0000000000..4faacb58ea --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-filter.reducer.js @@ -0,0 +1,77 @@ +import { SearchFilterActionTypes } from './search-filter.actions'; +var initialState = Object.create(null); +/** + * Performs a search filter action on the current state + * @param {SearchFiltersState} state The state before the action is performed + * @param {SearchFilterAction} action The action that should be performed + * @returns {SearchFiltersState} The state after the action is performed + */ +export function filterReducer(state, action) { + if (state === void 0) { state = initialState; } + var _a, _b, _c, _d, _e, _f, _g; + switch (action.type) { + case SearchFilterActionTypes.INITIALIZE: { + var initAction = action; + return Object.assign({}, state, (_a = {}, + _a[action.filterName] = { + filterCollapsed: !initAction.initiallyExpanded, + page: 1 + }, + _a)); + return state; + } + case SearchFilterActionTypes.COLLAPSE: { + return Object.assign({}, state, (_b = {}, + _b[action.filterName] = { + filterCollapsed: true, + page: state[action.filterName].page + }, + _b)); + } + case SearchFilterActionTypes.EXPAND: { + return Object.assign({}, state, (_c = {}, + _c[action.filterName] = { + filterCollapsed: false, + page: state[action.filterName].page + }, + _c)); + } + case SearchFilterActionTypes.DECREMENT_PAGE: { + var page = state[action.filterName].page - 1; + return Object.assign({}, state, (_d = {}, + _d[action.filterName] = { + filterCollapsed: state[action.filterName].filterCollapsed, + page: (page >= 1 ? page : 1) + }, + _d)); + } + case SearchFilterActionTypes.INCREMENT_PAGE: { + return Object.assign({}, state, (_e = {}, + _e[action.filterName] = { + filterCollapsed: state[action.filterName].filterCollapsed, + page: state[action.filterName].page + 1 + }, + _e)); + } + case SearchFilterActionTypes.RESET_PAGE: { + return Object.assign({}, state, (_f = {}, + _f[action.filterName] = { + filterCollapsed: state[action.filterName].filterCollapsed, + page: 1 + }, + _f)); + } + case SearchFilterActionTypes.TOGGLE: { + return Object.assign({}, state, (_g = {}, + _g[action.filterName] = { + filterCollapsed: !state[action.filterName].filterCollapsed, + page: state[action.filterName].page + }, + _g)); + } + default: { + return state; + } + } +} +//# sourceMappingURL=search-filter.reducer.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-filter.reducer.js.map b/src/app/+search-page/search-filters/search-filter/search-filter.reducer.js.map new file mode 100644 index 0000000000..b92bdebe3f --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-filter.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-filter.reducer.js","sourceRoot":"","sources":["search-filter.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,uBAAuB,EAAgC,MAAM,yBAAyB,CAAC;AAiBpH,IAAM,YAAY,GAAuB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,wBAAwB,KAAoB,EAAE,MAA0B;IAAhD,sBAAA,EAAA,oBAAoB;;IAEhD,QAAQ,MAAM,CAAC,IAAI,EAAE;QAEnB,KAAK,uBAAuB,CAAC,UAAU,CAAC,CAAC;YACvC,IAAM,UAAU,GAAI,MAAuC,CAAC;YAC5D,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK;gBAC5B,GAAC,MAAM,CAAC,UAAU,IAAG;oBACnB,eAAe,EAAE,CAAC,UAAU,CAAC,iBAAiB;oBAC9C,IAAI,EAAE,CAAC;iBACR;oBACD,CAAC;YACH,OAAO,KAAK,CAAC;SACd;QAED,KAAK,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YACrC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK;gBAC5B,GAAC,MAAM,CAAC,UAAU,IAAG;oBACnB,eAAe,EAAE,IAAI;oBACrB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI;iBACpC;oBACD,CAAC;SACJ;QAED,KAAK,uBAAuB,CAAC,MAAM,CAAC,CAAC;YACnC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK;gBAC5B,GAAC,MAAM,CAAC,UAAU,IAAG;oBACnB,eAAe,EAAE,KAAK;oBACtB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAA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C1D,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI;iBACpC;oBACD,CAAC;SAEJ;QAED,OAAO,CAAC,CAAC;YACP,OAAO,KAAK,CAAC;SACd;KACF;AACH,CAAC"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-filter.service.js b/src/app/+search-page/search-filters/search-filter/search-filter.service.js new file mode 100644 index 0000000000..968b10698e --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-filter.service.js @@ -0,0 +1,230 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest } from 'rxjs'; +import { mergeMap, map, distinctUntilChanged } from 'rxjs/operators'; +import { Injectable, InjectionToken } from '@angular/core'; +import { createSelector, select, Store } from '@ngrx/store'; +import { SearchFilterCollapseAction, SearchFilterDecrementPageAction, SearchFilterExpandAction, SearchFilterIncrementPageAction, SearchFilterInitializeAction, SearchFilterResetPageAction, SearchFilterToggleAction } from './search-filter.actions'; +import { hasValue, isNotEmpty, } from '../../../shared/empty.util'; +import { RouteService } from '../../../shared/services/route.service'; +import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model'; +import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; +import { SearchFixedFilterService } from './search-fixed-filter.service'; +// const spy = create(); +var filterStateSelector = function (state) { return state.searchFilter; }; +export var FILTER_CONFIG = new InjectionToken('filterConfig'); +export var IN_PLACE_SEARCH = new InjectionToken('inPlaceSearch'); +/** + * Service that performs all actions that have to do with search filters and facets + */ +var SearchFilterService = /** @class */ (function () { + function SearchFilterService(store, routeService, fixedFilterService) { + this.store = store; + this.routeService = routeService; + this.fixedFilterService = fixedFilterService; + } + /** + * Checks if a given filter is active with a given value + * @param {string} paramName The parameter name of the filter's configuration for which to search + * @param {string} filterValue The value for which to search + * @returns {Observable} Emit true when the filter is active with the given value + */ + SearchFilterService.prototype.isFilterActiveWithValue = function (paramName, filterValue) { + return this.routeService.hasQueryParamWithValue(paramName, filterValue); + }; + /** + * Checks if a given filter is active with any value + * @param {string} paramName The parameter name of the filter's configuration for which to search + * @returns {Observable} Emit true when the filter is active with any value + */ + SearchFilterService.prototype.isFilterActive = function (paramName) { + return this.routeService.hasQueryParam(paramName); + }; + /** + * Fetch the current active scope from the query parameters + * @returns {Observable} + */ + SearchFilterService.prototype.getCurrentScope = function () { + return this.routeService.getQueryParameterValue('scope'); + }; + /** + * Fetch the current query from the query parameters + * @returns {Observable} + */ + SearchFilterService.prototype.getCurrentQuery = function () { + return this.routeService.getQueryParameterValue('query'); + }; + /** + * Fetch the current pagination from query parameters 'page' and 'pageSize' + * and combine them with a given pagination + * @param pagination Pagination options to combine the query parameters with + * @returns {Observable} + */ + SearchFilterService.prototype.getCurrentPagination = function (pagination) { + if (pagination === void 0) { pagination = {}; } + var page$ = this.routeService.getQueryParameterValue('page'); + var size$ = this.routeService.getQueryParameterValue('pageSize'); + return observableCombineLatest(page$, size$).pipe(map(function (_a) { + var page = _a[0], size = _a[1]; + return Object.assign(new PaginationComponentOptions(), pagination, { + currentPage: page || 1, + pageSize: size || pagination.pageSize + }); + })); + }; + /** + * Fetch the current sorting options from query parameters 'sortDirection' and 'sortField' + * and combine them with given sorting options + * @param {SortOptions} defaultSort Sorting options to combine the query parameters with + * @returns {Observable} + */ + SearchFilterService.prototype.getCurrentSort = function (defaultSort) { + var sortDirection$ = this.routeService.getQueryParameterValue('sortDirection'); + var sortField$ = this.routeService.getQueryParameterValue('sortField'); + return observableCombineLatest(sortDirection$, sortField$).pipe(map(function (_a) { + var sortDirection = _a[0], sortField = _a[1]; + var field = sortField || defaultSort.field; + var direction = SortDirection[sortDirection] || defaultSort.direction; + return new SortOptions(field, direction); + })); + }; + /** + * Fetch the current active filters from the query parameters + * @returns {Observable} + */ + SearchFilterService.prototype.getCurrentFilters = function () { + return this.routeService.getQueryParamsWithPrefix('f.'); + }; + /** + * Fetch the current active fixed filter from the route parameters and return the query by filter name + * @returns {Observable} + */ + SearchFilterService.prototype.getCurrentFixedFilter = function () { + var _this = this; + var filter = this.routeService.getRouteParameterValue('filter'); + return filter.pipe(mergeMap(function (f) { return _this.fixedFilterService.getQueryByFilterName(f); })); + }; + /** + * Fetch the current view from the query parameters + * @returns {Observable} + */ + SearchFilterService.prototype.getCurrentView = function () { + return this.routeService.getQueryParameterValue('view'); + }; + /** + * Requests the active filter values set for a given filter + * @param {SearchFilterConfig} filterConfig The configuration for which the filters are active + * @returns {Observable} Emits the active filters for the given filter configuration + */ + SearchFilterService.prototype.getSelectedValuesForFilter = function (filterConfig) { + var values$ = this.routeService.getQueryParameterValues(filterConfig.paramName); + var prefixValues$ = this.routeService.getQueryParamsWithPrefix(filterConfig.paramName + '.').pipe(map(function (params) { return [].concat.apply([], Object.values(params)); })); + return observableCombineLatest(values$, prefixValues$).pipe(map(function (_a) { + var values = _a[0], prefixValues = _a[1]; + if (isNotEmpty(values)) { + return values; + } + return prefixValues; + })); + }; + /** + * Checks if the state of a given filter is currently collapsed or not + * @param {string} filterName The filtername for which the collapsed state is checked + * @returns {Observable} Emits the current collapsed state of the given filter, if it's unavailable, return false + */ + SearchFilterService.prototype.isCollapsed = function (filterName) { + return this.store.pipe(select(filterByNameSelector(filterName)), map(function (object) { + if (object) { + return object.filterCollapsed; + } + else { + return false; + } + }), distinctUntilChanged()); + }; + /** + * Request the current page of a given filter + * @param {string} filterName The filter name for which the page state is checked + * @returns {Observable} Emits the current page state of the given filter, if it's unavailable, return 1 + */ + SearchFilterService.prototype.getPage = function (filterName) { + return this.store.pipe(select(filterByNameSelector(filterName)), map(function (object) { + if (object) { + return object.page; + } + else { + return 1; + } + }), distinctUntilChanged()); + }; + /** + * Dispatches a collapse action to the store for a given filter + * @param {string} filterName The filter for which the action is dispatched + */ + SearchFilterService.prototype.collapse = function (filterName) { + this.store.dispatch(new SearchFilterCollapseAction(filterName)); + }; + /** + * Dispatches an expand action to the store for a given filter + * @param {string} filterName The filter for which the action is dispatched + */ + SearchFilterService.prototype.expand = function (filterName) { + this.store.dispatch(new SearchFilterExpandAction(filterName)); + }; + /** + * Dispatches a toggle action to the store for a given filter + * @param {string} filterName The filter for which the action is dispatched + */ + SearchFilterService.prototype.toggle = function (filterName) { + this.store.dispatch(new SearchFilterToggleAction(filterName)); + }; + /** + * Dispatches an initialize action to the store for a given filter + * @param {SearchFilterConfig} filter The filter for which the action is dispatched + */ + SearchFilterService.prototype.initializeFilter = function (filter) { + this.store.dispatch(new SearchFilterInitializeAction(filter)); + }; + /** + * Dispatches a decrement action to the store for a given filter + * @param {string} filterName The filter for which the action is dispatched + */ + SearchFilterService.prototype.decrementPage = function (filterName) { + this.store.dispatch(new SearchFilterDecrementPageAction(filterName)); + }; + /** + * Dispatches an increment page action to the store for a given filter + * @param {string} filterName The filter for which the action is dispatched + */ + SearchFilterService.prototype.incrementPage = function (filterName) { + this.store.dispatch(new SearchFilterIncrementPageAction(filterName)); + }; + /** + * Dispatches a reset page action to the store for a given filter + * @param {string} filterName The filter for which the action is dispatched + */ + SearchFilterService.prototype.resetPage = function (filterName) { + this.store.dispatch(new SearchFilterResetPageAction(filterName)); + }; + SearchFilterService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Store, + RouteService, + SearchFixedFilterService]) + ], SearchFilterService); + return SearchFilterService; +}()); +export { SearchFilterService }; +function filterByNameSelector(name) { + return keySelector(name); +} +export function keySelector(key) { + return createSelector(filterStateSelector, function (state) { + if (hasValue(state)) { + return state[key]; + } + else { + return undefined; + } + }); +} +//# sourceMappingURL=search-filter.service.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-filter.service.js.map b/src/app/+search-page/search-filters/search-filter/search-filter.service.js.map new file mode 100644 index 0000000000..301699c23b --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-filter.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-filter.service.js","sourceRoot":"","sources":["search-filter.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,IAAI,uB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filter.service.js b/src/app/+search-page/search-filters/search-filter/search-fixed-filter.service.js new file mode 100644 index 0000000000..abdd3cf6b7 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-fixed-filter.service.js @@ -0,0 +1,73 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { map } from 'rxjs/operators'; +import { of as observableOf } from 'rxjs'; +import { HALEndpointService } from '../../../core/shared/hal-endpoint.service'; +import { GetRequest } from '../../../core/data/request.models'; +import { RequestService } from '../../../core/data/request.service'; +import { FilteredDiscoveryPageResponseParsingService } from '../../../core/data/filtered-discovery-page-response-parsing.service'; +import { hasValue } from '../../../shared/empty.util'; +import { configureRequest, getResponseFromEntry } from '../../../core/shared/operators'; +import { RouteService } from '../../../shared/services/route.service'; +/** + * Service for performing actions on the filtered-discovery-pages REST endpoint + */ +var SearchFixedFilterService = /** @class */ (function () { + function SearchFixedFilterService(routeService, requestService, halService) { + this.routeService = routeService; + this.requestService = requestService; + this.halService = halService; + this.queryByFilterPath = 'filtered-discovery-pages'; + } + /** + * Get the filter query for a certain filter by name + * @param {string} filterName Name of the filter + * @returns {Observable} Filter query + */ + SearchFixedFilterService.prototype.getQueryByFilterName = function (filterName) { + if (hasValue(filterName)) { + var requestUuid_1 = this.requestService.generateRequestId(); + this.halService.getEndpoint(this.queryByFilterPath).pipe(map(function (url) { + url += ('/' + filterName); + var request = new GetRequest(requestUuid_1, url); + return Object.assign(request, { + getResponseParser: function () { + return FilteredDiscoveryPageResponseParsingService; + } + }); + }), configureRequest(this.requestService)).subscribe(); + // get search results from response cache + var filterQuery = this.requestService.getByUUID(requestUuid_1).pipe(getResponseFromEntry(), map(function (response) { + return response.filterQuery; + })); + return filterQuery; + } + return observableOf(undefined); + }; + /** + * Get the query for looking up items by relation type + * @param {string} relationType Relation type + * @param {string} itemUUID Item UUID + * @returns {string} Query + */ + SearchFixedFilterService.prototype.getQueryByRelations = function (relationType, itemUUID) { + return "query=relation." + relationType + ":" + itemUUID; + }; + /** + * Get the filter for a relation with the item's UUID + * @param relationType The type of relation e.g. 'isAuthorOfPublication' + * @param itemUUID The item's UUID + */ + SearchFixedFilterService.prototype.getFilterByRelation = function (relationType, itemUUID) { + return "f." + relationType + "=" + itemUUID; + }; + SearchFixedFilterService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RouteService, + RequestService, + HALEndpointService]) + ], SearchFixedFilterService); + return SearchFixedFilterService; +}()); +export { SearchFixedFilterService }; +//# sourceMappingURL=search-fixed-filter.service.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-fixed-filter.service.js.map b/src/app/+search-page/search-filters/search-filter/search-fixed-filter.service.js.map new file mode 100644 index 0000000000..c8db35eb42 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-fixed-filter.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-fixed-filter.service.js","sourceRoot":"","sources":["search-fixed-filter.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAW,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAgB,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAe,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGpE,OAAO,EAAE,2CAA2C,EAAE,MAAM,qEAAqE,CAAC;AAClI,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAGtE;;GAEG;AAEH;IAGE,kCAAoB,YAA0B,EACxB,cAA8B,EAChC,UAA8B;QAF9B,iBAAY,GA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B;QACxD,OAAO,OAAK,YAAY,SAAI,QAAU,CAAC;IACzC,CAAC;IA1DU,wBAAwB;QADpC,UAAU,EAAE;iDAIuB,YAAY;YACR,cAAc;YACpB,kBAAkB;OALvC,wBAAwB,CA4DpC;IAAD,+BAAC;CAAA,AA5DD,IA4DC;SA5DY,wBAAwB"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.js b/src/app/+search-page/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.js new file mode 100644 index 0000000000..09c692a143 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { FilterType } from '../../../search-service/filter-type.model'; +import { renderFacetFor } from '../search-filter-type-decorator'; +import { facetLoad, SearchFacetFilterComponent } from '../search-facet-filter/search-facet-filter.component'; +var SearchHierarchyFilterComponent = /** @class */ (function (_super) { + tslib_1.__extends(SearchHierarchyFilterComponent, _super); + function SearchHierarchyFilterComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + SearchHierarchyFilterComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-hierarchy-filter', + styleUrls: ['./search-hierarchy-filter.component.scss'], + templateUrl: './search-hierarchy-filter.component.html', + animations: [facetLoad] + }) + /** + * Component that represents a hierarchy facet for a specific filter configuration + */ + , + renderFacetFor(FilterType.hierarchy) + ], SearchHierarchyFilterComponent); + return SearchHierarchyFilterComponent; +}(SearchFacetFilterComponent)); +export { SearchHierarchyFilterComponent }; +//# sourceMappingURL=search-hierarchy-filter.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.js.map b/src/app/+search-page/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.js.map new file mode 100644 index 0000000000..d8838f8f27 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-hierarchy-filter.component.js","sourceRoot":"","sources":["search-hierarchy-filter.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EACL,SAAS,EACT,0BAA0B,EAC3B,MAAM,sDAAsD,CAAC;AAa9D;IAAoD,0DAA0B;IAA9E;;IACA,CAAC;IADY,8BAA8B;QAX1C,SAAS,CAAC;YACT,QAAQ,EAAE,4BAA4B;YACtC,SAAS,EAAE,CAAC,0CAA0C,CAAC;YACvD,WAAW,EAAE,0CAA0C;YACvD,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC;QAEF;;WAEG;;QACF,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC;OACxB,8BAA8B,CAC1C;IAAD,qCAAC;CAAA,AADD,CAAoD,0BAA0B,GAC7E;SADY,8BAA8B"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.js b/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.js new file mode 100644 index 0000000000..ff1ccbacb5 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.js @@ -0,0 +1,135 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest } from 'rxjs'; +import { map, startWith } from 'rxjs/operators'; +import { isPlatformBrowser } from '@angular/common'; +import { Component, Inject, PLATFORM_ID } from '@angular/core'; +import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service'; +import { FilterType } from '../../../search-service/filter-type.model'; +import { renderFacetFor } from '../search-filter-type-decorator'; +import { facetLoad, SearchFacetFilterComponent } from '../search-facet-filter/search-facet-filter.component'; +import { SearchFilterConfig } from '../../../search-service/search-filter-config.model'; +import { FILTER_CONFIG, IN_PLACE_SEARCH, SearchFilterService } from '../search-filter.service'; +import { SearchService } from '../../../search-service/search.service'; +import { Router } from '@angular/router'; +import * as moment from 'moment'; +import { RouteService } from '../../../../shared/services/route.service'; +import { hasValue } from '../../../../shared/empty.util'; +import { SearchConfigurationService } from '../../../search-service/search-configuration.service'; +import { SEARCH_CONFIG_SERVICE } from '../../../../+my-dspace-page/my-dspace-page.component'; +/** + * The suffix for a range filters' minimum in the frontend URL + */ +export var RANGE_FILTER_MIN_SUFFIX = '.min'; +/** + * The suffix for a range filters' maximum in the frontend URL + */ +export var RANGE_FILTER_MAX_SUFFIX = '.max'; +/** + * The date formats that are possible to appear in a date filter + */ +var dateFormats = ['YYYY', 'YYYY-MM', 'YYYY-MM-DD']; +/** + * This component renders a simple item page. + * The route parameter 'id' is used to request the item it represents. + * All fields of the item that should be displayed, are defined in its template. + */ +var SearchRangeFilterComponent = /** @class */ (function (_super) { + tslib_1.__extends(SearchRangeFilterComponent, _super); + function SearchRangeFilterComponent(searchService, filterService, router, rdbs, searchConfigService, inPlaceSearch, filterConfig, platformId, route) { + var _this = _super.call(this, searchService, filterService, rdbs, router, searchConfigService, inPlaceSearch, filterConfig) || this; + _this.searchService = searchService; + _this.filterService = filterService; + _this.router = router; + _this.rdbs = rdbs; + _this.searchConfigService = searchConfigService; + _this.inPlaceSearch = inPlaceSearch; + _this.filterConfig = filterConfig; + _this.platformId = platformId; + _this.route = route; + /** + * Fallback minimum for the range + */ + _this.min = 1950; + /** + * Fallback maximum for the range + */ + _this.max = 2018; + return _this; + } + /** + * Initialize with the min and max values as configured in the filter configuration + * Set the initial values of the range + */ + SearchRangeFilterComponent.prototype.ngOnInit = function () { + var _this = this; + _super.prototype.ngOnInit.call(this); + this.min = moment(this.filterConfig.minValue, dateFormats).year() || this.min; + this.max = moment(this.filterConfig.maxValue, dateFormats).year() || this.max; + var iniMin = this.route.getQueryParameterValue(this.filterConfig.paramName + RANGE_FILTER_MIN_SUFFIX).pipe(startWith(undefined)); + var iniMax = this.route.getQueryParameterValue(this.filterConfig.paramName + RANGE_FILTER_MAX_SUFFIX).pipe(startWith(undefined)); + this.sub = observableCombineLatest(iniMin, iniMax).pipe(map(function (_a) { + var min = _a[0], max = _a[1]; + var minimum = hasValue(min) ? min : _this.min; + var maximum = hasValue(max) ? max : _this.max; + return [minimum, maximum]; + })).subscribe(function (minmax) { return _this.range = minmax; }); + }; + /** + * Submits new custom range values to the range filter from the widget + */ + SearchRangeFilterComponent.prototype.onSubmit = function () { + var _a; + var newMin = this.range[0] !== this.min ? [this.range[0]] : null; + var newMax = this.range[1] !== this.max ? [this.range[1]] : null; + this.router.navigate(this.getSearchLinkParts(), { + queryParams: (_a = {}, + _a[this.filterConfig.paramName + RANGE_FILTER_MIN_SUFFIX] = newMin, + _a[this.filterConfig.paramName + RANGE_FILTER_MAX_SUFFIX] = newMax, + _a), + queryParamsHandling: 'merge' + }); + this.filter = ''; + }; + /** + * TODO when upgrading nouislider, verify that this check is still needed. + * Prevents AoT bug + * @returns {boolean} True if the platformId is a platform browser + */ + SearchRangeFilterComponent.prototype.shouldShowSlider = function () { + return isPlatformBrowser(this.platformId); + }; + /** + * Unsubscribe from all subscriptions + */ + SearchRangeFilterComponent.prototype.ngOnDestroy = function () { + _super.prototype.ngOnDestroy.call(this); + if (hasValue(this.sub)) { + this.sub.unsubscribe(); + } + }; + SearchRangeFilterComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-range-filter', + styleUrls: ['./search-range-filter.component.scss'], + templateUrl: './search-range-filter.component.html', + animations: [facetLoad] + }) + /** + * Component that represents a range facet for a specific filter configuration + */ + , + renderFacetFor(FilterType.range), + tslib_1.__param(4, Inject(SEARCH_CONFIG_SERVICE)), + tslib_1.__param(5, Inject(IN_PLACE_SEARCH)), + tslib_1.__param(6, Inject(FILTER_CONFIG)), + tslib_1.__param(7, Inject(PLATFORM_ID)), + tslib_1.__metadata("design:paramtypes", [SearchService, + SearchFilterService, + Router, + RemoteDataBuildService, + SearchConfigurationService, Boolean, SearchFilterConfig, Object, RouteService]) + ], SearchRangeFilterComponent); + return SearchRangeFilterComponent; +}(SearchFacetFilterComponent)); +export { SearchRangeFilterComponent }; +//# sourceMappingURL=search-range-filter.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.js.map b/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.js.map new file mode 100644 index 0000000000..bed7729db0 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-range-filter/search-range-filter.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-range-filter.component.js","sourceRoot":"","sources":["search-range-filter.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAgB,MAAM,MAAM,CAAC;AAC9E,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAqB,WAAW,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,2DAA2D,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EACL,SAAS,EACT,0BAA0B,EAC3B,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,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;QACrB,mBAAA,MAAM,CAAC,WAAW,CAAC,CAAA;iDAPK,aAAa;YACb,mBAAmB;YAC1B,MAAM;YACR,sBAAsB;YACqB,0BAA0B,WAEzC,kBAAkB,UAE/C,YAAY;OA7B5B,0BAA0B,CAwFtC;IAAD,iCAAC;CAAA,AAxFD,CAAgD,0BAA0B,GAwFzE;SAxFY,0BAA0B"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-text-filter/search-text-filter.component.js b/src/app/+search-page/search-filters/search-filter/search-text-filter/search-text-filter.component.js new file mode 100644 index 0000000000..18d28f8e62 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-text-filter/search-text-filter.component.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { FilterType } from '../../../search-service/filter-type.model'; +import { facetLoad, SearchFacetFilterComponent } from '../search-facet-filter/search-facet-filter.component'; +import { renderFacetFor } from '../search-filter-type-decorator'; +/** + * This component renders a simple item page. + * The route parameter 'id' is used to request the item it represents. + * All fields of the item that should be displayed, are defined in its template. + */ +var SearchTextFilterComponent = /** @class */ (function (_super) { + tslib_1.__extends(SearchTextFilterComponent, _super); + function SearchTextFilterComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + SearchTextFilterComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-text-filter', + styleUrls: ['./search-text-filter.component.scss'], + templateUrl: './search-text-filter.component.html', + animations: [facetLoad] + }) + /** + * Component that represents a text facet for a specific filter configuration + */ + , + renderFacetFor(FilterType.text) + ], SearchTextFilterComponent); + return SearchTextFilterComponent; +}(SearchFacetFilterComponent)); +export { SearchTextFilterComponent }; +//# sourceMappingURL=search-text-filter.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filter/search-text-filter/search-text-filter.component.js.map b/src/app/+search-page/search-filters/search-filter/search-text-filter/search-text-filter.component.js.map new file mode 100644 index 0000000000..71627953b9 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filter/search-text-filter/search-text-filter.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-text-filter.component.js","sourceRoot":"","sources":["search-text-filter.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EACL,SAAS,EACT,0BAA0B,EAC3B,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;;;GAIG;AAaH;IAA+C,qDAA0B;IAAzE;;IACA,CAAC;IADY,yBAAyB;QAXrC,SAAS,CAAC;YACT,QAAQ,EAAE,uBAAuB;YACjC,SAAS,EAAE,CAAC,qCAAqC,CAAC;YAClD,WAAW,EAAE,qCAAqC;YAClD,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC;QAEF;;WAEG;;QACF,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC;OACnB,yBAAyB,CACrC;IAAD,gCAAC;CAAA,AADD,CAA+C,0BAA0B,GACxE;SADY,yBAAyB"} \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filters.component.js b/src/app/+search-page/search-filters/search-filters.component.js new file mode 100644 index 0000000000..6891734cde --- /dev/null +++ b/src/app/+search-page/search-filters/search-filters.component.js @@ -0,0 +1,66 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject, Input } from '@angular/core'; +import { map, switchMap } from 'rxjs/operators'; +import { SearchService } from '../search-service/search.service'; +import { SearchConfigurationService } from '../search-service/search-configuration.service'; +import { SearchFilterService } from './search-filter/search-filter.service'; +import { getSucceededRemoteData } from '../../core/shared/operators'; +import { SEARCH_CONFIG_SERVICE } from '../../+my-dspace-page/my-dspace-page.component'; +var SearchFiltersComponent = /** @class */ (function () { + /** + * Initialize instance variables + * @param {SearchService} searchService + * @param {SearchConfigurationService} searchConfigService + * @param {SearchFilterService} filterService + */ + function SearchFiltersComponent(searchService, filterService, searchConfigService) { + this.searchService = searchService; + this.filterService = filterService; + this.searchConfigService = searchConfigService; + } + SearchFiltersComponent.prototype.ngOnInit = function () { + var _this = this; + this.filters = this.searchConfigService.searchOptions.pipe(switchMap(function (options) { return _this.searchService.getConfig(options.scope, options.configuration).pipe(getSucceededRemoteData()); })); + this.clearParams = this.searchConfigService.getCurrentFrontendFilters().pipe(map(function (filters) { + Object.keys(filters).forEach(function (f) { return filters[f] = null; }); + return filters; + })); + }; + /** + * @returns {string} The base path to the search page, or the current page when inPlaceSearch is true + */ + SearchFiltersComponent.prototype.getSearchLink = function () { + if (this.inPlaceSearch) { + return './'; + } + return this.searchService.getSearchLink(); + }; + /** + * Prevent unnecessary rerendering + */ + SearchFiltersComponent.prototype.trackUpdate = function (index, config) { + return config ? config.name : undefined; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchFiltersComponent.prototype, "inPlaceSearch", void 0); + SearchFiltersComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-filters', + styleUrls: ['./search-filters.component.scss'], + templateUrl: './search-filters.component.html', + }) + /** + * This component represents the part of the search sidebar that contains filters. + */ + , + tslib_1.__param(2, Inject(SEARCH_CONFIG_SERVICE)), + tslib_1.__metadata("design:paramtypes", [SearchService, + SearchFilterService, + SearchConfigurationService]) + ], SearchFiltersComponent); + return SearchFiltersComponent; +}()); +export { SearchFiltersComponent }; +//# sourceMappingURL=search-filters.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-filters/search-filters.component.js.map b/src/app/+search-page/search-filters/search-filters.component.js.map new file mode 100644 index 0000000000..bb04fb1904 --- /dev/null +++ b/src/app/+search-page/search-filters/search-filters.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-filters.component.js","sourceRoot":"","sources":["search-filters.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAGjE,OAAO,EAAE,GAAG,EA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C,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,4CAAW,GAAX,UAAY,KAAK,EAAE,MAA0B;QAC3C,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1C,CAAC;IA1CQ;QAAR,KAAK,EAAE;;iEAAe;IAfZ,sBAAsB;QATlC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,SAAS,EAAE,CAAC,iCAAiC,CAAC;YAC9C,WAAW,EAAE,iCAAiC;SAC/C,CAAC;QAEF;;WAEG;;QA2BE,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;iDAFP,aAAa;YACb,mBAAmB;YACkB,0BAA0B;OA1B7E,sBAAsB,CA2DlC;IAAD,6BAAC;CAAA,AA3DD,IA2DC;SA3DY,sBAAsB"} \ No newline at end of file diff --git a/src/app/+search-page/search-labels/search-labels.component.js b/src/app/+search-page/search-labels/search-labels.component.js new file mode 100644 index 0000000000..220e4c9d5a --- /dev/null +++ b/src/app/+search-page/search-labels/search-labels.component.js @@ -0,0 +1,76 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject, Input } from '@angular/core'; +import { SearchService } from '../search-service/search.service'; +import { map } from 'rxjs/operators'; +import { hasValue, isNotEmpty } from '../../shared/empty.util'; +import { SearchConfigurationService } from '../search-service/search-configuration.service'; +import { SEARCH_CONFIG_SERVICE } from '../../+my-dspace-page/my-dspace-page.component'; +var SearchLabelsComponent = /** @class */ (function () { + /** + * Initialize the instance variable + */ + function SearchLabelsComponent(searchService, searchConfigService) { + this.searchService = searchService; + this.searchConfigService = searchConfigService; + this.appliedFilters = this.searchConfigService.getCurrentFrontendFilters(); + } + /** + * Calculates the parameters that should change if a given value for the given filter would be removed from the active filters + * @param {string} filterField The filter field parameter name from which the value should be removed + * @param {string} filterValue The value that is removed for this given filter field + * @returns {Observable} The changed filter parameters + */ + SearchLabelsComponent.prototype.getRemoveParams = function (filterField, filterValue) { + return this.appliedFilters.pipe(map(function (filters) { + var _a; + var field = Object.keys(filters).find(function (f) { return f === filterField; }); + var newValues = hasValue(filters[field]) ? filters[field].filter(function (v) { return v !== filterValue; }) : null; + return _a = {}, + _a[field] = isNotEmpty(newValues) ? newValues : null, + _a.page = 1, + _a; + })); + }; + /** + * @returns {string} The base path to the search page, or the current page when inPlaceSearch is true + */ + SearchLabelsComponent.prototype.getSearchLink = function () { + if (this.inPlaceSearch) { + return './'; + } + return this.searchService.getSearchLink(); + }; + /** + * TODO to review after https://github.com/DSpace/dspace-angular/issues/368 is resolved + * Strips authority operator from filter value + * e.g. 'test ,authority' => 'test' + * + * @param value + */ + SearchLabelsComponent.prototype.normalizeFilterValue = function (value) { + // const pattern = /,[^,]*$/g; + var pattern = /,authority*$/g; + return value.replace(pattern, ''); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchLabelsComponent.prototype, "inPlaceSearch", void 0); + SearchLabelsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-labels', + styleUrls: ['./search-labels.component.scss'], + templateUrl: './search-labels.component.html', + }) + /** + * Component that represents the labels containing the currently active filters + */ + , + tslib_1.__param(1, Inject(SEARCH_CONFIG_SERVICE)), + tslib_1.__metadata("design:paramtypes", [SearchService, + SearchConfigurationService]) + ], SearchLabelsComponent); + return SearchLabelsComponent; +}()); +export { SearchLabelsComponent }; +//# sourceMappingURL=search-labels.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-labels/search-labels.component.js.map b/src/app/+search-page/search-labels/search-labels.component.js.map new file mode 100644 index 0000000000..8667c2d341 --- /dev/null +++ b/src/app/+search-page/search-labels/search-labels.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-labels.component.js","sourceRoot":"","sources":["search-labels.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAA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C;SACb;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACH,oDAAoB,GAApB,UAAqB,KAAa;QAChC,8BAA8B;QAC9B,IAAM,OAAO,GAAG,eAAe,CAAC;QAChC,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACpC,CAAC;IAnDQ;QAAR,KAAK,EAAE;;gEAAe;IATZ,qBAAqB;QATjC,SAAS,CAAC;YACT,QAAQ,EAAE,kBAAkB;YAC5B,SAAS,EAAE,CAAC,gCAAgC,CAAC;YAC7C,WAAW,EAAE,gCAAgC;SAC9C,CAAC;QAEF;;WAEG;;QAiBE,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;iDADP,aAAa;YACuB,0BAA0B;OAhB5E,qBAAqB,CA6DjC;IAAD,4BAAC;CAAA,AA7DD,IA6DC;SA7DY,qBAAqB"} \ No newline at end of file diff --git a/src/app/+search-page/search-options.model.js b/src/app/+search-page/search-options.model.js new file mode 100644 index 0000000000..5ef1cf890e --- /dev/null +++ b/src/app/+search-page/search-options.model.js @@ -0,0 +1,57 @@ +import { isNotEmpty } from '../shared/empty.util'; +import { URLCombiner } from '../core/url-combiner/url-combiner'; +import 'core-js/library/fn/object/entries'; +import { SetViewMode } from '../shared/view-mode'; +/** + * This model class represents all parameters needed to request information about a certain search request + */ +var SearchOptions = /** @class */ (function () { + function SearchOptions(options) { + this.view = SetViewMode.List; + this.configuration = options.configuration; + this.scope = options.scope; + this.query = options.query; + this.dsoType = options.dsoType; + this.filters = options.filters; + this.fixedFilter = options.fixedFilter; + } + /** + * Method to generate the URL that can be used request information about a search request + * @param {string} url The URL to the REST endpoint + * @param {string[]} args A list of query arguments that should be included in the URL + * @returns {string} URL with all search options and passed arguments as query parameters + */ + SearchOptions.prototype.toRestUrl = function (url, args) { + if (args === void 0) { args = []; } + if (isNotEmpty(this.configuration)) { + args.push("configuration=" + this.configuration); + } + if (isNotEmpty(this.fixedFilter)) { + args.push(this.fixedFilter); + } + if (isNotEmpty(this.query)) { + args.push("query=" + this.query); + } + if (isNotEmpty(this.scope)) { + args.push("scope=" + this.scope); + } + if (isNotEmpty(this.dsoType)) { + args.push("dsoType=" + this.dsoType); + } + if (isNotEmpty(this.filters)) { + this.filters.forEach(function (filter) { + filter.values.forEach(function (value) { + var filterValue = value.includes(',') ? "" + value : value + "," + filter.operator; + args.push(filter.key + "=" + filterValue); + }); + }); + } + if (isNotEmpty(args)) { + url = new URLCombiner(url, "?" + args.join('&')).toString(); + } + return url; + }; + return SearchOptions; +}()); +export { SearchOptions }; +//# sourceMappingURL=search-options.model.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-options.model.js.map b/src/app/+search-page/search-options.model.js.map new file mode 100644 index 0000000000..fce041dabd --- /dev/null +++ b/src/app/+search-page/search-options.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-options.model.js","sourceRoot":"","sources":["search-options.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,mCAAmC,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;GAEG;AACH;IASE,uBAAY,OAA0I;QAPtJ,SAAI,GAAiB,WAAW,CAAC,IAAI,CAAC;QAQlC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAC3C,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,CAAC,GAAG,EAAE,MAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;SAC7D;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACH,oBAAC;AAAD,CAAC,AArDD,IAqDC"} \ No newline at end of file diff --git a/src/app/+search-page/search-page-routing.module.js b/src/app/+search-page/search-page-routing.module.js new file mode 100644 index 0000000000..1f9647fcd1 --- /dev/null +++ b/src/app/+search-page/search-page-routing.module.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { SearchPageComponent } from './search-page.component'; +import { FilteredSearchPageComponent } from './filtered-search-page.component'; +import { FilteredSearchPageGuard } from './filtered-search-page.guard'; +var SearchPageRoutingModule = /** @class */ (function () { + function SearchPageRoutingModule() { + } + SearchPageRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: SearchPageComponent, data: { title: 'search.title' } }, + { path: ':filter', component: FilteredSearchPageComponent, canActivate: [FilteredSearchPageGuard], data: { title: 'search.' } } + ]) + ] + }) + ], SearchPageRoutingModule); + return SearchPageRoutingModule; +}()); +export { SearchPageRoutingModule }; +//# sourceMappingURL=search-page-routing.module.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-page-routing.module.js.map b/src/app/+search-page/search-page-routing.module.js.map new file mode 100644 index 0000000000..f732e3deb7 --- /dev/null +++ b/src/app/+search-page/search-page-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-page-routing.module.js","sourceRoot":"","sources":["search-page-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAUvE;IAAA;IAAuC,CAAC;IAA3B,uBAAuB;QARnC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;oBAC7E,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,2BAA2B,EAAE,WAAW,EAAE,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAC;iBAC/H,CAAC;aACH;SACF,CAAC;OACW,uBAAuB,CAAI;IAAD,8BAAC;CAAA,AAAxC,IAAwC;SAA3B,uBAAuB"} \ No newline at end of file diff --git a/src/app/+search-page/search-page.component.js b/src/app/+search-page/search-page.component.js new file mode 100644 index 0000000000..108971af35 --- /dev/null +++ b/src/app/+search-page/search-page.component.js @@ -0,0 +1,152 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, Component, Inject, Input } from '@angular/core'; +import { Observable, BehaviorSubject } from 'rxjs'; +import { switchMap, } from 'rxjs/operators'; +import { pushInOut } from '../shared/animations/push'; +import { HostWindowService } from '../shared/host-window.service'; +import { SearchService } from './search-service/search.service'; +import { SearchSidebarService } from './search-sidebar/search-sidebar.service'; +import { hasValue, isNotEmpty } from '../shared/empty.util'; +import { SearchConfigurationService } from './search-service/search-configuration.service'; +import { getSucceededRemoteData } from '../core/shared/operators'; +import { RouteService } from '../shared/services/route.service'; +import { SEARCH_CONFIG_SERVICE } from '../+my-dspace-page/my-dspace-page.component'; +export var SEARCH_ROUTE = '/search'; +/** + * This component renders a simple item page. + * The route parameter 'id' is used to request the item it represents. + * All fields of the item that should be displayed, are defined in its template. + */ +var SearchPageComponent = /** @class */ (function () { + function SearchPageComponent(service, sidebarService, windowService, searchConfigService, routeService) { + this.service = service; + this.sidebarService = sidebarService; + this.windowService = windowService; + this.searchConfigService = searchConfigService; + this.routeService = routeService; + /** + * The current search results + */ + this.resultsRD$ = new BehaviorSubject(null); + /** + * True when the search component should show results on the current page + */ + this.inPlaceSearch = true; + /** + * Whether or not the search bar should be visible + */ + this.searchEnabled = true; + /** + * The width of the sidebar (bootstrap columns) + */ + this.sideBarWidth = 3; + this.isXsOrSm$ = this.windowService.isXsOrSm(); + } + /** + * Listening to changes in the paginated search options + * If something changes, update the search results + * + * Listen to changes in the scope + * If something changes, update the list of scopes for the dropdown + */ + SearchPageComponent.prototype.ngOnInit = function () { + var _this = this; + this.searchOptions$ = this.getSearchOptions(); + this.sub = this.searchOptions$.pipe(switchMap(function (options) { return _this.service.search(options).pipe(getSucceededRemoteData()); })) + .subscribe(function (results) { + _this.resultsRD$.next(results); + }); + this.scopeListRD$ = this.searchConfigService.getCurrentScope('').pipe(switchMap(function (scopeId) { return _this.service.getScopes(scopeId); })); + if (!isNotEmpty(this.fixedFilter$)) { + this.fixedFilter$ = this.routeService.getRouteParameterValue('filter'); + } + }; + /** + * Get the current paginated search options + * @returns {Observable} + */ + SearchPageComponent.prototype.getSearchOptions = function () { + return this.searchConfigService.paginatedSearchOptions; + }; + /** + * Set the sidebar to a collapsed state + */ + SearchPageComponent.prototype.closeSidebar = function () { + this.sidebarService.collapse(); + }; + /** + * Set the sidebar to an expanded state + */ + SearchPageComponent.prototype.openSidebar = function () { + this.sidebarService.expand(); + }; + /** + * Check if the sidebar is collapsed + * @returns {Observable} emits true if the sidebar is currently collapsed, false if it is expanded + */ + SearchPageComponent.prototype.isSidebarCollapsed = function () { + return this.sidebarService.isCollapsed; + }; + /** + * @returns {string} The base path to the search page, or the current page when inPlaceSearch is true + */ + SearchPageComponent.prototype.getSearchLink = function () { + if (this.inPlaceSearch) { + return './'; + } + return this.service.getSearchLink(); + }; + /** + * Unsubscribe from the subscription + */ + SearchPageComponent.prototype.ngOnDestroy = function () { + if (hasValue(this.sub)) { + this.sub.unsubscribe(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchPageComponent.prototype, "inPlaceSearch", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchPageComponent.prototype, "searchEnabled", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchPageComponent.prototype, "sideBarWidth", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Observable) + ], SearchPageComponent.prototype, "fixedFilter$", void 0); + SearchPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-page', + styleUrls: ['./search-page.component.scss'], + templateUrl: './search-page.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + animations: [pushInOut], + providers: [ + { + provide: SEARCH_CONFIG_SERVICE, + useClass: SearchConfigurationService + } + ] + }) + /** + * This component represents the whole search page + * It renders search results depending on the current search options + */ + , + tslib_1.__param(3, Inject(SEARCH_CONFIG_SERVICE)), + tslib_1.__metadata("design:paramtypes", [SearchService, + SearchSidebarService, + HostWindowService, + SearchConfigurationService, + RouteService]) + ], SearchPageComponent); + return SearchPageComponent; +}()); +export { SearchPageComponent }; +//# sourceMappingURL=search-page.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-page.component.js.map b/src/app/+search-page/search-page.component.js.map new file mode 100644 index 0000000000..c92bd82da8 --- /dev/null +++ b/src/app/+search-page/search-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-page.component.js","sourceRoot":"","sources":["search-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAoB,eAAe,EAAE,MAAM,MAAM,CAAC;AACrE,OAAO,EAAE,SAAS,GAAG,MAAM,gBAAgB,CAAC;AAI5C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAA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,GAAG,CAAC,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;SACxB;IACH,CAAC;IAjGQ;QAAR,KAAK,EAAE;;8DAAsB;IAM9B;QADC,KAAK,EAAE;;8DACa;IAMrB;QADC,KAAK,EAAE;;6DACS;IAMjB;QADC,KAAK,EAAE;0CACM,UAAU;6DAAS;IAhDtB,mBAAmB;QAlB/B,SAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,CAAC,8BAA8B,CAAC;YAC3C,WAAW,EAAE,8BAA8B;YAC3C,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,UAAU,EAAE,CAAC,SAAS,CAAC;YACvB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,qBAAqB;oBAC9B,QAAQ,EAAE,0BAA0B;iBACrC;aACF;SACF,CAAC;QAEF;;;WAGG;;QAsDY,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;iDAHX,aAAa;YACN,oBAAoB;YACrB,iBAAiB;YACiB,0BAA0B;YAC7D,YAAY;OAtDrC,mBAAmB,CAgI/B;IAAD,0BAAC;CAAA,AAhID,IAgIC;SAhIY,mBAAmB"} \ No newline at end of file diff --git a/src/app/+search-page/search-page.module.js b/src/app/+search-page/search-page.module.js new file mode 100644 index 0000000000..6162af9d69 --- /dev/null +++ b/src/app/+search-page/search-page.module.js @@ -0,0 +1,111 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { CoreModule } from '../core/core.module'; +import { SharedModule } from '../shared/shared.module'; +import { SearchPageRoutingModule } from './search-page-routing.module'; +import { SearchPageComponent } from './search-page.component'; +import { SearchResultsComponent } from './search-results/search-results.component'; +import { ItemSearchResultGridElementComponent } from '../shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component'; +import { CommunitySearchResultGridElementComponent } from '../shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component'; +import { CollectionSearchResultGridElementComponent } from '../shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component'; +import { SearchSidebarComponent } from './search-sidebar/search-sidebar.component'; +import { SearchSidebarService } from './search-sidebar/search-sidebar.service'; +import { SearchSidebarEffects } from './search-sidebar/search-sidebar.effects'; +import { SearchSettingsComponent } from './search-settings/search-settings.component'; +import { EffectsModule } from '@ngrx/effects'; +import { SearchFiltersComponent } from './search-filters/search-filters.component'; +import { SearchFilterComponent } from './search-filters/search-filter/search-filter.component'; +import { SearchFacetFilterComponent } from './search-filters/search-filter/search-facet-filter/search-facet-filter.component'; +import { SearchFilterService } from './search-filters/search-filter/search-filter.service'; +import { FilteredSearchPageComponent } from './filtered-search-page.component'; +import { SearchFixedFilterService } from './search-filters/search-filter/search-fixed-filter.service'; +import { FilteredSearchPageGuard } from './filtered-search-page.guard'; +import { SearchLabelsComponent } from './search-labels/search-labels.component'; +import { SearchRangeFilterComponent } from './search-filters/search-filter/search-range-filter/search-range-filter.component'; +import { SearchTextFilterComponent } from './search-filters/search-filter/search-text-filter/search-text-filter.component'; +import { SearchFacetFilterWrapperComponent } from './search-filters/search-filter/search-facet-filter-wrapper/search-facet-filter-wrapper.component'; +import { SearchBooleanFilterComponent } from './search-filters/search-filter/search-boolean-filter/search-boolean-filter.component'; +import { SearchHierarchyFilterComponent } from './search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component'; +import { SearchConfigurationService } from './search-service/search-configuration.service'; +import { SearchFacetOptionComponent } from './search-filters/search-filter/search-facet-filter-options/search-facet-option/search-facet-option.component'; +import { SearchFacetSelectedOptionComponent } from './search-filters/search-filter/search-facet-filter-options/search-facet-selected-option/search-facet-selected-option.component'; +import { SearchFacetRangeOptionComponent } from './search-filters/search-filter/search-facet-filter-options/search-facet-range-option/search-facet-range-option.component'; +import { SearchSwitchConfigurationComponent } from './search-switch-configuration/search-switch-configuration.component'; +import { SearchAuthorityFilterComponent } from './search-filters/search-filter/search-authority-filter/search-authority-filter.component'; +var effects = [ + SearchSidebarEffects +]; +var components = [ + SearchPageComponent, + SearchResultsComponent, + SearchSidebarComponent, + SearchSettingsComponent, + ItemSearchResultGridElementComponent, + CollectionSearchResultGridElementComponent, + CommunitySearchResultGridElementComponent, + SearchFiltersComponent, + SearchFilterComponent, + SearchFacetFilterComponent, + SearchLabelsComponent, + SearchFacetFilterComponent, + SearchFacetFilterWrapperComponent, + SearchRangeFilterComponent, + SearchTextFilterComponent, + SearchHierarchyFilterComponent, + SearchBooleanFilterComponent, + SearchFacetOptionComponent, + SearchFacetSelectedOptionComponent, + SearchFacetRangeOptionComponent, + SearchSwitchConfigurationComponent, + SearchAuthorityFilterComponent, + FilteredSearchPageComponent +]; +var SearchPageModule = /** @class */ (function () { + /** + * This module handles all components and pipes that are necessary for the search page + */ + function SearchPageModule() { + } + SearchPageModule = tslib_1.__decorate([ + NgModule({ + imports: [ + SearchPageRoutingModule, + CommonModule, + SharedModule, + EffectsModule.forFeature(effects), + CoreModule.forRoot() + ], + declarations: components, + providers: [ + SearchSidebarService, + SearchFilterService, + SearchFixedFilterService, + FilteredSearchPageGuard, + SearchFilterService, + SearchConfigurationService + ], + entryComponents: [ + ItemSearchResultGridElementComponent, + CollectionSearchResultGridElementComponent, + CommunitySearchResultGridElementComponent, + SearchFacetFilterComponent, + SearchRangeFilterComponent, + SearchTextFilterComponent, + SearchHierarchyFilterComponent, + SearchBooleanFilterComponent, + SearchFacetOptionComponent, + SearchFacetSelectedOptionComponent, + SearchFacetRangeOptionComponent, + SearchAuthorityFilterComponent + ], + exports: components + }) + /** + * This module handles all components and pipes that are necessary for the search page + */ + ], SearchPageModule); + return SearchPageModule; +}()); +export { SearchPageModule }; +//# sourceMappingURL=search-page.module.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-page.module.js.map b/src/app/+search-page/search-page.module.js.map new file mode 100644 index 0000000000..628bc18c81 --- /dev/null +++ b/src/app/+search-page/search-page.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-page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,CAAC,OAAO,EAAE;aACrB;YACD,YAAY,EAAE,UAAU;YACxB,SAAS,EAAE;gBACT,oBAAoB;gBACpB,mBAAmB;gBACnB,wBAAwB;gBACxB,uBAAuB;gBACvB,mBAAmB;gBACnB,0BAA0B;aAC3B;YACD,eAAe,EAAE;gBACf,oCAAoC;gBACpC,0CAA0C;gBAC1C,yCAAyC;gBACzC,0BAA0B;gBAC1B,0BAA0B;gBAC1B,yBAAyB;gBACzB,8BAA8B;gBAC9B,4BAA4B;gBAC5B,0BAA0B;gBAC1B,kCAAkC;gBAClC,+BAA+B;gBAC/B,8BAA8B;aAC/B;YACD,OAAO,EAAE,UAAU;SACpB,CAAC;QAEF;;WAEG;OACU,gBAAgB,CAC5B;IAAD,uBAAC;CAAA,AADD,IACC;SADY,gBAAgB"} \ No newline at end of file diff --git a/src/app/+search-page/search-result.model.js b/src/app/+search-page/search-result.model.js new file mode 100644 index 0000000000..c3ce849864 --- /dev/null +++ b/src/app/+search-page/search-result.model.js @@ -0,0 +1,10 @@ +/** + * Represents a search result object of a certain () DSpaceObject + */ +var SearchResult = /** @class */ (function () { + function SearchResult() { + } + return SearchResult; +}()); +export { SearchResult }; +//# sourceMappingURL=search-result.model.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-result.model.js.map b/src/app/+search-page/search-result.model.js.map new file mode 100644 index 0000000000..05c50b603a --- /dev/null +++ b/src/app/+search-page/search-result.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-result.model.js","sourceRoot":"","sources":["search-result.model.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAAA;IAWA,CAAC;IAAD,mBAAC;AAAD,CAAC,AAXD,IAWC"} \ No newline at end of file diff --git a/src/app/+search-page/search-results/search-results.component.js b/src/app/+search-page/search-results/search-results.component.js new file mode 100644 index 0000000000..e9cab0d935 --- /dev/null +++ b/src/app/+search-page/search-results/search-results.component.js @@ -0,0 +1,80 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { RemoteData } from '../../core/data/remote-data'; +import { fadeIn, fadeInOut } from '../../shared/animations/fade'; +import { SetViewMode } from '../../shared/view-mode'; +import { SearchOptions } from '../search-options.model'; +import { isNotEmpty } from '../../shared/empty.util'; +import { SortOptions } from '../../core/cache/models/sort-options.model'; +var SearchResultsComponent = /** @class */ (function () { + function SearchResultsComponent() { + /** + * Whether or not to hide the header of the results + * Defaults to a visible header + */ + this.disableHeader = false; + } + /** + * Get the i18n key for the title depending on the fixed filter + * Defaults to 'search.results.head' if there's no fixed filter found + * @returns {string} + */ + SearchResultsComponent.prototype.getTitleKey = function () { + if (isNotEmpty(this.fixedFilter)) { + return 'search.' + this.fixedFilter + '.results.head'; + } + else { + return 'search.results.head'; + } + }; + /** + * Method to change the given string by surrounding it by quotes if not already present. + */ + SearchResultsComponent.prototype.surroundStringWithQuotes = function (input) { + var result = input; + if (isNotEmpty(result) && !(result.startsWith('\"') && result.endsWith('\"'))) { + result = "\"" + result + "\""; + } + return result; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", RemoteData) + ], SearchResultsComponent.prototype, "searchResults", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SearchOptions) + ], SearchResultsComponent.prototype, "searchConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SortOptions) + ], SearchResultsComponent.prototype, "sortConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SearchResultsComponent.prototype, "viewMode", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SearchResultsComponent.prototype, "fixedFilter", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchResultsComponent.prototype, "disableHeader", void 0); + SearchResultsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-results', + templateUrl: './search-results.component.html', + animations: [ + fadeIn, + fadeInOut + ] + }) + /** + * Component that represents all results from a search + */ + ], SearchResultsComponent); + return SearchResultsComponent; +}()); +export { SearchResultsComponent }; +//# sourceMappingURL=search-results.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-results/search-results.component.js.map b/src/app/+search-page/search-results/search-results.component.js.map new file mode 100644 index 0000000000..e9c7499aaa --- /dev/null +++ b/src/app/+search-page/search-results/search-results.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-results.component.js","sourceRoot":"","sources":["search-results.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAczE;IAZA;QAsCE;;;WAGG;QACM,kBAAa,GAAG,KAAK,CAAC;IA2BjC,CAAC;IAzBC;;;;OAIG;IACH,4CAAW,GAAX;QACE,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YAChC,OAAO,SAAS,GAAG,IAAI,CAAC,WAAW,GAAG,eAAe,CAAA;SACtD;aAAM;YACL,OAAO,qBAAqB,CAAC;SAC9B;IACH,CAAC;IAED;;OAEG;IACH,yDAAwB,GAAxB,UAAyB,KAAa;QACpC,IAAI,MAAM,GAAG,KAAK,CAAC;QAEnB,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE;YAC7E,MAAM,GAAG,OAAI,MAAM,OAAG,CAAC;SACxB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IApDQ;QAAR,KAAK,EAAE;0CAAgB,UAAU;iEAA4C;IAKrE;QAAR,KAAK,EAAE;0CAAe,aAAa;gEAAC;IAK5B;QAAR,KAAK,EAAE;0CAAa,WAAW;8DAAC;IAKxB;QAAR,KAAK,EAAE;;4DAAuB;IAKtB;QAAR,KAAK,EAAE;;+DAAqB;IAMpB;QAAR,KAAK,EAAE;;iEAAuB;IA9BpB,sBAAsB;QAZlC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,WAAW,EAAE,iCAAiC;YAC9C,UAAU,EAAE;gBACV,MAAM;gBACN,SAAS;aACV;SACF,CAAC;QAEF;;WAEG;OACU,sBAAsB,CAyDlC;IAAD,6BAAC;CAAA,AAzDD,IAyDC;SAzDY,sBAAsB"} \ No newline at end of file diff --git a/src/app/+search-page/search-service/facet-value.model.js b/src/app/+search-page/search-service/facet-value.model.js new file mode 100644 index 0000000000..282b1f6b8f --- /dev/null +++ b/src/app/+search-page/search-service/facet-value.model.js @@ -0,0 +1,28 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs } from 'cerialize'; +/** + * Class representing possible values for a certain filter + */ +var FacetValue = /** @class */ (function () { + function FacetValue() { + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], FacetValue.prototype, "label", void 0); + tslib_1.__decorate([ + autoserializeAs(String, 'label'), + tslib_1.__metadata("design:type", String) + ], FacetValue.prototype, "value", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], FacetValue.prototype, "count", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], FacetValue.prototype, "search", void 0); + return FacetValue; +}()); +export { FacetValue }; +//# sourceMappingURL=facet-value.model.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-service/facet-value.model.js.map b/src/app/+search-page/search-service/facet-value.model.js.map new file mode 100644 index 0000000000..0e7b9e7285 --- /dev/null +++ b/src/app/+search-page/search-service/facet-value.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"facet-value.model.js","sourceRoot":"","sources":["facet-value.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE3D;;GAEG;AACH;IAAA;IAwBA,CAAC;IAnBC;QADC,aAAa;;6CACA;IAMd;QADC,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC;;6CACnB;IAMd;QADC,aAAa;;6CACA;IAMd;QADC,aAAa;;8CACC;IACjB,iBAAC;CAAA,AAxBD,IAwBC;SAxBY,UAAU"} \ No newline at end of file diff --git a/src/app/+search-page/search-service/filter-type.model.js b/src/app/+search-page/search-service/filter-type.model.js new file mode 100644 index 0000000000..2f4007d130 --- /dev/null +++ b/src/app/+search-page/search-service/filter-type.model.js @@ -0,0 +1,27 @@ +/** + * Enumeration containing all possible types for filters + */ +export var FilterType; +(function (FilterType) { + /** + * Represents authority facets + */ + FilterType["authority"] = "authority"; + /** + * Represents simple text facets + */ + FilterType["text"] = "text"; + /** + * Represents date facets + */ + FilterType["range"] = "date"; + /** + * Represents hierarchically structured facets + */ + FilterType["hierarchy"] = "hierarchical"; + /** + * Represents binary facets + */ + FilterType["boolean"] = "standard"; +})(FilterType || (FilterType = {})); +//# sourceMappingURL=filter-type.model.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-service/filter-type.model.js.map b/src/app/+search-page/search-service/filter-type.model.js.map new file mode 100644 index 0000000000..0d78daf73d --- /dev/null +++ b/src/app/+search-page/search-service/filter-type.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filter-type.model.js","sourceRoot":"","sources":["filter-type.model.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,UAyBX;AAzBD,WAAY,UAAU;IACpB;;OAEG;IACH,qCAAuB,CAAA;IAEvB;;OAEG;IACH,2BAAa,CAAA;IAEb;;OAEG;IACH,4BAAc,CAAA;IAEd;;OAEG;IACH,wCAA0B,CAAA;IAE1B;;OAEG;IACH,kCAAoB,CAAA;AACtB,CAAC,EAzBW,UAAU,KAAV,UAAU,QAyBrB"} \ No newline at end of file diff --git a/src/app/+search-page/search-service/search-configuration.service.js b/src/app/+search-page/search-service/search-configuration.service.js new file mode 100644 index 0000000000..82d397801a --- /dev/null +++ b/src/app/+search-page/search-service/search-configuration.service.js @@ -0,0 +1,313 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { BehaviorSubject, combineLatest as observableCombineLatest, merge as observableMerge, of as observableOf } from 'rxjs'; +import { filter, flatMap, map } from 'rxjs/operators'; +import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; +import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model'; +import { PaginatedSearchOptions } from '../paginated-search-options.model'; +import { RouteService } from '../../shared/services/route.service'; +import { hasNoValue, hasValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util'; +import { RemoteData } from '../../core/data/remote-data'; +import { getSucceededRemoteData } from '../../core/shared/operators'; +import { SearchFilter } from '../search-filter.model'; +import { DSpaceObjectType } from '../../core/shared/dspace-object-type.model'; +import { SearchFixedFilterService } from '../search-filters/search-filter/search-fixed-filter.service'; +/** + * Service that performs all actions that have to do with the current search configuration + */ +var SearchConfigurationService = /** @class */ (function () { + /** + * Initialize the search options + * @param {RouteService} routeService + * @param {SearchFixedFilterService} fixedFilterService + * @param {ActivatedRoute} route + */ + function SearchConfigurationService(routeService, fixedFilterService, route) { + this.routeService = routeService; + this.fixedFilterService = fixedFilterService; + this.route = route; + /** + * Default pagination settings + */ + this.defaultPagination = Object.assign(new PaginationComponentOptions(), { + id: 'search-page-configuration', + pageSize: 10, + currentPage: 1 + }); + /** + * Default sort settings + */ + this.defaultSort = new SortOptions('score', SortDirection.DESC); + /** + * Default configuration parameter setting + */ + this.defaultConfiguration = 'default'; + /** + * Default scope setting + */ + this.defaultScope = ''; + /** + * Default query setting + */ + this.defaultQuery = ''; + /** + * List of subscriptions to unsubscribe from on destroy + */ + this.subs = new Array(); + this.initDefaults(); + } + /** + * Initialize the search options + */ + SearchConfigurationService.prototype.initDefaults = function () { + var _this = this; + this.defaults + .pipe(getSucceededRemoteData()) + .subscribe(function (defRD) { + var defs = defRD.payload; + _this.paginatedSearchOptions = new BehaviorSubject(defs); + _this.searchOptions = new BehaviorSubject(defs); + _this.subs.push(_this.subscribeToSearchOptions(defs)); + _this.subs.push(_this.subscribeToPaginatedSearchOptions(defs)); + }); + }; + /** + * @returns {Observable} Emits the current configuration string + */ + SearchConfigurationService.prototype.getCurrentConfiguration = function (defaultConfiguration) { + return this.routeService.getQueryParameterValue('configuration').pipe(map(function (configuration) { + return configuration || defaultConfiguration; + })); + }; + /** + * @returns {Observable} Emits the current scope's identifier + */ + SearchConfigurationService.prototype.getCurrentScope = function (defaultScope) { + return this.routeService.getQueryParameterValue('scope').pipe(map(function (scope) { + return scope || defaultScope; + })); + }; + /** + * @returns {Observable} Emits the current query string + */ + SearchConfigurationService.prototype.getCurrentQuery = function (defaultQuery) { + return this.routeService.getQueryParameterValue('query').pipe(map(function (query) { + return query || defaultQuery; + })); + }; + /** + * @returns {Observable} Emits the current DSpaceObject type as a number + */ + SearchConfigurationService.prototype.getCurrentDSOType = function () { + return this.routeService.getQueryParameterValue('dsoType').pipe(filter(function (type) { return isNotEmpty(type) && hasValue(DSpaceObjectType[type.toUpperCase()]); }), map(function (type) { return DSpaceObjectType[type.toUpperCase()]; })); + }; + /** + * @returns {Observable} Emits the current pagination settings + */ + SearchConfigurationService.prototype.getCurrentPagination = function (defaultPagination) { + var page$ = this.routeService.getQueryParameterValue('page'); + var size$ = this.routeService.getQueryParameterValue('pageSize'); + return observableCombineLatest(page$, size$).pipe(map(function (_a) { + var page = _a[0], size = _a[1]; + return Object.assign(new PaginationComponentOptions(), defaultPagination, { + currentPage: page || defaultPagination.currentPage, + pageSize: size || defaultPagination.pageSize + }); + })); + }; + /** + * @returns {Observable} Emits the current sorting settings + */ + SearchConfigurationService.prototype.getCurrentSort = function (defaultSort) { + var _this = this; + var sortDirection$ = this.routeService.getQueryParameterValue('sortDirection'); + var sortField$ = this.routeService.getQueryParameterValue('sortField'); + return observableCombineLatest(sortDirection$, sortField$).pipe(map(function (_a) { + var sortDirection = _a[0], sortField = _a[1]; + // Dirty fix because sometimes the observable value is null somehow + sortField = _this.route.snapshot.queryParamMap.get('sortField'); + var field = sortField || defaultSort.field; + var direction = SortDirection[sortDirection] || defaultSort.direction; + return new SortOptions(field, direction); + })); + }; + /** + * @returns {Observable} Emits the current active filters with their values as they are sent to the backend + */ + SearchConfigurationService.prototype.getCurrentFilters = function () { + return this.routeService.getQueryParamsWithPrefix('f.').pipe(map(function (filterParams) { + if (isNotEmpty(filterParams)) { + var filters_1 = []; + Object.keys(filterParams).forEach(function (key) { + if (key.endsWith('.min') || key.endsWith('.max')) { + var realKey_1 = key.slice(0, -4); + if (hasNoValue(filters_1.find(function (f) { return f.key === realKey_1; }))) { + var min = filterParams[realKey_1 + '.min'] ? filterParams[realKey_1 + '.min'][0] : '*'; + var max = filterParams[realKey_1 + '.max'] ? filterParams[realKey_1 + '.max'][0] : '*'; + filters_1.push(new SearchFilter(realKey_1, ['[' + min + ' TO ' + max + ']'])); + } + } + else { + filters_1.push(new SearchFilter(key, filterParams[key])); + } + }); + return filters_1; + } + return []; + })); + }; + /** + * @returns {Observable} Emits the current fixed filter as a string + */ + SearchConfigurationService.prototype.getCurrentFixedFilter = function () { + var _this = this; + return this.routeService.getRouteParameterValue('filter').pipe(flatMap(function (f) { return _this.fixedFilterService.getQueryByFilterName(f); })); + }; + /** + * @returns {Observable} Emits the current active filters with their values as they are displayed in the frontend URL + */ + SearchConfigurationService.prototype.getCurrentFrontendFilters = function () { + return this.routeService.getQueryParamsWithPrefix('f.'); + }; + /** + * Sets up a subscription to all necessary parameters to make sure the searchOptions emits a new value every time they update + * @param {SearchOptions} defaults Default values for when no parameters are available + * @returns {Subscription} The subscription to unsubscribe from + */ + SearchConfigurationService.prototype.subscribeToSearchOptions = function (defaults) { + var _this = this; + return observableMerge(this.getConfigurationPart(defaults.configuration), this.getScopePart(defaults.scope), this.getQueryPart(defaults.query), this.getDSOTypePart(), this.getFiltersPart(), this.getFixedFilterPart()).subscribe(function (update) { + var currentValue = _this.searchOptions.getValue(); + var updatedValue = Object.assign(currentValue, update); + _this.searchOptions.next(updatedValue); + }); + }; + /** + * Sets up a subscription to all necessary parameters to make sure the paginatedSearchOptions emits a new value every time they update + * @param {PaginatedSearchOptions} defaults Default values for when no parameters are available + * @returns {Subscription} The subscription to unsubscribe from + */ + SearchConfigurationService.prototype.subscribeToPaginatedSearchOptions = function (defaults) { + var _this = this; + return observableMerge(this.getPaginationPart(defaults.pagination), this.getSortPart(defaults.sort), this.getConfigurationPart(defaults.configuration), this.getScopePart(defaults.scope), this.getQueryPart(defaults.query), this.getDSOTypePart(), this.getFiltersPart(), this.getFixedFilterPart()).subscribe(function (update) { + var currentValue = _this.paginatedSearchOptions.getValue(); + var updatedValue = Object.assign(currentValue, update); + _this.paginatedSearchOptions.next(updatedValue); + }); + }; + Object.defineProperty(SearchConfigurationService.prototype, "defaults", { + /** + * Default values for the Search Options + */ + get: function () { + if (hasNoValue(this._defaults)) { + var options = new PaginatedSearchOptions({ + pagination: this.defaultPagination, + configuration: this.defaultConfiguration, + sort: this.defaultSort, + scope: this.defaultScope, + query: this.defaultQuery + }); + this._defaults = observableOf(new RemoteData(false, false, true, null, options)); + } + return this._defaults; + }, + enumerable: true, + configurable: true + }); + /** + * Make sure to unsubscribe from all existing subscription to prevent memory leaks + */ + SearchConfigurationService.prototype.ngOnDestroy = function () { + this.subs.forEach(function (sub) { + sub.unsubscribe(); + }); + this.subs = []; + }; + /** + * @returns {Observable} Emits the current configuration settings as a partial SearchOptions object + */ + SearchConfigurationService.prototype.getConfigurationPart = function (defaultConfiguration) { + return this.getCurrentConfiguration(defaultConfiguration).pipe(map(function (configuration) { + return { configuration: configuration }; + })); + }; + /** + * @returns {Observable} Emits the current scope's identifier + */ + SearchConfigurationService.prototype.getScopePart = function (defaultScope) { + return this.getCurrentScope(defaultScope).pipe(map(function (scope) { + return { scope: scope }; + })); + }; + /** + * @returns {Observable} Emits the current query string as a partial SearchOptions object + */ + SearchConfigurationService.prototype.getQueryPart = function (defaultQuery) { + return this.getCurrentQuery(defaultQuery).pipe(map(function (query) { + return { query: query }; + })); + }; + /** + * @returns {Observable} Emits the current query string as a partial SearchOptions object + */ + SearchConfigurationService.prototype.getDSOTypePart = function () { + return this.getCurrentDSOType().pipe(map(function (dsoType) { + return { dsoType: dsoType }; + })); + }; + /** + * @returns {Observable} Emits the current pagination settings as a partial SearchOptions object + */ + SearchConfigurationService.prototype.getPaginationPart = function (defaultPagination) { + return this.getCurrentPagination(defaultPagination).pipe(map(function (pagination) { + return { pagination: pagination }; + })); + }; + /** + * @returns {Observable} Emits the current sorting settings as a partial SearchOptions object + */ + SearchConfigurationService.prototype.getSortPart = function (defaultSort) { + return this.getCurrentSort(defaultSort).pipe(map(function (sort) { + return { sort: sort }; + })); + }; + /** + * @returns {Observable} Emits the current active filters as a partial SearchOptions object + */ + SearchConfigurationService.prototype.getFiltersPart = function () { + return this.getCurrentFilters().pipe(map(function (filters) { + return { filters: filters }; + })); + }; + /** + * @returns {Observable} Emits the current fixed filter as a partial SearchOptions object + */ + SearchConfigurationService.prototype.getFixedFilterPart = function () { + return this.getCurrentFixedFilter().pipe(isNotEmptyOperator(), map(function (fixedFilter) { + return { fixedFilter: fixedFilter }; + })); + }; + /** + * Update the fixed filter in paginated and non-paginated search options with a given value + * @param {string} fixedFilter + */ + SearchConfigurationService.prototype.updateFixedFilter = function (fixedFilter) { + var currentPaginatedValue = this.paginatedSearchOptions.getValue(); + var updatedPaginatedValue = Object.assign(currentPaginatedValue, { fixedFilter: fixedFilter }); + this.paginatedSearchOptions.next(updatedPaginatedValue); + var currentValue = this.searchOptions.getValue(); + var updatedValue = Object.assign(currentValue, { fixedFilter: fixedFilter }); + this.searchOptions.next(updatedValue); + }; + SearchConfigurationService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RouteService, + SearchFixedFilterService, + ActivatedRoute]) + ], SearchConfigurationService); + return SearchConfigurationService; +}()); +export { SearchConfigurationService }; +//# sourceMappingURL=search-configuration.service.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-service/search-configuration.service.js.map b/src/app/+search-page/search-service/search-configuration.service.js.map new file mode 100644 index 0000000000..588ab4b935 --- /dev/null +++ b/src/app/+search-page/search-service/search-configuration.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-configuration.service.js","sourceRoot":"","sources":["search-configuration.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,cAAc,EAAU,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EACL,eAAe,EACf,aAAa,IAAI,uBAAuB,EACxC,KAAK,IAAI,eAAe,EAExB,EAAE,IAAI,YAAY,EAEnB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,4DAA4D,CAAC;AAExG,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,g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4VtC;IAAD,iCAAC;CAAA,AA5VD,IA4VC;SA5VY,0BAA0B"} \ No newline at end of file diff --git a/src/app/+search-page/search-service/search-filter-config.model.js b/src/app/+search-page/search-service/search-filter-config.model.js new file mode 100644 index 0000000000..44fe2b8a48 --- /dev/null +++ b/src/app/+search-page/search-service/search-filter-config.model.js @@ -0,0 +1,56 @@ +import * as tslib_1 from "tslib"; +import { FilterType } from './filter-type.model'; +import { autoserialize, autoserializeAs } from 'cerialize'; +/** + * The configuration for a search filter + */ +var SearchFilterConfig = /** @class */ (function () { + function SearchFilterConfig() { + /** + * @type {number} The page size used for this facet + */ + this.pageSize = 5; + } + Object.defineProperty(SearchFilterConfig.prototype, "paramName", { + /** + * Name of this configuration that can be used in a url + * @returns Parameter name + */ + get: function () { + return 'f.' + this.name; + }, + enumerable: true, + configurable: true + }); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SearchFilterConfig.prototype, "name", void 0); + tslib_1.__decorate([ + autoserializeAs(String, 'facetType'), + tslib_1.__metadata("design:type", String) + ], SearchFilterConfig.prototype, "type", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], SearchFilterConfig.prototype, "hasFacets", void 0); + tslib_1.__decorate([ + autoserializeAs(String, 'facetLimit'), + tslib_1.__metadata("design:type", Object) + ], SearchFilterConfig.prototype, "pageSize", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], SearchFilterConfig.prototype, "isOpenByDefault", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SearchFilterConfig.prototype, "maxValue", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SearchFilterConfig.prototype, "minValue", void 0); + return SearchFilterConfig; +}()); +export { SearchFilterConfig }; +//# sourceMappingURL=search-filter-config.model.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-service/search-filter-config.model.js.map b/src/app/+search-page/search-service/search-filter-config.model.js.map new file mode 100644 index 0000000000..7831d132a2 --- /dev/null +++ b/src/app/+search-page/search-service/search-filter-config.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-filter-config.model.js","sourceRoot":"","sources":["search-filter-config.model.ts"],"names":[],"mappings":";AAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE3D;;GAEG;AACH;IAAA;QAoBE;;WAEG;QAEH,aAAQ,GAAG,CAAC,CAAC;IA2Bf,CAAC;IAHC,sBAAI,yCAAS;QAJb;;;WAGG;aACH;YACE,OAAO,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC1B,CAAC;;;OAAA;IA5CD;QADC,aAAa;;oDACD;IAMb;QADC,eAAe,CAAC,MAAM,EAAE,WAAW,CAAC;;oDACpB;IAMjB;QADC,aAAa;;yDACK;IAMnB;QADC,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC;;wDACzB;IAMb;QADC,aAAa;;+DACW;IAMzB;QADC,aAAa;;wDACG;IAMjB;QADC,aAAa;;wDACG;IASnB,yBAAC;CAAA,AAnDD,IAmDC;SAnDY,kBAAkB"} \ No newline at end of file diff --git a/src/app/+search-page/search-service/search-query-response.model.js b/src/app/+search-page/search-service/search-query-response.model.js new file mode 100644 index 0000000000..bde61becbc --- /dev/null +++ b/src/app/+search-page/search-service/search-query-response.model.js @@ -0,0 +1,70 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs } from 'cerialize'; +import { PageInfo } from '../../core/shared/page-info.model'; +import { NormalizedSearchResult } from '../normalized-search-result.model'; +/** + * Class representing the response returned by the server when performing a search request + */ +var SearchQueryResponse = /** @class */ (function () { + function SearchQueryResponse() { + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SearchQueryResponse.prototype, "scope", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SearchQueryResponse.prototype, "query", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Array) + ], SearchQueryResponse.prototype, "appliedFilters", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Object) + ], SearchQueryResponse.prototype, "sort", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SearchQueryResponse.prototype, "configuration", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SearchQueryResponse.prototype, "type", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", PageInfo) + ], SearchQueryResponse.prototype, "page", void 0); + tslib_1.__decorate([ + autoserializeAs(NormalizedSearchResult), + tslib_1.__metadata("design:type", Array) + ], SearchQueryResponse.prototype, "objects", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Object) + ], SearchQueryResponse.prototype, "facets", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SearchQueryResponse.prototype, "self", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SearchQueryResponse.prototype, "next", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SearchQueryResponse.prototype, "previous", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SearchQueryResponse.prototype, "first", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SearchQueryResponse.prototype, "last", void 0); + return SearchQueryResponse; +}()); +export { SearchQueryResponse }; +//# sourceMappingURL=search-query-response.model.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-service/search-query-response.model.js.map b/src/app/+search-page/search-service/search-query-response.model.js.map new file mode 100644 index 0000000000..d365b0de2c --- /dev/null +++ b/src/app/+search-page/search-service/search-query-response.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-query-response.model.js","sourceRoot":"","sources":["search-query-response.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E;;GAEG;AACH;IAAA;IAiFA,CAAC;IA5EC;QADC,aAAa;;sDACA;IAMd;QADC,aAAa;;sDACA;IAMd;QADC,aAAa;;+DACQ;IAMtB;QADC,aAAa;;qDACJ;IAMV;QADC,aAAa;;8DACQ;IAMtB;QADC,aAAa;;qDACM;IAMpB;QADC,aAAa;0CACR,QAAQ;qDAAC;IAMf;QADC,eAAe,CAAC,sBAAsB,CAAC;;wDACN;IAGlC;QADC,aAAa;;uDACF;IAMZ;QADC,aAAa;;qDACD;IAMb;QADC,aAAa;;qDACD;IAMb;QADC,aAAa;;yDACG;IAMjB;QADC,aAAa;;sDACA;IAMd;QADC,aAAa;;qDACD;IACf,0BAAC;CAAA,AAjFD,IAiFC;SAjFY,mBAAmB"} \ No newline at end of file diff --git a/src/app/+search-page/search-service/search-result-element-decorator.js b/src/app/+search-page/search-service/search-result-element-decorator.js new file mode 100644 index 0000000000..aeadebaea2 --- /dev/null +++ b/src/app/+search-page/search-service/search-result-element-decorator.js @@ -0,0 +1,42 @@ +import { isNull } from '../../shared/empty.util'; +/** + * Contains the mapping between a search result component and a DSpaceObject + */ +var searchResultMap = new Map(); +/** + * Used to map Search Result components to their matching DSpaceObject + * @param {GenericConstructor} domainConstructor The constructor of the DSpaceObject + * @returns Decorator function that performs the actual mapping on initialization of the component + */ +export function searchResultFor(domainConstructor, configuration) { + if (configuration === void 0) { configuration = null; } + return function decorator(searchResult) { + if (!searchResult) { + return; + } + if (isNull(configuration)) { + searchResultMap.set(domainConstructor, searchResult); + } + else { + if (!searchResultMap.get(configuration)) { + searchResultMap.set(configuration, new Map()); + } + searchResultMap.get(configuration).set(domainConstructor, searchResult); + } + }; +} +/** + * Requests the matching component based on a given DSpaceObject's constructor + * @param {GenericConstructor} domainConstructor The DSpaceObject's constructor for which the search result component is requested + * @returns The component's constructor that matches the given DSpaceObject + */ +export function getSearchResultFor(domainConstructor, configuration) { + if (configuration === void 0) { configuration = null; } + if (isNull(configuration) || configuration === 'default') { + return searchResultMap.get(domainConstructor); + } + else { + return searchResultMap.get(configuration).get(domainConstructor); + } +} +//# sourceMappingURL=search-result-element-decorator.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-service/search-result-element-decorator.js.map b/src/app/+search-page/search-service/search-result-element-decorator.js.map new file mode 100644 index 0000000000..f9f3969332 --- /dev/null +++ b/src/app/+search-page/search-service/search-result-element-decorator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-result-element-decorator.js","sourceRoot":"","sources":["search-result-element-decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD;;GAEG;AACH,IAAM,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;AAElC;;;;GAIG;AACH,MAAM,0BAA0B,iBAAqD,EAAE,aAA4B;IAA5B,8BAAA,EAAA,oBAA4B;IACjH,OAAO,mBAAmB,YAAiB;QACzC,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO;SACR;QACD,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE;YACzB,eAAe,CAAC,GAAG,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;SACtD;aAAM;YACL,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;gBACvC,eAAe,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;aAC/C;YACD,eAAe,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;SACzE;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,6BAA6B,iBAAqD,EAAE,aAA4B;IAA5B,8BAAA,EAAA,oBAA4B;IACpH,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,KAAK,SAAS,EAAE;QACxD,OAAO,eAAe,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;KAC/C;SAAM;QACL,OAAO,eAAe,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;KAClE;AACH,CAAC"} \ No newline at end of file diff --git a/src/app/+search-page/search-service/search.service.js b/src/app/+search-page/search-service/search.service.js new file mode 100644 index 0000000000..972f0a466e --- /dev/null +++ b/src/app/+search-page/search-service/search.service.js @@ -0,0 +1,279 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest, of as observableOf } from 'rxjs'; +import { Injectable } from '@angular/core'; +import { Router } from '@angular/router'; +import { first, map, switchMap } from 'rxjs/operators'; +import { RemoteDataBuildService } from '../../core/cache/builders/remote-data-build.service'; +import { PaginatedList } from '../../core/data/paginated-list'; +import { GetRequest } from '../../core/data/request.models'; +import { RequestService } from '../../core/data/request.service'; +import { DSpaceObject } from '../../core/shared/dspace-object.model'; +import { HALEndpointService } from '../../core/shared/hal-endpoint.service'; +import { configureRequest, filterSuccessfulResponses, getResponseFromEntry, getSucceededRemoteData } from '../../core/shared/operators'; +import { URLCombiner } from '../../core/url-combiner/url-combiner'; +import { hasValue, isEmpty, isNotEmpty, isNotUndefined } from '../../shared/empty.util'; +import { SearchFilterConfig } from './search-filter-config.model'; +import { SearchResponseParsingService } from '../../core/data/search-response-parsing.service'; +import { getSearchResultFor } from './search-result-element-decorator'; +import { FacetValueResponseParsingService } from '../../core/data/facet-value-response-parsing.service'; +import { FacetConfigResponseParsingService } from '../../core/data/facet-config-response-parsing.service'; +import { CommunityDataService } from '../../core/data/community-data.service'; +import { ViewMode } from '../../core/shared/view-mode.model'; +import { ResourceType } from '../../core/shared/resource-type'; +import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service'; +import { RouteService } from '../../shared/services/route.service'; +/** + * Service that performs all general actions that have to do with the search page + */ +var SearchService = /** @class */ (function () { + function SearchService(router, routeService, requestService, rdb, halService, communityService, dspaceObjectService) { + this.router = router; + this.routeService = routeService; + this.requestService = requestService; + this.rdb = rdb; + this.halService = halService; + this.communityService = communityService; + this.dspaceObjectService = dspaceObjectService; + /** + * Endpoint link path for retrieving general search results + */ + this.searchLinkPath = 'discover/search/objects'; + /** + * Endpoint link path for retrieving facet config incl values + */ + this.facetLinkPathPrefix = 'discover/facets/'; + /** + * The ResponseParsingService constructor name + */ + this.parser = SearchResponseParsingService; + /** + * The RestRequest constructor name + */ + this.request = GetRequest; + } + /** + * Method to set service options + * @param {GenericConstructor} parser The ResponseParsingService constructor name + * @param {boolean} request The RestRequest constructor name + */ + SearchService.prototype.setServiceOptions = function (parser, request) { + if (parser) { + this.parser = parser; + } + if (request) { + this.request = request; + } + }; + /** + * Method to retrieve a paginated list of search results from the server + * @param {PaginatedSearchOptions} searchOptions The configuration necessary to perform this search + * @returns {Observable>>>} Emits a paginated list with all search results found + */ + SearchService.prototype.search = function (searchOptions) { + var _this = this; + var requestObs = this.halService.getEndpoint(this.searchLinkPath).pipe(map(function (url) { + if (hasValue(searchOptions)) { + url = searchOptions.toRestUrl(url); + } + var request = new _this.request(_this.requestService.generateRequestId(), url); + var getResponseParserFn = function () { + return _this.parser; + }; + return Object.assign(request, { + getResponseParser: getResponseParserFn + }); + }), configureRequest(this.requestService)); + var requestEntryObs = requestObs.pipe(switchMap(function (request) { return _this.requestService.getByHref(request.href); })); + // get search results from response cache + var sqrObs = requestEntryObs.pipe(filterSuccessfulResponses(), map(function (response) { return response.results; })); + // turn dspace href from search results to effective list of DSpaceObjects + // Turn list of observable remote data DSO's into observable remote data object with list of DSO + var dsoObs = sqrObs.pipe(map(function (sqr) { + return sqr.objects + .filter(function (nsr) { return isNotUndefined(nsr.indexableObject); }) + .map(function (nsr) { + return _this.rdb.buildSingle(nsr.indexableObject); + }); + }), switchMap(function (input) { return _this.rdb.aggregate(input); })); + // Create search results again with the correct dso objects linked to each result + var tDomainListObs = observableCombineLatest(sqrObs, dsoObs).pipe(map(function (_a) { + var sqr = _a[0], dsos = _a[1]; + return sqr.objects.map(function (object, index) { + var co = DSpaceObject; + if (dsos.payload[index]) { + var constructor = dsos.payload[index].constructor; + co = getSearchResultFor(constructor, searchOptions.configuration); + return Object.assign(new co(), object, { + indexableObject: dsos.payload[index] + }); + } + else { + return undefined; + } + }); + })); + var pageInfoObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { return response.pageInfo; })); + var payloadObs = observableCombineLatest(tDomainListObs, pageInfoObs).pipe(map(function (_a) { + var tDomainList = _a[0], pageInfo = _a[1]; + return new PaginatedList(pageInfo, tDomainList); + })); + return this.rdb.toRemoteDataObservable(requestEntryObs, payloadObs); + }; + /** + * Request the filter configuration for a given scope or the whole repository + * @param {string} scope UUID of the object for which config the filter config is requested, when no scope is provided the configuration for the whole repository is loaded + * @param {string} configurationName the name of the configuration + * @returns {Observable>} The found filter configuration + */ + SearchService.prototype.getConfig = function (scope, configurationName) { + var _this = this; + var requestObs = this.halService.getEndpoint(this.facetLinkPathPrefix).pipe(map(function (url) { + var args = []; + if (isNotEmpty(scope)) { + args.push("scope=" + scope); + } + if (isNotEmpty(configurationName)) { + args.push("configuration=" + configurationName); + } + if (isNotEmpty(args)) { + url = new URLCombiner(url, "?" + args.join('&')).toString(); + } + var request = new _this.request(_this.requestService.generateRequestId(), url); + return Object.assign(request, { + getResponseParser: function () { + return FacetConfigResponseParsingService; + } + }); + }), configureRequest(this.requestService)); + var requestEntryObs = requestObs.pipe(switchMap(function (request) { return _this.requestService.getByHref(request.href); })); + // get search results from response cache + var facetConfigObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { + return response.results.map(function (result) { return Object.assign(new SearchFilterConfig(), result); }); + })); + return this.rdb.toRemoteDataObservable(requestEntryObs, facetConfigObs); + }; + /** + * Method to request a single page of filter values for a given value + * @param {SearchFilterConfig} filterConfig The filter config for which we want to request filter values + * @param {number} valuePage The page number of the filter values + * @param {SearchOptions} searchOptions The search configuration for the current search + * @param {string} filterQuery The optional query used to filter out filter values + * @returns {Observable>>} Emits the given page of facet values + */ + SearchService.prototype.getFacetValuesFor = function (filterConfig, valuePage, searchOptions, filterQuery) { + var _this = this; + var requestObs = this.halService.getEndpoint(this.facetLinkPathPrefix + filterConfig.name).pipe(map(function (url) { + var args = ["page=" + (valuePage - 1), "size=" + filterConfig.pageSize]; + if (hasValue(filterQuery)) { + args.push("prefix=" + filterQuery); + } + if (hasValue(searchOptions)) { + url = searchOptions.toRestUrl(url, args); + } + var request = new _this.request(_this.requestService.generateRequestId(), url); + return Object.assign(request, { + getResponseParser: function () { + return FacetValueResponseParsingService; + } + }); + }), configureRequest(this.requestService), first()); + var requestEntryObs = requestObs.pipe(switchMap(function (request) { return _this.requestService.getByHref(request.href); })); + // get search results from response cache + var facetValueObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { return response.results; })); + var pageInfoObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { return response.pageInfo; })); + var payloadObs = observableCombineLatest(facetValueObs, pageInfoObs).pipe(map(function (_a) { + var facetValue = _a[0], pageInfo = _a[1]; + return new PaginatedList(pageInfo, facetValue); + })); + return this.rdb.toRemoteDataObservable(requestEntryObs, payloadObs); + }; + /** + * Request a list of DSpaceObjects that can be used as a scope, based on the current scope + * @param {string} scopeId UUID of the current scope, if the scope is empty, the repository wide scopes will be returned + * @returns {Observable} Emits a list of DSpaceObjects which represent possible scopes + */ + SearchService.prototype.getScopes = function (scopeId) { + if (isEmpty(scopeId)) { + var top_1 = this.communityService.findTop({ elementsPerPage: 9999 }).pipe(map(function (communities) { return communities.payload.page; })); + return top_1; + } + var scopeObject = this.dspaceObjectService.findById(scopeId).pipe(getSucceededRemoteData()); + var scopeList = scopeObject.pipe(switchMap(function (dsoRD) { + if (dsoRD.payload.type === ResourceType.Community) { + var community_1 = dsoRD.payload; + return observableCombineLatest(community_1.subcommunities, community_1.collections).pipe(map(function (_a) { + var subCommunities = _a[0], collections = _a[1]; + /*if this is a community, we also need to show the direct children*/ + return [community_1].concat(subCommunities.payload.page, collections.payload.page); + })); + } + else { + return observableOf([dsoRD.payload]); + } + })); + return scopeList; + }; + /** + * Requests the current view mode based on the current URL + * @returns {Observable} The current view mode + */ + SearchService.prototype.getViewMode = function () { + return this.routeService.getQueryParamMap().pipe(map(function (params) { + if (isNotEmpty(params.get('view')) && hasValue(params.get('view'))) { + return params.get('view'); + } + else { + return ViewMode.List; + } + })); + }; + /** + * Changes the current view mode in the current URL + * @param {ViewMode} viewMode Mode to switch to + */ + SearchService.prototype.setViewMode = function (viewMode, searchLinkParts) { + var _this = this; + this.routeService.getQueryParameterValue('pageSize').pipe(first()) + .subscribe(function (pageSize) { + var queryParams = { view: viewMode, page: 1 }; + if (viewMode === ViewMode.Detail) { + queryParams = Object.assign(queryParams, { pageSize: '1' }); + } + else if (pageSize === '1') { + queryParams = Object.assign(queryParams, { pageSize: '10' }); + } + var navigationExtras = { + queryParams: queryParams, + queryParamsHandling: 'merge' + }; + _this.router.navigate(hasValue(searchLinkParts) ? searchLinkParts : [_this.getSearchLink()], navigationExtras); + }); + }; + /** + * @returns {string} The base path to the search page + */ + SearchService.prototype.getSearchLink = function () { + return '/search'; + }; + /** + * Unsubscribe from the subscription + */ + SearchService.prototype.ngOnDestroy = function () { + if (this.sub !== undefined) { + this.sub.unsubscribe(); + } + }; + SearchService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Router, + RouteService, + RequestService, + RemoteDataBuildService, + HALEndpointService, + CommunityDataService, + DSpaceObjectDataService]) + ], SearchService); + return SearchService; +}()); +export { SearchService }; +//# sourceMappingURL=search.service.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-service/search.service.js.map b/src/app/+search-page/search-service/search.service.js.map new file mode 100644 index 0000000000..a264603707 --- /dev/null +++ b/src/app/+search-page/search-service/search.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I,CAAC,KAAK,EAAE,CAAC;aAC/D,SAAS,CAAC,UAAC,QAAQ;YAClB,IAAI,WAAW,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;YAC9C,IAAI,QAAQ,KAAK,QAAQ,CAAC,MAAM,EAAE;gBAChC,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,EAAC,QAAQ,EAAE,GAAG,EAAC,CAAC,CAAC;aAC3D;iBAAM,IAAI,QAAQ,KAAK,GAAG,EAAE;gBAC3B,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;aAC5D;YACD,IAAM,gBAAgB,GAAqB;gBACzC,WAAW,EAAE,WAAW;gBACxB,mBAAmB,EAAE,OAAO;aAC7B,CAAC;YAEF,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,KAAI,CAAC,aAAa,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;QAC/G,CAAC,CAAC,CAAA;IACN,CAAC;IAED;;OAEG;IACH,qCAAa,GAAb;QACE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,mCAAW,GAAX;QACE,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,EAAE;YAC1B,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;SACxB;IACH,CAAC;IA5TU,aAAa;QADzB,UAAU,EAAE;iDA2BiB,MAAM;YACA,YAAY;YACR,cAAc;YAC3B,sBAAsB;YACf,kBAAkB;YACZ,oBAAoB;YACjB,uBAAuB;OAhCrD,aAAa,CA6TzB;IAAD,oBAAC;CAAA,AA7TD,IA6TC;SA7TY,aAAa"} \ No newline at end of file diff --git a/src/app/+search-page/search-settings/search-settings.component.js b/src/app/+search-page/search-settings/search-settings.component.js new file mode 100644 index 0000000000..4569822552 --- /dev/null +++ b/src/app/+search-page/search-settings/search-settings.component.js @@ -0,0 +1,97 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject, Input } from '@angular/core'; +import { SearchService } from '../search-service/search.service'; +import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; +import { ActivatedRoute, Router } from '@angular/router'; +import { SearchConfigurationService } from '../search-service/search-configuration.service'; +import { SEARCH_CONFIG_SERVICE } from '../../+my-dspace-page/my-dspace-page.component'; +var SearchSettingsComponent = /** @class */ (function () { + function SearchSettingsComponent(service, route, router, searchConfigurationService) { + this.service = service; + this.route = route; + this.router = router; + this.searchConfigurationService = searchConfigurationService; + /** + * All sort options that are shown in the settings + */ + this.searchOptionPossibilities = [new SortOptions('score', SortDirection.DESC), new SortOptions('dc.title', SortDirection.ASC), new SortOptions('dc.title', SortDirection.DESC)]; + } + /** + * Initialize paginated search options + */ + SearchSettingsComponent.prototype.ngOnInit = function () { + this.searchOptions$ = this.searchConfigurationService.paginatedSearchOptions; + }; + /** + * Method to change the current page size (results per page) + * @param {Event} event Change event containing the new page size value + */ + SearchSettingsComponent.prototype.reloadRPP = function (event) { + var value = event.target.value; + var navigationExtras = { + queryParams: { + pageSize: value, + page: 1 + }, + queryParamsHandling: 'merge' + }; + this.router.navigate(this.getSearchLinkParts(), navigationExtras); + }; + /** + * Method to change the current sort field and direction + * @param {Event} event Change event containing the sort direction and sort field + */ + SearchSettingsComponent.prototype.reloadOrder = function (event) { + var values = event.target.value.split(','); + var navigationExtras = { + queryParams: { + sortDirection: values[1], + sortField: values[0], + page: 1 + }, + queryParamsHandling: 'merge' + }; + this.router.navigate(this.getSearchLinkParts(), navigationExtras); + }; + /** + * @returns {string} The base path to the search page, or the current page when inPlaceSearch is true + */ + SearchSettingsComponent.prototype.getSearchLink = function () { + if (this.inPlaceSearch) { + return './'; + } + return this.service.getSearchLink(); + }; + /** + * @returns {string[]} The base path to the search page, or the current page when inPlaceSearch is true, split in separate pieces + */ + SearchSettingsComponent.prototype.getSearchLinkParts = function () { + if (this.service) { + return []; + } + return this.getSearchLink().split('/'); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchSettingsComponent.prototype, "inPlaceSearch", void 0); + SearchSettingsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-settings', + styleUrls: ['./search-settings.component.scss'], + templateUrl: './search-settings.component.html' + }) + /** + * This component represents the part of the search sidebar that contains the general search settings. + */ + , + tslib_1.__param(3, Inject(SEARCH_CONFIG_SERVICE)), + tslib_1.__metadata("design:paramtypes", [SearchService, + ActivatedRoute, + Router, + SearchConfigurationService]) + ], SearchSettingsComponent); + return SearchSettingsComponent; +}()); +export { SearchSettingsComponent }; +//# sourceMappingURL=search-settings.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-settings/search-settings.component.js.map b/src/app/+search-page/search-settings/search-settings.component.js.map new file mode 100644 index 0000000000..17ea1709c3 --- /dev/null +++ b/src/app/+search-page/search-settings/search-settings.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-settings.component.js","sourceRoot":"","sources":["search-settings.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,cAAc,EAAoB,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAG3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAWvF;IAiBE,iCAAoB,OAAsB,EACtB,KAAqB,EACrB,MAAc,EACgB,0BAAsD;QAHpF,YAAO,GAAP,OAAO,CAAe;QACtB,UAAK,GAAL,KAAK,CAAgB;QACrB,WAAM,GAAN,MAAM,C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I,CAAC,aAAa,EAAE;YACtB,OAAO,IAAI,CAAC;SACb;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,oDAAkB,GAAzB;QACE,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,OAAO,EAAE,CAAC;SACX;QACD,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IA5EQ;QAAR,KAAK,EAAE;;kEAAe;IALZ,uBAAuB;QATnC,SAAS,CAAC;YACT,QAAQ,EAAE,oBAAoB;YAC9B,SAAS,EAAE,CAAC,kCAAkC,CAAC;YAC/C,WAAW,EAAE,kCAAkC;SAChD,CAAC;QAEF;;WAEG;;QAqBY,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;iDAHb,aAAa;YACf,cAAc;YACb,MAAM;YAC4C,0BAA0B;OApB7F,uBAAuB,CAkFnC;IAAD,8BAAC;CAAA,AAlFD,IAkFC;SAlFY,uBAAuB"} \ No newline at end of file diff --git a/src/app/+search-page/search-sidebar/search-sidebar.actions.js b/src/app/+search-page/search-sidebar/search-sidebar.actions.js new file mode 100644 index 0000000000..0d9d950384 --- /dev/null +++ b/src/app/+search-page/search-sidebar/search-sidebar.actions.js @@ -0,0 +1,46 @@ +import { type } from '../../shared/ngrx/type'; +/** + * For each action type in an action group, make a simple + * enum object for all of this group's action types. + * + * The 'type' utility function coerces strings into string + * literal types and runs a simple check to guarantee all + * action types in the application are unique. + */ +export var SearchSidebarActionTypes = { + COLLAPSE: type('dspace/search-sidebar/COLLAPSE'), + EXPAND: type('dspace/search-sidebar/EXPAND'), + TOGGLE: type('dspace/search-sidebar/TOGGLE') +}; +/* tslint:disable:max-classes-per-file */ +/** + * Used to collapse the sidebar + */ +var SearchSidebarCollapseAction = /** @class */ (function () { + function SearchSidebarCollapseAction() { + this.type = SearchSidebarActionTypes.COLLAPSE; + } + return SearchSidebarCollapseAction; +}()); +export { SearchSidebarCollapseAction }; +/** + * Used to expand the sidebar + */ +var SearchSidebarExpandAction = /** @class */ (function () { + function SearchSidebarExpandAction() { + this.type = SearchSidebarActionTypes.EXPAND; + } + return SearchSidebarExpandAction; +}()); +export { SearchSidebarExpandAction }; +/** + * Used to collapse the sidebar when it's expanded and expand it when it's collapsed + */ +var SearchSidebarToggleAction = /** @class */ (function () { + function SearchSidebarToggleAction() { + this.type = SearchSidebarActionTypes.TOGGLE; + } + return SearchSidebarToggleAction; +}()); +export { SearchSidebarToggleAction }; +//# sourceMappingURL=search-sidebar.actions.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-sidebar/search-sidebar.actions.js.map b/src/app/+search-page/search-sidebar/search-sidebar.actions.js.map new file mode 100644 index 0000000000..4cb6a1db1a --- /dev/null +++ b/src/app/+search-page/search-sidebar/search-sidebar.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-sidebar.actions.js","sourceRoot":"","sources":["search-sidebar.actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,wBAAwB,GAAG;IACtC,QAAQ,EAAE,IAAI,CAAC,gCAAgC,CAAC;IAChD,MAAM,EAAE,IAAI,CAAC,8BAA8B,CAAC;IAC5C,MAAM,EAAE,IAAI,CAAC,8BAA8B,CAAC;CAC7C,CAAC;AAEF,yCAAyC;AACzC;;GAEG;AACH;IAAA;QACE,SAAI,GAAG,wBAAwB,CAAC,QAAQ,CAAC;IAC3C,CAAC;IAAD,kCAAC;AAAD,CAAC,AAFD,IAEC;;AAED;;GAEG;AACH;IAAA;QACE,SAAI,GAAG,wBAAwB,CAAC,MAAM,CAAC;IACzC,CAAC;IAAD,gCAAC;AAAD,CAAC,AAFD,IAEC;;AAED;;GAEG;AACH;IAAA;QACE,SAAI,GAAG,wBAAwB,CAAC,MAAM,CAAC;IACzC,CAAC;IAAD,gCAAC;AAAD,CAAC,AAFD,IAEC"} \ No newline at end of file diff --git a/src/app/+search-page/search-sidebar/search-sidebar.component.js b/src/app/+search-page/search-sidebar/search-sidebar.component.js new file mode 100644 index 0000000000..669647c3aa --- /dev/null +++ b/src/app/+search-page/search-sidebar/search-sidebar.component.js @@ -0,0 +1,48 @@ +import * as tslib_1 from "tslib"; +import { Component, EventEmitter, Input, Output } from '@angular/core'; +/** + * This component renders a simple item page. + * The route parameter 'id' is used to request the item it represents. + * All fields of the item that should be displayed, are defined in its template. + */ +var SearchSidebarComponent = /** @class */ (function () { + function SearchSidebarComponent() { + /** + * Emits event when the user clicks a button to open or close the sidebar + */ + this.toggleSidebar = new EventEmitter(); + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], SearchSidebarComponent.prototype, "configurationList", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchSidebarComponent.prototype, "resultCount", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchSidebarComponent.prototype, "viewModeList", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchSidebarComponent.prototype, "inPlaceSearch", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], SearchSidebarComponent.prototype, "toggleSidebar", void 0); + SearchSidebarComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-sidebar', + styleUrls: ['./search-sidebar.component.scss'], + templateUrl: './search-sidebar.component.html', + }) + /** + * Component representing the sidebar on the search page + */ + ], SearchSidebarComponent); + return SearchSidebarComponent; +}()); +export { SearchSidebarComponent }; +//# sourceMappingURL=search-sidebar.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-sidebar/search-sidebar.component.js.map b/src/app/+search-page/search-sidebar/search-sidebar.component.js.map new file mode 100644 index 0000000000..8582442a2b --- /dev/null +++ b/src/app/+search-page/search-sidebar/search-sidebar.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-sidebar.component.js","sourceRoot":"","sources":["search-sidebar.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvE;;;;GAIG;AAWH;IATA;QA+BE;;WAEG;QACO,kBAAa,GAAG,IAAI,YAAY,EAAW,CAAC;IAExD,CAAC;IAtBU;QAAR,KAAK,EAAE;;qEAAgD;IAK/C;QAAR,KAAK,EAAE;;+DAAa;IAKZ;QAAR,KAAK,EAAE;;gEAAc;IAKb;QAAR,KAAK,EAAE;;iEAAe;IAKb;QAAT,MAAM,EAAE;;iEAA6C;IAzB3C,sBAAsB;QATlC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,SAAS,EAAE,CAAC,iCAAiC,CAAC;YAC9C,WAAW,EAAE,iCAAiC;SAC/C,CAAC;QAEF;;WAEG;OACU,sBAAsB,CA2BlC;IAAD,6BAAC;CAAA,AA3BD,IA2BC;SA3BY,sBAAsB"} \ No newline at end of file diff --git a/src/app/+search-page/search-sidebar/search-sidebar.effects.js b/src/app/+search-page/search-sidebar/search-sidebar.effects.js new file mode 100644 index 0000000000..8f788ba393 --- /dev/null +++ b/src/app/+search-page/search-sidebar/search-sidebar.effects.js @@ -0,0 +1,37 @@ +import * as tslib_1 from "tslib"; +import { map, tap, filter } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { Effect, Actions, ofType } from '@ngrx/effects'; +import * as fromRouter from '@ngrx/router-store'; +import { SearchSidebarCollapseAction } from './search-sidebar.actions'; +import { URLBaser } from '../../core/url-baser/url-baser'; +/** + * Makes sure that if the user navigates to another route, the sidebar is collapsed + */ +var SearchSidebarEffects = /** @class */ (function () { + function SearchSidebarEffects(actions$) { + var _this = this; + this.actions$ = actions$; + this.routeChange$ = this.actions$ + .pipe(ofType(fromRouter.ROUTER_NAVIGATION), filter(function (action) { return _this.previousPath !== _this.getBaseUrl(action); }), tap(function (action) { + _this.previousPath = _this.getBaseUrl(action); + }), map(function () { return new SearchSidebarCollapseAction(); })); + } + SearchSidebarEffects.prototype.getBaseUrl = function (action) { + /* tslint:disable:no-string-literal */ + var url = action['payload'].routerState.url; + return new URLBaser(url).toString(); + /* tslint:enable:no-string-literal */ + }; + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], SearchSidebarEffects.prototype, "routeChange$", void 0); + SearchSidebarEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Actions]) + ], SearchSidebarEffects); + return SearchSidebarEffects; +}()); +export { SearchSidebarEffects }; +//# sourceMappingURL=search-sidebar.effects.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-sidebar/search-sidebar.effects.js.map b/src/app/+search-page/search-sidebar/search-sidebar.effects.js.map new file mode 100644 index 0000000000..3d714074ee --- /dev/null +++ b/src/app/+search-page/search-sidebar/search-sidebar.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-sidebar.effects.js","sourceRoot":"","sources":["search-sidebar.effects.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D;;GAEG;AAEH;IAYE,8BAAoB,QAAiB;QAArC,iBAEC;QAFmB,aAAQ,GAAR,QAAQ,CAAS;QAV3B,iBAAY,GAAG,IAAI,CAAC,QAAQ;aACnC,IAAI,CACH,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,EACpC,MAAM,CAAC,UAAC,MAAM,IAAK,OAAA,KAAI,CAAC,YAAY,KAAK,KAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAA7C,CAA6C,CAAC,EACjE,GAAG,CAAC,UAAC,MAAM;YACT,KAAI,CAAC,YAAY,GAAG,KAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QAC7C,CAAC,CAAC,EACF,GAAG,CAAC,cAAM,OAAA,IAAI,2BAA2B,EAAE,EAAjC,CAAiC,CAAC,CAC7C,CAAC;IAIJ,CAAC;IAED,yCAAU,GAAV,UAAW,MAAW;QACpB,sCAAsC;QACtC,IAAM,GAAG,GAAW,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC;QACtD,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;QACpC,qCAAqC;IACvC,CAAC;IAnBS;QAAT,MAAM,EAAE;;8DAQL;IAVO,oBAAoB;QADhC,UAAU,EAAE;iDAamB,OAAO;OAZ1B,oBAAoB,CAuBhC;IAAD,2BAAC;CAAA,AAvBD,IAuBC;SAvBY,oBAAoB"} \ No newline at end of file diff --git a/src/app/+search-page/search-sidebar/search-sidebar.reducer.js b/src/app/+search-page/search-sidebar/search-sidebar.reducer.js new file mode 100644 index 0000000000..8ac297eafb --- /dev/null +++ b/src/app/+search-page/search-sidebar/search-sidebar.reducer.js @@ -0,0 +1,34 @@ +import { SearchSidebarActionTypes } from './search-sidebar.actions'; +var initialState = { + sidebarCollapsed: true +}; +/** + * Performs a search sidebar action on the current state + * @param {SearchSidebarState} state The state before the action is performed + * @param {SearchSidebarAction} action The action that should be performed + * @returns {SearchSidebarState} The state after the action is performed + */ +export function sidebarReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case SearchSidebarActionTypes.COLLAPSE: { + return Object.assign({}, state, { + sidebarCollapsed: true + }); + } + case SearchSidebarActionTypes.EXPAND: { + return Object.assign({}, state, { + sidebarCollapsed: false + }); + } + case SearchSidebarActionTypes.TOGGLE: { + return Object.assign({}, state, { + sidebarCollapsed: !state.sidebarCollapsed + }); + } + default: { + return state; + } + } +} +//# sourceMappingURL=search-sidebar.reducer.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-sidebar/search-sidebar.reducer.js.map b/src/app/+search-page/search-sidebar/search-sidebar.reducer.js.map new file mode 100644 index 0000000000..f75abc15de --- /dev/null +++ b/src/app/+search-page/search-sidebar/search-sidebar.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-sidebar.reducer.js","sourceRoot":"","sources":["search-sidebar.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AASzF,IAAM,YAAY,GAAuB;IACvC,gBAAgB,EAAE,IAAI;CACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,yBAAyB,KAAoB,EAAE,MAA2B;IAAjD,sBAAA,EAAA,oBAAoB;IACjD,QAAQ,MAAM,CAAC,IAAI,EAAE;QAEnB,KAAK,wBAAwB,CAAC,QAAQ,CAAC,CAAC;YACtC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,gBAAgB,EAAE,IAAI;aACvB,CAAC,CAAC;SACJ;QAED,KAAK,wBAAwB,CAAC,MAAM,CAAC,CAAC;YACpC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,gBAAgB,EAAE,KAAK;aACxB,CAAC,CAAC;SAEJ;QAED,KAAK,wBAAwB,CAAC,MAAM,CAAC,CAAC;YACpC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,gBAAgB,EAAE,CAAC,KAAK,CAAC,gBAAgB;aAC1C,CAAC,CAAC;SAEJ;QAED,OAAO,CAAC,CAAC;YACP,OAAO,KAAK,CAAC;SACd;KACF;AACH,CAAC"} \ No newline at end of file diff --git a/src/app/+search-page/search-sidebar/search-sidebar.service.js b/src/app/+search-page/search-sidebar/search-sidebar.service.js new file mode 100644 index 0000000000..fc4c506fd5 --- /dev/null +++ b/src/app/+search-page/search-sidebar/search-sidebar.service.js @@ -0,0 +1,53 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest } from 'rxjs'; +import { Injectable } from '@angular/core'; +import { createSelector, select, Store } from '@ngrx/store'; +import { SearchSidebarCollapseAction, SearchSidebarExpandAction } from './search-sidebar.actions'; +import { HostWindowService } from '../../shared/host-window.service'; +import { map } from 'rxjs/operators'; +var sidebarStateSelector = function (state) { return state.searchSidebar; }; +var sidebarCollapsedSelector = createSelector(sidebarStateSelector, function (sidebar) { return sidebar.sidebarCollapsed; }); +/** + * Service that performs all actions that have to do with the search sidebar + */ +var SearchSidebarService = /** @class */ (function () { + function SearchSidebarService(store, windowService) { + this.store = store; + this.windowService = windowService; + this.isXsOrSm$ = this.windowService.isXsOrSm(); + this.isCollapsedInStore = this.store.pipe(select(sidebarCollapsedSelector)); + } + Object.defineProperty(SearchSidebarService.prototype, "isCollapsed", { + /** + * Checks if the sidebar should currently be collapsed + * @returns {Observable} Emits true if the user's screen size is mobile or when the state in the store is currently collapsed + */ + get: function () { + return observableCombineLatest(this.isXsOrSm$, this.isCollapsedInStore).pipe(map(function (_a) { + var mobile = _a[0], store = _a[1]; + return mobile ? store : true; + })); + }, + enumerable: true, + configurable: true + }); + /** + * Dispatches a collapse action to the store + */ + SearchSidebarService.prototype.collapse = function () { + this.store.dispatch(new SearchSidebarCollapseAction()); + }; + /** + * Dispatches an expand action to the store + */ + SearchSidebarService.prototype.expand = function () { + this.store.dispatch(new SearchSidebarExpandAction()); + }; + SearchSidebarService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Store, HostWindowService]) + ], SearchSidebarService); + return SearchSidebarService; +}()); +export { SearchSidebarService }; +//# sourceMappingURL=search-sidebar.service.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-sidebar/search-sidebar.service.js.map b/src/app/+search-page/search-sidebar/search-sidebar.service.js.map new file mode 100644 index 0000000000..fd0635dd46 --- /dev/null +++ b/src/app/+search-page/search-sidebar/search-sidebar.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-sidebar.service.js","sourceRoot":"","sources":["search-sidebar.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAc,MAAM,MAAM,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAElG,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,IAAM,oBAAoB,GAAG,UAAC,KAAe,IAAK,OAAA,KAAK,CAAC,aAAa,EAAnB,CAAmB,CAAC;AACtE,IAAM,wBAAwB,GAAG,cAAc,CAAC,oBAAoB,EAAE,UAAC,OAA2B,IAAK,OAAA,OAAO,CAAC,gBAAgB,EAAxB,CAAwB,CAAC,CAAC;AAEjI;;GAEG;AAEH;IAWE,8BAAoB,KAAsB,EAAU,aAAgC;QAAhE,UAAK,GAAL,KAAK,CAAiB;QAAU,kBAAa,GAAb,aAAa,CAAmB;QAClF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;QAC/C,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAC9E,CAAC;IAMD,sBAAI,6CAAW;QAJf;;;WAGG;aACH;YACE,OAAO,uBAAuB,CAC5B,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,kBAAkB,CACxB,CAAC,IAAI,CACJ,GAAG,CAAC,UAAC,EAAe;oBAAd,cAAM,EAAE,aAAK;gBAAM,OAAA,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;YAArB,CAAqB,CAAC,CAChD,CAAC;QACJ,CAAC;;;OAAA;IAED;;OAEG;IACI,uCAAQ,GAAf;QACE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,2BAA2B,EAAE,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACI,qCAAM,GAAb;QACE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,yBAAyB,EAAE,CAAC,CAAC;IACvD,CAAC;IAzCU,oBAAoB;QADhC,UAAU,EAAE;iDAYgB,KAAK,EAAmC,iBAAiB;OAXzE,oBAAoB,CA0ChC;IAAD,2BAAC;CAAA,AA1CD,IA0CC;SA1CY,oBAAoB"} \ No newline at end of file diff --git a/src/app/+search-page/search-switch-configuration/search-configuration-option.model.js b/src/app/+search-page/search-switch-configuration/search-configuration-option.model.js new file mode 100644 index 0000000000..9866eff61c --- /dev/null +++ b/src/app/+search-page/search-switch-configuration/search-configuration-option.model.js @@ -0,0 +1 @@ +//# sourceMappingURL=search-configuration-option.model.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-switch-configuration/search-configuration-option.model.js.map b/src/app/+search-page/search-switch-configuration/search-configuration-option.model.js.map new file mode 100644 index 0000000000..bba49d72a6 --- /dev/null +++ b/src/app/+search-page/search-switch-configuration/search-configuration-option.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-configuration-option.model.js","sourceRoot":"","sources":["search-configuration-option.model.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/+search-page/search-switch-configuration/search-switch-configuration.component.js b/src/app/+search-page/search-switch-configuration/search-switch-configuration.component.js new file mode 100644 index 0000000000..84dfd0c960 --- /dev/null +++ b/src/app/+search-page/search-switch-configuration/search-switch-configuration.component.js @@ -0,0 +1,74 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject, Input } from '@angular/core'; +import { Router } from '@angular/router'; +import { hasValue } from '../../shared/empty.util'; +import { SEARCH_CONFIG_SERVICE } from '../../+my-dspace-page/my-dspace-page.component'; +import { SearchConfigurationService } from '../search-service/search-configuration.service'; +import { SearchService } from '../search-service/search.service'; +var SearchSwitchConfigurationComponent = /** @class */ (function () { + function SearchSwitchConfigurationComponent(router, searchService, searchConfigService) { + this.router = router; + this.searchService = searchService; + this.searchConfigService = searchConfigService; + /** + * The list of available configuration options + */ + this.configurationList = []; + } + /** + * Init current configuration + */ + SearchSwitchConfigurationComponent.prototype.ngOnInit = function () { + var _this = this; + this.searchConfigService.getCurrentConfiguration('default') + .subscribe(function (currentConfiguration) { return _this.selectedOption = currentConfiguration; }); + }; + /** + * Init current configuration + */ + SearchSwitchConfigurationComponent.prototype.onSelect = function () { + var navigationExtras = { + queryParams: { configuration: this.selectedOption }, + }; + this.router.navigate([this.searchService.getSearchLink()], navigationExtras); + }; + /** + * Define the select 'compareWith' method to tell Angular how to compare the values + * + * @param item1 + * @param item2 + */ + SearchSwitchConfigurationComponent.prototype.compare = function (item1, item2) { + return item1 === item2; + }; + /** + * Make sure the subscription is unsubscribed from when this component is destroyed + */ + SearchSwitchConfigurationComponent.prototype.ngOnDestroy = function () { + if (hasValue(this.sub)) { + this.sub.unsubscribe(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], SearchSwitchConfigurationComponent.prototype, "configurationList", void 0); + SearchSwitchConfigurationComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-switch-configuration', + styleUrls: ['./search-switch-configuration.component.scss'], + templateUrl: './search-switch-configuration.component.html', + }) + /** + * Represents a select that allow to switch over available search configurations + */ + , + tslib_1.__param(2, Inject(SEARCH_CONFIG_SERVICE)), + tslib_1.__metadata("design:paramtypes", [Router, + SearchService, + SearchConfigurationService]) + ], SearchSwitchConfigurationComponent); + return SearchSwitchConfigurationComponent; +}()); +export { SearchSwitchConfigurationComponent }; +//# sourceMappingURL=search-switch-configuration.component.js.map \ No newline at end of file diff --git a/src/app/+search-page/search-switch-configuration/search-switch-configuration.component.js.map b/src/app/+search-page/search-switch-configuration/search-switch-configuration.component.js.map new file mode 100644 index 0000000000..7fe1fa3af7 --- /dev/null +++ b/src/app/+search-page/search-switch-configuration/search-switch-configuration.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-switch-configuration.component.js","sourceRoot":"","sources":["search-switch-configuration.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAoB,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAI3D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAG5F,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAUjE;IAiBE,4CAAoB,MAAc,EACd,aAA4B,EACG,mBAA+C;QAF9E,WAAM,GAAN,MAAM,CAAQ;QACd,kBAAa,GAAb,aAAa,CAAe;QACG,wBAAmB,GAAnB,mBAAmB,CAA4B;QAjBlG;;WAEG;QACM,sBAAiB,GAAgC,EAAE,CAAC;IAe7D,CAAC;IAED;;OAEG;IACH,qDAAQ,GAAR;QAAA,iBAGC;QAFC,IAAI,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,SAAS,CAAC;aACxD,SAAS,CAAC,UAAC,oBAAoB,IAAK,OAAA,KAAI,CAAC,cAAc,GAAG,oBAAoB,EAA1C,CAA0C,CAAC,CAAC;IACrF,CAAC;IAED;;OAEG;IACH,qDAAQ,GAAR;QACE,IAAM,gBAAgB,GAAqB;YACzC,WAAW,EAAE,EAAC,aAAa,EAAE,IAAI,CAAC,cAAc,EAAC;SAClD,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;OAKG;IACH,oDAAO,GAAP,UAAQ,KAAqC,EAAE,KAAqC;QAClF,OAAO,KAAK,KAAK,KAAK,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,wDAAW,GAAX;QACE,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;SACxB;IACH,CAAC;IArDQ;QAAR,KAAK,EAAE;;iFAAqD;IALlD,kCAAkC;QAR9C,SAAS,CAAC;YACT,QAAQ,EAAE,gCAAgC;YAC1C,SAAS,EAAE,CAAC,8CAA8C,CAAC;YAC3D,WAAW,EAAE,8CAA8C;SAC5D,CAAC;QACF;;WAEG;;QAoBY,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;iDAFd,MAAM;YACC,aAAa;YACwB,0BAA0B;OAnBvF,kCAAkC,CA2D9C;IAAD,yCAAC;CAAA,AA3DD,IA2DC;SA3DY,kCAAkC"} \ No newline at end of file diff --git a/src/app/+submit-page/submit-page-routing.module.js b/src/app/+submit-page/submit-page-routing.module.js new file mode 100644 index 0000000000..8f11bedf79 --- /dev/null +++ b/src/app/+submit-page/submit-page-routing.module.js @@ -0,0 +1,33 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; +import { SubmissionSubmitComponent } from '../submission/submit/submission-submit.component'; +var SubmitPageRoutingModule = /** @class */ (function () { + /** + * This module defines the default component to load when navigating to the submit page path. + */ + function SubmitPageRoutingModule() { + } + SubmitPageRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { + canActivate: [AuthenticatedGuard], + path: '', + pathMatch: 'full', + component: SubmissionSubmitComponent, + data: { title: 'submission.submit.title' } + } + ]) + ] + }) + /** + * This module defines the default component to load when navigating to the submit page path. + */ + ], SubmitPageRoutingModule); + return SubmitPageRoutingModule; +}()); +export { SubmitPageRoutingModule }; +//# sourceMappingURL=submit-page-routing.module.js.map \ No newline at end of file diff --git a/src/app/+submit-page/submit-page-routing.module.js.map b/src/app/+submit-page/submit-page-routing.module.js.map new file mode 100644 index 0000000000..227670133b --- /dev/null +++ b/src/app/+submit-page/submit-page-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submit-page-routing.module.js","sourceRoot":"","sources":["submit-page-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAkB7F;IAHA;;OAEG;IACH;IAAuC,CAAC;IAA3B,uBAAuB;QAhBnC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB;wBACE,WAAW,EAAE,CAAC,kBAAkB,CAAC;wBACjC,IAAI,EAAE,EAAE;wBACR,SAAS,EAAE,MAAM;wBACjB,SAAS,EAAE,yBAAyB;wBACpC,IAAI,EAAE,EAAE,KAAK,EAAE,yBAAyB,EAAE;qBAC3C;iBACF,CAAC;aACH;SACF,CAAC;QACF;;WAEG;OACU,uBAAuB,CAAI;IAAD,8BAAC;CAAA,AAAxC,IAAwC;SAA3B,uBAAuB"} \ No newline at end of file diff --git a/src/app/+submit-page/submit-page.module.js b/src/app/+submit-page/submit-page.module.js new file mode 100644 index 0000000000..8ed8939182 --- /dev/null +++ b/src/app/+submit-page/submit-page.module.js @@ -0,0 +1,29 @@ +import * as tslib_1 from "tslib"; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { SharedModule } from '../shared/shared.module'; +import { SubmitPageRoutingModule } from './submit-page-routing.module'; +import { SubmissionModule } from '../submission/submission.module'; +var SubmitPageModule = /** @class */ (function () { + /** + * This module handles all modules that need to access the submit page. + */ + function SubmitPageModule() { + } + SubmitPageModule = tslib_1.__decorate([ + NgModule({ + imports: [ + SubmitPageRoutingModule, + CommonModule, + SharedModule, + SubmissionModule, + ], + }) + /** + * This module handles all modules that need to access the submit page. + */ + ], SubmitPageModule); + return SubmitPageModule; +}()); +export { SubmitPageModule }; +//# sourceMappingURL=submit-page.module.js.map \ No newline at end of file diff --git a/src/app/+submit-page/submit-page.module.js.map b/src/app/+submit-page/submit-page.module.js.map new file mode 100644 index 0000000000..e686e4169e --- /dev/null +++ b/src/app/+submit-page/submit-page.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submit-page.module.js","sourceRoot":"","sources":["submit-page.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAanE;IAHA;;OAEG;IACH;IAEA,CAAC;IAFY,gBAAgB;QAX5B,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,uBAAuB;gBACvB,YAAY;gBACZ,YAAY;gBACZ,gBAAgB;aACjB;SACF,CAAC;QACF;;WAEG;OACU,gBAAgB,CAE5B;IAAD,uBAAC;CAAA,AAFD,IAEC;SAFY,gBAAgB"} \ No newline at end of file diff --git a/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.js b/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.js new file mode 100644 index 0000000000..0b22883628 --- /dev/null +++ b/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.js @@ -0,0 +1,33 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; +import { SubmissionEditComponent } from '../submission/edit/submission-edit.component'; +var WorkflowitemsEditPageRoutingModule = /** @class */ (function () { + /** + * This module defines the default component to load when navigating to the workflowitems edit page path. + */ + function WorkflowitemsEditPageRoutingModule() { + } + WorkflowitemsEditPageRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', redirectTo: '/home', pathMatch: 'full' }, + { + canActivate: [AuthenticatedGuard], + path: ':id/edit', + component: SubmissionEditComponent, + data: { title: 'submission.edit.title' } + } + ]) + ] + }) + /** + * This module defines the default component to load when navigating to the workflowitems edit page path. + */ + ], WorkflowitemsEditPageRoutingModule); + return WorkflowitemsEditPageRoutingModule; +}()); +export { WorkflowitemsEditPageRoutingModule }; +//# sourceMappingURL=workflowitems-edit-page-routing.module.js.map \ No newline at end of file diff --git a/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.js.map b/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.js.map new file mode 100644 index 0000000000..2304b1f2cc --- /dev/null +++ b/src/app/+workflowitems-edit-page/workflowitems-edit-page-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workflowitems-edit-page-routing.module.js","sourceRoot":"","sources":["workflowitems-edit-page-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAkBvF;IAHA;;OAEG;IACH;IAAkD,CAAC;IAAtC,kCAAkC;QAhB9C,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE;oBACpD;wBACE,WAAW,EAAE,CAAC,kBAAkB,CAAC;wBACjC,IAAI,EAAE,UAAU;wBAChB,SAAS,EAAE,uBAAuB;wBAClC,IAAI,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE;qBACzC;iBACF,CAAC;aACH;SACF,CAAC;QACF;;WAEG;OACU,kCAAkC,CAAI;IAAD,yCAAC;CAAA,AAAnD,IAAmD;SAAtC,kCAAkC"} \ No newline at end of file diff --git a/src/app/+workflowitems-edit-page/workflowitems-edit-page.module.js b/src/app/+workflowitems-edit-page/workflowitems-edit-page.module.js new file mode 100644 index 0000000000..68112b1cc0 --- /dev/null +++ b/src/app/+workflowitems-edit-page/workflowitems-edit-page.module.js @@ -0,0 +1,30 @@ +import * as tslib_1 from "tslib"; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { SharedModule } from '../shared/shared.module'; +import { WorkflowitemsEditPageRoutingModule } from './workflowitems-edit-page-routing.module'; +import { SubmissionModule } from '../submission/submission.module'; +var WorkflowitemsEditPageModule = /** @class */ (function () { + /** + * This module handles all modules that need to access the workflowitems edit page. + */ + function WorkflowitemsEditPageModule() { + } + WorkflowitemsEditPageModule = tslib_1.__decorate([ + NgModule({ + imports: [ + WorkflowitemsEditPageRoutingModule, + CommonModule, + SharedModule, + SubmissionModule, + ], + declarations: [] + }) + /** + * This module handles all modules that need to access the workflowitems edit page. + */ + ], WorkflowitemsEditPageModule); + return WorkflowitemsEditPageModule; +}()); +export { WorkflowitemsEditPageModule }; +//# sourceMappingURL=workflowitems-edit-page.module.js.map \ No newline at end of file diff --git a/src/app/+workflowitems-edit-page/workflowitems-edit-page.module.js.map b/src/app/+workflowitems-edit-page/workflowitems-edit-page.module.js.map new file mode 100644 index 0000000000..7e5bddcf4c --- /dev/null +++ b/src/app/+workflowitems-edit-page/workflowitems-edit-page.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workflowitems-edit-page.module.js","sourceRoot":"","sources":["workflowitems-edit-page.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAcnE;IAHA;;OAEG;IACH;IAEA,CAAC;IAFY,2BAA2B;QAZvC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,kCAAkC;gBAClC,YAAY;gBACZ,YAAY;gBACZ,gBAAgB;aACjB;YACD,YAAY,EAAE,EAAE;SACjB,CAAC;QACF;;WAEG;OACU,2BAA2B,CAEvC;IAAD,kCAAC;CAAA,AAFD,IAEC;SAFY,2BAA2B"} \ No newline at end of file diff --git a/src/app/+workspaceitems-edit-page/workspaceitems-edit-page-routing.module.js b/src/app/+workspaceitems-edit-page/workspaceitems-edit-page-routing.module.js new file mode 100644 index 0000000000..a6a04a9a5d --- /dev/null +++ b/src/app/+workspaceitems-edit-page/workspaceitems-edit-page-routing.module.js @@ -0,0 +1,33 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; +import { SubmissionEditComponent } from '../submission/edit/submission-edit.component'; +var WorkspaceitemsEditPageRoutingModule = /** @class */ (function () { + /** + * This module defines the default component to load when navigating to the workspaceitems edit page path + */ + function WorkspaceitemsEditPageRoutingModule() { + } + WorkspaceitemsEditPageRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', redirectTo: '/home', pathMatch: 'full' }, + { + canActivate: [AuthenticatedGuard], + path: ':id/edit', + component: SubmissionEditComponent, + data: { title: 'submission.edit.title' } + } + ]) + ] + }) + /** + * This module defines the default component to load when navigating to the workspaceitems edit page path + */ + ], WorkspaceitemsEditPageRoutingModule); + return WorkspaceitemsEditPageRoutingModule; +}()); +export { WorkspaceitemsEditPageRoutingModule }; +//# sourceMappingURL=workspaceitems-edit-page-routing.module.js.map \ No newline at end of file diff --git a/src/app/+workspaceitems-edit-page/workspaceitems-edit-page-routing.module.js.map b/src/app/+workspaceitems-edit-page/workspaceitems-edit-page-routing.module.js.map new file mode 100644 index 0000000000..378ddd7a97 --- /dev/null +++ b/src/app/+workspaceitems-edit-page/workspaceitems-edit-page-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitems-edit-page-routing.module.js","sourceRoot":"","sources":["workspaceitems-edit-page-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAkBvF;IAHA;;OAEG;IACH;IAAmD,CAAC;IAAvC,mCAAmC;QAhB/C,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY,CAAC,QAAQ,CAAC;oBACpB,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE;oBACpD;wBACE,WAAW,EAAE,CAAC,kBAAkB,CAAC;wBACjC,IAAI,EAAE,UAAU;wBAChB,SAAS,EAAE,uBAAuB;wBAClC,IAAI,EAAE,EAAE,KAAK,EAAE,uBAAuB,EAAE;qBACzC;iBACF,CAAC;aACH;SACF,CAAC;QACF;;WAEG;OACU,mCAAmC,CAAI;IAAD,0CAAC;CAAA,AAApD,IAAoD;SAAvC,mCAAmC"} \ No newline at end of file diff --git a/src/app/+workspaceitems-edit-page/workspaceitems-edit-page.module.js b/src/app/+workspaceitems-edit-page/workspaceitems-edit-page.module.js new file mode 100644 index 0000000000..13cafca2c9 --- /dev/null +++ b/src/app/+workspaceitems-edit-page/workspaceitems-edit-page.module.js @@ -0,0 +1,30 @@ +import * as tslib_1 from "tslib"; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { SharedModule } from '../shared/shared.module'; +import { WorkspaceitemsEditPageRoutingModule } from './workspaceitems-edit-page-routing.module'; +import { SubmissionModule } from '../submission/submission.module'; +var WorkspaceitemsEditPageModule = /** @class */ (function () { + /** + * This module handles all modules that need to access the workspaceitems edit page. + */ + function WorkspaceitemsEditPageModule() { + } + WorkspaceitemsEditPageModule = tslib_1.__decorate([ + NgModule({ + imports: [ + WorkspaceitemsEditPageRoutingModule, + CommonModule, + SharedModule, + SubmissionModule, + ], + declarations: [] + }) + /** + * This module handles all modules that need to access the workspaceitems edit page. + */ + ], WorkspaceitemsEditPageModule); + return WorkspaceitemsEditPageModule; +}()); +export { WorkspaceitemsEditPageModule }; +//# sourceMappingURL=workspaceitems-edit-page.module.js.map \ No newline at end of file diff --git a/src/app/+workspaceitems-edit-page/workspaceitems-edit-page.module.js.map b/src/app/+workspaceitems-edit-page/workspaceitems-edit-page.module.js.map new file mode 100644 index 0000000000..192b392b9f --- /dev/null +++ b/src/app/+workspaceitems-edit-page/workspaceitems-edit-page.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitems-edit-page.module.js","sourceRoot":"","sources":["workspaceitems-edit-page.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,mCAAmC,EAAE,MAAM,2CAA2C,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAcnE;IAHA;;OAEG;IACH;IAEA,CAAC;IAFY,4BAA4B;QAZxC,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,mCAAmC;gBACnC,YAAY;gBACZ,YAAY;gBACZ,gBAAgB;aACjB;YACD,YAAY,EAAE,EAAE;SACjB,CAAC;QACF;;WAEG;OACU,4BAA4B,CAExC;IAAD,mCAAC;CAAA,AAFD,IAEC;SAFY,4BAA4B"} \ No newline at end of file diff --git a/src/app/app-routing.module.js b/src/app/app-routing.module.js new file mode 100644 index 0000000000..76fc1d5f7d --- /dev/null +++ b/src/app/app-routing.module.js @@ -0,0 +1,48 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component'; +import { AuthenticatedGuard } from './core/auth/authenticated.guard'; +var ITEM_MODULE_PATH = 'items'; +export function getItemModulePath() { + return "/" + ITEM_MODULE_PATH; +} +var COLLECTION_MODULE_PATH = 'collections'; +export function getCollectionModulePath() { + return "/" + COLLECTION_MODULE_PATH; +} +var COMMUNITY_MODULE_PATH = 'communities'; +export function getCommunityModulePath() { + return "/" + COMMUNITY_MODULE_PATH; +} +var AppRoutingModule = /** @class */ (function () { + function AppRoutingModule() { + } + AppRoutingModule = tslib_1.__decorate([ + NgModule({ + imports: [ + RouterModule.forRoot([ + { path: '', redirectTo: '/home', pathMatch: 'full' }, + { path: 'home', loadChildren: './+home-page/home-page.module#HomePageModule' }, + { path: COMMUNITY_MODULE_PATH, loadChildren: './+community-page/community-page.module#CommunityPageModule' }, + { path: COLLECTION_MODULE_PATH, loadChildren: './+collection-page/collection-page.module#CollectionPageModule' }, + { path: ITEM_MODULE_PATH, loadChildren: './+item-page/item-page.module#ItemPageModule' }, + { path: 'mydspace', loadChildren: './+my-dspace-page/my-dspace-page.module#MyDSpacePageModule', canActivate: [AuthenticatedGuard] }, + { path: 'search', loadChildren: './+search-page/search-page.module#SearchPageModule' }, + { path: 'browse', loadChildren: './+browse-by/browse-by.module#BrowseByModule' }, + { path: 'admin', loadChildren: './+admin/admin.module#AdminModule', canActivate: [AuthenticatedGuard] }, + { path: 'login', loadChildren: './+login-page/login-page.module#LoginPageModule' }, + { path: 'logout', loadChildren: './+logout-page/logout-page.module#LogoutPageModule' }, + { path: 'submit', loadChildren: './+submit-page/submit-page.module#SubmitPageModule' }, + { path: 'workspaceitems', loadChildren: './+workspaceitems-edit-page/workspaceitems-edit-page.module#WorkspaceitemsEditPageModule' }, + { path: 'workflowitems', loadChildren: './+workflowitems-edit-page/workflowitems-edit-page.module#WorkflowitemsEditPageModule' }, + { path: '**', pathMatch: 'full', component: PageNotFoundComponent }, + ]) + ], + exports: [RouterModule] + }) + ], AppRoutingModule); + return AppRoutingModule; +}()); +export { AppRoutingModule }; +//# sourceMappingURL=app-routing.module.js.map \ No newline at end of file diff --git a/src/app/app-routing.module.js.map b/src/app/app-routing.module.js.map new file mode 100644 index 0000000000..35290f0a06 --- /dev/null +++ b/src/app/app-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app-routing.module.js","sourceRoot":"","sources":["app-routing.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,IAAM,gBAAgB,GAAG,OAAO,CAAC;AACjC,MAAM;IACJ,OAAO,MAAI,gBAAkB,CAAC;AAChC,CAAC;AACD,IAAM,sBAAsB,GAAG,aAAa,CAAC;AAC7C,MAAM;IACJ,OAAO,MAAI,sBAAwB,CAAC;AACtC,CAAC;AACD,IAAM,qBAAqB,GAAG,aAAa,CAAC;AAC5C,MAAM;IACJ,OAAO,MAAI,qBAAuB,CAAC;AACrC,CAAC;AAuBD;IAAA;IAEA,CAAC;IAFY,gBAAgB;QAtB5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AgB,CAE5B;IAAD,uBAAC;CAAA,AAFD,IAEC;SAFY,gBAAgB"} \ No newline at end of file diff --git a/src/app/app.component.js b/src/app/app.component.js new file mode 100644 index 0000000000..6c9ccae304 --- /dev/null +++ b/src/app/app.component.js @@ -0,0 +1,131 @@ +import * as tslib_1 from "tslib"; +import { filter, map, take } from 'rxjs/operators'; +import { ChangeDetectionStrategy, Component, HostListener, Inject, ViewEncapsulation } from '@angular/core'; +import { NavigationCancel, NavigationEnd, NavigationStart, Router } from '@angular/router'; +import { select, Store } from '@ngrx/store'; +import { TranslateService } from '@ngx-translate/core'; +import { GLOBAL_CONFIG } from '../config'; +import { MetadataService } from './core/metadata/metadata.service'; +import { HostWindowResizeAction } from './shared/host-window.actions'; +import { NativeWindowRef, NativeWindowService } from './shared/services/window.service'; +import { isAuthenticated } from './core/auth/selectors'; +import { AuthService } from './core/auth/auth.service'; +import { Angulartics2GoogleAnalytics } from 'angulartics2/ga'; +import { RouteService } from './shared/services/route.service'; +import variables from '../styles/_exposed_variables.scss'; +import { CSSVariableService } from './shared/sass-helper/sass-helper.service'; +import { MenuService } from './shared/menu/menu.service'; +import { MenuID } from './shared/menu/initial-menus-state'; +import { slideSidebarPadding } from './shared/animations/slide'; +import { combineLatest as combineLatestObservable } from 'rxjs'; +import { HostWindowService } from './shared/host-window.service'; +var AppComponent = /** @class */ (function () { + function AppComponent(config, _window, translate, store, metadata, angulartics2GoogleAnalytics, authService, router, routeService, cssService, menuService, windowService) { + this.config = config; + this._window = _window; + this.translate = translate; + this.store = store; + this.metadata = metadata; + this.angulartics2GoogleAnalytics = angulartics2GoogleAnalytics; + this.authService = authService; + this.router = router; + this.routeService = routeService; + this.cssService = cssService; + this.menuService = menuService; + this.windowService = windowService; + this.isLoading = true; + // Load all the languages that are defined as active from the config file + translate.addLangs(config.languages.filter(function (LangConfig) { return LangConfig.active === true; }).map(function (a) { return a.code; })); + // Load the default language from the config file + translate.setDefaultLang(config.defaultLanguage); + // Attempt to get the browser language from the user + if (translate.getLangs().includes(translate.getBrowserLang())) { + translate.use(translate.getBrowserLang()); + } + else { + translate.use(config.defaultLanguage); + } + metadata.listenForRouteChange(); + routeService.saveRouting(); + if (config.debug) { + console.info(config); + } + this.storeCSSVariables(); + } + AppComponent.prototype.ngOnInit = function () { + var _this = this; + var env = this.config.production ? 'Production' : 'Development'; + var color = this.config.production ? 'red' : 'green'; + console.info("Environment: %c" + env, "color: " + color + "; font-weight: bold;"); + this.dispatchWindowSize(this._window.nativeWindow.innerWidth, this._window.nativeWindow.innerHeight); + // Whether is not authenticathed try to retrieve a possible stored auth token + this.store.pipe(select(isAuthenticated), take(1), filter(function (authenticated) { return !authenticated; })).subscribe(function (authenticated) { return _this.authService.checkAuthenticationToken(); }); + this.sidebarVisible = this.menuService.isMenuVisible(MenuID.ADMIN); + this.collapsedSidebarWidth = this.cssService.getVariable('collapsedSidebarWidth'); + this.totalSidebarWidth = this.cssService.getVariable('totalSidebarWidth'); + var sidebarCollapsed = this.menuService.isMenuCollapsed(MenuID.ADMIN); + this.slideSidebarOver = combineLatestObservable(sidebarCollapsed, this.windowService.isXsOrSm()) + .pipe(map(function (_a) { + var collapsed = _a[0], mobile = _a[1]; + return collapsed || mobile; + })); + }; + AppComponent.prototype.storeCSSVariables = function () { + var _this = this; + var vars = variables.locals || {}; + Object.keys(vars).forEach(function (name) { + _this.cssService.addCSSVariable(name, vars[name]); + }); + }; + AppComponent.prototype.ngAfterViewInit = function () { + var _this = this; + this.router.events + .subscribe(function (event) { + if (event instanceof NavigationStart) { + _this.isLoading = true; + } + else if (event instanceof NavigationEnd || + event instanceof NavigationCancel) { + _this.isLoading = false; + } + }); + }; + AppComponent.prototype.onResize = function (event) { + this.dispatchWindowSize(event.target.innerWidth, event.target.innerHeight); + }; + AppComponent.prototype.dispatchWindowSize = function (width, height) { + this.store.dispatch(new HostWindowResizeAction(width, height)); + }; + tslib_1.__decorate([ + HostListener('window:resize', ['$event']), + tslib_1.__metadata("design:type", Function), + tslib_1.__metadata("design:paramtypes", [Object]), + tslib_1.__metadata("design:returntype", void 0) + ], AppComponent.prototype, "onResize", null); + AppComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-app', + templateUrl: './app.component.html', + styleUrls: ['./app.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + encapsulation: ViewEncapsulation.None, + animations: [slideSidebarPadding] + }), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__param(1, Inject(NativeWindowService)), + tslib_1.__metadata("design:paramtypes", [Object, NativeWindowRef, + TranslateService, + Store, + MetadataService, + Angulartics2GoogleAnalytics, + AuthService, + Router, + RouteService, + CSSVariableService, + MenuService, + HostWindowService]) + ], AppComponent); + return AppComponent; +}()); +export { AppComponent }; +//# sourceMappingURL=app.component.js.map \ No newline at end of file diff --git a/src/app/app.component.js.map b/src/app/app.component.js.map new file mode 100644 index 0000000000..a358d006a6 --- /dev/null +++ b/src/app/app.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.component.js","sourceRoot":"","sources":["app.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAEL,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,MAAM,EAEN,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE3F,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAgB,MAAM,WAAW,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,mBAAm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Y,YAAY"} \ No newline at end of file diff --git a/src/app/app.effects.js b/src/app/app.effects.js new file mode 100644 index 0000000000..479b5f3a0d --- /dev/null +++ b/src/app/app.effects.js @@ -0,0 +1,9 @@ +import { StoreEffects } from './store.effects'; +import { NotificationsEffects } from './shared/notifications/notifications.effects'; +import { NavbarEffects } from './navbar/navbar.effects'; +export var appEffects = [ + StoreEffects, + NavbarEffects, + NotificationsEffects, +]; +//# sourceMappingURL=app.effects.js.map \ No newline at end of file diff --git a/src/app/app.effects.js.map b/src/app/app.effects.js.map new file mode 100644 index 0000000000..9ef8d3dea5 --- /dev/null +++ b/src/app/app.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.effects.js","sourceRoot":"","sources":["app.effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,IAAM,UAAU,GAAG;IACxB,YAAY;IACZ,aAAa;IACb,oBAAoB;CACrB,CAAC"} \ No newline at end of file diff --git a/src/app/app.metareducers.js b/src/app/app.metareducers.js new file mode 100644 index 0000000000..2d6e982204 --- /dev/null +++ b/src/app/app.metareducers.js @@ -0,0 +1,33 @@ +import { StoreActionTypes } from './store.actions'; +// fallback ngrx debugger +var actionCounter = 0; +export function debugMetaReducer(reducer) { + return function (state, action) { + actionCounter++; + console.log('@ngrx action', actionCounter, action.type); + console.log('state', JSON.stringify(state)); + console.log('action', JSON.stringify(action)); + console.log('------------------------------------'); + return reducer(state, action); + }; +} +export function universalMetaReducer(reducer) { + return function (state, action) { + switch (action.type) { + case StoreActionTypes.REHYDRATE: + state = Object.assign({}, state, action.payload); + break; + case StoreActionTypes.REPLAY: + default: + break; + } + return reducer(state, action); + }; +} +export var debugMetaReducers = [ + debugMetaReducer +]; +export var appMetaReducers = [ + universalMetaReducer +]; +//# sourceMappingURL=app.metareducers.js.map \ No newline at end of file diff --git a/src/app/app.metareducers.js.map b/src/app/app.metareducers.js.map new file mode 100644 index 0000000000..a40db6d9d1 --- /dev/null +++ b/src/app/app.metareducers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.metareducers.js","sourceRoot":"","sources":["app.metareducers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,yBAAyB;AACzB,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB,MAAM,2BAA2B,OAAO;IACtC,OAAO,UAAC,KAAK,EAAE,MAAM;QACnB,aAAa,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5C,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QACpD,OAAO,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAChC,CAAC,CAAA;AACH,CAAC;AAED,MAAM,+BAA+B,OAAO;IAC1C,OAAO,UAAC,KAAK,EAAE,MAAM;QACnB,QAAQ,MAAM,CAAC,IAAI,EAAE;YACnB,KAAK,gBAAgB,CAAC,SAAS;gBAC7B,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;gBACjD,MAAM;YACR,KAAK,gBAAgB,CAAC,MAAM,CAAC;YAC7B;gBACE,MAAM;SACT;QACD,OAAO,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAChC,CAAC,CAAA;AACH,CAAC;AAED,MAAM,CAAC,IAAM,iBAAiB,GAAG;IAC/B,gBAAgB;CACjB,CAAC;AAEF,MAAM,CAAC,IAAM,eAAe,GAAG;IAC7B,oBAAoB;CACrB,CAAC"} \ No newline at end of file diff --git a/src/app/app.module.js b/src/app/app.module.js new file mode 100644 index 0000000000..7737eb411d --- /dev/null +++ b/src/app/app.module.js @@ -0,0 +1,112 @@ +import * as tslib_1 from "tslib"; +import { APP_BASE_HREF, CommonModule } from '@angular/common'; +import { HttpClientModule } from '@angular/common/http'; +import { NgModule } from '@angular/core'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { EffectsModule } from '@ngrx/effects'; +import { RouterStateSerializer, StoreRouterConnectingModule } from '@ngrx/router-store'; +import { META_REDUCERS, StoreModule } from '@ngrx/store'; +import { StoreDevtoolsModule } from '@ngrx/store-devtools'; +import { TranslateModule } from '@ngx-translate/core'; +import { storeFreeze } from 'ngrx-store-freeze'; +import { ENV_CONFIG, GLOBAL_CONFIG } from '../config'; +import { AppRoutingModule } from './app-routing.module'; +import { AppComponent } from './app.component'; +import { appEffects } from './app.effects'; +import { appMetaReducers, debugMetaReducers } from './app.metareducers'; +import { appReducers } from './app.reducer'; +import { CoreModule } from './core/core.module'; +import { FooterComponent } from './footer/footer.component'; +import { HeaderComponent } from './header/header.component'; +import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component'; +import { DSpaceRouterStateSerializer } from './shared/ngrx/dspace-router-state-serializer'; +import { NotificationsBoardComponent } from './shared/notifications/notifications-board/notifications-board.component'; +import { NotificationComponent } from './shared/notifications/notification/notification.component'; +import { SharedModule } from './shared/shared.module'; +import { ScrollToModule } from '@nicky-lenaers/ngx-scroll-to'; +import { HeaderNavbarWrapperComponent } from './header-nav-wrapper/header-navbar-wrapper.component'; +import { AdminSidebarComponent } from './+admin/admin-sidebar/admin-sidebar.component'; +import { AdminSidebarSectionComponent } from './+admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component'; +import { ExpandableAdminSidebarSectionComponent } from './+admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component'; +import { NavbarModule } from './navbar/navbar.module'; +export function getConfig() { + return ENV_CONFIG; +} +export function getBase() { + return ENV_CONFIG.ui.nameSpace; +} +export function getMetaReducers(config) { + var metaReducers = config.production ? appMetaReducers : appMetaReducers.concat([storeFreeze]); + return config.debug ? metaReducers.concat(debugMetaReducers) : metaReducers; +} +var IMPORTS = [ + CommonModule, + SharedModule, + NavbarModule, + HttpClientModule, + AppRoutingModule, + CoreModule.forRoot(), + ScrollToModule.forRoot(), + NgbModule.forRoot(), + TranslateModule.forRoot(), + EffectsModule.forRoot(appEffects), + StoreModule.forRoot(appReducers), + StoreRouterConnectingModule, +]; +IMPORTS.push(StoreDevtoolsModule.instrument({ + maxAge: 100, + logOnly: ENV_CONFIG.production, +})); +var PROVIDERS = [ + { + provide: GLOBAL_CONFIG, + useFactory: (getConfig) + }, + { + provide: APP_BASE_HREF, + useFactory: (getBase) + }, + { + provide: META_REDUCERS, + useFactory: getMetaReducers, + deps: [GLOBAL_CONFIG] + }, + { + provide: RouterStateSerializer, + useClass: DSpaceRouterStateSerializer + } +]; +var DECLARATIONS = [ + AppComponent, + HeaderComponent, + HeaderNavbarWrapperComponent, + AdminSidebarComponent, + AdminSidebarSectionComponent, + ExpandableAdminSidebarSectionComponent, + FooterComponent, + PageNotFoundComponent, + NotificationComponent, + NotificationsBoardComponent +]; +var EXPORTS = [ + AppComponent +]; +var AppModule = /** @class */ (function () { + function AppModule() { + } + AppModule = tslib_1.__decorate([ + NgModule({ + imports: IMPORTS.slice(), + providers: PROVIDERS.slice(), + declarations: DECLARATIONS.slice(), + exports: EXPORTS.slice(), + entryComponents: [ + AdminSidebarSectionComponent, + ExpandableAdminSidebarSectionComponent + ] + }) + ], AppModule); + return AppModule; +}()); +export { AppModule }; +//# sourceMappingURL=app.module.js.map \ No newline at end of file diff --git a/src/app/app.module.js.map b/src/app/app.module.js.map new file mode 100644 index 0000000000..f3c9afee6b --- /dev/null +++ b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,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,UAAU,CAAC,UAAU;CAC/B,CAAC,CACH,CAAC;AAEF,IAAM,SAAS,GAAG;IAChB;QACE,OAAO,EAAE,aAAa;QACtB,UAAU,EAAE,CAAC,SAAS,CAAC;KACxB;IACD;QACE,OAAO,EAAE,aAAa;QACtB,UAAU,EAAE,CAAC,OAAO,CAAC;KACtB;IACD;QACE,OAAO,EAAE,aAAa;QACtB,UAAU,EAAE,eAAe;QAC3B,IAAI,EAAE,CAAC,aAAa,CAAC;KACtB;IACD;QACE,OAAO,EAAE,qBAAqB;QAC9B,QAAQ,EAAE,2BAA2B;KACtC;CACF,CAAC;AAEF,IAAM,YAAY,GAAG;IACnB,YAAY;IACZ,eAAe;IACf,4BAA4B;IAC5B,qBAAqB;IACrB,4BAA4B;IAC5B,sCAAsC;IACtC,eAAe;IACf,qBAAqB;IACrB,qBAAqB;IACrB,2BAA2B;CAC5B,CAAC;AAEF,IAAM,OAAO,GAAG;IACd,YAAY;CACb,CAAC;AAoBF;IAAA;IAEA,CAAC;IAFY,SAAS;QAlBrB,QAAQ,CAAC;YACR,OAAO,EACF,OAAO,QACX;YACD,SAAS,EACJ,SAAS,QACb;YACD,YAAY,EACP,YAAY,QAChB;YACD,OAAO,EACF,OAAO,QACX;YACD,eAAe,EAAE;gBACf,4BAA4B;gBAC5B,sCAAsC;aACvC;SACF,CAAC;OACW,SAAS,CAErB;IAAD,gBAAC;CAAA,AAFD,IAEC;SAFY,SAAS"} \ No newline at end of file diff --git a/src/app/app.reducer.js b/src/app/app.reducer.js new file mode 100644 index 0000000000..0969455919 --- /dev/null +++ b/src/app/app.reducer.js @@ -0,0 +1,38 @@ +import { createSelector } from '@ngrx/store'; +import * as fromRouter from '@ngrx/router-store'; +import { hostWindowReducer } from './shared/host-window.reducer'; +import { formReducer } from './shared/form/form.reducer'; +import { sidebarReducer } from './+search-page/search-sidebar/search-sidebar.reducer'; +import { filterReducer } from './+search-page/search-filters/search-filter/search-filter.reducer'; +import { notificationsReducer } from './shared/notifications/notifications.reducers'; +import { truncatableReducer } from './shared/truncatable/truncatable.reducer'; +import { metadataRegistryReducer } from './+admin/admin-registries/metadata-registry/metadata-registry.reducers'; +import { hasValue } from './shared/empty.util'; +import { cssVariablesReducer } from './shared/sass-helper/sass-helper.reducer'; +import { menusReducer } from './shared/menu/menu.reducer'; +import { historyReducer } from './shared/history/history.reducer'; +export var appReducers = { + router: fromRouter.routerReducer, + history: historyReducer, + hostWindow: hostWindowReducer, + forms: formReducer, + metadataRegistry: metadataRegistryReducer, + notifications: notificationsReducer, + searchSidebar: sidebarReducer, + searchFilter: filterReducer, + truncatable: truncatableReducer, + cssVariables: cssVariablesReducer, + menus: menusReducer, +}; +export var routerStateSelector = function (state) { return state.router; }; +export function keySelector(key, selector) { + return createSelector(selector, function (state) { + if (hasValue(state)) { + return state[key]; + } + else { + return undefined; + } + }); +} +//# sourceMappingURL=app.reducer.js.map \ No newline at end of file diff --git a/src/app/app.reducer.js.map b/src/app/app.reducer.js.map new file mode 100644 index 0000000000..f974cbb806 --- /dev/null +++ b/src/app/app.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.reducer.js","sourceRoot":"","sources":["app.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,cAAc,EAAoB,MAAM,aAAa,CAAC;AACjF,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAmB,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,WAAW,EAAa,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAEL,cAAc,EACf,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,aAAa,EAEd,MAAM,mEAAmE,CAAC;AAC3E,OAAO,EACL,oBAAoB,EAErB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAqB,MAAM,0CAA0C,CAAC;AACjG,OAAO,EACL,uBAAuB,EAExB,MAAM,wEAAwE,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAqB,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,YAAY,EAAc,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAgB,MAAM,kCAAkC,CAAC;AAgBhF,MAAM,CAAC,IAAM,WAAW,GAA+B;IACrD,MAAM,EAAE,UAAU,CAAC,aAAa;IAChC,OAAO,EAAE,cAAc;IACvB,UAAU,EAAE,iBAAiB;IAC7B,KAAK,EAAE,WAAW;IAClB,gBAAgB,EAAE,uBAAuB;IACzC,aAAa,EAAE,oBAAoB;IACnC,aAAa,EAAE,cAAc;IAC7B,YAAY,EAAE,aAAa;IAC3B,WAAW,EAAE,kBAAkB;IAC/B,YAAY,EAAE,mBAAmB;IACjC,KAAK,EAAE,YAAY;CACpB,CAAC;AAEF,MAAM,CAAC,IAAM,mBAAmB,GAAG,UAAC,KAAe,IAAK,OAAA,KAAK,CAAC,MAAM,EAAZ,CAAY,CAAC;AAErE,MAAM,sBAAyB,GAAW,EAAE,QAAQ;IAClD,OAAO,cAAc,CAAC,QAAQ,EAAE,UAAC,KAAK;QACpC,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;YACnB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;SACnB;aAAM;YACL,OAAO,SAAS,CAAC;SAClB;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/src/app/core/auth/auth-object-factory.js b/src/app/core/auth/auth-object-factory.js new file mode 100644 index 0000000000..05147480aa --- /dev/null +++ b/src/app/core/auth/auth-object-factory.js @@ -0,0 +1,27 @@ +import { AuthType } from './auth-type'; +import { NormalizedAuthStatus } from './models/normalized-auth-status.model'; +import { NormalizedEPerson } from '../eperson/models/normalized-eperson.model'; +import { NormalizedGroup } from '../eperson/models/normalized-group.model'; +var AuthObjectFactory = /** @class */ (function () { + function AuthObjectFactory() { + } + AuthObjectFactory.getConstructor = function (type) { + switch (type) { + case AuthType.EPerson: { + return NormalizedEPerson; + } + case AuthType.Group: { + return NormalizedGroup; + } + case AuthType.Status: { + return NormalizedAuthStatus; + } + default: { + return undefined; + } + } + }; + return AuthObjectFactory; +}()); +export { AuthObjectFactory }; +//# sourceMappingURL=auth-object-factory.js.map \ No newline at end of file diff --git a/src/app/core/auth/auth-object-factory.js.map b/src/app/core/auth/auth-object-factory.js.map new file mode 100644 index 0000000000..ea5535cf11 --- /dev/null +++ b/src/app/core/auth/auth-object-factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-object-factory.js","sourceRoot":"","sources":["auth-object-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAG/E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E;IAAA;IAoBA,CAAC;IAnBe,gCAAc,GAA5B,UAA6B,IAAI;QAC/B,QAAQ,IAAI,EAAE;YACZ,KAAK,QAAQ,CAAC,OAAO,CAAC,CAAC;gBACrB,OAAO,iBAAiB,CAAA;aACzB;YAED,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACnB,OAAO,eAAe,CAAA;aACvB;YAED,KAAK,QAAQ,CAAC,MAAM,CAAC,CAAC;gBACpB,OAAO,oBAAoB,CAAA;aAC5B;YAED,OAAO,CAAC,CAAC;gBACP,OAAO,SAAS,CAAC;aAClB;SACF;IACH,CAAC;IACH,wBAAC;AAAD,CAAC,AApBD,IAoBC"} \ No newline at end of file diff --git a/src/app/core/auth/auth-request.service.js b/src/app/core/auth/auth-request.service.js new file mode 100644 index 0000000000..481513ed82 --- /dev/null +++ b/src/app/core/auth/auth-request.service.js @@ -0,0 +1,49 @@ +import * as tslib_1 from "tslib"; +import { of as observableOf, throwError as observableThrowError } from 'rxjs'; +import { distinctUntilChanged, filter, map, mergeMap, tap } from 'rxjs/operators'; +import { Inject, Injectable } from '@angular/core'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { RequestService } from '../data/request.service'; +import { GLOBAL_CONFIG } from '../../../config'; +import { isNotEmpty } from '../../shared/empty.util'; +import { AuthGetRequest, AuthPostRequest } from '../data/request.models'; +import { getResponseFromEntry } from '../shared/operators'; +var AuthRequestService = /** @class */ (function () { + function AuthRequestService(EnvConfig, halService, requestService) { + this.EnvConfig = EnvConfig; + this.halService = halService; + this.requestService = requestService; + this.linkName = 'authn'; + this.browseEndpoint = ''; + } + AuthRequestService.prototype.fetchRequest = function (request) { + return this.requestService.getByUUID(request.uuid).pipe(getResponseFromEntry(), mergeMap(function (response) { + if (response.isSuccessful && isNotEmpty(response)) { + return observableOf(response.response); + } + else if (!response.isSuccessful) { + return observableThrowError(new Error(response.errorMessage)); + } + })); + }; + AuthRequestService.prototype.getEndpointByMethod = function (endpoint, method) { + return isNotEmpty(method) ? endpoint + "/" + method : "" + endpoint; + }; + AuthRequestService.prototype.postToEndpoint = function (method, body, options) { + var _this = this; + return this.halService.getEndpoint(this.linkName).pipe(filter(function (href) { return isNotEmpty(href); }), map(function (endpointURL) { return _this.getEndpointByMethod(endpointURL, method); }), distinctUntilChanged(), map(function (endpointURL) { return new AuthPostRequest(_this.requestService.generateRequestId(), endpointURL, body, options); }), tap(function (request) { return _this.requestService.configure(request, true); }), mergeMap(function (request) { return _this.fetchRequest(request); }), distinctUntilChanged()); + }; + AuthRequestService.prototype.getRequest = function (method, options) { + var _this = this; + return this.halService.getEndpoint(this.linkName).pipe(filter(function (href) { return isNotEmpty(href); }), map(function (endpointURL) { return _this.getEndpointByMethod(endpointURL, method); }), distinctUntilChanged(), map(function (endpointURL) { return new AuthGetRequest(_this.requestService.generateRequestId(), endpointURL, options); }), tap(function (request) { return _this.requestService.configure(request, true); }), mergeMap(function (request) { return _this.fetchRequest(request); }), distinctUntilChanged()); + }; + AuthRequestService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, HALEndpointService, + RequestService]) + ], AuthRequestService); + return AuthRequestService; +}()); +export { AuthRequestService }; +//# sourceMappingURL=auth-request.service.js.map \ No newline at end of file diff --git a/src/app/core/auth/auth-request.service.js.map b/src/app/core/auth/auth-request.service.js.map new file mode 100644 index 0000000000..ad250e852d --- /dev/null +++ b/src/app/core/auth/auth-request.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-request.service.js","sourceRoot":"","sources":["auth-request.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAwC,MAAM,wBAAwB,CAAC;AAG/G,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D;IAIE,4BAA6C,SAAuB,EAC9C,UAA8B,EAC9B,cAA8B;QAFP,cAAS,GAAT,SAAS,CAAc;QAC9C,eAAU,GAAV,UAAU,CAAoB;QAC9B,mBAAc,GAAd,cAAc,CAAgB;QAL1C,aAAQ,GAAG,OAAO,CAAC;QACnB,mBAAc,GAAG,EAAE,CAAC;IAK9B,CAAC;IAES,yC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/src/app/core/auth/auth-response-parsing.service.js new file mode 100644 index 0000000000..25c63cf323 --- /dev/null +++ b/src/app/core/auth/auth-response-parsing.service.js @@ -0,0 +1,36 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { AuthObjectFactory } from './auth-object-factory'; +import { BaseResponseParsingService } from '../data/base-response-parsing.service'; +import { AuthStatusResponse } from '../cache/response.models'; +import { GLOBAL_CONFIG } from '../../../config'; +import { isNotEmpty } from '../../shared/empty.util'; +import { ObjectCacheService } from '../cache/object-cache.service'; +var AuthResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(AuthResponseParsingService, _super); + function AuthResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = AuthObjectFactory; + _this.toCache = true; + return _this; + } + AuthResponseParsingService.prototype.parse = function (request, data) { + if (isNotEmpty(data.payload) && isNotEmpty(data.payload._links) && (data.statusCode === 200)) { + var response = this.process(data.payload, request.uuid); + return new AuthStatusResponse(response, data.statusCode, data.statusText); + } + else { + return new AuthStatusResponse(data.payload, data.statusCode, data.statusText); + } + }; + AuthResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], AuthResponseParsingService); + return AuthResponseParsingService; +}(BaseResponseParsingService)); +export { AuthResponseParsingService }; +//# sourceMappingURL=auth-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/auth/auth-response-parsing.service.js.map b/src/app/core/auth/auth-response-parsing.service.js.map new file mode 100644 index 0000000000..5fbc2f9b2a --- /dev/null +++ b/src/app/core/auth/auth-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-response-parsing.service.js","sourceRoot":"","sources":["auth-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eA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CAAA,AAlBD,CAAgD,0BAA0B,GAkBzE;SAlBY,0BAA0B"} \ No newline at end of file diff --git a/src/app/core/auth/auth-type.js b/src/app/core/auth/auth-type.js new file mode 100644 index 0000000000..994f098291 --- /dev/null +++ b/src/app/core/auth/auth-type.js @@ -0,0 +1,7 @@ +export var AuthType; +(function (AuthType) { + AuthType["EPerson"] = "eperson"; + AuthType["Status"] = "status"; + AuthType["Group"] = "group"; +})(AuthType || (AuthType = {})); +//# sourceMappingURL=auth-type.js.map \ No newline at end of file diff --git a/src/app/core/auth/auth-type.js.map b/src/app/core/auth/auth-type.js.map new file mode 100644 index 0000000000..27d96c5d60 --- /dev/null +++ b/src/app/core/auth/auth-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-type.js","sourceRoot":"","sources":["auth-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,6BAAiB,CAAA;IACjB,2BAAe,CAAA;AACjB,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB"} \ No newline at end of file diff --git a/src/app/core/auth/auth.actions.js b/src/app/core/auth/auth.actions.js new file mode 100644 index 0000000000..8606512d82 --- /dev/null +++ b/src/app/core/auth/auth.actions.js @@ -0,0 +1,310 @@ +// import type function +import { type } from '../../shared/ngrx/type'; +export var AuthActionTypes = { + AUTHENTICATE: type('dspace/auth/AUTHENTICATE'), + AUTHENTICATE_ERROR: type('dspace/auth/AUTHENTICATE_ERROR'), + AUTHENTICATE_SUCCESS: type('dspace/auth/AUTHENTICATE_SUCCESS'), + AUTHENTICATED: type('dspace/auth/AUTHENTICATED'), + AUTHENTICATED_ERROR: type('dspace/auth/AUTHENTICATED_ERROR'), + AUTHENTICATED_SUCCESS: type('dspace/auth/AUTHENTICATED_SUCCESS'), + CHECK_AUTHENTICATION_TOKEN: type('dspace/auth/CHECK_AUTHENTICATION_TOKEN'), + CHECK_AUTHENTICATION_TOKEN_ERROR: type('dspace/auth/CHECK_AUTHENTICATION_TOKEN_ERROR'), + REDIRECT_TOKEN_EXPIRED: type('dspace/auth/REDIRECT_TOKEN_EXPIRED'), + REDIRECT_AUTHENTICATION_REQUIRED: type('dspace/auth/REDIRECT_AUTHENTICATION_REQUIRED'), + REFRESH_TOKEN: type('dspace/auth/REFRESH_TOKEN'), + REFRESH_TOKEN_SUCCESS: type('dspace/auth/REFRESH_TOKEN_SUCCESS'), + REFRESH_TOKEN_ERROR: type('dspace/auth/REFRESH_TOKEN_ERROR'), + ADD_MESSAGE: type('dspace/auth/ADD_MESSAGE'), + RESET_MESSAGES: type('dspace/auth/RESET_MESSAGES'), + LOG_OUT: type('dspace/auth/LOG_OUT'), + LOG_OUT_ERROR: type('dspace/auth/LOG_OUT_ERROR'), + LOG_OUT_SUCCESS: type('dspace/auth/LOG_OUT_SUCCESS'), + REGISTRATION: type('dspace/auth/REGISTRATION'), + REGISTRATION_ERROR: type('dspace/auth/REGISTRATION_ERROR'), + REGISTRATION_SUCCESS: type('dspace/auth/REGISTRATION_SUCCESS'), + SET_REDIRECT_URL: type('dspace/auth/SET_REDIRECT_URL'), +}; +/* tslint:disable:max-classes-per-file */ +/** + * Authenticate. + * @class AuthenticateAction + * @implements {Action} + */ +var AuthenticateAction = /** @class */ (function () { + function AuthenticateAction(email, password) { + this.type = AuthActionTypes.AUTHENTICATE; + this.payload = { email: email, password: password }; + } + return AuthenticateAction; +}()); +export { AuthenticateAction }; +/** + * Checks if user is authenticated. + * @class AuthenticatedAction + * @implements {Action} + */ +var AuthenticatedAction = /** @class */ (function () { + function AuthenticatedAction(token) { + this.type = AuthActionTypes.AUTHENTICATED; + this.payload = token; + } + return AuthenticatedAction; +}()); +export { AuthenticatedAction }; +/** + * Authenticated check success. + * @class AuthenticatedSuccessAction + * @implements {Action} + */ +var AuthenticatedSuccessAction = /** @class */ (function () { + function AuthenticatedSuccessAction(authenticated, authToken, user) { + this.type = AuthActionTypes.AUTHENTICATED_SUCCESS; + this.payload = { authenticated: authenticated, authToken: authToken, user: user }; + } + return AuthenticatedSuccessAction; +}()); +export { AuthenticatedSuccessAction }; +/** + * Authenticated check error. + * @class AuthenticatedErrorAction + * @implements {Action} + */ +var AuthenticatedErrorAction = /** @class */ (function () { + function AuthenticatedErrorAction(payload) { + this.type = AuthActionTypes.AUTHENTICATED_ERROR; + this.payload = payload; + } + return AuthenticatedErrorAction; +}()); +export { AuthenticatedErrorAction }; +/** + * Authentication error. + * @class AuthenticationErrorAction + * @implements {Action} + */ +var AuthenticationErrorAction = /** @class */ (function () { + function AuthenticationErrorAction(payload) { + this.type = AuthActionTypes.AUTHENTICATE_ERROR; + this.payload = payload; + } + return AuthenticationErrorAction; +}()); +export { AuthenticationErrorAction }; +/** + * Authentication success. + * @class AuthenticationSuccessAction + * @implements {Action} + */ +var AuthenticationSuccessAction = /** @class */ (function () { + function AuthenticationSuccessAction(token) { + this.type = AuthActionTypes.AUTHENTICATE_SUCCESS; + this.payload = token; + } + return AuthenticationSuccessAction; +}()); +export { AuthenticationSuccessAction }; +/** + * Check if token is already present upon initial load. + * @class CheckAuthenticationTokenAction + * @implements {Action} + */ +var CheckAuthenticationTokenAction = /** @class */ (function () { + function CheckAuthenticationTokenAction() { + this.type = AuthActionTypes.CHECK_AUTHENTICATION_TOKEN; + } + return CheckAuthenticationTokenAction; +}()); +export { CheckAuthenticationTokenAction }; +/** + * Check Authentication Token Error. + * @class CheckAuthenticationTokenErrorAction + * @implements {Action} + */ +var CheckAuthenticationTokenErrorAction = /** @class */ (function () { + function CheckAuthenticationTokenErrorAction() { + this.type = AuthActionTypes.CHECK_AUTHENTICATION_TOKEN_ERROR; + } + return CheckAuthenticationTokenErrorAction; +}()); +export { CheckAuthenticationTokenErrorAction }; +/** + * Sign out. + * @class LogOutAction + * @implements {Action} + */ +var LogOutAction = /** @class */ (function () { + function LogOutAction(payload) { + this.payload = payload; + this.type = AuthActionTypes.LOG_OUT; + } + return LogOutAction; +}()); +export { LogOutAction }; +/** + * Sign out error. + * @class LogOutErrorAction + * @implements {Action} + */ +var LogOutErrorAction = /** @class */ (function () { + function LogOutErrorAction(payload) { + this.type = AuthActionTypes.LOG_OUT_ERROR; + this.payload = payload; + } + return LogOutErrorAction; +}()); +export { LogOutErrorAction }; +/** + * Sign out success. + * @class LogOutSuccessAction + * @implements {Action} + */ +var LogOutSuccessAction = /** @class */ (function () { + function LogOutSuccessAction(payload) { + this.payload = payload; + this.type = AuthActionTypes.LOG_OUT_SUCCESS; + } + return LogOutSuccessAction; +}()); +export { LogOutSuccessAction }; +/** + * Redirect to login page when authentication is required. + * @class RedirectWhenAuthenticationIsRequiredAction + * @implements {Action} + */ +var RedirectWhenAuthenticationIsRequiredAction = /** @class */ (function () { + function RedirectWhenAuthenticationIsRequiredAction(message) { + this.type = AuthActionTypes.REDIRECT_AUTHENTICATION_REQUIRED; + this.payload = message; + } + return RedirectWhenAuthenticationIsRequiredAction; +}()); +export { RedirectWhenAuthenticationIsRequiredAction }; +/** + * Redirect to login page when token is expired. + * @class RedirectWhenTokenExpiredAction + * @implements {Action} + */ +var RedirectWhenTokenExpiredAction = /** @class */ (function () { + function RedirectWhenTokenExpiredAction(message) { + this.type = AuthActionTypes.REDIRECT_TOKEN_EXPIRED; + this.payload = message; + } + return RedirectWhenTokenExpiredAction; +}()); +export { RedirectWhenTokenExpiredAction }; +/** + * Refresh authentication token. + * @class RefreshTokenAction + * @implements {Action} + */ +var RefreshTokenAction = /** @class */ (function () { + function RefreshTokenAction(token) { + this.type = AuthActionTypes.REFRESH_TOKEN; + this.payload = token; + } + return RefreshTokenAction; +}()); +export { RefreshTokenAction }; +/** + * Refresh authentication token success. + * @class RefreshTokenSuccessAction + * @implements {Action} + */ +var RefreshTokenSuccessAction = /** @class */ (function () { + function RefreshTokenSuccessAction(token) { + this.type = AuthActionTypes.REFRESH_TOKEN_SUCCESS; + this.payload = token; + } + return RefreshTokenSuccessAction; +}()); +export { RefreshTokenSuccessAction }; +/** + * Refresh authentication token error. + * @class RefreshTokenErrorAction + * @implements {Action} + */ +var RefreshTokenErrorAction = /** @class */ (function () { + function RefreshTokenErrorAction() { + this.type = AuthActionTypes.REFRESH_TOKEN_ERROR; + } + return RefreshTokenErrorAction; +}()); +export { RefreshTokenErrorAction }; +/** + * Sign up. + * @class RegistrationAction + * @implements {Action} + */ +var RegistrationAction = /** @class */ (function () { + function RegistrationAction(user) { + this.type = AuthActionTypes.REGISTRATION; + this.payload = user; + } + return RegistrationAction; +}()); +export { RegistrationAction }; +/** + * Sign up error. + * @class RegistrationErrorAction + * @implements {Action} + */ +var RegistrationErrorAction = /** @class */ (function () { + function RegistrationErrorAction(payload) { + this.type = AuthActionTypes.REGISTRATION_ERROR; + this.payload = payload; + } + return RegistrationErrorAction; +}()); +export { RegistrationErrorAction }; +/** + * Sign up success. + * @class RegistrationSuccessAction + * @implements {Action} + */ +var RegistrationSuccessAction = /** @class */ (function () { + function RegistrationSuccessAction(user) { + this.type = AuthActionTypes.REGISTRATION_SUCCESS; + this.payload = user; + } + return RegistrationSuccessAction; +}()); +export { RegistrationSuccessAction }; +/** + * Add uthentication message. + * @class AddAuthenticationMessageAction + * @implements {Action} + */ +var AddAuthenticationMessageAction = /** @class */ (function () { + function AddAuthenticationMessageAction(message) { + this.type = AuthActionTypes.ADD_MESSAGE; + this.payload = message; + } + return AddAuthenticationMessageAction; +}()); +export { AddAuthenticationMessageAction }; +/** + * Reset error. + * @class ResetAuthenticationMessagesAction + * @implements {Action} + */ +var ResetAuthenticationMessagesAction = /** @class */ (function () { + function ResetAuthenticationMessagesAction() { + this.type = AuthActionTypes.RESET_MESSAGES; + } + return ResetAuthenticationMessagesAction; +}()); +export { ResetAuthenticationMessagesAction }; +/** + * Change the redirect url. + * @class SetRedirectUrlAction + * @implements {Action} + */ +var SetRedirectUrlAction = /** @class */ (function () { + function SetRedirectUrlAction(url) { + this.type = AuthActionTypes.SET_REDIRECT_URL; + this.payload = url; + } + return SetRedirectUrlAction; +}()); +export { SetRedirectUrlAction }; +//# sourceMappingURL=auth.actions.js.map \ No newline at end of file diff --git a/src/app/core/auth/auth.actions.js.map b/src/app/core/auth/auth.actions.js.map new file mode 100644 index 0000000000..5e240d85ae --- /dev/null +++ b/src/app/core/auth/auth.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth.actions.js","sourceRoot":"","sources":["auth.actions.ts"],"names":[],"mappings":"AAGA,uBAAuB;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAM9C,MAAM,CAAC,IAAM,eAAe,GAAG;IAC7B,YAAY,EAAE,IAAI,CAAC,0BAA0B,CAAC;IAC9C,kBAAkB,EAAE,IAAI,CAAC,gCAAgC,CAAC;IAC1D,oBAAoB,EAAE,IAAI,CAAC,kCAAkC,CAAC;IAC9D,aAAa,EAAE,IAAI,CAAC,2BAA2B,CAAC;IAChD,mBAAmB,EAAE,IAAI,CAAC,iCAAiC,CAAC;IAC5D,qBAAqB,EAAE,IAAI,CAAC,mCAAmC,CAAC;IAChE,0BAA0B,EAAE,IAAI,CAAC,wCAAwC,CAAC;IAC1E,gCAAgC,EAAE,IAAI,CAAC,8CAA8C,CAAC;IACtF,sBAAsB,EAAE,IAAI,CAAC,oCAAoC,CAAC;IAClE,gCAAgC,EAAE,IAAI,CAAC,8CAA8C,CAAC;IACtF,aAAa,EAAE,IAAI,CAAC,2BAA2B,CAAC;IAChD,qBAAqB,EAAE,IAAI,CAAC,mCAAmC,CAAC;IAChE,mBAAmB,EAAE,IAAI,CAAC,iCAAiC,CAAC;IAC5D,WAAW,EAAE,IAAI,CAAC,yBAAyB,CAAC;IAC5C,cAAc,EAAE,IAAI,CAAC,4BAA4B,CAAC;IAClD,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC;IACpC,aAAa,EAAE,IAAI,CAAC,2BAA2B,CAAC;IAChD,eAAe,EAAE,IAAI,CAAC,6BAA6B,CAAC;IACpD,YAAY,EAAE,IAAI,CAAC,0BAA0B,CAAC;IAC9C,kBAAkB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AAC;IAAD,wCAAC;AAAD,CAAC,AAFD,IAEC;;AAED;;;;GAIG;AACH;IAIE,8BAAY,GAAW;QAHhB,SAAI,GAAW,eAAe,CAAC,gBAAgB,CAAC;QAIrD,IAAI,CAAC,OAAO,GAAG,GAAG,CAAE;IACtB,CAAC;IACH,2BAAC;AAAD,CAAC,AAPD,IAOC"} \ No newline at end of file diff --git a/src/app/core/auth/auth.effects.js b/src/app/core/auth/auth.effects.js new file mode 100644 index 0000000000..450974774d --- /dev/null +++ b/src/app/core/auth/auth.effects.js @@ -0,0 +1,130 @@ +import * as tslib_1 from "tslib"; +import { of as observableOf, Observable } from 'rxjs'; +import { filter, debounceTime, switchMap, take, tap, catchError, map } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +// import @ngrx +import { Actions, Effect, ofType } from '@ngrx/effects'; +import { select, Store } from '@ngrx/store'; +// import services +import { AuthService } from './auth.service'; +// import actions +import { AuthActionTypes, AuthenticatedAction, AuthenticatedErrorAction, AuthenticatedSuccessAction, AuthenticationErrorAction, AuthenticationSuccessAction, CheckAuthenticationTokenErrorAction, LogOutErrorAction, LogOutSuccessAction, RefreshTokenErrorAction, RefreshTokenSuccessAction, RegistrationErrorAction, RegistrationSuccessAction } from './auth.actions'; +import { isAuthenticated } from './selectors'; +import { StoreActionTypes } from '../../store.actions'; +var AuthEffects = /** @class */ (function () { + /** + * @constructor + * @param {Actions} actions$ + * @param {AuthService} authService + * @param {Store} store + */ + function AuthEffects(actions$, authService, store) { + var _this = this; + this.actions$ = actions$; + this.authService = authService; + this.store = store; + /** + * Authenticate user. + * @method authenticate + */ + this.authenticate$ = this.actions$.pipe(ofType(AuthActionTypes.AUTHENTICATE), switchMap(function (action) { + return _this.authService.authenticate(action.payload.email, action.payload.password).pipe(take(1), map(function (response) { return new AuthenticationSuccessAction(response.token); }), catchError(function (error) { return observableOf(new AuthenticationErrorAction(error)); })); + })); + this.authenticateSuccess$ = this.actions$.pipe(ofType(AuthActionTypes.AUTHENTICATE_SUCCESS), tap(function (action) { return _this.authService.storeToken(action.payload); }), map(function (action) { return new AuthenticatedAction(action.payload); })); + this.authenticated$ = this.actions$.pipe(ofType(AuthActionTypes.AUTHENTICATED), switchMap(function (action) { + return _this.authService.authenticatedUser(action.payload).pipe(map(function (user) { return new AuthenticatedSuccessAction((user !== null), action.payload, user); }), catchError(function (error) { return observableOf(new AuthenticatedErrorAction(error)); })); + })); + // It means "reacts to this action but don't send another" + this.authenticatedError$ = this.actions$.pipe(ofType(AuthActionTypes.AUTHENTICATED_ERROR), tap(function (action) { return _this.authService.removeToken(); })); + this.checkToken$ = this.actions$.pipe(ofType(AuthActionTypes.CHECK_AUTHENTICATION_TOKEN), switchMap(function () { + return _this.authService.hasValidAuthenticationToken().pipe(map(function (token) { return new AuthenticatedAction(token); }), catchError(function (error) { return observableOf(new CheckAuthenticationTokenErrorAction()); })); + })); + this.createUser$ = this.actions$.pipe(ofType(AuthActionTypes.REGISTRATION), debounceTime(500), // to remove when functionality is implemented + switchMap(function (action) { + return _this.authService.create(action.payload).pipe(map(function (user) { return new RegistrationSuccessAction(user); }), catchError(function (error) { return observableOf(new RegistrationErrorAction(error)); })); + })); + this.refreshToken$ = this.actions$.pipe(ofType(AuthActionTypes.REFRESH_TOKEN), switchMap(function (action) { + return _this.authService.refreshAuthenticationToken(action.payload).pipe(map(function (token) { return new RefreshTokenSuccessAction(token); }), catchError(function (error) { return observableOf(new RefreshTokenErrorAction()); })); + })); + // It means "reacts to this action but don't send another" + this.refreshTokenSuccess$ = this.actions$.pipe(ofType(AuthActionTypes.REFRESH_TOKEN_SUCCESS), tap(function (action) { return _this.authService.replaceToken(action.payload); })); + /** + * When the store is rehydrated in the browser, + * clear a possible invalid token or authentication errors + */ + this.clearInvalidTokenOnRehydrate$ = this.actions$.pipe(ofType(StoreActionTypes.REHYDRATE), switchMap(function () { + return _this.store.pipe(select(isAuthenticated), take(1), filter(function (authenticated) { return !authenticated; }), tap(function () { return _this.authService.removeToken(); }), tap(function () { return _this.authService.resetAuthenticationError(); })); + })); + this.logOut$ = this.actions$ + .pipe(ofType(AuthActionTypes.LOG_OUT), switchMap(function () { + return _this.authService.logout().pipe(map(function (value) { return new LogOutSuccessAction(); }), catchError(function (error) { return observableOf(new LogOutErrorAction(error)); })); + })); + this.logOutSuccess$ = this.actions$ + .pipe(ofType(AuthActionTypes.LOG_OUT_SUCCESS), tap(function () { return _this.authService.removeToken(); }), tap(function () { return _this.authService.clearRedirectUrl(); }), tap(function () { return _this.authService.refreshAfterLogout(); })); + this.redirectToLogin$ = this.actions$ + .pipe(ofType(AuthActionTypes.REDIRECT_AUTHENTICATION_REQUIRED), tap(function () { return _this.authService.removeToken(); }), tap(function () { return _this.authService.redirectToLogin(); })); + this.redirectToLoginTokenExpired$ = this.actions$ + .pipe(ofType(AuthActionTypes.REDIRECT_TOKEN_EXPIRED), tap(function () { return _this.authService.removeToken(); }), tap(function () { return _this.authService.redirectToLoginWhenTokenExpired(); })); + } + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "authenticate$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "authenticateSuccess$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "authenticated$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "authenticatedError$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "checkToken$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "createUser$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "refreshToken$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "refreshTokenSuccess$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "clearInvalidTokenOnRehydrate$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "logOut$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "logOutSuccess$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "redirectToLogin$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Observable) + ], AuthEffects.prototype, "redirectToLoginTokenExpired$", void 0); + AuthEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Actions, + AuthService, + Store]) + ], AuthEffects); + return AuthEffects; +}()); +export { AuthEffects }; +//# sourceMappingURL=auth.effects.js.map \ No newline at end of file diff --git a/src/app/core/auth/auth.effects.js.map b/src/app/core/auth/auth.effects.js.map new file mode 100644 index 0000000000..55b0d4ebb9 --- /dev/null +++ b/src/app/core/auth/auth.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth.effects.js","sourceRoot":"","sources":["auth.effects.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,eAAe;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAU,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpD,kBAAkB;AA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AC;0CACC,UAAU;6DAGnC;IAOJ;QADC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;0CACU,UAAU;sEAU1C;IAGN;QADC,MAAM,EAAE;0CACO,UAAU;gDAStB;IAGJ;QADC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;0CACL,UAAU;uDAK7B;IAGJ;QADC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;0CACH,UAAU;yDAI/B;IAGJ;QADC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;0CACS,UAAU;qEAK3C;IAnIO,WAAW;QADvB,UAAU,EAAE;iDA4ImB,OAAO;YACJ,WAAW;YACjB,KAAK;OA7IrB,WAAW,CA+IvB;IAAD,kBAAC;CAAA,AA/ID,IA+IC;SA/IY,WAAW"} \ No newline at end of file diff --git a/src/app/core/auth/auth.interceptor.js b/src/app/core/auth/auth.interceptor.js new file mode 100644 index 0000000000..07f91b2409 --- /dev/null +++ b/src/app/core/auth/auth.interceptor.js @@ -0,0 +1,144 @@ +import * as tslib_1 from "tslib"; +import { of as observableOf, throwError as observableThrowError } from 'rxjs'; +import { catchError, filter, map } from 'rxjs/operators'; +import { Injectable, Injector } from '@angular/core'; +import { HttpErrorResponse, HttpResponse } from '@angular/common/http'; +import { find } from 'lodash'; +import { AuthService } from './auth.service'; +import { AuthStatus } from './models/auth-status.model'; +import { AuthTokenInfo } from './models/auth-token-info.model'; +import { isNotEmpty, isUndefined, isNotNull } from '../../shared/empty.util'; +import { RedirectWhenTokenExpiredAction, RefreshTokenAction } from './auth.actions'; +import { Store } from '@ngrx/store'; +import { Router } from '@angular/router'; +var AuthInterceptor = /** @class */ (function () { + function AuthInterceptor(inj, router, store) { + this.inj = inj; + this.router = router; + this.store = store; + // Intercetor is called twice per request, + // so to prevent RefreshTokenAction is dispatched twice + // we're creating a refresh token request list + this.refreshTokenRequestUrls = []; + } + AuthInterceptor.prototype.isUnauthorized = function (response) { + // invalid_token The access token provided is expired, revoked, malformed, or invalid for other reasons + return response.status === 401; + }; + AuthInterceptor.prototype.isSuccess = function (response) { + return (response.status === 200 || response.status === 204); + }; + AuthInterceptor.prototype.isAuthRequest = function (http) { + return http && http.url + && (http.url.endsWith('/authn/login') + || http.url.endsWith('/authn/logout') + || http.url.endsWith('/authn/status')); + }; + AuthInterceptor.prototype.isLoginResponse = function (http) { + return http.url && http.url.endsWith('/authn/login'); + }; + AuthInterceptor.prototype.isLogoutResponse = function (http) { + return http.url && http.url.endsWith('/authn/logout'); + }; + AuthInterceptor.prototype.makeAuthStatusObject = function (authenticated, accessToken, error) { + var authStatus = new AuthStatus(); + authStatus.id = null; + authStatus.okay = true; + if (authenticated) { + authStatus.authenticated = true; + authStatus.token = new AuthTokenInfo(accessToken); + } + else { + authStatus.authenticated = false; + authStatus.error = isNotEmpty(error) ? ((typeof error === 'string') ? JSON.parse(error) : error) : null; + } + return authStatus; + }; + AuthInterceptor.prototype.intercept = function (req, next) { + var _this = this; + var authService = this.inj.get(AuthService); + var token = authService.getToken(); + var newReq; + if (authService.isTokenExpired()) { + authService.setRedirectUrl(this.router.url); + // The access token is expired + // Redirect to the login route + this.store.dispatch(new RedirectWhenTokenExpiredAction('auth.messages.expired')); + return observableOf(null); + } + else if (!this.isAuthRequest(req) && isNotEmpty(token)) { + // Intercept a request that is not to the authentication endpoint + authService.isTokenExpiring().pipe(filter(function (isExpiring) { return isExpiring; })) + .subscribe(function () { + // If the current request url is already in the refresh token request list, skip it + if (isUndefined(find(_this.refreshTokenRequestUrls, req.url))) { + // When a token is about to expire, refresh it + _this.store.dispatch(new RefreshTokenAction(token)); + _this.refreshTokenRequestUrls.push(req.url); + } + }); + // Get the auth header from the service. + var Authorization = authService.buildAuthHeader(token); + // Clone the request to add the new header. + newReq = req.clone({ headers: req.headers.set('authorization', Authorization) }); + } + else { + newReq = req; + } + // Pass on the new request instead of the original request. + return next.handle(newReq).pipe(map(function (response) { + // Intercept a Login/Logout response + if (response instanceof HttpResponse && _this.isSuccess(response) && (_this.isLoginResponse(response) || _this.isLogoutResponse(response))) { + // It's a success Login/Logout response + var authRes = void 0; + if (_this.isLoginResponse(response)) { + // login successfully + var newToken = response.headers.get('authorization'); + authRes = response.clone({ body: _this.makeAuthStatusObject(true, newToken) }); + // clean eventually refresh Requests list + _this.refreshTokenRequestUrls = []; + } + else { + // logout successfully + authRes = response.clone({ body: _this.makeAuthStatusObject(false) }); + } + return authRes; + } + else { + return response; + } + }), catchError(function (error, caught) { + // Intercept an error response + if (error instanceof HttpErrorResponse) { + // Checks if is a response from a request to an authentication endpoint + if (_this.isAuthRequest(error)) { + // clean eventually refresh Requests list + _this.refreshTokenRequestUrls = []; + // Create a new HttpResponse and return it, so it can be handle properly by AuthService. + var authResponse = new HttpResponse({ + body: _this.makeAuthStatusObject(false, null, error.error), + headers: error.headers, + status: error.status, + statusText: error.statusText, + url: error.url + }); + return observableOf(authResponse); + } + else if (_this.isUnauthorized(error) && isNotNull(token) && authService.isTokenExpired()) { + // The access token provided is expired, revoked, malformed, or invalid for other reasons + // Redirect to the login route + _this.store.dispatch(new RedirectWhenTokenExpiredAction('auth.messages.expired')); + } + } + // Return error response as is. + return observableThrowError(error); + })); + }; + AuthInterceptor = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Injector, Router, Store]) + ], AuthInterceptor); + return AuthInterceptor; +}()); +export { AuthInterceptor }; +//# sourceMappingURL=auth.interceptor.js.map \ No newline at end of file diff --git a/src/app/core/auth/auth.interceptor.js.map b/src/app/core/auth/auth.interceptor.js.map new file mode 100644 index 0000000000..cdbdadcd12 --- /dev/null +++ b/src/app/core/auth/auth.interceptor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth.interceptor.js","sourceRoot":"","sources":["auth.interceptor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,MAAM,CAAC;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AAC;wBACpC,IAAI,EAAE,KAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC;wBACzD,OAAO,EAAE,KAAK,CAAC,OAAO;wBACtB,MAAM,EAAE,KAAK,CAAC,MAAM;wBACpB,UAAU,EAAE,KAAK,CAAC,UAAU;wBAC5B,GAAG,EAAE,KAAK,CAAC,GAAG;qBACf,CAAC,CAAC;oBACH,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;iBACnC;qBAAM,IAAI,KAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,cAAc,EAAE,EAAE;oBACzF,yFAAyF;oBACzF,8BAA8B;oBAC9B,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,8BAA8B,CAAC,uBAAuB,CAAC,CAAC,CAAC;iBAClF;aACF;YACD,+BAA+B;YAC/B,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC,CAAC,CAAQ,CAAC;IACf,CAAC;IAhIU,eAAe;QAD3B,UAAU,EAAE;iDAQc,QAAQ,EAAkB,MAAM,EAAiB,KAAK;OAPpE,eAAe,CAiI3B;IAAD,sBAAC;CAAA,AAjID,IAiIC;SAjIY,eAAe"} \ No newline at end of file diff --git a/src/app/core/auth/auth.reducer.js b/src/app/core/auth/auth.reducer.js new file mode 100644 index 0000000000..a8c0b8a9cc --- /dev/null +++ b/src/app/core/auth/auth.reducer.js @@ -0,0 +1,131 @@ +// import actions +import { AuthActionTypes } from './auth.actions'; +/** + * The initial state. + */ +var initialState = { + authenticated: false, + loaded: false, + loading: false, +}; +/** + * The reducer function. + * @function reducer + * @param {State} state Current state + * @param {AuthActions} action Incoming action + */ +export function authReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case AuthActionTypes.AUTHENTICATE: + return Object.assign({}, state, { + error: undefined, + loading: true, + info: undefined + }); + case AuthActionTypes.AUTHENTICATED: + return Object.assign({}, state, { + loading: true + }); + case AuthActionTypes.AUTHENTICATED_ERROR: + return Object.assign({}, state, { + authenticated: false, + authToken: undefined, + error: action.payload.message, + loaded: true, + loading: false + }); + case AuthActionTypes.AUTHENTICATED_SUCCESS: + return Object.assign({}, state, { + authenticated: true, + authToken: action.payload.authToken, + loaded: true, + error: undefined, + loading: false, + info: undefined, + user: action.payload.user + }); + case AuthActionTypes.AUTHENTICATE_ERROR: + case AuthActionTypes.REGISTRATION_ERROR: + return Object.assign({}, state, { + authenticated: false, + authToken: undefined, + error: action.payload.message, + loading: false + }); + case AuthActionTypes.AUTHENTICATED: + case AuthActionTypes.AUTHENTICATE_SUCCESS: + case AuthActionTypes.LOG_OUT: + return state; + case AuthActionTypes.CHECK_AUTHENTICATION_TOKEN: + return Object.assign({}, state, { + loading: true + }); + case AuthActionTypes.CHECK_AUTHENTICATION_TOKEN_ERROR: + return Object.assign({}, state, { + loading: false + }); + case AuthActionTypes.LOG_OUT_ERROR: + return Object.assign({}, state, { + authenticated: true, + error: action.payload.message + }); + case AuthActionTypes.LOG_OUT_SUCCESS: + case AuthActionTypes.REFRESH_TOKEN_ERROR: + return Object.assign({}, state, { + authenticated: false, + authToken: undefined, + error: undefined, + loaded: false, + loading: false, + info: undefined, + refreshing: false, + user: undefined + }); + case AuthActionTypes.REDIRECT_AUTHENTICATION_REQUIRED: + case AuthActionTypes.REDIRECT_TOKEN_EXPIRED: + return Object.assign({}, state, { + authenticated: false, + authToken: undefined, + loaded: false, + loading: false, + info: action.payload, + user: undefined + }); + case AuthActionTypes.REGISTRATION: + return Object.assign({}, state, { + authenticated: false, + authToken: undefined, + error: undefined, + loading: true, + info: undefined + }); + case AuthActionTypes.REGISTRATION_SUCCESS: + return state; + case AuthActionTypes.REFRESH_TOKEN: + return Object.assign({}, state, { + refreshing: true, + }); + case AuthActionTypes.REFRESH_TOKEN_SUCCESS: + return Object.assign({}, state, { + authToken: action.payload, + refreshing: false, + }); + case AuthActionTypes.ADD_MESSAGE: + return Object.assign({}, state, { + info: action.payload, + }); + case AuthActionTypes.RESET_MESSAGES: + return Object.assign({}, state, { + error: undefined, + info: undefined, + }); + case AuthActionTypes.SET_REDIRECT_URL: + return Object.assign({}, state, { + redirectUrl: action.payload, + }); + default: + return state; + } +} +//# sourceMappingURL=auth.reducer.js.map \ No newline at end of file diff --git a/src/app/core/auth/auth.reducer.js.map b/src/app/core/auth/auth.reducer.js.map new file mode 100644 index 0000000000..72c87ecf8d --- /dev/null +++ b/src/app/core/auth/auth.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth.reducer.js","sourceRoot":"","sources":["auth.reducer.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,OAAO,EAGL,eAAe,EAQhB,MAAM,gBAAgB,CAAC;AAuCxB;;GAEG;AACH,IAAM,YAAY,GAAc;IAC9B,aAAa,EAAE,KAAK;IACpB,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,KAAK;CACf,CAAC;AAEF;;;;;GAKG;AACH,MAAM,sBAAsB,KAAyB,EAAE,MAAmB;IAA9C,sBAAA,EAAA,oBAAyB;IAEnD,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,eAAe,CAAC,YAAY;YAC7B,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAChC,KAAK,EAAE,SAAS;gBAChB,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,SAAS;aAChB,CAAC,CAAC;QAEL,KAAK,eAAe,CAAC,aAAa;YAChC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;QAEL,KAAK,eAAe,CAAC,mBAAmB;YACtC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,aAAa,EAAE,KAAK;gBACpB,SAAS,EAAE,SAAS;gBACpB,KAAK,EAAG,MAAoC,CAAC,OA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AE;gBAC9B,SAAS,EAAG,MAAoC,CAAC,OAAO;gBACxD,UAAU,EAAE,KAAK;aAClB,CAAC,CAAC;QAEL,KAAK,eAAe,CAAC,WAAW;YAC9B,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,IAAI,EAAG,MAAyC,CAAC,OAAO;aACzD,CAAC,CAAC;QAEL,KAAK,eAAe,CAAC,cAAc;YACjC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,SAAS;aAChB,CAAC,CAAC;QAEL,KAAK,eAAe,CAAC,gBAAgB;YACnC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE;gBAC9B,WAAW,EAAG,MAA+B,CAAC,OAAO;aACtD,CAAC,CAAC;QAEL;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC"} \ No newline at end of file diff --git a/src/app/core/auth/auth.service.js b/src/app/core/auth/auth.service.js new file mode 100644 index 0000000000..a7a691369c --- /dev/null +++ b/src/app/core/auth/auth.service.js @@ -0,0 +1,365 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable, Optional } from '@angular/core'; +import { PRIMARY_OUTLET, Router } from '@angular/router'; +import { HttpHeaders } from '@angular/common/http'; +import { REQUEST, RESPONSE } from '@nguniversal/express-engine/tokens'; +import { of as observableOf } from 'rxjs'; +import { distinctUntilChanged, filter, map, startWith, switchMap, take, withLatestFrom } from 'rxjs/operators'; +import { select, Store } from '@ngrx/store'; +import { AuthRequestService } from './auth-request.service'; +import { TOKENITEM } from './models/auth-token-info.model'; +import { isEmpty, isNotEmpty, isNotNull, isNotUndefined } from '../../shared/empty.util'; +import { CookieService } from '../../shared/services/cookie.service'; +import { getAuthenticationToken, getRedirectUrl, isAuthenticated, isTokenRefreshing } from './selectors'; +import { routerStateSelector } from '../../app.reducer'; +import { ResetAuthenticationMessagesAction, SetRedirectUrlAction } from './auth.actions'; +import { NativeWindowRef, NativeWindowService } from '../../shared/services/window.service'; +import { Base64EncodeUrl } from '../../shared/utils/encode-decode.util'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +export var LOGIN_ROUTE = '/login'; +export var LOGOUT_ROUTE = '/logout'; +export var REDIRECT_COOKIE = 'dsRedirectUrl'; +/** + * The auth service. + */ +var AuthService = /** @class */ (function () { + function AuthService(req, _window, authRequestService, response, router, storage, store, rdbService) { + var _this = this; + this.req = req; + this._window = _window; + this.authRequestService = authRequestService; + this.response = response; + this.router = router; + this.storage = storage; + this.store = store; + this.rdbService = rdbService; + this.store.pipe(select(isAuthenticated), startWith(false)).subscribe(function (authenticated) { return _this._authenticated = authenticated; }); + // If current route is different from the one setted in authentication guard + // and is not the login route, clear redirect url and messages + var routeUrl$ = this.store.pipe(select(routerStateSelector), filter(function (routerState) { return isNotUndefined(routerState) && isNotUndefined(routerState.state); }), filter(function (routerState) { return !_this.isLoginRoute(routerState.state.url); }), map(function (routerState) { return routerState.state.url; })); + var redirectUrl$ = this.store.pipe(select(getRedirectUrl), distinctUntilChanged()); + routeUrl$.pipe(withLatestFrom(redirectUrl$), map(function (_a) { + var routeUrl = _a[0], redirectUrl = _a[1]; + return [routeUrl, redirectUrl]; + })).pipe(filter(function (_a) { + var routeUrl = _a[0], redirectUrl = _a[1]; + return isNotEmpty(redirectUrl) && (routeUrl !== redirectUrl); + })) + .subscribe(function () { + _this.clearRedirectUrl(); + }); + } + /** + * Check if is a login page route + * + * @param {string} url + * @returns {Boolean}. + */ + AuthService.prototype.isLoginRoute = function (url) { + var urlTree = this.router.parseUrl(url); + var g = urlTree.root.children[PRIMARY_OUTLET]; + var segment = '/' + g.toString(); + return segment === LOGIN_ROUTE; + }; + /** + * Authenticate the user + * + * @param {string} user The user name + * @param {string} password The user's password + * @returns {Observable} The authenticated user observable. + */ + AuthService.prototype.authenticate = function (user, password) { + // Attempt authenticating the user using the supplied credentials. + var body = ("password=" + Base64EncodeUrl(password) + "&user=" + Base64EncodeUrl(user)); + var options = Object.create({}); + var headers = new HttpHeaders(); + headers = headers.append('Content-Type', 'application/x-www-form-urlencoded'); + options.headers = headers; + return this.authRequestService.postToEndpoint('login', body, options).pipe(map(function (status) { + if (status.authenticated) { + return status; + } + else { + throw (new Error('Invalid email or password')); + } + })); + }; + /** + * Determines if the user is authenticated + * @returns {Observable} + */ + AuthService.prototype.isAuthenticated = function () { + return this.store.pipe(select(isAuthenticated)); + }; + /** + * Returns the authenticated user + * @returns {User} + */ + AuthService.prototype.authenticatedUser = function (token) { + var _this = this; + // Determine if the user has an existing auth session on the server + var options = Object.create({}); + var headers = new HttpHeaders(); + headers = headers.append('Accept', 'application/json'); + headers = headers.append('Authorization', "Bearer " + token.accessToken); + options.headers = headers; + return this.authRequestService.getRequest('status', options).pipe(map(function (status) { return _this.rdbService.build(status); }), switchMap(function (status) { + if (status.authenticated) { + return status.eperson.pipe(map(function (eperson) { return eperson.payload; })); + } + else { + throw (new Error('Not authenticated')); + } + })); + }; + /** + * Checks if token is present into browser storage and is valid. (NB Check is done only on SSR) + */ + AuthService.prototype.checkAuthenticationToken = function () { + return; + }; + /** + * Checks if token is present into storage and is not expired + */ + AuthService.prototype.hasValidAuthenticationToken = function () { + var _this = this; + return this.store.pipe(select(getAuthenticationToken), take(1), map(function (authTokenInfo) { + var token; + // Retrieve authentication token info and check if is valid + token = isNotEmpty(authTokenInfo) ? authTokenInfo : _this.storage.get(TOKENITEM); + if (isNotEmpty(token) && token.hasOwnProperty('accessToken') && isNotEmpty(token.accessToken) && !_this.isTokenExpired(token)) { + return token; + } + else { + throw false; + } + })); + }; + /** + * Checks if token is present into storage + */ + AuthService.prototype.refreshAuthenticationToken = function (token) { + var options = Object.create({}); + var headers = new HttpHeaders(); + headers = headers.append('Accept', 'application/json'); + headers = headers.append('Authorization', "Bearer " + token.accessToken); + options.headers = headers; + return this.authRequestService.postToEndpoint('login', {}, options).pipe(map(function (status) { + if (status.authenticated) { + return status.token; + } + else { + throw (new Error('Not authenticated')); + } + })); + }; + /** + * Clear authentication errors + */ + AuthService.prototype.resetAuthenticationError = function () { + this.store.dispatch(new ResetAuthenticationMessagesAction()); + }; + /** + * Create a new user + * @returns {User} + */ + AuthService.prototype.create = function (user) { + // Normally you would do an HTTP request to POST the user + // details and then return the new user object + // but, let's just return the new user for this example. + // this._authenticated = true; + return observableOf(user); + }; + /** + * End session + * @returns {Observable} + */ + AuthService.prototype.logout = function () { + // Send a request that sign end the session + var headers = new HttpHeaders(); + headers = headers.append('Content-Type', 'application/x-www-form-urlencoded'); + var options = Object.create({ headers: headers, responseType: 'text' }); + return this.authRequestService.getRequest('logout', options).pipe(map(function (status) { + if (!status.authenticated) { + return true; + } + else { + throw (new Error('auth.errors.invalid-user')); + } + })); + }; + /** + * Retrieve authentication token info and make authorization header + * @returns {string} + */ + AuthService.prototype.buildAuthHeader = function (token) { + if (isEmpty(token)) { + token = this.getToken(); + } + return (this._authenticated && isNotNull(token)) ? "Bearer " + token.accessToken : ''; + }; + /** + * Get authentication token info + * @returns {AuthTokenInfo} + */ + AuthService.prototype.getToken = function () { + var token; + this.store.pipe(select(getAuthenticationToken)) + .subscribe(function (authTokenInfo) { + // Retrieve authentication token info and check if is valid + token = authTokenInfo || null; + }); + return token; + }; + /** + * Check if a token is next to be expired + * @returns {boolean} + */ + AuthService.prototype.isTokenExpiring = function () { + var _this = this; + return this.store.pipe(select(isTokenRefreshing), take(1), map(function (isRefreshing) { + if (_this.isTokenExpired() || isRefreshing) { + return false; + } + else { + var token = _this.getToken(); + return token.expires - (60 * 5 * 1000) < Date.now(); + } + })); + }; + /** + * Check if a token is expired + * @returns {boolean} + */ + AuthService.prototype.isTokenExpired = function (token) { + token = token || this.getToken(); + return token && token.expires < Date.now(); + }; + /** + * Save authentication token info + * + * @param {AuthTokenInfo} token The token to save + * @returns {AuthTokenInfo} + */ + AuthService.prototype.storeToken = function (token) { + // Add 1 day to the current date + var expireDate = Date.now() + (1000 * 60 * 60 * 24); + // Set the cookie expire date + var expires = new Date(expireDate); + var options = { expires: expires }; + // Save cookie with the token + return this.storage.set(TOKENITEM, token, options); + }; + /** + * Remove authentication token info + */ + AuthService.prototype.removeToken = function () { + return this.storage.remove(TOKENITEM); + }; + /** + * Replace authentication token info with a new one + */ + AuthService.prototype.replaceToken = function (token) { + this.removeToken(); + return this.storeToken(token); + }; + /** + * Redirect to the login route + */ + AuthService.prototype.redirectToLogin = function () { + this.router.navigate([LOGIN_ROUTE]); + }; + /** + * Redirect to the login route when token has expired + */ + AuthService.prototype.redirectToLoginWhenTokenExpired = function () { + var redirectUrl = LOGIN_ROUTE + '?expired=true'; + if (this._window.nativeWindow.location) { + // Hard redirect to login page, so that all state is definitely lost + this._window.nativeWindow.location.href = redirectUrl; + } + else if (this.response) { + if (!this.response._headerSent) { + this.response.redirect(302, redirectUrl); + } + } + else { + this.router.navigateByUrl(redirectUrl); + } + }; + /** + * Redirect to the route navigated before the login + */ + AuthService.prototype.redirectToPreviousUrl = function () { + var _this = this; + this.getRedirectUrl().pipe(take(1)) + .subscribe(function (redirectUrl) { + if (isNotEmpty(redirectUrl)) { + _this.clearRedirectUrl(); + _this.router.onSameUrlNavigation = 'reload'; + var url = decodeURIComponent(redirectUrl); + _this.router.navigateByUrl(url); + /* TODO Reenable hard redirect when REST API can handle x-forwarded-for, see https://github.com/DSpace/DSpace/pull/2207 */ + // this._window.nativeWindow.location.href = url; + } + else { + _this.router.navigate(['/']); + /* TODO Reenable hard redirect when REST API can handle x-forwarded-for, see https://github.com/DSpace/DSpace/pull/2207 */ + // this._window.nativeWindow.location.href = '/'; + } + }); + }; + /** + * Refresh route navigated + */ + AuthService.prototype.refreshAfterLogout = function () { + this.router.navigate(['/home']); + // Hard redirect to home page, so that all state is definitely lost + this._window.nativeWindow.location.href = '/home'; + }; + /** + * Get redirect url + */ + AuthService.prototype.getRedirectUrl = function () { + var redirectUrl = this.storage.get(REDIRECT_COOKIE); + if (isNotEmpty(redirectUrl)) { + return observableOf(redirectUrl); + } + else { + return this.store.pipe(select(getRedirectUrl)); + } + }; + /** + * Set redirect url + */ + AuthService.prototype.setRedirectUrl = function (url) { + // Add 1 hour to the current date + var expireDate = Date.now() + (1000 * 60 * 60); + // Set the cookie expire date + var expires = new Date(expireDate); + var options = { expires: expires }; + this.storage.set(REDIRECT_COOKIE, url, options); + this.store.dispatch(new SetRedirectUrlAction(isNotUndefined(url) ? url : '')); + }; + /** + * Clear redirect url + */ + AuthService.prototype.clearRedirectUrl = function () { + this.store.dispatch(new SetRedirectUrlAction('')); + this.storage.remove(REDIRECT_COOKIE); + }; + AuthService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(REQUEST)), + tslib_1.__param(1, Inject(NativeWindowService)), + tslib_1.__param(3, Optional()), tslib_1.__param(3, Inject(RESPONSE)), + tslib_1.__metadata("design:paramtypes", [Object, NativeWindowRef, + AuthRequestService, Object, Router, + CookieService, + Store, + RemoteDataBuildService]) + ], AuthService); + return AuthService; +}()); +export { AuthService }; +//# sourceMappingURL=auth.service.js.map \ No newline at end of file diff --git a/src/app/core/auth/auth.service.js.map b/src/app/core/auth/auth.service.js.map new file mode 100644 index 0000000000..272f9a9a86 --- /dev/null +++ b/src/app/core/auth/auth.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["auth.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,EAA4B,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG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AAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChF,CAAC;IAED;;OAEG;IACH,sCAAgB,GAAhB;QACE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IA/WU,WAAW;QADvB,UAAU,EAAE;QASE,mBAAA,MAAM,CAAC,OAAO,CAAC,CAAA;QACf,mBAAA,MAAM,CAAC,mBAAmB,CAAC,CAAA;QAE3B,mBAAA,QAAQ,EAAE,CAAA,EAAE,mBAAA,MAAM,CAAC,QAAQ,CAAC,CAAA;yDAFmB,eAAe;YACjC,kBAAkB,UAE9B,MAAM;YACL,aAAa;YACf,KAAK;YACA,sBAAsB;OAf7C,WAAW,CAgXvB;IAAD,kBAAC;CAAA,AAhXD,IAgXC;SAhXY,WAAW"} \ No newline at end of file diff --git a/src/app/core/auth/authenticated.guard.js b/src/app/core/auth/authenticated.guard.js new file mode 100644 index 0000000000..194cf6c659 --- /dev/null +++ b/src/app/core/auth/authenticated.guard.js @@ -0,0 +1,68 @@ +import * as tslib_1 from "tslib"; +import { take } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { Router } from '@angular/router'; +import { select, Store } from '@ngrx/store'; +import { isAuthenticated } from './selectors'; +import { AuthService } from './auth.service'; +import { RedirectWhenAuthenticationIsRequiredAction } from './auth.actions'; +/** + * Prevent unauthorized activating and loading of routes + * @class AuthenticatedGuard + */ +var AuthenticatedGuard = /** @class */ (function () { + /** + * @constructor + */ + function AuthenticatedGuard(authService, router, store) { + this.authService = authService; + this.router = router; + this.store = store; + } + /** + * True when user is authenticated + * @method canActivate + */ + AuthenticatedGuard.prototype.canActivate = function (route, state) { + var url = state.url; + return this.handleAuth(url); + }; + /** + * True when user is authenticated + * @method canActivateChild + */ + AuthenticatedGuard.prototype.canActivateChild = function (route, state) { + return this.canActivate(route, state); + }; + /** + * True when user is authenticated + * @method canLoad + */ + AuthenticatedGuard.prototype.canLoad = function (route) { + var url = "/" + route.path; + return this.handleAuth(url); + }; + AuthenticatedGuard.prototype.handleAuth = function (url) { + var _this = this; + // get observable + var observable = this.store.pipe(select(isAuthenticated)); + // redirect to sign in page if user is not authenticated + observable.pipe( + // .filter(() => isEmpty(this.router.routerState.snapshot.url) || this.router.routerState.snapshot.url === url) + take(1)) + .subscribe(function (authenticated) { + if (!authenticated) { + _this.authService.setRedirectUrl(url); + _this.store.dispatch(new RedirectWhenAuthenticationIsRequiredAction('Login required')); + } + }); + return observable; + }; + AuthenticatedGuard = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [AuthService, Router, Store]) + ], AuthenticatedGuard); + return AuthenticatedGuard; +}()); +export { AuthenticatedGuard }; +//# sourceMappingURL=authenticated.guard.js.map \ No newline at end of file diff --git a/src/app/core/auth/authenticated.guard.js.map b/src/app/core/auth/authenticated.guard.js.map new file mode 100644 index 0000000000..0cb1af8138 --- /dev/null +++ b/src/app/core/auth/authenticated.guard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authenticated.guard.js","sourceRoot":"","sources":["authenticated.guard.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAuD,MAAM,EAAuB,MAAM,iBAAiB,CAAC;AAGnH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,EAAE,eAAe,EAA2B,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,0CAA0C,EAAE,MAAM,gBAAgB,CAAC;AAG5E;;;GAGG;AAEH;IAEE;;OAEG;IACH,4BAAo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E,kBAAkB,CAmD9B;IAAD,yBAAC;CAAA,AAnDD,IAmDC;SAnDY,kBAAkB"} \ No newline at end of file diff --git a/src/app/core/auth/models/auth-error.model.js b/src/app/core/auth/models/auth-error.model.js new file mode 100644 index 0000000000..6eeec0f56c --- /dev/null +++ b/src/app/core/auth/models/auth-error.model.js @@ -0,0 +1 @@ +//# sourceMappingURL=auth-error.model.js.map \ No newline at end of file diff --git a/src/app/core/auth/models/auth-error.model.js.map b/src/app/core/auth/models/auth-error.model.js.map new file mode 100644 index 0000000000..80bc34fbd3 --- /dev/null +++ b/src/app/core/auth/models/auth-error.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-error.model.js","sourceRoot":"","sources":["auth-error.model.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/core/auth/models/auth-status.model.js b/src/app/core/auth/models/auth-status.model.js new file mode 100644 index 0000000000..8d8023ec45 --- /dev/null +++ b/src/app/core/auth/models/auth-status.model.js @@ -0,0 +1,7 @@ +var AuthStatus = /** @class */ (function () { + function AuthStatus() { + } + return AuthStatus; +}()); +export { AuthStatus }; +//# sourceMappingURL=auth-status.model.js.map \ No newline at end of file diff --git a/src/app/core/auth/models/auth-status.model.js.map b/src/app/core/auth/models/auth-status.model.js.map new file mode 100644 index 0000000000..a7200d4a02 --- /dev/null +++ b/src/app/core/auth/models/auth-status.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-status.model.js","sourceRoot":"","sources":["auth-status.model.ts"],"names":[],"mappings":"AAOA;IAAA;IAeA,CAAC;IAAD,iBAAC;AAAD,CAAC,AAfD,IAeC"} \ No newline at end of file diff --git a/src/app/core/auth/models/auth-status.model.ts b/src/app/core/auth/models/auth-status.model.ts index 6e722a80c9..f4abb44ee6 100644 --- a/src/app/core/auth/models/auth-status.model.ts +++ b/src/app/core/auth/models/auth-status.model.ts @@ -17,6 +17,8 @@ export class AuthStatus implements CacheableObject { eperson: Observable>; + ssoLoginUrl?: string; + token?: AuthTokenInfo; self: string; diff --git a/src/app/core/auth/models/auth-token-info.model.js b/src/app/core/auth/models/auth-token-info.model.js new file mode 100644 index 0000000000..a3e7afd2ae --- /dev/null +++ b/src/app/core/auth/models/auth-token-info.model.js @@ -0,0 +1,18 @@ +import { default as decode } from 'jwt-decode'; +export var TOKENITEM = 'dsAuthInfo'; +var AuthTokenInfo = /** @class */ (function () { + function AuthTokenInfo(token) { + this.accessToken = token.replace('Bearer ', ''); + try { + var tokenClaims = decode(this.accessToken); + // exp claim is in seconds, convert it se to milliseconds + this.expires = tokenClaims.exp * 1000; + } + catch (err) { + this.expires = 0; + } + } + return AuthTokenInfo; +}()); +export { AuthTokenInfo }; +//# sourceMappingURL=auth-token-info.model.js.map \ No newline at end of file diff --git a/src/app/core/auth/models/auth-token-info.model.js.map b/src/app/core/auth/models/auth-token-info.model.js.map new file mode 100644 index 0000000000..b06a336395 --- /dev/null +++ b/src/app/core/auth/models/auth-token-info.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-token-info.model.js","sourceRoot":"","sources":["auth-token-info.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,CAAC,IAAM,SAAS,GAAG,YAAY,CAAC;AAEtC;IAIE,uBAAY,KAAa;QACvB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAChD,IAAI;YACF,IAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC7C,yDAAyD;YACzD,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,GAAG,GAAG,IAAI,CAAC;SACvC;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;SAClB;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAdD,IAcC"} \ No newline at end of file diff --git a/src/app/core/auth/models/normalized-auth-status.model.js b/src/app/core/auth/models/normalized-auth-status.model.js new file mode 100644 index 0000000000..7d497a3422 --- /dev/null +++ b/src/app/core/auth/models/normalized-auth-status.model.js @@ -0,0 +1,41 @@ +import * as tslib_1 from "tslib"; +import { AuthStatus } from './auth-status.model'; +import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize'; +import { mapsTo, relationship } from '../../cache/builders/build-decorators'; +import { ResourceType } from '../../shared/resource-type'; +import { NormalizedObject } from '../../cache/models/normalized-object.model'; +import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer'; +var NormalizedAuthStatus = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedAuthStatus, _super); + function NormalizedAuthStatus() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedAuthStatus.prototype, "id", void 0); + tslib_1.__decorate([ + autoserializeAs(new IDToUUIDSerializer('auth-status'), 'id'), + tslib_1.__metadata("design:type", String) + ], NormalizedAuthStatus.prototype, "uuid", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], NormalizedAuthStatus.prototype, "okay", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], NormalizedAuthStatus.prototype, "authenticated", void 0); + tslib_1.__decorate([ + relationship(ResourceType.EPerson, false), + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedAuthStatus.prototype, "eperson", void 0); + NormalizedAuthStatus = tslib_1.__decorate([ + mapsTo(AuthStatus), + inheritSerialization(NormalizedObject) + ], NormalizedAuthStatus); + return NormalizedAuthStatus; +}(NormalizedObject)); +export { NormalizedAuthStatus }; +//# sourceMappingURL=normalized-auth-status.model.js.map \ No newline at end of file diff --git a/src/app/core/auth/models/normalized-auth-status.model.js.map b/src/app/core/auth/models/normalized-auth-status.model.js.map new file mode 100644 index 0000000000..00d99272c4 --- /dev/null +++ b/src/app/core/auth/models/normalized-auth-status.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-auth-status.model.js","sourceRoot":"","sources":["normalized-auth-status.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAIvE;IAA0C,gDAA4B;IAAtE;;IAsBA,CAAC;IApBC;QADC,aAAa;;oDACH;IAGX;QADC,eAAe,CAAC,IAAI,kBAAkB,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC;;sDAChD;IAMb;QADC,aAAa;;sDACA;IAMd;QADC,aAAa;;+DACS;IAIvB;QAFC,YAAY,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;QACzC,aAAa;;yDACE;IArBL,oBAAoB;QAFhC,MAAM,CAAC,UAAU,CAAC;QAClB,oBAAoB,CAAC,gBAAgB,CAAC;OAC1B,oBAAoB,CAsBhC;IAAD,2BAAC;CAAA,AAtBD,CAA0C,gBAAgB,GAsBzD;SAtBY,oBAAoB"} \ No newline at end of file diff --git a/src/app/core/auth/selectors.js b/src/app/core/auth/selectors.js new file mode 100644 index 0000000000..41bdfc0276 --- /dev/null +++ b/src/app/core/auth/selectors.js @@ -0,0 +1,175 @@ +import { createSelector } from '@ngrx/store'; +import { EPerson } from '../eperson/models/eperson.model'; +/** + * Returns the user state. + * @function getUserState + * @param {AppState} state Top level state. + * @return {AuthState} + */ +export var getAuthState = function (state) { return state.core.auth; }; +/** + * Returns true if the user is authenticated. + * @function _isAuthenticated + * @param {State} state + * @returns {boolean} + */ +var _isAuthenticated = function (state) { return state.authenticated; }; +/** + * Returns true if the authenticated has loaded. + * @function _isAuthenticatedLoaded + * @param {State} state + * @returns {boolean} + */ +var _isAuthenticatedLoaded = function (state) { return state.loaded; }; +/** + * Return the users state + * NOTE: when state is REHYDRATED user object lose prototype so return always a new EPerson object + * @function _getAuthenticatedUser + * @param {State} state + * @returns {EPerson} + */ +var _getAuthenticatedUser = function (state) { return Object.assign(new EPerson(), state.user); }; +/** + * Returns the authentication error. + * @function _getAuthenticationError + * @param {State} state + * @returns {string} + */ +var _getAuthenticationError = function (state) { return state.error; }; +/** + * Returns the authentication info message. + * @function _getAuthenticationInfo + * @param {State} state + * @returns {string} + */ +var _getAuthenticationInfo = function (state) { return state.info; }; +/** + * Returns true if request is in progress. + * @function _isLoading + * @param {State} state + * @returns {boolean} + */ +var _isLoading = function (state) { return state.loading; }; +/** + * Returns true if a refresh token request is in progress. + * @function _isRefreshing + * @param {State} state + * @returns {boolean} + */ +var _isRefreshing = function (state) { return state.refreshing; }; +/** + * Returns the authentication token. + * @function _getAuthenticationToken + * @param {State} state + * @returns {AuthToken} + */ +var _getAuthenticationToken = function (state) { return state.authToken; }; +/** + * Returns the sign out error. + * @function _getLogOutError + * @param {State} state + * @returns {string} + */ +var _getLogOutError = function (state) { return state.error; }; +/** + * Returns the sign up error. + * @function _getRegistrationError + * @param {State} state + * @returns {string} + */ +var _getRegistrationError = function (state) { return state.error; }; +/** + * Returns the redirect url. + * @function _getRedirectUrl + * @param {State} state + * @returns {string} + */ +var _getRedirectUrl = function (state) { return state.redirectUrl; }; +/** + * Returns the authenticated user + * @function getAuthenticatedUser + * @param {AuthState} state + * @param {any} props + * @return {User} + */ +export var getAuthenticatedUser = createSelector(getAuthState, _getAuthenticatedUser); +/** + * Returns the authentication error. + * @function getAuthenticationError + * @param {AuthState} state + * @param {any} props + * @return {Error} + */ +export var getAuthenticationError = createSelector(getAuthState, _getAuthenticationError); +/** + * Returns the authentication info message. + * @function getAuthenticationInfo + * @param {AuthState} state + * @param {any} props + * @return {string} + */ +export var getAuthenticationInfo = createSelector(getAuthState, _getAuthenticationInfo); +/** + * Returns true if the user is authenticated + * @function isAuthenticated + * @param {AuthState} state + * @param {any} props + * @return {boolean} + */ +export var isAuthenticated = createSelector(getAuthState, _isAuthenticated); +/** + * Returns true if the user is authenticated + * @function isAuthenticated + * @param {AuthState} state + * @param {any} props + * @return {boolean} + */ +export var isAuthenticatedLoaded = createSelector(getAuthState, _isAuthenticatedLoaded); +/** + * Returns true if the authentication request is loading. + * @function isAuthenticationLoading + * @param {AuthState} state + * @param {any} props + * @return {boolean} + */ +export var isAuthenticationLoading = createSelector(getAuthState, _isLoading); +/** + * Returns true if the refresh token request is loading. + * @function isTokenRefreshing + * @param {AuthState} state + * @param {any} props + * @return {boolean} + */ +export var isTokenRefreshing = createSelector(getAuthState, _isRefreshing); +/** + * Returns the authentication token. + * @function getAuthenticationToken + * @param {State} state + * @returns {AuthToken} + */ +export var getAuthenticationToken = createSelector(getAuthState, _getAuthenticationToken); +/** + * Returns the log out error. + * @function getLogOutError + * @param {AuthState} state + * @param {any} props + * @return {Error} + */ +export var getLogOutError = createSelector(getAuthState, _getLogOutError); +/** + * Returns the registration error. + * @function getRegistrationError + * @param {AuthState} state + * @param {any} props + * @return {Error} + */ +export var getRegistrationError = createSelector(getAuthState, _getRegistrationError); +/** + * Returns the redirect url. + * @function getRedirectUrl + * @param {AuthState} state + * @param {any} props + * @return {string} + */ +export var getRedirectUrl = createSelector(getAuthState, _getRedirectUrl); +//# sourceMappingURL=selectors.js.map \ No newline at end of file diff --git a/src/app/core/auth/selectors.js.map b/src/app/core/auth/selectors.js.map new file mode 100644 index 0000000000..7fb484c273 --- /dev/null +++ b/src/app/core/auth/selectors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"selectors.js","sourceRoot":"","sources":["selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAU7C,OAAO,EAAE,OAAO,EAAE,MAAM,i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/server-auth.service.js b/src/app/core/auth/server-auth.service.js new file mode 100644 index 0000000000..f71210ffb0 --- /dev/null +++ b/src/app/core/auth/server-auth.service.js @@ -0,0 +1,73 @@ +import * as tslib_1 from "tslib"; +import { map, switchMap, take } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { HttpHeaders } from '@angular/common/http'; +import { isNotEmpty } from '../../shared/empty.util'; +import { AuthService } from './auth.service'; +import { CheckAuthenticationTokenAction } from './auth.actions'; +/** + * The auth service. + */ +var ServerAuthService = /** @class */ (function (_super) { + tslib_1.__extends(ServerAuthService, _super); + function ServerAuthService() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Returns the authenticated user + * @returns {User} + */ + ServerAuthService.prototype.authenticatedUser = function (token) { + var _this = this; + // Determine if the user has an existing auth session on the server + var options = Object.create({}); + var headers = new HttpHeaders(); + headers = headers.append('Accept', 'application/json'); + headers = headers.append('Authorization', "Bearer " + token.accessToken); + // NB this is used to pass server client IP check. + var clientIp = this.req.get('x-forwarded-for') || this.req.connection.remoteAddress; + headers = headers.append('X-Forwarded-For', clientIp); + options.headers = headers; + return this.authRequestService.getRequest('status', options).pipe(map(function (status) { return _this.rdbService.build(status); }), switchMap(function (status) { + if (status.authenticated) { + return status.eperson.pipe(map(function (eperson) { return eperson.payload; })); + } + else { + throw (new Error('Not authenticated')); + } + })); + }; + /** + * Checks if token is present into browser storage and is valid. (NB Check is done only on SSR) + */ + ServerAuthService.prototype.checkAuthenticationToken = function () { + this.store.dispatch(new CheckAuthenticationTokenAction()); + }; + /** + * Redirect to the route navigated before the login + */ + ServerAuthService.prototype.redirectToPreviousUrl = function () { + var _this = this; + this.getRedirectUrl().pipe(take(1)) + .subscribe(function (redirectUrl) { + if (isNotEmpty(redirectUrl)) { + // override the route reuse strategy + _this.router.routeReuseStrategy.shouldReuseRoute = function () { + return false; + }; + _this.router.navigated = false; + var url = decodeURIComponent(redirectUrl); + _this.router.navigateByUrl(url); + } + else { + _this.router.navigate(['/']); + } + }); + }; + ServerAuthService = tslib_1.__decorate([ + Injectable() + ], ServerAuthService); + return ServerAuthService; +}(AuthService)); +export { ServerAuthService }; +//# sourceMappingURL=server-auth.service.js.map \ No newline at end of file diff --git a/src/app/core/auth/server-auth.service.js.map b/src/app/core/auth/server-auth.service.js.map new file mode 100644 index 0000000000..37d35931e7 --- /dev/null +++ b/src/app/core/auth/server-auth.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"server-auth.service.js","sourceRoot":"","sources":["server-auth.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAGhE;;GAEG;AAEH;IAAuC,6CAAW;IAAlD;;IA0DA,CAAC;IAxDC;;;OAGG;IACI,6CAAiB,GAAxB,UAAyB,KAAoB;QAA7C,iBAqBC;QApBC,mEAAmE;QACnE,IAAM,OAAO,GAAgB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC/C,IAAI,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAEhC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QACvD,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,YAAU,KAAK,CAAC,WAAa,CAAC,CAAC;QACzE,kDAAkD;QAClD,IAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC;QACtF,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AC,GAAG,CAAC,CAAC;aAChC;iBAAM;gBACL,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;aAC7B;QACH,CAAC,CAAC,CAAA;IAEN,CAAC;IAxDU,iBAAiB;QAD7B,UAAU,EAAE;OACA,iBAAiB,CA0D7B;IAAD,wBAAC;CAAA,AA1DD,CAAuC,WAAW,GA0DjD;SA1DY,iBAAiB"} \ No newline at end of file diff --git a/src/app/core/browse/browse-entry-search-options.model.js b/src/app/core/browse/browse-entry-search-options.model.js new file mode 100644 index 0000000000..28c4f0e4c1 --- /dev/null +++ b/src/app/core/browse/browse-entry-search-options.model.js @@ -0,0 +1,19 @@ +/** + * A class that defines the search options to be used for fetching browse entries or items + * - metadataDefinition: The metadata definition to fetch entries or items for + * - pagination: Optional pagination options to use + * - sort: Optional sorting options to use + * - scope: An optional scope to limit the results within a specific collection or community + */ +var BrowseEntrySearchOptions = /** @class */ (function () { + function BrowseEntrySearchOptions(metadataDefinition, pagination, sort, startsWith, scope) { + this.metadataDefinition = metadataDefinition; + this.pagination = pagination; + this.sort = sort; + this.startsWith = startsWith; + this.scope = scope; + } + return BrowseEntrySearchOptions; +}()); +export { BrowseEntrySearchOptions }; +//# sourceMappingURL=browse-entry-search-options.model.js.map \ No newline at end of file diff --git a/src/app/core/browse/browse-entry-search-options.model.js.map b/src/app/core/browse/browse-entry-search-options.model.js.map new file mode 100644 index 0000000000..c649957c0e --- /dev/null +++ b/src/app/core/browse/browse-entry-search-options.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-entry-search-options.model.js","sourceRoot":"","sources":["browse-entry-search-options.model.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH;IACE,kCAAmB,kBAA0B,EAC1B,UAAuC,EACvC,IAAkB,EAClB,UAAmB,EACnB,KAAc;QAJd,uBAAkB,GAAlB,kBAAkB,CAAQ;QAC1B,eAAU,GAAV,UAAU,CAA6B;QACvC,SAAI,GAAJ,IAAI,CAAc;QAClB,eAAU,GAAV,UAAU,CAAS;QACnB,UAAK,GAAL,KAAK,CAAS;IACjC,CAAC;IACH,+BAAC;AAAD,CAAC,AAPD,IAOC"} \ No newline at end of file diff --git a/src/app/core/browse/browse.service.js b/src/app/core/browse/browse.service.js new file mode 100644 index 0000000000..0240811b7d --- /dev/null +++ b/src/app/core/browse/browse.service.js @@ -0,0 +1,240 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { of as observableOf } from 'rxjs'; +import { distinctUntilChanged, map, startWith } from 'rxjs/operators'; +import { ensureArrayHasValue, hasValue, hasValueOperator, isEmpty, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { PaginatedList } from '../data/paginated-list'; +import { BrowseEndpointRequest, BrowseEntriesRequest, BrowseItemsRequest } from '../data/request.models'; +import { RequestService } from '../data/request.service'; +import { BrowseDefinition } from '../shared/browse-definition.model'; +import { BrowseEntry } from '../shared/browse-entry.model'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { configureRequest, filterSuccessfulResponses, getBrowseDefinitionLinks, getFirstOccurrence, getRemoteDataPayload, getRequestFromRequestHref } from '../shared/operators'; +import { URLCombiner } from '../url-combiner/url-combiner'; +import { Item } from '../shared/item.model'; +/** + * The service handling all browse requests + */ +var BrowseService = /** @class */ (function () { + function BrowseService(requestService, halService, rdb) { + this.requestService = requestService; + this.halService = halService; + this.rdb = rdb; + this.linkPath = 'browses'; + } + BrowseService_1 = BrowseService; + BrowseService.toSearchKeyArray = function (metadataKey) { + var keyParts = metadataKey.split('.'); + var searchFor = []; + searchFor.push('*'); + for (var i = 0; i < keyParts.length - 1; i++) { + var prevParts = keyParts.slice(0, i + 1); + var nextPart = prevParts.concat(['*']).join('.'); + searchFor.push(nextPart); + } + searchFor.push(metadataKey); + return searchFor; + }; + /** + * Get all BrowseDefinitions + */ + BrowseService.prototype.getBrowseDefinitions = function () { + var _this = this; + var request$ = this.halService.getEndpoint(this.linkPath).pipe(isNotEmptyOperator(), distinctUntilChanged(), map(function (endpointURL) { return new BrowseEndpointRequest(_this.requestService.generateRequestId(), endpointURL); }), configureRequest(this.requestService)); + var href$ = request$.pipe(map(function (request) { return request.href; })); + var requestEntry$ = href$.pipe(getRequestFromRequestHref(this.requestService)); + var payload$ = requestEntry$.pipe(filterSuccessfulResponses(), map(function (response) { return response.payload; }), ensureArrayHasValue(), map(function (definitions) { return definitions + .map(function (definition) { return Object.assign(new BrowseDefinition(), definition); }); }), distinctUntilChanged()); + return this.rdb.toRemoteDataObservable(requestEntry$, payload$); + }; + /** + * Get all BrowseEntries filtered or modified by BrowseEntrySearchOptions + * @param options + */ + BrowseService.prototype.getBrowseEntriesFor = function (options) { + return this.getBrowseDefinitions().pipe(getBrowseDefinitionLinks(options.metadataDefinition), hasValueOperator(), map(function (_links) { return _links.entries; }), hasValueOperator(), map(function (href) { + // TODO nearly identical to PaginatedSearchOptions => refactor + var args = []; + if (isNotEmpty(options.scope)) { + args.push("scope=" + options.scope); + } + if (isNotEmpty(options.sort)) { + args.push("sort=" + options.sort.field + "," + options.sort.direction); + } + if (isNotEmpty(options.pagination)) { + args.push("page=" + (options.pagination.currentPage - 1)); + args.push("size=" + options.pagination.pageSize); + } + if (isNotEmpty(options.startsWith)) { + args.push("startsWith=" + options.startsWith); + } + if (isNotEmpty(args)) { + href = new URLCombiner(href, "?" + args.join('&')).toString(); + } + return href; + }), getBrowseEntriesFor(this.requestService, this.rdb)); + }; + /** + * Get all items linked to a certain metadata value + * @param {string} filterValue metadata value to filter by (e.g. author's name) + * @param options Options to narrow down your search + * @returns {Observable>>} + */ + BrowseService.prototype.getBrowseItemsFor = function (filterValue, options) { + return this.getBrowseDefinitions().pipe(getBrowseDefinitionLinks(options.metadataDefinition), hasValueOperator(), map(function (_links) { return _links.items; }), hasValueOperator(), map(function (href) { + var args = []; + if (isNotEmpty(options.scope)) { + args.push("scope=" + options.scope); + } + if (isNotEmpty(options.sort)) { + args.push("sort=" + options.sort.field + "," + options.sort.direction); + } + if (isNotEmpty(options.pagination)) { + args.push("page=" + (options.pagination.currentPage - 1)); + args.push("size=" + options.pagination.pageSize); + } + if (isNotEmpty(options.startsWith)) { + args.push("startsWith=" + options.startsWith); + } + if (isNotEmpty(filterValue)) { + args.push("filterValue=" + filterValue); + } + if (isNotEmpty(args)) { + href = new URLCombiner(href, "?" + args.join('&')).toString(); + } + return href; + }), getBrowseItemsFor(this.requestService, this.rdb)); + }; + /** + * Get the first item for a metadata definition in an optional scope + * @param definition + * @param scope + */ + BrowseService.prototype.getFirstItemFor = function (definition, scope) { + return this.getBrowseDefinitions().pipe(getBrowseDefinitionLinks(definition), hasValueOperator(), map(function (_links) { return _links.items; }), hasValueOperator(), map(function (href) { + var args = []; + if (hasValue(scope)) { + args.push("scope=" + scope); + } + args.push('page=0'); + args.push('size=1'); + if (isNotEmpty(args)) { + href = new URLCombiner(href, "?" + args.join('&')).toString(); + } + return href; + }), getBrowseItemsFor(this.requestService, this.rdb), getFirstOccurrence()); + }; + /** + * Get the previous page of items using the paginated list's prev link + * @param items + */ + BrowseService.prototype.getPrevBrowseItems = function (items) { + return observableOf(items.payload.prev).pipe(getBrowseItemsFor(this.requestService, this.rdb)); + }; + /** + * Get the next page of items using the paginated list's next link + * @param items + */ + BrowseService.prototype.getNextBrowseItems = function (items) { + return observableOf(items.payload.next).pipe(getBrowseItemsFor(this.requestService, this.rdb)); + }; + /** + * Get the previous page of browse-entries using the paginated list's prev link + * @param entries + */ + BrowseService.prototype.getPrevBrowseEntries = function (entries) { + return observableOf(entries.payload.prev).pipe(getBrowseEntriesFor(this.requestService, this.rdb)); + }; + /** + * Get the next page of browse-entries using the paginated list's next link + * @param entries + */ + BrowseService.prototype.getNextBrowseEntries = function (entries) { + return observableOf(entries.payload.next).pipe(getBrowseEntriesFor(this.requestService, this.rdb)); + }; + /** + * Get the browse URL by providing a metadatum key and linkPath + * @param metadatumKey + * @param linkPath + */ + BrowseService.prototype.getBrowseURLFor = function (metadataKey, linkPath) { + var searchKeyArray = BrowseService_1.toSearchKeyArray(metadataKey); + return this.getBrowseDefinitions().pipe(getRemoteDataPayload(), map(function (browseDefinitions) { return browseDefinitions + .find(function (def) { + var matchingKeys = def.metadataKeys.find(function (key) { return searchKeyArray.indexOf(key) >= 0; }); + return isNotEmpty(matchingKeys); + }); }), map(function (def) { + if (isEmpty(def) || isEmpty(def._links) || isEmpty(def._links[linkPath])) { + throw new Error("A browse endpoint for " + linkPath + " on " + metadataKey + " isn't configured"); + } + else { + return def._links[linkPath]; + } + }), startWith(undefined), distinctUntilChanged()); + }; + var BrowseService_1; + BrowseService = BrowseService_1 = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + HALEndpointService, + RemoteDataBuildService]) + ], BrowseService); + return BrowseService; +}()); +export { BrowseService }; +/** + * Operator for turning a href into a PaginatedList of BrowseEntries + * @param requestService + * @param responseCache + * @param rdb + */ +export var getBrowseEntriesFor = function (requestService, rdb) { + return function (source) { + return source.pipe(map(function (href) { return new BrowseEntriesRequest(requestService.generateRequestId(), href); }), configureRequest(requestService), toRDPaginatedBrowseEntries(requestService, rdb)); + }; +}; +/** + * Operator for turning a href into a PaginatedList of Items + * @param requestService + * @param responseCache + * @param rdb + */ +export var getBrowseItemsFor = function (requestService, rdb) { + return function (source) { + return source.pipe(map(function (href) { return new BrowseItemsRequest(requestService.generateRequestId(), href); }), configureRequest(requestService), toRDPaginatedBrowseItems(requestService, rdb)); + }; +}; +/** + * Operator for turning a RestRequest into a PaginatedList of Items + * @param requestService + * @param responseCache + * @param rdb + */ +export var toRDPaginatedBrowseItems = function (requestService, rdb) { + return function (source) { + var href$ = source.pipe(map(function (request) { return request.href; })); + var requestEntry$ = href$.pipe(getRequestFromRequestHref(requestService)); + var payload$ = requestEntry$.pipe(filterSuccessfulResponses(), map(function (response) { return new PaginatedList(response.pageInfo, response.payload); }), map(function (list) { return Object.assign(list, { + page: list.page ? list.page.map(function (item) { return Object.assign(new Item(), item); }) : list.page + }); }), distinctUntilChanged()); + return rdb.toRemoteDataObservable(requestEntry$, payload$); + }; +}; +/** + * Operator for turning a RestRequest into a PaginatedList of BrowseEntries + * @param requestService + * @param responseCache + * @param rdb + */ +export var toRDPaginatedBrowseEntries = function (requestService, rdb) { + return function (source) { + var href$ = source.pipe(map(function (request) { return request.href; })); + var requestEntry$ = href$.pipe(getRequestFromRequestHref(requestService)); + var payload$ = requestEntry$.pipe(filterSuccessfulResponses(), map(function (response) { return new PaginatedList(response.pageInfo, response.payload); }), map(function (list) { return Object.assign(list, { + page: list.page ? list.page.map(function (entry) { return Object.assign(new BrowseEntry(), entry); }) : list.page + }); }), distinctUntilChanged()); + return rdb.toRemoteDataObservable(requestEntry$, payload$); + }; +}; +//# sourceMappingURL=browse.service.js.map \ No newline at end of file diff --git a/src/app/core/browse/browse.service.js.map b/src/app/core/browse/browse.service.js.map new file mode 100644 index 0000000000..08d5b0055a --- /dev/null +++ b/src/app/core/browse/browse.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse.service.js","sourceRoot":"","sources":["browse.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,GAAG,EAAE,SAAS,EAAQ,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EACL,mBAAmB,EAAE,QAAQ,EAC7B,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAEnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,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AC,OAAoB,IAAK,OAAA,OAAO,CAAC,IAAI,EAAZ,CAAY,CAAC,CAAC,CAAC;QAEvE,IAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,cAAc,CAAC,CAAC,CAAC;QAE5E,IAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,CACjC,yBAAyB,EAAE,EAC3B,GAAG,CAAC,UAAC,QAA+C,IAAK,OAAA,IAAI,aAAa,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAtD,CAAsD,CAAC,EAChH,GAAG,CAAC,UAAC,IAAgC,IAAK,OAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;YAC5D,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,KAAkB,IAAK,OAAA,MAAM,CAAC,MAAM,CAAC,IAAI,WAAW,EAAE,EAAE,KAAK,CAAC,EAAvC,CAAuC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;SAC7G,CAAC,EAFwC,CAExC,CAAC,EACH,oBAAoB,EAAE,CACvB,CAAC;QAEF,OAAO,GAAG,CAAC,sBAAsB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAC7D,CAAC;AAfD,CAeC,CAAC"} \ No newline at end of file diff --git a/src/app/core/cache/builders/build-decorators.js b/src/app/core/cache/builders/build-decorators.js new file mode 100644 index 0000000000..ecc7a31410 --- /dev/null +++ b/src/app/core/cache/builders/build-decorators.js @@ -0,0 +1,31 @@ +import 'reflect-metadata'; +var mapsToMetadataKey = Symbol('mapsTo'); +var relationshipKey = Symbol('relationship'); +var relationshipMap = new Map(); +export function mapsTo(value) { + return Reflect.metadata(mapsToMetadataKey, value); +} +export function getMapsTo(target) { + return Reflect.getOwnMetadata(mapsToMetadataKey, target); +} +export function relationship(value, isList) { + if (isList === void 0) { isList = false; } + return function r(target, propertyKey, descriptor) { + if (!target || !propertyKey) { + return; + } + var metaDataList = relationshipMap.get(target.constructor) || []; + if (metaDataList.indexOf(propertyKey) === -1) { + metaDataList.push(propertyKey); + } + relationshipMap.set(target.constructor, metaDataList); + return Reflect.metadata(relationshipKey, { resourceType: value, isList: isList }).apply(this, arguments); + }; +} +export function getRelationMetadata(target, propertyKey) { + return Reflect.getMetadata(relationshipKey, target, propertyKey); +} +export function getRelationships(target) { + return relationshipMap.get(target); +} +//# sourceMappingURL=build-decorators.js.map \ No newline at end of file diff --git a/src/app/core/cache/builders/build-decorators.js.map b/src/app/core/cache/builders/build-decorators.js.map new file mode 100644 index 0000000000..ad399fd36d --- /dev/null +++ b/src/app/core/cache/builders/build-decorators.js.map @@ -0,0 +1 @@ +{"version":3,"file":"build-decorators.js","sourceRoot":"","sources":["build-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAM1B,IAAM,iBAAiB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC3C,IAAM,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAE/C,IAAM,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;AAElC,MAAM,iBAAiB,KAA0C;IAC/D,OAAO,OAAO,CAAC,QAAQ,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,oBAAoB,MAAW;IACnC,OAAO,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,uBAAuB,KAAmB,EAAE,MAAuB;IAAvB,uBAAA,EAAA,cAAuB;IACvE,OAAO,WAAW,MAAW,EAAE,WAAmB,EAAE,UAA8B;QAChF,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE;YAC3B,OAAO;SACR;QAED,IAAM,YAAY,GAAa,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC7E,IAAI,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE;YAC5C,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAChC;QACD,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAEtD,OAAO,OAAO,CAAC,QAAQ,CAAC,eAAe,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACnG,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,8BAA8B,MAAW,EAAE,WAAmB;IAClE,OAAO,OAAO,CAAC,WAAW,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,2BAA2B,MAAW;IAC1C,OAAO,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC"} \ No newline at end of file diff --git a/src/app/core/cache/builders/normalized-object-build.service.js b/src/app/core/cache/builders/normalized-object-build.service.js new file mode 100644 index 0000000000..07ae9c01b4 --- /dev/null +++ b/src/app/core/cache/builders/normalized-object-build.service.js @@ -0,0 +1,51 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { getRelationships } from './build-decorators'; +import { NormalizedObjectFactory } from '../models/normalized-object-factory'; +import { hasValue, isNotEmpty } from '../../../shared/empty.util'; +/** + * Return true if halObj has a value for `_links.self` + * + * @param {any} halObj The object to test + */ +export function isRestDataObject(halObj) { + return isNotEmpty(halObj._links) && hasValue(halObj._links.self); +} +/** + * Return true if halObj has a value for `page` and `_embedded` + * + * @param {any} halObj The object to test + */ +export function isRestPaginatedList(halObj) { + return hasValue(halObj.page) && hasValue(halObj._embedded); +} +/** + * A service to turn domain models in to their normalized + * counterparts. + */ +var NormalizedObjectBuildService = /** @class */ (function () { + function NormalizedObjectBuildService() { + } + /** + * Returns the normalized model that corresponds to the given domain model + * + * @param {TDomain} domainModel a domain model + */ + NormalizedObjectBuildService.prototype.normalize = function (domainModel) { + var normalizedConstructor = NormalizedObjectFactory.getConstructor(domainModel.type); + var relationships = getRelationships(normalizedConstructor) || []; + var normalizedModel = Object.assign({}, domainModel); + relationships.forEach(function (key) { + if (hasValue(domainModel[key])) { + domainModel[key] = undefined; + } + }); + return normalizedModel; + }; + NormalizedObjectBuildService = tslib_1.__decorate([ + Injectable() + ], NormalizedObjectBuildService); + return NormalizedObjectBuildService; +}()); +export { NormalizedObjectBuildService }; +//# sourceMappingURL=normalized-object-build.service.js.map \ No newline at end of file diff --git a/src/app/core/cache/builders/normalized-object-build.service.js.map b/src/app/core/cache/builders/normalized-object-build.service.js.map new file mode 100644 index 0000000000..ac16e0f015 --- /dev/null +++ b/src/app/core/cache/builders/normalized-object-build.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-object-build.service.js","sourceRoot":"","sources":["normalized-object-build.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;GAIG;AACH,MAAM,2BAA2B,MAAW;IAC1C,OAAO,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACnE,CAAC;AAED;;;;GAIG;AACH,MAAM,8BAA8B,MAAW;IAC7C,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAC7D,CAAC;AAED;;;GAGG;AAEH;IAAA;IAmBA,CAAC;IAjBC;;;;OAIG;IACH,gDAAS,GAAT,UAAqC,WAAc;QACjD,IAAM,qBAAqB,GAAG,uBAAuB,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACvF,IAAM,aAAa,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC;QAEpE,IAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,CAAQ,CAAC;QAC9D,aAAa,CAAC,OAAO,CAAC,UAAC,GAAW;YAChC,IAAI,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE;gBAC9B,WAAW,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;aAC9B;QACH,CAAC,CAAC,CAAC;QACH,OAAO,eAAe,CAAC;IACzB,CAAC;IAlBU,4BAA4B;QADxC,UAAU,EAAE;OACA,4BAA4B,CAmBxC;IAAD,mCAAC;CAAA,AAnBD,IAmBC;SAnBY,4BAA4B"} \ No newline at end of file diff --git a/src/app/core/cache/builders/remote-data-build.service.js b/src/app/core/cache/builders/remote-data-build.service.js new file mode 100644 index 0000000000..44a720007d --- /dev/null +++ b/src/app/core/cache/builders/remote-data-build.service.js @@ -0,0 +1,218 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { combineLatest as observableCombineLatest, of as observableOf, race as observableRace } from 'rxjs'; +import { distinctUntilChanged, flatMap, map, startWith, switchMap } from 'rxjs/operators'; +import { hasValue, hasValueOperator, isEmpty, isNotEmpty, isNotUndefined } from '../../../shared/empty.util'; +import { PaginatedList } from '../../data/paginated-list'; +import { RemoteData } from '../../data/remote-data'; +import { RemoteDataError } from '../../data/remote-data-error'; +import { GetRequest } from '../../data/request.models'; +import { RequestService } from '../../data/request.service'; +import { ObjectCacheService } from '../object-cache.service'; +import { getMapsTo, getRelationMetadata, getRelationships } from './build-decorators'; +import { filterSuccessfulResponses, getRequestFromRequestHref, getRequestFromRequestUUID, getResourceLinksFromResponse } from '../../shared/operators'; +var RemoteDataBuildService = /** @class */ (function () { + function RemoteDataBuildService(objectCache, requestService) { + this.objectCache = objectCache; + this.requestService = requestService; + } + RemoteDataBuildService.prototype.buildSingle = function (href$) { + var _this = this; + if (typeof href$ === 'string') { + href$ = observableOf(href$); + } + var requestUUID$ = href$.pipe(switchMap(function (href) { + return _this.objectCache.getRequestUUIDBySelfLink(href); + })); + var requestEntry$ = observableRace(href$.pipe(getRequestFromRequestHref(this.requestService)), requestUUID$.pipe(getRequestFromRequestUUID(this.requestService))); + // always use self link if that is cached, only if it isn't, get it via the response. + var payload$ = observableCombineLatest(href$.pipe(switchMap(function (href) { return _this.objectCache.getObjectBySelfLink(href); }), startWith(undefined)), requestEntry$.pipe(getResourceLinksFromResponse(), switchMap(function (resourceSelfLinks) { + if (isNotEmpty(resourceSelfLinks)) { + return _this.objectCache.getObjectBySelfLink(resourceSelfLinks[0]); + } + else { + return observableOf(undefined); + } + }), distinctUntilChanged(), startWith(undefined))).pipe(map(function (_a) { + var fromSelfLink = _a[0], fromResponse = _a[1]; + if (hasValue(fromSelfLink)) { + return fromSelfLink; + } + else { + return fromResponse; + } + }), hasValueOperator(), map(function (normalized) { + return _this.build(normalized); + }), startWith(undefined), distinctUntilChanged()); + return this.toRemoteDataObservable(requestEntry$, payload$); + }; + RemoteDataBuildService.prototype.toRemoteDataObservable = function (requestEntry$, payload$) { + return observableCombineLatest(requestEntry$, payload$).pipe(map(function (_a) { + var reqEntry = _a[0], payload = _a[1]; + var requestPending = hasValue(reqEntry.requestPending) ? reqEntry.requestPending : true; + var responsePending = hasValue(reqEntry.responsePending) ? reqEntry.responsePending : false; + var isSuccessful; + var error; + if (hasValue(reqEntry) && hasValue(reqEntry.response)) { + isSuccessful = reqEntry.response.isSuccessful; + var errorMessage = isSuccessful === false ? reqEntry.response.errorMessage : undefined; + if (hasValue(errorMessage)) { + error = new RemoteDataError(reqEntry.response.statusCode, reqEntry.response.statusText, errorMessage); + } + } + return new RemoteData(requestPending, responsePending, isSuccessful, error, payload); + })); + }; + RemoteDataBuildService.prototype.buildList = function (href$) { + var _this = this; + if (typeof href$ === 'string') { + href$ = observableOf(href$); + } + var requestEntry$ = href$.pipe(getRequestFromRequestHref(this.requestService)); + var tDomainList$ = requestEntry$.pipe(getResourceLinksFromResponse(), flatMap(function (resourceUUIDs) { + return _this.objectCache.getList(resourceUUIDs).pipe(map(function (normList) { + return normList.map(function (normalized) { + return _this.build(normalized); + }); + })); + }), startWith([]), distinctUntilChanged()); + var pageInfo$ = requestEntry$.pipe(filterSuccessfulResponses(), map(function (response) { + if (hasValue(response.pageInfo)) { + var resPageInfo = response.pageInfo; + if (isNotEmpty(resPageInfo) && resPageInfo.currentPage >= 0) { + return Object.assign({}, resPageInfo, { currentPage: resPageInfo.currentPage + 1 }); + } + else { + return resPageInfo; + } + } + })); + var payload$ = observableCombineLatest(tDomainList$, pageInfo$).pipe(map(function (_a) { + var tDomainList = _a[0], pageInfo = _a[1]; + return new PaginatedList(pageInfo, tDomainList); + })); + return this.toRemoteDataObservable(requestEntry$, payload$); + }; + RemoteDataBuildService.prototype.build = function (normalized) { + var _this = this; + var links = {}; + var relationships = getRelationships(normalized.constructor) || []; + relationships.forEach(function (relationship) { + var result; + if (hasValue(normalized[relationship])) { + var _a = getRelationMetadata(normalized, relationship), resourceType = _a.resourceType, isList = _a.isList; + var objectList = normalized[relationship].page || normalized[relationship]; + if (typeof objectList !== 'string') { + objectList.forEach(function (href) { + _this.requestService.configure(new GetRequest(_this.requestService.generateRequestId(), href)); + }); + var rdArr_1 = []; + objectList.forEach(function (href) { + rdArr_1.push(_this.buildSingle(href)); + }); + if (isList) { + result = _this.aggregate(rdArr_1); + } + else if (rdArr_1.length === 1) { + result = rdArr_1[0]; + } + } + else { + _this.requestService.configure(new GetRequest(_this.requestService.generateRequestId(), objectList)); + // The rest API can return a single URL to represent a list of resources (e.g. /items/:id/bitstreams) + // in that case only 1 href will be stored in the normalized obj (so the isArray above fails), + // but it should still be built as a list + if (isList) { + result = _this.buildList(objectList); + } + else { + result = _this.buildSingle(objectList); + } + } + if (hasValue(normalized[relationship].page)) { + links[relationship] = _this.toPaginatedList(result, normalized[relationship].pageInfo); + } + else { + links[relationship] = result; + } + } + }); + var domainModel = getMapsTo(normalized.constructor); + return Object.assign(new domainModel(), normalized, links); + }; + RemoteDataBuildService.prototype.aggregate = function (input) { + if (isEmpty(input)) { + return observableOf(new RemoteData(false, false, true, null, [])); + } + return observableCombineLatest.apply(void 0, input).pipe(map(function (arr) { + // The request of an aggregate RD should be pending if at least one + // of the RDs it's based on is still in the state RequestPending + var requestPending = arr + .map(function (d) { return d.isRequestPending; }) + .find(function (b) { return b === true; }); + // The response of an aggregate RD should be pending if no requests + // are still pending and at least one of the RDs it's based + // on is still in the state ResponsePending + var responsePending = !requestPending && arr + .map(function (d) { return d.isResponsePending; }) + .find(function (b) { return b === true; }); + var isSuccessful; + // isSuccessful should be undefined until all responses have come in. + // We can't know its state beforehand. We also can't say it's false + // because that would imply a request failed. + if (!(requestPending || responsePending)) { + isSuccessful = arr + .map(function (d) { return d.hasSucceeded; }) + .every(function (b) { return b === true; }); + } + var errorMessage = arr + .map(function (d) { return d.error; }) + .map(function (e, idx) { + if (hasValue(e)) { + return "[" + idx + "]: " + e.message; + } + }).filter(function (e) { return hasValue(e); }) + .join(', '); + var statusText = arr + .map(function (d) { return d.error; }) + .map(function (e, idx) { + if (hasValue(e)) { + return "[" + idx + "]: " + e.statusText; + } + }).filter(function (c) { return hasValue(c); }) + .join(', '); + var statusCode = arr + .map(function (d) { return d.error; }) + .map(function (e, idx) { + if (hasValue(e)) { + return e.statusCode; + } + }).filter(function (c) { return hasValue(c); }) + .reduce(function (acc, status) { return status; }, undefined); + var error = new RemoteDataError(statusCode, statusText, errorMessage); + var payload = arr.map(function (d) { return d.payload; }); + return new RemoteData(requestPending, responsePending, isSuccessful, error, payload); + })); + }; + RemoteDataBuildService.prototype.toPaginatedList = function (input, pageInfo) { + return input.pipe(map(function (rd) { + if (Array.isArray(rd.payload)) { + return Object.assign(rd, { payload: new PaginatedList(pageInfo, rd.payload) }); + } + else if (isNotUndefined(rd.payload)) { + return Object.assign(rd, { payload: new PaginatedList(pageInfo, rd.payload.page) }); + } + else { + return Object.assign(rd, { payload: new PaginatedList(pageInfo, []) }); + } + })); + }; + RemoteDataBuildService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [ObjectCacheService, + RequestService]) + ], RemoteDataBuildService); + return RemoteDataBuildService; +}()); +export { RemoteDataBuildService }; +//# sourceMappingURL=remote-data-build.service.js.map \ No newline at end of file diff --git a/src/app/core/cache/builders/remote-data-build.service.js.map b/src/app/core/cache/builders/remote-data-build.service.js.map new file mode 100644 index 0000000000..0ec9f94144 --- /dev/null +++ b/src/app/core/cache/builders/remote-data-build.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"remote-data-build.service.js","sourceRoot":"","sources":["remote-data-build.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAc,EAAE,IAAI,YAAY,EAAE,IAAI,IAAI,cAAc,EAAE,MAAM,MAAM,CAAC;AACxH,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAO,MAAM,gBAAgB,CAAC;AAE/F,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,S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/app/core/cache/cache-entry.js b/src/app/core/cache/cache-entry.js new file mode 100644 index 0000000000..a317688951 --- /dev/null +++ b/src/app/core/cache/cache-entry.js @@ -0,0 +1 @@ +//# sourceMappingURL=cache-entry.js.map \ No newline at end of file diff --git a/src/app/core/cache/cache-entry.js.map b/src/app/core/cache/cache-entry.js.map new file mode 100644 index 0000000000..2e5e21fbf3 --- /dev/null +++ b/src/app/core/cache/cache-entry.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cache-entry.js","sourceRoot":"","sources":["cache-entry.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/core/cache/id-to-uuid-serializer.js b/src/app/core/cache/id-to-uuid-serializer.js new file mode 100644 index 0000000000..71ba487106 --- /dev/null +++ b/src/app/core/cache/id-to-uuid-serializer.js @@ -0,0 +1,36 @@ +import { hasValue } from '../../shared/empty.util'; +/** + * Serializer to create unique fake UUID's from id's that might otherwise be the same across multiple object types + */ +var IDToUUIDSerializer = /** @class */ (function () { + /** + * @param {string} prefix To prepend the original ID with + */ + function IDToUUIDSerializer(prefix) { + this.prefix = prefix; + } + /** + * Method to serialize a UUID + * @param {string} uuid + * @returns {any} undefined Fake UUID's should not be sent back to the server, but only be used in the UI + */ + IDToUUIDSerializer.prototype.Serialize = function (uuid) { + return undefined; + }; + /** + * Method to deserialize a UUID + * @param {string} id Identifier to transform in to a UUID + * @returns {string} UUID based on the prefix and the given id + */ + IDToUUIDSerializer.prototype.Deserialize = function (id) { + if (hasValue(id)) { + return this.prefix + "-" + id; + } + else { + return id; + } + }; + return IDToUUIDSerializer; +}()); +export { IDToUUIDSerializer }; +//# sourceMappingURL=id-to-uuid-serializer.js.map \ No newline at end of file diff --git a/src/app/core/cache/id-to-uuid-serializer.js.map b/src/app/core/cache/id-to-uuid-serializer.js.map new file mode 100644 index 0000000000..967c64d34f --- /dev/null +++ b/src/app/core/cache/id-to-uuid-serializer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"id-to-uuid-serializer.js","sourceRoot":"","sources":["id-to-uuid-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD;;GAEG;AACH;IACE;;OAEG;IACH,4BAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAClC,CAAC;IAED;;;;OAIG;IACH,sCAAS,GAAT,UAAU,IAAY;QACpB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,wCAAW,GAAX,UAAY,EAAU;QACpB,IAAI,QAAQ,CAAC,EAAE,CAAC,EAAE;YAChB,OAAU,IAAI,CAAC,MAAM,SAAI,EAAI,CAAC;SAC/B;aAAM;YACL,OAAO,EAAE,CAAC;SACX;IAEH,CAAC;IACH,yBAAC;AAAD,CAAC,AA7BD,IA6BC"} \ No newline at end of file diff --git a/src/app/core/cache/models/action-type.model.js b/src/app/core/cache/models/action-type.model.js new file mode 100644 index 0000000000..722172f05b --- /dev/null +++ b/src/app/core/cache/models/action-type.model.js @@ -0,0 +1,55 @@ +/** + * Enum representing the Action Type of a Resource Policy + */ +export var ActionType; +(function (ActionType) { + /** + * Action of reading, viewing or downloading something + */ + ActionType[ActionType["READ"] = 0] = "READ"; + /** + * Action of modifying something + */ + ActionType[ActionType["WRITE"] = 1] = "WRITE"; + /** + * Action of deleting something + */ + ActionType[ActionType["DELETE"] = 2] = "DELETE"; + /** + * Action of adding something to a container + */ + ActionType[ActionType["ADD"] = 3] = "ADD"; + /** + * Action of removing something from a container + */ + ActionType[ActionType["REMOVE"] = 4] = "REMOVE"; + /** + * Action of performing workflow step 1 + */ + ActionType[ActionType["WORKFLOW_STEP_1"] = 5] = "WORKFLOW_STEP_1"; + /** + * Action of performing workflow step 2 + */ + ActionType[ActionType["WORKFLOW_STEP_2"] = 6] = "WORKFLOW_STEP_2"; + /** + * Action of performing workflow step 3 + */ + ActionType[ActionType["WORKFLOW_STEP_3"] = 7] = "WORKFLOW_STEP_3"; + /** + * Action of performing a workflow abort + */ + ActionType[ActionType["WORKFLOW_ABORT"] = 8] = "WORKFLOW_ABORT"; + /** + * Default Read policies for Bitstreams submitted to container + */ + ActionType[ActionType["DEFAULT_BITSTREAM_READ"] = 9] = "DEFAULT_BITSTREAM_READ"; + /** + * Default Read policies for Items submitted to container + */ + ActionType[ActionType["DEFAULT_ITEM_READ"] = 10] = "DEFAULT_ITEM_READ"; + /** + * Administrative actions + */ + ActionType[ActionType["ADMIN"] = 11] = "ADMIN"; +})(ActionType || (ActionType = {})); +//# sourceMappingURL=action-type.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/action-type.model.js.map b/src/app/core/cache/models/action-type.model.js.map new file mode 100644 index 0000000000..7d91d1e611 --- /dev/null +++ b/src/app/core/cache/models/action-type.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"action-type.model.js","sourceRoot":"","sources":["action-type.model.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,UA4DX;AA5DD,WAAY,UAAU;IACpB;;OAEG;IACH,2CAAQ,CAAA;IAER;;OAEG;IACH,6CAAS,CAAA;IAET;;OAEG;IACH,+CAAU,CAAA;IAEV;;OAEG;IACH,yCAAO,CAAA;IAEP;;OAEG;IACH,+CAAU,CAAA;IAEV;;OAEG;IACH,iEAAmB,CAAA;IAEnB;;OAEG;IACH,iEAAmB,CAAA;IAEnB;;OAEG;IACH,iEAAmB,CAAA;IAEnB;;OAEG;IACH,+DAAkB,CAAA;IAElB;;OAEG;IACH,+EAA0B,CAAA;IAE1B;;OAEG;IACH,sEAAsB,CAAA;IAEtB;;OAEG;IACH,8CAAU,CAAA;AACZ,CAAC,EA5DW,UAAU,KAAV,UAAU,QA4DrB"} \ No newline at end of file diff --git a/src/app/core/cache/models/items/normalized-item-type.model.js b/src/app/core/cache/models/items/normalized-item-type.model.js new file mode 100644 index 0000000000..e0e0ed89f4 --- /dev/null +++ b/src/app/core/cache/models/items/normalized-item-type.model.js @@ -0,0 +1,35 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize'; +import { ItemType } from '../../../shared/item-relationships/item-type.model'; +import { ResourceType } from '../../../shared/resource-type'; +import { mapsTo } from '../../builders/build-decorators'; +import { NormalizedObject } from '../normalized-object.model'; +import { IDToUUIDSerializer } from '../../id-to-uuid-serializer'; +/** + * Normalized model class for a DSpace ItemType + */ +var NormalizedItemType = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedItemType, _super); + function NormalizedItemType() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedItemType.prototype, "label", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedItemType.prototype, "id", void 0); + tslib_1.__decorate([ + autoserializeAs(new IDToUUIDSerializer(ResourceType.ItemType), 'id'), + tslib_1.__metadata("design:type", String) + ], NormalizedItemType.prototype, "uuid", void 0); + NormalizedItemType = tslib_1.__decorate([ + mapsTo(ItemType), + inheritSerialization(NormalizedObject) + ], NormalizedItemType); + return NormalizedItemType; +}(NormalizedObject)); +export { NormalizedItemType }; +//# sourceMappingURL=normalized-item-type.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/items/normalized-item-type.model.js.map b/src/app/core/cache/models/items/normalized-item-type.model.js.map new file mode 100644 index 0000000000..9210a61d46 --- /dev/null +++ b/src/app/core/cache/models/items/normalized-item-type.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-item-type.model.js","sourceRoot":"","sources":["normalized-item-type.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,oDAAoD,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE;;GAEG;AAGH;IAAwC,8CAA0B;IAAlE;;IAmBA,CAAC;IAbC;QADC,aAAa;;qDACA;IAMd;QADC,aAAa;;kDACH;IAMX;QADC,eAAe,CAAC,IAAI,kBAAkB,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;;oDACxD;IAlBF,kBAAkB;QAF9B,MAAM,CAAC,QAAQ,CAAC;QAChB,oBAAoB,CAAC,gBAAgB,CAAC;OAC1B,kBAAkB,CAmB9B;IAAD,yBAAC;CAAA,AAnBD,CAAwC,gBAAgB,GAmBvD;SAnBY,kBAAkB"} \ No newline at end of file diff --git a/src/app/core/cache/models/items/normalized-relationship-type.model.js b/src/app/core/cache/models/items/normalized-relationship-type.model.js new file mode 100644 index 0000000000..49808cc80a --- /dev/null +++ b/src/app/core/cache/models/items/normalized-relationship-type.model.js @@ -0,0 +1,66 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize'; +import { RelationshipType } from '../../../shared/item-relationships/relationship-type.model'; +import { ResourceType } from '../../../shared/resource-type'; +import { mapsTo, relationship } from '../../builders/build-decorators'; +import { NormalizedDSpaceObject } from '../normalized-dspace-object.model'; +import { NormalizedObject } from '../normalized-object.model'; +import { IDToUUIDSerializer } from '../../id-to-uuid-serializer'; +/** + * Normalized model class for a DSpace RelationshipType + */ +var NormalizedRelationshipType = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedRelationshipType, _super); + function NormalizedRelationshipType() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedRelationshipType.prototype, "id", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedRelationshipType.prototype, "leftLabel", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], NormalizedRelationshipType.prototype, "leftMaxCardinality", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], NormalizedRelationshipType.prototype, "leftMinCardinality", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedRelationshipType.prototype, "rightLabel", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], NormalizedRelationshipType.prototype, "rightMaxCardinality", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], NormalizedRelationshipType.prototype, "rightMinCardinality", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.ItemType, false), + tslib_1.__metadata("design:type", String) + ], NormalizedRelationshipType.prototype, "leftType", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.ItemType, false), + tslib_1.__metadata("design:type", String) + ], NormalizedRelationshipType.prototype, "rightType", void 0); + tslib_1.__decorate([ + autoserializeAs(new IDToUUIDSerializer(ResourceType.RelationshipType), 'id'), + tslib_1.__metadata("design:type", String) + ], NormalizedRelationshipType.prototype, "uuid", void 0); + NormalizedRelationshipType = tslib_1.__decorate([ + mapsTo(RelationshipType), + inheritSerialization(NormalizedDSpaceObject) + ], NormalizedRelationshipType); + return NormalizedRelationshipType; +}(NormalizedObject)); +export { NormalizedRelationshipType }; +//# sourceMappingURL=normalized-relationship-type.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/items/normalized-relationship-type.model.js.map b/src/app/core/cache/models/items/normalized-relationship-type.model.js.map new file mode 100644 index 0000000000..9a0c3b6f24 --- /dev/null +++ b/src/app/core/cache/models/items/normalized-relationship-type.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-relationship-type.model.js","sourceRoot":"","sources":["normalized-relationship-type.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE;;GAEG;AAGH;IAAgD,sDAAkC;IAAlF;;IA+DA,CAAC;IAzDC;QADC,aAAa;;0DACH;IAMX;QADC,aAAa;;iEACI;IAMlB;QADC,aAAa;;0EACa;IAM3B;QADC,aAAa;;0EACa;IAM3B;QADC,aAAa;;kEACK;IAMnB;QADC,aAAa;;2EACc;IAM5B;QADC,aAAa;;2EACc;IAO5B;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC;;gEAC1B;IAOjB;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC;;iEACzB;IAMlB;QADC,eAAe,CAAC,IAAI,kBAAkB,CAAC,YAAY,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC;;4DAChE;IA9DF,0BAA0B;QAFtC,MAAM,CAAC,gBAAgB,CAAC;QACxB,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,0BAA0B,CA+DtC;IAAD,iCAAC;CAAA,AA/DD,CAAgD,gBAAgB,GA+D/D;SA/DY,0BAA0B"} \ No newline at end of file diff --git a/src/app/core/cache/models/items/normalized-relationship.model.js b/src/app/core/cache/models/items/normalized-relationship.model.js new file mode 100644 index 0000000000..9463fcd985 --- /dev/null +++ b/src/app/core/cache/models/items/normalized-relationship.model.js @@ -0,0 +1,52 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize'; +import { Relationship } from '../../../shared/item-relationships/relationship.model'; +import { ResourceType } from '../../../shared/resource-type'; +import { mapsTo, relationship } from '../../builders/build-decorators'; +import { NormalizedObject } from '../normalized-object.model'; +import { IDToUUIDSerializer } from '../../id-to-uuid-serializer'; +/** + * Normalized model class for a DSpace Relationship + */ +var NormalizedRelationship = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedRelationship, _super); + function NormalizedRelationship() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedRelationship.prototype, "id", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedRelationship.prototype, "leftId", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedRelationship.prototype, "rightId", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], NormalizedRelationship.prototype, "leftPlace", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], NormalizedRelationship.prototype, "rightPlace", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.RelationshipType, false), + tslib_1.__metadata("design:type", String) + ], NormalizedRelationship.prototype, "relationshipType", void 0); + tslib_1.__decorate([ + autoserializeAs(new IDToUUIDSerializer(ResourceType.Relationship), 'id'), + tslib_1.__metadata("design:type", String) + ], NormalizedRelationship.prototype, "uuid", void 0); + NormalizedRelationship = tslib_1.__decorate([ + mapsTo(Relationship), + inheritSerialization(NormalizedObject) + ], NormalizedRelationship); + return NormalizedRelationship; +}(NormalizedObject)); +export { NormalizedRelationship }; +//# sourceMappingURL=normalized-relationship.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/items/normalized-relationship.model.js.map b/src/app/core/cache/models/items/normalized-relationship.model.js.map new file mode 100644 index 0000000000..b671028cf0 --- /dev/null +++ b/src/app/core/cache/models/items/normalized-relationship.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-relationship.model.js","sourceRoot":"","sources":["normalized-relationship.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,uDAAuD,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE;;GAEG;AAGH;IAA4C,kDAA8B;IAA1E;;IA4CA,CAAC;IAtCC;QADC,aAAa;;sDACH;IAMX;QADC,aAAa;;0DACC;IAMf;QADC,aAAa;;2DACE;IAMhB;QADC,aAAa;;6DACI;IAMlB;QADC,aAAa;;8DACK;IAOnB;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,gBAAgB,EAAE,KAAK,CAAC;;oEAC1B;IAMzB;QADC,eAAe,CAAC,IAAI,kBAAkB,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;;wDAC5D;IA3CF,sBAAsB;QAFlC,MAAM,CAAC,YAAY,CAAC;QACpB,oBAAoB,CAAC,gBAAgB,CAAC;OAC1B,sBAAsB,CA4ClC;IAAD,6BAAC;CAAA,AA5CD,CAA4C,gBAAgB,GA4C3D;SA5CY,sBAAsB"} \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-bitstream-format.model.js b/src/app/core/cache/models/normalized-bitstream-format.model.js new file mode 100644 index 0000000000..764c9dba97 --- /dev/null +++ b/src/app/core/cache/models/normalized-bitstream-format.model.js @@ -0,0 +1,55 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize'; +import { BitstreamFormat } from '../../shared/bitstream-format.model'; +import { mapsTo } from '../builders/build-decorators'; +import { IDToUUIDSerializer } from '../id-to-uuid-serializer'; +import { NormalizedObject } from './normalized-object.model'; +import { SupportLevel } from './support-level.model'; +/** + * Normalized model class for a Bitstream Format + */ +var NormalizedBitstreamFormat = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedBitstreamFormat, _super); + function NormalizedBitstreamFormat() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedBitstreamFormat.prototype, "shortDescription", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedBitstreamFormat.prototype, "description", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedBitstreamFormat.prototype, "mimetype", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], NormalizedBitstreamFormat.prototype, "supportLevel", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], NormalizedBitstreamFormat.prototype, "internal", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedBitstreamFormat.prototype, "extensions", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedBitstreamFormat.prototype, "id", void 0); + tslib_1.__decorate([ + autoserializeAs(new IDToUUIDSerializer('bitstream-format'), 'id'), + tslib_1.__metadata("design:type", String) + ], NormalizedBitstreamFormat.prototype, "uuid", void 0); + NormalizedBitstreamFormat = tslib_1.__decorate([ + mapsTo(BitstreamFormat), + inheritSerialization(NormalizedObject) + ], NormalizedBitstreamFormat); + return NormalizedBitstreamFormat; +}(NormalizedObject)); +export { NormalizedBitstreamFormat }; +//# sourceMappingURL=normalized-bitstream-format.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-bitstream-format.model.js.map b/src/app/core/cache/models/normalized-bitstream-format.model.js.map new file mode 100644 index 0000000000..e1218d6f50 --- /dev/null +++ b/src/app/core/cache/models/normalized-bitstream-format.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-bitstream-format.model.js","sourceRoot":"","sources":["normalized-bitstream-format.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;GAEG;AAGH;IAA+C,qDAAiC;IAAhF;;IAoDA,CAAC;IA9CC;QADC,aAAa;;uEACW;IAMzB;QADC,aAAa;;kEACM;IAMpB;QADC,aAAa;;+DACG;IAMjB;QADC,aAAa;;mEACa;IAM3B;QADC,aAAa;;+DACI;IAMlB;QADC,aAAa;;iEACK;IAQnB;QADC,aAAa;;yDACH;IAOX;QADC,eAAe,CAAC,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC;;2DACrD;IAnDF,yBAAyB;QAFrC,MAAM,CAAC,eAAe,CAAC;QACvB,oBAAoB,CAAC,gBAAgB,CAAC;OAC1B,yBAAyB,CAoDrC;IAAD,gCAAC;CAAA,AApDD,CAA+C,gBAAgB,GAoD9D;SApDY,yBAAyB"} \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-bitstream.model.js b/src/app/core/cache/models/normalized-bitstream.model.js new file mode 100644 index 0000000000..cb2b1acf36 --- /dev/null +++ b/src/app/core/cache/models/normalized-bitstream.model.js @@ -0,0 +1,53 @@ +import * as tslib_1 from "tslib"; +import { inheritSerialization, autoserialize } from 'cerialize'; +import { NormalizedDSpaceObject } from './normalized-dspace-object.model'; +import { Bitstream } from '../../shared/bitstream.model'; +import { mapsTo, relationship } from '../builders/build-decorators'; +import { ResourceType } from '../../shared/resource-type'; +/** + * Normalized model class for a DSpace Bitstream + */ +var NormalizedBitstream = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedBitstream, _super); + function NormalizedBitstream() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], NormalizedBitstream.prototype, "sizeBytes", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedBitstream.prototype, "content", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.BitstreamFormat, false), + tslib_1.__metadata("design:type", String) + ], NormalizedBitstream.prototype, "format", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedBitstream.prototype, "description", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.Item, true), + tslib_1.__metadata("design:type", Array) + ], NormalizedBitstream.prototype, "parents", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.Item, false), + tslib_1.__metadata("design:type", String) + ], NormalizedBitstream.prototype, "owner", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedBitstream.prototype, "bundleName", void 0); + NormalizedBitstream = tslib_1.__decorate([ + mapsTo(Bitstream), + inheritSerialization(NormalizedDSpaceObject) + ], NormalizedBitstream); + return NormalizedBitstream; +}(NormalizedDSpaceObject)); +export { NormalizedBitstream }; +//# sourceMappingURL=normalized-bitstream.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-bitstream.model.js.map b/src/app/core/cache/models/normalized-bitstream.model.js.map new file mode 100644 index 0000000000..d58c389a44 --- /dev/null +++ b/src/app/core/cache/models/normalized-bitstream.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-bitstream.model.js","sourceRoot":"","sources":["normalized-bitstream.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AAGH;IAAyC,+CAAiC;IAA1E;;IA+CA,CAAC;IAzCC;QADC,aAAa;;0DACI;IAMlB;QADC,aAAa;;wDACE;IAOhB;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,eAAe,EAAE,KAAK,CAAC;;uDACnC;IAMf;QADC,aAAa;;4DACM;IAOpB;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC;;wDACpB;IAOlB;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC;;sDACzB;IAMd;QADC,aAAa;;2DACK;IA7CR,mBAAmB;QAF/B,MAAM,CAAC,SAAS,CAAC;QACjB,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,mBAAmB,CA+C/B;IAAD,0BAAC;CAAA,AA/CD,CAAyC,sBAAsB,GA+C9D;SA/CY,mBAAmB"} \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-bundle.model.js b/src/app/core/cache/models/normalized-bundle.model.js new file mode 100644 index 0000000000..dbbb97547c --- /dev/null +++ b/src/app/core/cache/models/normalized-bundle.model.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, inheritSerialization } from 'cerialize'; +import { NormalizedDSpaceObject } from './normalized-dspace-object.model'; +import { Bundle } from '../../shared/bundle.model'; +import { mapsTo, relationship } from '../builders/build-decorators'; +import { ResourceType } from '../../shared/resource-type'; +/** + * Normalized model class for a DSpace Bundle + */ +var NormalizedBundle = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedBundle, _super); + function NormalizedBundle() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.Bitstream, false), + tslib_1.__metadata("design:type", String) + ], NormalizedBundle.prototype, "primaryBitstream", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.Bitstream, true), + tslib_1.__metadata("design:type", Array) + ], NormalizedBundle.prototype, "bitstreams", void 0); + NormalizedBundle = tslib_1.__decorate([ + mapsTo(Bundle), + inheritSerialization(NormalizedDSpaceObject) + ], NormalizedBundle); + return NormalizedBundle; +}(NormalizedDSpaceObject)); +export { NormalizedBundle }; +//# sourceMappingURL=normalized-bundle.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-bundle.model.js.map b/src/app/core/cache/models/normalized-bundle.model.js.map new file mode 100644 index 0000000000..0f18c64acc --- /dev/null +++ b/src/app/core/cache/models/normalized-bundle.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-bundle.model.js","sourceRoot":"","sources":["normalized-bundle.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AAGH;IAAsC,4CAA8B;IAApE;;IAyBA,CAAC;IAnBC;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC;;8DACnB;IAiBzB;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC;;wDACtB;IAvBV,gBAAgB;QAF5B,MAAM,CAAC,MAAM,CAAC;QACd,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,gBAAgB,CAyB5B;IAAD,uBAAC;CAAA,AAzBD,CAAsC,sBAAsB,GAyB3D;SAzBY,gBAAgB"} \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-collection.model.js b/src/app/core/cache/models/normalized-collection.model.js new file mode 100644 index 0000000000..811d6f3b27 --- /dev/null +++ b/src/app/core/cache/models/normalized-collection.model.js @@ -0,0 +1,56 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; +import { NormalizedDSpaceObject } from './normalized-dspace-object.model'; +import { Collection } from '../../shared/collection.model'; +import { mapsTo, relationship } from '../builders/build-decorators'; +import { ResourceType } from '../../shared/resource-type'; +/** + * Normalized model class for a DSpace Collection + */ +var NormalizedCollection = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedCollection, _super); + function NormalizedCollection() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedCollection.prototype, "handle", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.License, false), + tslib_1.__metadata("design:type", String) + ], NormalizedCollection.prototype, "license", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.ResourcePolicy, false), + tslib_1.__metadata("design:type", String) + ], NormalizedCollection.prototype, "defaultAccessConditions", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Bitstream, false), + tslib_1.__metadata("design:type", String) + ], NormalizedCollection.prototype, "logo", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Community, true), + tslib_1.__metadata("design:type", Array) + ], NormalizedCollection.prototype, "parents", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Community, false), + tslib_1.__metadata("design:type", String) + ], NormalizedCollection.prototype, "owner", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Item, true), + tslib_1.__metadata("design:type", Array) + ], NormalizedCollection.prototype, "items", void 0); + NormalizedCollection = tslib_1.__decorate([ + mapsTo(Collection), + inheritSerialization(NormalizedDSpaceObject) + ], NormalizedCollection); + return NormalizedCollection; +}(NormalizedDSpaceObject)); +export { NormalizedCollection }; +//# sourceMappingURL=normalized-collection.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-collection.model.js.map b/src/app/core/cache/models/normalized-collection.model.js.map new file mode 100644 index 0000000000..aa0375ad31 --- /dev/null +++ b/src/app/core/cache/models/normalized-collection.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-collection.model.js","sourceRoot":"","sources":["normalized-collection.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAE7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AAGH;IAA0C,gDAAkC;IAA5E;;IAkDA,CAAC;IA5CC;QADC,aAAa;;wDACC;IAOf;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;;yDAC1B;IAOhB;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,cAAc,EAAE,KAAK,CAAC;;yEACjB;IAOhC;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC;;sDAC/B;IAOb;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC;;yDACzB;IAOlB;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC;;uDAC9B;IAOd;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC;;uDACtB;IAhDL,oBAAoB;QAFhC,MAAM,CAAC,UAAU,CAAC;QAClB,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,oBAAoB,CAkDhC;IAAD,2BAAC;CAAA,AAlDD,CAA0C,sBAAsB,GAkD/D;SAlDY,oBAAoB"} \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-community.model.js b/src/app/core/cache/models/normalized-community.model.js new file mode 100644 index 0000000000..0f15ac3902 --- /dev/null +++ b/src/app/core/cache/models/normalized-community.model.js @@ -0,0 +1,51 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; +import { NormalizedDSpaceObject } from './normalized-dspace-object.model'; +import { Community } from '../../shared/community.model'; +import { mapsTo, relationship } from '../builders/build-decorators'; +import { ResourceType } from '../../shared/resource-type'; +/** + * Normalized model class for a DSpace Community + */ +var NormalizedCommunity = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedCommunity, _super); + function NormalizedCommunity() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedCommunity.prototype, "handle", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Bitstream, false), + tslib_1.__metadata("design:type", String) + ], NormalizedCommunity.prototype, "logo", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Community, true), + tslib_1.__metadata("design:type", Array) + ], NormalizedCommunity.prototype, "parents", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Community, false), + tslib_1.__metadata("design:type", String) + ], NormalizedCommunity.prototype, "owner", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Collection, true), + tslib_1.__metadata("design:type", Array) + ], NormalizedCommunity.prototype, "collections", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Community, true), + tslib_1.__metadata("design:type", Array) + ], NormalizedCommunity.prototype, "subcommunities", void 0); + NormalizedCommunity = tslib_1.__decorate([ + mapsTo(Community), + inheritSerialization(NormalizedDSpaceObject) + ], NormalizedCommunity); + return NormalizedCommunity; +}(NormalizedDSpaceObject)); +export { NormalizedCommunity }; +//# sourceMappingURL=normalized-community.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-community.model.js.map b/src/app/core/cache/models/normalized-community.model.js.map new file mode 100644 index 0000000000..5061c917e3 --- /dev/null +++ b/src/app/core/cache/models/normalized-community.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-community.model.js","sourceRoot":"","sources":["normalized-community.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,oBAAoB,EAAa,MAAM,WAAW,CAAC;AAExF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AAGH;IAAyC,+CAAiC;IAA1E;;IAwCA,CAAC;IAlCC;QADC,aAAa;;uDACC;IAOf;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC;;qDAC/B;IAOb;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC;;wDACzB;IAOlB;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC;;sDAC9B;IAOd;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC;;4DACtB;IAItB;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC;;+DAClB;IAtCd,mBAAmB;QAF/B,MAAM,CAAC,SAAS,CAAC;QACjB,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,mBAAmB,CAwC/B;IAAD,0BAAC;CAAA,AAxCD,CAAyC,sBAAsB,GAwC9D;SAxCY,mBAAmB"} \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-dspace-object.model.js b/src/app/core/cache/models/normalized-dspace-object.model.js new file mode 100644 index 0000000000..c9fc8b07bd --- /dev/null +++ b/src/app/core/cache/models/normalized-dspace-object.model.js @@ -0,0 +1,54 @@ +import * as tslib_1 from "tslib"; +import { autoserializeAs, deserializeAs } from 'cerialize'; +import { DSpaceObject } from '../../shared/dspace-object.model'; +import { MetadataMap, MetadataMapSerializer } from '../../shared/metadata.models'; +import { ResourceType } from '../../shared/resource-type'; +import { mapsTo } from '../builders/build-decorators'; +import { NormalizedObject } from './normalized-object.model'; +/** + * An model class for a DSpaceObject. + */ +var NormalizedDSpaceObject = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedDSpaceObject, _super); + function NormalizedDSpaceObject() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + deserializeAs(String), + tslib_1.__metadata("design:type", String) + ], NormalizedDSpaceObject.prototype, "self", void 0); + tslib_1.__decorate([ + autoserializeAs(String, 'uuid'), + tslib_1.__metadata("design:type", String) + ], NormalizedDSpaceObject.prototype, "id", void 0); + tslib_1.__decorate([ + autoserializeAs(String), + tslib_1.__metadata("design:type", String) + ], NormalizedDSpaceObject.prototype, "uuid", void 0); + tslib_1.__decorate([ + autoserializeAs(String), + tslib_1.__metadata("design:type", String) + ], NormalizedDSpaceObject.prototype, "type", void 0); + tslib_1.__decorate([ + autoserializeAs(MetadataMapSerializer), + tslib_1.__metadata("design:type", MetadataMap) + ], NormalizedDSpaceObject.prototype, "metadata", void 0); + tslib_1.__decorate([ + deserializeAs(String), + tslib_1.__metadata("design:type", Array) + ], NormalizedDSpaceObject.prototype, "parents", void 0); + tslib_1.__decorate([ + deserializeAs(String), + tslib_1.__metadata("design:type", String) + ], NormalizedDSpaceObject.prototype, "owner", void 0); + tslib_1.__decorate([ + deserializeAs(Object), + tslib_1.__metadata("design:type", Object) + ], NormalizedDSpaceObject.prototype, "_links", void 0); + NormalizedDSpaceObject = tslib_1.__decorate([ + mapsTo(DSpaceObject) + ], NormalizedDSpaceObject); + return NormalizedDSpaceObject; +}(NormalizedObject)); +export { NormalizedDSpaceObject }; +//# sourceMappingURL=normalized-dspace-object.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-dspace-object.model.js.map b/src/app/core/cache/models/normalized-dspace-object.model.js.map new file mode 100644 index 0000000000..d842d6f834 --- /dev/null +++ b/src/app/core/cache/models/normalized-dspace-object.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-dspace-object.model.js","sourceRoot":"","sources":["normalized-dspace-object.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D;;GAEG;AAEH;IAAoE,kDAAmB;IAAvF;;IA4DA,CAAC;IAnDC;QADC,aAAa,CAAC,MAAM,CAAC;;wDACT;IASb;QADC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC;;sDACrB;IAMX;QADC,eAAe,CAAC,MAAM,CAAC;;wDACX;IAMb;QADC,eAAe,CAAC,MAAM,CAAC;;wDACL;IAMnB;QADC,eAAe,CAAC,qBAAqB,CAAC;0CAC7B,WAAW;4DAAC;IAMtB;QADC,aAAa,CAAC,MAAM,CAAC;;2DACJ;IAMlB;QADC,aAAa,CAAC,MAAM,CAAC;;yDACR;IASd;QADC,aAAa,CAAC,MAAM,CAAC;;0DAGrB;IA3DU,sBAAsB;QADlC,MAAM,CAAC,YAAY,CAAC;OACR,sBAAsB,CA4DlC;IAAD,6BAAC;CAAA,AA5DD,CAAoE,gBAAgB,GA4DnF;SA5DY,sBAAsB"} \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-item.model.js b/src/app/core/cache/models/normalized-item.model.js new file mode 100644 index 0000000000..311a94d75e --- /dev/null +++ b/src/app/core/cache/models/normalized-item.model.js @@ -0,0 +1,62 @@ +import * as tslib_1 from "tslib"; +import { inheritSerialization, deserialize, autoserialize, autoserializeAs } from 'cerialize'; +import { NormalizedDSpaceObject } from './normalized-dspace-object.model'; +import { Item } from '../../shared/item.model'; +import { mapsTo, relationship } from '../builders/build-decorators'; +import { ResourceType } from '../../shared/resource-type'; +/** + * Normalized model class for a DSpace Item + */ +var NormalizedItem = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedItem, _super); + function NormalizedItem() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedItem.prototype, "handle", void 0); + tslib_1.__decorate([ + deserialize, + tslib_1.__metadata("design:type", Date) + ], NormalizedItem.prototype, "lastModified", void 0); + tslib_1.__decorate([ + autoserializeAs(Boolean, 'inArchive'), + tslib_1.__metadata("design:type", Boolean) + ], NormalizedItem.prototype, "isArchived", void 0); + tslib_1.__decorate([ + autoserializeAs(Boolean, 'discoverable'), + tslib_1.__metadata("design:type", Boolean) + ], NormalizedItem.prototype, "isDiscoverable", void 0); + tslib_1.__decorate([ + autoserializeAs(Boolean, 'withdrawn'), + tslib_1.__metadata("design:type", Boolean) + ], NormalizedItem.prototype, "isWithdrawn", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Collection, true), + tslib_1.__metadata("design:type", Array) + ], NormalizedItem.prototype, "parents", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Collection, false), + tslib_1.__metadata("design:type", String) + ], NormalizedItem.prototype, "owningCollection", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Bitstream, true), + tslib_1.__metadata("design:type", Array) + ], NormalizedItem.prototype, "bitstreams", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.Relationship, true), + tslib_1.__metadata("design:type", Array) + ], NormalizedItem.prototype, "relationships", void 0); + NormalizedItem = tslib_1.__decorate([ + mapsTo(Item), + inheritSerialization(NormalizedDSpaceObject) + ], NormalizedItem); + return NormalizedItem; +}(NormalizedDSpaceObject)); +export { NormalizedItem }; +//# sourceMappingURL=normalized-item.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-item.model.js.map b/src/app/core/cache/models/normalized-item.model.js.map new file mode 100644 index 0000000000..da7ca2c88d --- /dev/null +++ b/src/app/core/cache/models/normalized-item.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-item.model.js","sourceRoot":"","sources":["normalized-item.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AAGH;IAAoC,0CAA4B;IAAhE;;IAyDA,CAAC;IAnDC;QADC,aAAa;;kDACC;IAMf;QADC,WAAW;0CACE,IAAI;wDAAC;IAMnB;QADC,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC;;sDAClB;IAMpB;QADC,eAAe,CAAC,OAAO,EAAE,cAAc,CAAC;;0DACjB;IAMxB;QADC,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC;;uDACjB;IAOrB;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC;;mDAC1B;IAOlB;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC;;4DACpB;IAOzB;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC;;sDACtB;IAIrB;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC;;yDACtB;IAvDb,cAAc;QAF1B,MAAM,CAAC,IAAI,CAAC;QACZ,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,cAAc,CAyD1B;IAAD,qBAAC;CAAA,AAzDD,CAAoC,sBAAsB,GAyDzD;SAzDY,cAAc"} \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-license.model.js b/src/app/core/cache/models/normalized-license.model.js new file mode 100644 index 0000000000..73fed53c8a --- /dev/null +++ b/src/app/core/cache/models/normalized-license.model.js @@ -0,0 +1,29 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, inheritSerialization } from 'cerialize'; +import { mapsTo } from '../builders/build-decorators'; +import { NormalizedDSpaceObject } from './normalized-dspace-object.model'; +import { License } from '../../shared/license.model'; +/** + * Normalized model class for a Collection License + */ +var NormalizedLicense = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedLicense, _super); + function NormalizedLicense() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], NormalizedLicense.prototype, "custom", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedLicense.prototype, "text", void 0); + NormalizedLicense = tslib_1.__decorate([ + mapsTo(License), + inheritSerialization(NormalizedDSpaceObject) + ], NormalizedLicense); + return NormalizedLicense; +}(NormalizedDSpaceObject)); +export { NormalizedLicense }; +//# sourceMappingURL=normalized-license.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-license.model.js.map b/src/app/core/cache/models/normalized-license.model.js.map new file mode 100644 index 0000000000..1c10f06d3a --- /dev/null +++ b/src/app/core/cache/models/normalized-license.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-license.model.js","sourceRoot":"","sources":["normalized-license.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD;;GAEG;AAGH;IAAuC,6CAA+B;IAAtE;;IAaA,CAAC;IAPC;QADC,aAAa;;qDACE;IAMhB;QADC,aAAa;;mDACD;IAZF,iBAAiB;QAF7B,MAAM,CAAC,OAAO,CAAC;QACf,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,iBAAiB,CAa7B;IAAD,wBAAC;CAAA,AAbD,CAAuC,sBAAsB,GAa5D;SAbY,iBAAiB"} \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-object-factory.js b/src/app/core/cache/models/normalized-object-factory.js new file mode 100644 index 0000000000..3f799d3407 --- /dev/null +++ b/src/app/core/cache/models/normalized-object-factory.js @@ -0,0 +1,105 @@ +import { NormalizedItemType } from './items/normalized-item-type.model'; +import { NormalizedRelationshipType } from './items/normalized-relationship-type.model'; +import { NormalizedRelationship } from './items/normalized-relationship.model'; +import { NormalizedBitstream } from './normalized-bitstream.model'; +import { NormalizedBundle } from './normalized-bundle.model'; +import { NormalizedItem } from './normalized-item.model'; +import { NormalizedCollection } from './normalized-collection.model'; +import { NormalizedCommunity } from './normalized-community.model'; +import { ResourceType } from '../../shared/resource-type'; +import { NormalizedLicense } from './normalized-license.model'; +import { NormalizedResourcePolicy } from './normalized-resource-policy.model'; +import { NormalizedWorkspaceItem } from '../../submission/models/normalized-workspaceitem.model'; +import { NormalizedEPerson } from '../../eperson/models/normalized-eperson.model'; +import { NormalizedGroup } from '../../eperson/models/normalized-group.model'; +import { NormalizedWorkflowItem } from '../../submission/models/normalized-workflowitem.model'; +import { NormalizedClaimedTask } from '../../tasks/models/normalized-claimed-task-object.model'; +import { NormalizedPoolTask } from '../../tasks/models/normalized-pool-task-object.model'; +import { NormalizedBitstreamFormat } from './normalized-bitstream-format.model'; +import { NormalizedMetadataSchema } from '../../metadata/normalized-metadata-schema.model'; +import { NormalizedSubmissionDefinitionsModel } from '../../config/models/normalized-config-submission-definitions.model'; +import { NormalizedSubmissionFormsModel } from '../../config/models/normalized-config-submission-forms.model'; +import { NormalizedSubmissionSectionModel } from '../../config/models/normalized-config-submission-section.model'; +var NormalizedObjectFactory = /** @class */ (function () { + function NormalizedObjectFactory() { + } + NormalizedObjectFactory.getConstructor = function (type) { + switch (type) { + case ResourceType.Bitstream: { + return NormalizedBitstream; + } + case ResourceType.Bundle: { + return NormalizedBundle; + } + case ResourceType.Item: { + return NormalizedItem; + } + case ResourceType.Collection: { + return NormalizedCollection; + } + case ResourceType.Community: { + return NormalizedCommunity; + } + case ResourceType.BitstreamFormat: { + return NormalizedBitstreamFormat; + } + case ResourceType.License: { + return NormalizedLicense; + } + case ResourceType.ResourcePolicy: { + return NormalizedResourcePolicy; + } + case ResourceType.Relationship: { + return NormalizedRelationship; + } + case ResourceType.RelationshipType: { + return NormalizedRelationshipType; + } + case ResourceType.ItemType: { + return NormalizedItemType; + } + case ResourceType.EPerson: { + return NormalizedEPerson; + } + case ResourceType.Group: { + return NormalizedGroup; + } + case ResourceType.MetadataSchema: { + return NormalizedMetadataSchema; + } + case ResourceType.MetadataField: { + return NormalizedGroup; + } + case ResourceType.Workspaceitem: { + return NormalizedWorkspaceItem; + } + case ResourceType.Workflowitem: { + return NormalizedWorkflowItem; + } + case ResourceType.ClaimedTask: { + return NormalizedClaimedTask; + } + case ResourceType.PoolTask: { + return NormalizedPoolTask; + } + case ResourceType.SubmissionDefinition: + case ResourceType.SubmissionDefinitions: { + return NormalizedSubmissionDefinitionsModel; + } + case ResourceType.SubmissionForm: + case ResourceType.SubmissionForms: { + return NormalizedSubmissionFormsModel; + } + case ResourceType.SubmissionSection: + case ResourceType.SubmissionSections: { + return NormalizedSubmissionSectionModel; + } + default: { + return undefined; + } + } + }; + return NormalizedObjectFactory; +}()); +export { NormalizedObjectFactory }; +//# sourceMappingURL=normalized-object-factory.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-object-factory.js.map b/src/app/core/cache/models/normalized-object-factory.js.map new file mode 100644 index 0000000000..d63bdc2c30 --- /dev/null +++ b/src/app/core/cache/models/normalized-object-factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-object-factory.js","sourceRoot":"","sources":["normalized-object-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wDAAwD,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,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AAO,0BAA0B,CAAA;aAClC;YACD,KAAK,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAC1B,OAAO,kBAAkB,CAAA;aAC1B;YACD,KAAK,YAAY,CAAC,OAAO,CAAC,CAAC;gBACzB,OAAO,iBAAiB,CAAA;aACzB;YACD,KAAK,YAAY,CAAC,KAAK,CAAC,CAAC;gBACvB,OAAO,eAAe,CAAA;aACvB;YACD,KAAK,YAAY,CAAC,cAAc,CAAC,CAAC;gBAChC,OAAO,wBAAwB,CAAA;aAChC;YACD,KAAK,YAAY,CAAC,aAAa,CAAC,CAAC;gBAC/B,OAAO,eAAe,CAAA;aACvB;YACD,KAAK,YAAY,CAAC,aAAa,CAAC,CAAC;gBAC/B,OAAO,uBAAuB,CAAA;aAC/B;YACD,KAAK,YAAY,CAAC,YAAY,CAAC,CAAC;gBAC9B,OAAO,sBAAsB,CAAA;aAC9B;YACD,KAAK,YAAY,CAAC,WAAW,CAAC,CAAC;gBAC7B,OAAO,qBAAqB,CAAA;aAC7B;YACD,KAAK,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAC1B,OAAO,kBAAkB,CAAA;aAC1B;YACD,KAAK,YAAY,CAAC,oBAAoB,CAAC;YACvC,KAAK,YAAY,CAAC,qBAAqB,CAAC,CAAC;gBACvC,OAAO,oCAAoC,CAAA;aAC5C;YACD,KAAK,YAAY,CAAC,cAAc,CAAC;YACjC,KAAK,YAAY,CAAC,eAAe,CAAC,CAAC;gBACjC,OAAO,8BAA8B,CAAA;aACtC;YACD,KAAK,YAAY,CAAC,iBAAiB,CAAC;YACpC,KAAK,YAAY,CAAC,kBAAkB,CAAC,CAAC;gBACpC,OAAO,gCAAgC,CAAA;aACxC;YACD,OAAO,CAAC,CAAC;gBACP,OAAO,SAAS,CAAC;aAClB;SACF;IACH,CAAC;IACH,8BAAC;AAAD,CAAC,AA7ED,IA6EC"} \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-object.model.js b/src/app/core/cache/models/normalized-object.model.js new file mode 100644 index 0000000000..c9a0c33463 --- /dev/null +++ b/src/app/core/cache/models/normalized-object.model.js @@ -0,0 +1,25 @@ +import * as tslib_1 from "tslib"; +import { autoserialize } from 'cerialize'; +import { ResourceType } from '../../shared/resource-type'; +/** + * An abstract model class for a NormalizedObject. + */ +var NormalizedObject = /** @class */ (function () { + function NormalizedObject() { + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedObject.prototype, "self", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedObject.prototype, "type", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Object) + ], NormalizedObject.prototype, "_links", void 0); + return NormalizedObject; +}()); +export { NormalizedObject }; +//# sourceMappingURL=normalized-object.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-object.model.js.map b/src/app/core/cache/models/normalized-object.model.js.map new file mode 100644 index 0000000000..9097dcb960 --- /dev/null +++ b/src/app/core/cache/models/normalized-object.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-object.model.js","sourceRoot":"","sources":["normalized-object.model.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D;;GAEG;AACH;IAAA;IAkBA,CAAC;IAZC;QADC,aAAa;;kDACD;IAMb;QADC,aAAa;;kDACK;IAGnB;QADC,aAAa;;oDAGb;IACH,uBAAC;CAAA,AAlBD,IAkBC;SAlBqB,gBAAgB"} \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-resource-policy.model.js b/src/app/core/cache/models/normalized-resource-policy.model.js new file mode 100644 index 0000000000..e59a88a471 --- /dev/null +++ b/src/app/core/cache/models/normalized-resource-policy.model.js @@ -0,0 +1,43 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize'; +import { ResourcePolicy } from '../../shared/resource-policy.model'; +import { mapsTo } from '../builders/build-decorators'; +import { NormalizedObject } from './normalized-object.model'; +import { IDToUUIDSerializer } from '../id-to-uuid-serializer'; +import { ActionType } from './action-type.model'; +/** + * Normalized model class for a Resource Policy + */ +var NormalizedResourcePolicy = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedResourcePolicy, _super); + function NormalizedResourcePolicy() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], NormalizedResourcePolicy.prototype, "action", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedResourcePolicy.prototype, "name", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedResourcePolicy.prototype, "groupUUID", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedResourcePolicy.prototype, "id", void 0); + tslib_1.__decorate([ + autoserializeAs(new IDToUUIDSerializer('resource-policy'), 'id'), + tslib_1.__metadata("design:type", String) + ], NormalizedResourcePolicy.prototype, "uuid", void 0); + NormalizedResourcePolicy = tslib_1.__decorate([ + mapsTo(ResourcePolicy), + inheritSerialization(NormalizedObject) + ], NormalizedResourcePolicy); + return NormalizedResourcePolicy; +}(NormalizedObject)); +export { NormalizedResourcePolicy }; +//# sourceMappingURL=normalized-resource-policy.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/normalized-resource-policy.model.js.map b/src/app/core/cache/models/normalized-resource-policy.model.js.map new file mode 100644 index 0000000000..1080101cde --- /dev/null +++ b/src/app/core/cache/models/normalized-resource-policy.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-resource-policy.model.js","sourceRoot":"","sources":["normalized-resource-policy.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;GAEG;AAGH;IAA8C,oDAAgC;IAA9E;;IAmCA,CAAC;IA7BC;QADC,aAAa;;4DACK;IAMnB;QADC,aAAa;;0DACD;IAMb;QADC,aAAa;;+DACI;IAQlB;QADC,aAAa;;wDACH;IAOX;QADC,eAAe,CAAC,IAAI,kBAAkB,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC;;0DACpD;IAjCF,wBAAwB;QAFpC,MAAM,CAAC,cAAc,CAAC;QACtB,oBAAoB,CAAC,gBAAgB,CAAC;OAC1B,wBAAwB,CAmCpC;IAAD,+BAAC;CAAA,AAnCD,CAA8C,gBAAgB,GAmC7D;SAnCY,wBAAwB"} \ No newline at end of file diff --git a/src/app/core/cache/models/search-param.model.js b/src/app/core/cache/models/search-param.model.js new file mode 100644 index 0000000000..aee0e79853 --- /dev/null +++ b/src/app/core/cache/models/search-param.model.js @@ -0,0 +1,12 @@ +/** + * Class representing a query parameter (query?fieldName=fieldValue) used in FindAllOptions object + */ +var SearchParam = /** @class */ (function () { + function SearchParam(fieldName, fieldValue) { + this.fieldName = fieldName; + this.fieldValue = fieldValue; + } + return SearchParam; +}()); +export { SearchParam }; +//# sourceMappingURL=search-param.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/search-param.model.js.map b/src/app/core/cache/models/search-param.model.js.map new file mode 100644 index 0000000000..0849621347 --- /dev/null +++ b/src/app/core/cache/models/search-param.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-param.model.js","sourceRoot":"","sources":["search-param.model.ts"],"names":[],"mappings":"AACA;;GAEG;AACH;IACE,qBAAmB,SAAiB,EAAS,UAAe;QAAzC,cAAS,GAAT,SAAS,CAAQ;QAAS,eAAU,GAAV,UAAU,CAAK;IAE5D,CAAC;IACH,kBAAC;AAAD,CAAC,AAJD,IAIC"} \ No newline at end of file diff --git a/src/app/core/cache/models/self-link.model.js b/src/app/core/cache/models/self-link.model.js new file mode 100644 index 0000000000..528f3ddd21 --- /dev/null +++ b/src/app/core/cache/models/self-link.model.js @@ -0,0 +1,17 @@ +import * as tslib_1 from "tslib"; +import { autoserialize } from 'cerialize'; +var SelfLink = /** @class */ (function () { + function SelfLink() { + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SelfLink.prototype, "self", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SelfLink.prototype, "uuid", void 0); + return SelfLink; +}()); +export { SelfLink }; +//# sourceMappingURL=self-link.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/self-link.model.js.map b/src/app/core/cache/models/self-link.model.js.map new file mode 100644 index 0000000000..e9cab56544 --- /dev/null +++ b/src/app/core/cache/models/self-link.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"self-link.model.js","sourceRoot":"","sources":["self-link.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;IAAA;IAQA,CAAC;IALC;QADC,aAAa;;0CACD;IAGb;QADC,aAAa;;0CACD;IAEf,eAAC;CAAA,AARD,IAQC;SARY,QAAQ"} \ No newline at end of file diff --git a/src/app/core/cache/models/sort-options.model.js b/src/app/core/cache/models/sort-options.model.js new file mode 100644 index 0000000000..ca079868c1 --- /dev/null +++ b/src/app/core/cache/models/sort-options.model.js @@ -0,0 +1,14 @@ +export var SortDirection; +(function (SortDirection) { + SortDirection["ASC"] = "ASC"; + SortDirection["DESC"] = "DESC"; +})(SortDirection || (SortDirection = {})); +var SortOptions = /** @class */ (function () { + function SortOptions(field, direction) { + this.field = field; + this.direction = direction; + } + return SortOptions; +}()); +export { SortOptions }; +//# sourceMappingURL=sort-options.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/sort-options.model.js.map b/src/app/core/cache/models/sort-options.model.js.map new file mode 100644 index 0000000000..43d014d60d --- /dev/null +++ b/src/app/core/cache/models/sort-options.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sort-options.model.js","sourceRoot":"","sources":["sort-options.model.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,4BAAW,CAAA;IACX,8BAAa,CAAA;AACf,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAED;IACE,qBAAmB,KAAa,EAAS,SAAwB;QAA9C,UAAK,GAAL,KAAK,CAAQ;QAAS,cAAS,GAAT,SAAS,CAAe;IAEjE,CAAC;IACH,kBAAC;AAAD,CAAC,AAJD,IAIC"} \ No newline at end of file diff --git a/src/app/core/cache/models/support-level.model.js b/src/app/core/cache/models/support-level.model.js new file mode 100644 index 0000000000..6d7445f61d --- /dev/null +++ b/src/app/core/cache/models/support-level.model.js @@ -0,0 +1,19 @@ +/** + * Enum representing the Support Level of a Bitstream Format + */ +export var SupportLevel; +(function (SupportLevel) { + /** + * Unknown for Bitstream Formats that are unknown to the system + */ + SupportLevel[SupportLevel["Unknown"] = 0] = "Unknown"; + /** + * Unknown for Bitstream Formats that are known to the system, but not fully supported + */ + SupportLevel[SupportLevel["Known"] = 1] = "Known"; + /** + * Supported for Bitstream Formats that are known to the system and fully supported + */ + SupportLevel[SupportLevel["Supported"] = 2] = "Supported"; +})(SupportLevel || (SupportLevel = {})); +//# sourceMappingURL=support-level.model.js.map \ No newline at end of file diff --git a/src/app/core/cache/models/support-level.model.js.map b/src/app/core/cache/models/support-level.model.js.map new file mode 100644 index 0000000000..10426f3efa --- /dev/null +++ b/src/app/core/cache/models/support-level.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"support-level.model.js","sourceRoot":"","sources":["support-level.model.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,YAeX;AAfD,WAAY,YAAY;IACtB;;OAEG;IACH,qDAAW,CAAA;IAEX;;OAEG;IACH,iDAAS,CAAA;IAET;;OAEG;IACH,yDAAa,CAAA;AACf,CAAC,EAfW,YAAY,KAAZ,YAAY,QAevB"} \ No newline at end of file diff --git a/src/app/core/cache/object-cache.actions.js b/src/app/core/cache/object-cache.actions.js new file mode 100644 index 0000000000..d25668aa06 --- /dev/null +++ b/src/app/core/cache/object-cache.actions.js @@ -0,0 +1,108 @@ +import { type } from '../../shared/ngrx/type'; +/** + * The list of ObjectCacheAction type definitions + */ +export var ObjectCacheActionTypes = { + ADD: type('dspace/core/cache/object/ADD'), + REMOVE: type('dspace/core/cache/object/REMOVE'), + RESET_TIMESTAMPS: type('dspace/core/cache/object/RESET_TIMESTAMPS'), + ADD_PATCH: type('dspace/core/cache/object/ADD_PATCH'), + APPLY_PATCH: type('dspace/core/cache/object/APPLY_PATCH') +}; +/* tslint:disable:max-classes-per-file */ +/** + * An ngrx action to add an object to the cache + */ +var AddToObjectCacheAction = /** @class */ (function () { + /** + * Create a new AddToObjectCacheAction + * + * @param objectToCache + * the object to add + * @param timeAdded + * the time it was added + * @param msToLive + * the amount of milliseconds before it should expire + * @param requestHref + * The href of the request that resulted in this object + * This isn't necessarily the same as the object's self + * link, it could have been part of a list for example + */ + function AddToObjectCacheAction(objectToCache, timeAdded, msToLive, requestUUID) { + this.type = ObjectCacheActionTypes.ADD; + this.payload = { objectToCache: objectToCache, timeAdded: timeAdded, msToLive: msToLive, requestUUID: requestUUID }; + } + return AddToObjectCacheAction; +}()); +export { AddToObjectCacheAction }; +/** + * An ngrx action to remove an object from the cache + */ +var RemoveFromObjectCacheAction = /** @class */ (function () { + /** + * Create a new RemoveFromObjectCacheAction + * + * @param href + * the unique href of the object to remove + */ + function RemoveFromObjectCacheAction(href) { + this.type = ObjectCacheActionTypes.REMOVE; + this.payload = href; + } + return RemoveFromObjectCacheAction; +}()); +export { RemoveFromObjectCacheAction }; +/** + * An ngrx action to reset the timeAdded property of all cached objects + */ +var ResetObjectCacheTimestampsAction = /** @class */ (function () { + /** + * Create a new ResetObjectCacheTimestampsAction + * + * @param newTimestamp + * the new timeAdded all objects should get + */ + function ResetObjectCacheTimestampsAction(newTimestamp) { + this.type = ObjectCacheActionTypes.RESET_TIMESTAMPS; + this.payload = newTimestamp; + } + return ResetObjectCacheTimestampsAction; +}()); +export { ResetObjectCacheTimestampsAction }; +/** + * An ngrx action to add new operations to a specified cached object + */ +var AddPatchObjectCacheAction = /** @class */ (function () { + /** + * Create a new AddPatchObjectCacheAction + * + * @param href + * the unique href of the object that should be updated + * @param operations + * the list of operations to add + */ + function AddPatchObjectCacheAction(href, operations) { + this.type = ObjectCacheActionTypes.ADD_PATCH; + this.payload = { href: href, operations: operations }; + } + return AddPatchObjectCacheAction; +}()); +export { AddPatchObjectCacheAction }; +/** + * An ngrx action to apply all existing operations to a specified cached object + */ +var ApplyPatchObjectCacheAction = /** @class */ (function () { + /** + * Create a new ApplyPatchObjectCacheAction + * + * @param href + * the unique href of the object that should be updated + */ + function ApplyPatchObjectCacheAction(href) { + this.type = ObjectCacheActionTypes.APPLY_PATCH; + this.payload = href; + } + return ApplyPatchObjectCacheAction; +}()); +export { ApplyPatchObjectCacheAction }; +//# sourceMappingURL=object-cache.actions.js.map \ No newline at end of file diff --git a/src/app/core/cache/object-cache.actions.js.map b/src/app/core/cache/object-cache.actions.js.map new file mode 100644 index 0000000000..4f0ed16327 --- /dev/null +++ b/src/app/core/cache/object-cache.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-cache.actions.js","sourceRoot":"","sources":["object-cache.actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAI9C;;GAEG;AACH,MAAM,CAAC,IAAM,sBAAsB,GAAG;IACpC,GAAG,EAAE,IAAI,CAAC,8BAA8B,CAAC;IACzC,MAAM,EAAE,IAAI,CAAC,iCA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AC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;IACH,kCAAC;AAAD,CAAC,AAbD,IAaC"} \ No newline at end of file diff --git a/src/app/core/cache/object-cache.effects.js b/src/app/core/cache/object-cache.effects.js new file mode 100644 index 0000000000..dcc49e5ecf --- /dev/null +++ b/src/app/core/cache/object-cache.effects.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { map } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { Actions, Effect, ofType } from '@ngrx/effects'; +import { StoreActionTypes } from '../../store.actions'; +import { ResetObjectCacheTimestampsAction } from './object-cache.actions'; +var ObjectCacheEffects = /** @class */ (function () { + function ObjectCacheEffects(actions$) { + this.actions$ = actions$; + /** + * When the store is rehydrated in the browser, set all cache + * timestamps to 'now', because the time zone of the server can + * differ from the client. + * + * This assumes that the server cached everything a negligible + * time ago, and will likely need to be revisited later + */ + this.fixTimestampsOnRehydrate = this.actions$ + .pipe(ofType(StoreActionTypes.REHYDRATE), map(function () { return new ResetObjectCacheTimestampsAction(new Date().getTime()); })); + } + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], ObjectCacheEffects.prototype, "fixTimestampsOnRehydrate", void 0); + ObjectCacheEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Actions]) + ], ObjectCacheEffects); + return ObjectCacheEffects; +}()); +export { ObjectCacheEffects }; +//# sourceMappingURL=object-cache.effects.js.map \ No newline at end of file diff --git a/src/app/core/cache/object-cache.effects.js.map b/src/app/core/cache/object-cache.effects.js.map new file mode 100644 index 0000000000..edc264dbe8 --- /dev/null +++ b/src/app/core/cache/object-cache.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-cache.effects.js","sourceRoot":"","sources":["object-cache.effects.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAG1E;IAeE,4BAAoB,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;QAbrC;;;;;;;WAOG;QACO,6BAAwB,GAAG,IAAI,CAAC,QAAQ;aAC/C,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EACtC,GAAG,CAAC,cAAM,OAAA,IAAI,gCAAgC,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,EAA1D,CAA0D,CAAC,CACtE,CAAC;IAGJ,CAAC;IANS;QAAT,MAAM,EAAE;;wEAGL;IAbO,kBAAkB;QAD9B,UAAU,EAAE;iDAgBmB,OAAO;OAf1B,kBAAkB,CAkB9B;IAAD,yBAAC;CAAA,AAlBD,IAkBC;SAlBY,kBAAkB"} \ No newline at end of file diff --git a/src/app/core/cache/object-cache.reducer.js b/src/app/core/cache/object-cache.reducer.js new file mode 100644 index 0000000000..a9788ac620 --- /dev/null +++ b/src/app/core/cache/object-cache.reducer.js @@ -0,0 +1,162 @@ +import { ObjectCacheActionTypes } from './object-cache.actions'; +import { hasValue, isNotEmpty } from '../../shared/empty.util'; +import { applyPatch } from 'fast-json-patch'; +export var DirtyType; +(function (DirtyType) { + DirtyType["Created"] = "Created"; + DirtyType["Updated"] = "Updated"; + DirtyType["Deleted"] = "Deleted"; +})(DirtyType || (DirtyType = {})); +/** + * An entry in the ObjectCache + */ +var ObjectCacheEntry = /** @class */ (function () { + function ObjectCacheEntry() { + this.patches = []; + } + return ObjectCacheEntry; +}()); +export { ObjectCacheEntry }; +// Object.create(null) ensures the object has no default js properties (e.g. `__proto__`) +var initialState = Object.create(null); +/** + * The ObjectCache Reducer + * + * @param state + * the current state + * @param action + * the action to perform on the state + * @return ObjectCacheState + * the new state + */ +export function objectCacheReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case ObjectCacheActionTypes.ADD: { + return addToObjectCache(state, action); + } + case ObjectCacheActionTypes.REMOVE: { + return removeFromObjectCache(state, action); + } + case ObjectCacheActionTypes.RESET_TIMESTAMPS: { + return resetObjectCacheTimestamps(state, action); + } + case ObjectCacheActionTypes.ADD_PATCH: { + return addPatchObjectCache(state, action); + } + case ObjectCacheActionTypes.APPLY_PATCH: { + return applyPatchObjectCache(state, action); + } + default: { + return state; + } + } +} +/** + * Add an object to the cache + * + * @param state + * the current state + * @param action + * an AddToObjectCacheAction + * @return ObjectCacheState + * the new state, with the object added, or overwritten. + */ +function addToObjectCache(state, action) { + var _a; + var existing = state[action.payload.objectToCache.self]; + return Object.assign({}, state, (_a = {}, + _a[action.payload.objectToCache.self] = { + data: action.payload.objectToCache, + timeAdded: action.payload.timeAdded, + msToLive: action.payload.msToLive, + requestUUID: action.payload.requestUUID, + isDirty: (hasValue(existing) ? isNotEmpty(existing.patches) : false), + patches: (hasValue(existing) ? existing.patches : []) + }, + _a)); +} +/** + * Remove an object from the cache + * + * @param state + * the current state + * @param action + * an RemoveFromObjectCacheAction + * @return ObjectCacheState + * the new state, with the object removed if it existed. + */ +function removeFromObjectCache(state, action) { + if (hasValue(state[action.payload])) { + var newObjectCache = Object.assign({}, state); + delete newObjectCache[action.payload]; + return newObjectCache; + } + else { + return state; + } +} +/** + * Set the timeAdded timestamp of every cached object to the specified value + * + * @param state + * the current state + * @param action + * a ResetObjectCacheTimestampsAction + * @return ObjectCacheState + * the new state, with all timeAdded timestamps set to the specified value + */ +function resetObjectCacheTimestamps(state, action) { + var newState = Object.create(null); + Object.keys(state).forEach(function (key) { + newState[key] = Object.assign({}, state[key], { + timeAdded: action.payload + }); + }); + return newState; +} +/** + * Add the list of patch operations to a cached object + * + * @param state + * the current state + * @param action + * an AddPatchObjectCacheAction + * @return ObjectCacheState + * the new state, with the new operations added to the state of the specified ObjectCacheEntry + */ +function addPatchObjectCache(state, action) { + var uuid = action.payload.href; + var operations = action.payload.operations; + var newState = Object.assign({}, state); + if (hasValue(newState[uuid])) { + var patches = newState[uuid].patches; + newState[uuid] = Object.assign({}, newState[uuid], { + patches: patches.concat([{ operations: operations }]), + isDirty: true + }); + } + return newState; +} +/** + * Apply the list of patch operations to a cached object + * + * @param state + * the current state + * @param action + * an ApplyPatchObjectCacheAction + * @return ObjectCacheState + * the new state, with the new operations applied to the state of the specified ObjectCacheEntry + */ +function applyPatchObjectCache(state, action) { + var uuid = action.payload; + var newState = Object.assign({}, state); + if (hasValue(newState[uuid])) { + // flatten two dimensional array + var flatPatch = [].concat.apply([], newState[uuid].patches.map(function (patch) { return patch.operations; })); + var newData = applyPatch(newState[uuid].data, flatPatch, undefined, false); + newState[uuid] = Object.assign({}, newState[uuid], { data: newData.newDocument, patches: [] }); + } + return newState; +} +//# sourceMappingURL=object-cache.reducer.js.map \ No newline at end of file diff --git a/src/app/core/cache/object-cache.reducer.js.map b/src/app/core/cache/object-cache.reducer.js.map new file mode 100644 index 0000000000..2ca5662977 --- /dev/null +++ b/src/app/core/cache/object-cache.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-cache.reducer.js","sourceRoot":"","sources":["object-cache.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EAKvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAa,MAAM,iBAAiB,CAAC;AAExD,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,gCAAmB,CAAA;IACnB,gCAAmB,CAAA;IACnB,gCAAmB,CAAA;AACrB,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAiCD;;GAEG;AACH;IAAA;QAKE,YAAO,GAAY,EAAE,CAAC;IAExB,CAAC;IAAD,uBAAC;AAAD,CAAC,AAP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E,CAAC,CAAC;KAChG;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/src/app/core/cache/object-cache.service.js b/src/app/core/cache/object-cache.service.js new file mode 100644 index 0000000000..9d120daa36 --- /dev/null +++ b/src/app/core/cache/object-cache.service.js @@ -0,0 +1,236 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { createSelector, select, Store } from '@ngrx/store'; +import { applyPatch } from 'fast-json-patch'; +import { combineLatest as observableCombineLatest } from 'rxjs'; +import { distinctUntilChanged, filter, map, mergeMap, take, } from 'rxjs/operators'; +import { hasNoValue, isNotEmpty } from '../../shared/empty.util'; +import { coreSelector } from '../core.selectors'; +import { RestRequestMethod } from '../data/rest-request-method'; +import { selfLinkFromUuidSelector } from '../index/index.selectors'; +import { NormalizedObjectFactory } from './models/normalized-object-factory'; +import { AddPatchObjectCacheAction, AddToObjectCacheAction, ApplyPatchObjectCacheAction, RemoveFromObjectCacheAction } from './object-cache.actions'; +import { AddToSSBAction } from './server-sync-buffer.actions'; +/** + * The base selector function to select the object cache in the store + */ +var objectCacheSelector = createSelector(coreSelector, function (state) { return state['cache/object']; }); +/** + * Selector function to select an object entry by self link from the cache + * @param selfLink The self link of the object + */ +var entryFromSelfLinkSelector = function (selfLink) { return createSelector(objectCacheSelector, function (state) { return state[selfLink]; }); }; +/** + * A service to interact with the object cache + */ +var ObjectCacheService = /** @class */ (function () { + function ObjectCacheService(store) { + this.store = store; + } + /** + * Add an object to the cache + * + * @param objectToCache + * The object to add + * @param msToLive + * The number of milliseconds it should be cached for + * @param requestUUID + * The UUID of the request that resulted in this object + */ + ObjectCacheService.prototype.add = function (objectToCache, msToLive, requestUUID) { + this.store.dispatch(new AddToObjectCacheAction(objectToCache, new Date().getTime(), msToLive, requestUUID)); + }; + /** + * Remove the object with the supplied href from the cache + * + * @param href + * The unique href of the object to be removed + */ + ObjectCacheService.prototype.remove = function (uuid) { + this.store.dispatch(new RemoveFromObjectCacheAction(uuid)); + }; + /** + * Get an observable of the object with the specified UUID + * + * @param uuid + * The UUID of the object to get + * @return Observable> + * An observable of the requested object in normalized form + */ + ObjectCacheService.prototype.getObjectByUUID = function (uuid) { + var _this = this; + return this.store.pipe(select(selfLinkFromUuidSelector(uuid)), mergeMap(function (selfLink) { return _this.getObjectBySelfLink(selfLink); })); + }; + /** + * Get an observable of the object with the specified selfLink + * + * @param selfLink + * The selfLink of the object to get + * @return Observable> + * An observable of the requested object in normalized form + */ + ObjectCacheService.prototype.getObjectBySelfLink = function (selfLink) { + return this.getBySelfLink(selfLink).pipe(map(function (entry) { + if (isNotEmpty(entry.patches)) { + var flatPatch = [].concat.apply([], entry.patches.map(function (patch) { return patch.operations; })); + var patchedData = applyPatch(entry.data, flatPatch, undefined, false).newDocument; + return Object.assign({}, entry, { data: patchedData }); + } + else { + return entry; + } + }), map(function (entry) { + var type = NormalizedObjectFactory.getConstructor(entry.data.type); + return Object.assign(new type(), entry.data); + })); + }; + /** + * Get an observable of the object cache entry with the specified selfLink + * + * @param selfLink + * The selfLink of the object to get + * @return Observable + * An observable of the requested object cache entry + */ + ObjectCacheService.prototype.getBySelfLink = function (selfLink) { + var _this = this; + return this.store.pipe(select(entryFromSelfLinkSelector(selfLink)), filter(function (entry) { return _this.isValid(entry); }), distinctUntilChanged()); + }; + /** + * Get an observable of the request's uuid with the specified selfLink + * + * @param selfLink + * The selfLink of the object to get + * @return Observable + * An observable of the request's uuid + */ + ObjectCacheService.prototype.getRequestUUIDBySelfLink = function (selfLink) { + return this.getBySelfLink(selfLink).pipe(map(function (entry) { return entry.requestUUID; }), distinctUntilChanged()); + }; + /** + * Get an observable of the request's uuid with the specified uuid + * + * @param uuid + * The uuid of the object to get + * @return Observable + * An observable of the request's uuid + */ + ObjectCacheService.prototype.getRequestUUIDByObjectUUID = function (uuid) { + var _this = this; + return this.store.pipe(select(selfLinkFromUuidSelector(uuid)), mergeMap(function (selfLink) { return _this.getRequestUUIDBySelfLink(selfLink); })); + }; + /** + * Get an observable for an array of objects of the same type + * with the specified self links + * + * The type needs to be specified as well, in order to turn + * the cached plain javascript object in to an instance of + * a class. + * + * e.g. getList([ + * 'http://localhost:8080/api/core/collections/c96588c6-72d3-425d-9d47-fa896255a695', + * 'http://localhost:8080/api/core/collections/cff860da-cf5f-4fda-b8c9-afb7ec0b2d9e' + * ], Collection) + * + * @param selfLinks + * An array of self links of the objects to get + * @param type + * The type of the objects to get + * @return Observable> + */ + ObjectCacheService.prototype.getList = function (selfLinks) { + var _this = this; + return observableCombineLatest(selfLinks.map(function (selfLink) { return _this.getObjectBySelfLink(selfLink); })); + }; + /** + * Check whether the object with the specified UUID is cached + * + * @param uuid + * The UUID of the object to check + * @return boolean + * true if the object with the specified UUID is cached, + * false otherwise + */ + ObjectCacheService.prototype.hasByUUID = function (uuid) { + var _this = this; + var result; + this.store.pipe(select(selfLinkFromUuidSelector(uuid)), take(1)).subscribe(function (selfLink) { return result = _this.hasBySelfLink(selfLink); }); + return result; + }; + /** + * Check whether the object with the specified self link is cached + * + * @param selfLink + * The self link of the object to check + * @return boolean + * true if the object with the specified self link is cached, + * false otherwise + */ + ObjectCacheService.prototype.hasBySelfLink = function (selfLink) { + var _this = this; + var result = false; + this.store.pipe(select(entryFromSelfLinkSelector(selfLink)), take(1)).subscribe(function (entry) { return result = _this.isValid(entry); }); + return result; + }; + /** + * Check whether an ObjectCacheEntry should still be cached + * + * @param entry + * the entry to check + * @return boolean + * false if the entry is null, undefined, or its time to + * live has been exceeded, true otherwise + */ + ObjectCacheService.prototype.isValid = function (entry) { + if (hasNoValue(entry)) { + return false; + } + else { + var timeOutdated = entry.timeAdded + entry.msToLive; + var isOutDated = new Date().getTime() > timeOutdated; + if (isOutDated) { + this.store.dispatch(new RemoveFromObjectCacheAction(entry.data.self)); + } + return !isOutDated; + } + }; + /** + * Add operations to the existing list of operations for an ObjectCacheEntry + * Makes sure the ServerSyncBuffer for this ObjectCacheEntry is updated + * @param {string} uuid + * the uuid of the ObjectCacheEntry + * @param {Operation[]} patch + * list of operations to perform + */ + ObjectCacheService.prototype.addPatch = function (selfLink, patch) { + this.store.dispatch(new AddPatchObjectCacheAction(selfLink, patch)); + this.store.dispatch(new AddToSSBAction(selfLink, RestRequestMethod.PATCH)); + }; + /** + * Check whether there are any unperformed operations for an ObjectCacheEntry + * + * @param entry + * the entry to check + * @return boolean + * false if the entry is there are no operations left in the ObjectCacheEntry, true otherwise + */ + ObjectCacheService.prototype.isDirty = function (entry) { + return isNotEmpty(entry.patches); + }; + /** + * Apply the existing operations on an ObjectCacheEntry in the store + * NB: this does not make any server side changes + * @param {string} uuid + * the uuid of the ObjectCacheEntry + */ + ObjectCacheService.prototype.applyPatchesToCachedObject = function (selfLink) { + this.store.dispatch(new ApplyPatchObjectCacheAction(selfLink)); + }; + ObjectCacheService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Store]) + ], ObjectCacheService); + return ObjectCacheService; +}()); +export { ObjectCacheService }; +//# sourceMappingURL=object-cache.service.js.map \ No newline at end of file diff --git a/src/app/core/cache/object-cache.service.js.map b/src/app/core/cache/object-cache.service.js.map new file mode 100644 index 0000000000..cb7301e35d --- /dev/null +++ b/src/app/core/cache/object-cache.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-cache.service.js","sourceRoot":"","sources":["object-cache.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAoB,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAa,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAc,MAAM,MAAM,CAAC;AAE5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MA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,CAAC;IAC7E,CAAC;IAED;;;;;;;OAOG;IACK,oCAAO,GAAf,UAAgB,KAAuB;QACrC,OAAO,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACK,uDAA0B,GAAlC,UAAmC,QAAgB;QACjD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,2BAA2B,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjE,CAAC;IA3OU,kBAAkB;QAD9B,UAAU,EAAE;iDAEgB,KAAK;OADrB,kBAAkB,CA6O9B;IAAD,yBAAC;CAAA,AA7OD,IA6OC;SA7OY,kBAAkB"} \ No newline at end of file diff --git a/src/app/core/cache/response.models.js b/src/app/core/cache/response.models.js new file mode 100644 index 0000000000..6487cfeebe --- /dev/null +++ b/src/app/core/cache/response.models.js @@ -0,0 +1,320 @@ +import * as tslib_1 from "tslib"; +/* tslint:disable:max-classes-per-file */ +var RestResponse = /** @class */ (function () { + function RestResponse(isSuccessful, statusCode, statusText) { + this.isSuccessful = isSuccessful; + this.statusCode = statusCode; + this.statusText = statusText; + this.toCache = true; + } + return RestResponse; +}()); +export { RestResponse }; +var DSOSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(DSOSuccessResponse, _super); + function DSOSuccessResponse(resourceSelfLinks, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.resourceSelfLinks = resourceSelfLinks; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return DSOSuccessResponse; +}(RestResponse)); +export { DSOSuccessResponse }; +/** + * A successful response containing a list of MetadataSchemas wrapped in a RegistryMetadataschemasResponse + */ +var RegistryMetadataschemasSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(RegistryMetadataschemasSuccessResponse, _super); + function RegistryMetadataschemasSuccessResponse(metadataschemasResponse, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.metadataschemasResponse = metadataschemasResponse; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return RegistryMetadataschemasSuccessResponse; +}(RestResponse)); +export { RegistryMetadataschemasSuccessResponse }; +/** + * A successful response containing a list of MetadataFields wrapped in a RegistryMetadatafieldsResponse + */ +var RegistryMetadatafieldsSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(RegistryMetadatafieldsSuccessResponse, _super); + function RegistryMetadatafieldsSuccessResponse(metadatafieldsResponse, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.metadatafieldsResponse = metadatafieldsResponse; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return RegistryMetadatafieldsSuccessResponse; +}(RestResponse)); +export { RegistryMetadatafieldsSuccessResponse }; +/** + * A successful response containing a list of BitstreamFormats wrapped in a RegistryBitstreamformatsResponse + */ +var RegistryBitstreamformatsSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(RegistryBitstreamformatsSuccessResponse, _super); + function RegistryBitstreamformatsSuccessResponse(bitstreamformatsResponse, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.bitstreamformatsResponse = bitstreamformatsResponse; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return RegistryBitstreamformatsSuccessResponse; +}(RestResponse)); +export { RegistryBitstreamformatsSuccessResponse }; +/** + * A successful response containing exactly one MetadataSchema + */ +var MetadataschemaSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(MetadataschemaSuccessResponse, _super); + function MetadataschemaSuccessResponse(metadataschema, statusCode, statusText) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.metadataschema = metadataschema; + _this.statusCode = statusCode; + _this.statusText = statusText; + return _this; + } + return MetadataschemaSuccessResponse; +}(RestResponse)); +export { MetadataschemaSuccessResponse }; +/** + * A successful response containing exactly one MetadataField + */ +var MetadatafieldSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(MetadatafieldSuccessResponse, _super); + function MetadatafieldSuccessResponse(metadatafield, statusCode, statusText) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.metadatafield = metadatafield; + _this.statusCode = statusCode; + _this.statusText = statusText; + return _this; + } + return MetadatafieldSuccessResponse; +}(RestResponse)); +export { MetadatafieldSuccessResponse }; +var SearchSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(SearchSuccessResponse, _super); + function SearchSuccessResponse(results, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.results = results; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return SearchSuccessResponse; +}(RestResponse)); +export { SearchSuccessResponse }; +var FacetConfigSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(FacetConfigSuccessResponse, _super); + function FacetConfigSuccessResponse(results, statusCode, statusText) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.results = results; + _this.statusCode = statusCode; + _this.statusText = statusText; + return _this; + } + return FacetConfigSuccessResponse; +}(RestResponse)); +export { FacetConfigSuccessResponse }; +var FacetValueMap = /** @class */ (function () { + function FacetValueMap() { + } + return FacetValueMap; +}()); +export { FacetValueMap }; +var FacetValueSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(FacetValueSuccessResponse, _super); + function FacetValueSuccessResponse(results, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.results = results; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return FacetValueSuccessResponse; +}(RestResponse)); +export { FacetValueSuccessResponse }; +var FacetValueMapSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(FacetValueMapSuccessResponse, _super); + function FacetValueMapSuccessResponse(results, statusCode, statusText) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.results = results; + _this.statusCode = statusCode; + _this.statusText = statusText; + return _this; + } + return FacetValueMapSuccessResponse; +}(RestResponse)); +export { FacetValueMapSuccessResponse }; +var EndpointMap = /** @class */ (function () { + function EndpointMap() { + } + return EndpointMap; +}()); +export { EndpointMap }; +var EndpointMapSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(EndpointMapSuccessResponse, _super); + function EndpointMapSuccessResponse(endpointMap, statusCode, statusText) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.endpointMap = endpointMap; + _this.statusCode = statusCode; + _this.statusText = statusText; + return _this; + } + return EndpointMapSuccessResponse; +}(RestResponse)); +export { EndpointMapSuccessResponse }; +var GenericSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(GenericSuccessResponse, _super); + function GenericSuccessResponse(payload, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.payload = payload; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return GenericSuccessResponse; +}(RestResponse)); +export { GenericSuccessResponse }; +var ErrorResponse = /** @class */ (function (_super) { + tslib_1.__extends(ErrorResponse, _super); + function ErrorResponse(error) { + var _this = _super.call(this, false, error.statusCode, error.statusText) || this; + console.error(error); + _this.errorMessage = error.message; + return _this; + } + return ErrorResponse; +}(RestResponse)); +export { ErrorResponse }; +var ConfigSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(ConfigSuccessResponse, _super); + function ConfigSuccessResponse(configDefinition, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.configDefinition = configDefinition; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return ConfigSuccessResponse; +}(RestResponse)); +export { ConfigSuccessResponse }; +var AuthStatusResponse = /** @class */ (function (_super) { + tslib_1.__extends(AuthStatusResponse, _super); + function AuthStatusResponse(response, statusCode, statusText) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.response = response; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.toCache = false; + return _this; + } + return AuthStatusResponse; +}(RestResponse)); +export { AuthStatusResponse }; +var IntegrationSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(IntegrationSuccessResponse, _super); + function IntegrationSuccessResponse(dataDefinition, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.dataDefinition = dataDefinition; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return IntegrationSuccessResponse; +}(RestResponse)); +export { IntegrationSuccessResponse }; +var PostPatchSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(PostPatchSuccessResponse, _super); + function PostPatchSuccessResponse(dataDefinition, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.dataDefinition = dataDefinition; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return PostPatchSuccessResponse; +}(RestResponse)); +export { PostPatchSuccessResponse }; +var SubmissionSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionSuccessResponse, _super); + function SubmissionSuccessResponse(dataDefinition, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.dataDefinition = dataDefinition; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return SubmissionSuccessResponse; +}(RestResponse)); +export { SubmissionSuccessResponse }; +var EpersonSuccessResponse = /** @class */ (function (_super) { + tslib_1.__extends(EpersonSuccessResponse, _super); + function EpersonSuccessResponse(epersonDefinition, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.epersonDefinition = epersonDefinition; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return EpersonSuccessResponse; +}(RestResponse)); +export { EpersonSuccessResponse }; +var MessageResponse = /** @class */ (function (_super) { + tslib_1.__extends(MessageResponse, _super); + function MessageResponse(statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + _this.toCache = false; + return _this; + } + return MessageResponse; +}(RestResponse)); +export { MessageResponse }; +var TaskResponse = /** @class */ (function (_super) { + tslib_1.__extends(TaskResponse, _super); + function TaskResponse(statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + _this.toCache = false; + return _this; + } + return TaskResponse; +}(RestResponse)); +export { TaskResponse }; +var FilteredDiscoveryQueryResponse = /** @class */ (function (_super) { + tslib_1.__extends(FilteredDiscoveryQueryResponse, _super); + function FilteredDiscoveryQueryResponse(filterQuery, statusCode, statusText, pageInfo) { + var _this = _super.call(this, true, statusCode, statusText) || this; + _this.filterQuery = filterQuery; + _this.statusCode = statusCode; + _this.statusText = statusText; + _this.pageInfo = pageInfo; + return _this; + } + return FilteredDiscoveryQueryResponse; +}(RestResponse)); +export { FilteredDiscoveryQueryResponse }; +/* tslint:enable:max-classes-per-file */ +//# sourceMappingURL=response.models.js.map \ No newline at end of file diff --git a/src/app/core/cache/response.models.js.map b/src/app/core/cache/response.models.js.map new file mode 100644 index 0000000000..b79da5d2c5 --- /dev/null +++ b/src/app/core/cache/response.models.js.map @@ -0,0 +1 @@ +{"version":3,"file":"response.models.js","sourceRoot":"","sources":["response.models.ts"],"names":[],"mappings":";AAiBA,yCAAyC;AACzC;IAIE,sBACS,YAAqB,EACrB,UAAkB,EAClB,UAAkB;QAFlB,iBAAY,GAAZ,YAAY,CAAS;QACrB,eAAU,GAAV,UAAU,CAAQ;QAClB,eAAU,GAAV,UAAU,CAAQ;QANpB,YAAO,GAAG,IAAI,CAAC;IAQtB,CAAC;IACH,mBAAC;AAAD,CAAC,AAVD,IAUC;;AAED;IAAwC,8CAAY;IAClD,4BACS,iBAA2B,EAC3B,UAAkB,EAClB,UAAkB,EAClB,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B,cAAQ,GAAR,QAAQ,CAAW;;IAG5B,CAAC;IACH,6BAAC;AAAD,CAAC,AATD,CAA4C,YAAY,GASvD;;AAED;IAAqC,2CAAY;IAG/C,yBACS,UAAkB,EAClB,UAAkB,EAClB,QAAmB;QAH5B,YAKE,kBAAM,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,SACpC;QALQ,gBAAU,GAAV,UAAU,CAAQ;QAClB,gBAAU,GAAV,UAAU,CAAQ;QAClB,cAAQ,GAAR,QAAQ,CAAW;QALrB,aAAO,GAAG,KAAK,CAAC;;IAQvB,CAAC;IACH,sBAAC;AAAD,CAAC,AAVD,CAAqC,YAAY,GAUhD;;AAED;IAAkC,wCAAY;IAG5C,sBACS,UAAkB,EAClB,UAAkB,EAClB,QAAmB;QAH5B,YAKE,kBAAM,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,SACpC;QALQ,gBAAU,GAAV,UAAU,CAAQ;QAClB,gBAAU,GAAV,UAAU,CAAQ;QAClB,cAAQ,GAAR,QAAQ,CAAW;QALrB,aAAO,GAAG,KAAK,CAAC;;IAQvB,CAAC;IACH,mBAAC;AAAD,CAAC,AAVD,CAAkC,YAAY,GAU7C;;AAED;IAAoD,0DAAY;IAC9D,wCACS,WAAmB,EACnB,UAAkB,EAClB,UAAkB,EAClB,QAAmB;QAJ5B,YAME,kBAAM,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,SACpC;QANQ,iBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAU,GAAV,UAAU,CAAQ;QAClB,gBAAU,GAAV,UAAU,CAAQ;QAClB,cAAQ,GAAR,QAAQ,CAAW;;IAG5B,CAAC;IACH,qCAAC;AAAD,CAAC,AATD,CAAoD,YAAY,GAS/D;;AACD,wCAAwC"} \ No newline at end of file diff --git a/src/app/core/cache/server-sync-buffer.actions.js b/src/app/core/cache/server-sync-buffer.actions.js new file mode 100644 index 0000000000..f5e3f7b60d --- /dev/null +++ b/src/app/core/cache/server-sync-buffer.actions.js @@ -0,0 +1,63 @@ +import { type } from '../../shared/ngrx/type'; +/** + * The list of ServerSyncBufferAction type definitions + */ +export var ServerSyncBufferActionTypes = { + ADD: type('dspace/core/cache/syncbuffer/ADD'), + COMMIT: type('dspace/core/cache/syncbuffer/COMMIT'), + EMPTY: type('dspace/core/cache/syncbuffer/EMPTY'), +}; +/* tslint:disable:max-classes-per-file */ +/** + * An ngrx action to add a new cached object to the server sync buffer + */ +var AddToSSBAction = /** @class */ (function () { + /** + * Create a new AddToSSBAction + * + * @param href + * the unique href of the cached object entry that should be updated + */ + function AddToSSBAction(href, method) { + this.type = ServerSyncBufferActionTypes.ADD; + this.payload = { href: href, method: method }; + } + return AddToSSBAction; +}()); +export { AddToSSBAction }; +/** + * An ngrx action to commit everything (for a certain method, when specified) in the ServerSyncBuffer to the server + */ +var CommitSSBAction = /** @class */ (function () { + /** + * Create a new CommitSSBAction + * + * @param method + * an optional method for which the ServerSyncBuffer should send its entries to the server + */ + function CommitSSBAction(method) { + this.type = ServerSyncBufferActionTypes.COMMIT; + this.payload = method; + } + return CommitSSBAction; +}()); +export { CommitSSBAction }; +/** + * An ngrx action to remove everything (for a certain method, when specified) from the ServerSyncBuffer to the server + */ +var EmptySSBAction = /** @class */ (function () { + /** + * Create a new EmptySSBAction + * + * @param method + * an optional method for which the ServerSyncBuffer should remove its entries + * if this parameter is omitted, the buffer will be emptied as a whole + */ + function EmptySSBAction(method) { + this.type = ServerSyncBufferActionTypes.EMPTY; + this.payload = method; + } + return EmptySSBAction; +}()); +export { EmptySSBAction }; +//# sourceMappingURL=server-sync-buffer.actions.js.map \ No newline at end of file diff --git a/src/app/core/cache/server-sync-buffer.actions.js.map b/src/app/core/cache/server-sync-buffer.actions.js.map new file mode 100644 index 0000000000..8521aeb241 --- /dev/null +++ b/src/app/core/cache/server-sync-buffer.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"server-sync-buffer.actions.js","sourceRoot":"","sources":["server-sync-buffer.actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAG9C;;GAEG;AACH,MAAM,CAAC,IAAM,2BAA2B,GAAG;IACzC,GAAG,EAAE,IAAI,CAAC,kCAAkC,CAAC;IAC7C,MAAM,EAAE,IAAI,CAAC,qCAAqC,CAAC;IACnD,KAAK,EAAE,IAAI,CAAC,oCAAoC,CAAC;CAClD,CAAC;AAEF,yCAAyC;AAEzC;;GAEG;AACH;IAOE;;;;;OAKG;IACH,wBAAY,IAAY,EAAE,MAAyB;QAZnD,SAAI,GAAG,2BAA2B,CAAC,GAAG,CAAC;QAarC,IAAI,CAAC,OAAO,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC1C,CAAC;IACH,qBAAC;AAAD,CAAC,AAhBD,IAgBC;;AAED;;GAEG;AACH;IAIE;;;;;OAKG;IACH,yBAAY,MAA0B;QATtC,SAAI,GAAG,2BAA2B,CAAC,MAAM,CAAC;QAUxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IACH,sBAAC;AAAD,CAAC,AAbD,IAaC;;AACD;;GAEG;AACH;IAIE;;;;;;OAMG;IACH,wBAAY,MAA0B;QAVtC,SAAI,GAAG,2BAA2B,CAAC,KAAK,CAAC;QAWvC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IACH,qBAAC;AAAD,CAAC,AAdD,IAcC"} \ No newline at end of file diff --git a/src/app/core/cache/server-sync-buffer.effects.js b/src/app/core/cache/server-sync-buffer.effects.js new file mode 100644 index 0000000000..3e066e2c53 --- /dev/null +++ b/src/app/core/cache/server-sync-buffer.effects.js @@ -0,0 +1,110 @@ +import * as tslib_1 from "tslib"; +import { delay, exhaustMap, map, switchMap, take } from 'rxjs/operators'; +import { Inject, Injectable } from '@angular/core'; +import { Actions, Effect, ofType } from '@ngrx/effects'; +import { coreSelector } from '../core.selectors'; +import { CommitSSBAction, EmptySSBAction, ServerSyncBufferActionTypes } from './server-sync-buffer.actions'; +import { GLOBAL_CONFIG } from '../../../config'; +import { createSelector, select, Store } from '@ngrx/store'; +import { combineLatest as observableCombineLatest, of as observableOf } from 'rxjs'; +import { RequestService } from '../data/request.service'; +import { PutRequest } from '../data/request.models'; +import { ObjectCacheService } from './object-cache.service'; +import { ApplyPatchObjectCacheAction } from './object-cache.actions'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { hasValue, isNotEmpty, isNotUndefined } from '../../shared/empty.util'; +import { RestRequestMethod } from '../data/rest-request-method'; +var ServerSyncBufferEffects = /** @class */ (function () { + function ServerSyncBufferEffects(actions$, store, requestService, objectCache, EnvConfig) { + var _this = this; + this.actions$ = actions$; + this.store = store; + this.requestService = requestService; + this.objectCache = objectCache; + this.EnvConfig = EnvConfig; + /** + * When an ADDToSSBAction is dispatched + * Set a time out (configurable per method type) + * Then dispatch a CommitSSBAction + * When the delay is running, no new AddToSSBActions are processed in this effect + */ + this.setTimeoutForServerSync = this.actions$ + .pipe(ofType(ServerSyncBufferActionTypes.ADD), exhaustMap(function (action) { + var autoSyncConfig = _this.EnvConfig.cache.autoSync; + var timeoutInSeconds = autoSyncConfig.timePerMethod[action.payload.method] || autoSyncConfig.defaultTime; + return observableOf(new CommitSSBAction(action.payload.method)).pipe(delay(timeoutInSeconds * 1000)); + })); + /** + * When a CommitSSBAction is dispatched + * Create a list of actions for each entry in the current buffer state to be dispatched + * When the list of actions is not empty, also dispatch an EmptySSBAction + * When the list is empty dispatch a NO_ACTION placeholder action + */ + this.commitServerSyncBuffer = this.actions$ + .pipe(ofType(ServerSyncBufferActionTypes.COMMIT), switchMap(function (action) { + return _this.store.pipe(select(serverSyncBufferSelector()), take(1), /* necessary, otherwise delay will not have any effect after the first run */ switchMap(function (bufferState) { + var actions = bufferState.buffer + .filter(function (entry) { + /* If there's a request method, filter + If there's no filter, commit everything */ + if (hasValue(action.payload)) { + return entry.method === action.payload; + } + return true; + }) + .map(function (entry) { + if (entry.method === RestRequestMethod.PATCH) { + return _this.applyPatch(entry.href); + } + else { + /* TODO implement for other request method types */ + } + }); + /* Add extra action to array, to make sure the ServerSyncBuffer is emptied afterwards */ + if (isNotEmpty(actions) && isNotUndefined(actions[0])) { + return observableCombineLatest.apply(void 0, actions).pipe(switchMap(function (array) { return array.concat([new EmptySSBAction(action.payload)]); })); + } + else { + return observableOf({ type: 'NO_ACTION' }); + } + })); + })); + } + /** + * private method to create an ApplyPatchObjectCacheAction based on a cache entry + * and to do the actual patch request to the server + * @param {string} href The self link of the cache entry + * @returns {Observable} ApplyPatchObjectCacheAction to be dispatched + */ + ServerSyncBufferEffects.prototype.applyPatch = function (href) { + var _this = this; + var patchObject = this.objectCache.getObjectBySelfLink(href).pipe(take(1)); + return patchObject.pipe(map(function (object) { + var serializedObject = new DSpaceRESTv2Serializer(object.constructor).serialize(object); + _this.requestService.configure(new PutRequest(_this.requestService.generateRequestId(), href, serializedObject)); + return new ApplyPatchObjectCacheAction(href); + })); + }; + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], ServerSyncBufferEffects.prototype, "setTimeoutForServerSync", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], ServerSyncBufferEffects.prototype, "commitServerSyncBuffer", void 0); + ServerSyncBufferEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(4, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Actions, + Store, + RequestService, + ObjectCacheService, Object]) + ], ServerSyncBufferEffects); + return ServerSyncBufferEffects; +}()); +export { ServerSyncBufferEffects }; +export function serverSyncBufferSelector() { + return createSelector(coreSelector, function (state) { return state['cache/syncbuffer']; }); +} +//# sourceMappingURL=server-sync-buffer.effects.js.map \ No newline at end of file diff --git a/src/app/core/cache/server-sync-buffer.effects.js.map b/src/app/core/cache/server-sync-buffer.effects.js.map new file mode 100644 index 0000000000..81a77980da --- /dev/null +++ b/src/app/core/cache/server-sync-buffer.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"server-sync-buffer.effects.js","sourceRoot":"","sources":["server-sync-buffer.effects.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAEL,eAAe,EACf,cAAc,EACd,2BAA2B,EAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAU,cAAc,EAAoB,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGhE;IAoFE,iCAAoB,QAAiB,EACjB,KAAuB,EACvB,cAA8B,EAC9B,WAA+B,EACR,SAAuB;QAJlE,iBAMC;QANmB,aAAQ,GAAR,QAAQ,CAAS;QACjB,UAAK,GAAL,KAAK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,MAAM,EAAE;;4EAUL;IAQM;QAAT,MAAM,EAAE;;2EAoCL;IA9DO,uBAAuB;QADnC,UAAU,EAAE;QAyFE,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;iDAJJ,OAAO;YACV,KAAK;YACI,cAAc;YACjB,kBAAkB;OAvFxC,uBAAuB,CA2FnC;IAAD,8BAAC;CAAA,AA3FD,IA2FC;SA3FY,uBAAuB;AA6FpC,MAAM;IACJ,OAAO,cAAc,CAAC,YAAY,EAAE,UAAC,KAAgB,IAAK,OAAA,KAAK,CAAC,kBAAkB,CAAC,EAAzB,CAAyB,CAAC,CAAC;AACvF,CAAC"} \ No newline at end of file diff --git a/src/app/core/cache/server-sync-buffer.reducer.js b/src/app/core/cache/server-sync-buffer.reducer.js new file mode 100644 index 0000000000..c91f37fdcc --- /dev/null +++ b/src/app/core/cache/server-sync-buffer.reducer.js @@ -0,0 +1,73 @@ +import { hasNoValue, hasValue } from '../../shared/empty.util'; +import { ServerSyncBufferActionTypes } from './server-sync-buffer.actions'; +/** + * An entry in the ServerSyncBufferState + * href: unique href of an ObjectCacheEntry + * method: RestRequestMethod type + */ +var ServerSyncBufferEntry = /** @class */ (function () { + function ServerSyncBufferEntry() { + } + return ServerSyncBufferEntry; +}()); +export { ServerSyncBufferEntry }; +var initialState = { buffer: [] }; +/** + * The ServerSyncBuffer Reducer + * + * @param state + * the current state + * @param action + * the action to perform on the state + * @return ServerSyncBufferState + * the new state + */ +export function serverSyncBufferReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case ServerSyncBufferActionTypes.ADD: { + return addToServerSyncQueue(state, action); + } + case ServerSyncBufferActionTypes.EMPTY: { + return emptyServerSyncQueue(state, action); + } + default: { + return state; + } + } +} +/** + * Add a new entry to the buffer with a specified method + * + * @param state + * the current state + * @param action + * an AddToSSBAction + * @return ServerSyncBufferState + * the new state, with a new entry added to the buffer + */ +function addToServerSyncQueue(state, action) { + var actionEntry = action.payload; + if (hasNoValue(state.buffer.find(function (entry) { return entry.href === actionEntry.href && entry.method === actionEntry.method; }))) { + return Object.assign({}, state, { buffer: state.buffer.concat(actionEntry) }); + } +} +/** + * Remove all ServerSyncBuffers entry from the buffer with a specified method + * If no method is specified, empty the whole buffer + * + * @param state + * the current state + * @param action + * an AddToSSBAction + * @return ServerSyncBufferState + * the new state, with a new entry added to the buffer + */ +function emptyServerSyncQueue(state, action) { + var newBuffer = []; + if (hasValue(action.payload)) { + newBuffer = state.buffer.filter(function (entry) { return entry.method !== action.payload; }); + } + return Object.assign({}, state, { buffer: newBuffer }); +} +//# sourceMappingURL=server-sync-buffer.reducer.js.map \ No newline at end of file diff --git a/src/app/core/cache/server-sync-buffer.reducer.js.map b/src/app/core/cache/server-sync-buffer.reducer.js.map new file mode 100644 index 0000000000..5774c1fdef --- /dev/null +++ b/src/app/core/cache/server-sync-buffer.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"server-sync-buffer.reducer.js","sourceRoot":"","sources":["server-sync-buffer.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAIL,2BAA2B,EAC5B,MAAM,8BAA8B,CAAC;AAGtC;;;;GAIG;AACH;IAAA;IAGA,CAAC;IAAD,4BAAC;AAAD,CAAC,AAHD,IAGC;;AAWD,IAAM,YAAY,GAA0B,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAE3D;;;;;;;;;GASG;AACH,MAAM,kCAAkC,KAAoB,EAAE,MAA8B;IAApD,sBAAA,EAAA,oBAAoB;IAC1D,QAAQ,MAAM,CAAC,IAAI,EAAE;QAEnB,KAAK,2BAA2B,CAAC,GAAG,CAAC,CAAC;YACpC,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAwB,CAAC,CAAA;SAC7D;QAED,KAAK,2BAA2B,CAAC,KAAK,CAAC,CAAC;YACtC,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAwB,CAAC,CAAC;SAC9D;QACD,OAAO,CAAC,CAAC;YACP,OAAO,KAAK,CAAC;SACd;KACF;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,8BAA8B,KAA4B,EAAE,MAAsB;IAChF,IAAM,WAAW,GAAG,MAAM,CAAC,OAAgC,CAAC;IAC5D,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,EAAtE,CAAsE,CAAC,CAAC,EAAE;QACpH,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;KAC/E;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,8BAA8B,KAA4B,EAAE,MAAsB;IAC9E,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAI,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;QAC5B,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,EAA/B,CAA+B,CAAC,CAAC;KAC7E;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;AAC3D,CAAC"} \ No newline at end of file diff --git a/src/app/core/config/config-data.js b/src/app/core/config/config-data.js new file mode 100644 index 0000000000..09829cd567 --- /dev/null +++ b/src/app/core/config/config-data.js @@ -0,0 +1,12 @@ +/** + * A class to represent the data retrieved by a configuration service + */ +var ConfigData = /** @class */ (function () { + function ConfigData(pageInfo, payload) { + this.pageInfo = pageInfo; + this.payload = payload; + } + return ConfigData; +}()); +export { ConfigData }; +//# sourceMappingURL=config-data.js.map \ No newline at end of file diff --git a/src/app/core/config/config-data.js.map b/src/app/core/config/config-data.js.map new file mode 100644 index 0000000000..1c8337a04e --- /dev/null +++ b/src/app/core/config/config-data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-data.js","sourceRoot":"","sources":["config-data.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH;IACE,oBACS,QAAkB,EAClB,OAAqB;QADrB,aAAQ,GAAR,QAAQ,CAAU;QAClB,YAAO,GAAP,OAAO,CAAc;IAE9B,CAAC;IACH,iBAAC;AAAD,CAAC,AAND,IAMC"} \ No newline at end of file diff --git a/src/app/core/config/config-response-parsing.service.js b/src/app/core/config/config-response-parsing.service.js new file mode 100644 index 0000000000..d904a740e7 --- /dev/null +++ b/src/app/core/config/config-response-parsing.service.js @@ -0,0 +1,36 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { ConfigSuccessResponse, ErrorResponse } from '../cache/response.models'; +import { isNotEmpty } from '../../shared/empty.util'; +import { ConfigObjectFactory } from './models/config-object-factory'; +import { BaseResponseParsingService } from '../data/base-response-parsing.service'; +import { GLOBAL_CONFIG } from '../../../config'; +import { ObjectCacheService } from '../cache/object-cache.service'; +var ConfigResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(ConfigResponseParsingService, _super); + function ConfigResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = ConfigObjectFactory; + _this.toCache = false; + return _this; + } + ConfigResponseParsingService.prototype.parse = function (request, data) { + if (isNotEmpty(data.payload) && isNotEmpty(data.payload._links) && (data.statusCode === 201 || data.statusCode === 200)) { + var configDefinition = this.process(data.payload, request.uuid); + return new ConfigSuccessResponse(configDefinition, data.statusCode, data.statusText, this.processPageInfo(data.payload)); + } + else { + return new ErrorResponse(Object.assign(new Error('Unexpected response from config endpoint'), { statusCode: data.statusCode, statusText: data.statusText })); + } + }; + ConfigResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], ConfigResponseParsingService); + return ConfigResponseParsingService; +}(BaseResponseParsingService)); +export { ConfigResponseParsingService }; +//# sourceMappingURL=config-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/config/config-response-parsing.service.js.map b/src/app/core/config/config-response-parsing.service.js.map new file mode 100644 index 0000000000..a82659f2aa --- /dev/null +++ b/src/app/core/config/config-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-response-parsing.service.js","sourceRoot":"","sources":["config-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKnD,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAgB,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAIrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE;IAAkD,wDAA0B;IAK1E,sCACmC,SAAuB,EAC9C,WAA+B;QAF3C,YAGI,iBAAO,SACV;QAHkC,eAAS,GAAT,SAAS,CAAc;QAC9C,iBAAW,GAAX,WAAW,CAAoB;QALjC,mBAAa,GAAG,mBAAmB,CAAC;QACpC,aAAO,GAAG,KAAK,CAAC;;IAM1B,CAAC;IAED,4CAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QACpD,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,KAAK,GAAG,IAAI,IAAI,CAAC,UAAU,KAAK,GAAG,CAAC,EAAE;YACvH,IAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAA0B,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;YAC3F,OAAO,IAAI,qBAAqB,CAAC,gBAAgB,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;SAC1H;aAAM;YACL,OAAO,IAAI,aAAa,CACtB,MAAM,CAAC,MAAM,CACX,IAAI,KAAK,CAAC,0CAA0C,CAAC,EACrD,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAC7D,CACF,CAAC;SACH;IACH,CAAC;IAvBU,4BAA4B;QADxC,UAAU,EAAE;QAOR,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACC,kBAAkB;OAPhC,4BAA4B,CAyBxC;IAAD,mCAAC;CAAA,AAzBD,CAAkD,0BAA0B,GAyB3E;SAzBY,4BAA4B"} \ No newline at end of file diff --git a/src/app/core/config/config.service.js b/src/app/core/config/config.service.js new file mode 100644 index 0000000000..02ffddc808 --- /dev/null +++ b/src/app/core/config/config.service.js @@ -0,0 +1,66 @@ +import { merge as observableMerge, throwError as observableThrowError } from 'rxjs'; +import { distinctUntilChanged, filter, map, mergeMap, tap } from 'rxjs/operators'; +import { ConfigRequest } from '../data/request.models'; +import { hasValue, isNotEmpty } from '../../shared/empty.util'; +import { ConfigData } from './config-data'; +import { getResponseFromEntry } from '../shared/operators'; +var ConfigService = /** @class */ (function () { + function ConfigService() { + } + ConfigService.prototype.getConfig = function (request) { + var responses = this.requestService.getByHref(request.href).pipe(getResponseFromEntry()); + var errorResponses = responses.pipe(filter(function (response) { return !response.isSuccessful; }), mergeMap(function () { return observableThrowError(new Error("Couldn't retrieve the config")); })); + var successResponses = responses.pipe(filter(function (response) { return response.isSuccessful && isNotEmpty(response) && isNotEmpty(response.configDefinition); }), map(function (response) { return new ConfigData(response.pageInfo, response.configDefinition); })); + return observableMerge(errorResponses, successResponses); + }; + ConfigService.prototype.getConfigByNameHref = function (endpoint, resourceName) { + return endpoint + "/" + resourceName; + }; + ConfigService.prototype.getConfigSearchHref = function (endpoint, options) { + if (options === void 0) { options = {}; } + var result; + var args = []; + if (hasValue(options.scopeID)) { + result = endpoint + "/" + this.browseEndpoint; + args.push("uuid=" + options.scopeID); + } + else { + result = endpoint; + } + if (hasValue(options.currentPage) && typeof options.currentPage === 'number') { + /* TODO: this is a temporary fix for the pagination start index (0 or 1) discrepancy between the rest and the frontend respectively */ + args.push("page=" + (options.currentPage - 1)); + } + if (hasValue(options.elementsPerPage)) { + args.push("size=" + options.elementsPerPage); + } + if (hasValue(options.sort)) { + args.push("sort=" + options.sort.field + "," + options.sort.direction); + } + if (isNotEmpty(args)) { + result = result + "?" + args.join('&'); + } + return result; + }; + ConfigService.prototype.getConfigAll = function () { + var _this = this; + return this.halService.getEndpoint(this.linkPath).pipe(filter(function (href) { return isNotEmpty(href); }), distinctUntilChanged(), map(function (endpointURL) { return new ConfigRequest(_this.requestService.generateRequestId(), endpointURL); }), tap(function (request) { return _this.requestService.configure(request); }), mergeMap(function (request) { return _this.getConfig(request); }), distinctUntilChanged()); + }; + ConfigService.prototype.getConfigByHref = function (href) { + var request = new ConfigRequest(this.requestService.generateRequestId(), href); + this.requestService.configure(request); + return this.getConfig(request); + }; + ConfigService.prototype.getConfigByName = function (name) { + var _this = this; + return this.halService.getEndpoint(this.linkPath).pipe(map(function (endpoint) { return _this.getConfigByNameHref(endpoint, name); }), filter(function (href) { return isNotEmpty(href); }), distinctUntilChanged(), map(function (endpointURL) { return new ConfigRequest(_this.requestService.generateRequestId(), endpointURL); }), tap(function (request) { return _this.requestService.configure(request); }), mergeMap(function (request) { return _this.getConfig(request); }), distinctUntilChanged()); + }; + ConfigService.prototype.getConfigBySearch = function (options) { + var _this = this; + if (options === void 0) { options = {}; } + return this.halService.getEndpoint(this.linkPath).pipe(map(function (endpoint) { return _this.getConfigSearchHref(endpoint, options); }), filter(function (href) { return isNotEmpty(href); }), distinctUntilChanged(), map(function (endpointURL) { return new ConfigRequest(_this.requestService.generateRequestId(), endpointURL); }), tap(function (request) { return _this.requestService.configure(request); }), mergeMap(function (request) { return _this.getConfig(request); }), distinctUntilChanged()); + }; + return ConfigService; +}()); +export { ConfigService }; +//# sourceMappingURL=config.service.js.map \ No newline at end of file diff --git a/src/app/core/config/config.service.js.map b/src/app/core/config/config.service.js.map new file mode 100644 index 0000000000..128a4a06ee --- /dev/null +++ b/src/app/core/config/config.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.service.js","sourceRoot":"","sources":["config.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,eAAe,EAAc,UAAU,IAAI,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGlF,OAAO,EAAE,aAAa,EAA+B,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D;IAAA;IAgGA,CAAC;IAzFW,iCAAS,GAAnB,UAAoB,OAAoB;QACtC,IAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAChE,oBAAoB,EAAE,CACvB,CAAC;QACF,IAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CACnC,MAAM,CAAC,UAAC,QAAQ,IAAK,OAAA,CAAC,QAAQ,C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B,CAAC,EAC1C,oBAAoB,EAAE,EACtB,GAAG,CAAC,UAAC,WAAmB,IAAK,OAAA,IAAI,aAAa,CAAC,KAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,EAAE,WAAW,CAAC,EAAvE,CAAuE,CAAC,EACrG,GAAG,CAAC,UAAC,OAAoB,IAAK,OAAA,KAAI,CAAC,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,EAAtC,CAAsC,CAAC,EACrE,QAAQ,CAAC,UAAC,OAAoB,IAAK,OAAA,KAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAvB,CAAuB,CAAC,EAC3D,oBAAoB,EAAE,CAAC,CAAC;IAC5B,CAAC;IAEH,oBAAC;AAAD,CAAC,AAhGD,IAgGC"} \ No newline at end of file diff --git a/src/app/core/config/models/config-access-condition-option.model.js b/src/app/core/config/models/config-access-condition-option.model.js new file mode 100644 index 0000000000..4a6fe1756c --- /dev/null +++ b/src/app/core/config/models/config-access-condition-option.model.js @@ -0,0 +1,10 @@ +/** + * Model class for an Access Condition + */ +var AccessConditionOption = /** @class */ (function () { + function AccessConditionOption() { + } + return AccessConditionOption; +}()); +export { AccessConditionOption }; +//# sourceMappingURL=config-access-condition-option.model.js.map \ No newline at end of file diff --git a/src/app/core/config/models/config-access-condition-option.model.js.map b/src/app/core/config/models/config-access-condition-option.model.js.map new file mode 100644 index 0000000000..b5c3787330 --- /dev/null +++ b/src/app/core/config/models/config-access-condition-option.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-access-condition-option.model.js","sourceRoot":"","sources":["config-access-condition-option.model.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;IAAA;IAoCA,CAAC;IAAD,4BAAC;AAAD,CAAC,AApCD,IAoCC"} \ No newline at end of file diff --git a/src/app/core/config/models/config-object-factory.js b/src/app/core/config/models/config-object-factory.js new file mode 100644 index 0000000000..fad43f2e4a --- /dev/null +++ b/src/app/core/config/models/config-object-factory.js @@ -0,0 +1,38 @@ +import { ConfigType } from './config-type'; +import { NormalizedSubmissionDefinitionsModel } from './normalized-config-submission-definitions.model'; +import { NormalizedSubmissionFormsModel } from './normalized-config-submission-forms.model'; +import { NormalizedSubmissionSectionModel } from './normalized-config-submission-section.model'; +import { NormalizedSubmissionUploadsModel } from './normalized-config-submission-uploads.model'; +/** + * Class to return normalized models for config objects + */ +var ConfigObjectFactory = /** @class */ (function () { + function ConfigObjectFactory() { + } + ConfigObjectFactory.getConstructor = function (type) { + switch (type) { + case ConfigType.SubmissionDefinition: + case ConfigType.SubmissionDefinitions: { + return NormalizedSubmissionDefinitionsModel; + } + case ConfigType.SubmissionForm: + case ConfigType.SubmissionForms: { + return NormalizedSubmissionFormsModel; + } + case ConfigType.SubmissionSection: + case ConfigType.SubmissionSections: { + return NormalizedSubmissionSectionModel; + } + case ConfigType.SubmissionUpload: + case ConfigType.SubmissionUploads: { + return NormalizedSubmissionUploadsModel; + } + default: { + return undefined; + } + } + }; + return ConfigObjectFactory; +}()); +export { ConfigObjectFactory }; +//# sourceMappingURL=config-object-factory.js.map \ No newline at end of file diff --git a/src/app/core/config/models/config-object-factory.js.map b/src/app/core/config/models/config-object-factory.js.map new file mode 100644 index 0000000000..70cde0842e --- /dev/null +++ b/src/app/core/config/models/config-object-factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-object-factory.js","sourceRoot":"","sources":["config-object-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,oCAAoC,EAAE,MAAM,kDAAkD,CAAC;AACxG,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAC5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAEhG;;GAEG;AACH;IAAA;IAwBA,CAAC;IAvBe,kCAAc,GAA5B,UAA6B,IAAI;QAC/B,QAAQ,IAAI,EAAE;YACZ,KAAK,UAAU,CAAC,oBAAoB,CAAC;YACrC,KAAK,UAAU,CAAC,qBAAqB,CAAC,CAAC;gBACrC,OAAO,oCAAoC,CAAA;aAC5C;YACD,KAAK,UAAU,CAAC,cAAc,CAAC;YAC/B,KAAK,UAAU,CAAC,eAAe,CAAC,CAAC;gBAC/B,OAAO,8BAA8B,CAAA;aACtC;YACD,KAAK,UAAU,CAAC,iBAAiB,CAAC;YAClC,KAAK,UAAU,CAAC,kBAAkB,CAAC,CAAC;gBAClC,OAAO,gCAAgC,CAAA;aACxC;YACD,KAAK,UAAU,CAAC,gBAAgB,CAAC;YACjC,KAAK,UAAU,CAAC,iBAAiB,CAAC,CAAC;gBACjC,OAAO,gCAAgC,CAAA;aACxC;YACD,OAAO,CAAC,CAAC;gBACP,OAAO,SAAS,CAAC;aAClB;SACF;IACH,CAAC;IACH,0BAAC;AAAD,CAAC,AAxBD,IAwBC"} \ No newline at end of file diff --git a/src/app/core/config/models/config-submission-definitions.model.js b/src/app/core/config/models/config-submission-definitions.model.js new file mode 100644 index 0000000000..dc1311acd1 --- /dev/null +++ b/src/app/core/config/models/config-submission-definitions.model.js @@ -0,0 +1,11 @@ +import * as tslib_1 from "tslib"; +import { ConfigObject } from './config.model'; +var SubmissionDefinitionsModel = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionDefinitionsModel, _super); + function SubmissionDefinitionsModel() { + return _super !== null && _super.apply(this, arguments) || this; + } + return SubmissionDefinitionsModel; +}(ConfigObject)); +export { SubmissionDefinitionsModel }; +//# sourceMappingURL=config-submission-definitions.model.js.map \ No newline at end of file diff --git a/src/app/core/config/models/config-submission-definitions.model.js.map b/src/app/core/config/models/config-submission-definitions.model.js.map new file mode 100644 index 0000000000..671602cf36 --- /dev/null +++ b/src/app/core/config/models/config-submission-definitions.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-submission-definitions.model.js","sourceRoot":"","sources":["config-submission-definitions.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C;IAAgD,sDAAY;IAA5D;;IAYA,CAAC;IAAD,iCAAC;AAAD,CAAC,AAZD,CAAgD,YAAY,GAY3D"} \ No newline at end of file diff --git a/src/app/core/config/models/config-submission-forms.model.js b/src/app/core/config/models/config-submission-forms.model.js new file mode 100644 index 0000000000..3d84c5da0d --- /dev/null +++ b/src/app/core/config/models/config-submission-forms.model.js @@ -0,0 +1,14 @@ +import * as tslib_1 from "tslib"; +import { ConfigObject } from './config.model'; +/** + * A model class for a NormalizedObject. + */ +var SubmissionFormsModel = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionFormsModel, _super); + function SubmissionFormsModel() { + return _super !== null && _super.apply(this, arguments) || this; + } + return SubmissionFormsModel; +}(ConfigObject)); +export { SubmissionFormsModel }; +//# sourceMappingURL=config-submission-forms.model.js.map \ No newline at end of file diff --git a/src/app/core/config/models/config-submission-forms.model.js.map b/src/app/core/config/models/config-submission-forms.model.js.map new file mode 100644 index 0000000000..79f834f2a2 --- /dev/null +++ b/src/app/core/config/models/config-submission-forms.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-submission-forms.model.js","sourceRoot":"","sources":["config-submission-forms.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAU9C;;GAEG;AACH;IAA0C,gDAAY;IAAtD;;IAMA,CAAC;IAAD,2BAAC;AAAD,CAAC,AAND,CAA0C,YAAY,GAMrD"} \ No newline at end of file diff --git a/src/app/core/config/models/config-submission-section.model.js b/src/app/core/config/models/config-submission-section.model.js new file mode 100644 index 0000000000..530070ec4b --- /dev/null +++ b/src/app/core/config/models/config-submission-section.model.js @@ -0,0 +1,11 @@ +import * as tslib_1 from "tslib"; +import { ConfigObject } from './config.model'; +var SubmissionSectionModel = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionSectionModel, _super); + function SubmissionSectionModel() { + return _super !== null && _super.apply(this, arguments) || this; + } + return SubmissionSectionModel; +}(ConfigObject)); +export { SubmissionSectionModel }; +//# sourceMappingURL=config-submission-section.model.js.map \ No newline at end of file diff --git a/src/app/core/config/models/config-submission-section.model.js.map b/src/app/core/config/models/config-submission-section.model.js.map new file mode 100644 index 0000000000..c59af71743 --- /dev/null +++ b/src/app/core/config/models/config-submission-section.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-submission-section.model.js","sourceRoot":"","sources":["config-submission-section.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAW9C;IAA4C,kDAAY;IAAxD;;IAsBA,CAAC;IAAD,6BAAC;AAAD,CAAC,AAtBD,CAA4C,YAAY,GAsBvD"} \ No newline at end of file diff --git a/src/app/core/config/models/config-submission-uploads.model.js b/src/app/core/config/models/config-submission-uploads.model.js new file mode 100644 index 0000000000..e8374e7a7b --- /dev/null +++ b/src/app/core/config/models/config-submission-uploads.model.js @@ -0,0 +1,11 @@ +import * as tslib_1 from "tslib"; +import { ConfigObject } from './config.model'; +var SubmissionUploadsModel = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionUploadsModel, _super); + function SubmissionUploadsModel() { + return _super !== null && _super.apply(this, arguments) || this; + } + return SubmissionUploadsModel; +}(ConfigObject)); +export { SubmissionUploadsModel }; +//# sourceMappingURL=config-submission-uploads.model.js.map \ No newline at end of file diff --git a/src/app/core/config/models/config-submission-uploads.model.js.map b/src/app/core/config/models/config-submission-uploads.model.js.map new file mode 100644 index 0000000000..e5891438cf --- /dev/null +++ b/src/app/core/config/models/config-submission-uploads.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-submission-uploads.model.js","sourceRoot":"","sources":["config-submission-uploads.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C;IAA4C,kDAAY;IAAxD;;IAgBA,CAAC;IAAD,6BAAC;AAAD,CAAC,AAhBD,CAA4C,YAAY,GAgBvD"} \ No newline at end of file diff --git a/src/app/core/config/models/config-type.js b/src/app/core/config/models/config-type.js new file mode 100644 index 0000000000..ccf732c0b6 --- /dev/null +++ b/src/app/core/config/models/config-type.js @@ -0,0 +1,12 @@ +export var ConfigType; +(function (ConfigType) { + ConfigType["SubmissionDefinitions"] = "submissiondefinitions"; + ConfigType["SubmissionDefinition"] = "submissiondefinition"; + ConfigType["SubmissionForm"] = "submissionform"; + ConfigType["SubmissionForms"] = "submissionforms"; + ConfigType["SubmissionSections"] = "submissionsections"; + ConfigType["SubmissionSection"] = "submissionsection"; + ConfigType["SubmissionUploads"] = "submissionuploads"; + ConfigType["SubmissionUpload"] = "submissionupload"; +})(ConfigType || (ConfigType = {})); +//# sourceMappingURL=config-type.js.map \ No newline at end of file diff --git a/src/app/core/config/models/config-type.js.map b/src/app/core/config/models/config-type.js.map new file mode 100644 index 0000000000..9241094c45 --- /dev/null +++ b/src/app/core/config/models/config-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config-type.js","sourceRoot":"","sources":["config-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UASX;AATD,WAAY,UAAU;IACpB,6DAA+C,CAAA;IAC/C,2DAA6C,CAAA;IAC7C,+CAAiC,CAAA;IACjC,iDAAmC,CAAA;IACnC,uDAAyC,CAAA;IACzC,qDAAuC,CAAA;IACvC,qDAAuC,CAAA;IACvC,mDAAqC,CAAA;AACvC,CAAC,EATW,UAAU,KAAV,UAAU,QASrB"} \ No newline at end of file diff --git a/src/app/core/config/models/config.model.js b/src/app/core/config/models/config.model.js new file mode 100644 index 0000000000..12270d31ae --- /dev/null +++ b/src/app/core/config/models/config.model.js @@ -0,0 +1,7 @@ +var ConfigObject = /** @class */ (function () { + function ConfigObject() { + } + return ConfigObject; +}()); +export { ConfigObject }; +//# sourceMappingURL=config.model.js.map \ No newline at end of file diff --git a/src/app/core/config/models/config.model.js.map b/src/app/core/config/models/config.model.js.map new file mode 100644 index 0000000000..5a85c3fa49 --- /dev/null +++ b/src/app/core/config/models/config.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.model.js","sourceRoot":"","sources":["config.model.ts"],"names":[],"mappings":"AAGA;IAAA;IAuBA,CAAC;IAAD,mBAAC;AAAD,CAAC,AAvBD,IAuBC"} \ No newline at end of file diff --git a/src/app/core/config/models/normalized-config-submission-definitions.model.js b/src/app/core/config/models/normalized-config-submission-definitions.model.js new file mode 100644 index 0000000000..7a22f458bb --- /dev/null +++ b/src/app/core/config/models/normalized-config-submission-definitions.model.js @@ -0,0 +1,28 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize'; +import { SubmissionSectionModel } from './config-submission-section.model'; +import { PaginatedList } from '../../data/paginated-list'; +import { NormalizedConfigObject } from './normalized-config.model'; +/** + * Normalized class for the configuration describing the submission + */ +var NormalizedSubmissionDefinitionsModel = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedSubmissionDefinitionsModel, _super); + function NormalizedSubmissionDefinitionsModel() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], NormalizedSubmissionDefinitionsModel.prototype, "isDefault", void 0); + tslib_1.__decorate([ + autoserializeAs(SubmissionSectionModel), + tslib_1.__metadata("design:type", PaginatedList) + ], NormalizedSubmissionDefinitionsModel.prototype, "sections", void 0); + NormalizedSubmissionDefinitionsModel = tslib_1.__decorate([ + inheritSerialization(NormalizedConfigObject) + ], NormalizedSubmissionDefinitionsModel); + return NormalizedSubmissionDefinitionsModel; +}(NormalizedConfigObject)); +export { NormalizedSubmissionDefinitionsModel }; +//# sourceMappingURL=normalized-config-submission-definitions.model.js.map \ No newline at end of file diff --git a/src/app/core/config/models/normalized-config-submission-definitions.model.js.map b/src/app/core/config/models/normalized-config-submission-definitions.model.js.map new file mode 100644 index 0000000000..ec6b90b07a --- /dev/null +++ b/src/app/core/config/models/normalized-config-submission-definitions.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-config-submission-definitions.model.js","sourceRoot":"","sources":["normalized-config-submission-definitions.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGnE;;GAEG;AAEH;IAA0D,gEAAkD;IAA5G;;IAcA,CAAC;IARC;QADC,aAAa;;2EACK;IAMnB;QADC,eAAe,CAAC,sBAAsB,CAAC;0CAC9B,aAAa;0EAAyB;IAZrC,oCAAoC;QADhD,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,oCAAoC,CAchD;IAAD,2CAAC;CAAA,AAdD,CAA0D,sBAAsB,GAc/E;SAdY,oCAAoC"} \ No newline at end of file diff --git a/src/app/core/config/models/normalized-config-submission-forms.model.js b/src/app/core/config/models/normalized-config-submission-forms.model.js new file mode 100644 index 0000000000..3a0aa826f9 --- /dev/null +++ b/src/app/core/config/models/normalized-config-submission-forms.model.js @@ -0,0 +1,22 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, inheritSerialization } from 'cerialize'; +import { NormalizedConfigObject } from './normalized-config.model'; +/** + * Normalized class for the configuration describing the submission form + */ +var NormalizedSubmissionFormsModel = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedSubmissionFormsModel, _super); + function NormalizedSubmissionFormsModel() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Array) + ], NormalizedSubmissionFormsModel.prototype, "rows", void 0); + NormalizedSubmissionFormsModel = tslib_1.__decorate([ + inheritSerialization(NormalizedConfigObject) + ], NormalizedSubmissionFormsModel); + return NormalizedSubmissionFormsModel; +}(NormalizedConfigObject)); +export { NormalizedSubmissionFormsModel }; +//# sourceMappingURL=normalized-config-submission-forms.model.js.map \ No newline at end of file diff --git a/src/app/core/config/models/normalized-config-submission-forms.model.js.map b/src/app/core/config/models/normalized-config-submission-forms.model.js.map new file mode 100644 index 0000000000..c62b1e504f --- /dev/null +++ b/src/app/core/config/models/normalized-config-submission-forms.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-config-submission-forms.model.js","sourceRoot":"","sources":["normalized-config-submission-forms.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGnE;;GAEG;AAEH;IAAoD,0DAA4C;IAAhG;;IAOA,CAAC;IADC;QADC,aAAa;;gEACO;IANV,8BAA8B;QAD1C,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,8BAA8B,CAO1C;IAAD,qCAAC;CAAA,AAPD,CAAoD,sBAAsB,GAOzE;SAPY,8BAA8B"} \ No newline at end of file diff --git a/src/app/core/config/models/normalized-config-submission-section.model.js b/src/app/core/config/models/normalized-config-submission-section.model.js new file mode 100644 index 0000000000..99943022ea --- /dev/null +++ b/src/app/core/config/models/normalized-config-submission-section.model.js @@ -0,0 +1,35 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, inheritSerialization } from 'cerialize'; +import { SectionsType } from '../../../submission/sections/sections-type'; +import { NormalizedConfigObject } from './normalized-config.model'; +/** + * Normalized class for the configuration describing the submission section + */ +var NormalizedSubmissionSectionModel = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedSubmissionSectionModel, _super); + function NormalizedSubmissionSectionModel() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedSubmissionSectionModel.prototype, "header", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], NormalizedSubmissionSectionModel.prototype, "mandatory", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedSubmissionSectionModel.prototype, "sectionType", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Object) + ], NormalizedSubmissionSectionModel.prototype, "visibility", void 0); + NormalizedSubmissionSectionModel = tslib_1.__decorate([ + inheritSerialization(NormalizedConfigObject) + ], NormalizedSubmissionSectionModel); + return NormalizedSubmissionSectionModel; +}(NormalizedConfigObject)); +export { NormalizedSubmissionSectionModel }; +//# sourceMappingURL=normalized-config-submission-section.model.js.map \ No newline at end of file diff --git a/src/app/core/config/models/normalized-config-submission-section.model.js.map b/src/app/core/config/models/normalized-config-submission-section.model.js.map new file mode 100644 index 0000000000..d9a83b70c9 --- /dev/null +++ b/src/app/core/config/models/normalized-config-submission-section.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-config-submission-section.model.js","sourceRoot":"","sources":["normalized-config-submission-section.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAInE;;GAEG;AAEH;IAAsD,4DAA4C;IAAlG;;IA0BA,CAAC;IApBC;QADC,aAAa;;oEACC;IAMf;QADC,aAAa;;uEACK;IAMnB;QADC,aAAa;;yEACY;IAM1B;QADC,aAAa;;wEACyB;IAxB5B,gCAAgC;QAD5C,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,gCAAgC,CA0B5C;IAAD,uCAAC;CAAA,AA1BD,CAAsD,sBAAsB,GA0B3E;SA1BY,gCAAgC"} \ No newline at end of file diff --git a/src/app/core/config/models/normalized-config-submission-uploads.model.js b/src/app/core/config/models/normalized-config-submission-uploads.model.js new file mode 100644 index 0000000000..a2e0038032 --- /dev/null +++ b/src/app/core/config/models/normalized-config-submission-uploads.model.js @@ -0,0 +1,35 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize'; +import { SubmissionFormsModel } from './config-submission-forms.model'; +import { NormalizedConfigObject } from './normalized-config.model'; +/** + * Normalized class for the configuration describing the submission upload section + */ +var NormalizedSubmissionUploadsModel = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedSubmissionUploadsModel, _super); + function NormalizedSubmissionUploadsModel() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Array) + ], NormalizedSubmissionUploadsModel.prototype, "accessConditionOptions", void 0); + tslib_1.__decorate([ + autoserializeAs(SubmissionFormsModel), + tslib_1.__metadata("design:type", SubmissionFormsModel) + ], NormalizedSubmissionUploadsModel.prototype, "metadata", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], NormalizedSubmissionUploadsModel.prototype, "required", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], NormalizedSubmissionUploadsModel.prototype, "maxSize", void 0); + NormalizedSubmissionUploadsModel = tslib_1.__decorate([ + inheritSerialization(NormalizedConfigObject) + ], NormalizedSubmissionUploadsModel); + return NormalizedSubmissionUploadsModel; +}(NormalizedConfigObject)); +export { NormalizedSubmissionUploadsModel }; +//# sourceMappingURL=normalized-config-submission-uploads.model.js.map \ No newline at end of file diff --git a/src/app/core/config/models/normalized-config-submission-uploads.model.js.map b/src/app/core/config/models/normalized-config-submission-uploads.model.js.map new file mode 100644 index 0000000000..1c4e983b2e --- /dev/null +++ b/src/app/core/config/models/normalized-config-submission-uploads.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-config-submission-uploads.model.js","sourceRoot":"","sources":["normalized-config-submission-uploads.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGnE;;GAEG;AAEH;IAAsD,4DAA8C;IAApG;;IAoBA,CAAC;IAdC;QADC,aAAa;;oFACkC;IAMhD;QADC,eAAe,CAAC,oBAAoB,CAAC;0CAC5B,oBAAoB;sEAAC;IAG/B;QADC,aAAa;;sEACI;IAGlB;QADC,aAAa;;qEACE;IAlBL,gCAAgC;QAD5C,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,gCAAgC,CAoB5C;IAAD,uCAAC;CAAA,AApBD,CAAsD,sBAAsB,GAoB3E;SApBY,gCAAgC"} \ No newline at end of file diff --git a/src/app/core/config/models/normalized-config.model.js b/src/app/core/config/models/normalized-config.model.js new file mode 100644 index 0000000000..5408166cee --- /dev/null +++ b/src/app/core/config/models/normalized-config.model.js @@ -0,0 +1,33 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, inheritSerialization } from 'cerialize'; +import { NormalizedObject } from '../../cache/models/normalized-object.model'; +import { ResourceType } from '../../shared/resource-type'; +/** + * Normalized abstract class for a configuration object + */ +var NormalizedConfigObject = /** @class */ (function () { + function NormalizedConfigObject() { + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedConfigObject.prototype, "name", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedConfigObject.prototype, "type", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Object) + ], NormalizedConfigObject.prototype, "_links", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedConfigObject.prototype, "self", void 0); + NormalizedConfigObject = tslib_1.__decorate([ + inheritSerialization(NormalizedObject) + ], NormalizedConfigObject); + return NormalizedConfigObject; +}()); +export { NormalizedConfigObject }; +//# sourceMappingURL=normalized-config.model.js.map \ No newline at end of file diff --git a/src/app/core/config/models/normalized-config.model.js.map b/src/app/core/config/models/normalized-config.model.js.map new file mode 100644 index 0000000000..6f9c56f42d --- /dev/null +++ b/src/app/core/config/models/normalized-config.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-config.model.js","sourceRoot":"","sources":["normalized-config.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AAEH;IAAA;IA4BA,CAAC;IAtBC;QADC,aAAa;;wDACM;IAMpB;QADC,aAAa;;wDACY;IAM1B;QADC,aAAa;;0DAGZ;IAMF;QADC,aAAa;;wDACD;IA1BO,sBAAsB;QAD3C,oBAAoB,CAAC,gBAAgB,CAAC;OACjB,sBAAsB,CA4B3C;IAAD,6BAAC;CAAA,AA5BD,IA4BC;SA5BqB,sBAAsB"} \ No newline at end of file diff --git a/src/app/core/config/submission-definitions-config.service.js b/src/app/core/config/submission-definitions-config.service.js new file mode 100644 index 0000000000..6d0bfe9ad4 --- /dev/null +++ b/src/app/core/config/submission-definitions-config.service.js @@ -0,0 +1,24 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { ConfigService } from './config.service'; +import { RequestService } from '../data/request.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +var SubmissionDefinitionsConfigService = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionDefinitionsConfigService, _super); + function SubmissionDefinitionsConfigService(requestService, halService) { + var _this = _super.call(this) || this; + _this.requestService = requestService; + _this.halService = halService; + _this.linkPath = 'submissiondefinitions'; + _this.browseEndpoint = 'search/findByCollection'; + return _this; + } + SubmissionDefinitionsConfigService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + HALEndpointService]) + ], SubmissionDefinitionsConfigService); + return SubmissionDefinitionsConfigService; +}(ConfigService)); +export { SubmissionDefinitionsConfigService }; +//# sourceMappingURL=submission-definitions-config.service.js.map \ No newline at end of file diff --git a/src/app/core/config/submission-definitions-config.service.js.map b/src/app/core/config/submission-definitions-config.service.js.map new file mode 100644 index 0000000000..d347e993a6 --- /dev/null +++ b/src/app/core/config/submission-definitions-config.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-definitions-config.service.js","sourceRoot":"","sources":["submission-definitions-config.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE;IAAwD,8DAAa;IAInE,4CACY,cAA8B,EAC9B,UAA8B;QAF1C,YAGE,iBAAO,SACR;QAHW,oBAAc,GAAd,cAAc,CAAgB;QAC9B,gBAAU,GAAV,UAAU,CAAoB;QALhC,cAAQ,GAAG,uBAAuB,CAAC;QACnC,oBAAc,GAAG,yBAAyB,CAAC;;IAMrD,CAAC;IARU,kCAAkC;QAD9C,UAAU,EAAE;iDAMiB,cAAc;YAClB,kBAAkB;OAN/B,kCAAkC,CAU9C;IAAD,yCAAC;CAAA,AAVD,CAAwD,aAAa,GAUpE;SAVY,kCAAkC"} \ No newline at end of file diff --git a/src/app/core/config/submission-forms-config.service.js b/src/app/core/config/submission-forms-config.service.js new file mode 100644 index 0000000000..135b81bbaf --- /dev/null +++ b/src/app/core/config/submission-forms-config.service.js @@ -0,0 +1,24 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { ConfigService } from './config.service'; +import { RequestService } from '../data/request.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +var SubmissionFormsConfigService = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionFormsConfigService, _super); + function SubmissionFormsConfigService(requestService, halService) { + var _this = _super.call(this) || this; + _this.requestService = requestService; + _this.halService = halService; + _this.linkPath = 'submissionforms'; + _this.browseEndpoint = ''; + return _this; + } + SubmissionFormsConfigService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + HALEndpointService]) + ], SubmissionFormsConfigService); + return SubmissionFormsConfigService; +}(ConfigService)); +export { SubmissionFormsConfigService }; +//# sourceMappingURL=submission-forms-config.service.js.map \ No newline at end of file diff --git a/src/app/core/config/submission-forms-config.service.js.map b/src/app/core/config/submission-forms-config.service.js.map new file mode 100644 index 0000000000..bbb5e90514 --- /dev/null +++ b/src/app/core/config/submission-forms-config.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-forms-config.service.js","sourceRoot":"","sources":["submission-forms-config.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE;IAAkD,wDAAa;IAI7D,sCACY,cAA8B,EAC9B,UAA8B;QAF1C,YAGE,iBAAO,SACR;QAHW,oBAAc,GAAd,cAAc,CAAgB;QAC9B,gBAAU,GAAV,UAAU,CAAoB;QALhC,cAAQ,GAAG,iBAAiB,CAAC;QAC7B,oBAAc,GAAG,EAAE,CAAC;;IAM9B,CAAC;IARU,4BAA4B;QADxC,UAAU,EAAE;iDAMiB,cAAc;YAClB,kBAAkB;OAN/B,4BAA4B,CAUxC;IAAD,mCAAC;CAAA,AAVD,CAAkD,aAAa,GAU9D;SAVY,4BAA4B"} \ No newline at end of file diff --git a/src/app/core/config/submission-sections-config.service.js b/src/app/core/config/submission-sections-config.service.js new file mode 100644 index 0000000000..d9bee464bd --- /dev/null +++ b/src/app/core/config/submission-sections-config.service.js @@ -0,0 +1,24 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { ConfigService } from './config.service'; +import { RequestService } from '../data/request.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +var SubmissionSectionsConfigService = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionSectionsConfigService, _super); + function SubmissionSectionsConfigService(requestService, halService) { + var _this = _super.call(this) || this; + _this.requestService = requestService; + _this.halService = halService; + _this.linkPath = 'submissionsections'; + _this.browseEndpoint = ''; + return _this; + } + SubmissionSectionsConfigService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + HALEndpointService]) + ], SubmissionSectionsConfigService); + return SubmissionSectionsConfigService; +}(ConfigService)); +export { SubmissionSectionsConfigService }; +//# sourceMappingURL=submission-sections-config.service.js.map \ No newline at end of file diff --git a/src/app/core/config/submission-sections-config.service.js.map b/src/app/core/config/submission-sections-config.service.js.map new file mode 100644 index 0000000000..866ffe207d --- /dev/null +++ b/src/app/core/config/submission-sections-config.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-sections-config.service.js","sourceRoot":"","sources":["submission-sections-config.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE;IAAqD,2DAAa;IAIhE,yCACY,cAA8B,EAC9B,UAA8B;QAF1C,YAGE,iBAAO,SACR;QAHW,oBAAc,GAAd,cAAc,CAAgB;QAC9B,gBAAU,GAAV,UAAU,CAAoB;QALhC,cAAQ,GAAG,oBAAoB,CAAC;QAChC,oBAAc,GAAG,EAAE,CAAC;;IAM9B,CAAC;IARU,+BAA+B;QAD3C,UAAU,EAAE;iDAMiB,cAAc;YAClB,kBAAkB;OAN/B,+BAA+B,CAU3C;IAAD,sCAAC;CAAA,AAVD,CAAqD,aAAa,GAUjE;SAVY,+BAA+B"} \ No newline at end of file diff --git a/src/app/core/config/submission-uploads-config.service.js b/src/app/core/config/submission-uploads-config.service.js new file mode 100644 index 0000000000..a49ec3b0b1 --- /dev/null +++ b/src/app/core/config/submission-uploads-config.service.js @@ -0,0 +1,30 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { ConfigService } from './config.service'; +import { RequestService } from '../data/request.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +/** + * Provides methods to retrieve, from REST server, bitstream access conditions configurations applicable during the submission process. + */ +var SubmissionUploadsConfigService = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionUploadsConfigService, _super); + function SubmissionUploadsConfigService(objectCache, requestService, halService) { + var _this = _super.call(this) || this; + _this.objectCache = objectCache; + _this.requestService = requestService; + _this.halService = halService; + _this.linkPath = 'submissionuploads'; + _this.browseEndpoint = ''; + return _this; + } + SubmissionUploadsConfigService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [ObjectCacheService, + RequestService, + HALEndpointService]) + ], SubmissionUploadsConfigService); + return SubmissionUploadsConfigService; +}(ConfigService)); +export { SubmissionUploadsConfigService }; +//# sourceMappingURL=submission-uploads-config.service.js.map \ No newline at end of file diff --git a/src/app/core/config/submission-uploads-config.service.js.map b/src/app/core/config/submission-uploads-config.service.js.map new file mode 100644 index 0000000000..3941f0f0a6 --- /dev/null +++ b/src/app/core/config/submission-uploads-config.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-uploads-config.service.js","sourceRoot":"","sources":["submission-uploads-config.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;GAEG;AAEH;IAAoD,0DAAa;IAI/D,wCACY,WAA+B,EAC/B,cAA8B,EAC9B,UAA8B;QAH1C,YAIE,iBAAO,SACR;QAJW,iBAAW,GAAX,WAAW,CAAoB;QAC/B,oBAAc,GAAd,cAAc,CAAgB;QAC9B,gBAAU,GAAV,UAAU,CAAoB;QANhC,cAAQ,GAAG,mBAAmB,CAAC;QAC/B,oBAAc,GAAG,EAAE,CAAC;;IAO9B,CAAC;IATU,8BAA8B;QAD1C,UAAU,EAAE;iDAMc,kBAAkB;YACf,cAAc;YAClB,kBAAkB;OAP/B,8BAA8B,CAU1C;IAAD,qCAAC;CAAA,AAVD,CAAoD,aAAa,GAUhE;SAVY,8BAA8B"} \ No newline at end of file diff --git a/src/app/core/core.effects.js b/src/app/core/core.effects.js new file mode 100644 index 0000000000..81dbd0ccf7 --- /dev/null +++ b/src/app/core/core.effects.js @@ -0,0 +1,17 @@ +import { ObjectCacheEffects } from './cache/object-cache.effects'; +import { UUIDIndexEffects } from './index/index.effects'; +import { RequestEffects } from './data/request.effects'; +import { AuthEffects } from './auth/auth.effects'; +import { JsonPatchOperationsEffects } from './json-patch/json-patch-operations.effects'; +import { ServerSyncBufferEffects } from './cache/server-sync-buffer.effects'; +import { ObjectUpdatesEffects } from './data/object-updates/object-updates.effects'; +export var coreEffects = [ + RequestEffects, + ObjectCacheEffects, + UUIDIndexEffects, + AuthEffects, + JsonPatchOperationsEffects, + ServerSyncBufferEffects, + ObjectUpdatesEffects +]; +//# sourceMappingURL=core.effects.js.map \ No newline at end of file diff --git a/src/app/core/core.effects.js.map b/src/app/core/core.effects.js.map new file mode 100644 index 0000000000..6ebe90be2d --- /dev/null +++ b/src/app/core/core.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"core.effects.js","sourceRoot":"","sources":["core.effects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAEpF,MAAM,CAAC,IAAM,WAAW,GAAG;IACzB,cAAc;IACd,kBAAkB;IAClB,gBAAgB;IAChB,WAAW;IACX,0BAA0B;IAC1B,uBAAuB;IACvB,oBAAoB;CACrB,CAAC"} \ No newline at end of file diff --git a/src/app/core/core.module.js b/src/app/core/core.module.js new file mode 100644 index 0000000000..d3195f2227 --- /dev/null +++ b/src/app/core/core.module.js @@ -0,0 +1,199 @@ +import * as tslib_1 from "tslib"; +import { NgModule, Optional, SkipSelf } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { StoreModule } from '@ngrx/store'; +import { EffectsModule } from '@ngrx/effects'; +import { DynamicFormLayoutService, DynamicFormService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; +import { coreEffects } from './core.effects'; +import { coreReducers } from './core.reducers'; +import { isNotEmpty } from '../shared/empty.util'; +import { ApiService } from '../shared/services/api.service'; +import { BrowseEntriesResponseParsingService } from './data/browse-entries-response-parsing.service'; +import { CollectionDataService } from './data/collection-data.service'; +import { CommunityDataService } from './data/community-data.service'; +import { DebugResponseParsingService } from './data/debug-response-parsing.service'; +import { DSOResponseParsingService } from './data/dso-response-parsing.service'; +import { SearchResponseParsingService } from './data/search-response-parsing.service'; +import { DSpaceRESTv2Service } from './dspace-rest-v2/dspace-rest-v2.service'; +import { FormBuilderService } from '../shared/form/builder/form-builder.service'; +import { SectionFormOperationsService } from '../submission/sections/form/section-form-operations.service'; +import { FormService } from '../shared/form/form.service'; +import { GroupEpersonService } from './eperson/group-eperson.service'; +import { HostWindowService } from '../shared/host-window.service'; +import { ItemDataService } from './data/item-data.service'; +import { MetadataService } from './metadata/metadata.service'; +import { ObjectCacheService } from './cache/object-cache.service'; +import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model'; +import { RemoteDataBuildService } from './cache/builders/remote-data-build.service'; +import { RequestService } from './data/request.service'; +import { EndpointMapResponseParsingService } from './data/endpoint-map-response-parsing.service'; +import { ServerResponseService } from '../shared/services/server-response.service'; +import { NativeWindowFactory, NativeWindowService } from '../shared/services/window.service'; +import { BrowseService } from './browse/browse.service'; +import { BrowseResponseParsingService } from './data/browse-response-parsing.service'; +import { ConfigResponseParsingService } from './config/config-response-parsing.service'; +import { RouteService } from '../shared/services/route.service'; +import { SubmissionDefinitionsConfigService } from './config/submission-definitions-config.service'; +import { SubmissionFormsConfigService } from './config/submission-forms-config.service'; +import { SubmissionSectionsConfigService } from './config/submission-sections-config.service'; +import { SubmissionResponseParsingService } from './submission/submission-response-parsing.service'; +import { EpersonResponseParsingService } from './eperson/eperson-response-parsing.service'; +import { JsonPatchOperationsBuilder } from './json-patch/builder/json-patch-operations-builder'; +import { AuthorityService } from './integration/authority.service'; +import { IntegrationResponseParsingService } from './integration/integration-response-parsing.service'; +import { WorkspaceitemDataService } from './submission/workspaceitem-data.service'; +import { UUIDService } from './shared/uuid.service'; +import { AuthenticatedGuard } from './auth/authenticated.guard'; +import { AuthRequestService } from './auth/auth-request.service'; +import { AuthResponseParsingService } from './auth/auth-response-parsing.service'; +import { HTTP_INTERCEPTORS } from '@angular/common/http'; +import { AuthInterceptor } from './auth/auth.interceptor'; +import { HALEndpointService } from './shared/hal-endpoint.service'; +import { FacetValueResponseParsingService } from './data/facet-value-response-parsing.service'; +import { FacetValueMapResponseParsingService } from './data/facet-value-map-response-parsing.service'; +import { FacetConfigResponseParsingService } from './data/facet-config-response-parsing.service'; +import { RegistryService } from './registry/registry.service'; +import { RegistryMetadataschemasResponseParsingService } from './data/registry-metadataschemas-response-parsing.service'; +import { RegistryMetadatafieldsResponseParsingService } from './data/registry-metadatafields-response-parsing.service'; +import { RegistryBitstreamformatsResponseParsingService } from './data/registry-bitstreamformats-response-parsing.service'; +import { WorkflowitemDataService } from './submission/workflowitem-data.service'; +import { NotificationsService } from '../shared/notifications/notifications.service'; +import { UploaderService } from '../shared/uploader/uploader.service'; +import { FileService } from './shared/file.service'; +import { SubmissionRestService } from './submission/submission-rest.service'; +import { BrowseItemsResponseParsingService } from './data/browse-items-response-parsing-service'; +import { DSpaceObjectDataService } from './data/dspace-object-data.service'; +import { MetadataschemaParsingService } from './data/metadataschema-parsing.service'; +import { FilteredDiscoveryPageResponseParsingService } from './data/filtered-discovery-page-response-parsing.service'; +import { CSSVariableService } from '../shared/sass-helper/sass-helper.service'; +import { MenuService } from '../shared/menu/menu.service'; +import { SubmissionJsonPatchOperationsService } from './submission/submission-json-patch-operations.service'; +import { NormalizedObjectBuildService } from './cache/builders/normalized-object-build.service'; +import { DSOChangeAnalyzer } from './data/dso-change-analyzer.service'; +import { ObjectUpdatesService } from './data/object-updates/object-updates.service'; +import { DefaultChangeAnalyzer } from './data/default-change-analyzer.service'; +import { SearchService } from '../+search-page/search-service/search.service'; +import { RoleService } from './roles/role.service'; +import { MyDSpaceGuard } from '../+my-dspace-page/my-dspace.guard'; +import { MyDSpaceResponseParsingService } from './data/mydspace-response-parsing.service'; +import { ClaimedTaskDataService } from './tasks/claimed-task-data.service'; +import { PoolTaskDataService } from './tasks/pool-task-data.service'; +import { TaskResponseParsingService } from './tasks/task-response-parsing.service'; +var IMPORTS = [ + CommonModule, + StoreModule.forFeature('core', coreReducers, {}), + EffectsModule.forFeature(coreEffects) +]; +var DECLARATIONS = []; +var EXPORTS = []; +var PROVIDERS = [ + ApiService, + AuthenticatedGuard, + AuthRequestService, + AuthResponseParsingService, + CommunityDataService, + CollectionDataService, + DSOResponseParsingService, + DSpaceRESTv2Service, + DynamicFormLayoutService, + DynamicFormService, + DynamicFormValidationService, + FormBuilderService, + SectionFormOperationsService, + FormService, + EpersonResponseParsingService, + GroupEpersonService, + HALEndpointService, + HostWindowService, + ItemDataService, + MetadataService, + ObjectCacheService, + PaginationComponentOptions, + RegistryService, + NormalizedObjectBuildService, + RemoteDataBuildService, + RequestService, + EndpointMapResponseParsingService, + FacetValueResponseParsingService, + FacetValueMapResponseParsingService, + FacetConfigResponseParsingService, + RegistryMetadataschemasResponseParsingService, + RegistryMetadatafieldsResponseParsingService, + RegistryBitstreamformatsResponseParsingService, + DebugResponseParsingService, + SearchResponseParsingService, + MyDSpaceResponseParsingService, + ServerResponseService, + BrowseResponseParsingService, + BrowseEntriesResponseParsingService, + BrowseItemsResponseParsingService, + BrowseService, + ConfigResponseParsingService, + RouteService, + SubmissionDefinitionsConfigService, + SubmissionFormsConfigService, + SubmissionRestService, + SubmissionSectionsConfigService, + SubmissionResponseParsingService, + SubmissionJsonPatchOperationsService, + JsonPatchOperationsBuilder, + AuthorityService, + IntegrationResponseParsingService, + MetadataschemaParsingService, + UploaderService, + UUIDService, + NotificationsService, + WorkspaceitemDataService, + WorkflowitemDataService, + UploaderService, + FileService, + DSpaceObjectDataService, + DSOChangeAnalyzer, + DefaultChangeAnalyzer, + CSSVariableService, + MenuService, + ObjectUpdatesService, + SearchService, + MyDSpaceGuard, + RoleService, + TaskResponseParsingService, + ClaimedTaskDataService, + PoolTaskDataService, + // register AuthInterceptor as HttpInterceptor + { + provide: HTTP_INTERCEPTORS, + useClass: AuthInterceptor, + multi: true + }, + NotificationsService, + FilteredDiscoveryPageResponseParsingService, + { provide: NativeWindowService, useFactory: NativeWindowFactory } +]; +var CoreModule = /** @class */ (function () { + function CoreModule(parentModule) { + if (isNotEmpty(parentModule)) { + throw new Error('CoreModule is already loaded. Import it in the AppModule only'); + } + } + CoreModule_1 = CoreModule; + CoreModule.forRoot = function () { + return { + ngModule: CoreModule_1, + providers: PROVIDERS.slice() + }; + }; + var CoreModule_1; + CoreModule = CoreModule_1 = tslib_1.__decorate([ + NgModule({ + imports: IMPORTS.slice(), + declarations: DECLARATIONS.slice(), + exports: EXPORTS.slice(), + providers: PROVIDERS.slice() + }), + tslib_1.__param(0, Optional()), tslib_1.__param(0, SkipSelf()), + tslib_1.__metadata("design:paramtypes", [CoreModule]) + ], CoreModule); + return CoreModule; +}()); +export { CoreModule }; +//# sourceMappingURL=core.module.js.map \ No newline at end of file diff --git a/src/app/core/core.module.js.map b/src/app/core/core.module.js.map new file mode 100644 index 0000000000..59ed28e593 --- /dev/null +++ b/src/app/core/core.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"core.module.js","sourceRoot":"","sources":["core.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEpH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,mCAAmC,EAAE,MAAM,gDAAgD,CAAC;AACrG,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,yBAAyB,EAAE,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EAAE,mBAAmB,EAAE,UAAU,EAAE,mBAAmB,EAAE;CAClE,CAAC;AAgBF;IAWE,oBAAqC,YAAwB;QAC3D,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;SAClF;IACH,CAAC;mBAfU,UAAU;IAEd,kBAAO,GAAd;QACE,OAAO;YACL,QAAQ,EAAE,YAAU;YACpB,SAAS,EACJ,SAAS,QACb;SACF,CAAC;IACJ,CAAC;;IATU,UAAU;QAdtB,QAAQ,CAAC;YACR,OAAO,EACF,OAAO,QACX;YACD,YAAY,EACP,YAAY,QAChB;YACD,OAAO,EACF,OAAO,QACX;YACD,SAAS,EACJ,SAAS,QACb;SACF,CAAC;QAYc,mBAAA,QAAQ,EAAE,CAAA,EAAE,mBAAA,QAAQ,EAAE,CAAA;iDAAe,UAAU;OAXlD,UAAU,CAiBtB;IAAD,iBAAC;CAAA,AAjBD,IAiBC;SAjBY,UAAU"} \ No newline at end of file diff --git a/src/app/core/core.reducers.js b/src/app/core/core.reducers.js new file mode 100644 index 0000000000..24e519d187 --- /dev/null +++ b/src/app/core/core.reducers.js @@ -0,0 +1,17 @@ +import { objectCacheReducer } from './cache/object-cache.reducer'; +import { indexReducer } from './index/index.reducer'; +import { requestReducer } from './data/request.reducer'; +import { authReducer } from './auth/auth.reducer'; +import { jsonPatchOperationsReducer } from './json-patch/json-patch-operations.reducer'; +import { serverSyncBufferReducer } from './cache/server-sync-buffer.reducer'; +import { objectUpdatesReducer } from './data/object-updates/object-updates.reducer'; +export var coreReducers = { + 'cache/object': objectCacheReducer, + 'cache/syncbuffer': serverSyncBufferReducer, + 'cache/object-updates': objectUpdatesReducer, + 'data/request': requestReducer, + 'index': indexReducer, + 'auth': authReducer, + 'json/patch': jsonPatchOperationsReducer +}; +//# sourceMappingURL=core.reducers.js.map \ No newline at end of file diff --git a/src/app/core/core.reducers.js.map b/src/app/core/core.reducers.js.map new file mode 100644 index 0000000000..6273ef10cf --- /dev/null +++ b/src/app/core/core.reducers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"core.reducers.js","sourceRoot":"","sources":["core.reducers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAoB,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,YAAY,EAAkB,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAgB,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAa,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAA4B,MAAM,4CAA4C,CAAC;AAClH,OAAO,EAAE,uBAAuB,EAAyB,MAAM,oCAAoC,CAAC;AACpG,OAAO,EACL,oBAAoB,EAErB,MAAM,8CAA8C,CAAC;AAYtD,MAAM,CAAC,IAAM,YAAY,GAAgC;IACvD,cAAc,EAAE,kBAAkB;IAClC,kBAAkB,EAAE,uBAAuB;IAC3C,sBAAsB,EAAE,oBAAoB;IAC5C,cAAc,EAAE,cAAc;IAC9B,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;IACnB,YAAY,EAAE,0BAA0B;CACzC,CAAC"} \ No newline at end of file diff --git a/src/app/core/core.selectors.js b/src/app/core/core.selectors.js new file mode 100644 index 0000000000..0b353809f1 --- /dev/null +++ b/src/app/core/core.selectors.js @@ -0,0 +1,6 @@ +import { createFeatureSelector } from '@ngrx/store'; +/** + * Base selector to select the core state from the store + */ +export var coreSelector = createFeatureSelector('core'); +//# sourceMappingURL=core.selectors.js.map \ No newline at end of file diff --git a/src/app/core/core.selectors.js.map b/src/app/core/core.selectors.js.map new file mode 100644 index 0000000000..02219596b2 --- /dev/null +++ b/src/app/core/core.selectors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"core.selectors.js","sourceRoot":"","sources":["core.selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGpD;;GAEG;AACH,MAAM,CAAC,IAAM,YAAY,GAAG,qBAAqB,CAAY,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/core/data/base-response-parsing.service.js b/src/app/core/data/base-response-parsing.service.js new file mode 100644 index 0000000000..891c23b418 --- /dev/null +++ b/src/app/core/data/base-response-parsing.service.js @@ -0,0 +1,138 @@ +import { hasNoValue, hasValue, isNotEmpty } from '../../shared/empty.util'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { PageInfo } from '../shared/page-info.model'; +import { PaginatedList } from './paginated-list'; +import { isRestDataObject, isRestPaginatedList } from '../cache/builders/normalized-object-build.service'; +/* tslint:disable:max-classes-per-file */ +var BaseResponseParsingService = /** @class */ (function () { + function BaseResponseParsingService() { + } + BaseResponseParsingService.prototype.process = function (data, requestUUID) { + var _this = this; + if (isNotEmpty(data)) { + if (hasNoValue(data) || (typeof data !== 'object')) { + return data; + } + else if (isRestPaginatedList(data)) { + return this.processPaginatedList(data, requestUUID); + } + else if (Array.isArray(data)) { + return this.processArray(data, requestUUID); + } + else if (isRestDataObject(data)) { + var object_1 = this.deserialize(data); + if (isNotEmpty(data._embedded)) { + Object + .keys(data._embedded) + .filter(function (property) { return data._embedded.hasOwnProperty(property); }) + .forEach(function (property) { + var parsedObj = _this.process(data._embedded[property], requestUUID); + if (isNotEmpty(parsedObj)) { + if (isRestPaginatedList(data._embedded[property])) { + object_1[property] = parsedObj; + object_1[property].page = parsedObj.page.map(function (obj) { return _this.retrieveObjectOrUrl(obj); }); + } + else if (isRestDataObject(data._embedded[property])) { + object_1[property] = _this.retrieveObjectOrUrl(parsedObj); + } + else if (Array.isArray(parsedObj)) { + object_1[property] = parsedObj.map(function (obj) { return _this.retrieveObjectOrUrl(obj); }); + } + } + }); + } + this.cache(object_1, requestUUID); + return object_1; + } + var result_1 = {}; + Object.keys(data) + .filter(function (property) { return data.hasOwnProperty(property); }) + .filter(function (property) { return hasValue(data[property]); }) + .forEach(function (property) { + result_1[property] = _this.process(data[property], requestUUID); + }); + return result_1; + } + }; + BaseResponseParsingService.prototype.processPaginatedList = function (data, requestUUID) { + var pageInfo = this.processPageInfo(data); + var list = data._embedded; + // Workaround for inconsistency in rest response. Issue: https://github.com/DSpace/dspace-angular/issues/238 + if (hasNoValue(list)) { + list = []; + } + else if (!Array.isArray(list)) { + list = this.flattenSingleKeyObject(list); + } + var page = this.processArray(list, requestUUID); + return new PaginatedList(pageInfo, page); + }; + BaseResponseParsingService.prototype.processArray = function (data, requestUUID) { + var _this = this; + var array = []; + data.forEach(function (datum) { + array = array.concat([_this.process(datum, requestUUID)]); + }); + return array; + }; + BaseResponseParsingService.prototype.deserialize = function (obj) { + var type = obj.type; + if (hasValue(type)) { + var normObjConstructor = this.objectFactory.getConstructor(type); + if (hasValue(normObjConstructor)) { + var serializer = new DSpaceRESTv2Serializer(normObjConstructor); + return serializer.deserialize(obj); + } + else { + // TODO: move check to Validator? + // throw new Error(`The server returned an object with an unknown a known type: ${type}`); + return null; + } + } + else { + // TODO: move check to Validator + // throw new Error(`The server returned an object without a type: ${JSON.stringify(obj)}`); + return null; + } + }; + BaseResponseParsingService.prototype.cache = function (obj, requestUUID) { + if (this.toCache) { + this.addToObjectCache(obj, requestUUID); + } + }; + BaseResponseParsingService.prototype.addToObjectCache = function (co, requestUUID) { + if (hasNoValue(co) || hasNoValue(co.self)) { + throw new Error('The server returned an invalid object'); + } + this.objectCache.add(co, this.EnvConfig.cache.msToLive.default, requestUUID); + }; + BaseResponseParsingService.prototype.processPageInfo = function (payload) { + if (hasValue(payload.page)) { + var pageObj = Object.assign({}, payload.page, { _links: payload._links }); + var pageInfoObject = new DSpaceRESTv2Serializer(PageInfo).deserialize(pageObj); + if (pageInfoObject.currentPage >= 0) { + Object.assign(pageInfoObject, { currentPage: pageInfoObject.currentPage + 1 }); + } + return pageInfoObject; + } + else { + return undefined; + } + }; + BaseResponseParsingService.prototype.flattenSingleKeyObject = function (obj) { + var keys = Object.keys(obj); + if (keys.length !== 1) { + throw new Error("Expected an object with a single key, got: " + JSON.stringify(obj)); + } + return obj[keys[0]]; + }; + BaseResponseParsingService.prototype.retrieveObjectOrUrl = function (obj) { + return this.toCache ? obj.self : obj; + }; + BaseResponseParsingService.prototype.isSuccessStatus = function (statusCode) { + return statusCode >= 200 && statusCode < 300; + }; + return BaseResponseParsingService; +}()); +export { BaseResponseParsingService }; +//# sourceMappingURL=base-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/base-response-parsing.service.js.map b/src/app/core/data/base-response-parsing.service.js.map new file mode 100644 index 0000000000..8b32098cda --- /dev/null +++ b/src/app/core/data/base-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base-response-parsing.service.js","sourceRoot":"","sources":["base-response-parsing.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAIrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAE1G,yCAAyC;AAEzC;IAAA;IAuIA,CAAC;IAjIW,4CAAO,GAAjB,UAA4C,IAAS,EAAE,WAAmB;QAA1E,iBA0CC;QAzCC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;YACpB,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,EAAE;gBAClD,OAAO,IAAI,CAAC;aACb;iBAAM,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE;gBACpC,OAAO,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;aACrD;iBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,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vID,IAuIC"} \ No newline at end of file diff --git a/src/app/core/data/browse-entries-response-parsing.service.js b/src/app/core/data/browse-entries-response-parsing.service.js new file mode 100644 index 0000000000..a0cf76d431 --- /dev/null +++ b/src/app/core/data/browse-entries-response-parsing.service.js @@ -0,0 +1,43 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { GLOBAL_CONFIG } from '../../../config'; +import { isNotEmpty } from '../../shared/empty.util'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { ErrorResponse, GenericSuccessResponse } from '../cache/response.models'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { BrowseEntry } from '../shared/browse-entry.model'; +import { BaseResponseParsingService } from './base-response-parsing.service'; +var BrowseEntriesResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(BrowseEntriesResponseParsingService, _super); + function BrowseEntriesResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = { + getConstructor: function () { return BrowseEntry; } + }; + _this.toCache = false; + return _this; + } + BrowseEntriesResponseParsingService.prototype.parse = function (request, data) { + if (isNotEmpty(data.payload)) { + var browseEntries = []; + if (isNotEmpty(data.payload._embedded) && Array.isArray(data.payload._embedded[Object.keys(data.payload._embedded)[0]])) { + var serializer = new DSpaceRESTv2Serializer(BrowseEntry); + browseEntries = serializer.deserializeArray(data.payload._embedded[Object.keys(data.payload._embedded)[0]]); + } + return new GenericSuccessResponse(browseEntries, data.statusCode, data.statusText, this.processPageInfo(data.payload)); + } + else { + return new ErrorResponse(Object.assign(new Error('Unexpected response from browse endpoint'), { statusCode: data.statusCode, statusText: data.statusText })); + } + }; + BrowseEntriesResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], BrowseEntriesResponseParsingService); + return BrowseEntriesResponseParsingService; +}(BaseResponseParsingService)); +export { BrowseEntriesResponseParsingService }; +//# sourceMappingURL=browse-entries-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/browse-entries-response-parsing.service.js.map b/src/app/core/data/browse-entries-response-parsing.service.js.map new file mode 100644 index 0000000000..6a984518d3 --- /dev/null +++ b/src/app/core/data/browse-entries-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-entries-response-parsing.service.js","sourceRoot":"","sources":["browse-entries-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EACL,aAAa,EACb,sBAAsB,EAEvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAK7E;IAAyD,+DAA0B;IAOjF,6CACmC,SAAuB,EAC9C,WAA+B;QAF3C,YAGI,iBAAO,SACV;QAHkC,eAAS,GAAT,SAAS,CAAc;QAC9C,iBAAW,GAAX,WAAW,CAAoB;QAPjC,mBAAa,GAAG;YACxB,cAAc,EAAE,cAAM,OAAA,WAAW,EAAX,CAAW;SAClC,CAAC;QACQ,aAAO,GAAG,KAAK,CAAC;;IAM1B,CAAC;IAED,mDAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QACpD,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAC5B,IAAI,aAAa,GAAG,EAAE,CAAC;YACvB,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;gBACvH,IAAM,UAAU,GAAG,IAAI,sBAAsB,CAAC,WAAW,CAAC,CAAC;gBAC3D,aAAa,GAAG,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAC7G;YACD,OAAO,IAAI,sBAAsB,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;SACxH;aAAM;YACL,OAAO,IAAI,aAAa,CACtB,MAAM,CAAC,MAAM,CACX,IAAI,KAAK,CAAC,0CAA0C,CAAC,EACrD,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAC7D,CACF,CAAC;SACH;IACH,CAAC;IA7BU,mCAAmC;QAD/C,UAAU,EAAE;QASR,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACC,kBAAkB;OAThC,mCAAmC,CA+B/C;IAAD,0CAAC;CAAA,AA/BD,CAAyD,0BAA0B,GA+BlF;SA/BY,mCAAmC"} \ No newline at end of file diff --git a/src/app/core/data/browse-items-response-parsing-service.js b/src/app/core/data/browse-items-response-parsing-service.js new file mode 100644 index 0000000000..ead835755a --- /dev/null +++ b/src/app/core/data/browse-items-response-parsing-service.js @@ -0,0 +1,54 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { GLOBAL_CONFIG } from '../../../config'; +import { hasValue, isNotEmpty } from '../../shared/empty.util'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { ErrorResponse, GenericSuccessResponse } from '../cache/response.models'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { BaseResponseParsingService } from './base-response-parsing.service'; +import { DSpaceObject } from '../shared/dspace-object.model'; +import { NormalizedDSpaceObject } from '../cache/models/normalized-dspace-object.model'; +/** + * A ResponseParsingService used to parse DSpaceRESTV2Response coming from the REST API to Browse Items (DSpaceObject[]) + */ +var BrowseItemsResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(BrowseItemsResponseParsingService, _super); + function BrowseItemsResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = { + getConstructor: function () { return DSpaceObject; } + }; + _this.toCache = false; + return _this; + } + /** + * Parses data from the browse endpoint to a list of DSpaceObjects + * @param {RestRequest} request + * @param {DSpaceRESTV2Response} data + * @returns {RestResponse} + */ + BrowseItemsResponseParsingService.prototype.parse = function (request, data) { + if (isNotEmpty(data.payload) && isNotEmpty(data.payload._embedded) + && Array.isArray(data.payload._embedded[Object.keys(data.payload._embedded)[0]])) { + var serializer = new DSpaceRESTv2Serializer(NormalizedDSpaceObject); + var items = serializer.deserializeArray(data.payload._embedded[Object.keys(data.payload._embedded)[0]]); + return new GenericSuccessResponse(items, data.statusCode, data.statusText, this.processPageInfo(data.payload)); + } + else if (hasValue(data.payload) && hasValue(data.payload.page)) { + return new GenericSuccessResponse([], data.statusCode, data.statusText, this.processPageInfo(data.payload)); + } + else { + return new ErrorResponse(Object.assign(new Error('Unexpected response from browse endpoint'), { statusCode: data.statusCode, statusText: data.statusText })); + } + }; + BrowseItemsResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], BrowseItemsResponseParsingService); + return BrowseItemsResponseParsingService; +}(BaseResponseParsingService)); +export { BrowseItemsResponseParsingService }; +//# sourceMappingURL=browse-items-response-parsing-service.js.map \ No newline at end of file diff --git a/src/app/core/data/browse-items-response-parsing-service.js.map b/src/app/core/data/browse-items-response-parsing-service.js.map new file mode 100644 index 0000000000..0f086d27b0 --- /dev/null +++ b/src/app/core/data/browse-items-response-parsing-service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-items-response-parsing-service.js","sourceRoot":"","sources":["browse-items-response-parsing-service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAgB,MAAM,0BAA0B,CAAC;AAE/F,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAG7E,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAExF;;GAEG;AAEH;IAAuD,6DAA0B;IAO/E,2CACmC,SAAuB,EAC9C,WAA+B;QAF3C,YAGI,iBAAO,SACV;QAHkC,eAAS,GAAT,SAAS,CAAc;QAC9C,iBAAW,GAAX,WAAW,CAAoB;QAPjC,mBAAa,GAAG;YACxB,cAAc,EAAE,cAAM,OAAA,YAAY,EAAZ,CAAY;SACnC,CAAC;QACQ,aAAO,GAAG,KAAK,CAAC;;IAM1B,CAAC;IAED;;;;;OAKG;IACH,iDAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QACpD,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAA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A,AArCD,CAAuD,0BAA0B,GAqChF;SArCY,iCAAiC"} \ No newline at end of file diff --git a/src/app/core/data/browse-response-parsing.service.js b/src/app/core/data/browse-response-parsing.service.js new file mode 100644 index 0000000000..10bcef3610 --- /dev/null +++ b/src/app/core/data/browse-response-parsing.service.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { GenericSuccessResponse, ErrorResponse } from '../cache/response.models'; +import { isNotEmpty } from '../../shared/empty.util'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { BrowseDefinition } from '../shared/browse-definition.model'; +var BrowseResponseParsingService = /** @class */ (function () { + function BrowseResponseParsingService() { + } + BrowseResponseParsingService.prototype.parse = function (request, data) { + if (isNotEmpty(data.payload) && isNotEmpty(data.payload._embedded) + && Array.isArray(data.payload._embedded[Object.keys(data.payload._embedded)[0]])) { + var serializer = new DSpaceRESTv2Serializer(BrowseDefinition); + var browseDefinitions = serializer.deserializeArray(data.payload._embedded[Object.keys(data.payload._embedded)[0]]); + return new GenericSuccessResponse(browseDefinitions, data.statusCode, data.statusText); + } + else { + return new ErrorResponse(Object.assign(new Error('Unexpected response from browse endpoint'), { statusCode: data.statusCode, statusText: data.statusText })); + } + }; + BrowseResponseParsingService = tslib_1.__decorate([ + Injectable() + ], BrowseResponseParsingService); + return BrowseResponseParsingService; +}()); +export { BrowseResponseParsingService }; +//# sourceMappingURL=browse-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/browse-response-parsing.service.js.map b/src/app/core/data/browse-response-parsing.service.js.map new file mode 100644 index 0000000000..273beabdb8 --- /dev/null +++ b/src/app/core/data/browse-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-response-parsing.service.js","sourceRoot":"","sources":["browse-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,EAAE,sBAAsB,EAAE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analyzer.js b/src/app/core/data/change-analyzer.js new file mode 100644 index 0000000000..46a4daf164 --- /dev/null +++ b/src/app/core/data/change-analyzer.js @@ -0,0 +1 @@ +//# sourceMappingURL=change-analyzer.js.map \ No newline at end of file diff --git a/src/app/core/data/change-analyzer.js.map b/src/app/core/data/change-analyzer.js.map new file mode 100644 index 0000000000..5dfb5480f0 --- /dev/null +++ b/src/app/core/data/change-analyzer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"change-analyzer.js","sourceRoot":"","sources":["change-analyzer.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/core/data/collection-data.service.js b/src/app/core/data/collection-data.service.js new file mode 100644 index 0000000000..713332047d --- /dev/null +++ b/src/app/core/data/collection-data.service.js @@ -0,0 +1,62 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { filter, map, take } from 'rxjs/operators'; +import { Store } from '@ngrx/store'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { ComColDataService } from './comcol-data.service'; +import { CommunityDataService } from './community-data.service'; +import { RequestService } from './request.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { HttpClient } from '@angular/common/http'; +import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; +import { DSOChangeAnalyzer } from './dso-change-analyzer.service'; +import { FindAllOptions } from './request.models'; +var CollectionDataService = /** @class */ (function (_super) { + tslib_1.__extends(CollectionDataService, _super); + function CollectionDataService(requestService, rdbService, dataBuildService, store, cds, objectCache, halService, notificationsService, http, comparator) { + var _this = _super.call(this) || this; + _this.requestService = requestService; + _this.rdbService = rdbService; + _this.dataBuildService = dataBuildService; + _this.store = store; + _this.cds = cds; + _this.objectCache = objectCache; + _this.halService = halService; + _this.notificationsService = notificationsService; + _this.http = http; + _this.comparator = comparator; + _this.linkPath = 'collections'; + _this.forceBypassCache = false; + return _this; + } + /** + * Find whether there is a collection whom user has authorization to submit to + * + * @return boolean + * true if the user has at least one collection to submit to + */ + CollectionDataService.prototype.hasAuthorizedCollection = function () { + var searchHref = 'findAuthorized'; + var options = new FindAllOptions(); + options.elementsPerPage = 1; + return this.searchBy(searchHref, options).pipe(filter(function (collections) { return !collections.isResponsePending; }), take(1), map(function (collections) { return collections.payload.totalElements > 0; })); + }; + CollectionDataService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + RemoteDataBuildService, + NormalizedObjectBuildService, + Store, + CommunityDataService, + ObjectCacheService, + HALEndpointService, + NotificationsService, + HttpClient, + DSOChangeAnalyzer]) + ], CollectionDataService); + return CollectionDataService; +}(ComColDataService)); +export { CollectionDataService }; +//# sourceMappingURL=collection-data.service.js.map \ No newline at end of file diff --git a/src/app/core/data/collection-data.service.js.map b/src/app/core/data/collection-data.service.js.map new file mode 100644 index 0000000000..8d2f81e33b --- /dev/null +++ b/src/app/core/data/collection-data.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collection-data.service.js","sourceRoot":"","sources":["collection-data.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD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CAAC,OAAO,CAAC,aAAa,GAAG,CAAC,EAArC,CAAqC,CAAC,CACnG,CAAC;IACJ,CAAC;IAnCU,qBAAqB;QADjC,UAAU,EAAE;iDAMiB,cAAc;YAClB,sBAAsB;YAChB,4BAA4B;YACvC,KAAK;YACP,oBAAoB;YACZ,kBAAkB;YACnB,kBAAkB;YACR,oBAAoB;YACpC,UAAU;YACJ,iBAAiB;OAd9B,qBAAqB,CAoCjC;IAAD,4BAAC;CAAA,AApCD,CAA2C,iBAAiB,GAoC3D;SApCY,qBAAqB"} \ No newline at end of file diff --git a/src/app/core/data/comcol-data.service.js b/src/app/core/data/comcol-data.service.js new file mode 100644 index 0000000000..9e1f7efb18 --- /dev/null +++ b/src/app/core/data/comcol-data.service.js @@ -0,0 +1,44 @@ +import * as tslib_1 from "tslib"; +import { distinctUntilChanged, filter, map, mergeMap, share, take, tap } from 'rxjs/operators'; +import { merge as observableMerge, throwError as observableThrowError } from 'rxjs'; +import { isEmpty, isNotEmpty } from '../../shared/empty.util'; +import { DataService } from './data.service'; +import { FindByIDRequest } from './request.models'; +import { getResponseFromEntry } from '../shared/operators'; +var ComColDataService = /** @class */ (function (_super) { + tslib_1.__extends(ComColDataService, _super); + function ComColDataService() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Get the scoped endpoint URL by fetching the object with + * the given scopeID and returning its HAL link with this + * data-service's linkPath + * + * @param {string} scopeID + * the id of the scope object + * @return { Observable } + * an Observable containing the scoped URL + */ + ComColDataService.prototype.getBrowseEndpoint = function (options, linkPath) { + var _this = this; + if (options === void 0) { options = {}; } + if (linkPath === void 0) { linkPath = this.linkPath; } + if (isEmpty(options.scopeID)) { + return this.halService.getEndpoint(linkPath); + } + else { + var scopeCommunityHrefObs = this.cds.getEndpoint().pipe(mergeMap(function (endpoint) { return _this.cds.getIDHref(endpoint, options.scopeID); }), filter(function (href) { return isNotEmpty(href); }), take(1), tap(function (href) { + var request = new FindByIDRequest(_this.requestService.generateRequestId(), href, options.scopeID); + _this.requestService.configure(request); + })); + var responses = scopeCommunityHrefObs.pipe(mergeMap(function (href) { return _this.requestService.getByHref(href); }), getResponseFromEntry()); + var errorResponses = responses.pipe(filter(function (response) { return !response.isSuccessful; }), mergeMap(function () { return observableThrowError(new Error("The Community with scope " + options.scopeID + " couldn't be retrieved")); })); + var successResponses = responses.pipe(filter(function (response) { return response.isSuccessful; }), mergeMap(function () { return _this.objectCache.getObjectByUUID(options.scopeID); }), map(function (nc) { return nc._links[linkPath]; }), filter(function (href) { return isNotEmpty(href); })); + return observableMerge(errorResponses, successResponses).pipe(distinctUntilChanged(), share()); + } + }; + return ComColDataService; +}(DataService)); +export { ComColDataService }; +//# sourceMappingURL=comcol-data.service.js.map \ No newline at end of file diff --git a/src/app/core/data/comcol-data.service.js.map b/src/app/core/data/comcol-data.service.js.map new file mode 100644 index 0000000000..494b361279 --- /dev/null +++ b/src/app/core/data/comcol-data.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"comcol-data.service.js","sourceRoot":"","sources":["comcol-data.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,KAAK,IAAI,eAAe,EAAc,UAAU,IAAI,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAK9D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAkB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D;IAA2E,6CAAc;IAAzF;;IA8CA,CAAC;IAzCC;;;;;;;;;OASG;IACI,6CAAiB,GAAxB,UAAyB,OAA4B,EAAE,QAAgC;QAAvF,iBA8BC;QA9BwB,w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,CACrH,CAAC;YACF,IAAM,gBAAgB,GAAG,SAAS,CAAC,IAAI,CACrC,MAAM,CAAC,UAAC,QAAQ,IAAK,OAAA,QAAQ,CAAC,YAAY,EAArB,CAAqB,CAAC,EAC3C,QAAQ,CAAC,cAAM,OAAA,KAAI,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,EAAjD,CAAiD,CAAC,EACjE,GAAG,CAAC,UAAC,EAAuB,IAAK,OAAA,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAnB,CAAmB,CAAC,EACrD,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,UAAU,CAAC,IAAI,CAAC,EAAhB,CAAgB,CAAC,CACnC,CAAC;YAEF,OAAO,eAAe,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;SAChG;IACH,CAAC;IACH,wBAAC;AAAD,CAAC,AA9CD,CAA2E,WAAW,GA8CrF"} \ No newline at end of file diff --git a/src/app/core/data/community-data.service.js b/src/app/core/data/community-data.service.js new file mode 100644 index 0000000000..2e1b17155f --- /dev/null +++ b/src/app/core/data/community-data.service.js @@ -0,0 +1,64 @@ +import * as tslib_1 from "tslib"; +import { filter, take } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { Store } from '@ngrx/store'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { ComColDataService } from './comcol-data.service'; +import { RequestService } from './request.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { FindAllRequest } from './request.models'; +import { hasValue } from '../../shared/empty.util'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { HttpClient } from '@angular/common/http'; +import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; +import { DSOChangeAnalyzer } from './dso-change-analyzer.service'; +var CommunityDataService = /** @class */ (function (_super) { + tslib_1.__extends(CommunityDataService, _super); + function CommunityDataService(requestService, rdbService, dataBuildService, store, objectCache, halService, notificationsService, http, comparator) { + var _this = _super.call(this) || this; + _this.requestService = requestService; + _this.rdbService = rdbService; + _this.dataBuildService = dataBuildService; + _this.store = store; + _this.objectCache = objectCache; + _this.halService = halService; + _this.notificationsService = notificationsService; + _this.http = http; + _this.comparator = comparator; + _this.linkPath = 'communities'; + _this.topLinkPath = 'communities/search/top'; + _this.cds = _this; + _this.forceBypassCache = false; + return _this; + } + CommunityDataService.prototype.getEndpoint = function () { + return this.halService.getEndpoint(this.linkPath); + }; + CommunityDataService.prototype.findTop = function (options) { + var _this = this; + if (options === void 0) { options = {}; } + var hrefObs = this.getFindAllHref(options, this.topLinkPath); + hrefObs.pipe(filter(function (href) { return hasValue(href); }), take(1)) + .subscribe(function (href) { + var request = new FindAllRequest(_this.requestService.generateRequestId(), href, options); + _this.requestService.configure(request); + }); + return this.rdbService.buildList(hrefObs); + }; + CommunityDataService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + RemoteDataBuildService, + NormalizedObjectBuildService, + Store, + ObjectCacheService, + HALEndpointService, + NotificationsService, + HttpClient, + DSOChangeAnalyzer]) + ], CommunityDataService); + return CommunityDataService; +}(ComColDataService)); +export { CommunityDataService }; +//# sourceMappingURL=community-data.service.js.map \ No newline at end of file diff --git a/src/app/core/data/community-data.service.js.map b/src/app/core/data/community-data.service.js.map new file mode 100644 index 0000000000..3a640174b8 --- /dev/null +++ b/src/app/core/data/community-data.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-data.service.js","sourceRoot":"","sources":["community-data.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6C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AAI,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED,sCAAO,GAAP,UAAQ,OAA4B;QAApC,iBAWC;QAXO,wBAAA,EAAA,YAA4B;QAClC,IAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/D,OAAO,CAAC,IAAI,CACV,MAAM,CAAC,UAAC,IAAY,IAAK,OAAA,QAAQ,CAAC,IAAI,CAAC,EAAd,CAAc,CAAC,EACxC,IAAI,CAAC,CAAC,CAAC,CAAC;aACP,SAAS,CAAC,UAAC,IAAY;YACtB,IAAM,OAAO,GAAG,IAAI,cAAc,CAAC,KAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;YAC3F,KAAI,CAAC,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;QAEL,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAY,OAAO,CAAqD,CAAC;IAC3G,CAAC;IAnCU,oBAAoB;QADhC,UAAU,EAAE;iDAQiB,cAAc;YAClB,sBAAsB;YAChB,4BAA4B;YACvC,KAAK;YACC,kBAAkB;YACnB,kBAAkB;YACR,oBAAoB;YACpC,UAAU;YACJ,iBAAiB;OAf9B,oBAAoB,CAoChC;IAAD,2BAAC;CAAA,AApCD,CAA0C,iBAAiB,GAoC1D;SApCY,oBAAoB"} \ No newline at end of file diff --git a/src/app/core/data/data.service.js b/src/app/core/data/data.service.js new file mode 100644 index 0000000000..1bd816228a --- /dev/null +++ b/src/app/core/data/data.service.js @@ -0,0 +1,221 @@ +import { distinctUntilChanged, filter, find, first, map, mergeMap, switchMap, take } from 'rxjs/operators'; +import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util'; +import { URLCombiner } from '../url-combiner/url-combiner'; +import { CreateRequest, DeleteByIDRequest, FindAllRequest, FindByIDRequest, GetRequest } from './request.models'; +import { configureRequest, getResponseFromEntry } from '../shared/operators'; +import { ErrorResponse } from '../cache/response.models'; +import { NotificationOptions } from '../../shared/notifications/models/notification-options.model'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory'; +var DataService = /** @class */ (function () { + function DataService() { + this.forceBypassCache = false; + } + /** + * Create the HREF with given options object + * + * @param options The [[FindAllOptions]] object + * @param linkPath The link path for the object + * @return {Observable} + * Return an observable that emits created HREF + */ + DataService.prototype.getFindAllHref = function (options, linkPath) { + if (options === void 0) { options = {}; } + var result; + var args = []; + result = this.getBrowseEndpoint(options, linkPath).pipe(distinctUntilChanged()); + return this.buildHrefFromFindOptions(result, args, options); + }; + /** + * Create the HREF for a specific object's search method with given options object + * + * @param searchMethod The search method for the object + * @param options The [[FindAllOptions]] object + * @return {Observable} + * Return an observable that emits created HREF + */ + DataService.prototype.getSearchByHref = function (searchMethod, options) { + if (options === void 0) { options = {}; } + var result; + var args = []; + result = this.getSearchEndpoint(searchMethod); + if (hasValue(options.searchParams)) { + options.searchParams.forEach(function (param) { + args.push(param.fieldName + "=" + param.fieldValue); + }); + } + return this.buildHrefFromFindOptions(result, args, options); + }; + /** + * Turn an options object into a query string and combine it with the given HREF + * + * @param href$ The HREF to which the query string should be appended + * @param args Array with additional params to combine with query string + * @param options The [[FindAllOptions]] object + * @return {Observable} + * Return an observable that emits created HREF + */ + DataService.prototype.buildHrefFromFindOptions = function (href$, args, options) { + if (hasValue(options.currentPage) && typeof options.currentPage === 'number') { + /* TODO: this is a temporary fix for the pagination start index (0 or 1) discrepancy between the rest and the frontend respectively */ + args.push("page=" + (options.currentPage - 1)); + } + if (hasValue(options.elementsPerPage)) { + args.push("size=" + options.elementsPerPage); + } + if (hasValue(options.sort)) { + args.push("sort=" + options.sort.field + "," + options.sort.direction); + } + if (hasValue(options.startsWith)) { + args.push("startsWith=" + options.startsWith); + } + if (isNotEmpty(args)) { + return href$.pipe(map(function (href) { return new URLCombiner(href, "?" + args.join('&')).toString(); })); + } + else { + return href$; + } + }; + DataService.prototype.findAll = function (options) { + var _this = this; + if (options === void 0) { options = {}; } + var hrefObs = this.getFindAllHref(options); + hrefObs.pipe(first(function (href) { return hasValue(href); })) + .subscribe(function (href) { + var request = new FindAllRequest(_this.requestService.generateRequestId(), href, options); + _this.requestService.configure(request, _this.forceBypassCache); + }); + return this.rdbService.buildList(hrefObs); + }; + /** + * Create the HREF for a specific object based on its identifier + * @param endpoint The base endpoint for the type of object + * @param resourceID The identifier for the object + */ + DataService.prototype.getIDHref = function (endpoint, resourceID) { + return endpoint + "/" + resourceID; + }; + DataService.prototype.findById = function (id) { + var _this = this; + var hrefObs = this.halService.getEndpoint(this.linkPath).pipe(map(function (endpoint) { return _this.getIDHref(endpoint, id); })); + hrefObs.pipe(find(function (href) { return hasValue(href); })) + .subscribe(function (href) { + var request = new FindByIDRequest(_this.requestService.generateRequestId(), href, id); + _this.requestService.configure(request, _this.forceBypassCache); + }); + return this.rdbService.buildSingle(hrefObs); + }; + DataService.prototype.findByHref = function (href, options) { + this.requestService.configure(new GetRequest(this.requestService.generateRequestId(), href, null, options), this.forceBypassCache); + return this.rdbService.buildSingle(href); + }; + /** + * Return object search endpoint by given search method + * + * @param searchMethod The search method for the object + */ + DataService.prototype.getSearchEndpoint = function (searchMethod) { + return this.halService.getEndpoint(this.linkPath + "/search").pipe(filter(function (href) { return isNotEmpty(href); }), map(function (href) { return href + "/" + searchMethod; })); + }; + /** + * Make a new FindAllRequest with given search method + * + * @param searchMethod The search method for the object + * @param options The [[FindAllOptions]] object + * @return {Observable>} + * Return an observable that emits response from the server + */ + DataService.prototype.searchBy = function (searchMethod, options) { + var _this = this; + if (options === void 0) { options = {}; } + var hrefObs = this.getSearchByHref(searchMethod, options); + hrefObs.pipe(first(function (href) { return hasValue(href); })) + .subscribe(function (href) { + var request = new FindAllRequest(_this.requestService.generateRequestId(), href, options); + _this.requestService.configure(request, true); + }); + return this.rdbService.buildList(hrefObs); + }; + /** + * Add a new patch to the object cache to a specified object + * @param {string} href The selflink of the object that will be patched + * @param {Operation[]} operations The patch operations to be performed + */ + DataService.prototype.patch = function (href, operations) { + this.objectCache.addPatch(href, operations); + }; + /** + * Add a new patch to the object cache + * The patch is derived from the differences between the given object and its version in the object cache + * @param {DSpaceObject} object The given object + */ + DataService.prototype.update = function (object) { + var _this = this; + var oldVersion$ = this.objectCache.getObjectBySelfLink(object.self); + return oldVersion$.pipe(take(1), mergeMap(function (oldVersion) { + var operations = _this.comparator.diff(oldVersion, object); + if (isNotEmpty(operations)) { + _this.objectCache.addPatch(object.self, operations); + } + return _this.findById(object.uuid); + })); + }; + /** + * Create a new DSpaceObject on the server, and store the response + * in the object cache + * + * @param {DSpaceObject} dso + * The object to create + * @param {string} parentUUID + * The UUID of the parent to create the new object under + */ + DataService.prototype.create = function (dso, parentUUID) { + var _this = this; + var requestId = this.requestService.generateRequestId(); + var endpoint$ = this.halService.getEndpoint(this.linkPath).pipe(isNotEmptyOperator(), distinctUntilChanged(), map(function (endpoint) { return parentUUID ? endpoint + "?parent=" + parentUUID : endpoint; })); + var normalizedObject = this.dataBuildService.normalize(dso); + var serializedDso = new DSpaceRESTv2Serializer(NormalizedObjectFactory.getConstructor(dso.type)).serialize(normalizedObject); + var request$ = endpoint$.pipe(take(1), map(function (endpoint) { return new CreateRequest(requestId, endpoint, JSON.stringify(serializedDso)); })); + // Execute the post request + request$.pipe(configureRequest(this.requestService)).subscribe(); + // Resolve self link for new object + var selfLink$ = this.requestService.getByUUID(requestId).pipe(getResponseFromEntry(), map(function (response) { + if (!response.isSuccessful && response instanceof ErrorResponse) { + _this.notificationsService.error('Server Error:', response.errorMessage, new NotificationOptions(-1)); + } + else { + return response; + } + }), map(function (response) { + if (isNotEmpty(response.resourceSelfLinks)) { + return response.resourceSelfLinks[0]; + } + }), distinctUntilChanged()); + return selfLink$.pipe(switchMap(function (selfLink) { return _this.findByHref(selfLink); })); + }; + /** + * Delete an existing DSpace Object on the server + * @param dso The DSpace Object to be removed + * Return an observable that emits true when the deletion was successful, false when it failed + */ + DataService.prototype.delete = function (dso) { + var _this = this; + var requestId = this.requestService.generateRequestId(); + var hrefObs = this.halService.getEndpoint(this.linkPath).pipe(map(function (endpoint) { return _this.getIDHref(endpoint, dso.uuid); })); + hrefObs.pipe(find(function (href) { return hasValue(href); }), map(function (href) { + var request = new DeleteByIDRequest(requestId, href, dso.uuid); + _this.requestService.configure(request); + })).subscribe(); + return this.requestService.getByUUID(requestId).pipe(find(function (request) { return request.completed; }), map(function (request) { return request.response.isSuccessful; })); + }; + /** + * Commit current object changes to the server + * @param method The RestRequestMethod for which de server sync buffer should be committed + */ + DataService.prototype.commitUpdates = function (method) { + this.requestService.commit(method); + }; + return DataService; +}()); +export { DataService }; +//# sourceMappingURL=data.service.js.map \ No newline at end of file diff --git a/src/app/core/data/data.service.js.map b/src/app/core/data/data.service.js.map new file mode 100644 index 0000000000..bd70be8d5f --- /dev/null +++ b/src/app/core/data/data.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"data.service.js","sourceRoot":"","sources":["data.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG3G,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAInF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,OAAO,EACL,aAAa,EACb,iBAAiB,EAEjB,cAAc,EACd,eAAe,EACf,UAAU,EACX,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAgB,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,mBAAmB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,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;QAE1D,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAC7D,GAAG,CAAC,UAAC,QAAgB,IAAK,OAAA,KAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,EAAlC,CAAkC,CAAC,CAAC,CAAC;QAEjE,OAAO,CAAC,IAAI,CACV,IAAI,CAAC,UAAC,IAAY,IAAK,OAAA,QAAQ,CAAC,IAAI,CAAC,EAAd,CAAc,CAAC,EACtC,GAAG,CAAC,UAAC,IAAY;YACf,IAAM,OAAO,GAAG,IAAI,iBAAiB,CAAC,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;YACjE,KAAI,CAAC,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC,CAAC,CACH,CAAC,SAAS,EAAE,CAAC;QAEd,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI,CAClD,IAAI,CAAC,UAAC,OAAqB,IAAK,OAAA,OAAO,CAAC,SAAS,EAAjB,CAAiB,CAAC,EAClD,GAAG,CAAC,UAAC,OAAqB,IAAK,OAAA,OAAO,CAAC,QAAQ,CAAC,YAAY,EAA7B,CAA6B,CAAC,CAC9D,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,mCAAa,GAAb,UAAc,MAA0B;QACtC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAEH,kBAAC;AAAD,CAAC,AAjRD,IAiRC"} \ No newline at end of file diff --git a/src/app/core/data/debug-response-parsing.service.js b/src/app/core/data/debug-response-parsing.service.js new file mode 100644 index 0000000000..e5838266fa --- /dev/null +++ b/src/app/core/data/debug-response-parsing.service.js @@ -0,0 +1,16 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +var DebugResponseParsingService = /** @class */ (function () { + function DebugResponseParsingService() { + } + DebugResponseParsingService.prototype.parse = function (request, data) { + console.log('request', request, 'data', data); + return undefined; + }; + DebugResponseParsingService = tslib_1.__decorate([ + Injectable() + ], DebugResponseParsingService); + return DebugResponseParsingService; +}()); +export { DebugResponseParsingService }; +//# sourceMappingURL=debug-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/debug-response-parsing.service.js.map b/src/app/core/data/debug-response-parsing.service.js.map new file mode 100644 index 0000000000..72de0f7b0d --- /dev/null +++ b/src/app/core/data/debug-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"debug-response-parsing.service.js","sourceRoot":"","sources":["debug-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAO3C;IAAA;IAKA,CAAC;IAJC,2CAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QACpD,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC9C,OAAO,SAAS,CAAC;IACnB,CAAC;IAJU,2BAA2B;QADvC,UAAU,EAAE;OACA,2BAA2B,CAKvC;IAAD,kCAAC;CAAA,AALD,IAKC;SALY,2BAA2B"} \ No newline at end of file diff --git a/src/app/core/data/default-change-analyzer.service.js b/src/app/core/data/default-change-analyzer.service.js new file mode 100644 index 0000000000..1a4564ccef --- /dev/null +++ b/src/app/core/data/default-change-analyzer.service.js @@ -0,0 +1,29 @@ +import * as tslib_1 from "tslib"; +import { compare } from 'fast-json-patch'; +import { Injectable } from '@angular/core'; +/** + * A class to determine what differs between two + * CacheableObjects + */ +var DefaultChangeAnalyzer = /** @class */ (function () { + function DefaultChangeAnalyzer() { + } + /** + * Compare the metadata of two CacheableObject and return the differences as + * a JsonPatch Operation Array + * + * @param {NormalizedObject} object1 + * The first object to compare + * @param {NormalizedObject} object2 + * The second object to compare + */ + DefaultChangeAnalyzer.prototype.diff = function (object1, object2) { + return compare(object1, object2); + }; + DefaultChangeAnalyzer = tslib_1.__decorate([ + Injectable() + ], DefaultChangeAnalyzer); + return DefaultChangeAnalyzer; +}()); +export { DefaultChangeAnalyzer }; +//# sourceMappingURL=default-change-analyzer.service.js.map \ No newline at end of file diff --git a/src/app/core/data/default-change-analyzer.service.js.map b/src/app/core/data/default-change-analyzer.service.js.map new file mode 100644 index 0000000000..06d638c399 --- /dev/null +++ b/src/app/core/data/default-change-analyzer.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"default-change-analyzer.service.js","sourceRoot":"","sources":["default-change-analyzer.service.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C;;;GAGG;AAEH;IAAA;IAcA,CAAC;IAZC;;;;;;;;OAQG;IACH,oCAAI,GAAJ,UAAK,OAAgC,EAAE,OAAgC;QACrE,OAAO,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IAbU,qBAAqB;QADjC,UAAU,EAAE;OACA,qBAAqB,CAcjC;IAAD,4BAAC;CAAA,AAdD,IAcC;SAdY,qBAAqB"} \ No newline at end of file diff --git a/src/app/core/data/dso-change-analyzer.service.js b/src/app/core/data/dso-change-analyzer.service.js new file mode 100644 index 0000000000..d4d1d4d201 --- /dev/null +++ b/src/app/core/data/dso-change-analyzer.service.js @@ -0,0 +1,29 @@ +import * as tslib_1 from "tslib"; +import { compare } from 'fast-json-patch'; +import { Injectable } from '@angular/core'; +/** + * A class to determine what differs between two + * DSpaceObjects + */ +var DSOChangeAnalyzer = /** @class */ (function () { + function DSOChangeAnalyzer() { + } + /** + * Compare the metadata of two DSpaceObjects and return the differences as + * a JsonPatch Operation Array + * + * @param {NormalizedDSpaceObject} object1 + * The first object to compare + * @param {NormalizedDSpaceObject} object2 + * The second object to compare + */ + DSOChangeAnalyzer.prototype.diff = function (object1, object2) { + return compare(object1.metadata, object2.metadata).map(function (operation) { return Object.assign({}, operation, { path: '/metadata' + operation.path }); }); + }; + DSOChangeAnalyzer = tslib_1.__decorate([ + Injectable() + ], DSOChangeAnalyzer); + return DSOChangeAnalyzer; +}()); +export { DSOChangeAnalyzer }; +//# sourceMappingURL=dso-change-analyzer.service.js.map \ No newline at end of file diff --git a/src/app/core/data/dso-change-analyzer.service.js.map b/src/app/core/data/dso-change-analyzer.service.js.map new file mode 100644 index 0000000000..8be027805d --- /dev/null +++ b/src/app/core/data/dso-change-analyzer.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dso-change-analyzer.service.js","sourceRoot":"","sources":["dso-change-analyzer.service.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C;;;GAGG;AAEH;IAAA;IAcA,CAAC;IAZC;;;;;;;;OAQG;IACH,gCAAI,GAAJ,UAAK,OAAsC,EAAE,OAAsC;QACjF,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,UAAC,SAAoB,IAAK,OAAA,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,EAApE,CAAoE,CAAC,CAAC;IACzJ,CAAC;IAbU,iBAAiB;QAD7B,UAAU,EAAE;OACA,iBAAiB,CAc7B;IAAD,wBAAC;CAAA,AAdD,IAcC;SAdY,iBAAiB"} \ No newline at end of file diff --git a/src/app/core/data/dso-response-parsing.service.js b/src/app/core/data/dso-response-parsing.service.js new file mode 100644 index 0000000000..976b371254 --- /dev/null +++ b/src/app/core/data/dso-response-parsing.service.js @@ -0,0 +1,49 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { GLOBAL_CONFIG } from '../../../config'; +import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory'; +import { DSOSuccessResponse } from '../cache/response.models'; +import { BaseResponseParsingService } from './base-response-parsing.service'; +import { hasNoValue, hasValue } from '../../shared/empty.util'; +var DSOResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(DSOResponseParsingService, _super); + function DSOResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = NormalizedObjectFactory; + _this.toCache = true; + return _this; + } + DSOResponseParsingService.prototype.parse = function (request, data) { + var processRequestDTO; + // Prevent empty pages returning an error, initialize empty array instead. + if (hasValue(data.payload) && hasValue(data.payload.page) && data.payload.page.totalElements === 0) { + processRequestDTO = { page: [] }; + } + else { + processRequestDTO = this.process(data.payload, request.uuid); + } + var objectList = processRequestDTO; + if (hasNoValue(processRequestDTO)) { + return new DSOSuccessResponse([], data.statusCode, data.statusText, undefined); + } + if (hasValue(processRequestDTO.page)) { + objectList = processRequestDTO.page; + } + else if (!Array.isArray(processRequestDTO)) { + objectList = [processRequestDTO]; + } + var selfLinks = objectList.map(function (no) { return no.self; }); + return new DSOSuccessResponse(selfLinks, data.statusCode, data.statusText, this.processPageInfo(data.payload)); + }; + DSOResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], DSOResponseParsingService); + return DSOResponseParsingService; +}(BaseResponseParsingService)); +export { DSOResponseParsingService }; +//# sourceMappingURL=dso-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/dso-response-parsing.service.js.map b/src/app/core/data/dso-response-parsing.service.js.map new file mode 100644 index 0000000000..7e7e49d697 --- /dev/null +++ b/src/app/core/data/dso-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,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AAC,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;SAC/E;QACD,IAAI,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE;YACpC,UAAU,GAAG,iBAAiB,CAAC,IAAI,CAAC;SACrC;aAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE;YAC5C,UAAU,GAAG,CAAC,iBAAiB,CAAC,CAAC;SAClC;QACD,IAAM,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,UAAC,EAAE,IAAK,OAAA,EAAE,CAAC,IAAI,EAAP,CAAO,CAAC,CAAC;QAClD,OAAO,IAAI,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;IAChH,CAAC;IAhCU,yBAAyB;QADrC,UAAU,EAAE;QAOR,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACC,kBAAkB;OAPhC,yBAAyB,CAkCrC;IAAD,gCAAC;CAAA,AAlCD,CAA+C,0BAA0B,GAkCxE;SAlCY,yBAAyB"} \ No newline at end of file diff --git a/src/app/core/data/dspace-object-data.service.js b/src/app/core/data/dspace-object-data.service.js new file mode 100644 index 0000000000..a1ed019fa9 --- /dev/null +++ b/src/app/core/data/dspace-object-data.service.js @@ -0,0 +1,70 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { DataService } from './data.service'; +import { RequestService } from './request.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { HttpClient } from '@angular/common/http'; +import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; +import { DSOChangeAnalyzer } from './dso-change-analyzer.service'; +/* tslint:disable:max-classes-per-file */ +var DataServiceImpl = /** @class */ (function (_super) { + tslib_1.__extends(DataServiceImpl, _super); + function DataServiceImpl(requestService, rdbService, dataBuildService, store, objectCache, halService, notificationsService, http, comparator) { + var _this = _super.call(this) || this; + _this.requestService = requestService; + _this.rdbService = rdbService; + _this.dataBuildService = dataBuildService; + _this.store = store; + _this.objectCache = objectCache; + _this.halService = halService; + _this.notificationsService = notificationsService; + _this.http = http; + _this.comparator = comparator; + _this.linkPath = 'dso'; + _this.forceBypassCache = false; + return _this; + } + DataServiceImpl.prototype.getBrowseEndpoint = function (options, linkPath) { + if (options === void 0) { options = {}; } + if (linkPath === void 0) { linkPath = this.linkPath; } + return this.halService.getEndpoint(linkPath); + }; + DataServiceImpl.prototype.getIDHref = function (endpoint, resourceID) { + return endpoint.replace(/\{\?uuid\}/, "?uuid=" + resourceID); + }; + return DataServiceImpl; +}(DataService)); +var DSpaceObjectDataService = /** @class */ (function () { + function DSpaceObjectDataService(requestService, rdbService, dataBuildService, objectCache, halService, notificationsService, http, comparator) { + this.requestService = requestService; + this.rdbService = rdbService; + this.dataBuildService = dataBuildService; + this.objectCache = objectCache; + this.halService = halService; + this.notificationsService = notificationsService; + this.http = http; + this.comparator = comparator; + this.linkPath = 'dso'; + this.dataService = new DataServiceImpl(requestService, rdbService, dataBuildService, null, objectCache, halService, notificationsService, http, comparator); + } + DSpaceObjectDataService.prototype.findById = function (uuid) { + return this.dataService.findById(uuid); + }; + DSpaceObjectDataService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + RemoteDataBuildService, + NormalizedObjectBuildService, + ObjectCacheService, + HALEndpointService, + NotificationsService, + HttpClient, + DSOChangeAnalyzer]) + ], DSpaceObjectDataService); + return DSpaceObjectDataService; +}()); +export { DSpaceObjectDataService }; +//# sourceMappingURL=dspace-object-data.service.js.map \ No newline at end of file diff --git a/src/app/core/data/dspace-object-data.service.js.map b/src/app/core/data/dspace-object-data.service.js.map new file mode 100644 index 0000000000..e9176db2de --- /dev/null +++ b/src/app/core/data/dspace-object-data.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-object-data.service.js","sourceRoot":"","sources":["dspace-object-data.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAGrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,yCAAyC;AACzC;IAA8B,2CAAyB;IAIrD,yBACY,cAA8B,EAC9B,UAAkC,EAClC,gBAA8C,EAC9C,KAAuB,EACvB,WAA+B,EAC/B,UAA8B,EAC9B,oBAA0C,EAC1C,IAAgB,EAChB,UAA2C;QATvD,YAUE,iBAAO,SACR;QAVW,oBAAc,GAAd,cAAc,CAAgB;QAC9B,gBAAU,GAAV,UAAU,CAAwB;QAClC,sBAAgB,GAAhB,gBAAgB,CAA8B;QAC9C,WAAK,GAAL,KAAK,CAAkB;QACvB,iBAAW,GAAX,WAAW,CAAoB;QAC/B,gBAAU,GAAV,UAAU,CAAoB;QAC9B,0BAAoB,GAApB,oBAAoB,CAAsB;QAC1C,UAAI,GAAJ,IAAI,CAAY;QAChB,gBAAU,GAAV,UAAU,CAAiC;QAZ7C,cAAQ,GAAG,KAAK,CAAC;QACjB,sBAAgB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;YACnB,kBAAkB;YACR,oBAAoB;YACpC,UAAU;YACJ,iBAAiB;OAZ9B,uBAAuB,CAmBnC;IAAD,8BAAC;CAAA,AAnBD,IAmBC;SAnBY,uBAAuB"} \ No newline at end of file diff --git a/src/app/core/data/endpoint-map-response-parsing.service.js b/src/app/core/data/endpoint-map-response-parsing.service.js new file mode 100644 index 0000000000..9e8121b626 --- /dev/null +++ b/src/app/core/data/endpoint-map-response-parsing.service.js @@ -0,0 +1,31 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { GLOBAL_CONFIG } from '../../../config'; +import { ErrorResponse, EndpointMapSuccessResponse } from '../cache/response.models'; +import { isNotEmpty } from '../../shared/empty.util'; +var EndpointMapResponseParsingService = /** @class */ (function () { + function EndpointMapResponseParsingService(EnvConfig) { + this.EnvConfig = EnvConfig; + } + EndpointMapResponseParsingService.prototype.parse = function (request, data) { + if (isNotEmpty(data.payload) && isNotEmpty(data.payload._links)) { + var links = data.payload._links; + for (var _i = 0, _a = Object.keys(links); _i < _a.length; _i++) { + var link = _a[_i]; + links[link] = links[link].href; + } + return new EndpointMapSuccessResponse(links, data.statusCode, data.statusText); + } + else { + return new ErrorResponse(Object.assign(new Error('Unexpected response from root endpoint'), { statusCode: data.statusCode, statusText: data.statusText })); + } + }; + EndpointMapResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object]) + ], EndpointMapResponseParsingService); + return EndpointMapResponseParsingService; +}()); +export { EndpointMapResponseParsingService }; +//# sourceMappingURL=endpoint-map-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/endpoint-map-response-parsing.service.js.map b/src/app/core/data/endpoint-map-response-parsing.service.js.map new file mode 100644 index 0000000000..5474242083 --- /dev/null +++ b/src/app/core/data/endpoint-map-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"endpoint-map-response-parsing.service.js","sourceRoot":"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} \ No newline at end of file diff --git a/src/app/core/data/facet-config-response-parsing.service.js b/src/app/core/data/facet-config-response-parsing.service.js new file mode 100644 index 0000000000..902f6ea459 --- /dev/null +++ b/src/app/core/data/facet-config-response-parsing.service.js @@ -0,0 +1,33 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { FacetConfigSuccessResponse } from '../cache/response.models'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { SearchFilterConfig } from '../../+search-page/search-service/search-filter-config.model'; +import { BaseResponseParsingService } from './base-response-parsing.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { GLOBAL_CONFIG } from '../../../config'; +var FacetConfigResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(FacetConfigResponseParsingService, _super); + function FacetConfigResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = {}; + _this.toCache = false; + return _this; + } + FacetConfigResponseParsingService.prototype.parse = function (request, data) { + var config = data.payload._embedded.facets; + var serializer = new DSpaceRESTv2Serializer(SearchFilterConfig); + var facetConfig = serializer.deserializeArray(config); + return new FacetConfigSuccessResponse(facetConfig, data.statusCode, data.statusText); + }; + FacetConfigResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], FacetConfigResponseParsingService); + return FacetConfigResponseParsingService; +}(BaseResponseParsingService)); +export { FacetConfigResponseParsingService }; +//# sourceMappingURL=facet-config-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/facet-config-response-parsing.service.js.map b/src/app/core/data/facet-config-response-parsing.service.js.map new file mode 100644 index 0000000000..1f444f1663 --- /dev/null +++ b/src/app/core/data/facet-config-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"facet-config-response-parsing.service.js","sourceRoot":"","sources":["facet-config-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACL,0BAA0B,EAE3B,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;IAAuD,6DAA0B;IAG/E,2CACmC,SAAuB,EAC9C,WAA+B;QAF3C,YAGI,iBAAO,SACV;QAHkC,eAAS,GAAT,SAAS,CAAc;QAC9C,iBAAW,GAAX,WAAW,CAAoB;QAJ3C,mBAAa,GAAG,EAAE,CAAC;QACnB,aAAO,GAAG,KAAK,CAAC;;IAKhB,CAAC;IACD,iDAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QAEpD,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC;QAC7C,IAAM,UAAU,GAAG,IAAI,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;QAClE,IAAM,WAAW,GAAG,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACxD,OAAO,IAAI,0BAA0B,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACvF,CAAC;IAdU,iCAAiC;QAD7C,UAAU,EAAE;QAKR,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACC,kBAAkB;OALhC,iCAAiC,CAe7C;IAAD,wCAAC;CAAA,AAfD,CAAuD,0BAA0B,GAehF;SAfY,iCAAiC"} \ No newline at end of file diff --git a/src/app/core/data/facet-value-map-response-parsing.service.js b/src/app/core/data/facet-value-map-response-parsing.service.js new file mode 100644 index 0000000000..314b103ede --- /dev/null +++ b/src/app/core/data/facet-value-map-response-parsing.service.js @@ -0,0 +1,40 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { FacetValueMap, FacetValueMapSuccessResponse, FacetValueSuccessResponse } from '../cache/response.models'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { FacetValue } from '../../+search-page/search-service/facet-value.model'; +import { BaseResponseParsingService } from './base-response-parsing.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { GLOBAL_CONFIG } from '../../../config'; +var FacetValueMapResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(FacetValueMapResponseParsingService, _super); + function FacetValueMapResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = {}; + _this.toCache = false; + return _this; + } + FacetValueMapResponseParsingService.prototype.parse = function (request, data) { + var _this = this; + var payload = data.payload; + var facetMap = new FacetValueMap(); + var serializer = new DSpaceRESTv2Serializer(FacetValue); + payload._embedded.facets.map(function (facet) { + var values = facet._embedded.values.map(function (value) { value.search = value._links.search.href; return value; }); + var facetValues = serializer.deserializeArray(values); + var valuesResponse = new FacetValueSuccessResponse(facetValues, data.statusCode, data.statusText, _this.processPageInfo(data.payload)); + facetMap[facet.name] = valuesResponse; + }); + return new FacetValueMapSuccessResponse(facetMap, data.statusCode, data.statusText); + }; + FacetValueMapResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], FacetValueMapResponseParsingService); + return FacetValueMapResponseParsingService; +}(BaseResponseParsingService)); +export { FacetValueMapResponseParsingService }; +//# sourceMappingURL=facet-value-map-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/facet-value-map-response-parsing.service.js.map b/src/app/core/data/facet-value-map-response-parsing.service.js.map new file mode 100644 index 0000000000..3c2f84a662 --- /dev/null +++ b/src/app/core/data/facet-value-map-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"facet-value-map-response-parsing.service.js","sourceRoot":"","sources":["facet-value-map-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,yBAAyB,EAE1B,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,qDAAqD,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;IAAyD,+DAA0B;IAIjF,6CACmC,SAAuB,EAC9C,WAA+B;QAF3C,YAGI,iBAAO,SACV;QAHkC,eAAS,GAAT,SAAS,CAAc;QAC9C,iBAAW,GAAX,WAAW,CAAoB;QAL3C,mBAAa,GAAG,EAAE,CAAC;QACnB,aAAO,GAAG,KAAK,CAAC;;IAMhB,CAAC;IAED,mDAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QAAtD,iBAcC;QAZC,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAM,QAAQ,GAAkB,IAAI,aAAa,EAAE,CAAC;QAEpD,IAAM,UAAU,GAAG,IAAI,sBAAsB,CAAC,UAAU,CAAC,CAAC;QAC1D,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,UAAC,KAAK;YACjC,IAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,UAAC,KAAK,IAAM,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAA,CAAC,CAAC,CAAC;YAC/G,IAAM,WAAW,GAAG,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YACxD,IAAM,cAAc,GAAG,IAAI,yBAAyB,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YACxI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,4BAA4B,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACtF,CAAC;IAxBU,mCAAmC;QAD/C,UAAU,EAAE;QAMR,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACC,kBAAkB;OANhC,mCAAmC,CAyB/C;IAAD,0CAAC;CAAA,AAzBD,CAAyD,0BAA0B,GAyBlF;SAzBY,mCAAmC"} \ No newline at end of file diff --git a/src/app/core/data/facet-value-response-parsing.service.js b/src/app/core/data/facet-value-response-parsing.service.js new file mode 100644 index 0000000000..4ded3f9a7c --- /dev/null +++ b/src/app/core/data/facet-value-response-parsing.service.js @@ -0,0 +1,34 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { FacetValueSuccessResponse } from '../cache/response.models'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { FacetValue } from '../../+search-page/search-service/facet-value.model'; +import { BaseResponseParsingService } from './base-response-parsing.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { GLOBAL_CONFIG } from '../../../config'; +var FacetValueResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(FacetValueResponseParsingService, _super); + function FacetValueResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = {}; + _this.toCache = false; + return _this; + } + FacetValueResponseParsingService.prototype.parse = function (request, data) { + var payload = data.payload; + var serializer = new DSpaceRESTv2Serializer(FacetValue); + // const values = payload._embedded.values.map((value) => {value.search = value._links.search.href; return value;}); + var facetValues = serializer.deserializeArray(payload._embedded.values); + return new FacetValueSuccessResponse(facetValues, data.statusCode, data.statusText, this.processPageInfo(data.payload)); + }; + FacetValueResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], FacetValueResponseParsingService); + return FacetValueResponseParsingService; +}(BaseResponseParsingService)); +export { FacetValueResponseParsingService }; +//# sourceMappingURL=facet-value-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/facet-value-response-parsing.service.js.map b/src/app/core/data/facet-value-response-parsing.service.js.map new file mode 100644 index 0000000000..58da222e17 --- /dev/null +++ b/src/app/core/data/facet-value-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"facet-value-response-parsing.service.js","sourceRoot":"","sources":["facet-value-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAgB,MAAM,0BAA0B,CAAC;AAInF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,qDAAqD,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD;IAAsD,4DAA0B;IAG9E,0CACmC,SAAuB,EAC9C,WAA+B;QAF3C,YAGI,iBAAO,SACV;QAHkC,eAAS,GAAT,SAAS,CAAc;QAC9C,iBAAW,GAAX,WAAW,CAAoB;QAJ3C,mBAAa,GAAG,EAAE,CAAC;QACnB,aAAO,GAAG,KAAK,CAAC;;IAKhB,CAAC;IACD,gDAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QACpD,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAM,UAAU,GAAG,IAAI,sBAAsB,CAAC,UAAU,CAAC,CAAC;QAC1D,oHAAoH;QAEpH,IAAM,WAAW,GAAG,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC1E,OAAO,IAAI,yBAAyB,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1H,CAAC;IAhBU,gCAAgC;QAD5C,UAAU,EAAE;QAKR,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACC,kBAAkB;OALhC,gCAAgC,CAiB5C;IAAD,uCAAC;CAAA,AAjBD,CAAsD,0BAA0B,GAiB/E;SAjBY,gCAAgC"} \ No newline at end of file diff --git a/src/app/core/data/filtered-discovery-page-response-parsing.service.js b/src/app/core/data/filtered-discovery-page-response-parsing.service.js new file mode 100644 index 0000000000..f38ee1bb11 --- /dev/null +++ b/src/app/core/data/filtered-discovery-page-response-parsing.service.js @@ -0,0 +1,39 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { BaseResponseParsingService } from './base-response-parsing.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { GLOBAL_CONFIG } from '../../../config'; +import { FilteredDiscoveryQueryResponse } from '../cache/response.models'; +/** + * A ResponseParsingService used to parse DSpaceRESTV2Response coming from the REST API to a discovery query (string) + * wrapped in a FilteredDiscoveryQueryResponse + */ +var FilteredDiscoveryPageResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(FilteredDiscoveryPageResponseParsingService, _super); + function FilteredDiscoveryPageResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = {}; + _this.toCache = false; + return _this; + } + /** + * Parses data from the REST API to a discovery query wrapped in a FilteredDiscoveryQueryResponse + * @param {RestRequest} request + * @param {DSpaceRESTV2Response} data + * @returns {RestResponse} + */ + FilteredDiscoveryPageResponseParsingService.prototype.parse = function (request, data) { + var query = data.payload['discovery-query']; + return new FilteredDiscoveryQueryResponse(query, data.statusCode, data.statusText); + }; + FilteredDiscoveryPageResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], FilteredDiscoveryPageResponseParsingService); + return FilteredDiscoveryPageResponseParsingService; +}(BaseResponseParsingService)); +export { FilteredDiscoveryPageResponseParsingService }; +//# sourceMappingURL=filtered-discovery-page-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/filtered-discovery-page-response-parsing.service.js.map b/src/app/core/data/filtered-discovery-page-response-parsing.service.js.map new file mode 100644 index 0000000000..39df81ab99 --- /dev/null +++ b/src/app/core/data/filtered-discovery-page-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filtered-discovery-page-response-parsing.service.js","sourceRoot":"","sources":["filtered-discovery-page-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAInD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,8BAA8B,EAAgB,MAAM,0BAA0B,CAAC;AAExF;;;GAGG;AAEH;IAAiE,uEAA0B;IAGzF,qDACmC,SAAuB,EAC9C,WAA+B;QAF3C,YAGI,iBAAO,SACV;QAHkC,eAAS,GAAT,SAAS,CAAc;QAC9C,iBAAW,GAAX,WAAW,CAAoB;QAJ3C,mBAAa,GAAG,EAAE,CAAC;QACnB,aAAO,GAAG,KAAK,CAAC;;IAKhB,CAAC;IAED;;;;;OAKG;IACH,2DAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QACpD,IAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAC9C,OAAO,IAAI,8BAA8B,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACrF,CAAC;IAlBU,2CAA2C;QADvD,UAAU,EAAE;QAKR,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACC,kBAAkB;OALhC,2CAA2C,CAmBvD;IAAD,kDAAC;CAAA,AAnBD,CAAiE,0BAA0B,GAmB1F;SAnBY,2CAA2C"} \ No newline at end of file diff --git a/src/app/core/data/item-data.service.js b/src/app/core/data/item-data.service.js new file mode 100644 index 0000000000..ce09b98047 --- /dev/null +++ b/src/app/core/data/item-data.service.js @@ -0,0 +1,112 @@ +import * as tslib_1 from "tslib"; +import { distinctUntilChanged, filter, map } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { Store } from '@ngrx/store'; +import { isNotEmpty } from '../../shared/empty.util'; +import { BrowseService } from '../browse/browse.service'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { URLCombiner } from '../url-combiner/url-combiner'; +import { DataService } from './data.service'; +import { RequestService } from './request.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { PatchRequest } from './request.models'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { DSOChangeAnalyzer } from './dso-change-analyzer.service'; +import { HttpClient } from '@angular/common/http'; +import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; +import { configureRequest, getRequestFromRequestHref } from '../shared/operators'; +var ItemDataService = /** @class */ (function (_super) { + tslib_1.__extends(ItemDataService, _super); + function ItemDataService(requestService, rdbService, dataBuildService, store, bs, objectCache, halService, notificationsService, http, comparator) { + var _this = _super.call(this) || this; + _this.requestService = requestService; + _this.rdbService = rdbService; + _this.dataBuildService = dataBuildService; + _this.store = store; + _this.bs = bs; + _this.objectCache = objectCache; + _this.halService = halService; + _this.notificationsService = notificationsService; + _this.http = http; + _this.comparator = comparator; + _this.linkPath = 'items'; + _this.forceBypassCache = false; + return _this; + } + /** + * Get the endpoint for browsing items + * (When options.sort.field is empty, the default field to browse by will be 'dc.date.issued') + * @param {FindAllOptions} options + * @returns {Observable} + */ + ItemDataService.prototype.getBrowseEndpoint = function (options, linkPath) { + if (options === void 0) { options = {}; } + if (linkPath === void 0) { linkPath = this.linkPath; } + var field = 'dc.date.issued'; + if (options.sort && options.sort.field) { + field = options.sort.field; + } + return this.bs.getBrowseURLFor(field, linkPath).pipe(filter(function (href) { return isNotEmpty(href); }), map(function (href) { return new URLCombiner(href, "?scope=" + options.scopeID).toString(); }), distinctUntilChanged()); + }; + /** + * Get the endpoint for item withdrawal and reinstatement + * @param itemId + */ + ItemDataService.prototype.getItemWithdrawEndpoint = function (itemId) { + var _this = this; + return this.halService.getEndpoint(this.linkPath).pipe(map(function (endpoint) { return _this.getIDHref(endpoint, itemId); })); + }; + /** + * Get the endpoint to make item private and public + * @param itemId + */ + ItemDataService.prototype.getItemDiscoverableEndpoint = function (itemId) { + var _this = this; + return this.halService.getEndpoint(this.linkPath).pipe(map(function (endpoint) { return _this.getIDHref(endpoint, itemId); })); + }; + /** + * Set the isWithdrawn state of an item to a specified state + * @param itemId + * @param withdrawn + */ + ItemDataService.prototype.setWithDrawn = function (itemId, withdrawn) { + var _this = this; + var patchOperation = [{ + op: 'replace', path: '/withdrawn', value: withdrawn + }]; + return this.getItemWithdrawEndpoint(itemId).pipe(distinctUntilChanged(), map(function (endpointURL) { + return new PatchRequest(_this.requestService.generateRequestId(), endpointURL, patchOperation); + }), configureRequest(this.requestService), map(function (request) { return request.href; }), getRequestFromRequestHref(this.requestService), map(function (requestEntry) { return requestEntry.response; })); + }; + /** + * Set the isDiscoverable state of an item to a specified state + * @param itemId + * @param discoverable + */ + ItemDataService.prototype.setDiscoverable = function (itemId, discoverable) { + var _this = this; + var patchOperation = [{ + op: 'replace', path: '/discoverable', value: discoverable + }]; + return this.getItemDiscoverableEndpoint(itemId).pipe(distinctUntilChanged(), map(function (endpointURL) { + return new PatchRequest(_this.requestService.generateRequestId(), endpointURL, patchOperation); + }), configureRequest(this.requestService), map(function (request) { return request.href; }), getRequestFromRequestHref(this.requestService), map(function (requestEntry) { return requestEntry.response; })); + }; + ItemDataService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + RemoteDataBuildService, + NormalizedObjectBuildService, + Store, + BrowseService, + ObjectCacheService, + HALEndpointService, + NotificationsService, + HttpClient, + DSOChangeAnalyzer]) + ], ItemDataService); + return ItemDataService; +}(DataService)); +export { ItemDataService }; +//# sourceMappingURL=item-data.service.js.map \ No newline at end of file diff --git a/src/app/core/data/item-data.service.js.map b/src/app/core/data/item-data.service.js.map new file mode 100644 index 0000000000..ed6f4047ed --- /dev/null +++ b/src/app/core/data/item-data.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-data.service.js","sourceRoot":"","sources":["item-data.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,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G,CAAC,UAAC,OAAoB,IAAK,OAAA,OAAO,CAAC,IAAI,EAAZ,CAAY,CAAC,EAC3C,yBAAyB,CAAC,IAAI,CAAC,cAAc,CAAC,EAC9C,GAAG,CAAC,UAAC,YAA0B,IAAK,OAAA,YAAY,CAAC,QAAQ,EAArB,CAAqB,CAAC,CAC3D,CAAC;IACJ,CAAC;IA/FU,eAAe;QAD3B,UAAU,EAAE;iDAMiB,cAAc;YAClB,sBAAsB;YAChB,4BAA4B;YACvC,KAAK;YACV,aAAa;YACF,kBAAkB;YACnB,kBAAkB;YACR,oBAAoB;YACpC,UAAU;YACJ,iBAAiB;OAd9B,eAAe,CAgG3B;IAAD,sBAAC;CAAA,AAhGD,CAAqC,WAAW,GAgG/C;SAhGY,eAAe"} \ No newline at end of file diff --git a/src/app/core/data/metadata-schema-data.service.js b/src/app/core/data/metadata-schema-data.service.js new file mode 100644 index 0000000000..aa72714bba --- /dev/null +++ b/src/app/core/data/metadata-schema-data.service.js @@ -0,0 +1,58 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { Store } from '@ngrx/store'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { DataService } from './data.service'; +import { RequestService } from './request.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; +import { HttpClient } from '@angular/common/http'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { DefaultChangeAnalyzer } from './default-change-analyzer.service'; +/** + * A service responsible for fetching/sending data from/to the REST API on the metadataschemas endpoint + */ +var MetadataSchemaDataService = /** @class */ (function (_super) { + tslib_1.__extends(MetadataSchemaDataService, _super); + function MetadataSchemaDataService(requestService, rdbService, store, halService, objectCache, comparator, dataBuildService, http, notificationsService) { + var _this = _super.call(this) || this; + _this.requestService = requestService; + _this.rdbService = rdbService; + _this.store = store; + _this.halService = halService; + _this.objectCache = objectCache; + _this.comparator = comparator; + _this.dataBuildService = dataBuildService; + _this.http = http; + _this.notificationsService = notificationsService; + _this.linkPath = 'metadataschemas'; + _this.forceBypassCache = false; + return _this; + } + /** + * Get the endpoint for browsing metadataschemas + * @param {FindAllOptions} options + * @returns {Observable} + */ + MetadataSchemaDataService.prototype.getBrowseEndpoint = function (options, linkPath) { + if (options === void 0) { options = {}; } + if (linkPath === void 0) { linkPath = this.linkPath; } + return null; + }; + MetadataSchemaDataService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + RemoteDataBuildService, + Store, + HALEndpointService, + ObjectCacheService, + DefaultChangeAnalyzer, + NormalizedObjectBuildService, + HttpClient, + NotificationsService]) + ], MetadataSchemaDataService); + return MetadataSchemaDataService; +}(DataService)); +export { MetadataSchemaDataService }; +//# sourceMappingURL=metadata-schema-data.service.js.map \ No newline at end of file diff --git a/src/app/core/data/metadata-schema-data.service.js.map b/src/app/core/data/metadata-schema-data.service.js.map new file mode 100644 index 0000000000..1ce12f4ac5 --- /dev/null +++ b/src/app/core/data/metadata-schema-data.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata-schema-data.service.js","sourceRoot":"","sources":["metadata-schema-data.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAGrF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAC;AACjG,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;GAEG;AAEH;IAA+C,qDAA2B;IAIxE,mCACY,cAA8B,EAC9B,UAAkC,EAClC,KAAuB,EACvB,UAA8B,EAC9B,WAA+B,EAC/B,UAAiD,EACjD,gBAA8C,EAC9C,IAAgB,EAChB,oBAA0C;QATtD,YAUE,iBAAO,SACR;QAVW,oBAAc,GAAd,cAAc,CAAgB;QAC9B,gBAAU,GAAV,UAAU,CAAwB;QAClC,WAAK,GAAL,KAAK,CAAkB;QACvB,gBAAU,GAAV,UAAU,CAAoB;QAC9B,iBAAW,GAAX,WAAW,CAAoB;QAC/B,gBAAU,GAAV,UAAU,CAAuC;QACjD,sBAAgB,GAAhB,gBAAgB,CAA8B;QAC9C,UAAI,GAAJ,IAAI,CAAY;QAChB,0BAAoB,GAApB,oBAAoB,CAAsB;QAZ5C,cAAQ,GAAG,iBAAiB,CAAC;QAC7B,sBAAgB,GAAG,KAAK,CAAC;;IAanC,CAAC;IAED;;;;OAIG;IACI,qDAAiB,GAAxB,UAAyB,OAA4B,EAAE,QAAgC;QAA9D,wBAAA,EAAA,YAA4B;QAAE,yBAAA,EAAA,WAAmB,IAAI,CAAC,QAAQ;QAErF,OAAO,IAAI,CAAC;IACd,CAAC;IAzBU,yBAAyB;QADrC,UAAU,EAAE;iDAMiB,cAAc;YAClB,sBAAsB;YAC3B,KAAK;YACA,kBAAkB;YACjB,kBAAkB;YACnB,qBAAqB;YACf,4BAA4B;YACxC,UAAU;YACM,oBAAoB;OAb3C,yBAAyB,CA2BrC;IAAD,gCAAC;CAAA,AA3BD,CAA+C,WAAW,GA2BzD;SA3BY,yBAAyB"} \ No newline at end of file diff --git a/src/app/core/data/metadatafield-parsing.service.js b/src/app/core/data/metadatafield-parsing.service.js new file mode 100644 index 0000000000..845135ef5d --- /dev/null +++ b/src/app/core/data/metadatafield-parsing.service.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { Injectable } from '@angular/core'; +import { MetadatafieldSuccessResponse } from '../cache/response.models'; +import { MetadataField } from '../metadata/metadatafield.model'; +/** + * A service responsible for parsing DSpaceRESTV2Response data related to a single MetadataField to a valid RestResponse + */ +var MetadatafieldParsingService = /** @class */ (function () { + function MetadatafieldParsingService() { + } + MetadatafieldParsingService.prototype.parse = function (request, data) { + var payload = data.payload; + var deserialized = new DSpaceRESTv2Serializer(MetadataField).deserialize(payload); + return new MetadatafieldSuccessResponse(deserialized, data.statusCode, data.statusText); + }; + MetadatafieldParsingService = tslib_1.__decorate([ + Injectable() + ], MetadatafieldParsingService); + return MetadatafieldParsingService; +}()); +export { MetadatafieldParsingService }; +//# sourceMappingURL=metadatafield-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/metadatafield-parsing.service.js.map b/src/app/core/data/metadatafield-parsing.service.js.map new file mode 100644 index 0000000000..d72940dafe --- /dev/null +++ b/src/app/core/data/metadatafield-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadatafield-parsing.service.js","sourceRoot":"","sources":["metadatafield-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAIrF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,4BAA4B,EAA+C,MAAM,0BAA0B,CAAC;AACrH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE;;GAEG;AAEH;IAAA;IASA,CAAC;IAPC,2CAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QACpD,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAM,YAAY,GAAG,IAAI,sBAAsB,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACpF,OAAO,IAAI,4BAA4B,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1F,CAAC;IAPU,2BAA2B;QADvC,UAAU,EAAE;OACA,2BAA2B,CASvC;IAAD,kCAAC;CAAA,AATD,IASC;SATY,2BAA2B"} \ No newline at end of file diff --git a/src/app/core/data/metadataschema-parsing.service.js b/src/app/core/data/metadataschema-parsing.service.js new file mode 100644 index 0000000000..728e696c58 --- /dev/null +++ b/src/app/core/data/metadataschema-parsing.service.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { MetadataSchema } from '../metadata/metadataschema.model'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { Injectable } from '@angular/core'; +import { MetadataschemaSuccessResponse } from '../cache/response.models'; +var MetadataschemaParsingService = /** @class */ (function () { + function MetadataschemaParsingService() { + } + MetadataschemaParsingService.prototype.parse = function (request, data) { + var payload = data.payload; + var deserialized = new DSpaceRESTv2Serializer(MetadataSchema).deserialize(payload); + return new MetadataschemaSuccessResponse(deserialized, data.statusCode, data.statusText); + }; + MetadataschemaParsingService = tslib_1.__decorate([ + Injectable() + ], MetadataschemaParsingService); + return MetadataschemaParsingService; +}()); +export { MetadataschemaParsingService }; +//# sourceMappingURL=metadataschema-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/metadataschema-parsing.service.js.map b/src/app/core/data/metadataschema-parsing.service.js.map new file mode 100644 index 0000000000..fc9f79fca2 --- /dev/null +++ b/src/app/core/data/metadataschema-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadataschema-parsing.service.js","sourceRoot":"","sources":["metadataschema-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAIrF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,6BAA6B,EAAgB,MAAM,0BAA0B,CAAC;AAGvF;IAAA;IASA,CAAC;IAPC,4CAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QACpD,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAM,YAAY,GAAG,IAAI,sBAAsB,CAAC,cAAc,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACrF,OAAO,IAAI,6BAA6B,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC3F,CAAC;IAPU,4BAA4B;QADxC,UAAU,EAAE;OACA,4BAA4B,CASxC;IAAD,mCAAC;CAAA,AATD,IASC;SATY,4BAA4B"} \ No newline at end of file diff --git a/src/app/core/data/mydspace-response-parsing.service.js b/src/app/core/data/mydspace-response-parsing.service.js new file mode 100644 index 0000000000..64dba1ea6e --- /dev/null +++ b/src/app/core/data/mydspace-response-parsing.service.js @@ -0,0 +1,84 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { SearchSuccessResponse } from '../cache/response.models'; +import { DSOResponseParsingService } from './dso-response-parsing.service'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { hasValue } from '../../shared/empty.util'; +import { SearchQueryResponse } from '../../+search-page/search-service/search-query-response.model'; +import { MetadataValue } from '../shared/metadata.models'; +var MyDSpaceResponseParsingService = /** @class */ (function () { + function MyDSpaceResponseParsingService(dsoParser) { + this.dsoParser = dsoParser; + } + MyDSpaceResponseParsingService.prototype.parse = function (request, data) { + var _this = this; + // fallback for unexpected empty response + var emptyPayload = { + _embedded: { + objects: [] + } + }; + var payload = data.payload._embedded.searchResult || emptyPayload; + var hitHighlights = payload._embedded.objects + .map(function (object) { return object.hitHighlights; }) + .map(function (hhObject) { + var mdMap = {}; + if (hhObject) { + for (var _i = 0, _a = Object.keys(hhObject); _i < _a.length; _i++) { + var key = _a[_i]; + var value = Object.assign(new MetadataValue(), { + value: hhObject[key].join('...'), + language: null + }); + mdMap[key] = [value]; + } + } + return mdMap; + }); + var dsoSelfLinks = payload._embedded.objects + .filter(function (object) { return hasValue(object._embedded); }) + .map(function (object) { return object._embedded.indexableObject; }) + .map(function (dso) { return _this.dsoParser.parse(request, { + payload: dso, + statusCode: data.statusCode, + statusText: data.statusText + }); }) + .map(function (obj) { return obj.resourceSelfLinks; }) + .reduce(function (combined, thisElement) { return combined.concat(thisElement); }, []); + var objects = payload._embedded.objects + .filter(function (object) { return hasValue(object._embedded); }) + .map(function (object, index) { return Object.assign({}, object, { + indexableObject: dsoSelfLinks[index], + hitHighlights: hitHighlights[index], + _embedded: _this.filterEmbeddedObjects(object) + }); }); + payload.objects = objects; + var deserialized = new DSpaceRESTv2Serializer(SearchQueryResponse).deserialize(payload); + return new SearchSuccessResponse(deserialized, data.statusCode, data.statusText, this.dsoParser.processPageInfo(payload)); + }; + MyDSpaceResponseParsingService.prototype.filterEmbeddedObjects = function (object) { + var allowedEmbeddedKeys = ['submitter', 'item', 'workspaceitem', 'workflowitem']; + if (object._embedded.indexableObject && object._embedded.indexableObject._embedded) { + return Object.assign({}, object._embedded, { + indexableObject: Object.assign({}, object._embedded.indexableObject, { + _embedded: Object.keys(object._embedded.indexableObject._embedded) + .filter(function (key) { return allowedEmbeddedKeys.includes(key); }) + .reduce(function (obj, key) { + obj[key] = object._embedded.indexableObject._embedded[key]; + return obj; + }, {}) + }) + }); + } + else { + return object; + } + }; + MyDSpaceResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [DSOResponseParsingService]) + ], MyDSpaceResponseParsingService); + return MyDSpaceResponseParsingService; +}()); +export { MyDSpaceResponseParsingService }; +//# sourceMappingURL=mydspace-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/mydspace-response-parsing.service.js.map b/src/app/core/data/mydspace-response-parsing.service.js.map new file mode 100644 index 0000000000..29d79c7317 --- /dev/null +++ b/src/app/core/data/mydspace-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mydspace-response-parsing.service.js","sourceRoot":"","sources":["mydspace-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAgB,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAI3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAC;AACpG,OAAO,EAAe,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAGvE;IACE,wCAAoB,SAAoC;QAApC,cAAS,GAAT,SAAS,CAA2B;IACxD,CAAC;IAED,8CAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QAAtD,iBA6CC;QA5CC,yCAAyC;QACzC,IAAM,YAAY,GAAG;YACnB,SAAS,EAAE;gBACT,OAAO,EAAE,EAAE;aACZ;SACF,CAAC;QACF,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,IAAI,YAAY,CAAC;QACpE,IAAM,aAAa,GAAkB,OAAO,CAAC,SAAS,CAAC,OAAO;aAC3D,GAAG,CAAC,UAAC,MAAM,IAAK,OAAA,MAAM,CAAC,aAAa,EAApB,CAAoB,CAAC;aACrC,GAAG,CAAC,UAAC,QAAQ;YACZ,IAAM,KAAK,GAAgB,EAAE,CAAC;YAC9B,IAAI,QAAQ,EAAE;gBACZ,KAAkB,UAAqB,EAArB,KAAA,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAArB,cAAqB,EAArB,IAAqB,EAAE;oBAApC,IAAM,GAAG,SAAA;oBACZ,IAAM,KAAK,GAAkB,MAAM,CAAC,MAAM,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aACH,CAAC,CAAC;SACJ;aAAM;YACL,OAAO,MAAM,CAAC;SACf;IAEH,CAAC;IApEU,8BAA8B;QAD1C,UAAU,EAAE;iDAEoB,yBAAyB;OAD7C,8BAA8B,CAqE1C;IAAD,qCAAC;CAAA,AArED,IAqEC;SArEY,8BAA8B"} \ No newline at end of file diff --git a/src/app/core/data/object-updates/object-updates.actions.js b/src/app/core/data/object-updates/object-updates.actions.js new file mode 100644 index 0000000000..38a2fa2e9d --- /dev/null +++ b/src/app/core/data/object-updates/object-updates.actions.js @@ -0,0 +1,171 @@ +import { type } from '../../../shared/ngrx/type'; +/** + * The list of ObjectUpdatesAction type definitions + */ +export var ObjectUpdatesActionTypes = { + INITIALIZE_FIELDS: type('dspace/core/cache/object-updates/INITIALIZE_FIELDS'), + SET_EDITABLE_FIELD: type('dspace/core/cache/object-updates/SET_EDITABLE_FIELD'), + SET_VALID_FIELD: type('dspace/core/cache/object-updates/SET_VALID_FIELD'), + ADD_FIELD: type('dspace/core/cache/object-updates/ADD_FIELD'), + DISCARD: type('dspace/core/cache/object-updates/DISCARD'), + REINSTATE: type('dspace/core/cache/object-updates/REINSTATE'), + REMOVE: type('dspace/core/cache/object-updates/REMOVE'), + REMOVE_FIELD: type('dspace/core/cache/object-updates/REMOVE_FIELD'), +}; +/* tslint:disable:max-classes-per-file */ +/** + * Enum that represents the different types of updates that can be performed on a field in the ObjectUpdates store + */ +export var FieldChangeType; +(function (FieldChangeType) { + FieldChangeType[FieldChangeType["UPDATE"] = 0] = "UPDATE"; + FieldChangeType[FieldChangeType["ADD"] = 1] = "ADD"; + FieldChangeType[FieldChangeType["REMOVE"] = 2] = "REMOVE"; +})(FieldChangeType || (FieldChangeType = {})); +/** + * An ngrx action to initialize a new page's fields in the ObjectUpdates state + */ +var InitializeFieldsAction = /** @class */ (function () { + /** + * Create a new InitializeFieldsAction + * + * @param url + * the unique url of the page for which the fields are being initialized + * @param fields The identifiable fields of which the updates are kept track of + * @param lastModified The last modified date of the object that belongs to the page + */ + function InitializeFieldsAction(url, fields, lastModified) { + this.type = ObjectUpdatesActionTypes.INITIALIZE_FIELDS; + this.payload = { url: url, fields: fields, lastModified: lastModified }; + } + return InitializeFieldsAction; +}()); +export { InitializeFieldsAction }; +/** + * An ngrx action to add a new field update in the ObjectUpdates state for a certain page url + */ +var AddFieldUpdateAction = /** @class */ (function () { + /** + * Create a new AddFieldUpdateAction + * + * @param url + * the unique url of the page for which a field update is added + * @param field The identifiable field of which a new update is added + * @param changeType The update's change type + */ + function AddFieldUpdateAction(url, field, changeType) { + this.type = ObjectUpdatesActionTypes.ADD_FIELD; + this.payload = { url: url, field: field, changeType: changeType }; + } + return AddFieldUpdateAction; +}()); +export { AddFieldUpdateAction }; +/** + * An ngrx action to set the editable state of an existing field in the ObjectUpdates state for a certain page url + */ +var SetEditableFieldUpdateAction = /** @class */ (function () { + /** + * Create a new SetEditableFieldUpdateAction + * + * @param url + * the unique url of the page + * @param fieldUUID The UUID of the field of which + * @param editable The new editable value for the field + */ + function SetEditableFieldUpdateAction(url, fieldUUID, editable) { + this.type = ObjectUpdatesActionTypes.SET_EDITABLE_FIELD; + this.payload = { url: url, uuid: fieldUUID, editable: editable }; + } + return SetEditableFieldUpdateAction; +}()); +export { SetEditableFieldUpdateAction }; +/** + * An ngrx action to set the isValid state of an existing field in the ObjectUpdates state for a certain page url + */ +var SetValidFieldUpdateAction = /** @class */ (function () { + /** + * Create a new SetValidFieldUpdateAction + * + * @param url + * the unique url of the page + * @param fieldUUID The UUID of the field of which + * @param isValid The new isValid value for the field + */ + function SetValidFieldUpdateAction(url, fieldUUID, isValid) { + this.type = ObjectUpdatesActionTypes.SET_VALID_FIELD; + this.payload = { url: url, uuid: fieldUUID, isValid: isValid }; + } + return SetValidFieldUpdateAction; +}()); +export { SetValidFieldUpdateAction }; +/** + * An ngrx action to discard all existing updates in the ObjectUpdates state for a certain page url + */ +var DiscardObjectUpdatesAction = /** @class */ (function () { + /** + * Create a new DiscardObjectUpdatesAction + * + * @param url + * the unique url of the page for which the changes should be discarded + * @param notification The notification that is raised when changes are discarded + */ + function DiscardObjectUpdatesAction(url, notification) { + this.type = ObjectUpdatesActionTypes.DISCARD; + this.payload = { url: url, notification: notification }; + } + return DiscardObjectUpdatesAction; +}()); +export { DiscardObjectUpdatesAction }; +/** + * An ngrx action to reinstate all previously discarded updates in the ObjectUpdates state for a certain page url + */ +var ReinstateObjectUpdatesAction = /** @class */ (function () { + /** + * Create a new ReinstateObjectUpdatesAction + * + * @param url + * the unique url of the page for which the changes should be reinstated + */ + function ReinstateObjectUpdatesAction(url) { + this.type = ObjectUpdatesActionTypes.REINSTATE; + this.payload = { url: url }; + } + return ReinstateObjectUpdatesAction; +}()); +export { ReinstateObjectUpdatesAction }; +/** + * An ngrx action to remove all previously discarded updates in the ObjectUpdates state for a certain page url + */ +var RemoveObjectUpdatesAction = /** @class */ (function () { + /** + * Create a new RemoveObjectUpdatesAction + * + * @param url + * the unique url of the page for which the changes should be removed + */ + function RemoveObjectUpdatesAction(url) { + this.type = ObjectUpdatesActionTypes.REMOVE; + this.payload = { url: url }; + } + return RemoveObjectUpdatesAction; +}()); +export { RemoveObjectUpdatesAction }; +/** + * An ngrx action to remove a single field update in the ObjectUpdates state for a certain page url and field uuid + */ +var RemoveFieldUpdateAction = /** @class */ (function () { + /** + * Create a new RemoveObjectUpdatesAction + * + * @param url + * the unique url of the page for which a field's change should be removed + * @param uuid The UUID of the field for which the change should be removed + */ + function RemoveFieldUpdateAction(url, uuid) { + this.type = ObjectUpdatesActionTypes.REMOVE_FIELD; + this.payload = { url: url, uuid: uuid }; + } + return RemoveFieldUpdateAction; +}()); +export { RemoveFieldUpdateAction }; +//# sourceMappingURL=object-updates.actions.js.map \ No newline at end of file diff --git a/src/app/core/data/object-updates/object-updates.actions.js.map b/src/app/core/data/object-updates/object-updates.actions.js.map new file mode 100644 index 0000000000..736ab3e88d --- /dev/null +++ b/src/app/core/data/object-updates/object-updates.actions.js.map @@ -0,0 +1 @@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,gCAAC;AAAD,CAAC,AAjBD,IAiBC;;AAED;;GAEG;AACH;IAOE;;;;;;OAMG;IACH,iCACE,GAAW,EACX,IAAY;QAfd,SAAI,GAAG,wBAAwB,CAAC,YAAY,CAAC;QAiB3C,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,KAAA,EAAE,IAAI,MAAA,EAAE,CAAC;IAC/B,CAAC;IACH,8BAAC;AAAD,CAAC,AApBD,IAoBC"} \ No newline at end of file diff --git a/src/app/core/data/object-updates/object-updates.effects.js b/src/app/core/data/object-updates/object-updates.effects.js new file mode 100644 index 0000000000..de7554ed33 --- /dev/null +++ b/src/app/core/data/object-updates/object-updates.effects.js @@ -0,0 +1,100 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { Actions, Effect, ofType } from '@ngrx/effects'; +import { ObjectUpdatesActionTypes, RemoveObjectUpdatesAction } from './object-updates.actions'; +import { delay, filter, map, switchMap, take, tap } from 'rxjs/operators'; +import { of as observableOf, race as observableRace, Subject } from 'rxjs'; +import { hasNoValue } from '../../../shared/empty.util'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { NotificationsActionTypes } from '../../../shared/notifications/notifications.actions'; +/** + * NGRX effects for ObjectUpdatesActions + */ +var ObjectUpdatesEffects = /** @class */ (function () { + function ObjectUpdatesEffects(actions$, notificationsService) { + var _this = this; + this.actions$ = actions$; + this.notificationsService = notificationsService; + /** + * Identifier for when an action on all notifications is performed + */ + this.allIdentifier = 'all'; + /** + * Map that keeps track of the latest ObjectUpdatesAction for each page's url + */ + this.actionMap$ = {}; + this.notificationActionMap$ = { all: new Subject() }; + /** + * Effect that makes sure all last fired ObjectUpdatesActions are stored in the map of this service, with the url as their key + */ + this.mapLastActions$ = this.actions$ + .pipe(ofType.apply(void 0, Object.values(ObjectUpdatesActionTypes)), map(function (action) { + var url = action.payload.url; + if (hasNoValue(_this.actionMap$[url])) { + _this.actionMap$[url] = new Subject(); + } + _this.actionMap$[url].next(action); + })); + /** + * Effect that makes sure all last fired NotificationActions are stored in the notification map of this service, with the id as their key + */ + this.mapLastNotificationActions$ = this.actions$ + .pipe(ofType.apply(void 0, Object.values(NotificationsActionTypes)), map(function (action) { + var id = action.payload.id || action.payload || _this.allIdentifier; + if (hasNoValue(_this.notificationActionMap$[id])) { + _this.notificationActionMap$[id] = new Subject(); + } + _this.notificationActionMap$[id].next(action); + })); + /** + * Effect that checks whether the removeAction's notification timeout ends before a user triggers another ObjectUpdatesAction + * When no ObjectUpdatesAction is fired during the timeout, a RemoteObjectUpdatesAction will be returned + * When a REINSTATE action is fired during the timeout, a NO_ACTION action will be returned + * When any other ObjectUpdatesAction is fired during the timeout, a RemoteObjectUpdatesAction will be returned + */ + this.removeAfterDiscardOrReinstateOnUndo$ = this.actions$ + .pipe(ofType(ObjectUpdatesActionTypes.DISCARD), switchMap(function (action) { + var url = action.payload.url; + var notification = action.payload.notification; + var timeOut = notification.options.timeOut; + return observableRace( + // Either wait for the delay and perform a remove action + observableOf(new RemoveObjectUpdatesAction(action.payload.url)).pipe(delay(timeOut)), + // Or wait for a a user action + _this.actionMap$[url].pipe(take(1), tap(function () { + _this.notificationsService.remove(notification); + }), map(function (updateAction) { + if (updateAction.type === ObjectUpdatesActionTypes.REINSTATE) { + // If someone reinstated, do nothing, just let the reinstating happen + return { type: 'NO_ACTION' }; + } + // If someone performed another action, assume the user does not want to reinstate and remove all changes + return new RemoveObjectUpdatesAction(action.payload.url); + })), _this.notificationActionMap$[notification.id].pipe(filter(function (notificationsAction) { return notificationsAction.type === NotificationsActionTypes.REMOVE_NOTIFICATION; }), map(function () { + return new RemoveObjectUpdatesAction(action.payload.url); + })), _this.notificationActionMap$[_this.allIdentifier].pipe(filter(function (notificationsAction) { return notificationsAction.type === NotificationsActionTypes.REMOVE_ALL_NOTIFICATIONS; }), map(function () { + return new RemoveObjectUpdatesAction(action.payload.url); + }))); + })); + } + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Object) + ], ObjectUpdatesEffects.prototype, "mapLastActions$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Object) + ], ObjectUpdatesEffects.prototype, "mapLastNotificationActions$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], ObjectUpdatesEffects.prototype, "removeAfterDiscardOrReinstateOnUndo$", void 0); + ObjectUpdatesEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Actions, + NotificationsService]) + ], ObjectUpdatesEffects); + return ObjectUpdatesEffects; +}()); +export { ObjectUpdatesEffects }; +//# sourceMappingURL=object-updates.effects.js.map \ No newline at end of file diff --git a/src/app/core/data/object-updates/object-updates.effects.js.map b/src/app/core/data/object-updates/object-updates.effects.js.map new file mode 100644 index 0000000000..e93476cc21 --- /dev/null +++ b/src/app/core/data/object-updates/object-updates.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-updates.effects.js","sourceRoot":"","sources":["object-updates.effects.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAGL,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,IAAI,IAAI,cAAc,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAE3F,OAAO,EAEL,wBAAwB,EAEzB,MAAM,qDAAqD,CAAC;AAE7D;;GAEG;AAEH;IAyGE,8B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AAyB,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC3D,CAAC,CAAC,CACH,EACD,KAAI,CAAC,sBAAsB,CAAC,KAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAClD,MAAM,CAAC,UAAC,mBAAyC,IAAK,OAAA,mBAAmB,CAAC,IAAI,KAAK,wBAAwB,CAAC,wBAAwB,EAA9E,CAA8E,CAAC,EACrI,GAAG,CAAC;gBACF,OAAO,IAAI,yBAAyB,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC3D,CAAC,CAAC,CACH,CACF,CAAA;QACH,CAAC,CACF,CACF,CAAC;IAIJ,CAAC;IA/E4B;QAA5B,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;iEAWxB;IAKyB;QAA5B,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;6EAWxB;IAQM;QAAT,MAAM,EAAE;;sFAwCL;IAvGO,oBAAoB;QADhC,UAAU,EAAE;iDA0GmB,OAAO;YACK,oBAAoB;OA1GnD,oBAAoB,CA6GhC;IAAD,2BAAC;CAAA,AA7GD,IA6GC;SA7GY,oBAAoB"} \ No newline at end of file diff --git a/src/app/core/data/object-updates/object-updates.reducer.js b/src/app/core/data/object-updates/object-updates.reducer.js new file mode 100644 index 0000000000..c0913a6033 --- /dev/null +++ b/src/app/core/data/object-updates/object-updates.reducer.js @@ -0,0 +1,237 @@ +import { FieldChangeType, ObjectUpdatesActionTypes } from './object-updates.actions'; +import { hasNoValue, hasValue } from '../../../shared/empty.util'; +/** + * Path where discarded objects are saved + */ +export var OBJECT_UPDATES_TRASH_PATH = '/trash'; +/** + * Initial state for an existing initialized field + */ +var initialFieldState = { editable: false, isNew: false, isValid: true }; +/** + * Initial state for a newly added field + */ +var initialNewFieldState = { editable: true, isNew: true, isValid: undefined }; +// Object.create(null) ensures the object has no default js properties (e.g. `__proto__`) +var initialState = Object.create(null); +/** + * Reducer method to calculate the next ObjectUpdates state, based on the current state and the ObjectUpdatesAction + * @param state The current state + * @param action The action to perform on the current state + */ +export function objectUpdatesReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case ObjectUpdatesActionTypes.INITIALIZE_FIELDS: { + return initializeFieldsUpdate(state, action); + } + case ObjectUpdatesActionTypes.ADD_FIELD: { + return addFieldUpdate(state, action); + } + case ObjectUpdatesActionTypes.DISCARD: { + return discardObjectUpdates(state, action); + } + case ObjectUpdatesActionTypes.REINSTATE: { + return reinstateObjectUpdates(state, action); + } + case ObjectUpdatesActionTypes.REMOVE: { + return removeObjectUpdates(state, action); + } + case ObjectUpdatesActionTypes.REMOVE_FIELD: { + return removeFieldUpdate(state, action); + } + case ObjectUpdatesActionTypes.SET_EDITABLE_FIELD: { + return setEditableFieldUpdate(state, action); + } + case ObjectUpdatesActionTypes.SET_VALID_FIELD: { + return setValidFieldUpdate(state, action); + } + default: { + return state; + } + } +} +/** + * Initialize the state for a specific url and store all its fields in the store + * @param state The current state + * @param action The action to perform on the current state + */ +function initializeFieldsUpdate(state, action) { + var _a; + var url = action.payload.url; + var fields = action.payload.fields; + var lastModifiedServer = action.payload.lastModified; + var fieldStates = createInitialFieldStates(fields); + var newPageState = Object.assign({}, state[url], { fieldStates: fieldStates }, { fieldUpdates: {} }, { lastModified: lastModifiedServer }); + return Object.assign({}, state, (_a = {}, _a[url] = newPageState, _a)); +} +/** + * Add a new update for a specific field to the store + * @param state The current state + * @param action The action to perform on the current state + */ +function addFieldUpdate(state, action) { + var _a, _b, _c; + var url = action.payload.url; + var field = action.payload.field; + var changeType = action.payload.changeType; + var pageState = state[url] || {}; + var states = pageState.fieldStates; + if (changeType === FieldChangeType.ADD) { + states = Object.assign({}, (_a = {}, _a[field.uuid] = initialNewFieldState, _a), pageState.fieldStates); + } + var fieldUpdate = pageState.fieldUpdates[field.uuid] || {}; + var newChangeType = determineChangeType(fieldUpdate.changeType, changeType); + fieldUpdate = Object.assign({}, { field: field, changeType: newChangeType }); + var fieldUpdates = Object.assign({}, pageState.fieldUpdates, (_b = {}, _b[field.uuid] = fieldUpdate, _b)); + var newPageState = Object.assign({}, pageState, { fieldStates: states }, { fieldUpdates: fieldUpdates }); + return Object.assign({}, state, (_c = {}, _c[url] = newPageState, _c)); +} +/** + * Discard all updates for a specific action's url in the store + * @param state The current state + * @param action The action to perform on the current state + */ +function discardObjectUpdates(state, action) { + var _a, _b; + var url = action.payload.url; + var pageState = state[url]; + var newFieldStates = {}; + Object.keys(pageState.fieldStates).forEach(function (uuid) { + var fieldState = pageState.fieldStates[uuid]; + if (!fieldState.isNew) { + /* After discarding we don't want the reset fields to stay editable or invalid */ + newFieldStates[uuid] = Object.assign({}, fieldState, { editable: false, isValid: true }); + } + }); + var discardedPageState = Object.assign({}, pageState, { + fieldUpdates: {}, + fieldStates: newFieldStates + }); + return Object.assign({}, state, (_a = {}, _a[url] = discardedPageState, _a), (_b = {}, _b[url + OBJECT_UPDATES_TRASH_PATH] = pageState, _b)); +} +/** + * Reinstate all updates for a specific action's url in the store + * @param state The current state + * @param action The action to perform on the current state + */ +function reinstateObjectUpdates(state, action) { + var _a; + var url = action.payload.url; + var trashState = state[url + OBJECT_UPDATES_TRASH_PATH]; + var newState = Object.assign({}, state, (_a = {}, _a[url] = trashState, _a)); + delete newState[url + OBJECT_UPDATES_TRASH_PATH]; + return newState; +} +/** + * Remove all updates for a specific action's url in the store + * @param state The current state + * @param action The action to perform on the current state + */ +function removeObjectUpdates(state, action) { + var url = action.payload.url; + return removeObjectUpdatesByURL(state, url); +} +/** + * Remove all updates for a specific url in the store + * @param state The current state + * @param action The action to perform on the current state + */ +function removeObjectUpdatesByURL(state, url) { + var newState = Object.assign({}, state); + delete newState[url + OBJECT_UPDATES_TRASH_PATH]; + return newState; +} +/** + * Discard the update for a specific action's url and field UUID in the store + * @param state The current state + * @param action The action to perform on the current state + */ +function removeFieldUpdate(state, action) { + var _a; + var url = action.payload.url; + var uuid = action.payload.uuid; + var newPageState = state[url]; + if (hasValue(newPageState)) { + var newUpdates = Object.assign({}, newPageState.fieldUpdates); + if (hasValue(newUpdates[uuid])) { + delete newUpdates[uuid]; + } + var newFieldStates = Object.assign({}, newPageState.fieldStates); + if (hasValue(newFieldStates[uuid])) { + /* When resetting, make field not editable */ + if (newFieldStates[uuid].isNew) { + /* If this field was added, just throw it away */ + delete newFieldStates[uuid]; + } + else { + newFieldStates[uuid] = Object.assign({}, newFieldStates[uuid], { editable: false, isValid: true }); + } + } + newPageState = Object.assign({}, state[url], { + fieldUpdates: newUpdates, + fieldStates: newFieldStates + }); + } + return Object.assign({}, state, (_a = {}, _a[url] = newPageState, _a)); +} +/** + * Determine the most prominent FieldChangeType, ordered as follows: + * undefined < UPDATE < ADD < REMOVE + * @param oldType The current type + * @param newType The new type that should possibly override the new type + */ +function determineChangeType(oldType, newType) { + if (hasNoValue(newType)) { + return oldType; + } + if (hasNoValue(oldType)) { + return newType; + } + return oldType.valueOf() > newType.valueOf() ? oldType : newType; +} +/** + * Set the editable state of a specific action's url and uuid to false or true + * @param state The current state + * @param action The action to perform on the current state + */ +function setEditableFieldUpdate(state, action) { + var _a, _b; + var url = action.payload.url; + var uuid = action.payload.uuid; + var editable = action.payload.editable; + var pageState = state[url]; + var fieldState = pageState.fieldStates[uuid]; + var newFieldState = Object.assign({}, fieldState, { editable: editable }); + var newFieldStates = Object.assign({}, pageState.fieldStates, (_a = {}, _a[uuid] = newFieldState, _a)); + var newPageState = Object.assign({}, pageState, { fieldStates: newFieldStates }); + return Object.assign({}, state, (_b = {}, _b[url] = newPageState, _b)); +} +/** + * Set the isValid state of a specific action's url and uuid to false or true + * @param state The current state + * @param action The action to perform on the current state + */ +function setValidFieldUpdate(state, action) { + var _a, _b; + var url = action.payload.url; + var uuid = action.payload.uuid; + var isValid = action.payload.isValid; + var pageState = state[url]; + var fieldState = pageState.fieldStates[uuid]; + var newFieldState = Object.assign({}, fieldState, { isValid: isValid }); + var newFieldStates = Object.assign({}, pageState.fieldStates, (_a = {}, _a[uuid] = newFieldState, _a)); + var newPageState = Object.assign({}, pageState, { fieldStates: newFieldStates }); + return Object.assign({}, state, (_b = {}, _b[url] = newPageState, _b)); +} +/** + * Method to create an initial FieldStates object based on a list of Identifiable objects + * @param fields Identifiable objects + */ +function createInitialFieldStates(fields) { + var uuids = fields.map(function (field) { return field.uuid; }); + var fieldStates = {}; + uuids.forEach(function (uuid) { return fieldStates[uuid] = initialFieldState; }); + return fieldStates; +} +//# sourceMappingURL=object-updates.reducer.js.map \ No newline at end of file diff --git a/src/app/core/data/object-updates/object-updates.reducer.js.map b/src/app/core/data/object-updates/object-updates.reducer.js.map new file mode 100644 index 0000000000..b39ce3c775 --- /dev/null +++ b/src/app/core/data/object-updates/object-updates.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-updates.reducer.js","sourceRoot":"","sources":["object-updates.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAGf,wBAAwB,EAIzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,IAAM,yBAAyB,GAAG,QAAQ,CAAC;AAwDlD;;GAEG;AACH,IAAM,iBAAiB,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAE3E;;GAEG;AACH,IAAM,oBAAoB,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAEjF,yFAAyF;AACzF,IAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAEzC;;;;GAIG;AACH,MAAM,+BAA+B,KAAoB,EAAE,MAA2B;IAAjD,sBAAA,EAAA,oBAAoB;IACvD,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,wBAAw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EAAE,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;IAEnF,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,YAAI,GAAC,GAAG,IAAG,YAAY,MAAG,CAAC;AAC3D,CAAC;AAED;;;GAGG;AACH,kCAAkC,MAAsB;IACtD,IAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,UAAC,KAAmB,IAAK,OAAA,KAAK,CAAC,IAAI,EAAV,CAAU,CAAC,CAAC;IAC9D,IAAM,WAAW,GAAG,EAAE,CAAC;IACvB,KAAK,CAAC,OAAO,CAAC,UAAC,IAAY,IAAK,OAAA,WAAW,CAAC,IAAI,CAAC,GAAG,iBAAiB,EAArC,CAAqC,CAAC,CAAC;IACvE,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/src/app/core/data/object-updates/object-updates.service.js b/src/app/core/data/object-updates/object-updates.service.js new file mode 100644 index 0000000000..e7174b49c3 --- /dev/null +++ b/src/app/core/data/object-updates/object-updates.service.js @@ -0,0 +1,226 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { createSelector, select, Store } from '@ngrx/store'; +import { coreSelector } from '../../core.selectors'; +import { OBJECT_UPDATES_TRASH_PATH } from './object-updates.reducer'; +import { AddFieldUpdateAction, DiscardObjectUpdatesAction, FieldChangeType, InitializeFieldsAction, ReinstateObjectUpdatesAction, RemoveFieldUpdateAction, SetEditableFieldUpdateAction, SetValidFieldUpdateAction } from './object-updates.actions'; +import { distinctUntilChanged, filter, map } from 'rxjs/operators'; +import { hasNoValue, hasValue, isEmpty, isNotEmpty } from '../../../shared/empty.util'; +function objectUpdatesStateSelector() { + return createSelector(coreSelector, function (state) { return state['cache/object-updates']; }); +} +function filterByUrlObjectUpdatesStateSelector(url) { + return createSelector(objectUpdatesStateSelector(), function (state) { return state[url]; }); +} +function filterByUrlAndUUIDFieldStateSelector(url, uuid) { + return createSelector(filterByUrlObjectUpdatesStateSelector(url), function (state) { return state.fieldStates[uuid]; }); +} +/** + * Service that dispatches and reads from the ObjectUpdates' state in the store + */ +var ObjectUpdatesService = /** @class */ (function () { + function ObjectUpdatesService(store) { + this.store = store; + } + /** + * Method to dispatch an InitializeFieldsAction to the store + * @param url The page's URL for which the changes are being mapped + * @param fields The initial fields for the page's object + * @param lastModified The date the object was last modified + */ + ObjectUpdatesService.prototype.initialize = function (url, fields, lastModified) { + this.store.dispatch(new InitializeFieldsAction(url, fields, lastModified)); + }; + /** + * Method to dispatch an AddFieldUpdateAction to the store + * @param url The page's URL for which the changes are saved + * @param field An updated field for the page's object + * @param changeType The last type of change applied to this field + */ + ObjectUpdatesService.prototype.saveFieldUpdate = function (url, field, changeType) { + this.store.dispatch(new AddFieldUpdateAction(url, field, changeType)); + }; + /** + * Request the ObjectUpdatesEntry state for a specific URL + * @param url The URL to filter by + */ + ObjectUpdatesService.prototype.getObjectEntry = function (url) { + return this.store.pipe(select(filterByUrlObjectUpdatesStateSelector(url))); + }; + /** + * Request the getFieldState state for a specific URL and UUID + * @param url The URL to filter by + * @param uuid The field's UUID to filter by + */ + ObjectUpdatesService.prototype.getFieldState = function (url, uuid) { + return this.store.pipe(select(filterByUrlAndUUIDFieldStateSelector(url, uuid))); + }; + /** + * Method that combines the state's updates with the initial values (when there's no update) to create + * a FieldUpdates object + * @param url The URL of the page for which the FieldUpdates should be requested + * @param initialFields The initial values of the fields + */ + ObjectUpdatesService.prototype.getFieldUpdates = function (url, initialFields) { + var objectUpdates = this.getObjectEntry(url); + return objectUpdates.pipe(map(function (objectEntry) { + var fieldUpdates = {}; + Object.keys(objectEntry.fieldStates).forEach(function (uuid) { + var fieldUpdate = objectEntry.fieldUpdates[uuid]; + if (isEmpty(fieldUpdate)) { + var identifiable = initialFields.find(function (object) { return object.uuid === uuid; }); + fieldUpdate = { field: identifiable, changeType: undefined }; + } + fieldUpdates[uuid] = fieldUpdate; + }); + return fieldUpdates; + })); + }; + /** + * Method to check if a specific field is currently editable in the store + * @param url The URL of the page on which the field resides + * @param uuid The UUID of the field + */ + ObjectUpdatesService.prototype.isEditable = function (url, uuid) { + var fieldState$ = this.getFieldState(url, uuid); + return fieldState$.pipe(filter(function (fieldState) { return hasValue(fieldState); }), map(function (fieldState) { return fieldState.editable; }), distinctUntilChanged()); + }; + /** + * Method to check if a specific field is currently valid in the store + * @param url The URL of the page on which the field resides + * @param uuid The UUID of the field + */ + ObjectUpdatesService.prototype.isValid = function (url, uuid) { + var fieldState$ = this.getFieldState(url, uuid); + return fieldState$.pipe(filter(function (fieldState) { return hasValue(fieldState); }), map(function (fieldState) { return fieldState.isValid; }), distinctUntilChanged()); + }; + /** + * Method to check if a specific page is currently valid in the store + * @param url The URL of the page + */ + ObjectUpdatesService.prototype.isValidPage = function (url) { + var objectUpdates = this.getObjectEntry(url); + return objectUpdates.pipe(map(function (entry) { + return Object.values(entry.fieldStates).findIndex(function (state) { return !state.isValid; }) < 0; + }), distinctUntilChanged()); + }; + /** + * Calls the saveFieldUpdate method with FieldChangeType.ADD + * @param url The page's URL for which the changes are saved + * @param field An updated field for the page's object + */ + ObjectUpdatesService.prototype.saveAddFieldUpdate = function (url, field) { + this.saveFieldUpdate(url, field, FieldChangeType.ADD); + }; + /** + * Calls the saveFieldUpdate method with FieldChangeType.REMOVE + * @param url The page's URL for which the changes are saved + * @param field An updated field for the page's object + */ + ObjectUpdatesService.prototype.saveRemoveFieldUpdate = function (url, field) { + this.saveFieldUpdate(url, field, FieldChangeType.REMOVE); + }; + /** + * Calls the saveFieldUpdate method with FieldChangeType.UPDATE + * @param url The page's URL for which the changes are saved + * @param field An updated field for the page's object + */ + ObjectUpdatesService.prototype.saveChangeFieldUpdate = function (url, field) { + this.saveFieldUpdate(url, field, FieldChangeType.UPDATE); + }; + /** + * Dispatches a SetEditableFieldUpdateAction to the store to set a field's editable state + * @param url The URL of the page on which the field resides + * @param uuid The UUID of the field that should be set + * @param editable The new value of editable in the store for this field + */ + ObjectUpdatesService.prototype.setEditableFieldUpdate = function (url, uuid, editable) { + this.store.dispatch(new SetEditableFieldUpdateAction(url, uuid, editable)); + }; + /** + * Dispatches a SetValidFieldUpdateAction to the store to set a field's isValid state + * @param url The URL of the page on which the field resides + * @param uuid The UUID of the field that should be set + * @param valid The new value of isValid in the store for this field + */ + ObjectUpdatesService.prototype.setValidFieldUpdate = function (url, uuid, valid) { + this.store.dispatch(new SetValidFieldUpdateAction(url, uuid, valid)); + }; + /** + * Method to dispatch an DiscardObjectUpdatesAction to the store + * @param url The page's URL for which the changes should be discarded + * @param undoNotification The notification which is should possibly be canceled + */ + ObjectUpdatesService.prototype.discardFieldUpdates = function (url, undoNotification) { + this.store.dispatch(new DiscardObjectUpdatesAction(url, undoNotification)); + }; + /** + * Method to dispatch an ReinstateObjectUpdatesAction to the store + * @param url The page's URL for which the changes should be reinstated + */ + ObjectUpdatesService.prototype.reinstateFieldUpdates = function (url) { + this.store.dispatch(new ReinstateObjectUpdatesAction(url)); + }; + /** + * Method to dispatch an RemoveFieldUpdateAction to the store + * @param url The page's URL for which the changes should be removed + * @param uuid The UUID of the field that should be set + */ + ObjectUpdatesService.prototype.removeSingleFieldUpdate = function (url, uuid) { + this.store.dispatch(new RemoveFieldUpdateAction(url, uuid)); + }; + /** + * Method that combines the state's updates with the initial values (when there's no update) to create + * a list of updates fields + * @param url The URL of the page for which the updated fields should be requested + * @param initialFields The initial values of the fields + */ + ObjectUpdatesService.prototype.getUpdatedFields = function (url, initialFields) { + var objectUpdates = this.getObjectEntry(url); + return objectUpdates.pipe(map(function (objectEntry) { + var fields = []; + Object.keys(objectEntry.fieldStates).forEach(function (uuid) { + var fieldUpdate = objectEntry.fieldUpdates[uuid]; + if (hasNoValue(fieldUpdate) || fieldUpdate.changeType !== FieldChangeType.REMOVE) { + var field = void 0; + if (isNotEmpty(fieldUpdate)) { + field = fieldUpdate.field; + } + else { + field = initialFields.find(function (object) { return object.uuid === uuid; }); + } + fields.push(field); + } + }); + return fields; + })); + }; + /** + * Checks if the page currently has updates in the store or not + * @param url The page's url to check for in the store + */ + ObjectUpdatesService.prototype.hasUpdates = function (url) { + return this.getObjectEntry(url).pipe(map(function (objectEntry) { return hasValue(objectEntry) && isNotEmpty(objectEntry.fieldUpdates); })); + }; + /** + * Checks if the page currently is reinstatable in the store or not + * @param url The page's url to check for in the store + */ + ObjectUpdatesService.prototype.isReinstatable = function (url) { + return this.hasUpdates(url + OBJECT_UPDATES_TRASH_PATH); + }; + /** + * Request the current lastModified date stored for the updates in the store + * @param url The page's url to check for in the store + */ + ObjectUpdatesService.prototype.getLastModified = function (url) { + return this.getObjectEntry(url).pipe(map(function (entry) { return entry.lastModified; })); + }; + ObjectUpdatesService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Store]) + ], ObjectUpdatesService); + return ObjectUpdatesService; +}()); +export { ObjectUpdatesService }; +//# sourceMappingURL=object-updates.service.js.map \ No newline at end of file diff --git a/src/app/core/data/object-updates/object-updates.service.js.map b/src/app/core/data/object-updates/object-updates.service.js.map new file mode 100644 index 0000000000..6e02bb3133 --- /dev/null +++ b/src/app/core/data/object-updates/object-updates.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-updates.service.js","sourceRoot":"","sources":["object-updates.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAoB,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAIL,yBAAyB,EAG1B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,eAAe,EACf,sBAAsB,EACtB,4BAA4B,EAC5B,uBAAuB,EACvB,4BAA4B,EAC5B,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAA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,CAAC,CAAC,CAAC;IAC/F,CAAC;IAnOU,oBAAoB;QADhC,UAAU,EAAE;iDAEgB,KAAK;OADrB,oBAAoB,CAoOhC;IAAD,2BAAC;CAAA,AApOD,IAoOC;SApOY,oBAAoB"} \ No newline at end of file diff --git a/src/app/core/data/paginated-list.js b/src/app/core/data/paginated-list.js new file mode 100644 index 0000000000..04b1f13785 --- /dev/null +++ b/src/app/core/data/paginated-list.js @@ -0,0 +1,115 @@ +import { hasValue } from '../../shared/empty.util'; +var PaginatedList = /** @class */ (function () { + function PaginatedList(pageInfo, page) { + this.pageInfo = pageInfo; + this.page = page; + } + Object.defineProperty(PaginatedList.prototype, "elementsPerPage", { + get: function () { + if (hasValue(this.pageInfo) && hasValue(this.pageInfo.elementsPerPage)) { + return this.pageInfo.elementsPerPage; + } + return this.getPageLength(); + }, + set: function (value) { + this.pageInfo.elementsPerPage = value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PaginatedList.prototype, "totalElements", { + get: function () { + if (hasValue(this.pageInfo) && hasValue(this.pageInfo.totalElements)) { + return this.pageInfo.totalElements; + } + return this.getPageLength(); + }, + set: function (value) { + this.pageInfo.totalElements = value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PaginatedList.prototype, "totalPages", { + get: function () { + if (hasValue(this.pageInfo) && hasValue(this.pageInfo.totalPages)) { + return this.pageInfo.totalPages; + } + return 1; + }, + set: function (value) { + this.pageInfo.totalPages = value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PaginatedList.prototype, "currentPage", { + get: function () { + if (hasValue(this.pageInfo) && hasValue(this.pageInfo.currentPage)) { + return this.pageInfo.currentPage; + } + return 1; + }, + set: function (value) { + this.pageInfo.currentPage = value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PaginatedList.prototype, "first", { + get: function () { + return this.pageInfo.first; + }, + set: function (first) { + this.pageInfo.first = first; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PaginatedList.prototype, "prev", { + get: function () { + return this.pageInfo.prev; + }, + set: function (prev) { + this.pageInfo.prev = prev; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PaginatedList.prototype, "next", { + get: function () { + return this.pageInfo.next; + }, + set: function (next) { + this.pageInfo.next = next; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PaginatedList.prototype, "last", { + get: function () { + return this.pageInfo.last; + }, + set: function (last) { + this.pageInfo.last = last; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PaginatedList.prototype, "self", { + get: function () { + return this.pageInfo.self; + }, + set: function (self) { + this.pageInfo.self = self; + }, + enumerable: true, + configurable: true + }); + PaginatedList.prototype.getPageLength = function () { + return (Array.isArray(this.page)) ? this.page.length : 0; + }; + return PaginatedList; +}()); +export { PaginatedList }; +//# sourceMappingURL=paginated-list.js.map \ No newline at end of file diff --git a/src/app/core/data/paginated-list.js.map b/src/app/core/data/paginated-list.js.map new file mode 100644 index 0000000000..785782e72a --- /dev/null +++ b/src/app/core/data/paginated-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"paginated-list.js","sourceRoot":"","sources":["paginated-list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD;IAEE,uBAAoB,QAAkB,EACnB,IAAS;QADR,aAAQ,GAAR,QAAQ,CAAU;QACnB,SAAI,GAAJ,IAAI,CAAK;IAC5B,CAAC;IAED,sBAAI,0CAAe;aAAnB;YACE,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBACtE,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;aACtC;YACD,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;QAC9B,CAAC;aAED,UAAoB,KAAa;YAC/B,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,KAAK,CAAC;QACxC,CAAC;;;OAJA;IAMD,sBAAI,wCAAa;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B,CAAC;aACD,UAAS,IAAY;YACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;QAC5B,CAAC;;;OAHA;IAKD,sBAAI,+BAAI;aAAR;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC5B,CAAC;aAED,UAAS,IAAY;YACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;QAC5B,CAAC;;;OAJA;IAMD,sBAAI,+BAAI;aAAR;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC5B,CAAC;aAED,UAAS,IAAY;YACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;QAC5B,CAAC;;;OAJA;IAMD,sBAAI,+BAAI;aAAR;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC5B,CAAC;aAED,UAAS,IAAY;YACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;QAC5B,CAAC;;;OAJA;IAMS,qCAAa,GAAvB;QACE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC;IACH,oBAAC;AAAD,CAAC,AA5FD,IA4FC"} \ No newline at end of file diff --git a/src/app/core/data/parsing.service.js b/src/app/core/data/parsing.service.js new file mode 100644 index 0000000000..31f910aaf5 --- /dev/null +++ b/src/app/core/data/parsing.service.js @@ -0,0 +1 @@ +//# sourceMappingURL=parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/parsing.service.js.map b/src/app/core/data/parsing.service.js.map new file mode 100644 index 0000000000..51f1b25d03 --- /dev/null +++ b/src/app/core/data/parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parsing.service.js","sourceRoot":"","sources":["parsing.service.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/core/data/registry-bitstreamformats-response-parsing.service.js b/src/app/core/data/registry-bitstreamformats-response-parsing.service.js new file mode 100644 index 0000000000..a9eb44b069 --- /dev/null +++ b/src/app/core/data/registry-bitstreamformats-response-parsing.service.js @@ -0,0 +1,25 @@ +import * as tslib_1 from "tslib"; +import { RegistryBitstreamformatsSuccessResponse } from '../cache/response.models'; +import { RegistryBitstreamformatsResponse } from '../registry/registry-bitstreamformats-response.model'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { DSOResponseParsingService } from './dso-response-parsing.service'; +import { Injectable } from '@angular/core'; +var RegistryBitstreamformatsResponseParsingService = /** @class */ (function () { + function RegistryBitstreamformatsResponseParsingService(dsoParser) { + this.dsoParser = dsoParser; + } + RegistryBitstreamformatsResponseParsingService.prototype.parse = function (request, data) { + var payload = data.payload; + var bitstreamformats = payload._embedded.bitstreamformats; + payload.bitstreamformats = bitstreamformats; + var deserialized = new DSpaceRESTv2Serializer(RegistryBitstreamformatsResponse).deserialize(payload); + return new RegistryBitstreamformatsSuccessResponse(deserialized, data.statusCode, data.statusText, this.dsoParser.processPageInfo(data.payload.page)); + }; + RegistryBitstreamformatsResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [DSOResponseParsingService]) + ], RegistryBitstreamformatsResponseParsingService); + return RegistryBitstreamformatsResponseParsingService; +}()); +export { RegistryBitstreamformatsResponseParsingService }; +//# sourceMappingURL=registry-bitstreamformats-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/registry-bitstreamformats-response-parsing.service.js.map b/src/app/core/data/registry-bitstreamformats-response-parsing.service.js.map new file mode 100644 index 0000000000..949f80e28a --- /dev/null +++ b/src/app/core/data/registry-bitstreamformats-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"registry-bitstreamformats-response-parsing.service.js","sourceRoot":"","sources":["registry-bitstreamformats-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uCAAuC,EAAgB,MAAM,0BAA0B,CAAC;AACjG,OAAO,EAAE,gCAAgC,EAAE,MAAM,sDAAsD,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAGrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C;IACE,wDAAoB,SAAoC;QAApC,cAAS,GAAT,SAAS,CAA2B;IACxD,CAAC;IAED,8DAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QACpD,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAM,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC;QAC5D,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QAE5C,IAAM,YAAY,GAAG,IAAI,sBAAsB,CAAC,gCAAgC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACvG,OAAO,IAAI,uCAAuC,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACxJ,CAAC;IAZU,8CAA8C;QAD1D,UAAU,EAAE;iDAEoB,yBAAyB;OAD7C,8CAA8C,CAc1D;IAAD,qDAAC;CAAA,AAdD,IAcC;SAdY,8CAA8C"} \ No newline at end of file diff --git a/src/app/core/data/registry-metadatafields-response-parsing.service.js b/src/app/core/data/registry-metadatafields-response-parsing.service.js new file mode 100644 index 0000000000..e18cc90082 --- /dev/null +++ b/src/app/core/data/registry-metadatafields-response-parsing.service.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { RegistryMetadatafieldsSuccessResponse } from '../cache/response.models'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { DSOResponseParsingService } from './dso-response-parsing.service'; +import { Injectable } from '@angular/core'; +import { RegistryMetadatafieldsResponse } from '../registry/registry-metadatafields-response.model'; +import { hasValue } from '../../shared/empty.util'; +var RegistryMetadatafieldsResponseParsingService = /** @class */ (function () { + function RegistryMetadatafieldsResponseParsingService(dsoParser) { + this.dsoParser = dsoParser; + } + RegistryMetadatafieldsResponseParsingService.prototype.parse = function (request, data) { + var payload = data.payload; + var metadatafields = []; + if (hasValue(payload._embedded)) { + metadatafields = payload._embedded.metadatafields; + metadatafields.forEach(function (field) { + field.schema = field._embedded.schema; + }); + } + payload.metadatafields = metadatafields; + var deserialized = new DSpaceRESTv2Serializer(RegistryMetadatafieldsResponse).deserialize(payload); + return new RegistryMetadatafieldsSuccessResponse(deserialized, data.statusCode, data.statusText, this.dsoParser.processPageInfo(data.payload)); + }; + RegistryMetadatafieldsResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [DSOResponseParsingService]) + ], RegistryMetadatafieldsResponseParsingService); + return RegistryMetadatafieldsResponseParsingService; +}()); +export { RegistryMetadatafieldsResponseParsingService }; +//# sourceMappingURL=registry-metadatafields-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/registry-metadatafields-response-parsing.service.js.map b/src/app/core/data/registry-metadatafields-response-parsing.service.js.map new file mode 100644 index 0000000000..fb37789d6e --- /dev/null +++ b/src/app/core/data/registry-metadatafields-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"registry-metadatafields-response-parsing.service.js","sourceRoot":"","sources":["registry-metadatafields-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,qCAAqC,EAEtC,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGnD;IACE,sDAAoB,SAAoC;QAApC,cAAS,GAAT,SAAS,CAA2B;IACxD,CAAC;IAED,4DAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QACpD,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,cAAc,GAAG,EAAE,CAAC;QAExB,IAAI,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YAC/B,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC;YAClD,cAAc,CAAC,OAAO,CAAC,UAAC,KAAK;gBAC3B,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;YACxC,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC;QAExC,IAAM,YAAY,GAAG,IAAI,sBAAsB,CAAC,8BAA8B,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACrG,OAAO,IAAI,qCAAqC,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACjJ,CAAC;IApBU,4CAA4C;QADxD,UAAU,EAAE;iDAEoB,yBAAyB;OAD7C,4CAA4C,CAsBxD;IAAD,mDAAC;CAAA,AAtBD,IAsBC;SAtBY,4CAA4C"} \ No newline at end of file diff --git a/src/app/core/data/registry-metadataschemas-response-parsing.service.js b/src/app/core/data/registry-metadataschemas-response-parsing.service.js new file mode 100644 index 0000000000..ed18663914 --- /dev/null +++ b/src/app/core/data/registry-metadataschemas-response-parsing.service.js @@ -0,0 +1,29 @@ +import * as tslib_1 from "tslib"; +import { RegistryMetadataschemasSuccessResponse } from '../cache/response.models'; +import { RegistryMetadataschemasResponse } from '../registry/registry-metadataschemas-response.model'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { DSOResponseParsingService } from './dso-response-parsing.service'; +import { Injectable } from '@angular/core'; +import { hasValue } from '../../shared/empty.util'; +var RegistryMetadataschemasResponseParsingService = /** @class */ (function () { + function RegistryMetadataschemasResponseParsingService(dsoParser) { + this.dsoParser = dsoParser; + } + RegistryMetadataschemasResponseParsingService.prototype.parse = function (request, data) { + var payload = data.payload; + var metadataschemas = []; + if (hasValue(payload._embedded)) { + metadataschemas = payload._embedded.metadataschemas; + } + payload.metadataschemas = metadataschemas; + var deserialized = new DSpaceRESTv2Serializer(RegistryMetadataschemasResponse).deserialize(payload); + return new RegistryMetadataschemasSuccessResponse(deserialized, data.statusCode, data.statusText, this.dsoParser.processPageInfo(data.payload)); + }; + RegistryMetadataschemasResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [DSOResponseParsingService]) + ], RegistryMetadataschemasResponseParsingService); + return RegistryMetadataschemasResponseParsingService; +}()); +export { RegistryMetadataschemasResponseParsingService }; +//# sourceMappingURL=registry-metadataschemas-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/registry-metadataschemas-response-parsing.service.js.map b/src/app/core/data/registry-metadataschemas-response-parsing.service.js.map new file mode 100644 index 0000000000..a2e5eb29e1 --- /dev/null +++ b/src/app/core/data/registry-metadataschemas-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"registry-metadataschemas-response-parsing.service.js","sourceRoot":"","sources":["registry-metadataschemas-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sCAAsC,EAAgB,MAAM,0BAA0B,CAAC;AAIhG,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGnD;IACE,uDAAoB,SAAoC;QAApC,cAAS,GAAT,SAAS,CAA2B;IACxD,CAAC;IAED,6DAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QACpD,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,eAAe,GAAG,EAAE,CAAC;QACzB,IAAI,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YAC/B,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC;SACrD;QACD,OAAO,CAAC,eAAe,GAAG,eAAe,CAAC;QAE1C,IAAM,YAAY,GAAG,IAAI,sBAAsB,CAAC,+BAA+B,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACtG,OAAO,IAAI,sCAAsC,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClJ,CAAC;IAfU,6CAA6C;QADzD,UAAU,EAAE;iDAEoB,yBAAyB;OAD7C,6CAA6C,CAiBzD;IAAD,oDAAC;CAAA,AAjBD,IAiBC;SAjBY,6CAA6C"} \ No newline at end of file diff --git a/src/app/core/data/remote-data-error.js b/src/app/core/data/remote-data-error.js new file mode 100644 index 0000000000..7c20bd85c3 --- /dev/null +++ b/src/app/core/data/remote-data-error.js @@ -0,0 +1,10 @@ +var RemoteDataError = /** @class */ (function () { + function RemoteDataError(statusCode, statusText, message) { + this.statusCode = statusCode; + this.statusText = statusText; + this.message = message; + } + return RemoteDataError; +}()); +export { RemoteDataError }; +//# sourceMappingURL=remote-data-error.js.map \ No newline at end of file diff --git a/src/app/core/data/remote-data-error.js.map b/src/app/core/data/remote-data-error.js.map new file mode 100644 index 0000000000..cd2f0c1e5e --- /dev/null +++ b/src/app/core/data/remote-data-error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"remote-data-error.js","sourceRoot":"","sources":["remote-data-error.ts"],"names":[],"mappings":"AAAA;IACE,yBACS,UAAkB,EAClB,UAAkB,EAClB,OAAe;QAFf,eAAU,GAAV,UAAU,CAAQ;QAClB,eAAU,GAAV,UAAU,CAAQ;QAClB,YAAO,GAAP,OAAO,CAAQ;IAExB,CAAC;IACH,sBAAC;AAAD,CAAC,AAPD,IAOC"} \ No newline at end of file diff --git a/src/app/core/data/remote-data.js b/src/app/core/data/remote-data.js new file mode 100644 index 0000000000..bdb18de353 --- /dev/null +++ b/src/app/core/data/remote-data.js @@ -0,0 +1,77 @@ +import { hasValue } from '../../shared/empty.util'; +export var RemoteDataState; +(function (RemoteDataState) { + RemoteDataState["RequestPending"] = "RequestPending"; + RemoteDataState["ResponsePending"] = "ResponsePending"; + RemoteDataState["Failed"] = "Failed"; + RemoteDataState["Success"] = "Success"; +})(RemoteDataState || (RemoteDataState = {})); +/** + * A class to represent the state of a remote resource + */ +var RemoteData = /** @class */ (function () { + function RemoteData(requestPending, responsePending, isSuccessful, error, payload) { + this.requestPending = requestPending; + this.responsePending = responsePending; + this.isSuccessful = isSuccessful; + this.error = error; + this.payload = payload; + } + Object.defineProperty(RemoteData.prototype, "state", { + get: function () { + if (this.isSuccessful === true && hasValue(this.payload)) { + return RemoteDataState.Success; + } + else if (this.isSuccessful === false) { + return RemoteDataState.Failed; + } + else if (this.requestPending === true) { + return RemoteDataState.RequestPending; + } + else { + return RemoteDataState.ResponsePending; + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RemoteData.prototype, "isRequestPending", { + get: function () { + return this.state === RemoteDataState.RequestPending; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RemoteData.prototype, "isResponsePending", { + get: function () { + return this.state === RemoteDataState.ResponsePending; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RemoteData.prototype, "isLoading", { + get: function () { + return this.state === RemoteDataState.RequestPending + || this.state === RemoteDataState.ResponsePending; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RemoteData.prototype, "hasFailed", { + get: function () { + return this.state === RemoteDataState.Failed; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RemoteData.prototype, "hasSucceeded", { + get: function () { + return this.state === RemoteDataState.Success; + }, + enumerable: true, + configurable: true + }); + return RemoteData; +}()); +export { RemoteData }; +//# sourceMappingURL=remote-data.js.map \ No newline at end of file diff --git a/src/app/core/data/remote-data.js.map b/src/app/core/data/remote-data.js.map new file mode 100644 index 0000000000..9b0161dd69 --- /dev/null +++ b/src/app/core/data/remote-data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"remote-data.js","sourceRoot":"","sources":["remote-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGnD,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,oDAAiC,CAAA;IACjC,sDAAmC,CAAA;IACnC,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;AACrB,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAED;;GAEG;AACH;IACE,oBACU,cAAuB,EACvB,eAAwB,EACxB,YAAqB,EACtB,KAAsB,EACtB,OAAU;QAJT,mBAAc,GAAd,cAAc,CAAS;QACvB,oBAAe,GAAf,eAAe,CAAS;QACxB,iBAAY,GAAZ,YAAY,CAAS;QACtB,UAAK,GAAL,KAAK,CAAiB;QACtB,YAAO,GAAP,OAAO,CAAG;IAEnB,CAAC;IAED,sBAAI,6BAAK;aAAT;YACE,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;gBACxD,OAAO,eAAe,CAAC,OAAO,CAAA;aAC/B;iBAAM,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE;gBACtC,OAAO,eAAe,CAAC,MAAM,CAAA;aAC9B;iBAAM,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,EAAE;gBACvC,OAAO,eAAe,CAAC,cAAc,CAAA;aACtC;iBAAM;gBACL,OAAO,eAAe,CAAC,eAAe,CAAA;aACvC;QACH,CAAC;;;OAAA;IAED,sBAAI,wCAAgB;aAApB;YACE,OAAO,IAAI,CAAC,KAAK,KAAK,eAAe,CAAC,cAAc,CAAC;QACvD,CAAC;;;OAAA;IAED,sBAAI,yCAAiB;aAArB;YACE,OAAO,IAAI,CAAC,KAAK,KAAK,eAAe,CAAC,eAAe,CAAC;QACxD,CAAC;;;OAAA;IAED,sBAAI,iCAAS;aAAb;YACE,OAAO,IAAI,CAAC,KAAK,KAAK,eAAe,CAAC,cAAc;mBAC/C,IAAI,CAAC,KAAK,KAAK,eAAe,CAAC,eAAe,CAAC;QACtD,CAAC;;;OAAA;IAED,sBAAI,iCAAS;aAAb;YACE,OAAO,IAAI,CAAC,KAAK,KAAK,eAAe,CAAC,MAAM,CAAC;QAC/C,CAAC;;;OAAA;IAED,sBAAI,oCAAY;aAAhB;YACE,OAAO,IAAI,CAAC,KAAK,KAAK,eAAe,CAAC,OAAO,CAAC;QAChD,CAAC;;;OAAA;IAEH,iBAAC;AAAD,CAAC,AA3CD,IA2CC"} \ No newline at end of file diff --git a/src/app/core/data/request.actions.js b/src/app/core/data/request.actions.js new file mode 100644 index 0000000000..3f49f58b47 --- /dev/null +++ b/src/app/core/data/request.actions.js @@ -0,0 +1,89 @@ +import { type } from '../../shared/ngrx/type'; +/** + * The list of RequestAction type definitions + */ +export var RequestActionTypes = { + CONFIGURE: type('dspace/core/data/request/CONFIGURE'), + EXECUTE: type('dspace/core/data/request/EXECUTE'), + COMPLETE: type('dspace/core/data/request/COMPLETE'), + RESET_TIMESTAMPS: type('dspace/core/data/request/RESET_TIMESTAMPS'), + REMOVE: type('dspace/core/data/request/REMOVE') +}; +/* tslint:disable:max-classes-per-file */ +var RequestConfigureAction = /** @class */ (function () { + function RequestConfigureAction(request) { + this.type = RequestActionTypes.CONFIGURE; + this.payload = request; + } + return RequestConfigureAction; +}()); +export { RequestConfigureAction }; +var RequestExecuteAction = /** @class */ (function () { + /** + * Create a new RequestExecuteAction + * + * @param uuid + * the request's uuid + */ + function RequestExecuteAction(uuid) { + this.type = RequestActionTypes.EXECUTE; + this.payload = uuid; + } + return RequestExecuteAction; +}()); +export { RequestExecuteAction }; +/** + * An ngrx action to indicate a response was returned + */ +var RequestCompleteAction = /** @class */ (function () { + /** + * Create a new RequestCompleteAction + * + * @param uuid + * the request's uuid + */ + function RequestCompleteAction(uuid, response) { + this.type = RequestActionTypes.COMPLETE; + this.payload = { + uuid: uuid, + response: response + }; + } + return RequestCompleteAction; +}()); +export { RequestCompleteAction }; +/** + * An ngrx action to reset the timeAdded property of all responses in the cached objects + */ +var ResetResponseTimestampsAction = /** @class */ (function () { + /** + * Create a new ResetResponseTimestampsAction + * + * @param newTimestamp + * the new timeAdded all objects should get + */ + function ResetResponseTimestampsAction(newTimestamp) { + this.type = RequestActionTypes.RESET_TIMESTAMPS; + this.payload = newTimestamp; + } + return ResetResponseTimestampsAction; +}()); +export { ResetResponseTimestampsAction }; +/** + * An ngrx action to remove a cached request + */ +var RequestRemoveAction = /** @class */ (function () { + /** + * Create a new RequestRemoveAction + * + * @param uuid + * the request's uuid + */ + function RequestRemoveAction(uuid) { + this.type = RequestActionTypes.REMOVE; + this.uuid = uuid; + } + return RequestRemoveAction; +}()); +export { RequestRemoveAction }; +//# sourceMappingURL=request.actions.js.map \ No newline at end of file diff --git a/src/app/core/data/request.actions.js.map b/src/app/core/data/request.actions.js.map new file mode 100644 index 0000000000..19efc211e6 --- /dev/null +++ b/src/app/core/data/request.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"request.actions.js","sourceRoot":"","sources":["request.actions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAI9C;;GAEG;AACH,MAAM,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,IAaC"} \ No newline at end of file diff --git a/src/app/core/data/request.effects.js b/src/app/core/data/request.effects.js new file mode 100644 index 0000000000..931aab0a54 --- /dev/null +++ b/src/app/core/data/request.effects.js @@ -0,0 +1,71 @@ +import * as tslib_1 from "tslib"; +import { of as observableOf } from 'rxjs'; +import { Inject, Injectable, Injector } from '@angular/core'; +import { Actions, Effect, ofType } from '@ngrx/effects'; +import { GLOBAL_CONFIG } from '../../../config'; +import { hasValue, isNotEmpty } from '../../shared/empty.util'; +import { DSpaceRESTv2Service } from '../dspace-rest-v2/dspace-rest-v2.service'; +import { RequestActionTypes, RequestCompleteAction, ResetResponseTimestampsAction } from './request.actions'; +import { RequestService } from './request.service'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory'; +import { catchError, filter, flatMap, map, take } from 'rxjs/operators'; +import { ErrorResponse } from '../cache/response.models'; +import { StoreActionTypes } from '../../store.actions'; +export var addToResponseCacheAndCompleteAction = function (request, envConfig) { + return function (source) { + return source.pipe(map(function (response) { + return new RequestCompleteAction(request.uuid, response); + })); + }; +}; +var RequestEffects = /** @class */ (function () { + function RequestEffects(EnvConfig, actions$, restApi, injector, requestService) { + var _this = this; + this.EnvConfig = EnvConfig; + this.actions$ = actions$; + this.restApi = restApi; + this.injector = injector; + this.requestService = requestService; + this.execute = this.actions$.pipe(ofType(RequestActionTypes.EXECUTE), flatMap(function (action) { + return _this.requestService.getByUUID(action.payload).pipe(take(1)); + }), filter(function (entry) { return hasValue(entry); }), map(function (entry) { return entry.request; }), flatMap(function (request) { + var body; + if (isNotEmpty(request.body)) { + var serializer = new DSpaceRESTv2Serializer(NormalizedObjectFactory.getConstructor(request.body.type)); + body = serializer.serialize(request.body); + } + return _this.restApi.request(request.method, request.href, body, request.options).pipe(map(function (data) { return _this.injector.get(request.getResponseParser()).parse(request, data); }), addToResponseCacheAndCompleteAction(request, _this.EnvConfig), catchError(function (error) { return observableOf(new ErrorResponse(error)).pipe(addToResponseCacheAndCompleteAction(request, _this.EnvConfig)); })); + })); + /** + * When the store is rehydrated in the browser, set all cache + * timestamps to 'now', because the time zone of the server can + * differ from the client. + * + * This assumes that the server cached everything a negligible + * time ago, and will likely need to be revisited later + */ + this.fixTimestampsOnRehydrate = this.actions$ + .pipe(ofType(StoreActionTypes.REHYDRATE), map(function () { return new ResetResponseTimestampsAction(new Date().getTime()); })); + } + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], RequestEffects.prototype, "execute", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], RequestEffects.prototype, "fixTimestampsOnRehydrate", void 0); + RequestEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, Actions, + DSpaceRESTv2Service, + Injector, + RequestService]) + ], RequestEffects); + return RequestEffects; +}()); +export { RequestEffects }; +/* tslint:enable:max-classes-per-file */ +//# sourceMappingURL=request.effects.js.map \ No newline at end of file diff --git a/src/app/core/data/request.effects.js.map b/src/app/core/data/request.effects.js.map new file mode 100644 index 0000000000..519047c10e --- /dev/null +++ b/src/app/core/data/request.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"request.effects.js","sourceRoot":"","sources":["request.effects.ts"],"names":[],"mappings":";AAAA,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,aAAa,EAAgB,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;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AAG,CAAC,cAAM,OAAA,IAAI,6BAA6B,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,EAAvD,CAAuD,CAAC,CACnE,CAAC;IAQA,CAAC;IA5CK;QAAT,MAAM,EAAE;;mDAuBP;IAUQ;QAAT,MAAM,EAAE;;oEAGL;IAtCO,cAAc;QAD1B,UAAU,EAAE;QA0CR,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACJ,OAAO;YACR,mBAAmB;YAClB,QAAQ;YACA,cAAc;OA7C/B,cAAc,CAgD1B;IAAD,qBAAC;CAAA,AAhDD,IAgDC;SAhDY,cAAc;AAiD3B,wCAAwC"} \ No newline at end of file diff --git a/src/app/core/data/request.models.js b/src/app/core/data/request.models.js new file mode 100644 index 0000000000..017116975d --- /dev/null +++ b/src/app/core/data/request.models.js @@ -0,0 +1,478 @@ +import * as tslib_1 from "tslib"; +import { BrowseEntriesResponseParsingService } from './browse-entries-response-parsing.service'; +import { DSOResponseParsingService } from './dso-response-parsing.service'; +import { EndpointMapResponseParsingService } from './endpoint-map-response-parsing.service'; +import { BrowseResponseParsingService } from './browse-response-parsing.service'; +import { ConfigResponseParsingService } from '../config/config-response-parsing.service'; +import { AuthResponseParsingService } from '../auth/auth-response-parsing.service'; +import { SubmissionResponseParsingService } from '../submission/submission-response-parsing.service'; +import { IntegrationResponseParsingService } from '../integration/integration-response-parsing.service'; +import { RestRequestMethod } from './rest-request-method'; +import { EpersonResponseParsingService } from '../eperson/eperson-response-parsing.service'; +import { BrowseItemsResponseParsingService } from './browse-items-response-parsing-service'; +import { MetadataschemaParsingService } from './metadataschema-parsing.service'; +import { MetadatafieldParsingService } from './metadatafield-parsing.service'; +import { URLCombiner } from '../url-combiner/url-combiner'; +import { TaskResponseParsingService } from '../tasks/task-response-parsing.service'; +/* tslint:disable:max-classes-per-file */ +var RestRequest = /** @class */ (function () { + function RestRequest(uuid, href, method, body, options) { + if (method === void 0) { method = RestRequestMethod.GET; } + this.uuid = uuid; + this.href = href; + this.method = method; + this.body = body; + this.options = options; + this.responseMsToLive = 0; + } + RestRequest.prototype.getResponseParser = function () { + return DSOResponseParsingService; + }; + Object.defineProperty(RestRequest.prototype, "toCache", { + get: function () { + return this.responseMsToLive > 0; + }, + enumerable: true, + configurable: true + }); + return RestRequest; +}()); +export { RestRequest }; +var GetRequest = /** @class */ (function (_super) { + tslib_1.__extends(GetRequest, _super); + function GetRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, RestRequestMethod.GET, body, options) || this; + _this.uuid = uuid; + _this.href = href; + _this.body = body; + _this.options = options; + _this.responseMsToLive = 60 * 15 * 1000; + return _this; + } + return GetRequest; +}(RestRequest)); +export { GetRequest }; +var PostRequest = /** @class */ (function (_super) { + tslib_1.__extends(PostRequest, _super); + function PostRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, RestRequestMethod.POST, body) || this; + _this.uuid = uuid; + _this.href = href; + _this.body = body; + _this.options = options; + return _this; + } + return PostRequest; +}(RestRequest)); +export { PostRequest }; +var PutRequest = /** @class */ (function (_super) { + tslib_1.__extends(PutRequest, _super); + function PutRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, RestRequestMethod.PUT, body) || this; + _this.uuid = uuid; + _this.href = href; + _this.body = body; + _this.options = options; + return _this; + } + return PutRequest; +}(RestRequest)); +export { PutRequest }; +var DeleteRequest = /** @class */ (function (_super) { + tslib_1.__extends(DeleteRequest, _super); + function DeleteRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, RestRequestMethod.DELETE, body) || this; + _this.uuid = uuid; + _this.href = href; + _this.body = body; + _this.options = options; + return _this; + } + return DeleteRequest; +}(RestRequest)); +export { DeleteRequest }; +var OptionsRequest = /** @class */ (function (_super) { + tslib_1.__extends(OptionsRequest, _super); + function OptionsRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, RestRequestMethod.OPTIONS, body) || this; + _this.uuid = uuid; + _this.href = href; + _this.body = body; + _this.options = options; + return _this; + } + return OptionsRequest; +}(RestRequest)); +export { OptionsRequest }; +var HeadRequest = /** @class */ (function (_super) { + tslib_1.__extends(HeadRequest, _super); + function HeadRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, RestRequestMethod.HEAD, body) || this; + _this.uuid = uuid; + _this.href = href; + _this.body = body; + _this.options = options; + return _this; + } + return HeadRequest; +}(RestRequest)); +export { HeadRequest }; +var PatchRequest = /** @class */ (function (_super) { + tslib_1.__extends(PatchRequest, _super); + function PatchRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, RestRequestMethod.PATCH, body) || this; + _this.uuid = uuid; + _this.href = href; + _this.body = body; + _this.options = options; + return _this; + } + return PatchRequest; +}(RestRequest)); +export { PatchRequest }; +var FindByIDRequest = /** @class */ (function (_super) { + tslib_1.__extends(FindByIDRequest, _super); + function FindByIDRequest(uuid, href, resourceID) { + var _this = _super.call(this, uuid, href) || this; + _this.resourceID = resourceID; + return _this; + } + return FindByIDRequest; +}(GetRequest)); +export { FindByIDRequest }; +var FindAllOptions = /** @class */ (function () { + function FindAllOptions() { + } + return FindAllOptions; +}()); +export { FindAllOptions }; +var FindAllRequest = /** @class */ (function (_super) { + tslib_1.__extends(FindAllRequest, _super); + function FindAllRequest(uuid, href, body) { + var _this = _super.call(this, uuid, href) || this; + _this.body = body; + return _this; + } + return FindAllRequest; +}(GetRequest)); +export { FindAllRequest }; +var EndpointMapRequest = /** @class */ (function (_super) { + tslib_1.__extends(EndpointMapRequest, _super); + function EndpointMapRequest(uuid, href, body) { + return _super.call(this, uuid, new URLCombiner(href, '?endpointMap').toString(), body) || this; + } + EndpointMapRequest.prototype.getResponseParser = function () { + return EndpointMapResponseParsingService; + }; + return EndpointMapRequest; +}(GetRequest)); +export { EndpointMapRequest }; +var BrowseEndpointRequest = /** @class */ (function (_super) { + tslib_1.__extends(BrowseEndpointRequest, _super); + function BrowseEndpointRequest(uuid, href) { + return _super.call(this, uuid, href) || this; + } + BrowseEndpointRequest.prototype.getResponseParser = function () { + return BrowseResponseParsingService; + }; + return BrowseEndpointRequest; +}(GetRequest)); +export { BrowseEndpointRequest }; +var BrowseEntriesRequest = /** @class */ (function (_super) { + tslib_1.__extends(BrowseEntriesRequest, _super); + function BrowseEntriesRequest() { + return _super !== null && _super.apply(this, arguments) || this; + } + BrowseEntriesRequest.prototype.getResponseParser = function () { + return BrowseEntriesResponseParsingService; + }; + return BrowseEntriesRequest; +}(GetRequest)); +export { BrowseEntriesRequest }; +var BrowseItemsRequest = /** @class */ (function (_super) { + tslib_1.__extends(BrowseItemsRequest, _super); + function BrowseItemsRequest() { + return _super !== null && _super.apply(this, arguments) || this; + } + BrowseItemsRequest.prototype.getResponseParser = function () { + return BrowseItemsResponseParsingService; + }; + return BrowseItemsRequest; +}(GetRequest)); +export { BrowseItemsRequest }; +var ConfigRequest = /** @class */ (function (_super) { + tslib_1.__extends(ConfigRequest, _super); + function ConfigRequest(uuid, href, options) { + var _this = _super.call(this, uuid, href, null, options) || this; + _this.options = options; + return _this; + } + ConfigRequest.prototype.getResponseParser = function () { + return ConfigResponseParsingService; + }; + return ConfigRequest; +}(GetRequest)); +export { ConfigRequest }; +var AuthPostRequest = /** @class */ (function (_super) { + tslib_1.__extends(AuthPostRequest, _super); + function AuthPostRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, body, options) || this; + _this.body = body; + _this.options = options; + return _this; + } + AuthPostRequest.prototype.getResponseParser = function () { + return AuthResponseParsingService; + }; + return AuthPostRequest; +}(PostRequest)); +export { AuthPostRequest }; +var AuthGetRequest = /** @class */ (function (_super) { + tslib_1.__extends(AuthGetRequest, _super); + function AuthGetRequest(uuid, href, options) { + var _this = _super.call(this, uuid, href, null, options) || this; + _this.options = options; + return _this; + } + AuthGetRequest.prototype.getResponseParser = function () { + return AuthResponseParsingService; + }; + return AuthGetRequest; +}(GetRequest)); +export { AuthGetRequest }; +var IntegrationRequest = /** @class */ (function (_super) { + tslib_1.__extends(IntegrationRequest, _super); + function IntegrationRequest(uuid, href) { + return _super.call(this, uuid, href) || this; + } + IntegrationRequest.prototype.getResponseParser = function () { + return IntegrationResponseParsingService; + }; + return IntegrationRequest; +}(GetRequest)); +export { IntegrationRequest }; +/** + * Request to create a MetadataSchema + */ +var CreateMetadataSchemaRequest = /** @class */ (function (_super) { + tslib_1.__extends(CreateMetadataSchemaRequest, _super); + function CreateMetadataSchemaRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, body, options) || this; + _this.body = body; + _this.options = options; + return _this; + } + CreateMetadataSchemaRequest.prototype.getResponseParser = function () { + return MetadataschemaParsingService; + }; + return CreateMetadataSchemaRequest; +}(PostRequest)); +export { CreateMetadataSchemaRequest }; +/** + * Request to update a MetadataSchema + */ +var UpdateMetadataSchemaRequest = /** @class */ (function (_super) { + tslib_1.__extends(UpdateMetadataSchemaRequest, _super); + function UpdateMetadataSchemaRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, body, options) || this; + _this.body = body; + _this.options = options; + return _this; + } + UpdateMetadataSchemaRequest.prototype.getResponseParser = function () { + return MetadataschemaParsingService; + }; + return UpdateMetadataSchemaRequest; +}(PutRequest)); +export { UpdateMetadataSchemaRequest }; +/** + * Request to create a MetadataField + */ +var CreateMetadataFieldRequest = /** @class */ (function (_super) { + tslib_1.__extends(CreateMetadataFieldRequest, _super); + function CreateMetadataFieldRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, body, options) || this; + _this.body = body; + _this.options = options; + return _this; + } + CreateMetadataFieldRequest.prototype.getResponseParser = function () { + return MetadatafieldParsingService; + }; + return CreateMetadataFieldRequest; +}(PostRequest)); +export { CreateMetadataFieldRequest }; +/** + * Request to update a MetadataField + */ +var UpdateMetadataFieldRequest = /** @class */ (function (_super) { + tslib_1.__extends(UpdateMetadataFieldRequest, _super); + function UpdateMetadataFieldRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, body, options) || this; + _this.body = body; + _this.options = options; + return _this; + } + UpdateMetadataFieldRequest.prototype.getResponseParser = function () { + return MetadatafieldParsingService; + }; + return UpdateMetadataFieldRequest; +}(PutRequest)); +export { UpdateMetadataFieldRequest }; +/** + * Class representing a submission HTTP GET request object + */ +var SubmissionRequest = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionRequest, _super); + function SubmissionRequest(uuid, href) { + return _super.call(this, uuid, href) || this; + } + SubmissionRequest.prototype.getResponseParser = function () { + return SubmissionResponseParsingService; + }; + return SubmissionRequest; +}(GetRequest)); +export { SubmissionRequest }; +/** + * Class representing a submission HTTP DELETE request object + */ +var SubmissionDeleteRequest = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionDeleteRequest, _super); + function SubmissionDeleteRequest(uuid, href) { + var _this = _super.call(this, uuid, href) || this; + _this.uuid = uuid; + _this.href = href; + return _this; + } + SubmissionDeleteRequest.prototype.getResponseParser = function () { + return SubmissionResponseParsingService; + }; + return SubmissionDeleteRequest; +}(DeleteRequest)); +export { SubmissionDeleteRequest }; +/** + * Class representing a submission HTTP PATCH request object + */ +var SubmissionPatchRequest = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionPatchRequest, _super); + function SubmissionPatchRequest(uuid, href, body) { + var _this = _super.call(this, uuid, href, body) || this; + _this.uuid = uuid; + _this.href = href; + _this.body = body; + return _this; + } + SubmissionPatchRequest.prototype.getResponseParser = function () { + return SubmissionResponseParsingService; + }; + return SubmissionPatchRequest; +}(PatchRequest)); +export { SubmissionPatchRequest }; +/** + * Class representing a submission HTTP POST request object + */ +var SubmissionPostRequest = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionPostRequest, _super); + function SubmissionPostRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, body, options) || this; + _this.uuid = uuid; + _this.href = href; + _this.body = body; + _this.options = options; + return _this; + } + SubmissionPostRequest.prototype.getResponseParser = function () { + return SubmissionResponseParsingService; + }; + return SubmissionPostRequest; +}(PostRequest)); +export { SubmissionPostRequest }; +/** + * Class representing an eperson HTTP GET request object + */ +var EpersonRequest = /** @class */ (function (_super) { + tslib_1.__extends(EpersonRequest, _super); + function EpersonRequest(uuid, href) { + return _super.call(this, uuid, href) || this; + } + EpersonRequest.prototype.getResponseParser = function () { + return EpersonResponseParsingService; + }; + return EpersonRequest; +}(GetRequest)); +export { EpersonRequest }; +var CreateRequest = /** @class */ (function (_super) { + tslib_1.__extends(CreateRequest, _super); + function CreateRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, body, options) || this; + _this.body = body; + _this.options = options; + return _this; + } + CreateRequest.prototype.getResponseParser = function () { + return DSOResponseParsingService; + }; + return CreateRequest; +}(PostRequest)); +export { CreateRequest }; +/** + * Request to delete an object based on its identifier + */ +var DeleteByIDRequest = /** @class */ (function (_super) { + tslib_1.__extends(DeleteByIDRequest, _super); + function DeleteByIDRequest(uuid, href, resourceID) { + var _this = _super.call(this, uuid, href) || this; + _this.resourceID = resourceID; + return _this; + } + return DeleteByIDRequest; +}(DeleteRequest)); +export { DeleteByIDRequest }; +var TaskPostRequest = /** @class */ (function (_super) { + tslib_1.__extends(TaskPostRequest, _super); + function TaskPostRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, body, options) || this; + _this.body = body; + _this.options = options; + return _this; + } + TaskPostRequest.prototype.getResponseParser = function () { + return TaskResponseParsingService; + }; + return TaskPostRequest; +}(PostRequest)); +export { TaskPostRequest }; +var TaskDeleteRequest = /** @class */ (function (_super) { + tslib_1.__extends(TaskDeleteRequest, _super); + function TaskDeleteRequest(uuid, href, body, options) { + var _this = _super.call(this, uuid, href, body, options) || this; + _this.body = body; + _this.options = options; + return _this; + } + TaskDeleteRequest.prototype.getResponseParser = function () { + return TaskResponseParsingService; + }; + return TaskDeleteRequest; +}(DeleteRequest)); +export { TaskDeleteRequest }; +var MyDSpaceRequest = /** @class */ (function (_super) { + tslib_1.__extends(MyDSpaceRequest, _super); + function MyDSpaceRequest() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.responseMsToLive = 0; + return _this; + } + return MyDSpaceRequest; +}(GetRequest)); +export { MyDSpaceRequest }; +var RequestError = /** @class */ (function (_super) { + tslib_1.__extends(RequestError, _super); + function RequestError() { + return _super !== null && _super.apply(this, arguments) || this; + } + return RequestError; +}(Error)); +export { RequestError }; +/* tslint:enable:max-classes-per-file */ +//# sourceMappingURL=request.models.js.map \ No newline at end of file diff --git a/src/app/core/data/request.models.js.map b/src/app/core/data/request.models.js.map new file mode 100644 index 0000000000..3c530d90c8 --- /dev/null +++ b/src/app/core/data/request.models.js.map @@ -0,0 +1 @@ +{"version":3,"file":"request.models.js","sourceRoot":"","sources":["request.models.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,mCAAmC,EAAE,MAAM,2CAA2C,CAAC;AAChG,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAEnF,OAAO,EAAE,gCAAgC,EAAE,MAAM,mDAAmD,CAAC;AACrG,OAAO,EAAE,iCAAiC,EAAE,MAAM,qDAAqD,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,yCAAyC;AAEzC;IAEE,qBACS,IAAY,EACZ,IAAY,EACZ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request.reducer.js b/src/app/core/data/request.reducer.js new file mode 100644 index 0000000000..4b8e22dcbb --- /dev/null +++ b/src/app/core/data/request.reducer.js @@ -0,0 +1,106 @@ +import { RequestActionTypes } from './request.actions'; +var RequestEntry = /** @class */ (function () { + function RequestEntry() { + } + return RequestEntry; +}()); +export { RequestEntry }; +// Object.create(null) ensures the object has no default js properties (e.g. `__proto__`) +var initialState = Object.create(null); +export function requestReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case RequestActionTypes.CONFIGURE: { + return configureRequest(state, action); + } + case RequestActionTypes.EXECUTE: { + return executeRequest(state, action); + } + case RequestActionTypes.COMPLETE: { + return completeRequest(state, action); + } + case RequestActionTypes.RESET_TIMESTAMPS: { + return resetResponseTimestamps(state, action); + } + case RequestActionTypes.REMOVE: { + return removeRequest(state, action); + } + default: { + return state; + } + } +} +function configureRequest(state, action) { + var _a; + return Object.assign({}, state, (_a = {}, + _a[action.payload.uuid] = { + request: action.payload, + requestPending: true, + responsePending: false, + completed: false, + }, + _a)); +} +function executeRequest(state, action) { + var _a; + var obs = Object.assign({}, state, (_a = {}, + _a[action.payload] = Object.assign({}, state[action.payload], { + requestPending: false, + responsePending: true + }), + _a)); + return obs; +} +/** + * Update a request with the response + * + * @param state + * the current state + * @param action + * a RequestCompleteAction + * @return RequestState + * the new state, with the response added to the request + */ +function completeRequest(state, action) { + var _a; + var time = new Date().getTime(); + return Object.assign({}, state, (_a = {}, + _a[action.payload.uuid] = Object.assign({}, state[action.payload.uuid], { + responsePending: false, + completed: true, + response: Object.assign({}, action.payload.response, { timeAdded: time }) + }), + _a)); +} +/** + * Reset the timeAdded property of all responses + * + * @param state + * the current state + * @param action + * a RequestCompleteAction + * @return RequestState + * the new state, with the timeAdded property reset + */ +function resetResponseTimestamps(state, action) { + var newState = Object.create(null); + Object.keys(state).forEach(function (key) { + newState[key] = Object.assign({}, state[key], { response: Object.assign({}, state[key].response, { timeAdded: action.payload }) }); + }); + return newState; +} +/** + * Remove a request from the RequestState + * @param state The current RequestState + * @param action The RequestRemoveAction to perform + */ +function removeRequest(state, action) { + var newState = Object.create(null); + for (var value in state) { + if (value !== action.uuid) { + newState[value] = state[value]; + } + } + return newState; +} +//# sourceMappingURL=request.reducer.js.map \ No newline at end of file diff --git a/src/app/core/data/request.reducer.js.map b/src/app/core/data/request.reducer.js.map new file mode 100644 index 0000000000..8529b254f0 --- /dev/null +++ b/src/app/core/data/request.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"request.reducer.js","sourceRoot":"","sources":["request.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAEnB,MAAM,mBAAmB,CAAC;AAI3B;IAAA;IAMA,CAAC;IAAD,mBAAC;AAAD,CAAC,AAND,IAMC;;AAMD,yFAAyF;AACzF,IAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAEzC,MAAM,yBAAyB,KAAoB,EAAE,MAAqB;IAA3C,sBAAA,EAAA,oBAAoB;IACjD,QAAQ,MAAM,CAAC,IAAI,EAAE;QAEnB,KAAK,kBAAkB,CAAC,SAAS,CAAC,CAAC;YACjC,OAAO,gBAAgB,CAAC,KAAK,EAAE,MAAgC,CAAC,CAAC;SAClE;QAED,KAAK,kBAAkB,CAAC,OAAO,CAAC,CAAC;YAC/B,OAAO,cAAc,CAAC,KAAK,EAAE,MAA8B,CAAC,CAAC;SAC9D;QAED,KAAK,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YAChC,OAAO,eAAe,CAAC,KAAK,EAAE,MAA+B,CAAC,CAAC;SAChE;QACD,KAAK,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;YACxC,OAAO,uBAAuB,CAAC,KAAK,EAAE,MAAuC,CAAC,CAAC;SAChF;QAED,KAAK,kBAAkB,CAAC,MAAM,CAAC,CAAC;YAC9B,OAAO,aAAa,CAAC,KAAK,EAAE,MAA6B,CAAC,CAAC;SAC5D;QAED,OAAO,CAAC,CAAC;YACP,O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AG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;QAC7B,QAAQ,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,EAC1C,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,CACpF,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,uBAAuB,KAAmB,EAAE,MAA2B;IACrE,IAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrC,KAAK,IAAM,KAAK,IAAI,KAAK,EAAE;QACzB,IAAI,KAAK,KAAK,MAAM,CAAC,IAAI,EAAE;YACzB,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;SAChC;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/src/app/core/data/request.service.js b/src/app/core/data/request.service.js new file mode 100644 index 0000000000..98987e367b --- /dev/null +++ b/src/app/core/data/request.service.js @@ -0,0 +1,270 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { HttpHeaders } from '@angular/common/http'; +import { createSelector, select, Store } from '@ngrx/store'; +import { race as observableRace } from 'rxjs'; +import { filter, find, map, mergeMap, take } from 'rxjs/operators'; +import { cloneDeep, remove } from 'lodash'; +import { hasValue, isEmpty, isNotEmpty } from '../../shared/empty.util'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { IndexName } from '../index/index.reducer'; +import { originalRequestUUIDFromRequestUUIDSelector, requestIndexSelector, uuidFromHrefSelector } from '../index/index.selectors'; +import { UUIDService } from '../shared/uuid.service'; +import { RequestConfigureAction, RequestExecuteAction, RequestRemoveAction } from './request.actions'; +import { CommitSSBAction } from '../cache/server-sync-buffer.actions'; +import { RestRequestMethod } from './rest-request-method'; +import { AddToIndexAction, RemoveFromIndexBySubstringAction } from '../index/index.actions'; +import { coreSelector } from '../core.selectors'; +/** + * The base selector function to select the request state in the store + */ +var requestCacheSelector = createSelector(coreSelector, function (state) { return state['data/request']; }); +/** + * Selector function to select a request entry by uuid from the cache + * @param uuid The uuid of the request + */ +var entryFromUUIDSelector = function (uuid) { return createSelector(requestCacheSelector, function (state) { + return hasValue(state) ? state[uuid] : undefined; +}); }; +/** + * Create a selector that fetches a list of request UUIDs from a given index substate of which the request href + * contains a given substring + * @param selector MemoizedSelector to start from + * @param href Substring that the request's href should contain + */ +var uuidsFromHrefSubstringSelector = function (selector, href) { return createSelector(selector, function (state) { return getUuidsFromHrefSubstring(state, href); }); }; +/** + * Fetch a list of request UUIDs from a given index substate of which the request href contains a given substring + * @param state The IndexState + * @param href Substring that the request's href should contain + */ +var getUuidsFromHrefSubstring = function (state, href) { + var result = []; + if (isNotEmpty(state)) { + result = Object.values(state) + .filter(function (value) { return value.startsWith(href); }); + } + return result; +}; +/** + * A service to interact with the request state in the store + */ +var RequestService = /** @class */ (function () { + function RequestService(objectCache, uuidService, store, indexStore) { + this.objectCache = objectCache; + this.uuidService = uuidService; + this.store = store; + this.indexStore = indexStore; + this.requestsOnTheirWayToTheStore = []; + } + RequestService.prototype.generateRequestId = function () { + return "client/" + this.uuidService.generate(); + }; + /** + * Check if a request is currently pending + */ + RequestService.prototype.isPending = function (request) { + // first check requests that haven't made it to the store yet + if (this.requestsOnTheirWayToTheStore.includes(request.href)) { + return true; + } + // then check the store + var isPending = false; + this.getByHref(request.href).pipe(take(1)) + .subscribe(function (re) { + isPending = (hasValue(re) && !re.completed); + }); + return isPending; + }; + /** + * Retrieve a RequestEntry based on their uuid + */ + RequestService.prototype.getByUUID = function (uuid) { + var _this = this; + return observableRace(this.store.pipe(select(entryFromUUIDSelector(uuid))), this.store.pipe(select(originalRequestUUIDFromRequestUUIDSelector(uuid)), mergeMap(function (originalUUID) { + return _this.store.pipe(select(entryFromUUIDSelector(originalUUID))); + }))).pipe(map(function (entry) { + // Headers break after being retrieved from the store (because of lazy initialization) + // Combining them with a new object fixes this issue + if (hasValue(entry) && hasValue(entry.request) && hasValue(entry.request.options) && hasValue(entry.request.options.headers)) { + entry = cloneDeep(entry); + entry.request.options.headers = Object.assign(new HttpHeaders(), entry.request.options.headers); + } + return entry; + })); + }; + /** + * Retrieve a RequestEntry based on their href + */ + RequestService.prototype.getByHref = function (href) { + var _this = this; + return this.store.pipe(select(uuidFromHrefSelector(href)), mergeMap(function (uuid) { return _this.getByUUID(uuid); })); + }; + /** + * Configure a certain request + * Used to make sure a request is in the cache + * @param {RestRequest} request The request to send out + * @param {boolean} forceBypassCache When true, a new request is always dispatched + */ + RequestService.prototype.configure = function (request, forceBypassCache) { + var _this = this; + if (forceBypassCache === void 0) { forceBypassCache = false; } + var isGetRequest = request.method === RestRequestMethod.GET; + if (forceBypassCache) { + this.clearRequestsOnTheirWayToTheStore(request); + } + if (!isGetRequest || (forceBypassCache && !this.isPending(request)) || !this.isCachedOrPending(request)) { + this.dispatchRequest(request); + if (isGetRequest) { + this.trackRequestsOnTheirWayToTheStore(request); + } + } + else { + this.getByHref(request.href).pipe(filter(function (entry) { return hasValue(entry); }), take(1)).subscribe(function (entry) { + return _this.store.dispatch(new AddToIndexAction(IndexName.UUID_MAPPING, request.uuid, entry.request.uuid)); + }); + } + }; + /** + * Convert request Payload to a URL-encoded string + * + * e.g. uriEncodeBody({param: value, param1: value1}) + * returns: param=value¶m1=value1 + * + * @param body + * The request Payload to convert + * @return string + * URL-encoded string + */ + RequestService.prototype.uriEncodeBody = function (body) { + var queryParams = ''; + if (isNotEmpty(body) && typeof body === 'object') { + Object.keys(body) + .forEach(function (param) { + var paramValue = param + "=" + body[param]; + queryParams = isEmpty(queryParams) ? queryParams.concat(paramValue) : queryParams.concat('&', paramValue); + }); + } + return encodeURI(queryParams); + }; + /** + * Remove all request cache providing (part of) the href + * This also includes href-to-uuid index cache + * @param href A substring of the request(s) href + */ + RequestService.prototype.removeByHrefSubstring = function (href) { + var _this = this; + this.store.pipe(select(uuidsFromHrefSubstringSelector(requestIndexSelector, href)), take(1)).subscribe(function (uuids) { + for (var _i = 0, uuids_1 = uuids; _i < uuids_1.length; _i++) { + var uuid = uuids_1[_i]; + _this.removeByUuid(uuid); + } + }); + this.requestsOnTheirWayToTheStore = this.requestsOnTheirWayToTheStore.filter(function (reqHref) { return reqHref.indexOf(href) < 0; }); + this.indexStore.dispatch(new RemoveFromIndexBySubstringAction(IndexName.REQUEST, href)); + }; + /** + * Remove request cache using the request's UUID + * @param uuid + */ + RequestService.prototype.removeByUuid = function (uuid) { + this.store.dispatch(new RequestRemoveAction(uuid)); + }; + /** + * Check if a request is in the cache or if it's still pending + * @param {GetRequest} request The request to check + * @returns {boolean} True if the request is cached or still pending + */ + RequestService.prototype.isCachedOrPending = function (request) { + var inReqCache = this.hasByHref(request.href); + var inObjCache = this.objectCache.hasBySelfLink(request.href); + var isCached = inReqCache || inObjCache; + var isPending = this.isPending(request); + return isCached || isPending; + }; + /** + * Configure and execute the request + * @param {RestRequest} request to dispatch + */ + RequestService.prototype.dispatchRequest = function (request) { + this.store.dispatch(new RequestConfigureAction(request)); + this.store.dispatch(new RequestExecuteAction(request.uuid)); + }; + /** + * ngrx action dispatches are asynchronous. But this.isPending needs to return true as soon as the + * configure method for a GET request has been executed, otherwise certain requests will happen multiple times. + * + * This method will store the href of every GET request that gets configured in a local variable, and + * remove it as soon as it can be found in the store. + */ + RequestService.prototype.trackRequestsOnTheirWayToTheStore = function (request) { + var _this = this; + this.requestsOnTheirWayToTheStore = this.requestsOnTheirWayToTheStore.concat([request.href]); + this.getByHref(request.href).pipe(filter(function (re) { return hasValue(re); }), take(1)).subscribe(function (re) { + _this.requestsOnTheirWayToTheStore = _this.requestsOnTheirWayToTheStore.filter(function (pendingHref) { return pendingHref !== request.href; }); + }); + }; + /** + * This method remove requests that are on their way to the store. + */ + RequestService.prototype.clearRequestsOnTheirWayToTheStore = function (request) { + var _this = this; + this.getByHref(request.href).pipe(find(function (re) { return hasValue(re); })) + .subscribe(function (re) { + if (!re.responsePending) { + remove(_this.requestsOnTheirWayToTheStore, function (item) { return item === request.href; }); + } + }); + }; + /** + * Dispatch commit action to send all changes (for a certain method) to the server (buffer) + * @param {RestRequestMethod} method RestRequestMethod for which the changes should be committed + */ + RequestService.prototype.commit = function (method) { + this.store.dispatch(new CommitSSBAction(method)); + }; + /** + * Check whether a cached response should still be valid + * + * @param entry + * the entry to check + * @return boolean + * false if the uuid has no value, the response was not successful or its time to + * live was exceeded, true otherwise + */ + RequestService.prototype.isValid = function (entry) { + if (hasValue(entry) && entry.completed && entry.response.isSuccessful) { + var timeOutdated = entry.response.timeAdded + entry.request.responseMsToLive; + var isOutDated = new Date().getTime() > timeOutdated; + return !isOutDated; + } + else { + return false; + } + }; + /** + * Check whether the request with the specified href is cached + * + * @param href + * The link of the request to check + * @return boolean + * true if the request with the specified href is cached, + * false otherwise + */ + RequestService.prototype.hasByHref = function (href) { + var _this = this; + var result = false; + this.getByHref(href).pipe(take(1)).subscribe(function (requestEntry) { return result = _this.isValid(requestEntry); }); + return result; + }; + RequestService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [ObjectCacheService, + UUIDService, + Store, + Store]) + ], RequestService); + return RequestService; +}()); +export { RequestService }; +//# sourceMappingURL=request.service.js.map \ No newline at end of file diff --git a/src/app/core/data/request.service.js.map b/src/app/core/data/request.service.js.map new file mode 100644 index 0000000000..0fdec0c417 --- /dev/null +++ b/src/app/core/data/request.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"request.service.js","sourceRoot":"","sources":["request.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAA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K,CAAC;SACd;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,kCAAS,GAAT,UAAU,IAAY;QAAtB,iBAMC;QALC,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CACvB,IAAI,CAAC,CAAC,CAAC,CACR,CAAC,SAAS,CAAC,UAAC,YAA0B,IAAK,OAAA,MAAM,GAAG,KAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAnC,CAAmC,CAAC,CAAC;QACjF,OAAO,MAAM,CAAC;IAChB,CAAC;IA9OU,cAAc;QAD1B,UAAU,EAAE;iDAIsB,kBAAkB;YAClB,WAAW;YACjB,KAAK;YACA,KAAK;OAN1B,cAAc,CAgP1B;IAAD,qBAAC;CAAA,AAhPD,IAgPC;SAhPY,cAAc"} \ No newline at end of file diff --git a/src/app/core/data/rest-request-method.js b/src/app/core/data/rest-request-method.js new file mode 100644 index 0000000000..17fa3d2f91 --- /dev/null +++ b/src/app/core/data/rest-request-method.js @@ -0,0 +1,20 @@ +/** + * Represents a Request Method. + * + * I didn't reuse the RequestMethod enum in @angular/http because + * it uses numbers. The string values here are more clear when + * debugging. + * + * The ones commented out are still unsupported in the rest of the codebase + */ +export var RestRequestMethod; +(function (RestRequestMethod) { + RestRequestMethod["GET"] = "GET"; + RestRequestMethod["POST"] = "POST"; + RestRequestMethod["PUT"] = "PUT"; + RestRequestMethod["DELETE"] = "DELETE"; + RestRequestMethod["OPTIONS"] = "OPTIONS"; + RestRequestMethod["HEAD"] = "HEAD"; + RestRequestMethod["PATCH"] = "PATCH"; +})(RestRequestMethod || (RestRequestMethod = {})); +//# sourceMappingURL=rest-request-method.js.map \ No newline at end of file diff --git a/src/app/core/data/rest-request-method.js.map b/src/app/core/data/rest-request-method.js.map new file mode 100644 index 0000000000..585c948f29 --- /dev/null +++ b/src/app/core/data/rest-request-method.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rest-request-method.js","sourceRoot":"","sources":["rest-request-method.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,gCAAW,CAAA;IACX,kCAAa,CAAA;IACb,gCAAW,CAAA;IACX,sCAAiB,CAAA;IACjB,wCAAmB,CAAA;IACnB,kCAAa,CAAA;IACb,oCAAe,CAAA;AACjB,CAAC,EARW,iBAAiB,KAAjB,iBAAiB,QAQ5B"} \ No newline at end of file diff --git a/src/app/core/data/search-response-parsing.service.js b/src/app/core/data/search-response-parsing.service.js new file mode 100644 index 0000000000..b91b7f6622 --- /dev/null +++ b/src/app/core/data/search-response-parsing.service.js @@ -0,0 +1,70 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { SearchSuccessResponse } from '../cache/response.models'; +import { DSOResponseParsingService } from './dso-response-parsing.service'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { hasValue } from '../../shared/empty.util'; +import { SearchQueryResponse } from '../../+search-page/search-service/search-query-response.model'; +import { MetadataValue } from '../shared/metadata.models'; +var SearchResponseParsingService = /** @class */ (function () { + function SearchResponseParsingService(dsoParser) { + this.dsoParser = dsoParser; + } + SearchResponseParsingService.prototype.parse = function (request, data) { + var _this = this; + // fallback for unexpected empty response + var emptyPayload = { + _embedded: { + objects: [] + } + }; + var payload = data.payload._embedded.searchResult || emptyPayload; + var hitHighlights = payload._embedded.objects + .map(function (object) { return object.hitHighlights; }) + .map(function (hhObject) { + var mdMap = {}; + if (hhObject) { + for (var _i = 0, _a = Object.keys(hhObject); _i < _a.length; _i++) { + var key = _a[_i]; + var value = Object.assign(new MetadataValue(), { value: hhObject[key].join('...'), language: null }); + mdMap[key] = [value]; + } + } + return mdMap; + }); + var dsoSelfLinks = payload._embedded.objects + .filter(function (object) { return hasValue(object._embedded); }) + .map(function (object) { return object._embedded.indexableObject; }) + // we don't need embedded collections, bitstreamformats, etc for search results. + // And parsing them all takes up a lot of time. Throw them away to improve performance + // until objs until partial results are supported by the rest api + .map(function (dso) { return Object.assign({}, dso, { _embedded: undefined }); }) + .map(function (dso) { return _this.dsoParser.parse(request, { + payload: dso, + statusCode: data.statusCode, + statusText: data.statusText + }); }) + .map(function (obj) { return obj.resourceSelfLinks; }) + .reduce(function (combined, thisElement) { return combined.concat(thisElement); }, []); + var objects = payload._embedded.objects + .filter(function (object) { return hasValue(object._embedded); }) + .map(function (object, index) { return Object.assign({}, object, { + indexableObject: dsoSelfLinks[index], + hitHighlights: hitHighlights[index], + // we don't need embedded collections, bitstreamformats, etc for search results. + // And parsing them all takes up a lot of time. Throw them away to improve performance + // until objs until partial results are supported by the rest api + _embedded: undefined + }); }); + payload.objects = objects; + var deserialized = new DSpaceRESTv2Serializer(SearchQueryResponse).deserialize(payload); + return new SearchSuccessResponse(deserialized, data.statusCode, data.statusText, this.dsoParser.processPageInfo(payload)); + }; + SearchResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [DSOResponseParsingService]) + ], SearchResponseParsingService); + return SearchResponseParsingService; +}()); +export { SearchResponseParsingService }; +//# sourceMappingURL=search-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/data/search-response-parsing.service.js.map b/src/app/core/data/search-response-parsing.service.js.map new file mode 100644 index 0000000000..f05aef1d02 --- /dev/null +++ b/src/app/core/data/search-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-response-parsing.service.js","sourceRoot":"","sources":["search-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAgB,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAI3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,O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AAC,mBAAmB,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC1F,OAAO,IAAI,qBAAqB,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IAC5H,CAAC;IArDU,4BAA4B;QADxC,UAAU,EAAE;iDAEoB,yBAAyB;OAD7C,4BAA4B,CAsDxC;IAAD,mCAAC;CAAA,AAtDD,IAsDC;SAtDY,4BAA4B"} \ No newline at end of file diff --git a/src/app/core/dspace-rest-v2/dspace-rest-v2-response.model.js b/src/app/core/dspace-rest-v2/dspace-rest-v2-response.model.js new file mode 100644 index 0000000000..786c3274d2 --- /dev/null +++ b/src/app/core/dspace-rest-v2/dspace-rest-v2-response.model.js @@ -0,0 +1 @@ +//# sourceMappingURL=dspace-rest-v2-response.model.js.map \ No newline at end of file diff --git a/src/app/core/dspace-rest-v2/dspace-rest-v2-response.model.js.map b/src/app/core/dspace-rest-v2/dspace-rest-v2-response.model.js.map new file mode 100644 index 0000000000..e47b689cae --- /dev/null +++ b/src/app/core/dspace-rest-v2/dspace-rest-v2-response.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-rest-v2-response.model.js","sourceRoot":"","sources":["dspace-rest-v2-response.model.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/core/dspace-rest-v2/dspace-rest-v2.serializer.js b/src/app/core/dspace-rest-v2/dspace-rest-v2.serializer.js new file mode 100644 index 0000000000..a812a4d193 --- /dev/null +++ b/src/app/core/dspace-rest-v2/dspace-rest-v2.serializer.js @@ -0,0 +1,84 @@ +import { Serialize, Deserialize } from 'cerialize'; +/** + * This Serializer turns responses from v2 of DSpace's REST API + * to models and vice versa + */ +var DSpaceRESTv2Serializer = /** @class */ (function () { + /** + * Create a new DSpaceRESTv2Serializer instance + * + * @param modelType a class or interface to indicate + * the kind of model this serializer should work with + */ + function DSpaceRESTv2Serializer(modelType) { + this.modelType = modelType; + } + /** + * Convert a model in to the format expected by the backend + * + * @param model The model to serialize + * @returns An object to send to the backend + */ + DSpaceRESTv2Serializer.prototype.serialize = function (model) { + return Serialize(model, this.modelType); + }; + /** + * Convert an array of models in to the format expected by the backend + * + * @param models The array of models to serialize + * @returns An object to send to the backend + */ + DSpaceRESTv2Serializer.prototype.serializeArray = function (models) { + return Serialize(models, this.modelType); + }; + /** + * Convert a response from the backend in to a model. + * + * @param response An object returned by the backend + * @returns a model of type T + */ + DSpaceRESTv2Serializer.prototype.deserialize = function (response) { + // TODO enable validation, once rest data stabilizes + // new DSpaceRESTv2Validator(response).validate(); + if (Array.isArray(response)) { + throw new Error('Expected a single model, use deserializeArray() instead'); + } + var normalized = Object.assign({}, response, this.normalizeLinks(response._links)); + return Deserialize(normalized, this.modelType); + }; + /** + * Convert a response from the backend in to an array of models + * + * @param response An object returned by the backend + * @returns an array of models of type T + */ + DSpaceRESTv2Serializer.prototype.deserializeArray = function (response) { + var _this = this; + // TODO: enable validation, once rest data stabilizes + // new DSpaceRESTv2Validator(response).validate(); + if (!Array.isArray(response)) { + throw new Error('Expected an Array, use deserialize() instead'); + } + var normalized = response.map(function (resource) { + return Object.assign({}, resource, _this.normalizeLinks(resource._links)); + }); + return Deserialize(normalized, this.modelType); + }; + DSpaceRESTv2Serializer.prototype.normalizeLinks = function (links) { + var normalizedLinks = links; + for (var link in normalizedLinks) { + if (Array.isArray(normalizedLinks[link])) { + normalizedLinks[link] = normalizedLinks[link].map(function (linkedResource) { + return linkedResource.href; + }); + } + else { + normalizedLinks[link] = normalizedLinks[link].href; + } + } + return normalizedLinks; + }; + return DSpaceRESTv2Serializer; +}()); +export { DSpaceRESTv2Serializer }; +//# sourceMappingURL=dspace-rest-v2.serializer.js.map \ No newline at end of file diff --git a/src/app/core/dspace-rest-v2/dspace-rest-v2.serializer.js.map b/src/app/core/dspace-rest-v2/dspace-rest-v2.serializer.js.map new file mode 100644 index 0000000000..5ac8f69a76 --- /dev/null +++ b/src/app/core/dspace-rest-v2/dspace-rest-v2.serializer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-rest-v2.serializer.js","sourceRoot":"","sources":["dspace-rest-v2.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQnD;;;GAGG;AACH;IAEE;;;;;OAKG;IACH,gCAAoB,SAAgC;QAAhC,cAAS,GAAT,SAAS,CAAuB;IACpD,CAAC;IAED;;;;;OAKG;IACH,0CAAS,GAAT,UAAU,KAAQ;QAChB,OAAO,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACH,+CAAc,GAAd,UAAe,MAAW;QACxB,OAAO,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACH,4CAAW,GAAX,UAAY,QAAa;QACvB,oDAAoD;QACpD,kDAAkD;QAClD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;SAC5E;QACD,IAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QACrF,OAAO,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAM,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACH,iDAAgB,GAAhB,UAAiB,QAAa;QAA9B,iBAWC;QAVC,qDAAqD;QACrD,kDAAkD;QAClD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;SACjE;QACD,IAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAC,QAAQ;YACvC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;QAEH,OAAO,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAQ,CAAC;IACxD,CAAC;IAEO,+CAAc,GAAtB,UAAuB,KAAU;QAC/B,IAAM,eAAe,GAAG,KAAK,CAAC;QAC9B,KAAK,IAAM,IAAI,IAAI,eAAe,EAAE;YAClC,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE;gBACxC,eAAe,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAC,cAAc;oBAC/D,OAAO,cAAc,CAAC,IAAI,CAAC;gBAC7B,CAAC,CAAC,CAAC;aACJ;iBAAM;gBACL,eAAe,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;aACpD;SACF;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;IAEH,6BAAC;AAAD,CAAC,AAhFD,IAgFC"} \ No newline at end of file diff --git a/src/app/core/dspace-rest-v2/dspace-rest-v2.service.js b/src/app/core/dspace-rest-v2/dspace-rest-v2.service.js new file mode 100644 index 0000000000..25bf233668 --- /dev/null +++ b/src/app/core/dspace-rest-v2/dspace-rest-v2.service.js @@ -0,0 +1,119 @@ +import * as tslib_1 from "tslib"; +import { throwError as observableThrowError } from 'rxjs'; +import { catchError, map } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { RestRequestMethod } from '../data/rest-request-method'; +import { hasNoValue, isNotEmpty } from '../../shared/empty.util'; +export var DEFAULT_CONTENT_TYPE = 'application/json; charset=utf-8'; +/** + * Service to access DSpace's REST API + */ +var DSpaceRESTv2Service = /** @class */ (function () { + function DSpaceRESTv2Service(http) { + this.http = http; + } + /** + * Performs a request to the REST API with the `get` http method. + * + * @param absoluteURL + * A URL + * @return {Observable} + * An Observable containing the response from the server + */ + DSpaceRESTv2Service.prototype.get = function (absoluteURL) { + var requestOptions = { + observe: 'response', + headers: new HttpHeaders({ 'Content-Type': DEFAULT_CONTENT_TYPE }) + }; + return this.http.get(absoluteURL, requestOptions).pipe(map(function (res) { return ({ + payload: res.body, + statusCode: res.status, + statusText: res.statusText + }); }), catchError(function (err) { + console.log('Error: ', err); + return observableThrowError({ + statusCode: err.status, + statusText: err.statusText, + message: err.message + }); + })); + }; + /** + * Performs a request to the REST API. + * + * @param method + * the HTTP method for the request + * @param url + * the URL for the request + * @param body + * an optional body for the request + * @param options + * the HttpOptions object + * @return {Observable} + * An Observable containing the response from the server + */ + DSpaceRESTv2Service.prototype.request = function (method, url, body, options) { + var requestOptions = {}; + requestOptions.body = body; + if (method === RestRequestMethod.POST && isNotEmpty(body) && isNotEmpty(body.name)) { + requestOptions.body = this.buildFormData(body); + } + requestOptions.observe = 'response'; + if (options && options.responseType) { + requestOptions.responseType = options.responseType; + } + if (hasNoValue(options) || hasNoValue(options.headers)) { + requestOptions.headers = new HttpHeaders(); + } + else { + requestOptions.headers = options.headers; + } + if (!requestOptions.headers.has('Content-Type')) { + // Because HttpHeaders is immutable, the set method returns a new object instead of updating the existing headers + requestOptions.headers = requestOptions.headers.set('Content-Type', DEFAULT_CONTENT_TYPE); + } + return this.http.request(method, url, requestOptions).pipe(map(function (res) { return ({ + payload: res.body, + headers: res.headers, + statusCode: res.status, + statusText: res.statusText + }); }), catchError(function (err) { + console.log('Error: ', err); + return observableThrowError({ + statusCode: err.status, + statusText: err.statusText, + message: err.message + }); + })); + }; + /** + * Create a FormData object from a DSpaceObject + * + * @param {DSpaceObject} dso + * the DSpaceObject + * @return {FormData} + * the result + */ + DSpaceRESTv2Service.prototype.buildFormData = function (dso) { + var form = new FormData(); + form.append('name', dso.name); + if (dso.metadata) { + for (var _i = 0, _a = Object.keys(dso.metadata); _i < _a.length; _i++) { + var key = _a[_i]; + for (var _b = 0, _c = dso.allMetadataValues(key); _b < _c.length; _b++) { + var value = _c[_b]; + form.append(key, value); + } + } + } + return form; + }; + DSpaceRESTv2Service = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [HttpClient]) + ], DSpaceRESTv2Service); + return DSpaceRESTv2Service; +}()); +export { DSpaceRESTv2Service }; +//# sourceMappingURL=dspace-rest-v2.service.js.map \ No newline at end of file diff --git a/src/app/core/dspace-rest-v2/dspace-rest-v2.service.js.map b/src/app/core/dspace-rest-v2/dspace-rest-v2.service.js.map new file mode 100644 index 0000000000..1fde65d783 --- /dev/null +++ b/src/app/core/dspace-rest-v2/dspace-rest-v2.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-rest-v2.service.js","sourceRoot":"","sources":["dspace-rest-v2.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAc,UAAU,IAAI,oBAAoB,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,WAAW,EAA4B,MAAM,sBAAsB,CAAA;AAIxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGjE,MAAM,CAAC,IAAM,oBAAoB,GAAG,iCAAiC,CAAC;AAWtE;;GAEG;AAEH;IAEE,6BAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAEpC,CAAC;IAED;;;;;;;OAOG;IACH,iCAAG,GAAH,UAAI,WAAmB;QACrB,IAAM,cAAc,GAAG;YACrB,OAAO,EAAE,UAAiB;YAC1B,OAAO,EAAE,IAAI,WAAW,CAAC,EAA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AAyB,EAAE;gBAAxC,IAAM,GAAG,SAAA;gBACZ,KAAoB,UAA0B,EAA1B,KAAA,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAA1B,cAA0B,EAA1B,IAA0B,EAAE;oBAA3C,IAAM,KAAK,SAAA;oBACd,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;iBACzB;aACF;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IA3GU,mBAAmB;QAD/B,UAAU,EAAE;iDAGe,UAAU;OAFzB,mBAAmB,CA6G/B;IAAD,0BAAC;CAAA,AA7GD,IA6GC;SA7GY,mBAAmB"} \ No newline at end of file diff --git a/src/app/core/dspace-rest-v2/dspace-rest-v2.validator.js b/src/app/core/dspace-rest-v2/dspace-rest-v2.validator.js new file mode 100644 index 0000000000..eb65106443 --- /dev/null +++ b/src/app/core/dspace-rest-v2/dspace-rest-v2.validator.js @@ -0,0 +1,33 @@ +import { Validator } from 'jsonschema'; +import schema from './dspace-rest-v2.schema.json'; +/** + * Verifies a document is a valid response from + * a DSpace REST API v2 + */ +var DSpaceRESTv2Validator = /** @class */ (function () { + function DSpaceRESTv2Validator(document) { + this.document = document; + } + /** + * Throws an exception if this.document isn't a valid response from + * a DSpace REST API v2. Succeeds otherwise. + */ + DSpaceRESTv2Validator.prototype.validate = function () { + var validator = new Validator(); + var result = validator.validate(this.document, schema); + if (!result.valid) { + if (result.errors && result.errors.length > 0) { + var message = result.errors + .map(function (error) { return error.message; }) + .join('\n'); + throw new Error(message); + } + else { + throw new Error('JSON API validation failed for an unknown reason'); + } + } + }; + return DSpaceRESTv2Validator; +}()); +export { DSpaceRESTv2Validator }; +//# sourceMappingURL=dspace-rest-v2.validator.js.map \ No newline at end of file diff --git a/src/app/core/dspace-rest-v2/dspace-rest-v2.validator.js.map b/src/app/core/dspace-rest-v2/dspace-rest-v2.validator.js.map new file mode 100644 index 0000000000..166016e840 --- /dev/null +++ b/src/app/core/dspace-rest-v2/dspace-rest-v2.validator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-rest-v2.validator.js","sourceRoot":"","sources":["dspace-rest-v2.validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,MAAM,MAAM,8BAA8B,CAAA;AAEjD;;;GAGG;AACH;IAEE,+BAAoB,QAAa;QAAb,aAAQ,GAAR,QAAQ,CAAK;IAEjC,CAAC;IAED;;;OAGG;IACH,wCAAQ,GAAR;QACE,IAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;QAClC,IAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;YACjB,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC7C,IAAM,OAAO,GAAG,MAAM,CAAC,MAAM;qBAC1B,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,OAAO,EAAb,CAAa,CAAC;qBAC7B,IAAI,CAAC,IAAI,CAAC,CAAC;gBACd,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;aAC1B;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;aACrE;SACF;IACH,CAAC;IAEH,4BAAC;AAAD,CAAC,AAzBD,IAyBC"} \ No newline at end of file diff --git a/src/app/core/eperson/eperson-response-parsing.service.js b/src/app/core/eperson/eperson-response-parsing.service.js new file mode 100644 index 0000000000..4faf3a3653 --- /dev/null +++ b/src/app/core/eperson/eperson-response-parsing.service.js @@ -0,0 +1,39 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { EpersonSuccessResponse, ErrorResponse } from '../cache/response.models'; +import { isNotEmpty } from '../../shared/empty.util'; +import { BaseResponseParsingService } from '../data/base-response-parsing.service'; +import { GLOBAL_CONFIG } from '../../../config'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory'; +/** + * Provides method to parse response from eperson endpoint. + */ +var EpersonResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(EpersonResponseParsingService, _super); + function EpersonResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = NormalizedObjectFactory; + _this.toCache = false; + return _this; + } + EpersonResponseParsingService.prototype.parse = function (request, data) { + if (isNotEmpty(data.payload) && isNotEmpty(data.payload._links)) { + var epersonDefinition = this.process(data.payload, request.href); + return new EpersonSuccessResponse(epersonDefinition[Object.keys(epersonDefinition)[0]], data.statusCode, data.statusText, this.processPageInfo(data.payload)); + } + else { + return new ErrorResponse(Object.assign(new Error('Unexpected response from EPerson endpoint'), { statusCode: data.statusCode, statusText: data.statusText })); + } + }; + EpersonResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], EpersonResponseParsingService); + return EpersonResponseParsingService; +}(BaseResponseParsingService)); +export { EpersonResponseParsingService }; +//# sourceMappingURL=eperson-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/eperson/eperson-response-parsing.service.js.map b/src/app/core/eperson/eperson-response-parsing.service.js.map new file mode 100644 index 0000000000..6d94558fdd --- /dev/null +++ b/src/app/core/eperson/eperson-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"eperson-response-parsing.service.js","sourceRoot":"","sources":["eperson-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKnD,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAgB,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAE,UAAU,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AAC,aAAa,CAAC,CAAA;yDACC,kBAAkB;OAPhC,6BAA6B,CA0BzC;IAAD,oCAAC;CAAA,AA1BD,CAAmD,0BAA0B,GA0B5E;SA1BY,6BAA6B"} \ No newline at end of file diff --git a/src/app/core/eperson/eperson.service.js b/src/app/core/eperson/eperson.service.js new file mode 100644 index 0000000000..f86942dca1 --- /dev/null +++ b/src/app/core/eperson/eperson.service.js @@ -0,0 +1,17 @@ +import * as tslib_1 from "tslib"; +import { DataService } from '../data/data.service'; +/** + * An abstract class that provides methods to make HTTP request to eperson endpoint. + */ +var EpersonService = /** @class */ (function (_super) { + tslib_1.__extends(EpersonService, _super); + function EpersonService() { + return _super !== null && _super.apply(this, arguments) || this; + } + EpersonService.prototype.getBrowseEndpoint = function (options) { + return this.halService.getEndpoint(this.linkPath); + }; + return EpersonService; +}(DataService)); +export { EpersonService }; +//# sourceMappingURL=eperson.service.js.map \ No newline at end of file diff --git a/src/app/core/eperson/eperson.service.js.map b/src/app/core/eperson/eperson.service.js.map new file mode 100644 index 0000000000..b75835c759 --- /dev/null +++ b/src/app/core/eperson/eperson.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"eperson.service.js","sourceRoot":"","sources":["eperson.service.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD;;GAEG;AACH;IAA8E,0CAAoB;IAAlG;;IAKA,CAAC;IAHQ,0CAAiB,GAAxB,UAAyB,OAAuB;QAC9C,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;IACH,qBAAC;AAAD,CAAC,AALD,CAA8E,WAAW,GAKxF"} \ No newline at end of file diff --git a/src/app/core/eperson/group-eperson.service.js b/src/app/core/eperson/group-eperson.service.js new file mode 100644 index 0000000000..91c385c3c7 --- /dev/null +++ b/src/app/core/eperson/group-eperson.service.js @@ -0,0 +1,66 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Store } from '@ngrx/store'; +import { filter, map, take } from 'rxjs/operators'; +import { EpersonService } from './eperson.service'; +import { RequestService } from '../data/request.service'; +import { FindAllOptions } from '../data/request.models'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { SearchParam } from '../cache/models/search-param.model'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; +import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service'; +/** + * Provides methods to retrieve eperson group resources. + */ +var GroupEpersonService = /** @class */ (function (_super) { + tslib_1.__extends(GroupEpersonService, _super); + function GroupEpersonService(comparator, dataBuildService, http, notificationsService, requestService, rdbService, store, objectCache, halService) { + var _this = _super.call(this) || this; + _this.comparator = comparator; + _this.dataBuildService = dataBuildService; + _this.http = http; + _this.notificationsService = notificationsService; + _this.requestService = requestService; + _this.rdbService = rdbService; + _this.store = store; + _this.objectCache = objectCache; + _this.halService = halService; + _this.linkPath = 'groups'; + _this.browseEndpoint = ''; + _this.forceBypassCache = false; + return _this; + } + /** + * Check if the current user is member of to the indicated group + * + * @param groupName + * the group name + * @return boolean + * true if user is member of the indicated group, false otherwise + */ + GroupEpersonService.prototype.isMemberOf = function (groupName) { + var searchHref = 'isMemberOf'; + var options = new FindAllOptions(); + options.searchParams = [new SearchParam('groupName', groupName)]; + return this.searchBy(searchHref, options).pipe(filter(function (groups) { return !groups.isResponsePending; }), take(1), map(function (groups) { return groups.payload.totalElements > 0; })); + }; + GroupEpersonService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [DSOChangeAnalyzer, + NormalizedObjectBuildService, + HttpClient, + NotificationsService, + RequestService, + RemoteDataBuildService, + Store, + ObjectCacheService, + HALEndpointService]) + ], GroupEpersonService); + return GroupEpersonService; +}(EpersonService)); +export { GroupEpersonService }; +//# sourceMappingURL=group-eperson.service.js.map \ No newline at end of file diff --git a/src/app/core/eperson/group-eperson.service.js.map b/src/app/core/eperson/group-eperson.service.js.map new file mode 100644 index 0000000000..d2562e0c9b --- /dev/null +++ b/src/app/core/eperson/group-eperson.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"group-eperson.service.js","sourceRoot":"","sources":["group-eperson.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAGjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE;;GAEG;AAEH;IAAyC,+CAAqB;IAK5D,6BACY,UAAoC,EACpC,gBAA8C,EAC9C,IAAgB,EAChB,oBAA0C,EAC1C,cAA8B,EAC9B,UAAkC,EAClC,KAAuB,EACvB,WAA+B,EAC/B,UAA8B;QAT1C,YAWE,iBAAO,SACR;QAXW,gBAAU,GAAV,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b/src/app/core/eperson/models/eperson.model.js new file mode 100644 index 0000000000..c56b5b2a59 --- /dev/null +++ b/src/app/core/eperson/models/eperson.model.js @@ -0,0 +1,21 @@ +import * as tslib_1 from "tslib"; +import { DSpaceObject } from '../../shared/dspace-object.model'; +var EPerson = /** @class */ (function (_super) { + tslib_1.__extends(EPerson, _super); + function EPerson() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(EPerson.prototype, "name", { + /** + * Getter to retrieve the EPerson's full name as a string + */ + get: function () { + return this.firstMetadataValue('eperson.firstname') + ' ' + this.firstMetadataValue('eperson.lastname'); + }, + enumerable: true, + configurable: true + }); + return EPerson; +}(DSpaceObject)); +export { EPerson }; +//# sourceMappingURL=eperson.model.js.map \ No newline at end of file diff --git a/src/app/core/eperson/models/eperson.model.js.map b/src/app/core/eperson/models/eperson.model.js.map new file mode 100644 index 0000000000..8dce2e3826 --- /dev/null +++ b/src/app/core/eperson/models/eperson.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"eperson.model.js","sourceRoot":"","sources":["eperson.model.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAKhE;IAA6B,mCAAY;IAAzC;;IAgDA,CAAC;IAHC,sBAAI,yBAAI;QAHR;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;QAC1G,CAAC;;;OAAA;IACH,cAAC;AAAD,CAAC,AAhDD,CAA6B,YAAY,GAgDxC"} \ No newline at end of file diff --git a/src/app/core/eperson/models/group.model.js b/src/app/core/eperson/models/group.model.js new file mode 100644 index 0000000000..7dd837c499 --- /dev/null +++ b/src/app/core/eperson/models/group.model.js @@ -0,0 +1,11 @@ +import * as tslib_1 from "tslib"; +import { DSpaceObject } from '../../shared/dspace-object.model'; +var Group = /** @class */ (function (_super) { + tslib_1.__extends(Group, _super); + function Group() { + return _super !== null && _super.apply(this, arguments) || this; + } + return Group; +}(DSpaceObject)); +export { Group }; +//# sourceMappingURL=group.model.js.map \ No newline at end of file diff --git a/src/app/core/eperson/models/group.model.js.map b/src/app/core/eperson/models/group.model.js.map new file mode 100644 index 0000000000..e071c78c31 --- /dev/null +++ b/src/app/core/eperson/models/group.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"group.model.js","sourceRoot":"","sources":["group.model.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAIhE;IAA2B,iCAAY;IAAvC;;IAqBA,CAAC;IAAD,YAAC;AAAD,CAAC,AArBD,CAA2B,YAAY,GAqBtC"} \ No newline at end of file diff --git a/src/app/core/eperson/models/normalized-eperson.model.js b/src/app/core/eperson/models/normalized-eperson.model.js new file mode 100644 index 0000000000..c724f1799b --- /dev/null +++ b/src/app/core/eperson/models/normalized-eperson.model.js @@ -0,0 +1,52 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; +import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model'; +import { EPerson } from './eperson.model'; +import { mapsTo, relationship } from '../../cache/builders/build-decorators'; +import { ResourceType } from '../../shared/resource-type'; +var NormalizedEPerson = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedEPerson, _super); + function NormalizedEPerson() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedEPerson.prototype, "handle", void 0); + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Group, true), + tslib_1.__metadata("design:type", Array) + ], NormalizedEPerson.prototype, "groups", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedEPerson.prototype, "netid", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedEPerson.prototype, "lastActive", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], NormalizedEPerson.prototype, "canLogIn", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedEPerson.prototype, "email", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], NormalizedEPerson.prototype, "requireCertificate", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], NormalizedEPerson.prototype, "selfRegistered", void 0); + NormalizedEPerson = tslib_1.__decorate([ + mapsTo(EPerson), + inheritSerialization(NormalizedDSpaceObject) + ], NormalizedEPerson); + return NormalizedEPerson; +}(NormalizedDSpaceObject)); +export { NormalizedEPerson }; +//# sourceMappingURL=normalized-eperson.model.js.map \ No newline at end of file diff --git a/src/app/core/eperson/models/normalized-eperson.model.js.map b/src/app/core/eperson/models/normalized-eperson.model.js.map new file mode 100644 index 0000000000..31dec3fe76 --- /dev/null +++ b/src/app/core/eperson/models/normalized-eperson.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-eperson.model.js","sourceRoot":"","sources":["normalized-eperson.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAI7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D;IAAuC,6CAA+B;IAAtE;;IAkDA,CAAC;IA5CC;QADC,aAAa;;qDACQ;IAOtB;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC;;qDACtB;IAMjB;QADC,aAAa;;oDACO;IAMrB;QADC,aAAa;;yDACY;IAM1B;QADC,aAAa;;uDACW;IAMzB;QADC,aAAa;;oDACO;IAMrB;QADC,aAAa;;iEACqB;IAMnC;QADC,aAAa;;6DACiB;IAjDpB,iBAAiB;QAF7B,MAAM,CAAC,OAAO,CAAC;QACf,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,iBAAiB,CAkD7B;IAAD,wBAAC;CAAA,AAlDD,CAAuC,sBAAsB,GAkD5D;SAlDY,iBAAiB"} \ No newline at end of file diff --git a/src/app/core/eperson/models/normalized-group.model.js b/src/app/core/eperson/models/normalized-group.model.js new file mode 100644 index 0000000000..ea036db7d6 --- /dev/null +++ b/src/app/core/eperson/models/normalized-group.model.js @@ -0,0 +1,36 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; +import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model'; +import { mapsTo, relationship } from '../../cache/builders/build-decorators'; +import { Group } from './group.model'; +import { ResourceType } from '../../shared/resource-type'; +var NormalizedGroup = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedGroup, _super); + function NormalizedGroup() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + deserialize, + relationship(ResourceType.Group, true), + tslib_1.__metadata("design:type", Array) + ], NormalizedGroup.prototype, "groups", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedGroup.prototype, "handle", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedGroup.prototype, "name", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], NormalizedGroup.prototype, "permanent", void 0); + NormalizedGroup = tslib_1.__decorate([ + mapsTo(Group), + inheritSerialization(NormalizedDSpaceObject) + ], NormalizedGroup); + return NormalizedGroup; +}(NormalizedDSpaceObject)); +export { NormalizedGroup }; +//# sourceMappingURL=normalized-group.model.js.map \ No newline at end of file diff --git a/src/app/core/eperson/models/normalized-group.model.js.map b/src/app/core/eperson/models/normalized-group.model.js.map new file mode 100644 index 0000000000..24d8f02f8b --- /dev/null +++ b/src/app/core/eperson/models/normalized-group.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-group.model.js","sourceRoot":"","sources":["normalized-group.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAI7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D;IAAqC,2CAA6B;IAAlE;;IA0BA,CAAC;IAnBC;QAFC,WAAW;QACX,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC;;mDACtB;IAMjB;QADC,aAAa;;mDACQ;IAMtB;QADC,aAAa;;iDACM;IAMpB;QADC,aAAa;;sDACY;IAzBf,eAAe;QAF3B,MAAM,CAAC,KAAK,CAAC;QACb,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,eAAe,CA0B3B;IAAD,sBAAC;CAAA,AA1BD,CAAqC,sBAAsB,GA0B1D;SA1BY,eAAe"} \ No newline at end of file diff --git a/src/app/core/index/index.actions.js b/src/app/core/index/index.actions.js new file mode 100644 index 0000000000..0b7703e1aa --- /dev/null +++ b/src/app/core/index/index.actions.js @@ -0,0 +1,70 @@ +import { type } from '../../shared/ngrx/type'; +/** + * The list of HrefIndexAction type definitions + */ +export var IndexActionTypes = { + ADD: type('dspace/core/index/ADD'), + REMOVE_BY_VALUE: type('dspace/core/index/REMOVE_BY_VALUE'), + REMOVE_BY_SUBSTRING: type('dspace/core/index/REMOVE_BY_SUBSTRING') +}; +/* tslint:disable:max-classes-per-file */ +/** + * An ngrx action to add an value to the index + */ +var AddToIndexAction = /** @class */ (function () { + /** + * Create a new AddToIndexAction + * + * @param name + * the name of the index to add to + * @param key + * the key to add + * @param value + * the self link of the resource the key belongs to + */ + function AddToIndexAction(name, key, value) { + this.type = IndexActionTypes.ADD; + this.payload = { name: name, key: key, value: value }; + } + return AddToIndexAction; +}()); +export { AddToIndexAction }; +/** + * An ngrx action to remove an value from the index + */ +var RemoveFromIndexByValueAction = /** @class */ (function () { + /** + * Create a new RemoveFromIndexByValueAction + * + * @param name + * the name of the index to remove from + * @param value + * the value to remove the UUID for + */ + function RemoveFromIndexByValueAction(name, value) { + this.type = IndexActionTypes.REMOVE_BY_VALUE; + this.payload = { name: name, value: value }; + } + return RemoveFromIndexByValueAction; +}()); +export { RemoveFromIndexByValueAction }; +/** + * An ngrx action to remove multiple values from the index by substring + */ +var RemoveFromIndexBySubstringAction = /** @class */ (function () { + /** + * Create a new RemoveFromIndexByValueAction + * + * @param name + * the name of the index to remove from + * @param value + * the value to remove the UUID for + */ + function RemoveFromIndexBySubstringAction(name, value) { + this.type = IndexActionTypes.REMOVE_BY_SUBSTRING; + this.payload = { name: name, value: value }; + } + return RemoveFromIndexBySubstringAction; +}()); +export { RemoveFromIndexBySubstringAction }; +//# sourceMappingURL=index.actions.js.map \ No newline at end of file diff --git a/src/app/core/index/index.actions.js.map b/src/app/core/index/index.actions.js.map new file mode 100644 index 0000000000..4070744397 --- /dev/null +++ b/src/app/core/index/index.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.actions.js","sourceRoot":"","sources":["index.actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAG9C;;GAEG;AACH,MAAM,CAAC,IAAM,gBAAgB,GAAG;IAC9B,GAAG,EAAE,IAAI,CAAC,uBAAuB,CAAC;IAClC,eAAe,EAAE,IAAI,CAAC,mCAAmC,CAAC;IAC1D,mBAAmB,EAAE,IAAI,CAAC,uCAAuC,CAAC;CACnE,CAAC;AAEF,yCAAyC;AACzC;;GAEG;AACH;IAQE;;;;;;;;;OASG;IACH,0BAAY,IAAe,EAAE,GAAW,EAAE,KAAa;QAjBvD,SAAI,GAAG,gBAAgB,CAAC,GAAG,CAAC;QAkB1B,IAAI,CAAC,OAAO,GAAG,EAAE,IAAI,MAAA,EAAE,GAAG,KAAA,EAAE,KAAK,OAAA,EAAE,CAAC;IACtC,CAAC;IACH,uBAAC;AAAD,CAAC,AArBD,IAqBC;;AAED;;GAEG;AACH;IAOE;;;;;;;OAOG;IACH,sCAAY,IAAe,EAAE,KAAa;QAd1C,SAAI,GAAG,gBAAgB,CAAC,eAAe,CAAC;QAetC,IAAI,CAAC,OAAO,GAAG,EAAE,IAAI,MAAA,EAAE,KAAK,OAAA,EAAE,CAAC;IACjC,CAAC;IAEH,mCAAC;AAAD,CAAC,AAnBD,IAmBC;;AAED;;GAEG;AACH;IAOE;;;;;;;OAOG;IACH,0CAAY,IAAe,EAAE,KAAa;QAd1C,SAAI,GAAG,gBAAgB,CAAC,mBAAmB,CAAC;QAe1C,IAAI,CAAC,OAAO,GAAG,EAAE,IAAI,MAAA,EAAE,KAAK,OAAA,EAAE,CAAC;IACjC,CAAC;IAEH,uCAAC;AAAD,CAAC,AAnBD,IAmBC"} \ No newline at end of file diff --git a/src/app/core/index/index.effects.js b/src/app/core/index/index.effects.js new file mode 100644 index 0000000000..173ac8b894 --- /dev/null +++ b/src/app/core/index/index.effects.js @@ -0,0 +1,46 @@ +import * as tslib_1 from "tslib"; +import { filter, map } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { Actions, Effect, ofType } from '@ngrx/effects'; +import { ObjectCacheActionTypes } from '../cache/object-cache.actions'; +import { RequestActionTypes } from '../data/request.actions'; +import { AddToIndexAction, RemoveFromIndexByValueAction } from './index.actions'; +import { hasValue } from '../../shared/empty.util'; +import { IndexName } from './index.reducer'; +import { RestRequestMethod } from '../data/rest-request-method'; +var UUIDIndexEffects = /** @class */ (function () { + function UUIDIndexEffects(actions$) { + this.actions$ = actions$; + this.addObject$ = this.actions$ + .pipe(ofType(ObjectCacheActionTypes.ADD), filter(function (action) { return hasValue(action.payload.objectToCache.uuid); }), map(function (action) { + return new AddToIndexAction(IndexName.OBJECT, action.payload.objectToCache.uuid, action.payload.objectToCache.self); + })); + this.removeObject$ = this.actions$ + .pipe(ofType(ObjectCacheActionTypes.REMOVE), map(function (action) { + return new RemoveFromIndexByValueAction(IndexName.OBJECT, action.payload); + })); + this.addRequest$ = this.actions$ + .pipe(ofType(RequestActionTypes.CONFIGURE), filter(function (action) { return action.payload.method === RestRequestMethod.GET; }), map(function (action) { + return new AddToIndexAction(IndexName.REQUEST, action.payload.href, action.payload.uuid); + })); + } + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], UUIDIndexEffects.prototype, "addObject$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], UUIDIndexEffects.prototype, "removeObject$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], UUIDIndexEffects.prototype, "addRequest$", void 0); + UUIDIndexEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Actions]) + ], UUIDIndexEffects); + return UUIDIndexEffects; +}()); +export { UUIDIndexEffects }; +//# sourceMappingURL=index.effects.js.map \ No newline at end of file diff --git a/src/app/core/index/index.effects.js.map b/src/app/core/index/index.effects.js.map new file mode 100644 index 0000000000..70f86b7e51 --- /dev/null +++ b/src/app/core/index/index.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.effects.js","sourceRoot":"","sources":["index.effects.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAEL,sBAAsB,EAEvB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G,EAA/C,CAA+C,CAAC,EAC3F,GAAG,CAAC,UAAC,MAA8B;YACjC,OAAO,IAAI,gBAAgB,CACzB,SAAS,CAAC,OAAO,EACjB,MAAM,CAAC,OAAO,CAAC,IAAI,EACnB,MAAM,CAAC,OAAO,CAAC,IAAI,CACpB,CAAC;QACJ,CAAC,CAAC,CACH,CAAC;IAIJ,CAAC;IAvCS;QAAT,MAAM,EAAE;;wDAWL;IAEM;QAAT,MAAM,EAAE;;2DASL;IAEM;QAAT,MAAM,EAAE;;yDAWL;IArCO,gBAAgB;QAD5B,UAAU,EAAE;iDAwCmB,OAAO;OAvC1B,gBAAgB,CA2C5B;IAAD,uBAAC;CAAA,AA3CD,IA2CC;SA3CY,gBAAgB"} \ No newline at end of file diff --git a/src/app/core/index/index.reducer.js b/src/app/core/index/index.reducer.js new file mode 100644 index 0000000000..aea43da7ad --- /dev/null +++ b/src/app/core/index/index.reducer.js @@ -0,0 +1,114 @@ +import { IndexActionTypes } from './index.actions'; +/** + * An enum containing all index names + */ +export var IndexName; +(function (IndexName) { + // Contains all objects in the object cache indexed by UUID + IndexName["OBJECT"] = "object/uuid-to-self-link"; + // contains all requests in the request cache indexed by UUID + IndexName["REQUEST"] = "get-request/href-to-uuid"; + /** + * Contains the UUIDs of requests that were sent to the server and + * have their responses cached, indexed by the UUIDs of requests that + * weren't sent because the response they requested was already cached + */ + IndexName["UUID_MAPPING"] = "get-request/configured-to-cache-uuid"; +})(IndexName || (IndexName = {})); +// Object.create(null) ensures the object has no default js properties (e.g. `__proto__`) +var initialState = Object.create(null); +/** + * The Index Reducer + * + * @param state + * the current state + * @param action + * the action to perform on the state + * @return MetaIndexState + * the new state + */ +export function indexReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case IndexActionTypes.ADD: { + return addToIndex(state, action); + } + case IndexActionTypes.REMOVE_BY_VALUE: { + return removeFromIndexByValue(state, action); + } + case IndexActionTypes.REMOVE_BY_SUBSTRING: { + return removeFromIndexBySubstring(state, action); + } + default: { + return state; + } + } +} +/** + * Add an entry to a given index + * + * @param state + * The MetaIndexState that contains all indices + * @param action + * The AddToIndexAction containing the value to add, and the index to add it to + * @return MetaIndexState + * the new state + */ +function addToIndex(state, action) { + var _a, _b; + var subState = state[action.payload.name]; + var newSubState = Object.assign({}, subState, (_a = {}, + _a[action.payload.key] = action.payload.value, + _a)); + var obs = Object.assign({}, state, (_b = {}, + _b[action.payload.name] = newSubState, + _b)); + return obs; +} +/** + * Remove a entries that contain a given value from a given index + * + * @param state + * The MetaIndexState that contains all indices + * @param action + * The RemoveFromIndexByValueAction containing the value to remove, and the index to remove it from + * @return MetaIndexState + * the new state + */ +function removeFromIndexByValue(state, action) { + var _a; + var subState = state[action.payload.name]; + var newSubState = Object.create(null); + for (var value in subState) { + if (subState[value] !== action.payload.value) { + newSubState[value] = subState[value]; + } + } + return Object.assign({}, state, (_a = {}, + _a[action.payload.name] = newSubState, + _a)); +} +/** + * Remove entries that contain a given substring from a given index + * + * @param state + * The MetaIndexState that contains all indices + * @param action + * The RemoveFromIndexByValueAction the substring to remove, and the index to remove it from + * @return MetaIndexState + * the new state + */ +function removeFromIndexBySubstring(state, action) { + var _a; + var subState = state[action.payload.name]; + var newSubState = Object.create(null); + for (var value in subState) { + if (value.indexOf(action.payload.value) < 0) { + newSubState[value] = subState[value]; + } + } + return Object.assign({}, state, (_a = {}, + _a[action.payload.name] = newSubState, + _a)); +} +//# sourceMappingURL=index.reducer.js.map \ No newline at end of file diff --git a/src/app/core/index/index.reducer.js.map b/src/app/core/index/index.reducer.js.map new file mode 100644 index 0000000000..b50fd34806 --- /dev/null +++ b/src/app/core/index/index.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.reducer.js","sourceRoot":"","sources":["index.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,gBAAgB,EAGjB,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,CAAN,IAAY,SAaX;AAbD,WAAY,SAAS;IACnB,2D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AAgC,KAAqB,EAAE,MAAoC;;IACzF,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxC,KAAK,IAAM,KAAK,IAAI,QAAQ,EAAE;QAC5B,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE;YAC5C,WAAW,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;SACtC;KACF;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK;QAC5B,GAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAG,WAAW;YAClC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,oCAAoC,KAAqB,EAAE,MAAoC;;IAC7F,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxC,KAAK,IAAM,KAAK,IAAI,QAAQ,EAAE;QAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;YAC3C,WAAW,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;SACtC;KACF;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK;QAC5B,GAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAG,WAAW;YAClC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/src/app/core/index/index.selectors.js b/src/app/core/index/index.selectors.js new file mode 100644 index 0000000000..d06a8983ba --- /dev/null +++ b/src/app/core/index/index.selectors.js @@ -0,0 +1,62 @@ +import { createSelector } from '@ngrx/store'; +import { hasValue } from '../../shared/empty.util'; +import { coreSelector } from '../core.selectors'; +import { IndexName } from './index.reducer'; +/** + * Return the MetaIndexState based on the CoreSate + * + * @returns + * a MemoizedSelector to select the MetaIndexState + */ +export var metaIndexSelector = createSelector(coreSelector, function (state) { return state.index; }); +/** + * Return the object index based on the MetaIndexState + * It contains all objects in the object cache indexed by UUID + * + * @returns + * a MemoizedSelector to select the object index + */ +export var objectIndexSelector = createSelector(metaIndexSelector, function (state) { return state[IndexName.OBJECT]; }); +/** + * Return the request index based on the MetaIndexState + * + * @returns + * a MemoizedSelector to select the request index + */ +export var requestIndexSelector = createSelector(metaIndexSelector, function (state) { return state[IndexName.REQUEST]; }); +/** + * Return the request UUID mapping index based on the MetaIndexState + * + * @returns + * a MemoizedSelector to select the request UUID mapping + */ +export var requestUUIDIndexSelector = createSelector(metaIndexSelector, function (state) { return state[IndexName.UUID_MAPPING]; }); +/** + * Return the self link of an object in the object-cache based on its UUID + * + * @param uuid + * the UUID for which you want to find the matching self link + * @returns + * a MemoizedSelector to select the self link + */ +export var selfLinkFromUuidSelector = function (uuid) { return createSelector(objectIndexSelector, function (state) { return hasValue(state) ? state[uuid] : undefined; }); }; +/** + * Return the UUID of a GET request based on its href + * + * @param href + * the href of the GET request + * @returns + * a MemoizedSelector to select the UUID + */ +export var uuidFromHrefSelector = function (href) { return createSelector(requestIndexSelector, function (state) { return hasValue(state) ? state[href] : undefined; }); }; +/** + * Return the UUID of a cached request based on the UUID of a request + * that wasn't sent because the response was already cached + * + * @param uuid + * The UUID of the new request + * @returns + * a MemoizedSelector to select the UUID of the cached request + */ +export var originalRequestUUIDFromRequestUUIDSelector = function (uuid) { return createSelector(requestUUIDIndexSelector, function (state) { return hasValue(state) ? state[uuid] : undefined; }); }; +//# sourceMappingURL=index.selectors.js.map \ No newline at end of file diff --git a/src/app/core/index/index.selectors.js.map b/src/app/core/index/index.selectors.js.map new file mode 100644 index 0000000000..0807f45f9a --- /dev/null +++ b/src/app/core/index/index.selectors.js.map @@ -0,0 +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AAC,IAAM,oBAAoB,GAC/B,UAAC,IAAY,IAAyC,OAAA,cAAc,CAClE,oBAAoB,EACpB,UAAC,KAAiB,IAAK,OAAA,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,EAAzC,CAAyC,CACjE,EAHqD,CAGrD,CAAC;AAEJ;;;;;;;;GAQG;AACH,MAAM,CAAC,IAAM,0CAA0C,GACrD,UAAC,IAAY,IAAyC,OAAA,cAAc,CAClE,wBAAwB,EACxB,UAAC,KAAiB,IAAK,OAAA,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,EAAzC,CAAyC,CACjE,EAHqD,CAGrD,CAAC"} \ No newline at end of file diff --git a/src/app/core/integration/authority.service.js b/src/app/core/integration/authority.service.js new file mode 100644 index 0000000000..86b2860f0b --- /dev/null +++ b/src/app/core/integration/authority.service.js @@ -0,0 +1,28 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { RequestService } from '../data/request.service'; +import { IntegrationService } from './integration.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +var AuthorityService = /** @class */ (function (_super) { + tslib_1.__extends(AuthorityService, _super); + function AuthorityService(requestService, rdbService, halService) { + var _this = _super.call(this) || this; + _this.requestService = requestService; + _this.rdbService = rdbService; + _this.halService = halService; + _this.linkPath = 'authorities'; + _this.entriesEndpoint = 'entries'; + _this.entryValueEndpoint = 'entryValues'; + return _this; + } + AuthorityService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + RemoteDataBuildService, + HALEndpointService]) + ], AuthorityService); + return AuthorityService; +}(IntegrationService)); +export { AuthorityService }; +//# sourceMappingURL=authority.service.js.map \ No newline at end of file diff --git a/src/app/core/integration/authority.service.js.map b/src/app/core/integration/authority.service.js.map new file mode 100644 index 0000000000..c959e97d98 --- /dev/null +++ b/src/app/core/integration/authority.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authority.service.js","sourceRoot":"","sources":["authority.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAGrF;IAAsC,4CAAkB;IAKtD,0BACY,cAA8B,EAC9B,UAAkC,EAClC,UAA8B;QAH1C,YAIE,iBAAO,SACR;QAJW,oBAAc,GAAd,cAAc,CAAgB;QAC9B,gBAAU,GAAV,UAAU,CAAwB;QAClC,gBAAU,GAAV,UAAU,CAAoB;QAPhC,cAAQ,GAAG,aAAa,CAAC;QACzB,qBAAe,GAAG,SAAS,CAAC;QAC5B,wBAAkB,GAAG,aAAa,CAAC;;IAO7C,CAAC;IAVU,gBAAgB;QAD5B,UAAU,EAAE;iDAOiB,cAAc;YAClB,sBAAsB;YACtB,kBAAkB;OAR/B,gBAAgB,CAY5B;IAAD,uBAAC;CAAA,AAZD,CAAsC,kBAAkB,GAYvD;SAZY,gBAAgB"} \ No newline at end of file diff --git a/src/app/core/integration/integration-data.js b/src/app/core/integration/integration-data.js new file mode 100644 index 0000000000..a7fdf46cc1 --- /dev/null +++ b/src/app/core/integration/integration-data.js @@ -0,0 +1,12 @@ +/** + * A class to represent the data retrieved by an Integration service + */ +var IntegrationData = /** @class */ (function () { + function IntegrationData(pageInfo, payload) { + this.pageInfo = pageInfo; + this.payload = payload; + } + return IntegrationData; +}()); +export { IntegrationData }; +//# sourceMappingURL=integration-data.js.map \ No newline at end of file diff --git a/src/app/core/integration/integration-data.js.map b/src/app/core/integration/integration-data.js.map new file mode 100644 index 0000000000..5df64ce068 --- /dev/null +++ b/src/app/core/integration/integration-data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"integration-data.js","sourceRoot":"","sources":["integration-data.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH;IACE,yBACS,QAAkB,EAClB,OAA2B;QAD3B,aAAQ,GAAR,QAAQ,CAAU;QAClB,YAAO,GAAP,OAAO,CAAoB;IAChC,CAAC;IACP,sBAAC;AAAD,CAAC,AALD,IAKC"} \ No newline at end of file diff --git a/src/app/core/integration/integration-object-factory.js b/src/app/core/integration/integration-object-factory.js new file mode 100644 index 0000000000..defd3b08d0 --- /dev/null +++ b/src/app/core/integration/integration-object-factory.js @@ -0,0 +1,19 @@ +import { IntegrationType } from './intergration-type'; +import { NormalizedAuthorityValue } from './models/normalized-authority-value.model'; +var IntegrationObjectFactory = /** @class */ (function () { + function IntegrationObjectFactory() { + } + IntegrationObjectFactory.getConstructor = function (type) { + switch (type) { + case IntegrationType.Authority: { + return NormalizedAuthorityValue; + } + default: { + return undefined; + } + } + }; + return IntegrationObjectFactory; +}()); +export { IntegrationObjectFactory }; +//# sourceMappingURL=integration-object-factory.js.map \ No newline at end of file diff --git a/src/app/core/integration/integration-object-factory.js.map b/src/app/core/integration/integration-object-factory.js.map new file mode 100644 index 0000000000..b86b4a3703 --- /dev/null +++ b/src/app/core/integration/integration-object-factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"integration-object-factory.js","sourceRoot":"","sources":["integration-object-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAErF;IAAA;IAWA,CAAC;IAVe,uCAAc,GAA5B,UAA6B,IAAI;QAC/B,QAAQ,IAAI,EAAE;YACZ,KAAK,eAAe,CAAC,SAAS,CAAC,CAAC;gBAC9B,OAAO,wBAAwB,CAAC;aACjC;YACD,OAAO,CAAC,CAAC;gBACP,OAAO,SAAS,CAAC;aAClB;SACF;IACH,CAAC;IACH,+BAAC;AAAD,CAAC,AAXD,IAWC"} \ No newline at end of file diff --git a/src/app/core/integration/integration-response-parsing.service.js b/src/app/core/integration/integration-response-parsing.service.js new file mode 100644 index 0000000000..a8d8e54127 --- /dev/null +++ b/src/app/core/integration/integration-response-parsing.service.js @@ -0,0 +1,47 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { ErrorResponse, IntegrationSuccessResponse } from '../cache/response.models'; +import { isNotEmpty } from '../../shared/empty.util'; +import { IntegrationObjectFactory } from './integration-object-factory'; +import { BaseResponseParsingService } from '../data/base-response-parsing.service'; +import { GLOBAL_CONFIG } from '../../../config'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { IntegrationType } from './intergration-type'; +import { AuthorityValue } from './models/authority.value'; +var IntegrationResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(IntegrationResponseParsingService, _super); + function IntegrationResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = IntegrationObjectFactory; + _this.toCache = true; + return _this; + } + IntegrationResponseParsingService.prototype.parse = function (request, data) { + if (isNotEmpty(data.payload) && isNotEmpty(data.payload._links)) { + var dataDefinition = this.process(data.payload, request.uuid); + return new IntegrationSuccessResponse(this.processResponse(dataDefinition), data.statusCode, data.statusText, this.processPageInfo(data.payload)); + } + else { + return new ErrorResponse(Object.assign(new Error('Unexpected response from Integration endpoint'), { statusCode: data.statusCode, statusText: data.statusText })); + } + }; + IntegrationResponseParsingService.prototype.processResponse = function (data) { + var returnList = Array.of(); + data.page.forEach(function (item, index) { + if (item.type === IntegrationType.Authority) { + data.page[index] = Object.assign(new AuthorityValue(), item); + } + }); + return data; + }; + IntegrationResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], IntegrationResponseParsingService); + return IntegrationResponseParsingService; +}(BaseResponseParsingService)); +export { IntegrationResponseParsingService }; +//# sourceMappingURL=integration-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/integration/integration-response-parsing.service.js.map b/src/app/core/integration/integration-response-parsing.service.js.map new file mode 100644 index 0000000000..48a736ada4 --- /dev/null +++ b/src/app/core/integration/integration-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"integration-response-parsing.service.js","sourceRoot":"","sources":["integration-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAInD,OAAO,EACL,aAAa,EACb,0BAA0B,EAE3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI1D;IAAuD,6DAA0B;IAK/E,2CACmC,SAAuB,EAC9C,WAA+B;QAF3C,YAIE,iBAAO,SACR;QAJkC,eAAS,GAAT,SAAS,CAAc;QAC9C,iBAAW,GAAX,WAAW,CAAoB;QALjC,mBAAa,GAAG,wBAAwB,CAAC;QACzC,aAAO,GAAG,IAAI,CAAC;;IAOzB,CAAC;IAED,iDAAK,GAAL,UAAM,OAAoB,EAAE,IAA0B;QACpD,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAC/D,IAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAmC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;YAClG,OAAO,IAAI,0BAA0B,CAAC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;SACnJ;aAAM;YACL,OAAO,IAAI,aAAa,CACtB,MAAM,CAAC,MAAM,CACX,IAAI,KAAK,CAAC,+CAA+C,CAAC,EAC1D,EAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAC,CAC3D,CACF,CAAC;SACH;IACH,CAAC;IAES,2DAAe,GAAzB,UAA0B,IAAqC;QAC7D,IAAM,UAAU,GAAG,KAAK,CAAC,EAAE,EAAE,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAC,IAAI,EAAE,KAAK;YAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,SAAS,EAAE;gBAC3C,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC;aAC9D;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAnCU,iCAAiC;QAD7C,UAAU,EAAE;QAOR,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACC,kBAAkB;OAPhC,iCAAiC,CAqC7C;IAAD,wCAAC;CAAA,AArCD,CAAuD,0BAA0B,GAqChF;SArCY,iCAAiC"} \ No newline at end of file diff --git a/src/app/core/integration/integration.service.js b/src/app/core/integration/integration.service.js new file mode 100644 index 0000000000..2138128b65 --- /dev/null +++ b/src/app/core/integration/integration.service.js @@ -0,0 +1,84 @@ +import { of as observableOf, throwError as observableThrowError } from 'rxjs'; +import { distinctUntilChanged, filter, map, mergeMap, tap } from 'rxjs/operators'; +import { IntegrationRequest } from '../data/request.models'; +import { hasValue, isNotEmpty } from '../../shared/empty.util'; +import { IntegrationData } from './integration-data'; +import { IntegrationSearchOptions } from './models/integration-options.model'; +import { getResponseFromEntry } from '../shared/operators'; +var IntegrationService = /** @class */ (function () { + function IntegrationService() { + } + IntegrationService.prototype.getData = function (request) { + return this.requestService.getByHref(request.href).pipe(getResponseFromEntry(), mergeMap(function (response) { + if (response.isSuccessful && isNotEmpty(response)) { + return observableOf(new IntegrationData(response.pageInfo, (response.dataDefinition) ? response.dataDefinition.page : [])); + } + else if (!response.isSuccessful) { + return observableThrowError(new Error("Couldn't retrieve the integration data")); + } + }), distinctUntilChanged()); + }; + IntegrationService.prototype.getEntriesHref = function (endpoint, options) { + if (options === void 0) { options = new IntegrationSearchOptions(); } + var result; + var args = []; + if (hasValue(options.name)) { + result = endpoint + "/" + options.name + "/" + this.entriesEndpoint; + } + else { + result = endpoint; + } + if (hasValue(options.query)) { + args.push("query=" + options.query); + } + if (hasValue(options.metadata)) { + args.push("metadata=" + options.metadata); + } + if (hasValue(options.uuid)) { + args.push("uuid=" + options.uuid); + } + if (hasValue(options.currentPage) && typeof options.currentPage === 'number') { + /* TODO: this is a temporary fix for the pagination start index (0 or 1) discrepancy between the rest and the frontend respectively */ + args.push("page=" + (options.currentPage - 1)); + } + if (hasValue(options.elementsPerPage)) { + args.push("size=" + options.elementsPerPage); + } + if (hasValue(options.sort)) { + args.push("sort=" + options.sort.field + "," + options.sort.direction); + } + if (isNotEmpty(args)) { + result = result + "?" + args.join('&'); + } + return result; + }; + IntegrationService.prototype.getEntryValueHref = function (endpoint, options) { + if (options === void 0) { options = new IntegrationSearchOptions(); } + var result; + var args = []; + if (hasValue(options.name) && hasValue(options.query)) { + result = endpoint + "/" + options.name + "/" + this.entryValueEndpoint + "/" + options.query; + } + else { + result = endpoint; + } + if (hasValue(options.metadata)) { + args.push("metadata=" + options.metadata); + } + if (isNotEmpty(args)) { + result = result + "?" + args.join('&'); + } + return result; + }; + IntegrationService.prototype.getEntriesByName = function (options) { + var _this = this; + return this.halService.getEndpoint(this.linkPath).pipe(map(function (endpoint) { return _this.getEntriesHref(endpoint, options); }), filter(function (href) { return isNotEmpty(href); }), distinctUntilChanged(), map(function (endpointURL) { return new IntegrationRequest(_this.requestService.generateRequestId(), endpointURL); }), tap(function (request) { return _this.requestService.configure(request); }), mergeMap(function (request) { return _this.getData(request); }), distinctUntilChanged()); + }; + IntegrationService.prototype.getEntryByValue = function (options) { + var _this = this; + return this.halService.getEndpoint(this.linkPath).pipe(map(function (endpoint) { return _this.getEntryValueHref(endpoint, options); }), filter(function (href) { return isNotEmpty(href); }), distinctUntilChanged(), map(function (endpointURL) { return new IntegrationRequest(_this.requestService.generateRequestId(), endpointURL); }), tap(function (request) { return _this.requestService.configure(request); }), mergeMap(function (request) { return _this.getData(request); }), distinctUntilChanged()); + }; + return IntegrationService; +}()); +export { IntegrationService }; +//# sourceMappingURL=integration.service.js.map \ No newline at end of file diff --git a/src/app/core/integration/integration.service.js.map b/src/app/core/integration/integration.service.js.map new file mode 100644 index 0000000000..6be9b6439c --- /dev/null +++ b/src/app/core/integration/integration.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"integration.service.js","sourceRoot":"","sources":["integration.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGlF,OAAO,EAAc,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OA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,CAAC,IAAI,CACpD,GAAG,CAAC,UAAC,QAAgB,IAAK,OAAA,KAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAzC,CAAyC,CAAC,EACpE,MAAM,CAAC,UAAC,IAAY,IAAK,OAAA,UAAU,CAAC,IAAI,CAAC,EAAhB,CAAgB,CAAC,EAC1C,oBAAoB,EAAE,EACtB,GAAG,CAAC,UAAC,WAAmB,IAAK,OAAA,IAAI,kBAAkB,CAAC,KAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,EAAE,WAAW,CAAC,EAA5E,CAA4E,CAAC,EAC1G,GAAG,CAAC,UAAC,OAAmB,IAAK,OAAA,KAAI,CAAC,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,EAAtC,CAAsC,CAAC,EACpE,QAAQ,CAAC,UAAC,OAAmB,IAAK,OAAA,KAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAArB,CAAqB,CAAC,EACxD,oBAAoB,EAAE,CAAC,CAAC;IAC5B,CAAC;IAEH,yBAAC;AAAD,CAAC,AA7GD,IA6GC"} \ No newline at end of file diff --git a/src/app/core/integration/intergration-type.js b/src/app/core/integration/intergration-type.js new file mode 100644 index 0000000000..cfbfa76c50 --- /dev/null +++ b/src/app/core/integration/intergration-type.js @@ -0,0 +1,5 @@ +export var IntegrationType; +(function (IntegrationType) { + IntegrationType["Authority"] = "authority"; +})(IntegrationType || (IntegrationType = {})); +//# sourceMappingURL=intergration-type.js.map \ No newline at end of file diff --git a/src/app/core/integration/intergration-type.js.map b/src/app/core/integration/intergration-type.js.map new file mode 100644 index 0000000000..22d36e23e7 --- /dev/null +++ b/src/app/core/integration/intergration-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"intergration-type.js","sourceRoot":"","sources":["intergration-type.ts"],"names":[],"mappings":"AACA,MAAM,CAAN,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,0CAAuB,CAAA;AACzB,CAAC,EAFW,eAAe,KAAf,eAAe,QAE1B"} \ No newline at end of file diff --git a/src/app/core/integration/models/authority-options.model.js b/src/app/core/integration/models/authority-options.model.js new file mode 100644 index 0000000000..b7dd353e92 --- /dev/null +++ b/src/app/core/integration/models/authority-options.model.js @@ -0,0 +1,12 @@ +var AuthorityOptions = /** @class */ (function () { + function AuthorityOptions(name, metadata, scope, closed) { + if (closed === void 0) { closed = false; } + this.name = name; + this.metadata = metadata; + this.scope = scope; + this.closed = closed; + } + return AuthorityOptions; +}()); +export { AuthorityOptions }; +//# sourceMappingURL=authority-options.model.js.map \ No newline at end of file diff --git a/src/app/core/integration/models/authority-options.model.js.map b/src/app/core/integration/models/authority-options.model.js.map new file mode 100644 index 0000000000..a1bb97b0fa --- /dev/null +++ b/src/app/core/integration/models/authority-options.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authority-options.model.js","sourceRoot":"","sources":["authority-options.model.ts"],"names":[],"mappings":"AAAA;IAME,0BAAY,IAAY,EACZ,QAAgB,EAChB,KAAa,EACb,MAAuB;QAAvB,uBAAA,EAAA,cAAuB;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IACH,uBAAC;AAAD,CAAC,AAfD,IAeC"} \ No newline at end of file diff --git a/src/app/core/integration/models/authority.value.js b/src/app/core/integration/models/authority.value.js new file mode 100644 index 0000000000..8aff2025b4 --- /dev/null +++ b/src/app/core/integration/models/authority.value.js @@ -0,0 +1,48 @@ +import * as tslib_1 from "tslib"; +import { IntegrationModel } from './integration.model'; +import { isNotEmpty } from '../../../shared/empty.util'; +import { PLACEHOLDER_PARENT_METADATA } from '../../../shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; +/** + * Class representing an authority object + */ +var AuthorityValue = /** @class */ (function (_super) { + tslib_1.__extends(AuthorityValue, _super); + function AuthorityValue() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * This method checks if authority has an identifier value + * + * @return boolean + */ + AuthorityValue.prototype.hasAuthority = function () { + return isNotEmpty(this.id); + }; + /** + * This method checks if authority has a value + * + * @return boolean + */ + AuthorityValue.prototype.hasValue = function () { + return isNotEmpty(this.value); + }; + /** + * This method checks if authority has related information object + * + * @return boolean + */ + AuthorityValue.prototype.hasOtherInformation = function () { + return isNotEmpty(this.otherInformation); + }; + /** + * This method checks if authority has a placeholder as value + * + * @return boolean + */ + AuthorityValue.prototype.hasPlaceholder = function () { + return this.hasValue() && this.value === PLACEHOLDER_PARENT_METADATA; + }; + return AuthorityValue; +}(IntegrationModel)); +export { AuthorityValue }; +//# sourceMappingURL=authority.value.js.map \ No newline at end of file diff --git a/src/app/core/integration/models/authority.value.js.map b/src/app/core/integration/models/authority.value.js.map new file mode 100644 index 0000000000..3b56e06858 --- /dev/null +++ b/src/app/core/integration/models/authority.value.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authority.value.js","sourceRoot":"","sources":["authority.value.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oGAAoG,CAAC;AAIjJ;;GAEG;AACH;IAAoC,0CAAgB;IAApD;;IA8DA,CAAC;IAnCC;;;;OAIG;IACH,qCAAY,GAAZ;QACE,OAAO,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,iCAAQ,GAAR;QACE,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,4CAAmB,GAAnB;QACE,OAAO,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACH,uCAAc,GAAd;QACE,OAAO,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,KAAK,KAAK,2BAA2B,CAAC;IACvE,CAAC;IACH,qBAAC;AAAD,CAAC,AA9DD,CAAoC,gBAAgB,GA8DnD"} \ No newline at end of file diff --git a/src/app/core/integration/models/confidence-type.js b/src/app/core/integration/models/confidence-type.js new file mode 100644 index 0000000000..3895a17951 --- /dev/null +++ b/src/app/core/integration/models/confidence-type.js @@ -0,0 +1,39 @@ +export var ConfidenceType; +(function (ConfidenceType) { + /** + * This authority value has been confirmed as accurate by an + * interactive user or authoritative policy + */ + ConfidenceType[ConfidenceType["CF_ACCEPTED"] = 600] = "CF_ACCEPTED"; + /** + * Value is singular and valid but has not been seen and accepted + * by a human, so its provenance is uncertain. + */ + ConfidenceType[ConfidenceType["CF_UNCERTAIN"] = 500] = "CF_UNCERTAIN"; + /** + * There are multiple matching authority values of equal validity. + */ + ConfidenceType[ConfidenceType["CF_AMBIGUOUS"] = 400] = "CF_AMBIGUOUS"; + /** + * There are no matching answers from the authority. + */ + ConfidenceType[ConfidenceType["CF_NOTFOUND"] = 300] = "CF_NOTFOUND"; + /** + * The authority encountered an internal failure - this preserves a + * record in the metadata of why there is no value. + */ + ConfidenceType[ConfidenceType["CF_FAILED"] = 200] = "CF_FAILED"; + /** + * The authority recommends this submission be rejected. + */ + ConfidenceType[ConfidenceType["CF_REJECTED"] = 100] = "CF_REJECTED"; + /** + * No reasonable confidence value is available + */ + ConfidenceType[ConfidenceType["CF_NOVALUE"] = 0] = "CF_NOVALUE"; + /** + * Value has not been set (DB default). + */ + ConfidenceType[ConfidenceType["CF_UNSET"] = -1] = "CF_UNSET"; +})(ConfidenceType || (ConfidenceType = {})); +//# sourceMappingURL=confidence-type.js.map \ No newline at end of file diff --git a/src/app/core/integration/models/confidence-type.js.map b/src/app/core/integration/models/confidence-type.js.map new file mode 100644 index 0000000000..f716d3ef42 --- /dev/null +++ b/src/app/core/integration/models/confidence-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"confidence-type.js","sourceRoot":"","sources":["confidence-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cA2CX;AA3CD,WAAY,cAAc;IACxB;;;OAGG;IACH,mEAAiB,CAAA;IAEjB;;;OAGG;IACH,qEAAkB,CAAA;IAElB;;OAEG;IACH,qEAAkB,CAAA;IAElB;;OAEG;IACH,mEAAiB,CAAA;IAEjB;;;OAGG;IACH,+DAAe,CAAA;IAEf;;OAEG;IACH,mEAAiB,CAAA;IAEjB;;OAEG;IACH,+DAAc,CAAA;IAEd;;OAEG;IACH,4DAAa,CAAA;AACf,CAAC,EA3CW,cAAc,KAAd,cAAc,QA2CzB"} \ No newline at end of file diff --git a/src/app/core/integration/models/integration-options.model.js b/src/app/core/integration/models/integration-options.model.js new file mode 100644 index 0000000000..37c3c4cf3c --- /dev/null +++ b/src/app/core/integration/models/integration-options.model.js @@ -0,0 +1,18 @@ +var IntegrationSearchOptions = /** @class */ (function () { + function IntegrationSearchOptions(uuid, name, metadata, query, elementsPerPage, currentPage, sort) { + if (uuid === void 0) { uuid = ''; } + if (name === void 0) { name = ''; } + if (metadata === void 0) { metadata = ''; } + if (query === void 0) { query = ''; } + this.uuid = uuid; + this.name = name; + this.metadata = metadata; + this.query = query; + this.elementsPerPage = elementsPerPage; + this.currentPage = currentPage; + this.sort = sort; + } + return IntegrationSearchOptions; +}()); +export { IntegrationSearchOptions }; +//# sourceMappingURL=integration-options.model.js.map \ No newline at end of file diff --git a/src/app/core/integration/models/integration-options.model.js.map b/src/app/core/integration/models/integration-options.model.js.map new file mode 100644 index 0000000000..d4395a3ed4 --- /dev/null +++ b/src/app/core/integration/models/integration-options.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"integration-options.model.js","sourceRoot":"","sources":["integration-options.model.ts"],"names":[],"mappings":"AAEA;IAEE,kCAAmB,IAAiB,EACjB,IAAiB,EACjB,QAAqB,EACrB,KAAkB,EAClB,eAAwB,EACxB,WAAoB,EACpB,IAAkB;QANlB,qBAAA,EAAA,SAAiB;QACjB,qBAAA,EAAA,SAAiB;QACjB,yBAAA,EAAA,aAAqB;QACrB,sBAAA,EAAA,UAAkB;QAHlB,SAAI,GAAJ,IAAI,CAAa;QACjB,SAAI,GAAJ,IAAI,CAAa;QACjB,aAAQ,GAAR,QAAQ,CAAa;QACrB,UAAK,GAAL,KAAK,CAAa;QAClB,oBAAe,GAAf,eAAe,CAAS;QACxB,gBAAW,GAAX,WAAW,CAAS;QACpB,SAAI,GAAJ,IAAI,CAAc;IAErC,CAAC;IACH,+BAAC;AAAD,CAAC,AAXD,IAWC"} \ No newline at end of file diff --git a/src/app/core/integration/models/integration.model.js b/src/app/core/integration/models/integration.model.js new file mode 100644 index 0000000000..d77588dd49 --- /dev/null +++ b/src/app/core/integration/models/integration.model.js @@ -0,0 +1,25 @@ +import * as tslib_1 from "tslib"; +import { autoserialize } from 'cerialize'; +var IntegrationModel = /** @class */ (function () { + function IntegrationModel() { + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], IntegrationModel.prototype, "self", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], IntegrationModel.prototype, "uuid", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Object) + ], IntegrationModel.prototype, "type", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Object) + ], IntegrationModel.prototype, "_links", void 0); + return IntegrationModel; +}()); +export { IntegrationModel }; +//# sourceMappingURL=integration.model.js.map \ No newline at end of file diff --git a/src/app/core/integration/models/integration.model.js.map b/src/app/core/integration/models/integration.model.js.map new file mode 100644 index 0000000000..b6fe631caf --- /dev/null +++ b/src/app/core/integration/models/integration.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"integration.model.js","sourceRoot":"","sources":["integration.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C;IAAA;IAgBA,CAAC;IAbC;QADC,aAAa;;kDACD;IAGb;QADC,aAAa;;kDACD;IAGb;QADC,aAAa;;kDACG;IAGjB;QADC,aAAa;;oDAGb;IAEH,uBAAC;CAAA,AAhBD,IAgBC;SAhBqB,gBAAgB"} \ No newline at end of file diff --git a/src/app/core/integration/models/normalized-authority-value.model.js b/src/app/core/integration/models/normalized-authority-value.model.js new file mode 100644 index 0000000000..7531a3f0f3 --- /dev/null +++ b/src/app/core/integration/models/normalized-authority-value.model.js @@ -0,0 +1,41 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, inheritSerialization } from 'cerialize'; +import { IntegrationModel } from './integration.model'; +import { mapsTo } from '../../cache/builders/build-decorators'; +import { AuthorityValue } from './authority.value'; +/** + * Normalized model class for an Authority Value + */ +var NormalizedAuthorityValue = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedAuthorityValue, _super); + function NormalizedAuthorityValue() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedAuthorityValue.prototype, "id", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedAuthorityValue.prototype, "display", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedAuthorityValue.prototype, "value", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Object) + ], NormalizedAuthorityValue.prototype, "otherInformation", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedAuthorityValue.prototype, "language", void 0); + NormalizedAuthorityValue = tslib_1.__decorate([ + mapsTo(AuthorityValue), + inheritSerialization(IntegrationModel) + ], NormalizedAuthorityValue); + return NormalizedAuthorityValue; +}(IntegrationModel)); +export { NormalizedAuthorityValue }; +//# sourceMappingURL=normalized-authority-value.model.js.map \ No newline at end of file diff --git a/src/app/core/integration/models/normalized-authority-value.model.js.map b/src/app/core/integration/models/normalized-authority-value.model.js.map new file mode 100644 index 0000000000..9fe308140b --- /dev/null +++ b/src/app/core/integration/models/normalized-authority-value.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-authority-value.model.js","sourceRoot":"","sources":["normalized-authority-value.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AAGH;IAA8C,oDAAgB;IAA9D;;IAiBA,CAAC;IAdC;QADC,aAAa;;wDACH;IAGX;QADC,aAAa;;6DACE;IAGhB;QADC,aAAa;;2DACA;IAGd;QADC,aAAa;;sEACQ;IAGtB;QADC,aAAa;;8DACG;IAfN,wBAAwB;QAFpC,MAAM,CAAC,cAAc,CAAC;QACtB,oBAAoB,CAAC,gBAAgB,CAAC;OAC1B,wBAAwB,CAiBpC;IAAD,+BAAC;CAAA,AAjBD,CAA8C,gBAAgB,GAiB7D;SAjBY,wBAAwB"} \ No newline at end of file diff --git a/src/app/core/json-patch/builder/json-patch-operation-path-combiner.js b/src/app/core/json-patch/builder/json-patch-operation-path-combiner.js new file mode 100644 index 0000000000..c73e04bb3e --- /dev/null +++ b/src/app/core/json-patch/builder/json-patch-operation-path-combiner.js @@ -0,0 +1,56 @@ +import * as tslib_1 from "tslib"; +import { isNotUndefined } from '../../../shared/empty.util'; +import { URLCombiner } from '../../url-combiner/url-combiner'; +/** + * Combines a variable number of strings representing parts + * of a JSON-PATCH path + */ +var JsonPatchOperationPathCombiner = /** @class */ (function (_super) { + tslib_1.__extends(JsonPatchOperationPathCombiner, _super); + function JsonPatchOperationPathCombiner(rootElement) { + var subRootElements = []; + for (var _i = 1; _i < arguments.length; _i++) { + subRootElements[_i - 1] = arguments[_i]; + } + var _this = _super.apply(this, [rootElement].concat(subRootElements)) || this; + _this._rootElement = rootElement; + _this._subRootElement = subRootElements.join('/'); + return _this; + } + Object.defineProperty(JsonPatchOperationPathCombiner.prototype, "rootElement", { + get: function () { + return this._rootElement; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(JsonPatchOperationPathCombiner.prototype, "subRootElement", { + get: function () { + return this._subRootElement; + }, + enumerable: true, + configurable: true + }); + /** + * Combines the parts of this JsonPatchOperationPathCombiner in to a JSON-PATCH path member + * + * e.g. new JsonPatchOperationPathCombiner('sections', 'basic').getPath(['dc.title', '0']) + * returns: {rootElement: 'sections', subRootElement: 'basic', path: '/sections/basic/dc.title/0'} + * + * @return {JsonPatchOperationPathObject} + * The combined path object + */ + JsonPatchOperationPathCombiner.prototype.getPath = function (fragment) { + if (isNotUndefined(fragment) && Array.isArray(fragment)) { + fragment = fragment.join('/'); + } + var path = '/' + this.toString(); + if (isNotUndefined(fragment)) { + path += '/' + fragment; + } + return { rootElement: this._rootElement, subRootElement: this._subRootElement, path: path }; + }; + return JsonPatchOperationPathCombiner; +}(URLCombiner)); +export { JsonPatchOperationPathCombiner }; +//# sourceMappingURL=json-patch-operation-path-combiner.js.map \ No newline at end of file diff --git a/src/app/core/json-patch/builder/json-patch-operation-path-combiner.js.map b/src/app/core/json-patch/builder/json-patch-operation-path-combiner.js.map new file mode 100644 index 0000000000..277d072c2a --- /dev/null +++ b/src/app/core/json-patch/builder/json-patch-operation-path-combiner.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-patch-operation-path-combiner.js","sourceRoot":"","sources":["json-patch-operation-path-combiner.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAY9D;;;GAGG;AACH;IAAoD,0DAAW;IAI7D,wCAAY,WAAW;QAAE,yBAA4B;aAA5B,UAA4B,EAA5B,qBAA4B,EAA5B,IAA4B;YAA5B,wCAA4B;;QAArD,gCACQ,WAAW,SAAK,eAAe,WAGtC;QAFC,KAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,KAAI,CAAC,eAAe,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;IACnD,CAAC;IAED,sBAAI,uDAAW;aAAf;YACE,OAAO,IAAI,CAAC,YAAY,CAAC;QAC3B,CAAC;;;OAAA;IAED,sBAAI,0DAAc;aAAlB;YACE,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;;;OAAA;IAED;;;;;;;;OAQG;IACI,gDAAO,GAAd,UAAe,QAA0B;QACvC,IAAI,cAAc,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACvD,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAC/B;QAED,IAAI,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QACjC,IAAI,cAAc,CAAC,QAAQ,CAAC,EAAE;YAC5B,IAAI,IAAI,GAAG,GAAG,QAAQ,CAAC;SACxB;QAED,OAAO,EAAC,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,EAAC,CAAC;IAC5F,CAAC;IACH,qCAAC;AAAD,CAAC,AAvCD,CAAoD,WAAW,GAuC9D"} \ No newline at end of file diff --git a/src/app/core/json-patch/builder/json-patch-operations-builder.js b/src/app/core/json-patch/builder/json-patch-operations-builder.js new file mode 100644 index 0000000000..87d4f918f7 --- /dev/null +++ b/src/app/core/json-patch/builder/json-patch-operations-builder.js @@ -0,0 +1,134 @@ +import * as tslib_1 from "tslib"; +import { Store } from '@ngrx/store'; +import { NewPatchAddOperationAction, NewPatchRemoveOperationAction, NewPatchReplaceOperationAction } from '../json-patch-operations.actions'; +import { Injectable } from '@angular/core'; +import { isEmpty, isNotEmpty } from '../../../shared/empty.util'; +import { dateToISOFormat } from '../../../shared/date.util'; +import { AuthorityValue } from '../../integration/models/authority.value'; +import { FormFieldMetadataValueObject } from '../../../shared/form/builder/models/form-field-metadata-value.model'; +import { FormFieldLanguageValueObject } from '../../../shared/form/builder/models/form-field-language-value.model'; +/** + * Provides methods to dispatch JsonPatch Operations Actions + */ +var JsonPatchOperationsBuilder = /** @class */ (function () { + function JsonPatchOperationsBuilder(store) { + this.store = store; + } + /** + * Dispatches a new NewPatchAddOperationAction + * + * @param path + * a JsonPatchOperationPathObject representing path + * @param value + * The value to update the referenced path + * @param first + * A boolean representing if the value to be added is the first of an array + * @param plain + * A boolean representing if the value to be added is a plain text value + */ + JsonPatchOperationsBuilder.prototype.add = function (path, value, first, plain) { + if (first === void 0) { first = false; } + if (plain === void 0) { plain = false; } + this.store.dispatch(new NewPatchAddOperationAction(path.rootElement, path.subRootElement, path.path, this.prepareValue(value, plain, first))); + }; + /** + * Dispatches a new NewPatchReplaceOperationAction + * + * @param path + * a JsonPatchOperationPathObject representing path + * @param value + * the value to update the referenced path + * @param plain + * a boolean representing if the value to be added is a plain text value + */ + JsonPatchOperationsBuilder.prototype.replace = function (path, value, plain) { + if (plain === void 0) { plain = false; } + this.store.dispatch(new NewPatchReplaceOperationAction(path.rootElement, path.subRootElement, path.path, this.prepareValue(value, plain, false))); + }; + /** + * Dispatches a new NewPatchRemoveOperationAction + * + * @param path + * a JsonPatchOperationPathObject representing path + */ + JsonPatchOperationsBuilder.prototype.remove = function (path) { + this.store.dispatch(new NewPatchRemoveOperationAction(path.rootElement, path.subRootElement, path.path)); + }; + JsonPatchOperationsBuilder.prototype.prepareValue = function (value, plain, first) { + var _this = this; + var operationValue = null; + if (isNotEmpty(value)) { + if (plain) { + operationValue = value; + } + else { + if (Array.isArray(value)) { + operationValue = []; + value.forEach(function (entry) { + if ((typeof entry === 'object')) { + operationValue.push(_this.prepareObjectValue(entry)); + } + else { + operationValue.push(new FormFieldMetadataValueObject(entry)); + } + }); + } + else if (typeof value === 'object') { + operationValue = this.prepareObjectValue(value); + } + else { + operationValue = new FormFieldMetadataValueObject(value); + } + } + } + return (first && !Array.isArray(operationValue)) ? [operationValue] : operationValue; + }; + JsonPatchOperationsBuilder.prototype.prepareObjectValue = function (value) { + var _this = this; + var operationValue = Object.create({}); + if (isEmpty(value) || value instanceof FormFieldMetadataValueObject) { + operationValue = value; + } + else if (value instanceof Date) { + operationValue = new FormFieldMetadataValueObject(dateToISOFormat(value)); + } + else if (value instanceof AuthorityValue) { + operationValue = this.prepareAuthorityValue(value); + } + else if (value instanceof FormFieldLanguageValueObject) { + operationValue = new FormFieldMetadataValueObject(value.value, value.language); + } + else if (value.hasOwnProperty('value')) { + operationValue = new FormFieldMetadataValueObject(value.value); + } + else { + Object.keys(value) + .forEach(function (key) { + if (typeof value[key] === 'object') { + operationValue[key] = _this.prepareObjectValue(value[key]); + } + else { + operationValue[key] = value[key]; + } + }); + } + return operationValue; + }; + JsonPatchOperationsBuilder.prototype.prepareAuthorityValue = function (value) { + var operationValue = null; + if (isNotEmpty(value.id)) { + operationValue = new FormFieldMetadataValueObject(value.value, value.language, value.id); + } + else { + operationValue = new FormFieldMetadataValueObject(value.value, value.language); + } + return operationValue; + }; + JsonPatchOperationsBuilder = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Store]) + ], JsonPatchOperationsBuilder); + return JsonPatchOperationsBuilder; +}()); +export { JsonPatchOperationsBuilder }; +//# sourceMappingURL=json-patch-operations-builder.js.map \ No newline at end of file diff --git a/src/app/core/json-patch/builder/json-patch-operations-builder.js.map b/src/app/core/json-patch/builder/json-patch-operations-builder.js.map new file mode 100644 index 0000000000..f401e75cae --- /dev/null +++ b/src/app/core/json-patch/builder/json-patch-operations-builder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-patch-operations-builder.js","sourceRoot":"","sources":["json-patch-operations-builder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,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AAQ,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;SAC1F;aAAM;YACL,cAAc,GAAG,IAAI,4BAA4B,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;SAChF;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;IApHU,0BAA0B;QADtC,UAAU,EAAE;iDAGgB,KAAK;OAFrB,0BAA0B,CAsHtC;IAAD,iCAAC;CAAA,AAtHD,IAsHC;SAtHY,0BAA0B"} \ No newline at end of file diff --git a/src/app/core/json-patch/json-patch-operations.actions.js b/src/app/core/json-patch/json-patch-operations.actions.js new file mode 100644 index 0000000000..9f02747448 --- /dev/null +++ b/src/app/core/json-patch/json-patch-operations.actions.js @@ -0,0 +1,213 @@ +import { type } from '../../shared/ngrx/type'; +/** + * For each action type in an action group, make a simple + * enum object for all of this group's action types. + * + * The 'type' utility function coerces strings into string + * literal types and runs a simple check to guarantee all + * action types in the application are unique. + */ +export var JsonPatchOperationsActionTypes = { + NEW_JSON_PATCH_ADD_OPERATION: type('dspace/core/patch/NEW_JSON_PATCH_ADD_OPERATION'), + NEW_JSON_PATCH_COPY_OPERATION: type('dspace/core/patch/NEW_JSON_PATCH_COPY_OPERATION'), + NEW_JSON_PATCH_MOVE_OPERATION: type('dspace/core/patch/NEW_JSON_PATCH_MOVE_OPERATION'), + NEW_JSON_PATCH_REMOVE_OPERATION: type('dspace/core/patch/NEW_JSON_PATCH_REMOVE_OPERATION'), + NEW_JSON_PATCH_REPLACE_OPERATION: type('dspace/core/patch/NEW_JSON_PATCH_REPLACE_OPERATION'), + COMMIT_JSON_PATCH_OPERATIONS: type('dspace/core/patch/COMMIT_JSON_PATCH_OPERATIONS'), + ROLLBACK_JSON_PATCH_OPERATIONS: type('dspace/core/patch/ROLLBACK_JSON_PATCH_OPERATIONS'), + FLUSH_JSON_PATCH_OPERATIONS: type('dspace/core/patch/FLUSH_JSON_PATCH_OPERATIONS'), + START_TRANSACTION_JSON_PATCH_OPERATIONS: type('dspace/core/patch/START_TRANSACTION_JSON_PATCH_OPERATIONS'), +}; +/* tslint:disable:max-classes-per-file */ +/** + * An ngrx action to commit the current transaction + */ +var CommitPatchOperationsAction = /** @class */ (function () { + /** + * Create a new CommitPatchOperationsAction + * + * @param resourceType + * the resource's type + * @param resourceId + * the resource's ID + */ + function CommitPatchOperationsAction(resourceType, resourceId) { + this.type = JsonPatchOperationsActionTypes.COMMIT_JSON_PATCH_OPERATIONS; + this.payload = { resourceType: resourceType, resourceId: resourceId }; + } + return CommitPatchOperationsAction; +}()); +export { CommitPatchOperationsAction }; +/** + * An ngrx action to rollback the current transaction + */ +var RollbacktPatchOperationsAction = /** @class */ (function () { + /** + * Create a new CommitPatchOperationsAction + * + * @param resourceType + * the resource's type + * @param resourceId + * the resource's ID + */ + function RollbacktPatchOperationsAction(resourceType, resourceId) { + this.type = JsonPatchOperationsActionTypes.ROLLBACK_JSON_PATCH_OPERATIONS; + this.payload = { resourceType: resourceType, resourceId: resourceId }; + } + return RollbacktPatchOperationsAction; +}()); +export { RollbacktPatchOperationsAction }; +/** + * An ngrx action to initiate a transaction block + */ +var StartTransactionPatchOperationsAction = /** @class */ (function () { + /** + * Create a new CommitPatchOperationsAction + * + * @param resourceType + * the resource's type + * @param resourceId + * the resource's ID + * @param startTime + * the start timestamp + */ + function StartTransactionPatchOperationsAction(resourceType, resourceId, startTime) { + this.type = JsonPatchOperationsActionTypes.START_TRANSACTION_JSON_PATCH_OPERATIONS; + this.payload = { resourceType: resourceType, resourceId: resourceId, startTime: startTime }; + } + return StartTransactionPatchOperationsAction; +}()); +export { StartTransactionPatchOperationsAction }; +/** + * An ngrx action to flush list of the JSON Patch operations + */ +var FlushPatchOperationsAction = /** @class */ (function () { + /** + * Create a new FlushPatchOperationsAction + * + * @param resourceType + * the resource's type + * @param resourceId + * the resource's ID + */ + function FlushPatchOperationsAction(resourceType, resourceId) { + this.type = JsonPatchOperationsActionTypes.FLUSH_JSON_PATCH_OPERATIONS; + this.payload = { resourceType: resourceType, resourceId: resourceId }; + } + return FlushPatchOperationsAction; +}()); +export { FlushPatchOperationsAction }; +/** + * An ngrx action to Add new HTTP/PATCH ADD operations to state + */ +var NewPatchAddOperationAction = /** @class */ (function () { + /** + * Create a new NewPatchAddOperationAction + * + * @param resourceType + * the resource's type where to add operation + * @param resourceId + * the resource's ID + * @param path + * the path of the operation + * @param value + * the operation's payload + */ + function NewPatchAddOperationAction(resourceType, resourceId, path, value) { + this.type = JsonPatchOperationsActionTypes.NEW_JSON_PATCH_ADD_OPERATION; + this.payload = { resourceType: resourceType, resourceId: resourceId, path: path, value: value }; + } + return NewPatchAddOperationAction; +}()); +export { NewPatchAddOperationAction }; +/** + * An ngrx action to add new JSON Patch COPY operation to state + */ +var NewPatchCopyOperationAction = /** @class */ (function () { + /** + * Create a new NewPatchCopyOperationAction + * + * @param resourceType + * the resource's type + * @param resourceId + * the resource's ID + * @param from + * the path to copy the value from + * @param path + * the path where to copy the value + */ + function NewPatchCopyOperationAction(resourceType, resourceId, from, path) { + this.type = JsonPatchOperationsActionTypes.NEW_JSON_PATCH_COPY_OPERATION; + this.payload = { resourceType: resourceType, resourceId: resourceId, from: from, path: path }; + } + return NewPatchCopyOperationAction; +}()); +export { NewPatchCopyOperationAction }; +/** + * An ngrx action to Add new JSON Patch MOVE operation to state + */ +var NewPatchMoveOperationAction = /** @class */ (function () { + /** + * Create a new NewPatchMoveOperationAction + * + * @param resourceType + * the resource's type + * @param resourceId + * the resource's ID + * @param from + * the path to move the value from + * @param path + * the path where to move the value + */ + function NewPatchMoveOperationAction(resourceType, resourceId, from, path) { + this.type = JsonPatchOperationsActionTypes.NEW_JSON_PATCH_MOVE_OPERATION; + this.payload = { resourceType: resourceType, resourceId: resourceId, from: from, path: path }; + } + return NewPatchMoveOperationAction; +}()); +export { NewPatchMoveOperationAction }; +/** + * An ngrx action to Add new JSON Patch REMOVE operation to state + */ +var NewPatchRemoveOperationAction = /** @class */ (function () { + /** + * Create a new NewPatchRemoveOperationAction + * + * @param resourceType + * the resource's type + * @param resourceId + * the resource's ID + * @param path + * the path of the operation + */ + function NewPatchRemoveOperationAction(resourceType, resourceId, path) { + this.type = JsonPatchOperationsActionTypes.NEW_JSON_PATCH_REMOVE_OPERATION; + this.payload = { resourceType: resourceType, resourceId: resourceId, path: path }; + } + return NewPatchRemoveOperationAction; +}()); +export { NewPatchRemoveOperationAction }; +/** + * An ngrx action to add new JSON Patch REPLACE operation to state + */ +var NewPatchReplaceOperationAction = /** @class */ (function () { + /** + * Create a new NewPatchReplaceOperationAction + * + * @param resourceType + * the resource's type + * @param resourceId + * the resource's ID + * @param path + * the path of the operation + * @param value + * the operation's payload + */ + function NewPatchReplaceOperationAction(resourceType, resourceId, path, value) { + this.type = JsonPatchOperationsActionTypes.NEW_JSON_PATCH_REPLACE_OPERATION; + this.payload = { resourceType: resourceType, resourceId: resourceId, path: path, value: value }; + } + return NewPatchReplaceOperationAction; +}()); +export { NewPatchReplaceOperationAction }; +//# sourceMappingURL=json-patch-operations.actions.js.map \ No newline at end of file diff --git a/src/app/core/json-patch/json-patch-operations.actions.js.map b/src/app/core/json-patch/json-patch-operations.actions.js.map new file mode 100644 index 0000000000..13851a1595 --- /dev/null +++ b/src/app/core/json-patch/json-patch-operations.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-patch-operations.actions.js","sourceRoot":"","sources":["json-patch-operations.actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,8BAA8B,GAAG;IAC5C,4BAA4B,EAAE,IAAI,CAAC,gDAAgD,CAAC;IACpF,6BAA6B,EAAE,IAAI,CAAC,iDAAiD,CAAC;IACtF,6BAA6B,EAAE,IAAI,CAAC,iDAAiD,CAAC;IACtF,+BAA+B,EAAE,IAAI,CAAC,mDAAmD,CAAC;IAC1F,gCAAgC,EAAE,IAAI,CAAC,oDAAoD,CAAC;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;;AAED;;GAEG;AACH;IASE;;;;;;;;;;;OAWG;IACH,wCAAY,YAAoB,EAAE,UAAkB,EAAE,IAAY,EAAE,KAAU;QApB9E,SAAI,GAAG,8BAA8B,CAAC,gCAAgC,CAAC;QAqBrE,IAAI,CAAC,OAAO,GAAG,EAAE,YAAY,cAAA,EAAE,UAAU,YAAA,EAAE,IAAI,MAAA,EAAE,KAAK,OAAA,EAAE,CAAC;IAC3D,CAAC;IACH,qCAAC;AAAD,CAAC,AAxBD,IAwBC"} \ No newline at end of file diff --git a/src/app/core/json-patch/json-patch-operations.effects.js b/src/app/core/json-patch/json-patch-operations.effects.js new file mode 100644 index 0000000000..2d8bc5ffff --- /dev/null +++ b/src/app/core/json-patch/json-patch-operations.effects.js @@ -0,0 +1,30 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { map } from 'rxjs/operators'; +import { Effect, Actions, ofType } from '@ngrx/effects'; +import { FlushPatchOperationsAction, JsonPatchOperationsActionTypes } from './json-patch-operations.actions'; +/** + * Provides effect methods for jsonPatch Operations actions + */ +var JsonPatchOperationsEffects = /** @class */ (function () { + function JsonPatchOperationsEffects(actions$) { + this.actions$ = actions$; + /** + * Dispatches a FlushPatchOperationsAction for every dispatched CommitPatchOperationsAction + */ + this.commit$ = this.actions$.pipe(ofType(JsonPatchOperationsActionTypes.COMMIT_JSON_PATCH_OPERATIONS), map(function (action) { + return new FlushPatchOperationsAction(action.payload.resourceType, action.payload.resourceId); + })); + } + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], JsonPatchOperationsEffects.prototype, "commit$", void 0); + JsonPatchOperationsEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Actions]) + ], JsonPatchOperationsEffects); + return JsonPatchOperationsEffects; +}()); +export { JsonPatchOperationsEffects }; +//# sourceMappingURL=json-patch-operations.effects.js.map \ No newline at end of file diff --git a/src/app/core/json-patch/json-patch-operations.effects.js.map b/src/app/core/json-patch/json-patch-operations.effects.js.map new file mode 100644 index 0000000000..f78e5b8595 --- /dev/null +++ b/src/app/core/json-patch/json-patch-operations.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-patch-operations.effects.js","sourceRoot":"","sources":["json-patch-operations.effects.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EACwB,0BAA0B,EACvD,8BAA8B,EAC/B,MAAM,iCAAiC,CAAC;AAEzC;;GAEG;AAEH;IAWE,oCAAoB,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;QATrC;;WAEG;QACO,YAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CACpC,MAAM,CAAC,8BAA8B,CAAC,4BAA4B,CAAC,EACnE,GAAG,CAAC,UAAC,MAAmC;YACtC,OAAO,IAAI,0BAA0B,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAChG,CAAC,CAAC,CAAC,CAAC;IAEkC,CAAC;IAN/B;QAAT,MAAM,EAAE;;+DAIH;IATK,0BAA0B;QADtC,UAAU,EAAE;iDAYmB,OAAO;OAX1B,0BAA0B,CAatC;IAAD,iCAAC;CAAA,AAbD,IAaC;SAbY,0BAA0B"} \ No newline at end of file diff --git a/src/app/core/json-patch/json-patch-operations.reducer.js b/src/app/core/json-patch/json-patch-operations.reducer.js new file mode 100644 index 0000000000..5ebda1661d --- /dev/null +++ b/src/app/core/json-patch/json-patch-operations.reducer.js @@ -0,0 +1,264 @@ +import { hasValue, isNotEmpty, isNotUndefined, isNull } from '../../shared/empty.util'; +import { JsonPatchOperationsActionTypes } from './json-patch-operations.actions'; +import { JsonPatchOperationType } from './json-patch.model'; +var initialState = Object.create(null); +/** + * The JSON-PATCH operations Reducer + * + * @param state + * the current state + * @param action + * the action to perform on the state + * @return JsonPatchOperationsState + * the new state + */ +export function jsonPatchOperationsReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case JsonPatchOperationsActionTypes.COMMIT_JSON_PATCH_OPERATIONS: { + return commitOperations(state, action); + } + case JsonPatchOperationsActionTypes.FLUSH_JSON_PATCH_OPERATIONS: { + return flushOperation(state, action); + } + case JsonPatchOperationsActionTypes.NEW_JSON_PATCH_ADD_OPERATION: { + return newOperation(state, action); + } + case JsonPatchOperationsActionTypes.NEW_JSON_PATCH_COPY_OPERATION: { + return newOperation(state, action); + } + case JsonPatchOperationsActionTypes.NEW_JSON_PATCH_MOVE_OPERATION: { + return newOperation(state, action); + } + case JsonPatchOperationsActionTypes.NEW_JSON_PATCH_REMOVE_OPERATION: { + return newOperation(state, action); + } + case JsonPatchOperationsActionTypes.NEW_JSON_PATCH_REPLACE_OPERATION: { + return newOperation(state, action); + } + case JsonPatchOperationsActionTypes.ROLLBACK_JSON_PATCH_OPERATIONS: { + return rollbackOperations(state, action); + } + case JsonPatchOperationsActionTypes.START_TRANSACTION_JSON_PATCH_OPERATIONS: { + return startTransactionPatchOperations(state, action); + } + default: { + return state; + } + } +} +/** + * Set the transaction start time. + * + * @param state + * the current state + * @param action + * an StartTransactionPatchOperationsAction + * @return JsonPatchOperationsState + * the new state. + */ +function startTransactionPatchOperations(state, action) { + var _a; + if (hasValue(state[action.payload.resourceType]) + && isNull(state[action.payload.resourceType].transactionStartTime)) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.resourceType] = Object.assign({}, state[action.payload.resourceType], { + transactionStartTime: action.payload.startTime, + commitPending: true + }), + _a)); + } + else { + return state; + } +} +/** + * Set commit pending state. + * + * @param state + * the current state + * @param action + * an CommitPatchOperationsAction + * @return JsonPatchOperationsState + * the new state, with the section new validity status. + */ +function commitOperations(state, action) { + var _a; + if (hasValue(state[action.payload.resourceType]) + && state[action.payload.resourceType].commitPending) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.resourceType] = Object.assign({}, state[action.payload.resourceType], { + commitPending: false + }), + _a)); + } + else { + return state; + } +} +/** + * Set commit pending state. + * + * @param state + * the current state + * @param action + * an RollbacktPatchOperationsAction + * @return JsonPatchOperationsState + * the new state. + */ +function rollbackOperations(state, action) { + var _a; + if (hasValue(state[action.payload.resourceType]) + && state[action.payload.resourceType].commitPending) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.resourceType] = Object.assign({}, state[action.payload.resourceType], { + transactionStartTime: null, + commitPending: false + }), + _a)); + } + else { + return state; + } +} +/** + * Add new JSON patch operation list. + * + * @param state + * the current state + * @param action + * an NewPatchAddOperationAction + * @return JsonPatchOperationsState + * the new state, with the section new validity status. + */ +function newOperation(state, action) { + var _a, _b, _c, _d; + var newState = Object.assign({}, state); + var body = hasValidBody(newState, action.payload.resourceType, action.payload.resourceId) + ? newState[action.payload.resourceType].children[action.payload.resourceId].body : Array.of(); + var newBody = addOperationToList(body, action.type, action.payload.path, hasValue(action.payload.value) ? action.payload.value : null); + if (hasValue(newState[action.payload.resourceType]) + && hasValue(newState[action.payload.resourceType].children)) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.resourceType] = Object.assign({}, state[action.payload.resourceType], { + children: Object.assign({}, state[action.payload.resourceType].children, (_b = {}, + _b[action.payload.resourceId] = { + body: newBody, + }, + _b)), + commitPending: isNotUndefined(state[action.payload.resourceType].commitPending) ? state[action.payload.resourceType].commitPending : false + }), + _a)); + } + else { + return Object.assign({}, state, (_c = {}, + _c[action.payload.resourceType] = Object.assign({}, { + children: (_d = {}, + _d[action.payload.resourceId] = { + body: newBody, + }, + _d), + transactionStartTime: null, + commitPending: false + }), + _c)); + } +} +/** + * Check if state has a valid body. + * + * @param state + * the current state + * @param resourceType + * an resource type + * @param resourceId + * an resource ID + * @return boolean + */ +function hasValidBody(state, resourceType, resourceId) { + return (hasValue(state[resourceType]) + && hasValue(state[resourceType].children) + && hasValue(state[resourceType].children[resourceId]) + && isNotEmpty(state[resourceType].children[resourceId].body)); +} +/** + * Set the section validity. + * + * @param state + * the current state + * @param action + * an FlushPatchOperationsAction + * @return SubmissionObjectState + * the new state, with the section new validity status. + */ +function flushOperation(state, action) { + var _a, _b; + if (hasValue(state[action.payload.resourceType])) { + var newChildren_1; + if (isNotUndefined(action.payload.resourceId)) { + // flush only specified child's operations + if (hasValue(state[action.payload.resourceType].children) + && hasValue(state[action.payload.resourceType].children[action.payload.resourceId])) { + newChildren_1 = Object.assign({}, state[action.payload.resourceType].children, (_a = {}, + _a[action.payload.resourceId] = { + body: state[action.payload.resourceType].children[action.payload.resourceId].body + .filter(function (entry) { return entry.timeAdded > state[action.payload.resourceType].transactionStartTime; }) + }, + _a)); + } + else { + newChildren_1 = state[action.payload.resourceType].children; + } + } + else { + // flush all children's operations + newChildren_1 = state[action.payload.resourceType].children; + Object.keys(newChildren_1) + .forEach(function (resourceId) { + var _a; + newChildren_1 = Object.assign({}, newChildren_1, (_a = {}, + _a[resourceId] = { + body: newChildren_1[resourceId].body + .filter(function (entry) { return entry.timeAdded > state[action.payload.resourceType].transactionStartTime; }) + }, + _a)); + }); + } + return Object.assign({}, state, (_b = {}, + _b[action.payload.resourceType] = Object.assign({}, state[action.payload.resourceType], { + children: newChildren_1, + transactionStartTime: null, + }), + _b)); + } + else { + return state; + } +} +function addOperationToList(body, actionType, targetPath, value) { + var newBody = Array.from(body); + switch (actionType) { + case JsonPatchOperationsActionTypes.NEW_JSON_PATCH_ADD_OPERATION: + newBody.push(makeOperationEntry({ + op: JsonPatchOperationType.add, + path: targetPath, + value: value + })); + break; + case JsonPatchOperationsActionTypes.NEW_JSON_PATCH_REPLACE_OPERATION: + newBody.push(makeOperationEntry({ + op: JsonPatchOperationType.replace, + path: targetPath, + value: value + })); + break; + case JsonPatchOperationsActionTypes.NEW_JSON_PATCH_REMOVE_OPERATION: + newBody.push(makeOperationEntry({ op: JsonPatchOperationType.remove, path: targetPath })); + break; + } + return newBody; +} +function makeOperationEntry(operation) { + return { operation: operation, timeAdded: new Date().getTime() }; +} +//# sourceMappingURL=json-patch-operations.reducer.js.map \ No newline at end of file diff --git a/src/app/core/json-patch/json-patch-operations.reducer.js.map b/src/app/core/json-patch/json-patch-operations.reducer.js.map new file mode 100644 index 0000000000..360aba9668 --- /dev/null +++ b/src/app/core/json-patch/json-patch-operations.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-patch-operations.reducer.js","sourceRoot":"","sources":["json-patch-operations.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEvF,OAAO,EAGL,8BAA8B,EAS/B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAA2B,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAqCrF,IAAM,YAAY,GAA6B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAEnE;;;;;;;;;GASG;AACH,MAAM,qCAAqC,KAAoB,EAAE,MAA8B;IAApD,sBAAA,EAAA,oBAAoB;IAC7D,QAAQ,MAAM,CAAC,IAAI,EAAE;QAEnB,KAAK,8BAA8B,CAAC,4BAA4B,CAAC,CAAC;YAChE,OAAO,gBAAgB,CAAC,KAAK,EAAE,MAAqC,CAAC,CAAC;SACvE;QAED,KAAK,8BAA8B,CAAC,2BAA2B,CAAC,CAAC;YAC/D,OAAO,cAAc,CAAC,KAAK,EAAE,MAAoC,CAAC,CAAC;SACpE;QAED,KAAK,8BAA8B,CAAC,4BAA4B,CAAC,CAAC;YAChE,OAAO,YAAY,CAAC,KAAK,EAAE,MAAoC,CAAC,CAAC;SAClE;QAED,KAAK,8BAA8B,CAAC,6BAA6B,CAAC,CAAC;YACjE,OAAO,YAAY,CAAC,KAAK,EAAE,MAAqC,CAAC,CAAC;SACnE;QAED,KAAK,8BAA8B,CAAC,6BAA6B,CAAC,CAAC;Y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,QAAQ,EAAE,aAAW;gBACrB,oBAAoB,EAAE,IAAI;aAC3B,CAAC;gBACF,CAAC;KACJ;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAED,4BAA4B,IAAgC,EAAE,UAAU,EAAE,UAAU,EAAE,KAAM;IAC1F,IAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,QAAQ,UAAU,EAAE;QAClB,KAAK,8BAA8B,CAAC,4BAA4B;YAC9D,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC;gBAC9B,EAAE,EAAE,sBAAsB,CAAC,GAAG;gBAC9B,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,KAAK;aACb,CAAC,CAAC,CAAC;YACJ,MAAM;QACR,KAAK,8BAA8B,CAAC,gCAAgC;YAClE,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC;gBAC9B,EAAE,EAAE,sBAAsB,CAAC,OAAO;gBAClC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,KAAK;aACb,CAAC,CAAC,CAAC;YACJ,MAAM;QACR,KAAK,8BAA8B,CAAC,+BAA+B;YACjE,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,sBAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;YAC1F,MAAM;KACT;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,4BAA4B,SAAS;IACnC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;AACnE,CAAC"} \ No newline at end of file diff --git a/src/app/core/json-patch/json-patch-operations.service.js b/src/app/core/json-patch/json-patch-operations.service.js new file mode 100644 index 0000000000..27711715e8 --- /dev/null +++ b/src/app/core/json-patch/json-patch-operations.service.js @@ -0,0 +1,117 @@ +import { merge as observableMerge, throwError as observableThrowError } from 'rxjs'; +import { distinctUntilChanged, filter, find, flatMap, map, partition, take, tap } from 'rxjs/operators'; +import { hasValue, isEmpty, isNotEmpty, isNotUndefined, isUndefined } from '../../shared/empty.util'; +import { jsonPatchOperationsByResourceType } from './selectors'; +import { CommitPatchOperationsAction, RollbacktPatchOperationsAction, StartTransactionPatchOperationsAction } from './json-patch-operations.actions'; +import { getResponseFromEntry } from '../shared/operators'; +/** + * An abstract class that provides methods to make JSON Patch requests. + */ +var JsonPatchOperationsService = /** @class */ (function () { + function JsonPatchOperationsService() { + } + /** + * Submit a new JSON Patch request with all operations stored in the state that are ready to be dispatched + * + * @param hrefObs + * Observable of request href + * @param resourceType + * The resource type value + * @param resourceId + * The resource id value + * @return Observable + * observable of response + */ + JsonPatchOperationsService.prototype.submitJsonPatchOperations = function (hrefObs, resourceType, resourceId) { + var _this = this; + var requestId = this.requestService.generateRequestId(); + var startTransactionTime = null; + var _a = partition(function (request) { return isNotEmpty(request.body); })(hrefObs.pipe(flatMap(function (endpointURL) { + return _this.store.select(jsonPatchOperationsByResourceType(resourceType)).pipe(take(1), filter(function (operationsList) { return isUndefined(operationsList) || !(operationsList.commitPending); }), tap(function () { return startTransactionTime = new Date().getTime(); }), map(function (operationsList) { + var body = []; + if (isNotEmpty(operationsList)) { + if (isNotEmpty(resourceId)) { + if (isNotUndefined(operationsList.children[resourceId]) && isNotEmpty(operationsList.children[resourceId].body)) { + operationsList.children[resourceId].body.forEach(function (entry) { + body.push(entry.operation); + }); + } + } + else { + Object.keys(operationsList.children) + .filter(function (key) { return operationsList.children.hasOwnProperty(key); }) + .filter(function (key) { return hasValue(operationsList.children[key]); }) + .filter(function (key) { return hasValue(operationsList.children[key].body); }) + .forEach(function (key) { + operationsList.children[key].body.forEach(function (entry) { + body.push(entry.operation); + }); + }); + } + } + return _this.getRequestInstance(requestId, endpointURL, body); + })); + }))), patchRequest$ = _a[0], emptyRequest$ = _a[1]; + return observableMerge(emptyRequest$.pipe(filter(function (request) { return isEmpty(request.body); }), tap(function () { return startTransactionTime = null; }), map(function () { return null; })), patchRequest$.pipe(filter(function (request) { return isNotEmpty(request.body); }), tap(function () { return _this.store.dispatch(new StartTransactionPatchOperationsAction(resourceType, resourceId, startTransactionTime)); }), tap(function (request) { return _this.requestService.configure(request); }), flatMap(function () { + var _a = partition(function (response) { return response.isSuccessful; })(_this.requestService.getByUUID(requestId).pipe(getResponseFromEntry(), find(function (entry) { return startTransactionTime < entry.timeAdded; }), map(function (entry) { return entry; }))), successResponse$ = _a[0], errorResponse$ = _a[1]; + return observableMerge(errorResponse$.pipe(tap(function () { return _this.store.dispatch(new RollbacktPatchOperationsAction(resourceType, resourceId)); }), flatMap(function (error) { return observableThrowError(error); })), successResponse$.pipe(filter(function (response) { return isNotEmpty(response); }), tap(function () { return _this.store.dispatch(new CommitPatchOperationsAction(resourceType, resourceId)); }), map(function (response) { return response.dataDefinition; }), distinctUntilChanged())); + }))); + }; + /** + * Return an instance for RestRequest class + * + * @param uuid + * The request uuid + * @param href + * The request href + * @param body + * The request body + * @return Object + * instance of PatchRequestDefinition + */ + JsonPatchOperationsService.prototype.getRequestInstance = function (uuid, href, body) { + return new this.patchRequestConstructor(uuid, href, body); + }; + JsonPatchOperationsService.prototype.getEndpointByIDHref = function (endpoint, resourceID) { + return isNotEmpty(resourceID) ? endpoint + "/" + resourceID : "" + endpoint; + }; + /** + * Make a new JSON Patch request with all operations related to the specified resource type + * + * @param linkPath + * The link path of the request + * @param scopeId + * The scope id + * @param resourceType + * The resource type value + * @return Observable + * observable of response + */ + JsonPatchOperationsService.prototype.jsonPatchByResourceType = function (linkPath, scopeId, resourceType) { + var _this = this; + var href$ = this.halService.getEndpoint(linkPath).pipe(filter(function (href) { return isNotEmpty(href); }), distinctUntilChanged(), map(function (endpointURL) { return _this.getEndpointByIDHref(endpointURL, scopeId); })); + return this.submitJsonPatchOperations(href$, resourceType); + }; + /** + * Make a new JSON Patch request with all operations related to the specified resource id + * + * @param linkPath + * The link path of the request + * @param scopeId + * The scope id + * @param resourceType + * The resource type value + * @param resourceId + * The resource id value + * @return Observable + * observable of response + */ + JsonPatchOperationsService.prototype.jsonPatchByResourceID = function (linkPath, scopeId, resourceType, resourceId) { + var _this = this; + var hrefObs = this.halService.getEndpoint(linkPath).pipe(filter(function (href) { return isNotEmpty(href); }), distinctUntilChanged(), map(function (endpointURL) { return _this.getEndpointByIDHref(endpointURL, scopeId); })); + return this.submitJsonPatchOperations(hrefObs, resourceType, resourceId); + }; + return JsonPatchOperationsService; +}()); +export { JsonPatchOperationsService }; +//# sourceMappingURL=json-patch-operations.service.js.map \ No newline at end of file diff --git a/src/app/core/json-patch/json-patch-operations.service.js.map b/src/app/core/json-patch/json-patch-operations.service.js.map new file mode 100644 index 0000000000..2a5df7005c --- /dev/null +++ b/src/app/core/json-patch/json-patch-operations.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-patch-operations.service.js","sourceRoot":"","sources":["json-patch-operations.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,eAAe,EAAc,UAAU,IAAI,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGxG,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAMrG,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,qCAAqC,EACtC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D;;GAEG;AACH;IAAA;IAiJA,CAAC;IAzIC;;;;;;;;;;;OAWG;IACO,8DAAyB,GAAnC,UAAoC,OAA2B,EAAE,YAAoB,EAAE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EAAE,YAAY,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;;;;;OAaG;IACI,0DAAqB,GAA5B,UAA6B,QAAgB,EAAE,OAAe,EAAE,YAAoB,EAAE,UAAkB;QAAxG,iBAOC;QANC,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,IAAI,CACxD,MAAM,CAAC,UAAC,IAAY,IAAK,OAAA,UAAU,CAAC,IAAI,CAAC,EAAhB,CAAgB,CAAC,EAC1C,oBAAoB,EAAE,EACtB,GAAG,CAAC,UAAC,WAAmB,IAAK,OAAA,KAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,EAA9C,CAA8C,CAAC,CAAC,CAAC;QAEhF,OAAO,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC;IACH,iCAAC;AAAD,CAAC,AAjJD,IAiJC"} \ No newline at end of file diff --git a/src/app/core/json-patch/json-patch.model.js b/src/app/core/json-patch/json-patch.model.js new file mode 100644 index 0000000000..54a700e167 --- /dev/null +++ b/src/app/core/json-patch/json-patch.model.js @@ -0,0 +1,22 @@ +/** + * Represents all JSON Patch operations type. + */ +export var JsonPatchOperationType; +(function (JsonPatchOperationType) { + JsonPatchOperationType["test"] = "test"; + JsonPatchOperationType["remove"] = "remove"; + JsonPatchOperationType["add"] = "add"; + JsonPatchOperationType["replace"] = "replace"; + JsonPatchOperationType["move"] = "move"; + JsonPatchOperationType["copy"] = "copy"; +})(JsonPatchOperationType || (JsonPatchOperationType = {})); +/** + * Represents a JSON Patch operations. + */ +var JsonPatchOperationModel = /** @class */ (function () { + function JsonPatchOperationModel() { + } + return JsonPatchOperationModel; +}()); +export { JsonPatchOperationModel }; +//# sourceMappingURL=json-patch.model.js.map \ No newline at end of file diff --git a/src/app/core/json-patch/json-patch.model.js.map b/src/app/core/json-patch/json-patch.model.js.map new file mode 100644 index 0000000000..4f15735e67 --- /dev/null +++ b/src/app/core/json-patch/json-patch.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-patch.model.js","sourceRoot":"","sources":["json-patch.model.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,2CAAiB,CAAA;IACjB,qCAAW,CAAA;IACX,6CAAmB,CAAA;IACnB,uCAAa,CAAA;IACb,uCAAa,CAAA;AACf,CAAC,EAPW,sBAAsB,KAAtB,sBAAsB,QAOjC;AAED;;GAEG;AACH;IAAA;IAIA,CAAC;IAAD,8BAAC;AAAD,CAAC,AAJD,IAIC"} \ No newline at end of file diff --git a/src/app/core/json-patch/selectors.js b/src/app/core/json-patch/selectors.js new file mode 100644 index 0000000000..b25e647a08 --- /dev/null +++ b/src/app/core/json-patch/selectors.js @@ -0,0 +1,28 @@ +import { coreSelector } from '../core.selectors'; +import { keySelector, subStateSelector } from '../../submission/selectors'; +/** + * Return MemoizedSelector to select all jsonPatchOperations for a specified resource type, stored in the state + * + * @param resourceType + * the resource type + * @return MemoizedSelector + * MemoizedSelector + */ +export function jsonPatchOperationsByResourceType(resourceType) { + return keySelector(coreSelector, 'json/patch', resourceType); +} +/** + * Return MemoizedSelector to select all jsonPatchOperations for a specified resource id, stored in the state + * + * @param resourceType + * the resource type + * @param resourceId + * the resourceId type + * @return MemoizedSelector + * MemoizedSelector + */ +export function jsonPatchOperationsByResourceId(resourceType, resourceId) { + var resourceTypeSelector = jsonPatchOperationsByResourceType(resourceType); + return subStateSelector(resourceTypeSelector, resourceId); +} +//# sourceMappingURL=selectors.js.map \ No newline at end of file diff --git a/src/app/core/json-patch/selectors.js.map b/src/app/core/json-patch/selectors.js.map new file mode 100644 index 0000000000..cf86522c49 --- /dev/null +++ b/src/app/core/json-patch/selectors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"selectors.js","sourceRoot":"","sources":["selectors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE3E;;;;;;;GAOG;AACH,MAAM,4CAA4C,YAAoB;IACpE,OAAO,WAAW,CAA8C,YAAY,EAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAC3G,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,0CAA0C,YAAoB,EAAE,UAAkB;IACtF,IAAM,oBAAoB,GAAI,iCAAiC,CAAC,YAAY,CAAC,CAAC;IAC9E,OAAO,gBAAgB,CAAsC,oBAAoB,EAAE,UAAU,CAAC,CAAC;AACjG,CAAC"} \ No newline at end of file diff --git a/src/app/core/metadata/metadata.service.js b/src/app/core/metadata/metadata.service.js new file mode 100644 index 0000000000..2f5a3af133 --- /dev/null +++ b/src/app/core/metadata/metadata.service.js @@ -0,0 +1,317 @@ +import * as tslib_1 from "tslib"; +import { catchError, distinctUntilKeyChanged, filter, first, map, take } from 'rxjs/operators'; +import { Inject, Injectable } from '@angular/core'; +import { NavigationEnd, Router } from '@angular/router'; +import { Meta, Title } from '@angular/platform-browser'; +import { TranslateService } from '@ngx-translate/core'; +import { BehaviorSubject } from 'rxjs'; +import { Item } from '../shared/item.model'; +import { GLOBAL_CONFIG } from '../../../config'; +import { hasValue, isNotEmpty } from '../../shared/empty.util'; +var MetadataService = /** @class */ (function () { + function MetadataService(router, translate, meta, title, envConfig) { + this.router = router; + this.translate = translate; + this.meta = meta; + this.title = title; + this.envConfig = envConfig; + // TODO: determine what open graph meta tags are needed and whether + // the differ per route. potentially add image based on DSpaceObject + this.meta.addTags([ + { property: 'og:title', content: 'DSpace Angular Universal' }, + { property: 'og:description', content: 'The modern front-end for DSpace 7.' } + ]); + this.initialized = false; + this.tagStore = new Map(); + } + MetadataService.prototype.listenForRouteChange = function () { + var _this = this; + this.router.events.pipe(filter(function (event) { return event instanceof NavigationEnd; }), map(function () { return _this.router.routerState.root; }), map(function (route) { + route = _this.getCurrentRoute(route); + return { params: route.params, data: route.data }; + })).subscribe(function (routeInfo) { + _this.processRouteChange(routeInfo); + }); + }; + MetadataService.prototype.processRemoteData = function (remoteData) { + var _this = this; + remoteData.pipe(map(function (rd) { return rd.payload; }), filter(function (co) { return hasValue(co); }), take(1)) + .subscribe(function (dspaceObject) { + if (!_this.initialized) { + _this.initialize(dspaceObject); + } + _this.currentObject.next(dspaceObject); + }); + }; + MetadataService.prototype.processRouteChange = function (routeInfo) { + var _this = this; + if (routeInfo.params.value.id === undefined) { + this.clearMetaTags(); + } + if (routeInfo.data.value.title) { + this.translate.get(routeInfo.data.value.title, routeInfo.data.value).pipe(take(1)).subscribe(function (translatedTitle) { + _this.addMetaTag('title', translatedTitle); + _this.title.setTitle(translatedTitle); + }); + } + if (routeInfo.data.value.description) { + this.translate.get(routeInfo.data.value.description).pipe(take(1)).subscribe(function (translatedDescription) { + _this.addMetaTag('description', translatedDescription); + }); + } + }; + MetadataService.prototype.initialize = function (dspaceObject) { + var _this = this; + this.currentObject = new BehaviorSubject(dspaceObject); + this.currentObject.asObservable().pipe(distinctUntilKeyChanged('uuid')).subscribe(function () { + _this.setMetaTags(); + }); + this.initialized = true; + }; + MetadataService.prototype.getCurrentRoute = function (route) { + while (route.firstChild) { + route = route.firstChild; + } + return route; + }; + MetadataService.prototype.setMetaTags = function () { + this.clearMetaTags(); + this.setTitleTag(); + this.setDescriptionTag(); + this.setCitationTitleTag(); + this.setCitationAuthorTags(); + this.setCitationDateTag(); + this.setCitationISSNTag(); + this.setCitationISBNTag(); + this.setCitationLanguageTag(); + this.setCitationKeywordsTag(); + this.setCitationAbstractUrlTag(); + this.setCitationPdfUrlTag(); + if (this.isDissertation()) { + this.setCitationDissertationNameTag(); + this.setCitationDissertationInstitutionTag(); + } + if (this.isTechReport()) { + this.setCitationTechReportInstitutionTag(); + } + // this.setCitationJournalTitleTag(); + // this.setCitationVolumeTag(); + // this.setCitationIssueTag(); + // this.setCitationFirstPageTag(); + // this.setCitationLastPageTag(); + // this.setCitationDOITag(); + // this.setCitationPMIDTag(); + // this.setCitationFullTextTag(); + // this.setCitationConferenceTag(); + // this.setCitationPatentCountryTag(); + // this.setCitationPatentNumberTag(); + }; + /** + * Add to the + */ + MetadataService.prototype.setTitleTag = function () { + var value = this.getMetaTagValue('dc.title'); + this.addMetaTag('title', value); + this.title.setTitle(value); + }; + /** + * Add to the + */ + MetadataService.prototype.setDescriptionTag = function () { + // TODO: truncate abstract + var value = this.getMetaTagValue('dc.description.abstract'); + this.addMetaTag('desciption', value); + }; + /** + * Add to the + */ + MetadataService.prototype.setCitationTitleTag = function () { + var value = this.getMetaTagValue('dc.title'); + this.addMetaTag('citation_title', value); + }; + /** + * Add to the + */ + MetadataService.prototype.setCitationAuthorTags = function () { + var values = this.getMetaTagValues(['dc.author', 'dc.contributor.author', 'dc.creator']); + this.addMetaTags('citation_author', values); + }; + /** + * Add to the + */ + MetadataService.prototype.setCitationDateTag = function () { + var value = this.getFirstMetaTagValue(['dc.date.copyright', 'dc.date.issued', 'dc.date.available', 'dc.date.accessioned']); + this.addMetaTag('citation_date', value); + }; + /** + * Add to the + */ + MetadataService.prototype.setCitationISSNTag = function () { + var value = this.getMetaTagValue('dc.identifier.issn'); + this.addMetaTag('citation_issn', value); + }; + /** + * Add to the + */ + MetadataService.prototype.setCitationISBNTag = function () { + var value = this.getMetaTagValue('dc.identifier.isbn'); + this.addMetaTag('citation_isbn', value); + }; + /** + * Add to the + */ + MetadataService.prototype.setCitationLanguageTag = function () { + var value = this.getFirstMetaTagValue(['dc.language', 'dc.language.iso']); + this.addMetaTag('citation_language', value); + }; + /** + * Add to the + */ + MetadataService.prototype.setCitationDissertationNameTag = function () { + var value = this.getMetaTagValue('dc.title'); + this.addMetaTag('citation_dissertation_name', value); + }; + /** + * Add to the + */ + MetadataService.prototype.setCitationDissertationInstitutionTag = function () { + var value = this.getMetaTagValue('dc.publisher'); + this.addMetaTag('citation_dissertation_institution', value); + }; + /** + * Add to the + */ + MetadataService.prototype.setCitationTechReportInstitutionTag = function () { + var value = this.getMetaTagValue('dc.publisher'); + this.addMetaTag('citation_technical_report_institution', value); + }; + /** + * Add to the + */ + MetadataService.prototype.setCitationKeywordsTag = function () { + var value = this.getMetaTagValuesAndCombine('dc.subject'); + this.addMetaTag('citation_keywords', value); + }; + /** + * Add to the + */ + MetadataService.prototype.setCitationAbstractUrlTag = function () { + if (this.currentObject.value instanceof Item) { + var value = [this.envConfig.ui.baseUrl, this.router.url].join(''); + this.addMetaTag('citation_abstract_html_url', value); + } + }; + /** + * Add to the + */ + MetadataService.prototype.setCitationPdfUrlTag = function () { + var _this = this; + if (this.currentObject.value instanceof Item) { + var item = this.currentObject.value; + item.getFiles() + .pipe(first(function (files) { return isNotEmpty(files); }), catchError(function (error) { + console.debug(error.message); + return []; + })) + .subscribe(function (bitstreams) { + var _loop_1 = function (bitstream) { + bitstream.format.pipe(first(), catchError(function (error) { + console.debug(error.message); + return []; + }), map(function (rd) { return rd.payload; }), filter(function (format) { return hasValue(format); })) + .subscribe(function (format) { + if (format.mimetype === 'application/pdf') { + _this.addMetaTag('citation_pdf_url', bitstream.content); + } + }); + }; + for (var _i = 0, bitstreams_1 = bitstreams; _i < bitstreams_1.length; _i++) { + var bitstream = bitstreams_1[_i]; + _loop_1(bitstream); + } + }); + } + }; + MetadataService.prototype.hasType = function (value) { + return this.currentObject.value.hasMetadata('dc.type', { value: value, ignoreCase: true }); + }; + /** + * Returns true if this._item is a dissertation + * + * @returns {boolean} + * true if this._item has a dc.type equal to 'Thesis' + */ + MetadataService.prototype.isDissertation = function () { + return this.hasType('thesis'); + }; + /** + * Returns true if this._item is a technical report + * + * @returns {boolean} + * true if this._item has a dc.type equal to 'Technical Report' + */ + MetadataService.prototype.isTechReport = function () { + return this.hasType('technical report'); + }; + MetadataService.prototype.getMetaTagValue = function (key) { + return this.currentObject.value.firstMetadataValue(key); + }; + MetadataService.prototype.getFirstMetaTagValue = function (keys) { + return this.currentObject.value.firstMetadataValue(keys); + }; + MetadataService.prototype.getMetaTagValuesAndCombine = function (key) { + return this.getMetaTagValues([key]).join('; '); + }; + MetadataService.prototype.getMetaTagValues = function (keys) { + return this.currentObject.value.allMetadataValues(keys); + }; + MetadataService.prototype.addMetaTag = function (property, content) { + if (content) { + var tag = { property: property, content: content }; + this.meta.addTag(tag); + this.storeTag(property, tag); + } + }; + MetadataService.prototype.addMetaTags = function (property, content) { + for (var _i = 0, content_1 = content; _i < content_1.length; _i++) { + var value = content_1[_i]; + this.addMetaTag(property, value); + } + }; + MetadataService.prototype.storeTag = function (key, tag) { + var tags = this.getTags(key); + tags.push(tag); + this.setTags(key, tags); + }; + MetadataService.prototype.getTags = function (key) { + var tags = this.tagStore.get(key); + if (tags === undefined) { + tags = []; + } + return tags; + }; + MetadataService.prototype.setTags = function (key, tags) { + this.tagStore.set(key, tags); + }; + MetadataService.prototype.clearMetaTags = function () { + var _this = this; + this.tagStore.forEach(function (tags, property) { + _this.meta.removeTag("property='" + property + "'"); + }); + this.tagStore.clear(); + }; + MetadataService.prototype.getTagStore = function () { + return this.tagStore; + }; + MetadataService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(4, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Router, + TranslateService, + Meta, + Title, Object]) + ], MetadataService); + return MetadataService; +}()); +export { MetadataService }; +//# sourceMappingURL=metadata.service.js.map \ No newline at end of file diff --git a/src/app/core/metadata/metadata.service.js.map b/src/app/core/metadata/metadata.service.js.map new file mode 100644 index 0000000000..3e55504743 --- /dev/null +++ b/src/app/core/metadata/metadata.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.service.js","sourceRoot":"","sources":["metadata.service.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,uBAAuB,EACvB,MAAM,EAEN,KAAK,EACL,GAAG,EACH,IAAI,EACL,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE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UAAgB,GAAW;QACzB,IAAI,IAAI,GAAqB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpD,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,IAAI,GAAG,EAAE,CAAC;SACX;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,iCAAO,GAAf,UAAgB,GAAW,EAAE,IAAsB;QACjD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAEM,uCAAa,GAApB;QAAA,iBAKC;QAJC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAC,IAAsB,EAAE,QAAgB;YAC7D,KAAI,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,GAAG,QAAQ,GAAG,GAAG,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAEM,qCAAW,GAAlB;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IA5VU,eAAe;QAD3B,UAAU,EAAE;QAcR,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;iDAJN,MAAM;YACH,gBAAgB;YACrB,IAAI;YACH,KAAK;OAZX,eAAe,CA8V3B;IAAD,sBAAC;CAAA,AA9VD,IA8VC;SA9VY,eAAe"} \ No newline at end of file diff --git a/src/app/core/metadata/metadatafield.model.js b/src/app/core/metadata/metadatafield.model.js new file mode 100644 index 0000000000..4dd4ed83bf --- /dev/null +++ b/src/app/core/metadata/metadatafield.model.js @@ -0,0 +1,43 @@ +import * as tslib_1 from "tslib"; +import { MetadataSchema } from './metadataschema.model'; +import { autoserialize } from 'cerialize'; +import { isNotEmpty } from '../../shared/empty.util'; +var MetadataField = /** @class */ (function () { + function MetadataField() { + } + MetadataField.prototype.toString = function (separator) { + if (separator === void 0) { separator = '.'; } + var key = this.schema.prefix + separator + this.element; + if (isNotEmpty(this.qualifier)) { + key += separator + this.qualifier; + } + return key; + }; + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], MetadataField.prototype, "id", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], MetadataField.prototype, "self", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], MetadataField.prototype, "element", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], MetadataField.prototype, "qualifier", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], MetadataField.prototype, "scopeNote", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", MetadataSchema) + ], MetadataField.prototype, "schema", void 0); + return MetadataField; +}()); +export { MetadataField }; +//# sourceMappingURL=metadatafield.model.js.map \ No newline at end of file diff --git a/src/app/core/metadata/metadatafield.model.js.map b/src/app/core/metadata/metadatafield.model.js.map new file mode 100644 index 0000000000..0dfd3be4d2 --- /dev/null +++ b/src/app/core/metadata/metadatafield.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadatafield.model.js","sourceRoot":"","sources":["metadatafield.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD;IAAA;IA0BA,CAAC;IAPC,gCAAQ,GAAR,UAAS,SAAuB;QAAvB,0BAAA,EAAA,eAAuB;QAC9B,IAAI,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC;QACxD,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;YAC9B,GAAG,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;SACnC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAvBD;QADC,aAAa;;6CACH;IAGX;QADC,aAAa;;+CACD;IAGb;QADC,aAAa;;kDACE;IAGhB;QADC,aAAa;;oDACI;IAGlB;QADC,aAAa;;oDACI;IAGlB;QADC,aAAa;0CACN,cAAc;iDAAC;IASzB,oBAAC;CAAA,AA1BD,IA0BC;SA1BY,aAAa"} \ No newline at end of file diff --git a/src/app/core/metadata/metadataschema.model.js b/src/app/core/metadata/metadataschema.model.js new file mode 100644 index 0000000000..4c99d47821 --- /dev/null +++ b/src/app/core/metadata/metadataschema.model.js @@ -0,0 +1,25 @@ +import * as tslib_1 from "tslib"; +import { autoserialize } from 'cerialize'; +var MetadataSchema = /** @class */ (function () { + function MetadataSchema() { + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], MetadataSchema.prototype, "id", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], MetadataSchema.prototype, "self", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], MetadataSchema.prototype, "prefix", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], MetadataSchema.prototype, "namespace", void 0); + return MetadataSchema; +}()); +export { MetadataSchema }; +//# sourceMappingURL=metadataschema.model.js.map \ No newline at end of file diff --git a/src/app/core/metadata/metadataschema.model.js.map b/src/app/core/metadata/metadataschema.model.js.map new file mode 100644 index 0000000000..471749b028 --- /dev/null +++ b/src/app/core/metadata/metadataschema.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadataschema.model.js","sourceRoot":"","sources":["metadataschema.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C;IAAA;IAYA,CAAC;IAVC;QADC,aAAa;;8CACH;IAGX;QADC,aAAa;;gDACD;IAGb;QADC,aAAa;;kDACC;IAGf;QADC,aAAa;;qDACI;IACpB,qBAAC;CAAA,AAZD,IAYC;SAZY,cAAc"} \ No newline at end of file diff --git a/src/app/core/metadata/normalized-metadata-schema.model.js b/src/app/core/metadata/normalized-metadata-schema.model.js new file mode 100644 index 0000000000..81f6a7bf89 --- /dev/null +++ b/src/app/core/metadata/normalized-metadata-schema.model.js @@ -0,0 +1,36 @@ +import * as tslib_1 from "tslib"; +import { autoserialize } from 'cerialize'; +import { NormalizedObject } from '../cache/models/normalized-object.model'; +import { mapsTo } from '../cache/builders/build-decorators'; +import { MetadataSchema } from './metadataschema.model'; +/** + * Normalized class for a DSpace MetadataSchema + */ +var NormalizedMetadataSchema = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedMetadataSchema, _super); + function NormalizedMetadataSchema() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], NormalizedMetadataSchema.prototype, "id", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedMetadataSchema.prototype, "self", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedMetadataSchema.prototype, "prefix", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedMetadataSchema.prototype, "namespace", void 0); + NormalizedMetadataSchema = tslib_1.__decorate([ + mapsTo(MetadataSchema) + ], NormalizedMetadataSchema); + return NormalizedMetadataSchema; +}(NormalizedObject)); +export { NormalizedMetadataSchema }; +//# sourceMappingURL=normalized-metadata-schema.model.js.map \ No newline at end of file diff --git a/src/app/core/metadata/normalized-metadata-schema.model.js.map b/src/app/core/metadata/normalized-metadata-schema.model.js.map new file mode 100644 index 0000000000..3bdc210fe4 --- /dev/null +++ b/src/app/core/metadata/normalized-metadata-schema.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-metadata-schema.model.js","sourceRoot":"","sources":["normalized-metadata-schema.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD;;GAEG;AAEH;IAA8C,oDAAgC;IAA9E;;IAwBA,CAAC;IAnBC;QADC,aAAa;;wDACH;IAMX;QADC,aAAa;;0DACD;IAMb;QADC,aAAa;;4DACC;IAMf;QADC,aAAa;;+DACI;IAvBP,wBAAwB;QADpC,MAAM,CAAC,cAAc,CAAC;OACV,wBAAwB,CAwBpC;IAAD,+BAAC;CAAA,AAxBD,CAA8C,gBAAgB,GAwB7D;SAxBY,wBAAwB"} \ No newline at end of file diff --git a/src/app/core/registry/mock-bitstream-format.model.js b/src/app/core/registry/mock-bitstream-format.model.js new file mode 100644 index 0000000000..2b95f79f22 --- /dev/null +++ b/src/app/core/registry/mock-bitstream-format.model.js @@ -0,0 +1,7 @@ +var BitstreamFormat = /** @class */ (function () { + function BitstreamFormat() { + } + return BitstreamFormat; +}()); +export { BitstreamFormat }; +//# sourceMappingURL=mock-bitstream-format.model.js.map \ No newline at end of file diff --git a/src/app/core/registry/mock-bitstream-format.model.js.map b/src/app/core/registry/mock-bitstream-format.model.js.map new file mode 100644 index 0000000000..660273c9b0 --- /dev/null +++ b/src/app/core/registry/mock-bitstream-format.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-bitstream-format.model.js","sourceRoot":"","sources":["mock-bitstream-format.model.ts"],"names":[],"mappings":"AAAA;IAAA;IAOA,CAAC;IAAD,sBAAC;AAAD,CAAC,AAPD,IAOC"} \ No newline at end of file diff --git a/src/app/core/registry/registry-bitstreamformats-response.model.js b/src/app/core/registry/registry-bitstreamformats-response.model.js new file mode 100644 index 0000000000..cf8c1942c0 --- /dev/null +++ b/src/app/core/registry/registry-bitstreamformats-response.model.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs } from 'cerialize'; +import { PageInfo } from '../shared/page-info.model'; +import { BitstreamFormat } from '../shared/bitstream-format.model'; +var RegistryBitstreamformatsResponse = /** @class */ (function () { + function RegistryBitstreamformatsResponse() { + } + tslib_1.__decorate([ + autoserializeAs(BitstreamFormat), + tslib_1.__metadata("design:type", Array) + ], RegistryBitstreamformatsResponse.prototype, "bitstreamformats", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", PageInfo) + ], RegistryBitstreamformatsResponse.prototype, "page", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], RegistryBitstreamformatsResponse.prototype, "self", void 0); + return RegistryBitstreamformatsResponse; +}()); +export { RegistryBitstreamformatsResponse }; +//# sourceMappingURL=registry-bitstreamformats-response.model.js.map \ No newline at end of file diff --git a/src/app/core/registry/registry-bitstreamformats-response.model.js.map b/src/app/core/registry/registry-bitstreamformats-response.model.js.map new file mode 100644 index 0000000000..97b0fa35e0 --- /dev/null +++ b/src/app/core/registry/registry-bitstreamformats-response.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"registry-bitstreamformats-response.model.js","sourceRoot":"","sources":["registry-bitstreamformats-response.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE;IAAA;IASA,CAAC;IAPC;QADC,eAAe,CAAC,eAAe,CAAC;;8EACG;IAGpC;QADC,aAAa;0CACR,QAAQ;kEAAC;IAGf;QADC,aAAa;;kEACD;IACf,uCAAC;CAAA,AATD,IASC;SATY,gCAAgC"} \ No newline at end of file diff --git a/src/app/core/registry/registry-metadatafields-response.model.js b/src/app/core/registry/registry-metadatafields-response.model.js new file mode 100644 index 0000000000..db76e693f6 --- /dev/null +++ b/src/app/core/registry/registry-metadatafields-response.model.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { PageInfo } from '../shared/page-info.model'; +import { autoserialize, autoserializeAs } from 'cerialize'; +import { MetadataField } from '../metadata/metadatafield.model'; +var RegistryMetadatafieldsResponse = /** @class */ (function () { + function RegistryMetadatafieldsResponse() { + } + tslib_1.__decorate([ + autoserializeAs(MetadataField), + tslib_1.__metadata("design:type", Array) + ], RegistryMetadatafieldsResponse.prototype, "metadatafields", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", PageInfo) + ], RegistryMetadatafieldsResponse.prototype, "page", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], RegistryMetadatafieldsResponse.prototype, "self", void 0); + return RegistryMetadatafieldsResponse; +}()); +export { RegistryMetadatafieldsResponse }; +//# sourceMappingURL=registry-metadatafields-response.model.js.map \ No newline at end of file diff --git a/src/app/core/registry/registry-metadatafields-response.model.js.map b/src/app/core/registry/registry-metadatafields-response.model.js.map new file mode 100644 index 0000000000..144b47cce1 --- /dev/null +++ b/src/app/core/registry/registry-metadatafields-response.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"registry-metadatafields-response.model.js","sourceRoot":"","sources":["registry-metadatafields-response.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE;IAAA;IASA,CAAC;IAPC;QADC,eAAe,CAAC,aAAa,CAAC;;0EACC;IAGhC;QADC,aAAa;0CACR,QAAQ;gEAAC;IAGf;QADC,aAAa;;gEACD;IACf,qCAAC;CAAA,AATD,IASC;SATY,8BAA8B"} \ No newline at end of file diff --git a/src/app/core/registry/registry-metadataschemas-response.model.js b/src/app/core/registry/registry-metadataschemas-response.model.js new file mode 100644 index 0000000000..c5d74cec98 --- /dev/null +++ b/src/app/core/registry/registry-metadataschemas-response.model.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { MetadataSchema } from '../metadata/metadataschema.model'; +import { PageInfo } from '../shared/page-info.model'; +import { autoserialize, autoserializeAs } from 'cerialize'; +var RegistryMetadataschemasResponse = /** @class */ (function () { + function RegistryMetadataschemasResponse() { + } + tslib_1.__decorate([ + autoserializeAs(MetadataSchema), + tslib_1.__metadata("design:type", Array) + ], RegistryMetadataschemasResponse.prototype, "metadataschemas", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", PageInfo) + ], RegistryMetadataschemasResponse.prototype, "page", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], RegistryMetadataschemasResponse.prototype, "self", void 0); + return RegistryMetadataschemasResponse; +}()); +export { RegistryMetadataschemasResponse }; +//# sourceMappingURL=registry-metadataschemas-response.model.js.map \ No newline at end of file diff --git a/src/app/core/registry/registry-metadataschemas-response.model.js.map b/src/app/core/registry/registry-metadataschemas-response.model.js.map new file mode 100644 index 0000000000..d953130dfe --- /dev/null +++ b/src/app/core/registry/registry-metadataschemas-response.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"registry-metadataschemas-response.model.js","sourceRoot":"","sources":["registry-metadataschemas-response.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE3D;IAAA;IASA,CAAC;IAPC;QADC,eAAe,CAAC,cAAc,CAAC;;4EACE;IAGlC;QADC,aAAa;0CACR,QAAQ;iEAAC;IAGf;QADC,aAAa;;iEACD;IACf,sCAAC;CAAA,AATD,IASC;SATY,+BAA+B"} \ No newline at end of file diff --git a/src/app/core/registry/registry.service.js b/src/app/core/registry/registry.service.js new file mode 100644 index 0000000000..b4df79c0d9 --- /dev/null +++ b/src/app/core/registry/registry.service.js @@ -0,0 +1,386 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest } from 'rxjs'; +import { Injectable } from '@angular/core'; +import { PaginatedList } from '../data/paginated-list'; +import { PageInfo } from '../shared/page-info.model'; +import { MetadataField } from '../metadata/metadatafield.model'; +import { CreateMetadataFieldRequest, CreateMetadataSchemaRequest, DeleteRequest, GetRequest, UpdateMetadataFieldRequest, UpdateMetadataSchemaRequest } from '../data/request.models'; +import { RegistryMetadataschemasResponseParsingService } from '../data/registry-metadataschemas-response-parsing.service'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { RequestService } from '../data/request.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { RegistryMetadatafieldsResponseParsingService } from '../data/registry-metadatafields-response-parsing.service'; +import { hasValue, hasNoValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util'; +import { URLCombiner } from '../url-combiner/url-combiner'; +import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model'; +import { RegistryBitstreamformatsResponseParsingService } from '../data/registry-bitstreamformats-response-parsing.service'; +import { configureRequest, getResponseFromEntry } from '../shared/operators'; +import { createSelector, select, Store } from '@ngrx/store'; +import { MetadataRegistryCancelFieldAction, MetadataRegistryCancelSchemaAction, MetadataRegistryDeselectAllFieldAction, MetadataRegistryDeselectAllSchemaAction, MetadataRegistryDeselectFieldAction, MetadataRegistryDeselectSchemaAction, MetadataRegistryEditFieldAction, MetadataRegistryEditSchemaAction, MetadataRegistrySelectFieldAction, MetadataRegistrySelectSchemaAction } from '../../+admin/admin-registries/metadata-registry/metadata-registry.actions'; +import { distinctUntilChanged, flatMap, map, take, tap } from 'rxjs/operators'; +import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer'; +import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory'; +import { ResourceType } from '../shared/resource-type'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { NotificationOptions } from '../../shared/notifications/models/notification-options.model'; +import { HttpHeaders } from '@angular/common/http'; +import { TranslateService } from '@ngx-translate/core'; +var metadataRegistryStateSelector = function (state) { return state.metadataRegistry; }; +var editMetadataSchemaSelector = createSelector(metadataRegistryStateSelector, function (metadataState) { return metadataState.editSchema; }); +var selectedMetadataSchemasSelector = createSelector(metadataRegistryStateSelector, function (metadataState) { return metadataState.selectedSchemas; }); +var editMetadataFieldSelector = createSelector(metadataRegistryStateSelector, function (metadataState) { return metadataState.editField; }); +var selectedMetadataFieldsSelector = createSelector(metadataRegistryStateSelector, function (metadataState) { return metadataState.selectedFields; }); +var RegistryService = /** @class */ (function () { + function RegistryService(requestService, rdb, halService, store, notificationsService, translateService) { + this.requestService = requestService; + this.rdb = rdb; + this.halService = halService; + this.store = store; + this.notificationsService = notificationsService; + this.translateService = translateService; + this.metadataSchemasPath = 'metadataschemas'; + this.metadataFieldsPath = 'metadatafields'; + this.bitstreamFormatsPath = 'bitstreamformats'; + } + RegistryService.prototype.getMetadataSchemas = function (pagination) { + var _this = this; + var requestObs = this.getMetadataSchemasRequestObs(pagination); + var requestEntryObs = requestObs.pipe(flatMap(function (request) { return _this.requestService.getByHref(request.href); })); + var rmrObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { return response.metadataschemasResponse; })); + var metadataschemasObs = rmrObs.pipe(map(function (rmr) { return rmr.metadataschemas; })); + var pageInfoObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { return response.pageInfo; })); + var payloadObs = observableCombineLatest(metadataschemasObs, pageInfoObs).pipe(map(function (_a) { + var metadataschemas = _a[0], pageInfo = _a[1]; + return new PaginatedList(pageInfo, metadataschemas); + })); + return this.rdb.toRemoteDataObservable(requestEntryObs, payloadObs); + }; + RegistryService.prototype.getMetadataSchemaByName = function (schemaName) { + var _this = this; + // Temporary pagination to get ALL metadataschemas until there's a rest api endpoint for fetching a specific schema + var pagination = Object.assign(new PaginationComponentOptions(), { + id: 'all-metadatafields-pagination', + pageSize: 10000 + }); + var requestObs = this.getMetadataSchemasRequestObs(pagination); + var requestEntryObs = requestObs.pipe(flatMap(function (request) { return _this.requestService.getByHref(request.href); })); + var rmrObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { return response.metadataschemasResponse; })); + var metadataschemaObs = rmrObs.pipe(map(function (rmr) { return rmr.metadataschemas; }), map(function (metadataSchemas) { return metadataSchemas.filter(function (value) { return value.prefix === schemaName; })[0]; })); + return this.rdb.toRemoteDataObservable(requestEntryObs, metadataschemaObs); + }; + RegistryService.prototype.getMetadataFieldsBySchema = function (schema, pagination) { + var _this = this; + var requestObs = this.getMetadataFieldsBySchemaRequestObs(pagination, schema); + var requestEntryObs = requestObs.pipe(flatMap(function (request) { return _this.requestService.getByHref(request.href); })); + var rmrObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { return response.metadatafieldsResponse; })); + var metadatafieldsObs = rmrObs.pipe(map(function (rmr) { return rmr.metadatafields; })); + var pageInfoObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { return response.pageInfo; })); + var payloadObs = observableCombineLatest(metadatafieldsObs, pageInfoObs).pipe(map(function (_a) { + var metadatafields = _a[0], pageInfo = _a[1]; + return new PaginatedList(pageInfo, metadatafields); + })); + return this.rdb.toRemoteDataObservable(requestEntryObs, payloadObs); + }; + /** + * Retrieve all existing metadata fields as a paginated list + * @param pagination Pagination options to determine which page of metadata fields should be requested + * When no pagination is provided, all metadata fields are requested in one large page + * @returns an observable that emits a remote data object with a page of metadata fields + */ + RegistryService.prototype.getAllMetadataFields = function (pagination) { + var _this = this; + if (hasNoValue(pagination)) { + pagination = { currentPage: 1, pageSize: 10000 }; + } + var requestObs = this.getMetadataFieldsRequestObs(pagination); + var requestEntryObs = requestObs.pipe(flatMap(function (request) { return _this.requestService.getByHref(request.href); })); + var rmrObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { return response.metadatafieldsResponse; })); + var metadatafieldsObs = rmrObs.pipe(map(function (rmr) { return rmr.metadatafields; }), + /* Make sure to explicitly cast this into a MetadataField object, on first page loads this object comes from the object cache created by the server and its prototype is unknown */ + map(function (metadataFields) { return metadataFields.map(function (metadataField) { return Object.assign(new MetadataField(), metadataField); }); })); + var pageInfoObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { return response.pageInfo; })); + var payloadObs = observableCombineLatest(metadatafieldsObs, pageInfoObs).pipe(map(function (_a) { + var metadatafields = _a[0], pageInfo = _a[1]; + return new PaginatedList(pageInfo, metadatafields); + })); + return this.rdb.toRemoteDataObservable(requestEntryObs, payloadObs); + }; + RegistryService.prototype.getBitstreamFormats = function (pagination) { + var _this = this; + var requestObs = this.getBitstreamFormatsRequestObs(pagination); + var requestEntryObs = requestObs.pipe(flatMap(function (request) { return _this.requestService.getByHref(request.href); })); + var rbrObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { return response.bitstreamformatsResponse; })); + var bitstreamformatsObs = rbrObs.pipe(map(function (rbr) { return rbr.bitstreamformats; })); + var pageInfoObs = requestEntryObs.pipe(getResponseFromEntry(), map(function (response) { return response.pageInfo; })); + var payloadObs = observableCombineLatest(bitstreamformatsObs, pageInfoObs).pipe(map(function (_a) { + var bitstreamformats = _a[0], pageInfo = _a[1]; + return new PaginatedList(pageInfo, bitstreamformats); + })); + return this.rdb.toRemoteDataObservable(requestEntryObs, payloadObs); + }; + RegistryService.prototype.getMetadataSchemasRequestObs = function (pagination) { + var _this = this; + return this.halService.getEndpoint(this.metadataSchemasPath).pipe(map(function (url) { + var args = []; + args.push("size=" + pagination.pageSize); + args.push("page=" + (pagination.currentPage - 1)); + if (isNotEmpty(args)) { + url = new URLCombiner(url, "?" + args.join('&')).toString(); + } + var request = new GetRequest(_this.requestService.generateRequestId(), url); + return Object.assign(request, { + getResponseParser: function () { + return RegistryMetadataschemasResponseParsingService; + } + }); + }), tap(function (request) { return _this.requestService.configure(request); })); + }; + RegistryService.prototype.getMetadataFieldsBySchemaRequestObs = function (pagination, schema) { + var _this = this; + return this.halService.getEndpoint(this.metadataFieldsPath + '/search/bySchema').pipe( + // return this.halService.getEndpoint(this.metadataFieldsPath).pipe( + map(function (url) { + var args = []; + args.push("schema=" + schema.prefix); + args.push("size=" + pagination.pageSize); + args.push("page=" + (pagination.currentPage - 1)); + if (isNotEmpty(args)) { + url = new URLCombiner(url, "?" + args.join('&')).toString(); + } + var request = new GetRequest(_this.requestService.generateRequestId(), url); + return Object.assign(request, { + getResponseParser: function () { + return RegistryMetadatafieldsResponseParsingService; + } + }); + }), tap(function (request) { return _this.requestService.configure(request); })); + }; + RegistryService.prototype.getMetadataFieldsRequestObs = function (pagination) { + var _this = this; + return this.halService.getEndpoint(this.metadataFieldsPath).pipe(map(function (url) { + var args = []; + args.push("size=" + pagination.pageSize); + args.push("page=" + (pagination.currentPage - 1)); + if (isNotEmpty(args)) { + url = new URLCombiner(url, "?" + args.join('&')).toString(); + } + var request = new GetRequest(_this.requestService.generateRequestId(), url); + return Object.assign(request, { + getResponseParser: function () { + return RegistryMetadatafieldsResponseParsingService; + } + }); + }), tap(function (request) { return _this.requestService.configure(request); })); + }; + RegistryService.prototype.getBitstreamFormatsRequestObs = function (pagination) { + var _this = this; + return this.halService.getEndpoint(this.bitstreamFormatsPath).pipe(map(function (url) { + var args = []; + args.push("size=" + pagination.pageSize); + args.push("page=" + (pagination.currentPage - 1)); + if (isNotEmpty(args)) { + url = new URLCombiner(url, "?" + args.join('&')).toString(); + } + var request = new GetRequest(_this.requestService.generateRequestId(), url); + return Object.assign(request, { + getResponseParser: function () { + return RegistryBitstreamformatsResponseParsingService; + } + }); + }), tap(function (request) { return _this.requestService.configure(request); })); + }; + RegistryService.prototype.editMetadataSchema = function (schema) { + this.store.dispatch(new MetadataRegistryEditSchemaAction(schema)); + }; + RegistryService.prototype.cancelEditMetadataSchema = function () { + this.store.dispatch(new MetadataRegistryCancelSchemaAction()); + }; + RegistryService.prototype.getActiveMetadataSchema = function () { + return this.store.pipe(select(editMetadataSchemaSelector)); + }; + RegistryService.prototype.selectMetadataSchema = function (schema) { + this.store.dispatch(new MetadataRegistrySelectSchemaAction(schema)); + }; + RegistryService.prototype.deselectMetadataSchema = function (schema) { + this.store.dispatch(new MetadataRegistryDeselectSchemaAction(schema)); + }; + RegistryService.prototype.deselectAllMetadataSchema = function () { + this.store.dispatch(new MetadataRegistryDeselectAllSchemaAction()); + }; + RegistryService.prototype.getSelectedMetadataSchemas = function () { + return this.store.pipe(select(selectedMetadataSchemasSelector)); + }; + RegistryService.prototype.editMetadataField = function (field) { + this.store.dispatch(new MetadataRegistryEditFieldAction(field)); + }; + RegistryService.prototype.cancelEditMetadataField = function () { + this.store.dispatch(new MetadataRegistryCancelFieldAction()); + }; + RegistryService.prototype.getActiveMetadataField = function () { + return this.store.pipe(select(editMetadataFieldSelector)); + }; + RegistryService.prototype.selectMetadataField = function (field) { + this.store.dispatch(new MetadataRegistrySelectFieldAction(field)); + }; + RegistryService.prototype.deselectMetadataField = function (field) { + this.store.dispatch(new MetadataRegistryDeselectFieldAction(field)); + }; + RegistryService.prototype.deselectAllMetadataField = function () { + this.store.dispatch(new MetadataRegistryDeselectAllFieldAction()); + }; + RegistryService.prototype.getSelectedMetadataFields = function () { + return this.store.pipe(select(selectedMetadataFieldsSelector)); + }; + /** + * Create or Update a MetadataSchema + * If the MetadataSchema contains an id, it is assumed the schema already exists and is updated instead + * Since creating or updating is nearly identical, the only real difference is the request (and slight difference in endpoint): + * - On creation, a CreateMetadataSchemaRequest is used + * - On update, a UpdateMetadataSchemaRequest is used + * @param schema The MetadataSchema to create or update + */ + RegistryService.prototype.createOrUpdateMetadataSchema = function (schema) { + var _this = this; + var isUpdate = hasValue(schema.id); + var requestId = this.requestService.generateRequestId(); + var endpoint$ = this.halService.getEndpoint(this.metadataSchemasPath).pipe(isNotEmptyOperator(), map(function (endpoint) { return (isUpdate ? endpoint + "/" + schema.id : endpoint); }), distinctUntilChanged()); + var serializedSchema = new DSpaceRESTv2Serializer(NormalizedObjectFactory.getConstructor(ResourceType.MetadataSchema)).serialize(schema); + var request$ = endpoint$.pipe(take(1), map(function (endpoint) { + if (isUpdate) { + var options = Object.create({}); + var headers = new HttpHeaders(); + headers = headers.append('Content-Type', 'application/json'); + options.headers = headers; + return new UpdateMetadataSchemaRequest(requestId, endpoint, JSON.stringify(serializedSchema), options); + } + else { + return new CreateMetadataSchemaRequest(requestId, endpoint, JSON.stringify(serializedSchema)); + } + })); + // Execute the post/put request + request$.pipe(configureRequest(this.requestService)).subscribe(); + // Return created/updated schema + return this.requestService.getByUUID(requestId).pipe(getResponseFromEntry(), map(function (response) { + if (!response.isSuccessful) { + if (hasValue(response.errorMessage)) { + _this.notificationsService.error('Server Error:', response.errorMessage, new NotificationOptions(-1)); + } + } + else { + _this.showNotifications(true, isUpdate, false, { prefix: schema.prefix }); + return response; + } + }), isNotEmptyOperator(), map(function (response) { + if (isNotEmpty(response.metadataschema)) { + return response.metadataschema; + } + })); + }; + RegistryService.prototype.deleteMetadataSchema = function (id) { + return this.delete(this.metadataSchemasPath, id); + }; + RegistryService.prototype.clearMetadataSchemaRequests = function () { + var _this = this; + return this.halService.getEndpoint(this.metadataSchemasPath).pipe(tap(function (href) { return _this.requestService.removeByHrefSubstring(href); })); + }; + /** + * Create or Update a MetadataField + * If the MetadataField contains an id, it is assumed the field already exists and is updated instead + * Since creating or updating is nearly identical, the only real difference is the request (and slight difference in endpoint): + * - On creation, a CreateMetadataFieldRequest is used + * - On update, a UpdateMetadataFieldRequest is used + * @param field The MetadataField to create or update + */ + RegistryService.prototype.createOrUpdateMetadataField = function (field) { + var _this = this; + var isUpdate = hasValue(field.id); + var requestId = this.requestService.generateRequestId(); + var endpoint$ = this.halService.getEndpoint(this.metadataFieldsPath).pipe(isNotEmptyOperator(), map(function (endpoint) { return (isUpdate ? endpoint + "/" + field.id : endpoint + "?schemaId=" + field.schema.id); }), distinctUntilChanged()); + var request$ = endpoint$.pipe(take(1), map(function (endpoint) { + if (isUpdate) { + var options = Object.create({}); + var headers = new HttpHeaders(); + headers = headers.append('Content-Type', 'application/json'); + options.headers = headers; + return new UpdateMetadataFieldRequest(requestId, endpoint, JSON.stringify(field), options); + } + else { + return new CreateMetadataFieldRequest(requestId, endpoint, JSON.stringify(field)); + } + })); + // Execute the post/put request + request$.pipe(configureRequest(this.requestService)).subscribe(); + // Return created/updated field + return this.requestService.getByUUID(requestId).pipe(getResponseFromEntry(), map(function (response) { + if (!response.isSuccessful) { + if (hasValue(response.errorMessage)) { + _this.notificationsService.error('Server Error:', response.errorMessage, new NotificationOptions(-1)); + } + } + else { + var fieldString = field.schema.prefix + "." + field.element + (field.qualifier ? "." + field.qualifier : ''); + _this.showNotifications(true, isUpdate, true, { field: fieldString }); + return response; + } + }), isNotEmptyOperator(), map(function (response) { + if (isNotEmpty(response.metadatafield)) { + return response.metadatafield; + } + })); + }; + RegistryService.prototype.deleteMetadataField = function (id) { + return this.delete(this.metadataFieldsPath, id); + }; + RegistryService.prototype.clearMetadataFieldRequests = function () { + var _this = this; + return this.halService.getEndpoint(this.metadataFieldsPath).pipe(tap(function (href) { return _this.requestService.removeByHrefSubstring(href); })); + }; + RegistryService.prototype.delete = function (path, id) { + var requestId = this.requestService.generateRequestId(); + var endpoint$ = this.halService.getEndpoint(path).pipe(isNotEmptyOperator(), map(function (endpoint) { return endpoint + "/" + id; }), distinctUntilChanged()); + var request$ = endpoint$.pipe(take(1), map(function (endpoint) { return new DeleteRequest(requestId, endpoint); })); + // Execute the delete request + request$.pipe(configureRequest(this.requestService)).subscribe(); + return this.requestService.getByUUID(requestId).pipe(getResponseFromEntry()); + }; + RegistryService.prototype.showNotifications = function (success, edited, isField, options) { + var _this = this; + var prefix = 'admin.registries.schema.notification'; + var suffix = success ? 'success' : 'failure'; + var editedString = edited ? 'edited' : 'created'; + var messages = observableCombineLatest(this.translateService.get(success ? prefix + "." + suffix : prefix + "." + suffix), this.translateService.get("" + prefix + (isField ? '.field' : '') + "." + editedString, options)); + messages.subscribe(function (_a) { + var head = _a[0], content = _a[1]; + if (success) { + _this.notificationsService.success(head, content); + } + else { + _this.notificationsService.error(head, content); + } + }); + }; + /** + * Retrieve a filtered paginated list of metadata fields + * @param query {string} The query to filter the field names by + * @returns an observable that emits a remote data object with a page of metadata fields that match the query + */ + RegistryService.prototype.queryMetadataFields = function (query) { + return this.getAllMetadataFields().pipe(map(function (rd) { + var filteredFields = rd.payload.page.filter(function (field) { return field.toString().indexOf(query) >= 0; }); + var page = new PaginatedList(new PageInfo(), filteredFields); + return Object.assign({}, rd, { payload: page }); + })); + }; + RegistryService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + RemoteDataBuildService, + HALEndpointService, + Store, + NotificationsService, + TranslateService]) + ], RegistryService); + return RegistryService; +}()); +export { RegistryService }; +//# sourceMappingURL=registry.service.js.map \ No newline at end of file diff --git a/src/app/core/registry/registry.service.js.map b/src/app/core/registry/registry.service.js.map new file mode 100644 index 0000000000..9a81d423e7 --- /dev/null +++ b/src/app/core/registry/registry.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"registry.service.js","sourceRoot":"","sources":["registry.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAc,MAAM,MAAM,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,aAAa,EACb,UAAU,EACG,0BAA0B,EACvC,2BAA2B,EAC5B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,6CAA6C,EAAE,MAAM,2DAA2D,CAAC;AAC1H,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAC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A3fU,eAAe;QAD3B,UAAU,EAAE;iDAO2B,cAAc;YAC3B,sBAAsB;YACf,kBAAkB;YACvB,KAAK;YACU,oBAAoB;YACxB,gBAAgB;OAX3C,eAAe,CA4f3B;IAAD,sBAAC;CAAA,AA5fD,IA4fC;SA5fY,eAAe"} \ No newline at end of file diff --git a/src/app/core/roles/role-types.js b/src/app/core/roles/role-types.js new file mode 100644 index 0000000000..78e876cd48 --- /dev/null +++ b/src/app/core/roles/role-types.js @@ -0,0 +1,7 @@ +export var RoleType; +(function (RoleType) { + RoleType["Submitter"] = "submitter"; + RoleType["Controller"] = "controller"; + RoleType["Admin"] = "admin"; +})(RoleType || (RoleType = {})); +//# sourceMappingURL=role-types.js.map \ No newline at end of file diff --git a/src/app/core/roles/role-types.js.map b/src/app/core/roles/role-types.js.map new file mode 100644 index 0000000000..95b2dea04d --- /dev/null +++ b/src/app/core/roles/role-types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"role-types.js","sourceRoot":"","sources":["role-types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,mCAAuB,CAAA;IACvB,qCAAyB,CAAA;IACzB,2BAAe,CAAA;AACjB,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB"} \ No newline at end of file diff --git a/src/app/core/roles/role.service.js b/src/app/core/roles/role.service.js new file mode 100644 index 0000000000..169d06592f --- /dev/null +++ b/src/app/core/roles/role.service.js @@ -0,0 +1,67 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { of as observableOf } from 'rxjs'; +import { distinctUntilChanged } from 'rxjs/operators'; +import { RoleType } from './role-types'; +import { CollectionDataService } from '../data/collection-data.service'; +/** + * A service that provides methods to identify user role. + */ +var RoleService = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {CollectionDataService} collectionService + */ + function RoleService(collectionService) { + this.collectionService = collectionService; + } + /** + * Check if current user is a submitter + */ + RoleService.prototype.isSubmitter = function () { + return this.collectionService.hasAuthorizedCollection().pipe(distinctUntilChanged()); + }; + /** + * Check if current user is a controller + */ + RoleService.prototype.isController = function () { + // TODO find a way to check if user is a controller + return observableOf(true); + }; + /** + * Check if current user is an admin + */ + RoleService.prototype.isAdmin = function () { + // TODO find a way to check if user is an admin + return observableOf(false); + }; + /** + * Check if current user by role type + * + * @param {RoleType} role + * the role type + */ + RoleService.prototype.checkRole = function (role) { + var check; + switch (role) { + case RoleType.Submitter: + check = this.isSubmitter(); + break; + case RoleType.Controller: + check = this.isController(); + break; + case RoleType.Admin: + check = this.isAdmin(); + break; + } + return check; + }; + RoleService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [CollectionDataService]) + ], RoleService); + return RoleService; +}()); +export { RoleService }; +//# sourceMappingURL=role.service.js.map \ No newline at end of file diff --git a/src/app/core/roles/role.service.js.map b/src/app/core/roles/role.service.js.map new file mode 100644 index 0000000000..5b04248904 --- /dev/null +++ b/src/app/core/roles/role.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"role.service.js","sourceRoot":"","sources":["role.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;GAEG;AAEH;IAEE;;;;OAIG;IACH,qBAAoB,iBAAwC;QAAxC,sBAAiB,GAAjB,iBAAiB,CAAuB;IAC5D,CAAC;IAED;;OAEG;IACH,iCAAW,GAAX;QACE,OAAO,IAAI,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,CAAC,IAAI,CAC1D,oBAAoB,EAAE,CACvB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,kCAAY,GAAZ;QACE,mDAAmD;QACnD,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,6BAAO,GAAP;QACE,+CAA+C;QAC/C,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,+BAAS,GAAT,UAAU,IAAc;QACtB,IAAI,KAA0B,CAAC;QAC/B,QAAQ,IAAI,EAAE;YACZ,KAAK,QAAQ,CAAC,SAAS;gBACrB,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;gBAC3B,MAAM;YACR,KAAK,QAAQ,CAAC,UAAU;gBACtB,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;gBAC5B,MAAM;YACR,KAAK,QAAQ,CAAC,KAAK;gBACjB,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;gBACvB,MAAM;SACT;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAxDU,WAAW;QADvB,UAAU,EAAE;iDAQ4B,qBAAqB;OAPjD,WAAW,CAyDvB;IAAD,kBAAC;CAAA,AAzDD,IAyDC;SAzDY,WAAW"} \ No newline at end of file diff --git a/src/app/core/serializer.js b/src/app/core/serializer.js new file mode 100644 index 0000000000..4b3b4ca18d --- /dev/null +++ b/src/app/core/serializer.js @@ -0,0 +1 @@ +//# sourceMappingURL=serializer.js.map \ No newline at end of file diff --git a/src/app/core/serializer.js.map b/src/app/core/serializer.js.map new file mode 100644 index 0000000000..36f3dae23e --- /dev/null +++ b/src/app/core/serializer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"serializer.js","sourceRoot":"","sources":["serializer.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/core/shared/bitstream-format.model.js b/src/app/core/shared/bitstream-format.model.js new file mode 100644 index 0000000000..9b822ece42 --- /dev/null +++ b/src/app/core/shared/bitstream-format.model.js @@ -0,0 +1,10 @@ +/** + * Model class for a Bitstream Format + */ +var BitstreamFormat = /** @class */ (function () { + function BitstreamFormat() { + } + return BitstreamFormat; +}()); +export { BitstreamFormat }; +//# sourceMappingURL=bitstream-format.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/bitstream-format.model.js.map b/src/app/core/shared/bitstream-format.model.js.map new file mode 100644 index 0000000000..fc2f4bac23 --- /dev/null +++ b/src/app/core/shared/bitstream-format.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bitstream-format.model.js","sourceRoot":"","sources":["bitstream-format.model.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAAA;IA+CA,CAAC;IAAD,sBAAC;AAAD,CAAC,AA/CD,IA+CC"} \ No newline at end of file diff --git a/src/app/core/shared/bitstream.model.js b/src/app/core/shared/bitstream.model.js new file mode 100644 index 0000000000..4ca998a61d --- /dev/null +++ b/src/app/core/shared/bitstream.model.js @@ -0,0 +1,11 @@ +import * as tslib_1 from "tslib"; +import { DSpaceObject } from './dspace-object.model'; +var Bitstream = /** @class */ (function (_super) { + tslib_1.__extends(Bitstream, _super); + function Bitstream() { + return _super !== null && _super.apply(this, arguments) || this; + } + return Bitstream; +}(DSpaceObject)); +export { Bitstream }; +//# sourceMappingURL=bitstream.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/bitstream.model.js.map b/src/app/core/shared/bitstream.model.js.map new file mode 100644 index 0000000000..98c82ef30a --- /dev/null +++ b/src/app/core/shared/bitstream.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bitstream.model.js","sourceRoot":"","sources":["bitstream.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAMrD;IAA+B,qCAAY;IAA3C;;IAqCA,CAAC;IAAD,gBAAC;AAAD,CAAC,AArCD,CAA+B,YAAY,GAqC1C"} \ No newline at end of file diff --git a/src/app/core/shared/browse-definition.model.js b/src/app/core/shared/browse-definition.model.js new file mode 100644 index 0000000000..aded025a94 --- /dev/null +++ b/src/app/core/shared/browse-definition.model.js @@ -0,0 +1,37 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs } from 'cerialize'; +var BrowseDefinition = /** @class */ (function () { + function BrowseDefinition() { + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], BrowseDefinition.prototype, "id", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], BrowseDefinition.prototype, "metadataBrowse", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Array) + ], BrowseDefinition.prototype, "sortOptions", void 0); + tslib_1.__decorate([ + autoserializeAs('order'), + tslib_1.__metadata("design:type", String) + ], BrowseDefinition.prototype, "defaultSortOrder", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], BrowseDefinition.prototype, "type", void 0); + tslib_1.__decorate([ + autoserializeAs('metadata'), + tslib_1.__metadata("design:type", Array) + ], BrowseDefinition.prototype, "metadataKeys", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Object) + ], BrowseDefinition.prototype, "_links", void 0); + return BrowseDefinition; +}()); +export { BrowseDefinition }; +//# sourceMappingURL=browse-definition.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/browse-definition.model.js.map b/src/app/core/shared/browse-definition.model.js.map new file mode 100644 index 0000000000..5c903b3347 --- /dev/null +++ b/src/app/core/shared/browse-definition.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-definition.model.js","sourceRoot":"","sources":["browse-definition.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG3D;IAAA;IAuBA,CAAC;IArBC;QADC,aAAa;;gDACH;IAGX;QADC,aAAa;;4DACU;IAGxB;QADC,aAAa;;yDACY;IAG1B;QADC,eAAe,CAAC,OAAO,CAAC;;8DACA;IAGzB;QADC,aAAa;;kDACD;IAGb;QADC,eAAe,CAAC,UAAU,CAAC;;0DACL;IAGvB;QADC,aAAa;;oDAGb;IACH,uBAAC;CAAA,AAvBD,IAuBC;SAvBY,gBAAgB"} \ No newline at end of file diff --git a/src/app/core/shared/browse-entry.model.js b/src/app/core/shared/browse-entry.model.js new file mode 100644 index 0000000000..c0305a9bb8 --- /dev/null +++ b/src/app/core/shared/browse-entry.model.js @@ -0,0 +1,29 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs } from 'cerialize'; +var BrowseEntry = /** @class */ (function () { + function BrowseEntry() { + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], BrowseEntry.prototype, "type", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], BrowseEntry.prototype, "authority", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], BrowseEntry.prototype, "value", void 0); + tslib_1.__decorate([ + autoserializeAs('valueLang'), + tslib_1.__metadata("design:type", String) + ], BrowseEntry.prototype, "language", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], BrowseEntry.prototype, "count", void 0); + return BrowseEntry; +}()); +export { BrowseEntry }; +//# sourceMappingURL=browse-entry.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/browse-entry.model.js.map b/src/app/core/shared/browse-entry.model.js.map new file mode 100644 index 0000000000..fb24ae05ea --- /dev/null +++ b/src/app/core/shared/browse-entry.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-entry.model.js","sourceRoot":"","sources":["browse-entry.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG3D;IAAA;IAiBA,CAAC;IAdC;QADC,aAAa;;6CACD;IAGb;QADC,aAAa;;kDACI;IAGlB;QADC,aAAa;;8CACA;IAGd;QADC,eAAe,CAAC,WAAW,CAAC;;iDACZ;IAGjB;QADC,aAAa;;8CACA;IAEhB,kBAAC;CAAA,AAjBD,IAiBC;SAjBY,WAAW"} \ No newline at end of file diff --git a/src/app/core/shared/bundle.model.js b/src/app/core/shared/bundle.model.js new file mode 100644 index 0000000000..1ede803117 --- /dev/null +++ b/src/app/core/shared/bundle.model.js @@ -0,0 +1,11 @@ +import * as tslib_1 from "tslib"; +import { DSpaceObject } from './dspace-object.model'; +var Bundle = /** @class */ (function (_super) { + tslib_1.__extends(Bundle, _super); + function Bundle() { + return _super !== null && _super.apply(this, arguments) || this; + } + return Bundle; +}(DSpaceObject)); +export { Bundle }; +//# sourceMappingURL=bundle.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/bundle.model.js.map b/src/app/core/shared/bundle.model.js.map new file mode 100644 index 0000000000..708d273307 --- /dev/null +++ b/src/app/core/shared/bundle.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.model.js","sourceRoot":"","sources":["bundle.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAMrD;IAA4B,kCAAY;IAAxC;;IAkBA,CAAC;IAAD,aAAC;AAAD,CAAC,AAlBD,CAA4B,YAAY,GAkBvC"} \ No newline at end of file diff --git a/src/app/core/shared/collection.model.js b/src/app/core/shared/collection.model.js new file mode 100644 index 0000000000..b454d0c7ec --- /dev/null +++ b/src/app/core/shared/collection.model.js @@ -0,0 +1,66 @@ +import * as tslib_1 from "tslib"; +import { DSpaceObject } from './dspace-object.model'; +var Collection = /** @class */ (function (_super) { + tslib_1.__extends(Collection, _super); + function Collection() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Collection.prototype, "introductoryText", { + /** + * The introductory text of this Collection + * Corresponds to the metadata field dc.description + */ + get: function () { + return this.firstMetadataValue('dc.description'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Collection.prototype, "shortDescription", { + /** + * The short description: HTML + * Corresponds to the metadata field dc.description.abstract + */ + get: function () { + return this.firstMetadataValue('dc.description.abstract'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Collection.prototype, "copyrightText", { + /** + * The copyright text of this Collection + * Corresponds to the metadata field dc.rights + */ + get: function () { + return this.firstMetadataValue('dc.rights'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Collection.prototype, "dcLicense", { + /** + * The license of this Collection + * Corresponds to the metadata field dc.rights.license + */ + get: function () { + return this.firstMetadataValue('dc.rights.license'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Collection.prototype, "sidebarText", { + /** + * The sidebar text of this Collection + * Corresponds to the metadata field dc.description.tableofcontents + */ + get: function () { + return this.firstMetadataValue('dc.description.tableofcontents'); + }, + enumerable: true, + configurable: true + }); + return Collection; +}(DSpaceObject)); +export { Collection }; +//# sourceMappingURL=collection.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/collection.model.js.map b/src/app/core/shared/collection.model.js.map new file mode 100644 index 0000000000..b19d242005 --- /dev/null +++ b/src/app/core/shared/collection.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collection.model.js","sourceRoot":"","sources":["collection.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AASrD;IAAgC,sCAAY;IAA5C;;IA0EA,CAAC;IA/DC,sBAAI,wCAAgB;QAJpB;;;WAGG;aACH;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;QACnD,CAAC;;;OAAA;IAMD,sBAAI,wCAAgB;QAJpB;;;WAGG;aACH;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,CAAC;QAC5D,CAAC;;;OAAA;IAMD,sBAAI,qCAAa;QAJjB;;;WAGG;aACH;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QAC9C,CAAC;;;OAAA;IAMD,sBAAI,iCAAS;QAJb;;;WAGG;aACH;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;QACtD,CAAC;;;OAAA;IAMD,sBAAI,mCAAW;QAJf;;;WAGG;aACH;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,gCAAgC,CAAC,CAAC;QACnE,CAAC;;;OAAA;IA6BH,iBAAC;AAAD,CAAC,AA1ED,CAAgC,YAAY,GA0E3C"} \ No newline at end of file diff --git a/src/app/core/shared/community.model.js b/src/app/core/shared/community.model.js new file mode 100644 index 0000000000..d762595a4a --- /dev/null +++ b/src/app/core/shared/community.model.js @@ -0,0 +1,55 @@ +import * as tslib_1 from "tslib"; +import { DSpaceObject } from './dspace-object.model'; +var Community = /** @class */ (function (_super) { + tslib_1.__extends(Community, _super); + function Community() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Community.prototype, "introductoryText", { + /** + * The introductory text of this Community + * Corresponds to the metadata field dc.description + */ + get: function () { + return this.firstMetadataValue('dc.description'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Community.prototype, "shortDescription", { + /** + * The short description: HTML + * Corresponds to the metadata field dc.description.abstract + */ + get: function () { + return this.firstMetadataValue('dc.description.abstract'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Community.prototype, "copyrightText", { + /** + * The copyright text of this Community + * Corresponds to the metadata field dc.rights + */ + get: function () { + return this.firstMetadataValue('dc.rights'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Community.prototype, "sidebarText", { + /** + * The sidebar text of this Community + * Corresponds to the metadata field dc.description.tableofcontents + */ + get: function () { + return this.firstMetadataValue('dc.description.tableofcontents'); + }, + enumerable: true, + configurable: true + }); + return Community; +}(DSpaceObject)); +export { Community }; +//# sourceMappingURL=community.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/community.model.js.map b/src/app/core/shared/community.model.js.map new file mode 100644 index 0000000000..974b25cc40 --- /dev/null +++ b/src/app/core/shared/community.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community.model.js","sourceRoot":"","sources":["community.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAOrD;IAA+B,qCAAY;IAA3C;;IA0DA,CAAC;IA/CC,sBAAI,uCAAgB;QAJpB;;;WAGG;aACH;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;QACnD,CAAC;;;OAAA;IAMD,sBAAI,uCAAgB;QAJpB;;;WAGG;aACH;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,CAAC;QAC5D,CAAC;;;OAAA;IAMD,sBAAI,oCAAa;QAJjB;;;WAGG;aACH;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QAC9C,CAAC;;;OAAA;IAMD,sBAAI,kCAAW;QAJf;;;WAGG;aACH;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,gCAAgC,CAAC,CAAC;QACnE,CAAC;;;OAAA;IAqBH,gBAAC;AAAD,CAAC,AA1DD,CAA+B,YAAY,GA0D1C"} \ No newline at end of file diff --git a/src/app/core/shared/dspace-object-type.model.js b/src/app/core/shared/dspace-object-type.model.js new file mode 100644 index 0000000000..462683c50f --- /dev/null +++ b/src/app/core/shared/dspace-object-type.model.js @@ -0,0 +1,9 @@ +export var DSpaceObjectType; +(function (DSpaceObjectType) { + DSpaceObjectType["BUNDLE"] = "BUNDLE"; + DSpaceObjectType["BITSTREAM"] = "BITSTREAM"; + DSpaceObjectType["ITEM"] = "ITEM"; + DSpaceObjectType["COLLECTION"] = "COLLECTION"; + DSpaceObjectType["COMMUNITY"] = "COMMUNITY"; +})(DSpaceObjectType || (DSpaceObjectType = {})); +//# sourceMappingURL=dspace-object-type.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/dspace-object-type.model.js.map b/src/app/core/shared/dspace-object-type.model.js.map new file mode 100644 index 0000000000..6b22f291f1 --- /dev/null +++ b/src/app/core/shared/dspace-object-type.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-object-type.model.js","sourceRoot":"","sources":["dspace-object-type.model.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,2CAAuB,CAAA;IACvB,iCAAa,CAAA;IACb,6CAAyB,CAAA;IACzB,2CAAuB,CAAA;AACzB,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,QAM3B"} \ No newline at end of file diff --git a/src/app/core/shared/dspace-object.model.js b/src/app/core/shared/dspace-object.model.js new file mode 100644 index 0000000000..12f6bb3240 --- /dev/null +++ b/src/app/core/shared/dspace-object.model.js @@ -0,0 +1,107 @@ +import { Metadata } from './metadata.utils'; +import { isUndefined } from '../../shared/empty.util'; +import { hasNoValue } from '../../shared/empty.util'; +/** + * An abstract model class for a DSpaceObject. + */ +var DSpaceObject = /** @class */ (function () { + function DSpaceObject() { + } + Object.defineProperty(DSpaceObject.prototype, "name", { + /** + * The name for this DSpaceObject + */ + get: function () { + return (isUndefined(this._name)) ? this.firstMetadataValue('dc.title') : this._name; + }, + /** + * The name for this DSpaceObject + */ + set: function (name) { + this._name = name; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DSpaceObject.prototype, "metadataAsList", { + /** + * Retrieve the current metadata as a list of MetadatumViewModels + */ + get: function () { + return Metadata.toViewModelList(this.metadata); + }, + enumerable: true, + configurable: true + }); + /** + * Gets all matching metadata in this DSpaceObject. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @param {MetadataValueFilter} filter The value filter to use. If unspecified, no filtering will be done. + * @returns {MetadataValue[]} the matching values or an empty array. + */ + DSpaceObject.prototype.allMetadata = function (keyOrKeys, valueFilter) { + return Metadata.all(this.metadata, keyOrKeys, valueFilter); + }; + /** + * Like [[allMetadata]], but only returns string values. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @param {MetadataValueFilter} filter The value filter to use. If unspecified, no filtering will be done. + * @returns {string[]} the matching string values or an empty array. + */ + DSpaceObject.prototype.allMetadataValues = function (keyOrKeys, valueFilter) { + return Metadata.allValues(this.metadata, keyOrKeys, valueFilter); + }; + /** + * Gets the first matching MetadataValue object in this DSpaceObject, or `undefined`. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @param {MetadataValueFilter} filter The value filter to use. If unspecified, no filtering will be done. + * @returns {MetadataValue} the first matching value, or `undefined`. + */ + DSpaceObject.prototype.firstMetadata = function (keyOrKeys, valueFilter) { + return Metadata.first(this.metadata, keyOrKeys, valueFilter); + }; + /** + * Like [[firstMetadata]], but only returns a string value, or `undefined`. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @param {MetadataValueFilter} filter The value filter to use. If unspecified, no filtering will be done. + * @returns {string} the first matching string value, or `undefined`. + */ + DSpaceObject.prototype.firstMetadataValue = function (keyOrKeys, valueFilter) { + return Metadata.firstValue(this.metadata, keyOrKeys, valueFilter); + }; + /** + * Checks for a matching metadata value in this DSpaceObject. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @param {MetadataValueFilter} filter The value filter to use. If unspecified, no filtering will be done. + * @returns {boolean} whether a match is found. + */ + DSpaceObject.prototype.hasMetadata = function (keyOrKeys, valueFilter) { + return Metadata.has(this.metadata, keyOrKeys, valueFilter); + }; + /** + * Find metadata on a specific field and order all of them using their "place" property. + * @param key + */ + DSpaceObject.prototype.findMetadataSortedByPlace = function (key) { + return this.allMetadata([key]).sort(function (a, b) { + if (hasNoValue(a.place) && hasNoValue(b.place)) { + return 0; + } + if (hasNoValue(a.place)) { + return -1; + } + if (hasNoValue(b.place)) { + return 1; + } + return a.place - b.place; + }); + }; + return DSpaceObject; +}()); +export { DSpaceObject }; +//# sourceMappingURL=dspace-object.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/dspace-object.model.js.map b/src/app/core/shared/dspace-object.model.js.map new file mode 100644 index 0000000000..76b3781cb2 --- /dev/null +++ b/src/app/core/shared/dspace-object.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-object.model.js","sourceRoot":"","sources":["dspace-object.model.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAKtD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD;;GAEG;AACH;IAAA;IAmIA,CAAC;IA3GC,sBAAI,8BAAI;QAHR;;WAEG;aACH;YACE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QACtF,CAAC;QAED;;WAEG;aACH,UAAS,IAAI;YACX,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,CAAC;;;OAPA;IAiBD,sBAAI,wCAAc;QAHlB;;WAEG;aACH;YACE,OAAO,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,CAAC;;;OAAA;IAYD;;;;;;OAMG;IACH,kCAAW,GAAX,UAAY,SAA4B,EAAE,WAAiC;QACzE,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;OAMG;IACH,wCAAiB,GAAjB,UAAkB,SAA4B,EAAE,WAAiC;QAC/E,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;OAMG;IACH,oCAAa,GAAb,UAAc,SAA4B,EAAE,WAAiC;QAC3E,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;OAMG;IACH,yCAAkB,GAAlB,UAAmB,SAA4B,EAAE,WAAiC;QAChF,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;OAMG;IACH,kCAAW,GAAX,UAAY,SAA4B,EAAE,WAAiC;QACzE,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACH,gDAAyB,GAAzB,UAA0B,GAAW;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,CAAgB,EAAE,CAAgB;YACrE,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBAC9C,OAAO,CAAC,CAAC;aACV;YACD,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBACvB,OAAO,CAAC,CAAC,CAAC;aACX;YACD,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBACvB,OAAO,CAAC,CAAC;aACV;YACD,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAEH,mBAAC;AAAD,CAAC,AAnID,IAmIC"} \ No newline at end of file diff --git a/src/app/core/shared/file.service.js b/src/app/core/shared/file.service.js new file mode 100644 index 0000000000..865ae26d7d --- /dev/null +++ b/src/app/core/shared/file.service.js @@ -0,0 +1,50 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { HttpHeaders } from '@angular/common/http'; +import { DSpaceRESTv2Service } from '../dspace-rest-v2/dspace-rest-v2.service'; +import { RestRequestMethod } from '../data/rest-request-method'; +import { saveAs } from 'file-saver'; +/** + * Provides utility methods to save files on the client-side. + */ +var FileService = /** @class */ (function () { + function FileService(restService) { + this.restService = restService; + } + /** + * Makes a HTTP Get request to download a file + * + * @param url + * file url + */ + FileService.prototype.downloadFile = function (url) { + var _this = this; + var headers = new HttpHeaders(); + var options = Object.create({ headers: headers, responseType: 'blob' }); + return this.restService.request(RestRequestMethod.GET, url, null, options) + .subscribe(function (data) { + saveAs(data.payload, _this.getFileNameFromResponseContentDisposition(data)); + }); + }; + /** + * Derives file name from the http response + * by looking inside content-disposition + * @param res + * http DSpaceRESTV2Response + */ + FileService.prototype.getFileNameFromResponseContentDisposition = function (res) { + // NOTE: to be able to retrieve 'Content-Disposition' header, + // you need to set 'Access-Control-Expose-Headers': 'Content-Disposition' ON SERVER SIDE + var contentDisposition = res.headers.get('content-disposition') || ''; + var matches = /filename="([^;]+)"/ig.exec(contentDisposition) || []; + return (matches[1] || 'untitled').trim().replace(/\.[^/.]+$/, ''); + }; + ; + FileService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [DSpaceRESTv2Service]) + ], FileService); + return FileService; +}()); +export { FileService }; +//# sourceMappingURL=file.service.js.map \ No newline at end of file diff --git a/src/app/core/shared/file.service.js.map b/src/app/core/shared/file.service.js.map new file mode 100644 index 0000000000..c0452e0f09 --- /dev/null +++ b/src/app/core/shared/file.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"file.service.js","sourceRoot":"","sources":["file.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAe,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpC;;GAEG;AAEH;IACE,qBACU,WAAgC;QAAhC,gBAAW,GAAX,WAAW,CAAqB;IACtC,CAAC;IAEL;;;;;OAKG;IACH,kCAAY,GAAZ,UAAa,GAAW;QAAxB,iBAOC;QANC,IAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAClC,IAAM,OAAO,GAAgB,MAAM,CAAC,MAAM,CAAC,EAAC,OAAO,SAAA,EAAE,YAAY,EAAE,MAAM,EAAC,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC;aACvE,SAAS,CAAC,UAAC,IAAI;YACd,MAAM,CAAC,IAAI,CAAC,OAAe,EAAE,KAAI,CAAC,yCAAyC,CAAC,IAAI,CAAC,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACH,+DAAyC,GAAzC,UAA0C,GAAyB;QACjE,6DAA6D;QAC7D,wFAAwF;QACxF,IAAM,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC;QACxE,IAAM,OAAO,GAAG,sBAAsB,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;QACtE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IAAA,CAAC;IAhCS,WAAW;QADvB,UAAU,EAAE;iDAGY,mBAAmB;OAF/B,WAAW,CAiCvB;IAAD,kBAAC;CAAA,AAjCD,IAiCC;SAjCY,WAAW"} \ No newline at end of file diff --git a/src/app/core/shared/generic-constructor.js b/src/app/core/shared/generic-constructor.js new file mode 100644 index 0000000000..470d00546d --- /dev/null +++ b/src/app/core/shared/generic-constructor.js @@ -0,0 +1,2 @@ +/* tslint:enable:interface-over-type-literal */ +//# sourceMappingURL=generic-constructor.js.map \ No newline at end of file diff --git a/src/app/core/shared/generic-constructor.js.map b/src/app/core/shared/generic-constructor.js.map new file mode 100644 index 0000000000..d1cb9f319e --- /dev/null +++ b/src/app/core/shared/generic-constructor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"generic-constructor.js","sourceRoot":"","sources":["generic-constructor.ts"],"names":[],"mappings":"AAOA,+CAA+C"} \ No newline at end of file diff --git a/src/app/core/shared/hal-endpoint.service.js b/src/app/core/shared/hal-endpoint.service.js new file mode 100644 index 0000000000..644ddc95f0 --- /dev/null +++ b/src/app/core/shared/hal-endpoint.service.js @@ -0,0 +1,75 @@ +import * as tslib_1 from "tslib"; +import { distinctUntilChanged, map, startWith, switchMap } from 'rxjs/operators'; +import { RequestService } from '../data/request.service'; +import { EndpointMapRequest } from '../data/request.models'; +import { hasValue, isEmpty, isNotEmpty } from '../../shared/empty.util'; +import { RESTURLCombiner } from '../url-combiner/rest-url-combiner'; +import { Inject, Injectable } from '@angular/core'; +import { GLOBAL_CONFIG } from '../../../config'; +import { getResponseFromEntry } from './operators'; +import { URLCombiner } from '../url-combiner/url-combiner'; +var HALEndpointService = /** @class */ (function () { + function HALEndpointService(requestService, EnvConfig) { + this.requestService = requestService; + this.EnvConfig = EnvConfig; + } + HALEndpointService.prototype.getRootHref = function () { + return new RESTURLCombiner(this.EnvConfig, '/').toString(); + }; + HALEndpointService.prototype.getRootEndpointMap = function () { + return this.getEndpointMapAt(this.getRootHref()); + }; + HALEndpointService.prototype.getEndpointMapAt = function (href) { + var request = new EndpointMapRequest(this.requestService.generateRequestId(), href); + this.requestService.configure(request); + return this.requestService.getByHref(request.href).pipe(getResponseFromEntry(), map(function (response) { return response.endpointMap; })); + }; + HALEndpointService.prototype.getEndpoint = function (linkPath) { + return this.getEndpointAt.apply(this, [this.getRootHref()].concat(linkPath.split('/'))); + }; + /** + * Resolve the actual hal url based on a list of hal names + * @param {string} href The root url to start from + * @param {string} halNames List of hal names for which a url should be resolved + * @returns {Observable} Observable that emits the found hal url + */ + HALEndpointService.prototype.getEndpointAt = function (href) { + var _this = this; + var halNames = []; + for (var _i = 1; _i < arguments.length; _i++) { + halNames[_i - 1] = arguments[_i]; + } + if (isEmpty(halNames)) { + throw new Error('cant\'t fetch the URL without the HAL link names'); + } + var nextHref$ = this.getEndpointMapAt(href).pipe(map(function (endpointMap) { + /*TODO remove if/else block once the rest response contains _links for facets*/ + var nextName = halNames[0]; + if (hasValue(endpointMap) && hasValue(endpointMap[nextName])) { + return endpointMap[nextName]; + } + else { + return new URLCombiner(href, nextName).toString(); + } + })); + if (halNames.length === 1) { + return nextHref$; + } + else { + return nextHref$.pipe(switchMap(function (nextHref) { return _this.getEndpointAt.apply(_this, [nextHref].concat(halNames.slice(1))); })); + } + }; + HALEndpointService.prototype.isEnabledOnRestApi = function (linkPath) { + return this.getRootEndpointMap().pipe( + // TODO this only works when there's no / in linkPath + map(function (endpointMap) { return isNotEmpty(endpointMap[linkPath]); }), startWith(undefined), distinctUntilChanged()); + }; + HALEndpointService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(1, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [RequestService, Object]) + ], HALEndpointService); + return HALEndpointService; +}()); +export { HALEndpointService }; +//# sourceMappingURL=hal-endpoint.service.js.map \ No newline at end of file diff --git a/src/app/core/shared/hal-endpoint.service.js.map b/src/app/core/shared/hal-endpoint.service.js.map new file mode 100644 index 0000000000..fe1334a14f --- /dev/null +++ b/src/app/core/shared/hal-endpoint.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hal-endpoint.service.js","sourceRoot":"","sources":["hal-endpoint.service.ts"],"names":[],"mappings":";AACA,OAAO,EACL,oBAAoB,EACpB,GAAG,EAEH,SAAS,EACT,SAAS,EAEV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,QA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ACpB,oBAAoB,EAAE,CACvB,CAAA;IACH,CAAC;IAnEU,kBAAkB;QAD9B,UAAU,EAAE;QAIE,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;iDADE,cAAc;OAFvC,kBAAkB,CAqE9B;IAAD,yBAAC;CAAA,AArED,IAqEC;SArEY,kBAAkB"} \ No newline at end of file diff --git a/src/app/core/shared/item-relationships/item-type.model.js b/src/app/core/shared/item-relationships/item-type.model.js new file mode 100644 index 0000000000..f8264a7bb7 --- /dev/null +++ b/src/app/core/shared/item-relationships/item-type.model.js @@ -0,0 +1,10 @@ +/** + * Describes a type of Item + */ +var ItemType = /** @class */ (function () { + function ItemType() { + } + return ItemType; +}()); +export { ItemType }; +//# sourceMappingURL=item-type.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/item-relationships/item-type.model.js.map b/src/app/core/shared/item-relationships/item-type.model.js.map new file mode 100644 index 0000000000..0153ee426e --- /dev/null +++ b/src/app/core/shared/item-relationships/item-type.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-type.model.js","sourceRoot":"","sources":["item-type.model.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH;IAAA;IAoBA,CAAC;IAAD,eAAC;AAAD,CAAC,AApBD,IAoBC"} \ No newline at end of file diff --git a/src/app/core/shared/item-relationships/relationship-type.model.js b/src/app/core/shared/item-relationships/relationship-type.model.js new file mode 100644 index 0000000000..5442dda2a5 --- /dev/null +++ b/src/app/core/shared/item-relationships/relationship-type.model.js @@ -0,0 +1,10 @@ +/** + * Describes a type of Relationship between multiple possible Items + */ +var RelationshipType = /** @class */ (function () { + function RelationshipType() { + } + return RelationshipType; +}()); +export { RelationshipType }; +//# sourceMappingURL=relationship-type.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/item-relationships/relationship-type.model.js.map b/src/app/core/shared/item-relationships/relationship-type.model.js.map new file mode 100644 index 0000000000..e477b7d090 --- /dev/null +++ b/src/app/core/shared/item-relationships/relationship-type.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"relationship-type.model.js","sourceRoot":"","sources":["relationship-type.model.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH;IAAA;IAiEA,CAAC;IAAD,uBAAC;AAAD,CAAC,AAjED,IAiEC"} \ No newline at end of file diff --git a/src/app/core/shared/item-relationships/relationship.model.js b/src/app/core/shared/item-relationships/relationship.model.js new file mode 100644 index 0000000000..adf7c234de --- /dev/null +++ b/src/app/core/shared/item-relationships/relationship.model.js @@ -0,0 +1,10 @@ +/** + * Describes a Relationship between two Items + */ +var Relationship = /** @class */ (function () { + function Relationship() { + } + return Relationship; +}()); +export { Relationship }; +//# sourceMappingURL=relationship.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/item-relationships/relationship.model.js.map b/src/app/core/shared/item-relationships/relationship.model.js.map new file mode 100644 index 0000000000..e610d87740 --- /dev/null +++ b/src/app/core/shared/item-relationships/relationship.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"relationship.model.js","sourceRoot":"","sources":["relationship.model.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH;IAAA;IA6CA,CAAC;IAAD,mBAAC;AAAD,CAAC,AA7CD,IA6CC"} \ No newline at end of file diff --git a/src/app/core/shared/item.model.js b/src/app/core/shared/item.model.js new file mode 100644 index 0000000000..d085f6e120 --- /dev/null +++ b/src/app/core/shared/item.model.js @@ -0,0 +1,60 @@ +import * as tslib_1 from "tslib"; +import { map, startWith, filter, take } from 'rxjs/operators'; +import { DSpaceObject } from './dspace-object.model'; +import { hasValue, isNotEmpty, isNotUndefined } from '../../shared/empty.util'; +var Item = /** @class */ (function (_super) { + tslib_1.__extends(Item, _super); + function Item() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Item.prototype, "owner", { + get: function () { + return this.owningCollection; + }, + enumerable: true, + configurable: true + }); + /** + * Retrieves the thumbnail of this item + * @returns {Observable} the primaryBitstream of the 'THUMBNAIL' bundle + */ + Item.prototype.getThumbnail = function () { + // TODO: currently this just picks the first thumbnail + // should be adjusted when we have a way to determine + // the primary thumbnail from rest + return this.getBitstreamsByBundleName('THUMBNAIL').pipe(filter(function (thumbnails) { return isNotEmpty(thumbnails); }), map(function (thumbnails) { return thumbnails[0]; })); + }; + /** + * Retrieves the thumbnail for the given original of this item + * @returns {Observable} the primaryBitstream of the 'THUMBNAIL' bundle + */ + Item.prototype.getThumbnailForOriginal = function (original) { + return this.getBitstreamsByBundleName('THUMBNAIL').pipe(map(function (files) { + return files.find(function (thumbnail) { return thumbnail.name.startsWith(original.name); }); + }), startWith(undefined)); + }; + /** + * Retrieves all files that should be displayed on the item page of this item + * @returns {Observable>>} an array of all Bitstreams in the 'ORIGINAL' bundle + */ + Item.prototype.getFiles = function () { + return this.getBitstreamsByBundleName('ORIGINAL'); + }; + /** + * Retrieves bitstreams by bundle name + * @param bundleName The name of the Bundle that should be returned + * @returns {Observable} the bitstreams with the given bundleName + * TODO now that bitstreams can be paginated this should move to the server + * see https://github.com/DSpace/dspace-angular/issues/332 + */ + Item.prototype.getBitstreamsByBundleName = function (bundleName) { + return this.bitstreams.pipe(filter(function (rd) { return !rd.isResponsePending && isNotUndefined(rd.payload); }), map(function (rd) { return rd.payload.page; }), filter(function (bitstreams) { return hasValue(bitstreams); }), take(1), startWith([]), map(function (bitstreams) { + return bitstreams + .filter(function (bitstream) { return hasValue(bitstream); }) + .filter(function (bitstream) { return bitstream.bundleName === bundleName; }); + })); + }; + return Item; +}(DSpaceObject)); +export { Item }; +//# sourceMappingURL=item.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/item.model.js.map b/src/app/core/shared/item.model.js.map new file mode 100644 index 0000000000..3a1724abb6 --- /dev/null +++ b/src/app/core/shared/item.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item.model.js","sourceRoot":"","sources":["item.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG9D,OAAO,EAAE,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AAO,CAAC,EAAnD,CAAmD,CAAC,EACzG,GAAG,CAAC,UAAC,EAAwC,IAAK,OAAA,EAAE,CAAC,OAAO,CAAC,IAAI,EAAf,CAAe,CAAC,EAClE,MAAM,CAAC,UAAC,UAAuB,IAAK,OAAA,QAAQ,CAAC,UAAU,CAAC,EAApB,CAAoB,CAAC,EACzD,IAAI,CAAC,CAAC,CAAC,EACP,SAAS,CAAC,EAAE,CAAC,EACb,GAAG,CAAC,UAAC,UAAU;YACb,OAAO,UAAU;iBACd,MAAM,CAAC,UAAC,SAAS,IAAK,OAAA,QAAQ,CAAC,SAAS,CAAC,EAAnB,CAAmB,CAAC;iBAC1C,MAAM,CAAC,UAAC,SAAS,IAAK,OAAA,SAAS,CAAC,UAAU,KAAK,UAAU,EAAnC,CAAmC,CAAC,CAAA;QAC/D,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAEH,WAAC;AAAD,CAAC,AAlGD,CAA0B,YAAY,GAkGrC"} \ No newline at end of file diff --git a/src/app/core/shared/license.model.js b/src/app/core/shared/license.model.js new file mode 100644 index 0000000000..a5e53573a1 --- /dev/null +++ b/src/app/core/shared/license.model.js @@ -0,0 +1,11 @@ +import * as tslib_1 from "tslib"; +import { DSpaceObject } from './dspace-object.model'; +var License = /** @class */ (function (_super) { + tslib_1.__extends(License, _super); + function License() { + return _super !== null && _super.apply(this, arguments) || this; + } + return License; +}(DSpaceObject)); +export { License }; +//# sourceMappingURL=license.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/license.model.js.map b/src/app/core/shared/license.model.js.map new file mode 100644 index 0000000000..4380b59922 --- /dev/null +++ b/src/app/core/shared/license.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"license.model.js","sourceRoot":"","sources":["license.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;IAA6B,mCAAY;IAAzC;;IAWA,CAAC;IAAD,cAAC;AAAD,CAAC,AAXD,CAA6B,YAAY,GAWxC"} \ No newline at end of file diff --git a/src/app/core/shared/metadata-representation/item/item-metadata-representation.model.js b/src/app/core/shared/metadata-representation/item/item-metadata-representation.model.js new file mode 100644 index 0000000000..af54dddd24 --- /dev/null +++ b/src/app/core/shared/metadata-representation/item/item-metadata-representation.model.js @@ -0,0 +1,57 @@ +import * as tslib_1 from "tslib"; +import { Item } from '../../item.model'; +import { MetadataRepresentationType } from '../metadata-representation.model'; +import { hasValue } from '../../../../shared/empty.util'; +/** + * An object to convert item types into the metadata field it should render for the item's value + */ +export var ItemTypeToValue = { + Default: 'dc.title', + Person: 'dc.contributor.author', + OrgUnit: 'dc.title' +}; +/** + * This class determines which fields to use when rendering an Item as a metadata value. + */ +var ItemMetadataRepresentation = /** @class */ (function (_super) { + tslib_1.__extends(ItemMetadataRepresentation, _super); + function ItemMetadataRepresentation() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(ItemMetadataRepresentation.prototype, "itemType", { + /** + * The type of item this item can be represented as + */ + get: function () { + return this.firstMetadataValue('relationship.type'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ItemMetadataRepresentation.prototype, "representationType", { + /** + * Fetch the way this item should be rendered as in a list + */ + get: function () { + return MetadataRepresentationType.Item; + }, + enumerable: true, + configurable: true + }); + /** + * Get the value to display, depending on the itemType + */ + ItemMetadataRepresentation.prototype.getValue = function () { + var metadata; + if (hasValue(ItemTypeToValue[this.itemType])) { + metadata = ItemTypeToValue[this.itemType]; + } + else { + metadata = ItemTypeToValue.Default; + } + return this.firstMetadataValue(metadata); + }; + return ItemMetadataRepresentation; +}(Item)); +export { ItemMetadataRepresentation }; +//# sourceMappingURL=item-metadata-representation.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/metadata-representation/item/item-metadata-representation.model.js.map b/src/app/core/shared/metadata-representation/item/item-metadata-representation.model.js.map new file mode 100644 index 0000000000..5cb25e9aac --- /dev/null +++ b/src/app/core/shared/metadata-representation/item/item-metadata-representation.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-metadata-representation.model.js","sourceRoot":"","sources":["item-metadata-representation.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAA0B,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACtG,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG;IAC7B,OAAO,EAAE,UAAU;IACnB,MAAM,EAAE,uBAAuB;IAC/B,OAAO,EAAE,UAAU;CACpB,CAAC;AAEF;;GAEG;AACH;IAAgD,sDAAI;IAApD;;IA6BA,CAAC;IAxBC,sBAAI,gDAAQ;QAHZ;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;QACtD,CAAC;;;OAAA;IAKD,sBAAI,0DAAkB;QAHtB;;WAEG;aACH;YACE,OAAO,0BAA0B,CAAC,IAAI,CAAC;QACzC,CAAC;;;OAAA;IAED;;OAEG;IACH,6CAAQ,GAAR;QACE,IAAI,QAAQ,CAAC;QACb,IAAI,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE;YAC5C,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC3C;aAAM;YACL,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC;SACpC;QACD,OAAO,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAEH,iCAAC;AAAD,CAAC,AA7BD,CAAgD,IAAI,GA6BnD"} \ No newline at end of file diff --git a/src/app/core/shared/metadata-representation/metadata-representation.model.js b/src/app/core/shared/metadata-representation/metadata-representation.model.js new file mode 100644 index 0000000000..2e5057ddd8 --- /dev/null +++ b/src/app/core/shared/metadata-representation/metadata-representation.model.js @@ -0,0 +1,11 @@ +/** + * An Enum defining the representation type of metadata + */ +export var MetadataRepresentationType; +(function (MetadataRepresentationType) { + MetadataRepresentationType["None"] = "none"; + MetadataRepresentationType["Item"] = "item"; + MetadataRepresentationType["AuthorityControlled"] = "authority_controlled"; + MetadataRepresentationType["PlainText"] = "plain_text"; +})(MetadataRepresentationType || (MetadataRepresentationType = {})); +//# sourceMappingURL=metadata-representation.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/metadata-representation/metadata-representation.model.js.map b/src/app/core/shared/metadata-representation/metadata-representation.model.js.map new file mode 100644 index 0000000000..ea75b0fc78 --- /dev/null +++ b/src/app/core/shared/metadata-representation/metadata-representation.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata-representation.model.js","sourceRoot":"","sources":["metadata-representation.model.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,0BAKX;AALD,WAAY,0BAA0B;IACpC,2CAAa,CAAA;IACb,2CAAa,CAAA;IACb,0EAA4C,CAAA;IAC5C,sDAAwB,CAAA;AAC1B,CAAC,EALW,0BAA0B,KAA1B,0BAA0B,QAKrC"} \ No newline at end of file diff --git a/src/app/core/shared/metadata-representation/metadatum/metadatum-representation.model.js b/src/app/core/shared/metadata-representation/metadatum/metadatum-representation.model.js new file mode 100644 index 0000000000..60b14385eb --- /dev/null +++ b/src/app/core/shared/metadata-representation/metadatum/metadatum-representation.model.js @@ -0,0 +1,39 @@ +import * as tslib_1 from "tslib"; +import { MetadataRepresentationType } from '../metadata-representation.model'; +import { hasValue } from '../../../../shared/empty.util'; +import { MetadataValue } from '../../metadata.models'; +/** + * This class defines the way the metadatum it extends should be represented + */ +var MetadatumRepresentation = /** @class */ (function (_super) { + tslib_1.__extends(MetadatumRepresentation, _super); + function MetadatumRepresentation(itemType) { + var _this = _super.call(this) || this; + _this.itemType = itemType; + return _this; + } + Object.defineProperty(MetadatumRepresentation.prototype, "representationType", { + /** + * Fetch the way this metadatum should be rendered as in a list + */ + get: function () { + if (hasValue(this.authority)) { + return MetadataRepresentationType.AuthorityControlled; + } + else { + return MetadataRepresentationType.PlainText; + } + }, + enumerable: true, + configurable: true + }); + /** + * Get the value to display + */ + MetadatumRepresentation.prototype.getValue = function () { + return this.value; + }; + return MetadatumRepresentation; +}(MetadataValue)); +export { MetadatumRepresentation }; +//# sourceMappingURL=metadatum-representation.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/metadata-representation/metadatum/metadatum-representation.model.js.map b/src/app/core/shared/metadata-representation/metadatum/metadatum-representation.model.js.map new file mode 100644 index 0000000000..e8614af9cc --- /dev/null +++ b/src/app/core/shared/metadata-representation/metadatum/metadatum-representation.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadatum-representation.model.js","sourceRoot":"","sources":["metadatum-representation.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAA0B,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACtG,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;GAEG;AACH;IAA6C,mDAAa;IAOxD,iCAAY,QAAgB;QAA5B,YACE,iBAAO,SAER;QADC,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;;IAC3B,CAAC;IAKD,sBAAI,uDAAkB;QAHtB;;WAEG;aACH;YACE,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;gBAC5B,OAAO,0BAA0B,CAAC,mBAAmB,CAAC;aACvD;iBAAM;gBACL,OAAO,0BAA0B,CAAC,SAAS,CAAC;aAC7C;QACH,CAAC;;;OAAA;IAED;;OAEG;IACH,0CAAQ,GAAR;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEH,8BAAC;AAAD,CAAC,AA9BD,CAA6C,aAAa,GA8BzD"} \ No newline at end of file diff --git a/src/app/core/shared/metadata.models.js b/src/app/core/shared/metadata.models.js new file mode 100644 index 0000000000..acf11607e2 --- /dev/null +++ b/src/app/core/shared/metadata.models.js @@ -0,0 +1,98 @@ +import * as tslib_1 from "tslib"; +import * as uuidv4 from 'uuid/v4'; +import { autoserialize, Serialize, Deserialize } from 'cerialize'; +import { hasValue } from '../../shared/empty.util'; +/* tslint:disable:max-classes-per-file */ +var VIRTUAL_METADATA_PREFIX = 'virtual::'; +/** A map of metadata keys to an ordered list of MetadataValue objects. */ +var MetadataMap = /** @class */ (function () { + function MetadataMap() { + } + return MetadataMap; +}()); +export { MetadataMap }; +/** A single metadata value and its properties. */ +var MetadataValue = /** @class */ (function () { + function MetadataValue() { + /** The uuid. */ + this.uuid = uuidv4(); + } + Object.defineProperty(MetadataValue.prototype, "isVirtual", { + /** + * Returns true if this Metadatum's authority key starts with 'virtual::' + */ + get: function () { + return hasValue(this.authority) && this.authority.startsWith(VIRTUAL_METADATA_PREFIX); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MetadataValue.prototype, "virtualValue", { + /** + * If this is a virtual Metadatum, it returns everything in the authority key after 'virtual::'. + * Returns undefined otherwise. + */ + get: function () { + if (this.isVirtual) { + return this.authority.substring(this.authority.indexOf(VIRTUAL_METADATA_PREFIX) + VIRTUAL_METADATA_PREFIX.length); + } + else { + return undefined; + } + }, + enumerable: true, + configurable: true + }); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], MetadataValue.prototype, "language", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], MetadataValue.prototype, "value", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], MetadataValue.prototype, "place", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], MetadataValue.prototype, "authority", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], MetadataValue.prototype, "confidence", void 0); + return MetadataValue; +}()); +export { MetadataValue }; +var MetadatumViewModel = /** @class */ (function () { + function MetadatumViewModel() { + /** The uuid. */ + this.uuid = uuidv4(); + } + return MetadatumViewModel; +}()); +export { MetadatumViewModel }; +/** Serializer used for MetadataMaps. + * This is necessary because Cerialize has trouble instantiating the MetadataValues using their constructor + * when they are inside arrays which also represent the values in a map. + */ +export var MetadataMapSerializer = { + Serialize: function (map) { + var json = {}; + Object.keys(map).forEach(function (key) { + json[key] = Serialize(map[key], MetadataValue); + }); + return json; + }, + Deserialize: function (json) { + var metadataMap = {}; + Object.keys(json).forEach(function (key) { + metadataMap[key] = Deserialize(json[key], MetadataValue); + }); + return metadataMap; + } +}; +/* tslint:enable:max-classes-per-file */ +//# sourceMappingURL=metadata.models.js.map \ No newline at end of file diff --git a/src/app/core/shared/metadata.models.js.map b/src/app/core/shared/metadata.models.js.map new file mode 100644 index 0000000000..03fe92a3ec --- /dev/null +++ b/src/app/core/shared/metadata.models.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.models.js","sourceRoot":"","sources":["metadata.models.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,yCAAyC;AAEzC,IAAM,uBAAuB,GAAG,WAAW,CAAC;AAiB5C,0EAA0E;AAC1E;IAAA;IAEA,CAAC;IAAD,kBAAC;AAAD,CAAC,AAFD,IAEC;;AAED,kDAAkD;AAClD;IAAA;QACE,gBAAgB;QAChB,SAAI,GAAW,MAAM,EAAE,CAAC;IA2C1B,CAAC;IAfC,sBAAI,oCAAS;QAHb;;WAEG;aACH;YACE,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;QACxF,CAAC;;;OAAA;IAMD,sBAAI,uCAAY;QAJhB;;;WAGG;aACH;YACE,IAAI,IAAI,CAAC,SAAS,EAAE;gBAClB,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,uBAAuB,CAAC,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;aACnH;iBAAM;gBACL,OAAO,SAAS,CAAC;aAClB;QACH,CAAC;;;OAAA;IAtCD;QADC,aAAa;;mDACG;IAIjB;QADC,aAAa;;gDACA;IAOd;QADC,aAAa;;gDACA;IAId;QADC,aAAa;;oDACI;IAIlB;QADC,aAAa;;qDACK;IAoBrB,oBAAC;CAAA,AA7CD,IA6CC;SA7CY,aAAa;AA8D1B;IAAA;QACE,gBAAgB;QAChB,SAAI,GAAW,MAAM,EAAE,CAAC;IAsB1B,CAAC;IAAD,yBAAC;AAAD,CAAC,AAxBD,IAwBC;;AAED;;;GAGG;AACH,MAAM,CAAC,IAAM,qBAAqB,GAAG;IACnC,SAAS,EAAT,UAAU,GAAgB;QACxB,IAAM,IAAI,GAAG,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAC,GAAW;YACnC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW,EAAX,UAAY,IAAS;QACnB,IAAM,WAAW,GAAgB,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAC,GAAW;YACpC,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QACH,OAAO,WAAW,CAAC;IACrB,CAAC;CACF,CAAC;AACF,wCAAwC"} \ No newline at end of file diff --git a/src/app/core/shared/metadata.utils.js b/src/app/core/shared/metadata.utils.js new file mode 100644 index 0000000000..945870e4ab --- /dev/null +++ b/src/app/core/shared/metadata.utils.js @@ -0,0 +1,211 @@ +import { isEmpty, isNotUndefined, isUndefined } from '../../shared/empty.util'; +import { MetadataValue } from './metadata.models'; +import { groupBy, sortBy } from 'lodash'; +/** + * Utility class for working with DSpace object metadata. + * + * When specifying metadata keys, wildcards are supported, so `'*'` will match all keys, `'dc.date.*'` will + * match all qualified dc dates, and so on. Exact keys will be evaluated (and matches returned) in the order + * they are given. + * + * When multiple keys in a map match a given wildcard, they are evaluated in the order they are stored in + * the map (alphanumeric if obtained from the REST api). If duplicate or overlapping keys are specified, the + * first one takes precedence. For example, specifying `['dc.date', 'dc.*', '*']` will cause any `dc.date` + * values to be evaluated (and returned, if matched) first, followed by any other `dc` metadata values, + * followed by any other (non-dc) metadata values. + */ +var Metadata = /** @class */ (function () { + function Metadata() { + } + /** + * Gets all matching metadata in the map(s). + * + * @param {MetadataMapInterface|MetadataMapInterface[]} mapOrMaps The source map(s). When multiple maps are given, they will be + * checked in order, and only values from the first with at least one match will be returned. + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see above. + * @param {MetadataValueFilter} filter The value filter to use. If unspecified, no filtering will be done. + * @returns {MetadataValue[]} the matching values or an empty array. + */ + Metadata.all = function (mapOrMaps, keyOrKeys, filter) { + var mdMaps = mapOrMaps instanceof Array ? mapOrMaps : [mapOrMaps]; + var matches = []; + for (var _i = 0, mdMaps_1 = mdMaps; _i < mdMaps_1.length; _i++) { + var mdMap = mdMaps_1[_i]; + for (var _a = 0, _b = Metadata.resolveKeys(mdMap, keyOrKeys); _a < _b.length; _a++) { + var mdKey = _b[_a]; + var candidates = mdMap[mdKey]; + if (candidates) { + for (var _c = 0, candidates_1 = candidates; _c < candidates_1.length; _c++) { + var candidate = candidates_1[_c]; + if (Metadata.valueMatches(candidate, filter)) { + matches.push(candidate); + } + } + } + } + if (!isEmpty(matches)) { + return matches; + } + } + return matches; + }; + /** + * Like [[Metadata.all]], but only returns string values. + * + * @param {MetadataMapInterface|MetadataMapInterface[]} mapOrMaps The source map(s). When multiple maps are given, they will be + * checked in order, and only values from the first with at least one match will be returned. + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see above. + * @param {MetadataValueFilter} filter The value filter to use. If unspecified, no filtering will be done. + * @returns {string[]} the matching string values or an empty array. + */ + Metadata.allValues = function (mapOrMaps, keyOrKeys, filter) { + return Metadata.all(mapOrMaps, keyOrKeys, filter).map(function (mdValue) { return mdValue.value; }); + }; + /** + * Gets the first matching MetadataValue object in the map(s), or `undefined`. + * + * @param {MetadataMapInterface|MetadataMapInterface[]} mapOrMaps The source map(s). + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see above. + * @param {MetadataValueFilter} filter The value filter to use. If unspecified, no filtering will be done. + * @returns {MetadataValue} the first matching value, or `undefined`. + */ + Metadata.first = function (mdMapOrMaps, keyOrKeys, filter) { + var mdMaps = mdMapOrMaps instanceof Array ? mdMapOrMaps : [mdMapOrMaps]; + for (var _i = 0, mdMaps_2 = mdMaps; _i < mdMaps_2.length; _i++) { + var mdMap = mdMaps_2[_i]; + for (var _a = 0, _b = Metadata.resolveKeys(mdMap, keyOrKeys); _a < _b.length; _a++) { + var key = _b[_a]; + var values = mdMap[key]; + if (values) { + return values.find(function (value) { return Metadata.valueMatches(value, filter); }); + } + } + } + }; + /** + * Like [[Metadata.first]], but only returns a string value, or `undefined`. + * + * @param {MetadataMapInterface|MetadataMapInterface[]} mapOrMaps The source map(s). + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see above. + * @param {MetadataValueFilter} filter The value filter to use. If unspecified, no filtering will be done. + * @returns {string} the first matching string value, or `undefined`. + */ + Metadata.firstValue = function (mdMapOrMaps, keyOrKeys, filter) { + var value = Metadata.first(mdMapOrMaps, keyOrKeys, filter); + return isUndefined(value) ? undefined : value.value; + }; + /** + * Checks for a matching metadata value in the given map(s). + * + * @param {MetadataMapInterface|MetadataMapInterface[]} mapOrMaps The source map(s). + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see above. + * @param {MetadataValueFilter} filter The value filter to use. If unspecified, no filtering will be done. + * @returns {boolean} whether a match is found. + */ + Metadata.has = function (mdMapOrMaps, keyOrKeys, filter) { + return isNotUndefined(Metadata.first(mdMapOrMaps, keyOrKeys, filter)); + }; + /** + * Checks if a value matches a filter. + * + * @param {MetadataValue} mdValue the value to check. + * @param {MetadataValueFilter} filter the filter to use. + * @returns {boolean} whether the filter matches, or true if no filter is given. + */ + Metadata.valueMatches = function (mdValue, filter) { + if (!filter) { + return true; + } + else if (filter.language && filter.language !== mdValue.language) { + return false; + } + else if (filter.value) { + var fValue = filter.value; + var mValue = mdValue.value; + if (filter.ignoreCase) { + fValue = filter.value.toLowerCase(); + mValue = mdValue.value.toLowerCase(); + } + if (filter.substring) { + return mValue.includes(fValue); + } + else { + return mValue === fValue; + } + } + return true; + }; + /** + * Gets the list of keys in the map limited by, and in the order given by `keyOrKeys`. + * + * @param {MetadataMapInterface} mdMap The source map. + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see above. + */ + Metadata.resolveKeys = function (mdMap, keyOrKeys) { + if (mdMap === void 0) { mdMap = {}; } + var inputKeys = keyOrKeys instanceof Array ? keyOrKeys : [keyOrKeys]; + var outputKeys = []; + for (var _i = 0, inputKeys_1 = inputKeys; _i < inputKeys_1.length; _i++) { + var inputKey = inputKeys_1[_i]; + if (inputKey.includes('*')) { + var inputKeyRegex = new RegExp('^' + inputKey.replace('.', '\.').replace('*', '.*') + '$'); + for (var _a = 0, _b = Object.keys(mdMap); _a < _b.length; _a++) { + var mapKey = _b[_a]; + if (!outputKeys.includes(mapKey) && inputKeyRegex.test(mapKey)) { + outputKeys.push(mapKey); + } + } + } + else if (mdMap.hasOwnProperty(inputKey) && !outputKeys.includes(inputKey)) { + outputKeys.push(inputKey); + } + } + return outputKeys; + }; + /** + * Creates an array of MetadatumViewModels from an existing MetadataMapInterface. + * + * @param {MetadataMapInterface} mdMap The source map. + * @returns {MetadatumViewModel[]} List of metadata view models based on the source map. + */ + Metadata.toViewModelList = function (mdMap) { + var metadatumList = []; + Object.keys(mdMap) + .sort() + .forEach(function (key) { + var fields = mdMap[key].map(function (metadataValue, index) { + return Object.assign({}, metadataValue, { + order: index, + key: key + }); + }); + metadatumList = metadatumList.concat(fields); + }); + return metadatumList; + }; + /** + * Creates an MetadataMapInterface from an existing array of MetadatumViewModels. + * + * @param {MetadatumViewModel[]} viewModelList The source list. + * @returns {MetadataMapInterface} Map with metadata values based on the source list. + */ + Metadata.toMetadataMap = function (viewModelList) { + var metadataMap = {}; + var groupedList = groupBy(viewModelList, function (viewModel) { return viewModel.key; }); + Object.keys(groupedList) + .sort() + .forEach(function (key) { + var orderedValues = sortBy(groupedList[key], ['order']); + metadataMap[key] = orderedValues.map(function (value) { + var val = Object.assign(new MetadataValue(), value); + delete val.order; + delete val.key; + return val; + }); + }); + return metadataMap; + }; + return Metadata; +}()); +export { Metadata }; +//# sourceMappingURL=metadata.utils.js.map \ No newline at end of file diff --git a/src/app/core/shared/metadata.utils.js.map b/src/app/core/shared/metadata.utils.js.map new file mode 100644 index 0000000000..3348b42336 --- /dev/null +++ b/src/app/core/shared/metadata.utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.utils.js","sourceRoot":"","sources":["metadata.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAEL,aAAa,EAGd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEzC;;;;;;;;;;;;GAYG;AACH;IAAA;IAmMA,CAAC;IAjMC;;;;;;;;OAQG;IACW,YAAG,GAAjB,UAAkB,SAAwD,EAAE,SAA4B,EACtF,MAA4B;QAC5C,IAAM,MAAM,GAA2B,SAAS,YAAY,KAAK,CAAC,CAA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AAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;gBACtD,OAAQ,GAAW,CAAC,KAAK,CAAC;gBAC1B,OAAQ,GAAW,CAAC,GAAG,CAAC;gBACxB,OAAO,GAAG,CAAC;YACb,CAAC,CACF,CAAA;QACH,CAAC,CAAC,CAAC;QACL,OAAO,WAAW,CAAC;IACrB,CAAC;IACH,eAAC;AAAD,CAAC,AAnMD,IAmMC"} \ No newline at end of file diff --git a/src/app/core/shared/operators.js b/src/app/core/shared/operators.js new file mode 100644 index 0000000000..dba1ece736 --- /dev/null +++ b/src/app/core/shared/operators.js @@ -0,0 +1,105 @@ +import { filter, find, flatMap, map, tap } from 'rxjs/operators'; +import { hasValue, hasValueOperator, isNotEmpty } from '../../shared/empty.util'; +/** + * This file contains custom RxJS operators that can be used in multiple places + */ +export var getRequestFromRequestHref = function (requestService) { + return function (source) { + return source.pipe(flatMap(function (href) { return requestService.getByHref(href); }), hasValueOperator()); + }; +}; +export var getRequestFromRequestUUID = function (requestService) { + return function (source) { + return source.pipe(flatMap(function (uuid) { return requestService.getByUUID(uuid); }), hasValueOperator()); + }; +}; +export var filterSuccessfulResponses = function () { + return function (source) { + return source.pipe(getResponseFromEntry(), filter(function (response) { return response.isSuccessful === true; })); + }; +}; +export var getResponseFromEntry = function () { + return function (source) { + return source.pipe(filter(function (entry) { return hasValue(entry) && hasValue(entry.response); }), map(function (entry) { return entry.response; })); + }; +}; +export var getResourceLinksFromResponse = function () { + return function (source) { + return source.pipe(filterSuccessfulResponses(), map(function (response) { return response.resourceSelfLinks; })); + }; +}; +export var configureRequest = function (requestService, forceBypassCache) { + return function (source) { + return source.pipe(tap(function (request) { return requestService.configure(request, forceBypassCache); })); + }; +}; +export var getRemoteDataPayload = function () { + return function (source) { + return source.pipe(map(function (remoteData) { return remoteData.payload; })); + }; +}; +export var getSucceededRemoteData = function () { + return function (source) { + return source.pipe(find(function (rd) { return rd.hasSucceeded; })); + }; +}; +/** + * Operator that checks if a remote data object contains a page not found error + * When it does contain such an error, it will redirect the user to a page not found, without altering the current URL + * @param router The router used to navigate to a new page + */ +export var redirectToPageNotFoundOn404 = function (router) { + return function (source) { + return source.pipe(tap(function (rd) { + if (rd.hasFailed && rd.error.statusCode === 404) { + router.navigateByUrl('/404', { skipLocationChange: true }); + } + })); + }; +}; +export var getFinishedRemoteData = function () { + return function (source) { + return source.pipe(find(function (rd) { return !rd.isLoading; })); + }; +}; +export var getAllSucceededRemoteData = function () { + return function (source) { + return source.pipe(filter(function (rd) { return rd.hasSucceeded; })); + }; +}; +export var toDSpaceObjectListRD = function () { + return function (source) { + return source.pipe(filter(function (rd) { return rd.hasSucceeded; }), map(function (rd) { + var dsoPage = rd.payload.page.map(function (searchResult) { return searchResult.indexableObject; }); + var payload = Object.assign(rd.payload, { page: dsoPage }); + return Object.assign(rd, { payload: payload }); + })); + }; +}; +/** + * Get the browse links from a definition by ID given an array of all definitions + * @param {string} definitionID + * @returns {(source: Observable>) => Observable} + */ +export var getBrowseDefinitionLinks = function (definitionID) { + return function (source) { + return source.pipe(getRemoteDataPayload(), map(function (browseDefinitions) { return browseDefinitions + .find(function (def) { return def.id === definitionID; }); }), map(function (def) { + if (isNotEmpty(def)) { + return def._links; + } + else { + throw new Error("No metadata browse definition could be found for id '" + definitionID + "'"); + } + })); + }; +}; +/** + * Get the first occurrence of an object within a paginated list + */ +export var getFirstOccurrence = function () { + return function (source) { + return source.pipe(map(function (rd) { return Object.assign(rd, { payload: rd.payload.page.length > 0 ? rd.payload.page[0] : undefined }); })); + }; +}; +//# sourceMappingURL=operators.js.map \ No newline at end of file diff --git a/src/app/core/shared/operators.js.map b/src/app/core/shared/operators.js.map new file mode 100644 index 0000000000..dfb16c246f --- /dev/null +++ b/src/app/core/shared/operators.js.map @@ -0,0 +1 @@ +{"version":3,"file":"operators.js","sourceRoot":"","sources":["operators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE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,UAAC,YAAoB;IAC3D,OAAA,UAAC,MAAkD;QACjD,OAAA,MAAM,CAAC,IAAI,CACT,oBAAoB,EAAE,EACtB,GAAG,CAAC,UAAC,iBAAqC,IAAK,OAAA,iBAAiB;aAC7D,IAAI,CAAC,UAAC,GAAqB,IAAK,OAAA,GAAG,CAAC,EAAE,KAAK,YAAY,EAAvB,CAAuB,CAAC,EADZ,CACY,CAC1D,EACD,GAAG,CAAC,UAAC,GAAqB;YACxB,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE;gBACnB,OAAO,GAAG,CAAC,MAAM,CAAC;aACnB;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,0DAAwD,YAAY,MAAG,CAAC,CAAC;aAC1F;QACH,CAAC,CAAC,CACH;IAZD,CAYC;AAbH,CAaG,CAAC;AAEN;;GAEG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAG;IAChC,OAAA,UAAyB,MAAgD;QACvE,OAAA,MAAM,CAAC,IAAI,CACT,GAAG,CAAC,UAAC,EAAE,IAAK,OAAA,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,EAA3F,CAA2F,CAAC,CACzG;IAFD,CAEC;AAHH,CAGG,CAAC"} \ No newline at end of file diff --git a/src/app/core/shared/page-info.model.js b/src/app/core/shared/page-info.model.js new file mode 100644 index 0000000000..af6158995b --- /dev/null +++ b/src/app/core/shared/page-info.model.js @@ -0,0 +1,48 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs } from 'cerialize'; +/** + * Represents the state of a paginated response + */ +var PageInfo = /** @class */ (function () { + function PageInfo() { + } + tslib_1.__decorate([ + autoserializeAs(Number, 'size'), + tslib_1.__metadata("design:type", Number) + ], PageInfo.prototype, "elementsPerPage", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], PageInfo.prototype, "totalElements", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Number) + ], PageInfo.prototype, "totalPages", void 0); + tslib_1.__decorate([ + autoserializeAs(Number, 'number'), + tslib_1.__metadata("design:type", Number) + ], PageInfo.prototype, "currentPage", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], PageInfo.prototype, "last", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], PageInfo.prototype, "next", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], PageInfo.prototype, "prev", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], PageInfo.prototype, "first", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], PageInfo.prototype, "self", void 0); + return PageInfo; +}()); +export { PageInfo }; +//# sourceMappingURL=page-info.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/page-info.model.js.map b/src/app/core/shared/page-info.model.js.map new file mode 100644 index 0000000000..53aca86049 --- /dev/null +++ b/src/app/core/shared/page-info.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"page-info.model.js","sourceRoot":"","sources":["page-info.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE3D;;GAEG;AACH;IAAA;IAuCA,CAAC;IAlCC;QADC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC;;qDACR;IAMxB;QADC,aAAa;;mDACQ;IAMtB;QADC,aAAa;;gDACK;IAMnB;QADC,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC;;iDACd;IAGpB;QADC,aAAa;;0CACD;IAGb;QADC,aAAa;;0CACD;IAGb;QADC,aAAa;;0CACD;IAGb;QADC,aAAa;;2CACA;IAGd;QADC,aAAa;;0CACD;IACf,eAAC;CAAA,AAvCD,IAuCC;SAvCY,QAAQ"} \ No newline at end of file diff --git a/src/app/core/shared/resource-policy.model.js b/src/app/core/shared/resource-policy.model.js new file mode 100644 index 0000000000..8e896c4d7b --- /dev/null +++ b/src/app/core/shared/resource-policy.model.js @@ -0,0 +1,10 @@ +/** + * Model class for a Resource Policy + */ +var ResourcePolicy = /** @class */ (function () { + function ResourcePolicy() { + } + return ResourcePolicy; +}()); +export { ResourcePolicy }; +//# sourceMappingURL=resource-policy.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/resource-policy.model.js.map b/src/app/core/shared/resource-policy.model.js.map new file mode 100644 index 0000000000..1831562283 --- /dev/null +++ b/src/app/core/shared/resource-policy.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"resource-policy.model.js","sourceRoot":"","sources":["resource-policy.model.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH;IAAA;IA+BA,CAAC;IAAD,qBAAC;AAAD,CAAC,AA/BD,IA+BC"} \ No newline at end of file diff --git a/src/app/core/shared/resource-type.js b/src/app/core/shared/resource-type.js new file mode 100644 index 0000000000..2eba7cecb6 --- /dev/null +++ b/src/app/core/shared/resource-type.js @@ -0,0 +1,30 @@ +export var ResourceType; +(function (ResourceType) { + ResourceType["DSpaceObject"] = "dspaceobject"; + ResourceType["Bundle"] = "bundle"; + ResourceType["Bitstream"] = "bitstream"; + ResourceType["BitstreamFormat"] = "bitstreamformat"; + ResourceType["Item"] = "item"; + ResourceType["Collection"] = "collection"; + ResourceType["Community"] = "community"; + ResourceType["EPerson"] = "eperson"; + ResourceType["Group"] = "group"; + ResourceType["ResourcePolicy"] = "resourcePolicy"; + ResourceType["MetadataSchema"] = "metadataschema"; + ResourceType["MetadataField"] = "metadatafield"; + ResourceType["Relationship"] = "relationship"; + ResourceType["RelationshipType"] = "relationshiptype"; + ResourceType["ItemType"] = "entitytype"; + ResourceType["License"] = "license"; + ResourceType["Workflowitem"] = "workflowitem"; + ResourceType["Workspaceitem"] = "workspaceitem"; + ResourceType["SubmissionDefinitions"] = "submissiondefinitions"; + ResourceType["SubmissionDefinition"] = "submissiondefinition"; + ResourceType["SubmissionForm"] = "submissionform"; + ResourceType["SubmissionForms"] = "submissionforms"; + ResourceType["SubmissionSections"] = "submissionsections"; + ResourceType["SubmissionSection"] = "submissionsection"; + ResourceType["ClaimedTask"] = "claimedtask"; + ResourceType["PoolTask"] = "pooltask"; +})(ResourceType || (ResourceType = {})); +//# sourceMappingURL=resource-type.js.map \ No newline at end of file diff --git a/src/app/core/shared/resource-type.js.map b/src/app/core/shared/resource-type.js.map new file mode 100644 index 0000000000..22474f21ea --- /dev/null +++ b/src/app/core/shared/resource-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"resource-type.js","sourceRoot":"","sources":["resource-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YA2BX;AA3BD,WAAY,YAAY;IACtB,6CAA6B,CAAA;IAC7B,iCAAiB,CAAA;IACjB,uCAAuB,CAAA;IACvB,mDAAmC,CAAA;IACnC,6BAAa,CAAA;IACb,yCAAyB,CAAA;IACzB,uCAAuB,CAAA;IACvB,mCAAmB,CAAA;IACnB,+BAAe,CAAA;IACf,iDAAiC,CAAA;IACjC,iDAAiC,CAAA;IACjC,+CAA+B,CAAA;IAC/B,6CAA6B,CAAA;IAC7B,qDAAqC,CAAA;IACrC,uCAAuB,CAAA;IACvB,mCAAmB,CAAA;IACnB,6CAA6B,CAAA;IAC7B,+CAA+B,CAAA;IAC/B,+DAA+C,CAAA;IAC/C,6DAA6C,CAAA;IAC7C,iDAAiC,CAAA;IACjC,mDAAmC,CAAA;IACnC,yDAAyC,CAAA;IACzC,uDAAuC,CAAA;IACvC,2CAA2B,CAAA;IAC3B,qCAAqB,CAAA;AACvB,CAAC,EA3BW,YAAY,KAAZ,YAAY,QA2BvB"} \ No newline at end of file diff --git a/src/app/core/shared/sort-option.model.js b/src/app/core/shared/sort-option.model.js new file mode 100644 index 0000000000..28fd01f333 --- /dev/null +++ b/src/app/core/shared/sort-option.model.js @@ -0,0 +1,17 @@ +import * as tslib_1 from "tslib"; +import { autoserialize } from 'cerialize'; +var SortOption = /** @class */ (function () { + function SortOption() { + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SortOption.prototype, "name", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], SortOption.prototype, "metadata", void 0); + return SortOption; +}()); +export { SortOption }; +//# sourceMappingURL=sort-option.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/sort-option.model.js.map b/src/app/core/shared/sort-option.model.js.map new file mode 100644 index 0000000000..9cc1c2ab26 --- /dev/null +++ b/src/app/core/shared/sort-option.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sort-option.model.js","sourceRoot":"","sources":["sort-option.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;IAAA;IAMA,CAAC;IAJC;QADC,aAAa;;4CACD;IAGb;QADC,aAAa;;gDACG;IACnB,iBAAC;CAAA,AAND,IAMC;SANY,UAAU"} \ No newline at end of file diff --git a/src/app/core/shared/submit-data-response-definition.model.js b/src/app/core/shared/submit-data-response-definition.model.js new file mode 100644 index 0000000000..2b7715c9be --- /dev/null +++ b/src/app/core/shared/submit-data-response-definition.model.js @@ -0,0 +1 @@ +//# sourceMappingURL=submit-data-response-definition.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/submit-data-response-definition.model.js.map b/src/app/core/shared/submit-data-response-definition.model.js.map new file mode 100644 index 0000000000..3f64e805e5 --- /dev/null +++ b/src/app/core/shared/submit-data-response-definition.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submit-data-response-definition.model.js","sourceRoot":"","sources":["submit-data-response-definition.model.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/core/shared/uuid.service.js b/src/app/core/shared/uuid.service.js new file mode 100644 index 0000000000..0d22b513a8 --- /dev/null +++ b/src/app/core/shared/uuid.service.js @@ -0,0 +1,16 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import * as uuidv4 from 'uuid/v4'; +var UUIDService = /** @class */ (function () { + function UUIDService() { + } + UUIDService.prototype.generate = function () { + return uuidv4(); + }; + UUIDService = tslib_1.__decorate([ + Injectable() + ], UUIDService); + return UUIDService; +}()); +export { UUIDService }; +//# sourceMappingURL=uuid.service.js.map \ No newline at end of file diff --git a/src/app/core/shared/uuid.service.js.map b/src/app/core/shared/uuid.service.js.map new file mode 100644 index 0000000000..d82c081412 --- /dev/null +++ b/src/app/core/shared/uuid.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uuid.service.js","sourceRoot":"","sources":["uuid.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAGlC;IAAA;IAIA,CAAC;IAHC,8BAAQ,GAAR;QACE,OAAO,MAAM,EAAE,CAAC;IAClB,CAAC;IAHU,WAAW;QADvB,UAAU,EAAE;OACA,WAAW,CAIvB;IAAD,kBAAC;CAAA,AAJD,IAIC;SAJY,WAAW"} \ No newline at end of file diff --git a/src/app/core/shared/view-mode.model.js b/src/app/core/shared/view-mode.model.js new file mode 100644 index 0000000000..c56238b365 --- /dev/null +++ b/src/app/core/shared/view-mode.model.js @@ -0,0 +1,10 @@ +/** + * This enumeration represents all possible ways of representing a group of objects in the UI + */ +export var ViewMode; +(function (ViewMode) { + ViewMode["List"] = "list"; + ViewMode["Grid"] = "grid"; + ViewMode["Detail"] = "detail"; +})(ViewMode || (ViewMode = {})); +//# sourceMappingURL=view-mode.model.js.map \ No newline at end of file diff --git a/src/app/core/shared/view-mode.model.js.map b/src/app/core/shared/view-mode.model.js.map new file mode 100644 index 0000000000..180e03558a --- /dev/null +++ b/src/app/core/shared/view-mode.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view-mode.model.js","sourceRoot":"","sources":["view-mode.model.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,6BAAiB,CAAA;AACnB,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB"} \ No newline at end of file diff --git a/src/app/core/submission/models/normalized-submission-object.model.js b/src/app/core/submission/models/normalized-submission-object.model.js new file mode 100644 index 0000000000..a30fd59c35 --- /dev/null +++ b/src/app/core/submission/models/normalized-submission-object.model.js @@ -0,0 +1,39 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize'; +import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model'; +import { WorkspaceitemSectionsObject } from './workspaceitem-sections.model'; +/** + * An abstract model class for a NormalizedSubmissionObject. + */ +var NormalizedSubmissionObject = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedSubmissionObject, _super); + function NormalizedSubmissionObject() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedSubmissionObject.prototype, "id", void 0); + tslib_1.__decorate([ + autoserializeAs(String, 'id'), + tslib_1.__metadata("design:type", String) + ], NormalizedSubmissionObject.prototype, "uuid", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Date) + ], NormalizedSubmissionObject.prototype, "lastModified", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", WorkspaceitemSectionsObject) + ], NormalizedSubmissionObject.prototype, "sections", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Array) + ], NormalizedSubmissionObject.prototype, "errors", void 0); + NormalizedSubmissionObject = tslib_1.__decorate([ + inheritSerialization(NormalizedDSpaceObject) + ], NormalizedSubmissionObject); + return NormalizedSubmissionObject; +}(NormalizedDSpaceObject)); +export { NormalizedSubmissionObject }; +//# sourceMappingURL=normalized-submission-object.model.js.map \ No newline at end of file diff --git a/src/app/core/submission/models/normalized-submission-object.model.js.map b/src/app/core/submission/models/normalized-submission-object.model.js.map new file mode 100644 index 0000000000..9a3e3bc65d --- /dev/null +++ b/src/app/core/submission/models/normalized-submission-object.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-submission-object.model.js","sourceRoot":"","sources":["normalized-submission-object.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAI7E;;GAEG;AAEH;IAAwE,sDAAyB;IAAjG;;IA+BA,CAAC;IAzBC;QADC,aAAa;;0DACH;IAMX;QADC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC;;4DACjB;IAMb;QADC,aAAa;0CACA,IAAI;oEAAC;IAMnB;QADC,aAAa;0CACJ,2BAA2B;gEAAC;IAMtC;QADC,aAAa;;8DACkB;IA9BrB,0BAA0B;QADtC,oBAAoB,CAAC,sBAAsB,CAAC;OAChC,0BAA0B,CA+BtC;IAAD,iCAAC;CAAA,AA/BD,CAAwE,sBAAsB,GA+B7F;SA/BY,0BAA0B"} \ No newline at end of file diff --git a/src/app/core/submission/models/normalized-workflowitem.model.js b/src/app/core/submission/models/normalized-workflowitem.model.js new file mode 100644 index 0000000000..f75d0d41df --- /dev/null +++ b/src/app/core/submission/models/normalized-workflowitem.model.js @@ -0,0 +1,42 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, inheritSerialization } from 'cerialize'; +import { mapsTo, relationship } from '../../cache/builders/build-decorators'; +import { Workflowitem } from './workflowitem.model'; +import { NormalizedSubmissionObject } from './normalized-submission-object.model'; +import { ResourceType } from '../../shared/resource-type'; +/** + * An model class for a NormalizedWorkflowItem. + */ +var NormalizedWorkflowItem = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedWorkflowItem, _super); + function NormalizedWorkflowItem() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.Collection, false), + tslib_1.__metadata("design:type", String) + ], NormalizedWorkflowItem.prototype, "collection", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.Item, false), + tslib_1.__metadata("design:type", String) + ], NormalizedWorkflowItem.prototype, "item", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.SubmissionDefinition, false), + tslib_1.__metadata("design:type", String) + ], NormalizedWorkflowItem.prototype, "submissionDefinition", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.EPerson, false), + tslib_1.__metadata("design:type", String) + ], NormalizedWorkflowItem.prototype, "submitter", void 0); + NormalizedWorkflowItem = tslib_1.__decorate([ + mapsTo(Workflowitem), + inheritSerialization(NormalizedSubmissionObject) + ], NormalizedWorkflowItem); + return NormalizedWorkflowItem; +}(NormalizedSubmissionObject)); +export { NormalizedWorkflowItem }; +//# sourceMappingURL=normalized-workflowitem.model.js.map \ No newline at end of file diff --git a/src/app/core/submission/models/normalized-workflowitem.model.js.map b/src/app/core/submission/models/normalized-workflowitem.model.js.map new file mode 100644 index 0000000000..712c22d6f7 --- /dev/null +++ b/src/app/core/submission/models/normalized-workflowitem.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-workflowitem.model.js","sourceRoot":"","sources":["normalized-workflowitem.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AAGH;IAA4C,kDAAwC;IAApF;;IA8BA,CAAC;IAvBC;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC;;8DAC1B;IAOnB;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC;;wDAC1B;IAOb;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,oBAAoB,EAAE,KAAK,CAAC;;wEAC1B;IAO7B;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;;6DACxB;IA5BP,sBAAsB;QAFlC,MAAM,CAAC,YAAY,CAAC;QACpB,oBAAoB,CAAC,0BAA0B,CAAC;OACpC,sBAAsB,CA8BlC;IAAD,6BAAC;CAAA,AA9BD,CAA4C,0BAA0B,GA8BrE;SA9BY,sBAAsB"} \ No newline at end of file diff --git a/src/app/core/submission/models/normalized-workspaceitem.model.js b/src/app/core/submission/models/normalized-workspaceitem.model.js new file mode 100644 index 0000000000..99e722ea6b --- /dev/null +++ b/src/app/core/submission/models/normalized-workspaceitem.model.js @@ -0,0 +1,44 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, inheritSerialization } from 'cerialize'; +import { Workspaceitem } from './workspaceitem.model'; +import { NormalizedSubmissionObject } from './normalized-submission-object.model'; +import { mapsTo, relationship } from '../../cache/builders/build-decorators'; +import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model'; +import { ResourceType } from '../../shared/resource-type'; +/** + * An model class for a NormalizedWorkspaceItem. + */ +var NormalizedWorkspaceItem = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedWorkspaceItem, _super); + function NormalizedWorkspaceItem() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.Collection, false), + tslib_1.__metadata("design:type", String) + ], NormalizedWorkspaceItem.prototype, "collection", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.Item, false), + tslib_1.__metadata("design:type", String) + ], NormalizedWorkspaceItem.prototype, "item", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.SubmissionDefinition, false), + tslib_1.__metadata("design:type", String) + ], NormalizedWorkspaceItem.prototype, "submissionDefinition", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.EPerson, false), + tslib_1.__metadata("design:type", String) + ], NormalizedWorkspaceItem.prototype, "submitter", void 0); + NormalizedWorkspaceItem = tslib_1.__decorate([ + mapsTo(Workspaceitem), + inheritSerialization(NormalizedDSpaceObject), + inheritSerialization(NormalizedSubmissionObject) + ], NormalizedWorkspaceItem); + return NormalizedWorkspaceItem; +}(NormalizedSubmissionObject)); +export { NormalizedWorkspaceItem }; +//# sourceMappingURL=normalized-workspaceitem.model.js.map \ No newline at end of file diff --git a/src/app/core/submission/models/normalized-workspaceitem.model.js.map b/src/app/core/submission/models/normalized-workspaceitem.model.js.map new file mode 100644 index 0000000000..259e7691cf --- /dev/null +++ b/src/app/core/submission/models/normalized-workspaceitem.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-workspaceitem.model.js","sourceRoot":"","sources":["normalized-workspaceitem.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D;;GAEG;AAIH;IAA6C,mDAAwC;IAArF;;IA6BA,CAAC;IAtBC;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC;;+DAC1B;IAOnB;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC;;yDAC1B;IAOb;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,oBAAoB,EAAE,KAAK,CAAC;;yEAC1B;IAO7B;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;;8DACxB;IA5BP,uBAAuB;QAHnC,MAAM,CAAC,aAAa,CAAC;QACrB,oBAAoB,CAAC,sBAAsB,CAAC;QAC5C,oBAAoB,CAAC,0BAA0B,CAAC;OACpC,uBAAuB,CA6BnC;IAAD,8BAAC;CAAA,AA7BD,CAA6C,0BAA0B,GA6BtE;SA7BY,uBAAuB"} \ No newline at end of file diff --git a/src/app/core/submission/models/submission-object.model.js b/src/app/core/submission/models/submission-object.model.js new file mode 100644 index 0000000000..e1e60c5a14 --- /dev/null +++ b/src/app/core/submission/models/submission-object.model.js @@ -0,0 +1,14 @@ +import * as tslib_1 from "tslib"; +import { DSpaceObject } from '../../shared/dspace-object.model'; +/** + * An abstract model class for a SubmissionObject. + */ +var SubmissionObject = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionObject, _super); + function SubmissionObject() { + return _super !== null && _super.apply(this, arguments) || this; + } + return SubmissionObject; +}(DSpaceObject)); +export { SubmissionObject }; +//# sourceMappingURL=submission-object.model.js.map \ No newline at end of file diff --git a/src/app/core/submission/models/submission-object.model.js.map b/src/app/core/submission/models/submission-object.model.js.map new file mode 100644 index 0000000000..39f97f5d7a --- /dev/null +++ b/src/app/core/submission/models/submission-object.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-object.model.js","sourceRoot":"","sources":["submission-object.model.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAahE;;GAEG;AACH;IAA+C,4CAAY;IAA3D;;IA8CA,CAAC;IAAD,uBAAC;AAAD,CAAC,AA9CD,CAA+C,YAAY,GA8C1D"} \ No newline at end of file diff --git a/src/app/core/submission/models/submission-upload-file-access-condition.model.js b/src/app/core/submission/models/submission-upload-file-access-condition.model.js new file mode 100644 index 0000000000..d466644be2 --- /dev/null +++ b/src/app/core/submission/models/submission-upload-file-access-condition.model.js @@ -0,0 +1,10 @@ +/** + * An interface to represent bitstream's access condition. + */ +var SubmissionUploadFileAccessConditionObject = /** @class */ (function () { + function SubmissionUploadFileAccessConditionObject() { + } + return SubmissionUploadFileAccessConditionObject; +}()); +export { SubmissionUploadFileAccessConditionObject }; +//# sourceMappingURL=submission-upload-file-access-condition.model.js.map \ No newline at end of file diff --git a/src/app/core/submission/models/submission-upload-file-access-condition.model.js.map b/src/app/core/submission/models/submission-upload-file-access-condition.model.js.map new file mode 100644 index 0000000000..a0e0032701 --- /dev/null +++ b/src/app/core/submission/models/submission-upload-file-access-condition.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-upload-file-access-condition.model.js","sourceRoot":"","sources":["submission-upload-file-access-condition.model.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;IAAA;IA0BA,CAAC;IAAD,gDAAC;AAAD,CAAC,AA1BD,IA0BC"} \ No newline at end of file diff --git a/src/app/core/submission/models/workflowitem.model.js b/src/app/core/submission/models/workflowitem.model.js new file mode 100644 index 0000000000..2ddb44ad60 --- /dev/null +++ b/src/app/core/submission/models/workflowitem.model.js @@ -0,0 +1,14 @@ +import * as tslib_1 from "tslib"; +import { Workspaceitem } from './workspaceitem.model'; +/** + * A model class for a Workflowitem. + */ +var Workflowitem = /** @class */ (function (_super) { + tslib_1.__extends(Workflowitem, _super); + function Workflowitem() { + return _super !== null && _super.apply(this, arguments) || this; + } + return Workflowitem; +}(Workspaceitem)); +export { Workflowitem }; +//# sourceMappingURL=workflowitem.model.js.map \ No newline at end of file diff --git a/src/app/core/submission/models/workflowitem.model.js.map b/src/app/core/submission/models/workflowitem.model.js.map new file mode 100644 index 0000000000..5105f5650d --- /dev/null +++ b/src/app/core/submission/models/workflowitem.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workflowitem.model.js","sourceRoot":"","sources":["workflowitem.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;GAEG;AACH;IAAkC,wCAAa;IAA/C;;IACA,CAAC;IAAD,mBAAC;AAAD,CAAC,AADD,CAAkC,aAAa,GAC9C"} \ No newline at end of file diff --git a/src/app/core/submission/models/workspaceitem-section-form.model.js b/src/app/core/submission/models/workspaceitem-section-form.model.js new file mode 100644 index 0000000000..8a73a48ef8 --- /dev/null +++ b/src/app/core/submission/models/workspaceitem-section-form.model.js @@ -0,0 +1 @@ +//# sourceMappingURL=workspaceitem-section-form.model.js.map \ No newline at end of file diff --git a/src/app/core/submission/models/workspaceitem-section-form.model.js.map b/src/app/core/submission/models/workspaceitem-section-form.model.js.map new file mode 100644 index 0000000000..823e525b8b --- /dev/null +++ b/src/app/core/submission/models/workspaceitem-section-form.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitem-section-form.model.js","sourceRoot":"","sources":["workspaceitem-section-form.model.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/core/submission/models/workspaceitem-section-license.model.js b/src/app/core/submission/models/workspaceitem-section-license.model.js new file mode 100644 index 0000000000..6e69b8cb5c --- /dev/null +++ b/src/app/core/submission/models/workspaceitem-section-license.model.js @@ -0,0 +1 @@ +//# sourceMappingURL=workspaceitem-section-license.model.js.map \ No newline at end of file diff --git a/src/app/core/submission/models/workspaceitem-section-license.model.js.map b/src/app/core/submission/models/workspaceitem-section-license.model.js.map new file mode 100644 index 0000000000..922351e245 --- /dev/null +++ b/src/app/core/submission/models/workspaceitem-section-license.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitem-section-license.model.js","sourceRoot":"","sources":["workspaceitem-section-license.model.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/core/submission/models/workspaceitem-section-upload-file.model.js b/src/app/core/submission/models/workspaceitem-section-upload-file.model.js new file mode 100644 index 0000000000..97d5062f8a --- /dev/null +++ b/src/app/core/submission/models/workspaceitem-section-upload-file.model.js @@ -0,0 +1,10 @@ +/** + * An interface to represent submission's upload section file entry. + */ +var WorkspaceitemSectionUploadFileObject = /** @class */ (function () { + function WorkspaceitemSectionUploadFileObject() { + } + return WorkspaceitemSectionUploadFileObject; +}()); +export { WorkspaceitemSectionUploadFileObject }; +//# sourceMappingURL=workspaceitem-section-upload-file.model.js.map \ No newline at end of file diff --git a/src/app/core/submission/models/workspaceitem-section-upload-file.model.js.map b/src/app/core/submission/models/workspaceitem-section-upload-file.model.js.map new file mode 100644 index 0000000000..6f0c01bc80 --- /dev/null +++ b/src/app/core/submission/models/workspaceitem-section-upload-file.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitem-section-upload-file.model.js","sourceRoot":"","sources":["workspaceitem-section-upload-file.model.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH;IAAA;IAuCA,CAAC;IAAD,2CAAC;AAAD,CAAC,AAvCD,IAuCC"} \ No newline at end of file diff --git a/src/app/core/submission/models/workspaceitem-section-upload.model.js b/src/app/core/submission/models/workspaceitem-section-upload.model.js new file mode 100644 index 0000000000..52836c66be --- /dev/null +++ b/src/app/core/submission/models/workspaceitem-section-upload.model.js @@ -0,0 +1 @@ +//# sourceMappingURL=workspaceitem-section-upload.model.js.map \ No newline at end of file diff --git a/src/app/core/submission/models/workspaceitem-section-upload.model.js.map b/src/app/core/submission/models/workspaceitem-section-upload.model.js.map new file mode 100644 index 0000000000..65f414c553 --- /dev/null +++ b/src/app/core/submission/models/workspaceitem-section-upload.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitem-section-upload.model.js","sourceRoot":"","sources":["workspaceitem-section-upload.model.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/core/submission/models/workspaceitem-sections.model.js b/src/app/core/submission/models/workspaceitem-sections.model.js new file mode 100644 index 0000000000..26f0ca8795 --- /dev/null +++ b/src/app/core/submission/models/workspaceitem-sections.model.js @@ -0,0 +1,11 @@ +/** + * An interface to represent submission's section object. + * A map of section keys to an ordered list of WorkspaceitemSectionDataType objects. + */ +var WorkspaceitemSectionsObject = /** @class */ (function () { + function WorkspaceitemSectionsObject() { + } + return WorkspaceitemSectionsObject; +}()); +export { WorkspaceitemSectionsObject }; +//# sourceMappingURL=workspaceitem-sections.model.js.map \ No newline at end of file diff --git a/src/app/core/submission/models/workspaceitem-sections.model.js.map b/src/app/core/submission/models/workspaceitem-sections.model.js.map new file mode 100644 index 0000000000..be362aef82 --- /dev/null +++ b/src/app/core/submission/models/workspaceitem-sections.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitem-sections.model.js","sourceRoot":"","sources":["workspaceitem-sections.model.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH;IAAA;IAEA,CAAC;IAAD,kCAAC;AAAD,CAAC,AAFD,IAEC"} \ No newline at end of file diff --git a/src/app/core/submission/models/workspaceitem.model.js b/src/app/core/submission/models/workspaceitem.model.js new file mode 100644 index 0000000000..42734e3856 --- /dev/null +++ b/src/app/core/submission/models/workspaceitem.model.js @@ -0,0 +1,14 @@ +import * as tslib_1 from "tslib"; +import { SubmissionObject } from './submission-object.model'; +/** + * A model class for a Workspaceitem. + */ +var Workspaceitem = /** @class */ (function (_super) { + tslib_1.__extends(Workspaceitem, _super); + function Workspaceitem() { + return _super !== null && _super.apply(this, arguments) || this; + } + return Workspaceitem; +}(SubmissionObject)); +export { Workspaceitem }; +//# sourceMappingURL=workspaceitem.model.js.map \ No newline at end of file diff --git a/src/app/core/submission/models/workspaceitem.model.js.map b/src/app/core/submission/models/workspaceitem.model.js.map new file mode 100644 index 0000000000..799705d1ea --- /dev/null +++ b/src/app/core/submission/models/workspaceitem.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitem.model.js","sourceRoot":"","sources":["workspaceitem.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D;;GAEG;AACH;IAAmC,yCAAgB;IAAnD;;IAEA,CAAC;IAAD,oBAAC;AAAD,CAAC,AAFD,CAAmC,gBAAgB,GAElD"} \ No newline at end of file diff --git a/src/app/core/submission/submission-json-patch-operations.service.js b/src/app/core/submission/submission-json-patch-operations.service.js new file mode 100644 index 0000000000..ffad1ab7d4 --- /dev/null +++ b/src/app/core/submission/submission-json-patch-operations.service.js @@ -0,0 +1,31 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { Store } from '@ngrx/store'; +import { RequestService } from '../data/request.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { JsonPatchOperationsService } from '../json-patch/json-patch-operations.service'; +import { SubmissionPatchRequest } from '../data/request.models'; +/** + * A service that provides methods to make JSON Patch requests. + */ +var SubmissionJsonPatchOperationsService = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionJsonPatchOperationsService, _super); + function SubmissionJsonPatchOperationsService(requestService, store, halService) { + var _this = _super.call(this) || this; + _this.requestService = requestService; + _this.store = store; + _this.halService = halService; + _this.linkPath = ''; + _this.patchRequestConstructor = SubmissionPatchRequest; + return _this; + } + SubmissionJsonPatchOperationsService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + Store, + HALEndpointService]) + ], SubmissionJsonPatchOperationsService); + return SubmissionJsonPatchOperationsService; +}(JsonPatchOperationsService)); +export { SubmissionJsonPatchOperationsService }; +//# sourceMappingURL=submission-json-patch-operations.service.js.map \ No newline at end of file diff --git a/src/app/core/submission/submission-json-patch-operations.service.js.map b/src/app/core/submission/submission-json-patch-operations.service.js.map new file mode 100644 index 0000000000..67f351bcc7 --- /dev/null +++ b/src/app/core/submission/submission-json-patch-operations.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-json-patch-operations.service.js","sourceRoot":"","sources":["submission-json-patch-operations.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AAEzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE;;GAEG;AAEH;IAA0D,gEAAsF;IAI9I,8CACY,cAA8B,EAC9B,KAAuB,EACvB,UAA8B;QAH1C,YAKE,iBAAO,SACR;QALW,oBAAc,GAAd,cAAc,CAAgB;QAC9B,WAAK,GAAL,KAAK,CAAkB;QACvB,gBAAU,GAAV,UAAU,CAAoB;QANhC,cAAQ,GAAG,EAAE,CAAC;QACd,6BAAuB,GAAG,sBAAsB,CAAC;;IAQ3D,CAAC;IAVU,oCAAoC;QADhD,UAAU,EAAE;iDAMiB,cAAc;YACvB,KAAK;YACA,kBAAkB;OAP/B,oCAAoC,CAYhD;IAAD,2CAAC;CAAA,AAZD,CAA0D,0BAA0B,GAYnF;SAZY,oCAAoC"} \ No newline at end of file diff --git a/src/app/core/submission/submission-resource-type.js b/src/app/core/submission/submission-resource-type.js new file mode 100644 index 0000000000..ea0d9e2e19 --- /dev/null +++ b/src/app/core/submission/submission-resource-type.js @@ -0,0 +1,23 @@ +export var SubmissionResourceType; +(function (SubmissionResourceType) { + SubmissionResourceType["Bundle"] = "bundle"; + SubmissionResourceType["Bitstream"] = "bitstream"; + SubmissionResourceType["BitstreamFormat"] = "bitstreamformat"; + SubmissionResourceType["Item"] = "item"; + SubmissionResourceType["Collection"] = "collection"; + SubmissionResourceType["Community"] = "community"; + SubmissionResourceType["ResourcePolicy"] = "resourcePolicy"; + SubmissionResourceType["License"] = "license"; + SubmissionResourceType["EPerson"] = "eperson"; + SubmissionResourceType["Group"] = "group"; + SubmissionResourceType["WorkspaceItem"] = "workspaceitem"; + SubmissionResourceType["WorkflowItem"] = "workflowitem"; + SubmissionResourceType["SubmissionDefinitions"] = "submissiondefinitions"; + SubmissionResourceType["SubmissionDefinition"] = "submissiondefinition"; + SubmissionResourceType["SubmissionForm"] = "submissionform"; + SubmissionResourceType["SubmissionForms"] = "submissionforms"; + SubmissionResourceType["SubmissionSections"] = "submissionsections"; + SubmissionResourceType["SubmissionSection"] = "submissionsection"; + SubmissionResourceType["Authority"] = "authority"; +})(SubmissionResourceType || (SubmissionResourceType = {})); +//# sourceMappingURL=submission-resource-type.js.map \ No newline at end of file diff --git a/src/app/core/submission/submission-resource-type.js.map b/src/app/core/submission/submission-resource-type.js.map new file mode 100644 index 0000000000..a3b43d393e --- /dev/null +++ b/src/app/core/submission/submission-resource-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-resource-type.js","sourceRoot":"","sources":["submission-resource-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,sBAoBX;AApBD,WAAY,sBAAsB;IAChC,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,6DAAmC,CAAA;IACnC,uCAAa,CAAA;IACb,mDAAyB,CAAA;IACzB,iDAAuB,CAAA;IACvB,2DAAiC,CAAA;IACjC,6CAAmB,CAAA;IACnB,6CAAmB,CAAA;IACnB,yCAAe,CAAA;IACf,yDAA+B,CAAA;IAC/B,uDAA6B,CAAA;IAC7B,yEAA+C,CAAA;IAC/C,uEAA6C,CAAA;IAC7C,2DAAiC,CAAA;IACjC,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IACzC,iEAAuC,CAAA;IACvC,iDAAuB,CAAA;AACzB,CAAC,EApBW,sBAAsB,KAAtB,sBAAsB,QAoBjC"} \ No newline at end of file diff --git a/src/app/core/submission/submission-response-parsing.service.js b/src/app/core/submission/submission-response-parsing.service.js new file mode 100644 index 0000000000..002dbc3b38 --- /dev/null +++ b/src/app/core/submission/submission-response-parsing.service.js @@ -0,0 +1,150 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { ErrorResponse, SubmissionSuccessResponse } from '../cache/response.models'; +import { isEmpty, isNotEmpty, isNotNull } from '../../shared/empty.util'; +import { BaseResponseParsingService } from '../data/base-response-parsing.service'; +import { GLOBAL_CONFIG } from '../../../config'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { NormalizedWorkspaceItem } from './models/normalized-workspaceitem.model'; +import { NormalizedWorkflowItem } from './models/normalized-workflowitem.model'; +import { FormFieldMetadataValueObject } from '../../shared/form/builder/models/form-field-metadata-value.model'; +import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory'; +/** + * Export a function to check if object has same properties of FormFieldMetadataValueObject + * + * @param obj + */ +export function isServerFormValue(obj) { + return (typeof obj === 'object' + && obj.hasOwnProperty('value') + && obj.hasOwnProperty('language') + && obj.hasOwnProperty('authority') + && obj.hasOwnProperty('confidence')); +} +/** + * Export a function to normalize sections object of the server response + * + * @param obj + * @param objIndex + */ +export function normalizeSectionData(obj, objIndex) { + var result = obj; + if (isNotNull(obj)) { + // If is an Instance of FormFieldMetadataValueObject normalize it + if (typeof obj === 'object' && isServerFormValue(obj)) { + // If authority property is set normalize as a FormFieldMetadataValueObject object + /* NOTE: Data received from server could have authority property equal to null, but into form + field's model is required a FormFieldMetadataValueObject object as field value, so instantiate it */ + result = new FormFieldMetadataValueObject(obj.value, obj.language, obj.authority, (obj.display || obj.value), obj.place || objIndex, obj.confidence, obj.otherInformation); + } + else if (Array.isArray(obj)) { + result = []; + obj.forEach(function (item, index) { + result[index] = normalizeSectionData(item, index); + }); + } + else if (typeof obj === 'object') { + result = Object.create({}); + Object.keys(obj) + .forEach(function (key) { + result[key] = normalizeSectionData(obj[key]); + }); + } + } + return result; +} +/** + * Provides methods to parse response for a submission request. + */ +var SubmissionResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionResponseParsingService, _super); + function SubmissionResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = NormalizedObjectFactory; + _this.toCache = false; + return _this; + } + /** + * Parses data from the workspaceitems/workflowitems endpoints + * + * @param {RestRequest} request + * @param {DSpaceRESTV2Response} data + * @returns {RestResponse} + */ + SubmissionResponseParsingService.prototype.parse = function (request, data) { + if (isNotEmpty(data.payload) + && isNotEmpty(data.payload._links) + && this.isSuccessStatus(data.statusCode)) { + var dataDefinition = this.processResponse(data.payload, request.href); + return new SubmissionSuccessResponse(dataDefinition, data.statusCode, data.statusText, this.processPageInfo(data.payload)); + } + else if (isEmpty(data.payload) && this.isSuccessStatus(data.statusCode)) { + return new SubmissionSuccessResponse(null, data.statusCode, data.statusText); + } + else { + return new ErrorResponse(Object.assign(new Error('Unexpected response from server'), { statusCode: data.statusCode, statusText: data.statusText })); + } + }; + /** + * Parses response and normalize it + * + * @param {DSpaceRESTV2Response} data + * @param {string} requestHref + * @returns {any[]} + */ + SubmissionResponseParsingService.prototype.processResponse = function (data, requestHref) { + var dataDefinition = this.process(data, requestHref); + var normalizedDefinition = Array.of(); + var processedList = Array.isArray(dataDefinition) ? dataDefinition : Array.of(dataDefinition); + processedList.forEach(function (item) { + var normalizedItem = Object.assign({}, item); + // In case data is an Instance of NormalizedWorkspaceItem normalize field value of all the section of type form + if (item instanceof NormalizedWorkspaceItem + || item instanceof NormalizedWorkflowItem) { + if (item.sections) { + var precessedSection_1 = Object.create({}); + // Iterate over all workspaceitem's sections + Object.keys(item.sections) + .forEach(function (sectionId) { + if (typeof item.sections[sectionId] === 'object' && isNotEmpty(item.sections[sectionId])) { + var normalizedSectionData_1 = Object.create({}); + // Iterate over all sections property + Object.keys(item.sections[sectionId]) + .forEach(function (metdadataId) { + var entry = item.sections[sectionId][metdadataId]; + // If entry is not an array, for sure is not a section of type form + if (Array.isArray(entry)) { + normalizedSectionData_1[metdadataId] = []; + entry.forEach(function (valueItem, index) { + // Parse value and normalize it + var normValue = normalizeSectionData(valueItem, index); + if (isNotEmpty(normValue)) { + normalizedSectionData_1[metdadataId].push(normValue); + } + }); + } + else { + normalizedSectionData_1[metdadataId] = entry; + } + }); + precessedSection_1[sectionId] = normalizedSectionData_1; + } + }); + normalizedItem = Object.assign({}, item, { sections: precessedSection_1 }); + } + } + normalizedDefinition.push(normalizedItem); + }); + return normalizedDefinition; + }; + SubmissionResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], SubmissionResponseParsingService); + return SubmissionResponseParsingService; +}(BaseResponseParsingService)); +export { SubmissionResponseParsingService }; +//# sourceMappingURL=submission-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/submission/submission-response-parsing.service.js.map b/src/app/core/submission/submission-response-parsing.service.js.map new file mode 100644 index 0000000000..02a7e9b250 --- /dev/null +++ b/src/app/core/submission/submission-response-parsing.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-response-parsing.service.js","sourceRoot":"","sources":["submission-response-parsing.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKnD,OAAO,EAAE,aAAa,EAAgB,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,4BAA4B,EAAE,MAAM,kEAAkE,CAAC;AAEhH,OAA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AK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC;gCACpD,mEAAmE;gCACnE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oCACxB,uBAAqB,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;oCACxC,KAAK,CAAC,OAAO,CAAC,UAAC,SAAS,EAAE,KAAK;wCAC7B,+BAA+B;wCAC/B,IAAM,SAAS,GAAG,oBAAoB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;wCACzD,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE;4CACzB,uBAAqB,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;yCACpD;oCACH,CAAC,CAAC,CAAC;iCACJ;qCAAM;oCACL,uBAAqB,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC;iCAC5C;4BACH,CAAC,CAAC,CAAC;4BACL,kBAAgB,CAAC,SAAS,CAAC,GAAG,uBAAqB,CAAC;yBACrD;oBACH,CAAC,CAAC,CAAC;oBACL,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,kBAAgB,EAAE,CAAC,CAAC;iBAC1E;aACF;YACD,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAxFU,gCAAgC;QAD5C,UAAU,EAAE;QAME,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACC,kBAAkB;OAN1C,gCAAgC,CA0F5C;IAAD,uCAAC;CAAA,AA1FD,CAAsD,0BAA0B,GA0F/E;SA1FY,gCAAgC"} \ No newline at end of file diff --git a/src/app/core/submission/submission-rest.service.js b/src/app/core/submission/submission-rest.service.js new file mode 100644 index 0000000000..50e12f99b3 --- /dev/null +++ b/src/app/core/submission/submission-rest.service.js @@ -0,0 +1,121 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { merge as observableMerge, throwError as observableThrowError } from 'rxjs'; +import { distinctUntilChanged, filter, flatMap, map, mergeMap, tap } from 'rxjs/operators'; +import { RequestService } from '../data/request.service'; +import { isNotEmpty } from '../../shared/empty.util'; +import { SubmissionDeleteRequest, SubmissionPatchRequest, SubmissionPostRequest, SubmissionRequest } from '../data/request.models'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { getResponseFromEntry } from '../shared/operators'; +/** + * The service handling all submission REST requests + */ +var SubmissionRestService = /** @class */ (function () { + function SubmissionRestService(rdbService, requestService, halService) { + this.rdbService = rdbService; + this.requestService = requestService; + this.halService = halService; + this.linkPath = 'workspaceitems'; + } + /** + * Fetch a RestRequest + * + * @param requestId + * The base endpoint for the type of object + * @return Observable + * server response + */ + SubmissionRestService.prototype.fetchRequest = function (requestId) { + var responses = this.requestService.getByUUID(requestId).pipe(getResponseFromEntry()); + var errorResponses = responses.pipe(filter(function (response) { return !response.isSuccessful; }), mergeMap(function (error) { return observableThrowError(error); })); + var successResponses = responses.pipe(filter(function (response) { return response.isSuccessful; }), map(function (response) { return response.dataDefinition; }), distinctUntilChanged()); + return observableMerge(errorResponses, successResponses); + }; + /** + * Create the HREF for a specific submission object based on its identifier + * + * @param endpoint + * The base endpoint for the type of object + * @param resourceID + * The identifier for the object + */ + SubmissionRestService.prototype.getEndpointByIDHref = function (endpoint, resourceID) { + return isNotEmpty(resourceID) ? endpoint + "/" + resourceID : "" + endpoint; + }; + /** + * Delete an existing submission Object on the server + * + * @param scopeId + * The submission Object to be removed + * @param linkName + * The endpoint link name + * @return Observable + * server response + */ + SubmissionRestService.prototype.deleteById = function (scopeId, linkName) { + var _this = this; + var requestId = this.requestService.generateRequestId(); + return this.halService.getEndpoint(linkName || this.linkPath).pipe(filter(function (href) { return isNotEmpty(href); }), distinctUntilChanged(), map(function (endpointURL) { return _this.getEndpointByIDHref(endpointURL, scopeId); }), map(function (endpointURL) { return new SubmissionDeleteRequest(requestId, endpointURL); }), tap(function (request) { return _this.requestService.configure(request); }), flatMap(function () { return _this.fetchRequest(requestId); }), distinctUntilChanged()); + }; + /** + * Return an existing submission Object from the server + * + * @param linkName + * The endpoint link name + * @param id + * The submission Object to retrieve + * @return Observable + * server response + */ + SubmissionRestService.prototype.getDataById = function (linkName, id) { + var _this = this; + var requestId = this.requestService.generateRequestId(); + return this.halService.getEndpoint(linkName).pipe(map(function (endpointURL) { return _this.getEndpointByIDHref(endpointURL, id); }), filter(function (href) { return isNotEmpty(href); }), distinctUntilChanged(), map(function (endpointURL) { return new SubmissionRequest(requestId, endpointURL); }), tap(function (request) { return _this.requestService.configure(request, true); }), flatMap(function () { return _this.fetchRequest(requestId); }), distinctUntilChanged()); + }; + /** + * Make a new post request + * + * @param linkName + * The endpoint link name + * @param body + * The post request body + * @param scopeId + * The submission Object id + * @param options + * The [HttpOptions] object + * @return Observable + * server response + */ + SubmissionRestService.prototype.postToEndpoint = function (linkName, body, scopeId, options) { + var _this = this; + var requestId = this.requestService.generateRequestId(); + return this.halService.getEndpoint(linkName).pipe(filter(function (href) { return isNotEmpty(href); }), map(function (endpointURL) { return _this.getEndpointByIDHref(endpointURL, scopeId); }), distinctUntilChanged(), map(function (endpointURL) { return new SubmissionPostRequest(requestId, endpointURL, body, options); }), tap(function (request) { return _this.requestService.configure(request); }), flatMap(function () { return _this.fetchRequest(requestId); }), distinctUntilChanged()); + }; + /** + * Make a new patch to a specified object + * + * @param linkName + * The endpoint link name + * @param body + * The post request body + * @param scopeId + * The submission Object id + * @return Observable + * server response + */ + SubmissionRestService.prototype.patchToEndpoint = function (linkName, body, scopeId) { + var _this = this; + var requestId = this.requestService.generateRequestId(); + return this.halService.getEndpoint(linkName).pipe(filter(function (href) { return isNotEmpty(href); }), map(function (endpointURL) { return _this.getEndpointByIDHref(endpointURL, scopeId); }), distinctUntilChanged(), map(function (endpointURL) { return new SubmissionPatchRequest(requestId, endpointURL, body); }), tap(function (request) { return _this.requestService.configure(request); }), flatMap(function () { return _this.fetchRequest(requestId); }), distinctUntilChanged()); + }; + SubmissionRestService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RemoteDataBuildService, + RequestService, + HALEndpointService]) + ], SubmissionRestService); + return SubmissionRestService; +}()); +export { SubmissionRestService }; +//# sourceMappingURL=submission-rest.service.js.map \ No newline at end of file diff --git a/src/app/core/submission/submission-rest.service.js.map b/src/app/core/submission/submission-rest.service.js.map new file mode 100644 index 0000000000..5be3262b87 --- /dev/null +++ b/src/app/core/submission/submission-rest.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-rest.service.js","sourceRoot":"","sources":["submission-rest.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,KAAK,IAAI,eAAe,EAAc,UAAU,IAAI,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE3F,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAIL,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;GAEG;AAEH;IAGE,+BACY,UAAkC,EAClC,cAA8B,EAC9B,UAA8B;QAF9B,eAAU,GAAV,UAAU,CAAwB;QAClC,mBAAc,GAAd,cAAc,CAAgB;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AAC,CAAC,IAAI,CAC/C,MAAM,CAAC,UAAC,IAAY,IAAK,OAAA,UAAU,CAAC,IAAI,CAAC,EAAhB,CAAgB,CAAC,EAC1C,GAAG,CAAC,UAAC,WAAmB,IAAK,OAAA,KAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,EAA9C,CAA8C,CAAC,EAC5E,oBAAoB,EAAE,EACtB,GAAG,CAAC,UAAC,WAAmB,IAAK,OAAA,IAAI,sBAAsB,CAAC,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC,EAAxD,CAAwD,CAAC,EACtF,GAAG,CAAC,UAAC,OAAoB,IAAK,OAAA,KAAI,CAAC,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,EAAtC,CAAsC,CAAC,EACrE,OAAO,CAAC,cAAM,OAAA,KAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAA5B,CAA4B,CAAC,EAC3C,oBAAoB,EAAE,CAAC,CAAC;IAC5B,CAAC;IAzIU,qBAAqB;QADjC,UAAU,EAAE;iDAKa,sBAAsB;YAClB,cAAc;YAClB,kBAAkB;OAN/B,qBAAqB,CA2IjC;IAAD,4BAAC;CAAA,AA3ID,IA2IC;SA3IY,qBAAqB"} \ No newline at end of file diff --git a/src/app/core/submission/submission-scope-type.js b/src/app/core/submission/submission-scope-type.js new file mode 100644 index 0000000000..93eb6385d8 --- /dev/null +++ b/src/app/core/submission/submission-scope-type.js @@ -0,0 +1,6 @@ +export var SubmissionScopeType; +(function (SubmissionScopeType) { + SubmissionScopeType["WorkspaceItem"] = "WORKSPACE"; + SubmissionScopeType["WorkflowItem"] = "WORKFLOW"; +})(SubmissionScopeType || (SubmissionScopeType = {})); +//# sourceMappingURL=submission-scope-type.js.map \ No newline at end of file diff --git a/src/app/core/submission/submission-scope-type.js.map b/src/app/core/submission/submission-scope-type.js.map new file mode 100644 index 0000000000..d1025182f8 --- /dev/null +++ b/src/app/core/submission/submission-scope-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-scope-type.js","sourceRoot":"","sources":["submission-scope-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,kDAA2B,CAAA;IAC3B,gDAAyB,CAAA;AAC3B,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B"} \ No newline at end of file diff --git a/src/app/core/submission/workflowitem-data.service.js b/src/app/core/submission/workflowitem-data.service.js new file mode 100644 index 0000000000..5a73b3b377 --- /dev/null +++ b/src/app/core/submission/workflowitem-data.service.js @@ -0,0 +1,51 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Store } from '@ngrx/store'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { DataService } from '../data/data.service'; +import { RequestService } from '../data/request.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service'; +/** + * A service that provides methods to make REST requests with workflowitems endpoint. + */ +var WorkflowitemDataService = /** @class */ (function (_super) { + tslib_1.__extends(WorkflowitemDataService, _super); + function WorkflowitemDataService(comparator, dataBuildService, halService, http, notificationsService, requestService, rdbService, objectCache, store) { + var _this = _super.call(this) || this; + _this.comparator = comparator; + _this.dataBuildService = dataBuildService; + _this.halService = halService; + _this.http = http; + _this.notificationsService = notificationsService; + _this.requestService = requestService; + _this.rdbService = rdbService; + _this.objectCache = objectCache; + _this.store = store; + _this.linkPath = 'workflowitems'; + _this.forceBypassCache = true; + return _this; + } + WorkflowitemDataService.prototype.getBrowseEndpoint = function (options) { + return this.halService.getEndpoint(this.linkPath); + }; + WorkflowitemDataService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [DSOChangeAnalyzer, + NormalizedObjectBuildService, + HALEndpointService, + HttpClient, + NotificationsService, + RequestService, + RemoteDataBuildService, + ObjectCacheService, + Store]) + ], WorkflowitemDataService); + return WorkflowitemDataService; +}(DataService)); +export { WorkflowitemDataService }; +//# sourceMappingURL=workflowitem-data.service.js.map \ No newline at end of file diff --git a/src/app/core/submission/workflowitem-data.service.js.map b/src/app/core/submission/workflowitem-data.service.js.map new file mode 100644 index 0000000000..e9d7ac746b --- /dev/null +++ b/src/app/core/submission/workflowitem-data.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workflowitem-data.service.js","sourceRoot":"","sources":["workflowitem-data.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE;;GAEG;AAEH;IAA6C,mDAAyB;IAIpE,iCACY,UAA2C,EAC3C,gBAA8C,EAC9C,UAA8B,EAC9B,IAAgB,EAChB,oBAA0C,EAC1C,cAA8B,EAC9B,UAAkC,EAClC,WAA+B,EAC/B,KAAuB;QATnC,YAUE,iBAAO,SACR;QAVW,gBAAU,GAAV,UAAU,CAAiC;QAC3C,sBAAgB,GAAhB,gBAAgB,CAA8B;QAC9C,gBAAU,GAAV,UAAU,CAAoB;QAC9B,UAAI,GAAJ,IAAI,CAAY;QAChB,0BAAoB,GAApB,oBAAoB,CAAsB;QAC1C,oBAAc,GAAd,cAAc,CAAgB;QAC9B,gBAAU,GAAV,UAAU,CAAwB;QAClC,iBAAW,GAAX,WAAW,CAAoB;QAC/B,WAAK,GAAL,KAAK,CAAkB;QAZzB,cAAQ,GAAG,eAAe,CAAC;QAC3B,sBAAgB,GAAG,IAAI,CAAC;;IAalC,CAAC;IAEM,mDAAiB,GAAxB,UAAyB,OAAuB;QAC9C,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;IAnBU,uBAAuB;QADnC,UAAU,EAAE;iDAMa,iBAAiB;YACX,4BAA4B;YAClC,kBAAkB;YACxB,UAAU;YACM,oBAAoB;YAC1B,cAAc;YAClB,sBAAsB;YACrB,kBAAkB;YACxB,KAAK;OAbb,uBAAuB,CAqBnC;IAAD,8BAAC;CAAA,AArBD,CAA6C,WAAW,GAqBvD;SArBY,uBAAuB"} \ No newline at end of file diff --git a/src/app/core/submission/workspaceitem-data.service.js b/src/app/core/submission/workspaceitem-data.service.js new file mode 100644 index 0000000000..f36c51985e --- /dev/null +++ b/src/app/core/submission/workspaceitem-data.service.js @@ -0,0 +1,51 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Store } from '@ngrx/store'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { DataService } from '../data/data.service'; +import { RequestService } from '../data/request.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service'; +/** + * A service that provides methods to make REST requests with workspaceitems endpoint. + */ +var WorkspaceitemDataService = /** @class */ (function (_super) { + tslib_1.__extends(WorkspaceitemDataService, _super); + function WorkspaceitemDataService(comparator, dataBuildService, halService, http, notificationsService, requestService, rdbService, objectCache, store) { + var _this = _super.call(this) || this; + _this.comparator = comparator; + _this.dataBuildService = dataBuildService; + _this.halService = halService; + _this.http = http; + _this.notificationsService = notificationsService; + _this.requestService = requestService; + _this.rdbService = rdbService; + _this.objectCache = objectCache; + _this.store = store; + _this.linkPath = 'workspaceitems'; + _this.forceBypassCache = true; + return _this; + } + WorkspaceitemDataService.prototype.getBrowseEndpoint = function (options) { + return this.halService.getEndpoint(this.linkPath); + }; + WorkspaceitemDataService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [DSOChangeAnalyzer, + NormalizedObjectBuildService, + HALEndpointService, + HttpClient, + NotificationsService, + RequestService, + RemoteDataBuildService, + ObjectCacheService, + Store]) + ], WorkspaceitemDataService); + return WorkspaceitemDataService; +}(DataService)); +export { WorkspaceitemDataService }; +//# sourceMappingURL=workspaceitem-data.service.js.map \ No newline at end of file diff --git a/src/app/core/submission/workspaceitem-data.service.js.map b/src/app/core/submission/workspaceitem-data.service.js.map new file mode 100644 index 0000000000..3056aae1a3 --- /dev/null +++ b/src/app/core/submission/workspaceitem-data.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitem-data.service.js","sourceRoot":"","sources":["workspaceitem-data.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM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/tasks/claimed-task-data.service.js new file mode 100644 index 0000000000..0f77d2fd65 --- /dev/null +++ b/src/app/core/tasks/claimed-task-data.service.js @@ -0,0 +1,109 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Store } from '@ngrx/store'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { RequestService } from '../data/request.service'; +import { TasksService } from './tasks.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service'; +/** + * The service handling all REST requests for ClaimedTask + */ +var ClaimedTaskDataService = /** @class */ (function (_super) { + tslib_1.__extends(ClaimedTaskDataService, _super); + /** + * Initialize instance variables + * + * @param {RequestService} requestService + * @param {RemoteDataBuildService} rdbService + * @param {NormalizedObjectBuildService} dataBuildService + * @param {Store} store + * @param {ObjectCacheService} objectCache + * @param {HALEndpointService} halService + * @param {NotificationsService} notificationsService + * @param {HttpClient} http + * @param {DSOChangeAnalyzer} + * Emit the server response + */ + ClaimedTaskDataService.prototype.approveTask = function (scopeId) { + var body = { + submit_approve: 'true' + }; + return this.postToEndpoint(this.linkPath, this.requestService.uriEncodeBody(body), scopeId, this.makeHttpOptions()); + }; + /** + * Make a request to reject the given task + * + * @param reason + * The reason of reject + * @param scopeId + * The task id + * @return {Observable} + * Emit the server response + */ + ClaimedTaskDataService.prototype.rejectTask = function (reason, scopeId) { + var body = { + submit_reject: 'true', + reason: reason + }; + return this.postToEndpoint(this.linkPath, this.requestService.uriEncodeBody(body), scopeId, this.makeHttpOptions()); + }; + /** + * Make a request to return the given task to the pool + * + * @param scopeId + * The task id + * @return {Observable} + * Emit the server response + */ + ClaimedTaskDataService.prototype.returnToPoolTask = function (scopeId) { + return this.deleteById(this.linkPath, scopeId, this.makeHttpOptions()); + }; + ClaimedTaskDataService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + RemoteDataBuildService, + NormalizedObjectBuildService, + Store, + ObjectCacheService, + HALEndpointService, + NotificationsService, + HttpClient, + DSOChangeAnalyzer]) + ], ClaimedTaskDataService); + return ClaimedTaskDataService; +}(TasksService)); +export { ClaimedTaskDataService }; +//# sourceMappingURL=claimed-task-data.service.js.map \ No newline at end of file diff --git a/src/app/core/tasks/claimed-task-data.service.js.map b/src/app/core/tasks/claimed-task-data.service.js.map new file mode 100644 index 0000000000..99939a49aa --- /dev/null +++ b/src/app/core/tasks/claimed-task-data.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"claimed-task-data.service.js","sourceRoot":"","sources":["claimed-task-data.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAGxE;;GAEG;AAEH;IAA4C,kDAAyB;IAYnE;;;;;;;;;;;;OAYG;IACH,gCACY,cAA8B,EAC9B,UAAkC,EAClC,gBAA8C,EAC9C,KAAuB,EACvB,WAA+B,EAC/B,UAA8B,E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CAAC;IACzE,CAAC;IAjFU,sBAAsB;QADlC,UAAU,EAAE;iDA2BiB,cAAc;YAClB,sBAAsB;YAChB,4BAA4B;YACvC,KAAK;YACC,kBAAkB;YACnB,kBAAkB;YACR,oBAAoB;YACpC,UAAU;YACJ,iBAAiB;OAlC9B,sBAAsB,CAmFlC;IAAD,6BAAC;CAAA,AAnFD,CAA4C,YAAY,GAmFvD;SAnFY,sBAAsB"} \ No newline at end of file diff --git a/src/app/core/tasks/models/claimed-task-object.model.js b/src/app/core/tasks/models/claimed-task-object.model.js new file mode 100644 index 0000000000..d989e74103 --- /dev/null +++ b/src/app/core/tasks/models/claimed-task-object.model.js @@ -0,0 +1,14 @@ +import * as tslib_1 from "tslib"; +import { TaskObject } from './task-object.model'; +/** + * A model class for a ClaimedTask. + */ +var ClaimedTask = /** @class */ (function (_super) { + tslib_1.__extends(ClaimedTask, _super); + function ClaimedTask() { + return _super !== null && _super.apply(this, arguments) || this; + } + return ClaimedTask; +}(TaskObject)); +export { ClaimedTask }; +//# sourceMappingURL=claimed-task-object.model.js.map \ No newline at end of file diff --git a/src/app/core/tasks/models/claimed-task-object.model.js.map b/src/app/core/tasks/models/claimed-task-object.model.js.map new file mode 100644 index 0000000000..db6fbca599 --- /dev/null +++ b/src/app/core/tasks/models/claimed-task-object.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"claimed-task-object.model.js","sourceRoot":"","sources":["claimed-task-object.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;GAEG;AACH;IAAiC,uCAAU;IAA3C;;IAEA,CAAC;IAAD,kBAAC;AAAD,CAAC,AAFD,CAAiC,UAAU,GAE1C"} \ No newline at end of file diff --git a/src/app/core/tasks/models/normalized-claimed-task-object.model.js b/src/app/core/tasks/models/normalized-claimed-task-object.model.js new file mode 100644 index 0000000000..ff2afd23de --- /dev/null +++ b/src/app/core/tasks/models/normalized-claimed-task-object.model.js @@ -0,0 +1,39 @@ +import * as tslib_1 from "tslib"; +import { NormalizedTaskObject } from './normalized-task-object.model'; +import { mapsTo, relationship } from '../../cache/builders/build-decorators'; +import { autoserialize, inheritSerialization } from 'cerialize'; +import { ClaimedTask } from './claimed-task-object.model'; +import { ResourceType } from '../../shared/resource-type'; +/** + * A normalized model class for a ClaimedTask. + */ +var NormalizedClaimedTask = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedClaimedTask, _super); + function NormalizedClaimedTask() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedClaimedTask.prototype, "id", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedClaimedTask.prototype, "step", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedClaimedTask.prototype, "action", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.Workflowitem, false), + tslib_1.__metadata("design:type", String) + ], NormalizedClaimedTask.prototype, "workflowitem", void 0); + NormalizedClaimedTask = tslib_1.__decorate([ + mapsTo(ClaimedTask), + inheritSerialization(NormalizedTaskObject) + ], NormalizedClaimedTask); + return NormalizedClaimedTask; +}(NormalizedTaskObject)); +export { NormalizedClaimedTask }; +//# sourceMappingURL=normalized-claimed-task-object.model.js.map \ No newline at end of file diff --git a/src/app/core/tasks/models/normalized-claimed-task-object.model.js.map b/src/app/core/tasks/models/normalized-claimed-task-object.model.js.map new file mode 100644 index 0000000000..a258c6c215 --- /dev/null +++ b/src/app/core/tasks/models/normalized-claimed-task-object.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-claimed-task-object.model.js","sourceRoot":"","sources":["normalized-claimed-task-object.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AAGH;IAA2C,iDAAiC;IAA5E;;IA2BA,CAAC;IArBC;QADC,aAAa;;qDACH;IAMX;QADC,aAAa;;uDACD;IAMb;QADC,aAAa;;yDACC;IAOf;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC;;+DAC1B;IAzBV,qBAAqB;QAFjC,MAAM,CAAC,WAAW,CAAC;QACnB,oBAAoB,CAAC,oBAAoB,CAAC;OAC9B,qBAAqB,CA2BjC;IAAD,4BAAC;CAAA,AA3BD,CAA2C,oBAAoB,GA2B9D;SA3BY,qBAAqB"} \ No newline at end of file diff --git a/src/app/core/tasks/models/normalized-pool-task-object.model.js b/src/app/core/tasks/models/normalized-pool-task-object.model.js new file mode 100644 index 0000000000..5999d59086 --- /dev/null +++ b/src/app/core/tasks/models/normalized-pool-task-object.model.js @@ -0,0 +1,39 @@ +import * as tslib_1 from "tslib"; +import { NormalizedTaskObject } from './normalized-task-object.model'; +import { PoolTask } from './pool-task-object.model'; +import { autoserialize, inheritSerialization } from 'cerialize'; +import { mapsTo, relationship } from '../../cache/builders/build-decorators'; +import { ResourceType } from '../../shared/resource-type'; +/** + * A normalized model class for a PoolTask. + */ +var NormalizedPoolTask = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedPoolTask, _super); + function NormalizedPoolTask() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedPoolTask.prototype, "id", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedPoolTask.prototype, "step", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedPoolTask.prototype, "action", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.Workflowitem, false), + tslib_1.__metadata("design:type", String) + ], NormalizedPoolTask.prototype, "workflowitem", void 0); + NormalizedPoolTask = tslib_1.__decorate([ + mapsTo(PoolTask), + inheritSerialization(NormalizedTaskObject) + ], NormalizedPoolTask); + return NormalizedPoolTask; +}(NormalizedTaskObject)); +export { NormalizedPoolTask }; +//# sourceMappingURL=normalized-pool-task-object.model.js.map \ No newline at end of file diff --git a/src/app/core/tasks/models/normalized-pool-task-object.model.js.map b/src/app/core/tasks/models/normalized-pool-task-object.model.js.map new file mode 100644 index 0000000000..a7beecfbc2 --- /dev/null +++ b/src/app/core/tasks/models/normalized-pool-task-object.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-pool-task-object.model.js","sourceRoot":"","sources":["normalized-pool-task-object.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AAGH;IAAwC,8CAA8B;IAAtE;;IA0BA,CAAC;IApBC;QADC,aAAa;;kDACH;IAMX;QADC,aAAa;;oDACD;IAMb;QADC,aAAa;;sDACC;IAOf;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC;;4DAC1B;IAzBV,kBAAkB;QAF9B,MAAM,CAAC,QAAQ,CAAC;QAChB,oBAAoB,CAAC,oBAAoB,CAAC;OAC9B,kBAAkB,CA0B9B;IAAD,yBAAC;CAAA,AA1BD,CAAwC,oBAAoB,GA0B3D;SA1BY,kBAAkB"} \ No newline at end of file diff --git a/src/app/core/tasks/models/normalized-task-object.model.js b/src/app/core/tasks/models/normalized-task-object.model.js new file mode 100644 index 0000000000..be01d57c88 --- /dev/null +++ b/src/app/core/tasks/models/normalized-task-object.model.js @@ -0,0 +1,39 @@ +import * as tslib_1 from "tslib"; +import { autoserialize, inheritSerialization } from 'cerialize'; +import { mapsTo, relationship } from '../../cache/builders/build-decorators'; +import { ResourceType } from '../../shared/resource-type'; +import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model'; +import { TaskObject } from './task-object.model'; +/** + * An abstract normalized model class for a TaskObject. + */ +var NormalizedTaskObject = /** @class */ (function (_super) { + tslib_1.__extends(NormalizedTaskObject, _super); + function NormalizedTaskObject() { + return _super !== null && _super.apply(this, arguments) || this; + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedTaskObject.prototype, "id", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedTaskObject.prototype, "step", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], NormalizedTaskObject.prototype, "action", void 0); + tslib_1.__decorate([ + autoserialize, + relationship(ResourceType.Workflowitem, false), + tslib_1.__metadata("design:type", String) + ], NormalizedTaskObject.prototype, "workflowitem", void 0); + NormalizedTaskObject = tslib_1.__decorate([ + mapsTo(TaskObject), + inheritSerialization(NormalizedDSpaceObject) + ], NormalizedTaskObject); + return NormalizedTaskObject; +}(NormalizedDSpaceObject)); +export { NormalizedTaskObject }; +//# sourceMappingURL=normalized-task-object.model.js.map \ No newline at end of file diff --git a/src/app/core/tasks/models/normalized-task-object.model.js.map b/src/app/core/tasks/models/normalized-task-object.model.js.map new file mode 100644 index 0000000000..064e77da70 --- /dev/null +++ b/src/app/core/tasks/models/normalized-task-object.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalized-task-object.model.js","sourceRoot":"","sources":["normalized-task-object.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD;;GAEG;AAGH;IAA2E,gDAAyB;IAApG;;IA0BA,CAAC;IApBC;QADC,aAAa;;oDACH;IAMX;QADC,aAAa;;sDACD;IAMb;QADC,aAAa;;wDACC;IAOf;QAFC,aAAa;QACb,YAAY,CAAC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC;;8DAC1B;IAzBD,oBAAoB;QAFzC,MAAM,CAAC,UAAU,CAAC;QAClB,oBAAoB,CAAC,sBAAsB,CAAC;OACvB,oBAAoB,CA0BzC;IAAD,2BAAC;CAAA,AA1BD,CAA2E,sBAAsB,GA0BhG;SA1BqB,oBAAoB"} \ No newline at end of file diff --git a/src/app/core/tasks/models/pool-task-object.model.js b/src/app/core/tasks/models/pool-task-object.model.js new file mode 100644 index 0000000000..a6d4ba9acd --- /dev/null +++ b/src/app/core/tasks/models/pool-task-object.model.js @@ -0,0 +1,14 @@ +import * as tslib_1 from "tslib"; +import { TaskObject } from './task-object.model'; +/** + * A model class for a PoolTask. + */ +var PoolTask = /** @class */ (function (_super) { + tslib_1.__extends(PoolTask, _super); + function PoolTask() { + return _super !== null && _super.apply(this, arguments) || this; + } + return PoolTask; +}(TaskObject)); +export { PoolTask }; +//# sourceMappingURL=pool-task-object.model.js.map \ No newline at end of file diff --git a/src/app/core/tasks/models/pool-task-object.model.js.map b/src/app/core/tasks/models/pool-task-object.model.js.map new file mode 100644 index 0000000000..36227a16c3 --- /dev/null +++ b/src/app/core/tasks/models/pool-task-object.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pool-task-object.model.js","sourceRoot":"","sources":["pool-task-object.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;GAEG;AACH;IAA8B,oCAAU;IAAxC;;IAEA,CAAC;IAAD,eAAC;AAAD,CAAC,AAFD,CAA8B,UAAU,GAEvC"} \ No newline at end of file diff --git a/src/app/core/tasks/models/process-task-response.js b/src/app/core/tasks/models/process-task-response.js new file mode 100644 index 0000000000..908a08a83b --- /dev/null +++ b/src/app/core/tasks/models/process-task-response.js @@ -0,0 +1,20 @@ +/** + * A class to represent the data retrieved by after processing a task + */ +var ProcessTaskResponse = /** @class */ (function () { + function ProcessTaskResponse(isSuccessful, error, payload) { + this.isSuccessful = isSuccessful; + this.error = error; + this.payload = payload; + } + Object.defineProperty(ProcessTaskResponse.prototype, "hasSucceeded", { + get: function () { + return this.isSuccessful; + }, + enumerable: true, + configurable: true + }); + return ProcessTaskResponse; +}()); +export { ProcessTaskResponse }; +//# sourceMappingURL=process-task-response.js.map \ No newline at end of file diff --git a/src/app/core/tasks/models/process-task-response.js.map b/src/app/core/tasks/models/process-task-response.js.map new file mode 100644 index 0000000000..ce51c1e1d6 --- /dev/null +++ b/src/app/core/tasks/models/process-task-response.js.map @@ -0,0 +1 @@ +{"version":3,"file":"process-task-response.js","sourceRoot":"","sources":["process-task-response.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH;IACE,6BACU,YAAqB,EACtB,KAAuB,EACvB,OAAa;QAFZ,iBAAY,GAAZ,YAAY,CAAS;QACtB,UAAK,GAAL,KAAK,CAAkB;QACvB,YAAO,GAAP,OAAO,CAAM;IAEtB,CAAC;IAED,sBAAI,6CAAY;aAAhB;YACE,OAAO,IAAI,CAAC,YAAY,CAAC;QAC3B,CAAC;;;OAAA;IACH,0BAAC;AAAD,CAAC,AAXD,IAWC"} \ No newline at end of file diff --git a/src/app/core/tasks/models/task-object.model.js b/src/app/core/tasks/models/task-object.model.js new file mode 100644 index 0000000000..03109ad998 --- /dev/null +++ b/src/app/core/tasks/models/task-object.model.js @@ -0,0 +1,14 @@ +import * as tslib_1 from "tslib"; +import { DSpaceObject } from '../../shared/dspace-object.model'; +/** + * An abstract model class for a TaskObject. + */ +var TaskObject = /** @class */ (function (_super) { + tslib_1.__extends(TaskObject, _super); + function TaskObject() { + return _super !== null && _super.apply(this, arguments) || this; + } + return TaskObject; +}(DSpaceObject)); +export { TaskObject }; +//# sourceMappingURL=task-object.model.js.map \ No newline at end of file diff --git a/src/app/core/tasks/models/task-object.model.js.map b/src/app/core/tasks/models/task-object.model.js.map new file mode 100644 index 0000000000..f8bd94f41f --- /dev/null +++ b/src/app/core/tasks/models/task-object.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"task-object.model.js","sourceRoot":"","sources":["task-object.model.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAKhE;;GAEG;AACH;IAAgC,sCAAY;IAA5C;;IAqBA,CAAC;IAAD,iBAAC;AAAD,CAAC,AArBD,CAAgC,YAAY,GAqB3C"} \ No newline at end of file diff --git a/src/app/core/tasks/pool-task-data.service.js b/src/app/core/tasks/pool-task-data.service.js new file mode 100644 index 0000000000..6e8b94c509 --- /dev/null +++ b/src/app/core/tasks/pool-task-data.service.js @@ -0,0 +1,78 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Store } from '@ngrx/store'; +import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; +import { RequestService } from '../data/request.service'; +import { TasksService } from './tasks.service'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service'; +/** + * The service handling all REST requests for PoolTask + */ +var PoolTaskDataService = /** @class */ (function (_super) { + tslib_1.__extends(PoolTaskDataService, _super); + /** + * Initialize instance variables + * + * @param {RequestService} requestService + * @param {RemoteDataBuildService} rdbService + * @param {NormalizedObjectBuildService} dataBuildService + * @param {Store} store + * @param {ObjectCacheService} objectCache + * @param {HALEndpointService} halService + * @param {NotificationsService} notificationsService + * @param {HttpClient} http + * @param {DSOChangeAnalyzer} + * Emit the server response + */ + PoolTaskDataService.prototype.claimTask = function (scopeId) { + return this.postToEndpoint(this.linkPath, {}, scopeId, this.makeHttpOptions()); + }; + PoolTaskDataService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [RequestService, + RemoteDataBuildService, + NormalizedObjectBuildService, + Store, + ObjectCacheService, + HALEndpointService, + NotificationsService, + HttpClient, + DSOChangeAnalyzer]) + ], PoolTaskDataService); + return PoolTaskDataService; +}(TasksService)); +export { PoolTaskDataService }; +//# sourceMappingURL=pool-task-data.service.js.map \ No newline at end of file diff --git a/src/app/core/tasks/pool-task-data.service.js.map b/src/app/core/tasks/pool-task-data.service.js.map new file mode 100644 index 0000000000..3848f03263 --- /dev/null +++ b/src/app/core/tasks/pool-task-data.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pool-task-data.service.js","sourceRoot":"","sources":["pool-task-data.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM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src/app/core/tasks/task-response-parsing.service.js new file mode 100644 index 0000000000..be48104bf7 --- /dev/null +++ b/src/app/core/tasks/task-response-parsing.service.js @@ -0,0 +1,50 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { BaseResponseParsingService } from '../data/base-response-parsing.service'; +import { GLOBAL_CONFIG } from '../../../config'; +import { ObjectCacheService } from '../cache/object-cache.service'; +import { NormalizedObjectFactory } from '../cache/models/normalized-object-factory'; +import { ErrorResponse, TaskResponse } from '../cache/response.models'; +/** + * Provides methods to parse response for a task request. + */ +var TaskResponseParsingService = /** @class */ (function (_super) { + tslib_1.__extends(TaskResponseParsingService, _super); + /** + * Initialize instance variables + * + * @param {GlobalConfig} EnvConfig + * @param {ObjectCacheService} objectCache + */ + function TaskResponseParsingService(EnvConfig, objectCache) { + var _this = _super.call(this) || this; + _this.EnvConfig = EnvConfig; + _this.objectCache = objectCache; + _this.objectFactory = NormalizedObjectFactory; + _this.toCache = false; + return _this; + } + /** + * Parses data from the tasks endpoints + * + * @param {RestRequest} request + * @param {DSpaceRESTV2Response} data + * @returns {RestResponse} + */ + TaskResponseParsingService.prototype.parse = function (request, data) { + if (this.isSuccessStatus(data.statusCode)) { + return new TaskResponse(data.statusCode, data.statusText); + } + else { + return new ErrorResponse(Object.assign(new Error('Unexpected response from server'), { statusCode: data.statusCode, statusText: data.statusText })); + } + }; + TaskResponseParsingService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ObjectCacheService]) + ], TaskResponseParsingService); + return TaskResponseParsingService; +}(BaseResponseParsingService)); +export { TaskResponseParsingService }; +//# sourceMappingURL=task-response-parsing.service.js.map \ No newline at end of file diff --git a/src/app/core/tasks/task-response-parsing.service.js.map b/src/app/core/tasks/task-response-parsing.service.js.map new file mode 100644 index 0000000000..e7be5a994a --- /dev/null +++ b/src/app/core/tasks/task-response-parsing.service.js.map @@ -0,0 +1 @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AApCD,CAAgD,0BAA0B,GAoCzE;SApCY,0BAA0B"} \ No newline at end of file diff --git a/src/app/core/tasks/tasks.service.js b/src/app/core/tasks/tasks.service.js new file mode 100644 index 0000000000..7504ec248e --- /dev/null +++ b/src/app/core/tasks/tasks.service.js @@ -0,0 +1,96 @@ +import * as tslib_1 from "tslib"; +import { HttpHeaders } from '@angular/common/http'; +import { merge as observableMerge, of as observableOf } from 'rxjs'; +import { distinctUntilChanged, filter, flatMap, map, mergeMap, tap } from 'rxjs/operators'; +import { DataService } from '../data/data.service'; +import { TaskDeleteRequest, TaskPostRequest } from '../data/request.models'; +import { isNotEmpty } from '../../shared/empty.util'; +import { ProcessTaskResponse } from './models/process-task-response'; +import { RemoteDataError } from '../data/remote-data-error'; +import { getResponseFromEntry } from '../shared/operators'; +/** + * An abstract class that provides methods to handle task requests. + */ +var TasksService = /** @class */ (function (_super) { + tslib_1.__extends(TasksService, _super); + function TasksService() { + return _super !== null && _super.apply(this, arguments) || this; + } + TasksService.prototype.getBrowseEndpoint = function (options) { + return this.halService.getEndpoint(this.linkPath); + }; + /** + * Fetch a RestRequest + * + * @param requestId + * The base endpoint for the type of object + * @return Observable + * server response + */ + TasksService.prototype.fetchRequest = function (requestId) { + var responses = this.requestService.getByUUID(requestId).pipe(getResponseFromEntry()); + var errorResponses = responses.pipe(filter(function (response) { return !response.isSuccessful; }), mergeMap(function (response) { return observableOf(new ProcessTaskResponse(response.isSuccessful, new RemoteDataError(response.statusCode, response.statusText, response.errorMessage))); })); + var successResponses = responses.pipe(filter(function (response) { return response.isSuccessful; }), map(function (response) { return new ProcessTaskResponse(response.isSuccessful); }), distinctUntilChanged()); + return observableMerge(errorResponses, successResponses); + }; + /** + * Create the HREF for a specific submission object based on its identifier + * + * @param endpoint + * The base endpoint for the type of object + * @param resourceID + * The identifier for the object + */ + TasksService.prototype.getEndpointByIDHref = function (endpoint, resourceID) { + return isNotEmpty(resourceID) ? endpoint + "/" + resourceID : "" + endpoint; + }; + /** + * Make a new post request + * + * @param linkPath + * The endpoint link name + * @param body + * The request body + * @param scopeId + * The task id to be removed + * @param options + * The HttpOptions object + * @return Observable + * server response + */ + TasksService.prototype.postToEndpoint = function (linkPath, body, scopeId, options) { + var _this = this; + var requestId = this.requestService.generateRequestId(); + return this.halService.getEndpoint(linkPath).pipe(filter(function (href) { return isNotEmpty(href); }), map(function (endpointURL) { return _this.getEndpointByIDHref(endpointURL, scopeId); }), distinctUntilChanged(), map(function (endpointURL) { return new TaskPostRequest(requestId, endpointURL, body, options); }), tap(function (request) { return _this.requestService.configure(request); }), flatMap(function (request) { return _this.fetchRequest(requestId); }), distinctUntilChanged()); + }; + /** + * Delete an existing task on the server + * + * @param linkPath + * The endpoint link name + * @param scopeId + * The task id to be removed + * @param options + * The HttpOptions object + * @return Observable + * server response + */ + TasksService.prototype.deleteById = function (linkPath, scopeId, options) { + var _this = this; + var requestId = this.requestService.generateRequestId(); + return this.halService.getEndpoint(linkPath || this.linkPath).pipe(filter(function (href) { return isNotEmpty(href); }), distinctUntilChanged(), map(function (endpointURL) { return _this.getEndpointByIDHref(endpointURL, scopeId); }), map(function (endpointURL) { return new TaskDeleteRequest(requestId, endpointURL, null, options); }), tap(function (request) { return _this.requestService.configure(request); }), flatMap(function (request) { return _this.fetchRequest(requestId); }), distinctUntilChanged()); + }; + /** + * Create a new HttpOptions + */ + TasksService.prototype.makeHttpOptions = function () { + var options = Object.create({}); + var headers = new HttpHeaders(); + headers = headers.append('Content-Type', 'application/x-www-form-urlencoded'); + options.headers = headers; + return options; + }; + return TasksService; +}(DataService)); +export { TasksService }; +//# sourceMappingURL=tasks.service.js.map \ No newline at end of file diff --git a/src/app/core/tasks/tasks.service.js.map b/src/app/core/tasks/tasks.service.js.map new file mode 100644 index 0000000000..6ae3946573 --- /dev/null +++ b/src/app/core/tasks/tasks.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tasks.service.js","sourceRoot":"","sources":["tasks.service.ts"],"names":[],"mappings":";AAAA,OAAO,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E,CAAC;QAChC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,mCAAmC,CAAC,CAAC;QAC9E,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;QAC1B,OAAO,OAAO,CAAC;IACjB,CAAC;IACH,mBAAC;AAAD,CAAC,AA1GD,CAAsE,WAAW,GA0GhF"} \ No newline at end of file diff --git a/src/app/core/url-baser/url-baser.js b/src/app/core/url-baser/url-baser.js new file mode 100644 index 0000000000..ea748cbea1 --- /dev/null +++ b/src/app/core/url-baser/url-baser.js @@ -0,0 +1,39 @@ +import { isEmpty } from '../../shared/empty.util'; +/** + * Extracts the base URL + * from a URL with query parameters + */ +var URLBaser = /** @class */ (function () { + /** + * Creates a new URLBaser + * + * @param originalURL + * a string representing the original URL with possible query parameters + */ + function URLBaser(originalURL) { + this.original = originalURL; + } + /** + * Removes the query parameters from the original URL of this URLBaser + * + * @return {string} + * The base URL + */ + URLBaser.prototype.toString = function () { + if (isEmpty(this.original)) { + return ''; + } + else { + var index = this.original.indexOf('?'); + if (index < 0) { + return this.original; + } + else { + return this.original.substring(0, index); + } + } + }; + return URLBaser; +}()); +export { URLBaser }; +//# sourceMappingURL=url-baser.js.map \ No newline at end of file diff --git a/src/app/core/url-baser/url-baser.js.map b/src/app/core/url-baser/url-baser.js.map new file mode 100644 index 0000000000..6aae19fb0a --- /dev/null +++ b/src/app/core/url-baser/url-baser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"url-baser.js","sourceRoot":"","sources":["url-baser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD;;;GAGG;AACH;IAGE;;;;;OAKG;IACH,kBAAY,WAAmB;QAC7B,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACH,2BAAQ,GAAR;QACE,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAC1B,OAAO,EAAE,CAAC;SACX;aAAM;YACL,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACzC,IAAI,KAAK,GAAG,CAAC,EAAE;gBACb,OAAO,IAAI,CAAC,QAAQ,CAAC;aACtB;iBAAM;gBACL,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aAC1C;SACF;IACH,CAAC;IAEH,eAAC;AAAD,CAAC,AAhCD,IAgCC"} \ No newline at end of file diff --git a/src/app/core/url-combiner/rest-url-combiner.js b/src/app/core/url-combiner/rest-url-combiner.js new file mode 100644 index 0000000000..887f063c85 --- /dev/null +++ b/src/app/core/url-combiner/rest-url-combiner.js @@ -0,0 +1,21 @@ +import * as tslib_1 from "tslib"; +import { URLCombiner } from './url-combiner'; +/** + * Combines a variable number of strings representing parts + * of a relative REST URL in to a single, absolute REST URL + * + * TODO write tests once GlobalConfig becomes injectable + */ +var RESTURLCombiner = /** @class */ (function (_super) { + tslib_1.__extends(RESTURLCombiner, _super); + function RESTURLCombiner(EnvConfig) { + var parts = []; + for (var _i = 1; _i < arguments.length; _i++) { + parts[_i - 1] = arguments[_i]; + } + return _super.apply(this, [EnvConfig.rest.baseUrl].concat(parts)) || this; + } + return RESTURLCombiner; +}(URLCombiner)); +export { RESTURLCombiner }; +//# sourceMappingURL=rest-url-combiner.js.map \ No newline at end of file diff --git a/src/app/core/url-combiner/rest-url-combiner.js.map b/src/app/core/url-combiner/rest-url-combiner.js.map new file mode 100644 index 0000000000..9b39c4edca --- /dev/null +++ b/src/app/core/url-combiner/rest-url-combiner.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rest-url-combiner.js","sourceRoot":"","sources":["rest-url-combiner.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C;;;;;GAKG;AACH;IAAqC,2CAAW;IAC9C,yBAAY,SAAuB;QAAE,eAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,8BAAkB;;mCAC/C,SAAS,CAAC,IAAI,CAAC,OAAO,SAAK,KAAK;IACxC,CAAC;IACH,sBAAC;AAAD,CAAC,AAJD,CAAqC,WAAW,GAI/C"} \ No newline at end of file diff --git a/src/app/core/url-combiner/ui-url-combiner.js b/src/app/core/url-combiner/ui-url-combiner.js new file mode 100644 index 0000000000..0b20f6de37 --- /dev/null +++ b/src/app/core/url-combiner/ui-url-combiner.js @@ -0,0 +1,21 @@ +import * as tslib_1 from "tslib"; +import { URLCombiner } from './url-combiner'; +/** + * Combines a variable number of strings representing parts + * of a relative UI URL in to a single, absolute UI URL + * + * TODO write tests once GlobalConfig becomes injectable + */ +var UIURLCombiner = /** @class */ (function (_super) { + tslib_1.__extends(UIURLCombiner, _super); + function UIURLCombiner(EnvConfig) { + var parts = []; + for (var _i = 1; _i < arguments.length; _i++) { + parts[_i - 1] = arguments[_i]; + } + return _super.apply(this, [EnvConfig.ui.baseUrl].concat(parts)) || this; + } + return UIURLCombiner; +}(URLCombiner)); +export { UIURLCombiner }; +//# sourceMappingURL=ui-url-combiner.js.map \ No newline at end of file diff --git a/src/app/core/url-combiner/ui-url-combiner.js.map b/src/app/core/url-combiner/ui-url-combiner.js.map new file mode 100644 index 0000000000..c013190d7f --- /dev/null +++ b/src/app/core/url-combiner/ui-url-combiner.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ui-url-combiner.js","sourceRoot":"","sources":["ui-url-combiner.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;;;;GAKG;AACH;IAAmC,yCAAW;IAC5C,uBAAY,SAAuB;QAAE,eAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,8BAAkB;;mCAC/C,SAAS,CAAC,EAAE,CAAC,OAAO,SAAK,KAAK;IACtC,CAAC;IACH,oBAAC;AAAD,CAAC,AAJD,CAAmC,WAAW,GAI7C"} \ No newline at end of file diff --git a/src/app/core/url-combiner/url-combiner.js b/src/app/core/url-combiner/url-combiner.js new file mode 100644 index 0000000000..2da34fde1a --- /dev/null +++ b/src/app/core/url-combiner/url-combiner.js @@ -0,0 +1,52 @@ +import { isEmpty } from '../../shared/empty.util'; +/** + * Combines a variable number of strings representing parts + * of a URL in to a single, normalized URL + */ +var URLCombiner = /** @class */ (function () { + /** + * Creates a new URLCombiner + * + * @param parts + * a variable number of strings representing parts of a URL + */ + function URLCombiner() { + var parts = []; + for (var _i = 0; _i < arguments.length; _i++) { + parts[_i] = arguments[_i]; + } + // can't do this in the constructor signature, + // because of the spread operator + this.parts = parts; + } + /** + * Combines the parts of this URLCombiner in to a single, + * normalized URL + * + * e.g. new URLCombiner('http:/foo.com/', '/bar', 'id', '5').toString() + * returns: http://foo.com/bar/id/5 + * + * @return {string} + * The combined URL + */ + URLCombiner.prototype.toString = function () { + if (isEmpty(this.parts)) { + return ''; + } + else { + var url = this.parts.join('/'); + // make sure protocol is followed by two slashes + url = url.replace(/:\//g, '://'); + // remove consecutive slashes + url = url.replace(/([^:\s])\/+/g, '$1/'); + // remove trailing slash before parameters or hash + url = url.replace(/\/(\?|&|#[^!])/g, '$1'); + // replace ? in parameters with & + url = url.replace(/(\?.+)\?/g, '$1&'); + return url; + } + }; + return URLCombiner; +}()); +export { URLCombiner }; +//# sourceMappingURL=url-combiner.js.map \ No newline at end of file diff --git a/src/app/core/url-combiner/url-combiner.js.map b/src/app/core/url-combiner/url-combiner.js.map new file mode 100644 index 0000000000..f3372b7158 --- /dev/null +++ b/src/app/core/url-combiner/url-combiner.js.map @@ -0,0 +1 @@ +{"version":3,"file":"url-combiner.js","sourceRoot":"","sources":["url-combiner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD;;;GAGG;AACH;IAGE;;;;;OAKG;IACH;QAAY,eAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,0BAAkB;;QAC5B,8CAA8C;QAC9C,iCAAiC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;;;;;OASG;IACH,8BAAQ,GAAR;QACE,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACvB,OAAO,EAAE,CAAC;SACX;aAAM;YACL,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAE/B,gDAAgD;YAChD,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAEjC,6BAA6B;YAC7B,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;YAEzC,kDAAkD;YAClD,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YAE3C,iCAAiC;YACjC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;YAEtC,OAAO,GAAG,CAAC;SACZ;IACH,CAAC;IAEH,kBAAC;AAAD,CAAC,AA/CD,IA+CC"} \ No newline at end of file diff --git a/src/app/footer/footer.component.js b/src/app/footer/footer.component.js new file mode 100644 index 0000000000..9b61c075e4 --- /dev/null +++ b/src/app/footer/footer.component.js @@ -0,0 +1,17 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +var FooterComponent = /** @class */ (function () { + function FooterComponent() { + this.dateObj = Date.now(); + } + FooterComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-footer', + styleUrls: ['footer.component.scss'], + templateUrl: 'footer.component.html' + }) + ], FooterComponent); + return FooterComponent; +}()); +export { FooterComponent }; +//# sourceMappingURL=footer.component.js.map \ No newline at end of file diff --git a/src/app/footer/footer.component.js.map b/src/app/footer/footer.component.js.map new file mode 100644 index 0000000000..f010e95142 --- /dev/null +++ b/src/app/footer/footer.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"footer.component.js","sourceRoot":"","sources":["footer.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAO1C;IALA;QAOE,YAAO,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;IAE/B,CAAC;IAJY,eAAe;QAL3B,SAAS,CAAC;YACT,QAAQ,EAAE,WAAW;YACrB,SAAS,EAAE,CAAC,uBAAuB,CAAC;YACpC,WAAW,EAAE,uBAAuB;SACrC,CAAC;OACW,eAAe,CAI3B;IAAD,sBAAC;CAAA,AAJD,IAIC;SAJY,eAAe"} \ No newline at end of file diff --git a/src/app/header-nav-wrapper/header-navbar-wrapper.component.js b/src/app/header-nav-wrapper/header-navbar-wrapper.component.js new file mode 100644 index 0000000000..652f164d8a --- /dev/null +++ b/src/app/header-nav-wrapper/header-navbar-wrapper.component.js @@ -0,0 +1,43 @@ +import * as tslib_1 from "tslib"; +import { Component, HostBinding } from '@angular/core'; +import { Store } from '@ngrx/store'; +import { hasValue } from '../shared/empty.util'; +import { MenuService } from '../shared/menu/menu.service'; +import { MenuID } from '../shared/menu/initial-menus-state'; +/** + * This component represents a wrapper for the horizontal navbar and the header + */ +var HeaderNavbarWrapperComponent = /** @class */ (function () { + function HeaderNavbarWrapperComponent(store, menuService) { + this.store = store; + this.menuService = menuService; + this.isOpen = false; + this.menuID = MenuID.PUBLIC; + } + HeaderNavbarWrapperComponent.prototype.ngOnInit = function () { + var _this = this; + this.isNavBarCollapsed = this.menuService.isMenuCollapsed(this.menuID); + this.sub = this.isNavBarCollapsed.subscribe(function (isCollapsed) { return _this.isOpen = !isCollapsed; }); + }; + HeaderNavbarWrapperComponent.prototype.ngOnDestroy = function () { + if (hasValue(this.sub)) { + this.sub.unsubscribe(); + } + }; + tslib_1.__decorate([ + HostBinding('class.open'), + tslib_1.__metadata("design:type", Object) + ], HeaderNavbarWrapperComponent.prototype, "isOpen", void 0); + HeaderNavbarWrapperComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-header-navbar-wrapper', + styleUrls: ['header-navbar-wrapper.component.scss'], + templateUrl: 'header-navbar-wrapper.component.html', + }), + tslib_1.__metadata("design:paramtypes", [Store, + MenuService]) + ], HeaderNavbarWrapperComponent); + return HeaderNavbarWrapperComponent; +}()); +export { HeaderNavbarWrapperComponent }; +//# sourceMappingURL=header-navbar-wrapper.component.js.map \ No newline at end of file diff --git a/src/app/header-nav-wrapper/header-navbar-wrapper.component.js.map b/src/app/header-nav-wrapper/header-navbar-wrapper.component.js.map new file mode 100644 index 0000000000..f742261544 --- /dev/null +++ b/src/app/header-nav-wrapper/header-navbar-wrapper.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"header-navbar-wrapper.component.js","sourceRoot":"","sources":["header-navbar-wrapper.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D;;GAEG;AAMH;IAME,sCACU,KAAsB,EACtB,WAAwB;QADxB,UAAK,GAAL,KAAK,CAAiB;QACtB,gBAAW,GAAX,WAAW,CAAa;QAPP,WAAM,GAAG,KAAK,CAAC;QAG1C,WAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAMvB,CAAC;IAED,+CAAQ,GAAR;QAAA,iBAGC;QAFC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,UAAC,WAAW,IAAK,OAAA,KAAI,CAAC,MAAM,GAAG,CAAC,WAAW,EAA1B,CAA0B,CAAC,CAAA;IAC1F,CAAC;IAED,kDAAW,GAAX;QACE,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;SACxB;IACH,CAAC;IApB0B;QAA1B,WAAW,CAAC,YAAY,CAAC;;gEAAgB;IAD/B,4BAA4B;QALxC,SAAS,CAAC;YACT,QAAQ,EAAE,0BAA0B;YACpC,SAAS,EAAE,CAAC,sCAAsC,CAAC;YACnD,WAAW,EAAE,sCAAsC;SACpD,CAAC;iDAQiB,KAAK;YACC,WAAW;OARvB,4BAA4B,CAsBxC;IAAD,mCAAC;CAAA,AAtBD,IAsBC;SAtBY,4BAA4B"} \ No newline at end of file diff --git a/src/app/header/header.component.js b/src/app/header/header.component.js new file mode 100644 index 0000000000..0929f8c308 --- /dev/null +++ b/src/app/header/header.component.js @@ -0,0 +1,28 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { MenuService } from '../shared/menu/menu.service'; +import { MenuID } from '../shared/menu/initial-menus-state'; +/** + * Represents the header with the logo and simple navigation + */ +var HeaderComponent = /** @class */ (function () { + function HeaderComponent(menuService) { + this.menuService = menuService; + this.showAuth = false; + this.menuID = MenuID.PUBLIC; + } + HeaderComponent.prototype.toggleNavbar = function () { + this.menuService.toggleMenu(this.menuID); + }; + HeaderComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-header', + styleUrls: ['header.component.scss'], + templateUrl: 'header.component.html', + }), + tslib_1.__metadata("design:paramtypes", [MenuService]) + ], HeaderComponent); + return HeaderComponent; +}()); +export { HeaderComponent }; +//# sourceMappingURL=header.component.js.map \ No newline at end of file diff --git a/src/app/header/header.component.js.map b/src/app/header/header.component.js.map new file mode 100644 index 0000000000..95aa45ca67 --- /dev/null +++ b/src/app/header/header.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"header.component.js","sourceRoot":"","sources":["header.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D;;GAEG;AAMH;IASE,yBACU,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;QAJ3B,aAAQ,GAAG,KAAK,CAAC;QACxB,WAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAKvB,CAAC;IAEM,sCAAY,GAAnB;QACE,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAhBU,eAAe;QAL3B,SAAS,CAAC;YACT,QAAQ,EAAE,WAAW;YACrB,SAAS,EAAE,CAAC,uBAAuB,CAAC;YACpC,WAAW,EAAE,uBAAuB;SACrC,CAAC;iDAWuB,WAAW;OAVvB,eAAe,CAiB3B;IAAD,sBAAC;CAAA,AAjBD,IAiBC;SAjBY,eAAe"} \ No newline at end of file diff --git a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.js b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.js new file mode 100644 index 0000000000..1d6acc5d7a --- /dev/null +++ b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.js @@ -0,0 +1,85 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject, Injector } from '@angular/core'; +import { NavbarSectionComponent } from '../navbar-section/navbar-section.component'; +import { MenuService } from '../../shared/menu/menu.service'; +import { MenuID } from '../../shared/menu/initial-menus-state'; +import { slide } from '../../shared/animations/slide'; +import { first } from 'rxjs/operators'; +import { HostWindowService } from '../../shared/host-window.service'; +import { rendersSectionForMenu } from '../../shared/menu/menu-section.decorator'; +/** + * Represents an expandable section in the navbar + */ +var ExpandableNavbarSectionComponent = /** @class */ (function (_super) { + tslib_1.__extends(ExpandableNavbarSectionComponent, _super); + function ExpandableNavbarSectionComponent(menuSection, menuService, injector, windowService) { + var _this = _super.call(this, menuSection, menuService, injector) || this; + _this.menuService = menuService; + _this.injector = injector; + _this.windowService = windowService; + /** + * This section resides in the Public Navbar + */ + _this.menuID = MenuID.PUBLIC; + return _this; + } + ExpandableNavbarSectionComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + }; + /** + * Overrides the super function that activates this section (triggered on hover) + * Has an extra check to make sure the section can only be activated on non-mobile devices + * @param {Event} event The user event that triggered this function + */ + ExpandableNavbarSectionComponent.prototype.activateSection = function (event) { + var _this = this; + this.windowService.isXsOrSm().pipe(first()).subscribe(function (isMobile) { + if (!isMobile) { + _super.prototype.activateSection.call(_this, event); + } + }); + }; + /** + * Overrides the super function that deactivates this section (triggered on hover) + * Has an extra check to make sure the section can only be deactivated on non-mobile devices + * @param {Event} event The user event that triggered this function + */ + ExpandableNavbarSectionComponent.prototype.deactivateSection = function (event) { + var _this = this; + this.windowService.isXsOrSm().pipe(first()).subscribe(function (isMobile) { + if (!isMobile) { + _super.prototype.deactivateSection.call(_this, event); + } + }); + }; + /** + * Overrides the super function that toggles this section (triggered on click) + * Has an extra check to make sure the section can only be toggled on mobile devices + * @param {Event} event The user event that triggered this function + */ + ExpandableNavbarSectionComponent.prototype.toggleSection = function (event) { + var _this = this; + event.preventDefault(); + this.windowService.isXsOrSm().pipe(first()).subscribe(function (isMobile) { + if (isMobile) { + _super.prototype.toggleSection.call(_this, event); + } + }); + }; + ExpandableNavbarSectionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-expandable-navbar-section', + templateUrl: './expandable-navbar-section.component.html', + styleUrls: ['./expandable-navbar-section.component.scss'], + animations: [slide] + }), + rendersSectionForMenu(MenuID.PUBLIC, true), + tslib_1.__param(0, Inject('sectionDataProvider')), + tslib_1.__metadata("design:paramtypes", [Object, MenuService, + Injector, + HostWindowService]) + ], ExpandableNavbarSectionComponent); + return ExpandableNavbarSectionComponent; +}(NavbarSectionComponent)); +export { ExpandableNavbarSectionComponent }; +//# sourceMappingURL=expandable-navbar-section.component.js.map \ No newline at end of file diff --git a/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.js.map b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.js.map new file mode 100644 index 0000000000..00834d2b20 --- /dev/null +++ b/src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"expandable-navbar-section.component.js","sourceRoot":"","sources":["expandable-navbar-section.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAU,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF;;GAEG;AAQH;IAAsD,4DAAsB;IAM1E,0CAA2C,WAAW,EAChC,WAAwB,EACxB,QAAkB,EACpB,aAAgC;QAHpD,YAKE,kBAAM,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAC,SAC1C;QALqB,iBAAW,GAAX,WAAW,CAAa;QACxB,cAAQ,GAAR,QAAQ,CAAU;QACpB,mBAAa,GAAb,aAAa,CAAmB;QARpD;;WAEG;QACH,YAAM,GAAG,MAAM,CAAC,MAAM,CAAC;;IAQvB,CAAC;IAED,mDAAQ,GAAR;QACE,iBAAM,QAAQ,WAAE,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,0DAAe,GAAf,UAAgB,KAAK;QAArB,iBAQC;QAPC,IAAI,CAAC,aAAa,CAAC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ar-section/navbar-section.component.js b/src/app/navbar/navbar-section/navbar-section.component.js new file mode 100644 index 0000000000..768e9de26a --- /dev/null +++ b/src/app/navbar/navbar-section/navbar-section.component.js @@ -0,0 +1,39 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject, Injector } from '@angular/core'; +import { MenuSectionComponent } from '../../shared/menu/menu-section/menu-section.component'; +import { MenuService } from '../../shared/menu/menu.service'; +import { MenuID } from '../../shared/menu/initial-menus-state'; +import { rendersSectionForMenu } from '../../shared/menu/menu-section.decorator'; +/** + * Represents a non-expandable section in the navbar + */ +var NavbarSectionComponent = /** @class */ (function (_super) { + tslib_1.__extends(NavbarSectionComponent, _super); + function NavbarSectionComponent(menuSection, menuService, injector) { + var _this = _super.call(this, menuSection, menuService, injector) || this; + _this.menuService = menuService; + _this.injector = injector; + /** + * This section resides in the Public Navbar + */ + _this.menuID = MenuID.PUBLIC; + return _this; + } + NavbarSectionComponent.prototype.ngOnInit = function () { + _super.prototype.ngOnInit.call(this); + }; + NavbarSectionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-navbar-section', + templateUrl: './navbar-section.component.html', + styleUrls: ['./navbar-section.component.scss'] + }), + rendersSectionForMenu(MenuID.PUBLIC, false), + tslib_1.__param(0, Inject('sectionDataProvider')), + tslib_1.__metadata("design:paramtypes", [Object, MenuService, + Injector]) + ], NavbarSectionComponent); + return NavbarSectionComponent; +}(MenuSectionComponent)); +export { NavbarSectionComponent }; +//# sourceMappingURL=navbar-section.component.js.map \ No newline at end of file diff --git a/src/app/navbar/navbar-section/navbar-section.component.js.map b/src/app/navbar/navbar-section/navbar-section.component.js.map new file mode 100644 index 0000000000..e2282258dd --- /dev/null +++ b/src/app/navbar/navbar-section/navbar-section.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"navbar-section.component.js","sourceRoot":"","sources":["navbar-section.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAU,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uDAAuD,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF;;GAEG;AAOH;IAA4C,kDAAoB;IAM9D,gCAA2C,WAAW,EAChC,WAAwB,EACxB,QAAkB;QAFxC,YAIE,kBAAM,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAC,SAC1C;QAJqB,iBAAW,GAAX,WAAW,CAAa;QACxB,cAAQ,GAAR,QAAQ,CAAU;QAPxC;;WAEG;QACH,YAAM,GAAG,MAAM,CAAC,MAAM,CAAC;;IAOvB,CAAC;IAED,yCAAQ,GAAR;QACE,iBAAM,QAAQ,WAAE,CAAC;IACnB,CAAC;IAfU,sBAAsB;QANlC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,WAAW,EAAE,iCAAiC;YAC9C,SAAS,EAAE,CAAC,iCAAiC,CAAC;SAC/C,CAAC;QACD,qBAAqB,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;QAO7B,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;yDACP,WAAW;YACd,QAAQ;OAR7B,sBAAsB,CAgBlC;IAAD,6BAAC;CAAA,AAhBD,CAA4C,oBAAoB,GAgB/D;SAhBY,sBAAsB"} \ No newline at end of file diff --git a/src/app/navbar/navbar.component.js b/src/app/navbar/navbar.component.js new file mode 100644 index 0000000000..117578b1fe --- /dev/null +++ b/src/app/navbar/navbar.component.js @@ -0,0 +1,130 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector } from '@angular/core'; +import { slideMobileNav } from '../shared/animations/slide'; +import { MenuComponent } from '../shared/menu/menu.component'; +import { MenuService } from '../shared/menu/menu.service'; +import { MenuID, MenuItemType } from '../shared/menu/initial-menus-state'; +import { HostWindowService } from '../shared/host-window.service'; +/** + * Component representing the public navbar + */ +var NavbarComponent = /** @class */ (function (_super) { + tslib_1.__extends(NavbarComponent, _super); + function NavbarComponent(menuService, injector, windowService) { + var _this = _super.call(this, menuService, injector) || this; + _this.menuService = menuService; + _this.injector = injector; + _this.windowService = windowService; + /** + * The menu ID of the Navbar is PUBLIC + * @type {MenuID.PUBLIC} + */ + _this.menuID = MenuID.PUBLIC; + return _this; + } + NavbarComponent.prototype.ngOnInit = function () { + this.createMenu(); + _super.prototype.ngOnInit.call(this); + }; + /** + * Initialize all menu sections and items for this menu + */ + NavbarComponent.prototype.createMenu = function () { + var _this = this; + var menuList = [ + /* News */ + { + id: 'browse_global', + active: false, + visible: true, + model: { + type: MenuItemType.TEXT, + text: 'menu.section.browse_global' + }, + index: 0 + }, + // { + // id: 'browse_global_communities_and_collections', + // parentID: 'browse_global', + // active: false, + // visible: true, + // model: { + // type: MenuItemType.LINK, + // text: 'menu.section.browse_global_communities_and_collections', + // link: '#' + // } as LinkMenuItemModel, + // }, + { + id: 'browse_global_global_by_title', + parentID: 'browse_global', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.browse_global_by_title', + link: '/browse/title' + }, + }, + { + id: 'browse_global_global_by_issue_date', + parentID: 'browse_global', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.browse_global_by_issue_date', + link: '/browse/dateissued' + }, + }, + { + id: 'browse_global_by_author', + parentID: 'browse_global', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.browse_global_by_author', + link: '/browse/author' + }, + }, + { + id: 'browse_global_by_subject', + parentID: 'browse_global', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.browse_global_by_subject', + link: '/browse/subject' + }, + }, + /* Statistics */ + { + id: 'statistics', + active: false, + visible: true, + model: { + type: MenuItemType.LINK, + text: 'menu.section.statistics', + link: '' + }, + index: 2 + }, + ]; + menuList.forEach(function (menuSection) { return _this.menuService.addSection(_this.menuID, menuSection); }); + }; + NavbarComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-navbar', + styleUrls: ['navbar.component.scss'], + templateUrl: 'navbar.component.html', + animations: [slideMobileNav] + }), + tslib_1.__metadata("design:paramtypes", [MenuService, + Injector, + HostWindowService]) + ], NavbarComponent); + return NavbarComponent; +}(MenuComponent)); +export { NavbarComponent }; +//# sourceMappingURL=navbar.component.js.map \ No newline at end of file diff --git a/src/app/navbar/navbar.component.js.map b/src/app/navbar/navbar.component.js.map new file mode 100644 index 0000000000..766fd0b9a0 --- /dev/null +++ b/src/app/navbar/navbar.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"navbar.component.js","sourceRoot":"","sources":["navbar.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAU,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAG1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE;;GAEG;AAOH;IAAqC,2CAAa;IAOhD,yBAAsB,WAAwB,EACxB,QAAkB,EACrB,aAAgC;QAFnD,YAIE,kBAAM,WAAW,EAAE,QAAQ,CAAC,SAC7B;QALqB,iBAAW,GAAX,WAAW,CAAa;QACxB,cAAQ,GAAR,QAAQ,CAAU;QACrB,mBAAa,GAAb,aAAa,CAAmB;QARnD;;;WAGG;QACH,YAAM,GAAG,MAAM,CAAC,MAAM,CAAC;;IAOvB,CAAC;IAED,kCAAQ,GAAR;QACE,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,iBAAM,QAAQ,WAAE,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,oCAAU,GAAV;QAA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Y,CAAC,IAAI;oBACvB,IAAI,EAAE,uCAAuC;oBAC7C,IAAI,EAAE,iBAAiB;iBACH;aACvB;YAED,gBAAgB;YAChB;gBACE,EAAE,EAAE,YAAY;gBAChB,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE;oBACL,IAAI,EAAE,YAAY,CAAC,IAAI;oBACvB,IAAI,EAAE,yBAAyB;oBAC/B,IAAI,EAAE,EAAE;iBACY;gBACtB,KAAK,EAAE,CAAC;aACT;SACF,CAAC;QACF,QAAQ,CAAC,OAAO,CAAC,UAAC,WAAW,IAAK,OAAA,KAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAI,CAAC,MAAM,EAAE,WAAW,CAAC,EAArD,CAAqD,CAAC,CAAC;IAE3F,CAAC;IA1GU,eAAe;QAN3B,SAAS,CAAC;YACT,QAAQ,EAAE,WAAW;YACrB,SAAS,EAAE,CAAC,uBAAuB,CAAC;YACpC,WAAW,EAAE,uBAAuB;YACpC,UAAU,EAAE,CAAC,cAAc,CAAC;SAC7B,CAAC;iDAQmC,WAAW;YACd,QAAQ;YACN,iBAAiB;OATxC,eAAe,CA4G3B;IAAD,sBAAC;CAAA,AA5GD,CAAqC,aAAa,GA4GjD;SA5GY,eAAe"} \ No newline at end of file diff --git a/src/app/navbar/navbar.effects.js b/src/app/navbar/navbar.effects.js new file mode 100644 index 0000000000..147eb6d39c --- /dev/null +++ b/src/app/navbar/navbar.effects.js @@ -0,0 +1,63 @@ +import * as tslib_1 from "tslib"; +import { first, map, switchMap } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { Actions, Effect, ofType } from '@ngrx/effects'; +import * as fromRouter from '@ngrx/router-store'; +import { HostWindowActionTypes } from '../shared/host-window.actions'; +import { CollapseMenuAction, MenuActionTypes } from '../shared/menu/menu.actions'; +import { MenuID } from '../shared/menu/initial-menus-state'; +import { MenuService } from '../shared/menu/menu.service'; +var NavbarEffects = /** @class */ (function () { + function NavbarEffects(actions$, menuService) { + var _this = this; + this.actions$ = actions$; + this.menuService = menuService; + this.menuID = MenuID.PUBLIC; + /** + * Effect that collapses the public menu on window resize + * @type {Observable} + */ + this.resize$ = this.actions$ + .pipe(ofType(HostWindowActionTypes.RESIZE), map(function () { return new CollapseMenuAction(_this.menuID); })); + /** + * Effect that collapses the public menu on reroute + * @type {Observable} + */ + this.routeChange$ = this.actions$ + .pipe(ofType(fromRouter.ROUTER_NAVIGATION), map(function () { return new CollapseMenuAction(_this.menuID); })); + /** + * Effect that collapses the public menu when the admin sidebar opens + * @type {Observable} + */ + this.openAdminSidebar$ = this.actions$ + .pipe(ofType(MenuActionTypes.EXPAND_MENU_PREVIEW), switchMap(function (action) { + return _this.menuService.getMenu(action.menuID).pipe(first(), map(function (menu) { + if (menu.id === MenuID.ADMIN) { + if (!menu.previewCollapsed && menu.collapsed) { + return new CollapseMenuAction(MenuID.PUBLIC); + } + } + return { type: 'NO_ACTION' }; + })); + })); + } + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], NavbarEffects.prototype, "resize$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], NavbarEffects.prototype, "routeChange$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], NavbarEffects.prototype, "openAdminSidebar$", void 0); + NavbarEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Actions, MenuService]) + ], NavbarEffects); + return NavbarEffects; +}()); +export { NavbarEffects }; +//# sourceMappingURL=navbar.effects.js.map \ No newline at end of file diff --git a/src/app/navbar/navbar.effects.js.map b/src/app/navbar/navbar.effects.js.map new file mode 100644 index 0000000000..bd26e8b32b --- /dev/null +++ b/src/app/navbar/navbar.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"navbar.effects.js","sourceRoot":"","sources":["navbar.effects.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,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AAI,CACjD,KAAK,EAAE,EACP,GAAG,CAAC,UAAC,IAAe;gBAClB,IAAI,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,KAAK,EAAE;oBAC5B,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,SAAS,EAAE;wBAC5C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;qBAC7C;iBACF;gBACD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;YAC/B,CAAC,CAAC,CAAC,CAAC;QACR,CAAC,CAAC,CACH,CAAC;IAGJ,CAAC;IArCS;QAAT,MAAM,EAAE;;kDAIL;IAMM;QAAT,MAAM,EAAE;;uDAIL;IAKM;QAAT,MAAM,EAAE;;4DAeL;IAxCO,aAAa;QADzB,UAAU,EAAE;iDA0CmB,OAAO,EAAuB,WAAW;OAzC5D,aAAa,CA6CzB;IAAD,oBAAC;CAAA,AA7CD,IA6CC;SA7CY,aAAa"} \ No newline at end of file diff --git a/src/app/navbar/navbar.module.js b/src/app/navbar/navbar.module.js new file mode 100644 index 0000000000..e834bfe183 --- /dev/null +++ b/src/app/navbar/navbar.module.js @@ -0,0 +1,51 @@ +import * as tslib_1 from "tslib"; +import { SharedModule } from '../shared/shared.module'; +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { EffectsModule } from '@ngrx/effects'; +import { CoreModule } from '../core/core.module'; +import { NavbarEffects } from './navbar.effects'; +import { NavbarSectionComponent } from './navbar-section/navbar-section.component'; +import { ExpandableNavbarSectionComponent } from './expandable-navbar-section/expandable-navbar-section.component'; +import { NavbarComponent } from './navbar.component'; +var effects = [ + NavbarEffects +]; +var NavbarModule = /** @class */ (function () { + /** + * This module handles all components and pipes that are necessary for the horizontal navigation bar + */ + function NavbarModule() { + } + NavbarModule = tslib_1.__decorate([ + NgModule({ + imports: [ + CommonModule, + SharedModule, + EffectsModule.forFeature(effects), + CoreModule.forRoot() + ], + declarations: [ + NavbarComponent, + NavbarSectionComponent, + ExpandableNavbarSectionComponent + ], + providers: [], + entryComponents: [ + NavbarSectionComponent, + ExpandableNavbarSectionComponent + ], + exports: [ + NavbarComponent, + NavbarSectionComponent, + ExpandableNavbarSectionComponent + ] + }) + /** + * This module handles all components and pipes that are necessary for the horizontal navigation bar + */ + ], NavbarModule); + return NavbarModule; +}()); +export { NavbarModule }; +//# sourceMappingURL=navbar.module.js.map \ No newline at end of file diff --git a/src/app/navbar/navbar.module.js.map b/src/app/navbar/navbar.module.js.map new file mode 100644 index 0000000000..4fa76c23f8 --- /dev/null +++ b/src/app/navbar/navbar.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"navbar.module.js","sourceRoot":"","sources":["navbar.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,gCAAgC,EAAE,MAAM,iEAAiE,CAAC;AACnH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,IAAM,OAAO,GAAG;IACd,aAAa;CACd,CAAC;AA+BF;IAHA;;OAEG;IACH;IACA,CAAC;IADY,YAAY;QA7BxB,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY;gBACZ,YAAY;gBACZ,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC;gBACjC,UAAU,CAAC,OAAO,EAAE;aACrB;YACD,YAAY,EAAE;gBACZ,eAAe;gBACf,sBAAsB;gBACtB,gCAAgC;aACjC;YACD,SAAS,EAAE,EAEV;YACD,eAAe,EAAE;gBACf,sBAAsB;gBACtB,gCAAgC;aACjC;YACD,OAAO,EAAE;gBACP,eAAe;gBACf,sBAAsB;gBACtB,gCAAgC;aACjC;SACF,CAAC;QAEF;;WAEG;OACU,YAAY,CACxB;IAAD,mBAAC;CAAA,AADD,IACC;SADY,YAAY"} \ No newline at end of file diff --git a/src/app/pagenotfound/pagenotfound.component.js b/src/app/pagenotfound/pagenotfound.component.js new file mode 100644 index 0000000000..b5579673ca --- /dev/null +++ b/src/app/pagenotfound/pagenotfound.component.js @@ -0,0 +1,38 @@ +import * as tslib_1 from "tslib"; +import { ServerResponseService } from '../shared/services/server-response.service'; +import { Component, ChangeDetectionStrategy } from '@angular/core'; +import { AuthService } from '../core/auth/auth.service'; +/** + * This component representing the `PageNotFound` DSpace page. + */ +var PageNotFoundComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {AuthService} authservice + * @param {ServerResponseService} responseService + */ + function PageNotFoundComponent(authservice, responseService) { + this.authservice = authservice; + this.responseService = responseService; + this.responseService.setNotFound(); + } + /** + * Remove redirect url from the state + */ + PageNotFoundComponent.prototype.ngOnInit = function () { + this.authservice.clearRedirectUrl(); + }; + PageNotFoundComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-pagenotfound', + styleUrls: ['./pagenotfound.component.scss'], + templateUrl: './pagenotfound.component.html', + changeDetection: ChangeDetectionStrategy.Default + }), + tslib_1.__metadata("design:paramtypes", [AuthService, ServerResponseService]) + ], PageNotFoundComponent); + return PageNotFoundComponent; +}()); +export { PageNotFoundComponent }; +//# sourceMappingURL=pagenotfound.component.js.map \ No newline at end of file diff --git a/src/app/pagenotfound/pagenotfound.component.js.map b/src/app/pagenotfound/pagenotfound.component.js.map new file mode 100644 index 0000000000..decf78cd28 --- /dev/null +++ b/src/app/pagenotfound/pagenotfound.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pagenotfound.component.js","sourceRoot":"","sources":["pagenotfound.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAU,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD;;GAEG;AAOH;IAEE;;;;;OAKG;IACH,+BAAoB,WAAwB,EAAU,eAAsC;QAAxE,gBAAW,GAAX,WAAW,CAAa;QAAU,oBAAe,GAAf,eAAe,CAAuB;QAC1F,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,wCAAQ,GAAR;QACE,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC;IACtC,CAAC;IAjBU,qBAAqB;QANjC,SAAS,CAAC;YACT,QAAQ,EAAE,iBAAiB;YAC3B,SAAS,EAAE,CAAC,+BAA+B,CAAC;YAC5C,WAAW,EAAE,+BAA+B;YAC5C,eAAe,EAAE,uBAAuB,CAAC,OAAO;SACjD,CAAC;iDASiC,WAAW,EAA2B,qBAAqB;OARjF,qBAAqB,CAmBjC;IAAD,4BAAC;CAAA,AAnBD,IAmBC;SAnBY,qBAAqB"} \ No newline at end of file diff --git a/src/app/shared/alert/alert.component.js b/src/app/shared/alert/alert.component.js new file mode 100644 index 0000000000..bd7b404238 --- /dev/null +++ b/src/app/shared/alert/alert.component.js @@ -0,0 +1,82 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; +import { trigger } from '@angular/animations'; +import { AlertType } from './aletr-type'; +import { fadeOutLeave, fadeOutState } from '../animations/fade'; +/** + * This component allow to create div that uses the Bootstrap's Alerts component. + */ +var AlertComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {ChangeDetectorRef} cdr + */ + function AlertComponent(cdr) { + this.cdr = cdr; + /** + * A boolean representing if alert is dismissible + */ + this.dismissible = false; + /** + * An event fired when alert is dismissed. + */ + this.close = new EventEmitter(); + /** + * The initial animation name + */ + this.animate = 'fadeIn'; + /** + * A boolean representing if alert is dismissed or not + */ + this.dismissed = false; + } + /** + * Dismiss div with animation + */ + AlertComponent.prototype.dismiss = function () { + var _this = this; + if (this.dismissible) { + this.animate = 'fadeOut'; + this.cdr.detectChanges(); + setTimeout(function () { + _this.dismissed = true; + _this.close.emit(); + _this.cdr.detectChanges(); + }, 300); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], AlertComponent.prototype, "content", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], AlertComponent.prototype, "dismissible", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], AlertComponent.prototype, "type", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], AlertComponent.prototype, "close", void 0); + AlertComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-alert', + encapsulation: ViewEncapsulation.None, + animations: [ + trigger('enterLeave', [ + fadeOutLeave, fadeOutState, + ]) + ], + templateUrl: './alert.component.html', + styleUrls: ['./alert.component.scss'] + }), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef]) + ], AlertComponent); + return AlertComponent; +}()); +export { AlertComponent }; +//# sourceMappingURL=alert.component.js.map \ No newline at end of file diff --git a/src/app/shared/alert/alert.component.js.map b/src/app/shared/alert/alert.component.js.map new file mode 100644 index 0000000000..243bcc880a --- /dev/null +++ b/src/app/shared/alert/alert.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"alert.component.js","sourceRoot":"","sources":["alert.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE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AAvDD,IAuDC;SAvDY,cAAc"} \ No newline at end of file diff --git a/src/app/shared/alert/aletr-type.js b/src/app/shared/alert/aletr-type.js new file mode 100644 index 0000000000..cbd99c8234 --- /dev/null +++ b/src/app/shared/alert/aletr-type.js @@ -0,0 +1,8 @@ +export var AlertType; +(function (AlertType) { + AlertType["Success"] = "alert-success"; + AlertType["Error"] = "alert-danger"; + AlertType["Info"] = "alert-info"; + AlertType["Warning"] = "alert-warning"; +})(AlertType || (AlertType = {})); +//# sourceMappingURL=aletr-type.js.map \ No newline at end of file diff --git a/src/app/shared/alert/aletr-type.js.map b/src/app/shared/alert/aletr-type.js.map new file mode 100644 index 0000000000..856e8e7b2f --- /dev/null +++ b/src/app/shared/alert/aletr-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"aletr-type.js","sourceRoot":"","sources":["aletr-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,sCAAyB,CAAA;IACzB,mCAAsB,CAAA;IACtB,gCAAmB,CAAA;IACnB,sCAAyB,CAAA;AAC3B,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB"} \ No newline at end of file diff --git a/src/app/shared/animations/bgColor.js b/src/app/shared/animations/bgColor.js new file mode 100644 index 0000000000..8935f336b4 --- /dev/null +++ b/src/app/shared/animations/bgColor.js @@ -0,0 +1,12 @@ +import { animate, animateChild, group, query, state, style, transition, trigger } from '@angular/animations'; +var startStyle = style({ backgroundColor: '{{ startColor }}' }); +var endStyle = style({ backgroundColor: '{{ endColor }}' }); +export var bgColor = trigger('bgColor', [ + state('startBackground', startStyle, { params: { startColor: '*' } }), + state('endBackground', endStyle, { params: { endColor: '*' } }), + transition('startBackground <=> endBackground', group([ + query('@*', animateChild()), + animate('200ms'), + ])) +]); +//# sourceMappingURL=bgColor.js.map \ No newline at end of file diff --git a/src/app/shared/animations/bgColor.js.map b/src/app/shared/animations/bgColor.js.map new file mode 100644 index 0000000000..34f08a2cc2 --- /dev/null +++ b/src/app/shared/animations/bgColor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bgColor.js","sourceRoot":"","sources":["bgColor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,YAAY,EACZ,KAAK,EAAE,KAAK,EACZ,KAAK,EACL,KAAK,EACL,UAAU,EACV,OAAO,EACR,MAAM,qBAAqB,CAAC;AAE7B,IAAM,UAAU,GAAG,KAAK,CAAC,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAClE,IAAM,QAAQ,GAAG,KAAK,CAAC,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAE9D,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC,SAAS,EACtC;IACE,KAAK,CAAC,iBAAiB,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,CAAC;IACrE,KAAK,CAAC,eAAe,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,CAAC;IAC/D,UAAU,CAAC,mCAAmC,EAC5C,KAAK,CACH;QACE,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC;QAC3B,OAAO,CAAC,OAAO,CAAC;KAEjB,CACF,CAAC;CACL,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/animations/fade.js b/src/app/shared/animations/fade.js new file mode 100644 index 0000000000..dc92c5a630 --- /dev/null +++ b/src/app/shared/animations/fade.js @@ -0,0 +1,30 @@ +import { animate, state, style, transition, trigger } from '@angular/animations'; +export var fadeInState = state('fadeIn', style({ opacity: 1 })); +export var fadeInEnter = transition('* => fadeIn', [ + style({ opacity: 0 }), + animate(300, style({ opacity: 1 })) +]); +var fadeEnter = transition(':enter', [ + style({ opacity: 0 }), + animate(300, style({ opacity: 1 })) +]); +export var fadeOutState = state('fadeOut', style({ opacity: 0 })); +export var fadeOutLeave = transition('fadeIn => fadeOut', [ + style({ opacity: 1 }), + animate(400, style({ opacity: 0 })) +]); +var fadeLeave = transition(':leave', [ + style({ opacity: 0 }), + animate(300, style({ opacity: 1 })) +]); +export var fadeIn = trigger('fadeIn', [ + fadeEnter +]); +export var fadeOut = trigger('fadeOut', [ + fadeLeave +]); +export var fadeInOut = trigger('fadeInOut', [ + fadeEnter, + fadeLeave +]); +//# sourceMappingURL=fade.js.map \ No newline at end of file diff --git a/src/app/shared/animations/fade.js.map b/src/app/shared/animations/fade.js.map new file mode 100644 index 0000000000..0c99723e76 --- /dev/null +++ b/src/app/shared/animations/fade.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fade.js","sourceRoot":"","sources":["fade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,CAAC,IAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAC,CAAC,CAAC,CAAC;AAChE,MAAM,CAAC,IAAM,WAAW,GAAI,UAAU,CAAC,aAAa,EAAE;IACpD,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACrB,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CACpC,CAAC,CAAC;AACH,IAAM,SAAS,GAAI,UAAU,CAAC,QAAQ,EAAE;IACtC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACrB,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,YAAY,GAAG,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAC,CAAC,CAAC,CAAC;AAClE,MAAM,CAAC,IAAM,YAAY,GAAG,UAAU,CAAC,mBAAmB,EAAE;IAC1D,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACrB,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CACpC,CAAC,CAAC;AACH,IAAM,SAAS,GAAI,UAAU,CAAC,QAAQ,EAAE;IACtC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACrB,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE;IACtC,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC,SAAS,EAAE;IACxC,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE;IAC5C,SAAS;IACT,SAAS;CACV,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/animations/focus.js b/src/app/shared/animations/focus.js new file mode 100644 index 0000000000..9d55caeb52 --- /dev/null +++ b/src/app/shared/animations/focus.js @@ -0,0 +1,12 @@ +import { animate, state, transition, trigger, style } from '@angular/animations'; +export var focusShadow = trigger('focusShadow', [ + state('focus', style({ boxShadow: 'rgba(119, 119, 119, 0.6) 0px 0px 6px' })), + state('blur', style({ boxShadow: 'none' })), + transition('focus <=> blur', [animate('250ms')]) +]); +export var focusBackground = trigger('focusBackground', [ + state('focus', style({ backgroundColor: 'rgba(119, 119, 119, 0.1)' })), + state('blur', style({ backgroundColor: 'transparent' })), + transition('focus <=> blur', [animate('250ms')]) +]); +//# sourceMappingURL=focus.js.map \ No newline at end of file diff --git a/src/app/shared/animations/focus.js.map b/src/app/shared/animations/focus.js.map new file mode 100644 index 0000000000..f978a5c9ff --- /dev/null +++ b/src/app/shared/animations/focus.js.map @@ -0,0 +1 @@ +{"version":3,"file":"focus.js","sourceRoot":"","sources":["focus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,CAAC,IAAM,WAAW,GAAG,OAAO,CAAC,aAAa,EAAE;IAEhD,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,sCAAsC,EAAE,CAAC,CAAC;IAE5E,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;IAE3C,UAAU,CAAC,gBAAgB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;CACjD,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,EAAE;IAExD,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,eAAe,EAAE,0BAA0B,EAAE,CAAC,CAAC;IAEtE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,CAAC;IAExD,UAAU,CAAC,gBAAgB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;CACjD,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/animations/fromBottom.js b/src/app/shared/animations/fromBottom.js new file mode 100644 index 0000000000..2447dc0ca7 --- /dev/null +++ b/src/app/shared/animations/fromBottom.js @@ -0,0 +1,22 @@ +import { animate, state, style, transition, trigger } from '@angular/animations'; +export var fromBottomInState = state('fromBottomIn', style({ opacity: 1, transform: 'translateY(0)' })); +export var fromBottomEnter = transition('* => fromBottomIn', [ + style({ opacity: 0, transform: 'translateY(5%)' }), + animate('400ms ease-in-out') +]); +export var fromBottomOutState = state('fromBottomOut', style({ opacity: 0, transform: 'translateY(-5%)' })); +export var fromBottomLeave = transition('fromBottomIn => fromBottomOut', [ + style({ opacity: 1, transform: 'translateY(0)' }), + animate('300ms ease-in-out') +]); +export var fromBottomIn = trigger('fromBottomIn', [ + fromBottomEnter +]); +export var fromBottomOut = trigger('fromBottomOut', [ + fromBottomLeave +]); +export var fromBottomInOut = trigger('fromBottomInOut', [ + fromBottomEnter, + fromBottomLeave +]); +//# sourceMappingURL=fromBottom.js.map \ No newline at end of file diff --git a/src/app/shared/animations/fromBottom.js.map b/src/app/shared/animations/fromBottom.js.map new file mode 100644 index 0000000000..0ee4636ebf --- /dev/null +++ b/src/app/shared/animations/fromBottom.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fromBottom.js","sourceRoot":"","sources":["fromBottom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,CAAC,IAAM,iBAAiB,GAAG,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC,CAAC,CAAC;AACxG,MAAM,CAAC,IAAM,eAAe,GAAG,UAAU,CAAC,mBAAmB,EAAE;IAC7D,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAC,CAAC;IAChD,OAAO,CAAC,mBAAmB,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,kBAAkB,GAAG,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAC,CAAC,CAAC,CAAC;AAC5G,MAAM,CAAC,IAAM,eAAe,GAAG,UAAU,CAAC,+BAA+B,EAAE;IACzE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC;IAC/C,OAAO,CAAC,mBAAmB,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,YAAY,GAAG,OAAO,CAAC,cAAc,EAAE;IAClD,eAAe;CAChB,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,aAAa,GAAG,OAAO,CAAC,eAAe,EAAE;IACpD,eAAe;CAChB,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,EAAE;IACxD,eAAe;IACf,eAAe;CAChB,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/animations/fromLeft.js b/src/app/shared/animations/fromLeft.js new file mode 100644 index 0000000000..ace2e29dac --- /dev/null +++ b/src/app/shared/animations/fromLeft.js @@ -0,0 +1,22 @@ +import { animate, state, style, transition, trigger } from '@angular/animations'; +export var fromLeftInState = state('fromLeftIn', style({ opacity: 1, transform: 'translateX(0)' })); +export var fromLeftEnter = transition('* => fromLeftIn', [ + style({ opacity: 0, transform: 'translateX(-5%)' }), + animate('400ms ease-in-out') +]); +export var fromLeftOutState = state('fromLeftOut', style({ opacity: 0, transform: 'translateX(5%)' })); +export var fromLeftLeave = transition('fromLeftIn => fromLeftOut', [ + style({ opacity: 1, transform: 'translateX(0)' }), + animate('300ms ease-in-out') +]); +export var fromLeftIn = trigger('fromLeftIn', [ + fromLeftEnter +]); +export var fromLeftOut = trigger('fromLeftOut', [ + fromLeftLeave +]); +export var fromLeftInOut = trigger('fromLeftInOut', [ + fromLeftEnter, + fromLeftLeave +]); +//# sourceMappingURL=fromLeft.js.map \ No newline at end of file diff --git a/src/app/shared/animations/fromLeft.js.map b/src/app/shared/animations/fromLeft.js.map new file mode 100644 index 0000000000..12e6f5d440 --- /dev/null +++ b/src/app/shared/animations/fromLeft.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fromLeft.js","sourceRoot":"","sources":["fromLeft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,CAAC,IAAM,eAAe,GAAG,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC,CAAC,CAAC;AACpG,MAAM,CAAC,IAAM,aAAa,GAAG,UAAU,CAAC,iBAAiB,EAAE;IACzD,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAC,CAAC;IACjD,OAAO,CAAC,mBAAmB,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAC,CAAC,CAAC,CAAC;AACvG,MAAM,CAAC,IAAM,aAAa,GAAG,UAAU,CAAC,2BAA2B,EAAE;IACnE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC;IAC/C,OAAO,CAAC,mBAAmB,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE;IAC9C,aAAa;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,WAAW,GAAG,OAAO,CAAC,aAAa,EAAE;IAChD,aAAa;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,aAAa,GAAG,OAAO,CAAC,eAAe,EAAE;IACpD,aAAa;IACb,aAAa;CACd,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/animations/fromRight.js b/src/app/shared/animations/fromRight.js new file mode 100644 index 0000000000..9c6aabb23f --- /dev/null +++ b/src/app/shared/animations/fromRight.js @@ -0,0 +1,22 @@ +import { animate, state, style, transition, trigger } from '@angular/animations'; +export var fromRightInState = state('fromRightIn', style({ opacity: 1, transform: 'translateX(0)' })); +export var fromRightEnter = transition('* => fromRightIn', [ + style({ opacity: 0, transform: 'translateX(5%)' }), + animate('400ms ease-in-out') +]); +export var fromRightOutState = state('fromRightOut', style({ opacity: 0, transform: 'translateX(-5%)' })); +export var fromRightLeave = transition('fromRightIn => fromRightOut', [ + style({ opacity: 1, transform: 'translateX(0)' }), + animate('300ms ease-in-out') +]); +export var fromRightIn = trigger('fromRightIn', [ + fromRightEnter +]); +export var fromRightOut = trigger('fromRightOut', [ + fromRightLeave +]); +export var fromRightInOut = trigger('fromRightInOut', [ + fromRightEnter, + fromRightLeave +]); +//# sourceMappingURL=fromRight.js.map \ No newline at end of file diff --git a/src/app/shared/animations/fromRight.js.map b/src/app/shared/animations/fromRight.js.map new file mode 100644 index 0000000000..2fb535b538 --- /dev/null +++ b/src/app/shared/animations/fromRight.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fromRight.js","sourceRoot":"","sources":["fromRight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,CAAC,IAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC,CAAC,CAAC;AACtG,MAAM,CAAC,IAAM,cAAc,GAAG,UAAU,CAAC,kBAAkB,EAAE;IAC3D,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAC,CAAC;IAChD,OAAO,CAAC,mBAAmB,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,iBAAiB,GAAG,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAC,CAAC,CAAC,CAAC;AAC1G,MAAM,CAAC,IAAM,cAAc,GAAG,UAAU,CAAC,6BAA6B,EAAE;IACtE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC;IAC/C,OAAO,CAAC,mBAAmB,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,WAAW,GAAG,OAAO,CAAC,aAAa,EAAE;IAChD,cAAc;CACf,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,YAAY,GAAG,OAAO,CAAC,cAAc,EAAE;IAClD,cAAc;CACf,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,EAAE;IACtD,cAAc;IACd,cAAc;CACf,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/animations/fromTop.js b/src/app/shared/animations/fromTop.js new file mode 100644 index 0000000000..9c65ebae57 --- /dev/null +++ b/src/app/shared/animations/fromTop.js @@ -0,0 +1,22 @@ +import { animate, state, style, transition, trigger } from '@angular/animations'; +export var fromTopInState = state('fromTopIn', style({ opacity: 1, transform: 'translateY(0)' })); +export var fromTopEnter = transition('* => fromTopIn', [ + style({ opacity: 0, transform: 'translateY(-5%)' }), + animate('400ms ease-in-out') +]); +export var fromTopOutState = state('fromTopOut', style({ opacity: 0, transform: 'translateY(5%)' })); +export var fromTopLeave = transition('fromTopIn => fromTopOut', [ + style({ opacity: 1, transform: 'translateY(0)' }), + animate('300ms ease-in-out') +]); +export var fromTopIn = trigger('fromTopIn', [ + fromTopEnter +]); +export var fromTopOut = trigger('fromTopOut', [ + fromTopLeave +]); +export var fromTopInOut = trigger('fromTopInOut', [ + fromTopEnter, + fromTopLeave +]); +//# sourceMappingURL=fromTop.js.map \ No newline at end of file diff --git a/src/app/shared/animations/fromTop.js.map b/src/app/shared/animations/fromTop.js.map new file mode 100644 index 0000000000..442316ab09 --- /dev/null +++ b/src/app/shared/animations/fromTop.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fromTop.js","sourceRoot":"","sources":["fromTop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,CAAC,IAAM,cAAc,GAAG,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC,CAAC,CAAC;AAClG,MAAM,CAAC,IAAM,YAAY,GAAG,UAAU,CAAC,gBAAgB,EAAE;IACvD,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAC,CAAC;IACjD,OAAO,CAAC,mBAAmB,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,eAAe,GAAG,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAC,CAAC,CAAC,CAAC;AACrG,MAAM,CAAC,IAAM,YAAY,GAAG,UAAU,CAAC,yBAAyB,EAAE;IAChE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC;IAC/C,OAAO,CAAC,mBAAmB,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE;IAC5C,YAAY;CACb,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE;IAC9C,YAAY;CACb,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,YAAY,GAAG,OAAO,CAAC,cAAc,EAAE;IAClD,YAAY;IACZ,YAAY;CACb,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/animations/overlay.js b/src/app/shared/animations/overlay.js new file mode 100644 index 0000000000..168cac167e --- /dev/null +++ b/src/app/shared/animations/overlay.js @@ -0,0 +1,7 @@ +import { animate, state, transition, trigger, style } from '@angular/animations'; +export var overlay = trigger('overlay', [ + state('show', style({ opacity: 0.5 })), + state('hide', style({ opacity: 0 })), + transition('show <=> hide', animate(250)) +]); +//# sourceMappingURL=overlay.js.map \ No newline at end of file diff --git a/src/app/shared/animations/overlay.js.map b/src/app/shared/animations/overlay.js.map new file mode 100644 index 0000000000..4a7b1ff05a --- /dev/null +++ b/src/app/shared/animations/overlay.js.map @@ -0,0 +1 @@ +{"version":3,"file":"overlay.js","sourceRoot":"","sources":["overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC,SAAS,EAAE;IAExC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAEtC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAEpC,UAAU,CAAC,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;CAC1C,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/animations/push.js b/src/app/shared/animations/push.js new file mode 100644 index 0000000000..42a0cf191b --- /dev/null +++ b/src/app/shared/animations/push.js @@ -0,0 +1,12 @@ +import { animate, state, transition, trigger, style } from '@angular/animations'; +export var pushInOut = trigger('pushInOut', [ + /* + state('expanded', style({ right: '100%' })); + + state('collapsed', style({ right: 0 })); + */ + state('expanded', style({ left: '100%' })), + state('collapsed', style({ left: 0 })), + transition('expanded <=> collapsed', animate(250)), +]); +//# sourceMappingURL=push.js.map \ No newline at end of file diff --git a/src/app/shared/animations/push.js.map b/src/app/shared/animations/push.js.map new file mode 100644 index 0000000000..e13df10003 --- /dev/null +++ b/src/app/shared/animations/push.js.map @@ -0,0 +1 @@ +{"version":3,"file":"push.js","sourceRoot":"","sources":["push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,CAAC,IAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE;IAE5C;;;;IAIA;IAEA,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAE1C,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IAEtC,UAAU,CAAC,wBAAwB,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;CACnD,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/animations/rotate.js b/src/app/shared/animations/rotate.js new file mode 100644 index 0000000000..6fcd8586cf --- /dev/null +++ b/src/app/shared/animations/rotate.js @@ -0,0 +1,31 @@ +import { animate, state, style, transition, trigger } from '@angular/animations'; +export var rotateInState = state('rotateIn', style({ opacity: 1, transform: 'rotate(0deg)' })); +export var rotateEnter = transition('* => rotateIn', [ + style({ opacity: 0, transform: 'rotate(5deg)' }), + animate('400ms ease-in-out') +]); +export var rotateOutState = state('rotateOut', style({ opacity: 0, transform: 'rotate(5deg)' })); +export var rotateLeave = transition('rotateIn => rotateOut', [ + style({ opacity: 1, transform: 'rotate(0deg)' }), + animate('400ms ease-in-out') +]); +export var rotateIn = trigger('rotateIn', [ + rotateEnter +]); +export var rotateOut = trigger('rotateOut', [ + rotateLeave +]); +export var rotateInOut = trigger('rotateInOut', [ + rotateEnter, + rotateLeave +]); +var expandedStyle = { transform: 'rotate(90deg)' }; +var collapsedStyle = { transform: 'rotate(0deg)' }; +export var rotate = trigger('rotate', [ + state('expanded', style(expandedStyle)), + state('collapsed', style(collapsedStyle)), + transition('expanded <=> collapsed', [ + animate('200ms') + ]) +]); +//# sourceMappingURL=rotate.js.map \ No newline at end of file diff --git a/src/app/shared/animations/rotate.js.map b/src/app/shared/animations/rotate.js.map new file mode 100644 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Ae,EAAE,CAAC;AACrD,IAAM,cAAc,GAAG,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;AAErD,MAAM,CAAC,IAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,EACpC;IACE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACvC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACzC,UAAU,CAAC,wBAAwB,EAAE;QACnC,OAAO,CAAC,OAAO,CAAC;KACjB,CAAC;CAEH,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/animations/scale.js b/src/app/shared/animations/scale.js new file mode 100644 index 0000000000..0b957dcef0 --- /dev/null +++ b/src/app/shared/animations/scale.js @@ -0,0 +1,22 @@ +import { animate, state, style, transition, trigger } from '@angular/animations'; +export var scaleInState = state('scaleIn', style({ opacity: 1, transform: 'scale(1)' })); +export var scaleEnter = transition('* => scaleIn', [ + style({ opacity: 0, transform: 'scale(0)' }), + animate('400ms ease-in-out') +]); +export var scaleOutState = state('scaleOut', style({ opacity: 0, transform: 'scale(0)' })); +export var scaleLeave = transition('scaleIn => scaleOut', [ + style({ opacity: 1, transform: 'scale(1)' }), + animate('400ms ease-in-out') +]); +export var scaleIn = trigger('scaleIn', [ + scaleEnter +]); +export var scaleOut = trigger('scaleOut', [ + scaleLeave +]); +export var scaleInOut = trigger('scaleInOut', [ + scaleEnter, + scaleLeave +]); +//# sourceMappingURL=scale.js.map \ No newline at end of file diff --git a/src/app/shared/animations/scale.js.map b/src/app/shared/animations/scale.js.map new file mode 100644 index 0000000000..210c724577 --- /dev/null +++ b/src/app/shared/animations/scale.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scale.js","sourceRoot":"","sources":["scale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,CAAC,IAAM,YAAY,GAAG,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAC,CAAC,CAAC,CAAC;AACzF,MAAM,CAAC,IAAM,UAAU,GAAI,UAAU,CAAC,cAAc,EAAE;IACpD,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAC,CAAC;IAC1C,OAAO,CAAC,mBAAmB,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,aAAa,GAAG,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAC,CAAC,CAAC,CAAC;AAC3F,MAAM,CAAC,IAAM,UAAU,GAAG,UAAU,CAAC,qBAAqB,EAAE;IAC1D,KAAK,CAAC,EAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAC,CAAC;IAC1C,OAAO,CAAC,mBAAmB,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC,SAAS,EAAE;IACxC,UAAU;CACX,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE;IAC1C,UAAU;CACX,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,UAAU,GAAG,OAAO,CAAC,YAAY,EAAE;IAC9C,UAAU;IACV,UAAU;CACX,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/animations/shrink.js b/src/app/shared/animations/shrink.js new file mode 100644 index 0000000000..219953756f --- /dev/null +++ b/src/app/shared/animations/shrink.js @@ -0,0 +1,13 @@ +import { animate, state, style, transition, trigger } from '@angular/animations'; +export var shrinkInOut = trigger('shrinkInOut', [ + state('in', style({ height: '100%', opacity: 1 })), + transition('* => void', [ + style({ height: '!', opacity: 1 }), + animate(200, style({ height: 0, opacity: 0 })) + ]), + transition('void => *', [ + style({ height: 0, opacity: 0 }), + animate(200, style({ height: '*', opacity: 1 })) + ]) +]); +//# sourceMappingURL=shrink.js.map \ No newline at end of file diff --git a/src/app/shared/animations/shrink.js.map b/src/app/shared/animations/shrink.js.map new file mode 100644 index 0000000000..084ccfa583 --- /dev/null +++ b/src/app/shared/animations/shrink.js.map @@ -0,0 +1 @@ +{"version":3,"file":"shrink.js","sourceRoot":"","sources":["shrink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,CAAC,IAAM,WAAW,GAAG,OAAO,CAAC,aAAa,EAAE;IAChD,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAC,CAAC,CAAC;IAChD,UAAU,CAAC,WAAW,EAAE;QACtB,KAAK,CAAC,EAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,EAAC,CAAC;QAChC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,EAAC,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAC,CAAC,CAAC;KAC7C,CAAC;IACF,UAAU,CAAC,WAAW,EAAE;QACtB,KAAK,CAAC,EAAC,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,EAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,EAAC,CAAC,CAAC;KAC/C,CAAC;CACH,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/animations/slide.js b/src/app/shared/animations/slide.js new file mode 100644 index 0000000000..ee6098ab69 --- /dev/null +++ b/src/app/shared/animations/slide.js @@ -0,0 +1,45 @@ +import { animate, animateChild, group, query, state, style, transition, trigger } from '@angular/animations'; +export var slide = trigger('slide', [ + state('expanded', style({ height: '*' })), + state('collapsed', style({ height: 0 })), + state('void', style({ height: 0 })), + state('*', style({ height: '*' })), + transition(':enter', [animate('200ms')]), + transition(':leave', [animate('200ms')]), + transition('expanded <=> collapsed', animate(250)) +]); +export var slideHorizontal = trigger('slideHorizontal', [ + state('void', style({ width: 0 })), + state('*', style({ width: '*' })), + transition(':enter', [animate('200ms')]), + transition(':leave', [animate('200ms')]) +]); +export var slideMobileNav = trigger('slideMobileNav', [ + state('expanded', style({ height: '100vh' })), + state('collapsed', style({ height: 0 })), + transition('expanded <=> collapsed', animate('300ms')) +]); +var collapsedStyle = style({ marginLeft: '-{{ sidebarWidth }}' }); +var expandedStyle = style({ marginLeft: '0' }); +var options = { params: { sidebarWidth: '*' } }; +export var slideSidebar = trigger('slideSidebar', [ + transition('expanded => collapsed', group([ + query('@*', animateChild()), + query('.sidebar-collapsible', expandedStyle, options), + query('.sidebar-collapsible', animate('300ms ease-in-out', collapsedStyle)) + ])), + transition('collapsed => expanded', group([ + query('@*', animateChild()), + query('.sidebar-collapsible', collapsedStyle), + query('.sidebar-collapsible', animate('300ms ease-in-out', expandedStyle), options) + ])) +]); +export var slideSidebarPadding = trigger('slideSidebarPadding', [ + state('hidden', style({ paddingLeft: 0 })), + state('shown', style({ paddingLeft: '{{ collapsedSidebarWidth }}' }), { params: { collapsedSidebarWidth: '*' } }), + state('expanded', style({ paddingLeft: '{{ totalSidebarWidth }}' }), { params: { totalSidebarWidth: '*' } }), + transition('hidden <=> shown', [animate('200ms')]), + transition('hidden <=> expanded', [animate('200ms')]), + transition('shown <=> expanded', [animate('200ms')]), +]); +//# sourceMappingURL=slide.js.map \ No newline at end of file diff --git a/src/app/shared/animations/slide.js.map b/src/app/shared/animations/slide.js.map new file mode 100644 index 0000000000..d21fb79207 --- /dev/null +++ b/src/app/shared/animations/slide.js.map @@ -0,0 +1 @@ +{"version":3,"file":"slide.js","sourceRoot":"","sources":["slide.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,Y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AE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,qBAAqB,EAAE,GAAG,EAAE,EAAE,CAAC;IACjH,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,iBAAiB,EAAE,GAAG,EAAE,EAAE,CAAC;IAC5G,UAAU,CAAC,kBAAkB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,UAAU,CAAC,qBAAqB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACrD,UAAU,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;CACrD,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/auth-nav-menu/auth-nav-menu.component.js b/src/app/shared/auth-nav-menu/auth-nav-menu.component.js new file mode 100644 index 0000000000..828f0e88f8 --- /dev/null +++ b/src/app/shared/auth-nav-menu/auth-nav-menu.component.js @@ -0,0 +1,41 @@ +import * as tslib_1 from "tslib"; +import { of as observableOf } from 'rxjs'; +import { filter, map } from 'rxjs/operators'; +import { Component } from '@angular/core'; +import { select, Store } from '@ngrx/store'; +import { fadeInOut, fadeOut } from '../animations/fade'; +import { HostWindowService } from '../host-window.service'; +import { routerStateSelector } from '../../app.reducer'; +import { isNotUndefined } from '../empty.util'; +import { getAuthenticatedUser, isAuthenticated, isAuthenticationLoading } from '../../core/auth/selectors'; +import { LOGIN_ROUTE, LOGOUT_ROUTE } from '../../core/auth/auth.service'; +var AuthNavMenuComponent = /** @class */ (function () { + function AuthNavMenuComponent(store, windowService) { + this.store = store; + this.windowService = windowService; + this.showAuth = observableOf(false); + this.isXsOrSm$ = this.windowService.isXsOrSm(); + } + AuthNavMenuComponent.prototype.ngOnInit = function () { + // set isAuthenticated + this.isAuthenticated = this.store.pipe(select(isAuthenticated)); + // set loading + this.loading = this.store.pipe(select(isAuthenticationLoading)); + this.user = this.store.pipe(select(getAuthenticatedUser)); + this.showAuth = this.store.pipe(select(routerStateSelector), filter(function (router) { return isNotUndefined(router) && isNotUndefined(router.state); }), map(function (router) { return (!router.state.url.startsWith(LOGIN_ROUTE) + && !router.state.url.startsWith(LOGOUT_ROUTE)); })); + }; + AuthNavMenuComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-auth-nav-menu', + templateUrl: './auth-nav-menu.component.html', + styleUrls: ['./auth-nav-menu.component.scss'], + animations: [fadeInOut, fadeOut] + }), + tslib_1.__metadata("design:paramtypes", [Store, + HostWindowService]) + ], AuthNavMenuComponent); + return AuthNavMenuComponent; +}()); +export { AuthNavMenuComponent }; +//# sourceMappingURL=auth-nav-menu.component.js.map \ No newline at end of file diff --git a/src/app/shared/auth-nav-menu/auth-nav-menu.component.js.map b/src/app/shared/auth-nav-menu/auth-nav-menu.component.js.map new file mode 100644 index 0000000000..85e26fb386 --- /dev/null +++ b/src/app/shared/auth-nav-menu/auth-nav-menu.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-nav-menu.component.js","sourceRoot":"","sources":["auth-nav-menu.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAc,EAAE,IAAI,YAAY,EAAgB,MAAM,MAAM,CAAC;AAEpE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAY,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,2B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C,SAAS,EAAE,CAAC,gCAAgC,CAAC;YAC7C,UAAU,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;SACjC,CAAC;iDAsB2B,KAAK;YACG,iBAAiB;OAtBzC,oBAAoB,CA4ChC;IAAD,2BAAC;CAAA,AA5CD,IA4CC;SA5CY,oBAAoB"} \ No newline at end of file diff --git a/src/app/shared/auth-nav-menu/user-menu/user-menu.component.js b/src/app/shared/auth-nav-menu/user-menu/user-menu.component.js new file mode 100644 index 0000000000..1137f082db --- /dev/null +++ b/src/app/shared/auth-nav-menu/user-menu/user-menu.component.js @@ -0,0 +1,38 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { select, Store } from '@ngrx/store'; +import { getAuthenticatedUser, isAuthenticationLoading } from '../../../core/auth/selectors'; +import { MYDSPACE_ROUTE } from '../../../+my-dspace-page/my-dspace-page.component'; +/** + * This component represents the user nav menu. + */ +var UserMenuComponent = /** @class */ (function () { + function UserMenuComponent(store) { + this.store = store; + /** + * The mydspace page route. + * @type {string} + */ + this.mydspaceRoute = MYDSPACE_ROUTE; + } + /** + * Initialize all instance variables + */ + UserMenuComponent.prototype.ngOnInit = function () { + // set loading + this.loading$ = this.store.pipe(select(isAuthenticationLoading)); + // set user + this.user$ = this.store.pipe(select(getAuthenticatedUser)); + }; + UserMenuComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-user-menu', + templateUrl: './user-menu.component.html', + styleUrls: ['./user-menu.component.scss'] + }), + tslib_1.__metadata("design:paramtypes", [Store]) + ], UserMenuComponent); + return UserMenuComponent; +}()); +export { UserMenuComponent }; +//# sourceMappingURL=user-menu.component.js.map \ No newline at end of file diff --git a/src/app/shared/auth-nav-menu/user-menu/user-menu.component.js.map b/src/app/shared/auth-nav-menu/user-menu/user-menu.component.js.map new file mode 100644 index 0000000000..ce06b1675a --- /dev/null +++ b/src/app/shared/auth-nav-menu/user-menu/user-menu.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"user-menu.component.js","sourceRoot":"","sources":["user-menu.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAGlD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,mDAAmD,CAAC;AAEnF;;GAEG;AAMH;IAoBE,2BAAoB,KAAsB;QAAtB,UAAK,GAAL,KAAK,CAAiB;QAN1C;;;WAGG;QACI,kBAAa,GAAG,cAAc,CAAC;IAGtC,CAAC;IAED;;OAEG;IACH,oCAAQ,GAAR;QAEE,cAAc;QACd,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAEjE,WAAW;QACX,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAE7D,CAAC;IAlCU,iBAAiB;QAL7B,SAAS,CAAC;YACT,QAAQ,EAAE,cAAc;YACxB,WAAW,EAAE,4BAA4B;YACzC,SAAS,EAAE,CAAC,4BAA4B,CAAC;SAC1C,CAAC;iDAqB2B,KAAK;OApBrB,iBAAiB,CAmC7B;IAAD,wBAAC;CAAA,AAnCD,IAmCC;SAnCY,iBAAiB"} \ No newline at end of file diff --git a/src/app/shared/authority-confidence/authority-confidence-state.directive.js b/src/app/shared/authority-confidence/authority-confidence-state.directive.js new file mode 100644 index 0000000000..85001ab2b9 --- /dev/null +++ b/src/app/shared/authority-confidence/authority-confidence-state.directive.js @@ -0,0 +1,134 @@ +import * as tslib_1 from "tslib"; +import { Directive, ElementRef, EventEmitter, HostListener, Inject, Input, Output, Renderer2 } from '@angular/core'; +import { findIndex } from 'lodash'; +import { AuthorityValue } from '../../core/integration/models/authority.value'; +import { FormFieldMetadataValueObject } from '../form/builder/models/form-field-metadata-value.model'; +import { ConfidenceType } from '../../core/integration/models/confidence-type'; +import { isNotEmpty, isNull } from '../empty.util'; +import { GLOBAL_CONFIG } from '../../../config'; +/** + * Directive to add to the element a bootstrap utility class based on metadata confidence value + */ +var AuthorityConfidenceStateDirective = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {GlobalConfig} EnvConfig + * @param {ElementRef} elem + * @param {Renderer2} renderer + */ + function AuthorityConfidenceStateDirective(EnvConfig, elem, renderer) { + this.EnvConfig = EnvConfig; + this.elem = elem; + this.renderer = renderer; + /** + * A boolean representing if to show html icon if authority value is empty + */ + this.visibleWhenAuthorityEmpty = true; + /** + * The css class applied before directive changes + */ + this.previousClass = null; + /** + * An event fired when click on element that has a confidence value empty or different from CF_ACCEPTED + */ + this.whenClickOnConfidenceNotAccepted = new EventEmitter(); + } + /** + * Listener to click event + */ + AuthorityConfidenceStateDirective.prototype.onClick = function () { + if (isNotEmpty(this.authorityValue) && this.getConfidenceByValue(this.authorityValue) !== ConfidenceType.CF_ACCEPTED) { + this.whenClickOnConfidenceNotAccepted.emit(this.getConfidenceByValue(this.authorityValue)); + } + }; + /** + * Apply css class to element whenever authority value change + * + * @param {SimpleChanges} changes + */ + AuthorityConfidenceStateDirective.prototype.ngOnChanges = function (changes) { + if (!changes.authorityValue.firstChange) { + this.previousClass = this.getClassByConfidence(this.getConfidenceByValue(changes.authorityValue.previousValue)); + } + this.newClass = this.getClassByConfidence(this.getConfidenceByValue(changes.authorityValue.currentValue)); + if (isNull(this.previousClass)) { + this.renderer.addClass(this.elem.nativeElement, this.newClass); + } + else if (this.previousClass !== this.newClass) { + this.renderer.removeClass(this.elem.nativeElement, this.previousClass); + this.renderer.addClass(this.elem.nativeElement, this.newClass); + } + }; + /** + * Apply css class to element after view init + */ + AuthorityConfidenceStateDirective.prototype.ngAfterViewInit = function () { + if (isNull(this.previousClass)) { + this.renderer.addClass(this.elem.nativeElement, this.newClass); + } + else if (this.previousClass !== this.newClass) { + this.renderer.removeClass(this.elem.nativeElement, this.previousClass); + this.renderer.addClass(this.elem.nativeElement, this.newClass); + } + }; + /** + * Return confidence value as ConfidenceType + * + * @param value + */ + AuthorityConfidenceStateDirective.prototype.getConfidenceByValue = function (value) { + var confidence = ConfidenceType.CF_UNSET; + if (isNotEmpty(value) && value instanceof AuthorityValue && value.hasAuthority()) { + confidence = ConfidenceType.CF_ACCEPTED; + } + if (isNotEmpty(value) && value instanceof FormFieldMetadataValueObject) { + confidence = value.confidence; + } + return confidence; + }; + /** + * Return the properly css class based on confidence value + * + * @param confidence + */ + AuthorityConfidenceStateDirective.prototype.getClassByConfidence = function (confidence) { + if (!this.visibleWhenAuthorityEmpty && confidence === ConfidenceType.CF_UNSET) { + return 'd-none'; + } + var confidenceIcons = this.EnvConfig.submission.icons.authority.confidence; + var confidenceIndex = findIndex(confidenceIcons, { value: confidence }); + var defaultconfidenceIndex = findIndex(confidenceIcons, { value: 'default' }); + var defaultClass = (defaultconfidenceIndex !== -1) ? confidenceIcons[defaultconfidenceIndex].style : ''; + return (confidenceIndex !== -1) ? confidenceIcons[confidenceIndex].style : defaultClass; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], AuthorityConfidenceStateDirective.prototype, "authorityValue", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], AuthorityConfidenceStateDirective.prototype, "visibleWhenAuthorityEmpty", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], AuthorityConfidenceStateDirective.prototype, "whenClickOnConfidenceNotAccepted", void 0); + tslib_1.__decorate([ + HostListener('click'), + tslib_1.__metadata("design:type", Function), + tslib_1.__metadata("design:paramtypes", []), + tslib_1.__metadata("design:returntype", void 0) + ], AuthorityConfidenceStateDirective.prototype, "onClick", null); + AuthorityConfidenceStateDirective = tslib_1.__decorate([ + Directive({ + selector: '[dsAuthorityConfidenceState]' + }), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, ElementRef, + Renderer2]) + ], AuthorityConfidenceStateDirective); + return AuthorityConfidenceStateDirective; +}()); +export { AuthorityConfidenceStateDirective }; +//# sourceMappingURL=authority-confidence-state.directive.js.map \ No newline at end of file diff --git a/src/app/shared/authority-confidence/authority-confidence-state.directive.js.map b/src/app/shared/authority-confidence/authority-confidence-state.directive.js.map new file mode 100644 index 0000000000..397f4923c4 --- /dev/null +++ b/src/app/shared/authority-confidence/authority-confidence-state.directive.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authority-confidence-state.directive.js","sourceRoot":"","sources":["authority-confidence-state.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,UAAU,EAAE,YAAY,EACxB,YAAY,EACZ,MAAM,EACN,KAAK,EAEL,MAAM,EACN,SAAS,EAEV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,aAAa,EAAgB,MAAM,iBAAiB,CAAC;AAG9D;;GAEG;AAIH;IAoCE;;;;;;OAMG;IACH,2CACmC,SAAuB,EAChD,IAAgB,EAChB,QAAmB;QAFM,cAAS,GAAT,SAAS,CAAc;QAChD,SAAI,GAAJ,IAAI,CAAY;QAChB,aAAQ,GAAR,QAAQ,CAAW;QAvC7B;;WAEG;QACM,8BAAyB,GAAG,IAAI,CAAC;QAE1C;;WAEG;QACK,kBAAa,GAAW,IAAI,CAAC;QAOrC;;WAEG;QACO,qCAAgC,GAAiC,IAAI,YAAY,EAAkB,CAAC;IAuB9G,CAAC;IArB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C,CAAC,CAAC;QAC9F,IAAM,YAAY,GAAW,CAAC,sBAAsB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAElH,OAAO,CAAC,eAAe,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC;IAC1F,CAAC;IAjHQ;QAAR,KAAK,EAAE;;6EAAwE;IAKvE;QAAR,KAAK,EAAE;;wFAAkC;IAehC;QAAT,MAAM,EAAE;0CAAmC,YAAY;+FAAsD;IAKvF;QAAtB,YAAY,CAAC,OAAO,CAAC;;;;oEAIrB;IAlCU,iCAAiC;QAH7C,SAAS,CAAC;YACT,QAAQ,EAAE,8BAA8B;SACzC,CAAC;QA6CG,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACR,UAAU;YACN,SAAS;OA9ClB,iCAAiC,CAwH7C;IAAD,wCAAC;CAAA,AAxHD,IAwHC;SAxHY,iCAAiC"} \ No newline at end of file diff --git a/src/app/shared/browse-by/browse-by.component.js b/src/app/shared/browse-by/browse-by.component.js new file mode 100644 index 0000000000..af012851bb --- /dev/null +++ b/src/app/shared/browse-by/browse-by.component.js @@ -0,0 +1,157 @@ +import * as tslib_1 from "tslib"; +import { Component, EventEmitter, Injector, Input, Output } from '@angular/core'; +import { PaginationComponentOptions } from '../pagination/pagination-component-options.model'; +import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; +import { fadeIn, fadeInOut } from '../animations/fade'; +import { Observable } from 'rxjs'; +import { getStartsWithComponent, StartsWithType } from '../starts-with/starts-with-decorator'; +var BrowseByComponent = /** @class */ (function () { + function BrowseByComponent(injector) { + this.injector = injector; + /** + * The type of StartsWith options used to define what component to render for the options + * Defaults to text + */ + this.type = StartsWithType.text; + /** + * The list of options to render for the StartsWith component + */ + this.startsWithOptions = []; + /** + * Whether or not the pagination should be rendered as simple previous and next buttons instead of the normal pagination + */ + this.enableArrows = false; + /** + * If enableArrows is set to true, should it hide the options gear? + */ + this.hideGear = false; + /** + * If enableArrows is set to true, emit when the previous button is clicked + */ + this.prev = new EventEmitter(); + /** + * If enableArrows is set to true, emit when the next button is clicked + */ + this.next = new EventEmitter(); + /** + * If enableArrows is set to true, emit when the page size is changed + */ + this.pageSizeChange = new EventEmitter(); + /** + * If enableArrows is set to true, emit when the sort direction is changed + */ + this.sortDirectionChange = new EventEmitter(); + /** + * Declare SortDirection enumeration to use it in the template + */ + this.sortDirections = SortDirection; + } + /** + * Go to the previous page + */ + BrowseByComponent.prototype.goPrev = function () { + this.prev.emit(true); + }; + /** + * Go to the next page + */ + BrowseByComponent.prototype.goNext = function () { + this.next.emit(true); + }; + /** + * Change the page size + * @param size + */ + BrowseByComponent.prototype.doPageSizeChange = function (size) { + this.paginationConfig.pageSize = size; + this.pageSizeChange.emit(size); + }; + /** + * Change the sort direction + * @param direction + */ + BrowseByComponent.prototype.doSortDirectionChange = function (direction) { + this.sortConfig.direction = direction; + this.sortDirectionChange.emit(direction); + }; + /** + * Get the switchable StartsWith component dependant on the type + */ + BrowseByComponent.prototype.getStartsWithComponent = function () { + return getStartsWithComponent(this.type); + }; + BrowseByComponent.prototype.ngOnInit = function () { + var _this = this; + this.objectInjector = Injector.create({ + providers: [{ provide: 'startsWithOptions', useFactory: function () { return (_this.startsWithOptions); }, deps: [] }], + parent: this.injector + }); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], BrowseByComponent.prototype, "title", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Observable) + ], BrowseByComponent.prototype, "objects$", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", PaginationComponentOptions) + ], BrowseByComponent.prototype, "paginationConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SortOptions) + ], BrowseByComponent.prototype, "sortConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], BrowseByComponent.prototype, "type", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], BrowseByComponent.prototype, "startsWithOptions", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], BrowseByComponent.prototype, "enableArrows", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], BrowseByComponent.prototype, "hideGear", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], BrowseByComponent.prototype, "prev", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], BrowseByComponent.prototype, "next", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], BrowseByComponent.prototype, "pageSizeChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], BrowseByComponent.prototype, "sortDirectionChange", void 0); + BrowseByComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-browse-by', + styleUrls: ['./browse-by.component.scss'], + templateUrl: './browse-by.component.html', + animations: [ + fadeIn, + fadeInOut + ] + }) + /** + * Component to display a browse-by page for any ListableObject + */ + , + tslib_1.__metadata("design:paramtypes", [Injector]) + ], BrowseByComponent); + return BrowseByComponent; +}()); +export { BrowseByComponent }; +//# sourceMappingURL=browse-by.component.js.map \ No newline at end of file diff --git a/src/app/shared/browse-by/browse-by.component.js.map b/src/app/shared/browse-by/browse-by.component.js.map new file mode 100644 index 0000000000..28f67adaaa --- /dev/null +++ b/src/app/shared/browse-by/browse-by.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-by.component.js","sourceRoot":"","sources":["browse-by.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAGzF,OAAO,EAAE,0B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AiB,CA0H7B;IAAD,wBAAC;CAAA,AA1HD,IA0HC;SA1HY,iBAAiB"} \ No newline at end of file diff --git a/src/app/shared/chips/chips.component.js b/src/app/shared/chips/chips.component.js new file mode 100644 index 0000000000..3b806df7d9 --- /dev/null +++ b/src/app/shared/chips/chips.component.js @@ -0,0 +1,136 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, EventEmitter, Input, Output, } from '@angular/core'; +import { isObject } from 'lodash'; +import { Chips } from './models/chips.model'; +import { UploaderService } from '../uploader/uploader.service'; +import { TranslateService } from '@ngx-translate/core'; +var ChipsComponent = /** @class */ (function () { + function ChipsComponent(cdr, uploaderService, translate) { + this.cdr = cdr; + this.uploaderService = uploaderService; + this.translate = translate; + this.editable = true; + this.showIcons = false; + this.selected = new EventEmitter(); + this.remove = new EventEmitter(); + this.change = new EventEmitter(); + this.dragged = -1; + this.options = { + animation: 300, + chosenClass: 'm-0', + dragClass: 'm-0', + filter: '.chips-sort-ignore', + ghostClass: 'm-0' + }; + } + ChipsComponent.prototype.ngOnChanges = function (changes) { + if (changes.chips && !changes.chips.isFirstChange()) { + this.chips = changes.chips.currentValue; + } + }; + ChipsComponent.prototype.chipsSelected = function (event, index) { + event.preventDefault(); + if (this.editable) { + this.chips.getChips().forEach(function (item, i) { + if (i === index) { + item.setEditMode(); + } + else { + item.unsetEditMode(); + } + }); + this.selected.emit(index); + } + }; + ChipsComponent.prototype.removeChips = function (event, index) { + event.preventDefault(); + event.stopPropagation(); + // Can't remove if this element is in editMode + if (!this.chips.getChipByIndex(index).editMode) { + this.chips.remove(this.chips.getChipByIndex(index)); + } + }; + ChipsComponent.prototype.onDragStart = function (index) { + this.uploaderService.overrideDragOverPage(); + this.dragged = index; + }; + ChipsComponent.prototype.onDragEnd = function (event) { + this.uploaderService.allowDragOverPage(); + this.dragged = -1; + this.chips.updateOrder(); + }; + ChipsComponent.prototype.showTooltip = function (tooltip, index, field) { + var _this = this; + tooltip.close(); + var chipsItem = this.chips.getChipByIndex(index); + var textToDisplay = []; + if (!chipsItem.editMode && this.dragged === -1) { + if (field) { + if (isObject(chipsItem.item[field])) { + textToDisplay.push(chipsItem.item[field].display); + if (chipsItem.item[field].hasOtherInformation()) { + Object.keys(chipsItem.item[field].otherInformation) + .forEach(function (otherField) { + _this.translate.get('form.other-information.' + otherField) + .subscribe(function (label) { + textToDisplay.push(label + ': ' + chipsItem.item[field].otherInformation[otherField]); + }); + }); + } + } + else { + textToDisplay.push(chipsItem.item[field]); + } + } + else { + textToDisplay.push(chipsItem.display); + } + this.cdr.detectChanges(); + if (!chipsItem.hasIcons() || !chipsItem.hasVisibleIcons() || field) { + this.tipText = textToDisplay; + tooltip.open(); + } + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Chips) + ], ChipsComponent.prototype, "chips", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ChipsComponent.prototype, "wrapperClass", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ChipsComponent.prototype, "editable", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ChipsComponent.prototype, "showIcons", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ChipsComponent.prototype, "selected", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ChipsComponent.prototype, "remove", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ChipsComponent.prototype, "change", void 0); + ChipsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-chips', + styleUrls: ['./chips.component.scss'], + templateUrl: './chips.component.html', + }), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef, + UploaderService, + TranslateService]) + ], ChipsComponent); + return ChipsComponent; +}()); +export { ChipsComponent }; +//# sourceMappingURL=chips.component.js.map \ No newline at end of file diff --git a/src/app/shared/chips/chips.component.js.map b/src/app/shared/chips/chips.component.js.map new file mode 100644 index 0000000000..ecbcaa17e4 --- /dev/null +++ b/src/app/shared/chips/chips.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"chips.component.js","sourceRoot":"","sources":["chips.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAa,MAAM,GAAkB,MAAM,eAAe,CAAC;AAIrH,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQvD;IAcE,wBACU,GAAsB,EACtB,eAAgC,EAChC,SAA2B;QAF3B,QAAG,GAAH,GAAG,CAAmB;QACtB,oBAAe,GAAf,eAAe,CAAiB;QAChC,cAAS,GAAT,SAAS,CAAkB;QAd5B,aAAQ,GAAG,IAAI,CAAC;QAChB,cAAS,GAAG,KAAK,CAAC;QAEjB,aAAQ,GAAyB,IAAI,YAAY,EAAU,CAAC;QAC5D,WAAM,GAAyB,IAAI,YAAY,EAAU,CAAC;QAC1D,WAAM,GAAsB,IAAI,YAAY,EAAO,CAAC;QAG9D,YAAO,GAAG,CAAC,CAAC,CAAC;QAQX,IAAI,CAAC,OAAO,GAAG;YACb,SAAS,EAAE,GAAG;YACd,WAAW,EAAE,KAAK;YAClB,SAAS,EAAE,KAAK;YAChB,MAAM,EAAE,oBAAoB;YAC5B,UAAU,EAAE,KAAK;SAClB,CAAC;IACJ,CAAC;IAED,oCAAW,GAAX,UAAY,OAAsB;QAChC,IAAI,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE;YACnD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC;SACzC;IACH,CAAC;IAED,sCA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AE,CAAC;aAChB;SAEF;IACH,CAAC;IAlGQ;QAAR,KAAK,EAAE;0CAAQ,KAAK;iDAAC;IACb;QAAR,KAAK,EAAE;;wDAAsB;IACrB;QAAR,KAAK,EAAE;;oDAAiB;IAChB;QAAR,KAAK,EAAE;;qDAAmB;IAEjB;QAAT,MAAM,EAAE;0CAAW,YAAY;oDAAsC;IAC5D;QAAT,MAAM,EAAE;0CAAS,YAAY;kDAAsC;IAC1D;QAAT,MAAM,EAAE;0CAAS,YAAY;kDAAgC;IARnD,cAAc;QAN1B,SAAS,CAAC;YACT,QAAQ,EAAE,UAAU;YACpB,SAAS,EAAE,CAAC,wBAAwB,CAAC;YACrC,WAAW,EAAE,wBAAwB;SACtC,CAAC;iDAiBe,iBAAiB;YACL,eAAe;YACrB,gBAAgB;OAjB1B,cAAc,CAqG1B;IAAD,qBAAC;CAAA,AArGD,IAqGC;SArGY,cAAc"} \ No newline at end of file diff --git a/src/app/shared/chips/models/chips-item.model.js b/src/app/shared/chips/models/chips-item.model.js new file mode 100644 index 0000000000..98a8eb6d80 --- /dev/null +++ b/src/app/shared/chips/models/chips-item.model.js @@ -0,0 +1,88 @@ +import { isObject, uniqueId } from 'lodash'; +import { hasValue, isNotEmpty } from '../../empty.util'; +import { ConfidenceType } from '../../../core/integration/models/confidence-type'; +var ChipsItem = /** @class */ (function () { + function ChipsItem(item, fieldToDisplay, objToDisplay, icons, editMode) { + if (fieldToDisplay === void 0) { fieldToDisplay = 'display'; } + this.id = uniqueId(); + this._item = item; + this.fieldToDisplay = fieldToDisplay; + this.objToDisplay = objToDisplay; + this.setDisplayText(); + this.editMode = editMode || false; + this.icons = icons || []; + } + Object.defineProperty(ChipsItem.prototype, "item", { + get: function () { + return this._item; + }, + set: function (item) { + this._item = item; + }, + enumerable: true, + configurable: true + }); + ChipsItem.prototype.isNestedItem = function () { + return (isNotEmpty(this.item) + && isObject(this.item) + && isNotEmpty(this.objToDisplay) + && this.item[this.objToDisplay]); + }; + ChipsItem.prototype.hasIcons = function () { + return isNotEmpty(this.icons); + }; + ChipsItem.prototype.hasVisibleIcons = function () { + if (isNotEmpty(this.icons)) { + var hasVisible = false; + // check if it has at least one visible icon + for (var _i = 0, _a = this.icons; _i < _a.length; _i++) { + var icon = _a[_i]; + if (this._item.hasOwnProperty(icon.metadata) + && (((typeof this._item[icon.metadata] === 'string') && hasValue(this._item[icon.metadata])) + || this._item[icon.metadata].hasValue()) + && !this._item[icon.metadata].hasPlaceholder()) { + if ((icon.visibleWhenAuthorityEmpty + || this._item[icon.metadata].confidence !== ConfidenceType.CF_UNSET) + && isNotEmpty(icon.style)) { + hasVisible = true; + break; + } + } + } + return hasVisible; + } + else { + return false; + } + }; + ChipsItem.prototype.setEditMode = function () { + this.editMode = true; + }; + ChipsItem.prototype.updateIcons = function (icons) { + this.icons = icons; + }; + ChipsItem.prototype.updateItem = function (item) { + this._item = item; + this.setDisplayText(); + }; + ChipsItem.prototype.unsetEditMode = function () { + this.editMode = false; + }; + ChipsItem.prototype.setDisplayText = function () { + var value = this._item; + if (isObject(this._item)) { + // Check If displayField is in an internal object + var obj = this.objToDisplay ? this._item[this.objToDisplay] : this._item; + if (isObject(obj) && obj) { + value = obj[this.fieldToDisplay] || obj.value; + } + else { + value = obj; + } + } + this.display = value; + }; + return ChipsItem; +}()); +export { ChipsItem }; +//# sourceMappingURL=chips-item.model.js.map \ No newline at end of file diff --git a/src/app/shared/chips/models/chips-item.model.js.map b/src/app/shared/chips/models/chips-item.model.js.map new file mode 100644 index 0000000000..efefb8f99a --- /dev/null +++ b/src/app/shared/chips/models/chips-item.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"chips-item.model.js","sourceRoot":"","sources":["chips-item.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,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AC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YAE3E,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE;gBACxB,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC;aAC/C;iBAAM;gBACL,KAAK,GAAG,GAAG,CAAC;aACb;SACF;QAED,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IACH,gBAAC;AAAD,CAAC,AAnGD,IAmGC"} \ No newline at end of file diff --git a/src/app/shared/chips/models/chips.model.js b/src/app/shared/chips/models/chips.model.js new file mode 100644 index 0000000000..83ae701633 --- /dev/null +++ b/src/app/shared/chips/models/chips.model.js @@ -0,0 +1,127 @@ +import { findIndex, isEqual, isObject } from 'lodash'; +import { BehaviorSubject } from 'rxjs'; +import { ChipsItem } from './chips-item.model'; +import { hasValue, isNotEmpty } from '../../empty.util'; +import { PLACEHOLDER_PARENT_METADATA } from '../../form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; +import { FormFieldMetadataValueObject } from '../../form/builder/models/form-field-metadata-value.model'; +import { AuthorityValue } from '../../../core/integration/models/authority.value'; +var Chips = /** @class */ (function () { + function Chips(items, displayField, displayObj, iconsConfig) { + if (items === void 0) { items = []; } + if (displayField === void 0) { displayField = 'display'; } + this.displayField = displayField; + this.displayObj = displayObj; + this.iconsConfig = iconsConfig || []; + if (Array.isArray(items)) { + this.setInitialItems(items); + } + } + Chips.prototype.add = function (item) { + var icons = this.getChipsIcons(item); + var chipsItem = new ChipsItem(item, this.displayField, this.displayObj, icons); + var duplicatedIndex = findIndex(this._items, { display: chipsItem.display.trim() }); + if (duplicatedIndex === -1 || !isEqual(item, this.getChipByIndex(duplicatedIndex).item)) { + this._items.push(chipsItem); + this.chipsItems.next(this._items); + } + }; + Chips.prototype.getChipById = function (id) { + var index = findIndex(this._items, { id: id }); + return this.getChipByIndex(index); + }; + Chips.prototype.getChipByIndex = function (index) { + if (this._items.length > 0 && this._items[index]) { + return this._items[index]; + } + else { + return null; + } + }; + Chips.prototype.getChips = function () { + return this._items; + }; + /** + * To use to get items before to store it + * @returns {any[]} + */ + Chips.prototype.getChipsItems = function () { + var out = []; + this._items.forEach(function (item) { + out.push(item.item); + }); + return out; + }; + Chips.prototype.hasItems = function () { + return this._items.length > 0; + }; + Chips.prototype.hasPlaceholder = function (value) { + if (isObject(value)) { + return value.value === PLACEHOLDER_PARENT_METADATA; + } + else { + return value === PLACEHOLDER_PARENT_METADATA; + } + }; + Chips.prototype.remove = function (chipsItem) { + var index = findIndex(this._items, { id: chipsItem.id }); + this._items.splice(index, 1); + this.chipsItems.next(this._items); + }; + Chips.prototype.update = function (id, item) { + var chipsItemTarget = this.getChipById(id); + var icons = this.getChipsIcons(item); + chipsItemTarget.updateItem(item); + chipsItemTarget.updateIcons(icons); + chipsItemTarget.unsetEditMode(); + this.chipsItems.next(this._items); + }; + Chips.prototype.updateOrder = function () { + this.chipsItems.next(this._items); + }; + Chips.prototype.getChipsIcons = function (item) { + var _this = this; + var icons = []; + if (typeof item === 'string' || item instanceof FormFieldMetadataValueObject || item instanceof AuthorityValue) { + return icons; + } + var defaultConfigIndex = findIndex(this.iconsConfig, { name: 'default' }); + var defaultConfig = (defaultConfigIndex !== -1) ? this.iconsConfig[defaultConfigIndex] : undefined; + var config; + var configIndex; + var value; + Object.keys(item) + .forEach(function (metadata) { + value = item[metadata]; + configIndex = findIndex(_this.iconsConfig, { name: metadata }); + config = (configIndex !== -1) ? _this.iconsConfig[configIndex] : defaultConfig; + if (hasValue(value) && isNotEmpty(config) && !_this.hasPlaceholder(value)) { + var icon = void 0; + var visibleWhenAuthorityEmpty = _this.displayObj !== metadata; + // Set icon + icon = { + metadata: metadata, + visibleWhenAuthorityEmpty: visibleWhenAuthorityEmpty, + style: config.style + }; + icons.push(icon); + } + }); + return icons; + }; + /** + * Sets initial items, used in edit mode + */ + Chips.prototype.setInitialItems = function (items) { + var _this = this; + this._items = []; + items.forEach(function (item) { + var icons = _this.getChipsIcons(item); + var chipsItem = new ChipsItem(item, _this.displayField, _this.displayObj, icons); + _this._items.push(chipsItem); + }); + this.chipsItems = new BehaviorSubject(this._items); + }; + return Chips; +}()); +export { Chips }; +//# sourceMappingURL=chips.model.js.map \ No newline at end of file diff --git a/src/app/shared/chips/models/chips.model.js.map b/src/app/shared/chips/models/chips.model.js.map new file mode 100644 index 0000000000..6f3f445f54 --- /dev/null +++ b/src/app/shared/chips/models/chips.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"chips.model.js","sourceRoot":"","sources":["chips.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,SAAS,EAAiB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,0FAA0F,CAAC;AAEvI,OAAO,EAAE,4BAA4B,EAAE,MAAM,2DAA2D,CAAC;AACzG,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAElF;IAQE,eAAY,KAAiB,EACjB,YAAgC,EAChC,UAAmB,EACnB,WAAkC;QAHlC,sBAAA,EAAA,UAAiB;QACjB,6BAAA,EAAA,wBAAgC;QAI1C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,IAAI,EAAE,CAAC;QACrC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;SAC7B;IACH,CAA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KAAK;iBACpB,CAAC;gBAEF,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAClB;QACH,CAAC,CAAC,CAAC;QAEL,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACK,+BAAe,GAAvB,UAAwB,KAAY;QAApC,iBASC;QARC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI;YACjB,IAAM,KAAK,GAAG,KAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACvC,IAAM,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,EAAE,KAAI,CAAC,YAAY,EAAE,KAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YACjF,KAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,UAAU,GAAG,IAAI,eAAe,CAAc,IAAI,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;IACH,YAAC;AAAD,CAAC,AAjJD,IAiJC"} \ No newline at end of file diff --git a/src/app/shared/comcol-forms/comcol-form/comcol-form.component.js b/src/app/shared/comcol-forms/comcol-form/comcol-form.component.js new file mode 100644 index 0000000000..dd45cf5ba5 --- /dev/null +++ b/src/app/shared/comcol-forms/comcol-form/comcol-form.component.js @@ -0,0 +1,105 @@ +import * as tslib_1 from "tslib"; +import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { Location } from '@angular/common'; +import { DynamicFormService } from '@ng-dynamic-forms/core'; +import { TranslateService } from '@ngx-translate/core'; +import { isNotEmpty } from '../../empty.util'; +import { ResourceType } from '../../../core/shared/resource-type'; +/** + * A form for creating and editing Communities or Collections + */ +var ComColFormComponent = /** @class */ (function () { + function ComColFormComponent(location, formService, translate) { + this.location = location; + this.formService = formService; + this.translate = translate; + /** + * @type {string} Key prefix used to generate form labels + */ + this.LABEL_KEY_PREFIX = '.form.'; + /** + * @type {string} Key prefix used to generate form error messages + */ + this.ERROR_KEY_PREFIX = '.form.errors.'; + /** + * Emits DSO when the form is submitted + * @type {EventEmitter} + */ + this.submitForm = new EventEmitter(); + } + ComColFormComponent.prototype.ngOnInit = function () { + var _this = this; + this.formModel.forEach(function (fieldModel) { + fieldModel.value = _this.dso.firstMetadataValue(fieldModel.name); + }); + this.formGroup = this.formService.createFormGroup(this.formModel); + this.updateFieldTranslations(); + this.translate.onLangChange + .subscribe(function () { + _this.updateFieldTranslations(); + }); + }; + /** + * Checks which new fields were added and sends the updated version of the DSO to the parent component + */ + ComColFormComponent.prototype.onSubmit = function () { + var formMetadata = new Object(); + this.formModel.forEach(function (fieldModel) { + var value = { + value: fieldModel.value, + language: null + }; + if (formMetadata.hasOwnProperty(fieldModel.name)) { + formMetadata[fieldModel.name].push(value); + } + else { + formMetadata[fieldModel.name] = [value]; + } + }); + var updatedDSO = Object.assign({}, this.dso, { + metadata: tslib_1.__assign({}, this.dso.metadata, formMetadata), + type: ResourceType.Community + }); + this.submitForm.emit(updatedDSO); + }; + /** + * Used the update translations of errors and labels on init and on language change + */ + ComColFormComponent.prototype.updateFieldTranslations = function () { + var _this = this; + this.formModel.forEach(function (fieldModel) { + fieldModel.label = _this.translate.instant(_this.type + _this.LABEL_KEY_PREFIX + fieldModel.id); + if (isNotEmpty(fieldModel.validators)) { + fieldModel.errorMessages = {}; + Object.keys(fieldModel.validators).forEach(function (key) { + fieldModel.errorMessages[key] = _this.translate.instant(_this.type + _this.ERROR_KEY_PREFIX + fieldModel.id + '.' + key); + }); + } + }); + }; + ComColFormComponent.prototype.onCancel = function () { + this.location.back(); + }; + var _a; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", typeof (_a = typeof T !== "undefined" && T) === "function" && _a || Object) + ], ComColFormComponent.prototype, "dso", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ComColFormComponent.prototype, "submitForm", void 0); + ComColFormComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-comcol-form', + styleUrls: ['./comcol-form.component.scss'], + templateUrl: './comcol-form.component.html' + }), + tslib_1.__metadata("design:paramtypes", [Location, + DynamicFormService, + TranslateService]) + ], ComColFormComponent); + return ComColFormComponent; +}()); +export { ComColFormComponent }; +//# sourceMappingURL=comcol-form.component.js.map \ No newline at end of file diff --git a/src/app/shared/comcol-forms/comcol-form/comcol-form.component.js.map b/src/app/shared/comcol-forms/comcol-form/comcol-form.component.js.map new file mode 100644 index 0000000000..ea7706e78c --- /dev/null +++ b/src/app/shared/comcol-forms/comcol-form/comcol-form.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"comcol-form.component.js","sourceRoot":"","sources":["comcol-form.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,kBAAkB,EAEnB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE;;GAEG;AAMH;IAqCE,6BAA2B,QAAkB,EAClB,WAA+B,EAC/B,SAA2B;QAF3B,aAAQ,GAAR,QAAQ,CAAU;QAClB,gBAAW,GAAX,WAAW,CAAoB;QAC/B,cAAS,GAAT,SAAS,CAAkB;QA5BtD;;WAEG;QACH,qBAAgB,GAAG,QAAQ,CAAC;QAE5B;;WAEG;QACH,qBAAgB,GAAG,eAAe,CAAC;QAYnC;;;WAGG;QACO,eAAU,GAAsB,IAAI,YAAY,EAAE,CAAC;IAK7D,CAAC;IAED,sCAAQ,GAAR;QAAA,iBAaC;QAZC,IAAI,CAAC,SAAS,CAAC,OAAO,CACpB,UAAC,UAA6B;YAC5B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,CACpB,UAAC,UAA6B;YAC5B,UAAU,CAAC,KAAK,GAAG,KAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;YAC7F,IAAI,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;gBACrC,UAAU,CAAC,aAAa,GAAG,EAAE,CAAC;gBAC9B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;oBAC7C,UAAU,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,KAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;gBACxH,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CACF,CAAC;IACJ,CAAC;IAED,sCAAQ,GAAR;QACE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;;IAnGQ;QAAR,KAAK,EAAE;8DAAM,CAAC,oBAAD,CAAC;oDAAC;IA+BN;QAAT,MAAM,EAAE;0CAAa,YAAY;2DAA2B;IAnClD,mBAAmB;QAL/B,SAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,CAAC,8BAA8B,CAAC;YAC3C,WAAW,EAAE,8BAA8B;SAC5C,CAAC;iDAsCqC,QAAQ;YACL,kBAAkB;YACpB,gBAAgB;OAvC3C,mBAAmB,CAwG/B;IAAD,0BAAC;CAAA,AAxGD,IAwGC;SAxGY,mBAAmB"} \ No newline at end of file diff --git a/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.js b/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.js new file mode 100644 index 0000000000..2bdc0bb419 --- /dev/null +++ b/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.js @@ -0,0 +1,59 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { CommunityDataService } from '../../../core/data/community-data.service'; +import { RouteService } from '../../services/route.service'; +import { Router } from '@angular/router'; +import { isNotEmpty, isNotUndefined } from '../../empty.util'; +import { take } from 'rxjs/operators'; +import { getSucceededRemoteData } from '../../../core/shared/operators'; +import { DataService } from '../../../core/data/data.service'; +/** + * Component representing the create page for communities and collections + */ +var CreateComColPageComponent = /** @class */ (function () { + function CreateComColPageComponent(dsoDataService, parentDataService, routeService, router) { + this.dsoDataService = dsoDataService; + this.parentDataService = parentDataService; + this.routeService = routeService; + this.router = router; + } + CreateComColPageComponent.prototype.ngOnInit = function () { + var _this = this; + this.parentUUID$ = this.routeService.getQueryParameterValue('parent'); + this.parentUUID$.pipe(take(1)).subscribe(function (parentID) { + if (isNotEmpty(parentID)) { + _this.parentRD$ = _this.parentDataService.findById(parentID); + } + }); + }; + /** + * @param {TDomain} dso The updated version of the DSO + * Creates a new DSO based on the submitted user data and navigates to the new object's home page + */ + CreateComColPageComponent.prototype.onSubmit = function (dso) { + var _this = this; + this.parentUUID$.pipe(take(1)).subscribe(function (uuid) { + _this.dsoDataService.create(dso, uuid) + .pipe(getSucceededRemoteData()) + .subscribe(function (dsoRD) { + if (isNotUndefined(dsoRD)) { + var newUUID = dsoRD.payload.uuid; + _this.router.navigate([_this.frontendURL + newUUID]); + } + }); + }); + }; + CreateComColPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-create-comcol', + template: '' + }), + tslib_1.__metadata("design:paramtypes", [DataService, + CommunityDataService, + RouteService, + Router]) + ], CreateComColPageComponent); + return CreateComColPageComponent; +}()); +export { CreateComColPageComponent }; +//# sourceMappingURL=create-comcol-page.component.js.map \ No newline at end of file diff --git a/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.js.map b/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.js.map new file mode 100644 index 0000000000..0b3f4c104d --- /dev/null +++ b/src/app/shared/comcol-forms/create-comcol-page/create-comcol-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create-comcol-page.component.js","sourceRoot":"","sources":["create-comcol-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D;;GAEG;AAKH;IAgBE,mCACY,cAAoC,EACpC,iBAAuC,EACvC,YAA0B,EAC1B,MAAc;QAHd,mBAAc,GAAd,cAAc,CAAsB;QACpC,sBAAiB,GAAjB,iBAAiB,CAAsB;QACvC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,WAAM,GAAN,MAAM,CAAQ;IAG1B,CAAC;IAED,4CAAQ,GAAR;QAAA,iBAOC;QANC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QACtE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,UAAC,QAAgB;YACxD,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;gBACxB,KAAI,CAAC,SAAS,GAAG,KAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;aAC5D;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,4CAAQ,GAAR,UAAS,GAAY;QAArB,iBAWC;QAVC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,UAAC,IAAY;YACpD,KAAI,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC;iBAClC,IAAI,CAAC,sBAAsB,EAAE,CAAC;iBAC9B,SAAS,CAAC,UAAC,KAA0B;gBACpC,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE;oBACzB,IAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;oBACnC,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAI,CAAC,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;iBACpD;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;IAjDU,yBAAyB;QAJrC,SAAS,CAAC;YACT,QAAQ,EAAE,kBAAkB;YAC5B,QAAQ,EAAE,EAAE;SACb,CAAC;iDAkB4B,WAAW;YACR,oBAAoB;YACzB,YAAY;YAClB,MAAM;OApBf,yBAAyB,CAmDrC;IAAD,gCAAC;CAAA,AAnDD,IAmDC;SAnDY,yBAAyB"} \ No newline at end of file diff --git a/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.js b/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.js new file mode 100644 index 0000000000..96f340ee31 --- /dev/null +++ b/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.js @@ -0,0 +1,63 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { first, map } from 'rxjs/operators'; +import { DataService } from '../../../core/data/data.service'; +import { NotificationsService } from '../../notifications/notifications.service'; +import { TranslateService } from '@ngx-translate/core'; +/** + * Component representing the delete page for communities and collections + */ +var DeleteComColPageComponent = /** @class */ (function () { + function DeleteComColPageComponent(dsoDataService, router, route, notifications, translate) { + this.dsoDataService = dsoDataService; + this.router = router; + this.route = route; + this.notifications = notifications; + this.translate = translate; + } + DeleteComColPageComponent.prototype.ngOnInit = function () { + this.dsoRD$ = this.route.data.pipe(first(), map(function (data) { return data.dso; })); + }; + /** + * @param {TDomain} dso The DSO to delete + * Deletes an existing DSO and redirects to the home page afterwards, showing a notification that states whether or not the deletion was successful + */ + DeleteComColPageComponent.prototype.onConfirm = function (dso) { + var _this = this; + this.dsoDataService.delete(dso) + .pipe(first()) + .subscribe(function (success) { + if (success) { + var successMessage = _this.translate.instant(dso.type + '.delete.notification.success'); + _this.notifications.success(successMessage); + } + else { + var errorMessage = _this.translate.instant(dso.type + '.delete.notification.fail'); + _this.notifications.error(errorMessage); + } + _this.router.navigate(['/']); + }); + }; + /** + * @param {TDomain} dso The DSO for which the delete action was canceled + * When a delete is canceled, the user is redirected to the DSO's edit page + */ + DeleteComColPageComponent.prototype.onCancel = function (dso) { + this.router.navigate([this.frontendURL + '/' + dso.uuid + '/edit']); + }; + DeleteComColPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-delete-comcol', + template: '' + }), + tslib_1.__metadata("design:paramtypes", [DataService, + Router, + ActivatedRoute, + NotificationsService, + TranslateService]) + ], DeleteComColPageComponent); + return DeleteComColPageComponent; +}()); +export { DeleteComColPageComponent }; +//# sourceMappingURL=delete-comcol-page.component.js.map \ No newline at end of file diff --git a/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.js.map b/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.js.map new file mode 100644 index 0000000000..7d2e7a4af4 --- /dev/null +++ b/src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"delete-comcol-page.component.js","sourceRoot":"","sources":["delete-comcol-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CA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C,YAAY,CAAC,CAAA;aACvC;YACD,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACH,4CAAQ,GAAR,UAAS,GAAY;QACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,WAAW,GAAG,GAAG,GAAG,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC;IAhDU,yBAAyB;QAJrC,SAAS,CAAC;YACT,QAAQ,EAAE,kBAAkB;YAC5B,QAAQ,EAAE,EAAE;SACb,CAAC;iDAY4B,WAAW;YACnB,MAAM;YACP,cAAc;YACN,oBAAoB;YACxB,gBAAgB;OAf5B,yBAAyB,CAiDrC;IAAD,gCAAC;CAAA,AAjDD,IAiDC;SAjDY,yBAAyB"} \ No newline at end of file diff --git a/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.js b/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.js new file mode 100644 index 0000000000..88f5c4e7eb --- /dev/null +++ b/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.js @@ -0,0 +1,47 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { isNotUndefined } from '../../empty.util'; +import { first, map } from 'rxjs/operators'; +import { getSucceededRemoteData } from '../../../core/shared/operators'; +import { DataService } from '../../../core/data/data.service'; +/** + * Component representing the edit page for communities and collections + */ +var EditComColPageComponent = /** @class */ (function () { + function EditComColPageComponent(dsoDataService, router, route) { + this.dsoDataService = dsoDataService; + this.router = router; + this.route = route; + } + EditComColPageComponent.prototype.ngOnInit = function () { + this.dsoRD$ = this.route.data.pipe(first(), map(function (data) { return data.dso; })); + }; + /** + * @param {TDomain} dso The updated version of the DSO + * Updates an existing DSO based on the submitted user data and navigates to the edited object's home page + */ + EditComColPageComponent.prototype.onSubmit = function (dso) { + var _this = this; + this.dsoDataService.update(dso) + .pipe(getSucceededRemoteData()) + .subscribe(function (dsoRD) { + if (isNotUndefined(dsoRD)) { + var newUUID = dsoRD.payload.uuid; + _this.router.navigate([_this.frontendURL + newUUID]); + } + }); + }; + EditComColPageComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-edit-comcol', + template: '' + }), + tslib_1.__metadata("design:paramtypes", [DataService, + Router, + ActivatedRoute]) + ], EditComColPageComponent); + return EditComColPageComponent; +}()); +export { EditComColPageComponent }; +//# sourceMappingURL=edit-comcol-page.component.js.map \ No newline at end of file diff --git a/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.js.map b/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.js.map new file mode 100644 index 0000000000..fa2719e7c1 --- /dev/null +++ b/src/app/shared/comcol-forms/edit-comcol-page/edit-comcol-page.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-comcol-page.component.js","sourceRoot":"","sources":["edit-comcol-page.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D;;GAEG;AAKH;IAUE,iCACY,cAAoC,EACpC,MAAc,EACd,KAAqB;QAFrB,mBAAc,GAAd,cAAc,CAAsB;QACpC,WAAM,GAAN,MAAM,CAAQ;QACd,UAAK,GAAL,KAAK,CAAgB;IAEjC,CAAC;IAED,0CAAQ,GAAR;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,GAAG,EAAR,CAAQ,CAAC,CAAC,CAAC;IACvE,CAAC;IAED;;;OAGG;IACH,0CAAQ,GAAR,UAAS,GAAY;QAArB,iBASC;QARC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC;aAC5B,IAAI,CAAC,sBAAsB,EAAE,CAAC;aAC9B,SAAS,CAAC,UAAC,KAA0B;YACpC,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE;gBACzB,IAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;gBACnC,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAI,CAAC,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;aACpD;QACH,CAAC,CAAC,CAAC;IACP,CAAC;IAlCU,uBAAuB;QAJnC,SAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,QAAQ,EAAE,EAAE;SACb,CAAC;iDAY4B,WAAW;YACnB,MAAM;YACP,cAAc;OAbtB,uBAAuB,CAmCnC;IAAD,8BAAC;CAAA,AAnCD,IAmCC;SAnCY,uBAAuB"} \ No newline at end of file diff --git a/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.js b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.js new file mode 100644 index 0000000000..76b8cd3307 --- /dev/null +++ b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +/** + * A component to display the "Browse By" section of a Community or Collection page + * It expects the ID of the Community or Collection as input to be passed on as a scope + */ +var ComcolPageBrowseByComponent = /** @class */ (function () { + function ComcolPageBrowseByComponent() { + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ComcolPageBrowseByComponent.prototype, "id", void 0); + ComcolPageBrowseByComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-comcol-page-browse-by', + templateUrl: './comcol-page-browse-by.component.html', + }) + ], ComcolPageBrowseByComponent); + return ComcolPageBrowseByComponent; +}()); +export { ComcolPageBrowseByComponent }; +//# sourceMappingURL=comcol-page-browse-by.component.js.map \ No newline at end of file diff --git a/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.js.map b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.js.map new file mode 100644 index 0000000000..cfcf881c1c --- /dev/null +++ b/src/app/shared/comcol-page-browse-by/comcol-page-browse-by.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"comcol-page-browse-by.component.js","sourceRoot":"","sources":["comcol-page-browse-by.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD;;;GAGG;AAKH;IAAA;IAKA,CAAC;IADU;QAAR,KAAK,EAAE;;2DAAY;IAJT,2BAA2B;QAJvC,SAAS,CAAC;YACT,QAAQ,EAAE,0BAA0B;YACpC,WAAW,EAAE,wCAAwC;SACtD,CAAC;OACW,2BAA2B,CAKvC;IAAD,kCAAC;CAAA,AALD,IAKC;SALY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/comcol-page-content/comcol-page-content.component.js b/src/app/shared/comcol-page-content/comcol-page-content.component.js new file mode 100644 index 0000000000..319c6eac2a --- /dev/null +++ b/src/app/shared/comcol-page-content/comcol-page-content.component.js @@ -0,0 +1,34 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +/** + * This component renders any content inside of this component. + * If there is a title set it will render the title. + * If hasInnerHtml is true the content will be handled as html. + * To see how it is used see collection-page or community-page. + */ +var ComcolPageContentComponent = /** @class */ (function () { + function ComcolPageContentComponent() { + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ComcolPageContentComponent.prototype, "title", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ComcolPageContentComponent.prototype, "content", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Boolean) + ], ComcolPageContentComponent.prototype, "hasInnerHtml", void 0); + ComcolPageContentComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-comcol-page-content', + styleUrls: ['./comcol-page-content.component.scss'], + templateUrl: './comcol-page-content.component.html' + }) + ], ComcolPageContentComponent); + return ComcolPageContentComponent; +}()); +export { ComcolPageContentComponent }; +//# sourceMappingURL=comcol-page-content.component.js.map \ No newline at end of file diff --git a/src/app/shared/comcol-page-content/comcol-page-content.component.js.map b/src/app/shared/comcol-page-content/comcol-page-content.component.js.map new file mode 100644 index 0000000000..bb6397de6c --- /dev/null +++ b/src/app/shared/comcol-page-content/comcol-page-content.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"comcol-page-content.component.js","sourceRoot":"","sources":["comcol-page-content.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;GAKG;AAMH;IAAA;IAWA,CAAC;IARU;QAAR,KAAK,EAAE;;6DAAe;IAGd;QAAR,KAAK,EAAE;;+DAAiB;IAGhB;QAAR,KAAK,EAAE;;oEAAuB;IATpB,0BAA0B;QALtC,SAAS,CAAC;YACT,QAAQ,EAAE,wBAAwB;YAClC,SAAS,EAAE,CAAC,sCAAsC,CAAC;YACnD,WAAW,EAAE,sCAAsC;SACpD,CAAC;OACW,0BAA0B,CAWtC;IAAD,iCAAC;CAAA,AAXD,IAWC;SAXY,0BAA0B"} \ No newline at end of file diff --git a/src/app/shared/comcol-page-header/comcol-page-header.component.js b/src/app/shared/comcol-page-header/comcol-page-header.component.js new file mode 100644 index 0000000000..74246fdc8b --- /dev/null +++ b/src/app/shared/comcol-page-header/comcol-page-header.component.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +var ComcolPageHeaderComponent = /** @class */ (function () { + function ComcolPageHeaderComponent() { + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ComcolPageHeaderComponent.prototype, "name", void 0); + ComcolPageHeaderComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-comcol-page-header', + styleUrls: ['./comcol-page-header.component.scss'], + templateUrl: './comcol-page-header.component.html', + }) + ], ComcolPageHeaderComponent); + return ComcolPageHeaderComponent; +}()); +export { ComcolPageHeaderComponent }; +//# sourceMappingURL=comcol-page-header.component.js.map \ No newline at end of file diff --git a/src/app/shared/comcol-page-header/comcol-page-header.component.js.map b/src/app/shared/comcol-page-header/comcol-page-header.component.js.map new file mode 100644 index 0000000000..3e306abb66 --- /dev/null +++ b/src/app/shared/comcol-page-header/comcol-page-header.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"comcol-page-header.component.js","sourceRoot":"","sources":["comcol-page-header.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAOjD;IAAA;IAEA,CAAC;IADU;QAAR,KAAK,EAAE;;2DAAc;IADX,yBAAyB;QALrC,SAAS,CAAC;YACT,QAAQ,EAAE,uBAAuB;YACjC,SAAS,EAAE,CAAC,qCAAqC,CAAC;YAClD,WAAW,EAAE,qCAAqC;SACnD,CAAC;OACW,yBAAyB,CAErC;IAAD,gCAAC;CAAA,AAFD,IAEC;SAFY,yBAAyB"} \ No newline at end of file diff --git a/src/app/shared/comcol-page-logo/comcol-page-logo.component.js b/src/app/shared/comcol-page-logo/comcol-page-logo.component.js new file mode 100644 index 0000000000..ba9e925193 --- /dev/null +++ b/src/app/shared/comcol-page-logo/comcol-page-logo.component.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Bitstream } from '../../core/shared/bitstream.model'; +var ComcolPageLogoComponent = /** @class */ (function () { + function ComcolPageLogoComponent() { + /** + * The default 'holder.js' image + */ + this.holderSource = 'data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2293%22%20height%3D%22120%22%20viewBox%3D%220%200%2093%20120%22%20preserveAspectRatio%3D%22none%22%3E%3C!--%0ASource%20URL%3A%20holder.js%2F93x120%3Ftext%3DNo%20Thumbnail%0ACreated%20with%20Holder.js%202.8.2.%0ALearn%20more%20at%20http%3A%2F%2Fholderjs.com%0A(c)%202012-2015%20Ivan%20Malopinsky%20-%20http%3A%2F%2Fimsky.co%0A--%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%3C!%5BCDATA%5B%23holder_1543e460b05%20text%20%7B%20fill%3A%23AAAAAA%3Bfont-weight%3Abold%3Bfont-family%3AArial%2C%20Helvetica%2C%20Open%20Sans%2C%20sans-serif%2C%20monospace%3Bfont-size%3A10pt%20%7D%20%5D%5D%3E%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_1543e460b05%22%3E%3Crect%20width%3D%2293%22%20height%3D%22120%22%20fill%3D%22%23EEEEEE%22%2F%3E%3Cg%3E%3Ctext%20x%3D%2235.6171875%22%20y%3D%2257%22%3ENo%3C%2Ftext%3E%3Ctext%20x%3D%2210.8125%22%20y%3D%2272%22%3EThumbnail%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E'; + } + ComcolPageLogoComponent.prototype.errorHandler = function (event) { + event.currentTarget.src = this.holderSource; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Bitstream) + ], ComcolPageLogoComponent.prototype, "logo", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ComcolPageLogoComponent.prototype, "alternateText", void 0); + ComcolPageLogoComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-comcol-page-logo', + styleUrls: ['./comcol-page-logo.component.scss'], + templateUrl: './comcol-page-logo.component.html', + }) + ], ComcolPageLogoComponent); + return ComcolPageLogoComponent; +}()); +export { ComcolPageLogoComponent }; +//# sourceMappingURL=comcol-page-logo.component.js.map \ No newline at end of file diff --git a/src/app/shared/comcol-page-logo/comcol-page-logo.component.js.map b/src/app/shared/comcol-page-logo/comcol-page-logo.component.js.map new file mode 100644 index 0000000000..84c2ea48fa --- /dev/null +++ b/src/app/shared/comcol-page-logo/comcol-page-logo.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"comcol-page-logo.component.js","sourceRoot":"","sources":["comcol-page-logo.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAO9D;IALA;QAUE;;WAEG;QACH,iBAAY,GAAG,++BAA++B,CAAC;IAMjgC,CAAC;IAJC,8CAAY,GAAZ,UAAa,KAAK;QAChB,KAAK,CAAC,aAAa,CAAC,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC;IAC9C,CAAC;IAXQ;QAAR,KAAK,EAAE;0CAAO,SAAS;yDAAC;IAEhB;QAAR,KAAK,EAAE;;kEAAuB;IAHpB,uBAAuB;QALnC,SAAS,CAAC;YACT,QAAQ,EAAE,qBAAqB;YAC/B,SAAS,EAAE,CAAC,mCAAmC,CAAC;YAChD,WAAW,EAAE,mCAAmC;SACjD,CAAC;OACW,uBAAuB,CAcnC;IAAD,8BAAC;CAAA,AAdD,IAcC;SAdY,uBAAuB"} \ No newline at end of file diff --git a/src/app/shared/date.util.js b/src/app/shared/date.util.js new file mode 100644 index 0000000000..1d22e3f7ee --- /dev/null +++ b/src/app/shared/date.util.js @@ -0,0 +1,52 @@ +import { isObject } from 'lodash'; +import * as moment from 'moment'; +/** + * Returns true if the passed value is a NgbDateStruct. + * + * @param value + * The object to check + * @return boolean + * true if the passed value is a NgbDateStruct, false otherwise + */ +export function isNgbDateStruct(value) { + return isObject(value) && value.hasOwnProperty('day') + && value.hasOwnProperty('month') && value.hasOwnProperty('year'); +} +/** + * Returns a date in simplified extended ISO format (YYYY-MM-DDTHH:mm:ssZ). + * The timezone is always zero UTC offset, as denoted by the suffix "Z" + * + * @param date + * The date to format + * @return string + * the formatted date + */ +export function dateToISOFormat(date) { + var dateObj = (date instanceof Date) ? date : ngbDateStructToDate(date); + var year = dateObj.getFullYear().toString(); + var month = (dateObj.getMonth() + 1).toString(); + var day = dateObj.getDate().toString(); + var hour = dateObj.getHours().toString(); + var min = dateObj.getMinutes().toString(); + var sec = dateObj.getSeconds().toString(); + year = (year.length === 1) ? '0' + year : year; + month = (month.length === 1) ? '0' + month : month; + day = (day.length === 1) ? '0' + day : day; + hour = (hour.length === 1) ? '0' + hour : hour; + min = (min.length === 1) ? '0' + min : min; + sec = (sec.length === 1) ? '0' + sec : sec; + var dateStr = "" + year + month + day + hour + min + sec; + return moment.utc(dateStr, 'YYYYMMDDhhmmss').format(); +} +/** + * Returns a Date object started from a NgbDateStruct object + * + * @param date + * The NgbDateStruct to convert + * @return Date + * the Date object + */ +export function ngbDateStructToDate(date) { + return new Date(date.year, (date.month - 1), date.day); +} +//# sourceMappingURL=date.util.js.map \ No newline at end of file diff --git a/src/app/shared/date.util.js.map b/src/app/shared/date.util.js.map new file mode 100644 index 0000000000..a60c703097 --- /dev/null +++ b/src/app/shared/date.util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"date.util.js","sourceRoot":"","sources":["date.util.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC;;;;;;;GAOG;AACH,MAAM,0BAA0B,KAAa;IAC3C,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;WAChD,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,IAAK,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,0BA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AC,GAAG,CAAC;IAC3C,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAC3C,IAAM,OAAO,GAAG,KAAG,IAAI,GAAG,KAAK,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAK,CAAC;IAC3D,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,MAAM,EAAE,CAAC;AACxD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,8BAA8B,IAAmB;IACrD,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;AACzD,CAAC"} \ No newline at end of file diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.js b/src/app/shared/dso-selector/dso-selector/dso-selector.component.js new file mode 100644 index 0000000000..d2751b5c0d --- /dev/null +++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.js @@ -0,0 +1,84 @@ +import * as tslib_1 from "tslib"; +import { Component, EventEmitter, Input, Output, QueryList, ViewChildren } from '@angular/core'; +import { FormControl } from '@angular/forms'; +import { debounceTime, startWith, switchMap } from 'rxjs/operators'; +import { SearchService } from '../../../+search-page/search-service/search.service'; +import { PaginatedSearchOptions } from '../../../+search-page/paginated-search-options.model'; +import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model'; +var DSOSelectorComponent = /** @class */ (function () { + function DSOSelectorComponent(searchService) { + this.searchService = searchService; + /** + * Emits the selected Object when a user selects it in the list + */ + this.onSelect = new EventEmitter(); + /** + * Input form control to query the list + */ + this.input = new FormControl(); + /** + * Default pagination for this feature + */ + this.defaultPagination = { id: 'dso-selector', currentPage: 1, pageSize: 5 }; + /** + * Time to wait before sending a search request to the server when a user types something + */ + this.debounceTime = 500; + } + /** + * Fills the listEntries$ variable with search results based on the input field's current value + * The search will always start with the initial currentDSOId value + */ + DSOSelectorComponent.prototype.ngOnInit = function () { + var _this = this; + this.input.setValue(this.currentDSOId); + this.listEntries$ = this.input.valueChanges + .pipe(debounceTime(this.debounceTime), startWith(this.currentDSOId), switchMap(function (query) { + return _this.searchService.search(new PaginatedSearchOptions({ + query: query, + dsoType: _this.type, + pagination: _this.defaultPagination + })); + })); + }; + /** + * Set focus on the first list element when there is only one result + */ + DSOSelectorComponent.prototype.selectSingleResult = function () { + if (this.listElements.length > 0) { + this.listElements.first.nativeElement.click(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], DSOSelectorComponent.prototype, "currentDSOId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], DSOSelectorComponent.prototype, "type", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DSOSelectorComponent.prototype, "onSelect", void 0); + tslib_1.__decorate([ + ViewChildren('listEntryElement'), + tslib_1.__metadata("design:type", QueryList) + ], DSOSelectorComponent.prototype, "listElements", void 0); + DSOSelectorComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-dso-selector', + // styleUrls: ['./dso-selector.component.scss'], + templateUrl: './dso-selector.component.html' + }) + /** + * Component to render a list of DSO's of which one can be selected + * The user can search the list by using the input field + */ + , + tslib_1.__metadata("design:paramtypes", [SearchService]) + ], DSOSelectorComponent); + return DSOSelectorComponent; +}()); +export { DSOSelectorComponent }; +//# sourceMappingURL=dso-selector.component.js.map \ No newline at end of file diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.js.map b/src/app/shared/dso-selector/dso-selector/dso-selector.component.js.map new file mode 100644 index 0000000000..28afdd82a7 --- /dev/null +++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dso-selector.component.js","sourceRoot":"","sources":["dso-selector.component.ts"],"names":[],"mappings":";AAAA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ACH,CAAA;QACH,CAAC,CACF,CACF,CAAA;IACL,CAAC;IAED;;OAEG;IACH,iDAAkB,GAAlB;QACE,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;SAC/C;IACH,CAAC;IAtEQ;QAAR,KAAK,EAAE;;8DAAsB;IAKrB;QAAR,KAAK,EAAE;;sDAAwB;IAKtB;QAAT,MAAM,EAAE;0CAAW,YAAY;0DAAoC;IAoBlC;QAAjC,YAAY,CAAC,kBAAkB,CAAC;0CAAe,SAAS;8DAAa;IAnC3D,oBAAoB;QAVhC,SAAS,CAAC;YACT,QAAQ,EAAE,iBAAiB;YAC3B,gDAAgD;YAChD,WAAW,EAAE,+BAA+B;SAC7C,CAAC;QAEF;;;WAGG;;iDA2CkC,aAAa;OA1CrC,oBAAoB,CA4EhC;IAAD,2BAAC;CAAA,AA5ED,IA4EC;SA5EY,oBAAoB"} \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.js b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.js new file mode 100644 index 0000000000..61f326cb9e --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.js @@ -0,0 +1,46 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { COLLECTION_PARENT_PARAMETER, getCollectionCreatePath } from '../../../../+collection-page/collection-page-routing.module'; +import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-selector-modal-wrapper.component'; +/** + * Component to wrap a list of existing communities inside a modal + * Used to choose a community from to create a new collection in + */ +var CreateCollectionParentSelectorComponent = /** @class */ (function (_super) { + tslib_1.__extends(CreateCollectionParentSelectorComponent, _super); + function CreateCollectionParentSelectorComponent(activeModal, route, router) { + var _this = _super.call(this, activeModal, route) || this; + _this.activeModal = activeModal; + _this.route = route; + _this.router = router; + _this.objectType = DSpaceObjectType.COLLECTION; + _this.selectorType = DSpaceObjectType.COMMUNITY; + _this.action = SelectorActionType.CREATE; + return _this; + } + /** + * Navigate to the collection create page + */ + CreateCollectionParentSelectorComponent.prototype.navigate = function (dso) { + var _a; + var navigationExtras = { + queryParams: (_a = {}, + _a[COLLECTION_PARENT_PARAMETER] = dso.uuid, + _a) + }; + this.router.navigate([getCollectionCreatePath()], navigationExtras); + }; + CreateCollectionParentSelectorComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-create-collection-parent-selector', + templateUrl: '../dso-selector-modal-wrapper.component.html', + }), + tslib_1.__metadata("design:paramtypes", [NgbActiveModal, ActivatedRoute, Router]) + ], CreateCollectionParentSelectorComponent); + return CreateCollectionParentSelectorComponent; +}(DSOSelectorModalWrapperComponent)); +export { CreateCollectionParentSelectorComponent }; +//# sourceMappingURL=create-collection-parent-selector.component.js.map \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.js.map b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.js.map new file mode 100644 index 0000000000..ef8120bf1a --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create-collection-parent-selector.component.js","sourceRoot":"","sources":["create-collection-parent-selector.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAoB,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEpF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,gCAAgC,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE/G;;;GAGG;AAMH;IAA6D,mEAAgC;IAK3F,iDAAsB,WAA2B,EAAY,KAAqB,EAAU,MAAc;QAA1G,YACE,kBAAM,WAAW,EAAE,KAAK,CAAC,SAC1B;QAFqB,iBAAW,GAAX,WAAW,CAAgB;QAAY,WAAK,GAAL,KAAK,CAAgB;QAAU,YAAM,GAAN,MAAM,CAAQ;QAJ1G,gBAAU,GAAG,gBAAgB,CAAC,UAAU,CAAC;QACzC,kBAAY,GAAG,gBAAgB,CAAC,SAAS,CAAC;QAC1C,YAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC;;IAInC,CAAC;IAED;;OAEG;IACH,0DAAQ,GAAR,UAAS,GAAiB;;QACxB,IAAM,gBAAgB,GAAqB;YACzC,WAAW;gBACT,GAAC,2BAA2B,IAAG,GAAG,CAAC,IAAI;mBACxC;SACF,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,uBAAuB,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;IACtE,CAAC;IAnBU,uCAAuC;QAJnD,SAAS,CAAC;YACT,QAAQ,EAAE,sCAAsC;YAChD,WAAW,EAAE,8CAA8C;SAC5D,CAAC;iDAMmC,cAAc,EAAmB,cAAc,EAAkB,MAAM;OAL/F,uCAAuC,CAoBnD;IAAD,8CAAC;CAAA,AApBD,CAA6D,gCAAgC,GAoB5F;SApBY,uCAAuC"} \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.js b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.js new file mode 100644 index 0000000000..7fb734db6b --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.js @@ -0,0 +1,53 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; +import { hasValue } from '../../../empty.util'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { COMMUNITY_PARENT_PARAMETER, getCommunityCreatePath } from '../../../../+community-page/community-page-routing.module'; +import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-selector-modal-wrapper.component'; +/** + * Component to wrap a button - for top communities - + * and a list of parent communities - for sub communities + * inside a modal + * Used to create a new community + */ +var CreateCommunityParentSelectorComponent = /** @class */ (function (_super) { + tslib_1.__extends(CreateCommunityParentSelectorComponent, _super); + function CreateCommunityParentSelectorComponent(activeModal, route, router) { + var _this = _super.call(this, activeModal, route) || this; + _this.activeModal = activeModal; + _this.route = route; + _this.router = router; + _this.objectType = DSpaceObjectType.COMMUNITY; + _this.selectorType = DSpaceObjectType.COMMUNITY; + _this.action = SelectorActionType.CREATE; + return _this; + } + /** + * Navigate to the community create page + */ + CreateCommunityParentSelectorComponent.prototype.navigate = function (dso) { + var _a; + var navigationExtras = {}; + if (hasValue(dso)) { + navigationExtras = { + queryParams: (_a = {}, + _a[COMMUNITY_PARENT_PARAMETER] = dso.uuid, + _a) + }; + } + this.router.navigate([getCommunityCreatePath()], navigationExtras); + }; + CreateCommunityParentSelectorComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-create-community-parent-selector', + styleUrls: ['./create-community-parent-selector.component.scss'], + templateUrl: './create-community-parent-selector.component.html', + }), + tslib_1.__metadata("design:paramtypes", [NgbActiveModal, ActivatedRoute, Router]) + ], CreateCommunityParentSelectorComponent); + return CreateCommunityParentSelectorComponent; +}(DSOSelectorModalWrapperComponent)); +export { CreateCommunityParentSelectorComponent }; +//# sourceMappingURL=create-community-parent-selector.component.js.map \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.js.map b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.js.map new file mode 100644 index 0000000000..2a822302be --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create-community-parent-selector.component.js","sourceRoot":"","sources":["create-community-parent-selector.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAoB,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEpF,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,2DAA2D,CAAC;AACnE,OAAO,EACL,gCAAgC,EAChC,kBAAkB,EACnB,MAAM,yCAAyC,CAAC;AAEjD;;;;;GAKG;AAOH;IAA4D,kEAAgC;IAK1F,gDAAsB,WAA2B,EAAY,KAAqB,EAAU,MAAc;QAA1G,YACE,kBAAM,WAAW,EAAE,KAAK,CAAC,SAC1B;QAFqB,iBAAW,GAAX,WAAW,CAAgB;QAAY,WAAK,GAAL,KAAK,CAAgB;QAAU,YAAM,GAAN,MAAM,CAAQ;QAJ1G,gBAAU,GAAG,gBAAgB,CAAC,SAAS,CAAC;QACxC,kBAAY,GAAG,gBAAgB,CAAC,SAAS,CAAC;QAC1C,YAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC;;IAInC,CAAC;IAED;;OAEG;IACH,yDAAQ,GAAR,UAAS,GAAiB;;QACxB,IAAI,gBAAgB,GAAqB,EAAE,CAAC;QAC5C,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE;YACjB,gBAAgB,GAAG;gBACjB,WAAW;oBACT,GAAC,0BAA0B,IAAG,GAAG,CAAC,IAAI;uBACvC;aACF,CAAC;SACH;QACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,sBAAsB,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;IACrE,CAAC;IAtBU,sCAAsC;QALlD,SAAS,CAAC;YACT,QAAQ,EAAE,qCAAqC;YAC/C,SAAS,EAAE,CAAC,mDAAmD,CAAC;YAChE,WAAW,EAAE,mDAAmD;SACjE,CAAC;iDAMmC,cAAc,EAAmB,cAAc,EAAkB,MAAM;OAL/F,sCAAsC,CAuBlD;IAAD,6CAAC;CAAA,AAvBD,CAA4D,gCAAgC,GAuB3F;SAvBY,sCAAsC"} \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.js b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.js new file mode 100644 index 0000000000..e46879ef7f --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.js @@ -0,0 +1,40 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-selector-modal-wrapper.component'; +/** + * Component to wrap a list of existing collections inside a modal + * Used to choose a collection from to create a new item in + */ +var CreateItemParentSelectorComponent = /** @class */ (function (_super) { + tslib_1.__extends(CreateItemParentSelectorComponent, _super); + function CreateItemParentSelectorComponent(activeModal, route, router) { + var _this = _super.call(this, activeModal, route) || this; + _this.activeModal = activeModal; + _this.route = route; + _this.router = router; + _this.objectType = DSpaceObjectType.ITEM; + _this.selectorType = DSpaceObjectType.COLLECTION; + _this.action = SelectorActionType.CREATE; + return _this; + } + /** + * Navigate to the item create page + */ + CreateItemParentSelectorComponent.prototype.navigate = function (dso) { + // There's no submit path per collection yet... + }; + CreateItemParentSelectorComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-create-item-parent-selector', + // styleUrls: ['./create-item-parent-selector.component.scss'], + templateUrl: '../dso-selector-modal-wrapper.component.html', + }), + tslib_1.__metadata("design:paramtypes", [NgbActiveModal, ActivatedRoute, Router]) + ], CreateItemParentSelectorComponent); + return CreateItemParentSelectorComponent; +}(DSOSelectorModalWrapperComponent)); +export { CreateItemParentSelectorComponent }; +//# sourceMappingURL=create-item-parent-selector.component.js.map \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.js.map b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.js.map new file mode 100644 index 0000000000..6fc6098720 --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create-item-parent-selector.component.js","sourceRoot":"","sources":["create-item-parent-selector.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEpF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE/G;;;GAGG;AAOH;IAAuD,6DAAgC;IAKrF,2CAAsB,WAA2B,EAAY,KAAqB,EAAU,MAAc;QAA1G,YACE,kBAAM,WAAW,EAAE,KAAK,CAAC,SAC1B;QAFqB,iBAAW,GAAX,WAAW,CAAgB;QAAY,WAAK,GAAL,KAAK,CAAgB;QAAU,YAAM,GAAN,MAAM,CAAQ;QAJ1G,gBAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC;QACnC,kBAAY,GAAG,gBAAgB,CAAC,UAAU,CAAC;QAC3C,YAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC;;IAInC,CAAC;IAED;;OAEG;IACH,oDAAQ,GAAR,UAAS,GAAiB;QACzB,+CAA+C;IAChD,CAAC;IAdU,iCAAiC;QAL7C,SAAS,CAAC;YACT,QAAQ,EAAE,gCAAgC;YAC1C,+DAA+D;YAC/D,WAAW,EAAE,8CAA8C;SAC5D,CAAC;iDAMmC,cAAc,EAAmB,cAAc,EAAkB,MAAM;OAL/F,iCAAiC,CAe7C;IAAD,wCAAC;CAAA,AAfD,CAAuD,gCAAgC,GAetF;SAfY,iCAAiC"} \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.js b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.js new file mode 100644 index 0000000000..a33a35c459 --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.js @@ -0,0 +1,52 @@ +import * as tslib_1 from "tslib"; +import { Injectable, Input } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { Observable } from 'rxjs'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { map } from 'rxjs/operators'; +export var SelectorActionType; +(function (SelectorActionType) { + SelectorActionType["CREATE"] = "create"; + SelectorActionType["EDIT"] = "edit"; +})(SelectorActionType || (SelectorActionType = {})); +/** + * Abstract base class that represents a wrapper for modal content used to select a DSpace Object + */ +var DSOSelectorModalWrapperComponent = /** @class */ (function () { + function DSOSelectorModalWrapperComponent(activeModal, route) { + this.activeModal = activeModal; + this.route = route; + } + /** + * Get de current page's DSO based on the selectorType + */ + DSOSelectorModalWrapperComponent.prototype.ngOnInit = function () { + var typeString = this.selectorType.toString().toLowerCase(); + this.dsoRD$ = this.route.root.firstChild.firstChild.data.pipe(map(function (data) { return data[typeString]; })); + }; + /** + * Method called when an object has been selected + * @param dso The selected DSpaceObject + */ + DSOSelectorModalWrapperComponent.prototype.selectObject = function (dso) { + this.close(); + this.navigate(dso); + }; + /** + * Close the modal + */ + DSOSelectorModalWrapperComponent.prototype.close = function () { + this.activeModal.close(); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Observable) + ], DSOSelectorModalWrapperComponent.prototype, "dsoRD$", void 0); + DSOSelectorModalWrapperComponent = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [NgbActiveModal, ActivatedRoute]) + ], DSOSelectorModalWrapperComponent); + return DSOSelectorModalWrapperComponent; +}()); +export { DSOSelectorModalWrapperComponent }; +//# sourceMappingURL=dso-selector-modal-wrapper.component.js.map \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.js.map b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.js.map new file mode 100644 index 0000000000..cca46daeae --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dso-selector-modal-wrapper.component.js","sourceRoot":"","sources":["dso-selector-modal-wrapper.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGlC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGrC,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,mCAAa,CAAA;AACf,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAED;;GAEG;AAGH;IAqBE,0CAAsB,WAA2B,EAAY,KAAqB;QAA5D,gBAAW,GAAX,WAAW,CAAgB;QAAY,UAAK,GAAL,KAAK,CAAgB;IAClF,CAAC;IAED;;OAEG;IACH,mDAAQ,GAAR;QACE,IAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC;QAC9D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,UAAU,CAAC,EAAhB,CAAgB,CAAC,CAAC,CAAC;IACjG,CAAC;IAED;;;OAGG;IACH,uDAAY,GAAZ,UAAa,GAAiB;QAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAQD;;OAEG;IACH,gDAAK,GAAL;QACE,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAhDQ;QAAR,KAAK,EAAE;0CAAS,UAAU;oEAA2B;IAJlC,gCAAgC;QADrD,UAAU,EAAE;iDAsBwB,cAAc,EAAmB,cAAc;OArB9D,gCAAgC,CAqDrD;IAAD,uCAAC;CAAA,AArDD,IAqDC;SArDqB,gCAAgC"} \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.js b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.js new file mode 100644 index 0000000000..c9755f270b --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.js @@ -0,0 +1,40 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { getCollectionEditPath } from '../../../../+collection-page/collection-page-routing.module'; +import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-selector-modal-wrapper.component'; +/** + * Component to wrap a list of existing collections inside a modal + * Used to choose a collection from to edit + */ +var EditCollectionSelectorComponent = /** @class */ (function (_super) { + tslib_1.__extends(EditCollectionSelectorComponent, _super); + function EditCollectionSelectorComponent(activeModal, route, router) { + var _this = _super.call(this, activeModal, route) || this; + _this.activeModal = activeModal; + _this.route = route; + _this.router = router; + _this.objectType = DSpaceObjectType.COLLECTION; + _this.selectorType = DSpaceObjectType.COLLECTION; + _this.action = SelectorActionType.EDIT; + return _this; + } + /** + * Navigate to the collection edit page + */ + EditCollectionSelectorComponent.prototype.navigate = function (dso) { + this.router.navigate([getCollectionEditPath(dso.uuid)]); + }; + EditCollectionSelectorComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-edit-collection-selector', + templateUrl: '../dso-selector-modal-wrapper.component.html', + }), + tslib_1.__metadata("design:paramtypes", [NgbActiveModal, ActivatedRoute, Router]) + ], EditCollectionSelectorComponent); + return EditCollectionSelectorComponent; +}(DSOSelectorModalWrapperComponent)); +export { EditCollectionSelectorComponent }; +//# sourceMappingURL=edit-collection-selector.component.js.map \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.js.map b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.js.map new file mode 100644 index 0000000000..c08b556df3 --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-collection-selector.component.js","sourceRoot":"","sources":["edit-collection-selector.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEpF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAC;AACpG,OAAO,EACL,gCAAgC,EAChC,kBAAkB,EACnB,MAAM,yCAAyC,CAAC;AAEjD;;;GAGG;AAMH;IAAqD,2DAAgC;IAKnF,yCAAsB,WAA2B,EAAY,KAAqB,EAAU,MAAc;QAA1G,YACE,kBAAM,WAAW,EAAE,KAAK,CAAC,SAC1B;QAFqB,iBAAW,GAAX,WAAW,CAAgB;QAAY,WAAK,GAAL,KAAK,CAAgB;QAAU,YAAM,GAAN,MAAM,CAAQ;QAJ1G,gBAAU,GAAG,gBAAgB,CAAC,UAAU,CAAC;QACzC,kBAAY,GAAG,gBAAgB,CAAC,UAAU,CAAC;QAC3C,YAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC;;IAIjC,CAAC;IAED;;OAEG;IACH,kDAAQ,GAAR,UAAS,GAAiB;QACxB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IAdU,+BAA+B;QAJ3C,SAAS,CAAC;YACT,QAAQ,EAAE,6BAA6B;YACvC,WAAW,EAAE,8CAA8C;SAC5D,CAAC;iDAMmC,cAAc,EAAmB,cAAc,EAAkB,MAAM;OAL/F,+BAA+B,CAe3C;IAAD,sCAAC;CAAA,AAfD,CAAqD,gCAAgC,GAepF;SAfY,+BAA+B"} \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.js b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.js new file mode 100644 index 0000000000..001f8ce81e --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.js @@ -0,0 +1,40 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { getCommunityEditPath } from '../../../../+community-page/community-page-routing.module'; +import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-selector-modal-wrapper.component'; +/** + * Component to wrap a list of existing communities inside a modal + * Used to choose a community from to edit + */ +var EditCommunitySelectorComponent = /** @class */ (function (_super) { + tslib_1.__extends(EditCommunitySelectorComponent, _super); + function EditCommunitySelectorComponent(activeModal, route, router) { + var _this = _super.call(this, activeModal, route) || this; + _this.activeModal = activeModal; + _this.route = route; + _this.router = router; + _this.objectType = DSpaceObjectType.COMMUNITY; + _this.selectorType = DSpaceObjectType.COMMUNITY; + _this.action = SelectorActionType.EDIT; + return _this; + } + /** + * Navigate to the community edit page + */ + EditCommunitySelectorComponent.prototype.navigate = function (dso) { + this.router.navigate([getCommunityEditPath(dso.uuid)]); + }; + EditCommunitySelectorComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-edit-community-selector', + templateUrl: '../dso-selector-modal-wrapper.component.html', + }), + tslib_1.__metadata("design:paramtypes", [NgbActiveModal, ActivatedRoute, Router]) + ], EditCommunitySelectorComponent); + return EditCommunitySelectorComponent; +}(DSOSelectorModalWrapperComponent)); +export { EditCommunitySelectorComponent }; +//# sourceMappingURL=edit-community-selector.component.js.map \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.js.map b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.js.map new file mode 100644 index 0000000000..22f6db836b --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-community-selector.component.js","sourceRoot":"","sources":["edit-community-selector.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEpF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2DAA2D,CAAC;AACjG,OAAO,EACL,gCAAgC,EAChC,kBAAkB,EACnB,MAAM,yCAAyC,CAAC;AAEjD;;;GAGG;AAOH;IAAoD,0DAAgC;IAKlF,wCAAsB,WAA2B,EAAY,KAAqB,EAAU,MAAc;QAA1G,YACE,kBAAM,WAAW,EAAE,KAAK,CAAC,SAC1B;QAFqB,iBAAW,GAAX,WAAW,CAAgB;QAAY,WAAK,GAAL,KAAK,CAAgB;QAAU,YAAM,GAAN,MAAM,CAAQ;QAJ1G,gBAAU,GAAG,gBAAgB,CAAC,SAAS,CAAC;QACxC,kBAAY,GAAG,gBAAgB,CAAC,SAAS,CAAC;QAC1C,YAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC;;IAIjC,CAAC;IAED;;OAEG;IACH,iDAAQ,GAAR,UAAS,GAAiB;QACxB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC;IAdU,8BAA8B;QAL1C,SAAS,CAAC;YACT,QAAQ,EAAE,4BAA4B;YACtC,WAAW,EAAE,8CAA8C;SAC5D,CAAC;iDAOmC,cAAc,EAAmB,cAAc,EAAkB,MAAM;OAL/F,8BAA8B,CAe1C;IAAD,qCAAC;CAAA,AAfD,CAAoD,gCAAgC,GAenF;SAfY,8BAA8B"} \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.js b/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.js new file mode 100644 index 0000000000..e0b70e49cd --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.js @@ -0,0 +1,40 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { DSpaceObjectType } from '../../../../core/shared/dspace-object-type.model'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { getItemEditPath } from '../../../../+item-page/item-page-routing.module'; +import { DSOSelectorModalWrapperComponent, SelectorActionType } from '../dso-selector-modal-wrapper.component'; +/** + * Component to wrap a list of existing items inside a modal + * Used to choose an item from to edit + */ +var EditItemSelectorComponent = /** @class */ (function (_super) { + tslib_1.__extends(EditItemSelectorComponent, _super); + function EditItemSelectorComponent(activeModal, route, router) { + var _this = _super.call(this, activeModal, route) || this; + _this.activeModal = activeModal; + _this.route = route; + _this.router = router; + _this.objectType = DSpaceObjectType.ITEM; + _this.selectorType = DSpaceObjectType.ITEM; + _this.action = SelectorActionType.EDIT; + return _this; + } + /** + * Navigate to the item edit page + */ + EditItemSelectorComponent.prototype.navigate = function (dso) { + this.router.navigate([getItemEditPath(dso.uuid)]); + }; + EditItemSelectorComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-edit-item-selector', + templateUrl: '../dso-selector-modal-wrapper.component.html', + }), + tslib_1.__metadata("design:paramtypes", [NgbActiveModal, ActivatedRoute, Router]) + ], EditItemSelectorComponent); + return EditItemSelectorComponent; +}(DSOSelectorModalWrapperComponent)); +export { EditItemSelectorComponent }; +//# sourceMappingURL=edit-item-selector.component.js.map \ No newline at end of file diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.js.map b/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.js.map new file mode 100644 index 0000000000..db6649773b --- /dev/null +++ b/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-item-selector.component.js","sourceRoot":"","sources":["edit-item-selector.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEpF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAClF,OAAO,EAAE,gCAAgC,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE/G;;;GAGG;AAMH;IAA+C,qDAAgC;IAK7E,mCAAsB,WAA2B,EAAY,KAAqB,EAAU,MAAc;QAA1G,YACE,kBAAM,WAAW,EAAE,KAAK,CAAC,SAC1B;QAFqB,iBAAW,GAAX,WAAW,CAAgB;QAAY,WAAK,GAAL,KAAK,CAAgB;QAAU,YAAM,GAAN,MAAM,CAAQ;QAJ1G,gBAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC;QACnC,kBAAY,GAAG,gBAAgB,CAAC,IAAI,CAAC;QACrC,YAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC;;IAIjC,CAAC;IAED;;OAEG;IACH,4CAAQ,GAAR,UAAS,GAAiB;QACxB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAdU,yBAAyB;QAJrC,SAAS,CAAC;YACT,QAAQ,EAAE,uBAAuB;YACjC,WAAW,EAAE,8CAA8C;SAC5D,CAAC;iDAMmC,cAAc,EAAmB,cAAc,EAAkB,MAAM;OAL/F,yBAAyB,CAerC;IAAD,gCAAC;CAAA,AAfD,CAA+C,gCAAgC,GAe9E;SAfY,yBAAyB"} \ No newline at end of file diff --git a/src/app/shared/empty.util.js b/src/app/shared/empty.util.js new file mode 100644 index 0000000000..36de3a2845 --- /dev/null +++ b/src/app/shared/empty.util.js @@ -0,0 +1,168 @@ +import { filter, map } from 'rxjs/operators'; +/** + * Returns true if the passed value is null. + * isNull(); // false + * isNull(null); // true + * isNull(undefined); // false + * isNull(''); // false + * isNull({}); // false + * isNull([]); // false + * isNull(function() {}); // false + */ +export function isNull(obj) { + return obj === null; +} +/** + * Returns true if the passed value is not null. + * isNotNull(); // true + * isNotNull(null); // false + * isNotNull(undefined); // true + * isNotNull(''); // true + * isNotNull({}); // true + * isNotNull([]); // true + * isNotNull(function() {}); // true + */ +export function isNotNull(obj) { + return obj !== null; +} +/** + * Returns true if the passed value is undefined. + * isUndefined(); // true + * isUndefined(null); // false + * isUndefined(undefined); // true + * isUndefined(''); // false + * isUndefined({}); // false + * isUndefined([]); // false + * isUndefined(function() {}); // false + */ +export function isUndefined(obj) { + return obj === undefined; +} +/** + * Returns true if the passed value is not undefined. + * isNotUndefined(); // false + * isNotUndefined(null); // true + * isNotUndefined(undefined); // false + * isNotUndefined(''); // true + * isNotUndefined({}); // true + * isNotUndefined([]); // true + * isNotUndefined(function() {}); // true + */ +export function isNotUndefined(obj) { + return obj !== undefined; +} +/** + * Returns true if the passed value is null or undefined. + * hasNoValue(); // true + * hasNoValue(null); // true + * hasNoValue(undefined); // true + * hasNoValue(''); // false + * hasNoValue({}); // false + * hasNoValue([]); // false + * hasNoValue(function() {}); // false + */ +export function hasNoValue(obj) { + return isUndefined(obj) || isNull(obj); +} +/** + * Returns true if the passed value is not null or undefined. + * hasValue(); // false + * hasValue(null); // false + * hasValue(undefined); // false + * hasValue(''); // true + * hasValue({}); // true + * hasValue([]); // true + * hasValue(function() {}); // true + */ +export function hasValue(obj) { + return isNotUndefined(obj) && isNotNull(obj); +} +/** + * Filter items emitted by the source Observable by only emitting those for + * which hasValue is true + */ +export var hasValueOperator = function () { + return function (source) { + return source.pipe(filter(function (obj) { return hasValue(obj); })); + }; +}; +/** + * Verifies that a value is `null` or an empty string, empty array, + * or empty function. + * isEmpty(); // true + * isEmpty(null); // true + * isEmpty(undefined); // true + * isEmpty(''); // true + * isEmpty([]); // true + * isEmpty({}); // true + * isEmpty('Adam Hawkins'); // false + * isEmpty([0,1,2]); // false + * isEmpty('\n\t'); // false + * isEmpty(' '); // false + */ +export function isEmpty(obj) { + if (hasNoValue(obj)) { + return true; + } + if (typeof obj.size === 'number') { + return !obj.size; + } + var objectType = typeof obj; + if (objectType === 'object') { + var size = obj.size; + if (typeof size === 'number') { + return !size; + } + } + if (typeof obj.length === 'number' && objectType !== 'function') { + return !obj.length; + } + if (objectType === 'object') { + if (Object.keys(obj).length === 0) { + return true; + } + var length_1 = obj.length; + if (typeof length_1 === 'number') { + return !length_1; + } + } + return false; +} +/** + * Verifies that a value is not `null`, an empty string, empty array, + * or empty function. + * isNotEmpty(); // false + * isNotEmpty(null); // false + * isNotEmpty(undefined); // false + * isNotEmpty(''); // false + * isNotEmpty([]); // false + * isNotEmpty({}); // false + * isNotEmpty('Adam Hawkins'); // true + * isNotEmpty([0,1,2]); // true + * isNotEmpty('\n\t'); // true + * isNotEmpty(' '); // true + */ +export function isNotEmpty(obj) { + return !isEmpty(obj); +} +/** + * Filter items emitted by the source Observable by only emitting those for + * which isNotEmpty is true + */ +export var isNotEmptyOperator = function () { + return function (source) { + return source.pipe(filter(function (obj) { return isNotEmpty(obj); })); + }; +}; +/** + * Tests each value emitted by the source Observable, + * let's arrays pass through, turns other values in to + * empty arrays. Used to be able to chain array operators + * on something that may not have a value + */ +export var ensureArrayHasValue = function () { + return function (source) { + return source.pipe(map(function (arr) { return Array.isArray(arr) ? arr : []; })); + }; +}; +//# sourceMappingURL=empty.util.js.map \ No newline at end of file diff --git a/src/app/shared/empty.util.js.map b/src/app/shared/empty.util.js.map new file mode 100644 index 0000000000..c6ce45aee6 --- /dev/null +++ b/src/app/shared/empty.util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"empty.util.js","sourceRoot":"","sources":["empty.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,iBAAiB,GAAS;IAC9B,OAAO,GAAG,KAAK,IAAI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ED,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,UAAU,KAAK,UAAU,EAAE;QAC/D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;KACpB;IAED,IAAI,UAAU,KAAK,QAAQ,EAAE;QAC3B,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;YACjC,OAAO,IAAI,CAAC;SACb;QACD,IAAM,QAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1B,IAAI,OAAO,QAAM,KAAK,QAAQ,EAAE;YAC9B,OAAO,CAAC,QAAM,CAAC;SAChB;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,qBAAqB,GAAS;IAClC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAG;IAChC,OAAA,UAAI,MAAqB;QACvB,OAAA,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAC,GAAM,IAAK,OAAA,UAAU,CAAC,GAAG,CAAC,EAAf,CAAe,CAAC,CAAC;IAAhD,CAAgD;AADlD,CACkD,CAAC;AAErD;;;;;GAKG;AACH,MAAM,CAAC,IAAM,mBAAmB,GAAG;IACjC,OAAA,UAAI,MAAuB;QACzB,OAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,GAAQ,IAAU,OAAA,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAA7B,CAA6B,CAAC,CAAC;IAAlE,CAAkE;AADpE,CACoE,CAAC"} \ No newline at end of file diff --git a/src/app/shared/error/error.component.js b/src/app/shared/error/error.component.js new file mode 100644 index 0000000000..3734773afb --- /dev/null +++ b/src/app/shared/error/error.component.js @@ -0,0 +1,37 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; +var ErrorComponent = /** @class */ (function () { + function ErrorComponent(translate) { + this.translate = translate; + this.message = 'Error...'; + } + ErrorComponent.prototype.ngOnInit = function () { + var _this = this; + if (this.message === undefined) { + this.subscription = this.translate.get('error.default').subscribe(function (message) { + _this.message = message; + }); + } + }; + ErrorComponent.prototype.ngOnDestroy = function () { + if (this.subscription !== undefined) { + this.subscription.unsubscribe(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ErrorComponent.prototype, "message", void 0); + ErrorComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-error', + styleUrls: ['./error.component.scss'], + templateUrl: './error.component.html' + }), + tslib_1.__metadata("design:paramtypes", [TranslateService]) + ], ErrorComponent); + return ErrorComponent; +}()); +export { ErrorComponent }; +//# sourceMappingURL=error.component.js.map \ No newline at end of file diff --git a/src/app/shared/error/error.component.js.map b/src/app/shared/error/error.component.js.map new file mode 100644 index 0000000000..97f842e63a --- /dev/null +++ b/src/app/shared/error/error.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"error.component.js","sourceRoot":"","sources":["error.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AASvD;IAME,wBAAoB,SAA2B;QAA3B,cAAS,GAAT,SAAS,CAAkB;QAJtC,YAAO,GAAG,UAAU,CAAC;IAM9B,CAAC;IAED,iCAAQ,GAAR;QAAA,iBAMC;QALC,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;YAC9B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,UAAC,OAAe;gBAChF,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACzB,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,oCAAW,GAAX;QACE,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE;YACnC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;SACjC;IACH,CAAC;IApBQ;QAAR,KAAK,EAAE;;mDAAsB;IAFnB,cAAc;QAL1B,SAAS,CAAC;YACT,QAAQ,EAAE,UAAU;YACpB,SAAS,EAAE,CAAC,wBAAwB,CAAC;YACrC,WAAW,EAAE,wBAAwB;SACtC,CAAC;iDAO+B,gBAAgB;OANpC,cAAc,CAuB1B;IAAD,qBAAC;CAAA,AAvBD,IAuBC;SAvBY,cAAc"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.js b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.js new file mode 100644 index 0000000000..c28292c919 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.js @@ -0,0 +1,202 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, Component, ComponentFactoryResolver, ContentChildren, EventEmitter, Input, Output, QueryList, ViewChild, ViewContainerRef } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { DYNAMIC_FORM_CONTROL_TYPE_ARRAY, DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX, DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX_GROUP, DYNAMIC_FORM_CONTROL_TYPE_DATEPICKER, DYNAMIC_FORM_CONTROL_TYPE_GROUP, DYNAMIC_FORM_CONTROL_TYPE_INPUT, DYNAMIC_FORM_CONTROL_TYPE_RADIO_GROUP, DYNAMIC_FORM_CONTROL_TYPE_SELECT, DYNAMIC_FORM_CONTROL_TYPE_TEXTAREA, DYNAMIC_FORM_CONTROL_TYPE_TIMEPICKER, DynamicFormControlContainerComponent, DynamicFormLayoutService, DynamicFormValidationService, DynamicTemplateDirective, } from '@ng-dynamic-forms/core'; +import { DynamicNGBootstrapCalendarComponent, DynamicNGBootstrapCheckboxComponent, DynamicNGBootstrapCheckboxGroupComponent, DynamicNGBootstrapInputComponent, DynamicNGBootstrapRadioGroupComponent, DynamicNGBootstrapSelectComponent, DynamicNGBootstrapTextAreaComponent, DynamicNGBootstrapTimePickerComponent } from '@ng-dynamic-forms/ui-ng-bootstrap'; +import { TranslateService } from '@ngx-translate/core'; +import { DYNAMIC_FORM_CONTROL_TYPE_TYPEAHEAD } from './models/typeahead/dynamic-typeahead.model'; +import { DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN } from './models/scrollable-dropdown/dynamic-scrollable-dropdown.model'; +import { DYNAMIC_FORM_CONTROL_TYPE_TAG } from './models/tag/dynamic-tag.model'; +import { DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER } from './models/date-picker/date-picker.model'; +import { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP } from './models/lookup/dynamic-lookup.model'; +import { DynamicListCheckboxGroupModel } from './models/list/dynamic-list-checkbox-group.model'; +import { DynamicListRadioGroupModel } from './models/list/dynamic-list-radio-group.model'; +import { isNotEmpty, isNotUndefined } from '../../../empty.util'; +import { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME } from './models/lookup/dynamic-lookup-name.model'; +import { DsDynamicTagComponent } from './models/tag/dynamic-tag.component'; +import { DsDatePickerComponent } from './models/date-picker/date-picker.component'; +import { DsDynamicListComponent } from './models/list/dynamic-list.component'; +import { DsDynamicTypeaheadComponent } from './models/typeahead/dynamic-typeahead.component'; +import { DsDynamicScrollableDropdownComponent } from './models/scrollable-dropdown/dynamic-scrollable-dropdown.component'; +import { DsDynamicLookupComponent } from './models/lookup/dynamic-lookup.component'; +import { DsDynamicFormGroupComponent } from './models/form-group/dynamic-form-group.component'; +import { DsDynamicFormArrayComponent } from './models/array-group/dynamic-form-array.component'; +import { DsDynamicRelationGroupComponent } from './models/relation-group/dynamic-relation-group.components'; +import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './models/relation-group/dynamic-relation-group.model'; +import { DsDatePickerInlineComponent } from './models/date-picker-inline/dynamic-date-picker-inline.component'; +export function dsDynamicFormControlMapFn(model) { + switch (model.type) { + case DYNAMIC_FORM_CONTROL_TYPE_ARRAY: + return DsDynamicFormArrayComponent; + case DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX: + return DynamicNGBootstrapCheckboxComponent; + case DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX_GROUP: + return (model instanceof DynamicListCheckboxGroupModel) ? DsDynamicListComponent : DynamicNGBootstrapCheckboxGroupComponent; + case DYNAMIC_FORM_CONTROL_TYPE_DATEPICKER: + var datepickerModel = model; + return datepickerModel.inline ? DynamicNGBootstrapCalendarComponent : DsDatePickerInlineComponent; + case DYNAMIC_FORM_CONTROL_TYPE_GROUP: + return DsDynamicFormGroupComponent; + case DYNAMIC_FORM_CONTROL_TYPE_INPUT: + return DynamicNGBootstrapInputComponent; + case DYNAMIC_FORM_CONTROL_TYPE_RADIO_GROUP: + return (model instanceof DynamicListRadioGroupModel) ? DsDynamicListComponent : DynamicNGBootstrapRadioGroupComponent; + case DYNAMIC_FORM_CONTROL_TYPE_SELECT: + return DynamicNGBootstrapSelectComponent; + case DYNAMIC_FORM_CONTROL_TYPE_TEXTAREA: + return DynamicNGBootstrapTextAreaComponent; + case DYNAMIC_FORM_CONTROL_TYPE_TIMEPICKER: + return DynamicNGBootstrapTimePickerComponent; + case DYNAMIC_FORM_CONTROL_TYPE_TYPEAHEAD: + return DsDynamicTypeaheadComponent; + case DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN: + return DsDynamicScrollableDropdownComponent; + case DYNAMIC_FORM_CONTROL_TYPE_TAG: + return DsDynamicTagComponent; + case DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP: + return DsDynamicRelationGroupComponent; + case DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER: + return DsDatePickerComponent; + case DYNAMIC_FORM_CONTROL_TYPE_LOOKUP: + return DsDynamicLookupComponent; + case DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME: + return DsDynamicLookupComponent; + default: + return null; + } +} +var DsDynamicFormControlContainerComponent = /** @class */ (function (_super) { + tslib_1.__extends(DsDynamicFormControlContainerComponent, _super); + function DsDynamicFormControlContainerComponent(componentFactoryResolver, layoutService, validationService, translateService) { + var _this = _super.call(this, componentFactoryResolver, layoutService, validationService) || this; + _this.componentFactoryResolver = componentFactoryResolver; + _this.layoutService = layoutService; + _this.validationService = validationService; + _this.translateService = translateService; + _this.asBootstrapFormGroup = true; + _this.bindId = true; + _this.context = null; + _this.hasErrorMessaging = false; + _this.layout = null; + /* tslint:disable:no-output-rename */ + _this.blur = new EventEmitter(); + _this.change = new EventEmitter(); + _this.focus = new EventEmitter(); + _this.customEvent = new EventEmitter(); + return _this; + } + Object.defineProperty(DsDynamicFormControlContainerComponent.prototype, "componentType", { + get: function () { + return this.layoutService.getCustomComponentType(this.model) || dsDynamicFormControlMapFn(this.model); + }, + enumerable: true, + configurable: true + }); + DsDynamicFormControlContainerComponent.prototype.ngOnChanges = function (changes) { + if (changes) { + _super.prototype.ngOnChanges.call(this, changes); + if (this.model && this.model.placeholder) { + this.model.placeholder = this.translateService.instant(this.model.placeholder); + } + } + }; + DsDynamicFormControlContainerComponent.prototype.ngDoCheck = function () { + if (isNotUndefined(this.showErrorMessagesPreviousStage) && this.showErrorMessagesPreviousStage !== this.showErrorMessages) { + this.showErrorMessagesPreviousStage = this.showErrorMessages; + this.forceShowErrorDetection(); + } + }; + DsDynamicFormControlContainerComponent.prototype.ngAfterViewInit = function () { + this.showErrorMessagesPreviousStage = this.showErrorMessages; + }; + /** + * Since Form Control Components created dynamically have 'OnPush' change detection strategy, + * changes are not propagated. So use this method to force an update + */ + DsDynamicFormControlContainerComponent.prototype.forceShowErrorDetection = function () { + if (this.showErrorMessages) { + this.destroyFormControlComponent(); + this.createFormControlComponent(); + } + }; + DsDynamicFormControlContainerComponent.prototype.onChangeLanguage = function (event) { + if (isNotEmpty(this.model.value)) { + this.onChange(event); + } + }; + tslib_1.__decorate([ + ContentChildren(DynamicTemplateDirective), + tslib_1.__metadata("design:type", QueryList) + ], DsDynamicFormControlContainerComponent.prototype, "contentTemplateList", void 0); + tslib_1.__decorate([ + Input('templates'), + tslib_1.__metadata("design:type", QueryList) + ], DsDynamicFormControlContainerComponent.prototype, "inputTemplateList", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], DsDynamicFormControlContainerComponent.prototype, "formId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicFormControlContainerComponent.prototype, "asBootstrapFormGroup", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicFormControlContainerComponent.prototype, "bindId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicFormControlContainerComponent.prototype, "context", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], DsDynamicFormControlContainerComponent.prototype, "group", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicFormControlContainerComponent.prototype, "hasErrorMessaging", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicFormControlContainerComponent.prototype, "layout", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicFormControlContainerComponent.prototype, "model", void 0); + tslib_1.__decorate([ + Output('dfBlur'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormControlContainerComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output('dfChange'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormControlContainerComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output('dfFocus'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormControlContainerComponent.prototype, "focus", void 0); + tslib_1.__decorate([ + Output('ngbEvent'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormControlContainerComponent.prototype, "customEvent", void 0); + tslib_1.__decorate([ + ViewChild('componentViewContainer', { read: ViewContainerRef }), + tslib_1.__metadata("design:type", ViewContainerRef) + ], DsDynamicFormControlContainerComponent.prototype, "componentViewContainerRef", void 0); + DsDynamicFormControlContainerComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-dynamic-form-control-container', + styleUrls: ['./ds-dynamic-form-control-container.component.scss'], + templateUrl: './ds-dynamic-form-control-container.component.html', + changeDetection: ChangeDetectionStrategy.Default + }), + tslib_1.__metadata("design:paramtypes", [ComponentFactoryResolver, + DynamicFormLayoutService, + DynamicFormValidationService, + TranslateService]) + ], DsDynamicFormControlContainerComponent); + return DsDynamicFormControlContainerComponent; +}(DynamicFormControlContainerComponent)); +export { DsDynamicFormControlContainerComponent }; +//# sourceMappingURL=ds-dynamic-form-control-container.component.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.js.map new file mode 100644 index 0000000000..a7c74cfa18 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ds-dynamic-form-control-container.component.js","sourceRoot":"","sources":["ds-dynamic-form-control-container.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,wBAAwB,EACxB,eAAe,EACf,YAAY,EACZ,KAAK,EAEL,MAAM,EACN,SAAS,EAGT,SAAS,EACT,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,EAClC,wCAAwC,EACxC,oCAAoC,EACpC,+BAA+B,EAC/B,+BAA+B,EAC/B,qCA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CAAC;0CAAS,YAAY;0EAAwE;IAC7F;QAAlB,MAAM,CAAC,SAAS,CAAC;0CAAQ,YAAY;yEAAwE;IAC1F;QAAnB,MAAM,CAAC,UAAU,CAAC;0CAAc,YAAY;+EAAwE;IAEtD;QAA9D,SAAS,CAAC,wBAAwB,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAC,CAAC;0CAA4B,gBAAgB;6FAAC;IArBhG,sCAAsC;QANlD,SAAS,CAAC;YACT,QAAQ,EAAE,mCAAmC;YAC7C,SAAS,EAAE,CAAC,oDAAoD,CAAC;YACjE,WAAW,EAAE,oDAAoD;YACjE,eAAe,EAAE,uBAAuB,CAAC,OAAO;SACjD,CAAC;iDAgCsC,wBAAwB;YACnC,wBAAwB;YACpB,4BAA4B;YAC7B,gBAAgB;OAlCnC,sCAAsC,CA4ElD;IAAD,6CAAC;CAAA,AA5ED,CAA4D,oCAAoC,GA4E/F;SA5EY,sCAAsC"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.js b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.js new file mode 100644 index 0000000000..b1ec2001f7 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.js @@ -0,0 +1,71 @@ +import * as tslib_1 from "tslib"; +import { Component, ContentChildren, EventEmitter, Input, Output, QueryList, ViewChildren } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { DynamicFormComponent, DynamicFormLayoutService, DynamicTemplateDirective, } from '@ng-dynamic-forms/core'; +import { DsDynamicFormControlContainerComponent } from './ds-dynamic-form-control-container.component'; +import { FormBuilderService } from '../form-builder.service'; +var DsDynamicFormComponent = /** @class */ (function (_super) { + tslib_1.__extends(DsDynamicFormComponent, _super); + function DsDynamicFormComponent(formService, layoutService) { + var _this = _super.call(this, formService, layoutService) || this; + _this.formService = formService; + _this.layoutService = layoutService; + _this.formLayout = null; + /* tslint:disable:no-output-rename */ + _this.blur = new EventEmitter(); + _this.change = new EventEmitter(); + _this.focus = new EventEmitter(); + _this.customEvent = new EventEmitter(); + return _this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], DsDynamicFormComponent.prototype, "formId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], DsDynamicFormComponent.prototype, "formGroup", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], DsDynamicFormComponent.prototype, "formModel", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicFormComponent.prototype, "formLayout", void 0); + tslib_1.__decorate([ + Output('dfBlur'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output('dfChange'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output('dfFocus'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormComponent.prototype, "focus", void 0); + tslib_1.__decorate([ + Output('ngbEvent'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormComponent.prototype, "customEvent", void 0); + tslib_1.__decorate([ + ContentChildren(DynamicTemplateDirective), + tslib_1.__metadata("design:type", QueryList) + ], DsDynamicFormComponent.prototype, "templates", void 0); + tslib_1.__decorate([ + ViewChildren(DsDynamicFormControlContainerComponent), + tslib_1.__metadata("design:type", QueryList) + ], DsDynamicFormComponent.prototype, "components", void 0); + DsDynamicFormComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-dynamic-form', + templateUrl: './ds-dynamic-form.component.html' + }), + tslib_1.__metadata("design:paramtypes", [FormBuilderService, DynamicFormLayoutService]) + ], DsDynamicFormComponent); + return DsDynamicFormComponent; +}(DynamicFormComponent)); +export { DsDynamicFormComponent }; +//# sourceMappingURL=ds-dynamic-form.component.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.js.map new file mode 100644 index 0000000000..e2d1e7d8a7 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ds-dynamic-form.component.js","sourceRoot":"","sources":["ds-dynamic-form.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,oBAAoB,EAKpB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,sCAAsC,EAAE,MAAM,+CAA+C,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAM7D;IAA4C,kDAAoB;IAkB9D,gCAAsB,WAA+B,EAAY,aAAuC;QAAxG,YACE,kBAAM,WAAW,EAAE,aAAa,CAAC,SAClC;QAFqB,iBAAW,GAAX,WAAW,CAAoB;QAAY,mBAAa,GAAb,aAAa,CAA0B;QAb/F,gBAAU,GAAG,IAAyB,CAAC;QAEhD,qCAAqC;QACnB,UAAI,GAA0C,IAAI,YAAY,EAA2B,CAAC;QACxF,YAAM,GAA0C,IAAI,YAAY,EAA2B,CAAC;QAC7F,WAAK,GAA0C,IAAI,YAAY,EAA2B,CAAC;QAC1F,iBAAW,GAA0C,IAAI,YAAY,EAA2B,CAAC;;IASrH,CAAC;IAlBQ;QAAR,KAAK,EAAE;;0DAAgB;IACf;QAAR,KAAK,EAAE;0CAAY,SAAS;6DAAC;IACrB;QAAR,KAAK,EAAE;;6DAAsC;IACrC;QAAR,KAAK,EAAE;;8DAAwC;IAG9B;QAAjB,MAAM,CAAC,QAAQ,CAAC;0CAAO,YAAY;wDAAwE;IACxF;QAAnB,MAAM,CAAC,UAAU,CAAC;0CAAS,YAAY;0DAAwE;IAC7F;QAAlB,MAAM,CAAC,SAAS,CAAC;0CAAQ,YAAY;yDAAwE;IAC1F;QAAnB,MAAM,CAAC,UAAU,CAAC;0CAAc,YAAY;+DAAwE;IAG1E;QAA1C,eAAe,CAAC,wBAAwB,CAAC;0CAAY,SAAS;6DAA2B;IAEpC;QAArD,YAAY,CAAC,sCAAsC,CAAC;0CAAa,SAAS;8DAAuC;IAhBvG,sBAAsB;QAJlC,SAAS,CAAC;YACT,QAAQ,EAAE,iBAAiB;YAC3B,WAAW,EAAE,kCAAkC;SAChD,CAAC;iDAmBmC,kBAAkB,EAA2B,wBAAwB;OAlB7F,sBAAsB,CAsBlC;IAAD,6BAAC;CAAA,AAtBD,CAA4C,oBAAoB,GAsB/D;SAtBY,sBAAsB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.js new file mode 100644 index 0000000000..1667e9808a --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.js @@ -0,0 +1,67 @@ +import * as tslib_1 from "tslib"; +import { Component, EventEmitter, Input, Output, QueryList } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { DynamicFormArrayComponent, DynamicFormArrayModel, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; +var DsDynamicFormArrayComponent = /** @class */ (function (_super) { + tslib_1.__extends(DsDynamicFormArrayComponent, _super); + /* tslint:enable:no-output-rename */ + function DsDynamicFormArrayComponent(layoutService, validationService) { + var _this = _super.call(this, layoutService, validationService) || this; + _this.layoutService = layoutService; + _this.validationService = validationService; + _this.bindId = true; + /* tslint:disable:no-output-rename */ + _this.blur = new EventEmitter(); + _this.change = new EventEmitter(); + _this.focus = new EventEmitter(); + _this.customEvent = new EventEmitter(); + return _this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicFormArrayComponent.prototype, "bindId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], DsDynamicFormArrayComponent.prototype, "group", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicFormArrayComponent.prototype, "layout", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", DynamicFormArrayModel) + ], DsDynamicFormArrayComponent.prototype, "model", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", QueryList) + ], DsDynamicFormArrayComponent.prototype, "templates", void 0); + tslib_1.__decorate([ + Output('dfBlur'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormArrayComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output('dfChange'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormArrayComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output('dfFocus'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormArrayComponent.prototype, "focus", void 0); + tslib_1.__decorate([ + Output('ngbEvent'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormArrayComponent.prototype, "customEvent", void 0); + DsDynamicFormArrayComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-dynamic-form-array', + templateUrl: './dynamic-form-array.component.html' + }), + tslib_1.__metadata("design:paramtypes", [DynamicFormLayoutService, + DynamicFormValidationService]) + ], DsDynamicFormArrayComponent); + return DsDynamicFormArrayComponent; +}(DynamicFormArrayComponent)); +export { DsDynamicFormArrayComponent }; +//# sourceMappingURL=dynamic-form-array.component.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.js.map new file mode 100644 index 0000000000..8e553fbae0 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-form-array.component.js","sourceRoot":"","sources":["dynamic-form-array.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EAGrB,wBAAwB,EACxB,4BAA4B,EAE7B,MAAM,wBAAwB,CAAC;AAMhC;IAAiD,uDAAyB;IAaxE,oCAAoC;IAEpC,qCAAsB,aAAuC,EACvC,iBAA+C;QADrE,YAGE,kBAAM,aAAa,EAAE,iBAAiB,CAAC,SACxC;QAJqB,mBAAa,GAAb,aAAa,CAA0B;QACvC,uBAAiB,GAAjB,iBAAiB,CAA8B;QAd5D,YAAM,GAAG,IAAI,CAAC;QAMvB,qCAAqC;QACnB,UAAI,GAA0C,IAAI,YAAY,EAA2B,CAAC;QACxF,YAAM,GAA0C,IAAI,YAAY,EAA2B,CAAC;QAC7F,WAAK,GAA0C,IAAI,YAAY,EAA2B,CAAC;QAC1F,iBAAW,GAAgD,IAAI,YAAY,EAAE,CAAC;;IAOlG,CAAC;IAjBQ;QAAR,KAAK,EAAE;;+DAAe;IACd;QAAR,KAAK,EAAE;0CAAQ,SAAS;8DAAC;IACjB;QAAR,KAAK,EAAE;;+DAA2B;IAC1B;QAAR,KAAK,EAAE;0CAAQ,qBAAqB;8DAAC;IAC7B;QAAR,KAAK,EAAE;0CAAY,SAAS;kEAAuC;IAGlD;QAAjB,MAAM,CAAC,QAAQ,CAAC;0CAAO,YAAY;6DAAwE;IACxF;QAAnB,MAAM,CAAC,UAAU,CAAC;0CAAS,YAAY;+DAAwE;IAC7F;QAAlB,MAAM,CAAC,SAAS,CAAC;0CAAQ,YAAY;8DAAwE;IAC1F;QAAnB,MAAM,CAAC,UAAU,CAAC;0CAAc,YAAY;oEAAqD;IAZvF,2BAA2B;QAJvC,SAAS,CAAC;YACP,QAAQ,EAAE,uBAAuB;YACjC,WAAW,EAAE,qCAAqC;SACrD,CAAC;iDAgBqC,wBAAwB;YACpB,4BAA4B;OAhB1D,2BAA2B,CAqBvC;IAAD,kCAAC;CAAA,AArBD,CAAiD,yBAAyB,GAqBzE;SArBY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component.js new file mode 100644 index 0000000000..c2f9f1d92a --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component.js @@ -0,0 +1,63 @@ +import * as tslib_1 from "tslib"; +import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { NgbDatepicker, NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap'; +import { DynamicDatePickerModel, DynamicFormControlComponent, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; +var DsDatePickerInlineComponent = /** @class */ (function (_super) { + tslib_1.__extends(DsDatePickerInlineComponent, _super); + function DsDatePickerInlineComponent(layoutService, validationService, config) { + var _this = _super.call(this, layoutService, validationService) || this; + _this.layoutService = layoutService; + _this.validationService = validationService; + _this.config = config; + _this.bindId = true; + _this.blur = new EventEmitter(); + _this.change = new EventEmitter(); + _this.focus = new EventEmitter(); + return _this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDatePickerInlineComponent.prototype, "bindId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], DsDatePickerInlineComponent.prototype, "group", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDatePickerInlineComponent.prototype, "layout", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", DynamicDatePickerModel) + ], DsDatePickerInlineComponent.prototype, "model", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDatePickerInlineComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDatePickerInlineComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDatePickerInlineComponent.prototype, "focus", void 0); + tslib_1.__decorate([ + ViewChild(NgbDatepicker), + tslib_1.__metadata("design:type", NgbDatepicker) + ], DsDatePickerInlineComponent.prototype, "ngbDatePicker", void 0); + DsDatePickerInlineComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-dynamic-date-picker-inline', + templateUrl: './dynamic-date-picker-inline.component.html' + }), + tslib_1.__metadata("design:paramtypes", [DynamicFormLayoutService, + DynamicFormValidationService, + NgbDatepickerConfig]) + ], DsDatePickerInlineComponent); + return DsDatePickerInlineComponent; +}(DynamicFormControlComponent)); +export { DsDatePickerInlineComponent }; +//# sourceMappingURL=dynamic-date-picker-inline.component.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component.js.map new file mode 100644 index 0000000000..918206c93e --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-date-picker-inline.component.js","sourceRoot":"","sources":["dynamic-date-picker-inline.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAClF,O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/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component.js new file mode 100644 index 0000000000..e1a2bf8b40 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component.js @@ -0,0 +1,191 @@ +import * as tslib_1 from "tslib"; +import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { DynamicDsDatePickerModel } from './date-picker.model'; +import { hasValue } from '../../../../../empty.util'; +import { DynamicFormControlComponent, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; +export var DS_DATE_PICKER_SEPARATOR = '-'; +var DsDatePickerComponent = /** @class */ (function (_super) { + tslib_1.__extends(DsDatePickerComponent, _super); + function DsDatePickerComponent(layoutService, validationService) { + var _this = _super.call(this, layoutService, validationService) || this; + _this.layoutService = layoutService; + _this.validationService = validationService; + _this.bindId = true; + // @Input() + // minDate; + // @Input() + // maxDate; + _this.selected = new EventEmitter(); + _this.remove = new EventEmitter(); + _this.blur = new EventEmitter(); + _this.change = new EventEmitter(); + _this.focus = new EventEmitter(); + _this.minMonth = 1; + _this.maxMonth = 12; + _this.minDay = 1; + _this.maxDay = 31; + _this.yearPlaceholder = 'year'; + _this.monthPlaceholder = 'month'; + _this.dayPlaceholder = 'day'; + _this.disabledMonth = true; + _this.disabledDay = true; + return _this; + } + DsDatePickerComponent.prototype.ngOnInit = function () { + var now = new Date(); + this.initialYear = now.getFullYear(); + this.initialMonth = now.getMonth() + 1; + this.initialDay = now.getDate(); + if (this.model.value && this.model.value !== null) { + var values = this.model.value.toString().split(DS_DATE_PICKER_SEPARATOR); + if (values.length > 0) { + this.initialYear = parseInt(values[0], 10); + this.year = this.initialYear; + this.disabledMonth = false; + } + if (values.length > 1) { + this.initialMonth = parseInt(values[1], 10); + this.month = this.initialMonth; + this.disabledDay = false; + } + if (values.length > 2) { + this.initialDay = parseInt(values[2], 10); + this.day = this.initialDay; + } + } + this.maxYear = this.initialYear + 100; + }; + DsDatePickerComponent.prototype.onBlur = function (event) { + this.blur.emit(); + }; + DsDatePickerComponent.prototype.onChange = function (event) { + // update year-month-day + switch (event.field) { + case 'year': { + if (event.value !== null) { + this.year = event.value; + } + else { + this.year = undefined; + this.month = undefined; + this.day = undefined; + this.disabledMonth = true; + this.disabledDay = true; + } + break; + } + case 'month': { + if (event.value !== null) { + this.month = event.value; + } + else { + this.month = undefined; + this.day = undefined; + this.disabledDay = true; + } + break; + } + case 'day': { + if (event.value !== null) { + this.day = event.value; + } + else { + this.day = undefined; + } + break; + } + } + // set max for days by month/year + if (!this.disabledDay) { + var month = this.month ? this.month - 1 : 0; + var date = new Date(this.year, month, 1); + this.maxDay = this.getLastDay(date); + if (this.day > this.maxDay) { + this.day = this.maxDay; + } + } + // Manage disable + if (hasValue(this.year) && event.field === 'year') { + this.disabledMonth = false; + } + else if (hasValue(this.month) && event.field === 'month') { + this.disabledDay = false; + } + // update value + var value = null; + if (hasValue(this.year)) { + var yyyy = this.year.toString(); + while (yyyy.length < 4) { + yyyy = '0' + yyyy; + } + value = yyyy; + } + if (hasValue(this.month)) { + var mm = this.month.toString().length === 1 + ? '0' + this.month.toString() + : this.month.toString(); + value += DS_DATE_PICKER_SEPARATOR + mm; + } + if (hasValue(this.day)) { + var dd = this.day.toString().length === 1 + ? '0' + this.day.toString() + : this.day.toString(); + value += DS_DATE_PICKER_SEPARATOR + dd; + } + this.model.valueUpdates.next(value); + this.change.emit(value); + }; + DsDatePickerComponent.prototype.onFocus = function (event) { + this.focus.emit(event); + }; + DsDatePickerComponent.prototype.getLastDay = function (date) { + // Last Day of the same month (+1 month, -1 day) + date.setMonth(date.getMonth() + 1, 0); + return date.getDate(); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDatePickerComponent.prototype, "bindId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], DsDatePickerComponent.prototype, "group", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", DynamicDsDatePickerModel) + ], DsDatePickerComponent.prototype, "model", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], DsDatePickerComponent.prototype, "selected", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], DsDatePickerComponent.prototype, "remove", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], DsDatePickerComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], DsDatePickerComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], DsDatePickerComponent.prototype, "focus", void 0); + DsDatePickerComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-date-picker', + styleUrls: ['./date-picker.component.scss'], + templateUrl: './date-picker.component.html', + }), + tslib_1.__metadata("design:paramtypes", [DynamicFormLayoutService, + DynamicFormValidationService]) + ], DsDatePickerComponent); + return DsDatePickerComponent; +}(DynamicFormControlComponent)); +export { DsDatePickerComponent }; +//# sourceMappingURL=date-picker.component.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component.js.map new file mode 100644 index 0000000000..ea9d6873d8 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"date-picker.component.js","sourceRoot":"","sources":["date-picker.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;A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G,CAAC,QAAQ,EAAE,CAAC;YACxB,KAAK,IAAI,wBAAwB,GAAG,EAAE,CAAC;SACxC;QAED,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,uCAAO,GAAP,UAAQ,KAAK;QACX,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,0CAAU,GAAV,UAAW,IAAU;QACnB,gDAAgD;QAChD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAhKQ;QAAR,KAAK,EAAE;;yDAAe;IACd;QAAR,KAAK,EAAE;0CAAQ,SAAS;wDAAC;IACjB;QAAR,KAAK,EAAE;0CAAQ,wBAAwB;wDAAC;IAM/B;QAAT,MAAM,EAAE;;2DAAuC;IACtC;QAAT,MAAM,EAAE;;yDAAqC;IACpC;QAAT,MAAM,EAAE;;uDAAgC;IAC/B;QAAT,MAAM,EAAE;;yDAAkC;IACjC;QAAT,MAAM,EAAE;;wDAAiC;IAb/B,qBAAqB;QANjC,SAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,CAAC,8BAA8B,CAAC;YAC3C,WAAW,EAAE,8BAA8B;SAC5C,CAAC;iDAuCqC,wBAAwB;YACpB,4BAA4B;OAtC1D,qBAAqB,CAmKjC;IAAD,4BAAC;CAAA,AAnKD,CAA2C,2BAA2B,GAmKrE;SAnKY,qBAAqB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.model.js new file mode 100644 index 0000000000..e545309337 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.model.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { DynamicDateControlModel, serializable } from '@ng-dynamic-forms/core'; +export var DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER = 'DATE'; +/** + * Dynamic Date Picker Model class + */ +var DynamicDsDatePickerModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicDsDatePickerModel, _super); + function DynamicDsDatePickerModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.type = DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER; + _this.hasLanguages = false; + _this.malformedDate = false; + return _this; + } + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicDsDatePickerModel.prototype, "type", void 0); + return DynamicDsDatePickerModel; +}(DynamicDateControlModel)); +export { DynamicDsDatePickerModel }; +//# sourceMappingURL=date-picker.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.model.js.map new file mode 100644 index 0000000000..42d6bfcfd3 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"date-picker.model.js","sourceRoot":"","sources":["date-picker.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAA4B,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAIzG,MAAM,CAAC,IAAM,sCAAsC,GAAG,MAAM,CAAC;AAE7D;;GAEG;AACH;IAA8C,oDAAuB;IAMnE,kCAAY,MAAqC,EAAE,MAAiC;QAApF,YACE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAEtB;QARwB,UAAI,GAAW,sCAAsC,CAAC;QAG/E,kBAAY,GAAG,KAAK,CAAC;QAInB,KAAI,CAAC,aAAa,GAAG,KAAK,CAAC;;IAC7B,CAAC;IARe;QAAf,YAAY,EAAE;;0DAAgE;IAUjF,+BAAC;CAAA,AAXD,CAA8C,uBAAuB,GAWpE;SAXY,wBAAwB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.js new file mode 100644 index 0000000000..0a8197a64b --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.js @@ -0,0 +1,67 @@ +import * as tslib_1 from "tslib"; +import { DynamicFormGroupModel, serializable } from '@ng-dynamic-forms/core'; +import { isNotEmpty } from '../../../../empty.util'; +import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model'; +export var CONCAT_GROUP_SUFFIX = '_CONCAT_GROUP'; +export var CONCAT_FIRST_INPUT_SUFFIX = '_CONCAT_FIRST_INPUT'; +export var CONCAT_SECOND_INPUT_SUFFIX = '_CONCAT_SECOND_INPUT'; +var DynamicConcatModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicConcatModel, _super); + function DynamicConcatModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.hasLanguages = false; + _this.isCustomGroup = true; + _this.separator = config.separator + ' '; + return _this; + } + Object.defineProperty(DynamicConcatModel.prototype, "value", { + get: function () { + var firstValue = this.get(0).value; + var secondValue = this.get(1).value; + if (isNotEmpty(firstValue) && isNotEmpty(secondValue)) { + return new FormFieldMetadataValueObject(firstValue + this.separator + secondValue); + } + else if (isNotEmpty(firstValue)) { + return new FormFieldMetadataValueObject(firstValue); + } + else { + return null; + } + }, + set: function (value) { + var values; + var tempValue; + if (typeof value === 'string') { + tempValue = value; + } + else { + tempValue = value.value; + } + if (tempValue.includes(this.separator)) { + values = tempValue.split(this.separator); + } + else { + values = [tempValue, null]; + } + if (values[0]) { + this.get(0).valueUpdates.next(values[0]); + } + if (values[1]) { + this.get(1).valueUpdates.next(values[1]); + } + }, + enumerable: true, + configurable: true + }); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicConcatModel.prototype, "separator", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Object) + ], DynamicConcatModel.prototype, "hasLanguages", void 0); + return DynamicConcatModel; +}(DynamicFormGroupModel)); +export { DynamicConcatModel }; +//# sourceMappingURL=ds-dynamic-concat.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.js.map new file mode 100644 index 0000000000..31af370487 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ds-dynamic-concat.model.js","sourceRoot":"","sources":["ds-dynamic-concat.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAA4B,qBAAqB,EAA+B,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACpI,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAE5F,MAAM,CAAC,IAAM,mBAAmB,GAAG,eAAe,CAAC;AACnD,MAAM,CAAC,IAAM,yBAAyB,GAAG,qBAAqB,CAAC;AAC/D,MAAM,CAAC,IAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAMjE;IAAwC,8CAAqB;IAM3D,4BAAY,MAAgC,EAAE,MAAiC;QAA/E,YAEE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAGtB;QARe,kBAAY,GAAG,KAAK,CAAC;QACrC,mBAAa,GAAG,IAAI,CAAC;QAMnB,KAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC;;IAC1C,CAAC;IAED,sBAAI,qCAAK;aAAT;YACE,IAAM,UAAU,GAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAyB,CAAC,KA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+CvC,yBAAC;CAAA,AAlDD,CAAwC,qBAAqB,GAkD5D;SAlDY,kBAAkB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model.js new file mode 100644 index 0000000000..27811034b3 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model.js @@ -0,0 +1,95 @@ +import * as tslib_1 from "tslib"; +import { DynamicInputModel, serializable } from '@ng-dynamic-forms/core'; +import { Subject } from 'rxjs'; +import { AuthorityOptions } from '../../../../../core/integration/models/authority-options.model'; +import { hasValue } from '../../../../empty.util'; +import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model'; +var DsDynamicInputModel = /** @class */ (function (_super) { + tslib_1.__extends(DsDynamicInputModel, _super); + function DsDynamicInputModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.readOnly = config.readOnly; + _this.value = config.value; + _this.language = config.language; + if (!_this.language) { + // TypeAhead + if (config.value instanceof FormFieldMetadataValueObject) { + _this.language = config.value.language; + } + else if (Array.isArray(config.value)) { + // Tag of Authority + if (config.value[0].language) { + _this.language = config.value[0].language; + } + } + } + _this.languageCodes = config.languageCodes; + _this.languageUpdates = new Subject(); + _this.languageUpdates.subscribe(function (lang) { + _this.language = lang; + }); + _this.authorityOptions = config.authorityOptions; + return _this; + } + Object.defineProperty(DsDynamicInputModel.prototype, "hasAuthority", { + get: function () { + return this.authorityOptions && hasValue(this.authorityOptions.name); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DsDynamicInputModel.prototype, "hasLanguages", { + get: function () { + if (this.languageCodes && this.languageCodes.length > 1) { + return true; + } + else { + return false; + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DsDynamicInputModel.prototype, "language", { + get: function () { + return this._language; + }, + set: function (language) { + this._language = language; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DsDynamicInputModel.prototype, "languageCodes", { + get: function () { + return this._languageCodes; + }, + set: function (languageCodes) { + this._languageCodes = languageCodes; + if (!this.language || this.language === null || this.language === '') { + this.language = this.languageCodes ? this.languageCodes[0].code : null; + } + }, + enumerable: true, + configurable: true + }); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", AuthorityOptions) + ], DsDynamicInputModel.prototype, "authorityOptions", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Array) + ], DsDynamicInputModel.prototype, "_languageCodes", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DsDynamicInputModel.prototype, "_language", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Subject) + ], DsDynamicInputModel.prototype, "languageUpdates", void 0); + return DsDynamicInputModel; +}(DynamicInputModel)); +export { DsDynamicInputModel }; +//# sourceMappingURL=ds-dynamic-input.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model.js.map new file mode 100644 index 0000000000..62eca7e177 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ds-dynamic-input.model.js","sourceRoot":"","sources":["ds-dynamic-input.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,iBAAiB,EAEjB,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gEAAgE,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAS5F;IAAyC,+CAAiB;IAOxD,6BAAY,MAAiC,EAAE,MAAiC;QAAhF,YACE,kBAAM,MAAM,EAAE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AAO,KAAK,CAAC;aACd;QACH,CAAC;;;OAAA;IAED,sBAAI,yCAAQ;aAAZ;YACE,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;aAED,UAAa,QAAgB;YAC3B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC5B,CAAC;;;OAJA;IAMD,sBAAI,8CAAa;aAAjB;YACE,OAAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;aAED,UAAkB,aAA6B;YAC7C,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,EAAE,EAAE;gBACpE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;aACxE;QACH,CAAC;;;OAPA;IAtDe;QAAf,YAAY,EAAE;0CAAmB,gBAAgB;iEAAC;IACnC;QAAf,YAAY,EAAE;;+DAAwC;IACvC;QAAf,YAAY,EAAE;;0DAA2B;IAC1B;QAAf,YAAY,EAAE;0CAAkB,OAAO;gEAAS;IA4DnD,0BAAC;CAAA,AAjED,CAAyC,iBAAiB,GAiEzD;SAjEY,mBAAmB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model.js new file mode 100644 index 0000000000..04a397f3f0 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model.js @@ -0,0 +1,82 @@ +import * as tslib_1 from "tslib"; +import { DynamicFormGroupModel, serializable } from '@ng-dynamic-forms/core'; +import { Subject } from 'rxjs'; +export var QUALDROP_GROUP_SUFFIX = '_QUALDROP_GROUP'; +export var QUALDROP_METADATA_SUFFIX = '_QUALDROP_METADATA'; +export var QUALDROP_VALUE_SUFFIX = '_QUALDROP_VALUE'; +var DynamicQualdropModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicQualdropModel, _super); + function DynamicQualdropModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.hasLanguages = false; + _this.isCustomGroup = true; + _this.readOnly = config.readOnly; + _this.language = config.language; + _this.languageCodes = config.languageCodes; + _this.languageUpdates = new Subject(); + _this.languageUpdates.subscribe(function (lang) { + _this.language = lang; + }); + return _this; + } + Object.defineProperty(DynamicQualdropModel.prototype, "value", { + get: function () { + return this.get(1).value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DynamicQualdropModel.prototype, "qualdropId", { + get: function () { + return this.get(0).value.toString(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DynamicQualdropModel.prototype, "language", { + get: function () { + return this._language; + }, + set: function (language) { + this._language = language; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DynamicQualdropModel.prototype, "languageCodes", { + get: function () { + return this._languageCodes; + }, + set: function (languageCodes) { + this._languageCodes = languageCodes; + if (!this.language || this.language === null || this.language === '') { + this.language = this.languageCodes ? this.languageCodes[0].code : null; + } + }, + enumerable: true, + configurable: true + }); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicQualdropModel.prototype, "_language", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Array) + ], DynamicQualdropModel.prototype, "_languageCodes", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Subject) + ], DynamicQualdropModel.prototype, "languageUpdates", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Object) + ], DynamicQualdropModel.prototype, "hasLanguages", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Boolean) + ], DynamicQualdropModel.prototype, "readOnly", void 0); + return DynamicQualdropModel; +}(DynamicFormGroupModel)); +export { DynamicQualdropModel }; +//# sourceMappingURL=ds-dynamic-qualdrop.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model.js.map new file mode 100644 index 0000000000..6c6004c128 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ds-dynamic-qualdrop.model.js","sourceRoot":"","sources":["ds-dynamic-qualdrop.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAA4B,qBAAqB,EAA2B,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEhI,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAI/B,MAAM,CAAC,IAAM,qBAAqB,GAAG,iBAAiB,CAAC;AACvD,MAAM,CAAC,IAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAC7D,MAAM,CAAC,IAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAQvD;IAA0C,gDAAqB;IAQ7D,8BAAY,MAAoC,EAAE,MAAiC;QAAnF,YACE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAUtB;QAfe,kBAAY,GAAG,KAAK,CAAC;QAErC,mBAAa,GAAG,IAAI,CAAC;QAKnB,KAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,KAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,KAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAE1C,KAAI,CAAC,eAAe,GAAG,IAAI,OAAO,EAAU,CAAC;QAC7C,KAAI,CAAC,eAAe,CAAC,SAAS,CAAC,UAAC,IAAY;YAC1C,KAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC,CAAC,CAAC;;IACL,CAAC;IAED,sBAAI,uCAAK;aAAT;YACE,OAAQ,IAAI,CAAC,GAAG,CAAC,CAAC,CAAyB,CAAC,KAAK,CAAC;QACpD,CAAC;;;OAAA;IAED,sBAAI,4CAAU;aAAd;YACE,OAAQ,IAAI,CAAC,GAAG,CAAC,CAAC,CAAyB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC/D,CAAC;;;OAAA;IAED,sBAAI,0CAAQ;aAAZ;YACE,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;aAED,UAAa,QAAgB;YAC3B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC5B,CAAC;;;OAJA;IAMD,sBAAI,+CAAa;aAAjB;YACE,OAAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;aAED,UAAkB,aAA6B;YAC7C,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,EAAE,EAAE;gBACpE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;aACxE;QACH,CAAC;;;OAPA;IAtCe;QAAf,YAAY,EAAE;;2DAA2B;IAC1B;QAAf,YAAY,EAAE;;gEAAwC;IACvC;QAAf,YAAY,EAAE;0CAAkB,OAAO;iEAAS;IACjC;QAAf,YAAY,EAAE;;8DAAsB;IACrB;QAAf,YAAY,EAAE;;0DAAmB;IA2CpC,2BAAC;CAAA,AAhDD,CAA0C,qBAAqB,GAgD9D;SAhDY,oBAAoB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model.js new file mode 100644 index 0000000000..7f1b031146 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model.js @@ -0,0 +1,19 @@ +import * as tslib_1 from "tslib"; +import { DynamicFormArrayModel, serializable } from '@ng-dynamic-forms/core'; +var DynamicRowArrayModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicRowArrayModel, _super); + function DynamicRowArrayModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.notRepeatable = false; + _this.isRowArray = true; + _this.notRepeatable = config.notRepeatable; + return _this; + } + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Object) + ], DynamicRowArrayModel.prototype, "notRepeatable", void 0); + return DynamicRowArrayModel; +}(DynamicFormArrayModel)); +export { DynamicRowArrayModel }; +//# sourceMappingURL=ds-dynamic-row-array-model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model.js.map new file mode 100644 index 0000000000..b5b1a40f2d --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ds-dynamic-row-array-model.js","sourceRoot":"","sources":["ds-dynamic-row-array-model.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,qBAAqB,EACrB,YAAY,EACb,MAAM,wBAAwB,CAAC;AAOhC;IAA0C,gDAAqB;IAI7D,8BAAY,MAAkC,EAAE,MAAiC;QAAjF,YACE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAEtB;QANe,mBAAa,GAAG,KAAK,CAAC;QACtC,gBAAU,GAAG,IAAI,CAAC;QAIhB,KAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;;IAC5C,CAAC;IANe;QAAf,YAAY,EAAE;;+DAAuB;IAQxC,2BAAC;CAAA,AATD,CAA0C,qBAAqB,GAS9D;SATY,oBAAoB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model.js new file mode 100644 index 0000000000..8faf7630e4 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model.js @@ -0,0 +1,13 @@ +import * as tslib_1 from "tslib"; +import { DynamicFormGroupModel } from '@ng-dynamic-forms/core'; +var DynamicRowGroupModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicRowGroupModel, _super); + function DynamicRowGroupModel() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.isRowGroup = true; + return _this; + } + return DynamicRowGroupModel; +}(DynamicFormGroupModel)); +export { DynamicRowGroupModel }; +//# sourceMappingURL=ds-dynamic-row-group-model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model.js.map new file mode 100644 index 0000000000..777982262e --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ds-dynamic-row-group-model.js","sourceRoot":"","sources":["ds-dynamic-row-group-model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;IAA0C,gDAAqB;IAA/D;QAAA,qEAEC;QADC,gBAAU,GAAG,IAAI,CAAC;;IACpB,CAAC;IAAD,2BAAC;AAAD,CAAC,AAFD,CAA0C,qBAAqB,GAE9D"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-textarea.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-textarea.model.js new file mode 100644 index 0000000000..e450e49fa8 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-textarea.model.js @@ -0,0 +1,33 @@ +import * as tslib_1 from "tslib"; +import { DYNAMIC_FORM_CONTROL_TYPE_TEXTAREA, serializable } from '@ng-dynamic-forms/core'; +import { DsDynamicInputModel } from './ds-dynamic-input.model'; +var DsDynamicTextAreaModel = /** @class */ (function (_super) { + tslib_1.__extends(DsDynamicTextAreaModel, _super); + function DsDynamicTextAreaModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.type = DYNAMIC_FORM_CONTROL_TYPE_TEXTAREA; + _this.cols = config.cols; + _this.rows = config.rows; + _this.wrap = config.wrap; + return _this; + } + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Number) + ], DsDynamicTextAreaModel.prototype, "cols", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Number) + ], DsDynamicTextAreaModel.prototype, "rows", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DsDynamicTextAreaModel.prototype, "wrap", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicTextAreaModel.prototype, "type", void 0); + return DsDynamicTextAreaModel; +}(DsDynamicInputModel)); +export { DsDynamicTextAreaModel }; +//# sourceMappingURL=ds-dynamic-textarea.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-textarea.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-textarea.model.js.map new file mode 100644 index 0000000000..23c477fb13 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-textarea.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ds-dynamic-textarea.model.js","sourceRoot":"","sources":["ds-dynamic-textarea.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kCAAkC,EAA4B,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACpH,OAAO,EAAE,mBAAmB,EAA6B,MAAM,0BAA0B,CAAC;AAQ1F;IAA4C,kDAAmB;IAM7D,gCAAY,MAAoC,EAAE,MAAiC;QAAnF,YACE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAKtB;QARe,UAAI,GAAG,kCAAkC,CAAC;QAKxD,KAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,KAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,KAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;;IAC1B,CAAC;IAXe;QAAf,YAAY,EAAE;;wDAAc;IACb;QAAf,YAAY,EAAE;;wDAAc;IACb;QAAf,YAAY,EAAE;;wDAAc;IACb;QAAf,YAAY,EAAE;;wDAA2C;IAU5D,6BAAC;CAAA,AAdD,CAA4C,mBAAmB,GAc9D;SAdY,sBAAsB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/form-group/dynamic-form-group.component.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/form-group/dynamic-form-group.component.js new file mode 100644 index 0000000000..95c9163b73 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/form-group/dynamic-form-group.component.js @@ -0,0 +1,68 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { DynamicFormControlComponent, DynamicFormGroupModel, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; +var DsDynamicFormGroupComponent = /** @class */ (function (_super) { + tslib_1.__extends(DsDynamicFormGroupComponent, _super); + /* tslint:enable:no-output-rename */ + function DsDynamicFormGroupComponent(layoutService, validationService) { + var _this = _super.call(this, layoutService, validationService) || this; + _this.layoutService = layoutService; + _this.validationService = validationService; + _this.bindId = true; + /* tslint:disable:no-output-rename */ + _this.blur = new EventEmitter(); + _this.change = new EventEmitter(); + _this.focus = new EventEmitter(); + _this.customEvent = new EventEmitter(); + return _this; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicFormGroupComponent.prototype, "bindId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], DsDynamicFormGroupComponent.prototype, "group", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicFormGroupComponent.prototype, "layout", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", DynamicFormGroupModel) + ], DsDynamicFormGroupComponent.prototype, "model", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicFormGroupComponent.prototype, "templates", void 0); + tslib_1.__decorate([ + Output('dfBlur'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormGroupComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output('dfChange'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormGroupComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output('dfFocus'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormGroupComponent.prototype, "focus", void 0); + tslib_1.__decorate([ + Output('ngbEvent'), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicFormGroupComponent.prototype, "customEvent", void 0); + DsDynamicFormGroupComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-dynamic-form-group', + templateUrl: './dynamic-form-group.component.html', + changeDetection: ChangeDetectionStrategy.Default + }), + tslib_1.__metadata("design:paramtypes", [DynamicFormLayoutService, + DynamicFormValidationService]) + ], DsDynamicFormGroupComponent); + return DsDynamicFormGroupComponent; +}(DynamicFormControlComponent)); +export { DsDynamicFormGroupComponent }; +//# sourceMappingURL=dynamic-form-group.component.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/form-group/dynamic-form-group.component.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/form-group/dynamic-form-group.component.js.map new file mode 100644 index 0000000000..61f88fd799 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/form-group/dynamic-form-group.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F,2BAA2B;QALvC,SAAS,CAAC;YACT,QAAQ,EAAE,uBAAuB;YACjC,WAAW,EAAE,qCAAqC;YAClD,eAAe,EAAE,uBAAuB,CAAC,OAAO;SACjD,CAAC;iDAgBqC,wBAAwB;YACpB,4BAA4B;OAhB1D,2BAA2B,CAqBvC;IAAD,kCAAC;CAAA,AArBD,CAAiD,2BAA2B,GAqB3E;SArBY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model.js new file mode 100644 index 0000000000..188d90de37 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model.js @@ -0,0 +1,65 @@ +import * as tslib_1 from "tslib"; +import { Subject } from 'rxjs'; +import { DynamicCheckboxGroupModel, serializable } from '@ng-dynamic-forms/core'; +import { AuthorityOptions } from '../../../../../../core/integration/models/authority-options.model'; +import { hasValue } from '../../../../../empty.util'; +var DynamicListCheckboxGroupModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicListCheckboxGroupModel, _super); + function DynamicListCheckboxGroupModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.isListGroup = true; + _this.authorityOptions = config.authorityOptions; + _this.groupLength = config.groupLength || 5; + _this._value = []; + _this.repeatable = config.repeatable; + _this.valueUpdates = new Subject(); + _this.valueUpdates.subscribe(function (value) { return _this.value = value; }); + _this.valueUpdates.next(config.value); + return _this; + } + Object.defineProperty(DynamicListCheckboxGroupModel.prototype, "hasAuthority", { + get: function () { + return this.authorityOptions && hasValue(this.authorityOptions.name); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DynamicListCheckboxGroupModel.prototype, "value", { + get: function () { + return this._value; + }, + set: function (value) { + if (value) { + if (Array.isArray(value)) { + this._value = value; + } + else { + // _value is non extendible so assign it a new array + var newValue = this.value.concat([value]); + this._value = newValue; + } + } + }, + enumerable: true, + configurable: true + }); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", AuthorityOptions) + ], DynamicListCheckboxGroupModel.prototype, "authorityOptions", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Boolean) + ], DynamicListCheckboxGroupModel.prototype, "repeatable", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Number) + ], DynamicListCheckboxGroupModel.prototype, "groupLength", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Array) + ], DynamicListCheckboxGroupModel.prototype, "_value", void 0); + return DynamicListCheckboxGroupModel; +}(DynamicCheckboxGroupModel)); +export { DynamicListCheckboxGroupModel }; +//# sourceMappingURL=dynamic-list-checkbox-group.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model.js.map new file mode 100644 index 0000000000..8f644223b0 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-list-checkbox-group.model.js","sourceRoot":"","sources":["dynamic-list-checkbox-group.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EACL,yBAAyB,EAEzB,YAAY,EACb,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mEAAmE,CAAC;AACrG,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AASrD;IAAmD,yDAAyB;IAS1E,uCAAY,MAA2C,EAAE,MAAiC;QAA1F,YACE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAUtB;QAdD,iBAAW,GAAG,IAAI,CAAC;QAMjB,KAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CA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form/builder/ds-dynamic-form-ui/models/list/dynamic-list-radio-group.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-radio-group.model.js new file mode 100644 index 0000000000..0f1e97c1ea --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-radio-group.model.js @@ -0,0 +1,38 @@ +import * as tslib_1 from "tslib"; +import { DynamicRadioGroupModel, serializable } from '@ng-dynamic-forms/core'; +import { AuthorityOptions } from '../../../../../../core/integration/models/authority-options.model'; +import { hasValue } from '../../../../../empty.util'; +var DynamicListRadioGroupModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicListRadioGroupModel, _super); + function DynamicListRadioGroupModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.isListGroup = true; + _this.authorityOptions = config.authorityOptions; + _this.groupLength = config.groupLength || 5; + _this.repeatable = config.repeatable; + _this.valueUpdates.next(config.value); + return _this; + } + Object.defineProperty(DynamicListRadioGroupModel.prototype, "hasAuthority", { + get: function () { + return this.authorityOptions && hasValue(this.authorityOptions.name); + }, + enumerable: true, + configurable: true + }); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", AuthorityOptions) + ], DynamicListRadioGroupModel.prototype, "authorityOptions", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Boolean) + ], DynamicListRadioGroupModel.prototype, "repeatable", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Number) + ], DynamicListRadioGroupModel.prototype, "groupLength", void 0); + return DynamicListRadioGroupModel; +}(DynamicRadioGroupModel)); +export { DynamicListRadioGroupModel }; +//# sourceMappingURL=dynamic-list-radio-group.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-radio-group.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-radio-group.model.js.map new file mode 100644 index 0000000000..885b1e54ca --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list-radio-group.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-list-radio-group.model.js","sourceRoot":"","sources":["dynamic-list-radio-group.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,sBAAsB,EAEtB,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mEAAmE,CAAC;AACrG,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AASrD;IAAgD,sDAA2B;IAOzE,oCAAY,MAA8B,EAAE,MAAiC;QAA7E,YACE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAMtB;QATD,iBAAW,GAAG,IAAI,CAAC;QAKjB,KAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QAChD,KAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC;QAC3C,KAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,KAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;;IACvC,CAAC;IAED,sBAAI,oDAAY;aAAhB;YACE,OAAO,IAAI,CAAC,gBAAgB,IAAI,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACvE,CAAC;;;OAAA;IAhBe;QAAf,YAAY,EAAE;0CAAmB,gBAAgB;wEAAC;IACnC;QAAf,YAAY,EAAE;;kEAAqB;IACpB;QAAf,YAAY,EAAE;;mEAAqB;IAetC,iCAAC;CAAA,AAnBD,CAAgD,sBAAsB,GAmBrE;SAnBY,0BAA0B"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.js new file mode 100644 index 0000000000..9079b03574 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.js @@ -0,0 +1,146 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { findKey } from 'lodash'; +import { AuthorityService } from '../../../../../../core/integration/authority.service'; +import { IntegrationSearchOptions } from '../../../../../../core/integration/models/integration-options.model'; +import { hasValue, isNotEmpty } from '../../../../../empty.util'; +import { FormBuilderService } from '../../../form-builder.service'; +import { DynamicCheckboxModel, DynamicFormControlComponent, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; +var DsDynamicListComponent = /** @class */ (function (_super) { + tslib_1.__extends(DsDynamicListComponent, _super); + function DsDynamicListComponent(authorityService, cdr, formBuilderService, layoutService, validationService) { + var _this = _super.call(this, layoutService, validationService) || this; + _this.authorityService = authorityService; + _this.cdr = cdr; + _this.formBuilderService = formBuilderService; + _this.layoutService = layoutService; + _this.validationService = validationService; + _this.bindId = true; + _this.blur = new EventEmitter(); + _this.change = new EventEmitter(); + _this.focus = new EventEmitter(); + _this.items = []; + return _this; + } + DsDynamicListComponent.prototype.ngOnInit = function () { + if (this.hasAuthorityOptions()) { + // TODO Replace max elements 1000 with a paginated request when pagination bug is resolved + this.searchOptions = new IntegrationSearchOptions(this.model.authorityOptions.scope, this.model.authorityOptions.name, this.model.authorityOptions.metadata, '', 1000, // Max elements + 1); // Current Page + this.setOptionsFromAuthority(); + } + }; + DsDynamicListComponent.prototype.onBlur = function (event) { + this.blur.emit(event); + }; + DsDynamicListComponent.prototype.onFocus = function (event) { + this.focus.emit(event); + }; + DsDynamicListComponent.prototype.onChange = function (event) { + var target = event.target; + if (this.model.repeatable) { + // Target tabindex coincide with the array index of the value into the authority list + var authorityValue_1 = this.optionsList[target.tabIndex]; + if (target.checked) { + this.model.valueUpdates.next(authorityValue_1); + } + else { + var newValue_1 = []; + this.model.value + .filter(function (item) { return item.value !== authorityValue_1.value; }) + .forEach(function (item) { return newValue_1.push(item); }); + this.model.valueUpdates.next(newValue_1); + } + } + else { + this.model.valueUpdates.next(this.optionsList[target.value]); + } + this.change.emit(event); + }; + DsDynamicListComponent.prototype.setOptionsFromAuthority = function () { + var _this = this; + if (this.model.authorityOptions.name && this.model.authorityOptions.name.length > 0) { + var listGroup_1 = this.group.controls[this.model.id]; + this.authorityService.getEntriesByName(this.searchOptions).subscribe(function (authorities) { + var groupCounter = 0; + var itemsPerGroup = 0; + var tempList = []; + _this.optionsList = authorities.payload; + // Make a list of available options (checkbox/radio) and split in groups of 'model.groupLength' + authorities.payload.forEach(function (option, key) { + var value = option.id || option.value; + var checked = isNotEmpty(findKey(_this.model.value, function (v) { return v.value === option.value; })); + var item = { + id: value, + label: option.display, + value: checked, + index: key + }; + if (_this.model.repeatable) { + _this.formBuilderService.addFormGroupControl(listGroup_1, _this.model, new DynamicCheckboxModel(item)); + } + else { + _this.model.options.push({ + label: item.label, + value: option + }); + } + tempList.push(item); + itemsPerGroup++; + _this.items[groupCounter] = tempList; + if (itemsPerGroup === _this.model.groupLength) { + groupCounter++; + itemsPerGroup = 0; + tempList = []; + } + }); + _this.cdr.markForCheck(); + }); + } + }; + DsDynamicListComponent.prototype.hasAuthorityOptions = function () { + return (hasValue(this.model.authorityOptions.scope) + && hasValue(this.model.authorityOptions.name) + && hasValue(this.model.authorityOptions.metadata)); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicListComponent.prototype, "bindId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], DsDynamicListComponent.prototype, "group", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicListComponent.prototype, "model", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicListComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicListComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicListComponent.prototype, "focus", void 0); + DsDynamicListComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-dynamic-list', + styleUrls: ['./dynamic-list.component.scss'], + templateUrl: './dynamic-list.component.html' + }), + tslib_1.__metadata("design:paramtypes", [AuthorityService, + ChangeDetectorRef, + FormBuilderService, + DynamicFormLayoutService, + DynamicFormValidationService]) + ], DsDynamicListComponent); + return DsDynamicListComponent; +}(DynamicFormControlComponent)); +export { DsDynamicListComponent }; +//# sourceMappingURL=dynamic-list.component.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.js.map new file mode 100644 index 0000000000..192083834a --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-list.component.js","sourceRoot":"","sources":["dynamic-list.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sDAAsD,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,qEAAqE,CAAC;AAC/G,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAAE,wBAAwB,EACrD,4BAA4B,EAC7B,MAAM,wBAAwB,CAAC;AAkBhC;IAA4C,kDAA2B;IAarE,gCAAoB,gBAAkC,EAClC,GAAsB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CAAC,CAAC,CAAC;gBACH,KAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;YAC1B,CAAC,CAAC,CAAC;SAEJ;IACH,CAAC;IAES,oDAAmB,GAA7B;QACE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC;eAC9C,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC;eAC1C,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvD,CAAC;IA/GQ;QAAR,KAAK,EAAE;;0DAAe;IACd;QAAR,KAAK,EAAE;0CAAQ,SAAS;yDAAC;IACjB;QAAR,KAAK,EAAE;;yDAAmE;IAEjE;QAAT,MAAM,EAAE;0CAAO,YAAY;wDAAgC;IAClD;QAAT,MAAM,EAAE;0CAAS,YAAY;0DAAgC;IACpD;QAAT,MAAM,EAAE;0CAAQ,YAAY;yDAAgC;IAPlD,sBAAsB;QANlC,SAAS,CAAC;YACT,QAAQ,EAAE,iBAAiB;YAC3B,SAAS,EAAE,CAAC,+BAA+B,CAAC;YAC5C,WAAW,EAAE,+BAA+B;SAC7C,CAAC;iDAesC,gBAAgB;YAC7B,iBAAiB;YACF,kBAAkB;YACrB,wBAAwB;YACpB,4BAA4B;OAjB1D,sBAAsB,CAiHlC;IAAD,6BAAC;CAAA,AAjHD,CAA4C,2BAA2B,GAiHtE;SAjHY,sBAAsB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model.js new file mode 100644 index 0000000000..4c1d443f66 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model.js @@ -0,0 +1,30 @@ +import * as tslib_1 from "tslib"; +import { serializable } from '@ng-dynamic-forms/core'; +import { DynamicLookupModel } from './dynamic-lookup.model'; +export var DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME = 'LOOKUP_NAME'; +var DynamicLookupNameModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicLookupNameModel, _super); + function DynamicLookupNameModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.type = DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME; + _this.separator = config.separator || ','; + _this.placeholder = config.firstPlaceholder || 'form.last-name'; + _this.secondPlaceholder = config.secondPlaceholder || 'form.first-name'; + return _this; + } + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicLookupNameModel.prototype, "separator", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicLookupNameModel.prototype, "secondPlaceholder", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicLookupNameModel.prototype, "type", void 0); + return DynamicLookupNameModel; +}(DynamicLookupModel)); +export { DynamicLookupNameModel }; +//# sourceMappingURL=dynamic-lookup-name.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model.js.map new file mode 100644 index 0000000000..728d6e91a7 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-lookup-name.model.js","sourceRoot":"","sources":["dynamic-lookup-name.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAA4B,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAA4B,MAAM,wBAAwB,CAAC;AAEtF,MAAM,CAAC,IAAM,qCAAqC,GAAG,aAAa,CAAC;AAQnE;IAA4C,kDAAkB;IAM5D,gCAAY,MAAoC,EAAE,MAAiC;QAAnF,YAEE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAKtB;QATwB,UAAI,GAAW,qCAAqC,CAAC;QAM5E,KAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,GAAG,CAAC;QACzC,KAAI,CAAC,WAAW,GAAG,MAAM,CAAC,gBAAgB,IAAI,gBAAgB,CAAC;QAC/D,KAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,IAAI,iBAAiB,CAAC;;IACzE,CAAC;IAXe;QAAf,YAAY,EAAE;;6DAAmB;IAClB;QAAf,YAAY,EAAE;;qEAA2B;IAC1B;QAAf,YAAY,EAAE;;wDAA+D;IAUhF,6BAAC;CAAA,AAdD,CAA4C,kBAAkB,GAc7D;SAdY,sBAAsB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.js new file mode 100644 index 0000000000..f7422f200a --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.js @@ -0,0 +1,251 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { of as observableOf } from 'rxjs'; +import { catchError, distinctUntilChanged } from 'rxjs/operators'; +import { DynamicFormControlComponent, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; +import { AuthorityService } from '../../../../../../core/integration/authority.service'; +import { IntegrationSearchOptions } from '../../../../../../core/integration/models/integration-options.model'; +import { hasValue, isEmpty, isNotEmpty, isNull, isUndefined } from '../../../../../empty.util'; +import { IntegrationData } from '../../../../../../core/integration/integration-data'; +import { PageInfo } from '../../../../../../core/shared/page-info.model'; +import { FormFieldMetadataValueObject } from '../../../models/form-field-metadata-value.model'; +import { AuthorityValue } from '../../../../../../core/integration/models/authority.value'; +import { DynamicLookupNameModel } from './dynamic-lookup-name.model'; +var DsDynamicLookupComponent = /** @class */ (function (_super) { + tslib_1.__extends(DsDynamicLookupComponent, _super); + function DsDynamicLookupComponent(authorityService, cdr, layoutService, validationService) { + var _this = _super.call(this, layoutService, validationService) || this; + _this.authorityService = authorityService; + _this.cdr = cdr; + _this.layoutService = layoutService; + _this.validationService = validationService; + _this.bindId = true; + _this.blur = new EventEmitter(); + _this.change = new EventEmitter(); + _this.focus = new EventEmitter(); + _this.editMode = false; + _this.firstInputValue = ''; + _this.secondInputValue = ''; + _this.loading = false; + _this.subs = []; + _this.inputFormatter = function (x, y) { + return y === 1 ? _this.firstInputValue : _this.secondInputValue; + }; + return _this; + } + DsDynamicLookupComponent.prototype.ngOnInit = function () { + var _this = this; + this.searchOptions = new IntegrationSearchOptions(this.model.authorityOptions.scope, this.model.authorityOptions.name, this.model.authorityOptions.metadata, '', this.model.maxOptions, 1); + this.setInputsValue(this.model.value); + this.subs.push(this.model.valueUpdates + .subscribe(function (value) { + if (isEmpty(value)) { + _this.resetFields(); + } + else if (!_this.editMode) { + _this.setInputsValue(_this.model.value); + } + })); + }; + DsDynamicLookupComponent.prototype.getCurrentValue = function () { + var result = ''; + if (!this.isLookupName()) { + result = this.firstInputValue; + } + else { + if (isNotEmpty(this.firstInputValue)) { + result = this.firstInputValue; + } + if (isNotEmpty(this.secondInputValue)) { + result = isEmpty(result) + ? this.secondInputValue + : this.firstInputValue + this.model.separator + ' ' + this.secondInputValue; + } + } + return result; + }; + DsDynamicLookupComponent.prototype.resetFields = function () { + this.firstInputValue = ''; + if (this.isLookupName()) { + this.secondInputValue = ''; + } + }; + DsDynamicLookupComponent.prototype.setInputsValue = function (value) { + if (hasValue(value)) { + var displayValue = value; + if (value instanceof FormFieldMetadataValueObject || value instanceof AuthorityValue) { + displayValue = value.display; + } + if (hasValue(displayValue)) { + if (this.isLookupName()) { + var values = displayValue.split(this.model.separator); + this.firstInputValue = (values[0] || '').trim(); + this.secondInputValue = (values[1] || '').trim(); + } + else { + this.firstInputValue = displayValue || ''; + } + } + } + }; + DsDynamicLookupComponent.prototype.formatItemForInput = function (item, field) { + if (isUndefined(item) || isNull(item)) { + return ''; + } + return (typeof item === 'string') ? item : this.inputFormatter(item, field); + }; + DsDynamicLookupComponent.prototype.hasAuthorityValue = function () { + return hasValue(this.model.value) + && this.model.value.hasAuthority(); + }; + DsDynamicLookupComponent.prototype.hasEmptyValue = function () { + return isNotEmpty(this.getCurrentValue()); + }; + DsDynamicLookupComponent.prototype.clearFields = function () { + // Clear inputs whether there is no results and authority is closed + if (this.model.authorityOptions.closed) { + this.resetFields(); + } + }; + DsDynamicLookupComponent.prototype.isEditDisabled = function () { + return !this.hasAuthorityValue(); + }; + DsDynamicLookupComponent.prototype.isInputDisabled = function () { + return (this.model.authorityOptions.closed && this.hasAuthorityValue() && !this.editMode); + }; + DsDynamicLookupComponent.prototype.isLookupName = function () { + return (this.model instanceof DynamicLookupNameModel); + }; + DsDynamicLookupComponent.prototype.isSearchDisabled = function () { + return isEmpty(this.firstInputValue); + }; + DsDynamicLookupComponent.prototype.onBlurEvent = function (event) { + this.blur.emit(event); + }; + DsDynamicLookupComponent.prototype.onFocusEvent = function (event) { + this.focus.emit(event); + }; + DsDynamicLookupComponent.prototype.onInput = function (event) { + if (!this.model.authorityOptions.closed) { + if (isNotEmpty(this.getCurrentValue())) { + var currentValue = new FormFieldMetadataValueObject(this.getCurrentValue()); + if (!this.editMode) { + this.onSelect(currentValue); + } + } + else { + this.remove(); + } + } + }; + DsDynamicLookupComponent.prototype.onScroll = function () { + if (!this.loading && this.pageInfo.currentPage <= this.pageInfo.totalPages) { + this.searchOptions.currentPage++; + this.search(); + } + }; + DsDynamicLookupComponent.prototype.onSelect = function (event) { + this.group.markAsDirty(); + this.model.valueUpdates.next(event); + this.setInputsValue(event); + this.change.emit(event); + this.optionsList = null; + this.pageInfo = null; + }; + DsDynamicLookupComponent.prototype.openChange = function (isOpened) { + if (!isOpened) { + if (this.model.authorityOptions.closed && !this.hasAuthorityValue()) { + this.setInputsValue(''); + } + } + }; + DsDynamicLookupComponent.prototype.remove = function () { + this.group.markAsPristine(); + this.model.valueUpdates.next(null); + this.change.emit(null); + }; + DsDynamicLookupComponent.prototype.saveChanges = function () { + if (isNotEmpty(this.getCurrentValue())) { + var newValue = Object.assign(new AuthorityValue(), this.model.value, { + display: this.getCurrentValue(), + value: this.getCurrentValue() + }); + this.onSelect(newValue); + } + else { + this.remove(); + } + this.switchEditMode(); + }; + DsDynamicLookupComponent.prototype.search = function () { + var _this = this; + this.optionsList = null; + this.pageInfo = null; + // Query + this.searchOptions.query = this.getCurrentValue(); + this.loading = true; + this.subs.push(this.authorityService.getEntriesByName(this.searchOptions).pipe(catchError(function () { + var emptyResult = new IntegrationData(new PageInfo(), []); + return observableOf(emptyResult); + }), distinctUntilChanged()) + .subscribe(function (object) { + _this.optionsList = object.payload; + _this.pageInfo = object.pageInfo; + _this.loading = false; + _this.cdr.detectChanges(); + })); + }; + DsDynamicLookupComponent.prototype.switchEditMode = function () { + this.editMode = !this.editMode; + }; + DsDynamicLookupComponent.prototype.whenClickOnConfidenceNotAccepted = function (sdRef, confidence) { + if (!this.model.readOnly) { + sdRef.open(); + this.search(); + } + }; + DsDynamicLookupComponent.prototype.ngOnDestroy = function () { + this.subs + .filter(function (sub) { return hasValue(sub); }) + .forEach(function (sub) { return sub.unsubscribe(); }); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicLookupComponent.prototype, "bindId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], DsDynamicLookupComponent.prototype, "group", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicLookupComponent.prototype, "model", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicLookupComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicLookupComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicLookupComponent.prototype, "focus", void 0); + DsDynamicLookupComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-dynamic-lookup', + styleUrls: ['./dynamic-lookup.component.scss'], + templateUrl: './dynamic-lookup.component.html' + }), + tslib_1.__metadata("design:paramtypes", [AuthorityService, + ChangeDetectorRef, + DynamicFormLayoutService, + DynamicFormValidationService]) + ], DsDynamicLookupComponent); + return DsDynamicLookupComponent; +}(DynamicFormControlComponent)); +export { DsDynamicLookupComponent }; +//# sourceMappingURL=dynamic-lookup.component.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.js.map new file mode 100644 index 0000000000..13d1f1d24b --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-lookup.component.js","sourceRoot":"","sources":["dynamic-lookup.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAqB,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sDAAsD,CAAC;AAExF,OAAO,EAAE,wBAAwB,EAAE,MAAM,qEAAqE,CAAC;AAC/G,OAAO,EAAE,QAAQ,EAAE,OA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AI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;IACjC,CAAC;IAEM,mEAAgC,GAAvC,UAAwC,KAAkB,EAAE,UAA0B;QACpF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACxB,KAAK,CAAC,IAAI,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,EAAE,CAAC;SACf;IACH,CAAC;IAED,8CAAW,GAAX;QACE,IAAI,CAAC,IAAI;aACN,MAAM,CAAC,UAAC,GAAG,IAAK,OAAA,QAAQ,CAAC,GAAG,CAAC,EAAb,CAAa,CAAC;aAC9B,OAAO,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,WAAW,EAAE,EAAjB,CAAiB,CAAC,CAAC;IACzC,CAAC;IA9OQ;QAAR,KAAK,EAAE;;4DAAe;IACd;QAAR,KAAK,EAAE;0CAAQ,SAAS;2DAAC;IACjB;QAAR,KAAK,EAAE;;2DAAoD;IAElD;QAAT,MAAM,EAAE;0CAAO,YAAY;0DAAgC;IAClD;QAAT,MAAM,EAAE;0CAAS,YAAY;4DAAgC;IACpD;QAAT,MAAM,EAAE;0CAAQ,YAAY;2DAAgC;IAPlD,wBAAwB;QALpC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,SAAS,EAAE,CAAC,iCAAiC,CAAC;YAC9C,WAAW,EAAE,iCAAiC;SAC/C,CAAC;iDAoBsC,gBAAgB;YAC7B,iBAAiB;YACL,wBAAwB;YACpB,4BAA4B;OAtB1D,wBAAwB,CAgPpC;IAAD,+BAAC;CAAA,AAhPD,CAA8C,2BAA2B,GAgPxE;SAhPY,wBAAwB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.model.js new file mode 100644 index 0000000000..3107853d13 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.model.js @@ -0,0 +1,30 @@ +import * as tslib_1 from "tslib"; +import { AUTOCOMPLETE_OFF, serializable } from '@ng-dynamic-forms/core'; +import { DsDynamicInputModel } from '../ds-dynamic-input.model'; +export var DYNAMIC_FORM_CONTROL_TYPE_LOOKUP = 'LOOKUP'; +var DynamicLookupModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicLookupModel, _super); + function DynamicLookupModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.type = DYNAMIC_FORM_CONTROL_TYPE_LOOKUP; + _this.autoComplete = AUTOCOMPLETE_OFF; + _this.maxOptions = config.maxOptions || 10; + _this.valueUpdates.next(config.value); + return _this; + } + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Number) + ], DynamicLookupModel.prototype, "maxOptions", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicLookupModel.prototype, "type", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Object) + ], DynamicLookupModel.prototype, "value", void 0); + return DynamicLookupModel; +}(DsDynamicInputModel)); +export { DynamicLookupModel }; +//# sourceMappingURL=dynamic-lookup.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.model.js.map new file mode 100644 index 0000000000..2321f0a4e1 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-lookup.model.js","sourceRoot":"","sources":["dynamic-lookup.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAA4B,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAA6B,MAAM,2BAA2B,CAAC;AAE3F,MAAM,CAAC,IAAM,gCAAgC,GAAG,QAAQ,CAAC;AAOzD;IAAwC,8CAAmB;IAMzD,4BAAY,MAAgC,EAAE,MAAiC;QAA/E,YAEE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAMtB;QAXwB,UAAI,GAAW,gCAAgC,CAAC;QAOvE,KAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC;QACrC,KAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;QAE1C,KAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;;IACvC,CAAC;IAZe;QAAf,YAAY,EAAE;;0DAAoB;IACnB;QAAf,YAAY,EAAE;;oDAA0D;IACzD;QAAf,YAAY,EAAE;;qDAAY;IAW7B,yBAAC;CAAA,AAfD,CAAwC,mBAAmB,GAe1D;SAfY,kBAAkB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components.js new file mode 100644 index 0000000000..a039cf82e4 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components.js @@ -0,0 +1,282 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, EventEmitter, Inject, Input, Output, ViewChild } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { combineLatest, of as observableOf } from 'rxjs'; +import { filter, flatMap, map, mergeMap, scan } from 'rxjs/operators'; +import { DynamicFormControlComponent, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; +import { isEqual, isObject } from 'lodash'; +import { DynamicRelationGroupModel, PLACEHOLDER_PARENT_METADATA } from './dynamic-relation-group.model'; +import { FormBuilderService } from '../../../form-builder.service'; +import { FormService } from '../../../../form.service'; +import { FormComponent } from '../../../../form.component'; +import { Chips } from '../../../../../chips/models/chips.model'; +import { hasValue, isEmpty, isNotEmpty, isNotNull } from '../../../../../empty.util'; +import { shrinkInOut } from '../../../../../animations/shrink'; +import { GLOBAL_CONFIG } from '../../../../../../../config'; +import { hasOnlyEmptyProperties } from '../../../../../object.util'; +import { IntegrationSearchOptions } from '../../../../../../core/integration/models/integration-options.model'; +import { AuthorityService } from '../../../../../../core/integration/authority.service'; +import { FormFieldMetadataValueObject } from '../../../models/form-field-metadata-value.model'; +var DsDynamicRelationGroupComponent = /** @class */ (function (_super) { + tslib_1.__extends(DsDynamicRelationGroupComponent, _super); + function DsDynamicRelationGroupComponent(EnvConfig, authorityService, formBuilderService, formService, cdr, layoutService, validationService) { + var _this = _super.call(this, layoutService, validationService) || this; + _this.EnvConfig = EnvConfig; + _this.authorityService = authorityService; + _this.formBuilderService = formBuilderService; + _this.formService = formService; + _this.cdr = cdr; + _this.layoutService = layoutService; + _this.validationService = validationService; + _this.blur = new EventEmitter(); + _this.change = new EventEmitter(); + _this.focus = new EventEmitter(); + _this.formCollapsed = observableOf(false); + _this.editMode = false; + _this.subs = []; + return _this; + } + DsDynamicRelationGroupComponent.prototype.ngOnInit = function () { + var _this = this; + var config = { rows: this.model.formConfiguration }; + if (!this.model.isEmpty()) { + this.formCollapsed = observableOf(true); + } + this.model.valueUpdates.subscribe(function (value) { + if ((isNotEmpty(value) && !(value.length === 1 && hasOnlyEmptyProperties(value[0])))) { + _this.collapseForm(); + } + else { + _this.expandForm(); + } + }); + this.formId = this.formService.getUniqueId(this.model.id); + this.formModel = this.formBuilderService.modelFromConfiguration(config, this.model.scopeUUID, {}, this.model.submissionScope, this.model.readOnly); + this.initChipsFromModelValue(); + }; + DsDynamicRelationGroupComponent.prototype.isMandatoryFieldEmpty = function () { + var _this = this; + var res = true; + this.formModel.forEach(function (row) { + var modelRow = row; + modelRow.group.forEach(function (model) { + if (model.name === _this.model.mandatoryField) { + res = model.value == null; + return; + } + }); + }); + return res; + }; + DsDynamicRelationGroupComponent.prototype.onBlur = function (event) { + this.blur.emit(); + }; + DsDynamicRelationGroupComponent.prototype.onChipSelected = function (event) { + var _this = this; + this.expandForm(); + this.selectedChipItem = this.chips.getChipByIndex(event); + this.formModel.forEach(function (row) { + var modelRow = row; + modelRow.group.forEach(function (model) { + var value = (_this.selectedChipItem.item[model.name] === PLACEHOLDER_PARENT_METADATA + || _this.selectedChipItem.item[model.name].value === PLACEHOLDER_PARENT_METADATA) + ? null + : _this.selectedChipItem.item[model.name]; + if (isNotNull(value)) { + model.valueUpdates.next(_this.formBuilderService.isInputModel(model) ? value.value : value); + } + }); + }); + this.editMode = true; + }; + DsDynamicRelationGroupComponent.prototype.onFocus = function (event) { + this.focus.emit(event); + }; + DsDynamicRelationGroupComponent.prototype.collapseForm = function () { + this.formCollapsed = observableOf(true); + this.clear(); + }; + DsDynamicRelationGroupComponent.prototype.expandForm = function () { + this.formCollapsed = observableOf(false); + }; + DsDynamicRelationGroupComponent.prototype.clear = function () { + if (this.editMode) { + this.selectedChipItem.editMode = false; + this.selectedChipItem = null; + this.editMode = false; + } + this.resetForm(); + if (!this.model.isEmpty()) { + this.formCollapsed = observableOf(true); + } + }; + DsDynamicRelationGroupComponent.prototype.save = function () { + if (this.editMode) { + this.modifyChip(); + } + else { + this.addToChips(); + } + }; + DsDynamicRelationGroupComponent.prototype.delete = function () { + this.chips.remove(this.selectedChipItem); + this.clear(); + }; + DsDynamicRelationGroupComponent.prototype.addToChips = function () { + if (!this.formRef.formGroup.valid) { + this.formService.validateAllFormFields(this.formRef.formGroup); + return; + } + // Item to add + if (!this.isMandatoryFieldEmpty()) { + var item = this.buildChipItem(); + this.chips.add(item); + this.resetForm(); + } + }; + DsDynamicRelationGroupComponent.prototype.modifyChip = function () { + if (!this.formRef.formGroup.valid) { + this.formService.validateAllFormFields(this.formRef.formGroup); + return; + } + if (!this.isMandatoryFieldEmpty()) { + var item = this.buildChipItem(); + this.chips.update(this.selectedChipItem.id, item); + this.resetForm(); + this.cdr.detectChanges(); + } + }; + DsDynamicRelationGroupComponent.prototype.buildChipItem = function () { + var item = Object.create({}); + this.formModel.forEach(function (row) { + var modelRow = row; + modelRow.group.forEach(function (control) { + item[control.name] = control.value || PLACEHOLDER_PARENT_METADATA; + }); + }); + return item; + }; + DsDynamicRelationGroupComponent.prototype.initChipsFromModelValue = function () { + var _this = this; + var initChipsValue$; + if (this.model.isEmpty()) { + this.initChips([]); + } + else { + initChipsValue$ = observableOf(this.model.value); + // If authority + this.subs.push(initChipsValue$.pipe(flatMap(function (valueModel) { + var returnList = []; + valueModel.forEach(function (valueObj) { + var returnObj = Object.keys(valueObj).map(function (fieldName) { + var return$; + if (isObject(valueObj[fieldName]) && valueObj[fieldName].hasAuthority() && isNotEmpty(valueObj[fieldName].authority)) { + var fieldId = fieldName.replace(/\./g, '_'); + var model = _this.formBuilderService.findById(fieldId, _this.formModel); + var searchOptions = new IntegrationSearchOptions(model.authorityOptions.scope, model.authorityOptions.name, model.authorityOptions.metadata, valueObj[fieldName].authority, model.maxOptions, 1); + return$ = _this.authorityService.getEntryByValue(searchOptions).pipe(map(function (result) { return Object.assign(new FormFieldMetadataValueObject(), valueObj[fieldName], { + otherInformation: result.payload[0].otherInformation + }); })); + } + else { + return$ = observableOf(valueObj[fieldName]); + } + return return$.pipe(map(function (entry) { + var _a; + return (_a = {}, _a[fieldName] = entry, _a); + })); + }); + returnList.push(combineLatest(returnObj)); + }); + return returnList; + }), mergeMap(function (valueListObj, index) { + return valueListObj.pipe(map(function (valueObj) { return ({ + index: index, value: valueObj.reduce(function (acc, value) { return Object.assign({}, acc, value); }) + }); })); + }), scan(function (acc, valueObj) { + if (acc.length === 0) { + acc.push(valueObj.value); + } + else { + acc.splice(valueObj.index, 0, valueObj.value); + } + return acc; + }, []), filter(function (modelValues) { return _this.model.value.length === modelValues.length; })).subscribe(function (modelValue) { + _this.model.valueUpdates.next(modelValue); + _this.initChips(modelValue); + _this.cdr.markForCheck(); + })); + } + }; + DsDynamicRelationGroupComponent.prototype.initChips = function (initChipsValue) { + var _this = this; + this.chips = new Chips(initChipsValue, 'value', this.model.mandatoryField, this.EnvConfig.submission.icons.metadata); + this.subs.push(this.chips.chipsItems + .subscribe(function () { + var items = _this.chips.getChipsItems(); + // Does not emit change if model value is equal to the current value + if (!isEqual(items, _this.model.value)) { + if (!(isEmpty(items) && _this.model.isEmpty())) { + _this.model.valueUpdates.next(items); + _this.change.emit(); + } + } + })); + }; + DsDynamicRelationGroupComponent.prototype.resetForm = function () { + if (this.formRef) { + this.formService.resetForm(this.formRef.formGroup, this.formModel, this.formId); + } + }; + DsDynamicRelationGroupComponent.prototype.ngOnDestroy = function () { + this.subs + .filter(function (sub) { return hasValue(sub); }) + .forEach(function (sub) { return sub.unsubscribe(); }); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], DsDynamicRelationGroupComponent.prototype, "formId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], DsDynamicRelationGroupComponent.prototype, "group", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", DynamicRelationGroupModel) + ], DsDynamicRelationGroupComponent.prototype, "model", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicRelationGroupComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicRelationGroupComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicRelationGroupComponent.prototype, "focus", void 0); + tslib_1.__decorate([ + ViewChild('formRef'), + tslib_1.__metadata("design:type", FormComponent) + ], DsDynamicRelationGroupComponent.prototype, "formRef", void 0); + DsDynamicRelationGroupComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-dynamic-relation-group', + styleUrls: ['./dynamic-relation-group.component.scss'], + templateUrl: './dynamic-relation-group.component.html', + animations: [shrinkInOut] + }), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, AuthorityService, + FormBuilderService, + FormService, + ChangeDetectorRef, + DynamicFormLayoutService, + DynamicFormValidationService]) + ], DsDynamicRelationGroupComponent); + return DsDynamicRelationGroupComponent; +}(DynamicFormControlComponent)); +export { DsDynamicRelationGroupComponent }; +//# sourceMappingURL=dynamic-relation-group.components.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components.js.map new file mode 100644 index 0000000000..6cc36a1d47 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-relation-group.components.js","sourceRoot":"","sources":["dynamic-relation-group.components.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,MAAM,EACN,KAAK,EAGL,MAAM,EACN,SAAS,EACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAc,EAAE,IAAI,YAAY,EAAgB,MAAM,MAAM,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,2BAA2B,EAG3B,wBAAwB,EACxB,4BAA4B,EAE7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE3C,OAAO,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AACxG,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,KAAK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,MAAM,CAAC,UAAC,GAAG,IAAK,OAAA,QAAQ,CAAC,GAAG,CAAC,EAAb,CAAa,CAAC;aAC9B,OAAO,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,WAAW,EAAE,EAAjB,CAAiB,CAAC,CAAC;IACzC,CAAC;IA7QQ;QAAR,KAAK,EAAE;;mEAAgB;IACf;QAAR,KAAK,EAAE;0CAAQ,SAAS;kEAAC;IACjB;QAAR,KAAK,EAAE;0CAAQ,yBAAyB;kEAAC;IAEhC;QAAT,MAAM,EAAE;0CAAO,YAAY;iEAAgC;IAClD;QAAT,MAAM,EAAE;0CAAS,YAAY;mEAAgC;IACpD;QAAT,MAAM,EAAE;0CAAQ,YAAY;kEAAgC;IAUvC;QAArB,SAAS,CAAC,SAAS,CAAC;0CAAkB,aAAa;oEAAC;IAlB1C,+BAA+B;QAN3C,SAAS,CAAC;YACT,QAAQ,EAAE,2BAA2B;YACrC,SAAS,EAAE,CAAC,yCAAyC,CAAC;YACtD,WAAW,EAAE,yCAAyC;YACtD,UAAU,EAAE,CAAC,WAAW,CAAC;SAC1B,CAAC;QAqBa,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACI,gBAAgB;YACd,kBAAkB;YACzB,WAAW;YACnB,iBAAiB;YACL,wBAAwB;YACpB,4BAA4B;OA1B1D,+BAA+B,CAiR3C;IAAD,sCAAC;CAAA,AAjRD,CAAqD,2BAA2B,GAiR/E;SAjRY,+BAA+B"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.js new file mode 100644 index 0000000000..6a25e2c6aa --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.js @@ -0,0 +1,84 @@ +import * as tslib_1 from "tslib"; +import { serializable } from '@ng-dynamic-forms/core'; +import { DsDynamicInputModel } from '../ds-dynamic-input.model'; +import { isEmpty, isNull } from '../../../../../empty.util'; +export var DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP = 'RELATION'; +export var PLACEHOLDER_PARENT_METADATA = '#PLACEHOLDER_PARENT_METADATA_VALUE#'; +/** + * Dynamic Group Model class + */ +var DynamicRelationGroupModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicRelationGroupModel, _super); + function DynamicRelationGroupModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.type = DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP; + _this.formConfiguration = config.formConfiguration; + _this.mandatoryField = config.mandatoryField; + _this.relationFields = config.relationFields; + _this.scopeUUID = config.scopeUUID; + _this.submissionScope = config.submissionScope; + var value = config.value || []; + _this.valueUpdates.next(value); + return _this; + } + Object.defineProperty(DynamicRelationGroupModel.prototype, "value", { + get: function () { + return this._value; + }, + set: function (value) { + this._value = (isEmpty(value)) ? null : value; + }, + enumerable: true, + configurable: true + }); + DynamicRelationGroupModel.prototype.isEmpty = function () { + var value = this.getGroupValue(); + return (value.length === 1 && isNull(value[0][this.mandatoryField])); + }; + DynamicRelationGroupModel.prototype.getGroupValue = function () { + if (isEmpty(this._value)) { + // If items is empty, last element has been removed + // so emit an empty value that allows to dispatch + // a remove JSON PATCH operation + var emptyItem_1 = Object.create({}); + emptyItem_1[this.mandatoryField] = null; + this.relationFields + .forEach(function (field) { + emptyItem_1[field] = null; + }); + return [emptyItem_1]; + } + return this._value; + }; + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Array) + ], DynamicRelationGroupModel.prototype, "formConfiguration", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicRelationGroupModel.prototype, "mandatoryField", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Array) + ], DynamicRelationGroupModel.prototype, "relationFields", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicRelationGroupModel.prototype, "scopeUUID", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicRelationGroupModel.prototype, "submissionScope", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Array) + ], DynamicRelationGroupModel.prototype, "_value", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicRelationGroupModel.prototype, "type", void 0); + return DynamicRelationGroupModel; +}(DsDynamicInputModel)); +export { DynamicRelationGroupModel }; +//# sourceMappingURL=dynamic-relation-group.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.js.map new file mode 100644 index 0000000000..5055917fbf --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-relation-group.model.js","sourceRoot":"","sources":["dynamic-relation-group.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAA4B,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,EAAE,mBAAmB,EAA6B,MAAM,2BAA2B,CAAC;AAC3F,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,CAAC,IAAM,wCAAwC,GAAG,UAAU,CAAC;AACnE,MAAM,CAAC,IAAM,2BAA2B,GAAG,qCAAqC,CAAC;AAajF;;GAEG;AACH;IAA+C,qDAAmB;IAShE,mCAAY,MAAuC,EAAE,MAAiC;QAAtF,YACE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAStB;QAZwB,UAAI,GAAW,wCAAwC,CAAC;QAK/E,KAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAClD,KAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC5C,KAAI,CAAC,cAAc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YAAY,EAAE;;qEAAwB;IACvB;QAAf,YAAY,EAAE;;qEAA0B;IACzB;QAAf,YAAY,EAAE;;gEAAmB;IAClB;QAAf,YAAY,EAAE;;sEAAyB;IACxB;QAAf,YAAY,EAAE;;6DAAe;IACd;QAAf,YAAY,EAAE;;2DAAkE;IA0CnF,gCAAC;CAAA,AAjDD,CAA+C,mBAAmB,GAiDjE;SAjDY,yBAAyB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.js new file mode 100644 index 0000000000..dcc1690dca --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.js @@ -0,0 +1,143 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { of as observableOf } from 'rxjs'; +import { catchError, first, tap } from 'rxjs/operators'; +import { DynamicFormControlComponent, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; +import { DynamicScrollableDropdownModel } from './dynamic-scrollable-dropdown.model'; +import { PageInfo } from '../../../../../../core/shared/page-info.model'; +import { isNull, isUndefined } from '../../../../../empty.util'; +import { AuthorityService } from '../../../../../../core/integration/authority.service'; +import { IntegrationSearchOptions } from '../../../../../../core/integration/models/integration-options.model'; +import { IntegrationData } from '../../../../../../core/integration/integration-data'; +var DsDynamicScrollableDropdownComponent = /** @class */ (function (_super) { + tslib_1.__extends(DsDynamicScrollableDropdownComponent, _super); + function DsDynamicScrollableDropdownComponent(authorityService, cdr, layoutService, validationService) { + var _this = _super.call(this, layoutService, validationService) || this; + _this.authorityService = authorityService; + _this.cdr = cdr; + _this.layoutService = layoutService; + _this.validationService = validationService; + _this.bindId = true; + _this.blur = new EventEmitter(); + _this.change = new EventEmitter(); + _this.focus = new EventEmitter(); + _this.loading = false; + _this.inputFormatter = function (x) { return x.display || x.value; }; + return _this; + } + DsDynamicScrollableDropdownComponent.prototype.ngOnInit = function () { + var _this = this; + this.searchOptions = new IntegrationSearchOptions(this.model.authorityOptions.scope, this.model.authorityOptions.name, this.model.authorityOptions.metadata, '', this.model.maxOptions, 1); + this.authorityService.getEntriesByName(this.searchOptions).pipe(catchError(function () { + var emptyResult = new IntegrationData(new PageInfo(), []); + return observableOf(emptyResult); + }), first()) + .subscribe(function (object) { + _this.optionsList = object.payload; + if (_this.model.value) { + _this.setCurrentValue(_this.model.value); + } + _this.pageInfo = object.pageInfo; + _this.cdr.detectChanges(); + }); + }; + DsDynamicScrollableDropdownComponent.prototype.openDropdown = function (sdRef) { + if (!this.model.readOnly) { + sdRef.open(); + } + }; + DsDynamicScrollableDropdownComponent.prototype.onScroll = function () { + var _this = this; + if (!this.loading && this.pageInfo.currentPage <= this.pageInfo.totalPages) { + this.loading = true; + this.searchOptions.currentPage++; + this.authorityService.getEntriesByName(this.searchOptions).pipe(catchError(function () { + var emptyResult = new IntegrationData(new PageInfo(), []); + return observableOf(emptyResult); + }), tap(function () { return _this.loading = false; })) + .subscribe(function (object) { + _this.optionsList = _this.optionsList.concat(object.payload); + _this.pageInfo = object.pageInfo; + _this.cdr.detectChanges(); + }); + } + }; + DsDynamicScrollableDropdownComponent.prototype.onBlur = function (event) { + this.blur.emit(event); + }; + DsDynamicScrollableDropdownComponent.prototype.onFocus = function (event) { + this.focus.emit(event); + }; + DsDynamicScrollableDropdownComponent.prototype.onSelect = function (event) { + this.group.markAsDirty(); + this.model.valueUpdates.next(event); + this.change.emit(event); + this.setCurrentValue(event); + }; + DsDynamicScrollableDropdownComponent.prototype.onToggle = function (sdRef) { + if (sdRef.isOpen()) { + this.focus.emit(event); + } + else { + this.blur.emit(event); + } + }; + DsDynamicScrollableDropdownComponent.prototype.setCurrentValue = function (value) { + var result; + if (isUndefined(value) || isNull(value)) { + result = ''; + } + else if (typeof value === 'string') { + result = value; + } + else { + for (var _i = 0, _a = this.optionsList; _i < _a.length; _i++) { + var item = _a[_i]; + if (value.value === item.value) { + result = this.inputFormatter(item); + break; + } + } + } + this.currentValue = observableOf(result); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicScrollableDropdownComponent.prototype, "bindId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], DsDynamicScrollableDropdownComponent.prototype, "group", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", DynamicScrollableDropdownModel) + ], DsDynamicScrollableDropdownComponent.prototype, "model", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicScrollableDropdownComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicScrollableDropdownComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicScrollableDropdownComponent.prototype, "focus", void 0); + DsDynamicScrollableDropdownComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-dynamic-scrollable-dropdown', + styleUrls: ['./dynamic-scrollable-dropdown.component.scss'], + templateUrl: './dynamic-scrollable-dropdown.component.html' + }), + tslib_1.__metadata("design:paramtypes", [AuthorityService, + ChangeDetectorRef, + DynamicFormLayoutService, + DynamicFormValidationService]) + ], DsDynamicScrollableDropdownComponent); + return DsDynamicScrollableDropdownComponent; +}(DynamicFormControlComponent)); +export { DsDynamicScrollableDropdownComponent }; +//# sourceMappingURL=dynamic-scrollable-dropdown.component.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.js.map new file mode 100644 index 0000000000..6ea73aafda --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-scrollable-dropdown.component.js","sourceRoot":"","sources":["dynamic-scrollable-dropdown.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sDAAsD,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,qEAAqE,CAAC;AAC/G,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAOtF;IAA0D,gEAA2B;IAgBnF,8CAAoB,gBAAkC,EAClC,GAAsB,EACpB,aAAuC,EACvC,iBAA+C;QAHrE,YAKE,kBAAM,aAAa,EAAE,iBAAiB,CAAC,SACxC;QANmB,sBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,SAAG,GAAH,GAAG,CAAmB;QACpB,mBAAa,GAAb,aAAa,CAA0B;QACvC,uBAAiB,GAAjB,iBAAiB,CAA8B;QAlB5D,YAAM,GAAG,IAAI,CAAC;QAIb,UAAI,GAAsB,IAAI,YAAY,EAAO,C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AY;uEAAgC;IAPlD,oCAAoC;QALhD,SAAS,CAAC;YACT,QAAQ,EAAE,gCAAgC;YAC1C,SAAS,EAAE,CAAC,8CAA8C,CAAC;YAC3D,WAAW,EAAE,8CAA8C;SAC5D,CAAC;iDAiBsC,gBAAgB;YAC7B,iBAAiB;YACL,wBAAwB;YACpB,4BAA4B;OAnB1D,oCAAoC,CAuHhD;IAAD,2CAAC;CAAA,AAvHD,CAA0D,2BAA2B,GAuHpF;SAvHY,oCAAoC"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model.js new file mode 100644 index 0000000000..410f1c56b4 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model.js @@ -0,0 +1,26 @@ +import * as tslib_1 from "tslib"; +import { AUTOCOMPLETE_OFF, serializable } from '@ng-dynamic-forms/core'; +import { DsDynamicInputModel } from '../ds-dynamic-input.model'; +export var DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN = 'SCROLLABLE_DROPDOWN'; +var DynamicScrollableDropdownModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicScrollableDropdownModel, _super); + function DynamicScrollableDropdownModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.type = DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN; + _this.autoComplete = AUTOCOMPLETE_OFF; + _this.authorityOptions = config.authorityOptions; + _this.maxOptions = config.maxOptions || 10; + return _this; + } + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Number) + ], DynamicScrollableDropdownModel.prototype, "maxOptions", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicScrollableDropdownModel.prototype, "type", void 0); + return DynamicScrollableDropdownModel; +}(DsDynamicInputModel)); +export { DynamicScrollableDropdownModel }; +//# sourceMappingURL=dynamic-scrollable-dropdown.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model.js.map new file mode 100644 index 0000000000..1cefa8999e --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-scrollable-dropdown.model.js","sourceRoot":"","sources":["dynamic-scrollable-dropdown.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAA4B,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAA6B,MAAM,2BAA2B,CAAC;AAG3F,MAAM,CAAC,IAAM,6CAA6C,GAAG,qBAAqB,CAAC;AAQnF;IAAoD,0DAAmB;IAKrE,wCAAY,MAA4C,EAAE,MAAiC;QAA3F,YAEE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAKtB;QATwB,UAAI,GAAW,6CAA6C,CAAC;QAMpF,KAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC;QACrC,KAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QAChD,KAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;;IAC5C,CAAC;IAVe;QAAf,YAAY,EAAE;;sEAAoB;IACnB;QAAf,YAAY,EAAE;;gEAAuE;IAWxF,qCAAC;CAAA,AAdD,CAAoD,mBAAmB,GActE;SAdY,8BAA8B"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.js new file mode 100644 index 0000000000..334a6a8860 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.js @@ -0,0 +1,188 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, EventEmitter, Inject, Input, Output, ViewChild } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { DynamicFormControlComponent, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; +import { of as observableOf, Observable } from 'rxjs'; +import { catchError, debounceTime, distinctUntilChanged, tap, switchMap, map, merge } from 'rxjs/operators'; +import { NgbTypeahead } from '@ng-bootstrap/ng-bootstrap'; +import { isEqual } from 'lodash'; +import { AuthorityService } from '../../../../../../core/integration/authority.service'; +import { DynamicTagModel } from './dynamic-tag.model'; +import { IntegrationSearchOptions } from '../../../../../../core/integration/models/integration-options.model'; +import { Chips } from '../../../../../chips/models/chips.model'; +import { hasValue, isNotEmpty } from '../../../../../empty.util'; +import { GLOBAL_CONFIG } from '../../../../../../../config'; +var DsDynamicTagComponent = /** @class */ (function (_super) { + tslib_1.__extends(DsDynamicTagComponent, _super); + function DsDynamicTagComponent(EnvConfig, authorityService, cdr, layoutService, validationService) { + var _this = _super.call(this, layoutService, validationService) || this; + _this.EnvConfig = EnvConfig; + _this.authorityService = authorityService; + _this.cdr = cdr; + _this.layoutService = layoutService; + _this.validationService = validationService; + _this.bindId = true; + _this.blur = new EventEmitter(); + _this.change = new EventEmitter(); + _this.focus = new EventEmitter(); + _this.searching = false; + _this.searchFailed = false; + _this.hideSearchingWhenUnsubscribed = new Observable(function () { return function () { return _this.changeSearchingStatus(false); }; }); + _this.formatter = function (x) { return x.display; }; + _this.search = function (text$) { + return text$.pipe(debounceTime(300), distinctUntilChanged(), tap(function () { return _this.changeSearchingStatus(true); }), switchMap(function (term) { + if (term === '' || term.length < _this.model.minChars) { + return observableOf({ list: [] }); + } + else { + _this.searchOptions.query = term; + return _this.authorityService.getEntriesByName(_this.searchOptions).pipe(map(function (authorities) { + // @TODO Pagination for authority is not working, to refactor when it will be fixed + return { + list: authorities.payload, + pageInfo: authorities.pageInfo + }; + }), tap(function () { return _this.searchFailed = false; }), catchError(function () { + _this.searchFailed = true; + return observableOf({ list: [] }); + })); + } + }), map(function (results) { return results.list; }), tap(function () { return _this.changeSearchingStatus(false); }), merge(_this.hideSearchingWhenUnsubscribed)); + }; + return _this; + } + DsDynamicTagComponent.prototype.ngOnInit = function () { + var _this = this; + this.hasAuthority = this.model.authorityOptions && hasValue(this.model.authorityOptions.name); + if (this.hasAuthority) { + this.searchOptions = new IntegrationSearchOptions(this.model.authorityOptions.scope, this.model.authorityOptions.name, this.model.authorityOptions.metadata); + } + this.chips = new Chips(this.model.value, 'display', null, this.EnvConfig.submission.icons.metadata); + this.chips.chipsItems + .subscribe(function (subItems) { + var items = _this.chips.getChipsItems(); + // Does not emit change if model value is equal to the current value + if (!isEqual(items, _this.model.value)) { + _this.model.valueUpdates.next(items); + _this.change.emit(event); + } + }); + }; + DsDynamicTagComponent.prototype.changeSearchingStatus = function (status) { + this.searching = status; + this.cdr.detectChanges(); + }; + DsDynamicTagComponent.prototype.onInput = function (event) { + if (event.data) { + this.group.markAsDirty(); + } + this.cdr.detectChanges(); + }; + DsDynamicTagComponent.prototype.onBlur = function (event) { + if (isNotEmpty(this.currentValue) && !this.instance.isPopupOpen()) { + this.addTagsToChips(); + } + this.blur.emit(event); + }; + DsDynamicTagComponent.prototype.onFocus = function (event) { + this.focus.emit(event); + }; + DsDynamicTagComponent.prototype.onSelectItem = function (event) { + var _this = this; + this.chips.add(event.item); + // this.group.controls[this.model.id].setValue(this.model.value); + this.updateModel(event); + setTimeout(function () { + // Reset the input text after x ms, mandatory or the formatter overwrite it + _this.currentValue = null; + _this.cdr.detectChanges(); + }, 50); + }; + DsDynamicTagComponent.prototype.updateModel = function (event) { + this.model.valueUpdates.next(this.chips.getChipsItems()); + this.change.emit(event); + }; + DsDynamicTagComponent.prototype.onKeyUp = function (event) { + if (event.keyCode === 13 || event.keyCode === 188) { + event.preventDefault(); + // Key: Enter or ',' or ';' + this.addTagsToChips(); + event.stopPropagation(); + } + }; + DsDynamicTagComponent.prototype.preventEventsPropagation = function (event) { + event.stopPropagation(); + if (event.keyCode === 13) { + event.preventDefault(); + } + }; + DsDynamicTagComponent.prototype.addTagsToChips = function () { + var _this = this; + if (hasValue(this.currentValue) && (!this.hasAuthority || !this.model.authorityOptions.closed)) { + var res = []; + res = this.currentValue.split(','); + var res1_1 = []; + res.forEach(function (item) { + item.split(';').forEach(function (i) { + res1_1.push(i); + }); + }); + res1_1.forEach(function (c) { + c = c.trim(); + if (c.length > 0) { + _this.chips.add(c); + } + }); + // this.currentValue = ''; + setTimeout(function () { + // Reset the input text after x ms, mandatory or the formatter overwrite it + _this.currentValue = null; + _this.cdr.detectChanges(); + }, 50); + this.updateModel(event); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicTagComponent.prototype, "bindId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], DsDynamicTagComponent.prototype, "group", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", DynamicTagModel) + ], DsDynamicTagComponent.prototype, "model", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicTagComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicTagComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicTagComponent.prototype, "focus", void 0); + tslib_1.__decorate([ + ViewChild('instance'), + tslib_1.__metadata("design:type", NgbTypeahead) + ], DsDynamicTagComponent.prototype, "instance", void 0); + DsDynamicTagComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-dynamic-tag', + styleUrls: ['./dynamic-tag.component.scss'], + templateUrl: './dynamic-tag.component.html' + }), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, AuthorityService, + ChangeDetectorRef, + DynamicFormLayoutService, + DynamicFormValidationService]) + ], DsDynamicTagComponent); + return DsDynamicTagComponent; +}(DynamicFormControlComponent)); +export { DsDynamicTagComponent }; +//# sourceMappingURL=dynamic-tag.component.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.js.map new file mode 100644 index 0000000000..25270e634a --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-tag.component.js","sourceRoot":"","sources":["dynamic-tag.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,EAAE,IAAI,YAAY,EAAG,UAAU,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5G,OAAO,EAAE,YAAY,EAA+B,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sDAAsD,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qEAAqE,CAAC;AAC/G,OAAO,EAAE,KAAK,EAAE,MA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ALjC,SAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,CAAC,8BAA8B,CAAC;YAC3C,WAAW,EAAE,8BAA8B;SAC5C,CAAC;QAoDa,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACI,gBAAgB;YAC7B,iBAAiB;YACL,wBAAwB;YACpB,4BAA4B;OAvD1D,qBAAqB,CA2KjC;IAAD,4BAAC;CAAA,AA3KD,CAA2C,2BAA2B,GA2KrE;SA3KY,qBAAqB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.model.js new file mode 100644 index 0000000000..3a22414e4f --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.model.js @@ -0,0 +1,31 @@ +import * as tslib_1 from "tslib"; +import { AUTOCOMPLETE_OFF, serializable } from '@ng-dynamic-forms/core'; +import { DsDynamicInputModel } from '../ds-dynamic-input.model'; +export var DYNAMIC_FORM_CONTROL_TYPE_TAG = 'TAG'; +var DynamicTagModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicTagModel, _super); + function DynamicTagModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.type = DYNAMIC_FORM_CONTROL_TYPE_TAG; + _this.autoComplete = AUTOCOMPLETE_OFF; + _this.minChars = config.minChars || 3; + var value = config.value || []; + _this.valueUpdates.next(value); + return _this; + } + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Number) + ], DynamicTagModel.prototype, "minChars", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Array) + ], DynamicTagModel.prototype, "value", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicTagModel.prototype, "type", void 0); + return DynamicTagModel; +}(DsDynamicInputModel)); +export { DynamicTagModel }; +//# sourceMappingURL=dynamic-tag.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.model.js.map new file mode 100644 index 0000000000..fe7928678d --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-tag.model.js","sourceRoot":"","sources":["dynamic-tag.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAA4B,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAA6B,MAAM,2BAA2B,CAAC;AAG3F,MAAM,CAAC,IAAM,6BAA6B,GAAG,KAAK,CAAC;AAOnD;IAAqC,2CAAmB;IAMtD,yBAAY,MAA6B,EAAE,MAAiC;QAA5E,YAEE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAMtB;QAVwB,UAAI,GAAW,6BAA6B,CAAC;QAMpE,KAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC;QACrC,KAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC;QACrC,IAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;QACjC,KAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;;IAC/B,CAAC;IAZe;QAAf,YAAY,EAAE;;qDAAkB;IACjB;QAAf,YAAY,EAAE;;kDAAc;IACb;QAAf,YAAY,EAAE;;iDAAuD;IAYxE,sBAAC;CAAA,AAhBD,CAAqC,mBAAmB,GAgBvD;SAhBY,eAAe"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.js new file mode 100644 index 0000000000..8d4df0ab2b --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.js @@ -0,0 +1,138 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { DynamicFormControlComponent, DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; +import { catchError, debounceTime, distinctUntilChanged, filter, map, merge, switchMap, tap } from 'rxjs/operators'; +import { Observable, of as observableOf, Subject } from 'rxjs'; +import { AuthorityService } from '../../../../../../core/integration/authority.service'; +import { DynamicTypeaheadModel } from './dynamic-typeahead.model'; +import { IntegrationSearchOptions } from '../../../../../../core/integration/models/integration-options.model'; +import { isEmpty, isNotEmpty } from '../../../../../empty.util'; +import { FormFieldMetadataValueObject } from '../../../models/form-field-metadata-value.model'; +var DsDynamicTypeaheadComponent = /** @class */ (function (_super) { + tslib_1.__extends(DsDynamicTypeaheadComponent, _super); + function DsDynamicTypeaheadComponent(authorityService, cdr, layoutService, validationService) { + var _this = _super.call(this, layoutService, validationService) || this; + _this.authorityService = authorityService; + _this.cdr = cdr; + _this.layoutService = layoutService; + _this.validationService = validationService; + _this.bindId = true; + _this.blur = new EventEmitter(); + _this.change = new EventEmitter(); + _this.focus = new EventEmitter(); + _this.searching = false; + _this.searchFailed = false; + _this.hideSearchingWhenUnsubscribed$ = new Observable(function () { return function () { return _this.changeSearchingStatus(false); }; }); + _this.click$ = new Subject(); + _this.formatter = function (x) { + return (typeof x === 'object') ? x.display : x; + }; + _this.search = function (text$) { + return text$.pipe(merge(_this.click$), debounceTime(300), distinctUntilChanged(), tap(function () { return _this.changeSearchingStatus(true); }), switchMap(function (term) { + if (term === '' || term.length < _this.model.minChars) { + return observableOf({ list: [] }); + } + else { + _this.searchOptions.query = term; + return _this.authorityService.getEntriesByName(_this.searchOptions).pipe(map(function (authorities) { + // @TODO Pagination for authority is not working, to refactor when it will be fixed + return { + list: authorities.payload, + pageInfo: authorities.pageInfo + }; + }), tap(function () { return _this.searchFailed = false; }), catchError(function () { + _this.searchFailed = true; + return observableOf({ list: [] }); + })); + } + }), map(function (results) { return results.list; }), tap(function () { return _this.changeSearchingStatus(false); }), merge(_this.hideSearchingWhenUnsubscribed$)); + }; + return _this; + } + DsDynamicTypeaheadComponent.prototype.ngOnInit = function () { + var _this = this; + this.currentValue = this.model.value; + this.searchOptions = new IntegrationSearchOptions(this.model.authorityOptions.scope, this.model.authorityOptions.name, this.model.authorityOptions.metadata); + this.group.get(this.model.id).valueChanges.pipe(filter(function (value) { return _this.currentValue !== value; })) + .subscribe(function (value) { + _this.currentValue = value; + }); + }; + DsDynamicTypeaheadComponent.prototype.changeSearchingStatus = function (status) { + this.searching = status; + this.cdr.detectChanges(); + }; + DsDynamicTypeaheadComponent.prototype.onInput = function (event) { + if (!this.model.authorityOptions.closed && isNotEmpty(event.target.value)) { + this.inputValue = new FormFieldMetadataValueObject(event.target.value); + this.model.valueUpdates.next(this.inputValue); + } + }; + DsDynamicTypeaheadComponent.prototype.onBlur = function (event) { + if (!this.model.authorityOptions.closed && isNotEmpty(this.inputValue)) { + this.change.emit(this.inputValue); + this.inputValue = null; + } + this.blur.emit(event); + }; + DsDynamicTypeaheadComponent.prototype.onChange = function (event) { + event.stopPropagation(); + if (isEmpty(this.currentValue)) { + this.model.valueUpdates.next(null); + this.change.emit(null); + } + }; + DsDynamicTypeaheadComponent.prototype.onFocus = function (event) { + this.focus.emit(event); + }; + DsDynamicTypeaheadComponent.prototype.onSelectItem = function (event) { + this.inputValue = null; + this.currentValue = event.item; + this.model.valueUpdates.next(event.item); + this.change.emit(event.item); + }; + DsDynamicTypeaheadComponent.prototype.whenClickOnConfidenceNotAccepted = function (confidence) { + if (!this.model.readOnly) { + this.click$.next(this.formatter(this.currentValue)); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DsDynamicTypeaheadComponent.prototype, "bindId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], DsDynamicTypeaheadComponent.prototype, "group", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", DynamicTypeaheadModel) + ], DsDynamicTypeaheadComponent.prototype, "model", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicTypeaheadComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicTypeaheadComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], DsDynamicTypeaheadComponent.prototype, "focus", void 0); + DsDynamicTypeaheadComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-dynamic-typeahead', + styleUrls: ['./dynamic-typeahead.component.scss'], + templateUrl: './dynamic-typeahead.component.html' + }), + tslib_1.__metadata("design:paramtypes", [AuthorityService, + ChangeDetectorRef, + DynamicFormLayoutService, + DynamicFormValidationService]) + ], DsDynamicTypeaheadComponent); + return DsDynamicTypeaheadComponent; +}(DynamicFormControlComponent)); +export { DsDynamicTypeaheadComponent }; +//# sourceMappingURL=dynamic-typeahead.component.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.js.map new file mode 100644 index 0000000000..5204b6ced2 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-typeahead.component.js","sourceRoot":"","sources":["dynamic-typeahead.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,E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AC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;SACrD;IACH,CAAC;IApHQ;QAAR,KAAK,EAAE;;+DAAe;IACd;QAAR,KAAK,EAAE;0CAAQ,SAAS;8DAAC;IACjB;QAAR,KAAK,EAAE;0CAAQ,qBAAqB;8DAAC;IAE5B;QAAT,MAAM,EAAE;0CAAO,YAAY;6DAAgC;IAClD;QAAT,MAAM,EAAE;0CAAS,YAAY;+DAAgC;IACpD;QAAT,MAAM,EAAE;0CAAQ,YAAY;8DAAgC;IAPlD,2BAA2B;QALvC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,SAAS,EAAE,CAAC,oCAAoC,CAAC;YACjD,WAAW,EAAE,oCAAoC;SAClD,CAAC;iDAsDsC,gBAAgB;YAC7B,iBAAiB;YACL,wBAAwB;YACpB,4BAA4B;OAxD1D,2BAA2B,CAsHvC;IAAD,kCAAC;CAAA,AAtHD,CAAiD,2BAA2B,GAsH3E;SAtHY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.model.js b/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.model.js new file mode 100644 index 0000000000..d30197cde3 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.model.js @@ -0,0 +1,25 @@ +import * as tslib_1 from "tslib"; +import { AUTOCOMPLETE_OFF, serializable } from '@ng-dynamic-forms/core'; +import { DsDynamicInputModel } from '../ds-dynamic-input.model'; +export var DYNAMIC_FORM_CONTROL_TYPE_TYPEAHEAD = 'TYPEAHEAD'; +var DynamicTypeaheadModel = /** @class */ (function (_super) { + tslib_1.__extends(DynamicTypeaheadModel, _super); + function DynamicTypeaheadModel(config, layout) { + var _this = _super.call(this, config, layout) || this; + _this.type = DYNAMIC_FORM_CONTROL_TYPE_TYPEAHEAD; + _this.autoComplete = AUTOCOMPLETE_OFF; + _this.minChars = config.minChars || 3; + return _this; + } + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", Number) + ], DynamicTypeaheadModel.prototype, "minChars", void 0); + tslib_1.__decorate([ + serializable(), + tslib_1.__metadata("design:type", String) + ], DynamicTypeaheadModel.prototype, "type", void 0); + return DynamicTypeaheadModel; +}(DsDynamicInputModel)); +export { DynamicTypeaheadModel }; +//# sourceMappingURL=dynamic-typeahead.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.model.js.map b/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.model.js.map new file mode 100644 index 0000000000..3fe4e6e562 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-typeahead.model.js","sourceRoot":"","sources":["dynamic-typeahead.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAA4B,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAA6B,MAAM,2BAA2B,CAAC;AAE3F,MAAM,CAAC,IAAM,mCAAmC,GAAG,WAAW,CAAC;AAO/D;IAA2C,iDAAmB;IAK5D,+BAAY,MAAqC,EAAE,MAAiC;QAApF,YAEE,kBAAM,MAAM,EAAE,MAAM,CAAC,SAItB;QARwB,UAAI,GAAW,mCAAmC,CAAC;QAM1E,KAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC;QACrC,KAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC;;IACvC,CAAC;IATe;QAAf,YAAY,EAAE;;2DAAkB;IACjB;QAAf,YAAY,EAAE;;uDAA6D;IAU9E,4BAAC;CAAA,AAbD,CAA2C,mBAAmB,GAa7D;SAbY,qBAAqB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/form-builder.service.js b/src/app/shared/form/builder/form-builder.service.js new file mode 100644 index 0000000000..e2b831b729 --- /dev/null +++ b/src/app/shared/form/builder/form-builder.service.js @@ -0,0 +1,256 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { DYNAMIC_FORM_CONTROL_TYPE_ARRAY, DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX_GROUP, DYNAMIC_FORM_CONTROL_TYPE_GROUP, DYNAMIC_FORM_CONTROL_TYPE_INPUT, DYNAMIC_FORM_CONTROL_TYPE_RADIO_GROUP, DynamicFormService, JSONUtils, } from '@ng-dynamic-forms/core'; +import { isObject, isString, mergeWith } from 'lodash'; +import { hasValue, isEmpty, isNotEmpty, isNotNull, isNotUndefined, isNull } from '../../empty.util'; +import { DYNAMIC_FORM_CONTROL_TYPE_TAG } from './ds-dynamic-form-ui/models/tag/dynamic-tag.model'; +import { RowParser } from './parsers/row-parser'; +import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; +import { FormFieldMetadataValueObject } from './models/form-field-metadata-value.model'; +import { isNgbDateStruct } from '../../date.util'; +var FormBuilderService = /** @class */ (function (_super) { + tslib_1.__extends(FormBuilderService, _super); + function FormBuilderService() { + return _super !== null && _super.apply(this, arguments) || this; + } + FormBuilderService.prototype.findById = function (id, groupModel, arrayIndex) { + var _this = this; + if (arrayIndex === void 0) { arrayIndex = null; } + var result = null; + var findByIdFn = function (findId, findGroupModel, findArrayIndex) { + for (var _i = 0, findGroupModel_1 = findGroupModel; _i < findGroupModel_1.length; _i++) { + var controlModel = findGroupModel_1[_i]; + if (controlModel.id === findId) { + if (_this.isArrayGroup(controlModel) && isNotNull(findArrayIndex)) { + result = controlModel.get(findArrayIndex); + } + else { + result = controlModel; + } + break; + } + if (_this.isGroup(controlModel)) { + findByIdFn(findId, controlModel.group, findArrayIndex); + } + if (_this.isArrayGroup(controlModel) + && (isNull(findArrayIndex) || controlModel.size > (findArrayIndex))) { + var index = (isNull(findArrayIndex)) ? 0 : findArrayIndex; + findByIdFn(findId, controlModel.get(index).group, index); + } + } + }; + findByIdFn(id, groupModel, arrayIndex); + return result; + }; + FormBuilderService.prototype.clearAllModelsValue = function (groupModel) { + var _this = this; + var iterateControlModels = function (findGroupModel) { + for (var _i = 0, findGroupModel_2 = findGroupModel; _i < findGroupModel_2.length; _i++) { + var controlModel = findGroupModel_2[_i]; + if (_this.isGroup(controlModel)) { + iterateControlModels(controlModel.group); + continue; + } + if (_this.isArrayGroup(controlModel)) { + iterateControlModels(controlModel.groupFactory()); + continue; + } + if (controlModel.hasOwnProperty('valueUpdates')) { + controlModel.valueUpdates.next(undefined); + } + } + }; + iterateControlModels(groupModel); + }; + FormBuilderService.prototype.getValueFromModel = function (groupModel) { + var _this = this; + var result = Object.create({}); + var customizer = function (objValue, srcValue) { + if (Array.isArray(objValue)) { + return objValue.concat(srcValue); + } + }; + var normalizeValue = function (controlModel, controlValue, controlModelIndex) { + var controlLanguage = controlModel.hasLanguages ? controlModel.language : null; + if (isString(controlValue)) { + return new FormFieldMetadataValueObject(controlValue, controlLanguage, null, null, controlModelIndex); + } + else if (isObject(controlValue)) { + var authority = controlValue.authority || controlValue.id || null; + var place = controlModelIndex || controlValue.place; + if (isNgbDateStruct(controlValue)) { + return new FormFieldMetadataValueObject(controlValue, controlLanguage, authority, controlValue, place); + } + else { + return new FormFieldMetadataValueObject(controlValue.value, controlLanguage, authority, controlValue.display, place, controlValue.confidence); + } + } + }; + var iterateControlModels = function (findGroupModel, controlModelIndex) { + if (controlModelIndex === void 0) { controlModelIndex = 0; } + var iterateResult = Object.create({}); + var _loop_1 = function (controlModel) { + if (_this.isRowGroup(controlModel) && !_this.isCustomOrListGroup(controlModel)) { + iterateResult = mergeWith(iterateResult, iterateControlModels(controlModel.group), customizer); + return "continue"; + } + if (_this.isGroup(controlModel) && !_this.isCustomOrListGroup(controlModel)) { + iterateResult[controlModel.name] = iterateControlModels(controlModel.group); + return "continue"; + } + if (_this.isRowArrayGroup(controlModel)) { + for (var _i = 0, _a = controlModel.groups; _i < _a.length; _i++) { + var arrayItemModel = _a[_i]; + iterateResult = mergeWith(iterateResult, iterateControlModels(arrayItemModel.group, arrayItemModel.index), customizer); + } + return "continue"; + } + if (_this.isArrayGroup(controlModel)) { + iterateResult[controlModel.name] = []; + for (var _b = 0, _c = controlModel.groups; _b < _c.length; _b++) { + var arrayItemModel = _c[_b]; + iterateResult[controlModel.name].push(iterateControlModels(arrayItemModel.group, arrayItemModel.index)); + } + return "continue"; + } + var controlId = void 0; + // Get the field's name + if (_this.isQualdropGroup(controlModel)) { + // If is instance of DynamicQualdropModel take the qualdrop id as field's name + controlId = controlModel.qualdropId; + } + else { + controlId = controlModel.name; + } + if (_this.isRelationGroup(controlModel)) { + var values = controlModel.getGroupValue(); + values.forEach(function (groupValue, groupIndex) { + var newGroupValue = Object.create({}); + Object.keys(groupValue) + .forEach(function (key) { + var normValue = normalizeValue(controlModel, groupValue[key], groupIndex); + if (isNotEmpty(normValue) && normValue.hasValue()) { + if (iterateResult.hasOwnProperty(key)) { + iterateResult[key].push(normValue); + } + else { + iterateResult[key] = [normValue]; + } + } + }); + }); + } + else if (isNotUndefined(controlModel.value) && isNotEmpty(controlModel.value)) { + var controlArrayValue_1 = []; + // Normalize control value as an array of FormFieldMetadataValueObject + var values = Array.isArray(controlModel.value) ? controlModel.value : [controlModel.value]; + values.forEach(function (controlValue) { + controlArrayValue_1.push(normalizeValue(controlModel, controlValue, controlModelIndex)); + }); + if (controlId && iterateResult.hasOwnProperty(controlId) && isNotNull(iterateResult[controlId])) { + iterateResult[controlId] = iterateResult[controlId].concat(controlArrayValue_1); + } + else { + iterateResult[controlId] = isNotEmpty(controlArrayValue_1) ? controlArrayValue_1 : null; + } + } + }; + // Iterate over all group's controls + for (var _i = 0, findGroupModel_3 = findGroupModel; _i < findGroupModel_3.length; _i++) { + var controlModel = findGroupModel_3[_i]; + _loop_1(controlModel); + } + return iterateResult; + }; + result = iterateControlModels(groupModel); + return result; + }; + FormBuilderService.prototype.modelFromConfiguration = function (json, scopeUUID, initFormValues, submissionScope, readOnly) { + if (initFormValues === void 0) { initFormValues = {}; } + if (readOnly === void 0) { readOnly = false; } + var rows = []; + var rawData = typeof json === 'string' ? JSON.parse(json, JSONUtils.parseReviver) : json; + if (rawData.rows && !isEmpty(rawData.rows)) { + rawData.rows.forEach(function (currentRow) { + var rowParsed = new RowParser(currentRow, scopeUUID, initFormValues, submissionScope, readOnly).parse(); + if (isNotNull(rowParsed)) { + if (Array.isArray(rowParsed)) { + rows = rows.concat(rowParsed); + } + else { + rows.push(rowParsed); + } + } + }); + } + return rows; + }; + FormBuilderService.prototype.isModelInCustomGroup = function (model) { + return this.isCustomGroup(model.parent); + }; + FormBuilderService.prototype.hasArrayGroupValue = function (model) { + return model && (this.isListGroup(model) || model.type === DYNAMIC_FORM_CONTROL_TYPE_TAG); + }; + FormBuilderService.prototype.hasMappedGroupValue = function (model) { + return (this.isQualdropGroup(model.parent) + || this.isRelationGroup(model.parent)); + }; + FormBuilderService.prototype.isGroup = function (model) { + return model && (model.type === DYNAMIC_FORM_CONTROL_TYPE_GROUP || model.type === DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX_GROUP); + }; + FormBuilderService.prototype.isQualdropGroup = function (model) { + return (model && model.type === DYNAMIC_FORM_CONTROL_TYPE_GROUP && hasValue(model.qualdropId)); + }; + FormBuilderService.prototype.isCustomGroup = function (model) { + return model && (model.type === DYNAMIC_FORM_CONTROL_TYPE_GROUP && model.isCustomGroup === true); + }; + FormBuilderService.prototype.isRowGroup = function (model) { + return model && (model.type === DYNAMIC_FORM_CONTROL_TYPE_GROUP && model.isRowGroup === true); + }; + FormBuilderService.prototype.isCustomOrListGroup = function (model) { + return model && + (this.isCustomGroup(model) + || this.isListGroup(model)); + }; + FormBuilderService.prototype.isListGroup = function (model) { + return model && + ((model.type === DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX_GROUP && model.isListGroup === true) + || (model.type === DYNAMIC_FORM_CONTROL_TYPE_RADIO_GROUP && model.isListGroup === true)); + }; + FormBuilderService.prototype.isRelationGroup = function (model) { + return model && model.type === DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP; + }; + FormBuilderService.prototype.isRowArrayGroup = function (model) { + return model.type === DYNAMIC_FORM_CONTROL_TYPE_ARRAY && model.isRowArray === true; + }; + FormBuilderService.prototype.isArrayGroup = function (model) { + return model.type === DYNAMIC_FORM_CONTROL_TYPE_ARRAY; + }; + FormBuilderService.prototype.isInputModel = function (model) { + return model.type === DYNAMIC_FORM_CONTROL_TYPE_INPUT; + }; + FormBuilderService.prototype.getFormControlById = function (id, formGroup, groupModel, index) { + if (index === void 0) { index = 0; } + var fieldModel = this.findById(id, groupModel, index); + return isNotEmpty(fieldModel) ? formGroup.get(this.getPath(fieldModel)) : null; + }; + FormBuilderService.prototype.getId = function (model) { + var tempModel; + if (this.isArrayGroup(model)) { + return model.index.toString(); + } + else if (this.isModelInCustomGroup(model)) { + tempModel = model.parent; + } + else { + tempModel = model; + } + return (tempModel.id !== tempModel.name) ? tempModel.name : tempModel.id; + }; + FormBuilderService = tslib_1.__decorate([ + Injectable() + ], FormBuilderService); + return FormBuilderService; +}(DynamicFormService)); +export { FormBuilderService }; +//# sourceMappingURL=form-builder.service.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/form-builder.service.js.map b/src/app/shared/form/builder/form-builder.service.js.map new file mode 100644 index 0000000000..7af33e3ea8 --- /dev/null +++ b/src/app/shared/form/builder/form-builder.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"form-builder.service.js","sourceRoot":"","sources":["form-builder.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EACL,+BAA+B,EAC/B,wCAAwC,EACxC,+BAA+B,EAC/B,+BAA+B,EAC/B,qCAAqC,EAIrC,kBAAkB,EAElB,SAAS,GACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,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C,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QACxD,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjF,CAAC;IAED,kCAAK,GAAL,UAAM,KAAsB;QAC1B,IAAI,SAAkC,CAAC;QAEvC,IAAI,IAAI,CAAC,YAAY,CAAC,KAAgC,CAAC,EAAE;YACvD,OAAO,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;SAC/B;aAAM,IAAI,IAAI,CAAC,oBAAoB,CAAC,KAAgC,CAAC,EAAE;YACtE,SAAS,GAAI,KAAa,CAAC,MAAM,CAAC;SACnC;aAAM;YACL,SAAS,GAAI,KAAa,CAAC;SAC5B;QAED,OAAO,CAAC,SAAS,CAAC,EAAE,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;IAC3E,CAAC;IArQU,kBAAkB;QAD9B,UAAU,EAAE;OACA,kBAAkB,CAuQ9B;IAAD,yBAAC;CAAA,AAvQD,CAAwC,kBAAkB,GAuQzD;SAvQY,kBAAkB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/models/form-field-language-value.model.js b/src/app/shared/form/builder/models/form-field-language-value.model.js new file mode 100644 index 0000000000..656b17b100 --- /dev/null +++ b/src/app/shared/form/builder/models/form-field-language-value.model.js @@ -0,0 +1,9 @@ +var FormFieldLanguageValueObject = /** @class */ (function () { + function FormFieldLanguageValueObject(value, language) { + this.value = value; + this.language = language; + } + return FormFieldLanguageValueObject; +}()); +export { FormFieldLanguageValueObject }; +//# sourceMappingURL=form-field-language-value.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/models/form-field-language-value.model.js.map b/src/app/shared/form/builder/models/form-field-language-value.model.js.map new file mode 100644 index 0000000000..eb3f43b6b9 --- /dev/null +++ b/src/app/shared/form/builder/models/form-field-language-value.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"form-field-language-value.model.js","sourceRoot":"","sources":["form-field-language-value.model.ts"],"names":[],"mappings":"AAAA;IAIE,sCAAY,KAAa,EAAE,QAAgB;QACzC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IACH,mCAAC;AAAD,CAAC,AARD,IAQC"} \ No newline at end of file diff --git a/src/app/shared/form/builder/models/form-field-metadata-value.model.js b/src/app/shared/form/builder/models/form-field-metadata-value.model.js new file mode 100644 index 0000000000..9bb2c30162 --- /dev/null +++ b/src/app/shared/form/builder/models/form-field-metadata-value.model.js @@ -0,0 +1,49 @@ +import { isEmpty, isNotEmpty, isNotNull } from '../../../empty.util'; +import { ConfidenceType } from '../../../../core/integration/models/confidence-type'; +import { PLACEHOLDER_PARENT_METADATA } from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; +var FormFieldMetadataValueObject = /** @class */ (function () { + function FormFieldMetadataValueObject(value, language, authority, display, place, confidence, otherInformation, metadata) { + if (value === void 0) { value = null; } + if (language === void 0) { language = null; } + if (authority === void 0) { authority = null; } + if (display === void 0) { display = null; } + if (place === void 0) { place = 0; } + if (confidence === void 0) { confidence = null; } + if (otherInformation === void 0) { otherInformation = null; } + if (metadata === void 0) { metadata = null; } + this.value = isNotNull(value) ? ((typeof value === 'string') ? value.trim() : value) : null; + this.language = language; + this.authority = authority; + this.display = display || value; + this.confidence = confidence; + if (authority != null && isEmpty(confidence)) { + this.confidence = ConfidenceType.CF_ACCEPTED; + } + else if (isNotEmpty(confidence)) { + this.confidence = confidence; + } + else { + this.confidence = ConfidenceType.CF_UNSET; + } + this.place = place; + if (isNotEmpty(metadata)) { + this.metadata = metadata; + } + this.otherInformation = otherInformation; + } + FormFieldMetadataValueObject.prototype.hasAuthority = function () { + return isNotEmpty(this.authority); + }; + FormFieldMetadataValueObject.prototype.hasValue = function () { + return isNotEmpty(this.value); + }; + FormFieldMetadataValueObject.prototype.hasOtherInformation = function () { + return isNotEmpty(this.otherInformation); + }; + FormFieldMetadataValueObject.prototype.hasPlaceholder = function () { + return this.hasValue() && this.value === PLACEHOLDER_PARENT_METADATA; + }; + return FormFieldMetadataValueObject; +}()); +export { FormFieldMetadataValueObject }; +//# sourceMappingURL=form-field-metadata-value.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/models/form-field-metadata-value.model.js.map b/src/app/shared/form/builder/models/form-field-metadata-value.model.js.map new file mode 100644 index 0000000000..66e2488629 --- /dev/null +++ b/src/app/shared/form/builder/models/form-field-metadata-value.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"form-field-metadata-value.model.js","sourceRoot":"","sources":["form-field-metadata-value.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AACrF,OAAO,EAAE,2BAA2B,EAAE,MAAM,0EAA0E,CAAC;AAOvH;IAYE,sCAAY,KAAiB,EACjB,QAAoB,EACpB,SAAwB,EACxB,OAAsB,EACtB,KAAiB,EACjB,UAAyB,EACzB,gBAA4B,EAC5B,QAAuB;QAPvB,sBAAA,EAAA,YAAiB;QACjB,yBAAA,EAAA,eAAoB;QACpB,0BAAA,EAAA,gBAAwB;QACxB,wBAAA,EAAA,cAAsB;QACtB,sBAAA,EAAA,SAAiB;QACjB,2BAAA,EAAA,iBAAyB;QACzB,iCAAA,EAAA,uBAA4B;QAC5B,yBAAA,EAAA,eAAuB;QACjC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC5F,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,KAAK,CAAC;QAEhC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,SAAS,IAAI,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,EAAE;YAC5C,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC,WAAW,CAAC;SAC9C;aAAM,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;YACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;SAC9B;aAAM;YACL,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC,QAAQ,CAAC;SAC3C;QAED,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;YACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC1B;QAED,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;IAED,mDAAY,GAAZ;QACE,OAAO,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,+CAAQ,GAAR;QACE,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,0DAAmB,GAAnB;QACE,OAAO,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3C,CAAC;IAED,qDAAc,GAAd;QACE,OAAO,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,KAAK,KAAK,2BAA2B,CAAC;IACvE,CAAC;IACH,mCAAC;AAAD,CAAC,AAzDD,IAyDC"} \ No newline at end of file diff --git a/src/app/shared/form/builder/models/form-field-previous-value-object.js b/src/app/shared/form/builder/models/form-field-previous-value-object.js new file mode 100644 index 0000000000..60721ae1c3 --- /dev/null +++ b/src/app/shared/form/builder/models/form-field-previous-value-object.js @@ -0,0 +1,39 @@ +import { isEqual } from 'lodash'; +var FormFieldPreviousValueObject = /** @class */ (function () { + function FormFieldPreviousValueObject(path, value) { + if (path === void 0) { path = null; } + if (value === void 0) { value = null; } + this._path = path; + this._value = value; + } + Object.defineProperty(FormFieldPreviousValueObject.prototype, "path", { + get: function () { + return this._path; + }, + set: function (path) { + this._path = path; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(FormFieldPreviousValueObject.prototype, "value", { + get: function () { + return this._value; + }, + set: function (value) { + this._value = value; + }, + enumerable: true, + configurable: true + }); + FormFieldPreviousValueObject.prototype.delete = function () { + this._value = null; + this._path = null; + }; + FormFieldPreviousValueObject.prototype.isPathEqual = function (path) { + return this._path && isEqual(this._path, path); + }; + return FormFieldPreviousValueObject; +}()); +export { FormFieldPreviousValueObject }; +//# sourceMappingURL=form-field-previous-value-object.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/models/form-field-previous-value-object.js.map b/src/app/shared/form/builder/models/form-field-previous-value-object.js.map new file mode 100644 index 0000000000..0921d50355 --- /dev/null +++ b/src/app/shared/form/builder/models/form-field-previous-value-object.js.map @@ -0,0 +1 @@ +{"version":3,"file":"form-field-previous-value-object.js","sourceRoot":"","sources":["form-field-previous-value-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC;IAKE,sCAAY,IAAkB,EAAE,KAAiB;QAArC,qBAAA,EAAA,WAAkB;QAAE,sBAAA,EAAA,YAAiB;QAC/C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,sBAAI,8CAAI;aAAR;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;aAED,UAAS,IAAW;YAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,CAAC;;;OAJA;IAMD,sBAAI,+CAAK;aAAT;YACE,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;aAED,UAAU,KAAU;YAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACtB,CAAC;;;OAJA;IAMM,6CAAM,GAAb;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAEM,kDAAW,GAAlB,UAAmB,IAAI;QACrB,OAAO,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IACH,mCAAC;AAAD,CAAC,AAlCD,IAkCC"} \ No newline at end of file diff --git a/src/app/shared/form/builder/models/form-field.model.js b/src/app/shared/form/builder/models/form-field.model.js new file mode 100644 index 0000000000..55f7a7b4fb --- /dev/null +++ b/src/app/shared/form/builder/models/form-field.model.js @@ -0,0 +1,57 @@ +import * as tslib_1 from "tslib"; +import { autoserialize } from 'cerialize'; +var FormFieldModel = /** @class */ (function () { + function FormFieldModel() { + } + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], FormFieldModel.prototype, "hints", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], FormFieldModel.prototype, "label", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Array) + ], FormFieldModel.prototype, "languageCodes", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], FormFieldModel.prototype, "mandatoryMessage", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], FormFieldModel.prototype, "mandatory", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Boolean) + ], FormFieldModel.prototype, "repeatable", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Object) + ], FormFieldModel.prototype, "input", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Array) + ], FormFieldModel.prototype, "selectableMetadata", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Array) + ], FormFieldModel.prototype, "rows", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], FormFieldModel.prototype, "scope", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", String) + ], FormFieldModel.prototype, "style", void 0); + tslib_1.__decorate([ + autoserialize, + tslib_1.__metadata("design:type", Object) + ], FormFieldModel.prototype, "value", void 0); + return FormFieldModel; +}()); +export { FormFieldModel }; +//# sourceMappingURL=form-field.model.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/models/form-field.model.js.map b/src/app/shared/form/builder/models/form-field.model.js.map new file mode 100644 index 0000000000..dfd52a63e5 --- /dev/null +++ b/src/app/shared/form/builder/models/form-field.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"form-field.model.js","sourceRoot":"","sources":["form-field.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAK1C;IAAA;IAwCA,CAAC;IArCC;QADC,aAAa;;iDACA;IAGd;QADC,aAAa;;iDACA;IAGd;QADC,aAAa;;yDACgB;IAG9B;QADC,aAAa;;4DACW;IAGzB;QADC,aAAa;;qDACI;IAGlB;QADC,aAAa;;sDACM;IAGpB;QADC,aAAa;;iDAIZ;IAGF;QADC,aAAa;;8DACqC;IAGnD;QADC,aAAa;;gDACO;IAGrB;QADC,aAAa;;iDACA;IAGd;QADC,aAAa;;iDACA;IAGd;QADC,aAAa;;iDACH;IACb,qBAAC;CAAA,AAxCD,IAwCC;SAxCY,cAAc"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/concat-field-parser.js b/src/app/shared/form/builder/parsers/concat-field-parser.js new file mode 100644 index 0000000000..baaee1a473 --- /dev/null +++ b/src/app/shared/form/builder/parsers/concat-field-parser.js @@ -0,0 +1,73 @@ +import * as tslib_1 from "tslib"; +import { FieldParser } from './field-parser'; +import { DynamicInputModel } from '@ng-dynamic-forms/core'; +import { CONCAT_FIRST_INPUT_SUFFIX, CONCAT_GROUP_SUFFIX, CONCAT_SECOND_INPUT_SUFFIX, DynamicConcatModel } from '../ds-dynamic-form-ui/models/ds-dynamic-concat.model'; +import { isNotEmpty } from '../../../empty.util'; +var ConcatFieldParser = /** @class */ (function (_super) { + tslib_1.__extends(ConcatFieldParser, _super); + function ConcatFieldParser(configData, initFormValues, parserOptions, separator, firstPlaceholder, secondPlaceholder) { + if (firstPlaceholder === void 0) { firstPlaceholder = null; } + if (secondPlaceholder === void 0) { secondPlaceholder = null; } + var _this = _super.call(this, configData, initFormValues, parserOptions) || this; + _this.configData = configData; + _this.initFormValues = initFormValues; + _this.parserOptions = parserOptions; + _this.separator = separator; + _this.firstPlaceholder = firstPlaceholder; + _this.secondPlaceholder = secondPlaceholder; + _this.separator = separator; + _this.firstPlaceholder = firstPlaceholder; + _this.secondPlaceholder = secondPlaceholder; + return _this; + } + ConcatFieldParser.prototype.modelFactory = function (fieldValue, label) { + var clsGroup; + var clsInput; + var id = this.configData.selectableMetadata[0].metadata; + clsInput = { + grid: { + host: 'col-sm-6' + } + }; + var groupId = id.replace(/\./g, '_') + CONCAT_GROUP_SUFFIX; + var concatGroup = this.initModel(groupId, false, false); + concatGroup.group = []; + concatGroup.separator = this.separator; + var input1ModelConfig = this.initModel(id + CONCAT_FIRST_INPUT_SUFFIX, label, false, false); + var input2ModelConfig = this.initModel(id + CONCAT_SECOND_INPUT_SUFFIX, label, true, false); + if (this.configData.mandatory) { + input1ModelConfig.required = true; + } + if (isNotEmpty(this.firstPlaceholder)) { + input1ModelConfig.placeholder = this.firstPlaceholder; + } + if (isNotEmpty(this.secondPlaceholder)) { + input2ModelConfig.placeholder = this.secondPlaceholder; + } + // Split placeholder if is like 'placeholder1/placeholder2' + var placeholder = this.configData.label.split('/'); + if (placeholder.length === 2) { + input1ModelConfig.placeholder = placeholder[0]; + input2ModelConfig.placeholder = placeholder[1]; + } + var model1 = new DynamicInputModel(input1ModelConfig, clsInput); + var model2 = new DynamicInputModel(input2ModelConfig, clsInput); + concatGroup.group.push(model1); + concatGroup.group.push(model2); + clsGroup = { + element: { + control: 'form-row', + } + }; + var concatModel = new DynamicConcatModel(concatGroup, clsGroup); + concatModel.name = this.getFieldId(); + // Init values + if (isNotEmpty(fieldValue)) { + concatModel.value = fieldValue; + } + return concatModel; + }; + return ConcatFieldParser; +}(FieldParser)); +export { ConcatFieldParser }; +//# sourceMappingURL=concat-field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/concat-field-parser.js.map b/src/app/shared/form/builder/parsers/concat-field-parser.js.map new file mode 100644 index 0000000000..3f98ac35a8 --- /dev/null +++ b/src/app/shared/form/builder/parsers/concat-field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"concat-field-parser.js","sourceRoot":"","sources":["concat-field-parser.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAA4B,iBAAiB,EAA2B,MAAM,wBAAwB,CAAC;AAC9G,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,0BAA0B,EAC1B,kBAAkB,EAEnB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD;IAAuC,6CAAW;IAEhD,2BAAsB,UAA0B,EAC1B,cAAc,EACd,aAA4B,EAC5B,SAAiB,EACjB,gBAA+B,EAC/B,iBAAgC;QADhC,iCAAA,EAAA,uBAA+B;QAC/B,kCAAA,EAAA,wBAAgC;QALtD,YAME,kBAAM,UAAU,EAAE,cAAc,EAAE,aAAa,CAAC,SAKjD;QAXqB,gBAAU,GAAV,UAAU,CAAgB;QAC1B,oBAAc,GAAd,cAAc,CAAA;QACd,mBAAa,GAAb,aAAa,CAAe;QAC5B,eAAS,GAAT,SAA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gBAAgB,CAAC;SACvD;QAED,IAAI,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE;YACtC,iBAAiB,CAAC,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC;SACxD;QAED,2DAA2D;QAC3D,IAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,iBAAiB,CAAC,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;YAC/C,iBAAiB,CAAC,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;SAChD;QAED,IAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QAClE,IAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QAClE,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/B,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE/B,QAAQ,GAAG;YACT,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF,CAAC;QACF,IAAM,WAAW,GAAG,IAAI,kBAAkB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAClE,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAErC,cAAc;QACd,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;YAC1B,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC;SAChC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAEH,wBAAC;AAAD,CAAC,AA5ED,CAAuC,WAAW,GA4EjD"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/date-field-parser.js b/src/app/shared/form/builder/parsers/date-field-parser.js new file mode 100644 index 0000000000..a2129acdc1 --- /dev/null +++ b/src/app/shared/form/builder/parsers/date-field-parser.js @@ -0,0 +1,38 @@ +import * as tslib_1 from "tslib"; +import { FieldParser } from './field-parser'; +import { DynamicDsDatePickerModel } from '../ds-dynamic-form-ui/models/date-picker/date-picker.model'; +import { isNotEmpty } from '../../../empty.util'; +import { DS_DATE_PICKER_SEPARATOR } from '../ds-dynamic-form-ui/models/date-picker/date-picker.component'; +var DateFieldParser = /** @class */ (function (_super) { + tslib_1.__extends(DateFieldParser, _super); + function DateFieldParser() { + return _super !== null && _super.apply(this, arguments) || this; + } + DateFieldParser.prototype.modelFactory = function (fieldValue, label) { + var malformedDate = false; + var inputDateModelConfig = this.initModel(null, label); + inputDateModelConfig.toggleIcon = 'fas fa-calendar'; + this.setValues(inputDateModelConfig, fieldValue); + // Init Data and validity check + if (isNotEmpty(inputDateModelConfig.value)) { + var value = inputDateModelConfig.value.toString(); + if (value.length >= 4) { + var valuesArray = value.split(DS_DATE_PICKER_SEPARATOR); + if (valuesArray.length < 4) { + for (var i = 0; i < valuesArray.length; i++) { + var len = i === 0 ? 4 : 2; + if (valuesArray[i].length !== len) { + malformedDate = true; + } + } + } + } + } + var dateModel = new DynamicDsDatePickerModel(inputDateModelConfig); + dateModel.malformedDate = malformedDate; + return dateModel; + }; + return DateFieldParser; +}(FieldParser)); +export { DateFieldParser }; +//# sourceMappingURL=date-field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/date-field-parser.js.map b/src/app/shared/form/builder/parsers/date-field-parser.js.map new file mode 100644 index 0000000000..6a2320fdbe --- /dev/null +++ b/src/app/shared/form/builder/parsers/date-field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"date-field-parser.js","sourceRoot":"","sources":["date-field-parser.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,4DAA4D,CAAC;AACtG,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC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app/shared/form/builder/parsers/dropdown-field-parser.js b/src/app/shared/form/builder/parsers/dropdown-field-parser.js new file mode 100644 index 0000000000..4656b8dd58 --- /dev/null +++ b/src/app/shared/form/builder/parsers/dropdown-field-parser.js @@ -0,0 +1,36 @@ +import * as tslib_1 from "tslib"; +import { FieldParser } from './field-parser'; +import { DynamicScrollableDropdownModel } from '../ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model'; +import { isNotEmpty } from '../../../empty.util'; +var DropdownFieldParser = /** @class */ (function (_super) { + tslib_1.__extends(DropdownFieldParser, _super); + function DropdownFieldParser() { + return _super !== null && _super.apply(this, arguments) || this; + } + DropdownFieldParser.prototype.modelFactory = function (fieldValue, label) { + var dropdownModelConfig = this.initModel(null, label); + var layout; + if (isNotEmpty(this.configData.selectableMetadata[0].authority)) { + this.setAuthorityOptions(dropdownModelConfig, this.parserOptions.authorityUuid); + if (isNotEmpty(fieldValue)) { + dropdownModelConfig.value = fieldValue; + } + layout = { + element: { + control: 'col' + }, + grid: { + host: 'col' + } + }; + var dropdownModel = new DynamicScrollableDropdownModel(dropdownModelConfig, layout); + return dropdownModel; + } + else { + throw Error("Authority name is not available. Please checks form configuration file."); + } + }; + return DropdownFieldParser; +}(FieldParser)); +export { DropdownFieldParser }; +//# sourceMappingURL=dropdown-field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/dropdown-field-parser.js.map b/src/app/shared/form/builder/parsers/dropdown-field-parser.js.map new file mode 100644 index 0000000000..d10061ed10 --- /dev/null +++ b/src/app/shared/form/builder/parsers/dropdown-field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dropdown-field-parser.js","sourceRoot":"","sources":["dropdown-field-parser.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EACL,8BAA8B,EAE/B,MAAM,oFAAoF,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD;IAAyC,+CAAW;IAApD;;IAyBA,CAAC;IAvBQ,0CAAY,GAAnB,UAAoB,UAA+C,EAAE,KAAe;QAClF,IAAM,mBAAmB,GAAyC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC9F,IAAI,MAAgC,CAAC;QAErC,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;YAC/D,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;YAChF,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;gBAC1B,mBAAmB,CAAC,KAAK,GAAG,UAAU,CAAC;aACxC;YACD,MAAM,GAAG;gBACP,OAAO,EAAE;oBACP,OAAO,EAAE,KAAK;iBACf;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,KAAK;iBACZ;aACF,CAAC;YACF,IAAM,aAAa,GAAG,IAAI,8BAA8B,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;YACtF,OAAO,aAAa,CAAC;SACtB;aAAM;YACL,MAAO,KAAK,CAAC,yEAAyE,CAAC,CAAC;SACzF;IACH,CAAC;IACH,0BAAC;AAAD,CAAC,AAzBD,CAAyC,WAAW,GAyBnD"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/field-parser.js b/src/app/shared/form/builder/parsers/field-parser.js new file mode 100644 index 0000000000..45547f8f0d --- /dev/null +++ b/src/app/shared/form/builder/parsers/field-parser.js @@ -0,0 +1,276 @@ +import { hasValue, isNotEmpty, isNotNull, isNotUndefined } from '../../../empty.util'; +import { uniqueId } from 'lodash'; +import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model'; +import { DynamicRowArrayModel } from '../ds-dynamic-form-ui/models/ds-dynamic-row-array-model'; +import { setLayout } from './parser.utils'; +import { AuthorityOptions } from '../../../../core/integration/models/authority-options.model'; +var FieldParser = /** @class */ (function () { + function FieldParser(configData, initFormValues, parserOptions) { + this.configData = configData; + this.initFormValues = initFormValues; + this.parserOptions = parserOptions; + } + FieldParser.prototype.parse = function () { + var _this = this; + if (((this.getInitValueCount() > 1 && !this.configData.repeatable) || (this.configData.repeatable)) + && (this.configData.input.type !== 'list') + && (this.configData.input.type !== 'tag') + && (this.configData.input.type !== 'group')) { + var arrayCounter_1 = 0; + var fieldArrayCounter_1 = 0; + var config = { + id: uniqueId() + '_array', + label: this.configData.label, + initialCount: this.getInitArrayIndex(), + notRepeatable: !this.configData.repeatable, + groupFactory: function () { + var model; + if ((arrayCounter_1 === 0)) { + model = _this.modelFactory(); + arrayCounter_1++; + } + else { + var fieldArrayOfValueLenght = _this.getInitValueCount(arrayCounter_1 - 1); + var fieldValue = null; + if (fieldArrayOfValueLenght > 0) { + fieldValue = _this.getInitFieldValue(arrayCounter_1 - 1, fieldArrayCounter_1++); + if (fieldArrayCounter_1 === fieldArrayOfValueLenght) { + fieldArrayCounter_1 = 0; + arrayCounter_1++; + } + } + model = _this.modelFactory(fieldValue, false); + } + setLayout(model, 'element', 'host', 'col'); + if (model.hasLanguages) { + setLayout(model, 'grid', 'control', 'col'); + } + return [model]; + } + }; + var layout = { + grid: { + group: 'form-row' + } + }; + return new DynamicRowArrayModel(config, layout); + } + else { + var model = this.modelFactory(this.getInitFieldValue()); + if (model.hasLanguages) { + setLayout(model, 'grid', 'control', 'col'); + } + return model; + } + }; + FieldParser.prototype.getInitValueCount = function (index, fieldId) { + var _this = this; + if (index === void 0) { index = 0; } + var fieldIds = fieldId || this.getAllFieldIds(); + if (isNotEmpty(this.initFormValues) && isNotNull(fieldIds) && fieldIds.length === 1 && this.initFormValues.hasOwnProperty(fieldIds[0])) { + return this.initFormValues[fieldIds[0]].length; + } + else if (isNotEmpty(this.initFormValues) && isNotNull(fieldIds) && fieldIds.length > 1) { + var values_1 = []; + fieldIds.forEach(function (id) { + if (_this.initFormValues.hasOwnProperty(id)) { + values_1.push(_this.initFormValues[id].length); + } + }); + return values_1[index]; + } + else { + return 0; + } + }; + FieldParser.prototype.getInitGroupValues = function () { + var fieldIds = this.getAllFieldIds(); + if (isNotEmpty(this.initFormValues) && isNotNull(fieldIds) && fieldIds.length === 1 && this.initFormValues.hasOwnProperty(fieldIds[0])) { + return this.initFormValues[fieldIds[0]]; + } + }; + FieldParser.prototype.getInitFieldValues = function (fieldId) { + if (isNotEmpty(this.initFormValues) && isNotNull(fieldId) && this.initFormValues.hasOwnProperty(fieldId)) { + return this.initFormValues[fieldId]; + } + }; + FieldParser.prototype.getInitFieldValue = function (outerIndex, innerIndex, fieldId) { + var _this = this; + if (outerIndex === void 0) { outerIndex = 0; } + if (innerIndex === void 0) { innerIndex = 0; } + var fieldIds = fieldId || this.getAllFieldIds(); + if (isNotEmpty(this.initFormValues) + && isNotNull(fieldIds) + && fieldIds.length === 1 + && this.initFormValues.hasOwnProperty(fieldIds[outerIndex]) + && this.initFormValues[fieldIds[outerIndex]].length > innerIndex) { + return this.initFormValues[fieldIds[outerIndex]][innerIndex]; + } + else if (isNotEmpty(this.initFormValues) && isNotNull(fieldIds) && fieldIds.length > 1) { + var values_2 = []; + fieldIds.forEach(function (id) { + if (_this.initFormValues.hasOwnProperty(id)) { + var valueObj = Object.assign(new FormFieldMetadataValueObject(), _this.initFormValues[id][innerIndex]); + valueObj.metadata = id; + // valueObj.value = this.initFormValues[id][innerIndex]; + values_2.push(valueObj); + } + }); + return values_2[outerIndex]; + } + else { + return null; + } + }; + FieldParser.prototype.getInitArrayIndex = function () { + var _this = this; + var fieldIds = this.getAllFieldIds(); + if (isNotEmpty(this.initFormValues) && isNotNull(fieldIds) && fieldIds.length === 1 && this.initFormValues.hasOwnProperty(fieldIds)) { + return this.initFormValues[fieldIds].length; + } + else if (isNotEmpty(this.initFormValues) && isNotNull(fieldIds) && fieldIds.length > 1) { + var counter_1 = 0; + fieldIds.forEach(function (id) { + if (_this.initFormValues.hasOwnProperty(id)) { + counter_1 = counter_1 + _this.initFormValues[id].length; + } + }); + return (counter_1 === 0) ? 1 : counter_1; + } + else { + return 1; + } + }; + FieldParser.prototype.getFieldId = function () { + var ids = this.getAllFieldIds(); + return isNotNull(ids) ? ids[0] : null; + }; + FieldParser.prototype.getAllFieldIds = function () { + if (Array.isArray(this.configData.selectableMetadata)) { + if (this.configData.selectableMetadata.length === 1) { + return [this.configData.selectableMetadata[0].metadata]; + } + else { + var ids_1 = []; + this.configData.selectableMetadata.forEach(function (entry) { return ids_1.push(entry.metadata); }); + return ids_1; + } + } + else { + return null; + } + }; + FieldParser.prototype.initModel = function (id, label, labelEmpty, setErrors) { + if (label === void 0) { label = true; } + if (labelEmpty === void 0) { labelEmpty = false; } + if (setErrors === void 0) { setErrors = true; } + var controlModel = Object.create(null); + // Sets input ID + this.fieldId = id ? id : this.getFieldId(); + // Sets input name (with the original field's id value) + controlModel.name = this.fieldId; + // input ID doesn't allow dots, so replace them + controlModel.id = (this.fieldId).replace(/\./g, '_'); + // Set read only option + controlModel.readOnly = this.parserOptions.readOnly; + controlModel.disabled = this.parserOptions.readOnly; + // Set label + this.setLabel(controlModel, label, labelEmpty); + controlModel.placeholder = this.configData.label; + if (this.configData.mandatory && setErrors) { + this.markAsRequired(controlModel); + } + if (this.hasRegex()) { + this.addPatternValidator(controlModel); + } + // Available Languages + if (this.configData.languageCodes && this.configData.languageCodes.length > 0) { + controlModel.languageCodes = this.configData.languageCodes; + } + /* (controlModel as DsDynamicInputModel).languageCodes = [{ + display: 'English', + code: 'en_US' + }, + { + display: 'Italian', + code: 'it_IT' + }];*/ + return controlModel; + }; + FieldParser.prototype.hasRegex = function () { + return hasValue(this.configData.input.regex); + }; + FieldParser.prototype.addPatternValidator = function (controlModel) { + var regex = new RegExp(this.configData.input.regex); + controlModel.validators = Object.assign({}, controlModel.validators, { pattern: regex }); + controlModel.errorMessages = Object.assign({}, controlModel.errorMessages, { pattern: 'error.validation.pattern' }); + }; + FieldParser.prototype.markAsRequired = function (controlModel) { + controlModel.required = true; + controlModel.validators = Object.assign({}, controlModel.validators, { required: null }); + controlModel.errorMessages = Object.assign({}, controlModel.errorMessages, { required: this.configData.mandatoryMessage }); + }; + FieldParser.prototype.setLabel = function (controlModel, label, labelEmpty) { + if (label === void 0) { label = true; } + if (labelEmpty === void 0) { labelEmpty = false; } + if (label) { + controlModel.label = (labelEmpty) ? ' ' : this.configData.label; + } + }; + FieldParser.prototype.setOptions = function (controlModel) { + // Checks if field has multiple values and sets options available + if (isNotUndefined(this.configData.selectableMetadata) && this.configData.selectableMetadata.length > 1) { + controlModel.options = []; + this.configData.selectableMetadata.forEach(function (option, key) { + if (key === 0) { + controlModel.value = option.metadata; + } + controlModel.options.push({ label: option.label, value: option.metadata }); + }); + } + }; + FieldParser.prototype.setAuthorityOptions = function (controlModel, authorityUuid) { + if (isNotEmpty(this.configData.selectableMetadata[0].authority)) { + controlModel.authorityOptions = new AuthorityOptions(this.configData.selectableMetadata[0].authority, this.configData.selectableMetadata[0].metadata, authorityUuid, this.configData.selectableMetadata[0].closed); + } + }; + FieldParser.prototype.setValues = function (modelConfig, fieldValue, forceValueAsObj, groupModel) { + if (forceValueAsObj === void 0) { forceValueAsObj = false; } + if (isNotEmpty(fieldValue)) { + if (groupModel) { + // Array, values is an array + modelConfig.value = this.getInitGroupValues(); + if (Array.isArray(modelConfig.value) && modelConfig.value.length > 0 && modelConfig.value[0].language) { + // Array Item has language, ex. AuthorityModel + modelConfig.language = modelConfig.value[0].language; + } + return; + } + if (typeof fieldValue === 'object') { + modelConfig.language = fieldValue.language; + if (forceValueAsObj) { + modelConfig.value = fieldValue; + } + else { + modelConfig.value = fieldValue.value; + } + } + else { + if (forceValueAsObj) { + // If value isn't an instance of FormFieldMetadataValueObject instantiate it + modelConfig.value = new FormFieldMetadataValueObject(fieldValue); + } + else { + if (typeof fieldValue === 'string') { + // Case only string + modelConfig.value = fieldValue; + } + } + } + } + return modelConfig; + }; + return FieldParser; +}()); +export { FieldParser }; +//# sourceMappingURL=field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/field-parser.js.map b/src/app/shared/form/builder/parsers/field-parser.js.map new file mode 100644 index 0000000000..d0f0f51727 --- /dev/null +++ b/src/app/shared/form/builder/parsers/field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"field-parser.js","sourceRoot":"","sources":["field-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGtF,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EACL,oBAAoB,EAErB,MAAM,yDAAyD,CAAC;AAGjE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAG/F;IAIE,qBAAsB,UAA0B,EAAY,cAAc,EAAY,aAA4B;QAA5F,eAAU,GAAV,UAAU,CAAgB;QAAY,mBAAc,GAAd,cAAc,CAAA;QAAY,kBAAa,GAAb,aAAa,CAAe;IAClH,CAAC;IAIM,2BAAK,GAAZ;QAAA,iBAsDC;QArDC,IAAI,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;eAC9F,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC;eACvC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC;eACtC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,EAC3C;YACA,IAAI,cAAY,GAAG,CAAC,CAAC;YACrB,IAAI,mBAA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AAE;oBACrG,8CAA8C;oBAC9C,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;iBACtD;gBACD,OAAO;aACR;YAED,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;gBAClC,WAAW,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;gBAC3C,IAAI,eAAe,EAAE;oBACnB,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC;iBAChC;qBAAM;oBACL,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;iBACtC;aACF;iBAAM;gBACL,IAAI,eAAe,EAAE;oBACnB,4EAA4E;oBAC5E,WAAW,CAAC,KAAK,GAAG,IAAI,4BAA4B,CAAC,UAAU,CAAC,CAAC;iBAClE;qBAAM;oBACL,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;wBAClC,mBAAmB;wBACnB,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC;qBAChC;iBACF;aACF;SACF;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAEH,kBAAC;AAAD,CAAC,AAjSD,IAiSC"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/list-field-parser.js b/src/app/shared/form/builder/parsers/list-field-parser.js new file mode 100644 index 0000000000..7a37316ad5 --- /dev/null +++ b/src/app/shared/form/builder/parsers/list-field-parser.js @@ -0,0 +1,45 @@ +import * as tslib_1 from "tslib"; +import { FieldParser } from './field-parser'; +import { isNotEmpty } from '../../../empty.util'; +import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model'; +import { DynamicListCheckboxGroupModel } from '../ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model'; +import { DynamicListRadioGroupModel } from '../ds-dynamic-form-ui/models/list/dynamic-list-radio-group.model'; +var ListFieldParser = /** @class */ (function (_super) { + tslib_1.__extends(ListFieldParser, _super); + function ListFieldParser() { + return _super !== null && _super.apply(this, arguments) || this; + } + ListFieldParser.prototype.modelFactory = function (fieldValue, label) { + var listModelConfig = this.initModel(null, label); + listModelConfig.repeatable = this.configData.repeatable; + if (this.configData.selectableMetadata[0].authority + && this.configData.selectableMetadata[0].authority.length > 0) { + if (isNotEmpty(this.getInitGroupValues())) { + listModelConfig.value = []; + this.getInitGroupValues().forEach(function (value) { + if (value instanceof FormFieldMetadataValueObject) { + listModelConfig.value.push(value); + } + else { + var valueObj = new FormFieldMetadataValueObject(value); + listModelConfig.value.push(valueObj); + } + }); + } + this.setAuthorityOptions(listModelConfig, this.parserOptions.authorityUuid); + } + var listModel; + if (listModelConfig.repeatable) { + listModelConfig.group = []; + listModel = new DynamicListCheckboxGroupModel(listModelConfig); + } + else { + listModelConfig.options = []; + listModel = new DynamicListRadioGroupModel(listModelConfig); + } + return listModel; + }; + return ListFieldParser; +}(FieldParser)); +export { ListFieldParser }; +//# sourceMappingURL=list-field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/list-field-parser.js.map b/src/app/shared/form/builder/parsers/list-field-parser.js.map new file mode 100644 index 0000000000..429e04c9f3 --- /dev/null +++ b/src/app/shared/form/builder/parsers/list-field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"list-field-parser.js","sourceRoot":"","sources":["list-field-parser.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAAE,6BAA6B,EAAE,MAAM,qEAAqE,CAAC;AACpH,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAE9G;IAAqC,2CAAW;IAAhD;;IAoCA,CAAC;IAjCQ,sCAAY,GAAnB,UAAoB,UAA+C,EAAE,KAAe;QAClF,IAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACpD,eAAe,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;QAExD,IAAI,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;eAC9C,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YAE/D,IAAI,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,EAAE;gBACzC,eAAe,CAAC,KAAK,GAAG,EAAE,CAAC;gBAC3B,IAAI,CAAC,kBAAkB,EAAE,CAAC,OAAO,CAAC,UAAC,KAAU;oBAC3C,IAAI,KAAK,YAAY,4BAA4B,EAAE;wBACjD,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;qBACnC;yBAAM;wBACL,IAAM,QAAQ,GAAG,IAAI,4BAA4B,CAAC,KAAK,CAAC,CAAC;wBACzD,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;qBACtC;gBACH,CAAC,CAAC,CAAC;aACJ;YACD,IAAI,CAAC,mBAAmB,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;SAC7E;QAED,IAAI,SAAS,CAAC;QACd,IAAI,eAAe,CAAC,UAAU,EAAE;YAC9B,eAAe,CAAC,KAAK,GAAG,EAAE,CAAC;YAC3B,SAAS,GAAG,IAAI,6BAA6B,CAAC,eAAe,CAAC,CAAC;SAChE;aAAM;YACL,eAAe,CAAC,OAAO,GAAG,EAAE,CAAC;YAC7B,SAAS,GAAG,IAAI,0BAA0B,CAAC,eAAe,CAAC,CAAC;SAC7D;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEH,sBAAC;AAAD,CAAC,AApCD,CAAqC,WAAW,GAoC/C"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/lookup-field-parser.js b/src/app/shared/form/builder/parsers/lookup-field-parser.js new file mode 100644 index 0000000000..6bb2c29779 --- /dev/null +++ b/src/app/shared/form/builder/parsers/lookup-field-parser.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { FieldParser } from './field-parser'; +import { DynamicLookupModel } from '../ds-dynamic-form-ui/models/lookup/dynamic-lookup.model'; +var LookupFieldParser = /** @class */ (function (_super) { + tslib_1.__extends(LookupFieldParser, _super); + function LookupFieldParser() { + return _super !== null && _super.apply(this, arguments) || this; + } + LookupFieldParser.prototype.modelFactory = function (fieldValue, label) { + if (this.configData.selectableMetadata[0].authority) { + var lookupModelConfig = this.initModel(null, label); + this.setAuthorityOptions(lookupModelConfig, this.parserOptions.authorityUuid); + this.setValues(lookupModelConfig, fieldValue, true); + return new DynamicLookupModel(lookupModelConfig); + } + }; + return LookupFieldParser; +}(FieldParser)); +export { LookupFieldParser }; +//# sourceMappingURL=lookup-field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/lookup-field-parser.js.map b/src/app/shared/form/builder/parsers/lookup-field-parser.js.map new file mode 100644 index 0000000000..75ac9c0c66 --- /dev/null +++ b/src/app/shared/form/builder/parsers/lookup-field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lookup-field-parser.js","sourceRoot":"","sources":["lookup-field-parser.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAA4B,MAAM,0DAA0D,CAAC;AAGxH;IAAuC,6CAAW;IAAlD;;IAcA,CAAC;IAZQ,wCAAY,GAAnB,UAAoB,UAA+C,EAAE,KAAe;QAClF,IAAI,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE;YACnD,IAAM,iBAAiB,GAA6B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAEhF,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;YAE9E,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;YAEpD,OAAO,IAAI,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;SAElD;IACH,CAAC;IACH,wBAAC;AAAD,CAAC,AAdD,CAAuC,WAAW,GAcjD"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/lookup-name-field-parser.js b/src/app/shared/form/builder/parsers/lookup-name-field-parser.js new file mode 100644 index 0000000000..4006f73cc7 --- /dev/null +++ b/src/app/shared/form/builder/parsers/lookup-name-field-parser.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { FieldParser } from './field-parser'; +import { DynamicLookupNameModel } from '../ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model'; +var LookupNameFieldParser = /** @class */ (function (_super) { + tslib_1.__extends(LookupNameFieldParser, _super); + function LookupNameFieldParser() { + return _super !== null && _super.apply(this, arguments) || this; + } + LookupNameFieldParser.prototype.modelFactory = function (fieldValue, label) { + if (this.configData.selectableMetadata[0].authority) { + var lookupModelConfig = this.initModel(null, label); + this.setAuthorityOptions(lookupModelConfig, this.parserOptions.authorityUuid); + this.setValues(lookupModelConfig, fieldValue, true); + return new DynamicLookupNameModel(lookupModelConfig); + } + }; + return LookupNameFieldParser; +}(FieldParser)); +export { LookupNameFieldParser }; +//# sourceMappingURL=lookup-name-field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/lookup-name-field-parser.js.map b/src/app/shared/form/builder/parsers/lookup-name-field-parser.js.map new file mode 100644 index 0000000000..9b353db1c7 --- /dev/null +++ b/src/app/shared/form/builder/parsers/lookup-name-field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lookup-name-field-parser.js","sourceRoot":"","sources":["lookup-name-field-parser.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,sBAAsB,EAEvB,MAAM,+DAA+D,CAAC;AAGvE;IAA2C,iDAAW;IAAtD;;IAcA,CAAC;IAZQ,4CAAY,GAAnB,UAAoB,UAA+C,EAAE,KAAe;QAClF,IAAI,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE;YACnD,IAAM,iBAAiB,GAAiC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAEpF,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;YAE9E,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;YAEpD,OAAO,IAAI,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;SACtD;IACH,CAAC;IAEH,4BAAC;AAAD,CAAC,AAdD,CAA2C,WAAW,GAcrD"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/name-field-parser.js b/src/app/shared/form/builder/parsers/name-field-parser.js new file mode 100644 index 0000000000..c0939765cc --- /dev/null +++ b/src/app/shared/form/builder/parsers/name-field-parser.js @@ -0,0 +1,15 @@ +import * as tslib_1 from "tslib"; +import { ConcatFieldParser } from './concat-field-parser'; +var NameFieldParser = /** @class */ (function (_super) { + tslib_1.__extends(NameFieldParser, _super); + function NameFieldParser(configData, initFormValues, parserOptions) { + var _this = _super.call(this, configData, initFormValues, parserOptions, ',', 'form.last-name', 'form.first-name') || this; + _this.configData = configData; + _this.initFormValues = initFormValues; + _this.parserOptions = parserOptions; + return _this; + } + return NameFieldParser; +}(ConcatFieldParser)); +export { NameFieldParser }; +//# sourceMappingURL=name-field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/name-field-parser.js.map b/src/app/shared/form/builder/parsers/name-field-parser.js.map new file mode 100644 index 0000000000..29d7e602fc --- /dev/null +++ b/src/app/shared/form/builder/parsers/name-field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"name-field-parser.js","sourceRoot":"","sources":["name-field-parser.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D;IAAqC,2CAAiB;IAEpD,yBAAsB,UAA0B,EAAY,cAAc,EAAY,aAA4B;QAAlH,YACE,kBAAM,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,SAC3F;QAFqB,gBAAU,GAAV,UAAU,CAAgB;QAAY,oBAAc,GAAd,cAAc,CAAA;QAAY,mBAAa,GAAb,aAAa,CAAe;;IAElH,CAAC;IACH,sBAAC;AAAD,CAAC,AALD,CAAqC,iBAAiB,GAKrD"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/onebox-field-parser.js b/src/app/shared/form/builder/parsers/onebox-field-parser.js new file mode 100644 index 0000000000..07a6fefb00 --- /dev/null +++ b/src/app/shared/form/builder/parsers/onebox-field-parser.js @@ -0,0 +1,72 @@ +import * as tslib_1 from "tslib"; +import { DynamicSelectModel } from '@ng-dynamic-forms/core'; +import { FieldParser } from './field-parser'; +import { DynamicQualdropModel, QUALDROP_GROUP_SUFFIX, QUALDROP_METADATA_SUFFIX, QUALDROP_VALUE_SUFFIX } from '../ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model'; +import { isNotEmpty } from '../../../empty.util'; +import { DsDynamicInputModel } from '../ds-dynamic-form-ui/models/ds-dynamic-input.model'; +import { DynamicTypeaheadModel } from '../ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.model'; +var OneboxFieldParser = /** @class */ (function (_super) { + tslib_1.__extends(OneboxFieldParser, _super); + function OneboxFieldParser() { + return _super !== null && _super.apply(this, arguments) || this; + } + OneboxFieldParser.prototype.modelFactory = function (fieldValue, label) { + if (this.configData.selectableMetadata.length > 1) { + // Case Qualdrop Model + var clsGroup = { + element: { + control: 'form-row', + } + }; + var clsSelect = { + element: { + control: 'ds-form-input-addon custom-select', + }, + grid: { + host: 'col-sm-4 pr-0' + } + }; + var clsInput = { + element: { + control: 'ds-form-input-value', + }, + grid: { + host: 'col-sm-8 pl-0' + } + }; + var newId = this.configData.selectableMetadata[0].metadata + .split('.') + .slice(0, this.configData.selectableMetadata[0].metadata.split('.').length - 1) + .join('.'); + var inputSelectGroup = Object.create(null); + inputSelectGroup.id = newId.replace(/\./g, '_') + QUALDROP_GROUP_SUFFIX; + inputSelectGroup.group = []; + inputSelectGroup.legend = this.configData.label; + var selectModelConfig = this.initModel(newId + QUALDROP_METADATA_SUFFIX, label); + this.setOptions(selectModelConfig); + if (isNotEmpty(fieldValue)) { + selectModelConfig.value = fieldValue.metadata; + } + inputSelectGroup.group.push(new DynamicSelectModel(selectModelConfig, clsSelect)); + var inputModelConfig = this.initModel(newId + QUALDROP_VALUE_SUFFIX, label, true); + this.setValues(inputModelConfig, fieldValue); + inputSelectGroup.readOnly = selectModelConfig.disabled && inputModelConfig.readOnly; + inputSelectGroup.group.push(new DsDynamicInputModel(inputModelConfig, clsInput)); + return new DynamicQualdropModel(inputSelectGroup, clsGroup); + } + else if (this.configData.selectableMetadata[0].authority) { + var typeaheadModelConfig = this.initModel(null, label); + this.setAuthorityOptions(typeaheadModelConfig, this.parserOptions.authorityUuid); + this.setValues(typeaheadModelConfig, fieldValue, true); + return new DynamicTypeaheadModel(typeaheadModelConfig); + } + else { + var inputModelConfig = this.initModel(null, label); + this.setValues(inputModelConfig, fieldValue); + return new DsDynamicInputModel(inputModelConfig); + } + }; + return OneboxFieldParser; +}(FieldParser)); +export { OneboxFieldParser }; +//# sourceMappingURL=onebox-field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/onebox-field-parser.js.map b/src/app/shared/form/builder/parsers/onebox-field-parser.js.map new file mode 100644 index 0000000000..a80a68ebff --- /dev/null +++ b/src/app/shared/form/builder/parsers/onebox-field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"onebox-field-parser.js","sourceRoot":"","s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S,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACxF,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;YACjF,IAAI,CAAC,SAAS,CAAC,oBAAoB,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;YAEvD,OAAO,IAAI,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;SACxD;aAAM;YACL,IAAM,gBAAgB,GAA8B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAChF,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;YAE7C,OAAO,IAAI,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;SAClD;IACH,CAAC;IACH,wBAAC;AAAD,CAAC,AAlED,CAAuC,WAAW,GAkEjD"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/parser-factory.js b/src/app/shared/form/builder/parsers/parser-factory.js new file mode 100644 index 0000000000..8a243b8d80 --- /dev/null +++ b/src/app/shared/form/builder/parsers/parser-factory.js @@ -0,0 +1,59 @@ +import { ParserType } from './parser-type'; +import { DateFieldParser } from './date-field-parser'; +import { DropdownFieldParser } from './dropdown-field-parser'; +import { RelationGroupFieldParser } from './relation-group-field-parser'; +import { ListFieldParser } from './list-field-parser'; +import { LookupFieldParser } from './lookup-field-parser'; +import { LookupNameFieldParser } from './lookup-name-field-parser'; +import { OneboxFieldParser } from './onebox-field-parser'; +import { NameFieldParser } from './name-field-parser'; +import { SeriesFieldParser } from './series-field-parser'; +import { TagFieldParser } from './tag-field-parser'; +import { TextareaFieldParser } from './textarea-field-parser'; +var ParserFactory = /** @class */ (function () { + function ParserFactory() { + } + ParserFactory.getConstructor = function (type) { + switch (type) { + case ParserType.Date: { + return DateFieldParser; + } + case ParserType.Dropdown: { + return DropdownFieldParser; + } + case ParserType.RelationGroup: { + return RelationGroupFieldParser; + } + case ParserType.List: { + return ListFieldParser; + } + case ParserType.Lookup: { + return LookupFieldParser; + } + case ParserType.LookupName: { + return LookupNameFieldParser; + } + case ParserType.Onebox: { + return OneboxFieldParser; + } + case ParserType.Name: { + return NameFieldParser; + } + case ParserType.Series: { + return SeriesFieldParser; + } + case ParserType.Tag: { + return TagFieldParser; + } + case ParserType.Textarea: { + return TextareaFieldParser; + } + default: { + return undefined; + } + } + }; + return ParserFactory; +}()); +export { ParserFactory }; +//# sourceMappingURL=parser-factory.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/parser-factory.js.map b/src/app/shared/form/builder/parsers/parser-factory.js.map new file mode 100644 index 0000000000..74652805ac --- /dev/null +++ b/src/app/shared/form/builder/parsers/parser-factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parser-factory.js","sourceRoot":"","sources":["parser-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;IAAA;IA0CA,CAAC;IAzCe,4BAAc,GAA5B,UAA6B,IAAgB;QAC3C,QAAQ,IAAI,EAAE;YACZ,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC;gBACpB,OAAO,eAAe,CAAA;aACvB;YACD,KAAK,UAAU,CAAC,QAAQ,CAAC,CAAC;gBACxB,OAAO,mBAAmB,CAAA;aAC3B;YACD,KAAK,UAAU,CAAC,aAAa,CAAC,CAAC;gBAC7B,OAAO,wBAAwB,CAAA;aAChC;YACD,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC;gBACpB,OAAO,eAAe,CAAA;aACvB;YACD,KAAK,UAAU,CAAC,MAAM,CAAC,CAAC;gBACtB,OAAO,iBAAiB,CAAA;aACzB;YACD,KAAK,UAAU,CAAC,UAAU,CAAC,CAAC;gBAC1B,OAAO,qBAAqB,CAAA;aAC7B;YACD,KAAK,UAAU,CAAC,MAAM,CAAC,CAAC;gBACtB,OAAO,iBAAiB,CAAA;aACzB;YACD,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC;gBACpB,OAAO,eAAe,CAAA;aACvB;YACD,KAAK,UAAU,CAAC,MAAM,CAAC,CAAC;gBACtB,OAAO,iBAAiB,CAAA;aACzB;YACD,KAAK,UAAU,CAAC,GAAG,CAAC,CAAC;gBACnB,OAAO,cAAc,CAAA;aACtB;YACD,KAAK,UAAU,CAAC,QAAQ,CAAC,CAAC;gBACxB,OAAO,mBAAmB,CAAA;aAC3B;YAED,OAAO,CAAC,CAAC;gBACP,OAAO,SAAS,CAAC;aAClB;SACF;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AA1CD,IA0CC"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/parser-options.js b/src/app/shared/form/builder/parsers/parser-options.js new file mode 100644 index 0000000000..5c14668214 --- /dev/null +++ b/src/app/shared/form/builder/parsers/parser-options.js @@ -0,0 +1 @@ +//# sourceMappingURL=parser-options.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/parser-options.js.map b/src/app/shared/form/builder/parsers/parser-options.js.map new file mode 100644 index 0000000000..7835ce30a8 --- /dev/null +++ b/src/app/shared/form/builder/parsers/parser-options.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parser-options.js","sourceRoot":"","sources":["parser-options.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/parser-type.js b/src/app/shared/form/builder/parsers/parser-type.js new file mode 100644 index 0000000000..ac4701a070 --- /dev/null +++ b/src/app/shared/form/builder/parsers/parser-type.js @@ -0,0 +1,15 @@ +export var ParserType; +(function (ParserType) { + ParserType["Date"] = "date"; + ParserType["Dropdown"] = "dropdown"; + ParserType["RelationGroup"] = "group"; + ParserType["List"] = "list"; + ParserType["Lookup"] = "lookup"; + ParserType["LookupName"] = "lookup-name"; + ParserType["Onebox"] = "onebox"; + ParserType["Name"] = "name"; + ParserType["Series"] = "series"; + ParserType["Tag"] = "tag"; + ParserType["Textarea"] = "textarea"; +})(ParserType || (ParserType = {})); +//# sourceMappingURL=parser-type.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/parser-type.js.map b/src/app/shared/form/builder/parsers/parser-type.js.map new file mode 100644 index 0000000000..f3a9eb625e --- /dev/null +++ b/src/app/shared/form/builder/parsers/parser-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parser-type.js","sourceRoot":"","sources":["parser-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAYX;AAZD,WAAY,UAAU;IACpB,2BAAa,CAAA;IACb,mCAAqB,CAAA;IACrB,qCAAuB,CAAA;IACvB,2BAAa,CAAA;IACb,+BAAiB,CAAA;IACjB,wCAA0B,CAAA;IAC1B,+BAAiB,CAAA;IACjB,2BAAa,CAAA;IACb,+BAAiB,CAAA;IACjB,yBAAW,CAAA;IACX,mCAAqB,CAAA;AACvB,CAAC,EAZW,UAAU,KAAV,UAAU,QAYrB"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/parser.utils.js b/src/app/shared/form/builder/parsers/parser.utils.js new file mode 100644 index 0000000000..9709020bfa --- /dev/null +++ b/src/app/shared/form/builder/parsers/parser.utils.js @@ -0,0 +1,19 @@ +import { isNull, isUndefined } from '../../../empty.util'; +export function setLayout(model, controlLayout, controlLayoutConfig, style) { + if (isNull(model.layout)) { + model.layout = {}; + model.layout[controlLayout] = {}; + model.layout[controlLayout][controlLayoutConfig] = style; + } + else if (isUndefined(model.layout[controlLayout])) { + model.layout[controlLayout] = {}; + model.layout[controlLayout][controlLayoutConfig] = style; + } + else if (isUndefined(model.layout[controlLayout][controlLayoutConfig])) { + model.layout[controlLayout][controlLayoutConfig] = style; + } + else { + model.layout[controlLayout][controlLayoutConfig] = model.layout[controlLayout][controlLayoutConfig].concat(" " + style); + } +} +//# sourceMappingURL=parser.utils.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/parser.utils.js.map b/src/app/shared/form/builder/parsers/parser.utils.js.map new file mode 100644 index 0000000000..6bc744beff --- /dev/null +++ b/src/app/shared/form/builder/parsers/parser.utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parser.utils.js","sourceRoot":"","sources":["parser.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG1D,MAAM,oBAAoB,KAAU,EAAE,aAAqB,EAAE,mBAA2B,EAAE,KAAa;IACrG,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;QACxB,KAAK,CAAC,MAAM,GAAG,EAA8B,CAAC;QAC9C,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAoC,CAAC;QACnE,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC;KAC1D;SAAM,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE;QACnD,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAoC,CAAC;QACnE,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC;KAC1D;SAAM,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,mBAAmB,CAAC,CAAC,EAAE;QACxE,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC;KAC1D;SAAM;QACL,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,MAAI,KAAO,CAAC,CAAC;KACzH;AACH,CAAC"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/relation-group-field-parser.js b/src/app/shared/form/builder/parsers/relation-group-field-parser.js new file mode 100644 index 0000000000..578857343f --- /dev/null +++ b/src/app/shared/form/builder/parsers/relation-group-field-parser.js @@ -0,0 +1,60 @@ +import * as tslib_1 from "tslib"; +import { FieldParser } from './field-parser'; +import { isNotEmpty } from '../../../empty.util'; +import { DynamicRelationGroupModel, PLACEHOLDER_PARENT_METADATA } from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; +var RelationGroupFieldParser = /** @class */ (function (_super) { + tslib_1.__extends(RelationGroupFieldParser, _super); + function RelationGroupFieldParser() { + return _super !== null && _super.apply(this, arguments) || this; + } + RelationGroupFieldParser.prototype.modelFactory = function (fieldValue, label) { + var _this = this; + var modelConfiguration = this.initModel(null, label); + modelConfiguration.scopeUUID = this.parserOptions.authorityUuid; + modelConfiguration.submissionScope = this.parserOptions.submissionScope; + if (this.configData && this.configData.rows && this.configData.rows.length > 0) { + modelConfiguration.formConfiguration = this.configData.rows; + modelConfiguration.relationFields = []; + this.configData.rows.forEach(function (row) { + row.fields.forEach(function (field) { + if (field.selectableMetadata[0].metadata === _this.configData.selectableMetadata[0].metadata) { + if (!field.mandatory) { + // throw new Error(`Configuration not valid: Main field ${this.configData.selectableMetadata[0].metadata} may be mandatory`); + } + modelConfiguration.mandatoryField = _this.configData.selectableMetadata[0].metadata; + } + else { + modelConfiguration.relationFields.push(field.selectableMetadata[0].metadata); + } + }); + }); + } + else { + throw new Error("Configuration not valid: " + modelConfiguration.name); + } + if (isNotEmpty(this.getInitGroupValues())) { + modelConfiguration.value = []; + var mandatoryFieldEntries = this.getInitFieldValues(modelConfiguration.mandatoryField); + mandatoryFieldEntries.forEach(function (entry, index) { + var item = Object.create(null); + var listFields = [modelConfiguration.mandatoryField].concat(modelConfiguration.relationFields); + listFields.forEach(function (fieldId) { + var value = _this.getInitFieldValue(0, index, [fieldId]); + item[fieldId] = isNotEmpty(value) ? value : PLACEHOLDER_PARENT_METADATA; + }); + modelConfiguration.value.push(item); + }); + } + var cls = { + element: { + container: 'mb-3' + } + }; + var model = new DynamicRelationGroupModel(modelConfiguration, cls); + model.name = this.getFieldId(); + return model; + }; + return RelationGroupFieldParser; +}(FieldParser)); +export { RelationGroupFieldParser }; +//# sourceMappingURL=relation-group-field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/relation-group-field-parser.js.map b/src/app/shared/form/builder/parsers/relation-group-field-parser.js.map new file mode 100644 index 0000000000..6782b02ba2 --- /dev/null +++ b/src/app/shared/form/builder/parsers/relation-group-field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"relation-group-field-parser.js","sourceRoot":"","sources":["relation-group-field-parser.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EACL,yBAAyB,EAEzB,2BAA2B,EAC5B,MAAM,0EAA0E,CAAC;AAElF;IAA8C,oDAAW;IAAzD;;IAkDA,CAAC;IAhDQ,+CAAY,GAAnB,UAAoB,UAA+C,EAAE,KAAe;QAApF,iBA8CC;QA7CC,IAAM,kBAAkB,GAAoC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,C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AAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;YACzH,qBAAqB,CAAC,OAAO,CAAC,UAAC,KAAK,EAAE,KAAK;gBACzC,IAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACjC,IAAM,UAAU,GAAG,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;gBACjG,UAAU,CAAC,OAAO,CAAC,UAAC,OAAO;oBACzB,IAAM,KAAK,GAAG,KAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;oBAC1D,IAAI,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,2BAA2B,CAAC;gBAC1E,CAAC,CAAC,CAAC;gBACH,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtC,CAAC,CAAC,CAAA;SACH;QACD,IAAM,GAAG,GAAG;YACV,OAAO,EAAE;gBACP,SAAS,EAAE,MAAM;aAClB;SACF,CAAC;QAEF,IAAM,KAAK,GAAG,IAAI,yBAAyB,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;QACrE,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAEH,+BAAC;AAAD,CAAC,AAlDD,CAA8C,WAAW,GAkDxD"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/row-parser.js b/src/app/shared/form/builder/parsers/row-parser.js new file mode 100644 index 0000000000..ff6d6f2035 --- /dev/null +++ b/src/app/shared/form/builder/parsers/row-parser.js @@ -0,0 +1,108 @@ +import { DYNAMIC_FORM_CONTROL_TYPE_ARRAY } from '@ng-dynamic-forms/core'; +import { uniqueId } from 'lodash'; +import { IntegrationSearchOptions } from '../../../../core/integration/models/integration-options.model'; +import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; +import { DynamicRowGroupModel } from '../ds-dynamic-form-ui/models/ds-dynamic-row-group-model'; +import { isEmpty } from '../../../empty.util'; +import { setLayout } from './parser.utils'; +import { ParserFactory } from './parser-factory'; +export var ROW_ID_PREFIX = 'df-row-group-config-'; +var RowParser = /** @class */ (function () { + function RowParser(rowData, scopeUUID, initFormValues, submissionScope, readOnly) { + this.rowData = rowData; + this.scopeUUID = scopeUUID; + this.initFormValues = initFormValues; + this.submissionScope = submissionScope; + this.readOnly = readOnly; + this.authorityOptions = new IntegrationSearchOptions(scopeUUID); + } + RowParser.prototype.parse = function () { + var _this = this; + var fieldModel = null; + var parsedResult = null; + var config = { + id: uniqueId(ROW_ID_PREFIX), + group: [], + }; + var scopedFields = this.filterScopedFields(this.rowData.fields); + var layoutDefaultGridClass = ' col-sm-' + Math.trunc(12 / scopedFields.length); + var layoutClass = ' d-flex flex-column justify-content-start'; + var parserOptions = { + readOnly: this.readOnly, + submissionScope: this.submissionScope, + authorityUuid: this.authorityOptions.uuid + }; + // Iterate over row's fields + scopedFields.forEach(function (fieldData) { + var layoutFieldClass = (fieldData.style || layoutDefaultGridClass) + layoutClass; + var parserCo = ParserFactory.getConstructor(fieldData.input.type); + if (parserCo) { + fieldModel = new parserCo(fieldData, _this.initFormValues, parserOptions).parse(); + } + else { + throw new Error("unknown form control model type \"" + fieldData.input.type + "\" defined for Input field with label \"" + fieldData.label + "\"."); + } + if (fieldModel) { + if (fieldModel.type === DYNAMIC_FORM_CONTROL_TYPE_ARRAY || fieldModel.type === DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP) { + if (_this.rowData.fields.length > 1) { + setLayout(fieldModel, 'grid', 'host', layoutFieldClass); + config.group.push(fieldModel); + // if (isEmpty(parsedResult)) { + // parsedResult = []; + // } + // parsedResult.push(fieldModel); + } + else { + parsedResult = fieldModel; + } + return; + } + else { + if (Array.isArray(fieldModel)) { + fieldModel.forEach(function (model) { + parsedResult = model; + return; + }); + } + else { + setLayout(fieldModel, 'grid', 'host', layoutFieldClass); + config.group.push(fieldModel); + } + } + fieldModel = null; + } + }); + if (config && !isEmpty(config.group)) { + var clsGroup = { + element: { + control: 'form-row', + } + }; + var groupModel = new DynamicRowGroupModel(config, clsGroup); + if (Array.isArray(parsedResult)) { + parsedResult.push(groupModel); + } + else { + parsedResult = groupModel; + } + } + return parsedResult; + }; + RowParser.prototype.checksFieldScope = function (fieldScope) { + return (isEmpty(fieldScope) || isEmpty(this.submissionScope) || fieldScope === this.submissionScope); + }; + RowParser.prototype.filterScopedFields = function (fields) { + var _this = this; + var filteredFields = []; + fields.forEach(function (field) { + // Whether field scope doesn't match the submission scope, skip it + if (_this.checksFieldScope(field.scope)) { + filteredFields.push(field); + } + }); + return filteredFields; + }; + return RowParser; +}()); +export { RowParser }; +//# sourceMappingURL=row-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/row-parser.js.map b/src/app/shared/form/builder/parsers/row-parser.js.map new file mode 100644 index 0000000000..e5b6c30411 --- /dev/null +++ b/src/app/shared/form/builder/parsers/row-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"row-parser.js","sourceRoot":"","sources":["row-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAA+B,MAAM,wBAAwB,CAAC;AACtG,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+DAA+D,CAAC;AACzG,OAAO,EAAE,wCAAwC,EAAE,MAAM,0EAA0E,CAAC;AACpI,OAAO,EAAE,oBAAoB,EAAE,MAAM,yDAAyD,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI3C,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pC,IAAM,QAAQ,GAAG;gBACf,OAAO,EAAE;oBACP,OAAO,EAAE,UAAU;iBACpB;aACF,CAAC;YACF,IAAM,UAAU,GAAG,IAAI,oBAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC9D,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;gBAC/B,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;aAC9B;iBAAM;gBACL,YAAY,GAAG,UAAU,CAAC;aAC3B;SACF;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,oCAAgB,GAAhB,UAAiB,UAAU;QACzB,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,UAAU,KAAK,IAAI,CAAC,eAAe,CAAC,CAAC;IACvG,CAAC;IAED,sCAAkB,GAAlB,UAAmB,MAAwB;QAA3C,iBASC;QARC,IAAM,cAAc,GAAqB,EAAE,CAAC;QAC5C,MAAM,CAAC,OAAO,CAAC,UAAC,KAAqB;YACnC,kEAAkE;YAClE,IAAI,KAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACtC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAC5B;QACH,CAAC,CAAC,CAAC;QACH,OAAO,cAAc,CAAC;IACxB,CAAC;IACH,gBAAC;AAAD,CAAC,AAnGD,IAmGC"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/series-field-parser.js b/src/app/shared/form/builder/parsers/series-field-parser.js new file mode 100644 index 0000000000..4a3bf9c635 --- /dev/null +++ b/src/app/shared/form/builder/parsers/series-field-parser.js @@ -0,0 +1,15 @@ +import * as tslib_1 from "tslib"; +import { ConcatFieldParser } from './concat-field-parser'; +var SeriesFieldParser = /** @class */ (function (_super) { + tslib_1.__extends(SeriesFieldParser, _super); + function SeriesFieldParser(configData, initFormValues, parserOptions) { + var _this = _super.call(this, configData, initFormValues, parserOptions, ';') || this; + _this.configData = configData; + _this.initFormValues = initFormValues; + _this.parserOptions = parserOptions; + return _this; + } + return SeriesFieldParser; +}(ConcatFieldParser)); +export { SeriesFieldParser }; +//# sourceMappingURL=series-field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/series-field-parser.js.map b/src/app/shared/form/builder/parsers/series-field-parser.js.map new file mode 100644 index 0000000000..16338e0c57 --- /dev/null +++ b/src/app/shared/form/builder/parsers/series-field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"series-field-parser.js","sourceRoot":"","sources":["series-field-parser.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D;IAAuC,6CAAiB;IAEtD,2BAAsB,UAA0B,EAAY,cAAc,EAAY,aAA4B;QAAlH,YACE,kBAAM,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,CAAC,SACtD;QAFqB,gBAAU,GAAV,UAAU,CAAgB;QAAY,oBAAc,GAAd,cAAc,CAAA;QAAY,mBAAa,GAAb,aAAa,CAAe;;IAElH,CAAC;IACH,wBAAC;AAAD,CAAC,AALD,CAAuC,iBAAiB,GAKvD"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/tag-field-parser.js b/src/app/shared/form/builder/parsers/tag-field-parser.js new file mode 100644 index 0000000000..bb07e41a81 --- /dev/null +++ b/src/app/shared/form/builder/parsers/tag-field-parser.js @@ -0,0 +1,22 @@ +import * as tslib_1 from "tslib"; +import { FieldParser } from './field-parser'; +import { DynamicTagModel } from '../ds-dynamic-form-ui/models/tag/dynamic-tag.model'; +var TagFieldParser = /** @class */ (function (_super) { + tslib_1.__extends(TagFieldParser, _super); + function TagFieldParser() { + return _super !== null && _super.apply(this, arguments) || this; + } + TagFieldParser.prototype.modelFactory = function (fieldValue, label) { + var tagModelConfig = this.initModel(null, label); + if (this.configData.selectableMetadata[0].authority + && this.configData.selectableMetadata[0].authority.length > 0) { + this.setAuthorityOptions(tagModelConfig, this.parserOptions.authorityUuid); + } + this.setValues(tagModelConfig, fieldValue, null, true); + var tagModel = new DynamicTagModel(tagModelConfig); + return tagModel; + }; + return TagFieldParser; +}(FieldParser)); +export { TagFieldParser }; +//# sourceMappingURL=tag-field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/tag-field-parser.js.map b/src/app/shared/form/builder/parsers/tag-field-parser.js.map new file mode 100644 index 0000000000..7aaf79cf79 --- /dev/null +++ b/src/app/shared/form/builder/parsers/tag-field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tag-field-parser.js","sourceRoot":"","sources":["tag-field-parser.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAyB,MAAM,oDAAoD,CAAC;AAE5G;IAAoC,0CAAW;IAA/C;;IAgBA,CAAC;IAdQ,qCAAY,GAAnB,UAAoB,UAA+C,EAAE,KAAe;QAClF,IAAM,cAAc,GAA0B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC1E,IAAI,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;eAC9C,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YAC/D,IAAI,CAAC,mBAAmB,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;SAC5E;QAED,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEvD,IAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,cAAc,CAAC,CAAC;QAErD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEH,qBAAC;AAAD,CAAC,AAhBD,CAAoC,WAAW,GAgB9C"} \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/textarea-field-parser.js b/src/app/shared/form/builder/parsers/textarea-field-parser.js new file mode 100644 index 0000000000..efd8e5a56a --- /dev/null +++ b/src/app/shared/form/builder/parsers/textarea-field-parser.js @@ -0,0 +1,25 @@ +import * as tslib_1 from "tslib"; +import { FieldParser } from './field-parser'; +import { DsDynamicTextAreaModel } from '../ds-dynamic-form-ui/models/ds-dynamic-textarea.model'; +var TextareaFieldParser = /** @class */ (function (_super) { + tslib_1.__extends(TextareaFieldParser, _super); + function TextareaFieldParser() { + return _super !== null && _super.apply(this, arguments) || this; + } + TextareaFieldParser.prototype.modelFactory = function (fieldValue, label) { + var textAreaModelConfig = this.initModel(null, label); + var layout; + layout = { + element: { + label: 'col-form-label' + } + }; + textAreaModelConfig.rows = 10; + this.setValues(textAreaModelConfig, fieldValue); + var textAreaModel = new DsDynamicTextAreaModel(textAreaModelConfig, layout); + return textAreaModel; + }; + return TextareaFieldParser; +}(FieldParser)); +export { TextareaFieldParser }; +//# sourceMappingURL=textarea-field-parser.js.map \ No newline at end of file diff --git a/src/app/shared/form/builder/parsers/textarea-field-parser.js.map b/src/app/shared/form/builder/parsers/textarea-field-parser.js.map new file mode 100644 index 0000000000..b99c32763f --- /dev/null +++ b/src/app/shared/form/builder/parsers/textarea-field-parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"textarea-field-parser.js","sourceRoot":"","sources":["textarea-field-parser.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EACL,sBAAsB,EAEvB,MAAM,wDAAwD,CAAC;AAEhE;IAAyC,+CAAW;IAApD;;IAmBA,CAAC;IAjBQ,0CAAY,GAAnB,UAAoB,UAA+C,EAAE,KAAe;QAClF,IAAM,mBAAmB,GAAiC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAEtF,IAAI,MAAgC,CAAC;QAErC,MAAM,GAAG;YACP,OAAO,EAAE;gBACP,KAAK,EAAE,gBAAgB;aACxB;SACF,CAAC;QAEF,mBAAmB,CAAC,IAAI,GAAG,EAAE,CAAC;QAC9B,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;QAChD,IAAM,aAAa,GAAG,IAAI,sBAAsB,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;QAE9E,OAAO,aAAa,CAAC;IACvB,CAAC;IACH,0BAAC;AAAD,CAAC,AAnBD,CAAyC,WAAW,GAmBnD"} \ No newline at end of file diff --git a/src/app/shared/form/form.actions.js b/src/app/shared/form/form.actions.js new file mode 100644 index 0000000000..be2fd2eab1 --- /dev/null +++ b/src/app/shared/form/form.actions.js @@ -0,0 +1,108 @@ +import { type } from '../ngrx/type'; +/** + * For each action type in an action group, make a simple + * enum object for all of this group's action types. + * + * The 'type' utility function coerces strings into string + * literal types and runs a simple check to guarantee all + * action types in the application are unique. + */ +export var FormActionTypes = { + FORM_INIT: type('dspace/form/FORM_INIT'), + FORM_CHANGE: type('dspace/form/FORM_CHANGE'), + FORM_REMOVE: type('dspace/form/FORM_REMOVE'), + FORM_STATUS_CHANGE: type('dspace/form/FORM_STATUS_CHANGE'), + FORM_ADD_ERROR: type('dspace/form/FORM_ADD_ERROR'), + FORM_REMOVE_ERROR: type('dspace/form/FORM_REMOVE_ERROR'), + FORM_CLEAR_ERRORS: type('dspace/form/FORM_CLEAR_ERRORS'), +}; +/* tslint:disable:max-classes-per-file */ +var FormInitAction = /** @class */ (function () { + /** + * Create a new FormInitAction + * + * @param formId + * the Form's ID + * @param formData + * the FormGroup Object + * @param valid + * the Form validation status + */ + function FormInitAction(formId, formData, valid) { + this.type = FormActionTypes.FORM_INIT; + this.payload = { formId: formId, formData: formData, valid: valid }; + } + return FormInitAction; +}()); +export { FormInitAction }; +var FormChangeAction = /** @class */ (function () { + /** + * Create a new FormInitAction + * + * @param formId + * the Form's ID + * @param formData + * the FormGroup Object + */ + function FormChangeAction(formId, formData) { + this.type = FormActionTypes.FORM_CHANGE; + this.payload = { formId: formId, formData: formData }; + } + return FormChangeAction; +}()); +export { FormChangeAction }; +var FormRemoveAction = /** @class */ (function () { + /** + * Create a new FormRemoveAction + * + * @param formId + * the Form's ID + */ + function FormRemoveAction(formId) { + this.type = FormActionTypes.FORM_REMOVE; + this.payload = { formId: formId }; + } + return FormRemoveAction; +}()); +export { FormRemoveAction }; +var FormStatusChangeAction = /** @class */ (function () { + /** + * Create a new FormInitAction + * + * @param formId + * the Form's ID + * @param valid + * the Form validation status + */ + function FormStatusChangeAction(formId, valid) { + this.type = FormActionTypes.FORM_STATUS_CHANGE; + this.payload = { formId: formId, valid: valid }; + } + return FormStatusChangeAction; +}()); +export { FormStatusChangeAction }; +var FormAddError = /** @class */ (function () { + function FormAddError(formId, fieldId, fieldIndex, errorMessage) { + this.type = FormActionTypes.FORM_ADD_ERROR; + this.payload = { formId: formId, fieldId: fieldId, fieldIndex: fieldIndex, errorMessage: errorMessage }; + } + return FormAddError; +}()); +export { FormAddError }; +var FormRemoveErrorAction = /** @class */ (function () { + function FormRemoveErrorAction(formId, fieldId, fieldIndex) { + this.type = FormActionTypes.FORM_REMOVE_ERROR; + this.payload = { formId: formId, fieldId: fieldId, fieldIndex: fieldIndex }; + } + return FormRemoveErrorAction; +}()); +export { FormRemoveErrorAction }; +var FormClearErrorsAction = /** @class */ (function () { + function FormClearErrorsAction(formId) { + this.type = FormActionTypes.FORM_CLEAR_ERRORS; + this.payload = { formId: formId }; + } + return FormClearErrorsAction; +}()); +export { FormClearErrorsAction }; +//# sourceMappingURL=form.actions.js.map \ No newline at end of file diff --git a/src/app/shared/form/form.actions.js.map b/src/app/shared/form/form.actions.js.map new file mode 100644 index 0000000000..d5d03508f6 --- /dev/null +++ b/src/app/shared/form/form.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"form.actions.js","sourceRoot":"","sources":["form.actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;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M,QAAA,EAAE,KAAK,OAAA,EAAC,CAAC;IACjC,CAAC;IACH,6BAAC;AAAD,CAAC,AAlBD,IAkBC;;AAED;IASE,sBAAY,MAAc,EAAE,OAAe,EAAE,UAAkB,EAAE,YAAoB;QARrF,SAAI,GAAG,eAAe,CAAC,cAAc,CAAC;QASpC,IAAI,CAAC,OAAO,GAAG,EAAC,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,UAAU,YAAA,EAAE,YAAY,cAAA,EAAC,CAAC;IAC7D,CAAC;IACH,mBAAC;AAAD,CAAC,AAZD,IAYC;;AAED;IAQE,+BAAY,MAAc,EAAE,OAAe,EAAE,UAAkB;QAP/D,SAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC;QAQvC,IAAI,CAAC,OAAO,GAAG,EAAC,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,UAAU,YAAA,EAAC,CAAC;IAC/C,CAAC;IACH,4BAAC;AAAD,CAAC,AAXD,IAWC;;AAED;IAME,+BAAY,MAAc;QAL1B,SAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC;QAMvC,IAAI,CAAC,OAAO,GAAG,EAAC,MAAM,QAAA,EAAC,CAAC;IAC1B,CAAC;IACH,4BAAC;AAAD,CAAC,AATD,IASC"} \ No newline at end of file diff --git a/src/app/shared/form/form.component.js b/src/app/shared/form/form.component.js new file mode 100644 index 0000000000..3e0017be2a --- /dev/null +++ b/src/app/shared/form/form.component.js @@ -0,0 +1,320 @@ +import * as tslib_1 from "tslib"; +import { distinctUntilChanged, filter, map } from 'rxjs/operators'; +import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { findIndex } from 'lodash'; +import { FormBuilderService } from './builder/form-builder.service'; +import { hasValue, isNotEmpty, isNotNull, isNull } from '../empty.util'; +import { FormService } from './form.service'; +/** + * The default form component. + */ +var FormComponent = /** @class */ (function () { + function FormComponent(formService, changeDetectorRef, formBuilderService) { + this.formService = formService; + this.changeDetectorRef = changeDetectorRef; + this.formBuilderService = formBuilderService; + this.formErrors = []; + /** + * A boolean that indicate if to display form's submit and cancel buttons + */ + this.displaySubmit = true; + /** + * A boolean that indicate if to emit a form change event + */ + this.emitChange = true; + this.formLayout = null; + /* tslint:disable:no-output-rename */ + this.blur = new EventEmitter(); + this.change = new EventEmitter(); + this.focus = new EventEmitter(); + /* tslint:enable:no-output-rename */ + this.addArrayItem = new EventEmitter(); + this.removeArrayItem = new EventEmitter(); + /** + * An event fired when form is valid and submitted . + * Event's payload equals to the form content. + */ + this.cancel = new EventEmitter(); + /** + * An event fired when form is valid and submitted . + * Event's payload equals to the form content. + */ + this.submitForm = new EventEmitter(); + /** + * An object of FormGroup type + */ + // public formGroup: FormGroup; + /** + * Array to track all subscriptions and unsubscribe them onDestroy + * @type {Array} + */ + this.subs = []; + } + /** + * Method provided by Angular. Invoked after the view has been initialized. + */ + /*ngAfterViewChecked(): void { + this.subs.push(this.formGroup.valueChanges + .filter((formGroup) => this.formGroup.dirty) + .subscribe(() => { + // Dispatch a FormChangeAction if the user has changed the value in the UI + this.store.dispatch(new FormChangeAction(this.formId, this.formGroup.value)); + this.formGroup.markAsPristine(); + })); + }*/ + FormComponent.prototype.getFormGroup = function () { + if (!!this.parentFormModel) { + return this.formGroup.parent; + } + return this.formGroup; + }; + FormComponent.prototype.getFormGroupValue = function () { + return this.getFormGroup().value; + }; + FormComponent.prototype.getFormGroupValidStatus = function () { + return this.getFormGroup().valid; + }; + /** + * Method provided by Angular. Invoked after the constructor + */ + FormComponent.prototype.ngOnInit = function () { + var _this = this; + if (!this.formGroup) { + this.formGroup = this.formBuilderService.createFormGroup(this.formModel); + } + else { + this.formModel.forEach(function (model) { + if (_this.parentFormModel) { + _this.formBuilderService.addFormGroupControl(_this.formGroup, _this.parentFormModel, model); + } + }); + } + this.formService.initForm(this.formId, this.formModel, this.getFormGroupValidStatus()); + // TODO: take a look to the following method: + // this.keepSync(); + this.formValid = this.getFormGroupValidStatus(); + this.subs.push(this.formGroup.statusChanges.pipe(filter(function (currentStatus) { return _this.formValid !== _this.getFormGroupValidStatus(); })) + .subscribe(function (currentStatus) { + _this.formService.setStatusChanged(_this.formId, _this.getFormGroupValidStatus()); + _this.formValid = _this.getFormGroupValidStatus(); + })); + this.subs.push(this.formService.getForm(this.formId).pipe(filter(function (formState) { return !!formState && (isNotEmpty(formState.errors) || isNotEmpty(_this.formErrors)); }), map(function (formState) { return formState.errors; }), distinctUntilChanged()) + // .delay(100) // this terrible delay is here to prevent the detection change error + .subscribe(function (errors) { + var _a = _this, formGroup = _a.formGroup, formModel = _a.formModel; + errors + .filter(function (error) { return findIndex(_this.formErrors, { + fieldId: error.fieldId, + fieldIndex: error.fieldIndex + }) === -1; }) + .forEach(function (error) { + var fieldId = error.fieldId; + var fieldIndex = error.fieldIndex; + var field; + if (!!_this.parentFormModel) { + field = _this.formBuilderService.getFormControlById(fieldId, formGroup.parent, formModel, fieldIndex); + } + else { + field = _this.formBuilderService.getFormControlById(fieldId, formGroup, formModel, fieldIndex); + } + if (field) { + var model = _this.formBuilderService.findById(fieldId, formModel); + _this.formService.addErrorToField(field, model, error.message); + // this.formService.validateAllFormFields(formGroup); + _this.changeDetectorRef.detectChanges(); + } + }); + _this.formErrors + .filter(function (error) { return findIndex(errors, { + fieldId: error.fieldId, + fieldIndex: error.fieldIndex + }) === -1; }) + .forEach(function (error) { + var fieldId = error.fieldId; + var fieldIndex = error.fieldIndex; + var field; + if (!!_this.parentFormModel) { + field = _this.formBuilderService.getFormControlById(fieldId, formGroup.parent, formModel, fieldIndex); + } + else { + field = _this.formBuilderService.getFormControlById(fieldId, formGroup, formModel, fieldIndex); + } + if (field) { + var model = _this.formBuilderService.findById(fieldId, formModel); + _this.formService.removeErrorFromField(field, model, error.message); + } + }); + _this.formErrors = errors; + _this.changeDetectorRef.detectChanges(); + })); + }; + /** + * Method provided by Angular. Invoked when the instance is destroyed + */ + FormComponent.prototype.ngOnDestroy = function () { + this.subs + .filter(function (sub) { return hasValue(sub); }) + .forEach(function (sub) { return sub.unsubscribe(); }); + this.formService.removeForm(this.formId); + }; + /** + * Method to check if the form status is valid or not + */ + FormComponent.prototype.isValid = function () { + return this.formService.isValid(this.formId); + }; + /** + * Method to keep synchronized form controls values with form state + */ + FormComponent.prototype.keepSync = function () { + var _this = this; + this.subs.push(this.formService.getFormData(this.formId) + .subscribe(function (stateFormData) { + if (!Object.is(stateFormData, _this.formGroup.value) && _this.formGroup) { + _this.formGroup.setValue(stateFormData); + } + })); + }; + FormComponent.prototype.onBlur = function (event) { + this.blur.emit(event); + }; + FormComponent.prototype.onFocus = function (event) { + this.focus.emit(event); + }; + FormComponent.prototype.onChange = function (event) { + this.formService.changeForm(this.formId, this.formModel); + this.formGroup.markAsPristine(); + if (this.emitChange) { + this.change.emit(event); + } + var control = event.control; + var fieldIndex = (event.context && event.context.index) ? event.context.index : 0; + if (control.valid) { + this.formService.removeError(this.formId, event.model.id, fieldIndex); + } + }; + /** + * Method called on submit. + * Emit a new submit Event whether the form is valid, mark fields with error otherwise + */ + FormComponent.prototype.onSubmit = function () { + if (this.getFormGroupValidStatus()) { + this.submitForm.emit(this.formService.getFormData(this.formId)); + } + else { + this.formService.validateAllFormFields(this.formGroup); + } + }; + /** + * Method to reset form fields + */ + FormComponent.prototype.reset = function () { + this.formGroup.reset(); + this.cancel.emit(); + }; + FormComponent.prototype.isItemReadOnly = function (arrayContext, index) { + var context = arrayContext.groups[index]; + var model = context.group[0]; + return model.readOnly; + }; + FormComponent.prototype.removeItem = function ($event, arrayContext, index) { + var formArrayControl = this.formGroup.get(this.formBuilderService.getPath(arrayContext)); + this.removeArrayItem.emit(this.getEvent($event, arrayContext, index, 'remove')); + this.formBuilderService.removeFormArrayGroup(index, formArrayControl, arrayContext); + this.formService.changeForm(this.formId, this.formModel); + }; + FormComponent.prototype.insertItem = function ($event, arrayContext, index) { + var formArrayControl = this.formGroup.get(this.formBuilderService.getPath(arrayContext)); + this.formBuilderService.insertFormArrayGroup(index, formArrayControl, arrayContext); + this.addArrayItem.emit(this.getEvent($event, arrayContext, index, 'add')); + this.formService.changeForm(this.formId, this.formModel); + }; + FormComponent.prototype.getEvent = function ($event, arrayContext, index, type) { + var context = arrayContext.groups[index]; + var itemGroupModel = context.context; + var group = this.formGroup.get(itemGroupModel.id); + if (isNull(group)) { + for (var _i = 0, _a = Object.keys(this.formGroup.controls); _i < _a.length; _i++) { + var key = _a[_i]; + group = this.formGroup.controls[key].get(itemGroupModel.id); + if (isNotNull(group)) { + break; + } + } + } + var model = context.group[0]; + var control = group.controls[index]; + return { $event: $event, context: context, control: control, group: group, model: model, type: type }; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], FormComponent.prototype, "displaySubmit", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], FormComponent.prototype, "emitChange", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], FormComponent.prototype, "formId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], FormComponent.prototype, "formModel", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], FormComponent.prototype, "parentFormModel", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", FormGroup) + ], FormComponent.prototype, "formGroup", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], FormComponent.prototype, "formLayout", void 0); + tslib_1.__decorate([ + Output('dfBlur'), + tslib_1.__metadata("design:type", EventEmitter) + ], FormComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output('dfChange'), + tslib_1.__metadata("design:type", EventEmitter) + ], FormComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output('dfFocus'), + tslib_1.__metadata("design:type", EventEmitter) + ], FormComponent.prototype, "focus", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], FormComponent.prototype, "addArrayItem", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], FormComponent.prototype, "removeArrayItem", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], FormComponent.prototype, "cancel", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], FormComponent.prototype, "submitForm", void 0); + FormComponent = tslib_1.__decorate([ + Component({ + exportAs: 'formComponent', + selector: 'ds-form', + styleUrls: ['form.component.scss'], + templateUrl: 'form.component.html' + }), + tslib_1.__metadata("design:paramtypes", [FormService, + ChangeDetectorRef, + FormBuilderService]) + ], FormComponent); + return FormComponent; +}()); +export { FormComponent }; +//# sourceMappingURL=form.component.js.map \ No newline at end of file diff --git a/src/app/shared/form/form.component.js.map b/src/app/shared/form/form.component.js.map new file mode 100644 index 0000000000..1731cf57b7 --- /dev/null +++ b/src/app/shared/form/form.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"form.component.js","sourceRoot":"","sources":["form.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,KAAK,EAGL,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAA2C,SAAS,EAAE,MAAM,gBAAgB,CAAC;AASpF,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;GAEG;AAOH;IA2DE,uBAAoB,WAAwB,EACtB,iBAAoC,EACtC,kBAAsC;QAFtC,gBAAW,GAAX,WAAW,CAAa;QACtB,sBAAiB,GAAjB,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SD,IAiSC;SAjSY,aAAa"} \ No newline at end of file diff --git a/src/app/shared/form/form.effects.js b/src/app/shared/form/form.effects.js new file mode 100644 index 0000000000..a6451788b8 --- /dev/null +++ b/src/app/shared/form/form.effects.js @@ -0,0 +1,15 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { Actions } from '@ngrx/effects'; +var FormEffects = /** @class */ (function () { + function FormEffects(actions$) { + this.actions$ = actions$; + } + FormEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Actions]) + ], FormEffects); + return FormEffects; +}()); +export { FormEffects }; +//# sourceMappingURL=form.effects.js.map \ No newline at end of file diff --git a/src/app/shared/form/form.effects.js.map b/src/app/shared/form/form.effects.js.map new file mode 100644 index 0000000000..7836d15c6b --- /dev/null +++ b/src/app/shared/form/form.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"form.effects.js","sourceRoot":"","sources":["form.effects.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAU,MAAM,eAAe,CAAC;AAGhD;IAEE,qBAAoB,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;IAErC,CAAC;IAJU,WAAW;QADvB,UAAU,EAAE;iDAGmB,OAAO;OAF1B,WAAW,CAMvB;IAAD,kBAAC;CAAA,AAND,IAMC;SANY,WAAW"} \ No newline at end of file diff --git a/src/app/shared/form/form.reducer.js b/src/app/shared/form/form.reducer.js new file mode 100644 index 0000000000..2fd09dbb3e --- /dev/null +++ b/src/app/shared/form/form.reducer.js @@ -0,0 +1,181 @@ +import { FormActionTypes } from './form.actions'; +import { hasValue } from '../empty.util'; +import { isEqual, uniqWith } from 'lodash'; +var initialState = Object.create(null); +export function formReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case FormActionTypes.FORM_INIT: { + return initForm(state, action); + } + case FormActionTypes.FORM_CHANGE: { + return changeDataForm(state, action); + } + case FormActionTypes.FORM_REMOVE: { + return removeForm(state, action); + } + case FormActionTypes.FORM_STATUS_CHANGE: { + return changeStatusForm(state, action); + } + case FormActionTypes.FORM_ADD_ERROR: { + return addFormErrors(state, action); + } + case FormActionTypes.FORM_REMOVE_ERROR: { + return removeFormError(state, action); + } + case FormActionTypes.FORM_CLEAR_ERRORS: { + return clearsFormErrors(state, action); + } + default: { + return state; + } + } +} +function addFormErrors(state, action) { + var _a; + var formId = action.payload.formId; + if (hasValue(state[formId])) { + var error = { + fieldId: action.payload.fieldId, + fieldIndex: action.payload.fieldIndex, + message: action.payload.errorMessage + }; + return Object.assign({}, state, (_a = {}, + _a[formId] = { + data: state[formId].data, + valid: state[formId].valid, + errors: state[formId].errors ? uniqWith(state[formId].errors.concat(error), isEqual) : [].concat(error), + }, + _a)); + } + else { + return state; + } +} +function removeFormError(state, action) { + var formId = action.payload.formId; + var fieldId = action.payload.fieldId; + var fieldIndex = action.payload.fieldIndex; + if (hasValue(state[formId])) { + var errors = state[formId].errors.filter(function (error) { return error.fieldId !== fieldId || error.fieldIndex !== fieldIndex; }); + var newState = Object.assign({}, state); + newState[formId] = Object.assign({}, state[formId], { errors: errors }); + return newState; + } + else { + return state; + } +} +function clearsFormErrors(state, action) { + var formId = action.payload.formId; + if (hasValue(state[formId])) { + var errors = []; + var newState = Object.assign({}, state); + newState[formId] = Object.assign({}, state[formId], { errors: errors }); + return newState; + } + else { + return state; + } +} +/** + * Init form state. + * + * @param state + * the current state + * @param action + * an FormInitAction + * @return FormState + * the new state, with the form initialized. + */ +function initForm(state, action) { + var _a; + var formState = { + data: action.payload.formData, + valid: action.payload.valid, + errors: [] + }; + if (!hasValue(state[action.payload.formId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.formId] = formState, + _a)); + } + else { + var newState = Object.assign({}, state); + newState[action.payload.formId] = Object.assign({}, newState[action.payload.formId], formState); + return newState; + } +} +/** + * Set form data. + * + * @param state + * the current state + * @param action + * an FormChangeAction + * @return FormState + * the new state, with the data changed. + */ +function changeDataForm(state, action) { + if (hasValue(state[action.payload.formId])) { + var newState = Object.assign({}, state); + newState[action.payload.formId] = Object.assign({}, newState[action.payload.formId], { + data: action.payload.formData, + valid: state[action.payload.formId].valid + }); + return newState; + } + else { + return state; + } +} +/** + * Set form status. + * + * @param state + * the current state + * @param action + * an FormStatusChangeAction + * @return FormState + * the new state, with the status changed. + */ +function changeStatusForm(state, action) { + var _a; + if (!hasValue(state[action.payload.formId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.formId] = { + data: state[action.payload.formId].data, + valid: action.payload.valid + }, + _a)); + } + else { + var newState = Object.assign({}, state); + newState[action.payload.formId] = Object.assign({}, newState[action.payload.formId], { + data: state[action.payload.formId].data, + valid: action.payload.valid + }); + return newState; + } +} +/** + * Remove form state. + * + * @param state + * the current state + * @param action + * an FormRemoveAction + * @return FormState + * the new state, with the form initialized. + */ +function removeForm(state, action) { + if (hasValue(state[action.payload.formId])) { + var newState = Object.assign({}, state); + delete newState[action.payload.formId]; + return newState; + } + else { + return state; + } +} +//# sourceMappingURL=form.reducer.js.map \ No newline at end of file diff --git a/src/app/shared/form/form.reducer.js.map b/src/app/shared/form/form.reducer.js.map new file mode 100644 index 0000000000..39fc68d8d2 --- /dev/null +++ b/src/app/shared/form/form.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"form.reducer.js","sourceRoot":"","sources":["form.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAOhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAkB3C,IAAM,YAAY,GAAc,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAEpD,MAAM,sBAAsB,KAAoB,EAAE,MAAkB;IAAxC,sBAAA,EAAA,oBAAoB;IAC9C,QAAQ,MAAM,CAAC,IAAI,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AC,IAAI;YACvC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK;SAC5B,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;KACjB;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,oBAAoB,KAAgB,EAAE,MAAwB;IAC5D,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE;QAC1C,IAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACvC,OAAO,QAAQ,CAAC;KACjB;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC"} \ No newline at end of file diff --git a/src/app/shared/form/form.service.js b/src/app/shared/form/form.service.js new file mode 100644 index 0000000000..79238ce7fd --- /dev/null +++ b/src/app/shared/form/form.service.js @@ -0,0 +1,135 @@ +import * as tslib_1 from "tslib"; +import { map, distinctUntilChanged, filter } from 'rxjs/operators'; +import { Inject, Injectable } from '@angular/core'; +import { FormArray, FormControl, FormGroup } from '@angular/forms'; +import { select, Store } from '@ngrx/store'; +import { formObjectFromIdSelector } from './selectors'; +import { FormBuilderService } from './builder/form-builder.service'; +import { isEmpty, isNotUndefined } from '../empty.util'; +import { uniqueId } from 'lodash'; +import { FormChangeAction, FormInitAction, FormRemoveAction, FormRemoveErrorAction, FormStatusChangeAction } from './form.actions'; +import { GLOBAL_CONFIG } from '../../../config'; +var FormService = /** @class */ (function () { + function FormService(config, formBuilderService, store) { + this.config = config; + this.formBuilderService = formBuilderService; + this.store = store; + } + /** + * Method to retrieve form's status from state + */ + FormService.prototype.isValid = function (formId) { + return this.store.pipe(select(formObjectFromIdSelector(formId)), filter(function (state) { return isNotUndefined(state); }), map(function (state) { return state.valid; }), distinctUntilChanged()); + }; + /** + * Method to retrieve form's data from state + */ + FormService.prototype.getFormData = function (formId) { + return this.store.pipe(select(formObjectFromIdSelector(formId)), filter(function (state) { return isNotUndefined(state); }), map(function (state) { return state.data; }), distinctUntilChanged()); + }; + /** + * Method to retrieve form's errors from state + */ + FormService.prototype.getFormErrors = function (formId) { + return this.store.pipe(select(formObjectFromIdSelector(formId)), filter(function (state) { return isNotUndefined(state); }), map(function (state) { return state.errors; }), distinctUntilChanged()); + }; + /** + * Method to retrieve form's data from state + */ + FormService.prototype.isFormInitialized = function (formId) { + return this.store.pipe(select(formObjectFromIdSelector(formId)), distinctUntilChanged(), map(function (state) { return isNotUndefined(state); })); + }; + FormService.prototype.getUniqueId = function (formId) { + return uniqueId() + '_' + formId; + }; + /** + * Method to validate form's fields + */ + FormService.prototype.validateAllFormFields = function (formGroup) { + var _this = this; + Object.keys(formGroup.controls).forEach(function (field) { + var control = formGroup.get(field); + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + control.markAsDirty({ onlySelf: true }); + } + else if (control instanceof FormGroup || control instanceof FormArray) { + _this.validateAllFormFields(control); + } + }); + }; + FormService.prototype.addErrorToField = function (field, model, message) { + var error = {}; // create the error object + var errorKey = this.getValidatorNameFromMap(message); + var errorMsg = message; + // if form control model has no errorMessages object, create it + if (!model.errorMessages) { + model.errorMessages = {}; + } + // check if error code is already present in the set of model's validators + if (isEmpty(model.errorMessages[errorKey])) { + // put the error message in the form control model + model.errorMessages[errorKey] = message; + } + else { + // Use correct error messages from the model + errorMsg = model.errorMessages[errorKey]; + } + if (!field.hasError(errorKey)) { + error[errorKey] = true; + // add the error in the form control + field.setErrors(error); + } + field.markAsTouched(); + }; + FormService.prototype.removeErrorFromField = function (field, model, messageKey) { + var error = {}; + var errorKey = this.getValidatorNameFromMap(messageKey); + if (field.hasError(errorKey)) { + error[errorKey] = null; + field.setErrors(error); + } + field.markAsUntouched(); + }; + FormService.prototype.resetForm = function (formGroup, groupModel, formId) { + this.formBuilderService.clearAllModelsValue(groupModel); + formGroup.reset(); + this.store.dispatch(new FormChangeAction(formId, formGroup.value)); + }; + FormService.prototype.getValidatorNameFromMap = function (validator) { + if (validator.includes('.')) { + var splitArray = validator.split('.'); + if (splitArray && splitArray.length > 0) { + validator = this.getValidatorNameFromMap(splitArray[splitArray.length - 1]); + } + } + return (this.config.form.validatorMap.hasOwnProperty(validator)) ? this.config.form.validatorMap[validator] : validator; + }; + FormService.prototype.initForm = function (formId, model, valid) { + this.store.dispatch(new FormInitAction(formId, this.formBuilderService.getValueFromModel(model), valid)); + }; + FormService.prototype.setStatusChanged = function (formId, valid) { + this.store.dispatch(new FormStatusChangeAction(formId, valid)); + }; + FormService.prototype.getForm = function (formId) { + return this.store.pipe(select(formObjectFromIdSelector(formId))); + }; + FormService.prototype.removeForm = function (formId) { + this.store.dispatch(new FormRemoveAction(formId)); + }; + FormService.prototype.changeForm = function (formId, model) { + this.store.dispatch(new FormChangeAction(formId, this.formBuilderService.getValueFromModel(model))); + }; + FormService.prototype.removeError = function (formId, eventModelId, fieldIndex) { + this.store.dispatch(new FormRemoveErrorAction(formId, eventModelId, fieldIndex)); + }; + FormService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, FormBuilderService, + Store]) + ], FormService); + return FormService; +}()); +export { FormService }; +//# sourceMappingURL=form.service.js.map \ No newline at end of file diff --git a/src/app/shared/form/form.service.js.map b/src/app/shared/form/form.service.js.map new file mode 100644 index 0000000000..dac99427c3 --- /dev/null +++ b/src/app/shared/form/form.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"form.service.js","sourceRoot":"","sources":["form.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAmB,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEpF,OA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B,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;IAChE,CAAC;IAEM,6BAAO,GAAd,UAAe,MAAc;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;IAEM,gCAAU,GAAjB,UAAkB,MAAc;QAC9B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IACpD,CAAC;IAEM,gCAAU,GAAjB,UAAkB,MAAc,EAAE,KAAgC;QAChE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtG,CAAC;IAEM,iCAAW,GAAlB,UAAmB,MAAc,EAAE,YAAoB,EAAE,UAAkB;QACzE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,qBAAqB,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;IACnF,CAAC;IAxJU,WAAW;QADvB,UAAU,EAAE;QAIR,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACM,kBAAkB;YAC/B,KAAK;OALX,WAAW,CAyJvB;IAAD,kBAAC;CAAA,AAzJD,IAyJC;SAzJY,WAAW"} \ No newline at end of file diff --git a/src/app/shared/form/selectors.js b/src/app/shared/form/selectors.js new file mode 100644 index 0000000000..e883320ea8 --- /dev/null +++ b/src/app/shared/form/selectors.js @@ -0,0 +1,6 @@ +import { createSelector } from '@ngrx/store'; +export var formStateSelector = function (state) { return state.forms; }; +export function formObjectFromIdSelector(formId) { + return createSelector(formStateSelector, function (forms) { return forms[formId]; }); +} +//# sourceMappingURL=selectors.js.map \ No newline at end of file diff --git a/src/app/shared/form/selectors.js.map b/src/app/shared/form/selectors.js.map new file mode 100644 index 0000000000..94208b4c4c --- /dev/null +++ b/src/app/shared/form/selectors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"selectors.js","sourceRoot":"","sources":["selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAoB,MAAM,aAAa,CAAC;AAK/D,MAAM,CAAC,IAAM,iBAAiB,GAAG,UAAC,KAAe,IAAK,OAAA,KAAK,CAAC,KAAK,EAAX,CAAW,CAAC;AAElE,MAAM,mCAAmC,MAAc;IACrD,OAAO,cAAc,CAAC,iBAAiB,EAAE,UAAC,KAAgB,IAAK,OAAA,KAAK,CAAC,MAAM,CAAC,EAAb,CAAa,CAAC,CAAC;AAChF,CAAC"} \ No newline at end of file diff --git a/src/app/shared/history/history.actions.js b/src/app/shared/history/history.actions.js new file mode 100644 index 0000000000..7458ae1f94 --- /dev/null +++ b/src/app/shared/history/history.actions.js @@ -0,0 +1,15 @@ +import { type } from '../ngrx/type'; +export var HistoryActionTypes = { + ADD_TO_HISTORY: type('dspace/history/ADD_TO_HISTORY'), + GET_HISTORY: type('dspace/history/GET_HISTORY') +}; +/* tslint:disable:max-classes-per-file */ +var AddUrlToHistoryAction = /** @class */ (function () { + function AddUrlToHistoryAction(url) { + this.type = HistoryActionTypes.ADD_TO_HISTORY; + this.payload = { url: url }; + } + return AddUrlToHistoryAction; +}()); +export { AddUrlToHistoryAction }; +//# sourceMappingURL=history.actions.js.map \ No newline at end of file diff --git a/src/app/shared/history/history.actions.js.map b/src/app/shared/history/history.actions.js.map new file mode 100644 index 0000000000..14685e8a25 --- /dev/null +++ b/src/app/shared/history/history.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"history.actions.js","sourceRoot":"","sources":["history.actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,MAAM,CAAC,IAAM,kBAAkB,GAAG;IAChC,cAAc,EAAE,IAAI,CAAC,+BAA+B,CAAC;IACrD,WAAW,EAAE,IAAI,CAAC,4BAA4B,CAAC;CAChD,CAAC;AAEF,yCAAyC;AAEzC;IAME,+BAAY,GAAW;QALvB,SAAI,GAAG,kBAAkB,CAAC,cAAc,CAAC;QAMvC,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,KAAA,EAAE,CAAA;IACxB,CAAC;IACH,4BAAC;AAAD,CAAC,AATD,IASC"} \ No newline at end of file diff --git a/src/app/shared/history/history.reducer.js b/src/app/shared/history/history.reducer.js new file mode 100644 index 0000000000..f2874b22e0 --- /dev/null +++ b/src/app/shared/history/history.reducer.js @@ -0,0 +1,17 @@ +import { HistoryActionTypes } from './history.actions'; +/** + * The initial state. + */ +var initialState = []; +export function historyReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case HistoryActionTypes.ADD_TO_HISTORY: { + return state.concat([action.payload.url]); + } + default: { + return state; + } + } +} +//# sourceMappingURL=history.reducer.js.map \ No newline at end of file diff --git a/src/app/shared/history/history.reducer.js.map b/src/app/shared/history/history.reducer.js.map new file mode 100644 index 0000000000..22c021e453 --- /dev/null +++ b/src/app/shared/history/history.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"history.reducer.js","sourceRoot":"","sources":["history.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAS7F;;GAEG;AACH,IAAM,YAAY,GAAiB,EAAE,CAAC;AAEtC,MAAM,yBAAyB,KAAoB,EAAE,MAAqB;IAA3C,sBAAA,EAAA,oBAAoB;IACjD,QAAQ,MAAM,CAAC,IAAI,EAAE;QAEnB,KAAK,kBAAkB,CAAC,cAAc,CAAC,CAAC;YACtC,OAAW,KAAK,SAAG,MAAgC,CAAC,OAAO,CAAC,GAAG,GAAE;SAClE;QAED,OAAO,CAAC,CAAC;YACP,OAAO,KAAK,CAAC;SACd;KACF;AACH,CAAC"} \ No newline at end of file diff --git a/src/app/shared/history/selectors.js b/src/app/shared/history/selectors.js new file mode 100644 index 0000000000..7dc14f1f21 --- /dev/null +++ b/src/app/shared/history/selectors.js @@ -0,0 +1,2 @@ +export var historySelector = function (state) { return state.history; }; +//# sourceMappingURL=selectors.js.map \ No newline at end of file diff --git a/src/app/shared/history/selectors.js.map b/src/app/shared/history/selectors.js.map new file mode 100644 index 0000000000..3956ddac81 --- /dev/null +++ b/src/app/shared/history/selectors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"selectors.js","sourceRoot":"","sources":["selectors.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,IAAM,eAAe,GAAG,UAAC,KAAe,IAAK,OAAA,KAAK,CAAC,OAAO,EAAb,CAAa,CAAC"} \ No newline at end of file diff --git a/src/app/shared/host-window.actions.js b/src/app/shared/host-window.actions.js new file mode 100644 index 0000000000..528c07beab --- /dev/null +++ b/src/app/shared/host-window.actions.js @@ -0,0 +1,13 @@ +import { type } from './ngrx/type'; +export var HostWindowActionTypes = { + RESIZE: type('dspace/host-window/RESIZE') +}; +var HostWindowResizeAction = /** @class */ (function () { + function HostWindowResizeAction(width, height) { + this.type = HostWindowActionTypes.RESIZE; + this.payload = { width: width, height: height }; + } + return HostWindowResizeAction; +}()); +export { HostWindowResizeAction }; +//# sourceMappingURL=host-window.actions.js.map \ No newline at end of file diff --git a/src/app/shared/host-window.actions.js.map b/src/app/shared/host-window.actions.js.map new file mode 100644 index 0000000000..8002acca50 --- /dev/null +++ b/src/app/shared/host-window.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"host-window.actions.js","sourceRoot":"","sources":["host-window.actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,CAAC,IAAM,qBAAqB,GAAG;IACnC,MAAM,EAAE,IAAI,CAAC,2BAA2B,CAAC;CAC1C,CAAC;AAEF;IAOE,gCAAY,KAAa,EAAE,MAAc;QANzC,SAAI,GAAG,qBAAqB,CAAC,MAAM,CAAC;QAOlC,IAAI,CAAC,OAAO,GAAG,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,CAAA;IAClC,CAAC;IACH,6BAAC;AAAD,CAAC,AAVD,IAUC"} \ No newline at end of file diff --git a/src/app/shared/host-window.reducer.js b/src/app/shared/host-window.reducer.js new file mode 100644 index 0000000000..befcc6156d --- /dev/null +++ b/src/app/shared/host-window.reducer.js @@ -0,0 +1,17 @@ +import { HostWindowActionTypes } from './host-window.actions'; +var initialState = { + width: null, + height: null +}; +export function hostWindowReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case HostWindowActionTypes.RESIZE: { + return Object.assign({}, state, action.payload); + } + default: { + return state; + } + } +} +//# sourceMappingURL=host-window.reducer.js.map \ No newline at end of file diff --git a/src/app/shared/host-window.reducer.js.map b/src/app/shared/host-window.reducer.js.map new file mode 100644 index 0000000000..d58d4bf2c8 --- /dev/null +++ b/src/app/shared/host-window.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"host-window.reducer.js","sourceRoot":"","sources":["host-window.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAOhF,IAAM,YAAY,GAAoB;IACpC,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;CACb,CAAC;AAEF,MAAM,4BAA4B,KAAoB,EAAE,MAAwB;IAA9C,sBAAA,EAAA,oBAAoB;IACpD,QAAQ,MAAM,CAAC,IAAI,EAAE;QAEnB,KAAK,qBAAqB,CAAC,MAAM,CAAC,CAAC;YACjC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;SACjD;QAED,OAAO,CAAC,CAAC;YACP,OAAO,KAAK,CAAC;SACd;KACF;AACH,CAAC"} \ No newline at end of file diff --git a/src/app/shared/host-window.service.js b/src/app/shared/host-window.service.js new file mode 100644 index 0000000000..9e8f935b28 --- /dev/null +++ b/src/app/shared/host-window.service.js @@ -0,0 +1,89 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest } from 'rxjs'; +import { filter, distinctUntilChanged, map } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { createSelector, select, Store } from '@ngrx/store'; +import { hasValue } from './empty.util'; +import { CSSVariableService } from './sass-helper/sass-helper.service'; +export var WidthCategory; +(function (WidthCategory) { + WidthCategory[WidthCategory["XS"] = 0] = "XS"; + WidthCategory[WidthCategory["SM"] = 1] = "SM"; + WidthCategory[WidthCategory["MD"] = 2] = "MD"; + WidthCategory[WidthCategory["LG"] = 3] = "LG"; + WidthCategory[WidthCategory["XL"] = 4] = "XL"; +})(WidthCategory || (WidthCategory = {})); +var hostWindowStateSelector = function (state) { return state.hostWindow; }; +var widthSelector = createSelector(hostWindowStateSelector, function (hostWindow) { return hostWindow.width; }); +var HostWindowService = /** @class */ (function () { + function HostWindowService(store, variableService) { + var _this = this; + this.store = store; + this.variableService = variableService; + this.breakPoints = {}; + /* See _exposed_variables.scss */ + variableService.getAllVariables() + .subscribe(function (variables) { + _this.breakPoints.XL_MIN = parseInt(variables.xlMin, 10); + _this.breakPoints.LG_MIN = parseInt(variables.lgMin, 10); + _this.breakPoints.MD_MIN = parseInt(variables.mdMin, 10); + _this.breakPoints.SM_MIN = parseInt(variables.smMin, 10); + }); + } + HostWindowService.prototype.getWidthObs = function () { + return this.store.pipe(select(widthSelector), filter(function (width) { return hasValue(width); })); + }; + Object.defineProperty(HostWindowService.prototype, "widthCategory", { + get: function () { + var _this = this; + return this.getWidthObs().pipe(map(function (width) { + if (width < _this.breakPoints.SM_MIN) { + return WidthCategory.XS; + } + else if (width >= _this.breakPoints.SM_MIN && width < _this.breakPoints.MD_MIN) { + return WidthCategory.SM; + } + else if (width >= _this.breakPoints.MD_MIN && width < _this.breakPoints.LG_MIN) { + return WidthCategory.MD; + } + else if (width >= _this.breakPoints.LG_MIN && width < _this.breakPoints.XL_MIN) { + return WidthCategory.LG; + } + else { + return WidthCategory.XL; + } + }), distinctUntilChanged()); + }, + enumerable: true, + configurable: true + }); + HostWindowService.prototype.isXs = function () { + return this.widthCategory.pipe(map(function (widthCat) { return widthCat === WidthCategory.XS; }), distinctUntilChanged()); + }; + HostWindowService.prototype.isSm = function () { + return this.widthCategory.pipe(map(function (widthCat) { return widthCat === WidthCategory.SM; }), distinctUntilChanged()); + }; + HostWindowService.prototype.isMd = function () { + return this.widthCategory.pipe(map(function (widthCat) { return widthCat === WidthCategory.MD; }), distinctUntilChanged()); + }; + HostWindowService.prototype.isLg = function () { + return this.widthCategory.pipe(map(function (widthCat) { return widthCat === WidthCategory.LG; }), distinctUntilChanged()); + }; + HostWindowService.prototype.isXl = function () { + return this.widthCategory.pipe(map(function (widthCat) { return widthCat === WidthCategory.XL; }), distinctUntilChanged()); + }; + HostWindowService.prototype.isXsOrSm = function () { + return observableCombineLatest(this.isXs(), this.isSm()).pipe(map(function (_a) { + var isXs = _a[0], isSm = _a[1]; + return isXs || isSm; + }), distinctUntilChanged()); + }; + HostWindowService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Store, + CSSVariableService]) + ], HostWindowService); + return HostWindowService; +}()); +export { HostWindowService }; +//# sourceMappingURL=host-window.service.js.map \ No newline at end of file diff --git a/src/app/shared/host-window.service.js.map b/src/app/shared/host-window.service.js.map new file mode 100644 index 0000000000..7d1fc9e91a --- /dev/null +++ b/src/app/shared/host-window.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"host-window.service.js","sourceRoot":"","sources":["host-window.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAc,MAAM,MAAM,CAAC;AAE5E,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,QAAQ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AC,EAAE,EAA7B,CAA6B,CAAC,EAC/D,oBAAoB,EAAE,CACvB,CAAC;IACJ,CAAC;IAED,gCAAI,GAAJ;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAC5B,GAAG,CAAC,UAAC,QAAuB,IAAK,OAAA,QAAQ,KAAK,aAAa,CAAC,EAAE,EAA7B,CAA6B,CAAC,EAC/D,oBAAoB,EAAE,CACvB,CAAC;IACJ,CAAC;IAED,gCAAI,GAAJ;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAC5B,GAAG,CAAC,UAAC,QAAuB,IAAK,OAAA,QAAQ,KAAK,aAAa,CAAC,EAAE,EAA7B,CAA6B,CAAC,EAC/D,oBAAoB,EAAE,CACvB,CAAC;IACJ,CAAC;IAED,gCAAI,GAAJ;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAC5B,GAAG,CAAC,UAAC,QAAuB,IAAK,OAAA,QAAQ,KAAK,aAAa,CAAC,EAAE,EAA7B,CAA6B,CAAC,EAC/D,oBAAoB,EAAE,CACvB,CAAC;IACJ,CAAC;IAED,oCAAQ,GAAR;QACE,OAAO,uBAAuB,CAC5B,IAAI,CAAC,IAAI,EAAE,EACX,IAAI,CAAC,IAAI,EAAE,CACZ,CAAC,IAAI,CACJ,GAAG,CAAC,UAAC,EAAY;gBAAX,YAAI,EAAE,YAAI;YAAM,OAAA,IAAI,IAAI,IAAI;QAAZ,CAAY,CAAC,EACnC,oBAAoB,EAAE,CACvB,CAAC;IACJ,CAAC;IAtFU,iBAAiB;QAD7B,UAAU,EAAE;iDAKM,KAAK;YACK,kBAAkB;OALlC,iBAAiB,CAuF7B;IAAD,wBAAC;CAAA,AAvFD,IAuFC;SAvFY,iBAAiB"} \ No newline at end of file diff --git a/src/app/shared/input-suggestions/input-suggestions.component.js b/src/app/shared/input-suggestions/input-suggestions.component.js new file mode 100644 index 0000000000..6f5e95d720 --- /dev/null +++ b/src/app/shared/input-suggestions/input-suggestions.component.js @@ -0,0 +1,255 @@ +import * as tslib_1 from "tslib"; +import { Component, ElementRef, EventEmitter, forwardRef, Input, Output, QueryList, ViewChild, ViewChildren } from '@angular/core'; +import { BehaviorSubject } from 'rxjs'; +import { hasValue, isNotEmpty } from '../empty.util'; +import { NG_VALUE_ACCESSOR } from '@angular/forms'; +var InputSuggestionsComponent = /** @class */ (function () { + function InputSuggestionsComponent() { + /** + * The suggestions that should be shown + */ + this.suggestions = []; + /** + * The time waited to detect if any other input will follow before requesting the suggestions + */ + this.debounceTime = 500; + /** + * Placeholder attribute for the input field + */ + this.placeholder = ''; + /** + * Whether or not the current input is valid + */ + this.valid = true; + /** + * Output for when the form is submitted + */ + this.submitSuggestion = new EventEmitter(); + /** + * Output for when a suggestion is clicked + */ + this.clickSuggestion = new EventEmitter(); + /** + * Output for when something is typed in the input field + */ + this.typeSuggestion = new EventEmitter(); + /** + * Output for when new suggestions should be requested + */ + this.findSuggestions = new EventEmitter(); + /** + * Emits true when the list of suggestions should be shown + */ + this.show = new BehaviorSubject(false); + /** + * Index of the currently selected suggestion + */ + this.selectedIndex = -1; + /** + * True when the dropdown should not reopen + */ + this.blockReopen = false; + /** Fields needed to add ngModel */ + this.disabled = false; + this.propagateChange = function (_) { + /* Empty implementation */ + }; + this.propagateTouch = function (_) { + /* Empty implementation */ + }; + /* END - Method's needed to add ngModel to a component */ + } + InputSuggestionsComponent_1 = InputSuggestionsComponent; + /** + * When any of the inputs change, check if we should still show the suggestions + */ + InputSuggestionsComponent.prototype.ngOnChanges = function (changes) { + if (hasValue(changes.suggestions)) { + this.show.next(isNotEmpty(changes.suggestions.currentValue) && !changes.suggestions.firstChange); + } + }; + /** + * Move the focus on one of the suggestions up to the previous suggestion + * When no suggestion is currently in focus OR the first suggestion is in focus: shift to the last suggestion + */ + InputSuggestionsComponent.prototype.shiftFocusUp = function (event) { + event.preventDefault(); + if (this.selectedIndex > 0) { + this.selectedIndex--; + this.selectedIndex = (this.selectedIndex + this.resultViews.length) % this.resultViews.length; // Prevent negative modulo outcome + } + else { + this.selectedIndex = this.resultViews.length - 1; + } + this.changeFocus(); + }; + /** + * Move the focus on one of the suggestions up to the next suggestion + * When no suggestion is currently in focus OR the last suggestion is in focus: shift to the first suggestion + */ + InputSuggestionsComponent.prototype.shiftFocusDown = function (event) { + event.preventDefault(); + if (this.selectedIndex >= 0) { + this.selectedIndex++; + this.selectedIndex %= this.resultViews.length; + } + else { + this.selectedIndex = 0; + } + this.changeFocus(); + }; + /** + * Perform the change of focus to the current selectedIndex + */ + InputSuggestionsComponent.prototype.changeFocus = function () { + if (this.resultViews.length > 0) { + this.resultViews.toArray()[this.selectedIndex].nativeElement.focus(); + } + }; + /** + * When any key is pressed (except for the Enter button) the query input should move to the input field + * @param {KeyboardEvent} event The keyboard event + */ + InputSuggestionsComponent.prototype.onKeydown = function (event) { + if (event.key !== 'Enter') { + this.queryInput.nativeElement.focus(); + } + }; + /** + * Changes the show variable so the suggestion dropdown closes + */ + InputSuggestionsComponent.prototype.close = function () { + this.show.next(false); + }; + /** + * For usage of the isNotEmpty function in the template + */ + InputSuggestionsComponent.prototype.isNotEmpty = function (data) { + return isNotEmpty(data); + }; + /** + * Make sure that if a suggestion is clicked, the suggestions dropdown closes, does not reopen and the focus moves to the input field + */ + InputSuggestionsComponent.prototype.onClickSuggestion = function (data) { + this.value = data; + this.clickSuggestion.emit(data); + this.close(); + this.blockReopen = true; + this.queryInput.nativeElement.focus(); + return false; + }; + /** + * Finds new suggestions when necessary + * @param data The query value to emit + */ + InputSuggestionsComponent.prototype.find = function (data) { + if (!this.blockReopen) { + this.findSuggestions.emit(data); + this.typeSuggestion.emit(data); + } + this.blockReopen = false; + }; + InputSuggestionsComponent.prototype.onSubmit = function (data) { + this.value = data; + this.submitSuggestion.emit(data); + }; + /* START - Method's needed to add ngModel (ControlValueAccessor) to a component */ + InputSuggestionsComponent.prototype.registerOnChange = function (fn) { + this.propagateChange = fn; + }; + InputSuggestionsComponent.prototype.registerOnTouched = function (fn) { + this.propagateTouch = fn; + }; + InputSuggestionsComponent.prototype.setDisabledState = function (isDisabled) { + this.disabled = isDisabled; + }; + InputSuggestionsComponent.prototype.writeValue = function (value) { + this.value = value; + }; + Object.defineProperty(InputSuggestionsComponent.prototype, "value", { + get: function () { + return this._value; + }, + set: function (val) { + this._value = val; + this.propagateChange(this._value); + }, + enumerable: true, + configurable: true + }); + var InputSuggestionsComponent_1; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], InputSuggestionsComponent.prototype, "suggestions", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], InputSuggestionsComponent.prototype, "debounceTime", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], InputSuggestionsComponent.prototype, "placeholder", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], InputSuggestionsComponent.prototype, "action", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], InputSuggestionsComponent.prototype, "name", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], InputSuggestionsComponent.prototype, "valid", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], InputSuggestionsComponent.prototype, "submitSuggestion", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], InputSuggestionsComponent.prototype, "clickSuggestion", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], InputSuggestionsComponent.prototype, "typeSuggestion", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], InputSuggestionsComponent.prototype, "findSuggestions", void 0); + tslib_1.__decorate([ + ViewChild('inputField'), + tslib_1.__metadata("design:type", ElementRef) + ], InputSuggestionsComponent.prototype, "queryInput", void 0); + tslib_1.__decorate([ + ViewChildren('suggestion'), + tslib_1.__metadata("design:type", QueryList) + ], InputSuggestionsComponent.prototype, "resultViews", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], InputSuggestionsComponent.prototype, "disabled", void 0); + InputSuggestionsComponent = InputSuggestionsComponent_1 = tslib_1.__decorate([ + Component({ + selector: 'ds-input-suggestions', + styleUrls: ['./input-suggestions.component.scss'], + templateUrl: './input-suggestions.component.html', + providers: [ + { + provide: NG_VALUE_ACCESSOR, + // Usage of forwardRef necessary https://github.com/angular/angular.io/issues/1151 + // tslint:disable-next-line:no-forward-ref + useExisting: forwardRef(function () { return InputSuggestionsComponent_1; }), + multi: true + } + ] + }) + /** + * Component representing a form with a autocomplete functionality + */ + ], InputSuggestionsComponent); + return InputSuggestionsComponent; +}()); +export { InputSuggestionsComponent }; +//# sourceMappingURL=input-suggestions.component.js.map \ No newline at end of file diff --git a/src/app/shared/input-suggestions/input-suggestions.component.js.map b/src/app/shared/input-suggestions/input-suggestions.component.js.map new file mode 100644 index 0000000000..2a6f8351c7 --- /dev/null +++ b/src/app/shared/input-suggestions/input-suggestions.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"input-suggestions.component.js","sourceRoot":"","sources":["input-suggestions.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,UAAU,EACV,KAAK,EAEL,MAAM,EACN,SAAS,EAET,SAAS,EACT,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAwB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAoBzE;IAlBA;QAmBE;;WAEG;QACM,gBAAW,GAAsB,EAAE,CAAC;QAE7C;;WAEG;QACM,iBAAY,GAAG,GAAG,CAAC;QAE5B;;WAEG;QACM,gBAAW,GAAG,EAAE,CAAC;QAY1B;;WAEG;QACM,UAAK,GAAG,IAAI,CAAC;QAEtB;;WAEG;QAC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Q;IAKP;QAAR,KAAK,EAAE;;2DAAM;IAKL;QAAR,KAAK,EAAE;;4DAAc;IAKZ;QAAT,MAAM,EAAE;;uEAAuC;IAKtC;QAAT,MAAM,EAAE;;sEAAsC;IAKrC;QAAT,MAAM,EAAE;;qEAAqC;IAKpC;QAAT,MAAM,EAAE;;sEAAsC;IAoBtB;QAAxB,SAAS,CAAC,YAAY,CAAC;0CAAa,UAAU;iEAAC;IAIpB;QAA3B,YAAY,CAAC,YAAY,CAAC;0CAAc,SAAS;kEAAa;IAQtD;QAAR,KAAK,EAAE;;+DAAkB;IAjFf,yBAAyB;QAlBrC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,SAAS,EAAE,CAAC,oCAAoC,CAAC;YACjD,WAAW,EAAE,oCAAoC;YACjD,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,iBAAiB;oBAC1B,kFAAkF;oBAClF,0CAA0C;oBAC1C,WAAW,EAAE,UAAU,CAAC,cAAM,OAAA,2BAAyB,EAAzB,CAAyB,CAAC;oBACxD,KAAK,EAAE,IAAI;iBACZ;aACF;SACF,CAAC;QAEF;;WAEG;OACU,yBAAyB,CAwNrC;IAAD,gCAAC;CAAA,AAxND,IAwNC;SAxNY,yBAAyB"} \ No newline at end of file diff --git a/src/app/shared/input-suggestions/input-suggestions.model.js b/src/app/shared/input-suggestions/input-suggestions.model.js new file mode 100644 index 0000000000..064373be13 --- /dev/null +++ b/src/app/shared/input-suggestions/input-suggestions.model.js @@ -0,0 +1 @@ +//# sourceMappingURL=input-suggestions.model.js.map \ No newline at end of file diff --git a/src/app/shared/input-suggestions/input-suggestions.model.js.map b/src/app/shared/input-suggestions/input-suggestions.model.js.map new file mode 100644 index 0000000000..f70e778309 --- /dev/null +++ b/src/app/shared/input-suggestions/input-suggestions.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"input-suggestions.model.js","sourceRoot":"","sources":["input-suggestions.model.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/shared/items/item-type-decorator.js b/src/app/shared/items/item-type-decorator.js new file mode 100644 index 0000000000..22a3ede845 --- /dev/null +++ b/src/app/shared/items/item-type-decorator.js @@ -0,0 +1,62 @@ +import { hasNoValue, hasValue } from '../empty.util'; +import { MetadataRepresentationType } from '../../core/shared/metadata-representation/metadata-representation.model'; +export var ItemViewMode; +(function (ItemViewMode) { + ItemViewMode["Element"] = "element"; + ItemViewMode["Full"] = "full"; + ItemViewMode["Metadata"] = "metadata"; +})(ItemViewMode || (ItemViewMode = {})); +export var DEFAULT_ITEM_TYPE = 'Default'; +export var DEFAULT_VIEW_MODE = ItemViewMode.Element; +export var NO_REPRESENTATION_TYPE = MetadataRepresentationType.None; +export var DEFAULT_REPRESENTATION_TYPE = MetadataRepresentationType.PlainText; +var map = new Map(); +/** + * Decorator used for rendering simple item pages by type and viewMode (and optionally a representationType) + * @param type + * @param viewMode + * @param representationType + */ +export function rendersItemType(type, viewMode, representationType) { + return function decorator(component) { + if (hasNoValue(map.get(viewMode))) { + map.set(viewMode, new Map()); + } + if (hasNoValue(map.get(viewMode).get(type))) { + map.get(viewMode).set(type, new Map()); + } + if (hasNoValue(representationType)) { + representationType = NO_REPRESENTATION_TYPE; + } + if (hasValue(map.get(viewMode).get(type).get(representationType))) { + throw new Error("There can't be more than one component to render Metadata of type \"" + type + "\" in view mode \"" + viewMode + "\" with representation type \"" + representationType + "\""); + } + map.get(viewMode).get(type).set(representationType, component); + }; +} +/** + * Get the component used for rendering an item by type and viewMode (and optionally a representationType) + * @param type + * @param viewMode + * @param representationType + */ +export function getComponentByItemType(type, viewMode, representationType) { + if (hasNoValue(representationType)) { + representationType = NO_REPRESENTATION_TYPE; + } + if (hasNoValue(map.get(viewMode))) { + viewMode = DEFAULT_VIEW_MODE; + } + if (hasNoValue(map.get(viewMode).get(type))) { + type = DEFAULT_ITEM_TYPE; + } + var representationComponent = map.get(viewMode).get(type).get(representationType); + if (hasNoValue(representationComponent)) { + representationComponent = map.get(viewMode).get(type).get(DEFAULT_REPRESENTATION_TYPE); + } + if (hasNoValue(representationComponent)) { + representationComponent = map.get(viewMode).get(type).get(NO_REPRESENTATION_TYPE); + } + return representationComponent; +} +//# sourceMappingURL=item-type-decorator.js.map \ No newline at end of file diff --git a/src/app/shared/items/item-type-decorator.js.map b/src/app/shared/items/item-type-decorator.js.map new file mode 100644 index 0000000000..7f674e0c34 --- /dev/null +++ b/src/app/shared/items/item-type-decorator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-type-decorator.js","sourceRoot":"","sources":["item-type-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yEAAyE,CAAC;AAErH,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,6BAAa,CAAA;IACb,qCAAqB,CAAA;AACvB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,CAAC,IAAM,iBAAiB,GAAG,SAAS,CAAC;AAC3C,MAAM,CAAC,IAAM,iBAAiB,GAAG,YAAY,CAAC,OAAO,CAAC;AACtD,MAAM,CAAC,IAAM,sBAAsB,GAAG,0BAA0B,CAAC,IAAI,CAAC;AACtE,MAAM,CAAC,IAAM,2BAA2B,GAAG,0BAA0B,CAAC,SAAS,CAAC;AAEhF,IAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;AAEtB;;;;;GAKG;AACH,MAAM,0BAA0B,IAAY,EAAE,QAAgB,EAAE,kBAA+C;IAC7G,OAAO,mBAAmB,SAAc;QACtC,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE;YACjC,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;SAC9B;QACD,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAA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,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;KACxF;IACD,IAAI,UAAU,CAAC,uBAAuB,CAAC,EAAE;QACvC,uBAAuB,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;KACnF;IACD,OAAO,uBAAuB,CAAC;AACjC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/items/switcher/item-type-switcher.component.js b/src/app/shared/items/switcher/item-type-switcher.component.js new file mode 100644 index 0000000000..78345f7c37 --- /dev/null +++ b/src/app/shared/items/switcher/item-type-switcher.component.js @@ -0,0 +1,60 @@ +import * as tslib_1 from "tslib"; +import { Component, InjectionToken, Injector, Input } from '@angular/core'; +import { hasValue } from '../../empty.util'; +import { getComponentByItemType } from '../item-type-decorator'; +export var ITEM = new InjectionToken('item'); +var ItemTypeSwitcherComponent = /** @class */ (function () { + function ItemTypeSwitcherComponent(injector) { + this.injector = injector; + } + ItemTypeSwitcherComponent.prototype.ngOnInit = function () { + var _this = this; + this.objectInjector = Injector.create({ + providers: [{ provide: ITEM, useFactory: function () { return _this.object; }, deps: [] }], + parent: this.injector + }); + }; + /** + * Fetch the component depending on the item's relationship type + * @returns {string} + */ + ItemTypeSwitcherComponent.prototype.getComponent = function () { + if (hasValue(this.object.representationType)) { + var metadataRepresentation = this.object; + return getComponentByItemType(metadataRepresentation.itemType, this.viewMode, metadataRepresentation.representationType); + } + var item; + if (hasValue(this.object.indexableObject)) { + var searchResult = this.object; + item = searchResult.indexableObject; + } + else { + item = this.object; + } + var type = item.firstMetadataValue('relationship.type'); + return getComponentByItemType(type, this.viewMode); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ItemTypeSwitcherComponent.prototype, "object", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ItemTypeSwitcherComponent.prototype, "viewMode", void 0); + ItemTypeSwitcherComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-type-switcher', + styleUrls: ['./item-type-switcher.component.scss'], + templateUrl: './item-type-switcher.component.html' + }) + /** + * Component for determining what component to use depending on the item's relationship type (relationship.type) + */ + , + tslib_1.__metadata("design:paramtypes", [Injector]) + ], ItemTypeSwitcherComponent); + return ItemTypeSwitcherComponent; +}()); +export { ItemTypeSwitcherComponent }; +//# sourceMappingURL=item-type-switcher.component.js.map \ No newline at end of file diff --git a/src/app/shared/items/switcher/item-type-switcher.component.js.map b/src/app/shared/items/switcher/item-type-switcher.component.js.map new file mode 100644 index 0000000000..37c973e36a --- /dev/null +++ b/src/app/shared/items/switcher/item-type-switcher.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-type-switcher.component.js","sourceRoot":"","sources":["item-type-switcher.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAGnF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,MAAM,CAAC,IAAM,IAAI,GAA2B,IAAI,cAAc,CAAS,MAAM,CAAC,CAAC;AAU/E;IAgBE,mCAAoB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IACtC,CAAC;IAED,4CAAQ,GAAR;QAAA,iBAMC;QALC,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;YACpC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,cAAM,OAAA,KAAI,CAAC,MAAM,EAAX,CAAW,EAAE,IAAI,EAAC,EAAE,EAAE,CAAC;YACtE,MAAM,EAAE,IAAI,CAAC,QAAQ;SACtB,CAAC,CAAC;IAEL,CAAC;IAED;;;OAGG;IACH,gDAAY,GAAZ;QACE,IAAI,QAAQ,CAAE,IAAI,CAAC,MAAc,CAAC,kBAAkB,CAAC,EAAE;YACrD,IAAM,sBAAsB,GAAG,IAAI,CAAC,MAAgC,CAAC;YACrE,OAAO,sBAAsB,CAAC,sBAAsB,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;SAC1H;QAED,IAAI,IAAU,CAAC;QACf,IAAI,QAAQ,CAAE,IAAI,CAAC,MAAc,CAAC,eAAe,CAAC,EAAE;YAClD,IAAM,YAAY,GAAG,IAAI,CAAC,MAA0B,CAAC;YACrD,IAAI,GAAG,YAAY,CAAC,eAAe,CAAC;SACrC;aAAM;YACL,IAAI,GAAG,IAAI,CAAC,MAAc,CAAC;SAC5B;QAED,IAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;QAC1D,OAAO,sBAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;IA3CQ;QAAR,KAAK,EAAE;;6DAA4D;IAK3D;QAAR,KAAK,EAAE;;+DAAkB;IATf,yBAAyB;QARrC,SAAS,CAAC;YACT,QAAQ,EAAE,uBAAuB;YACjC,SAAS,EAAE,CAAC,qCAAqC,CAAC;YAClD,WAAW,EAAE,qCAAqC;SACnD,CAAC;QACF;;WAEG;;iDAiB6B,QAAQ;OAhB3B,yBAAyB,CAgDrC;IAAD,gCAAC;CAAA,AAhDD,IAgDC;SAhDY,yBAAyB"} \ No newline at end of file diff --git a/src/app/shared/lang-switch/lang-switch.component.js b/src/app/shared/lang-switch/lang-switch.component.js new file mode 100644 index 0000000000..cc3576585e --- /dev/null +++ b/src/app/shared/lang-switch/lang-switch.component.js @@ -0,0 +1,44 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { GLOBAL_CONFIG } from '../../../config'; +import { TranslateService } from '@ngx-translate/core'; +var LangSwitchComponent = /** @class */ (function () { + function LangSwitchComponent(config, translate) { + this.config = config; + this.translate = translate; + } + LangSwitchComponent.prototype.ngOnInit = function () { + this.activeLangs = this.config.languages.filter(function (MyLangConfig) { return MyLangConfig.active === true; }); + this.moreThanOneLanguage = (this.activeLangs.length > 1); + }; + /** + * Returns the label for the current language + */ + LangSwitchComponent.prototype.currentLangLabel = function () { + var _this = this; + return this.activeLangs.find(function (MyLangConfig) { return MyLangConfig.code === _this.translate.currentLang; }).label; + }; + /** + * Returns the label for a specific language code + */ + LangSwitchComponent.prototype.langLabel = function (langcode) { + return this.activeLangs.find(function (MyLangConfig) { return MyLangConfig.code === langcode; }).label; + }; + LangSwitchComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-lang-switch', + styleUrls: ['lang-switch.component.scss'], + templateUrl: 'lang-switch.component.html', + }) + /** + * Component representing a switch for changing the interface language throughout the application + * If only one language is active, the component will disappear as there are no languages to switch to. + */ + , + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, TranslateService]) + ], LangSwitchComponent); + return LangSwitchComponent; +}()); +export { LangSwitchComponent }; +//# sourceMappingURL=lang-switch.component.js.map \ No newline at end of file diff --git a/src/app/shared/lang-switch/lang-switch.component.js.map b/src/app/shared/lang-switch/lang-switch.component.js.map new file mode 100644 index 0000000000..c6d0bac160 --- /dev/null +++ b/src/app/shared/lang-switch/lang-switch.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-switch.component.js","sourceRoot":"","sources":["lang-switch.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAS,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,aAAa,EAAgB,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAarD;IAQE,6BACgC,MAAoB,EAC3C,SAA2B;QADJ,WAAM,GAAN,MAAM,CAAc;QAC3C,cAAS,GAAT,SAAS,CAAkB;IAEpC,CAAC;IAED,sCAAQ,GAAR;QACE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,UAAC,YAAY,IAAK,OAAA,YAAY,CAAC,MAAM,KAAK,IAAI,EAA5B,CAA4B,CAAC,CAAC;QAChG,IAAI,CAAC,mBAAmB,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,8CAAgB,GAAhB;QAAA,iBAEC;QADC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAC,YAAY,IAAK,OAAA,YAAY,CAAC,IAAI,KAAK,KAAI,CAAC,SAAS,CAAC,WAAW,EAAhD,CAAgD,CAAC,CAAC,KAAK,CAAC;IACzG,CAAC;IAED;;OAEG;IACH,uCAAS,GAAT,UAAU,QAAgB;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAC,YAAY,IAAK,OAAA,YAAY,CAAC,IAAI,KAAK,QAAQ,EAA9B,CAA8B,CAAC,CAAC,KAAK,CAAC;IACvF,CAAC;IA/BU,mBAAmB;QAV/B,SAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,CAAC,4BAA4B,CAAC;YACzC,WAAW,EAAE,4BAA4B;SAC1C,CAAC;QAEF;;;WAGG;;QAUE,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACJ,gBAAgB;OAVzB,mBAAmB,CAiC/B;IAAD,0BAAC;CAAA,AAjCD,IAiCC;SAjCY,mBAAmB"} \ No newline at end of file diff --git a/src/app/shared/loading/loading.component.js b/src/app/shared/loading/loading.component.js new file mode 100644 index 0000000000..9f72d4cb01 --- /dev/null +++ b/src/app/shared/loading/loading.component.js @@ -0,0 +1,42 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; +import { hasValue } from '../empty.util'; +var LoadingComponent = /** @class */ (function () { + function LoadingComponent(translate) { + this.translate = translate; + this.showMessage = true; + } + LoadingComponent.prototype.ngOnInit = function () { + var _this = this; + if (this.message === undefined) { + this.subscription = this.translate.get('loading.default').subscribe(function (message) { + _this.message = message; + }); + } + }; + LoadingComponent.prototype.ngOnDestroy = function () { + if (hasValue(this.subscription)) { + this.subscription.unsubscribe(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], LoadingComponent.prototype, "message", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], LoadingComponent.prototype, "showMessage", void 0); + LoadingComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-loading', + styleUrls: ['./loading.component.scss'], + templateUrl: './loading.component.html' + }), + tslib_1.__metadata("design:paramtypes", [TranslateService]) + ], LoadingComponent); + return LoadingComponent; +}()); +export { LoadingComponent }; +//# sourceMappingURL=loading.component.js.map \ No newline at end of file diff --git a/src/app/shared/loading/loading.component.js.map b/src/app/shared/loading/loading.component.js.map new file mode 100644 index 0000000000..f4aa2dcb59 --- /dev/null +++ b/src/app/shared/loading/loading.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"loading.component.js","sourceRoot":"","sources":["loading.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOzC;IAOE,0BAAoB,SAA2B;QAA3B,cAAS,GAAT,SAAS,CAAkB;QAJtC,gBAAW,GAAG,IAAI,CAAC;IAM5B,CAAC;IAED,mCAAQ,GAAR;QAAA,iBAMC;QALC,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;YAC9B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC,UAAC,OAAe;gBAClF,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACzB,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,sCAAW,GAAX;QACE,IAAI,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;YAC/B,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;SACjC;IACH,CAAC;IArBQ;QAAR,KAAK,EAAE;;qDAAiB;IAChB;QAAR,KAAK,EAAE;;yDAAoB;IAHjB,gBAAgB;QAL5B,SAAS,CAAC;YACT,QAAQ,EAAE,YAAY;YACtB,SAAS,EAAE,CAAC,0BAA0B,CAAC;YACvC,WAAW,EAAE,0BAA0B;SACxC,CAAC;iDAQ+B,gBAAgB;OAPpC,gBAAgB,CAyB5B;IAAD,uBAAC;CAAA,AAzBD,IAyBC;SAzBY,gBAAgB"} \ No newline at end of file diff --git a/src/app/shared/log-in/log-in.component.js b/src/app/shared/log-in/log-in.component.js new file mode 100644 index 0000000000..c1140b5967 --- /dev/null +++ b/src/app/shared/log-in/log-in.component.js @@ -0,0 +1,129 @@ +import * as tslib_1 from "tslib"; +import { filter, map, takeWhile } from 'rxjs/operators'; +import { Component } from '@angular/core'; +import { FormBuilder, Validators } from '@angular/forms'; +import { select, Store } from '@ngrx/store'; +import { AuthenticateAction, ResetAuthenticationMessagesAction } from '../../core/auth/auth.actions'; +import { getAuthenticationError, getAuthenticationInfo, isAuthenticated, isAuthenticationLoading, } from '../../core/auth/selectors'; +import { isNotEmpty } from '../empty.util'; +import { fadeOut } from '../animations/fade'; +import { AuthService } from '../../core/auth/auth.service'; +/** + * /users/sign-in + * @class LogInComponent + */ +var LogInComponent = /** @class */ (function () { + /** + * @constructor + * @param {AuthService} authService + * @param {FormBuilder} formBuilder + * @param {Store} store + */ + function LogInComponent(authService, formBuilder, store) { + this.authService = authService; + this.formBuilder = formBuilder; + this.store = store; + /** + * Has authentication error. + * @type {boolean} + */ + this.hasError = false; + /** + * Has authentication message. + * @type {boolean} + */ + this.hasMessage = false; + /** + * Component state. + * @type {boolean} + */ + this.alive = true; + } + /** + * Lifecycle hook that is called after data-bound properties of a directive are initialized. + * @method ngOnInit + */ + LogInComponent.prototype.ngOnInit = function () { + var _this = this; + // set isAuthenticated + this.isAuthenticated = this.store.pipe(select(isAuthenticated)); + // set formGroup + this.form = this.formBuilder.group({ + email: ['', Validators.required], + password: ['', Validators.required] + }); + // set error + this.error = this.store.pipe(select(getAuthenticationError), map(function (error) { + _this.hasError = (isNotEmpty(error)); + return error; + })); + // set error + this.message = this.store.pipe(select(getAuthenticationInfo), map(function (message) { + _this.hasMessage = (isNotEmpty(message)); + return message; + })); + // set loading + this.loading = this.store.pipe(select(isAuthenticationLoading)); + // subscribe to success + this.store.pipe(select(isAuthenticated), takeWhile(function () { return _this.alive; }), filter(function (authenticated) { return authenticated; })) + .subscribe(function () { + _this.authService.redirectToPreviousUrl(); + }); + }; + /** + * Lifecycle hook that is called when a directive, pipe or service is destroyed. + * @method ngOnDestroy + */ + LogInComponent.prototype.ngOnDestroy = function () { + this.alive = false; + }; + /** + * Reset error or message. + */ + LogInComponent.prototype.resetErrorOrMessage = function () { + if (this.hasError || this.hasMessage) { + this.store.dispatch(new ResetAuthenticationMessagesAction()); + this.hasError = false; + this.hasMessage = false; + } + }; + /** + * To the registration page. + * @method register + */ + LogInComponent.prototype.register = function () { + // TODO enable after registration process is done + // this.router.navigate(['/register']); + }; + /** + * Submit the authentication form. + * @method submit + */ + LogInComponent.prototype.submit = function () { + this.resetErrorOrMessage(); + // get email and password values + var email = this.form.get('email').value; + var password = this.form.get('password').value; + // trim values + email.trim(); + password.trim(); + // dispatch AuthenticationAction + this.store.dispatch(new AuthenticateAction(email, password)); + // clear form + this.form.reset(); + }; + LogInComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-log-in', + templateUrl: './log-in.component.html', + styleUrls: ['./log-in.component.scss'], + animations: [fadeOut] + }), + tslib_1.__metadata("design:paramtypes", [AuthService, + FormBuilder, + Store]) + ], LogInComponent); + return LogInComponent; +}()); +export { LogInComponent }; +//# sourceMappingURL=log-in.component.js.map \ No newline at end of file diff --git a/src/app/shared/log-in/log-in.component.js.map b/src/app/shared/log-in/log-in.component.js.map new file mode 100644 index 0000000000..292c21cf2d --- /dev/null +++ b/src/app/shared/log-in/log-in.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"log-in.component.js","sourceRoot":"","sources":["log-in.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAqB,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAa,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EACL,kBAAkB,EAClB,iCAAiC,EAClC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D;;;GAGG;AAOH;IAkDE;;;;;OAKG;IACH,wBACU,WAAwB,EACxB,WAAwB,EACxB,KAAuB;QAFvB,gBAAW,GAAX,WAAW,CAAa;QACxB,gBAAW,GAAX,WAAW,CAAa;QACxB,UAAK,GAAL,KAAK,CAAkB;QAnDjC;;;WAGG;QACI,aAAQ,GAAG,KAAK,CAAC;QAQxB;;;WAGG;QACI,eAAU,GAAG,KAAK,CAAC;QAoB1B;;;WAGG;QACK,UAAK,GAAG,IAAI,CAAC;IAarB,CAAC;IAED;;;OAGG;IACI,iCAAQ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DuB,WAAW;YACX,WAAW;YACjB,KAAK;OA3DX,cAAc,CA6J1B;IAAD,qBAAC;CAAA,AA7JD,IA6JC;SA7JY,cAAc"} \ No newline at end of file diff --git a/src/app/shared/log-out/log-out.component.js b/src/app/shared/log-out/log-out.component.js new file mode 100644 index 0000000000..1df625e1b2 --- /dev/null +++ b/src/app/shared/log-out/log-out.component.js @@ -0,0 +1,47 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { Router } from '@angular/router'; +import { select, Store } from '@ngrx/store'; +import { LogOutAction } from '../../core/auth/auth.actions'; +import { getLogOutError, } from '../../core/auth/selectors'; +import { fadeOut } from '../animations/fade'; +var LogOutComponent = /** @class */ (function () { + /** + * @constructor + * @param {Store} store + * @param {Router} router + */ + function LogOutComponent(router, store) { + this.router = router; + this.store = store; + } + /** + * Lifecycle hook that is called after data-bound properties of a directive are initialized. + */ + LogOutComponent.prototype.ngOnInit = function () { + // set error + this.error = this.store.pipe(select(getLogOutError)); + }; + /** + * Go to the home page. + */ + LogOutComponent.prototype.home = function () { + this.router.navigate(['/home']); + }; + LogOutComponent.prototype.logOut = function () { + this.store.dispatch(new LogOutAction()); + }; + LogOutComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-log-out', + templateUrl: './log-out.component.html', + styleUrls: ['./log-out.component.scss'], + animations: [fadeOut] + }), + tslib_1.__metadata("design:paramtypes", [Router, + Store]) + ], LogOutComponent); + return LogOutComponent; +}()); +export { LogOutComponent }; +//# sourceMappingURL=log-out.component.js.map \ No newline at end of file diff --git a/src/app/shared/log-out/log-out.component.js.map b/src/app/shared/log-out/log-out.component.js.map new file mode 100644 index 0000000000..f359683f89 --- /dev/null +++ b/src/app/shared/log-out/log-out.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"log-out.component.js","sourceRoot":"","sources":["log-out.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,GAAG,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAQ7C;IAOE;;;;OAIG;IACH,yBAAoB,MAAc,EACd,KAAsB;QADtB,WAAM,GAAN,MAAM,CAAQ;QACd,UAAK,GAAL,KAAK,CAAiB;IAC1C,CAAC;IAED;;OAEG;IACH,kCAAQ,GAAR;QACE,YAAY;QACZ,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACI,8BAAI,GAAX;QACE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAClC,CAAC;IAEM,gCAAM,GAAb;QACE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;IAC1C,CAAC;IAjCU,eAAe;QAN3B,SAAS,CAAC;YACT,QAAQ,EAAE,YAAY;YACtB,WAAW,EAAE,0BAA0B;YACvC,SAAS,EAAE,CAAC,0BAA0B,CAAC;YACvC,UAAU,EAAE,CAAC,OAAO,CAAC;SACtB,CAAC;iDAa4B,MAAM;YACP,KAAK;OAbrB,eAAe,CAmC3B;IAAD,sBAAC;CAAA,AAnCD,IAmCC;SAnCY,eAAe"} \ No newline at end of file diff --git a/src/app/shared/menu/initial-menus-state.js b/src/app/shared/menu/initial-menus-state.js new file mode 100644 index 0000000000..a1df50135d --- /dev/null +++ b/src/app/shared/menu/initial-menus-state.js @@ -0,0 +1,42 @@ +var _a; +/** + * Availavle Menu IDs + */ +export var MenuID; +(function (MenuID) { + MenuID["ADMIN"] = "admin-sidebar"; + MenuID["PUBLIC"] = "public"; +})(MenuID || (MenuID = {})); +/** + * List of possible MenuItemTypes + */ +export var MenuItemType; +(function (MenuItemType) { + MenuItemType[MenuItemType["TEXT"] = 0] = "TEXT"; + MenuItemType[MenuItemType["LINK"] = 1] = "LINK"; + MenuItemType[MenuItemType["ALTMETRIC"] = 2] = "ALTMETRIC"; + MenuItemType[MenuItemType["SEARCH"] = 3] = "SEARCH"; + MenuItemType[MenuItemType["ONCLICK"] = 4] = "ONCLICK"; +})(MenuItemType || (MenuItemType = {})); +/** + * The initial state of the menus + */ +export var initialMenusState = (_a = {}, + _a[MenuID.ADMIN] = { + id: MenuID.ADMIN, + collapsed: true, + previewCollapsed: true, + visible: false, + sections: {}, + sectionToSubsectionIndex: {} + }, + _a[MenuID.PUBLIC] = { + id: MenuID.PUBLIC, + collapsed: true, + previewCollapsed: true, + visible: true, + sections: {}, + sectionToSubsectionIndex: {} + }, + _a); +//# sourceMappingURL=initial-menus-state.js.map \ No newline at end of file diff --git a/src/app/shared/menu/initial-menus-state.js.map b/src/app/shared/menu/initial-menus-state.js.map new file mode 100644 index 0000000000..8489a45d64 --- /dev/null +++ b/src/app/shared/menu/initial-menus-state.js.map @@ -0,0 +1 @@ +{"version":3,"file":"initial-menus-state.js","sourceRoot":"","sources":["initial-menus-state.ts"],"names":[],"mappings":";AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,iCAAuB,CAAA;IACvB,2BAAiB,CAAA;AACnB,CAAC,EAHW,MAAM,KAAN,MAAM,QAGjB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,YAEX;AAFD,WAAY,YAAY;IACtB,+CAAI,CAAA;IAAE,+CAAI,CAAA;IAAE,yDAAS,CAAA;IAAE,mDAAM,CAAA;IAAE,qDAAO,CAAA;AACxC,CAAC,EAFW,YAAY,KAAZ,YAAY,QAEvB;AAED;;GAEG;AACH,MAAM,CAAC,IAAM,iBAAiB;IAC5B,GAAC,MAAM,CAAC,KAAK,IACX;QACE,EAAE,EAAE,MAAM,CAAC,KAAK;QAChB,SAAS,EAAE,IAAI;QACf,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,EAAE;QACZ,wBAAwB,EAAE,EAAE;KAC7B;IACH,GAAC,MAAM,CAAC,MAAM,IACZ;QACE,EAAE,EAAE,MAAM,CAAC,MAAM;QACjB,SAAS,EAAE,IAAI;QACf,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,EAAE;QACZ,wBAAwB,EAAE,EAAE;KAC7B;OACJ,CAAC"} \ No newline at end of file diff --git a/src/app/shared/menu/menu-item.decorator.js b/src/app/shared/menu/menu-item.decorator.js new file mode 100644 index 0000000000..3e6584ced7 --- /dev/null +++ b/src/app/shared/menu/menu-item.decorator.js @@ -0,0 +1,23 @@ +var menuMenuItemComponentMap = new Map(); +/** + * Decorator function to link a MenuItemType to a Component + * @param {MenuItemType} type The MenuItemType of the MenuSection's model + * @returns {(sectionComponent: GenericContructor) => void} + */ +export function rendersMenuItemForType(type) { + return function decorator(sectionComponent) { + if (!sectionComponent) { + return; + } + menuMenuItemComponentMap.set(type, sectionComponent); + }; +} +/** + * Retrieves the Component matching a given MenuItemType + * @param {MenuItemType} type The given MenuItemType + * @returns {GenericConstructor} The constructor of the Component that matches the MenuItemType + */ +export function getComponentForMenuItemType(type) { + return menuMenuItemComponentMap.get(type); +} +//# sourceMappingURL=menu-item.decorator.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu-item.decorator.js.map b/src/app/shared/menu/menu-item.decorator.js.map new file mode 100644 index 0000000000..7b8722a87b --- /dev/null +++ b/src/app/shared/menu/menu-item.decorator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"menu-item.decorator.js","sourceRoot":"","sources":["menu-item.decorator.ts"],"names":[],"mappings":"AAEA,IAAM,wBAAwB,GAAG,IAAI,GAAG,EAAE,CAAC;AAE3C;;;;GAIG;AACH,MAAM,iCAAiC,IAAkB;IACvD,OAAO,mBAAmB,gBAAqB;QAC7C,IAAI,CAAC,gBAAgB,EAAE;YACrB,OAAO;SACR;QACD,wBAAwB,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,sCAAsC,IAAkB;IAC5D,OAAO,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC"} \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/link-menu-item.component.js b/src/app/shared/menu/menu-item/link-menu-item.component.js new file mode 100644 index 0000000000..3f5af87f61 --- /dev/null +++ b/src/app/shared/menu/menu-item/link-menu-item.component.js @@ -0,0 +1,37 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { LinkMenuItemModel } from './models/link.model'; +import { MenuItemType } from '../initial-menus-state'; +import { rendersMenuItemForType } from '../menu-item.decorator'; +import { GLOBAL_CONFIG } from '../../../../config'; +import { isNotEmpty } from '../../empty.util'; +/** + * Component that renders a menu section of type LINK + */ +var LinkMenuItemComponent = /** @class */ (function () { + function LinkMenuItemComponent(item, EnvConfig) { + this.EnvConfig = EnvConfig; + this.item = item; + } + LinkMenuItemComponent.prototype.ngOnInit = function () { + this.hasLink = isNotEmpty(this.item.link); + }; + LinkMenuItemComponent.prototype.getRouterLink = function () { + if (this.hasLink) { + return this.EnvConfig.ui.nameSpace + this.item.link; + } + return undefined; + }; + LinkMenuItemComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-link-menu-item', + templateUrl: './link-menu-item.component.html' + }), + rendersMenuItemForType(MenuItemType.LINK), + tslib_1.__param(0, Inject('itemModelProvider')), tslib_1.__param(1, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [LinkMenuItemModel, Object]) + ], LinkMenuItemComponent); + return LinkMenuItemComponent; +}()); +export { LinkMenuItemComponent }; +//# sourceMappingURL=link-menu-item.component.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/link-menu-item.component.js.map b/src/app/shared/menu/menu-item/link-menu-item.component.js.map new file mode 100644 index 0000000000..4c12ee42e4 --- /dev/null +++ b/src/app/shared/menu/menu-item/link-menu-item.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"link-menu-item.component.js","sourceRoot":"","sources":["link-menu-item.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAgB,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;GAEG;AAMH;IAGE,+BAAyC,IAAuB,EAAiC,SAAuB;QAAvB,cAAS,GAAT,SAAS,CAAc;QACtH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,wCAAQ,GAAR;QACE,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,6CAAa,GAAb;QACE,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;SACrD;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAhBU,qBAAqB;QALjC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,WAAW,EAAE,iCAAiC;SAC/C,CAAC;QACD,sBAAsB,CAAC,YAAY,CAAC,IAAI,CAAC;QAI3B,mBAAA,MAAM,CAAC,mBAAmB,CAAC,CAAA,EAA2B,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;iDAAzC,iBAAiB;OAHrD,qBAAqB,CAkBjC;IAAD,4BAAC;CAAA,AAlBD,IAkBC;SAlBY,qBAAqB"} \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/models/altmetric.model.js b/src/app/shared/menu/menu-item/models/altmetric.model.js new file mode 100644 index 0000000000..1cac0f5573 --- /dev/null +++ b/src/app/shared/menu/menu-item/models/altmetric.model.js @@ -0,0 +1,12 @@ +import { MenuItemType } from '../../initial-menus-state'; +/** + * Model representing an Altmetric Menu Section + */ +var AltmetricMenuItemModel = /** @class */ (function () { + function AltmetricMenuItemModel() { + this.type = MenuItemType.ALTMETRIC; + } + return AltmetricMenuItemModel; +}()); +export { AltmetricMenuItemModel }; +//# sourceMappingURL=altmetric.model.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/models/altmetric.model.js.map b/src/app/shared/menu/menu-item/models/altmetric.model.js.map new file mode 100644 index 0000000000..73415c2848 --- /dev/null +++ b/src/app/shared/menu/menu-item/models/altmetric.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"altmetric.model.js","sourceRoot":"","sources":["altmetric.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD;;GAEG;AACH;IAAA;QACE,SAAI,GAAG,YAAY,CAAC,SAAS,CAAC;IAEhC,CAAC;IAAD,6BAAC;AAAD,CAAC,AAHD,IAGC"} \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/models/link.model.js b/src/app/shared/menu/menu-item/models/link.model.js new file mode 100644 index 0000000000..5e9c7e136e --- /dev/null +++ b/src/app/shared/menu/menu-item/models/link.model.js @@ -0,0 +1,12 @@ +import { MenuItemType } from '../../initial-menus-state'; +/** + * Model representing an Link Menu Section + */ +var LinkMenuItemModel = /** @class */ (function () { + function LinkMenuItemModel() { + this.type = MenuItemType.LINK; + } + return LinkMenuItemModel; +}()); +export { LinkMenuItemModel }; +//# sourceMappingURL=link.model.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/models/link.model.js.map b/src/app/shared/menu/menu-item/models/link.model.js.map new file mode 100644 index 0000000000..636a9341bd --- /dev/null +++ b/src/app/shared/menu/menu-item/models/link.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"link.model.js","sourceRoot":"","sources":["link.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;GAEG;AACH;IAAA;QACE,SAAI,GAAG,YAAY,CAAC,IAAI,CAAC;IAG3B,CAAC;IAAD,wBAAC;AAAD,CAAC,AAJD,IAIC"} \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/models/menu-item.model.js b/src/app/shared/menu/menu-item/models/menu-item.model.js new file mode 100644 index 0000000000..89b0604ff6 --- /dev/null +++ b/src/app/shared/menu/menu-item/models/menu-item.model.js @@ -0,0 +1 @@ +//# sourceMappingURL=menu-item.model.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/models/menu-item.model.js.map b/src/app/shared/menu/menu-item/models/menu-item.model.js.map new file mode 100644 index 0000000000..8da54788a1 --- /dev/null +++ b/src/app/shared/menu/menu-item/models/menu-item.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"menu-item.model.js","sourceRoot":"","sources":["menu-item.model.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/models/onclick.model.js b/src/app/shared/menu/menu-item/models/onclick.model.js new file mode 100644 index 0000000000..d10d394350 --- /dev/null +++ b/src/app/shared/menu/menu-item/models/onclick.model.js @@ -0,0 +1,12 @@ +import { MenuItemType } from '../../initial-menus-state'; +/** + * Model representing an OnClick Menu Section + */ +var OnClickMenuItemModel = /** @class */ (function () { + function OnClickMenuItemModel() { + this.type = MenuItemType.ONCLICK; + } + return OnClickMenuItemModel; +}()); +export { OnClickMenuItemModel }; +//# sourceMappingURL=onclick.model.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/models/onclick.model.js.map b/src/app/shared/menu/menu-item/models/onclick.model.js.map new file mode 100644 index 0000000000..59a643d0fb --- /dev/null +++ b/src/app/shared/menu/menu-item/models/onclick.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"onclick.model.js","sourceRoot":"","sources":["onclick.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;GAEG;AACH;IAAA;QACE,SAAI,GAAG,YAAY,CAAC,OAAO,CAAC;IAG9B,CAAC;IAAD,2BAAC;AAAD,CAAC,AAJD,IAIC"} \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/models/search.model.js b/src/app/shared/menu/menu-item/models/search.model.js new file mode 100644 index 0000000000..d44f7691dc --- /dev/null +++ b/src/app/shared/menu/menu-item/models/search.model.js @@ -0,0 +1,12 @@ +import { MenuItemType } from '../../initial-menus-state'; +/** + * Model representing an Search Bar Menu Section + */ +var SearchMenuItemModel = /** @class */ (function () { + function SearchMenuItemModel() { + this.type = MenuItemType.SEARCH; + } + return SearchMenuItemModel; +}()); +export { SearchMenuItemModel }; +//# sourceMappingURL=search.model.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/models/search.model.js.map b/src/app/shared/menu/menu-item/models/search.model.js.map new file mode 100644 index 0000000000..e6e39f74d4 --- /dev/null +++ b/src/app/shared/menu/menu-item/models/search.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search.model.js","sourceRoot":"","sources":["search.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD;;GAEG;AACH;IAAA;QACE,SAAI,GAAG,YAAY,CAAC,MAAM,CAAC;IAG7B,CAAC;IAAD,0BAAC;AAAD,CAAC,AAJD,IAIC"} \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/models/text.model.js b/src/app/shared/menu/menu-item/models/text.model.js new file mode 100644 index 0000000000..1eb4302f75 --- /dev/null +++ b/src/app/shared/menu/menu-item/models/text.model.js @@ -0,0 +1,12 @@ +import { MenuItemType } from '../../initial-menus-state'; +/** + * Model representing an Text Menu Section + */ +var TextMenuItemModel = /** @class */ (function () { + function TextMenuItemModel() { + this.type = MenuItemType.TEXT; + } + return TextMenuItemModel; +}()); +export { TextMenuItemModel }; +//# sourceMappingURL=text.model.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/models/text.model.js.map b/src/app/shared/menu/menu-item/models/text.model.js.map new file mode 100644 index 0000000000..48869ed6bf --- /dev/null +++ b/src/app/shared/menu/menu-item/models/text.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"text.model.js","sourceRoot":"","sources":["text.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD;;GAEG;AACH;IAAA;QACE,SAAI,GAAG,YAAY,CAAC,IAAI,CAAC;IAE3B,CAAC;IAAD,wBAAC;AAAD,CAAC,AAHD,IAGC"} \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/onclick-menu-item.component.js b/src/app/shared/menu/menu-item/onclick-menu-item.component.js new file mode 100644 index 0000000000..18540a54f5 --- /dev/null +++ b/src/app/shared/menu/menu-item/onclick-menu-item.component.js @@ -0,0 +1,26 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { MenuItemType } from '../initial-menus-state'; +import { rendersMenuItemForType } from '../menu-item.decorator'; +import { OnClickMenuItemModel } from './models/onclick.model'; +/** + * Component that renders a menu section of type ONCLICK + */ +var OnClickMenuItemComponent = /** @class */ (function () { + function OnClickMenuItemComponent(item) { + this.item = item; + } + OnClickMenuItemComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-onclick-menu-item', + styleUrls: ['./onclick-menu-item.component.scss'], + templateUrl: './onclick-menu-item.component.html' + }), + rendersMenuItemForType(MenuItemType.ONCLICK), + tslib_1.__param(0, Inject('itemModelProvider')), + tslib_1.__metadata("design:paramtypes", [OnClickMenuItemModel]) + ], OnClickMenuItemComponent); + return OnClickMenuItemComponent; +}()); +export { OnClickMenuItemComponent }; +//# sourceMappingURL=onclick-menu-item.component.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/onclick-menu-item.component.js.map b/src/app/shared/menu/menu-item/onclick-menu-item.component.js.map new file mode 100644 index 0000000000..ea5c67a88f --- /dev/null +++ b/src/app/shared/menu/menu-item/onclick-menu-item.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"onclick-menu-item.component.js","sourceRoot":"","sources":["onclick-menu-item.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AAOH;IAEE,kCAAyC,IAA0B;QACjE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAJU,wBAAwB;QANpC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,SAAS,EAAE,CAAC,oCAAoC,CAAC;YACjD,WAAW,EAAE,oCAAoC;SAClD,CAAC;QACD,sBAAsB,CAAC,YAAY,CAAC,OAAO,CAAC;QAG9B,mBAAA,MAAM,CAAC,mBAAmB,CAAC,CAAA;iDAAO,oBAAoB;OAFxD,wBAAwB,CAKpC;IAAD,+BAAC;CAAA,AALD,IAKC;SALY,wBAAwB"} \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/text-menu-item.component.js b/src/app/shared/menu/menu-item/text-menu-item.component.js new file mode 100644 index 0000000000..c685907d6d --- /dev/null +++ b/src/app/shared/menu/menu-item/text-menu-item.component.js @@ -0,0 +1,25 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { TextMenuItemModel } from './models/text.model'; +import { MenuItemType } from '../initial-menus-state'; +import { rendersMenuItemForType } from '../menu-item.decorator'; +/** + * Component that renders a menu section of type TEXT + */ +var TextMenuItemComponent = /** @class */ (function () { + function TextMenuItemComponent(item) { + this.item = item; + } + TextMenuItemComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-text-menu-item', + templateUrl: './text-menu-item.component.html', + }), + rendersMenuItemForType(MenuItemType.TEXT), + tslib_1.__param(0, Inject('itemModelProvider')), + tslib_1.__metadata("design:paramtypes", [TextMenuItemModel]) + ], TextMenuItemComponent); + return TextMenuItemComponent; +}()); +export { TextMenuItemComponent }; +//# sourceMappingURL=text-menu-item.component.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu-item/text-menu-item.component.js.map b/src/app/shared/menu/menu-item/text-menu-item.component.js.map new file mode 100644 index 0000000000..cc2e7848db --- /dev/null +++ b/src/app/shared/menu/menu-item/text-menu-item.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"text-menu-item.component.js","sourceRoot":"","sources":["text-menu-item.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAS,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;GAEG;AAMH;IAEE,+BAAyC,IAAuB;QAC9D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAJU,qBAAqB;QALjC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,WAAW,EAAE,iCAAiC;SAC/C,CAAC;QACD,sBAAsB,CAAC,YAAY,CAAC,IAAI,CAAC;QAG3B,mBAAA,MAAM,CAAC,mBAAmB,CAAC,CAAA;iDAAO,iBAAiB;OAFrD,qBAAqB,CAKjC;IAAD,4BAAC;CAAA,AALD,IAKC;SALY,qBAAqB"} \ No newline at end of file diff --git a/src/app/shared/menu/menu-section.decorator.js b/src/app/shared/menu/menu-section.decorator.js new file mode 100644 index 0000000000..72121ea7ba --- /dev/null +++ b/src/app/shared/menu/menu-section.decorator.js @@ -0,0 +1,28 @@ +var menuComponentMap = new Map(); +/** + * Decorator function to render a MenuSection for a menu + * @param {MenuID} menuID The ID of the Menu in which the section is rendered + * @param {boolean} expandable True when the section should be expandable, false when if should not + * @returns {(menuSectionWrapperComponent: GenericConstructor) => void} + */ +export function rendersSectionForMenu(menuID, expandable) { + return function decorator(menuSectionWrapperComponent) { + if (!menuSectionWrapperComponent) { + return; + } + if (!menuComponentMap.get(menuID)) { + menuComponentMap.set(menuID, new Map()); + } + menuComponentMap.get(menuID).set(expandable, menuSectionWrapperComponent); + }; +} +/** + * Retrieves the component matching the given MenuID and whether or not it should be expandable + * @param {MenuID} menuID The ID of the Menu in which the section is rendered + * @param {boolean} expandable True when the section should be expandable, false when if should not + * @returns {GenericConstructor} The constructor of the matching Component + */ +export function getComponentForMenu(menuID, expandable) { + return menuComponentMap.get(menuID).get(expandable); +} +//# sourceMappingURL=menu-section.decorator.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu-section.decorator.js.map b/src/app/shared/menu/menu-section.decorator.js.map new file mode 100644 index 0000000000..136adbee5a --- /dev/null +++ b/src/app/shared/menu/menu-section.decorator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"menu-section.decorator.js","sourceRoot":"","sources":["menu-section.decorator.ts"],"names":[],"mappings":"AAEA,IAAM,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,gCAAgC,MAAc,EAAE,UAAmB;IACvE,OAAO,mBAAmB,2BAAgC;QACxD,IAAI,CAAC,2BAA2B,EAAE;YAChC,OAAO;SACR;QACD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YACjC,gBAAgB,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;SACzC;QACD,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,2BAA2B,CAAC,CAAC;IAC5E,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,8BAA8B,MAAc,EAAE,UAAmB;IACrE,OAAO,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACtD,CAAC"} \ No newline at end of file diff --git a/src/app/shared/menu/menu-section/menu-section.component.js b/src/app/shared/menu/menu-section/menu-section.component.js new file mode 100644 index 0000000000..ddfeae5ca7 --- /dev/null +++ b/src/app/shared/menu/menu-section/menu-section.component.js @@ -0,0 +1,107 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector } from '@angular/core'; +import { MenuService } from '../menu.service'; +import { MenuSection } from '../menu.reducer'; +import { getComponentForMenuItemType } from '../menu-item.decorator'; +import { hasNoValue } from '../../empty.util'; +import { distinctUntilChanged } from 'rxjs/operators'; +/** + * A basic implementation of a menu section's component + */ +var MenuSectionComponent = /** @class */ (function () { + function MenuSectionComponent(section, menuService, injector) { + this.section = section; + this.menuService = menuService; + this.injector = injector; + /** + * List of Injectors for each dynamically rendered menu item of this section + */ + this.itemInjectors = new Map(); + /** + * List of child Components for each dynamically rendered menu item of this section + */ + this.itemComponents = new Map(); + } + /** + * Set initial values for instance variables + */ + MenuSectionComponent.prototype.ngOnInit = function () { + this.active = this.menuService.isSectionActive(this.menuID, this.section.id).pipe(distinctUntilChanged()); + this.initializeInjectorData(); + }; + /** + * Activate this section if it's currently inactive, deactivate it when it's currently active + * @param {Event} event The user event that triggered this method + */ + MenuSectionComponent.prototype.toggleSection = function (event) { + event.preventDefault(); + this.menuService.toggleActiveSection(this.menuID, this.section.id); + }; + /** + * Activate this section + * @param {Event} event The user event that triggered this method + */ + MenuSectionComponent.prototype.activateSection = function (event) { + event.preventDefault(); + this.menuService.activateSection(this.menuID, this.section.id); + }; + /** + * Deactivate this section + * @param {Event} event The user event that triggered this method + */ + MenuSectionComponent.prototype.deactivateSection = function (event) { + event.preventDefault(); + this.menuService.deactivateSection(this.menuID, this.section.id); + }; + /** + * Method for initializing all injectors and component constructors for the menu items in this section + */ + MenuSectionComponent.prototype.initializeInjectorData = function () { + var _this = this; + this.itemInjectors.set(this.section.id, this.getItemModelInjector(this.section.model)); + this.itemComponents.set(this.section.id, this.getMenuItemComponent(this.section.model)); + this.subSections = this.menuService.getSubSectionsByParentID(this.menuID, this.section.id); + this.subSections.subscribe(function (sections) { + sections.forEach(function (section) { + _this.itemInjectors.set(section.id, _this.getItemModelInjector(section.model)); + _this.itemComponents.set(section.id, _this.getMenuItemComponent(section.model)); + }); + }); + }; + /** + * Retrieve the component for a given MenuItemModel object + * @param {MenuItemModel} itemModel The given MenuItemModel + * @returns {GenericConstructor} Emits the constructor of the Component that should be used to render this menu item model + */ + MenuSectionComponent.prototype.getMenuItemComponent = function (itemModel) { + if (hasNoValue(itemModel)) { + itemModel = this.section.model; + } + var type = itemModel.type; + return getComponentForMenuItemType(type); + }; + /** + * Retrieve the Injector for a given MenuItemModel object + * @param {MenuItemModel} itemModel The given MenuItemModel + * @returns {Injector} The Injector that injects the data for this menu item into the item's component + */ + MenuSectionComponent.prototype.getItemModelInjector = function (itemModel) { + if (hasNoValue(itemModel)) { + itemModel = this.section.model; + } + return Injector.create({ + providers: [{ provide: 'itemModelProvider', useFactory: function () { return (itemModel); }, deps: [] }], + parent: this.injector + }); + }; + MenuSectionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-menu-section', + template: '' + }), + tslib_1.__metadata("design:paramtypes", [MenuSection, MenuService, Injector]) + ], MenuSectionComponent); + return MenuSectionComponent; +}()); +export { MenuSectionComponent }; +//# sourceMappingURL=menu-section.component.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu-section/menu-section.component.js.map b/src/app/shared/menu/menu-section/menu-section.component.js.map new file mode 100644 index 0000000000..b3058584da --- /dev/null +++ b/src/app/shared/menu/menu-section/menu-section.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"menu-section.component.js","sourceRoot":"","sources":["menu-section.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD;;GAEG;AAKH;IA2BE,8BAAmB,OAAoB,EAAY,WAAwB,EAAY,QAAkB;QAAtF,YAAO,GAAP,OAAO,CAAa;QAAY,gBAAW,GAAX,WAAW,CAAa;QAAY,aAAQ,GAAR,QAAQ,CAAU;QAfzG;;WAEG;QACH,kBAAa,GAA0B,IAAI,GAAG,EAAoB,CAAC;QAEnE;;WAEG;QACH,mBAAc,GAA0D,IAAI,GAAG,EAAoD,CAAC;IAQpI,CAAC;IAED;;OAEG;IACH,uCAAQ,GAAR;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QAC1G,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,4CAAa,GAAb,UAAc,KAAY;QACxB,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACH,8CAAe,GAAf,UA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C,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;;;OAIG;IACK,mDAAoB,GAA5B,UAA6B,SAAyB;QACpD,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE;YACzB,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;SAChC;QACD,IAAM,IAAI,GAAiB,SAAS,CAAC,IAAI,CAAC;QAC1C,OAAO,2BAA2B,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACK,mDAAoB,GAA5B,UAA6B,SAAyB;QACpD,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE;YACzB,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;SAChC;QACD,OAAO,QAAQ,CAAC,MAAM,CAAC;YACrB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,cAAM,OAAA,CAAC,SAAS,CAAC,EAAX,CAAW,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;YACtF,MAAM,EAAE,IAAI,CAAC,QAAQ;SACtB,CAAC,CAAC;IACL,CAAC;IA1GU,oBAAoB;QAJhC,SAAS,CAAC;YACT,QAAQ,EAAE,iBAAiB;YAC3B,QAAQ,EAAE,EAAE;SACb,CAAC;iDA4B4B,WAAW,EAAyB,WAAW,EAAsB,QAAQ;OA3B9F,oBAAoB,CA4GhC;IAAD,2BAAC;CAAA,AA5GD,IA4GC;SA5GY,oBAAoB"} \ No newline at end of file diff --git a/src/app/shared/menu/menu.actions.js b/src/app/shared/menu/menu.actions.js new file mode 100644 index 0000000000..f8995ca1a8 --- /dev/null +++ b/src/app/shared/menu/menu.actions.js @@ -0,0 +1,211 @@ +import * as tslib_1 from "tslib"; +import { type } from '../ngrx/type'; +/** + * For each action type in an action group, make a simple + * enum object for all of this group's action types. + * + * The 'type' utility function coerces strings into string + * literal types and runs a simple check to guarantee all + * action types in the application are unique. + */ +export var MenuActionTypes = { + COLLAPSE_MENU: type('dspace/menu/COLLAPSE_MENU'), + TOGGLE_MENU: type('dspace/menu/TOGGLE_MENU'), + EXPAND_MENU: type('dspace/menu/EXPAND_MENU'), + SHOW_MENU: type('dspace/menu/SHOW_MENU'), + HIDE_MENU: type('dspace/menu/HIDE_MENU'), + COLLAPSE_MENU_PREVIEW: type('dspace/menu/COLLAPSE_MENU_PREVIEW'), + EXPAND_MENU_PREVIEW: type('dspace/menu/EXPAND_MENU_PREVIEW'), + ADD_SECTION: type('dspace/menu-section/ADD_SECTION'), + REMOVE_SECTION: type('dspace/menu-section/REMOVE_SECTION'), + SHOW_SECTION: type('dspace/menu-section/SHOW_SECTION'), + HIDE_SECTION: type('dspace/menu-section/HIDE_SECTION'), + ACTIVATE_SECTION: type('dspace/menu-section/ACTIVATE_SECTION'), + DEACTIVATE_SECTION: type('dspace/menu-section/DEACTIVATE_SECTION'), + TOGGLE_ACTIVE_SECTION: type('dspace/menu-section/TOGGLE_ACTIVE_SECTION'), +}; +/* tslint:disable:max-classes-per-file */ +// MENU STATE ACTIONS +/** + * Action used to collapse a single menu + */ +var CollapseMenuAction = /** @class */ (function () { + function CollapseMenuAction(menuID) { + this.type = MenuActionTypes.COLLAPSE_MENU; + this.menuID = menuID; + } + return CollapseMenuAction; +}()); +export { CollapseMenuAction }; +/** + * Action used to expand a single menu + */ +var ExpandMenuAction = /** @class */ (function () { + function ExpandMenuAction(menuID) { + this.type = MenuActionTypes.EXPAND_MENU; + this.menuID = menuID; + } + return ExpandMenuAction; +}()); +export { ExpandMenuAction }; +/** + * Action used to collapse a single menu when it's expanded and expanded it when it's collapse + */ +var ToggleMenuAction = /** @class */ (function () { + function ToggleMenuAction(menuID) { + this.type = MenuActionTypes.TOGGLE_MENU; + this.menuID = menuID; + } + return ToggleMenuAction; +}()); +export { ToggleMenuAction }; +/** + * Action used to show a single menu + */ +var ShowMenuAction = /** @class */ (function () { + function ShowMenuAction(menuID) { + this.type = MenuActionTypes.SHOW_MENU; + this.menuID = menuID; + } + return ShowMenuAction; +}()); +export { ShowMenuAction }; +/** + * Action used to hide a single menu + */ +var HideMenuAction = /** @class */ (function () { + function HideMenuAction(menuID) { + this.type = MenuActionTypes.HIDE_MENU; + this.menuID = menuID; + } + return HideMenuAction; +}()); +export { HideMenuAction }; +/** + * Action used to collapse a single menu's preview + */ +var CollapseMenuPreviewAction = /** @class */ (function () { + function CollapseMenuPreviewAction(menuID) { + this.type = MenuActionTypes.COLLAPSE_MENU_PREVIEW; + this.menuID = menuID; + } + return CollapseMenuPreviewAction; +}()); +export { CollapseMenuPreviewAction }; +/** + * Action used to expand a single menu's preview + */ +var ExpandMenuPreviewAction = /** @class */ (function () { + function ExpandMenuPreviewAction(menuID) { + this.type = MenuActionTypes.EXPAND_MENU_PREVIEW; + this.menuID = menuID; + } + return ExpandMenuPreviewAction; +}()); +export { ExpandMenuPreviewAction }; +// MENU SECTION ACTIONS +/** + * Action used to perform state changes for a section of a certain menu + */ +var MenuSectionAction = /** @class */ (function () { + function MenuSectionAction(menuID, id) { + this.menuID = menuID; + this.id = id; + } + return MenuSectionAction; +}()); +export { MenuSectionAction }; +/** + * Action used to add a section to a certain menu + */ +var AddMenuSectionAction = /** @class */ (function (_super) { + tslib_1.__extends(AddMenuSectionAction, _super); + function AddMenuSectionAction(menuID, section) { + var _this = _super.call(this, menuID, section.id) || this; + _this.type = MenuActionTypes.ADD_SECTION; + _this.section = section; + return _this; + } + return AddMenuSectionAction; +}(MenuSectionAction)); +export { AddMenuSectionAction }; +/** + * Action used to remove a section from a certain menu + */ +var RemoveMenuSectionAction = /** @class */ (function (_super) { + tslib_1.__extends(RemoveMenuSectionAction, _super); + function RemoveMenuSectionAction(menuID, id) { + var _this = _super.call(this, menuID, id) || this; + _this.type = MenuActionTypes.REMOVE_SECTION; + return _this; + } + return RemoveMenuSectionAction; +}(MenuSectionAction)); +export { RemoveMenuSectionAction }; +/** + * Action used to hide a section of a certain menu + */ +var HideMenuSectionAction = /** @class */ (function (_super) { + tslib_1.__extends(HideMenuSectionAction, _super); + function HideMenuSectionAction(menuID, id) { + var _this = _super.call(this, menuID, id) || this; + _this.type = MenuActionTypes.HIDE_SECTION; + return _this; + } + return HideMenuSectionAction; +}(MenuSectionAction)); +export { HideMenuSectionAction }; +/** + * Action used to show a section of a certain menu + */ +var ShowMenuSectionAction = /** @class */ (function (_super) { + tslib_1.__extends(ShowMenuSectionAction, _super); + function ShowMenuSectionAction(menuID, id) { + var _this = _super.call(this, menuID, id) || this; + _this.type = MenuActionTypes.SHOW_SECTION; + return _this; + } + return ShowMenuSectionAction; +}(MenuSectionAction)); +export { ShowMenuSectionAction }; +/** + * Action used to make a section of a certain menu active + */ +var ActivateMenuSectionAction = /** @class */ (function (_super) { + tslib_1.__extends(ActivateMenuSectionAction, _super); + function ActivateMenuSectionAction(menuID, id) { + var _this = _super.call(this, menuID, id) || this; + _this.type = MenuActionTypes.ACTIVATE_SECTION; + return _this; + } + return ActivateMenuSectionAction; +}(MenuSectionAction)); +export { ActivateMenuSectionAction }; +/** + * Action used to make a section of a certain menu inactive + */ +var DeactivateMenuSectionAction = /** @class */ (function (_super) { + tslib_1.__extends(DeactivateMenuSectionAction, _super); + function DeactivateMenuSectionAction(menuID, id) { + var _this = _super.call(this, menuID, id) || this; + _this.type = MenuActionTypes.DEACTIVATE_SECTION; + return _this; + } + return DeactivateMenuSectionAction; +}(MenuSectionAction)); +export { DeactivateMenuSectionAction }; +/** + * Action used to make an active section of a certain menu inactive or an inactive section of a certain menu active + */ +var ToggleActiveMenuSectionAction = /** @class */ (function (_super) { + tslib_1.__extends(ToggleActiveMenuSectionAction, _super); + function ToggleActiveMenuSectionAction(menuID, id) { + var _this = _super.call(this, menuID, id) || this; + _this.type = MenuActionTypes.TOGGLE_ACTIVE_SECTION; + return _this; + } + return ToggleActiveMenuSectionAction; +}(MenuSectionAction)); +export { ToggleActiveMenuSectionAction }; +/* tslint:enable:max-classes-per-file */ +//# sourceMappingURL=menu.actions.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu.actions.js.map b/src/app/shared/menu/menu.actions.js.map new file mode 100644 index 0000000000..a035b03cbe --- /dev/null +++ b/src/app/shared/menu/menu.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"menu.actions.js","sourceRoot":"","sources":["menu.actions.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG;IAC7B,aAAa,EAAE,IAAI,CAAC,2BAA2B,CAAC;IAChD,WAAW,EAAE,IAAI,CAAC,yBAAyB,CAAC;IAC5C,WAAW,EAAE,IAAI,CAAC,yBAAyB,CAAC;IAC5C,SAAS,EAAE,IAAI,CAAC,uBAAuB,CAAC;IACxC,SAAS,EAAE,IAAI,CAAC,uBAAuB,CAAC;IACxC,qBAAqB,EAAE,IAAI,CAAC,mCAAmC,CAAC;IAChE,mBAAmB,EAAE,IAAI,CAAC,iCAAiC,CAAC;IAC5D,WAAW,EAAE,IAAI,CAAC,iCAAiC,CAAC;IACpD,cAAc,EAAE,IAAI,CAAC,oCAAoC,CAAC;IAC1D,YAAY,EAAE,IAAI,CAAC,kCAAkC,CAAC;IACtD,YAAY,EAAE,IAAI,CAAC,kCAAkC,CAAC;IACtD,gBAAgB,EAAE,IAAI,CAAC,sCAAsC,CAAC;IAC9D,kBAAkB,EAAE,IAAI,CAAC,wCAAwC,CAAC;IAClE,qBAAqB,EAAE,IAAI,CAAC,2CAA2C,CAAC;CACzE,CAAC;AAEF,yCAAyC;AAEzC,qBAAqB;AACrB;;GAEG;AACH;IAIE,4BAAY,MAAc;QAH1B,SAAI,GAAG,eAAe,CAAC,aAAa,CAAC;QAInC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IACH,yBAAC;AAAD,CAAC,AAPD,IAOC;;AAED;;GAEG;AACH;IAIE,0BAAY,MAAc;QAH1B,SAAI,GAAG,eAAe,CAAC,WAAW,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G,eAAe,CAAC,kBAAkB,CAAC;;IAI1C,CAAC;IACH,kCAAC;AAAD,CAAC,AAND,CAAiD,iBAAiB,GAMjE;;AAED;;GAEG;AACH;IAAmD,yDAAiB;IAGlE,uCAAY,MAAc,EAAE,EAAU;QAAtC,YACE,kBAAM,MAAM,EAAE,EAAE,CAAC,SAClB;QAJD,UAAI,GAAG,eAAe,CAAC,qBAAqB,CAAC;;IAI7C,CAAC;IACH,oCAAC;AAAD,CAAC,AAND,CAAmD,iBAAiB,GAMnE;;AAeD,wCAAwC"} \ No newline at end of file diff --git a/src/app/shared/menu/menu.component.js b/src/app/shared/menu/menu.component.js new file mode 100644 index 0000000000..72ce74e22a --- /dev/null +++ b/src/app/shared/menu/menu.component.js @@ -0,0 +1,125 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector } from '@angular/core'; +import { MenuService } from '../../shared/menu/menu.service'; +import { first, map } from 'rxjs/operators'; +import { hasValue } from '../empty.util'; +import { getComponentForMenu } from './menu-section.decorator'; +/** + * A basic implementation of a MenuComponent + */ +var MenuComponent = /** @class */ (function () { + function MenuComponent(menuService, injector) { + this.menuService = menuService; + this.injector = injector; + /** + * List of Injectors for each dynamically rendered menu section + */ + this.sectionInjectors = new Map(); + /** + * List of child Components for each dynamically rendered menu section + */ + this.sectionComponents = new Map(); + } + /** + * Sets all instance variables to their initial values + */ + MenuComponent.prototype.ngOnInit = function () { + var _this = this; + this.menuCollapsed = this.menuService.isMenuCollapsed(this.menuID); + this.menuPreviewCollapsed = this.menuService.isMenuPreviewCollapsed(this.menuID); + this.menuVisible = this.menuService.isMenuVisible(this.menuID); + this.sections = this.menuService.getMenuTopSections(this.menuID).pipe(first()); + this.sections.subscribe(function (sections) { + sections.forEach(function (section) { + _this.sectionInjectors.set(section.id, _this.getSectionDataInjector(section)); + _this.getSectionComponent(section).pipe(first()).subscribe(function (constr) { return _this.sectionComponents.set(section.id, constr); }); + }); + }); + }; + /** + * Collapse this menu when it's currently expanded, expand it when its currently collapsed + * @param {Event} event The user event that triggered this method + */ + MenuComponent.prototype.toggle = function (event) { + event.preventDefault(); + this.menuService.toggleMenu(this.menuID); + }; + /** + * Expand this menu + * @param {Event} event The user event that triggered this method + */ + MenuComponent.prototype.expand = function (event) { + event.preventDefault(); + this.menuService.expandMenu(this.menuID); + }; + /** + * Collapse this menu + * @param {Event} event The user event that triggered this method + */ + MenuComponent.prototype.collapse = function (event) { + event.preventDefault(); + this.menuService.collapseMenu(this.menuID); + }; + /** + * Expand this menu's preview + * @param {Event} event The user event that triggered this method + */ + MenuComponent.prototype.expandPreview = function (event) { + var _this = this; + event.preventDefault(); + this.previewToggleDebounce(function () { return _this.menuService.expandMenuPreview(_this.menuID); }, 100); + }; + /** + * Collapse this menu's preview + * @param {Event} event The user event that triggered this method + */ + MenuComponent.prototype.collapsePreview = function (event) { + var _this = this; + event.preventDefault(); + this.previewToggleDebounce(function () { return _this.menuService.collapseMenuPreview(_this.menuID); }, 400); + }; + /** + * delay the handler function by the given amount of time + * + * @param {Function} handler The function to delay + * @param {number} ms The amount of ms to delay the handler function by + */ + MenuComponent.prototype.previewToggleDebounce = function (handler, ms) { + if (hasValue(this.previewTimer)) { + clearTimeout(this.previewTimer); + } + this.previewTimer = setTimeout(handler, ms); + }; + /** + * Retrieve the component for a given MenuSection object + * @param {MenuSection} section The given MenuSection + * @returns {Observable>} Emits the constructor of the Component that should be used to render this object + */ + MenuComponent.prototype.getSectionComponent = function (section) { + var _this = this; + return this.menuService.hasSubSections(this.menuID, section.id).pipe(map(function (expandable) { + return getComponentForMenu(_this.menuID, expandable); + })); + }; + /** + * Retrieve the Injector for a given MenuSection object + * @param {MenuSection} section The given MenuSection + * @returns {Injector} The Injector that injects the data for this menu section into the section's component + */ + MenuComponent.prototype.getSectionDataInjector = function (section) { + return Injector.create({ + providers: [{ provide: 'sectionDataProvider', useFactory: function () { return (section); }, deps: [] }], + parent: this.injector + }); + }; + MenuComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-menu', + template: '' + }), + tslib_1.__metadata("design:paramtypes", [MenuService, Injector]) + ], MenuComponent); + return MenuComponent; +}()); +export { MenuComponent }; +//# sourceMappingURL=menu.component.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu.component.js.map b/src/app/shared/menu/menu.component.js.map new file mode 100644 index 0000000000..2624327dcc --- /dev/null +++ b/src/app/shared/menu/menu.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"menu.component.js","sourceRoot":"","sources":["menu.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAA2B,SAAS,EAAE,QAAQ,EAAU,MAAM,eAAe,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAG7D,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D;;GAEG;AAKH;IA8CE,uBAAsB,WAAwB,EAAY,QAAkB;QAAtD,gBAAW,GAAX,WAAW,CAAa;QAAY,aAAQ,GAAR,QAAQ,CAAU;QApB5E;;WAEG;QACH,qBAAgB,GAA0B,IAAI,GAAG,EAAoB,CAAC;QAEtE;;WAEG;QACH,sBAAiB,GAA0D,IAAI,GAAG,EAAoD,CAAC;IAavI,CAAC;IAED;;OAEG;IACH,gCAAQ,GAAR;QAAA,iBAWC;QAVC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnE,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjF,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,WA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CAAC;IAnJU,aAAa;QAJzB,SAAS,CAAC;YACT,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE,EAAE;SACb,CAAC;iDA+CmC,WAAW,EAAsB,QAAQ;OA9CjE,aAAa,CAoJzB;IAAD,oBAAC;CAAA,AApJD,IAoJC;SApJY,aAAa"} \ No newline at end of file diff --git a/src/app/shared/menu/menu.module.js b/src/app/shared/menu/menu.module.js new file mode 100644 index 0000000000..eb759260c3 --- /dev/null +++ b/src/app/shared/menu/menu.module.js @@ -0,0 +1,50 @@ +import * as tslib_1 from "tslib"; +import { MenuSectionComponent } from './menu-section/menu-section.component'; +import { MenuComponent } from './menu.component'; +import { NgModule } from '@angular/core'; +import { TranslateModule } from '@ngx-translate/core'; +import { RouterModule } from '@angular/router'; +import { LinkMenuItemComponent } from './menu-item/link-menu-item.component'; +import { TextMenuItemComponent } from './menu-item/text-menu-item.component'; +import { OnClickMenuItemComponent } from './menu-item/onclick-menu-item.component'; +import { CommonModule } from '@angular/common'; +var COMPONENTS = [ + MenuSectionComponent, + MenuComponent, + LinkMenuItemComponent, + TextMenuItemComponent, + OnClickMenuItemComponent +]; +var ENTRY_COMPONENTS = [ + LinkMenuItemComponent, + TextMenuItemComponent, + OnClickMenuItemComponent +]; +var MODULES = [ + TranslateModule, + RouterModule, + CommonModule +]; +var PROVIDERS = []; +var MenuModule = /** @class */ (function () { + /** + * This module handles all components, providers and modules that are needed for the menu + */ + function MenuModule() { + } + MenuModule = tslib_1.__decorate([ + NgModule({ + imports: MODULES.slice(), + declarations: COMPONENTS.concat(ENTRY_COMPONENTS), + providers: PROVIDERS.slice(), + exports: COMPONENTS.concat(MODULES), + entryComponents: ENTRY_COMPONENTS.slice() + }) + /** + * This module handles all components, providers and modules that are needed for the menu + */ + ], MenuModule); + return MenuModule; +}()); +export { MenuModule }; +//# sourceMappingURL=menu.module.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu.module.js.map b/src/app/shared/menu/menu.module.js.map new file mode 100644 index 0000000000..c6f79a40d6 --- /dev/null +++ b/src/app/shared/menu/menu.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"menu.module.js","sourceRoot":"","sources":["menu.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,IAAM,UAAU,GAAG;IACjB,oBAAoB;IACpB,aAAa;IACb,qBAAqB;IACrB,qBAAqB;IACrB,wBAAwB;CACzB,CAAC;AAEF,IAAM,gBAAgB,GAAG;IACvB,qBAAqB;IACrB,qBAAqB;IACrB,wBAAwB;CACzB,CAAC;AAEF,IAAM,OAAO,GAAG;IACd,eAAe;IACf,YAAY;IACZ,YAAY;CACb,CAAC;AACF,IAAM,SAAS,GAAG,EAEjB,CAAC;AAyBF;IAHA;;OAEG;IACH;IAEA,CAAC;IAFY,UAAU;QAvBtB,QAAQ,CAAC;YACR,OAAO,EACF,OAAO,QACX;YACD,YAAY,EACP,UAAU,QACV,gBAAgB,CACpB;YACD,SAAS,EACJ,SAAS,QACb;YACD,OAAO,EACF,UAAU,QACV,OAAO,CACX;YACD,eAAe,EACV,gBAAgB,QACpB;SACF,CAAC;QAEF;;WAEG;OACU,UAAU,CAEtB;IAAD,iBAAC;CAAA,AAFD,IAEC;SAFY,UAAU"} \ No newline at end of file diff --git a/src/app/shared/menu/menu.reducer.js b/src/app/shared/menu/menu.reducer.js new file mode 100644 index 0000000000..52424558c9 --- /dev/null +++ b/src/app/shared/menu/menu.reducer.js @@ -0,0 +1,242 @@ +import { MenuActionTypes } from './menu.actions'; +import { initialMenusState } from './initial-menus-state'; +import { hasValue } from '../empty.util'; +/** + * Represents the state of a single menu section in the store + */ +var MenuSection = /** @class */ (function () { + function MenuSection() { + } + return MenuSection; +}()); +export { MenuSection }; +/** + * Reducer that handles MenuActions to update the MenusState + * @param {MenusState} state The initial MenusState + * @param {MenuAction} action The Action to be performed on the state + * @returns {MenusState} The new, reducer MenusState + */ +export function menusReducer(state, action) { + if (state === void 0) { state = initialMenusState; } + var _a, _b, _c, _d, _e, _f, _g; + var menuState = state[action.menuID]; + switch (action.type) { + case MenuActionTypes.COLLAPSE_MENU: { + var newMenuState = Object.assign({}, menuState, { collapsed: true }); + return Object.assign({}, state, (_a = {}, _a[action.menuID] = newMenuState, _a)); + } + case MenuActionTypes.EXPAND_MENU: { + var newMenuState = Object.assign({}, menuState, { collapsed: false }); + return Object.assign({}, state, (_b = {}, _b[action.menuID] = newMenuState, _b)); + } + case MenuActionTypes.COLLAPSE_MENU_PREVIEW: { + var newMenuState = Object.assign({}, menuState, { previewCollapsed: true }); + return Object.assign({}, state, (_c = {}, _c[action.menuID] = newMenuState, _c)); + } + case MenuActionTypes.EXPAND_MENU_PREVIEW: { + var newMenuState = Object.assign({}, menuState, { previewCollapsed: false }); + return Object.assign({}, state, (_d = {}, _d[action.menuID] = newMenuState, _d)); + } + case MenuActionTypes.TOGGLE_MENU: { + var newMenuState = Object.assign({}, menuState, { collapsed: !menuState.collapsed }); + return Object.assign({}, state, (_e = {}, _e[action.menuID] = newMenuState, _e)); + } + case MenuActionTypes.SHOW_MENU: { + var newMenuState = Object.assign({}, menuState, { visible: true }); + return Object.assign({}, state, (_f = {}, _f[action.menuID] = newMenuState, _f)); + } + case MenuActionTypes.HIDE_MENU: { + var newMenuState = Object.assign({}, menuState, { visible: false }); + return Object.assign({}, state, (_g = {}, _g[action.menuID] = newMenuState, _g)); + } + case MenuActionTypes.ADD_SECTION: { + return addSection(state, action); + } + case MenuActionTypes.REMOVE_SECTION: { + return removeSection(state, action); + } + case MenuActionTypes.ACTIVATE_SECTION: { + return activateSection(state, action); + } + case MenuActionTypes.DEACTIVATE_SECTION: { + return deactivateSection(state, action); + } + case MenuActionTypes.TOGGLE_ACTIVE_SECTION: { + return toggleActiveSection(state, action); + } + case MenuActionTypes.HIDE_SECTION: { + return hideSection(state, action); + } + case MenuActionTypes.SHOW_SECTION: { + return showSection(state, action); + } + default: { + return state; + } + } +} +/** + * Add a section the a certain menu + * @param {MenusState} state The initial state + * @param {AddMenuSectionAction} action Action containing the new section and the menu's ID + * @returns {MenusState} The new reduced state + */ +function addSection(state, action) { + // let newState = addToIndex(state, action.section, action.menuID); + var newState = putSectionState(state, action, action.section); + return reorderSections(newState, action); +} +/** + * Reorder all sections based on their index field + * @param {MenusState} state The initial state + * @param {MenuSectionAction} action Action containing the menu ID of the menu that is to be reordered + * @returns {MenusState} The new reduced state + */ +function reorderSections(state, action) { + var _a; + var menuState = state[action.menuID]; + var newSectionState = {}; + var newSectionIndexState = {}; + Object.values(menuState.sections).sort(function (sectionA, sectionB) { + var indexA = sectionA.index || 0; + var indexB = sectionB.index || 0; + return indexA - indexB; + }).forEach(function (section) { + newSectionState[section.id] = section; + if (hasValue(section.parentID)) { + var parentIndex = hasValue(newSectionIndexState[section.parentID]) ? newSectionIndexState[section.parentID] : []; + newSectionIndexState[section.parentID] = parentIndex.concat([section.id]); + } + }); + var newMenuState = Object.assign({}, menuState, { + sections: newSectionState, + sectionToSubsectionIndex: newSectionIndexState + }); + return Object.assign({}, state, (_a = {}, _a[action.menuID] = newMenuState, _a)); +} +/** + * Remove a section from a certain menu + * @param {MenusState} state The initial state + * @param {RemoveMenuSectionAction} action Action containing the section ID and menu ID of the section that should be removed + * @returns {MenusState} The new reduced state + */ +function removeSection(state, action) { + var _a; + var menuState = state[action.menuID]; + var id = action.id; + var newState = removeFromIndex(state, menuState.sections[action.id], action.menuID); + var newMenuState = Object.assign({}, newState[action.menuID]); + delete newMenuState.sections[id]; + return Object.assign({}, newState, (_a = {}, _a[action.menuID] = newMenuState, _a)); +} +/** + * Remove a section from the index of a certain menu + * @param {MenusState} state The initial state + * @param {MenuSection} action The MenuSection of which the ID should be removed from the index + * @param {MenuID} action The Menu ID to which the section belonged + * @returns {MenusState} The new reduced state + */ +function removeFromIndex(state, section, menuID) { + var _a, _b; + var sectionID = section.id; + var parentID = section.parentID; + if (hasValue(parentID)) { + var menuState = state[menuID]; + var index = menuState.sectionToSubsectionIndex; + var parentIndex = hasValue(index[parentID]) ? index[parentID] : []; + var newIndex = Object.assign({}, index, (_a = {}, _a[parentID] = parentIndex.filter(function (id) { return id !== sectionID; }), _a)); + var newMenuState = Object.assign({}, menuState, { sectionToSubsectionIndex: newIndex }); + return Object.assign({}, state, (_b = {}, _b[menuID] = newMenuState, _b)); + } + return state; +} +/** + * Hide a certain section + * @param {MenusState} state The initial state + * @param {HideMenuSectionAction} action Action containing data to identify the section to be updated + * @returns {MenusState} The new reduced state + */ +function hideSection(state, action) { + return updateSectionState(state, action, { visible: false }); +} +/** + * Show a certain section + * @param {MenusState} state The initial state + * @param {ShowMenuSectionAction} action Action containing data to identify the section to be updated + * @returns {MenusState} The new reduced state + */ +function showSection(state, action) { + return updateSectionState(state, action, { visible: true }); +} +/** + * Deactivate a certain section + * @param {MenusState} state The initial state + * @param {DeactivateMenuSectionAction} action Action containing data to identify the section to be updated + * @returns {MenusState} The new reduced state + */ +function deactivateSection(state, action) { + var sectionState = state[action.menuID].sections[action.id]; + if (hasValue(sectionState)) { + return updateSectionState(state, action, { active: false }); + } +} +/** + * Activate a certain section + * @param {MenusState} state The initial state + * @param {DeactivateMenuSectionAction} action Action containing data to identify the section to be updated + * @returns {MenusState} The new reduced state + */ +function activateSection(state, action) { + var sectionState = state[action.menuID].sections[action.id]; + if (hasValue(sectionState)) { + return updateSectionState(state, action, { active: true }); + } +} +/** + * Deactivate a certain section when it's currently active, activate a certain section when it's currently inactive + * @param {MenusState} state The initial state + * @param {DeactivateMenuSectionAction} action Action containing data to identify the section to be updated + * @returns {MenusState} The new reduced state + */ +function toggleActiveSection(state, action) { + var sectionState = state[action.menuID].sections[action.id]; + if (hasValue(sectionState)) { + return updateSectionState(state, action, { active: !sectionState.active }); + } + return state; +} +/** + * Add or replace a section in the state + * @param {MenusState} state The initial state + * @param {MenuAction} action The action which contains the menu ID of the menu of which the state is to be updated + * @param {MenuSection} section The section that will be added or replaced in the state + * @returns {MenusState} The new reduced state + */ +function putSectionState(state, action, section) { + var _a, _b; + var menuState = state[action.menuID]; + var newSections = Object.assign({}, menuState.sections, (_a = {}, + _a[section.id] = section, + _a)); + var newMenuState = Object.assign({}, menuState, { + sections: newSections + }); + return Object.assign({}, state, (_b = {}, _b[action.menuID] = newMenuState, _b)); +} +/** + * Update a section + * @param {MenusState} state The initial state + * @param {MenuSectionAction} action The action containing the menu ID and section ID + * @param {any} update A partial section that represents the part that should be updated in an existing section + * @returns {MenusState} The new reduced state + */ +function updateSectionState(state, action, update) { + var menuState = state[action.menuID]; + var sectionState = menuState.sections[action.id]; + if (hasValue(sectionState)) { + var newTopSection = Object.assign({}, sectionState, update); + return putSectionState(state, action, newTopSection); + } + return state; +} +//# sourceMappingURL=menu.reducer.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu.reducer.js.map b/src/app/shared/menu/menu.reducer.js.map new file mode 100644 index 0000000000..39429faa19 --- /dev/null +++ b/src/app/shared/menu/menu.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"menu.reducer.js","sourceRoot":"","sources":["menu.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,eAAe,EAKhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAU,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAA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,QAAQ;QACtD,GAAC,OAAO,CAAC,EAAE,IAAG,OAAO;YACrB,CAAC;IACH,IAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE;QAChD,QAAQ,EAAE,WAAW;KACtB,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,YAAI,GAAC,MAAM,CAAC,MAAM,IAAG,YAAY,MAAG,CAAC;AACrE,CAAC;AAED;;;;;;GAMG;AACH,4BAA4B,KAAiB,EAAE,MAAyB,EAAE,MAAW;IACnF,IAAM,SAAS,GAAc,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClD,IAAM,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACnD,IAAI,QAAQ,CAAC,YAAY,CAAC,EAAE;QAC1B,IAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;QAC9D,OAAO,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;KAEtD;IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/src/app/shared/menu/menu.service.js b/src/app/shared/menu/menu.service.js new file mode 100644 index 0000000000..d8cc4f52ed --- /dev/null +++ b/src/app/shared/menu/menu.service.js @@ -0,0 +1,217 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { select, Store } from '@ngrx/store'; +import { keySelector } from '../../app.reducer'; +import { map, switchMap } from 'rxjs/operators'; +import { ActivateMenuSectionAction, AddMenuSectionAction, CollapseMenuAction, CollapseMenuPreviewAction, DeactivateMenuSectionAction, ExpandMenuAction, ExpandMenuPreviewAction, HideMenuAction, RemoveMenuSectionAction, ShowMenuAction, ToggleActiveMenuSectionAction, ToggleMenuAction, } from './menu.actions'; +import { hasNoValue, isNotEmpty } from '../empty.util'; +import { combineLatest as observableCombineLatest } from 'rxjs'; +var menusStateSelector = function (state) { return state.menus; }; +var menuByIDSelector = function (menuID) { + return keySelector(menuID, menusStateSelector); +}; +var menuSectionStateSelector = function (state) { return state.sections; }; +var menuSectionByIDSelector = function (id) { + return keySelector(id, menuSectionStateSelector); +}; +var menuSectionIndexStateSelector = function (state) { return state.sectionToSubsectionIndex; }; +var getSubSectionsFromSectionSelector = function (id) { + return keySelector(id, menuSectionIndexStateSelector); +}; +var MenuService = /** @class */ (function () { + function MenuService(store) { + this.store = store; + } + /** + * Retrieve a menu's state by its ID + * @param {MenuID} id ID of the requested Menu + * @returns {Observable} Observable that emits the current state of the requested Menu + */ + MenuService.prototype.getMenu = function (id) { + return this.store.pipe(select(menuByIDSelector(id))); + }; + /** + * Retrieve all top level sections of a certain menu + * @param {MenuID} menuID ID of the Menu + * @param {boolean} mustBeVisible True if you only want to request visible sections, false if you want to request all top level sections + * @returns {Observable} Observable that emits a list of MenuSections that are top sections of the given menu + */ + MenuService.prototype.getMenuTopSections = function (menuID, mustBeVisible) { + if (mustBeVisible === void 0) { mustBeVisible = true; } + return this.store.pipe(select(menuByIDSelector(menuID)), select(menuSectionStateSelector), map(function (sections) { + return Object.values(sections) + .filter(function (section) { return hasNoValue(section.parentID); }) + .filter(function (section) { return !mustBeVisible || section.visible; }); + })); + }; + /** + * Retrieve all sub level sections of a certain top section in a given menu + * @param {MenuID} menuID The ID of the menu + * @param {string} parentID The ID of the parent section + * @param {boolean} mustBeVisible True if you only want to request visible sections, false if you want to request all sections + * @returns {Observable} Observable that emits a list of MenuSections that are sub sections of the given menu and parent section + */ + MenuService.prototype.getSubSectionsByParentID = function (menuID, parentID, mustBeVisible) { + var _this = this; + if (mustBeVisible === void 0) { mustBeVisible = true; } + return this.store.pipe(select(menuByIDSelector(menuID)), select(getSubSectionsFromSectionSelector(parentID)), map(function (ids) { return isNotEmpty(ids) ? ids : []; }), switchMap(function (ids) { + return observableCombineLatest(ids.map(function (id) { return _this.getMenuSection(menuID, id); })); + }), map(function (sections) { return sections.filter(function (section) { return !mustBeVisible || section.visible; }); })); + }; + /** + * Check if the a menu's top level section has subsections + * @param {MenuID} menuID The ID of the Menu + * @param {string} parentID The ID of the top level parent section + * @returns {Observable} Observable that emits true when the given parent section has sub sections, false if the given parent section does not have any sub sections + */ + MenuService.prototype.hasSubSections = function (menuID, parentID) { + return this.store.pipe(select(menuByIDSelector(menuID)), select(getSubSectionsFromSectionSelector(parentID)), map(function (ids) { return isNotEmpty(ids); })); + }; + /** + * Retrieve a specific menu section by its menu ID and section ID + * @param {MenuID} menuID The ID of the menu the section resides in + * @param {string} sectionId The ID of the requested section + * @returns {Observable} Observable that emits the found MenuSection + */ + MenuService.prototype.getMenuSection = function (menuID, sectionId) { + return this.store.pipe(select(menuByIDSelector(menuID)), select(menuSectionByIDSelector(sectionId))); + }; + /** + * Add a new section to the store + * @param {MenuID} menuID The menu to which the new section is to be added + * @param {MenuSection} section The section to be added + */ + MenuService.prototype.addSection = function (menuID, section) { + this.store.dispatch(new AddMenuSectionAction(menuID, section)); + }; + /** + * Remove a section from the store + * @param {MenuID} menuID The menu from which the section is to be removed + * @param {string} sectionID The ID of the section that should be removed + */ + MenuService.prototype.removeSection = function (menuID, sectionID) { + this.store.dispatch(new RemoveMenuSectionAction(menuID, sectionID)); + }; + /** + * Check if a given menu is collapsed + * @param {MenuID} menuID The ID of the menu that is to be checked + * @returns {Observable} Emits true if the given menu is collapsed, emits falls when it's expanded + */ + MenuService.prototype.isMenuCollapsed = function (menuID) { + return this.getMenu(menuID).pipe(map(function (state) { return state.collapsed; })); + }; + /** + * Check if a given menu's preview is collapsed + * @param {MenuID} menuID The ID of the menu that is to be checked + * @returns {Observable} Emits true if the given menu's preview is collapsed, emits falls when it's expanded + */ + MenuService.prototype.isMenuPreviewCollapsed = function (menuID) { + return this.getMenu(menuID).pipe(map(function (state) { return state.previewCollapsed; })); + }; + /** + * Check if a given menu is visible + * @param {MenuID} menuID The ID of the menu that is to be checked + * @returns {Observable} Emits true if the given menu is visible, emits falls when it's hidden + */ + MenuService.prototype.isMenuVisible = function (menuID) { + return this.getMenu(menuID).pipe(map(function (state) { return state.visible; })); + }; + /** + * Expands a given menu + * @param {MenuID} menuID The ID of the menu + */ + MenuService.prototype.expandMenu = function (menuID) { + this.store.dispatch(new ExpandMenuAction(menuID)); + }; + /** + * Collapses a given menu + * @param {MenuID} menuID The ID of the menu + */ + MenuService.prototype.collapseMenu = function (menuID) { + this.store.dispatch(new CollapseMenuAction(menuID)); + }; + /** + * Expands a given menu's preview + * @param {MenuID} menuID The ID of the menu + */ + MenuService.prototype.expandMenuPreview = function (menuID) { + this.store.dispatch(new ExpandMenuPreviewAction(menuID)); + }; + /** + * Collapses a given menu's preview + * @param {MenuID} menuID The ID of the menu + */ + MenuService.prototype.collapseMenuPreview = function (menuID) { + this.store.dispatch(new CollapseMenuPreviewAction(menuID)); + }; + /** + * Collapse a given menu when it's currently expanded or expand it when it's currently collapsed + * @param {MenuID} menuID The ID of the menu + */ + MenuService.prototype.toggleMenu = function (menuID) { + this.store.dispatch(new ToggleMenuAction(menuID)); + }; + /** + * Show a given menu + * @param {MenuID} menuID The ID of the menu + */ + MenuService.prototype.showMenu = function (menuID) { + this.store.dispatch(new ShowMenuAction(menuID)); + }; + /** + * Hide a given menu + * @param {MenuID} menuID The ID of the menu + */ + MenuService.prototype.hideMenu = function (menuID) { + this.store.dispatch(new HideMenuAction(menuID)); + }; + /** + * Activate a given menu section when it's currently inactive or deactivate it when it's currently active + * @param {MenuID} menuID The ID of the menu + * @param {string} id The ID of the section + */ + MenuService.prototype.toggleActiveSection = function (menuID, id) { + this.store.dispatch(new ToggleActiveMenuSectionAction(menuID, id)); + }; + /** + * Activate a given menu section + * @param {MenuID} menuID The ID of the menu + * @param {string} id The ID of the section + */ + MenuService.prototype.activateSection = function (menuID, id) { + this.store.dispatch(new ActivateMenuSectionAction(menuID, id)); + }; + /** + * Deactivate a given menu section + * @param {MenuID} menuID The ID of the menu + * @param {string} id The ID of the section + */ + MenuService.prototype.deactivateSection = function (menuID, id) { + this.store.dispatch(new DeactivateMenuSectionAction(menuID, id)); + }; + /** + * Check whether a given section is currently active or not + * @param {MenuID} menuID The ID of the Menu the section resides in + * @param {string} id The ID of the menu section to check + * @returns {Observable} Emits true when the given section is currently active, false when the given section is currently inactive + */ + MenuService.prototype.isSectionActive = function (menuID, id) { + return this.getMenuSection(menuID, id).pipe(map(function (section) { return section.active; })); + }; + /** + * Check whether a given section is currently visible or not + * @param {MenuID} menuID The ID of the Menu the section resides in + * @param {string} id The ID of the menu section to check + * @returns {Observable} Emits true when the given section is currently visible, false when the given section is currently hidden + */ + MenuService.prototype.isSectionVisible = function (menuID, id) { + return this.getMenuSection(menuID, id).pipe(map(function (section) { return section.visible; })); + }; + MenuService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Store]) + ], MenuService); + return MenuService; +}()); +export { MenuService }; +//# sourceMappingURL=menu.service.js.map \ No newline at end of file diff --git a/src/app/shared/menu/menu.service.js.map b/src/app/shared/menu/menu.service.js.map new file mode 100644 index 0000000000..71167a6b77 --- /dev/null +++ b/src/app/shared/menu/menu.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"menu.service.js","sourceRoot":"","sources":["menu.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAoB,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAY,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAAE,yBAAyB,EAC7C,2BAA2B,EAC3B,gBAAgB,EAAE,uBAAuB,EACzC,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,6BAA6B,EAC7B,gBAAgB,GACjB,MAAM,gBAA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,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,6BAA6B,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACH,qCAAe,GAAf,UAAgB,MAAc,EAAE,EAAU;QACxC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,yBAAyB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACH,uCAAiB,GAAjB,UAAkB,MAAc,EAAE,EAAU;QAC1C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,2BAA2B,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACH,qCAAe,GAAf,UAAgB,MAAc,EAAE,EAAU;QACxC,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,OAAO,IAAK,OAAA,OAAO,CAAC,MAAM,EAAd,CAAc,CAAC,CAAC,CAAC;IAChF,CAAC;IAED;;;;;OAKG;IACH,sCAAgB,GAAhB,UAAiB,MAAc,EAAE,EAAU;QACzC,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,OAAO,IAAK,OAAA,OAAO,CAAC,OAAO,EAAf,CAAe,CAAC,CAAC,CAAC;IACjF,CAAC;IAvOU,WAAW;QADvB,UAAU,EAAE;iDAGgB,KAAK;OAFrB,WAAW,CAyOvB;IAAD,kBAAC;CAAA,AAzOD,IAyOC;SAzOY,WAAW"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-action.js b/src/app/shared/mocks/mock-action.js new file mode 100644 index 0000000000..eb52581277 --- /dev/null +++ b/src/app/shared/mocks/mock-action.js @@ -0,0 +1,8 @@ +var MockAction = /** @class */ (function () { + function MockAction() { + this.type = null; + } + return MockAction; +}()); +export { MockAction }; +//# sourceMappingURL=mock-action.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-action.js.map b/src/app/shared/mocks/mock-action.js.map new file mode 100644 index 0000000000..def2870f4d --- /dev/null +++ b/src/app/shared/mocks/mock-action.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-action.js","sourceRoot":"","sources":["mock-action.ts"],"names":[],"mappings":"AAEA;IAAA;QACE,SAAI,GAAG,IAAI,CAAC;IAEd,CAAC;IAAD,iBAAC;AAAD,CAAC,AAHD,IAGC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-active-router.js b/src/app/shared/mocks/mock-active-router.js new file mode 100644 index 0000000000..6ec4d22b63 --- /dev/null +++ b/src/app/shared/mocks/mock-active-router.js @@ -0,0 +1,36 @@ +import { BehaviorSubject } from 'rxjs'; +var MockActivatedRoute = /** @class */ (function () { + function MockActivatedRoute(params) { + // ActivatedRoute.params is Observable + this.subject = new BehaviorSubject(this.testParams); + this.params = this.subject.asObservable(); + this.queryParams = this.subject.asObservable(); + if (params) { + this.testParams = params; + } + else { + this.testParams = {}; + } + } + Object.defineProperty(MockActivatedRoute.prototype, "testParams", { + // Test parameters + get: function () { return this._testParams; }, + set: function (params) { + this._testParams = params; + this.subject.next(params); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MockActivatedRoute.prototype, "snapshot", { + // ActivatedRoute.snapshot.params + get: function () { + return { params: this.testParams, queryParams: this.testParams }; + }, + enumerable: true, + configurable: true + }); + return MockActivatedRoute; +}()); +export { MockActivatedRoute }; +//# sourceMappingURL=mock-active-router.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-active-router.js.map b/src/app/shared/mocks/mock-active-router.js.map new file mode 100644 index 0000000000..dcade68f39 --- /dev/null +++ b/src/app/shared/mocks/mock-active-router.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-active-router.js","sourceRoot":"","sources":["mock-active-router.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAEvC;IAUE,4BAAY,MAAe;QAN3B,sCAAsC;QAC9B,YAAO,GAA0B,IAAI,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE9E,WAAM,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QACrC,gBAAW,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAGxC,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;SAC1B;aAAM;YACL,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;SACtB;IACH,CAAC;IAGD,sBAAI,0CAAU;QADd,kBAAkB;aAClB,cAAmB,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;aAC7C,UAAe,MAAU;YACvB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;YAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;;;OAJ4C;IAO7C,sBAAI,wCAAQ;QADZ,iCAAiC;aACjC;YACE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACnE,CAAC;;;OAAA;IACH,yBAAC;AAAD,CAAC,AA7BD,IA6BC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-admin-guard.service.js b/src/app/shared/mocks/mock-admin-guard.service.js new file mode 100644 index 0000000000..ac9b4e8e2e --- /dev/null +++ b/src/app/shared/mocks/mock-admin-guard.service.js @@ -0,0 +1,26 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { hasValue } from '../empty.util'; +var MockAdminGuard = /** @class */ (function () { + function MockAdminGuard() { + } + MockAdminGuard.prototype.canActivate = function (route, state) { + // if being run in browser, enforce 'isAdmin' requirement + if (typeof window === 'object' && hasValue(window.localStorage)) { + if (window.localStorage.getItem('isAdmin') === 'true') { + return true; + } + return false; + } + return true; + }; + MockAdminGuard.prototype.canActivateChild = function (route, state) { + return this.canActivate(route, state); + }; + MockAdminGuard = tslib_1.__decorate([ + Injectable() + ], MockAdminGuard); + return MockAdminGuard; +}()); +export { MockAdminGuard }; +//# sourceMappingURL=mock-admin-guard.service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-admin-guard.service.js.map b/src/app/shared/mocks/mock-admin-guard.service.js.map new file mode 100644 index 0000000000..1f381483c8 --- /dev/null +++ b/src/app/shared/mocks/mock-admin-guard.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-admin-guard.service.js","sourceRoot":"","sources":["mock-admin-guard.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC;IAAA;IAgBA,CAAC;IAdC,oCAAW,GAAX,UAAY,KAA6B,EAAE,KAA0B;QACnE,yDAAyD;QACzD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;YAC/D,IAAI,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,MAAM,EAAE;gBACrD,OAAO,IAAI,CAAC;aACb;YACD,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yCAAgB,GAAhB,UAAiB,KAA6B,EAAE,KAA0B;QACxE,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAfU,cAAc;QAD1B,UAAU,EAAE;OACA,cAAc,CAgB1B;IAAD,qBAAC;CAAA,AAhBD,IAgBC;SAhBY,cAAc"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-angulartics.service.js b/src/app/shared/mocks/mock-angulartics.service.js new file mode 100644 index 0000000000..2a1ccc0d22 --- /dev/null +++ b/src/app/shared/mocks/mock-angulartics.service.js @@ -0,0 +1,9 @@ +/* tslint:disable:no-empty */ +var AngularticsMock = /** @class */ (function () { + function AngularticsMock() { + } + AngularticsMock.prototype.eventTrack = function (action, properties) { }; + return AngularticsMock; +}()); +export { AngularticsMock }; +//# sourceMappingURL=mock-angulartics.service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-angulartics.service.js.map b/src/app/shared/mocks/mock-angulartics.service.js.map new file mode 100644 index 0000000000..a82f9a412d --- /dev/null +++ b/src/app/shared/mocks/mock-angulartics.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-angulartics.service.js","sourceRoot":"","sources":["mock-angulartics.service.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B;IAAA;IAEA,CAAC;IADQ,oCAAU,GAAjB,UAAkB,MAAM,EAAE,UAAU,IAAI,CAAC;IAC3C,sBAAC;AAAD,CAAC,AAFD,IAEC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-auth.service.js b/src/app/shared/mocks/mock-auth.service.js new file mode 100644 index 0000000000..dcb1a72ae2 --- /dev/null +++ b/src/app/shared/mocks/mock-auth.service.js @@ -0,0 +1,11 @@ +/* tslint:disable:no-empty */ +var AuthServiceMock = /** @class */ (function () { + function AuthServiceMock() { + } + AuthServiceMock.prototype.checksAuthenticationToken = function () { + return; + }; + return AuthServiceMock; +}()); +export { AuthServiceMock }; +//# sourceMappingURL=mock-auth.service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-auth.service.js.map b/src/app/shared/mocks/mock-auth.service.js.map new file mode 100644 index 0000000000..26ffb1b43e --- /dev/null +++ b/src/app/shared/mocks/mock-auth.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-auth.service.js","sourceRoot":"","sources":["mock-auth.service.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B;IAAA;IAIA,CAAC;IAHQ,mDAAyB,GAAhC;QACE,OAAM;IACR,CAAC;IACH,sBAAC;AAAD,CAAC,AAJD,IAIC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-form-builder-service.js b/src/app/shared/mocks/mock-form-builder-service.js new file mode 100644 index 0000000000..3ddfb9cad8 --- /dev/null +++ b/src/app/shared/mocks/mock-form-builder-service.js @@ -0,0 +1,21 @@ +import { FormControl, FormGroup } from '@angular/forms'; +export function getMockFormBuilderService() { + return jasmine.createSpyObj('FormBuilderService', { + modelFromConfiguration: [], + createFormGroup: new FormGroup({}), + getValueFromModel: {}, + getFormControlById: new FormControl(), + hasMappedGroupValue: false, + findById: {}, + getPath: ['test', 'path'], + getId: 'path', + clearAllModelsValue: {}, + insertFormArrayGroup: {}, + isQualdrop: false, + isQualdropGroup: false, + isModelInCustomGroup: true, + isRelationGroup: true, + hasArrayGroupValue: true + }); +} +//# sourceMappingURL=mock-form-builder-service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-form-builder-service.js.map b/src/app/shared/mocks/mock-form-builder-service.js.map new file mode 100644 index 0000000000..4422604f8e --- /dev/null +++ b/src/app/shared/mocks/mock-form-builder-service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-form-builder-service.js","sourceRoot":"","sources":["mock-form-builder-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM;IACJ,OAAO,OAAO,CAAC,YAAY,CAAC,oBAAoB,EAAE;QAChD,sBAAsB,EAAE,EAAE;QAC1B,eAAe,EAAE,IAAI,SAAS,CAAC,EAAE,CAAC;QAClC,iBAAiB,EAAE,EAAE;QACrB,kBAAkB,EAAE,IAAI,WAAW,EAAE;QACrC,mBAAmB,EAAE,KAAK;QAC1B,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;QACzB,KAAK,EAAE,MAAM;QACb,mBAAmB,EAAG,EAAE;QACxB,oBAAoB,EAAE,EAAE;QACxB,UAAU,EAAE,KAAK;QACjB,eAAe,EAAE,KAAK;QACtB,oBAAoB,EAAE,IAAI;QAC1B,eAAe,EAAE,IAAI;QACrB,kBAAkB,EAAE,IAAI;KAEzB,CAAC,CAAC;AAEL,CAAC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-form-models.js b/src/app/shared/mocks/mock-form-models.js new file mode 100644 index 0000000000..7dee9624e3 --- /dev/null +++ b/src/app/shared/mocks/mock-form-models.js @@ -0,0 +1,228 @@ +import { DsDynamicInputModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model'; +import { DynamicQualdropModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model'; +import { DynamicRowArrayModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model'; +import { DynamicSelectModel } from '@ng-dynamic-forms/core'; +import { SubmissionScopeType } from '../../core/submission/submission-scope-type'; +import { DynamicRelationGroupModel } from '../form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; +import { AuthorityOptions } from '../../core/integration/models/authority-options.model'; +import { AuthorityValue } from '../../core/integration/models/authority.value'; +import { FormFieldMetadataValueObject } from '../form/builder/models/form-field-metadata-value.model'; +import { DynamicRowGroupModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model'; +export var qualdropSelectConfig = { + name: 'dc.identifier_QUALDROP_METADATA', + id: 'dc_identifier_QUALDROP_METADATA', + readOnly: false, + disabled: false, + label: 'Identifiers', + placeholder: 'Identifiers', + options: [ + { + label: 'ISSN', + value: 'dc.identifier.issn' + }, + { + label: 'Other', + value: 'dc.identifier.other' + }, + { + label: 'ISMN', + value: 'dc.identifier.ismn' + }, + { + label: 'Gov\'t Doc #', + value: 'dc.identifier.govdoc' + }, + { + label: 'URI', + value: 'dc.identifier.uri' + }, + { + label: 'ISBN', + value: 'dc.identifier.isbn' + } + ], + value: 'dc.identifier.issn' +}; +export var qualdropInputConfig = { + name: 'dc.identifier_QUALDROP_VALUE', + id: 'dc_identifier_QUALDROP_VALUE', + readOnly: false, + disabled: false, + value: 'test' +}; +export var mockQualdropSelectModel = new DynamicSelectModel(qualdropSelectConfig); +export var mockQualdropInputModel = new DsDynamicInputModel(qualdropInputConfig); +export var qualdropConfig = { + id: 'dc_identifier_QUALDROP_GROUP', + legend: 'Identifiers', + readOnly: false, + group: [mockQualdropSelectModel, mockQualdropInputModel] +}; +export var MockQualdropModel = new DynamicQualdropModel(qualdropConfig); +var rowArrayQualdropConfig = { + id: 'row_QUALDROP_GROUP', + initialCount: 1, + notRepeatable: true, + groupFactory: function () { + return [MockQualdropModel]; + } +}; +export var MockRowArrayQualdropModel = new DynamicRowArrayModel(rowArrayQualdropConfig); +var mockFormRowModel = { + fields: [ + { + input: { type: 'lookup' }, + label: 'Journal', + mandatory: 'false', + repeatable: false, + hints: 'Enter the name of the journal where the item has been\n\t\t\t\t\tpublished, if any.', + selectableMetadata: [ + { + metadata: 'journal', + authority: 'JOURNALAuthority', + closed: false + } + ], + languageCodes: [] + }, + { + input: { type: 'onebox' }, + label: 'Issue', + mandatory: 'false', + repeatable: false, + hints: ' Enter issue number.', + selectableMetadata: [ + { + metadata: 'issue' + } + ], + languageCodes: [] + } + ] +}; +var relationGroupConfig = { + id: 'relationGroup', + formConfiguration: [mockFormRowModel], + mandatoryField: 'false', + relationFields: ['journal', 'issue'], + scopeUUID: 'scope', + submissionScope: SubmissionScopeType.WorkspaceItem, + value: { + journal: [ + 'journal test 1', + 'journal test 2' + ], + issue: [ + 'issue test 1', + 'issue test 2' + ], + } +}; +export var MockRelationModel = new DynamicRelationGroupModel(relationGroupConfig); +export var inputWithLanguageAndAuthorityConfig = { + authorityOptions: new AuthorityOptions('testAuthority', 'testWithAuthority', 'scope'), + languageCodes: [ + { + display: 'English', + code: 'en_US' + }, + { + display: 'Italian', + code: 'it_IT' + } + ], + language: 'en_US', + name: 'testWithAuthority', + id: 'testWithAuthority', + readOnly: false, + disabled: false, + value: { + value: 'testWithLanguageAndAuthority', + display: 'testWithLanguageAndAuthority', + id: 'testWithLanguageAndAuthority', + } +}; +export var mockInputWithLanguageAndAuthorityModel = new DsDynamicInputModel(inputWithLanguageAndAuthorityConfig); +export var inputWithLanguageConfig = { + languageCodes: [ + { + display: 'English', + code: 'en_US' + }, + { + display: 'Italian', + code: 'it_IT' + } + ], + language: 'en_US', + name: 'testWithLanguage', + id: 'testWithLanguage', + readOnly: false, + disabled: false, + value: 'testWithLanguage' +}; +export var mockInputWithLanguageModel = new DsDynamicInputModel(inputWithLanguageConfig); +export var inputWithLanguageAndAuthorityArrayConfig = { + authorityOptions: new AuthorityOptions('testAuthority', 'testWithAuthority', 'scope'), + languageCodes: [ + { + display: 'English', + code: 'en_US' + }, + { + display: 'Italian', + code: 'it_IT' + } + ], + language: 'en_US', + name: 'testWithLanguageAndAuthorityArray', + id: 'testWithLanguageAndAuthorityArray', + readOnly: false, + disabled: false, + value: [{ + value: 'testLanguageAndAuthorityArray', + display: 'testLanguageAndAuthorityArray', + id: 'testLanguageAndAuthorityArray', + }] +}; +export var mockInputWithLanguageAndAuthorityArrayModel = new DsDynamicInputModel(inputWithLanguageAndAuthorityArrayConfig); +export var inputWithFormFieldValueConfig = { + name: 'testWithFormField', + id: 'testWithFormField', + readOnly: false, + disabled: false, + value: new FormFieldMetadataValueObject('testWithFormFieldValue') +}; +export var mockInputWithFormFieldValueModel = new DsDynamicInputModel(inputWithFormFieldValueConfig); +export var inputWithAuthorityValueConfig = { + name: 'testWithAuthorityField', + id: 'testWithAuthorityField', + readOnly: false, + disabled: false, + value: Object.assign({}, new AuthorityValue(), { value: 'testWithAuthorityValue', id: 'testWithAuthorityValue', display: 'testWithAuthorityValue' }) +}; +export var mockInputWithAuthorityValueModel = new DsDynamicInputModel(inputWithAuthorityValueConfig); +export var inputWithObjectValueConfig = { + name: 'testWithObjectValue', + id: 'testWithObjectValue', + readOnly: false, + disabled: false, + value: { value: 'testWithObjectValue', id: 'testWithObjectValue', display: 'testWithObjectValue' } +}; +export var mockInputWithObjectValueModel = new DsDynamicInputModel(inputWithObjectValueConfig); +export var mockRowGroupModel = new DynamicRowGroupModel({ + id: 'mockRowGroupModel', + group: [mockInputWithFormFieldValueModel], +}); +export var fileFormEditInputConfig = { + name: 'dc.title', + id: 'dc_title', + readOnly: false, + disabled: false, +}; +export var mockFileFormEditInputModel = new DsDynamicInputModel(fileFormEditInputConfig); +export var mockFileFormEditRowGroupModel = new DynamicRowGroupModel({ + id: 'mockRowGroupModel', + group: [mockFileFormEditInputModel] +}); +//# sourceMappingURL=mock-form-models.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-form-models.js.map b/src/app/shared/mocks/mock-form-models.js.map new file mode 100644 index 0000000000..93accdb7a9 --- /dev/null +++ b/src/app/shared/mocks/mock-form-models.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-form-models.js","sourceRoot":"","sources":["mock-form-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kEAAkE,CAAC;AACvG,OAAO,EAAE,oBAAoB,EAAE,MAAM,qEAAqE,CAAC;AAC3G,OAAO,EACL,oBAAoB,EAErB,MAAM,sEAAsE,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uFAAuF,CAAC;AAElI,OAAO,EAAE,gBAAgB,EAAE,MAAM,uDAAuD,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,sEAAsE,CAAC;AAE5G,MAAM,CAAC,IAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,iCAAiC;IACvC,EAAE,EAAE,iCAAiC;IACrC,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,aA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CAAC;AAEjG,MAAM,CAAC,IAAM,iBAAiB,GAAG,IAAI,oBAAoB,CAAC;IACxD,EAAE,EAAE,mBAAmB;IACvB,KAAK,EAAE,CAAC,gCAAgC,CAAC;CAC1C,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,UAAU;IAChB,EAAE,EAAE,UAAU;IACd,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,KAAK;CAChB,CAAC;AAEF,MAAM,CAAC,IAAM,0BAA0B,GAAG,IAAI,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;AAE3F,MAAM,CAAC,IAAM,6BAA6B,GAAG,IAAI,oBAAoB,CAAC;IACpE,EAAE,EAAE,mBAAmB;IACvB,KAAK,EAAE,CAAC,0BAA0B,CAAC;CACpC,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-form-operations-service.js b/src/app/shared/mocks/mock-form-operations-service.js new file mode 100644 index 0000000000..020a8d3388 --- /dev/null +++ b/src/app/shared/mocks/mock-form-operations-service.js @@ -0,0 +1,17 @@ +/** + * Mock for [[FormOperationsService]] + */ +export function getMockFormOperationsService() { + return jasmine.createSpyObj('SectionFormOperationsService', { + dispatchOperationsFromEvent: jasmine.createSpy('dispatchOperationsFromEvent'), + getArrayIndexFromEvent: jasmine.createSpy('getArrayIndexFromEvent'), + isPartOfArrayOfGroup: jasmine.createSpy('isPartOfArrayOfGroup'), + getQualdropValueMap: jasmine.createSpy('getQualdropValueMap'), + getFieldPathFromEvent: jasmine.createSpy('getFieldPathFromEvent'), + getQualdropItemPathFromEvent: jasmine.createSpy('getQualdropItemPathFromEvent'), + getFieldPathSegmentedFromChangeEvent: jasmine.createSpy('getFieldPathSegmentedFromChangeEvent'), + getFieldValueFromChangeEvent: jasmine.createSpy('getFieldValueFromChangeEvent'), + getValueMap: jasmine.createSpy('getValueMap'), + }); +} +//# sourceMappingURL=mock-form-operations-service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-form-operations-service.js.map b/src/app/shared/mocks/mock-form-operations-service.js.map new file mode 100644 index 0000000000..3bcd675829 --- /dev/null +++ b/src/app/shared/mocks/mock-form-operations-service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-form-operations-service.js","sourceRoot":"","sources":["mock-form-operations-service.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM;IACJ,OAAO,OAAO,CAAC,YAAY,CAAC,8BAA8B,EAAE;QAC1D,2BAA2B,EAAE,OAAO,CAAC,SAAS,CAAC,6BAA6B,CAAC;QAC7E,sBAAsB,EAAE,OAAO,CAAC,SAAS,CAAC,wBAAwB,CAAC;QACnE,oBAAoB,EAAE,OAAO,CAAC,SAAS,CAAC,sBAAsB,CAAC;QAC/D,mBAAmB,EAAE,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC;QAC7D,qBAAqB,EAAE,OAAO,CAAC,SAAS,CAAC,uBAAuB,CAAC;QACjE,4BAA4B,EAAE,OAAO,CAAC,SAAS,CAAC,8BAA8B,CAAC;QAC/E,oCAAoC,EAAE,OAAO,CAAC,SAAS,CAAC,sCAAsC,CAAC;QAC/F,4BAA4B,EAAE,OAAO,CAAC,SAAS,CAAC,8BAA8B,CAAC;QAC/E,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC;KAE9C,CAAC,CAAC;AAEL,CAAC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-form-service.js b/src/app/shared/mocks/mock-form-service.js new file mode 100644 index 0000000000..4c2bc3043b --- /dev/null +++ b/src/app/shared/mocks/mock-form-service.js @@ -0,0 +1,19 @@ +import { of as observableOf } from 'rxjs'; +/** + * Mock for [[FormService]] + */ +export function getMockFormService(id$) { + if (id$ === void 0) { id$ = 'random_id'; } + return jasmine.createSpyObj('FormService', { + getFormData: jasmine.createSpy('getFormData'), + initForm: jasmine.createSpy('initForm'), + removeForm: jasmine.createSpy('removeForm'), + getForm: observableOf({}), + getUniqueId: id$, + resetForm: {}, + validateAllFormFields: jasmine.createSpy('validateAllFormFields'), + isValid: jasmine.createSpy('isValid'), + isFormInitialized: observableOf(true) + }); +} +//# sourceMappingURL=mock-form-service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-form-service.js.map b/src/app/shared/mocks/mock-form-service.js.map new file mode 100644 index 0000000000..d83dc3e898 --- /dev/null +++ b/src/app/shared/mocks/mock-form-service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-form-service.js","sourceRoot":"","sources":["mock-form-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAI1C;;GAEG;AACH,MAAM,6BACJ,GAAyB;IAAzB,oBAAA,EAAA,iBAAyB;IAEzB,OAAO,OAAO,CAAC,YAAY,CAAC,aAAa,EAAE;QACzC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC;QAC7C,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC;QACvC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC;QAC3C,OAAO,EAAE,YAAY,CAAC,EAAE,CAAC;QACzB,WAAW,EAAE,GAAG;QAChB,SAAS,EAAE,EAAE;QACb,qBAAqB,EAAE,OAAO,CAAC,SAAS,CAAC,uBAAuB,CAAC;QACjE,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;QACrC,iBAAiB,EAAE,YAAY,CAAC,IAAI,CAAC;KACtC,CAAC,CAAC;AAEL,CAAC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-host-window-service.js b/src/app/shared/mocks/mock-host-window-service.js new file mode 100644 index 0000000000..dda698699b --- /dev/null +++ b/src/app/shared/mocks/mock-host-window-service.js @@ -0,0 +1,19 @@ +import { of as observableOf } from 'rxjs'; +// declare a stub service +var MockHostWindowService = /** @class */ (function () { + function MockHostWindowService(width) { + this.setWidth(width); + } + MockHostWindowService.prototype.setWidth = function (width) { + this.width = width; + }; + MockHostWindowService.prototype.isXs = function () { + return observableOf(this.width < 576); + }; + MockHostWindowService.prototype.isSm = function () { + return observableOf(this.width < 768); + }; + return MockHostWindowService; +}()); +export { MockHostWindowService }; +//# sourceMappingURL=mock-host-window-service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-host-window-service.js.map b/src/app/shared/mocks/mock-host-window-service.js.map new file mode 100644 index 0000000000..7a338fa8b9 --- /dev/null +++ b/src/app/shared/mocks/mock-host-window-service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-host-window-service.js","sourceRoot":"","sources":["mock-host-window-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,IAAI,YAAY,EAAe,MAAM,MAAM,CAAC;AAEtD,yBAAyB;AACzB;IAIE,+BAAY,KAAK;QACf,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAED,wCAAQ,GAAR,UAAS,KAAK;QACZ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,oCAAI,GAAJ;QACE,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IACxC,CAAC;IAED,oCAAI,GAAJ;QACE,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IACxC,CAAC;IACH,4BAAC;AAAD,CAAC,AAnBD,IAmBC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-item.js b/src/app/shared/mocks/mock-item.js new file mode 100644 index 0000000000..890fa5fb0e --- /dev/null +++ b/src/app/shared/mocks/mock-item.js @@ -0,0 +1,215 @@ +import { of as observableOf } from 'rxjs'; +import { Item } from '../../core/shared/item.model'; +/* tslint:disable:no-shadowed-variable */ +export var MockItem = Object.assign(new Item(), { + handle: '10673/6', + lastModified: '2017-04-24T19:44:08.178+0000', + isArchived: true, + isDiscoverable: true, + isWithdrawn: false, + bitstreams: observableOf({ + self: 'dspace-angular://aggregated/object/1507836003548', + requestPending: false, + responsePending: false, + isSuccessful: true, + errorMessage: '', + statusCode: '202', + pageInfo: {}, + payload: { + pageInfo: { + elementsPerPage: 20, + totalElements: 3, + totalPages: 1, + currentPage: 2 + }, + page: [ + { + sizeBytes: 10201, + content: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713/content', + format: observableOf({ + self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/10', + requestPending: false, + responsePending: false, + isSuccessful: true, + errorMessage: '', + statusCode: '202', + pageInfo: {}, + payload: { + shortDescription: 'Microsoft Word XML', + description: 'Microsoft Word XML', + mimetype: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + supportLevel: 0, + internal: false, + extensions: null, + self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/10' + } + }), + bundleName: 'ORIGINAL', + self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713', + id: 'cf9b0c8e-a1eb-4b65-afd0-567366448713', + uuid: 'cf9b0c8e-a1eb-4b65-afd0-567366448713', + type: 'bitstream', + metadata: { + 'dc.title': [ + { + language: null, + value: 'test_word.docx' + } + ] + } + }, + { + sizeBytes: 31302, + content: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/99b00f3c-1cc6-4689-8158-91965bee6b28/content', + format: observableOf({ + self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/4', + requestPending: false, + responsePending: false, + isSuccessful: true, + errorMessage: '', + statusCode: '202', + pageInfo: {}, + payload: { + shortDescription: 'Adobe PDF', + description: 'Adobe Portable Document Format', + mimetype: 'application/pdf', + supportLevel: 0, + internal: false, + extensions: null, + self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/4' + } + }), + bundleName: 'ORIGINAL', + self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/99b00f3c-1cc6-4689-8158-91965bee6b28', + id: '99b00f3c-1cc6-4689-8158-91965bee6b28', + uuid: '99b00f3c-1cc6-4689-8158-91965bee6b28', + type: 'bitstream', + metadata: { + 'dc.title': [ + { + language: null, + value: 'test_pdf.pdf' + } + ] + } + } + ] + } + }), + self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/items/0ec7ff22-f211-40ab-a69e-c819b0b1f357', + id: '0ec7ff22-f211-40ab-a69e-c819b0b1f357', + uuid: '0ec7ff22-f211-40ab-a69e-c819b0b1f357', + type: 'item', + metadata: { + 'dc.creator': [ + { + language: 'en_US', + value: 'Doe, Jane' + } + ], + 'dc.date.accessioned': [ + { + language: null, + value: '1650-06-26T19:58:25Z' + } + ], + 'dc.date.available': [ + { + language: null, + value: '1650-06-26T19:58:25Z' + } + ], + 'dc.date.issued': [ + { + language: null, + value: '1650-06-26' + } + ], + 'dc.identifier.issn': [ + { + language: 'en_US', + value: '123456789' + } + ], + 'dc.identifier.uri': [ + { + language: null, + value: 'http://dspace7.4science.it/xmlui/handle/10673/6' + } + ], + 'dc.description.abstract': [ + { + language: 'en_US', + value: 'This is really just a sample abstract. If it was a real abstract it would contain useful information about this test document. Sorry though, nothing useful in this paragraph. You probably shouldn\'t have even bothered to read it!' + } + ], + 'dc.description.provenance': [ + { + language: 'en', + value: 'Made available in DSpace on 2012-06-26T19:58:25Z (GMT). No. of bitstreams: 2\r\ntest_ppt.ppt: 12707328 bytes, checksum: a353fc7d29b3c558c986f7463a41efd3 (MD5)\r\ntest_ppt.pptx: 12468572 bytes, checksum: 599305edb4ebee329667f2c35b14d1d6 (MD5)' + }, + { + language: 'en', + value: 'Restored into DSpace on 2013-06-13T09:17:34Z (GMT).' + }, + { + language: 'en', + value: 'Restored into DSpace on 2013-06-13T11:04:16Z (GMT).' + }, + { + language: 'en', + value: 'Restored into DSpace on 2017-04-24T19:44:08Z (GMT).' + } + ], + 'dc.language': [ + { + language: 'en_US', + value: 'en' + } + ], + 'dc.rights': [ + { + language: 'en_US', + value: '© Jane Doe' + } + ], + 'dc.subject': [ + { + language: 'en_US', + value: 'keyword1' + }, + { + language: 'en_US', + value: 'keyword2' + }, + { + language: 'en_US', + value: 'keyword3' + } + ], + 'dc.title': [ + { + language: 'en_US', + value: 'Test PowerPoint Document' + } + ], + 'dc.type': [ + { + language: 'en_US', + value: 'text' + } + ] + }, + owningCollection: observableOf({ + self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb', + requestPending: false, + responsePending: false, + isSuccessful: true, + errorMessage: '', + statusCode: '202', + pageInfo: {}, + payload: [] + }) +}); +/* tslint:enable:no-shadowed-variable */ +//# sourceMappingURL=mock-item.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-item.js.map b/src/app/shared/mocks/mock-item.js.map new file mode 100644 index 0000000000..ae8ac4d016 --- /dev/null +++ b/src/app/shared/mocks/mock-item.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-item.js","sourceRoot":"","sources":["mock-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,IAAI,YAAY,EAAe,MAAM,MAAM,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAEpD,yCAAyC;AACzC,MAAM,CAAC,IAAM,QAAQ,GAAS,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,EAAE;IACtD,MAAM,EAAE,SAAS;IACjB,YAAY,EAAE,8BAA8B;IAC5C,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,IAAI;IACpB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,YAAY,CAAC;QACvB,IAAI,EAAE,kDAAkD;QACxD,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,KAAK;QACtB,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE;YACP,QAAQ,EAAE;gBACR,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P;YACD;gBACE,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,qDAAqD;aAC7D;YACD;gBACE,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,qDAAqD;aAC7D;YACD;gBACE,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,qDAAqD;aAC7D;SACF;QACD,aAAa,EAAE;YACb;gBACE,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,IAAI;aACZ;SACF;QACD,WAAW,EAAE;YACX;gBACE,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,YAAY;aACpB;SACF;QACD,YAAY,EAAE;YACZ;gBACE,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,UAAU;aAClB;YACD;gBACE,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,UAAU;aAClB;YACD;gBACE,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,UAAU;aAClB;SACF;QACD,UAAU,EAAE;YACV;gBACE,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,0BAA0B;aAClC;SACF;QACD,SAAS,EAAE;YACT;gBACE,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,MAAM;aACd;SACF;KACF;IACD,gBAAgB,EAAE,YAAY,CAAC;QAC3B,IAAI,EAAE,0GAA0G;QAChH,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,KAAK;QACtB,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;KACZ,CACF;CAAC,CAAC,CAAC;AACN,wCAAwC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-metadata-service.js b/src/app/shared/mocks/mock-metadata-service.js new file mode 100644 index 0000000000..6621acfaf7 --- /dev/null +++ b/src/app/shared/mocks/mock-metadata-service.js @@ -0,0 +1,10 @@ +var MockMetadataService = /** @class */ (function () { + function MockMetadataService() { + } + // tslint:disable-next-line:no-empty + MockMetadataService.prototype.listenForRouteChange = function () { + }; + return MockMetadataService; +}()); +export { MockMetadataService }; +//# sourceMappingURL=mock-metadata-service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-metadata-service.js.map b/src/app/shared/mocks/mock-metadata-service.js.map new file mode 100644 index 0000000000..31eaafd020 --- /dev/null +++ b/src/app/shared/mocks/mock-metadata-service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-metadata-service.js","sourceRoot":"","sources":["mock-metadata-service.ts"],"names":[],"mappings":"AACA;IAAA;IAOA,CAAC;IALC,oCAAoC;IAC7B,kDAAoB,GAA3B;IAEA,CAAC;IAEH,0BAAC;AAAD,CAAC,AAPD,IAOC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-object-cache.service.js b/src/app/shared/mocks/mock-object-cache.service.js new file mode 100644 index 0000000000..bf63406fb9 --- /dev/null +++ b/src/app/shared/mocks/mock-object-cache.service.js @@ -0,0 +1,14 @@ +export function getMockObjectCacheService() { + return jasmine.createSpyObj('objectCacheService', [ + 'add', + 'remove', + 'getByUUID', + 'getBySelfLink', + 'getRequestHrefBySelfLink', + 'getRequestHrefByUUID', + 'getList', + 'hasByUUID', + 'hasBySelfLink' + ]); +} +//# sourceMappingURL=mock-object-cache.service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-object-cache.service.js.map b/src/app/shared/mocks/mock-object-cache.service.js.map new file mode 100644 index 0000000000..e0d73dc26a --- /dev/null +++ b/src/app/shared/mocks/mock-object-cache.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-object-cache.service.js","sourceRoot":"","sources":["mock-object-cache.service.ts"],"names":[],"mappings":"AAEA,MAAM;IACJ,OAAO,OAAO,CAAC,YAAY,CAAC,oBAAoB,EAAE;QAChD,KAAK;QACL,QAAQ;QACR,WAAW;QACX,eAAe;QACf,0BAA0B;QAC1B,sBAAsB;QACtB,SAAS;QACT,WAAW;QACX,eAAe;KAChB,CAAC,CAAC;AAEL,CAAC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-remote-data-build.service.js b/src/app/shared/mocks/mock-remote-data-build.service.js new file mode 100644 index 0000000000..d2f84f9d33 --- /dev/null +++ b/src/app/shared/mocks/mock-remote-data-build.service.js @@ -0,0 +1,21 @@ +import { of as observableOf } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { RemoteData } from '../../core/data/remote-data'; +import { hasValue } from '../empty.util'; +export function getMockRemoteDataBuildService(toRemoteDataObservable$) { + return { + toRemoteDataObservable: function (requestEntry$, payload$) { + if (hasValue(toRemoteDataObservable$)) { + return toRemoteDataObservable$; + } + else { + return payload$.pipe(map(function (payload) { return ({ + payload: payload + }); })); + } + }, + buildSingle: function (href$) { return observableOf(new RemoteData(false, false, true, undefined, {})); }, + build: function (normalized) { return Object.create({}); } + }; +} +//# sourceMappingURL=mock-remote-data-build.service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-remote-data-build.service.js.map b/src/app/shared/mocks/mock-remote-data-build.service.js.map new file mode 100644 index 0000000000..2add06cc91 --- /dev/null +++ b/src/app/shared/mocks/mock-remote-data-build.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-remote-data-build.service.js","sourceRoot":"","sources":["mock-remote-data-build.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,MAAM,wCAAwC,uBAAqD;IACjG,OAAO;QACL,sBAAsB,EAAE,UAAC,aAAuC,EAAE,QAAyB;YAEzF,IAAI,QAAQ,CAAC,uBAAuB,CAAC,EAAE;gBACrC,OAAO,uBAAuB,CAAC;aAChC;iBAAM;gBACL,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,OAAO,IAAK,OAAA,CAAC;oBACrC,OAAO,SAAA;iBACY,CAAA,EAFiB,CAEjB,CAAC,CAAC,CAAA;aACxB;QACH,CAAC;QACD,WAAW,EAAE,UAAC,KAAkC,IAAK,OAAA,YAAY,CAAC,IAAI,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,EAA/D,CAA+D;QACpH,KAAK,EAAE,UAAC,UAAiC,IAAK,OAAA,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAjB,CAAiB;KACtC,CAAC;AAE9B,CAAC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-request.service.js b/src/app/shared/mocks/mock-request.service.js new file mode 100644 index 0000000000..265bbb6eea --- /dev/null +++ b/src/app/shared/mocks/mock-request.service.js @@ -0,0 +1,16 @@ +import { of as observableOf } from 'rxjs'; +import { RequestEntry } from '../../core/data/request.reducer'; +export function getMockRequestService(requestEntry$) { + if (requestEntry$ === void 0) { requestEntry$ = observableOf(new RequestEntry()); } + return jasmine.createSpyObj('requestService', { + configure: false, + generateRequestId: 'clients/b186e8ce-e99c-4183-bc9a-42b4821bdb78', + getByHref: requestEntry$, + getByUUID: requestEntry$, + uriEncodeBody: jasmine.createSpy('uriEncodeBody'), + /* tslint:disable:no-empty */ + removeByHrefSubstring: function () { } + /* tslint:enable:no-empty */ + }); +} +//# sourceMappingURL=mock-request.service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-request.service.js.map b/src/app/shared/mocks/mock-request.service.js.map new file mode 100644 index 0000000000..6575346d02 --- /dev/null +++ b/src/app/shared/mocks/mock-request.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-request.service.js","sourceRoot":"","sources":["mock-request.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,IAAI,YAAY,EAAe,MAAM,MAAM,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,MAAM,gCAAgC,aAA0E;IAA1E,8BAAA,EAAA,gBAA0C,YAAY,CAAC,IAAI,YAAY,EAAE,CAAC;IAC9G,OAAO,OAAO,CAAC,YAAY,CAAC,gBAAgB,EAAE;QAC5C,SAAS,EAAE,KAAK;QAChB,iBAAiB,EAAE,8CAA8C;QACjE,SAAS,EAAE,aAAa;QACxB,SAAS,EAAE,aAAa;QACxB,aAAa,EAAE,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC;QACjD,6BAA6B;QAC7B,qBAAqB,EAAE,cAAO,CAAC;QAC/B,4BAA4B;KAC7B,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-role-service.js b/src/app/shared/mocks/mock-role-service.js new file mode 100644 index 0000000000..038d84e14b --- /dev/null +++ b/src/app/shared/mocks/mock-role-service.js @@ -0,0 +1,45 @@ +import { RoleType } from '../../core/roles/role-types'; +import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject'; +var MockRoleService = /** @class */ (function () { + function MockRoleService() { + this._isSubmitter = new BehaviorSubject(true); + this._isController = new BehaviorSubject(true); + this._isAdmin = new BehaviorSubject(true); + } + MockRoleService.prototype.setSubmitter = function (isSubmitter) { + this._isSubmitter.next(isSubmitter); + }; + MockRoleService.prototype.setController = function (isController) { + this._isController.next(isController); + }; + MockRoleService.prototype.setAdmin = function (isAdmin) { + this._isAdmin.next(isAdmin); + }; + MockRoleService.prototype.isSubmitter = function () { + return this._isSubmitter; + }; + MockRoleService.prototype.isController = function () { + return this._isController; + }; + MockRoleService.prototype.isAdmin = function () { + return this._isAdmin; + }; + MockRoleService.prototype.checkRole = function (role) { + var check; + switch (role) { + case RoleType.Submitter: + check = this.isSubmitter(); + break; + case RoleType.Controller: + check = this.isController(); + break; + case RoleType.Admin: + check = this.isAdmin(); + break; + } + return check; + }; + return MockRoleService; +}()); +export { MockRoleService }; +//# sourceMappingURL=mock-role-service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-role-service.js.map b/src/app/shared/mocks/mock-role-service.js.map new file mode 100644 index 0000000000..2d5f52000f --- /dev/null +++ b/src/app/shared/mocks/mock-role-service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-role-service.js","sourceRoot":"","sources":["mock-role-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE;IAAA;QAEE,iBAAY,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;QACzC,kBAAa,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;QAC1C,aAAQ,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;IA0CvC,CAAC;IAxCC,sCAAY,GAAZ,UAAa,WAAoB;QAC/B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,uCAAa,GAAb,UAAc,YAAqB;QACjC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC;IAED,kCAAQ,GAAR,UAAS,OAAgB;QACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,qCAAW,GAAX;QACE,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,sCAAY,GAAZ;QACE,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,iCAAO,GAAP;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,mCAAS,GAAT,UAAU,IAAc;QACtB,IAAI,KAA0B,CAAC;QAC/B,QAAQ,IAAI,EAAE;YACZ,KAAK,QAAQ,CAAC,SAAS;gBACrB,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;gBAC3B,MAAM;YACR,KAAK,QAAQ,CAAC,UAAU;gBACtB,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;gBAC5B,MAAM;YACR,KAAK,QAAQ,CAAC,KAAK;gBACjB,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;gBACvB,MAAM;SACT;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IACH,sBAAC;AAAD,CAAC,AA9CD,IA8CC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-router.js b/src/app/shared/mocks/mock-router.js new file mode 100644 index 0000000000..b9eaf52248 --- /dev/null +++ b/src/app/shared/mocks/mock-router.js @@ -0,0 +1,33 @@ +import { of as observableOf } from 'rxjs'; +/** + * Mock for [[RouterService]] + */ +var MockRouter = /** @class */ (function () { + function MockRouter() { + this.events = observableOf({}); + this.routerState = { + snapshot: { + url: '', + root: { + queryParamMap: null + } + } + }; + // noinspection TypeScriptUnresolvedFunction + this.navigate = jasmine.createSpy('navigate'); + this.navigateByUrl = jasmine.createSpy('navigateByUrl'); + } + MockRouter.prototype.setRoute = function (route) { + this.routerState.snapshot.url = route; + }; + MockRouter.prototype.setParams = function (paramsMap) { + this.routerState.snapshot.root.queryParamMap = paramsMap; + }; + MockRouter.prototype.createUrlTree = function (commands, navExtras) { + if (navExtras === void 0) { navExtras = {}; } + return {}; + }; + return MockRouter; +}()); +export { MockRouter }; +//# sourceMappingURL=mock-router.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-router.js.map b/src/app/shared/mocks/mock-router.js.map new file mode 100644 index 0000000000..1f1ab2f029 --- /dev/null +++ b/src/app/shared/mocks/mock-router.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-router.js","sourceRoot":"","sources":["mock-router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAE1C;;GAEG;AACH;IAAA;QACS,WAAM,GAAG,YAAY,CAAC,EAAE,CAAC,CAAC;QAC1B,gBAAW,GAAG;YACnB,QAAQ,EAAE;gBACR,GAAG,EAAE,EAAE;gBACP,IAAI,EAAE;oBACJ,aAAa,EAAE,IAAI;iBACpB;aACF;SACF,CAAC;QAEF,4CAA4C;QAC5C,aAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACzC,kBAAa,GAAG,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAarD,CAAC;IAXC,6BAAQ,GAAR,UAAS,KAAK;QACZ,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,GAAG,KAAK,CAAC;IACxC,CAAC;IAED,8BAAS,GAAT,UAAU,SAAS;QACjB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;IAC3D,CAAC;IAED,kCAAa,GAAb,UAAc,QAAQ,EAAE,SAAc;QAAd,0BAAA,EAAA,cAAc;QACpC,OAAO,EAAE,CAAC;IACZ,CAAC;IACH,iBAAC;AAAD,CAAC,AA1BD,IA0BC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-scroll-to-service.js b/src/app/shared/mocks/mock-scroll-to-service.js new file mode 100644 index 0000000000..68af1820a3 --- /dev/null +++ b/src/app/shared/mocks/mock-scroll-to-service.js @@ -0,0 +1,9 @@ +/** + * Mock for [[ScrollToService]] + */ +export function getMockScrollToService() { + return jasmine.createSpyObj('scrollToService', { + scrollTo: jasmine.createSpy('scrollTo') + }); +} +//# sourceMappingURL=mock-scroll-to-service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-scroll-to-service.js.map b/src/app/shared/mocks/mock-scroll-to-service.js.map new file mode 100644 index 0000000000..6daebe7139 --- /dev/null +++ b/src/app/shared/mocks/mock-scroll-to-service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-scroll-to-service.js","sourceRoot":"","sources":["mock-scroll-to-service.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM;IACJ,OAAO,OAAO,CAAC,YAAY,CAAC,iBAAiB,EAAE;QAC7C,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC;KACxC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-section-upload.service.js b/src/app/shared/mocks/mock-section-upload.service.js new file mode 100644 index 0000000000..37024713f5 --- /dev/null +++ b/src/app/shared/mocks/mock-section-upload.service.js @@ -0,0 +1,14 @@ +/** + * Mock for [[SubmissionFormsConfigService]] + */ +export function getMockSectionUploadService() { + return jasmine.createSpyObj('SectionUploadService', { + getUploadedFileList: jasmine.createSpy('getUploadedFileList'), + getFileData: jasmine.createSpy('getFileData'), + getDefaultPolicies: jasmine.createSpy('getDefaultPolicies'), + addUploadedFile: jasmine.createSpy('addUploadedFile'), + updateFileData: jasmine.createSpy('updateFileData'), + removeUploadedFile: jasmine.createSpy('removeUploadedFile') + }); +} +//# sourceMappingURL=mock-section-upload.service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-section-upload.service.js.map b/src/app/shared/mocks/mock-section-upload.service.js.map new file mode 100644 index 0000000000..e898a23121 --- /dev/null +++ b/src/app/shared/mocks/mock-section-upload.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-section-upload.service.js","sourceRoot":"","sources":["mock-section-upload.service.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM;IACJ,OAAO,OAAO,CAAC,YAAY,CAAC,sBAAsB,EAAE;QAClD,mBAAmB,EAAE,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC;QAC7D,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC;QAC7C,kBAAkB,EAAE,OAAO,CAAC,SAAS,CAAC,oBAAoB,CAAC;QAC3D,eAAe,EAAE,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC;QACrD,cAAc,EAAE,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC;QACnD,kBAAkB,EAAE,OAAO,CAAC,SAAS,CAAC,oBAAoB,CAAC;KAC5D,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-store.js b/src/app/shared/mocks/mock-store.js new file mode 100644 index 0000000000..80ee9c68ab --- /dev/null +++ b/src/app/shared/mocks/mock-store.js @@ -0,0 +1 @@ +//# sourceMappingURL=mock-store.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-store.js.map b/src/app/shared/mocks/mock-store.js.map new file mode 100644 index 0000000000..14ff0dd608 --- /dev/null +++ b/src/app/shared/mocks/mock-store.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-store.js","sourceRoot":"","sources":["mock-store.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-submission.js b/src/app/shared/mocks/mock-submission.js new file mode 100644 index 0000000000..3d6c75f976 --- /dev/null +++ b/src/app/shared/mocks/mock-submission.js @@ -0,0 +1,1572 @@ +import { PaginatedList } from '../../core/data/paginated-list'; +import { PageInfo } from '../../core/shared/page-info.model'; +import { FormFieldMetadataValueObject } from '../form/builder/models/form-field-metadata-value.model'; +import { Group } from '../../core/eperson/models/group.model'; +export var mockSectionsData = { + traditionalpageone: { + 'dc.title': [ + new FormFieldMetadataValueObject('test', null, null, 'test') + ] + }, + license: { + url: null, + acceptanceDate: null, + granted: false + }, + upload: { + files: [] + } +}; +export var mockSectionsDataTwo = { + traditionalpageone: { + 'dc.title': [ + new FormFieldMetadataValueObject('test', null, null, 'test') + ] + }, + traditionalpagetwo: { + 'dc.relation': [ + new FormFieldMetadataValueObject('test', null, null, 'test') + ] + }, + license: { + url: null, + acceptanceDate: null, + granted: false + }, + upload: { + files: [] + } +}; +export var mockSectionsErrors = [ + { + message: 'error.validation.required', + paths: [ + '/sections/traditionalpageone/dc.contributor.author', + '/sections/traditionalpageone/dc.title', + '/sections/traditionalpageone/dc.date.issued' + ] + }, + { + message: 'error.validation.license.notgranted', + paths: [ + '/sections/license' + ] + } +]; +export var mockUploadResponse1Errors = { + errors: [ + { + message: 'error.validation.required', + paths: [ + '/sections/traditionalpageone/dc.title', + '/sections/traditionalpageone/dc.date.issued' + ] + } + ] +}; +export var mockUploadResponse1ParsedErrors = { + traditionalpageone: [ + { path: '/sections/traditionalpageone/dc.title', message: 'error.validation.required' }, + { path: '/sections/traditionalpageone/dc.date.issued', message: 'error.validation.required' } + ] +}; +export var mockLicenseParsedErrors = { + license: [ + { path: '/sections/license', message: 'error.validation.license.notgranted' } + ] +}; +export var mockUploadResponse2Errors = { + errors: [ + { + message: 'error.validation.required', + paths: [ + '/sections/traditionalpageone/dc.title', + '/sections/traditionalpageone/dc.date.issued' + ] + }, + { + message: 'error.upload', + paths: [ + '/sections/upload' + ] + } + ] +}; +export var mockUploadResponse2ParsedErrors = { + traditionalpageone: [ + { path: '/sections/traditionalpageone/dc.title', message: 'error.validation.required' }, + { path: '/sections/traditionalpageone/dc.date.issued', message: 'error.validation.required' } + ], + upload: [ + { path: '/sections/upload', message: 'error.upload' } + ] +}; +export var mockSubmissionRestResponse = [ + { + id: 826, + lastModified: '2018-08-03T12:49:45.268+0000', + collection: [ + { + handle: '10673/2', + license: 'https://rest.api/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb/license', + defaultAccessConditions: [], + logo: [ + { + sizeBytes: 7451, + content: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425/content', + format: [], + bundleName: null, + self: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425', + id: '3f859425-ffbd-4b0e-bf91-bfeb458a7425', + uuid: '3f859425-ffbd-4b0e-bf91-bfeb458a7425', + type: 'bitstream', + name: null, + metadata: [], + _links: { + content: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425/content', + format: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425/format', + self: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425' + } + } + ], + self: 'https://rest.api/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb', + id: '1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb', + uuid: '1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb', + type: 'collection', + name: 'Collection of Sample Items', + metadata: [ + { + key: 'dc.provenance', + language: null, + value: 'This field is for private provenance information. It is only visible to Administrative users and is not displayed in the user interface by default.' + }, + { + key: 'dc.rights.license', + language: null, + value: '' + }, + { + key: 'dc.description', + language: null, + value: '

This is a DSpace Collection which contains sample DSpace Items.

\r\n

Collections in DSpace may only contain Items.

\r\n

This particular Collection has its own logo (the Open Source Initiative logo).

\r\n

This introductory text is editable by System Administrators, Community Administrators (of a parent Community) or Collection Administrators (of this Collection).

' + }, + { + key: 'dc.description.abstract', + language: null, + value: 'This collection contains sample items.' + }, + { + key: 'dc.description.tableofcontents', + language: null, + value: '

This is the news section for this Collection. System Administrators, Community Administrators (of a parent Community) or Collection Administrators (of this Collection) can edit this News field.

' + }, + { + key: 'dc.rights', + language: null, + value: '

If this collection had a specific copyright statement, it would be placed here.

' + }, + { + key: 'dc.title', + language: null, + value: 'Collection of Sample Items' + } + ], + _links: { + license: 'https://rest.api/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb/license', + defaultAccessConditions: 'https://rest.api/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb/defaultAccessConditions', + logo: 'https://rest.api/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb/logo', + self: 'https://rest.api/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb' + } + } + ], + item: [ + { + handle: null, + lastModified: '2018-07-25T14:08:28.750+0000', + isArchived: false, + isDiscoverable: true, + isWithdrawn: false, + bitstreams: 'https://rest.api/dspace-spring-rest/api/core/items/6f344222-6980-4738-8192-b808d79af8a5/bitstreams', + self: 'https://rest.api/dspace-spring-rest/api/core/items/6f344222-6980-4738-8192-b808d79af8a5', + id: '6f344222-6980-4738-8192-b808d79af8a5', + uuid: '6f344222-6980-4738-8192-b808d79af8a5', + type: 'item', + name: null, + metadata: [], + _links: { + bitstreams: 'https://rest.api/dspace-spring-rest/api/core/items/6f344222-6980-4738-8192-b808d79af8a5/bitstreams', + owningCollection: 'https://rest.api/dspace-spring-rest/api/core/items/6f344222-6980-4738-8192-b808d79af8a5/owningCollection', + templateItemOf: 'https://rest.api/dspace-spring-rest/api/core/items/6f344222-6980-4738-8192-b808d79af8a5/templateItemOf', + self: 'https://rest.api/dspace-spring-rest/api/core/items/6f344222-6980-4738-8192-b808d79af8a5' + } + } + ], + sections: {}, + submissionDefinition: [ + { + isDefault: true, + sections: [ + { + mandatory: true, + sectionType: 'utils', + visibility: { + main: 'HIDDEN', + other: 'HIDDEN' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/extraction' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/extraction' + }, + { + mandatory: true, + sectionType: 'collection', + visibility: { + main: 'HIDDEN', + other: 'HIDDEN' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/collection' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/collection' + }, + { + header: 'submit.progressbar.describe.stepone', + mandatory: true, + sectionType: 'submission-form', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpageone', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpageone' + }, + { + header: 'submit.progressbar.describe.steptwo', + mandatory: false, + sectionType: 'submission-form', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpagetwo', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpagetwo' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpagetwo' + }, + { + header: 'submit.progressbar.upload', + mandatory: true, + sectionType: 'upload', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/upload', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/upload' + }, + { + header: 'submit.progressbar.license', + mandatory: true, + sectionType: 'license', + visibility: { + main: null, + other: 'READONLY' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/license' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/license' + } + ], + name: 'traditional', + type: 'submissiondefinition', + _links: { + collections: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional/collections', + sections: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional/sections', + self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional' + } + ], + submitter: [], + errors: [], + self: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826', + type: 'workspaceitem', + _links: { + collection: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826/collection', + item: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826/item', + submissionDefinition: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826/submissionDefinition', + submitter: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826/submitter', + self: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826' + } + } +]; +export var mockSubmissionObject = { + collection: { + handle: '10673/2', + license: 'https://rest.api/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb/license', + defaultAccessConditions: { + pageInfo: { + elementsPerPage: 1, + totalElements: 1, + totalPages: 1, + currentPage: 1 + }, + page: [ + { + name: null, + groupUUID: '11cc35e5-a11d-4b64-b5b9-0052a5d15509', + id: 20, + uuid: 'resource-policy-20', + self: 'https://rest.api/dspace-spring-rest/api/authz/resourcePolicies/20', + type: 'resourcePolicy', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/authz/resourcePolicies/20' + } + } + ] + }, + logo: { + sizeBytes: 7451, + content: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425/content', + format: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425/format', + bundleName: null, + self: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425', + id: '3f859425-ffbd-4b0e-bf91-bfeb458a7425', + uuid: '3f859425-ffbd-4b0e-bf91-bfeb458a7425', + type: 'bitstream', + name: null, + metadata: [], + _links: { + content: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425/content', + format: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425/format', + self: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425' + } + }, + self: 'https://rest.api/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb', + id: '1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb', + uuid: '1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb', + type: 'collection', + name: 'Collection of Sample Items', + metadata: [ + { + key: 'dc.provenance', + language: null, + value: 'This field is for private provenance information. It is only visible to Administrative users and is not displayed in the user interface by default.' + }, + { + key: 'dc.rights.license', + language: null, + value: '' + }, + { + key: 'dc.description', + language: null, + value: '

This is a DSpace Collection which contains sample DSpace Items.

\r\n

Collections in DSpace may only contain Items.

\r\n

This particular Collection has its own logo (the Open Source Initiative logo).

\r\n

This introductory text is editable by System Administrators, Community Administrators (of a parent Community) or Collection Administrators (of this Collection).

' + }, + { + key: 'dc.description.abstract', + language: null, + value: 'This collection contains sample items.' + }, + { + key: 'dc.description.tableofcontents', + language: null, + value: '

This is the news section for this Collection. System Administrators, Community Administrators (of a parent Community) or Collection Administrators (of this Collection) can edit this News field.

' + }, + { + key: 'dc.rights', + language: null, + value: '

If this collection had a specific copyright statement, it would be placed here.

' + }, + { + key: 'dc.title', + language: null, + value: 'Collection of Sample Items' + } + ], + _links: { + license: 'https://rest.api/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb/license', + defaultAccessConditions: 'https://rest.api/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb/defaultAccessConditions', + logo: 'https://rest.api/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb/logo', + self: 'https://rest.api/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb' + } + }, + item: { + handle: null, + lastModified: '2019-01-09T10:17:33.722+0000', + isArchived: false, + isDiscoverable: true, + isWithdrawn: false, + owningCollection: 'https://rest.api/dspace-spring-rest/api/core/items/cae8af78-c874-4468-af79-e6c996aa8270/owningCollection', + bitstreams: { + pageInfo: { + elementsPerPage: 0, + totalElements: 0, + totalPages: 1, + currentPage: 1 + }, + page: [] + }, + self: 'https://rest.api/dspace-spring-rest/api/core/items/cae8af78-c874-4468-af79-e6c996aa8270', + id: 'cae8af78-c874-4468-af79-e6c996aa8270', + uuid: 'cae8af78-c874-4468-af79-e6c996aa8270', + type: 'item', + name: null, + metadata: [], + _links: { + bitstreams: 'https://rest.api/dspace-spring-rest/api/core/items/cae8af78-c874-4468-af79-e6c996aa8270/bitstreams', + owningCollection: 'https://rest.api/dspace-spring-rest/api/core/items/cae8af78-c874-4468-af79-e6c996aa8270/owningCollection', + templateItemOf: 'https://rest.api/dspace-spring-rest/api/core/items/cae8af78-c874-4468-af79-e6c996aa8270/templateItemOf', + self: 'https://rest.api/dspace-spring-rest/api/core/items/cae8af78-c874-4468-af79-e6c996aa8270' + } + }, + submissionDefinition: { + isDefault: true, + sections: { + pageInfo: { + elementsPerPage: 5, + totalElements: 5, + totalPages: 1, + currentPage: 1 + }, + page: [ + { + mandatory: true, + sectionType: 'collection', + visibility: { + main: 'HIDDEN', + other: 'HIDDEN' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/collection' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/collection' + }, + { + header: 'submit.progressbar.describe.stepone', + mandatory: true, + sectionType: 'submission-form', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpageone', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpageone' + }, + { + header: 'submit.progressbar.describe.steptwo', + mandatory: true, + sectionType: 'submission-form', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpagetwo', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpagetwo' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpagetwo' + }, + { + header: 'submit.progressbar.upload', + mandatory: true, + sectionType: 'upload', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/upload', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/upload' + }, + { + header: 'submit.progressbar.license', + mandatory: true, + sectionType: 'license', + visibility: { + main: null, + other: 'READONLY' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/license' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/license' + } + ] + }, + name: 'traditional', + type: 'submissiondefinition', + _links: { + collections: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional/collections', + sections: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional/sections', + self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional', + collections: { + pageInfo: { + elementsPerPage: 0, + totalElements: 0, + totalPages: 1, + currentPage: 1 + }, + page: [] + } + }, + submitter: { + handle: null, + groups: [], + netid: null, + lastActive: '2019-01-09T10:17:33.047+0000', + canLogIn: true, + email: 'dspacedemo+submit@gmail.com', + requireCertificate: false, + selfRegistered: false, + self: 'https://rest.api/dspace-spring-rest/api/eperson/epersons/99423c27-b642-5tg6-a9cd-6d910e68dca5', + id: '99423c27-b642-5tg6-a9cd-6d910e68dca5', + uuid: '99423c27-b642-5tg6-a9cd-6d910e68dca5', + type: 'eperson', + name: 'dspacedemo+submit@gmail.com', + metadata: [ + { + key: 'eperson.firstname', + language: null, + value: 'Demo' + }, + { + key: 'eperson.lastname', + language: null, + value: 'Submitter' + } + ], + _links: { + self: 'https://rest.api/dspace-spring-rest/api/eperson/epersons/99423c27-b642-5tg6-a9cd-6d910e68dca5' + } + }, + id: 826, + lastModified: '2019-01-09T10:17:33.738+0000', + sections: { + license: { + url: null, + acceptanceDate: null, + granted: false + }, + upload: { + files: [] + } + }, + errors: [ + { + message: 'error.validation.required', + paths: [ + '/sections/traditionalpageone/dc.title', + '/sections/traditionalpageone/dc.date.issued' + ] + } + ], + self: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826', + type: 'workspaceitem', + _links: { + collection: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826/collection', + item: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826/item', + submissionDefinition: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826/submissionDefinition', + submitter: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826/submitter', + self: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826' + } +}; +export var mockSubmissionObjectNew = { + collection: { + handle: '10673/2', + license: 'https://rest.api/dspace-spring-rest/api/core/collections/45f2f3f1-ba1f-4f36-908a-3f1ea9a557eb/license', + defaultAccessConditions: { + pageInfo: { + elementsPerPage: 1, + totalElements: 1, + totalPages: 1, + currentPage: 1 + }, + page: [ + { + name: null, + groupUUID: '11cc35e5-a11d-4b64-b5b9-0052a5d15509', + id: 20, + uuid: 'resource-policy-20', + self: 'https://rest.api/dspace-spring-rest/api/authz/resourcePolicies/20', + type: 'resourcePolicy', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/authz/resourcePolicies/20' + } + } + ] + }, + logo: { + sizeBytes: 7451, + content: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425/content', + format: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425/format', + bundleName: null, + self: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425', + id: '3f859425-ffbd-4b0e-bf91-bfeb458a7425', + uuid: '3f859425-ffbd-4b0e-bf91-bfeb458a7425', + type: 'bitstream', + name: null, + metadata: [], + _links: { + content: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425/content', + format: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425/format', + self: 'https://rest.api/dspace-spring-rest/api/core/bitstreams/3f859425-ffbd-4b0e-bf91-bfeb458a7425' + } + }, + self: 'https://rest.api/dspace-spring-rest/api/core/collections/45f2f3f1-ba1f-4f36-908a-3f1ea9a557eb', + id: '45f2f3f1-ba1f-4f36-908a-3f1ea9a557eb', + uuid: '45f2f3f1-ba1f-4f36-908a-3f1ea9a557eb', + type: 'collection', + name: 'Another Collection of Sample Items', + metadata: [ + { + key: 'dc.provenance', + language: null, + value: 'This field is for private provenance information. It is only visible to Administrative users and is not displayed in the user interface by default.' + }, + { + key: 'dc.rights.license', + language: null, + value: '' + }, + { + key: 'dc.description', + language: null, + value: '

This is a DSpace Collection which contains sample DSpace Items.

\r\n

Collections in DSpace may only contain Items.

\r\n

This particular Collection has its own logo (the Open Source Initiative logo).

\r\n

This introductory text is editable by System Administrators, Community Administrators (of a parent Community) or Collection Administrators (of this Collection).

' + }, + { + key: 'dc.description.abstract', + language: null, + value: 'This collection contains sample items.' + }, + { + key: 'dc.description.tableofcontents', + language: null, + value: '

This is the news section for this Collection. System Administrators, Community Administrators (of a parent Community) or Collection Administrators (of this Collection) can edit this News field.

' + }, + { + key: 'dc.rights', + language: null, + value: '

If this collection had a specific copyright statement, it would be placed here.

' + }, + { + key: 'dc.title', + language: null, + value: 'Collection of Sample Items' + } + ], + _links: { + license: 'https://rest.api/dspace-spring-rest/api/core/collections/45f2f3f1-ba1f-4f36-908a-3f1ea9a557eb/license', + defaultAccessConditions: 'https://rest.api/dspace-spring-rest/api/core/collections/45f2f3f1-ba1f-4f36-908a-3f1ea9a557eb/defaultAccessConditions', + logo: 'https://rest.api/dspace-spring-rest/api/core/collections/45f2f3f1-ba1f-4f36-908a-3f1ea9a557eb/logo', + self: 'https://rest.api/dspace-spring-rest/api/core/collections/45f2f3f1-ba1f-4f36-908a-3f1ea9a557eb' + } + }, + item: { + handle: null, + lastModified: '2019-01-09T10:17:33.722+0000', + isArchived: false, + isDiscoverable: true, + isWithdrawn: false, + owningCollection: 'https://rest.api/dspace-spring-rest/api/core/items/cae8af78-c874-4468-af79-e6c996aa8270/owningCollection', + bitstreams: { + pageInfo: { + elementsPerPage: 0, + totalElements: 0, + totalPages: 1, + currentPage: 1 + }, + page: [] + }, + self: 'https://rest.api/dspace-spring-rest/api/core/items/cae8af78-c874-4468-af79-e6c996aa8270', + id: 'cae8af78-c874-4468-af79-e6c996aa8270', + uuid: 'cae8af78-c874-4468-af79-e6c996aa8270', + type: 'item', + name: null, + metadata: [], + _links: { + bitstreams: 'https://rest.api/dspace-spring-rest/api/core/items/cae8af78-c874-4468-af79-e6c996aa8270/bitstreams', + owningCollection: 'https://rest.api/dspace-spring-rest/api/core/items/cae8af78-c874-4468-af79-e6c996aa8270/owningCollection', + templateItemOf: 'https://rest.api/dspace-spring-rest/api/core/items/cae8af78-c874-4468-af79-e6c996aa8270/templateItemOf', + self: 'https://rest.api/dspace-spring-rest/api/core/items/cae8af78-c874-4468-af79-e6c996aa8270' + } + }, + submissionDefinition: { + isDefault: true, + sections: { + pageInfo: { + elementsPerPage: 5, + totalElements: 5, + totalPages: 1, + currentPage: 1 + }, + page: [ + { + mandatory: true, + sectionType: 'collection', + visibility: { + main: 'HIDDEN', + other: 'HIDDEN' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/collection' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/collection' + }, + { + header: 'submit.progressbar.describe.stepone', + mandatory: true, + sectionType: 'submission-form', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpageone', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpageone' + }, + { + header: 'submit.progressbar.describe.steptwo', + mandatory: true, + sectionType: 'submission-form', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpagetwo', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpagetwo' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpagetwo' + }, + { + header: 'submit.progressbar.upload', + mandatory: true, + sectionType: 'upload', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/upload', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/upload' + }, + { + header: 'submit.progressbar.license', + mandatory: true, + sectionType: 'license', + visibility: { + main: null, + other: 'READONLY' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/license' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/license' + } + ] + }, + name: 'traditionaltwo', + type: 'submissiondefinition', + _links: { + collections: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional/collections', + sections: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional/sections', + self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional', + collections: { + pageInfo: { + elementsPerPage: 0, + totalElements: 0, + totalPages: 1, + currentPage: 1 + }, + page: [] + } + }, + submitter: { + handle: null, + groups: [], + netid: null, + lastActive: '2019-01-09T10:17:33.047+0000', + canLogIn: true, + email: 'dspacedemo+submit@gmail.com', + requireCertificate: false, + selfRegistered: false, + self: 'https://rest.api/dspace-spring-rest/api/eperson/epersons/99423c27-b642-4bb9-a9cd-45gh23e68dca5', + id: '99423c27-b642-4bb9-a9cd-45gh23e68dca5', + uuid: '99423c27-b642-4bb9-a9cd-45gh23e68dca5', + type: 'eperson', + name: 'dspacedemo+submit@gmail.com', + metadata: [ + { + key: 'eperson.firstname', + language: null, + value: 'Demo' + }, + { + key: 'eperson.lastname', + language: null, + value: 'Submitter' + } + ], + _links: { + self: 'https://rest.api/dspace-spring-rest/api/eperson/epersons/99423c27-b642-4bb9-a9cd-45gh23e68dca5' + } + }, + id: 826, + lastModified: '2019-01-09T10:17:33.738+0000', + sections: {}, + errors: [], + self: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826', + type: 'workspaceitem', + _links: { + collection: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826/collection', + item: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826/item', + submissionDefinition: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826/submissionDefinition', + submitter: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826/submitter', + self: 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826' + } +}; +export var mockSubmissionCollectionId = '1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb'; +export var mockSubmissionId = '826'; +export var mockSubmissionSelfUrl = 'https://rest.api/dspace-spring-rest/api/submission/workspaceitems/826'; +export var mockSubmissionDefinitionResponse = { + isDefault: true, + sections: [ + { + mandatory: true, + sectionType: 'utils', + visibility: { + main: 'HIDDEN', + other: 'HIDDEN' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/extraction' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/extraction' + }, + { + mandatory: true, + sectionType: 'collection', + visibility: { + main: 'HIDDEN', + other: 'HIDDEN' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/collection' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/collection' + }, + { + header: 'submit.progressbar.describe.stepone', + mandatory: true, + sectionType: 'submission-form', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpageone', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpageone' + }, + { + header: 'submit.progressbar.describe.steptwo', + mandatory: false, + sectionType: 'submission-form', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpagetwo', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpagetwo' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpagetwo' + }, + { + header: 'submit.progressbar.upload', + mandatory: true, + sectionType: 'upload', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/upload', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/upload' + }, + { + header: 'submit.progressbar.license', + mandatory: true, + sectionType: 'license', + visibility: { + main: null, + other: 'READONLY' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/license' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/license' + } + ], + name: 'traditional', + type: 'submissiondefinition', + _links: { + collections: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional/collections', + sections: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional/sections', + self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional' +}; +export var mockSubmissionDefinition = { + isDefault: true, + sections: new PaginatedList(new PageInfo(), [ + { + mandatory: true, + sectionType: 'utils', + visibility: { + main: 'HIDDEN', + other: 'HIDDEN' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/extraction' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/extraction' + }, + { + mandatory: true, + sectionType: 'collection', + visibility: { + main: 'HIDDEN', + other: 'HIDDEN' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/collection' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/collection' + }, + { + header: 'submit.progressbar.describe.stepone', + mandatory: true, + sectionType: 'submission-form', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpageone', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpageone' + }, + { + header: 'submit.progressbar.describe.steptwo', + mandatory: false, + sectionType: 'submission-form', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpagetwo', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpagetwo' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/traditionalpagetwo' + }, + { + header: 'submit.progressbar.upload', + mandatory: true, + sectionType: 'upload', + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/upload', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/upload' + }, + { + header: 'submit.progressbar.license', + mandatory: true, + sectionType: 'license', + visibility: { + main: null, + other: 'READONLY' + }, + type: 'submissionsection', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/license' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionsections/license' + } + ]), + name: 'traditional', + type: 'submissiondefinition', + _links: { + collections: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional/collections', + sections: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional/sections', + self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional' +}; +export var mockSubmissionState = Object.assign({}, { + 826: { + collection: mockSubmissionCollectionId, + definition: 'traditional', + selfUrl: mockSubmissionSelfUrl, + activeSection: null, + sections: { + extraction: { + config: '', + mandatory: true, + sectionType: 'utils', + visibility: { + main: 'HIDDEN', + other: 'HIDDEN' + }, + collapsed: false, + enabled: true, + data: {}, + errors: [], + isLoading: false, + isValid: false + }, + collection: { + config: '', + mandatory: true, + sectionType: 'collection', + visibility: { + main: 'HIDDEN', + other: 'HIDDEN' + }, + collapsed: false, + enabled: true, + data: {}, + errors: [], + isLoading: false, + isValid: false + }, + traditionalpageone: { + header: 'submit.progressbar.describe.stepone', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone', + mandatory: true, + sectionType: 'submission-form', + collapsed: false, + enabled: true, + data: {}, + errors: [], + isLoading: false, + isValid: false + }, + traditionalpagetwo: { + header: 'submit.progressbar.describe.steptwo', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpagetwo', + mandatory: false, + sectionType: 'submission-form', + collapsed: false, + enabled: false, + data: {}, + errors: [], + isLoading: false, + isValid: false + }, + upload: { + header: 'submit.progressbar.upload', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload', + mandatory: true, + sectionType: 'upload', + collapsed: false, + enabled: true, + data: { + files: [] + }, + errors: [], + isLoading: false, + isValid: false + }, + license: { + header: 'submit.progressbar.license', + config: '', + mandatory: true, + sectionType: 'license', + visibility: { + main: null, + other: 'READONLY' + }, + collapsed: false, + enabled: true, + data: {}, + errors: [], + isLoading: false, + isValid: false + } + }, + isLoading: false, + savePending: false, + depositPending: false + } +}); +export var mockSectionsState = Object.assign({}, { + extraction: { + config: '', + mandatory: true, + sectionType: 'utils', + visibility: { + main: 'HIDDEN', + other: 'HIDDEN' + }, + collapsed: false, + enabled: true, + data: {}, + errors: [], + isLoading: false, + isValid: false + }, + collection: { + config: '', + mandatory: true, + sectionType: 'collection', + visibility: { + main: 'HIDDEN', + other: 'HIDDEN' + }, + collapsed: false, + enabled: true, + data: {}, + errors: [], + isLoading: false, + isValid: false + }, + traditionalpageone: { + header: 'submit.progressbar.describe.stepone', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone', + mandatory: true, + sectionType: 'submission-form', + collapsed: false, + enabled: true, + data: {}, + errors: [], + isLoading: false, + isValid: false + }, + traditionalpagetwo: { + header: 'submit.progressbar.describe.steptwo', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpagetwo', + mandatory: false, + sectionType: 'submission-form', + collapsed: false, + enabled: false, + data: {}, + errors: [], + isLoading: false, + isValid: false + }, + upload: { + header: 'submit.progressbar.upload', + config: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload', + mandatory: true, + sectionType: 'upload', + collapsed: false, + enabled: true, + data: {}, + errors: [], + isLoading: false, + isValid: false + }, + license: { + header: 'submit.progressbar.license', + config: '', + mandatory: true, + sectionType: 'license', + visibility: { + main: null, + other: 'READONLY' + }, + collapsed: false, + enabled: true, + data: {}, + errors: [], + isLoading: false, + isValid: false + } +}); +export var mockSectionsList = [ + { + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone', + mandatory: true, + data: {}, + errors: [], + header: 'submit.progressbar.describe.stepone', + id: 'traditionalpageone', + sectionType: 'submission-form' + }, + { + config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpagetwo', + mandatory: true, + data: {}, + errors: [], + header: 'submit.progressbar.describe.steptwo', + id: 'traditionalpagetwo', + sectionType: 'submission-form' + }, + { + config: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload', + mandatory: true, + data: {}, + errors: [], + header: 'submit.progressbar.upload', + id: 'upload', + sectionType: 'upload' + }, + { + config: '', + mandatory: true, + data: {}, + errors: [], + header: 'submit.progressbar.license', + id: 'license', + sectionType: 'license' + } +]; +export var mockUploadConfigResponse = { + accessConditionOptions: [ + { + name: 'openaccess', + groupUUID: '123456-g', + hasStartDate: false, + hasEndDate: false + }, + { + name: 'lease', + groupUUID: '123456-g', + hasStartDate: false, + hasEndDate: true, + maxEndDate: '2019-07-12T14:40:06.308+0000' + }, + { + name: 'embargo', + groupUUID: '123456-g', + hasStartDate: true, + hasEndDate: false, + maxStartDate: '2022-01-12T14:40:06.308+0000' + }, + { + name: 'administrator', + groupUUID: '0f2773dd-1741-475f-80e7-ccdef153d655', + hasStartDate: false, + hasEndDate: false + } + ], + metadata: { + rows: [ + { + fields: [ + { + input: { + type: 'onebox' + }, + label: 'Title', + mandatory: true, + repeatable: false, + mandatoryMessage: 'You must enter a main title for this item.', + hints: 'Enter the name of the file.', + selectableMetadata: [ + { + metadata: 'dc.title', + label: null, + authority: null, + closed: null + } + ], + languageCodes: [] + } + ] + }, + { + fields: [ + { + input: { + type: 'textarea' + }, + label: 'Description', + mandatory: false, + repeatable: true, + hints: 'Enter a description for the file', + selectableMetadata: [ + { + metadata: 'dc.description', + label: null, + authority: null, + closed: null + } + ], + languageCodes: [] + } + ] + } + ], + name: 'bitstream-metadata', + type: 'submissionform', + _links: { + self: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/bitstream-metadata' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/bitstream-metadata' + }, + required: false, + maxSize: 536870912, + name: 'upload', + type: 'submissionupload', + _links: { + metadata: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload/metadata', + self: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload' + }, + self: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload' +}; +export var mockAccessConditionOptions = [ + { + name: 'openaccess', + groupUUID: '123456-g', + hasStartDate: false, + hasEndDate: false + }, + { + name: 'lease', + groupUUID: '123456-g', + hasStartDate: false, + hasEndDate: true, + maxEndDate: '2019-07-12T14:40:06.308+0000' + }, + { + name: 'embargo', + groupUUID: '123456-g', + hasStartDate: true, + hasEndDate: false, + maxStartDate: '2022-01-12T14:40:06.308+0000' + }, + { + name: 'administrator', + groupUUID: '0f2773dd-1741-475f-80e7-ccdef153d655', + hasStartDate: false, + hasEndDate: false + } +]; +export var mockGroup = Object.assign(new Group(), { + handle: null, + permanent: true, + self: 'https://rest.api/dspace-spring-rest/api/eperson/groups/123456-g1', + id: '123456-g', + uuid: '123456-g', + type: 'group', + name: 'Anonymous', + metadata: [], + _links: { + groups: 'https://rest.api/dspace-spring-rest/api/eperson/groups/123456-g1/groups', + self: 'https://rest.api/dspace-spring-rest/api/eperson/groups/123456-g1' + }, + groups: { + pageInfo: { + elementsPerPage: 0, + totalElements: 0, + totalPages: 1, + currentPage: 1 + }, + page: [] + } +}); +export var mockUploadFiles = [ + { + uuid: '123456-test-upload', + metadata: { + 'dc.source': [ + { + value: '123456-test-upload.jpg', + language: null, + authority: null, + display: '123456-test-upload.jpg', + confidence: -1, + place: 0, + otherInformation: null + } + ], + 'dc.title': [ + { + value: '123456-test-upload.jpg', + language: null, + authority: null, + display: '123456-test-upload.jpg', + confidence: -1, + place: 0, + otherInformation: null + } + ] + }, + accessConditions: [ + { + id: 3675, + name: 'lease', + rpType: 'TYPE_CUSTOM', + groupUUID: '123456-g', + action: 'READ', + endDate: '2019-01-16', + type: 'resourcePolicy' + }, + { + id: 3676, + name: 'openaccess', + rpType: 'TYPE_CUSTOM', + groupUUID: '123456-g', + action: 'READ', + type: 'resourcePolicy' + } + ], + format: { + id: 16, + shortDescription: 'JPEG', + description: 'Joint Photographic Experts Group/JPEG File Interchange Format (JFIF)', + mimetype: 'image/jpeg', + supportLevel: 0, + internal: false, + extensions: null, + type: 'bitstreamformat' + }, + sizeBytes: 202999, + checkSum: { + checkSumAlgorithm: 'MD5', + value: '5e0996996863d2623439cbb53052bc72' + }, + url: 'https://test-ui.com/api/core/bitstreams/123456-test-upload/content' + } +]; +export var mockFileFormData = { + metadata: { + 'dc.title': [ + { + value: 'title', + language: null, + authority: null, + display: 'title', + confidence: -1, + place: 0, + otherInformation: null + } + ], + 'dc.description': [ + { + value: 'description', + language: null, + authority: null, + display: 'description', + confidence: -1, + place: 0, + otherInformation: null + } + ] + }, + accessConditions: [ + { + name: [ + { + value: 'openaccess', + language: null, + authority: null, + display: 'openaccess', + confidence: -1, + place: 0, + otherInformation: null + } + ], + groupUUID: [ + { + value: '123456-g', + language: null, + authority: null, + display: '123456-g', + confidence: -1, + place: 0, + otherInformation: null + } + ] + }, + { + name: [ + { + value: 'lease', + language: null, + authority: null, + display: 'lease', + confidence: -1, + place: 0, + otherInformation: null + } + ], + endDate: [ + { + value: { + year: 2019, + month: 1, + day: 16 + }, + language: null, + authority: null, + display: { + year: 2019, + month: 1, + day: 16 + }, + confidence: -1, + place: 0, + otherInformation: null + } + ], + groupUUID: [ + { + value: '123456-g', + language: null, + authority: null, + display: '123456-g', + confidence: -1, + place: 0, + otherInformation: null + } + ] + }, + { + name: [ + { + value: 'embargo', + language: null, + authority: null, + display: 'lease', + confidence: -1, + place: 0, + otherInformation: null + } + ], + startDate: [ + { + value: { + year: 2019, + month: 1, + day: 16 + }, + language: null, + authority: null, + display: { + year: 2019, + month: 1, + day: 16 + }, + confidence: -1, + place: 0, + otherInformation: null + } + ], + groupUUID: [ + { + value: '123456-g', + language: null, + authority: null, + display: '123456-g', + confidence: -1, + place: 0, + otherInformation: null + } + ] + } + ] +}; +//# sourceMappingURL=mock-submission.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-submission.js.map b/src/app/shared/mocks/mock-submission.js.map new file mode 100644 index 0000000000..a3783cc014 --- /dev/null +++ b/src/app/shared/mocks/mock-submission.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-submission.js","sourceRoot":"","sources":["mock-submission.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,EAAE,KAAK,EAAE,MAAM,uCAAuC,CAAC;AAE9D,MAAM,CAAC,IAAM,gBAAgB,GAAG;IAC9B,kBAAkB,EAAC;QACjB,UAAU,EAAE;YACV,IAAI,4BAA4B,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAE;SAC9D;KAAC;IACJ,OAAO,EAAE;QACP,GAAG,EAAE,IAAI;QACT,cAAc,EAAE,IAAI;QACpB,OAAO,EAAE,KAAK;KACf;IACD,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;KACV;CACF,CAAC;AAEF,MAAM,CAAC,IAAM,mBAAmB,GAAG;IACjC,kBAAkB,EAAC;QACjB,UAAU,EAAE;YACV,IAAI,4BAA4B,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAE;SAC9D;KAAC;IACJ,kBAAkB,EAAC;QACjB,aAAa,EA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U;oBACnB,UAAU,EAAE,CAAC,CAAC;oBACd,KAAK,EAAE,CAAC;oBACR,gBAAgB,EAAE,IAAI;iBACvB;aACF;SACF;KACF;CACF,CAAC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-translate-loader.js b/src/app/shared/mocks/mock-translate-loader.js new file mode 100644 index 0000000000..ca38a45bda --- /dev/null +++ b/src/app/shared/mocks/mock-translate-loader.js @@ -0,0 +1,11 @@ +import { of as observableOf } from 'rxjs'; +var MockTranslateLoader = /** @class */ (function () { + function MockTranslateLoader() { + } + MockTranslateLoader.prototype.getTranslation = function (lang) { + return observableOf({}); + }; + return MockTranslateLoader; +}()); +export { MockTranslateLoader }; +//# sourceMappingURL=mock-translate-loader.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-translate-loader.js.map b/src/app/shared/mocks/mock-translate-loader.js.map new file mode 100644 index 0000000000..6cb163d59e --- /dev/null +++ b/src/app/shared/mocks/mock-translate-loader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-translate-loader.js","sourceRoot":"","sources":["mock-translate-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,IAAI,YAAY,EAAe,MAAM,MAAM,CAAC;AAGtD;IAAA;IAIA,CAAC;IAHC,4CAAc,GAAd,UAAe,IAAY;QACzB,OAAO,YAAY,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IACH,0BAAC;AAAD,CAAC,AAJD,IAIC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-translate.service.js b/src/app/shared/mocks/mock-translate.service.js new file mode 100644 index 0000000000..80d1acd4d6 --- /dev/null +++ b/src/app/shared/mocks/mock-translate.service.js @@ -0,0 +1,7 @@ +export function getMockTranslateService() { + return jasmine.createSpyObj('translateService', { + get: jasmine.createSpy('get'), + instant: jasmine.createSpy('instant') + }); +} +//# sourceMappingURL=mock-translate.service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-translate.service.js.map b/src/app/shared/mocks/mock-translate.service.js.map new file mode 100644 index 0000000000..83694debf6 --- /dev/null +++ b/src/app/shared/mocks/mock-translate.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-translate.service.js","sourceRoot":"","sources":["mock-translate.service.ts"],"names":[],"mappings":"AAEA,MAAM;IACJ,OAAO,OAAO,CAAC,YAAY,CAAC,kBAAkB,EAAE;QAC9C,GAAG,EAAE,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC;QAC7B,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;KACtC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-uuid.service.js b/src/app/shared/mocks/mock-uuid.service.js new file mode 100644 index 0000000000..f2984381a4 --- /dev/null +++ b/src/app/shared/mocks/mock-uuid.service.js @@ -0,0 +1,8 @@ +export var defaultUUID = 'c4ce6905-290b-478f-979d-a333bbd7820f'; +export function getMockUUIDService(uuid) { + if (uuid === void 0) { uuid = defaultUUID; } + return jasmine.createSpyObj('uuidService', { + generate: uuid, + }); +} +//# sourceMappingURL=mock-uuid.service.js.map \ No newline at end of file diff --git a/src/app/shared/mocks/mock-uuid.service.js.map b/src/app/shared/mocks/mock-uuid.service.js.map new file mode 100644 index 0000000000..acbb411840 --- /dev/null +++ b/src/app/shared/mocks/mock-uuid.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-uuid.service.js","sourceRoot":"","sources":["mock-uuid.service.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,IAAM,WAAW,GAAG,sCAAsC,CAAC;AAElE,MAAM,6BAA6B,IAAkB;IAAlB,qBAAA,EAAA,kBAAkB;IACnD,OAAO,OAAO,CAAC,YAAY,CAAC,aAAa,EAAE;QACzC,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.js b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.js new file mode 100644 index 0000000000..180d192986 --- /dev/null +++ b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.js @@ -0,0 +1,38 @@ +import * as tslib_1 from "tslib"; +import { Component, EventEmitter, Input, Output } from '@angular/core'; +var ClaimedTaskActionsApproveComponent = /** @class */ (function () { + function ClaimedTaskActionsApproveComponent() { + /** + * An event fired when a approve action is confirmed. + */ + this.approve = new EventEmitter(); + } + /** + * Emit approve event + */ + ClaimedTaskActionsApproveComponent.prototype.confirmApprove = function () { + this.approve.emit(); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Boolean) + ], ClaimedTaskActionsApproveComponent.prototype, "processingApprove", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ClaimedTaskActionsApproveComponent.prototype, "wrapperClass", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ClaimedTaskActionsApproveComponent.prototype, "approve", void 0); + ClaimedTaskActionsApproveComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-claimed-task-actions-approve', + styleUrls: ['./claimed-task-actions-approve.component.scss'], + templateUrl: './claimed-task-actions-approve.component.html', + }) + ], ClaimedTaskActionsApproveComponent); + return ClaimedTaskActionsApproveComponent; +}()); +export { ClaimedTaskActionsApproveComponent }; +//# sourceMappingURL=claimed-task-actions-approve.component.js.map \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.js.map b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.js.map new file mode 100644 index 0000000000..c868706c96 --- /dev/null +++ b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"claimed-task-actions-approve.component.js","sourceRoot":"","sources":["claimed-task-actions-approve.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAQvE;IANA;QAkBE;;WAEG;QACO,YAAO,GAAsB,IAAI,YAAY,EAAO,CAAC;IAQjE,CAAC;IANC;;OAEG;IACH,2DAAc,GAAd;QACE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC;IAjBQ;QAAR,KAAK,EAAE;;iFAA4B;IAK3B;QAAR,KAAK,EAAE;;4EAAsB;IAKpB;QAAT,MAAM,EAAE;0CAAU,YAAY;uEAAgC;IAfpD,kCAAkC;QAN9C,SAAS,CAAC;YACT,QAAQ,EAAE,iCAAiC;YAC3C,SAAS,EAAE,CAAC,+CAA+C,CAAC;YAC5D,WAAW,EAAE,+CAA+C;SAC7D,CAAC;OAEW,kCAAkC,CAuB9C;IAAD,yCAAC;CAAA,AAvBD,IAuBC;SAvBY,kCAAkC"} \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.js b/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.js new file mode 100644 index 0000000000..dd88663e3d --- /dev/null +++ b/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.js @@ -0,0 +1,114 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector, Input } from '@angular/core'; +import { Router } from '@angular/router'; +import { BehaviorSubject } from 'rxjs'; +import { filter, map } from 'rxjs/operators'; +import { TranslateService } from '@ngx-translate/core'; +import { ClaimedTask } from '../../../core/tasks/models/claimed-task-object.model'; +import { isNotUndefined } from '../../empty.util'; +import { MyDSpaceActionsComponent } from '../mydspace-actions'; +import { ResourceType } from '../../../core/shared/resource-type'; +import { NotificationsService } from '../../notifications/notifications.service'; +/** + * This component represents mydspace actions related to ClaimedTask object. + */ +var ClaimedTaskActionsComponent = /** @class */ (function (_super) { + tslib_1.__extends(ClaimedTaskActionsComponent, _super); + /** + * Initialize instance variables + * + * @param {Injector} injector + * @param {Router} router + * @param {NotificationsService} notificationsService + * @param {TranslateService} translate + */ + function ClaimedTaskActionsComponent(injector, router, notificationsService, translate) { + var _this = _super.call(this, ResourceType.ClaimedTask, injector, router, notificationsService, translate) || this; + _this.injector = injector; + _this.router = router; + _this.notificationsService = notificationsService; + _this.translate = translate; + /** + * A boolean representing if an approve operation is pending + */ + _this.processingApprove$ = new BehaviorSubject(false); + /** + * A boolean representing if a reject operation is pending + */ + _this.processingReject$ = new BehaviorSubject(false); + /** + * A boolean representing if a return to pool operation is pending + */ + _this.processingReturnToPool$ = new BehaviorSubject(false); + return _this; + } + /** + * Initialize objects + */ + ClaimedTaskActionsComponent.prototype.ngOnInit = function () { + this.initObjects(this.object); + }; + /** + * Init the ClaimedTask and Workflowitem objects + * + * @param {PoolTask} object + */ + ClaimedTaskActionsComponent.prototype.initObjects = function (object) { + this.object = object; + this.workflowitem$ = this.object.workflowitem.pipe(filter(function (rd) { return ((!rd.isRequestPending) && isNotUndefined(rd.payload)); }), map(function (rd) { return rd.payload; })); + }; + /** + * Approve the task. + */ + ClaimedTaskActionsComponent.prototype.approve = function () { + var _this = this; + this.processingApprove$.next(true); + this.objectDataService.approveTask(this.object.id) + .subscribe(function (res) { + _this.processingApprove$.next(false); + _this.handleActionResponse(res.hasSucceeded); + }); + }; + /** + * Reject the task. + */ + ClaimedTaskActionsComponent.prototype.reject = function (reason) { + var _this = this; + this.processingReject$.next(true); + this.objectDataService.rejectTask(reason, this.object.id) + .subscribe(function (res) { + _this.processingReject$.next(false); + _this.handleActionResponse(res.hasSucceeded); + }); + }; + /** + * Return task to the pool. + */ + ClaimedTaskActionsComponent.prototype.returnToPool = function () { + var _this = this; + this.processingReturnToPool$.next(true); + this.objectDataService.returnToPoolTask(this.object.id) + .subscribe(function (res) { + _this.processingReturnToPool$.next(false); + _this.handleActionResponse(res.hasSucceeded); + }); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", ClaimedTask) + ], ClaimedTaskActionsComponent.prototype, "object", void 0); + ClaimedTaskActionsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-claimed-task-actions', + styleUrls: ['./claimed-task-actions.component.scss'], + templateUrl: './claimed-task-actions.component.html', + }), + tslib_1.__metadata("design:paramtypes", [Injector, + Router, + NotificationsService, + TranslateService]) + ], ClaimedTaskActionsComponent); + return ClaimedTaskActionsComponent; +}(MyDSpaceActionsComponent)); +export { ClaimedTaskActionsComponent }; +//# sourceMappingURL=claimed-task-actions.component.js.map \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.js.map b/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.js.map new file mode 100644 index 0000000000..33174cabf7 --- /dev/null +++ b/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"claimed-task-actions.component.js","sourceRoot":"","sources":["claimed-task-actions.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAc,MAAM,MAAM,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAEnF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF;;GAEG;AAMH;IAAiD,uDAA6D;IA2B5G;;;;;;;OAOG;IACH,qCAAsB,QAAkB,EAClB,MAAc,EACd,oBAA0C,EAC1C,SAA2B;QAHjD,YAIE,kBAAM,YAAY,CAAC,WAAW,EAAE,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ace-actions/claimed-task/reject/claimed-task-actions-reject.component.js b/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.js new file mode 100644 index 0000000000..8fbeb8ccd9 --- /dev/null +++ b/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.js @@ -0,0 +1,70 @@ +import * as tslib_1 from "tslib"; +import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { FormBuilder, Validators } from '@angular/forms'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +var ClaimedTaskActionsRejectComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {FormBuilder} formBuilder + * @param {NgbModal} modalService + */ + function ClaimedTaskActionsRejectComponent(formBuilder, modalService) { + this.formBuilder = formBuilder; + this.modalService = modalService; + /** + * An event fired when a reject action is confirmed. + * Event's payload equals to reject reason. + */ + this.reject = new EventEmitter(); + } + /** + * Initialize form + */ + ClaimedTaskActionsRejectComponent.prototype.ngOnInit = function () { + this.rejectForm = this.formBuilder.group({ + reason: ['', Validators.required] + }); + }; + /** + * Close modal and emit reject event + */ + ClaimedTaskActionsRejectComponent.prototype.confirmReject = function () { + this.processingReject = true; + this.modalRef.close('Send Button'); + var reason = this.rejectForm.get('reason').value; + this.reject.emit(reason); + }; + /** + * Open modal + * + * @param content + */ + ClaimedTaskActionsRejectComponent.prototype.openRejectModal = function (content) { + this.rejectForm.reset(); + this.modalRef = this.modalService.open(content); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Boolean) + ], ClaimedTaskActionsRejectComponent.prototype, "processingReject", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ClaimedTaskActionsRejectComponent.prototype, "wrapperClass", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ClaimedTaskActionsRejectComponent.prototype, "reject", void 0); + ClaimedTaskActionsRejectComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-claimed-task-actions-reject', + styleUrls: ['./claimed-task-actions-reject.component.scss'], + templateUrl: './claimed-task-actions-reject.component.html', + }), + tslib_1.__metadata("design:paramtypes", [FormBuilder, NgbModal]) + ], ClaimedTaskActionsRejectComponent); + return ClaimedTaskActionsRejectComponent; +}()); +export { ClaimedTaskActionsRejectComponent }; +//# sourceMappingURL=claimed-task-actions-reject.component.js.map \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.js.map b/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.js.map new file mode 100644 index 0000000000..b0a66f6a95 --- /dev/null +++ b/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"claimed-task-actions-reject.component.js","sourceRoot":"","sources":["claimed-task-actions-reject.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAa,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAe,MAAM,4BAA4B,CAAC;AAQnE;IA4BE;;;;;OAKG;IACH,2CAAoB,WAAwB,EAAU,YAAsB;QAAxD,gBAAW,GAAX,WAAW,CAAa;QAAU,iBAAY,GAAZ,YAAY,CAAU;QAtB5E;;;WAGG;QACO,WAAM,GAAyB,IAAI,YAAY,EAAU,CAAC;IAmBpE,CAAC;IAED;;OAEG;IACH,oDAAQ,GAAR;QACE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;YACvC,MAAM,EAAE,CAAC,EAAE,EAAE,UAAU,CAAC,QAAQ,CAAC;SAClC,CAAC,CAAC;IAEL,CAAC;IAED;;OAEG;IACH,yDAAa,GAAb;QACE,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACnC,IAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,2DAAe,GAAf,UAAgB,OAAY;QAC1B,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;IA5DQ;QAAR,KAAK,EAAE;;+EAA2B;IAK1B;QAAR,KAAK,EAAE;;2EAAsB;IAMpB;QAAT,MAAM,EAAE;0CAAS,YAAY;qEAAsC;IAhBzD,iCAAiC;QAN7C,SAAS,CAAC;YACT,QAAQ,EAAE,gCAAgC;YAC1C,SAAS,EAAE,CAAC,8CAA8C,CAAC;YAC3D,WAAW,EAAE,8CAA8C;SAC5D,CAAC;iDAoCiC,WAAW,EAAwB,QAAQ;OAlCjE,iCAAiC,CAkE7C;IAAD,wCAAC;CAAA,AAlED,IAkEC;SAlEY,iCAAiC"} \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.js b/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.js new file mode 100644 index 0000000000..a26828d97a --- /dev/null +++ b/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.js @@ -0,0 +1,38 @@ +import * as tslib_1 from "tslib"; +import { Component, EventEmitter, Input, Output } from '@angular/core'; +var ClaimedTaskActionsReturnToPoolComponent = /** @class */ (function () { + function ClaimedTaskActionsReturnToPoolComponent() { + /** + * An event fired when a return to pool action is confirmed. + */ + this.returnToPool = new EventEmitter(); + } + /** + * Emit returnToPool event + */ + ClaimedTaskActionsReturnToPoolComponent.prototype.confirmReturnToPool = function () { + this.returnToPool.emit(); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Boolean) + ], ClaimedTaskActionsReturnToPoolComponent.prototype, "processingReturnToPool", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ClaimedTaskActionsReturnToPoolComponent.prototype, "wrapperClass", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ClaimedTaskActionsReturnToPoolComponent.prototype, "returnToPool", void 0); + ClaimedTaskActionsReturnToPoolComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-claimed-task-actions-return-to-pool', + styleUrls: ['./claimed-task-actions-return-to-pool.component.scss'], + templateUrl: './claimed-task-actions-return-to-pool.component.html', + }) + ], ClaimedTaskActionsReturnToPoolComponent); + return ClaimedTaskActionsReturnToPoolComponent; +}()); +export { ClaimedTaskActionsReturnToPoolComponent }; +//# sourceMappingURL=claimed-task-actions-return-to-pool.component.js.map \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.js.map b/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.js.map new file mode 100644 index 0000000000..be6fbfdc1a --- /dev/null +++ b/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"claimed-task-actions-return-to-pool.component.js","sourceRoot":"","sources":["claimed-task-actions-return-to-pool.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAQvE;IANA;QAkBE;;WAEG;QACO,iBAAY,GAAsB,IAAI,YAAY,EAAO,CAAC;IAQtE,CAAC;IANC;;OAEG;IACH,qEAAmB,GAAnB;QACE,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;IAjBQ;QAAR,KAAK,EAAE;;2FAAiC;IAKhC;QAAR,KAAK,EAAE;;iFAAsB;IAKpB;QAAT,MAAM,EAAE;0CAAe,YAAY;iFAAgC;IAfzD,uCAAuC;QANnD,SAAS,CAAC;YACT,QAAQ,EAAE,wCAAwC;YAClD,SAAS,EAAE,CAAC,sDAAsD,CAAC;YACnE,WAAW,EAAE,sDAAsD;SACpE,CAAC;OAEW,uCAAuC,CAuBnD;IAAD,8CAAC;CAAA,AAvBD,IAuBC;SAvBY,uCAAuC"} \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/item/item-actions.component.js b/src/app/shared/mydspace-actions/item/item-actions.component.js new file mode 100644 index 0000000000..0ac9bacffd --- /dev/null +++ b/src/app/shared/mydspace-actions/item/item-actions.component.js @@ -0,0 +1,56 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector, Input } from '@angular/core'; +import { Router } from '@angular/router'; +import { TranslateService } from '@ngx-translate/core'; +import { MyDSpaceActionsComponent } from '../mydspace-actions'; +import { Item } from '../../../core/shared/item.model'; +import { ResourceType } from '../../../core/shared/resource-type'; +import { NotificationsService } from '../../notifications/notifications.service'; +/** + * This component represents mydspace actions related to Item object. + */ +var ItemActionsComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemActionsComponent, _super); + /** + * Initialize instance variables + * + * @param {Injector} injector + * @param {Router} router + * @param {NotificationsService} notificationsService + * @param {TranslateService} translate + */ + function ItemActionsComponent(injector, router, notificationsService, translate) { + var _this = _super.call(this, ResourceType.Item, injector, router, notificationsService, translate) || this; + _this.injector = injector; + _this.router = router; + _this.notificationsService = notificationsService; + _this.translate = translate; + return _this; + } + /** + * Init the target object + * + * @param {Item} object + */ + ItemActionsComponent.prototype.initObjects = function (object) { + this.object = object; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], ItemActionsComponent.prototype, "object", void 0); + ItemActionsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-actions', + styleUrls: ['./item-actions.component.scss'], + templateUrl: './item-actions.component.html', + }), + tslib_1.__metadata("design:paramtypes", [Injector, + Router, + NotificationsService, + TranslateService]) + ], ItemActionsComponent); + return ItemActionsComponent; +}(MyDSpaceActionsComponent)); +export { ItemActionsComponent }; +//# sourceMappingURL=item-actions.component.js.map \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/item/item-actions.component.js.map b/src/app/shared/mydspace-actions/item/item-actions.component.js.map new file mode 100644 index 0000000000..6c8b2fdccc --- /dev/null +++ b/src/app/shared/mydspace-actions/item/item-actions.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-actions.component.js","sourceRoot":"","sources":["item-actions.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF;;GAEG;AAOH;IAA0C,gDAA+C;IAOvF;;;;;;;OAOG;IACH,8BAAsB,QAAkB,EAClB,MAAc,EACd,oBAA0C,EAC1C,SAA2B;QAHjD,YAIE,kBAAM,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,oBAAoB,EAAE,SAAS,CAAC,SAC5E;QALqB,cAAQ,GAAR,QAAQ,CAAU;QAClB,YAAM,GAAN,MAAM,CAAQ;QACd,0BAAoB,GAApB,oBAAoB,CAAsB;QAC1C,eAAS,GAAT,SAAS,CAAkB;;IAEjD,CAAC;IAED;;;;OAIG;IACH,0CAAW,GAAX,UAAY,MAAY;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAxBQ;QAAR,KAAK,EAAE;0CAAS,IAAI;wDAAC;IALX,oBAAoB;QANhC,SAAS,CAAC;YACT,QAAQ,EAAE,iBAAiB;YAC3B,SAAS,EAAE,CAAC,+BAA+B,CAAC;YAC5C,WAAW,EAAE,+BAA+B;SAC7C,CAAC;iDAiBgC,QAAQ;YACV,MAAM;YACQ,oBAAoB;YAC/B,gBAAgB;OAlBtC,oBAAoB,CA+BhC;IAAD,2BAAC;CAAA,AA/BD,CAA0C,wBAAwB,GA+BjE;SA/BY,oBAAoB"} \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/mydspace-actions-service.factory.js b/src/app/shared/mydspace-actions/mydspace-actions-service.factory.js new file mode 100644 index 0000000000..26f9cb397e --- /dev/null +++ b/src/app/shared/mydspace-actions/mydspace-actions-service.factory.js @@ -0,0 +1,38 @@ +import { ResourceType } from '../../core/shared/resource-type'; +import { WorkspaceitemDataService } from '../../core/submission/workspaceitem-data.service'; +import { ClaimedTaskDataService } from '../../core/tasks/claimed-task-data.service'; +import { PoolTaskDataService } from '../../core/tasks/pool-task-data.service'; +import { WorkflowitemDataService } from '../../core/submission/workflowitem-data.service'; +import { ItemDataService } from '../../core/data/item-data.service'; +/** + * Class to return DataService for given ResourceType + */ +var MydspaceActionsServiceFactory = /** @class */ (function () { + function MydspaceActionsServiceFactory() { + } + MydspaceActionsServiceFactory.prototype.getConstructor = function (type) { + switch (type) { + case ResourceType.Item: { + return ItemDataService; + } + case ResourceType.Workspaceitem: { + return WorkspaceitemDataService; + } + case ResourceType.Workflowitem: { + return WorkflowitemDataService; + } + case ResourceType.ClaimedTask: { + return ClaimedTaskDataService; + } + case ResourceType.PoolTask: { + return PoolTaskDataService; + } + default: { + return undefined; + } + } + }; + return MydspaceActionsServiceFactory; +}()); +export { MydspaceActionsServiceFactory }; +//# sourceMappingURL=mydspace-actions-service.factory.js.map \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/mydspace-actions-service.factory.js.map b/src/app/shared/mydspace-actions/mydspace-actions-service.factory.js.map new file mode 100644 index 0000000000..0c008acbe0 --- /dev/null +++ b/src/app/shared/mydspace-actions/mydspace-actions-service.factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mydspace-actions-service.factory.js","sourceRoot":"","sources":["mydspace-actions-service.factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kDAAkD,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAE1F,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE;;GAEG;AACH;IAAA;IAuBA,CAAC;IAtBQ,sDAAc,GAArB,UAAsB,IAAkB;QACtC,QAAQ,IAAI,EAAE;YACZ,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;gBACtB,OAAO,eAAsB,CAAC;aAC/B;YACD,KAAK,YAAY,CAAC,aAAa,CAAC,CAAC;gBAC/B,OAAO,wBAA+B,CAAC;aACxC;YACD,KAAK,YAAY,CAAC,YAAY,CAAC,CAAC;gBAC9B,OAAO,uBAA8B,CAAC;aACvC;YACD,KAAK,YAAY,CAAC,WAAW,CAAC,CAAC;gBAC7B,OAAO,sBAA6B,CAAC;aACtC;YACD,KAAK,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAC1B,OAAO,mBAA0B,CAAC;aACnC;YACD,OAAO,CAAC,CAAC;gBACP,OAAO,SAAS,CAAC;aAClB;SACF;IACH,CAAC;IACH,oCAAC;AAAD,CAAC,AAvBD,IAuBC"} \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/mydspace-actions.js b/src/app/shared/mydspace-actions/mydspace-actions.js new file mode 100644 index 0000000000..8b8281a6be --- /dev/null +++ b/src/app/shared/mydspace-actions/mydspace-actions.js @@ -0,0 +1,73 @@ +import * as tslib_1 from "tslib"; +import { Input } from '@angular/core'; +import { find } from 'rxjs/operators'; +import { MydspaceActionsServiceFactory } from './mydspace-actions-service.factory'; +import { NotificationOptions } from '../notifications/models/notification-options.model'; +/** + * Abstract class for all different representations of mydspace actions + */ +var MyDSpaceActionsComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {ResourceType} objectType + * @param {Injector} injector + * @param {Router} router + * @param {NotificationsService} notificationsService + * @param {TranslateService} translate + */ + function MyDSpaceActionsComponent(objectType, injector, router, notificationsService, translate) { + this.objectType = objectType; + this.injector = injector; + this.router = router; + this.notificationsService = notificationsService; + this.translate = translate; + var factory = new MydspaceActionsServiceFactory(); + this.objectDataService = injector.get(factory.getConstructor(objectType)); + } + /** + * Refresh current page + */ + MyDSpaceActionsComponent.prototype.reload = function () { + // override the route reuse strategy + this.router.routeReuseStrategy.shouldReuseRoute = function () { + return false; + }; + this.router.navigated = false; + var url = decodeURIComponent(this.router.url); + this.router.navigateByUrl(url); + }; + /** + * Override the target object with a refreshed one + */ + MyDSpaceActionsComponent.prototype.refresh = function () { + var _this = this; + // find object by id + this.objectDataService.findById(this.object.id).pipe(find(function (rd) { return rd.hasSucceeded; })).subscribe(function (rd) { + _this.initObjects(rd.payload); + }); + }; + /** + * Handle action response and show properly notification + * + * @param result + * true on success, false otherwise + */ + MyDSpaceActionsComponent.prototype.handleActionResponse = function (result) { + if (result) { + this.reload(); + this.notificationsService.success(null, this.translate.get('submission.workflow.tasks.generic.success'), new NotificationOptions(5000, false)); + } + else { + this.notificationsService.error(null, this.translate.get('submission.workflow.tasks.generic.error'), new NotificationOptions(20000, true)); + } + }; + var _a; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", typeof (_a = typeof T !== "undefined" && T) === "function" && _a || Object) + ], MyDSpaceActionsComponent.prototype, "object", void 0); + return MyDSpaceActionsComponent; +}()); +export { MyDSpaceActionsComponent }; +//# sourceMappingURL=mydspace-actions.js.map \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/mydspace-actions.js.map b/src/app/shared/mydspace-actions/mydspace-actions.js.map new file mode 100644 index 0000000000..9b7db1d138 --- /dev/null +++ b/src/app/shared/mydspace-actions/mydspace-actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mydspace-actions.js","sourceRoot":"","sources":["mydspace-actions.ts"],"names":[],"mappings":";AACA,OAAO,EAAY,KAAK,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAKnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAIzF;;GAEG;AACH;IAYE;;;;;;;;OAQG;IACH,kCACY,UAAwB,EACxB,QAAkB,EAClB,MAAc,EACd,oBAA0C,EAC1C,SAA2B;QAJ3B,eAAU,GAAV,UAAU,CAAc;QACxB,aAAQ,GAAR,QAAQ,CAAU;QAClB,WAAM,GAAN,MAAM,CAAQ;QACd,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,cAAS,GAAT,SAAS,CAAkB;QACrC,IAAM,OAAO,GAAG,IAAI,6BAA6B,EAAe,CAAC;QACjE,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5E,CAAC;IASD;;OAEG;IACH,yCAAM,GAAN;QACE,oCAAoC;QACpC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,GAAG;YAChD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC;QAC9B,IAAM,GAAG,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,0CAAO,GAAP;QAAA,iBAOC;QANC,oBAAoB;QACpB,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAClD,IAAI,CAAC,UAAC,EAAiB,IAAK,OAAA,EAAE,CAAC,YAAY,EAAf,CAAe,CAAC,CAC7C,CAAC,SAAS,CAAC,UAAC,EAAiB;YAC5B,KAAI,CAAC,WAAW,CAAC,EAAE,CAAC,OAAY,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,uDAAoB,GAApB,UAAqB,MAAe;QAClC,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,IAAI,EACpC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,2CAA2C,CAAC,EAC/D,IAAI,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;SACzC;aAAM;YACL,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAClC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,yCAAyC,CAAC,EAC7D,IAAI,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;SACzC;IACH,CAAC;;IA3EQ;QAAR,KAAK,EAAE;8DAAkB,CAAC,oBAAD,CAAC;4DAAC;IA4E9B,+BAAC;CAAA,AAjFD,IAiFC;SAjFqB,wBAAwB"} \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.js b/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.js new file mode 100644 index 0000000000..db55bcf2f2 --- /dev/null +++ b/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.js @@ -0,0 +1,83 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector, Input } from '@angular/core'; +import { Router } from '@angular/router'; +import { BehaviorSubject } from 'rxjs'; +import { filter, map } from 'rxjs/operators'; +import { TranslateService } from '@ngx-translate/core'; +import { PoolTask } from '../../../core/tasks/models/pool-task-object.model'; +import { isNotUndefined } from '../../empty.util'; +import { MyDSpaceActionsComponent } from '../mydspace-actions'; +import { ResourceType } from '../../../core/shared/resource-type'; +import { NotificationsService } from '../../notifications/notifications.service'; +/** + * This component represents mydspace actions related to PoolTask object. + */ +var PoolTaskActionsComponent = /** @class */ (function (_super) { + tslib_1.__extends(PoolTaskActionsComponent, _super); + /** + * Initialize instance variables + * + * @param {Injector} injector + * @param {Router} router + * @param {NotificationsService} notificationsService + * @param {TranslateService} translate + */ + function PoolTaskActionsComponent(injector, router, notificationsService, translate) { + var _this = _super.call(this, ResourceType.PoolTask, injector, router, notificationsService, translate) || this; + _this.injector = injector; + _this.router = router; + _this.notificationsService = notificationsService; + _this.translate = translate; + /** + * A boolean representing if a claim operation is pending + * @type {BehaviorSubject} + */ + _this.processingClaim$ = new BehaviorSubject(false); + return _this; + } + /** + * Initialize objects + */ + PoolTaskActionsComponent.prototype.ngOnInit = function () { + this.initObjects(this.object); + }; + /** + * Init the PoolTask and Workflowitem objects + * + * @param {PoolTask} object + */ + PoolTaskActionsComponent.prototype.initObjects = function (object) { + this.object = object; + this.workflowitem$ = this.object.workflowitem.pipe(filter(function (rd) { return ((!rd.isRequestPending) && isNotUndefined(rd.payload)); }), map(function (rd) { return rd.payload; })); + }; + /** + * Claim the task. + */ + PoolTaskActionsComponent.prototype.claim = function () { + var _this = this; + this.processingClaim$.next(true); + this.objectDataService.claimTask(this.object.id) + .subscribe(function (res) { + _this.handleActionResponse(res.hasSucceeded); + _this.processingClaim$.next(false); + }); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", PoolTask) + ], PoolTaskActionsComponent.prototype, "object", void 0); + PoolTaskActionsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-pool-task-actions', + styleUrls: ['./pool-task-actions.component.scss'], + templateUrl: './pool-task-actions.component.html', + }), + tslib_1.__metadata("design:paramtypes", [Injector, + Router, + NotificationsService, + TranslateService]) + ], PoolTaskActionsComponent); + return PoolTaskActionsComponent; +}(MyDSpaceActionsComponent)); +export { PoolTaskActionsComponent }; +//# sourceMappingURL=pool-task-actions.component.js.map \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.js.map b/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.js.map new file mode 100644 index 0000000000..f3848f9911 --- /dev/null +++ b/src/app/shared/mydspace-actions/pool-task/pool-task-actions.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pool-task-actions.component.js","sourceRoot":"","sources":["pool-task-actions.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAc,MAAM,MAAM,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAKvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mDAAmD,CAAC;AAE7E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF;;GAEG;AAMH;IAA8C,oDAAuD;IAkBnG;;;;;;;OAOG;IACH,kCAAsB,QAAkB,EAClB,MAAc,EACd,oBAA0C,EAC1C,SAA2B;QAHjD,YAIE,kBAAM,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAA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CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,SAAS,EAAE,CAAC,oCAAoC,CAAC;YACjD,WAAW,EAAE,oCAAoC;SAClD,CAAC;iDA2BgC,QAAQ;YACV,MAAM;YACQ,oBAAoB;YAC/B,gBAAgB;OA7BtC,wBAAwB,CA+DpC;IAAD,+BAAC;CAAA,AA/DD,CAA8C,wBAAwB,GA+DrE;SA/DY,wBAAwB"} \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.js b/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.js new file mode 100644 index 0000000000..1d308c75f5 --- /dev/null +++ b/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.js @@ -0,0 +1,56 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector, Input } from '@angular/core'; +import { Router } from '@angular/router'; +import { TranslateService } from '@ngx-translate/core'; +import { MyDSpaceActionsComponent } from '../mydspace-actions'; +import { Workflowitem } from '../../../core/submission/models/workflowitem.model'; +import { ResourceType } from '../../../core/shared/resource-type'; +import { NotificationsService } from '../../notifications/notifications.service'; +/** + * This component represents mydspace actions related to Workflowitem object. + */ +var WorkflowitemActionsComponent = /** @class */ (function (_super) { + tslib_1.__extends(WorkflowitemActionsComponent, _super); + /** + * Initialize instance variables + * + * @param {Injector} injector + * @param {Router} router + * @param {NotificationsService} notificationsService + * @param {TranslateService} translate + */ + function WorkflowitemActionsComponent(injector, router, notificationsService, translate) { + var _this = _super.call(this, ResourceType.Workflowitem, injector, router, notificationsService, translate) || this; + _this.injector = injector; + _this.router = router; + _this.notificationsService = notificationsService; + _this.translate = translate; + return _this; + } + /** + * Init the target object + * + * @param {Workflowitem} object + */ + WorkflowitemActionsComponent.prototype.initObjects = function (object) { + this.object = object; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Workflowitem) + ], WorkflowitemActionsComponent.prototype, "object", void 0); + WorkflowitemActionsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-workflowitem-actions', + styleUrls: ['./workflowitem-actions.component.scss'], + templateUrl: './workflowitem-actions.component.html', + }), + tslib_1.__metadata("design:paramtypes", [Injector, + Router, + NotificationsService, + TranslateService]) + ], WorkflowitemActionsComponent); + return WorkflowitemActionsComponent; +}(MyDSpaceActionsComponent)); +export { WorkflowitemActionsComponent }; +//# sourceMappingURL=workflowitem-actions.component.js.map \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.js.map b/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.js.map new file mode 100644 index 0000000000..82d0414dbd --- /dev/null +++ b/src/app/shared/mydspace-actions/workflowitem/workflowitem-actions.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workflowitem-actions.component.js","sourceRoot":"","sources":["workflowitem-actions.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF;;GAEG;AAMH;IAAkD,wDAA+D;IAO/G;;;;;;;OAOG;IACH,sCAAsB,QAAkB,EAClB,MAAc,EACd,oBAA0C,EAC1C,SAA2B;QAHjD,YAIE,kBAAM,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,oBAAoB,EAAE,SAAS,CAAC,SACpF;QALqB,cAAQ,GAAR,QAAQ,CAAU;QAClB,YAAM,GAAN,MAAM,CAAQ;QACd,0BAAoB,GAApB,oBAAoB,CAAsB;QAC1C,eAAS,GAAT,SAAS,CAAkB;;IAEjD,CAAC;IAED;;;;OAIG;IACH,kDAAW,GAAX,UAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAxBQ;QAAR,KAAK,EAAE;0CAAS,YAAY;gEAAC;IALnB,4BAA4B;QALxC,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,SAAS,EAAE,CAAC,uCAAuC,CAAC;YACpD,WAAW,EAAE,uCAAuC;SACrD,CAAC;iDAgBgC,QAAQ;YACV,MAAM;YACQ,oBAAoB;YAC/B,gBAAgB;OAlBtC,4BAA4B,CA+BxC;IAAD,mCAAC;CAAA,AA/BD,CAAkD,wBAAwB,GA+BzE;SA/BY,4BAA4B"} \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.js b/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.js new file mode 100644 index 0000000000..fc43df2a49 --- /dev/null +++ b/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.js @@ -0,0 +1,82 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector, Input } from '@angular/core'; +import { Router } from '@angular/router'; +import { BehaviorSubject } from 'rxjs'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { TranslateService } from '@ngx-translate/core'; +import { Workspaceitem } from '../../../core/submission/models/workspaceitem.model'; +import { MyDSpaceActionsComponent } from '../mydspace-actions'; +import { ResourceType } from '../../../core/shared/resource-type'; +import { NotificationsService } from '../../notifications/notifications.service'; +/** + * This component represents mydspace actions related to Workspaceitem object. + */ +var WorkspaceitemActionsComponent = /** @class */ (function (_super) { + tslib_1.__extends(WorkspaceitemActionsComponent, _super); + /** + * Initialize instance variables + * + * @param {Injector} injector + * @param {Router} router + * @param {NgbModal} modalService + * @param {NotificationsService} notificationsService + * @param {TranslateService} translate + */ + function WorkspaceitemActionsComponent(injector, router, modalService, notificationsService, translate) { + var _this = _super.call(this, ResourceType.Workspaceitem, injector, router, notificationsService, translate) || this; + _this.injector = injector; + _this.router = router; + _this.modalService = modalService; + _this.notificationsService = notificationsService; + _this.translate = translate; + /** + * A boolean representing if a delete operation is pending + * @type {BehaviorSubject} + */ + _this.processingDelete$ = new BehaviorSubject(false); + return _this; + } + /** + * Delete the target workspaceitem object + */ + WorkspaceitemActionsComponent.prototype.confirmDiscard = function (content) { + var _this = this; + this.modalService.open(content).result.then(function (result) { + if (result === 'ok') { + _this.processingDelete$.next(true); + _this.objectDataService.delete(_this.object) + .subscribe(function (response) { + _this.processingDelete$.next(false); + _this.handleActionResponse(response); + }); + } + }); + }; + /** + * Init the target object + * + * @param {Workspaceitem} object + */ + WorkspaceitemActionsComponent.prototype.initObjects = function (object) { + this.object = object; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Workspaceitem) + ], WorkspaceitemActionsComponent.prototype, "object", void 0); + WorkspaceitemActionsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-workspaceitem-actions', + styleUrls: ['./workspaceitem-actions.component.scss'], + templateUrl: './workspaceitem-actions.component.html', + }), + tslib_1.__metadata("design:paramtypes", [Injector, + Router, + NgbModal, + NotificationsService, + TranslateService]) + ], WorkspaceitemActionsComponent); + return WorkspaceitemActionsComponent; +}(MyDSpaceActionsComponent)); +export { WorkspaceitemActionsComponent }; +//# sourceMappingURL=workspaceitem-actions.component.js.map \ No newline at end of file diff --git a/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.js.map b/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.js.map new file mode 100644 index 0000000000..3478436e5c --- /dev/null +++ b/src/app/shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitem-actions.component.js","sourceRoot":"","sources":["workspaceitem-actions.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAA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AAS,CAAC,UAAC,QAAiB;oBAC3B,KAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBACnC,KAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;gBACtC,CAAC,CAAC,CAAA;aACL;QACH,CAAC,CACF,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,mDAAW,GAAX,UAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAlDQ;QAAR,KAAK,EAAE;0CAAS,aAAa;iEAAC;IALpB,6BAA6B;QALzC,SAAS,CAAC;YACT,QAAQ,EAAE,0BAA0B;YACpC,SAAS,EAAE,CAAC,wCAAwC,CAAC;YACrD,WAAW,EAAE,wCAAwC;SACtD,CAAC;iDAuBgC,QAAQ;YACV,MAAM;YACA,QAAQ;YACA,oBAAoB;YAC/B,gBAAgB;OA1BtC,6BAA6B,CAyDzC;IAAD,oCAAC;CAAA,AAzDD,CAAmD,wBAAwB,GAyD1E;SAzDY,6BAA6B"} \ No newline at end of file diff --git a/src/app/shared/ngrx/dspace-router-state-serializer.js b/src/app/shared/ngrx/dspace-router-state-serializer.js new file mode 100644 index 0000000000..19c0b58168 --- /dev/null +++ b/src/app/shared/ngrx/dspace-router-state-serializer.js @@ -0,0 +1,14 @@ +var DSpaceRouterStateSerializer = /** @class */ (function () { + function DSpaceRouterStateSerializer() { + } + DSpaceRouterStateSerializer.prototype.serialize = function (routerState) { + var url = routerState.url; + var queryParams = routerState.root.queryParams; + // Only return an object including the URL and query params + // instead of the entire snapshot + return { url: url, queryParams: queryParams }; + }; + return DSpaceRouterStateSerializer; +}()); +export { DSpaceRouterStateSerializer }; +//# sourceMappingURL=dspace-router-state-serializer.js.map \ No newline at end of file diff --git a/src/app/shared/ngrx/dspace-router-state-serializer.js.map b/src/app/shared/ngrx/dspace-router-state-serializer.js.map new file mode 100644 index 0000000000..72e5331393 --- /dev/null +++ b/src/app/shared/ngrx/dspace-router-state-serializer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-router-state-serializer.js","sourceRoot":"","sources":["dspace-router-state-serializer.ts"],"names":[],"mappings":"AAQA;IAAA;IASA,CAAC;IARC,+CAAS,GAAT,UAAU,WAAgC;QAChC,IAAA,qBAAG,CAAiB;QAC5B,IAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;QAEjD,2DAA2D;QAC3D,iCAAiC;QACjC,OAAO,EAAE,GAAG,KAAA,EAAE,WAAW,aAAA,EAAE,CAAC;IAC9B,CAAC;IACH,kCAAC;AAAD,CAAC,AATD,IASC"} \ No newline at end of file diff --git a/src/app/shared/ngrx/type.js b/src/app/shared/ngrx/type.js new file mode 100644 index 0000000000..1fbd0c68e0 --- /dev/null +++ b/src/app/shared/ngrx/type.js @@ -0,0 +1,24 @@ +/** + * Based on + * https://github.com/ngrx/example-app/blob/master/src/app/util.ts + * + * This function coerces a string into a string literal type. + * Using tagged union types in TypeScript 2.0, this enables + * powerful typechecking of our reducers. + * + * Since every action label passes through this function it + * is a good place to ensure all of our action labels + * are unique. + */ +var typeCache = {}; +export function types() { + return Object.keys(typeCache); +} +export function type(label) { + if (typeCache[label]) { + throw new Error("Action type \"" + label + "\" is not unique\""); + } + typeCache[label] = true; + return label; +} +//# sourceMappingURL=type.js.map \ No newline at end of file diff --git a/src/app/shared/ngrx/type.js.map b/src/app/shared/ngrx/type.js.map new file mode 100644 index 0000000000..8bd7b5ef4d --- /dev/null +++ b/src/app/shared/ngrx/type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"type.js","sourceRoot":"","sources":["type.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;GAWG;AAEH,IAAM,SAAS,GAAiC,EAAE,CAAC;AAEnD,MAAM;IACJ,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,eAAkB,KAAa;IACnC,IAAI,SAAS,CAAC,KAAe,CAAC,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,mBAAgB,KAAK,uBAAkB,CAAC,CAAC;KAC1D;IAED,SAAS,CAAC,KAAe,CAAC,GAAG,IAAI,CAAC;IAElC,OAAO,KAAU,CAAC;AACpB,CAAC"} \ No newline at end of file diff --git a/src/app/shared/notifications/models/notification-animations-type.js b/src/app/shared/notifications/models/notification-animations-type.js new file mode 100644 index 0000000000..441b741010 --- /dev/null +++ b/src/app/shared/notifications/models/notification-animations-type.js @@ -0,0 +1,17 @@ +// 'fade' | 'fromTop' | 'fromRight' | 'fromBottom' | 'fromLeft' | 'rotate' | 'scale' +export var NotificationAnimationsType; +(function (NotificationAnimationsType) { + NotificationAnimationsType["Fade"] = "fade"; + NotificationAnimationsType["FromTop"] = "fromTop"; + NotificationAnimationsType["FromRight"] = "fromRight"; + NotificationAnimationsType["FromBottom"] = "fromBottom"; + NotificationAnimationsType["FromLeft"] = "fromLeft"; + NotificationAnimationsType["Rotate"] = "rotate"; + NotificationAnimationsType["Scale"] = "scale"; +})(NotificationAnimationsType || (NotificationAnimationsType = {})); +export var NotificationAnimationsStatus; +(function (NotificationAnimationsStatus) { + NotificationAnimationsStatus["In"] = "In"; + NotificationAnimationsStatus["Out"] = "Out"; +})(NotificationAnimationsStatus || (NotificationAnimationsStatus = {})); +//# sourceMappingURL=notification-animations-type.js.map \ No newline at end of file diff --git a/src/app/shared/notifications/models/notification-animations-type.js.map b/src/app/shared/notifications/models/notification-animations-type.js.map new file mode 100644 index 0000000000..35631a0469 --- /dev/null +++ b/src/app/shared/notifications/models/notification-animations-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"notification-animations-type.js","sourceRoot":"","sources":["notification-animations-type.ts"],"names":[],"mappings":"AAAA,oFAAoF;AAEpF,MAAM,CAAN,IAAY,0BAQX;AARD,WAAY,0BAA0B;IACpC,2CAAa,CAAA;IACb,iDAAmB,CAAA;IACnB,qDAAuB,CAAA;IACvB,uDAAyB,CAAA;IACzB,mDAAqB,CAAA;IACrB,+CAAiB,CAAA;IACjB,6CAAe,CAAA;AACjB,CAAC,EARW,0BAA0B,KAA1B,0BAA0B,QAQrC;AAED,MAAM,CAAN,IAAY,4BAGX;AAHD,WAAY,4BAA4B;IACtC,yCAAS,CAAA;IACT,2CAAW,CAAA;AACb,CAAC,EAHW,4BAA4B,KAA5B,4BAA4B,QAGvC"} \ No newline at end of file diff --git a/src/app/shared/notifications/models/notification-options.model.js b/src/app/shared/notifications/models/notification-options.model.js new file mode 100644 index 0000000000..b64a9d8e4e --- /dev/null +++ b/src/app/shared/notifications/models/notification-options.model.js @@ -0,0 +1,14 @@ +import { NotificationAnimationsType } from './notification-animations-type'; +var NotificationOptions = /** @class */ (function () { + function NotificationOptions(timeOut, clickToClose, animate) { + if (timeOut === void 0) { timeOut = 5000; } + if (clickToClose === void 0) { clickToClose = true; } + if (animate === void 0) { animate = NotificationAnimationsType.Scale; } + this.timeOut = timeOut; + this.clickToClose = clickToClose; + this.animate = animate; + } + return NotificationOptions; +}()); +export { NotificationOptions }; +//# sourceMappingURL=notification-options.model.js.map \ No newline at end of file diff --git a/src/app/shared/notifications/models/notification-options.model.js.map b/src/app/shared/notifications/models/notification-options.model.js.map new file mode 100644 index 0000000000..af73d27da7 --- /dev/null +++ b/src/app/shared/notifications/models/notification-options.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"notification-options.model.js","sourceRoot":"","sources":["notification-options.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAQ5E;IAKE,6BAAY,OAAc,EACd,YAAmB,EACnB,OAA0C;QAF1C,wBAAA,EAAA,cAAc;QACd,6BAAA,EAAA,mBAAmB;QACnB,wBAAA,EAAA,UAAU,0BAA0B,CAAC,KAAK;QAEpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IACH,0BAAC;AAAD,CAAC,AAbD,IAaC"} \ No newline at end of file diff --git a/src/app/shared/notifications/models/notification-type.js b/src/app/shared/notifications/models/notification-type.js new file mode 100644 index 0000000000..b97c16199b --- /dev/null +++ b/src/app/shared/notifications/models/notification-type.js @@ -0,0 +1,8 @@ +export var NotificationType; +(function (NotificationType) { + NotificationType["Success"] = "alert-success"; + NotificationType["Error"] = "alert-danger"; + NotificationType["Info"] = "alert-info"; + NotificationType["Warning"] = "alert-warning"; +})(NotificationType || (NotificationType = {})); +//# sourceMappingURL=notification-type.js.map \ No newline at end of file diff --git a/src/app/shared/notifications/models/notification-type.js.map b/src/app/shared/notifications/models/notification-type.js.map new file mode 100644 index 0000000000..eb7d5cadba --- /dev/null +++ b/src/app/shared/notifications/models/notification-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"notification-type.js","sourceRoot":"","sources":["notification-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,6CAAyB,CAAA;IACzB,0CAAsB,CAAA;IACtB,uCAAmB,CAAA;IACnB,6CAAyB,CAAA;AAC3B,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B"} \ No newline at end of file diff --git a/src/app/shared/notifications/models/notification.model.js b/src/app/shared/notifications/models/notification.model.js new file mode 100644 index 0000000000..635828ac28 --- /dev/null +++ b/src/app/shared/notifications/models/notification.model.js @@ -0,0 +1,15 @@ +import { NotificationOptions } from './notification-options.model'; +import { isEmpty } from '../../empty.util'; +var Notification = /** @class */ (function () { + function Notification(id, type, title, content, options, html) { + this.id = id; + this.type = type; + this.title = title; + this.content = content; + this.options = isEmpty(options) ? new NotificationOptions() : options; + this.html = html; + } + return Notification; +}()); +export { Notification }; +//# sourceMappingURL=notification.model.js.map \ No newline at end of file diff --git a/src/app/shared/notifications/models/notification.model.js.map b/src/app/shared/notifications/models/notification.model.js.map new file mode 100644 index 0000000000..9efeb0a29a --- /dev/null +++ b/src/app/shared/notifications/models/notification.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"notification.model.js","sourceRoot":"","sources":["notification.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEzF,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAY3C;IAQE,sBAAY,EAAU,EACV,IAAsB,EACtB,KAAmC,EACnC,OAAqC,EACrC,OAA6B,EAC7B,IAAc;QAExB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QACtE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEH,mBAAC;AAAD,CAAC,AAvBD,IAuBC"} \ No newline at end of file diff --git a/src/app/shared/notifications/notification/notification.component.js b/src/app/shared/notifications/notification/notification.component.js new file mode 100644 index 0000000000..9193c9e8e5 --- /dev/null +++ b/src/app/shared/notifications/notification/notification.component.js @@ -0,0 +1,140 @@ +import * as tslib_1 from "tslib"; +import { of as observableOf, Observable } from 'rxjs'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, NgZone, TemplateRef, ViewEncapsulation } from '@angular/core'; +import { trigger } from '@angular/animations'; +import { DomSanitizer } from '@angular/platform-browser'; +import { NotificationsService } from '../notifications.service'; +import { scaleEnter, scaleInState, scaleLeave, scaleOutState } from '../../animations/scale'; +import { rotateEnter, rotateInState, rotateLeave, rotateOutState } from '../../animations/rotate'; +import { fromBottomEnter, fromBottomInState, fromBottomLeave, fromBottomOutState } from '../../animations/fromBottom'; +import { fromRightEnter, fromRightInState, fromRightLeave, fromRightOutState } from '../../animations/fromRight'; +import { fromLeftEnter, fromLeftInState, fromLeftLeave, fromLeftOutState } from '../../animations/fromLeft'; +import { fromTopEnter, fromTopInState, fromTopLeave, fromTopOutState } from '../../animations/fromTop'; +import { fadeInEnter, fadeInState, fadeOutLeave, fadeOutState } from '../../animations/fade'; +import { NotificationAnimationsStatus } from '../models/notification-animations-type'; +import { isNotEmpty } from '../../empty.util'; +var NotificationComponent = /** @class */ (function () { + function NotificationComponent(notificationService, domSanitizer, cdr, zone) { + var _this = this; + this.notificationService = notificationService; + this.domSanitizer = domSanitizer; + this.cdr = cdr; + this.zone = zone; + this.notification = null; + this.showProgressBar = false; + this.titleIsTemplate = false; + this.contentIsTemplate = false; + this.htmlIsTemplate = false; + this.progressWidth = 0; + this.stopTime = false; + this.count = 0; + this.instance = function () { + _this.diff = (new Date().getTime() - _this.start) - (_this.count * _this.speed); + if (_this.count++ === _this.steps) { + _this.remove(); + // this.item.timeoutEnd!.emit(); + } + else if (!_this.stopTime) { + if (_this.showProgressBar) { + _this.progressWidth += 100 / _this.steps; + } + _this.timer = setTimeout(_this.instance, (_this.speed - _this.diff)); + } + _this.zone.run(function () { return _this.cdr.detectChanges(); }); + }; + } + NotificationComponent.prototype.ngOnInit = function () { + this.animate = this.notification.options.animate + NotificationAnimationsStatus.In; + if (this.notification.options.timeOut !== 0) { + this.startTimeOut(); + this.showProgressBar = true; + } + this.html = this.notification.html; + this.contentType(this.notification.title, 'title'); + this.contentType(this.notification.content, 'content'); + }; + NotificationComponent.prototype.startTimeOut = function () { + var _this = this; + this.steps = this.notification.options.timeOut / 10; + this.speed = this.notification.options.timeOut / this.steps; + this.start = new Date().getTime(); + this.zone.runOutsideAngular(function () { return _this.timer = setTimeout(_this.instance, _this.speed); }); + }; + NotificationComponent.prototype.ngOnDestroy = function () { + clearTimeout(this.timer); + }; + NotificationComponent.prototype.remove = function () { + var _this = this; + if (this.animate) { + this.setAnimationOut(); + setTimeout(function () { + _this.notificationService.remove(_this.notification); + }, 1000); + } + else { + this.notificationService.remove(this.notification); + } + }; + NotificationComponent.prototype.contentType = function (item, key) { + if (item instanceof TemplateRef) { + this[key] = item; + } + else if (key === 'title' || (key === 'content' && !this.html)) { + var value = null; + if (isNotEmpty(item)) { + if (typeof item === 'string') { + value = observableOf(item); + } + else if (item instanceof Observable) { + value = item; + } + else if (typeof item === 'object' && isNotEmpty(item.value)) { + // when notifications state is transferred from SSR to CSR, + // Observables Object loses the instance type and become simply object, + // so converts it again to Observable + value = observableOf(item.value); + } + } + this[key] = value; + } + else { + this[key] = this.domSanitizer.bypassSecurityTrustHtml(item); + } + this[key + 'IsTemplate'] = item instanceof TemplateRef; + }; + NotificationComponent.prototype.setAnimationOut = function () { + this.animate = this.notification.options.animate + NotificationAnimationsStatus.Out; + this.cdr.detectChanges(); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], NotificationComponent.prototype, "notification", void 0); + NotificationComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-notification', + encapsulation: ViewEncapsulation.None, + animations: [ + trigger('enterLeave', [ + fadeInEnter, fadeInState, fadeOutLeave, fadeOutState, + fromBottomEnter, fromBottomInState, fromBottomLeave, fromBottomOutState, + fromRightEnter, fromRightInState, fromRightLeave, fromRightOutState, + fromLeftEnter, fromLeftInState, fromLeftLeave, fromLeftOutState, + fromTopEnter, fromTopInState, fromTopLeave, fromTopOutState, + rotateInState, rotateEnter, rotateOutState, rotateLeave, + scaleInState, scaleEnter, scaleOutState, scaleLeave + ]) + ], + templateUrl: './notification.component.html', + styleUrls: ['./notification.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush + }), + tslib_1.__metadata("design:paramtypes", [NotificationsService, + DomSanitizer, + ChangeDetectorRef, + NgZone]) + ], NotificationComponent); + return NotificationComponent; +}()); +export { NotificationComponent }; +//# sourceMappingURL=notification.component.js.map \ No newline at end of file diff --git a/src/app/shared/notifications/notification/notification.component.js.map b/src/app/shared/notifications/notification/notification.component.js.map new file mode 100644 index 0000000000..f57d39a052 --- /dev/null +++ b/src/app/shared/notifications/notification/notification.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"notification.component.js","sourceRoot":"","sources":["notification.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,EAAE,IAAI,YAAY,EAAG,UAAU,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,KAAK,EACL,MAAM,EAGN,WAAW,EACX,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACjH,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAsB9C;IAwBE,+BAA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,GAAG,CAAC;QACpF,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;IAC3B,CAAC;IA1GQ;QAAR,KAAK,EAAE;;+DAA6C;IAF1C,qBAAqB;QAnBjC,SAAS,CAAC;YACT,QAAQ,EAAE,iBAAiB;YAC3B,aAAa,EAAE,iBAAiB,CAAC,IAAI;YACrC,UAAU,EAAE;gBACV,OAAO,CAAC,YAAY,EAAE;oBACpB,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY;oBACpD,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,kBAAkB;oBACvE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB;oBACnE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB;oBAC/D,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe;oBAC3D,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW;oBACvD,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU;iBACpD,CAAC;aACH;YACD,WAAW,EAAE,+BAA+B;YAC5C,SAAS,EAAE,CAAC,+BAA+B,CAAC;YAC5C,eAAe,EAAE,uBAAuB,CAAC,MAAM;SAChD,CAAC;iDA0ByC,oBAAoB;YAC3B,YAAY;YACrB,iBAAiB;YAChB,MAAM;OA3BrB,qBAAqB,CA6GjC;IAAD,4BAAC;CAAA,AA7GD,IA6GC;SA7GY,qBAAqB"} \ No newline at end of file diff --git a/src/app/shared/notifications/notifications-board/notifications-board.component.js b/src/app/shared/notifications/notifications-board/notifications-board.component.js new file mode 100644 index 0000000000..0b454b775e --- /dev/null +++ b/src/app/shared/notifications/notifications-board/notifications-board.component.js @@ -0,0 +1,130 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, ViewEncapsulation } from '@angular/core'; +import { select, Store } from '@ngrx/store'; +import { difference } from 'lodash'; +import { NotificationsService } from '../notifications.service'; +import { notificationsStateSelector } from '../selectors'; +var NotificationsBoardComponent = /** @class */ (function () { + function NotificationsBoardComponent(service, store, cdr) { + this.service = service; + this.store = store; + this.cdr = cdr; + this.notifications = []; + this.position = ['bottom', 'right']; + // Received values + this.maxStack = 8; + // Sent values + this.rtl = false; + this.animate = 'fromRight'; + } + Object.defineProperty(NotificationsBoardComponent.prototype, "options", { + set: function (opt) { + this.attachChanges(opt); + }, + enumerable: true, + configurable: true + }); + NotificationsBoardComponent.prototype.ngOnInit = function () { + var _this = this; + this.sub = this.store.pipe(select(notificationsStateSelector)) + .subscribe(function (state) { + if (state.length === 0) { + _this.notifications = []; + } + else if (state.length > _this.notifications.length) { + // Add + var newElem = difference(state, _this.notifications); + newElem.forEach(function (notification) { + _this.add(notification); + }); + } + else { + // Remove + var delElem = difference(_this.notifications, state); + delElem.forEach(function (notification) { + _this.notifications = _this.notifications.filter(function (item) { return item.id !== notification.id; }); + }); + } + _this.cdr.detectChanges(); + }); + }; + // Add the new notification to the notification array + NotificationsBoardComponent.prototype.add = function (item) { + var toBlock = this.block(item); + if (!toBlock) { + if (this.notifications.length >= this.maxStack) { + this.notifications.splice(this.notifications.length - 1, 1); + } + this.notifications.splice(0, 0, item); + } + else { + // Remove the notification from the store + // This notification was in the store, but not in this.notifications + // because it was a blocked duplicate + this.service.remove(item); + } + }; + NotificationsBoardComponent.prototype.block = function (item) { + var toCheck = item.html ? this.checkHtml : this.checkStandard; + this.notifications.forEach(function (notification) { + if (toCheck(notification, item)) { + return true; + } + }); + if (this.notifications.length > 0) { + this.notifications.forEach(function (notification) { + if (toCheck(notification, item)) { + return true; + } + }); + } + var comp; + if (this.notifications.length > 0) { + comp = this.notifications[0]; + } + else { + return false; + } + return toCheck(comp, item); + }; + NotificationsBoardComponent.prototype.checkStandard = function (checker, item) { + return checker.type === item.type && checker.title === item.title && checker.content === item.content; + }; + NotificationsBoardComponent.prototype.checkHtml = function (checker, item) { + return checker.html ? checker.type === item.type && checker.title === item.title && checker.content === item.content && checker.html === item.html : false; + }; + // Attach all the changes received in the options object + NotificationsBoardComponent.prototype.attachChanges = function (options) { + var _this = this; + Object.keys(options).forEach(function (a) { + if (_this.hasOwnProperty(a)) { + _this[a] = options[a]; + } + }); + }; + NotificationsBoardComponent.prototype.ngOnDestroy = function () { + if (this.sub) { + this.sub.unsubscribe(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object), + tslib_1.__metadata("design:paramtypes", [Object]) + ], NotificationsBoardComponent.prototype, "options", null); + NotificationsBoardComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-notifications-board', + encapsulation: ViewEncapsulation.None, + templateUrl: './notifications-board.component.html', + styleUrls: ['./notifications-board.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush + }), + tslib_1.__metadata("design:paramtypes", [NotificationsService, + Store, + ChangeDetectorRef]) + ], NotificationsBoardComponent); + return NotificationsBoardComponent; +}()); +export { NotificationsBoardComponent }; +//# sourceMappingURL=notifications-board.component.js.map \ No newline at end of file diff --git a/src/app/shared/notifications/notifications-board/notifications-board.component.js.map b/src/app/shared/notifications/notifications-board/notifications-board.component.js.map new file mode 100644 index 0000000000..c498853f0e --- /dev/null +++ b/src/app/shared/notifications/notifications-board/notifications-board.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"notifications-board.component.js","sourceRoot":"","sources":["notifications-board.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,KAAK,EAGL,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAY1D;IAkBE,qCAAoB,OAA6B,EAC7B,KAAsB,EACtB,GAAsB;QAFtB,YAAO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IAzGD;QADC,KAAK,EAAE;;;8DAGP;IALU,2BAA2B;QAPvC,SAAS,CAAC;YACT,QAAQ,EAAE,wBAAwB;YAClC,aAAa,EAAE,iBAAiB,CAAC,IAAI;YACrC,WAAW,EAAE,sCAAsC;YACnD,SAAS,EAAE,CAAC,sCAAsC,CAAC;YACnD,eAAe,EAAE,uBAAuB,CAAC,MAAM;SAChD,CAAC;iDAmB6B,oBAAoB;YACtB,KAAK;YACP,iBAAiB;OApB/B,2BAA2B,CA6GvC;IAAD,kCAAC;CAAA,AA7GD,IA6GC;SA7GY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/notifications/notifications.actions.js b/src/app/shared/notifications/notifications.actions.js new file mode 100644 index 0000000000..069b0e59f6 --- /dev/null +++ b/src/app/shared/notifications/notifications.actions.js @@ -0,0 +1,47 @@ +import { type } from '../../shared/ngrx/type'; +export var NotificationsActionTypes = { + NEW_NOTIFICATION: type('dspace/notifications/NEW_NOTIFICATION'), + REMOVE_ALL_NOTIFICATIONS: type('dspace/notifications/REMOVE_ALL_NOTIFICATIONS'), + REMOVE_NOTIFICATION: type('dspace/notifications/REMOVE_NOTIFICATION'), +}; +/* tslint:disable:max-classes-per-file */ +/** + * New notification. + * @class NewNotificationAction + * @implements {Action} + */ +var NewNotificationAction = /** @class */ (function () { + function NewNotificationAction(notification) { + this.type = NotificationsActionTypes.NEW_NOTIFICATION; + this.payload = notification; + } + return NewNotificationAction; +}()); +export { NewNotificationAction }; +/** + * Remove all notifications. + * @class RemoveAllNotificationsAction + * @implements {Action} + */ +var RemoveAllNotificationsAction = /** @class */ (function () { + function RemoveAllNotificationsAction(payload) { + this.payload = payload; + this.type = NotificationsActionTypes.REMOVE_ALL_NOTIFICATIONS; + } + return RemoveAllNotificationsAction; +}()); +export { RemoveAllNotificationsAction }; +/** + * Remove a notification. + * @class RemoveNotificationAction + * @implements {Action} + */ +var RemoveNotificationAction = /** @class */ (function () { + function RemoveNotificationAction(notificationId) { + this.type = NotificationsActionTypes.REMOVE_NOTIFICATION; + this.payload = notificationId; + } + return RemoveNotificationAction; +}()); +export { RemoveNotificationAction }; +//# sourceMappingURL=notifications.actions.js.map \ No newline at end of file diff --git a/src/app/shared/notifications/notifications.actions.js.map b/src/app/shared/notifications/notifications.actions.js.map new file mode 100644 index 0000000000..0ee4745890 --- /dev/null +++ b/src/app/shared/notifications/notifications.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"notifications.actions.js","sourceRoot":"","sources":["notifications.actions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAG9C,MAAM,CAAC,IAAM,wBAAwB,GAAG;IACtC,gBAAgB,EAAE,IAAI,CAAC,uCAAuC,CAAC;IAC/D,wBAAwB,EAAE,IAAI,CAAC,+CAA+C,CAAC;IAC/E,mBAAmB,EAAE,IAAI,CAAC,0CAA0C,CAAC;CACtE,CAAC;AAEF,yCAAyC;AAEzC;;;;GAIG;AACH;IAIE,+BAAY,YAA2B;QAHhC,SAAI,GAAW,wBAAwB,CAAC,gBAAgB,CAAC;QAI9D,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC;IAC9B,CAAC;IACH,4BAAC;AAAD,CAAC,AAPD,IAOC;;AAED;;;;GAIG;AACH;IAGE,sCAAmB,OAAa;QAAb,YAAO,GAAP,OAAO,CAAM;QAFzB,SAAI,GAAW,wBAAwB,CAAC,wBAAwB,CAAC;IAEpC,CAAC;IACvC,mCAAC;AAAD,CAAC,AAJD,IAIC;;AAED;;;;GAIG;AACH;IAIE,kCAAY,cAAmB;QAHxB,SAAI,GAAW,wBAAwB,CAAC,mBAAmB,CAAC;QAIjE,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC;IAChC,CAAC;IACH,+BAAC;AAAD,CAAC,AAPD,IAOC"} \ No newline at end of file diff --git a/src/app/shared/notifications/notifications.effects.js b/src/app/shared/notifications/notifications.effects.js new file mode 100644 index 0000000000..e3aff2f3fc --- /dev/null +++ b/src/app/shared/notifications/notifications.effects.js @@ -0,0 +1,37 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { Actions } from '@ngrx/effects'; +import { Store } from '@ngrx/store'; +var NotificationsEffects = /** @class */ (function () { + /** + * Authenticate user. + * @method authenticate + */ + /* @Effect() + public timer: Observable = this.actions$ + .pipe(ofType(NotificationsActionTypes.NEW_NOTIFICATION_WITH_TIMER), + // .debounceTime((action: any) => action.payload.options.timeOut) + debounceTime(3000), + map(() => new RemoveNotificationAction()); + .switchMap((action: NewNotificationWithTimerAction) => Observable + .timer(30000) + .mapTo(() => new RemoveNotificationAction()) + ));*/ + /** + * @constructor + * @param {Actions} actions$ + * @param {Store} store + */ + function NotificationsEffects(actions$, store) { + this.actions$ = actions$; + this.store = store; + } + NotificationsEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Actions, + Store]) + ], NotificationsEffects); + return NotificationsEffects; +}()); +export { NotificationsEffects }; +//# sourceMappingURL=notifications.effects.js.map \ No newline at end of file diff --git a/src/app/shared/notifications/notifications.effects.js.map b/src/app/shared/notifications/notifications.effects.js.map new file mode 100644 index 0000000000..545b890d3f --- /dev/null +++ b/src/app/shared/notifications/notifications.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"notifications.effects.js","sourceRoot":"","sources":["notifications.effects.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIpC;IAEE;;;OAGG;IACJ;;;;;;;;;YASQ;IAEP;;;;OAIG;IACH,8BAAoB,QAAiB,EACjB,KAAsB;QADtB,aAAQ,GAAR,QAAQ,CAAS;QACjB,UAAK,GAAL,KAAK,CAAiB;IAC1C,CAAC;IAxBU,oBAAoB;QADhC,UAAU,EAAE;iDAuBmB,OAAO;YACV,KAAK;OAvBrB,oBAAoB,CAyBhC;IAAD,2BAAC;CAAA,AAzBD,IAyBC;SAzBY,oBAAoB"} \ No newline at end of file diff --git a/src/app/shared/notifications/notifications.reducers.js b/src/app/shared/notifications/notifications.reducers.js new file mode 100644 index 0000000000..267307aa05 --- /dev/null +++ b/src/app/shared/notifications/notifications.reducers.js @@ -0,0 +1,28 @@ +import { NotificationsActionTypes } from './notifications.actions'; +/** + * The initial state. + */ +var initialState = []; +/** + * The reducer function. + * @function reducer + * @param {State} state Current state + * @param {NotificationsActions} action Incoming action + */ +export function notificationsReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + case NotificationsActionTypes.NEW_NOTIFICATION: + return state.concat([action.payload]); + case NotificationsActionTypes.REMOVE_ALL_NOTIFICATIONS: + return []; + case NotificationsActionTypes.REMOVE_NOTIFICATION: + return removeNotification(state, action); + default: + return state; + } +} +var removeNotification = function (state, action) { + return state.filter(function (item) { return item.id !== action.payload; }); +}; +//# sourceMappingURL=notifications.reducers.js.map \ No newline at end of file diff --git a/src/app/shared/notifications/notifications.reducers.js.map b/src/app/shared/notifications/notifications.reducers.js.map new file mode 100644 index 0000000000..9cd3e84a85 --- /dev/null +++ b/src/app/shared/notifications/notifications.reducers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"notifications.reducers.js","sourceRoot":"","sources":["notifications.reducers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,wBAAwB,EAA4B,MAAM,yBAAyB,CAAC;AAUnH;;GAEG;AACH,IAAM,YAAY,GAAuB,EAAE,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,+BAA+B,KAAyB,EAAE,MAA4B;IAAvD,sBAAA,EAAA,oBAAyB;IAE5D,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,wBAAwB,CAAC,gBAAgB;YAC5C,OAAW,KAAK,SAAE,MAAM,CAAC,OAAO,GAAE;QAEpC,KAAK,wBAAwB,CAAC,wBAAwB;YACpD,OAAO,EAAE,CAAC;QAEZ,KAAK,wBAAwB,CAAC,mBAAmB;YAC/C,OAAO,kBAAkB,CAAC,KAAK,EAAE,MAAkC,CAAC,CAAC;QAEvE;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC;AAED,IAAM,kBAAkB,GAAG,UAAC,KAAyB,EAAE,MAAgC;IACrF,OAAO,KAAK,CAAC,MAAM,CAAC,UAAC,IAAmB,IAAK,OAAA,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,EAA1B,CAA0B,CAAC,CAAC;AAC3E,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/notifications/notifications.service.js b/src/app/shared/notifications/notifications.service.js new file mode 100644 index 0000000000..efc078b27f --- /dev/null +++ b/src/app/shared/notifications/notifications.service.js @@ -0,0 +1,112 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { of as observableOf } from 'rxjs'; +import { first } from 'rxjs/operators'; +import { Store } from '@ngrx/store'; +import { TranslateService } from '@ngx-translate/core'; +import { uniqueId } from 'lodash'; +import { Notification } from './models/notification.model'; +import { NotificationType } from './models/notification-type'; +import { NotificationOptions } from './models/notification-options.model'; +import { NewNotificationAction, RemoveAllNotificationsAction, RemoveNotificationAction } from './notifications.actions'; +import { GLOBAL_CONFIG } from '../../../config'; +var NotificationsService = /** @class */ (function () { + function NotificationsService(config, store, translate) { + this.config = config; + this.store = store; + this.translate = translate; + } + NotificationsService.prototype.add = function (notification) { + var notificationAction; + notificationAction = new NewNotificationAction(notification); + this.store.dispatch(notificationAction); + }; + NotificationsService.prototype.success = function (title, content, options, html) { + if (title === void 0) { title = observableOf(''); } + if (content === void 0) { content = observableOf(''); } + if (options === void 0) { options = {}; } + if (html === void 0) { html = false; } + var notificationOptions = tslib_1.__assign({}, this.getDefaultOptions(), options); + var notification = new Notification(uniqueId(), NotificationType.Success, title, content, notificationOptions, html); + this.add(notification); + return notification; + }; + NotificationsService.prototype.error = function (title, content, options, html) { + if (title === void 0) { title = observableOf(''); } + if (content === void 0) { content = observableOf(''); } + if (options === void 0) { options = {}; } + if (html === void 0) { html = false; } + var notificationOptions = tslib_1.__assign({}, this.getDefaultOptions(), options); + var notification = new Notification(uniqueId(), NotificationType.Error, title, content, notificationOptions, html); + this.add(notification); + return notification; + }; + NotificationsService.prototype.info = function (title, content, options, html) { + if (title === void 0) { title = observableOf(''); } + if (content === void 0) { content = observableOf(''); } + if (options === void 0) { options = {}; } + if (html === void 0) { html = false; } + var notificationOptions = tslib_1.__assign({}, this.getDefaultOptions(), options); + var notification = new Notification(uniqueId(), NotificationType.Info, title, content, notificationOptions, html); + this.add(notification); + return notification; + }; + NotificationsService.prototype.warning = function (title, content, options, html) { + if (title === void 0) { title = observableOf(''); } + if (content === void 0) { content = observableOf(''); } + if (options === void 0) { options = this.getDefaultOptions(); } + if (html === void 0) { html = false; } + var notificationOptions = tslib_1.__assign({}, this.getDefaultOptions(), options); + var notification = new Notification(uniqueId(), NotificationType.Warning, title, content, notificationOptions, html); + this.add(notification); + return notification; + }; + NotificationsService.prototype.notificationWithAnchor = function (notificationType, options, href, hrefTranslateLabel, messageTranslateLabel, interpolateParam) { + var _this = this; + this.translate.get(hrefTranslateLabel) + .pipe(first()) + .subscribe(function (hrefMsg) { + var anchor = "\n " + hrefMsg + "\n "; + var interpolateParams = Object.create({}); + interpolateParams[interpolateParam] = anchor; + _this.translate.get(messageTranslateLabel, interpolateParams) + .pipe(first()) + .subscribe(function (m) { + switch (notificationType) { + case NotificationType.Success: + _this.success(null, m, options, true); + break; + case NotificationType.Error: + _this.error(null, m, options, true); + break; + case NotificationType.Info: + _this.info(null, m, options, true); + break; + case NotificationType.Warning: + _this.warning(null, m, options, true); + break; + } + }); + }); + }; + NotificationsService.prototype.remove = function (notification) { + var actionRemove = new RemoveNotificationAction(notification.id); + this.store.dispatch(actionRemove); + }; + NotificationsService.prototype.removeAll = function () { + var actionRemoveAll = new RemoveAllNotificationsAction(); + this.store.dispatch(actionRemoveAll); + }; + NotificationsService.prototype.getDefaultOptions = function () { + return new NotificationOptions(this.config.notifications.timeOut, this.config.notifications.clickToClose, this.config.notifications.animate); + }; + NotificationsService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, Store, + TranslateService]) + ], NotificationsService); + return NotificationsService; +}()); +export { NotificationsService }; +//# sourceMappingURL=notifications.service.js.map \ No newline at end of file diff --git a/src/app/shared/notifications/notifications.service.js.map b/src/app/shared/notifications/notifications.service.js.map new file mode 100644 index 0000000000..37ba115eaf --- /dev/null +++ b/src/app/shared/notifications/notifications.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"notifications.service.js","sourceRoot":"","sources":["notifications.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAiB,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACxH,OAAO,EAAE,aAAa,EAAgB,MAAM,iBAAiB,CAAC;AAG9D;IAEE,8BAA0C,MAAoB,EAC1C,KAA0B,EAC1B,SAA2B;QAFL,WAAM,GAAN,MAAM,CAAc;QAC1C,UAAK,GAAL,KAAK,CAAqB;QAC1B,cAAS,GAAT,SAAS,CAAkB;IA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IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC;IAED,wCAAS,GAAT;QACE,IAAM,eAAe,GAAG,IAAI,4BAA4B,EAAE,CAAC;QAC3D,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAEO,gDAAiB,GAAzB;QACE,OAAO,IAAI,mBAAmB,CAC5B,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,EACjC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,EACtC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAClC,CAAC;IACJ,CAAC;IAxGU,oBAAoB;QADhC,UAAU,EAAE;QAGE,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACP,KAAK;YACD,gBAAgB;OAJpC,oBAAoB,CAyGhC;IAAD,2BAAC;CAAA,AAzGD,IAyGC;SAzGY,oBAAoB"} \ No newline at end of file diff --git a/src/app/shared/notifications/selectors.js b/src/app/shared/notifications/selectors.js new file mode 100644 index 0000000000..bc382e47ab --- /dev/null +++ b/src/app/shared/notifications/selectors.js @@ -0,0 +1,2 @@ +export var notificationsStateSelector = function (state) { return state.notifications; }; +//# sourceMappingURL=selectors.js.map \ No newline at end of file diff --git a/src/app/shared/notifications/selectors.js.map b/src/app/shared/notifications/selectors.js.map new file mode 100644 index 0000000000..3da6e2ee79 --- /dev/null +++ b/src/app/shared/notifications/selectors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"selectors.js","sourceRoot":"","sources":["selectors.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,IAAM,0BAA0B,GAAG,UAAC,KAAe,IAAK,OAAA,KAAK,CAAC,aAAa,EAAnB,CAAmB,CAAC"} \ No newline at end of file diff --git a/src/app/shared/number-picker/number-picker.component.js b/src/app/shared/number-picker/number-picker.component.js new file mode 100644 index 0000000000..6bae14f5d0 --- /dev/null +++ b/src/app/shared/number-picker/number-picker.component.js @@ -0,0 +1,187 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, EventEmitter, Input, Output, } from '@angular/core'; +import { FormBuilder, NG_VALUE_ACCESSOR } from '@angular/forms'; +import { isEmpty } from '../empty.util'; +var NumberPickerComponent = /** @class */ (function () { + function NumberPickerComponent(fb, cd) { + this.fb = fb; + this.cd = cd; + this.selected = new EventEmitter(); + this.remove = new EventEmitter(); + this.blur = new EventEmitter(); + this.change = new EventEmitter(); + this.focus = new EventEmitter(); + } + NumberPickerComponent_1 = NumberPickerComponent; + NumberPickerComponent.prototype.ngOnInit = function () { + // this.startValue = this.value; + this.step = this.step || 1; + this.min = this.min || 0; + this.max = this.max || 100; + this.size = this.size || 1; + this.disabled = this.disabled || false; + this.invalid = this.invalid || false; + this.cd.detectChanges(); + }; + NumberPickerComponent.prototype.ngOnChanges = function (changes) { + if (this.value) { + if (changes.max) { + // When the user select a month with < # of days + this.value = this.value > this.max ? this.max : this.value; + } + } + else if (changes.value && changes.value.currentValue === null) { + // When the user delete the inserted value + this.value = null; + } + else if (changes.invalid) { + this.invalid = changes.invalid.currentValue; + } + }; + NumberPickerComponent.prototype.changeValue = function (reverse) { + if (reverse === void 0) { reverse = false; } + // First after init + if (isEmpty(this.value)) { + this.value = this.startValue; + } + else { + this.startValue = this.value; + var newValue = this.value; + if (reverse) { + newValue -= this.step; + } + else { + newValue += this.step; + } + if (newValue >= this.min && newValue <= this.max) { + this.value = newValue; + } + else { + if (newValue > this.max) { + this.value = this.min; + } + else { + this.value = this.max; + } + } + } + this.emitChange(); + }; + NumberPickerComponent.prototype.toggleDown = function () { + this.changeValue(true); + }; + NumberPickerComponent.prototype.toggleUp = function () { + this.changeValue(); + }; + NumberPickerComponent.prototype.update = function (event) { + try { + var i = Number.parseInt(event.target.value, 10); + if (i >= this.min && i <= this.max) { + this.value = i; + this.emitChange(); + } + else if (event.target.value === null || event.target.value === '') { + this.value = null; + this.emitChange(); + } + else { + this.value = undefined; + } + } + catch (e) { + this.value = undefined; + } + }; + NumberPickerComponent.prototype.onBlur = function (event) { + this.blur.emit(event); + }; + NumberPickerComponent.prototype.onFocus = function (event) { + if (this.value) { + this.startValue = this.value; + } + this.focus.emit(event); + }; + NumberPickerComponent.prototype.writeValue = function (value) { + this.startValue = value || this.min; + }; + NumberPickerComponent.prototype.registerOnChange = function (fn) { + return; + }; + NumberPickerComponent.prototype.registerOnTouched = function (fn) { + return; + }; + NumberPickerComponent.prototype.emitChange = function () { + this.change.emit({ field: this.name, value: this.value }); + }; + var NumberPickerComponent_1; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Number) + ], NumberPickerComponent.prototype, "step", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Number) + ], NumberPickerComponent.prototype, "min", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Number) + ], NumberPickerComponent.prototype, "max", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Number) + ], NumberPickerComponent.prototype, "size", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], NumberPickerComponent.prototype, "placeholder", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], NumberPickerComponent.prototype, "name", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Boolean) + ], NumberPickerComponent.prototype, "disabled", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Boolean) + ], NumberPickerComponent.prototype, "invalid", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Number) + ], NumberPickerComponent.prototype, "value", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], NumberPickerComponent.prototype, "selected", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], NumberPickerComponent.prototype, "remove", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], NumberPickerComponent.prototype, "blur", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], NumberPickerComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], NumberPickerComponent.prototype, "focus", void 0); + NumberPickerComponent = NumberPickerComponent_1 = tslib_1.__decorate([ + Component({ + selector: 'ds-number-picker', + styleUrls: ['./number-picker.component.scss'], + templateUrl: './number-picker.component.html', + providers: [ + { provide: NG_VALUE_ACCESSOR, useExisting: NumberPickerComponent_1, multi: true } + ], + }), + tslib_1.__metadata("design:paramtypes", [FormBuilder, ChangeDetectorRef]) + ], NumberPickerComponent); + return NumberPickerComponent; +}()); +export { NumberPickerComponent }; +//# sourceMappingURL=number-picker.component.js.map \ No newline at end of file diff --git a/src/app/shared/number-picker/number-picker.component.js.map b/src/app/shared/number-picker/number-picker.component.js.map new file mode 100644 index 0000000000..83d70d501d --- /dev/null +++ b/src/app/shared/number-picker/number-picker.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"number-picker.component.js","sourceRoot":"","sources":["number-picker.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAU,MAAM,GAAkB,MAAM,eAAe,CAAC;AAClH,OAAO,EAAwB,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAWxC;IAoBE,+BAAoB,EAAe,EAAU,EAAqB;QAA9C,OAAE,GAAF,EAAE,CAAa;QAAU,OAAE,GAAF,EAAE,CAAmB;QARxD,aAAQ,GAAG,IAAI,YAAY,EAAU,CAAC;QACtC,WAAM,GAAG,IAAI,YAAY,EAAU,CAAC;QACpC,SAAI,GAAG,IAAI,YAAY,EAAO,CAAC;QAC/B,WAAM,GAAG,IAAI,YAAY,EAAO,CAAC;QACjC,UAAK,GAAG,IAAI,YAAY,EAAO,CAAC;IAK1C,CAAC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AT,MAAM,EAAE;;yDAAqC;IACpC;QAAT,MAAM,EAAE;;uDAAgC;IAC/B;QAAT,MAAM,EAAE;;yDAAkC;IACjC;QAAT,MAAM,EAAE;;wDAAiC;IAhB/B,qBAAqB;QATjC,SAAS,CAAC;YACT,QAAQ,EAAE,kBAAkB;YAC5B,SAAS,EAAE,CAAC,gCAAgC,CAAC;YAC7C,WAAW,EAAE,gCAAgC;YAC7C,SAAS,EAAE;gBACT,EAAC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,uBAAqB,EAAE,KAAK,EAAE,IAAI,EAAC;aAC9E;SACF,CAAC;iDAsBwB,WAAW,EAAc,iBAAiB;OApBvD,qBAAqB,CAkIjC;IAAD,4BAAC;CAAA,AAlID,IAkIC;SAlIY,qBAAqB"} \ No newline at end of file diff --git a/src/app/shared/object-collection/object-collection.component.js b/src/app/shared/object-collection/object-collection.component.js new file mode 100644 index 0000000000..38b006a70c --- /dev/null +++ b/src/app/shared/object-collection/object-collection.component.js @@ -0,0 +1,143 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { map } from 'rxjs/operators'; +import { RemoteData } from '../../core/data/remote-data'; +import { PaginationComponentOptions } from '../pagination/pagination-component-options.model'; +import { SortOptions } from '../../core/cache/models/sort-options.model'; +import { SetViewMode } from '../view-mode'; +import { hasValue, isNotEmpty } from '../empty.util'; +var ObjectCollectionComponent = /** @class */ (function () { + /** + * @param cdRef + * ChangeDetectorRef service provided by Angular. + * @param route + * Route is a singleton service provided by Angular. + * @param router + * Router is a singleton service provided by Angular. + */ + function ObjectCollectionComponent(cdRef, route, router) { + this.cdRef = cdRef; + this.route = route; + this.router = router; + this.hasBorder = false; + this.hideGear = false; + /** + * An event fired when the page is changed. + * Event's payload equals to the newly selected page. + */ + this.pageChange = new EventEmitter(); + /** + * An event fired when the page wsize is changed. + * Event's payload equals to the newly selected page size. + */ + this.pageSizeChange = new EventEmitter(); + /** + * An event fired when the sort direction is changed. + * Event's payload equals to the newly selected sort direction. + */ + this.sortDirectionChange = new EventEmitter(); + this.paginationChange = new EventEmitter(); + /** + * An event fired when the sort field is changed. + * Event's payload equals to the newly selected sort field. + */ + this.sortFieldChange = new EventEmitter(); + this.data = {}; + this.currentMode = SetViewMode.List; + this.viewModeEnum = SetViewMode; + } + ObjectCollectionComponent.prototype.ngOnChanges = function (changes) { + if (changes.objects && !changes.objects.isFirstChange()) { + // this.pageInfo = this.objects.pageInfo; + } + }; + ObjectCollectionComponent.prototype.ngOnInit = function () { + // this.pageInfo = this.objects.pageInfo; + var _this = this; + this.sub = this.route + .queryParams + .subscribe(function (params) { + if (isNotEmpty(params.view)) { + _this.currentMode = params.view; + } + }); + }; + ObjectCollectionComponent.prototype.getViewMode = function () { + var _this = this; + this.route.queryParams.pipe(map(function (params) { + if (isNotEmpty(params.view) && hasValue(params.view)) { + _this.currentMode = params.view; + } + })); + return this.currentMode; + }; + ObjectCollectionComponent.prototype.onPageChange = function (event) { + this.pageChange.emit(event); + }; + ObjectCollectionComponent.prototype.onPageSizeChange = function (event) { + this.pageSizeChange.emit(event); + }; + ObjectCollectionComponent.prototype.onSortDirectionChange = function (event) { + this.sortDirectionChange.emit(event); + }; + ObjectCollectionComponent.prototype.onSortFieldChange = function (event) { + this.sortFieldChange.emit(event); + }; + ObjectCollectionComponent.prototype.onPaginationChange = function (event) { + this.paginationChange.emit(event); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", RemoteData) + ], ObjectCollectionComponent.prototype, "objects", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", PaginationComponentOptions) + ], ObjectCollectionComponent.prototype, "config", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SortOptions) + ], ObjectCollectionComponent.prototype, "sortConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ObjectCollectionComponent.prototype, "hasBorder", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ObjectCollectionComponent.prototype, "hideGear", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectCollectionComponent.prototype, "pageChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectCollectionComponent.prototype, "pageSizeChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectCollectionComponent.prototype, "sortDirectionChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectCollectionComponent.prototype, "paginationChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectCollectionComponent.prototype, "sortFieldChange", void 0); + ObjectCollectionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-viewable-collection', + styleUrls: ['./object-collection.component.scss'], + templateUrl: './object-collection.component.html', + }), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef, + ActivatedRoute, + Router]) + ], ObjectCollectionComponent); + return ObjectCollectionComponent; +}()); +export { ObjectCollectionComponent }; +//# sourceMappingURL=object-collection.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/object-collection.component.js.map b/src/app/shared/object-collection/object-collection.component.js.map new file mode 100644 index 0000000000..285390beef --- /dev/null +++ b/src/app/shared/object-collection/object-collection.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-collection.component.js","sourceRoot":"","sources":["object-collection.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,KAAK,EAGL,MAAM,EAEP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE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;0CAAiB,YAAY;qEAAsC;IAMlE;QAAT,MAAM,EAAE;0CAAsB,YAAY;0EAAoD;IAErF;QAAT,MAAM,EAAE;0CAAmB,YAAY;uEAA0C;IAMxE;QAAT,MAAM,EAAE;0CAAkB,YAAY;sEAAsC;IAjClE,yBAAyB;QALrC,SAAS,CAAC;YACT,QAAQ,EAAE,wBAAwB;YAClC,SAAS,EAAE,CAAC,oCAAoC,CAAC;YACjD,WAAW,EAAE,oCAAoC;SAClD,CAAC;iDAkEiB,iBAAiB;YACjB,cAAc;YACb,MAAM;OAnEb,yBAAyB,CAmGrC;IAAD,gCAAC;CAAA,AAnGD,IAmGC;SAnGY,yBAAyB"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/claimed-task-my-dspace-result.model.js b/src/app/shared/object-collection/shared/claimed-task-my-dspace-result.model.js new file mode 100644 index 0000000000..3e007a9522 --- /dev/null +++ b/src/app/shared/object-collection/shared/claimed-task-my-dspace-result.model.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { ClaimedTask } from '../../../core/tasks/models/claimed-task-object.model'; +import { SearchResult } from '../../../+search-page/search-result.model'; +import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type'; +import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator'; +/** + * Represents a search result object of a ClaimedTask object + */ +var ClaimedTaskMyDSpaceResult = /** @class */ (function (_super) { + tslib_1.__extends(ClaimedTaskMyDSpaceResult, _super); + function ClaimedTaskMyDSpaceResult() { + return _super !== null && _super.apply(this, arguments) || this; + } + ClaimedTaskMyDSpaceResult = tslib_1.__decorate([ + searchResultFor(ClaimedTask, MyDSpaceConfigurationValueType.Workflow) + ], ClaimedTaskMyDSpaceResult); + return ClaimedTaskMyDSpaceResult; +}(SearchResult)); +export { ClaimedTaskMyDSpaceResult }; +//# sourceMappingURL=claimed-task-my-dspace-result.model.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/claimed-task-my-dspace-result.model.js.map b/src/app/shared/object-collection/shared/claimed-task-my-dspace-result.model.js.map new file mode 100644 index 0000000000..327fbedf88 --- /dev/null +++ b/src/app/shared/object-collection/shared/claimed-task-my-dspace-result.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"claimed-task-my-dspace-result.model.js","sourceRoot":"","sources":["claimed-task-my-dspace-result.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6DAA6D,CAAC;AAC7G,OAAO,EAAE,eAAe,EAAE,MAAM,sEAAsE,CAAC;AAEvG;;GAEG;AAEH;IAA+C,qDAAyB;IAAxE;;IACA,CAAC;IADY,yBAAyB;QADrC,eAAe,CAAC,WAAW,EAAE,8BAA8B,CAAC,QAAQ,CAAC;OACzD,yBAAyB,CACrC;IAAD,gCAAC;CAAA,AADD,CAA+C,YAAY,GAC1D;SADY,yBAAyB"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/collection-search-result.model.js b/src/app/shared/object-collection/shared/collection-search-result.model.js new file mode 100644 index 0000000000..e162ede065 --- /dev/null +++ b/src/app/shared/object-collection/shared/collection-search-result.model.js @@ -0,0 +1,16 @@ +import * as tslib_1 from "tslib"; +import { SearchResult } from '../../../+search-page/search-result.model'; +import { Collection } from '../../../core/shared/collection.model'; +import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator'; +var CollectionSearchResult = /** @class */ (function (_super) { + tslib_1.__extends(CollectionSearchResult, _super); + function CollectionSearchResult() { + return _super !== null && _super.apply(this, arguments) || this; + } + CollectionSearchResult = tslib_1.__decorate([ + searchResultFor(Collection) + ], CollectionSearchResult); + return CollectionSearchResult; +}(SearchResult)); +export { CollectionSearchResult }; +//# sourceMappingURL=collection-search-result.model.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/collection-search-result.model.js.map b/src/app/shared/object-collection/shared/collection-search-result.model.js.map new file mode 100644 index 0000000000..f9546df8a5 --- /dev/null +++ b/src/app/shared/object-collection/shared/collection-search-result.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collection-search-result.model.js","sourceRoot":"","sources":["collection-search-result.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,sEAAsE,CAAC;AAGvG;IAA4C,kDAAwB;IAApE;;IACA,CAAC;IADY,sBAAsB;QADlC,eAAe,CAAC,UAAU,CAAC;OACf,sBAAsB,CAClC;IAAD,6BAAC;CAAA,AADD,CAA4C,YAAY,GACvD;SADY,sBAAsB"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/community-search-result.model.js b/src/app/shared/object-collection/shared/community-search-result.model.js new file mode 100644 index 0000000000..43ddc2c3e5 --- /dev/null +++ b/src/app/shared/object-collection/shared/community-search-result.model.js @@ -0,0 +1,16 @@ +import * as tslib_1 from "tslib"; +import { Community } from '../../../core/shared/community.model'; +import { SearchResult } from '../../../+search-page/search-result.model'; +import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator'; +var CommunitySearchResult = /** @class */ (function (_super) { + tslib_1.__extends(CommunitySearchResult, _super); + function CommunitySearchResult() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommunitySearchResult = tslib_1.__decorate([ + searchResultFor(Community) + ], CommunitySearchResult); + return CommunitySearchResult; +}(SearchResult)); +export { CommunitySearchResult }; +//# sourceMappingURL=community-search-result.model.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/community-search-result.model.js.map b/src/app/shared/object-collection/shared/community-search-result.model.js.map new file mode 100644 index 0000000000..3fa6ef4651 --- /dev/null +++ b/src/app/shared/object-collection/shared/community-search-result.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-search-result.model.js","sourceRoot":"","sources":["community-search-result.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,sEAAsE,CAAC;AAGvG;IAA2C,iDAAuB;IAAlE;;IACA,CAAC;IADY,qBAAqB;QADjC,eAAe,CAAC,SAAS,CAAC;OACd,qBAAqB,CACjC;IAAD,4BAAC;CAAA,AADD,CAA2C,YAAY,GACtD;SADY,qBAAqB"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/dso-element-decorator.js b/src/app/shared/object-collection/shared/dso-element-decorator.js new file mode 100644 index 0000000000..ac08138257 --- /dev/null +++ b/src/app/shared/object-collection/shared/dso-element-decorator.js @@ -0,0 +1,16 @@ +var dsoElementMap = new Map(); +export function renderElementsFor(listable, viewMode) { + return function decorator(objectElement) { + if (!objectElement) { + return; + } + if (!dsoElementMap.get(viewMode)) { + dsoElementMap.set(viewMode, new Map()); + } + dsoElementMap.get(viewMode).set(listable, objectElement); + }; +} +export function rendersDSOType(listable, viewMode) { + return dsoElementMap.get(viewMode).get(listable); +} +//# sourceMappingURL=dso-element-decorator.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/dso-element-decorator.js.map b/src/app/shared/object-collection/shared/dso-element-decorator.js.map new file mode 100644 index 0000000000..1e89bd37e4 --- /dev/null +++ b/src/app/shared/object-collection/shared/dso-element-decorator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dso-element-decorator.js","sourceRoot":"","sources":["dso-element-decorator.ts"],"names":[],"mappings":"AAIA,IAAM,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;AAChC,MAAM,4BAA4B,QAA4C,EAAE,QAAqB;IACnG,OAAO,mBAAmB,aAAkB;QAC1C,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO;SACR;QACD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAChC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;SACxC;QACD,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,yBAAyB,QAA4C,EAAE,QAAqB;IAChG,OAAO,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACnD,CAAC"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/item-my-dspace-result.model.js b/src/app/shared/object-collection/shared/item-my-dspace-result.model.js new file mode 100644 index 0000000000..7efb687948 --- /dev/null +++ b/src/app/shared/object-collection/shared/item-my-dspace-result.model.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { Item } from '../../../core/shared/item.model'; +import { SearchResult } from '../../../+search-page/search-result.model'; +import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator'; +import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type'; +/** + * Represents a search result object of a Item object + */ +var ItemMyDSpaceResult = /** @class */ (function (_super) { + tslib_1.__extends(ItemMyDSpaceResult, _super); + function ItemMyDSpaceResult() { + return _super !== null && _super.apply(this, arguments) || this; + } + ItemMyDSpaceResult = tslib_1.__decorate([ + searchResultFor(Item, MyDSpaceConfigurationValueType.Workspace) + ], ItemMyDSpaceResult); + return ItemMyDSpaceResult; +}(SearchResult)); +export { ItemMyDSpaceResult }; +//# sourceMappingURL=item-my-dspace-result.model.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/item-my-dspace-result.model.js.map b/src/app/shared/object-collection/shared/item-my-dspace-result.model.js.map new file mode 100644 index 0000000000..6a4377a465 --- /dev/null +++ b/src/app/shared/object-collection/shared/item-my-dspace-result.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-my-dspace-result.model.js","sourceRoot":"","sources":["item-my-dspace-result.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,sEAAsE,CAAC;AACvG,OAAO,EAAE,8BAA8B,EAAE,MAAM,6DAA6D,CAAC;AAE7G;;GAEG;AAEH;IAAwC,8CAAkB;IAA1D;;IACA,CAAC;IADY,kBAAkB;QAD9B,eAAe,CAAC,IAAI,EAAE,8BAA8B,CAAC,SAAS,CAAC;OACnD,kBAAkB,CAC9B;IAAD,yBAAC;CAAA,AADD,CAAwC,YAAY,GACnD;SADY,kBAAkB"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/item-search-result.model.js b/src/app/shared/object-collection/shared/item-search-result.model.js new file mode 100644 index 0000000000..6c4d44ec90 --- /dev/null +++ b/src/app/shared/object-collection/shared/item-search-result.model.js @@ -0,0 +1,16 @@ +import * as tslib_1 from "tslib"; +import { SearchResult } from '../../../+search-page/search-result.model'; +import { Item } from '../../../core/shared/item.model'; +import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator'; +var ItemSearchResult = /** @class */ (function (_super) { + tslib_1.__extends(ItemSearchResult, _super); + function ItemSearchResult() { + return _super !== null && _super.apply(this, arguments) || this; + } + ItemSearchResult = tslib_1.__decorate([ + searchResultFor(Item) + ], ItemSearchResult); + return ItemSearchResult; +}(SearchResult)); +export { ItemSearchResult }; +//# sourceMappingURL=item-search-result.model.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/item-search-result.model.js.map b/src/app/shared/object-collection/shared/item-search-result.model.js.map new file mode 100644 index 0000000000..ab9d23a8b6 --- /dev/null +++ b/src/app/shared/object-collection/shared/item-search-result.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-search-result.model.js","sourceRoot":"","sources":["item-search-result.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sEAAsE,CAAC;AAGvG;IAAsC,4CAAkB;IAAxD;;IACA,CAAC;IADY,gBAAgB;QAD5B,eAAe,CAAC,IAAI,CAAC;OACT,gBAAgB,CAC5B;IAAD,uBAAC;CAAA,AADD,CAAsC,YAAY,GACjD;SADY,gBAAgB"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/listable-object.model.js b/src/app/shared/object-collection/shared/listable-object.model.js new file mode 100644 index 0000000000..bbcefdafca --- /dev/null +++ b/src/app/shared/object-collection/shared/listable-object.model.js @@ -0,0 +1 @@ +//# sourceMappingURL=listable-object.model.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/listable-object.model.js.map b/src/app/shared/object-collection/shared/listable-object.model.js.map new file mode 100644 index 0000000000..d1df240cfa --- /dev/null +++ b/src/app/shared/object-collection/shared/listable-object.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"listable-object.model.js","sourceRoot":"","sources":["listable-object.model.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status-type.js b/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status-type.js new file mode 100644 index 0000000000..92c4dfed44 --- /dev/null +++ b/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status-type.js @@ -0,0 +1,9 @@ +export var MyDspaceItemStatusType; +(function (MyDspaceItemStatusType) { + MyDspaceItemStatusType["WORKFLOW"] = "mydspace.status.workflow"; + MyDspaceItemStatusType["VALIDATION"] = "mydspace.status.validation"; + MyDspaceItemStatusType["WAITING_CONTROLLER"] = "mydspace.status.waiting-for-controller"; + MyDspaceItemStatusType["WORKSPACE"] = "mydspace.status.workspace"; + MyDspaceItemStatusType["ARCHIVED"] = "mydspace.status.archived"; +})(MyDspaceItemStatusType || (MyDspaceItemStatusType = {})); +//# sourceMappingURL=my-dspace-item-status-type.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status-type.js.map b/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status-type.js.map new file mode 100644 index 0000000000..5546fe9e4c --- /dev/null +++ b/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace-item-status-type.js","sourceRoot":"","sources":["my-dspace-item-status-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,sBAMX;AAND,WAAY,sBAAsB;IAChC,+DAAqC,CAAA;IACrC,mEAAyC,CAAA;IACzC,uFAA6D,CAAA;IAC7D,iEAAuC,CAAA;IACvC,+DAAqC,CAAA;AACvC,CAAC,EANW,sBAAsB,KAAtB,sBAAsB,QAMjC"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status.component.js b/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status.component.js new file mode 100644 index 0000000000..f2c2021c31 --- /dev/null +++ b/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status.component.js @@ -0,0 +1,48 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { MyDspaceItemStatusType } from './my-dspace-item-status-type'; +/** + * This component represents a badge with mydspace item status + */ +var MyDSpaceItemStatusComponent = /** @class */ (function () { + function MyDSpaceItemStatusComponent() { + } + /** + * Initialize badge content and class + */ + MyDSpaceItemStatusComponent.prototype.ngOnInit = function () { + this.badgeContent = this.status; + this.badgeClass = 'text-light badge '; + switch (this.status) { + case MyDspaceItemStatusType.VALIDATION: + this.badgeClass += 'badge-warning'; + break; + case MyDspaceItemStatusType.WAITING_CONTROLLER: + this.badgeClass += 'badge-info'; + break; + case MyDspaceItemStatusType.WORKSPACE: + this.badgeClass += 'badge-primary'; + break; + case MyDspaceItemStatusType.ARCHIVED: + this.badgeClass += 'badge-success'; + break; + case MyDspaceItemStatusType.WORKFLOW: + this.badgeClass += 'badge-info'; + break; + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], MyDSpaceItemStatusComponent.prototype, "status", void 0); + MyDSpaceItemStatusComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-mydspace-item-status', + styleUrls: ['./my-dspace-item-status.component.scss'], + templateUrl: './my-dspace-item-status.component.html' + }) + ], MyDSpaceItemStatusComponent); + return MyDSpaceItemStatusComponent; +}()); +export { MyDSpaceItemStatusComponent }; +//# sourceMappingURL=my-dspace-item-status.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status.component.js.map b/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status.component.js.map new file mode 100644 index 0000000000..d0bcd7743d --- /dev/null +++ b/src/app/shared/object-collection/shared/mydspace-item-status/my-dspace-item-status.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace-item-status.component.js","sourceRoot":"","sources":["my-dspace-item-status.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AAMH;IAAA;IA0CA,CAAC;IAzBC;;OAEG;IACH,8CAAQ,GAAR;QACE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC;QACtC,QAAQ,IAAI,CAAC,MAAM,EAAE;YACnB,KAAK,sBAAsB,CAAC,UAAU;gBACpC,IAAI,CAAC,UAAU,IAAI,eAAe,CAAC;gBACnC,MAAM;YACR,KAAK,sBAAsB,CAAC,kBAAkB;gBAC5C,IAAI,CAAC,UAAU,IAAI,YAAY,CAAC;gBAChC,MAAM;YACR,KAAK,sBAAsB,CAAC,SAAS;gBACnC,IAAI,CAAC,UAAU,IAAI,eAAe,CAAC;gBACnC,MAAM;YACR,KAAK,sBAAsB,CAAC,QAAQ;gBAClC,IAAI,CAAC,UAAU,IAAI,eAAe,CAAC;gBACnC,MAAM;YACR,KAAK,sBAAsB,CAAC,QAAQ;gBAClC,IAAI,CAAC,UAAU,IAAI,YAAY,CAAC;gBAChC,MAAM;SACT;IACH,CAAC;IAnCQ;QAAR,KAAK,EAAE;;+DAAgC;IAL7B,2BAA2B;QALvC,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,SAAS,EAAE,CAAC,wCAAwC,CAAC;YACrD,WAAW,EAAE,wCAAwC;SACtD,CAAC;OACW,2BAA2B,CA0CvC;IAAD,kCAAC;CAAA,AA1CD,IA0CC;SA1CY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.js b/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.js new file mode 100644 index 0000000000..5f7a8e0f79 --- /dev/null +++ b/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.js @@ -0,0 +1,31 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { filter, find, flatMap, map } from 'rxjs/operators'; +import { isNotEmpty, isNotUndefined } from '../../../empty.util'; +/** + * This component represents a badge with submitter information. + */ +var ItemSubmitterComponent = /** @class */ (function () { + function ItemSubmitterComponent() { + } + /** + * Initialize submitter object + */ + ItemSubmitterComponent.prototype.ngOnInit = function () { + this.submitter$ = this.object.workflowitem.pipe(filter(function (rd) { return (rd.hasSucceeded && isNotUndefined(rd.payload)); }), flatMap(function (rd) { return rd.payload.submitter; }), find(function (rd) { return rd.hasSucceeded && isNotEmpty(rd.payload); }), map(function (rd) { return rd.payload; })); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ItemSubmitterComponent.prototype, "object", void 0); + ItemSubmitterComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-submitter', + styleUrls: ['./item-submitter.component.scss'], + templateUrl: './item-submitter.component.html' + }) + ], ItemSubmitterComponent); + return ItemSubmitterComponent; +}()); +export { ItemSubmitterComponent }; +//# sourceMappingURL=item-submitter.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.js.map b/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.js.map new file mode 100644 index 0000000000..db1c0a3d47 --- /dev/null +++ b/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-submitter.component.js","sourceRoot":"","sources":["item-submitter.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAGzD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAI5D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGjE;;GAEG;AAMH;IAAA;IAsBA,CAAC;IAVC;;OAEG;IACH,yCAAQ,GAAR;QACE,IAAI,CAAC,UAAU,GAAI,IAAI,CAAC,MAAM,CAAC,YAAqD,CAAC,IAAI,CACvF,MAAM,CAAC,UAAC,EAA4B,IAAK,OAAA,CAAC,EAAE,CAAC,YAAY,IAAI,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAA/C,CAA+C,CAAC,EACzF,OAAO,CAAC,UAAC,EAA4B,IAAK,OAAA,EAAE,CAAC,OAAO,CAAC,SAA4C,EAAvD,CAAuD,CAAC,EAClG,IAAI,CAAC,UAAC,EAAuB,IAAK,OAAA,EAAE,CAAC,YAAY,IAAI,UAAU,CAAC,EAAE,CAAC,OAAO,CAAC,EAAzC,CAAyC,CAAC,EAC5E,GAAG,CAAC,UAAC,EAAuB,IAAK,OAAA,EAAE,CAAC,OAAO,EAAV,CAAU,CAAC,CAAC,CAAC;IAClD,CAAC;IAhBQ;QAAR,KAAK,EAAE;;0DAAa;IALV,sBAAsB;QALlC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,SAAS,EAAE,CAAC,iCAAiC,CAAC;YAC9C,WAAW,EAAE,iCAAiC;SAC/C,CAAC;OACW,sBAAsB,CAsBlC;IAAD,6BAAC;CAAA,AAtBD,IAsBC;SAtBY,sBAAsB"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.js b/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.js new file mode 100644 index 0000000000..f8c89f8e2d --- /dev/null +++ b/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.js @@ -0,0 +1,19 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +var AbstractListableElementComponent = /** @class */ (function () { + function AbstractListableElementComponent(listableObject) { + this.listableObject = listableObject; + this.object = listableObject; + } + AbstractListableElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-abstract-object-element', + template: "", + }), + tslib_1.__param(0, Inject('objectElementProvider')), + tslib_1.__metadata("design:paramtypes", [Object]) + ], AbstractListableElementComponent); + return AbstractListableElementComponent; +}()); +export { AbstractListableElementComponent }; +//# sourceMappingURL=abstract-listable-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.js.map b/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.js.map new file mode 100644 index 0000000000..0b19bed2eb --- /dev/null +++ b/src/app/shared/object-collection/shared/object-collection-element/abstract-listable-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-listable-element.component.js","sourceRoot":"","sources":["abstract-listable-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAOlD;IAEE,0CAA2D,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QACvF,IAAI,CAAC,MAAM,GAAG,cAAmB,CAAC;IACpC,CAAC;IAJU,gCAAgC;QAJ5C,SAAS,CAAC;YACT,QAAQ,EAAE,4BAA4B;YACtC,QAAQ,EAAE,EAAE;SACb,CAAC;QAGoB,mBAAA,MAAM,CAAC,uBAAuB,CAAC,CAAA;;OAFxC,gCAAgC,CAK5C;IAAD,uCAAC;CAAA,AALD,IAKC;SALY,gCAAgC"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/pool-task-my-dspace-result.model.js b/src/app/shared/object-collection/shared/pool-task-my-dspace-result.model.js new file mode 100644 index 0000000000..566deece9c --- /dev/null +++ b/src/app/shared/object-collection/shared/pool-task-my-dspace-result.model.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { PoolTask } from '../../../core/tasks/models/pool-task-object.model'; +import { SearchResult } from '../../../+search-page/search-result.model'; +import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type'; +import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator'; +/** + * Represents a search result object of a PoolTask object + */ +var PoolTaskMyDSpaceResult = /** @class */ (function (_super) { + tslib_1.__extends(PoolTaskMyDSpaceResult, _super); + function PoolTaskMyDSpaceResult() { + return _super !== null && _super.apply(this, arguments) || this; + } + PoolTaskMyDSpaceResult = tslib_1.__decorate([ + searchResultFor(PoolTask, MyDSpaceConfigurationValueType.Workflow) + ], PoolTaskMyDSpaceResult); + return PoolTaskMyDSpaceResult; +}(SearchResult)); +export { PoolTaskMyDSpaceResult }; +//# sourceMappingURL=pool-task-my-dspace-result.model.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/pool-task-my-dspace-result.model.js.map b/src/app/shared/object-collection/shared/pool-task-my-dspace-result.model.js.map new file mode 100644 index 0000000000..772d083f47 --- /dev/null +++ b/src/app/shared/object-collection/shared/pool-task-my-dspace-result.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pool-task-my-dspace-result.model.js","sourceRoot":"","sources":["pool-task-my-dspace-result.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mDAAmD,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6DAA6D,CAAC;AAC7G,OAAO,EAAE,eAAe,EAAE,MAAM,sEAAsE,CAAC;AAEvG;;GAEG;AAEH;IAA4C,kDAAsB;IAAlE;;IACA,CAAC;IADY,sBAAsB;QADlC,eAAe,CAAC,QAAQ,EAAE,8BAA8B,CAAC,QAAQ,CAAC;OACtD,sBAAsB,CAClC;IAAD,6BAAC;CAAA,AADD,CAA4C,YAAY,GACvD;SADY,sBAAsB"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.js b/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.js new file mode 100644 index 0000000000..9821fe54d8 --- /dev/null +++ b/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { Workflowitem } from '../../../core/submission/models/workflowitem.model'; +import { SearchResult } from '../../../+search-page/search-result.model'; +import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type'; +import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator'; +/** + * Represents a search result object of a Workflowitem object + */ +var WorkflowitemMyDSpaceResult = /** @class */ (function (_super) { + tslib_1.__extends(WorkflowitemMyDSpaceResult, _super); + function WorkflowitemMyDSpaceResult() { + return _super !== null && _super.apply(this, arguments) || this; + } + WorkflowitemMyDSpaceResult = tslib_1.__decorate([ + searchResultFor(Workflowitem, MyDSpaceConfigurationValueType.Workspace) + ], WorkflowitemMyDSpaceResult); + return WorkflowitemMyDSpaceResult; +}(SearchResult)); +export { WorkflowitemMyDSpaceResult }; +//# sourceMappingURL=workflowitem-my-dspace-result.model.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.js.map b/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.js.map new file mode 100644 index 0000000000..8408bec1b3 --- /dev/null +++ b/src/app/shared/object-collection/shared/workflowitem-my-dspace-result.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workflowitem-my-dspace-result.model.js","sourceRoot":"","sources":["workflowitem-my-dspace-result.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6DAA6D,CAAC;AAC7G,OAAO,EAAE,eAAe,EAAE,MAAM,sEAAsE,CAAC;AAEvG;;GAEG;AAEH;IAAgD,sDAA0B;IAA1E;;IACA,CAAC;IADY,0BAA0B;QADtC,eAAe,CAAC,YAAY,EAAE,8BAA8B,CAAC,SAAS,CAAC;OAC3D,0BAA0B,CACtC;IAAD,iCAAC;CAAA,AADD,CAAgD,YAAY,GAC3D;SADY,0BAA0B"} \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.js b/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.js new file mode 100644 index 0000000000..356ec01517 --- /dev/null +++ b/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { Workspaceitem } from '../../../core/submission/models/workspaceitem.model'; +import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type'; +import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator'; +import { SearchResult } from '../../../+search-page/search-result.model'; +/** + * Represents a search result object of a Workspaceitem object + */ +var WorkspaceitemMyDSpaceResult = /** @class */ (function (_super) { + tslib_1.__extends(WorkspaceitemMyDSpaceResult, _super); + function WorkspaceitemMyDSpaceResult() { + return _super !== null && _super.apply(this, arguments) || this; + } + WorkspaceitemMyDSpaceResult = tslib_1.__decorate([ + searchResultFor(Workspaceitem, MyDSpaceConfigurationValueType.Workspace) + ], WorkspaceitemMyDSpaceResult); + return WorkspaceitemMyDSpaceResult; +}(SearchResult)); +export { WorkspaceitemMyDSpaceResult }; +//# sourceMappingURL=workspaceitem-my-dspace-result.model.js.map \ No newline at end of file diff --git a/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.js.map b/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.js.map new file mode 100644 index 0000000000..bcb9caad6f --- /dev/null +++ b/src/app/shared/object-collection/shared/workspaceitem-my-dspace-result.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitem-my-dspace-result.model.js","sourceRoot":"","sources":["workspaceitem-my-dspace-result.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAC;AACpF,OAAO,EAAE,8BAA8B,EAAE,MAAM,6DAA6D,CAAC;AAC7G,OAAO,EAAE,eAAe,EAAE,MAAM,sEAAsE,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAEzE;;GAEG;AAEH;IAAiD,uDAA2B;IAA5E;;IACA,CAAC;IADY,2BAA2B;QADvC,eAAe,CAAC,aAAa,EAAE,8BAA8B,CAAC,SAAS,CAAC;OAC5D,2BAA2B,CACvC;IAAD,kCAAC;CAAA,AADD,CAAiD,YAAY,GAC5D;SADY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.js b/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.js new file mode 100644 index 0000000000..1711e664be --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.js @@ -0,0 +1,58 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { find } from 'rxjs/operators'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { isNotUndefined } from '../../../empty.util'; +import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model'; +import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/claimed-task-my-dspace-result.model'; +import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component'; +import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; +import { SetViewMode } from '../../../view-mode'; +/** + * This component renders claimed task object for the mydspace result in the detail view. + */ +var ClaimedMyDSpaceResultDetailElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(ClaimedMyDSpaceResultDetailElementComponent, _super); + function ClaimedMyDSpaceResultDetailElementComponent(listable) { + var _this = _super.call(this, listable) || this; + _this.listable = listable; + /** + * A boolean representing if to show submitter information + */ + _this.showSubmitter = true; + /** + * Represent item's status + */ + _this.status = MyDspaceItemStatusType.VALIDATION; + return _this; + } + /** + * Initialize all instance variables + */ + ClaimedMyDSpaceResultDetailElementComponent.prototype.ngOnInit = function () { + this.initWorkflowItem(this.dso.workflowitem); + }; + /** + * Retrieve workflowitem from result object + */ + ClaimedMyDSpaceResultDetailElementComponent.prototype.initWorkflowItem = function (wfi$) { + var _this = this; + wfi$.pipe(find(function (rd) { return (rd.hasSucceeded && isNotUndefined(rd.payload)); })).subscribe(function (rd) { + _this.workflowitem = rd.payload; + }); + }; + ClaimedMyDSpaceResultDetailElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-claimed-my-dspace-result-detail-element', + styleUrls: ['../my-dspace-result-detail-element.component.scss'], + templateUrl: './claimed-my-dspace-result-detail-element.component.html' + }), + renderElementsFor(ClaimedTaskMyDSpaceResult, SetViewMode.Detail), + renderElementsFor(ClaimedTask, SetViewMode.Detail), + tslib_1.__param(0, Inject('objectElementProvider')), + tslib_1.__metadata("design:paramtypes", [Object]) + ], ClaimedMyDSpaceResultDetailElementComponent); + return ClaimedMyDSpaceResultDetailElementComponent; +}(MyDSpaceResultDetailElementComponent)); +export { ClaimedMyDSpaceResultDetailElementComponent }; +//# sourceMappingURL=claimed-my-dspace-result-detail-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.js.map b/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.js.map new file mode 100644 index 0000000000..959aee8281 --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"claimed-my-dspace-result-detail-element.component.js","sourceRoot":"","sources":["claimed-my-dspace-result-detail-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAG5F,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uEAAuE,CAAC;AAClH,OAAO,EAAE,oCAAoC,EAAE,MAAM,8CAA8C,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,mFAAmF,CAAC;AAC3H,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AASH;IAAiE,uEAA4E;IAiB3I,qDAAoD,QAAwB;QAA5E,YACE,kBAAM,QAAQ,CAAC,SAChB;QAFmD,cAAQ,GAAR,QAAQ,CAAgB;QAf5E;;WAEG;QACI,mBAAa,GAAG,IAAI,CAAC;QAE5B;;WAEG;QACI,YAAM,GAAG,sBAAsB,CAAC,UAAU,CAAC;;IASlD,CAAC;IAED;;OAEG;IACH,8DAAQ,GAAR;QACE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,YAAoD,CAAC,CAAC;IACvF,CAAC;IAED;;OAEG;IACH,sEAAgB,GAAhB,UAAiB,IAA0C;QAA3D,iBAMC;QALC,IAAI,CAAC,IAAI,CACP,IAAI,CAAC,UAAC,EAA4B,IAAK,OAAA,CAAC,EAAE,CAAC,YAAY,IAAI,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAA/C,CAA+C,CAAC,CACxF,CAAC,SAAS,CAAC,UAAC,EAA4B;YACvC,KAAI,CAAC,YAAY,GAAG,EAAE,CAAC,OAAO,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IArCU,2CAA2C;QARvD,SAAS,CAAC;YACT,QAAQ,EAAE,4CAA4C;YACtD,SAAS,EAAE,CAAC,mDAAmD,CAAC;YAChE,WAAW,EAAE,0DAA0D;SACxE,CAAC;QAED,iBAAiB,CAAC,yBAAyB,EAAE,WAAW,CAAC,MAAM,CAAC;QAChE,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC;QAkBpC,mBAAA,MAAM,CAAC,uBAAuB,CAAC,CAAA;;OAjBjC,2CAA2C,CAuCvD;IAAD,kDAAC;CAAA,AAvCD,CAAiE,oCAAoC,GAuCpG;SAvCY,2CAA2C"} \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component.js b/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component.js new file mode 100644 index 0000000000..6e433a98cc --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component.js @@ -0,0 +1,54 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Metadata } from '../../../../../core/shared/metadata.utils'; +import { MyDSpaceResult } from '../../../../../+my-dspace-page/my-dspace-result.model'; +import { Item } from '../../../../../core/shared/item.model'; +/** + * This component show values for the given item metadata + */ +var ItemDetailPreviewFieldComponent = /** @class */ (function () { + function ItemDetailPreviewFieldComponent() { + } + /** + * Gets all matching metadata string values from hitHighlights or dso metadata, preferring hitHighlights. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @returns {string[]} the matching string values or an empty array. + */ + ItemDetailPreviewFieldComponent.prototype.allMetadataValues = function (keyOrKeys) { + return Metadata.allValues([this.object.hitHighlights, this.item.metadata], keyOrKeys); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], ItemDetailPreviewFieldComponent.prototype, "item", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", MyDSpaceResult) + ], ItemDetailPreviewFieldComponent.prototype, "object", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ItemDetailPreviewFieldComponent.prototype, "label", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ItemDetailPreviewFieldComponent.prototype, "metadata", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ItemDetailPreviewFieldComponent.prototype, "placeholder", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ItemDetailPreviewFieldComponent.prototype, "separator", void 0); + ItemDetailPreviewFieldComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-detail-preview-field', + templateUrl: './item-detail-preview-field.component.html' + }) + ], ItemDetailPreviewFieldComponent); + return ItemDetailPreviewFieldComponent; +}()); +export { ItemDetailPreviewFieldComponent }; +//# sourceMappingURL=item-detail-preview-field.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component.js.map b/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component.js.map new file mode 100644 index 0000000000..c395081f8b --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-detail-preview-field.component.js","sourceRoot":"","sources":["item-detail-preview-field.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAE7D;;GAEG;AAKH;IAAA;IAyCA,CAAC;IATC;;;;;OAKG;IACH,2DAAiB,GAAjB,UAAkB,SAA4B;QAC5C,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IACxF,CAAC;IAnCQ;QAAR,KAAK,EAAE;0CAAO,IAAI;iEAAC;IAKX;QAAR,KAAK,EAAE;0CAAS,cAAc;mEAAM;IAK5B;QAAR,KAAK,EAAE;;kEAAe;IAKd;QAAR,KAAK,EAAE;;qEAA6B;IAK5B;QAAR,KAAK,EAAE;;wEAAqB;IAKpB;QAAR,KAAK,EAAE;;sEAAmB;IA9BhB,+BAA+B;QAJ3C,SAAS,CAAC;YACT,QAAQ,EAAE,8BAA8B;YACxC,WAAW,EAAE,4CAA4C;SAC1D,CAAC;OACW,+BAA+B,CAyC3C;IAAD,sCAAC;CAAA,AAzCD,IAyCC;SAzCY,+BAA+B"} \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component.js b/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component.js new file mode 100644 index 0000000000..fff5288287 --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component.js @@ -0,0 +1,55 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../../core/shared/item.model'; +import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; +import { fadeInOut } from '../../../animations/fade'; +import { MyDSpaceResult } from '../../../../+my-dspace-page/my-dspace-result.model'; +/** + * This component show metadata for the given item object in the detail view. + */ +var ItemDetailPreviewComponent = /** @class */ (function () { + function ItemDetailPreviewComponent() { + /** + * A boolean representing if to show submitter information + */ + this.showSubmitter = false; + /** + * The value's separator + */ + this.separator = ', '; + } + /** + * Initialize all instance variables + */ + ItemDetailPreviewComponent.prototype.ngOnInit = function () { + this.thumbnail$ = this.item.getThumbnail(); + this.bitstreams$ = this.item.getFiles(); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], ItemDetailPreviewComponent.prototype, "item", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", MyDSpaceResult) + ], ItemDetailPreviewComponent.prototype, "object", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ItemDetailPreviewComponent.prototype, "status", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ItemDetailPreviewComponent.prototype, "showSubmitter", void 0); + ItemDetailPreviewComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-detail-preview', + styleUrls: ['./item-detail-preview.component.scss'], + templateUrl: './item-detail-preview.component.html', + animations: [fadeInOut] + }) + ], ItemDetailPreviewComponent); + return ItemDetailPreviewComponent; +}()); +export { ItemDetailPreviewComponent }; +//# sourceMappingURL=item-detail-preview.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component.js.map b/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component.js.map new file mode 100644 index 0000000000..927239dd37 --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-detail-preview.component.js","sourceRoot":"","sources":["item-detail-preview.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAIjD,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mFAAmF,CAAC;AAC3H,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AAEpF;;GAEG;AAOH;IANA;QAuBE;;WAEG;QACM,kBAAa,GAAG,KAAK,CAAC;QAO/B;;WAEG;QACI,cAAS,GAAG,IAAI,CAAC;IAe1B,CAAC;IARC;;OAEG;IACH,6CAAQ,GAAR;QACE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC1C,CAAC;IAtCQ;QAAR,KAAK,EAAE;0CAAO,IAAI;4DAAC;IAKX;QAAR,KAAK,EAAE;0CAAS,cAAc;8DAAM;IAK5B;QAAR,KAAK,EAAE;;8DAAgC;IAK/B;QAAR,KAAK,EAAE;;qEAAuB;IApBpB,0BAA0B;QANtC,SAAS,CAAC;YACT,QAAQ,EAAE,wBAAwB;YAClC,SAAS,EAAE,CAAC,sCAAsC,CAAC;YACnD,WAAW,EAAE,sCAAsC;YACnD,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC;OACW,0BAA0B,CA6CtC;IAAD,iCAAC;CAAA,AA7CD,IA6CC;SA7CY,0BAA0B"} \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/item-my-dspace-result/item-my-dspace-result-detail-element.component.js b/src/app/shared/object-detail/my-dspace-result-detail-element/item-my-dspace-result/item-my-dspace-result-detail-element.component.js new file mode 100644 index 0000000000..0a918b1fc5 --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/item-my-dspace-result/item-my-dspace-result-detail-element.component.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { ItemMyDSpaceResult } from '../../../object-collection/shared/item-my-dspace-result.model'; +import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component'; +import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; +import { SetViewMode } from '../../../view-mode'; +/** + * This component renders item object for the mydspace result in the detail view. + */ +var ItemMyDSpaceResultDetailElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemMyDSpaceResultDetailElementComponent, _super); + function ItemMyDSpaceResultDetailElementComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * Represent item's status + */ + _this.status = MyDspaceItemStatusType.ARCHIVED; + return _this; + } + ItemMyDSpaceResultDetailElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-workspaceitem-my-dspace-result-detail-element', + styleUrls: ['../my-dspace-result-detail-element.component.scss', './item-my-dspace-result-detail-element.component.scss'], + templateUrl: './item-my-dspace-result-detail-element.component.html' + }), + renderElementsFor(ItemMyDSpaceResult, SetViewMode.Detail) + ], ItemMyDSpaceResultDetailElementComponent); + return ItemMyDSpaceResultDetailElementComponent; +}(MyDSpaceResultDetailElementComponent)); +export { ItemMyDSpaceResultDetailElementComponent }; +//# sourceMappingURL=item-my-dspace-result-detail-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/item-my-dspace-result/item-my-dspace-result-detail-element.component.js.map b/src/app/shared/object-detail/my-dspace-result-detail-element/item-my-dspace-result/item-my-dspace-result-detail-element.component.js.map new file mode 100644 index 0000000000..f34dce05f6 --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/item-my-dspace-result/item-my-dspace-result-detail-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-my-dspace-result-detail-element.component.js","sourceRoot":"","sources":["item-my-dspace-result-detail-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAG5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,+DAA+D,CAAC;AACnG,OAAO,EAAE,oCAAoC,EAAE,MAAM,8CAA8C,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,mFAAmF,CAAC;AAC3H,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AAQH;IAA8D,oEAA8D;IAP5H;QAAA,qEAcC;QALC;;WAEG;QACI,YAAM,GAAG,sBAAsB,CAAC,QAAQ,CAAC;;IAElD,CAAC;IAPY,wCAAwC;QAPpD,SAAS,CAAC;YACT,QAAQ,EAAE,kDAAkD;YAC5D,SAAS,EAAE,CAAC,mDAAmD,EAAE,uDAAuD,CAAC;YACzH,WAAW,EAAE,uDAAuD;SACrE,CAAC;QAED,iBAAiB,CAAC,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC;OAC7C,wCAAwC,CAOpD;IAAD,+CAAC;CAAA,AAPD,CAA8D,oCAAoC,GAOjG;SAPY,wCAAwC"} \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/my-dspace-result-detail-element.component.js b/src/app/shared/object-detail/my-dspace-result-detail-element/my-dspace-result-detail-element.component.js new file mode 100644 index 0000000000..30aee93f3f --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/my-dspace-result-detail-element.component.js @@ -0,0 +1,47 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; +import { Metadata } from '../../../core/shared/metadata.utils'; +var MyDSpaceResultDetailElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(MyDSpaceResultDetailElementComponent, _super); + /** + * Initialize instance variables + * + * @param {ListableObject} detailable + */ + function MyDSpaceResultDetailElementComponent(detailable) { + var _this = _super.call(this, detailable) || this; + _this.detailable = detailable; + _this.dso = _this.object.indexableObject; + return _this; + } + /** + * Gets all matching metadata string values from hitHighlights or dso metadata, preferring hitHighlights. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @returns {string[]} the matching string values or an empty array. + */ + MyDSpaceResultDetailElementComponent.prototype.allMetadataValues = function (keyOrKeys) { + return Metadata.allValues([this.object.hitHighlights, this.dso.metadata], keyOrKeys); + }; + /** + * Gets the first matching metadata string value from hitHighlights or dso metadata, preferring hitHighlights. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @returns {string} the first matching string value, or `undefined`. + */ + MyDSpaceResultDetailElementComponent.prototype.firstMetadataValue = function (keyOrKeys) { + return Metadata.firstValue([this.object.hitHighlights, this.dso.metadata], keyOrKeys); + }; + MyDSpaceResultDetailElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-my-dspace-result-detail-element', + template: "" + }), + tslib_1.__param(0, Inject('objectElementProvider')), + tslib_1.__metadata("design:paramtypes", [Object]) + ], MyDSpaceResultDetailElementComponent); + return MyDSpaceResultDetailElementComponent; +}(AbstractListableElementComponent)); +export { MyDSpaceResultDetailElementComponent }; +//# sourceMappingURL=my-dspace-result-detail-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/my-dspace-result-detail-element.component.js.map b/src/app/shared/object-detail/my-dspace-result-detail-element/my-dspace-result-detail-element.component.js.map new file mode 100644 index 0000000000..ec36d3548a --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/my-dspace-result-detail-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace-result-detail-element.component.js","sourceRoot":"","sources":["my-dspace-result-detail-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8FAA8F,CAAC;AAGhJ,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAM/D;IAA+G,gEAAmC;IAOhJ;;;;OAIG;IACH,8CAA2D,UAA0B;QAArF,YACE,kBAAM,UAAU,CAAC,SAElB;QAH0D,gBAAU,GAAV,UAAU,CAAgB;QAEnF,KAAI,CAAC,GAAG,GAAG,KAAI,CAAC,MAAM,CAAC,eAAe,CAAC;;IACzC,CAAC;IAED;;;;;OAKG;IACH,gEAAiB,GAAjB,UAAkB,SAA4B;QAC5C,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IACvF,CAAC;IAED;;;;;OAKG;IACH,iEAAkB,GAAlB,UAAmB,SAA4B;QAC7C,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IACxF,CAAC;IAnCU,oCAAoC;QAJhD,SAAS,CAAC;YACT,QAAQ,EAAE,oCAAoC;YAC9C,QAAQ,EAAE,EAAE;SACb,CAAC;QAaoB,mBAAA,MAAM,CAAC,uBAAuB,CAAC,CAAA;;OAZxC,oCAAoC,CAoChD;IAAD,2CAAC;CAAA,AApCD,CAA+G,gCAAgC,GAoC9I;SApCY,oCAAoC"} \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-lement.component.js b/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-lement.component.js new file mode 100644 index 0000000000..8d3777f6b7 --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-lement.component.js @@ -0,0 +1,58 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { find } from 'rxjs/operators'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { isNotUndefined } from '../../../empty.util'; +import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model'; +import { PoolTaskMyDSpaceResult } from '../../../object-collection/shared/pool-task-my-dspace-result.model'; +import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component'; +import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; +import { SetViewMode } from '../../../view-mode'; +/** + * This component renders pool task object for the mydspace result in the detail view. + */ +var PoolMyDSpaceResultDetailElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(PoolMyDSpaceResultDetailElementComponent, _super); + function PoolMyDSpaceResultDetailElementComponent(listable) { + var _this = _super.call(this, listable) || this; + _this.listable = listable; + /** + * A boolean representing if to show submitter information + */ + _this.showSubmitter = true; + /** + * Represent item's status + */ + _this.status = MyDspaceItemStatusType.WAITING_CONTROLLER; + return _this; + } + /** + * Initialize all instance variables + */ + PoolMyDSpaceResultDetailElementComponent.prototype.ngOnInit = function () { + this.initWorkflowItem(this.dso.workflowitem); + }; + /** + * Retrieve workflowitem from result object + */ + PoolMyDSpaceResultDetailElementComponent.prototype.initWorkflowItem = function (wfi$) { + var _this = this; + wfi$.pipe(find(function (rd) { return (rd.hasSucceeded && isNotUndefined(rd.payload)); })).subscribe(function (rd) { + _this.workflowitem = rd.payload; + }); + }; + PoolMyDSpaceResultDetailElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-pool-my-dspace-result-detail-element', + styleUrls: ['../my-dspace-result-detail-element.component.scss'], + templateUrl: './pool-my-dspace-result-detail-element.component.html', + }), + renderElementsFor(PoolTaskMyDSpaceResult, SetViewMode.Detail), + renderElementsFor(PoolTask, SetViewMode.Detail), + tslib_1.__param(0, Inject('objectElementProvider')), + tslib_1.__metadata("design:paramtypes", [Object]) + ], PoolMyDSpaceResultDetailElementComponent); + return PoolMyDSpaceResultDetailElementComponent; +}(MyDSpaceResultDetailElementComponent)); +export { PoolMyDSpaceResultDetailElementComponent }; +//# sourceMappingURL=pool-my-dspace-result-detail-lement.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-lement.component.js.map b/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-lement.component.js.map new file mode 100644 index 0000000000..dd1a5f8d12 --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-lement.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pool-my-dspace-result-detail-lement.component.js","sourceRoot":"","sources":["pool-my-dspace-result-detail-lement.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAE5F,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,QAAQ,EAAE,MAAM,sDAAsD,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oEAAoE,CAAC;AAC5G,OAAO,EAAE,oCAAoC,EAAE,MAAM,8CAA8C,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,mFAAmF,CAAC;AAC3H,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AASH;IAA8D,oEAAsE;IAiBlI,kDAAoD,QAAwB;QAA5E,YACE,kBAAM,QAAQ,CAAC,SAChB;QAFmD,cAAQ,GAAR,QAAQ,CAAgB;QAf5E;;WAEG;QACI,mBAAa,GAAG,IAAI,CAAC;QAE5B;;WAEG;QACI,YAAM,GAAG,sBAAsB,CAAC,kBAAkB,CAAC;;IAS1D,CAAC;IAED;;OAEG;IACH,2DAAQ,GAAR;QACE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,YAAoD,CAAC,CAAC;IACvF,CAAC;IAED;;OAEG;IACH,mEAAgB,GAAhB,UAAiB,IAA0C;QAA3D,iBAMC;QALC,IAAI,CAAC,IAAI,CACP,IAAI,CAAC,UAAC,EAA4B,IAAK,OAAA,CAAC,EAAE,CAAC,YAAY,IAAI,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAA/C,CAA+C,CAAC,CACxF,CAAC,SAAS,CAAC,UAAC,EAA4B;YACvC,KAAI,CAAC,YAAY,GAAG,EAAE,CAAC,OAAO,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IArCU,wCAAwC;QARpD,SAAS,CAAC;YACT,QAAQ,EAAE,yCAAyC;YACnD,SAAS,EAAE,CAAC,mDAAmD,CAAC;YAChE,WAAW,EAAE,uDAAuD;SACrE,CAAC;QAED,iBAAiB,CAAC,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAAC;QAC7D,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC;QAkBjC,mBAAA,MAAM,CAAC,uBAAuB,CAAC,CAAA;;OAjBjC,wCAAwC,CAuCpD;IAAD,+CAAC;CAAA,AAvCD,CAA8D,oCAAoC,GAuCjG;SAvCY,wCAAwC"} \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.js b/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.js new file mode 100644 index 0000000000..1b1540810e --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.js @@ -0,0 +1,54 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { WorkflowitemMyDSpaceResult } from '../../../object-collection/shared/workflowitem-my-dspace-result.model'; +import { Workflowitem } from '../../../../core/submission/models/workflowitem.model'; +import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component'; +import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; +import { find } from 'rxjs/operators'; +import { isNotUndefined } from '../../../empty.util'; +import { SetViewMode } from '../../../view-mode'; +/** + * This component renders workflowitem object for the mydspace result in the detail view. + */ +var WorkflowitemMyDSpaceResultDetailElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(WorkflowitemMyDSpaceResultDetailElementComponent, _super); + function WorkflowitemMyDSpaceResultDetailElementComponent(listable) { + var _this = _super.call(this, listable) || this; + _this.listable = listable; + /** + * Represent item's status + */ + _this.status = MyDspaceItemStatusType.WORKFLOW; + return _this; + } + /** + * Initialize all instance variables + */ + WorkflowitemMyDSpaceResultDetailElementComponent.prototype.ngOnInit = function () { + this.initItem(this.dso.item); + }; + /** + * Retrieve item from result object + */ + WorkflowitemMyDSpaceResultDetailElementComponent.prototype.initItem = function (item$) { + var _this = this; + item$.pipe(find(function (rd) { return rd.hasSucceeded && isNotUndefined(rd.payload); })).subscribe(function (rd) { + _this.item = rd.payload; + }); + }; + WorkflowitemMyDSpaceResultDetailElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-workflowitem-my-dspace-result-detail-element', + styleUrls: ['../my-dspace-result-detail-element.component.scss'], + templateUrl: './workflowitem-my-dspace-result-detail-element.component.html', + }), + renderElementsFor(WorkflowitemMyDSpaceResult, SetViewMode.Detail), + renderElementsFor(Workflowitem, SetViewMode.Detail), + tslib_1.__param(0, Inject('objectElementProvider')), + tslib_1.__metadata("design:paramtypes", [Object]) + ], WorkflowitemMyDSpaceResultDetailElementComponent); + return WorkflowitemMyDSpaceResultDetailElementComponent; +}(MyDSpaceResultDetailElementComponent)); +export { WorkflowitemMyDSpaceResultDetailElementComponent }; +//# sourceMappingURL=workflowitem-my-dspace-result-detail-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.js.map b/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.js.map new file mode 100644 index 0000000000..6cd3063f44 --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workflowitem-my-dspace-result-detail-element.component.js","sourceRoot":"","sources":["workflowitem-my-dspace-result-detail-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAI5F,OAAO,EAAE,0BAA0B,EAAE,MAAM,uEAAuE,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,MAAM,uDAAuD,CAAC;AACrF,OAAO,EAAE,oCAAoC,EAAE,MAAM,8CAA8C,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,mFAAmF,CAAC;AAG3H,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AASH;IAAsE,4EAA8E;IAYlJ,0DAAoD,QAAwB;QAA5E,YACE,kBAAM,QAAQ,CAAC,SAChB;QAFmD,cAAQ,GAAR,QAAQ,CAAgB;QAL5E;;WAEG;QACI,YAAM,GAAG,sBAAsB,CAAC,QAAQ,CAAC;;IAIhD,CAAC;IAED;;OAEG;IACH,mEAAQ,GAAR;QACE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAoC,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,mEAAQ,GAAR,UAAS,KAAmC;QAA5C,iBAMC;QALC,KAAK,CAAC,IAAI,CACR,IAAI,CAAC,UAAC,EAAoB,IAAK,OAAA,EAAE,CAAC,YAAY,IAAI,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,EAA7C,CAA6C,CAAC,CAC9E,CAAC,SAAS,CAAC,UAAC,EAAoB;YAC/B,KAAI,CAAC,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IAhCU,gDAAgD;QAR5D,SAAS,CAAC;YACT,QAAQ,EAAE,iDAAiD;YAC3D,SAAS,EAAE,CAAC,mDAAmD,CAAC;YAChE,WAAW,EAAE,+DAA+D;SAC7E,CAAC;QAED,iBAAiB,CAAC,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAAC;QACjE,iBAAiB,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC;QAarC,mBAAA,MAAM,CAAC,uBAAuB,CAAC,CAAA;;OAZjC,gDAAgD,CAkC5D;IAAD,uDAAC;CAAA,AAlCD,CAAsE,oCAAoC,GAkCzG;SAlCY,gDAAgD"} \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.js b/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.js new file mode 100644 index 0000000000..6455e5ebfa --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.js @@ -0,0 +1,54 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { find } from 'rxjs/operators'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { Workspaceitem } from '../../../../core/submission/models/workspaceitem.model'; +import { WorkspaceitemMyDSpaceResult } from '../../../object-collection/shared/workspaceitem-my-dspace-result.model'; +import { isNotUndefined } from '../../../empty.util'; +import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component'; +import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; +import { SetViewMode } from '../../../view-mode'; +/** + * This component renders workspaceitem object for the mydspace result in the detail view. + */ +var WorkspaceitemMyDSpaceResultDetailElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(WorkspaceitemMyDSpaceResultDetailElementComponent, _super); + function WorkspaceitemMyDSpaceResultDetailElementComponent(listable) { + var _this = _super.call(this, listable) || this; + _this.listable = listable; + /** + * Represent item's status + */ + _this.status = MyDspaceItemStatusType.WORKSPACE; + return _this; + } + /** + * Initialize all instance variables + */ + WorkspaceitemMyDSpaceResultDetailElementComponent.prototype.ngOnInit = function () { + this.initItem(this.dso.item); + }; + /** + * Retrieve item from result object + */ + WorkspaceitemMyDSpaceResultDetailElementComponent.prototype.initItem = function (item$) { + var _this = this; + item$.pipe(find(function (rd) { return rd.hasSucceeded && isNotUndefined(rd.payload); })).subscribe(function (rd) { + _this.item = rd.payload; + }); + }; + WorkspaceitemMyDSpaceResultDetailElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-workspaceitem-my-dspace-result-detail-element', + styleUrls: ['../my-dspace-result-detail-element.component.scss', './workspaceitem-my-dspace-result-detail-element.component.scss'], + templateUrl: './workspaceitem-my-dspace-result-detail-element.component.html', + }), + renderElementsFor(WorkspaceitemMyDSpaceResult, SetViewMode.Detail), + renderElementsFor(Workspaceitem, SetViewMode.Detail), + tslib_1.__param(0, Inject('objectElementProvider')), + tslib_1.__metadata("design:paramtypes", [Object]) + ], WorkspaceitemMyDSpaceResultDetailElementComponent); + return WorkspaceitemMyDSpaceResultDetailElementComponent; +}(MyDSpaceResultDetailElementComponent)); +export { WorkspaceitemMyDSpaceResultDetailElementComponent }; +//# sourceMappingURL=workspaceitem-my-dspace-result-detail-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.js.map b/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.js.map new file mode 100644 index 0000000000..fa3dc94d56 --- /dev/null +++ b/src/app/shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitem-my-dspace-result-detail-element.component.js","sourceRoot":"","sources":["workspaceitem-my-dspace-result-detail-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAE5F,OAAO,EAAE,aAAa,EAAE,MAAM,wDAAwD,CAAC;AACvF,OAAO,EAAE,2BAA2B,EAAE,MAAM,wEAAwE,CAAC;AAGrH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,oCAAoC,EAAE,MAAM,8CAA8C,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,mFAAmF,CAAC;AAC3H,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AASH;IAAuE,6EAAgF;IAYrJ,2DAAoD,QAAwB;QAA5E,YACE,kBAAM,QAAQ,CAAC,SAChB;QAFmD,cAAQ,GAAR,QAAQ,CAAgB;QAL5E;;WAEG;QACH,YAAM,GAAG,sBAAsB,CAAC,SAAS,CAAC;;IAI1C,CAAC;IAED;;OAEG;IACH,oEAAQ,GAAR;QACE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAoC,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,oEAAQ,GAAR,UAAS,KAAmC;QAA5C,iBAMC;QALC,KAAK,CAAC,IAAI,CACR,IAAI,CAAC,UAAC,EAAoB,IAAK,OAAA,EAAE,CAAC,YAAY,IAAI,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,EAA7C,CAA6C,CAAC,CAC9E,CAAC,SAAS,CAAC,UAAC,EAAoB;YAC/B,KAAI,CAAC,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IAhCU,iDAAiD;QAR7D,SAAS,CAAC;YACT,QAAQ,EAAE,kDAAkD;YAC5D,SAAS,EAAE,CAAC,mDAAmD,EAAE,gEAAgE,CAAC;YAClI,WAAW,EAAE,gEAAgE;SAC9E,CAAC;QAED,iBAAiB,CAAC,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAAC;QAClE,iBAAiB,CAAC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC;QAatC,mBAAA,MAAM,CAAC,uBAAuB,CAAC,CAAA;;OAZjC,iDAAiD,CAiC7D;IAAD,wDAAC;CAAA,AAjCD,CAAuE,oCAAoC,GAiC1G;SAjCY,iDAAiD"} \ No newline at end of file diff --git a/src/app/shared/object-detail/object-detail.component.js b/src/app/shared/object-detail/object-detail.component.js new file mode 100644 index 0000000000..9fff998881 --- /dev/null +++ b/src/app/shared/object-detail/object-detail.component.js @@ -0,0 +1,160 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; +import { SortOptions } from '../../core/cache/models/sort-options.model'; +import { RemoteData } from '../../core/data/remote-data'; +import { fadeIn } from '../animations/fade'; +import { PaginationComponentOptions } from '../pagination/pagination-component-options.model'; +/** + * This component renders a paginated set of results in the detail view. + */ +var ObjectDetailComponent = /** @class */ (function () { + function ObjectDetailComponent() { + /** + * A boolean representing if to hide gear pagination icon + */ + this.hideGear = true; + /** + * A boolean representing if to hide pagination when there is only a page + */ + this.hidePagerWhenSinglePage = true; + /** + * Option for hiding the pagination detail + */ + this.hidePaginationDetail = true; + /** + * An event fired when the page is changed. + * Event's payload equals to the newly selected page. + */ + this.change = new EventEmitter(); + /** + * An event fired when the page is changed. + * Event's payload equals to the newly selected page. + */ + this.pageChange = new EventEmitter(); + /** + * An event fired when the page wsize is changed. + * Event's payload equals to the newly selected page size. + */ + this.pageSizeChange = new EventEmitter(); + /** + * An event fired when the sort direction is changed. + * Event's payload equals to the newly selected sort direction. + */ + this.sortDirectionChange = new EventEmitter(); + /** + * An event fired when the pagination is changed. + * Event's payload equals to the newly selected sort direction. + */ + this.paginationChange = new EventEmitter(); + /** + * An event fired when the sort field is changed. + * Event's payload equals to the newly selected sort field. + */ + this.sortFieldChange = new EventEmitter(); + } + Object.defineProperty(ObjectDetailComponent.prototype, "objects", { + /** + * Getter for _objects property + */ + get: function () { + return this._objects; + }, + /** + * Setter for _objects property + * @param objects + */ + set: function (objects) { + this._objects = objects; + }, + enumerable: true, + configurable: true + }); + /** + * Emit pageChange event + */ + ObjectDetailComponent.prototype.onPageChange = function (event) { + this.pageChange.emit(event); + }; + /** + * Emit pageSizeChange event + */ + ObjectDetailComponent.prototype.onPageSizeChange = function (event) { + this.pageSizeChange.emit(event); + }; + /** + * Emit sortDirectionChange event + */ + ObjectDetailComponent.prototype.onSortDirectionChange = function (event) { + this.sortDirectionChange.emit(event); + }; + /** + * Emit sortFieldChange event + */ + ObjectDetailComponent.prototype.onSortFieldChange = function (event) { + this.sortFieldChange.emit(event); + }; + /** + * Emit paginationChange event + */ + ObjectDetailComponent.prototype.onPaginationChange = function (event) { + this.paginationChange.emit(event); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", PaginationComponentOptions) + ], ObjectDetailComponent.prototype, "config", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SortOptions) + ], ObjectDetailComponent.prototype, "sortConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ObjectDetailComponent.prototype, "hideGear", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ObjectDetailComponent.prototype, "hidePagerWhenSinglePage", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", RemoteData), + tslib_1.__metadata("design:paramtypes", [RemoteData]) + ], ObjectDetailComponent.prototype, "objects", null); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectDetailComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectDetailComponent.prototype, "pageChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectDetailComponent.prototype, "pageSizeChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectDetailComponent.prototype, "sortDirectionChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectDetailComponent.prototype, "paginationChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectDetailComponent.prototype, "sortFieldChange", void 0); + ObjectDetailComponent = tslib_1.__decorate([ + Component({ + changeDetection: ChangeDetectionStrategy.Default, + encapsulation: ViewEncapsulation.Emulated, + selector: 'ds-object-detail', + styleUrls: ['./object-detail.component.scss'], + templateUrl: './object-detail.component.html', + animations: [fadeIn] + }) + ], ObjectDetailComponent); + return ObjectDetailComponent; +}()); +export { ObjectDetailComponent }; +//# sourceMappingURL=object-detail.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-detail/object-detail.component.js.map b/src/app/shared/object-detail/object-detail.component.js.map new file mode 100644 index 0000000000..8c88dcdf08 --- /dev/null +++ b/src/app/shared/object-detail/object-detail.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-detail.component.js","sourceRoot":"","sources":["object-detail.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,KAAK,EACL,MAAM,EACN,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAiB,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAGxF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAE9F;;GAEG;AASH;IARA;QAoBE;;WAEG;QACM,aAAQ,GAAG,IAAI,CAAC;QAEzB;;WAEG;QACM,4BAAuB,GAAG,IAAI,CAAC;QAsBxC;;WAEG;QACI,yBAAoB,GAAG,IAAI,CAAC;QAEnC;;;WAGG;QACO,WAAM,GAGX,IAAI,YAAY,EAGjB,CAAC;QAEL;;;WAGG;QACO,eAAU,GAAyB,IAAI,YAAY,EAAU,CAAC;QAExE;;;WAGG;QACO,mBAAc,GAAyB,IAAI,YAAY,EAAU,CAAC;QAE5E;;;WAGG;QACO,wBAAmB,GAAgC,IAAI,YAAY,EAAiB,CAAC;QAE/F;;;WAGG;QACO,qBAAgB,GAAgC,IAAI,YAAY,EAAO,CAAC;QAElF;;;WAGG;QACO,oBAAe,GAAyB,IAAI,YAAY,EAAU,CAAC;IAqC/E,CAAC;IA7FU,sBAAI,0CAAO;QAIpB;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;QAbD;;;WAGG;aACM,UAAY,OAAkD;YACrE,IAAI,CAAC,QAAQ,GAAG,OAAO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CAAC,QAAQ;YACzC,QAAQ,EAAE,kBAAkB;YAC5B,SAAS,EAAE,CAAE,gCAAgC,CAAE;YAC/C,WAAW,EAAE,gCAAgC;YAC7C,UAAU,EAAE,CAAC,MAAM,CAAC;SACrB,CAAC;OACW,qBAAqB,CA4HjC;IAAD,4BAAC;CAAA,AA5HD,IA4HC;SA5HY,qBAAqB"} \ No newline at end of file diff --git a/src/app/shared/object-detail/wrapper-detail-element/wrapper-detail-element.component.js b/src/app/shared/object-detail/wrapper-detail-element/wrapper-detail-element.component.js new file mode 100644 index 0000000000..873dc1050e --- /dev/null +++ b/src/app/shared/object-detail/wrapper-detail-element/wrapper-detail-element.component.js @@ -0,0 +1,49 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector, Input } from '@angular/core'; +import { rendersDSOType } from '../../object-collection/shared/dso-element-decorator'; +import { SetViewMode } from '../../view-mode'; +/** + * This component renders a wrapper for an object in the detail view. + */ +var WrapperDetailElementComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {Injector} injector + */ + function WrapperDetailElementComponent(injector) { + this.injector = injector; + } + /** + * Initialize injector + */ + WrapperDetailElementComponent.prototype.ngOnInit = function () { + var _this = this; + this.objectInjector = Injector.create({ + providers: [{ provide: 'objectElementProvider', useFactory: function () { return (_this.object); }, deps: [] }], + parent: this.injector + }); + }; + /** + * Return class name for the object to inject + */ + WrapperDetailElementComponent.prototype.getDetailElement = function () { + var f = this.object.constructor; + return rendersDSOType(f, SetViewMode.Detail); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], WrapperDetailElementComponent.prototype, "object", void 0); + WrapperDetailElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-wrapper-detail-element', + styleUrls: ['./wrapper-detail-element.component.scss'], + templateUrl: './wrapper-detail-element.component.html' + }), + tslib_1.__metadata("design:paramtypes", [Injector]) + ], WrapperDetailElementComponent); + return WrapperDetailElementComponent; +}()); +export { WrapperDetailElementComponent }; +//# sourceMappingURL=wrapper-detail-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-detail/wrapper-detail-element/wrapper-detail-element.component.js.map b/src/app/shared/object-detail/wrapper-detail-element/wrapper-detail-element.component.js.map new file mode 100644 index 0000000000..76abcc04ad --- /dev/null +++ b/src/app/shared/object-detail/wrapper-detail-element/wrapper-detail-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrapper-detail-element.component.js","sourceRoot":"","sources":["wrapper-detail-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAInE,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;AAEtF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;GAEG;AAMH;IAYE;;;;OAIG;IACH,uCAAoB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IACtC,CAAC;IAED;;OAEG;IACH,gDAAQ,GAAR;QAAA,iBAMC;QALC,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;YACpC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,cAAM,OAAA,CAAC,KAAI,CAAC,MAAM,CAAC,EAAb,CAAa,EAAE,IAAI,EAAC,EAAE,EAAE,CAAC;YAC3F,MAAM,EAAE,IAAI,CAAC,QAAQ;SACtB,CAAC,CAAC;IAEL,CAAC;IAED;;OAEG;IACH,wDAAgB,GAAhB;QACE,IAAM,CAAC,GAAuC,IAAI,CAAC,MAAM,CAAC,WAAiD,CAAC;QAC5G,OAAO,cAAc,CAAC,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IAhCQ;QAAR,KAAK,EAAE;;iEAAwB;IALrB,6BAA6B;QALzC,SAAS,CAAC;YACT,QAAQ,EAAE,2BAA2B;YACrC,SAAS,EAAE,CAAC,yCAAyC,CAAC;YACtD,WAAW,EAAE,yCAAyC;SACvD,CAAC;iDAkB8B,QAAQ;OAjB3B,6BAA6B,CAsCzC;IAAD,oCAAC;CAAA,AAtCD,IAsCC;SAtCY,6BAA6B"} \ No newline at end of file diff --git a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.js b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.js new file mode 100644 index 0000000000..7d1f85f71b --- /dev/null +++ b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { Collection } from '../../../core/shared/collection.model'; +import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator'; +import { SetViewMode } from '../../view-mode'; +import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; +var CollectionGridElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(CollectionGridElementComponent, _super); + function CollectionGridElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + CollectionGridElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-collection-grid-element', + styleUrls: ['./collection-grid-element.component.scss'], + templateUrl: './collection-grid-element.component.html' + }), + renderElementsFor(Collection, SetViewMode.Grid) + ], CollectionGridElementComponent); + return CollectionGridElementComponent; +}(AbstractListableElementComponent)); +export { CollectionGridElementComponent }; +//# sourceMappingURL=collection-grid-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.js.map b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.js.map new file mode 100644 index 0000000000..4afdf2dca8 --- /dev/null +++ b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collection-grid-element.component.js","sourceRoot":"","sources":["collection-grid-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAC,MAAM,sDAAsD,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,8FAA8F,CAAC;AAShJ;IAAoD,0DAA4C;IAAhG;;IAAkG,CAAC;IAAtF,8BAA8B;QAP1C,SAAS,CAAC;YACT,QAAQ,EAAE,4BAA4B;YACtC,SAAS,EAAE,CAAC,0CAA0C,CAAC;YACvD,WAAW,EAAE,0CAA0C;SACxD,CAAC;QAED,iBAAiB,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC;OACnC,8BAA8B,CAAwD;IAAD,qCAAC;CAAA,AAAnG,CAAoD,gCAAgC,GAAe;SAAtF,8BAA8B"} \ No newline at end of file diff --git a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.js b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.js new file mode 100644 index 0000000000..8c2fb90c68 --- /dev/null +++ b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { Community } from '../../../core/shared/community.model'; +import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; +import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator'; +import { SetViewMode } from '../../view-mode'; +var CommunityGridElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(CommunityGridElementComponent, _super); + function CommunityGridElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommunityGridElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-community-grid-element', + styleUrls: ['./community-grid-element.component.scss'], + templateUrl: './community-grid-element.component.html' + }), + renderElementsFor(Community, SetViewMode.Grid) + ], CommunityGridElementComponent); + return CommunityGridElementComponent; +}(AbstractListableElementComponent)); +export { CommunityGridElementComponent }; +//# sourceMappingURL=community-grid-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.js.map b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.js.map new file mode 100644 index 0000000000..29c21bcb06 --- /dev/null +++ b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-grid-element.component.js","sourceRoot":"","sources":["community-grid-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,gCAAgC,EAAE,MAAM,8FAA8F,CAAC;AAChJ,OAAO,EAAE,iBAAiB,EAAC,MAAM,sDAAsD,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAS9C;IAAmD,yDAA2C;IAA9F;;IAAgG,CAAC;IAApF,6BAA6B;QAPzC,SAAS,CAAC;YACT,QAAQ,EAAE,2BAA2B;YACrC,SAAS,EAAE,CAAC,yCAAyC,CAAC;YACtD,WAAW,EAAE,yCAAyC;SACvD,CAAC;QAED,iBAAiB,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC;OAClC,6BAA6B,CAAuD;IAAD,oCAAC;CAAA,AAAjG,CAAmD,gCAAgC,GAAc;SAApF,6BAA6B"} \ No newline at end of file diff --git a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.js b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.js new file mode 100644 index 0000000000..7b44ef64ae --- /dev/null +++ b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.js @@ -0,0 +1,34 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Bitstream } from '../../../core/shared/bitstream.model'; +/** + * This component renders a given Bitstream as a thumbnail. + * One input parameter of type Bitstream is expected. + * If no Bitstream is provided, a holderjs image will be rendered instead. + */ +var GridThumbnailComponent = /** @class */ (function () { + function GridThumbnailComponent() { + this.data = {}; + /** + * The default 'holder.js' image + */ + this.holderSource = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjYwIiBoZWlnaHQ9IjE4MCIgdmlld0JveD0iMCAwIDI2MCAxODAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjwhLS0KU291cmNlIFVSTDogaG9sZGVyLmpzLzEwMCV4MTgwL3RleHQ6Tm8gVGh1bWJuYWlsCkNyZWF0ZWQgd2l0aCBIb2xkZXIuanMgMi42LjAuCkxlYXJuIG1vcmUgYXQgaHR0cDovL2hvbGRlcmpzLmNvbQooYykgMjAxMi0yMDE1IEl2YW4gTWFsb3BpbnNreSAtIGh0dHA6Ly9pbXNreS5jbwotLT48ZGVmcz48c3R5bGUgdHlwZT0idGV4dC9jc3MiPjwhW0NEQVRBWyNob2xkZXJfMTVmNzJmMmFlMGIgdGV4dCB7IGZpbGw6I0FBQUFBQTtmb250LXdlaWdodDpib2xkO2ZvbnQtZmFtaWx5OkFyaWFsLCBIZWx2ZXRpY2EsIE9wZW4gU2Fucywgc2Fucy1zZXJpZiwgbW9ub3NwYWNlO2ZvbnQtc2l6ZToxM3B0IH0gXV0+PC9zdHlsZT48L2RlZnM+PGcgaWQ9ImhvbGRlcl8xNWY3MmYyYWUwYiI+PHJlY3Qgd2lkdGg9IjI2MCIgaGVpZ2h0PSIxODAiIGZpbGw9IiNFRUVFRUUiLz48Zz48dGV4dCB4PSI3Mi4yNDIxODc1IiB5PSI5NiI+Tm8gVGh1bWJuYWlsPC90ZXh0PjwvZz48L2c+PC9zdmc+'; + } + GridThumbnailComponent.prototype.errorHandler = function (event) { + event.currentTarget.src = this.holderSource; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Bitstream) + ], GridThumbnailComponent.prototype, "thumbnail", void 0); + GridThumbnailComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-grid-thumbnail', + styleUrls: ['./grid-thumbnail.component.scss'], + templateUrl: './grid-thumbnail.component.html' + }) + ], GridThumbnailComponent); + return GridThumbnailComponent; +}()); +export { GridThumbnailComponent }; +//# sourceMappingURL=grid-thumbnail.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.js.map b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.js.map new file mode 100644 index 0000000000..c5ce8f4918 --- /dev/null +++ b/src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"grid-thumbnail.component.js","sourceRoot":"","sources":["grid-thumbnail.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEjE;;;;GAIG;AAOH;IALA;QASE,SAAI,GAAQ,EAAE,CAAC;QAEf;;WAEG;QACH,iBAAY,GAAG,w5BAAw5B,CAAC;IAM16B,CAAC;IAJC,6CAAY,GAAZ,UAAa,KAAK;QAChB,KAAK,CAAC,aAAa,CAAC,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC;IAC9C,CAAC;IAXQ;QAAR,KAAK,EAAE;0CAAY,SAAS;6DAAC;IAFnB,sBAAsB;QALlC,SAAS,CAAC;YACT,QAAQ,EAAE,mBAAmB;YAC7B,SAAS,EAAE,CAAC,iCAAiC,CAAC;YAC9C,WAAW,EAAE,iCAAiC;SAC/C,CAAC;OACW,sBAAsB,CAelC;IAAD,6BAAC;CAAA,AAfD,IAeC;SAfY,sBAAsB"} \ No newline at end of file diff --git a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.js b/src/app/shared/object-grid/item-grid-element/item-grid-element.component.js new file mode 100644 index 0000000000..c34f6b9414 --- /dev/null +++ b/src/app/shared/object-grid/item-grid-element/item-grid-element.component.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { Item } from '../../../core/shared/item.model'; +import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator'; +import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; +import { SetViewMode } from '../../view-mode'; +var ItemGridElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemGridElementComponent, _super); + function ItemGridElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + ItemGridElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-grid-element', + styleUrls: ['./item-grid-element.component.scss'], + templateUrl: './item-grid-element.component.html' + }), + renderElementsFor(Item, SetViewMode.Grid) + ], ItemGridElementComponent); + return ItemGridElementComponent; +}(AbstractListableElementComponent)); +export { ItemGridElementComponent }; +//# sourceMappingURL=item-grid-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.js.map b/src/app/shared/object-grid/item-grid-element/item-grid-element.component.js.map new file mode 100644 index 0000000000..08074d572e --- /dev/null +++ b/src/app/shared/object-grid/item-grid-element/item-grid-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-grid-element.component.js","sourceRoot":"","sources":["item-grid-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAC,MAAM,sDAAsD,CAAC;AACxF,OAAO,EAAE,gCAAgC,EAAE,MAAM,8FAA8F,CAAC;AAChJ,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAS9C;IAA8C,oDAAsC;IAApF;;IAAsF,CAAC;IAA1E,wBAAwB;QAPpC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,SAAS,EAAE,CAAC,oCAAoC,CAAC;YACjD,WAAW,EAAE,oCAAoC;SAClD,CAAC;QAED,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;OAC7B,wBAAwB,CAAkD;IAAD,+BAAC;CAAA,AAAvF,CAA8C,gCAAgC,GAAS;SAA1E,wBAAwB"} \ No newline at end of file diff --git a/src/app/shared/object-grid/object-grid.component.js b/src/app/shared/object-grid/object-grid.component.js new file mode 100644 index 0000000000..6db34997ef --- /dev/null +++ b/src/app/shared/object-grid/object-grid.component.js @@ -0,0 +1,165 @@ +import * as tslib_1 from "tslib"; +import { combineLatest as observableCombineLatest, BehaviorSubject } from 'rxjs'; +import { startWith, distinctUntilChanged, map } from 'rxjs/operators'; +import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; +import { SortOptions } from '../../core/cache/models/sort-options.model'; +import { RemoteData } from '../../core/data/remote-data'; +import { fadeIn } from '../animations/fade'; +import { hasNoValue, hasValue } from '../empty.util'; +import { HostWindowService, WidthCategory } from '../host-window.service'; +import { PaginationComponentOptions } from '../pagination/pagination-component-options.model'; +var ObjectGridComponent = /** @class */ (function () { + function ObjectGridComponent(hostWindow) { + this.hostWindow = hostWindow; + this.hideGear = false; + this.hidePagerWhenSinglePage = true; + /** + * An event fired when the page is changed. + * Event's payload equals to the newly selected page. + */ + this.change = new EventEmitter(); + /** + * An event fired when the page is changed. + * Event's payload equals to the newly selected page. + */ + this.pageChange = new EventEmitter(); + /** + * An event fired when the page wsize is changed. + * Event's payload equals to the newly selected page size. + */ + this.pageSizeChange = new EventEmitter(); + /** + * An event fired when the sort direction is changed. + * Event's payload equals to the newly selected sort direction. + */ + this.sortDirectionChange = new EventEmitter(); + this.paginationChange = new EventEmitter(); + /** + * An event fired when the sort field is changed. + * Event's payload equals to the newly selected sort field. + */ + this.sortFieldChange = new EventEmitter(); + this.data = {}; + this._objects$ = new BehaviorSubject(undefined); + } + Object.defineProperty(ObjectGridComponent.prototype, "objects", { + get: function () { + return this._objects$.getValue(); + }, + set: function (objects) { + this._objects$.next(objects); + }, + enumerable: true, + configurable: true + }); + ObjectGridComponent.prototype.ngOnInit = function () { + var nbColumns$ = this.hostWindow.widthCategory.pipe(map(function (widthCat) { + switch (widthCat) { + case WidthCategory.XL: + case WidthCategory.LG: { + return 3; + } + case WidthCategory.MD: + case WidthCategory.SM: { + return 2; + } + default: { + return 1; + } + } + }), distinctUntilChanged()).pipe(startWith(3)); + this.columns$ = observableCombineLatest(nbColumns$, this._objects$).pipe(map(function (_a) { + var nbColumns = _a[0], objects = _a[1]; + if (hasValue(objects) && hasValue(objects.payload) && hasValue(objects.payload.page)) { + var page = objects.payload.page; + var result_1 = []; + page.forEach(function (obj, i) { + var colNb = i % nbColumns; + var col = result_1[colNb]; + if (hasNoValue(col)) { + col = []; + } + result_1[colNb] = col.concat([obj]); + }); + return result_1; + } + else { + return []; + } + })); + }; + ObjectGridComponent.prototype.onPageChange = function (event) { + this.pageChange.emit(event); + }; + ObjectGridComponent.prototype.onPageSizeChange = function (event) { + this.pageSizeChange.emit(event); + }; + ObjectGridComponent.prototype.onSortDirectionChange = function (event) { + this.sortDirectionChange.emit(event); + }; + ObjectGridComponent.prototype.onSortFieldChange = function (event) { + this.sortFieldChange.emit(event); + }; + ObjectGridComponent.prototype.onPaginationChange = function (event) { + this.paginationChange.emit(event); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", PaginationComponentOptions) + ], ObjectGridComponent.prototype, "config", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SortOptions) + ], ObjectGridComponent.prototype, "sortConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ObjectGridComponent.prototype, "hideGear", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ObjectGridComponent.prototype, "hidePagerWhenSinglePage", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", RemoteData), + tslib_1.__metadata("design:paramtypes", [RemoteData]) + ], ObjectGridComponent.prototype, "objects", null); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectGridComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectGridComponent.prototype, "pageChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectGridComponent.prototype, "pageSizeChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectGridComponent.prototype, "sortDirectionChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectGridComponent.prototype, "paginationChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectGridComponent.prototype, "sortFieldChange", void 0); + ObjectGridComponent = tslib_1.__decorate([ + Component({ + changeDetection: ChangeDetectionStrategy.Default, + encapsulation: ViewEncapsulation.Emulated, + selector: 'ds-object-grid', + styleUrls: ['./object-grid.component.scss'], + templateUrl: './object-grid.component.html', + animations: [fadeIn] + }), + tslib_1.__metadata("design:paramtypes", [HostWindowService]) + ], ObjectGridComponent); + return ObjectGridComponent; +}()); +export { ObjectGridComponent }; +//# sourceMappingURL=object-grid.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-grid/object-grid.component.js.map b/src/app/shared/object-grid/object-grid.component.js.map new file mode 100644 index 0000000000..822d1a2d9f --- /dev/null +++ b/src/app/shared/object-grid/object-grid.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-grid.component.js","sourceRoot":"","sources":["object-grid.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAE,eAAe,EAAc,MAAM,MAAM,CAAC;AAE7F,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,uBAAuB,EACvB,SAAS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AQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,CAAC,8BAA8B,CAAC;YAC3C,WAAW,EAAE,8BAA8B;YAC3C,UAAU,EAAE,CAAC,MAAM,CAAC;SACrB,CAAC;iDA0DgC,iBAAiB;OAxDtC,mBAAmB,CA2H/B;IAAD,0BAAC;CAAA,AA3HD,IA2HC;SA3HY,mBAAmB"} \ No newline at end of file diff --git a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.js b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.js new file mode 100644 index 0000000000..076cfe8be9 --- /dev/null +++ b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { SearchResultGridElementComponent } from '../search-result-grid-element.component'; +import { SetViewMode } from '../../../view-mode'; +import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model'; +var CollectionSearchResultGridElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(CollectionSearchResultGridElementComponent, _super); + function CollectionSearchResultGridElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + CollectionSearchResultGridElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-collection-search-result-grid-element', + styleUrls: ['../search-result-grid-element.component.scss', 'collection-search-result-grid-element.component.scss'], + templateUrl: 'collection-search-result-grid-element.component.html' + }), + renderElementsFor(CollectionSearchResult, SetViewMode.Grid) + ], CollectionSearchResultGridElementComponent); + return CollectionSearchResultGridElementComponent; +}(SearchResultGridElementComponent)); +export { CollectionSearchResultGridElementComponent }; +//# sourceMappingURL=collection-search-result-grid-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.js.map b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.js.map new file mode 100644 index 0000000000..b4a958a218 --- /dev/null +++ b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collection-search-result-grid-element.component.js","sourceRoot":"","sources":["collection-search-result-grid-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAC,MAAM,yDAAyD,CAAC;AAC3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAE3F,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kEAAkE,CAAC;AAS1G;IAAgE,sEAAoE;IAApI;;IAAsI,CAAC;IAA1H,0CAA0C;QAPtD,SAAS,CAAC;YACT,QAAQ,EAAE,0CAA0C;YACpD,SAAS,EAAE,CAAC,8CAA8C,EAAE,sDAAsD,CAAC;YACnH,WAAW,EAAE,sDAAsD;SACpE,CAAC;QAED,iBAAiB,CAAC,sBAAsB,EAAE,WAAW,CAAC,IAAI,CAAC;OAC/C,0CAA0C,CAAgF;IAAD,iDAAC;CAAA,AAAvI,CAAgE,gCAAgC,GAAuC;SAA1H,0CAA0C"} \ No newline at end of file diff --git a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.js b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.js new file mode 100644 index 0000000000..8ceed16a7b --- /dev/null +++ b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { SearchResultGridElementComponent } from '../search-result-grid-element.component'; +import { SetViewMode } from '../../../view-mode'; +import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model'; +var CommunitySearchResultGridElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(CommunitySearchResultGridElementComponent, _super); + function CommunitySearchResultGridElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommunitySearchResultGridElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-community-search-result-grid-element', + styleUrls: ['../search-result-grid-element.component.scss', 'community-search-result-grid-element.component.scss'], + templateUrl: 'community-search-result-grid-element.component.html' + }), + renderElementsFor(CommunitySearchResult, SetViewMode.Grid) + ], CommunitySearchResultGridElementComponent); + return CommunitySearchResultGridElementComponent; +}(SearchResultGridElementComponent)); +export { CommunitySearchResultGridElementComponent }; +//# sourceMappingURL=community-search-result-grid-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.js.map b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.js.map new file mode 100644 index 0000000000..e083d946b5 --- /dev/null +++ b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-search-result-grid-element.component.js","sourceRoot":"","sources":["community-search-result-grid-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iEAAiE,CAAC;AASxG;IAA+D,qEAAkE;IAAjI;;IAEA,CAAC;IAFY,yCAAyC;QAPrD,SAAS,CAAC;YACT,QAAQ,EAAE,yCAAyC;YACnD,SAAS,EAAE,CAAC,8CAA8C,EAAE,qDAAqD,CAAC;YAClH,WAAW,EAAE,qDAAqD;SACnE,CAAC;QAED,iBAAiB,CAAC,qBAAqB,EAAE,WAAW,CAAC,IAAI,CAAC;OAC9C,yCAAyC,CAErD;IAAD,gDAAC;CAAA,AAFD,CAA+D,gCAAgC,GAE9F;SAFY,yCAAyC"} \ No newline at end of file diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.js b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.js new file mode 100644 index 0000000000..0bc2642067 --- /dev/null +++ b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.js @@ -0,0 +1,25 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { SearchResultGridElementComponent } from '../search-result-grid-element.component'; +import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; +import { SetViewMode } from '../../../view-mode'; +import { focusShadow } from '../../../../shared/animations/focus'; +var ItemSearchResultGridElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemSearchResultGridElementComponent, _super); + function ItemSearchResultGridElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + ItemSearchResultGridElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-search-result-grid-element', + styleUrls: ['../search-result-grid-element.component.scss', 'item-search-result-grid-element.component.scss'], + templateUrl: 'item-search-result-grid-element.component.html', + animations: [focusShadow], + }), + renderElementsFor(ItemSearchResult, SetViewMode.Grid) + ], ItemSearchResultGridElementComponent); + return ItemSearchResultGridElementComponent; +}(SearchResultGridElementComponent)); +export { ItemSearchResultGridElementComponent }; +//# sourceMappingURL=item-search-result-grid-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.js.map b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.js.map new file mode 100644 index 0000000000..3b77b39d50 --- /dev/null +++ b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-search-result-grid-element.component.js","sourceRoot":"","sources":["item-search-result-grid-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAUlE;IAA0D,gEAAwD;IAAlH;;IAAoH,CAAC;IAAxG,oCAAoC;QARhD,SAAS,CAAC;YACT,QAAQ,EAAE,oCAAoC;YAC9C,SAAS,EAAE,CAAC,8CAA8C,EAAE,gDAAgD,CAAC;YAC7G,WAAW,EAAE,gDAAgD;YAC7D,UAAU,EAAE,CAAC,WAAW,CAAC;SAC1B,CAAC;QAED,iBAAiB,CAAC,gBAAgB,EAAE,WAAW,CAAC,IAAI,CAAC;OACzC,oCAAoC,CAAoE;IAAD,2CAAC;CAAA,AAArH,CAA0D,gCAAgC,GAA2B;SAAxG,oCAAoC"} \ No newline at end of file diff --git a/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.js b/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.js new file mode 100644 index 0000000000..52728f567a --- /dev/null +++ b/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.js @@ -0,0 +1,47 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; +import { TruncatableService } from '../../truncatable/truncatable.service'; +import { Metadata } from '../../../core/shared/metadata.utils'; +var SearchResultGridElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(SearchResultGridElementComponent, _super); + function SearchResultGridElementComponent(listableObject, truncatableService) { + var _this = _super.call(this, listableObject) || this; + _this.listableObject = listableObject; + _this.truncatableService = truncatableService; + _this.dso = _this.object.indexableObject; + return _this; + } + /** + * Gets all matching metadata string values from hitHighlights or dso metadata, preferring hitHighlights. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @returns {string[]} the matching string values or an empty array. + */ + SearchResultGridElementComponent.prototype.allMetadataValues = function (keyOrKeys) { + return Metadata.allValues([this.object.hitHighlights, this.dso.metadata], keyOrKeys); + }; + /** + * Gets the first matching metadata string value from hitHighlights or dso metadata, preferring hitHighlights. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @returns {string} the first matching string value, or `undefined`. + */ + SearchResultGridElementComponent.prototype.firstMetadataValue = function (keyOrKeys) { + return Metadata.firstValue([this.object.hitHighlights, this.dso.metadata], keyOrKeys); + }; + SearchResultGridElementComponent.prototype.isCollapsed = function () { + return this.truncatableService.isCollapsed(this.dso.id); + }; + SearchResultGridElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-result-grid-element', + template: "" + }), + tslib_1.__param(0, Inject('objectElementProvider')), + tslib_1.__metadata("design:paramtypes", [Object, TruncatableService]) + ], SearchResultGridElementComponent); + return SearchResultGridElementComponent; +}(AbstractListableElementComponent)); +export { SearchResultGridElementComponent }; +//# sourceMappingURL=search-result-grid-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.js.map b/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.js.map new file mode 100644 index 0000000000..cda164ca8a --- /dev/null +++ b/src/app/shared/object-grid/search-result-grid-element/search-result-grid-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-result-grid-element.component.js","sourceRoot":"","sources":["search-result-grid-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIlD,OAAO,EAAE,gCAAgC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/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.js new file mode 100644 index 0000000000..2e36f3e910 --- /dev/null +++ b/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.js @@ -0,0 +1,35 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector, Input } from '@angular/core'; +import { SetViewMode } from '../../view-mode'; +import { rendersDSOType } from '../../object-collection/shared/dso-element-decorator'; +var WrapperGridElementComponent = /** @class */ (function () { + function WrapperGridElementComponent(injector) { + this.injector = injector; + } + WrapperGridElementComponent.prototype.ngOnInit = function () { + var _this = this; + this.objectInjector = Injector.create({ + providers: [{ provide: 'objectElementProvider', useFactory: function () { return (_this.object); }, deps: [] }], + parent: this.injector + }); + }; + WrapperGridElementComponent.prototype.getGridElement = function () { + var f = this.object.constructor; + return rendersDSOType(f, SetViewMode.Grid); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], WrapperGridElementComponent.prototype, "object", void 0); + WrapperGridElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-wrapper-grid-element', + styleUrls: ['./wrapper-grid-element.component.scss'], + templateUrl: './wrapper-grid-element.component.html' + }), + tslib_1.__metadata("design:paramtypes", [Injector]) + ], WrapperGridElementComponent); + return WrapperGridElementComponent; +}()); +export { WrapperGridElementComponent }; +//# sourceMappingURL=wrapper-grid-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.js.map b/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.js.map new file mode 100644 index 0000000000..4d8156d415 --- /dev/null +++ b/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrapper-grid-element.component.js","sourceRoot":"","sources":["wrapper-grid-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;AAQtF;IAIE,qCAAoB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IACtC,CAAC;IAED,8CAAQ,GAAR;QAAA,iBAMC;QALC,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;YACpC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,cAAM,OAAA,CAAC,KAAI,CAAC,MAAM,CAAC,EAAb,CAAa,EAAE,IAAI,EAAC,EAAE,EAAE,CAAC;YAC3F,MAAM,EAAE,IAAI,CAAC,QAAQ;SACtB,CAAC,CAAC;IAEL,CAAC;IAED,oDAAc,GAAd;QACE,IAAM,CAAC,GAAuC,IAAI,CAAC,MAAM,CAAC,WAAiD,CAAC;QAC5G,OAAO,cAAc,CAAC,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAjBQ;QAAR,KAAK,EAAE;;+DAAwB;IADrB,2BAA2B;QALvC,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,SAAS,EAAE,CAAC,uCAAuC,CAAC;YACpD,WAAW,EAAE,uCAAuC;SACrD,CAAC;iDAK8B,QAAQ;OAJ3B,2BAA2B,CAmBvC;IAAD,kCAAC;CAAA,AAnBD,IAmBC;SAnBY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.js b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.js new file mode 100644 index 0000000000..be4195ab13 --- /dev/null +++ b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; +import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator'; +import { BrowseEntry } from '../../../core/shared/browse-entry.model'; +import { SetViewMode } from '../../view-mode'; +var BrowseEntryListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(BrowseEntryListElementComponent, _super); + function BrowseEntryListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + BrowseEntryListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-browse-entry-list-element', + styleUrls: ['./browse-entry-list-element.component.scss'], + templateUrl: './browse-entry-list-element.component.html' + }) + /** + * This component is automatically used to create a list view for BrowseEntry objects when used in ObjectCollectionComponent + */ + , + renderElementsFor(BrowseEntry, SetViewMode.List) + ], BrowseEntryListElementComponent); + return BrowseEntryListElementComponent; +}(AbstractListableElementComponent)); +export { BrowseEntryListElementComponent }; +//# sourceMappingURL=browse-entry-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.js.map b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.js.map new file mode 100644 index 0000000000..39ae82a45f --- /dev/null +++ b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-entry-list-element.component.js","sourceRoot":"","sources":["browse-entry-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8FAA8F,CAAC;AAChJ,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAY9C;IAAqD,2DAA6C;IAAlG;;IAAoG,CAAC;IAAxF,+BAA+B;QAV3C,SAAS,CAAC;YACT,QAAQ,EAAE,8BAA8B;YACxC,SAAS,EAAE,CAAC,4CAA4C,CAAC;YACzD,WAAW,EAAE,4CAA4C;SAC1D,CAAC;QAEF;;WAEG;;QACF,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC;OACpC,+BAA+B,CAAyD;IAAD,sCAAC;CAAA,AAArG,CAAqD,gCAAgC,GAAgB;SAAxF,+BAA+B"} \ No newline at end of file diff --git a/src/app/shared/object-list/collection-list-element/collection-list-element.component.js b/src/app/shared/object-list/collection-list-element/collection-list-element.component.js new file mode 100644 index 0000000000..4a1c0e96ea --- /dev/null +++ b/src/app/shared/object-list/collection-list-element/collection-list-element.component.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { Collection } from '../../../core/shared/collection.model'; +import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator'; +import { SetViewMode } from '../../view-mode'; +import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; +var CollectionListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(CollectionListElementComponent, _super); + function CollectionListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + CollectionListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-collection-list-element', + styleUrls: ['./collection-list-element.component.scss'], + templateUrl: './collection-list-element.component.html' + }), + renderElementsFor(Collection, SetViewMode.List) + ], CollectionListElementComponent); + return CollectionListElementComponent; +}(AbstractListableElementComponent)); +export { CollectionListElementComponent }; +//# sourceMappingURL=collection-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/collection-list-element/collection-list-element.component.js.map b/src/app/shared/object-list/collection-list-element/collection-list-element.component.js.map new file mode 100644 index 0000000000..b18702be9c --- /dev/null +++ b/src/app/shared/object-list/collection-list-element/collection-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collection-list-element.component.js","sourceRoot":"","sources":["collection-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,8FAA8F,CAAC;AAShJ;IAAoD,0DAA4C;IAAhG;;IAAkG,CAAC;IAAtF,8BAA8B;QAP1C,SAAS,CAAC;YACT,QAAQ,EAAE,4BAA4B;YACtC,SAAS,EAAE,CAAC,0CAA0C,CAAC;YACvD,WAAW,EAAE,0CAA0C;SACxD,CAAC;QAED,iBAAiB,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC;OACnC,8BAA8B,CAAwD;IAAD,qCAAC;CAAA,AAAnG,CAAoD,gCAAgC,GAAe;SAAtF,8BAA8B"} \ No newline at end of file diff --git a/src/app/shared/object-list/community-list-element/community-list-element.component.js b/src/app/shared/object-list/community-list-element/community-list-element.component.js new file mode 100644 index 0000000000..80e529919a --- /dev/null +++ b/src/app/shared/object-list/community-list-element/community-list-element.component.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { Community } from '../../../core/shared/community.model'; +import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; +import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator'; +import { SetViewMode } from '../../view-mode'; +var CommunityListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(CommunityListElementComponent, _super); + function CommunityListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommunityListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-community-list-element', + styleUrls: ['./community-list-element.component.scss'], + templateUrl: './community-list-element.component.html' + }), + renderElementsFor(Community, SetViewMode.List) + ], CommunityListElementComponent); + return CommunityListElementComponent; +}(AbstractListableElementComponent)); +export { CommunityListElementComponent }; +//# sourceMappingURL=community-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/community-list-element/community-list-element.component.js.map b/src/app/shared/object-list/community-list-element/community-list-element.component.js.map new file mode 100644 index 0000000000..0203dbd492 --- /dev/null +++ b/src/app/shared/object-list/community-list-element/community-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-list-element.component.js","sourceRoot":"","sources":["community-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,gCAAgC,EAAE,MAAM,8FAA8F,CAAC;AAChJ,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAS9C;IAAmD,yDAA2C;IAA9F;;IAAgG,CAAC;IAApF,6BAA6B;QAPzC,SAAS,CAAC;YACT,QAAQ,EAAE,2BAA2B;YACrC,SAAS,EAAE,CAAC,yCAAyC,CAAC;YACtD,WAAW,EAAE,yCAAyC;SACvD,CAAC;QAED,iBAAiB,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC;OAClC,6BAA6B,CAAuD;IAAD,oCAAC;CAAA,AAAjG,CAAmD,gCAAgC,GAAc;SAApF,6BAA6B"} \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-list-element.component.js b/src/app/shared/object-list/item-list-element/item-list-element.component.js new file mode 100644 index 0000000000..1fa30c8e73 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-list-element.component.js @@ -0,0 +1,31 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { Item } from '../../../core/shared/item.model'; +import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator'; +import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; +import { SetViewMode } from '../../view-mode'; +import { ItemViewMode } from '../../items/item-type-decorator'; +var ItemListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemListElementComponent, _super); + function ItemListElementComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.viewMode = ItemViewMode.Element; + return _this; + } + ItemListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-list-element', + styleUrls: ['./item-list-element.component.scss'], + templateUrl: './item-list-element.component.html' + }) + /** + * The component used to list items depending on type + * Uses item-type-switcher to determine which components to use for displaying the list + */ + , + renderElementsFor(Item, SetViewMode.List) + ], ItemListElementComponent); + return ItemListElementComponent; +}(AbstractListableElementComponent)); +export { ItemListElementComponent }; +//# sourceMappingURL=item-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-list-element.component.js.map b/src/app/shared/object-list/item-list-element/item-list-element.component.js.map new file mode 100644 index 0000000000..05ab8e0e6f --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-list-element.component.js","sourceRoot":"","sources":["item-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,gCAAgC,EAAE,MAAM,8FAA8F,CAAC;AAChJ,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAa/D;IAA8C,oDAAsC;IAXpF;QAAA,qEAaC;QADC,cAAQ,GAAG,YAAY,CAAC,OAAO,CAAC;;IAClC,CAAC;IAFY,wBAAwB;QAXpC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,SAAS,EAAE,CAAC,oCAAoC,CAAC;YACjD,WAAW,EAAE,oCAAoC;SAClD,CAAC;QAEF;;;WAGG;;QACF,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;OAC7B,wBAAwB,CAEpC;IAAD,+BAAC;CAAA,AAFD,CAA8C,gCAAgC,GAE7E;SAFY,wBAAwB"} \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/journal-issue/journal-issue-list-element.component.js b/src/app/shared/object-list/item-list-element/item-types/journal-issue/journal-issue-list-element.component.js new file mode 100644 index 0000000000..7767894d7b --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/journal-issue/journal-issue-list-element.component.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; +import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; +var JournalIssueListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(JournalIssueListElementComponent, _super); + /** + * The component for displaying a list element for an item of the type Journal Issue + */ + function JournalIssueListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + JournalIssueListElementComponent = tslib_1.__decorate([ + rendersItemType('JournalIssue', ItemViewMode.Element), + Component({ + selector: 'ds-journal-issue-list-element', + styleUrls: ['./journal-issue-list-element.component.scss'], + templateUrl: './journal-issue-list-element.component.html' + }) + /** + * The component for displaying a list element for an item of the type Journal Issue + */ + ], JournalIssueListElementComponent); + return JournalIssueListElementComponent; +}(TypedItemSearchResultListElementComponent)); +export { JournalIssueListElementComponent }; +//# sourceMappingURL=journal-issue-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/journal-issue/journal-issue-list-element.component.js.map b/src/app/shared/object-list/item-list-element/item-types/journal-issue/journal-issue-list-element.component.js.map new file mode 100644 index 0000000000..3345061bd9 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/journal-issue/journal-issue-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"journal-issue-list-element.component.js","sourceRoot":"","sources":["journal-issue-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;AAW/G;IAAsD,4DAAyC;IAH/F;;OAEG;IACH;;IACA,CAAC;IADY,gCAAgC;QAT5C,eAAe,CAAC,cAAc,EAAE,YAAY,CAAC,OAAO,CAAC;QACrD,SAAS,CAAC;YACT,QAAQ,EAAE,+BAA+B;YACzC,SAAS,EAAE,CAAC,6CAA6C,CAAC;YAC1D,WAAW,EAAE,6CAA6C;SAC3D,CAAC;QACF;;WAEG;OACU,gCAAgC,CAC5C;IAAD,uCAAC;CAAA,AADD,CAAsD,yCAAyC,GAC9F;SADY,gCAAgC"} \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/journal-volume/journal-volume-list-element.component.js b/src/app/shared/object-list/item-list-element/item-types/journal-volume/journal-volume-list-element.component.js new file mode 100644 index 0000000000..344f35f951 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/journal-volume/journal-volume-list-element.component.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; +import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; +var JournalVolumeListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(JournalVolumeListElementComponent, _super); + /** + * The component for displaying a list element for an item of the type Journal Volume + */ + function JournalVolumeListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + JournalVolumeListElementComponent = tslib_1.__decorate([ + rendersItemType('JournalVolume', ItemViewMode.Element), + Component({ + selector: 'ds-journal-volume-list-element', + styleUrls: ['./journal-volume-list-element.component.scss'], + templateUrl: './journal-volume-list-element.component.html' + }) + /** + * The component for displaying a list element for an item of the type Journal Volume + */ + ], JournalVolumeListElementComponent); + return JournalVolumeListElementComponent; +}(TypedItemSearchResultListElementComponent)); +export { JournalVolumeListElementComponent }; +//# sourceMappingURL=journal-volume-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/journal-volume/journal-volume-list-element.component.js.map b/src/app/shared/object-list/item-list-element/item-types/journal-volume/journal-volume-list-element.component.js.map new file mode 100644 index 0000000000..1d444223da --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/journal-volume/journal-volume-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"journal-volume-list-element.component.js","sourceRoot":"","sources":["journal-volume-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;AAW/G;IAAuD,6DAAyC;IAHhG;;OAEG;IACH;;IACA,CAAC;IADY,iCAAiC;QAT7C,eAAe,CAAC,eAAe,EAAE,YAAY,CAAC,OAAO,CAAC;QACtD,SAAS,CAAC;YACT,QAAQ,EAAE,gCAAgC;YAC1C,SAAS,EAAE,CAAC,8CAA8C,CAAC;YAC3D,WAAW,EAAE,8CAA8C;SAC5D,CAAC;QACF;;WAEG;OACU,iCAAiC,CAC7C;IAAD,wCAAC;CAAA,AADD,CAAuD,yCAAyC,GAC/F;SADY,iCAAiC"} \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/journal/journal-list-element.component.js b/src/app/shared/object-list/item-list-element/item-types/journal/journal-list-element.component.js new file mode 100644 index 0000000000..408424b233 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/journal/journal-list-element.component.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; +import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; +var JournalListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(JournalListElementComponent, _super); + /** + * The component for displaying a list element for an item of the type Journal + */ + function JournalListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + JournalListElementComponent = tslib_1.__decorate([ + rendersItemType('Journal', ItemViewMode.Element), + Component({ + selector: 'ds-journal-list-element', + styleUrls: ['./journal-list-element.component.scss'], + templateUrl: './journal-list-element.component.html' + }) + /** + * The component for displaying a list element for an item of the type Journal + */ + ], JournalListElementComponent); + return JournalListElementComponent; +}(TypedItemSearchResultListElementComponent)); +export { JournalListElementComponent }; +//# sourceMappingURL=journal-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/journal/journal-list-element.component.js.map b/src/app/shared/object-list/item-list-element/item-types/journal/journal-list-element.component.js.map new file mode 100644 index 0000000000..81435f4cd3 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/journal/journal-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"journal-list-element.component.js","sourceRoot":"","sources":["journal-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;AAW/G;IAAiD,uDAAyC;IAH1F;;OAEG;IACH;;IACA,CAAC;IADY,2BAA2B;QATvC,eAAe,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC;QAChD,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,SAAS,EAAE,CAAC,uCAAuC,CAAC;YACpD,WAAW,EAAE,uCAAuC;SACrD,CAAC;QACF;;WAEG;OACU,2BAA2B,CACvC;IAAD,kCAAC;CAAA,AADD,CAAiD,yCAAyC,GACzF;SADY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-list-element.component.js b/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-list-element.component.js new file mode 100644 index 0000000000..9ee965fa66 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-list-element.component.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; +import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; +var OrgUnitListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(OrgUnitListElementComponent, _super); + /** + * The component for displaying a list element for an item of the type Organisation Unit + */ + function OrgUnitListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + OrgUnitListElementComponent = tslib_1.__decorate([ + rendersItemType('OrgUnit', ItemViewMode.Element), + Component({ + selector: 'ds-orgunit-list-element', + styleUrls: ['./orgunit-list-element.component.scss'], + templateUrl: './orgunit-list-element.component.html' + }) + /** + * The component for displaying a list element for an item of the type Organisation Unit + */ + ], OrgUnitListElementComponent); + return OrgUnitListElementComponent; +}(TypedItemSearchResultListElementComponent)); +export { OrgUnitListElementComponent }; +//# sourceMappingURL=orgunit-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-list-element.component.js.map b/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-list-element.component.js.map new file mode 100644 index 0000000000..09f87db5d0 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"orgunit-list-element.component.js","sourceRoot":"","sources":["orgunit-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;AAW/G;IAAiD,uDAAyC;IAH1F;;OAEG;IACH;;IACA,CAAC;IADY,2BAA2B;QATvC,eAAe,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC;QAChD,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,SAAS,EAAE,CAAC,uCAAuC,CAAC;YACpD,WAAW,EAAE,uCAAuC;SACrD,CAAC;QACF;;WAEG;OACU,2BAA2B,CACvC;IAAD,kCAAC;CAAA,AADD,CAAiD,yCAAyC,GACzF;SADY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-metadata-list-element.component.js b/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-metadata-list-element.component.js new file mode 100644 index 0000000000..d4ad81f310 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-metadata-list-element.component.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; +import { Component } from '@angular/core'; +import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; +import { MetadataRepresentationType } from '../../../../../core/shared/metadata-representation/metadata-representation.model'; +var OrgUnitMetadataListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(OrgUnitMetadataListElementComponent, _super); + /** + * The component for displaying a list element for an item of the type OrgUnit + */ + function OrgUnitMetadataListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + OrgUnitMetadataListElementComponent = tslib_1.__decorate([ + rendersItemType('OrgUnit', ItemViewMode.Element, MetadataRepresentationType.Item), + Component({ + selector: 'ds-orgunit-metadata-list-element', + templateUrl: './orgunit-metadata-list-element.component.html' + }) + /** + * The component for displaying a list element for an item of the type OrgUnit + */ + ], OrgUnitMetadataListElementComponent); + return OrgUnitMetadataListElementComponent; +}(TypedItemSearchResultListElementComponent)); +export { OrgUnitMetadataListElementComponent }; +//# sourceMappingURL=orgunit-metadata-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-metadata-list-element.component.js.map b/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-metadata-list-element.component.js.map new file mode 100644 index 0000000000..9393fb8b31 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-metadata-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"orgunit-metadata-list-element.component.js","sourceRoot":"","sources":["orgunit-metadata-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;AAC/G,OAAO,EAAE,0BAA0B,EAAE,MAAM,kFAAkF,CAAC;AAU9H;IAAyD,+DAAyC;IAHlG;;OAEG;IACH;;IACA,CAAC;IADY,mCAAmC;QAR/C,eAAe,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,0BAA0B,CAAC,IAAI,CAAC;QACjF,SAAS,CAAC;YACT,QAAQ,EAAE,kCAAkC;YAC5C,WAAW,EAAE,gDAAgD;SAC9D,CAAC;QACF;;WAEG;OACU,mCAAmC,CAC/C;IAAD,0CAAC;CAAA,AADD,CAAyD,yCAAyC,GACjG;SADY,mCAAmC"} \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/person/person-list-element.component.js b/src/app/shared/object-list/item-list-element/item-types/person/person-list-element.component.js new file mode 100644 index 0000000000..08547fdf81 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/person/person-list-element.component.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; +import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; +var PersonListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(PersonListElementComponent, _super); + /** + * The component for displaying a list element for an item of the type Person + */ + function PersonListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + PersonListElementComponent = tslib_1.__decorate([ + rendersItemType('Person', ItemViewMode.Element), + Component({ + selector: 'ds-person-list-element', + styleUrls: ['./person-list-element.component.scss'], + templateUrl: './person-list-element.component.html' + }) + /** + * The component for displaying a list element for an item of the type Person + */ + ], PersonListElementComponent); + return PersonListElementComponent; +}(TypedItemSearchResultListElementComponent)); +export { PersonListElementComponent }; +//# sourceMappingURL=person-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/person/person-list-element.component.js.map b/src/app/shared/object-list/item-list-element/item-types/person/person-list-element.component.js.map new file mode 100644 index 0000000000..0a295b1b86 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/person/person-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"person-list-element.component.js","sourceRoot":"","sources":["person-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;AAW/G;IAAgD,sDAAyC;IAHzF;;OAEG;IACH;;IACA,CAAC;IADY,0BAA0B;QATtC,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC;QAC/C,SAAS,CAAC;YACT,QAAQ,EAAE,wBAAwB;YAClC,SAAS,EAAE,CAAC,sCAAsC,CAAC;YACnD,WAAW,EAAE,sCAAsC;SACpD,CAAC;QACF;;WAEG;OACU,0BAA0B,CACtC;IAAD,iCAAC;CAAA,AADD,CAAgD,yCAAyC,GACxF;SADY,0BAA0B"} \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/person/person-metadata-list-element.component.js b/src/app/shared/object-list/item-list-element/item-types/person/person-metadata-list-element.component.js new file mode 100644 index 0000000000..5d1e6d9769 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/person/person-metadata-list-element.component.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; +import { Component } from '@angular/core'; +import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; +import { MetadataRepresentationType } from '../../../../../core/shared/metadata-representation/metadata-representation.model'; +var PersonMetadataListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(PersonMetadataListElementComponent, _super); + /** + * The component for displaying a list element for an item of the type Person + */ + function PersonMetadataListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + PersonMetadataListElementComponent = tslib_1.__decorate([ + rendersItemType('Person', ItemViewMode.Element, MetadataRepresentationType.Item), + Component({ + selector: 'ds-person-metadata-list-element', + templateUrl: './person-metadata-list-element.component.html' + }) + /** + * The component for displaying a list element for an item of the type Person + */ + ], PersonMetadataListElementComponent); + return PersonMetadataListElementComponent; +}(TypedItemSearchResultListElementComponent)); +export { PersonMetadataListElementComponent }; +//# sourceMappingURL=person-metadata-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/person/person-metadata-list-element.component.js.map b/src/app/shared/object-list/item-list-element/item-types/person/person-metadata-list-element.component.js.map new file mode 100644 index 0000000000..ba1b185a5e --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/person/person-metadata-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"person-metadata-list-element.component.js","sourceRoot":"","sources":["person-metadata-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;AAC/G,OAAO,EAAE,0BAA0B,EAAE,MAAM,kFAAkF,CAAC;AAU9H;IAAwD,8DAAyC;IAHjG;;OAEG;IACH;;IACA,CAAC;IADY,kCAAkC;QAR9C,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,OAAO,EAAE,0BAA0B,CAAC,IAAI,CAAC;QAChF,SAAS,CAAC;YACT,QAAQ,EAAE,iCAAiC;YAC3C,WAAW,EAAE,+CAA+C;SAC7D,CAAC;QACF;;WAEG;OACU,kCAAkC,CAC9C;IAAD,yCAAC;CAAA,AADD,CAAwD,yCAAyC,GAChG;SADY,kCAAkC"} \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/project/project-list-element.component.js b/src/app/shared/object-list/item-list-element/item-types/project/project-list-element.component.js new file mode 100644 index 0000000000..f0dba4162b --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/project/project-list-element.component.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; +import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; +var ProjectListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(ProjectListElementComponent, _super); + /** + * The component for displaying a list element for an item of the type Project + */ + function ProjectListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + ProjectListElementComponent = tslib_1.__decorate([ + rendersItemType('Project', ItemViewMode.Element), + Component({ + selector: 'ds-project-list-element', + styleUrls: ['./project-list-element.component.scss'], + templateUrl: './project-list-element.component.html' + }) + /** + * The component for displaying a list element for an item of the type Project + */ + ], ProjectListElementComponent); + return ProjectListElementComponent; +}(TypedItemSearchResultListElementComponent)); +export { ProjectListElementComponent }; +//# sourceMappingURL=project-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/project/project-list-element.component.js.map b/src/app/shared/object-list/item-list-element/item-types/project/project-list-element.component.js.map new file mode 100644 index 0000000000..2acb503cbf --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/project/project-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"project-list-element.component.js","sourceRoot":"","sources":["project-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;AAW/G;IAAiD,uDAAyC;IAH1F;;OAEG;IACH;;IACA,CAAC;IADY,2BAA2B;QATvC,eAAe,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC;QAChD,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,SAAS,EAAE,CAAC,uCAAuC,CAAC;YACpD,WAAW,EAAE,uCAAuC;SACrD,CAAC;QACF;;WAEG;OACU,2BAA2B,CACvC;IAAD,kCAAC;CAAA,AADD,CAAiD,yCAAyC,GACzF;SADY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.js b/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.js new file mode 100644 index 0000000000..8d5dfcf990 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.js @@ -0,0 +1,28 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { DEFAULT_ITEM_TYPE, ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; +import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; +var PublicationListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(PublicationListElementComponent, _super); + /** + * The component for displaying a list element for an item of the type Publication + */ + function PublicationListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + PublicationListElementComponent = tslib_1.__decorate([ + rendersItemType('Publication', ItemViewMode.Element), + rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Element), + Component({ + selector: 'ds-publication-list-element', + styleUrls: ['./publication-list-element.component.scss'], + templateUrl: './publication-list-element.component.html' + }) + /** + * The component for displaying a list element for an item of the type Publication + */ + ], PublicationListElementComponent); + return PublicationListElementComponent; +}(TypedItemSearchResultListElementComponent)); +export { PublicationListElementComponent }; +//# sourceMappingURL=publication-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.js.map b/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.js.map new file mode 100644 index 0000000000..a123f02c67 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"publication-list-element.component.js","sourceRoot":"","sources":["publication-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACzG,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;AAY/G;IAAqD,2DAAyC;IAH9F;;OAEG;IACH;;IACA,CAAC;IADY,+BAA+B;QAV3C,eAAe,CAAC,aAAa,EAAE,YAAY,CAAC,OAAO,CAAC;QACpD,eAAe,CAAC,iBAAiB,EAAE,YAAY,CAAC,OAAO,CAAC;QACxD,SAAS,CAAC;YACT,QAAQ,EAAE,6BAA6B;YACvC,SAAS,EAAE,CAAC,2CAA2C,CAAC;YACxD,WAAW,EAAE,2CAA2C;SACzD,CAAC;QACF;;WAEG;OACU,+BAA+B,CAC3C;IAAD,sCAAC;CAAA,AADD,CAAqD,yCAAyC,GAC7F;SADY,+BAA+B"} \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.js b/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.js new file mode 100644 index 0000000000..db22dc3493 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.js @@ -0,0 +1,42 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { hasValue } from '../../../empty.util'; +import { ITEM } from '../../../items/switcher/item-type-switcher.component'; +import { TruncatableService } from '../../../truncatable/truncatable.service'; +import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component'; +import { MetadataMap } from '../../../../core/shared/metadata.models'; +/** + * A generic component for displaying item list elements + */ +var TypedItemSearchResultListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(TypedItemSearchResultListElementComponent, _super); + function TypedItemSearchResultListElementComponent(truncatableService, obj) { + var _this = _super.call(this, undefined, truncatableService) || this; + _this.truncatableService = truncatableService; + _this.obj = obj; + if (hasValue(obj.indexableObject)) { + _this.object = obj; + _this.dso = _this.object.indexableObject; + } + else { + _this.object = { + indexableObject: obj, + hitHighlights: new MetadataMap() + }; + _this.dso = obj; + } + _this.item = _this.dso; + return _this; + } + TypedItemSearchResultListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-search-result', + template: '' + }), + tslib_1.__param(1, Inject(ITEM)), + tslib_1.__metadata("design:paramtypes", [TruncatableService, Object]) + ], TypedItemSearchResultListElementComponent); + return TypedItemSearchResultListElementComponent; +}(SearchResultListElementComponent)); +export { TypedItemSearchResultListElementComponent }; +//# sourceMappingURL=typed-item-search-result-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.js.map b/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.js.map new file mode 100644 index 0000000000..366db8595b --- /dev/null +++ b/src/app/shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"typed-item-search-result-list-element.component.js","sourceRoot":"","sources":["typed-item-search-result-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,sDAAsD,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,uEAAuE,CAAC;AACzH,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAEtE;;GAEG;AAKH;IAA+D,qEAAwD;IAGrH,mDACY,kBAAsC,EAC3B,GAA4B;QAFnD,YAIE,kBAAM,SAAS,EAAE,kBAAkB,CAAC,SAYrC;QAfW,wBAAkB,GAAlB,kBAAkB,CAAoB;QAC3B,SAAG,GAAH,GAAG,CAAyB;QAGjD,IAAI,QAAQ,CAAE,GAAW,CAAC,eAAe,CAAC,EAAE;YAC1C,KAAI,CAAC,MAAM,GAAG,GAAuB,CAAC;YACtC,KAAI,CAAC,GAAG,GAAG,KAAI,CAAC,MAAM,CAAC,eAAe,CAAC;SACxC;aAAM;YACL,KAAI,CAAC,MAAM,GAAG;gBACZ,eAAe,EAAE,GAAW;gBAC5B,aAAa,EAAE,IAAI,WAAW,EAAE;aACjC,CAAC;YACF,KAAI,CAAC,GAAG,GAAG,GAAW,CAAC;SACxB;QACD,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,GAAG,CAAC;;IACvB,CAAC;IAnBU,yCAAyC;QAJrD,SAAS,CAAC;YACT,QAAQ,EAAE,uBAAuB;YACjC,QAAQ,EAAE,EAAE;SACb,CAAC;QAMG,mBAAA,MAAM,CAAC,IAAI,CAAC,CAAA;iDADiB,kBAAkB;OAJvC,yCAAyC,CAoBrD;IAAD,gDAAC;CAAA,AApBD,CAA+D,gCAAgC,GAoB9F;SApBY,yCAAyC"} \ No newline at end of file diff --git a/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.js b/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.js new file mode 100644 index 0000000000..56f2a9fd1c --- /dev/null +++ b/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model'; +import { Component } from '@angular/core'; +import { MetadataRepresentationListElementComponent } from '../metadata-representation-list-element.component'; +import { DEFAULT_ITEM_TYPE, ItemViewMode, rendersItemType } from '../../../items/item-type-decorator'; +var ItemMetadataListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemMetadataListElementComponent, _super); + function ItemMetadataListElementComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * The view-mode we're currently on + * @type {ElementViewMode} + */ + _this.viewMode = ItemViewMode.Element; + return _this; + } + ItemMetadataListElementComponent = tslib_1.__decorate([ + rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Metadata, MetadataRepresentationType.Item), + Component({ + selector: 'ds-item-metadata-list-element', + templateUrl: './item-metadata-list-element.component.html' + }) + /** + * A component for displaying MetadataRepresentation objects in the form of items + * It will send the MetadataRepresentation object along with ElementViewMode.SetElement to the ItemTypeSwitcherComponent, + * which will in his turn decide how to render the item as metadata. + */ + ], ItemMetadataListElementComponent); + return ItemMetadataListElementComponent; +}(MetadataRepresentationListElementComponent)); +export { ItemMetadataListElementComponent }; +//# sourceMappingURL=item-metadata-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.js.map b/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.js.map new file mode 100644 index 0000000000..93846918fa --- /dev/null +++ b/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-metadata-list-element.component.js","sourceRoot":"","sources":["item-metadata-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+EAA+E,CAAC;AAC3H,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,0CAA0C,EAAE,MAAM,mDAAmD,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAYtG;IAAsD,4DAA0C;IAVhG;QAAA,qEAgBC;QALC;;;WAGG;QACH,cAAQ,GAAG,YAAY,CAAC,OAAO,CAAC;;IAClC,CAAC;IANY,gCAAgC;QAV5C,eAAe,CAAC,iBAAiB,EAAE,YAAY,CAAC,QAAQ,EAAE,0BAA0B,CAAC,IAAI,CAAC;QAC1F,SAAS,CAAC;YACT,QAAQ,EAAE,+BAA+B;YACzC,WAAW,EAAE,6CAA6C;SAC3D,CAAC;QACF;;;;WAIG;OACU,gCAAgC,CAM5C;IAAD,uCAAC;CAAA,AAND,CAAsD,0CAA0C,GAM/F;SANY,gCAAgC"} \ No newline at end of file diff --git a/src/app/shared/object-list/metadata-representation-list-element/metadata-representation-list-element.component.js b/src/app/shared/object-list/metadata-representation-list-element/metadata-representation-list-element.component.js new file mode 100644 index 0000000000..1d17a0463d --- /dev/null +++ b/src/app/shared/object-list/metadata-representation-list-element/metadata-representation-list-element.component.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { ITEM } from '../../items/switcher/item-type-switcher.component'; +var MetadataRepresentationListElementComponent = /** @class */ (function () { + function MetadataRepresentationListElementComponent(metadataRepresentation) { + this.metadataRepresentation = metadataRepresentation; + } + MetadataRepresentationListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-metadata-representation-list-element', + template: '' + }) + /** + * An abstract class for displaying a single MetadataRepresentation + */ + , + tslib_1.__param(0, Inject(ITEM)), + tslib_1.__metadata("design:paramtypes", [Object]) + ], MetadataRepresentationListElementComponent); + return MetadataRepresentationListElementComponent; +}()); +export { MetadataRepresentationListElementComponent }; +//# sourceMappingURL=metadata-representation-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/metadata-representation-list-element/metadata-representation-list-element.component.js.map b/src/app/shared/object-list/metadata-representation-list-element/metadata-representation-list-element.component.js.map new file mode 100644 index 0000000000..672eef12dc --- /dev/null +++ b/src/app/shared/object-list/metadata-representation-list-element/metadata-representation-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata-representation-list-element.component.js","sourceRoot":"","sources":["metadata-representation-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,mDAAmD,CAAC;AASzE;IACE,oDAAiC,sBAA8C;QAA9C,2BAAsB,GAAtB,sBAAsB,CAAwB;IAC/E,CAAC;IAFU,0CAA0C;QAPtD,SAAS,CAAC;YACT,QAAQ,EAAE,yCAAyC;YACnD,QAAQ,EAAE,EAAE;SACb,CAAC;QACF;;WAEG;;QAEY,mBAAA,MAAM,CAAC,IAAI,CAAC,CAAA;;OADd,0CAA0C,CAGtD;IAAD,iDAAC;CAAA,AAHD,IAGC;SAHY,0CAA0C"} \ No newline at end of file diff --git a/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.js b/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.js new file mode 100644 index 0000000000..3cb7ab9598 --- /dev/null +++ b/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model'; +import { Component } from '@angular/core'; +import { MetadataRepresentationListElementComponent } from '../metadata-representation-list-element.component'; +import { DEFAULT_ITEM_TYPE, ItemViewMode, rendersItemType } from '../../../items/item-type-decorator'; +var PlainTextMetadataListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(PlainTextMetadataListElementComponent, _super); + /** + * A component for displaying MetadataRepresentation objects in the form of plain text + * It will simply use the value retrieved from MetadataRepresentation.getValue() to display as plain text + */ + function PlainTextMetadataListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + PlainTextMetadataListElementComponent = tslib_1.__decorate([ + rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Metadata, MetadataRepresentationType.PlainText) + // For now, authority controlled fields are rendered the same way as plain text fields + , + rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Metadata, MetadataRepresentationType.AuthorityControlled), + Component({ + selector: 'ds-plain-text-metadata-list-element', + templateUrl: './plain-text-metadata-list-element.component.html' + }) + /** + * A component for displaying MetadataRepresentation objects in the form of plain text + * It will simply use the value retrieved from MetadataRepresentation.getValue() to display as plain text + */ + ], PlainTextMetadataListElementComponent); + return PlainTextMetadataListElementComponent; +}(MetadataRepresentationListElementComponent)); +export { PlainTextMetadataListElementComponent }; +//# sourceMappingURL=plain-text-metadata-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.js.map b/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.js.map new file mode 100644 index 0000000000..6bfb245e0e --- /dev/null +++ b/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plain-text-metadata-list-element.component.js","sourceRoot":"","sources":["plain-text-metadata-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+EAA+E,CAAC;AAC3H,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,0CAA0C,EAAE,MAAM,mDAAmD,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAatG;IAA2D,iEAA0C;IAJrG;;;OAGG;IACH;;IACA,CAAC;IADY,qCAAqC;QAXjD,eAAe,CAAC,iBAAiB,EAAE,YAAY,CAAC,QAAQ,EAAE,0BAA0B,CAAC,SAAS,CAAC;QAChG,sFAAsF;;QACrF,eAAe,CAAC,iBAAiB,EAAE,YAAY,CAAC,QAAQ,EAAE,0BAA0B,CAAC,mBAAmB,CAAC;QACzG,SAAS,CAAC;YACT,QAAQ,EAAE,qCAAqC;YAC/C,WAAW,EAAE,mDAAmD;SACjE,CAAC;QACF;;;WAGG;OACU,qCAAqC,CACjD;IAAD,4CAAC;CAAA,AADD,CAA2D,0CAA0C,GACpG;SADY,qCAAqC"} \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.js b/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.js new file mode 100644 index 0000000000..b7d1d5b283 --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.js @@ -0,0 +1,57 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { Location, LocationStrategy, PathLocationStrategy } from '@angular/common'; +import { find } from 'rxjs/operators'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component'; +import { isNotUndefined } from '../../../empty.util'; +import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model'; +import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/claimed-task-my-dspace-result.model'; +import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; +import { SetViewMode } from '../../../view-mode'; +/** + * This component renders claimed task object for the mydspace result in the list view. + */ +var ClaimedMyDSpaceResultListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(ClaimedMyDSpaceResultListElementComponent, _super); + function ClaimedMyDSpaceResultListElementComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * A boolean representing if to show submitter information + */ + _this.showSubmitter = true; + /** + * Represent item's status + */ + _this.status = MyDspaceItemStatusType.VALIDATION; + return _this; + } + /** + * Initialize all instance variables + */ + ClaimedMyDSpaceResultListElementComponent.prototype.ngOnInit = function () { + this.initWorkflowItem(this.dso.workflowitem); + }; + /** + * Retrieve workflowitem from result object + */ + ClaimedMyDSpaceResultListElementComponent.prototype.initWorkflowItem = function (wfi$) { + var _this = this; + wfi$.pipe(find(function (rd) { return (rd.hasSucceeded && isNotUndefined(rd.payload)); })).subscribe(function (rd) { + _this.workflowitem = rd.payload; + }); + }; + ClaimedMyDSpaceResultListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-claimed-my-dspace-result-list-element', + styleUrls: ['../my-dspace-result-list-element.component.scss'], + templateUrl: './claimed-my-dspace-result-list-element.component.html', + providers: [Location, { provide: LocationStrategy, useClass: PathLocationStrategy }] + }), + renderElementsFor(ClaimedTaskMyDSpaceResult, SetViewMode.List), + renderElementsFor(ClaimedTask, SetViewMode.List) + ], ClaimedMyDSpaceResultListElementComponent); + return ClaimedMyDSpaceResultListElementComponent; +}(MyDSpaceResultListElementComponent)); +export { ClaimedMyDSpaceResultListElementComponent }; +//# sourceMappingURL=claimed-my-dspace-result-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.js.map b/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.js.map new file mode 100644 index 0000000000..6c4568c70f --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"claimed-my-dspace-result-list-element.component.js","sourceRoot":"","sources":["claimed-my-dspace-result-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAGnF,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAA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AAC;QAC9D,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC;OACpC,yCAAyC,CAkCrD;IAAD,gDAAC;CAAA,AAlCD,CAA+D,kCAAkC,GAkChG;SAlCY,yCAAyC"} \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.js b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.js new file mode 100644 index 0000000000..d7995f6703 --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.js @@ -0,0 +1,44 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Item } from '../../../../core/shared/item.model'; +import { fadeInOut } from '../../../animations/fade'; +import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; +import { MyDSpaceResult } from '../../../../+my-dspace-page/my-dspace-result.model'; +/** + * This component show metadata for the given item object in the list view. + */ +var ItemListPreviewComponent = /** @class */ (function () { + function ItemListPreviewComponent() { + /** + * A boolean representing if to show submitter information + */ + this.showSubmitter = false; + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Item) + ], ItemListPreviewComponent.prototype, "item", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", MyDSpaceResult) + ], ItemListPreviewComponent.prototype, "object", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], ItemListPreviewComponent.prototype, "status", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ItemListPreviewComponent.prototype, "showSubmitter", void 0); + ItemListPreviewComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-list-preview', + styleUrls: ['item-list-preview.component.scss'], + templateUrl: 'item-list-preview.component.html', + animations: [fadeInOut] + }) + ], ItemListPreviewComponent); + return ItemListPreviewComponent; +}()); +export { ItemListPreviewComponent }; +//# sourceMappingURL=item-list-preview.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.js.map b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.js.map new file mode 100644 index 0000000000..64d32eb7c1 --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-list-preview.component.js","sourceRoot":"","sources":["item-list-preview.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mFAAmF,CAAC;AAC3H,OAAO,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AAEpF;;GAEG;AAOH;IANA;QAuBE;;WAEG;QACM,kBAAa,GAAG,KAAK,CAAC;IAEjC,CAAC;IAjBU;QAAR,KAAK,EAAE;0CAAO,IAAI;0DAAC;IAKX;QAAR,KAAK,EAAE;0CAAS,cAAc;4DAAM;IAK5B;QAAR,KAAK,EAAE;;4DAAgC;IAK/B;QAAR,KAAK,EAAE;;mEAAuB;IApBpB,wBAAwB;QANpC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,SAAS,EAAE,CAAC,kCAAkC,CAAC;YAC/C,WAAW,EAAE,kCAAkC;YAC/C,UAAU,EAAE,CAAC,SAAS,CAAC;SACxB,CAAC;OACW,wBAAwB,CAsBpC;IAAD,+BAAC;CAAA,AAtBD,IAsBC;SAtBY,wBAAwB"} \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/item-my-dspace-result/item-my-dspace-result-list-element.component.js b/src/app/shared/object-list/my-dspace-result-list-element/item-my-dspace-result/item-my-dspace-result-list-element.component.js new file mode 100644 index 0000000000..d5ca8c4e14 --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/item-my-dspace-result/item-my-dspace-result-list-element.component.js @@ -0,0 +1,32 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component'; +import { ItemMyDSpaceResult } from '../../../object-collection/shared/item-my-dspace-result.model'; +import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; +import { SetViewMode } from '../../../view-mode'; +/** + * This component renders item object for the mydspace result in the list view. + */ +var ItemMyDSpaceResultListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemMyDSpaceResultListElementComponent, _super); + function ItemMyDSpaceResultListElementComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * Represent item's status + */ + _this.status = MyDspaceItemStatusType.ARCHIVED; + return _this; + } + ItemMyDSpaceResultListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-workspaceitem-my-dspace-result-list-element', + styleUrls: ['../my-dspace-result-list-element.component.scss', './item-my-dspace-result-list-element.component.scss'], + templateUrl: './item-my-dspace-result-list-element.component.html' + }), + renderElementsFor(ItemMyDSpaceResult, SetViewMode.List) + ], ItemMyDSpaceResultListElementComponent); + return ItemMyDSpaceResultListElementComponent; +}(MyDSpaceResultListElementComponent)); +export { ItemMyDSpaceResultListElementComponent }; +//# sourceMappingURL=item-my-dspace-result-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/item-my-dspace-result/item-my-dspace-result-list-element.component.js.map b/src/app/shared/object-list/my-dspace-result-list-element/item-my-dspace-result/item-my-dspace-result-list-element.component.js.map new file mode 100644 index 0000000000..a9a3cadd53 --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/item-my-dspace-result/item-my-dspace-result-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-my-dspace-result-list-element.component.js","sourceRoot":"","sources":["item-my-dspace-result-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAAE,kCAAkC,GAAG,MAAM,4CAA4C,CAAC;AAEjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,+DAA+D,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,mFAAmF,CAAC;AAC3H,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AAQH;IAA4D,kEAA4D;IAPxH;QAAA,qEAcC;QALC;;WAEG;QACI,YAAM,GAAG,sBAAsB,CAAC,QAAQ,CAAC;;IAElD,CAAC;IAPY,sCAAsC;QAPlD,SAAS,CAAC;YACT,QAAQ,EAAE,gDAAgD;YAC1D,SAAS,EAAE,CAAC,iDAAiD,EAAE,qDAAqD,CAAC;YACrH,WAAW,EAAE,qDAAqD;SACnE,CAAC;QAED,iBAAiB,CAAC,kBAAkB,EAAE,WAAW,CAAC,IAAI,CAAC;OAC3C,sCAAsC,CAOlD;IAAD,6CAAC;CAAA,AAPD,CAA4D,kCAAkC,GAO7F;SAPY,sCAAsC"} \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/my-dspace-result-list-element.component.js b/src/app/shared/object-list/my-dspace-result-list-element/my-dspace-result-list-element.component.js new file mode 100644 index 0000000000..4482b5a481 --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/my-dspace-result-list-element.component.js @@ -0,0 +1,51 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; +import { Metadata } from '../../../core/shared/metadata.utils'; +var MyDSpaceResultListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(MyDSpaceResultListElementComponent, _super); + /** + * Initialize instance variables + * + * @param {ListableObject} listable + * @param {number} index + */ + function MyDSpaceResultListElementComponent(listable, index) { + var _this = _super.call(this, listable) || this; + _this.listable = listable; + _this.index = index; + _this.dso = _this.object.indexableObject; + _this.dsoIndex = _this.index; + return _this; + } + /** + * Gets all matching metadata string values from hitHighlights or dso metadata, preferring hitHighlights. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @returns {string[]} the matching string values or an empty array. + */ + MyDSpaceResultListElementComponent.prototype.allMetadataValues = function (keyOrKeys) { + return Metadata.allValues([this.object.hitHighlights, this.dso.metadata], keyOrKeys); + }; + /** + * Gets the first matching metadata string value from hitHighlights or dso metadata, preferring hitHighlights. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @returns {string} the first matching string value, or `undefined`. + */ + MyDSpaceResultListElementComponent.prototype.firstMetadataValue = function (keyOrKeys) { + return Metadata.firstValue([this.object.hitHighlights, this.dso.metadata], keyOrKeys); + }; + MyDSpaceResultListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-my-dspace-result-list-element', + template: "" + }), + tslib_1.__param(0, Inject('objectElementProvider')), + tslib_1.__param(1, Inject('indexElementProvider')), + tslib_1.__metadata("design:paramtypes", [Object, Number]) + ], MyDSpaceResultListElementComponent); + return MyDSpaceResultListElementComponent; +}(AbstractListableElementComponent)); +export { MyDSpaceResultListElementComponent }; +//# sourceMappingURL=my-dspace-result-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/my-dspace-result-list-element.component.js.map b/src/app/shared/object-list/my-dspace-result-list-element/my-dspace-result-list-element.component.js.map new file mode 100644 index 0000000000..dae604983a --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/my-dspace-result-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my-dspace-result-list-element.component.js","sourceRoot":"","sources":["my-dspace-result-list-element.component.ts"],"names":[],"mappings":";AAAA,OAA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ool-my-dspace-result-list-element.component.js b/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.js new file mode 100644 index 0000000000..d14662ebcd --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.js @@ -0,0 +1,60 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { find } from 'rxjs/operators'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component'; +import { isNotUndefined } from '../../../empty.util'; +import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model'; +import { PoolTaskMyDSpaceResult } from '../../../object-collection/shared/pool-task-my-dspace-result.model'; +import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; +import { SetViewMode } from '../../../view-mode'; +/** + * This component renders pool task object for the mydspace result in the list view. + */ +var PoolMyDSpaceResultListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(PoolMyDSpaceResultListElementComponent, _super); + function PoolMyDSpaceResultListElementComponent(listable, index) { + var _this = _super.call(this, listable, index) || this; + _this.listable = listable; + _this.index = index; + /** + * A boolean representing if to show submitter information + */ + _this.showSubmitter = true; + /** + * Represent item's status + */ + _this.status = MyDspaceItemStatusType.WAITING_CONTROLLER; + return _this; + } + /** + * Initialize all instance variables + */ + PoolMyDSpaceResultListElementComponent.prototype.ngOnInit = function () { + this.initWorkflowItem(this.dso.workflowitem); + }; + /** + * Retrieve workflowitem from result object + */ + PoolMyDSpaceResultListElementComponent.prototype.initWorkflowItem = function (wfi$) { + var _this = this; + wfi$.pipe(find(function (rd) { return (rd.hasSucceeded && isNotUndefined(rd.payload)); })).subscribe(function (rd) { + _this.workflowitem = rd.payload; + }); + }; + PoolMyDSpaceResultListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-pool-my-dspace-result-list-element', + styleUrls: ['../my-dspace-result-list-element.component.scss'], + templateUrl: './pool-my-dspace-result-list-element.component.html', + }), + renderElementsFor(PoolTaskMyDSpaceResult, SetViewMode.List), + renderElementsFor(PoolTask, SetViewMode.List), + tslib_1.__param(0, Inject('objectElementProvider')), + tslib_1.__param(1, Inject('indexElementProvider')), + tslib_1.__metadata("design:paramtypes", [Object, Number]) + ], PoolMyDSpaceResultListElementComponent); + return PoolMyDSpaceResultListElementComponent; +}(MyDSpaceResultListElementComponent)); +export { PoolMyDSpaceResultListElementComponent }; +//# sourceMappingURL=pool-my-dspace-result-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.js.map b/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.js.map new file mode 100644 index 0000000000..a67a5fd126 --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pool-my-dspace-result-list-element.component.js","sourceRoot":"","sources":["pool-my-dspace-result-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAU,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAAE,kCAAkC,GAAG,MAAM,4CAA4C,CAAC;AAGjG,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,QAAQ,EAAE,MAAM,sDAAsD,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oEAAoE,CAAC;AAC5G,OAAO,EAAE,sBAAsB,EAAE,MAAM,mFAAmF,CAAC;AAC3H,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AASH;IAA4D,k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workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.js b/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.js new file mode 100644 index 0000000000..3dbd5ebcf6 --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.js @@ -0,0 +1,51 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { find } from 'rxjs/operators'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component'; +import { isNotUndefined } from '../../../empty.util'; +import { WorkflowitemMyDSpaceResult } from '../../../object-collection/shared/workflowitem-my-dspace-result.model'; +import { Workflowitem } from '../../../../core/submission/models/workflowitem.model'; +import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; +import { SetViewMode } from '../../../view-mode'; +/** + * This component renders workflowitem object for the mydspace result in the list view. + */ +var WorkflowitemMyDSpaceResultListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(WorkflowitemMyDSpaceResultListElementComponent, _super); + function WorkflowitemMyDSpaceResultListElementComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * Represent item's status + */ + _this.status = MyDspaceItemStatusType.WORKFLOW; + return _this; + } + /** + * Initialize all instance variables + */ + WorkflowitemMyDSpaceResultListElementComponent.prototype.ngOnInit = function () { + this.initItem(this.dso.item); + }; + /** + * Retrieve item from result object + */ + WorkflowitemMyDSpaceResultListElementComponent.prototype.initItem = function (item$) { + var _this = this; + item$.pipe(find(function (rd) { return rd.hasSucceeded && isNotUndefined(rd.payload); })).subscribe(function (rd) { + _this.item = rd.payload; + }); + }; + WorkflowitemMyDSpaceResultListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-workflowitem-my-dspace-result-list-element', + styleUrls: ['../my-dspace-result-list-element.component.scss'], + templateUrl: './workflowitem-my-dspace-result-list-element.component.html', + }), + renderElementsFor(WorkflowitemMyDSpaceResult, SetViewMode.List), + renderElementsFor(Workflowitem, SetViewMode.List) + ], WorkflowitemMyDSpaceResultListElementComponent); + return WorkflowitemMyDSpaceResultListElementComponent; +}(MyDSpaceResultListElementComponent)); +export { WorkflowitemMyDSpaceResultListElementComponent }; +//# sourceMappingURL=workflowitem-my-dspace-result-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.js.map b/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.js.map new file mode 100644 index 0000000000..cd921c06f2 --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workflowitem-my-dspace-result-list-element.component.js","sourceRoot":"","sources":["workflowitem-my-dspace-result-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAAE,kCAAkC,GAAG,MAAM,4CAA4C,CAAC;AAGjG,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uEAAuE,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,MAAM,uDAAuD,CAAC;AAErF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mFAAmF,CAAC;AAC3H,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AASH;IAAoE,0EAA4E;IARhJ;QAAA,qEAsCC;QAvBC;;WAEG;QACI,YAAM,GAAG,sBAAsB,CAAC,QAAQ,CAAC;;IAoBlD,CAAC;IAlBC;;OAEG;IACH,iEAAQ,GAAR;QACE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAoC,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,iEAAQ,GAAR,UAAS,KAAmC;QAA5C,iBAMC;QALC,KAAK,CAAC,IAAI,CACR,IAAI,CAAC,UAAC,EAAoB,IAAK,OAAA,EAAE,CAAC,YAAY,IAAI,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,EAA7C,CAA6C,CAAC,CAC9E,CAAC,SAAS,CAAC,UAAC,EAAoB;YAC/B,KAAI,CAAC,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IA5BU,8CAA8C;QAR1D,SAAS,CAAC;YACT,QAAQ,EAAE,+CAA+C;YACzD,SAAS,EAAE,CAAC,iDAAiD,CAAC;YAC9D,WAAW,EAAE,6DAA6D;SAC3E,CAAC;QAED,iBAAiB,CAAC,0BAA0B,EAAE,WAAW,CAAC,IAAI,CAAC;QAC/D,iBAAiB,CAAC,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC;OACrC,8CAA8C,CA8B1D;IAAD,qDAAC;CAAA,AA9BD,CAAoE,kCAAkC,GA8BrG;SA9BY,8CAA8C"} \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.js b/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.js new file mode 100644 index 0000000000..7f2410b377 --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.js @@ -0,0 +1,49 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { find } from 'rxjs/operators'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component'; +import { WorkspaceitemMyDSpaceResult } from '../../../object-collection/shared/workspaceitem-my-dspace-result.model'; +import { isNotUndefined } from '../../../empty.util'; +import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; +import { SetViewMode } from '../../../view-mode'; +/** + * This component renders workspaceitem object for the mydspace result in the list view. + */ +var WorkspaceitemMyDSpaceResultListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(WorkspaceitemMyDSpaceResultListElementComponent, _super); + function WorkspaceitemMyDSpaceResultListElementComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * Represent item's status + */ + _this.status = MyDspaceItemStatusType.WORKSPACE; + return _this; + } + /** + * Initialize all instance variables + */ + WorkspaceitemMyDSpaceResultListElementComponent.prototype.ngOnInit = function () { + this.initItem(this.dso.item); + }; + /** + * Retrieve item from result object + */ + WorkspaceitemMyDSpaceResultListElementComponent.prototype.initItem = function (item$) { + var _this = this; + item$.pipe(find(function (rd) { return rd.hasSucceeded && isNotUndefined(rd.payload); })).subscribe(function (rd) { + _this.item = rd.payload; + }); + }; + WorkspaceitemMyDSpaceResultListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-workspaceitem-my-dspace-result-list-element', + styleUrls: ['../my-dspace-result-list-element.component.scss', './workspaceitem-my-dspace-result-list-element.component.scss'], + templateUrl: './workspaceitem-my-dspace-result-list-element.component.html', + }), + renderElementsFor(WorkspaceitemMyDSpaceResult, SetViewMode.List) + ], WorkspaceitemMyDSpaceResultListElementComponent); + return WorkspaceitemMyDSpaceResultListElementComponent; +}(MyDSpaceResultListElementComponent)); +export { WorkspaceitemMyDSpaceResultListElementComponent }; +//# sourceMappingURL=workspaceitem-my-dspace-result-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.js.map b/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.js.map new file mode 100644 index 0000000000..ef3c4f780e --- /dev/null +++ b/src/app/shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"workspaceitem-my-dspace-result-list-element.component.js","sourceRoot":"","sources":["workspaceitem-my-dspace-result-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAAE,kCAAkC,GAAG,MAAM,4CAA4C,CAAC;AAGjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,wEAAwE,CAAC;AAErH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mFAAmF,CAAC;AAC3H,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AAQH;IAAqE,2EAA8E;IAPnJ;QAAA,qEAoCC;QAtBC;;WAEG;QACH,YAAM,GAAG,sBAAsB,CAAC,SAAS,CAAC;;IAmB5C,CAAC;IAjBC;;OAEG;IACH,kEAAQ,GAAR;QACE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAoC,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,kEAAQ,GAAR,UAAS,KAAmC;QAA5C,iBAMC;QALC,KAAK,CAAC,IAAI,CACR,IAAI,CAAC,UAAC,EAAoB,IAAK,OAAA,EAAE,CAAC,YAAY,IAAI,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,EAA7C,CAA6C,CAAC,CAC9E,CAAC,SAAS,CAAC,UAAC,EAAoB;YAC/B,KAAI,CAAC,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IA5BU,+CAA+C;QAP3D,SAAS,CAAC;YACT,QAAQ,EAAE,gDAAgD;YAC1D,SAAS,EAAE,CAAC,iDAAiD,EAAE,8DAA8D,CAAC;YAC9H,WAAW,EAAE,8DAA8D;SAC5E,CAAC;QAED,iBAAiB,CAAC,2BAA2B,EAAE,WAAW,CAAC,IAAI,CAAC;OACpD,+CAA+C,CA6B3D;IAAD,sDAAC;CAAA,AA7BD,CAAqE,kCAAkC,GA6BtG;SA7BY,+CAA+C"} \ No newline at end of file diff --git a/src/app/shared/object-list/object-list.component.js b/src/app/shared/object-list/object-list.component.js new file mode 100644 index 0000000000..84aa1df651 --- /dev/null +++ b/src/app/shared/object-list/object-list.component.js @@ -0,0 +1,127 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; +import { SortOptions } from '../../core/cache/models/sort-options.model'; +import { RemoteData } from '../../core/data/remote-data'; +import { fadeIn } from '../animations/fade'; +import { PaginationComponentOptions } from '../pagination/pagination-component-options.model'; +var ObjectListComponent = /** @class */ (function () { + function ObjectListComponent() { + this.hasBorder = false; + this.hideGear = false; + this.hidePagerWhenSinglePage = true; + /** + * An event fired when the page is changed. + * Event's payload equals to the newly selected page. + */ + this.change = new EventEmitter(); + /** + * An event fired when the page is changed. + * Event's payload equals to the newly selected page. + */ + this.pageChange = new EventEmitter(); + /** + * An event fired when the page wsize is changed. + * Event's payload equals to the newly selected page size. + */ + this.pageSizeChange = new EventEmitter(); + /** + * An event fired when the sort direction is changed. + * Event's payload equals to the newly selected sort direction. + */ + this.sortDirectionChange = new EventEmitter(); + this.paginationChange = new EventEmitter(); + /** + * An event fired when the sort field is changed. + * Event's payload equals to the newly selected sort field. + */ + this.sortFieldChange = new EventEmitter(); + this.data = {}; + } + Object.defineProperty(ObjectListComponent.prototype, "objects", { + get: function () { + return this._objects; + }, + set: function (objects) { + this._objects = objects; + }, + enumerable: true, + configurable: true + }); + ObjectListComponent.prototype.onPageChange = function (event) { + this.pageChange.emit(event); + }; + ObjectListComponent.prototype.onPageSizeChange = function (event) { + this.pageSizeChange.emit(event); + }; + ObjectListComponent.prototype.onSortDirectionChange = function (event) { + this.sortDirectionChange.emit(event); + }; + ObjectListComponent.prototype.onSortFieldChange = function (event) { + this.sortFieldChange.emit(event); + }; + ObjectListComponent.prototype.onPaginationChange = function (event) { + this.paginationChange.emit(event); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", PaginationComponentOptions) + ], ObjectListComponent.prototype, "config", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SortOptions) + ], ObjectListComponent.prototype, "sortConfig", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ObjectListComponent.prototype, "hasBorder", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ObjectListComponent.prototype, "hideGear", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ObjectListComponent.prototype, "hidePagerWhenSinglePage", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", RemoteData), + tslib_1.__metadata("design:paramtypes", [RemoteData]) + ], ObjectListComponent.prototype, "objects", null); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectListComponent.prototype, "change", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectListComponent.prototype, "pageChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectListComponent.prototype, "pageSizeChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectListComponent.prototype, "sortDirectionChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectListComponent.prototype, "paginationChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], ObjectListComponent.prototype, "sortFieldChange", void 0); + ObjectListComponent = tslib_1.__decorate([ + Component({ + changeDetection: ChangeDetectionStrategy.Default, + encapsulation: ViewEncapsulation.Emulated, + selector: 'ds-object-list', + styleUrls: ['./object-list.component.scss'], + templateUrl: './object-list.component.html', + animations: [fadeIn] + }) + ], ObjectListComponent); + return ObjectListComponent; +}()); +export { ObjectListComponent }; +//# sourceMappingURL=object-list.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/object-list.component.js.map b/src/app/shared/object-list/object-list.component.js.map new file mode 100644 index 0000000000..83763343c8 --- /dev/null +++ b/src/app/shared/object-list/object-list.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-list.component.js","sourceRoot":"","sources":["object-list.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,KAAK,EACL,MAAM,EACN,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAiB,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAExF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAU9F;IARA;QAYW,cAAS,GAAG,KAAK,CAAC;QAClB,aAAQ,GAAG,KAAK,CAAC;QACjB,4BAAuB,GAAG,IAAI,CAAC;QAUxC;;;WAGG;QACO,WAAM,GAGX,IAAI,YAAY,EAGjB,CAAC;QAEL;;;WAGG;QACO,eAAU,GAAyB,IAAI,YAAY,EAAU,CAAC;QAExE;;;WAGG;QACO,mBAAc,GAAyB,IAAI,YAAY,EAAU,CAAC;QAE5E;;;WAGG;QACO,wBAAmB,GAAgC,IAAI,YAAY,EAAiB,CAAC;QAErF,qBAAgB,GAAgC,IAAI,YAAY,EAAO,CAAC;QAEl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oEAAoD;IAErF;QAAT,MAAM,EAAE;0CAAmB,YAAY;iEAA0C;IAMxE;QAAT,MAAM,EAAE;0CAAkB,YAAY;gEAAsC;IApDlE,mBAAmB;QAR/B,SAAS,CAAC;YACT,eAAe,EAAE,uBAAuB,CAAC,OAAO;YAChD,aAAa,EAAE,iBAAiB,CAAC,QAAQ;YACzC,QAAQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,CAAC,8BAA8B,CAAC;YAC3C,WAAW,EAAE,8BAA8B;YAC3C,UAAU,EAAE,CAAC,MAAM,CAAC;SACrB,CAAC;OACW,mBAAmB,CA2E/B;IAAD,0BAAC;CAAA,AA3ED,IA2EC;SA3EY,mBAAmB"} \ No newline at end of file diff --git a/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.js b/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.js new file mode 100644 index 0000000000..eaa02851f0 --- /dev/null +++ b/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { SearchResultListElementComponent } from '../search-result-list-element.component'; +import { SetViewMode } from '../../../view-mode'; +import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model'; +var CollectionSearchResultListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(CollectionSearchResultListElementComponent, _super); + function CollectionSearchResultListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + CollectionSearchResultListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-collection-search-result-list-element', + styleUrls: ['../search-result-list-element.component.scss', 'collection-search-result-list-element.component.scss'], + templateUrl: 'collection-search-result-list-element.component.html' + }), + renderElementsFor(CollectionSearchResult, SetViewMode.List) + ], CollectionSearchResultListElementComponent); + return CollectionSearchResultListElementComponent; +}(SearchResultListElementComponent)); +export { CollectionSearchResultListElementComponent }; +//# sourceMappingURL=collection-search-result-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.js.map b/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.js.map new file mode 100644 index 0000000000..39a63f0aac --- /dev/null +++ b/src/app/shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"collection-search-result-list-element.component.js","sourceRoot":"","sources":["collection-search-result-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAE5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAE3F,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kEAAkE,CAAC;AAS1G;IAAgE,sEAAoE;IAApI;;IAAsI,CAAC;IAA1H,0CAA0C;QAPtD,SAAS,CAAC;YACT,QAAQ,EAAE,0CAA0C;YACpD,SAAS,EAAE,CAAC,8CAA8C,EAAE,sDAAsD,CAAC;YACnH,WAAW,EAAE,sDAAsD;SACpE,CAAC;QAED,iBAAiB,CAAC,sBAAsB,EAAE,WAAW,CAAC,IAAI,CAAC;OAC/C,0CAA0C,CAAgF;IAAD,iDAAC;CAAA,AAAvI,CAAgE,gCAAgC,GAAuC;SAA1H,0CAA0C"} \ No newline at end of file diff --git a/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.js b/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.js new file mode 100644 index 0000000000..4af8ec2869 --- /dev/null +++ b/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.js @@ -0,0 +1,23 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { SearchResultListElementComponent } from '../search-result-list-element.component'; +import { SetViewMode } from '../../../view-mode'; +import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model'; +var CommunitySearchResultListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(CommunitySearchResultListElementComponent, _super); + function CommunitySearchResultListElementComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommunitySearchResultListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-community-search-result-list-element', + styleUrls: ['../search-result-list-element.component.scss', 'community-search-result-list-element.component.scss'], + templateUrl: 'community-search-result-list-element.component.html' + }), + renderElementsFor(CommunitySearchResult, SetViewMode.List) + ], CommunitySearchResultListElementComponent); + return CommunitySearchResultListElementComponent; +}(SearchResultListElementComponent)); +export { CommunitySearchResultListElementComponent }; +//# sourceMappingURL=community-search-result-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.js.map b/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.js.map new file mode 100644 index 0000000000..094fe9dd17 --- /dev/null +++ b/src/app/shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community-search-result-list-element.component.js","sourceRoot":"","sources":["community-search-result-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAE5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAE3F,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iEAAiE,CAAC;AASxG;IAA+D,qEAAkE;IAAjI;;IAEA,CAAC;IAFY,yCAAyC;QAPrD,SAAS,CAAC;YACT,QAAQ,EAAE,yCAAyC;YACnD,SAAS,EAAE,CAAC,8CAA8C,EAAE,qDAAqD,CAAC;YAClH,WAAW,EAAE,qDAAqD;SACnE,CAAC;QAED,iBAAiB,CAAC,qBAAqB,EAAE,WAAW,CAAC,IAAI,CAAC;OAC9C,yCAAyC,CAErD;IAAD,gDAAC;CAAA,AAFD,CAA+D,gCAAgC,GAE9F;SAFY,yCAAyC"} \ No newline at end of file diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.js b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.js new file mode 100644 index 0000000000..b6d7e7175f --- /dev/null +++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.js @@ -0,0 +1,28 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { focusBackground } from '../../../animations/focus'; +import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; +import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; +import { SetViewMode } from '../../../view-mode'; +import { SearchResultListElementComponent } from '../search-result-list-element.component'; +import { ItemViewMode } from '../../../items/item-type-decorator'; +var ItemSearchResultListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(ItemSearchResultListElementComponent, _super); + function ItemSearchResultListElementComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.viewMode = ItemViewMode.Element; + return _this; + } + ItemSearchResultListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-item-search-result-list-element', + styleUrls: ['../search-result-list-element.component.scss', 'item-search-result-list-element.component.scss'], + templateUrl: 'item-search-result-list-element.component.html', + animations: [focusBackground], + }), + renderElementsFor(ItemSearchResult, SetViewMode.List) + ], ItemSearchResultListElementComponent); + return ItemSearchResultListElementComponent; +}(SearchResultListElementComponent)); +export { ItemSearchResultListElementComponent }; +//# sourceMappingURL=item-search-result-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.js.map b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.js.map new file mode 100644 index 0000000000..a25b45ae04 --- /dev/null +++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-search-result-list-element.component.js","sourceRoot":"","sources":["item-search-result-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gCAAgC,EAAE,MAAM,yCAAyC,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAWlE;IAA0D,gEAAwD;IATlH;QAAA,qEAYC;QAFC,cAAQ,GAAG,YAAY,CAAC,OAAO,CAAC;;IAElC,CAAC;IAHY,oCAAoC;QAThD,SAAS,CAAC;YACT,QAAQ,EAAE,oCAAoC;YAC9C,SAAS,EAAE,CAAC,8CAA8C,EAAE,gDAAgD,CAAC;YAC7G,WAAW,EAAE,gDAAgD;YAC7D,UAAU,EAAE,CAAC,eAAe,CAAC;SAE9B,CAAC;QAED,iBAAiB,CAAC,gBAAgB,EAAE,WAAW,CAAC,IAAI,CAAC;OACzC,oCAAoC,CAGhD;IAAD,2CAAC;CAAA,AAHD,CAA0D,gCAAgC,GAGzF;SAHY,oCAAoC"} \ No newline at end of file diff --git a/src/app/shared/object-list/search-result-list-element/search-result-list-element.component.js b/src/app/shared/object-list/search-result-list-element/search-result-list-element.component.js new file mode 100644 index 0000000000..de4e3557a3 --- /dev/null +++ b/src/app/shared/object-list/search-result-list-element/search-result-list-element.component.js @@ -0,0 +1,50 @@ +import * as tslib_1 from "tslib"; +import { Component, Inject } from '@angular/core'; +import { hasValue } from '../../empty.util'; +import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; +import { TruncatableService } from '../../truncatable/truncatable.service'; +import { Metadata } from '../../../core/shared/metadata.utils'; +var SearchResultListElementComponent = /** @class */ (function (_super) { + tslib_1.__extends(SearchResultListElementComponent, _super); + function SearchResultListElementComponent(listable, truncatableService) { + var _this = _super.call(this, listable) || this; + _this.listable = listable; + _this.truncatableService = truncatableService; + if (hasValue(_this.object)) { + _this.dso = _this.object.indexableObject; + } + return _this; + } + /** + * Gets all matching metadata string values from hitHighlights or dso metadata, preferring hitHighlights. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @returns {string[]} the matching string values or an empty array. + */ + SearchResultListElementComponent.prototype.allMetadataValues = function (keyOrKeys) { + return Metadata.allValues([this.object.hitHighlights, this.dso.metadata], keyOrKeys); + }; + /** + * Gets the first matching metadata string value from hitHighlights or dso metadata, preferring hitHighlights. + * + * @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]]. + * @returns {string} the first matching string value, or `undefined`. + */ + SearchResultListElementComponent.prototype.firstMetadataValue = function (keyOrKeys) { + return Metadata.firstValue([this.object.hitHighlights, this.dso.metadata], keyOrKeys); + }; + SearchResultListElementComponent.prototype.isCollapsed = function () { + return this.truncatableService.isCollapsed(this.dso.id); + }; + SearchResultListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-result-list-element', + template: "" + }), + tslib_1.__param(0, Inject('objectElementProvider')), + tslib_1.__metadata("design:paramtypes", [Object, TruncatableService]) + ], SearchResultListElementComponent); + return SearchResultListElementComponent; +}(AbstractListableElementComponent)); +export { SearchResultListElementComponent }; +//# sourceMappingURL=search-result-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/search-result-list-element/search-result-list-element.component.js.map b/src/app/shared/object-list/search-result-list-element/search-result-list-element.component.js.map new file mode 100644 index 0000000000..bd607602cf --- /dev/null +++ b/src/app/shared/object-list/search-result-list-element/search-result-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-result-list-element.component.js","sourceRoot":"","sources":["search-result-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKlD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,gCAAgC,EAAE,MAAM,8FAA8F,CAAC;AAChJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAO/D;IAAyG,4DAAmC;IAG1I,0CAA2D,QAAwB,EAAY,kBAAsC;QAArI,YACE,kBAAM,QAAQ,CAAC,SAIhB;QAL0D,cAAQ,GAAR,QAAQ,CAAgB;QAAY,wBAAkB,GAAlB,kBAAkB,CAAoB;QAEnI,IAAI,QAAQ,CAAC,KAAI,CAAC,MAAM,CAAC,EAAE;YACzB,KAAI,CAAC,GAAG,GAAG,KAAI,CAAC,MAAM,CAAC,eAAe,CAAC;SACxC;;IACH,CAAC;IAED;;;;;OAKG;IACH,4DAAiB,GAAjB,UAAkB,SAA4B;QAC5C,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IACvF,CAAC;IAED;;;;;OAKG;IACH,6DAAkB,GAAlB,UAAmB,SAA4B;QAC7C,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IACxF,CAAC;IAED,sDAAW,GAAX;QACE,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;IAhCU,gCAAgC;QAL5C,SAAS,CAAC;YACT,QAAQ,EAAE,+BAA+B;YACzC,QAAQ,EAAE,EAAE;SACb,CAAC;QAKoB,mBAAA,MAAM,CAAC,uBAAuB,CAAC,CAAA;yDAAgE,kBAAkB;OAH1H,gCAAgC,CAiC5C;IAAD,uCAAC;CAAA,AAjCD,CAAyG,gCAAgC,GAiCxI;SAjCY,gCAAgC"} \ No newline at end of file diff --git a/src/app/shared/object-list/wrapper-list-element/wrapper-list-element.component.js b/src/app/shared/object-list/wrapper-list-element/wrapper-list-element.component.js new file mode 100644 index 0000000000..e44c8134cf --- /dev/null +++ b/src/app/shared/object-list/wrapper-list-element/wrapper-list-element.component.js @@ -0,0 +1,42 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector, Input } from '@angular/core'; +import { SetViewMode } from '../../view-mode'; +import { rendersDSOType } from '../../object-collection/shared/dso-element-decorator'; +var WrapperListElementComponent = /** @class */ (function () { + function WrapperListElementComponent(injector) { + this.injector = injector; + } + WrapperListElementComponent.prototype.ngOnInit = function () { + var _this = this; + this.objectInjector = Injector.create({ + providers: [ + { provide: 'objectElementProvider', useFactory: function () { return (_this.object); }, deps: [] }, + { provide: 'indexElementProvider', useFactory: function () { return (_this.index); }, deps: [] } + ], + parent: this.injector + }); + }; + WrapperListElementComponent.prototype.getListElement = function () { + var f = this.object.constructor; + return rendersDSOType(f, SetViewMode.List); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], WrapperListElementComponent.prototype, "object", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Number) + ], WrapperListElementComponent.prototype, "index", void 0); + WrapperListElementComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-wrapper-list-element', + styleUrls: ['./wrapper-list-element.component.scss'], + templateUrl: './wrapper-list-element.component.html' + }), + tslib_1.__metadata("design:paramtypes", [Injector]) + ], WrapperListElementComponent); + return WrapperListElementComponent; +}()); +export { WrapperListElementComponent }; +//# sourceMappingURL=wrapper-list-element.component.js.map \ No newline at end of file diff --git a/src/app/shared/object-list/wrapper-list-element/wrapper-list-element.component.js.map b/src/app/shared/object-list/wrapper-list-element/wrapper-list-element.component.js.map new file mode 100644 index 0000000000..c40024ad26 --- /dev/null +++ b/src/app/shared/object-list/wrapper-list-element/wrapper-list-element.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrapper-list-element.component.js","sourceRoot":"","sources":["wrapper-list-element.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAQrF;IAKE,qCAAoB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IAAG,CAAC;IAE1C,8CAAQ,GAAR;QAAA,iBAQC;QAPC,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;YAClC,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,cAAM,OAAA,CAAC,KAAI,CAAC,MAAM,CAAC,EAAb,CAAa,EAAE,IAAI,EAAC,EAAE,EAAE;gBAC9E,EAAE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,cAAM,OAAA,CAAC,KAAI,CAAC,KAAK,CAAC,EAAZ,CAAY,EAAE,IAAI,EAAC,EAAE,EAAE;aAC7E;YACD,MAAM,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;IACL,CAAC;IAED,oDAAc,GAAd;QACE,IAAM,CAAC,GAAuC,IAAI,CAAC,MAAM,CAAC,WAAiD,CAAC;QAC5G,OAAO,cAAc,CAAC,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAnBQ;QAAR,KAAK,EAAE;;+DAAwB;IACvB;QAAR,KAAK,EAAE;;8DAAe;IAFZ,2BAA2B;QALvC,SAAS,CAAC;YACT,QAAQ,EAAE,yBAAyB;YACnC,SAAS,EAAE,CAAC,uCAAuC,CAAC;YACpD,WAAW,EAAE,uCAAuC;SACrD,CAAC;iDAM8B,QAAQ;OAL3B,2BAA2B,CAqBvC;IAAD,kCAAC;CAAA,AArBD,IAqBC;SArBY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/object.util.js b/src/app/shared/object.util.js new file mode 100644 index 0000000000..cb41492d65 --- /dev/null +++ b/src/app/shared/object.util.js @@ -0,0 +1,58 @@ +import * as tslib_1 from "tslib"; +import { isNotEmpty } from './empty.util'; +import { isEqual, isObject, transform } from 'lodash'; +/** + * Returns passed object without specified property + */ +export function deleteProperty(object, key) { + var _a = key, deletedKey = object[_a], otherKeys = tslib_1.__rest(object, [typeof _a === "symbol" ? _a : _a + ""]); + return otherKeys; +} +/** + * Returns true if the passed object is empty or has only empty property. + * hasOnlyEmptyProperties({}); // true + * hasOnlyEmptyProperties({a: null}); // true + * hasOnlyEmptyProperties({a: []}); // true + * hasOnlyEmptyProperties({a: [], b: {}); // true + * hasOnlyEmptyProperties({a: 'a', b: 'b'}); // false + * hasOnlyEmptyProperties({a: [], b: 'b'}); // false + */ +export function hasOnlyEmptyProperties(obj) { + var objectType = typeof obj; + if (objectType === 'object') { + if (Object.keys(obj).length === 0) { + return true; + } + else { + var result = true; + for (var key in obj) { + if (isNotEmpty(obj[key])) { + result = false; + break; + } + } + return result; + } + } +} +/** + * Returns diff from the base object. + * difference({}, {}); // {} + * difference({a: 'a', b: 'b'}, {a: 'a'}); // {b: 'b'} + * difference({a: 'a', b: {}}, {a: 'a'}); // {} + * difference({a: 'a'}, {a: 'a', b: 'b'}); // {} + */ +export function difference(object, base) { + var changes = function (o, b) { + return transform(o, function (result, value, key) { + if (!isEqual(value, b[key]) && isNotEmpty(value)) { + var resultValue = (isObject(value) && isObject(b[key])) ? changes(value, b[key]) : value; + if (!hasOnlyEmptyProperties(resultValue)) { + result[key] = resultValue; + } + } + }); + }; + return changes(object, base); +} +//# sourceMappingURL=object.util.js.map \ No newline at end of file diff --git a/src/app/shared/object.util.js.map b/src/app/shared/object.util.js.map new file mode 100644 index 0000000000..21c70166b1 --- /dev/null +++ b/src/app/shared/object.util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object.util.js","sourceRoot":"","sources":["object.util.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEtD;;GAEG;AACH,MAAM,yBAAyB,MAAc,EAAE,GAAW;IACxD,IAAO,QAAK,EAAL,uBAAiB,EAAE,2EAAsB,CAAC;IACjD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,iCAAiC,GAAW;IAChD,IAAM,UAAU,GAAG,OAAO,GAAG,CAAC;IAC9B,IAAI,UAAU,KAAK,QAAQ,EAAE;QAC3B,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;YACjC,OAAO,IAAI,CAAC;SACb;aAAM;YACL,IAAI,MAAM,GAAG,IAAI,CAAC;YAClB,KAAK,IAAM,GAAG,IAAI,GAAG,EAAE;gBACrB,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;oBACxB,MAAM,GAAG,KAAK,CAAC;oBACf,MAAM;iBACP;aACF;YACD,OAAO,MAAM,CAAC;SACf;KACF;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,qBAAqB,MAAc,EAAE,IAAY;IACrD,IAAM,OAAO,GAAG,UAAC,CAAC,EAAE,CAAC;QACnB,OAAO,SAAS,CAAC,CAAC,EAAE,UAAC,MAAM,EAAE,KAAK,EAAE,GAAG;YACrC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE;gBAChD,IAAM,WAAW,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;gBAC3F,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,EAAE;oBACxC,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;iBAC3B;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IACF,OAAO,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC/B,CAAC"} \ No newline at end of file diff --git a/src/app/shared/pagination/pagination-component-options.model.js b/src/app/shared/pagination/pagination-component-options.model.js new file mode 100644 index 0000000000..0c638d3eb9 --- /dev/null +++ b/src/app/shared/pagination/pagination-component-options.model.js @@ -0,0 +1,24 @@ +import * as tslib_1 from "tslib"; +import { NgbPaginationConfig } from '@ng-bootstrap/ng-bootstrap'; +var PaginationComponentOptions = /** @class */ (function (_super) { + tslib_1.__extends(PaginationComponentOptions, _super); + function PaginationComponentOptions() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * The active page. + */ + _this.currentPage = 1; + /** + * Maximum number of pages to display. + */ + _this.maxSize = 10; + /** + * A number array that represents options for a context pagination limit. + */ + _this.pageSizeOptions = [1, 5, 10, 20, 40, 60, 80, 100]; + return _this; + } + return PaginationComponentOptions; +}(NgbPaginationConfig)); +export { PaginationComponentOptions }; +//# sourceMappingURL=pagination-component-options.model.js.map \ No newline at end of file diff --git a/src/app/shared/pagination/pagination-component-options.model.js.map b/src/app/shared/pagination/pagination-component-options.model.js.map new file mode 100644 index 0000000000..f4339e7b7e --- /dev/null +++ b/src/app/shared/pagination/pagination-component-options.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pagination-component-options.model.js","sourceRoot":"","sources":["pagination-component-options.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE;IAAgD,sDAAmB;IAAnE;QAAA,qEA2BC;QApBC;;WAEG;QACH,iBAAW,GAAG,CAAC,CAAC;QAEhB;;WAEG;QACH,aAAO,GAAG,EAAE,CAAC;QAEb;;WAEG;QACH,qBAAe,GAAa,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;;IAO9D,CAAC;IAAD,iCAAC;AAAD,CAAC,AA3BD,CAAgD,mBAAmB,GA2BlE"} \ No newline at end of file diff --git a/src/app/shared/pagination/pagination.component.js b/src/app/shared/pagination/pagination.component.js new file mode 100644 index 0000000000..42733d0fc3 --- /dev/null +++ b/src/app/shared/pagination/pagination.component.js @@ -0,0 +1,474 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Observable } from 'rxjs'; +import { isNumeric } from 'rxjs/internal-compatibility'; +import { isEqual, isObject, transform } from 'lodash'; +import { HostWindowService } from '../host-window.service'; +import { PaginationComponentOptions } from './pagination-component-options.model'; +import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; +import { hasValue, isNotEmpty } from '../empty.util'; +import { difference } from '../object.util'; +/** + * The default pagination controls component. + */ +var PaginationComponent = /** @class */ (function () { + /** + * @param route + * Route is a singleton service provided by Angular. + * @param router + * Router is a singleton service provided by Angular. + */ + function PaginationComponent(cdRef, route, router, hostWindowService) { + this.cdRef = cdRef; + this.route = route; + this.router = router; + this.hostWindowService = hostWindowService; + /** + * Page state of a Remote paginated objects. + */ + this.pageInfoState = undefined; + /** + * An event fired when the page is changed. + * Event's payload equals to the newly selected page. + */ + this.pageChange = new EventEmitter(); + /** + * An event fired when the page wsize is changed. + * Event's payload equals to the newly selected page size. + */ + this.pageSizeChange = new EventEmitter(); + /** + * An event fired when the sort direction is changed. + * Event's payload equals to the newly selected sort direction. + */ + this.sortDirectionChange = new EventEmitter(); + /** + * An event fired when the sort field is changed. + * Event's payload equals to the newly selected sort field. + */ + this.sortFieldChange = new EventEmitter(); + /** + * An event fired when the pagination is changed. + * Event's payload equals to the newly selected sort field. + */ + this.paginationChange = new EventEmitter(); + /** + * Option for hiding the pagination detail + */ + this.hidePaginationDetail = false; + /** + * Option for hiding the gear + */ + this.hideGear = false; + /** + * Option for hiding the pager when there is less than 2 pages + */ + this.hidePagerWhenSinglePage = true; + /** + * Current page in the state of a Remote paginated objects. + */ + this.currentPageState = undefined; + /** + * Declare SortDirection enumeration to use it in the template + */ + this.sortDirections = SortDirection; + /** + * Direction in which to sort: ascending or descending + */ + this.sortDirection = SortDirection.ASC; + /** + * Name of the field that's used to sort by + */ + this.sortField = 'id'; + /** + * Array to track all subscriptions and unsubscribe them onDestroy + * @type {Array} + */ + this.subs = []; + } + /** + * Method provided by Angular. Invoked after the constructor. + */ + PaginationComponent.prototype.ngOnInit = function () { + var _this = this; + this.subs.push(this.hostWindowService.isXs() + .subscribe(function (status) { + _this.isXs = status; + _this.cdRef.markForCheck(); + })); + this.checkConfig(this.paginationOptions); + this.initializeConfig(); + // Listen to changes + this.subs.push(this.route.queryParams + .subscribe(function (queryParams) { + if (_this.isEmptyPaginationParams(queryParams)) { + _this.initializeConfig(queryParams); + } + else { + _this.currentQueryParams = queryParams; + var fixedProperties = _this.validateParams(queryParams); + if (isNotEmpty(fixedProperties)) { + _this.fixRoute(fixedProperties); + } + else { + _this.setFields(); + } + } + })); + }; + PaginationComponent.prototype.fixRoute = function (fixedProperties) { + this.updateRoute(fixedProperties); + }; + /** + * Method provided by Angular. Invoked when the instance is destroyed. + */ + PaginationComponent.prototype.ngOnDestroy = function () { + this.subs + .filter(function (sub) { return hasValue(sub); }) + .forEach(function (sub) { return sub.unsubscribe(); }); + }; + /** + * Initializes all default variables + */ + PaginationComponent.prototype.initializeConfig = function (queryParams) { + if (queryParams === void 0) { queryParams = {}; } + // Set initial values + this.id = this.paginationOptions.id || null; + this.pageSizeOptions = this.paginationOptions.pageSizeOptions; + this.currentPage = this.paginationOptions.currentPage; + this.pageSize = this.paginationOptions.pageSize; + if (this.sortOptions) { + this.sortDirection = this.sortOptions.direction; + this.sortField = this.sortOptions.field; + } + this.currentQueryParams = Object.assign({}, queryParams, { + pageId: this.id, + page: this.currentPage, + pageSize: this.pageSize, + sortDirection: this.sortDirection, + sortField: this.sortField + }); + }; + /** + * Method to change the route to the given page + * + * @param page + * The page being navigated to. + */ + PaginationComponent.prototype.doPageChange = function (page) { + this.updateRoute({ page: page.toString() }); + }; + /** + * Method to change the route to the given page size + * + * @param pageSize + * The page size being navigated to. + */ + PaginationComponent.prototype.doPageSizeChange = function (pageSize) { + this.updateRoute({ page: 1, pageSize: pageSize }); + }; + /** + * Method to change the route to the given sort direction + * + * @param sortDirection + * The sort direction being navigated to. + */ + PaginationComponent.prototype.doSortDirectionChange = function (sortDirection) { + this.updateRoute({ page: 1, sortDirection: sortDirection }); + }; + /** + * Method to change the route to the given sort field + * + * @param sortField + * The sort field being navigated to. + */ + PaginationComponent.prototype.doSortFieldChange = function (field) { + this.updateRoute({ page: 1, sortField: field }); + }; + /** + * Method to set the current page and trigger page change events + * + * @param page + * The new page value + */ + PaginationComponent.prototype.setPage = function (page) { + this.currentPage = page; + this.pageChange.emit(page); + this.emitPaginationChange(); + }; + /** + * Method to set the current page size and trigger page size change events + * + * @param pageSize + * The new page size value. + */ + PaginationComponent.prototype.setPageSize = function (pageSize) { + this.pageSize = pageSize; + this.pageSizeChange.emit(pageSize); + this.emitPaginationChange(); + }; + /** + * Method to set the current sort direction and trigger sort direction change events + * + * @param sortDirection + * The new sort directionvalue. + */ + PaginationComponent.prototype.setSortDirection = function (sortDirection) { + this.sortDirection = sortDirection; + this.sortDirectionChange.emit(sortDirection); + this.emitPaginationChange(); + }; + /** + * Method to set the current sort field and trigger sort field change events + * + * @param sortField + * The new sort field. + */ + PaginationComponent.prototype.setSortField = function (field) { + this.sortField = field; + this.sortFieldChange.emit(field); + this.emitPaginationChange(); + }; + /** + * Method to emit a general pagination change event + */ + PaginationComponent.prototype.emitPaginationChange = function () { + this.paginationChange.emit({ + pageId: this.id, + page: this.currentPage, + pageSize: this.pageSize, + sortDirection: this.sortDirection, + sortField: this.sortField + }); + }; + /** + * Method to update the route parameters + */ + PaginationComponent.prototype.updateRoute = function (params) { + if (isNotEmpty(difference(params, this.currentQueryParams))) { + this.router.navigate([], { + queryParams: Object.assign({}, this.currentQueryParams, params), + queryParamsHandling: 'merge' + }); + } + }; + PaginationComponent.prototype.difference = function (object, base) { + var changes = function (o, b) { + return transform(o, function (result, value, key) { + if (!isEqual(value, b[key]) && isNotEmpty(value)) { + result[key] = (isObject(value) && isObject(b[key])) ? changes(value, b[key]) : value; + } + }); + }; + return changes(object, base); + }; + /** + * Method to get pagination details of the current viewed page. + */ + PaginationComponent.prototype.getShowingDetails = function (collectionSize) { + var showingDetails = { range: null + ' - ' + null, total: null }; + if (collectionSize) { + var firstItem = void 0; + var lastItem = void 0; + var pageMax = this.pageSize * this.currentPage; + firstItem = this.pageSize * (this.currentPage - 1) + 1; + if (collectionSize > pageMax) { + lastItem = pageMax; + } + else { + lastItem = collectionSize; + } + showingDetails = { range: firstItem + ' - ' + lastItem, total: collectionSize }; + } + return showingDetails; + }; + /** + * Method to validate query params + * + * @param page + * The page number to validate + * @param pageSize + * The page size to validate + * @returns valid parameters if initial parameters were invalid + */ + PaginationComponent.prototype.validateParams = function (params) { + var validPage = this.validatePage(params.page); + var filteredSize = this.validatePageSize(params.pageSize); + var fixedFields = {}; + if (+params.page !== validPage) { + fixedFields.page = validPage.toString(); + } + if (+params.pageSize !== filteredSize) { + fixedFields.pageSize = filteredSize.toString(); + } + return fixedFields; + }; + /** + * Method to update all pagination variables to the current query parameters + */ + PaginationComponent.prototype.setFields = function () { + // (+) converts string to a number + var page = this.currentQueryParams.page; + if (this.currentPage !== +page) { + this.setPage(+page); + } + var pageSize = this.currentQueryParams.pageSize; + if (this.pageSize !== +pageSize) { + this.setPageSize(+pageSize); + } + var sortDirection = this.currentQueryParams.sortDirection; + if (this.sortDirection !== sortDirection) { + this.setSortDirection(sortDirection); + } + var sortField = this.currentQueryParams.sortField; + if (this.sortField !== sortField) { + this.setSortField(sortField); + } + this.cdRef.detectChanges(); + }; + /** + * Method to validate the current page value + * + * @param page + * The page number to validate + * @returns returns valid page value + */ + PaginationComponent.prototype.validatePage = function (page) { + var result = this.currentPage; + if (isNumeric(page)) { + result = +page; + } + return result; + }; + /** + * Method to validate the current page size value + * + * @param page size + * The page size to validate + * @returns returns valid page size value + */ + PaginationComponent.prototype.validatePageSize = function (pageSize) { + var filteredPageSize = this.pageSizeOptions.find(function (x) { return x === +pageSize; }); + var result = this.pageSize; + if (filteredPageSize) { + result = +pageSize; + } + return result; + }; + /** + * Method to ensure options passed contains the required properties. + * + * @param paginateOptions + * The paginate options object. + */ + PaginationComponent.prototype.checkConfig = function (paginateOptions) { + var required = ['id', 'currentPage', 'pageSize', 'pageSizeOptions']; + var missing = required.filter(function (prop) { + return !(prop in paginateOptions); + }); + if (0 < missing.length) { + throw new Error('Paginate: Argument is missing the following required properties: ' + missing.join(', ')); + } + }; + /** + * Method to check if none of the query params necessary for pagination are filled out. + * + * @param paginateOptions + * The paginate options object. + */ + PaginationComponent.prototype.isEmptyPaginationParams = function (paginateOptions) { + var properties = ['id', 'currentPage', 'pageSize', 'pageSizeOptions']; + var missing = properties.filter(function (prop) { + return !(prop in paginateOptions); + }); + return properties.length === missing.length; + }; + Object.defineProperty(PaginationComponent.prototype, "hasMultiplePages", { + /** + * Property to check whether the current pagination object has multiple pages + * @returns true if there are multiple pages, else returns false + */ + get: function () { + return this.collectionSize > this.pageSize; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PaginationComponent.prototype, "shouldShowBottomPager", { + /** + * Property to check whether the current pagination should show a bottom pages + * @returns true if a bottom pages should be shown, else returns false + */ + get: function () { + return this.hasMultiplePages || !this.hidePagerWhenSinglePage; + }, + enumerable: true, + configurable: true + }); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Number) + ], PaginationComponent.prototype, "collectionSize", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Observable) + ], PaginationComponent.prototype, "pageInfoState", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", PaginationComponentOptions) + ], PaginationComponent.prototype, "paginationOptions", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SortOptions) + ], PaginationComponent.prototype, "sortOptions", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], PaginationComponent.prototype, "pageChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], PaginationComponent.prototype, "pageSizeChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], PaginationComponent.prototype, "sortDirectionChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], PaginationComponent.prototype, "sortFieldChange", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], PaginationComponent.prototype, "paginationChange", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], PaginationComponent.prototype, "hidePaginationDetail", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], PaginationComponent.prototype, "hideGear", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], PaginationComponent.prototype, "hidePagerWhenSinglePage", void 0); + PaginationComponent = tslib_1.__decorate([ + Component({ + exportAs: 'paginationComponent', + selector: 'ds-pagination', + styleUrls: ['pagination.component.scss'], + templateUrl: 'pagination.component.html', + changeDetection: ChangeDetectionStrategy.Default, + encapsulation: ViewEncapsulation.Emulated + }), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef, + ActivatedRoute, + Router, + HostWindowService]) + ], PaginationComponent); + return PaginationComponent; +}()); +export { PaginationComponent }; +//# sourceMappingURL=pagination.component.js.map \ No newline at end of file diff --git a/src/app/shared/pagination/pagination.component.js.map b/src/app/shared/pagination/pagination.component.js.map new file mode 100644 index 0000000000..27fb45c1ef --- /dev/null +++ b/src/app/shared/pagination/pagination.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pagination.component.js","sourceRoot":"","sources":["pagination.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,uBAAuB,EAAE,iBAAiB,EAC1C,SAAS,EACT,YAAY,EACZ,KAAK,EAGL,MAAM,EACN,iBAAiB,EAClB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAgB,UAAU,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AASH;IA+LE;;;;;OAKG;IACH,6BAAoB,KAAwB,EACxB,KAAqB,EACrB,MAAc,EACf,iBAAoC;QAHnC,UAAK,GAAL,KAAK,CAAmB;QACxB,UAAK,GAAL,KA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B,SAAS,EAAE,CAAC,2BAA2B,CAAC;YACxC,WAAW,EAAE,2BAA2B;YACxC,eAAe,EAAE,uBAAuB,CAAC,OAAO;YAChD,aAAa,EAAE,iBAAiB,CAAC,QAAQ;SAC1C,CAAC;iDAsM2B,iBAAiB;YACjB,cAAc;YACb,MAAM;YACI,iBAAiB;OAxM5C,mBAAmB,CA2d/B;IAAD,0BAAC;CAAA,AA3dD,IA2dC;SA3dY,mBAAmB"} \ No newline at end of file diff --git a/src/app/shared/roles/role.directive.js b/src/app/shared/roles/role.directive.js new file mode 100644 index 0000000000..3fd3b17650 --- /dev/null +++ b/src/app/shared/roles/role.directive.js @@ -0,0 +1,100 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core'; +import { combineLatest } from 'rxjs'; +import { filter, first, map } from 'rxjs/operators'; +import { hasValue } from '../empty.util'; +import { RoleService } from '../../core/roles/role.service'; +var RoleDirective = /** @class */ (function () { + function RoleDirective(roleService, viewContainer, changeDetector, templateRef) { + this.roleService = roleService; + this.viewContainer = viewContainer; + this.changeDetector = changeDetector; + this.templateRef = templateRef; + this.subs = []; + } + RoleDirective.prototype.ngOnChanges = function (changes) { + var onlyChanges = changes.dsShowOnlyForRole; + var exceptChanges = changes.dsShowExceptForRole; + this.hasRoles(this.dsShowOnlyForRole); + if (changes.dsShowOnlyForRole) { + this.validateOnly(); + } + else if (changes.dsShowExceptForRole) { + this.validateExcept(); + } + }; + RoleDirective.prototype.ngOnDestroy = function () { + this.subs + .filter(function (subscription) { return hasValue(subscription); }) + .forEach(function (subscription) { return subscription.unsubscribe(); }); + }; + /** + * Show template in view container + */ + RoleDirective.prototype.showTemplateBlockInView = function () { + this.viewContainer.clear(); + if (!this.templateRef) { + return; + } + this.viewContainer.createEmbeddedView(this.templateRef); + this.changeDetector.markForCheck(); + }; + /** + * Validate the list of roles that can show template + */ + RoleDirective.prototype.validateOnly = function () { + var _this = this; + this.subs.push(this.hasRoles(this.dsShowOnlyForRole).pipe(filter(function (hasRole) { return hasRole; })) + .subscribe(function (hasRole) { + _this.showTemplateBlockInView(); + })); + }; + /** + * Validate the list of roles that cannot show template + */ + RoleDirective.prototype.validateExcept = function () { + var _this = this; + this.subs.push(this.hasRoles(this.dsShowExceptForRole).pipe(filter(function (hasRole) { return !hasRole; })) + .subscribe(function (hasRole) { + _this.showTemplateBlockInView(); + })); + }; + /** + * Check if current user role is included in the specified role list + * + * @param roles + * The role or the list of roles + * @returns {Observable} + * observable of true if current user role is included in the specified role list, observable of false otherwise + */ + RoleDirective.prototype.hasRoles = function (roles) { + var _this = this; + var toValidate = (Array.isArray(roles)) ? roles : [roles]; + var checks = toValidate.map(function (role) { return _this.roleService.checkRole(role); }); + return combineLatest(checks).pipe(map(function (permissions) { return permissions.includes(true); }), first()); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], RoleDirective.prototype, "dsShowOnlyForRole", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], RoleDirective.prototype, "dsShowExceptForRole", void 0); + RoleDirective = tslib_1.__decorate([ + Directive({ + selector: '[dsShowOnlyForRole],[dsShowExceptForRole]' + }) + /** + * Structural Directive for showing or hiding a template based on current user role + */ + , + tslib_1.__metadata("design:paramtypes", [RoleService, + ViewContainerRef, + ChangeDetectorRef, + TemplateRef]) + ], RoleDirective); + return RoleDirective; +}()); +export { RoleDirective }; +//# sourceMappingURL=role.directive.js.map \ No newline at end of file diff --git a/src/app/shared/roles/role.directive.js.map b/src/app/shared/roles/role.directive.js.map new file mode 100644 index 0000000000..ce1aac9a29 --- /dev/null +++ b/src/app/shared/roles/role.directive.js.map @@ -0,0 +1 @@ +{"version":3,"file":"role.directive.js","sourceRoot":"","sources":["role.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,KAAK,EAIL,WAAW,EACX,gBAAgB,EACjB,MAAM,eAAe,CAAC;AA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WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAA1B,CAA0B,CAAC,EAC3D,KAAK,EAAE,CACR,CAAA;IACH,CAAC;IAnFQ;QAAR,KAAK,EAAE;;4DAA0C;IAKzC;QAAR,KAAK,EAAE;;8DAA4C;IAVzC,aAAa;QANzB,SAAS,CAAC;YACT,QAAQ,EAAE,2CAA2C;SACtD,CAAC;QACF;;WAEG;;iDAgBsB,WAAW;YACT,gBAAgB;YACf,iBAAiB;YACpB,WAAW;OAlBvB,aAAa,CAyFzB;IAAD,oBAAC;CAAA,AAzFD,IAyFC;SAzFY,aAAa"} \ No newline at end of file diff --git a/src/app/shared/sass-helper/sass-helper.actions.js b/src/app/shared/sass-helper/sass-helper.actions.js new file mode 100644 index 0000000000..7a9d38293e --- /dev/null +++ b/src/app/shared/sass-helper/sass-helper.actions.js @@ -0,0 +1,21 @@ +import { type } from '../../shared/ngrx/type'; +/** + * For each action type in an action group, make a simple + * enum object for all of this group's action types. + * + * The 'type' utility function coerces strings into string + * literal types and runs a simple check to guarantee all + * action types in the application are unique. + */ +export var CSSVariableActionTypes = { + ADD: type('dspace/css-variables/ADD'), +}; +var AddCSSVariableAction = /** @class */ (function () { + function AddCSSVariableAction(name, value) { + this.type = CSSVariableActionTypes.ADD; + this.payload = { name: name, value: value }; + } + return AddCSSVariableAction; +}()); +export { AddCSSVariableAction }; +//# sourceMappingURL=sass-helper.actions.js.map \ No newline at end of file diff --git a/src/app/shared/sass-helper/sass-helper.actions.js.map b/src/app/shared/sass-helper/sass-helper.actions.js.map new file mode 100644 index 0000000000..985d85f0c2 --- /dev/null +++ b/src/app/shared/sass-helper/sass-helper.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sass-helper.actions.js","sourceRoot":"","sources":["sass-helper.actions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,sBAAsB,GAAG;IACpC,GAAG,EAAE,IAAI,CAAC,0BAA0B,CAAC;CACtC,CAAC;AAEF;IAOE,8BAAY,IAAY,EAAE,KAAa;QANvC,SAAI,GAAG,sBAAsB,CAAC,GAAG,CAAC;QAOhC,IAAI,CAAC,OAAO,GAAG,EAAC,IAAI,MAAA,EAAE,KAAK,OAAA,EAAC,CAAC;IAC/B,CAAC;IACH,2BAAC;AAAD,CAAC,AAVD,IAUC"} \ No newline at end of file diff --git a/src/app/shared/sass-helper/sass-helper.reducer.js b/src/app/shared/sass-helper/sass-helper.reducer.js new file mode 100644 index 0000000000..ded67b34d9 --- /dev/null +++ b/src/app/shared/sass-helper/sass-helper.reducer.js @@ -0,0 +1,17 @@ +import { CSSVariableActionTypes } from './sass-helper.actions'; +var initialState = Object.create({}); +export function cssVariablesReducer(state, action) { + if (state === void 0) { state = initialState; } + var _a; + switch (action.type) { + case CSSVariableActionTypes.ADD: { + var variable = action.payload; + var t = Object.assign({}, state, (_a = {}, _a[variable.name] = variable.value, _a)); + return t; + } + default: { + return state; + } + } +} +//# sourceMappingURL=sass-helper.reducer.js.map \ No newline at end of file diff --git a/src/app/shared/sass-helper/sass-helper.reducer.js.map b/src/app/shared/sass-helper/sass-helper.reducer.js.map new file mode 100644 index 0000000000..1788e4abd1 --- /dev/null +++ b/src/app/shared/sass-helper/sass-helper.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sass-helper.reducer.js","sourceRoot":"","sources":["sass-helper.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAMlF,IAAM,YAAY,GAAsB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE1D,MAAM,8BAA8B,KAAoB,EAAE,MAAyB;IAA/C,sBAAA,EAAA,oBAAoB;;IACtD,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,sBAAsB,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC;YAChC,IAAM,CAAC,GAAI,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,YAAI,GAAC,QAAQ,CAAC,IAAI,IAAG,QAAQ,CAAC,KAAK,MAAG,CAAC;YACzE,OAAO,CAAC,CAAC;SACV;QACD,OAAO,CAAC,CAAC;YACP,OAAO,KAAK,CAAC;SACd;KACF;AACH,CAAC"} \ No newline at end of file diff --git a/src/app/shared/sass-helper/sass-helper.service.js b/src/app/shared/sass-helper/sass-helper.service.js new file mode 100644 index 0000000000..9892dc138d --- /dev/null +++ b/src/app/shared/sass-helper/sass-helper.service.js @@ -0,0 +1,33 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { keySelector } from '../../app.reducer'; +import { select, Store } from '@ngrx/store'; +import { GLOBAL_CONFIG } from '../../../config'; +import { AddCSSVariableAction } from './sass-helper.actions'; +var CSSVariableService = /** @class */ (function () { + function CSSVariableService(store, EnvConfig) { + this.store = store; + this.EnvConfig = EnvConfig; + } + CSSVariableService.prototype.addCSSVariable = function (name, value) { + this.store.dispatch(new AddCSSVariableAction(name, value)); + }; + CSSVariableService.prototype.getVariable = function (name) { + return this.store.pipe(select(themeVariableByNameSelector(name))); + }; + CSSVariableService.prototype.getAllVariables = function () { + return this.store.pipe(select(themeVariablesSelector)); + }; + CSSVariableService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(1, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Store, Object]) + ], CSSVariableService); + return CSSVariableService; +}()); +export { CSSVariableService }; +var themeVariablesSelector = function (state) { return state.cssVariables; }; +var themeVariableByNameSelector = function (name) { + return keySelector(name, themeVariablesSelector); +}; +//# sourceMappingURL=sass-helper.service.js.map \ No newline at end of file diff --git a/src/app/shared/sass-helper/sass-helper.service.js.map b/src/app/shared/sass-helper/sass-helper.service.js.map new file mode 100644 index 0000000000..b417fc3d5a --- /dev/null +++ b/src/app/shared/sass-helper/sass-helper.service.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AsB,CAAC,CAAC;AAC3D,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/search-form/search-form.component.js b/src/app/shared/search-form/search-form.component.js new file mode 100644 index 0000000000..fc82d1c1dd --- /dev/null +++ b/src/app/shared/search-form/search-form.component.js @@ -0,0 +1,103 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Router } from '@angular/router'; +import { isNotEmpty } from '../empty.util'; +import { SearchService } from '../../+search-page/search-service/search.service'; +/** + * This component renders a simple item page. + * The route parameter 'id' is used to request the item it represents. + * All fields of the item that should be displayed, are defined in its template. + */ +var SearchFormComponent = /** @class */ (function () { + function SearchFormComponent(router, searchService) { + this.router = router; + this.searchService = searchService; + /** + * The currently selected scope object's UUID + */ + this.scope = ''; + } + /** + * Updates the search when the form is submitted + * @param data Values submitted using the form + */ + SearchFormComponent.prototype.onSubmit = function (data) { + this.updateSearch(data); + }; + /** + * Updates the search when the current scope has been changed + * @param {string} scope The new scope + */ + SearchFormComponent.prototype.onScopeChange = function (scope) { + this.updateSearch({ scope: scope }); + }; + /** + * Updates the search URL + * @param data Updated parameters + */ + SearchFormComponent.prototype.updateSearch = function (data) { + this.router.navigate(this.getSearchLinkParts(), { + queryParams: Object.assign({}, { page: 1 }, data), + queryParamsHandling: 'merge' + }); + }; + /** + * For usage of the isNotEmpty function in the template + */ + SearchFormComponent.prototype.isNotEmpty = function (object) { + return isNotEmpty(object); + }; + /** + * @returns {string} The base path to the search page, or the current page when inPlaceSearch is true + */ + SearchFormComponent.prototype.getSearchLink = function () { + if (this.inPlaceSearch) { + return './'; + } + return this.searchService.getSearchLink(); + }; + /** + * @returns {string[]} The base path to the search page, or the current page when inPlaceSearch is true, split in separate pieces + */ + SearchFormComponent.prototype.getSearchLinkParts = function () { + if (this.inPlaceSearch) { + return []; + } + return this.getSearchLink().split('/'); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SearchFormComponent.prototype, "query", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchFormComponent.prototype, "inPlaceSearch", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SearchFormComponent.prototype, "scope", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SearchFormComponent.prototype, "currentUrl", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], SearchFormComponent.prototype, "scopes", void 0); + SearchFormComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-search-form', + styleUrls: ['./search-form.component.scss'], + templateUrl: './search-form.component.html' + }) + /** + * Component that represents the search form + */ + , + tslib_1.__metadata("design:paramtypes", [Router, SearchService]) + ], SearchFormComponent); + return SearchFormComponent; +}()); +export { SearchFormComponent }; +//# sourceMappingURL=search-form.component.js.map \ No newline at end of file diff --git a/src/app/shared/search-form/search-form.component.js.map b/src/app/shared/search-form/search-form.component.js.map new file mode 100644 index 0000000000..c8793162da --- /dev/null +++ b/src/app/shared/search-form/search-form.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-form.component.js","sourceRoot":"","sources":["search-form.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAY,UAAU,EAAE,MAAM,eAAe,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AAEjF;;;;GAIG;AAWH;IAwBE,6BAAoB,MAAc,EAAU,aAA4B;QAApD,WAAM,GAAN,MAAM,CAAQ;QAAU,kBAAa,GAAb,aAAa,CAAe;QAbxE;;WAEG;QAEH,UAAK,GAAG,EAAE,CAAC;IAUX,CAAC;IAED;;;OAGG;IACH,sCAAQ,GAAR,UAAS,IAAS;QAChB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED;;;O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hFD,IAgFC;SAhFY,mBAAmB"} \ No newline at end of file diff --git a/src/app/shared/services/api.service.js b/src/app/shared/services/api.service.js new file mode 100644 index 0000000000..d78b7ad3d4 --- /dev/null +++ b/src/app/shared/services/api.service.js @@ -0,0 +1,26 @@ +import * as tslib_1 from "tslib"; +import { throwError as observableThrowError } from 'rxjs'; +import { catchError } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +var ApiService = /** @class */ (function () { + function ApiService(_http) { + this._http = _http; + } + /** + * whatever domain/feature method name + */ + ApiService.prototype.get = function (url, options) { + return this._http.get(url, options).pipe(catchError(function (err) { + console.log('Error: ', err); + return observableThrowError(err); + })); + }; + ApiService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [HttpClient]) + ], ApiService); + return ApiService; +}()); +export { ApiService }; +//# sourceMappingURL=api.service.js.map \ No newline at end of file diff --git a/src/app/shared/services/api.service.js.map b/src/app/shared/services/api.service.js.map new file mode 100644 index 0000000000..a21ec466b0 --- /dev/null +++ b/src/app/shared/services/api.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"api.service.js","sourceRoot":"","sources":["api.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD;IACE,oBAAmB,KAAiB;QAAjB,UAAK,GAAL,KAAK,CAAY;IAEpC,CAAC;IAED;;OAEG;IACH,wBAAG,GAAH,UAAI,GAAW,EAAE,OAAa;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CACtC,UAAU,CAAC,UAAC,GAAG;YACb,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;YAC5B,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAdU,UAAU;QADtB,UAAU,EAAE;iDAEe,UAAU;OADzB,UAAU,CAgBtB;IAAD,iBAAC;CAAA,AAhBD,IAgBC;SAhBY,UAAU"} \ No newline at end of file diff --git a/src/app/shared/services/client-cookie.service.js b/src/app/shared/services/client-cookie.service.js new file mode 100644 index 0000000000..d225b6abdc --- /dev/null +++ b/src/app/shared/services/client-cookie.service.js @@ -0,0 +1,30 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { getJSON, remove, set } from 'js-cookie'; +import { CookieService } from './cookie.service'; +var ClientCookieService = /** @class */ (function (_super) { + tslib_1.__extends(ClientCookieService, _super); + function ClientCookieService() { + return _super !== null && _super.apply(this, arguments) || this; + } + ClientCookieService.prototype.set = function (name, value, options) { + set(name, value, options); + this.updateSource(); + }; + ClientCookieService.prototype.remove = function (name, options) { + remove(name, options); + this.updateSource(); + }; + ClientCookieService.prototype.get = function (name) { + return getJSON(name); + }; + ClientCookieService.prototype.getAll = function () { + return getJSON(); + }; + ClientCookieService = tslib_1.__decorate([ + Injectable() + ], ClientCookieService); + return ClientCookieService; +}(CookieService)); +export { ClientCookieService }; +//# sourceMappingURL=client-cookie.service.js.map \ No newline at end of file diff --git a/src/app/shared/services/client-cookie.service.js.map b/src/app/shared/services/client-cookie.service.js.map new file mode 100644 index 0000000000..bcd6aef675 --- /dev/null +++ b/src/app/shared/services/client-cookie.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"client-cookie.service.js","sourceRoot":"","sources":["client-cookie.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAoB,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAClE,OAAO,EAAE,aAAa,EAAkB,MAAM,kBAAkB,CAAC;AAGjE;IAAyC,+CAAa;IAAtD;;IAmBA,CAAC;IAjBQ,iCAAG,GAAV,UAAW,IAAY,EAAE,KAAU,EAAE,OAA0B;QAC7D,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC1B,IAAI,CAAC,YAAY,EAAE,CAAA;IACrB,CAAC;IAEM,oCAAM,GAAb,UAAc,IAAY,EAAE,OAA0B;QACpD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACtB,IAAI,CAAC,YAAY,EAAE,CAAA;IACrB,CAAC;IAEM,iCAAG,GAAV,UAAW,IAAY;QACrB,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC;IAEM,oCAAM,GAAb;QACE,OAAO,OAAO,EAAE,CAAA;IAClB,CAAC;IAlBU,mBAAmB;QAD/B,UAAU,EAAE;OACA,mBAAmB,CAmB/B;IAAD,0BAAC;CAAA,AAnBD,CAAyC,aAAa,GAmBrD;SAnBY,mBAAmB"} \ No newline at end of file diff --git a/src/app/shared/services/cookie.service.js b/src/app/shared/services/cookie.service.js new file mode 100644 index 0000000000..bf19204af1 --- /dev/null +++ b/src/app/shared/services/cookie.service.js @@ -0,0 +1,22 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { REQUEST } from '@nguniversal/express-engine/tokens'; +import { Subject } from 'rxjs'; +var CookieService = /** @class */ (function () { + function CookieService(req) { + this.req = req; + this.cookieSource = new Subject(); + this.cookies$ = this.cookieSource.asObservable(); + } + CookieService.prototype.updateSource = function () { + this.cookieSource.next(this.getAll()); + }; + CookieService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(REQUEST)), + tslib_1.__metadata("design:paramtypes", [Object]) + ], CookieService); + return CookieService; +}()); +export { CookieService }; +//# sourceMappingURL=cookie.service.js.map \ No newline at end of file diff --git a/src/app/shared/services/cookie.service.js.map b/src/app/shared/services/cookie.service.js.map new file mode 100644 index 0000000000..da3db155d2 --- /dev/null +++ b/src/app/shared/services/cookie.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cookie.service.js","sourceRoot":"","sources":["cookie.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAE5D,OAAO,EAAE,OAAO,EAAgB,MAAM,MAAM,CAAA;AAgB5C;IAIE,uBAAuC,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;QAH5B,iBAAY,GAAG,IAAI,OAAO,EAAmC,CAAC;QACjE,aAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;IAG5D,CAAC;IAUS,oCAAY,GAAtB;QACE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACxC,CAAC;IAjBmB,aAAa;QADlC,UAAU,EAAE;QAKE,mBAAA,MAAM,CAAC,OAAO,CAAC,CAAA;;OAJR,aAAa,CAkBlC;IAAD,oBAAC;CAAA,AAlBD,IAkBC;SAlBqB,aAAa"} \ No newline at end of file diff --git a/src/app/shared/services/route.service.js b/src/app/shared/services/route.service.js new file mode 100644 index 0000000000..fe0420e858 --- /dev/null +++ b/src/app/shared/services/route.service.js @@ -0,0 +1,114 @@ +import * as tslib_1 from "tslib"; +import { distinctUntilChanged, filter, map, mergeMap } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { ActivatedRoute, NavigationEnd, Router, } from '@angular/router'; +import { select, Store } from '@ngrx/store'; +import { isEqual } from 'lodash'; +import { AddUrlToHistoryAction } from '../history/history.actions'; +import { historySelector } from '../history/selectors'; +/** + * Service to keep track of the current query parameters + */ +var RouteService = /** @class */ (function () { + function RouteService(route, router, store) { + this.route = route; + this.router = router; + this.store = store; + this.subscribeToRouterParams(); + } + /** + * Retrieves all query parameter values based on a parameter name + * @param paramName The name of the parameter to look for + */ + RouteService.prototype.getQueryParameterValues = function (paramName) { + return this.getQueryParamMap().pipe(map(function (params) { return params.getAll(paramName).slice(); }), distinctUntilChanged(function (a, b) { return JSON.stringify(a) === JSON.stringify(b); })); + }; + /** + * Retrieves a single query parameter values based on a parameter name + * @param paramName The name of the parameter to look for + */ + RouteService.prototype.getQueryParameterValue = function (paramName) { + return this.getQueryParamMap().pipe(map(function (params) { return params.get(paramName); }), distinctUntilChanged()); + }; + /** + * Checks if the query parameter currently exists in the route + * @param paramName The name of the parameter to look for + */ + RouteService.prototype.hasQueryParam = function (paramName) { + return this.getQueryParamMap().pipe(map(function (params) { return params.has(paramName); }), distinctUntilChanged()); + }; + /** + * Checks if the query parameter with a specific value currently exists in the route + * @param paramName The name of the parameter to look for + * @param paramValue The value of the parameter to look for + */ + RouteService.prototype.hasQueryParamWithValue = function (paramName, paramValue) { + return this.getQueryParamMap().pipe(map(function (params) { return params.getAll(paramName).indexOf(paramValue) > -1; }), distinctUntilChanged()); + }; + RouteService.prototype.getRouteParameterValue = function (paramName) { + return this.params.pipe(map(function (params) { return params[paramName]; }), distinctUntilChanged()); + }; + RouteService.prototype.getRouteDataValue = function (datafield) { + return this.route.data.pipe(map(function (data) { return data[datafield]; }), distinctUntilChanged()); + }; + /** + * Retrieves all query parameters of which the parameter name starts with the given prefix + * @param prefix The prefix of the parameter name to look for + */ + RouteService.prototype.getQueryParamsWithPrefix = function (prefix) { + return this.getQueryParamMap().pipe(map(function (qparams) { + var params = {}; + qparams.keys + .filter(function (key) { return key.startsWith(prefix); }) + .forEach(function (key) { + params[key] = qparams.getAll(key).slice(); + }); + return params; + }), distinctUntilChanged(function (a, b) { return JSON.stringify(a) === JSON.stringify(b); })); + }; + RouteService.prototype.getQueryParamMap = function () { + var _this = this; + return this.route.queryParamMap.pipe(map(function (paramMap) { + var snapshot = _this.router.routerState.snapshot; + // Due to an Angular bug, sometimes change of QueryParam is not detected so double checks with route snapshot + if (!isEqual(paramMap, snapshot.root.queryParamMap)) { + return snapshot.root.queryParamMap; + } + else { + return paramMap; + } + })); + }; + RouteService.prototype.saveRouting = function () { + var _this = this; + this.router.events + .pipe(filter(function (event) { return event instanceof NavigationEnd; })) + .subscribe(function (_a) { + var urlAfterRedirects = _a.urlAfterRedirects; + _this.store.dispatch(new AddUrlToHistoryAction(urlAfterRedirects)); + }); + }; + RouteService.prototype.subscribeToRouterParams = function () { + var _this = this; + this.params = this.router.events.pipe(mergeMap(function (event) { + var active = _this.route; + while (active.firstChild) { + active = active.firstChild; + } + return active.params; + })); + }; + RouteService.prototype.getHistory = function () { + return this.store.pipe(select(historySelector)); + }; + RouteService.prototype.getPreviousUrl = function () { + return this.getHistory().pipe(map(function (history) { return history[history.length - 2] || ''; })); + }; + RouteService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [ActivatedRoute, Router, Store]) + ], RouteService); + return RouteService; +}()); +export { RouteService }; +//# sourceMappingURL=route.service.js.map \ No newline at end of file diff --git a/src/app/shared/services/route.service.js.map b/src/app/shared/services/route.service.js.map new file mode 100644 index 0000000000..dc5b08a762 --- /dev/null +++ b/src/app/shared/services/route.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"route.service.js","sourceRoot":"","sources":["route.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,aAAa,EAEb,MAAM,GAEP,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD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E,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAC3B,GAAG,CAAC,UAAC,OAAiB,IAAK,OAAA,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,EAAjC,CAAiC,CAAC,CAC9D,CAAC;IACJ,CAAC;IAzHU,YAAY;QADxB,UAAU,EAAE;iDAIgB,cAAc,EAAkB,MAAM,EAAiB,KAAK;OAH5E,YAAY,CA0HxB;IAAD,mBAAC;CAAA,AA1HD,IA0HC;SA1HY,YAAY"} \ No newline at end of file diff --git a/src/app/shared/services/server-cookie.service.js b/src/app/shared/services/server-cookie.service.js new file mode 100644 index 0000000000..44512df6c0 --- /dev/null +++ b/src/app/shared/services/server-cookie.service.js @@ -0,0 +1,34 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { CookieService } from './cookie.service'; +var ServerCookieService = /** @class */ (function (_super) { + tslib_1.__extends(ServerCookieService, _super); + function ServerCookieService() { + return _super !== null && _super.apply(this, arguments) || this; + } + ServerCookieService.prototype.set = function (name, value, options) { + return; + }; + ServerCookieService.prototype.remove = function (name, options) { + return; + }; + ServerCookieService.prototype.get = function (name) { + try { + return JSON.parse(this.req.cookies[name]); + } + catch (err) { + return this.req ? this.req.cookies[name] : undefined; + } + }; + ServerCookieService.prototype.getAll = function () { + if (this.req) { + return this.req.cookies; + } + }; + ServerCookieService = tslib_1.__decorate([ + Injectable() + ], ServerCookieService); + return ServerCookieService; +}(CookieService)); +export { ServerCookieService }; +//# sourceMappingURL=server-cookie.service.js.map \ No newline at end of file diff --git a/src/app/shared/services/server-cookie.service.js.map b/src/app/shared/services/server-cookie.service.js.map new file mode 100644 index 0000000000..1638d226bf --- /dev/null +++ b/src/app/shared/services/server-cookie.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"server-cookie.service.js","sourceRoot":"","sources":["server-cookie.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAkB,MAAM,kBAAkB,CAAC;AAGjE;IAAyC,+CAAa;IAAtD;;IAuBA,CAAC;IArBQ,iCAAG,GAAV,UAAW,IAAY,EAAE,KAAU,EAAE,OAA0B;QAC7D,OAAM;IACR,CAAC;IAEM,oCAAM,GAAb,UAAc,IAAY,EAAE,OAA0B;QACpD,OAAM;IACR,CAAC;IAEM,iCAAG,GAAV,UAAW,IAAY;QACrB,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;SAC1C;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;SACrD;IACH,CAAC;IAEM,oCAAM,GAAb;QACE,IAAI,IAAI,CAAC,GAAG,EAAE;YACZ,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAA;SACxB;IACH,CAAC;IAtBU,mBAAmB;QAD/B,UAAU,EAAE;OACA,mBAAmB,CAuB/B;IAAD,0BAAC;CAAA,AAvBD,CAAyC,aAAa,GAuBrD;SAvBY,mBAAmB"} \ No newline at end of file diff --git a/src/app/shared/services/server-response.service.js b/src/app/shared/services/server-response.service.js new file mode 100644 index 0000000000..d8be5626e8 --- /dev/null +++ b/src/app/shared/services/server-response.service.js @@ -0,0 +1,29 @@ +import * as tslib_1 from "tslib"; +import { RESPONSE } from '@nguniversal/express-engine/tokens'; +import { Inject, Injectable, Optional } from '@angular/core'; +var ServerResponseService = /** @class */ (function () { + function ServerResponseService(response) { + this.response = response; + } + ServerResponseService.prototype.setStatus = function (code, message) { + if (this.response) { + this.response.statusCode = code; + if (message) { + this.response.statusMessage = message; + } + } + return this; + }; + ServerResponseService.prototype.setNotFound = function (message) { + if (message === void 0) { message = 'Not found'; } + return this.setStatus(404, message); + }; + ServerResponseService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Optional()), tslib_1.__param(0, Inject(RESPONSE)), + tslib_1.__metadata("design:paramtypes", [Object]) + ], ServerResponseService); + return ServerResponseService; +}()); +export { ServerResponseService }; +//# sourceMappingURL=server-response.service.js.map \ No newline at end of file diff --git a/src/app/shared/services/server-response.service.js.map b/src/app/shared/services/server-response.service.js.map new file mode 100644 index 0000000000..aef0de2b97 --- /dev/null +++ b/src/app/shared/services/server-response.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"server-response.service.js","sourceRoot":"","sources":["server-response.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI7D;IAGE,+BAA0C,QAAa;QACrD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,yCAAS,GAAT,UAAU,IAAY,EAAE,OAAgB;QACtC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC;YAChC,IAAI,OAAO,EAAE;gBACX,IAAI,CAAC,QAAQ,CAAC,aAAa,GAAG,OAAO,CAAC;aACvC;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,2CAAW,GAAX,UAAY,OAAqB;QAArB,wBAAA,EAAA,qBAAqB;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC;IAnBU,qBAAqB;QADjC,UAAU,EAAE;QAIE,mBAAA,QAAQ,EAAE,CAAA,EAAE,mBAAA,MAAM,CAAC,QAAQ,CAAC,CAAA;;OAH9B,qBAAqB,CAoBjC;IAAD,4BAAC;CAAA,AApBD,IAoBC;SApBY,qBAAqB"} \ No newline at end of file diff --git a/src/app/shared/services/window.service.js b/src/app/shared/services/window.service.js new file mode 100644 index 0000000000..5adbaf64e4 --- /dev/null +++ b/src/app/shared/services/window.service.js @@ -0,0 +1,24 @@ +import { InjectionToken } from '@angular/core'; +export var NativeWindowService = new InjectionToken('NativeWindowService'); +var NativeWindowRef = /** @class */ (function () { + function NativeWindowRef() { + } + Object.defineProperty(NativeWindowRef.prototype, "nativeWindow", { + get: function () { + if (typeof window !== 'undefined') { + return window; + } + else { + return false; + } + }, + enumerable: true, + configurable: true + }); + return NativeWindowRef; +}()); +export { NativeWindowRef }; +export function NativeWindowFactory() { + return new NativeWindowRef(); +} +//# sourceMappingURL=window.service.js.map \ No newline at end of file diff --git a/src/app/shared/services/window.service.js.map b/src/app/shared/services/window.service.js.map new file mode 100644 index 0000000000..6653f09be2 --- /dev/null +++ b/src/app/shared/services/window.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"window.service.js","sourceRoot":"","sources":["window.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,CAAC,IAAM,mBAAmB,GAAG,IAAI,cAAc,CAAC,qBAAqB,CAAC,CAAC;AAE7E;IAAA;IAQA,CAAC;IAPC,sBAAI,yCAAY;aAAhB;YACE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;gBACjC,OAAO,MAAM,CAAC;aACf;iBAAM;gBACL,OAAO,KAAK,CAAC;aACd;QACH,CAAC;;;OAAA;IACH,sBAAC;AAAD,CAAC,AARD,IAQC;;AAED,MAAM;IACJ,OAAO,IAAI,eAAe,EAAE,CAAC;AAC/B,CAAC"} \ No newline at end of file diff --git a/src/app/shared/shared.module.js b/src/app/shared/shared.module.js new file mode 100644 index 0000000000..3e53dae222 --- /dev/null +++ b/src/app/shared/shared.module.js @@ -0,0 +1,350 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { RouterModule } from '@angular/router'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { NouisliderModule } from 'ng2-nouislider'; +import { NgbDatepickerModule, NgbModule, NgbTimepickerModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgxPaginationModule } from 'ngx-pagination'; +import { ItemTypeSwitcherComponent } from './items/switcher/item-type-switcher.component'; +import { OrgUnitMetadataListElementComponent } from './object-list/item-list-element/item-types/orgunit/orgunit-metadata-list-element.component'; +import { TypedItemSearchResultListElementComponent } from './object-list/item-list-element/item-types/typed-item-search-result-list-element.component'; +import { PublicationListElementComponent } from './object-list/item-list-element/item-types/publication/publication-list-element.component'; +import { OrgUnitListElementComponent } from './object-list/item-list-element/item-types/orgunit/orgunit-list-element.component'; +import { PersonListElementComponent } from './object-list/item-list-element/item-types/person/person-list-element.component'; +import { ProjectListElementComponent } from './object-list/item-list-element/item-types/project/project-list-element.component'; +import { JournalListElementComponent } from './object-list/item-list-element/item-types/journal/journal-list-element.component'; +import { JournalVolumeListElementComponent } from './object-list/item-list-element/item-types/journal-volume/journal-volume-list-element.component'; +import { JournalIssueListElementComponent } from './object-list/item-list-element/item-types/journal-issue/journal-issue-list-element.component'; +import { FileUploadModule } from 'ng2-file-upload'; +import { InfiniteScrollModule } from 'ngx-infinite-scroll'; +import { EnumKeysPipe } from './utils/enum-keys-pipe'; +import { FileSizePipe } from './utils/file-size-pipe'; +import { SafeUrlPipe } from './utils/safe-url-pipe'; +import { ConsolePipe } from './utils/console.pipe'; +import { CollectionListElementComponent } from './object-list/collection-list-element/collection-list-element.component'; +import { CommunityListElementComponent } from './object-list/community-list-element/community-list-element.component'; +import { ItemListElementComponent } from './object-list/item-list-element/item-list-element.component'; +import { SearchResultListElementComponent } from './object-list/search-result-list-element/search-result-list-element.component'; +import { WrapperListElementComponent } from './object-list/wrapper-list-element/wrapper-list-element.component'; +import { ObjectListComponent } from './object-list/object-list.component'; +import { CollectionGridElementComponent } from './object-grid/collection-grid-element/collection-grid-element.component'; +import { CommunityGridElementComponent } from './object-grid/community-grid-element/community-grid-element.component'; +import { ItemGridElementComponent } from './object-grid/item-grid-element/item-grid-element.component'; +import { AbstractListableElementComponent } from './object-collection/shared/object-collection-element/abstract-listable-element.component'; +import { WrapperGridElementComponent } from './object-grid/wrapper-grid-element/wrapper-grid-element.component'; +import { ObjectGridComponent } from './object-grid/object-grid.component'; +import { ObjectCollectionComponent } from './object-collection/object-collection.component'; +import { ComcolPageContentComponent } from './comcol-page-content/comcol-page-content.component'; +import { ComcolPageHeaderComponent } from './comcol-page-header/comcol-page-header.component'; +import { ComcolPageLogoComponent } from './comcol-page-logo/comcol-page-logo.component'; +import { ErrorComponent } from './error/error.component'; +import { LoadingComponent } from './loading/loading.component'; +import { PaginationComponent } from './pagination/pagination.component'; +import { ThumbnailComponent } from '../thumbnail/thumbnail.component'; +import { SearchFormComponent } from './search-form/search-form.component'; +import { SearchResultGridElementComponent } from './object-grid/search-result-grid-element/search-result-grid-element.component'; +import { ViewModeSwitchComponent } from './view-mode-switch/view-mode-switch.component'; +import { GridThumbnailComponent } from './object-grid/grid-thumbnail/grid-thumbnail.component'; +import { VarDirective } from './utils/var.directive'; +import { LogInComponent } from './log-in/log-in.component'; +import { AuthNavMenuComponent } from './auth-nav-menu/auth-nav-menu.component'; +import { LogOutComponent } from './log-out/log-out.component'; +import { FormComponent } from './form/form.component'; +import { DsDynamicTypeaheadComponent } from './form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component'; +import { DsDynamicScrollableDropdownComponent } from './form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component'; +import { DsDynamicFormControlContainerComponent, dsDynamicFormControlMapFn } from './form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component'; +import { DsDynamicFormComponent } from './form/builder/ds-dynamic-form-ui/ds-dynamic-form.component'; +import { DYNAMIC_FORM_CONTROL_MAP_FN, DynamicFormsCoreModule } from '@ng-dynamic-forms/core'; +import { DynamicFormsNGBootstrapUIModule } from '@ng-dynamic-forms/ui-ng-bootstrap'; +import { TextMaskModule } from 'angular2-text-mask'; +import { DragClickDirective } from './utils/drag-click.directive'; +import { TruncatePipe } from './utils/truncate.pipe'; +import { TruncatableComponent } from './truncatable/truncatable.component'; +import { TruncatableService } from './truncatable/truncatable.service'; +import { TruncatablePartComponent } from './truncatable/truncatable-part/truncatable-part.component'; +import { UploaderComponent } from './uploader/uploader.component'; +import { ChipsComponent } from './chips/chips.component'; +import { DsDynamicTagComponent } from './form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component'; +import { DsDynamicListComponent } from './form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component'; +import { DsDynamicFormGroupComponent } from './form/builder/ds-dynamic-form-ui/models/form-group/dynamic-form-group.component'; +import { DsDynamicFormArrayComponent } from './form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component'; +import { DsDynamicRelationGroupComponent } from './form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components'; +import { DsDatePickerInlineComponent } from './form/builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component'; +import { SortablejsModule } from 'angular-sortablejs'; +import { NumberPickerComponent } from './number-picker/number-picker.component'; +import { DsDatePickerComponent } from './form/builder/ds-dynamic-form-ui/models/date-picker/date-picker.component'; +import { DsDynamicLookupComponent } from './form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component'; +import { MockAdminGuard } from './mocks/mock-admin-guard.service'; +import { AlertComponent } from './alert/alert.component'; +import { MyDSpaceResultListElementComponent } from './object-list/my-dspace-result-list-element/my-dspace-result-list-element.component'; +import { MyDSpaceResultDetailElementComponent } from './object-detail/my-dspace-result-detail-element/my-dspace-result-detail-element.component'; +import { ClaimedTaskActionsComponent } from './mydspace-actions/claimed-task/claimed-task-actions.component'; +import { PoolTaskActionsComponent } from './mydspace-actions/pool-task/pool-task-actions.component'; +import { ObjectDetailComponent } from './object-detail/object-detail.component'; +import { WrapperDetailElementComponent } from './object-detail/wrapper-detail-element/wrapper-detail-element.component'; +import { ItemDetailPreviewComponent } from './object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component'; +import { MyDSpaceItemStatusComponent } from './object-collection/shared/mydspace-item-status/my-dspace-item-status.component'; +import { WorkspaceitemActionsComponent } from './mydspace-actions/workspaceitem/workspaceitem-actions.component'; +import { WorkflowitemActionsComponent } from './mydspace-actions/workflowitem/workflowitem-actions.component'; +import { ItemSubmitterComponent } from './object-collection/shared/mydspace-item-submitter/item-submitter.component'; +import { ItemActionsComponent } from './mydspace-actions/item/item-actions.component'; +import { ClaimedTaskActionsApproveComponent } from './mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component'; +import { ClaimedTaskActionsRejectComponent } from './mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component'; +import { ObjNgFor } from './utils/object-ngfor.pipe'; +import { BrowseByComponent } from './browse-by/browse-by.component'; +import { BrowseEntryListElementComponent } from './object-list/browse-entry-list-element/browse-entry-list-element.component'; +import { DebounceDirective } from './utils/debounce.directive'; +import { ClickOutsideDirective } from './utils/click-outside.directive'; +import { EmphasizePipe } from './utils/emphasize.pipe'; +import { InputSuggestionsComponent } from './input-suggestions/input-suggestions.component'; +import { CapitalizePipe } from './utils/capitalize.pipe'; +import { ObjectKeysPipe } from './utils/object-keys-pipe'; +import { MomentModule } from 'ngx-moment'; +import { AuthorityConfidenceStateDirective } from './authority-confidence/authority-confidence-state.directive'; +import { MenuModule } from './menu/menu.module'; +import { LangSwitchComponent } from './lang-switch/lang-switch.component'; +import { PlainTextMetadataListElementComponent } from './object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component'; +import { ItemMetadataListElementComponent } from './object-list/metadata-representation-list-element/item/item-metadata-list-element.component'; +import { TooltipModule } from 'ngx-bootstrap'; +import { PersonMetadataListElementComponent } from './object-list/item-list-element/item-types/person/person-metadata-list-element.component'; +import { MetadataRepresentationListElementComponent } from './object-list/metadata-representation-list-element/metadata-representation-list-element.component'; +import { ComColFormComponent } from './comcol-forms/comcol-form/comcol-form.component'; +import { CreateComColPageComponent } from './comcol-forms/create-comcol-page/create-comcol-page.component'; +import { EditComColPageComponent } from './comcol-forms/edit-comcol-page/edit-comcol-page.component'; +import { DeleteComColPageComponent } from './comcol-forms/delete-comcol-page/delete-comcol-page.component'; +import { ObjectValuesPipe } from './utils/object-values-pipe'; +import { InListValidator } from './utils/in-list-validator.directive'; +import { AutoFocusDirective } from './utils/auto-focus.directive'; +import { ComcolPageBrowseByComponent } from './comcol-page-browse-by/comcol-page-browse-by.component'; +import { StartsWithDateComponent } from './starts-with/date/starts-with-date.component'; +import { StartsWithTextComponent } from './starts-with/text/starts-with-text.component'; +import { DSOSelectorComponent } from './dso-selector/dso-selector/dso-selector.component'; +import { CreateCommunityParentSelectorComponent } from './dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component'; +import { CreateItemParentSelectorComponent } from './dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component'; +import { CreateCollectionParentSelectorComponent } from './dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component'; +import { CommunitySearchResultListElementComponent } from './object-list/search-result-list-element/community-search-result/community-search-result-list-element.component'; +import { CollectionSearchResultListElementComponent } from './object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component'; +import { ItemSearchResultListElementComponent } from './object-list/search-result-list-element/item-search-result/item-search-result-list-element.component'; +import { EditItemSelectorComponent } from './dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component'; +import { EditCommunitySelectorComponent } from './dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component'; +import { EditCollectionSelectorComponent } from './dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component'; +import { ItemListPreviewComponent } from './object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component'; +import { MetadataFieldWrapperComponent } from '../+item-page/field-components/metadata-field-wrapper/metadata-field-wrapper.component'; +import { MetadataValuesComponent } from '../+item-page/field-components/metadata-values/metadata-values.component'; +import { RoleDirective } from './roles/role.directive'; +import { UserMenuComponent } from './auth-nav-menu/user-menu/user-menu.component'; +import { ClaimedTaskActionsReturnToPoolComponent } from './mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component'; +import { ItemDetailPreviewFieldComponent } from './object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component'; +var MODULES = [ + // Do NOT include UniversalModule, HttpModule, or JsonpModule here + CommonModule, + SortablejsModule, + DynamicFormsCoreModule, + DynamicFormsNGBootstrapUIModule, + FileUploadModule, + FormsModule, + InfiniteScrollModule, + NgbModule, + NgbDatepickerModule, + NgbTimepickerModule, + NgbTypeaheadModule, + NgxPaginationModule, + ReactiveFormsModule, + RouterModule, + TranslateModule, + NouisliderModule, + MomentModule, + TextMaskModule, + MenuModule +]; +var ROOT_MODULES = [ + TooltipModule.forRoot() +]; +var PIPES = [ + // put shared pipes here + EnumKeysPipe, + FileSizePipe, + SafeUrlPipe, + TruncatePipe, + EmphasizePipe, + CapitalizePipe, + ObjectKeysPipe, + ObjectValuesPipe, + ConsolePipe, + ObjNgFor +]; +var COMPONENTS = [ + // put shared components here + AlertComponent, + AuthNavMenuComponent, + UserMenuComponent, + ChipsComponent, + ComcolPageContentComponent, + ComcolPageHeaderComponent, + ComcolPageLogoComponent, + ComColFormComponent, + CreateComColPageComponent, + EditComColPageComponent, + DeleteComColPageComponent, + ComcolPageBrowseByComponent, + DsDynamicFormComponent, + DsDynamicFormControlContainerComponent, + DsDynamicListComponent, + DsDynamicLookupComponent, + DsDynamicScrollableDropdownComponent, + DsDynamicTagComponent, + DsDynamicTypeaheadComponent, + DsDynamicRelationGroupComponent, + DsDatePickerComponent, + DsDynamicFormGroupComponent, + DsDynamicFormArrayComponent, + DsDatePickerInlineComponent, + ErrorComponent, + FormComponent, + LangSwitchComponent, + LoadingComponent, + LogInComponent, + LogOutComponent, + NumberPickerComponent, + ObjectListComponent, + ObjectDetailComponent, + ObjectGridComponent, + AbstractListableElementComponent, + WrapperListElementComponent, + WrapperDetailElementComponent, + WrapperGridElementComponent, + ObjectCollectionComponent, + PaginationComponent, + SearchFormComponent, + ThumbnailComponent, + GridThumbnailComponent, + UploaderComponent, + WrapperListElementComponent, + ItemListPreviewComponent, + MyDSpaceItemStatusComponent, + ItemSubmitterComponent, + ItemDetailPreviewComponent, + ItemDetailPreviewFieldComponent, + ClaimedTaskActionsComponent, + ClaimedTaskActionsApproveComponent, + ClaimedTaskActionsRejectComponent, + ClaimedTaskActionsReturnToPoolComponent, + ItemActionsComponent, + PoolTaskActionsComponent, + WorkflowitemActionsComponent, + WorkspaceitemActionsComponent, + ViewModeSwitchComponent, + TruncatableComponent, + TruncatablePartComponent, + BrowseByComponent, + InputSuggestionsComponent, + DSOSelectorComponent, + CreateCommunityParentSelectorComponent, + CreateCollectionParentSelectorComponent, + CreateItemParentSelectorComponent, + EditCommunitySelectorComponent, + EditCollectionSelectorComponent, + EditItemSelectorComponent, + CommunitySearchResultListElementComponent, + CollectionSearchResultListElementComponent, + ItemSearchResultListElementComponent, + TypedItemSearchResultListElementComponent, + ItemTypeSwitcherComponent, + BrowseByComponent +]; +var ENTRY_COMPONENTS = [ + // put shared entry components (components that are created dynamically) here + ItemListElementComponent, + CollectionListElementComponent, + CommunityListElementComponent, + MyDSpaceResultListElementComponent, + SearchResultListElementComponent, + CommunitySearchResultListElementComponent, + CollectionSearchResultListElementComponent, + ItemSearchResultListElementComponent, + ItemGridElementComponent, + CollectionGridElementComponent, + CommunityGridElementComponent, + SearchResultGridElementComponent, + PublicationListElementComponent, + PersonListElementComponent, + PersonMetadataListElementComponent, + OrgUnitMetadataListElementComponent, + OrgUnitListElementComponent, + ProjectListElementComponent, + JournalListElementComponent, + JournalVolumeListElementComponent, + JournalIssueListElementComponent, + BrowseEntryListElementComponent, + MyDSpaceResultDetailElementComponent, + SearchResultGridElementComponent, + DsDynamicListComponent, + DsDynamicLookupComponent, + DsDynamicScrollableDropdownComponent, + DsDynamicTagComponent, + DsDynamicTypeaheadComponent, + DsDynamicRelationGroupComponent, + DsDatePickerComponent, + DsDynamicFormGroupComponent, + DsDynamicFormArrayComponent, + DsDatePickerInlineComponent, + StartsWithDateComponent, + StartsWithTextComponent, + DSOSelectorComponent, + CreateCommunityParentSelectorComponent, + CreateCollectionParentSelectorComponent, + CreateItemParentSelectorComponent, + EditCommunitySelectorComponent, + EditCollectionSelectorComponent, + EditItemSelectorComponent, + StartsWithTextComponent, + PlainTextMetadataListElementComponent, + ItemMetadataListElementComponent, + MetadataRepresentationListElementComponent +]; +var SHARED_ITEM_PAGE_COMPONENTS = [ + MetadataFieldWrapperComponent, + MetadataValuesComponent, +]; +var PROVIDERS = [ + TruncatableService, + MockAdminGuard, + { + provide: DYNAMIC_FORM_CONTROL_MAP_FN, + useValue: dsDynamicFormControlMapFn + } +]; +var DIRECTIVES = [ + VarDirective, + DragClickDirective, + DebounceDirective, + ClickOutsideDirective, + AuthorityConfidenceStateDirective, + InListValidator, + AutoFocusDirective, + RoleDirective +]; +var SharedModule = /** @class */ (function () { + /** + * This module handles all components and pipes that need to be shared among multiple other modules + */ + function SharedModule() { + } + SharedModule = tslib_1.__decorate([ + NgModule({ + imports: MODULES.concat(ROOT_MODULES), + declarations: PIPES.concat(COMPONENTS, DIRECTIVES, ENTRY_COMPONENTS, SHARED_ITEM_PAGE_COMPONENTS), + providers: PROVIDERS.slice(), + exports: MODULES.concat(PIPES, COMPONENTS, SHARED_ITEM_PAGE_COMPONENTS, DIRECTIVES), + entryComponents: ENTRY_COMPONENTS.slice() + }) + /** + * This module handles all components and pipes that need to be shared among multiple other modules + */ + ], SharedModule); + return SharedModule; +}()); +export { SharedModule }; +//# sourceMappingURL=shared.module.js.map \ No newline at end of file diff --git a/src/app/shared/shared.module.js.map b/src/app/shared/shared.module.js.map new file mode 100644 index 0000000000..bd5ebff6ef --- /dev/null +++ b/src/app/shared/shared.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"shared.module.js","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;CAC3C,CAAC;AAEF,IAAM,2BAA2B,GAAG;IAClC,6BAA6B;IAC7B,uBAAuB;CACxB,CAAC;AAEF,IAAM,SAAS,GAAG;IAChB,kBAAkB;IAClB,cAAc;IACd;QACE,OAAO,EAAE,2BAA2B;QACpC,QAAQ,EAAE,yBAAyB;KACpC;CACF,CAAC;AAEF,IAAM,UAAU,GAAG;IACjB,YAAY;IACZ,kBAAkB;IAClB,iBAAiB;IACjB,qBAAqB;IACrB,iCAAiC;IACjC,eAAe;IACf,kBAAkB;IAClB,aAAa;CACd,CAAC;AAgCF;IAHA;;OAEG;IACH;IAEA,CAAC;IAFY,YAAY;QA9BxB,QAAQ,CAAC;YACR,OAAO,EACF,OAAO,QACP,YAAY,CAChB;YACD,YAAY,EACP,KAAK,QACL,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,2BAA2B,CAC/B;YACD,SAAS,EACJ,SAAS,QACb;YACD,OAAO,EACF,OAAO,QACP,KAAK,EACL,UAAU,EACV,2BAA2B,EAC3B,UAAU,CACd;YACD,eAAe,EACV,gBAAgB,QACpB;SACF,CAAC;QAEF;;WAEG;OACU,YAAY,CAExB;IAAD,mBAAC;CAAA,AAFD,IAEC;SAFY,YAAY"} \ No newline at end of file diff --git a/src/app/shared/starts-with/date/starts-with-date.component.js b/src/app/shared/starts-with/date/starts-with-date.component.js new file mode 100644 index 0000000000..67e408e086 --- /dev/null +++ b/src/app/shared/starts-with/date/starts-with-date.component.js @@ -0,0 +1,133 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { renderStartsWithFor, StartsWithType } from '../starts-with-decorator'; +import { StartsWithAbstractComponent } from '../starts-with-abstract.component'; +import { hasValue } from '../../empty.util'; +/** + * A switchable component rendering StartsWith options for the type "Date". + * The options are rendered in a dropdown with an input field (of type number) next to it. + */ +var StartsWithDateComponent = /** @class */ (function (_super) { + tslib_1.__extends(StartsWithDateComponent, _super); + function StartsWithDateComponent() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * Currently selected month + */ + _this.startsWithMonth = 'none'; + return _this; + } + StartsWithDateComponent.prototype.ngOnInit = function () { + this.monthOptions = [ + 'none', + 'january', + 'february', + 'march', + 'april', + 'may', + 'june', + 'july', + 'august', + 'september', + 'october', + 'november', + 'december' + ]; + _super.prototype.ngOnInit.call(this); + }; + /** + * Set the startsWith by event + * @param event + */ + StartsWithDateComponent.prototype.setStartsWithYearEvent = function (event) { + this.startsWithYear = +event.target.value; + this.setStartsWithYearMonth(); + this.setStartsWithParam(); + }; + /** + * Set the startsWithMonth by event + * @param event + */ + StartsWithDateComponent.prototype.setStartsWithMonthEvent = function (event) { + this.startsWithMonth = event.target.value; + this.setStartsWithYearMonth(); + this.setStartsWithParam(); + }; + /** + * Get startsWith year combined with month; + * Returned value: "{{year}}-{{month}}" + */ + StartsWithDateComponent.prototype.getStartsWith = function () { + var month = this.getStartsWithMonth(); + if (month > 0 && hasValue(this.startsWithYear) && this.startsWithYear !== -1) { + var twoDigitMonth = '' + month; + if (month < 10) { + twoDigitMonth = "0" + month; + } + return this.startsWithYear + "-" + twoDigitMonth; + } + else { + if (hasValue(this.startsWithYear) && this.startsWithYear > 0) { + return '' + this.startsWithYear; + } + else { + return undefined; + } + } + }; + /** + * Set startsWith year combined with month; + */ + StartsWithDateComponent.prototype.setStartsWithYearMonth = function () { + this.startsWith = this.getStartsWith(); + }; + /** + * Set the startsWith by string + * This method also sets startsWithYear and startsWithMonth correctly depending on the received value + * - When startsWith contains a "-", the first part is considered the year, the second part the month + * - When startsWith doesn't contain a "-", the whole string is expected to be the year + * startsWithMonth will be set depending on the index received after the "-" + * @param startsWith + */ + StartsWithDateComponent.prototype.setStartsWith = function (startsWith) { + this.startsWith = startsWith; + if (hasValue(startsWith) && startsWith.indexOf('-') > -1) { + var split = startsWith.split('-'); + this.startsWithYear = +split[0]; + var month = +split[1]; + if (month < this.monthOptions.length) { + this.startsWithMonth = this.monthOptions[month]; + } + else { + this.startsWithMonth = this.monthOptions[0]; + } + } + else { + this.startsWithYear = +startsWith; + } + this.setStartsWithParam(); + }; + /** + * Get startsWithYear as a number; + */ + StartsWithDateComponent.prototype.getStartsWithYear = function () { + return this.startsWithYear; + }; + /** + * Get startsWithMonth as a number; + */ + StartsWithDateComponent.prototype.getStartsWithMonth = function () { + return this.monthOptions.indexOf(this.startsWithMonth); + }; + StartsWithDateComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-starts-with-date', + styleUrls: ['./starts-with-date.component.scss'], + templateUrl: './starts-with-date.component.html' + }), + renderStartsWithFor(StartsWithType.date) + ], StartsWithDateComponent); + return StartsWithDateComponent; +}(StartsWithAbstractComponent)); +export { StartsWithDateComponent }; +//# sourceMappingURL=starts-with-date.component.js.map \ No newline at end of file diff --git a/src/app/shared/starts-with/date/starts-with-date.component.js.map b/src/app/shared/starts-with/date/starts-with-date.component.js.map new file mode 100644 index 0000000000..e3c2e0b67c --- /dev/null +++ b/src/app/shared/starts-with/date/starts-with-date.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"starts-with-date.component.js","sourceRoot":"","sources":["starts-with-date.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;GAGG;AAOH;IAA6C,mDAA2B;IANxE;QAAA,qEAkIC;QArHC;;WAEG;QACH,qBAAe,GAAG,MAAM,CAAC;;IAkH3B,CAAC;IA3GC,0CAAQ,GAAR;QACE,IAAI,CAAC,YAAY,GAAG;YAClB,MAAM;YACN,SAAS;YACT,UAAU;YACV,OAAO;YACP,OAAO;YACP,KAAK;YACL,MAAM;YACN,MAAM;YACN,QAAQ;YACR,WAAW;YACX,SAAS;YACT,UAAU;YACV,UAAU;SACX,C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AC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;YACxD,IAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,CAAC,cAAc,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChC,IAAM,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACxB,IAAI,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;gBACpC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;aACjD;iBAAM;gBACL,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;aAC7C;SACF;aAAM;YACL,IAAI,CAAC,cAAc,GAAG,CAAC,UAAU,CAAC;SACnC;QACD,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,mDAAiB,GAAjB;QACE,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,oDAAkB,GAAlB;QACE,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACzD,CAAC;IA1HU,uBAAuB;QANnC,SAAS,CAAC;YACT,QAAQ,EAAE,qBAAqB;YAC/B,SAAS,EAAE,CAAC,mCAAmC,CAAC;YAChD,WAAW,EAAE,mCAAmC;SACjD,CAAC;QACD,mBAAmB,CAAC,cAAc,CAAC,IAAI,CAAC;OAC5B,uBAAuB,CA4HnC;IAAD,8BAAC;CAAA,AA5HD,CAA6C,2BAA2B,GA4HvE;SA5HY,uBAAuB"} \ No newline at end of file diff --git a/src/app/shared/starts-with/starts-with-abstract.component.js b/src/app/shared/starts-with/starts-with-abstract.component.js new file mode 100644 index 0000000000..31e65afc24 --- /dev/null +++ b/src/app/shared/starts-with/starts-with-abstract.component.js @@ -0,0 +1,83 @@ +import * as tslib_1 from "tslib"; +import { Inject } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { FormControl, FormGroup } from '@angular/forms'; +import { hasValue } from '../empty.util'; +/** + * An abstract component to render StartsWith options + */ +var StartsWithAbstractComponent = /** @class */ (function () { + function StartsWithAbstractComponent(startsWithOptions, route, router) { + this.startsWithOptions = startsWithOptions; + this.route = route; + this.router = router; + /** + * List of subscriptions + */ + this.subs = []; + } + StartsWithAbstractComponent.prototype.ngOnInit = function () { + var _this = this; + this.subs.push(this.route.queryParams.subscribe(function (params) { + if (hasValue(params.startsWith)) { + _this.setStartsWith(params.startsWith); + } + })); + this.formData = new FormGroup({ + startsWith: new FormControl() + }); + }; + /** + * Get startsWith + */ + StartsWithAbstractComponent.prototype.getStartsWith = function () { + return this.startsWith; + }; + /** + * Set the startsWith by event + * @param event + */ + StartsWithAbstractComponent.prototype.setStartsWithEvent = function (event) { + this.startsWith = event.target.value; + this.setStartsWithParam(); + }; + /** + * Set the startsWith by string + * @param startsWith + */ + StartsWithAbstractComponent.prototype.setStartsWith = function (startsWith) { + this.startsWith = startsWith; + this.setStartsWithParam(); + }; + /** + * Add/Change the url query parameter startsWith using the local variable + */ + StartsWithAbstractComponent.prototype.setStartsWithParam = function () { + if (this.startsWith === '-1') { + this.startsWith = undefined; + } + this.router.navigate([], { + queryParams: Object.assign({ startsWith: this.startsWith }), + queryParamsHandling: 'merge' + }); + }; + /** + * Submit the form data. Called when clicking a submit button on the form. + * @param data + */ + StartsWithAbstractComponent.prototype.submitForm = function (data) { + this.startsWith = data.startsWith; + this.setStartsWithParam(); + }; + StartsWithAbstractComponent.prototype.ngOnDestroy = function () { + this.subs.filter(function (sub) { return hasValue(sub); }).forEach(function (sub) { return sub.unsubscribe(); }); + }; + StartsWithAbstractComponent = tslib_1.__decorate([ + tslib_1.__param(0, Inject('startsWithOptions')), + tslib_1.__metadata("design:paramtypes", [Array, ActivatedRoute, + Router]) + ], StartsWithAbstractComponent); + return StartsWithAbstractComponent; +}()); +export { StartsWithAbstractComponent }; +//# sourceMappingURL=starts-with-abstract.component.js.map \ No newline at end of file diff --git a/src/app/shared/starts-with/starts-with-abstract.component.js.map b/src/app/shared/starts-with/starts-with-abstract.component.js.map new file mode 100644 index 0000000000..ce1c7e265e --- /dev/null +++ b/src/app/shared/starts-with/starts-with-abstract.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"starts-with-abstract.component.js","sourceRoot":"","sources":["starts-with-abstract.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH;IAgBE,qCAAuD,iBAAwB,EAClD,KAAqB,EACrB,MAAc;QAFY,sBAAiB,GAAjB,iBAAiB,CAAO;QAClD,UAAK,GAAL,KAAK,CAAgB;QACrB,WAAM,GAAN,MAAM,CAAQ;QAP3C;;WAEG;QACH,SAAI,GAAmB,EAAE,CAAC;IAK1B,CAAC;IAED,8CAAQ,GAAR;QAAA,iBAWC;QAVC,IAAI,CAAC,IAAI,CAAC,IAAI,CACZ,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,UAAC,MAAM;YACtC,IAAI,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;gBAC/B,KAAI,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;aACvC;QACH,CAAC,CAAC,CACH,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,IAAI,SAAS,CAAC;YAC5B,UAAU,EAAE,IAAI,WAAW,EAAE;SAC9B,CAAC,CAAC;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C;CAAA,AApFD,IAoFC;SApFY,2BAA2B"} \ No newline at end of file diff --git a/src/app/shared/starts-with/starts-with-decorator.js b/src/app/shared/starts-with/starts-with-decorator.js new file mode 100644 index 0000000000..520883b3f7 --- /dev/null +++ b/src/app/shared/starts-with/starts-with-decorator.js @@ -0,0 +1,29 @@ +var startsWithMap = new Map(); +/** + * An enum that defines the type of StartsWith options + */ +export var StartsWithType; +(function (StartsWithType) { + StartsWithType["text"] = "Text"; + StartsWithType["date"] = "Date"; +})(StartsWithType || (StartsWithType = {})); +/** + * Fetch a decorator to render a StartsWith component for type + * @param type + */ +export function renderStartsWithFor(type) { + return function decorator(objectElement) { + if (!objectElement) { + return; + } + startsWithMap.set(type, objectElement); + }; +} +/** + * Get the correct component depending on the StartsWith type + * @param type + */ +export function getStartsWithComponent(type) { + return startsWithMap.get(type); +} +//# sourceMappingURL=starts-with-decorator.js.map \ No newline at end of file diff --git a/src/app/shared/starts-with/starts-with-decorator.js.map b/src/app/shared/starts-with/starts-with-decorator.js.map new file mode 100644 index 0000000000..3e84c0b3e8 --- /dev/null +++ b/src/app/shared/starts-with/starts-with-decorator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"starts-with-decorator.js","sourceRoot":"","sources":["starts-with-decorator.ts"],"names":[],"mappings":"AAAA,IAAM,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;AAEhC;;GAEG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,+BAAa,CAAA;IACb,+BAAa,CAAA;AACf,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED;;;GAGG;AACH,MAAM,8BAA8B,IAAoB;IACtD,OAAO,mBAAmB,aAAkB;QAC1C,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO;SACR;QACD,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACzC,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,iCAAiC,IAAoB;IACzD,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/starts-with/text/starts-with-text.component.js b/src/app/shared/starts-with/text/starts-with-text.component.js new file mode 100644 index 0000000000..e6b4014239 --- /dev/null +++ b/src/app/shared/starts-with/text/starts-with-text.component.js @@ -0,0 +1,55 @@ +import * as tslib_1 from "tslib"; +import { Component } from '@angular/core'; +import { renderStartsWithFor, StartsWithType } from '../starts-with-decorator'; +import { StartsWithAbstractComponent } from '../starts-with-abstract.component'; +import { hasValue } from '../../empty.util'; +/** + * A switchable component rendering StartsWith options for the type "Text". + */ +var StartsWithTextComponent = /** @class */ (function (_super) { + tslib_1.__extends(StartsWithTextComponent, _super); + function StartsWithTextComponent() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Get startsWith as text; + */ + StartsWithTextComponent.prototype.getStartsWith = function () { + if (hasValue(this.startsWith)) { + return this.startsWith; + } + else { + return ''; + } + }; + /** + * Add/Change the url query parameter startsWith using the local variable + */ + StartsWithTextComponent.prototype.setStartsWithParam = function () { + if (this.startsWith === '0-9') { + this.startsWith = '0'; + } + _super.prototype.setStartsWithParam.call(this); + }; + /** + * Checks whether the provided option is equal to the current startsWith + * @param option + */ + StartsWithTextComponent.prototype.isSelectedOption = function (option) { + if (this.startsWith === '0' && option === '0-9') { + return true; + } + return option === this.startsWith; + }; + StartsWithTextComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-starts-with-text', + styleUrls: ['./starts-with-text.component.scss'], + templateUrl: './starts-with-text.component.html' + }), + renderStartsWithFor(StartsWithType.text) + ], StartsWithTextComponent); + return StartsWithTextComponent; +}(StartsWithAbstractComponent)); +export { StartsWithTextComponent }; +//# sourceMappingURL=starts-with-text.component.js.map \ No newline at end of file diff --git a/src/app/shared/starts-with/text/starts-with-text.component.js.map b/src/app/shared/starts-with/text/starts-with-text.component.js.map new file mode 100644 index 0000000000..4e975cb963 --- /dev/null +++ b/src/app/shared/starts-with/text/starts-with-text.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"starts-with-text.component.js","sourceRoot":"","sources":["starts-with-text.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;GAEG;AAOH;IAA6C,mDAA2B;IAAxE;;IAkCA,CAAC;IAhCC;;OAEG;IACH,+CAAa,GAAb;QACE,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YAC7B,OAAO,IAAI,CAAC,UAAU,CAAC;SACxB;aAAM;YACL,OAAO,EAAE,CAAC;SACX;IACH,CAAC;IAED;;OAEG;IACH,oDAAkB,GAAlB;QACE,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK,EAAE;YAC7B,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;SACvB;QACD,iBAAM,kBAAkB,WAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACH,kDAAgB,GAAhB,UAAiB,MAAc;QAC7B,IAAI,IAAI,CAAC,UAAU,KAAK,GAAG,IAAI,MAAM,KAAK,KAAK,EAAE;YAC/C,OAAO,IAAI,CAAC;SACb;QACD,OAAO,MAAM,KAAK,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;IAhCU,uBAAuB;QANnC,SAAS,CAAC;YACT,QAAQ,EAAE,qBAAqB;YAC/B,SAAS,EAAE,CAAC,mCAAmC,CAAC;YAChD,WAAW,EAAE,mCAAmC;SACjD,CAAC;QACD,mBAAmB,CAAC,cAAc,CAAC,IAAI,CAAC;OAC5B,uBAAuB,CAkCnC;IAAD,8BAAC;CAAA,AAlCD,CAA6C,2BAA2B,GAkCvE;SAlCY,uBAAuB"} \ No newline at end of file diff --git a/src/app/shared/testing/active-router-stub.js b/src/app/shared/testing/active-router-stub.js new file mode 100644 index 0000000000..32e831461e --- /dev/null +++ b/src/app/shared/testing/active-router-stub.js @@ -0,0 +1,46 @@ +import { map } from 'rxjs/operators'; +import { convertToParamMap } from '@angular/router'; +import { BehaviorSubject } from 'rxjs'; +var ActivatedRouteStub = /** @class */ (function () { + function ActivatedRouteStub(params) { + // ActivatedRoute.params is Observable + this.subject = new BehaviorSubject(this.testParams); + this.params = this.subject.asObservable(); + this.queryParams = this.subject.asObservable(); + this.paramMap = this.subject.asObservable().pipe(map(function (params) { return convertToParamMap(params); })); + this.queryParamMap = this.subject.asObservable().pipe(map(function (params) { return convertToParamMap(params); })); + if (params) { + this.testParams = params; + } + else { + this.testParams = {}; + } + } + ; + Object.defineProperty(ActivatedRouteStub.prototype, "testParams", { + // Test parameters + get: function () { + return this._testParams; + }, + set: function (params) { + this._testParams = params; + this.subject.next(params); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ActivatedRouteStub.prototype, "snapshot", { + // ActivatedRoute.snapshot.params + get: function () { + return { + params: this.testParams, + queryParamMap: convertToParamMap(this.testParams) + }; + }, + enumerable: true, + configurable: true + }); + return ActivatedRouteStub; +}()); +export { ActivatedRouteStub }; +//# sourceMappingURL=active-router-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/active-router-stub.js.map b/src/app/shared/testing/active-router-stub.js.map new file mode 100644 index 0000000000..25c7e620f2 --- /dev/null +++ b/src/app/shared/testing/active-router-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"active-router-stub.js","sourceRoot":"","sources":["active-router-stub.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAoB,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAEvC;IAWE,4BAAY,MAAe;QAR3B,sCAAsC;QAC9B,YAAO,GAA0B,IAAI,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE9E,WAAM,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QACrC,gBAAW,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAC1C,aAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,MAAc,IAAK,OAAA,iBAAiB,CAAC,MAAM,CAAC,EAAzB,CAAyB,CAAC,CAAC,CAAC;QAChG,kBAAa,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,MAAc,IAAK,OAAA,iBAAiB,CAAC,MAAM,CAAC,EAAzB,CAAyB,CAAC,CAAC,CAAC;QAGnG,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;SAC1B;aAAM;YACL,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;SACtB;IACH,CAAC;IAT+F,CAAC;IAYjG,sBAAI,0CAAU;QADd,kBAAkB;aAClB;YACE,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;aAED,UAAe,MAAU;YACvB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;YAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;;;OALA;IAQD,sBAAI,wCAAQ;QADZ,iCAAiC;aACjC;YACE,OAAO;gBACL,MAAM,EAAE,IAAI,CAAC,UAAU;gBACvB,aAAa,EAAE,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC;aAClD,CAAA;QACH,CAAC;;;OAAA;IACH,yBAAC;AAAD,CAAC,AApCD,IAoCC"} \ No newline at end of file diff --git a/src/app/shared/testing/auth-request-service-stub.js b/src/app/shared/testing/auth-request-service-stub.js new file mode 100644 index 0000000000..fa8528198c --- /dev/null +++ b/src/app/shared/testing/auth-request-service-stub.js @@ -0,0 +1,74 @@ +import { of as observableOf } from 'rxjs'; +import { AuthStatus } from '../../core/auth/models/auth-status.model'; +import { AuthTokenInfo } from '../../core/auth/models/auth-token-info.model'; +import { isNotEmpty } from '../empty.util'; +import { EPersonMock } from './eperson-mock'; +import { RemoteData } from '../../core/data/remote-data'; +var AuthRequestServiceStub = /** @class */ (function () { + function AuthRequestServiceStub() { + this.mockUser = EPersonMock; + this.mockTokenInfo = new AuthTokenInfo('test_token'); + } + AuthRequestServiceStub.prototype.postToEndpoint = function (method, body, options) { + var authStatusStub = new AuthStatus(); + if (isNotEmpty(body)) { + var parsedBody = this.parseQueryString(body); + authStatusStub.okay = true; + if (parsedBody.user === 'user' && parsedBody.password === 'password') { + authStatusStub.authenticated = true; + authStatusStub.token = this.mockTokenInfo; + } + else { + authStatusStub.authenticated = false; + } + } + else { + var token = options.headers.lazyUpdate[1].value; + if (this.validateToken(token)) { + authStatusStub.authenticated = true; + authStatusStub.token = this.mockTokenInfo; + authStatusStub.eperson = observableOf(new RemoteData(false, false, true, undefined, this.mockUser)); + } + else { + authStatusStub.authenticated = false; + } + } + return observableOf(authStatusStub); + }; + AuthRequestServiceStub.prototype.getRequest = function (method, options) { + var authStatusStub = new AuthStatus(); + switch (method) { + case 'logout': + authStatusStub.authenticated = false; + break; + case 'status': + var token = options.headers.lazyUpdate[1].value; + if (this.validateToken(token)) { + authStatusStub.authenticated = true; + authStatusStub.token = this.mockTokenInfo; + authStatusStub.eperson = observableOf(new RemoteData(false, false, true, undefined, this.mockUser)); + } + else { + authStatusStub.authenticated = false; + } + break; + } + return observableOf(authStatusStub); + }; + AuthRequestServiceStub.prototype.validateToken = function (token) { + return (token === 'Bearer test_token'); + }; + AuthRequestServiceStub.prototype.parseQueryString = function (query) { + var obj = Object.create({}); + var vars = query.split('&'); + for (var _i = 0, vars_1 = vars; _i < vars_1.length; _i++) { + var param = vars_1[_i]; + var pair = param.split('='); + obj[pair[0]] = pair[1]; + } + return obj; + }; + return AuthRequestServiceStub; +}()); +export { AuthRequestServiceStub }; +//# sourceMappingURL=auth-request-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/auth-request-service-stub.js.map b/src/app/shared/testing/auth-request-service-stub.js.map new file mode 100644 index 0000000000..b7d02f20d5 --- /dev/null +++ b/src/app/shared/testing/auth-request-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-request-service-stub.js","sourceRoot":"","sources":["auth-request-service-stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD;IAAA;QACY,aAAQ,GAAY,WAAW,CAAC;QAChC,kBAAa,GAAG,IAAI,aAAa,CAAC,YAAY,CAAC,CAAC;IA0D5D,CAAC;IAxDQ,+CAAc,GAArB,UAAsB,MAAc,EAAE,IAAS,EAAE,OAAqB;QACpE,IAAM,cAAc,GAAe,IAAI,UAAU,EAAE,CAAC;QACpD,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;YACpB,IAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YAC/C,cAAc,CAAC,IAAI,GAAG,IAAI,CAAC;YAC3B,IAAI,UAAU,CAAC,IAAI,KAAK,MAAM,IAAI,UAAU,CAAC,QAAQ,KAAK,UAAU,EAAE;gBACpE,cAAc,CAAC,aAAa,GAAG,IAAI,CAAC;gBACpC,cAAc,CAAC,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC;aAC3C;iBAAM;gBACL,cAAc,CAAC,aAAa,GAAG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ACD,OAAO,YAAY,CAAC,cAAc,CAAC,CAAC;IACtC,CAAC;IAEO,8CAAa,GAArB,UAAsB,KAAK;QACzB,OAAO,CAAC,KAAK,KAAK,mBAAmB,CAAC,CAAC;IACzC,CAAC;IACO,iDAAgB,GAAxB,UAAyB,KAAK;QAC5B,IAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC9B,IAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,KAAoB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;YAArB,IAAM,KAAK,aAAA;YACd,IAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC9B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;SACvB;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACH,6BAAC;AAAD,CAAC,AA5DD,IA4DC"} \ No newline at end of file diff --git a/src/app/shared/testing/auth-service-stub.js b/src/app/shared/testing/auth-service-stub.js new file mode 100644 index 0000000000..371d2ebecc --- /dev/null +++ b/src/app/shared/testing/auth-service-stub.js @@ -0,0 +1,85 @@ +import { of as observableOf } from 'rxjs'; +import { AuthStatus } from '../../core/auth/models/auth-status.model'; +import { AuthTokenInfo } from '../../core/auth/models/auth-token-info.model'; +import { EPersonMock } from './eperson-mock'; +import { RemoteData } from '../../core/data/remote-data'; +var AuthServiceStub = /** @class */ (function () { + function AuthServiceStub() { + this.token = new AuthTokenInfo('token_test'); + this._tokenExpired = false; + this.token.expires = Date.now() + (1000 * 60 * 60); + } + AuthServiceStub.prototype.authenticate = function (user, password) { + if (user === 'user' && password === 'password') { + var authStatus = new AuthStatus(); + authStatus.okay = true; + authStatus.authenticated = true; + authStatus.token = this.token; + authStatus.eperson = observableOf(new RemoteData(false, false, true, undefined, EPersonMock)); + return observableOf(authStatus); + } + else { + console.log('error'); + throw (new Error('Message Error test')); + } + }; + AuthServiceStub.prototype.authenticatedUser = function (token) { + if (token.accessToken === 'token_test') { + return observableOf(EPersonMock); + } + else { + throw (new Error('Message Error test')); + } + }; + AuthServiceStub.prototype.buildAuthHeader = function (token) { + return "Bearer " + token.accessToken; + }; + AuthServiceStub.prototype.getToken = function () { + return this.token; + }; + AuthServiceStub.prototype.hasValidAuthenticationToken = function () { + return observableOf(this.token); + }; + AuthServiceStub.prototype.logout = function () { + return observableOf(true); + }; + AuthServiceStub.prototype.isTokenExpired = function (token) { + return this._tokenExpired; + }; + /** + * This method is used to ease testing + */ + AuthServiceStub.prototype.setTokenAsExpired = function () { + this._tokenExpired = true; + }; + /** + * This method is used to ease testing + */ + AuthServiceStub.prototype.setTokenAsNotExpired = function () { + this._tokenExpired = false; + }; + AuthServiceStub.prototype.isTokenExpiring = function () { + return observableOf(false); + }; + AuthServiceStub.prototype.refreshAuthenticationToken = function (token) { + return observableOf(this.token); + }; + AuthServiceStub.prototype.redirectToPreviousUrl = function () { + return; + }; + AuthServiceStub.prototype.removeToken = function () { + return; + }; + AuthServiceStub.prototype.setRedirectUrl = function (url) { + return; + }; + AuthServiceStub.prototype.storeToken = function (token) { + return; + }; + AuthServiceStub.prototype.isAuthenticated = function () { + return observableOf(true); + }; + return AuthServiceStub; +}()); +export { AuthServiceStub }; +//# sourceMappingURL=auth-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/auth-service-stub.js.map b/src/app/shared/testing/auth-service-stub.js.map new file mode 100644 index 0000000000..1787839899 --- /dev/null +++ b/src/app/shared/testing/auth-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-service-stub.js","sourceRoot":"","sources":["auth-service-stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,M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,YAAU,KAAK,CAAC,WAAa,CAAC;IACvC,CAAC;IAEM,kCAAQ,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEM,qDAA2B,GAAlC;QACE,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAEM,gCAAM,GAAb;QACE,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAEM,wCAAc,GAArB,UAAsB,KAAqB;QACzC,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,2CAAiB,GAAxB;QACE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAA;IAC3B,CAAC;IAED;;OAEG;IACI,8CAAoB,GAA3B;QACE,IAAI,CAAC,aAAa,GAAG,KAAK,CAAA;IAC5B,CAAC;IAEM,yCAAe,GAAtB;QACE,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAEM,oDAA0B,GAAjC,UAAkC,KAAoB;QACpD,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAEM,+CAAqB,GAA5B;QACE,OAAO;IACT,CAAC;IAEM,qCAAW,GAAlB;QACE,OAAO;IACT,CAAC;IAED,wCAAc,GAAd,UAAe,GAAW;QACxB,OAAO;IACT,CAAC;IAEM,oCAAU,GAAjB,UAAkB,KAAoB;QACpC,OAAO;IACT,CAAC;IAED,yCAAe,GAAf;QACE,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IACH,sBAAC;AAAD,CAAC,AA5FD,IA4FC"} \ No newline at end of file diff --git a/src/app/shared/testing/authority-service-stub.js b/src/app/shared/testing/authority-service-stub.js new file mode 100644 index 0000000000..40e630c55e --- /dev/null +++ b/src/app/shared/testing/authority-service-stub.js @@ -0,0 +1,21 @@ +import { of as observableOf } from 'rxjs'; +import { IntegrationData } from '../../core/integration/integration-data'; +import { PageInfo } from '../../core/shared/page-info.model'; +import { AuthorityValue } from '../../core/integration/models/authority.value'; +var AuthorityServiceStub = /** @class */ (function () { + function AuthorityServiceStub() { + this._payload = [ + Object.assign(new AuthorityValue(), { id: 1, display: 'one', value: 1 }), + Object.assign(new AuthorityValue(), { id: 2, display: 'two', value: 2 }), + ]; + } + AuthorityServiceStub.prototype.setNewPayload = function (payload) { + this._payload = payload; + }; + AuthorityServiceStub.prototype.getEntriesByName = function (options) { + return observableOf(new IntegrationData(new PageInfo(), this._payload)); + }; + return AuthorityServiceStub; +}()); +export { AuthorityServiceStub }; +//# sourceMappingURL=authority-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/authority-service-stub.js.map b/src/app/shared/testing/authority-service-stub.js.map new file mode 100644 index 0000000000..a3e08627c4 --- /dev/null +++ b/src/app/shared/testing/authority-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authority-service-stub.js","sourceRoot":"","sources":["authority-service-stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,IAAI,YAAY,EAAe,MAAM,MAAM,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E;IAAA;QAEU,aAAQ,GAAG;YACjB,MAAM,CAAC,MAAM,CAAC,IAAI,cAAc,EAAE,EAAC,EAAC,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;YACrE,MAAM,CAAC,MAAM,CAAC,IAAI,cAAc,EAAE,EAAC,EAAC,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;SACtE,CAAC;IASJ,CAAC;IAPC,4CAAa,GAAb,UAAc,OAAO;QACnB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,+CAAgB,GAAhB,UAAiB,OAAiC;QAChD,OAAO,YAAY,CAAC,IAAI,eAAe,CAAC,IAAI,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1E,CAAC;IACH,2BAAC;AAAD,CAAC,AAdD,IAcC"} \ No newline at end of file diff --git a/src/app/shared/testing/css-variable-service-stub.js b/src/app/shared/testing/css-variable-service-stub.js new file mode 100644 index 0000000000..314ee7f542 --- /dev/null +++ b/src/app/shared/testing/css-variable-service-stub.js @@ -0,0 +1,23 @@ +import { of as observableOf } from 'rxjs'; +var variables = { + smMin: '576px,', + mdMin: '768px,', + lgMin: '992px', + xlMin: '1200px', +}; +var CSSVariableServiceStub = /** @class */ (function () { + function CSSVariableServiceStub() { + } + CSSVariableServiceStub.prototype.getVariable = function (name) { + return observableOf('500px'); + }; + CSSVariableServiceStub.prototype.getAllVariables = function (name) { + return observableOf(variables); + }; + CSSVariableServiceStub.prototype.addCSSVariable = function (name, value) { + /**/ + }; + return CSSVariableServiceStub; +}()); +export { CSSVariableServiceStub }; +//# sourceMappingURL=css-variable-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/css-variable-service-stub.js.map b/src/app/shared/testing/css-variable-service-stub.js.map new file mode 100644 index 0000000000..a7a452b5c1 --- /dev/null +++ b/src/app/shared/testing/css-variable-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"css-variable-service-stub.js","sourceRoot":"","sources":["css-variable-service-stub.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAC1C,IAAM,SAAS,GAAG;IAChB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,QAAQ;CACT,CAAC;AAET;IAAA;IAYA,CAAC;IAXC,4CAAW,GAAX,UAAY,IAAY;QACtB,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,gDAAe,GAAf,UAAgB,IAAY;QAC1B,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,+CAAc,GAAd,UAAe,IAAY,EAAE,KAAa;QACxC,IAAI;IACN,CAAC;IACH,6BAAC;AAAD,CAAC,AAZD,IAYC"} \ No newline at end of file diff --git a/src/app/shared/testing/eperson-mock.js b/src/app/shared/testing/eperson-mock.js new file mode 100644 index 0000000000..d189e33c8e --- /dev/null +++ b/src/app/shared/testing/eperson-mock.js @@ -0,0 +1,42 @@ +import { EPerson } from '../../core/eperson/models/eperson.model'; +export var EPersonMock = Object.assign(new EPerson(), { + handle: null, + groups: [], + netid: 'test@test.com', + lastActive: '2018-05-14T12:25:42.411+0000', + canLogIn: true, + email: 'test@test.com', + requireCertificate: false, + selfRegistered: false, + self: 'https://dspace.4science.it/dspace-spring-rest/api/eperson/epersons/testid', + id: 'testid', + uuid: 'testid', + type: 'eperson', + metadata: { + 'dc.title': [ + { + language: null, + value: 'User Test' + } + ], + 'eperson.firstname': [ + { + language: null, + value: 'User' + } + ], + 'eperson.lastname': [ + { + language: null, + value: 'Test' + }, + ], + 'eperson.language': [ + { + language: null, + value: 'en' + }, + ] + } +}); +//# sourceMappingURL=eperson-mock.js.map \ No newline at end of file diff --git a/src/app/shared/testing/eperson-mock.js.map b/src/app/shared/testing/eperson-mock.js.map new file mode 100644 index 0000000000..4614e04850 --- /dev/null +++ b/src/app/shared/testing/eperson-mock.js.map @@ -0,0 +1 @@ +{"version":3,"file":"eperson-mock.js","sourceRoot":"","sources":["eperson-mock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAElE,MAAM,CAAC,IAAM,WAAW,GAAY,MAAM,CAAC,MAAM,CAAC,IAAI,OAAO,EAAE,EAAC;IAC9D,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,eAAe;IACtB,UAAU,EAAE,8BAA8B;IAC1C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,eAAe;IACtB,kBAAkB,EAAE,KAAK;IACzB,cAAc,EAAE,KAAK;IACrB,IAAI,EAAE,2EAA2E;IACjF,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE;QACR,UAAU,EAAE;YACV;gBACE,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,WAAW;aACnB;SACF;QACD,mBAAmB,EAAE;YACnB;gBACE,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,MAAM;aACd;SACF;QACD,kBAAkB,EAAE;YAClB;gBACE,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,MAAM;aACd;SACF;QACD,kBAAkB,EAAE;YAClB;gBACE,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,IAAI;aACZ;SACF;KACF;CACF,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/shared/testing/hal-endpoint-service-stub.js b/src/app/shared/testing/hal-endpoint-service-stub.js new file mode 100644 index 0000000000..9462df0309 --- /dev/null +++ b/src/app/shared/testing/hal-endpoint-service-stub.js @@ -0,0 +1,13 @@ +import { of as observableOf } from 'rxjs'; +var HALEndpointServiceStub = /** @class */ (function () { + function HALEndpointServiceStub(url) { + this.url = url; + } + ; + HALEndpointServiceStub.prototype.getEndpoint = function (path) { + return observableOf(this.url + '/' + path); + }; + return HALEndpointServiceStub; +}()); +export { HALEndpointServiceStub }; +//# sourceMappingURL=hal-endpoint-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/hal-endpoint-service-stub.js.map b/src/app/shared/testing/hal-endpoint-service-stub.js.map new file mode 100644 index 0000000000..f1fe0c6810 --- /dev/null +++ b/src/app/shared/testing/hal-endpoint-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hal-endpoint-service-stub.js","sourceRoot":"","sources":["hal-endpoint-service-stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAE1C;IAEE,gCAAoB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAAA,CAAC;IACpC,4CAAW,GAAX,UAAY,IAAY;QACtB,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC;IAC7C,CAAC;IACH,6BAAC;AAAD,CAAC,AAND,IAMC"} \ No newline at end of file diff --git a/src/app/shared/testing/host-window-service-stub.js b/src/app/shared/testing/host-window-service-stub.js new file mode 100644 index 0000000000..3fd93aae41 --- /dev/null +++ b/src/app/shared/testing/host-window-service-stub.js @@ -0,0 +1,19 @@ +import { of as observableOf } from 'rxjs'; +// declare a stub service +var HostWindowServiceStub = /** @class */ (function () { + function HostWindowServiceStub(width) { + this.setWidth(width); + } + HostWindowServiceStub.prototype.setWidth = function (width) { + this.width = width; + }; + HostWindowServiceStub.prototype.isXs = function () { + return observableOf(this.width < 576); + }; + HostWindowServiceStub.prototype.isXsOrSm = function () { + return this.isXs(); + }; + return HostWindowServiceStub; +}()); +export { HostWindowServiceStub }; +//# sourceMappingURL=host-window-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/host-window-service-stub.js.map b/src/app/shared/testing/host-window-service-stub.js.map new file mode 100644 index 0000000000..9ee176b21a --- /dev/null +++ b/src/app/shared/testing/host-window-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"host-window-service-stub.js","sourceRoot":"","sources":["host-window-service-stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,IAAI,YAAY,EAAe,MAAM,MAAM,CAAC;AAEtD,yBAAyB;AACzB;IAIE,+BAAY,KAAK;QACf,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAED,wCAAQ,GAAR,UAAS,KAAK;QACZ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,oCAAI,GAAJ;QACE,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IACxC,CAAC;IAED,wCAAQ,GAAR;QACE,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IACH,4BAAC;AAAD,CAAC,AAnBD,IAmBC"} \ No newline at end of file diff --git a/src/app/shared/testing/menu-service-stub.js b/src/app/shared/testing/menu-service-stub.js new file mode 100644 index 0000000000..0ef5a4aea5 --- /dev/null +++ b/src/app/shared/testing/menu-service-stub.js @@ -0,0 +1,94 @@ +import { of as observableOf } from 'rxjs'; +var MenuServiceStub = /** @class */ (function () { + function MenuServiceStub() { + this.visibleSection1 = { + id: 'section', + visible: true, + active: false + }; + this.visibleSection2 = { + id: 'section_2', + visible: true + }; + this.hiddenSection3 = { + id: 'section_3', + visible: false + }; + this.subSection4 = { + id: 'section_4', + visible: true, + parentID: 'section1' + }; + } + MenuServiceStub.prototype.toggleMenu = function () { + }; + ; + MenuServiceStub.prototype.expandMenu = function () { + }; + ; + MenuServiceStub.prototype.collapseMenu = function () { + }; + ; + MenuServiceStub.prototype.showMenu = function () { + }; + ; + MenuServiceStub.prototype.hideMenu = function () { + }; + ; + MenuServiceStub.prototype.expandMenuPreview = function () { + }; + ; + MenuServiceStub.prototype.collapseMenuPreview = function () { + }; + ; + MenuServiceStub.prototype.toggleActiveSection = function () { + }; + ; + MenuServiceStub.prototype.activateSection = function () { + }; + ; + MenuServiceStub.prototype.deactivateSection = function () { + }; + ; + MenuServiceStub.prototype.addSection = function () { + }; + ; + MenuServiceStub.prototype.removeSection = function () { + }; + ; + MenuServiceStub.prototype.isMenuVisible = function (id) { + return observableOf(true); + }; + ; + MenuServiceStub.prototype.isMenuCollapsed = function (id) { + return observableOf(false); + }; + ; + MenuServiceStub.prototype.isMenuPreviewCollapsed = function (id) { + return observableOf(true); + }; + ; + MenuServiceStub.prototype.hasSubSections = function (id, sectionID) { + return observableOf(true); + }; + ; + MenuServiceStub.prototype.getMenuTopSections = function (id) { + return observableOf([this.visibleSection1, this.visibleSection2]); + }; + ; + MenuServiceStub.prototype.getSubSectionsByParentID = function (id) { + return observableOf([this.subSection4]); + }; + ; + MenuServiceStub.prototype.isSectionActive = function (id, sectionID) { + return observableOf(true); + }; + ; + MenuServiceStub.prototype.isSectionVisible = function (id, sectionID) { + return observableOf(true); + }; + ; + return MenuServiceStub; +}()); +export { MenuServiceStub }; +//# sourceMappingURL=menu-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/menu-service-stub.js.map b/src/app/shared/testing/menu-service-stub.js.map new file mode 100644 index 0000000000..c99889fc81 --- /dev/null +++ b/src/app/shared/testing/menu-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"menu-service-stub.js","sourceRoot":"","sources":["menu-service-stub.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAI1C;IAAA;QACE,oBAAe,GAAG;YAChB,EAAE,EAAE,SAAS;YACb,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,KAAK;SACP,CAAC;QACT,oBAAe,GAAG;YAChB,EAAE,EAAE,WAAW;YACf,OAAO,EAAE,IAAI;SACP,CAAC;QACT,mBAAc,GAAG;YACf,EAAE,EAAE,WAAW;YACf,OAAO,EAAE,KAAK;SACR,CAAC;QACT,gBAAW,GAAG;YACZ,EAAE,EAAE,WAAW;YACf,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,UAAU;SACd,CAAC;IAqEX,CAAC;IAnEC,oCAAU,GAAV;IACA,CAAC;IAAA,CAAC;IAEF,oCAAU,GAAV;IACA,CAAC;IAAA,CAAC;IAEF,sCAAY,GAAZ;IACA,CAAC;IAAA,CAAC;IAEF,kCAAQ,GAAR;IACA,CAAC;IAAA,CAAC;IAEF,kCAAQ,GAAR;IACA,CAAC;IAAA,CAAC;IAEF,2CAAiB,GAAjB;IACA,CAAC;IAAA,CAAC;IAEF,6CAAmB,GAAnB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mock-action.js b/src/app/shared/testing/mock-action.js new file mode 100644 index 0000000000..eb52581277 --- /dev/null +++ b/src/app/shared/testing/mock-action.js @@ -0,0 +1,8 @@ +var MockAction = /** @class */ (function () { + function MockAction() { + this.type = null; + } + return MockAction; +}()); +export { MockAction }; +//# sourceMappingURL=mock-action.js.map \ No newline at end of file diff --git a/src/app/shared/testing/mock-action.js.map b/src/app/shared/testing/mock-action.js.map new file mode 100644 index 0000000000..def2870f4d --- /dev/null +++ b/src/app/shared/testing/mock-action.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-action.js","sourceRoot":"","sources":["mock-action.ts"],"names":[],"mappings":"AAEA;IAAA;QACE,SAAI,GAAG,IAAI,CAAC;IAEd,CAAC;IAAD,iBAAC;AAAD,CAAC,AAHD,IAGC"} \ No newline at end of file diff --git a/src/app/shared/testing/mock-store.js b/src/app/shared/testing/mock-store.js new file mode 100644 index 0000000000..cfcbeac3bc --- /dev/null +++ b/src/app/shared/testing/mock-store.js @@ -0,0 +1,25 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { ActionsSubject, ReducerManager, StateObservable, Store } from '@ngrx/store'; +import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject'; +var MockStore = /** @class */ (function (_super) { + tslib_1.__extends(MockStore, _super); + function MockStore(state$, actionsObserver, reducerManager) { + var _this = _super.call(this, state$, actionsObserver, reducerManager) || this; + _this.stateSubject = new BehaviorSubject({}); + _this.source = _this.stateSubject.asObservable(); + return _this; + } + MockStore.prototype.nextState = function (nextState) { + this.stateSubject.next(nextState); + }; + MockStore = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [StateObservable, + ActionsSubject, + ReducerManager]) + ], MockStore); + return MockStore; +}(Store)); +export { MockStore }; +//# sourceMappingURL=mock-store.js.map \ No newline at end of file diff --git a/src/app/shared/testing/mock-store.js.map b/src/app/shared/testing/mock-store.js.map new file mode 100644 index 0000000000..5fde29ed0f --- /dev/null +++ b/src/app/shared/testing/mock-store.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-store.js","sourceRoot":"","sources":["mock-store.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE;IAAkC,qCAAQ;IAGxC,mBACE,MAAuB,EACvB,eAA+B,EAC/B,cAA8B;QAHhC,YAKE,kBAAM,MAAM,EAAE,eAAe,EAAE,cAAc,CAAC,SAE/C;QATO,kBAAY,GAAG,IAAI,eAAe,CAAI,EAAO,CAAC,CAAC;QAQrD,KAAI,CAAC,MAAM,GAAG,KAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;;IACjD,CAAC;IAED,6BAAS,GAAT,UAAU,SAAY;QACpB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAdU,SAAS;QADrB,UAAU,EAAE;iDAKD,eAAe;YACN,cAAc;YACf,cAAc;OANrB,SAAS,CAerB;IAAD,gBAAC;CAAA,AAfD,CAAkC,KAAK,GAetC;SAfY,SAAS"} \ No newline at end of file diff --git a/src/app/shared/testing/mock-submission-config.js b/src/app/shared/testing/mock-submission-config.js new file mode 100644 index 0000000000..f222dac593 --- /dev/null +++ b/src/app/shared/testing/mock-submission-config.js @@ -0,0 +1,51 @@ +export var MOCK_SUBMISSION_CONFIG = { + submission: { + autosave: { + // NOTE: which metadata trigger an autosave + metadata: ['dc.title', 'dc.identifier.doi', 'dc.identifier.pmid', 'dc.identifier.arxiv'], + // NOTE: every how many minutes submission is saved automatically + timer: 5 + }, + icons: { + metadata: [ + { + name: 'mainField', + style: 'fas fa-user' + }, + { + name: 'relatedField', + style: 'fas fa-university' + }, + { + name: 'otherRelatedField', + style: 'fas fa-circle' + }, + { + name: 'default', + style: '' + } + ], + authority: { + confidence: [ + { + value: 600, + style: 'text-success' + }, + { + value: 500, + style: 'text-info' + }, + { + value: 400, + style: 'text-warning' + }, + { + value: 'default', + style: 'text-muted' + }, + ] + } + } + } +}; +//# sourceMappingURL=mock-submission-config.js.map \ No newline at end of file diff --git a/src/app/shared/testing/mock-submission-config.js.map b/src/app/shared/testing/mock-submission-config.js.map new file mode 100644 index 0000000000..4d6b01ec93 --- /dev/null +++ b/src/app/shared/testing/mock-submission-config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-submission-config.js","sourceRoot":"","sources":["mock-submission-config.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,IAAM,sBAAsB,GAAG;IACpC,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,2CAA2C;YAC3C,QAAQ,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB,CAAC;YACxF,iEAAiE;YACjE,KAAK,EAAE,CAAC;SACT;QACD,KAAK,EAAE;YACL,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,WAAW;oBACjB,KAAK,EAAE,aAAa;iBACrB;gBACD;oBACE,IAAI,EAAE,cAAc;oBACpB,KAAK,EAAE,mBAAmB;iBAC3B;gBACD;oBACE,IAAI,EAAE,mBAAmB;oBACzB,KAAK,EAAE,eAAe;iBACvB;gBACD;oBACE,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE,EAAE;iBACV;aACF;YACD,SAAS,EAAE;gBACT,UAAU,EAAE;oBACV;wBACE,KAAK,EAAE,GAAG;wBACV,KAAK,EAAE,cAAc;qBACtB;oBACD;wBACE,KAAK,EAAE,GAAG;wBACV,KAAK,EAAE,WAAW;qBACnB;oBACD;wBACE,KAAK,EAAE,GAAG;wBACV,KAAK,EAAE,cAAc;qBACtB;oBACD;wBACE,KAAK,EAAE,SAAS;wBAChB,KAAK,EAAE,YAAY;qBACpB;iBAEF;aACF;SACF;KACkB;CACN,CAAC"} \ No newline at end of file diff --git a/src/app/shared/testing/mock-translate-loader.js b/src/app/shared/testing/mock-translate-loader.js new file mode 100644 index 0000000000..ca38a45bda --- /dev/null +++ b/src/app/shared/testing/mock-translate-loader.js @@ -0,0 +1,11 @@ +import { of as observableOf } from 'rxjs'; +var MockTranslateLoader = /** @class */ (function () { + function MockTranslateLoader() { + } + MockTranslateLoader.prototype.getTranslation = function (lang) { + return observableOf({}); + }; + return MockTranslateLoader; +}()); +export { MockTranslateLoader }; +//# sourceMappingURL=mock-translate-loader.js.map \ No newline at end of file diff --git a/src/app/shared/testing/mock-translate-loader.js.map b/src/app/shared/testing/mock-translate-loader.js.map new file mode 100644 index 0000000000..6cb163d59e --- /dev/null +++ b/src/app/shared/testing/mock-translate-loader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mock-translate-loader.js","sourceRoot":"","sources":["mock-translate-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,IAAI,YAAY,EAAe,MAAM,MAAM,CAAC;AAGtD;IAAA;IAIA,CAAC;IAHC,4CAAc,GAAd,UAAe,IAAY;QACzB,OAAO,YAAY,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IACH,0BAAC;AAAD,CAAC,AAJD,IAIC"} \ No newline at end of file diff --git a/src/app/shared/testing/ng-component-outlet-directive-stub.js b/src/app/shared/testing/ng-component-outlet-directive-stub.js new file mode 100644 index 0000000000..57ea748ce3 --- /dev/null +++ b/src/app/shared/testing/ng-component-outlet-directive-stub.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { Directive, Input } from '@angular/core'; +/* tslint:disable:directive-class-suffix */ +var NgComponentOutletDirectiveStub = /** @class */ (function () { + function NgComponentOutletDirectiveStub() { + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], NgComponentOutletDirectiveStub.prototype, "ngComponentOutlet", void 0); + NgComponentOutletDirectiveStub = tslib_1.__decorate([ + Directive({ + // tslint:disable-next-line:directive-selector + selector: '[ngComponentOutlet]', + }) + ], NgComponentOutletDirectiveStub); + return NgComponentOutletDirectiveStub; +}()); +export { NgComponentOutletDirectiveStub }; +//# sourceMappingURL=ng-component-outlet-directive-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/ng-component-outlet-directive-stub.js.map b/src/app/shared/testing/ng-component-outlet-directive-stub.js.map new file mode 100644 index 0000000000..0b96804a9a --- /dev/null +++ b/src/app/shared/testing/ng-component-outlet-directive-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ng-component-outlet-directive-stub.js","sourceRoot":"","sources":["ng-component-outlet-directive-stub.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,2CAA2C;AAK3C;IAAA;IAEA,CAAC;IADU;QAAR,KAAK,EAAE;;6EAAwB;IADrB,8BAA8B;QAJ1C,SAAS,CAAC;YACT,8CAA8C;YAC9C,QAAQ,EAAE,qBAAqB;SAChC,CAAC;OACW,8BAA8B,CAE1C;IAAD,qCAAC;CAAA,AAFD,IAEC;SAFY,8BAA8B"} \ No newline at end of file diff --git a/src/app/shared/testing/notifications-service-stub.js b/src/app/shared/testing/notifications-service-stub.js new file mode 100644 index 0000000000..049616e1cc --- /dev/null +++ b/src/app/shared/testing/notifications-service-stub.js @@ -0,0 +1,17 @@ +import { NotificationOptions } from '../notifications/models/notification-options.model'; +var NotificationsServiceStub = /** @class */ (function () { + function NotificationsServiceStub() { + this.success = jasmine.createSpy('success'); + this.error = jasmine.createSpy('error'); + this.info = jasmine.createSpy('info'); + this.warning = jasmine.createSpy('warning'); + this.remove = jasmine.createSpy('remove'); + this.removeAll = jasmine.createSpy('removeAll'); + } + NotificationsServiceStub.prototype.getDefaultOptions = function () { + return new NotificationOptions(); + }; + return NotificationsServiceStub; +}()); +export { NotificationsServiceStub }; +//# sourceMappingURL=notifications-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/notifications-service-stub.js.map b/src/app/shared/testing/notifications-service-stub.js.map new file mode 100644 index 0000000000..e7850dc04d --- /dev/null +++ b/src/app/shared/testing/notifications-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"notifications-service-stub.js","sourceRoot":"","sources":["notifications-service-stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAEzF;IAAA;QAEE,YAAO,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACvC,UAAK,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACnC,SAAI,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACjC,YAAO,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACvC,WAAM,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACrC,cAAS,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAK7C,CAAC;IAHS,oDAAiB,GAAzB;QACE,OAAO,IAAI,mBAAmB,EAAE,CAAC;IACnC,CAAC;IACH,+BAAC;AAAD,CAAC,AAZD,IAYC"} \ No newline at end of file diff --git a/src/app/shared/testing/query-params-directive-stub.js b/src/app/shared/testing/query-params-directive-stub.js new file mode 100644 index 0000000000..f730ae0638 --- /dev/null +++ b/src/app/shared/testing/query-params-directive-stub.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { Directive, Input } from '@angular/core'; +/* tslint:disable:directive-class-suffix */ +var QueryParamsDirectiveStub = /** @class */ (function () { + function QueryParamsDirectiveStub() { + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], QueryParamsDirectiveStub.prototype, "queryParams", void 0); + QueryParamsDirectiveStub = tslib_1.__decorate([ + Directive({ + // tslint:disable-next-line:directive-selector + selector: '[queryParams]', + }) + ], QueryParamsDirectiveStub); + return QueryParamsDirectiveStub; +}()); +export { QueryParamsDirectiveStub }; +//# sourceMappingURL=query-params-directive-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/query-params-directive-stub.js.map b/src/app/shared/testing/query-params-directive-stub.js.map new file mode 100644 index 0000000000..0a575fda00 --- /dev/null +++ b/src/app/shared/testing/query-params-directive-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"query-params-directive-stub.js","sourceRoot":"","sources":["query-params-directive-stub.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,2CAA2C;AAK3C;IAAA;IAEA,CAAC;IADU;QAAR,KAAK,EAAE;;iEAAkB;IADf,wBAAwB;QAJpC,SAAS,CAAC;YACT,8CAA8C;YAC9C,QAAQ,EAAE,eAAe;SAC1B,CAAC;OACW,wBAAwB,CAEpC;IAAD,+BAAC;CAAA,AAFD,IAEC;SAFY,wBAAwB"} \ No newline at end of file diff --git a/src/app/shared/testing/route-service-stub.js b/src/app/shared/testing/route-service-stub.js new file mode 100644 index 0000000000..5cfd37ea72 --- /dev/null +++ b/src/app/shared/testing/route-service-stub.js @@ -0,0 +1,32 @@ +import { of as observableOf } from 'rxjs/internal/observable/of'; +export var routeServiceStub = { + /* tslint:disable:no-empty */ + hasQueryParamWithValue: function (param, value) { + }, + hasQueryParam: function (param) { + }, + removeQueryParameterValue: function (param, value) { + }, + addQueryParameterValue: function (param, value) { + }, + getQueryParameterValues: function (param) { + return observableOf({}); + }, + getQueryParamsWithPrefix: function (param) { + return observableOf({}); + }, + getQueryParamMap: function () { + return observableOf(new Map()); + }, + getQueryParameterValue: function () { + return observableOf({}); + }, + getRouteParameterValue: function (param) { + return observableOf(''); + }, + getRouteDataValue: function (param) { + return observableOf({}); + } + /* tslint:enable:no-empty */ +}; +//# sourceMappingURL=route-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/route-service-stub.js.map b/src/app/shared/testing/route-service-stub.js.map new file mode 100644 index 0000000000..e60d85a830 --- /dev/null +++ b/src/app/shared/testing/route-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"route-service-stub.js","sourceRoot":"","sources":["route-service-stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEjE,MAAM,CAAC,IAAM,gBAAgB,GAAQ;IACnC,6BAA6B;IAC7B,sBAAsB,EAAE,UAAC,KAAa,EAAE,KAAa;IACrD,CAAC;IACD,aAAa,EAAE,UAAC,KAAa;IAC7B,CAAC;IACD,yBAAyB,EAAE,UAAC,KAAa,EAAE,KAAa;IACxD,CAAC;IACD,sBAAsB,EAAE,UAAC,KAAa,EAAE,KAAa;IACrD,CAAC;IACD,uBAAuB,EAAE,UAAC,KAAa;QACrC,OAAO,YAAY,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IACD,wBAAwB,EAAE,UAAC,KAAa;QACtC,OAAO,YAAY,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IACD,gBAAgB,EAAE;QAChB,OAAO,YAAY,CAAC,IAAI,GAAG,EAAE,CAAC,CAAA;IAChC,CAAC;IACD,sBAAsB,EAAE;QACtB,OAAO,YAAY,CAAC,EAAE,CAAC,CAAA;IACzB,CAAC;IACD,sBAAsB,EAAE,UAAC,KAAK;QAC5B,OAAO,YAAY,CAAC,EAAE,CAAC,CAAA;IACzB,CAAC;IACD,iBAAiB,EAAE,UAAC,KAAK;QACvB,OAAO,YAAY,CAAC,EAAE,CAAC,CAAA;IACzB,CAAC;IACD,4BAA4B;CAC7B,CAAC"} \ No newline at end of file diff --git a/src/app/shared/testing/router-link-directive-stub.js b/src/app/shared/testing/router-link-directive-stub.js new file mode 100644 index 0000000000..2a3d1740be --- /dev/null +++ b/src/app/shared/testing/router-link-directive-stub.js @@ -0,0 +1,20 @@ +import * as tslib_1 from "tslib"; +import { Directive, Input } from '@angular/core'; +/* tslint:disable:directive-class-suffix */ +var RouterLinkDirectiveStub = /** @class */ (function () { + function RouterLinkDirectiveStub() { + } + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], RouterLinkDirectiveStub.prototype, "routerLink", void 0); + RouterLinkDirectiveStub = tslib_1.__decorate([ + Directive({ + // tslint:disable-next-line:directive-selector + selector: '[routerLink]', + }) + ], RouterLinkDirectiveStub); + return RouterLinkDirectiveStub; +}()); +export { RouterLinkDirectiveStub }; +//# sourceMappingURL=router-link-directive-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/router-link-directive-stub.js.map b/src/app/shared/testing/router-link-directive-stub.js.map new file mode 100644 index 0000000000..1ea94bbf2c --- /dev/null +++ b/src/app/shared/testing/router-link-directive-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"router-link-directive-stub.js","sourceRoot":"","sources":["router-link-directive-stub.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjD,2CAA2C;AAK3C;IAAA;IAEA,CAAC;IADU;QAAR,KAAK,EAAE;;+DAAiB;IADd,uBAAuB;QAJnC,SAAS,CAAC;YACT,8CAA8C;YAC9C,QAAQ,EAAE,cAAc;SACzB,CAAC;OACW,uBAAuB,CAEnC;IAAD,8BAAC;CAAA,AAFD,IAEC;SAFY,uBAAuB"} \ No newline at end of file diff --git a/src/app/shared/testing/router-stub.js b/src/app/shared/testing/router-stub.js new file mode 100644 index 0000000000..792f985661 --- /dev/null +++ b/src/app/shared/testing/router-stub.js @@ -0,0 +1,16 @@ +import { of as observableOf } from 'rxjs'; +var RouterStub = /** @class */ (function () { + function RouterStub() { + this.routeReuseStrategy = { shouldReuseRoute: {} }; + //noinspection TypeScriptUnresolvedFunction + this.navigate = jasmine.createSpy('navigate'); + this.parseUrl = jasmine.createSpy('parseUrl'); + this.events = observableOf({}); + } + RouterStub.prototype.navigateByUrl = function (url) { + this.url = url; + }; + return RouterStub; +}()); +export { RouterStub }; +//# sourceMappingURL=router-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/router-stub.js.map b/src/app/shared/testing/router-stub.js.map new file mode 100644 index 0000000000..1df9c126c9 --- /dev/null +++ b/src/app/shared/testing/router-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"router-stub.js","sourceRoot":"","sources":["router-stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAC1C;IAAA;QAEE,uBAAkB,GAAG,EAAC,gBAAgB,EAAE,EAAE,EAAC,CAAC;QAC5C,2CAA2C;QAC3C,aAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACzC,aAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACzC,WAAM,GAAG,YAAY,CAAC,EAAE,CAAC,CAAC;IAI5B,CAAC;IAHC,kCAAa,GAAb,UAAc,GAAG;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IACH,iBAAC;AAAD,CAAC,AAVD,IAUC"} \ No newline at end of file diff --git a/src/app/shared/testing/search-configuration-service-stub.js b/src/app/shared/testing/search-configuration-service-stub.js new file mode 100644 index 0000000000..6215ab340f --- /dev/null +++ b/src/app/shared/testing/search-configuration-service-stub.js @@ -0,0 +1,19 @@ +import { BehaviorSubject, of as observableOf } from 'rxjs'; +var SearchConfigurationServiceStub = /** @class */ (function () { + function SearchConfigurationServiceStub() { + this.searchOptions = new BehaviorSubject({}); + this.paginatedSearchOptions = new BehaviorSubject({}); + } + SearchConfigurationServiceStub.prototype.getCurrentFrontendFilters = function () { + return observableOf([]); + }; + SearchConfigurationServiceStub.prototype.getCurrentScope = function (a) { + return observableOf('test-id'); + }; + SearchConfigurationServiceStub.prototype.getCurrentConfiguration = function (a) { + return observableOf(a); + }; + return SearchConfigurationServiceStub; +}()); +export { SearchConfigurationServiceStub }; +//# sourceMappingURL=search-configuration-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/search-configuration-service-stub.js.map b/src/app/shared/testing/search-configuration-service-stub.js.map new file mode 100644 index 0000000000..1fd5e692b9 --- /dev/null +++ b/src/app/shared/testing/search-configuration-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-configuration-service-stub.js","sourceRoot":"","sources":["search-configuration-service-stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAE3D;IAAA;QAEU,kBAAa,GAAyB,IAAI,eAAe,CAAM,EAAE,CAAC,CAAC;QACnE,2BAAsB,GAAyB,IAAI,eAAe,CAAM,EAAE,CAAC,CAAC;IAatF,CAAC;IAXC,kEAAyB,GAAzB;QACE,OAAO,YAAY,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IAED,wDAAe,GAAf,UAAgB,CAAC;QACf,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,gEAAuB,GAAvB,UAAwB,CAAC;QACvB,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IACH,qCAAC;AAAD,CAAC,AAhBD,IAgBC"} \ No newline at end of file diff --git a/src/app/shared/testing/search-service-stub.js b/src/app/shared/testing/search-service-stub.js new file mode 100644 index 0000000000..d4551ef2e5 --- /dev/null +++ b/src/app/shared/testing/search-service-stub.js @@ -0,0 +1,43 @@ +import { of as observableOf, BehaviorSubject } from 'rxjs'; +import { SetViewMode } from '../view-mode'; +var SearchServiceStub = /** @class */ (function () { + function SearchServiceStub(searchLink) { + if (searchLink === void 0) { searchLink = '/search'; } + this.searchLink = searchLink; + this.subject = new BehaviorSubject(this.testViewMode); + this.viewMode = this.subject.asObservable(); + this.setViewMode(SetViewMode.List); + } + SearchServiceStub.prototype.getViewMode = function () { + return this.viewMode; + }; + SearchServiceStub.prototype.setViewMode = function (viewMode) { + this.testViewMode = viewMode; + }; + SearchServiceStub.prototype.getFacetValuesFor = function () { + return null; + }; + Object.defineProperty(SearchServiceStub.prototype, "testViewMode", { + get: function () { + return this._viewMode; + }, + set: function (viewMode) { + this._viewMode = viewMode; + this.subject.next(viewMode); + }, + enumerable: true, + configurable: true + }); + SearchServiceStub.prototype.getSearchLink = function () { + return this.searchLink; + }; + SearchServiceStub.prototype.getFilterLabels = function () { + return observableOf([]); + }; + SearchServiceStub.prototype.search = function () { + return observableOf({}); + }; + return SearchServiceStub; +}()); +export { SearchServiceStub }; +//# sourceMappingURL=search-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/search-service-stub.js.map b/src/app/shared/testing/search-service-stub.js.map new file mode 100644 index 0000000000..cb3cc5ca40 --- /dev/null +++ b/src/app/shared/testing/search-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"search-service-stub.js","sourceRoot":"","sources":["search-service-stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,IAAI,YAAY,EAAiB,eAAe,EAAE,MAAM,MAAM,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;IAOE,2BAAoB,UAA8B;QAA9B,2BAAA,EAAA,sBAA8B;QAA9B,eAAU,GAAV,UAAU,CAAoB;QAJ1C,YAAO,GAA0B,IAAI,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAEhF,aAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAGrC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,uCAAW,GAAX;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,uCAAW,GAAX,UAAY,QAAqB;QAC/B,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC;IAC/B,CAAC;IAED,6CAAiB,GAAjB;QACE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,sBAAI,2CAAY;aAAhB;YACE,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;aAED,UAAiB,QAAqB;YACpC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;YAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;;;OALA;IAOD,yCAAa,GAAb;QACE,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,2CAAe,GAAf;QACE,OAAO,YAAY,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IAED,kCAAM,GAAN;QACE,OAAO,YAAY,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IACH,wBAAC;AAAD,CAAC,AA3CD,IA2CC"} \ No newline at end of file diff --git a/src/app/shared/testing/sections-service-stub.js b/src/app/shared/testing/sections-service-stub.js new file mode 100644 index 0000000000..fc23b29ac8 --- /dev/null +++ b/src/app/shared/testing/sections-service-stub.js @@ -0,0 +1,21 @@ +var SectionsServiceStub = /** @class */ (function () { + function SectionsServiceStub() { + this.checkSectionErrors = jasmine.createSpy('checkSectionErrors'); + this.dispatchRemoveSectionErrors = jasmine.createSpy('dispatchRemoveSectionErrors'); + this.getSectionData = jasmine.createSpy('getSectionData'); + this.getSectionErrors = jasmine.createSpy('getSectionErrors'); + this.getSectionState = jasmine.createSpy('getSectionState'); + this.isSectionValid = jasmine.createSpy('isSectionValid'); + this.isSectionEnabled = jasmine.createSpy('isSectionEnabled'); + this.isSectionReadOnly = jasmine.createSpy('isSectionReadOnly'); + this.isSectionAvailable = jasmine.createSpy('isSectionAvailable'); + this.addSection = jasmine.createSpy('addSection'); + this.removeSection = jasmine.createSpy('removeSection'); + this.updateSectionData = jasmine.createSpy('updateSectionData'); + this.setSectionError = jasmine.createSpy('setSectionError'); + this.setSectionStatus = jasmine.createSpy('setSectionStatus'); + } + return SectionsServiceStub; +}()); +export { SectionsServiceStub }; +//# sourceMappingURL=sections-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/sections-service-stub.js.map b/src/app/shared/testing/sections-service-stub.js.map new file mode 100644 index 0000000000..a22b409bb2 --- /dev/null +++ b/src/app/shared/testing/sections-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sections-service-stub.js","sourceRoot":"","sources":["sections-service-stub.ts"],"names":[],"mappings":"AAAA;IAAA;QAEE,uBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QAC7D,gCAA2B,GAAG,OAAO,CAAC,SAAS,CAAC,6BAA6B,CAAC,CAAC;QAC/E,mBAAc,GAAG,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACrD,qBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACzD,oBAAe,GAAG,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACvD,mBAAc,GAAG,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACrD,qBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACzD,sBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAC3D,uBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QAC7D,eAAU,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC7C,kBAAa,GAAG,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QACnD,sBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAC3D,oBAAe,GAAG,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACvD,qBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;IAE3D,CAAC;IAAD,0BAAC;AAAD,CAAC,AAjBD,IAiBC"} \ No newline at end of file diff --git a/src/app/shared/testing/submission-json-patch-operations-service-stub.js b/src/app/shared/testing/submission-json-patch-operations-service-stub.js new file mode 100644 index 0000000000..f7fd708ccc --- /dev/null +++ b/src/app/shared/testing/submission-json-patch-operations-service-stub.js @@ -0,0 +1,10 @@ +var SubmissionJsonPatchOperationsServiceStub = /** @class */ (function () { + function SubmissionJsonPatchOperationsServiceStub() { + this.linkPath = 'workspaceitems'; + this.jsonPatchByResourceType = jasmine.createSpy('jsonPatchByResourceType'); + this.jsonPatchByResourceID = jasmine.createSpy('jsonPatchByResourceID'); + } + return SubmissionJsonPatchOperationsServiceStub; +}()); +export { SubmissionJsonPatchOperationsServiceStub }; +//# sourceMappingURL=submission-json-patch-operations-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/submission-json-patch-operations-service-stub.js.map b/src/app/shared/testing/submission-json-patch-operations-service-stub.js.map new file mode 100644 index 0000000000..1e583bd6e7 --- /dev/null +++ b/src/app/shared/testing/submission-json-patch-operations-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-json-patch-operations-service-stub.js","sourceRoot":"","sources":["submission-json-patch-operations-service-stub.ts"],"names":[],"mappings":"AAEA;IAAA;QACY,aAAQ,GAAG,gBAAgB,CAAC;QAGtC,4BAAuB,GAAG,OAAO,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;QACvE,0BAAqB,GAAG,OAAO,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;IAErE,CAAC;IAAD,+CAAC;AAAD,CAAC,AAPD,IAOC"} \ No newline at end of file diff --git a/src/app/shared/testing/submission-rest-service-stub.js b/src/app/shared/testing/submission-rest-service-stub.js new file mode 100644 index 0000000000..f8d794d0f1 --- /dev/null +++ b/src/app/shared/testing/submission-rest-service-stub.js @@ -0,0 +1,17 @@ +import { of as observableOf } from 'rxjs'; +var SubmissionRestServiceStub = /** @class */ (function () { + function SubmissionRestServiceStub() { + this.linkPath = 'workspaceitems'; + this.deleteById = jasmine.createSpy('deleteById'); + this.fetchRequest = jasmine.createSpy('fetchRequest'); + this.getDataById = jasmine.createSpy('getDataById'); + this.getDataByHref = jasmine.createSpy('getDataByHref'); + this.getEndpointByIDHref = jasmine.createSpy('getEndpointByIDHref'); + this.patchToEndpoint = jasmine.createSpy('patchToEndpoint'); + this.postToEndpoint = jasmine.createSpy('postToEndpoint').and.returnValue(observableOf({})); + this.submitData = jasmine.createSpy('submitData'); + } + return SubmissionRestServiceStub; +}()); +export { SubmissionRestServiceStub }; +//# sourceMappingURL=submission-rest-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/submission-rest-service-stub.js.map b/src/app/shared/testing/submission-rest-service-stub.js.map new file mode 100644 index 0000000000..bddd22432c --- /dev/null +++ b/src/app/shared/testing/submission-rest-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-rest-service-stub.js","sourceRoot":"","sources":["submission-rest-service-stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAO1C;IAAA;QACY,aAAQ,GAAG,gBAAgB,CAAC;QAKtC,eAAU,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC7C,iBAAY,GAAG,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QACjD,gBAAW,GAAG,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QAC/C,kBAAa,GAAG,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QACnD,wBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAC/D,oBAAe,GAAG,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACvD,mBAAc,GAAG,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;QACvF,eAAU,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAC/C,CAAC;IAAD,gCAAC;AAAD,CAAC,AAdD,IAcC"} \ No newline at end of file diff --git a/src/app/shared/testing/submission-service-stub.js b/src/app/shared/testing/submission-service-stub.js new file mode 100644 index 0000000000..2a9f4c3413 --- /dev/null +++ b/src/app/shared/testing/submission-service-stub.js @@ -0,0 +1,36 @@ +var SubmissionServiceStub = /** @class */ (function () { + function SubmissionServiceStub() { + this.changeSubmissionCollection = jasmine.createSpy('changeSubmissionCollection'); + this.createSubmission = jasmine.createSpy('createSubmission'); + this.depositSubmission = jasmine.createSpy('depositSubmission'); + this.discardSubmission = jasmine.createSpy('discardSubmission'); + this.dispatchInit = jasmine.createSpy('dispatchInit'); + this.dispatchDeposit = jasmine.createSpy('dispatchDeposit'); + this.dispatchDiscard = jasmine.createSpy('dispatchDiscard'); + this.dispatchSave = jasmine.createSpy('dispatchSave'); + this.dispatchSaveForLater = jasmine.createSpy('dispatchSaveForLater'); + this.dispatchSaveSection = jasmine.createSpy('dispatchSaveSection'); + this.getActiveSectionId = jasmine.createSpy('getActiveSectionId'); + this.getSubmissionObject = jasmine.createSpy('getSubmissionObject'); + this.getSubmissionSections = jasmine.createSpy('getSubmissionSections'); + this.getDisabledSectionsList = jasmine.createSpy('getDisabledSectionsList'); + this.getSubmissionObjectLinkName = jasmine.createSpy('getSubmissionObjectLinkName'); + this.getSubmissionScope = jasmine.createSpy('getSubmissionScope'); + this.getSubmissionStatus = jasmine.createSpy('getSubmissionStatus'); + this.getSubmissionSaveProcessingStatus = jasmine.createSpy('getSubmissionSaveProcessingStatus'); + this.getSubmissionDepositProcessingStatus = jasmine.createSpy('getSubmissionDepositProcessingStatus'); + this.isSectionHidden = jasmine.createSpy('isSectionHidden'); + this.isSubmissionLoading = jasmine.createSpy('isSubmissionLoading'); + this.notifyNewSection = jasmine.createSpy('notifyNewSection'); + this.redirectToMyDSpace = jasmine.createSpy('redirectToMyDSpace'); + this.resetAllSubmissionObjects = jasmine.createSpy('resetAllSubmissionObjects'); + this.resetSubmissionObject = jasmine.createSpy('resetSubmissionObject'); + this.retrieveSubmission = jasmine.createSpy('retrieveSubmission'); + this.setActiveSection = jasmine.createSpy('setActiveSection'); + this.startAutoSave = jasmine.createSpy('startAutoSave'); + this.stopAutoSave = jasmine.createSpy('stopAutoSave'); + } + return SubmissionServiceStub; +}()); +export { SubmissionServiceStub }; +//# sourceMappingURL=submission-service-stub.js.map \ No newline at end of file diff --git a/src/app/shared/testing/submission-service-stub.js.map b/src/app/shared/testing/submission-service-stub.js.map new file mode 100644 index 0000000000..56993567c4 --- /dev/null +++ b/src/app/shared/testing/submission-service-stub.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-service-stub.js","sourceRoot":"","sources":["submission-service-stub.ts"],"names":[],"mappings":"AAAA;IAAA;QAEE,+BAA0B,GAAG,OAAO,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC;QAC7E,qBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACzD,sBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAC3D,sBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAC3D,iBAAY,GAAG,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QACjD,oBAAe,GAAG,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACvD,oBAAe,GAAG,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACvD,iBAAY,GAAG,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QACjD,yBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;QACjE,wBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAC/D,uBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QAC7D,wBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAC/D,0BAAqB,GAAG,OAAO,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;QACnE,4BAAuB,GAAG,OAAO,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;QACvE,gCAA2B,GAAG,OAAO,CAAC,SAAS,CAAC,6BAA6B,CAAC,CAAC;QAC/E,uBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QAC7D,wBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAC/D,sCAAiC,GAAG,OAAO,CAAC,SAAS,CAAC,mCAAmC,CAAC,CAAC;QAC3F,yCAAoC,GAAG,OAAO,CAAC,SAAS,CAAC,sCAAsC,CAAC,CAAC;QACjG,oBAAe,GAAG,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACvD,wBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAC/D,qBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACzD,uBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QAC7D,8BAAyB,GAAG,OAAO,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;QAC3E,0BAAqB,GAAG,OAAO,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;QACnE,uBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QAC7D,qBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACzD,kBAAa,GAAG,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QACnD,iBAAY,GAAG,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAEnD,CAAC;IAAD,4BAAC;AAAD,CAAC,AAhCD,IAgCC"} \ No newline at end of file diff --git a/src/app/shared/testing/test-module.js b/src/app/shared/testing/test-module.js new file mode 100644 index 0000000000..a701db1869 --- /dev/null +++ b/src/app/shared/testing/test-module.js @@ -0,0 +1,37 @@ +import * as tslib_1 from "tslib"; +import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; +import { QueryParamsDirectiveStub } from './query-params-directive-stub'; +import { MySimpleItemActionComponent } from '../../+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec'; +import { CommonModule } from '@angular/common'; +import { SharedModule } from '../shared.module'; +import { RouterLinkDirectiveStub } from './router-link-directive-stub'; +import { NgComponentOutletDirectiveStub } from './ng-component-outlet-directive-stub'; +/** + * This module isn't used. It serves to prevent the AoT compiler + * complaining about components/pipes/directives that were + * created only for use in tests. + * See https://github.com/angular/angular/issues/13590 + */ +var TestModule = /** @class */ (function () { + function TestModule() { + } + TestModule = tslib_1.__decorate([ + NgModule({ + imports: [ + CommonModule, + SharedModule + ], + declarations: [ + QueryParamsDirectiveStub, + MySimpleItemActionComponent, + RouterLinkDirectiveStub, + NgComponentOutletDirectiveStub + ], schemas: [ + CUSTOM_ELEMENTS_SCHEMA + ] + }) + ], TestModule); + return TestModule; +}()); +export { TestModule }; +//# sourceMappingURL=test-module.js.map \ No newline at end of file diff --git a/src/app/shared/testing/test-module.js.map b/src/app/shared/testing/test-module.js.map new file mode 100644 index 0000000000..2d72bbf16c --- /dev/null +++ b/src/app/shared/testing/test-module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-module.js","sourceRoot":"","sources":["test-module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,sBAAsB,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+FAA+F,CAAC;AAC5I,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAEtF;;;;;GAKG;AAeH;IAAA;IAAyB,CAAC;IAAb,UAAU;QAdtB,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,YAAY;gBACZ,YAAY;aACb;YACD,YAAY,EAAE;gBACZ,wBAAwB;gBACxB,2BAA2B;gBAC3B,uBAAuB;gBACvB,8BAA8B;aAC/B,EAAE,OAAO,EAAE;gBACV,sBAAsB;aACvB;SACF,CAAC;OACW,UAAU,CAAG;IAAD,iBAAC;CAAA,AAA1B,IAA0B;SAAb,UAAU"} \ No newline at end of file diff --git a/src/app/shared/testing/utils.js b/src/app/shared/testing/utils.js new file mode 100644 index 0000000000..0bb159c359 --- /dev/null +++ b/src/app/shared/testing/utils.js @@ -0,0 +1,48 @@ +import { TestBed } from '@angular/core/testing'; +/** + * Returns true if a Native Element has a specified css class. + * + * @param element + * the Native Element + * @param className + * the class name to find + */ +export var hasClass = function (element, className) { + var classes = element.getAttribute('class'); + return classes.split(' ').indexOf(className) !== -1; +}; +/** + * Creates an instance of a component and returns test fixture. + * + * @param html + * the component's template as html + * @param type + * the type of the component to instantiate + */ +export var createTestComponent = function (html, type) { + TestBed.overrideComponent(type, { + set: { template: html } + }); + var fixture = TestBed.createComponent(type); + fixture.detectChanges(); + return fixture; +}; +/** + * Allows you to spy on a read only property + * + * @param obj + * The object to spy on + * @param prop + * The property to spy on + */ +export function spyOnOperator(obj, prop) { + var oldProp = obj[prop]; + Object.defineProperty(obj, prop, { + configurable: true, + enumerable: true, + value: oldProp, + writable: true + }); + return spyOn(obj, prop); +} +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/src/app/shared/testing/utils.js.map b/src/app/shared/testing/utils.js.map new file mode 100644 index 0000000000..16f9c73dd5 --- /dev/null +++ b/src/app/shared/testing/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAElE;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,QAAQ,GAAG,UAAC,OAAY,EAAE,SAAiB;IACtD,IAAM,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC9C,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,mBAAmB,GAAG,UAAI,IAAY,EAAE,IAAgC;IACnF,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE;QAC9B,GAAG,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC;KACtB,CAAC,CAAC;IACH,IAAM,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAE9C,OAAO,CAAC,aAAa,EAAE,CAAC;IACxB,OAAO,OAA8B,CAAC;AACxC,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,wBAAwB,GAAQ,EAAE,IAAY;IAClD,IAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1B,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE;QAC/B,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,IAAI;QAChB,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC1B,CAAC"} \ No newline at end of file diff --git a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.js b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.js new file mode 100644 index 0000000000..95df0bd9ca --- /dev/null +++ b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.js @@ -0,0 +1,81 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { TruncatableService } from '../truncatable.service'; +import { hasValue } from '../../empty.util'; +var TruncatablePartComponent = /** @class */ (function () { + function TruncatablePartComponent(service) { + this.service = service; + /** + * Number of lines shown when the part is expanded. -1 indicates no limit + */ + this.maxLines = -1; + /** + * True if the minimal height of the part should at least be as high as it's minimum amount of lines + */ + this.fixedHeight = false; + } + /** + * Initialize lines variable + */ + TruncatablePartComponent.prototype.ngOnInit = function () { + this.setLines(); + }; + /** + * Subscribe to the current state to determine how much lines should be shown of this part + */ + TruncatablePartComponent.prototype.setLines = function () { + var _this = this; + this.sub = this.service.isCollapsed(this.id).subscribe(function (collapsed) { + if (collapsed) { + _this.lines = _this.minLines.toString(); + } + else { + _this.lines = _this.maxLines < 0 ? 'none' : _this.maxLines.toString(); + } + }); + }; + /** + * Unsubscribe from the subscription + */ + TruncatablePartComponent.prototype.ngOnDestroy = function () { + if (hasValue(this.sub)) { + this.sub.unsubscribe(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Number) + ], TruncatablePartComponent.prototype, "minLines", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], TruncatablePartComponent.prototype, "maxLines", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], TruncatablePartComponent.prototype, "id", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], TruncatablePartComponent.prototype, "type", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], TruncatablePartComponent.prototype, "fixedHeight", void 0); + TruncatablePartComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-truncatable-part', + templateUrl: './truncatable-part.component.html', + styleUrls: ['./truncatable-part.component.scss'] + }) + /** + * Component that truncates/clamps a piece of text + * It needs a TruncatableComponent parent to identify it's current state + */ + , + tslib_1.__metadata("design:paramtypes", [TruncatableService]) + ], TruncatablePartComponent); + return TruncatablePartComponent; +}()); +export { TruncatablePartComponent }; +//# sourceMappingURL=truncatable-part.component.js.map \ No newline at end of file diff --git a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.js.map b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.js.map new file mode 100644 index 0000000000..130071dbdc --- /dev/null +++ b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"truncatable-part.component.js","sourceRoot":"","sources":["truncatable-part.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAY5C;IAoCE,kCAA2B,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;QA9BtD;;WAEG;QACM,aAAQ,GAAG,CAAC,CAAC,CAAC;QAYvB;;WAEG;QACM,gBAAW,GAAG,KAAK,CAAC;IAa7B,CAAC;IAED;;OAEG;IACH,2CAAQ,GAAR;QACE,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAED;;OAEG;IACK,2CAAQ,GAAhB;QAAA,iBAQC;QAPC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,UAAC,SAAkB;YACxE,IAAI,SAAS,EAAE;gBACb,KAAI,CAAC,KAAK,GAAG,KAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;aACvC;iBAAM;gBACL,KAAI,CAAC,KAAK,GAAG,KAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;aACpE;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,8CAAW,GAAX;QACE,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;SACxB;IACH,CAAC;IA9DQ;QAAR,KAAK,EAAE;;8DAAkB;IAKjB;QAAR,KAAK,EAAE;;8DAAe;IAKd;QAAR,KAAK,EAAE;;wDAAY;IAKX;QAAR,KAAK,EAAE;;0DAAc;IAKb;QAAR,KAAK,EAAE;;iEAAqB;IAxBlB,wBAAwB;QAVpC,SAAS,CAAC;YACT,QAAQ,EAAE,qBAAqB;YAC/B,WAAW,EAAE,mCAAmC;YAChD,SAAS,EAAE,CAAC,mCAAmC,CAAC;SACjD,CAAC;QAEF;;;WAGG;;iDAqCmC,kBAAkB;OApC3C,wBAAwB,CAmEpC;IAAD,+BAAC;CAAA,AAnED,IAmEC;SAnEY,wBAAwB"} \ No newline at end of file diff --git a/src/app/shared/truncatable/truncatable.actions.js b/src/app/shared/truncatable/truncatable.actions.js new file mode 100644 index 0000000000..05ae73c58a --- /dev/null +++ b/src/app/shared/truncatable/truncatable.actions.js @@ -0,0 +1,68 @@ +import * as tslib_1 from "tslib"; +import { type } from '../ngrx/type'; +/** + * For each action type in an action group, make a simple + * enum object for all of this group's action types. + * + * The 'type' utility function coerces strings into string + * literal types and runs a simple check to guarantee all + * action types in the application are unique. + */ +export var TruncatableActionTypes = { + TOGGLE: type('dspace/truncatable/TOGGLE'), + COLLAPSE: type('dspace/truncatable/COLLAPSE'), + EXPAND: type('dspace/truncatable/EXPAND'), +}; +var TruncatableAction = /** @class */ (function () { + /** + * Initialize with the truncatable component's UUID + * @param {string} id of the filter + */ + function TruncatableAction(id) { + this.id = id; + } + return TruncatableAction; +}()); +export { TruncatableAction }; +/* tslint:disable:max-classes-per-file */ +/** + * Used to collapse a truncatable component when it's expanded and expand it when it's collapsed + */ +var TruncatableToggleAction = /** @class */ (function (_super) { + tslib_1.__extends(TruncatableToggleAction, _super); + function TruncatableToggleAction() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = TruncatableActionTypes.TOGGLE; + return _this; + } + return TruncatableToggleAction; +}(TruncatableAction)); +export { TruncatableToggleAction }; +/** + * Used to collapse a truncatable component + */ +var TruncatableCollapseAction = /** @class */ (function (_super) { + tslib_1.__extends(TruncatableCollapseAction, _super); + function TruncatableCollapseAction() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = TruncatableActionTypes.COLLAPSE; + return _this; + } + return TruncatableCollapseAction; +}(TruncatableAction)); +export { TruncatableCollapseAction }; +/** + * Used to expand a truncatable component + */ +var TruncatableExpandAction = /** @class */ (function (_super) { + tslib_1.__extends(TruncatableExpandAction, _super); + function TruncatableExpandAction() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = TruncatableActionTypes.EXPAND; + return _this; + } + return TruncatableExpandAction; +}(TruncatableAction)); +export { TruncatableExpandAction }; +/* tslint:enable:max-classes-per-file */ +//# sourceMappingURL=truncatable.actions.js.map \ No newline at end of file diff --git a/src/app/shared/truncatable/truncatable.actions.js.map b/src/app/shared/truncatable/truncatable.actions.js.map new file mode 100644 index 0000000000..0483a73578 --- /dev/null +++ b/src/app/shared/truncatable/truncatable.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"truncatable.actions.js","sourceRoot":"","sources":["truncatable.actions.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,sBAAsB,GAAG;IACpC,MAAM,EAAE,IAAI,CAAC,2BAA2B,CAAC;IACzC,QAAQ,EAAE,IAAI,CAAC,6BAA6B,CAAC;IAC7C,MAAM,EAAE,IAAI,CAAC,2BAA2B,CAAC;CAC1C,CAAC;AAEF;IAWE;;;OAGG;IACH,2BAAY,EAAU;QACpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IACH,wBAAC;AAAD,CAAC,AAlBD,IAkBC;;AAED,yCAAyC;AACzC;;GAEG;AACH;IAA6C,mDAAiB;IAA9D;QAAA,qEAEC;QADC,UAAI,GAAG,sBAAsB,CAAC,MAAM,CAAC;;IACvC,CAAC;IAAD,8BAAC;AAAD,CAAC,AAFD,CAA6C,iBAAiB,GAE7D;;AAED;;GAEG;AACH;IAA+C,qDAAiB;IAAhE;QAAA,qEAEC;QADC,UAAI,GAAG,sBAAsB,CAAC,QAAQ,CAAC;;IACzC,CAAC;IAAD,gCAAC;AAAD,CAAC,AAFD,CAA+C,iBAAiB,GAE/D;;AAED;;GAEG;AACH;IAA6C,mDAAiB;IAA9D;QAAA,qEAEC;QADC,UAAI,GAAG,sBAAsB,CAAC,MAAM,CAAC;;IACvC,CAAC;IAAD,8BAAC;AAAD,CAAC,AAFD,CAA6C,iBAAiB,GAE7D;;AAED,wCAAwC"} \ No newline at end of file diff --git a/src/app/shared/truncatable/truncatable.component.js b/src/app/shared/truncatable/truncatable.component.js new file mode 100644 index 0000000000..0cc791dc02 --- /dev/null +++ b/src/app/shared/truncatable/truncatable.component.js @@ -0,0 +1,76 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { TruncatableService } from './truncatable.service'; +var TruncatableComponent = /** @class */ (function () { + function TruncatableComponent(service) { + this.service = service; + /** + * Is true when all truncatable parts in this truncatable should be expanded on loading + */ + this.initialExpand = false; + /** + * Is true when the truncatable should expand on both hover as click + */ + this.onHover = false; + } + /** + * Set the initial state + */ + TruncatableComponent.prototype.ngOnInit = function () { + if (this.initialExpand) { + this.service.expand(this.id); + } + else { + this.service.collapse(this.id); + } + }; + /** + * If onHover is true, collapses the truncatable + */ + TruncatableComponent.prototype.hoverCollapse = function () { + if (this.onHover) { + this.service.collapse(this.id); + } + }; + /** + * If onHover is true, expands the truncatable + */ + TruncatableComponent.prototype.hoverExpand = function () { + if (this.onHover) { + this.service.expand(this.id); + } + }; + /** + * Expands the truncatable when it's collapsed, collapses it when it's expanded + */ + TruncatableComponent.prototype.toggle = function () { + this.service.toggle(this.id); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], TruncatableComponent.prototype, "initialExpand", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], TruncatableComponent.prototype, "id", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], TruncatableComponent.prototype, "onHover", void 0); + TruncatableComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-truncatable', + templateUrl: './truncatable.component.html', + styleUrls: ['./truncatable.component.scss'], + }) + /** + * Component that represents a section with one or more truncatable parts that all listen to this state + */ + , + tslib_1.__metadata("design:paramtypes", [TruncatableService]) + ], TruncatableComponent); + return TruncatableComponent; +}()); +export { TruncatableComponent }; +//# sourceMappingURL=truncatable.component.js.map \ No newline at end of file diff --git a/src/app/shared/truncatable/truncatable.component.js.map b/src/app/shared/truncatable/truncatable.component.js.map new file mode 100644 index 0000000000..5a19b385d1 --- /dev/null +++ b/src/app/shared/truncatable/truncatable.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"truncatable.component.js","sourceRoot":"","sources":["truncatable.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EAAE,KAAK,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAY3D;IAgBE,8BAA2B,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;QAftD;;WAEG;QACM,kBAAa,GAAG,KAAK,CAAC;QAO/B;;WAEG;QACM,YAAO,GAAG,KAAK,CAAC;IAGzB,CAAC;IAED;;OAEG;IACH,uCAAQ,GAAR;QACE,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC9B;aAAM;YACL,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAChC;IACH,CAAC;IAED;;OAEG;IACI,4CAAa,GAApB;QACE,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAChC;IACH,CAAC;IAED;;OAEG;IACI,0CAAW,GAAlB;QACE,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC9B;IACH,CAAC;IAED;;OAEG;IACI,qCAAM,GAAb;QACE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAjDQ;QAAR,KAAK,EAAE;;+DAAuB;IAKtB;QAAR,KAAK,EAAE;;oDAAY;IAKX;QAAR,KAAK,EAAE;;yDAAiB;IAdd,oBAAoB;QAVhC,SAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,8BAA8B;YAC3C,SAAS,EAAE,CAAC,8BAA8B,CAAC;SAE5C,CAAC;QAEF;;WAEG;;iDAiBmC,kBAAkB;OAhB3C,oBAAoB,CAuDhC;IAAD,2BAAC;CAAA,AAvDD,IAuDC;SAvDY,oBAAoB"} \ No newline at end of file diff --git a/src/app/shared/truncatable/truncatable.reducer.js b/src/app/shared/truncatable/truncatable.reducer.js new file mode 100644 index 0000000000..86a1b4cae7 --- /dev/null +++ b/src/app/shared/truncatable/truncatable.reducer.js @@ -0,0 +1,42 @@ +import { TruncatableActionTypes } from './truncatable.actions'; +var initialState = Object.create(null); +/** + * Performs a truncatable action on the current state + * @param {TruncatablesState} state The state before the action is performed + * @param {TruncatableAction} action The action that should be performed + * @returns {TruncatablesState} The state after the action is performed + */ +export function truncatableReducer(state, action) { + if (state === void 0) { state = initialState; } + var _a, _b, _c; + switch (action.type) { + case TruncatableActionTypes.COLLAPSE: { + return Object.assign({}, state, (_a = {}, + _a[action.id] = { + collapsed: true, + }, + _a)); + } + case TruncatableActionTypes.EXPAND: { + return Object.assign({}, state, (_b = {}, + _b[action.id] = { + collapsed: false, + }, + _b)); + } + case TruncatableActionTypes.TOGGLE: { + if (!state[action.id]) { + state[action.id] = { collapsed: false }; + } + return Object.assign({}, state, (_c = {}, + _c[action.id] = { + collapsed: !state[action.id].collapsed, + }, + _c)); + } + default: { + return state; + } + } +} +//# sourceMappingURL=truncatable.reducer.js.map \ No newline at end of file diff --git a/src/app/shared/truncatable/truncatable.reducer.js.map b/src/app/shared/truncatable/truncatable.reducer.js.map new file mode 100644 index 0000000000..cb7da1cf4d --- /dev/null +++ b/src/app/shared/truncatable/truncatable.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"truncatable.reducer.js","sourceRoot":"","sources":["truncatable.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAgBlF,IAAM,YAAY,GAAsB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,6BAA6B,KAAoB,EAAE,MAAyB;IAA/C,sBAAA,EAAA,oBAAoB;;IAErD,QAAQ,MAAM,CAAC,IAAI,EAAE;QAEnB,KAAK,sBAAsB,CAAC,QAAQ,CAAC,CAAC;YACpC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK;gBAC5B,GAAC,MAAM,CAAC,EAAE,IAAG;oBACX,SAAS,EAAE,IAAI;iBAChB;oBACD,CAAC;SACJ;QAAC,KAAK,sBAAsB,CAAC,MAAM,CAAC,CAAC;YACpC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK;gBAC5B,GAAC,MAAM,CAAC,EAAE,IAAG;oBACX,SAAS,EAAE,KAAK;iBACjB;oBACD,CAAC;SACJ;QAAC,KAAK,sBAAsB,CAAC,MAAM,CAAC,CAAC;YACpC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;gBACrB,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAC,SAAS,EAAE,KAAK,EAAC,CAAC;aACvC;YACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK;gBAC5B,GAAC,MAAM,CAAC,EAAE,IAAG;oBACX,SAAS,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS;iBACvC;oBACD,CAAC;SACJ;QACD,OAAO,CAAC,CAAC;YACP,OAAO,KAAK,CAAC;SACd;KACF;AACH,CAAC"} \ No newline at end of file diff --git a/src/app/shared/truncatable/truncatable.service.js b/src/app/shared/truncatable/truncatable.service.js new file mode 100644 index 0000000000..fa27e455f7 --- /dev/null +++ b/src/app/shared/truncatable/truncatable.service.js @@ -0,0 +1,71 @@ +import * as tslib_1 from "tslib"; +import { map } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { createSelector, select, Store } from '@ngrx/store'; +import { TruncatableExpandAction, TruncatableToggleAction, TruncatableCollapseAction } from './truncatable.actions'; +import { hasValue } from '../empty.util'; +var truncatableStateSelector = function (state) { return state.truncatable; }; +/** + * Service responsible for truncating/clamping text and performing actions on truncatable elements + */ +var TruncatableService = /** @class */ (function () { + function TruncatableService(store) { + this.store = store; + } + /** + * Checks if a trunctable component should currently be collapsed + * @param {string} id The UUID of the truncatable component + * @returns {Observable} Emits true if the state in the store is currently collapsed for the given truncatable component + */ + TruncatableService.prototype.isCollapsed = function (id) { + return this.store.pipe(select(truncatableByIdSelector(id)), map(function (object) { + if (object) { + return object.collapsed; + } + else { + return false; + } + })); + }; + /** + * Dispatches a toggle action to the store for a given truncatable component + * @param {string} id The identifier of the truncatable for which the action is dispatched + */ + TruncatableService.prototype.toggle = function (id) { + this.store.dispatch(new TruncatableToggleAction(id)); + }; + /** + * Dispatches a collapse action to the store for a given truncatable component + * @param {string} id The identifier of the truncatable for which the action is dispatched + */ + TruncatableService.prototype.collapse = function (id) { + this.store.dispatch(new TruncatableCollapseAction(id)); + }; + /** + * Dispatches an expand action to the store for a given truncatable component + * @param {string} id The identifier of the truncatable for which the action is dispatched + */ + TruncatableService.prototype.expand = function (id) { + this.store.dispatch(new TruncatableExpandAction(id)); + }; + TruncatableService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Store]) + ], TruncatableService); + return TruncatableService; +}()); +export { TruncatableService }; +function truncatableByIdSelector(id) { + return keySelector(id); +} +export function keySelector(key) { + return createSelector(truncatableStateSelector, function (state) { + if (hasValue(state)) { + return state[key]; + } + else { + return undefined; + } + }); +} +//# sourceMappingURL=truncatable.service.js.map \ No newline at end of file diff --git a/src/app/shared/truncatable/truncatable.service.js.map b/src/app/shared/truncatable/truncatable.service.js.map new file mode 100644 index 0000000000..c7357bee07 --- /dev/null +++ b/src/app/shared/truncatable/truncatable.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"truncatable.service.js","sourceRoot":"","sources":["truncatable.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAoB,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAG9E,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,IAAM,wBAAwB,GAAG,UAAC,KAAwB,IAAK,OAAA,KAAK,CAAC,WAAW,EAAjB,CAAiB,CAAC;AAEjF;;GAEG;AAEH;IAEE,4BAAoB,KAA+B;QAA/B,UAAK,GAAL,KAAK,CAA0B;IACnD,CAAC;IAED;;;;OAIG;IACH,wCAAW,GAAX,UAAY,EAAU;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CACpB,MAAM,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC,EACnC,GAAG,CAAC,UAAC,MAAwB;YAC3B,IAAI,MAAM,EAAE;gBACV,OAAO,MAAM,CAAC,SAAS,CAAC;aACzB;iBAAM;gBACL,OAAO,KAAK,CAAC;aACd;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,mCAAM,GAAb,UAAc,EAAU;QACtB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,uBAAuB,CAAC,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACI,qCAAQ,GAAf,UAAgB,EAAU;QACxB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,yBAAyB,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACI,mCAAM,GAAb,UAAc,EAAU;QACtB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,uBAAuB,CAAC,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;IA7CU,kBAAkB;QAD9B,UAAU,EAAE;iDAGgB,KAAK;OAFrB,kBAAkB,CA8C9B;IAAD,yBAAC;CAAA,AA9CD,IA8CC;SA9CY,kBAAkB;AAgD/B,iCAAiC,EAAU;IACzC,OAAO,WAAW,CAAmB,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,sBAAyB,GAAW;IACxC,OAAO,cAAc,CAAC,wBAAwB,EAAE,UAAC,KAAuB;QACtE,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;YACnB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;SACnB;aAAM;YACL,OAAO,SAAS,CAAC;SAClB;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/src/app/shared/uploader/uploader-options.model.js b/src/app/shared/uploader/uploader-options.model.js new file mode 100644 index 0000000000..275cb21456 --- /dev/null +++ b/src/app/shared/uploader/uploader-options.model.js @@ -0,0 +1,8 @@ +var UploaderOptions = /** @class */ (function () { + function UploaderOptions() { + this.disableMultipart = false; + } + return UploaderOptions; +}()); +export { UploaderOptions }; +//# sourceMappingURL=uploader-options.model.js.map \ No newline at end of file diff --git a/src/app/shared/uploader/uploader-options.model.js.map b/src/app/shared/uploader/uploader-options.model.js.map new file mode 100644 index 0000000000..1c509cd187 --- /dev/null +++ b/src/app/shared/uploader/uploader-options.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uploader-options.model.js","sourceRoot":"","sources":["uploader-options.model.ts"],"names":[],"mappings":"AACA;IAAA;QAQE,qBAAgB,GAAG,KAAK,CAAC;IAG3B,CAAC;IAAD,sBAAC;AAAD,CAAC,AAXD,IAWC"} \ No newline at end of file diff --git a/src/app/shared/uploader/uploader.component.js b/src/app/shared/uploader/uploader.component.js new file mode 100644 index 0000000000..08dc78d757 --- /dev/null +++ b/src/app/shared/uploader/uploader.component.js @@ -0,0 +1,169 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, HostListener, Input, Output, ViewEncapsulation, } from '@angular/core'; +import { of as observableOf } from 'rxjs'; +import { FileUploader } from 'ng2-file-upload'; +import { uniqueId } from 'lodash'; +import { ScrollToService } from '@nicky-lenaers/ngx-scroll-to'; +import { UploaderOptions } from './uploader-options.model'; +import { isNotEmpty, isUndefined } from '../empty.util'; +import { UploaderService } from './uploader.service'; +var UploaderComponent = /** @class */ (function () { + function UploaderComponent(cdr, scrollToService, uploaderService) { + this.cdr = cdr; + this.scrollToService = scrollToService; + this.uploaderService = uploaderService; + /** + * The function to call when upload is completed + */ + this.onCompleteItem = new EventEmitter(); + /** + * The function to call on error occurred + */ + this.onUploadError = new EventEmitter(); + this.isOverBaseDropZone = observableOf(false); + this.isOverDocumentDropZone = observableOf(false); + } + UploaderComponent.prototype.onDragOver = function (event) { + if (this.enableDragOverDocument && this.uploaderService.isAllowedDragOverPage()) { + // Show drop area on the page + event.preventDefault(); + if (event.target.tagName !== 'HTML') { + this.isOverDocumentDropZone = observableOf(true); + } + } + }; + /** + * Method provided by Angular. Invoked after the constructor. + */ + UploaderComponent.prototype.ngOnInit = function () { + this.uploaderId = 'ds-drag-and-drop-uploader' + uniqueId(); + this.checkConfig(this.uploadFilesOptions); + this.uploader = new FileUploader({ + url: this.uploadFilesOptions.url, + authToken: this.uploadFilesOptions.authToken, + disableMultipart: this.uploadFilesOptions.disableMultipart, + itemAlias: this.uploadFilesOptions.itemAlias, + removeAfterUpload: true, + autoUpload: true + }); + if (isUndefined(this.enableDragOverDocument)) { + this.enableDragOverDocument = false; + } + if (isUndefined(this.dropMsg)) { + this.dropMsg = 'uploader.drag-message'; + } + if (isUndefined(this.dropOverDocumentMsg)) { + this.dropOverDocumentMsg = 'uploader.drag-message'; + } + }; + UploaderComponent.prototype.ngAfterViewInit = function () { + var _this = this; + // Maybe to remove: needed to avoid CORS issue with our temp upload server + this.uploader.onAfterAddingFile = (function (item) { + item.withCredentials = false; + }); + if (isUndefined(this.onBeforeUpload)) { + this.onBeforeUpload = function () { return; }; + } + this.uploader.onBeforeUploadItem = function () { + _this.onBeforeUpload(); + _this.isOverDocumentDropZone = observableOf(false); + // Move page target to the uploader + var config = { + target: _this.uploaderId + }; + _this.scrollToService.scrollTo(config); + }; + this.uploader.onCompleteItem = function (item, response, status, headers) { + if (isNotEmpty(response)) { + var responsePath = JSON.parse(response); + _this.onCompleteItem.emit(responsePath); + } + }; + this.uploader.onErrorItem = function (item, response, status, headers) { + _this.onUploadError.emit(null); + _this.uploader.cancelAll(); + }; + this.uploader.onProgressAll = function () { return _this.onProgress(); }; + this.uploader.onProgressItem = function () { return _this.onProgress(); }; + }; + /** + * Called when files are dragged on the base drop area. + */ + UploaderComponent.prototype.fileOverBase = function (isOver) { + this.isOverBaseDropZone = observableOf(isOver); + }; + /** + * Called when files are dragged on the window document drop area. + */ + UploaderComponent.prototype.fileOverDocument = function (isOver) { + if (!isOver) { + this.isOverDocumentDropZone = observableOf(isOver); + } + }; + UploaderComponent.prototype.onProgress = function () { + this.cdr.detectChanges(); + }; + /** + * Ensure options passed contains the required properties. + * + * @param fileUploadOptions + * The upload-files options object. + */ + UploaderComponent.prototype.checkConfig = function (fileUploadOptions) { + var required = ['url', 'authToken', 'disableMultipart', 'itemAlias']; + var missing = required.filter(function (prop) { + return !((prop in fileUploadOptions) && fileUploadOptions[prop] !== ''); + }); + if (0 < missing.length) { + throw new Error('UploadFiles: Argument is missing the following required properties: ' + missing.join(', ')); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], UploaderComponent.prototype, "dropMsg", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], UploaderComponent.prototype, "dropOverDocumentMsg", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Boolean) + ], UploaderComponent.prototype, "enableDragOverDocument", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Function) + ], UploaderComponent.prototype, "onBeforeUpload", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", UploaderOptions) + ], UploaderComponent.prototype, "uploadFilesOptions", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], UploaderComponent.prototype, "onCompleteItem", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], UploaderComponent.prototype, "onUploadError", void 0); + tslib_1.__decorate([ + HostListener('window:dragover', ['$event']), + tslib_1.__metadata("design:type", Function), + tslib_1.__metadata("design:paramtypes", [Object]), + tslib_1.__metadata("design:returntype", void 0) + ], UploaderComponent.prototype, "onDragOver", null); + UploaderComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-uploader', + templateUrl: 'uploader.component.html', + styleUrls: ['uploader.component.scss'], + changeDetection: ChangeDetectionStrategy.Default, + encapsulation: ViewEncapsulation.Emulated + }), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef, ScrollToService, UploaderService]) + ], UploaderComponent); + return UploaderComponent; +}()); +export { UploaderComponent }; +//# sourceMappingURL=uploader.component.js.map \ No newline at end of file diff --git a/src/app/shared/uploader/uploader.component.js.map b/src/app/shared/uploader/uploader.component.js.map new file mode 100644 index 0000000000..4c877e4536 --- /dev/null +++ b/src/app/shared/uploader/uplo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nH,iBAAiB,CAuJ7B;IAAD,wBAAC;CAAA,AAvJD,IAuJC;SAvJY,iBAAiB"} \ No newline at end of file diff --git a/src/app/shared/uploader/uploader.service.js b/src/app/shared/uploader/uploader.service.js new file mode 100644 index 0000000000..0fa0663809 --- /dev/null +++ b/src/app/shared/uploader/uploader.service.js @@ -0,0 +1,22 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +var UploaderService = /** @class */ (function () { + function UploaderService() { + this._overrideDragOverPage = false; + } + UploaderService.prototype.overrideDragOverPage = function () { + this._overrideDragOverPage = true; + }; + UploaderService.prototype.allowDragOverPage = function () { + this._overrideDragOverPage = false; + }; + UploaderService.prototype.isAllowedDragOverPage = function () { + return !this._overrideDragOverPage; + }; + UploaderService = tslib_1.__decorate([ + Injectable() + ], UploaderService); + return UploaderService; +}()); +export { UploaderService }; +//# sourceMappingURL=uploader.service.js.map \ No newline at end of file diff --git a/src/app/shared/uploader/uploader.service.js.map b/src/app/shared/uploader/uploader.service.js.map new file mode 100644 index 0000000000..b055bea6a7 --- /dev/null +++ b/src/app/shared/uploader/uploader.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uploader.service.js","sourceRoot":"","sources":["uploader.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C;IADA;QAEU,0BAAqB,GAAG,KAAK,CAAC;IAaxC,CAAC;IAXQ,8CAAoB,GAA3B;QACE,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACpC,CAAC;IAEM,2CAAiB,GAAxB;QACE,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;IACrC,CAAC;IAEM,+CAAqB,GAA5B;QACE,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC;IACrC,CAAC;IAbU,eAAe;QAD3B,UAAU,EAAE;OACA,eAAe,CAc3B;IAAD,sBAAC;CAAA,AAdD,IAcC;SAdY,eAAe"} \ No newline at end of file diff --git a/src/app/shared/utils/auto-focus.directive.js b/src/app/shared/utils/auto-focus.directive.js new file mode 100644 index 0000000000..ac441f58cf --- /dev/null +++ b/src/app/shared/utils/auto-focus.directive.js @@ -0,0 +1,37 @@ +import * as tslib_1 from "tslib"; +import { Directive, ElementRef, Input } from '@angular/core'; +import { isNotEmpty } from '../empty.util'; +/** + * Directive to set focus on an element when it is rendered + */ +var AutoFocusDirective = /** @class */ (function () { + function AutoFocusDirective(el) { + this.el = el; + /** + * Optional input to specify which element in a component should get the focus + * If left empty, the component itself will get the focus + */ + this.autoFocusSelector = undefined; + } + AutoFocusDirective.prototype.ngAfterViewInit = function () { + if (isNotEmpty(this.autoFocusSelector)) { + return this.el.nativeElement.querySelector(this.autoFocusSelector).focus(); + } + else { + return this.el.nativeElement.focus(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], AutoFocusDirective.prototype, "autoFocusSelector", void 0); + AutoFocusDirective = tslib_1.__decorate([ + Directive({ + selector: '[dsAutoFocus]' + }), + tslib_1.__metadata("design:paramtypes", [ElementRef]) + ], AutoFocusDirective); + return AutoFocusDirective; +}()); +export { AutoFocusDirective }; +//# sourceMappingURL=auto-focus.directive.js.map \ No newline at end of file diff --git a/src/app/shared/utils/auto-focus.directive.js.map b/src/app/shared/utils/auto-focus.directive.js.map new file mode 100644 index 0000000000..408250c221 --- /dev/null +++ b/src/app/shared/utils/auto-focus.directive.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auto-focus.directive.js","sourceRoot":"","sources":["auto-focus.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAiB,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;GAEG;AAIH;IAQE,4BAAoB,EAAc;QAAd,OAAE,GAAF,EAAE,CAAY;QANlC;;;WAGG;QACM,sBAAiB,GAAW,SAAS,CAAC;IAG/C,CAAC;IAED,4CAAe,GAAf;QACE,IAAI,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE;YACtC,OAAO,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE,CAAC;SAC5E;aAAM;YACL,OAAO,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;SACtC;IACH,CAAC;IAXQ;QAAR,KAAK,EAAE;;iEAAuC;IANpC,kBAAkB;QAH9B,SAAS,CAAC;YACT,QAAQ,EAAE,eAAe;SAC1B,CAAC;iDASwB,UAAU;OARvB,kBAAkB,CAkB9B;IAAD,yBAAC;CAAA,AAlBD,IAkBC;SAlBY,kBAAkB"} \ No newline at end of file diff --git a/src/app/shared/utils/capitalize.pipe.js b/src/app/shared/utils/capitalize.pipe.js new file mode 100644 index 0000000000..d9d0b0df5b --- /dev/null +++ b/src/app/shared/utils/capitalize.pipe.js @@ -0,0 +1,30 @@ +import * as tslib_1 from "tslib"; +import { Pipe } from '@angular/core'; +var CapitalizePipe = /** @class */ (function () { + /** + * Pipe for capizalizing a string + */ + function CapitalizePipe() { + } + /** + * @param {string} value String to be capitalized + * @returns {string} Capitalized version of the input value + */ + CapitalizePipe.prototype.transform = function (value) { + if (value) { + return value.charAt(0).toUpperCase() + value.slice(1); + } + return value; + }; + CapitalizePipe = tslib_1.__decorate([ + Pipe({ + name: 'dsCapitalize' + }) + /** + * Pipe for capizalizing a string + */ + ], CapitalizePipe); + return CapitalizePipe; +}()); +export { CapitalizePipe }; +//# sourceMappingURL=capitalize.pipe.js.map \ No newline at end of file diff --git a/src/app/shared/utils/capitalize.pipe.js.map b/src/app/shared/utils/capitalize.pipe.js.map new file mode 100644 index 0000000000..f909234e8a --- /dev/null +++ b/src/app/shared/utils/capitalize.pipe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"capitalize.pipe.js","sourceRoot":"","sources":["capitalize.pipe.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAA;AASnD;IAHA;;OAEG;IACH;IAYA,CAAC;IAXC;;;OAGG;IACH,kCAAS,GAAT,UAAU,KAAa;QACrB,IAAI,KAAK,EAAE;YACT,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACvD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAVU,cAAc;QAP1B,IAAI,CAAC;YACJ,IAAI,EAAE,cAAc;SACrB,CAAC;QAEF;;WAEG;OACU,cAAc,CAY1B;IAAD,qBAAC;CAAA,AAZD,IAYC;SAZY,cAAc"} \ No newline at end of file diff --git a/src/app/shared/utils/click-outside.directive.js b/src/app/shared/utils/click-outside.directive.js new file mode 100644 index 0000000000..4ba5d449a1 --- /dev/null +++ b/src/app/shared/utils/click-outside.directive.js @@ -0,0 +1,42 @@ +import * as tslib_1 from "tslib"; +import { Directive, ElementRef, Output, EventEmitter, HostListener } from '@angular/core'; +var ClickOutsideDirective = /** @class */ (function () { + function ClickOutsideDirective(_elementRef) { + this._elementRef = _elementRef; + /** + * Emits null when the user clicks outside of the element + */ + this.dsClickOutside = new EventEmitter(); + } + ClickOutsideDirective.prototype.onClick = function () { + var hostElement = this._elementRef.nativeElement; + var focusElement = hostElement.ownerDocument.activeElement; + var clickedInside = hostElement.contains(focusElement); + if (!clickedInside) { + this.dsClickOutside.emit(null); + } + }; + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], ClickOutsideDirective.prototype, "dsClickOutside", void 0); + tslib_1.__decorate([ + HostListener('document:click'), + tslib_1.__metadata("design:type", Function), + tslib_1.__metadata("design:paramtypes", []), + tslib_1.__metadata("design:returntype", void 0) + ], ClickOutsideDirective.prototype, "onClick", null); + ClickOutsideDirective = tslib_1.__decorate([ + Directive({ + selector: '[dsClickOutside]' + }) + /** + * Directive to detect when the users clicks outside of the element the directive was put on + */ + , + tslib_1.__metadata("design:paramtypes", [ElementRef]) + ], ClickOutsideDirective); + return ClickOutsideDirective; +}()); +export { ClickOutsideDirective }; +//# sourceMappingURL=click-outside.directive.js.map \ No newline at end of file diff --git a/src/app/shared/utils/click-outside.directive.js.map b/src/app/shared/utils/click-outside.directive.js.map new file mode 100644 index 0000000000..7897d896a4 --- /dev/null +++ b/src/app/shared/utils/click-outside.directive.js.map @@ -0,0 +1 @@ +{"version":3,"file":"click-outside.directive.js","sourceRoot":"","sources":["click-outside.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAQ1F;IAOE,+BAAoB,WAAuB;QAAvB,gBAAW,GAAX,WAAW,CAAY;QAN3C;;WAEG;QAEI,mBAAc,GAAG,IAAI,YAAY,EAAE,CAAC;IAG3C,CAAC;IAGM,uCAAO,GAAd;QACE,IAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC;QACnD,IAAM,YAAY,GAAG,WAAW,CAAC,aAAa,CAAC,aAAa,CAAC;QAC7D,IAAM,aAAa,GAAG,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QACzD,IAAI,CAAC,aAAa,EAAE;YAClB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAChC;IACH,CAAC;IAbD;QADC,MAAM,EAAE;;iEACkC;IAM3C;QADC,YAAY,CAAC,gBAAgB,CAAC;;;;wDAQ9B;IAlBU,qBAAqB;QANjC,SAAS,CAAC;YACT,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;QACF;;WAEG;;iDAQgC,UAAU;OAPhC,qBAAqB,CAmBjC;IAAD,4BAAC;CAAA,AAnBD,IAmBC;SAnBY,qBAAqB"} \ No newline at end of file diff --git a/src/app/shared/utils/console.pipe.js b/src/app/shared/utils/console.pipe.js new file mode 100644 index 0000000000..cab3e142a2 --- /dev/null +++ b/src/app/shared/utils/console.pipe.js @@ -0,0 +1,18 @@ +import * as tslib_1 from "tslib"; +import { Pipe } from '@angular/core'; +var ConsolePipe = /** @class */ (function () { + function ConsolePipe() { + } + ConsolePipe.prototype.transform = function (value) { + console.log(value); + return ''; + }; + ConsolePipe = tslib_1.__decorate([ + Pipe({ + name: 'dsConsole' + }) + ], ConsolePipe); + return ConsolePipe; +}()); +export { ConsolePipe }; +//# sourceMappingURL=console.pipe.js.map \ No newline at end of file diff --git a/src/app/shared/utils/console.pipe.js.map b/src/app/shared/utils/console.pipe.js.map new file mode 100644 index 0000000000..f5a70c45d2 --- /dev/null +++ b/src/app/shared/utils/console.pipe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"console.pipe.js","sourceRoot":"","sources":["console.pipe.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;AAKpD;IAAA;IAKA,CAAC;IAJC,+BAAS,GAAT,UAAU,KAAU;QAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,EAAE,CAAC;IACZ,CAAC;IAJU,WAAW;QAHvB,IAAI,CAAC;YACJ,IAAI,EAAE,WAAW;SAClB,CAAC;OACW,WAAW,CAKvB;IAAD,kBAAC;CAAA,AALD,IAKC;SALY,WAAW"} \ No newline at end of file diff --git a/src/app/shared/utils/debounce.directive.js b/src/app/shared/utils/debounce.directive.js new file mode 100644 index 0000000000..da9ea0b0d3 --- /dev/null +++ b/src/app/shared/utils/debounce.directive.js @@ -0,0 +1,64 @@ +import * as tslib_1 from "tslib"; +import { distinctUntilChanged, debounceTime, takeUntil } from 'rxjs/operators'; +import { Directive, Input, Output, EventEmitter } from '@angular/core'; +import { NgControl } from '@angular/forms'; +import { Subject } from 'rxjs'; +var DebounceDirective = /** @class */ (function () { + function DebounceDirective(model) { + this.model = model; + /** + * Emits a value when nothing has changed in dsDebounce milliseconds + */ + this.onDebounce = new EventEmitter(); + /** + * The debounce time in milliseconds + */ + this.dsDebounce = 500; + /** + * Subject to unsubscribe from + */ + this.subject = new Subject(); + } + /** + * Start listening to changes of the input field's value changes + * Emit it when the debounceTime is over without new changes + */ + DebounceDirective.prototype.ngOnInit = function () { + var _this = this; + this.model.valueChanges.pipe(takeUntil(this.subject), debounceTime(this.dsDebounce), distinctUntilChanged()) + .subscribe(function (modelValue) { + if (_this.model.dirty) { + _this.onDebounce.emit(modelValue); + } + }); + }; + /** + * Close subject + */ + DebounceDirective.prototype.ngOnDestroy = function () { + this.subject.next(); + this.subject.complete(); + }; + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], DebounceDirective.prototype, "onDebounce", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], DebounceDirective.prototype, "dsDebounce", void 0); + DebounceDirective = tslib_1.__decorate([ + Directive({ + selector: '[ngModel][dsDebounce]', + }) + /** + * Directive for setting a debounce time on an input field + * It will emit the input field's value when no changes were made to this value in a given debounce time + */ + , + tslib_1.__metadata("design:paramtypes", [NgControl]) + ], DebounceDirective); + return DebounceDirective; +}()); +export { DebounceDirective }; +//# sourceMappingURL=debounce.directive.js.map \ No newline at end of file diff --git a/src/app/shared/utils/debounce.directive.js.map b/src/app/shared/utils/debounce.directive.js.map new file mode 100644 index 0000000000..3c77363a04 --- /dev/null +++ b/src/app/shared/utils/debounce.directive.js.map @@ -0,0 +1 @@ +{"version":3,"file":"debounce.directive.js","sourceRoot":"","sources":["debounce.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,oBAAoB,EAAE,YAAY,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAqB,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAS/B;IAmBE,2BAAmB,KAAgB;QAAhB,UAAK,GAAL,KAAK,CAAW;QAjBnC;;WAEG;QAEI,eAAU,GAAG,IAAI,YAAY,EAAO,CAAC;QAE5C;;WAEG;QAEI,eAAU,GAAG,GAAG,CAAC;QAExB;;WAEG;QACK,YAAO,GAAkB,IAAI,OAAO,EAAQ,CAAC;IAGrD,CAAC;IAED;;;OAGG;IACH,oCAAQ,GAAR;QAAA,iBAUC;QATC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAC1B,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,EACvB,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,EAC7B,oBAAoB,EAAE,CAAC;aACtB,SAAS,CAAC,UAAC,UAAU;YACpB,IAAI,KAAI,CAAC,KAAK,CAAC,KAAK,EAAE;gBACpB,KAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aAClC;QACH,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,uCAAW,GAAX;QACE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAtCD;QADC,MAAM,EAAE;;yDACmC;IAM5C;QADC,KAAK,EAAE;;yDACgB;IAZb,iBAAiB;QAP7B,SAAS,CAAC;YACT,QAAQ,EAAE,uBAAuB;SAClC,CAAC;QACF;;;WAGG;;iDAoByB,SAAS;OAnBxB,iBAAiB,CA6C7B;IAAD,wBAAC;CAAA,AA7CD,IA6CC;SA7CY,iBAAiB"} \ No newline at end of file diff --git a/src/app/shared/utils/drag-click.directive.js b/src/app/shared/utils/drag-click.directive.js new file mode 100644 index 0000000000..1856c7fedb --- /dev/null +++ b/src/app/shared/utils/drag-click.directive.js @@ -0,0 +1,57 @@ +import * as tslib_1 from "tslib"; +import { Directive, EventEmitter, HostListener, Output } from '@angular/core'; +var DragClickDirective = /** @class */ (function () { + function DragClickDirective() { + /** + * Emits a click event when the click is perceived as an actual click and not a drag + */ + this.actualClick = new EventEmitter(); + } + /** + * When the mouse button is pushed down, register the start time + * @param event Mouse down event + */ + DragClickDirective.prototype.mousedownEvent = function (event) { + this.start = new Date(); + }; + /** + * When the mouse button is let go of, check how long if it was down for + * If the mouse button was down for more than 250ms, don't emit a click event + * @param event Mouse down event + */ + DragClickDirective.prototype.mouseupEvent = function (event) { + var end = new Date(); + var clickTime = end - this.start; + if (clickTime < 250) { + this.actualClick.emit(event); + } + }; + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", Object) + ], DragClickDirective.prototype, "actualClick", void 0); + tslib_1.__decorate([ + HostListener('mousedown', ['$event']), + tslib_1.__metadata("design:type", Function), + tslib_1.__metadata("design:paramtypes", [Object]), + tslib_1.__metadata("design:returntype", void 0) + ], DragClickDirective.prototype, "mousedownEvent", null); + tslib_1.__decorate([ + HostListener('mouseup', ['$event']), + tslib_1.__metadata("design:type", Function), + tslib_1.__metadata("design:paramtypes", [Object]), + tslib_1.__metadata("design:returntype", void 0) + ], DragClickDirective.prototype, "mouseupEvent", null); + DragClickDirective = tslib_1.__decorate([ + Directive({ + selector: '[dsDragClick]' + }) + /** + * Directive for preventing drag events being misinterpret as clicks + * The difference is made using the time the mouse button is pushed down + */ + ], DragClickDirective); + return DragClickDirective; +}()); +export { DragClickDirective }; +//# sourceMappingURL=drag-click.directive.js.map \ No newline at end of file diff --git a/src/app/shared/utils/drag-click.directive.js.map b/src/app/shared/utils/drag-click.directive.js.map new file mode 100644 index 0000000000..c3ec7a57a0 --- /dev/null +++ b/src/app/shared/utils/drag-click.directive.js.map @@ -0,0 +1 @@ +{"version":3,"file":"drag-click.directive.js","sourceRoot":"","sources":["drag-click.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAU9E;IARA;QAcE;;WAEG;QACO,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;IAwB7C,CAAC;IAtBC;;;OAGG;IAEH,2CAAc,GAAd,UAAe,KAAK;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IAEH,yCAAY,GAAZ,UAAa,KAAK;QAChB,IAAM,GAAG,GAAQ,IAAI,IAAI,EAAE,CAAC;QAC5B,IAAM,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC;QACnC,IAAI,SAAS,GAAG,GAAG,EAAE;YACnB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;SAC7B;IACH,CAAC;IAvBS;QAAT,MAAM,EAAE;;2DAAkC;IAO3C;QADC,YAAY,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC;;;;4DAGrC;IAQD;QADC,YAAY,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAC;;;;0DAOnC;IAhCU,kBAAkB;QAR9B,SAAS,CAAC;YACT,QAAQ,EAAE,eAAe;SAC1B,CAAC;QAEF;;;WAGG;OACU,kBAAkB,CAiC9B;IAAD,yBAAC;CAAA,AAjCD,IAiCC;SAjCY,kBAAkB"} \ No newline at end of file diff --git a/src/app/shared/utils/emphasize.pipe.js b/src/app/shared/utils/emphasize.pipe.js new file mode 100644 index 0000000000..0d2484196a --- /dev/null +++ b/src/app/shared/utils/emphasize.pipe.js @@ -0,0 +1,62 @@ +import * as tslib_1 from "tslib"; +import { Pipe } from '@angular/core'; +var EmphasizePipe = /** @class */ (function () { + function EmphasizePipe() { + /** + * Characters that should be escaped + */ + this.specials = [ + // order matters for these + '-', + '[', + ']' + // order doesn't matter for any of these + , + '/', + '{', + '}', + '(', + ')', + '*', + '+', + '?', + '.', + '\\', + '^', + '$', + '|' + ]; + /** + * Regular expression for escaping the string we're trying to find + */ + this.regex = RegExp('[' + this.specials.join('\\') + ']', 'g'); + } + /** + * + * @param haystack The string which we want to partly highlight + * @param needle The string that should become emphasized in the haystack string + * @returns {any} Transformed haystack with the needle emphasized + */ + EmphasizePipe.prototype.transform = function (haystack, needle) { + var escaped = this.escapeRegExp(needle); + var reg = new RegExp(escaped, 'gi'); + return haystack.replace(reg, '$&'); + }; + /** + * + * @param str Escape special characters in the string we're looking for + * @returns {any} The escaped version of the input string + */ + EmphasizePipe.prototype.escapeRegExp = function (str) { + return str.replace(this.regex, '\\$&'); + }; + EmphasizePipe = tslib_1.__decorate([ + Pipe({ name: 'dsEmphasize' }) + /** + * Pipe for emphasizing a part of a string by surrounding it with tags + */ + ], EmphasizePipe); + return EmphasizePipe; +}()); +export { EmphasizePipe }; +//# sourceMappingURL=emphasize.pipe.js.map \ No newline at end of file diff --git a/src/app/shared/utils/emphasize.pipe.js.map b/src/app/shared/utils/emphasize.pipe.js.map new file mode 100644 index 0000000000..fbdd8cf5df --- /dev/null +++ b/src/app/shared/utils/emphasize.pipe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"emphasize.pipe.js","sourceRoot":"","sources":["emphasize.pipe.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;AAMpD;IAJA;QAKE;;WAEG;QACH,aAAQ,GAAG;YACT,0BAA0B;YAC1B,GAAG;YACD,GAAG;YACH,GAAG;YACL,wCAAwC;;YACtC,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,IAAI;YACJ,GAAG;YACH,GAAG;YACH,GAAG;SACN,CAAC;QACF;;WAEG;QACH,UAAK,GAAG,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;IAsB5D,CAAC;IApBC;;;;;OAKG;IACH,iCAAS,GAAT,UAAU,QAAQ,EAAE,MAAM;QACxB,IAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAM,GAAG,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACtC,OAAO,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACF,oCAAY,GAAZ,UAAa,GAAG;QACf,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAhDU,aAAa;QAJzB,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;QAC9B;;WAEG;OACU,aAAa,CAiDzB;IAAD,oBAAC;CAAA,AAjDD,IAiDC;SAjDY,aAAa"} \ No newline at end of file diff --git a/src/app/shared/utils/encode-decode.util.js b/src/app/shared/utils/encode-decode.util.js new file mode 100644 index 0000000000..8c5bb712c9 --- /dev/null +++ b/src/app/shared/utils/encode-decode.util.js @@ -0,0 +1,11 @@ +/** + * use this to make a Base64 encoded string URL friendly, + * i.e. '+' and '/' are replaced with special percent-encoded hexadecimal sequences + * + * @param {String} str the encoded string + * @returns {String} the URL friendly encoded String + */ +export function Base64EncodeUrl(str) { + return str.replace(/\+/g, '%2B').replace(/\//g, '%2F').replace(/\=/g, '%3D'); +} +//# sourceMappingURL=encode-decode.util.js.map \ No newline at end of file diff --git a/src/app/shared/utils/encode-decode.util.js.map b/src/app/shared/utils/encode-decode.util.js.map new file mode 100644 index 0000000000..b9925f9b88 --- /dev/null +++ b/src/app/shared/utils/encode-decode.util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"encode-decode.util.js","sourceRoot":"","sources":["encode-decode.util.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,0BAA0B,GAAG;IACjC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC/E,CAAC"} \ No newline at end of file diff --git a/src/app/shared/utils/enum-keys-pipe.js b/src/app/shared/utils/enum-keys-pipe.js new file mode 100644 index 0000000000..99fc6f1d6b --- /dev/null +++ b/src/app/shared/utils/enum-keys-pipe.js @@ -0,0 +1,34 @@ +import * as tslib_1 from "tslib"; +import { Pipe } from '@angular/core'; +var EnumKeysPipe = /** @class */ (function () { + /** + * Pipe for parsing all values of an enumeration to an array of key-value pairs + */ + function EnumKeysPipe() { + } + /** + * @param value An enumeration + * @returns {any} Array with all keys and values of the input enumeration + */ + EnumKeysPipe.prototype.transform = function (value) { + var keys = []; + for (var enumMember in value) { + if (!isNaN(parseInt(enumMember, 10))) { + keys.push({ key: +enumMember, value: value[enumMember] }); + } + else { + keys.push({ key: enumMember, value: value[enumMember] }); + } + } + return keys; + }; + EnumKeysPipe = tslib_1.__decorate([ + Pipe({ name: 'dsKeys' }) + /** + * Pipe for parsing all values of an enumeration to an array of key-value pairs + */ + ], EnumKeysPipe); + return EnumKeysPipe; +}()); +export { EnumKeysPipe }; +//# sourceMappingURL=enum-keys-pipe.js.map \ No newline at end of file diff --git a/src/app/shared/utils/enum-keys-pipe.js.map b/src/app/shared/utils/enum-keys-pipe.js.map new file mode 100644 index 0000000000..becc3ab614 --- /dev/null +++ b/src/app/shared/utils/enum-keys-pipe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"enum-keys-pipe.js","sourceRoot":"","sources":["enum-keys-pipe.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;AAMpD;IAHA;;OAEG;IACH;IAiBA,CAAC;IAfC;;;OAGG;IACH,gCAAS,GAAT,UAAU,KAAK;QACb,IAAM,IAAI,GAAG,EAAE,CAAC;QAChB,KAAK,IAAM,UAAU,IAAI,KAAK,EAAE;YAC9B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,EAAE;gBACpC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;aAC3D;iBAAM;gBACL,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;aAC1D;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAhBU,YAAY;QAJxB,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACzB;;WAEG;OACU,YAAY,CAiBxB;IAAD,mBAAC;CAAA,AAjBD,IAiBC;SAjBY,YAAY"} \ No newline at end of file diff --git a/src/app/shared/utils/file-size-pipe.js b/src/app/shared/utils/file-size-pipe.js new file mode 100644 index 0000000000..89b893d0de --- /dev/null +++ b/src/app/shared/utils/file-size-pipe.js @@ -0,0 +1,46 @@ +import * as tslib_1 from "tslib"; +import { Pipe } from '@angular/core'; +/* + * Convert bytes into largest possible unit. + * Takes an precision argument that defaults to 2. + * Usage: + * bytes | fileSize:precision + * Example: + * {{ 1024 | fileSize}} + * formats to: 1 KB + */ +var FileSizePipe = /** @class */ (function () { + function FileSizePipe() { + this.units = [ + 'bytes', + 'KiB', + 'MiB', + 'GiB', + 'TiB', + 'PiB' + ]; + } + FileSizePipe.prototype.transform = function (bytes, precision) { + if (bytes === void 0) { bytes = 0; } + if (precision === void 0) { precision = 2; } + var result; + if (isNaN(parseFloat(String(bytes))) || !isFinite(bytes)) { + result = '?'; + } + else { + var unit = 0; + while (bytes >= 1024) { + bytes /= 1024; + unit++; + } + result = bytes.toFixed(+precision) + ' ' + this.units[unit]; + } + return result; + }; + FileSizePipe = tslib_1.__decorate([ + Pipe({ name: 'dsFileSize' }) + ], FileSizePipe); + return FileSizePipe; +}()); +export { FileSizePipe }; +//# sourceMappingURL=file-size-pipe.js.map \ No newline at end of file diff --git a/src/app/shared/utils/file-size-pipe.js.map b/src/app/shared/utils/file-size-pipe.js.map new file mode 100644 index 0000000000..15d74e29d4 --- /dev/null +++ b/src/app/shared/utils/file-size-pipe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"file-size-pipe.js","sourceRoot":"","sources":["file-size-pipe.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;AAEpD;;;;;;;;GAQG;AAGH;IADA;QAGU,UAAK,GAAa;YACxB,OAAO;YACP,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;SACN,CAAC;IAkBJ,CAAC;IAhBC,gCAAS,GAAT,UAAU,KAAiB,EAAE,SAAqB;QAAxC,sBAAA,EAAA,SAAiB;QAAE,0BAAA,EAAA,aAAqB;QAChD,IAAI,MAAc,CAAC;QACnB,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YACxD,MAAM,GAAG,GAAG,CAAC;SACd;aAAM;YACL,IAAI,IAAI,GAAG,CAAC,CAAC;YAEb,OAAO,KAAK,IAAI,IAAI,EAAE;gBACpB,KAAK,IAAI,IAAI,CAAC;gBACd,IAAI,EAAE,CAAC;aACR;YAED,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAE,SAAS,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAC9D;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IA1BU,YAAY;QADxB,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;OAChB,YAAY,CA2BxB;IAAD,mBAAC;CAAA,AA3BD,IA2BC;SA3BY,YAAY"} \ No newline at end of file diff --git a/src/app/shared/utils/in-list-validator.directive.js b/src/app/shared/utils/in-list-validator.directive.js new file mode 100644 index 0000000000..47f7bb563b --- /dev/null +++ b/src/app/shared/utils/in-list-validator.directive.js @@ -0,0 +1,36 @@ +import * as tslib_1 from "tslib"; +import { Directive, Input } from '@angular/core'; +import { NG_VALIDATORS } from '@angular/forms'; +import { inListValidator } from './validator.functions'; +/** + * Directive for validating if a ngModel value is in a given list + */ +var InListValidator = /** @class */ (function () { + function InListValidator() { + } + InListValidator_1 = InListValidator; + /** + * The function that checks if the form control's value is currently valid + * @param c The FormControl + */ + InListValidator.prototype.validate = function (c) { + return inListValidator(this.dsInListValidator)(c); + }; + var InListValidator_1; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], InListValidator.prototype, "dsInListValidator", void 0); + InListValidator = InListValidator_1 = tslib_1.__decorate([ + Directive({ + selector: '[ngModel][dsInListValidator]', + // We add our directive to the list of existing validators + providers: [ + { provide: NG_VALIDATORS, useExisting: InListValidator_1, multi: true } + ] + }) + ], InListValidator); + return InListValidator; +}()); +export { InListValidator }; +//# sourceMappingURL=in-list-validator.directive.js.map \ No newline at end of file diff --git a/src/app/shared/utils/in-list-validator.directive.js.map b/src/app/shared/utils/in-list-validator.directive.js.map new file mode 100644 index 0000000000..ae0c1ef916 --- /dev/null +++ b/src/app/shared/utils/in-list-validator.directive.js.map @@ -0,0 +1 @@ +{"version":3,"file":"in-list-validator.directive.js","sourceRoot":"","sources":["in-list-validator.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAe,aAAa,EAA+B,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;GAEG;AAQH;IAAA;IAcA,CAAC;wBAdY,eAAe;IAO1B;;;OAGG;IACH,kCAAQ,GAAR,UAAS,CAAc;QACrB,OAAO,eAAe,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;;IARD;QADC,KAAK,EAAE;;8DACoB;IALjB,eAAe;QAP3B,SAAS,CAAC;YACT,QAAQ,EAAE,8BAA8B;YACxC,0DAA0D;YAC1D,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAe,EAAE,KAAK,EAAE,IAAI,EAAE;aACtE;SACF,CAAC;OACW,eAAe,CAc3B;IAAD,sBAAC;CAAA,AAdD,IAcC;SAdY,eAAe"} \ No newline at end of file diff --git a/src/app/shared/utils/object-keys-pipe.js b/src/app/shared/utils/object-keys-pipe.js new file mode 100644 index 0000000000..7417d87598 --- /dev/null +++ b/src/app/shared/utils/object-keys-pipe.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { Pipe } from '@angular/core'; +var ObjectKeysPipe = /** @class */ (function () { + /** + * Pipe for parsing all keys of an object to an array of key-value pairs + */ + function ObjectKeysPipe() { + } + /** + * @param value An object + * @returns {any} Array with all keys the input object + */ + ObjectKeysPipe.prototype.transform = function (value, args) { + var keys = []; + Object.keys(value).forEach(function (k) { return keys.push(k); }); + return keys; + }; + ObjectKeysPipe = tslib_1.__decorate([ + Pipe({ name: 'dsObjectKeys' }) + /** + * Pipe for parsing all keys of an object to an array of key-value pairs + */ + ], ObjectKeysPipe); + return ObjectKeysPipe; +}()); +export { ObjectKeysPipe }; +//# sourceMappingURL=object-keys-pipe.js.map \ No newline at end of file diff --git a/src/app/shared/utils/object-keys-pipe.js.map b/src/app/shared/utils/object-keys-pipe.js.map new file mode 100644 index 0000000000..e4c657683f --- /dev/null +++ b/src/app/shared/utils/object-keys-pipe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-keys-pipe.js","sourceRoot":"","sources":["object-keys-pipe.ts"],"names":[],"mappings":";AAAA,OAAO,EAAiB,IAAI,EAAE,MAAM,eAAe,CAAC;AAMpD;IAHA;;OAEG;IACH;IAWA,CAAC;IATC;;;OAGG;IACH,kCAAS,GAAT,UAAU,KAAK,EAAE,IAAa;QAC5B,IAAM,IAAI,GAAG,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,CAAC,IAAK,OAAA,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAZ,CAAY,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAVU,cAAc;QAJ1B,IAAI,CAAC,EAAC,IAAI,EAAE,cAAc,EAAC,CAAC;QAC7B;;WAEG;OACU,cAAc,CAW1B;IAAD,qBAAC;CAAA,AAXD,IAWC;SAXY,cAAc"} \ No newline at end of file diff --git a/src/app/shared/utils/object-ngfor.pipe.js b/src/app/shared/utils/object-ngfor.pipe.js new file mode 100644 index 0000000000..b59199c1f9 --- /dev/null +++ b/src/app/shared/utils/object-ngfor.pipe.js @@ -0,0 +1,26 @@ +import * as tslib_1 from "tslib"; +import { Pipe } from '@angular/core'; +/** + * Pipe that allows to iterate over an object and to access to entry key and value : + * + *
+ * {{obj.key}} - {{obj.value}} + *
+ * + */ +var ObjNgFor = /** @class */ (function () { + function ObjNgFor() { + } + ObjNgFor.prototype.transform = function (value, args) { + if (args === void 0) { args = null; } + return Object.keys(value).map(function (key) { return Object.assign({ key: key }, { value: value[key] }); }); + }; + ObjNgFor = tslib_1.__decorate([ + Pipe({ + name: 'dsObjNgFor' + }) + ], ObjNgFor); + return ObjNgFor; +}()); +export { ObjNgFor }; +//# sourceMappingURL=object-ngfor.pipe.js.map \ No newline at end of file diff --git a/src/app/shared/utils/object-ngfor.pipe.js.map b/src/app/shared/utils/object-ngfor.pipe.js.map new file mode 100644 index 0000000000..dd83e440ce --- /dev/null +++ b/src/app/shared/utils/object-ngfor.pipe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-ngfor.pipe.js","sourceRoot":"","sources":["object-ngfor.pipe.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;AAEpD;;;;;;;GAOG;AAIH;IAAA;IAIA,CAAC;IAHC,4BAAS,GAAT,UAAU,KAAU,EAAE,IAAkB;QAAlB,qBAAA,EAAA,WAAkB;QACtC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,KAAA,EAAE,EAAE,EAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAC,CAAC,EAA3C,CAA2C,CAAC,CAAC;IACtF,CAAC;IAHU,QAAQ;QAHpB,IAAI,CAAC;YACJ,IAAI,EAAE,YAAY;SACnB,CAAC;OACW,QAAQ,CAIpB;IAAD,eAAC;CAAA,AAJD,IAIC;SAJY,QAAQ"} \ No newline at end of file diff --git a/src/app/shared/utils/object-values-pipe.js b/src/app/shared/utils/object-values-pipe.js new file mode 100644 index 0000000000..1e0f8123c4 --- /dev/null +++ b/src/app/shared/utils/object-values-pipe.js @@ -0,0 +1,27 @@ +import * as tslib_1 from "tslib"; +import { Pipe } from '@angular/core'; +var ObjectValuesPipe = /** @class */ (function () { + /** + * Pipe for parsing all values of an object to an array of values + */ + function ObjectValuesPipe() { + } + /** + * @param value An object + * @returns {any} Array with all values of the input object + */ + ObjectValuesPipe.prototype.transform = function (value, args) { + var values = []; + Object.values(value).forEach(function (v) { return values.push(v); }); + return values; + }; + ObjectValuesPipe = tslib_1.__decorate([ + Pipe({ name: 'dsObjectValues' }) + /** + * Pipe for parsing all values of an object to an array of values + */ + ], ObjectValuesPipe); + return ObjectValuesPipe; +}()); +export { ObjectValuesPipe }; +//# sourceMappingURL=object-values-pipe.js.map \ No newline at end of file diff --git a/src/app/shared/utils/object-values-pipe.js.map b/src/app/shared/utils/object-values-pipe.js.map new file mode 100644 index 0000000000..efbc43b95c --- /dev/null +++ b/src/app/shared/utils/object-values-pipe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-values-pipe.js","sourceRoot":"","sources":["object-values-pipe.ts"],"names":[],"mappings":";AAAA,OAAO,EAAiB,IAAI,EAAE,MAAM,eAAe,CAAC;AAMpD;IAHA;;OAEG;IACH;IAWA,CAAC;IATC;;;OAGG;IACH,oCAAS,GAAT,UAAU,KAAK,EAAE,IAAa;QAC5B,IAAM,MAAM,GAAG,EAAE,CAAC;QAClB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,CAAC,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAd,CAAc,CAAC,CAAC;QACpD,OAAO,MAAM,CAAC;IAChB,CAAC;IAVU,gBAAgB;QAJ5B,IAAI,CAAC,EAAC,IAAI,EAAE,gBAAgB,EAAC,CAAC;QAC/B;;WAEG;OACU,gBAAgB,CAW5B;IAAD,uBAAC;CAAA,AAXD,IAWC;SAXY,gBAAgB"} \ No newline at end of file diff --git a/src/app/shared/utils/safe-url-pipe.js b/src/app/shared/utils/safe-url-pipe.js new file mode 100644 index 0000000000..f7351c1bc9 --- /dev/null +++ b/src/app/shared/utils/safe-url-pipe.js @@ -0,0 +1,22 @@ +import * as tslib_1 from "tslib"; +import { Pipe } from '@angular/core'; +import { DomSanitizer } from '@angular/platform-browser'; +/** + * This pipe explicitly escapes the sanitization of a URL, + * only use this when you are sure the URL is indeed safe + */ +var SafeUrlPipe = /** @class */ (function () { + function SafeUrlPipe(domSanitizer) { + this.domSanitizer = domSanitizer; + } + SafeUrlPipe.prototype.transform = function (url) { + return this.domSanitizer.bypassSecurityTrustResourceUrl(url); + }; + SafeUrlPipe = tslib_1.__decorate([ + Pipe({ name: 'dsSafeUrl' }), + tslib_1.__metadata("design:paramtypes", [DomSanitizer]) + ], SafeUrlPipe); + return SafeUrlPipe; +}()); +export { SafeUrlPipe }; +//# sourceMappingURL=safe-url-pipe.js.map \ No newline at end of file diff --git a/src/app/shared/utils/safe-url-pipe.js.map b/src/app/shared/utils/safe-url-pipe.js.map new file mode 100644 index 0000000000..a60fd2ab30 --- /dev/null +++ b/src/app/shared/utils/safe-url-pipe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"safe-url-pipe.js","sourceRoot":"","sources":["safe-url-pipe.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;GAGG;AAGH;IACE,qBAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAI,CAAC;IACnD,+BAAS,GAAT,UAAU,GAAG;QACX,OAAO,IAAI,CAAC,YAAY,CAAC,8BAA8B,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;IAJU,WAAW;QADvB,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;iDAEQ,YAAY;OADnC,WAAW,CAKvB;IAAD,kBAAC;CAAA,AALD,IAKC;SALY,WAAW"} \ No newline at end of file diff --git a/src/app/shared/utils/truncate.pipe.js b/src/app/shared/utils/truncate.pipe.js new file mode 100644 index 0000000000..62eff60c12 --- /dev/null +++ b/src/app/shared/utils/truncate.pipe.js @@ -0,0 +1,31 @@ +import * as tslib_1 from "tslib"; +import { Pipe } from '@angular/core'; +import { hasValue } from '../empty.util'; +/** + * Pipe to truncate a value in Angular. (Take a substring, starting at 0) + * Default value: 10 + */ +var TruncatePipe = /** @class */ (function () { + function TruncatePipe() { + } + /** + * + */ + TruncatePipe.prototype.transform = function (value, args) { + if (hasValue(value)) { + var limit = (args && args.length > 0) ? parseInt(args[0], 10) : 10; // 10 as default truncate value + return value.length > limit ? value.substring(0, limit) + '...' : value; + } + else { + return value; + } + }; + TruncatePipe = tslib_1.__decorate([ + Pipe({ + name: 'dsTruncate' + }) + ], TruncatePipe); + return TruncatePipe; +}()); +export { TruncatePipe }; +//# sourceMappingURL=truncate.pipe.js.map \ No newline at end of file diff --git a/src/app/shared/utils/truncate.pipe.js.map b/src/app/shared/utils/truncate.pipe.js.map new file mode 100644 index 0000000000..684ba54aaa --- /dev/null +++ b/src/app/shared/utils/truncate.pipe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"truncate.pipe.js","sourceRoot":"","sources":["truncate.pipe.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;GAGG;AAIH;IAAA;IAcA,CAAC;IAZC;;OAEG;IACH,gCAAS,GAAT,UAAU,KAAa,EAAE,IAAc;QACrC,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;YACnB,IAAM,KAAK,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,+BAA+B;YACrG,OAAO,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;SACzE;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;IAZU,YAAY;QAHxB,IAAI,CAAC;YACJ,IAAI,EAAE,YAAY;SACnB,CAAC;OACW,YAAY,CAcxB;IAAD,mBAAC;CAAA,AAdD,IAcC;SAdY,YAAY"} \ No newline at end of file diff --git a/src/app/shared/utils/validator.functions.js b/src/app/shared/utils/validator.functions.js new file mode 100644 index 0000000000..399e00380b --- /dev/null +++ b/src/app/shared/utils/validator.functions.js @@ -0,0 +1,16 @@ +import { isNotEmpty } from '../empty.util'; +/** + * Returns a validator function to check if the control's value is in a given list + * @param list The list to look in + */ +export function inListValidator(list) { + return function (control) { + var hasValue = isNotEmpty(control.value); + var inList = true; + if (isNotEmpty(list)) { + inList = list.indexOf(control.value) > -1; + } + return (hasValue && inList) ? null : { inList: { value: control.value } }; + }; +} +//# sourceMappingURL=validator.functions.js.map \ No newline at end of file diff --git a/src/app/shared/utils/validator.functions.js.map b/src/app/shared/utils/validator.functions.js.map new file mode 100644 index 0000000000..2946ebd51e --- /dev/null +++ b/src/app/shared/utils/validator.functions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"validator.functions.js","sourceRoot":"","sources":["validator.functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;GAGG;AACH,MAAM,0BAA0B,IAAc;IAC5C,OAAO,UAAC,OAAwB;QAC9B,IAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;YACpB,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;SAC3C;QACD,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAA;IAC3E,CAAC,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/src/app/shared/utils/var.directive.js b/src/app/shared/utils/var.directive.js new file mode 100644 index 0000000000..d1f9c34878 --- /dev/null +++ b/src/app/shared/utils/var.directive.js @@ -0,0 +1,37 @@ +import * as tslib_1 from "tslib"; +import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core'; +/* tslint:disable:directive-selector */ +var VarDirective = /** @class */ (function () { + function VarDirective(vcRef, templateRef) { + this.vcRef = vcRef; + this.templateRef = templateRef; + this.context = {}; + } + Object.defineProperty(VarDirective.prototype, "ngVar", { + set: function (context) { + this.context.$implicit = this.context.ngVar = context; + this.updateView(); + }, + enumerable: true, + configurable: true + }); + VarDirective.prototype.updateView = function () { + this.vcRef.clear(); + this.vcRef.createEmbeddedView(this.templateRef, this.context); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object), + tslib_1.__metadata("design:paramtypes", [Object]) + ], VarDirective.prototype, "ngVar", null); + VarDirective = tslib_1.__decorate([ + Directive({ + selector: '[ngVar]', + }), + tslib_1.__metadata("design:paramtypes", [ViewContainerRef, TemplateRef]) + ], VarDirective); + return VarDirective; +}()); +export { VarDirective }; +/* tslint:enable:directive-selector */ +//# sourceMappingURL=var.directive.js.map \ No newline at end of file diff --git a/src/app/shared/utils/var.directive.js.map b/src/app/shared/utils/var.directive.js.map new file mode 100644 index 0000000000..96d6ffa8e4 --- /dev/null +++ b/src/app/shared/utils/var.directive.js.map @@ -0,0 +1 @@ +{"version":3,"file":"var.directive.js","sourceRoot":"","sources":["var.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEhF,uCAAuC;AAIvC;IASE,sBAAoB,KAAuB,EAAU,WAA6B;QAA9D,UAAK,GAAL,KAAK,CAAkB;QAAU,gBAAW,GAAX,WAAW,CAAkB;QAFlF,YAAO,GAAQ,EAAE,CAAC;IAEmE,CAAC;IAPtF,sBAAI,+BAAK;aAAT,UAAU,OAAY;YACpB,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC;YACtD,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC;;;OAAA;IAMD,iCAAU,GAAV;QACE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAZD;QADC,KAAK,EAAE;;;6CAIP;IALU,YAAY;QAHxB,SAAS,CAAC;YACT,QAAQ,EAAE,SAAS;SACpB,CAAC;iDAU2B,gBAAgB,EAAuB,WAAW;OATlE,YAAY,CAexB;IAAD,mBAAC;CAAA,AAfD,IAeC;SAfY,YAAY;AAgBzB,sCAAsC"} \ No newline at end of file diff --git a/src/app/shared/view-mode-switch/view-mode-switch.component.js b/src/app/shared/view-mode-switch/view-mode-switch.component.js new file mode 100644 index 0000000000..d87a82c253 --- /dev/null +++ b/src/app/shared/view-mode-switch/view-mode-switch.component.js @@ -0,0 +1,72 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { SearchService } from '../../+search-page/search-service/search.service'; +import { ViewMode } from '../../core/shared/view-mode.model'; +import { isEmpty } from '../empty.util'; +/** + * Component to switch between list and grid views. + */ +var ViewModeSwitchComponent = /** @class */ (function () { + function ViewModeSwitchComponent(searchService) { + this.searchService = searchService; + this.currentMode = ViewMode.List; + this.viewModeEnum = ViewMode; + } + ViewModeSwitchComponent.prototype.ngOnInit = function () { + var _this = this; + if (isEmpty(this.viewModeList)) { + this.viewModeList = [ViewMode.List, ViewMode.Grid]; + } + this.sub = this.searchService.getViewMode().subscribe(function (viewMode) { + _this.currentMode = viewMode; + }); + }; + ViewModeSwitchComponent.prototype.switchViewTo = function (viewMode) { + this.searchService.setViewMode(viewMode, this.getSearchLinkParts()); + }; + ViewModeSwitchComponent.prototype.ngOnDestroy = function () { + if (this.sub !== undefined) { + this.sub.unsubscribe(); + } + }; + ViewModeSwitchComponent.prototype.isToShow = function (viewMode) { + return this.viewModeList && this.viewModeList.includes(viewMode); + }; + /** + * @returns {string} The base path to the search page, or the current page when inPlaceSearch is true + */ + ViewModeSwitchComponent.prototype.getSearchLink = function () { + if (this.inPlaceSearch) { + return './'; + } + return this.searchService.getSearchLink(); + }; + /** + * @returns {string[]} The base path to the search page, or the current page when inPlaceSearch is true, split in separate pieces + */ + ViewModeSwitchComponent.prototype.getSearchLinkParts = function () { + if (this.searchService) { + return []; + } + return this.getSearchLink().split('/'); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], ViewModeSwitchComponent.prototype, "viewModeList", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ViewModeSwitchComponent.prototype, "inPlaceSearch", void 0); + ViewModeSwitchComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-view-mode-switch', + styleUrls: ['./view-mode-switch.component.scss'], + templateUrl: './view-mode-switch.component.html' + }), + tslib_1.__metadata("design:paramtypes", [SearchService]) + ], ViewModeSwitchComponent); + return ViewModeSwitchComponent; +}()); +export { ViewModeSwitchComponent }; +//# sourceMappingURL=view-mode-switch.component.js.map \ No newline at end of file diff --git a/src/app/shared/view-mode-switch/view-mode-switch.component.js.map b/src/app/shared/view-mode-switch/view-mode-switch.component.js.map new file mode 100644 index 0000000000..b99873a402 --- /dev/null +++ b/src/app/shared/view-mode-switch/view-mode-switch.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view-mode-switch.component.js","sourceRoot":"","sources":["view-mode-switch.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AAIpE,OAAO,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;GAEG;AAMH;IAYE,iCAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAJhD,gBAAW,GAAa,QAAQ,CAAC,IAAI,CAAC;QACtC,iBAAY,GAAG,QAAQ,CAAC;IAIxB,CAAC;IAED,0CAAQ,GAAR;QAAA,iBAQC;QAPC,IAAI,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;YAC9B,IAAI,CAAC,YAAY,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;SACpD;QAED,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,UAAC,QAAkB;YACvE,KAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,8CAAY,GAAZ,UAAa,QAAkB;QAC7B,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,6CAAW,GAAX;QACE,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,EAAE;YAC1B,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;SACxB;IACH,CAAC;IAED,0CAAQ,GAAR,UAAS,QAAkB;QACzB,OAAO,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACI,+CAAa,GAApB;QACE,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,OAAO,IAAI,CAAC;SACb;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,oDAAkB,GAAzB;QACE,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,OAAO,EAAE,CAAC;SACX;QACD,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IAxDQ;QAAR,KAAK,EAAE;;iEAA0B;IAKzB;QAAR,KAAK,EAAE;;kEAAe;IANZ,uBAAuB;QALnC,SAAS,CAAC;YACT,QAAQ,EAAE,qBAAqB;YAC/B,SAAS,EAAE,CAAC,mCAAmC,CAAC;YAChD,WAAW,EAAE,mCAAmC;SACjD,CAAC;iDAamC,aAAa;OAZrC,uBAAuB,CA2DnC;IAAD,8BAAC;CAAA,AA3DD,IA2DC;SA3DY,uBAAuB"} \ No newline at end of file diff --git a/src/app/shared/view-mode.js b/src/app/shared/view-mode.js new file mode 100644 index 0000000000..e0388064ad --- /dev/null +++ b/src/app/shared/view-mode.js @@ -0,0 +1,12 @@ +/** + * Enum used for defining the view-mode of a set of elements + * List Display the elements in a (vertical) list + * Grid Display the elements in a grid + */ +export var SetViewMode; +(function (SetViewMode) { + SetViewMode["List"] = "list"; + SetViewMode["Grid"] = "grid"; + SetViewMode["Detail"] = "detail"; +})(SetViewMode || (SetViewMode = {})); +//# sourceMappingURL=view-mode.js.map \ No newline at end of file diff --git a/src/app/shared/view-mode.js.map b/src/app/shared/view-mode.js.map new file mode 100644 index 0000000000..f3ad498e92 --- /dev/null +++ b/src/app/shared/view-mode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view-mode.js","sourceRoot":"","sources":["view-mode.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB"} \ No newline at end of file diff --git a/src/app/store.actions.js b/src/app/store.actions.js new file mode 100644 index 0000000000..4ea7d6d1df --- /dev/null +++ b/src/app/store.actions.js @@ -0,0 +1,15 @@ +import { type } from './shared/ngrx/type'; +export var StoreActionTypes = { + REHYDRATE: type('dspace/ngrx/REHYDRATE'), + REPLAY: type('dspace/ngrx/REPLAY') +}; +var StoreAction = /** @class */ (function () { + // tslint:disable-next-line:no-shadowed-variable + function StoreAction(type, payload) { + this.type = type; + this.payload = payload; + } + return StoreAction; +}()); +export { StoreAction }; +//# sourceMappingURL=store.actions.js.map \ No newline at end of file diff --git a/src/app/store.actions.js.map b/src/app/store.actions.js.map new file mode 100644 index 0000000000..d50b60afed --- /dev/null +++ b/src/app/store.actions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"store.actions.js","sourceRoot":"","sources":["store.actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAI1C,MAAM,CAAC,IAAM,gBAAgB,GAAG;IAC9B,SAAS,EAAE,IAAI,CAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,IAAI,CAAC,oBAAoB,CAAC;CACnC,CAAC;AAEF;IAGE,gDAAgD;IAChD,qBAAY,IAAY,EAAE,OAA4B;QACpD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IACH,kBAAC;AAAD,CAAC,AARD,IAQC"} \ No newline at end of file diff --git a/src/app/store.effects.js b/src/app/store.effects.js new file mode 100644 index 0000000000..e0f28cf43c --- /dev/null +++ b/src/app/store.effects.js @@ -0,0 +1,37 @@ +import * as tslib_1 from "tslib"; +import { of as observableOf } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { Store } from '@ngrx/store'; +import { Actions, Effect, ofType } from '@ngrx/effects'; +import { StoreActionTypes } from './store.actions'; +import { HostWindowResizeAction } from './shared/host-window.actions'; +var StoreEffects = /** @class */ (function () { + function StoreEffects(actions, store) { + this.actions = actions; + this.store = store; + this.replay = this.actions.pipe(ofType(StoreActionTypes.REPLAY), map(function (replayAction) { + // TODO: should be able to replay all actions before the browser attempts to + // replayAction.payload.forEach((action: Action) => { + // this.store.dispatch(action); + // }); + return observableOf({}); + })); + this.resize = this.actions.pipe(ofType(StoreActionTypes.REPLAY, StoreActionTypes.REHYDRATE), map(function () { return new HostWindowResizeAction(window.innerWidth, window.innerHeight); })); + } + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Object) + ], StoreEffects.prototype, "replay", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], StoreEffects.prototype, "resize", void 0); + StoreEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Actions, Store]) + ], StoreEffects); + return StoreEffects; +}()); +export { StoreEffects }; +//# sourceMappingURL=store.effects.js.map \ No newline at end of file diff --git a/src/app/store.effects.js.map b/src/app/store.effects.js.map new file mode 100644 index 0000000000..19d4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;IAfS,YAAY;QADxB,UAAU,EAAE;iDAkBkB,OAAO,EAAiB,KAAK;OAjB/C,YAAY,CAqBxB;IAAD,mBAAC;CAAA,AArBD,IAqBC;SArBY,YAAY"} \ No newline at end of file diff --git a/src/app/submission/edit/submission-edit.component.js b/src/app/submission/edit/submission-edit.component.js new file mode 100644 index 0000000000..7b15c66572 --- /dev/null +++ b/src/app/submission/edit/submission-edit.component.js @@ -0,0 +1,91 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { filter, switchMap } from 'rxjs/operators'; +import { TranslateService } from '@ngx-translate/core'; +import { hasValue, isEmpty, isNotNull } from '../../shared/empty.util'; +import { SubmissionService } from '../submission.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +/** + * This component allows to edit an existing workspaceitem/workflowitem. + */ +var SubmissionEditComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {ChangeDetectorRef} changeDetectorRef + * @param {NotificationsService} notificationsService + * @param {ActivatedRoute} route + * @param {Router} router + * @param {SubmissionService} submissionService + * @param {TranslateService} translate + */ + function SubmissionEditComponent(changeDetectorRef, notificationsService, route, router, submissionService, translate) { + this.changeDetectorRef = changeDetectorRef; + this.notificationsService = notificationsService; + this.route = route; + this.router = router; + this.submissionService = submissionService; + this.translate = translate; + /** + * Array to track all subscriptions and unsubscribe them onDestroy + * @type {Array} + */ + this.subs = []; + } + /** + * Retrieve workspaceitem/workflowitem from server and initialize all instance variables + */ + SubmissionEditComponent.prototype.ngOnInit = function () { + var _this = this; + this.subs.push(this.route.paramMap.pipe(switchMap(function (params) { return _this.submissionService.retrieveSubmission(params.get('id')); }), + // NOTE new submission is retrieved on the browser side only, so get null on server side rendering + filter(function (submissionObjectRD) { return isNotNull(submissionObjectRD); })).subscribe(function (submissionObjectRD) { + if (submissionObjectRD.hasSucceeded) { + if (isEmpty(submissionObjectRD.payload)) { + _this.notificationsService.info(null, _this.translate.get('submission.general.cannot_submit')); + _this.router.navigate(['/mydspace']); + } + else { + _this.submissionId = submissionObjectRD.payload.id.toString(); + _this.collectionId = submissionObjectRD.payload.collection.id; + _this.selfUrl = submissionObjectRD.payload.self; + _this.sections = submissionObjectRD.payload.sections; + _this.submissionDefinition = submissionObjectRD.payload.submissionDefinition; + _this.changeDetectorRef.detectChanges(); + } + } + else { + if (submissionObjectRD.error.statusCode === 404) { + // redirect to not found page + _this.router.navigate(['/404'], { skipLocationChange: true }); + } + // TODO handle generic error + } + })); + }; + /** + * Unsubscribe from all subscriptions + */ + SubmissionEditComponent.prototype.ngOnDestroy = function () { + this.subs + .filter(function (sub) { return hasValue(sub); }) + .forEach(function (sub) { return sub.unsubscribe(); }); + }; + SubmissionEditComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-edit', + styleUrls: ['./submission-edit.component.scss'], + templateUrl: './submission-edit.component.html' + }), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef, + NotificationsService, + ActivatedRoute, + Router, + SubmissionService, + TranslateService]) + ], SubmissionEditComponent); + return SubmissionEditComponent; +}()); +export { SubmissionEditComponent }; +//# sourceMappingURL=submission-edit.component.js.map \ No newline at end of file diff --git a/src/app/submission/edit/submission-edit.component.js.map b/src/app/submission/edit/submission-edit.component.js.map new file mode 100644 index 0000000000..7cd5c8b0f2 --- /dev/null +++ b/src/app/submission/edit/submission-edit.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-edit.component.js","sourceRoot":"","sources":["submission-edit.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAqB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,cAAc,EAAY,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EAAE,QAAQ,EAAE,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B,gBAAgB;OArDpC,uBAAuB,CA+FnC;IAAD,8BAAC;CAAA,AA/FD,IA+FC;SA/FY,uBAAuB"} \ No newline at end of file diff --git a/src/app/submission/form/collection/submission-form-collection.component.js b/src/app/submission/form/collection/submission-form-collection.component.js new file mode 100644 index 0000000000..654917ebd0 --- /dev/null +++ b/src/app/submission/form/collection/submission-form-collection.component.js @@ -0,0 +1,206 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, EventEmitter, HostListener, Input, Output } from '@angular/core'; +import { FormControl } from '@angular/forms'; +import { BehaviorSubject, combineLatest, of as observableOf } from 'rxjs'; +import { debounceTime, distinctUntilChanged, filter, find, flatMap, map, mergeMap, reduce, startWith } from 'rxjs/operators'; +import { CommunityDataService } from '../../../core/data/community-data.service'; +import { hasValue, isEmpty, isNotEmpty } from '../../../shared/empty.util'; +import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner'; +import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder'; +import { SubmissionService } from '../../submission.service'; +import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service'; +/** + * This component allows to show the current collection the submission belonging to and to change it. + */ +var SubmissionFormCollectionComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {ChangeDetectorRef} cdr + * @param {CommunityDataService} communityDataService + * @param {JsonPatchOperationsBuilder} operationsBuilder + * @param {SubmissionJsonPatchOperationsService} operationsService + * @param {SubmissionService} submissionService + */ + function SubmissionFormCollectionComponent(cdr, communityDataService, operationsBuilder, operationsService, submissionService) { + this.cdr = cdr; + this.communityDataService = communityDataService; + this.operationsBuilder = operationsBuilder; + this.operationsService = operationsService; + this.submissionService = submissionService; + /** + * An event fired when a different collection is selected. + * Event's payload equals to new SubmissionObject. + */ + this.collectionChange = new EventEmitter(); + /** + * A boolean representing if this dropdown button is disabled + * @type {BehaviorSubject} + */ + this.disabled$ = new BehaviorSubject(true); + /** + * The search form control + * @type {FormControl} + */ + this.searchField = new FormControl(); + /** + * A boolean representing if dropdown list is scrollable to the bottom + * @type {boolean} + */ + this.scrollableBottom = false; + /** + * A boolean representing if dropdown list is scrollable to the top + * @type {boolean} + */ + this.scrollableTop = false; + /** + * Array to track all subscriptions and unsubscribe them onDestroy + * @type {Array} + */ + this.subs = []; + } + /** + * Method called on mousewheel event, it prevent the page scroll + * when arriving at the top/bottom of dropdown menu + * + * @param event + * mousewheel event + */ + SubmissionFormCollectionComponent.prototype.onMousewheel = function (event) { + if (event.wheelDelta > 0 && this.scrollableTop) { + event.preventDefault(); + } + if (event.wheelDelta < 0 && this.scrollableBottom) { + event.preventDefault(); + } + }; + /** + * Check if dropdown scrollbar is at the top or bottom of the dropdown list + * + * @param event + */ + SubmissionFormCollectionComponent.prototype.onScroll = function (event) { + this.scrollableBottom = (event.target.scrollTop + event.target.clientHeight === event.target.scrollHeight); + this.scrollableTop = (event.target.scrollTop === 0); + }; + /** + * Initialize collection list + */ + SubmissionFormCollectionComponent.prototype.ngOnChanges = function (changes) { + var _this = this; + if (hasValue(changes.currentCollectionId) + && hasValue(changes.currentCollectionId.currentValue)) { + this.selectedCollectionId = this.currentCollectionId; + // @TODO replace with search/top browse endpoint + // @TODO implement community/subcommunity hierarchy + var communities$ = this.communityDataService.findAll().pipe(find(function (communities) { return isNotEmpty(communities.payload); }), mergeMap(function (communities) { return communities.payload.page; })); + var listCollection$ = communities$.pipe(flatMap(function (communityData) { + return communityData.collections.pipe(find(function (collections) { return !collections.isResponsePending && collections.hasSucceeded; }), mergeMap(function (collections) { return collections.payload.page; }), filter(function (collectionData) { return isNotEmpty(collectionData); }), map(function (collectionData) { return ({ + communities: [{ id: communityData.id, name: communityData.name }], + collection: { id: collectionData.id, name: collectionData.name } + }); })); + }), reduce(function (acc, value) { return acc.concat(value); }, []), startWith([])); + this.selectedCollectionName$ = communities$.pipe(flatMap(function (communityData) { + return communityData.collections.pipe(find(function (collections) { return !collections.isResponsePending && collections.hasSucceeded; }), mergeMap(function (collections) { return collections.payload.page; }), filter(function (collectionData) { return isNotEmpty(collectionData); }), filter(function (collectionData) { return collectionData.id === _this.selectedCollectionId; }), map(function (collectionData) { return collectionData.name; })); + }), startWith('')); + var searchTerm$ = this.searchField.valueChanges.pipe(debounceTime(200), distinctUntilChanged(), startWith('')); + this.searchListCollection$ = combineLatest(searchTerm$, listCollection$).pipe(map(function (_a) { + var searchTerm = _a[0], listCollection = _a[1]; + _this.disabled$.next(isEmpty(listCollection)); + if (isEmpty(searchTerm)) { + return listCollection; + } + else { + return listCollection.filter(function (v) { return v.collection.name.toLowerCase().indexOf(searchTerm.toLowerCase()) > -1; }).slice(0, 5); + } + })); + } + }; + /** + * Initialize all instance variables + */ + SubmissionFormCollectionComponent.prototype.ngOnInit = function () { + this.pathCombiner = new JsonPatchOperationPathCombiner('sections', 'collection'); + }; + /** + * Unsubscribe from all subscriptions + */ + SubmissionFormCollectionComponent.prototype.ngOnDestroy = function () { + this.subs.filter(function (sub) { return hasValue(sub); }).forEach(function (sub) { return sub.unsubscribe(); }); + }; + /** + * Emit a [collectionChange] event when a new collection is selected from list + * + * @param event + * the selected [CollectionListEntryItem] + */ + SubmissionFormCollectionComponent.prototype.onSelect = function (event) { + var _this = this; + this.searchField.reset(); + this.disabled$.next(true); + this.operationsBuilder.replace(this.pathCombiner.getPath(), event.collection.id, true); + this.subs.push(this.operationsService.jsonPatchByResourceID(this.submissionService.getSubmissionObjectLinkName(), this.submissionId, 'sections', 'collection') + .subscribe(function (submissionObject) { + _this.selectedCollectionId = event.collection.id; + _this.selectedCollectionName$ = observableOf(event.collection.name); + _this.collectionChange.emit(submissionObject[0]); + _this.submissionService.changeSubmissionCollection(_this.submissionId, event.collection.id); + _this.disabled$.next(false); + _this.cdr.detectChanges(); + })); + }; + /** + * Reset search form control on dropdown menu close + */ + SubmissionFormCollectionComponent.prototype.onClose = function () { + this.searchField.reset(); + }; + /** + * Reset search form control when dropdown menu is closed + * + * @param isOpen + * Representing if the dropdown menu is open or not. + */ + SubmissionFormCollectionComponent.prototype.toggled = function (isOpen) { + if (!isOpen) { + this.searchField.reset(); + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionFormCollectionComponent.prototype, "currentCollectionId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionFormCollectionComponent.prototype, "currentDefinition", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SubmissionFormCollectionComponent.prototype, "submissionId", void 0); + tslib_1.__decorate([ + Output(), + tslib_1.__metadata("design:type", EventEmitter) + ], SubmissionFormCollectionComponent.prototype, "collectionChange", void 0); + tslib_1.__decorate([ + HostListener('mousewheel', ['$event']), + tslib_1.__metadata("design:type", Function), + tslib_1.__metadata("design:paramtypes", [Object]), + tslib_1.__metadata("design:returntype", void 0) + ], SubmissionFormCollectionComponent.prototype, "onMousewheel", null); + SubmissionFormCollectionComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-form-collection', + styleUrls: ['./submission-form-collection.component.scss'], + templateUrl: './submission-form-collection.component.html' + }), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef, + CommunityDataService, + JsonPatchOperationsBuilder, + SubmissionJsonPatchOperationsService, + SubmissionService]) + ], SubmissionFormCollectionComponent); + return SubmissionFormCollectionComponent; +}()); +export { SubmissionFormCollectionComponent }; +//# sourceMappingURL=submission-form-collection.component.js.map \ No newline at end of file diff --git a/src/app/submission/form/collection/submission-form-collection.component.js.map b/src/app/submission/form/collection/submission-form-collection.component.js.map new file mode 100644 index 0000000000..8ceb4bbb25 --- /dev/null +++ b/src/app/submission/form/collection/submission-form-collection.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-form-collection.component.js","sourceRoot":"","sources":["submission-form-collection.component.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,KAAK,EAGL,MAAM,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;IAED;;OAEG;IACH,mDAAO,GAAP;QACE,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACH,mDAAO,GAAP,UAAQ,MAAe;QACrB,IAAI,CAAC,MAAM,EAAE;YACX,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;SAC1B;IACH,CAAC;IA1OQ;QAAR,KAAK,EAAE;;kFAA6B;IAM5B;QAAR,KAAK,EAAE;;gFAA2B;IAM1B;QAAR,KAAK,EAAE;;2EAAc;IAMZ;QAAT,MAAM,EAAE;0CAAmB,YAAY;+EAA0D;IA+E1D;QAAvC,YAAY,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,CAAC;;;;yEAOtC;IA9GU,iCAAiC;QAL7C,SAAS,CAAC;YACT,QAAQ,EAAE,+BAA+B;YACzC,SAAS,EAAE,CAAC,6CAA6C,CAAC;YAC1D,WAAW,EAAE,6CAA6C;SAC3D,CAAC;iDA0F2B,iBAAiB;YACF,oBAAoB;YACvB,0BAA0B;YAC1B,oCAAoC;YACpC,iBAAiB;OA7F7C,iCAAiC,CAiP7C;IAAD,wCAAC;CAAA,AAjPD,IAiPC;SAjPY,iCAAiC"} \ No newline at end of file diff --git a/src/app/submission/form/footer/submission-form-footer.component.js b/src/app/submission/form/footer/submission-form-footer.component.js new file mode 100644 index 0000000000..5deed53113 --- /dev/null +++ b/src/app/submission/form/footer/submission-form-footer.component.js @@ -0,0 +1,88 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { of as observableOf } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { SubmissionRestService } from '../../../core/submission/submission-rest.service'; +import { SubmissionService } from '../../submission.service'; +import { SubmissionScopeType } from '../../../core/submission/submission-scope-type'; +import { isNotEmpty } from '../../../shared/empty.util'; +/** + * This component represents submission form footer bar. + */ +var SubmissionFormFooterComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {NgbModal} modalService + * @param {SubmissionRestService} restService + * @param {SubmissionService} submissionService + */ + function SubmissionFormFooterComponent(modalService, restService, submissionService) { + this.modalService = modalService; + this.restService = restService; + this.submissionService = submissionService; + /** + * A boolean representing if submission form is valid or not + * @type {Observable} + */ + this.submissionIsInvalid = observableOf(true); + } + /** + * Initialize all instance variables + */ + SubmissionFormFooterComponent.prototype.ngOnChanges = function (changes) { + if (isNotEmpty(this.submissionId)) { + this.submissionIsInvalid = this.submissionService.getSubmissionStatus(this.submissionId).pipe(map(function (isValid) { return isValid === false; })); + this.processingSaveStatus = this.submissionService.getSubmissionSaveProcessingStatus(this.submissionId); + this.processingDepositStatus = this.submissionService.getSubmissionDepositProcessingStatus(this.submissionId); + this.showDepositAndDiscard = observableOf(this.submissionService.getSubmissionScope() === SubmissionScopeType.WorkspaceItem); + } + }; + /** + * Dispatch a submission save action + */ + SubmissionFormFooterComponent.prototype.save = function (event) { + this.submissionService.dispatchSave(this.submissionId); + }; + /** + * Dispatch a submission save for later action + */ + SubmissionFormFooterComponent.prototype.saveLater = function (event) { + this.submissionService.dispatchSaveForLater(this.submissionId); + }; + /** + * Dispatch a submission deposit action + */ + SubmissionFormFooterComponent.prototype.deposit = function (event) { + this.submissionService.dispatchDeposit(this.submissionId); + }; + /** + * Dispatch a submission discard action + */ + SubmissionFormFooterComponent.prototype.confirmDiscard = function (content) { + var _this = this; + this.modalService.open(content).result.then(function (result) { + if (result === 'ok') { + _this.submissionService.dispatchDiscard(_this.submissionId); + } + }); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionFormFooterComponent.prototype, "submissionId", void 0); + SubmissionFormFooterComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-form-footer', + styleUrls: ['./submission-form-footer.component.scss'], + templateUrl: './submission-form-footer.component.html' + }), + tslib_1.__metadata("design:paramtypes", [NgbModal, + SubmissionRestService, + SubmissionService]) + ], SubmissionFormFooterComponent); + return SubmissionFormFooterComponent; +}()); +export { SubmissionFormFooterComponent }; +//# sourceMappingURL=submission-form-footer.component.js.map \ No newline at end of file diff --git a/src/app/submission/form/footer/submission-form-footer.component.js.map b/src/app/submission/form/footer/submission-form-footer.component.js.map new file mode 100644 index 0000000000..18e2f2d481 --- /dev/null +++ b/src/app/submission/form/footer/submission-form-footer.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-form-footer.component.js","sourceRoot":"","sources":["submission-form-footer.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAA4B,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD;;GAEG;AAMH;IAgCE;;;;;;OAMG;IACH,uCAAoB,YAAsB,EACtB,WAAkC,EAClC,iBAAoC;QAFpC,iBAAY,GAAZ,YAAY,CAAU;QACtB,gBAAW,GAAX,WAAW,CAAuB;QAClC,sBAAiB,GAAjB,iBAAiB,CAAmB;QAfxD;;;WAGG;QACK,wBAAmB,GAAwB,YAAY,CAAC,IAAI,CAAC,CAAC;IAYtE,CAAC;IAED;;OAEG;IACH,mDAAW,GAAX,UAAY,OAAsB;QAChC,IAAI,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;YACjC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAC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ACrC,SAAS,EAAE,CAAC,yCAAyC,CAAC;YACtD,WAAW,EAAE,yCAAyC;SACvD,CAAC;iDAwCkC,QAAQ;YACT,qBAAqB;YACf,iBAAiB;OAzC7C,6BAA6B,CA4FzC;IAAD,oCAAC;CAAA,AA5FD,IA4FC;SA5FY,6BAA6B"} \ No newline at end of file diff --git a/src/app/submission/form/section-add/submission-form-section-add.component.js b/src/app/submission/form/section-add/submission-form-section-add.component.js new file mode 100644 index 0000000000..86caab8914 --- /dev/null +++ b/src/app/submission/form/section-add/submission-form-section-add.component.js @@ -0,0 +1,57 @@ +import * as tslib_1 from "tslib"; +import { Component, Input, } from '@angular/core'; +import { map } from 'rxjs/operators'; +import { SectionsService } from '../../sections/sections.service'; +import { HostWindowService } from '../../../shared/host-window.service'; +import { SubmissionService } from '../../submission.service'; +/** + * This component allow to add any new section to submission form + */ +var SubmissionFormSectionAddComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {SectionsService} sectionService + * @param {SubmissionService} submissionService + * @param {HostWindowService} windowService + */ + function SubmissionFormSectionAddComponent(sectionService, submissionService, windowService) { + this.sectionService = sectionService; + this.submissionService = submissionService; + this.windowService = windowService; + } + /** + * Initialize all instance variables + */ + SubmissionFormSectionAddComponent.prototype.ngOnInit = function () { + this.sectionList$ = this.submissionService.getDisabledSectionsList(this.submissionId); + this.hasSections$ = this.sectionList$.pipe(map(function (list) { return list.length > 0; })); + }; + /** + * Dispatch an action to add a new section + */ + SubmissionFormSectionAddComponent.prototype.addSection = function (sectionId) { + this.sectionService.addSection(this.submissionId, sectionId); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionFormSectionAddComponent.prototype, "collectionId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionFormSectionAddComponent.prototype, "submissionId", void 0); + SubmissionFormSectionAddComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-form-section-add', + styleUrls: ['./submission-form-section-add.component.scss'], + templateUrl: './submission-form-section-add.component.html' + }), + tslib_1.__metadata("design:paramtypes", [SectionsService, + SubmissionService, + HostWindowService]) + ], SubmissionFormSectionAddComponent); + return SubmissionFormSectionAddComponent; +}()); +export { SubmissionFormSectionAddComponent }; +//# sourceMappingURL=submission-form-section-add.component.js.map \ No newline at end of file diff --git a/src/app/submission/form/section-add/submission-form-section-add.component.js.map b/src/app/submission/form/section-add/submission-form-section-add.component.js.map new file mode 100644 index 0000000000..a31408c7fd --- /dev/null +++ b/src/app/submission/form/section-add/submission-form-section-add.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-form-section-add.component.js","sourceRoot":"","sources":["submission-form-section-add.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,GAAW,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D;;GAEG;AAMH;IA0BE;;;;;;OAMG;IACH,2CAAoB,cAA+B,EAC/B,iBAAoC,EACrC,aAAgC;QAF/B,mBAAc,GAAd,cAAc,CAAiB;QAC/B,sBAAiB,GAAjB,iBAAiB,CAAmB;QACrC,kBAAa,GAAb,aAAa,CAAmB;IACnD,CAAC;IAED;;OAEG;IACH,oDAAQ,GAAR;QACE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACtF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CACxC,GAAG,CAAC,UAAC,IAAyB,IAAK,OAAA,IAAI,CAAC,MAAM,GAAG,CAAC,EAAf,CAAe,CAAC,CACpD,CAAA;IACH,CAAC;IAED;;OAEG;IACH,sDAAU,GAAV,UAAW,SAAS;QAClB,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC;IA/CQ;QAAR,KAAK,EAAE;;2EAAsB;IAMrB;QAAR,KAAK,EAAE;;2EAAsB;IAZnB,iCAAiC;QAL7C,SAAS,CAAC;YACT,QAAQ,EAAE,gCAAgC;YAC1C,SAAS,EAAE,CAAE,8CAA8C,CAAE;YAC7D,WAAW,EAAE,8CAA8C;SAC5D,CAAC;iDAkCoC,eAAe;YACZ,iBAAiB;YACtB,iBAAiB;OAnCxC,iCAAiC,CAsD7C;IAAD,wCAAC;CAAA,AAtDD,IAsDC;SAtDY,iCAAiC"} \ No newline at end of file diff --git a/src/app/submission/form/submission-form.component.js b/src/app/submission/form/submission-form.component.js new file mode 100644 index 0000000000..086421219a --- /dev/null +++ b/src/app/submission/form/submission-form.component.js @@ -0,0 +1,158 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, Input } from '@angular/core'; +import { of as observableOf } from 'rxjs'; +import { distinctUntilChanged, filter, flatMap, map } from 'rxjs/operators'; +import { hasValue, isNotEmpty } from '../../shared/empty.util'; +import { WorkspaceitemSectionsObject } from '../../core/submission/models/workspaceitem-sections.model'; +import { SubmissionDefinitionsModel } from '../../core/config/models/config-submission-definitions.model'; +import { SubmissionService } from '../submission.service'; +import { AuthService } from '../../core/auth/auth.service'; +import { HALEndpointService } from '../../core/shared/hal-endpoint.service'; +/** + * This component represents the submission form. + */ +var SubmissionFormComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {AuthService} authService + * @param {ChangeDetectorRef} changeDetectorRef + * @param {HALEndpointService} halService + * @param {SubmissionService} submissionService + */ + function SubmissionFormComponent(authService, changeDetectorRef, halService, submissionService) { + this.authService = authService; + this.changeDetectorRef = changeDetectorRef; + this.halService = halService; + this.submissionService = submissionService; + /** + * A boolean representing if a submission form is pending + * @type {Observable} + */ + this.loading = observableOf(true); + /** + * The uploader configuration options + * @type {UploaderOptions} + */ + this.uploadFilesOptions = { + url: '', + authToken: null, + disableMultipart: false, + itemAlias: null + }; + /** + * Array to track all subscriptions and unsubscribe them onDestroy + * @type {Array} + */ + this.subs = []; + this.isActive = true; + } + /** + * Initialize all instance variables and retrieve form configuration + */ + SubmissionFormComponent.prototype.ngOnChanges = function (changes) { + var _this = this; + if (this.collectionId && this.submissionId) { + this.isActive = true; + // retrieve submission's section list + this.submissionSections = this.submissionService.getSubmissionObject(this.submissionId).pipe(filter(function () { return _this.isActive; }), map(function (submission) { return submission.isLoading; }), map(function (isLoading) { return isLoading; }), distinctUntilChanged(), flatMap(function (isLoading) { + if (!isLoading) { + return _this.getSectionsList(); + } + else { + return observableOf([]); + } + })); + // check if is submission loading + this.loading = this.submissionService.getSubmissionObject(this.submissionId).pipe(filter(function () { return _this.isActive; }), map(function (submission) { return submission.isLoading; }), map(function (isLoading) { return isLoading; }), distinctUntilChanged()); + // init submission state + this.subs.push(this.halService.getEndpoint('workspaceitems').pipe(filter(function (href) { return isNotEmpty(href); }), distinctUntilChanged()) + .subscribe(function (endpointURL) { + _this.uploadFilesOptions.authToken = _this.authService.buildAuthHeader(); + _this.uploadFilesOptions.url = endpointURL.concat("/" + _this.submissionId); + _this.definitionId = _this.submissionDefinition.name; + _this.submissionService.dispatchInit(_this.collectionId, _this.submissionId, _this.selfUrl, _this.submissionDefinition, _this.sections, null); + _this.changeDetectorRef.detectChanges(); + })); + // start auto save + this.submissionService.startAutoSave(this.submissionId); + } + }; + /** + * Unsubscribe from all subscriptions, destroy instance variables + * and reset submission state + */ + SubmissionFormComponent.prototype.ngOnDestroy = function () { + this.isActive = false; + this.submissionService.stopAutoSave(); + this.submissionService.resetAllSubmissionObjects(); + this.subs + .filter(function (subscription) { return hasValue(subscription); }) + .forEach(function (subscription) { return subscription.unsubscribe(); }); + }; + /** + * On collection change reset submission state in case of it has a different + * submission definition + * + * @param submissionObject + * new submission object + */ + SubmissionFormComponent.prototype.onCollectionChange = function (submissionObject) { + this.collectionId = submissionObject.collection.id; + if (this.definitionId !== submissionObject.submissionDefinition.name) { + this.sections = submissionObject.sections; + this.submissionDefinition = submissionObject.submissionDefinition; + this.definitionId = this.submissionDefinition.name; + this.submissionService.resetSubmissionObject(this.collectionId, this.submissionId, submissionObject.self, this.submissionDefinition, this.sections); + } + else { + this.changeDetectorRef.detectChanges(); + } + }; + /** + * Check if submission form is loading + */ + SubmissionFormComponent.prototype.isLoading = function () { + return this.loading; + }; + /** + * Check if submission form is loading + */ + SubmissionFormComponent.prototype.getSectionsList = function () { + return this.submissionService.getSubmissionSections(this.submissionId).pipe(filter(function (sections) { return isNotEmpty(sections); }), map(function (sections) { return sections; })); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionFormComponent.prototype, "collectionId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", WorkspaceitemSectionsObject) + ], SubmissionFormComponent.prototype, "sections", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionFormComponent.prototype, "selfUrl", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SubmissionDefinitionsModel) + ], SubmissionFormComponent.prototype, "submissionDefinition", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionFormComponent.prototype, "submissionId", void 0); + SubmissionFormComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-form', + styleUrls: ['./submission-form.component.scss'], + templateUrl: './submission-form.component.html', + }), + tslib_1.__metadata("design:paramtypes", [AuthService, + ChangeDetectorRef, + HALEndpointService, + SubmissionService]) + ], SubmissionFormComponent); + return SubmissionFormComponent; +}()); +export { SubmissionFormComponent }; +//# sourceMappingURL=submission-form.component.js.map \ No newline at end of file diff --git a/src/app/submission/form/submission-form.component.js.map b/src/app/submission/form/submission-form.component.js.map new file mode 100644 index 0000000000..0632de842a --- /dev/null +++ b/src/app/submission/form/submission-form.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-form.component.js","sourceRoot":"","sources":["submission-form.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,EAAuC,MAAM,eAAe,CAAC;AAEzG,OAAO,EAAE,EAAE,IAAI,YAAY,EAA4B,MAAM,MAAM,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAC;AACxG,OAAO,EAAE,0BAA0B,EAAE,MAAM,8DAA8D,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAI5E;;GAEG;AAMH;IAyEE;;;;;;;OAOG;IACH,iCACU,WAAwB,EACxB,iBAAoC,EACpC,UAA8B,EAC9B,iBAAoC;QAHpC,gBAAW,GAAX,WAAW,CAAa;QACxB,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,eAAU,GAAV,UAAU,CAAoB;QAC9B,sBAAiB,GAAjB,iBAAiB,CAAmB;QA/C9C;;;WAGG;QACI,YAAO,GAAwB,YAAY,CAAC,IAAI,CAAC,CAAC;QAQzD;;;WAGG;QACI,uBAAkB,GAAoB;YAC3C,GAAG,EAAE,EAAE;YACP,SAAS,EAAE,IAAI;YACf,gBAAgB,EAAE,KAAK;YACvB,SAAS,EAAE,IAAI;SAChB,CAAC;QAQF;;;WAGG;QACO,SAAI,GAAmB,EAAE,CAAC;QAelC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED;;OA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CAAC,kCAAkC,CAAC;YAC/C,WAAW,EAAE,kCAAkC;SAChD,CAAC;iDAmFuB,WAAW;YACL,iBAAiB;YACxB,kBAAkB;YACX,iBAAiB;OArFnC,uBAAuB,CAkMnC;IAAD,8BAAC;CAAA,AAlMD,IAkMC;SAlMY,uBAAuB"} \ No newline at end of file diff --git a/src/app/submission/form/submission-upload-files/submission-upload-files.component.js b/src/app/submission/form/submission-upload-files/submission-upload-files.component.js new file mode 100644 index 0000000000..f65c017f5e --- /dev/null +++ b/src/app/submission/form/submission-upload-files/submission-upload-files.component.js @@ -0,0 +1,155 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; +import { of as observableOf } from 'rxjs'; +import { first } from 'rxjs/operators'; +import { SectionsService } from '../../sections/sections.service'; +import { hasValue, isEmpty, isNotEmpty } from '../../../shared/empty.util'; +import { normalizeSectionData } from '../../../core/submission/submission-response-parsing.service'; +import { SubmissionService } from '../../submission.service'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { UploaderOptions } from '../../../shared/uploader/uploader-options.model'; +import parseSectionErrors from '../../utils/parseSectionErrors'; +import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service'; +/** + * This component represents the drop zone that provides to add files to the submission. + */ +var SubmissionUploadFilesComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {NotificationsService} notificationsService + * @param {SubmissionJsonPatchOperationsService} operationsService + * @param {SectionsService} sectionService + * @param {SubmissionService} submissionService + * @param {TranslateService} translate + */ + function SubmissionUploadFilesComponent(notificationsService, operationsService, sectionService, submissionService, translate) { + var _this = this; + this.notificationsService = notificationsService; + this.operationsService = operationsService; + this.sectionService = sectionService; + this.submissionService = submissionService; + this.translate = translate; + /** + * A boolean representing if is possible to active drop zone over the document page + * @type {boolean} + */ + this.enableDragOverDocument = true; + /** + * i18n message label + * @type {string} + */ + this.dropOverDocumentMsg = 'submission.sections.upload.drop-message'; + /** + * i18n message label + * @type {string} + */ + this.dropMsg = 'submission.sections.upload.drop-message'; + /** + * Array to track all subscriptions and unsubscribe them onDestroy + * @type {Array} + */ + this.subs = []; + /** + * A boolean representing if upload functionality is enabled + * @type {boolean} + */ + this.uploadEnabled = observableOf(false); + /** + * Save submission before to upload a file + */ + this.onBeforeUpload = function () { + var sub = _this.operationsService.jsonPatchByResourceType(_this.submissionService.getSubmissionObjectLinkName(), _this.submissionId, 'sections') + .subscribe(); + _this.subs.push(sub); + return sub; + }; + } + /** + * Check if upload functionality is enabled + */ + SubmissionUploadFilesComponent.prototype.ngOnChanges = function () { + this.uploadEnabled = this.sectionService.isSectionAvailable(this.submissionId, this.sectionId); + }; + /** + * Parse the submission object retrieved from REST after upload + * + * @param workspaceitem + * The submission object retrieved from REST + */ + SubmissionUploadFilesComponent.prototype.onCompleteItem = function (workspaceitem) { + var _this = this; + // Checks if upload section is enabled so do upload + this.subs.push(this.uploadEnabled + .pipe(first()) + .subscribe(function (isUploadEnabled) { + if (isUploadEnabled) { + var sections_1 = workspaceitem.sections; + var errors = workspaceitem.errors; + var errorsList_1 = parseSectionErrors(errors); + if (sections_1 && isNotEmpty(sections_1)) { + Object.keys(sections_1) + .forEach(function (sectionId) { + var sectionData = normalizeSectionData(sections_1[sectionId]); + var sectionErrors = errorsList_1[sectionId]; + if (sectionId === 'upload') { + // Look for errors on upload + if ((isEmpty(sectionErrors))) { + _this.notificationsService.success(null, _this.translate.get('submission.sections.upload.upload-successful')); + } + else { + _this.notificationsService.error(null, _this.translate.get('submission.sections.upload.upload-failed')); + } + } + _this.sectionService.updateSectionData(_this.submissionId, sectionId, sectionData, sectionErrors); + }); + } + } + })); + }; + /** + * Show error notification on upload fails + */ + SubmissionUploadFilesComponent.prototype.onUploadError = function () { + this.notificationsService.error(null, this.translate.get('submission.sections.upload.upload-failed')); + }; + /** + * Unsubscribe from all subscriptions + */ + SubmissionUploadFilesComponent.prototype.ngOnDestroy = function () { + this.subs + .filter(function (subscription) { return hasValue(subscription); }) + .forEach(function (subscription) { return subscription.unsubscribe(); }); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionUploadFilesComponent.prototype, "collectionId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionUploadFilesComponent.prototype, "submissionId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionUploadFilesComponent.prototype, "sectionId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", UploaderOptions) + ], SubmissionUploadFilesComponent.prototype, "uploadFilesOptions", void 0); + SubmissionUploadFilesComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-upload-files', + templateUrl: './submission-upload-files.component.html', + }), + tslib_1.__metadata("design:paramtypes", [NotificationsService, + SubmissionJsonPatchOperationsService, + SectionsService, + SubmissionService, + TranslateService]) + ], SubmissionUploadFilesComponent); + return SubmissionUploadFilesComponent; +}()); +export { SubmissionUploadFilesComponent }; +//# sourceMappingURL=submission-upload-files.component.js.map \ No newline at end of file diff --git a/src/app/submission/form/submission-upload-files/submission-upload-files.component.js.map b/src/app/submission/form/submission-upload-files/submission-upload-files.component.js.map new file mode 100644 index 0000000000..b34e999553 --- /dev/null +++ b/src/app/submission/form/submission-upload-files/submission-upload-files.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-upload-files.component.js","sourceRoot":"","sources":["submission-upload-files.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAa,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAc,EAAE,IAAI,YAAY,EAAgB,MAAM,MAAM,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,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SAAS,EAAE,WAAW,EAAE,aAAa,CAAC,CAAA;oBACjG,CAAC,CAAC,CAAA;iBACL;aAEF;QACH,CAAC,CAAC,CACL,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,sDAAa,GAApB;QACE,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC,CAAC;IACxG,CAAC;IAED;;OAEG;IACH,oDAAW,GAAX;QACE,IAAI,CAAC,IAAI;aACN,MAAM,CAAC,UAAC,YAAY,IAAK,OAAA,QAAQ,CAAC,YAAY,CAAC,EAAtB,CAAsB,CAAC;aAChD,OAAO,CAAC,UAAC,YAAY,IAAK,OAAA,YAAY,CAAC,WAAW,EAAE,EAA1B,CAA0B,CAAC,CAAC;IAC3D,CAAC;IA5IQ;QAAR,KAAK,EAAE;;wEAAsB;IAMrB;QAAR,KAAK,EAAE;;wEAAsB;IAMrB;QAAR,KAAK,EAAE;;qEAAmB;IAMlB;QAAR,KAAK,EAAE;0CAAqB,eAAe;8EAAC;IAxBlC,8BAA8B;QAJ1C,SAAS,CAAC;YACT,QAAQ,EAAE,4BAA4B;YACtC,WAAW,EAAE,0CAA0C;SACxD,CAAC;iDA+E0C,oBAAoB;YACvB,oCAAoC;YACvC,eAAe;YACZ,iBAAiB;YACzB,gBAAgB;OAlFpC,8BAA8B,CAmJ1C;IAAD,qCAAC;CAAA,AAnJD,IAmJC;SAnJY,8BAA8B"} \ No newline at end of file diff --git a/src/app/submission/objects/submission-objects.actions.js b/src/app/submission/objects/submission-objects.actions.js new file mode 100644 index 0000000000..34cf2a3b7f --- /dev/null +++ b/src/app/submission/objects/submission-objects.actions.js @@ -0,0 +1,588 @@ +import { type } from '../../shared/ngrx/type'; +/** + * For each action type in an action group, make a simple + * enum object for all of this group's action types. + * + * The 'type' utility function coerces strings into string + * literal types and runs a simple check to guarantee all + * action types in the application are unique. + */ +export var SubmissionObjectActionTypes = { + // Section types + INIT_SUBMISSION_FORM: type('dspace/submission/INIT_SUBMISSION_FORM'), + RESET_SUBMISSION_FORM: type('dspace/submission/RESET_SUBMISSION_FORM'), + CANCEL_SUBMISSION_FORM: type('dspace/submission/CANCEL_SUBMISSION_FORM'), + COMPLETE_INIT_SUBMISSION_FORM: type('dspace/submission/COMPLETE_INIT_SUBMISSION_FORM'), + SAVE_FOR_LATER_SUBMISSION_FORM: type('dspace/submission/SAVE_FOR_LATER_SUBMISSION_FORM'), + SAVE_FOR_LATER_SUBMISSION_FORM_SUCCESS: type('dspace/submission/SAVE_FOR_LATER_SUBMISSION_FORM_SUCCESS'), + SAVE_FOR_LATER_SUBMISSION_FORM_ERROR: type('dspace/submission/SAVE_FOR_LATER_SUBMISSION_FORM_ERROR'), + SAVE_SUBMISSION_FORM: type('dspace/submission/SAVE_SUBMISSION_FORM'), + SAVE_SUBMISSION_FORM_SUCCESS: type('dspace/submission/SAVE_SUBMISSION_FORM_SUCCESS'), + SAVE_SUBMISSION_FORM_ERROR: type('dspace/submission/SAVE_SUBMISSION_FORM_ERROR'), + SAVE_SUBMISSION_SECTION_FORM: type('dspace/submission/SAVE_SUBMISSION_SECTION_FORM'), + SAVE_SUBMISSION_SECTION_FORM_SUCCESS: type('dspace/submission/SAVE_SUBMISSION_SECTION_FORM_SUCCESS'), + SAVE_SUBMISSION_SECTION_FORM_ERROR: type('dspace/submission/SAVE_SUBMISSION_SECTION_FORM_ERROR'), + CHANGE_SUBMISSION_COLLECTION: type('dspace/submission/CHANGE_SUBMISSION_COLLECTION'), + SET_ACTIVE_SECTION: type('dspace/submission/SET_ACTIVE_SECTION'), + INIT_SECTION: type('dspace/submission/INIT_SECTION'), + ENABLE_SECTION: type('dspace/submission/ENABLE_SECTION'), + DISABLE_SECTION: type('dspace/submission/DISABLE_SECTION'), + SECTION_STATUS_CHANGE: type('dspace/submission/SECTION_STATUS_CHANGE'), + SECTION_LOADING_STATUS_CHANGE: type('dspace/submission/SECTION_LOADING_STATUS_CHANGE'), + UPLOAD_SECTION_DATA: type('dspace/submission/UPLOAD_SECTION_DATA'), + SAVE_AND_DEPOSIT_SUBMISSION: type('dspace/submission/SAVE_AND_DEPOSIT_SUBMISSION'), + DEPOSIT_SUBMISSION: type('dspace/submission/DEPOSIT_SUBMISSION'), + DEPOSIT_SUBMISSION_SUCCESS: type('dspace/submission/DEPOSIT_SUBMISSION_SUCCESS'), + DEPOSIT_SUBMISSION_ERROR: type('dspace/submission/DEPOSIT_SUBMISSION_ERROR'), + DISCARD_SUBMISSION: type('dspace/submission/DISCARD_SUBMISSION'), + DISCARD_SUBMISSION_SUCCESS: type('dspace/submission/DISCARD_SUBMISSION_SUCCESS'), + DISCARD_SUBMISSION_ERROR: type('dspace/submission/DISCARD_SUBMISSION_ERROR'), + // Upload file types + NEW_FILE: type('dspace/submission/NEW_FILE'), + EDIT_FILE_DATA: type('dspace/submission/EDIT_FILE_DATA'), + DELETE_FILE: type('dspace/submission/DELETE_FILE'), + // Errors + ADD_SECTION_ERROR: type('dspace/submission/ADD_SECTION_ERROR'), + DELETE_SECTION_ERROR: type('dspace/submission/DELETE_SECTION_ERROR'), + REMOVE_SECTION_ERRORS: type('dspace/submission/REMOVE_SECTION_ERRORS'), +}; +/* tslint:disable:max-classes-per-file */ +/** + * Insert a new error of type SubmissionSectionError into the given section + * @param {string} submissionId + * @param {string} sectionId + * @param {SubmissionSectionError} error + */ +var InertSectionErrorsAction = /** @class */ (function () { + function InertSectionErrorsAction(submissionId, sectionId, error) { + this.type = SubmissionObjectActionTypes.ADD_SECTION_ERROR; + this.payload = { submissionId: submissionId, sectionId: sectionId, error: error }; + } + return InertSectionErrorsAction; +}()); +export { InertSectionErrorsAction }; +/** + * Delete a SubmissionSectionError from the given section + * @param {string} submissionId + * @param {string} sectionId + * @param {string | SubmissionSectionError} error + */ +var DeleteSectionErrorsAction = /** @class */ (function () { + function DeleteSectionErrorsAction(submissionId, sectionId, errors) { + this.type = SubmissionObjectActionTypes.DELETE_SECTION_ERROR; + this.payload = { submissionId: submissionId, sectionId: sectionId, errors: errors }; + } + return DeleteSectionErrorsAction; +}()); +export { DeleteSectionErrorsAction }; +// Section actions +var InitSectionAction = /** @class */ (function () { + /** + * Create a new InitSectionAction + * + * @param submissionId + * the submission's ID to remove + * @param sectionId + * the section's ID to add + * @param header + * the section's header + * @param config + * the section's config + * @param mandatory + * the section's mandatory + * @param sectionType + * the section's type + * @param visibility + * the section's visibility + * @param enabled + * the section's enabled state + * @param data + * the section's data + * @param errors + * the section's errors + */ + function InitSectionAction(submissionId, sectionId, header, config, mandatory, sectionType, visibility, enabled, data, errors) { + this.type = SubmissionObjectActionTypes.INIT_SECTION; + this.payload = { submissionId: submissionId, sectionId: sectionId, header: header, config: config, mandatory: mandatory, sectionType: sectionType, visibility: visibility, enabled: enabled, data: data, errors: errors }; + } + return InitSectionAction; +}()); +export { InitSectionAction }; +var EnableSectionAction = /** @class */ (function () { + /** + * Create a new EnableSectionAction + * + * @param submissionId + * the submission's ID to remove + * @param sectionId + * the section's ID to add + */ + function EnableSectionAction(submissionId, sectionId) { + this.type = SubmissionObjectActionTypes.ENABLE_SECTION; + this.payload = { submissionId: submissionId, sectionId: sectionId }; + } + return EnableSectionAction; +}()); +export { EnableSectionAction }; +var DisableSectionAction = /** @class */ (function () { + /** + * Create a new DisableSectionAction + * + * @param submissionId + * the submission's ID to remove + * @param sectionId + * the section's ID to remove + */ + function DisableSectionAction(submissionId, sectionId) { + this.type = SubmissionObjectActionTypes.DISABLE_SECTION; + this.payload = { submissionId: submissionId, sectionId: sectionId }; + } + return DisableSectionAction; +}()); +export { DisableSectionAction }; +var UpdateSectionDataAction = /** @class */ (function () { + /** + * Create a new EnableSectionAction + * + * @param submissionId + * the submission's ID to remove + * @param sectionId + * the section's ID to add + * @param data + * the section's data + * @param errors + * the section's errors + */ + function UpdateSectionDataAction(submissionId, sectionId, data, errors) { + this.type = SubmissionObjectActionTypes.UPLOAD_SECTION_DATA; + this.payload = { submissionId: submissionId, sectionId: sectionId, data: data, errors: errors }; + } + return UpdateSectionDataAction; +}()); +export { UpdateSectionDataAction }; +var RemoveSectionErrorsAction = /** @class */ (function () { + /** + * Create a new RemoveSectionErrorsAction + * + * @param submissionId + * the submission's ID to remove + * @param sectionId + * the section's ID to add + */ + function RemoveSectionErrorsAction(submissionId, sectionId) { + this.type = SubmissionObjectActionTypes.REMOVE_SECTION_ERRORS; + this.payload = { submissionId: submissionId, sectionId: sectionId }; + } + return RemoveSectionErrorsAction; +}()); +export { RemoveSectionErrorsAction }; +// Submission actions +var CompleteInitSubmissionFormAction = /** @class */ (function () { + /** + * Create a new CompleteInitSubmissionFormAction + * + * @param submissionId + * the submission's ID + */ + function CompleteInitSubmissionFormAction(submissionId) { + this.type = SubmissionObjectActionTypes.COMPLETE_INIT_SUBMISSION_FORM; + this.payload = { submissionId: submissionId }; + } + return CompleteInitSubmissionFormAction; +}()); +export { CompleteInitSubmissionFormAction }; +var InitSubmissionFormAction = /** @class */ (function () { + /** + * Create a new InitSubmissionFormAction + * + * @param collectionId + * the collection's Id where to deposit + * @param submissionId + * the submission's ID + * @param selfUrl + * the submission object url + * @param submissionDefinition + * the submission's sections definition + * @param sections + * the submission's sections + * @param errors + * the submission's sections errors + */ + function InitSubmissionFormAction(collectionId, submissionId, selfUrl, submissionDefinition, sections, errors) { + this.type = SubmissionObjectActionTypes.INIT_SUBMISSION_FORM; + this.payload = { collectionId: collectionId, submissionId: submissionId, selfUrl: selfUrl, submissionDefinition: submissionDefinition, sections: sections, errors: errors }; + } + return InitSubmissionFormAction; +}()); +export { InitSubmissionFormAction }; +var SaveForLaterSubmissionFormAction = /** @class */ (function () { + /** + * Create a new SaveForLaterSubmissionFormAction + * + * @param submissionId + * the submission's ID + */ + function SaveForLaterSubmissionFormAction(submissionId) { + this.type = SubmissionObjectActionTypes.SAVE_FOR_LATER_SUBMISSION_FORM; + this.payload = { submissionId: submissionId }; + } + return SaveForLaterSubmissionFormAction; +}()); +export { SaveForLaterSubmissionFormAction }; +var SaveForLaterSubmissionFormSuccessAction = /** @class */ (function () { + /** + * Create a new SaveForLaterSubmissionFormSuccessAction + * + * @param submissionId + * the submission's ID + * @param submissionObject + * the submission's Object + */ + function SaveForLaterSubmissionFormSuccessAction(submissionId, submissionObject) { + this.type = SubmissionObjectActionTypes.SAVE_FOR_LATER_SUBMISSION_FORM_SUCCESS; + this.payload = { submissionId: submissionId, submissionObject: submissionObject }; + } + return SaveForLaterSubmissionFormSuccessAction; +}()); +export { SaveForLaterSubmissionFormSuccessAction }; +var SaveForLaterSubmissionFormErrorAction = /** @class */ (function () { + /** + * Create a new SaveForLaterSubmissionFormErrorAction + * + * @param submissionId + * the submission's ID + */ + function SaveForLaterSubmissionFormErrorAction(submissionId) { + this.type = SubmissionObjectActionTypes.SAVE_FOR_LATER_SUBMISSION_FORM_ERROR; + this.payload = { submissionId: submissionId }; + } + return SaveForLaterSubmissionFormErrorAction; +}()); +export { SaveForLaterSubmissionFormErrorAction }; +var SaveSubmissionFormAction = /** @class */ (function () { + /** + * Create a new SaveSubmissionFormAction + * + * @param submissionId + * the submission's ID + */ + function SaveSubmissionFormAction(submissionId) { + this.type = SubmissionObjectActionTypes.SAVE_SUBMISSION_FORM; + this.payload = { submissionId: submissionId }; + } + return SaveSubmissionFormAction; +}()); +export { SaveSubmissionFormAction }; +var SaveSubmissionFormSuccessAction = /** @class */ (function () { + /** + * Create a new SaveSubmissionFormSuccessAction + * + * @param submissionId + * the submission's ID + * @param submissionObject + * the submission's Object + */ + function SaveSubmissionFormSuccessAction(submissionId, submissionObject) { + this.type = SubmissionObjectActionTypes.SAVE_SUBMISSION_FORM_SUCCESS; + this.payload = { submissionId: submissionId, submissionObject: submissionObject }; + } + return SaveSubmissionFormSuccessAction; +}()); +export { SaveSubmissionFormSuccessAction }; +var SaveSubmissionFormErrorAction = /** @class */ (function () { + /** + * Create a new SaveSubmissionFormErrorAction + * + * @param submissionId + * the submission's ID + */ + function SaveSubmissionFormErrorAction(submissionId) { + this.type = SubmissionObjectActionTypes.SAVE_SUBMISSION_FORM_ERROR; + this.payload = { submissionId: submissionId }; + } + return SaveSubmissionFormErrorAction; +}()); +export { SaveSubmissionFormErrorAction }; +var SaveSubmissionSectionFormAction = /** @class */ (function () { + /** + * Create a new SaveSubmissionSectionFormAction + * + * @param submissionId + * the submission's ID + * @param sectionId + * the section's ID + */ + function SaveSubmissionSectionFormAction(submissionId, sectionId) { + this.type = SubmissionObjectActionTypes.SAVE_SUBMISSION_SECTION_FORM; + this.payload = { submissionId: submissionId, sectionId: sectionId }; + } + return SaveSubmissionSectionFormAction; +}()); +export { SaveSubmissionSectionFormAction }; +var SaveSubmissionSectionFormSuccessAction = /** @class */ (function () { + /** + * Create a new SaveSubmissionSectionFormSuccessAction + * + * @param submissionId + * the submission's ID + * @param submissionObject + * the submission's Object + */ + function SaveSubmissionSectionFormSuccessAction(submissionId, submissionObject) { + this.type = SubmissionObjectActionTypes.SAVE_SUBMISSION_SECTION_FORM_SUCCESS; + this.payload = { submissionId: submissionId, submissionObject: submissionObject }; + } + return SaveSubmissionSectionFormSuccessAction; +}()); +export { SaveSubmissionSectionFormSuccessAction }; +var SaveSubmissionSectionFormErrorAction = /** @class */ (function () { + /** + * Create a new SaveSubmissionFormErrorAction + * + * @param submissionId + * the submission's ID + */ + function SaveSubmissionSectionFormErrorAction(submissionId) { + this.type = SubmissionObjectActionTypes.SAVE_SUBMISSION_SECTION_FORM_ERROR; + this.payload = { submissionId: submissionId }; + } + return SaveSubmissionSectionFormErrorAction; +}()); +export { SaveSubmissionSectionFormErrorAction }; +var ResetSubmissionFormAction = /** @class */ (function () { + /** + * Create a new ResetSubmissionFormAction + * + * @param collectionId + * the collection's Id where to deposit + * @param submissionId + * the submission's ID + * @param selfUrl + * the submission object url + * @param sections + * the submission's sections + * @param submissionDefinition + * the submission's form definition + */ + function ResetSubmissionFormAction(collectionId, submissionId, selfUrl, sections, submissionDefinition) { + this.type = SubmissionObjectActionTypes.RESET_SUBMISSION_FORM; + this.payload = { collectionId: collectionId, submissionId: submissionId, selfUrl: selfUrl, sections: sections, submissionDefinition: submissionDefinition }; + } + return ResetSubmissionFormAction; +}()); +export { ResetSubmissionFormAction }; +var CancelSubmissionFormAction = /** @class */ (function () { + function CancelSubmissionFormAction() { + this.type = SubmissionObjectActionTypes.CANCEL_SUBMISSION_FORM; + } + return CancelSubmissionFormAction; +}()); +export { CancelSubmissionFormAction }; +var ChangeSubmissionCollectionAction = /** @class */ (function () { + /** + * Create a new ChangeSubmissionCollectionAction + * + * @param submissionId + * the submission's ID + * @param collectionId + * the new collection's ID + */ + function ChangeSubmissionCollectionAction(submissionId, collectionId) { + this.type = SubmissionObjectActionTypes.CHANGE_SUBMISSION_COLLECTION; + this.payload = { submissionId: submissionId, collectionId: collectionId }; + } + return ChangeSubmissionCollectionAction; +}()); +export { ChangeSubmissionCollectionAction }; +var SaveAndDepositSubmissionAction = /** @class */ (function () { + /** + * Create a new SaveAndDepositSubmissionAction + * + * @param submissionId + * the submission's ID to deposit + */ + function SaveAndDepositSubmissionAction(submissionId) { + this.type = SubmissionObjectActionTypes.SAVE_AND_DEPOSIT_SUBMISSION; + this.payload = { submissionId: submissionId }; + } + return SaveAndDepositSubmissionAction; +}()); +export { SaveAndDepositSubmissionAction }; +var DepositSubmissionAction = /** @class */ (function () { + /** + * Create a new DepositSubmissionAction + * + * @param submissionId + * the submission's ID to deposit + */ + function DepositSubmissionAction(submissionId) { + this.type = SubmissionObjectActionTypes.DEPOSIT_SUBMISSION; + this.payload = { submissionId: submissionId }; + } + return DepositSubmissionAction; +}()); +export { DepositSubmissionAction }; +var DepositSubmissionSuccessAction = /** @class */ (function () { + /** + * Create a new DepositSubmissionSuccessAction + * + * @param submissionId + * the submission's ID to deposit + */ + function DepositSubmissionSuccessAction(submissionId) { + this.type = SubmissionObjectActionTypes.DEPOSIT_SUBMISSION_SUCCESS; + this.payload = { submissionId: submissionId }; + } + return DepositSubmissionSuccessAction; +}()); +export { DepositSubmissionSuccessAction }; +var DepositSubmissionErrorAction = /** @class */ (function () { + /** + * Create a new DepositSubmissionErrorAction + * + * @param submissionId + * the submission's ID to deposit + */ + function DepositSubmissionErrorAction(submissionId) { + this.type = SubmissionObjectActionTypes.DEPOSIT_SUBMISSION_ERROR; + this.payload = { submissionId: submissionId }; + } + return DepositSubmissionErrorAction; +}()); +export { DepositSubmissionErrorAction }; +var DiscardSubmissionAction = /** @class */ (function () { + /** + * Create a new DiscardSubmissionAction + * + * @param submissionId + * the submission's ID to discard + */ + function DiscardSubmissionAction(submissionId) { + this.type = SubmissionObjectActionTypes.DISCARD_SUBMISSION; + this.payload = { submissionId: submissionId }; + } + return DiscardSubmissionAction; +}()); +export { DiscardSubmissionAction }; +var DiscardSubmissionSuccessAction = /** @class */ (function () { + /** + * Create a new DiscardSubmissionSuccessAction + * + * @param submissionId + * the submission's ID to discard + */ + function DiscardSubmissionSuccessAction(submissionId) { + this.type = SubmissionObjectActionTypes.DISCARD_SUBMISSION_SUCCESS; + this.payload = { submissionId: submissionId }; + } + return DiscardSubmissionSuccessAction; +}()); +export { DiscardSubmissionSuccessAction }; +var DiscardSubmissionErrorAction = /** @class */ (function () { + /** + * Create a new DiscardSubmissionErrorAction + * + * @param submissionId + * the submission's ID to discard + */ + function DiscardSubmissionErrorAction(submissionId) { + this.type = SubmissionObjectActionTypes.DISCARD_SUBMISSION_ERROR; + this.payload = { submissionId: submissionId }; + } + return DiscardSubmissionErrorAction; +}()); +export { DiscardSubmissionErrorAction }; +var SectionStatusChangeAction = /** @class */ (function () { + /** + * Change the section validity status + * + * @param submissionId + * the submission's ID + * @param sectionId + * the section's ID to change + * @param status + * the section validity status (true if is valid) + */ + function SectionStatusChangeAction(submissionId, sectionId, status) { + this.type = SubmissionObjectActionTypes.SECTION_STATUS_CHANGE; + this.payload = { submissionId: submissionId, sectionId: sectionId, status: status }; + } + return SectionStatusChangeAction; +}()); +export { SectionStatusChangeAction }; +var SetActiveSectionAction = /** @class */ (function () { + /** + * Create a new SetActiveSectionAction + * + * @param submissionId + * the submission's ID + * @param sectionId + * the section's ID to active + */ + function SetActiveSectionAction(submissionId, sectionId) { + this.type = SubmissionObjectActionTypes.SET_ACTIVE_SECTION; + this.payload = { submissionId: submissionId, sectionId: sectionId }; + } + return SetActiveSectionAction; +}()); +export { SetActiveSectionAction }; +// Upload file actions +var NewUploadedFileAction = /** @class */ (function () { + /** + * Add a new uploaded file + * + * @param submissionId + * the submission's ID + * @param sectionId + * the section's ID + * @param fileId + * the file's ID + * @param data + * the metadata of the new bitstream + */ + function NewUploadedFileAction(submissionId, sectionId, fileId, data) { + this.type = SubmissionObjectActionTypes.NEW_FILE; + this.payload = { submissionId: submissionId, sectionId: sectionId, fileId: fileId, data: data }; + } + return NewUploadedFileAction; +}()); +export { NewUploadedFileAction }; +var EditFileDataAction = /** @class */ (function () { + /** + * Edit a file data + * + * @param submissionId + * the submission's ID + * @param sectionId + * the section's ID + * @param fileId + * the file's ID + * @param data + * the metadata of the new bitstream + */ + function EditFileDataAction(submissionId, sectionId, fileId, data) { + this.type = SubmissionObjectActionTypes.EDIT_FILE_DATA; + this.payload = { submissionId: submissionId, sectionId: sectionId, fileId: fileId, data: data }; + } + return EditFileDataAction; +}()); +export { EditFileDataAction }; +var DeleteUploadedFileAction = /** @class */ (function () { + /** + * Delete a uploaded file + * + * @param submissionId + * the submission's ID + * @param sectionId + * the section's ID + * @param fileId + * the file's ID + */ + function DeleteUploadedFileAction(submissionId, sectionId, fileId) { + this.type = SubmissionObjectActionTypes.DELETE_FILE; + this.payload = { submissionId: submissionId, sectionId: sectionId, fileId: fileId }; + } + return DeleteUploadedFileAction; +}()); +export { DeleteUploadedFileAction }; +//# sourceMappingURL=submission-objects.actions.js.map \ No newline at end of file diff --git a/src/app/submission/objects/submission-objects.actions.js.map b/src/app/submission/objects/submission-objects.actions.js.map new file mode 100644 index 0000000000..d4c512a1c4 --- /dev/null +++ b/src/app/submission/objects/submission-objects.actions.js.map @@ -0,0 +1 @@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CAAC;IACH,+BAAC;AAAD,CAAC,AArBD,IAqBC"} \ No newline at end of file diff --git a/src/app/submission/objects/submission-objects.effects.js b/src/app/submission/objects/submission-objects.effects.js new file mode 100644 index 0000000000..f9cbab38f8 --- /dev/null +++ b/src/app/submission/objects/submission-objects.effects.js @@ -0,0 +1,273 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { Actions, Effect, ofType } from '@ngrx/effects'; +import { from as observableFrom, of as observableOf } from 'rxjs'; +import { catchError, map, mergeMap, switchMap, tap, withLatestFrom } from 'rxjs/operators'; +import { Store } from '@ngrx/store'; +import { union } from 'lodash'; +import { CompleteInitSubmissionFormAction, DepositSubmissionAction, DepositSubmissionErrorAction, DepositSubmissionSuccessAction, DiscardSubmissionErrorAction, DiscardSubmissionSuccessAction, InitSectionAction, InitSubmissionFormAction, SaveForLaterSubmissionFormSuccessAction, SaveSubmissionFormErrorAction, SaveSubmissionFormSuccessAction, SaveSubmissionSectionFormErrorAction, SaveSubmissionSectionFormSuccessAction, SubmissionObjectActionTypes, UpdateSectionDataAction } from './submission-objects.actions'; +import { SectionsService } from '../sections/sections.service'; +import { isEmpty, isNotEmpty, isNotUndefined } from '../../shared/empty.util'; +import { SubmissionService } from '../submission.service'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { TranslateService } from '@ngx-translate/core'; +import parseSectionErrors from '../utils/parseSectionErrors'; +import { SectionsType } from '../sections/sections-type'; +import { SubmissionJsonPatchOperationsService } from '../../core/submission/submission-json-patch-operations.service'; +var SubmissionObjectEffects = /** @class */ (function () { + function SubmissionObjectEffects(actions$, notificationsService, operationsService, sectionService, store$, submissionService, translate) { + var _this = this; + this.actions$ = actions$; + this.notificationsService = notificationsService; + this.operationsService = operationsService; + this.sectionService = sectionService; + this.store$ = store$; + this.submissionService = submissionService; + this.translate = translate; + /** + * Dispatch a [InitSectionAction] for every submission sections and dispatch a [CompleteInitSubmissionFormAction] + */ + this.loadForm$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.INIT_SUBMISSION_FORM), map(function (action) { + var definition = action.payload.submissionDefinition; + var mappedActions = []; + definition.sections.page.forEach(function (sectionDefinition) { + var sectionId = sectionDefinition._links.self.substr(sectionDefinition._links.self.lastIndexOf('/') + 1); + var config = sectionDefinition._links.config || ''; + var enabled = (sectionDefinition.mandatory) || (isNotEmpty(action.payload.sections) && action.payload.sections.hasOwnProperty(sectionId)); + var sectionData = (isNotUndefined(action.payload.sections) && isNotUndefined(action.payload.sections[sectionId])) ? action.payload.sections[sectionId] : Object.create(null); + var sectionErrors = null; + mappedActions.push(new InitSectionAction(action.payload.submissionId, sectionId, sectionDefinition.header, config, sectionDefinition.mandatory, sectionDefinition.sectionType, sectionDefinition.visibility, enabled, sectionData, sectionErrors)); + }); + return { action: action, definition: definition, mappedActions: mappedActions }; + }), mergeMap(function (result) { + return observableFrom(result.mappedActions.concat(new CompleteInitSubmissionFormAction(result.action.payload.submissionId))); + })); + /** + * Dispatch a [InitSubmissionFormAction] + */ + this.resetForm$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.RESET_SUBMISSION_FORM), map(function (action) { + return new InitSubmissionFormAction(action.payload.collectionId, action.payload.submissionId, action.payload.selfUrl, action.payload.submissionDefinition, action.payload.sections, null); + })); + /** + * Dispatch a [SaveSubmissionFormSuccessAction] or a [SaveSubmissionFormErrorAction] on error + */ + this.saveSubmission$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.SAVE_SUBMISSION_FORM), switchMap(function (action) { + return _this.operationsService.jsonPatchByResourceType(_this.submissionService.getSubmissionObjectLinkName(), action.payload.submissionId, 'sections').pipe(map(function (response) { return new SaveSubmissionFormSuccessAction(action.payload.submissionId, response); }), catchError(function () { return observableOf(new SaveSubmissionFormErrorAction(action.payload.submissionId)); })); + })); + /** + * Dispatch a [SaveForLaterSubmissionFormSuccessAction] or a [SaveSubmissionFormErrorAction] on error + */ + this.saveForLaterSubmission$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.SAVE_FOR_LATER_SUBMISSION_FORM), switchMap(function (action) { + return _this.operationsService.jsonPatchByResourceType(_this.submissionService.getSubmissionObjectLinkName(), action.payload.submissionId, 'sections').pipe(map(function (response) { return new SaveForLaterSubmissionFormSuccessAction(action.payload.submissionId, response); }), catchError(function () { return observableOf(new SaveSubmissionFormErrorAction(action.payload.submissionId)); })); + })); + /** + * Call parseSaveResponse and dispatch actions + */ + this.saveSubmissionSuccess$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.SAVE_SUBMISSION_FORM_SUCCESS, SubmissionObjectActionTypes.SAVE_SUBMISSION_SECTION_FORM_SUCCESS), withLatestFrom(this.store$), map(function (_a) { + var action = _a[0], currentState = _a[1]; + return _this.parseSaveResponse(currentState.submission.objects[action.payload.submissionId], action.payload.submissionObject, action.payload.submissionId); + }), mergeMap(function (actions) { return observableFrom(actions); })); + /** + * Dispatch a [SaveSubmissionSectionFormSuccessAction] or a [SaveSubmissionSectionFormErrorAction] on error + */ + this.saveSection$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.SAVE_SUBMISSION_SECTION_FORM), switchMap(function (action) { + return _this.operationsService.jsonPatchByResourceID(_this.submissionService.getSubmissionObjectLinkName(), action.payload.submissionId, 'sections', action.payload.sectionId).pipe(map(function (response) { return new SaveSubmissionSectionFormSuccessAction(action.payload.submissionId, response); }), catchError(function () { return observableOf(new SaveSubmissionSectionFormErrorAction(action.payload.submissionId)); })); + })); + /** + * Show a notification on error + */ + this.saveError$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.SAVE_SUBMISSION_FORM_ERROR, SubmissionObjectActionTypes.SAVE_SUBMISSION_SECTION_FORM_ERROR), withLatestFrom(this.store$), tap(function () { return _this.notificationsService.error(null, _this.translate.get('submission.sections.general.save_error_notice')); })); + /** + * Call parseSaveResponse and dispatch actions or dispatch [SaveSubmissionFormErrorAction] on error + */ + this.saveAndDeposit$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.SAVE_AND_DEPOSIT_SUBMISSION), withLatestFrom(this.store$), switchMap(function (_a) { + var action = _a[0], currentState = _a[1]; + return _this.operationsService.jsonPatchByResourceType(_this.submissionService.getSubmissionObjectLinkName(), action.payload.submissionId, 'sections').pipe(map(function (response) { + if (_this.canDeposit(response)) { + return new DepositSubmissionAction(action.payload.submissionId); + } + else { + _this.notificationsService.warning(null, _this.translate.get('submission.sections.general.sections_not_valid')); + return _this.parseSaveResponse(currentState.submission.objects[action.payload.submissionId], response, action.payload.submissionId); + } + }), catchError(function () { return observableOf(new SaveSubmissionFormErrorAction(action.payload.submissionId)); })); + })); + /** + * Dispatch a [DepositSubmissionSuccessAction] or a [DepositSubmissionErrorAction] on error + */ + this.depositSubmission$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.DEPOSIT_SUBMISSION), withLatestFrom(this.store$), switchMap(function (_a) { + var action = _a[0], state = _a[1]; + return _this.submissionService.depositSubmission(state.submission.objects[action.payload.submissionId].selfUrl).pipe(map(function () { return new DepositSubmissionSuccessAction(action.payload.submissionId); }), catchError(function () { return observableOf(new DepositSubmissionErrorAction(action.payload.submissionId)); })); + })); + /** + * Show a notification on success and redirect to MyDSpace page + */ + this.saveForLaterSubmissionSuccess$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.SAVE_FOR_LATER_SUBMISSION_FORM_SUCCESS), tap(function () { return _this.notificationsService.success(null, _this.translate.get('submission.sections.general.save_success_notice')); }), tap(function () { return _this.submissionService.redirectToMyDSpace(); })); + /** + * Show a notification on success and redirect to MyDSpace page + */ + this.depositSubmissionSuccess$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.DEPOSIT_SUBMISSION_SUCCESS), tap(function () { return _this.notificationsService.success(null, _this.translate.get('submission.sections.general.deposit_success_notice')); }), tap(function () { return _this.submissionService.redirectToMyDSpace(); })); + /** + * Show a notification on error + */ + this.depositSubmissionError$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.DEPOSIT_SUBMISSION_ERROR), tap(function () { return _this.notificationsService.error(null, _this.translate.get('submission.sections.general.deposit_error_notice')); })); + /** + * Dispatch a [DiscardSubmissionSuccessAction] or a [DiscardSubmissionErrorAction] on error + */ + this.discardSubmission$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.DISCARD_SUBMISSION), switchMap(function (action) { + return _this.submissionService.discardSubmission(action.payload.submissionId).pipe(map(function () { return new DiscardSubmissionSuccessAction(action.payload.submissionId); }), catchError(function () { return observableOf(new DiscardSubmissionErrorAction(action.payload.submissionId)); })); + })); + /** + * Show a notification on success and redirect to MyDSpace page + */ + this.discardSubmissionSuccess$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.DISCARD_SUBMISSION_SUCCESS), tap(function () { return _this.notificationsService.success(null, _this.translate.get('submission.sections.general.discard_success_notice')); }), tap(function () { return _this.submissionService.redirectToMyDSpace(); })); + /** + * Show a notification on error + */ + this.discardSubmissionError$ = this.actions$.pipe(ofType(SubmissionObjectActionTypes.DISCARD_SUBMISSION_ERROR), tap(function () { return _this.notificationsService.error(null, _this.translate.get('submission.sections.general.discard_error_notice')); })); + } + /** + * Check if the submission object retrieved from REST haven't section errors + * + * @param response + * The submission object retrieved from REST + */ + SubmissionObjectEffects.prototype.canDeposit = function (response) { + var canDeposit = true; + if (isNotEmpty(response)) { + response.forEach(function (item) { + var errors = item.errors; + if (errors && !isEmpty(errors)) { + canDeposit = false; + } + }); + } + return canDeposit; + }; + /** + * Parse the submission object retrieved from REST and return actions to dispatch + * + * @param currentState + * The current SubmissionObjectEntry + * @param response + * The submission object retrieved from REST + * @param submissionId + * The submission id + * @param notify + * A boolean that indicate if show notification or not + * @return SubmissionObjectAction[] + * List of SubmissionObjectAction to dispatch + */ + SubmissionObjectEffects.prototype.parseSaveResponse = function (currentState, response, submissionId, notify) { + var _this = this; + if (notify === void 0) { notify = true; } + var mappedActions = []; + if (isNotEmpty(response)) { + if (notify) { + this.notificationsService.success(null, this.translate.get('submission.sections.general.save_success_notice')); + } + response.forEach(function (item) { + var errorsList = Object.create({}); + var errors = item.errors; + if (errors && !isEmpty(errors)) { + // to avoid dispatching an action for every error, create an array of errors per section + errorsList = parseSectionErrors(errors); + if (notify) { + _this.notificationsService.warning(null, _this.translate.get('submission.sections.general.sections_not_valid')); + } + } + var sections = (item.sections && isNotEmpty(item.sections)) ? item.sections : {}; + var sectionsKeys = union(Object.keys(sections), Object.keys(errorsList)); + for (var _i = 0, sectionsKeys_1 = sectionsKeys; _i < sectionsKeys_1.length; _i++) { + var sectionId = sectionsKeys_1[_i]; + var sectionErrors = errorsList[sectionId] || []; + var sectionData = sections[sectionId] || {}; + // When Upload section is disabled, add to submission only if there are files + if (currentState.sections[sectionId].sectionType === SectionsType.Upload + && isEmpty(sectionData.files) + && !currentState.sections[sectionId].enabled) { + continue; + } + if (notify && !currentState.sections[sectionId].enabled) { + _this.submissionService.notifyNewSection(submissionId, sectionId, currentState.sections[sectionId].sectionType); + } + mappedActions.push(new UpdateSectionDataAction(submissionId, sectionId, sectionData, sectionErrors)); + } + }); + } + return mappedActions; + }; + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "loadForm$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "resetForm$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "saveSubmission$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "saveForLaterSubmission$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "saveSubmissionSuccess$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "saveSection$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "saveError$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "saveAndDeposit$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "depositSubmission$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "saveForLaterSubmissionSuccess$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "depositSubmissionSuccess$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "depositSubmissionError$", void 0); + tslib_1.__decorate([ + Effect(), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "discardSubmission$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "discardSubmissionSuccess$", void 0); + tslib_1.__decorate([ + Effect({ dispatch: false }), + tslib_1.__metadata("design:type", Object) + ], SubmissionObjectEffects.prototype, "discardSubmissionError$", void 0); + SubmissionObjectEffects = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Actions, + NotificationsService, + SubmissionJsonPatchOperationsService, + SectionsService, + Store, + SubmissionService, + TranslateService]) + ], SubmissionObjectEffects); + return SubmissionObjectEffects; +}()); +export { SubmissionObjectEffects }; +//# sourceMappingURL=submission-objects.effects.js.map \ No newline at end of file diff --git a/src/app/submission/objects/submission-objects.effects.js.map b/src/app/submission/objects/submission-objects.effects.js.map new file mode 100644 index 0000000000..5b7289d37b --- /dev/null +++ b/src/app/submission/objects/submission-objects.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-objects.effects.js","sourceRoot":"","sources":["submission-objects.effects.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,M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ission/objects/submission-objects.reducer.js new file mode 100644 index 0000000000..efb0d114d0 --- /dev/null +++ b/src/app/submission/objects/submission-objects.reducer.js @@ -0,0 +1,617 @@ +import { hasValue, isNotEmpty, isNotNull, isUndefined } from '../../shared/empty.util'; +import { differenceWith, findKey, isEqual, uniqWith } from 'lodash'; +import { SubmissionObjectActionTypes } from './submission-objects.actions'; +var initialState = Object.create({}); +export function submissionObjectReducer(state, action) { + if (state === void 0) { state = initialState; } + switch (action.type) { + // submission form actions + case SubmissionObjectActionTypes.COMPLETE_INIT_SUBMISSION_FORM: { + return completeInit(state, action); + } + case SubmissionObjectActionTypes.INIT_SUBMISSION_FORM: { + return initSubmission(state, action); + } + case SubmissionObjectActionTypes.RESET_SUBMISSION_FORM: { + return resetSubmission(state, action); + } + case SubmissionObjectActionTypes.CANCEL_SUBMISSION_FORM: { + return initialState; + } + case SubmissionObjectActionTypes.SAVE_SUBMISSION_FORM: + case SubmissionObjectActionTypes.SAVE_FOR_LATER_SUBMISSION_FORM: + case SubmissionObjectActionTypes.SAVE_AND_DEPOSIT_SUBMISSION: + case SubmissionObjectActionTypes.SAVE_SUBMISSION_SECTION_FORM: { + return saveSubmission(state, action); + } + case SubmissionObjectActionTypes.SAVE_SUBMISSION_FORM_SUCCESS: + case SubmissionObjectActionTypes.SAVE_SUBMISSION_SECTION_FORM_SUCCESS: + case SubmissionObjectActionTypes.SAVE_SUBMISSION_FORM_ERROR: + case SubmissionObjectActionTypes.SAVE_FOR_LATER_SUBMISSION_FORM_ERROR: + case SubmissionObjectActionTypes.SAVE_SUBMISSION_SECTION_FORM_ERROR: { + return completeSave(state, action); + } + case SubmissionObjectActionTypes.CHANGE_SUBMISSION_COLLECTION: { + return changeCollection(state, action); + } + case SubmissionObjectActionTypes.DEPOSIT_SUBMISSION: { + return startDeposit(state, action); + } + case SubmissionObjectActionTypes.DEPOSIT_SUBMISSION_SUCCESS: { + return initialState; + } + case SubmissionObjectActionTypes.DEPOSIT_SUBMISSION_ERROR: { + return endDeposit(state, action); + } + case SubmissionObjectActionTypes.DISCARD_SUBMISSION: { + return state; + } + case SubmissionObjectActionTypes.DISCARD_SUBMISSION_SUCCESS: { + return initialState; + } + case SubmissionObjectActionTypes.DISCARD_SUBMISSION_ERROR: { + return state; + } + case SubmissionObjectActionTypes.SET_ACTIVE_SECTION: { + return setActiveSection(state, action); + } + // Section actions + case SubmissionObjectActionTypes.INIT_SECTION: { + return initSection(state, action); + } + case SubmissionObjectActionTypes.ENABLE_SECTION: { + return changeSectionState(state, action, true); + } + case SubmissionObjectActionTypes.UPLOAD_SECTION_DATA: { + return updateSectionData(state, action); + } + case SubmissionObjectActionTypes.DISABLE_SECTION: { + return changeSectionState(state, action, false); + } + case SubmissionObjectActionTypes.SECTION_STATUS_CHANGE: { + return setIsValid(state, action); + } + // Files actions + case SubmissionObjectActionTypes.NEW_FILE: { + return newFile(state, action); + } + case SubmissionObjectActionTypes.EDIT_FILE_DATA: { + return editFileData(state, action); + } + case SubmissionObjectActionTypes.DELETE_FILE: { + return deleteFile(state, action); + } + // errors actions + case SubmissionObjectActionTypes.ADD_SECTION_ERROR: { + return addError(state, action); + } + case SubmissionObjectActionTypes.DELETE_SECTION_ERROR: { + return removeError(state, action); + } + case SubmissionObjectActionTypes.REMOVE_SECTION_ERRORS: { + return removeSectionErrors(state, action); + } + default: { + return state; + } + } +} +// ------ Submission error functions ------ // +var removeError = function (state, action) { + var _a, _b; + var _c = action.payload, submissionId = _c.submissionId, sectionId = _c.sectionId, errors = _c.errors; + if (hasValue(state[submissionId].sections[sectionId])) { + var filteredErrors = void 0; + if (Array.isArray(errors)) { + filteredErrors = differenceWith(errors, errors, isEqual); + } + else { + filteredErrors = state[submissionId].sections[sectionId].errors + .filter(function (currentError) { return currentError.path !== errors.path || !isEqual(currentError, errors); }); + } + return Object.assign({}, state, (_a = {}, + _a[submissionId] = Object.assign({}, state[submissionId], { + sections: Object.assign({}, state[submissionId].sections, (_b = {}, + _b[sectionId] = Object.assign({}, state[submissionId].sections[sectionId], { + errors: filteredErrors + }), + _b)) + }), + _a)); + } + else { + return state; + } +}; +var addError = function (state, action) { + var _a, _b; + var _c = action.payload, submissionId = _c.submissionId, sectionId = _c.sectionId, error = _c.error; + if (hasValue(state[submissionId].sections[sectionId])) { + var errors = uniqWith(state[submissionId].sections[sectionId].errors.concat(error), isEqual); + return Object.assign({}, state, (_a = {}, + _a[submissionId] = Object.assign({}, state[submissionId], { + activeSection: state[action.payload.submissionId].activeSection, sections: Object.assign({}, state[submissionId].sections, (_b = {}, + _b[sectionId] = Object.assign({}, state[action.payload.submissionId].sections[action.payload.sectionId], { + errors: errors + }), + _b)), + }), + _a)); + } + else { + return state; + } +}; +/** + * Remove all section's errors. + * + * @param state + * the current state + * @param action + * an RemoveSectionErrorsAction + * @return SubmissionObjectState + * the new state, with the section's errors updated. + */ +function removeSectionErrors(state, action) { + var _a, _b; + if (isNotEmpty(state[action.payload.submissionId]) + && isNotEmpty(state[action.payload.submissionId].sections[action.payload.sectionId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + sections: Object.assign({}, state[action.payload.submissionId].sections, (_b = {}, + _b[action.payload.sectionId] = Object.assign({}, state[action.payload.submissionId].sections[action.payload.sectionId], { + errors: [] + }), + _b)) + }), + _a)); + } + else { + return state; + } +} +// ------ Submission functions ------ // +/** + * Init a SubmissionObjectState. + * + * @param state + * the current state + * @param action + * an InitSubmissionFormAction | ResetSubmissionFormAction + * @return SubmissionObjectState + * the new state, with the section removed. + */ +function initSubmission(state, action) { + var newState = Object.assign({}, state); + newState[action.payload.submissionId] = { + collection: action.payload.collectionId, + definition: action.payload.submissionDefinition.name, + selfUrl: action.payload.selfUrl, + activeSection: null, + sections: Object.create(null), + isLoading: true, + savePending: false, + depositPending: false, + }; + return newState; +} +/** + * Reset submission. + * + * @param state + * the current state + * @param action + * an ResetSubmissionFormAction + * @return SubmissionObjectState + * the new state, with the section removed. + */ +function resetSubmission(state, action) { + var _a; + if (hasValue(state[action.payload.submissionId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + sections: Object.create(null), + isLoading: true + }), + _a)); + } + else { + return state; + } +} +/** + * Set submission loading to false. + * + * @param state + * the current state + * @param action + * an CompleteInitSubmissionFormAction + * @return SubmissionObjectState + * the new state, with the section removed. + */ +function completeInit(state, action) { + var _a; + if (hasValue(state[action.payload.submissionId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + isLoading: false + }), + _a)); + } + else { + return state; + } +} +/** + * Set submission save flag to true + * + * @param state + * the current state + * @param action + * an SaveSubmissionFormAction | SaveSubmissionSectionFormAction + * | SaveForLaterSubmissionFormAction | SaveAndDepositSubmissionAction + * @return SubmissionObjectState + * the new state, with the flag set to true. + */ +function saveSubmission(state, action) { + var _a; + if (hasValue(state[action.payload.submissionId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + activeSection: state[action.payload.submissionId].activeSection, + sections: state[action.payload.submissionId].sections, + isLoading: state[action.payload.submissionId].isLoading, + savePending: true, + }), + _a)); + } + else { + return state; + } +} +/** + * Set submission save flag to false. + * + * @param state + * the current state + * @param action + * an SaveSubmissionFormSuccessAction | SaveForLaterSubmissionFormSuccessAction + * | SaveSubmissionSectionFormSuccessAction | SaveSubmissionFormErrorAction + * | SaveForLaterSubmissionFormErrorAction | SaveSubmissionSectionFormErrorAction + * @return SubmissionObjectState + * the new state, with the flag set to false. + */ +function completeSave(state, action) { + var _a; + if (hasValue(state[action.payload.submissionId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + savePending: false, + }), + _a)); + } + else { + return state; + } +} +/** + * Set deposit flag to true + * + * @param state + * the current state + * @param action + * an DepositSubmissionAction + * @return SubmissionObjectState + * the new state, with the deposit flag changed. + */ +function startDeposit(state, action) { + var _a; + if (hasValue(state[action.payload.submissionId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + savePending: false, + depositPending: true, + }), + _a)); + } + else { + return state; + } +} +/** + * Set deposit flag to false + * + * @param state + * the current state + * @param action + * an DepositSubmissionSuccessAction or DepositSubmissionErrorAction + * @return SubmissionObjectState + * the new state, with the deposit flag changed. + */ +function endDeposit(state, action) { + var _a; + if (hasValue(state[action.payload.submissionId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + depositPending: false, + }), + _a)); + } + else { + return state; + } +} +/** + * Init a SubmissionObjectState. + * + * @param state + * the current state + * @param action + * an InitSubmissionFormAction + * @return SubmissionObjectState + * the new state, with the section removed. + */ +function changeCollection(state, action) { + var _a; + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + collection: action.payload.collectionId + }), + _a)); +} +// ------ Section functions ------ // +/** + * Set submission active section. + * + * @param state + * the current state + * @param action + * an SetActiveSectionAction + * @return SubmissionObjectState + * the new state, with the active section. + */ +function setActiveSection(state, action) { + var _a; + if (hasValue(state[action.payload.submissionId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + activeSection: action.payload.sectionId, + sections: state[action.payload.submissionId].sections, + isLoading: state[action.payload.submissionId].isLoading, + savePending: state[action.payload.submissionId].savePending, + }), + _a)); + } + else { + return state; + } +} +/** + * Set a section enabled. + * + * @param state + * the current state + * @param action + * an InitSectionAction + * @return SubmissionObjectState + * the new state, with the section removed. + */ +function initSection(state, action) { + var _a, _b; + if (hasValue(state[action.payload.submissionId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + sections: Object.assign({}, state[action.payload.submissionId].sections, (_b = {}, + _b[action.payload.sectionId] = { + header: action.payload.header, + config: action.payload.config, + mandatory: action.payload.mandatory, + sectionType: action.payload.sectionType, + visibility: action.payload.visibility, + collapsed: false, + enabled: action.payload.enabled, + data: action.payload.data, + errors: action.payload.errors || [], + isLoading: false, + isValid: false + }, + _b)) + }), + _a)); + } + else { + return state; + } +} +/** + * Update section's data. + * + * @param state + * the current state + * @param action + * an UpdateSectionDataAction + * @return SubmissionObjectState + * the new state, with the section's data updated. + */ +function updateSectionData(state, action) { + var _a, _b; + if (isNotEmpty(state[action.payload.submissionId]) + && isNotEmpty(state[action.payload.submissionId].sections[action.payload.sectionId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + sections: Object.assign({}, state[action.payload.submissionId].sections, (_b = {}, + _b[action.payload.sectionId] = Object.assign({}, state[action.payload.submissionId].sections[action.payload.sectionId], { + enabled: true, + data: action.payload.data, + errors: action.payload.errors + }), + _b)) + }), + _a)); + } + else { + return state; + } +} +/** + * Set a section state. + * + * @param state + * the current state + * @param action + * an DisableSectionAction + * @param enabled + * enabled or disabled section. + * @return SubmissionObjectState + * the new state, with the section removed. + */ +function changeSectionState(state, action, enabled) { + var _a, _b; + if (hasValue(state[action.payload.submissionId].sections[action.payload.sectionId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + // sections: deleteProperty(state[ action.payload.submissionId ].sections, action.payload.sectionId), + sections: Object.assign({}, state[action.payload.submissionId].sections, (_b = {}, + _b[action.payload.sectionId] = Object.assign({}, state[action.payload.submissionId].sections[action.payload.sectionId], { + enabled: enabled + }), + _b)) + }), + _a)); + } + else { + return state; + } +} +/** + * Set the section validity. + * + * @param state + * the current state + * @param action + * an SectionStatusChangeAction + * @return SubmissionObjectState + * the new state, with the section new validity status. + */ +function setIsValid(state, action) { + var _a, _b; + if (isNotEmpty(state[action.payload.submissionId]) && hasValue(state[action.payload.submissionId].sections[action.payload.sectionId])) { + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + sections: Object.assign({}, state[action.payload.submissionId].sections, Object.assign({}, (_b = {}, + _b[action.payload.sectionId] = Object.assign({}, state[action.payload.submissionId].sections[action.payload.sectionId], { + isValid: action.payload.status + }), + _b))) + }), + _a)); + } + else { + return state; + } +} +// ------ Upload file functions ------ // +/** + * Set a new file. + * + * @param state + * the current state + * @param action + * a NewUploadedFileAction action + * @return SubmissionObjectState + * the new state, with the new file. + */ +function newFile(state, action) { + var _a, _b; + var filesData = state[action.payload.submissionId].sections[action.payload.sectionId].data; + var newData; + if (isUndefined(filesData.files)) { + newData = { + files: [action.payload.data] + }; + } + else { + newData = filesData; + newData.files.push(action.payload.data); + } + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + sections: Object.assign({}, state[action.payload.submissionId].sections, (_b = {}, + _b[action.payload.sectionId] = Object.assign({}, state[action.payload.submissionId].sections[action.payload.sectionId], { + enabled: true, + data: newData + }), + _b)) + }), + _a)); +} +/** + * Edit a file. + * + * @param state + * the current state + * @param action + * a EditFileDataAction action + * @return SubmissionObjectState + * the new state, with the edited file. + */ +function editFileData(state, action) { + var _a, _b; + var filesData = state[action.payload.submissionId].sections[action.payload.sectionId].data; + if (hasValue(filesData.files)) { + var fileIndex = findKey(filesData.files, { uuid: action.payload.fileId }); + if (isNotNull(fileIndex)) { + var newData = Array.from(filesData.files); + newData[fileIndex] = action.payload.data; + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + activeSection: state[action.payload.submissionId].activeSection, + sections: Object.assign({}, state[action.payload.submissionId].sections, Object.assign({}, (_b = {}, + _b[action.payload.sectionId] = Object.assign({}, state[action.payload.submissionId].sections[action.payload.sectionId], { + data: Object.assign({}, state[action.payload.submissionId].sections[action.payload.sectionId].data, { + files: newData + }) + }), + _b))), + isLoading: state[action.payload.submissionId].isLoading, + savePending: state[action.payload.submissionId].savePending, + }), + _a)); + } + } + return state; +} +/** + * Delete a file. + * + * @param state + * the current state + * @param action + * a DeleteUploadedFileAction action + * @return SubmissionObjectState + * the new state, with the file removed. + */ +function deleteFile(state, action) { + var _a, _b; + var filesData = state[action.payload.submissionId].sections[action.payload.sectionId].data; + if (hasValue(filesData.files)) { + var fileIndex = findKey(filesData.files, { uuid: action.payload.fileId }); + if (isNotNull(fileIndex)) { + var newData = Array.from(filesData.files); + newData.splice(fileIndex, 1); + return Object.assign({}, state, (_a = {}, + _a[action.payload.submissionId] = Object.assign({}, state[action.payload.submissionId], { + sections: Object.assign({}, state[action.payload.submissionId].sections, Object.assign({}, (_b = {}, + _b[action.payload.sectionId] = Object.assign({}, state[action.payload.submissionId].sections[action.payload.sectionId], { + data: Object.assign({}, state[action.payload.submissionId].sections[action.payload.sectionId].data, { + files: newData + }) + }), + _b))) + }), + _a)); + } + } + return state; +} +//# sourceMappingURL=submission-objects.reducer.js.map \ No newline at end of file diff --git a/src/app/submission/objects/submission-objects.reducer.js.map b/src/app/submission/objects/submission-objects.reducer.js.map new file mode 100644 index 0000000000..c27d97f32b --- /dev/null +++ b/src/app/submission/objects/submission-objects.reducer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-objects.reducer.js","sourceRoot":"","sources":["submission-objects.reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEpE,OAAO,EA8BL,2BAA2B,EAE5B,MAAM,8BAA8B,CAAC;AAsJtC,IAAM,YAAY,GAA0B,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE9D,MAAM,kCAAkC,KAAoB,EAAE,MAA8B;IAApD,sBAAA,EAAA,oBAAoB;IAC1D,QAAQ,MAAM,CAAC,IAAI,EAAE;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AI,EAAE;gCACtG,KAAK,EAAE,OAAO;6BACf,CAAC;yBACH,CAAC;4BACF,CACH;iBACF,CAAC;oBACF,CAAC;SACJ;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/src/app/submission/sections/container/section-container.component.js b/src/app/submission/sections/container/section-container.component.js new file mode 100644 index 0000000000..3434aaef2c --- /dev/null +++ b/src/app/submission/sections/container/section-container.component.js @@ -0,0 +1,81 @@ +import * as tslib_1 from "tslib"; +import { Component, Injector, Input, ViewChild } from '@angular/core'; +import { SectionsDirective } from '../sections.directive'; +import { rendersSectionType } from '../sections-decorator'; +import { AlertType } from '../../../shared/alert/aletr-type'; +/** + * This component represents a section that contains the submission license form. + */ +var SubmissionSectionContainerComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {Injector} injector + */ + function SubmissionSectionContainerComponent(injector) { + this.injector = injector; + /** + * The AlertType enumeration + * @type {AlertType} + */ + this.AlertTypeEnum = AlertType; + } + /** + * Initialize all instance variables + */ + SubmissionSectionContainerComponent.prototype.ngOnInit = function () { + var _this = this; + this.objectInjector = Injector.create({ + providers: [ + { provide: 'collectionIdProvider', useFactory: function () { return (_this.collectionId); }, deps: [] }, + { provide: 'sectionDataProvider', useFactory: function () { return (_this.sectionData); }, deps: [] }, + { provide: 'submissionIdProvider', useFactory: function () { return (_this.submissionId); }, deps: [] }, + ], + parent: this.injector + }); + }; + /** + * Remove section from submission form + * + * @param event + * the event emitted + */ + SubmissionSectionContainerComponent.prototype.removeSection = function (event) { + event.preventDefault(); + event.stopPropagation(); + this.sectionRef.removeSection(this.submissionId, this.sectionData.id); + }; + /** + * Find the correct component based on the section's type + */ + SubmissionSectionContainerComponent.prototype.getSectionContent = function () { + return rendersSectionType(this.sectionData.sectionType); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionContainerComponent.prototype, "collectionId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SubmissionSectionContainerComponent.prototype, "sectionData", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionContainerComponent.prototype, "submissionId", void 0); + tslib_1.__decorate([ + ViewChild('sectionRef'), + tslib_1.__metadata("design:type", SectionsDirective) + ], SubmissionSectionContainerComponent.prototype, "sectionRef", void 0); + SubmissionSectionContainerComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-section-container', + templateUrl: './section-container.component.html', + styleUrls: ['./section-container.component.scss'] + }), + tslib_1.__metadata("design:paramtypes", [Injector]) + ], SubmissionSectionContainerComponent); + return SubmissionSectionContainerComponent; +}()); +export { SubmissionSectionContainerComponent }; +//# sourceMappingURL=section-container.component.js.map \ No newline at end of file diff --git a/src/app/submission/sections/container/section-container.component.js.map b/src/app/submission/sections/container/section-container.component.js.map new file mode 100644 index 0000000000..798d209204 --- /dev/null +++ b/src/app/submission/sections/container/section-container.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section-container.component.js","sourceRoot":"","sources":["section-container.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAU,SAAS,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D;;GAEG;AAMH;IAqCE;;;;OAIG;IACH,6CAAoB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;QAtBtC;;;WAGG;QACI,kBAAa,GAAG,SAAS,CAAC;IAmBjC,CAAC;IAED;;OAEG;IACH,sDAAQ,GAAR;QAAA,iBASC;QARC,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;YACpC,SAAS,EAAE;gBACT,EAAC,OAAO,EAAE,sBAAsB,EAAE,UAAU,EA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service.js b/src/app/submission/sections/form/section-form-operations.service.js new file mode 100644 index 0000000000..03f5238222 --- /dev/null +++ b/src/app/submission/sections/form/section-form-operations.service.js @@ -0,0 +1,372 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { isEqual, isObject } from 'lodash'; +import { DYNAMIC_FORM_CONTROL_TYPE_ARRAY, DYNAMIC_FORM_CONTROL_TYPE_GROUP } from '@ng-dynamic-forms/core'; +import { isNotEmpty, isNotNull, isNotUndefined, isNull, isUndefined } from '../../../shared/empty.util'; +import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder'; +import { FormFieldLanguageValueObject } from '../../../shared/form/builder/models/form-field-language-value.model'; +import { AuthorityValue } from '../../../core/integration/models/authority.value'; +import { FormBuilderService } from '../../../shared/form/builder/form-builder.service'; +import { FormFieldMetadataValueObject } from '../../../shared/form/builder/models/form-field-metadata-value.model'; +/** + * The service handling all form section operations + */ +var SectionFormOperationsService = /** @class */ (function () { + /** + * Initialize service variables + * + * @param {FormBuilderService} formBuilder + * @param {JsonPatchOperationsBuilder} operationsBuilder + */ + function SectionFormOperationsService(formBuilder, operationsBuilder) { + this.formBuilder = formBuilder; + this.operationsBuilder = operationsBuilder; + } + /** + * Dispatch properly method based on form operation type + * + * @param pathCombiner + * the [[JsonPatchOperationPathCombiner]] object for the specified operation + * @param event + * the [[DynamicFormControlEvent]] for the specified operation + * @param previousValue + * the [[FormFieldPreviousValueObject]] for the specified operation + * @param hasStoredValue + * representing if field value related to the specified operation has stored value + */ + SectionFormOperationsService.prototype.dispatchOperationsFromEvent = function (pathCombiner, event, previousValue, hasStoredValue) { + switch (event.type) { + case 'remove': + this.dispatchOperationsFromRemoveEvent(pathCombiner, event, previousValue); + break; + case 'change': + this.dispatchOperationsFromChangeEvent(pathCombiner, event, previousValue, hasStoredValue); + break; + default: + break; + } + }; + /** + * Return index if specified field is part of fields array + * + * @param event + * the [[DynamicFormControlEvent]] for the specified operation + * @return number + * the array index is part of array, zero otherwise + */ + SectionFormOperationsService.prototype.getArrayIndexFromEvent = function (event) { + var fieldIndex; + if (isNotEmpty(event)) { + if (isNull(event.context)) { + // Check whether model is part of an Array of group + if (this.isPartOfArrayOfGroup(event.model)) { + fieldIndex = event.model.parent.parent.index; + } + } + else { + fieldIndex = event.context.index; + } + } + // if field index is undefined model is not part of array of fields + return isNotUndefined(fieldIndex) ? fieldIndex : 0; + }; + /** + * Check if specified model is part of array of group + * + * @param model + * the [[DynamicFormControlModel]] model + * @return boolean + * true if is part of array, false otherwise + */ + SectionFormOperationsService.prototype.isPartOfArrayOfGroup = function (model) { + return (isNotNull(model.parent) + && model.parent.type === DYNAMIC_FORM_CONTROL_TYPE_GROUP + && model.parent.parent + && model.parent.parent.context + && model.parent.parent.context.type === DYNAMIC_FORM_CONTROL_TYPE_ARRAY); + }; + /** + * Return a map for the values of a Qualdrop field + * + * @param event + * the [[DynamicFormControlEvent]] for the specified operation + * @return Map + * the map of values + */ + SectionFormOperationsService.prototype.getQualdropValueMap = function (event) { + var metadataValueMap = new Map(); + var context = this.formBuilder.isQualdropGroup(event.model) + ? event.model.parent.context + : event.model.parent.parent.context; + context.groups.forEach(function (arrayModel) { + var groupModel = arrayModel.group[0]; + var metadataValueList = metadataValueMap.get(groupModel.qualdropId) ? metadataValueMap.get(groupModel.qualdropId) : []; + if (groupModel.value) { + metadataValueList.push(groupModel.value); + metadataValueMap.set(groupModel.qualdropId, metadataValueList); + } + }); + return metadataValueMap; + }; + /** + * Return the absolute path for the field interesting in the specified operation + * + * @param event + * the [[DynamicFormControlEvent]] for the specified operation + * @return string + * the field path + */ + SectionFormOperationsService.prototype.getFieldPathFromEvent = function (event) { + var fieldIndex = this.getArrayIndexFromEvent(event); + var fieldId = this.getFieldPathSegmentedFromChangeEvent(event); + return (isNotUndefined(fieldIndex)) ? fieldId + '/' + fieldIndex : fieldId; + }; + /** + * Return the absolute path for the Qualdrop field interesting in the specified operation + * + * @param event + * the [[DynamicFormControlEvent]] for the specified operation + * @return string + * the field path + */ + SectionFormOperationsService.prototype.getQualdropItemPathFromEvent = function (event) { + var fieldIndex = this.getArrayIndexFromEvent(event); + var metadataValueMap = new Map(); + var path = null; + var context = this.formBuilder.isQualdropGroup(event.model) + ? event.model.parent.context + : event.model.parent.parent.context; + context.groups.forEach(function (arrayModel, index) { + var groupModel = arrayModel.group[0]; + var metadataValueList = metadataValueMap.get(groupModel.qualdropId) ? metadataValueMap.get(groupModel.qualdropId) : []; + if (groupModel.value) { + metadataValueList.push(groupModel.value); + metadataValueMap.set(groupModel.qualdropId, metadataValueList); + } + if (index === fieldIndex) { + path = groupModel.qualdropId + '/' + (metadataValueMap.get(groupModel.qualdropId).length - 1); + } + }); + return path; + }; + /** + * Return the segmented path for the field interesting in the specified change operation + * + * @param event + * the [[DynamicFormControlEvent]] for the specified operation + * @return string + * the field path + */ + SectionFormOperationsService.prototype.getFieldPathSegmentedFromChangeEvent = function (event) { + var fieldId; + if (this.formBuilder.isQualdropGroup(event.model)) { + fieldId = event.model.qualdropId; + } + else if (this.formBuilder.isQualdropGroup(event.model.parent)) { + fieldId = event.model.parent.qualdropId; + } + else { + fieldId = this.formBuilder.getId(event.model); + } + return fieldId; + }; + /** + * Return the value of the field interesting in the specified change operation + * + * @param event + * the [[DynamicFormControlEvent]] for the specified operation + * @return any + * the field value + */ + SectionFormOperationsService.prototype.getFieldValueFromChangeEvent = function (event) { + var fieldValue; + var value = event.model.value; + if (this.formBuilder.isModelInCustomGroup(event.model)) { + fieldValue = event.model.parent.value; + } + else if (this.formBuilder.isRelationGroup(event.model)) { + fieldValue = event.model.getGroupValue(); + } + else if (event.model.hasLanguages) { + var language_1 = event.model.language; + if (event.model.hasAuthority) { + if (Array.isArray(value)) { + value.forEach(function (authority, index) { + authority = Object.assign(new AuthorityValue(), authority, { language: language_1 }); + value[index] = authority; + }); + fieldValue = value; + } + else { + fieldValue = Object.assign(new AuthorityValue(), value, { language: language_1 }); + } + } + else { + // Language without Authority (input, textArea) + fieldValue = new FormFieldMetadataValueObject(value, language_1); + } + } + else if (value instanceof FormFieldLanguageValueObject || value instanceof AuthorityValue || isObject(value)) { + fieldValue = value; + } + else { + fieldValue = new FormFieldMetadataValueObject(value); + } + return fieldValue; + }; + /** + * Return a map for the values of an array of field + * + * @param items + * the list of items + * @return Map + * the map of values + */ + SectionFormOperationsService.prototype.getValueMap = function (items) { + var metadataValueMap = new Map(); + items.forEach(function (item) { + Object.keys(item) + .forEach(function (key) { + var metadataValueList = metadataValueMap.get(key) ? metadataValueMap.get(key) : []; + metadataValueList.push(item[key]); + metadataValueMap.set(key, metadataValueList); + }); + }); + return metadataValueMap; + }; + /** + * Handle form remove operations + * + * @param pathCombiner + * the [[JsonPatchOperationPathCombiner]] object for the specified operation + * @param event + * the [[DynamicFormControlEvent]] for the specified operation + * @param previousValue + * the [[FormFieldPreviousValueObject]] for the specified operation + */ + SectionFormOperationsService.prototype.dispatchOperationsFromRemoveEvent = function (pathCombiner, event, previousValue) { + var path = this.getFieldPathFromEvent(event); + var value = this.getFieldValueFromChangeEvent(event); + if (this.formBuilder.isQualdropGroup(event.model)) { + this.dispatchOperationsFromMap(this.getQualdropValueMap(event), pathCombiner, event, previousValue); + } + else if (isNotEmpty(value)) { + this.operationsBuilder.remove(pathCombiner.getPath(path)); + } + }; + /** + * Handle form change operations + * + * @param pathCombiner + * the [[JsonPatchOperationPathCombiner]] object for the specified operation + * @param event + * the [[DynamicFormControlEvent]] for the specified operation + * @param previousValue + * the [[FormFieldPreviousValueObject]] for the specified operation + * @param hasStoredValue + * representing if field value related to the specified operation has stored value + */ + SectionFormOperationsService.prototype.dispatchOperationsFromChangeEvent = function (pathCombiner, event, previousValue, hasStoredValue) { + var path = this.getFieldPathFromEvent(event); + var segmentedPath = this.getFieldPathSegmentedFromChangeEvent(event); + var value = this.getFieldValueFromChangeEvent(event); + // Detect which operation must be dispatched + if (this.formBuilder.isQualdropGroup(event.model.parent)) { + // It's a qualdrup model + this.dispatchOperationsFromMap(this.getQualdropValueMap(event), pathCombiner, event, previousValue); + } + else if (this.formBuilder.isRelationGroup(event.model)) { + // It's a relation model + this.dispatchOperationsFromMap(this.getValueMap(value), pathCombiner, event, previousValue); + } + else if (this.formBuilder.hasArrayGroupValue(event.model)) { + // Model has as value an array, so dispatch an add operation with entire block of values + this.operationsBuilder.add(pathCombiner.getPath(segmentedPath), value, true); + } + else if (previousValue.isPathEqual(this.formBuilder.getPath(event.model)) || hasStoredValue) { + // Here model has a previous value changed or stored in the server + if (!value.hasValue()) { + // New value is empty, so dispatch a remove operation + if (this.getArrayIndexFromEvent(event) === 0) { + this.operationsBuilder.remove(pathCombiner.getPath(segmentedPath)); + } + else { + this.operationsBuilder.remove(pathCombiner.getPath(path)); + } + } + else { + // New value is not equal from the previous one, so dispatch a replace operation + this.operationsBuilder.replace(pathCombiner.getPath(path), value); + } + previousValue.delete(); + } + else if (value.hasValue()) { + // Here model has no previous value but a new one + if (isUndefined(this.getArrayIndexFromEvent(event)) + || this.getArrayIndexFromEvent(event) === 0) { + // Model is single field or is part of an array model but is the first item, + // so dispatch an add operation that initialize the values of a specific metadata + this.operationsBuilder.add(pathCombiner.getPath(segmentedPath), value, true); + } + else { + // Model is part of an array model but is not the first item, + // so dispatch an add operation that add a value to an existent metadata + this.operationsBuilder.add(pathCombiner.getPath(path), value); + } + } + }; + /** + * Handle form operations interesting a field with a map as value + * + * @param valueMap + * map of values + * @param pathCombiner + * the [[JsonPatchOperationPathCombiner]] object for the specified operation + * @param event + * the [[DynamicFormControlEvent]] for the specified operation + * @param previousValue + * the [[FormFieldPreviousValueObject]] for the specified operation + */ + SectionFormOperationsService.prototype.dispatchOperationsFromMap = function (valueMap, pathCombiner, event, previousValue) { + var _this = this; + var currentValueMap = valueMap; + if (event.type === 'remove') { + var path = this.getQualdropItemPathFromEvent(event); + this.operationsBuilder.remove(pathCombiner.getPath(path)); + } + else { + if (previousValue.isPathEqual(this.formBuilder.getPath(event.model))) { + previousValue.value.forEach(function (entry, index) { + var currentValue = currentValueMap.get(index); + if (currentValue) { + if (!isEqual(entry, currentValue)) { + _this.operationsBuilder.add(pathCombiner.getPath(index), currentValue, true); + } + currentValueMap.delete(index); + } + else if (!currentValue) { + _this.operationsBuilder.remove(pathCombiner.getPath(index)); + } + }); + } + currentValueMap.forEach(function (entry, index) { + if (entry.length === 1 && isNull(entry[0])) { + // The last item of the group has been deleted so make a remove op + _this.operationsBuilder.remove(pathCombiner.getPath(index)); + } + else { + _this.operationsBuilder.add(pathCombiner.getPath(index), entry, true); + } + }); + } + previousValue.delete(); + }; + SectionFormOperationsService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [FormBuilderService, + JsonPatchOperationsBuilder]) + ], SectionFormOperationsService); + return SectionFormOperationsService; +}()); +export { SectionFormOperationsService }; +//# sourceMappingURL=section-form-operations.service.js.map \ No newline at end of file diff --git a/src/app/submission/sections/form/section-form-operations.service.js.map b/src/app/submission/sections/form/section-form-operations.service.js.map new file mode 100644 index 0000000000..32d8584381 --- /dev/null +++ b/src/app/submission/sections/form/section-form-operations.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section-form-operations.service.js","sourceRoot":"","sources":["section-form-operations.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EACL,+BAA+B,EAC/B,+BAA+B,EAIhC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGxG,OAAO,EAAE,0BAA0B,EAAE,MAAM,gEAAgE,CAAC;AAC5G,OAAO,EAAE,4BAA4B,EAAE,MAAM,qEAAqE,CAAC;AAEnH,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAE,kBAAk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AC,KAAK,EAAE,YAAY,CAAC,EAAE;4BACjC,KAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;yBAC7E;wBACD,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;qBAC/B;yBAAM,IAAI,CAAC,YAAY,EAAE;wBACxB,KAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;qBAC5D;gBACH,CAAC,CAAC,CAAC;aACJ;YACD,eAAe,CAAC,OAAO,CAAC,UAAC,KAAY,EAAE,KAAK;gBAC1C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;oBAC1C,kEAAkE;oBAClE,KAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;iBAC5D;qBAAM;oBACL,KAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;iBACtE;YACH,CAAC,CAAC,CAAC;SACJ;QAED,aAAa,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;IApXU,4BAA4B;QADxC,UAAU,EAAE;iDAUY,kBAAkB;YACZ,0BAA0B;OAV5C,4BAA4B,CAqXxC;IAAD,mCAAC;CAAA,AArXD,IAqXC;SArXY,4BAA4B"} \ No newline at end of file diff --git a/src/app/submission/sections/form/section-form.component.js b/src/app/submission/sections/form/section-form.component.js new file mode 100644 index 0000000000..63ab31a6d0 --- /dev/null +++ b/src/app/submission/sections/form/section-form.component.js @@ -0,0 +1,319 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, Inject, ViewChild } from '@angular/core'; +import { distinctUntilChanged, filter, find, flatMap, map, take, tap } from 'rxjs/operators'; +import { TranslateService } from '@ngx-translate/core'; +import { isEqual } from 'lodash'; +import { FormBuilderService } from '../../../shared/form/builder/form-builder.service'; +import { FormComponent } from '../../../shared/form/form.component'; +import { FormService } from '../../../shared/form/form.service'; +import { SectionModelComponent } from '../models/section.model'; +import { SubmissionFormsConfigService } from '../../../core/config/submission-forms-config.service'; +import { hasValue, isNotEmpty, isUndefined } from '../../../shared/empty.util'; +import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner'; +import { FormFieldPreviousValueObject } from '../../../shared/form/builder/models/form-field-previous-value-object'; +import { GLOBAL_CONFIG } from '../../../../config'; +import { renderSectionFor } from '../sections-decorator'; +import { SectionsType } from '../sections-type'; +import { SubmissionService } from '../../submission.service'; +import { SectionFormOperationsService } from './section-form-operations.service'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { SectionsService } from '../sections.service'; +import { difference } from '../../../shared/object.util'; +/** + * This component represents a section that contains a Form. + */ +var SubmissionSectionformComponent = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionSectionformComponent, _super); + /** + * Initialize instance variables + * + * @param {ChangeDetectorRef} cdr + * @param {FormBuilderService} formBuilderService + * @param {SectionFormOperationsService} formOperationsService + * @param {FormService} formService + * @param {SubmissionFormsConfigService} formConfigService + * @param {NotificationsService} notificationsService + * @param {SectionsService} sectionService + * @param {SubmissionService} submissionService + * @param {TranslateService} translate + * @param {GlobalConfig} EnvConfig + * @param {string} injectedCollectionId + * @param {SectionDataObject} injectedSectionData + * @param {string} injectedSubmissionId + */ + function SubmissionSectionformComponent(cdr, formBuilderService, formOperationsService, formService, formConfigService, notificationsService, sectionService, submissionService, translate, EnvConfig, injectedCollectionId, injectedSectionData, injectedSubmissionId) { + var _this = _super.call(this, injectedCollectionId, injectedSectionData, injectedSubmissionId) || this; + _this.cdr = cdr; + _this.formBuilderService = formBuilderService; + _this.formOperationsService = formOperationsService; + _this.formService = formService; + _this.formConfigService = formConfigService; + _this.notificationsService = notificationsService; + _this.sectionService = sectionService; + _this.submissionService = submissionService; + _this.translate = translate; + _this.EnvConfig = EnvConfig; + _this.injectedCollectionId = injectedCollectionId; + _this.injectedSectionData = injectedSectionData; + _this.injectedSubmissionId = injectedSubmissionId; + /** + * A boolean representing if this section is updating + * @type {boolean} + */ + _this.isUpdating = false; + /** + * A boolean representing if this section is loading + * @type {boolean} + */ + _this.isLoading = true; + /** + * The form data + * @type {any} + */ + _this.formData = Object.create({}); + /** + * The [FormFieldPreviousValueObject] object + * @type {FormFieldPreviousValueObject} + */ + _this.previousValue = new FormFieldPreviousValueObject(); + /** + * The list of Subscription + * @type {Array} + */ + _this.subs = []; + return _this; + } + /** + * Initialize all instance variables and retrieve form configuration + */ + SubmissionSectionformComponent.prototype.onSectionInit = function () { + var _this = this; + this.pathCombiner = new JsonPatchOperationPathCombiner('sections', this.sectionData.id); + this.formId = this.formService.getUniqueId(this.sectionData.id); + this.formConfigService.getConfigByHref(this.sectionData.config).pipe(map(function (configData) { return configData.payload; }), tap(function (config) { return _this.formConfig = config; }), flatMap(function () { return _this.sectionService.getSectionData(_this.submissionId, _this.sectionData.id); }), take(1)) + .subscribe(function (sectionData) { + if (isUndefined(_this.formModel)) { + _this.sectionData.errors = []; + // Is the first loading so init form + _this.initForm(sectionData); + _this.sectionData.data = sectionData; + _this.subscriptions(); + _this.isLoading = false; + _this.cdr.detectChanges(); + } + }); + }; + /** + * Unsubscribe from all subscriptions + */ + SubmissionSectionformComponent.prototype.onSectionDestroy = function () { + this.subs + .filter(function (subscription) { return hasValue(subscription); }) + .forEach(function (subscription) { return subscription.unsubscribe(); }); + }; + /** + * Get section status + * + * @return Observable + * the section status + */ + SubmissionSectionformComponent.prototype.getSectionStatus = function () { + return this.formService.isValid(this.formId); + }; + /** + * Check if the section data has been enriched by the server + * + * @param sectionData + * the section data retrieved from the server + */ + SubmissionSectionformComponent.prototype.hasMetadataEnrichment = function (sectionData) { + var diffResult = []; + // compare current form data state with section data retrieved from store + var diffObj = difference(sectionData, this.formData); + // iterate over differences to check whether they are actually different + Object.keys(diffObj) + .forEach(function (key) { + diffObj[key].forEach(function (value) { + if (value.hasOwnProperty('value')) { + diffResult.push(value); + } + }); + }); + return isNotEmpty(diffResult); + }; + /** + * Initialize form model + * + * @param sectionData + * the section data retrieved from the server + */ + SubmissionSectionformComponent.prototype.initForm = function (sectionData) { + try { + this.formModel = this.formBuilderService.modelFromConfiguration(this.formConfig, this.collectionId, sectionData, this.submissionService.getSubmissionScope()); + } + catch (e) { + var msg = this.translate.instant('error.submission.sections.init-form-error') + e.toString(); + var sectionError = { + message: msg, + path: '/sections/' + this.sectionData.id + }; + this.sectionService.setSectionError(this.submissionId, this.sectionData.id, sectionError); + } + }; + /** + * Update form model + * + * @param sectionData + * the section data retrieved from the server + * @param errors + * the section errors retrieved from the server + */ + SubmissionSectionformComponent.prototype.updateForm = function (sectionData, errors) { + if (isNotEmpty(sectionData) && !isEqual(sectionData, this.sectionData.data)) { + this.sectionData.data = sectionData; + if (this.hasMetadataEnrichment(sectionData)) { + var msg = this.translate.instant('submission.sections.general.metadata-extracted', { sectionId: this.sectionData.id }); + this.notificationsService.info(null, msg, null, true); + this.isUpdating = true; + this.formModel = null; + this.cdr.detectChanges(); + this.initForm(sectionData); + this.checksForErrors(errors); + this.isUpdating = false; + this.cdr.detectChanges(); + } + else if (isNotEmpty(errors) || isNotEmpty(this.sectionData.errors)) { + this.checksForErrors(errors); + } + } + else if (isNotEmpty(errors) || isNotEmpty(this.sectionData.errors)) { + this.checksForErrors(errors); + } + }; + /** + * Check if there are form validation error retrieved from server + * + * @param errors + * the section errors retrieved from the server + */ + SubmissionSectionformComponent.prototype.checksForErrors = function (errors) { + var _this = this; + this.formService.isFormInitialized(this.formId).pipe(find(function (status) { return status === true && !_this.isUpdating; })) + .subscribe(function () { + _this.sectionService.checkSectionErrors(_this.submissionId, _this.sectionData.id, _this.formId, errors, _this.sectionData.errors); + _this.sectionData.errors = errors; + _this.cdr.detectChanges(); + }); + }; + /** + * Initialize all subscriptions + */ + SubmissionSectionformComponent.prototype.subscriptions = function () { + var _this = this; + this.subs.push( + /** + * Subscribe to form's data + */ + this.formService.getFormData(this.formId).pipe(distinctUntilChanged()) + .subscribe(function (formData) { + _this.formData = formData; + }), + /** + * Subscribe to section state + */ + this.sectionService.getSectionState(this.submissionId, this.sectionData.id).pipe(filter(function (sectionState) { + return isNotEmpty(sectionState) && (isNotEmpty(sectionState.data) || isNotEmpty(sectionState.errors)); + }), distinctUntilChanged()) + .subscribe(function (sectionState) { + _this.updateForm(sectionState.data, sectionState.errors); + })); + }; + /** + * Method called when a form dfChange event is fired. + * Dispatch form operations based on changes. + * + * @param event + * the [[DynamicFormControlEvent]] emitted + */ + SubmissionSectionformComponent.prototype.onChange = function (event) { + this.formOperationsService.dispatchOperationsFromEvent(this.pathCombiner, event, this.previousValue, this.hasStoredValue(this.formBuilderService.getId(event.model), this.formOperationsService.getArrayIndexFromEvent(event))); + var metadata = this.formOperationsService.getFieldPathSegmentedFromChangeEvent(event); + var value = this.formOperationsService.getFieldValueFromChangeEvent(event); + if (this.EnvConfig.submission.autosave.metadata.indexOf(metadata) !== -1 && isNotEmpty(value)) { + this.submissionService.dispatchSave(this.submissionId); + } + }; + /** + * Method called when a form dfFocus event is fired. + * Initialize [FormFieldPreviousValueObject] instance. + * + * @param event + * the [[DynamicFormControlEvent]] emitted + */ + SubmissionSectionformComponent.prototype.onFocus = function (event) { + var value = this.formOperationsService.getFieldValueFromChangeEvent(event); + var path = this.formBuilderService.getPath(event.model); + if (this.formBuilderService.hasMappedGroupValue(event.model)) { + this.previousValue.path = path; + this.previousValue.value = this.formOperationsService.getQualdropValueMap(event); + } + else if (isNotEmpty(value) && ((typeof value === 'object' && isNotEmpty(value.value)) || (typeof value === 'string'))) { + this.previousValue.path = path; + this.previousValue.value = value; + } + }; + /** + * Method called when a form remove event is fired. + * Dispatch form operations based on changes. + * + * @param event + * the [[DynamicFormControlEvent]] emitted + */ + SubmissionSectionformComponent.prototype.onRemove = function (event) { + this.formOperationsService.dispatchOperationsFromEvent(this.pathCombiner, event, this.previousValue, this.hasStoredValue(this.formBuilderService.getId(event.model), this.formOperationsService.getArrayIndexFromEvent(event))); + }; + /** + * Check if the specified form field has already a value stored + * + * @param fieldId + * the section data retrieved from the serverù + * @param index + * the section data retrieved from the server + */ + SubmissionSectionformComponent.prototype.hasStoredValue = function (fieldId, index) { + if (isNotEmpty(this.sectionData.data)) { + return this.sectionData.data.hasOwnProperty(fieldId) && isNotEmpty(this.sectionData.data[fieldId][index]); + } + else { + return false; + } + }; + tslib_1.__decorate([ + ViewChild('formRef'), + tslib_1.__metadata("design:type", FormComponent) + ], SubmissionSectionformComponent.prototype, "formRef", void 0); + SubmissionSectionformComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-section-form', + styleUrls: ['./section-form.component.scss'], + templateUrl: './section-form.component.html', + }), + renderSectionFor(SectionsType.SubmissionForm), + tslib_1.__param(9, Inject(GLOBAL_CONFIG)), + tslib_1.__param(10, Inject('collectionIdProvider')), + tslib_1.__param(11, Inject('sectionDataProvider')), + tslib_1.__param(12, Inject('submissionIdProvider')), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef, + FormBuilderService, + SectionFormOperationsService, + FormService, + SubmissionFormsConfigService, + NotificationsService, + SectionsService, + SubmissionService, + TranslateService, Object, String, Object, String]) + ], SubmissionSectionformComponent); + return SubmissionSectionformComponent; +}(SectionModelComponent)); +export { SubmissionSectionformComponent }; +//# sourceMappingURL=section-form.component.js.map \ No newline at end of file diff --git a/src/app/submission/sections/form/section-form.component.js.map b/src/app/submission/sections/form/section-form.component.js.map new file mode 100644 index 0000000000..cf4ecd0805 --- /dev/null +++ b/src/app/submission/sections/form/section-form.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section-form.component.js","sourceRoot":"","sources":["section-form.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EA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CAAC,+BAA+B,CAAC;YAC5C,WAAW,EAAE,+BAA+B;SAC7C,CAAC;QACD,gBAAgB,CAAC,YAAY,CAAC,cAAc,CAAC;QAwF/B,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;QACrB,oBAAA,MAAM,CAAC,sBAAsB,CAAC,CAAA;QAC9B,oBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;QAC7B,oBAAA,MAAM,CAAC,sBAAsB,CAAC,CAAA;iDAZhB,iBAAiB;YACF,kBAAkB;YACf,4BAA4B;YACtC,WAAW;YACL,4BAA4B;YACzB,oBAAoB;YAC1B,eAAe;YACZ,iBAAiB;YACzB,gBAAgB;OAtFtC,8BAA8B,CA4U1C;IAAD,qCAAC;CAAA,AA5UD,CAAoD,qBAAqB,GA4UxE;SA5UY,8BAA8B"} \ No newline at end of file diff --git a/src/app/submission/sections/license/section-license.component.js b/src/app/submission/sections/license/section-license.component.js new file mode 100644 index 0000000000..e76ada3324 --- /dev/null +++ b/src/app/submission/sections/license/section-license.component.js @@ -0,0 +1,180 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, Inject, ViewChild } from '@angular/core'; +import { distinctUntilChanged, filter, find, flatMap, map, startWith, take } from 'rxjs/operators'; +import { SectionModelComponent } from '../models/section.model'; +import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder'; +import { CollectionDataService } from '../../../core/data/collection-data.service'; +import { hasValue, isNotEmpty, isNotNull, isNotUndefined } from '../../../shared/empty.util'; +import { SECTION_LICENSE_FORM_LAYOUT, SECTION_LICENSE_FORM_MODEL } from './section-license.model'; +import { FormBuilderService } from '../../../shared/form/builder/form-builder.service'; +import { FormService } from '../../../shared/form/form.service'; +import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner'; +import { SectionsType } from '../sections-type'; +import { renderSectionFor } from '../sections-decorator'; +import { SubmissionService } from '../../submission.service'; +import { SectionsService } from '../sections.service'; +import { SectionFormOperationsService } from '../form/section-form-operations.service'; +import { FormComponent } from '../../../shared/form/form.component'; +/** + * This component represents a section that contains the submission license form. + */ +var SubmissionSectionLicenseComponent = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionSectionLicenseComponent, _super); + /** + * Initialize instance variables + * + * @param {ChangeDetectorRef} changeDetectorRef + * @param {CollectionDataService} collectionDataService + * @param {FormBuilderService} formBuilderService + * @param {SectionFormOperationsService} formOperationsService + * @param {FormService} formService + * @param {JsonPatchOperationsBuilder} operationsBuilder + * @param {SectionsService} sectionService + * @param {SubmissionService} submissionService + * @param {string} injectedCollectionId + * @param {SectionDataObject} injectedSectionData + * @param {string} injectedSubmissionId + */ + function SubmissionSectionLicenseComponent(changeDetectorRef, collectionDataService, formBuilderService, formOperationsService, formService, operationsBuilder, sectionService, submissionService, injectedCollectionId, injectedSectionData, injectedSubmissionId) { + var _this = _super.call(this, injectedCollectionId, injectedSectionData, injectedSubmissionId) || this; + _this.changeDetectorRef = changeDetectorRef; + _this.collectionDataService = collectionDataService; + _this.formBuilderService = formBuilderService; + _this.formOperationsService = formOperationsService; + _this.formService = formService; + _this.operationsBuilder = operationsBuilder; + _this.sectionService = sectionService; + _this.submissionService = submissionService; + _this.injectedCollectionId = injectedCollectionId; + _this.injectedSectionData = injectedSectionData; + _this.injectedSubmissionId = injectedSubmissionId; + /** + * The [[DynamicFormLayout]] object + * @type {DynamicFormLayout} + */ + _this.formLayout = SECTION_LICENSE_FORM_LAYOUT; + /** + * A boolean representing if to show form submit and cancel buttons + * @type {boolean} + */ + _this.displaySubmit = false; + /** + * Array to track all subscriptions and unsubscribe them onDestroy + * @type {Array} + */ + _this.subs = []; + return _this; + } + /** + * Initialize all instance variables and retrieve submission license + */ + SubmissionSectionLicenseComponent.prototype.onSectionInit = function () { + var _this = this; + this.pathCombiner = new JsonPatchOperationPathCombiner('sections', this.sectionData.id); + this.formId = this.formService.getUniqueId(this.sectionData.id); + this.formModel = this.formBuilderService.fromJSON(SECTION_LICENSE_FORM_MODEL); + var model = this.formBuilderService.findById('granted', this.formModel); + // Retrieve license accepted status + if (this.sectionData.data.granted) { + model.valueUpdates.next(true); + } + else { + model.valueUpdates.next(false); + } + this.licenseText$ = this.collectionDataService.findById(this.collectionId).pipe(filter(function (collectionData) { return isNotUndefined((collectionData.payload)); }), flatMap(function (collectionData) { return collectionData.payload.license; }), find(function (licenseData) { return isNotUndefined((licenseData.payload)); }), map(function (licenseData) { return licenseData.payload.text; }), startWith('')); + this.subs.push( + // Disable checkbox whether it's in workflow or item scope + this.sectionService.isSectionReadOnly(this.submissionId, this.sectionData.id, this.submissionService.getSubmissionScope()).pipe(take(1), filter(function (isReadOnly) { return isReadOnly; })) + .subscribe(function () { + model.disabledUpdates.next(true); + }), this.sectionService.getSectionErrors(this.submissionId, this.sectionData.id).pipe(filter(function (errors) { return isNotEmpty(errors); }), distinctUntilChanged()) + .subscribe(function (errors) { + // parse errors + var newErrors = errors.map(function (error) { + // When the error path is only on the section, + // replace it with the path to the form field to display error also on the form + if (error.path === '/sections/license') { + // check whether license is not accepted + if (!model.checked) { + return Object.assign({}, error, { path: '/sections/license/granted' }); + } + else { + return null; + } + } + else { + return error; + } + }).filter(function (error) { return isNotNull(error); }); + if (isNotEmpty(newErrors)) { + _this.sectionService.checkSectionErrors(_this.submissionId, _this.sectionData.id, _this.formId, newErrors); + _this.sectionData.errors = errors; + } + else { + // Remove any section's errors + _this.sectionService.dispatchRemoveSectionErrors(_this.submissionId, _this.sectionData.id); + } + _this.changeDetectorRef.detectChanges(); + })); + }; + /** + * Get section status + * + * @return Observable + * the section status + */ + SubmissionSectionLicenseComponent.prototype.getSectionStatus = function () { + var model = this.formBuilderService.findById('granted', this.formModel); + return model.valueUpdates.pipe(map(function (value) { return value === true; }), startWith(model.value)); + }; + /** + * Method called when a form dfChange event is fired. + * Dispatch form operations based on changes. + */ + SubmissionSectionLicenseComponent.prototype.onChange = function (event) { + var path = this.formOperationsService.getFieldPathSegmentedFromChangeEvent(event); + var value = this.formOperationsService.getFieldValueFromChangeEvent(event); + if (value) { + this.operationsBuilder.add(this.pathCombiner.getPath(path), value.value.toString(), false, true); + // Remove any section's errors + this.sectionService.dispatchRemoveSectionErrors(this.submissionId, this.sectionData.id); + } + else { + this.operationsBuilder.remove(this.pathCombiner.getPath(path)); + } + }; + /** + * Unsubscribe from all subscriptions + */ + SubmissionSectionLicenseComponent.prototype.onSectionDestroy = function () { + this.subs + .filter(function (subscription) { return hasValue(subscription); }) + .forEach(function (subscription) { return subscription.unsubscribe(); }); + }; + tslib_1.__decorate([ + ViewChild('formRef'), + tslib_1.__metadata("design:type", FormComponent) + ], SubmissionSectionLicenseComponent.prototype, "formRef", void 0); + SubmissionSectionLicenseComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-section-license', + styleUrls: ['./section-license.component.scss'], + templateUrl: './section-license.component.html', + }), + renderSectionFor(SectionsType.License), + tslib_1.__param(8, Inject('collectionIdProvider')), + tslib_1.__param(9, Inject('sectionDataProvider')), + tslib_1.__param(10, Inject('submissionIdProvider')), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef, + CollectionDataService, + FormBuilderService, + SectionFormOperationsService, + FormService, + JsonPatchOperationsBuilder, + SectionsService, + SubmissionService, String, Object, String]) + ], SubmissionSectionLicenseComponent); + return SubmissionSectionLicenseComponent; +}(SectionModelComponent)); +export { SubmissionSectionLicenseComponent }; +//# sourceMappingURL=section-license.component.js.map \ No newline at end of file diff --git a/src/app/submission/sections/license/section-license.component.js.map b/src/app/submission/sections/license/section-license.component.js.map new file mode 100644 index 0000000000..8903c8d5b8 --- /dev/null +++ b/src/app/submission/sections/license/section-license.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section-license.component.js","sourceRoot":"","sources":["section-license.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGhF,OAAO,EAAE,oBAAoB,EAAE,MAAM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,CAAC,sBAAsB,CAAC,CAAA;QAC9B,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;QAC7B,oBAAA,MAAM,CAAC,sBAAsB,CAAC,CAAA;iDAVF,iBAAiB;YACb,qBAAqB;YACxB,kBAAkB;YACf,4BAA4B;YACtC,WAAW;YACL,0BAA0B;YAC7B,eAAe;YACZ,iBAAiB;OAvE/C,iCAAiC,CAuL7C;IAAD,wCAAC;CAAA,AAvLD,CAAuD,qBAAqB,GAuL3E;SAvLY,iCAAiC"} \ No newline at end of file diff --git a/src/app/submission/sections/license/section-license.model.js b/src/app/submission/sections/license/section-license.model.js new file mode 100644 index 0000000000..e1f3cb796c --- /dev/null +++ b/src/app/submission/sections/license/section-license.model.js @@ -0,0 +1,26 @@ +export var SECTION_LICENSE_FORM_LAYOUT = { + granted: { + element: { + container: 'custom-control custom-checkbox pl-1', + control: 'custom-control-input', + label: 'custom-control-label pt-1' + } + } +}; +export var SECTION_LICENSE_FORM_MODEL = [ + { + id: 'granted', + label: 'I confirm the license above', + required: true, + value: false, + validators: { + required: null + }, + errorMessages: { + required: 'You must accept the license', + notgranted: 'You must accept the license' + }, + type: 'CHECKBOX', + } +]; +//# sourceMappingURL=section-license.model.js.map \ No newline at end of file diff --git a/src/app/submission/sections/license/section-license.model.js.map b/src/app/submission/sections/license/section-license.model.js.map new file mode 100644 index 0000000000..526cc61c58 --- /dev/null +++ b/src/app/submission/sections/license/section-license.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section-license.model.js","sourceRoot":"","sources":["section-license.model.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,IAAM,2BAA2B,GAAG;IAEzC,OAAO,EAAE;QACP,OAAO,EAAE;YACP,SAAS,EAAE,qCAAqC;YAChD,OAAO,EAAE,sBAAsB;YAC/B,KAAK,EAAE,2BAA2B;SACnC;KACF;CACF,CAAC;AAEF,MAAM,CAAC,IAAM,0BAA0B,GAAG;IACxC;QACE,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,6BAA6B;QACpC,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,KAAK;QACZ,UAAU,EAAE;YACV,QAAQ,EAAE,IAAI;SACf;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,6BAA6B;YACvC,UAAU,EAAE,6BAA6B;SAC1C;QACD,IAAI,EAAE,UAAU;KACjB;CACF,CAAC"} \ No newline at end of file diff --git a/src/app/submission/sections/models/section-data.model.js b/src/app/submission/sections/models/section-data.model.js new file mode 100644 index 0000000000..eb0b06de2e --- /dev/null +++ b/src/app/submission/sections/models/section-data.model.js @@ -0,0 +1 @@ +//# sourceMappingURL=section-data.model.js.map \ No newline at end of file diff --git a/src/app/submission/sections/models/section-data.model.js.map b/src/app/submission/sections/models/section-data.model.js.map new file mode 100644 index 0000000000..567af326b4 --- /dev/null +++ b/src/app/submission/sections/models/section-data.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section-data.model.js","sourceRoot":"","sources":["section-data.model.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/app/submission/sections/models/section.model.js b/src/app/submission/sections/models/section.model.js new file mode 100644 index 0000000000..187cc4c306 --- /dev/null +++ b/src/app/submission/sections/models/section.model.js @@ -0,0 +1,59 @@ +import * as tslib_1 from "tslib"; +import { Inject } from '@angular/core'; +import { filter, startWith } from 'rxjs/operators'; +import { hasValue, isNotUndefined } from '../../../shared/empty.util'; +/** + * An abstract model class for a submission edit form section. + */ +var SectionModelComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {string} injectedCollectionId + * @param {SectionDataObject} injectedSectionData + * @param {string} injectedSubmissionId + */ + function SectionModelComponent(injectedCollectionId, injectedSectionData, injectedSubmissionId) { + this.injectedCollectionId = injectedCollectionId; + this.injectedSectionData = injectedSectionData; + this.injectedSubmissionId = injectedSubmissionId; + this.collectionId = injectedCollectionId; + this.sectionData = injectedSectionData; + this.submissionId = injectedSubmissionId; + } + /** + * Call abstract methods on component init + */ + SectionModelComponent.prototype.ngOnInit = function () { + this.onSectionInit(); + this.updateSectionStatus(); + }; + /** + * Subscribe to section status + */ + SectionModelComponent.prototype.updateSectionStatus = function () { + var _this = this; + this.sectionStatusSub = this.getSectionStatus().pipe(filter(function (sectionStatus) { return isNotUndefined(sectionStatus); }), startWith(true)) + .subscribe(function (sectionStatus) { + _this.sectionService.setSectionStatus(_this.submissionId, _this.sectionData.id, sectionStatus); + }); + }; + /** + * Unsubscribe from all subscriptions and Call abstract methods on component destroy + */ + SectionModelComponent.prototype.ngOnDestroy = function () { + if (hasValue(this.sectionStatusSub)) { + this.sectionStatusSub.unsubscribe(); + } + this.onSectionDestroy(); + }; + SectionModelComponent = tslib_1.__decorate([ + tslib_1.__param(0, Inject('collectionIdProvider')), + tslib_1.__param(1, Inject('sectionDataProvider')), + tslib_1.__param(2, Inject('submissionIdProvider')), + tslib_1.__metadata("design:paramtypes", [String, Object, String]) + ], SectionModelComponent); + return SectionModelComponent; +}()); +export { SectionModelComponent }; +//# sourceMappingURL=section.model.js.map \ No newline at end of file diff --git a/src/app/submission/sections/models/section.model.js.map b/src/app/submission/sections/models/section.model.js.map new file mode 100644 index 0000000000..5ef727c430 --- /dev/null +++ b/src/app/submission/sections/models/section.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section.model.js","sourceRoot":"","sources":["section.model.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAInD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAMtE;;GAEG;AACH;IAiCE;;;;;;OAMG;IACH,+BAA0D,oBAA4B,EAC7B,mBAAsC,EACrC,oBAA4B;QAF5B,yBAAoB,GAApB,oBAAoB,CAAQ;QAC7B,wBAAmB,GAAnB,mBAAmB,CAAmB;QACrC,yBAAoB,GAApB,oBAAoB,CAAQ;QACpF,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,wCAAQ,GAAR;QACE,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IA4BD;;OAEG;IACO,mDAAmB,GAA7B;QAAA,iBAOC;QANC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC,IAAI,CAClD,MAAM,CAAC,UAAC,aAAsB,IAAK,OAAA,cAAc,CAAC,aAAa,CAAC,EAA7B,CAA6B,CAAC,EACjE,SAAS,CAAC,IAAI,CAAC,CAAC;aACf,SAAS,CAAC,UAAC,aAAsB;YAChC,KAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,KAAI,CAAC,YAAY,EAAE,KAAI,CAAC,WAAW,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;QAC9F,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,2CAAW,GAAX;QACE,IAAI,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE;YACnC,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC;SACrC;QACD,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAtGmB,qBAAqB;QAwCrB,mBAAA,MAAM,CAAC,sBAAsB,CAAC,CAAA;QAC9B,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;QAC7B,mBAAA,MAAM,CAAC,sBAAsB,CAAC,CAAA;;OA1C9B,qBAAqB,CAuG1C;IAAD,4BAAC;CAAA,AAvGD,IAuGC;SAvGqB,qBAAqB"} \ No newline at end of file diff --git a/src/app/submission/sections/sections-decorator.js b/src/app/submission/sections/sections-decorator.js new file mode 100644 index 0000000000..05691450a1 --- /dev/null +++ b/src/app/submission/sections/sections-decorator.js @@ -0,0 +1,13 @@ +var submissionSectionsMap = new Map(); +export function renderSectionFor(sectionType) { + return function decorator(objectElement) { + if (!objectElement) { + return; + } + submissionSectionsMap.set(sectionType, objectElement); + }; +} +export function rendersSectionType(sectionType) { + return submissionSectionsMap.get(sectionType); +} +//# sourceMappingURL=sections-decorator.js.map \ No newline at end of file diff --git a/src/app/submission/sections/sections-decorator.js.map b/src/app/submission/sections/sections-decorator.js.map new file mode 100644 index 0000000000..7a701d3a29 --- /dev/null +++ b/src/app/submission/sections/sections-decorator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sections-decorator.js","sourceRoot":"","sources":["sections-decorator.ts"],"names":[],"mappings":"AAGA,IAAM,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;AACxC,MAAM,2BAA2B,WAAyB;IACxD,OAAO,mBAAmB,aAAkB;QAC1C,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO;SACR;QACD,qBAAqB,CAAC,GAAG,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACxD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,6BAA6B,WAAyB;IAC1D,OAAO,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAChD,CAAC"} \ No newline at end of file diff --git a/src/app/submission/sections/sections-type.js b/src/app/submission/sections/sections-type.js new file mode 100644 index 0000000000..571af6569e --- /dev/null +++ b/src/app/submission/sections/sections-type.js @@ -0,0 +1,9 @@ +export var SectionsType; +(function (SectionsType) { + SectionsType["SubmissionForm"] = "submission-form"; + SectionsType["Upload"] = "upload"; + SectionsType["License"] = "license"; + SectionsType["CcLicense"] = "cclicense"; + SectionsType["collection"] = "collection"; +})(SectionsType || (SectionsType = {})); +//# sourceMappingURL=sections-type.js.map \ No newline at end of file diff --git a/src/app/submission/sections/sections-type.js.map b/src/app/submission/sections/sections-type.js.map new file mode 100644 index 0000000000..b69fa60447 --- /dev/null +++ b/src/app/submission/sections/sections-type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sections-type.js","sourceRoot":"","sources":["sections-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,kDAAkC,CAAA;IAClC,iCAAiB,CAAA;IACjB,mCAAmB,CAAA;IACnB,uCAAuB,CAAA;IACvB,yCAAyB,CAAA;AAC3B,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB"} \ No newline at end of file diff --git a/src/app/submission/sections/sections.directive.js b/src/app/submission/sections/sections.directive.js new file mode 100644 index 0000000000..852def2db5 --- /dev/null +++ b/src/app/submission/sections/sections.directive.js @@ -0,0 +1,255 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Directive, Input } from '@angular/core'; +import { map } from 'rxjs/operators'; +import { uniq } from 'lodash'; +import { SectionsService } from './sections.service'; +import { hasValue, isNotEmpty, isNotNull } from '../../shared/empty.util'; +import parseSectionErrorPaths from '../utils/parseSectionErrorPaths'; +import { SubmissionService } from '../submission.service'; +/** + * Directive for handling generic section functionality + */ +var SectionsDirective = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {ChangeDetectorRef} changeDetectorRef + * @param {SubmissionService} submissionService + * @param {SectionsService} sectionService + */ + function SectionsDirective(changeDetectorRef, submissionService, sectionService) { + this.changeDetectorRef = changeDetectorRef; + this.submissionService = submissionService; + this.sectionService = sectionService; + /** + * A boolean representing if section is mandatory + * @type {boolean} + */ + this.mandatory = true; + /** + * The list of generic errors related to the section + * @type {Array} + */ + this.genericSectionErrors = []; + /** + * The list of all errors related to the element belonging to this section + * @type {Array} + */ + this.allSectionErrors = []; + /** + * A boolean representing if section is active + * @type {boolean} + */ + this.active = true; + /** + * A boolean representing the panel collapsible state: opened (true) or closed (false) + * @type {boolean} + */ + this.sectionState = this.mandatory; + /** + * Array to track all subscriptions and unsubscribe them onDestroy + * @type {Array} + */ + this.subs = []; + } + /** + * Initialize instance variables + */ + SectionsDirective.prototype.ngOnInit = function () { + var _this = this; + this.valid = this.sectionService.isSectionValid(this.submissionId, this.sectionId).pipe(map(function (valid) { + if (valid) { + _this.resetErrors(); + } + return valid; + })); + this.subs.push(this.sectionService.getSectionState(this.submissionId, this.sectionId).pipe(map(function (state) { return state.errors; })) + .subscribe(function (errors) { + if (isNotEmpty(errors)) { + errors.forEach(function (errorItem) { + var parsedErrors = parseSectionErrorPaths(errorItem.path); + parsedErrors.forEach(function (error) { + if (!error.fieldId) { + _this.genericSectionErrors = uniq(_this.genericSectionErrors.concat(errorItem.message)); + } + else { + _this.allSectionErrors.push(errorItem.message); + } + }); + }); + } + else { + _this.resetErrors(); + } + }), this.submissionService.getActiveSectionId(this.submissionId) + .subscribe(function (activeSectionId) { + var previousActive = _this.active; + _this.active = (activeSectionId === _this.sectionId); + if (previousActive !== _this.active) { + _this.changeDetectorRef.detectChanges(); + // If section is no longer active dispatch save action + if (!_this.active && isNotNull(activeSectionId)) { + _this.submissionService.dispatchSave(_this.submissionId); + } + } + })); + this.enabled = this.sectionService.isSectionEnabled(this.submissionId, this.sectionId); + }; + /** + * Unsubscribe from all subscriptions + */ + SectionsDirective.prototype.ngOnDestroy = function () { + this.subs + .filter(function (subscription) { return hasValue(subscription); }) + .forEach(function (subscription) { return subscription.unsubscribe(); }); + }; + /** + * Change section state + * + * @param event + * the event emitted + */ + SectionsDirective.prototype.sectionChange = function (event) { + this.sectionState = event.nextState; + }; + /** + * Check if section panel is open + * + * @returns {boolean} + * Returns true when section panel is open + */ + SectionsDirective.prototype.isOpen = function () { + return this.sectionState; + }; + /** + * Check if section is mandatory + * + * @returns {boolean} + * Returns true when section is mandatory + */ + SectionsDirective.prototype.isMandatory = function () { + return this.mandatory; + }; + /** + * Check if section panel is active + * + * @returns {boolean} + * Returns true when section panel is active + */ + SectionsDirective.prototype.isSectionActive = function () { + return this.active; + }; + /** + * Check if section is enabled + * + * @returns {Observable} + * Emits true whenever section is enabled + */ + SectionsDirective.prototype.isEnabled = function () { + return this.enabled; + }; + /** + * Check if section is valid + * + * @returns {Observable} + * Emits true whenever section is valid + */ + SectionsDirective.prototype.isValid = function () { + return this.valid; + }; + /** + * Remove section panel from submission form + * + * @param submissionId + * the submission id + * @param sectionId + * the section id + * @returns {Observable} + * Emits true whenever section is valid + */ + SectionsDirective.prototype.removeSection = function (submissionId, sectionId) { + this.sectionService.removeSection(submissionId, sectionId); + }; + /** + * Check if section has only generic errors + * + * @returns {boolean} + * Returns true when section has only generic errors + */ + SectionsDirective.prototype.hasGenericErrors = function () { + return this.genericSectionErrors && this.genericSectionErrors.length > 0; + }; + /** + * Check if section has errors + * + * @returns {boolean} + * Returns true when section has errors + */ + SectionsDirective.prototype.hasErrors = function () { + return (this.genericSectionErrors && this.genericSectionErrors.length > 0) || + (this.allSectionErrors && this.allSectionErrors.length > 0); + }; + /** + * Return section errors + * + * @returns {Array} + * Returns section errors list + */ + SectionsDirective.prototype.getErrors = function () { + return this.genericSectionErrors; + }; + /** + * Set form focus to this section panel + * + * @param event + * The event emitted + */ + SectionsDirective.prototype.setFocus = function (event) { + if (!this.active) { + this.submissionService.setActiveSection(this.submissionId, this.sectionId); + } + }; + /** + * Remove error from list + * + * @param index + * The error array key + */ + SectionsDirective.prototype.removeError = function (index) { + this.genericSectionErrors.splice(index); + }; + /** + * Remove all errors from list + */ + SectionsDirective.prototype.resetErrors = function () { + if (isNotEmpty(this.genericSectionErrors)) { + this.sectionService.dispatchRemoveSectionErrors(this.submissionId, this.sectionId); + } + this.genericSectionErrors = []; + this.allSectionErrors = []; + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], SectionsDirective.prototype, "mandatory", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SectionsDirective.prototype, "sectionId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SectionsDirective.prototype, "submissionId", void 0); + SectionsDirective = tslib_1.__decorate([ + Directive({ + selector: '[dsSection]', + exportAs: 'sectionRef' + }), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef, + SubmissionService, + SectionsService]) + ], SectionsDirective); + return SectionsDirective; +}()); +export { SectionsDirective }; +//# sourceMappingURL=sections.directive.js.map \ No newline at end of file diff --git a/src/app/submission/sections/sections.directive.js.map b/src/app/submission/sections/sections.directive.js.map new file mode 100644 index 0000000000..7fe4660110 --- /dev/null +++ b/src/app/submission/sections/sections.directive.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sections.directive.js","sourceRoot":"","sources":["sections.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AAGvF,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,sBAA4C,MAAM,iCAAiC,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;GAEG;AAKH;IA8DE;;;;;;OAMG;IACH,2BAAoB,iBAAoC,EACpC,iBAAoC,EACpC,cAA+B;QAF/B,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,mBAAc,GAAd,cAAc,CAAiB;QArEnD;;;WAGG;QACM,cAAS,GAAG,IAAI,CAAC;QAc1B;;;WAGG;QACI,yBAAoB,GAAa,EAAE,CAAC;QAE3C;;;WAGG;QACI,qBAAgB,GAAa,EAAE,CAAC;QAEvC;;;WAGG;QACK,WAAM,GAAG,IAAI,CAAC;QAQtB;;;WAGG;QACK,iBAAY,GAAG,IAAI,CAAC,SAAS,CAAC;QAEtC;;;WAGG;QACK,SAAI,GAAmB,EAAE,CAAC;IAkBlC,CAAC;IAED;;OAEG;IACH,oCAAQ,GAA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AC;SACpF;QACD,IAAI,CAAC,oBAAoB,GAAG,EAAE,CAAC;QAC/B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;IAE7B,CAAC;IAvQQ;QAAR,KAAK,EAAE;;wDAAkB;IAMjB;QAAR,KAAK,EAAE;;wDAAmB;IAMlB;QAAR,KAAK,EAAE;;2DAAsB;IAlBnB,iBAAiB;QAJ7B,SAAS,CAAC;YACT,QAAQ,EAAE,aAAa;YACvB,QAAQ,EAAE,YAAY;SACvB,CAAC;iDAsEuC,iBAAiB;YACjB,iBAAiB;YACpB,eAAe;OAvExC,iBAAiB,CA8Q7B;IAAD,wBAAC;CAAA,AA9QD,IA8QC;SA9QY,iBAAiB"} \ No newline at end of file diff --git a/src/app/submission/sections/sections.service.js b/src/app/submission/sections/sections.service.js new file mode 100644 index 0000000000..53c2a72c1f --- /dev/null +++ b/src/app/submission/sections/sections.service.js @@ -0,0 +1,309 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { combineLatest } from 'rxjs'; +import { distinctUntilChanged, filter, map, take } from 'rxjs/operators'; +import { Store } from '@ngrx/store'; +import { TranslateService } from '@ngx-translate/core'; +import { ScrollToService } from '@nicky-lenaers/ngx-scroll-to'; +import { isEqual } from 'lodash'; +import { hasValue, isEmpty, isNotEmpty, isNotUndefined } from '../../shared/empty.util'; +import { DisableSectionAction, EnableSectionAction, InertSectionErrorsAction, RemoveSectionErrorsAction, SectionStatusChangeAction, UpdateSectionDataAction } from '../objects/submission-objects.actions'; +import { submissionObjectFromIdSelector, submissionSectionDataFromIdSelector, submissionSectionErrorsFromIdSelector, submissionSectionFromIdSelector } from '../selectors'; +import { SubmissionScopeType } from '../../core/submission/submission-scope-type'; +import parseSectionErrorPaths from '../utils/parseSectionErrorPaths'; +import { FormAddError, FormClearErrorsAction, FormRemoveErrorAction } from '../../shared/form/form.actions'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { SubmissionService } from '../submission.service'; +/** + * A service that provides methods used in submission process. + */ +var SectionsService = /** @class */ (function () { + /** + * Initialize service variables + * @param {NotificationsService} notificationsService + * @param {ScrollToService} scrollToService + * @param {SubmissionService} submissionService + * @param {Store} store + * @param {TranslateService} translate + */ + function SectionsService(notificationsService, scrollToService, submissionService, store, translate) { + this.notificationsService = notificationsService; + this.scrollToService = scrollToService; + this.submissionService = submissionService; + this.store = store; + this.translate = translate; + } + /** + * Compare the list of the current section errors with the previous one, + * and dispatch actions to add/remove to/from the section state + * + * @param submissionId + * The submission id + * @param sectionId + * The workspaceitem self url + * @param formId + * The [SubmissionDefinitionsModel] that define submission configuration + * @param currentErrors + * The [SubmissionSectionError] that define submission sections init data + * @param prevErrors + * The [SubmissionSectionError] that define submission sections init errors + */ + SectionsService.prototype.checkSectionErrors = function (submissionId, sectionId, formId, currentErrors, prevErrors) { + var _this = this; + if (prevErrors === void 0) { prevErrors = []; } + // Remove previous error list if the current is empty + if (isEmpty(currentErrors)) { + this.store.dispatch(new RemoveSectionErrorsAction(submissionId, sectionId)); + this.store.dispatch(new FormClearErrorsAction(formId)); + } + else if (!isEqual(currentErrors, prevErrors)) { // compare previous error list with the current one + var dispatchedErrors_1 = []; + // Itereate over the current error list + currentErrors.forEach(function (error) { + var errorPaths = parseSectionErrorPaths(error.path); + errorPaths.forEach(function (path) { + if (path.fieldId) { + var fieldId = path.fieldId.replace(/\./g, '_'); + // Dispatch action to add form error to the state; + var formAddErrorAction = new FormAddError(formId, fieldId, path.fieldIndex, error.message); + _this.store.dispatch(formAddErrorAction); + dispatchedErrors_1.push(fieldId); + } + }); + }); + // Itereate over the previous error list + prevErrors.forEach(function (error) { + var errorPaths = parseSectionErrorPaths(error.path); + errorPaths.forEach(function (path) { + if (path.fieldId) { + var fieldId = path.fieldId.replace(/\./g, '_'); + if (!dispatchedErrors_1.includes(fieldId)) { + // Dispatch action to remove form error from the state; + var formRemoveErrorAction = new FormRemoveErrorAction(formId, fieldId, path.fieldIndex); + _this.store.dispatch(formRemoveErrorAction); + } + } + }); + }); + } + }; + /** + * Dispatch a new [RemoveSectionErrorsAction] + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + */ + SectionsService.prototype.dispatchRemoveSectionErrors = function (submissionId, sectionId) { + this.store.dispatch(new RemoveSectionErrorsAction(submissionId, sectionId)); + }; + /** + * Return the data object for the specified section + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @return Observable + * observable of [WorkspaceitemSectionDataType] + */ + SectionsService.prototype.getSectionData = function (submissionId, sectionId) { + return this.store.select(submissionSectionDataFromIdSelector(submissionId, sectionId)).pipe(distinctUntilChanged()); + }; + /** + * Return the error list object data for the specified section + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @return Observable + * observable of array of [SubmissionSectionError] + */ + SectionsService.prototype.getSectionErrors = function (submissionId, sectionId) { + return this.store.select(submissionSectionErrorsFromIdSelector(submissionId, sectionId)).pipe(distinctUntilChanged()); + }; + /** + * Return the state object for the specified section + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @return Observable + * observable of [SubmissionSectionObject] + */ + SectionsService.prototype.getSectionState = function (submissionId, sectionId) { + return this.store.select(submissionSectionFromIdSelector(submissionId, sectionId)).pipe(filter(function (sectionObj) { return hasValue(sectionObj); }), map(function (sectionObj) { return sectionObj; }), distinctUntilChanged()); + }; + /** + * Check if a given section is valid + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @return Observable + * Emits true whenever a given section should be valid + */ + SectionsService.prototype.isSectionValid = function (submissionId, sectionId) { + return this.store.select(submissionSectionFromIdSelector(submissionId, sectionId)).pipe(filter(function (sectionObj) { return hasValue(sectionObj); }), map(function (sectionObj) { return sectionObj.isValid; }), distinctUntilChanged()); + }; + /** + * Check if a given section is active + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @return Observable + * Emits true whenever a given section should be active + */ + SectionsService.prototype.isSectionActive = function (submissionId, sectionId) { + return this.submissionService.getActiveSectionId(submissionId).pipe(map(function (activeSectionId) { return sectionId === activeSectionId; }), distinctUntilChanged()); + }; + /** + * Check if a given section is enabled + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @return Observable + * Emits true whenever a given section should be enabled + */ + SectionsService.prototype.isSectionEnabled = function (submissionId, sectionId) { + return this.store.select(submissionSectionFromIdSelector(submissionId, sectionId)).pipe(filter(function (sectionObj) { return hasValue(sectionObj); }), map(function (sectionObj) { return sectionObj.enabled; }), distinctUntilChanged()); + }; + /** + * Check if a given section is a read only section + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @param submissionScope + * The submission scope + * @return Observable + * Emits true whenever a given section should be read only + */ + SectionsService.prototype.isSectionReadOnly = function (submissionId, sectionId, submissionScope) { + return this.store.select(submissionSectionFromIdSelector(submissionId, sectionId)).pipe(filter(function (sectionObj) { return hasValue(sectionObj); }), map(function (sectionObj) { + return isNotEmpty(sectionObj.visibility) + && sectionObj.visibility.other === 'READONLY' + && submissionScope !== SubmissionScopeType.WorkspaceItem; + }), distinctUntilChanged()); + }; + /** + * Check if a given section is a read only available + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @return Observable + * Emits true whenever a given section should be available + */ + SectionsService.prototype.isSectionAvailable = function (submissionId, sectionId) { + return this.store.select(submissionObjectFromIdSelector(submissionId)).pipe(filter(function (submissionState) { return isNotUndefined(submissionState); }), map(function (submissionState) { + return isNotUndefined(submissionState.sections) && isNotUndefined(submissionState.sections[sectionId]); + }), distinctUntilChanged()); + }; + /** + * Dispatch a new [EnableSectionAction] to add a new section and move page target to it + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + */ + SectionsService.prototype.addSection = function (submissionId, sectionId) { + this.store.dispatch(new EnableSectionAction(submissionId, sectionId)); + var config = { + target: sectionId, + offset: -70 + }; + this.scrollToService.scrollTo(config); + }; + /** + * Dispatch a new [DisableSectionAction] to remove section + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + */ + SectionsService.prototype.removeSection = function (submissionId, sectionId) { + this.store.dispatch(new DisableSectionAction(submissionId, sectionId)); + }; + /** + * Dispatch a new [UpdateSectionDataAction] to update section state with new data and errors + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @param data + * The section data + * @param errors + * The list of section errors + */ + SectionsService.prototype.updateSectionData = function (submissionId, sectionId, data, errors) { + var _this = this; + if (errors === void 0) { errors = []; } + if (isNotEmpty(data)) { + var isAvailable$ = this.isSectionAvailable(submissionId, sectionId); + var isEnabled$ = this.isSectionEnabled(submissionId, sectionId); + combineLatest(isAvailable$, isEnabled$).pipe(take(1), filter(function (_a) { + var available = _a[0], enabled = _a[1]; + return available; + })) + .subscribe(function (_a) { + var available = _a[0], enabled = _a[1]; + if (!enabled) { + var msg = _this.translate.instant('submission.sections.general.metadata-extracted-new-section', { sectionId: sectionId }); + _this.notificationsService.info(null, msg, null, true); + } + _this.store.dispatch(new UpdateSectionDataAction(submissionId, sectionId, data, errors)); + }); + } + }; + /** + * Dispatch a new [InertSectionErrorsAction] to update section state with new error + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @param error + * The section error + */ + SectionsService.prototype.setSectionError = function (submissionId, sectionId, error) { + this.store.dispatch(new InertSectionErrorsAction(submissionId, sectionId, error)); + }; + /** + * Dispatch a new [SectionStatusChangeAction] to update section state with new status + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @param status + * The section status + */ + SectionsService.prototype.setSectionStatus = function (submissionId, sectionId, status) { + this.store.dispatch(new SectionStatusChangeAction(submissionId, sectionId, status)); + }; + SectionsService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [NotificationsService, + ScrollToService, + SubmissionService, + Store, + TranslateService]) + ], SectionsService); + return SectionsService; +}()); +export { SectionsService }; +//# sourceMappingURL=sections.service.js.map \ No newline at end of file diff --git a/src/app/submission/sections/sections.service.js.map b/src/app/submission/sections/sections.service.js.map new file mode 100644 index 0000000000..1393518efb --- /dev/null +++ b/src/app/submission/sections/sections.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sections.service.js","sourceRoot":"","sources":["sections.service.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AE,IAAI,EAAE,IAAI,CAAC,CAAC;iBACvD;gBACD,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,uBAAuB,CAAC,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;YAC1F,CAAC,CAAC,CAAC;SACN;IACH,CAAC;IAED;;;;;;;;;OASG;IACI,yCAAe,GAAtB,UAAuB,YAAoB,EAAE,SAAiB,EAAE,KAA6B;QAC3F,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,wBAAwB,CAAC,YAAY,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;;;OASG;IACI,0CAAgB,GAAvB,UAAwB,YAAoB,EAAE,SAAiB,EAAE,MAAe;QAC9E,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,yBAAyB,CAAC,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACtF,CAAC;IA7TU,eAAe;QAD3B,UAAU,EAAE;iDAW+B,oBAAoB;YACzB,eAAe;YACb,iBAAiB;YAC7B,KAAK;YACD,gBAAgB;OAdpC,eAAe,CA8T3B;IAAD,sBAAC;CAAA,AA9TD,IA8TC;SA9TY,eAAe"} \ No newline at end of file diff --git a/src/app/submission/sections/upload/accessConditions/submission-section-upload-access-conditions.component.js b/src/app/submission/sections/upload/accessConditions/submission-section-upload-access-conditions.component.js new file mode 100644 index 0000000000..d0228caf1f --- /dev/null +++ b/src/app/submission/sections/upload/accessConditions/submission-section-upload-access-conditions.component.js @@ -0,0 +1,57 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { find } from 'rxjs/operators'; +import { GroupEpersonService } from '../../../../core/eperson/group-eperson.service'; +import { isEmpty } from '../../../../shared/empty.util'; +/** + * This component represents a badge that describe an access condition + */ +var SubmissionSectionUploadAccessConditionsComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {GroupEpersonService} groupService + */ + function SubmissionSectionUploadAccessConditionsComponent(groupService) { + this.groupService = groupService; + /** + * The list of access conditions + * @type {Array} + */ + this.accessConditionsList = []; + } + /** + * Retrieve access conditions list + */ + SubmissionSectionUploadAccessConditionsComponent.prototype.ngOnInit = function () { + var _this = this; + this.accessConditions.forEach(function (accessCondition) { + if (isEmpty(accessCondition.name)) { + _this.groupService.findById(accessCondition.groupUUID).pipe(find(function (rd) { return !rd.isResponsePending && rd.hasSucceeded; })) + .subscribe(function (rd) { + var group = rd.payload; + var accessConditionEntry = Object.assign({}, accessCondition); + accessConditionEntry.name = group.name; + _this.accessConditionsList.push(accessConditionEntry); + }); + } + else { + _this.accessConditionsList.push(accessCondition); + } + }); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], SubmissionSectionUploadAccessConditionsComponent.prototype, "accessConditions", void 0); + SubmissionSectionUploadAccessConditionsComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-section-upload-access-conditions', + templateUrl: './submission-section-upload-access-conditions.component.html', + }), + tslib_1.__metadata("design:paramtypes", [GroupEpersonService]) + ], SubmissionSectionUploadAccessConditionsComponent); + return SubmissionSectionUploadAccessConditionsComponent; +}()); +export { SubmissionSectionUploadAccessConditionsComponent }; +//# sourceMappingURL=submission-section-upload-access-conditions.component.js.map \ No newline at end of file diff --git a/src/app/submission/sections/upload/accessConditions/submission-section-upload-access-conditions.component.js.map b/src/app/submission/sections/upload/accessConditions/submission-section-upload-access-conditions.component.js.map new file mode 100644 index 0000000000..09d1d8ee63 --- /dev/null +++ b/src/app/submission/sections/upload/accessConditions/submission-section-upload-access-conditions.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-section-upload-access-conditions.component.js","sourceRoot":"","sources":["submission-section-upload-access-conditions.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC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AD,uDAAC;CAAA,AAxCD,IAwCC;SAxCY,gDAAgD"} \ No newline at end of file diff --git a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.js b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.js new file mode 100644 index 0000000000..3c4237efe9 --- /dev/null +++ b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.js @@ -0,0 +1,287 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, Input, ViewChild } from '@angular/core'; +import { DYNAMIC_FORM_CONTROL_TYPE_DATEPICKER, DynamicDatePickerModel, DynamicFormArrayModel, DynamicFormGroupModel, DynamicSelectModel } from '@ng-dynamic-forms/core'; +import { WorkspaceitemSectionUploadFileObject } from '../../../../../core/submission/models/workspaceitem-section-upload-file.model'; +import { FormBuilderService } from '../../../../../shared/form/builder/form-builder.service'; +import { BITSTREAM_ACCESS_CONDITIONS_FORM_ARRAY_CONFIG, BITSTREAM_ACCESS_CONDITIONS_FORM_ARRAY_LAYOUT, BITSTREAM_FORM_ACCESS_CONDITION_END_DATE_CONFIG, BITSTREAM_FORM_ACCESS_CONDITION_END_DATE_LAYOUT, BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_CONFIG, BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_LAYOUT, BITSTREAM_FORM_ACCESS_CONDITION_START_DATE_CONFIG, BITSTREAM_FORM_ACCESS_CONDITION_START_DATE_LAYOUT, BITSTREAM_FORM_ACCESS_CONDITION_TYPE_CONFIG, BITSTREAM_FORM_ACCESS_CONDITION_TYPE_LAYOUT, BITSTREAM_METADATA_FORM_GROUP_CONFIG, BITSTREAM_METADATA_FORM_GROUP_LAYOUT } from './section-upload-file-edit.model'; +import { POLICY_DEFAULT_WITH_LIST } from '../../section-upload.component'; +import { isNotEmpty, isNotUndefined } from '../../../../../shared/empty.util'; +import { SubmissionFormsModel } from '../../../../../core/config/models/config-submission-forms.model'; +import { SubmissionService } from '../../../../submission.service'; +import { FormService } from '../../../../../shared/form/form.service'; +import { FormComponent } from '../../../../../shared/form/form.component'; +/** + * This component represents the edit form for bitstream + */ +var SubmissionSectionUploadFileEditComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {ChangeDetectorRef} cdr + * @param {FormBuilderService} formBuilderService + * @param {FormService} formService + * @param {SubmissionService} submissionService + */ + function SubmissionSectionUploadFileEditComponent(cdr, formBuilderService, formService, submissionService) { + this.cdr = cdr; + this.formBuilderService = formBuilderService; + this.formService = formService; + this.submissionService = submissionService; + } + /** + * Dispatch form model init + */ + SubmissionSectionUploadFileEditComponent.prototype.ngOnChanges = function () { + if (this.fileData && this.formId) { + this.formModel = this.buildFileEditForm(); + this.cdr.detectChanges(); + } + }; + /** + * Initialize form model + */ + SubmissionSectionUploadFileEditComponent.prototype.buildFileEditForm = function () { + var configDescr = Object.assign({}, this.configMetadataForm.rows[0].fields[0]); + configDescr.repeatable = false; + var configForm = Object.assign({}, this.configMetadataForm, { + fields: Object.assign([], this.configMetadataForm.rows[0].fields[0], [ + this.configMetadataForm.rows[0].fields[0], + configDescr + ]) + }); + var formModel = []; + var metadataGroupModelConfig = Object.assign({}, BITSTREAM_METADATA_FORM_GROUP_CONFIG); + metadataGroupModelConfig.group = this.formBuilderService.modelFromConfiguration(configForm, this.collectionId, this.fileData.metadata, this.submissionService.getSubmissionScope()); + formModel.push(new DynamicFormGroupModel(metadataGroupModelConfig, BITSTREAM_METADATA_FORM_GROUP_LAYOUT)); + var accessConditionTypeModelConfig = Object.assign({}, BITSTREAM_FORM_ACCESS_CONDITION_TYPE_CONFIG); + var accessConditionsArrayConfig = Object.assign({}, BITSTREAM_ACCESS_CONDITIONS_FORM_ARRAY_CONFIG); + var accessConditionTypeOptions = []; + if (this.collectionPolicyType === POLICY_DEFAULT_WITH_LIST) { + for (var _i = 0, _a = this.availableAccessConditionOptions; _i < _a.length; _i++) { + var accessCondition = _a[_i]; + accessConditionTypeOptions.push({ + label: accessCondition.name, + value: accessCondition.name + }); + } + accessConditionTypeModelConfig.options = accessConditionTypeOptions; + // Dynamically assign of relation in config. For startdate, endDate, groups. + var hasStart_1 = []; + var hasEnd_1 = []; + var hasGroups_1 = []; + this.availableAccessConditionOptions.forEach(function (condition) { + var showStart = condition.hasStartDate === true; + var showEnd = condition.hasEndDate === true; + var showGroups = showStart || showEnd; + if (showStart) { + hasStart_1.push({ id: 'name', value: condition.name }); + } + if (showEnd) { + hasEnd_1.push({ id: 'name', value: condition.name }); + } + if (showGroups) { + hasGroups_1.push({ id: 'name', value: condition.name }); + } + }); + var confStart_1 = { relation: [{ action: 'ENABLE', connective: 'OR', when: hasStart_1 }] }; + var confEnd_1 = { relation: [{ action: 'ENABLE', connective: 'OR', when: hasEnd_1 }] }; + var confGroup_1 = { relation: [{ action: 'ENABLE', connective: 'OR', when: hasGroups_1 }] }; + accessConditionsArrayConfig.groupFactory = function () { + var type = new DynamicSelectModel(accessConditionTypeModelConfig, BITSTREAM_FORM_ACCESS_CONDITION_TYPE_LAYOUT); + var startDateConfig = Object.assign({}, BITSTREAM_FORM_ACCESS_CONDITION_START_DATE_CONFIG, confStart_1); + var endDateConfig = Object.assign({}, BITSTREAM_FORM_ACCESS_CONDITION_END_DATE_CONFIG, confEnd_1); + var groupsConfig = Object.assign({}, BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_CONFIG, confGroup_1); + var startDate = new DynamicDatePickerModel(startDateConfig, BITSTREAM_FORM_ACCESS_CONDITION_START_DATE_LAYOUT); + var endDate = new DynamicDatePickerModel(endDateConfig, BITSTREAM_FORM_ACCESS_CONDITION_END_DATE_LAYOUT); + var groups = new DynamicSelectModel(groupsConfig, BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_LAYOUT); + return [type, startDate, endDate, groups]; + }; + // Number of access conditions blocks in form + accessConditionsArrayConfig.initialCount = isNotEmpty(this.fileData.accessConditions) ? this.fileData.accessConditions.length : 1; + formModel.push(new DynamicFormArrayModel(accessConditionsArrayConfig, BITSTREAM_ACCESS_CONDITIONS_FORM_ARRAY_LAYOUT)); + } + this.initModelData(formModel); + return formModel; + }; + /** + * Initialize form model values + * + * @param formModel + * The form model + */ + SubmissionSectionUploadFileEditComponent.prototype.initModelData = function (formModel) { + var _this = this; + this.fileData.accessConditions.forEach(function (accessCondition, index) { + Array.of('name', 'groupUUID', 'startDate', 'endDate') + .filter(function (key) { return accessCondition.hasOwnProperty(key); }) + .forEach(function (key) { + var metadataModel = _this.formBuilderService.findById(key, formModel, index); + if (metadataModel) { + if (key === 'groupUUID' && _this.availableAccessConditionGroups.get(accessCondition.name)) { + _this.availableAccessConditionGroups.get(accessCondition.name).forEach(function (group) { + metadataModel.options.push({ + label: group.name, + value: group.uuid + }); + }); + } + if (metadataModel.type === DYNAMIC_FORM_CONTROL_TYPE_DATEPICKER) { + var date = new Date(accessCondition[key]); + metadataModel.value = { + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate() + }; + } + else { + metadataModel.value = accessCondition[key]; + } + } + }); + }); + }; + /** + * Dispatch form model update when changing an access condition + * + * @param event + * The event emitted + */ + SubmissionSectionUploadFileEditComponent.prototype.onChange = function (event) { + if (event.model.id === 'name') { + this.setOptions(event.model, event.control); + } + }; + /** + * Update `startDate`, 'groupUUID' and 'endDate' model + * + * @param model + * The [[DynamicFormControlModel]] object + * @param control + * The [[FormControl]] object + */ + SubmissionSectionUploadFileEditComponent.prototype.setOptions = function (model, control) { + var accessCondition = null; + this.availableAccessConditionOptions.filter(function (element) { return element.name === control.value; }) + .forEach(function (element) { return accessCondition = element; }); + if (isNotEmpty(accessCondition)) { + var showGroups = accessCondition.hasStartDate === true || accessCondition.hasEndDate === true; + var groupControl = control.parent.get('groupUUID'); + var startDateControl = control.parent.get('startDate'); + var endDateControl = control.parent.get('endDate'); + // Clear previous state + groupControl.markAsUntouched(); + startDateControl.markAsUntouched(); + endDateControl.markAsUntouched(); + // Clear previous values + if (showGroups) { + groupControl.setValue(null); + } + else { + groupControl.clearValidators(); + groupControl.setValue(accessCondition.groupUUID); + } + startDateControl.setValue(null); + control.parent.markAsDirty(); + endDateControl.setValue(null); + if (showGroups) { + if (isNotUndefined(accessCondition.groupUUID) || isNotUndefined(accessCondition.selectGroupUUID)) { + var groupOptions_1 = []; + if (isNotUndefined(this.availableAccessConditionGroups.get(accessCondition.name))) { + var groupModel = this.formBuilderService.findById('groupUUID', model.parent.group); + this.availableAccessConditionGroups.get(accessCondition.name).forEach(function (group) { + groupOptions_1.push({ + label: group.name, + value: group.uuid + }); + }); + // Due to a bug can't dynamically change the select options, so replace the model with a new one + var confGroup = { relation: groupModel.relation }; + var groupsConfig = Object.assign({}, BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_CONFIG, confGroup); + groupsConfig.options = groupOptions_1; + model.parent.group.pop(); + model.parent.group.push(new DynamicSelectModel(groupsConfig, BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_LAYOUT)); + } + } + if (accessCondition.hasStartDate) { + var startDateModel = this.formBuilderService.findById('startDate', model.parent.group); + var min = new Date(accessCondition.maxStartDate); + startDateModel.max = { + year: min.getFullYear(), + month: min.getMonth() + 1, + day: min.getDate() + }; + } + if (accessCondition.hasEndDate) { + var endDateModel = this.formBuilderService.findById('endDate', model.parent.group); + var max = new Date(accessCondition.maxEndDate); + endDateModel.max = { + year: max.getFullYear(), + month: max.getMonth() + 1, + day: max.getDate() + }; + } + } + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], SubmissionSectionUploadFileEditComponent.prototype, "availableAccessConditionOptions", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Map) + ], SubmissionSectionUploadFileEditComponent.prototype, "availableAccessConditionGroups", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionUploadFileEditComponent.prototype, "collectionId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Number) + ], SubmissionSectionUploadFileEditComponent.prototype, "collectionPolicyType", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SubmissionFormsModel) + ], SubmissionSectionUploadFileEditComponent.prototype, "configMetadataForm", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", WorkspaceitemSectionUploadFileObject) + ], SubmissionSectionUploadFileEditComponent.prototype, "fileData", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionUploadFileEditComponent.prototype, "fileId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionUploadFileEditComponent.prototype, "fileIndex", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionUploadFileEditComponent.prototype, "formId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionUploadFileEditComponent.prototype, "sectionId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionUploadFileEditComponent.prototype, "submissionId", void 0); + tslib_1.__decorate([ + ViewChild('formRef'), + tslib_1.__metadata("design:type", FormComponent) + ], SubmissionSectionUploadFileEditComponent.prototype, "formRef", void 0); + SubmissionSectionUploadFileEditComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-section-upload-file-edit', + templateUrl: './section-upload-file-edit.component.html', + }), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef, + FormBuilderService, + FormService, + SubmissionService]) + ], SubmissionSectionUploadFileEditComponent); + return SubmissionSectionUploadFileEditComponent; +}()); +export { SubmissionSectionUploadFileEditComponent }; +//# sourceMappingURL=section-upload-file-edit.component.js.map \ No newline at end of file diff --git a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.js.map b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.js.map new file mode 100644 index 0000000000..c72f7a44cd --- /dev/null +++ b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section-upload-file-edit.component.js","s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,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE;qBACnB,CAAC;iBACH;aACF;SACF;IACH,CAAC;IA3TQ;QAAR,KAAK,EAAE;;qGAAwC;IAMvC;QAAR,KAAK,EAAE;0CAAiC,GAAG;oGAAkB;IAMrD;QAAR,KAAK,EAAE;;kFAAsB;IAQrB;QAAR,KAAK,EAAE;;0FAA8B;IAM7B;QAAR,KAAK,EAAE;0CAAqB,oBAAoB;wFAAC;IAMzC;QAAR,KAAK,EAAE;0CAAW,oCAAoC;8EAAC;IAM/C;QAAR,KAAK,EAAE;;4EAAgB;IAMf;QAAR,KAAK,EAAE;;+EAAmB;IAMlB;QAAR,KAAK,EAAE;;4EAAgB;IAMf;QAAR,KAAK,EAAE;;+EAAmB;IAMlB;QAAR,KAAK,EAAE;;kFAAsB;IAWR;QAArB,SAAS,CAAC,SAAS,CAAC;0CAAiB,aAAa;6EAAC;IA/EzC,wCAAwC;QAJpD,SAAS,CAAC;YACT,QAAQ,EAAE,wCAAwC;YAClD,WAAW,EAAE,2CAA2C;SACzD,CAAC;iDA0FyB,iBAAiB;YACF,kBAAkB;YACzB,WAAW;YACL,iBAAiB;OA5F7C,wCAAwC,CAmUpD;IAAD,+CAAC;CAAA,AAnUD,IAmUC;SAnUY,wCAAwC"} \ No newline at end of file diff --git a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.model.js b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.model.js new file mode 100644 index 0000000000..e980ef7ab0 --- /dev/null +++ b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.model.js @@ -0,0 +1,125 @@ +export var BITSTREAM_METADATA_FORM_GROUP_CONFIG = { + id: 'metadata', + group: [] +}; +export var BITSTREAM_METADATA_FORM_GROUP_LAYOUT = { + element: { + container: 'form-group', + label: 'col-form-label' + }, + grid: { + label: 'col-sm-3' + } +}; +export var BITSTREAM_ACCESS_CONDITIONS_FORM_ARRAY_CONFIG = { + id: 'accessConditions', + groupFactory: null, +}; +export var BITSTREAM_ACCESS_CONDITIONS_FORM_ARRAY_LAYOUT = { + grid: { + group: 'form-row' + } +}; +export var BITSTREAM_FORM_ACCESS_CONDITION_TYPE_CONFIG = { + id: 'name', + label: 'submission.sections.upload.form.access-condition-label', + options: [] +}; +export var BITSTREAM_FORM_ACCESS_CONDITION_TYPE_LAYOUT = { + element: { + container: 'p-0', + label: 'col-form-label' + }, + grid: { + host: 'col-md-10' + } +}; +export var BITSTREAM_FORM_ACCESS_CONDITION_START_DATE_CONFIG = { + id: 'startDate', + label: 'submission.sections.upload.form.from-label', + placeholder: 'submission.sections.upload.form.from-placeholder', + inline: false, + toggleIcon: 'far fa-calendar-alt', + relation: [ + { + action: 'ENABLE', + connective: 'OR', + when: [] + } + ], + required: true, + validators: { + required: null + }, + errorMessages: { + required: 'submission.sections.upload.form.date-required' + } +}; +export var BITSTREAM_FORM_ACCESS_CONDITION_START_DATE_LAYOUT = { + element: { + container: 'p-0', + label: 'col-form-label' + }, + grid: { + host: 'col-md-4' + } +}; +export var BITSTREAM_FORM_ACCESS_CONDITION_END_DATE_CONFIG = { + id: 'endDate', + label: 'submission.sections.upload.form.until-label', + placeholder: 'submission.sections.upload.form.until-placeholder', + inline: false, + toggleIcon: 'far fa-calendar-alt', + relation: [ + { + action: 'ENABLE', + connective: 'OR', + when: [] + } + ], + required: true, + validators: { + required: null + }, + errorMessages: { + required: 'submission.sections.upload.form.date-required' + } +}; +export var BITSTREAM_FORM_ACCESS_CONDITION_END_DATE_LAYOUT = { + element: { + container: 'p-0', + label: 'col-form-label' + }, + grid: { + host: 'col-md-4' + } +}; +export var BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_CONFIG = { + id: 'groupUUID', + label: 'submission.sections.upload.form.group-label', + options: [], + relation: [ + { + action: 'ENABLE', + connective: 'OR', + when: [] + } + ], + required: true, + validators: { + required: null + }, + errorMessages: { + required: 'submission.sections.upload.form.group-required' + } +}; +export var BITSTREAM_FORM_ACCESS_CONDITION_GROUPS_LAYOUT = { + element: { + container: 'p-0', + label: 'col-form-label' + }, + grid: { + host: 'col-sm-10' + } +}; +//# sourceMappingURL=section-upload-file-edit.model.js.map \ No newline at end of file diff --git a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.model.js.map b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.model.js.map new file mode 100644 index 0000000000..0cc39f354a --- /dev/null +++ b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section-upload-file-edit.model.js","sourceRoot":"","sources":["section-upload-file-edit.model.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,IAAM,oCAAoC,GAAgC;IAC/E,EAAE,EAAE,UAAU;IACd,KAAK,EAAE,EAAE;CACV,CAAC;AACF,MAAM,CAAC,IAAM,oCAAoC,GAA6B;IAC5E,OAAO,EAAE;QACP,SAAS,EAAE,YAAY;QACrB,KAAK,EAAE,gBAAgB;KAC1B;IACD,IAAI,EAAE;QACF,KAAK,EAAE,UAAU;KACpB;CACF,CAAC;AAEF,MAAM,CAAC,IAAM,6CAA6C,GAAgC;IACxF,EAAE,EAAE,kBAAkB;IACtB,YAAY,EAAE,IAAI;CACnB,CAAC;AACF,MAAM,CAAC,IAAM,6CAA6C,GAA6B;IACrF,IAAI,EAAE;QACJ,KAAK,EAAE,UAAU;KAClB;CACF,CAAC;AAEF,MAAM,CAAC,IAAM,2CAA2C,GAAkC;IACxF,EAAE,EAAE,MAAM;IACV,KAAK,EAAE,wDAAwD;IAC/D,OAAO,EAAE,EAAE;CACZ,CAAC;AACF,MAAM,CAAC,IAAM,2CAA2C,GAA6B;IACnF,OAAO,EAAE;QACP,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,gBAAgB;KACxB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;KAClB;CACF,CAAC;AAEF,MAAM,CAAC,IAAM,iDAAiD,GAAiC;IAC7F,EAAE,EAAE,WAAW;IACf,KAAK,EAAE,4CAA4C;IACnD,WAAW,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ChB,IAAI,EAAE,EAAE;SACT;KACF;IACD,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,IAAI;KACf;IACD,aAAa,EAAE;QACb,QAAQ,EAAE,gDAAgD;KAC3D;CACF,CAAC;AACF,MAAM,CAAC,IAAM,6CAA6C,GAA6B;IACrF,OAAO,EAAE;QACP,SAAS,EAAE,KAAK;QACd,KAAK,EAAE,gBAAgB;KAC1B;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;KAClB;CACF,CAAC"} \ No newline at end of file diff --git a/src/app/submission/sections/upload/file/section-upload-file.component.js b/src/app/submission/sections/upload/file/section-upload-file.component.js new file mode 100644 index 0000000000..c5e68506ae --- /dev/null +++ b/src/app/submission/sections/upload/file/section-upload-file.component.js @@ -0,0 +1,260 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, Input, ViewChild } from '@angular/core'; +import { BehaviorSubject } from 'rxjs'; +import { filter, first, flatMap, take } from 'rxjs/operators'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { SectionUploadService } from '../section-upload.service'; +import { isNotEmpty, isNotNull, isNotUndefined } from '../../../../shared/empty.util'; +import { FormService } from '../../../../shared/form/form.service'; +import { JsonPatchOperationsBuilder } from '../../../../core/json-patch/builder/json-patch-operations-builder'; +import { JsonPatchOperationPathCombiner } from '../../../../core/json-patch/builder/json-patch-operation-path-combiner'; +import { SubmissionFormsModel } from '../../../../core/config/models/config-submission-forms.model'; +import { deleteProperty } from '../../../../shared/object.util'; +import { dateToISOFormat } from '../../../../shared/date.util'; +import { SubmissionService } from '../../../submission.service'; +import { FileService } from '../../../../core/shared/file.service'; +import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service'; +import { SubmissionJsonPatchOperationsService } from '../../../../core/submission/submission-json-patch-operations.service'; +import { SubmissionSectionUploadFileEditComponent } from './edit/section-upload-file-edit.component'; +/** + * This component represents a single bitstream contained in the submission + */ +var SubmissionSectionUploadFileComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {ChangeDetectorRef} cdr + * @param {FileService} fileService + * @param {FormService} formService + * @param {HALEndpointService} halService + * @param {NgbModal} modalService + * @param {JsonPatchOperationsBuilder} operationsBuilder + * @param {SubmissionJsonPatchOperationsService} operationsService + * @param {SubmissionService} submissionService + * @param {SectionUploadService} uploadService + */ + function SubmissionSectionUploadFileComponent(cdr, fileService, formService, halService, modalService, operationsBuilder, operationsService, submissionService, uploadService) { + this.cdr = cdr; + this.fileService = fileService; + this.formService = formService; + this.halService = halService; + this.modalService = modalService; + this.operationsBuilder = operationsBuilder; + this.operationsService = operationsService; + this.submissionService = submissionService; + this.uploadService = uploadService; + /** + * A boolean representing if a submission delete operation is pending + * @type {BehaviorSubject} + */ + this.processingDelete$ = new BehaviorSubject(false); + /** + * Array to track all subscriptions and unsubscribe them onDestroy + * @type {Array} + */ + this.subscriptions = []; + this.readMode = true; + } + /** + * Retrieve bitstream's metadata + */ + SubmissionSectionUploadFileComponent.prototype.ngOnChanges = function () { + var _this = this; + if (this.availableAccessConditionOptions && this.availableAccessConditionGroups) { + // Retrieve file state + this.subscriptions.push(this.uploadService + .getFileData(this.submissionId, this.sectionId, this.fileId).pipe(filter(function (bitstream) { return isNotUndefined(bitstream); })) + .subscribe(function (bitstream) { + _this.fileData = bitstream; + })); + } + }; + /** + * Initialize instance variables + */ + SubmissionSectionUploadFileComponent.prototype.ngOnInit = function () { + this.formId = this.formService.getUniqueId(this.fileId); + this.pathCombiner = new JsonPatchOperationPathCombiner('sections', this.sectionId, 'files', this.fileIndex); + }; + /** + * Delete bitstream from submission + */ + SubmissionSectionUploadFileComponent.prototype.deleteFile = function () { + var _this = this; + this.operationsBuilder.remove(this.pathCombiner.getPath()); + this.subscriptions.push(this.operationsService.jsonPatchByResourceID(this.submissionService.getSubmissionObjectLinkName(), this.submissionId, this.pathCombiner.rootElement, this.pathCombiner.subRootElement) + .subscribe(function () { + _this.uploadService.removeUploadedFile(_this.submissionId, _this.sectionId, _this.fileId); + _this.processingDelete$.next(false); + })); + }; + /** + * Show confirmation dialog for delete + */ + SubmissionSectionUploadFileComponent.prototype.confirmDelete = function (content) { + var _this = this; + this.modalService.open(content).result.then(function (result) { + if (result === 'ok') { + _this.processingDelete$.next(true); + _this.deleteFile(); + } + }); + }; + /** + * Perform bitstream download + */ + SubmissionSectionUploadFileComponent.prototype.downloadBitstreamFile = function () { + var _this = this; + this.halService.getEndpoint('bitstreams').pipe(first()) + .subscribe(function (url) { + var fileUrl = url + "/" + _this.fileData.uuid + "/content"; + _this.fileService.downloadFile(fileUrl); + }); + }; + /** + * Save bitstream metadata + * + * @param event + * the click event emitted + */ + SubmissionSectionUploadFileComponent.prototype.saveBitstreamData = function (event) { + var _this = this; + event.preventDefault(); + // validate form + this.formService.validateAllFormFields(this.fileEditComp.formRef.formGroup); + this.subscriptions.push(this.formService.isValid(this.formId).pipe(take(1), filter(function (isValid) { return isValid; }), flatMap(function () { return _this.formService.getFormData(_this.formId); }), take(1), flatMap(function (formData) { + // collect bitstream metadata + Object.keys((formData.metadata)) + .filter(function (key) { return isNotEmpty(formData.metadata[key]); }) + .forEach(function (key) { + var metadataKey = key.replace(/_/g, '.'); + var path = "metadata/" + metadataKey; + _this.operationsBuilder.add(_this.pathCombiner.getPath(path), formData.metadata[key], true); + }); + var accessConditionsToSave = []; + formData.accessConditions + .filter(function (accessCondition) { return isNotEmpty(accessCondition); }) + .forEach(function (accessCondition) { + var accessConditionOpt; + _this.availableAccessConditionOptions + .filter(function (element) { return isNotNull(accessCondition.name) && element.name === accessCondition.name[0].value; }) + .forEach(function (element) { return accessConditionOpt = element; }); + if (accessConditionOpt) { + if (accessConditionOpt.hasStartDate !== true && accessConditionOpt.hasEndDate !== true) { + accessConditionOpt = deleteProperty(accessConditionOpt, 'hasStartDate'); + accessConditionOpt = deleteProperty(accessConditionOpt, 'hasEndDate'); + accessConditionsToSave.push(accessConditionOpt); + } + else { + accessConditionOpt = Object.assign({}, accessCondition); + accessConditionOpt.name = _this.retrieveValueFromField(accessCondition.name); + accessConditionOpt.groupUUID = _this.retrieveValueFromField(accessCondition.groupUUID); + if (accessCondition.startDate) { + var startDate = _this.retrieveValueFromField(accessCondition.startDate); + accessConditionOpt.startDate = dateToISOFormat(startDate); + accessConditionOpt = deleteProperty(accessConditionOpt, 'endDate'); + } + if (accessCondition.endDate) { + var endDate = _this.retrieveValueFromField(accessCondition.endDate); + accessConditionOpt.endDate = dateToISOFormat(endDate); + accessConditionOpt = deleteProperty(accessConditionOpt, 'startDate'); + } + accessConditionsToSave.push(accessConditionOpt); + } + } + }); + if (isNotEmpty(accessConditionsToSave)) { + _this.operationsBuilder.add(_this.pathCombiner.getPath('accessConditions'), accessConditionsToSave, true); + } + // dispatch a PATCH request to save metadata + return _this.operationsService.jsonPatchByResourceID(_this.submissionService.getSubmissionObjectLinkName(), _this.submissionId, _this.pathCombiner.rootElement, _this.pathCombiner.subRootElement); + })).subscribe(function (result) { + if (result[0].sections.upload) { + Object.keys(result[0].sections.upload.files) + .filter(function (key) { return result[0].sections.upload.files[key].uuid === _this.fileId; }) + .forEach(function (key) { return _this.uploadService.updateFileData(_this.submissionId, _this.sectionId, _this.fileId, result[0].sections.upload.files[key]); }); + } + _this.switchMode(); + })); + }; + /** + * Retrieve field value + * + * @param field + * the specified field object + */ + SubmissionSectionUploadFileComponent.prototype.retrieveValueFromField = function (field) { + var temp = Array.isArray(field) ? field[0] : field; + return (temp) ? temp.value : undefined; + }; + /** + * Switch from edit form to metadata view + */ + SubmissionSectionUploadFileComponent.prototype.switchMode = function () { + this.readMode = !this.readMode; + this.cdr.detectChanges(); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Array) + ], SubmissionSectionUploadFileComponent.prototype, "availableAccessConditionOptions", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Map) + ], SubmissionSectionUploadFileComponent.prototype, "availableAccessConditionGroups", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionUploadFileComponent.prototype, "collectionId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Number) + ], SubmissionSectionUploadFileComponent.prototype, "collectionPolicyType", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", SubmissionFormsModel) + ], SubmissionSectionUploadFileComponent.prototype, "configMetadataForm", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionUploadFileComponent.prototype, "fileId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionUploadFileComponent.prototype, "fileIndex", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionUploadFileComponent.prototype, "fileName", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionUploadFileComponent.prototype, "sectionId", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", String) + ], SubmissionSectionUploadFileComponent.prototype, "submissionId", void 0); + tslib_1.__decorate([ + ViewChild(SubmissionSectionUploadFileEditComponent), + tslib_1.__metadata("design:type", SubmissionSectionUploadFileEditComponent) + ], SubmissionSectionUploadFileComponent.prototype, "fileEditComp", void 0); + SubmissionSectionUploadFileComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-upload-section-file', + styleUrls: ['./section-upload-file.component.scss'], + templateUrl: './section-upload-file.component.html', + }), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef, + FileService, + FormService, + HALEndpointService, + NgbModal, + JsonPatchOperationsBuilder, + SubmissionJsonPatchOperationsService, + SubmissionService, + SectionUploadService]) + ], SubmissionSectionUploadFileComponent); + return SubmissionSectionUploadFileComponent; +}()); +export { SubmissionSectionUploadFileComponent }; +//# sourceMappingURL=section-upload-file.component.js.map \ No newline at end of file diff --git a/src/app/submission/sections/upload/file/section-upload-file.component.js.map b/src/app/submission/sections/upload/file/section-upload-file.component.js.map new file mode 100644 index 0000000000..a45af6fbd2 --- /dev/null +++ b/src/app/submission/sections/upload/file/section-upload-file.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section-upload-file.component.js","sourceRoot":"","sources":["section-upload-file.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,EAAqB,SAAS,EAAE,MAAM,eAAe,CAAC;AAElG,OAAO,EAAE,eAAe,EAAgB,MAAM,MAAM,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,mEAAmE,CAAC;AAC/G,OAAO,EAAE,8BAA8B,EAAE,MAAM,wEAAwE,CAAC;AAExH,OAAO,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,oCAAoC,EAAE,MAAM,sEAAsE,CAAC;AAG5H,OAAO,EAAE,wCAAwC,EAAE,MAAM,2CAA2C,CAAC;AAGrG;;GAEG;AAMH;IAgHE;;;;;;;;;;;;OAYG;IACH,8CAAoB,GAAsB,EACtB,WAAwB,E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AmB;IAMlB;QAAR,KAAK,EAAE;;8EAAsB;IAgDuB;QAApD,SAAS,CAAC,wCAAwC,CAAC;0CAAe,wCAAwC;8EAAC;IA9GjG,oCAAoC;QALhD,SAAS,CAAC;YACT,QAAQ,EAAE,mCAAmC;YAC7C,SAAS,EAAE,CAAC,sCAAsC,CAAC;YACnD,WAAW,EAAE,sCAAsC;SACpD,CAAC;iDA8HyB,iBAAiB;YACT,WAAW;YACX,WAAW;YACZ,kBAAkB;YAChB,QAAQ;YACH,0BAA0B;YAC1B,oCAAoC;YACpC,iBAAiB;YACrB,oBAAoB;OArI5C,oCAAoC,CAsThD;IAAD,2CAAC;CAAA,AAtTD,IAsTC;SAtTY,oCAAoC"} \ No newline at end of file diff --git a/src/app/submission/sections/upload/file/view/section-upload-file-view.component.js b/src/app/submission/sections/upload/file/view/section-upload-file-view.component.js new file mode 100644 index 0000000000..76aa8a8f8f --- /dev/null +++ b/src/app/submission/sections/upload/file/view/section-upload-file-view.component.js @@ -0,0 +1,60 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { WorkspaceitemSectionUploadFileObject } from '../../../../../core/submission/models/workspaceitem-section-upload-file.model'; +import { isNotEmpty } from '../../../../../shared/empty.util'; +import { Metadata } from '../../../../../core/shared/metadata.utils'; +/** + * This component allow to show bitstream's metadata + */ +var SubmissionSectionUploadFileViewComponent = /** @class */ (function () { + function SubmissionSectionUploadFileViewComponent() { + /** + * The [[MetadataMap]] object + * @type {MetadataMap} + */ + this.metadata = Object.create({}); + /** + * The bitstream's title key + * @type {string} + */ + this.fileTitleKey = 'Title'; + /** + * The bitstream's description key + * @type {string} + */ + this.fileDescrKey = 'Description'; + } + /** + * Initialize instance variables + */ + SubmissionSectionUploadFileViewComponent.prototype.ngOnInit = function () { + if (isNotEmpty(this.fileData.metadata)) { + this.metadata[this.fileTitleKey] = Metadata.all(this.fileData.metadata, 'dc.title'); + this.metadata[this.fileDescrKey] = Metadata.all(this.fileData.metadata, 'dc.description'); + } + }; + /** + * Gets all matching metadata in the map(s) + * + * @param metadataKey + * The metadata key(s) in scope + * @returns {MetadataValue[]} + * The matching values + */ + SubmissionSectionUploadFileViewComponent.prototype.getAllMetadataValue = function (metadataKey) { + return Metadata.all(this.metadata, metadataKey); + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", WorkspaceitemSectionUploadFileObject) + ], SubmissionSectionUploadFileViewComponent.prototype, "fileData", void 0); + SubmissionSectionUploadFileViewComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-section-upload-file-view', + templateUrl: './section-upload-file-view.component.html', + }) + ], SubmissionSectionUploadFileViewComponent); + return SubmissionSectionUploadFileViewComponent; +}()); +export { SubmissionSectionUploadFileViewComponent }; +//# sourceMappingURL=section-upload-file-view.component.js.map \ No newline at end of file diff --git a/src/app/submission/sections/upload/file/view/section-upload-file-view.component.js.map b/src/app/submission/sections/upload/file/view/section-upload-file-view.component.js.map new file mode 100644 index 0000000000..29b2730000 --- /dev/null +++ b/src/app/submission/sections/upload/file/view/section-upload-file-view.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section-upload-file-view.component.js","sourceRoot":"","sources":["section-upload-file-view.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,oCAAoC,EAAE,MAAM,+EAA+E,CAAC;AACrI,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAGrE;;GAEG;AAKH;IAJA;QAYE;;;WAGG;QACI,aAAQ,GAAgB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAEjD;;;WAGG;QACI,iBAAY,GAAG,OAAO,CAAC;QAE9B;;;WAGG;QACI,iBAAY,GAAG,aAAa,CAAC;IAuBtC,CAAC;IArBC;;OAEG;IACH,2DAAQ,GAAR;QACE,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACtC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACpF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;SAC3F;IACH,CAAC;IAED;;;;;;;OAOG;IACH,sEAAmB,GAAnB,UAAoB,WAAmB;QACrC,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAClD,CAAC;IAxCQ;QAAR,KAAK,EAAE;0CAAW,oCAAoC;8EAAC;IAN7C,wCAAwC;QAJpD,SAAS,CAAC;YACT,QAAQ,EAAE,wCAAwC;YAClD,WAAW,EAAE,2CAA2C;SACzD,CAAC;OACW,wCAAwC,CA+CpD;IAAD,+CAAC;CAAA,AA/CD,IA+CC;SA/CY,wCAAwC"} \ No newline at end of file diff --git a/src/app/submission/sections/upload/section-upload.component.js b/src/app/submission/sections/upload/section-upload.component.js new file mode 100644 index 0000000000..07c5765774 --- /dev/null +++ b/src/app/submission/sections/upload/section-upload.component.js @@ -0,0 +1,207 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, Inject } from '@angular/core'; +import { combineLatest } from 'rxjs'; +import { distinctUntilChanged, filter, find, flatMap, map, reduce, take, tap } from 'rxjs/operators'; +import { SectionModelComponent } from '../models/section.model'; +import { hasValue, isNotEmpty, isNotUndefined, isUndefined } from '../../../shared/empty.util'; +import { SectionUploadService } from './section-upload.service'; +import { CollectionDataService } from '../../../core/data/collection-data.service'; +import { GroupEpersonService } from '../../../core/eperson/group-eperson.service'; +import { SubmissionUploadsConfigService } from '../../../core/config/submission-uploads-config.service'; +import { SectionsType } from '../sections-type'; +import { renderSectionFor } from '../sections-decorator'; +import { AlertType } from '../../../shared/alert/aletr-type'; +import { SectionsService } from '../sections.service'; +import { SubmissionService } from '../../submission.service'; +export var POLICY_DEFAULT_NO_LIST = 1; // Banner1 +export var POLICY_DEFAULT_WITH_LIST = 2; // Banner2 +/** + * This component represents a section that contains submission's bitstreams + */ +var SubmissionSectionUploadComponent = /** @class */ (function (_super) { + tslib_1.__extends(SubmissionSectionUploadComponent, _super); + /** + * Initialize instance variables + * + * @param {SectionUploadService} bitstreamService + * @param {ChangeDetectorRef} changeDetectorRef + * @param {CollectionDataService} collectionDataService + * @param {GroupEpersonService} groupService + * @param {SectionsService} sectionService + * @param {SubmissionService} submissionService + * @param {SubmissionUploadsConfigService} uploadsConfigService + * @param {SectionDataObject} injectedSectionData + * @param {string} injectedSubmissionId + */ + function SubmissionSectionUploadComponent(bitstreamService, changeDetectorRef, collectionDataService, groupService, sectionService, submissionService, uploadsConfigService, injectedSectionData, injectedSubmissionId) { + var _this = _super.call(this, undefined, injectedSectionData, injectedSubmissionId) || this; + _this.bitstreamService = bitstreamService; + _this.changeDetectorRef = changeDetectorRef; + _this.collectionDataService = collectionDataService; + _this.groupService = groupService; + _this.sectionService = sectionService; + _this.submissionService = submissionService; + _this.uploadsConfigService = uploadsConfigService; + _this.injectedSectionData = injectedSectionData; + _this.injectedSubmissionId = injectedSubmissionId; + /** + * The AlertType enumeration + * @type {AlertType} + */ + _this.AlertTypeEnum = AlertType; + /** + * The array containing the keys of file list array + * @type {Array} + */ + _this.fileIndexes = []; + /** + * The file list + * @type {Array} + */ + _this.fileList = []; + /** + * The array containing the name of the files + * @type {Array} + */ + _this.fileNames = []; + /** + * Default access conditions of this collection + * @type {Array} + */ + _this.collectionDefaultAccessConditions = []; + /** + * Array to track all subscriptions and unsubscribe them onDestroy + * @type {Array} + */ + _this.subs = []; + return _this; + } + /** + * Initialize all instance variables and retrieve collection default access conditions + */ + SubmissionSectionUploadComponent.prototype.onSectionInit = function () { + var _this = this; + var config$ = this.uploadsConfigService.getConfigByHref(this.sectionData.config).pipe(map(function (config) { return config.payload; })); + // retrieve configuration for the bitstream's metadata form + this.configMetadataForm$ = config$.pipe(take(1), map(function (config) { return config.metadata; })); + this.subs.push(this.submissionService.getSubmissionObject(this.submissionId).pipe(filter(function (submissionObject) { return isNotUndefined(submissionObject) && !submissionObject.isLoading; }), filter(function (submissionObject) { return isUndefined(_this.collectionId) || _this.collectionId !== submissionObject.collection; }), tap(function (submissionObject) { return _this.collectionId = submissionObject.collection; }), flatMap(function (submissionObject) { return _this.collectionDataService.findById(submissionObject.collection); }), find(function (rd) { return isNotUndefined((rd.payload)); }), tap(function (collectionRemoteData) { return _this.collectionName = collectionRemoteData.payload.name; }), flatMap(function (collectionRemoteData) { + return _this.collectionDataService.findByHref(collectionRemoteData.payload._links.defaultAccessConditions); + }), find(function (defaultAccessConditionsRemoteData) { + return defaultAccessConditionsRemoteData.hasSucceeded; + }), tap(function (defaultAccessConditionsRemoteData) { + if (isNotEmpty(defaultAccessConditionsRemoteData.payload)) { + _this.collectionDefaultAccessConditions = Array.isArray(defaultAccessConditionsRemoteData.payload) + ? defaultAccessConditionsRemoteData.payload : [defaultAccessConditionsRemoteData.payload]; + } + }), flatMap(function () { return config$; }), take(1), flatMap(function (config) { + _this.availableAccessConditionOptions = isNotEmpty(config.accessConditionOptions) ? config.accessConditionOptions : []; + _this.collectionPolicyType = _this.availableAccessConditionOptions.length > 0 + ? POLICY_DEFAULT_WITH_LIST + : POLICY_DEFAULT_NO_LIST; + _this.availableGroups = new Map(); + var mapGroups$ = []; + // Retrieve Groups for accessCondition Policies + _this.availableAccessConditionOptions.forEach(function (accessCondition) { + if (accessCondition.hasEndDate === true || accessCondition.hasStartDate === true) { + if (accessCondition.groupUUID) { + mapGroups$.push(_this.groupService.findById(accessCondition.groupUUID).pipe(find(function (rd) { return !rd.isResponsePending && rd.hasSucceeded; }), map(function (rd) { return ({ + accessCondition: accessCondition.name, + groups: [rd.payload] + }); }))); + } + else if (accessCondition.selectGroupUUID) { + mapGroups$.push(_this.groupService.findById(accessCondition.selectGroupUUID).pipe(find(function (rd) { return !rd.isResponsePending && rd.hasSucceeded; }), flatMap(function (group) { return group.payload.groups; }), find(function (rd) { return !rd.isResponsePending && rd.hasSucceeded; }), map(function (rd) { return ({ + accessCondition: accessCondition.name, + groups: rd.payload.page + }); }))); + } + } + }); + return mapGroups$; + }), flatMap(function (entry) { return entry; }), reduce(function (acc, entry) { + acc.push(entry); + return acc; + }, [])).subscribe(function (entries) { + entries.forEach(function (entry) { + _this.availableGroups.set(entry.accessCondition, entry.groups); + }); + _this.changeDetectorRef.detectChanges(); + }), + // retrieve submission's bitstreams from state + combineLatest(this.configMetadataForm$, this.bitstreamService.getUploadedFileList(this.submissionId, this.sectionData.id)).pipe(filter(function (_a) { + var configMetadataForm = _a[0], fileList = _a[1]; + return isNotEmpty(configMetadataForm) && isNotUndefined(fileList); + }), distinctUntilChanged()) + .subscribe(function (_a) { + var configMetadataForm = _a[0], fileList = _a[1]; + _this.fileList = []; + _this.fileIndexes = []; + _this.fileNames = []; + _this.changeDetectorRef.detectChanges(); + if (isNotUndefined(fileList) && fileList.length > 0) { + fileList.forEach(function (file) { + _this.fileList.push(file); + _this.fileIndexes.push(file.uuid); + _this.fileNames.push(_this.getFileName(configMetadataForm, file)); + }); + } + _this.changeDetectorRef.detectChanges(); + })); + }; + /** + * Return file name from metadata + * + * @param configMetadataForm + * the bitstream's form configuration + * @param fileData + * the file metadata + */ + SubmissionSectionUploadComponent.prototype.getFileName = function (configMetadataForm, fileData) { + var metadataName = configMetadataForm.rows[0].fields[0].selectableMetadata[0].metadata; + var title; + if (isNotEmpty(fileData.metadata) && isNotEmpty(fileData.metadata[metadataName])) { + title = fileData.metadata[metadataName][0].display; + } + else { + title = fileData.uuid; + } + return title; + }; + /** + * Get section status + * + * @return Observable + * the section status + */ + SubmissionSectionUploadComponent.prototype.getSectionStatus = function () { + return this.bitstreamService.getUploadedFileList(this.submissionId, this.sectionData.id).pipe(map(function (fileList) { return (isNotUndefined(fileList) && fileList.length > 0); })); + }; + /** + * Method provided by Angular. Invoked when the instance is destroyed. + */ + SubmissionSectionUploadComponent.prototype.onSectionDestroy = function () { + this.subs + .filter(function (subscription) { return hasValue(subscription); }) + .forEach(function (subscription) { return subscription.unsubscribe(); }); + }; + SubmissionSectionUploadComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-section-upload', + styleUrls: ['./section-upload.component.scss'], + templateUrl: './section-upload.component.html', + }), + renderSectionFor(SectionsType.Upload), + tslib_1.__param(7, Inject('sectionDataProvider')), + tslib_1.__param(8, Inject('submissionIdProvider')), + tslib_1.__metadata("design:paramtypes", [SectionUploadService, + ChangeDetectorRef, + CollectionDataService, + GroupEpersonService, + SectionsService, + SubmissionService, + SubmissionUploadsConfigService, Object, String]) + ], SubmissionSectionUploadComponent); + return SubmissionSectionUploadComponent; +}(SectionModelComponent)); +export { SubmissionSectionUploadComponent }; +//# sourceMappingURL=section-upload.component.js.map \ No newline at end of file diff --git a/src/app/submission/sections/upload/section-upload.component.js.map b/src/app/submission/sections/upload/section-upload.component.js.map new file mode 100644 index 0000000000..7b8a53c7c9 --- /dev/null +++ b/src/app/submission/sections/upload/section-upload.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section-upload.component.js","sourceRoot":"","sources":["section-upload.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,EAAE,aAAa,EAA4B,MAAM,MAAM,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErG,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE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BAAmB,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,CAC3F,GAAG,CAAC,UAAC,QAAe,IAAK,OAAA,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,EAAjD,CAAiD,CAAC,CAAC,CAAC;IACjF,CAAC;IAED;;OAEG;IACH,2DAAgB,GAAhB;QACE,IAAI,CAAC,IAAI;aACN,MAAM,CAAC,UAAC,YAAY,IAAK,OAAA,QAAQ,CAAC,YAAY,CAAC,EAAtB,CAAsB,CAAC;aAChD,OAAO,CAAC,UAAC,YAAY,IAAK,OAAA,YAAY,CAAC,WAAW,EAAE,EAA1B,CAA0B,CAAC,CAAC;IAC3D,CAAC;IAhPU,gCAAgC;QAN5C,SAAS,CAAC;YACT,QAAQ,EAAE,8BAA8B;YACxC,SAAS,EAAE,CAAC,iCAAiC,CAAC;YAC9C,WAAW,EAAE,iCAAiC;SAC/C,CAAC;QACD,gBAAgB,CAAC,YAAY,CAAC,MAAM,CAAC;QAwFvB,mBAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;QAC7B,mBAAA,MAAM,CAAC,sBAAsB,CAAC,CAAA;iDARL,oBAAoB;YACnB,iBAAiB;YACb,qBAAqB;YAC9B,mBAAmB;YACf,eAAe;YACd,iBAAiB;YACd,8BAA8B;OAtF7D,gCAAgC,CAkP5C;IAAD,uCAAC;CAAA,AAlPD,CAAsD,qBAAqB,GAkP1E;SAlPY,gCAAgC"} \ No newline at end of file diff --git a/src/app/submission/sections/upload/section-upload.service.js b/src/app/submission/sections/upload/section-upload.service.js new file mode 100644 index 0000000000..e2b740509a --- /dev/null +++ b/src/app/submission/sections/upload/section-upload.service.js @@ -0,0 +1,119 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { distinctUntilChanged, filter, map } from 'rxjs/operators'; +import { Store } from '@ngrx/store'; +import { DeleteUploadedFileAction, EditFileDataAction, NewUploadedFileAction } from '../../objects/submission-objects.actions'; +import { submissionUploadedFileFromUuidSelector, submissionUploadedFilesFromIdSelector } from '../../selectors'; +import { isUndefined } from '../../../shared/empty.util'; +/** + * A service that provides methods to handle submission's bitstream state. + */ +var SectionUploadService = /** @class */ (function () { + /** + * Initialize service variables + * + * @param {Store} store + */ + function SectionUploadService(store) { + this.store = store; + } + /** + * Return submission's bitstream list from state + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @returns {Array} + * Returns submission's bitstream list + */ + SectionUploadService.prototype.getUploadedFileList = function (submissionId, sectionId) { + return this.store.select(submissionUploadedFilesFromIdSelector(submissionId, sectionId)).pipe(map(function (state) { return state; }), distinctUntilChanged()); + }; + /** + * Return bitstream's metadata + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @param fileUUID + * The bitstream UUID + * @returns {Observable} + * Emits bitstream's metadata + */ + SectionUploadService.prototype.getFileData = function (submissionId, sectionId, fileUUID) { + return this.store.select(submissionUploadedFilesFromIdSelector(submissionId, sectionId)).pipe(filter(function (state) { return !isUndefined(state); }), map(function (state) { + var fileState; + Object.keys(state) + .filter(function (key) { return state[key].uuid === fileUUID; }) + .forEach(function (key) { return fileState = state[key]; }); + return fileState; + }), distinctUntilChanged()); + }; + /** + * Return bitstream's default policies + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @param fileUUID + * The bitstream UUID + * @returns {Observable} + * Emits bitstream's default policies + */ + SectionUploadService.prototype.getDefaultPolicies = function (submissionId, sectionId, fileUUID) { + return this.store.select(submissionUploadedFileFromUuidSelector(submissionId, sectionId, fileUUID)).pipe(map(function (state) { return state; }), distinctUntilChanged()); + }; + /** + * Add a new bitstream to the state + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @param fileUUID + * The bitstream UUID + * @param data + * The [[WorkspaceitemSectionUploadFileObject]] object + */ + SectionUploadService.prototype.addUploadedFile = function (submissionId, sectionId, fileUUID, data) { + this.store.dispatch(new NewUploadedFileAction(submissionId, sectionId, fileUUID, data)); + }; + /** + * Update bitstream metadata into the state + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @param fileUUID + * The bitstream UUID + * @param data + * The [[WorkspaceitemSectionUploadFileObject]] object + */ + SectionUploadService.prototype.updateFileData = function (submissionId, sectionId, fileUUID, data) { + this.store.dispatch(new EditFileDataAction(submissionId, sectionId, fileUUID, data)); + }; + /** + * Remove bitstream from the state + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @param fileUUID + * The bitstream UUID + */ + SectionUploadService.prototype.removeUploadedFile = function (submissionId, sectionId, fileUUID) { + this.store.dispatch(new DeleteUploadedFileAction(submissionId, sectionId, fileUUID)); + }; + SectionUploadService = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [Store]) + ], SectionUploadService); + return SectionUploadService; +}()); +export { SectionUploadService }; +//# sourceMappingURL=section-upload.service.js.map \ No newline at end of file diff --git a/src/app/submission/sections/upload/section-upload.service.js.map b/src/app/submission/sections/upload/section-upload.service.js.map new file mode 100644 index 0000000000..0fc84f6554 --- /dev/null +++ b/src/app/submission/sections/upload/section-upload.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"section-upload.service.js","sourceRoot":"","sources":["section-upload.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,sCAAsC,EAAE,qCAAqC,EAAE,MAAM,iBAAiB,CAAC;AAChH,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD;;GAEG;AAEH;IAEE;;;;OAIG;IACH,8BAAoB,KAA6B;QAA7B,UA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AAK,IAAK,OAAA,KAAK,EAAL,CAAK,CAAC,EACrB,oBAAoB,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;;;;;;OAWG;IACI,8CAAe,GAAtB,UAAuB,YAAoB,EAAE,SAAiB,EAAE,QAAgB,EAAE,IAA0C;QAC1H,IAAI,CAAC,KAAK,CAAC,QAAQ,CACjB,IAAI,qBAAqB,CAAC,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CACnE,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;OAWG;IACI,6CAAc,GAArB,UAAsB,YAAoB,EAAE,SAAiB,EAAE,QAAgB,EAAE,IAA0C;QACzH,IAAI,CAAC,KAAK,CAAC,QAAQ,CACjB,IAAI,kBAAkB,CAAC,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CAChE,CAAC;IACJ,CAAC;IAED;;;;;;;;;OASG;IACI,iDAAkB,GAAzB,UAA0B,YAAoB,EAAE,SAAiB,EAAE,QAAgB;QACjF,IAAI,CAAC,KAAK,CAAC,QAAQ,CACjB,IAAI,wBAAwB,CAAC,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC,CAChE,CAAC;IACJ,CAAC;IAtHU,oBAAoB;QADhC,UAAU,EAAE;iDAQgB,KAAK;OAPrB,oBAAoB,CAuHhC;IAAD,2BAAC;CAAA,AAvHD,IAuHC;SAvHY,oBAAoB"} \ No newline at end of file diff --git a/src/app/submission/selectors.js b/src/app/submission/selectors.js new file mode 100644 index 0000000000..b3e4548de9 --- /dev/null +++ b/src/app/submission/selectors.js @@ -0,0 +1,57 @@ +import { createSelector } from '@ngrx/store'; +import { hasValue } from '../shared/empty.util'; +import { submissionSelector } from './submission.reducers'; +/** + * Export a function to return a subset of the state by key + */ +export function keySelector(parentSelector, subState, key) { + return createSelector(parentSelector, function (state) { + if (hasValue(state) && hasValue(state[subState])) { + return state[subState][key]; + } + else { + return undefined; + } + }); +} +/** + * Export a function to return a subset of the state + */ +export function subStateSelector(parentSelector, subState) { + return createSelector(parentSelector, function (state) { + if (hasValue(state) && hasValue(state[subState])) { + return state[subState]; + } + else { + return undefined; + } + }); +} +export function submissionObjectFromIdSelector(submissionId) { + return keySelector(submissionSelector, 'objects', submissionId); +} +export function submissionObjectSectionsFromIdSelector(submissionId) { + var submissionObjectSelector = submissionObjectFromIdSelector(submissionId); + return subStateSelector(submissionObjectSelector, 'sections'); +} +export function submissionUploadedFilesFromIdSelector(submissionId, sectionId) { + var sectionDataSelector = submissionSectionDataFromIdSelector(submissionId, sectionId); + return subStateSelector(sectionDataSelector, 'files'); +} +export function submissionUploadedFileFromUuidSelector(submissionId, sectionId, uuid) { + var filesSelector = submissionSectionDataFromIdSelector(submissionId, sectionId); + return keySelector(filesSelector, 'files', uuid); +} +export function submissionSectionFromIdSelector(submissionId, sectionId) { + var submissionIdSelector = submissionObjectFromIdSelector(submissionId); + return keySelector(submissionIdSelector, 'sections', sectionId); +} +export function submissionSectionDataFromIdSelector(submissionId, sectionId) { + var submissionIdSelector = submissionSectionFromIdSelector(submissionId, sectionId); + return subStateSelector(submissionIdSelector, 'data'); +} +export function submissionSectionErrorsFromIdSelector(submissionId, sectionId) { + var submissionIdSelector = submissionSectionFromIdSelector(submissionId, sectionId); + return subStateSelector(submissionIdSelector, 'errors'); +} +//# sourceMappingURL=selectors.js.map \ No newline at end of file diff --git a/src/app/submission/selectors.js.map b/src/app/submission/selectors.js.map new file mode 100644 index 0000000000..8c321c9ca9 --- /dev/null +++ b/src/app/submission/selectors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"selectors.js","sourceRoot":"","sources":["selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA8B,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAmB,MAAM,uBAAuB,CAAC;AAG5E;;GAEG;AACH,MAAM,sBAA4B,cAAkC,EAA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O,EAAE,IAAI,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,0CAA0C,YAAoB,EAAE,SAAiB;IACrF,IAAM,oBAAoB,GAAI,8BAA8B,CAAC,YAAY,CAAC,CAAC;IAC3E,OAAO,WAAW,CAAyC,oBAAoB,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AAC1G,CAAC;AAED,MAAM,8CAA8C,YAAoB,EAAE,SAAiB;IACzF,IAAM,oBAAoB,GAAI,+BAA+B,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACvF,OAAO,gBAAgB,CAA2C,oBAAoB,EAAE,MAAM,CAAC,CAAC;AAClG,CAAC;AAED,MAAM,gDAAgD,YAAoB,EAAE,SAAiB;IAC3F,IAAM,oBAAoB,GAAI,+BAA+B,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACvF,OAAO,gBAAgB,CAA2C,oBAAoB,EAAE,QAAQ,CAAC,CAAC;AACpG,CAAC"} \ No newline at end of file diff --git a/src/app/submission/server-submission.service.js b/src/app/submission/server-submission.service.js new file mode 100644 index 0000000000..56aa61a376 --- /dev/null +++ b/src/app/submission/server-submission.service.js @@ -0,0 +1,52 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { of as observableOf } from 'rxjs'; +import { SubmissionService } from './submission.service'; +/** + * Instance of SubmissionService used on SSR. + */ +var ServerSubmissionService = /** @class */ (function (_super) { + tslib_1.__extends(ServerSubmissionService, _super); + function ServerSubmissionService() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Override createSubmission parent method to return an empty observable + * + * @return Observable + * observable of SubmissionObject + */ + ServerSubmissionService.prototype.createSubmission = function () { + return observableOf(null); + }; + /** + * Override retrieveSubmission parent method to return an empty observable + * + * @return Observable + * observable of SubmissionObject + */ + ServerSubmissionService.prototype.retrieveSubmission = function (submissionId) { + return observableOf(null); + }; + /** + * Override startAutoSave parent method and return without doing anything + * + * @param submissionId + * The submission id + */ + ServerSubmissionService.prototype.startAutoSave = function (submissionId) { + return; + }; + /** + * Override startAutoSave parent method and return without doing anything + */ + ServerSubmissionService.prototype.stopAutoSave = function () { + return; + }; + ServerSubmissionService = tslib_1.__decorate([ + Injectable() + ], ServerSubmissionService); + return ServerSubmissionService; +}(SubmissionService)); +export { ServerSubmissionService }; +//# sourceMappingURL=server-submission.service.js.map \ No newline at end of file diff --git a/src/app/submission/server-submission.service.js.map b/src/app/submission/server-submission.service.js.map new file mode 100644 index 0000000000..e3d78e3367 --- /dev/null +++ b/src/app/submission/server-submission.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"server-submission.service.js","sourceRoot":"","sources":["server-submission.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAc,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD;;GAEG;AAEH;IAA6C,mDAAiB;IAA9D;;IAsCA,CAAC;IApCC;;;;;OAKG;IACH,kDAAgB,GAAhB;QACE,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,oDAAkB,GAAlB,UAAmB,YAAY;QAC7B,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,+CAAa,GAAb,UAAc,YAAY;QACxB,OAAO;IACT,CAAC;IAED;;OAEG;IACH,8CAAY,GAAZ;QACE,OAAO;IACT,CAAC;IArCU,uBAAuB;QADnC,UAAU,EAAE;OACA,uBAAuB,CAsCnC;IAAD,8BAAC;CAAA,AAtCD,CAA6C,iBAAiB,GAsC7D;SAtCY,uBAAuB"} \ No newline at end of file diff --git a/src/app/submission/submission.effects.js b/src/app/submission/submission.effects.js new file mode 100644 index 0000000000..27706d2fb2 --- /dev/null +++ b/src/app/submission/submission.effects.js @@ -0,0 +1,5 @@ +import { SubmissionObjectEffects } from './objects/submission-objects.effects'; +export var submissionEffects = [ + SubmissionObjectEffects +]; +//# sourceMappingURL=submission.effects.js.map \ No newline at end of file diff --git a/src/app/submission/submission.effects.js.map b/src/app/submission/submission.effects.js.map new file mode 100644 index 0000000000..71137addc9 --- /dev/null +++ b/src/app/submission/submission.effects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission.effects.js","sourceRoot":"","sources":["submission.effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,MAAM,CAAC,IAAM,iBAAiB,GAAG;IAC/B,uBAAuB;CACxB,CAAC"} \ No newline at end of file diff --git a/src/app/submission/submission.module.js b/src/app/submission/submission.module.js new file mode 100644 index 0000000000..fa7dac0b7c --- /dev/null +++ b/src/app/submission/submission.module.js @@ -0,0 +1,88 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreModule } from '../core/core.module'; +import { SharedModule } from '../shared/shared.module'; +import { SubmissionSectionformComponent } from './sections/form/section-form.component'; +import { SectionsDirective } from './sections/sections.directive'; +import { SectionsService } from './sections/sections.service'; +import { SubmissionFormCollectionComponent } from './form/collection/submission-form-collection.component'; +import { SubmissionFormFooterComponent } from './form/footer/submission-form-footer.component'; +import { SubmissionFormComponent } from './form/submission-form.component'; +import { SubmissionFormSectionAddComponent } from './form/section-add/submission-form-section-add.component'; +import { SubmissionSectionContainerComponent } from './sections/container/section-container.component'; +import { CommonModule } from '@angular/common'; +import { StoreModule } from '@ngrx/store'; +import { EffectsModule } from '@ngrx/effects'; +import { submissionReducers } from './submission.reducers'; +import { submissionEffects } from './submission.effects'; +import { SubmissionSectionUploadComponent } from './sections/upload/section-upload.component'; +import { SectionUploadService } from './sections/upload/section-upload.service'; +import { SubmissionUploadFilesComponent } from './form/submission-upload-files/submission-upload-files.component'; +import { SubmissionSectionLicenseComponent } from './sections/license/section-license.component'; +import { SubmissionUploadsConfigService } from '../core/config/submission-uploads-config.service'; +import { SubmissionEditComponent } from './edit/submission-edit.component'; +import { SubmissionSectionUploadFileComponent } from './sections/upload/file/section-upload-file.component'; +import { SubmissionSectionUploadFileEditComponent } from './sections/upload/file/edit/section-upload-file-edit.component'; +import { SubmissionSectionUploadFileViewComponent } from './sections/upload/file/view/section-upload-file-view.component'; +import { SubmissionSectionUploadAccessConditionsComponent } from './sections/upload/accessConditions/submission-section-upload-access-conditions.component'; +import { SubmissionSubmitComponent } from './submit/submission-submit.component'; +var SubmissionModule = /** @class */ (function () { + /** + * This module handles all components that are necessary for the submission process + */ + function SubmissionModule() { + } + SubmissionModule = tslib_1.__decorate([ + NgModule({ + imports: [ + CommonModule, + CoreModule, + SharedModule, + StoreModule.forFeature('submission', submissionReducers, {}), + EffectsModule.forFeature(submissionEffects), + TranslateModule + ], + declarations: [ + SubmissionSectionUploadAccessConditionsComponent, + SubmissionSectionUploadComponent, + SubmissionSectionformComponent, + SubmissionSectionLicenseComponent, + SectionsDirective, + SubmissionSectionContainerComponent, + SubmissionEditComponent, + SubmissionFormSectionAddComponent, + SubmissionFormCollectionComponent, + SubmissionFormComponent, + SubmissionFormFooterComponent, + SubmissionSubmitComponent, + SubmissionUploadFilesComponent, + SubmissionSectionUploadFileComponent, + SubmissionSectionUploadFileEditComponent, + SubmissionSectionUploadFileViewComponent + ], + entryComponents: [ + SubmissionSectionUploadComponent, + SubmissionSectionformComponent, + SubmissionSectionLicenseComponent, + SubmissionSectionContainerComponent + ], + exports: [ + SubmissionEditComponent, + SubmissionFormComponent, + SubmissionSubmitComponent + ], + providers: [ + SectionUploadService, + SectionsService, + SubmissionUploadsConfigService + ] + }) + /** + * This module handles all components that are necessary for the submission process + */ + ], SubmissionModule); + return SubmissionModule; +}()); +export { SubmissionModule }; +//# sourceMappingURL=submission.module.js.map \ No newline at end of file diff --git a/src/app/submission/submission.module.js.map b/src/app/submission/submission.module.js.map new file mode 100644 index 0000000000..4a421ea1c2 --- /dev/null +++ b/src/app/submission/submission.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission.module.js","sourceRoot":"","sources":["submission.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,iCAAiC,EAAE,MAAM,wDAAwD,CAAC;AAC3G,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,iCAAiC,EAAE,MAAM,0DAA0D,CAAC;AAC7G,OAAO,EAAE,mCAAmC,EAAE,MAAM,kDAAkD,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,kEAAkE,CAAC;AAClH,OAAO,EAAE,iCAAiC,EAAE,MAAM,8CAA8C,CAAC;AACjG,OAAO,EAAE,8BAA8B,EAAE,MAAM,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submission/submission.reducers.js new file mode 100644 index 0000000000..884658462d --- /dev/null +++ b/src/app/submission/submission.reducers.js @@ -0,0 +1,7 @@ +import { createFeatureSelector } from '@ngrx/store'; +import { submissionObjectReducer } from './objects/submission-objects.reducer'; +export var submissionReducers = { + objects: submissionObjectReducer, +}; +export var submissionSelector = createFeatureSelector('submission'); +//# sourceMappingURL=submission.reducers.js.map \ No newline at end of file diff --git a/src/app/submission/submission.reducers.js.map b/src/app/submission/submission.reducers.js.map new file mode 100644 index 0000000000..4344de474d --- /dev/null +++ b/src/app/submission/submission.reducers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission.reducers.js","sourceRoot":"","sources":["submission.reducers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EACL,uBAAuB,EAExB,MAAM,sCAAsC,CAAC;AAS9C,MAAM,CAAC,IAAM,kBAAkB,GAAsC;IACnE,OAAO,EAAE,uBAAuB;CACjC,CAAC;AAEF,MAAM,CAAC,IAAM,kBAAkB,GAAG,qBAAqB,CAAkB,YAAY,CAAC,CAAC"} \ No newline at end of file diff --git a/src/app/submission/submission.service.js b/src/app/submission/submission.service.js new file mode 100644 index 0000000000..588d138ae9 --- /dev/null +++ b/src/app/submission/submission.service.js @@ -0,0 +1,448 @@ +import * as tslib_1 from "tslib"; +import { Inject, Injectable } from '@angular/core'; +import { HttpHeaders } from '@angular/common/http'; +import { Router } from '@angular/router'; +import { of as observableOf, timer as observableTimer } from 'rxjs'; +import { catchError, distinctUntilChanged, filter, find, first, map, startWith } from 'rxjs/operators'; +import { Store } from '@ngrx/store'; +import { TranslateService } from '@ngx-translate/core'; +import { submissionSelector } from './submission.reducers'; +import { hasValue, isEmpty, isNotUndefined } from '../shared/empty.util'; +import { CancelSubmissionFormAction, ChangeSubmissionCollectionAction, DiscardSubmissionAction, InitSubmissionFormAction, ResetSubmissionFormAction, SaveAndDepositSubmissionAction, SaveForLaterSubmissionFormAction, SaveSubmissionFormAction, SaveSubmissionSectionFormAction, SetActiveSectionAction } from './objects/submission-objects.actions'; +import { submissionObjectFromIdSelector } from './selectors'; +import { GLOBAL_CONFIG } from '../../config'; +import { SubmissionRestService } from '../core/submission/submission-rest.service'; +import { SubmissionScopeType } from '../core/submission/submission-scope-type'; +import { RouteService } from '../shared/services/route.service'; +import { NotificationsService } from '../shared/notifications/notifications.service'; +import { RemoteData } from '../core/data/remote-data'; +import { RemoteDataError } from '../core/data/remote-data-error'; +/** + * A service that provides methods used in submission process. + */ +var SubmissionService = /** @class */ (function () { + /** + * Initialize service variables + * @param {GlobalConfig} EnvConfig + * @param {NotificationsService} notificationsService + * @param {SubmissionRestService} restService + * @param {Router} router + * @param {RouteService} routeService + * @param {Store} store + * @param {TranslateService} translate + */ + function SubmissionService(EnvConfig, notificationsService, restService, router, routeService, store, translate) { + this.EnvConfig = EnvConfig; + this.notificationsService = notificationsService; + this.restService = restService; + this.router = router; + this.routeService = routeService; + this.store = store; + this.translate = translate; + } + /** + * Dispatch a new [ChangeSubmissionCollectionAction] + * + * @param submissionId + * The submission id + * @param collectionId + * The collection id + */ + SubmissionService.prototype.changeSubmissionCollection = function (submissionId, collectionId) { + this.store.dispatch(new ChangeSubmissionCollectionAction(submissionId, collectionId)); + }; + /** + * Perform a REST call to create a new workspaceitem and return response + * + * @return Observable + * observable of SubmissionObject + */ + SubmissionService.prototype.createSubmission = function () { + return this.restService.postToEndpoint('workspaceitems', {}).pipe(map(function (workspaceitem) { return workspaceitem[0]; }), catchError(function () { return observableOf({}); })); + }; + /** + * Perform a REST call to deposit a workspaceitem and return response + * + * @param selfUrl + * The workspaceitem self url + * @return Observable + * observable of SubmissionObject + */ + SubmissionService.prototype.depositSubmission = function (selfUrl) { + var options = Object.create({}); + var headers = new HttpHeaders(); + headers = headers.append('Content-Type', 'text/uri-list'); + options.headers = headers; + return this.restService.postToEndpoint('workflowitems', selfUrl, null, options); + }; + /** + * Perform a REST call to delete a workspaceitem and return response + * + * @param submissionId + * The submission id + * @return Observable + * observable of SubmissionObject + */ + SubmissionService.prototype.discardSubmission = function (submissionId) { + return this.restService.deleteById(submissionId); + }; + /** + * Dispatch a new [InitSubmissionFormAction] + * + * @param collectionId + * The collection id + * @param submissionId + * The submission id + * @param selfUrl + * The workspaceitem self url + * @param submissionDefinition + * The [SubmissionDefinitionsModel] that define submission configuration + * @param sections + * The [WorkspaceitemSectionsObject] that define submission sections init data + * @param errors + * The [SubmissionSectionError] that define submission sections init errors + */ + SubmissionService.prototype.dispatchInit = function (collectionId, submissionId, selfUrl, submissionDefinition, sections, errors) { + this.store.dispatch(new InitSubmissionFormAction(collectionId, submissionId, selfUrl, submissionDefinition, sections, errors)); + }; + /** + * Dispatch a new [SaveAndDepositSubmissionAction] + * + * @param submissionId + * The submission id + */ + SubmissionService.prototype.dispatchDeposit = function (submissionId) { + this.store.dispatch(new SaveAndDepositSubmissionAction(submissionId)); + }; + /** + * Dispatch a new [DiscardSubmissionAction] + * + * @param submissionId + * The submission id + */ + SubmissionService.prototype.dispatchDiscard = function (submissionId) { + this.store.dispatch(new DiscardSubmissionAction(submissionId)); + }; + /** + * Dispatch a new [SaveSubmissionFormAction] + * + * @param submissionId + * The submission id + */ + SubmissionService.prototype.dispatchSave = function (submissionId) { + this.store.dispatch(new SaveSubmissionFormAction(submissionId)); + }; + /** + * Dispatch a new [SaveForLaterSubmissionFormAction] + * + * @param submissionId + * The submission id + */ + SubmissionService.prototype.dispatchSaveForLater = function (submissionId) { + this.store.dispatch(new SaveForLaterSubmissionFormAction(submissionId)); + }; + /** + * Dispatch a new [SaveSubmissionSectionFormAction] + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + */ + SubmissionService.prototype.dispatchSaveSection = function (submissionId, sectionId) { + this.store.dispatch(new SaveSubmissionSectionFormAction(submissionId, sectionId)); + }; + /** + * Return the id of the current focused section for the specified submission + * + * @param submissionId + * The submission id + * @return Observable + * observable of section id + */ + SubmissionService.prototype.getActiveSectionId = function (submissionId) { + return this.getSubmissionObject(submissionId).pipe(map(function (submission) { return submission.activeSection; })); + }; + /** + * Return the [SubmissionObjectEntry] for the specified submission + * + * @param submissionId + * The submission id + * @return Observable + * observable of SubmissionObjectEntry + */ + SubmissionService.prototype.getSubmissionObject = function (submissionId) { + return this.store.select(submissionObjectFromIdSelector(submissionId)).pipe(filter(function (submission) { return isNotUndefined(submission); })); + }; + /** + * Return a list of the active [SectionDataObject] belonging to the specified submission + * + * @param submissionId + * The submission id + * @return Observable + * observable with the list of active submission's sections + */ + SubmissionService.prototype.getSubmissionSections = function (submissionId) { + var _this = this; + return this.getSubmissionObject(submissionId).pipe(find(function (submission) { return isNotUndefined(submission.sections) && !submission.isLoading; }), map(function (submission) { return submission.sections; }), map(function (sections) { + var availableSections = []; + Object.keys(sections) + .filter(function (sectionId) { return !_this.isSectionHidden(sections[sectionId]); }) + .forEach(function (sectionId) { + var sectionObject = Object.create({}); + sectionObject.config = sections[sectionId].config; + sectionObject.mandatory = sections[sectionId].mandatory; + sectionObject.data = sections[sectionId].data; + sectionObject.errors = sections[sectionId].errors; + sectionObject.header = sections[sectionId].header; + sectionObject.id = sectionId; + sectionObject.sectionType = sections[sectionId].sectionType; + availableSections.push(sectionObject); + }); + return availableSections; + }), startWith([]), distinctUntilChanged()); + }; + /** + * Return a list of the disabled [SectionDataObject] belonging to the specified submission + * + * @param submissionId + * The submission id + * @return Observable + * observable with the list of disabled submission's sections + */ + SubmissionService.prototype.getDisabledSectionsList = function (submissionId) { + var _this = this; + return this.getSubmissionObject(submissionId).pipe(filter(function (submission) { return isNotUndefined(submission.sections) && !submission.isLoading; }), map(function (submission) { return submission.sections; }), map(function (sections) { + var disabledSections = []; + Object.keys(sections) + .filter(function (sectionId) { return !_this.isSectionHidden(sections[sectionId]); }) + .filter(function (sectionId) { return !sections[sectionId].enabled; }) + .forEach(function (sectionId) { + var sectionObject = Object.create({}); + sectionObject.header = sections[sectionId].header; + sectionObject.id = sectionId; + disabledSections.push(sectionObject); + }); + return disabledSections; + }), startWith([]), distinctUntilChanged()); + }; + /** + * Return the correct REST endpoint link path depending on the page route + * + * @return string + * link path + */ + SubmissionService.prototype.getSubmissionObjectLinkName = function () { + var url = this.router.routerState.snapshot.url; + if (url.startsWith('/workspaceitems') || url.startsWith('/submit')) { + return 'workspaceitems'; + } + else if (url.startsWith('/workflowitems')) { + return 'workflowitems'; + } + else { + return 'edititems'; + } + }; + /** + * Return the submission scope + * + * @return SubmissionScopeType + * the SubmissionScopeType + */ + SubmissionService.prototype.getSubmissionScope = function () { + var scope; + switch (this.getSubmissionObjectLinkName()) { + case 'workspaceitems': + scope = SubmissionScopeType.WorkspaceItem; + break; + case 'workflowitems': + scope = SubmissionScopeType.WorkflowItem; + break; + } + return scope; + }; + /** + * Return the validity status of the submission + * + * @param submissionId + * The submission id + * @return Observable + * observable with submission validity status + */ + SubmissionService.prototype.getSubmissionStatus = function (submissionId) { + var _this = this; + return this.store.select(submissionSelector).pipe(map(function (submissions) { return submissions.objects[submissionId]; }), filter(function (item) { return isNotUndefined(item) && isNotUndefined(item.sections); }), map(function (item) { return item.sections; }), map(function (sections) { + var states = []; + if (isNotUndefined(sections)) { + Object.keys(sections) + .filter(function (sectionId) { return sections.hasOwnProperty(sectionId); }) + .filter(function (sectionId) { return !_this.isSectionHidden(sections[sectionId]); }) + .filter(function (sectionId) { return sections[sectionId].enabled; }) + .filter(function (sectionId) { return sections[sectionId].isValid === false; }) + .forEach(function (sectionId) { + states.push(sections[sectionId].isValid); + }); + } + return !isEmpty(sections) && isEmpty(states); + }), distinctUntilChanged(), startWith(false)); + }; + /** + * Return the save processing status of the submission + * + * @param submissionId + * The submission id + * @return Observable + * observable with submission save processing status + */ + SubmissionService.prototype.getSubmissionSaveProcessingStatus = function (submissionId) { + return this.getSubmissionObject(submissionId).pipe(map(function (state) { return state.savePending; }), distinctUntilChanged(), startWith(false)); + }; + /** + * Return the deposit processing status of the submission + * + * @param submissionId + * The submission id + * @return Observable + * observable with submission deposit processing status + */ + SubmissionService.prototype.getSubmissionDepositProcessingStatus = function (submissionId) { + return this.getSubmissionObject(submissionId).pipe(map(function (state) { return state.depositPending; }), distinctUntilChanged(), startWith(false)); + }; + /** + * Return the visibility status of the specified section + * + * @param sectionData + * The section data + * @return boolean + * true if section is hidden, false otherwise + */ + SubmissionService.prototype.isSectionHidden = function (sectionData) { + return (isNotUndefined(sectionData.visibility) + && sectionData.visibility.main === 'HIDDEN' + && sectionData.visibility.other === 'HIDDEN'); + }; + /** + * Return the loading status of the submission + * + * @param submissionId + * The submission id + * @return Observable + * observable with submission loading status + */ + SubmissionService.prototype.isSubmissionLoading = function (submissionId) { + return this.getSubmissionObject(submissionId).pipe(map(function (submission) { return submission.isLoading; }), distinctUntilChanged()); + }; + /** + * Show a notification when a new section is added to submission form + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + * @param sectionType + * The section type + */ + SubmissionService.prototype.notifyNewSection = function (submissionId, sectionId, sectionType) { + var m = this.translate.instant('submission.sections.general.metadata-extracted-new-section', { sectionId: sectionId }); + this.notificationsService.info(null, m, null, true); + }; + /** + * Redirect to MyDspace page + */ + SubmissionService.prototype.redirectToMyDSpace = function () { + var _this = this; + this.routeService.getPreviousUrl().pipe(first()).subscribe(function (previousUrl) { + if (isEmpty(previousUrl) || !previousUrl.startsWith('/mydspace')) { + _this.router.navigate(['/mydspace']); + } + else { + _this.router.navigateByUrl(previousUrl); + } + }); + }; + /** + * Dispatch a new [CancelSubmissionFormAction] + */ + SubmissionService.prototype.resetAllSubmissionObjects = function () { + this.store.dispatch(new CancelSubmissionFormAction()); + }; + /** + * Dispatch a new [ResetSubmissionFormAction] + * + * @param collectionId + * The collection id + * @param submissionId + * The submission id + * @param selfUrl + * The workspaceitem self url + * @param submissionDefinition + * The [SubmissionDefinitionsModel] that define submission configuration + * @param sections + * The [WorkspaceitemSectionsObject] that define submission sections init data + */ + SubmissionService.prototype.resetSubmissionObject = function (collectionId, submissionId, selfUrl, submissionDefinition, sections) { + this.store.dispatch(new ResetSubmissionFormAction(collectionId, submissionId, selfUrl, sections, submissionDefinition)); + }; + /** + * Perform a REST call to retrieve an existing workspaceitem/workflowitem and return response + * + * @return Observable> + * observable of RemoteData + */ + SubmissionService.prototype.retrieveSubmission = function (submissionId) { + return this.restService.getDataById(this.getSubmissionObjectLinkName(), submissionId).pipe(find(function (submissionObjects) { return isNotUndefined(submissionObjects); }), map(function (submissionObjects) { return new RemoteData(false, false, true, null, submissionObjects[0]); }), catchError(function (errorResponse) { + return observableOf(new RemoteData(false, false, false, new RemoteDataError(errorResponse.statusCode, errorResponse.statusText, errorResponse.errorMessage), null)); + })); + }; + /** + * Dispatch a new [SetActiveSectionAction] + * + * @param submissionId + * The submission id + * @param sectionId + * The section id + */ + SubmissionService.prototype.setActiveSection = function (submissionId, sectionId) { + this.store.dispatch(new SetActiveSectionAction(submissionId, sectionId)); + }; + /** + * Allow to save automatically the submission + * + * @param submissionId + * The submission id + */ + SubmissionService.prototype.startAutoSave = function (submissionId) { + var _this = this; + this.stopAutoSave(); + // AUTOSAVE submission + // Retrieve interval from config and convert to milliseconds + var duration = this.EnvConfig.submission.autosave.timer * (1000 * 60); + // Dispatch save action after given duration + this.timer$ = observableTimer(duration, duration); + this.autoSaveSub = this.timer$ + .subscribe(function () { return _this.store.dispatch(new SaveSubmissionFormAction(submissionId)); }); + }; + /** + * Unsubscribe subscription to timer + */ + SubmissionService.prototype.stopAutoSave = function () { + if (hasValue(this.autoSaveSub)) { + this.autoSaveSub.unsubscribe(); + this.autoSaveSub = null; + } + }; + SubmissionService = tslib_1.__decorate([ + Injectable(), + tslib_1.__param(0, Inject(GLOBAL_CONFIG)), + tslib_1.__metadata("design:paramtypes", [Object, NotificationsService, + SubmissionRestService, + Router, + RouteService, + Store, + TranslateService]) + ], SubmissionService); + return SubmissionService; +}()); +export { SubmissionService }; +//# sourceMappingURL=submission.service.js.map \ No newline at end of file diff --git a/src/app/submission/submission.service.js.map b/src/app/submission/submission.service.js.map new file mode 100644 index 0000000000..80389d58f0 --- /dev/null +++ b/src/app/submission/submission.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission.service.js","sourceRoot":"","sources":["submission.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAc,EAAE,IAAI,YAAY,EAAgB,KAAK,IAAI,eAAe,EAAE,MAAM,MAAM,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACvG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAmB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,EAChC,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,gCAAgC,EAChC,wBAAwB,EACxB,+BAA+B,EAC/B,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAO9C,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAEnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+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CAAC;IACtF,CAAC;IAED;;OAEG;IACH,wCAAY,GAAZ;QACE,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YAC9B,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;YAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;SACzB;IACH,CAAC;IAtfU,iBAAiB;QAD7B,UAAU,EAAE;QAuBE,mBAAA,MAAM,CAAC,aAAa,CAAC,CAAA;yDACU,oBAAoB;YAC7B,qBAAqB;YAC1B,MAAM;YACA,YAAY;YACnB,KAAK;YACD,gBAAgB;OA5BtC,iBAAiB,CAuf7B;IAAD,wBAAC;CAAA,AAvfD,IAufC;SAvfY,iBAAiB"} \ No newline at end of file diff --git a/src/app/submission/submit/submission-submit.component.js b/src/app/submission/submit/submission-submit.component.js new file mode 100644 index 0000000000..bb16f3ae38 --- /dev/null +++ b/src/app/submission/submit/submission-submit.component.js @@ -0,0 +1,85 @@ +import * as tslib_1 from "tslib"; +import { ChangeDetectorRef, Component, ViewContainerRef } from '@angular/core'; +import { Router } from '@angular/router'; +import { hasValue, isEmpty, isNotNull } from '../../shared/empty.util'; +import { TranslateService } from '@ngx-translate/core'; +import { NotificationsService } from '../../shared/notifications/notifications.service'; +import { SubmissionService } from '../submission.service'; +/** + * This component allows to submit a new workspaceitem. + */ +var SubmissionSubmitComponent = /** @class */ (function () { + /** + * Initialize instance variables + * + * @param {ChangeDetectorRef} changeDetectorRef + * @param {NotificationsService} notificationsService + * @param {SubmissionService} submissioService + * @param {Router} router + * @param {TranslateService} translate + * @param {ViewContainerRef} viewContainerRef + */ + function SubmissionSubmitComponent(changeDetectorRef, notificationsService, router, submissioService, translate, viewContainerRef) { + this.changeDetectorRef = changeDetectorRef; + this.notificationsService = notificationsService; + this.router = router; + this.submissioService = submissioService; + this.translate = translate; + this.viewContainerRef = viewContainerRef; + /** + * Array to track all subscriptions and unsubscribe them onDestroy + * @type {Array} + */ + this.subs = []; + } + /** + * Create workspaceitem on the server and initialize all instance variables + */ + SubmissionSubmitComponent.prototype.ngOnInit = function () { + var _this = this; + // NOTE execute the code on the browser side only, otherwise it is executed twice + this.subs.push(this.submissioService.createSubmission() + .subscribe(function (submissionObject) { + // NOTE new submission is created on the browser side only + if (isNotNull(submissionObject)) { + if (isEmpty(submissionObject)) { + _this.notificationsService.info(null, _this.translate.get('submission.general.cannot_submit')); + _this.router.navigate(['/mydspace']); + } + else { + _this.collectionId = submissionObject.collection.id; + _this.selfUrl = submissionObject.self; + _this.submissionDefinition = submissionObject.submissionDefinition; + _this.submissionId = submissionObject.id; + _this.changeDetectorRef.detectChanges(); + } + } + })); + }; + /** + * Unsubscribe from all subscriptions + */ + SubmissionSubmitComponent.prototype.ngOnDestroy = function () { + this.subs + .filter(function (subscription) { return hasValue(subscription); }) + .forEach(function (subscription) { return subscription.unsubscribe(); }); + this.viewContainerRef.clear(); + this.changeDetectorRef.markForCheck(); + }; + SubmissionSubmitComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-submission-submit', + styleUrls: ['./submission-submit.component.scss'], + templateUrl: './submission-submit.component.html' + }), + tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef, + NotificationsService, + Router, + SubmissionService, + TranslateService, + ViewContainerRef]) + ], SubmissionSubmitComponent); + return SubmissionSubmitComponent; +}()); +export { SubmissionSubmitComponent }; +//# sourceMappingURL=submission-submit.component.js.map \ No newline at end of file diff --git a/src/app/submission/submit/submission-submit.component.js.map b/src/app/submission/submit/submission-submit.component.js.map new file mode 100644 index 0000000000..91ead0ea3d --- /dev/null +++ b/src/app/submission/submit/submission-submit.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-submit.component.js","sourceRoot":"","sources":["submission-submit.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAqB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAIzC,OAAO,EA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,CAAC,IAAI,CAAC;oBACrC,KAAI,CAAC,oBAAoB,GAAI,gBAAgB,CAAC,oBAAmD,CAAC;oBAClG,KAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC,EAAE,CAAC;oBACxC,KAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC;iBACxC;aACF;QACH,CAAC,CAAC,CACL,CAAA;IACH,CAAC;IAED;;OAEG;IACH,+CAAW,GAAX;QACE,IAAI,CAAC,IAAI;aACN,MAAM,CAAC,UAAC,YAAY,IAAK,OAAA,QAAQ,CAAC,YAAY,CAAC,EAAtB,CAAsB,CAAC;aAChD,OAAO,CAAC,UAAC,YAAY,IAAK,OAAA,YAAY,CAAC,WAAW,EAAE,EAA1B,CAA0B,CAAC,CAAC;QAEzD,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IArFU,yBAAyB;QALrC,SAAS,CAAC;YACT,QAAQ,EAAE,sBAAsB;YAChC,SAAS,EAAE,CAAC,oCAAoC,CAAC;YACjD,WAAW,EAAE,oCAAoC;SAClD,CAAC;iDA2CuC,iBAAiB;YACd,oBAAoB;YAClC,MAAM;YACI,iBAAiB;YACxB,gBAAgB;YACT,gBAAgB;OA/C3C,yBAAyB,CAuFrC;IAAD,gCAAC;CAAA,AAvFD,IAuFC;SAvFY,yBAAyB"} \ No newline at end of file diff --git a/src/app/submission/utils/parseSectionErrorPaths.js b/src/app/submission/utils/parseSectionErrorPaths.js new file mode 100644 index 0000000000..cc2e9be4da --- /dev/null +++ b/src/app/submission/utils/parseSectionErrorPaths.js @@ -0,0 +1,30 @@ +import { hasValue } from '../../shared/empty.util'; +var regex = /([^\/]+)/g; +// const regex = /\/sections\/(.*)\/(.*)\/(.*)/; +var regexShort = /\/sections\/(.*)/; +/** + * The following method accept an array of section path strings and return a path object + * @param {string | string[]} path + * @returns {SectionErrorPath[]} + */ +var parseSectionErrorPaths = function (path) { + var paths = typeof path === 'string' ? [path] : path; + return paths.map(function (item) { + if (item.match(regex) && item.match(regex).length > 2) { + return { + sectionId: item.match(regex)[1], + fieldId: item.match(regex)[2], + fieldIndex: hasValue(item.match(regex)[3]) ? +item.match(regex)[3] : 0, + originalPath: item, + }; + } + else { + return { + sectionId: item.match(regexShort)[1], + originalPath: item, + }; + } + }); +}; +export default parseSectionErrorPaths; +//# sourceMappingURL=parseSectionErrorPaths.js.map \ No newline at end of file diff --git a/src/app/submission/utils/parseSectionErrorPaths.js.map b/src/app/submission/utils/parseSectionErrorPaths.js.map new file mode 100644 index 0000000000..888d195168 --- /dev/null +++ b/src/app/submission/utils/parseSectionErrorPaths.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parseSectionErrorPaths.js","sourceRoot":"","sources":["parseSectionErrorPaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AA4BnD,IAAM,KAAK,GAAG,WAAW,CAAC;AAC1B,gDAAgD;AAChD,IAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC;;;;GAIG;AACH,IAAM,sBAAsB,GAAG,UAAC,IAAuB;IACrD,IAAM,KAAK,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEvD,OAAO,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI;QAClB,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YACrD,OAAO;gBACL,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC/B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC7B,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACtE,YAAY,EAAE,IAAI;aACnB,CAAC;SACH;aAAM;YACL,OAAO;gBACL,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBACpC,YAAY,EAAE,IAAI;aACnB,CAAC;SACH;IAEH,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"} \ No newline at end of file diff --git a/src/app/submission/utils/parseSectionErrors.js b/src/app/submission/utils/parseSectionErrors.js new file mode 100644 index 0000000000..b8aaab9b7f --- /dev/null +++ b/src/app/submission/utils/parseSectionErrors.js @@ -0,0 +1,23 @@ +import { default as parseSectionErrorPaths } from './parseSectionErrorPaths'; +/** + * the following method accept an array of SubmissionObjectError and return a section errors object + * @param {errors: SubmissionObjectError[]} errors + * @returns {any} + */ +var parseSectionErrors = function (errors) { + if (errors === void 0) { errors = []; } + var errorsList = Object.create({}); + errors.forEach(function (error) { + var paths = parseSectionErrorPaths(error.paths); + paths.forEach(function (path) { + var sectionError = { path: path.originalPath, message: error.message }; + if (!errorsList[path.sectionId]) { + errorsList[path.sectionId] = []; + } + errorsList[path.sectionId].push(sectionError); + }); + }); + return errorsList; +}; +export default parseSectionErrors; +//# sourceMappingURL=parseSectionErrors.js.map \ No newline at end of file diff --git a/src/app/submission/utils/parseSectionErrors.js.map b/src/app/submission/utils/parseSectionErrors.js.map new file mode 100644 index 0000000000..5e12f3df64 --- /dev/null +++ b/src/app/submission/utils/parseSectionErrors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parseSectionErrors.js","sourceRoot":"","sources":["parseSectionErrors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAoB,MAAM,0BAA0B,CAAC;AAE/F;;;;GAIG;AACH,IAAM,kBAAkB,GAAG,UAAC,MAAoC;IAApC,uBAAA,EAAA,WAAoC;IAC9D,IAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAErC,MAAM,CAAC,OAAO,CAAC,UAAC,KAA4B;QAC1C,IAAM,KAAK,GAAuB,sBAAsB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEtE,KAAK,CAAC,OAAO,CAAC,UAAC,IAAsB;YACnC,IAAM,YAAY,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAC,CAAC;YACvE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;gBAC/B,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;aACjC;YACD,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/src/app/thumbnail/thumbnail.component.js b/src/app/thumbnail/thumbnail.component.js new file mode 100644 index 0000000000..d7f5b9b50d --- /dev/null +++ b/src/app/thumbnail/thumbnail.component.js @@ -0,0 +1,46 @@ +import * as tslib_1 from "tslib"; +import { Component, Input } from '@angular/core'; +import { Bitstream } from '../core/shared/bitstream.model'; +import { hasValue } from '../shared/empty.util'; +/** + * This component renders a given Bitstream as a thumbnail. + * One input parameter of type Bitstream is expected. + * If no Bitstream is provided, a holderjs image will be rendered instead. + */ +var ThumbnailComponent = /** @class */ (function () { + function ThumbnailComponent() { + /** + * The default 'holder.js' image + */ + this.defaultImage = 'data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2293%22%20height%3D%22120%22%20viewBox%3D%220%200%2093%20120%22%20preserveAspectRatio%3D%22none%22%3E%3C!--%0ASource%20URL%3A%20holder.js%2F93x120%3Ftext%3DNo%20Thumbnail%0ACreated%20with%20Holder.js%202.8.2.%0ALearn%20more%20at%20http%3A%2F%2Fholderjs.com%0A(c)%202012-2015%20Ivan%20Malopinsky%20-%20http%3A%2F%2Fimsky.co%0A--%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%3C!%5BCDATA%5B%23holder_1543e460b05%20text%20%7B%20fill%3A%23AAAAAA%3Bfont-weight%3Abold%3Bfont-family%3AArial%2C%20Helvetica%2C%20Open%20Sans%2C%20sans-serif%2C%20monospace%3Bfont-size%3A10pt%20%7D%20%5D%5D%3E%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_1543e460b05%22%3E%3Crect%20width%3D%2293%22%20height%3D%22120%22%20fill%3D%22%23EEEEEE%22%2F%3E%3Cg%3E%3Ctext%20x%3D%2235.6171875%22%20y%3D%2257%22%3ENo%3C%2Ftext%3E%3Ctext%20x%3D%2210.8125%22%20y%3D%2272%22%3EThumbnail%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E'; + } + ThumbnailComponent.prototype.errorHandler = function (event) { + event.currentTarget.src = this.defaultImage; + }; + ThumbnailComponent.prototype.ngOnInit = function () { + if (hasValue(this.thumbnail) && this.thumbnail.content) { + this.src = this.thumbnail.content; + } + else { + this.src = this.defaultImage; + } + }; + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Bitstream) + ], ThumbnailComponent.prototype, "thumbnail", void 0); + tslib_1.__decorate([ + Input(), + tslib_1.__metadata("design:type", Object) + ], ThumbnailComponent.prototype, "defaultImage", void 0); + ThumbnailComponent = tslib_1.__decorate([ + Component({ + selector: 'ds-thumbnail', + styleUrls: ['./thumbnail.component.scss'], + templateUrl: './thumbnail.component.html' + }) + ], ThumbnailComponent); + return ThumbnailComponent; +}()); +export { ThumbnailComponent }; +//# sourceMappingURL=thumbnail.component.js.map \ No newline at end of file diff --git a/src/app/thumbnail/thumbnail.component.js.map b/src/app/thumbnail/thumbnail.component.js.map new file mode 100644 index 0000000000..98a9a8010a --- /dev/null +++ b/src/app/thumbnail/thumbnail.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"thumbnail.component.js","sourceRoot":"","sources":["thumbnail.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD;;;;GAIG;AAOH;IALA;QASE;;WAEG;QACM,iBAAY,GAAI,++BAA++B,CAAC;IAe3gC,CAAC;IAZC,yCAAY,GAAZ,UAAa,KAAK;QAChB,KAAK,CAAC,aAAa,CAAC,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC;IAC9C,CAAC;IAED,qCAAQ,GAAR;QACI,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;YACtD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SACnC;aAAM;YACL,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,YAAY,CAAA;SAC7B;IACL,CAAC;IAlBQ;QAAR,KAAK,EAAE;0CAAY,SAAS;yDAAC;IAKrB;QAAR,KAAK,EAAE;;4DAAigC;IAP9/B,kBAAkB;QAL9B,SAAS,CAAC;YACT,QAAQ,EAAE,cAAc;YACxB,SAAS,EAAE,CAAC,4BAA4B,CAAC;YACzC,WAAW,EAAE,4BAA4B;SAC1C,CAAC;OACW,kBAAkB,CAsB9B;IAAD,yBAAC;CAAA,AAtBD,IAsBC;SAtBY,kBAAkB"} \ No newline at end of file diff --git a/src/backend/api.js b/src/backend/api.js new file mode 100644 index 0000000000..109e94a529 --- /dev/null +++ b/src/backend/api.js @@ -0,0 +1,169 @@ +var Router = require('express').Router; +var util = require('util'); +// Our API for demos only +import { fakeDataBase } from './db'; +import { fakeDemoRedisCache } from './cache'; +import COMMUNITIES from './data/communities.json'; +import COLLECTIONS from './data/collections.json'; +import ITEMS from './data/items.json'; +import BUNDLES from './data/bundles.json'; +import BITSTREAMS from './data/bitstreams.json'; +// you would use cookies/token etc +var USER_ID = 'f9d98cf1-1b96-464e-8755-bcc2a5c09077'; // hardcoded as an example +// Our API for demos only +export function serverApi(req, res) { + var key = USER_ID + '/data.json'; + var cache = fakeDemoRedisCache.get(key); + if (cache !== undefined) { + console.log('/data.json Cache Hit'); + return res.json(cache); + } + console.log('/data.json Cache Miss'); + fakeDataBase.get() + .then(function (data) { + fakeDemoRedisCache.set(key, data); + return data; + }) + .then(function (data) { return res.json(data); }); +} +function toHALResponse(req, data, included) { + var result = { + _embedded: data, + _links: { + self: req.protocol + '://' + req.get('host') + req.originalUrl + } + }; + if (included && Array.isArray(included) && included.length > 0) { + Object.assign(result, { + included: included + }); + } + return result; +} +export function createMockApi() { + var router = Router(); + router.route('/communities').get(function (req, res) { + console.log('GET'); + // 70ms latency + setTimeout(function () { + res.json(toHALResponse(req, COMMUNITIES)); + }, 0); + }); + router.param('community_id', function (req, res, next, communityId) { + // ensure correct prop type + var id = req.params.community_id; + try { + req.community_id = id; + req.community = COMMUNITIES.communities.find(function (community) { + return community.id === id; + }); + next(); + } + catch (e) { + next(new Error('failed to load community')); + } + }); + router.route('/communities/:community_id').get(function (req, res) { + res.json(toHALResponse(req, req.community)); + }); + router.route('/collections').get(function (req, res) { + console.log('GET'); + // 70ms latency + setTimeout(function () { + res.json(toHALResponse(req, COLLECTIONS)); + }, 0); + }); + router.param('collection_id', function (req, res, next, collectionId) { + // ensure correct prop type + var id = req.params.collection_id; + try { + req.collection_id = id; + req.collection = COLLECTIONS.collections.find(function (collection) { + return collection.id === id; + }); + next(); + } + catch (e) { + next(new Error('failed to load collection')); + } + }); + router.route('/collections/:collection_id').get(function (req, res) { + res.json(toHALResponse(req, req.collection)); + }); + router.route('/items').get(function (req, res) { + console.log('GET'); + // 70ms latency + setTimeout(function () { + res.json(toHALResponse(req, ITEMS)); + }, 0); + }); + router.param('item_id', function (req, res, next, itemId) { + // ensure correct prop type + var id = req.params.item_id; + try { + req.item_id = id; + req.item = ITEMS.items.find(function (item) { + return item.id === id; + }); + next(); + } + catch (e) { + next(new Error('failed to load item')); + } + }); + router.route('/items/:item_id').get(function (req, res) { + res.json(toHALResponse(req, req.item)); + }); + router.route('/bundles').get(function (req, res) { + console.log('GET'); + // 70ms latency + setTimeout(function () { + res.json(toHALResponse(req, BUNDLES)); + }, 0); + }); + router.param('bundle_id', function (req, res, next, bundleId) { + // ensure correct prop type + var id = req.params.bundle_id; + try { + req.bundle_id = id; + req.bundle = BUNDLES.bundles.find(function (bundle) { + return bundle.id === id; + }); + next(); + } + catch (e) { + next(new Error('failed to load item')); + } + }); + router.route('/bundles/:bundle_id').get(function (req, res) { + // console.log('GET', util.inspect(req.bundle, { colors: true })); + res.json(toHALResponse(req, req.bundle)); + }); + router.route('/bitstreams').get(function (req, res) { + console.log('GET'); + // 70ms latency + setTimeout(function () { + res.json(toHALResponse(req, BITSTREAMS)); + }, 0); + }); + router.param('bitstream_id', function (req, res, next, bitstreamId) { + // ensure correct prop type + var id = req.params.bitstream_id; + try { + req.bitstream_id = id; + req.bitstream = BITSTREAMS.bitstreams.find(function (bitstream) { + return bitstream.id === id; + }); + next(); + } + catch (e) { + next(new Error('failed to load item')); + } + }); + router.route('/bitstreams/:bitstream_id').get(function (req, res) { + // console.log('GET', util.inspect(req.bitstream, { colors: true })); + res.json(toHALResponse(req, req.bitstream)); + }); + return router; +} +//# sourceMappingURL=api.js.map \ No newline at end of file diff --git a/src/backend/api.js.map b/src/backend/api.js.map new file mode 100644 index 0000000000..d9f71a4c99 --- /dev/null +++ b/src/backend/api.js.map @@ -0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ACvD,2BAA2B;QAC3B,IAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC;QACnC,IAAI;YACF,GAAG,CAAC,YAAY,GAAG,EAAE,CAAC;YACtB,GAAG,CAAC,SAAS,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,UAAC,SAAS;gBACnD,OAAO,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC;YAC7B,CAAC,CAAC,CAAC;YACH,IAAI,EAAE,CAAC;SACR;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;SACxC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,GAAG,CAAC,UAAC,GAAG,EAAE,GAAG;QACrD,qEAAqE;QACrE,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/src/backend/cache.js b/src/backend/cache.js new file mode 100644 index 0000000000..2adbf6e512 --- /dev/null +++ b/src/backend/cache.js @@ -0,0 +1,16 @@ +var _fakeLRUcount = 0; +export var fakeDemoRedisCache = { + _cache: {}, + get: function (key) { + var cache = fakeDemoRedisCache._cache[key]; + _fakeLRUcount++; + if (_fakeLRUcount >= 10) { + fakeDemoRedisCache.clear(); + _fakeLRUcount = 0; + } + return cache; + }, + set: function (key, data) { return fakeDemoRedisCache._cache[key] = data; }, + clear: function () { return fakeDemoRedisCache._cache = {}; } +}; +//# sourceMappingURL=cache.js.map \ No newline at end of file diff --git a/src/backend/cache.js.map b/src/backend/cache.js.map new file mode 100644 index 0000000000..d27248f43c --- /dev/null +++ b/src/backend/cache.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cache.js","sourceRoot":"","sources":["cache.ts"],"names":[],"mappings":"AAAA,IAAI,aAAa,GAAG,CAAC,CAAC;AACtB,MAAM,CAAC,IAAM,kBAAkB,GAAG;IAChC,MAAM,EAAE,EAAE;IACV,GAAG,EAAE,UAAC,GAAG;QACP,IAAM,KAAK,GAAG,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7C,aAAa,EAAE,CAAC;QAChB,IAAI,aAAa,IAAI,EAAE,EAAE;YACvB,kBAAkB,CAAC,KAAK,EAAE,CAAC;YAC3B,aAAa,GAAG,CAAC,CAAC;SACnB;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,GAAG,EAAE,UAAC,GAAG,EAAE,IAAI,IAAK,OAAA,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAArC,CAAqC;IACzD,KAAK,EAAE,cAAM,OAAA,kBAAkB,CAAC,MAAM,GAAG,EAAE,EAA9B,CAA8B;CAC5C,CAAC"} \ No newline at end of file diff --git a/src/backend/db.js b/src/backend/db.js new file mode 100644 index 0000000000..54e1b8635e --- /dev/null +++ b/src/backend/db.js @@ -0,0 +1,8 @@ +// Our API for demos only +export var fakeDataBase = { + get: function () { + var res = { data: 'This fake data came from the db on the server.' }; + return Promise.resolve(res); + } +}; +//# sourceMappingURL=db.js.map \ No newline at end of file diff --git a/src/backend/db.js.map b/src/backend/db.js.map new file mode 100644 index 0000000000..214fa61364 --- /dev/null +++ b/src/backend/db.js.map @@ -0,0 +1 @@ +{"version":3,"file":"db.js","sourceRoot":"","sources":["db.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,MAAM,CAAC,IAAM,YAAY,GAAG;IAC1B,GAAG;QACD,IAAM,GAAG,GAAG,EAAE,IAAI,EAAE,gDAAgD,EAAE,CAAC;QACvE,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/src/config.js b/src/config.js new file mode 100644 index 0000000000..e6d7779382 --- /dev/null +++ b/src/config.js @@ -0,0 +1,121 @@ +// Look in ./config folder for config +import { InjectionToken } from '@angular/core'; +import { hasValue } from './app/shared/empty.util'; +var GLOBAL_CONFIG = new InjectionToken('config'); +var configContext = require.context('../config', false, /js$/); +var production = false; +var ENV_CONFIG; +var envConfigOverride; +var envConfigFile; +// check process.env.NODE_ENV to determine which environment config to use +// process.env.NODE_ENV is defined by webpack, else assume development +switch (process.env.NODE_ENV) { + case 'prod': + case 'production': + // webpack.prod.config.ts defines process.env.NODE_ENV = 'production' + envConfigFile = './environment.prod.js'; + production = true; + break; + case 'test': + // webpack.test.config.ts defines process.env.NODE_ENV = 'test' + envConfigFile = './environment.test.js'; + break; + default: + // if not using webpack.prod.config.ts or webpack.test.config.ts, it must be development + envConfigFile = './environment.dev.js'; +} +try { + ENV_CONFIG = configContext('./environment.default.js'); +} +catch (e) { + throw new Error('Cannot find file config/environment.default.js'); +} +// if envConfigFile set try to get configs +if (envConfigFile) { + try { + envConfigOverride = configContext(envConfigFile); + } + catch (e) { + console.warn('Cannot find file ' + envConfigFile.substring(2, envConfigFile.length), 'Using default environment'); + } + try { + merge(envConfigOverride); + } + catch (e) { + console.warn('Unable to merge the default environment'); + } +} +// allow to override a few important options by environment variables +function createServerConfig(host, port, nameSpace, ssl) { + var result = { host: host, nameSpace: nameSpace }; + if (hasValue(port)) { + result.port = Number(port); + } + if (hasValue(ssl)) { + result.ssl = ssl.trim().match(/^(true|1|yes)$/i) ? true : false; + } + return result; +} +var processEnv = { + ui: createServerConfig(process.env.DSPACE_HOST, process.env.DSPACE_PORT, process.env.DSPACE_NAMESPACE, process.env.DSPACE_SSL), + rest: createServerConfig(process.env.DSPACE_REST_HOST, process.env.DSPACE_REST_PORT, process.env.DSPACE_REST_NAMESPACE, process.env.DSPACE_REST_SSL) +}; +// merge the environment variables with our configuration. +try { + merge(processEnv); +} +catch (e) { + console.warn('Unable to merge environment variable into the configuration'); +} +buildBaseUrls(); +// set config for whether running in production +ENV_CONFIG.production = production; +function merge(config) { + innerMerge(ENV_CONFIG, config); +} +function innerMerge(globalConfig, config) { + for (var key in config) { + if (config.hasOwnProperty(key)) { + if (isObject(config[key])) { + innerMerge(globalConfig[key], config[key]); + } + else { + if (isDefined(config[key])) { + globalConfig[key] = config[key]; + } + } + } + } +} +function buildBaseUrls() { + for (var key in ENV_CONFIG) { + if (ENV_CONFIG.hasOwnProperty(key) && ENV_CONFIG[key].host) { + ENV_CONFIG[key].baseUrl = [ + getProtocol(ENV_CONFIG[key].ssl), + getHost(ENV_CONFIG[key].host), + getPort(ENV_CONFIG[key].port), + getNameSpace(ENV_CONFIG[key].nameSpace) + ].join(''); + } + } +} +function getProtocol(ssl) { + return ssl ? 'https://' : 'http://'; +} +function getHost(host) { + return host; +} +function getPort(port) { + return port ? (port !== 80 && port !== 443) ? ':' + port : '' : ''; +} +function getNameSpace(nameSpace) { + return nameSpace ? nameSpace.charAt(0) === '/' ? nameSpace : '/' + nameSpace : ''; +} +function isDefined(value) { + return typeof value !== 'undefined' && value !== null; +} +function isObject(item) { + return item && typeof item === 'object' && !Array.isArray(item); +} +export { GLOBAL_CONFIG, ENV_CONFIG }; +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/src/config.js.map b/src/config.js.map new file mode 100644 index 0000000000..eeaa79165f --- /dev/null +++ b/src/config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.js","sourceRoot":"","sources":["config.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK/C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,IAAM,aAAa,GAAiC,IAAI,cAAc,CAAe,QAAQ,CAAC,CAAC;AAE/F,IAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAEjE,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB,IAAI,UAAwB,CAAC;AAE7B,IAAI,iBA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,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC;AACxD,CAAC;AAED,kBAAkB,IAAS;IACzB,OAAO,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC;AAED,OAAO,EAAgB,aAAa,EAAE,UAAU,EAAE,CAAA"} \ No newline at end of file diff --git a/src/config/auto-sync-config.interface.js b/src/config/auto-sync-config.interface.js new file mode 100644 index 0000000000..c7efb560b1 --- /dev/null +++ b/src/config/auto-sync-config.interface.js @@ -0,0 +1 @@ +//# sourceMappingURL=auto-sync-config.interface.js.map \ No newline at end of file diff --git a/src/config/auto-sync-config.interface.js.map b/src/config/auto-sync-config.interface.js.map new file mode 100644 index 0000000000..398d6a3b0e --- /dev/null +++ b/src/config/auto-sync-config.interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auto-sync-config.interface.js","sourceRoot":"","sources":["auto-sync-config.interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/config/browse-by-config.interface.js b/src/config/browse-by-config.interface.js new file mode 100644 index 0000000000..5c7c416033 --- /dev/null +++ b/src/config/browse-by-config.interface.js @@ -0,0 +1 @@ +//# sourceMappingURL=browse-by-config.interface.js.map \ No newline at end of file diff --git a/src/config/browse-by-config.interface.js.map b/src/config/browse-by-config.interface.js.map new file mode 100644 index 0000000000..954efb57ed --- /dev/null +++ b/src/config/browse-by-config.interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browse-by-config.interface.js","sourceRoot":"","sources":["browse-by-config.interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/config/cache-config.interface.js b/src/config/cache-config.interface.js new file mode 100644 index 0000000000..c888233eef --- /dev/null +++ b/src/config/cache-config.interface.js @@ -0,0 +1 @@ +//# sourceMappingURL=cache-config.interface.js.map \ No newline at end of file diff --git a/src/config/cache-config.interface.js.map b/src/config/cache-config.interface.js.map new file mode 100644 index 0000000000..457d12e998 --- /dev/null +++ b/src/config/cache-config.interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cache-config.interface.js","sourceRoot":"","sources":["cache-config.interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/config/config.interface.js b/src/config/config.interface.js new file mode 100644 index 0000000000..77cd154139 --- /dev/null +++ b/src/config/config.interface.js @@ -0,0 +1 @@ +//# sourceMappingURL=config.interface.js.map \ No newline at end of file diff --git a/src/config/config.interface.js.map b/src/config/config.interface.js.map new file mode 100644 index 0000000000..3cd0463779 --- /dev/null +++ b/src/config/config.interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.interface.js","sourceRoot":"","sources":["config.interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/config/form-config.interfaces.js b/src/config/form-config.interfaces.js new file mode 100644 index 0000000000..495560d9f4 --- /dev/null +++ b/src/config/form-config.interfaces.js @@ -0,0 +1 @@ +//# sourceMappingURL=form-config.interfaces.js.map \ No newline at end of file diff --git a/src/config/form-config.interfaces.js.map b/src/config/form-config.interfaces.js.map new file mode 100644 index 0000000000..b4a9268f52 --- /dev/null +++ b/src/config/form-config.interfaces.js.map @@ -0,0 +1 @@ +{"version":3,"file":"form-config.interfaces.js","sourceRoot":"","sources":["form-config.interfaces.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/config/global-config.interface.js b/src/config/global-config.interface.js new file mode 100644 index 0000000000..41269a9a04 --- /dev/null +++ b/src/config/global-config.interface.js @@ -0,0 +1 @@ +//# sourceMappingURL=global-config.interface.js.map \ No newline at end of file diff --git a/src/config/global-config.interface.js.map b/src/config/global-config.interface.js.map new file mode 100644 index 0000000000..8efc1ef8c7 --- /dev/null +++ b/src/config/global-config.interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"global-config.interface.js","sourceRoot":"","sources":["global-config.interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/config/item-page-config.interface.js b/src/config/item-page-config.interface.js new file mode 100644 index 0000000000..532f8adf59 --- /dev/null +++ b/src/config/item-page-config.interface.js @@ -0,0 +1 @@ +//# sourceMappingURL=item-page-config.interface.js.map \ No newline at end of file diff --git a/src/config/item-page-config.interface.js.map b/src/config/item-page-config.interface.js.map new file mode 100644 index 0000000000..6072d59a34 --- /dev/null +++ b/src/config/item-page-config.interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"item-page-config.interface.js","sourceRoot":"","sources":["item-page-config.interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/config/lang-config.interface.js b/src/config/lang-config.interface.js new file mode 100644 index 0000000000..5cc007d8c3 --- /dev/null +++ b/src/config/lang-config.interface.js @@ -0,0 +1 @@ +//# sourceMappingURL=lang-config.interface.js.map \ No newline at end of file diff --git a/src/config/lang-config.interface.js.map b/src/config/lang-config.interface.js.map new file mode 100644 index 0000000000..3e866516f9 --- /dev/null +++ b/src/config/lang-config.interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-config.interface.js","sourceRoot":"","sources":["lang-config.interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/config/notifications-config.interfaces.js b/src/config/notifications-config.interfaces.js new file mode 100644 index 0000000000..e48d062de7 --- /dev/null +++ b/src/config/notifications-config.interfaces.js @@ -0,0 +1 @@ +//# sourceMappingURL=notifications-config.interfaces.js.map \ No newline at end of file diff --git a/src/config/notifications-config.interfaces.js.map b/src/config/notifications-config.interfaces.js.map new file mode 100644 index 0000000000..905d1b3748 --- /dev/null +++ b/src/config/notifications-config.interfaces.js.map @@ -0,0 +1 @@ +{"version":3,"file":"notifications-config.interfaces.js","sourceRoot":"","sources":["notifications-config.interfaces.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/config/server-config.interface.js b/src/config/server-config.interface.js new file mode 100644 index 0000000000..64efc0d513 --- /dev/null +++ b/src/config/server-config.interface.js @@ -0,0 +1 @@ +//# sourceMappingURL=server-config.interface.js.map \ No newline at end of file diff --git a/src/config/server-config.interface.js.map b/src/config/server-config.interface.js.map new file mode 100644 index 0000000000..043d6151ff --- /dev/null +++ b/src/config/server-config.interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"server-config.interface.js","sourceRoot":"","sources":["server-config.interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/config/submission-config.interface.js b/src/config/submission-config.interface.js new file mode 100644 index 0000000000..9b594514bd --- /dev/null +++ b/src/config/submission-config.interface.js @@ -0,0 +1 @@ +//# sourceMappingURL=submission-config.interface.js.map \ No newline at end of file diff --git a/src/config/submission-config.interface.js.map b/src/config/submission-config.interface.js.map new file mode 100644 index 0000000000..1a7258ce6b --- /dev/null +++ b/src/config/submission-config.interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"submission-config.interface.js","sourceRoot":"","sources":["submission-config.interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/config/universal-config.interface.js b/src/config/universal-config.interface.js new file mode 100644 index 0000000000..6f30188d10 --- /dev/null +++ b/src/config/universal-config.interface.js @@ -0,0 +1 @@ +//# sourceMappingURL=universal-config.interface.js.map \ No newline at end of file diff --git a/src/config/universal-config.interface.js.map b/src/config/universal-config.interface.js.map new file mode 100644 index 0000000000..998472c2f6 --- /dev/null +++ b/src/config/universal-config.interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"universal-config.interface.js","sourceRoot":"","sources":["universal-config.interface.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/main.browser.js b/src/main.browser.js new file mode 100644 index 0000000000..6e0957d874 --- /dev/null +++ b/src/main.browser.js @@ -0,0 +1,41 @@ +import 'zone.js/dist/zone'; +import 'reflect-metadata'; +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; +import { bootloader } from '@angularclass/bootloader'; +import { load as loadWebFont } from 'webfontloader'; +import { hasValue, isNotEmpty } from './app/shared/empty.util'; +import { BrowserAppModule } from './modules/app/browser-app.module'; +import { ENV_CONFIG } from './config'; +if (ENV_CONFIG.production) { + enableProdMode(); +} +export function main() { + // Load fonts async + // https://github.com/typekit/webfontloader#configuration + loadWebFont({ + google: { + families: ['Droid Sans'] + } + }); + addGoogleAnalytics(); + return platformBrowserDynamic().bootstrapModule(BrowserAppModule, { preserveWhitespaces: true }); +} +function addGoogleAnalytics() { + // Add google analytics if key is present in config + var trackingId = ENV_CONFIG.gaTrackingId; + if (isNotEmpty(trackingId)) { + var keyScript = document.createElement('script'); + keyScript.innerHTML = "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');" + + 'ga(\'create\', \'' + ENV_CONFIG.gaTrackingId + '\', \'auto\');'; + document.body.appendChild(keyScript); + } +} +// support async tag or hmr +if (hasValue(ENV_CONFIG.universal) && ENV_CONFIG.universal.preboot === false) { + bootloader(main); +} +else { + document.addEventListener('DOMContentLoaded', function () { return bootloader(main); }); +} +//# sourceMappingURL=main.browser.js.map \ No newline at end of file diff --git a/src/main.browser.js.map b/src/main.browser.js.map new file mode 100644 index 0000000000..9d38538972 --- /dev/null +++ b/src/main.browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main.browser.js","sourceRoot":"","sources":["main.browser.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,IAAI,UAAU,CAAC,UAAU,EAAE;IACzB,cAAc,EAAE,CAAC;CAClB;AAED,MAAM;IACJ,mBAAmB;IACnB,yDAAyD;IACzD,WAAW,CAAC;QACV,MAAM,EAAE;YACN,QAAQ,EAAE,CAAC,YAAY,CAAC;SACzB;KACF,CAAC,CAAC;IAEH,kBAAkB,EAAE,CAAC;IAErB,OAAO,sBAAsB,EAAE,CAAC,eAAe,CAAC,gBAAgB,EAAE,EAAC,mBAAmB,EAAC,IAAI,EAAC,CAAC,CAAC;AAChG,CAAC;AAED;IACE,mDAAmD;IACnD,IAAM,UAAU,GAAG,UAAU,CAAC,YAAY,CAAC;IAC3C,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;QAC1B,IAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACnD,SAAS,CAAC,SAAS,GAAK,uZAGmF;cACvG,mBAAmB,GAAG,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;QACrE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;KACtC;AACH,CAAC;AAED,2BAA2B;AAC3B,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,OAAO,KAAK,KAAK,EAAE;IAC5E,UAAU,CAAC,IAAI,CAAC,CAAC;CAClB;KAAM;IACL,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,cAAM,OAAA,UAAU,CAAC,IAAI,CAAC,EAAhB,CAAgB,CAAC,CAAC;CACvE"} \ No newline at end of file diff --git a/src/main.server.js b/src/main.server.js new file mode 100644 index 0000000000..976eb5803c --- /dev/null +++ b/src/main.server.js @@ -0,0 +1,4 @@ +import { startServer } from './server'; +import { ServerAppModule } from './modules/app/server-app.module'; +startServer(ServerAppModule); +//# sourceMappingURL=main.server.js.map \ No newline at end of file diff --git a/src/main.server.js.map b/src/main.server.js.map new file mode 100644 index 0000000000..e59e7a37a2 --- /dev/null +++ b/src/main.server.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main.server.js","sourceRoot":"","sources":["main.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,WAAW,CAAC,eAAe,CAAC,CAAC"} \ No newline at end of file diff --git a/src/modules/app/browser-app.module.js b/src/modules/app/browser-app.module.js new file mode 100644 index 0000000000..60bc96b56f --- /dev/null +++ b/src/modules/app/browser-app.module.js @@ -0,0 +1,85 @@ +import * as tslib_1 from "tslib"; +import { HttpClient, HttpClientModule } from '@angular/common/http'; +import { NgModule } from '@angular/core'; +import { BrowserModule, makeStateKey, TransferState } from '@angular/platform-browser'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { RouterModule } from '@angular/router'; +import { REQUEST } from '@nguniversal/express-engine/tokens'; +import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; +import { TranslateHttpLoader } from '@ngx-translate/http-loader'; +import { IdlePreload, IdlePreloadModule } from 'angular-idle-preload'; +import { AppComponent } from '../../app/app.component'; +import { AppModule } from '../../app/app.module'; +import { DSpaceBrowserTransferStateModule } from '../transfer-state/dspace-browser-transfer-state.module'; +import { DSpaceTransferState } from '../transfer-state/dspace-transfer-state.service'; +import { ClientCookieService } from '../../app/shared/services/client-cookie.service'; +import { CookieService } from '../../app/shared/services/cookie.service'; +import { AuthService } from '../../app/core/auth/auth.service'; +import { Angulartics2Module } from 'angulartics2'; +import { Angulartics2GoogleAnalytics } from 'angulartics2/ga'; +import { SubmissionService } from '../../app/submission/submission.service'; +export var REQ_KEY = makeStateKey('req'); +export function createTranslateLoader(http) { + return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); +} +export function getRequest(transferState) { + return transferState.get(REQ_KEY, {}); +} +var BrowserAppModule = /** @class */ (function () { + function BrowserAppModule(transferState) { + this.transferState = transferState; + this.transferState.transfer(); + } + BrowserAppModule = tslib_1.__decorate([ + NgModule({ + bootstrap: [AppComponent], + imports: [ + BrowserModule.withServerTransition({ + appId: 'dspace-angular' + }), + HttpClientModule, + // forRoot ensures the providers are only created once + IdlePreloadModule.forRoot(), + RouterModule.forRoot([], { + // enableTracing: true, + useHash: false, + preloadingStrategy: IdlePreload + }), + Angulartics2Module.forRoot([Angulartics2GoogleAnalytics]), + BrowserAnimationsModule, + DSpaceBrowserTransferStateModule, + TranslateModule.forRoot({ + loader: { + provide: TranslateLoader, + useFactory: (createTranslateLoader), + deps: [HttpClient] + } + }), + AppModule + ], + providers: [ + { + provide: REQUEST, + useFactory: getRequest, + deps: [TransferState] + }, + { + provide: AuthService, + useClass: AuthService + }, + { + provide: CookieService, + useClass: ClientCookieService + }, + { + provide: SubmissionService, + useClass: SubmissionService + } + ] + }), + tslib_1.__metadata("design:paramtypes", [DSpaceTransferState]) + ], BrowserAppModule); + return BrowserAppModule; +}()); +export { BrowserAppModule }; +//# sourceMappingURL=browser-app.module.js.map \ No newline at end of file diff --git a/src/modules/app/browser-app.module.js.map b/src/modules/app/browser-app.module.js.map new file mode 100644 index 0000000000..fbe8922fc1 --- /dev/null +++ b/src/modules/app/browser-app.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browser-app.module.js","sourceRoot":"","sources":["browser-app.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAA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AC,YAAY,CAAC;YACzB,OAAO,EAAE;gBACP,aAAa,CAAC,oBAAoB,CAAC;oBACjC,KAAK,EAAE,gBAAgB;iBACxB,CAAC;gBACF,gBAAgB;gBAChB,sDAAsD;gBACtD,iBAAiB,CAAC,OAAO,EAAE;gBAC3B,YAAY,CAAC,OAAO,CAAC,EAAE,EAAE;oBACvB,uBAAuB;oBACvB,OAAO,EAAE,KAAK;oBACd,kBAAkB,EAClB,WAAW;iBACZ,CAAC;gBACF,kBAAkB,CAAC,OAAO,CAAC,CAAC,2BAA2B,CAAC,CAAC;gBACzD,uBAAuB;gBACvB,gCAAgC;gBAChC,eAAe,CAAC,OAAO,CAAC;oBACtB,MAAM,EAAE;wBACN,OAAO,EAAE,eAAe;wBACxB,UAAU,EAAE,CAAC,qBAAqB,CAAC;wBACnC,IAAI,EAAE,CAAC,UAAU,CAAC;qBACnB;iBACF,CAAC;gBACF,SAAS;aACV;YACD,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,OAAO;oBAChB,UAAU,EAAE,UAAU;oBACtB,IAAI,EAAE,CAAC,aAAa,CAAC;iBACtB;gBACD;oBACE,OAAO,EAAE,WAAW;oBACpB,QAAQ,EAAE,WAAW;iBACtB;gBACD;oBACE,OAAO,EAAE,aAAa;oBACtB,QAAQ,EAAE,mBAAmB;iBAC9B;gBACD;oBACE,OAAO,EAAE,iBAAiB;oBAC1B,QAAQ,EAAE,iBAAiB;iBAC5B;aACF;SACF,CAAC;iDAGyB,mBAAmB;OAFjC,gBAAgB,CAM5B;IAAD,uBAAC;CAAA,AAND,IAMC;SANY,gBAAgB"} \ No newline at end of file diff --git a/src/modules/app/server-app.module.js b/src/modules/app/server-app.module.js new file mode 100644 index 0000000000..38ab19c0e2 --- /dev/null +++ b/src/modules/app/server-app.module.js @@ -0,0 +1,75 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ServerModule } from '@angular/platform-server'; +import { RouterModule } from '@angular/router'; +import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; +import { AppComponent } from '../../app/app.component'; +import { AppModule } from '../../app/app.module'; +import { DSpaceServerTransferStateModule } from '../transfer-state/dspace-server-transfer-state.module'; +import { DSpaceTransferState } from '../transfer-state/dspace-transfer-state.service'; +import { TranslateUniversalLoader } from '../translate-universal-loader'; +import { CookieService } from '../../app/shared/services/cookie.service'; +import { ServerCookieService } from '../../app/shared/services/server-cookie.service'; +import { AuthService } from '../../app/core/auth/auth.service'; +import { ServerAuthService } from '../../app/core/auth/server-auth.service'; +import { Angulartics2GoogleAnalytics } from 'angulartics2/ga'; +import { AngularticsMock } from '../../app/shared/mocks/mock-angulartics.service'; +import { SubmissionService } from '../../app/submission/submission.service'; +import { ServerSubmissionService } from '../../app/submission/server-submission.service'; +export function createTranslateLoader() { + return new TranslateUniversalLoader('dist/assets/i18n/', '.json'); +} +var ServerAppModule = /** @class */ (function () { + function ServerAppModule(transferState) { + this.transferState = transferState; + this.transferState.transfer(); + } + ServerAppModule = tslib_1.__decorate([ + NgModule({ + bootstrap: [AppComponent], + imports: [ + BrowserModule.withServerTransition({ + appId: 'dspace-angular' + }), + RouterModule.forRoot([], { + useHash: false + }), + NoopAnimationsModule, + DSpaceServerTransferStateModule, + TranslateModule.forRoot({ + loader: { + provide: TranslateLoader, + useFactory: (createTranslateLoader), + deps: [] + } + }), + ServerModule, + AppModule + ], + providers: [ + { + provide: Angulartics2GoogleAnalytics, + useClass: AngularticsMock + }, + { + provide: AuthService, + useClass: ServerAuthService + }, + { + provide: CookieService, + useClass: ServerCookieService + }, + { + provide: SubmissionService, + useClass: ServerSubmissionService + }, + ] + }), + tslib_1.__metadata("design:paramtypes", [DSpaceTransferState]) + ], ServerAppModule); + return ServerAppModule; +}()); +export { ServerAppModule }; +//# sourceMappingURL=server-app.module.js.map \ No newline at end of file diff --git a/src/modules/app/server-app.module.js.map b/src/modules/app/server-app.module.js.map new file mode 100644 index 0000000000..0e08849b48 --- /dev/null +++ b/src/modules/app/server-app.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"server-app.module.js","sourceRoot":"","sources":["server-app.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,uDAAuD,CAAC;AACxG,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAEtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,MAAM;IACJ,OAAO,IAAI,wBAAwB,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;AACpE,CAAC;AA0CD;IACE,yBACU,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;QAE1C,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IAChC,CAAC;IALU,eAAe;QAxC3B,QAAQ,CAAC;YACR,SAAS,EAAE,CAAC,YAAY,CAAC;YACzB,OAAO,EAAE;gBACP,aAAa,CAAC,oBAAoB,CAAC;oBACjC,KAAK,EAAE,gBAAgB;iBACxB,CAAC;gBACF,YAAY,CAAC,OAAO,CAAC,EAAE,EAAE;oBACvB,OAAO,EAAE,KAAK;iBACf,CAAC;gBACF,oBAAoB;gBACpB,+BAA+B;gBAC/B,eAAe,CAAC,OAAO,CAAC;oBACtB,MAAM,EAAE;wBACN,OAAO,EAAE,eAAe;wBACxB,UAAU,EAAE,CAAC,qBAAqB,CAAC;wBACnC,IAAI,EAAE,EAAE;qBACT;iBACF,CAAC;gBACF,YAAY;gBACZ,SAAS;aACV;YACD,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,2BAA2B;oBACpC,QAAQ,EAAE,eAAe;iBAC1B;gBACD;oBACE,OAAO,EAAE,WAAW;oBACpB,QAAQ,EAAE,iBAAiB;iBAC5B;gBACD;oBACE,OAAO,EAAE,aAAa;oBACtB,QAAQ,EAAE,mBAAmB;iBAC9B;gBACD;oBACE,OAAO,EAAE,iBAAiB;oBAC1B,QAAQ,EAAE,uBAAuB;iBAClC;aACF;SACF,CAAC;iDAGyB,mBAAmB;OAFjC,eAAe,CAM3B;IAAD,sBAAC;CAAA,AAND,IAMC;SANY,eAAe"} \ No newline at end of file diff --git a/src/modules/transfer-state/dspace-browser-transfer-state.module.js b/src/modules/transfer-state/dspace-browser-transfer-state.module.js new file mode 100644 index 0000000000..5e64af701d --- /dev/null +++ b/src/modules/transfer-state/dspace-browser-transfer-state.module.js @@ -0,0 +1,22 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { BrowserTransferStateModule } from '@angular/platform-browser'; +import { DSpaceBrowserTransferState } from './dspace-browser-transfer-state.service'; +import { DSpaceTransferState } from './dspace-transfer-state.service'; +var DSpaceBrowserTransferStateModule = /** @class */ (function () { + function DSpaceBrowserTransferStateModule() { + } + DSpaceBrowserTransferStateModule = tslib_1.__decorate([ + NgModule({ + imports: [ + BrowserTransferStateModule + ], + providers: [ + { provide: DSpaceTransferState, useClass: DSpaceBrowserTransferState } + ] + }) + ], DSpaceBrowserTransferStateModule); + return DSpaceBrowserTransferStateModule; +}()); +export { DSpaceBrowserTransferStateModule }; +//# sourceMappingURL=dspace-browser-transfer-state.module.js.map \ No newline at end of file diff --git a/src/modules/transfer-state/dspace-browser-transfer-state.module.js.map b/src/modules/transfer-state/dspace-browser-transfer-state.module.js.map new file mode 100644 index 0000000000..6ec3b7eefe --- /dev/null +++ b/src/modules/transfer-state/dspace-browser-transfer-state.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-browser-transfer-state.module.js","sourceRoot":"","sources":["dspace-browser-transfer-state.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAUtE;IAAA;IAEA,CAAC;IAFY,gCAAgC;QAR5C,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,0BAA0B;aAC3B;YACD,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,0BAA0B,EAAE;aACvE;SACF,CAAC;OACW,gCAAgC,CAE5C;IAAD,uCAAC;CAAA,AAFD,IAEC;SAFY,gCAAgC"} \ No newline at end of file diff --git a/src/modules/transfer-state/dspace-browser-transfer-state.service.js b/src/modules/transfer-state/dspace-browser-transfer-state.service.js new file mode 100644 index 0000000000..774e8d1790 --- /dev/null +++ b/src/modules/transfer-state/dspace-browser-transfer-state.service.js @@ -0,0 +1,21 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { StoreAction, StoreActionTypes } from '../../app/store.actions'; +import { DSpaceTransferState } from './dspace-transfer-state.service'; +var DSpaceBrowserTransferState = /** @class */ (function (_super) { + tslib_1.__extends(DSpaceBrowserTransferState, _super); + function DSpaceBrowserTransferState() { + return _super !== null && _super.apply(this, arguments) || this; + } + DSpaceBrowserTransferState.prototype.transfer = function () { + var state = this.transferState.get(DSpaceTransferState.NGRX_STATE, null); + this.transferState.remove(DSpaceTransferState.NGRX_STATE); + this.store.dispatch(new StoreAction(StoreActionTypes.REHYDRATE, state)); + }; + DSpaceBrowserTransferState = tslib_1.__decorate([ + Injectable() + ], DSpaceBrowserTransferState); + return DSpaceBrowserTransferState; +}(DSpaceTransferState)); +export { DSpaceBrowserTransferState }; +//# sourceMappingURL=dspace-browser-transfer-state.service.js.map \ No newline at end of file diff --git a/src/modules/transfer-state/dspace-browser-transfer-state.service.js.map b/src/modules/transfer-state/dspace-browser-transfer-state.service.js.map new file mode 100644 index 0000000000..b3f9e66d28 --- /dev/null +++ b/src/modules/transfer-state/dspace-browser-transfer-state.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-browser-transfer-state.service.js","sourceRoot":"","sources":["dspace-browser-transfer-state.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE;IAAgD,sDAAmB;IAAnE;;IAMA,CAAC;IALC,6CAAQ,GAAR;QACE,IAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAM,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAChF,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC1D,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAC1E,CAAC;IALU,0BAA0B;QADtC,UAAU,EAAE;OACA,0BAA0B,CAMtC;IAAD,iCAAC;CAAA,AAND,CAAgD,mBAAmB,GAMlE;SANY,0BAA0B"} \ No newline at end of file diff --git a/src/modules/transfer-state/dspace-server-transfer-state.module.js b/src/modules/transfer-state/dspace-server-transfer-state.module.js new file mode 100644 index 0000000000..25e4fbad35 --- /dev/null +++ b/src/modules/transfer-state/dspace-server-transfer-state.module.js @@ -0,0 +1,22 @@ +import * as tslib_1 from "tslib"; +import { NgModule } from '@angular/core'; +import { ServerTransferStateModule } from '@angular/platform-server'; +import { DSpaceServerTransferState } from './dspace-server-transfer-state.service'; +import { DSpaceTransferState } from './dspace-transfer-state.service'; +var DSpaceServerTransferStateModule = /** @class */ (function () { + function DSpaceServerTransferStateModule() { + } + DSpaceServerTransferStateModule = tslib_1.__decorate([ + NgModule({ + imports: [ + ServerTransferStateModule + ], + providers: [ + { provide: DSpaceTransferState, useClass: DSpaceServerTransferState } + ] + }) + ], DSpaceServerTransferStateModule); + return DSpaceServerTransferStateModule; +}()); +export { DSpaceServerTransferStateModule }; +//# sourceMappingURL=dspace-server-transfer-state.module.js.map \ No newline at end of file diff --git a/src/modules/transfer-state/dspace-server-transfer-state.module.js.map b/src/modules/transfer-state/dspace-server-transfer-state.module.js.map new file mode 100644 index 0000000000..e404b85d9f --- /dev/null +++ b/src/modules/transfer-state/dspace-server-transfer-state.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-server-transfer-state.module.js","sourceRoot":"","sources":["dspace-server-transfer-state.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAUtE;IAAA;IAEA,CAAC;IAFY,+BAA+B;QAR3C,QAAQ,CAAC;YACR,OAAO,EAAE;gBACP,yBAAyB;aAC1B;YACD,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,yBAAyB,EAAE;aACtE;SACF,CAAC;OACW,+BAA+B,CAE3C;IAAD,sCAAC;CAAA,AAFD,IAEC;SAFY,+BAA+B"} \ No newline at end of file diff --git a/src/modules/transfer-state/dspace-server-transfer-state.service.js b/src/modules/transfer-state/dspace-server-transfer-state.service.js new file mode 100644 index 0000000000..01dccefa1d --- /dev/null +++ b/src/modules/transfer-state/dspace-server-transfer-state.service.js @@ -0,0 +1,26 @@ +import * as tslib_1 from "tslib"; +import { take } from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import { DSpaceTransferState } from './dspace-transfer-state.service'; +var DSpaceServerTransferState = /** @class */ (function (_super) { + tslib_1.__extends(DSpaceServerTransferState, _super); + function DSpaceServerTransferState() { + return _super !== null && _super.apply(this, arguments) || this; + } + DSpaceServerTransferState.prototype.transfer = function () { + var _this = this; + this.transferState.onSerialize(DSpaceTransferState.NGRX_STATE, function () { + var state; + _this.store.pipe(take(1)).subscribe(function (saveState) { + state = saveState; + }); + return state; + }); + }; + DSpaceServerTransferState = tslib_1.__decorate([ + Injectable() + ], DSpaceServerTransferState); + return DSpaceServerTransferState; +}(DSpaceTransferState)); +export { DSpaceServerTransferState }; +//# sourceMappingURL=dspace-server-transfer-state.service.js.map \ No newline at end of file diff --git a/src/modules/transfer-state/dspace-server-transfer-state.service.js.map b/src/modules/transfer-state/dspace-server-transfer-state.service.js.map new file mode 100644 index 0000000000..d29d9a3a81 --- /dev/null +++ b/src/modules/transfer-state/dspace-server-transfer-state.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-server-transfer-state.service.js","sourceRoot":"","sources":["dspace-server-transfer-state.service.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE;IAA+C,qDAAmB;IAAlE;;IAWA,CAAC;IAVC,4CAAQ,GAAR;QAAA,iBASC;QARC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,mBAAmB,CAAC,UAAU,EAAE;YAC7D,IAAI,KAAK,CAAC;YACV,KAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,UAAC,SAAc;gBAChD,KAAK,GAAG,SAAS,CAAC;YACpB,CAAC,CAAC,CAAC;YAEH,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IAVU,yBAAyB;QADrC,UAAU,EAAE;OACA,yBAAyB,CAWrC;IAAD,gCAAC;CAAA,AAXD,CAA+C,mBAAmB,GAWjE;SAXY,yBAAyB"} \ No newline at end of file diff --git a/src/modules/transfer-state/dspace-transfer-state.service.js b/src/modules/transfer-state/dspace-transfer-state.service.js new file mode 100644 index 0000000000..434e48201e --- /dev/null +++ b/src/modules/transfer-state/dspace-transfer-state.service.js @@ -0,0 +1,19 @@ +import * as tslib_1 from "tslib"; +import { Injectable } from '@angular/core'; +import { makeStateKey, TransferState } from '@angular/platform-browser'; +import { Store } from '@ngrx/store'; +var DSpaceTransferState = /** @class */ (function () { + function DSpaceTransferState(transferState, store) { + this.transferState = transferState; + this.store = store; + } + DSpaceTransferState.NGRX_STATE = makeStateKey('NGRX_STATE'); + DSpaceTransferState = tslib_1.__decorate([ + Injectable(), + tslib_1.__metadata("design:paramtypes", [TransferState, + Store]) + ], DSpaceTransferState); + return DSpaceTransferState; +}()); +export { DSpaceTransferState }; +//# sourceMappingURL=dspace-transfer-state.service.js.map \ No newline at end of file diff --git a/src/modules/transfer-state/dspace-transfer-state.service.js.map b/src/modules/transfer-state/dspace-transfer-state.service.js.map new file mode 100644 index 0000000000..88c5123d45 --- /dev/null +++ b/src/modules/transfer-state/dspace-transfer-state.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dspace-transfer-state.service.js","sourceRoot":"","sources":["dspace-transfer-state.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIpC;IAIE,6BACY,aAA4B,EAC5B,KAAsB;QADtB,kBAAa,GAAb,aAAa,CAAe;QAC5B,UAAK,GAAL,KAAK,CAAiB;IAElC,CAAC;IANgB,8BAAU,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;IAFrC,mBAAmB;QADxC,UAAU,EAAE;iDAMgB,aAAa;YACrB,KAAK;OANJ,mBAAmB,CAWxC;IAAD,0BAAC;CAAA,AAXD,IAWC;SAXqB,mBAAmB"} \ No newline at end of file diff --git a/src/modules/translate-universal-loader.js b/src/modules/translate-universal-loader.js new file mode 100644 index 0000000000..6cac95a730 --- /dev/null +++ b/src/modules/translate-universal-loader.js @@ -0,0 +1,20 @@ +import { Observable } from 'rxjs'; +import * as fs from 'fs'; +var TranslateUniversalLoader = /** @class */ (function () { + function TranslateUniversalLoader(prefix, suffix) { + if (prefix === void 0) { prefix = 'dist/assets/i18n/'; } + if (suffix === void 0) { suffix = '.json'; } + this.prefix = prefix; + this.suffix = suffix; + } + TranslateUniversalLoader.prototype.getTranslation = function (lang) { + var _this = this; + return Observable.create(function (observer) { + observer.next(JSON.parse(fs.readFileSync("" + _this.prefix + lang + _this.suffix, 'utf8'))); + observer.complete(); + }); + }; + return TranslateUniversalLoader; +}()); +export { TranslateUniversalLoader }; +//# sourceMappingURL=translate-universal-loader.js.map \ No newline at end of file diff --git a/src/modules/translate-universal-loader.js.map b/src/modules/translate-universal-loader.js.map new file mode 100644 index 0000000000..eb0c1e40f4 --- /dev/null +++ b/src/modules/translate-universal-loader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"translate-universal-loader.js","sourceRoot":"","sources":["translate-universal-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB;IAEE,kCAAoB,MAAoC,EAAU,MAAwB;QAAtE,uBAAA,EAAA,4BAAoC;QAAU,uBAAA,EAAA,gBAAwB;QAAtE,WAAM,GAAN,MAAM,CAA8B;QAAU,WAAM,GAAN,MAAM,CAAkB;IAAI,CAAC;IAExF,iDAAc,GAArB,UAAsB,IAAY;QAAlC,iBAKC;QAJC,OAAO,UAAU,CAAC,MAAM,CAAC,UAAC,QAAa;YACrC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,KAAG,KAAI,CAAC,MAAM,GAAG,IAAI,GAAG,KAAI,CAAC,MAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;YAC1F,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC;IAEH,+BAAC;AAAD,CAAC,AAXD,IAWC"} \ No newline at end of file diff --git a/src/routes.js b/src/routes.js new file mode 100644 index 0000000000..296b892486 --- /dev/null +++ b/src/routes.js @@ -0,0 +1,16 @@ +export var ROUTES = [ + 'home', + 'items/:id', + 'login', + 'logout', + 'collections/:id', + 'communities/:id', + 'login', + 'logout', + 'search', + 'submit', + 'workspaceitems/:id/edit', + 'workflowitems/:id/edit', + '**' +]; +//# sourceMappingURL=routes.js.map \ No newline at end of file diff --git a/src/routes.js.map b/src/routes.js.map new file mode 100644 index 0000000000..85ad1043f9 --- /dev/null +++ b/src/routes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"routes.js","sourceRoot":"","sources":["routes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,MAAM,GAAa;IAC9B,MAAM;IACN,WAAW;IACX,OAAO;IACP,QAAQ;IACR,iBAAiB;IACjB,iBAAiB;IACjB,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,yBAAyB;IACzB,wBAAwB;IACxB,IAAI;CACL,CAAC"} \ No newline at end of file diff --git a/src/server.js b/src/server.js new file mode 100644 index 0000000000..4090403129 --- /dev/null +++ b/src/server.js @@ -0,0 +1,129 @@ +import 'zone.js/dist/zone-node'; +import 'reflect-metadata'; +import 'rxjs'; +import * as fs from 'fs'; +import * as pem from 'pem'; +import * as https from 'https'; +import * as morgan from 'morgan'; +import * as express from 'express'; +import * as bodyParser from 'body-parser'; +import * as compression from 'compression'; +import * as cookieParser from 'cookie-parser'; +import { enableProdMode } from '@angular/core'; +import { ngExpressEngine } from '@nguniversal/express-engine'; +import { ROUTES } from './routes'; +import { ENV_CONFIG } from './config'; +import { REQUEST, RESPONSE } from '@nguniversal/express-engine/tokens'; +export function startServer(bootstrap) { + var app = express(); + if (ENV_CONFIG.production) { + enableProdMode(); + app.use(compression()); + } + app.use(morgan('dev')); + app.use(cookieParser()); + app.use(bodyParser.json()); + app.engine('html', function (_, options, callback) { + return ngExpressEngine({ + bootstrap: bootstrap, + providers: [ + { + provide: REQUEST, + useValue: options.req, + }, + { + provide: RESPONSE, + useValue: options.req.res, + }, + ], + })(_, options, callback); + }); + app.set('view engine', 'html'); + app.set('views', 'src'); + function cacheControl(req, res, next) { + // instruct browser to revalidate + res.header('Cache-Control', ENV_CONFIG.cache.control || 'max-age=60'); + next(); + } + app.use('/', cacheControl, express.static('dist', { index: false })); + // TODO: either remove or update mock backend + // app.get('/data.json', serverApi); + // app.use('/api', createMockApi()); + function ngApp(req, res) { + function onHandleError(parentZoneDelegate, currentZone, targetZone, error) { + if (!res._headerSent) { + console.warn('Error in SSR, serving for direct CSR'); + res.sendFile('index.csr.html', { root: './src' }); + } + } + if (ENV_CONFIG.universal.preboot) { + Zone.current.fork({ name: 'CSR fallback', onHandleError: onHandleError }).run(function () { + res.render('../dist/index', { + req: req, + res: res, + preboot: ENV_CONFIG.universal.preboot, + async: ENV_CONFIG.universal.async, + time: ENV_CONFIG.universal.time, + baseUrl: ENV_CONFIG.ui.nameSpace, + originUrl: ENV_CONFIG.ui.baseUrl, + requestUrl: req.originalUrl + }); + }); + } + else { + console.log('Universal off, serving for direct CSR'); + res.sendFile('index.csr.html', { root: './src' }); + } + } + ROUTES.forEach(function (route) { + app.get(route, ngApp); + }); + function serverStarted() { + console.log("[" + new Date().toTimeString() + "] Listening at " + ENV_CONFIG.ui.baseUrl); + } + function createHttpsServer(keys) { + https.createServer({ + key: keys.serviceKey, + cert: keys.certificate + }, app).listen(ENV_CONFIG.ui.port, ENV_CONFIG.ui.host, function () { + serverStarted(); + }); + } + if (ENV_CONFIG.ui.ssl) { + var serviceKey = void 0; + try { + serviceKey = fs.readFileSync('./config/ssl/key.pem'); + } + catch (e) { + console.warn('Service key not found at ./config/ssl/key.pem'); + } + var certificate = void 0; + try { + certificate = fs.readFileSync('./config/ssl/cert.pem'); + } + catch (e) { + console.warn('Certificate not found at ./config/ssl/key.pem'); + } + if (serviceKey && certificate) { + createHttpsServer({ + serviceKey: serviceKey, + certificate: certificate + }); + } + else { + process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; + pem.createCertificate({ + days: 1, + selfSigned: true + }, function (error, keys) { + createHttpsServer(keys); + }); + } + } + else { + app.listen(ENV_CONFIG.ui.port, ENV_CONFIG.ui.host, function () { + serverStarted(); + }); + } +} +//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/src/server.js.map b/src/server.js.map new file mode 100644 index 0000000000..8dbac3e4ea --- /dev/null +++ b/src/server.js.map @@ -0,0 +1 @@ +{"version":3,"file":"server.js","sourceRoot":"","sources":["server.ts"],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