mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
feat(handlebars plugin): adding handlebars helpers for common math operations (#20648)
* feat(plugin-chart-handlebars): add common helpers * add import * add declare module Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import Handlebars from 'handlebars';
|
||||
import moment from 'moment';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { isPlainObject } from 'lodash';
|
||||
import Helpers from 'just-handlebars-helpers';
|
||||
|
||||
export interface HandlebarsViewerProps {
|
||||
templateSource: string;
|
||||
@@ -73,3 +74,5 @@ Handlebars.registerHelper('stringify', (obj: any, obj2: any) => {
|
||||
throw Error('Please call with an object. Example: `stringify myObj`');
|
||||
return isPlainObject(obj) ? JSON.stringify(obj) : String(obj);
|
||||
});
|
||||
|
||||
Helpers.registerHelpers(Handlebars);
|
||||
|
||||
Reference in New Issue
Block a user