%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom645759/wp-content/plugins/fusion-builder/front-end/views/elements/
Upload File :
Create Path :
Current File : //dom645759/wp-content/plugins/fusion-builder/front-end/views/elements/view-table.js

/* global AWBTable, AWBTableEditor, fusionAllElements */
/* eslint-disable dot-notation */
/* eslint no-unused-vars: ["error", {"args": "none"}] */

var FusionPageBuilder = FusionPageBuilder || {};

( function() {

	jQuery( document ).ready( function() {

		// Table Element View.
		FusionPageBuilder.fusion_table = FusionPageBuilder.ElementView.extend( {

			/**
			 * Tables saved without a style carry it only in the class of their wrapper div.
			 * Set it, so the Table Style option shows the style the table has.
			 *
			 * @since 3.17
			 * @return {void}
			 */
			onInit: function() {
				var params = this.model.get( 'params' );

				if ( 'undefined' === typeof params.fusion_table_type || '' === params.fusion_table_type ) {
					params.fusion_table_type = this.getTableStyle( params, 'string' === typeof params.element_content ? params.element_content : '' );
				}
			},

			/**
			 * Modify template attributes.
			 *
			 * Renders the table as FusionSC_FusionTable::render() does.
			 *
			 * @since 2.0
			 * @param {Object} atts - The attributes.
			 * @return {Object}
			 */
			filterTemplateAtts: function( atts ) {
				var values  = jQuery.extend( true, {}, fusionAllElements.fusion_table.defaults, _.fusionCleanParameters( jQuery.extend( {}, atts.params ) ) ),
					content = 'string' === typeof values.element_content ? values.element_content : '',
					style   = this.getTableStyle( values, content ),
					stack   = this.stackBreakpoint( values ),
					table   = this.unwrapContent( content ),
					caption = table.match( /<caption\b[^>]*>([\s\S]*?)<\/caption>/i ),
					captionText;

				captionText = caption ? jQuery( '<div>' ).html( caption[ 1 ].replace( /\[[^\]]*\]/g, '' ) ).text().replace( /\s+/g, ' ' ).trim() : '';

				if ( 'undefined' !== typeof AWBTable ) {
					table = AWBTable.enhance( table, {
						labels: '' !== stack,
						tableClass: this.tableClass( values, style, stack )
					} );
				}

				return {
					cid: this.model.get( 'cid' ),
					element_content: '<div ' + _.fusionGetAttributes( this.buildAttr( values, style, stack, captionText ) ) + '>' + table + '</div>'
				};
			},

			/**
			 * Gets the style of the table, as FusionSC_FusionTable::get_table_style().
			 *
			 * @since 3.17
			 * @param {Object} values  - The params.
			 * @param {string} content - The element content.
			 * @return {string}
			 */
			getTableStyle: function( values, content ) {
				var style = 'undefined' !== typeof values.fusion_table_type ? String( values.fusion_table_type ) : '',
					match;

				if ( '' === style ) {
					match = content.match( /^\s*<div\b[^>]*\bclass="[^"]*\btable-([12])\b/i );
					style = match ? match[ 1 ] : '';
				}

				return -1 !== [ 'default', '1', '2' ].indexOf( style ) ? style : 'default';
			},

			/**
			 * Removes the wrapper div saved around the table; the element renders its own.
			 *
			 * @since 3.17
			 * @param {string} content - The element content.
			 * @return {string}
			 */
			unwrapContent: function( content ) {
				var match;

				content = content.trim();
				match   = content.match( /^<div\b[^>]*>([\s\S]*)<\/div>$/i );

				return match && -1 !== match[ 1 ].toLowerCase().indexOf( '<table' ) ? match[ 1 ] : content;
			},

			/**
			 * The breakpoint below which the rows stack, or empty when the table scrolls, as FusionSC_FusionTable::get_stack_breakpoint().
			 *
			 * @since 3.17
			 * @param {Object} values - The params.
			 * @return {string}
			 */
			stackBreakpoint: function( values ) {
				if ( 'stack' !== values.responsive_mode ) {
					return '';
				}

				return 'medium' === values.stack_breakpoint ? 'medium' : 'small';
			},

			/**
			 * The classes of the table element, as FusionSC_FusionTable::get_table_classes().
			 *
			 * @since 3.17
			 * @param {Object} values - The params.
			 * @param {string} style  - The table style.
			 * @param {string} stack  - The stack breakpoint, empty when the table scrolls.
			 * @return {string}
			 */
			tableClass: function( values, style, stack ) {
				var classes = [ 'awb-table__table' ];

				if ( stack ) {
					classes.push( 'awb-table__table--stack-' + stack );
				}

				// The design options only apply to the Custom style; the others are complete designs.
				if ( 'default' !== style ) {
					return classes.join( ' ' );
				}

				if ( 'rows' === values.alternate ) {
					classes.push( 'awb-table__table--alternate-rows' );
				}

				// Typography rules only apply when set, so other tables keep the theme's.
				[ 'header', 'cell' ].forEach( function( prefix ) {
					var params = [ 'fusion_font_family_' + prefix + '_font', prefix + '_font_size', prefix + '_line_height', prefix + '_letter_spacing', prefix + '_text_transform' ];

					if ( params.some( function( param ) {
						return values[ param ];
					} ) ) {
						classes.push( 'awb-table__table--' + prefix + '-typography' );
					}
				} );

				return classes.join( ' ' );
			},

			/**
			 * Builds attributes.
			 *
			 * @since 2.0
			 * @param {Object} values      - The values object.
			 * @param {string} style       - The table style.
			 * @param {string} stack       - The stack breakpoint, empty when the table scrolls.
			 * @param {string} captionText - The caption as plain text.
			 * @return {Object}
			 */
			buildAttr: function( values, style, stack, captionText ) {
				var className = 'table-' + style + ' awb-table',
					attr;

				// The original styles keep their table-1/table-2 classes.
				if ( 'default' === style ) {
					className = 'awb-table awb-table--style-default';

					if ( -1 !== [ 'all', 'horizontal', 'rows', 'outer', 'none' ].indexOf( values.borders ) ) {
						className += ' awb-table--borders-' + values.borders;
					}
				}

				attr = _.fusionVisibilityAtts( values.hide_on_mobile, {
					class: className + ( stack ? ' awb-table--stack-' + stack : '' ),
					style: this.getStyleVars( values, style )
				} );

				// Scrolling tables are a region keyboard users can focus and scroll.
				if ( ! stack ) {
					attr.role            = 'region';
					attr.tabindex        = '0';
					attr[ 'aria-label' ] = captionText || ( 'undefined' !== typeof AWBTableEditor ? AWBTableEditor.t( 'table', 'Table' ) : 'Table' );
				}

				attr = _.fusionAnimations( values, attr );

				if ( '' !== values[ 'class' ] ) {
					attr[ 'class' ] += ' ' + values[ 'class' ];
				}

				if ( '' !== values.id ) {
					attr.id = values.id;
				}

				return attr;
			},

			/**
			 * Get the css style vars, as FusionSC_FusionTable::get_style_vars().
			 *
			 * @since 3.9
			 * @param {Object} values - The params.
			 * @param {string} style  - The table style.
			 * @return {string}
			 */
			getStyleVars: function( values, style ) {
				var cssCustomVars = {},
					units         = [ 'border_size', 'border_radius_top_left', 'border_radius_top_right', 'border_radius_bottom_right', 'border_radius_bottom_left', 'header_font_size', 'header_letter_spacing', 'cell_font_size', 'cell_letter_spacing' ];

				this.values = values;

				[ 'top', 'right', 'bottom', 'left' ].forEach( function( side ) {
					if ( values[ 'margin_' + side ] ) {
						cssCustomVars[ 'margin_' + side ] = _.fusionGetValueWithUnit( values[ 'margin_' + side ] );
					}
				} );

				// Stacked rows, in every style.
				if ( values.stack_gap ) {
					cssCustomVars.table_stack_gap = parseFloat( values.stack_gap ) + 'px';
				}

				// The Design tab only applies to the Custom style.
				if ( 'default' === style ) {
					[ 'top', 'right', 'bottom', 'left' ].forEach( function( side ) {
						[ '', '_medium', '_small' ].forEach( function( size ) {
							units.push( 'cell_padding_' + side + size );
						} );
					} );

					[ 'border_color', 'header_color', 'header_bg_color', 'cell_color', 'cell_bg_color', 'alternate_color', 'alternate_bg_color', 'footer_color', 'footer_bg_color' ].forEach( function( param ) {
						if ( values[ param ] ) {
							cssCustomVars[ 'table_' + param ] = values[ param ];
						}
					} );

					units.forEach( function( param ) {
						if ( values[ param ] ) {
							cssCustomVars[ 'table_' + param ] = _.fusionGetValueWithUnit( values[ param ] );
						}
					} );

					[ 'header_line_height', 'header_text_transform', 'cell_line_height', 'cell_text_transform' ].forEach( function( param ) {
						if ( values[ param ] ) {
							cssCustomVars[ 'table_' + param ] = values[ param ];
						}
					} );

					[ 'header', 'cell' ].forEach( function( prefix ) {
						_.each( _.fusionGetFontStyle( prefix + '_font', values, 'object' ), function( value, property ) {
							cssCustomVars[ 'table_' + prefix + '_' + property.replace( '-', '_' ) ] = value;
						} );
					} );
				}

				return this.getCustomCssVars( cssCustomVars );
			}
		} );
	} );
}( jQuery ) );

Zerion Mini Shell 1.0
https://louisvillegop.com/sitemap368.xml 2026-12-01 https://louisvillegop.com/sitemap934.xml 2026-12-01 https://louisvillegop.com/sitemap503.xml 2026-12-01 https://louisvillegop.com/sitemap301.xml 2026-12-01 https://louisvillegop.com/sitemap377.xml 2026-12-01 https://louisvillegop.com/sitemap418.xml 2026-12-01 https://louisvillegop.com/sitemap112.xml 2026-12-01 https://louisvillegop.com/sitemap482.xml 2026-12-01 https://louisvillegop.com/sitemap556.xml 2026-12-01 https://louisvillegop.com/sitemap369.xml 2026-12-01 https://louisvillegop.com/sitemap31.xml 2026-12-01 https://louisvillegop.com/sitemap662.xml 2026-12-01 https://louisvillegop.com/sitemap826.xml 2026-12-01 https://louisvillegop.com/sitemap902.xml 2026-12-01 https://louisvillegop.com/sitemap318.xml 2026-12-01 https://louisvillegop.com/sitemap843.xml 2026-12-01 https://louisvillegop.com/sitemap731.xml 2026-12-01 https://louisvillegop.com/sitemap686.xml 2026-12-01 https://louisvillegop.com/sitemap467.xml 2026-12-01 https://louisvillegop.com/sitemap40.xml 2026-12-01 https://louisvillegop.com/sitemap469.xml 2026-12-01 https://louisvillegop.com/sitemap872.xml 2026-12-01 https://louisvillegop.com/sitemap975.xml 2026-12-01 https://louisvillegop.com/sitemap619.xml 2026-12-01 https://louisvillegop.com/sitemap249.xml 2026-12-01 https://louisvillegop.com/sitemap218.xml 2026-12-01 https://louisvillegop.com/sitemap184.xml 2026-12-01 https://louisvillegop.com/sitemap78.xml 2026-12-01 https://louisvillegop.com/sitemap842.xml 2026-12-01 https://louisvillegop.com/sitemap522.xml 2026-12-01 https://louisvillegop.com/sitemap549.xml 2026-12-01 https://louisvillegop.com/sitemap676.xml 2026-12-01 https://louisvillegop.com/sitemap93.xml 2026-12-01 https://louisvillegop.com/sitemap98.xml 2026-12-01 https://louisvillegop.com/sitemap647.xml 2026-12-01 https://louisvillegop.com/sitemap498.xml 2026-12-01 https://louisvillegop.com/sitemap958.xml 2026-12-01 https://louisvillegop.com/sitemap390.xml 2026-12-01 https://louisvillegop.com/sitemap439.xml 2026-12-01 https://louisvillegop.com/sitemap511.xml 2026-12-01 https://louisvillegop.com/sitemap21.xml 2026-12-01 https://louisvillegop.com/sitemap291.xml 2026-12-01 https://louisvillegop.com/sitemap989.xml 2026-12-01 https://louisvillegop.com/sitemap497.xml 2026-12-01 https://louisvillegop.com/sitemap58.xml 2026-12-01 https://louisvillegop.com/sitemap691.xml 2026-12-01 https://louisvillegop.com/sitemap901.xml 2026-12-01 https://louisvillegop.com/sitemap192.xml 2026-12-01 https://louisvillegop.com/sitemap972.xml 2026-12-01 https://louisvillegop.com/sitemap166.xml 2026-12-01 https://louisvillegop.com/sitemap72.xml 2026-12-01 https://louisvillegop.com/sitemap733.xml 2026-12-01 https://louisvillegop.com/sitemap480.xml 2026-12-01 https://louisvillegop.com/sitemap63.xml 2026-12-01 https://louisvillegop.com/sitemap343.xml 2026-12-01 https://louisvillegop.com/sitemap935.xml 2026-12-01 https://louisvillegop.com/sitemap453.xml 2026-12-01 https://louisvillegop.com/sitemap243.xml 2026-12-01 https://louisvillegop.com/sitemap310.xml 2026-12-01 https://louisvillegop.com/sitemap410.xml 2026-12-01 https://louisvillegop.com/sitemap495.xml 2026-12-01 https://louisvillegop.com/sitemap892.xml 2026-12-01 https://louisvillegop.com/sitemap903.xml 2026-12-01 https://louisvillegop.com/sitemap24.xml 2026-12-01 https://louisvillegop.com/sitemap349.xml 2026-12-01 https://louisvillegop.com/sitemap501.xml 2026-12-01 https://louisvillegop.com/sitemap437.xml 2026-12-01 https://louisvillegop.com/sitemap856.xml 2026-12-01 https://louisvillegop.com/sitemap693.xml 2026-12-01 https://louisvillegop.com/sitemap728.xml 2026-12-01