cx 23.4.2 → 23.4.4
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/LICENSE-THIRD-PARTY.md +91 -91
- package/LICENSE.md +7 -7
- package/README.md +46 -46
- package/dist/charts.js +362 -1149
- package/dist/data.js +159 -558
- package/dist/hooks.js +10 -21
- package/dist/manifest.js +805 -805
- package/dist/svg.js +89 -201
- package/dist/ui.js +463 -1256
- package/dist/util.js +115 -300
- package/dist/widgets.js +1990 -4623
- package/index.js +17 -17
- package/locale/de-de.js +69 -69
- package/locale/en-us.js +71 -71
- package/locale/es-es.js +69 -69
- package/locale/fr-fr.js +70 -70
- package/locale/nl-nl.js +75 -75
- package/locale/pt-pt.js +63 -63
- package/locale/sr-latn-ba.js +70 -70
- package/package.json +32 -30
- package/src/charts/Bar.d.ts +27 -27
- package/src/charts/Bar.js +89 -89
- package/src/charts/Bar.scss +26 -26
- package/src/charts/BarGraph.d.ts +16 -16
- package/src/charts/BarGraph.js +110 -110
- package/src/charts/BarGraph.scss +27 -27
- package/src/charts/BubbleGraph.js +92 -92
- package/src/charts/BubbleGraph.scss +29 -29
- package/src/charts/Chart.d.ts +12 -12
- package/src/charts/Chart.js +77 -77
- package/src/charts/ColorMap.d.ts +21 -21
- package/src/charts/ColorMap.js +98 -98
- package/src/charts/Column.d.ts +27 -27
- package/src/charts/Column.js +88 -88
- package/src/charts/Column.scss +26 -26
- package/src/charts/ColumnBarBase.d.ts +61 -61
- package/src/charts/ColumnBarBase.js +169 -169
- package/src/charts/ColumnBarGraphBase.d.ts +71 -71
- package/src/charts/ColumnBarGraphBase.js +119 -119
- package/src/charts/ColumnGraph.d.ts +19 -19
- package/src/charts/ColumnGraph.js +114 -114
- package/src/charts/ColumnGraph.scss +27 -27
- package/src/charts/Grid.js +5 -5
- package/src/charts/Gridlines.d.ts +24 -24
- package/src/charts/Gridlines.js +48 -48
- package/src/charts/Gridlines.scss +22 -22
- package/src/charts/Legend.d.ts +26 -26
- package/src/charts/Legend.js +142 -142
- package/src/charts/Legend.scss +41 -41
- package/src/charts/LegendEntry.d.ts +37 -37
- package/src/charts/LegendEntry.js +117 -117
- package/src/charts/LegendEntry.scss +30 -30
- package/src/charts/LineGraph.d.ts +92 -92
- package/src/charts/LineGraph.js +211 -211
- package/src/charts/LineGraph.scss +23 -23
- package/src/charts/Marker.d.ts +87 -87
- package/src/charts/Marker.js +287 -287
- package/src/charts/Marker.scss +41 -41
- package/src/charts/MarkerLine.d.ts +57 -57
- package/src/charts/MarkerLine.js +128 -128
- package/src/charts/MarkerLine.scss +17 -17
- package/src/charts/MouseTracker.d.ts +16 -16
- package/src/charts/MouseTracker.js +80 -80
- package/src/charts/Pie.js +8 -8
- package/src/charts/PieChart.d.ts +80 -80
- package/src/charts/PieChart.js +370 -370
- package/src/charts/PieChart.scss +26 -26
- package/src/charts/PieLabel.d.ts +26 -26
- package/src/charts/PieLabel.js +65 -65
- package/src/charts/PieLabelsContainer.d.ts +3 -3
- package/src/charts/PieLabelsContainer.js +55 -55
- package/src/charts/Range.d.ts +74 -74
- package/src/charts/Range.js +205 -205
- package/src/charts/Range.scss +18 -18
- package/src/charts/ScatterGraph.d.ts +65 -65
- package/src/charts/ScatterGraph.js +155 -155
- package/src/charts/ScatterGraph.scss +21 -21
- package/src/charts/axis/Axis.d.ts +82 -82
- package/src/charts/axis/Axis.js +222 -222
- package/src/charts/axis/Axis.scss +22 -22
- package/src/charts/axis/CategoryAxis.d.ts +21 -21
- package/src/charts/axis/CategoryAxis.js +224 -224
- package/src/charts/axis/CategoryAxis.scss +32 -32
- package/src/charts/axis/NumericAxis.d.ts +46 -46
- package/src/charts/axis/NumericAxis.js +347 -347
- package/src/charts/axis/NumericAxis.scss +32 -32
- package/src/charts/axis/Stack.d.ts +10 -10
- package/src/charts/axis/Stack.js +58 -58
- package/src/charts/axis/TimeAxis.d.ts +23 -23
- package/src/charts/axis/TimeAxis.js +510 -510
- package/src/charts/axis/TimeAxis.scss +32 -32
- package/src/charts/axis/index.d.ts +3 -3
- package/src/charts/axis/index.js +3 -3
- package/src/charts/axis/index.scss +5 -5
- package/src/charts/axis/variables.scss +2 -2
- package/src/charts/helpers/MinMaxFinder.d.ts +22 -22
- package/src/charts/helpers/MinMaxFinder.js +36 -36
- package/src/charts/helpers/PointReducer.d.ts +15 -15
- package/src/charts/helpers/PointReducer.js +39 -39
- package/src/charts/helpers/SnapPointFinder.d.ts +24 -24
- package/src/charts/helpers/SnapPointFinder.js +46 -46
- package/src/charts/helpers/ValueAtFinder.d.ts +16 -16
- package/src/charts/helpers/ValueAtFinder.js +41 -41
- package/src/charts/helpers/index.d.ts +4 -4
- package/src/charts/helpers/index.js +4 -4
- package/src/charts/index.d.ts +23 -23
- package/src/charts/index.js +31 -31
- package/src/charts/index.scss +20 -20
- package/src/charts/palette.scss +95 -95
- package/src/charts/shapes.d.ts +22 -22
- package/src/charts/shapes.js +79 -79
- package/src/charts/variables.scss +14 -14
- package/src/core.d.ts +270 -270
- package/src/data/AggregateFunction.d.ts +17 -17
- package/src/data/AggregateFunction.js +148 -148
- package/src/data/ArrayElementView.d.ts +13 -13
- package/src/data/ArrayElementView.js +46 -46
- package/src/data/ArrayElementView.spec.js +70 -70
- package/src/data/ArrayRef.d.ts +14 -14
- package/src/data/ArrayRef.js +34 -34
- package/src/data/AugmentedViewBase.d.ts +18 -18
- package/src/data/AugmentedViewBase.js +67 -67
- package/src/data/Binding.d.ts +17 -17
- package/src/data/Binding.js +86 -76
- package/src/data/Binding.spec.js +51 -61
- package/src/data/ExposedRecordView.d.ts +14 -14
- package/src/data/ExposedRecordView.js +69 -69
- package/src/data/ExposedValueView.d.ts +19 -19
- package/src/data/ExposedValueView.js +72 -72
- package/src/data/Expression.d.ts +16 -16
- package/src/data/Expression.js +211 -211
- package/src/data/Expression.spec.js +164 -164
- package/src/data/Grouper.d.ts +21 -21
- package/src/data/Grouper.js +120 -120
- package/src/data/Grouper.spec.js +22 -22
- package/src/data/NestedDataView.d.ts +19 -19
- package/src/data/NestedDataView.js +22 -22
- package/src/data/ReadOnlyDataView.d.ts +14 -14
- package/src/data/ReadOnlyDataView.js +26 -26
- package/src/data/Ref.d.ts +24 -24
- package/src/data/Ref.js +79 -79
- package/src/data/Ref.spec.js +79 -79
- package/src/data/Store.d.ts +14 -14
- package/src/data/Store.js +46 -46
- package/src/data/Store.spec.js +22 -22
- package/src/data/StoreProxy.d.ts +4 -4
- package/src/data/StoreProxy.js +16 -16
- package/src/data/StoreRef.js +54 -54
- package/src/data/StoreRef.spec.js +24 -24
- package/src/data/StringTemplate.d.ts +13 -13
- package/src/data/StringTemplate.js +85 -85
- package/src/data/StringTemplate.spec.js +95 -95
- package/src/data/StructuredDataAccessor.d.ts +7 -7
- package/src/data/StructuredSelector.d.ts +17 -17
- package/src/data/StructuredSelector.js +131 -131
- package/src/data/StructuredSelector.spec.js +113 -113
- package/src/data/SubscribableView.d.ts +11 -11
- package/src/data/SubscribableView.js +54 -54
- package/src/data/View.d.ts +131 -131
- package/src/data/View.js +182 -182
- package/src/data/View.spec.js +60 -60
- package/src/data/ZoomIntoPropertyView.d.ts +11 -11
- package/src/data/ZoomIntoPropertyView.js +33 -33
- package/src/data/ZoomIntoPropertyView.spec.js +65 -65
- package/src/data/comparer.d.ts +7 -7
- package/src/data/comparer.js +54 -54
- package/src/data/comparer.spec.js +60 -60
- package/src/data/computable.d.ts +125 -125
- package/src/data/computable.js +56 -56
- package/src/data/computable.spec.js +55 -55
- package/src/data/createAccessorModelProxy.d.ts +6 -6
- package/src/data/createAccessorModelProxy.js +43 -43
- package/src/data/createAccessorModelProxy.spec.tsx +38 -44
- package/src/data/createStructuredSelector.d.ts +2 -2
- package/src/data/createStructuredSelector.js +43 -43
- package/src/data/createStructuredSelector.spec.js +46 -46
- package/src/data/defaultCompare.js +14 -14
- package/src/data/diff/diffArrays.d.ts +15 -15
- package/src/data/diff/diffArrays.js +41 -41
- package/src/data/diff/diffs.spec.js +49 -49
- package/src/data/diff/index.d.ts +1 -1
- package/src/data/diff/index.js +1 -1
- package/src/data/enableFatArrowExpansion.d.ts +1 -1
- package/src/data/enableFatArrowExpansion.js +6 -6
- package/src/data/getAccessor.d.ts +8 -8
- package/src/data/getAccessor.js +61 -61
- package/src/data/getSelector.d.ts +3 -3
- package/src/data/getSelector.js +48 -48
- package/src/data/getSelector.spec.js +43 -43
- package/src/data/index.d.ts +30 -30
- package/src/data/index.js +28 -28
- package/src/data/isSelector.d.ts +1 -1
- package/src/data/isSelector.js +26 -26
- package/src/data/ops/append.d.ts +1 -1
- package/src/data/ops/append.js +7 -7
- package/src/data/ops/append.spec.js +28 -28
- package/src/data/ops/filter.d.ts +1 -1
- package/src/data/ops/filter.js +8 -8
- package/src/data/ops/filter.spec.js +29 -29
- package/src/data/ops/findTreeNode.d.ts +1 -1
- package/src/data/ops/findTreeNode.js +15 -15
- package/src/data/ops/findTreeNode.spec.js +24 -24
- package/src/data/ops/findTreePath.d.ts +6 -6
- package/src/data/ops/findTreePath.js +16 -16
- package/src/data/ops/index.d.ts +10 -10
- package/src/data/ops/index.js +11 -11
- package/src/data/ops/insertElement.d.ts +1 -1
- package/src/data/ops/insertElement.js +2 -2
- package/src/data/ops/merge.d.ts +3 -3
- package/src/data/ops/merge.js +9 -9
- package/src/data/ops/merge.spec.js +27 -27
- package/src/data/ops/moveElement.d.ts +1 -1
- package/src/data/ops/moveElement.js +13 -13
- package/src/data/ops/removeTreeNodes.d.ts +5 -5
- package/src/data/ops/removeTreeNodes.js +5 -5
- package/src/data/ops/removeTreeNodes.spec.js +28 -28
- package/src/data/ops/updateArray.d.ts +5 -5
- package/src/data/ops/updateArray.js +24 -24
- package/src/data/ops/updateArray.spec.js +38 -38
- package/src/data/ops/updateTree.d.ts +7 -7
- package/src/data/ops/updateTree.js +25 -25
- package/src/data/ops/updateTree.spec.js +34 -34
- package/src/global.scss +13 -13
- package/src/hooks/createLocalStorageRef.d.ts +2 -2
- package/src/hooks/createLocalStorageRef.js +22 -22
- package/src/hooks/index.d.ts +8 -8
- package/src/hooks/index.js +7 -7
- package/src/hooks/invokeCallback.d.ts +5 -5
- package/src/hooks/invokeCallback.js +6 -6
- package/src/hooks/invokeCallback.spec.js +53 -53
- package/src/hooks/resolveCallback.d.ts +3 -3
- package/src/hooks/resolveCallback.js +11 -11
- package/src/hooks/resolveCallback.spec.js +54 -54
- package/src/hooks/store.d.ts +7 -7
- package/src/hooks/store.js +32 -32
- package/src/hooks/store.spec.js +73 -73
- package/src/hooks/useEffect.d.ts +2 -2
- package/src/hooks/useEffect.js +14 -14
- package/src/hooks/useInterval.js +7 -7
- package/src/hooks/useState.d.ts +2 -2
- package/src/hooks/useState.js +15 -15
- package/src/hooks/useTrigger.d.ts +4 -4
- package/src/hooks/useTrigger.js +20 -20
- package/src/hooks/useTrigger.spec.js +102 -102
- package/src/index.js +7 -7
- package/src/index.scss +6 -6
- package/src/svg/BoundedObject.d.ts +22 -22
- package/src/svg/BoundedObject.js +59 -59
- package/src/svg/ClipRect.d.ts +4 -4
- package/src/svg/ClipRect.js +23 -23
- package/src/svg/Ellipse.d.ts +23 -23
- package/src/svg/Ellipse.js +36 -36
- package/src/svg/Line.d.ts +20 -20
- package/src/svg/Line.js +32 -32
- package/src/svg/NonOverlappingRect.d.ts +5 -5
- package/src/svg/NonOverlappingRect.js +14 -14
- package/src/svg/NonOverlappingRectGroup.d.ts +3 -3
- package/src/svg/NonOverlappingRectGroup.js +36 -36
- package/src/svg/Rectangle.d.ts +23 -23
- package/src/svg/Rectangle.js +36 -36
- package/src/svg/Svg.d.ts +32 -32
- package/src/svg/Svg.js +177 -177
- package/src/svg/Svg.scss +26 -26
- package/src/svg/Text.d.ts +38 -38
- package/src/svg/Text.js +61 -61
- package/src/svg/TextualBoundedObject.d.ts +6 -6
- package/src/svg/TextualBoundedObject.js +28 -28
- package/src/svg/index.d.ts +11 -11
- package/src/svg/index.js +17 -17
- package/src/svg/index.scss +8 -8
- package/src/svg/util/Rect.d.ts +40 -40
- package/src/svg/util/Rect.js +108 -108
- package/src/ui/CSS.d.ts +19 -19
- package/src/ui/CSS.js +79 -79
- package/src/ui/CSSHelper.d.ts +10 -10
- package/src/ui/CSSHelper.js +17 -17
- package/src/ui/Container.d.ts +18 -18
- package/src/ui/Container.js +183 -183
- package/src/ui/ContentResolver.d.ts +12 -12
- package/src/ui/ContentResolver.js +78 -78
- package/src/ui/Controller.d.ts +180 -180
- package/src/ui/Controller.js +114 -114
- package/src/ui/Controller.spec.js +414 -414
- package/src/ui/Culture.d.ts +22 -22
- package/src/ui/Culture.js +65 -65
- package/src/ui/Cx.d.ts +18 -18
- package/src/ui/Cx.js +313 -313
- package/src/ui/Cx.spec.js +193 -193
- package/src/ui/DataProxy.d.ts +11 -11
- package/src/ui/DataProxy.js +44 -44
- package/src/ui/DataProxy.spec.js +335 -335
- package/src/ui/DetachedScope.d.ts +21 -21
- package/src/ui/DetachedScope.js +93 -93
- package/src/ui/FocusManager.d.ts +29 -29
- package/src/ui/FocusManager.js +171 -171
- package/src/ui/Format.d.ts +2 -2
- package/src/ui/Format.js +89 -89
- package/src/ui/HoverSync.d.ts +13 -13
- package/src/ui/HoverSync.js +147 -147
- package/src/ui/Instance.d.ts +69 -69
- package/src/ui/Instance.js +610 -610
- package/src/ui/IsolatedScope.d.ts +16 -16
- package/src/ui/IsolatedScope.js +29 -29
- package/src/ui/IsolatedScope.spec.js +62 -62
- package/src/ui/Localization.d.ts +17 -17
- package/src/ui/Localization.js +72 -72
- package/src/ui/PureContainer.d.ts +16 -16
- package/src/ui/PureContainer.js +7 -7
- package/src/ui/RenderingContext.d.ts +9 -9
- package/src/ui/RenderingContext.js +88 -88
- package/src/ui/Repeater.d.ts +52 -52
- package/src/ui/Repeater.js +98 -98
- package/src/ui/Repeater.spec.js +143 -143
- package/src/ui/Rescope.d.ts +10 -10
- package/src/ui/Rescope.js +31 -31
- package/src/ui/Rescope.spec.js +195 -195
- package/src/ui/ResizeManager.d.ts +9 -9
- package/src/ui/ResizeManager.js +30 -30
- package/src/ui/Restate.d.ts +15 -15
- package/src/ui/Restate.js +4 -1
- package/src/ui/Restate.spec.js +422 -422
- package/src/ui/StaticText.d.ts +8 -8
- package/src/ui/StaticText.js +9 -9
- package/src/ui/StructuredInstanceDataAccessor.d.ts +16 -16
- package/src/ui/StructuredInstanceDataAccessor.js +26 -26
- package/src/ui/Text.d.ts +10 -10
- package/src/ui/Text.js +27 -27
- package/src/ui/VDOM.d.ts +3 -3
- package/src/ui/VDOM.js +2 -2
- package/src/ui/Widget.d.ts +14 -14
- package/src/ui/Widget.js +200 -200
- package/src/ui/ZIndexManager.d.ts +7 -7
- package/src/ui/ZIndexManager.js +11 -11
- package/src/ui/adapter/ArrayAdapter.d.ts +17 -17
- package/src/ui/adapter/ArrayAdapter.js +142 -142
- package/src/ui/adapter/ArrayAdapter.spec.js +55 -55
- package/src/ui/adapter/DataAdapter.d.ts +28 -28
- package/src/ui/adapter/DataAdapter.js +19 -19
- package/src/ui/adapter/GroupAdapter.d.ts +4 -4
- package/src/ui/adapter/GroupAdapter.js +138 -138
- package/src/ui/adapter/TreeAdapter.d.ts +4 -4
- package/src/ui/adapter/TreeAdapter.js +100 -100
- package/src/ui/adapter/TreeAdapter.spec.js +67 -67
- package/src/ui/adapter/index.d.ts +4 -4
- package/src/ui/adapter/index.js +4 -4
- package/src/ui/app/History.d.ts +17 -17
- package/src/ui/app/History.js +114 -114
- package/src/ui/app/Url.d.ts +21 -21
- package/src/ui/app/Url.js +103 -103
- package/src/ui/app/Url.spec.js +51 -51
- package/src/ui/app/index.d.ts +4 -4
- package/src/ui/app/index.js +5 -5
- package/src/ui/app/startAppLoop.d.ts +3 -3
- package/src/ui/app/startAppLoop.js +57 -57
- package/src/ui/app/startHotAppLoop.d.ts +6 -6
- package/src/ui/app/startHotAppLoop.js +25 -25
- package/src/ui/batchUpdates.d.ts +10 -10
- package/src/ui/batchUpdates.js +67 -67
- package/src/ui/bind.d.ts +4 -4
- package/src/ui/bind.js +7 -7
- package/src/ui/createFunctionalComponent.d.ts +1 -1
- package/src/ui/createFunctionalComponent.js +68 -68
- package/src/ui/createFunctionalComponent.spec.js +400 -400
- package/src/ui/expr.d.ts +24 -24
- package/src/ui/expr.js +17 -17
- package/src/ui/flattenProps.js +21 -21
- package/src/ui/index.d.ts +42 -42
- package/src/ui/index.js +44 -44
- package/src/ui/index.scss +2 -2
- package/src/ui/keyboardShortcuts.d.ts +4 -4
- package/src/ui/keyboardShortcuts.js +32 -32
- package/src/ui/layout/Content.d.ts +14 -14
- package/src/ui/layout/Content.js +16 -16
- package/src/ui/layout/ContentPlaceholder.d.ts +17 -17
- package/src/ui/layout/ContentPlaceholder.js +79 -79
- package/src/ui/layout/ContentPlaceholder.spec.js +368 -368
- package/src/ui/layout/FirstVisibleChildLayout.d.ts +4 -4
- package/src/ui/layout/FirstVisibleChildLayout.js +65 -65
- package/src/ui/layout/FirstVisibleChildLayout.spec.js +196 -196
- package/src/ui/layout/LabelsLeftLayout.d.ts +11 -11
- package/src/ui/layout/LabelsLeftLayout.js +59 -59
- package/src/ui/layout/LabelsLeftLayout.scss +44 -44
- package/src/ui/layout/LabelsTopLayout.d.ts +15 -15
- package/src/ui/layout/LabelsTopLayout.js +134 -134
- package/src/ui/layout/LabelsTopLayout.scss +63 -63
- package/src/ui/layout/UseParentLayout.d.ts +4 -4
- package/src/ui/layout/UseParentLayout.js +6 -6
- package/src/ui/layout/exploreChildren.d.ts +14 -14
- package/src/ui/layout/exploreChildren.js +40 -40
- package/src/ui/layout/index.d.ts +10 -10
- package/src/ui/layout/index.js +10 -10
- package/src/ui/layout/index.scss +3 -3
- package/src/ui/layout/variables.scss +2 -2
- package/src/ui/selection/KeySelection.d.ts +17 -17
- package/src/ui/selection/KeySelection.js +129 -129
- package/src/ui/selection/PropertySelection.d.ts +17 -17
- package/src/ui/selection/PropertySelection.js +57 -57
- package/src/ui/selection/Selection.d.ts +27 -27
- package/src/ui/selection/Selection.js +93 -93
- package/src/ui/selection/index.d.ts +3 -3
- package/src/ui/selection/index.js +3 -3
- package/src/ui/tpl.d.ts +2 -2
- package/src/ui/tpl.js +4 -4
- package/src/ui/variables.scss +1 -1
- package/src/util/Component.d.ts +41 -41
- package/src/util/Component.js +107 -107
- package/src/util/Console.d.ts +9 -9
- package/src/util/Console.js +11 -11
- package/src/util/DOM.d.ts +33 -33
- package/src/util/DOM.js +72 -72
- package/src/util/Debug.d.ts +10 -10
- package/src/util/Debug.js +45 -45
- package/src/util/Format.d.ts +13 -13
- package/src/util/Format.js +241 -241
- package/src/util/Format.spec.js +69 -69
- package/src/util/GlobalCacheIdentifier.js +11 -11
- package/src/util/GlobalCacheldentifier.d.ts +6 -6
- package/src/util/KeyCode.d.ts +21 -21
- package/src/util/KeyCode.js +21 -21
- package/src/util/SubscriberList.d.ts +41 -41
- package/src/util/SubscriberList.js +57 -57
- package/src/util/Timing.d.ts +13 -13
- package/src/util/Timing.js +57 -57
- package/src/util/TraversalStack.js +42 -42
- package/src/util/TraversalStack.spec.js +46 -46
- package/src/util/addEventListenerWithOptions.d.ts +6 -6
- package/src/util/addEventListenerWithOptions.js +9 -9
- package/src/util/browserSupportsPassiveEventHandlers.d.ts +4 -4
- package/src/util/browserSupportsPassiveEventHandlers.js +18 -18
- package/src/util/calculateNaturalElementHeight.d.ts +1 -1
- package/src/util/calculateNaturalElementHeight.js +22 -22
- package/src/util/call-once.scss +6 -6
- package/src/util/coalesce.d.ts +1 -1
- package/src/util/coalesce.js +6 -6
- package/src/util/color/hslToRgb.d.ts +8 -8
- package/src/util/color/hslToRgb.js +27 -27
- package/src/util/color/index.d.ts +3 -3
- package/src/util/color/index.js +4 -4
- package/src/util/color/parseColor.d.ts +59 -59
- package/src/util/color/parseColor.js +119 -119
- package/src/util/color/rgbToHex.d.ts +8 -8
- package/src/util/color/rgbToHex.js +7 -7
- package/src/util/color/rgbToHsl.d.ts +8 -8
- package/src/util/color/rgbToHsl.js +27 -27
- package/src/util/date/dateDiff.d.ts +7 -7
- package/src/util/date/dateDiff.js +3 -3
- package/src/util/date/diff.d.ts +7 -7
- package/src/util/date/diff.js +7 -7
- package/src/util/date/encodeDateWithTimezoneOffset.js +18 -18
- package/src/util/date/index.d.ts +8 -8
- package/src/util/date/index.js +9 -9
- package/src/util/date/lowerBoundCheck.d.ts +7 -7
- package/src/util/date/lowerBoundCheck.js +6 -6
- package/src/util/date/maxDate.d.ts +5 -5
- package/src/util/date/maxDate.js +9 -9
- package/src/util/date/minDate.d.ts +5 -5
- package/src/util/date/minDate.js +9 -9
- package/src/util/date/monthStart.d.ts +5 -5
- package/src/util/date/monthStart.js +3 -3
- package/src/util/date/sameDate.d.ts +6 -6
- package/src/util/date/sameDate.js +5 -5
- package/src/util/date/upperBoundCheck.d.ts +7 -7
- package/src/util/date/upperBoundCheck.js +6 -6
- package/src/util/date/upperBoundCheck.spec.js +30 -30
- package/src/util/date/zeroTime.d.ts +6 -6
- package/src/util/date/zeroTime.js +3 -3
- package/src/util/debounce.d.ts +9 -9
- package/src/util/debounce.js +18 -18
- package/src/util/dummyCallback.d.ts +1 -1
- package/src/util/dummyCallback.js +1 -1
- package/src/util/escapeSpecialRegexCharacters.d.ts +6 -6
- package/src/util/escapeSpecialRegexCharacters.js +3 -3
- package/src/util/eventCallbacks.d.ts +4 -4
- package/src/util/eventCallbacks.js +2 -2
- package/src/util/expandFatArrows.js +118 -118
- package/src/util/findScrollableParent.js +16 -16
- package/src/util/getActiveElement.js +3 -3
- package/src/util/getParentFrameBoundingClientRect.js +18 -18
- package/src/util/getScrollerBoundingClientRect.js +21 -21
- package/src/util/getSearchQueryPredicate.js +58 -58
- package/src/util/getSearchQueryPredicate.spec.js +40 -40
- package/src/util/getTopLevelBoundingClientRect.js +13 -13
- package/src/util/getVendorPrefix.js +26 -26
- package/src/util/index.d.ts +50 -50
- package/src/util/index.js +52 -52
- package/src/util/index.scss +10 -10
- package/src/util/innerTextTrim.d.ts +6 -6
- package/src/util/innerTextTrim.js +5 -5
- package/src/util/isArray.d.ts +1 -1
- package/src/util/isArray.js +3 -3
- package/src/util/isDefined.js +3 -3
- package/src/util/isDigit.d.ts +6 -6
- package/src/util/isDigit.js +3 -3
- package/src/util/isFunction.d.ts +1 -1
- package/src/util/isFunction.js +3 -3
- package/src/util/isNonEmptyArray.d.ts +1 -1
- package/src/util/isNonEmptyArray.js +3 -3
- package/src/util/isNumber.d.ts +1 -1
- package/src/util/isNumber.js +3 -3
- package/src/util/isObject.d.ts +1 -1
- package/src/util/isObject.js +3 -3
- package/src/util/isPromise.d.ts +1 -1
- package/src/util/isPromise.js +6 -6
- package/src/util/isString.d.ts +1 -1
- package/src/util/isString.js +3 -3
- package/src/util/isTextInputElement.d.ts +1 -1
- package/src/util/isTextInputElement.js +2 -2
- package/src/util/isTouchDevice.d.ts +1 -1
- package/src/util/isTouchDevice.js +7 -7
- package/src/util/isTouchEvent.d.ts +3 -3
- package/src/util/isTouchEvent.js +64 -64
- package/src/util/isUndefined.d.ts +1 -1
- package/src/util/isUndefined.js +3 -3
- package/src/util/onIdleCallback.js +13 -13
- package/src/util/parseStyle.d.ts +3 -3
- package/src/util/parseStyle.js +27 -27
- package/src/util/quote.d.ts +2 -2
- package/src/util/quote.js +4 -4
- package/src/util/reverseSlice.js +9 -9
- package/src/util/routeAppend.js +15 -15
- package/src/util/routeAppend.spec.js +19 -19
- package/src/util/scrollElementIntoView.d.ts +7 -7
- package/src/util/scrollElementIntoView.js +34 -34
- package/src/util/scss/add-rules.scss +39 -39
- package/src/util/scss/calc.scss +40 -40
- package/src/util/scss/call-once.scss +10 -10
- package/src/util/scss/clockwise.scss +47 -47
- package/src/util/scss/colors.scss +7 -7
- package/src/util/scss/deep-get.scss +9 -9
- package/src/util/scss/deep-merge.scss +18 -18
- package/src/util/scss/divide.scss +3 -3
- package/src/util/scss/include.scss +47 -47
- package/src/util/scss/index.scss +9 -9
- package/src/util/shallowEquals.js +43 -43
- package/src/util/throttle.d.ts +8 -8
- package/src/util/throttle.js +14 -14
- package/src/util/validatedDebounce.js +19 -19
- package/src/variables.scss +217 -217
- package/src/widgets/AccessorBindings.spec.tsx +66 -66
- package/src/widgets/Button.d.ts +58 -58
- package/src/widgets/Button.js +118 -118
- package/src/widgets/Button.scss +117 -117
- package/src/widgets/Button.variables.scss +107 -107
- package/src/widgets/CxCredit.d.ts +12 -12
- package/src/widgets/CxCredit.js +31 -31
- package/src/widgets/CxCredit.scss +41 -41
- package/src/widgets/DocumentTitle.d.ts +11 -11
- package/src/widgets/DocumentTitle.js +68 -68
- package/src/widgets/FlexBox.d.ts +69 -69
- package/src/widgets/FlexBox.js +92 -92
- package/src/widgets/FlexBox.scss +146 -146
- package/src/widgets/Heading.d.ts +16 -16
- package/src/widgets/Heading.js +32 -32
- package/src/widgets/Heading.scss +38 -38
- package/src/widgets/HighlightedSearchText.d.ts +9 -9
- package/src/widgets/HighlightedSearchText.js +36 -36
- package/src/widgets/HighlightedSearchText.scss +18 -18
- package/src/widgets/HtmlElement.d.ts +26 -26
- package/src/widgets/HtmlElement.js +273 -273
- package/src/widgets/HtmlElement.spec.js +57 -57
- package/src/widgets/Icon.d.ts +34 -34
- package/src/widgets/Icon.js +50 -50
- package/src/widgets/Icon.scss +20 -20
- package/src/widgets/List.d.ts +95 -95
- package/src/widgets/List.js +587 -587
- package/src/widgets/List.scss +92 -92
- package/src/widgets/ProgressBar.d.ts +17 -17
- package/src/widgets/ProgressBar.js +46 -46
- package/src/widgets/ProgressBar.scss +49 -49
- package/src/widgets/Resizer.d.ts +27 -27
- package/src/widgets/Resizer.js +151 -151
- package/src/widgets/Resizer.scss +42 -42
- package/src/widgets/Sandbox.d.ts +16 -16
- package/src/widgets/Sandbox.js +62 -62
- package/src/widgets/Section.d.ts +52 -52
- package/src/widgets/Section.js +139 -139
- package/src/widgets/Section.scss +54 -54
- package/src/widgets/animations.scss +10 -10
- package/src/widgets/autoFocus.d.ts +1 -1
- package/src/widgets/autoFocus.js +9 -9
- package/src/widgets/cx.d.ts +1 -1
- package/src/widgets/cx.js +71 -71
- package/src/widgets/drag-drop/DragClone.scss +33 -33
- package/src/widgets/drag-drop/DragHandle.d.ts +10 -10
- package/src/widgets/drag-drop/DragHandle.js +37 -37
- package/src/widgets/drag-drop/DragHandle.scss +16 -16
- package/src/widgets/drag-drop/DragSource.d.ts +45 -45
- package/src/widgets/drag-drop/DragSource.js +160 -160
- package/src/widgets/drag-drop/DragSource.scss +24 -24
- package/src/widgets/drag-drop/DropZone.d.ts +98 -98
- package/src/widgets/drag-drop/DropZone.js +213 -213
- package/src/widgets/drag-drop/DropZone.scss +74 -74
- package/src/widgets/drag-drop/index.d.ts +4 -4
- package/src/widgets/drag-drop/index.js +4 -4
- package/src/widgets/drag-drop/index.scss +3 -3
- package/src/widgets/drag-drop/ops.d.ts +56 -56
- package/src/widgets/drag-drop/ops.js +344 -344
- package/src/widgets/drag-drop/variables.scss +11 -11
- package/src/widgets/enableAllInternalDependencies.d.ts +1 -1
- package/src/widgets/enableAllInternalDependencies.js +11 -11
- package/src/widgets/form/Calendar.d.ts +86 -86
- package/src/widgets/form/Calendar.js +527 -527
- package/src/widgets/form/Calendar.scss +164 -164
- package/src/widgets/form/Calendar.variables.scss +63 -63
- package/src/widgets/form/Checkbox.d.ts +43 -43
- package/src/widgets/form/Checkbox.js +200 -200
- package/src/widgets/form/Checkbox.scss +125 -125
- package/src/widgets/form/Checkbox.variables.scss +39 -39
- package/src/widgets/form/ColorField.d.ts +43 -43
- package/src/widgets/form/ColorField.js +392 -392
- package/src/widgets/form/ColorField.scss +92 -92
- package/src/widgets/form/ColorPicker.d.ts +23 -23
- package/src/widgets/form/ColorPicker.js +451 -451
- package/src/widgets/form/ColorPicker.scss +184 -184
- package/src/widgets/form/ColorPicker.variables.scss +20 -20
- package/src/widgets/form/DateField.d.ts +6 -6
- package/src/widgets/form/DateField.js +12 -12
- package/src/widgets/form/DateTimeField.d.ts +83 -83
- package/src/widgets/form/DateTimeField.js +571 -571
- package/src/widgets/form/DateTimeField.scss +90 -90
- package/src/widgets/form/DateTimePicker.js +391 -391
- package/src/widgets/form/DateTimePicker.scss +44 -44
- package/src/widgets/form/Field.d.ts +112 -112
- package/src/widgets/form/Field.js +419 -419
- package/src/widgets/form/Field.scss +162 -162
- package/src/widgets/form/FieldGroup.d.ts +6 -6
- package/src/widgets/form/FieldGroup.js +5 -5
- package/src/widgets/form/HelpText.d.ts +10 -10
- package/src/widgets/form/HelpText.js +9 -9
- package/src/widgets/form/HelpText.scss +23 -23
- package/src/widgets/form/Label.d.ts +25 -25
- package/src/widgets/form/Label.js +86 -86
- package/src/widgets/form/Label.scss +36 -36
- package/src/widgets/form/LabeledContainer.d.ts +17 -17
- package/src/widgets/form/LabeledContainer.js +59 -59
- package/src/widgets/form/LookupField.d.ts +171 -171
- package/src/widgets/form/LookupField.js +1126 -1126
- package/src/widgets/form/LookupField.scss +219 -219
- package/src/widgets/form/MonthField.d.ts +88 -88
- package/src/widgets/form/MonthField.js +512 -512
- package/src/widgets/form/MonthField.scss +99 -99
- package/src/widgets/form/MonthPicker.d.ts +68 -68
- package/src/widgets/form/MonthPicker.js +631 -631
- package/src/widgets/form/MonthPicker.scss +120 -120
- package/src/widgets/form/NumberField.d.ts +96 -96
- package/src/widgets/form/NumberField.js +459 -459
- package/src/widgets/form/NumberField.scss +65 -65
- package/src/widgets/form/Radio.d.ts +37 -37
- package/src/widgets/form/Radio.js +188 -188
- package/src/widgets/form/Radio.scss +122 -122
- package/src/widgets/form/Radio.variables.scss +45 -45
- package/src/widgets/form/Select.d.ts +73 -73
- package/src/widgets/form/Select.js +274 -274
- package/src/widgets/form/Select.scss +98 -98
- package/src/widgets/form/Slider.d.ts +65 -65
- package/src/widgets/form/Slider.js +351 -351
- package/src/widgets/form/Slider.scss +119 -119
- package/src/widgets/form/Switch.d.ts +38 -38
- package/src/widgets/form/Switch.js +118 -118
- package/src/widgets/form/Switch.scss +140 -140
- package/src/widgets/form/TextArea.d.ts +17 -17
- package/src/widgets/form/TextArea.js +182 -182
- package/src/widgets/form/TextArea.scss +60 -60
- package/src/widgets/form/TextField.d.ts +78 -78
- package/src/widgets/form/TextField.js +285 -285
- package/src/widgets/form/TextField.scss +55 -55
- package/src/widgets/form/TimeField.d.ts +6 -6
- package/src/widgets/form/TimeField.js +11 -11
- package/src/widgets/form/TimeList.js +84 -84
- package/src/widgets/form/UploadButton.d.ts +34 -34
- package/src/widgets/form/UploadButton.js +213 -213
- package/src/widgets/form/UploadButton.scss +47 -47
- package/src/widgets/form/ValidationError.d.ts +10 -10
- package/src/widgets/form/ValidationError.js +44 -44
- package/src/widgets/form/ValidationError.scss +21 -21
- package/src/widgets/form/ValidationGroup.d.ts +38 -38
- package/src/widgets/form/ValidationGroup.js +65 -65
- package/src/widgets/form/ValidationGroup.spec.js +148 -148
- package/src/widgets/form/Validator.d.ts +8 -8
- package/src/widgets/form/Validator.js +21 -21
- package/src/widgets/form/Wheel.js +261 -261
- package/src/widgets/form/Wheel.scss +150 -150
- package/src/widgets/form/index.d.ts +26 -26
- package/src/widgets/form/index.js +29 -29
- package/src/widgets/form/index.scss +24 -24
- package/src/widgets/form/variables.scss +352 -352
- package/src/widgets/grid/Grid.d.ts +403 -403
- package/src/widgets/grid/Grid.js +3255 -3255
- package/src/widgets/grid/Grid.scss +680 -680
- package/src/widgets/grid/GridCell.d.ts +29 -29
- package/src/widgets/grid/GridCell.js +70 -70
- package/src/widgets/grid/GridCellEditor.js +41 -41
- package/src/widgets/grid/GridRow.js +228 -228
- package/src/widgets/grid/GridRowLine.js +24 -24
- package/src/widgets/grid/Pagination.d.ts +14 -14
- package/src/widgets/grid/Pagination.js +94 -94
- package/src/widgets/grid/Pagination.scss +113 -113
- package/src/widgets/grid/TreeNode.d.ts +25 -25
- package/src/widgets/grid/TreeNode.js +102 -102
- package/src/widgets/grid/TreeNode.scss +89 -89
- package/src/widgets/grid/index.d.ts +3 -3
- package/src/widgets/grid/index.js +14 -14
- package/src/widgets/grid/index.scss +3 -3
- package/src/widgets/grid/variables.scss +88 -88
- package/src/widgets/icons/arrow-down.svg +3 -3
- package/src/widgets/icons/arrow-right.svg +2 -2
- package/src/widgets/icons/base.svg +104 -104
- package/src/widgets/icons/calendar-old.svg +169 -169
- package/src/widgets/icons/calendar.js +16 -16
- package/src/widgets/icons/calendar.svg +187 -187
- package/src/widgets/icons/check.js +12 -12
- package/src/widgets/icons/clear.js +14 -14
- package/src/widgets/icons/clear.svg +74 -74
- package/src/widgets/icons/close.js +19 -19
- package/src/widgets/icons/close.svg +74 -74
- package/src/widgets/icons/cx.js +37 -37
- package/src/widgets/icons/drop-down.js +14 -14
- package/src/widgets/icons/dropdown-arrow.svg +61 -61
- package/src/widgets/icons/file.js +12 -12
- package/src/widgets/icons/file.svg +4 -4
- package/src/widgets/icons/folder-open.js +14 -14
- package/src/widgets/icons/folder-open.svg +5 -5
- package/src/widgets/icons/folder.js +12 -12
- package/src/widgets/icons/folder.svg +58 -58
- package/src/widgets/icons/forward.js +21 -21
- package/src/widgets/icons/forward.svg +67 -67
- package/src/widgets/icons/index.js +14 -14
- package/src/widgets/icons/loading.js +23 -23
- package/src/widgets/icons/loading.svg +4 -4
- package/src/widgets/icons/menu.js +16 -16
- package/src/widgets/icons/registry.js +53 -53
- package/src/widgets/icons/search.js +12 -12
- package/src/widgets/icons/search.svg +107 -107
- package/src/widgets/icons/sort-asc.js +13 -13
- package/src/widgets/icons/sort-asc.svg +3 -3
- package/src/widgets/icons/square.js +17 -17
- package/src/widgets/index.d.ts +55 -55
- package/src/widgets/index.js +57 -57
- package/src/widgets/index.scss +16 -16
- package/src/widgets/nav/Link.d.ts +26 -26
- package/src/widgets/nav/Link.js +7 -7
- package/src/widgets/nav/Link.scss +18 -18
- package/src/widgets/nav/LinkButton.d.ts +31 -31
- package/src/widgets/nav/LinkButton.js +127 -127
- package/src/widgets/nav/Menu.d.ts +27 -27
- package/src/widgets/nav/Menu.js +406 -406
- package/src/widgets/nav/Menu.scss +74 -74
- package/src/widgets/nav/Menu.variables.scss +17 -17
- package/src/widgets/nav/MenuItem.d.ts +31 -31
- package/src/widgets/nav/MenuItem.js +445 -445
- package/src/widgets/nav/MenuItem.scss +128 -128
- package/src/widgets/nav/MenuSpacer.d.ts +5 -5
- package/src/widgets/nav/MenuSpacer.js +12 -12
- package/src/widgets/nav/RedirectRoute.d.ts +9 -9
- package/src/widgets/nav/RedirectRoute.js +40 -40
- package/src/widgets/nav/Route.d.ts +21 -21
- package/src/widgets/nav/Route.js +105 -105
- package/src/widgets/nav/Route.spec.js +27 -27
- package/src/widgets/nav/Scroller.d.ts +17 -17
- package/src/widgets/nav/Scroller.js +214 -214
- package/src/widgets/nav/Scroller.scss +146 -146
- package/src/widgets/nav/Submenu.d.ts +6 -6
- package/src/widgets/nav/Submenu.js +6 -6
- package/src/widgets/nav/Tab.d.ts +33 -33
- package/src/widgets/nav/Tab.js +82 -82
- package/src/widgets/nav/Tab.scss +81 -81
- package/src/widgets/nav/Tab.variables.scss +80 -80
- package/src/widgets/nav/cover.scss +21 -21
- package/src/widgets/nav/index.d.ts +10 -10
- package/src/widgets/nav/index.js +10 -10
- package/src/widgets/nav/index.scss +5 -5
- package/src/widgets/nav/variables.scss +25 -25
- package/src/widgets/overlay/ContextMenu.d.ts +10 -10
- package/src/widgets/overlay/ContextMenu.js +29 -29
- package/src/widgets/overlay/Dropdown.d.ts +31 -31
- package/src/widgets/overlay/Dropdown.js +612 -612
- package/src/widgets/overlay/Dropdown.scss +184 -184
- package/src/widgets/overlay/FlyweightTooltipTracker.d.ts +8 -8
- package/src/widgets/overlay/FlyweightTooltipTracker.js +36 -36
- package/src/widgets/overlay/MsgBox.d.ts +16 -16
- package/src/widgets/overlay/MsgBox.js +116 -116
- package/src/widgets/overlay/Overlay.d.ts +69 -69
- package/src/widgets/overlay/Overlay.js +747 -747
- package/src/widgets/overlay/Overlay.scss +66 -66
- package/src/widgets/overlay/Toast.d.ts +30 -30
- package/src/widgets/overlay/Toast.js +92 -92
- package/src/widgets/overlay/Toast.scss +162 -162
- package/src/widgets/overlay/Tooltip.d.ts +50 -50
- package/src/widgets/overlay/Tooltip.js +288 -288
- package/src/widgets/overlay/Tooltip.scss +175 -175
- package/src/widgets/overlay/Window.d.ts +39 -39
- package/src/widgets/overlay/Window.js +195 -195
- package/src/widgets/overlay/Window.scss +112 -112
- package/src/widgets/overlay/Window.variables.scss +67 -67
- package/src/widgets/overlay/alerts.d.ts +7 -7
- package/src/widgets/overlay/alerts.js +39 -39
- package/src/widgets/overlay/captureMouse.d.ts +53 -53
- package/src/widgets/overlay/captureMouse.js +132 -132
- package/src/widgets/overlay/captureMouse.scss +13 -13
- package/src/widgets/overlay/index.d.ts +10 -10
- package/src/widgets/overlay/index.js +10 -10
- package/src/widgets/overlay/index.scss +15 -15
- package/src/widgets/overlay/tooltip-ops.d.ts +8 -8
- package/src/widgets/overlay/tooltip-ops.js +24 -24
- package/src/widgets/overlay/variables.scss +82 -82
- package/src/widgets/variables.scss +144 -144
- package/dist/reset.js +0 -1
package/dist/data.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
isObject,
|
|
3
2
|
isString,
|
|
3
|
+
isObject,
|
|
4
4
|
isFunction,
|
|
5
5
|
Format,
|
|
6
6
|
isDigit,
|
|
@@ -10,32 +10,27 @@ import {
|
|
|
10
10
|
isDefined,
|
|
11
11
|
SubscriberList,
|
|
12
12
|
isUndefined,
|
|
13
|
-
expandFatArrows
|
|
13
|
+
expandFatArrows,
|
|
14
14
|
} from "cx/util";
|
|
15
15
|
|
|
16
16
|
var emptyFn = function emptyFn() {};
|
|
17
|
-
|
|
18
17
|
function createAccessorModelProxy(chain) {
|
|
19
18
|
if (chain === void 0) {
|
|
20
19
|
chain = "";
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
var lastOp = null;
|
|
24
22
|
var proxy = new Proxy(emptyFn, {
|
|
25
23
|
get: function get(_, name) {
|
|
26
24
|
if (typeof name !== "string") return proxy;
|
|
27
|
-
|
|
28
25
|
switch (name) {
|
|
29
26
|
case "isAccessorChain":
|
|
30
27
|
return true;
|
|
31
|
-
|
|
32
28
|
case "toString":
|
|
33
29
|
case "valueOf":
|
|
34
30
|
case "nameOf":
|
|
35
31
|
lastOp = name;
|
|
36
32
|
return proxy;
|
|
37
33
|
}
|
|
38
|
-
|
|
39
34
|
var newChain = chain;
|
|
40
35
|
if (newChain.length > 0) newChain += ".";
|
|
41
36
|
newChain += name;
|
|
@@ -46,11 +41,10 @@ function createAccessorModelProxy(chain) {
|
|
|
46
41
|
case "nameOf":
|
|
47
42
|
var lastDotIndex = chain.lastIndexOf(".");
|
|
48
43
|
return lastDotIndex > 0 ? chain.substring(lastDotIndex + 1) : chain;
|
|
49
|
-
|
|
50
44
|
default:
|
|
51
45
|
return chain;
|
|
52
46
|
}
|
|
53
|
-
}
|
|
47
|
+
},
|
|
54
48
|
});
|
|
55
49
|
return proxy;
|
|
56
50
|
}
|
|
@@ -59,55 +53,50 @@ function isAccessorChain(value) {
|
|
|
59
53
|
}
|
|
60
54
|
|
|
61
55
|
var bindingCache = {};
|
|
62
|
-
var Binding = /*#__PURE__*/ (function() {
|
|
56
|
+
var Binding = /*#__PURE__*/ (function () {
|
|
63
57
|
function Binding(path) {
|
|
64
58
|
this.path = path;
|
|
65
59
|
this.parts = path.split(".");
|
|
66
|
-
var body = "return x";
|
|
67
|
-
|
|
60
|
+
var body = "return (x";
|
|
61
|
+
var selector = "x";
|
|
68
62
|
for (var i = 0; i < this.parts.length; i++) {
|
|
69
|
-
|
|
63
|
+
if (this.parts[i][0] >= "0" && this.parts[i][0] <= "9") selector += "[" + this.parts[i] + "]";
|
|
64
|
+
else selector += "." + this.parts[i];
|
|
65
|
+
if (i + 1 < this.parts.length) body += " && " + selector;
|
|
66
|
+
else body += " ? " + selector + " : undefined";
|
|
70
67
|
}
|
|
71
|
-
|
|
68
|
+
body += ")";
|
|
72
69
|
this.value = new Function("x", body);
|
|
73
70
|
}
|
|
74
|
-
|
|
75
71
|
var _proto = Binding.prototype;
|
|
76
|
-
|
|
77
72
|
_proto.set = function set(state, value) {
|
|
78
73
|
var cv = this.value(state);
|
|
79
74
|
if (cv === value) return state;
|
|
80
75
|
var ns = Object.assign({}, state);
|
|
81
76
|
var o = ns;
|
|
82
|
-
|
|
83
77
|
for (var i = 0; i < this.parts.length; i++) {
|
|
84
78
|
var part = this.parts[i];
|
|
85
79
|
var no = i == this.parts.length - 1 ? value : Object.assign({}, o[part]);
|
|
86
80
|
o[part] = no;
|
|
87
81
|
o = no;
|
|
88
82
|
}
|
|
89
|
-
|
|
90
83
|
return ns;
|
|
91
84
|
};
|
|
92
|
-
|
|
93
85
|
_proto["delete"] = function _delete(state) {
|
|
94
86
|
var ns = Object.assign({}, state);
|
|
95
87
|
var o = ns;
|
|
96
88
|
var part;
|
|
97
|
-
|
|
98
89
|
for (var i = 0; i < this.parts.length - 1; i++) {
|
|
99
90
|
part = this.parts[i];
|
|
100
91
|
var no = Object.assign({}, o[part]);
|
|
101
92
|
o[part] = no;
|
|
102
93
|
o = no;
|
|
103
94
|
}
|
|
104
|
-
|
|
105
95
|
part = this.parts[this.parts.length - 1];
|
|
106
96
|
if (!o.hasOwnProperty(part)) return state;
|
|
107
97
|
delete o[part];
|
|
108
98
|
return ns;
|
|
109
99
|
};
|
|
110
|
-
|
|
111
100
|
Binding.get = function get(path) {
|
|
112
101
|
if (isString(path)) {
|
|
113
102
|
var b = bindingCache[path];
|
|
@@ -116,13 +105,11 @@ var Binding = /*#__PURE__*/ (function() {
|
|
|
116
105
|
bindingCache[path] = b;
|
|
117
106
|
return b;
|
|
118
107
|
}
|
|
119
|
-
|
|
120
108
|
if (isObject(path) && isString(path.bind)) return this.get(path.bind);
|
|
121
109
|
if (path instanceof Binding) return path;
|
|
122
110
|
if (isAccessorChain(path)) return this.get(path.toString());
|
|
123
111
|
throw new Error("Invalid binding definition provided.");
|
|
124
112
|
};
|
|
125
|
-
|
|
126
113
|
return Binding;
|
|
127
114
|
})();
|
|
128
115
|
function isBinding(value) {
|
|
@@ -133,58 +120,50 @@ function isBinding(value) {
|
|
|
133
120
|
|
|
134
121
|
function ownKeys(object, enumerableOnly) {
|
|
135
122
|
var keys = Object.keys(object);
|
|
136
|
-
|
|
137
123
|
if (Object.getOwnPropertySymbols) {
|
|
138
124
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
139
125
|
enumerableOnly &&
|
|
140
|
-
(symbols = symbols.filter(function(sym) {
|
|
126
|
+
(symbols = symbols.filter(function (sym) {
|
|
141
127
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
142
128
|
})),
|
|
143
129
|
keys.push.apply(keys, symbols);
|
|
144
130
|
}
|
|
145
|
-
|
|
146
131
|
return keys;
|
|
147
132
|
}
|
|
148
|
-
|
|
149
133
|
function _objectSpread2(target) {
|
|
150
134
|
for (var i = 1; i < arguments.length; i++) {
|
|
151
135
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
152
136
|
i % 2
|
|
153
|
-
? ownKeys(Object(source), !0).forEach(function(key) {
|
|
137
|
+
? ownKeys(Object(source), !0).forEach(function (key) {
|
|
154
138
|
_defineProperty(target, key, source[key]);
|
|
155
139
|
})
|
|
156
140
|
: Object.getOwnPropertyDescriptors
|
|
157
141
|
? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source))
|
|
158
|
-
: ownKeys(Object(source)).forEach(function(key) {
|
|
142
|
+
: ownKeys(Object(source)).forEach(function (key) {
|
|
159
143
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
160
144
|
});
|
|
161
145
|
}
|
|
162
|
-
|
|
163
146
|
return target;
|
|
164
147
|
}
|
|
165
|
-
|
|
166
148
|
function _defineProperty(obj, key, value) {
|
|
149
|
+
key = _toPropertyKey(key);
|
|
167
150
|
if (key in obj) {
|
|
168
151
|
Object.defineProperty(obj, key, {
|
|
169
152
|
value: value,
|
|
170
153
|
enumerable: true,
|
|
171
154
|
configurable: true,
|
|
172
|
-
writable: true
|
|
155
|
+
writable: true,
|
|
173
156
|
});
|
|
174
157
|
} else {
|
|
175
158
|
obj[key] = value;
|
|
176
159
|
}
|
|
177
|
-
|
|
178
160
|
return obj;
|
|
179
161
|
}
|
|
180
|
-
|
|
181
162
|
function _inheritsLoose(subClass, superClass) {
|
|
182
163
|
subClass.prototype = Object.create(superClass.prototype);
|
|
183
164
|
subClass.prototype.constructor = subClass;
|
|
184
|
-
|
|
185
165
|
_setPrototypeOf(subClass, superClass);
|
|
186
166
|
}
|
|
187
|
-
|
|
188
167
|
function _setPrototypeOf(o, p) {
|
|
189
168
|
_setPrototypeOf = Object.setPrototypeOf
|
|
190
169
|
? Object.setPrototypeOf.bind()
|
|
@@ -194,20 +173,17 @@ function _setPrototypeOf(o, p) {
|
|
|
194
173
|
};
|
|
195
174
|
return _setPrototypeOf(o, p);
|
|
196
175
|
}
|
|
197
|
-
|
|
198
176
|
function _isNativeReflectConstruct() {
|
|
199
177
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
200
178
|
if (Reflect.construct.sham) return false;
|
|
201
179
|
if (typeof Proxy === "function") return true;
|
|
202
|
-
|
|
203
180
|
try {
|
|
204
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
181
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
205
182
|
return true;
|
|
206
183
|
} catch (e) {
|
|
207
184
|
return false;
|
|
208
185
|
}
|
|
209
186
|
}
|
|
210
|
-
|
|
211
187
|
function _construct(Parent, args, Class) {
|
|
212
188
|
if (_isNativeReflectConstruct()) {
|
|
213
189
|
_construct = Reflect.construct.bind();
|
|
@@ -221,28 +197,37 @@ function _construct(Parent, args, Class) {
|
|
|
221
197
|
return instance;
|
|
222
198
|
};
|
|
223
199
|
}
|
|
224
|
-
|
|
225
200
|
return _construct.apply(null, arguments);
|
|
226
201
|
}
|
|
227
|
-
|
|
228
202
|
function _assertThisInitialized(self) {
|
|
229
203
|
if (self === void 0) {
|
|
230
204
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
231
205
|
}
|
|
232
|
-
|
|
233
206
|
return self;
|
|
234
207
|
}
|
|
208
|
+
function _toPrimitive(input, hint) {
|
|
209
|
+
if (typeof input !== "object" || input === null) return input;
|
|
210
|
+
var prim = input[Symbol.toPrimitive];
|
|
211
|
+
if (prim !== undefined) {
|
|
212
|
+
var res = prim.call(input, hint || "default");
|
|
213
|
+
if (typeof res !== "object") return res;
|
|
214
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
215
|
+
}
|
|
216
|
+
return (hint === "string" ? String : Number)(input);
|
|
217
|
+
}
|
|
218
|
+
function _toPropertyKey(arg) {
|
|
219
|
+
var key = _toPrimitive(arg, "string");
|
|
220
|
+
return typeof key === "symbol" ? key : String(key);
|
|
221
|
+
}
|
|
235
222
|
|
|
236
223
|
function computable() {
|
|
237
224
|
var _ref;
|
|
238
|
-
|
|
239
225
|
if (arguments.length == 0)
|
|
240
226
|
throw new Error("computable requires at least a compute function to be passed in arguments.");
|
|
241
227
|
var compute = ((_ref = arguments.length - 1), _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref]);
|
|
242
228
|
if (typeof compute != "function") throw new Error("Last argument to the computable function should be a function.");
|
|
243
229
|
var inputs = [],
|
|
244
230
|
a;
|
|
245
|
-
|
|
246
231
|
for (var i = 0; i + 1 < arguments.length; i++) {
|
|
247
232
|
a = i < 0 || arguments.length <= i ? undefined : arguments[i];
|
|
248
233
|
if (isString(a) || isAccessorChain(a)) inputs.push(Binding.get(a.toString()).value);
|
|
@@ -250,46 +235,39 @@ function computable() {
|
|
|
250
235
|
else if (isFunction(a)) inputs.push(a);
|
|
251
236
|
else throw new Error("Invalid selector type '" + typeof a + "' received.");
|
|
252
237
|
}
|
|
253
|
-
|
|
254
238
|
function memoize(warmupData) {
|
|
255
239
|
var lastValue,
|
|
256
240
|
lastArgs =
|
|
257
241
|
warmupData &&
|
|
258
|
-
inputs.map(function(s) {
|
|
242
|
+
inputs.map(function (s) {
|
|
259
243
|
return s(warmupData);
|
|
260
244
|
});
|
|
261
|
-
return function(data) {
|
|
245
|
+
return function (data) {
|
|
262
246
|
var dirty = false;
|
|
263
|
-
|
|
264
247
|
if (!lastArgs) {
|
|
265
248
|
lastArgs = Array.from({
|
|
266
|
-
length: inputs.length
|
|
249
|
+
length: inputs.length,
|
|
267
250
|
});
|
|
268
251
|
dirty = true;
|
|
269
252
|
}
|
|
270
|
-
|
|
271
253
|
for (var _i = 0; _i < inputs.length; _i++) {
|
|
272
254
|
var v = inputs[_i](data);
|
|
273
|
-
|
|
274
255
|
if (v === lastArgs[_i]) continue;
|
|
275
256
|
lastArgs[_i] = v;
|
|
276
257
|
dirty = true;
|
|
277
258
|
}
|
|
278
|
-
|
|
279
259
|
if (dirty) lastValue = compute.apply(null, lastArgs);
|
|
280
260
|
return lastValue;
|
|
281
261
|
};
|
|
282
262
|
}
|
|
283
|
-
|
|
284
263
|
var selector = function selector(data) {
|
|
285
264
|
return compute.apply(
|
|
286
265
|
null,
|
|
287
|
-
inputs.map(function(s) {
|
|
266
|
+
inputs.map(function (s) {
|
|
288
267
|
return s(data);
|
|
289
268
|
})
|
|
290
269
|
);
|
|
291
270
|
};
|
|
292
|
-
|
|
293
271
|
selector.memoize = memoize;
|
|
294
272
|
return selector;
|
|
295
273
|
}
|
|
@@ -306,10 +284,8 @@ var expCache = {},
|
|
|
306
284
|
helperNames = [],
|
|
307
285
|
helperValues = [],
|
|
308
286
|
expFatArrows = null;
|
|
309
|
-
|
|
310
287
|
function getExpr(expr) {
|
|
311
288
|
if (expr.memoize) return expr;
|
|
312
|
-
|
|
313
289
|
function memoize() {
|
|
314
290
|
var lastValue,
|
|
315
291
|
lastRunBindings = {},
|
|
@@ -317,29 +293,23 @@ function getExpr(expr) {
|
|
|
317
293
|
getters = {},
|
|
318
294
|
currentData,
|
|
319
295
|
len = -1;
|
|
320
|
-
|
|
321
296
|
var get = function get(bindingWithFormat) {
|
|
322
297
|
var getter = getters[bindingWithFormat];
|
|
323
|
-
|
|
324
298
|
if (!getter) {
|
|
325
299
|
var binding = bindingWithFormat,
|
|
326
300
|
format;
|
|
327
301
|
var colonIndex = bindingWithFormat.indexOf(":");
|
|
328
|
-
|
|
329
302
|
if (colonIndex != -1) {
|
|
330
303
|
format = Format.parse(bindingWithFormat.substring(colonIndex + 1));
|
|
331
304
|
binding = bindingWithFormat.substring(0, colonIndex);
|
|
332
305
|
} else {
|
|
333
306
|
var nullSeparatorIndex = bindingWithFormat.indexOf(":");
|
|
334
|
-
|
|
335
307
|
if (nullSeparatorIndex != -1) {
|
|
336
308
|
format = Format.parse(bindingWithFormat.substring(nullSeparatorIndex));
|
|
337
309
|
binding = bindingWithFormat.substring(0, nullSeparatorIndex - 1);
|
|
338
310
|
}
|
|
339
311
|
}
|
|
340
|
-
|
|
341
312
|
var b = Binding.get(binding);
|
|
342
|
-
|
|
343
313
|
getter = function getter(data) {
|
|
344
314
|
var value = b.value(data);
|
|
345
315
|
lastRunBindings[len] = b.value;
|
|
@@ -347,43 +317,31 @@ function getExpr(expr) {
|
|
|
347
317
|
len++;
|
|
348
318
|
return value;
|
|
349
319
|
};
|
|
350
|
-
|
|
351
320
|
if (format) {
|
|
352
321
|
var valueGetter = getter;
|
|
353
|
-
|
|
354
322
|
getter = function getter(data) {
|
|
355
323
|
return format(valueGetter(data));
|
|
356
324
|
};
|
|
357
325
|
}
|
|
358
|
-
|
|
359
326
|
getters[bindingWithFormat] = getter;
|
|
360
327
|
}
|
|
361
|
-
|
|
362
328
|
return getter(currentData);
|
|
363
329
|
};
|
|
364
|
-
|
|
365
|
-
return function(data) {
|
|
330
|
+
return function (data) {
|
|
366
331
|
var i = 0;
|
|
367
|
-
|
|
368
|
-
for (; i < len; i++) {
|
|
369
|
-
if (lastRunBindings[i](data) !== lastRunResults[i]) break;
|
|
370
|
-
}
|
|
371
|
-
|
|
332
|
+
for (; i < len; i++) if (lastRunBindings[i](data) !== lastRunResults[i]) break;
|
|
372
333
|
if (i !== len) {
|
|
373
334
|
len = 0;
|
|
374
335
|
currentData = data;
|
|
375
336
|
lastValue = expr(get);
|
|
376
337
|
}
|
|
377
|
-
|
|
378
338
|
return lastValue;
|
|
379
339
|
};
|
|
380
340
|
}
|
|
381
|
-
|
|
382
341
|
var result = memoize();
|
|
383
342
|
result.memoize = memoize;
|
|
384
343
|
return result;
|
|
385
344
|
}
|
|
386
|
-
|
|
387
345
|
function expression(str) {
|
|
388
346
|
if (isFunction(str)) return getExpr(str);
|
|
389
347
|
var r = expCache[str];
|
|
@@ -396,10 +354,8 @@ function expression(str) {
|
|
|
396
354
|
var args = {};
|
|
397
355
|
var formats = [];
|
|
398
356
|
var subExpr = 0;
|
|
399
|
-
|
|
400
357
|
for (var i = 0; i < str.length; i++) {
|
|
401
358
|
var c = str[i];
|
|
402
|
-
|
|
403
359
|
switch (c) {
|
|
404
360
|
case "{":
|
|
405
361
|
if (curlyBrackets > 0) curlyBrackets++;
|
|
@@ -412,7 +368,6 @@ function expression(str) {
|
|
|
412
368
|
} else if (str[i - 1] != "{") fb.push(c);
|
|
413
369
|
}
|
|
414
370
|
break;
|
|
415
|
-
|
|
416
371
|
case "}":
|
|
417
372
|
if (termStart >= 0) {
|
|
418
373
|
if (--curlyBrackets == 0) {
|
|
@@ -422,36 +377,28 @@ function expression(str) {
|
|
|
422
377
|
var colon = term.indexOf(":", formatStart > 0 ? formatStart : 0);
|
|
423
378
|
var binding = colon == -1 ? term : term.substring(0, colon);
|
|
424
379
|
var format = colon == -1 ? null : term.substring(colon + 1);
|
|
425
|
-
|
|
426
380
|
if (colon == -1) {
|
|
427
381
|
var nullSepIndex = binding.indexOf("|", formatStart);
|
|
428
|
-
|
|
429
382
|
if (nullSepIndex != -1) {
|
|
430
383
|
format = binding.substring(nullSepIndex);
|
|
431
384
|
binding = binding.substring(0, nullSepIndex);
|
|
432
385
|
}
|
|
433
386
|
}
|
|
434
|
-
|
|
435
387
|
var argName = binding.replace(/\./g, "_");
|
|
436
388
|
if (isDigit(argName[0])) argName = "$" + argName;
|
|
437
|
-
|
|
438
389
|
if (percentExpression || (binding[0] == "[" && binding[binding.length - 1] == "]")) {
|
|
439
390
|
argName = "expr" + ++subExpr;
|
|
440
391
|
args[argName] = expression(percentExpression ? binding : binding.substring(1, binding.length - 1));
|
|
441
392
|
} else args[argName] = binding;
|
|
442
|
-
|
|
443
393
|
if (format) {
|
|
444
394
|
var formatter = "fmt" + formats.length;
|
|
445
395
|
fb.push(formatter, "(", argName, ", ", quoteStr(format), ")");
|
|
446
396
|
formats.push(Format.parse(format));
|
|
447
397
|
} else fb.push(argName);
|
|
448
|
-
|
|
449
398
|
termStart = -1;
|
|
450
399
|
}
|
|
451
400
|
} else fb.push(c);
|
|
452
|
-
|
|
453
401
|
break;
|
|
454
|
-
|
|
455
402
|
case '"':
|
|
456
403
|
case "'":
|
|
457
404
|
if (curlyBrackets == 0) {
|
|
@@ -459,37 +406,32 @@ function expression(str) {
|
|
|
459
406
|
else if (str[i - 1] != "\\" && quote == c) quote = false;
|
|
460
407
|
fb.push(c);
|
|
461
408
|
}
|
|
462
|
-
|
|
463
409
|
break;
|
|
464
|
-
|
|
465
410
|
default:
|
|
466
411
|
if (termStart < 0) fb.push(c);
|
|
467
412
|
break;
|
|
468
413
|
}
|
|
469
414
|
}
|
|
470
|
-
|
|
471
415
|
fb.push(")");
|
|
472
416
|
var body = fb.join("");
|
|
473
|
-
if (expFatArrows) body = expFatArrows(body);
|
|
417
|
+
if (expFatArrows) body = expFatArrows(body);
|
|
474
418
|
|
|
419
|
+
//console.log(body);
|
|
475
420
|
var keys = Object.keys(args);
|
|
476
|
-
|
|
477
421
|
try {
|
|
478
422
|
var _Function;
|
|
479
|
-
|
|
480
423
|
var compute = (_Function = _construct(
|
|
481
424
|
Function,
|
|
482
425
|
formats
|
|
483
|
-
.map(function(f, i) {
|
|
426
|
+
.map(function (f, i) {
|
|
484
427
|
return "fmt" + i;
|
|
485
428
|
})
|
|
486
429
|
.concat(keys, helperNames, [body])
|
|
487
430
|
)).bind.apply(_Function, [Format].concat(formats, helperValues));
|
|
488
|
-
|
|
489
431
|
var selector = computable.apply(
|
|
490
432
|
void 0,
|
|
491
433
|
keys
|
|
492
|
-
.map(function(k) {
|
|
434
|
+
.map(function (k) {
|
|
493
435
|
return args[k];
|
|
494
436
|
})
|
|
495
437
|
.concat([compute])
|
|
@@ -510,10 +452,10 @@ var Expression = {
|
|
|
510
452
|
registerHelper: function registerHelper(name, helper) {
|
|
511
453
|
helpers[name] = helper;
|
|
512
454
|
helperNames = Object.keys(helpers);
|
|
513
|
-
helperValues = helperNames.map(function(n) {
|
|
455
|
+
helperValues = helperNames.map(function (n) {
|
|
514
456
|
return helpers[n];
|
|
515
457
|
});
|
|
516
|
-
}
|
|
458
|
+
},
|
|
517
459
|
};
|
|
518
460
|
function plugFatArrowExpansion(impl) {
|
|
519
461
|
expFatArrows = impl;
|
|
@@ -525,7 +467,6 @@ function invalidateExpressionCache() {
|
|
|
525
467
|
function plus(str) {
|
|
526
468
|
return str.length ? str + " + " : str;
|
|
527
469
|
}
|
|
528
|
-
|
|
529
470
|
var tplCache = {};
|
|
530
471
|
function stringTemplate(str) {
|
|
531
472
|
var expr = tplCache[str];
|
|
@@ -536,10 +477,8 @@ function stringTemplate(str) {
|
|
|
536
477
|
term,
|
|
537
478
|
bracketsOpen = 0,
|
|
538
479
|
percentSign;
|
|
539
|
-
|
|
540
480
|
for (var i = 0; i < str.length; i++) {
|
|
541
481
|
var c = str[i];
|
|
542
|
-
|
|
543
482
|
switch (c) {
|
|
544
483
|
case "{":
|
|
545
484
|
if (termStart < 0) {
|
|
@@ -554,20 +493,16 @@ function stringTemplate(str) {
|
|
|
554
493
|
bracketsOpen = 1;
|
|
555
494
|
}
|
|
556
495
|
} else bracketsOpen++;
|
|
557
|
-
|
|
558
496
|
break;
|
|
559
|
-
|
|
560
497
|
case "}":
|
|
561
498
|
if (termStart >= 0) {
|
|
562
499
|
if (--bracketsOpen == 0) {
|
|
563
500
|
term = str.substring(termStart, i);
|
|
564
|
-
|
|
565
501
|
if (term.indexOf(":") == -1) {
|
|
566
502
|
var nullSepIndex = term.indexOf("|");
|
|
567
503
|
if (nullSepIndex == -1) term += ":s";
|
|
568
504
|
else term = term.substring(0, nullSepIndex) + ":s" + term.substring(nullSepIndex);
|
|
569
505
|
}
|
|
570
|
-
|
|
571
506
|
expr = plus(expr) + (percentSign ? "%{" : "{") + term + "}";
|
|
572
507
|
termStart = -1;
|
|
573
508
|
quoteStart = i + 1;
|
|
@@ -578,11 +513,9 @@ function stringTemplate(str) {
|
|
|
578
513
|
i++;
|
|
579
514
|
quoteStart = i + 1;
|
|
580
515
|
}
|
|
581
|
-
|
|
582
516
|
break;
|
|
583
517
|
}
|
|
584
518
|
}
|
|
585
|
-
|
|
586
519
|
if (quoteStart < str.length) expr = plus(expr) + quoteStr(str.substring(quoteStart));
|
|
587
520
|
return (tplCache[str] = expression(expr));
|
|
588
521
|
}
|
|
@@ -597,58 +530,46 @@ var StringTemplate = {
|
|
|
597
530
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
598
531
|
args[_key - 1] = arguments[_key];
|
|
599
532
|
}
|
|
600
|
-
|
|
601
533
|
return stringTemplate(_format)(args);
|
|
602
|
-
}
|
|
534
|
+
},
|
|
603
535
|
};
|
|
604
536
|
function invalidateStringTemplateCache() {
|
|
605
537
|
tplCache = {};
|
|
606
538
|
}
|
|
607
539
|
|
|
608
|
-
var Ref = /*#__PURE__*/ (function(_Component) {
|
|
540
|
+
var Ref = /*#__PURE__*/ (function (_Component) {
|
|
609
541
|
_inheritsLoose(Ref, _Component);
|
|
610
|
-
|
|
611
542
|
function Ref(config) {
|
|
612
543
|
var _this;
|
|
613
|
-
|
|
614
544
|
_this = _Component.call(this, config) || this;
|
|
615
545
|
_this.get = _this.get.bind(_assertThisInitialized(_this));
|
|
616
546
|
if (_this.set) _this.set = _this.set.bind(_assertThisInitialized(_this));
|
|
617
547
|
return _this;
|
|
618
548
|
}
|
|
619
|
-
|
|
620
549
|
var _proto = Ref.prototype;
|
|
621
|
-
|
|
622
550
|
_proto.get = function get() {
|
|
623
551
|
throw new Error("Ref's get method is not implemented.");
|
|
624
552
|
};
|
|
625
|
-
|
|
626
553
|
_proto.init = function init(value) {
|
|
627
554
|
if (this.get() === undefined) this.set(value);
|
|
628
555
|
};
|
|
629
|
-
|
|
630
556
|
_proto.toggle = function toggle() {
|
|
631
557
|
this.set(!this.get());
|
|
632
558
|
};
|
|
633
|
-
|
|
634
559
|
_proto.update = function update(cb) {
|
|
635
560
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
636
561
|
args[_key - 1] = arguments[_key];
|
|
637
562
|
}
|
|
638
|
-
|
|
639
563
|
this.set(cb.apply(void 0, [this.get()].concat(args)));
|
|
640
564
|
};
|
|
641
|
-
|
|
642
565
|
_proto.as = function as(config) {
|
|
643
566
|
return Ref.create(config, {
|
|
644
567
|
get: this.get,
|
|
645
|
-
set: this.set
|
|
568
|
+
set: this.set,
|
|
646
569
|
});
|
|
647
570
|
};
|
|
648
|
-
|
|
649
571
|
_proto.ref = function ref(path) {
|
|
650
572
|
var _this2 = this;
|
|
651
|
-
|
|
652
573
|
var binding = Binding.get(path);
|
|
653
574
|
return Ref.create({
|
|
654
575
|
get: function get() {
|
|
@@ -656,271 +577,219 @@ var Ref = /*#__PURE__*/ (function(_Component) {
|
|
|
656
577
|
},
|
|
657
578
|
set: function set(value) {
|
|
658
579
|
var data = _this2.get();
|
|
659
|
-
|
|
660
580
|
var newData = binding.set(data, value);
|
|
661
581
|
if (data === newData) return false;
|
|
662
582
|
return _this2.set(newData);
|
|
663
|
-
}
|
|
583
|
+
},
|
|
664
584
|
});
|
|
665
|
-
};
|
|
585
|
+
};
|
|
666
586
|
|
|
587
|
+
//allows the function to be passed as a selector, e.g. to computable or addTrigger
|
|
667
588
|
_proto.memoize = function memoize() {
|
|
668
589
|
return this.get;
|
|
669
590
|
};
|
|
670
|
-
|
|
671
591
|
return Ref;
|
|
672
592
|
})(Component);
|
|
673
593
|
Ref.prototype.isRef = true;
|
|
674
|
-
|
|
675
|
-
Ref.factory = function(alias, config, more) {
|
|
594
|
+
Ref.factory = function (alias, config, more) {
|
|
676
595
|
if (isFunction(alias)) {
|
|
677
596
|
var cfg = _objectSpread2(_objectSpread2({}, config), more);
|
|
678
|
-
|
|
679
597
|
if (cfg.store) Object.assign(cfg, cfg.store.getMethods());
|
|
680
598
|
var result = alias(cfg);
|
|
681
599
|
if (result instanceof Ref) return result;
|
|
682
600
|
return this.create(_objectSpread2(_objectSpread2(_objectSpread2({}, config), more), result));
|
|
683
601
|
}
|
|
684
|
-
|
|
685
602
|
return this.create(_objectSpread2(_objectSpread2({}, config), more));
|
|
686
603
|
};
|
|
687
604
|
|
|
688
|
-
var StoreRef = /*#__PURE__*/ (function(_Ref) {
|
|
605
|
+
var StoreRef = /*#__PURE__*/ (function (_Ref) {
|
|
689
606
|
_inheritsLoose(StoreRef, _Ref);
|
|
690
|
-
|
|
691
607
|
function StoreRef(config) {
|
|
692
608
|
var _this;
|
|
693
|
-
|
|
694
609
|
_this = _Ref.call(this, config) || this;
|
|
695
610
|
if (isAccessorChain(_this.path)) _this.path = _this.path.toString();
|
|
696
611
|
return _this;
|
|
697
612
|
}
|
|
698
|
-
|
|
699
613
|
var _proto = StoreRef.prototype;
|
|
700
|
-
|
|
701
614
|
_proto.get = function get() {
|
|
702
615
|
return this.store.get(this.path);
|
|
703
616
|
};
|
|
704
|
-
|
|
705
617
|
_proto.set = function set(value) {
|
|
706
618
|
return this.store.set(this.path, value);
|
|
707
619
|
};
|
|
708
|
-
|
|
709
620
|
_proto.init = function init(value) {
|
|
710
621
|
return this.store.init(this.path, value);
|
|
711
622
|
};
|
|
712
|
-
|
|
713
623
|
_proto.toggle = function toggle() {
|
|
714
624
|
return this.store.toggle(this.path);
|
|
715
625
|
};
|
|
716
|
-
|
|
717
626
|
_proto["delete"] = function _delete() {
|
|
718
627
|
return this.store["delete"](this.path);
|
|
719
628
|
};
|
|
720
|
-
|
|
721
629
|
_proto.update = function update() {
|
|
722
630
|
var _this$store;
|
|
723
|
-
|
|
724
631
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
725
632
|
args[_key] = arguments[_key];
|
|
726
633
|
}
|
|
727
|
-
|
|
728
634
|
return (_this$store = this.store).update.apply(_this$store, [this.path].concat(args));
|
|
729
|
-
};
|
|
635
|
+
};
|
|
730
636
|
|
|
637
|
+
//allows the function to be passed as a selector, e.g. to computable or addTrigger
|
|
731
638
|
_proto.memoize = function memoize() {
|
|
732
639
|
return this.get;
|
|
733
640
|
};
|
|
734
|
-
|
|
735
641
|
_proto.ref = function ref(path) {
|
|
736
642
|
return new StoreRef({
|
|
737
643
|
path: this.path + "." + path,
|
|
738
|
-
store: this.store
|
|
644
|
+
store: this.store,
|
|
739
645
|
});
|
|
740
646
|
};
|
|
741
|
-
|
|
742
647
|
_proto.as = function as(config) {
|
|
743
648
|
return StoreRef.create(config, {
|
|
744
649
|
path: this.path,
|
|
745
650
|
store: this.store,
|
|
746
651
|
get: this.get,
|
|
747
|
-
set: this.set
|
|
652
|
+
set: this.set,
|
|
748
653
|
});
|
|
749
654
|
};
|
|
750
|
-
|
|
751
655
|
return StoreRef;
|
|
752
656
|
})(Ref);
|
|
753
657
|
|
|
754
|
-
var View = /*#__PURE__*/ (function() {
|
|
658
|
+
var View = /*#__PURE__*/ (function () {
|
|
755
659
|
function View(config) {
|
|
756
660
|
Object.assign(this, config);
|
|
757
661
|
this.cache = {
|
|
758
|
-
version: -1
|
|
662
|
+
version: -1,
|
|
759
663
|
};
|
|
760
664
|
if (this.store) this.setStore(this.store);
|
|
761
665
|
}
|
|
762
|
-
|
|
763
666
|
var _proto = View.prototype;
|
|
764
|
-
|
|
765
667
|
_proto.getData = function getData() {
|
|
766
668
|
throw new Error("abstract method");
|
|
767
669
|
};
|
|
768
|
-
|
|
769
670
|
_proto.init = function init(path, value) {
|
|
770
671
|
if (typeof path == "object" && path != null) {
|
|
771
672
|
var changed = false;
|
|
772
|
-
|
|
773
|
-
for (var key in path) {
|
|
673
|
+
for (var key in path)
|
|
774
674
|
if (path.hasOwnProperty(key) && this.get(key) === undefined && this.setItem(key, path[key])) changed = true;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
675
|
return changed;
|
|
778
676
|
}
|
|
779
|
-
|
|
780
677
|
var binding = Binding.get(path);
|
|
781
678
|
if (this.get(binding.path) === undefined) return this.setItem(binding.path, value);
|
|
782
679
|
return false;
|
|
783
680
|
};
|
|
784
|
-
|
|
785
681
|
_proto.set = function set(path, value) {
|
|
786
682
|
if (isObject(path)) {
|
|
787
683
|
var changed = false;
|
|
788
|
-
|
|
789
|
-
for (var key in path) {
|
|
790
|
-
if (path.hasOwnProperty(key) && this.setItem(key, path[key])) changed = true;
|
|
791
|
-
}
|
|
792
|
-
|
|
684
|
+
for (var key in path) if (path.hasOwnProperty(key) && this.setItem(key, path[key])) changed = true;
|
|
793
685
|
return changed;
|
|
794
686
|
}
|
|
795
|
-
|
|
796
687
|
var binding = Binding.get(path);
|
|
797
688
|
return this.setItem(binding.path, value);
|
|
798
689
|
};
|
|
799
|
-
|
|
800
690
|
_proto.copy = function copy(from, to) {
|
|
801
691
|
var value = this.get(from);
|
|
802
692
|
this.set(to, value);
|
|
803
693
|
};
|
|
804
|
-
|
|
805
694
|
_proto.move = function move(from, to) {
|
|
806
695
|
var _this = this;
|
|
807
|
-
|
|
808
|
-
this.batch(function() {
|
|
696
|
+
this.batch(function () {
|
|
809
697
|
_this.copy(from, to);
|
|
810
|
-
|
|
811
698
|
_this["delete"](from);
|
|
812
699
|
});
|
|
813
|
-
};
|
|
700
|
+
};
|
|
814
701
|
|
|
702
|
+
//protected
|
|
815
703
|
_proto.setItem = function setItem(path, value) {
|
|
816
704
|
if (this.store) return this.store.setItem(path, value);
|
|
817
705
|
throw new Error("abstract method");
|
|
818
706
|
};
|
|
819
|
-
|
|
820
707
|
_proto["delete"] = function _delete(path) {
|
|
821
708
|
var _this2 = this;
|
|
822
|
-
|
|
823
709
|
if (arguments.length > 1) path = Array.from(arguments);
|
|
824
710
|
if (isArray(path))
|
|
825
711
|
return path
|
|
826
|
-
.map(function(arg) {
|
|
712
|
+
.map(function (arg) {
|
|
827
713
|
return _this2["delete"](arg);
|
|
828
714
|
})
|
|
829
715
|
.some(Boolean);
|
|
830
716
|
var binding = Binding.get(path);
|
|
831
717
|
return this.deleteItem(binding.path);
|
|
832
|
-
};
|
|
718
|
+
};
|
|
833
719
|
|
|
720
|
+
//protected
|
|
834
721
|
_proto.deleteItem = function deleteItem(path) {
|
|
835
722
|
if (this.store) return this.store.deleteItem(path);
|
|
836
723
|
throw new Error("abstract method");
|
|
837
724
|
};
|
|
838
|
-
|
|
839
725
|
_proto.clear = function clear() {
|
|
840
726
|
if (this.store) return this.store.clear();
|
|
841
727
|
throw new Error("abstract method");
|
|
842
728
|
};
|
|
843
|
-
|
|
844
729
|
_proto.get = function get(path) {
|
|
845
730
|
var storeData = this.getData();
|
|
846
731
|
if (arguments.length > 1) path = Array.from(arguments);
|
|
847
732
|
if (isArray(path))
|
|
848
|
-
return path.map(function(arg) {
|
|
733
|
+
return path.map(function (arg) {
|
|
849
734
|
return Binding.get(arg).value(storeData);
|
|
850
735
|
});
|
|
851
736
|
return Binding.get(path).value(storeData);
|
|
852
737
|
};
|
|
853
|
-
|
|
854
738
|
_proto.toggle = function toggle(path) {
|
|
855
739
|
return this.set(path, !this.get(path));
|
|
856
740
|
};
|
|
857
|
-
|
|
858
741
|
_proto.update = function update(path, updateFn) {
|
|
859
742
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
860
743
|
args[_key - 2] = arguments[_key];
|
|
861
744
|
}
|
|
862
|
-
|
|
863
745
|
if (arguments.length == 1 && isFunction(path))
|
|
864
746
|
return this.load(path.apply(null, [this.getData(), updateFn].concat(args)));
|
|
865
747
|
return this.set(path, updateFn.apply(null, [this.get(path)].concat(args)));
|
|
866
748
|
};
|
|
867
|
-
|
|
868
749
|
_proto.batch = function batch(callback) {
|
|
869
750
|
var dirty = this.silently(callback);
|
|
870
751
|
if (dirty) this.notify();
|
|
871
752
|
return dirty;
|
|
872
753
|
};
|
|
873
|
-
|
|
874
754
|
_proto.silently = function silently(callback) {
|
|
875
755
|
if (this.store) return this.store.silently(callback);
|
|
876
756
|
throw new Error("abstract method");
|
|
877
757
|
};
|
|
878
|
-
|
|
879
758
|
_proto.notify = function notify(path) {
|
|
880
759
|
if (this.notificationsSuspended) this.dirty = true;
|
|
881
760
|
else this.doNotify(path);
|
|
882
761
|
};
|
|
883
|
-
|
|
884
762
|
_proto.doNotify = function doNotify(path) {
|
|
885
763
|
if (this.store) return this.store.notify(path);
|
|
886
764
|
throw new Error("abstract method");
|
|
887
765
|
};
|
|
888
|
-
|
|
889
766
|
_proto.subscribe = function subscribe(callback) {
|
|
890
767
|
if (this.store) return this.store.subscribe(callback);
|
|
891
768
|
throw new Error("abstract method");
|
|
892
769
|
};
|
|
893
|
-
|
|
894
770
|
_proto.load = function load(data) {
|
|
895
|
-
return this.batch(function(store) {
|
|
896
|
-
for (var key in data)
|
|
897
|
-
store.set(key, data[key]);
|
|
898
|
-
}
|
|
771
|
+
return this.batch(function (store) {
|
|
772
|
+
for (var key in data) store.set(key, data[key]);
|
|
899
773
|
});
|
|
900
774
|
};
|
|
901
|
-
|
|
902
775
|
_proto.dispatch = function dispatch(action) {
|
|
903
776
|
if (this.store) return this.store.dispatch(action);
|
|
904
777
|
throw new Error("The underlying store doesn't support dispatch.");
|
|
905
778
|
};
|
|
906
|
-
|
|
907
779
|
_proto.getMeta = function getMeta() {
|
|
908
780
|
return this.meta;
|
|
909
781
|
};
|
|
910
|
-
|
|
911
782
|
_proto.setStore = function setStore(store) {
|
|
912
783
|
this.store = store;
|
|
913
784
|
this.meta = store.getMeta();
|
|
914
785
|
};
|
|
915
|
-
|
|
916
786
|
_proto.ref = function ref(path, defaultValue) {
|
|
917
787
|
if (isDefined(defaultValue)) this.init(path, defaultValue);
|
|
918
788
|
return StoreRef.create({
|
|
919
789
|
store: this,
|
|
920
|
-
path: path
|
|
790
|
+
path: path,
|
|
921
791
|
});
|
|
922
792
|
};
|
|
923
|
-
|
|
924
793
|
_proto.getMethods = function getMethods() {
|
|
925
794
|
return {
|
|
926
795
|
getData: this.getData.bind(this),
|
|
@@ -931,72 +800,59 @@ var View = /*#__PURE__*/ (function() {
|
|
|
931
800
|
toggle: this.toggle.bind(this),
|
|
932
801
|
init: this.init.bind(this),
|
|
933
802
|
ref: this.ref.bind(this),
|
|
934
|
-
mutate: this.ref.bind(this)
|
|
803
|
+
mutate: this.ref.bind(this),
|
|
935
804
|
};
|
|
936
805
|
};
|
|
937
|
-
|
|
938
806
|
return View;
|
|
939
807
|
})();
|
|
940
808
|
View.prototype.sealed = false; //indicate that data should be copied before virtual items are added
|
|
941
|
-
//Immer integration point
|
|
942
809
|
|
|
943
|
-
|
|
810
|
+
//Immer integration point
|
|
811
|
+
View.prototype.mutate = function () {
|
|
944
812
|
throw new Error(
|
|
945
813
|
"Mutate requires Immer. Please install 'immer' and 'cx-immer' packages and enable store mutation by calling enableImmerMutate()."
|
|
946
814
|
);
|
|
947
815
|
};
|
|
948
816
|
|
|
949
|
-
var SubscribableView = /*#__PURE__*/ (function(_View) {
|
|
817
|
+
var SubscribableView = /*#__PURE__*/ (function (_View) {
|
|
950
818
|
_inheritsLoose(SubscribableView, _View);
|
|
951
|
-
|
|
952
819
|
function SubscribableView(config) {
|
|
953
820
|
var _this;
|
|
954
|
-
|
|
955
821
|
_this = _View.call(this, config) || this;
|
|
956
822
|
_this.subscribers = new SubscriberList();
|
|
957
823
|
_this.changes = [];
|
|
958
824
|
return _this;
|
|
959
825
|
}
|
|
960
|
-
|
|
961
826
|
var _proto = SubscribableView.prototype;
|
|
962
|
-
|
|
963
827
|
_proto.subscribe = function subscribe(callback) {
|
|
964
828
|
return this.subscribers.subscribe(callback);
|
|
965
829
|
};
|
|
966
|
-
|
|
967
830
|
_proto.unsubscribeAll = function unsubscribeAll() {
|
|
968
831
|
this.subscribers.clear();
|
|
969
832
|
};
|
|
970
|
-
|
|
971
833
|
_proto.doNotify = function doNotify(path) {
|
|
972
834
|
var _this2 = this;
|
|
973
|
-
|
|
974
835
|
if (this.notificationsSuspended) return;
|
|
975
|
-
|
|
976
836
|
if (!this.async) {
|
|
977
837
|
this.subscribers.notify([path]);
|
|
978
838
|
} else {
|
|
979
839
|
this.changes.push(path || "");
|
|
980
|
-
|
|
981
840
|
if (!this.scheduled) {
|
|
982
841
|
this.scheduled = true;
|
|
983
|
-
setTimeout(function() {
|
|
842
|
+
setTimeout(function () {
|
|
984
843
|
_this2.scheduled = false;
|
|
985
844
|
var changes = _this2.changes;
|
|
986
845
|
_this2.changes = [];
|
|
987
|
-
|
|
988
846
|
_this2.subscribers.notify(changes);
|
|
989
847
|
}, 0);
|
|
990
848
|
}
|
|
991
849
|
}
|
|
992
850
|
};
|
|
993
|
-
|
|
994
851
|
_proto.silently = function silently(callback) {
|
|
995
852
|
this.notificationsSuspended = (this.notificationsSuspended || 0) + 1;
|
|
996
853
|
var wasDirty = this.dirty,
|
|
997
854
|
dirty;
|
|
998
855
|
this.dirty = false;
|
|
999
|
-
|
|
1000
856
|
try {
|
|
1001
857
|
callback(this);
|
|
1002
858
|
} finally {
|
|
@@ -1004,83 +860,65 @@ var SubscribableView = /*#__PURE__*/ (function(_View) {
|
|
|
1004
860
|
dirty = this.dirty;
|
|
1005
861
|
this.dirty = wasDirty;
|
|
1006
862
|
}
|
|
1007
|
-
|
|
1008
863
|
return dirty;
|
|
1009
864
|
};
|
|
1010
|
-
|
|
1011
865
|
return SubscribableView;
|
|
1012
866
|
})(View);
|
|
1013
867
|
SubscribableView.prototype.async = false;
|
|
1014
868
|
|
|
1015
|
-
var Store = /*#__PURE__*/ (function(_SubscribableView) {
|
|
869
|
+
var Store = /*#__PURE__*/ (function (_SubscribableView) {
|
|
1016
870
|
_inheritsLoose(Store, _SubscribableView);
|
|
1017
|
-
|
|
1018
871
|
function Store(config) {
|
|
1019
872
|
var _this;
|
|
1020
|
-
|
|
1021
873
|
if (config === void 0) {
|
|
1022
874
|
config = {};
|
|
1023
875
|
}
|
|
1024
|
-
|
|
1025
876
|
_this = _SubscribableView.call(this, config) || this;
|
|
1026
877
|
_this.data = config.data || {};
|
|
1027
878
|
_this.meta = {
|
|
1028
|
-
version: 0
|
|
879
|
+
version: 0,
|
|
1029
880
|
};
|
|
1030
881
|
return _this;
|
|
1031
882
|
}
|
|
1032
|
-
|
|
1033
883
|
var _proto = Store.prototype;
|
|
1034
|
-
|
|
1035
884
|
_proto.getData = function getData() {
|
|
1036
885
|
return this.data;
|
|
1037
886
|
};
|
|
1038
|
-
|
|
1039
887
|
_proto.setItem = function setItem(path, value) {
|
|
1040
888
|
var next = Binding.get(path).set(this.data, value);
|
|
1041
|
-
|
|
1042
889
|
if (next != this.data) {
|
|
1043
890
|
this.data = next;
|
|
1044
891
|
this.meta.version++;
|
|
1045
892
|
this.notify(path);
|
|
1046
893
|
return true;
|
|
1047
894
|
}
|
|
1048
|
-
|
|
1049
895
|
return false;
|
|
1050
896
|
};
|
|
1051
|
-
|
|
1052
897
|
_proto.deleteItem = function deleteItem(path) {
|
|
1053
898
|
var next = Binding.get(path)["delete"](this.data);
|
|
1054
|
-
|
|
1055
899
|
if (next != this.data) {
|
|
1056
900
|
this.data = next;
|
|
1057
901
|
this.meta.version++;
|
|
1058
902
|
this.notify(path);
|
|
1059
903
|
return true;
|
|
1060
904
|
}
|
|
1061
|
-
|
|
1062
905
|
return false;
|
|
1063
906
|
};
|
|
1064
|
-
|
|
1065
907
|
_proto.clear = function clear() {
|
|
1066
908
|
this.data = {};
|
|
1067
909
|
this.meta.version++;
|
|
1068
910
|
this.notify();
|
|
1069
911
|
};
|
|
1070
|
-
|
|
1071
912
|
return Store;
|
|
1072
913
|
})(SubscribableView);
|
|
1073
914
|
Store.prototype.async = false;
|
|
1074
915
|
|
|
1075
|
-
var ExposedRecordView = /*#__PURE__*/ (function(_View) {
|
|
916
|
+
var ExposedRecordView = /*#__PURE__*/ (function (_View) {
|
|
1076
917
|
_inheritsLoose(ExposedRecordView, _View);
|
|
1077
|
-
|
|
1078
918
|
function ExposedRecordView() {
|
|
1079
919
|
return _View.apply(this, arguments) || this;
|
|
1080
920
|
}
|
|
1081
|
-
|
|
1082
921
|
var _proto = ExposedRecordView.prototype;
|
|
1083
|
-
|
|
1084
922
|
_proto.getData = function getData() {
|
|
1085
923
|
if (this.sealed && this.meta.version === this.cache.version && this.cache.itemIndex === this.itemIndex)
|
|
1086
924
|
return this.cache.result;
|
|
@@ -1089,7 +927,6 @@ var ExposedRecordView = /*#__PURE__*/ (function(_View) {
|
|
|
1089
927
|
this.cache.itemIndex = this.itemIndex;
|
|
1090
928
|
return this.cache.result;
|
|
1091
929
|
};
|
|
1092
|
-
|
|
1093
930
|
_proto.embed = function embed(data) {
|
|
1094
931
|
var collection = this.collectionBinding.value(data);
|
|
1095
932
|
var record = collection[this.itemIndex];
|
|
@@ -1098,11 +935,9 @@ var ExposedRecordView = /*#__PURE__*/ (function(_View) {
|
|
|
1098
935
|
if (this.indexName) copy[this.indexName] = this.itemIndex;
|
|
1099
936
|
return copy;
|
|
1100
937
|
};
|
|
1101
|
-
|
|
1102
938
|
_proto.setIndex = function setIndex(index) {
|
|
1103
939
|
this.itemIndex = index;
|
|
1104
940
|
};
|
|
1105
|
-
|
|
1106
941
|
_proto.setItem = function setItem(path, value) {
|
|
1107
942
|
if (path == this.recordName || path.indexOf(this.recordName + ".") == 0) {
|
|
1108
943
|
var storeData = this.store.getData();
|
|
@@ -1118,13 +953,10 @@ var ExposedRecordView = /*#__PURE__*/ (function(_View) {
|
|
|
1118
953
|
);
|
|
1119
954
|
return this.store.setItem(this.collectionBinding.path, newCollection);
|
|
1120
955
|
}
|
|
1121
|
-
|
|
1122
956
|
return this.store.setItem(path, value);
|
|
1123
957
|
};
|
|
1124
|
-
|
|
1125
958
|
_proto.deleteItem = function deleteItem(path) {
|
|
1126
959
|
var storeData, collection, newCollection;
|
|
1127
|
-
|
|
1128
960
|
if (path == this.recordName) {
|
|
1129
961
|
storeData = this.store.getData();
|
|
1130
962
|
collection = this.collectionBinding.value(storeData);
|
|
@@ -1140,23 +972,18 @@ var ExposedRecordView = /*#__PURE__*/ (function(_View) {
|
|
|
1140
972
|
newCollection = [].concat(collection.slice(0, this.itemIndex), [record], collection.slice(this.itemIndex + 1));
|
|
1141
973
|
return this.store.setItem(this.collectionBinding.path, newCollection);
|
|
1142
974
|
}
|
|
1143
|
-
|
|
1144
975
|
return this.store.deleteItem(path);
|
|
1145
976
|
};
|
|
1146
|
-
|
|
1147
977
|
return ExposedRecordView;
|
|
1148
978
|
})(View);
|
|
1149
979
|
ExposedRecordView.prototype.immutable = false;
|
|
1150
980
|
|
|
1151
|
-
var ExposedValueView = /*#__PURE__*/ (function(_View) {
|
|
981
|
+
var ExposedValueView = /*#__PURE__*/ (function (_View) {
|
|
1152
982
|
_inheritsLoose(ExposedValueView, _View);
|
|
1153
|
-
|
|
1154
983
|
function ExposedValueView() {
|
|
1155
984
|
return _View.apply(this, arguments) || this;
|
|
1156
985
|
}
|
|
1157
|
-
|
|
1158
986
|
var _proto = ExposedValueView.prototype;
|
|
1159
|
-
|
|
1160
987
|
_proto.getData = function getData() {
|
|
1161
988
|
if (this.sealed && this.meta.version === this.cache.version && this.cache.key === this.key)
|
|
1162
989
|
return this.cache.result;
|
|
@@ -1169,15 +996,12 @@ var ExposedValueView = /*#__PURE__*/ (function(_View) {
|
|
|
1169
996
|
this.cache.result[this.recordName] = record;
|
|
1170
997
|
return this.cache.result;
|
|
1171
998
|
};
|
|
1172
|
-
|
|
1173
999
|
_proto.setKey = function setKey(key) {
|
|
1174
1000
|
this.key = key;
|
|
1175
1001
|
};
|
|
1176
|
-
|
|
1177
1002
|
_proto.getKey = function getKey() {
|
|
1178
1003
|
return this.key;
|
|
1179
1004
|
};
|
|
1180
|
-
|
|
1181
1005
|
_proto.setItem = function setItem(path, value) {
|
|
1182
1006
|
if (path == this.recordName || path.indexOf(this.recordName + ".") == 0) {
|
|
1183
1007
|
var data = this.getData();
|
|
@@ -1189,13 +1013,10 @@ var ExposedValueView = /*#__PURE__*/ (function(_View) {
|
|
|
1189
1013
|
newContainer[this.key] = record;
|
|
1190
1014
|
return this.store.setItem(this.containerBinding.path, newContainer);
|
|
1191
1015
|
}
|
|
1192
|
-
|
|
1193
1016
|
return this.store.setItem(path, value);
|
|
1194
1017
|
};
|
|
1195
|
-
|
|
1196
1018
|
_proto.deleteItem = function deleteItem(path) {
|
|
1197
1019
|
var data, container, newContainer;
|
|
1198
|
-
|
|
1199
1020
|
if (path == this.recordName) {
|
|
1200
1021
|
data = this.getData();
|
|
1201
1022
|
container = this.containerBinding.value(data);
|
|
@@ -1213,23 +1034,18 @@ var ExposedValueView = /*#__PURE__*/ (function(_View) {
|
|
|
1213
1034
|
newContainer[this.key] = record;
|
|
1214
1035
|
return this.store.setItem(this.containerBinding.path, newContainer);
|
|
1215
1036
|
}
|
|
1216
|
-
|
|
1217
1037
|
return this.store.deleteItem(path);
|
|
1218
1038
|
};
|
|
1219
|
-
|
|
1220
1039
|
return ExposedValueView;
|
|
1221
1040
|
})(View);
|
|
1222
1041
|
ExposedValueView.prototype.immutable = false;
|
|
1223
1042
|
|
|
1224
|
-
var ReadOnlyDataView = /*#__PURE__*/ (function(_View) {
|
|
1043
|
+
var ReadOnlyDataView = /*#__PURE__*/ (function (_View) {
|
|
1225
1044
|
_inheritsLoose(ReadOnlyDataView, _View);
|
|
1226
|
-
|
|
1227
1045
|
function ReadOnlyDataView() {
|
|
1228
1046
|
return _View.apply(this, arguments) || this;
|
|
1229
1047
|
}
|
|
1230
|
-
|
|
1231
1048
|
var _proto = ReadOnlyDataView.prototype;
|
|
1232
|
-
|
|
1233
1049
|
_proto.getData = function getData() {
|
|
1234
1050
|
if (this.sealed && this.meta.version === this.cache.version && this.cache.data === this.data)
|
|
1235
1051
|
return this.cache.result;
|
|
@@ -1242,28 +1058,22 @@ var ReadOnlyDataView = /*#__PURE__*/ (function(_View) {
|
|
|
1242
1058
|
this.cache.data = this.data;
|
|
1243
1059
|
return this.cache.result;
|
|
1244
1060
|
};
|
|
1245
|
-
|
|
1246
1061
|
_proto.getAdditionalData = function getAdditionalData() {
|
|
1247
1062
|
return this.data;
|
|
1248
1063
|
};
|
|
1249
|
-
|
|
1250
1064
|
_proto.setData = function setData(data) {
|
|
1251
1065
|
this.data = data;
|
|
1252
1066
|
};
|
|
1253
|
-
|
|
1254
1067
|
return ReadOnlyDataView;
|
|
1255
1068
|
})(View);
|
|
1256
1069
|
ReadOnlyDataView.prototype.immutable = false;
|
|
1257
1070
|
|
|
1258
|
-
var AugmentedViewBase = /*#__PURE__*/ (function(_View) {
|
|
1071
|
+
var AugmentedViewBase = /*#__PURE__*/ (function (_View) {
|
|
1259
1072
|
_inheritsLoose(AugmentedViewBase, _View);
|
|
1260
|
-
|
|
1261
1073
|
function AugmentedViewBase() {
|
|
1262
1074
|
return _View.apply(this, arguments) || this;
|
|
1263
1075
|
}
|
|
1264
|
-
|
|
1265
1076
|
var _proto = AugmentedViewBase.prototype;
|
|
1266
|
-
|
|
1267
1077
|
_proto.getData = function getData() {
|
|
1268
1078
|
if (this.meta.version === this.cache.version && this.sealed) return this.cache.result;
|
|
1269
1079
|
var parentStoreData = this.store.getData();
|
|
@@ -1274,50 +1084,38 @@ var AugmentedViewBase = /*#__PURE__*/ (function(_View) {
|
|
|
1274
1084
|
this.cache.version = this.meta.version;
|
|
1275
1085
|
return this.cache.result;
|
|
1276
1086
|
};
|
|
1277
|
-
|
|
1278
1087
|
_proto.getBaseData = function getBaseData(parentStoreData) {
|
|
1279
1088
|
if (this.sealed || this.immutable || this.store.sealed) return _objectSpread2({}, parentStoreData);
|
|
1280
1089
|
return parentStoreData;
|
|
1281
1090
|
};
|
|
1282
|
-
|
|
1283
1091
|
_proto.embedAugmentData = function embedAugmentData(result, parentStoreData) {
|
|
1284
1092
|
throw new Error("abstract");
|
|
1285
1093
|
};
|
|
1286
|
-
|
|
1287
1094
|
_proto.isExtraKey = function isExtraKey(key) {
|
|
1288
1095
|
throw new Error("abstract");
|
|
1289
1096
|
};
|
|
1290
|
-
|
|
1291
1097
|
_proto.setExtraKeyValue = function setExtraKeyValue(key, value) {
|
|
1292
1098
|
throw new Error("abstract");
|
|
1293
1099
|
};
|
|
1294
|
-
|
|
1295
1100
|
_proto.deleteExtraKeyValue = function deleteExtraKeyValue(key) {
|
|
1296
1101
|
throw new Error("abstract");
|
|
1297
1102
|
};
|
|
1298
|
-
|
|
1299
1103
|
_proto.setItem = function setItem(path, value) {
|
|
1300
1104
|
var binding = Binding.get(path);
|
|
1301
|
-
|
|
1302
1105
|
if (this.isExtraKey(binding.parts[0])) {
|
|
1303
1106
|
var bindingRoot = binding.parts[0];
|
|
1304
1107
|
var newValue = value;
|
|
1305
|
-
|
|
1306
1108
|
if (binding.parts.length > 1) {
|
|
1307
1109
|
var data = {};
|
|
1308
1110
|
this.embedAugmentData(data, this.store.getData());
|
|
1309
1111
|
newValue = binding.set(data, value)[bindingRoot];
|
|
1310
1112
|
}
|
|
1311
|
-
|
|
1312
1113
|
return this.setExtraKeyValue(bindingRoot, newValue);
|
|
1313
1114
|
}
|
|
1314
|
-
|
|
1315
1115
|
return _View.prototype.setItem.call(this, path, value);
|
|
1316
1116
|
};
|
|
1317
|
-
|
|
1318
1117
|
_proto.deleteItem = function deleteItem(path) {
|
|
1319
1118
|
var binding = Binding.get(path);
|
|
1320
|
-
|
|
1321
1119
|
if (this.isExtraKey(binding.parts[0])) {
|
|
1322
1120
|
var bindingRoot = binding.parts[0];
|
|
1323
1121
|
if (binding.parts.length == 1) return this.deleteExtraKeyValue(bindingRoot);
|
|
@@ -1326,81 +1124,61 @@ var AugmentedViewBase = /*#__PURE__*/ (function(_View) {
|
|
|
1326
1124
|
var newValue = binding["delete"](data)[bindingRoot];
|
|
1327
1125
|
return this.setExtraKeyValue(bindingRoot, newValue);
|
|
1328
1126
|
}
|
|
1329
|
-
|
|
1330
1127
|
return _View.prototype.deleteItem.call(this, path);
|
|
1331
1128
|
};
|
|
1332
|
-
|
|
1333
1129
|
return AugmentedViewBase;
|
|
1334
1130
|
})(View);
|
|
1335
1131
|
AugmentedViewBase.prototype.immutable = false;
|
|
1336
1132
|
|
|
1337
|
-
var NestedDataView = /*#__PURE__*/ (function(_AugmentedViewBase) {
|
|
1133
|
+
var NestedDataView = /*#__PURE__*/ (function (_AugmentedViewBase) {
|
|
1338
1134
|
_inheritsLoose(NestedDataView, _AugmentedViewBase);
|
|
1339
|
-
|
|
1340
1135
|
function NestedDataView() {
|
|
1341
1136
|
return _AugmentedViewBase.apply(this, arguments) || this;
|
|
1342
1137
|
}
|
|
1343
|
-
|
|
1344
1138
|
var _proto = NestedDataView.prototype;
|
|
1345
|
-
|
|
1346
1139
|
_proto.embedAugmentData = function embedAugmentData(result, parentStoreData) {
|
|
1347
1140
|
if (this.nestedData) {
|
|
1348
1141
|
var nested = this.nestedData.getSelector()(parentStoreData);
|
|
1349
|
-
|
|
1350
|
-
for (var key in nested) {
|
|
1351
|
-
result[key] = nested[key];
|
|
1352
|
-
}
|
|
1142
|
+
for (var key in nested) result[key] = nested[key];
|
|
1353
1143
|
}
|
|
1354
1144
|
};
|
|
1355
|
-
|
|
1356
1145
|
_proto.isExtraKey = function isExtraKey(key) {
|
|
1357
1146
|
return this.nestedData && this.nestedData.containsKey(key);
|
|
1358
1147
|
};
|
|
1359
|
-
|
|
1360
1148
|
_proto.setExtraKeyValue = function setExtraKeyValue(key, value) {
|
|
1361
1149
|
this.nestedData.setItem(key, value);
|
|
1362
1150
|
};
|
|
1363
|
-
|
|
1364
1151
|
_proto.deleteExtraKeyValue = function deleteExtraKeyValue(key) {
|
|
1365
1152
|
this.setExtraKeyValue(key, undefined);
|
|
1366
1153
|
};
|
|
1367
|
-
|
|
1368
1154
|
return NestedDataView;
|
|
1369
1155
|
})(AugmentedViewBase);
|
|
1370
1156
|
|
|
1371
|
-
var ZoomIntoPropertyView = /*#__PURE__*/ (function(_NestedDataView) {
|
|
1157
|
+
var ZoomIntoPropertyView = /*#__PURE__*/ (function (_NestedDataView) {
|
|
1372
1158
|
_inheritsLoose(ZoomIntoPropertyView, _NestedDataView);
|
|
1373
|
-
|
|
1374
1159
|
function ZoomIntoPropertyView() {
|
|
1375
1160
|
return _NestedDataView.apply(this, arguments) || this;
|
|
1376
1161
|
}
|
|
1377
|
-
|
|
1378
1162
|
var _proto = ZoomIntoPropertyView.prototype;
|
|
1379
|
-
|
|
1380
1163
|
_proto.getBaseData = function getBaseData(parentStoreData) {
|
|
1381
1164
|
var x = this.binding.value(parentStoreData);
|
|
1382
1165
|
if (x != null && typeof x != "object") throw new Error("Zoomed value must be an object.");
|
|
1383
1166
|
return _objectSpread2({}, x);
|
|
1384
1167
|
};
|
|
1385
|
-
|
|
1386
1168
|
_proto.embedAugmentData = function embedAugmentData(result, parentStoreData) {
|
|
1387
1169
|
result[this.rootName] = parentStoreData;
|
|
1388
|
-
|
|
1389
1170
|
_NestedDataView.prototype.embedAugmentData.call(this, result, parentStoreData);
|
|
1390
1171
|
};
|
|
1391
|
-
|
|
1392
1172
|
_proto.setItem = function setItem(path, value) {
|
|
1393
1173
|
if (path.indexOf(this.rootName + ".") == 0) this.store.setItem(path.substring(this.rootName.length + 1), value);
|
|
1394
1174
|
else if (this.isExtraKey(Binding.get(path).parts[0])) _NestedDataView.prototype.setItem.call(this, path, value);
|
|
1395
1175
|
else _NestedDataView.prototype.setItem.call(this, this.binding.path + "." + path, value);
|
|
1396
1176
|
};
|
|
1397
|
-
|
|
1398
1177
|
_proto.deleteItem = function deleteItem(path) {
|
|
1399
1178
|
if (path.indexOf(this.rootName + ".") == 0) this.store.deleteItem(path.substring(this.rootName.length + 1));
|
|
1400
1179
|
else if (this.isExtraKey(Binding.get(path).parts[0])) _NestedDataView.prototype.deleteItem.call(this, path);
|
|
1401
1180
|
else _NestedDataView.prototype.deleteItem.call(this, this.binding.path + "." + path);
|
|
1402
1181
|
};
|
|
1403
|
-
|
|
1404
1182
|
return ZoomIntoPropertyView;
|
|
1405
1183
|
})(NestedDataView);
|
|
1406
1184
|
ZoomIntoPropertyView.prototype.rootName = "$root";
|
|
@@ -1408,123 +1186,101 @@ ZoomIntoPropertyView.prototype.rootName = "$root";
|
|
|
1408
1186
|
function createStructuredSelector(selector, constants) {
|
|
1409
1187
|
var keys = Object.keys(selector);
|
|
1410
1188
|
if (keys.length == 0)
|
|
1411
|
-
return function() {
|
|
1189
|
+
return function () {
|
|
1412
1190
|
return constants;
|
|
1413
1191
|
};
|
|
1414
|
-
|
|
1415
1192
|
function memoize() {
|
|
1416
1193
|
var lastResult = Object.assign({}, constants);
|
|
1417
1194
|
var memoizedSelectors = {};
|
|
1418
|
-
keys.forEach(function(key) {
|
|
1195
|
+
keys.forEach(function (key) {
|
|
1419
1196
|
memoizedSelectors[key] = selector[key].memoize ? selector[key].memoize() : selector[key];
|
|
1420
1197
|
lastResult[key] = undefined;
|
|
1421
1198
|
});
|
|
1422
|
-
return function(data) {
|
|
1199
|
+
return function (data) {
|
|
1423
1200
|
var result = lastResult,
|
|
1424
1201
|
k,
|
|
1425
1202
|
v,
|
|
1426
1203
|
i;
|
|
1427
|
-
|
|
1428
1204
|
for (i = 0; i < keys.length; i++) {
|
|
1429
1205
|
k = keys[i];
|
|
1430
1206
|
v = memoizedSelectors[k](data);
|
|
1431
|
-
|
|
1432
1207
|
if (result === lastResult) {
|
|
1433
1208
|
if (v === lastResult[k]) continue;
|
|
1434
1209
|
result = Object.assign({}, lastResult);
|
|
1435
1210
|
}
|
|
1436
|
-
|
|
1437
1211
|
result[k] = v;
|
|
1438
1212
|
}
|
|
1439
|
-
|
|
1440
1213
|
return (lastResult = result);
|
|
1441
1214
|
};
|
|
1442
1215
|
}
|
|
1443
|
-
|
|
1444
1216
|
function evaluate(data) {
|
|
1445
1217
|
var result = Object.assign({}, constants);
|
|
1446
|
-
|
|
1447
1218
|
for (var i = 0; i < keys.length; i++) {
|
|
1448
1219
|
result[keys[i]] = selector[keys[i]](data);
|
|
1449
1220
|
}
|
|
1450
|
-
|
|
1451
1221
|
return result;
|
|
1452
1222
|
}
|
|
1453
|
-
|
|
1454
1223
|
evaluate.memoize = memoize;
|
|
1455
1224
|
return evaluate;
|
|
1456
1225
|
}
|
|
1457
1226
|
|
|
1458
1227
|
function isSelector(config) {
|
|
1459
1228
|
if (config == null) return true;
|
|
1460
|
-
|
|
1461
1229
|
switch (typeof config) {
|
|
1462
1230
|
case "object":
|
|
1463
1231
|
if (config.type || config.$type) return false;
|
|
1464
1232
|
return !!(config.bind || config.tpl || config.expr || config.get);
|
|
1465
|
-
|
|
1466
1233
|
case "function":
|
|
1467
1234
|
return true;
|
|
1468
|
-
|
|
1469
1235
|
case "string":
|
|
1470
1236
|
return true;
|
|
1471
|
-
|
|
1472
1237
|
case "number":
|
|
1473
1238
|
return true;
|
|
1474
|
-
|
|
1475
1239
|
case "boolean":
|
|
1476
1240
|
return true;
|
|
1477
1241
|
}
|
|
1478
|
-
|
|
1479
1242
|
return false;
|
|
1480
1243
|
}
|
|
1481
1244
|
|
|
1482
1245
|
var undefinedF = function undefinedF() {
|
|
1483
1246
|
return undefined;
|
|
1484
1247
|
};
|
|
1485
|
-
|
|
1486
1248
|
var nullF = function nullF() {
|
|
1487
1249
|
return null;
|
|
1488
1250
|
};
|
|
1489
|
-
|
|
1490
1251
|
function getSelector(config) {
|
|
1491
1252
|
if (config === undefined) return undefinedF;
|
|
1492
1253
|
if (config === null) return nullF;
|
|
1493
|
-
|
|
1494
1254
|
switch (typeof config) {
|
|
1495
1255
|
case "object":
|
|
1496
1256
|
if (isArray(config)) {
|
|
1497
|
-
var _selectors = config.map(function(x) {
|
|
1257
|
+
var _selectors = config.map(function (x) {
|
|
1498
1258
|
return getSelector(x);
|
|
1499
1259
|
});
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
return _selectors.map(function(elementSelector) {
|
|
1260
|
+
return function (data) {
|
|
1261
|
+
return _selectors.map(function (elementSelector) {
|
|
1503
1262
|
return elementSelector(data);
|
|
1504
1263
|
});
|
|
1505
1264
|
};
|
|
1506
|
-
}
|
|
1265
|
+
}
|
|
1507
1266
|
|
|
1267
|
+
//toString converts accessor chains to binding paths
|
|
1508
1268
|
if (config.bind) return Binding.get(config.bind.toString()).value;
|
|
1509
1269
|
if (config.tpl) return StringTemplate.get(config.tpl);
|
|
1510
1270
|
if (config.expr) return Expression.get(config.expr);
|
|
1511
1271
|
if (config.get) return config.get;
|
|
1512
1272
|
var selectors = {};
|
|
1513
1273
|
var constants = {};
|
|
1514
|
-
|
|
1515
1274
|
for (var key in config) {
|
|
1516
1275
|
if (isSelector(config[key])) selectors[key] = getSelector(config[key]);
|
|
1517
1276
|
else constants[key] = config[key];
|
|
1518
1277
|
}
|
|
1519
|
-
|
|
1520
1278
|
return createStructuredSelector(selectors, constants);
|
|
1521
|
-
|
|
1522
1279
|
case "function":
|
|
1523
1280
|
if (isAccessorChain(config)) return Binding.get(config.toString()).value;
|
|
1524
1281
|
return config;
|
|
1525
|
-
|
|
1526
1282
|
default:
|
|
1527
|
-
return function() {
|
|
1283
|
+
return function () {
|
|
1528
1284
|
return config;
|
|
1529
1285
|
};
|
|
1530
1286
|
}
|
|
@@ -1534,7 +1290,6 @@ function defaultValue(pv) {
|
|
|
1534
1290
|
if (typeof pv == "object" && pv && pv.structured) return pv.defaultValue;
|
|
1535
1291
|
return pv;
|
|
1536
1292
|
}
|
|
1537
|
-
|
|
1538
1293
|
function getSelectorConfig(props, values, nameMap) {
|
|
1539
1294
|
var functions = {},
|
|
1540
1295
|
structures = {},
|
|
@@ -1544,12 +1299,10 @@ function getSelectorConfig(props, values, nameMap) {
|
|
|
1544
1299
|
v,
|
|
1545
1300
|
pv,
|
|
1546
1301
|
constant = true;
|
|
1547
|
-
|
|
1548
1302
|
for (p in props) {
|
|
1549
1303
|
v = values[p];
|
|
1550
1304
|
pv = props[p];
|
|
1551
1305
|
if (isUndefined(v) && pv && (pv.bind || pv.tpl || pv.expr)) v = pv;
|
|
1552
|
-
|
|
1553
1306
|
if (v === null) {
|
|
1554
1307
|
if (!constants) constants = {};
|
|
1555
1308
|
constants[p] = null;
|
|
@@ -1587,219 +1340,165 @@ function getSelectorConfig(props, values, nameMap) {
|
|
|
1587
1340
|
nameMap[p] = path;
|
|
1588
1341
|
functions[p] = Binding.get(path).value;
|
|
1589
1342
|
} else functions[p] = v;
|
|
1590
|
-
|
|
1591
1343
|
constant = false;
|
|
1592
1344
|
} else {
|
|
1593
1345
|
if (isUndefined(v)) {
|
|
1594
1346
|
if (isUndefined(pv)) continue;
|
|
1595
1347
|
v = defaultValue(pv);
|
|
1596
1348
|
}
|
|
1597
|
-
|
|
1598
1349
|
if (isUndefined(v)) continue;
|
|
1599
1350
|
if (!constants) constants = {};
|
|
1600
1351
|
constants[p] = v;
|
|
1601
1352
|
}
|
|
1602
1353
|
}
|
|
1603
|
-
|
|
1604
1354
|
return {
|
|
1605
1355
|
functions: functions,
|
|
1606
1356
|
structures: structures,
|
|
1607
1357
|
defaultValues: defaultValues,
|
|
1608
1358
|
constants: constants,
|
|
1609
|
-
constant: constant
|
|
1359
|
+
constant: constant,
|
|
1610
1360
|
};
|
|
1611
1361
|
}
|
|
1612
|
-
|
|
1613
1362
|
function createSelector(_ref) {
|
|
1614
1363
|
var functions = _ref.functions,
|
|
1615
1364
|
structures = _ref.structures,
|
|
1616
|
-
constants = _ref.constants
|
|
1617
|
-
|
|
1365
|
+
constants = _ref.constants;
|
|
1366
|
+
_ref.defaultValues;
|
|
1618
1367
|
var selector = {};
|
|
1619
|
-
|
|
1620
1368
|
for (var n in functions) {
|
|
1621
1369
|
selector[n] = functions[n];
|
|
1622
1370
|
}
|
|
1623
|
-
|
|
1624
|
-
for (var _n in structures) {
|
|
1625
|
-
selector[_n] = createSelector(structures[_n]);
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1371
|
+
for (var _n in structures) selector[_n] = createSelector(structures[_n]);
|
|
1628
1372
|
return createStructuredSelector(selector, constants);
|
|
1629
1373
|
}
|
|
1630
|
-
|
|
1631
|
-
var StructuredSelector = /*#__PURE__*/ (function() {
|
|
1374
|
+
var StructuredSelector = /*#__PURE__*/ (function () {
|
|
1632
1375
|
function StructuredSelector(_ref2) {
|
|
1633
1376
|
var props = _ref2.props,
|
|
1634
1377
|
values = _ref2.values;
|
|
1635
1378
|
this.nameMap = {};
|
|
1636
1379
|
this.config = getSelectorConfig(props, values, this.nameMap);
|
|
1637
1380
|
}
|
|
1638
|
-
|
|
1639
1381
|
var _proto = StructuredSelector.prototype;
|
|
1640
|
-
|
|
1641
1382
|
_proto.init = function init(store) {
|
|
1642
1383
|
store.init(this.config.defaultValues);
|
|
1643
1384
|
};
|
|
1644
|
-
|
|
1645
1385
|
_proto.create = function create(memoize) {
|
|
1646
1386
|
if (memoize === void 0) {
|
|
1647
1387
|
memoize = true;
|
|
1648
1388
|
}
|
|
1649
|
-
|
|
1650
1389
|
var selector = createSelector(this.config);
|
|
1651
1390
|
if (memoize && selector.memoize) return selector.memoize();
|
|
1652
1391
|
return selector;
|
|
1653
1392
|
};
|
|
1654
|
-
|
|
1655
1393
|
_proto.createStoreSelector = function createStoreSelector() {
|
|
1656
1394
|
if (this.config.constant) {
|
|
1657
1395
|
var result = _objectSpread2({}, this.config.constants);
|
|
1658
|
-
|
|
1659
|
-
return function() {
|
|
1396
|
+
return function () {
|
|
1660
1397
|
return result;
|
|
1661
1398
|
};
|
|
1662
1399
|
}
|
|
1663
|
-
|
|
1664
1400
|
var selector = this.create();
|
|
1665
|
-
return function(store) {
|
|
1401
|
+
return function (store) {
|
|
1666
1402
|
return selector(store.getData());
|
|
1667
1403
|
};
|
|
1668
1404
|
};
|
|
1669
|
-
|
|
1670
1405
|
return StructuredSelector;
|
|
1671
1406
|
})();
|
|
1672
1407
|
|
|
1673
|
-
var AggregateFunction = /*#__PURE__*/ (function() {
|
|
1408
|
+
var AggregateFunction = /*#__PURE__*/ (function () {
|
|
1674
1409
|
function AggregateFunction() {}
|
|
1675
|
-
|
|
1676
1410
|
AggregateFunction.sum = function sum() {
|
|
1677
1411
|
return new Sum();
|
|
1678
1412
|
};
|
|
1679
|
-
|
|
1680
1413
|
AggregateFunction.avg = function avg() {
|
|
1681
1414
|
return new Avg();
|
|
1682
1415
|
};
|
|
1683
|
-
|
|
1684
1416
|
AggregateFunction.count = function count() {
|
|
1685
1417
|
return new Count();
|
|
1686
1418
|
};
|
|
1687
|
-
|
|
1688
1419
|
AggregateFunction.distinct = function distinct() {
|
|
1689
1420
|
return new Distinct();
|
|
1690
1421
|
};
|
|
1691
|
-
|
|
1692
1422
|
AggregateFunction.min = function min() {
|
|
1693
1423
|
return new Min();
|
|
1694
1424
|
};
|
|
1695
|
-
|
|
1696
1425
|
AggregateFunction.max = function max() {
|
|
1697
1426
|
return new Max();
|
|
1698
1427
|
};
|
|
1699
|
-
|
|
1700
1428
|
return AggregateFunction;
|
|
1701
1429
|
})();
|
|
1702
|
-
|
|
1703
|
-
var Sum = /*#__PURE__*/ (function() {
|
|
1430
|
+
var Sum = /*#__PURE__*/ (function () {
|
|
1704
1431
|
function Sum() {}
|
|
1705
|
-
|
|
1706
1432
|
var _proto = Sum.prototype;
|
|
1707
|
-
|
|
1708
1433
|
_proto.process = function process(value) {
|
|
1709
1434
|
this.empty = false;
|
|
1710
1435
|
if (!isNaN(value)) this.result += value;
|
|
1711
1436
|
else this.invalid = true;
|
|
1712
1437
|
};
|
|
1713
|
-
|
|
1714
1438
|
_proto.getResult = function getResult() {
|
|
1715
1439
|
if (this.invalid) return null;
|
|
1716
1440
|
return this.result;
|
|
1717
1441
|
};
|
|
1718
|
-
|
|
1719
1442
|
return Sum;
|
|
1720
1443
|
})();
|
|
1721
|
-
|
|
1722
1444
|
Sum.prototype.result = 0;
|
|
1723
1445
|
Sum.prototype.empty = true;
|
|
1724
|
-
|
|
1725
|
-
var Avg = /*#__PURE__*/ (function() {
|
|
1446
|
+
var Avg = /*#__PURE__*/ (function () {
|
|
1726
1447
|
function Avg() {}
|
|
1727
|
-
|
|
1728
1448
|
var _proto2 = Avg.prototype;
|
|
1729
|
-
|
|
1730
1449
|
_proto2.process = function process(value, count) {
|
|
1731
1450
|
if (count === void 0) {
|
|
1732
1451
|
count = 1;
|
|
1733
1452
|
}
|
|
1734
|
-
|
|
1735
1453
|
this.empty = false;
|
|
1736
|
-
|
|
1737
1454
|
if (!isNaN(value) && !isNaN(count)) {
|
|
1738
1455
|
this.result += value * count;
|
|
1739
1456
|
this.count += count;
|
|
1740
1457
|
} else this.invalid = true;
|
|
1741
1458
|
};
|
|
1742
|
-
|
|
1743
1459
|
_proto2.getResult = function getResult() {
|
|
1744
1460
|
if (this.empty || this.invalid || this.count == 0) return null;
|
|
1745
1461
|
return this.result / this.count;
|
|
1746
1462
|
};
|
|
1747
|
-
|
|
1748
1463
|
return Avg;
|
|
1749
1464
|
})();
|
|
1750
|
-
|
|
1751
1465
|
Avg.prototype.result = 0;
|
|
1752
1466
|
Avg.prototype.count = 0;
|
|
1753
1467
|
Avg.prototype.empty = true;
|
|
1754
|
-
|
|
1755
|
-
var Count = /*#__PURE__*/ (function() {
|
|
1468
|
+
var Count = /*#__PURE__*/ (function () {
|
|
1756
1469
|
function Count() {}
|
|
1757
|
-
|
|
1758
1470
|
var _proto3 = Count.prototype;
|
|
1759
|
-
|
|
1760
1471
|
_proto3.process = function process(value) {
|
|
1761
1472
|
if (value != null) this.result++;
|
|
1762
1473
|
};
|
|
1763
|
-
|
|
1764
1474
|
_proto3.getResult = function getResult() {
|
|
1765
1475
|
return this.result;
|
|
1766
1476
|
};
|
|
1767
|
-
|
|
1768
1477
|
return Count;
|
|
1769
1478
|
})();
|
|
1770
|
-
|
|
1771
1479
|
Count.prototype.result = 0;
|
|
1772
|
-
|
|
1773
|
-
var Distinct = /*#__PURE__*/ (function() {
|
|
1480
|
+
var Distinct = /*#__PURE__*/ (function () {
|
|
1774
1481
|
function Distinct() {
|
|
1775
1482
|
this.values = {};
|
|
1776
1483
|
}
|
|
1777
|
-
|
|
1778
1484
|
var _proto4 = Distinct.prototype;
|
|
1779
|
-
|
|
1780
1485
|
_proto4.process = function process(value) {
|
|
1781
1486
|
if (value == null || this.values[value]) return;
|
|
1782
1487
|
this.values[value] = true;
|
|
1783
1488
|
this.empty = false;
|
|
1784
1489
|
this.result++;
|
|
1785
1490
|
};
|
|
1786
|
-
|
|
1787
1491
|
_proto4.getResult = function getResult() {
|
|
1788
1492
|
if (this.empty || this.invalid) return null;
|
|
1789
1493
|
return this.result;
|
|
1790
1494
|
};
|
|
1791
|
-
|
|
1792
1495
|
return Distinct;
|
|
1793
1496
|
})();
|
|
1794
|
-
|
|
1795
1497
|
Distinct.prototype.result = 0;
|
|
1796
1498
|
Distinct.prototype.empty = true;
|
|
1797
|
-
|
|
1798
|
-
var Max = /*#__PURE__*/ (function() {
|
|
1499
|
+
var Max = /*#__PURE__*/ (function () {
|
|
1799
1500
|
function Max() {}
|
|
1800
|
-
|
|
1801
1501
|
var _proto5 = Max.prototype;
|
|
1802
|
-
|
|
1803
1502
|
_proto5.process = function process(value) {
|
|
1804
1503
|
if (!isNaN(value)) {
|
|
1805
1504
|
if (this.empty) this.result = value;
|
|
@@ -1807,23 +1506,17 @@ var Max = /*#__PURE__*/ (function() {
|
|
|
1807
1506
|
this.empty = false;
|
|
1808
1507
|
} else if (value != null) this.invalid = true;
|
|
1809
1508
|
};
|
|
1810
|
-
|
|
1811
1509
|
_proto5.getResult = function getResult() {
|
|
1812
1510
|
if (this.empty || this.invalid) return null;
|
|
1813
1511
|
return this.result;
|
|
1814
1512
|
};
|
|
1815
|
-
|
|
1816
1513
|
return Max;
|
|
1817
1514
|
})();
|
|
1818
|
-
|
|
1819
1515
|
Max.prototype.result = 0;
|
|
1820
1516
|
Max.prototype.empty = true;
|
|
1821
|
-
|
|
1822
|
-
var Min = /*#__PURE__*/ (function() {
|
|
1517
|
+
var Min = /*#__PURE__*/ (function () {
|
|
1823
1518
|
function Min() {}
|
|
1824
|
-
|
|
1825
1519
|
var _proto6 = Min.prototype;
|
|
1826
|
-
|
|
1827
1520
|
_proto6.process = function process(value) {
|
|
1828
1521
|
if (!isNaN(value)) {
|
|
1829
1522
|
if (this.empty) this.result = value;
|
|
@@ -1831,15 +1524,12 @@ var Min = /*#__PURE__*/ (function() {
|
|
|
1831
1524
|
this.empty = false;
|
|
1832
1525
|
} else if (value != null) this.invalid = true;
|
|
1833
1526
|
};
|
|
1834
|
-
|
|
1835
1527
|
_proto6.getResult = function getResult() {
|
|
1836
1528
|
if (this.empty || this.invalid) return null;
|
|
1837
1529
|
return this.result;
|
|
1838
1530
|
};
|
|
1839
|
-
|
|
1840
1531
|
return Min;
|
|
1841
1532
|
})();
|
|
1842
|
-
|
|
1843
1533
|
Min.prototype.result = 0;
|
|
1844
1534
|
Min.prototype.empty = true;
|
|
1845
1535
|
|
|
@@ -1854,49 +1544,39 @@ Min.prototype.empty = true;
|
|
|
1854
1544
|
|
|
1855
1545
|
function transform(o, f) {
|
|
1856
1546
|
var res = {};
|
|
1857
|
-
|
|
1858
|
-
for (var k in o) {
|
|
1859
|
-
res[k] = f(o[k], k);
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1547
|
+
for (var k in o) res[k] = f(o[k], k);
|
|
1862
1548
|
return res;
|
|
1863
1549
|
}
|
|
1864
|
-
|
|
1865
|
-
var Grouper = /*#__PURE__*/ (function() {
|
|
1550
|
+
var Grouper = /*#__PURE__*/ (function () {
|
|
1866
1551
|
function Grouper(key, aggregates, dataGetter, nameGetter) {
|
|
1867
|
-
this.keys = Object.keys(key).map(function(k) {
|
|
1552
|
+
this.keys = Object.keys(key).map(function (k) {
|
|
1868
1553
|
return {
|
|
1869
1554
|
name: k,
|
|
1870
|
-
value: getSelector(key[k])
|
|
1555
|
+
value: getSelector(key[k]),
|
|
1871
1556
|
};
|
|
1872
1557
|
});
|
|
1873
1558
|
if (nameGetter) this.nameGetter = getSelector(nameGetter);
|
|
1874
|
-
|
|
1875
1559
|
this.dataGetter =
|
|
1876
1560
|
dataGetter ||
|
|
1877
|
-
function(x) {
|
|
1561
|
+
function (x) {
|
|
1878
1562
|
return x;
|
|
1879
1563
|
};
|
|
1880
|
-
|
|
1881
1564
|
this.aggregates =
|
|
1882
1565
|
aggregates &&
|
|
1883
|
-
transform(aggregates, function(prop) {
|
|
1566
|
+
transform(aggregates, function (prop) {
|
|
1884
1567
|
if (!AggregateFunction[prop.type]) throw new Error("Unknown aggregate function '" + prop.type + "'.");
|
|
1885
1568
|
return {
|
|
1886
1569
|
value: getSelector(prop.value),
|
|
1887
1570
|
weight: getSelector(prop.weight || 1),
|
|
1888
|
-
type: prop.type
|
|
1571
|
+
type: prop.type,
|
|
1889
1572
|
};
|
|
1890
1573
|
});
|
|
1891
1574
|
this.reset();
|
|
1892
1575
|
}
|
|
1893
|
-
|
|
1894
1576
|
var _proto = Grouper.prototype;
|
|
1895
|
-
|
|
1896
1577
|
_proto.reset = function reset() {
|
|
1897
1578
|
this.groups = this.initGroup(this.keys.length == 0);
|
|
1898
1579
|
};
|
|
1899
|
-
|
|
1900
1580
|
_proto.initGroup = function initGroup(leaf) {
|
|
1901
1581
|
if (!leaf) return {};
|
|
1902
1582
|
return {
|
|
@@ -1904,64 +1584,51 @@ var Grouper = /*#__PURE__*/ (function() {
|
|
|
1904
1584
|
indexes: [],
|
|
1905
1585
|
aggregates:
|
|
1906
1586
|
this.aggregates &&
|
|
1907
|
-
transform(this.aggregates, function(prop) {
|
|
1587
|
+
transform(this.aggregates, function (prop) {
|
|
1908
1588
|
var f = AggregateFunction[prop.type];
|
|
1909
1589
|
return {
|
|
1910
1590
|
processor: f(),
|
|
1911
1591
|
value: prop.value,
|
|
1912
|
-
weight: prop.weight
|
|
1592
|
+
weight: prop.weight,
|
|
1913
1593
|
};
|
|
1914
|
-
})
|
|
1594
|
+
}),
|
|
1915
1595
|
};
|
|
1916
1596
|
};
|
|
1917
|
-
|
|
1918
1597
|
_proto.process = function process(record, index) {
|
|
1919
1598
|
var data = this.dataGetter(record);
|
|
1920
|
-
var key = this.keys.map(function(k) {
|
|
1599
|
+
var key = this.keys.map(function (k) {
|
|
1921
1600
|
return k.value(data);
|
|
1922
1601
|
});
|
|
1923
1602
|
var g = this.groups;
|
|
1924
|
-
|
|
1925
1603
|
for (var i = 0; i < key.length; i++) {
|
|
1926
1604
|
var sg = g[key[i]];
|
|
1927
|
-
|
|
1928
1605
|
if (!sg) {
|
|
1929
1606
|
sg = g[key[i]] = this.initGroup(i + 1 == key.length);
|
|
1930
1607
|
if (this.nameGetter) sg.name = this.nameGetter(data);
|
|
1931
1608
|
}
|
|
1932
|
-
|
|
1933
1609
|
g = sg;
|
|
1934
1610
|
}
|
|
1935
|
-
|
|
1936
1611
|
g.records.push(record);
|
|
1937
1612
|
g.indexes.push(index);
|
|
1938
|
-
|
|
1939
1613
|
if (g.aggregates) {
|
|
1940
|
-
for (var k in g.aggregates)
|
|
1614
|
+
for (var k in g.aggregates)
|
|
1941
1615
|
g.aggregates[k].processor.process(g.aggregates[k].value(data), g.aggregates[k].weight(data));
|
|
1942
|
-
}
|
|
1943
1616
|
}
|
|
1944
1617
|
};
|
|
1945
|
-
|
|
1946
1618
|
_proto.processAll = function processAll(records, indexes) {
|
|
1947
1619
|
var _this = this;
|
|
1948
|
-
|
|
1949
1620
|
if (indexes) {
|
|
1950
|
-
for (var i = 0; i < records.length; i++)
|
|
1951
|
-
this.process(records[i], indexes[i]);
|
|
1952
|
-
}
|
|
1621
|
+
for (var i = 0; i < records.length; i++) this.process(records[i], indexes[i]);
|
|
1953
1622
|
} else
|
|
1954
|
-
records.forEach(function(r, i) {
|
|
1623
|
+
records.forEach(function (r, i) {
|
|
1955
1624
|
return _this.process(r, i);
|
|
1956
1625
|
});
|
|
1957
1626
|
};
|
|
1958
|
-
|
|
1959
1627
|
_proto.report = function report(g, path, level, results) {
|
|
1960
1628
|
var _this2 = this;
|
|
1961
|
-
|
|
1962
1629
|
if (level == this.keys.length) {
|
|
1963
1630
|
var key = {};
|
|
1964
|
-
this.keys.forEach(function(k, i) {
|
|
1631
|
+
this.keys.forEach(function (k, i) {
|
|
1965
1632
|
return (key[k.name] = path[i]);
|
|
1966
1633
|
});
|
|
1967
1634
|
results.push({
|
|
@@ -1969,24 +1636,22 @@ var Grouper = /*#__PURE__*/ (function() {
|
|
|
1969
1636
|
name: g.name,
|
|
1970
1637
|
records: g.records,
|
|
1971
1638
|
indexes: g.indexes,
|
|
1972
|
-
aggregates: transform(g.aggregates, function(p) {
|
|
1639
|
+
aggregates: transform(g.aggregates, function (p) {
|
|
1973
1640
|
return p.processor.getResult();
|
|
1974
|
-
})
|
|
1641
|
+
}),
|
|
1975
1642
|
});
|
|
1976
1643
|
} else {
|
|
1977
|
-
Object.keys(g).forEach(function(k) {
|
|
1644
|
+
Object.keys(g).forEach(function (k) {
|
|
1978
1645
|
return _this2.report(g[k], [].concat(path, [k]), level + 1, results);
|
|
1979
1646
|
});
|
|
1980
1647
|
}
|
|
1981
1648
|
};
|
|
1982
|
-
|
|
1983
1649
|
_proto.getResults = function getResults() {
|
|
1984
1650
|
var g = this.groups;
|
|
1985
1651
|
var results = [];
|
|
1986
1652
|
this.report(g, [], 0, results);
|
|
1987
1653
|
return results;
|
|
1988
1654
|
};
|
|
1989
|
-
|
|
1990
1655
|
return Grouper;
|
|
1991
1656
|
})();
|
|
1992
1657
|
|
|
@@ -1995,67 +1660,64 @@ function defaultCompare(av, bv) {
|
|
|
1995
1660
|
if (bv == null) return 0;
|
|
1996
1661
|
return -1;
|
|
1997
1662
|
}
|
|
1998
|
-
|
|
1999
1663
|
if (bv == null || av > bv) return 1;
|
|
2000
1664
|
if (av < bv) return -1;
|
|
2001
1665
|
return 0;
|
|
2002
1666
|
}
|
|
2003
1667
|
|
|
2004
1668
|
function getComparer(sorters, dataAccessor, comparer) {
|
|
2005
|
-
var resolvedSorters = (sorters || []).map(function(s) {
|
|
1669
|
+
var resolvedSorters = (sorters || []).map(function (s) {
|
|
2006
1670
|
var selector = isDefined(s.value)
|
|
2007
1671
|
? getSelector(s.value)
|
|
2008
1672
|
: s.field
|
|
2009
|
-
? function(x) {
|
|
1673
|
+
? function (x) {
|
|
2010
1674
|
return x[s.field];
|
|
2011
1675
|
}
|
|
2012
|
-
: function() {
|
|
1676
|
+
: function () {
|
|
2013
1677
|
return null;
|
|
2014
1678
|
};
|
|
2015
1679
|
return {
|
|
2016
1680
|
getter: dataAccessor
|
|
2017
|
-
? function(x) {
|
|
1681
|
+
? function (x) {
|
|
2018
1682
|
return selector(dataAccessor(x));
|
|
2019
1683
|
}
|
|
2020
1684
|
: selector,
|
|
2021
1685
|
factor: s.direction && s.direction[0].toLowerCase() == "d" ? -1 : 1,
|
|
2022
|
-
compare: s.comparer || s.compare || comparer || defaultCompare
|
|
1686
|
+
compare: s.comparer || s.compare || comparer || defaultCompare,
|
|
2023
1687
|
};
|
|
2024
1688
|
});
|
|
2025
|
-
return function(a, b) {
|
|
1689
|
+
return function (a, b) {
|
|
2026
1690
|
var d, av, bv;
|
|
2027
|
-
|
|
2028
1691
|
for (var i = 0; i < resolvedSorters.length; i++) {
|
|
2029
1692
|
d = resolvedSorters[i];
|
|
2030
1693
|
av = d.getter(a);
|
|
2031
|
-
bv = d.getter(b);
|
|
1694
|
+
bv = d.getter(b);
|
|
2032
1695
|
|
|
1696
|
+
// show nulls always on the bottom
|
|
2033
1697
|
if (av == null) {
|
|
2034
1698
|
if (bv == null) continue;
|
|
2035
1699
|
else return 1;
|
|
2036
1700
|
}
|
|
2037
|
-
|
|
2038
1701
|
if (bv == null) return -1;
|
|
2039
1702
|
var r = d.compare(av, bv);
|
|
2040
1703
|
if (r == 0) continue;
|
|
2041
1704
|
return d.factor * r;
|
|
2042
1705
|
}
|
|
2043
|
-
|
|
2044
1706
|
return 0;
|
|
2045
1707
|
};
|
|
2046
1708
|
}
|
|
2047
1709
|
function indexSorter(sorters, dataAccessor, compare) {
|
|
2048
1710
|
var cmp = getComparer(sorters, dataAccessor, compare);
|
|
2049
|
-
return function(data) {
|
|
1711
|
+
return function (data) {
|
|
2050
1712
|
var result = Array.from(
|
|
2051
1713
|
{
|
|
2052
|
-
length: data.length
|
|
1714
|
+
length: data.length,
|
|
2053
1715
|
},
|
|
2054
|
-
function(v, k) {
|
|
1716
|
+
function (v, k) {
|
|
2055
1717
|
return k;
|
|
2056
1718
|
}
|
|
2057
1719
|
);
|
|
2058
|
-
result.sort(function(ia, ib) {
|
|
1720
|
+
result.sort(function (ia, ib) {
|
|
2059
1721
|
return cmp(data[ia], data[ib]);
|
|
2060
1722
|
});
|
|
2061
1723
|
return result;
|
|
@@ -2063,7 +1725,7 @@ function indexSorter(sorters, dataAccessor, compare) {
|
|
|
2063
1725
|
}
|
|
2064
1726
|
function sorter(sorters, dataAccessor, compare) {
|
|
2065
1727
|
var cmp = getComparer(sorters, dataAccessor, compare);
|
|
2066
|
-
return function(data) {
|
|
1728
|
+
return function (data) {
|
|
2067
1729
|
var result = [].concat(data);
|
|
2068
1730
|
result.sort(cmp);
|
|
2069
1731
|
return result;
|
|
@@ -2078,7 +1740,6 @@ function append(array) {
|
|
|
2078
1740
|
for (var _len = arguments.length, items = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
2079
1741
|
items[_key - 1] = arguments[_key];
|
|
2080
1742
|
}
|
|
2081
|
-
|
|
2082
1743
|
if (items.length == 0) return array;
|
|
2083
1744
|
if (!array) return items;
|
|
2084
1745
|
return [].concat(array, items);
|
|
@@ -2086,10 +1747,7 @@ function append(array) {
|
|
|
2086
1747
|
|
|
2087
1748
|
function merge(item, data) {
|
|
2088
1749
|
var result = item;
|
|
2089
|
-
if (data)
|
|
2090
|
-
for (var key in data) {
|
|
2091
|
-
result = Binding.get(key).set(result, data[key]);
|
|
2092
|
-
}
|
|
1750
|
+
if (data) for (var key in data) result = Binding.get(key).set(result, data[key]);
|
|
2093
1751
|
return result;
|
|
2094
1752
|
}
|
|
2095
1753
|
|
|
@@ -2104,31 +1762,26 @@ function updateArray(array, updateCallback, itemFilter, removeFilter) {
|
|
|
2104
1762
|
if (!array) return array;
|
|
2105
1763
|
var newArray = [];
|
|
2106
1764
|
var dirty = false;
|
|
2107
|
-
|
|
2108
1765
|
for (var index = 0; index < array.length; index++) {
|
|
2109
1766
|
var item = array[index];
|
|
2110
|
-
|
|
2111
1767
|
if (removeFilter && removeFilter(item, index)) {
|
|
2112
1768
|
dirty = true;
|
|
2113
1769
|
continue;
|
|
2114
1770
|
}
|
|
2115
|
-
|
|
2116
1771
|
if (!itemFilter || itemFilter(item, index)) {
|
|
2117
1772
|
var newItem = updateCallback(item, index);
|
|
2118
1773
|
newArray.push(newItem);
|
|
2119
1774
|
if (newItem !== item) dirty = true;
|
|
2120
1775
|
} else newArray.push(item);
|
|
2121
1776
|
}
|
|
2122
|
-
|
|
2123
1777
|
return dirty ? newArray : array;
|
|
2124
1778
|
}
|
|
2125
1779
|
|
|
2126
1780
|
function updateTree(array, updateCallback, itemFilter, childrenField, removeFilter) {
|
|
2127
1781
|
return updateArray(
|
|
2128
1782
|
array,
|
|
2129
|
-
function(item) {
|
|
1783
|
+
function (item) {
|
|
2130
1784
|
var _objectSpread2$1;
|
|
2131
|
-
|
|
2132
1785
|
if (!itemFilter || itemFilter(item)) item = updateCallback(item);
|
|
2133
1786
|
var children = item[childrenField];
|
|
2134
1787
|
if (!Array.isArray(children)) return item;
|
|
@@ -2150,11 +1803,10 @@ function removeTreeNodes(array, criteria, childrenField) {
|
|
|
2150
1803
|
if (childrenField === void 0) {
|
|
2151
1804
|
childrenField = "$children";
|
|
2152
1805
|
}
|
|
2153
|
-
|
|
2154
1806
|
return updateTree(
|
|
2155
1807
|
array,
|
|
2156
1808
|
null,
|
|
2157
|
-
function() {
|
|
1809
|
+
function () {
|
|
2158
1810
|
return false;
|
|
2159
1811
|
},
|
|
2160
1812
|
childrenField,
|
|
@@ -2166,15 +1818,12 @@ function findTreeNode(array, criteria, childrenField) {
|
|
|
2166
1818
|
if (childrenField === void 0) {
|
|
2167
1819
|
childrenField = "$children";
|
|
2168
1820
|
}
|
|
2169
|
-
|
|
2170
1821
|
if (!Array.isArray(array)) return false;
|
|
2171
|
-
|
|
2172
1822
|
for (var i = 0; i < array.length; i++) {
|
|
2173
1823
|
if (criteria(array[i])) return array[i];
|
|
2174
1824
|
var child = findTreeNode(array[i][childrenField], criteria, childrenField);
|
|
2175
1825
|
if (child) return child;
|
|
2176
1826
|
}
|
|
2177
|
-
|
|
2178
1827
|
return false;
|
|
2179
1828
|
}
|
|
2180
1829
|
|
|
@@ -2182,19 +1831,12 @@ function moveElement(array, sourceIndex, targetIndex) {
|
|
|
2182
1831
|
if (targetIndex == sourceIndex) return array;
|
|
2183
1832
|
var el = array[sourceIndex];
|
|
2184
1833
|
var res = [].concat(array);
|
|
2185
|
-
|
|
2186
1834
|
if (sourceIndex < targetIndex) {
|
|
2187
|
-
for (var i = sourceIndex; i + 1 < targetIndex; i++)
|
|
2188
|
-
res[i] = res[i + 1];
|
|
2189
|
-
}
|
|
2190
|
-
|
|
1835
|
+
for (var i = sourceIndex; i + 1 < targetIndex; i++) res[i] = res[i + 1];
|
|
2191
1836
|
targetIndex--;
|
|
2192
1837
|
} else {
|
|
2193
|
-
for (var _i = sourceIndex; _i > targetIndex; _i--)
|
|
2194
|
-
res[_i] = res[_i - 1];
|
|
2195
|
-
}
|
|
1838
|
+
for (var _i = sourceIndex; _i > targetIndex; _i--) res[_i] = res[_i - 1];
|
|
2196
1839
|
}
|
|
2197
|
-
|
|
2198
1840
|
res[targetIndex] = el;
|
|
2199
1841
|
return res;
|
|
2200
1842
|
}
|
|
@@ -2203,7 +1845,6 @@ function insertElement(array, index) {
|
|
|
2203
1845
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
2204
1846
|
args[_key - 2] = arguments[_key];
|
|
2205
1847
|
}
|
|
2206
|
-
|
|
2207
1848
|
return [].concat(array.slice(0, index), args, array.slice(index));
|
|
2208
1849
|
}
|
|
2209
1850
|
|
|
@@ -2211,13 +1852,10 @@ function findTreePath(array, criteria, childrenField, currentPath) {
|
|
|
2211
1852
|
if (childrenField === void 0) {
|
|
2212
1853
|
childrenField = "$children";
|
|
2213
1854
|
}
|
|
2214
|
-
|
|
2215
1855
|
if (currentPath === void 0) {
|
|
2216
1856
|
currentPath = [];
|
|
2217
1857
|
}
|
|
2218
|
-
|
|
2219
1858
|
if (!Array.isArray(array)) return false;
|
|
2220
|
-
|
|
2221
1859
|
for (var i = 0; i < array.length; i++) {
|
|
2222
1860
|
currentPath.push(array[i]);
|
|
2223
1861
|
if (criteria(array[i])) return currentPath;
|
|
@@ -2225,7 +1863,6 @@ function findTreePath(array, criteria, childrenField, currentPath) {
|
|
|
2225
1863
|
if (childPath) return childPath;
|
|
2226
1864
|
currentPath.pop();
|
|
2227
1865
|
}
|
|
2228
|
-
|
|
2229
1866
|
return false;
|
|
2230
1867
|
}
|
|
2231
1868
|
|
|
@@ -2235,15 +1872,10 @@ function diffArrays(oldArray, newArray, keyFn) {
|
|
|
2235
1872
|
return e;
|
|
2236
1873
|
};
|
|
2237
1874
|
var map = new Map();
|
|
2238
|
-
|
|
2239
|
-
for (var i = 0; i < oldArray.length; i++) {
|
|
2240
|
-
map.set(keyFn(oldArray[i]), oldArray[i]);
|
|
2241
|
-
}
|
|
2242
|
-
|
|
1875
|
+
for (var i = 0; i < oldArray.length; i++) map.set(keyFn(oldArray[i]), oldArray[i]);
|
|
2243
1876
|
var added = [],
|
|
2244
1877
|
changed = [],
|
|
2245
1878
|
unchanged = [];
|
|
2246
|
-
|
|
2247
1879
|
for (var _i = 0; _i < newArray.length; _i++) {
|
|
2248
1880
|
var el = newArray[_i];
|
|
2249
1881
|
var k = keyFn(el);
|
|
@@ -2255,61 +1887,50 @@ function diffArrays(oldArray, newArray, keyFn) {
|
|
|
2255
1887
|
else
|
|
2256
1888
|
changed.push({
|
|
2257
1889
|
before: old,
|
|
2258
|
-
after: el
|
|
1890
|
+
after: el,
|
|
2259
1891
|
});
|
|
2260
1892
|
}
|
|
2261
1893
|
}
|
|
2262
|
-
|
|
2263
1894
|
var removed = Array.from(map.values());
|
|
2264
1895
|
return {
|
|
2265
1896
|
added: added,
|
|
2266
1897
|
changed: changed,
|
|
2267
1898
|
unchanged: unchanged,
|
|
2268
|
-
removed: removed
|
|
1899
|
+
removed: removed,
|
|
2269
1900
|
};
|
|
2270
1901
|
}
|
|
2271
1902
|
|
|
2272
|
-
var ArrayRef = /*#__PURE__*/ (function(_Ref) {
|
|
1903
|
+
var ArrayRef = /*#__PURE__*/ (function (_Ref) {
|
|
2273
1904
|
_inheritsLoose(ArrayRef, _Ref);
|
|
2274
|
-
|
|
2275
1905
|
function ArrayRef() {
|
|
2276
1906
|
return _Ref.apply(this, arguments) || this;
|
|
2277
1907
|
}
|
|
2278
|
-
|
|
2279
1908
|
var _proto = ArrayRef.prototype;
|
|
2280
|
-
|
|
2281
1909
|
_proto.append = function append$1() {
|
|
2282
1910
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2283
1911
|
args[_key] = arguments[_key];
|
|
2284
1912
|
}
|
|
2285
|
-
|
|
2286
1913
|
this.update.apply(this, [append].concat(args));
|
|
2287
1914
|
};
|
|
2288
|
-
|
|
2289
1915
|
_proto.insert = function insert(index) {
|
|
2290
1916
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
2291
1917
|
args[_key2 - 1] = arguments[_key2];
|
|
2292
1918
|
}
|
|
2293
|
-
|
|
2294
1919
|
this.update.apply(this, [insertElement].concat(args));
|
|
2295
1920
|
};
|
|
2296
|
-
|
|
2297
1921
|
_proto.filter = function filter(predicate) {
|
|
2298
|
-
this.update(function(array) {
|
|
2299
|
-
return array.filter(function(a) {
|
|
1922
|
+
this.update(function (array) {
|
|
1923
|
+
return array.filter(function (a) {
|
|
2300
1924
|
return predicate(a);
|
|
2301
1925
|
});
|
|
2302
1926
|
});
|
|
2303
1927
|
};
|
|
2304
|
-
|
|
2305
1928
|
_proto.move = function move(fromIndex, toIndex) {
|
|
2306
1929
|
this.update(moveElement, fromIndex, toIndex);
|
|
2307
1930
|
};
|
|
2308
|
-
|
|
2309
1931
|
_proto.clear = function clear() {
|
|
2310
1932
|
this.set([]);
|
|
2311
1933
|
};
|
|
2312
|
-
|
|
2313
1934
|
_proto.sort = function sort(compare) {
|
|
2314
1935
|
var data = this.get();
|
|
2315
1936
|
if (!data) return;
|
|
@@ -2317,48 +1938,38 @@ var ArrayRef = /*#__PURE__*/ (function(_Ref) {
|
|
|
2317
1938
|
x.sort(compare);
|
|
2318
1939
|
this.set(x);
|
|
2319
1940
|
};
|
|
2320
|
-
|
|
2321
1941
|
return ArrayRef;
|
|
2322
1942
|
})(Ref);
|
|
2323
1943
|
|
|
2324
|
-
var StoreProxy = /*#__PURE__*/ (function(_View) {
|
|
1944
|
+
var StoreProxy = /*#__PURE__*/ (function (_View) {
|
|
2325
1945
|
_inheritsLoose(StoreProxy, _View);
|
|
2326
|
-
|
|
2327
1946
|
function StoreProxy(getStore) {
|
|
2328
1947
|
var _this;
|
|
2329
|
-
|
|
2330
1948
|
_this =
|
|
2331
1949
|
_View.call(this, {
|
|
2332
|
-
store: getStore()
|
|
1950
|
+
store: getStore(),
|
|
2333
1951
|
}) || this;
|
|
2334
1952
|
Object.defineProperty(_assertThisInitialized(_this), "store", {
|
|
2335
|
-
get: getStore
|
|
1953
|
+
get: getStore,
|
|
2336
1954
|
});
|
|
2337
1955
|
return _this;
|
|
2338
1956
|
}
|
|
2339
|
-
|
|
2340
1957
|
var _proto = StoreProxy.prototype;
|
|
2341
|
-
|
|
2342
1958
|
_proto.getData = function getData() {
|
|
2343
1959
|
return this.store.getData();
|
|
2344
1960
|
};
|
|
2345
|
-
|
|
2346
1961
|
return StoreProxy;
|
|
2347
1962
|
})(View);
|
|
2348
1963
|
|
|
2349
|
-
var ArrayElementView = /*#__PURE__*/ (function(_AugmentedViewBase) {
|
|
1964
|
+
var ArrayElementView = /*#__PURE__*/ (function (_AugmentedViewBase) {
|
|
2350
1965
|
_inheritsLoose(ArrayElementView, _AugmentedViewBase);
|
|
2351
|
-
|
|
2352
1966
|
function ArrayElementView() {
|
|
2353
1967
|
return _AugmentedViewBase.apply(this, arguments) || this;
|
|
2354
1968
|
}
|
|
2355
|
-
|
|
2356
1969
|
var _proto = ArrayElementView.prototype;
|
|
2357
|
-
|
|
2358
1970
|
_proto.isExtraKey = function isExtraKey(key) {
|
|
2359
1971
|
return key == this.recordAlias || key == this.indexAlias || key == this.lengthAlias;
|
|
2360
1972
|
};
|
|
2361
|
-
|
|
2362
1973
|
_proto.deleteExtraKeyValue = function deleteExtraKeyValue(key) {
|
|
2363
1974
|
if (key != this.recordAlias) throw new Error("Field " + key + " cannot be deleted.");
|
|
2364
1975
|
var array = this.arrayAccessor.get(this.store.getData());
|
|
@@ -2366,7 +1977,6 @@ var ArrayElementView = /*#__PURE__*/ (function(_AugmentedViewBase) {
|
|
|
2366
1977
|
var newArray = [].concat(array.slice(0, this.itemIndex), array.slice(this.itemIndex + 1));
|
|
2367
1978
|
return this.arrayAccessor.set(newArray, this.store);
|
|
2368
1979
|
};
|
|
2369
|
-
|
|
2370
1980
|
_proto.setExtraKeyValue = function setExtraKeyValue(key, value) {
|
|
2371
1981
|
if (key != this.recordAlias) throw new Error("Field " + key + " is read-only.");
|
|
2372
1982
|
var array = this.arrayAccessor.get(this.store.getData());
|
|
@@ -2374,7 +1984,6 @@ var ArrayElementView = /*#__PURE__*/ (function(_AugmentedViewBase) {
|
|
|
2374
1984
|
var newArray = [].concat(array.slice(0, this.itemIndex), [value], array.slice(this.itemIndex + 1));
|
|
2375
1985
|
return this.arrayAccessor.set(newArray, this.store);
|
|
2376
1986
|
};
|
|
2377
|
-
|
|
2378
1987
|
_proto.embedAugmentData = function embedAugmentData(result, parentStoreData) {
|
|
2379
1988
|
var array = this.arrayAccessor.get(parentStoreData);
|
|
2380
1989
|
if (!isArray(array)) return;
|
|
@@ -2382,11 +1991,9 @@ var ArrayElementView = /*#__PURE__*/ (function(_AugmentedViewBase) {
|
|
|
2382
1991
|
result[this.indexAlias] = this.itemIndex;
|
|
2383
1992
|
result[this.lengthAlias] = array.length;
|
|
2384
1993
|
};
|
|
2385
|
-
|
|
2386
1994
|
_proto.setIndex = function setIndex(itemIndex) {
|
|
2387
1995
|
this.itemIndex = itemIndex;
|
|
2388
1996
|
};
|
|
2389
|
-
|
|
2390
1997
|
return ArrayElementView;
|
|
2391
1998
|
})(AugmentedViewBase);
|
|
2392
1999
|
ArrayElementView.prototype.recordAlias = "$record";
|
|
@@ -2401,10 +2008,8 @@ ArrayElementView.prototype.lengthAlias = "$length";
|
|
|
2401
2008
|
|
|
2402
2009
|
function getAccessor(accessor, options) {
|
|
2403
2010
|
if (accessor == null) return null;
|
|
2404
|
-
|
|
2405
2011
|
if (isObject(accessor)) {
|
|
2406
2012
|
if (accessor.isAccessor || accessor.isRef) return accessor;
|
|
2407
|
-
|
|
2408
2013
|
if (isBinding(accessor)) {
|
|
2409
2014
|
var binding = Binding.get(accessor);
|
|
2410
2015
|
return {
|
|
@@ -2412,23 +2017,20 @@ function getAccessor(accessor, options) {
|
|
|
2412
2017
|
set: function set(v, store) {
|
|
2413
2018
|
return store.set(binding.path, v);
|
|
2414
2019
|
},
|
|
2415
|
-
isAccessor: true
|
|
2020
|
+
isAccessor: true,
|
|
2416
2021
|
};
|
|
2417
2022
|
}
|
|
2418
2023
|
}
|
|
2419
|
-
|
|
2420
2024
|
if (isAccessorChain(accessor)) {
|
|
2421
2025
|
var _binding = Binding.get(accessor);
|
|
2422
|
-
|
|
2423
2026
|
return {
|
|
2424
2027
|
get: _binding.value,
|
|
2425
2028
|
set: function set(v, store) {
|
|
2426
2029
|
return store.set(_binding.path, v);
|
|
2427
2030
|
},
|
|
2428
|
-
isAccessor: true
|
|
2031
|
+
isAccessor: true,
|
|
2429
2032
|
};
|
|
2430
2033
|
}
|
|
2431
|
-
|
|
2432
2034
|
if (isSelector(accessor)) {
|
|
2433
2035
|
var selector = getSelector(accessor);
|
|
2434
2036
|
if (accessor && accessor.set)
|
|
@@ -2441,20 +2043,19 @@ function getAccessor(accessor, options) {
|
|
|
2441
2043
|
set: function set(value) {
|
|
2442
2044
|
return accessor.set(value, instance);
|
|
2443
2045
|
},
|
|
2444
|
-
isAccessor: true
|
|
2046
|
+
isAccessor: true,
|
|
2445
2047
|
};
|
|
2446
|
-
}
|
|
2048
|
+
},
|
|
2447
2049
|
};
|
|
2448
2050
|
return {
|
|
2449
2051
|
get: selector,
|
|
2450
|
-
isAccessor: true
|
|
2052
|
+
isAccessor: true,
|
|
2451
2053
|
};
|
|
2452
2054
|
}
|
|
2453
|
-
|
|
2454
2055
|
return {
|
|
2455
2056
|
get: function get() {
|
|
2456
2057
|
return accessor;
|
|
2457
|
-
}
|
|
2058
|
+
},
|
|
2458
2059
|
};
|
|
2459
2060
|
}
|
|
2460
2061
|
|
|
@@ -2504,5 +2105,5 @@ export {
|
|
|
2504
2105
|
sorter,
|
|
2505
2106
|
stringTemplate,
|
|
2506
2107
|
updateArray,
|
|
2507
|
-
updateTree
|
|
2108
|
+
updateTree,
|
|
2508
2109
|
};
|