mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-05 20:57:12 +00:00
Use rollup to bundle JS (ES6 modules)
This commit is contained in:
parent
f49ff38cff
commit
72bda8f3cb
47 changed files with 2330 additions and 1673 deletions
5
.babelrc
5
.babelrc
|
|
@ -10,11 +10,6 @@
|
|||
"plugins": [
|
||||
["transform-object-rest-spread", {
|
||||
"useBuiltIns": true
|
||||
}],
|
||||
["transform-runtime", {
|
||||
"helpers": true,
|
||||
"polyfill": true,
|
||||
"regenerator": true
|
||||
}]
|
||||
]
|
||||
}
|
||||
|
|
|
|||
82
.editorconfig
Normal file
82
.editorconfig
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
# Change these settings to your own preference
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# We recommend you to keep these unchanged
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.feature]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.js]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.neon]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.php]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.sh]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.{yaml,yml}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[.babelrc]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[.gitmodules]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[.php_cs{,.dist}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[composer.json]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[package.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[phpspec.yml{,.dist}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[phpstan.neon]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[phpunit.xml{,.dist}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
|
@ -1,6 +1,13 @@
|
|||
module.exports = {
|
||||
extends: 'airbnb-base',
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
rules: {
|
||||
'object-shorthand': ['error', 'always', {
|
||||
avoidQuotes: true,
|
||||
avoidExplicitReturnArrows: true,
|
||||
}],
|
||||
'function-paren-newline': ['error', 'consistent'],
|
||||
'max-len': ['warn', 120, 2, {
|
||||
ignoreUrls: true,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
{
|
||||
// Other registrered bundles
|
||||
|
||||
if (in_array($this->getEnvironment(), ['prod']))
|
||||
if (in_array($this->getEnvironment(), ['prod']))
|
||||
{
|
||||
$bundles[] = new \Symfony\Bundle\WebServerBundle\WebServerBundle();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ const config = [
|
|||
|
||||
export const buildAdmin = function buildAdmin() {
|
||||
return gulp.src('src/Sylius/Bundle/AdminBundle/gulpfile.babel.js', { read: false })
|
||||
.pipe(chug({ args: config }));
|
||||
.pipe(chug({ args: config, tasks: 'build' }));
|
||||
};
|
||||
buildAdmin.description = 'Build admin assets.';
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ watchAdmin.description = 'Watch admin asset sources and rebuild on changes.';
|
|||
|
||||
export const buildShop = function buildShop() {
|
||||
return gulp.src('src/Sylius/Bundle/ShopBundle/gulpfile.babel.js', { read: false })
|
||||
.pipe(chug({ args: config }));
|
||||
.pipe(chug({ args: config, tasks: 'build' }));
|
||||
};
|
||||
buildShop.description = 'Build shop assets.';
|
||||
|
||||
|
|
|
|||
22
package.json
22
package.json
|
|
@ -1,18 +1,23 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"babel-runtime": "^6.26.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"jquery": "^3.2.0",
|
||||
"lightbox2": "^2.9.0",
|
||||
"semantic-ui-css": "^2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-plugin-external-helpers": "^6.22.0",
|
||||
"babel-plugin-module-resolver": "^3.1.1",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||
"babel-plugin-transform-runtime": "^6.23.0",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-register": "^6.26.0",
|
||||
"dedent": "^0.7.0",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-airbnb-base": "^12.1.0",
|
||||
"eslint-import-resolver-babel-module": "^4.0.0",
|
||||
"eslint-plugin-import": "^2.11.0",
|
||||
"fast-async": "^6.3.7",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-chug": "^0.5",
|
||||
"gulp-concat": "^2.6.0",
|
||||
|
|
@ -22,17 +27,22 @@
|
|||
"gulp-order": "^1.1.1",
|
||||
"gulp-sass": "^4.0.1",
|
||||
"gulp-sourcemaps": "^1.6.0",
|
||||
"gulp-uglify": "^1.5.1",
|
||||
"gulp-uglifycss": "^1.0.5",
|
||||
"merge-stream": "^1.0.0",
|
||||
"rollup": "^0.60.2",
|
||||
"rollup-plugin-babel": "^3.0.4",
|
||||
"rollup-plugin-commonjs": "^9.1.3",
|
||||
"rollup-plugin-inject": "^2.0.0",
|
||||
"rollup-plugin-node-resolve": "^3.3.0",
|
||||
"rollup-plugin-uglify": "^4.0.0",
|
||||
"upath": "^1.1.0",
|
||||
"yargs": "^6.4.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "gulp",
|
||||
"gulp": "gulp",
|
||||
"build": "gulp build",
|
||||
"gulp": "gulp build",
|
||||
"lint": "yarn lint:js",
|
||||
"lint:js": "eslint gulpfile.babel.js src/Sylius/Bundle/AdminBundle/gulpfile.babel.js src/Sylius/Bundle/ShopBundle/gulpfile.babel.js"
|
||||
"lint:js": "eslint gulpfile.babel.js src/Sylius/Bundle/AdminBundle/gulpfile.babel.js src/Sylius/Bundle/ShopBundle/gulpfile.babel.js src/Sylius/Bundle/UiBundle/Resources/private/js src/Sylius/Bundle/AdminBundle/Resources/private/js src/Sylius/Bundle/ShopBundle/Resources/private/js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
|||
29
src/Sylius/Bundle/AdminBundle/Resources/private/.eslintrc.js
Normal file
29
src/Sylius/Bundle/AdminBundle/Resources/private/.eslintrc.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
module.exports = {
|
||||
extends: 'airbnb-base',
|
||||
env: {
|
||||
browser: true,
|
||||
},
|
||||
rules: {
|
||||
'object-shorthand': ['error', 'always', {
|
||||
avoidQuotes: true,
|
||||
avoidExplicitReturnArrows: true,
|
||||
}],
|
||||
'function-paren-newline': ['error', 'consistent'],
|
||||
'max-len': ['warn', 120, 2, {
|
||||
ignoreUrls: true,
|
||||
ignoreComments: false,
|
||||
ignoreRegExpLiterals: true,
|
||||
ignoreStrings: true,
|
||||
ignoreTemplateLiterals: true,
|
||||
}],
|
||||
},
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
'babel-module': {
|
||||
alias: {
|
||||
'sylius/ui': './src/Sylius/Bundle/UiBundle/Resources/private/js',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -7,77 +7,97 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
$(document).ready(function () {
|
||||
$('#sylius_product_variant_pricingCalculator').handlePrototypes({
|
||||
'prototypePrefix': 'sylius_product_variant_pricingCalculator',
|
||||
'containerSelector': '#sylius_calculator_container'
|
||||
});
|
||||
import 'semantic-ui-css/components/accordion';
|
||||
import $ from 'jquery';
|
||||
|
||||
$('#sylius_customer_createUser').change(function () {
|
||||
$('#user-form').toggle();
|
||||
});
|
||||
import 'sylius/ui/app';
|
||||
import 'sylius/ui/sylius-auto-complete';
|
||||
import 'sylius/ui/sylius-product-attributes';
|
||||
import 'sylius/ui/sylius-product-auto-complete';
|
||||
import 'sylius/ui/sylius-prototype-handler';
|
||||
|
||||
$('.sylius-autocomplete').autoComplete();
|
||||
import './sylius-compound-form-errors';
|
||||
import './sylius-lazy-choice-tree';
|
||||
import './sylius-move-product';
|
||||
import './sylius-move-product-variant';
|
||||
import './sylius-move-taxon';
|
||||
import './sylius-notification';
|
||||
import './sylius-product-images-preview';
|
||||
import './sylius-product-slug';
|
||||
import './sylius-taxon-slug';
|
||||
|
||||
$('.product-select.ui.fluid.multiple.search.selection.dropdown').productAutoComplete();
|
||||
$('div#attributeChoice > .ui.dropdown.search').productAttributes();
|
||||
$(document).ready(() => {
|
||||
$('#sylius_product_variant_pricingCalculator').handlePrototypes({
|
||||
prototypePrefix: 'sylius_product_variant_pricingCalculator',
|
||||
containerSelector: '#sylius_calculator_container',
|
||||
});
|
||||
|
||||
$('table thead th.sortable').on('click', function () {
|
||||
window.location = $(this).find('a').attr('href');
|
||||
});
|
||||
$('#sylius_customer_createUser').change(() => {
|
||||
$('#user-form').toggle();
|
||||
});
|
||||
|
||||
$('.sylius-update-product-taxons').moveProduct($('.sylius-product-taxon-position'));
|
||||
$('.sylius-update-product-variants').moveProductVariant($('.sylius-product-variant-position'));
|
||||
$('.sylius-taxon-move-up').taxonMoveUp();
|
||||
$('.sylius-taxon-move-down').taxonMoveDown();
|
||||
$('.sylius-autocomplete').autoComplete();
|
||||
|
||||
$('#sylius_shipping_method_calculator').handlePrototypes({
|
||||
'prototypePrefix': 'sylius_shipping_method_calculator_calculators',
|
||||
'containerSelector': '.configuration'
|
||||
});
|
||||
$('.product-select.ui.fluid.multiple.search.selection.dropdown').productAutoComplete();
|
||||
$('div#attributeChoice > .ui.dropdown.search').productAttributes();
|
||||
|
||||
$('#actions a[data-form-collection="add"]').on('click', function () {
|
||||
setTimeout(function(){
|
||||
$('select[name^="sylius_promotion[actions]"][name$="[type]"]').last().change();
|
||||
}, 50);
|
||||
});
|
||||
$('#rules a[data-form-collection="add"]').on('click', function () {
|
||||
setTimeout(function(){
|
||||
$('select[name^="sylius_promotion[rules]"][name$="[type]"]').last().change();
|
||||
}, 50);
|
||||
});
|
||||
$('table thead th.sortable').on('click', (event) => {
|
||||
window.location = $(event.currentTarget).find('a').attr('href');
|
||||
});
|
||||
|
||||
$(document).on('collection-form-add', function () {
|
||||
$.each($('.sylius-autocomplete'), function (index, element) {
|
||||
if ($._data($(element).get(0), 'events') == undefined) {
|
||||
$(element).autoComplete();
|
||||
}
|
||||
});
|
||||
});
|
||||
$(document).on('collection-form-update', function () {
|
||||
$.each($('.sylius-autocomplete'), function (index, element) {
|
||||
if ($._data($(element).get(0), 'events') == undefined) {
|
||||
$(element).autoComplete();
|
||||
}
|
||||
});
|
||||
});
|
||||
$('.sylius-update-product-taxons').moveProduct($('.sylius-product-taxon-position'));
|
||||
$('.sylius-update-product-variants').moveProductVariant($('.sylius-product-variant-position'));
|
||||
$('.sylius-taxon-move-up').taxonMoveUp();
|
||||
$('.sylius-taxon-move-down').taxonMoveDown();
|
||||
|
||||
$('.sylius-tabular-form').addTabErrors();
|
||||
$('.ui.accordion').addAccordionErrors();
|
||||
$('#sylius-product-taxonomy-tree').choiceTree('productTaxon', true, 1);
|
||||
$('#sylius_shipping_method_calculator').handlePrototypes({
|
||||
prototypePrefix: 'sylius_shipping_method_calculator_calculators',
|
||||
containerSelector: '.configuration',
|
||||
});
|
||||
|
||||
$(document).notification();
|
||||
$(document).productSlugGenerator();
|
||||
$(document).taxonSlugGenerator();
|
||||
$('#actions a[data-form-collection="add"]').on('click', () => {
|
||||
setTimeout(() => {
|
||||
$('select[name^="sylius_promotion[actions]"][name$="[type]"]').last().change();
|
||||
}, 50);
|
||||
});
|
||||
$('#rules a[data-form-collection="add"]').on('click', () => {
|
||||
setTimeout(() => {
|
||||
$('select[name^="sylius_promotion[rules]"][name$="[type]"]').last().change();
|
||||
}, 50);
|
||||
});
|
||||
|
||||
$(document).previewUploadedImage('#sylius_product_images');
|
||||
$(document).previewUploadedImage('#sylius_taxon_images');
|
||||
|
||||
$('body').on('DOMNodeInserted', '[data-form-collection="item"]', function() {
|
||||
if ($(this).find('.accordion').length > 0) {
|
||||
$(this).find('.accordion').accordion();
|
||||
}
|
||||
});
|
||||
$(document).on('collection-form-add', () => {
|
||||
$('.sylius-autocomplete').each((index, element) => {
|
||||
if ($._data($(element).get(0), 'events') == undefined) {
|
||||
$(element).autoComplete();
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
});
|
||||
$(document).on('collection-form-update', () => {
|
||||
$('.sylius-autocomplete').each((index, element) => {
|
||||
if ($._data($(element).get(0), 'events') == undefined) {
|
||||
$(element).autoComplete();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.sylius-tabular-form').addTabErrors();
|
||||
$('.ui.accordion').addAccordionErrors();
|
||||
$('#sylius-product-taxonomy-tree').choiceTree('productTaxon', true, 1);
|
||||
|
||||
$(document).notification();
|
||||
$(document).productSlugGenerator();
|
||||
$(document).taxonSlugGenerator();
|
||||
|
||||
$(document).previewUploadedImage('#sylius_product_images');
|
||||
$(document).previewUploadedImage('#sylius_taxon_images');
|
||||
|
||||
$('body').on('DOMNodeInserted', '[data-form-collection="item"]', (event) => {
|
||||
if ($(event.relatedNode).find('.accordion').length > 0) {
|
||||
$(event.relatedNode).find('.accordion').accordion();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
window.$ = $;
|
||||
window.jQuery = $;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
window.$ = $;
|
||||
window.jQuery = $;
|
||||
|
|
@ -0,0 +1 @@
|
|||
import 'babel-polyfill';
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
import 'semantic-ui-css/components/accordion';
|
||||
import 'semantic-ui-css/components/api';
|
||||
import 'semantic-ui-css/components/checkbox';
|
||||
import 'semantic-ui-css/components/colorize';
|
||||
import 'semantic-ui-css/components/dimmer';
|
||||
import 'semantic-ui-css/components/dropdown';
|
||||
import 'semantic-ui-css/components/embed';
|
||||
import 'semantic-ui-css/components/form';
|
||||
import 'semantic-ui-css/components/modal';
|
||||
import 'semantic-ui-css/components/nag';
|
||||
import 'semantic-ui-css/components/popup';
|
||||
import 'semantic-ui-css/components/progress';
|
||||
import 'semantic-ui-css/components/rating';
|
||||
import 'semantic-ui-css/components/search';
|
||||
import 'semantic-ui-css/components/shape';
|
||||
import 'semantic-ui-css/components/sidebar';
|
||||
import 'semantic-ui-css/components/site';
|
||||
import 'semantic-ui-css/components/state';
|
||||
import 'semantic-ui-css/components/sticky';
|
||||
import 'semantic-ui-css/components/tab';
|
||||
import 'semantic-ui-css/components/transition';
|
||||
import 'semantic-ui-css/components/video';
|
||||
import 'semantic-ui-css/components/visibility';
|
||||
import 'semantic-ui-css/components/visit';
|
||||
|
|
@ -7,40 +7,39 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
addTabErrors: function () {
|
||||
var element = $(this);
|
||||
$.fn.extend({
|
||||
addTabErrors() {
|
||||
const element = this;
|
||||
|
||||
$('.ui.segment > .ui.tab').each(function () {
|
||||
var errors = $(this).find('.sylius-validation-error');
|
||||
$('.ui.segment > .ui.tab').each((idx, el) => {
|
||||
const errors = $(el).find('.sylius-validation-error');
|
||||
|
||||
if(0 !== errors.length) {
|
||||
var tabName = $(this).attr('data-tab');
|
||||
var tabWithErrors = $(element).find('a.item[data-tab="' + tabName + '"]');
|
||||
if (errors.length !== 0) {
|
||||
const tabName = $(el).attr('data-tab');
|
||||
const tabWithErrors = $(element).find(`a.item[data-tab="${tabName}"]`);
|
||||
|
||||
var label = tabWithErrors.html();
|
||||
var newLabel = label + '<span class="ui small horizontal circular label" style="background-color: #DB2828">' + errors.length + '</span>';
|
||||
const label = tabWithErrors.html();
|
||||
const newLabel = `${label}<span class="ui small horizontal circular label" style="background-color: #DB2828">${errors.length}</span>`;
|
||||
|
||||
tabWithErrors.html(newLabel);
|
||||
}
|
||||
});
|
||||
},
|
||||
addAccordionErrors: function () {
|
||||
var element = $(this);
|
||||
var accordionElements = element.find('.ui.content');
|
||||
tabWithErrors.html(newLabel);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
$(accordionElements).each(function () {
|
||||
var errors = $(this).find('.sylius-validation-error');
|
||||
addAccordionErrors() {
|
||||
const element = this;
|
||||
const accordionElements = element.find('.ui.content');
|
||||
|
||||
if(0 !== errors.length) {
|
||||
var ribWithErrors = $(this).closest('[data-locale]').find('.title');
|
||||
$(accordionElements).each((idx, el) => {
|
||||
const errors = $(el).find('.sylius-validation-error');
|
||||
|
||||
ribWithErrors.css('color', '#DB2828');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
})( jQuery );
|
||||
if (errors.length !== 0) {
|
||||
const ribWithErrors = $(el).closest('[data-locale]').find('.title');
|
||||
|
||||
ribWithErrors.css('color', '#DB2828');
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,166 +7,169 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/api';
|
||||
import 'semantic-ui-css/components/checkbox';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
choiceTree: function (type, multiple, defaultLevel) {
|
||||
var tree = $(this);
|
||||
var loader = $(this).find('.dimmer');
|
||||
var loadedLeafs = [];
|
||||
var $input = $(this).find('input[type="hidden"]');
|
||||
const createRootContainer = function createRootContainer() {
|
||||
return $('<div class="ui list"></div>');
|
||||
};
|
||||
|
||||
tree.api({
|
||||
on: 'now',
|
||||
method: 'GET',
|
||||
url: tree.data('taxon-root-nodes-url'),
|
||||
cache: false,
|
||||
beforeSend: function(settings) {
|
||||
loader.addClass('active');
|
||||
const createLeafContainerElement = function createLeafContainerElement() {
|
||||
return $('<div class="list"></div>');
|
||||
};
|
||||
|
||||
return settings;
|
||||
},
|
||||
onSuccess: function (response) {
|
||||
var rootContainer = createRootContainer();
|
||||
$.each(response, function (rootNodeIndex, rootNode) {
|
||||
rootContainer.append(createLeaf(rootNode.name, rootNode.code, rootNode.hasChildren, multiple, rootNode.level));
|
||||
});
|
||||
tree.append(rootContainer);
|
||||
loader.removeClass('active');
|
||||
}
|
||||
const createLeafIconElement = function createLeafIconElement() {
|
||||
return $('<i class="folder icon"></i>');
|
||||
};
|
||||
|
||||
const createLeafTitleElement = function createLeafTitleElement() {
|
||||
return $('<div class="header"></div>');
|
||||
};
|
||||
|
||||
const createLeafTitleSpan = function createLeafTitleSpan(displayName) {
|
||||
return $(`<span style="margin-right: 5px; cursor: pointer;">${displayName}</span>`);
|
||||
};
|
||||
|
||||
const createLeafContentElement = function createLeafContentElement() {
|
||||
return $('<div class="content"></div>');
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
choiceTree(type, multiple, defaultLevel) {
|
||||
const tree = this;
|
||||
const loader = tree.find('.dimmer');
|
||||
const loadedLeafs = [];
|
||||
const $input = tree.find('input[type="hidden"]');
|
||||
|
||||
const createCheckboxElement = function createCheckboxElement(name, code, multi) {
|
||||
const chosenNodes = $input.val().split(',');
|
||||
let checked = '';
|
||||
if (chosenNodes.some(chosenCode => chosenCode === code)) {
|
||||
checked = 'checked="checked"';
|
||||
}
|
||||
if (multi) {
|
||||
return $(`<div class="ui checkbox" data-value="${code}"><input ${checked} type="checkbox" name="${type}"></div>`);
|
||||
}
|
||||
|
||||
return $(`<div class="ui radio checkbox" data-value="${code}"><input ${checked} type="radio" name="${type}"></div>`);
|
||||
};
|
||||
|
||||
const isLeafLoaded = function isLeafLoaded(code) {
|
||||
return loadedLeafs.some(leafCode => leafCode === code);
|
||||
};
|
||||
|
||||
let createLeafFunc;
|
||||
|
||||
const loadLeafAction = function loadLeafAction(parentCode, expandButton, content, icon, leafContainerElement) {
|
||||
icon.toggleClass('open');
|
||||
|
||||
if (!isLeafLoaded(parentCode)) {
|
||||
expandButton.api({
|
||||
on: 'now',
|
||||
url: tree.data('taxon-leafs-url'),
|
||||
method: 'GET',
|
||||
cache: false,
|
||||
data: {
|
||||
parentCode,
|
||||
},
|
||||
beforeSend(settings) {
|
||||
loader.addClass('active');
|
||||
|
||||
return settings;
|
||||
},
|
||||
onSuccess(response) {
|
||||
response.forEach((leafNode) => {
|
||||
leafContainerElement.append((
|
||||
createLeafFunc(leafNode.name, leafNode.code, leafNode.hasChildren, multiple, leafNode.level)
|
||||
));
|
||||
});
|
||||
content.append(leafContainerElement);
|
||||
loader.removeClass('active');
|
||||
loadedLeafs.push(parentCode);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
var createLeaf = function (name, code, hasChildren, multipleChoice, level) {
|
||||
var displayNameElement = createLeafTitleSpan(name);
|
||||
var titleElement = createLeafTitleElement();
|
||||
var iconElement = createLeafIconElement();
|
||||
var checkboxElement = createCheckboxElement(name, code, multipleChoice);
|
||||
leafContainerElement.toggle();
|
||||
};
|
||||
|
||||
bindCheckboxAction(checkboxElement);
|
||||
const bindExpandLeafAction = function bindExpandLeafAction(parentCode, expandButton, content, icon, level) {
|
||||
const leafContainerElement = createLeafContainerElement();
|
||||
if (defaultLevel > level) {
|
||||
loadLeafAction(parentCode, expandButton, content, icon, leafContainerElement);
|
||||
}
|
||||
|
||||
var leafElement = $('<div class="item"></div>');
|
||||
var leafContentElement = createLeafContentElement();
|
||||
expandButton.click(() => {
|
||||
loadLeafAction(parentCode, expandButton, content, icon, leafContainerElement);
|
||||
});
|
||||
};
|
||||
|
||||
leafElement.append(iconElement);
|
||||
titleElement.append(displayNameElement);
|
||||
titleElement.append(checkboxElement);
|
||||
leafContentElement.append(titleElement);
|
||||
const bindCheckboxAction = function bindCheckboxAction(checkboxElement) {
|
||||
checkboxElement.checkbox({
|
||||
onChange() {
|
||||
const $checkboxes = tree.find('.checkbox');
|
||||
const checkedValues = [];
|
||||
|
||||
if (!hasChildren) {
|
||||
iconElement.addClass('outline');
|
||||
}
|
||||
if (hasChildren) {
|
||||
bindExpandLeafAction(code, displayNameElement, leafContentElement, iconElement, level);
|
||||
}
|
||||
leafElement.append(leafContentElement);
|
||||
$checkboxes.each((index, element) => {
|
||||
if ($(element).checkbox('is checked')) {
|
||||
checkedValues.push($(element).data('value'));
|
||||
}
|
||||
});
|
||||
|
||||
return leafElement;
|
||||
};
|
||||
$input.val(checkedValues.join());
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
var createRootContainer = function () {
|
||||
return $('<div class="ui list"></div>');
|
||||
};
|
||||
const createLeaf = function createLeaf(name, code, hasChildren, multipleChoice, level) {
|
||||
const displayNameElement = createLeafTitleSpan(name);
|
||||
const titleElement = createLeafTitleElement();
|
||||
const iconElement = createLeafIconElement();
|
||||
const checkboxElement = createCheckboxElement(name, code, multipleChoice);
|
||||
|
||||
var createLeafContainerElement = function () {
|
||||
return $('<div class="list"></div>');
|
||||
};
|
||||
bindCheckboxAction(checkboxElement);
|
||||
|
||||
var createLeafIconElement = function () {
|
||||
return $('<i class="folder icon"></i>');
|
||||
};
|
||||
const leafElement = $('<div class="item"></div>');
|
||||
const leafContentElement = createLeafContentElement();
|
||||
|
||||
var createLeafTitleElement = function () {
|
||||
return $('<div class="header"></div>');
|
||||
};
|
||||
leafElement.append(iconElement);
|
||||
titleElement.append(displayNameElement);
|
||||
titleElement.append(checkboxElement);
|
||||
leafContentElement.append(titleElement);
|
||||
|
||||
var createLeafTitleSpan = function (displayName) {
|
||||
return $('<span style="margin-right: 5px; cursor: pointer;">'+displayName+'</span>')
|
||||
};
|
||||
if (!hasChildren) {
|
||||
iconElement.addClass('outline');
|
||||
}
|
||||
if (hasChildren) {
|
||||
bindExpandLeafAction(code, displayNameElement, leafContentElement, iconElement, level);
|
||||
}
|
||||
leafElement.append(leafContentElement);
|
||||
|
||||
var createLeafContentElement = function () {
|
||||
return $('<div class="content"></div>');
|
||||
};
|
||||
return leafElement;
|
||||
};
|
||||
createLeafFunc = createLeaf;
|
||||
|
||||
var createCheckboxElement = function (name, code, multiple) {
|
||||
var chosenNodes = $input.val().split(',');
|
||||
var checked = '';
|
||||
if (chosenNodes.some(function (chosenCode) {return chosenCode === code})) {
|
||||
checked = 'checked="checked"';
|
||||
}
|
||||
if (multiple) {
|
||||
return $('<div class="ui checkbox" data-value="'+code+'"><input '+checked+' type="checkbox" name="'+type+'"></div>');
|
||||
}
|
||||
tree.api({
|
||||
on: 'now',
|
||||
method: 'GET',
|
||||
url: tree.data('taxon-root-nodes-url'),
|
||||
cache: false,
|
||||
beforeSend(settings) {
|
||||
loader.addClass('active');
|
||||
|
||||
return $('<div class="ui radio checkbox" data-value="'+code+'"><input '+checked+' type="radio" name="'+type+'"></div>');
|
||||
};
|
||||
|
||||
var isLeafLoaded = function (code) {
|
||||
return loadedLeafs.some(function (leafCode) {
|
||||
return leafCode === code;
|
||||
})
|
||||
};
|
||||
|
||||
var bindExpandLeafAction = function (parentCode, expandButton, content, icon, level) {
|
||||
var leafContainerElement = createLeafContainerElement();
|
||||
if (defaultLevel > level) {
|
||||
loadLeafAction(parentCode, expandButton, content, icon, leafContainerElement);
|
||||
}
|
||||
|
||||
expandButton.click(function () {
|
||||
loadLeafAction(parentCode, expandButton, content, icon, leafContainerElement);
|
||||
});
|
||||
};
|
||||
|
||||
var loadLeafAction = function (parentCode, expandButton, content, icon, leafContainerElement) {
|
||||
icon.toggleClass('open');
|
||||
|
||||
if (!isLeafLoaded(parentCode)) {
|
||||
expandButton.api({
|
||||
on: 'now',
|
||||
url: tree.data('taxon-leafs-url'),
|
||||
method: 'GET',
|
||||
cache: false,
|
||||
data: {
|
||||
parentCode: parentCode
|
||||
},
|
||||
beforeSend: function(settings) {
|
||||
loader.addClass('active');
|
||||
|
||||
return settings;
|
||||
},
|
||||
onSuccess: function (response) {
|
||||
$.each(response, function (leafIndex, leafNode) {
|
||||
leafContainerElement.append(createLeaf(leafNode.name, leafNode.code, leafNode.hasChildren, multiple, leafNode.level));
|
||||
});
|
||||
content.append(leafContainerElement);
|
||||
loader.removeClass('active');
|
||||
loadedLeafs.push(parentCode);
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
leafContainerElement.toggle();
|
||||
};
|
||||
|
||||
var bindCheckboxAction = function (checkboxElement) {
|
||||
checkboxElement.checkbox({
|
||||
onChange: function () {
|
||||
var $checkboxes = tree.find('.checkbox');
|
||||
var checkedValues = [];
|
||||
|
||||
$checkboxes.each(function () {
|
||||
if ($(this).checkbox('is checked')) {
|
||||
checkedValues.push($(this).data('value'));
|
||||
}
|
||||
});
|
||||
|
||||
$input.val(checkedValues.join());
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
return settings;
|
||||
},
|
||||
onSuccess(response) {
|
||||
const rootContainer = createRootContainer();
|
||||
response.forEach((rootNode) => {
|
||||
rootContainer.append((
|
||||
createLeaf(rootNode.name, rootNode.code, rootNode.hasChildren, multiple, rootNode.level)
|
||||
));
|
||||
});
|
||||
tree.append(rootContainer);
|
||||
loader.removeClass('active');
|
||||
},
|
||||
});
|
||||
})(jQuery);
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,44 +7,43 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/api';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
moveProductVariant: function (positionInput) {
|
||||
var productVariantIds = [];
|
||||
var element = $(this);
|
||||
$.fn.extend({
|
||||
moveProductVariant(positionInput) {
|
||||
const productVariantRows = [];
|
||||
const element = this;
|
||||
|
||||
element.api({
|
||||
method: 'PUT',
|
||||
beforeSend: function (settings) {
|
||||
settings.data = {
|
||||
productVariants: productVariantIds,
|
||||
_csrf_token: element.data('csrf-token')
|
||||
};
|
||||
element.api({
|
||||
method: 'PUT',
|
||||
beforeSend(settings) {
|
||||
/* eslint-disable-next-line no-param-reassign */
|
||||
settings.data = {
|
||||
productVariants: productVariantRows,
|
||||
_csrf_token: element.data('csrf-token'),
|
||||
};
|
||||
|
||||
return settings;
|
||||
},
|
||||
onSuccess: function (response) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
positionInput.on('input', function () {
|
||||
var id = $(this).data('id');
|
||||
var rowToEdit = productVariantIds.filter(function (productVariant){
|
||||
return productVariant.id == id;
|
||||
});
|
||||
|
||||
if(rowToEdit.length == 0) {
|
||||
productVariantIds.push({
|
||||
id: $(this).data('id'),
|
||||
position: $(this).val()
|
||||
});
|
||||
} else {
|
||||
rowToEdit[0].position = $(this).val();
|
||||
}
|
||||
});
|
||||
}
|
||||
return settings;
|
||||
},
|
||||
onSuccess() {
|
||||
window.location.reload();
|
||||
},
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
positionInput.on('input', (event) => {
|
||||
const input = $(event.currentTarget);
|
||||
const productVariantId = input.data('id');
|
||||
const row = productVariantRows.find(({ id }) => id === productVariantId);
|
||||
|
||||
if (!row) {
|
||||
productVariantRows.push({
|
||||
id: productVariantId,
|
||||
position: input.val(),
|
||||
});
|
||||
} else {
|
||||
row.position = input.val();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,44 +7,43 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/api';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
moveProduct: function (positionInput) {
|
||||
var productIds = [];
|
||||
var element = $(this);
|
||||
$.fn.extend({
|
||||
moveProduct(positionInput) {
|
||||
const productIds = [];
|
||||
const element = this;
|
||||
|
||||
element.api({
|
||||
method: 'PUT',
|
||||
beforeSend: function (settings) {
|
||||
settings.data = {
|
||||
productTaxons: productIds,
|
||||
_csrf_token: element.data('csrf-token')
|
||||
};
|
||||
element.api({
|
||||
method: 'PUT',
|
||||
beforeSend(settings) {
|
||||
/* eslint-disable-next-line no-param-reassign */
|
||||
settings.data = {
|
||||
productTaxons: productIds,
|
||||
_csrf_token: element.data('csrf-token'),
|
||||
};
|
||||
|
||||
return settings;
|
||||
},
|
||||
onSuccess: function (response) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
positionInput.on('input', function () {
|
||||
var id = $(this).data('id');
|
||||
var rowToEdit = productIds.filter(function (productTaxon){
|
||||
return productTaxon.id == id;
|
||||
});
|
||||
|
||||
if(rowToEdit.length == 0) {
|
||||
productIds.push({
|
||||
id: $(this).data('id'),
|
||||
position: $(this).val()
|
||||
});
|
||||
} else {
|
||||
rowToEdit[0].position = $(this).val();
|
||||
}
|
||||
});
|
||||
}
|
||||
return settings;
|
||||
},
|
||||
onSuccess() {
|
||||
window.location.reload();
|
||||
},
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
positionInput.on('input', (event) => {
|
||||
const input = $(event.currentTarget);
|
||||
const id = input.data('id');
|
||||
const rowToEdit = productIds.filter(productTaxon => productTaxon.id == id);
|
||||
|
||||
if (rowToEdit.length === 0) {
|
||||
productIds.push({
|
||||
id: input.data('id'),
|
||||
position: input.val(),
|
||||
});
|
||||
} else {
|
||||
rowToEdit[0].position = input.val();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,41 +7,47 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/api';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
taxonMoveUp: function () {
|
||||
$(this).api({
|
||||
method: 'PUT',
|
||||
on: 'click',
|
||||
beforeSend: function (settings) {
|
||||
settings.data = {
|
||||
position: $(this).data('position') - 1
|
||||
};
|
||||
$.fn.extend({
|
||||
taxonMoveUp() {
|
||||
const element = this;
|
||||
|
||||
return settings;
|
||||
},
|
||||
onSuccess: function (response) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
},
|
||||
taxonMoveDown: function () {
|
||||
$(this).api({
|
||||
method: 'PUT',
|
||||
on: 'click',
|
||||
beforeSend: function (settings) {
|
||||
settings.data = {
|
||||
position: $(this).data('position') + 1
|
||||
};
|
||||
element.api({
|
||||
method: 'PUT',
|
||||
on: 'click',
|
||||
beforeSend(settings) {
|
||||
/* eslint-disable-next-line no-param-reassign */
|
||||
settings.data = {
|
||||
position: element.data('position') - 1,
|
||||
};
|
||||
|
||||
return settings;
|
||||
},
|
||||
onSuccess: function (response) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
return settings;
|
||||
},
|
||||
onSuccess() {
|
||||
window.location.reload();
|
||||
},
|
||||
});
|
||||
})(jQuery);
|
||||
},
|
||||
|
||||
taxonMoveDown() {
|
||||
const element = this;
|
||||
|
||||
element.api({
|
||||
method: 'PUT',
|
||||
on: 'click',
|
||||
beforeSend(settings) {
|
||||
/* eslint-disable-next-line no-param-reassign */
|
||||
settings.data = {
|
||||
position: element.data('position') + 1,
|
||||
};
|
||||
|
||||
return settings;
|
||||
},
|
||||
onSuccess() {
|
||||
window.location.reload();
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,109 +7,96 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
notification: function () {
|
||||
var HUB_REQUEST_TIME = 'hub_request_time';
|
||||
var LAST_SYLIUS_VERSION = 'last_sylius_version';
|
||||
var SYLIUS_VERSION_DISMISSED = 'sylius_version_dismissed';
|
||||
var MILISECONDS_MULTIPLIER = 1000;
|
||||
const HUB_REQUEST_TIME = 'hub_request_time';
|
||||
const LAST_SYLIUS_VERSION = 'last_sylius_version';
|
||||
const SYLIUS_VERSION_DISMISSED = 'sylius_version_dismissed';
|
||||
const MILISECONDS_MULTIPLIER = 1000;
|
||||
|
||||
var notificationMenu = $('#sylius-version-notification');
|
||||
var askFrequency = notificationMenu.attr('data-frequency') * MILISECONDS_MULTIPLIER;
|
||||
const store = function store(key, value) {
|
||||
localStorage.setItem(key, value);
|
||||
};
|
||||
|
||||
$(notificationMenu).find('i[data-dismiss]').on('click', function () {
|
||||
store(SYLIUS_VERSION_DISMISSED, getLatestSyliusVersion());
|
||||
const retrieve = function retrieve(key) {
|
||||
return localStorage.getItem(key);
|
||||
};
|
||||
|
||||
updateNotification();
|
||||
});
|
||||
const milisecondsSinceLastRequest = function milisecondsSinceLastRequest() {
|
||||
return new Date().getTime() - parseInt(retrieve(HUB_REQUEST_TIME), 10);
|
||||
};
|
||||
|
||||
updateNotification();
|
||||
const getDismissedSyliusVersion = function getDismissedSyliusVersion() {
|
||||
return retrieve(SYLIUS_VERSION_DISMISSED);
|
||||
};
|
||||
|
||||
function updateNotification() {
|
||||
if (isLatest() || isDismissed()) {
|
||||
hideNotification();
|
||||
$.fn.extend({
|
||||
notification() {
|
||||
const notificationMenu = $('#sylius-version-notification');
|
||||
const askFrequency = notificationMenu.attr('data-frequency') * MILISECONDS_MULTIPLIER;
|
||||
|
||||
return;
|
||||
}
|
||||
const getCurrentSyliusVersion = function getCurrentSyliusVersion() {
|
||||
return notificationMenu.data('current-version');
|
||||
};
|
||||
|
||||
showNotification();
|
||||
}
|
||||
const getLatestSyliusVersion = function getLatestSyliusVersion() {
|
||||
if (retrieve(HUB_REQUEST_TIME) !== undefined && milisecondsSinceLastRequest() < askFrequency) {
|
||||
return retrieve(LAST_SYLIUS_VERSION);
|
||||
}
|
||||
|
||||
function showNotification()
|
||||
{
|
||||
var notificationMenu = $('#sylius-version-notification');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: notificationMenu.attr('data-url'),
|
||||
accept: 'application/json',
|
||||
success(response) {
|
||||
if (undefined !== response && response.version !== retrieve(LAST_SYLIUS_VERSION)) {
|
||||
store(LAST_SYLIUS_VERSION, response.version.toString());
|
||||
}
|
||||
},
|
||||
complete() {
|
||||
store(HUB_REQUEST_TIME, new Date().getTime().toString());
|
||||
},
|
||||
});
|
||||
|
||||
$('#notifications').css('display', 'block');
|
||||
$('#no-notifications').css('display', 'none');
|
||||
notificationMenu.find('.bell.icon').removeClass('outline').addClass('yellow');
|
||||
}
|
||||
return retrieve(LAST_SYLIUS_VERSION);
|
||||
};
|
||||
|
||||
function hideNotification()
|
||||
{
|
||||
var notificationMenu = $('#sylius-version-notification');
|
||||
const isLatest = function isLatest() {
|
||||
return getCurrentSyliusVersion() === getLatestSyliusVersion();
|
||||
};
|
||||
|
||||
$('#notifications').css('display', 'none');
|
||||
$('#no-notifications').css('display', 'block');
|
||||
notificationMenu.find('.bell.icon').removeClass('yellow').addClass('outline');
|
||||
}
|
||||
const isDismissed = function isDismissed() {
|
||||
return getLatestSyliusVersion() === getDismissedSyliusVersion();
|
||||
};
|
||||
|
||||
function getCurrentSyliusVersion()
|
||||
{
|
||||
return notificationMenu.data('current-version');
|
||||
}
|
||||
const showNotification = function showNotification() {
|
||||
$('#notifications').css('display', 'block');
|
||||
$('#no-notifications').css('display', 'none');
|
||||
notificationMenu.find('.bell.icon').removeClass('outline').addClass('yellow');
|
||||
};
|
||||
|
||||
function getLatestSyliusVersion()
|
||||
{
|
||||
if (retrieve(HUB_REQUEST_TIME) !== undefined && milisecondsSinceLastRequest() < askFrequency) {
|
||||
return retrieve(LAST_SYLIUS_VERSION);
|
||||
}
|
||||
const hideNotification = function hideNotification() {
|
||||
$('#notifications').css('display', 'none');
|
||||
$('#no-notifications').css('display', 'block');
|
||||
notificationMenu.find('.bell.icon').removeClass('yellow').addClass('outline');
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: notificationMenu.attr('data-url'),
|
||||
accept: "application/json",
|
||||
success: function (data) {
|
||||
if (undefined !== data && data.version !== retrieve(LAST_SYLIUS_VERSION)) {
|
||||
store(LAST_SYLIUS_VERSION, data.version.toString());
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
store(HUB_REQUEST_TIME, new Date().getTime().toString());
|
||||
}
|
||||
});
|
||||
const updateNotification = function updateNotification() {
|
||||
if (isLatest() || isDismissed()) {
|
||||
hideNotification();
|
||||
|
||||
return retrieve(LAST_SYLIUS_VERSION);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
function getDismissedSyliusVersion()
|
||||
{
|
||||
return retrieve(SYLIUS_VERSION_DISMISSED);
|
||||
}
|
||||
showNotification();
|
||||
};
|
||||
|
||||
function isLatest()
|
||||
{
|
||||
return getCurrentSyliusVersion() === getLatestSyliusVersion();
|
||||
}
|
||||
$(notificationMenu).find('i[data-dismiss]').on('click', () => {
|
||||
store(SYLIUS_VERSION_DISMISSED, getLatestSyliusVersion());
|
||||
|
||||
function isDismissed()
|
||||
{
|
||||
return getLatestSyliusVersion() === getDismissedSyliusVersion();
|
||||
}
|
||||
|
||||
function milisecondsSinceLastRequest() {
|
||||
return new Date().getTime() - parseInt(retrieve(HUB_REQUEST_TIME));
|
||||
}
|
||||
|
||||
function store(key, value) {
|
||||
localStorage.setItem(key, value);
|
||||
}
|
||||
|
||||
function retrieve(key) {
|
||||
return localStorage.getItem(key);
|
||||
}
|
||||
}
|
||||
updateNotification();
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
updateNotification();
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,43 +1,50 @@
|
|||
(function ( $ ) {
|
||||
'use strict';
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
$.fn.extend({
|
||||
previewUploadedImage: function (root) {
|
||||
$(root + ' input[type="file"]').each(function() {
|
||||
$(this).change(function() {
|
||||
displayUploadedImage(this);
|
||||
});
|
||||
});
|
||||
import $ from 'jquery';
|
||||
|
||||
$(root + ' [data-form-collection="add"]').on('click', function() {
|
||||
var self = $(this);
|
||||
const displayUploadedImage = function displayUploadedImage(input) {
|
||||
if (input.files && input.files[0]) {
|
||||
const reader = new FileReader();
|
||||
|
||||
setTimeout(function() {
|
||||
self.parent().find('.column:last-child input[type="file"]').on('change', function() {
|
||||
displayUploadedImage(this);
|
||||
});
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
reader.onload = (event) => {
|
||||
const image = $(input).parent().siblings('.image');
|
||||
|
||||
if (image.length > 0) {
|
||||
image.attr('src', event.target.result);
|
||||
} else {
|
||||
const img = $('<img class="ui small bordered image"/>');
|
||||
img.attr('src', event.target.result);
|
||||
$(input).parent().before(img);
|
||||
}
|
||||
};
|
||||
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
previewUploadedImage(root) {
|
||||
$(`${root} input[type="file"]`).each((idx, el) => {
|
||||
$(el).change((event) => {
|
||||
displayUploadedImage(event.currentTarget);
|
||||
});
|
||||
});
|
||||
})( jQuery );
|
||||
|
||||
function displayUploadedImage(input) {
|
||||
if (input.files && input.files[0]) {
|
||||
var reader = new FileReader();
|
||||
$(`${root} [data-form-collection="add"]`).on('click', (evt) => {
|
||||
const self = $(evt.currentTarget);
|
||||
|
||||
reader.onload = function (e) {
|
||||
var image = $(input).parent().siblings('.image');
|
||||
|
||||
if (image.length > 0) {
|
||||
image.attr('src', e.target.result);
|
||||
} else {
|
||||
var img = $('<img class="ui small bordered image"/>');
|
||||
img.attr('src', e.target.result);
|
||||
$(input).parent().before(img);
|
||||
}
|
||||
};
|
||||
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
}
|
||||
}
|
||||
setTimeout(() => {
|
||||
self.parent().find('.column:last-child input[type="file"]').on('change', (event) => {
|
||||
displayUploadedImage(event.currentTarget);
|
||||
});
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,63 +7,61 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
productSlugGenerator: function () {
|
||||
var timeout;
|
||||
const updateSlug = function updateSlug(element) {
|
||||
const slugInput = element.parents('.content').find('[name*="[slug]"]');
|
||||
const loadableParent = slugInput.parents('.field.loadable');
|
||||
|
||||
$('[name*="sylius_product[translations]"][name*="[name]"]').on('input', function() {
|
||||
clearTimeout(timeout);
|
||||
var element = $(this);
|
||||
if (slugInput.attr('readonly') === 'readonly') {
|
||||
return;
|
||||
}
|
||||
|
||||
timeout = setTimeout(function() {
|
||||
updateSlug(element);
|
||||
}, 1000);
|
||||
});
|
||||
loadableParent.addClass('loading');
|
||||
|
||||
$('.toggle-product-slug-modification').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
toggleSlugModification($(this), $(this).siblings('input'));
|
||||
});
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: slugInput.attr('data-url'),
|
||||
data: { name: element.val() },
|
||||
dataType: 'json',
|
||||
accept: 'application/json',
|
||||
success(response) {
|
||||
slugInput.val(response.slug);
|
||||
if (slugInput.parents('.field').hasClass('error')) {
|
||||
slugInput.parents('.field').removeClass('error');
|
||||
slugInput.parents('.field').find('.sylius-validation-error').remove();
|
||||
}
|
||||
loadableParent.removeClass('loading');
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
function updateSlug(element) {
|
||||
var slugInput = element.parents('.content').find('[name*="[slug]"]');
|
||||
var loadableParent = slugInput.parents('.field.loadable');
|
||||
const toggleSlugModification = function toggleSlugModification(button, slugInput) {
|
||||
if (slugInput.attr('readonly')) {
|
||||
slugInput.removeAttr('readonly');
|
||||
button.html('<i class="unlock icon"></i>');
|
||||
} else {
|
||||
slugInput.attr('readonly', 'readonly');
|
||||
button.html('<i class="lock icon"></i>');
|
||||
}
|
||||
};
|
||||
|
||||
if ('readonly' == slugInput.attr('readonly')) {
|
||||
return;
|
||||
}
|
||||
$.fn.extend({
|
||||
productSlugGenerator() {
|
||||
let timeout;
|
||||
|
||||
loadableParent.addClass('loading');
|
||||
$('[name*="sylius_product[translations]"][name*="[name]"]').on('input', (event) => {
|
||||
clearTimeout(timeout);
|
||||
const element = $(event.currentTarget);
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: slugInput.attr('data-url'),
|
||||
data: { name: element.val() },
|
||||
dataType: "json",
|
||||
accept: "application/json",
|
||||
success: function(data) {
|
||||
slugInput.val(data.slug);
|
||||
if (slugInput.parents('.field').hasClass('error')) {
|
||||
slugInput.parents('.field').removeClass('error');
|
||||
slugInput.parents('.field').find('.sylius-validation-error').remove();
|
||||
}
|
||||
loadableParent.removeClass('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function toggleSlugModification(button, slugInput) {
|
||||
if (slugInput.attr('readonly')) {
|
||||
slugInput.removeAttr('readonly');
|
||||
button.html('<i class="unlock icon"></i>');
|
||||
} else {
|
||||
slugInput.attr('readonly', 'readonly');
|
||||
button.html('<i class="lock icon"></i>');
|
||||
}
|
||||
}
|
||||
}
|
||||
timeout = setTimeout(() => {
|
||||
updateSlug(element);
|
||||
}, 1000);
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
$('.toggle-product-slug-modification').on('click', (event) => {
|
||||
event.preventDefault();
|
||||
toggleSlugModification($(event.currentTarget), $(event.currentTarget).siblings('input'));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,73 +7,81 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
taxonSlugGenerator: function () {
|
||||
var timeout;
|
||||
const updateSlug = function updateSlug(element) {
|
||||
const slugInput = element.parents('.content').find('[name*="[slug]"]');
|
||||
const loadableParent = slugInput.parents('.field.loadable');
|
||||
|
||||
$('[name*="sylius_taxon[translations]"][name*="[name]"]').on('input', function() {
|
||||
clearTimeout(timeout);
|
||||
var element = $(this);
|
||||
if (slugInput.attr('readonly') === 'readonly') {
|
||||
return;
|
||||
}
|
||||
|
||||
timeout = setTimeout(function() {
|
||||
updateSlug(element);
|
||||
}, 1000);
|
||||
});
|
||||
loadableParent.addClass('loading');
|
||||
|
||||
$('.toggle-taxon-slug-modification').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
toggleSlugModification($(this), $(this).siblings('input'));
|
||||
});
|
||||
let data;
|
||||
if (slugInput.attr('data-parent') != '' && slugInput.attr('data-parent') != undefined) {
|
||||
data = {
|
||||
name: element.val(),
|
||||
locale: element.closest('[data-locale]').data('locale'),
|
||||
parentId: slugInput.attr('data-parent'),
|
||||
};
|
||||
} else if ($('#sylius_taxon_parent').length > 0 && $('#sylius_taxon_parent').is(':visible') && $('#sylius_taxon_parent').val() != '') {
|
||||
data = {
|
||||
name: element.val(),
|
||||
locale: element.closest('[data-locale]').data('locale'),
|
||||
parentId: $('#sylius_taxon_parent').val(),
|
||||
};
|
||||
} else {
|
||||
data = {
|
||||
name: element.val(),
|
||||
locale: element.closest('[data-locale]').data('locale'),
|
||||
};
|
||||
}
|
||||
|
||||
function updateSlug(element) {
|
||||
var slugInput = element.parents('.content').find('[name*="[slug]"]');
|
||||
var loadableParent = slugInput.parents('.field.loadable');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: slugInput.attr('data-url'),
|
||||
data,
|
||||
dataType: 'json',
|
||||
accept: 'application/json',
|
||||
success(response) {
|
||||
slugInput.val(response.slug);
|
||||
if (slugInput.parents('.field').hasClass('error')) {
|
||||
slugInput.parents('.field').removeClass('error');
|
||||
slugInput.parents('.field').find('.sylius-validation-error').remove();
|
||||
}
|
||||
loadableParent.removeClass('loading');
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
if ('readonly' == slugInput.attr('readonly')) {
|
||||
return;
|
||||
}
|
||||
const toggleSlugModification = function toggleSlugModification(button, slugInput) {
|
||||
if (slugInput.attr('readonly')) {
|
||||
slugInput.removeAttr('readonly');
|
||||
button.html('<i class="unlock icon"></i>');
|
||||
} else {
|
||||
slugInput.attr('readonly', 'readonly');
|
||||
button.html('<i class="lock icon"></i>');
|
||||
}
|
||||
};
|
||||
|
||||
loadableParent.addClass('loading');
|
||||
$.fn.extend({
|
||||
taxonSlugGenerator() {
|
||||
let timeout;
|
||||
|
||||
var data;
|
||||
if ('' != slugInput.attr('data-parent') && undefined != slugInput.attr('data-parent')) {
|
||||
data = { name: element.val(), locale: element.closest('[data-locale]').data('locale'), parentId: slugInput.attr('data-parent') };
|
||||
} else if ($('#sylius_taxon_parent').length > 0 && $('#sylius_taxon_parent').is(':visible') && '' != $('#sylius_taxon_parent').val()) {
|
||||
data = { name: element.val(), locale: element.closest('[data-locale]').data('locale'), parentId: $('#sylius_taxon_parent').val() };
|
||||
} else {
|
||||
data = { name: element.val(), locale: element.closest('[data-locale]').data('locale') };
|
||||
}
|
||||
$('[name*="sylius_taxon[translations]"][name*="[name]"]').on('input', (event) => {
|
||||
clearTimeout(timeout);
|
||||
const element = $(event.currentTarget);
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: slugInput.attr('data-url'),
|
||||
data: data,
|
||||
dataType: "json",
|
||||
accept: "application/json",
|
||||
success: function(data) {
|
||||
slugInput.val(data.slug);
|
||||
if (slugInput.parents('.field').hasClass('error')) {
|
||||
slugInput.parents('.field').removeClass('error');
|
||||
slugInput.parents('.field').find('.sylius-validation-error').remove();
|
||||
}
|
||||
loadableParent.removeClass('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function toggleSlugModification(button, slugInput) {
|
||||
if (slugInput.attr('readonly')) {
|
||||
slugInput.removeAttr('readonly');
|
||||
button.html('<i class="unlock icon"></i>');
|
||||
} else {
|
||||
slugInput.attr('readonly', 'readonly');
|
||||
button.html('<i class="lock icon"></i>');
|
||||
}
|
||||
}
|
||||
}
|
||||
timeout = setTimeout(() => {
|
||||
updateSlug(element);
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
$('.toggle-taxon-slug-modification').on('click', (event) => {
|
||||
event.preventDefault();
|
||||
toggleSlugModification($(event.currentTarget), $(event.currentTarget).siblings('input'));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
import { rollup } from 'rollup';
|
||||
import { uglify } from 'rollup-plugin-uglify';
|
||||
import babel from 'rollup-plugin-babel';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import concat from 'gulp-concat';
|
||||
import dedent from 'dedent';
|
||||
import gulp from 'gulp';
|
||||
import gulpif from 'gulp-if';
|
||||
import inject from 'rollup-plugin-inject';
|
||||
import livereload from 'gulp-livereload';
|
||||
import merge from 'merge-stream';
|
||||
import order from 'gulp-order';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import sass from 'gulp-sass';
|
||||
import sourcemaps from 'gulp-sourcemaps';
|
||||
import uglify from 'gulp-uglify';
|
||||
import uglifycss from 'gulp-uglifycss';
|
||||
import upath from 'upath';
|
||||
import yargs from 'yargs';
|
||||
|
|
@ -34,6 +40,11 @@ const { argv } = yargs
|
|||
});
|
||||
|
||||
const env = process.env.GULP_ENV;
|
||||
const options = {
|
||||
minify: env === 'prod',
|
||||
sourcemaps: env !== 'prod',
|
||||
};
|
||||
|
||||
const rootPath = upath.normalizeSafe(argv.rootPath);
|
||||
const adminRootPath = upath.joinSafe(rootPath, 'admin');
|
||||
const vendorPath = upath.normalizeSafe(argv.vendorPath || '.');
|
||||
|
|
@ -44,8 +55,6 @@ const nodeModulesPath = upath.normalizeSafe(argv.nodeModulesPath);
|
|||
const paths = {
|
||||
admin: {
|
||||
js: [
|
||||
upath.joinSafe(nodeModulesPath, 'jquery/dist/jquery.min.js'),
|
||||
upath.joinSafe(nodeModulesPath, 'semantic-ui-css/semantic.min.js'),
|
||||
upath.joinSafe(vendorUiPath, 'Resources/private/js/**'),
|
||||
upath.joinSafe(vendorAdminPath, 'Resources/private/js/**'),
|
||||
],
|
||||
|
|
@ -80,7 +89,7 @@ const sourcePathMap = [
|
|||
},
|
||||
];
|
||||
|
||||
const mapSourcePath = function mapSourcePath(sourcePath /* , file */) {
|
||||
const mapSourcePath = function mapSourcePath(sourcePath) {
|
||||
const match = sourcePathMap.find(({ sourceDir }) => (
|
||||
sourcePath.substring(0, sourceDir.length) === sourceDir
|
||||
));
|
||||
|
|
@ -94,15 +103,88 @@ const mapSourcePath = function mapSourcePath(sourcePath /* , file */) {
|
|||
return upath.joinSafe(destPath, sourcePath.substring(sourceDir.length));
|
||||
};
|
||||
|
||||
export const buildAdminJs = function buildAdminJs() {
|
||||
return gulp.src(paths.admin.js, { base: './' })
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.init()))
|
||||
.pipe(concat('app.js'))
|
||||
.pipe(gulpif(env === 'prod', uglify()))
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.mapSources(mapSourcePath)))
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.write('./')))
|
||||
.pipe(gulp.dest(upath.joinSafe(adminRootPath, 'js')))
|
||||
.pipe(livereload());
|
||||
export const buildAdminJs = async function buildAdminJs() {
|
||||
const bundle = await rollup({
|
||||
input: upath.joinSafe(vendorAdminPath, 'Resources/private/js/app.js'),
|
||||
plugins: [
|
||||
{
|
||||
name: 'shim-app',
|
||||
|
||||
transform(code, id) {
|
||||
if (upath.relative('', id) === upath.relative('', upath.joinSafe(vendorAdminPath, 'Resources/private/js/app.js'))) {
|
||||
return {
|
||||
code: dedent`
|
||||
import './shim/shim-polyfill';
|
||||
import './shim/shim-jquery';
|
||||
import './shim/shim-semantic-ui';
|
||||
|
||||
${code}
|
||||
`,
|
||||
map: null,
|
||||
};
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
},
|
||||
inject({
|
||||
include: `${nodeModulesPath}/**`,
|
||||
modules: {
|
||||
$: 'jquery',
|
||||
jQuery: 'jquery',
|
||||
},
|
||||
}),
|
||||
resolve({
|
||||
jail: upath.resolve(nodeModulesPath),
|
||||
}),
|
||||
commonjs({
|
||||
include: `${nodeModulesPath}/**`,
|
||||
}),
|
||||
babel({
|
||||
babelrc: false,
|
||||
exclude: `${nodeModulesPath}/**`,
|
||||
presets: [
|
||||
['env', {
|
||||
targets: {
|
||||
browsers: [
|
||||
'last 2 versions',
|
||||
'Firefox ESR',
|
||||
'IE >= 9',
|
||||
'Android >= 4.0',
|
||||
'iOS >= 7',
|
||||
],
|
||||
},
|
||||
modules: false,
|
||||
exclude: [
|
||||
'transform-async-to-generator',
|
||||
'transform-regenerator',
|
||||
],
|
||||
useBuiltIns: true,
|
||||
}],
|
||||
],
|
||||
plugins: [
|
||||
['external-helpers'],
|
||||
['fast-async'],
|
||||
['module-resolver', {
|
||||
alias: {
|
||||
'sylius/ui': upath.relative('', upath.joinSafe(vendorUiPath, 'Resources/private/js')),
|
||||
},
|
||||
}],
|
||||
['transform-object-rest-spread', {
|
||||
useBuiltIns: false,
|
||||
}],
|
||||
],
|
||||
}),
|
||||
options.minify && uglify(),
|
||||
],
|
||||
treeshake: false,
|
||||
});
|
||||
|
||||
await bundle.write({
|
||||
file: upath.joinSafe(adminRootPath, 'js/app.js'),
|
||||
format: 'iife',
|
||||
sourcemap: options.sourcemaps,
|
||||
});
|
||||
};
|
||||
buildAdminJs.description = 'Build admin js assets.';
|
||||
|
||||
|
|
@ -113,11 +195,11 @@ export const buildAdminCss = function buildAdminCss() {
|
|||
);
|
||||
|
||||
const cssStream = gulp.src(paths.admin.css, { base: './' })
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.init()))
|
||||
.pipe(gulpif(options.sourcemaps, sourcemaps.init()))
|
||||
.pipe(concat('css-files.css'));
|
||||
|
||||
const sassStream = gulp.src(paths.admin.sass, { base: './' })
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.init()))
|
||||
.pipe(gulpif(options.sourcemaps, sourcemaps.init()))
|
||||
.pipe(sass())
|
||||
.pipe(concat('sass-files.scss'));
|
||||
|
||||
|
|
@ -126,9 +208,9 @@ export const buildAdminCss = function buildAdminCss() {
|
|||
merge(cssStream, sassStream)
|
||||
.pipe(order(['css-files.css', 'sass-files.scss']))
|
||||
.pipe(concat('style.css'))
|
||||
.pipe(gulpif(env === 'prod', uglifycss()))
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.mapSources(mapSourcePath)))
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.write('./')))
|
||||
.pipe(gulpif(options.minify, uglifycss()))
|
||||
.pipe(gulpif(options.sourcemaps, sourcemaps.mapSources(mapSourcePath)))
|
||||
.pipe(gulpif(options.sourcemaps, sourcemaps.write('./')))
|
||||
.pipe(gulp.dest(upath.joinSafe(adminRootPath, 'css')))
|
||||
.pipe(livereload()),
|
||||
);
|
||||
|
|
|
|||
29
src/Sylius/Bundle/ShopBundle/Resources/private/.eslintrc.js
Normal file
29
src/Sylius/Bundle/ShopBundle/Resources/private/.eslintrc.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
module.exports = {
|
||||
extends: 'airbnb-base',
|
||||
env: {
|
||||
browser: true,
|
||||
},
|
||||
rules: {
|
||||
'object-shorthand': ['error', 'always', {
|
||||
avoidQuotes: true,
|
||||
avoidExplicitReturnArrows: true,
|
||||
}],
|
||||
'function-paren-newline': ['error', 'consistent'],
|
||||
'max-len': ['warn', 120, 2, {
|
||||
ignoreUrls: true,
|
||||
ignoreComments: false,
|
||||
ignoreRegExpLiterals: true,
|
||||
ignoreStrings: true,
|
||||
ignoreTemplateLiterals: true,
|
||||
}],
|
||||
},
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
'babel-module': {
|
||||
alias: {
|
||||
'sylius/ui': './src/Sylius/Bundle/UiBundle/Resources/private/js',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -7,60 +7,72 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
import 'semantic-ui-css/components/popup';
|
||||
import 'semantic-ui-css/components/rating';
|
||||
import $ from 'jquery';
|
||||
|
||||
(function($) {
|
||||
$(document).ready(function () {
|
||||
$('.cart.button')
|
||||
.popup({
|
||||
popup: $('.cart.popup'),
|
||||
on: 'click',
|
||||
})
|
||||
;
|
||||
import 'sylius/ui/app';
|
||||
import 'sylius/ui/sylius-api-login';
|
||||
import 'sylius/ui/sylius-api-toggle';
|
||||
|
||||
$('.star.rating').rating({
|
||||
fireOnInit: true,
|
||||
onRate: function(value) {
|
||||
$("[name='sylius_product_review[rating]']:checked").removeAttr('checked');
|
||||
$("#sylius_product_review_rating_"+(value-1)).attr('checked', 'checked');
|
||||
}
|
||||
});
|
||||
import './sylius-add-to-cart';
|
||||
import './sylius-address-book';
|
||||
import './sylius-province-field';
|
||||
import './sylius-remove-from-cart';
|
||||
import './sylius-variant-images';
|
||||
import './sylius-variants-prices';
|
||||
|
||||
$('#sylius_checkout_address_customer_email').apiToggle({
|
||||
dataType: 'json',
|
||||
method: 'GET',
|
||||
throttle: 1500,
|
||||
|
||||
beforeSend: function (settings) {
|
||||
var email = $('#sylius_checkout_address_customer_email').val();
|
||||
|
||||
if (email.length < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
settings.data = {
|
||||
email: email
|
||||
};
|
||||
|
||||
return settings;
|
||||
},
|
||||
|
||||
successTest: function (response) {
|
||||
return $('#sylius_checkout_address_customer_email').val() === response.username;
|
||||
}
|
||||
}, $('#sylius-api-login-form'));
|
||||
|
||||
$('#sylius-api-login').apiLogin({
|
||||
method: 'POST',
|
||||
throttle: 500
|
||||
});
|
||||
|
||||
$('.sylius-cart-remove-button').removeFromCart();
|
||||
$('#sylius-product-adding-to-cart').addToCart();
|
||||
|
||||
$('#sylius-shipping-address').addressBook();
|
||||
$('#sylius-billing-address').addressBook();
|
||||
$(document).provinceField();
|
||||
$(document).variantPrices();
|
||||
$(document).variantImages();
|
||||
$(document).ready(() => {
|
||||
$('.cart.button')
|
||||
.popup({
|
||||
popup: $('.cart.popup'),
|
||||
on: 'click',
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
$('.star.rating').rating({
|
||||
fireOnInit: true,
|
||||
onRate(value) {
|
||||
$('[name="sylius_product_review[rating]"]:checked').removeAttr('checked');
|
||||
$(`#sylius_product_review_rating_${value - 1}`).attr('checked', 'checked');
|
||||
},
|
||||
});
|
||||
|
||||
$('#sylius_checkout_address_customer_email').apiToggle({
|
||||
dataType: 'json',
|
||||
method: 'GET',
|
||||
throttle: 1500,
|
||||
|
||||
beforeSend(settings) {
|
||||
const email = $('#sylius_checkout_address_customer_email').val();
|
||||
|
||||
if (email.length < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* eslint-disable-next-line no-param-reassign */
|
||||
settings.data = {
|
||||
email,
|
||||
};
|
||||
|
||||
return settings;
|
||||
},
|
||||
|
||||
successTest(response) {
|
||||
return $('#sylius_checkout_address_customer_email').val() === response.username;
|
||||
},
|
||||
}, $('#sylius-api-login-form'));
|
||||
|
||||
$('#sylius-api-login').apiLogin({
|
||||
method: 'POST',
|
||||
throttle: 500,
|
||||
});
|
||||
|
||||
$('.sylius-cart-remove-button').removeFromCart();
|
||||
$('#sylius-product-adding-to-cart').addToCart();
|
||||
|
||||
$('#sylius-shipping-address').addressBook();
|
||||
$('#sylius-billing-address').addressBook();
|
||||
$(document).provinceField();
|
||||
$(document).variantPrices();
|
||||
$(document).variantImages();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
import $ from 'jquery';
|
||||
|
||||
window.$ = $;
|
||||
window.jQuery = $;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import lightbox from 'lightbox2';
|
||||
|
||||
window.lightbox = lightbox;
|
||||
|
|
@ -0,0 +1 @@
|
|||
import 'babel-polyfill';
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
import 'semantic-ui-css/components/accordion';
|
||||
import 'semantic-ui-css/components/api';
|
||||
import 'semantic-ui-css/components/checkbox';
|
||||
import 'semantic-ui-css/components/colorize';
|
||||
import 'semantic-ui-css/components/dimmer';
|
||||
import 'semantic-ui-css/components/dropdown';
|
||||
import 'semantic-ui-css/components/embed';
|
||||
import 'semantic-ui-css/components/form';
|
||||
import 'semantic-ui-css/components/modal';
|
||||
import 'semantic-ui-css/components/nag';
|
||||
import 'semantic-ui-css/components/popup';
|
||||
import 'semantic-ui-css/components/progress';
|
||||
import 'semantic-ui-css/components/rating';
|
||||
import 'semantic-ui-css/components/search';
|
||||
import 'semantic-ui-css/components/shape';
|
||||
import 'semantic-ui-css/components/sidebar';
|
||||
import 'semantic-ui-css/components/site';
|
||||
import 'semantic-ui-css/components/state';
|
||||
import 'semantic-ui-css/components/sticky';
|
||||
import 'semantic-ui-css/components/tab';
|
||||
import 'semantic-ui-css/components/transition';
|
||||
import 'semantic-ui-css/components/video';
|
||||
import 'semantic-ui-css/components/visibility';
|
||||
import 'semantic-ui-css/components/visit';
|
||||
|
|
@ -7,41 +7,41 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/api';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
addToCart: function () {
|
||||
var element = $(this);
|
||||
var href = $(element).attr('action');
|
||||
var redirectUrl = $(element).data('redirect');
|
||||
var validationElement = $('#sylius-cart-validation-error');
|
||||
$.fn.extend({
|
||||
addToCart() {
|
||||
const element = this;
|
||||
const url = $(element).attr('action');
|
||||
const redirectUrl = $(element).data('redirect');
|
||||
const validationElement = $('#sylius-cart-validation-error');
|
||||
|
||||
$(element).api({
|
||||
method: 'POST',
|
||||
on: 'submit',
|
||||
cache: false,
|
||||
url: href,
|
||||
beforeSend: function (settings) {
|
||||
settings.data = $(this).serialize();
|
||||
element.api({
|
||||
method: 'POST',
|
||||
on: 'submit',
|
||||
cache: false,
|
||||
url,
|
||||
beforeSend(settings) {
|
||||
/* eslint-disable-next-line no-param-reassign */
|
||||
settings.data = element.serialize();
|
||||
|
||||
return settings;
|
||||
},
|
||||
onSuccess: function (response) {
|
||||
validationElement.addClass('hidden');
|
||||
window.location.href = redirectUrl;
|
||||
},
|
||||
onFailure: function (response) {
|
||||
validationElement.removeClass('hidden');
|
||||
var validationMessage = '';
|
||||
return settings;
|
||||
},
|
||||
onSuccess() {
|
||||
validationElement.addClass('hidden');
|
||||
window.location.href = redirectUrl;
|
||||
},
|
||||
onFailure(response) {
|
||||
validationElement.removeClass('hidden');
|
||||
let validationMessage = '';
|
||||
|
||||
$.each(response.errors.errors, function (key, message) {
|
||||
validationMessage += message;
|
||||
});
|
||||
validationElement.html(validationMessage);
|
||||
$(element).removeClass('loading');
|
||||
},
|
||||
});
|
||||
}
|
||||
Object.entries(response.errors.errors).forEach(([, message]) => {
|
||||
validationMessage += message;
|
||||
});
|
||||
validationElement.html(validationMessage);
|
||||
$(element).removeClass('loading');
|
||||
},
|
||||
});
|
||||
})( jQuery );
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,61 +7,59 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/dropdown';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
addressBook: function () {
|
||||
var element = $(this);
|
||||
var select = element.find('.address-book-select');
|
||||
const parseKey = function parseKey(key) {
|
||||
return key.replace(/(_\w)/g, words => words[1].toUpperCase());
|
||||
};
|
||||
|
||||
select.dropdown({
|
||||
forceSelection: false,
|
||||
$.fn.extend({
|
||||
addressBook() {
|
||||
const element = this;
|
||||
const select = element.find('.address-book-select');
|
||||
const findByName = function findByName(name) {
|
||||
return element.find(`[name*=${parseKey(name)}]`);
|
||||
};
|
||||
|
||||
onChange: function (name, text, choice) {
|
||||
var provinceCode = choice.data()['provinceCode'],
|
||||
provinceName = choice.data()['provinceName'],
|
||||
provinceContainer = $(this).parent().find(".province-container").get(0);
|
||||
select.dropdown({
|
||||
forceSelection: false,
|
||||
|
||||
$.each(element.find('input, select'), function (key, input) {
|
||||
$(input).val('');
|
||||
});
|
||||
onChange(name, text, choice) {
|
||||
const { provinceCode, provinceName } = choice.data();
|
||||
const provinceContainer = select.parent().find('.province-container').get(0);
|
||||
|
||||
$.each(choice.data(), function (property, value) {
|
||||
var field = findByName(property);
|
||||
element.find('input, select').each((index, input) => {
|
||||
$(input).val('');
|
||||
});
|
||||
|
||||
if (-1 !== property.indexOf('countryCode')) {
|
||||
field.val(value).change();
|
||||
Object.entries(choice.data()).forEach(([property, value]) => {
|
||||
const field = findByName(property);
|
||||
|
||||
var exists = setInterval(function () {
|
||||
var provinceCodeField = findByName('provinceCode');
|
||||
var provinceNameField = findByName('provinceName');
|
||||
if (property.indexOf('countryCode') !== -1) {
|
||||
field.val(value).change();
|
||||
|
||||
if (!provinceContainer.hasAttribute("data-loading")) {
|
||||
if (0 !== provinceCodeField.length && ('' !== provinceCode || undefined != provinceCode)) {
|
||||
provinceCodeField.val(provinceCode);
|
||||
const exists = setInterval(() => {
|
||||
const provinceCodeField = findByName('provinceCode');
|
||||
const provinceNameField = findByName('provinceName');
|
||||
|
||||
clearInterval(exists);
|
||||
} else if (0 !== provinceNameField.length && ('' !== provinceName || undefined != provinceName)) {
|
||||
provinceNameField.val(provinceName);
|
||||
if (!provinceContainer.hasAttribute('data-loading')) {
|
||||
if (provinceCodeField.length !== 0 && (provinceCode !== '' || provinceCode != undefined)) {
|
||||
provinceCodeField.val(provinceCode);
|
||||
|
||||
clearInterval(exists);
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
field.val(value);
|
||||
}
|
||||
});
|
||||
clearInterval(exists);
|
||||
} else if (provinceNameField.length !== 0 && (provinceName !== '' || provinceName != undefined)) {
|
||||
provinceNameField.val(provinceName);
|
||||
|
||||
clearInterval(exists);
|
||||
}
|
||||
});
|
||||
|
||||
var parseKey = function (key) {
|
||||
return key.replace(/(_\w)/g, function (words) {return words[1].toUpperCase()});
|
||||
};
|
||||
var findByName = function (name) {
|
||||
return element.find('[name*=' + parseKey(name) + ']');
|
||||
};
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
field.val(value);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
})( jQuery );
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,98 +7,88 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
provinceField: function () {
|
||||
var countrySelect = $('select[name$="[countryCode]"]');
|
||||
const getProvinceInputValue = function getProvinceInputValue(valueSelector) {
|
||||
return valueSelector == undefined ? '' : `value="${valueSelector}"`;
|
||||
};
|
||||
|
||||
countrySelect.on('change', function(event) {
|
||||
var select = $(event.currentTarget);
|
||||
var provinceContainer = select.parents('.field').next('div.province-container');
|
||||
$.fn.extend({
|
||||
provinceField() {
|
||||
const countrySelect = $('select[name$="[countryCode]"]');
|
||||
|
||||
var provinceSelectFieldName = select.attr('name').replace('country', 'province');
|
||||
var provinceInputFieldName = select.attr('name').replace('countryCode', 'provinceName');
|
||||
countrySelect.on('change', (event) => {
|
||||
const select = $(event.currentTarget);
|
||||
const provinceContainer = select.parents('.field').next('div.province-container');
|
||||
|
||||
if ('' === select.val() || undefined == select.val()) {
|
||||
provinceContainer.fadeOut('slow', function () {
|
||||
provinceContainer.html('');
|
||||
});
|
||||
const provinceSelectFieldName = select.attr('name').replace('country', 'province');
|
||||
const provinceInputFieldName = select.attr('name').replace('countryCode', 'provinceName');
|
||||
|
||||
return;
|
||||
}
|
||||
if (select.val() === '' || select.val() == undefined) {
|
||||
provinceContainer.fadeOut('slow', () => {
|
||||
provinceContainer.html('');
|
||||
});
|
||||
|
||||
provinceContainer.attr('data-loading', true);
|
||||
return;
|
||||
}
|
||||
|
||||
$.get(provinceContainer.attr('data-url'), {countryCode: $(this).val()}, function (response) {
|
||||
if (!response.content) {
|
||||
provinceContainer.fadeOut('slow', function () {
|
||||
provinceContainer.html('');
|
||||
provinceContainer.attr('data-loading', true);
|
||||
|
||||
provinceContainer.removeAttr('data-loading');
|
||||
});
|
||||
} else if (-1 !== response.content.indexOf('select')) {
|
||||
provinceContainer.fadeOut('slow', function () {
|
||||
$.get(provinceContainer.attr('data-url'), { countryCode: select.val() }, (response) => {
|
||||
if (!response.content) {
|
||||
provinceContainer.fadeOut('slow', () => {
|
||||
provinceContainer.html('');
|
||||
|
||||
var provinceSelectValue = getProvinceInputValue(
|
||||
$(provinceContainer).find('select > option[selected$="selected"]').val()
|
||||
);
|
||||
provinceContainer.removeAttr('data-loading');
|
||||
});
|
||||
} else if (response.content.indexOf('select') !== -1) {
|
||||
provinceContainer.fadeOut('slow', () => {
|
||||
const provinceSelectValue = getProvinceInputValue((
|
||||
$(provinceContainer).find('select > option[selected$="selected"]').val()
|
||||
));
|
||||
|
||||
provinceContainer.html(response.content.replace(
|
||||
'name="sylius_address_province"',
|
||||
'name="' + provinceSelectFieldName + '"' + provinceSelectValue
|
||||
)
|
||||
.replace(
|
||||
'option value="" selected="selected"',
|
||||
'option value=""'
|
||||
)
|
||||
.replace(
|
||||
'option ' + provinceSelectValue,
|
||||
'option ' + provinceSelectValue + '" selected="selected"'
|
||||
));
|
||||
provinceContainer.html((
|
||||
response.content
|
||||
.replace('name="sylius_address_province"', `name="${provinceSelectFieldName}"${provinceSelectValue}`)
|
||||
.replace('option value="" selected="selected"', 'option value=""')
|
||||
.replace(`option ${provinceSelectValue}`, `option ${provinceSelectValue}" selected="selected"`)
|
||||
));
|
||||
|
||||
provinceContainer.removeAttr('data-loading');
|
||||
provinceContainer.removeAttr('data-loading');
|
||||
|
||||
provinceContainer.fadeIn();
|
||||
});
|
||||
} else {
|
||||
provinceContainer.fadeOut('slow', function () {
|
||||
provinceContainer.fadeIn();
|
||||
});
|
||||
} else {
|
||||
provinceContainer.fadeOut('slow', () => {
|
||||
const provinceInputValue = getProvinceInputValue($(provinceContainer).find('input').val());
|
||||
|
||||
var provinceInputValue = getProvinceInputValue($(provinceContainer).find('input').val());
|
||||
provinceContainer.html((
|
||||
response.content
|
||||
.replace('name="sylius_address_province"', `name="${provinceInputFieldName}"${provinceInputValue}`)
|
||||
));
|
||||
|
||||
provinceContainer.html(response.content.replace(
|
||||
'name="sylius_address_province"',
|
||||
'name="' + provinceInputFieldName + '"' + provinceInputValue
|
||||
));
|
||||
provinceContainer.removeAttr('data-loading');
|
||||
|
||||
provinceContainer.removeAttr('data-loading');
|
||||
|
||||
provinceContainer.fadeIn();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if('' !== countrySelect.val()) {
|
||||
countrySelect.trigger('change');
|
||||
}
|
||||
|
||||
if('' === $.trim($('div.province-container').text())) {
|
||||
$('select.country-select').trigger('change');
|
||||
}
|
||||
|
||||
var billingAddressCheckbox = $('input[type="checkbox"][name$="[differentBillingAddress]"]');
|
||||
var billingAddressContainer = $('#sylius-billing-address-container');
|
||||
var toggleBillingAddress = function() {
|
||||
billingAddressContainer.toggle(billingAddressCheckbox.prop('checked'));
|
||||
};
|
||||
toggleBillingAddress();
|
||||
billingAddressCheckbox.on('change', toggleBillingAddress);
|
||||
|
||||
var getProvinceInputValue = function (valueSelector) {
|
||||
return undefined == valueSelector ? '' : 'value="'+ valueSelector +'"';
|
||||
};
|
||||
provinceContainer.fadeIn();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
})( jQuery );
|
||||
|
||||
if (countrySelect.val() !== '') {
|
||||
countrySelect.trigger('change');
|
||||
}
|
||||
|
||||
if ($.trim($('div.province-container').text()) === '') {
|
||||
$('select.country-select').trigger('change');
|
||||
}
|
||||
|
||||
const billingAddressCheckbox = $('input[type="checkbox"][name$="[differentBillingAddress]"]');
|
||||
const billingAddressContainer = $('#sylius-billing-address-container');
|
||||
const toggleBillingAddress = function toggleBillingAddress() {
|
||||
billingAddressContainer.toggle(billingAddressCheckbox.prop('checked'));
|
||||
};
|
||||
toggleBillingAddress();
|
||||
billingAddressCheckbox.on('change', toggleBillingAddress);
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,31 +7,30 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/api';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
removeFromCart: function () {
|
||||
$.each($(this), function (index, element) {
|
||||
var redirectUrl = $(element).data('redirect');
|
||||
var csrfToken = $(element).data('csrf-token');
|
||||
$.fn.extend({
|
||||
removeFromCart() {
|
||||
this.each((index, element) => {
|
||||
const redirectUrl = $(element).data('redirect');
|
||||
const csrfToken = $(element).data('csrf-token');
|
||||
|
||||
$(element).api({
|
||||
method: 'DELETE',
|
||||
on: 'click',
|
||||
beforeSend: function (settings) {
|
||||
settings.data = {
|
||||
_csrf_token: csrfToken
|
||||
};
|
||||
$(element).api({
|
||||
method: 'DELETE',
|
||||
on: 'click',
|
||||
beforeSend(settings) {
|
||||
/* eslint-disable-next-line no-param-reassign */
|
||||
settings.data = {
|
||||
_csrf_token: csrfToken,
|
||||
};
|
||||
|
||||
return settings;
|
||||
},
|
||||
onSuccess: function (response) {
|
||||
window.location.replace(redirectUrl);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return settings;
|
||||
},
|
||||
onSuccess() {
|
||||
window.location.replace(redirectUrl);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
})( jQuery );
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,83 +7,79 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
variantImages: function () {
|
||||
if ($('[data-variant-options]').length > 0) {
|
||||
handleProductOptionImages();
|
||||
handleProductOptionChange();
|
||||
} else if ($('[data-variant-code]').length > 0) {
|
||||
handleProductVariantImages($('[name="sylius_add_to_cart[cartItem][variant]"]'));
|
||||
handleProductVariantChange();
|
||||
}
|
||||
}
|
||||
});
|
||||
})( jQuery );
|
||||
const changeMainImage = function changeMainImage(newImageDiv) {
|
||||
const mainImageLink = $('a.ui.fluid.image');
|
||||
const mainImage = $('a.ui.fluid.image > img');
|
||||
|
||||
function handleProductOptionChange() {
|
||||
$('[name*="sylius_add_to_cart[cartItem][variant]"]').on('change', function () {
|
||||
handleProductOptionImages();
|
||||
});
|
||||
}
|
||||
const newImage = $(newImageDiv).find('img');
|
||||
const newImageLink = $(newImageDiv).find('a');
|
||||
|
||||
function handleProductVariantChange() {
|
||||
$('[name="sylius_add_to_cart[cartItem][variant]"]').on('change', function () {
|
||||
handleProductVariantImages($(this))
|
||||
});
|
||||
}
|
||||
if (newImage.length === 0 && newImageLink.length === 0) {
|
||||
mainImage.attr('src', $('div[data-product-image]').attr('data-product-image'));
|
||||
newImageLink.attr('href', $('div[data-product-link]').attr('data-product-link'));
|
||||
|
||||
function handleProductOptionImages() {
|
||||
var options = '';
|
||||
return;
|
||||
}
|
||||
|
||||
$('#sylius-product-adding-to-cart select').each(function() {
|
||||
options += $(this).find('option:selected').val() + ' ';
|
||||
});
|
||||
mainImageLink.attr('href', newImageLink.attr('href'));
|
||||
mainImage.attr('src', newImage.attr('data-large-thumbnail'));
|
||||
};
|
||||
|
||||
var imagesWithOptions = [];
|
||||
var optionsArray = options.trim().split(' ');
|
||||
const handleProductOptionImages = function handleProductOptionImages() {
|
||||
let options = '';
|
||||
|
||||
$('[data-variant-options]').each(function () {
|
||||
var imageOptions = $(this).attr('data-variant-options');
|
||||
var imageHasOptions = optionsArray.every(function(option) {
|
||||
return imageOptions.indexOf(option) > -1;
|
||||
});
|
||||
$('#sylius-product-adding-to-cart select').each((index, select) => {
|
||||
options += `${$(select).find('option:selected').val()} `;
|
||||
});
|
||||
|
||||
if (imageHasOptions) {
|
||||
imagesWithOptions.push($(this).closest('div.ui.image'));
|
||||
}
|
||||
});
|
||||
const imagesWithOptions = [];
|
||||
const optionsArray = options.trim().split(' ');
|
||||
|
||||
changeMainImage(imagesWithOptions.shift());
|
||||
}
|
||||
$('[data-variant-options]').each((index, element) => {
|
||||
const imageOptions = $(element).attr('data-variant-options');
|
||||
const imageHasOptions = optionsArray.every(option => imageOptions.indexOf(option) > -1);
|
||||
|
||||
function handleProductVariantImages(element) {
|
||||
var variantCode = $(element).attr('value');
|
||||
var imagesWithVariantCode = [];
|
||||
|
||||
$('[data-variant-code*="'+ variantCode +'"]').each(function () {
|
||||
imagesWithVariantCode.push($(this).closest('div.ui.image'));
|
||||
});
|
||||
|
||||
changeMainImage(imagesWithVariantCode.shift());
|
||||
}
|
||||
|
||||
function changeMainImage(newImageDiv) {
|
||||
var mainImageLink = $('a.ui.fluid.image');
|
||||
var mainImage = $('a.ui.fluid.image > img');
|
||||
|
||||
var newImage = $(newImageDiv).find('img');
|
||||
var newImageLink = $(newImageDiv).find('a');
|
||||
|
||||
if (newImage.length == 0 && newImageLink.length == 0) {
|
||||
mainImage.attr('src', $('div[data-product-image]').attr('data-product-image'));
|
||||
newImageLink.attr('href', $('div[data-product-link]').attr('data-product-link'));
|
||||
|
||||
return;
|
||||
if (imageHasOptions) {
|
||||
imagesWithOptions.push($(element).closest('div.ui.image'));
|
||||
}
|
||||
});
|
||||
|
||||
mainImageLink.attr('href', newImageLink.attr('href'));
|
||||
mainImage.attr('src', newImage.attr('data-large-thumbnail'));
|
||||
}
|
||||
changeMainImage(imagesWithOptions.shift());
|
||||
};
|
||||
|
||||
const handleProductOptionChange = function handleProductOptionChange() {
|
||||
$('[name*="sylius_add_to_cart[cartItem][variant]"]').on('change', () => {
|
||||
handleProductOptionImages();
|
||||
});
|
||||
};
|
||||
|
||||
const handleProductVariantImages = function handleProductVariantImages(variantElement) {
|
||||
const variantCode = $(variantElement).attr('value');
|
||||
const imagesWithVariantCode = [];
|
||||
|
||||
$(`[data-variant-code*="${variantCode}"]`).each((index, element) => {
|
||||
imagesWithVariantCode.push($(element).closest('div.ui.image'));
|
||||
});
|
||||
|
||||
changeMainImage(imagesWithVariantCode.shift());
|
||||
};
|
||||
|
||||
const handleProductVariantChange = function handleProductVariantChange() {
|
||||
$('[name="sylius_add_to_cart[cartItem][variant]"]').on('change', (event) => {
|
||||
handleProductVariantImages($(event.currentTarget));
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
variantImages() {
|
||||
if ($('[data-variant-options]').length > 0) {
|
||||
handleProductOptionImages();
|
||||
handleProductOptionChange();
|
||||
} else if ($('[data-variant-code]').length > 0) {
|
||||
handleProductVariantImages($('[name="sylius_add_to_cart[cartItem][variant]"]'));
|
||||
handleProductVariantChange();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,44 +7,43 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
variantPrices: function () {
|
||||
if ($('#sylius-variants-pricing').length > 0) {
|
||||
handleProductOptionsChange();
|
||||
} else if ($("#sylius-product-variants").length > 0) {
|
||||
handleProductVariantsChange();
|
||||
}
|
||||
}
|
||||
const handleProductOptionsChange = function handleProductOptionsChange() {
|
||||
$('[name*="sylius_add_to_cart[cartItem][variant]"]').on('change', () => {
|
||||
let selector = '';
|
||||
|
||||
$('#sylius-product-adding-to-cart select[data-option]').each((index, element) => {
|
||||
const select = $(element);
|
||||
const option = select.find('option:selected').val();
|
||||
selector += `[data-${select.attr('data-option')}="${option}"]`;
|
||||
});
|
||||
})( jQuery );
|
||||
|
||||
function handleProductOptionsChange() {
|
||||
$('[name*="sylius_add_to_cart[cartItem][variant]"]').on('change', function() {
|
||||
var $selector = '';
|
||||
const price = $('#sylius-variants-pricing').find(selector).attr('data-value');
|
||||
|
||||
$('#sylius-product-adding-to-cart select[data-option]').each(function() {
|
||||
var option = $(this).find('option:selected').val();
|
||||
$selector += '[data-' + $(this).attr('data-option') + '="' + option + '"]';
|
||||
});
|
||||
if (price !== undefined) {
|
||||
$('#product-price').text(price);
|
||||
$('button[type=submit]').removeAttr('disabled');
|
||||
} else {
|
||||
$('#product-price').text($('#sylius-variants-pricing').attr('data-unavailable-text'));
|
||||
$('button[type=submit]').attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var $price = $('#sylius-variants-pricing').find($selector).attr('data-value');
|
||||
const handleProductVariantsChange = function handleProductVariantsChange() {
|
||||
$('[name="sylius_add_to_cart[cartItem][variant]"]').on('change', (event) => {
|
||||
const price = $(event.currentTarget).parents('tr').find('.sylius-product-variant-price').text();
|
||||
$('#product-price').text(price);
|
||||
});
|
||||
};
|
||||
|
||||
if ($price !== undefined) {
|
||||
$('#product-price').text($price);
|
||||
$('button[type=submit]').removeAttr('disabled');
|
||||
} else {
|
||||
$('#product-price').text($('#sylius-variants-pricing').attr('data-unavailable-text'));
|
||||
$('button[type=submit]').attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleProductVariantsChange() {
|
||||
$('[name="sylius_add_to_cart[cartItem][variant]"]').on('change', function() {
|
||||
var $price = $(this).parents('tr').find('.sylius-product-variant-price').text();
|
||||
$('#product-price').text($price);
|
||||
});
|
||||
}
|
||||
$.fn.extend({
|
||||
variantPrices() {
|
||||
if ($('#sylius-variants-pricing').length > 0) {
|
||||
handleProductOptionsChange();
|
||||
} else if ($('#sylius-product-variants').length > 0) {
|
||||
handleProductVariantsChange();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
import { rollup } from 'rollup';
|
||||
import { uglify } from 'rollup-plugin-uglify';
|
||||
import babel from 'rollup-plugin-babel';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import concat from 'gulp-concat';
|
||||
import dedent from 'dedent';
|
||||
import gulp from 'gulp';
|
||||
import gulpif from 'gulp-if';
|
||||
import inject from 'rollup-plugin-inject';
|
||||
import livereload from 'gulp-livereload';
|
||||
import merge from 'merge-stream';
|
||||
import order from 'gulp-order';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import sass from 'gulp-sass';
|
||||
import sourcemaps from 'gulp-sourcemaps';
|
||||
import uglify from 'gulp-uglify';
|
||||
import uglifycss from 'gulp-uglifycss';
|
||||
import upath from 'upath';
|
||||
import yargs from 'yargs';
|
||||
|
|
@ -34,6 +40,11 @@ const { argv } = yargs
|
|||
});
|
||||
|
||||
const env = process.env.GULP_ENV;
|
||||
const options = {
|
||||
minify: env === 'prod',
|
||||
sourcemaps: env !== 'prod',
|
||||
};
|
||||
|
||||
const rootPath = upath.normalizeSafe(argv.rootPath);
|
||||
const shopRootPath = upath.joinSafe(rootPath, 'shop');
|
||||
const vendorPath = upath.normalizeSafe(argv.vendorPath || '.');
|
||||
|
|
@ -44,9 +55,6 @@ const nodeModulesPath = upath.normalizeSafe(argv.nodeModulesPath);
|
|||
const paths = {
|
||||
shop: {
|
||||
js: [
|
||||
upath.joinSafe(nodeModulesPath, 'jquery/dist/jquery.min.js'),
|
||||
upath.joinSafe(nodeModulesPath, 'semantic-ui-css/semantic.min.js'),
|
||||
upath.joinSafe(nodeModulesPath, 'lightbox2/dist/js/lightbox.js'),
|
||||
upath.joinSafe(vendorUiPath, 'Resources/private/js/**'),
|
||||
upath.joinSafe(vendorShopPath, 'Resources/private/js/**'),
|
||||
],
|
||||
|
|
@ -83,7 +91,7 @@ const sourcePathMap = [
|
|||
},
|
||||
];
|
||||
|
||||
const mapSourcePath = function mapSourcePath(sourcePath /* , file */) {
|
||||
const mapSourcePath = function mapSourcePath(sourcePath) {
|
||||
const match = sourcePathMap.find(({ sourceDir }) => (
|
||||
sourcePath.substring(0, sourceDir.length) === sourceDir
|
||||
));
|
||||
|
|
@ -97,15 +105,89 @@ const mapSourcePath = function mapSourcePath(sourcePath /* , file */) {
|
|||
return upath.joinSafe(destPath, sourcePath.substring(sourceDir.length));
|
||||
};
|
||||
|
||||
export const buildShopJs = function buildShopJs() {
|
||||
return gulp.src(paths.shop.js, { base: './' })
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.init()))
|
||||
.pipe(concat('app.js'))
|
||||
.pipe(gulpif(env === 'prod', uglify()))
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.mapSources(mapSourcePath)))
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.write('./')))
|
||||
.pipe(gulp.dest(upath.joinSafe(shopRootPath, 'js')))
|
||||
.pipe(livereload());
|
||||
export const buildShopJs = async function buildShopJs() {
|
||||
const bundle = await rollup({
|
||||
input: upath.joinSafe(vendorShopPath, 'Resources/private/js/app.js'),
|
||||
plugins: [
|
||||
{
|
||||
name: 'shim-app',
|
||||
|
||||
transform(code, id) {
|
||||
if (upath.relative('', id) === upath.relative('', upath.joinSafe(vendorShopPath, 'Resources/private/js/app.js'))) {
|
||||
return {
|
||||
code: dedent`
|
||||
import './shim/shim-polyfill';
|
||||
import './shim/shim-jquery';
|
||||
import './shim/shim-semantic-ui';
|
||||
import './shim/shim-lightbox';
|
||||
|
||||
${code}
|
||||
`,
|
||||
map: null,
|
||||
};
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
},
|
||||
inject({
|
||||
include: `${nodeModulesPath}/**`,
|
||||
modules: {
|
||||
$: 'jquery',
|
||||
jQuery: 'jquery',
|
||||
},
|
||||
}),
|
||||
resolve({
|
||||
jail: upath.resolve(nodeModulesPath),
|
||||
}),
|
||||
commonjs({
|
||||
include: `${nodeModulesPath}/**`,
|
||||
}),
|
||||
babel({
|
||||
babelrc: false,
|
||||
exclude: `${nodeModulesPath}/**`,
|
||||
presets: [
|
||||
['env', {
|
||||
targets: {
|
||||
browsers: [
|
||||
'last 2 versions',
|
||||
'Firefox ESR',
|
||||
'IE >= 9',
|
||||
'Android >= 4.0',
|
||||
'iOS >= 7',
|
||||
],
|
||||
},
|
||||
modules: false,
|
||||
exclude: [
|
||||
'transform-async-to-generator',
|
||||
'transform-regenerator',
|
||||
],
|
||||
useBuiltIns: true,
|
||||
}],
|
||||
],
|
||||
plugins: [
|
||||
['external-helpers'],
|
||||
['fast-async'],
|
||||
['module-resolver', {
|
||||
alias: {
|
||||
'sylius/ui': upath.relative('', upath.joinSafe(vendorUiPath, 'Resources/private/js')),
|
||||
},
|
||||
}],
|
||||
['transform-object-rest-spread', {
|
||||
useBuiltIns: false,
|
||||
}],
|
||||
],
|
||||
}),
|
||||
options.minify && uglify(),
|
||||
],
|
||||
treeshake: false,
|
||||
});
|
||||
|
||||
await bundle.write({
|
||||
file: upath.joinSafe(shopRootPath, 'js/app.js'),
|
||||
format: 'iife',
|
||||
sourcemap: options.sourcemaps,
|
||||
});
|
||||
};
|
||||
buildShopJs.description = 'Build shop js assets.';
|
||||
|
||||
|
|
@ -116,11 +198,11 @@ export const buildShopCss = function buildShopCss() {
|
|||
);
|
||||
|
||||
const cssStream = gulp.src(paths.shop.css, { base: './' })
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.init()))
|
||||
.pipe(gulpif(options.sourcemaps, sourcemaps.init()))
|
||||
.pipe(concat('css-files.css'));
|
||||
|
||||
const sassStream = gulp.src(paths.shop.sass, { base: './' })
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.init()))
|
||||
.pipe(gulpif(options.sourcemaps, sourcemaps.init()))
|
||||
.pipe(sass())
|
||||
.pipe(concat('sass-files.scss'));
|
||||
|
||||
|
|
@ -129,9 +211,9 @@ export const buildShopCss = function buildShopCss() {
|
|||
merge(cssStream, sassStream)
|
||||
.pipe(order(['css-files.css', 'sass-files.scss']))
|
||||
.pipe(concat('style.css'))
|
||||
.pipe(gulpif(env === 'prod', uglifycss()))
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.mapSources(mapSourcePath)))
|
||||
.pipe(gulpif(env !== 'prod', sourcemaps.write('./')))
|
||||
.pipe(gulpif(options.minify, uglifycss()))
|
||||
.pipe(gulpif(options.sourcemaps, sourcemaps.mapSources(mapSourcePath)))
|
||||
.pipe(gulpif(options.sourcemaps, sourcemaps.write('./')))
|
||||
.pipe(gulp.dest(upath.joinSafe(shopRootPath, 'css')))
|
||||
.pipe(livereload()),
|
||||
);
|
||||
|
|
|
|||
20
src/Sylius/Bundle/UiBundle/Resources/private/.eslintrc.js
Normal file
20
src/Sylius/Bundle/UiBundle/Resources/private/.eslintrc.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
module.exports = {
|
||||
extends: 'airbnb-base',
|
||||
env: {
|
||||
browser: true,
|
||||
},
|
||||
rules: {
|
||||
'object-shorthand': ['error', 'always', {
|
||||
avoidQuotes: true,
|
||||
avoidExplicitReturnArrows: true,
|
||||
}],
|
||||
'function-paren-newline': ['error', 'consistent'],
|
||||
'max-len': ['warn', 120, 2, {
|
||||
ignoreUrls: true,
|
||||
ignoreComments: false,
|
||||
ignoreRegExpLiterals: true,
|
||||
ignoreStrings: true,
|
||||
ignoreTemplateLiterals: true,
|
||||
}],
|
||||
},
|
||||
};
|
||||
|
|
@ -7,45 +7,57 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
$(document).ready(function() {
|
||||
$('#sidebar').addClass('visible');
|
||||
$('#sidebar').sidebar('attach events', '#sidebar-toggle', 'toggle');
|
||||
$('#sidebar').sidebar('setting', {
|
||||
dimPage: false,
|
||||
closable: false
|
||||
});
|
||||
import 'semantic-ui-css/components/accordion';
|
||||
import 'semantic-ui-css/components/checkbox';
|
||||
import 'semantic-ui-css/components/dimmer';
|
||||
import 'semantic-ui-css/components/dropdown';
|
||||
import 'semantic-ui-css/components/rating';
|
||||
import 'semantic-ui-css/components/sidebar';
|
||||
import 'semantic-ui-css/components/tab';
|
||||
import 'semantic-ui-css/components/transition';
|
||||
import $ from 'jquery';
|
||||
|
||||
$('.ui.checkbox').checkbox();
|
||||
$('.ui.accordion').accordion();
|
||||
$('.ui.menu .dropdown').dropdown({action: 'hide'});
|
||||
$('.ui.inline.dropdown').dropdown();
|
||||
$('.link.ui.dropdown').dropdown({action: 'hide'});
|
||||
$('.button.ui.dropdown').dropdown({action: 'hide'});
|
||||
$('.ui.fluid.search.selection.ui.dropdown').dropdown();
|
||||
$('.menu .item').tab();
|
||||
$('.card .image').dimmer({on: 'hover'});
|
||||
$('.ui.rating').rating('disable');
|
||||
|
||||
$('form.loadable button').on('click', function() {
|
||||
return $(this).closest('form').addClass('loading');
|
||||
});
|
||||
$('.loadable.button').on('click', function() {
|
||||
return $(this).addClass('loading');
|
||||
});
|
||||
$('.message .close').on('click', function() {
|
||||
return $(this).closest('.message').transition('fade');
|
||||
});
|
||||
|
||||
$('[data-requires-confirmation]').requireConfirmation();
|
||||
$('[data-bulk-action-requires-confirmation]').bulkActionRequireConfirmation();
|
||||
$('[data-toggles]').toggleElement();
|
||||
|
||||
$('.special.cards .image').dimmer({
|
||||
on: 'hover'
|
||||
});
|
||||
|
||||
$('[data-form-type="collection"]').CollectionForm();
|
||||
import './sylius-bulk-action-require-confirmation';
|
||||
import './sylius-form-collection';
|
||||
import './sylius-require-confirmation';
|
||||
import './sylius-toggle';
|
||||
|
||||
$(document).ready(() => {
|
||||
$('#sidebar').addClass('visible');
|
||||
$('#sidebar').sidebar('attach events', '#sidebar-toggle', 'toggle');
|
||||
$('#sidebar').sidebar('setting', {
|
||||
dimPage: false,
|
||||
closable: false,
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
$('.ui.checkbox').checkbox();
|
||||
$('.ui.accordion').accordion();
|
||||
$('.ui.menu .dropdown').dropdown({ action: 'hide' });
|
||||
$('.ui.inline.dropdown').dropdown();
|
||||
$('.link.ui.dropdown').dropdown({ action: 'hide' });
|
||||
$('.button.ui.dropdown').dropdown({ action: 'hide' });
|
||||
$('.ui.fluid.search.selection.ui.dropdown').dropdown();
|
||||
$('.menu .item').tab();
|
||||
$('.card .image').dimmer({ on: 'hover' });
|
||||
$('.ui.rating').rating('disable');
|
||||
|
||||
$('form.loadable button').on('click', (event) => {
|
||||
$(event.currentTarget).closest('form').addClass('loading');
|
||||
});
|
||||
$('.loadable.button').on('click', (event) => {
|
||||
$(event.currentTarget).addClass('loading');
|
||||
});
|
||||
$('.message .close').on('click', (event) => {
|
||||
$(event.currentTarget).closest('.message').transition('fade');
|
||||
});
|
||||
|
||||
$('[data-requires-confirmation]').requireConfirmation();
|
||||
$('[data-bulk-action-requires-confirmation]').bulkActionRequireConfirmation();
|
||||
$('[data-toggles]').toggleElement();
|
||||
|
||||
$('.special.cards .image').dimmer({
|
||||
on: 'hover',
|
||||
});
|
||||
|
||||
$('[data-form-type="collection"]').CollectionForm();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,50 +7,53 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/api';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
apiLogin: function (apiSettings) {
|
||||
var element = $(this);
|
||||
var apiSettings = apiSettings;
|
||||
var passwordField = element.find('input[type=\'password\']');
|
||||
var emailField = element.find('input[type=\'email\']');
|
||||
var csrfTokenField = element.find('input[type=\'hidden\']');
|
||||
var signInButton = element.find('.button');
|
||||
var validationField = element.find('.red.label');
|
||||
$.fn.extend({
|
||||
apiLogin({
|
||||
method,
|
||||
dataType = 'json',
|
||||
throttle = 0,
|
||||
debug = false,
|
||||
}) {
|
||||
const element = this;
|
||||
const passwordField = element.find('input[type="password"]');
|
||||
const emailField = element.find('input[type="email"]');
|
||||
const csrfTokenField = element.find('input[type="hidden"]');
|
||||
const signInButton = element.find('.button');
|
||||
const validationField = element.find('.red.label');
|
||||
|
||||
signInButton.api({
|
||||
method: apiSettings.method,
|
||||
dataType: apiSettings.dataType || 'json',
|
||||
throttle: apiSettings.throttle || 0,
|
||||
debug: apiSettings.debug || false,
|
||||
signInButton.api({
|
||||
method,
|
||||
dataType,
|
||||
throttle,
|
||||
debug,
|
||||
|
||||
beforeSend: function (settings) {
|
||||
settings.data = {
|
||||
_username: emailField.val(),
|
||||
_password: passwordField.val()
|
||||
};
|
||||
settings.data[csrfTokenField.attr('name')] = csrfTokenField.val();
|
||||
beforeSend(settings) {
|
||||
/* eslint-disable-next-line no-param-reassign */
|
||||
settings.data = {
|
||||
_username: emailField.val(),
|
||||
_password: passwordField.val(),
|
||||
[csrfTokenField.attr('name')]: csrfTokenField.val(),
|
||||
};
|
||||
|
||||
return settings;
|
||||
},
|
||||
return settings;
|
||||
},
|
||||
|
||||
successTest: function (response) {
|
||||
return response.success;
|
||||
},
|
||||
successTest(response) {
|
||||
return response.success;
|
||||
},
|
||||
|
||||
onSuccess: function (response) {
|
||||
element.remove();
|
||||
location.reload();
|
||||
},
|
||||
onSuccess() {
|
||||
element.remove();
|
||||
window.location.reload();
|
||||
},
|
||||
|
||||
onFailure: function (response) {
|
||||
validationField.removeClass('hidden');
|
||||
validationField.html(response.message);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
onFailure(response) {
|
||||
validationField.removeClass('hidden');
|
||||
validationField.html(response.message);
|
||||
},
|
||||
});
|
||||
})( jQuery );
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,38 +7,40 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/api';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
apiToggle: function (apiSettings, toggleableElement, isHidden) {
|
||||
var element = $(this);
|
||||
var apiSettings = apiSettings;
|
||||
var toggleableElement = toggleableElement;
|
||||
var isHidden = isHidden || true;
|
||||
$.fn.extend({
|
||||
apiToggle({
|
||||
method,
|
||||
dataType = 'json',
|
||||
throttle = 0,
|
||||
debug = false,
|
||||
beforeSend,
|
||||
successTest,
|
||||
}, toggleableElement, isHidden = true) {
|
||||
const element = this;
|
||||
|
||||
if (isHidden) {
|
||||
toggleableElement.hide();
|
||||
}
|
||||
if (isHidden) {
|
||||
toggleableElement.hide();
|
||||
}
|
||||
|
||||
element.api({
|
||||
method: apiSettings.method,
|
||||
dataType: apiSettings.dataType || 'json',
|
||||
throttle: apiSettings.throttle || 0,
|
||||
debug: apiSettings.debug || false,
|
||||
element.api({
|
||||
method,
|
||||
dataType,
|
||||
throttle,
|
||||
debug,
|
||||
|
||||
beforeSend: apiSettings.beforeSend,
|
||||
successTest: apiSettings.successTest,
|
||||
beforeSend,
|
||||
successTest,
|
||||
|
||||
onSuccess: function (response) {
|
||||
toggleableElement.show();
|
||||
},
|
||||
onSuccess() {
|
||||
toggleableElement.show();
|
||||
},
|
||||
|
||||
onFailure: function (response) {
|
||||
toggleableElement.hide();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
onFailure() {
|
||||
toggleableElement.hide();
|
||||
},
|
||||
});
|
||||
})( jQuery );
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,77 +7,71 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/dropdown';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
autoComplete: function () {
|
||||
$(this).each(function () {
|
||||
var element = $(this);
|
||||
var criteriaName = $(this).data('criteria-name');
|
||||
var choiceName = $(this).data('choice-name');
|
||||
var choiceValue = $(this).data('choice-value');
|
||||
var autocompleteValue = $(this).find('input.autocomplete').val();
|
||||
var loadForEditUrl = $(this).data('load-edit-url');
|
||||
$.fn.extend({
|
||||
autoComplete() {
|
||||
this.each((idx, el) => {
|
||||
const element = $(el);
|
||||
const criteriaName = element.data('criteria-name');
|
||||
const choiceName = element.data('choice-name');
|
||||
const choiceValue = element.data('choice-value');
|
||||
const autocompleteValue = element.find('input.autocomplete').val();
|
||||
const loadForEditUrl = element.data('load-edit-url');
|
||||
|
||||
element.dropdown({
|
||||
delay: {
|
||||
search: 250
|
||||
},
|
||||
forceSelection: false,
|
||||
apiSettings: {
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
beforeSend: function(settings) {
|
||||
settings.data[criteriaName] = settings.urlData.query;
|
||||
element.dropdown({
|
||||
delay: {
|
||||
search: 250,
|
||||
},
|
||||
forceSelection: false,
|
||||
apiSettings: {
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
beforeSend(settings) {
|
||||
/* eslint-disable-next-line no-param-reassign */
|
||||
settings.data[criteriaName] = settings.urlData.query;
|
||||
|
||||
return settings;
|
||||
},
|
||||
onResponse: function (response) {
|
||||
var choiceName = element.data('choice-name');
|
||||
var choiceValue = element.data('choice-value');
|
||||
var myResults = [];
|
||||
$.each(response, function (index, item) {
|
||||
myResults.push({
|
||||
name: item[choiceName],
|
||||
value: item[choiceValue]
|
||||
});
|
||||
});
|
||||
return settings;
|
||||
},
|
||||
onResponse(response) {
|
||||
return {
|
||||
success: true,
|
||||
results: response.map(item => ({
|
||||
name: item[choiceName],
|
||||
value: item[choiceValue],
|
||||
})),
|
||||
};
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
success: true,
|
||||
results: myResults
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
if (autocompleteValue.split(',').filter(String).length > 0) {
|
||||
const menuElement = element.find('div.menu');
|
||||
|
||||
if (0 < autocompleteValue.split(',').filter(String).length) {
|
||||
var menuElement = element.find('div.menu');
|
||||
menuElement.api({
|
||||
on: 'now',
|
||||
method: 'GET',
|
||||
url: loadForEditUrl,
|
||||
beforeSend(settings) {
|
||||
/* eslint-disable-next-line no-param-reassign */
|
||||
settings.data[choiceValue] = autocompleteValue.split(',').filter(String);
|
||||
|
||||
menuElement.api({
|
||||
on: 'now',
|
||||
method: 'GET',
|
||||
url: loadForEditUrl,
|
||||
beforeSend: function (settings) {
|
||||
settings.data[choiceValue] = autocompleteValue.split(',').filter(String);
|
||||
|
||||
return settings;
|
||||
},
|
||||
onSuccess: function (response) {
|
||||
$.each(response, function (index, item) {
|
||||
menuElement.append(
|
||||
$('<div class="item" data-value="'+item[choiceValue]+'">'+item[choiceName]+'</div>')
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.setTimeout(function () {
|
||||
element.dropdown('set selected', element.find('input.autocomplete').val().split(',').filter(String));
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
return settings;
|
||||
},
|
||||
onSuccess(response) {
|
||||
response.forEach((item) => {
|
||||
menuElement.append((
|
||||
$(`<div class="item" data-value="${item[choiceValue]}">${item[choiceName]}</div>`)
|
||||
));
|
||||
});
|
||||
},
|
||||
});
|
||||
})( jQuery );
|
||||
}
|
||||
|
||||
window.setTimeout(() => {
|
||||
element.dropdown('set selected', element.find('input.autocomplete').val().split(',').filter(String));
|
||||
}, 5000);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,37 +7,36 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/modal';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
bulkActionRequireConfirmation: function() {
|
||||
return this.each(function() {
|
||||
return $(this).on('click', function(event) {
|
||||
event.preventDefault();
|
||||
$.fn.extend({
|
||||
bulkActionRequireConfirmation() {
|
||||
this.each((idx, el) => {
|
||||
$(el).on('click', (evt) => {
|
||||
evt.preventDefault();
|
||||
|
||||
var actionButton = $(this);
|
||||
const actionButton = $(evt.currentTarget);
|
||||
|
||||
if (actionButton.is('a')) {
|
||||
$('#confirmation-button').attr('href', actionButton.attr('href'));
|
||||
}
|
||||
|
||||
if (actionButton.is('button')) {
|
||||
$('#confirmation-button').on('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var form = actionButton.closest('form');
|
||||
$('input.bulk-select-checkbox:checked').each(function() {
|
||||
$('<input type="hidden" name="ids[]" value="' + this.value + '">').appendTo(form);
|
||||
});
|
||||
|
||||
return form.submit();
|
||||
});
|
||||
}
|
||||
|
||||
return $('#confirmation-modal').modal('show');
|
||||
});
|
||||
});
|
||||
if (actionButton.is('a')) {
|
||||
$('#confirmation-button').attr('href', actionButton.attr('href'));
|
||||
}
|
||||
|
||||
if (actionButton.is('button')) {
|
||||
$('#confirmation-button').on('click', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const form = actionButton.closest('form');
|
||||
$('input.bulk-select-checkbox:checked').each((index, element) => {
|
||||
$(`<input type="hidden" name="ids[]" value="${element.value}">`).appendTo(form);
|
||||
});
|
||||
|
||||
form.submit();
|
||||
});
|
||||
}
|
||||
|
||||
$('#confirmation-modal').modal('show');
|
||||
});
|
||||
});
|
||||
})( jQuery );
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,158 +7,126 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
!function($){
|
||||
import $ from 'jquery';
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* Collection Form plugin
|
||||
*
|
||||
* @param element
|
||||
* @constructor
|
||||
*/
|
||||
class CollectionForm {
|
||||
constructor(element) {
|
||||
this.addItem = this.addItem.bind(this);
|
||||
this.updateItem = this.updateItem.bind(this);
|
||||
this.deleteItem = this.constructor.deleteItem;
|
||||
this.updatePrototype = this.updatePrototype.bind(this);
|
||||
|
||||
/**
|
||||
* Collection Form plugin
|
||||
*
|
||||
* @param element
|
||||
* @constructor
|
||||
*/
|
||||
var CollectionForm = function (element) {
|
||||
this.$element = $(element);
|
||||
this.$list = this.$element.find('[data-form-collection="list"]:first');
|
||||
this.count = this.$list.children().length;
|
||||
this.lastChoice = null;
|
||||
this.$element = $(element);
|
||||
this.$list = this.$element.find('[data-form-collection="list"]:first');
|
||||
this.count = this.$list.children().length;
|
||||
this.lastChoice = null;
|
||||
this.$element.on('click', '[data-form-collection="add"]:last', this.addItem);
|
||||
this.$element.on('click', '[data-form-collection="delete"]', this.deleteItem);
|
||||
this.$element.on('change', '[data-form-collection="update"]', this.updateItem);
|
||||
$(document).on('change', '[data-form-prototype="update"]', this.updatePrototype);
|
||||
$(document).on('collection-form-add', (event, addedElement) => {
|
||||
$(addedElement).find('[data-form-type="collection"]').CollectionForm();
|
||||
$(document).trigger('dom-node-inserted', [$(addedElement)]);
|
||||
});
|
||||
}
|
||||
|
||||
this.$element.on(
|
||||
'click',
|
||||
'[data-form-collection="add"]:last',
|
||||
$.proxy(this.addItem, this)
|
||||
);
|
||||
/**
|
||||
* Add a item to the collection.
|
||||
* @param event
|
||||
*/
|
||||
addItem(event) {
|
||||
event.preventDefault();
|
||||
|
||||
this.$element.on(
|
||||
'click',
|
||||
'[data-form-collection="delete"]',
|
||||
$.proxy(this.deleteItem, this)
|
||||
);
|
||||
let prototype = this.$element.data('prototype');
|
||||
|
||||
this.$element.on(
|
||||
'change',
|
||||
'[data-form-collection="update"]',
|
||||
$.proxy(this.updateItem, this)
|
||||
);
|
||||
prototype = prototype.replace(/__name__/g, this.count);
|
||||
|
||||
$(document).on(
|
||||
'change',
|
||||
'[data-form-prototype="update"]',
|
||||
$.proxy(this.updatePrototype, this)
|
||||
);
|
||||
this.$list.append(prototype);
|
||||
this.count = this.count + 1;
|
||||
|
||||
$(document).on('collection-form-add', function(e, addedElement) {
|
||||
$(addedElement).find('[data-form-type="collection"]').CollectionForm();
|
||||
$(document).trigger('dom-node-inserted', [$(addedElement)]);
|
||||
});
|
||||
$(document).trigger('collection-form-add', [this.$list.children().last()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update item from the collection
|
||||
*/
|
||||
updateItem(event) {
|
||||
event.preventDefault();
|
||||
const $element = $(event.currentTarget);
|
||||
const url = $element.data('form-url');
|
||||
const value = $element.val();
|
||||
const $container = $element.closest('[data-form-collection="item"]');
|
||||
const index = $container.data('form-collection-index');
|
||||
const position = $container.data('form-collection-index');
|
||||
|
||||
if (url) {
|
||||
$container.load(url, { id: value, position });
|
||||
} else {
|
||||
let prototype = this.$element.find(`[data-form-prototype="${value}"]`).val();
|
||||
|
||||
prototype = prototype.replace(/__name__/g, index);
|
||||
|
||||
$container.replaceWith(prototype);
|
||||
}
|
||||
CollectionForm.prototype = {
|
||||
constructor : CollectionForm,
|
||||
$(document).trigger('collection-form-update', [$(event.currentTarget)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a item to the collection.
|
||||
* @param event
|
||||
*/
|
||||
addItem: function (event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* Delete item from the collection
|
||||
* @param event
|
||||
*/
|
||||
static deleteItem(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var prototype = this.$element.data('prototype');
|
||||
$(event.currentTarget)
|
||||
.closest('[data-form-collection="item"]')
|
||||
.remove();
|
||||
|
||||
prototype = prototype.replace(
|
||||
/__name__/g,
|
||||
this.count
|
||||
);
|
||||
$(document).trigger('collection-form-delete', [$(event.currentTarget)]);
|
||||
}
|
||||
|
||||
this.$list.append(prototype);
|
||||
this.count = this.count + 1;
|
||||
/**
|
||||
* Update the prototype
|
||||
* @param event
|
||||
*/
|
||||
updatePrototype(event) {
|
||||
const $target = $(event.currentTarget);
|
||||
let prototypeName = $target.val();
|
||||
|
||||
$(document).trigger('collection-form-add', [this.$list.children().last()]);
|
||||
},
|
||||
if ($target.data('form-prototype-prefix') !== undefined) {
|
||||
prototypeName = $target.data('form-prototype-prefix') + prototypeName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update item from the collection
|
||||
*/
|
||||
updateItem: function (event) {
|
||||
event.preventDefault();
|
||||
var $element = $(event.currentTarget),
|
||||
url = $element.data('form-url'),
|
||||
value = $element.val(),
|
||||
$container = $element.closest('[data-form-collection="item"]'),
|
||||
index = $container.data('form-collection-index'),
|
||||
position = $container.data('form-collection-index');
|
||||
if (url) {
|
||||
$container.load(url, {'id' : value, 'position' : position});
|
||||
} else {
|
||||
var prototype = this.$element.find('[data-form-prototype="'+ value +'"]').val();
|
||||
if (this.lastChoice !== null && this.lastChoice !== prototypeName) {
|
||||
this.$list.html('');
|
||||
}
|
||||
|
||||
prototype = prototype.replace(
|
||||
/__name__/g,
|
||||
index
|
||||
);
|
||||
this.lastChoice = prototypeName;
|
||||
|
||||
$container.replaceWith(prototype);
|
||||
}
|
||||
$(document).trigger('collection-form-update', [$(event.currentTarget)]);
|
||||
},
|
||||
this.$element.data('prototype', this.$element.find(`[data-form-prototype="${prototypeName}"]`).val());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete item from the collection
|
||||
* @param event
|
||||
*/
|
||||
deleteItem: function (event) {
|
||||
event.preventDefault();
|
||||
/*
|
||||
* Plugin definition
|
||||
*/
|
||||
|
||||
$(event.currentTarget)
|
||||
.closest('[data-form-collection="item"]')
|
||||
.remove();
|
||||
$.fn.CollectionForm = function CollectionFormPlugin(option) {
|
||||
this.each((idx, el) => {
|
||||
const $element = $(el);
|
||||
const data = $element.data('collectionForm');
|
||||
const options = typeof option === 'object' && option;
|
||||
|
||||
$(document).trigger('collection-form-delete', [$(event.currentTarget)]);
|
||||
},
|
||||
if (!data) {
|
||||
$element.data('collectionForm', new CollectionForm(el, options));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the prototype
|
||||
* @param event
|
||||
*/
|
||||
updatePrototype: function (event) {
|
||||
var $target = $(event.currentTarget);
|
||||
var prototypeName = $target.val();
|
||||
|
||||
if (undefined !== $target.data('form-prototype-prefix')) {
|
||||
prototypeName = $target.data('form-prototype-prefix') + prototypeName;
|
||||
}
|
||||
|
||||
if (null !== this.lastChoice && this.lastChoice !== prototypeName) {
|
||||
this.$list.html('');
|
||||
}
|
||||
|
||||
this.lastChoice = prototypeName;
|
||||
|
||||
this.$element.data(
|
||||
'prototype',
|
||||
this.$element.find('[data-form-prototype="'+ prototypeName +'"]').val()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Plugin definition
|
||||
*/
|
||||
|
||||
$.fn.CollectionForm = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
var data = $this.data('collectionForm');
|
||||
var options = typeof option == 'object' && option;
|
||||
|
||||
if (!data) {
|
||||
$this.data(
|
||||
'collectionForm',
|
||||
(data = new CollectionForm(this, options))
|
||||
)
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
$.fn.CollectionForm.Constructor = CollectionForm;
|
||||
|
||||
}(jQuery);
|
||||
$.fn.CollectionForm.Constructor = CollectionForm;
|
||||
|
|
|
|||
|
|
@ -7,118 +7,117 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/dropdown';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
productAttributes: function () {
|
||||
setAttributeChoiceListener();
|
||||
const getNextIndex = function getNextIndex() {
|
||||
return $('#attributesContainer').attr('data-count');
|
||||
};
|
||||
|
||||
$(this).dropdown({
|
||||
onRemove: function(removedValue, removedText, $removedChoice) {
|
||||
modifyAttributesListOnSelectorElementDelete(removedValue);
|
||||
},
|
||||
forceSelection: false
|
||||
});
|
||||
const addAttributesNumber = function addAttributesNumber(number) {
|
||||
const currentIndex = parseInt(getNextIndex(), 10);
|
||||
$('#attributesContainer').attr('data-count', currentIndex + number);
|
||||
};
|
||||
|
||||
controlAttributesList();
|
||||
modifySelectorOnAttributesListElementDelete();
|
||||
const controlAttributesList = function controlAttributesList() {
|
||||
$('#attributesContainer .attribute').each((index, element) => {
|
||||
const value = $(element).attr('data-id');
|
||||
$('#sylius_product_attribute_choice').dropdown('set selected', value);
|
||||
});
|
||||
};
|
||||
|
||||
const modifyAttributesListOnSelectorElementDelete = function modifyAttributesListOnSelectorElementDelete(removedValue) {
|
||||
$(`#attributesContainer .attribute[data-id="${removedValue}"]`).remove();
|
||||
};
|
||||
|
||||
const modifySelectorOnAttributesListElementDelete = function modifySelectorOnAttributesListElementDelete() {
|
||||
$('.attribute button').off('click').on('click', (event) => {
|
||||
const attributeId = $(event.currentTarget).parents('.attribute').attr('data-id');
|
||||
|
||||
$('div#attributeChoice > .ui.dropdown.search').dropdown('remove selected', attributeId);
|
||||
modifyAttributesListOnSelectorElementDelete(attributeId);
|
||||
});
|
||||
};
|
||||
|
||||
const modifyAttributeFormElements = function modifyAttributeFormElements($response) {
|
||||
$response.find('input,select,textarea').each((index, element) => {
|
||||
if ($(element).attr('data-name') != null) {
|
||||
$(element).attr('name', $(element).attr('data-name'));
|
||||
}
|
||||
});
|
||||
|
||||
return $response;
|
||||
};
|
||||
|
||||
const isInTheAttributesContainer = function isInTheAttributesContainer(attributeId) {
|
||||
let result = false;
|
||||
$('#attributesContainer .attribute').each((index, element) => {
|
||||
const dataId = $(element).attr('data-id');
|
||||
if (dataId === attributeId) {
|
||||
result = true;
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const setAttributeChoiceListener = function setAttributeChoiceListener() {
|
||||
const $attributeChoice = $('#attributeChoice');
|
||||
$attributeChoice.find('button').on('click', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const $attributeChoiceSelect = $attributeChoice.find('select');
|
||||
let queryData = '';
|
||||
const $newAttributes = $attributeChoiceSelect.val();
|
||||
|
||||
if ($newAttributes != null) {
|
||||
$attributeChoiceSelect.val().forEach((item) => {
|
||||
if (!isInTheAttributesContainer(item)) {
|
||||
queryData += `${$attributeChoiceSelect.prop('name')}=${item}&`;
|
||||
}
|
||||
});
|
||||
}
|
||||
queryData += `count=${getNextIndex()}`;
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: $(event.currentTarget).parent().attr('data-action'),
|
||||
data: queryData,
|
||||
dataType: 'html',
|
||||
error() {
|
||||
$('form').removeClass('loading');
|
||||
},
|
||||
success(response) {
|
||||
const attributeFormElements = modifyAttributeFormElements($(response));
|
||||
|
||||
attributeFormElements.each((index, element) => {
|
||||
const localeCode = $(element).find('input[type="hidden"]').last().val();
|
||||
$(`#attributesContainer > div[data-tab="${localeCode}"]`).append(element);
|
||||
});
|
||||
|
||||
$('#sylius_product_attribute_choice').val('');
|
||||
|
||||
addAttributesNumber($.grep(attributeFormElements, a => $(a).hasClass('attribute')).length);
|
||||
modifySelectorOnAttributesListElementDelete();
|
||||
|
||||
$('form').removeClass('loading');
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
productAttributes() {
|
||||
setAttributeChoiceListener();
|
||||
|
||||
this.dropdown({
|
||||
onRemove(removedValue) {
|
||||
modifyAttributesListOnSelectorElementDelete(removedValue);
|
||||
},
|
||||
forceSelection: false,
|
||||
});
|
||||
|
||||
function addAttributesNumber(number) {
|
||||
var currentIndex = parseInt(getNextIndex());
|
||||
$('#attributesContainer').attr('data-count', currentIndex+number);
|
||||
}
|
||||
|
||||
function getNextIndex() {
|
||||
return $('#attributesContainer').attr('data-count');
|
||||
}
|
||||
|
||||
function controlAttributesList() {
|
||||
$('#attributesContainer .attribute').each(function() {
|
||||
var value = $(this).attr('data-id');
|
||||
$('#sylius_product_attribute_choice').dropdown('set selected', value);
|
||||
});
|
||||
}
|
||||
|
||||
function modifyAttributesListOnSelectorElementDelete(removedValue) {
|
||||
$('#attributesContainer .attribute[data-id="'+removedValue+'"]').remove();
|
||||
}
|
||||
|
||||
function modifySelectorOnAttributesListElementDelete() {
|
||||
$('.attribute button').off('click').on('click', function() {
|
||||
var attributeId = $(this).parents('.attribute').attr('data-id');
|
||||
|
||||
$('div#attributeChoice > .ui.dropdown.search').dropdown('remove selected', attributeId);
|
||||
modifyAttributesListOnSelectorElementDelete(attributeId)
|
||||
});
|
||||
}
|
||||
|
||||
function modifyAttributeForms(data) {
|
||||
$.each($(data).find('input,select,textarea'), function() {
|
||||
if ($(this).attr('data-name') != null) {
|
||||
$(this).attr('name', $(this).attr('data-name'));
|
||||
}
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function setAttributeChoiceListener() {
|
||||
var $attributeChoice = $('#attributeChoice');
|
||||
$attributeChoice.find('button').on('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $attributeChoiceSelect = $attributeChoice.find('select');
|
||||
var data = '';
|
||||
var $newAttributes = $attributeChoiceSelect.val();
|
||||
|
||||
if (null != $newAttributes) {
|
||||
$attributeChoiceSelect.val().forEach(function(item) {
|
||||
if (!isInTheAttributesContainer(item)) {
|
||||
data += $attributeChoiceSelect.prop('name') + '=' + item + "&";
|
||||
}
|
||||
});
|
||||
}
|
||||
data += "count=" + getNextIndex();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: $(this).parent().attr('data-action'),
|
||||
data: data,
|
||||
dataType: 'html',
|
||||
error: function() {
|
||||
$('form').removeClass('loading');
|
||||
},
|
||||
success: function(data) {
|
||||
var finalData = modifyAttributeForms($(data));
|
||||
|
||||
$(finalData).each(function() {
|
||||
var localeCode = $(this).find('input[type="hidden"]').last().val();
|
||||
$('#attributesContainer > div[data-tab="'+localeCode+'"]').append(this);
|
||||
});
|
||||
|
||||
$('#sylius_product_attribute_choice').val('');
|
||||
|
||||
addAttributesNumber($.grep($(finalData), function (a) { return $(a).hasClass('attribute'); }).length);
|
||||
modifySelectorOnAttributesListElementDelete();
|
||||
|
||||
$('form').removeClass('loading');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function isInTheAttributesContainer(attributeId) {
|
||||
var result = false;
|
||||
$('#attributesContainer .attribute').each(function() {
|
||||
var dataId = $(this).attr('data-id');
|
||||
if (dataId === attributeId) {
|
||||
result = true;
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
})( jQuery );
|
||||
controlAttributesList();
|
||||
modifySelectorOnAttributesListElementDelete();
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,65 +7,60 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/dropdown';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
productAutoComplete: function () {
|
||||
$(this).each(function() {
|
||||
$(this).dropdown('set selected', $(this).find('input[name*="[associations]"]').val().split(',').filter(String));
|
||||
});
|
||||
|
||||
$(this).dropdown({
|
||||
delay: {
|
||||
search: 250,
|
||||
},
|
||||
forceSelection: false,
|
||||
apiSettings: {
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
criteria: { search: { type: 'contains', value: '' } }
|
||||
},
|
||||
beforeSend: function(settings) {
|
||||
settings.data.criteria.search.value = settings.urlData.query;
|
||||
|
||||
return settings;
|
||||
},
|
||||
onResponse: function (response) {
|
||||
var myResults = [];
|
||||
$.each(response._embedded.items, function (index, item) {
|
||||
myResults.push({
|
||||
name: item.name,
|
||||
value: item.code
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
success: true,
|
||||
results: myResults
|
||||
};
|
||||
}
|
||||
},
|
||||
onAdd: function(addedValue, addedText, $addedChoice) {
|
||||
var inputAssociation = $addedChoice.parents('.product-select').find('input[name*="[associations]"]');
|
||||
var associatedProductCodes = 0 < inputAssociation.val().length ? inputAssociation.val().split(',').filter(String) : [];
|
||||
|
||||
associatedProductCodes.push(addedValue);
|
||||
$.unique(associatedProductCodes.sort());
|
||||
|
||||
inputAssociation.attr('value', associatedProductCodes.join());
|
||||
},
|
||||
onRemove: function(removedValue, removedText, $removedChoice) {
|
||||
var inputAssociation = $removedChoice.parents('.product-select').find('input[name*="[associations]"]');
|
||||
var associatedProductCodes = 0 < inputAssociation.val().length ? inputAssociation.val().split(',').filter(String) : [];
|
||||
|
||||
associatedProductCodes.splice($.inArray(removedValue, associatedProductCodes), 1);
|
||||
|
||||
inputAssociation.attr('value', associatedProductCodes.join());
|
||||
}
|
||||
});
|
||||
}
|
||||
$.fn.extend({
|
||||
productAutoComplete() {
|
||||
this.each((index, element) => {
|
||||
const $element = $(element);
|
||||
$element.dropdown('set selected', $element.find('input[name*="[associations]"]').val().split(',').filter(String));
|
||||
});
|
||||
|
||||
})( jQuery );
|
||||
this.dropdown({
|
||||
delay: {
|
||||
search: 250,
|
||||
},
|
||||
forceSelection: false,
|
||||
apiSettings: {
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
data: {
|
||||
criteria: { search: { type: 'contains', value: '' } },
|
||||
},
|
||||
beforeSend(settings) {
|
||||
/* eslint-disable-next-line no-param-reassign */
|
||||
settings.data.criteria.search.value = settings.urlData.query;
|
||||
|
||||
return settings;
|
||||
},
|
||||
onResponse(response) {
|
||||
return {
|
||||
success: true,
|
||||
results: response._embedded.items.map(item => ({
|
||||
name: item.name,
|
||||
value: item.code,
|
||||
})),
|
||||
};
|
||||
},
|
||||
},
|
||||
onAdd(addedValue, addedText, $addedChoice) {
|
||||
const inputAssociation = $addedChoice.parents('.product-select').find('input[name*="[associations]"]');
|
||||
const associatedProductCodes = inputAssociation.val().length > 0 ? inputAssociation.val().split(',').filter(String) : [];
|
||||
|
||||
associatedProductCodes.push(addedValue);
|
||||
$.unique(associatedProductCodes.sort());
|
||||
|
||||
inputAssociation.attr('value', associatedProductCodes.join());
|
||||
},
|
||||
onRemove(removedValue, removedText, $removedChoice) {
|
||||
const inputAssociation = $removedChoice.parents('.product-select').find('input[name*="[associations]"]');
|
||||
const associatedProductCodes = inputAssociation.val().length > 0 ? inputAssociation.val().split(',').filter(String) : [];
|
||||
|
||||
associatedProductCodes.splice($.inArray(removedValue, associatedProductCodes), 1);
|
||||
|
||||
inputAssociation.attr('value', associatedProductCodes.join());
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,59 +1,68 @@
|
|||
(function ($) {
|
||||
'use strict';
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
var methods = {
|
||||
init: function(options) {
|
||||
var settings = $.extend({
|
||||
'prototypePrefix': false,
|
||||
'containerSelector': false
|
||||
}, options);
|
||||
import $ from 'jquery';
|
||||
|
||||
return this.each(function() {
|
||||
show($(this), false);
|
||||
$(this).change(function() {
|
||||
show($(this), true);
|
||||
});
|
||||
const methods = {
|
||||
init(options) {
|
||||
const settings = $.extend({
|
||||
prototypePrefix: false,
|
||||
containerSelector: false,
|
||||
}, options);
|
||||
|
||||
function show(element, replace) {
|
||||
var selectedValue = element.val();
|
||||
var prototypePrefix = element.attr('id');
|
||||
if (false != settings.prototypePrefix) {
|
||||
prototypePrefix = settings.prototypePrefix;
|
||||
}
|
||||
const show = function show(element, replace) {
|
||||
const selectedValue = element.val();
|
||||
let prototypePrefix = element.attr('id');
|
||||
if (settings.prototypePrefix != false) {
|
||||
({ prototypePrefix } = settings);
|
||||
}
|
||||
|
||||
var prototypeElement = $('#' + prototypePrefix + '_' + selectedValue);
|
||||
var container;
|
||||
const prototypeElement = $(`#${prototypePrefix}_${selectedValue}`);
|
||||
let container;
|
||||
|
||||
if (settings.containerSelector) {
|
||||
container = $(settings.containerSelector);
|
||||
} else {
|
||||
container = $(prototypeElement.data('container'));
|
||||
}
|
||||
if (settings.containerSelector) {
|
||||
container = $(settings.containerSelector);
|
||||
} else {
|
||||
container = $(prototypeElement.data('container'));
|
||||
}
|
||||
|
||||
if (!container.length) {
|
||||
return;
|
||||
}
|
||||
if (!container.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!prototypeElement.length) {
|
||||
container.empty();
|
||||
return;
|
||||
}
|
||||
if (!prototypeElement.length) {
|
||||
container.empty();
|
||||
return;
|
||||
}
|
||||
|
||||
if (replace || !container.html().trim()) {
|
||||
container.html(prototypeElement.data('prototype'));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (replace || !container.html().trim()) {
|
||||
container.html(prototypeElement.data('prototype'));
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.handlePrototypes = function(method) {
|
||||
if (methods[method]) {
|
||||
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
} else if (typeof method === 'object' || !method) {
|
||||
return methods.init.apply(this, arguments);
|
||||
} else {
|
||||
$.error( 'Method ' + method + ' does not exist on jQuery.handlePrototypes' );
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
return this.each((index, element) => {
|
||||
show($(element), false);
|
||||
$(element).change((event) => {
|
||||
show($(event.currentTarget), true);
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
$.fn.handlePrototypes = function handlePrototypes(method, ...args) {
|
||||
if (methods[method]) {
|
||||
return methods[method].apply(this, args);
|
||||
} else if (typeof method === 'object' || !method) {
|
||||
return methods.init.apply(this, [method, ...args]);
|
||||
}
|
||||
|
||||
$.error(`Method ${method} does not exist on jQuery.handlePrototypes`);
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,32 +7,31 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import 'semantic-ui-css/components/modal';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
requireConfirmation: function() {
|
||||
return this.each(function() {
|
||||
return $(this).on('click', function(event) {
|
||||
event.preventDefault();
|
||||
$.fn.extend({
|
||||
requireConfirmation() {
|
||||
this.each((idx, el) => {
|
||||
$(el).on('click', (evt) => {
|
||||
evt.preventDefault();
|
||||
|
||||
var actionButton = $(this);
|
||||
const actionButton = $(evt.currentTarget);
|
||||
|
||||
if (actionButton.is('a')) {
|
||||
$('#confirmation-button').attr('href', actionButton.attr('href'));
|
||||
}
|
||||
|
||||
if (actionButton.is('button')) {
|
||||
$('#confirmation-button').on('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
return actionButton.closest('form').submit();
|
||||
});
|
||||
}
|
||||
|
||||
return $('#confirmation-modal').modal('show');
|
||||
});
|
||||
});
|
||||
if (actionButton.is('a')) {
|
||||
$('#confirmation-button').attr('href', actionButton.attr('href'));
|
||||
}
|
||||
|
||||
if (actionButton.is('button')) {
|
||||
$('#confirmation-button').on('click', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
actionButton.closest('form').submit();
|
||||
});
|
||||
}
|
||||
|
||||
$('#confirmation-modal').modal('show');
|
||||
});
|
||||
});
|
||||
})( jQuery );
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,27 +7,25 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
(function ( $ ) {
|
||||
'use strict';
|
||||
import $ from 'jquery';
|
||||
|
||||
$.fn.extend({
|
||||
toggleElement: function() {
|
||||
return this.each(function() {
|
||||
$(this).on('change', function(event) {
|
||||
event.preventDefault();
|
||||
$.fn.extend({
|
||||
toggleElement() {
|
||||
this.each((idx, el) => {
|
||||
$(el).on('change', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
var toggleElement = $(this);
|
||||
var targetElement = $('#' + toggleElement.data('toggles'));
|
||||
const toggle = $(event.currentTarget);
|
||||
const targetElement = $(`#${toggle.data('toggles')}`);
|
||||
|
||||
if (toggleElement.is(':checked')) {
|
||||
targetElement.show();
|
||||
} else {
|
||||
targetElement.hide();
|
||||
}
|
||||
});
|
||||
|
||||
return $(this).trigger('change');
|
||||
});
|
||||
if (toggle.is(':checked')) {
|
||||
targetElement.show();
|
||||
} else {
|
||||
targetElement.hide();
|
||||
}
|
||||
});
|
||||
|
||||
$(el).trigger('change');
|
||||
});
|
||||
})( jQuery );
|
||||
},
|
||||
});
|
||||
|
|
|
|||
486
yarn.lock
486
yarn.lock
|
|
@ -2,6 +2,20 @@
|
|||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@babel/code-frame@^7.0.0-beta.47":
|
||||
version "7.0.0-beta.49"
|
||||
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.49.tgz#becd805482734440c9d137e46d77340e64d7f51b"
|
||||
dependencies:
|
||||
"@babel/highlight" "7.0.0-beta.49"
|
||||
|
||||
"@babel/highlight@7.0.0-beta.49":
|
||||
version "7.0.0-beta.49"
|
||||
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.49.tgz#96bdc6b43e13482012ba6691b1018492d39622cc"
|
||||
dependencies:
|
||||
chalk "^2.0.0"
|
||||
esutils "^2.0.2"
|
||||
js-tokens "^3.0.0"
|
||||
|
||||
"@gulp-sourcemaps/map-sources@1.X":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@gulp-sourcemaps/map-sources/-/map-sources-1.0.0.tgz#890ae7c5d8c877f6d384860215ace9d7ec945bda"
|
||||
|
|
@ -9,28 +23,40 @@
|
|||
normalize-path "^2.0.1"
|
||||
through2 "^2.0.3"
|
||||
|
||||
"@types/estree@0.0.39":
|
||||
version "0.0.39"
|
||||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
|
||||
|
||||
"@types/node@*":
|
||||
version "10.3.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.3.2.tgz#3840ec6c12556fdda6e0e6d036df853101d732a4"
|
||||
|
||||
abbrev@1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
|
||||
|
||||
acorn-es7-plugin@^1.1.7:
|
||||
version "1.1.7"
|
||||
resolved "https://registry.yarnpkg.com/acorn-es7-plugin/-/acorn-es7-plugin-1.1.7.tgz#f2ee1f3228a90eead1245f9ab1922eb2e71d336b"
|
||||
|
||||
acorn-jsx@^3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b"
|
||||
dependencies:
|
||||
acorn "^3.0.4"
|
||||
|
||||
acorn@4.X:
|
||||
acorn@4.X, acorn@^4.0.3:
|
||||
version "4.0.13"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"
|
||||
|
||||
acorn@>=2.5.2, acorn@^5.5.0:
|
||||
version "5.6.2"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.6.2.tgz#b1da1d7be2ac1b4a327fb9eab851702c5045b4e7"
|
||||
|
||||
acorn@^3.0.4:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
|
||||
|
||||
acorn@^5.5.0:
|
||||
version "5.6.2"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.6.2.tgz#b1da1d7be2ac1b4a327fb9eab851702c5045b4e7"
|
||||
|
||||
ajv-keywords@^2.1.0:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762"
|
||||
|
|
@ -51,14 +77,6 @@ ajv@^5.2.3, ajv@^5.3.0:
|
|||
fast-json-stable-stringify "^2.0.0"
|
||||
json-schema-traverse "^0.3.0"
|
||||
|
||||
align-text@^0.1.1, align-text@^0.1.3:
|
||||
version "0.1.4"
|
||||
resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117"
|
||||
dependencies:
|
||||
kind-of "^3.0.2"
|
||||
longest "^1.0.1"
|
||||
repeat-string "^1.5.2"
|
||||
|
||||
amdefine@>=0.0.4:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
|
||||
|
|
@ -143,6 +161,12 @@ argparse@^1.0.7:
|
|||
dependencies:
|
||||
sprintf-js "~1.0.2"
|
||||
|
||||
arr-diff@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf"
|
||||
dependencies:
|
||||
arr-flatten "^1.0.1"
|
||||
|
||||
arr-diff@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520"
|
||||
|
|
@ -214,6 +238,10 @@ array-uniq@^1.0.1, array-uniq@^1.0.2:
|
|||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6"
|
||||
|
||||
array-unique@^0.2.1:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53"
|
||||
|
||||
array-unique@^0.3.2:
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428"
|
||||
|
|
@ -261,10 +289,6 @@ async-settle@^1.0.0:
|
|||
dependencies:
|
||||
async-done "^1.2.2"
|
||||
|
||||
async@~0.2.6:
|
||||
version "0.2.10"
|
||||
resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
|
||||
|
||||
asynckit@^0.4.0:
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
|
||||
|
|
@ -289,7 +313,7 @@ babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
|
|||
esutils "^2.0.2"
|
||||
js-tokens "^3.0.2"
|
||||
|
||||
babel-core@^6.26.0:
|
||||
babel-core@^6.26.0, babel-core@^6.26.3:
|
||||
version "6.26.3"
|
||||
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.3.tgz#b2e2f09e342d0f0c88e2f02e067794125e75c207"
|
||||
dependencies:
|
||||
|
|
@ -439,6 +463,22 @@ babel-plugin-check-es2015-constants@^6.22.0:
|
|||
dependencies:
|
||||
babel-runtime "^6.22.0"
|
||||
|
||||
babel-plugin-external-helpers@^6.22.0:
|
||||
version "6.22.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-external-helpers/-/babel-plugin-external-helpers-6.22.0.tgz#2285f48b02bd5dede85175caf8c62e86adccefa1"
|
||||
dependencies:
|
||||
babel-runtime "^6.22.0"
|
||||
|
||||
babel-plugin-module-resolver@^3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-3.1.1.tgz#881cf67e3d4b8400d5eaaefc1be44d2dc1fe404f"
|
||||
dependencies:
|
||||
find-babel-config "^1.1.0"
|
||||
glob "^7.1.2"
|
||||
pkg-up "^2.0.0"
|
||||
reselect "^3.0.1"
|
||||
resolve "^1.4.0"
|
||||
|
||||
babel-plugin-syntax-async-functions@^6.8.0:
|
||||
version "6.13.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95"
|
||||
|
|
@ -652,12 +692,6 @@ babel-plugin-transform-regenerator@^6.22.0:
|
|||
dependencies:
|
||||
regenerator-transform "^0.10.0"
|
||||
|
||||
babel-plugin-transform-runtime@^6.23.0:
|
||||
version "6.23.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz#88490d446502ea9b8e7efb0fe09ec4d99479b1ee"
|
||||
dependencies:
|
||||
babel-runtime "^6.22.0"
|
||||
|
||||
babel-plugin-transform-strict-mode@^6.24.1:
|
||||
version "6.24.1"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758"
|
||||
|
|
@ -665,6 +699,14 @@ babel-plugin-transform-strict-mode@^6.24.1:
|
|||
babel-runtime "^6.22.0"
|
||||
babel-types "^6.24.1"
|
||||
|
||||
babel-polyfill@^6.26.0:
|
||||
version "6.26.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153"
|
||||
dependencies:
|
||||
babel-runtime "^6.26.0"
|
||||
core-js "^2.5.0"
|
||||
regenerator-runtime "^0.10.5"
|
||||
|
||||
babel-preset-env@^1.7.0:
|
||||
version "1.7.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.7.0.tgz#dea79fa4ebeb883cd35dab07e260c1c9c04df77a"
|
||||
|
|
@ -834,6 +876,14 @@ brace-expansion@^1.1.7:
|
|||
balanced-match "^1.0.0"
|
||||
concat-map "0.0.1"
|
||||
|
||||
braces@^1.8.2:
|
||||
version "1.8.5"
|
||||
resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7"
|
||||
dependencies:
|
||||
expand-range "^1.8.1"
|
||||
preserve "^0.2.0"
|
||||
repeat-element "^1.1.2"
|
||||
|
||||
braces@^2.3.0, braces@^2.3.1:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729"
|
||||
|
|
@ -868,6 +918,10 @@ builtin-modules@^1.0.0:
|
|||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
|
||||
|
||||
builtin-modules@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-2.0.0.tgz#60b7ef5ae6546bd7deefa74b08b62a43a232648e"
|
||||
|
||||
bytes@2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/bytes/-/bytes-2.2.0.tgz#fd35464a403f6f9117c2de3609ecff9cae000588"
|
||||
|
|
@ -907,10 +961,6 @@ camelcase-keys@^2.0.0:
|
|||
camelcase "^2.0.0"
|
||||
map-obj "^1.0.0"
|
||||
|
||||
camelcase@^1.0.2:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"
|
||||
|
||||
camelcase@^2.0.0:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"
|
||||
|
|
@ -931,13 +981,6 @@ caseless@~0.12.0:
|
|||
version "0.12.0"
|
||||
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
|
||||
|
||||
center-align@^0.1.1:
|
||||
version "0.1.3"
|
||||
resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad"
|
||||
dependencies:
|
||||
align-text "^0.1.3"
|
||||
lazy-cache "^1.0.3"
|
||||
|
||||
chalk@^0.5.1:
|
||||
version "0.5.1"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-0.5.1.tgz#663b3a648b68b55d04690d49167aa837858f2174"
|
||||
|
|
@ -1015,14 +1058,6 @@ cli-width@^2.0.0:
|
|||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639"
|
||||
|
||||
cliui@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1"
|
||||
dependencies:
|
||||
center-align "^0.1.1"
|
||||
right-align "^0.1.1"
|
||||
wordwrap "0.0.2"
|
||||
|
||||
cliui@^3.2.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
|
||||
|
|
@ -1102,7 +1137,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5:
|
|||
dependencies:
|
||||
delayed-stream "~1.0.0"
|
||||
|
||||
commander@^2.9.0:
|
||||
commander@^2.9.0, commander@~2.15.0:
|
||||
version "2.15.1"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f"
|
||||
|
||||
|
|
@ -1216,10 +1251,6 @@ dateformat@^2.0.0:
|
|||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-2.2.0.tgz#4065e2013cf9fb916ddfd82efb506ad4c6769062"
|
||||
|
||||
deap@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/deap/-/deap-1.0.1.tgz#0646e9e1a095ffe8a9e404d68d1f76dcf57e66fb"
|
||||
|
||||
debug-fabulous@0.0.X:
|
||||
version "0.0.4"
|
||||
resolved "https://registry.yarnpkg.com/debug-fabulous/-/debug-fabulous-0.0.4.tgz#fa071c5d87484685424807421ca4b16b0b1a0763"
|
||||
|
|
@ -1246,7 +1277,7 @@ debug@~2.2.0:
|
|||
dependencies:
|
||||
ms "0.7.1"
|
||||
|
||||
decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
|
||||
decamelize@^1.1.1, decamelize@^1.1.2:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||
|
||||
|
|
@ -1254,6 +1285,10 @@ decode-uri-component@^0.2.0:
|
|||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"
|
||||
|
||||
dedent@^0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c"
|
||||
|
||||
deep-extend@^0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
|
||||
|
|
@ -1447,6 +1482,13 @@ eslint-config-airbnb-base@^12.1.0:
|
|||
dependencies:
|
||||
eslint-restricted-globals "^0.1.1"
|
||||
|
||||
eslint-import-resolver-babel-module@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-import-resolver-babel-module/-/eslint-import-resolver-babel-module-4.0.0.tgz#1c596f7fb9815050292c8750d523b27a5444b4bf"
|
||||
dependencies:
|
||||
pkg-up "^2.0.0"
|
||||
resolve "^1.4.0"
|
||||
|
||||
eslint-import-resolver-node@^0.3.1:
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a"
|
||||
|
|
@ -1561,6 +1603,14 @@ estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1:
|
|||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13"
|
||||
|
||||
estree-walker@^0.2.0, estree-walker@^0.2.1:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.2.1.tgz#bdafe8095383d8414d5dc2ecf4c9173b6db9412e"
|
||||
|
||||
estree-walker@^0.5.1, estree-walker@^0.5.2:
|
||||
version "0.5.2"
|
||||
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.2.tgz#d3850be7529c9580d815600b53126515e146dd39"
|
||||
|
||||
esutils@^2.0.2:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
|
||||
|
|
@ -1577,6 +1627,12 @@ event-stream@^3.1.7:
|
|||
stream-combiner "~0.0.4"
|
||||
through "~2.3.1"
|
||||
|
||||
expand-brackets@^0.1.4:
|
||||
version "0.1.5"
|
||||
resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b"
|
||||
dependencies:
|
||||
is-posix-bracket "^0.1.0"
|
||||
|
||||
expand-brackets@^2.1.4:
|
||||
version "2.1.4"
|
||||
resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622"
|
||||
|
|
@ -1589,6 +1645,12 @@ expand-brackets@^2.1.4:
|
|||
snapdragon "^0.8.1"
|
||||
to-regex "^3.0.1"
|
||||
|
||||
expand-range@^1.8.1:
|
||||
version "1.8.2"
|
||||
resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337"
|
||||
dependencies:
|
||||
fill-range "^2.1.0"
|
||||
|
||||
expand-tilde@^2.0.0, expand-tilde@^2.0.2:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502"
|
||||
|
|
@ -1620,6 +1682,12 @@ external-editor@^2.0.4:
|
|||
iconv-lite "^0.4.17"
|
||||
tmp "^0.0.33"
|
||||
|
||||
extglob@^0.3.1:
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1"
|
||||
dependencies:
|
||||
is-extglob "^1.0.0"
|
||||
|
||||
extglob@^2.0.4:
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543"
|
||||
|
|
@ -1641,7 +1709,7 @@ extsprintf@^1.2.0:
|
|||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f"
|
||||
|
||||
fancy-log@^1.0.0, fancy-log@^1.1.0, fancy-log@^1.3.2:
|
||||
fancy-log@^1.1.0, fancy-log@^1.3.2:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.2.tgz#f41125e3d84f2e7d89a43d06d958c8f78be16be1"
|
||||
dependencies:
|
||||
|
|
@ -1649,6 +1717,13 @@ fancy-log@^1.0.0, fancy-log@^1.1.0, fancy-log@^1.3.2:
|
|||
color-support "^1.1.3"
|
||||
time-stamp "^1.0.0"
|
||||
|
||||
fast-async@^6.3.7:
|
||||
version "6.3.7"
|
||||
resolved "https://registry.yarnpkg.com/fast-async/-/fast-async-6.3.7.tgz#b4a406f2c59890b8b1b4c8468a36bd7f1a57e47f"
|
||||
dependencies:
|
||||
nodent-compiler "^3.2.4"
|
||||
nodent-runtime ">=3.2.1"
|
||||
|
||||
fast-deep-equal@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614"
|
||||
|
|
@ -1680,6 +1755,20 @@ file-entry-cache@^2.0.0:
|
|||
flat-cache "^1.2.1"
|
||||
object-assign "^4.0.1"
|
||||
|
||||
filename-regex@^2.0.0:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26"
|
||||
|
||||
fill-range@^2.1.0:
|
||||
version "2.2.4"
|
||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565"
|
||||
dependencies:
|
||||
is-number "^2.1.0"
|
||||
isobject "^2.0.0"
|
||||
randomatic "^3.0.0"
|
||||
repeat-element "^1.1.2"
|
||||
repeat-string "^1.5.2"
|
||||
|
||||
fill-range@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7"
|
||||
|
|
@ -1689,6 +1778,13 @@ fill-range@^4.0.0:
|
|||
repeat-string "^1.6.1"
|
||||
to-regex-range "^2.1.0"
|
||||
|
||||
find-babel-config@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/find-babel-config/-/find-babel-config-1.1.0.tgz#acc01043a6749fec34429be6b64f542ebb5d6355"
|
||||
dependencies:
|
||||
json5 "^0.5.1"
|
||||
path-exists "^3.0.0"
|
||||
|
||||
find-up@^1.0.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f"
|
||||
|
|
@ -1696,7 +1792,7 @@ find-up@^1.0.0:
|
|||
path-exists "^2.0.0"
|
||||
pinkie-promise "^2.0.0"
|
||||
|
||||
find-up@^2.0.0:
|
||||
find-up@^2.0.0, find-up@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7"
|
||||
dependencies:
|
||||
|
|
@ -1745,6 +1841,12 @@ for-in@^1.0.1, for-in@^1.0.2:
|
|||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
|
||||
|
||||
for-own@^0.1.4:
|
||||
version "0.1.5"
|
||||
resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce"
|
||||
dependencies:
|
||||
for-in "^1.0.1"
|
||||
|
||||
for-own@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/for-own/-/for-own-1.0.0.tgz#c63332f415cedc4b04dbfe70cf836494c53cb44b"
|
||||
|
|
@ -1869,6 +1971,19 @@ getpass@^0.1.1:
|
|||
dependencies:
|
||||
assert-plus "^1.0.0"
|
||||
|
||||
glob-base@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4"
|
||||
dependencies:
|
||||
glob-parent "^2.0.0"
|
||||
is-glob "^2.0.0"
|
||||
|
||||
glob-parent@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28"
|
||||
dependencies:
|
||||
is-glob "^2.0.0"
|
||||
|
||||
glob-parent@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae"
|
||||
|
|
@ -2089,19 +2204,6 @@ gulp-sourcemaps@^1.6.0:
|
|||
through2 "2.X"
|
||||
vinyl "1.X"
|
||||
|
||||
gulp-uglify@^1.5.1:
|
||||
version "1.5.4"
|
||||
resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-1.5.4.tgz#524788d87666d09f9d0c21fb2177f90039a658c9"
|
||||
dependencies:
|
||||
deap "^1.0.0"
|
||||
fancy-log "^1.0.0"
|
||||
gulp-util "^3.0.0"
|
||||
isobject "^2.0.0"
|
||||
through2 "^2.0.0"
|
||||
uglify-js "2.6.4"
|
||||
uglify-save-license "^0.4.1"
|
||||
vinyl-sourcemaps-apply "^0.2.0"
|
||||
|
||||
gulp-uglifycss@^1.0.5:
|
||||
version "1.0.9"
|
||||
resolved "https://registry.yarnpkg.com/gulp-uglifycss/-/gulp-uglifycss-1.0.9.tgz#4d58cca04251c3f1e0140fb2a5dcbe8bebb21244"
|
||||
|
|
@ -2433,6 +2535,16 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2:
|
|||
is-data-descriptor "^1.0.0"
|
||||
kind-of "^6.0.2"
|
||||
|
||||
is-dotfile@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1"
|
||||
|
||||
is-equal-shallow@^0.1.3:
|
||||
version "0.1.3"
|
||||
resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534"
|
||||
dependencies:
|
||||
is-primitive "^2.0.0"
|
||||
|
||||
is-extendable@^0.1.0, is-extendable@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89"
|
||||
|
|
@ -2443,6 +2555,10 @@ is-extendable@^1.0.1:
|
|||
dependencies:
|
||||
is-plain-object "^2.0.4"
|
||||
|
||||
is-extglob@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0"
|
||||
|
||||
is-extglob@^2.1.0, is-extglob@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
|
||||
|
|
@ -2463,6 +2579,12 @@ is-fullwidth-code-point@^2.0.0:
|
|||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
|
||||
|
||||
is-glob@^2.0.0, is-glob@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863"
|
||||
dependencies:
|
||||
is-extglob "^1.0.0"
|
||||
|
||||
is-glob@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a"
|
||||
|
|
@ -2475,6 +2597,10 @@ is-glob@^4.0.0:
|
|||
dependencies:
|
||||
is-extglob "^2.1.1"
|
||||
|
||||
is-module@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591"
|
||||
|
||||
is-my-ip-valid@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz#7b351b8e8edd4d3995d4d066680e664d94696824"
|
||||
|
|
@ -2493,6 +2619,12 @@ is-negated-glob@^1.0.0:
|
|||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-negated-glob/-/is-negated-glob-1.0.0.tgz#6910bca5da8c95e784b5751b976cf5a10fee36d2"
|
||||
|
||||
is-number@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f"
|
||||
dependencies:
|
||||
kind-of "^3.0.2"
|
||||
|
||||
is-number@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195"
|
||||
|
|
@ -2535,6 +2667,14 @@ is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4:
|
|||
dependencies:
|
||||
isobject "^3.0.1"
|
||||
|
||||
is-posix-bracket@^0.1.0:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4"
|
||||
|
||||
is-primitive@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575"
|
||||
|
||||
is-promise@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
|
||||
|
|
@ -2710,10 +2850,6 @@ last-run@^1.1.0:
|
|||
default-resolution "^2.0.0"
|
||||
es6-weak-map "^2.0.1"
|
||||
|
||||
lazy-cache@^1.0.3:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"
|
||||
|
||||
lazy-debug-legacy@0.0.X:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/lazy-debug-legacy/-/lazy-debug-legacy-0.0.1.tgz#537716c0776e4cf79e3ed1b621f7658c2911b1b1"
|
||||
|
|
@ -2916,10 +3052,6 @@ lodash@^4.0.0, lodash@^4.17.4, lodash@^4.3.0, lodash@~4.17.10:
|
|||
version "4.17.10"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
|
||||
|
||||
longest@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
|
||||
|
||||
loose-envify@^1.0.0:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
|
||||
|
|
@ -2944,6 +3076,18 @@ lru-cache@^4.0.1:
|
|||
pseudomap "^1.0.2"
|
||||
yallist "^2.1.2"
|
||||
|
||||
magic-string@^0.16.0:
|
||||
version "0.16.0"
|
||||
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.16.0.tgz#970ebb0da7193301285fb1aa650f39bdd81eb45a"
|
||||
dependencies:
|
||||
vlq "^0.2.1"
|
||||
|
||||
magic-string@^0.22.4:
|
||||
version "0.22.5"
|
||||
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.5.tgz#8e9cf5afddf44385c1da5bc2a6a0dbd10b03657e"
|
||||
dependencies:
|
||||
vlq "^0.2.2"
|
||||
|
||||
make-iterator@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6"
|
||||
|
|
@ -2977,6 +3121,10 @@ matchdep@^2.0.0:
|
|||
resolve "^1.4.0"
|
||||
stack-trace "0.0.10"
|
||||
|
||||
math-random@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.1.tgz#8b3aac588b8a66e4975e3cdea67f7bb329601fac"
|
||||
|
||||
media-typer@0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
|
||||
|
|
@ -3002,6 +3150,24 @@ merge-stream@^1.0.0:
|
|||
dependencies:
|
||||
readable-stream "^2.0.1"
|
||||
|
||||
micromatch@^2.3.11:
|
||||
version "2.3.11"
|
||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565"
|
||||
dependencies:
|
||||
arr-diff "^2.0.0"
|
||||
array-unique "^0.2.1"
|
||||
braces "^1.8.2"
|
||||
expand-brackets "^0.1.4"
|
||||
extglob "^0.3.1"
|
||||
filename-regex "^2.0.0"
|
||||
is-extglob "^1.0.0"
|
||||
is-glob "^2.0.1"
|
||||
kind-of "^3.0.2"
|
||||
normalize-path "^2.0.1"
|
||||
object.omit "^2.0.0"
|
||||
parse-glob "^3.0.4"
|
||||
regex-cache "^0.4.2"
|
||||
|
||||
micromatch@^3.0.4, micromatch@^3.1.4:
|
||||
version "3.1.10"
|
||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23"
|
||||
|
|
@ -3207,6 +3373,23 @@ node-sass@^4.8.3:
|
|||
stdout-stream "^1.4.0"
|
||||
"true-case-path" "^1.0.2"
|
||||
|
||||
nodent-compiler@^3.2.4:
|
||||
version "3.2.6"
|
||||
resolved "https://registry.yarnpkg.com/nodent-compiler/-/nodent-compiler-3.2.6.tgz#ce53314bce7b18f136601068886b0379b8d372a8"
|
||||
dependencies:
|
||||
acorn ">=2.5.2"
|
||||
acorn-es7-plugin "^1.1.7"
|
||||
nodent-transform "^3.2.6"
|
||||
source-map "^0.5.7"
|
||||
|
||||
nodent-runtime@>=3.2.1:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/nodent-runtime/-/nodent-runtime-3.2.1.tgz#9e2755d85e39f764288f0d4752ebcfe3e541e00e"
|
||||
|
||||
nodent-transform@^3.2.6:
|
||||
version "3.2.6"
|
||||
resolved "https://registry.yarnpkg.com/nodent-transform/-/nodent-transform-3.2.6.tgz#b782edc0e2aafa6d29df0333b36cd00af757c36d"
|
||||
|
||||
"nopt@2 || 3":
|
||||
version "3.0.6"
|
||||
resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9"
|
||||
|
|
@ -3324,6 +3507,13 @@ object.map@^1.0.0:
|
|||
for-own "^1.0.0"
|
||||
make-iterator "^1.0.0"
|
||||
|
||||
object.omit@^2.0.0:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa"
|
||||
dependencies:
|
||||
for-own "^0.1.4"
|
||||
is-extendable "^0.1.1"
|
||||
|
||||
object.pick@^1.2.0, object.pick@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747"
|
||||
|
|
@ -3417,6 +3607,15 @@ parse-filepath@^1.0.1:
|
|||
map-cache "^0.2.0"
|
||||
path-root "^0.1.1"
|
||||
|
||||
parse-glob@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c"
|
||||
dependencies:
|
||||
glob-base "^0.3.0"
|
||||
is-dotfile "^1.0.0"
|
||||
is-extglob "^1.0.0"
|
||||
is-glob "^2.0.0"
|
||||
|
||||
parse-json@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9"
|
||||
|
|
@ -3515,6 +3714,12 @@ pkg-dir@^1.0.0:
|
|||
dependencies:
|
||||
find-up "^1.0.0"
|
||||
|
||||
pkg-up@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-2.0.0.tgz#c819ac728059a461cab1c3889a2be3c49a004d7f"
|
||||
dependencies:
|
||||
find-up "^2.1.0"
|
||||
|
||||
plugin-error@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-1.0.1.tgz#77016bd8919d0ac377fdcdd0322328953ca5781c"
|
||||
|
|
@ -3542,6 +3747,10 @@ prelude-ls@~1.1.2:
|
|||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
|
||||
|
||||
preserve@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
|
||||
|
||||
pretty-hrtime@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1"
|
||||
|
|
@ -3601,6 +3810,14 @@ qs@~6.4.0:
|
|||
version "6.4.0"
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233"
|
||||
|
||||
randomatic@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.0.0.tgz#d35490030eb4f7578de292ce6dfb04a91a128923"
|
||||
dependencies:
|
||||
is-number "^4.0.0"
|
||||
kind-of "^6.0.0"
|
||||
math-random "^1.0.1"
|
||||
|
||||
raw-body@~2.1.5:
|
||||
version "2.1.7"
|
||||
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.1.7.tgz#adfeace2e4fb3098058014d08c072dcc59758774"
|
||||
|
|
@ -3695,6 +3912,10 @@ regenerate@^1.2.1:
|
|||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11"
|
||||
|
||||
regenerator-runtime@^0.10.5:
|
||||
version "0.10.5"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658"
|
||||
|
||||
regenerator-runtime@^0.11.0:
|
||||
version "0.11.1"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
|
||||
|
|
@ -3707,6 +3928,12 @@ regenerator-transform@^0.10.0:
|
|||
babel-types "^6.19.0"
|
||||
private "^0.1.6"
|
||||
|
||||
regex-cache@^0.4.2:
|
||||
version "0.4.4"
|
||||
resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd"
|
||||
dependencies:
|
||||
is-equal-shallow "^0.1.3"
|
||||
|
||||
regex-not@^1.0.0, regex-not@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c"
|
||||
|
|
@ -3852,6 +4079,10 @@ require-uncached@^1.0.3:
|
|||
caller-path "^0.1.0"
|
||||
resolve-from "^1.0.0"
|
||||
|
||||
reselect@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/reselect/-/reselect-3.0.1.tgz#efdaa98ea7451324d092b2b2163a6a1d7a9a2147"
|
||||
|
||||
resolve-dir@^1.0.0, resolve-dir@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43"
|
||||
|
|
@ -3890,18 +4121,72 @@ ret@~0.1.10:
|
|||
version "0.1.15"
|
||||
resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc"
|
||||
|
||||
right-align@^0.1.1:
|
||||
version "0.1.3"
|
||||
resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef"
|
||||
dependencies:
|
||||
align-text "^0.1.1"
|
||||
|
||||
rimraf@2, rimraf@^2.2.8, rimraf@^2.6.1:
|
||||
version "2.6.2"
|
||||
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36"
|
||||
dependencies:
|
||||
glob "^7.0.5"
|
||||
|
||||
rollup-plugin-babel@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-3.0.4.tgz#41b3e762fe64450dd61da3105a2cf7ad76be4edc"
|
||||
dependencies:
|
||||
rollup-pluginutils "^1.5.0"
|
||||
|
||||
rollup-plugin-commonjs@^9.1.3:
|
||||
version "9.1.3"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-9.1.3.tgz#37bfbf341292ea14f512438a56df8f9ca3ba4d67"
|
||||
dependencies:
|
||||
estree-walker "^0.5.1"
|
||||
magic-string "^0.22.4"
|
||||
resolve "^1.5.0"
|
||||
rollup-pluginutils "^2.0.1"
|
||||
|
||||
rollup-plugin-inject@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-inject/-/rollup-plugin-inject-2.0.0.tgz#8934d98a5b0db2d05efcee2ac06a170a4c70b044"
|
||||
dependencies:
|
||||
acorn "^4.0.3"
|
||||
estree-walker "^0.2.0"
|
||||
magic-string "^0.16.0"
|
||||
rollup-pluginutils "^1.2.0"
|
||||
|
||||
rollup-plugin-node-resolve@^3.3.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.3.0.tgz#c26d110a36812cbefa7ce117cadcd3439aa1c713"
|
||||
dependencies:
|
||||
builtin-modules "^2.0.0"
|
||||
is-module "^1.0.0"
|
||||
resolve "^1.1.6"
|
||||
|
||||
rollup-plugin-uglify@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-4.0.0.tgz#6eb471738f1ce9ba7d9d4bc43b71cba02417c8fb"
|
||||
dependencies:
|
||||
"@babel/code-frame" "^7.0.0-beta.47"
|
||||
uglify-js "^3.3.25"
|
||||
|
||||
rollup-pluginutils@^1.2.0, rollup-pluginutils@^1.5.0:
|
||||
version "1.5.2"
|
||||
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408"
|
||||
dependencies:
|
||||
estree-walker "^0.2.1"
|
||||
minimatch "^3.0.2"
|
||||
|
||||
rollup-pluginutils@^2.0.1:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.3.0.tgz#478ace04bd7f6da2e724356ca798214884738fc4"
|
||||
dependencies:
|
||||
estree-walker "^0.5.2"
|
||||
micromatch "^2.3.11"
|
||||
|
||||
rollup@^0.60.2:
|
||||
version "0.60.2"
|
||||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.60.2.tgz#9635fea3c2f32095c35cda7bfc2816c675de2da4"
|
||||
dependencies:
|
||||
"@types/estree" "0.0.39"
|
||||
"@types/node" "*"
|
||||
|
||||
run-async@^2.2.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0"
|
||||
|
|
@ -4091,11 +4376,11 @@ source-map@^0.4.2:
|
|||
dependencies:
|
||||
amdefine ">=0.0.4"
|
||||
|
||||
source-map@^0.5.1, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1:
|
||||
source-map@^0.5.1, source-map@^0.5.6, source-map@^0.5.7:
|
||||
version "0.5.7"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
|
||||
|
||||
source-map@^0.6.1, source-map@~0.6.0:
|
||||
source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||
|
||||
|
|
@ -4454,22 +4739,12 @@ typedarray@^0.0.6:
|
|||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
|
||||
uglify-js@2.6.4:
|
||||
version "2.6.4"
|
||||
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.6.4.tgz#65ea2fb3059c9394692f15fed87c2b36c16b9adf"
|
||||
uglify-js@^3.3.25:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.0.tgz#796762282b5b5f0eafe7d5c8c708d1d7bd5ba11d"
|
||||
dependencies:
|
||||
async "~0.2.6"
|
||||
source-map "~0.5.1"
|
||||
uglify-to-browserify "~1.0.0"
|
||||
yargs "~3.10.0"
|
||||
|
||||
uglify-save-license@^0.4.1:
|
||||
version "0.4.1"
|
||||
resolved "https://registry.yarnpkg.com/uglify-save-license/-/uglify-save-license-0.4.1.tgz#95726c17cc6fd171c3617e3bf4d8d82aa8c4cce1"
|
||||
|
||||
uglify-to-browserify@~1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
|
||||
commander "~2.15.0"
|
||||
source-map "~0.6.1"
|
||||
|
||||
uglifycss@^0.0.25:
|
||||
version "0.0.25"
|
||||
|
|
@ -4638,6 +4913,10 @@ vinyl@^2.0.0:
|
|||
remove-trailing-separator "^1.0.1"
|
||||
replace-ext "^1.0.0"
|
||||
|
||||
vlq@^0.2.1, vlq@^0.2.2:
|
||||
version "0.2.3"
|
||||
resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26"
|
||||
|
||||
websocket-driver@>=0.3.6:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.0.tgz#0caf9d2d755d93aee049d4bdd0d3fe2cca2a24eb"
|
||||
|
|
@ -4665,14 +4944,6 @@ wide-align@^1.1.0:
|
|||
dependencies:
|
||||
string-width "^1.0.2 || 2"
|
||||
|
||||
window-size@0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
|
||||
|
||||
wordwrap@0.0.2:
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
|
||||
|
||||
wordwrap@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
|
||||
|
|
@ -4757,12 +5028,3 @@ yargs@^7.0.0, yargs@^7.1.0:
|
|||
which-module "^1.0.0"
|
||||
y18n "^3.2.1"
|
||||
yargs-parser "^5.0.0"
|
||||
|
||||
yargs@~3.10.0:
|
||||
version "3.10.0"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1"
|
||||
dependencies:
|
||||
camelcase "^1.0.2"
|
||||
cliui "^2.1.0"
|
||||
decamelize "^1.0.0"
|
||||
window-size "0.1.0"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue