brew-js-react 0.2.3 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brew-js-react.js +130 -106
- package/dist/brew-js-react.js.map +1 -1
- package/dist/brew-js-react.min.js +1 -1
- package/dist/brew-js-react.min.js.map +1 -1
- package/hooks.js +119 -113
- package/include/brew-js/util/path.js +1 -0
- package/mixins/FlyoutMixin.d.ts +1 -1
- package/mixins/FlyoutMixin.js +6 -6
- package/mixins/StatefulMixin.js +6 -6
- package/package.json +2 -2
- package/view.d.ts +27 -0
- package/view.js +223 -211
package/dist/brew-js-react.js
CHANGED
|
@@ -181,6 +181,7 @@ __webpack_require__.d(src_namespaceObject, {
|
|
|
181
181
|
"isViewMatched": () => (isViewMatched),
|
|
182
182
|
"linkTo": () => (linkTo),
|
|
183
183
|
"makeTranslation": () => (makeTranslation),
|
|
184
|
+
"matchView": () => (matchView),
|
|
184
185
|
"navigateTo": () => (navigateTo),
|
|
185
186
|
"redirectTo": () => (redirectTo),
|
|
186
187
|
"registerView": () => (registerView),
|
|
@@ -243,8 +244,10 @@ var _lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_
|
|
|
243
244
|
any = _lib$util.any,
|
|
244
245
|
single = _lib$util.single,
|
|
245
246
|
kv = _lib$util.kv,
|
|
247
|
+
fill = _lib$util.fill,
|
|
246
248
|
pick = _lib$util.pick,
|
|
247
249
|
exclude = _lib$util.exclude,
|
|
250
|
+
mapObject = _lib$util.mapObject,
|
|
248
251
|
mapGet = _lib$util.mapGet,
|
|
249
252
|
mapRemove = _lib$util.mapRemove,
|
|
250
253
|
arrRemove = _lib$util.arrRemove,
|
|
@@ -261,6 +264,7 @@ var _lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_
|
|
|
261
264
|
setImmediateOnce = _lib$util.setImmediateOnce,
|
|
262
265
|
throwNotFunction = _lib$util.throwNotFunction,
|
|
263
266
|
errorWithCode = _lib$util.errorWithCode,
|
|
267
|
+
isErrorWithCode = _lib$util.isErrorWithCode,
|
|
264
268
|
util_keys = _lib$util.keys,
|
|
265
269
|
values = _lib$util.values,
|
|
266
270
|
util_hasOwnProperty = _lib$util.hasOwnProperty,
|
|
@@ -513,6 +517,19 @@ var animateIn = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_bre
|
|
|
513
517
|
|
|
514
518
|
;// CONCATENATED MODULE: ./src/include/brew-js/anim.js
|
|
515
519
|
|
|
520
|
+
;// CONCATENATED MODULE: ./tmp/brew-js/util/path.js
|
|
521
|
+
|
|
522
|
+
var setBaseUrl = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.setBaseUrl,
|
|
523
|
+
combinePath = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.combinePath,
|
|
524
|
+
normalizePath = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.normalizePath,
|
|
525
|
+
removeQueryAndHash = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.removeQueryAndHash,
|
|
526
|
+
withBaseUrl = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.withBaseUrl,
|
|
527
|
+
toAbsoluteUrl = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.toAbsoluteUrl,
|
|
528
|
+
toRelativeUrl = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.toRelativeUrl,
|
|
529
|
+
isSubPathOf = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.isSubPathOf;
|
|
530
|
+
|
|
531
|
+
;// CONCATENATED MODULE: ./src/include/brew-js/util/path.js
|
|
532
|
+
|
|
516
533
|
;// CONCATENATED MODULE: ./src/view.js
|
|
517
534
|
|
|
518
535
|
|
|
@@ -522,38 +539,30 @@ var animateIn = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_bre
|
|
|
522
539
|
|
|
523
540
|
|
|
524
541
|
|
|
542
|
+
|
|
525
543
|
var view_root = zeta_dom_dom.root;
|
|
526
544
|
var routeMap = new Map();
|
|
527
545
|
var usedParams = {};
|
|
546
|
+
var sortedViews = [];
|
|
528
547
|
var StateContext = /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createContext(Object.freeze({
|
|
529
548
|
active: true
|
|
530
549
|
}));
|
|
531
|
-
var stateId;
|
|
532
550
|
|
|
533
551
|
function ViewContainer() {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
external_commonjs_react_commonjs2_react_amd_react_root_React_.Component.apply(self, arguments);
|
|
537
|
-
self.mounted = false;
|
|
538
|
-
|
|
539
|
-
if (!stateId) {
|
|
540
|
-
stateId = history.state;
|
|
541
|
-
app_app.on('navigate', function () {
|
|
542
|
-
stateId = history.state;
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
self.componentWillUnmount = app_app.on('navigate', function () {
|
|
547
|
-
if (self.mounted && self.getViewComponent()) {
|
|
548
|
-
self.isForceUpdate = true;
|
|
549
|
-
self.forceUpdate();
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
+
external_commonjs_react_commonjs2_react_amd_react_root_React_.Component.apply(this, arguments);
|
|
553
|
+
this.stateId = history.state;
|
|
552
554
|
}
|
|
553
555
|
|
|
554
556
|
definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react_root_React_.Component, {
|
|
555
557
|
componentDidMount: function componentDidMount() {
|
|
556
|
-
|
|
558
|
+
/** @type {any} */
|
|
559
|
+
var self = this;
|
|
560
|
+
self.componentWillUnmount = combineFn(watch(app_app.route, function () {
|
|
561
|
+
self.setActive(self.getViewComponent() === self.currentViewComponent);
|
|
562
|
+
}), app_app.on('beforepageload', function () {
|
|
563
|
+
self.stateId = history.state;
|
|
564
|
+
self.forceUpdate();
|
|
565
|
+
}));
|
|
557
566
|
},
|
|
558
567
|
componentDidCatch: function componentDidCatch(error) {
|
|
559
568
|
zeta_dom_dom.emit('error', this.parentElement || view_root, {
|
|
@@ -563,22 +572,32 @@ definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react
|
|
|
563
572
|
render: function render() {
|
|
564
573
|
/** @type {any} */
|
|
565
574
|
var self = this;
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}
|
|
575
|
+
|
|
576
|
+
if (history.state !== self.stateId) {
|
|
577
|
+
return self.lastChild || null;
|
|
578
|
+
}
|
|
579
|
+
|
|
570
580
|
var V = self.getViewComponent();
|
|
571
581
|
|
|
582
|
+
if (V) {
|
|
583
|
+
// ensure the current path actually corresponds to the matched view
|
|
584
|
+
// when some views are not included in the list of allowed views
|
|
585
|
+
var targetPath = linkTo(V, getCurrentParams(V, true));
|
|
586
|
+
|
|
587
|
+
if (targetPath !== removeQueryAndHash(app_app.path)) {
|
|
588
|
+
app_app.navigate(targetPath, true);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
572
592
|
if (V && V !== self.currentViewComponent) {
|
|
573
|
-
|
|
593
|
+
var prevElement = self.currentElement;
|
|
574
594
|
|
|
575
|
-
if (
|
|
576
|
-
|
|
577
|
-
var prevElement = self.currentElement;
|
|
595
|
+
if (prevElement) {
|
|
596
|
+
self.setActive(false);
|
|
578
597
|
self.prevView = self.currentView;
|
|
579
598
|
self.currentElement = undefined;
|
|
580
599
|
app_app.emit('pageleave', prevElement, {
|
|
581
|
-
pathname:
|
|
600
|
+
pathname: self.currentPath
|
|
582
601
|
}, true);
|
|
583
602
|
animateOut(prevElement, 'show').then(function () {
|
|
584
603
|
self.prevView = undefined;
|
|
@@ -586,11 +605,17 @@ definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react
|
|
|
586
605
|
});
|
|
587
606
|
}
|
|
588
607
|
|
|
589
|
-
var
|
|
590
|
-
|
|
591
|
-
|
|
608
|
+
var resolve;
|
|
609
|
+
var promise = new Promise(function (resolve_) {
|
|
610
|
+
resolve = resolve_;
|
|
611
|
+
});
|
|
612
|
+
var state = {
|
|
613
|
+
view: V
|
|
592
614
|
};
|
|
593
|
-
var view = /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(StateContext.Provider,
|
|
615
|
+
var view = /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(StateContext.Provider, {
|
|
616
|
+
key: routeMap.get(V).id,
|
|
617
|
+
value: state
|
|
618
|
+
}, /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(ViewStateContainer, null, /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(V, {
|
|
594
619
|
rootProps: self.props.rootProps,
|
|
595
620
|
onComponentLoaded: function onComponentLoaded(element) {
|
|
596
621
|
self.currentElement = element;
|
|
@@ -604,51 +629,33 @@ definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react
|
|
|
604
629
|
});
|
|
605
630
|
}
|
|
606
631
|
})));
|
|
607
|
-
|
|
608
|
-
|
|
632
|
+
extend(self, {
|
|
633
|
+
currentPath: app_app.path,
|
|
634
|
+
currentView: view,
|
|
635
|
+
currentViewComponent: V,
|
|
636
|
+
setActive: defineObservableProperty(state, 'active', true, true)
|
|
609
637
|
});
|
|
610
|
-
self.
|
|
611
|
-
self.currentView = view;
|
|
612
|
-
} else {
|
|
613
|
-
if (self.isForceUpdate) {
|
|
614
|
-
self.isForceUpdate = false;
|
|
615
|
-
app_app.emit('pageenter', self.currentElement, {
|
|
616
|
-
pathname: app_app.path
|
|
617
|
-
}, true);
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
resolve();
|
|
638
|
+
notifyAsync(self.parentElement || view_root, promise);
|
|
621
639
|
}
|
|
622
640
|
|
|
623
|
-
|
|
624
|
-
|
|
641
|
+
var child = /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(external_commonjs_react_commonjs2_react_amd_react_root_React_.Fragment, null, self.prevView, self.currentView);
|
|
642
|
+
self.lastChild = child;
|
|
643
|
+
return child;
|
|
625
644
|
},
|
|
626
645
|
getViewComponent: function getViewComponent() {
|
|
627
646
|
var props = this.props;
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
if (history.state === stateId) {
|
|
631
|
-
// ensure the current path actually corresponds to the matched view
|
|
632
|
-
// when some views are not included in the list of allowed views
|
|
633
|
-
var targetPath = linkTo(matched, getCurrentParams(matched, true));
|
|
634
|
-
|
|
635
|
-
if (targetPath !== app_app.path) {
|
|
636
|
-
app_app.navigate(targetPath, true);
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
return matched;
|
|
647
|
+
return any(props.views, isViewMatched) || props.defaultView;
|
|
642
648
|
}
|
|
643
649
|
});
|
|
644
650
|
|
|
645
|
-
function getCurrentParams(view, includeAll) {
|
|
651
|
+
function getCurrentParams(view, includeAll, params) {
|
|
646
652
|
var state = routeMap.get(view);
|
|
647
653
|
|
|
648
654
|
if (!state.maxParams) {
|
|
655
|
+
var matchers = exclude(state.matchers, ['remainingSegments']);
|
|
649
656
|
var matched = map(app_app.routes, function (v) {
|
|
650
657
|
var route = app_app.parseRoute(v);
|
|
651
|
-
var matched = route.length && !any(
|
|
658
|
+
var matched = route.length && !any(matchers, function (v, i) {
|
|
652
659
|
var pos = route.params[i];
|
|
653
660
|
return (v ? !(pos >= 0) : pos < route.minLength) || !isFunction(v) && !route.match(i, v);
|
|
654
661
|
});
|
|
@@ -657,8 +664,8 @@ function getCurrentParams(view, includeAll) {
|
|
|
657
664
|
|
|
658
665
|
if (matched[1]) {
|
|
659
666
|
matched = grep(matched, function (v) {
|
|
660
|
-
return !
|
|
661
|
-
return usedParams[i] && !
|
|
667
|
+
return !single(v.params, function (v, i) {
|
|
668
|
+
return usedParams[i] && !matchers[i];
|
|
662
669
|
});
|
|
663
670
|
});
|
|
664
671
|
}
|
|
@@ -674,19 +681,41 @@ function getCurrentParams(view, includeAll) {
|
|
|
674
681
|
}
|
|
675
682
|
}
|
|
676
683
|
|
|
677
|
-
return pick(app_app.route, includeAll ? state.maxParams : state.minParams);
|
|
684
|
+
return pick(params || app_app.route, includeAll ? state.maxParams : state.minParams);
|
|
678
685
|
}
|
|
679
686
|
|
|
680
|
-
function
|
|
681
|
-
return
|
|
687
|
+
function sortViews(a, b) {
|
|
688
|
+
return (routeMap.get(b) || {}).matchCount - (routeMap.get(a) || {}).matchCount;
|
|
682
689
|
}
|
|
683
|
-
|
|
690
|
+
|
|
691
|
+
function matchViewParams(view, route) {
|
|
684
692
|
var params = routeMap.get(view);
|
|
685
|
-
return !!params &&
|
|
686
|
-
var value =
|
|
693
|
+
return !!params && !single(params.matchers, function (v, i) {
|
|
694
|
+
var value = route[i] || '';
|
|
687
695
|
return isFunction(v) ? !v(value) : (v || '') !== value;
|
|
688
696
|
});
|
|
689
697
|
}
|
|
698
|
+
|
|
699
|
+
function useViewContainerState() {
|
|
700
|
+
return external_commonjs_react_commonjs2_react_amd_react_root_React_.useContext(StateContext);
|
|
701
|
+
}
|
|
702
|
+
function isViewMatched(view) {
|
|
703
|
+
return matchViewParams(view, app_app.route);
|
|
704
|
+
}
|
|
705
|
+
function matchView(path, views) {
|
|
706
|
+
var route = app_app.route;
|
|
707
|
+
|
|
708
|
+
if (typeof path === 'string') {
|
|
709
|
+
route = route.parse(path);
|
|
710
|
+
} else {
|
|
711
|
+
views = path;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
views = views ? makeArray(views).sort(sortViews) : sortedViews;
|
|
715
|
+
return any(views, function (v) {
|
|
716
|
+
return matchViewParams(v, route);
|
|
717
|
+
}) || undefined;
|
|
718
|
+
}
|
|
690
719
|
function registerView(factory, routeParams) {
|
|
691
720
|
var Component = function Component(props) {
|
|
692
721
|
var state = (0,external_zeta_dom_react_.useAsync)(factory);
|
|
@@ -718,15 +747,15 @@ function registerView(factory, routeParams) {
|
|
|
718
747
|
return typeof v === 'string';
|
|
719
748
|
})
|
|
720
749
|
});
|
|
750
|
+
sortedViews.push(Component);
|
|
751
|
+
sortedViews.sort(sortViews);
|
|
721
752
|
return Component;
|
|
722
753
|
}
|
|
723
754
|
function renderView() {
|
|
724
755
|
var views = makeArray(arguments);
|
|
725
756
|
var rootProps = isFunction(views[0]) ? {} : views.shift();
|
|
726
757
|
var defaultView = views[0];
|
|
727
|
-
views.sort(
|
|
728
|
-
return (routeMap.get(b) || {}).matchCount - (routeMap.get(a) || {}).matchCount;
|
|
729
|
-
});
|
|
758
|
+
views.sort(sortViews);
|
|
730
759
|
return /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(ViewContainer, {
|
|
731
760
|
rootProps: rootProps,
|
|
732
761
|
views: views,
|
|
@@ -740,7 +769,7 @@ function linkTo(view, params) {
|
|
|
740
769
|
return '/';
|
|
741
770
|
}
|
|
742
771
|
|
|
743
|
-
var newParams = extend(getCurrentParams(view), params, state.params);
|
|
772
|
+
var newParams = extend(getCurrentParams(view), getCurrentParams(view, true, params), state.params);
|
|
744
773
|
return app_app.route.getPath(newParams);
|
|
745
774
|
}
|
|
746
775
|
function navigateTo(view, params) {
|
|
@@ -763,7 +792,8 @@ function getCurrentStates() {
|
|
|
763
792
|
return states[history.state] || (states[history.state] = {});
|
|
764
793
|
}
|
|
765
794
|
|
|
766
|
-
function ViewState(value) {
|
|
795
|
+
function ViewState(key, value) {
|
|
796
|
+
this.key = key;
|
|
767
797
|
this.value = value;
|
|
768
798
|
}
|
|
769
799
|
|
|
@@ -802,9 +832,13 @@ function useRouteParam(name, defaultValue) {
|
|
|
802
832
|
var setValue = function setValue() {
|
|
803
833
|
var current = route[name] || '';
|
|
804
834
|
|
|
805
|
-
if (
|
|
806
|
-
|
|
807
|
-
|
|
835
|
+
if (current !== ref.current) {
|
|
836
|
+
if (container.active) {
|
|
837
|
+
ref.current = current;
|
|
838
|
+
forceUpdate({});
|
|
839
|
+
} else {
|
|
840
|
+
watch(container, 'active', setValue);
|
|
841
|
+
}
|
|
808
842
|
}
|
|
809
843
|
}; // route parameter might be changed after state initialization and before useEffect hook is called
|
|
810
844
|
|
|
@@ -845,20 +879,21 @@ function ViewStateContainer(props) {
|
|
|
845
879
|
return {
|
|
846
880
|
getState: function getState(uniqueId, key) {
|
|
847
881
|
var cur = getCurrentStates();
|
|
848
|
-
var state = cache[uniqueId] || (cache[uniqueId] = new ViewState(cur[key] && cur[key].value));
|
|
882
|
+
var state = cache[uniqueId] || (cache[uniqueId] = new ViewState(key, cur[key] && cur[key].value));
|
|
849
883
|
|
|
850
884
|
if (container.active) {
|
|
851
885
|
var stateId = state.stateId;
|
|
852
886
|
|
|
853
|
-
if (stateId && stateId !== history.state) {
|
|
887
|
+
if (stateId && (stateId !== history.state || key !== state.key)) {
|
|
854
888
|
var newValue = cur[key] && cur[key].value;
|
|
855
889
|
emitter.emit('popstate', state, {
|
|
856
890
|
newValue: newValue
|
|
857
891
|
}); // detach value in previous history state from current one
|
|
858
892
|
|
|
859
|
-
var previous = new ViewState(state.value);
|
|
860
|
-
states[stateId][key] = previous;
|
|
893
|
+
var previous = new ViewState(state.key, state.value);
|
|
894
|
+
states[stateId][previous.key] = previous;
|
|
861
895
|
state.value = newValue;
|
|
896
|
+
state.key = key;
|
|
862
897
|
}
|
|
863
898
|
|
|
864
899
|
state.stateId = history.state;
|
|
@@ -1067,6 +1102,7 @@ function StatefulMixin() {
|
|
|
1067
1102
|
Mixin.call(this);
|
|
1068
1103
|
|
|
1069
1104
|
_(this, {
|
|
1105
|
+
elements: new WeakSet(),
|
|
1070
1106
|
states: {},
|
|
1071
1107
|
prefix: '',
|
|
1072
1108
|
counter: 0
|
|
@@ -1099,8 +1135,9 @@ definePrototype(StatefulMixin, Mixin, {
|
|
|
1099
1135
|
var self = this;
|
|
1100
1136
|
var state = self.state;
|
|
1101
1137
|
return function (current) {
|
|
1102
|
-
|
|
1103
|
-
|
|
1138
|
+
state.element = current;
|
|
1139
|
+
|
|
1140
|
+
if (current && setAdd(_(self).elements, current)) {
|
|
1104
1141
|
self.initElement(current, state);
|
|
1105
1142
|
}
|
|
1106
1143
|
};
|
|
@@ -1122,11 +1159,10 @@ definePrototype(StatefulMixin, Mixin, {
|
|
|
1122
1159
|
var self = this;
|
|
1123
1160
|
var clone = inherit(Object.getPrototypeOf(self), self);
|
|
1124
1161
|
|
|
1125
|
-
_(clone, {
|
|
1126
|
-
states: _(self).states,
|
|
1162
|
+
_(clone, extend({}, _(self), {
|
|
1127
1163
|
prefix: randomId() + '.',
|
|
1128
1164
|
counter: 0
|
|
1129
|
-
});
|
|
1165
|
+
}));
|
|
1130
1166
|
|
|
1131
1167
|
return clone;
|
|
1132
1168
|
},
|
|
@@ -1313,18 +1349,6 @@ definePrototype(ErrorHandlerMixin, StatefulMixin, {
|
|
|
1313
1349
|
});
|
|
1314
1350
|
}
|
|
1315
1351
|
});
|
|
1316
|
-
;// CONCATENATED MODULE: ./tmp/brew-js/var.js
|
|
1317
|
-
|
|
1318
|
-
var getVarScope = undefined.getVarScope,
|
|
1319
|
-
setVar = undefined.setVar,
|
|
1320
|
-
declareVar = undefined.declareVar,
|
|
1321
|
-
resetVar = undefined.resetVar,
|
|
1322
|
-
getVar = undefined.getVar,
|
|
1323
|
-
evaluate = undefined.evaluate,
|
|
1324
|
-
evalAttr = undefined.evalAttr;
|
|
1325
|
-
|
|
1326
|
-
;// CONCATENATED MODULE: ./src/include/brew-js/var.js
|
|
1327
|
-
|
|
1328
1352
|
;// CONCATENATED MODULE: ./src/mixins/FlyoutToggleMixin.js
|
|
1329
1353
|
|
|
1330
1354
|
|
|
@@ -1353,9 +1377,8 @@ definePrototype(FlyoutToggleMixin, ClassNameMixin, {
|
|
|
1353
1377
|
|
|
1354
1378
|
|
|
1355
1379
|
|
|
1356
|
-
|
|
1357
1380
|
var FlyoutMixinSuper = ClassNameMixin.prototype;
|
|
1358
|
-
var
|
|
1381
|
+
var valueMap = new WeakMap();
|
|
1359
1382
|
var flyoutMixinCounter = 0;
|
|
1360
1383
|
function FlyoutMixin() {
|
|
1361
1384
|
var self = this;
|
|
@@ -1396,7 +1419,9 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
|
|
|
1396
1419
|
});
|
|
1397
1420
|
},
|
|
1398
1421
|
open: function open(value) {
|
|
1399
|
-
|
|
1422
|
+
var element = this.elements()[0];
|
|
1423
|
+
valueMap.set(element, value);
|
|
1424
|
+
return openFlyout(element);
|
|
1400
1425
|
},
|
|
1401
1426
|
close: function close(value) {
|
|
1402
1427
|
return closeFlyout(this.elements()[0], value);
|
|
@@ -1405,7 +1430,7 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
|
|
|
1405
1430
|
var element = this.elements()[0];
|
|
1406
1431
|
return this.onToggleState(function (opened) {
|
|
1407
1432
|
if (opened) {
|
|
1408
|
-
return callback(
|
|
1433
|
+
return callback(valueMap.get(element));
|
|
1409
1434
|
}
|
|
1410
1435
|
});
|
|
1411
1436
|
},
|
|
@@ -1421,7 +1446,6 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
|
|
|
1421
1446
|
|
|
1422
1447
|
if (!element.id) {
|
|
1423
1448
|
element.id = 'flyout-' + ++flyoutMixinCounter;
|
|
1424
|
-
declareVar(element, varname, undefined);
|
|
1425
1449
|
}
|
|
1426
1450
|
|
|
1427
1451
|
app_app.on(element, {
|