Replaces JSON textarea with professional Excel-like spreadsheet interface for managing product variant properties. Features: - Handsontable 14.6.1 spreadsheet component - Property presets (Size, Color, Material, Storage, Custom) - Inline cell editing with Tab/Enter navigation - Context menu for add/remove rows and columns - Keyboard shortcuts (Ctrl+D delete, Ctrl+Enter save, Ctrl+Z undo) - Mobile touch gestures (swipe to delete rows) - Automatic JSON serialization on form submit - Form validation before saving - Comprehensive user guide documentation Files Changed: - LittleShop/package.json: NPM package management setup - LittleShop/wwwroot/js/variant-editor.js: 400-line spreadsheet editor module - LittleShop/wwwroot/lib/handsontable/: Handsontable library (Community Edition) - LittleShop/wwwroot/lib/hammerjs/: Hammer.js touch gesture library - LittleShop/Areas/Admin/Views/VariantCollections/Edit.cshtml: Spreadsheet UI integration - VARIANT_COLLECTIONS_USER_GUIDE.md: Complete user guide (18+ pages) Technical Details: - Excel-like editing experience (no more manual JSON editing) - Mobile-first responsive design - Browser compatibility: Chrome 90+, Firefox 88+, Edge 90+, Safari 14+ - Touch-optimized for mobile administration - Automatic data validation and error handling
56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
/**
|
|
* Swipe
|
|
* Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
|
|
* @constructor
|
|
* @extends AttrRecognizer
|
|
*/
|
|
function SwipeRecognizer() {
|
|
AttrRecognizer.apply(this, arguments);
|
|
}
|
|
|
|
inherit(SwipeRecognizer, AttrRecognizer, {
|
|
/**
|
|
* @namespace
|
|
* @memberof SwipeRecognizer
|
|
*/
|
|
defaults: {
|
|
event: 'swipe',
|
|
threshold: 10,
|
|
velocity: 0.3,
|
|
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
|
|
pointers: 1
|
|
},
|
|
|
|
getTouchAction: function() {
|
|
return PanRecognizer.prototype.getTouchAction.call(this);
|
|
},
|
|
|
|
attrTest: function(input) {
|
|
var direction = this.options.direction;
|
|
var velocity;
|
|
|
|
if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
|
|
velocity = input.overallVelocity;
|
|
} else if (direction & DIRECTION_HORIZONTAL) {
|
|
velocity = input.overallVelocityX;
|
|
} else if (direction & DIRECTION_VERTICAL) {
|
|
velocity = input.overallVelocityY;
|
|
}
|
|
|
|
return this._super.attrTest.call(this, input) &&
|
|
direction & input.offsetDirection &&
|
|
input.distance > this.options.threshold &&
|
|
input.maxPointers == this.options.pointers &&
|
|
abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
|
|
},
|
|
|
|
emit: function(input) {
|
|
var direction = directionStr(input.offsetDirection);
|
|
if (direction) {
|
|
this.manager.emit(this.options.event + direction, input);
|
|
}
|
|
|
|
this.manager.emit(this.options.event, input);
|
|
}
|
|
});
|