From bd15a2ed8996cbf246bd5c47a01b71f798a114b5 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Fri, 12 Jan 2018 18:14:00 +0530 Subject: [PATCH 01/58] database import --- classes/Visualizer/Module/Chart.php | 120 ++++++- classes/Visualizer/Module/Setup.php | 64 ++++ classes/Visualizer/Plugin.php | 11 +- classes/Visualizer/Render/Layout.php | 355 +++++++++++++++++++++ classes/Visualizer/Render/Page/Data.php | 67 +++- classes/Visualizer/Source/Query.php | 185 +++++++++++ classes/Visualizer/Source/Query/Params.php | 333 +++++++++++++++++++ css/frame.css | 17 + index.php | 6 +- js/frame.js | 200 ++++++++++++ 10 files changed, 1350 insertions(+), 8 deletions(-) create mode 100644 classes/Visualizer/Render/Layout.php create mode 100644 classes/Visualizer/Source/Query.php create mode 100644 classes/Visualizer/Source/Query/Params.php diff --git a/classes/Visualizer/Module/Chart.php b/classes/Visualizer/Module/Chart.php index 590d7083..2979002c 100644 --- a/classes/Visualizer/Module/Chart.php +++ b/classes/Visualizer/Module/Chart.php @@ -57,9 +57,13 @@ public function __construct( Visualizer_Plugin $plugin ) { $this->_addAjaxAction( Visualizer_Plugin::ACTION_EDIT_CHART, 'renderChartPages' ); $this->_addAjaxAction( Visualizer_Plugin::ACTION_UPLOAD_DATA, 'uploadData' ); $this->_addAjaxAction( Visualizer_Plugin::ACTION_CLONE_CHART, 'cloneChart' ); - // Added by Ash/Upwork $this->_addAjaxAction( Visualizer_Plugin::ACTION_EXPORT_DATA, 'exportData' ); - // Added by Ash/Upwork + + if ( strpos( VISUALIZER_ENABLE_BETA_FEATURES, 'dbwizard' ) !== false ) { + $this->_addAjaxAction( Visualizer_Plugin::ACTION_FETCH_DB_COLS, 'getTableColumns' ); + $this->_addAjaxAction( Visualizer_Plugin::ACTION_FETCH_DB_DATA, 'getTableData' ); + $this->_addAjaxAction( Visualizer_Plugin::ACTION_SAVE_DB_QUERY, 'saveQuery' ); + } } /** @@ -237,6 +241,10 @@ public function renderChartPages() { wp_register_script( 'visualizer-chosen', VISUALIZER_ABSURL . 'js/lib/chosen.jquery.min.js', array( 'jquery' ), Visualizer_Plugin::VERSION ); wp_register_style( 'visualizer-chosen', VISUALIZER_ABSURL . 'css/lib/chosen.min.css', array(), Visualizer_Plugin::VERSION ); + wp_register_script( 'visualizer-datatables', '//cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js', array( 'jquery-ui-core' ), Visualizer_Plugin::VERSION ); + wp_register_style( 'visualizer-datatables', '//cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css', array(), Visualizer_Plugin::VERSION ); + wp_register_style( 'visualizer-datatables-ui', '//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css', array( 'visualizer-datatables' ), Visualizer_Plugin::VERSION ); + wp_register_style( 'visualizer-frame', VISUALIZER_ABSURL . 'css/frame.css', array( 'visualizer-chosen' ), Visualizer_Plugin::VERSION ); wp_register_script( 'visualizer-frame', VISUALIZER_ABSURL . 'js/frame.js', array( 'visualizer-chosen' ), Visualizer_Plugin::VERSION, true ); wp_register_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); @@ -286,6 +294,7 @@ private function _handleDataAndSettingsPage() { update_option( 'visualizer-map-api-key', $_POST['map_api_key'] ); } if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'] ) ) { + error_log("idhar! " . print_r($_POST,true)); if ( $this->_chart->post_status == 'auto-draft' ) { $this->_chart->post_status = 'publish'; wp_update_post( $this->_chart->to_array() ); @@ -316,6 +325,13 @@ private function _handleDataAndSettingsPage() { wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'visualizer-frame' ); wp_enqueue_script( 'visualizer-preview' ); + + if ( strpos( VISUALIZER_ENABLE_BETA_FEATURES, 'dbwizard' ) !== false ) { + wp_enqueue_script( 'visualizer-chosen' ); + wp_enqueue_script( 'visualizer-datatables' ); + wp_enqueue_style( 'visualizer-datatables-ui' ); + } + wp_enqueue_script( 'visualizer-render' ); wp_localize_script( 'visualizer-render', 'visualizer', array( @@ -325,15 +341,43 @@ private function _handleDataAndSettingsPage() { ), 'charts' => array( 'canvas' => $data, + 'id' => $this->_chart->ID, ), 'map_api_key' => get_option( 'visualizer-map-api-key' ), 'ajax' => array( 'url' => admin_url( 'admin-ajax.php' ), 'nonces' => array( 'permissions' => wp_create_nonce( Visualizer_Plugin::ACTION_FETCH_PERMISSIONS_DATA ), + 'db_get_cols' => wp_create_nonce( Visualizer_Plugin::ACTION_FETCH_DB_COLS . Visualizer_Plugin::VERSION ), + 'db_get_data' => wp_create_nonce( Visualizer_Plugin::ACTION_FETCH_DB_DATA . Visualizer_Plugin::VERSION ), ), 'actions' => array( 'permissions' => Visualizer_Plugin::ACTION_FETCH_PERMISSIONS_DATA, + 'db_get_cols' => Visualizer_Plugin::ACTION_FETCH_DB_COLS, + 'db_get_data' => Visualizer_Plugin::ACTION_FETCH_DB_DATA, + ), + ), + 'db_wizard' => array( + 'labels' => array( + 'from' => __( 'Select From', 'visualizer' ), + 'select' => __( 'Select Columns', 'visualizer' ), + 'where' => __( 'Where', 'visualizer' ), + 'group' => __( 'Group By', 'visualizer' ), + 'order' => __( 'Order By', 'visualizer' ), + ), + 'select' => array( + 'count(*)', + 'count(distinct #)', + '#', + ), + 'where' => array( + '#', + ), + 'group' => array( + '#', + ), + 'order' => array( + '#', ), ), ) @@ -588,4 +632,76 @@ private function _handleDataPage() { $this->_addAction( 'admin_head', 'renderFlattrScript' ); wp_iframe( array( $render, 'render' ) ); } + + /** + * Returns the columns for the table. + * + * @access public + */ + public function getTableColumns() { + global $wpdb; + check_ajax_referer( Visualizer_Plugin::ACTION_FETCH_DB_COLS . Visualizer_Plugin::VERSION, 'security' ); + + wp_send_json_success( array( 'columns' => Visualizer_Source_Query_Params::get_table_columns( $_POST['table'] ) ) ); + } + + /** + * Returns the data for the query params. + * + * @access public + */ + public function getTableData() { + global $wpdb; + check_ajax_referer( Visualizer_Plugin::ACTION_FETCH_DB_DATA . Visualizer_Plugin::VERSION, 'security' ); + + $source = new Visualizer_Source_Query_Params( wp_parse_args( $_POST['params'] ) ); + $html = $source->fetch( true ); + wp_send_json_success( array( 'table' => $html ) ); + } + + /** + * Saves the query and the schedule. + * + * @access public + */ + public function saveQuery() { + check_ajax_referer( Visualizer_Plugin::ACTION_SAVE_DB_QUERY . Visualizer_Plugin::VERSION, 'security' ); + + $chart_id = filter_input( + INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( + 'options' => array( + 'min_range' => 1, + ), + ) + ); + + $render = new Visualizer_Render_Page_Update(); + if ( $chart_id ) { + $source = new Visualizer_Source_Query_Params( wp_parse_args( $_POST['params'] ) ); + $source->fetch( false ); + if ( empty( $source->get_error() ) ) { + update_post_meta( $chart_id, Visualizer_Plugin::CF_DB_PARAMS, wp_parse_args( $_POST['params'] ) ); + update_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() ); + update_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); + update_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, $_POST['refresh'] ); + + $schedules = get_option( Visualizer_Plugin::CF_DB_SCHEDULE, array() ); + $schedules[ $chart_id ] = time() + $hours * HOUR_IN_SECONDS; + update_option( Visualizer_Plugin::CF_DB_SCHEDULE, $schedules ); + + wp_update_post( array( + 'ID' => $chart_id, + 'post_content' => $source->getData(), + ) ); + $render->data = json_encode( $source->getRawData() ); + $render->series = json_encode( $source->getSeries() ); + } else { + $render->message = $souce->get_error(); + } + } + $render->render(); + if ( ! ( defined( 'VISUALIZER_DO_NOT_DIE' ) && VISUALIZER_DO_NOT_DIE ) ) { + defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit(); + } + } } diff --git a/classes/Visualizer/Module/Setup.php b/classes/Visualizer/Module/Setup.php index 3ac64537..eece90e3 100644 --- a/classes/Visualizer/Module/Setup.php +++ b/classes/Visualizer/Module/Setup.php @@ -42,10 +42,16 @@ class Visualizer_Module_Setup extends Visualizer_Module { public function __construct( Visualizer_Plugin $plugin ) { parent::__construct( $plugin ); + register_activation_hook( VISUALIZER_BASEFILE, array( $this, 'activate' ) ); + register_deactivation_hook( VISUALIZER_BASEFILE, array( $this, 'deactivate' ) ); + $this->_addAction( 'visualizer_schedule_refresh_db', 'refreshDbChart' ); + $this->_addAction( 'init', 'setupCustomPostTypes' ); $this->_addAction( 'plugins_loaded', 'loadTextDomain' ); $this->_addFilter( 'visualizer_logger_data', 'getLoggerData' ); $this->_addFilter( 'visualizer_get_chart_counts', 'getChartCountsByTypeAndMeta' ); + + } /** * Fetches the SDK logger data. @@ -126,4 +132,62 @@ public function loadTextDomain() { load_plugin_textdomain( Visualizer_Plugin::NAME, false, dirname( plugin_basename( VISUALIZER_BASEFILE ) ) . '/languages/' ); } + /** + * Activate the plugin + */ + public function activate() { + wp_clear_scheduled_hook( 'visualizer_schedule_refresh_db' ); + wp_schedule_event( strtotime( 'midnight' ) - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS, 'hourly', 'visualizer_schedule_refresh_db' ); + } + + /** + * Deactivate the plugin + */ + public function deactivate() { + wp_clear_scheduled_hook( 'visualizer_schedule_refresh_db' ); + } + + /** + * Refresh the db chart. + * + * @access public + */ + public function refreshDbChart() { + $schedules = get_option( Visualizer_Plugin::CF_DB_SCHEDULE, array() ); + if ( ! $schedules ) { + return; + } + if ( ! defined( 'VISUALIZER_DO_NOT_DIE' ) ) { + // define this so that the ajax call does not die + // this means that if the new version of pro and the old version of free are installed, only the first chart will be updated + define( 'VISUALIZER_DO_NOT_DIE', true ); + } + + $new_schedules = array(); + $now = time(); + foreach ( $schedules as $chart_id => $time ) { + $new_schedules[ $chart_id ] = $time; + if ( $time > $now ) { + continue; + } + // check if the source is correct. + $source = get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ); + if ( Visualizer_Source_Query_Params::class === $source ) { + $params = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_PARAMS, true ); + $source = new Visualizer_Source_Query_Params( $params ); + $source->fetch( false ); + if ( empty( $source->get_error() ) ) { + update_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); + + wp_update_post( array( + 'ID' => $chart_id, + 'post_content' => $source->getData(), + ) ); + } + $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true ); + $new_schedules[ $chart_id ] = time() + $hours * HOUR_IN_SECONDS; + } + } + update_option( Visualizer_Plugin::CF_DB_SCHEDULE, $new_schedules ); + } } diff --git a/classes/Visualizer/Plugin.php b/classes/Visualizer/Plugin.php index ff450764..3ba7f860 100644 --- a/classes/Visualizer/Plugin.php +++ b/classes/Visualizer/Plugin.php @@ -49,7 +49,6 @@ class Visualizer_Plugin { const ACTION_CLONE_CHART = 'visualizer-clone-chart'; const ACTION_DELETE_CHART = 'visualizer-delete-chart'; const ACTION_UPLOAD_DATA = 'visualizer-upload-data'; - // Added by Ash/Upwork const ACTION_EXPORT_DATA = 'visualizer-export-data'; /** @@ -57,12 +56,22 @@ class Visualizer_Plugin { */ const ACTION_FETCH_PERMISSIONS_DATA = 'visualizer-fetch-permissions-data'; + /** + *Action used for fetching db import data. + */ + const ACTION_FETCH_DB_DATA = 'visualizer-fetch-db-data'; + const ACTION_FETCH_DB_COLS = 'visualizer-fetch-db-columns'; + const ACTION_SAVE_DB_QUERY = 'visualizer-save-db-query'; + // custom filters const FILTER_CHART_WRAPPER_CLASS = 'visualizer-chart-wrapper-class'; const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series'; const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data'; const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings'; + const CF_DB_PARAMS = 'visualizer-db-params'; + const CF_DB_SCHEDULE = 'visualizer-db-schedule'; + const CF_CHART_URL = 'visualizer-chart-url'; const CF_CHART_SCHEDULE = 'visualizer-chart-schedule'; // Added by Ash/Upwork diff --git a/classes/Visualizer/Render/Layout.php b/classes/Visualizer/Render/Layout.php new file mode 100644 index 00000000..c492e833 --- /dev/null +++ b/classes/Visualizer/Render/Layout.php @@ -0,0 +1,355 @@ + | +// +----------------------------------------------------------------------+ +/** + * Layout rendering class. + * + * @category Visualizer + * @package Render + * + */ +class Visualizer_Render_Layout extends Visualizer_Render { + + /** + * Renders template. + * + * @since 1.0.0 + * + * @abstract + * @access protected + */ + protected function _toHTML() { + // empty. + } + + /** + * Show the layout by delegating the call to the layout-specific method with the params. + * + * @access public + */ + public static function show( $layout ) { + return call_user_func( array( __CLASS__, '_render' . str_replace( ' ', '', ucwords( str_replace( '-', ' ', $layout ) ) ) ), func_get_args() ); + } + + /** + * Show the fake editor (just an empty div). + * + * @access public + */ + public static function _renderFauxEditor( $args ) { + echo ''; + } + + /** + * Show the DB wizard. + * + * @access public + */ + public static function _renderDbWizard( $args ) { + $tables = $args[1]; + $params = $args[2]; + $tbl = null; + $columns = null; + $group = array(); + $order = array(); + $limit = ''; + $where = array(); + if ( ! empty( $params['from'] ) ) { + $tbl = $params['from']; + } + if ( ! empty( $params['select'] ) ) { + $select = $params['select']; + } + if ( ! empty( $params['group'] ) ) { + $group = $params['group']; + } + if ( ! empty( $params['order'] ) ) { + $order = $params['order']; + } + if ( ! empty( $params['limit'] ) ) { + $limit = $params['limit']; + } + if ( ! empty( $params['where'] ) ) { + $where = $params['where']; + } + + if ( ! empty( $params ) ) { + $columns = Visualizer_Source_Query_Params::get_table_columns( $tbl ); + } + ?> + + +
+ +
+
+
'> +
+ " => __( 'Greater than', 'visualizer' ), + ">=" => __( 'Greater than or equals', 'visualizer' ), + "<" => __( 'Less than', 'visualizer' ), + "<=" => __( 'Less than or equals', 'visualizer' ), + "=" => __( 'Equals', 'visualizer' ), + "!=" => __( 'Not Equals', 'visualizer' ), + ); + ?> + +
+
+ +
+
+
'> +
+ __( 'Equals', 'visualizer' ), + "!=" => __( 'Not Equals', 'visualizer' ), + "like" => __( 'Like', 'visualizer' ), + ); + ?> + +
+
+ +
+
+
'> +
+ __( 'Equals', 'visualizer' ), + "!=" => __( 'Not Equals', 'visualizer' ), + "<=" => __( 'Before', 'visualizer' ), + ">=" => __( 'After', 'visualizer' ), + ); + ?> + +
+
+ +
+
+
+ + + + + + ' . $header['label'] . ''; + } + ?> + + + + + + '; + foreach ( $result as $r ) { + echo ''; + } + echo ''; + } + ?> + +
' . $r . '
+ _addFilterWizard( $this->chart->ID ); } + } else { + Visualizer_Render_Layout::show( 'faux-editor' ); } + + $this->add_additional_content(); + // Added by Ash/Upwork echo '
'; echo ''; @@ -135,12 +140,12 @@ class="visualizer-input visualizer-remote-url"> class="visualizer-select"> chart->ID, Visualizer_Plugin::CF_CHART_SCHEDULE, true ); - $schedules = array( + $schedules = apply_filters( 'visualizer_schedules', array( '1' => __( 'Each hour', 'visualizer' ), '12' => __( 'Each 12 hours', 'visualizer' ), '24' => __( 'Each day', 'visualizer' ), '36' => __( 'Each 3 days', 'visualizer' ), - ); + ) ); foreach ( $schedules as $num => $name ) { $extra = $num == $hours ? 'selected' : ''; ?> @@ -206,7 +211,7 @@ class="dashicons dashicons-lock"> class="dashicons dashicons-lock">
-

+

+ + Visualizer_Plugin::ACTION_SAVE_DB_QUERY, + 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_SAVE_DB_QUERY . Visualizer_Plugin::VERSION ), + 'chart' => $this->chart->ID, + ), admin_url( 'admin-ajax.php' ) + ); + ?> +
  • +

    +
    +
    +

    +
    +

    + + + + + +
    +
    +
    +
  • + +
  • chart->ID, Visualizer_Plugin::CF_DB_PARAMS, true ); + Visualizer_Render_Layout::show( 'db-wizard', Visualizer_Source_Query_Params::get_db_tables(), $params ); + } + } + } diff --git a/classes/Visualizer/Source/Query.php b/classes/Visualizer/Source/Query.php new file mode 100644 index 00000000..0ef4c142 --- /dev/null +++ b/classes/Visualizer/Source/Query.php @@ -0,0 +1,185 @@ + | +// +----------------------------------------------------------------------+ + +/** + * Source manager for query builder. + * + * @category Visualizer + * @package Source + */ +class Visualizer_Source_Query extends Visualizer_Source { + + /** + * The query. + * + * @access protected + * @var string + */ + protected $_query; + + /** + * The error message. + * + * @access protected + * @var string + */ + protected $_error; + + /** + * Constructor. + * + * @access public + * @param array $params The query. + */ + public function __construct( $query ) { + $this->_query = $query; + } + + /** + * Fetches information from source, parses it and builds series and data arrays. + * + * @param bool $as_html Should the result be fetched as an HTML table or as an object. + * @access public + * @return boolean TRUE on success, otherwise FALSE. + */ + public function fetch( $as_html = false ) { + if ( empty( $this->_query ) ) { + return false; + } + + global $wpdb; + $rows = $wpdb->get_results( $this->_query, ARRAY_A ); + if ( $rows ) { + $results = array(); + $headers = array(); + if ( $rows ) { + $row_num = 0; + foreach ( $rows as $row ) { + $result = array(); + $col_num = 0; + foreach ( $row as $k => $v ) { + $result[] = $v; + if ( 0 === $row_num ) { + $headers[] = array( 'type' => $this->get_col_type( $col_num++ ), 'label' => $k ); + } + } + $results[] = $result; + $row_num++; + } + } + + if ( $as_html ) { + return $this->html( $headers, $results ); + } + return $this->object( $headers, $results ); + } else { + $this->_error = $wpdb->last_error; + } + } + + /** + * Get the data type of the column. + * + * @param int $col_num The column index in the fetched result set. + * @access private + * @return int + */ + private function get_col_type( $col_num ) { + global $wpdb; + switch ( $wpdb->get_col_info( 'type', $col_num ) ) { + case 8: + // numeric. + return 'number'; + case 12: + // date. + return 'date'; + } + return 'string'; + } + + /** + * Returns the HTML output. + * + * @param array $headers The headers of the result set. + * @param array $results The data of the result set. + * @access private + * @return string + */ + private function html( $headers, $results ) { + return Visualizer_Render_Layout::show( 'db-wizard-results', $headers, $results ); + } + + /** + * Sets the series and data. + * + * @param array $headers The headers of the result set. + * @param array $results The data of the result set. + * @access private + * @return bool + */ + private function object( $headers, $results ) { + $series = array(); + foreach ( $headers as $header ) { + $series[] = $header; + } + $this->_series = $series; + + $data = array(); + foreach ( $results as $row ) { + $data[] = $this->_normalizeData( $row ); + } + $this->_data = $data; + return true; + } + + /** + * Returns the error, if any. + * + * @access public + * @return string + */ + public function get_error() { + return $this->_error; + } + + /** + * Returns the final query. + * + * @access public + * @return string + */ + public function get_query() { + return $this->_query; + } + + /** + * Returns source name. + * + * @since 1.0.0 + * + * @access public + * @return string The name of source. + */ + public function getSourceName() { + return __CLASS__; + } +} \ No newline at end of file diff --git a/classes/Visualizer/Source/Query/Params.php b/classes/Visualizer/Source/Query/Params.php new file mode 100644 index 00000000..86fc4fcb --- /dev/null +++ b/classes/Visualizer/Source/Query/Params.php @@ -0,0 +1,333 @@ + | +// +----------------------------------------------------------------------+ + +/** + * Source manager for query builder. + * + * @category Visualizer + * @package Source + */ +class Visualizer_Source_Query_Params extends Visualizer_Source_Query { + + /** + * The params that will form the query. + * + * @access protected + * @var string + */ + protected $_params; + + /** + * Constructor. + * + * @since 1.0.0 + * + * @access public + * @param array $params The params that will form the query. + */ + public function __construct( $params = null ) { + $this->_params = $params; + if ( ! empty ( $params ) ) { + $this->build_query(); + } + } + + /** + * Rearrange columns so that a string column, if present, is always first in the select list as this will form the x axis. + */ + private function rearrange_columns_for_x_axis( $columns, $select, $tables ) { + if ( ! $select ) { + return null; + } + + $first = null; + $index = 0; + foreach ( $select as $column ) { + if ( ! is_null( $first ) ) { + break; + } + $table = $tables; + $col = $column; + if ( 0 !== strpos( $column, 'count(' ) ) { + if ( count( $tables ) > 1 ) { + $arr = explode( '.', $column ); + $table = $arr[0]; + $col = $arr[1]; + } + foreach ( $columns[ $table ] as $table_cols ) { + if ( $table_cols['name'] === $column && 's' === $table_cols['type' ] ) { + $first = $column; + break; + } + } + } + $index++; + } + + if ( $first ) { + unset( $select[ --$index ] ); + array_unshift( $select, $first ); + } + + return implode( ',', $select ); + } + + /** + * Build the final query. + * + * @access private + */ + private function build_query() { + $args = $this->_params; + + $table = $args['from']; + $tables = array( $table ); + $mapping = self::get_db_table_mapping(); + if ( array_key_exists( $table, $mapping ) ) { + $tables[] = $mapping[ $table ]; + } + + $cols = array(); + foreach ( $tables as $table ) { + $cols[ $table ] = self::get_db_table_columns( $table, count( $tables ) > 1 ); + } + + if ( ! isset( $args['select'] ) ) { + return; + } + + $query = ''; + $select = 'SELECT ' . $this->rearrange_columns_for_x_axis( $cols, $args['select'], $tables ); + $from = ' FROM ' . vsprintf( implode( ',', array_fill( 0, count( $tables ), '%s' ) ), $tables ); + $group = ''; + $order = ''; + $limit = ''; + $fk = ''; + $where = array(); + + if ( isset( $args['group'] ) ) { + $group = ' GROUP BY ' . implode( ', ', $args['group'] ); + } + if ( isset( $args['order'] ) ) { + $order = ' ORDER BY ' . implode( ', ', $args['order'] ); + } + if ( ! empty( $args['limit'] ) ) { + $limit = ' LIMIT ' . $args['limit']; + } + + + $index = 0; + if ( ! empty( $args['where'] ) ) { + $scraps = array(); + foreach ( $args['where'] as $column ) { + if ( empty( $column ) ) { + continue; + } + $table = strstr( $column, '.', true ); + $scraps[] = array( + 'table' => $table, + 'col' => $column, + 'index' => $index++, + ); + } + + if ( $scraps ) { + foreach ( $scraps as $scrap ) { + foreach ( $cols[ $scrap['table'] ] as $col ) { + if ( $scrap['col'] === $col['name'] ) { + $operator = $args[ $col['type'] . '-operator' ][ $scrap['index'] ]; + $operand = $args[ $col['type'] ][ $scrap['index'] ]; + $where[] = $scrap['col'] . " $operator $operand"; + } + } + } + } + } + + if ( count( $tables ) > 1 ) { + $fk = $this->get_foreign_key_constraint( $tables[0], $tables[1] ); + if ( ! empty( $fk ) ) { + $where[] = $fk; + } + } + + if ( empty( $where ) ) { + $where = ''; + } else { + $where = ' WHERE ' . implode( ' AND ', $where ); + } + + $query = $select . $from . $where . $group . $order . $limit; + $this->_query = $query; + } + + /** + * Gets the relationship between tables in the database. + * + * @access public + * @return array + */ + public static function get_db_table_mapping() { + global $wpdb; + $mapping = get_transient( 'visualizer_db_table_mapping' ); + if ( $mapping ) { + return $mapping; + } + // no need to provide x=>y and then y=>x as we will flip the array shortly. + $mapping = array( + $wpdb->prefix . 'posts' => $wpdb->prefix . 'postmeta', + $wpdb->prefix . 'users' => $wpdb->prefix . 'usermeta', + $wpdb->prefix . 'terms' => $wpdb->prefix . 'termmeta', + ); + $mapping = apply_filters( 'visualizer_pro_db_table_mapping', $mapping ); + $mapping += array_flip( $mapping ); + set_transient( 'visualizer_db_table_mapping', $mapping, HOUR_IN_SECONDS ); + return $mapping; + } + + /** + * Returns the foreign key relationship constraint between the tables. + * + * @param string $table Table 1. + * @param string $table Table 2. + * @access private + * @return string + */ + private function get_foreign_key_constraint( $table1, $table2 ) { + global $wpdb; + + $posts = array( $wpdb->prefix . 'posts', $wpdb->prefix . 'postmeta' ); + $users = array( $wpdb->prefix . 'users', $wpdb->prefix . 'usermeta' ); + $terms = array( $wpdb->prefix . 'terms', $wpdb->prefix . 'termmeta' ); + + if ( in_array( $table1, $posts ) && in_array( $table2, $posts ) ) { + return $wpdb->prefix . 'posts.ID = ' . $wpdb->prefix . 'postmeta.post_id'; + } + if ( in_array( $table1, $users ) && in_array( $table2, $users ) ) { + return $wpdb->prefix . 'users.ID = ' . $wpdb->prefix . 'usermeta.user_id'; + } + if ( in_array( $table1, $terms ) && in_array( $table2, $terms ) ) { + return $wpdb->prefix . 'terms.term_id = ' . $wpdb->prefix . 'termmeta.term_id'; + } + + return apply_filters( 'visualizer_pro_db_fk_constraint', '', $table1, $table2 ); + } + + /** + * Gets the column information for the table. + * + * @param string $table The table. + * @param bool $prefix_with_table Whether to prefix column name with the name of the table. + * @access private + * @return array + */ + private static function get_db_table_columns( $table, $prefix_with_table = false ) { + global $wpdb; + $columns = get_transient( "visualizer_db_{$table}_columns" ); + if ( $columns ) { + return $columns; + } + $columns = array(); + $rows = $wpdb->get_results( "SHOW COLUMNS IN `$table`", ARRAY_N ); + if ( $rows ) { + // n => numeric, d => date-ish, s => string-ish. + foreach ( $rows as $row ) { + $col = ( $prefix_with_table ? "$table." : '' ) . $row[0]; + $type = $row[1]; + if ( strpos( $type, 'int' ) !== false || strpos( $type, 'float' ) !== false ) { + $type = 'n'; + } else if ( strpos( $type, 'date' ) !== false || strpos( $type, 'time' ) !== false ) { + $type = 'd'; + } else { + $type = 's'; + } + $columns[] = array( 'name' => $col, 'type' => $type ); + } + } + $mapping = apply_filters( 'visualizer_pro_db_table_columns', $columns, $table ); + set_transient( "visualizer_db_{$table}_columns", $columns, DAY_IN_SECONDS ); + return $columns; + } + + /** + * Gets the dependent tables and then gets column information for all the tables. + * + * @param string $table The table. + * @access public + * @return array + */ + public static function get_table_columns( $table ) { + $columns = array(); + if ( ! $table ) { + return $columns; + } + + $tables = array( $table ); + $mapping = Visualizer_Source_Query_Params::get_db_table_mapping(); + if ( array_key_exists( $table, $mapping ) ) { + $tables[] = $mapping[ $table ]; + } + foreach ( $tables as $table ) { + $cols = self::get_db_table_columns( $table, count( $tables ) > 1 ); + $columns = array_merge( $columns, $cols ); + } + return $columns; + } + + /** + * Gets the tables in the database; + * + * @access public + * @return array + */ + public static function get_db_tables() { + global $wpdb; + $tables = get_transient( 'visualizer_db_tables' ); + if ( $tables ) { + return $tables; + } + + $prefix = apply_filters( 'visualizer_pro_db_prefix', $wpdb->prefix ); + $sql = $wpdb->get_col( 'SHOW TABLES', 0 ); + foreach( $sql as $table ) { + if ( empty( $prefix ) || 0 === strpos( $table, $prefix ) ) { + $tables[] = $table; + } + } + $tables = apply_filters( 'visualizer_pro_db_tables', $tables ); + set_transient( 'visualizer_db_tables', $tables, HOUR_IN_SECONDS ); + return $tables; + } + + + /** + * Returns source name. + * + * @since 1.0.0 + * + * @access public + * @return string The name of source. + */ + public function getSourceName() { + return __CLASS__; + } +} \ No newline at end of file diff --git a/css/frame.css b/css/frame.css index bf32a4cd..f1152022 100644 --- a/css/frame.css +++ b/css/frame.css @@ -1056,3 +1056,20 @@ span.viz-section-error { position: relative; text-align: center; } + + +/******************************************************************************/ +/******************************** DB WIZARD ***********************************/ +/******************************************************************************/ + +.db-wizard-condition .select-condition { + display: none; +} + +.db-wizard-condition .select-condition.active { + display: block; +} + +.db-wizard-results { + width: 75%; +} \ No newline at end of file diff --git a/index.php b/index.php index 116618ed..4a440380 100644 --- a/index.php +++ b/index.php @@ -23,13 +23,15 @@ if ( class_exists( 'Visualizer_Plugin', false ) ) { return; } -// Added by Ash/Upwork if ( class_exists( 'Visualizer_Pro', false ) ) { define( 'VISUALIZER_PRO', true ); } else { defined( 'VISUALIZER_PRO' ) || define( 'VISUALIZER_PRO', false ); } -// Added by Ash/Upwork + +// if x and y features are required, this value should read x,y or x|y or x;y. +define( 'VISUALIZER_ENABLE_BETA_FEATURES', 'dbwizard' ); + /** * Automatically loads classes for the plugin. Checks a namespace and loads only * approved classes. diff --git a/js/frame.js b/js/frame.js index 5dbd6ee7..4ba66d3c 100644 --- a/js/frame.js +++ b/js/frame.js @@ -5,6 +5,7 @@ (function ($) { $(document).ready(function () { init_permissions(); + init_db_import(); $('.type-radio').change(function () { $('.type-label-selected').removeClass('type-label-selected'); @@ -149,6 +150,205 @@ }); }); } + + function init_db_import(){ + $( '#visualizer-db-wizard' ).css("z-index", "-1").hide(); + + // add the first where clause. + $('.db-wizard-templates').append($('.db-wizard-where-template').clone().removeClass('db-wizard-where-template').show()); + + $('.db-wizard-query select').chosen({ + width : '50%', + search_contains : true + }); + + // trigger for new where clauses. + $('.db-wizard-where-template-add').on('click', function(e){ + e.preventDefault(); + $('.db-wizard-templates').append($('.db-wizard-where-template').clone().removeClass('db-wizard-where-template').addClass('visualizer-select-where-added').show()); + $('.db-wizard-templates .visualizer-select-where-added select').chosen({ + width : '50%', + search_contains : true + }); + + // show the condition operator and operand. + $('.db-wizard-templates .visualizer-select-where-added select.visualizer-select-where').on('change', function(evt, params) { + display_where_clause(evt, params, $(this)); + }); + + $('.db-wizard-templates .visualizer-select-where-added .db-wizard-where-template-remove').on('click', function(e){ + $(this).parent().remove(); + }); + + $('.db-wizard-templates .visualizer-select-where-added').removeClass('visualizer-select-where-added'); + }); + + // show the condition operator and operand. + $('.visualizer-select-where').on('change', function(evt, params) { + display_where_clause(evt, params, $(this)); + }); + + $('.db-wizard-where-template-remove').on('click', function(e){ + $(this).parent().remove(); + }); + + if($('.visualizer-select-select :selected').length === 0){ + $('#visualizer-query-fetch').attr('disabled', 'disabled'); + } + + $('.visualizer-select-select').on('change', function(evt, params) { + if($('.visualizer-select-select :selected').length > 0){ + $('#visualizer-query-fetch').removeAttr('disabled'); + }else{ + $('#visualizer-query-fetch').attr('disabled', 'disabled'); + } + }); + + // get the columns when table is selected. + $('.visualizer-select-from').on('change', function(evt, params) { + start_ajax($('#visualizer-db-wizard')); + $('.db-wizard-templates').empty(); + $('.db-wizard-where-template-add').trigger('click'); + $('.visualizer-select-select').empty().trigger('chosen:updated'); + $('.visualizer-select-group').empty().trigger('chosen:updated'); + $('.visualizer-select-order').empty().trigger('chosen:updated'); + $('.visualizer-select-limit').val(''); + $('.db-wizard-results').empty(); + $('#visualizer-query-fetch').attr('disabled', 'disabled'); + + $.ajax({ + url : ajaxurl, + method : 'post', + data : { + 'action' : visualizer.ajax['actions']['db_get_cols'], + 'security' : visualizer.ajax['nonces']['db_get_cols'], + 'table' : params.selected + }, + success : function(data){ + var where = $('.visualizer-select-where'); + var select = $('.visualizer-select-select'); + var group = $('.visualizer-select-group'); + var order = $('.visualizer-select-order'); + + where.empty().append(''); + select.empty().append(''); + group.empty().append(''); + order.empty().append(''); + + // populate the SELECT clause. + $(visualizer.db_wizard.select).each(function(i, clause){ + if(clause.indexOf('#') === -1){ + select.append($('')); + }else{ + $(data.data.columns).each(function(i, col){ + var val = clause.replace(/#/g, col.name); + select.append($('')); + }); + } + }); + + // populate the WHERE, ORDER and GROUPBY clauses. + $(data.data.columns).each(function(i, col){ + $(visualizer.db_wizard.where).each(function(i, clause){ + if(clause.indexOf('#') !== -1){ + var val = clause.replace(/#/g, col.name); + where.append($('')); + } + }); + $(visualizer.db_wizard.group).each(function(i, clause){ + if(clause.indexOf('#') !== -1){ + var val = clause.replace(/#/g, col.name); + group.append($('')); + } + }); + $(visualizer.db_wizard.order).each(function(i, clause){ + if(clause.indexOf('#') !== -1){ + var val = clause.replace(/#/g, col.name); + order.append($('')); + } + }); + }); + where.trigger('chosen:updated'); + select.trigger('chosen:updated'); + group.trigger('chosen:updated'); + order.trigger('chosen:updated'); + }, + complete: function(){ + end_ajax($('#visualizer-db-wizard')); + } + }); + }); + + $('#visualizer-query-fetch').on('click', function(e){ + start_ajax($('#visualizer-db-wizard')); + $.ajax({ + url : ajaxurl, + method : 'post', + data : { + 'action' : visualizer.ajax['actions']['db_get_data'], + 'security' : visualizer.ajax['nonces']['db_get_data'], + 'params' : $('#db-wizard-form').serialize() + }, + success : function(data){ + $('.db-wizard-error').contents().filter(function(){ return this.nodeType === 3; }).empty(); + $('.db-wizard-results').empty(); + if(data.success){ + $('.db-wizard-results').html(data.data.table); + $('#db-query').html(data.data.query); + $('#results').DataTable({ + "paging": false + }); + }else{ + $('.db-wizard-error .query').html(data.data.query); + $('.db-wizard-error .msg').html(data.data.msg); + } + }, + complete: function(){ + end_ajax($('#visualizer-db-wizard')); + } + }); + }); + + $( '#db-chart-button' ).on( 'click', function(){ + if( $(this).attr( 'data-current' ) === 'chart'){ + $(this).val( $(this).attr( 'data-t-filter' ) ); + $(this).html( $(this).attr( 'data-t-filter' ) ); + $(this).attr( 'data-current', 'filter' ); + $( '.visualizer-editor-lhs' ).hide(); + $( '#visualizer-db-wizard' ).css("z-index", "9999").show(); + $( '#canvas' ).hide(); + }else{ + var filter_button = $(this); + $( '#visualizer-db-wizard' ).css("z-index", "-1").hide(); + $('#canvas').lock(); + filter_button.val( filter_button.attr( 'data-t-chart' ) ); + filter_button.html( filter_button.attr( 'data-t-chart' ) ); + filter_button.attr( 'data-current', 'chart' ); + $( '#canvas' ).css("z-index", "1").show(); + $( '#db-chart-save-button' ).trigger('click'); + } + } ); + + $( '#db-chart-save-button' ).on( 'click', function(){ + $('#viz-db-wizard-params').val($('#db-wizard-form').serialize()); + $('#vz-db-wizard').submit(); + }); + } + + function display_where_clause(evt, params, where){ + var type = where.find('option[value="' + params.selected + '"]').attr('data-type'); + where.parent().parent().find('.select-condition').removeClass('active'); + where.parent().parent().find('.select-condition.select-condition-' + type).addClass('active'); + } + + function start_ajax(element){ + element.lock(); + } + + function end_ajax(element){ + element.unlock(); + } + })(jQuery); (function ($) { From f08fa2e28257b890fe1ec6af98f76ece4df32176 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Sat, 13 Jan 2018 14:32:40 +0530 Subject: [PATCH 02/58] grunt --- classes/Visualizer/Module/Chart.php | 48 ++-- classes/Visualizer/Module/Setup.php | 17 +- classes/Visualizer/Render/Layout.php | 263 ++++++++++----------- classes/Visualizer/Render/Page/Data.php | 33 ++- classes/Visualizer/Source/Query.php | 31 +-- classes/Visualizer/Source/Query/Params.php | 126 +++++----- js/frame.js | 1 + tests/test-import.php | 40 ++++ 8 files changed, 306 insertions(+), 253 deletions(-) diff --git a/classes/Visualizer/Module/Chart.php b/classes/Visualizer/Module/Chart.php index 2979002c..0f2d694a 100644 --- a/classes/Visualizer/Module/Chart.php +++ b/classes/Visualizer/Module/Chart.php @@ -294,7 +294,7 @@ private function _handleDataAndSettingsPage() { update_option( 'visualizer-map-api-key', $_POST['map_api_key'] ); } if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'] ) ) { - error_log("idhar! " . print_r($_POST,true)); + error_log( 'idhar! ' . print_r( $_POST, true ) ); if ( $this->_chart->post_status == 'auto-draft' ) { $this->_chart->post_status = 'publish'; wp_update_post( $this->_chart->to_array() ); @@ -348,7 +348,7 @@ private function _handleDataAndSettingsPage() { 'url' => admin_url( 'admin-ajax.php' ), 'nonces' => array( 'permissions' => wp_create_nonce( Visualizer_Plugin::ACTION_FETCH_PERMISSIONS_DATA ), - 'db_get_cols' => wp_create_nonce( Visualizer_Plugin::ACTION_FETCH_DB_COLS . Visualizer_Plugin::VERSION ), + 'db_get_cols' => wp_create_nonce( Visualizer_Plugin::ACTION_FETCH_DB_COLS . Visualizer_Plugin::VERSION ), 'db_get_data' => wp_create_nonce( Visualizer_Plugin::ACTION_FETCH_DB_DATA . Visualizer_Plugin::VERSION ), ), 'actions' => array( @@ -357,26 +357,26 @@ private function _handleDataAndSettingsPage() { 'db_get_data' => Visualizer_Plugin::ACTION_FETCH_DB_DATA, ), ), - 'db_wizard' => array( - 'labels' => array( - 'from' => __( 'Select From', 'visualizer' ), - 'select' => __( 'Select Columns', 'visualizer' ), - 'where' => __( 'Where', 'visualizer' ), - 'group' => __( 'Group By', 'visualizer' ), - 'order' => __( 'Order By', 'visualizer' ), + 'db_wizard' => array( + 'labels' => array( + 'from' => __( 'Select From', 'visualizer' ), + 'select' => __( 'Select Columns', 'visualizer' ), + 'where' => __( 'Where', 'visualizer' ), + 'group' => __( 'Group By', 'visualizer' ), + 'order' => __( 'Order By', 'visualizer' ), ), - 'select' => array( + 'select' => array( 'count(*)', 'count(distinct #)', '#', ), - 'where' => array( + 'where' => array( '#', ), - 'group' => array( + 'group' => array( '#', ), - 'order' => array( + 'order' => array( '#', ), ), @@ -653,10 +653,10 @@ public function getTableColumns() { public function getTableData() { global $wpdb; check_ajax_referer( Visualizer_Plugin::ACTION_FETCH_DB_DATA . Visualizer_Plugin::VERSION, 'security' ); - - $source = new Visualizer_Source_Query_Params( wp_parse_args( $_POST['params'] ) ); - $html = $source->fetch( true ); - wp_send_json_success( array( 'table' => $html ) ); + + $source = new Visualizer_Source_Query_Params( wp_parse_args( $_POST['params'] ) ); + $html = $source->fetch( true ); + wp_send_json_success( array( 'table' => $html ) ); } /** @@ -667,7 +667,7 @@ public function getTableData() { public function saveQuery() { check_ajax_referer( Visualizer_Plugin::ACTION_SAVE_DB_QUERY . Visualizer_Plugin::VERSION, 'security' ); - $chart_id = filter_input( + $chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1, @@ -677,7 +677,7 @@ public function saveQuery() { $render = new Visualizer_Render_Page_Update(); if ( $chart_id ) { - $source = new Visualizer_Source_Query_Params( wp_parse_args( $_POST['params'] ) ); + $source = new Visualizer_Source_Query_Params( wp_parse_args( $_POST['params'] ) ); $source->fetch( false ); if ( empty( $source->get_error() ) ) { update_post_meta( $chart_id, Visualizer_Plugin::CF_DB_PARAMS, wp_parse_args( $_POST['params'] ) ); @@ -689,10 +689,12 @@ public function saveQuery() { $schedules[ $chart_id ] = time() + $hours * HOUR_IN_SECONDS; update_option( Visualizer_Plugin::CF_DB_SCHEDULE, $schedules ); - wp_update_post( array( - 'ID' => $chart_id, - 'post_content' => $source->getData(), - ) ); + wp_update_post( + array( + 'ID' => $chart_id, + 'post_content' => $source->getData(), + ) + ); $render->data = json_encode( $source->getRawData() ); $render->series = json_encode( $source->getSeries() ); } else { diff --git a/classes/Visualizer/Module/Setup.php b/classes/Visualizer/Module/Setup.php index eece90e3..e3206d23 100644 --- a/classes/Visualizer/Module/Setup.php +++ b/classes/Visualizer/Module/Setup.php @@ -51,7 +51,6 @@ public function __construct( Visualizer_Plugin $plugin ) { $this->_addFilter( 'visualizer_logger_data', 'getLoggerData' ); $this->_addFilter( 'visualizer_get_chart_counts', 'getChartCountsByTypeAndMeta' ); - } /** * Fetches the SDK logger data. @@ -171,18 +170,20 @@ public function refreshDbChart() { continue; } // check if the source is correct. - $source = get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ); + $source = get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ); if ( Visualizer_Source_Query_Params::class === $source ) { - $params = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_PARAMS, true ); - $source = new Visualizer_Source_Query_Params( $params ); + $params = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_PARAMS, true ); + $source = new Visualizer_Source_Query_Params( $params ); $source->fetch( false ); if ( empty( $source->get_error() ) ) { update_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); - wp_update_post( array( - 'ID' => $chart_id, - 'post_content' => $source->getData(), - ) ); + wp_update_post( + array( + 'ID' => $chart_id, + 'post_content' => $source->getData(), + ) + ); } $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true ); $new_schedules[ $chart_id ] = time() + $hours * HOUR_IN_SECONDS; diff --git a/classes/Visualizer/Render/Layout.php b/classes/Visualizer/Render/Layout.php index c492e833..ea9a3479 100644 --- a/classes/Visualizer/Render/Layout.php +++ b/classes/Visualizer/Render/Layout.php @@ -24,7 +24,6 @@ * * @category Visualizer * @package Render - * */ class Visualizer_Render_Layout extends Visualizer_Render { @@ -64,125 +63,125 @@ public static function _renderFauxEditor( $args ) { * @access public */ public static function _renderDbWizard( $args ) { - $tables = $args[1]; - $params = $args[2]; - $tbl = null; - $columns = null; - $group = array(); - $order = array(); - $limit = ''; - $where = array(); + $tables = $args[1]; + $params = $args[2]; + $tbl = null; + $columns = null; + $group = array(); + $order = array(); + $limit = ''; + $where = array(); if ( ! empty( $params['from'] ) ) { - $tbl = $params['from']; + $tbl = $params['from']; } if ( ! empty( $params['select'] ) ) { - $select = $params['select']; + $select = $params['select']; } if ( ! empty( $params['group'] ) ) { - $group = $params['group']; + $group = $params['group']; } if ( ! empty( $params['order'] ) ) { - $order = $params['order']; + $order = $params['order']; } if ( ! empty( $params['limit'] ) ) { - $limit = $params['limit']; + $limit = $params['limit']; } if ( ! empty( $params['where'] ) ) { - $where = $params['where']; + $where = $params['where']; } if ( ! empty( $params ) ) { - $columns = Visualizer_Source_Query_Params::get_table_columns( $tbl ); + $columns = Visualizer_Source_Query_Params::get_table_columns( $tbl ); } ?>

    '>
  • + ' multiple>
    + ' value=''>
    @@ -215,6 +220,7 @@ public static function _renderDbWizardWhere( $args ) { $operand = ''; ?>
    + '> @@ -317,6 +318,7 @@ public static function _renderDbWizardWhere( $args ) {
    + Date: Tue, 6 Feb 2018 13:36:17 +0200 Subject: [PATCH 09/58] Further styling of database import. --- classes/Visualizer/Render/Layout.php | 4 ++-- css/frame.css | 34 ++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/classes/Visualizer/Render/Layout.php b/classes/Visualizer/Render/Layout.php index a2b9d44c..9f26d5d0 100644 --- a/classes/Visualizer/Render/Layout.php +++ b/classes/Visualizer/Render/Layout.php @@ -150,7 +150,7 @@ public static function _renderDbWizard( $args ) { ?> - +
    @@ -317,7 +317,7 @@ public static function _renderDbWizardWhere( $args ) {
    - + div { - display: inline; + display: block; +} +.db-wizard-templates > div { + width: 50%; + border: 1px solid #efefef; + padding: 20px; + margin-top: 20px; + box-sizing: border-box; +} +.db-wizard-templates > div:first-child { + margin-top: 0; } .db-wizard-query .chosen-container-multi .chosen-choices { border-color: #ccc; @@ -1124,11 +1135,9 @@ span.viz-section-error { padding: 5px; } - .db-wizard-results .dataTables_wrapper .dataTables_filter input, .db-wizard-query .select-condition-operand input, .db-wizard-limit input { - margin-top: 10px; background: #fff; box-shadow: none; border: 1px solid #ccc; @@ -1138,9 +1147,14 @@ span.viz-section-error { font-size: 13px; } .db-wizard-limit input { - /*width: auto;*/ - margin-bottom: 20px; + margin: 0 0 20px 20px; + display: inline; + width: 150px; } +.db-wizard-limit label{ + display: inline; +} + .db-wizard-query .select-condition-operand input::placeholder { color: #cdcdcd; } @@ -1193,13 +1207,19 @@ span.viz-section-error { .db-wizard-where-template-remove, .db-wizard-where-template-add { - width: 25px; + font-size: 12px; + width: auto; height: 25px; border-radius: 3px; color: #fff; border: none; - font-size: 18px; margin-top: 10px; + cursor: pointer; + transition: .3s ease; +} +.db-wizard-where-template-remove:hover, +.db-wizard-where-template-add:hover { + opacity: .8; } .db-wizard-results .dataTables_wrapper .dataTables_filter { From a92f5dfb864e2f1db78b3489bc1bfce6f6e0d208 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Tue, 20 Feb 2018 08:08:52 +0530 Subject: [PATCH 10/58] added live data option --- classes/Visualizer/Module/Chart.php | 4 +- classes/Visualizer/Module/Frontend.php | 4 +- classes/Visualizer/Module/Setup.php | 80 ++++++++++++++++++------- classes/Visualizer/Render/Page/Data.php | 1 + 4 files changed, 66 insertions(+), 23 deletions(-) diff --git a/classes/Visualizer/Module/Chart.php b/classes/Visualizer/Module/Chart.php index 5e15a94b..5d96e2f6 100644 --- a/classes/Visualizer/Module/Chart.php +++ b/classes/Visualizer/Module/Chart.php @@ -294,7 +294,6 @@ private function _handleDataAndSettingsPage() { update_option( 'visualizer-map-api-key', $_POST['map_api_key'] ); } if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'] ) ) { - error_log( 'idhar! ' . print_r( $_POST, true ) ); if ( $this->_chart->post_status == 'auto-draft' ) { $this->_chart->post_status = 'publish'; wp_update_post( $this->_chart->to_array() ); @@ -681,10 +680,11 @@ public function saveQuery() { $source->fetch( false ); $error = $source->get_error(); if ( empty( $error ) ) { + $hours = $_POST['refresh']; update_post_meta( $chart_id, Visualizer_Plugin::CF_DB_PARAMS, wp_parse_args( $_POST['params'] ) ); update_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() ); update_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); - update_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, $_POST['refresh'] ); + update_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, $hours ); $schedules = get_option( Visualizer_Plugin::CF_DB_SCHEDULE, array() ); $schedules[ $chart_id ] = time() + $hours * HOUR_IN_SECONDS; diff --git a/classes/Visualizer/Module/Frontend.php b/classes/Visualizer/Module/Frontend.php index e5a8ece1..e77e59d4 100644 --- a/classes/Visualizer/Module/Frontend.php +++ b/classes/Visualizer/Module/Frontend.php @@ -197,7 +197,9 @@ public function renderChart( $atts ) { $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ); - // faetch and update settings + $chart = apply_filters( 'visualizer_schedule_refresh_chart', $chart, $chart->ID, false ); + + // fetch and update settings $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true ); if ( empty( $settings['height'] ) ) { $settings['height'] = '400'; diff --git a/classes/Visualizer/Module/Setup.php b/classes/Visualizer/Module/Setup.php index 13d0ef9c..4d61a9f4 100644 --- a/classes/Visualizer/Module/Setup.php +++ b/classes/Visualizer/Module/Setup.php @@ -45,6 +45,7 @@ public function __construct( Visualizer_Plugin $plugin ) { register_activation_hook( VISUALIZER_BASEFILE, array( $this, 'activate' ) ); register_deactivation_hook( VISUALIZER_BASEFILE, array( $this, 'deactivate' ) ); $this->_addAction( 'visualizer_schedule_refresh_db', 'refreshDbChart' ); + $this->_addFilter( 'visualizer_schedule_refresh_chart', 'refresh_db_for_chart', null, 10, 3 ); $this->_addAction( 'init', 'setupCustomPostTypes' ); $this->_addAction( 'plugins_loaded', 'loadTextDomain' ); @@ -146,6 +147,60 @@ public function deactivate() { wp_clear_scheduled_hook( 'visualizer_schedule_refresh_db' ); } + /** + * Refresh the specific chart from the db. This is mostly for charts that have 0 refresh time i.e. live data. + * + * @param WP_Post $chart The chart object. + * @param int $chart_id The chart id. + * @param bool $force If this is true, then the chart data will be refreshed no matter if the chart requests live data or cached data. + * If false, data will be refreshed only if the chart requests live data. + * + * @access public + */ + public function refresh_db_for_chart( $chart, $chart_id, $force = false ) { + if ( ! $chart_id ) { + return $chart; + } + + if ( ! $chart ) { + $chart = get_post( $chart_id ); + } + + // check if its a live-data chart or a cached-data chart. + if ( ! $force ) { + $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true ); + if ( ! empty( $hours ) ) { + // cached, bail! + return $chart; + } + } + + // check if the source is correct. + $source = get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ); + if ( $source !== 'Visualizer_Source_Query_Params' ) { + return $chart; + } + + $params = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_PARAMS, true ); + $source = new Visualizer_Source_Query_Params( $params ); + $source->fetch( false ); + $error = $source->get_error(); + if ( empty( $error ) ) { + update_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); + + wp_update_post( + array( + 'ID' => $chart_id, + 'post_content' => $source->getData(), + ) + ); + + $chart = get_post( $chart_id ); + } + + return $chart; + } + /** * Refresh the db chart. * @@ -169,27 +224,12 @@ public function refreshDbChart() { if ( $time > $now ) { continue; } - // check if the source is correct. - $source = get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ); - if ( 'Visualizer_Source_Query_Params' === $source ) { - $params = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_PARAMS, true ); - $source = new Visualizer_Source_Query_Params( $params ); - $source->fetch( false ); - $error = $source->get_error(); - if ( empty( $error ) ) { - update_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); - - wp_update_post( - array( - 'ID' => $chart_id, - 'post_content' => $source->getData(), - ) - ); - } - $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true ); - $new_schedules[ $chart_id ] = time() + $hours * HOUR_IN_SECONDS; - } + + $this->refresh_db_for_chart( null, $chart_id, false ); + $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true ); + $new_schedules[ $chart_id ] = time() + $hours * HOUR_IN_SECONDS; } update_option( Visualizer_Plugin::CF_DB_SCHEDULE, $new_schedules ); } + } diff --git a/classes/Visualizer/Render/Page/Data.php b/classes/Visualizer/Render/Page/Data.php index f0728c70..a3ab50f0 100644 --- a/classes/Visualizer/Render/Page/Data.php +++ b/classes/Visualizer/Render/Page/Data.php @@ -246,6 +246,7 @@ class="dashicons dashicons-lock"> $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_DB_SCHEDULE, true ); $schedules = apply_filters( 'visualizer_schedules', array( + '0' => __( 'Live', 'visualizer' ), '1' => __( 'Each hour', 'visualizer' ), '12' => __( 'Each 12 hours', 'visualizer' ), '24' => __( 'Each day', 'visualizer' ), From 9393daccb213737759187e52cfcdcf5a552b3698 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Tue, 20 Feb 2018 08:15:28 +0530 Subject: [PATCH 11/58] grunt --- classes/Visualizer/Module/Setup.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/Visualizer/Module/Setup.php b/classes/Visualizer/Module/Setup.php index 4d61a9f4..1657466f 100644 --- a/classes/Visualizer/Module/Setup.php +++ b/classes/Visualizer/Module/Setup.php @@ -151,9 +151,9 @@ public function deactivate() { * Refresh the specific chart from the db. This is mostly for charts that have 0 refresh time i.e. live data. * * @param WP_Post $chart The chart object. - * @param int $chart_id The chart id. - * @param bool $force If this is true, then the chart data will be refreshed no matter if the chart requests live data or cached data. - * If false, data will be refreshed only if the chart requests live data. + * @param int $chart_id The chart id. + * @param bool $force If this is true, then the chart data will be refreshed no matter if the chart requests live data or cached data. + * If false, data will be refreshed only if the chart requests live data. * * @access public */ From d29a9c45e53b740100b621cd140d58e09d58a6dc Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Tue, 20 Feb 2018 08:57:09 +0530 Subject: [PATCH 12/58] container doesnt get deleted when removing where clause --- classes/Visualizer/Render/Layout.php | 2 ++ js/frame.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/Visualizer/Render/Layout.php b/classes/Visualizer/Render/Layout.php index 9f26d5d0..7200da76 100644 --- a/classes/Visualizer/Render/Layout.php +++ b/classes/Visualizer/Render/Layout.php @@ -144,7 +144,9 @@ public static function _renderDbWizard( $args ) { if ( $where ) { $index = 0; foreach ( $where as $col ) { + echo '
    '; self::show( 'db-wizard-where', $columns, $col, $index++, $params ); + echo '
    '; } } ?> diff --git a/js/frame.js b/js/frame.js index e5ef3102..cab2df86 100644 --- a/js/frame.js +++ b/js/frame.js @@ -178,7 +178,7 @@ }); $('.db-wizard-templates .db-wizard-where-template-remove').on('click', function(e){ - $(this).parent().remove(); + $(this).parent().parent().remove(); }); $('.db-wizard-templates .visualizer-select-where-added').removeClass('visualizer-select-where-added'); @@ -190,7 +190,7 @@ }); $('.db-wizard-where-template-remove').on('click', function(e){ - $(this).parent().remove(); + $(this).parent().parent().remove(); }); if($('.visualizer-select-select :selected').length === 0){ From fbc477839970645c1009bd3b68ca5cc92c444379 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Mon, 23 Apr 2018 12:44:14 +0530 Subject: [PATCH 13/58] date type series dont work --- classes/Visualizer/Module/Admin.php | 5 +++++ classes/Visualizer/Source.php | 12 ++++++++++++ classes/Visualizer/Source/Query.php | 7 ++++++- js/render.js | 6 +++++- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/classes/Visualizer/Module/Admin.php b/classes/Visualizer/Module/Admin.php index 13634176..5efc3914 100644 --- a/classes/Visualizer/Module/Admin.php +++ b/classes/Visualizer/Module/Admin.php @@ -370,12 +370,17 @@ public function renderLibraryPage() { $query = new WP_Query( $query_args ); while ( $query->have_posts() ) { $chart = $query->next_post(); + + // refresh a "live" db query chart. + $chart = apply_filters( 'visualizer_schedule_refresh_chart', $chart, $chart->ID, false ); + // fetch and update settings $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true ); unset( $settings['height'], $settings['width'] ); $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ); $series = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), $chart->ID, $type ); $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( html_entity_decode( $chart->post_content ) ), $chart->ID, $type ); + // add chart to the array $charts[ 'visualizer-' . $chart->ID ] = array( 'id' => $chart->ID, diff --git a/classes/Visualizer/Source.php b/classes/Visualizer/Source.php index 0a527a47..13f84271 100644 --- a/classes/Visualizer/Source.php +++ b/classes/Visualizer/Source.php @@ -210,6 +210,18 @@ protected function _normalizeData( $data ) { case 'boolean': $data[ $i ] = ! empty( $data[ $i ] ) ? filter_validate( $data[ $i ], FILTER_VALIDATE_BOOLEAN ) : null; break; + case 'date': + if ( array_key_exists( 'transform', $series ) ) { + switch ( $series['transform'] ) { + case 'mysql2date': + //$data[ $i ] = explode( ':', mysql2date( 'Y:m:d:H:i:s:0', $data[ $i ] ) ); + //$data[ $i ] = 1000 * intval(mysql2date( 'U', $data[ $i ] )); + //$data[ $i ] = array( 2018, 8, 9 ); + $data[ $i ] = "2018-02-19"; + break; + } + } + break; case 'timeofday': $date = new DateTime( '1984-03-16T' . $data[ $i ] ); if ( $date ) { diff --git a/classes/Visualizer/Source/Query.php b/classes/Visualizer/Source/Query.php index 1fac69d6..ced9fe40 100644 --- a/classes/Visualizer/Source/Query.php +++ b/classes/Visualizer/Source/Query.php @@ -80,7 +80,11 @@ public function fetch( $as_html = false ) { foreach ( $row as $k => $v ) { $result[] = $v; if ( 0 === $row_num ) { - $headers[] = array( 'type' => $this->get_col_type( $col_num++ ), 'label' => $k ); + $header = array( 'type' => $this->get_col_type( $col_num++ ), 'label' => $k ); + if ( $header['type'] === 'date' ) { + $header['transform'] = 'mysql2date'; + } + $headers[] = $header; } } $results[] = $result; @@ -149,6 +153,7 @@ private function object( $headers, $results ) { $data[] = $this->_normalizeData( $row ); } $this->_data = $data; + return true; } diff --git a/js/render.js b/js/render.js index cf44510f..d2fd5e76 100644 --- a/js/render.js +++ b/js/render.js @@ -158,6 +158,8 @@ row = []; for (j = 0; j < series.length; j++) { if (series[j].type === 'date' || series[j].type === 'datetime') { + data[i][j]=new Date("2013-01-30"); + date = new Date(data[i][j]); data[i][j] = null; if (Object.prototype.toString.call(date) === "[object Date]") { @@ -165,6 +167,8 @@ data[i][j] = date; } } + + console.log(data[i][j]); } row.push(data[i][j]); } @@ -200,7 +204,7 @@ } v.override(settings); - +console.log(table); render.draw(table, settings); }; From 430f7ed1e9408ff5b27fc0e435da7b73f1dc53e4 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Mon, 23 Apr 2018 13:37:19 +0530 Subject: [PATCH 14/58] temporary checkin --- classes/Visualizer/Source.php | 12 ------------ classes/Visualizer/Source/Query.php | 3 --- classes/Visualizer/Source/Query/Params.php | 5 +++-- js/render.js | 7 ++++--- 4 files changed, 7 insertions(+), 20 deletions(-) diff --git a/classes/Visualizer/Source.php b/classes/Visualizer/Source.php index 13f84271..0a527a47 100644 --- a/classes/Visualizer/Source.php +++ b/classes/Visualizer/Source.php @@ -210,18 +210,6 @@ protected function _normalizeData( $data ) { case 'boolean': $data[ $i ] = ! empty( $data[ $i ] ) ? filter_validate( $data[ $i ], FILTER_VALIDATE_BOOLEAN ) : null; break; - case 'date': - if ( array_key_exists( 'transform', $series ) ) { - switch ( $series['transform'] ) { - case 'mysql2date': - //$data[ $i ] = explode( ':', mysql2date( 'Y:m:d:H:i:s:0', $data[ $i ] ) ); - //$data[ $i ] = 1000 * intval(mysql2date( 'U', $data[ $i ] )); - //$data[ $i ] = array( 2018, 8, 9 ); - $data[ $i ] = "2018-02-19"; - break; - } - } - break; case 'timeofday': $date = new DateTime( '1984-03-16T' . $data[ $i ] ); if ( $date ) { diff --git a/classes/Visualizer/Source/Query.php b/classes/Visualizer/Source/Query.php index ced9fe40..a5ae6f1d 100644 --- a/classes/Visualizer/Source/Query.php +++ b/classes/Visualizer/Source/Query.php @@ -81,9 +81,6 @@ public function fetch( $as_html = false ) { $result[] = $v; if ( 0 === $row_num ) { $header = array( 'type' => $this->get_col_type( $col_num++ ), 'label' => $k ); - if ( $header['type'] === 'date' ) { - $header['transform'] = 'mysql2date'; - } $headers[] = $header; } } diff --git a/classes/Visualizer/Source/Query/Params.php b/classes/Visualizer/Source/Query/Params.php index d3f2a896..59b1b780 100644 --- a/classes/Visualizer/Source/Query/Params.php +++ b/classes/Visualizer/Source/Query/Params.php @@ -51,7 +51,7 @@ public function __construct( $params = null ) { } /** - * Rearrange columns so that a string column, if present, is always first in the select list as this will form the x axis. + * Rearrange columns so that a string/date column, if present, is always first in the select list as this will form the x axis. */ private function rearrange_columns_for_x_axis( $columns, $select, $tables ) { if ( ! $select ) { @@ -73,7 +73,7 @@ private function rearrange_columns_for_x_axis( $columns, $select, $tables ) { $col = $arr[1]; } foreach ( $columns[ $table ] as $table_cols ) { - if ( $table_cols['name'] === $column && 's' === $table_cols['type'] ) { + if ( $table_cols['name'] === $column && 'n' !== $table_cols['type'] ) { $first = $column; break; } @@ -87,6 +87,7 @@ private function rearrange_columns_for_x_axis( $columns, $select, $tables ) { array_unshift( $select, $first ); } +error_log(print_r($select,true)); return implode( ',', $select ); } diff --git a/js/render.js b/js/render.js index d2fd5e76..9db41b7c 100644 --- a/js/render.js +++ b/js/render.js @@ -124,6 +124,7 @@ } if (axis) { + console.log(axis); for (property in axis.viewWindow) { date = new Date(axis.viewWindow[property]); if (Object.prototype.toString.call(date) === "[object Date]") { @@ -158,8 +159,8 @@ row = []; for (j = 0; j < series.length; j++) { if (series[j].type === 'date' || series[j].type === 'datetime') { - data[i][j]=new Date("2013-01-30"); - + //data[i][j]=new Date("2013-01-30"); +console.log("in " + data[i][j] ); date = new Date(data[i][j]); data[i][j] = null; if (Object.prototype.toString.call(date) === "[object Date]") { @@ -167,7 +168,7 @@ data[i][j] = date; } } - + console.log(data[i][j]); } row.push(data[i][j]); From 80a58383c65d80adbe7eca8875fe8ae81b288c62 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Mon, 23 Apr 2018 13:40:59 +0530 Subject: [PATCH 15/58] Revert "temporary checkin" This reverts commit 430f7ed1e9408ff5b27fc0e435da7b73f1dc53e4. --- classes/Visualizer/Source.php | 12 ++++++++++++ classes/Visualizer/Source/Query.php | 3 +++ classes/Visualizer/Source/Query/Params.php | 5 ++--- js/render.js | 7 +++---- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/classes/Visualizer/Source.php b/classes/Visualizer/Source.php index 0a527a47..13f84271 100644 --- a/classes/Visualizer/Source.php +++ b/classes/Visualizer/Source.php @@ -210,6 +210,18 @@ protected function _normalizeData( $data ) { case 'boolean': $data[ $i ] = ! empty( $data[ $i ] ) ? filter_validate( $data[ $i ], FILTER_VALIDATE_BOOLEAN ) : null; break; + case 'date': + if ( array_key_exists( 'transform', $series ) ) { + switch ( $series['transform'] ) { + case 'mysql2date': + //$data[ $i ] = explode( ':', mysql2date( 'Y:m:d:H:i:s:0', $data[ $i ] ) ); + //$data[ $i ] = 1000 * intval(mysql2date( 'U', $data[ $i ] )); + //$data[ $i ] = array( 2018, 8, 9 ); + $data[ $i ] = "2018-02-19"; + break; + } + } + break; case 'timeofday': $date = new DateTime( '1984-03-16T' . $data[ $i ] ); if ( $date ) { diff --git a/classes/Visualizer/Source/Query.php b/classes/Visualizer/Source/Query.php index a5ae6f1d..ced9fe40 100644 --- a/classes/Visualizer/Source/Query.php +++ b/classes/Visualizer/Source/Query.php @@ -81,6 +81,9 @@ public function fetch( $as_html = false ) { $result[] = $v; if ( 0 === $row_num ) { $header = array( 'type' => $this->get_col_type( $col_num++ ), 'label' => $k ); + if ( $header['type'] === 'date' ) { + $header['transform'] = 'mysql2date'; + } $headers[] = $header; } } diff --git a/classes/Visualizer/Source/Query/Params.php b/classes/Visualizer/Source/Query/Params.php index 59b1b780..d3f2a896 100644 --- a/classes/Visualizer/Source/Query/Params.php +++ b/classes/Visualizer/Source/Query/Params.php @@ -51,7 +51,7 @@ public function __construct( $params = null ) { } /** - * Rearrange columns so that a string/date column, if present, is always first in the select list as this will form the x axis. + * Rearrange columns so that a string column, if present, is always first in the select list as this will form the x axis. */ private function rearrange_columns_for_x_axis( $columns, $select, $tables ) { if ( ! $select ) { @@ -73,7 +73,7 @@ private function rearrange_columns_for_x_axis( $columns, $select, $tables ) { $col = $arr[1]; } foreach ( $columns[ $table ] as $table_cols ) { - if ( $table_cols['name'] === $column && 'n' !== $table_cols['type'] ) { + if ( $table_cols['name'] === $column && 's' === $table_cols['type'] ) { $first = $column; break; } @@ -87,7 +87,6 @@ private function rearrange_columns_for_x_axis( $columns, $select, $tables ) { array_unshift( $select, $first ); } -error_log(print_r($select,true)); return implode( ',', $select ); } diff --git a/js/render.js b/js/render.js index 9db41b7c..d2fd5e76 100644 --- a/js/render.js +++ b/js/render.js @@ -124,7 +124,6 @@ } if (axis) { - console.log(axis); for (property in axis.viewWindow) { date = new Date(axis.viewWindow[property]); if (Object.prototype.toString.call(date) === "[object Date]") { @@ -159,8 +158,8 @@ row = []; for (j = 0; j < series.length; j++) { if (series[j].type === 'date' || series[j].type === 'datetime') { - //data[i][j]=new Date("2013-01-30"); -console.log("in " + data[i][j] ); + data[i][j]=new Date("2013-01-30"); + date = new Date(data[i][j]); data[i][j] = null; if (Object.prototype.toString.call(date) === "[object Date]") { @@ -168,7 +167,7 @@ console.log("in " + data[i][j] ); data[i][j] = date; } } - + console.log(data[i][j]); } row.push(data[i][j]); From 66fbf6ac39d763487264b11b47d87e26299a224f Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Mon, 23 Apr 2018 13:52:08 +0530 Subject: [PATCH 16/58] date type column should be on the x axis --- classes/Visualizer/Source/Query/Params.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Visualizer/Source/Query/Params.php b/classes/Visualizer/Source/Query/Params.php index d3f2a896..122b723b 100644 --- a/classes/Visualizer/Source/Query/Params.php +++ b/classes/Visualizer/Source/Query/Params.php @@ -73,7 +73,7 @@ private function rearrange_columns_for_x_axis( $columns, $select, $tables ) { $col = $arr[1]; } foreach ( $columns[ $table ] as $table_cols ) { - if ( $table_cols['name'] === $column && 's' === $table_cols['type'] ) { + if ( $table_cols['name'] === $column && 'n' !== $table_cols['type'] ) { $first = $column; break; } From ae91dc3df00524e10de2e9975b6d94ae85b2eddf Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Mon, 23 Apr 2018 13:57:56 +0530 Subject: [PATCH 17/58] undo changes that were not required --- classes/Visualizer/Source.php | 12 ------------ classes/Visualizer/Source/Query.php | 6 +----- js/render.js | 7 +------ 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/classes/Visualizer/Source.php b/classes/Visualizer/Source.php index 0266554c..eb80e245 100644 --- a/classes/Visualizer/Source.php +++ b/classes/Visualizer/Source.php @@ -210,18 +210,6 @@ protected function _normalizeData( $data ) { case 'boolean': $data[ $i ] = ! empty( $data[ $i ] ) ? filter_validate( $data[ $i ], FILTER_VALIDATE_BOOLEAN ) : null; break; - case 'date': - if ( array_key_exists( 'transform', $series ) ) { - switch ( $series['transform'] ) { - case 'mysql2date': - //$data[ $i ] = explode( ':', mysql2date( 'Y:m:d:H:i:s:0', $data[ $i ] ) ); - //$data[ $i ] = 1000 * intval(mysql2date( 'U', $data[ $i ] )); - //$data[ $i ] = array( 2018, 8, 9 ); - $data[ $i ] = "2018-02-19"; - break; - } - } - break; case 'timeofday': $date = new DateTime( '1984-03-16T' . $data[ $i ] ); if ( $date ) { diff --git a/classes/Visualizer/Source/Query.php b/classes/Visualizer/Source/Query.php index ced9fe40..da440bf0 100644 --- a/classes/Visualizer/Source/Query.php +++ b/classes/Visualizer/Source/Query.php @@ -80,11 +80,7 @@ public function fetch( $as_html = false ) { foreach ( $row as $k => $v ) { $result[] = $v; if ( 0 === $row_num ) { - $header = array( 'type' => $this->get_col_type( $col_num++ ), 'label' => $k ); - if ( $header['type'] === 'date' ) { - $header['transform'] = 'mysql2date'; - } - $headers[] = $header; + $headers[] = array( 'type' => $this->get_col_type( $col_num++ ), 'label' => $k ); } } $results[] = $result; diff --git a/js/render.js b/js/render.js index d2fd5e76..d983ce7c 100644 --- a/js/render.js +++ b/js/render.js @@ -157,9 +157,7 @@ for (i = 0; i < data.length; i++) { row = []; for (j = 0; j < series.length; j++) { - if (series[j].type === 'date' || series[j].type === 'datetime') { - data[i][j]=new Date("2013-01-30"); - + if (series[j].type === 'date' || series[j].type === 'datetime') { date = new Date(data[i][j]); data[i][j] = null; if (Object.prototype.toString.call(date) === "[object Date]") { @@ -167,8 +165,6 @@ data[i][j] = date; } } - - console.log(data[i][j]); } row.push(data[i][j]); } @@ -204,7 +200,6 @@ } v.override(settings); -console.log(table); render.draw(table, settings); }; From 70c4b8687a3ff30c9daf4124a75d7a999cecda25 Mon Sep 17 00:00:00 2001 From: contactashish13 Date: Thu, 26 Apr 2018 23:58:54 +0530 Subject: [PATCH 18/58] default chart comes up after creating a new chart --- classes/Visualizer/Module/Chart.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/classes/Visualizer/Module/Chart.php b/classes/Visualizer/Module/Chart.php index 5d96e2f6..5ecdd0e1 100644 --- a/classes/Visualizer/Module/Chart.php +++ b/classes/Visualizer/Module/Chart.php @@ -477,6 +477,10 @@ public function uploadData() { if ( ! isset( $_POST['chart_data_src'] ) || Visualizer_Plugin::CF_SOURCE_FILTER !== $_POST['chart_data_src'] ) { // delete the filters in case this chart is being uploaded from other data sources delete_post_meta( $chart_id, 'visualizer-filter-config' ); + + // delete "import from db" specific parameters. + delete_post_meta( $chart_id, Visualizer_Plugin::CF_DB_PARAMS ); + delete_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE ); } $source = null; @@ -685,6 +689,7 @@ public function saveQuery() { update_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() ); update_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); update_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, $hours ); + update_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, 0 ); $schedules = get_option( Visualizer_Plugin::CF_DB_SCHEDULE, array() ); $schedules[ $chart_id ] = time() + $hours * HOUR_IN_SECONDS; From 20389769a07317e60319ba44bbfb02036a0d81c3 Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Sun, 29 Jul 2018 17:32:08 +0530 Subject: [PATCH 19/58] support single table query --- classes/Visualizer/Source/Query/Params.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/classes/Visualizer/Source/Query/Params.php b/classes/Visualizer/Source/Query/Params.php index 122b723b..72f83d92 100644 --- a/classes/Visualizer/Source/Query/Params.php +++ b/classes/Visualizer/Source/Query/Params.php @@ -98,6 +98,8 @@ private function rearrange_columns_for_x_axis( $columns, $select, $tables ) { private function build_query() { $args = $this->_params; + do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'Building query with params %s', print_r( $args, true ) ), 'debug', __FILE__, __LINE__ ); + $table = $args['from']; $tables = array( $table ); $mapping = self::get_db_table_mapping(); @@ -140,7 +142,11 @@ private function build_query() { if ( empty( $column ) ) { continue; } - $table = strstr( $column, '.', true ); + if ( strpos( $column, '.' ) !== false ) { + $table = strstr( $column, '.', true ); + } else { + $table = $args['from']; + } $scraps[] = array( 'table' => $table, 'col' => $column, @@ -154,7 +160,7 @@ private function build_query() { if ( $scrap['col'] === $col['name'] ) { $operator = $args[ $col['type'] . '-operator' ][ $scrap['index'] ]; $operand = $args[ $col['type'] ][ $scrap['index'] ]; - $where[] = $scrap['col'] . " $operator $operand"; + $where[] = $scrap['col'] . " $operator '$operand'"; } } } @@ -176,6 +182,8 @@ private function build_query() { $query = $select . $from . $where . $group . $order . $limit; $this->_query = $query; + + do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'Firing query: %s', $this->_query ), 'debug', __FILE__, __LINE__ ); } /** From 49b3d912934a1252ec3b65d353868efa79f3ebad Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Tue, 16 Oct 2018 18:42:53 +0530 Subject: [PATCH 20/58] single table bug --- classes/Visualizer/Source/Query/Params.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Visualizer/Source/Query/Params.php b/classes/Visualizer/Source/Query/Params.php index 72f83d92..e6ea45ab 100644 --- a/classes/Visualizer/Source/Query/Params.php +++ b/classes/Visualizer/Source/Query/Params.php @@ -64,7 +64,7 @@ private function rearrange_columns_for_x_axis( $columns, $select, $tables ) { if ( ! is_null( $first ) ) { break; } - $table = $tables; + $table = is_array( $tables ) ? $tables[0] : $tables; $col = $column; if ( 0 !== strpos( $column, 'count(' ) ) { if ( count( $tables ) > 1 ) { From ee3127a23979f380d9ec5ec65cb5f302a7641de6 Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Tue, 16 Oct 2018 18:43:10 +0530 Subject: [PATCH 21/58] comment tables --- classes/Visualizer/Source/Query/Params.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/classes/Visualizer/Source/Query/Params.php b/classes/Visualizer/Source/Query/Params.php index e6ea45ab..6dc26901 100644 --- a/classes/Visualizer/Source/Query/Params.php +++ b/classes/Visualizer/Source/Query/Params.php @@ -203,6 +203,7 @@ public static function get_db_table_mapping() { $wpdb->prefix . 'posts' => $wpdb->prefix . 'postmeta', $wpdb->prefix . 'users' => $wpdb->prefix . 'usermeta', $wpdb->prefix . 'terms' => $wpdb->prefix . 'termmeta', + $wpdb->prefix . 'comments' => $wpdb->prefix . 'commentmeta', ); $mapping = apply_filters( 'visualizer_pro_db_table_mapping', $mapping ); $mapping += array_flip( $mapping ); @@ -224,6 +225,7 @@ private function get_foreign_key_constraint( $table1, $table2 ) { $posts = array( $wpdb->prefix . 'posts', $wpdb->prefix . 'postmeta' ); $users = array( $wpdb->prefix . 'users', $wpdb->prefix . 'usermeta' ); $terms = array( $wpdb->prefix . 'terms', $wpdb->prefix . 'termmeta' ); + $comments = array( $wpdb->prefix . 'comments', $wpdb->prefix . 'commentmeta' ); if ( in_array( $table1, $posts ) && in_array( $table2, $posts ) ) { return $wpdb->prefix . 'posts.ID = ' . $wpdb->prefix . 'postmeta.post_id'; @@ -234,6 +236,9 @@ private function get_foreign_key_constraint( $table1, $table2 ) { if ( in_array( $table1, $terms ) && in_array( $table2, $terms ) ) { return $wpdb->prefix . 'terms.term_id = ' . $wpdb->prefix . 'termmeta.term_id'; } + if ( in_array( $table1, $comments ) && in_array( $table2, $comments ) ) { + return $wpdb->prefix . 'comments.comment_id = ' . $wpdb->prefix . 'commentmeta.comment_id'; + } return apply_filters( 'visualizer_pro_db_fk_constraint', '', $table1, $table2 ); } From a42638cd5fd50e104184b5479c623a4a3545d573 Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Mon, 29 Oct 2018 14:24:20 +0530 Subject: [PATCH 22/58] Integrate https://www.datatables.net as new table type --- classes/Visualizer/Module/Admin.php | 6 +- classes/Visualizer/Module/Chart.php | 1 + classes/Visualizer/Module/Frontend.php | 2 + classes/Visualizer/Render/Sidebar/Graph.php | 12 + .../Visualizer/Render/Sidebar/Type/Table.php | 397 ++++++++++++++++++ css/frame.css | 4 + samples/htmltable.csv | 7 + 7 files changed, 428 insertions(+), 1 deletion(-) create mode 100644 classes/Visualizer/Render/Sidebar/Type/Table.php create mode 100644 samples/htmltable.csv diff --git a/classes/Visualizer/Module/Admin.php b/classes/Visualizer/Module/Admin.php index d8a664f5..a0bcef8d 100644 --- a/classes/Visualizer/Module/Admin.php +++ b/classes/Visualizer/Module/Admin.php @@ -326,9 +326,13 @@ public static function _getChartTypesLocalized( $enabledOnly = false, $get2Darra 'name' => esc_html__( 'Candlestick', 'visualizer' ), 'enabled' => true, ), + 'htmltable' => array( + 'name' => esc_html__( 'Table (New)', 'visualizer' ), + 'enabled' => true, + ), // pro types 'table' => array( - 'name' => esc_html__( 'Table', 'visualizer' ), + 'name' => esc_html__( 'Table (Deprecated)', 'visualizer' ), 'enabled' => false, ), 'timeline' => array( diff --git a/classes/Visualizer/Module/Chart.php b/classes/Visualizer/Module/Chart.php index c4b24127..759f88f4 100644 --- a/classes/Visualizer/Module/Chart.php +++ b/classes/Visualizer/Module/Chart.php @@ -385,6 +385,7 @@ private function _handleDataAndSettingsPage() { ), ) ); + do_action( 'visualizer_load_assets_' . $data['type'] ); $render = new Visualizer_Render_Page_Data(); $render->chart = $this->_chart; $render->type = $data['type']; diff --git a/classes/Visualizer/Module/Frontend.php b/classes/Visualizer/Module/Frontend.php index 9ab77d08..2c44530d 100644 --- a/classes/Visualizer/Module/Frontend.php +++ b/classes/Visualizer/Module/Frontend.php @@ -255,6 +255,8 @@ public function renderChart( $atts ) { ); // enqueue visualizer render and update render localizations + do_action( 'visualizer_load_assets_' . $type ); + wp_enqueue_script( 'visualizer-render' ); wp_localize_script( 'visualizer-render', diff --git a/classes/Visualizer/Render/Sidebar/Graph.php b/classes/Visualizer/Render/Sidebar/Graph.php index 158cfd40..2ff960de 100644 --- a/classes/Visualizer/Render/Sidebar/Graph.php +++ b/classes/Visualizer/Render/Sidebar/Graph.php @@ -81,8 +81,20 @@ public function __construct( $data = array() ) { 'out' => esc_html__( 'Outside the chart', 'visualizer' ), 'none' => esc_html__( 'None', 'visualizer' ), ); + + $this->hooks(); } + /** + * Registers additional hooks. + * + * @access protected + */ + protected function hooks() { + // empty. + } + + /** * Renders chart title settings. * diff --git a/classes/Visualizer/Render/Sidebar/Type/Table.php b/classes/Visualizer/Render/Sidebar/Type/Table.php new file mode 100644 index 00000000..f673a7b9 --- /dev/null +++ b/classes/Visualizer/Render/Sidebar/Type/Table.php @@ -0,0 +1,397 @@ + | +// +----------------------------------------------------------------------+ +/** + * Class for datatables.net table chart sidebar settings. + * + * @since 1.0.0 + */ +class Table extends Visualizer_Render_Sidebar_Columnar { + + /** + * Constructor. + * + * @since 1.0.0 + * + * @access public + * @param array $data The data what has to be associated with this render. + */ + public function __construct( $data = array() ) { + parent::__construct( $data ); + $this->_includeCurveTypes = false; + } + + /** + * Registers additional hooks. + * + * @access protected + */ + protected function hooks() { + add_action( 'visualizer_load_assets_htmltable', array( $this, 'load_assets' ) ); + } + + public function load_assets() { + error_log("yeah"); + } + + /** + * Renders template. + * + * @since 1.0.0 + * + * @access protected + */ + protected function _toHTML() { + $this->_supportsAnimation = false; + $this->_renderGeneralSettings(); + $this->_renderColumnarSettings(); + $this->_renderSeriesSettings(); + $this->_renderViewSettings(); + $this->_renderAdvancedSettings(); + } + + /** + * Renders general settings group. + * + * @since 1.0.0 + * + * @access protected + */ + protected function _renderGeneralSettings() { + self::_renderGroupStart( esc_html__( 'General Settings', 'visualizer' ) ); + self::_renderSectionStart( esc_html__( 'Title', 'visualizer' ), false ); + self::_renderTextItem( + esc_html__( 'Chart Title', 'visualizer' ), + 'title', + $this->title, + esc_html__( 'Text to display in the back-end admin area.', 'visualizer' ) + ); + self::_renderSectionEnd(); + self::_renderGroupEnd(); + } + + /** + * Renders line settings items. + * + * @since 1.0.0 + * + * @access protected + */ + protected function _renderColumnarSettings() { + self::_renderGroupStart( esc_html__( 'Table Settings', 'visualizer' ) ); + self::_renderSectionStart(); + + self::_renderCheckboxItem( + esc_html__( 'Enable Pagination', 'visualizer' ), + 'pagination', + $this->pagination, + 1, + esc_html__( 'To enable paging through the data.', 'visualizer' ) + ); + + echo '
    '; + + self::_renderTextItem( + esc_html__( 'Number of rows per page', 'visualizer' ), + 'pageSize', + $this->pageSize, + esc_html__( 'The number of rows in each page, when paging is enabled.', 'visualizer' ), + '10' + ); + + echo '
    '; + + self::_renderCheckboxItem( + esc_html__( 'Disable Sort', 'visualizer' ), + 'sort', + $this->sort, + 'disable', + esc_html__( 'To disable sorting on columns.', 'visualizer' ) + ); + + echo '
    '; + + self::_renderTextItem( + esc_html__( 'Freeze Columns', 'visualizer' ), + 'frozenColumns', + $this->frozenColumns, + esc_html__( 'The number of columns from the left that will be frozen.', 'visualizer' ), + '', + 'number', + array( + 'min' => 0, + ) + ); + + echo '
    '; + + self::_renderCheckboxItem( + esc_html__( 'Allow HTML', 'visualizer' ), + 'allowHtml', + $this->allowHtml, + 1, + esc_html__( 'If enabled, formatted values of cells that include HTML tags will be rendered as HTML.', 'visualizer' ) + ); + + echo '
    '; + + self::_renderCheckboxItem( + esc_html__( 'Right to Left table', 'visualizer' ), + 'rtlTable', + $this->rtlTable, + 1, + esc_html__( 'Adds basic support for right-to-left languages.', 'visualizer' ) + ); + + self::_renderSectionEnd(); + self::_renderGroupEnd(); + + self::_renderGroupStart( esc_html__( 'Row/Cell Settings', 'visualizer' ) ); + self::_renderSectionStart( esc_html__( 'Header Row', 'visualizer' ) ); + self::_renderColorPickerItem( + esc_html__( 'Background Color', 'visualizer' ), + 'customcss[headerRow][background-color]', + isset( $this->customcss['headerRow']['background-color'] ) ? $this->customcss['headerRow']['background-color'] : null, + null + ); + + self::_renderColorPickerItem( + esc_html__( 'Color', 'visualizer' ), + 'customcss[headerRow][color]', + isset( $this->customcss['headerRow']['color'] ) ? $this->customcss['headerRow']['color'] : null, + null + ); + + self::_renderTextItem( + esc_html__( 'Text Orientation', 'visualizer' ), + 'customcss[headerRow][transform]', + isset( $this->customcss['headerRow']['transform'] ) ? $this->customcss['headerRow']['transform'] : null, + esc_html__( 'In degrees.', 'visualizer' ), + '', + 'number', + array( + 'min' => -180, + 'max' => 180, + ) + ); + self::_renderSectionEnd(); + + self::_renderSectionStart( esc_html__( 'Table Row', 'visualizer' ) ); + self::_renderColorPickerItem( + esc_html__( 'Background Color', 'visualizer' ), + 'customcss[tableRow][background-color]', + isset( $this->customcss['tableRow']['background-color'] ) ? $this->customcss['tableRow']['background-color'] : null, + null + ); + + self::_renderColorPickerItem( + esc_html__( 'Color', 'visualizer' ), + 'customcss[tableRow][color]', + isset( $this->customcss['tableRow']['color'] ) ? $this->customcss['tableRow']['color'] : null, + null + ); + + self::_renderTextItem( + esc_html__( 'Text Orientation', 'visualizer' ), + 'customcss[tableRow][transform]', + isset( $this->customcss['tableRow']['transform'] ) ? $this->customcss['tableRow']['transform'] : null, + esc_html__( 'In degrees.', 'visualizer' ), + '', + 'number', + array( + 'min' => -180, + 'max' => 180, + ) + ); + self::_renderSectionEnd(); + + self::_renderSectionStart( esc_html__( 'Odd Table Row', 'visualizer' ) ); + self::_renderColorPickerItem( + esc_html__( 'Background Color', 'visualizer' ), + 'customcss[oddTableRow][background-color]', + isset( $this->customcss['oddTableRow']['background-color'] ) ? $this->customcss['oddTableRow']['background-color'] : null, + null + ); + + self::_renderColorPickerItem( + esc_html__( 'Color', 'visualizer' ), + 'customcss[oddTableRow][color]', + isset( $this->customcss['oddTableRow']['color'] ) ? $this->customcss['oddTableRow']['color'] : null, + null + ); + + self::_renderTextItem( + esc_html__( 'Text Orientation', 'visualizer' ), + 'customcss[oddTableRow][transform]', + isset( $this->customcss['oddTableRow']['transform'] ) ? $this->customcss['oddTableRow']['transform'] : null, + esc_html__( 'In degrees.', 'visualizer' ), + '', + 'number', + array( + 'min' => -180, + 'max' => 180, + ) + ); + self::_renderSectionEnd(); + + self::_renderSectionStart( esc_html__( 'Selected Table Row', 'visualizer' ) ); + self::_renderColorPickerItem( + esc_html__( 'Background Color', 'visualizer' ), + 'customcss[selectedTableRow][background-color]', + isset( $this->customcss['selectedTableRow']['background-color'] ) ? $this->customcss['selectedTableRow']['background-color'] : null, + null + ); + + self::_renderColorPickerItem( + esc_html__( 'Color', 'visualizer' ), + 'customcss[selectedTableRow][color]', + isset( $this->customcss['selectedTableRow']['color'] ) ? $this->customcss['selectedTableRow']['color'] : null, + null + ); + + self::_renderTextItem( + esc_html__( 'Text Orientation', 'visualizer' ), + 'customcss[selectedTableRow][transform]', + isset( $this->customcss['selectedTableRow']['transform'] ) ? $this->customcss['selectedTableRow']['transform'] : null, + esc_html__( 'In degrees.', 'visualizer' ), + '', + 'number', + array( + 'min' => -180, + 'max' => 180, + ) + ); + self::_renderSectionEnd(); + + self::_renderSectionStart( esc_html__( 'Hover Table Row', 'visualizer' ) ); + self::_renderColorPickerItem( + esc_html__( 'Background Color', 'visualizer' ), + 'customcss[hoverTableRow][background-color]', + isset( $this->customcss['hoverTableRow']['background-color'] ) ? $this->customcss['hoverTableRow']['background-color'] : null, + null + ); + + self::_renderColorPickerItem( + esc_html__( 'Color', 'visualizer' ), + 'customcss[hoverTableRow][color]', + isset( $this->customcss['hoverTableRow']['color'] ) ? $this->customcss['hoverTableRow']['color'] : null, + null + ); + + self::_renderTextItem( + esc_html__( 'Text Orientation', 'visualizer' ), + 'customcss[hoverTableRow][transform]', + isset( $this->customcss['hoverTableRow']['transform'] ) ? $this->customcss['hoverTableRow']['transform'] : null, + esc_html__( 'In degrees.', 'visualizer' ), + '', + 'number', + array( + 'min' => -180, + 'max' => 180, + ) + ); + self::_renderSectionEnd(); + + self::_renderSectionStart( esc_html__( 'Header Cell', 'visualizer' ) ); + self::_renderColorPickerItem( + esc_html__( 'Background Color', 'visualizer' ), + 'customcss[headerCell][background-color]', + isset( $this->customcss['headerCell']['background-color'] ) ? $this->customcss['headerCell']['background-color'] : null, + null + ); + + self::_renderColorPickerItem( + esc_html__( 'Color', 'visualizer' ), + 'customcss[headerCell][color]', + isset( $this->customcss['headerCell']['color'] ) ? $this->customcss['headerCell']['color'] : null, + null + ); + + self::_renderTextItem( + esc_html__( 'Text Orientation', 'visualizer' ), + 'customcss[headerCell][transform]', + isset( $this->customcss['headerCell']['transform'] ) ? $this->customcss['headerCell']['transform'] : null, + esc_html__( 'In degrees.', 'visualizer' ), + '', + 'number', + array( + 'min' => -180, + 'max' => 180, + ) + ); + self::_renderSectionEnd(); + + self::_renderSectionStart( esc_html__( 'Table Cell', 'visualizer' ) ); + self::_renderColorPickerItem( + esc_html__( 'Background Color', 'visualizer' ), + 'customcss[tableCell][background-color]', + isset( $this->customcss['tableCell']['background-color'] ) ? $this->customcss['tableCell']['background-color'] : null, + null + ); + + self::_renderColorPickerItem( + esc_html__( 'Color', 'visualizer' ), + 'customcss[tableCell][color]', + isset( $this->customcss['tableCell']['color'] ) ? $this->customcss['tableCell']['color'] : null, + null + ); + + self::_renderTextItem( + esc_html__( 'Text Orientation', 'visualizer' ), + 'customcss[tableCell][transform]', + isset( $this->customcss['tableCell']['transform'] ) ? $this->customcss['tableCell']['transform'] : null, + esc_html__( 'In degrees.', 'visualizer' ), + '', + 'number', + array( + 'min' => -180, + 'max' => 180, + ) + ); + self::_renderSectionEnd(); + + self::_renderGroupEnd(); + } + + /** + * Renders concreate series settings. + * + * @since 1.4.0 + * + * @access protected + * @param int $index The series index. + */ + protected function _renderSeries( $index ) { + $this->_renderFormatField( $index ); + } + + /** + * Renders combo series settings + * + * @since 1.0.0 + * + * @access protected + */ + protected function _renderSeriesSettings() { + parent::_renderSeriesSettings(); + } + +} diff --git a/css/frame.css b/css/frame.css index bf32a4cd..d403e561 100644 --- a/css/frame.css +++ b/css/frame.css @@ -484,6 +484,10 @@ div.viz-group-content .viz-group-description { background-position: -600px -225px; } +.type-box-htmltable .type-label { + background-position: -301px -670px; +} + .type-box-table .type-label { background-position: -301px -670px; } diff --git a/samples/htmltable.csv b/samples/htmltable.csv new file mode 100644 index 00000000..a779626b --- /dev/null +++ b/samples/htmltable.csv @@ -0,0 +1,7 @@ +Month,Bolivia,Ecuador,Madagascar,Papua New Guinea,Rwanda +date,number,number,number,number,number +2004/05,165,938,522,998,450 +2005/06,135,1120,599,1268,288 +2006/07,157,1167,587,807,397 +2007/08,139,1110,615,968,215 +2008/09,136,691,629,1026,366 \ No newline at end of file From 1466d2b164e1db5b42068c0af9cd1a762bdf44d7 Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Thu, 1 Nov 2018 12:09:16 +0530 Subject: [PATCH 23/58] WIP --- classes/Visualizer/Module/Admin.php | 81 +++++++++++++------ classes/Visualizer/Module/Chart.php | 16 +--- classes/Visualizer/Module/Frontend.php | 23 ++++-- classes/Visualizer/Render/Sidebar/Graph.php | 33 +++++++- .../Type/{Table.php => Html_Table.php} | 5 +- js/render-facade.js | 5 ++ js/{render.js => render-google.js} | 25 +++--- 7 files changed, 129 insertions(+), 59 deletions(-) rename classes/Visualizer/Render/Sidebar/Type/{Table.php => Html_Table.php} (98%) create mode 100644 js/render-facade.js rename js/{render.js => render-google.js} (95%) diff --git a/classes/Visualizer/Module/Admin.php b/classes/Visualizer/Module/Admin.php index a0bcef8d..bc385793 100644 --- a/classes/Visualizer/Module/Admin.php +++ b/classes/Visualizer/Module/Admin.php @@ -419,20 +419,26 @@ public function enqueueLibraryScripts( $suffix ) { Visualizer_Plugin::VERSION, true ); - wp_enqueue_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); - wp_enqueue_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true ); + wp_enqueue_script( 'visualizer-customization', $this->get_user_customization_js(), array(), null, true ); - wp_enqueue_script( - 'visualizer-render', - VISUALIZER_ABSURL . 'js/render.js', - array( - 'google-jsapi-old', - 'visualizer-library', - 'visualizer-customization', - ), - Visualizer_Plugin::VERSION, - true - ); + + $query = $this->getQuery(); + while ( $query->have_posts() ) { + $chart = $query->next_post(); + $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ); + $name = 'Visualizer_Render_Sidebar_Type_' . ucwords( $type ); + if ( ! class_exists( $name ) ) { + continue; + } + $class = new $name; + wp_enqueue_script( + "visualizer-render-$type", + VISUALIZER_ABSURL . 'js/render-facade.js', + apply_filters( 'visualizer_assets_render', array( 'visualizer-library', 'visualizer-customization' ), true ), + Visualizer_Plugin::VERSION, + true + ); + } } } @@ -466,14 +472,12 @@ public function registerAdminMenu() { $this->_libraryPage = add_submenu_page( 'upload.php', $title, $title, 'edit_posts', Visualizer_Plugin::NAME, $callback ); } - /** - * Renders visualizer library page. - * - * @since 1.0.0 - * - * @access public - */ - public function renderLibraryPage() { + private function getQuery() { + static $q; + if ( ! is_null( $q ) ) { + return $q; + } + // get current page $page = filter_input( INPUT_GET, @@ -517,10 +521,39 @@ public function renderLibraryPage() { $meta[] = $query; $query_args['meta_query'] = $meta; } - // Added by Ash/Upwork - // fetch charts + $q = new WP_Query( $query_args ); + return $q; + } + + /** + * Renders visualizer library page. + * + * @since 1.0.0 + * + * @access public + */ + public function renderLibraryPage() { $charts = array(); - $query = new WP_Query( $query_args ); + $query = $this->getQuery(); + + // get current page + $page = filter_input( + INPUT_GET, + 'vpage', + FILTER_VALIDATE_INT, + array( + 'options' => array( + 'min_range' => 1, + 'default' => 1, + ), + ) + ); + // add chart type filter to the query arguments + $filter = filter_input( INPUT_GET, 'type' ); + if ( ! ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) ) { + $filter = 'all'; + } + while ( $query->have_posts() ) { $chart = $query->next_post(); diff --git a/classes/Visualizer/Module/Chart.php b/classes/Visualizer/Module/Chart.php index 759f88f4..a45c6eb6 100644 --- a/classes/Visualizer/Module/Chart.php +++ b/classes/Visualizer/Module/Chart.php @@ -250,18 +250,11 @@ public function renderChartPages() { wp_register_style( 'visualizer-frame', VISUALIZER_ABSURL . 'css/frame.css', array( 'visualizer-chosen' ), Visualizer_Plugin::VERSION ); wp_register_script( 'visualizer-frame', VISUALIZER_ABSURL . 'js/frame.js', array( 'visualizer-chosen' ), Visualizer_Plugin::VERSION, true ); - wp_register_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); - wp_register_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true ); wp_register_script( 'visualizer-customization', $this->get_user_customization_js(), array(), null, true ); wp_register_script( 'visualizer-render', - VISUALIZER_ABSURL . 'js/render.js', - array( - 'google-jsapi-old', - 'google-jsapi-new', - 'visualizer-frame', - 'visualizer-customization', - ), + VISUALIZER_ABSURL . 'js/render-facade.js', + apply_filters( 'visualizer_assets_render', array( 'visualizer-frame', 'visualizer-customization' ), false ), Visualizer_Plugin::VERSION, true ); @@ -356,11 +349,10 @@ private function _handleDataAndSettingsPage() { } } unset( $data['settings']['width'], $data['settings']['height'] ); - wp_enqueue_style( 'visualizer-frame' ); wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'visualizer-frame' ); wp_enqueue_script( 'visualizer-preview' ); - wp_enqueue_script( 'visualizer-render' ); + wp_enqueue_script( 'visualizer-render' ); // isn't this redundant if above we have defined render as dependency? wp_localize_script( 'visualizer-render', 'visualizer', @@ -385,7 +377,7 @@ private function _handleDataAndSettingsPage() { ), ) ); - do_action( 'visualizer_load_assets_' . $data['type'] ); + $render = new Visualizer_Render_Page_Data(); $render->chart = $this->_chart; $render->type = $data['type']; diff --git a/classes/Visualizer/Module/Frontend.php b/classes/Visualizer/Module/Frontend.php index 2c44530d..bef0559c 100644 --- a/classes/Visualizer/Module/Frontend.php +++ b/classes/Visualizer/Module/Frontend.php @@ -157,10 +157,7 @@ public function perform_action( WP_REST_Request $params ) { * @access public */ public function enqueueScripts() { - wp_register_script( 'visualizer-google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); - wp_register_script( 'visualizer-google-jsapi-old', '//www.google.com/jsapi', array( 'visualizer-google-jsapi-new' ), null, true ); wp_register_script( 'visualizer-customization', $this->get_user_customization_js(), array(), null, true ); - wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'visualizer-google-jsapi-old', 'jquery', 'visualizer-customization' ), Visualizer_Plugin::VERSION, true ); wp_register_script( 'visualizer-clipboardjs', VISUALIZER_ABSURL . 'js/lib/clipboardjs/clipboard.min.js', array( 'jquery' ), Visualizer_Plugin::VERSION, true ); wp_register_style( 'visualizer-front', VISUALIZER_ABSURL . 'css/front.css', array(), Visualizer_Plugin::VERSION ); do_action( 'visualizer_pro_frontend_load_resources' ); @@ -254,16 +251,26 @@ public function renderChart( $atts ) { 'data' => $data, ); - // enqueue visualizer render and update render localizations - do_action( 'visualizer_load_assets_' . $type ); + $name = 'Visualizer_Render_Sidebar_Type_' . ucwords( $type ); + if ( class_exists( $name ) ) { + $classss = new $name; + } + + wp_register_script( + "visualizer-render-$type", + VISUALIZER_ABSURL . 'js/render-facade.js', + apply_filters( 'visualizer_assets_render', array( 'jquery', 'visualizer-customization' ), true ), + Visualizer_Plugin::VERSION, + true + ); - wp_enqueue_script( 'visualizer-render' ); + wp_enqueue_script( "visualizer-render-$type" ); wp_localize_script( - 'visualizer-render', + "visualizer-render-$type", 'visualizer', array( 'charts' => $this->_charts, - 'language' => $this->get_language(), + 'language' => $this->get_language(), 'map_api_key' => get_option( 'visualizer-map-api-key' ), 'rest_url' => version_compare( $wp_version, '4.7.0', '>=' ) ? rest_url( 'visualizer/v' . VISUALIZER_REST_VERSION . '/action/#id#/#type#/' ) : '', 'i10n' => array( diff --git a/classes/Visualizer/Render/Sidebar/Graph.php b/classes/Visualizer/Render/Sidebar/Graph.php index 2ff960de..509f7ef2 100644 --- a/classes/Visualizer/Render/Sidebar/Graph.php +++ b/classes/Visualizer/Render/Sidebar/Graph.php @@ -61,6 +61,14 @@ abstract class Visualizer_Render_Sidebar_Graph extends Visualizer_Render_Sidebar */ protected $_positions; + /** + * Is this a google chart? + * + * @access protected + * @var bool + */ + protected $_is_google_chart = true; + /** * Constructor. * @@ -91,9 +99,32 @@ public function __construct( $data = array() ) { * @access protected */ protected function hooks() { - // empty. + if ( $this->_is_google_chart ) { + add_filter( 'visualizer_assets_render', array( $this, 'load_google_assets' ), 10, 2 ); + } } + function load_google_assets( $deps, $is_frontend ) { + wp_register_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); + wp_register_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true ); + wp_register_script( + 'visualizer-render-google', + VISUALIZER_ABSURL . 'js/render-google.js', + array( + 'google-jsapi-old', + ), + Visualizer_Plugin::VERSION, + true + ); + + return array_merge( + $deps, + array( 'visualizer-render-google' ) + ); + + } + + /** * Renders chart title settings. diff --git a/classes/Visualizer/Render/Sidebar/Type/Table.php b/classes/Visualizer/Render/Sidebar/Type/Html_Table.php similarity index 98% rename from classes/Visualizer/Render/Sidebar/Type/Table.php rename to classes/Visualizer/Render/Sidebar/Type/Html_Table.php index f673a7b9..68b5a8d0 100644 --- a/classes/Visualizer/Render/Sidebar/Type/Table.php +++ b/classes/Visualizer/Render/Sidebar/Type/Html_Table.php @@ -24,7 +24,7 @@ * * @since 1.0.0 */ -class Table extends Visualizer_Render_Sidebar_Columnar { +class Visualizer_Render_Sidebar_Type_Html_Table extends Visualizer_Render_Sidebar_Columnar { /** * Constructor. @@ -37,6 +37,7 @@ class Table extends Visualizer_Render_Sidebar_Columnar { public function __construct( $data = array() ) { parent::__construct( $data ); $this->_includeCurveTypes = false; + $this->_is_google_chart = false; } /** @@ -45,7 +46,7 @@ public function __construct( $data = array() ) { * @access protected */ protected function hooks() { - add_action( 'visualizer_load_assets_htmltable', array( $this, 'load_assets' ) ); + $this->load_assets(); } public function load_assets() { diff --git a/js/render-facade.js b/js/render-facade.js new file mode 100644 index 00000000..04178fbe --- /dev/null +++ b/js/render-facade.js @@ -0,0 +1,5 @@ +(function($, v){ + $(document).ready(function(){ + $('body').trigger('visualizer:render:chart:start', v); + }); +})(jQuery, visualizer); \ No newline at end of file diff --git a/js/render.js b/js/render-google.js similarity index 95% rename from js/render.js rename to js/render-google.js index 7005db68..3ded2d3c 100644 --- a/js/render.js +++ b/js/render-google.js @@ -5,11 +5,9 @@ // this will store the images for each chart rendered. var __visualizer_chart_images = []; -(function(v, g) { +(function($) { var gv; - v.objects = {}; - v.renderChart = function(id) { var chart, render, container, series, data, table, settings, i, j, row, date, axis, property, format, formatter; @@ -206,7 +204,7 @@ var __visualizer_chart_images = []; } v.override(settings); - g.visualization.events.addListener(render, 'ready', function () { + gv.events.addListener(render, 'ready', function () { var arr = id.split('-'); try{ var img = render.getImageURI(); @@ -228,12 +226,12 @@ var __visualizer_chart_images = []; var formatter = null; switch (type) { case 'number': - formatter = new g.visualization.NumberFormat({pattern: format}); + formatter = new gv.NumberFormat({pattern: format}); break; case 'date': case 'datetime': case 'timeofday': - formatter = new g.visualization.DateFormat({pattern: format}); + formatter = new gv.DateFormat({pattern: format}); break; } @@ -264,12 +262,15 @@ var __visualizer_chart_images = []; } }; - g.charts.load("current", {packages: ["corechart", "geochart", "gauge", "table", "timeline"], mapsApiKey: v.map_api_key, 'language' : v.language}); - g.charts.setOnLoadCallback(function() { - gv = g.visualization; - v.render(); - }); -})(visualizer, google); + jQuery('body').on('visualizer:render:chart:start', function(event, v){ + v.objects = {}; + google.charts.load("current", {packages: ["corechart", "geochart", "gauge", "table", "timeline"], mapsApiKey: v.map_api_key, 'language' : v.language}); + goggle.charts.setOnLoadCallback(function() { + gv = google.visualization; + v.render(); + }); + }); +})(jQuery); (function($, v) { var resizeTimeout; From 37d2803103e160cfdfe52ba6f0b7b20326d5d067 Mon Sep 17 00:00:00 2001 From: Ashish Ravi Date: Fri, 9 Nov 2018 18:48:48 +0530 Subject: [PATCH 24/58] database import - SQL editor --- classes/Visualizer/Module/Admin.php | 38 ++- classes/Visualizer/Module/Chart.php | 136 +++++----- classes/Visualizer/Module/Frontend.php | 10 +- classes/Visualizer/Module/Setup.php | 7 +- classes/Visualizer/Module/Sources.php | 2 +- classes/Visualizer/Plugin.php | 3 +- classes/Visualizer/Render/Layout.php | 273 ++------------------- classes/Visualizer/Render/Library.php | 9 +- classes/Visualizer/Render/Page/Data.php | 93 +++---- classes/Visualizer/Source/Query.php | 10 +- classes/Visualizer/Source/Query/Params.php | 27 +- css/frame.css | 30 +++ index.php | 13 +- js/frame.js | 186 ++++---------- phpcs.xml | 2 + 15 files changed, 310 insertions(+), 529 deletions(-) diff --git a/classes/Visualizer/Module/Admin.php b/classes/Visualizer/Module/Admin.php index 6d02aa60..04654426 100644 --- a/classes/Visualizer/Module/Admin.php +++ b/classes/Visualizer/Module/Admin.php @@ -220,7 +220,9 @@ public function enqueueMediaScripts() { wp_enqueue_script( 'visualizer-media-controller', VISUALIZER_ABSURL . 'js/media/controller.js', array( 'visualizer-media-collection' ), Visualizer_Plugin::VERSION, true ); wp_enqueue_script( 'visualizer-media-view', VISUALIZER_ABSURL . 'js/media/view.js', array( 'visualizer-media-controller' ), Visualizer_Plugin::VERSION, true ); wp_localize_script( - 'visualizer-media-view', 'visualizer', array( + 'visualizer-media-view', + 'visualizer', + array( 'i10n' => array( 'insert' => __( 'Insert', 'visualizer' ), ), @@ -286,7 +288,8 @@ public static function _getChartTypesLocalized( $enabledOnly = false, $get2Darra } $types = array_merge( - $additional, array( + $additional, + array( 'pie' => array( 'name' => esc_html__( 'Pie', 'visualizer' ), 'enabled' => true, @@ -403,18 +406,26 @@ public function enqueueLibraryScripts( $suffix ) { $this->_addFilter( 'media_upload_tabs', 'setupVisualizerTab' ); wp_enqueue_media(); wp_enqueue_script( - 'visualizer-library', VISUALIZER_ABSURL . 'js/library.js', array( + 'visualizer-library', + VISUALIZER_ABSURL . 'js/library.js', + array( 'jquery', 'media-views', - ), Visualizer_Plugin::VERSION, true + ), + Visualizer_Plugin::VERSION, + true ); wp_enqueue_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); wp_enqueue_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true ); wp_enqueue_script( - 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( + 'visualizer-render', + VISUALIZER_ABSURL . 'js/render.js', + array( 'google-jsapi-old', 'visualizer-library', - ), Visualizer_Plugin::VERSION, true + ), + Visualizer_Plugin::VERSION, + true ); } } @@ -459,7 +470,10 @@ public function registerAdminMenu() { public function renderLibraryPage() { // get current page $page = filter_input( - INPUT_GET, 'vpage', FILTER_VALIDATE_INT, array( + INPUT_GET, + 'vpage', + FILTER_VALIDATE_INT, + array( 'options' => array( 'min_range' => 1, 'default' => 1, @@ -528,7 +542,9 @@ public function renderLibraryPage() { // enqueue charts array $ajaxurl = admin_url( 'admin-ajax.php' ); wp_localize_script( - 'visualizer-library', 'visualizer', array( + 'visualizer-library', + 'visualizer', + array( 'language' => $this->get_language(), 'map_api_key' => get_option( 'visualizer-map-api-key' ), 'charts' => $charts, @@ -539,13 +555,15 @@ public function renderLibraryPage() { 'action' => Visualizer_Plugin::ACTION_CREATE_CHART, 'library' => 'yes', 'type' => isset( $_GET['type'] ) ? $_GET['type'] : '', - ), $ajaxurl + ), + $ajaxurl ), 'edit' => add_query_arg( array( 'action' => Visualizer_Plugin::ACTION_EDIT_CHART, 'library' => 'yes', - ), $ajaxurl + ), + $ajaxurl ), ), ) diff --git a/classes/Visualizer/Module/Chart.php b/classes/Visualizer/Module/Chart.php index 4da903ba..5865bffd 100644 --- a/classes/Visualizer/Module/Chart.php +++ b/classes/Visualizer/Module/Chart.php @@ -59,9 +59,8 @@ public function __construct( Visualizer_Plugin $plugin ) { $this->_addAjaxAction( Visualizer_Plugin::ACTION_CLONE_CHART, 'cloneChart' ); $this->_addAjaxAction( Visualizer_Plugin::ACTION_EXPORT_DATA, 'exportData' ); - if ( strpos( VISUALIZER_ENABLE_BETA_FEATURES, 'dbwizard' ) !== false ) { - $this->_addAjaxAction( Visualizer_Plugin::ACTION_FETCH_DB_COLS, 'getTableColumns' ); - $this->_addAjaxAction( Visualizer_Plugin::ACTION_FETCH_DB_DATA, 'getTableData' ); + if ( strpos( VISUALIZER_ENABLE_BETA_FEATURES, 'db-query' ) !== false ) { + $this->_addAjaxAction( Visualizer_Plugin::ACTION_FETCH_DB_DATA, 'getQueryData' ); $this->_addAjaxAction( Visualizer_Plugin::ACTION_SAVE_DB_QUERY, 'saveQuery' ); } } @@ -78,7 +77,10 @@ public function getCharts() { 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, 'posts_per_page' => 9, 'paged' => filter_input( - INPUT_GET, 'page', FILTER_VALIDATE_INT, array( + INPUT_GET, + 'page', + FILTER_VALIDATE_INT, + array( 'options' => array( 'min_range' => 1, 'default' => 1, @@ -177,7 +179,10 @@ public function deleteChart() { $capable = current_user_can( 'delete_posts' ); if ( $nonce && $capable ) { $chart_id = filter_input( - $input_method, 'chart', FILTER_VALIDATE_INT, array( + $input_method, + 'chart', + FILTER_VALIDATE_INT, + array( 'options' => array( 'min_range' => 1, ), @@ -233,7 +238,9 @@ public function renderChartPages() { add_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() ); add_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); add_post_meta( - $chart_id, Visualizer_Plugin::CF_SETTINGS, array( + $chart_id, + Visualizer_Plugin::CF_SETTINGS, + array( 'focusTarget' => 'datum', ) ); @@ -246,26 +253,46 @@ public function renderChartPages() { wp_register_script( 'visualizer-chosen', VISUALIZER_ABSURL . 'js/lib/chosen.jquery.min.js', array( 'jquery' ), Visualizer_Plugin::VERSION ); wp_register_style( 'visualizer-chosen', VISUALIZER_ABSURL . 'css/lib/chosen.min.css', array(), Visualizer_Plugin::VERSION ); + // data tables assets. wp_register_script( 'visualizer-datatables', '//cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js', array( 'jquery-ui-core' ), Visualizer_Plugin::VERSION ); wp_register_style( 'visualizer-datatables', '//cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css', array(), Visualizer_Plugin::VERSION ); wp_register_style( 'visualizer-datatables-ui', '//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css', array( 'visualizer-datatables' ), Visualizer_Plugin::VERSION ); + // code mirror assets. + wp_register_script( 'visualizer-codemirror-core', '//codemirror.net/lib/codemirror.js', array( 'jquery' ), Visualizer_Plugin::VERSION ); + wp_register_script( 'visualizer-codemirror-placeholder', '//codemirror.net/addon/display/placeholder.js', array( 'visualizer-codemirror-core' ), Visualizer_Plugin::VERSION ); + wp_register_script( 'visualizer-codemirror-matchbrackets', '//codemirror.net/addon/edit/matchbrackets.js', array( 'visualizer-codemirror-core' ), Visualizer_Plugin::VERSION ); + wp_register_script( 'visualizer-codemirror-closebrackets', '//codemirror.net/addon/edit/closebrackets.js', array( 'visualizer-codemirror-core' ), Visualizer_Plugin::VERSION ); + wp_register_script( 'visualizer-codemirror-sql', '//codemirror.net/mode/sql/sql.js', array( 'visualizer-codemirror-core' ), Visualizer_Plugin::VERSION ); + wp_register_script( 'visualizer-codemirror-sql-hint', '//codemirror.net/addon/hint/sql-hint.js', array( 'visualizer-codemirror-core' ), Visualizer_Plugin::VERSION ); + wp_register_script( 'visualizer-codemirror-hint', '//codemirror.net/addon/hint/show-hint.js', array( 'visualizer-codemirror-sql', 'visualizer-codemirror-sql-hint', 'visualizer-codemirror-placeholder', 'visualizer-codemirror-matchbrackets', 'visualizer-codemirror-closebrackets' ), Visualizer_Plugin::VERSION ); + wp_register_style( 'visualizer-codemirror-core', '//codemirror.net/lib/codemirror.css', array(), Visualizer_Plugin::VERSION ); + wp_register_style( 'visualizer-codemirror-hint', '//codemirror.net/addon/hint/show-hint.css', array( 'visualizer-codemirror-core' ), Visualizer_Plugin::VERSION ); + wp_register_style( 'visualizer-frame', VISUALIZER_ABSURL . 'css/frame.css', array( 'visualizer-chosen' ), Visualizer_Plugin::VERSION ); wp_register_script( 'visualizer-frame', VISUALIZER_ABSURL . 'js/frame.js', array( 'visualizer-chosen' ), Visualizer_Plugin::VERSION, true ); wp_register_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); wp_register_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true ); wp_register_script( - 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( + 'visualizer-render', + VISUALIZER_ABSURL . 'js/render.js', + array( 'google-jsapi-old', 'google-jsapi-new', 'visualizer-frame', - ), Visualizer_Plugin::VERSION, true + ), + Visualizer_Plugin::VERSION, + true ); wp_register_script( - 'visualizer-preview', VISUALIZER_ABSURL . 'js/preview.js', array( + 'visualizer-preview', + VISUALIZER_ABSURL . 'js/preview.js', + array( 'wp-color-picker', 'visualizer-render', - ), Visualizer_Plugin::VERSION, true + ), + Visualizer_Plugin::VERSION, + true ); // added by Ash/Upwork if ( VISUALIZER_PRO ) { @@ -353,15 +380,19 @@ private function _handleDataAndSettingsPage() { wp_enqueue_style( 'visualizer-frame' ); wp_enqueue_script( 'visualizer-preview' ); - if ( strpos( VISUALIZER_ENABLE_BETA_FEATURES, 'dbwizard' ) !== false ) { + if ( strpos( VISUALIZER_ENABLE_BETA_FEATURES, 'db-query' ) !== false ) { wp_enqueue_script( 'visualizer-chosen' ); wp_enqueue_script( 'visualizer-datatables' ); wp_enqueue_style( 'visualizer-datatables-ui' ); + wp_enqueue_script( 'visualizer-codemirror-hint' ); + wp_enqueue_style( 'visualizer-codemirror-hint' ); } wp_enqueue_script( 'visualizer-render' ); wp_localize_script( - 'visualizer-render', 'visualizer', array( + 'visualizer-render', + 'visualizer', + array( 'l10n' => array( 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ), 'loading' => esc_html__( 'Loading...', 'visualizer' ), @@ -372,41 +403,19 @@ private function _handleDataAndSettingsPage() { ), 'language' => $this->get_language(), 'map_api_key' => get_option( 'visualizer-map-api-key' ), - 'ajax' => array( + 'ajax' => array( 'url' => admin_url( 'admin-ajax.php' ), 'nonces' => array( 'permissions' => wp_create_nonce( Visualizer_Plugin::ACTION_FETCH_PERMISSIONS_DATA ), - 'db_get_cols' => wp_create_nonce( Visualizer_Plugin::ACTION_FETCH_DB_COLS . Visualizer_Plugin::VERSION ), 'db_get_data' => wp_create_nonce( Visualizer_Plugin::ACTION_FETCH_DB_DATA . Visualizer_Plugin::VERSION ), ), 'actions' => array( 'permissions' => Visualizer_Plugin::ACTION_FETCH_PERMISSIONS_DATA, - 'db_get_cols' => Visualizer_Plugin::ACTION_FETCH_DB_COLS, 'db_get_data' => Visualizer_Plugin::ACTION_FETCH_DB_DATA, ), ), - 'db_wizard' => array( - 'labels' => array( - 'from' => __( 'Select From', 'visualizer' ), - 'select' => __( 'Select Columns', 'visualizer' ), - 'where' => __( 'Where', 'visualizer' ), - 'group' => __( 'Group By', 'visualizer' ), - 'order' => __( 'Order By', 'visualizer' ), - ), - 'select' => array( - 'count(*)', - 'count(distinct #)', - '#', - ), - 'where' => array( - '#', - ), - 'group' => array( - '#', - ), - 'order' => array( - '#', - ), + 'db_query' => array( + 'tables' => Visualizer_Source_Query_Params::get_all_db_tables_column_mapping(), ), ) ); @@ -523,7 +532,7 @@ public function uploadData() { delete_post_meta( $chart_id, 'visualizer-filter-config' ); // delete "import from db" specific parameters. - delete_post_meta( $chart_id, Visualizer_Plugin::CF_DB_PARAMS ); + delete_post_meta( $chart_id, Visualizer_Plugin::CF_DB_QUERY ); delete_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE ); } @@ -574,7 +583,10 @@ public function cloneChart() { $capable = current_user_can( 'edit_posts' ); if ( $nonce && $capable ) { $chart_id = filter_input( - INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( + INPUT_GET, + 'chart', + FILTER_VALIDATE_INT, + array( 'options' => array( 'min_range' => 1, ), @@ -606,7 +618,8 @@ public function cloneChart() { array( 'page' => 'visualizer', 'type' => filter_input( INPUT_GET, 'type' ), - ), admin_url( 'upload.php' ) + ), + admin_url( 'upload.php' ) ); } } @@ -626,7 +639,9 @@ public function exportData() { $capable = current_user_can( 'edit_posts' ); if ( $capable ) { $chart_id = isset( $_GET['chart'] ) ? filter_var( - $_GET['chart'], FILTER_VALIDATE_INT, array( + $_GET['chart'], + FILTER_VALIDATE_INT, + array( 'options' => array( 'min_range' => 1, ), @@ -659,7 +674,9 @@ private function _handleDataPage() { wp_enqueue_style( 'visualizer-frame' ); wp_enqueue_script( 'visualizer-render' ); wp_localize_script( - 'visualizer-render', 'visualizer', array( + 'visualizer-render', + 'visualizer', + array( 'l10n' => array( 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ), 'loading' => esc_html__( 'Loading...', 'visualizer' ), @@ -680,28 +697,21 @@ private function _handleDataPage() { } /** - * Returns the columns for the table. + * Returns the data for the query. * * @access public */ - public function getTableColumns() { - global $wpdb; - check_ajax_referer( Visualizer_Plugin::ACTION_FETCH_DB_COLS . Visualizer_Plugin::VERSION, 'security' ); - - wp_send_json_success( array( 'columns' => Visualizer_Source_Query_Params::get_table_columns( $_POST['table'] ) ) ); - } - - /** - * Returns the data for the query params. - * - * @access public - */ - public function getTableData() { - global $wpdb; + public function getQueryData() { check_ajax_referer( Visualizer_Plugin::ACTION_FETCH_DB_DATA . Visualizer_Plugin::VERSION, 'security' ); - $source = new Visualizer_Source_Query_Params( wp_parse_args( $_POST['params'] ) ); + $params = wp_parse_args( $_POST['params'] ); + $source = new Visualizer_Source_Query( stripslashes( $params['query'] ) ); $html = $source->fetch( true ); + $error = ''; + if ( empty( $html ) ) { + $error = $source->get_error(); + wp_send_json_error( array( 'msg' => $error ) ); + } wp_send_json_success( array( 'table' => $html ) ); } @@ -714,7 +724,10 @@ public function saveQuery() { check_ajax_referer( Visualizer_Plugin::ACTION_SAVE_DB_QUERY . Visualizer_Plugin::VERSION, 'security' ); $chart_id = filter_input( - INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( + INPUT_GET, + 'chart', + FILTER_VALIDATE_INT, + array( 'options' => array( 'min_range' => 1, ), @@ -723,12 +736,13 @@ public function saveQuery() { $render = new Visualizer_Render_Page_Update(); if ( $chart_id ) { - $source = new Visualizer_Source_Query_Params( wp_parse_args( $_POST['params'] ) ); + $params = wp_parse_args( $_POST['params'] ); + $source = new Visualizer_Source_Query( stripslashes( $params['query'] ) ); $source->fetch( false ); $error = $source->get_error(); if ( empty( $error ) ) { $hours = $_POST['refresh']; - update_post_meta( $chart_id, Visualizer_Plugin::CF_DB_PARAMS, wp_parse_args( $_POST['params'] ) ); + update_post_meta( $chart_id, Visualizer_Plugin::CF_DB_QUERY, stripslashes( $params['query'] ) ); update_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() ); update_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); update_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, $hours ); diff --git a/classes/Visualizer/Module/Frontend.php b/classes/Visualizer/Module/Frontend.php index a78ad637..c3d3178c 100644 --- a/classes/Visualizer/Module/Frontend.php +++ b/classes/Visualizer/Module/Frontend.php @@ -99,7 +99,8 @@ function endpoint_register() { */ private function get_actions() { return apply_filters( - 'visualizer_action_buttons', array( + 'visualizer_action_buttons', + array( 'print' => __( 'Print', 'visualizer' ), 'csv' => __( 'CSV', 'visualizer' ), 'xls' => __( 'Excel', 'visualizer' ), @@ -185,7 +186,8 @@ public function renderChart( $atts ) { 'series' => false, // series filter hook 'data' => false, // data filter hook 'settings' => false, // data filter hook - ), $atts + ), + $atts ); // if empty id or chart does not exists, then return empty string @@ -255,7 +257,9 @@ public function renderChart( $atts ) { // enqueue visualizer render and update render localizations wp_enqueue_script( 'visualizer-render' ); wp_localize_script( - 'visualizer-render', 'visualizer', array( + 'visualizer-render', + 'visualizer', + array( 'charts' => $this->_charts, 'language' => $this->get_language(), 'map_api_key' => get_option( 'visualizer-map-api-key' ), diff --git a/classes/Visualizer/Module/Setup.php b/classes/Visualizer/Module/Setup.php index d127797f..ce4b563b 100644 --- a/classes/Visualizer/Module/Setup.php +++ b/classes/Visualizer/Module/Setup.php @@ -113,7 +113,8 @@ public function getChartCountsByTypeAndMeta( $meta_keys = array() ) { */ public function setupCustomPostTypes() { register_post_type( - Visualizer_Plugin::CPT_VISUALIZER, array( + Visualizer_Plugin::CPT_VISUALIZER, + array( 'label' => 'Visualizer Charts', 'public' => false, 'supports' => array( 'revisions' ), @@ -182,8 +183,8 @@ public function refresh_db_for_chart( $chart, $chart_id, $force = false ) { return $chart; } - $params = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_PARAMS, true ); - $source = new Visualizer_Source_Query_Params( $params ); + $params = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_QUERY, true ); + $source = new Visualizer_Source_Query( $params ); $source->fetch( false ); $error = $source->get_error(); if ( empty( $error ) ) { diff --git a/classes/Visualizer/Module/Sources.php b/classes/Visualizer/Module/Sources.php index cd5c1abc..d86c53dd 100644 --- a/classes/Visualizer/Module/Sources.php +++ b/classes/Visualizer/Module/Sources.php @@ -130,7 +130,7 @@ public function filterChartData( $data, $chart_id ) { * @return string The new html code. */ public function addProUpsell( $old, $feature = null ) { - $biz_features = array( 'schedule-chart', 'chart-permissions' ); + $biz_features = array( 'schedule-chart', 'chart-permissions', 'db-query' ); $return = ''; $feature = strval( $feature ); if ( empty( $feature ) || ( in_array( $feature, $biz_features ) && ! apply_filters( 'visualizer_is_business', false ) ) ) { diff --git a/classes/Visualizer/Plugin.php b/classes/Visualizer/Plugin.php index 1369f812..23d38b1a 100644 --- a/classes/Visualizer/Plugin.php +++ b/classes/Visualizer/Plugin.php @@ -60,7 +60,6 @@ class Visualizer_Plugin { *Action used for fetching db import data. */ const ACTION_FETCH_DB_DATA = 'visualizer-fetch-db-data'; - const ACTION_FETCH_DB_COLS = 'visualizer-fetch-db-columns'; const ACTION_SAVE_DB_QUERY = 'visualizer-save-db-query'; // custom filters @@ -71,8 +70,8 @@ class Visualizer_Plugin { const FILTER_UNDO_REVISIONS = 'visualizer-undo-revisions'; const FILTER_HANDLE_REVISIONS = 'visualizer-handle-revisions'; - const CF_DB_PARAMS = 'visualizer-db-params'; const CF_DB_SCHEDULE = 'visualizer-db-schedule'; + const CF_DB_QUERY = 'visualizer-db-query'; const CF_CHART_URL = 'visualizer-chart-url'; const CF_CHART_SCHEDULE = 'visualizer-chart-schedule'; diff --git a/classes/Visualizer/Render/Layout.php b/classes/Visualizer/Render/Layout.php index 7200da76..298aa413 100644 --- a/classes/Visualizer/Render/Layout.php +++ b/classes/Visualizer/Render/Layout.php @@ -58,269 +58,34 @@ public static function _renderFauxEditor( $args ) { } /** - * Show the DB wizard. + * Show the DB query box. * * @access public */ - public static function _renderDbWizard( $args ) { - $tables = $args[1]; - $params = $args[2]; - $tbl = null; - $columns = null; - $group = array(); - $order = array(); - $limit = ''; - $where = array(); - if ( ! empty( $params['from'] ) ) { - $tbl = $params['from']; - } - if ( ! empty( $params['select'] ) ) { - $select = $params['select']; - } - if ( ! empty( $params['group'] ) ) { - $group = $params['group']; - } - if ( ! empty( $params['order'] ) ) { - $order = $params['order']; - } - if ( ! empty( $params['limit'] ) ) { - $limit = $params['limit']; - } - if ( ! empty( $params['where'] ) ) { - $where = $params['where']; - } - - if ( ! empty( $params ) ) { - $columns = Visualizer_Source_Query_Params::get_table_columns( $tbl ); - } - ?> - - - '> - - -
    -
    -
    -
    -
    - - -
    -
    - -
    -
    - - -
    -
    - - -
    -
    -
    '> -
    - ' => __( 'Greater than', 'visualizer' ), - '>=' => __( 'Greater than or equals', 'visualizer' ), - '<' => __( 'Less than', 'visualizer' ), - '<=' => __( 'Less than or equals', 'visualizer' ), - '=' => __( 'Equals', 'visualizer' ), - '!=' => __( 'Not Equals', 'visualizer' ), - ); - ?> - + ",u(m.yearRange)?(o=m.yearRange[0],s=m.yearRange[1]+1):(o=n-m.yearRange,s=1+n+m.yearRange),l=[];o=m.minYear&&l.push('");return c='
    '+n+m.yearSuffix+'
    ",m.showMonthAfterYear?_+=c+d:_+=d+c,p&&(0===r||m.minMonth>=r)&&(f=!1),h&&(11===r||m.maxMonth<=r)&&(y=!1),0===t&&(_+='"),t===e._o.numberOfMonths-1&&(_+='"),_+="
    "},w=function(o){var s=this,u=s.config(o);s._onMouseDown=function(e){if(s._v){var t=(e=e||window.event).target||e.srcElement;if(t)if(l(t,"is-disabled")||(!l(t,"pika-button")||l(t,"is-empty")||l(t.parentNode,"is-disabled")?l(t,"pika-prev")?s.prevMonth():l(t,"pika-next")&&s.nextMonth():(s.setDate(new Date(t.getAttribute("data-pika-year"),t.getAttribute("data-pika-month"),t.getAttribute("data-pika-day"))),u.bound&&a(function(){s.hide(),u.field&&u.field.blur()},100))),l(t,"pika-select"))s._c=!0;else{if(!e.preventDefault)return e.returnValue=!1,!1;e.preventDefault()}}},s._onChange=function(e){var t=(e=e||window.event).target||e.srcElement;t&&(l(t,"pika-select-month")?s.gotoMonth(t.value):l(t,"pika-select-year")&&s.gotoYear(t.value))},s._onKeyChange=function(e){if(e=e||window.event,s.isVisible())switch(e.keyCode){case 13:case 27:u.field.blur();break;case 37:e.preventDefault(),s.adjustDate("subtract",1);break;case 38:s.adjustDate("subtract",7);break;case 39:s.adjustDate("add",1);break;case 40:s.adjustDate("add",7)}},s._onInputChange=function(n){var r;n.firedBy!==s&&(r=t?(r=e(u.field.value,u.format,u.formatStrict))&&r.isValid()?r.toDate():null:new Date(Date.parse(u.field.value)),d(r)&&s.setDate(r),s._v||s.show())},s._onInputFocus=function(){s.show()},s._onInputClick=function(){s.show()},s._onInputBlur=function(){var e=r.activeElement;do{if(l(e,"pika-single"))return}while(e=e.parentNode);s._c||(s._b=a(function(){s.hide()},50)),s._c=!1},s._onClick=function(e){var t=(e=e||window.event).target||e.srcElement,r=t;if(t){!n&&l(t,"pika-select")&&(t.onchange||(t.setAttribute("onchange","return;"),i(t,"change",s._onChange)));do{if(l(r,"pika-single")||r===u.trigger)return}while(r=r.parentNode);s._v&&t!==u.trigger&&r!==u.trigger&&s.hide()}},s.el=r.createElement("div"),s.el.className="pika-single"+(u.isRTL?" is-rtl":"")+(u.theme?" "+u.theme:""),i(s.el,"mousedown",s._onMouseDown,!0),i(s.el,"touchend",s._onMouseDown,!0),i(s.el,"change",s._onChange),i(r,"keydown",s._onKeyChange),u.field&&(u.container?u.container.appendChild(s.el):u.bound?r.body.appendChild(s.el):u.field.parentNode.insertBefore(s.el,u.field.nextSibling),i(u.field,"change",s._onInputChange),u.defaultDate||(t&&u.field.value?u.defaultDate=e(u.field.value,u.format).toDate():u.defaultDate=new Date(Date.parse(u.field.value)),u.setDefaultDate=!0));var c=u.defaultDate;d(c)?u.setDefaultDate?s.setDate(c,!0):s.gotoDate(c):s.gotoDate(new Date),u.bound?(this.hide(),s.el.className+=" is-bound",i(u.trigger,"click",s._onInputClick),i(u.trigger,"focus",s._onInputFocus),i(u.trigger,"blur",s._onInputBlur)):this.show()};return w.prototype={config:function(e){this._o||(this._o=_({},y,!0));var t=_(this._o,e,!0);t.isRTL=!!t.isRTL,t.field=t.field&&t.field.nodeName?t.field:null,t.theme="string"==typeof t.theme&&t.theme?t.theme:null,t.bound=!!(void 0!==t.bound?t.field&&t.bound:t.field),t.trigger=t.trigger&&t.trigger.nodeName?t.trigger:t.field,t.disableWeekends=!!t.disableWeekends,t.disableDayFn="function"==typeof t.disableDayFn?t.disableDayFn:null;var n=parseInt(t.numberOfMonths,10)||1;if(t.numberOfMonths=n>4?4:n,d(t.minDate)||(t.minDate=!1),d(t.maxDate)||(t.maxDate=!1),t.minDate&&t.maxDate&&t.maxDate100&&(t.yearRange=100);return t},toString:function(n){return d(this._d)?t?e(this._d).format(n||this._o.format):this._d.toDateString():""},getMoment:function(){return t?e(this._d):null},setMoment:function(n,r){t&&e.isMoment(n)&&this.setDate(n.toDate(),r)},getDate:function(){return d(this._d)?new Date(this._d.getTime()):new Date},setDate:function(e,t){if(!e)return this._d=null,this._o.field&&(this._o.field.value="",s(this._o.field,"change",{firedBy:this})),this.draw();if("string"==typeof e&&(e=new Date(Date.parse(e))),d(e)){var n=this._o.minDate,r=this._o.maxDate;d(n)&&er&&(e=r),this._d=new Date(e.getTime()),p(this._d),this.gotoDate(this._d),this._o.field&&(this._o.field.value=this.toString(),s(this._o.field,"change",{firedBy:this})),t||"function"!=typeof this._o.onSelect||this._o.onSelect.call(this,this.getDate())}},gotoDate:function(e){var t=!0;if(d(e)){if(this.calendars){var n=new Date(this.calendars[0].year,this.calendars[0].month,1),r=new Date(this.calendars[this.calendars.length-1].year,this.calendars[this.calendars.length-1].month,1),a=e.getTime();r.setMonth(r.getMonth()+1),r.setDate(r.getDate()-1),t=a=i&&(this._y=i,!isNaN(s)&&this._m>s&&(this._m=s)),t="pika-title-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,2);for(var u=0;u'+v(this,u,this.calendars[u].year,this.calendars[u].month,this.calendars[0].year,t)+this.render(this.calendars[u].year,this.calendars[u].month,t)+"
    ";this.el.innerHTML=l,n.bound&&"hidden"!==n.field.type&&a(function(){n.trigger.focus()},1),"function"==typeof this._o.onDraw&&this._o.onDraw(this),n.bound&&n.field.setAttribute("aria-label","Use the arrow keys to pick a date")}},adjustPosition:function(){var e,t,n,a,i,o,s,l,u,d;if(!this._o.container){if(this.el.style.position="absolute",t=e=this._o.trigger,n=this.el.offsetWidth,a=this.el.offsetHeight,i=window.innerWidth||r.documentElement.clientWidth,o=window.innerHeight||r.documentElement.clientHeight,s=window.pageYOffset||r.body.scrollTop||r.documentElement.scrollTop,"function"==typeof e.getBoundingClientRect)l=(d=e.getBoundingClientRect()).left+window.pageXOffset,u=d.bottom+window.pageYOffset;else for(l=t.offsetLeft,u=t.offsetTop+t.offsetHeight;t=t.offsetParent;)l+=t.offsetLeft,u+=t.offsetTop;(this._o.reposition&&l+n>i||this._o.position.indexOf("right")>-1&&l-n+e.offsetWidth>0)&&(l=l-n+e.offsetWidth),(this._o.reposition&&u+a>o+s||this._o.position.indexOf("top")>-1&&u-a-e.offsetHeight>0)&&(u=u-a-e.offsetHeight),this.el.style.left=l+"px",this.el.style.top=u+"px"}},render:function(e,t,n){var r=this._o,a=new Date,i=m(e,t),o=new Date(e,t,1).getDay(),s=[],l=[];p(a),r.firstDay>0&&(o-=r.firstDay)<0&&(o+=7);for(var u,_,f,y,v=0===t?11:t-1,w=11===t?0:t+1,k=0===t?e-1:e,L=11===t?e+1:e,Y=m(k,v),D=i+o,T=D;T>7;)T-=7;D+=7-T;for(var S=0,O=0;S=i+o,H=S-o+1,P=t,A=e,z=r.startRange&&h(r.startRange,j),F=r.endRange&&h(r.endRange,j),W=r.startRange&&r.endRange&&r.startRanger.maxDate||r.disableWeekends&&c(j)||r.disableDayFn&&r.disableDayFn(j),isEmpty:C,isStartRange:z,isEndRange:F,isInRange:W,showDaysInNextAndPreviousMonths:r.showDaysInNextAndPreviousMonths};l.push(b(N)),7==++O&&(r.showWeekNumber&&l.unshift((u=S-o,_=t,f=e,y=void 0,y=new Date(f,0,1),''+Math.ceil(((new Date(f,_,u)-y)/864e5+y.getDay()+1)/7)+"")),s.push(M(l,r.isRTL)),l=[],O=0)}return function(e,t,n){return''+function(e){var t,n=[];for(e.showWeekNumber&&n.push(""),t=0;t<7;t++)n.push('");return""+(e.isRTL?n.reverse():n).join("")+""}(e)+(""+t.join("")+"")+"
    '+g(e,t,!0)+"
    "}(r,s,n)},isVisible:function(){return this._v},show:function(){var e,t,n;this.isVisible()||(e=this.el,t="is-hidden",e.className=(n=(" "+e.className+" ").replace(" "+t+" "," ")).trim?n.trim():n.replace(/^\s+|\s+$/g,""),this._v=!0,this.draw(),this._o.bound&&(i(r,"click",this._onClick),this.adjustPosition()),"function"==typeof this._o.onOpen&&this._o.onOpen.call(this))},hide:function(){var e,t,n=this._v;!1!==n&&(this._o.bound&&o(r,"click",this._onClick),this.el.style.position="static",this.el.style.left="auto",this.el.style.top="auto",e=this.el,l(e,t="is-hidden")||(e.className=""===e.className?t:e.className+" "+t),this._v=!1,void 0!==n&&"function"==typeof this._o.onClose&&this._o.onClose.call(this))},destroy:function(){this.hide(),o(this.el,"mousedown",this._onMouseDown,!0),o(this.el,"touchend",this._onMouseDown,!0),o(this.el,"change",this._onChange),this._o.field&&(o(this._o.field,"change",this._onInputChange),this._o.bound&&(o(this._o.trigger,"click",this._onInputClick),o(this._o.trigger,"focus",this._onInputFocus),o(this._o.trigger,"blur",this._onInputBlur))),this.el.parentNode&&this.el.parentNode.removeChild(this.el)}},w}(a)}()},,function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r=n(1),a=n.n(r),i=n(127),o=n.n(i),s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function l(e,t){function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var u=function(){return(u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]0){var o=Array.from({length:i-1}).map(function(e,r){var i=t.getColumnID(a,r+1);return t.state.hiddenColumns.includes(i)?k:void 0!==n.colors&&null!==n.colors?n.colors[r]:f[r]});r.setOptions(u({},n,{colors:o})),r.draw()}}},t.onResize=function(){t.props.googleChartWrapper.draw()},t}return l(t,e),t.prototype.componentDidMount=function(){this.draw(this.props),window.addEventListener("resize",this.onResize),(this.props.legend_toggle||this.props.legendToggle)&&this.listenToLegendToggle()},t.prototype.componentWillUnmount=function(){var e=this.props,t=e.google,n=e.googleChartWrapper;window.removeEventListener("resize",this.onResize),t.visualization.events.removeAllListeners(n),"Timeline"===n.getChartType()&&n.getChart()&&n.getChart().clearChart()},t.prototype.componentDidUpdate=function(){this.draw(this.props)},t.prototype.render=function(){return null},t}(r.Component),Y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l(t,e),t.prototype.componentDidMount=function(){},t.prototype.componentWillUnmount=function(){},t.prototype.shouldComponentUpdate=function(){return!1},t.prototype.render=function(){var e=this.props,t=e.google,n=e.googleChartWrapper,a=e.googleChartDashboard;return Object(r.createElement)(w,{render:function(e){return Object(r.createElement)(L,u({},e,{google:t,googleChartWrapper:n,googleChartDashboard:a}))}})},t}(r.Component),D=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l(t,e),t.prototype.shouldComponentUpdate=function(){return!1},t.prototype.listenToEvents=function(e){var t=this,n=e.chartEvents,r=e.google,a=e.googleChartWrapper;if(null!==n){r.visualization.events.removeAllListeners(a);for(var i=function(e){var n=e.eventName,i=e.callback;r.visualization.events.addListener(a,n,function(){for(var e=[],n=0;n(r=e.sent).length&&(n=!0),this.setState({charts:this.state.charts.concat(r),isBusy:!1,chartsLoaded:n});case 8:case"end":return e.stop()}},e,this)})),function(){return i.apply(this,arguments)})},{key:"render",value:function(){var e=this,t=this.state,n=t.charts,r=t.isBusy,a=t.chartsLoaded;return wp.element.createElement("div",{className:"visualizer-settings__charts"},null!==n?1<=n.length?wp.element.createElement(K,null,wp.element.createElement("div",{className:"visualizer-settings__charts-grid"},Object.keys(n).map(function(t){var r,a,i,o=H(n[t].chart_data);return r=o["visualizer-settings"].title?o["visualizer-settings"].title:"#".concat(n[t].id),a=0<=["gauge","table","timeline"].indexOf(o["visualizer-chart-type"])?V(o["visualizer-chart-type"]):"".concat(V(o["visualizer-chart-type"]),"Chart"),wp.element.createElement("div",{className:"visualizer-settings__charts-single"},wp.element.createElement("div",{className:"visualizer-settings__charts-title"},r),wp.element.createElement(O,{chartType:a,rows:o["visualizer-data"],columns:o["visualizer-series"],options:(i=o["visualizer-settings"],i.width="",i.height="",i.backgroundColor={},i.chartArea={},A(i))}),wp.element.createElement("div",{className:"visualizer-settings__charts-controls",title:J("Insert Chart"),onClick:function(){return e.props.getChart(n[t].id)}},wp.element.createElement(X,{icon:"upload"})))})),!a&&wp.element.createElement(Q,{isPrimary:!0,isLarge:!0,onClick:this.loadMoreCharts,isBusy:r},J("Load More"))):wp.element.createElement("p",{className:"visualizer-no-charts"},J("No charts found.")):wp.element.createElement(ee,null,wp.element.createElement(te,null)))}}])&&R(n.prototype,r),a&&R(n,a),t}();function re(e){return(re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ae(e,t){for(var n=0;n=["timeline"].indexOf(t)&&(r[1]={label:Lt("The tooltip will be displayed when the user selects an element"),value:"selection"}),r[2]={label:Lt("The tooltip will not be displayed"),value:"none"},wp.element.createElement(jt,{title:Lt("General Settings"),initialOpen:!1,className:"visualizer-advanced-panel"},wp.element.createElement(jt,{title:Lt("Title"),className:"visualizer-inner-sections",initialOpen:!1},wp.element.createElement(Et,{label:Lt("Chart Title"),help:Lt("Text to display above the chart."),value:n.title,onChange:function(t){n.title=t,e.props.edit(n)}}),-1>=["table","gauge","geo","pie","timeline"].indexOf(t)&&wp.element.createElement(xt,{label:Lt("Chart Title Position"),help:Lt("Where to place the chart title, compared to the chart area."),value:n.titlePosition?n.titlePosition:"out",options:[{label:Lt("Inside the chart"),value:"in"},{label:Lt("Outside the chart"),value:"out"},{label:Lt("None"),value:"none"}],onChange:function(t){n.titlePosition=t,e.props.edit(n)}}),-1>=["table","gauge","geo","timeline"].indexOf(t)&&wp.element.createElement(St,{label:Lt("Chart Title Color")},wp.element.createElement(Dt,{value:n.titleTextStyle.color,onChange:function(t){n.titleTextStyle.color=t,e.props.edit(n)}})),-1>=["table","gauge","geo","pie","timeline"].indexOf(t)&&wp.element.createElement(xt,{label:Lt("Axes Titles Position"),help:Lt("Determines where to place the axis titles, compared to the chart area."),value:n.axisTitlesPosition?n.axisTitlesPosition:"out",options:[{label:Lt("Inside the chart"),value:"in"},{label:Lt("Outside the chart"),value:"out"},{label:Lt("None"),value:"none"}],onChange:function(t){n.axisTitlesPosition=t,e.props.edit(n)}})),-1>=["table","gauge","geo","pie","timeline"].indexOf(t)&&wp.element.createElement(jt,{title:Lt("Font Styles"),className:"visualizer-inner-sections",initialOpen:!1},wp.element.createElement(xt,{label:Lt("Font Family"),help:Lt("The default font family for all text in the chart."),value:n.fontName?n.fontName:"Arial",options:[{label:Lt("Arial"),value:"Arial"},{label:Lt("Sans Serif"),value:"Sans Serif"},{label:Lt("Serif"),value:"serif"},{label:Lt("Arial"),value:"Arial"},{label:Lt("Wide"),value:"Arial black"},{label:Lt("Narrow"),value:"Arial Narrow"},{label:Lt("Comic Sans MS"),value:"Comic Sans MS"},{label:Lt("Courier New"),value:"Courier New"},{label:Lt("Garamond"),value:"Garamond"},{label:Lt("Georgia"),value:"Georgia"},{label:Lt("Tahoma"),value:"Tahoma"},{label:Lt("Verdana"),value:"Verdana"}],onChange:function(t){n.fontName=t,e.props.edit(n)}}),wp.element.createElement(xt,{label:Lt("Font Size"),help:Lt("The default font size for all text in the chart."),value:n.fontSize?n.fontSize:"15",options:[{label:"7",value:"7"},{label:"8",value:"8"},{label:"9",value:"9"},{label:"10",value:"10"},{label:"11",value:"11"},{label:"12",value:"12"},{label:"13",value:"13"},{label:"14",value:"14"},{label:"15",value:"15"},{label:"16",value:"16"},{label:"17",value:"17"},{label:"18",value:"18"},{label:"19",value:"19"},{label:"20",value:"20"}],onChange:function(t){n.fontSize=t,e.props.edit(n)}})),-1>=["table","gauge","geo","timeline"].indexOf(t)&&wp.element.createElement(jt,{title:Lt("Legend"),className:"visualizer-inner-sections",initialOpen:!1},wp.element.createElement(xt,{label:Lt("Position"),help:Lt("Determines where to place the legend, compared to the chart area."),value:n.legend.position?n.legend.position:"right",options:[{label:Lt("Left of the chart"),value:"left"},{label:Lt("Right of the chart"),value:"right"},{label:Lt("Above the chart"),value:"top"},{label:Lt("Below the chart"),value:"bottom"},{label:Lt("Inside the chart"),value:"in"},{label:Lt("Omit the legend"),value:"none"}],onChange:function(r){if("pie"!==t){var a="left"===r?1:0;Object.keys(n.series).map(function(e){n.series[e].targetAxisIndex=a})}n.legend.position=r,e.props.edit(n)}}),wp.element.createElement(xt,{label:Lt("Alignment"),help:Lt("Determines the alignment of the legend."),value:n.legend.alignment?n.legend.alignment:"15",options:[{label:Lt("Aligned to the start of the allocated area"),value:"start"},{label:Lt("Centered in the allocated area"),value:"center"},{label:Lt("Aligned to the end of the allocated area"),value:"end"}],onChange:function(t){n.legend.alignment=t,e.props.edit(n)}}),wp.element.createElement(St,{label:Lt("Font Color")},wp.element.createElement(Dt,{value:n.legend.textStyle.color,onChange:function(t){n.legend.textStyle.color=t,e.props.edit(n)}}))),-1>=["table","gauge","geo"].indexOf(t)&&wp.element.createElement(jt,{title:Lt("Tooltip"),className:"visualizer-inner-sections",initialOpen:!1},wp.element.createElement(xt,{label:Lt("Trigger"),help:Lt("Determines the user interaction that causes the tooltip to be displayed."),value:n.tooltip.trigger?n.tooltip.trigger:"focus",options:r,onChange:function(t){n.tooltip.trigger=t,e.props.edit(n)}}),wp.element.createElement(xt,{label:Lt("Show Color Code"),help:Lt("If set to yes, will show colored squares next to the slice information in the tooltip."),value:n.tooltip.showColorCode?n.tooltip.showColorCode:"0",options:[{label:Lt("Yes"),value:"1"},{label:Lt("No"),value:"0"}],onChange:function(t){n.tooltip.showColorCode=t,e.props.edit(n)}}),0<=["pie"].indexOf(t)&&wp.element.createElement(xt,{label:Lt("Text"),help:Lt("Determines what information to display when the user hovers over a pie slice."),value:n.tooltip.text?n.tooltip.text:"both",options:[{label:Lt("Display both the absolute value of the slice and the percentage of the whole"),value:"both"},{label:Lt("Display only the absolute value of the slice"),value:"value"},{label:Lt("Display only the percentage of the whole represented by the slice"),value:"percentage"}],onChange:function(t){n.tooltip.text=t,e.props.edit(n)}})),-1>=["table","gauge","geo","pie","timeline"].indexOf(t)&&wp.element.createElement(jt,{title:Lt("Animation"),className:"visualizer-inner-sections",initialOpen:!1},wp.element.createElement(Ot,{label:Lt("Animate on startup?"),help:Lt("Determines if the chart will animate on the initial draw."),checked:Number(n.animation.startup),onChange:function(t){n.animation.startup=t?"1":"0",e.props.edit(n)}}),wp.element.createElement(Et,{label:Lt("Duration"),help:Lt("The duration of the animation, in milliseconds."),type:"number",value:n.animation.duration,onChange:function(t){n.animation.duration=t,e.props.edit(n)}}),wp.element.createElement(xt,{label:Lt("Easing"),help:Lt("The easing function applied to the animation."),value:n.animation.easing?n.animation.easing:"linear",options:[{label:Lt("Constant speed"),value:"linear"},{label:Lt("Start slow and speed up"),value:"in"},{label:Lt("Start fast and slow down"),value:"out"},{label:Lt("Start slow, speed up, then slow down"),value:"inAndOut"}],onChange:function(t){n.animation.easing=t,e.props.edit(n)}})))}}])&&Mt(n.prototype,r),a&&Mt(n,a),t}();function Ht(e){return(Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Pt(e,t){for(var n=0;n=["column"].indexOf(t)&&wp.element.createElement(It,null,wp.element.createElement($t,{label:Wt("Number Format"),help:Wt("Enter custom format pattern to apply to horizontal axis labels."),value:n.hAxis.format,onChange:function(t){n.hAxis.format=t,e.props.edit(n)}}),wp.element.createElement("p",null,Wt("For number axis labels, this is a subset of the formatting "),wp.element.createElement(Jt,{href:"http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details"},Wt("ICU pattern set.")),Wt(" For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #%% percentage format then your values will be multiplied by 100.")),wp.element.createElement("p",null,Wt("For date axis labels, this is a subset of the date formatting "),wp.element.createElement(Jt,{href:"http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax"},Wt("ICU date and time format."))))),-1>=["column"].indexOf(t)&&wp.element.createElement(It,null,wp.element.createElement(Gt,{title:Wt("Grid Lines"),className:"visualizer-inner-sections",initialOpen:!1},wp.element.createElement($t,{label:Wt("Count"),help:Wt("The number of horizontal gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines."),value:n.hAxis.gridlines.count,onChange:function(t){n.hAxis.gridlines.count=t,e.props.edit(n)}}),wp.element.createElement(Vt,{label:Wt("Color")},wp.element.createElement(Bt,{value:n.hAxis.gridlines.color,onChange:function(t){n.hAxis.gridlines.color=t,e.props.edit(n)}}))),wp.element.createElement(Gt,{title:Wt("Minor Grid Lines"),className:"visualizer-inner-sections",initialOpen:!1},wp.element.createElement($t,{label:Wt("Count"),help:Wt("The number of horizontal minor gridlines between two regular gridlines."),value:n.hAxis.minorGridlines.count,onChange:function(t){n.hAxis.minorGridlines.count=t,e.props.edit(n)}}),wp.element.createElement(Vt,{label:Wt("Color")},wp.element.createElement(Bt,{value:n.hAxis.minorGridlines.color,onChange:function(t){n.hAxis.minorGridlines.color=t,e.props.edit(n)}}))),wp.element.createElement(Gt,{title:Wt("View Window"),className:"visualizer-inner-sections",initialOpen:!1},wp.element.createElement($t,{label:Wt("Maximun Value"),help:Wt("The maximum vertical data value to render."),value:n.hAxis.viewWindow.max,onChange:function(t){n.hAxis.viewWindow.max=t,e.props.edit(n)}}),wp.element.createElement($t,{label:Wt("Minimum Value"),help:Wt("The minimum vertical data value to render."),value:n.hAxis.viewWindow.min,onChange:function(t){n.hAxis.viewWindow.min=t,e.props.edit(n)}}))))}}])&&Pt(n.prototype,r),a&&Pt(n,a),t}();function Zt(e){return(Zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Qt(e,t){for(var n=0;n=["column"].indexOf(t)&&wp.element.createElement(on,null,wp.element.createElement(pn,{label:nn("Number Format"),help:nn("Enter custom format pattern to apply to Vertical axis labels."),value:n.vAxis.format,onChange:function(t){n.vAxis.format=t,e.props.edit(n)}}),wp.element.createElement("p",null,nn("For number axis labels, this is a subset of the formatting "),wp.element.createElement(dn,{href:"http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details"},nn("ICU pattern set.")),nn(" For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #%% percentage format then your values will be multiplied by 100.")),wp.element.createElement("p",null,nn("For date axis labels, this is a subset of the date formatting "),wp.element.createElement(dn,{href:"http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax"},nn("ICU date and time format."))))),-1>=["bar"].indexOf(t)&&wp.element.createElement(on,null,wp.element.createElement(cn,{title:nn("Grid Lines"),className:"visualizer-inner-sections",initialOpen:!1},wp.element.createElement(pn,{label:nn("Count"),help:nn("The number of Vertical gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines."),value:n.vAxis.gridlines.count,onChange:function(t){n.vAxis.gridlines.count=t,e.props.edit(n)}}),wp.element.createElement(un,{label:nn("Color")},wp.element.createElement(sn,{value:n.vAxis.gridlines.color,onChange:function(t){n.vAxis.gridlines.color=t,e.props.edit(n)}}))),wp.element.createElement(cn,{title:nn("Minor Grid Lines"),className:"visualizer-inner-sections",initialOpen:!1},wp.element.createElement(pn,{label:nn("Count"),help:nn("The number of Vertical minor gridlines between two regular gridlines."),value:n.vAxis.minorGridlines.count,onChange:function(t){n.vAxis.minorGridlines.count=t,e.props.edit(n)}}),wp.element.createElement(un,{label:nn("Color")},wp.element.createElement(sn,{value:n.vAxis.minorGridlines.color,onChange:function(t){n.vAxis.minorGridlines.color=t,e.props.edit(n)}}))),wp.element.createElement(cn,{title:nn("View Window"),className:"visualizer-inner-sections",initialOpen:!1},wp.element.createElement(pn,{label:nn("Maximun Value"),help:nn("The maximum vertical data value to render."),value:n.vAxis.viewWindow.max,onChange:function(t){n.vAxis.viewWindow.max=t,e.props.edit(n)}}),wp.element.createElement(pn,{label:nn("Minimum Value"),help:nn("The minimum vertical data value to render."),value:n.vAxis.viewWindow.min,onChange:function(t){n.vAxis.viewWindow.min=t,e.props.edit(n)}}))))}}])&&Qt(n.prototype,r),a&&Qt(n,a),t}();function _n(e){return(_n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function fn(e,t){for(var n=0;n=["area"].indexOf(t)&&wp.element.createElement(nr,{label:Kn("Curve Type"),help:Kn("Determines whether the series has to be presented in the legend or not."),value:n.curveType?n.curveType:"none",options:[{label:Kn("Straight line without curve"),value:"none"},{label:Kn("The angles of the line will be smoothed"),value:"function"}],onChange:function(t){n.curveType=t,e.props.edit(n)}}),-1>=["scatter"].indexOf(t)&&wp.element.createElement(nr,{label:Kn("Focus Target"),help:Kn("The type of the entity that receives focus on mouse hover. Also affects which entity is selected by mouse click."),value:n.focusTarget?n.focusTarget:"datum",options:[{label:Kn("Focus on a single data point."),value:"datum"},{label:Kn("Focus on a grouping of all data points along the major axis."),value:"category"}],onChange:function(t){n.focusTarget=t,e.props.edit(n)}}),wp.element.createElement(nr,{label:Kn("Selection Mode"),help:Kn("Determines how many data points an user can select on a chart."),value:n.selectionMode?n.selectionMode:"single",options:[{label:Kn("Single data point"),value:"single"},{label:Kn("Multiple data points"),value:"multiple"}],onChange:function(t){n.selectionMode=t,e.props.edit(n)}}),wp.element.createElement(nr,{label:Kn("Aggregation Target"),help:Kn("Determines how multiple data selections are rolled up into tooltips. To make it working you need to set multiple selection mode and tooltip trigger to display it when an user selects an element."),value:n.aggregationTarget?n.aggregationTarget:"auto",options:[{label:Kn("Group selected data by x-value"),value:"category"},{label:Kn("Group selected data by series"),value:"series"},{label:Kn("Group selected data by x-value if all selections have the same x-value, and by series otherwise"),value:"auto"},{label:Kn("Show only one tooltip per selection"),value:"none"}],onChange:function(t){n.aggregationTarget=t,e.props.edit(n)}}),wp.element.createElement(rr,{label:Kn("Point Opacity"),help:Kn("The transparency of data points, with 1.0 being completely opaque and 0.0 fully transparent."),value:n.dataOpacity,onChange:function(t){n.dataOpacity=t,e.props.edit(n)}}),-1>=["scatter","line"].indexOf(t)&&wp.element.createElement(Xn,null,wp.element.createElement(rr,{label:Kn("Area Opacity"),help:Kn("The default opacity of the colored area under an area chart series, where 0.0 is fully transparent and 1.0 is fully opaque. To specify opacity for an individual series, set the area opacity value in the series property."),value:n.areaOpacity,onChange:function(t){n.areaOpacity=t,e.props.edit(n)}}),wp.element.createElement(nr,{label:Kn("Is Stacked"),help:Kn("If set to yes, series elements are stacked."),value:n.isStacked?n.isStacked:"0",options:[{label:Kn("Yes"),value:"1"},{label:Kn("No"),value:"0"}],onChange:function(t){n.isStacked=t,e.props.edit(n)}})),-1>=["scatter","area"].indexOf(t)&&wp.element.createElement(nr,{label:Kn("Interpolate Nulls"),help:Kn("Whether to guess the value of missing points. If yes, it will guess the value of any missing data based on neighboring points. If no, it will leave a break in the line at the unknown point."),value:n.interpolateNulls?n.interpolateNulls:"0",options:[{label:Kn("Yes"),value:"1"},{label:Kn("No"),value:"0"}],onChange:function(t){n.interpolateNulls=t,e.props.edit(n)}}))}}])&&Jn(n.prototype,r),a&&Jn(n,a),t}();function ir(e){return(ir="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function or(e,t){for(var n=0;n=["table","pie"].indexOf(t)&&wp.element.createElement(to,{label:Ji("Visible In Legend"),help:Ji("Determines whether the series has to be presented in the legend or not."),value:n.series[i].visibleInLegend?n.series[i].visibleInLegend:"1",options:[{label:Ji("Yes"),value:"1"},{label:Ji("No"),value:"0"}],onChange:function(t){n.series[i].visibleInLegend=t,e.props.edit(n)}}),-1>=["table","candlestick","combo","column","bar"].indexOf(t)&&wp.element.createElement($i,null,wp.element.createElement(no,{label:Ji("Line Width"),help:Ji("Overrides the global line width value for this series."),value:n.series[i].lineWidth,onChange:function(t){n.series[i].lineWidth=t,e.props.edit(n)}}),wp.element.createElement(no,{label:Ji("Point Size"),help:Ji("Overrides the global point size value for this series."),value:n.series[i].pointSize,onChange:function(t){n.series[i].pointSize=t,e.props.edit(n)}})),-1>=["candlestick"].indexOf(t)&&"number"===r[a].type?wp.element.createElement($i,null,wp.element.createElement(no,{label:Ji("Format"),help:Ji("Enter custom format pattern to apply to this series value."),value:n.series[i].format,onChange:function(t){n.series[i].format=t,e.props.edit(n)}}),wp.element.createElement("p",null,Ji("For number axis labels, this is a subset of the formatting "),wp.element.createElement(Xi,{href:"http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details"},Ji("ICU pattern set.")),Ji(" For instance, $#,###.## will display values $1,234.56 for value 1234.56. Pay attention that if you use #%% percentage format then your values will be multiplied by 100."))):"date"===r[a].type&&wp.element.createElement($i,null,wp.element.createElement(no,{label:Ji("Date Format"),help:Ji("Enter custom format pattern to apply to this series value."),placeholder:"dd LLLL yyyy",value:n.series[i].format,onChange:function(t){n.series[i].format=t,e.props.edit(n)}}),wp.element.createElement("p",null,Ji("This is a subset of the date formatting "),wp.element.createElement(Xi,{href:"http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax"},Ji("ICU date and time format.")))),0<=["scatter","line"].indexOf(t)&&wp.element.createElement(to,{label:Ji("Curve Type"),help:Ji("Determines whether the series has to be presented in the legend or not."),value:n.series[i].curveType?n.series[i].curveType:"none",options:[{label:Ji("Straight line without curve"),value:"none"},{label:Ji("The angles of the line will be smoothed"),value:"function"}],onChange:function(t){n.series[i].curveType=t,e.props.edit(n)}}),0<=["area"].indexOf(t)&&wp.element.createElement(no,{label:Ji("Area Opacity"),help:Ji("The opacity of the colored area, where 0.0 is fully transparent and 1.0 is fully opaque."),value:n.series[i].areaOpacity,onChange:function(t){n.series[i].areaOpacity=t,e.props.edit(n)}}),0<=["combo"].indexOf(t)&&wp.element.createElement(to,{label:Ji("Chart Type"),help:Ji("Select the type of chart to show for this series."),value:n.series[i].type?n.series[i].type:"area",options:[{label:Ji("Area"),value:"area"},{label:Ji("Bar"),value:"bars"},{label:Ji("Candlesticks"),value:"candlesticks"},{label:Ji("Line"),value:"line"},{label:Ji("Stepped Area"),value:"steppedArea"}],onChange:function(t){n.series[i].type=t,e.props.edit(n)}}),-1>=["table"].indexOf(t)&&wp.element.createElement(Qi,{label:Ji("Color")},wp.element.createElement(Ki,{value:n.series[i].color,onChange:function(t){n.series[i].color=t,e.props.edit(n)}})))}))}}])&&Ii(n.prototype,r),a&&Ii(n,a),t}();function ao(e){return(ao="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function io(e,t){for(var n=0;n=["gauge"].indexOf(t)&&wp.element.createElement(Do,null,wp.element.createElement(Co,{label:ko("Stroke Width"),help:ko("The chart border width in pixels."),value:n.backgroundColor.strokeWidth,onChange:function(t){n.backgroundColor.strokeWidth=t,e.props.edit(n)}}),wp.element.createElement(Oo,{label:ko("Stroke Color")},wp.element.createElement(To,{value:n.backgroundColor.stroke,onChange:function(t){n.backgroundColor.stroke=t,e.props.edit(n)}})),wp.element.createElement(Oo,{label:ko("Background Color")},wp.element.createElement(To,{value:n.backgroundColor.fill,onChange:function(t){n.backgroundColor.fill=t,e.props.edit(n)}})),wp.element.createElement(jo,{label:ko("Transparent Background?"),checked:"transparent"===n.backgroundColor.fill,onChange:function(t){n.backgroundColor.fill="transparent"===n.backgroundColor.fill?"":"transparent",e.props.edit(n)}}))),-1>=["geo","gauge"].indexOf(t)&&wp.element.createElement(xo,{title:ko("Chart Area"),className:"visualizer-inner-sections",initialOpen:!1},wp.element.createElement(Co,{label:ko("Left Margin"),help:ko("Determines how far to draw the chart from the left border."),value:n.chartArea.left,onChange:function(t){n.chartArea.left=t,e.props.edit(n)}}),wp.element.createElement(Co,{label:ko("Top Margin"),help:ko("Determines how far to draw the chart from the top border."),value:n.chartArea.top,onChange:function(t){n.chartArea.top=t,e.props.edit(n)}}),wp.element.createElement(Co,{label:ko("Width Of Chart Area"),help:ko("Determines the width of the chart area."),value:n.chartArea.width,onChange:function(t){n.chartArea.width=t,e.props.edit(n)}}),wp.element.createElement(Co,{label:ko("Height Of Chart Area"),help:ko("Determines the hight of the chart area."),value:n.chartArea.height,onChange:function(t){n.chartArea.height=t,e.props.edit(n)}})))}}])&&bo(n.prototype,r),a&&bo(n,a),t}();function Po(e){return(Po="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ao(e,t){for(var n=0;n{var t=(new Error).stack.replace(/^Error\s+/,"");return t=(t=t.split("\n")[e]).replace(/^\s+at Object./,"").replace(/^\s+at /,"").replace(/ \(.+\)$/,"")},throwError:(e="unknown function",t="unknown parameter",n="to be defined")=>{throw["@",e,"(): Expected parameter '",t,"' ",n].join("")},isUndefined:(e="",t)=>{[null,void 0].indexOf(t)>-1&&Qo.throwError(Qo.getCaller(2),e)},isFalsy:(e="",t)=>{t||Qo.throwError(Qo.getCaller(2),e)},isNoneOf:(e="",t,n=[])=>{-1===n.indexOf(t)&&Qo.throwError(Qo.getCaller(2),e,"to be any of"+JSON.stringify(n))},isAnyOf:(e="",t,n=[])=>{n.indexOf(t)>-1&&Qo.throwError(Qo.getCaller(2),e,"not to be any of"+JSON.stringify(n))},isNotType:(e="",t,n="")=>{Object(Zo.getType)(t)!==n.toLowerCase()&&Qo.throwError(Qo.getCaller(2),e,"to be type "+n.toLowerCase())},isAnyTypeOf:(e="",t,n=[])=>{n.forEach(n=>{Object(Zo.getType)(t)===n&&Qo.throwError(Qo.getCaller(2),e,"not to be type of "+n.toLowerCase())})},missingKey:(e="",t,n="")=>{Qo.isUndefined(e,t),-1===Object.keys(t).indexOf(n)&&Qo.throwError(Qo.getCaller(2),e,"to contain '"+n+"' key")},missingAnyKeys:(e="",t,n=[""])=>{Qo.isUndefined(e,t);const r=Object.keys(t);n.forEach(t=>{-1===r.indexOf(t)&&Qo.throwError(Qo.getCaller(2),e,"to contain '"+t+"' key")})},containsUndefined:(e="",t)=>{[void 0,null].forEach(n=>{const r=Object(Zo.locate)(t,n);r&&Qo.throwError(Qo.getCaller(2),e,"not to contain '"+JSON.stringify(n)+"' at "+r)})},isInvalidPath:(e="",t)=>{Qo.isUndefined(e,t),Qo.isNotType(e,t,"string"),Qo.isAnyOf(e,t,["","/"]),".$[]#".split().forEach(n=>{t.indexOf(n)>-1&&Qo.throwError(Qo.getCaller(2),e,"not to contain invalid character '"+n+"'")}),t.match(/\/{2,}/g)&&Qo.throwError(Qo.getCaller(2),e,"not to contain consecutive forward slash characters")},isInvalidWriteData:(e="",t)=>{Qo.isUndefined(e,t),Qo.containsUndefined(e,t)}};var Xo=Qo;const es=(e,t)=>t?Object.keys(t).reduce((e,n)=>e.replace(new RegExp(`\\{${n}\\}`,"gi"),(e=>Array.isArray(e)?e.join(", "):"string"==typeof e?e:""+e)(t[n])),e):e;var ts={format:"{reason} at line {line}",symbols:{colon:"colon",comma:"comma",semicolon:"semicolon",slash:"slash",backslash:"backslash",brackets:{round:"round brackets",square:"square brackets",curly:"curly brackets",angle:"angle brackets"},period:"period",quotes:{single:"single quote",double:"double quote",grave:"grave accent"},space:"space",ampersand:"ampersand",asterisk:"asterisk",at:"at sign",equals:"equals sign",hash:"hash",percent:"percent",plus:"plus",minus:"minus",dash:"dash",hyphen:"hyphen",tilde:"tilde",underscore:"underscore",bar:"vertical bar"},types:{key:"key",value:"value",number:"number",string:"string",primitive:"primitive",boolean:"boolean",character:"character",integer:"integer",array:"array",float:"float"},invalidToken:{tokenSequence:{prohibited:"'{firstToken}' token cannot be followed by '{secondToken}' token(s)",permitted:"'{firstToken}' token can only be followed by '{secondToken}' token(s)"},termSequence:{prohibited:"A {firstTerm} cannot be followed by a {secondTerm}",permitted:"A {firstTerm} can only be followed by a {secondTerm}"},double:"'{token}' token cannot be followed by another '{token}' token",useInstead:"'{badToken}' token is not accepted. Use '{goodToken}' instead",unexpected:"Unexpected '{token}' token found"},brace:{curly:{missingOpen:"Missing '{' open curly brace",missingClose:"Open '{' curly brace is missing closing '}' curly brace",cannotWrap:"'{token}' token cannot be wrapped in '{}' curly braces"},square:{missingOpen:"Missing '[' open square brace",missingClose:"Open '[' square brace is missing closing ']' square brace",cannotWrap:"'{token}' token cannot be wrapped in '[]' square braces"}},string:{missingOpen:"Missing/invalid opening string '{quote}' token",missingClose:"Missing/invalid closing string '{quote}' token",mustBeWrappedByQuotes:"Strings must be wrapped by quotes",nonAlphanumeric:"Non-alphanumeric token '{token}' is not allowed outside string notation",unexpectedKey:"Unexpected key found at string position"},key:{numberAndLetterMissingQuotes:"Key beginning with number and containing letters must be wrapped by quotes",spaceMissingQuotes:"Key containing space must be wrapped by quotes",unexpectedString:"Unexpected string found at key position"},noTrailingOrLeadingComma:"Trailing or leading commas in arrays and objects are not permitted"}; +/** @license react-json-editor-ajrm v2.5.8 + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ns=class extends r.Component{constructor(e){super(e),this.updateInternalProps=this.updateInternalProps.bind(this),this.createMarkup=this.createMarkup.bind(this),this.onClick=this.onClick.bind(this),this.onBlur=this.onBlur.bind(this),this.update=this.update.bind(this),this.getCursorPosition=this.getCursorPosition.bind(this),this.setCursorPosition=this.setCursorPosition.bind(this),this.scheduledUpdate=this.scheduledUpdate.bind(this),this.setUpdateTime=this.setUpdateTime.bind(this),this.renderLabels=this.renderLabels.bind(this),this.newSpan=this.newSpan.bind(this),this.renderErrorMessage=this.renderErrorMessage.bind(this),this.onScroll=this.onScroll.bind(this),this.showPlaceholder=this.showPlaceholder.bind(this),this.tokenize=this.tokenize.bind(this),this.onKeyPress=this.onKeyPress.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onPaste=this.onPaste.bind(this),this.stopEvent=this.stopEvent.bind(this),this.refContent=null,this.refLabels=null,this.updateInternalProps(),this.renderCount=1,this.state={prevPlaceholder:"",markupText:"",plainText:"",json:"",jsObject:void 0,lines:!1,error:!1},this.props.locale||console.warn("[react-json-editor-ajrm - Deprecation Warning] You did not provide a 'locale' prop for your JSON input - This will be required in a future version. English has been set as a default.")}updateInternalProps(){let e={},t={},n=Ko.dark_vscode_tribute;"theme"in this.props&&"string"==typeof this.props.theme&&this.props.theme in Ko&&(n=Ko[this.props.theme]),e=n,"colors"in this.props&&(e={default:"default"in this.props.colors?this.props.colors.default:e.default,string:"string"in this.props.colors?this.props.colors.string:e.string,number:"number"in this.props.colors?this.props.colors.number:e.number,colon:"colon"in this.props.colors?this.props.colors.colon:e.colon,keys:"keys"in this.props.colors?this.props.colors.keys:e.keys,keys_whiteSpace:"keys_whiteSpace"in this.props.colors?this.props.colors.keys_whiteSpace:e.keys_whiteSpace,primitive:"primitive"in this.props.colors?this.props.colors.primitive:e.primitive,error:"error"in this.props.colors?this.props.colors.error:e.error,background:"background"in this.props.colors?this.props.colors.background:e.background,background_warning:"background_warning"in this.props.colors?this.props.colors.background_warning:e.background_warning}),this.colors=e,t="style"in this.props?{outerBox:"outerBox"in this.props.style?this.props.style.outerBox:{},container:"container"in this.props.style?this.props.style.container:{},warningBox:"warningBox"in this.props.style?this.props.style.warningBox:{},errorMessage:"errorMessage"in this.props.style?this.props.style.errorMessage:{},body:"body"in this.props.style?this.props.style.body:{},labelColumn:"labelColumn"in this.props.style?this.props.style.labelColumn:{},labels:"labels"in this.props.style?this.props.style.labels:{},contentBox:"contentBox"in this.props.style?this.props.style.contentBox:{}}:{outerBox:{},container:{},warningBox:{},errorMessage:{},body:{},labelColumn:{},labels:{},contentBox:{}},this.style=t,this.confirmGood=!("confirmGood"in this.props)||this.props.confirmGood;const r=this.props.height||"610px",a=this.props.width||"479px";this.totalHeight=r,this.totalWidth=a,"onKeyPressUpdate"in this.props&&!this.props.onKeyPressUpdate?this.timer&&(clearInterval(this.timer),this.timer=!1):this.timer||(this.timer=setInterval(this.scheduledUpdate,100)),this.updateTime=!1,this.waitAfterKeyPress="waitAfterKeyPress"in this.props?this.props.waitAfterKeyPress:1e3,this.resetConfiguration="reset"in this.props&&this.props.reset}render(){const e=this.props.id,t=this.state.markupText,n=this.state.error,r=this.colors,i=this.style,o=this.confirmGood,s=this.totalHeight,l=this.totalWidth,u=!!n&&"token"in n;return this.renderCount++,a.a.createElement("div",{name:"outer-box",id:e&&e+"-outer-box",style:$o({display:"block",overflow:"none",height:s,width:l,margin:0,boxSizing:"border-box",position:"relative"},i.outerBox)},o?a.a.createElement("div",{style:{opacity:u?0:1,height:"30px",width:"30px",position:"absolute",top:0,right:0,transform:"translate(-25%,25%)",pointerEvents:"none",transitionDuration:"0.2s",transitionTimingFunction:"cubic-bezier(0, 1, 0.5, 1)"}},a.a.createElement("svg",{height:"30px",width:"30px",viewBox:"0 0 100 100"},a.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"green",opacity:"0.85",d:"M39.363,79L16,55.49l11.347-11.419L39.694,56.49L72.983,23L84,34.085L39.363,79z"}))):void 0,a.a.createElement("div",{name:"container",id:e&&e+"-container",style:$o({display:"block",height:s,width:l,margin:0,boxSizing:"border-box",overflow:"hidden",fontFamily:"Roboto, sans-serif"},i.container),onClick:this.onClick},a.a.createElement("div",{name:"warning-box",id:e&&e+"-warning-box",style:$o({display:"block",overflow:"hidden",height:u?"60px":"0px",width:"100%",margin:0,backgroundColor:r.background_warning,transitionDuration:"0.2s",transitionTimingFunction:"cubic-bezier(0, 1, 0.5, 1)"},i.warningBox),onClick:this.onClick},a.a.createElement("span",{style:{display:"inline-block",height:"60px",width:"60px",margin:0,boxSizing:"border-box",overflow:"hidden",verticalAlign:"top",pointerEvents:"none"},onClick:this.onClick},a.a.createElement("div",{style:{position:"relative",top:0,left:0,height:"60px",width:"60px",margin:0,pointerEvents:"none"},onClick:this.onClick},a.a.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"},onClick:this.onClick},a.a.createElement("svg",{height:"25px",width:"25px",viewBox:"0 0 100 100"},a.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"red",d:"M73.9,5.75c0.467-0.467,1.067-0.7,1.8-0.7c0.7,0,1.283,0.233,1.75,0.7l16.8,16.8 c0.467,0.5,0.7,1.084,0.7,1.75c0,0.733-0.233,1.334-0.7,1.801L70.35,50l23.9,23.95c0.5,0.467,0.75,1.066,0.75,1.8 c0,0.667-0.25,1.25-0.75,1.75l-16.8,16.75c-0.534,0.467-1.117,0.7-1.75,0.7s-1.233-0.233-1.8-0.7L50,70.351L26.1,94.25 c-0.567,0.467-1.167,0.7-1.8,0.7c-0.667,0-1.283-0.233-1.85-0.7L5.75,77.5C5.25,77,5,76.417,5,75.75c0-0.733,0.25-1.333,0.75-1.8 L29.65,50L5.75,26.101C5.25,25.667,5,25.066,5,24.3c0-0.666,0.25-1.25,0.75-1.75l16.8-16.8c0.467-0.467,1.05-0.7,1.75-0.7 c0.733,0,1.333,0.233,1.8,0.7L50,29.65L73.9,5.75z"}))))),a.a.createElement("span",{style:{display:"inline-block",height:"60px",width:"calc(100% - 60px)",margin:0,overflow:"hidden",verticalAlign:"top",position:"absolute",pointerEvents:"none"},onClick:this.onClick},this.renderErrorMessage())),a.a.createElement("div",{name:"body",id:e&&e+"-body",style:$o({display:"flex",overflow:"none",height:u?"calc(100% - 60px)":"100%",width:"",margin:0,resize:"none",fontFamily:"Roboto Mono, Monaco, monospace",fontSize:"11px",backgroundColor:r.background,transitionDuration:"0.2s",transitionTimingFunction:"cubic-bezier(0, 1, 0.5, 1)"},i.body),onClick:this.onClick},a.a.createElement("span",{name:"labels",id:e&&e+"-labels",ref:e=>this.refLabels=e,style:$o({display:"inline-block",boxSizing:"border-box",verticalAlign:"top",height:"100%",width:"44px",margin:0,padding:"5px 0px 5px 10px",overflow:"hidden",color:"#D4D4D4"},i.labelColumn),onClick:this.onClick},this.renderLabels()),a.a.createElement("span",{id:e,ref:e=>this.refContent=e,contentEditable:!0,style:$o({display:"inline-block",boxSizing:"border-box",verticalAlign:"top",height:"100%",width:"",flex:1,margin:0,padding:"5px",overflowX:"hidden",overflowY:"auto",wordWrap:"break-word",whiteSpace:"pre-line",color:"#D4D4D4",outline:"none"},i.contentBox),dangerouslySetInnerHTML:this.createMarkup(t),onKeyPress:this.onKeyPress,onKeyDown:this.onKeyDown,onClick:this.onClick,onBlur:this.onBlur,onScroll:this.onScroll,onPaste:this.onPaste,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}))))}renderErrorMessage(){const e=this.props.locale||ts,t=this.state.error,n=this.style;if(t)return a.a.createElement("p",{style:$o({color:"red",fontSize:"12px",position:"absolute",width:"calc(100% - 60px)",height:"60px",boxSizing:"border-box",margin:0,padding:0,paddingRight:"10px",overflowWrap:"break-word",display:"flex",flexDirection:"column",justifyContent:"center"},n.errorMessage)},es(e.format,t))}renderLabels(){const e=this.colors,t=this.style,n=this.state.error?this.state.error.line:-1,r=this.state.lines?this.state.lines:1;let i=new Array(r);for(var o=0;o{const i=r!==n?e.default:"red";return a.a.createElement("div",{key:r,style:$o({},t.labels,{color:i})},r)})}createMarkup(e){return void 0===e?{__html:""}:{__html:""+e}}newSpan(e,t,n){let r=this.colors,a=t.type,i=t.string,o="";switch(a){case"string":case"number":case"primitive":case"error":o=r[t.type];break;case"key":o=" "===i?r.keys_whiteSpace:r.keys;break;case"symbol":o=":"===i?r.colon:r.default;break;default:o=r.default}return i.length!==i.replace(//g,"").length&&(i=""+i+""),''+i+""}getCursorPosition(e){let t,n=window.getSelection(),r=-1,a=0;if(n.focusNode&&(e=>{for(;null!==e;){if(e===this.refContent)return!0;e=e.parentNode}return!1})(n.focusNode))for(t=n.focusNode,r=n.focusOffset;t&&t!==this.refContent;)if(t.previousSibling)t=t.previousSibling,e&&"BR"===t.nodeName&&a++,r+=t.textContent.length;else if(null===(t=t.parentNode))break;return r+a}setCursorPosition(e){if([!1,null,void 0].indexOf(e)>-1)return;const t=(e,n,r)=>{if(r||((r=document.createRange()).selectNode(e),r.setStart(e,0)),0===n.count)r.setEnd(e,n.count);else if(e&&n.count>0)if(e.nodeType===Node.TEXT_NODE)e.textContent.length0?(e=>{if(e<0)return;let n=window.getSelection(),r=t(this.refContent,{count:e});r&&(r.collapse(!1),n.removeAllRanges(),n.addRange(r))})(e):this.refContent.focus()}update(e=0,t=!0){const n=this.refContent,r=this.tokenize(n);"onChange"in this.props&&this.props.onChange({plainText:r.indented,markupText:r.markup,json:r.json,jsObject:r.jsObject,lines:r.lines,error:r.error});let a=this.getCursorPosition(r.error)+e;this.setState({plainText:r.indented,markupText:r.markup,json:r.json,jsObject:r.jsObject,lines:r.lines,error:r.error}),this.updateTime=!1,t&&this.setCursorPosition(a)}scheduledUpdate(){if("onKeyPressUpdate"in this.props&&!1===this.props.onKeyPressUpdate)return;const{updateTime:e}=this;!1!==e&&(e>(new Date).getTime()||this.update())}setUpdateTime(){"onKeyPressUpdate"in this.props&&!1===this.props.onKeyPressUpdate||(this.updateTime=(new Date).getTime()+this.waitAfterKeyPress)}stopEvent(e){e&&(e.preventDefault(),e.stopPropagation())}onKeyPress(e){const t=e.ctrlKey||e.metaKey;this.props.viewOnly&&!t&&this.stopEvent(e),t||this.setUpdateTime()}onKeyDown(e){const t=!!this.props.viewOnly,n=e.ctrlKey||e.metaKey;switch(e.key){case"Tab":if(this.stopEvent(e),t)break;document.execCommand("insertText",!1," "),this.setUpdateTime();break;case"Backspace":case"Delete":t&&this.stopEvent(e),this.setUpdateTime();break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":this.setUpdateTime();break;case"a":case"c":t&&!n&&this.stopEvent(e);break;default:t&&this.stopEvent(e)}}onPaste(e){if(this.props.viewOnly)this.stopEvent(e);else{e.preventDefault();var t=e.clipboardData.getData("text/plain");document.execCommand("insertHTML",!1,t)}this.update()}onClick(){"viewOnly"in this.props&&this.props.viewOnly}onBlur(){"viewOnly"in this.props&&this.props.viewOnly||this.update(0,!1)}onScroll(e){this.refLabels.scrollTop=e.target.scrollTop}componentDidUpdate(){this.updateInternalProps(),this.showPlaceholder()}componentDidMount(){this.showPlaceholder()}componentWillUnmount(){this.timer&&clearInterval(this.timer)}showPlaceholder(){if(!("placeholder"in this.props))return;const{placeholder:e}=this.props;if([void 0,null].indexOf(e)>-1)return;const{prevPlaceholder:t,jsObject:n}=this.state,{resetConfiguration:r}=this,a=Object(Zo.getType)(e);-1===["object","array"].indexOf(a)&&Xo.throwError("showPlaceholder","placeholder","either an object or an array");let i=!Object(Zo.identical)(e,t);if(i||r&&void 0!==n&&(i=!Object(Zo.identical)(e,n)),!i)return;const o=this.tokenize(e);this.setState({prevPlaceholder:e,plainText:o.indentation,markupText:o.markup,lines:o.lines,error:o.error})}tokenize(e){if("object"!=typeof e)return console.error("tokenize() expects object type properties only. Got '"+typeof e+"' type instead.");const t=this.props.locale||ts,n=this.newSpan;if("nodeType"in e){const M=e.cloneNode(!0);if(!M.hasChildNodes())return"";const v=M.childNodes;let w={tokens_unknown:[],tokens_proto:[],tokens_split:[],tokens_fallback:[],tokens_normalize:[],tokens_merge:[],tokens_plainText:"",indented:"",json:"",jsObject:void 0,markup:""};for(var r=0;r-1?(n.active&&n.quarks.push({string:n[n.active],type:t+"-"+n.active}),n[n.active]="",n.active=r,n[n.active]=e):n[r]+=e}}for(var a=0;a-1){r(t,"number");break}case".":if(a0&&"0123456789".indexOf(e.charAt(a+1))>-1&&"0123456789".indexOf(e.charAt(a-1))>-1){r(t,"number");break}default:r(t,"string")}}return n.active&&(n.quarks.push({string:n[n.active],type:t+"-"+n.active}),n[n.active]="",n.active=!1),n.quarks}for(r=0;r0&&i-1){if(1===e.length)return!1;if(n!==r)return!1;for(i=0;i0&&i=~*%\\|/-+!?@^  ";for(i=0;i-1)return!1}}break;case"number":for(i=0;i1)return!1;if(-1==="{[:]},".indexOf(e))return!1;break;case"colon":if(e.length>1)return!1;if(":"!==e)return!1;break;default:return!0}return!0}for(r=0;r-1&&("string"!==(t=t.slice(t.indexOf("-")+1))&&i.push("string"),i.push("key"),i.push("error"));let o={string:n,length:a,type:t,fallback:i};w.tokens_fallback.push(o)}function o(){const e=w.tokens_normalize.length-1;if(e<1)return!1;for(var t=e;t>=0;t--){const e=w.tokens_normalize[t];switch(e.type){case"space":case"linebreak":break;default:return e}}return!1}let k={brackets:[],stringOpen:!1,isValue:!1};for(r=0;r0){const e=w.tokens_fallback[r-1],t=e.string,n=e.type,a=t.charAt(t.length-1);if("string"===n&&"\\"===a)break}if(k.stringOpen===n){k.stringOpen=!1;break}break;case"primitive":case"string":if(["false","true","null","undefined"].indexOf(n)>-1){const e=w.tokens_normalize.length-1;if(e>=0){if("string"!==w.tokens_normalize[e].type){a.type="primitive";break}a.type="string";break}a.type="primitive";break}if("\n"===n&&!k.stringOpen){a.type="linebreak";break}k.isValue?a.type="string":a.type="key";break;case"space":case"number":k.stringOpen&&(k.isValue?a.type="string":a.type="key")}w.tokens_normalize.push(a)}for(r=0;r0?1:0;function d(e,t,n=0){l={token:e,line:u,reason:t},w.tokens_merge[e+n].type="error"}function c(e,t){if(void 0===e&&console.error("tokenID argument must be an integer."),void 0===t&&console.error("options argument must be an array."),e===w.tokens_merge.length-1)return!1;for(var n=e+1;n-1&&n;default:return!1}}return!1}function m(e,t){if(void 0===e&&console.error("tokenID argument must be an integer."),void 0===t&&console.error("options argument must be an array."),0===e)return!1;for(var n=e-1;n>=0;n--){const e=w.tokens_merge[n];switch(e.type){case"space":case"linebreak":break;case"symbol":case"colon":return t.indexOf(e.string)>-1;default:return!1}}return!1}function p(e){if(void 0===e&&console.error("tokenID argument must be an integer."),0===e)return!1;for(var t=e-1;t>=0;t--){const e=w.tokens_merge[t];switch(e.type){case"space":case"linebreak":break;default:return e.type}}return!1}k={brackets:[],stringOpen:!1,isValue:!1};let D=[];for(r=0;r0&&!m(r,[":","[",","])){d(r,es(t.invalidToken.tokenSequence.permitted,{firstToken:"[",secondToken:[":","[",","]}));break}if("{"===n&&m(r,["{"])){d(r,es(t.invalidToken.double,{token:"{"}));break}k.brackets.push(n),k.isValue="["===k.brackets[k.brackets.length-1],D.push({i:r,line:u,string:n});break;case"}":case"]":if("}"===n&&"{"!==k.brackets[k.brackets.length-1]){d(r,es(t.brace.curly.missingOpen));break}if("}"===n&&m(r,[","])){d(r,es(t.invalidToken.tokenSequence.prohibited,{firstToken:",",secondToken:"}"}));break}if("]"===n&&"["!==k.brackets[k.brackets.length-1]){d(r,es(t.brace.square.missingOpen));break}if("]"===n&&m(r,[":"])){d(r,es(t.invalidToken.tokenSequence.prohibited,{firstToken:":",secondToken:"]"}));break}k.brackets.pop(),k.isValue="["===k.brackets[k.brackets.length-1],D.push({i:r,line:u,string:n});break;case",":if(i=m(r,["{"])){if(c(r,["}"])){d(r,es(t.brace.curly.cannotWrap,{token:","}));break}d(r,es(t.invalidToken.tokenSequence.prohibited,{firstToken:"{",secondToken:","}));break}if(c(r,["}",",","]"])){d(r,es(t.noTrailingOrLeadingComma));break}switch(i=p(r)){case"key":case"colon":d(r,es(t.invalidToken.termSequence.prohibited,{firstTerm:"key"===i?t.types.key:t.symbols.colon,secondTerm:t.symbols.comma}));break;case"symbol":if(m(r,["{"])){d(r,es(t.invalidToken.tokenSequence.prohibited,{firstToken:"{",secondToken:","}));break}}k.isValue="["===k.brackets[k.brackets.length-1]}w.json+=n;break;case"colon":if((i=m(r,["["]))&&c(r,["]"])){d(r,es(t.brace.square.cannotWrap,{token:":"}));break}if(i){d(r,es(t.invalidToken.tokenSequence.prohibited,{firstToken:"[",secondToken:":"}));break}if("key"!==p(r)){d(r,es(t.invalidToken.termSequence.permitted,{firstTerm:t.symbols.colon,secondTerm:t.types.key}));break}if(c(r,["}","]"])){d(r,es(t.invalidToken.termSequence.permitted,{firstTerm:t.symbols.colon,secondTerm:t.types.value}));break}k.isValue=!0,w.json+=n;break;case"key":case"string":let e=n.charAt(0),o=n.charAt(n.length-1);if(L.indexOf(e),-1===L.indexOf(e)&&-1!==L.indexOf(o)){d(r,es(t.string.missingOpen,{quote:e}));break}if(-1===L.indexOf(o)&&-1!==L.indexOf(e)){d(r,es(t.string.missingClose,{quote:e}));break}if(L.indexOf(e)>-1&&e!==o){d(r,es(t.string.missingClose,{quote:e}));break}if("string"===a&&-1===L.indexOf(e)&&-1===L.indexOf(o)){d(r,es(t.string.mustBeWrappedByQuotes));break}if("key"===a&&c(r,["}","]"])&&d(r,es(t.invalidToken.termSequence.permitted,{firstTerm:t.types.key,secondTerm:t.symbols.colon})),-1===L.indexOf(e)&&-1===L.indexOf(o))for(var h=0;h0&&!isNaN(w.tokens_merge[r-1])){w.tokens_merge[r-1]+=w.tokens_merge[r],d(r,es(t.key.numberAndLetterMissingQuotes));break}d(r,es(t.key.spaceMissingQuotes));break}if("key"===a&&!m(r,["{",","])){d(r,es(t.invalidToken.tokenSequence.permitted,{firstToken:a,secondToken:["{",","]}));break}if("string"===a&&!m(r,["[",":",","])){d(r,es(t.invalidToken.tokenSequence.permitted,{firstToken:a,secondToken:["[",":",","]}));break}if("key"===a&&k.isValue){d(r,es(t.string.unexpectedKey));break}if("string"===a&&!k.isValue){d(r,es(t.key.unexpectedString));break}w.json+=n;break;case"number":case"primitive":if(m(r,["{"]))w.tokens_merge[r].type="key",a=w.tokens_merge[r].type,n='"'+n+'"';else if("key"===p(r))w.tokens_merge[r].type="key",a=w.tokens_merge[r].type;else if(!m(r,["[",":",","])){d(r,es(t.invalidToken.tokenSequence.permitted,{firstToken:a,secondToken:["[",":",","]}));break}"key"!==a&&(k.isValue||(w.tokens_merge[r].type="key",a=w.tokens_merge[r].type,n='"'+n+'"')),"primitive"===a&&"undefined"===n&&d(r,es(t.invalidToken.useInstead,{badToken:"undefined",goodToken:"null"})),w.json+=n}}let T="";for(r=0;r0;){r=!1;for(var f=0;f-1&&_(f)}if(n++,!r)break;if(n>=e)break}if(D.length>0){const e=D[0].string,n=D[0].i,r="["===e?"]":"}";u=D[0].line,d(n,es(t.brace["]"===r?"square":"curly"].missingClose))}}if(!l&&-1===[void 0,""].indexOf(w.json))try{w.jsObject=JSON.parse(w.json)}catch(e){const n=e.message,r=n.indexOf("position");if(-1===r)throw new Error("Error parsing failed");const a=n.substring(r+9,n.length),i=parseInt(a);let o=0,s=0,c=!1,m=1,p=!1;for(;o=i));)s++,w.tokens_merge[s+1]||(p=!0);u=m;let h=0;for(let e=0;e0?h+1:1:(h%2==0&&0!==h||-1==="'\"bfnrt".indexOf(n)&&d(s,es(t.invalidToken.unexpected,{token:"\\"})),h=0)}l||d(s,es(t.invalidToken.unexpected,{token:c.string}))}let S=1,O=0;function y(e=!1){return function(e=!1){return S++,O>0||e?"
    ":""}(e)+function(){for(var e=[],t=0;t<2*O;t++)e.push(" ");return e.join("")}()}if(!l)for(r=0;r0?["[","{"].indexOf(w.tokens_merge[r-1].string)>-1?"":y(a):"";w.markup+=i+n(r,e,O);break;case",":w.markup+=n(r,e,O)}}}if(l){let e=1;function g(e){let t=0;for(var n=0;n-1&&t++;return t}for(S=1,r=0;r{let t="",n="",r="";switch(e){case",":t="symbol",n=e,r=e,a.isValue="["===a.brackets[a.brackets.length-1];break;case":":t="symbol",n=e,r=e,a.isValue=!0;break;case"{":case"[":t="symbol",n=e,r=e,a.brackets.push(e),a.isValue="["===a.brackets[a.brackets.length-1];break;case"}":case"]":t="symbol",n=e,r=e,a.brackets.pop(),a.isValue="["===a.brackets[a.brackets.length-1];break;case"undefined":t="primitive",n=e,r=void 0;break;case"null":t="primitive",n=e,r=null;break;case"false":t="primitive",n=e,r=!1;break;case"true":t="primitive",n=e,r=!0;break;default:const o=e.charAt(0);if("'\"".indexOf(o)>-1){if("key"==(t=a.isValue?"string":"key")&&(n=function(e){if(0===e.length)return e;if(['""',"''"].indexOf(e)>-1)return"''";let t=!1;for(var n=0;n<2;n++)if([e.charAt(0),e.charAt(e.length-1)].indexOf(['"',"'"][n])>-1){t=!0;break}t&&e.length>=2&&(e=e.slice(1,-1));const r=e.replace(/\w/g,""),a=(e.replace(/\W+/g,""),((e,t)=>{let n=!1;for(var r=0;r0||n)})(r,e));if((e=>{for(var t=0;t-1)return!0;return!1})(r)){let t="";const n=e.split("");for(var i=0;i-1&&(e="\\"+e),t+=e}e=t}return a?e:"'"+e+"'"}(e)),"string"===t){n="";const t=e.slice(1,-1).split("");for(var i=0;i-1&&(e="\\"+e),n+=e}n="'"+n+"'"}r=n;break}if(!isNaN(e)){t="number",n=e,r=Number(e);break}if(e.length>0&&!a.isValue){t="key",(n=e).indexOf(" ")>-1&&(n="'"+n+"'"),r=n;break}}return{type:t,string:n,value:r,depth:a.brackets.length}});let i="";for(r=0;r0?"\n":"")+t.join("")}let o="";for(r=0;r0?a.tokens[r-1]:"";-1==="[{".indexOf(n.string)?o+=Y(e.depth)+e.string:o+=e.string;break;case":":o+=e.string+" ";break;case",":o+=e.string+Y(e.depth);break;default:o+=e.string}}let s=1;function D(e){var t=[];e>0&&s++;for(var n=0;n<2*e;n++)t.push(" ");return(e>0?"
    ":"")+t.join("")}let l="";const u=a.tokens.length-1;for(r=0;r0?a.tokens[r-1]:"";-1==="[{".indexOf(i.string)?l+=D(e.depth)+(u===r?"
    ":"")+t:l+=t;break;case":":l+=t+" ";break;case",":l+=t+D(e.depth);break;default:l+=t}}return s+=2,{tokens:a.tokens,noSpaces:i,indented:o,json:JSON.stringify(e),jsObject:e,markup:l,lines:s}}}},rs=n(130),as=n.n(rs);function is(e){return(is="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function os(e,t){for(var n=0;n=["table","gauge","geo","pie","timeline"].indexOf(e)&&wp.element.createElement(Kt,{chart:this.props.chart,edit:this.props.edit}),-1>=["table","gauge","geo","pie","timeline"].indexOf(e)&&wp.element.createElement(hn,{chart:this.props.chart,edit:this.props.edit}),0<=["pie"].indexOf(e)&&wp.element.createElement(ks,null,wp.element.createElement(xn,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(Un,{chart:this.props.chart,edit:this.props.edit})),0<=["area","scatter","line"].indexOf(e)&&wp.element.createElement(ar,{chart:this.props.chart,edit:this.props.edit}),0<=["bar","column"].indexOf(e)&&wp.element.createElement(fr,{chart:this.props.chart,edit:this.props.edit}),0<=["candlestick"].indexOf(e)&&wp.element.createElement(jr,{chart:this.props.chart,edit:this.props.edit}),0<=["geo"].indexOf(e)&&wp.element.createElement(ks,null,wp.element.createElement(Br,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(na,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(fa,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(Sa,{chart:this.props.chart,edit:this.props.edit})),0<=["gauge"].indexOf(e)&&wp.element.createElement(Ua,{chart:this.props.chart,edit:this.props.edit}),0<=["timeline"].indexOf(e)&&wp.element.createElement(ri,{chart:this.props.chart,edit:this.props.edit}),0<=["table"].indexOf(e)&&wp.element.createElement(ks,null,wp.element.createElement(fi,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(Oi,{chart:this.props.chart,edit:this.props.edit})),0<=["combo"].indexOf(e)&&wp.element.createElement(Ni,{chart:this.props.chart,edit:this.props.edit}),-1>=["timeline","gauge","geo","pie"].indexOf(e)&&wp.element.createElement(ro,{chart:this.props.chart,edit:this.props.edit}),0<=["pie"].indexOf(e)&&wp.element.createElement(yo,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(Ho,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(Go,{chart:this.props.chart,edit:this.props.edit}),wp.element.createElement(_s,{chart:this.props.chart,edit:this.props.edit}))}}])&&ys(n.prototype,r),a&&ys(n,a),t}();function Ys(e){return(Ys="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ds(e,t,n,r,a,i,o){try{var s=e[i](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function Ts(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var i=e.apply(t,n);function o(e){Ds(i,r,a,o,s,"next",e)}function s(e){Ds(i,r,a,o,s,"throw",e)}o(void 0)})}}function Ss(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0];this.setState({isLoading:"uploadData",isScheduled:t}),Nl({path:"/visualizer/v1/upload-data?url=".concat(this.state.chart["visualizer-chart-url"]),method:"POST"}).then(function(t){if(2<=Object.keys(t).length){var n=Ol({},e.state.chart);n["visualizer-source"]="Visualizer_Source_Csv_Remote",n["visualizer-default-data"]=0,n["visualizer-series"]=t.series,n["visualizer-data"]=t.data;var r=n["visualizer-series"],a=n["visualizer-settings"],i=r,o="series";return"pie"===n["visualizer-chart-type"]&&(i=n["visualizer-data"],o="slices"),i.map(function(e,t){if("pie"===n["visualizer-chart-type"]||0!==t){var r="pie"!==n["visualizer-chart-type"]?t-1:t;void 0===a[o][r]&&(a[o][r]={},a[o][r].temp=1)}}),a[o]=a[o].filter(function(e,t){return t<("pie"!==n["visualizer-chart-type"]?i.length-1:i.length)}),n["visualizer-settings"]=a,e.setState({chart:n,isModified:!0,isLoading:!1}),t}e.setState({isLoading:!1})},function(t){return e.setState({isLoading:!1}),t})}},{key:"getChartData",value:(i=El(regeneratorRuntime.mark(function e(t){var n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setState({isLoading:"getChartData"});case 2:return e.next=4,Wl({path:"wp/v2/visualizer/".concat(t)});case 4:n=e.sent,(r=Ol({},this.state.chart))["visualizer-source"]="Visualizer_Source_Csv",r["visualizer-default-data"]=0,r["visualizer-series"]=n.chart_data["visualizer-series"],r["visualizer-data"]=n.chart_data["visualizer-data"],this.setState({isLoading:!1,chart:r});case 11:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"editChartData",value:function(e,t){var n=Ol({},this.state.chart),r=[],a=Ol({},n["visualizer-settings"]);e[0].map(function(t,n){r[n]={label:t,type:e[1][n]}}),e.splice(0,2);var i=r,o="series";"pie"===n["visualizer-chart-type"]&&(i=e,o="slices"),i.map(function(e,t){if("pie"===n["visualizer-chart-type"]||0!==t){var r="pie"!==n["visualizer-chart-type"]?t-1:t;void 0===a[o][r]&&(a[o][r]={},a[o][r].temp=1)}}),a[o]=a[o].filter(function(e,t){return t<("pie"!==n["visualizer-chart-type"]?i.length-1:i.length)}),n["visualizer-source"]=t,n["visualizer-default-data"]=0,n["visualizer-data"]=e,n["visualizer-series"]=r,n["visualizer-settings"]=a,n["visualizer-chart-url"]="",this.setState({chart:n,isModified:!0,isScheduled:!1})}},{key:"updateChart",value:function(){var e=this;this.setState({isLoading:"updateChart"});var t=this.state.chart;!1===this.state.isScheduled&&(t["visualizer-chart-schedule"]="");var n="series";"pie"===t["visualizer-chart-type"]&&(n="slices"),Object.keys(t["visualizer-settings"][n]).map(function(e){void 0!==t["visualizer-settings"][n][e]&&void 0!==t["visualizer-settings"][n][e].temp&&delete t["visualizer-settings"][n][e].temp}),Nl({path:"/visualizer/v1/update-chart?id=".concat(this.props.attributes.id),method:"POST",data:t}).then(function(t){return e.setState({isLoading:!1,isModified:!1}),t},function(e){return e})}},{key:"render",value:function(){var e=this;return"renderChart"===this.state.route&&null!==this.state.chart?wp.element.createElement(Tl,{chart:this.state.chart,className:this.props.className,editChart:this.editChart}):wp.element.createElement("div",{className:"visualizer-settings"},wp.element.createElement("div",{className:"visualizer-settings__title"},wp.element.createElement(Gl,{icon:"chart-pie"}),zl("Visualizer")),"home"===this.state.route&&wp.element.createElement("div",{className:"visualizer-settings__content"},wp.element.createElement("div",{className:"visualizer-settings__content-description"},zl("Make a new chart or display an existing one?")),wp.element.createElement("div",{className:"visualizer-settings__content-option locked"},wp.element.createElement("span",{className:"visualizer-settings__content-option-title"},zl("Create a new chart (coming soon)")),wp.element.createElement("div",{className:"visualizer-settings__content-option-icon"},wp.element.createElement(Gl,{icon:"lock"}))),wp.element.createElement("div",{className:"visualizer-settings__content-option",onClick:function(){e.setState({route:"showCharts"}),e.props.setAttributes({route:"showCharts"})}},wp.element.createElement("span",{className:"visualizer-settings__content-option-title"},zl("Display an existing chart")),wp.element.createElement("div",{className:"visualizer-settings__content-option-icon"},wp.element.createElement(Gl,{icon:"arrow-right-alt2"})))),("getChart"===this.state.isLoading||"chartSelect"===this.state.route&&null===this.state.chart||"renderChart"===this.state.route&&null===this.state.chart)&&wp.element.createElement(ql,null,wp.element.createElement($l,null)),"showCharts"===this.state.route&&!1===this.state.isLoading&&wp.element.createElement(ne,{getChart:this.getChart}),"chartSelect"===this.state.route&&null!==this.state.chart&&wp.element.createElement(dl,{chart:this.state.chart,editSettings:this.editSettings,editPermissions:this.editPermissions,url:this.state.url,readUploadedFile:this.readUploadedFile,editURL:this.editURL,editSchedule:this.editSchedule,uploadData:this.uploadData,getChartData:this.getChartData,editChartData:this.editChartData,isLoading:this.state.isLoading}),wp.element.createElement("div",{className:"visualizer-settings__controls"},("showCharts"===this.state.route||"chartSelect"===this.state.route)&&wp.element.createElement(Jl,null,wp.element.createElement(Vl,{isDefault:!0,isLarge:!0,onClick:function(){var t;"showCharts"===e.state.route?t="home":"chartSelect"===e.state.route&&(t="showCharts"),e.setState({route:t}),e.props.setAttributes({route:t})}},zl("Back")),"chartSelect"===this.state.route&&wp.element.createElement(Bl,null,!1===this.state.isModified?wp.element.createElement(Vl,{isDefault:!0,isLarge:!0,onClick:function(){e.setState({route:"renderChart"}),e.props.setAttributes({route:"renderChart"})}},zl("Done")):wp.element.createElement(Vl,{isPrimary:!0,isLarge:!0,isBusy:"updateChart"===this.state.isLoading,disabled:"updateChart"===this.state.isLoading,onClick:this.updateChart},zl("Save"))))))}}])&&Cl(n.prototype,r),a&&Cl(n,a),t}(),Zl=(n(148),wp.i18n.__),Ql=wp.blocks.registerBlockType;t.default=Ql("visualizer/chart",{title:Zl("Visualizer Chart"),description:Zl("A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages."),category:"common",icon:"chart-pie",keywords:[Zl("Visualizer"),Zl("Chart"),Zl("Google Charts")],attributes:{id:{type:"number"},route:{type:"string"}},supports:{customClassName:!1},edit:Kl,save:function(){return null}})}]); \ No newline at end of file diff --git a/classes/Visualizer/Gutenberg/build/handsontable.css b/classes/Visualizer/Gutenberg/build/handsontable.css new file mode 100644 index 00000000..1ffbec1b --- /dev/null +++ b/classes/Visualizer/Gutenberg/build/handsontable.css @@ -0,0 +1,34 @@ +/*! + * (The MIT License) + * + * Copyright (c) 2012-2014 Marcin Warpechowski + * Copyright (c) 2015 Handsoncode sp. z o.o. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Version: 5.0.2 + * Release date: 12/09/2018 (built at 11/09/2018 09:55:19) + */.handsontable .table th,.handsontable .table td{border-top:none}.handsontable tr{background:#fff}.handsontable td{background-color:inherit}.handsontable .table caption+thead tr:first-child th,.handsontable .table caption+thead tr:first-child td,.handsontable .table colgroup+thead tr:first-child th,.handsontable .table colgroup+thead tr:first-child td,.handsontable .table thead:first-child tr:first-child th,.handsontable .table thead:first-child tr:first-child td{border-top:1px solid #CCCCCC}.handsontable .table-bordered{border:0;border-collapse:separate}.handsontable .table-bordered th,.handsontable .table-bordered td{border-left:none}.handsontable .table-bordered th:first-child,.handsontable .table-bordered td:first-child{border-left:1px solid #CCCCCC}.handsontable .table>tbody>tr>td,.handsontable .table>tbody>tr>th,.handsontable .table>tfoot>tr>td,.handsontable .table>tfoot>tr>th,.handsontable .table>thead>tr>td,.handsontable .table>thead>tr>th{line-height:21px;padding:0 4px}.col-lg-1.handsontable,.col-lg-10.handsontable,.col-lg-11.handsontable,.col-lg-12.handsontable,.col-lg-2.handsontable,.col-lg-3.handsontable,.col-lg-4.handsontable,.col-lg-5.handsontable,.col-lg-6.handsontable,.col-lg-7.handsontable,.col-lg-8.handsontable,.col-lg-9.handsontable,.col-md-1.handsontable,.col-md-10.handsontable,.col-md-11.handsontable,.col-md-12.handsontable,.col-md-2.handsontable,.col-md-3.handsontable,.col-md-4.handsontable,.col-md-5.handsontable,.col-md-6.handsontable,.col-md-7.handsontable,.col-md-8.handsontable,.col-md-9.handsontable .col-sm-1.handsontable,.col-sm-10.handsontable,.col-sm-11.handsontable,.col-sm-12.handsontable,.col-sm-2.handsontable,.col-sm-3.handsontable,.col-sm-4.handsontable,.col-sm-5.handsontable,.col-sm-6.handsontable,.col-sm-7.handsontable,.col-sm-8.handsontable,.col-sm-9.handsontable .col-xs-1.handsontable,.col-xs-10.handsontable,.col-xs-11.handsontable,.col-xs-12.handsontable,.col-xs-2.handsontable,.col-xs-3.handsontable,.col-xs-4.handsontable,.col-xs-5.handsontable,.col-xs-6.handsontable,.col-xs-7.handsontable,.col-xs-8.handsontable,.col-xs-9.handsontable{padding-left:0;padding-right:0}.handsontable .table-striped>tbody>tr:nth-of-type(even){background-color:#FFF}.handsontable{position:relative}.handsontable .hide{display:none}.handsontable .relative{position:relative}.handsontable.htAutoSize{visibility:hidden;left:-99000px;position:absolute;top:-99000px}.handsontable .wtHider{width:0}.handsontable .wtSpreader{position:relative;width:0;height:auto}.handsontable table,.handsontable tbody,.handsontable thead,.handsontable td,.handsontable th,.handsontable input,.handsontable textarea,.handsontable div{box-sizing:content-box;-webkit-box-sizing:content-box;-moz-box-sizing:content-box}.handsontable input,.handsontable textarea{min-height:initial}.handsontable table.htCore{border-collapse:separate;border-spacing:0;margin:0;border-width:0;table-layout:fixed;width:0;outline-width:0;cursor:default;max-width:none;max-height:none}.handsontable col{width:50px}.handsontable col.rowHeader{width:50px}.handsontable th,.handsontable td{border-top-width:0;border-left-width:0;border-right:1px solid #CCC;border-bottom:1px solid #CCC;height:22px;empty-cells:show;line-height:21px;padding:0 4px 0 4px;background-color:#FFF;vertical-align:top;overflow:hidden;outline-width:0;white-space:pre-line;background-clip:padding-box}.handsontable td.htInvalid{background-color:#ff4c42 !important}.handsontable td.htNoWrap{white-space:nowrap}.handsontable th:last-child{border-right:1px solid #CCC;border-bottom:1px solid #CCC}.handsontable tr:first-child th.htNoFrame,.handsontable th:first-child.htNoFrame,.handsontable th.htNoFrame{border-left-width:0;background-color:white;border-color:#FFF}.handsontable th:first-child,.handsontable th:nth-child(2),.handsontable td:first-of-type,.handsontable .htNoFrame+th,.handsontable .htNoFrame+td{border-left:1px solid #CCC}.handsontable.htRowHeaders thead tr th:nth-child(2){border-left:1px solid #CCC}.handsontable tr:first-child th,.handsontable tr:first-child td{border-top:1px solid #CCC}.ht_master:not(.innerBorderLeft):not(.emptyColumns) ~ .handsontable tbody tr th,.ht_master:not(.innerBorderLeft):not(.emptyColumns) ~ .handsontable:not(.ht_clone_top) thead tr th:first-child{border-right-width:0}.ht_master:not(.innerBorderTop) thead tr:last-child th,.ht_master:not(.innerBorderTop) ~ .handsontable thead tr:last-child th,.ht_master:not(.innerBorderTop) thead tr.lastChild th,.ht_master:not(.innerBorderTop) ~ .handsontable thead tr.lastChild th{border-bottom-width:0}.handsontable th{background-color:#f0f0f0;color:#222;text-align:center;font-weight:normal;white-space:nowrap}.handsontable thead th{padding:0}.handsontable th.active{background-color:#CCC}.handsontable thead th .relative{padding:2px 4px}#hot-display-license-info{font-size:10px;color:#323232;padding:5px 0 3px 0;font-family:Helvetica, Arial, sans-serif;text-align:left}.handsontable .manualColumnResizer{position:fixed;top:0;cursor:col-resize;z-index:110;width:5px;height:25px}.handsontable .manualRowResizer{position:fixed;left:0;cursor:row-resize;z-index:110;height:5px;width:50px}.handsontable .manualColumnResizer:hover,.handsontable .manualColumnResizer.active,.handsontable .manualRowResizer:hover,.handsontable .manualRowResizer.active{background-color:#34a9db}.handsontable .manualColumnResizerGuide{position:fixed;right:0;top:0;background-color:#34a9db;display:none;width:0;border-right:1px dashed #777;margin-left:5px}.handsontable .manualRowResizerGuide{position:fixed;left:0;bottom:0;background-color:#34a9db;display:none;height:0;border-bottom:1px dashed #777;margin-top:5px}.handsontable .manualColumnResizerGuide.active,.handsontable .manualRowResizerGuide.active{display:block;z-index:199}.handsontable .columnSorting{position:relative}.handsontable .columnSorting:hover{text-decoration:underline;cursor:pointer}.handsontable .columnSorting.ascending::after{content:'\25B2';color:#5f5f5f;position:absolute;right:-15px}.handsontable .columnSorting.descending::after{content:'\25BC';color:#5f5f5f;position:absolute;right:-15px}.handsontable .wtBorder{position:absolute;font-size:0}.handsontable .wtBorder.hidden{display:none !important}.handsontable .wtBorder.current{z-index:10}.handsontable .wtBorder.area{z-index:8}.handsontable .wtBorder.fill{z-index:6}.handsontable td.area,.handsontable td.area-1,.handsontable td.area-2,.handsontable td.area-3,.handsontable td.area-4,.handsontable td.area-5,.handsontable td.area-6,.handsontable td.area-7{position:relative}.handsontable td.area:before,.handsontable td.area-1:before,.handsontable td.area-2:before,.handsontable td.area-3:before,.handsontable td.area-4:before,.handsontable td.area-5:before,.handsontable td.area-6:before,.handsontable td.area-7:before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;bottom:-100%\9;background:#005eff}@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none){.handsontable td.area:before,.handsontable td.area-1:before,.handsontable td.area-2:before,.handsontable td.area-3:before,.handsontable td.area-4:before,.handsontable td.area-5:before,.handsontable td.area-6:before,.handsontable td.area-7:before{bottom:-100%}}.handsontable td.area:before{opacity:0.1}.handsontable td.area-1:before{opacity:0.2}.handsontable td.area-2:before{opacity:0.27}.handsontable td.area-3:before{opacity:0.35}.handsontable td.area-4:before{opacity:0.41}.handsontable td.area-5:before{opacity:0.47}.handsontable td.area-6:before{opacity:0.54}.handsontable td.area-7:before{opacity:0.58}.handsontable tbody th.ht__highlight,.handsontable thead th.ht__highlight{background-color:#dcdcdc}.handsontable tbody th.ht__active_highlight,.handsontable thead th.ht__active_highlight{background-color:#8eb0e7;color:#000}.handsontable .wtBorder.corner{font-size:0;cursor:crosshair}.handsontable .htBorder.htFillBorder{background:red;width:1px;height:1px}.handsontableInput{border:none;outline-width:0;margin:0;padding:1px 5px 0 5px;font-family:inherit;line-height:21px;font-size:inherit;box-shadow:0 0 0 2px #5292F7 inset;resize:none;display:block;color:#000;border-radius:0;background-color:#FFF}.handsontableInputHolder{position:absolute;top:0;left:0;z-index:104}.htSelectEditor{-webkit-appearance:menulist-button !important;position:absolute;width:auto}.handsontable .htDimmed{color:#777}.handsontable .htSubmenu{position:relative}.handsontable .htSubmenu :after{content:'\25B6';color:#777;position:absolute;right:5px;font-size:9px}.handsontable .htLeft{text-align:left}.handsontable .htCenter{text-align:center}.handsontable .htRight{text-align:right}.handsontable .htJustify{text-align:justify}.handsontable .htTop{vertical-align:top}.handsontable .htMiddle{vertical-align:middle}.handsontable .htBottom{vertical-align:bottom}.handsontable .htPlaceholder{color:#999}.handsontable .htAutocompleteArrow{float:right;font-size:10px;color:#EEE;cursor:default;width:16px;text-align:center}.handsontable td .htAutocompleteArrow:hover{color:#777}.handsontable td.area .htAutocompleteArrow{color:#d3d3d3}.handsontable .htCheckboxRendererInput{display:inline-block;vertical-align:middle}.handsontable .htCheckboxRendererInput.noValue{opacity:0.5}.handsontable .htCheckboxRendererLabel{cursor:pointer;display:inline-block;width:100%}.handsontable .handsontable.ht_clone_top .wtHider{padding:0 0 5px 0}.handsontable .autocompleteEditor.handsontable{padding-right:17px}.handsontable .autocompleteEditor.handsontable.htMacScroll{padding-right:15px}.handsontable.listbox{margin:0}.handsontable.listbox .ht_master table{border:1px solid #ccc;border-collapse:separate;background:white}.handsontable.listbox th,.handsontable.listbox tr:first-child th,.handsontable.listbox tr:last-child th,.handsontable.listbox tr:first-child td,.handsontable.listbox td{border-color:transparent}.handsontable.listbox th,.handsontable.listbox td{white-space:nowrap;text-overflow:ellipsis}.handsontable.listbox td.htDimmed{cursor:default;color:inherit;font-style:inherit}.handsontable.listbox .wtBorder{visibility:hidden}.handsontable.listbox tr td.current,.handsontable.listbox tr:hover td{background:#eee}.ht_clone_top{z-index:101}.ht_clone_left{z-index:102}.ht_clone_top_left_corner,.ht_clone_bottom_left_corner{z-index:103}.ht_clone_debug{z-index:103}.handsontable td.htSearchResult{background:#fcedd9;color:#583707}.htBordered{border-width:1px}.htBordered.htTopBorderSolid{border-top-style:solid;border-top-color:#000}.htBordered.htRightBorderSolid{border-right-style:solid;border-right-color:#000}.htBordered.htBottomBorderSolid{border-bottom-style:solid;border-bottom-color:#000}.htBordered.htLeftBorderSolid{border-left-style:solid;border-left-color:#000}.handsontable tbody tr th:nth-last-child(2){border-right:1px solid #CCC}.handsontable thead tr:nth-last-child(2) th.htGroupIndicatorContainer{border-bottom:1px solid #CCC;padding-bottom:5px}.ht_clone_top_left_corner thead tr th:nth-last-child(2){border-right:1px solid #CCC}.htCollapseButton{width:10px;height:10px;line-height:10px;text-align:center;border-radius:5px;border:1px solid #f3f3f3;box-shadow:1px 1px 3px rgba(0,0,0,0.4);cursor:pointer;margin-bottom:3px;position:relative}.htCollapseButton:after{content:"";height:300%;width:1px;display:block;background:#ccc;margin-left:4px;position:absolute;bottom:10px}thead .htCollapseButton{right:5px;position:absolute;top:5px;background:#fff}thead .htCollapseButton:after{height:1px;width:700%;right:10px;top:4px}.handsontable tr th .htExpandButton{position:absolute;width:10px;height:10px;line-height:10px;text-align:center;border-radius:5px;border:1px solid #f3f3f3;box-shadow:1px 1px 3px rgba(0,0,0,0.4);cursor:pointer;top:0;display:none}.handsontable thead tr th .htExpandButton{top:5px}.handsontable tr th .htExpandButton.clickable{display:block}.collapsibleIndicator{position:absolute;top:50%;-webkit-transform:translate(0%, -50%);transform:translate(0%, -50%);right:5px;border:1px solid #A6A6A6;line-height:10px;color:#222;border-radius:10px;font-size:10px;width:10px;height:10px;cursor:pointer;box-shadow:0 0 0 6px #eee;background:#eee}.handsontable col.hidden{width:0 !important}.handsontable table tr th.lightRightBorder{border-right:1px solid #E6E6E6}.handsontable tr.hidden,.handsontable tr.hidden td,.handsontable tr.hidden th{display:none}.ht_master,.ht_clone_left,.ht_clone_top,.ht_clone_bottom{overflow:hidden}.ht_master .wtHolder{overflow:auto}.handsontable .ht_master thead,.handsontable .ht_master tr th,.handsontable .ht_clone_left thead{visibility:hidden}.ht_clone_top .wtHolder,.ht_clone_left .wtHolder,.ht_clone_bottom .wtHolder{overflow:hidden}.handsontable.mobile,.handsontable.mobile .wtHolder{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-overflow-scrolling:touch}.htMobileEditorContainer{display:none;position:absolute;top:0;width:70%;height:54pt;background:#f8f8f8;border-radius:20px;border:1px solid #ebebeb;z-index:999;box-sizing:border-box;-webkit-box-sizing:border-box;-webkit-text-size-adjust:none}.topLeftSelectionHandle:not(.ht_master .topLeftSelectionHandle),.topLeftSelectionHandle-HitArea:not(.ht_master .topLeftSelectionHandle-HitArea){z-index:9999}.topLeftSelectionHandle,.topLeftSelectionHandle-HitArea,.bottomRightSelectionHandle,.bottomRightSelectionHandle-HitArea{left:-10000px;top:-10000px}.htMobileEditorContainer.active{display:block}.htMobileEditorContainer .inputs{position:absolute;right:210pt;bottom:10pt;top:10pt;left:14px;height:34pt}.htMobileEditorContainer .inputs textarea{font-size:13pt;border:1px solid #a1a1a1;-webkit-appearance:none;box-shadow:none;position:absolute;left:14px;right:14px;top:0;bottom:0;padding:7pt}.htMobileEditorContainer .cellPointer{position:absolute;top:-13pt;height:0;width:0;left:30px;border-left:13pt solid transparent;border-right:13pt solid transparent;border-bottom:13pt solid #ebebeb}.htMobileEditorContainer .cellPointer.hidden{display:none}.htMobileEditorContainer .cellPointer:before{content:'';display:block;position:absolute;top:2px;height:0;width:0;left:-13pt;border-left:13pt solid transparent;border-right:13pt solid transparent;border-bottom:13pt solid #f8f8f8}.htMobileEditorContainer .moveHandle{position:absolute;top:10pt;left:5px;width:30px;bottom:0px;cursor:move;z-index:9999}.htMobileEditorContainer .moveHandle:after{content:"..\A..\A..\A..";white-space:pre;line-height:10px;font-size:20pt;display:inline-block;margin-top:-8px;color:#ebebeb}.htMobileEditorContainer .positionControls{width:205pt;position:absolute;right:5pt;top:0;bottom:0}.htMobileEditorContainer .positionControls>div{width:50pt;height:100%;float:left}.htMobileEditorContainer .positionControls>div:after{content:" ";display:block;width:15pt;height:15pt;text-align:center;line-height:50pt}.htMobileEditorContainer .leftButton:after,.htMobileEditorContainer .rightButton:after,.htMobileEditorContainer .upButton:after,.htMobileEditorContainer .downButton:after{transform-origin:5pt 5pt;-webkit-transform-origin:5pt 5pt;margin:21pt 0 0 21pt}.htMobileEditorContainer .leftButton:after{border-top:2px solid #288ffe;border-left:2px solid #288ffe;-webkit-transform:rotate(-45deg)}.htMobileEditorContainer .leftButton:active:after{border-color:#cfcfcf}.htMobileEditorContainer .rightButton:after{border-top:2px solid #288ffe;border-left:2px solid #288ffe;-webkit-transform:rotate(135deg)}.htMobileEditorContainer .rightButton:active:after{border-color:#cfcfcf}.htMobileEditorContainer .upButton:after{border-top:2px solid #288ffe;border-left:2px solid #288ffe;-webkit-transform:rotate(45deg)}.htMobileEditorContainer .upButton:active:after{border-color:#cfcfcf}.htMobileEditorContainer .downButton:after{border-top:2px solid #288ffe;border-left:2px solid #288ffe;-webkit-transform:rotate(225deg)}.htMobileEditorContainer .downButton:active:after{border-color:#cfcfcf}.handsontable.hide-tween{-webkit-animation:opacity-hide 0.3s;animation:opacity-hide 0.3s;animation-fill-mode:forwards;-webkit-animation-fill-mode:forwards}.handsontable.show-tween{-webkit-animation:opacity-show 0.3s;animation:opacity-show 0.3s;animation-fill-mode:forwards;-webkit-animation-fill-mode:forwards}/*! + * Pikaday + * Copyright © 2014 David Bushell | BSD & MIT license | http://dbushell.com/ + */.pika-single{z-index:9999;display:block;position:relative;color:#333;background:#fff;border:1px solid #ccc;border-bottom-color:#bbb;font-family:"Helvetica Neue", Helvetica, Arial, sans-serif}.pika-single:before,.pika-single:after{content:" ";display:table}.pika-single:after{clear:both}.pika-single{*zoom:1}.pika-single.is-hidden{display:none}.pika-single.is-bound{position:absolute;box-shadow:0 5px 15px -5px rgba(0,0,0,0.5)}.pika-lendar{float:left;width:240px;margin:8px}.pika-title{position:relative;text-align:center}.pika-label{display:inline-block;*display:inline;position:relative;z-index:9999;overflow:hidden;margin:0;padding:5px 3px;font-size:14px;line-height:20px;font-weight:bold;background-color:#fff}.pika-title select{cursor:pointer;position:absolute;z-index:9998;margin:0;left:0;top:5px;filter:alpha(opacity=0);opacity:0}.pika-prev,.pika-next{display:block;cursor:pointer;position:relative;outline:none;border:0;padding:0;width:20px;height:30px;text-indent:20px;white-space:nowrap;overflow:hidden;background-color:transparent;background-position:center center;background-repeat:no-repeat;background-size:75% 75%;opacity:.5;*position:absolute;*top:0}.pika-prev:hover,.pika-next:hover{opacity:1}.pika-prev,.is-rtl .pika-next{float:left;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAUklEQVR42u3VMQoAIBADQf8Pgj+OD9hG2CtONJB2ymQkKe0HbwAP0xucDiQWARITIDEBEnMgMQ8S8+AqBIl6kKgHiXqQqAeJepBo/z38J/U0uAHlaBkBl9I4GwAAAABJRU5ErkJggg==");*left:0}.pika-next,.is-rtl .pika-prev{float:right;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAU0lEQVR42u3VOwoAMAgE0dwfAnNjU26bYkBCFGwfiL9VVWoO+BJ4Gf3gtsEKKoFBNTCoCAYVwaAiGNQGMUHMkjGbgjk2mIONuXo0nC8XnCf1JXgArVIZAQh5TKYAAAAASUVORK5CYII=");*right:0}.pika-prev.is-disabled,.pika-next.is-disabled{cursor:default;opacity:.2}.pika-select{display:inline-block;*display:inline}.pika-table{width:100%;border-collapse:collapse;border-spacing:0;border:0}.pika-table th,.pika-table td{width:14.285714285714286%;padding:0}.pika-table th{color:#999;font-size:12px;line-height:25px;font-weight:bold;text-align:center}.pika-button{cursor:pointer;display:block;box-sizing:border-box;-moz-box-sizing:border-box;outline:none;border:0;margin:0;width:100%;padding:5px;color:#666;font-size:12px;line-height:15px;text-align:right;background:#f5f5f5}.pika-week{font-size:11px;color:#999}.is-today .pika-button{color:#33aaff;font-weight:bold}.is-selected .pika-button{color:#fff;font-weight:bold;background:#33aaff;box-shadow:inset 0 1px 3px #178fe5;border-radius:3px}.is-inrange .pika-button{background:#D5E9F7}.is-startrange .pika-button{color:#fff;background:#6CB31D;box-shadow:none;border-radius:3px}.is-endrange .pika-button{color:#fff;background:#33aaff;box-shadow:none;border-radius:3px}.is-disabled .pika-button,.is-outside-current-month .pika-button{pointer-events:none;cursor:default;color:#999;opacity:.3}.pika-button:hover{color:#fff;background:#ff8000;box-shadow:none;border-radius:3px}.pika-table abbr{border-bottom:none;cursor:help}.htCommentCell{position:relative}.htCommentCell:after{content:'';position:absolute;top:0;right:0;border-left:6px solid transparent;border-top:6px solid black}.htComments{display:none;z-index:1059;position:absolute}.htCommentTextArea{box-shadow:rgba(0,0,0,0.117647) 0 1px 3px,rgba(0,0,0,0.239216) 0 1px 2px;box-sizing:border-box;border:none;border-left:3px solid #ccc;background-color:#fff;width:215px;height:90px;font-size:12px;padding:5px;outline:0px !important;-webkit-appearance:none}.htCommentTextArea:focus{box-shadow:rgba(0,0,0,0.117647) 0 1px 3px,rgba(0,0,0,0.239216) 0 1px 2px,inset 0 0 0 1px #5292f7;border-left:3px solid #5292f7}/*! + * Handsontable ContextMenu + */.htContextMenu:not(.htGhostTable){display:none;position:absolute;z-index:1060}.htContextMenu .ht_clone_top,.htContextMenu .ht_clone_left,.htContextMenu .ht_clone_corner,.htContextMenu .ht_clone_debug{display:none}.htContextMenu table.htCore{border:1px solid #ccc;border-bottom-width:2px;border-right-width:2px}.htContextMenu .wtBorder{visibility:hidden}.htContextMenu table tbody tr td{background:white;border-width:0;padding:4px 6px 0 6px;cursor:pointer;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.htContextMenu table tbody tr td:first-child{border:0}.htContextMenu table tbody tr td.htDimmed{font-style:normal;color:#323232}.htContextMenu table tbody tr td.current,.htContextMenu table tbody tr td.zeroclipboard-is-hover{background:#f3f3f3}.htContextMenu table tbody tr td.htSeparator{border-top:1px solid #e6e6e6;height:0;padding:0;cursor:default}.htContextMenu table tbody tr td.htDisabled{color:#999;cursor:default}.htContextMenu table tbody tr td.htDisabled:hover{background:#fff;color:#999;cursor:default}.htContextMenu table tbody tr.htHidden{display:none}.htContextMenu table tbody tr td .htItemWrapper{margin-left:10px;margin-right:6px}.htContextMenu table tbody tr td div span.selected{margin-top:-2px;position:absolute;left:4px}.htContextMenu .ht_master .wtHolder{overflow:hidden}textarea#HandsontableCopyPaste{position:fixed !important;top:0 !important;right:100% !important;overflow:hidden;opacity:0;outline:0 none !important}.htRowHeaders .ht_master.innerBorderLeft ~ .ht_clone_top_left_corner th:nth-child(2),.htRowHeaders .ht_master.innerBorderLeft ~ .ht_clone_left td:first-of-type{border-left:0 none}.handsontable .wtHider{position:relative}.handsontable.ht__manualColumnMove.after-selection--columns thead th.ht__highlight{cursor:move;cursor:-webkit-grab;cursor:grab}.handsontable.ht__manualColumnMove.on-moving--columns,.handsontable.ht__manualColumnMove.on-moving--columns thead th.ht__highlight{cursor:move;cursor:-webkit-grabbing;cursor:grabbing}.handsontable.ht__manualColumnMove.on-moving--columns .manualColumnResizer{display:none}.handsontable .ht__manualColumnMove--guideline,.handsontable .ht__manualColumnMove--backlight{position:absolute;height:100%;display:none}.handsontable .ht__manualColumnMove--guideline{background:#757575;width:2px;top:0;margin-left:-1px;z-index:105}.handsontable .ht__manualColumnMove--backlight{background:#343434;background:rgba(52,52,52,0.25);display:none;z-index:105;pointer-events:none}.handsontable.on-moving--columns.show-ui .ht__manualColumnMove--guideline,.handsontable.on-moving--columns .ht__manualColumnMove--backlight{display:block}.handsontable .wtHider{position:relative}.handsontable.ht__manualRowMove.after-selection--rows tbody th.ht__highlight{cursor:move;cursor:-webkit-grab;cursor:grab}.handsontable.ht__manualRowMove.on-moving--rows,.handsontable.ht__manualRowMove.on-moving--rows tbody th.ht__highlight{cursor:move;cursor:-webkit-grabbing;cursor:grabbing}.handsontable.ht__manualRowMove.on-moving--rows .manualRowResizer{display:none}.handsontable .ht__manualRowMove--guideline,.handsontable .ht__manualRowMove--backlight{position:absolute;width:100%;display:none}.handsontable .ht__manualRowMove--guideline{background:#757575;height:2px;left:0;margin-top:-1px;z-index:105}.handsontable .ht__manualRowMove--backlight{background:#343434;background:rgba(52,52,52,0.25);display:none;z-index:105;pointer-events:none}.handsontable.on-moving--rows.show-ui .ht__manualRowMove--guideline,.handsontable.on-moving--rows .ht__manualRowMove--backlight{display:block}.handsontable tbody td[rowspan][class*="area"][class*="highlight"]:not([class*="fullySelectedMergedCell"]):before{opacity:0}.handsontable tbody td[rowspan][class*="area"][class*="highlight"][class*="fullySelectedMergedCell-multiple"]:before{opacity:0.1}.handsontable tbody td[rowspan][class*="area"][class*="highlight"][class*="fullySelectedMergedCell-0"]:before{opacity:0.1}.handsontable tbody td[rowspan][class*="area"][class*="highlight"][class*="fullySelectedMergedCell-1"]:before{opacity:0.2}.handsontable tbody td[rowspan][class*="area"][class*="highlight"][class*="fullySelectedMergedCell-2"]:before{opacity:0.27}.handsontable tbody td[rowspan][class*="area"][class*="highlight"][class*="fullySelectedMergedCell-3"]:before{opacity:0.35}.handsontable tbody td[rowspan][class*="area"][class*="highlight"][class*="fullySelectedMergedCell-4"]:before{opacity:0.41}.handsontable tbody td[rowspan][class*="area"][class*="highlight"][class*="fullySelectedMergedCell-5"]:before{opacity:0.47}.handsontable tbody td[rowspan][class*="area"][class*="highlight"][class*="fullySelectedMergedCell-6"]:before{opacity:0.54}.handsontable tbody td[rowspan][class*="area"][class*="highlight"][class*="fullySelectedMergedCell-7"]:before{opacity:0.58} + diff --git a/classes/Visualizer/Gutenberg/build/handsontable.js b/classes/Visualizer/Gutenberg/build/handsontable.js new file mode 100644 index 00000000..169a4e32 --- /dev/null +++ b/classes/Visualizer/Gutenberg/build/handsontable.js @@ -0,0 +1,43 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{141:function(e,t,n){(function(t,o){ +/*! + * (The MIT License) + * + * Copyright (c) 2012-2014 Marcin Warpechowski + * Copyright (c) 2015 Handsoncode sp. z o.o. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Version: 5.0.2 + * Release date: 12/09/2018 (built at 11/09/2018 09:55:19) + */ +var r;"undefined"!=typeof self&&self,r=function(e,n,r){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=207)}([function(e,t,n){"use strict";t.__esModule=!0,t.HTML_CHARACTERS=void 0,t.getParent=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=-1,o=null,r=e;for(;null!==r;){if(n===t){o=r;break}r.host&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE?r=r.host:(n+=1,r=r.parentNode)}return o},t.closest=a,t.closestDown=function(e,t,n){var o=[],r=e;for(;r&&(r=a(r,t,n))&&(!n||n.contains(r));)o.push(r),r=r.host&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE?r.host:r.parentNode;var i=o.length;return i?o[i-1]:null},t.isChildOf=function(e,t){var n=e.parentNode,o=[];"string"==typeof t?o=Array.prototype.slice.call(document.querySelectorAll(t),0):o.push(t);for(;null!==n;){if(o.indexOf(n)>-1)return!0;n=n.parentNode}return!1},t.isChildOfWebComponentTable=function(e){var t="hot-table",n=!1,o=s(e);function r(e){return e.nodeType===Node.ELEMENT_NODE&&e.nodeName===t.toUpperCase()}for(;null!==o;){if(r(o)){n=!0;break}if(o.host&&o.nodeType===Node.DOCUMENT_FRAGMENT_NODE){if(n=r(o.host))break;o=o.host}o=o.parentNode}return n},t.polymerWrap=s,t.polymerUnwrap=l,t.index=function(e){var t=0,n=e;if(n.previousSibling)for(;n=n.previousSibling;)t+=1;return t},t.overlayContainsElement=function(e,t){var n=document.querySelector(".ht_clone_"+e);return n?n.contains(t):null},t.hasClass=function(e,t){return h(e,t)},t.addClass=function(e,t){return f(e,t)},t.removeClass=function(e,t){return d(e,t)},t.removeTextNodes=function e(t,n){if(3===t.nodeType)n.removeChild(t);else if(["TABLE","THEAD","TBODY","TFOOT","TR"].indexOf(t.nodeName)>-1)for(var o=t.childNodes,r=o.length-1;r>=0;r--)e(o[r],t)},t.empty=y,t.fastInnerHTML=function(e,t){m.test(t)?e.innerHTML=t:b(e,t)},t.fastInnerText=b,t.isVisible=function e(t){var n=t;for(;l(n)!==document.documentElement;){if(null===n)return!1;if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){if(n.host){if(n.host.impl)return e(n.host.impl);if(n.host)return e(n.host);throw new Error("Lost in Web Components world")}return!1}if("none"===n.style.display)return!1;n=n.parentNode}return!0},t.offset=function(e){var t=document.documentElement,n=e,o=void 0,i=void 0,a=void 0,s=void 0;if((0,r.hasCaptionProblem)()&&n.firstChild&&"CAPTION"===n.firstChild.nodeName)return{top:(s=n.getBoundingClientRect()).top+(window.pageYOffset||t.scrollTop)-(t.clientTop||0),left:s.left+(window.pageXOffset||t.scrollLeft)-(t.clientLeft||0)};o=n.offsetLeft,i=n.offsetTop,a=n;for(;(n=n.offsetParent)&&n!==document.body;)o+=n.offsetLeft,i+=n.offsetTop,a=n;a&&"fixed"===a.style.position&&(o+=window.pageXOffset||t.scrollLeft,i+=window.pageYOffset||t.scrollTop);return{left:o,top:i}},t.getWindowScrollTop=E,t.getWindowScrollLeft=S,t.getScrollTop=function(e){if(e===window)return E();return e.scrollTop},t.getScrollLeft=function(e){if(e===window)return S();return e.scrollLeft},t.getScrollableElement=function(e){var t=["auto","scroll"],n=e.parentNode,o=void 0,r=void 0,i=void 0,a="",s="",l="",u="";for(;n&&n.style&&document.body!==n;){if(o=n.style.overflow,r=n.style.overflowX,i=n.style.overflowY,"scroll"===o||"scroll"===r||"scroll"===i)return n;if(window.getComputedStyle&&(a=window.getComputedStyle(n),s=a.getPropertyValue("overflow"),l=a.getPropertyValue("overflow-y"),u=a.getPropertyValue("overflow-x"),"scroll"===s||"scroll"===u||"scroll"===l))return n;if(n.clientHeight<=n.scrollHeight+1&&(-1!==t.indexOf(i)||-1!==t.indexOf(o)||-1!==t.indexOf(s)||-1!==t.indexOf(l)))return n;if(n.clientWidth<=n.scrollWidth+1&&(-1!==t.indexOf(r)||-1!==t.indexOf(o)||-1!==t.indexOf(s)||-1!==t.indexOf(u)))return n;n=n.parentNode}return window},t.getTrimmingContainer=function(e){var t=e.parentNode;for(;t&&t.style&&document.body!==t;){if("visible"!==t.style.overflow&&""!==t.style.overflow)return t;if(window.getComputedStyle){var n=window.getComputedStyle(t);if("visible"!==n.getPropertyValue("overflow")&&""!==n.getPropertyValue("overflow"))return t}t=t.parentNode}return window},t.getStyle=function(e,t){if(!e)return;if(e===window)return"width"===t?window.innerWidth+"px":"height"===t?window.innerHeight+"px":void 0;var n,o=e.style[t];if(""!==o&&void 0!==o)return o;if(""!==(n=O(e))[t]&&void 0!==n[t])return n[t]},t.getComputedStyle=O,t.outerWidth=function(e){return e.offsetWidth},t.outerHeight=function(e){if((0,r.hasCaptionProblem)()&&e.firstChild&&"CAPTION"===e.firstChild.nodeName)return e.offsetHeight+e.firstChild.offsetHeight;return e.offsetHeight},t.innerHeight=function(e){return e.clientHeight||e.innerHeight},t.innerWidth=function(e){return e.clientWidth||e.innerWidth},t.addEvent=function(e,t,n){window.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},t.removeEvent=function(e,t,n){window.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n)},t.getCaretPosition=function(e){if(e.selectionStart)return e.selectionStart;if(document.selection){e.focus();var t=document.selection.createRange();if(null==t)return 0;var n=e.createTextRange(),o=n.duplicate();return n.moveToBookmark(t.getBookmark()),o.setEndPoint("EndToStart",n),o.text.length}return 0},t.getSelectionEndPosition=function(e){if(e.selectionEnd)return e.selectionEnd;if(document.selection){var t=document.selection.createRange();if(null==t)return 0;var n=e.createTextRange();return n.text.indexOf(t.text)+t.text.length}return 0},t.getSelectionText=function(){var e="";window.getSelection?e=window.getSelection().toString():document.selection&&"Control"!==document.selection.type&&(e=document.selection.createRange().text);return e},t.setCaretPosition=function(e,t,n){void 0===n&&(n=t);if(e.setSelectionRange){e.focus();try{e.setSelectionRange(t,n)}catch(i){var o=e.parentNode,r=o.style.display;o.style.display="block",e.setSelectionRange(t,n),o.style.display=r}}else if(e.createTextRange){var i=e.createTextRange();i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",t),i.select()}},t.getScrollbarWidth=function(){void 0===w&&(w=function(){var e=document.createElement("div");e.style.height="200px",e.style.width="100%";var t=document.createElement("div");t.style.boxSizing="content-box",t.style.height="150px",t.style.left="0px",t.style.overflow="hidden",t.style.position="absolute",t.style.top="0px",t.style.width="200px",t.style.visibility="hidden",t.appendChild(e),(document.body||document.documentElement).appendChild(t);var n=e.offsetWidth;t.style.overflow="scroll";var o=e.offsetWidth;n==o&&(o=t.clientWidth);return(document.body||document.documentElement).removeChild(t),n-o}());return w},t.hasVerticalScrollbar=function(e){return e.offsetWidth!==e.clientWidth},t.hasHorizontalScrollbar=function(e){return e.offsetHeight!==e.clientHeight},t.setOverlayPosition=function(e,t,n){(0,o.isIE8)()||(0,o.isIE9)()?(e.style.top=n,e.style.left=t):(0,o.isSafari)()?e.style["-webkit-transform"]="translate3d("+t+","+n+",0)":e.style.transform="translate3d("+t+","+n+",0)"},t.getCssTransform=function(e){var t=void 0;if(e.style.transform&&""!==(t=e.style.transform))return["transform",t];if(e.style["-webkit-transform"]&&""!==(t=e.style["-webkit-transform"]))return["-webkit-transform",t];return-1},t.resetCssTransform=function(e){e.style.transform&&""!==e.style.transform?e.style.transform="":e.style["-webkit-transform"]&&""!==e.style["-webkit-transform"]&&(e.style["-webkit-transform"]="")},t.isInput=T,t.isOutsideInput=function(e){return T(e)&&-1==e.className.indexOf("handsontableInput")&&-1==e.className.indexOf("copyPaste")};var o=n(39),r=n(40);function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t-1||t.indexOf(o)>-1))return o;o=o.host&&o.nodeType===Node.DOCUMENT_FRAGMENT_NODE?o.host:o.parentNode}return null}function s(e){return"undefined"!=typeof Polymer&&"function"==typeof wrap?wrap(e):e}function l(e){return"undefined"!=typeof Polymer&&"function"==typeof unwrap?unwrap(e):e}var u,c=!!document.documentElement.classList,h=void 0,f=void 0,d=void 0;function p(e){var t=[];if(!e||!e.length)return t;for(var n=0;e[n];)t.push(e[n]),n+=1;return t}if(c){var g=((u=document.createElement("div")).classList.add("test","test2"),u.classList.contains("test2"));h=function(e,t){return void 0!==e.classList&&"string"==typeof t&&""!==t&&e.classList.contains(t)},f=function(e,t){var n,o=t;if("string"==typeof o&&(o=o.split(" ")),(o=p(o)).length>0)if(g)(n=e.classList).add.apply(n,i(o));else for(var r=0;o&&o[r];)e.classList.add(o[r]),r+=1},d=function(e,t){var n,o=t;if("string"==typeof o&&(o=o.split(" ")),(o=p(o)).length>0)if(g)(n=e.classList).remove.apply(n,i(o));else for(var r=0;o&&o[r];)e.classList.remove(o[r]),r+=1}}else{var v=function(e){return new RegExp("(\\s|^)"+e+"(\\s|$)")};h=function(e,t){return void 0!==e.className&&v(t).test(e.className)},f=function(e,t){var n=0,o=e.className,r=t;if("string"==typeof r&&(r=r.split(" ")),""===o)o=r.join(" ");else for(;r&&r[n];)v(r[n]).test(o)||(o+=" "+r[n]),n+=1;e.className=o},d=function(e,t){var n=0,o=e.className,r=t;for("string"==typeof r&&(r=r.split(" "));r&&r[n];)o=o.replace(v(r[n])," ").trim(),n+=1;e.className!==o&&(e.className=o)}}function y(e){for(var t=void 0;t=e.lastChild;)e.removeChild(t)}var m=t.HTML_CHARACTERS=/(<(.*)>|&(.*);)/;var w,C=!!document.createTextNode("test").textContent;function b(e,t){var n=e.firstChild;n&&3===n.nodeType&&null===n.nextSibling?C?n.textContent=t:n.data=t:(y(e),e.appendChild(document.createTextNode(t)))}function E(){var e=window.scrollY;return void 0===e&&(e=document.documentElement.scrollTop),e}function S(){var e=window.scrollX;return void 0===e&&(e=document.documentElement.scrollLeft),e}function O(e){return e.currentStyle||document.defaultView.getComputedStyle(e)}function T(e){return e&&(["INPUT","SELECT","TEXTAREA"].indexOf(e.nodeName)>-1||"true"===e.contentEditable)}},function(e,t,n){"use strict";t.__esModule=!0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.duckSchema=function e(t){var n=void 0;Array.isArray(t)?n=[]:(n={},l(t,function(t,r){"__children"!==r&&(t&&"object"===(void 0===t?"undefined":o(t))&&!Array.isArray(t)?n[r]=e(t):Array.isArray(t)?t.length&&"object"===o(t[0])&&!Array.isArray(t[0])?n[r]=[e(t[0])]:n[r]=[]:n[r]=null)}));return n},t.inherit=function(e,t){return t.prototype.constructor=t,e.prototype=new t,e.prototype.constructor=e,e},t.extend=function(e,t){return l(t,function(t,n){e[n]=t}),e},t.deepExtend=function e(t,n){l(n,function(r,i){n[i]&&"object"===o(n[i])?(t[i]||(Array.isArray(n[i])?t[i]=[]:"[object Date]"===Object.prototype.toString.call(n[i])?t[i]=n[i]:t[i]={}),e(t[i],n[i])):t[i]=n[i]})},t.deepClone=a,t.clone=function(e){var t={};return l(e,function(e,n){t[n]=e}),t},t.mixin=function(e){e.MIXINS||(e.MIXINS=[]);for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:"value",o="_"+n,r=(i(t={_touched:!1},o,e),i(t,"isTouched",function(){return this._touched}),t);return Object.defineProperty(r,n,{get:function(){return this[o]},set:function(e){this._touched=!0,this[o]=e},enumerable:!0,configurable:!0}),r},t.hasOwnProperty=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r=n(2);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){return"object"===(void 0===e?"undefined":o(e))?JSON.parse(JSON.stringify(e)):e}function s(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e,t){for(var n in e)if((!e.hasOwnProperty||e.hasOwnProperty&&Object.prototype.hasOwnProperty.call(e,n))&&!1===t(e[n],n,e))break;return e}},function(e,t,n){"use strict";function o(e,t,n,o){var r=-1,i=e,a=n;Array.isArray(e)||(i=Array.from(e));var s=i.length;for(o&&s&&(a=i[r+=1]),r+=1;rt?e:t},Array.isArray(e)?e[0]:void 0)},t.arrayMin=function(e){return o(e,function(e,t){return e0&&void 0!==arguments[0]?arguments[0]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.context=t||this,this.context.eventListeners||(this.context.eventListeners=[])}return o(e,[{key:"addEventListener",value:function(e,t,n){var o=this,r=this.context;function i(e){n.call(this,c(r,e))}return this.context.eventListeners.push({element:e,event:t,callback:n,callbackProxy:i}),window.addEventListener?e.addEventListener(t,i,!1):e.attachEvent("on"+t,i),l+=1,function(){o.removeEventListener(e,t,n)}}},{key:"removeEventListener",value:function(e,t,n){for(var o=this.context.eventListeners.length,r=void 0;o;)if(o-=1,(r=this.context.eventListeners[o]).event===t&&r.element===e){if(n&&n!==r.callback)continue;this.context.eventListeners.splice(o,1),r.element.removeEventListener?r.element.removeEventListener(r.event,r.callbackProxy,!1):r.element.detachEvent("on"+r.event,r.callbackProxy),l-=1}}},{key:"clearEvents",value:function(){if(this.context)for(var e=this.context.eventListeners.length;e;){e-=1;var t=this.context.eventListeners[e];t&&this.removeEventListener(t.element,t.event,t.callback)}}},{key:"clear",value:function(){this.clearEvents()}},{key:"destroy",value:function(){this.clearEvents(),this.context=null}},{key:"fireEvent",value:function(e,t){var n={bubbles:!0,cancelable:"mousemove"!==t,view:window,detail:0,screenX:0,screenY:0,clientX:1,clientY:1,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:void 0},o=void 0;document.createEvent?(o=document.createEvent("MouseEvents")).initMouseEvent(t,n.bubbles,n.cancelable,n.view,n.detail,n.screenX,n.screenY,n.clientX,n.clientY,n.ctrlKey,n.altKey,n.shiftKey,n.metaKey,n.button,n.relatedTarget||document.body.parentNode):o=document.createEventObject(),e.dispatchEvent?e.dispatchEvent(o):e.fireEvent("on"+t,o)}}]),e}();function c(e,t){var n=void 0,o=void 0,l=void 0,c=void 0,h=void 0;t.isTargetWebComponent=!1,t.realTarget=t.target;var f=t.stopImmediatePropagation;if(t.stopImmediatePropagation=function(){f.apply(this),(0,s.stopImmediatePropagation)(this)},!u.isHotTableEnv)return t;for(h=(t=(0,r.polymerWrap)(t)).path?t.path.length:0;h;){if(h-=1,"HOT-TABLE"===t.path[h].nodeName)n=!0;else if(n&&t.path[h].shadowRoot){c=t.path[h];break}0!==h||c||(c=t.path[h])}return c||(c=t.target),t.isTargetWebComponent=!0,(0,a.isWebComponentSupportedNatively)()?t.realTarget=t.srcElement||t.toElement:((0,i.hasOwnProperty)(e,"hot")||e.isHotTableEnv||e.wtTable)&&((0,i.hasOwnProperty)(e,"hot")?o=e.hot?e.hot.view.wt.wtTable.TABLE:null:e.isHotTableEnv?o=e.view.activeWt.wtTable.TABLE.parentNode.parentNode:e.wtTable&&(o=e.wtTable.TABLE.parentNode.parentNode),l=(0,r.closest)(t.target,["HOT-TABLE"],o),t.realTarget=l&&o.querySelector("HOT-TABLE")||t.target),Object.defineProperty(t,"target",{get:function(){return(0,r.polymerWrap)(c)},enumerable:!0,configurable:!0}),t}t.default=u},function(e,t,n){"use strict";t.__esModule=!0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.isNumeric=function(e){var t=void 0===e?"undefined":o(e);return"number"==t?!isNaN(e)&&isFinite(e):"string"==t?!!e.length&&(1==e.length?/\d/.test(e):/^\s*[+-]?\s*(?:(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?)|(?:0x[a-f\d]+))\s*$/i.test(e)):"object"==t&&!(!e||"number"!=typeof e.valueOf()||e instanceof Date)},t.rangeEach=function(e,t,n){var o=-1;"function"==typeof t?(n=t,t=e):o=e-1;for(;++o<=t&&!1!==n(o););},t.rangeEachReverse=function(e,t,n){var o=e+1;"function"==typeof t&&(n=t,t=0);for(;--o>=t&&!1!==n(o););},t.valueAccordingPercent=function(e,t){return t=parseInt(t.toString().replace("%",""),10),t=parseInt(e*t/100,10)}},function(e,t,n){"use strict";t.__esModule=!0;var o=t.CONTEXT_MENU_ITEMS_NAMESPACE="ContextMenu:items",r=(t.CONTEXTMENU_ITEMS_ROW_ABOVE=o+".insertRowAbove",t.CONTEXTMENU_ITEMS_ROW_BELOW=o+".insertRowBelow",t.CONTEXTMENU_ITEMS_INSERT_LEFT=o+".insertColumnOnTheLeft",t.CONTEXTMENU_ITEMS_INSERT_RIGHT=o+".insertColumnOnTheRight",t.CONTEXTMENU_ITEMS_REMOVE_ROW=o+".removeRow",t.CONTEXTMENU_ITEMS_REMOVE_COLUMN=o+".removeColumn",t.CONTEXTMENU_ITEMS_UNDO=o+".undo",t.CONTEXTMENU_ITEMS_REDO=o+".redo",t.CONTEXTMENU_ITEMS_READ_ONLY=o+".readOnly",t.CONTEXTMENU_ITEMS_CLEAR_COLUMN=o+".clearColumn",t.CONTEXTMENU_ITEMS_COPY=o+".copy",t.CONTEXTMENU_ITEMS_CUT=o+".cut",t.CONTEXTMENU_ITEMS_FREEZE_COLUMN=o+".freezeColumn",t.CONTEXTMENU_ITEMS_UNFREEZE_COLUMN=o+".unfreezeColumn",t.CONTEXTMENU_ITEMS_MERGE_CELLS=o+".mergeCells",t.CONTEXTMENU_ITEMS_UNMERGE_CELLS=o+".unmergeCells",t.CONTEXTMENU_ITEMS_ADD_COMMENT=o+".addComment",t.CONTEXTMENU_ITEMS_EDIT_COMMENT=o+".editComment",t.CONTEXTMENU_ITEMS_REMOVE_COMMENT=o+".removeComment",t.CONTEXTMENU_ITEMS_READ_ONLY_COMMENT=o+".readOnlyComment",t.CONTEXTMENU_ITEMS_ALIGNMENT=o+".align",t.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT=o+".align.left",t.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER=o+".align.center",t.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT=o+".align.right",t.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY=o+".align.justify",t.CONTEXTMENU_ITEMS_ALIGNMENT_TOP=o+".align.top",t.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE=o+".align.middle",t.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM=o+".align.bottom",t.CONTEXTMENU_ITEMS_BORDERS=o+".borders",t.CONTEXTMENU_ITEMS_BORDERS_TOP=o+".borders.top",t.CONTEXTMENU_ITEMS_BORDERS_RIGHT=o+".borders.right",t.CONTEXTMENU_ITEMS_BORDERS_BOTTOM=o+".borders.bottom",t.CONTEXTMENU_ITEMS_BORDERS_LEFT=o+".borders.left",t.CONTEXTMENU_ITEMS_REMOVE_BORDERS=o+".borders.remove",t.CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD=o+".nestedHeaders.insertChildRow",t.CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD=o+".nestedHeaders.detachFromParent",t.CONTEXTMENU_ITEMS_HIDE_COLUMN=o+".hideColumn",t.CONTEXTMENU_ITEMS_SHOW_COLUMN=o+".showColumn",t.CONTEXTMENU_ITEMS_HIDE_ROW=o+".hideRow",t.CONTEXTMENU_ITEMS_SHOW_ROW=o+".showRow",t.FILTERS_NAMESPACE="Filters:"),i=t.FILTERS_CONDITIONS_NAMESPACE=r+"conditions";t.FILTERS_CONDITIONS_NONE=i+".none",t.FILTERS_CONDITIONS_EMPTY=i+".isEmpty",t.FILTERS_CONDITIONS_NOT_EMPTY=i+".isNotEmpty",t.FILTERS_CONDITIONS_EQUAL=i+".isEqualTo",t.FILTERS_CONDITIONS_NOT_EQUAL=i+".isNotEqualTo",t.FILTERS_CONDITIONS_BEGINS_WITH=i+".beginsWith",t.FILTERS_CONDITIONS_ENDS_WITH=i+".endsWith",t.FILTERS_CONDITIONS_CONTAINS=i+".contains",t.FILTERS_CONDITIONS_NOT_CONTAIN=i+".doesNotContain",t.FILTERS_CONDITIONS_BY_VALUE=i+".byValue",t.FILTERS_CONDITIONS_GREATER_THAN=i+".greaterThan",t.FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL=i+".greaterThanOrEqualTo",t.FILTERS_CONDITIONS_LESS_THAN=i+".lessThan",t.FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL=i+".lessThanOrEqualTo",t.FILTERS_CONDITIONS_BETWEEN=i+".isBetween",t.FILTERS_CONDITIONS_NOT_BETWEEN=i+".isNotBetween",t.FILTERS_CONDITIONS_AFTER=i+".after",t.FILTERS_CONDITIONS_BEFORE=i+".before",t.FILTERS_CONDITIONS_TODAY=i+".today",t.FILTERS_CONDITIONS_TOMORROW=i+".tomorrow",t.FILTERS_CONDITIONS_YESTERDAY=i+".yesterday",t.FILTERS_DIVS_FILTER_BY_CONDITION=r+"labels.filterByCondition",t.FILTERS_DIVS_FILTER_BY_VALUE=r+"labels.filterByValue",t.FILTERS_LABELS_CONJUNCTION=r+"labels.conjunction",t.FILTERS_LABELS_DISJUNCTION=r+"labels.disjunction",t.FILTERS_VALUES_BLANK_CELLS=r+"values.blankCells",t.FILTERS_BUTTONS_SELECT_ALL=r+"buttons.selectAll",t.FILTERS_BUTTONS_CLEAR=r+"buttons.clear",t.FILTERS_BUTTONS_OK=r+"buttons.ok",t.FILTERS_BUTTONS_CANCEL=r+"buttons.cancel",t.FILTERS_BUTTONS_PLACEHOLDER_SEARCH=r+"buttons.placeholder.search",t.FILTERS_BUTTONS_PLACEHOLDER_VALUE=r+"buttons.placeholder.value",t.FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE=r+"buttons.placeholder.secondValue"},function(e,t,n){"use strict";t.__esModule=!0,t.getPluginName=t.getRegistredPluginNames=t.getPlugin=t.registerPlugin=void 0;var o,r=n(16),i=(o=r)&&o.__esModule?o:{default:o},a=n(1),s=n(33);var l=new WeakMap;t.registerPlugin=function(e,t){var n=(0,s.toUpperCaseFirst)(e);i.default.getSingleton().add("construct",function(){l.has(this)||l.set(this,{});var e=l.get(this);e[n]||(e[n]=new t(this))}),i.default.getSingleton().add("afterDestroy",function(){if(l.has(this)){var e=l.get(this);(0,a.objectEach)(e,function(e){return e.destroy()}),l.delete(this)}})},t.getPlugin=function(e,t){if("string"!=typeof t)throw Error('Only strings can be passed as "plugin" parameter');var n=(0,s.toUpperCaseFirst)(t);if(l.has(e)&&l.get(e)[n])return l.get(e)[n]},t.getRegistredPluginNames=function(e){return l.has(e)?Object.keys(l.get(e)):[]},t.getPluginName=function(e,t){var n=null;return l.has(e)&&(0,a.objectEach)(l.get(e),function(e,o){e===t&&(n=o)}),n}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){"use strict";t.__esModule=!0;var o=function(){function e(e,t){for(var n=0;n=0&&u.splice(u.indexOf(this.pluginName),1),u.length||this.hot.runHooks("afterPluginsInitialized"),this.initialized=!0}},{key:"enablePlugin",value:function(){this.enabled=!0}},{key:"disablePlugin",value:function(){this.eventManager&&this.eventManager.clear(),this.clearHooks(),this.enabled=!1}},{key:"addHook",value:function(e,t){l.get(this).hooks[e]=l.get(this).hooks[e]||[];var n=l.get(this).hooks[e];this.hot.addHook(e,t),n.push(t),l.get(this).hooks[e]=n}},{key:"removeHooks",value:function(e){var t=this;(0,i.arrayEach)(l.get(this).hooks[e]||[],function(n){t.hot.removeHook(e,n)})}},{key:"clearHooks",value:function(){var e=this,t=l.get(this).hooks;(0,r.objectEach)(t,function(t,n){return e.removeHooks(n)}),t.length=0}},{key:"callOnPluginsReady",value:function(e){this.isPluginsReady?e():this.pluginsInitializedCallbacks.push(e)}},{key:"onAfterPluginsInitialized",value:function(){(0,i.arrayEach)(this.pluginsInitializedCallbacks,function(e){return e()}),this.pluginsInitializedCallbacks.length=0,this.isPluginsReady=!0}},{key:"onUpdateSettings",value:function(){this.isEnabled&&(this.enabled&&!this.isEnabled()&&this.disablePlugin(),!this.enabled&&this.isEnabled()&&this.enablePlugin(),this.enabled&&this.isEnabled()&&this.updatePlugin())}},{key:"updatePlugin",value:function(){}},{key:"destroy",value:function(){var e=this;this.eventManager&&this.eventManager.destroy(),this.clearHooks(),(0,r.objectEach)(this,function(t,n){"hot"!==n&&"t"!==n&&(e[n]=null)}),delete this.t,delete this.hot}}]),e}();t.default=c},function(e,t,n){"use strict";t.__esModule=!0;var o,r,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=(o=["\n Your license key of Handsontable Pro has expired.‌‌‌‌ \n Renew your maintenance plan at https://handsontable.com or downgrade to the previous version of the software.\n "],r=["\n Your license key of Handsontable Pro has expired.‌‌‌‌ \n Renew your maintenance plan at https://handsontable.com or downgrade to the previous version of the software.\n "],Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(r)}})));t.stringify=function(e){var t=void 0;switch(void 0===e?"undefined":i(e)){case"string":case"number":t=""+e;break;case"object":t=null===e?"":e.toString();break;case"undefined":t="";break;default:t=e.toString()}return t},t.isDefined=function(e){return void 0!==e},t.isUndefined=h,t.isEmpty=f,t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t._injectProductInfo=function(e,t){e=m(e||"");var n="",o=!0,r=function(e){var t=[][d],n=t;if(e[d]!==y("Z"))return!1;for(var o="",r="B>1:o=v(e,i,i?1===r[d]?9:8:6);return n===t}(e),i=C(),s=f(e)||"trial"===e;if(s||r)if(r){var l=Math.floor((0,u.default)("12/09/2018","DD/MM/YYYY").toDate().getTime()/864e5),h=w(e);(h>45e3||h!==parseInt(h,10))&&(n="The license key provided to Handsontable Pro is invalid. Make sure you pass it correctly."),n||(l>h+1&&(n=(0,c.toSingleLine)(a)),o=l>h+15)}else n="Evaluation version of Handsontable Pro. Not licensed for use in a production environment.";else n="The license key provided to Handsontable Pro is invalid. Make sure you pass it correctly.";i&&(n=!1,o=!1);n&&!b&&(console[s?"info":"warn"](n),b=!0);if(o&&t.parentNode){var E=document.createElement("div");E.id="hot-display-license-info",E.appendChild(document.createTextNode("Evaluation version of Handsontable Pro.")),E.appendChild(document.createElement("br")),E.appendChild(document.createTextNode("Not licensed for production use.")),t.parentNode.insertBefore(E,t.nextSibling)}};var s,l=n(57),u=(s=l)&&s.__esModule?s:{default:s},c=n(42);function h(e){return void 0===e}function f(e){return null===e||""===e||h(e)}var d="length",p=function(e){return parseInt(e,16)},g=function(e){return parseInt(e,10)},v=function(e,t,n){return e.substr(t,n)},y=function(e){return e.codePointAt(0)-65},m=function(e){return(""+e).replace(/\-/g,"")},w=function(e){return p(v(m(e),p("12"),y("F")))/(p(v(m(e),y("B"),~~![][d]))||9)},C=function(){return"undefined"!=typeof location&&/^([a-z0-9\-]+\.)?\x68\x61\x6E\x64\x73\x6F\x6E\x74\x61\x62\x6C\x65\x2E\x63\x6F\x6D$/i.test(location.host)},b=!1},function(e,t,n){var o=n(79)("wks"),r=n(50),i=n(15).Symbol,a="function"==typeof i;(e.exports=function(e){return o[e]||(o[e]=a&&i[e]||(a?i:r)("Symbol."+e))}).store=o},function(e,t,n){"use strict";t.__esModule=!0,t.stopImmediatePropagation=function(e){e.isImmediatePropagationEnabled=!1,e.cancelBubble=!0},t.isImmediatePropagationStopped=function(e){return!1===e.isImmediatePropagationEnabled},t.stopPropagation=function(e){"function"==typeof e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},t.pageX=function(e){if(e.pageX)return e.pageX;return e.clientX+(0,o.getWindowScrollLeft)()},t.pageY=function(e){if(e.pageY)return e.pageY;return e.clientY+(0,o.getWindowScrollTop)()},t.isRightClick=function(e){return 2===e.button},t.isLeftClick=function(e){return 0===e.button};var o=n(0)},function(e,t,n){"use strict";t.__esModule=!0,t.getRegisteredRenderers=t.getRegisteredRendererNames=t.hasRenderer=t.getRenderer=t.registerRenderer=void 0;var o=h(n(38)),r=h(n(243)),i=h(n(244)),a=h(n(245)),s=h(n(246)),l=h(n(247)),u=h(n(249)),c=h(n(250));function h(e){return e&&e.__esModule?e:{default:e}}var f=(0,o.default)("renderers"),d=f.register,p=f.getItem,g=f.hasItem,v=f.getNames,y=f.getValues;d("base",r.default),d("autocomplete",i.default),d("checkbox",a.default),d("html",s.default),d("numeric",l.default),d("password",u.default),d("text",c.default),t.registerRenderer=d,t.getRenderer=function(e){if("function"==typeof e)return e;if(!g(e))throw Error('No registered renderer found under "'+e+'" name');return p(e)},t.hasRenderer=g,t.getRegisteredRendererNames=v,t.getRegisteredRenderers=y},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";t.__esModule=!0;var o=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null;return e?(e.pluginHookBucket||(e.pluginHookBucket=this.createEmptyBucket()),e.pluginHookBucket):this.globalBucket}},{key:"add",value:function(e,t){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(Array.isArray(t))(0,r.arrayEach)(t,function(t){return n.add(e,t,o)});else{var i=this.getBucket(o);if(void 0===i[e]&&(this.register(e),i[e]=[]),t.skip=!1,-1===i[e].indexOf(t)){var a=!1;t.initialHook&&(0,r.arrayEach)(i[e],function(n,o){if(n.initialHook)return i[e][o]=t,a=!0,!1}),a||i[e].push(t)}}return this}},{key:"once",value:function(e,t){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Array.isArray(t)?(0,r.arrayEach)(t,function(t){return n.once(e,t,o)}):(t.runOnce=!0,this.add(e,t,o))}},{key:"remove",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=this.getBucket(n);return void 0!==o[e]&&o[e].indexOf(t)>=0&&(t.skip=!0,!0)}},{key:"has",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.getBucket(t);return!(void 0===n[e]||!n[e].length)}},{key:"run",value:function(e,t,n,o,r,i,a,s){var l=this.globalBucket[t],u=l?l.length:0,c=0;if(u)for(;c0&&void 0!==arguments[0]?arguments[0]:null;(0,i.objectEach)(this.getBucket(e),function(e,t,n){return n[t].length=0})}},{key:"register",value:function(e){this.isRegistered(e)||a.push(e)}},{key:"deregister",value:function(e){this.isRegistered(e)&&a.splice(a.indexOf(e),1)}},{key:"isRegistered",value:function(e){return a.indexOf(e)>=0}},{key:"getRegistered",value:function(){return a}}]),e}(),l=new s;t.default=s},function(e,t,n){"use strict";t.__esModule=!0,t.getRegisteredEditors=t.getRegisteredEditorNames=t.hasEditor=t.getEditorInstance=t.getEditor=t.registerEditor=void 0,t.RegisteredEditor=S,t._getEditorInstance=O;var o=g(n(38)),r=g(n(16)),i=g(n(55)),a=g(n(190)),s=g(n(235)),l=g(n(236)),u=g(n(239)),c=g(n(191)),h=g(n(240)),f=g(n(241)),d=g(n(242)),p=g(n(59));function g(e){return e&&e.__esModule?e:{default:e}}var v=new WeakMap,y=(0,o.default)("editors"),m=y.register,w=y.getItem,C=y.hasItem,b=y.getNames,E=y.getValues;function S(e){var t={},n=e;this.getConstructor=function(){return e},this.getInstance=function(e){return e.guid in t||(t[e.guid]=new n(e)),t[e.guid]},r.default.getSingleton().add("afterDestroy",function(){t[this.guid]=null})}function O(e,t){var n=void 0;if("function"==typeof e)v.get(e)||T(null,e),n=v.get(e);else{if("string"!=typeof e)throw Error('Only strings and functions can be passed as "editor" parameter');n=w(e)}if(!n)throw Error('No editor registered under name "'+e+'"');return n.getInstance(t)}function T(e,t){var n=new S(t);"string"==typeof e&&m(e,n),v.set(t,n)}T("base",i.default),T("autocomplete",a.default),T("checkbox",s.default),T("date",l.default),T("dropdown",u.default),T("handsontable",c.default),T("numeric",h.default),T("password",f.default),T("select",d.default),T("text",p.default),t.registerEditor=T,t.getEditor=function(e){if(!C(e))throw Error('No registered editor found under "'+e+'" name');return w(e).getConstructor()},t.getEditorInstance=O,t.hasEditor=C,t.getRegisteredEditorNames=b,t.getRegisteredEditors=E},function(e,t,n){var o=n(9);e.exports=function(e){if(!o(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){"use strict";t.__esModule=!0,t.normalizeSelection=function(e){return(0,o.arrayMap)(e,function(e){return{start:e.getTopLeftCorner(),end:e.getBottomRightCorner()}})},t.isSeparator=function(e){return(0,r.hasClass)(e,"htSeparator")},t.hasSubMenu=function(e){return(0,r.hasClass)(e,"htSubmenu")},t.isDisabled=function(e){return(0,r.hasClass)(e,"htDisabled")},t.isSelectionDisabled=function(e){return(0,r.hasClass)(e,"htSelectionDisabled")},t.getValidSelection=function(e){var t=e.getSelected();if(!t)return null;if(t[0]<0)return null;return t},t.prepareVerticalAlignClass=a,t.prepareHorizontalAlignClass=s,t.getAlignmentClasses=function(e,t){var n={};return(0,o.arrayEach)(e,function(e){for(var o=e.from,r=e.to,i=o.row;i<=r.row;i++)for(var a=o.col;a<=r.col;a++)n[i]||(n[i]=[]),n[i][a]=t(i,a)}),n},t.align=function(e,t,n,r,i){(0,o.arrayEach)(e,function(e){var o=e.from,a=e.to;if(o.row===a.row&&o.col===a.col)l(o.row,o.col,t,n,r,i);else for(var s=o.row;s<=a.row;s++)for(var u=o.col;u<=a.col;u++)l(s,u,t,n,r,i)})},t.checkSelectionConsistency=function(e,t){var n=!1;Array.isArray(e)&&(0,o.arrayEach)(e,function(e){return e.forAll(function(e,o){if(t(e,o))return n=!0,!1}),n});return n},t.markLabelAsSelected=function(e){return''+String.fromCharCode(10003)+""+e},t.isItemHidden=function(e,t){return!e.hidden||!("function"==typeof e.hidden&&e.hidden.call(t))},t.filterSeparators=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.KEY,n=e.slice(0);return n=function(e){var t=[];return(0,o.arrayEach)(e,function(e,n){n>0?t[t.length-1].name!==e.name&&t.push(e):t.push(e)}),t}(n=function(e,t){var n=e.slice(0);return n.reverse(),(n=u(n,t)).reverse(),n}(n=u(n,t),t))};var o=n(2),r=n(0),i=n(95);function a(e,t){return-1!==e.indexOf(t)?e:e.replace("htTop","").replace("htMiddle","").replace("htBottom","").replace(" ","")+" "+t}function s(e,t){return-1!==e.indexOf(t)?e:e.replace("htLeft","").replace("htCenter","").replace("htRight","").replace("htJustify","").replace(" ","")+" "+t}function l(e,t,n,o,r,i){var l=r(e,t),u=o;l.className&&(u="vertical"===n?a(l.className,o):s(l.className,o)),i(e,t,"className",u)}function u(e,t){for(var n=e.slice(0);0=48&&e<=57||e>=96&&e<=111||e>=186&&e<=192||e>=219&&e<=222||e>=226||e>=65&&e<=90},t.isMetaKey=function(e){return-1!==[r.ARROW_DOWN,r.ARROW_UP,r.ARROW_LEFT,r.ARROW_RIGHT,r.HOME,r.END,r.DELETE,r.BACKSPACE,r.F1,r.F2,r.F3,r.F4,r.F5,r.F6,r.F7,r.F8,r.F9,r.F10,r.F11,r.F12,r.TAB,r.PAGE_DOWN,r.PAGE_UP,r.ENTER,r.ESCAPE,r.SHIFT,r.CAPS_LOCK,r.ALT].indexOf(e)},t.isCtrlKey=function(e){var t=[];window.navigator.platform.includes("Mac")?t.push(r.COMMAND_LEFT,r.COMMAND_RIGHT,r.COMMAND_FIREFOX):t.push(r.CONTROL);return t.includes(e)},t.isCtrlMetaKey=function(e){return[r.CONTROL,r.COMMAND_LEFT,r.COMMAND_RIGHT,r.COMMAND_FIREFOX].includes(e)},t.isKey=function(e,t){var n=t.split("|"),i=!1;return(0,o.arrayEach)(n,function(t){if(e===r[t])return i=!0,!1}),i};var o=n(2),r=t.KEY_CODES={MOUSE_LEFT:1,MOUSE_RIGHT:3,MOUSE_MIDDLE:2,BACKSPACE:8,COMMA:188,INSERT:45,DELETE:46,END:35,ENTER:13,ESCAPE:27,CONTROL:17,COMMAND_LEFT:91,COMMAND_RIGHT:93,COMMAND_FIREFOX:224,ALT:18,HOME:36,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,SPACE:32,SHIFT:16,CAPS_LOCK:20,TAB:9,ARROW_RIGHT:39,ARROW_LEFT:37,ARROW_UP:38,ARROW_DOWN:40,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,A:65,X:88,C:67,V:86}},function(e,t,n){e.exports=!n(23)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var o=n(77),r=n(36);e.exports=function(e){return o(r(e))}},function(e,t,n){var o=n(60),r=Math.min;e.exports=function(e){return e>0?r(o(e),9007199254740991):0}},function(e,t,n){var o=n(3),r=n(37),i=n(23);e.exports=function(e,t){var n=(r.Object||{})[e]||Object[e],a={};a[e]=t(n),o(o.S+o.F*i(function(){n(1)}),"Object",a)}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var o=n(15),r=n(29),i=n(27),a=n(50)("src"),s=Function.toString,l=(""+s).split("toString");n(37).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,n,s){var u="function"==typeof n;u&&(i(n,"name")||r(n,"name",t)),e[t]!==n&&(u&&(i(n,a)||r(n,a,e[t]?""+e[t]:l.join(String(t)))),e===o?e[t]=n:s?e[t]?e[t]=n:r(e,t,n):(delete e[t],r(e,t,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[a]||s.call(this)})},function(e,t,n){var o=n(20),r=n(51);e.exports=n(22)?function(e,t,n){return o.f(e,t,r(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var o=n(63);e.exports=function(e,t,n){if(o(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,o){return e.call(t,n,o)};case 3:return function(n,o,r){return e.call(t,n,o,r)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var o=n(36);e.exports=function(e){return Object(o(e))}},function(e,t,n){var o=n(50)("meta"),r=n(9),i=n(27),a=n(20).f,s=0,l=Object.isExtensible||function(){return!0},u=!n(23)(function(){return l(Object.preventExtensions({}))}),c=function(e){a(e,o,{value:{i:"O"+ ++s,w:{}}})},h=e.exports={KEY:o,NEED:!1,fastKey:function(e,t){if(!r(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,o)){if(!l(e))return"F";if(!t)return"E";c(e)}return e[o].i},getWeak:function(e,t){if(!i(e,o)){if(!l(e))return!0;if(!t)return!1;c(e)}return e[o].w},onFreeze:function(e){return u&&h.NEED&&l(e)&&!i(e,o)&&c(e),e}}},function(e,t,n){"use strict";t.__esModule=!0,t.toUpperCaseFirst=function(e){return e[0].toUpperCase()+e.substr(1)},t.equalsIgnoreCase=function(){for(var e=[],t=arguments.length,n=Array(t),r=0;r1&&void 0!==arguments[1]?arguments[1]:{};return(""+e).replace(/(?:\\)?\[([^[\]]+)]/g,function(e,n){return"\\"===e.charAt(0)?e.substr(1,e.length-1):void 0===t[n]?"":t[n]})},t.stripTags=function(e){return(""+e).replace(r,"")};var o=n(11);var r=/<\/?\w+\/?>|<\w+[\s|\/][^>]*>/gi},function(e,t,n){"use strict";t.__esModule=!0,t.getRegisteredValidators=t.getRegisteredValidatorNames=t.hasValidator=t.getValidator=t.registerValidator=void 0;var o=l(n(38)),r=l(n(251)),i=l(n(252)),a=l(n(253)),s=l(n(254));function l(e){return e&&e.__esModule?e:{default:e}}var u=(0,o.default)("validators"),c=u.register,h=u.getItem,f=u.hasItem,d=u.getNames,p=u.getValues;c("autocomplete",r.default),c("date",i.default),c("numeric",a.default),c("time",s.default),t.registerValidator=c,t.getValidator=function(e){if("function"==typeof e)return e;if(!f(e))throw Error('No registered validator found under "'+e+'" name');return h(e)},t.hasValidator=f,t.getRegisteredValidatorNames=d,t.getRegisteredValidators=p},function(e,t,n){var o=n(101),r=n(80);e.exports=Object.keys||function(e){return o(e,r)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){var n=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(e,t,n){"use strict";function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:"common";r.has(e)||r.set(e,new Map);var t=r.get(e);return{register:function(e,n){t.set(e,n)},getItem:function(e){return t.get(e)},hasItem:function(e){return t.has(e)},getNames:function(){return[].concat(o(t.keys()))},getValues:function(){return[].concat(o(t.values()))}}};var r=t.collection=new Map},function(e,t,n){"use strict";t.__esModule=!0,t.setBrowserMeta=a,t.isChrome=function(){return i.chrome.value},t.isEdge=function(){return i.edge.value},t.isIE=function(){return i.ie.value},t.isIE8=function(){return i.ie8.value},t.isIE9=function(){return i.ie9.value},t.isMSBrowser=function(){return i.ie.value||i.edge.value},t.isMobileBrowser=function(){return i.mobile.value},t.isSafari=function(){return i.safari.value};var o=n(1),r=function(e){var t={value:!1,test:function(n,o){t.value=e(n,o)}};return t},i={chrome:r(function(e,t){return/Chrome/.test(e)&&/Google/.test(t)}),edge:r(function(e){return/Edge/.test(e)}),ie:r(function(e){return/Trident/.test(e)}),ie8:r(function(){return!document.createTextNode("test").textContent}),ie9:r(function(){return!!document.documentMode}),mobile:r(function(e){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e)}),safari:r(function(e,t){return/Safari/.test(e)&&/Apple Computer/.test(t)})};function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.userAgent,n=void 0===t?navigator.userAgent:t,r=e.vendor,a=void 0===r?navigator.vendor:r;(0,o.objectEach)(i,function(e){(0,e.test)(n,a)})}a()},function(e,t,n){"use strict";t.__esModule=!0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.requestAnimationFrame=function(e){return a.call(window,e)},t.cancelAnimationFrame=function(e){s.call(window,e)},t.isTouchSupported=function(){return"ontouchstart"in window},t.isWebComponentSupportedNatively=function(){var e=document.createElement("div");return!(!e.createShadowRoot||!e.createShadowRoot.toString().match(/\[native code\]/))},t.hasCaptionProblem=function(){void 0===u&&function(){var e=document.createElement("TABLE");e.style.borderSpacing=0,e.style.borderWidth=0,e.style.padding=0;var t=document.createElement("TBODY");e.appendChild(t),t.appendChild(document.createElement("TR")),t.firstChild.appendChild(document.createElement("TD")),t.firstChild.firstChild.innerHTML="t
    t";var n=document.createElement("CAPTION");n.innerHTML="c
    c
    c
    c",n.style.padding=0,n.style.margin=0,e.insertBefore(n,t),document.body.appendChild(e),u=e.offsetHeight<2*e.lastChild.offsetHeight,document.body.removeChild(e)}();return u},t.getComparisonFunction=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(c)return c;c="object"===("undefined"==typeof Intl?"undefined":o(Intl))?new Intl.Collator(e,t).compare:"function"==typeof String.prototype.localeCompare?function(e,t){return(""+e).localeCompare(t)}:function(e,t){return e===t?0:e>t?-1:1};return c};for(var r=0,i=["ms","moz","webkit","o"],a=window.requestAnimationFrame,s=window.cancelAnimationFrame,l=0;l0&&void 0!==arguments[0]&&arguments[0],t=this.shouldBeRendered();this.clone&&(this.needFullRender||t)&&this.clone.draw(e),this.needFullRender=t}},{key:"reset",value:function(){if(this.clone){var e=this.clone.wtTable.holder,t=this.clone.wtTable.hider,n=e.style,o=t.style,r=e.parentNode.style;(0,a.arrayEach)([n,o,r],function(e){e.width="",e.height=""})}}},{key:"destroy",value:function(){new s.default(this.clone).destroy()}}]),e}();t.default=h},function(e,t,n){"use strict";t.__esModule=!0,t.toSingleLine=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:200,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,o=r(e,t),i=n;function a(){for(var t=arguments.length,n=Array(t),r=0;r1&&void 0!==arguments[1]?arguments[1]:200,n=null,o=void 0;return function(){for(var r=this,i=arguments.length,a=Array(i),s=0;s1?t-1:0),o=1;o=t?e.apply(this,s):n(s)}}([])},t.curryRight=function(e){var t=e.length;return function n(o){return function(){for(var r=arguments.length,i=Array(r),a=0;a=t?e.apply(this,s):n(s)}}([])};var o=n(2);function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,n=0,o={lastCallThrottled:!0},r=null;return function(){for(var i=this,a=arguments.length,s=Array(a),l=0;l1?n-1:0),i=1;i'+String.fromCharCode(10003)+""+e};var o=n(1),r=n(2);function i(e,t){return"border_row"+e+"col"+t}function a(){return{width:1,color:"#000"}}function s(){return{hide:!0}}function l(){return{width:1,color:"#000",cornerVisible:!1}}},function(e,t){e.exports=!1},function(e,t){var n=0,o=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+o).toString(36))}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){e.exports={}},function(e,t,n){var o=n(20).f,r=n(27),i=n(12)("toStringTag");e.exports=function(e,t,n){e&&!r(e=n?e:e.prototype,i)&&o(e,i,{configurable:!0,value:t})}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){"use strict";t.__esModule=!0,t.EditorState=void 0;var o=n(4),r=n(11),i=t.EditorState={VIRGIN:"STATE_VIRGIN",EDITING:"STATE_EDITING",WAITING:"STATE_WAITING",FINISHED:"STATE_FINISHED"};function a(e){this.instance=e,this.state=i.VIRGIN,this._opened=!1,this._fullEditMode=!1,this._closeCallback=null,this.init()}a.prototype._fireCallbacks=function(e){this._closeCallback&&(this._closeCallback(e),this._closeCallback=null)},a.prototype.init=function(){},a.prototype.getValue=function(){throw Error("Editor getValue() method unimplemented")},a.prototype.setValue=function(){throw Error("Editor setValue() method unimplemented")},a.prototype.open=function(){throw Error("Editor open() method unimplemented")},a.prototype.close=function(){throw Error("Editor close() method unimplemented")},a.prototype.prepare=function(e,t,n,o,r,a){this.TD=o,this.row=e,this.col=t,this.prop=n,this.originalValue=r,this.cellProperties=a,this.state=i.VIRGIN},a.prototype.extend=function(){var e=this.constructor;return function(e,t){function n(){}return n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e,e}(function(){for(var t=arguments.length,n=Array(t),o=0;on[2]&&(o=n[0],n[0]=n[2],n[2]=o),n[1]>n[3]&&(o=n[1],n[1]=n[3],n[3]=o)):n=[this.row,this.col,null,null],this.instance.populateFromArray(n[0],n[1],e,n[2],n[3],"edit")},a.prototype.beginEditing=function(e,t){if(this.state===i.VIRGIN){if(this.instance.view.scrollViewport(new o.CellCoords(this.row,this.col)),this.state=i.EDITING,this.isInFullEditMode()){var n="string"==typeof e?e:(0,r.stringify)(this.originalValue);this.setValue(n)}this.open(t),this._opened=!0,this.focus(),this.instance.view.render(),this.instance.runHooks("afterBeginEditing",this.row,this.col)}},a.prototype.finishEditing=function(e,t,n){var o=this,r=void 0;if(n){var a=this._closeCallback;this._closeCallback=function(e){a&&a(e),n(e),o.instance.view.render()}}if(!this.isWaiting())if(this.state!==i.VIRGIN){if(this.state===i.EDITING){if(e)return this.cancelChanges(),void this.instance.view.render();var s=this.getValue();r=this.instance.getSettings().trimWhitespace?[["string"==typeof s?String.prototype.trim.call(s||""):s]]:[[s]],this.state=i.WAITING,this.saveValue(r,t),this.instance.getCellValidator(this.cellProperties)?this.instance.addHookOnce("postAfterValidate",function(e){o.state=i.FINISHED,o.discardEditor(e)}):(this.state=i.FINISHED,this.discardEditor(!0))}}else this.instance._registerTimeout(function(){o._fireCallbacks(!0)})},a.prototype.cancelChanges=function(){this.state=i.FINISHED,this.discardEditor()},a.prototype.discardEditor=function(e){this.state===i.FINISHED&&(!1===e&&!0!==this.cellProperties.allowInvalid?(this.instance.selectCell(this.row,this.col),this.focus(),this.state=i.EDITING,this._fireCallbacks(!1)):(this.close(),this._opened=!1,this._fullEditMode=!1,this.state=i.VIRGIN,this._fireCallbacks(!0)))},a.prototype.enableFullEditMode=function(){this._fullEditMode=!0},a.prototype.isInFullEditMode=function(){return this._fullEditMode},a.prototype.isOpened=function(){return this._opened},a.prototype.isWaiting=function(){return this.state===i.WAITING},a.prototype.checkEditorSection=function(){var e=this.instance.countRows(),t="";return this.row=e-this.instance.getSettings().fixedRowsBottom?t=this.col=e.getSetting("totalRows")||this.col>=e.getSetting("totalColumns"))}},{key:"isEqual",value:function(e){return e===this||this.row===e.row&&this.col===e.col}},{key:"isSouthEastOf",value:function(e){return this.row>=e.row&&this.col>=e.col}},{key:"isNorthWestOf",value:function(e){return this.row<=e.row&&this.col<=e.col}},{key:"isSouthWestOf",value:function(e){return this.row>=e.row&&this.col<=e.col}},{key:"isNorthEastOf",value:function(e){return this.row<=e.row&&this.col>=e.col}},{key:"toObject",value:function(){return{row:this.row,col:this.col}}}]),e}();t.default=r},function(t,n){t.exports=e},function(e,t,n){"use strict";t.__esModule=!0,t.log=function(){var e;(0,o.isDefined)(console)&&(e=console).log.apply(e,arguments)},t.warn=function(){var e;(0,o.isDefined)(console)&&(e=console).warn.apply(e,arguments)},t.info=function(){var e;(0,o.isDefined)(console)&&(e=console).info.apply(e,arguments)},t.error=function(){var e;(0,o.isDefined)(console)&&(e=console).error.apply(e,arguments)};var o=n(11)},function(e,t,n){"use strict";t.__esModule=!0;var o=n(0),r=c(n(234)),i=n(55),a=c(i),s=c(n(5)),l=n(21),u=n(13);function c(e){return e&&e.__esModule?e:{default:e}}var h=a.default.prototype.extend();h.prototype.init=function(){var e=this;this.createElements(),this.eventManager=new s.default(this),this.bindEvents(),this.autoResize=(0,r.default)(),this.holderZIndex=-1,this.instance.addHook("afterDestroy",function(){e.destroy()})},h.prototype.prepare=function(e,t,n,o,r,s){for(var l=this,u=this.state,c=arguments.length,h=Array(c>6?c-6:0),f=6;f=0?this.holderZIndex:"",this.textareaParentStyle.position=""},h.prototype.getValue=function(){return this.TEXTAREA.value},h.prototype.setValue=function(e){this.TEXTAREA.value=e},h.prototype.beginEditing=function(){if(this.state===i.EditorState.VIRGIN){this.TEXTAREA.value="";for(var e=arguments.length,t=Array(e),n=0;n0&&void 0!==arguments[0]&&arguments[0];if(this.state===i.EditorState.EDITING||e)if(this.TD=this.getEditedCell(),this.TD){var t=(0,o.offset)(this.TD),n=(0,o.offset)(this.instance.rootElement),r=this.instance.view.wt.wtOverlays.topOverlay.mainTableScrollableElement,a=this.instance.countRows(),s=r!==window?r.scrollTop:0,l=r!==window?r.scrollLeft:0,u=this.checkEditorSection(),c=["","left"].includes(u)?s:0,h=["","top","bottom"].includes(u)?l:0,f=t.top===n.top?0:1,d=this.instance.getSettings(),p=this.instance.hasColHeaders(),g=this.TD.style.backgroundColor,v=t.top-n.top-f-c,y=t.left-n.left-1-h,m=void 0;switch(u){case"top":m=(0,o.getCssTransform)(this.instance.view.wt.wtOverlays.topOverlay.clone.wtTable.holder.parentNode);break;case"left":m=(0,o.getCssTransform)(this.instance.view.wt.wtOverlays.leftOverlay.clone.wtTable.holder.parentNode);break;case"top-left-corner":m=(0,o.getCssTransform)(this.instance.view.wt.wtOverlays.topLeftCornerOverlay.clone.wtTable.holder.parentNode);break;case"bottom-left-corner":m=(0,o.getCssTransform)(this.instance.view.wt.wtOverlays.bottomLeftCornerOverlay.clone.wtTable.holder.parentNode);break;case"bottom":m=(0,o.getCssTransform)(this.instance.view.wt.wtOverlays.bottomOverlay.clone.wtTable.holder.parentNode)}(p&&0===this.instance.getSelectedLast()[0]||d.fixedRowsBottom&&this.instance.getSelectedLast()[0]===a-d.fixedRowsBottom)&&(v+=1),0===this.instance.getSelectedLast()[1]&&(y+=1),m&&-1!==m?this.textareaParentStyle[m[0]]=m[1]:(0,o.resetCssTransform)(this.TEXTAREA_PARENT),this.textareaParentStyle.top=v+"px",this.textareaParentStyle.left=y+"px",this.showEditableElement();var w=this.instance.view.wt.wtViewport.rowsRenderCalculator.startPosition,C=this.instance.view.wt.wtViewport.columnsRenderCalculator.startPosition,b=this.instance.view.wt.wtOverlays.leftOverlay.getScrollPosition(),E=this.instance.view.wt.wtOverlays.topOverlay.getScrollPosition(),S=(0,o.getScrollbarWidth)(),O=this.TD.offsetTop+w-E,T=this.TD.offsetLeft+C-b,_=(0,o.innerWidth)(this.TD)-8,R=(0,o.hasVerticalScrollbar)(r)?S:0,k=(0,o.hasHorizontalScrollbar)(r)?S:0,M=this.instance.view.maximumVisibleElementWidth(T)-9-R,A=this.TD.scrollHeight+1,N=Math.max(this.instance.view.maximumVisibleElementHeight(O)-k,23),P=(0,o.getComputedStyle)(this.TD);this.TEXTAREA.style.fontSize=P.fontSize,this.TEXTAREA.style.fontFamily=P.fontFamily,this.TEXTAREA.style.backgroundColor=g||(0,o.getComputedStyle)(this.TEXTAREA).backgroundColor,this.autoResize.init(this.TEXTAREA,{minHeight:Math.min(A,N),maxHeight:N,minWidth:Math.min(_,M),maxWidth:M},!0)}else e||this.close(!0)},h.prototype.bindEvents=function(){var e=this;this.eventManager.addEventListener(this.TEXTAREA,"cut",function(e){(0,u.stopPropagation)(e)}),this.eventManager.addEventListener(this.TEXTAREA,"paste",function(e){(0,u.stopPropagation)(e)}),this.instance.addHook("afterScrollHorizontally",function(){e.refreshDimensions()}),this.instance.addHook("afterScrollVertically",function(){e.refreshDimensions()}),this.instance.addHook("afterColumnResize",function(){e.refreshDimensions(),e.focus()}),this.instance.addHook("afterRowResize",function(){e.refreshDimensions(),e.focus()}),this.instance.addHook("afterDestroy",function(){e.eventManager.destroy()})},h.prototype.destroy=function(){this.eventManager.destroy()},t.default=h},function(e,t){var n=Math.ceil,o=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?o:n)(e)}},function(e,t,n){var o=n(60),r=Math.max,i=Math.min;e.exports=function(e,t){return(e=o(e))<0?r(e+t,0):i(e,t)}},function(e,t,n){var o=n(28);e.exports=function(e,t,n){for(var r in t)o(e,r,t[r],n);return e}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(e,t,n,o){if(!(e instanceof t)||void 0!==o&&o in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var o=n(30),r=n(104),i=n(105),a=n(18),s=n(25),l=n(106),u={},c={};(t=e.exports=function(e,t,n,h,f){var d,p,g,v,y=f?function(){return e}:l(e),m=o(n,h,t?2:1),w=0;if("function"!=typeof y)throw TypeError(e+" is not iterable!");if(i(y)){for(d=s(e.length);d>w;w++)if((v=t?m(a(p=e[w])[0],p[1]):m(e[w]))===u||v===c)return v}else for(g=y.call(e);!(p=g.next()).done;)if((v=r(g,m,p.value,t))===u||v===c)return v}).BREAK=u,t.RETURN=c},function(e,t,n){"use strict";var o=n(15),r=n(3),i=n(28),a=n(62),s=n(32),l=n(65),u=n(64),c=n(9),h=n(23),f=n(81),d=n(53),p=n(210);e.exports=function(e,t,n,g,v,y){var m=o[e],w=m,C=v?"set":"add",b=w&&w.prototype,E={},S=function(e){var t=b[e];i(b,e,"delete"==e?function(e){return!(y&&!c(e))&&t.call(this,0===e?0:e)}:"has"==e?function(e){return!(y&&!c(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return y&&!c(e)?void 0:t.call(this,0===e?0:e)}:"add"==e?function(e){return t.call(this,0===e?0:e),this}:function(e,n){return t.call(this,0===e?0:e,n),this})};if("function"==typeof w&&(y||b.forEach&&!h(function(){(new w).entries().next()}))){var O=new w,T=O[C](y?{}:-0,1)!=O,_=h(function(){O.has(1)}),R=f(function(e){new w(e)}),k=!y&&h(function(){for(var e=new w,t=5;t--;)e[C](t,t);return!e.has(-0)});R||((w=t(function(t,n){u(t,w,e);var o=p(new m,t,w);return null!=n&&l(n,v,o[C],o),o})).prototype=b,b.constructor=w),(_||k)&&(S("delete"),S("has"),v&&S("get")),(k||T)&&S(C),y&&b.clear&&delete b.clear}else w=g.getConstructor(t,e,v,C),a(w.prototype,n),s.NEED=!0;return d(w,e),E[e]=w,r(r.G+r.W+r.F*(w!=m),E),y||g.setStrong(w,e,v),w}},function(e,t,n){var o=n(54),r=n(51),i=n(24),a=n(75),s=n(27),l=n(100),u=Object.getOwnPropertyDescriptor;t.f=n(22)?u:function(e,t){if(e=i(e),t=a(t,!0),l)try{return u(e,t)}catch(e){}if(s(e,t))return r(!o.f.call(e,t),e[t])}},function(e,t,n){var o=n(30),r=n(77),i=n(31),a=n(25),s=n(211);e.exports=function(e,t){var n=1==e,l=2==e,u=3==e,c=4==e,h=6==e,f=5==e||h,d=t||s;return function(t,s,p){for(var g,v,y=i(t),m=r(y),w=o(s,p,3),C=a(m.length),b=0,E=n?d(t,C):l?d(t,0):void 0;C>b;b++)if((f||b in m)&&(v=w(g=m[b],b,y),e))if(n)E[b]=v;else if(v)switch(e){case 3:return!0;case 5:return g;case 6:return b;case 2:E.push(g)}else if(c)return!1;return h?-1:u||c?c:E}}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){"use strict";var o=n(29),r=n(28),i=n(23),a=n(36),s=n(12);e.exports=function(e,t,n){var l=s(e),u=n(a,l,""[e]),c=u[0],h=u[1];i(function(){var t={};return t[l]=function(){return 7},7!=""[e](t)})&&(r(String.prototype,e,c),o(RegExp.prototype,l,2==t?function(e,t){return h.call(e,this,t)}:function(e){return h.call(e,this)}))}},function(e,t,n){"use strict";t.__esModule=!0,t.DEFAULT_LANGUAGE_CODE=t.getLanguagesDictionaries=t.getDefaultLanguageDictionary=t.hasLanguageDictionary=t.getLanguageDictionary=t.registerLanguageDictionary=void 0;var o=n(1),r=n(199),i=s(n(38)),a=s(n(270));function s(e){return e&&e.__esModule?e:{default:e}}var l=a.default.languageCode,u=(0,i.default)("languagesDictionaries"),c=u.register,h=u.getItem,f=u.hasItem,d=u.getValues;function p(e,t){var n=e,i=t;return(0,o.isObject)(e)&&(n=(i=e).languageCode),function(e,t){e!==l&&(0,r.extendNotExistingKeys)(t,h(l))}(n,i),c(n,(0,o.deepClone)(i)),(0,o.deepClone)(i)}function g(e){return f(e)}t.registerLanguageDictionary=p,t.getLanguageDictionary=function(e){return g(e)?(0,o.deepClone)(h(e)):null},t.hasLanguageDictionary=g,t.getDefaultLanguageDictionary=function(){return a.default},t.getLanguagesDictionaries=function(){return d()},t.DEFAULT_LANGUAGE_CODE=l,p(a.default)},function(e,t,n){"use strict";t.__esModule=!0,t.SELECTION_TYPES=t.SELECTION_TYPE_OBJECT=t.SELECTION_TYPE_ARRAY=t.SELECTION_TYPE_EMPTY=t.SELECTION_TYPE_UNRECOGNIZED=void 0;var o=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],o=!0,r=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(o=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);o=!0);}catch(e){r=!0,i=e}finally{try{!o&&s.return&&s.return()}finally{if(r)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.detectSelectionType=v,t.normalizeSelectionFactory=y,t.transformSelectionToColumnDistance=function(e){var t=v(e);if(t===l||t===u)return[];var n=y(t),r=new Set;(0,a.arrayEach)(e,function(e){var t=n(e),i=o(t,4),s=i[1],l=i[3],u=l-s+1;(0,a.arrayEach)(Array.from(new Array(u),function(e,t){return s+t}),function(e){r.has(e)||r.add(e)})});var i=Array.from(r).sort(function(e,t){return e-t});return(0,a.arrayReduce)(i,function(e,t,n,o){return 0!==n&&t===o[n-1]+1?e[e.length-1][1]+=1:e.push([t,1]),e},[])},t.transformSelectionToRowDistance=function(e){var t=v(e);if(t===l||t===u)return[];var n=y(t),r=new Set;(0,a.arrayEach)(e,function(e){var t=n(e),i=o(t,3),s=i[0],l=i[2],u=l-s+1;(0,a.arrayEach)(Array.from(new Array(u),function(e,t){return s+t}),function(e){r.has(e)||r.add(e)})});var i=Array.from(r).sort(function(e,t){return e-t});return(0,a.arrayReduce)(i,function(e,t,n,o){return 0!==n&&t===o[n-1]+1?e[e.length-1][1]+=1:e.push([t,1]),e},[])},t.isValidCoord=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0;return"number"==typeof e&&e>=0&&e1&&void 0!==arguments[1]?arguments[1]:p;if(t!==p&&t!==g)throw new Error("The second argument is used internally only and cannot be overwritten.");var n=Array.isArray(e),o=t===p,a=l;if(n){var s=e[0];if(0===e.length)a=u;else if(o&&s instanceof i.CellRange)a=h;else if(o&&Array.isArray(s))a=v(s,g);else if(e.length>=2&&e.length<=4){!e.some(function(e,t){return!d[t].includes(void 0===e?"undefined":r(e))})&&(a=c)}}return a}function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.keepDirection,o=void 0!==n&&n,r=t.propToCol;if(!f.includes(e))throw new Error("Unsupported selection ranges schema type was provided.");return function(t){var n=e===h,i=n?t.from.row:t[0],a=n?t.from.col:t[1],l=n?t.to.row:t[2],u=n?t.to.col:t[3];if("function"==typeof r&&("string"==typeof a&&(a=r(a)),"string"==typeof u&&(u=r(u))),(0,s.isUndefined)(l)&&(l=i),(0,s.isUndefined)(u)&&(u=a),!o){var c=i,f=a,d=l,p=u;i=Math.min(c,d),a=Math.min(f,p),l=Math.max(c,d),u=Math.max(f,p)}return[i,a,l,u]}}},function(e,t,n){"use strict";t.__esModule=!0,t.FIRST_AFTER_SECOND=t.FIRST_BEFORE_SECOND=t.DO_NOT_SWAP=void 0,t.getSortFunctionForColumn=function(e){if(e.sortFunction)return e.sortFunction;if("date"===e.type)return o.default;if("numeric"===e.type)return i.default;return r.default};var o=a(n(292)),r=a(n(293)),i=a(n(294));function a(e){return e&&e.__esModule?e:{default:e}}t.DO_NOT_SWAP=0,t.FIRST_BEFORE_SECOND=-1,t.FIRST_AFTER_SECOND=1},function(e,t,n){var o=n(9),r=n(15).document,i=o(r)&&o(r.createElement);e.exports=function(e){return i?r.createElement(e):{}}},function(e,t,n){var o=n(9);e.exports=function(e,t){if(!o(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!o(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var o=n(18),r=n(208),i=n(80),a=n(78)("IE_PROTO"),s=function(){},l=function(){var e,t=n(74)("iframe"),o=i.length;for(t.style.display="none",n(103).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("