-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reverted framework7 version back to 6
- Loading branch information
1 parent
86cd96c
commit 546ca21
Showing
937 changed files
with
108,523 additions
and
60,091 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "framework7/bundle", | ||
"private": true, | ||
"sideEffects": false, | ||
"main": "../cjs/framework7-bundle.js", | ||
"module": "../esm/framework7-bundle.js", | ||
"typings": "../framework7.d.ts" | ||
} |
136 changes: 136 additions & 0 deletions
136
www/assets/framework7/cjs/components/accordion/accordion.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
"use strict"; | ||
|
||
exports.__esModule = true; | ||
exports.default = void 0; | ||
|
||
var _dom = _interopRequireDefault(require("../../shared/dom7")); | ||
|
||
var _utils = require("../../shared/utils"); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
var Accordion = { | ||
toggleClicked: function toggleClicked($clickedEl) { | ||
var app = this; | ||
var $accordionItemEl = $clickedEl.closest('.accordion-item').eq(0); | ||
if (!$accordionItemEl.length) $accordionItemEl = $clickedEl.parents('li').eq(0); | ||
var $accordionContent = $clickedEl.parents('.accordion-item-content').eq(0); | ||
|
||
if ($accordionContent.length) { | ||
if ($accordionContent.parents($accordionItemEl).length) return; | ||
} | ||
|
||
if ($clickedEl.parents('li').length > 1 && $clickedEl.parents('li')[0] !== $accordionItemEl[0]) return; | ||
app.accordion.toggle($accordionItemEl); | ||
}, | ||
open: function open(el) { | ||
var app = this; | ||
var $el = (0, _dom.default)(el); | ||
var prevented = false; | ||
|
||
function prevent() { | ||
prevented = true; | ||
} | ||
|
||
$el.trigger('accordion:beforeopen', { | ||
prevent: prevent | ||
}, prevent); | ||
app.emit('accordionBeforeOpen', $el[0], prevent); | ||
if (prevented) return; | ||
var $list = $el.parents('.accordion-list').eq(0); | ||
var $contentEl = $el.children('.accordion-item-content'); | ||
$contentEl.removeAttr('aria-hidden'); | ||
if ($contentEl.length === 0) $contentEl = $el.find('.accordion-item-content'); | ||
if ($contentEl.length === 0) return; | ||
var $openedItem = $list.length > 0 && $el.parent().children('.accordion-item-opened'); | ||
|
||
if ($openedItem.length > 0) { | ||
app.accordion.close($openedItem); | ||
} | ||
|
||
$contentEl.transitionEnd(function () { | ||
if ($el.hasClass('accordion-item-opened')) { | ||
$contentEl.transition(0); | ||
$contentEl.css('height', 'auto'); | ||
(0, _utils.nextFrame)(function () { | ||
$contentEl.transition(''); | ||
$el.trigger('accordion:opened'); | ||
app.emit('accordionOpened', $el[0]); | ||
}); | ||
} else { | ||
$contentEl.css('height', ''); | ||
$el.trigger('accordion:closed'); | ||
app.emit('accordionClosed', $el[0]); | ||
} | ||
}); | ||
$contentEl.css('height', $contentEl[0].scrollHeight + "px"); | ||
$el.trigger('accordion:open'); | ||
$el.addClass('accordion-item-opened'); | ||
app.emit('accordionOpen', $el[0]); | ||
}, | ||
close: function close(el) { | ||
var app = this; | ||
var $el = (0, _dom.default)(el); | ||
var prevented = false; | ||
|
||
function prevent() { | ||
prevented = true; | ||
} | ||
|
||
$el.trigger('accordion:beforeclose', { | ||
prevent: prevent | ||
}, prevent); | ||
app.emit('accordionBeforeClose', $el[0], prevent); | ||
if (prevented) return; | ||
var $contentEl = $el.children('.accordion-item-content'); | ||
if ($contentEl.length === 0) $contentEl = $el.find('.accordion-item-content'); | ||
$el.removeClass('accordion-item-opened'); | ||
$contentEl.attr('aria-hidden', true); | ||
$contentEl.transition(0); | ||
$contentEl.css('height', $contentEl[0].scrollHeight + "px"); // Close | ||
|
||
$contentEl.transitionEnd(function () { | ||
if ($el.hasClass('accordion-item-opened')) { | ||
$contentEl.transition(0); | ||
$contentEl.css('height', 'auto'); | ||
(0, _utils.nextFrame)(function () { | ||
$contentEl.transition(''); | ||
$el.trigger('accordion:opened'); | ||
app.emit('accordionOpened', $el[0]); | ||
}); | ||
} else { | ||
$contentEl.css('height', ''); | ||
$el.trigger('accordion:closed'); | ||
app.emit('accordionClosed', $el[0]); | ||
} | ||
}); | ||
(0, _utils.nextFrame)(function () { | ||
$contentEl.transition(''); | ||
$contentEl.css('height', ''); | ||
$el.trigger('accordion:close'); | ||
app.emit('accordionClose', $el[0]); | ||
}); | ||
}, | ||
toggle: function toggle(el) { | ||
var app = this; | ||
var $el = (0, _dom.default)(el); | ||
if ($el.length === 0) return; | ||
if ($el.hasClass('accordion-item-opened')) app.accordion.close(el);else app.accordion.open(el); | ||
} | ||
}; | ||
var _default = { | ||
name: 'accordion', | ||
create: function create() { | ||
var app = this; | ||
(0, _utils.bindMethods)(app, { | ||
accordion: Accordion | ||
}); | ||
}, | ||
clicks: { | ||
'.accordion-item .item-link, .accordion-item-toggle, .links-list.accordion-list > ul > li > a': function open($clickedEl) { | ||
var app = this; | ||
Accordion.toggleClicked.call(app, $clickedEl); | ||
} | ||
} | ||
}; | ||
exports.default = _default; |
Oops, something went wrong.