@hestia-earth/ui-components 0.41.15 → 0.41.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5191,8 +5191,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
5191
5191
  args: [{ selector: 'he-bibliographies-search-confirm', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, ReactiveFormsModule, NgbHighlight, NgTemplateOutlet, HESvgIconComponent], template: "<div class=\"modal is-large is-active\">\n <div class=\"modal-background\"></div>\n <div class=\"modal-card\">\n <header class=\"modal-card-head\">\n <p class=\"modal-card-title\">Search Bibliographies</p>\n <button class=\"delete is-small\" aria-label=\"close\" type=\"button\" (click)=\"cancel()\"></button>\n </header>\n <section class=\"modal-card-body\">\n <form [formGroup]=\"formGroup\" novalidate>\n <div class=\"field has-addons\">\n <div class=\"control is-expanded has-icons-right\">\n <input\n class=\"input search-input\"\n [attr.placeholder]=\"'Search bibliography by ' + searchBy()\"\n formControlName=\"search\"\n name=\"bibliography\"\n autocomplete=\"off\"\n (focus)=\"searchFocus($event)\" />\n <a class=\"icon is-small is-right\" [class.is-hidden]=\"loading()\" (click)=\"resetSearch()\">\n <he-svg-icon name=\"xmark\" />\n </a>\n\n <span class=\"icon is-right has-text-grey-dark\" [class.is-hidden]=\"!loading()\">\n <he-svg-icon name=\"loading\" animation=\"spin\" size=\"20\" />\n </span>\n </div>\n </div>\n </form>\n\n <div class=\"is-mt-2\">\n <span [class.is-hidden]=\"loading() || !searchControl?.value || hasResults()\">\n No bibliographies found matching query.\n </span>\n\n <ul>\n @for (result of results(); track result) {\n <li>\n <a\n class=\"is-block p-1 search-result\"\n (click)=\"selectedResult.set(result)\"\n [class.is-active]=\"selectedResult() === result\">\n <ngb-highlight [result]=\"result.bibliography?.title ?? result.title\" [term]=\"searchControl?.value\" />\n <span class=\"px-1\">-</span>\n <span class=\"px-1\">\n <i>{{ result.name }}</i>\n </span>\n @if (result.bibliography?.documentDOI || result.documentDOI) {\n <span class=\"px-1\">\n -\n <b>documentDOI:</b>\n </span>\n }\n <ngb-highlight\n [result]=\"result.bibliography?.documentDOI ?? result.documentDOI\"\n [term]=\"searchControl?.value\" />\n @if (result.bibliography?.scopus || result.scopus) {\n <span class=\"px-1\">\n -\n <b>scopus:</b>\n </span>\n }\n <ngb-highlight [result]=\"result.bibliography?.scopus ?? result.scopus\" [term]=\"searchControl?.value\" />\n <span>\n <ng-container\n *ngTemplateOutlet=\"\n mendeleyLink;\n context: { $implicit: result.bibliography?.mendeleyID ?? result.mendeleyID }\n \" />\n </span>\n </a>\n </li>\n }\n </ul>\n </div>\n </section>\n <footer class=\"modal-card-foot\">\n <button class=\"button is-primary\" (click)=\"confirm()\" [disabled]=\"!selectedResult()\">\n <span>Confirm</span>\n </button>\n <button class=\"button is-ghost\" (click)=\"cancel()\">\n <span>Close</span>\n </button>\n </footer>\n </div>\n</div>\n\n<ng-template #mendeleyLink let-id>\n @if (id) {\n <a [href]=\"'https://www.mendeley.com/catalogue/' + id\" target=\"_blank\" (click)=\"$event.stopPropagation()\">\n <he-svg-icon name=\"external-link\" class=\"ml-2\" />\n </a>\n }\n</ng-template>\n", styles: ["ngb-highlight,span{vertical-align:middle;white-space:normal;width:auto}\n"] }]
5192
5192
  }], ctorParameters: () => [], propDecorators: { search: [{ type: i0.Input, args: [{ isSignal: true, alias: "search", required: false }] }, { type: i0.Output, args: ["searchChange"] }], searchSources: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchSources", required: false }] }, { type: i0.Output, args: ["searchSourcesChange"] }], searchBibliographies: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchBibliographies", required: false }] }, { type: i0.Output, args: ["searchBibliographiesChange"] }], searchBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchBy", required: false }] }, { type: i0.Output, args: ["searchByChange"] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
5193
5193
 
5194
+ // show label 8px from bar
5195
+ const gapX = 8;
5196
+ const placementGap = (placement) => (placement === 'right' ? +gapX : -gapX);
5197
+ const placementX = (x, chart, data, placement) => placement === 'right' ? (data < 0 ? positionAtZero(chart) : x) : x;
5198
+ const positionAtZero = (chart) => chart.scales.x.getPixelForValue(0);
5194
5199
  const defaultBarDrawSettings = {
5195
- xPosFn: (x, index, width, chart, data) => (data < 0 || isEmpty(data) ? chart.scales.x.getPixelForValue(0) : x) + 10,
5200
+ placement: 'right',
5201
+ xPosFn: (x, index, width, chart, data, placement) => (isEmpty(data) ? positionAtZero(chart) : placementX(x, chart, data, placement)) + placementGap(placement),
5196
5202
  yPosFn: y => y + 3,
5197
5203
  colorFn: (m, index, chart, data) => (isUndefined(data) ? '#b5b5b5' : '#4a4a4a'),
5198
5204
  textFn: ({ data }) => `${data}`,
@@ -5200,13 +5206,25 @@ const defaultBarDrawSettings = {
5200
5206
  maxWidth: 90,
5201
5207
  emptyValueLabel: 'No data'
5202
5208
  };
5209
+ const drawText = (ctx, { text, font, fillStyle, placement, xPos, yPos, maxWidth }) => {
5210
+ ctx.font = font;
5211
+ ctx.fillStyle = fillStyle;
5212
+ ctx.textAlign = placement === 'left' ? 'right' : 'left';
5213
+ if (Array.isArray(text)) {
5214
+ ctx.fillText(text[0], xPos, yPos - 5, maxWidth);
5215
+ ctx.fillText(text[1], xPos, yPos + 5, maxWidth);
5216
+ }
5217
+ else {
5218
+ ctx.fillText(text, xPos, yPos, maxWidth);
5219
+ }
5220
+ };
5203
5221
  const afterBarDrawPlugin = settings => ({
5204
- id: 'afterBarDrawPlugin',
5222
+ id: ['afterBarDrawPlugin', settings?.placement].filter(Boolean).join('-'),
5205
5223
  afterDatasetsDraw: (chart) => {
5206
5224
  if (!chart.data.datasets?.length) {
5207
5225
  return;
5208
5226
  }
5209
- const { xPosFn, yPosFn, colorFn, textFn, maxWidth, font, emptyValueLabel } = {
5227
+ const { placement, xPosFn, yPosFn, colorFn, textFn, maxWidth, font, emptyValueLabel } = {
5210
5228
  ...defaultBarDrawSettings,
5211
5229
  ...(settings ?? {})
5212
5230
  };
@@ -5218,24 +5236,25 @@ const afterBarDrawPlugin = settings => ({
5218
5236
  elements
5219
5237
  .filter(element => !element.skip)
5220
5238
  .forEach((element, index) => {
5221
- const { x, y } = element;
5239
+ const { x, y, base } = element;
5222
5240
  const label = chart.data.labels?.[index] ?? '';
5223
5241
  const data = dataset.data[index];
5224
- const xPos = xPosFn(x, index, width, chart, data);
5225
- const yPos = yPosFn(y, index, height, chart, data);
5242
+ const anchorX = placement === 'left' ? base : x;
5243
+ const xPos = xPosFn(anchorX, index, width, chart, data, placement);
5244
+ const yPos = yPosFn(y, index, height, chart, data, placement);
5226
5245
  const text = isUndefined(data) ? emptyValueLabel : textFn({ label, data }, index, chart);
5227
- if (text) {
5228
- ctx.font = font;
5229
- ctx.fillStyle = colorFn(element.options, index, chart, data);
5230
- if (Array.isArray(text)) {
5231
- ctx.fillText(text[0], xPos, yPos - 5, maxWidth);
5232
- ctx.fillText(text[1], xPos, yPos + 5, maxWidth);
5233
- }
5234
- else {
5235
- ctx.fillText(text, xPos, yPos, maxWidth);
5236
- }
5237
- }
5246
+ text &&
5247
+ drawText(ctx, {
5248
+ text,
5249
+ font,
5250
+ fillStyle: colorFn(element.options, index, chart, data),
5251
+ placement,
5252
+ xPos,
5253
+ yPos,
5254
+ maxWidth
5255
+ });
5238
5256
  });
5257
+ ctx.restore();
5239
5258
  }
5240
5259
  });
5241
5260
 
@@ -10071,7 +10090,6 @@ class EngineModelsStageDeepComponent {
10071
10090
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: EngineModelsStageDeepComponent, decorators: [{
10072
10091
  type: Component$1,
10073
10092
  args: [{ selector: 'he-engine-models-stage-deep', imports: [
10074
- DatePipe,
10075
10093
  KeyToLabelPipe,
10076
10094
  HESvgIconComponent,
10077
10095
  NgbPopoverModule,