cx 26.0.1 → 26.0.3
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/build/charts/Bar.d.ts +29 -0
- package/build/charts/Bar.js +74 -0
- package/build/charts/BarGraph.d.ts +29 -0
- package/build/charts/BarGraph.js +86 -0
- package/build/charts/BubbleGraph.d.ts +54 -0
- package/build/charts/BubbleGraph.js +80 -0
- package/build/charts/Chart.d.ts +31 -0
- package/build/charts/Chart.js +62 -0
- package/build/charts/ColorMap.d.ts +59 -0
- package/build/charts/ColorMap.js +97 -0
- package/build/charts/Column.d.ts +32 -0
- package/build/charts/Column.js +81 -0
- package/build/charts/ColumnBarBase.d.ts +92 -0
- package/build/charts/ColumnBarBase.js +144 -0
- package/build/charts/ColumnBarGraphBase.d.ts +91 -0
- package/build/charts/ColumnBarGraphBase.js +106 -0
- package/build/charts/ColumnGraph.d.ts +30 -0
- package/build/charts/ColumnGraph.js +94 -0
- package/build/charts/Grid.d.ts +2 -0
- package/build/charts/Grid.js +3 -0
- package/build/charts/Gridlines.d.ts +34 -0
- package/build/charts/Gridlines.js +42 -0
- package/build/charts/Legend.d.ts +73 -0
- package/build/charts/Legend.js +138 -0
- package/build/charts/LegendEntry.d.ts +60 -0
- package/build/charts/LegendEntry.js +101 -0
- package/build/charts/LineGraph.d.ts +111 -0
- package/build/charts/LineGraph.js +253 -0
- package/build/charts/Marker.d.ts +133 -0
- package/build/charts/Marker.js +275 -0
- package/build/charts/MarkerLine.d.ts +65 -0
- package/build/charts/MarkerLine.js +108 -0
- package/build/charts/MouseTracker.d.ts +34 -0
- package/build/charts/MouseTracker.js +55 -0
- package/build/charts/Pie.d.ts +4 -0
- package/build/charts/Pie.js +5 -0
- package/build/charts/PieChart.d.ts +158 -0
- package/build/charts/PieChart.js +445 -0
- package/build/charts/PieLabel.d.ts +34 -0
- package/build/charts/PieLabel.js +47 -0
- package/build/charts/PieLabelsContainer.d.ts +15 -0
- package/build/charts/PieLabelsContainer.js +54 -0
- package/build/charts/Range.d.ts +94 -0
- package/build/charts/Range.js +160 -0
- package/build/charts/RangeMarker.d.ts +65 -0
- package/build/charts/RangeMarker.js +143 -0
- package/build/charts/ScatterGraph.d.ts +72 -0
- package/build/charts/ScatterGraph.js +133 -0
- package/build/charts/Swimlane.d.ts +47 -0
- package/build/charts/Swimlane.js +113 -0
- package/build/charts/Swimlanes.d.ts +57 -0
- package/build/charts/Swimlanes.js +83 -0
- package/build/charts/axis/Axis.d.ts +141 -0
- package/build/charts/axis/Axis.js +215 -0
- package/build/charts/axis/CategoryAxis.d.ts +35 -0
- package/build/charts/axis/CategoryAxis.js +240 -0
- package/build/charts/axis/NumericAxis.d.ts +57 -0
- package/build/charts/axis/NumericAxis.js +316 -0
- package/build/charts/axis/Stack.d.ts +16 -0
- package/build/charts/axis/Stack.js +57 -0
- package/build/charts/axis/TimeAxis.d.ts +50 -0
- package/build/charts/axis/TimeAxis.js +554 -0
- package/build/charts/axis/index.d.ts +4 -0
- package/build/charts/axis/index.js +4 -0
- package/build/charts/helpers/MinMaxFinder.d.ts +36 -0
- package/build/charts/helpers/MinMaxFinder.js +37 -0
- package/build/charts/helpers/PointReducer.d.ts +41 -0
- package/build/charts/helpers/PointReducer.js +55 -0
- package/build/charts/helpers/SnapPointFinder.d.ts +58 -0
- package/build/charts/helpers/SnapPointFinder.js +65 -0
- package/build/charts/helpers/ValueAtFinder.d.ts +33 -0
- package/build/charts/helpers/ValueAtFinder.js +46 -0
- package/build/charts/helpers/index.d.ts +4 -0
- package/build/charts/helpers/index.js +4 -0
- package/build/charts/index.d.ts +26 -0
- package/build/charts/index.js +26 -0
- package/build/charts/shapes.d.ts +13 -0
- package/build/charts/shapes.js +62 -0
- package/build/data/AggregateFunction.d.ts +60 -0
- package/build/data/AggregateFunction.js +155 -0
- package/build/data/ArrayElementView.d.ts +33 -0
- package/build/data/ArrayElementView.js +65 -0
- package/build/data/ArrayElementView.spec.d.ts +1 -0
- package/build/data/ArrayElementView.spec.js +81 -0
- package/build/data/ArrayRef.d.ts +9 -0
- package/build/data/ArrayRef.js +29 -0
- package/build/data/AugmentedViewBase.d.ts +18 -0
- package/build/data/AugmentedViewBase.js +72 -0
- package/build/data/Binding.d.ts +23 -0
- package/build/data/Binding.js +78 -0
- package/build/data/Binding.spec.d.ts +1 -0
- package/build/data/Binding.spec.js +61 -0
- package/build/data/ExposedRecordView.d.ts +24 -0
- package/build/data/ExposedRecordView.js +76 -0
- package/build/data/ExposedValueView.d.ts +20 -0
- package/build/data/ExposedValueView.js +68 -0
- package/build/data/Expression.d.ts +12 -0
- package/build/data/Expression.js +201 -0
- package/build/data/Expression.spec.d.ts +1 -0
- package/build/data/Expression.spec.js +196 -0
- package/build/data/Grouper.d.ts +29 -0
- package/build/data/Grouper.js +138 -0
- package/build/data/Grouper.spec.d.ts +1 -0
- package/build/data/Grouper.spec.js +48 -0
- package/build/data/NestedDataView.d.ts +21 -0
- package/build/data/NestedDataView.js +24 -0
- package/build/data/ReadOnlyDataView.d.ts +13 -0
- package/build/data/ReadOnlyDataView.js +25 -0
- package/build/data/Ref.d.ts +23 -0
- package/build/data/Ref.js +79 -0
- package/build/data/Ref.spec.d.ts +1 -0
- package/build/data/Ref.spec.js +72 -0
- package/build/data/Selector.d.ts +8 -0
- package/build/data/Selector.js +1 -0
- package/build/data/Store.d.ts +12 -0
- package/build/data/Store.js +41 -0
- package/build/data/Store.spec.d.ts +1 -0
- package/build/data/Store.spec.js +19 -0
- package/build/data/StoreProxy.d.ts +6 -0
- package/build/data/StoreProxy.js +14 -0
- package/build/data/StoreRef.d.ts +22 -0
- package/build/data/StoreRef.js +47 -0
- package/build/data/StoreRef.spec.d.ts +1 -0
- package/build/data/StoreRef.spec.js +22 -0
- package/build/data/StringTemplate.d.ts +9 -0
- package/build/data/StringTemplate.js +81 -0
- package/build/data/StringTemplate.spec.d.ts +1 -0
- package/build/data/StringTemplate.spec.js +112 -0
- package/build/data/StructuredSelector.d.ts +12 -0
- package/build/data/StructuredSelector.js +131 -0
- package/build/data/StructuredSelector.spec.d.ts +1 -0
- package/build/data/StructuredSelector.spec.js +102 -0
- package/build/data/SubscribableView.d.ts +15 -0
- package/build/data/SubscribableView.js +52 -0
- package/build/data/View.d.ts +125 -0
- package/build/data/View.js +163 -0
- package/build/data/View.spec.d.ts +1 -0
- package/build/data/View.spec.js +44 -0
- package/build/data/ZoomIntoPropertyView.d.ts +15 -0
- package/build/data/ZoomIntoPropertyView.js +34 -0
- package/build/data/ZoomIntoPropertyView.spec.d.ts +1 -0
- package/build/data/ZoomIntoPropertyView.spec.js +54 -0
- package/build/data/comparer.d.ts +11 -0
- package/build/data/comparer.js +55 -0
- package/build/data/comparer.spec.d.ts +1 -0
- package/build/data/comparer.spec.js +50 -0
- package/build/data/computable.d.ts +10 -0
- package/build/data/computable.js +46 -0
- package/build/data/computable.spec.d.ts +1 -0
- package/build/data/computable.spec.js +56 -0
- package/build/data/createAccessorModelProxy.d.ts +17 -0
- package/build/data/createAccessorModelProxy.js +37 -0
- package/build/data/createAccessorModelProxy.spec.d.ts +1 -0
- package/build/data/createAccessorModelProxy.spec.js +30 -0
- package/build/data/createStructuredSelector.d.ts +9 -0
- package/build/data/createStructuredSelector.js +40 -0
- package/build/data/createStructuredSelector.spec.d.ts +1 -0
- package/build/data/createStructuredSelector.spec.js +42 -0
- package/build/data/defaultCompare.d.ts +1 -0
- package/build/data/defaultCompare.js +12 -0
- package/build/data/diff/diffArrays.d.ts +12 -0
- package/build/data/diff/diffArrays.js +34 -0
- package/build/data/diff/diffs.spec.d.ts +1 -0
- package/build/data/diff/diffs.spec.js +45 -0
- package/build/data/diff/index.d.ts +1 -0
- package/build/data/diff/index.js +1 -0
- package/build/data/enableFatArrowExpansion.d.ts +1 -0
- package/build/data/enableFatArrowExpansion.js +5 -0
- package/build/data/getAccessor.d.ts +11 -0
- package/build/data/getAccessor.js +51 -0
- package/build/data/getAccessor.spec.d.ts +1 -0
- package/build/data/getAccessor.spec.js +10 -0
- package/build/data/getSelector.d.ts +3 -0
- package/build/data/getSelector.js +60 -0
- package/build/data/getSelector.spec.d.ts +1 -0
- package/build/data/getSelector.spec.js +36 -0
- package/build/data/index.d.ts +29 -0
- package/build/data/index.js +29 -0
- package/build/data/isSelector.d.ts +1 -0
- package/build/data/isSelector.js +19 -0
- package/build/data/ops/append.d.ts +1 -0
- package/build/data/ops/append.js +7 -0
- package/build/data/ops/append.spec.d.ts +1 -0
- package/build/data/ops/append.spec.js +24 -0
- package/build/data/ops/filter.d.ts +1 -0
- package/build/data/ops/filter.js +8 -0
- package/build/data/ops/filter.spec.d.ts +1 -0
- package/build/data/ops/filter.spec.js +25 -0
- package/build/data/ops/findTreeNode.d.ts +1 -0
- package/build/data/ops/findTreeNode.js +13 -0
- package/build/data/ops/findTreeNode.spec.d.ts +1 -0
- package/build/data/ops/findTreeNode.spec.js +20 -0
- package/build/data/ops/findTreePath.d.ts +1 -0
- package/build/data/ops/findTreePath.js +15 -0
- package/build/data/ops/index.d.ts +10 -0
- package/build/data/ops/index.js +10 -0
- package/build/data/ops/insertElement.d.ts +1 -0
- package/build/data/ops/insertElement.js +3 -0
- package/build/data/ops/merge.d.ts +1 -0
- package/build/data/ops/merge.js +10 -0
- package/build/data/ops/merge.spec.d.ts +1 -0
- package/build/data/ops/merge.spec.js +23 -0
- package/build/data/ops/moveElement.d.ts +1 -0
- package/build/data/ops/moveElement.js +20 -0
- package/build/data/ops/removeTreeNodes.d.ts +1 -0
- package/build/data/ops/removeTreeNodes.js +4 -0
- package/build/data/ops/removeTreeNodes.spec.d.ts +1 -0
- package/build/data/ops/removeTreeNodes.spec.js +35 -0
- package/build/data/ops/updateArray.d.ts +1 -0
- package/build/data/ops/updateArray.js +23 -0
- package/build/data/ops/updateArray.spec.d.ts +1 -0
- package/build/data/ops/updateArray.spec.js +33 -0
- package/build/data/ops/updateTree.d.ts +1 -0
- package/build/data/ops/updateTree.js +14 -0
- package/build/data/ops/updateTree.spec.d.ts +1 -0
- package/build/data/ops/updateTree.spec.js +44 -0
- package/build/data/test-types.d.ts +1 -0
- package/build/data/test-types.js +2 -0
- package/build/hooks/createLocalStorageRef.d.ts +2 -0
- package/build/hooks/createLocalStorageRef.js +22 -0
- package/build/hooks/index.d.ts +8 -0
- package/build/hooks/index.js +8 -0
- package/build/hooks/invokeCallback.d.ts +2 -0
- package/build/hooks/invokeCallback.js +8 -0
- package/build/hooks/invokeCallback.spec.d.ts +1 -0
- package/build/hooks/invokeCallback.spec.js +44 -0
- package/build/hooks/resolveCallback.d.ts +2 -0
- package/build/hooks/resolveCallback.js +13 -0
- package/build/hooks/resolveCallback.spec.d.ts +1 -0
- package/build/hooks/resolveCallback.spec.js +35 -0
- package/build/hooks/store.d.ts +11 -0
- package/build/hooks/store.js +38 -0
- package/build/hooks/store.spec.d.ts +1 -0
- package/build/hooks/store.spec.js +48 -0
- package/build/hooks/useEffect.d.ts +2 -0
- package/build/hooks/useEffect.js +13 -0
- package/build/hooks/useInterval.d.ts +1 -0
- package/build/hooks/useInterval.js +7 -0
- package/build/hooks/useState.d.ts +2 -0
- package/build/hooks/useState.js +17 -0
- package/build/hooks/useTrigger.d.ts +3 -0
- package/build/hooks/useTrigger.js +22 -0
- package/build/hooks/useTrigger.spec.d.ts +1 -0
- package/build/hooks/useTrigger.spec.js +59 -0
- package/build/index.d.ts +7 -0
- package/build/index.js +7 -0
- package/build/jsx-runtime.d.ts +31 -0
- package/build/jsx-runtime.js +27 -0
- package/build/locale/de-de.d.ts +1 -0
- package/build/locale/de-de.js +62 -0
- package/build/locale/en-us.d.ts +1 -0
- package/build/locale/en-us.js +62 -0
- package/build/locale/es-es.d.ts +1 -0
- package/build/locale/es-es.js +62 -0
- package/build/locale/fr-fr.d.ts +1 -0
- package/build/locale/fr-fr.js +62 -0
- package/build/locale/nl-nl.d.ts +1 -0
- package/build/locale/nl-nl.js +62 -0
- package/build/locale/pt-pt.d.ts +1 -0
- package/build/locale/pt-pt.js +62 -0
- package/build/locale/sr-latn-ba.d.ts +1 -0
- package/build/locale/sr-latn-ba.js +62 -0
- package/build/svg/BoundedObject.d.ts +39 -0
- package/build/svg/BoundedObject.js +51 -0
- package/build/svg/ClipRect.d.ts +11 -0
- package/build/svg/ClipRect.js +18 -0
- package/build/svg/Ellipse.d.ts +27 -0
- package/build/svg/Ellipse.js +22 -0
- package/build/svg/Line.d.ts +26 -0
- package/build/svg/Line.js +19 -0
- package/build/svg/NonOverlappingRect.d.ts +12 -0
- package/build/svg/NonOverlappingRect.js +17 -0
- package/build/svg/NonOverlappingRectGroup.d.ts +15 -0
- package/build/svg/NonOverlappingRectGroup.js +38 -0
- package/build/svg/Rectangle.d.ts +40 -0
- package/build/svg/Rectangle.js +27 -0
- package/build/svg/Svg.d.ts +49 -0
- package/build/svg/Svg.js +132 -0
- package/build/svg/Text.d.ts +48 -0
- package/build/svg/Text.js +60 -0
- package/build/svg/TextualBoundedObject.d.ts +7 -0
- package/build/svg/TextualBoundedObject.js +22 -0
- package/build/svg/index.d.ts +11 -0
- package/build/svg/index.js +11 -0
- package/build/svg/util/Rect.d.ts +31 -0
- package/build/svg/util/Rect.js +83 -0
- package/build/svg/util/index.d.ts +1 -0
- package/build/svg/util/index.js +1 -0
- package/build/ui/CSS.d.ts +10 -0
- package/build/ui/CSS.js +77 -0
- package/build/ui/CSSHelper.d.ts +5 -0
- package/build/ui/CSSHelper.js +15 -0
- package/build/ui/Container.d.ts +55 -0
- package/build/ui/Container.js +160 -0
- package/build/ui/ContentResolver.d.ts +51 -0
- package/build/ui/ContentResolver.js +71 -0
- package/build/ui/Controller.d.ts +64 -0
- package/build/ui/Controller.js +110 -0
- package/build/ui/Controller.spec.d.ts +1 -0
- package/build/ui/Controller.spec.js +251 -0
- package/build/ui/Culture.d.ts +39 -0
- package/build/ui/Culture.js +124 -0
- package/build/ui/Cx.d.ts +57 -0
- package/build/ui/Cx.js +277 -0
- package/build/ui/Cx.spec.d.ts +1 -0
- package/build/ui/Cx.spec.js +153 -0
- package/build/ui/DataProxy.d.ts +24 -0
- package/build/ui/DataProxy.js +26 -0
- package/build/ui/DataProxy.spec.d.ts +1 -0
- package/build/ui/DataProxy.spec.js +208 -0
- package/build/ui/DetachedScope.d.ts +61 -0
- package/build/ui/DetachedScope.js +84 -0
- package/build/ui/FocusManager.d.ts +16 -0
- package/build/ui/FocusManager.js +149 -0
- package/build/ui/Format.d.ts +4 -0
- package/build/ui/Format.js +96 -0
- package/build/ui/HoverSync.d.ts +30 -0
- package/build/ui/HoverSync.js +129 -0
- package/build/ui/Instance.d.ts +219 -0
- package/build/ui/Instance.js +613 -0
- package/build/ui/IsolatedScope.d.ts +19 -0
- package/build/ui/IsolatedScope.js +31 -0
- package/build/ui/IsolatedScope.spec.d.ts +1 -0
- package/build/ui/IsolatedScope.spec.js +42 -0
- package/build/ui/Localization.d.ts +9 -0
- package/build/ui/Localization.js +63 -0
- package/build/ui/Prop.d.ts +83 -0
- package/build/ui/Prop.js +1 -0
- package/build/ui/PureContainer.d.ts +9 -0
- package/build/ui/PureContainer.js +9 -0
- package/build/ui/RenderingContext.d.ts +19 -0
- package/build/ui/RenderingContext.js +84 -0
- package/build/ui/Repeater.d.ts +73 -0
- package/build/ui/Repeater.js +99 -0
- package/build/ui/Repeater.spec.d.ts +1 -0
- package/build/ui/Repeater.spec.js +109 -0
- package/build/ui/Rescope.d.ts +18 -0
- package/build/ui/Rescope.js +31 -0
- package/build/ui/Rescope.spec.d.ts +1 -0
- package/build/ui/Rescope.spec.js +134 -0
- package/build/ui/ResizeManager.d.ts +5 -0
- package/build/ui/ResizeManager.js +24 -0
- package/build/ui/Restate.d.ts +44 -0
- package/build/ui/Restate.js +142 -0
- package/build/ui/Restate.spec.d.ts +1 -0
- package/build/ui/Restate.spec.js +257 -0
- package/build/ui/StaticText.d.ts +5 -0
- package/build/ui/StaticText.js +7 -0
- package/build/ui/StructuredInstanceDataAccessor.d.ts +13 -0
- package/build/ui/StructuredInstanceDataAccessor.js +30 -0
- package/build/ui/Text.d.ts +10 -0
- package/build/ui/Text.js +21 -0
- package/build/ui/VDOM.d.ts +20 -0
- package/build/ui/VDOM.js +3 -0
- package/build/ui/Widget.d.ts +111 -0
- package/build/ui/Widget.js +170 -0
- package/build/ui/ZIndexManager.d.ts +4 -0
- package/build/ui/ZIndexManager.js +9 -0
- package/build/ui/adapter/ArrayAdapter.d.ts +48 -0
- package/build/ui/adapter/ArrayAdapter.js +148 -0
- package/build/ui/adapter/ArrayAdapter.spec.d.ts +1 -0
- package/build/ui/adapter/ArrayAdapter.spec.js +44 -0
- package/build/ui/adapter/DataAdapter.d.ts +30 -0
- package/build/ui/adapter/DataAdapter.js +13 -0
- package/build/ui/adapter/GroupAdapter.d.ts +57 -0
- package/build/ui/adapter/GroupAdapter.js +137 -0
- package/build/ui/adapter/TreeAdapter.d.ts +51 -0
- package/build/ui/adapter/TreeAdapter.js +98 -0
- package/build/ui/adapter/TreeAdapter.spec.d.ts +1 -0
- package/build/ui/adapter/TreeAdapter.spec.js +71 -0
- package/build/ui/adapter/index.d.ts +4 -0
- package/build/ui/adapter/index.js +4 -0
- package/build/ui/app/History.d.ts +18 -0
- package/build/ui/app/History.js +109 -0
- package/build/ui/app/Url.d.ts +13 -0
- package/build/ui/app/Url.js +86 -0
- package/build/ui/app/Url.spec.d.ts +1 -0
- package/build/ui/app/Url.spec.js +43 -0
- package/build/ui/app/index.d.ts +4 -0
- package/build/ui/app/index.js +4 -0
- package/build/ui/app/startAppLoop.d.ts +10 -0
- package/build/ui/app/startAppLoop.js +53 -0
- package/build/ui/app/startHotAppLoop.d.ts +11 -0
- package/build/ui/app/startHotAppLoop.js +22 -0
- package/build/ui/batchUpdates.d.ts +5 -0
- package/build/ui/batchUpdates.js +60 -0
- package/build/ui/bind.d.ts +3 -0
- package/build/ui/bind.js +7 -0
- package/build/ui/createFunctionalComponent.d.ts +2 -0
- package/build/ui/createFunctionalComponent.js +58 -0
- package/build/ui/createFunctionalComponent.spec.d.ts +1 -0
- package/build/ui/createFunctionalComponent.spec.js +272 -0
- package/build/ui/expr.d.ts +11 -0
- package/build/ui/expr.js +17 -0
- package/build/ui/flattenProps.d.ts +1 -0
- package/build/ui/flattenProps.js +18 -0
- package/build/ui/index.d.ts +40 -0
- package/build/ui/index.js +41 -0
- package/build/ui/keyboardShortcuts.d.ts +10 -0
- package/build/ui/keyboardShortcuts.js +27 -0
- package/build/ui/layout/Content.d.ts +14 -0
- package/build/ui/layout/Content.js +15 -0
- package/build/ui/layout/ContentPlaceholder.d.ts +35 -0
- package/build/ui/layout/ContentPlaceholder.js +105 -0
- package/build/ui/layout/ContentPlaceholder.spec.d.ts +1 -0
- package/build/ui/layout/ContentPlaceholder.spec.js +333 -0
- package/build/ui/layout/FirstVisibleChildLayout.d.ts +7 -0
- package/build/ui/layout/FirstVisibleChildLayout.js +58 -0
- package/build/ui/layout/FirstVisibleChildLayout.spec.d.ts +1 -0
- package/build/ui/layout/FirstVisibleChildLayout.spec.js +101 -0
- package/build/ui/layout/LabelsLeftLayout.d.ts +17 -0
- package/build/ui/layout/LabelsLeftLayout.js +50 -0
- package/build/ui/layout/LabelsTopLayout.d.ts +36 -0
- package/build/ui/layout/LabelsTopLayout.js +97 -0
- package/build/ui/layout/UseParentLayout.d.ts +4 -0
- package/build/ui/layout/UseParentLayout.js +5 -0
- package/build/ui/layout/exploreChildren.d.ts +4 -0
- package/build/ui/layout/exploreChildren.js +27 -0
- package/build/ui/layout/index.d.ts +7 -0
- package/build/ui/layout/index.js +7 -0
- package/build/ui/selection/KeySelection.d.ts +37 -0
- package/build/ui/selection/KeySelection.js +125 -0
- package/build/ui/selection/PropertySelection.d.ts +26 -0
- package/build/ui/selection/PropertySelection.js +51 -0
- package/build/ui/selection/Selection.d.ts +35 -0
- package/build/ui/selection/Selection.js +75 -0
- package/build/ui/selection/index.d.ts +3 -0
- package/build/ui/selection/index.js +3 -0
- package/build/ui/tpl.d.ts +3 -0
- package/build/ui/tpl.js +5 -0
- package/build/util/Component.d.ts +149 -0
- package/build/util/Component.js +109 -0
- package/build/util/Console.d.ts +4 -0
- package/build/util/Console.js +10 -0
- package/build/util/DOM.d.ts +24 -0
- package/build/util/DOM.js +64 -0
- package/build/util/Debug.d.ts +25 -0
- package/build/util/Debug.js +42 -0
- package/build/util/Format.d.ts +14 -0
- package/build/util/Format.js +229 -0
- package/build/util/Format.spec.d.ts +1 -0
- package/build/util/Format.spec.js +58 -0
- package/build/util/GlobalCacheIdentifier.d.ts +4 -0
- package/build/util/GlobalCacheIdentifier.js +9 -0
- package/build/util/KeyCode.d.ts +21 -0
- package/build/util/KeyCode.js +21 -0
- package/build/util/SubscriberList.d.ts +39 -0
- package/build/util/SubscriberList.js +70 -0
- package/build/util/Timing.d.ts +15 -0
- package/build/util/Timing.js +49 -0
- package/build/util/TraversalStack.d.ts +8 -0
- package/build/util/TraversalStack.js +37 -0
- package/build/util/TraversalStack.spec.d.ts +1 -0
- package/build/util/TraversalStack.spec.js +43 -0
- package/build/util/addEventListenerWithOptions.d.ts +17 -0
- package/build/util/addEventListenerWithOptions.js +8 -0
- package/build/util/browserSupportsPassiveEventHandlers.d.ts +5 -0
- package/build/util/browserSupportsPassiveEventHandlers.js +20 -0
- package/build/util/calculateNaturalElementHeight.d.ts +1 -0
- package/build/util/calculateNaturalElementHeight.js +24 -0
- package/build/util/capitalize.d.ts +1 -0
- package/build/util/capitalize.js +5 -0
- package/build/util/coalesce.d.ts +1 -0
- package/build/util/coalesce.js +7 -0
- package/build/util/color/hslToRgb.d.ts +8 -0
- package/build/util/color/hslToRgb.js +38 -0
- package/build/util/color/index.d.ts +4 -0
- package/build/util/color/index.js +4 -0
- package/build/util/color/parseColor.d.ts +57 -0
- package/build/util/color/parseColor.js +114 -0
- package/build/util/color/rgbToHex.d.ts +8 -0
- package/build/util/color/rgbToHex.js +14 -0
- package/build/util/color/rgbToHsl.d.ts +8 -0
- package/build/util/color/rgbToHsl.js +35 -0
- package/build/util/date/dateDiff.d.ts +7 -0
- package/build/util/date/dateDiff.js +10 -0
- package/build/util/date/diff.d.ts +7 -0
- package/build/util/date/diff.js +11 -0
- package/build/util/date/encodeDate.d.ts +1 -0
- package/build/util/date/encodeDate.js +7 -0
- package/build/util/date/encodeDateWithTimezoneOffset.d.ts +1 -0
- package/build/util/date/encodeDateWithTimezoneOffset.js +16 -0
- package/build/util/date/index.d.ts +11 -0
- package/build/util/date/index.js +11 -0
- package/build/util/date/lowerBoundCheck.d.ts +8 -0
- package/build/util/date/lowerBoundCheck.js +12 -0
- package/build/util/date/maxDate.d.ts +6 -0
- package/build/util/date/maxDate.js +13 -0
- package/build/util/date/minDate.d.ts +6 -0
- package/build/util/date/minDate.js +13 -0
- package/build/util/date/monthStart.d.ts +6 -0
- package/build/util/date/monthStart.js +8 -0
- package/build/util/date/parseDateInvariant.d.ts +2 -0
- package/build/util/date/parseDateInvariant.js +18 -0
- package/build/util/date/sameDate.d.ts +7 -0
- package/build/util/date/sameDate.js +11 -0
- package/build/util/date/upperBoundCheck.d.ts +8 -0
- package/build/util/date/upperBoundCheck.js +12 -0
- package/build/util/date/upperBoundCheck.spec.d.ts +1 -0
- package/build/util/date/upperBoundCheck.spec.js +22 -0
- package/build/util/date/zeroTime.d.ts +7 -0
- package/build/util/date/zeroTime.js +9 -0
- package/build/util/debounce.d.ts +5 -0
- package/build/util/debounce.js +15 -0
- package/build/util/dummyCallback.d.ts +1 -0
- package/build/util/dummyCallback.js +1 -0
- package/build/util/escapeSpecialRegexCharacters.d.ts +6 -0
- package/build/util/escapeSpecialRegexCharacters.js +8 -0
- package/build/util/eventCallbacks.d.ts +7 -0
- package/build/util/eventCallbacks.js +6 -0
- package/build/util/expandFatArrows.d.ts +1 -0
- package/build/util/expandFatArrows.js +104 -0
- package/build/util/findScrollableParent.d.ts +1 -0
- package/build/util/findScrollableParent.js +16 -0
- package/build/util/getActiveElement.d.ts +1 -0
- package/build/util/getActiveElement.js +4 -0
- package/build/util/getParentFrameBoundingClientRect.d.ts +1 -0
- package/build/util/getParentFrameBoundingClientRect.js +13 -0
- package/build/util/getScrollerBoundingClientRect.d.ts +1 -0
- package/build/util/getScrollerBoundingClientRect.js +10 -0
- package/build/util/getSearchQueryPredicate.d.ts +2 -0
- package/build/util/getSearchQueryPredicate.js +54 -0
- package/build/util/getSearchQueryPredicate.spec.d.ts +1 -0
- package/build/util/getSearchQueryPredicate.spec.js +33 -0
- package/build/util/getTopLevelBoundingClientRect.d.ts +1 -0
- package/build/util/getTopLevelBoundingClientRect.js +6 -0
- package/build/util/getVendorPrefix.d.ts +1 -0
- package/build/util/getVendorPrefix.js +22 -0
- package/build/util/hasKey.d.ts +4 -0
- package/build/util/hasKey.js +14 -0
- package/build/util/index.d.ts +55 -0
- package/build/util/index.js +55 -0
- package/build/util/innerTextTrim.d.ts +6 -0
- package/build/util/innerTextTrim.js +10 -0
- package/build/util/isArray.d.ts +1 -0
- package/build/util/isArray.js +3 -0
- package/build/util/isDataRecord.d.ts +1 -0
- package/build/util/isDataRecord.js +4 -0
- package/build/util/isDefined.d.ts +1 -0
- package/build/util/isDefined.js +3 -0
- package/build/util/isDigit.d.ts +6 -0
- package/build/util/isDigit.js +8 -0
- package/build/util/isFunction.d.ts +1 -0
- package/build/util/isFunction.js +3 -0
- package/build/util/isNonEmptyArray.d.ts +1 -0
- package/build/util/isNonEmptyArray.js +3 -0
- package/build/util/isNumber.d.ts +1 -0
- package/build/util/isNumber.js +3 -0
- package/build/util/isObject.d.ts +1 -0
- package/build/util/isObject.js +3 -0
- package/build/util/isPromise.d.ts +1 -0
- package/build/util/isPromise.js +5 -0
- package/build/util/isString.d.ts +1 -0
- package/build/util/isString.js +3 -0
- package/build/util/isTextInputElement.d.ts +1 -0
- package/build/util/isTextInputElement.js +3 -0
- package/build/util/isTouchDevice.d.ts +1 -0
- package/build/util/isTouchDevice.js +6 -0
- package/build/util/isTouchEvent.d.ts +2 -0
- package/build/util/isTouchEvent.js +43 -0
- package/build/util/isUndefined.d.ts +1 -0
- package/build/util/isUndefined.js +3 -0
- package/build/util/isValidIdentifierName.d.ts +1 -0
- package/build/util/isValidIdentifierName.js +4 -0
- package/build/util/isValidIdentifierName.spec.d.ts +1 -0
- package/build/util/isValidIdentifierName.spec.js +28 -0
- package/build/util/onIdleCallback.d.ts +1 -0
- package/build/util/onIdleCallback.js +13 -0
- package/build/util/parseStyle.d.ts +2 -0
- package/build/util/parseStyle.js +22 -0
- package/build/util/quote.d.ts +2 -0
- package/build/util/quote.js +5 -0
- package/build/util/reverseSlice.d.ts +1 -0
- package/build/util/reverseSlice.js +10 -0
- package/build/util/routeAppend.d.ts +1 -0
- package/build/util/routeAppend.js +16 -0
- package/build/util/routeAppend.spec.d.ts +1 -0
- package/build/util/routeAppend.spec.js +14 -0
- package/build/util/scrollElementIntoView.d.ts +1 -0
- package/build/util/scrollElementIntoView.js +28 -0
- package/build/util/shallowEquals.d.ts +1 -0
- package/build/util/shallowEquals.js +30 -0
- package/build/util/test/createTestRenderer.d.ts +5 -0
- package/build/util/test/createTestRenderer.js +10 -0
- package/build/util/throttle.d.ts +9 -0
- package/build/util/throttle.js +19 -0
- package/build/util/validatedDebounce.d.ts +3 -0
- package/build/util/validatedDebounce.js +18 -0
- package/build/widgets/AccessorBindings.spec.d.ts +1 -0
- package/build/widgets/AccessorBindings.spec.js +40 -0
- package/build/widgets/Button.d.ts +57 -0
- package/build/widgets/Button.js +105 -0
- package/build/widgets/CxCredit.d.ts +11 -0
- package/build/widgets/CxCredit.js +25 -0
- package/build/widgets/DocumentTitle.d.ts +27 -0
- package/build/widgets/DocumentTitle.js +57 -0
- package/build/widgets/FlexBox.d.ts +79 -0
- package/build/widgets/FlexBox.js +77 -0
- package/build/widgets/Heading.d.ts +16 -0
- package/build/widgets/Heading.js +24 -0
- package/build/widgets/HighlightedSearchText.d.ts +18 -0
- package/build/widgets/HighlightedSearchText.js +32 -0
- package/build/widgets/HtmlElement.d.ts +46 -0
- package/build/widgets/HtmlElement.js +253 -0
- package/build/widgets/HtmlElement.spec.d.ts +1 -0
- package/build/widgets/HtmlElement.spec.js +38 -0
- package/build/widgets/Icon.d.ts +29 -0
- package/build/widgets/Icon.js +39 -0
- package/build/widgets/List.d.ts +122 -0
- package/build/widgets/List.js +510 -0
- package/build/widgets/ProgressBar.d.ts +20 -0
- package/build/widgets/ProgressBar.js +29 -0
- package/build/widgets/Resizer.d.ts +30 -0
- package/build/widgets/Resizer.js +111 -0
- package/build/widgets/Sandbox.d.ts +40 -0
- package/build/widgets/Sandbox.js +54 -0
- package/build/widgets/Section.d.ts +52 -0
- package/build/widgets/Section.js +93 -0
- package/build/widgets/autoFocus.d.ts +1 -0
- package/build/widgets/autoFocus.js +9 -0
- package/build/widgets/cx.d.ts +2 -0
- package/build/widgets/cx.js +53 -0
- package/build/widgets/drag-drop/DragHandle.d.ts +12 -0
- package/build/widgets/drag-drop/DragHandle.js +23 -0
- package/build/widgets/drag-drop/DragSource.d.ts +55 -0
- package/build/widgets/drag-drop/DragSource.js +135 -0
- package/build/widgets/drag-drop/DropZone.d.ts +103 -0
- package/build/widgets/drag-drop/DropZone.js +173 -0
- package/build/widgets/drag-drop/index.d.ts +4 -0
- package/build/widgets/drag-drop/index.js +4 -0
- package/build/widgets/drag-drop/ops.d.ts +55 -0
- package/build/widgets/drag-drop/ops.js +292 -0
- package/build/widgets/enableAllInternalDependencies.d.ts +1 -0
- package/build/widgets/enableAllInternalDependencies.js +10 -0
- package/build/widgets/form/Calendar.d.ts +130 -0
- package/build/widgets/form/Calendar.js +445 -0
- package/build/widgets/form/Checkbox.d.ts +46 -0
- package/build/widgets/form/Checkbox.js +157 -0
- package/build/widgets/form/ColorField.d.ts +49 -0
- package/build/widgets/form/ColorField.js +310 -0
- package/build/widgets/form/ColorPicker.d.ts +46 -0
- package/build/widgets/form/ColorPicker.js +304 -0
- package/build/widgets/form/DateField.d.ts +8 -0
- package/build/widgets/form/DateField.js +12 -0
- package/build/widgets/form/DateTimeField.d.ts +98 -0
- package/build/widgets/form/DateTimeField.js +474 -0
- package/build/widgets/form/DateTimePicker.d.ts +17 -0
- package/build/widgets/form/DateTimePicker.js +248 -0
- package/build/widgets/form/Field.d.ts +140 -0
- package/build/widgets/form/Field.js +369 -0
- package/build/widgets/form/FieldGroup.d.ts +5 -0
- package/build/widgets/form/FieldGroup.js +5 -0
- package/build/widgets/form/FieldIcon.d.ts +22 -0
- package/build/widgets/form/FieldIcon.js +41 -0
- package/build/widgets/form/HelpText.d.ts +6 -0
- package/build/widgets/form/HelpText.js +10 -0
- package/build/widgets/form/Label.d.ts +27 -0
- package/build/widgets/form/Label.js +74 -0
- package/build/widgets/form/LabeledContainer.d.ts +30 -0
- package/build/widgets/form/LabeledContainer.js +48 -0
- package/build/widgets/form/LookupField.d.ts +124 -0
- package/build/widgets/form/LookupField.js +907 -0
- package/build/widgets/form/MonthField.d.ts +104 -0
- package/build/widgets/form/MonthField.js +423 -0
- package/build/widgets/form/MonthPicker.d.ts +125 -0
- package/build/widgets/form/MonthPicker.js +557 -0
- package/build/widgets/form/NumberField.d.ts +63 -0
- package/build/widgets/form/NumberField.js +361 -0
- package/build/widgets/form/Radio.d.ts +43 -0
- package/build/widgets/form/Radio.js +131 -0
- package/build/widgets/form/Select.d.ts +40 -0
- package/build/widgets/form/Select.js +183 -0
- package/build/widgets/form/Slider.d.ts +68 -0
- package/build/widgets/form/Slider.js +264 -0
- package/build/widgets/form/Switch.d.ts +41 -0
- package/build/widgets/form/Switch.js +94 -0
- package/build/widgets/form/TextArea.d.ts +20 -0
- package/build/widgets/form/TextArea.js +128 -0
- package/build/widgets/form/TextField.d.ts +49 -0
- package/build/widgets/form/TextField.js +202 -0
- package/build/widgets/form/TimeField.d.ts +3 -0
- package/build/widgets/form/TimeField.js +8 -0
- package/build/widgets/form/TimeList.d.ts +1 -0
- package/build/widgets/form/TimeList.js +89 -0
- package/build/widgets/form/UploadButton.d.ts +17 -0
- package/build/widgets/form/UploadButton.js +163 -0
- package/build/widgets/form/ValidationError.d.ts +27 -0
- package/build/widgets/form/ValidationError.js +33 -0
- package/build/widgets/form/ValidationGroup.d.ts +63 -0
- package/build/widgets/form/ValidationGroup.js +58 -0
- package/build/widgets/form/ValidationGroup.spec.d.ts +1 -0
- package/build/widgets/form/ValidationGroup.spec.js +62 -0
- package/build/widgets/form/Validator.d.ts +8 -0
- package/build/widgets/form/Validator.js +19 -0
- package/build/widgets/form/Wheel.d.ts +61 -0
- package/build/widgets/form/Wheel.js +178 -0
- package/build/widgets/form/index.d.ts +28 -0
- package/build/widgets/form/index.js +28 -0
- package/build/widgets/grid/Grid.d.ts +517 -0
- package/build/widgets/grid/Grid.js +2756 -0
- package/build/widgets/grid/GridCell.d.ts +68 -0
- package/build/widgets/grid/GridCell.js +61 -0
- package/build/widgets/grid/GridCellEditor.d.ts +10 -0
- package/build/widgets/grid/GridCellEditor.js +29 -0
- package/build/widgets/grid/GridRow.d.ts +87 -0
- package/build/widgets/grid/GridRow.js +192 -0
- package/build/widgets/grid/GridRowLine.d.ts +27 -0
- package/build/widgets/grid/GridRowLine.js +24 -0
- package/build/widgets/grid/Pagination.d.ts +23 -0
- package/build/widgets/grid/Pagination.js +73 -0
- package/build/widgets/grid/TreeNode.d.ts +42 -0
- package/build/widgets/grid/TreeNode.js +82 -0
- package/build/widgets/grid/createGridCellEditor.d.ts +2 -0
- package/build/widgets/grid/createGridCellEditor.js +6 -0
- package/build/widgets/grid/index.d.ts +10 -0
- package/build/widgets/grid/index.js +10 -0
- package/build/widgets/icons/calendar.d.ts +2 -0
- package/build/widgets/icons/calendar.js +5 -0
- package/build/widgets/icons/check.d.ts +2 -0
- package/build/widgets/icons/check.js +5 -0
- package/build/widgets/icons/clear.d.ts +2 -0
- package/build/widgets/icons/clear.js +5 -0
- package/build/widgets/icons/close.d.ts +2 -0
- package/build/widgets/icons/close.js +5 -0
- package/build/widgets/icons/cx.d.ts +2 -0
- package/build/widgets/icons/cx.js +5 -0
- package/build/widgets/icons/drop-down.d.ts +2 -0
- package/build/widgets/icons/drop-down.js +5 -0
- package/build/widgets/icons/file.d.ts +2 -0
- package/build/widgets/icons/file.js +5 -0
- package/build/widgets/icons/folder-open.d.ts +2 -0
- package/build/widgets/icons/folder-open.js +5 -0
- package/build/widgets/icons/folder.d.ts +2 -0
- package/build/widgets/icons/folder.js +5 -0
- package/build/widgets/icons/forward.d.ts +2 -0
- package/build/widgets/icons/forward.js +5 -0
- package/build/widgets/icons/index.d.ts +12 -0
- package/build/widgets/icons/index.js +12 -0
- package/build/widgets/icons/loading.d.ts +2 -0
- package/build/widgets/icons/loading.js +14 -0
- package/build/widgets/icons/menu.d.ts +2 -0
- package/build/widgets/icons/menu.js +5 -0
- package/build/widgets/icons/pixel-picker.d.ts +2 -0
- package/build/widgets/icons/pixel-picker.js +5 -0
- package/build/widgets/icons/registry.d.ts +9 -0
- package/build/widgets/icons/registry.js +40 -0
- package/build/widgets/icons/search.d.ts +2 -0
- package/build/widgets/icons/search.js +5 -0
- package/build/widgets/icons/sort-asc.d.ts +2 -0
- package/build/widgets/icons/sort-asc.js +5 -0
- package/build/widgets/icons/square.d.ts +2 -0
- package/build/widgets/icons/square.js +5 -0
- package/build/widgets/index.d.ts +36 -0
- package/build/widgets/index.js +37 -0
- package/build/widgets/nav/Link.d.ts +6 -0
- package/build/widgets/nav/Link.js +6 -0
- package/build/widgets/nav/LinkButton.d.ts +45 -0
- package/build/widgets/nav/LinkButton.js +110 -0
- package/build/widgets/nav/Menu.d.ts +48 -0
- package/build/widgets/nav/Menu.js +336 -0
- package/build/widgets/nav/MenuItem.d.ts +68 -0
- package/build/widgets/nav/MenuItem.js +364 -0
- package/build/widgets/nav/MenuSpacer.d.ts +13 -0
- package/build/widgets/nav/MenuSpacer.js +11 -0
- package/build/widgets/nav/RedirectRoute.d.ts +14 -0
- package/build/widgets/nav/RedirectRoute.js +30 -0
- package/build/widgets/nav/Route.d.ts +40 -0
- package/build/widgets/nav/Route.js +94 -0
- package/build/widgets/nav/Route.spec.d.ts +1 -0
- package/build/widgets/nav/Route.spec.js +15 -0
- package/build/widgets/nav/Scroller.d.ts +55 -0
- package/build/widgets/nav/Scroller.js +125 -0
- package/build/widgets/nav/Submenu.d.ts +3 -0
- package/build/widgets/nav/Submenu.js +3 -0
- package/build/widgets/nav/Tab.d.ts +40 -0
- package/build/widgets/nav/Tab.js +66 -0
- package/build/widgets/nav/index.d.ts +10 -0
- package/build/widgets/nav/index.js +10 -0
- package/build/widgets/overlay/ContextMenu.d.ts +9 -0
- package/build/widgets/overlay/ContextMenu.js +31 -0
- package/build/widgets/overlay/Dropdown.d.ts +120 -0
- package/build/widgets/overlay/Dropdown.js +522 -0
- package/build/widgets/overlay/FlyweightTooltipTracker.d.ts +22 -0
- package/build/widgets/overlay/FlyweightTooltipTracker.js +39 -0
- package/build/widgets/overlay/MsgBox.d.ts +25 -0
- package/build/widgets/overlay/MsgBox.js +67 -0
- package/build/widgets/overlay/Overlay.d.ts +183 -0
- package/build/widgets/overlay/Overlay.js +597 -0
- package/build/widgets/overlay/Toast.d.ts +27 -0
- package/build/widgets/overlay/Toast.js +76 -0
- package/build/widgets/overlay/Tooltip.d.ts +55 -0
- package/build/widgets/overlay/Tooltip.js +307 -0
- package/build/widgets/overlay/Window.d.ts +65 -0
- package/build/widgets/overlay/Window.js +154 -0
- package/build/widgets/overlay/alerts.d.ts +12 -0
- package/build/widgets/overlay/alerts.js +31 -0
- package/build/widgets/overlay/captureMouse.d.ts +57 -0
- package/build/widgets/overlay/captureMouse.js +147 -0
- package/build/widgets/overlay/createHotPromiseWindowFactory.d.ts +10 -0
- package/build/widgets/overlay/createHotPromiseWindowFactory.js +54 -0
- package/build/widgets/overlay/index.d.ts +11 -0
- package/build/widgets/overlay/index.js +11 -0
- package/build/widgets/overlay/tooltip-ops.d.ts +73 -0
- package/build/widgets/overlay/tooltip-ops.js +34 -0
- package/dist/manifest.js +844 -844
- package/dist/util.js +0 -1
- package/dist/widgets.js +1 -2
- package/package.json +3 -2
package/build/ui/Text.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Widget } from './Widget';
|
|
2
|
+
export class Text extends Widget {
|
|
3
|
+
init() {
|
|
4
|
+
if (!this.value && (this.tpl || this.expr || this.bind))
|
|
5
|
+
this.value = {
|
|
6
|
+
tpl: this.tpl,
|
|
7
|
+
expr: this.expr,
|
|
8
|
+
bind: this.bind
|
|
9
|
+
};
|
|
10
|
+
super.init();
|
|
11
|
+
}
|
|
12
|
+
declareData(...args) {
|
|
13
|
+
super.declareData({
|
|
14
|
+
value: undefined
|
|
15
|
+
}, ...args);
|
|
16
|
+
}
|
|
17
|
+
render(context, { data }, key) {
|
|
18
|
+
return data.value != null ? data.value : '';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
Widget.alias('text', Text);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import type { Component } from "react";
|
|
3
|
+
import type { unstable_batchedUpdates, render, findDOMNode, createPortal, unstable_renderSubtreeIntoContainer, hydrate, unmountComponentAtNode } from "react-dom";
|
|
4
|
+
import type { createRoot, hydrateRoot } from "react-dom/client";
|
|
5
|
+
export interface VDOMType extends Omit<typeof React, "default"> {
|
|
6
|
+
allowRenderOutputCaching?: boolean;
|
|
7
|
+
Component: typeof Component;
|
|
8
|
+
DOM: {
|
|
9
|
+
unstable_batchedUpdates: typeof unstable_batchedUpdates;
|
|
10
|
+
render: typeof render;
|
|
11
|
+
findDOMNode: typeof findDOMNode;
|
|
12
|
+
createPortal: typeof createPortal;
|
|
13
|
+
createRoot: typeof createRoot;
|
|
14
|
+
hydrateRoot: typeof hydrateRoot;
|
|
15
|
+
hydrate: typeof hydrate;
|
|
16
|
+
unmountComponentAtNode: typeof unmountComponentAtNode;
|
|
17
|
+
unstable_renderSubtreeIntoContainer: typeof unstable_renderSubtreeIntoContainer;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare const VDOM: VDOMType;
|
package/build/ui/VDOM.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { StructuredSelector } from "../data/StructuredSelector";
|
|
2
|
+
import { Component, CreateConfig } from "../util/Component";
|
|
3
|
+
import { CSS } from "./CSS";
|
|
4
|
+
import { RenderingContext } from "./RenderingContext";
|
|
5
|
+
import type { Controller, ControllerConfig, ControllerFactory } from "./Controller";
|
|
6
|
+
import { BooleanProp, ClassProp, ModProp, StyleProp } from "./Prop";
|
|
7
|
+
import { Instance } from "./Instance";
|
|
8
|
+
export declare const VDOM: import("./VDOM").VDOMType;
|
|
9
|
+
export type ControllerProp = CreateConfig<typeof Controller> | (ControllerConfig & {
|
|
10
|
+
type?: never;
|
|
11
|
+
$type?: never;
|
|
12
|
+
}) | ControllerFactory;
|
|
13
|
+
export interface WidgetConfig {
|
|
14
|
+
/** Visibility of the widget. Defaults to `true`. */
|
|
15
|
+
visible?: BooleanProp;
|
|
16
|
+
/** Visibility of the widget. Defaults to `true`. */
|
|
17
|
+
if?: BooleanProp;
|
|
18
|
+
/** Outer (wrapper) layout used to display the widget in. */
|
|
19
|
+
outerLayout?: unknown;
|
|
20
|
+
/** Inner layout used to display children inside the widget. */
|
|
21
|
+
layout?: unknown;
|
|
22
|
+
/** Name of the ContentPlaceholder that should be used to display the widget. */
|
|
23
|
+
contentFor?: string;
|
|
24
|
+
/** Name of the ContentPlaceholder that should be used to display the widget. */
|
|
25
|
+
putInto?: string;
|
|
26
|
+
/** Key that will be used as the key when rendering the React component. */
|
|
27
|
+
vdomKey?: string;
|
|
28
|
+
/** Controller. */
|
|
29
|
+
controller?: ControllerProp;
|
|
30
|
+
onInit?(context: RenderingContext): void;
|
|
31
|
+
onExplore?(context: RenderingContext, instance: Instance): void;
|
|
32
|
+
onPrepare?(context: RenderingContext, instance: Instance): void;
|
|
33
|
+
onCleanup?(context: RenderingContext, instance: Instance): void;
|
|
34
|
+
onDestroy?(instance: Instance): void;
|
|
35
|
+
}
|
|
36
|
+
/** Style-related config properties for widgets that support styling. */
|
|
37
|
+
export interface WidgetStyleConfig {
|
|
38
|
+
/**
|
|
39
|
+
* Additional CSS classes to be applied to the element.
|
|
40
|
+
* If an object is provided, all keys with a "truthy" value will be added to the CSS class list.
|
|
41
|
+
*/
|
|
42
|
+
class?: ClassProp;
|
|
43
|
+
/**
|
|
44
|
+
* Additional CSS classes to be applied to the element.
|
|
45
|
+
* If an object is provided, all keys with a "truthy" value will be added to the CSS class list.
|
|
46
|
+
*/
|
|
47
|
+
className?: ClassProp;
|
|
48
|
+
/** Style object applied to the element. */
|
|
49
|
+
style?: StyleProp;
|
|
50
|
+
/** Style object applied to the element. */
|
|
51
|
+
styles?: StyleProp;
|
|
52
|
+
/** Base CSS class to be applied to the element. For example, value 'button' will add a class 'cxb-button' to the element. */
|
|
53
|
+
baseClass?: string;
|
|
54
|
+
/** Appearance modifier. For example, mod="big" will add the CSS class .cxm-big to the block element. */
|
|
55
|
+
mod?: ModProp;
|
|
56
|
+
}
|
|
57
|
+
export declare abstract class Widget<Config extends WidgetConfig = WidgetConfig, InstanceType extends Instance = Instance> extends Component {
|
|
58
|
+
vdomKey?: string | number;
|
|
59
|
+
jsxSpread?: Record<string, any>[];
|
|
60
|
+
jsxAttributes?: string[];
|
|
61
|
+
styles?: any;
|
|
62
|
+
style?: any;
|
|
63
|
+
styled: boolean;
|
|
64
|
+
if?: any;
|
|
65
|
+
visible: boolean;
|
|
66
|
+
outerLayout?: Widget;
|
|
67
|
+
contentFor?: string;
|
|
68
|
+
putInto?: string;
|
|
69
|
+
isContent?: boolean;
|
|
70
|
+
CSS: typeof CSS;
|
|
71
|
+
baseClass?: string;
|
|
72
|
+
memoize: boolean;
|
|
73
|
+
controller?: Controller;
|
|
74
|
+
isPureContainer?: boolean;
|
|
75
|
+
useParentLayout?: boolean;
|
|
76
|
+
widgetId?: number;
|
|
77
|
+
initialized?: boolean;
|
|
78
|
+
components?: Record<string, any>;
|
|
79
|
+
helpers?: Record<string, any>;
|
|
80
|
+
selector?: StructuredSelector;
|
|
81
|
+
nameMap?: any;
|
|
82
|
+
version?: number;
|
|
83
|
+
onInit?: (context: RenderingContext, instance: Instance) => void;
|
|
84
|
+
onExplore?: (context: RenderingContext, instance: Instance) => void;
|
|
85
|
+
onPrepare?: (context: RenderingContext, instance: Instance) => void;
|
|
86
|
+
onCleanup?: (context: RenderingContext, instance: Instance) => void;
|
|
87
|
+
onDestroy?: (instance: Instance) => void;
|
|
88
|
+
exploreCleanup?(context: RenderingContext, instance: InstanceType): void;
|
|
89
|
+
prepareCleanup?(context: RenderingContext, instance: InstanceType): void;
|
|
90
|
+
cleanup?(context: RenderingContext, instance: InstanceType): void;
|
|
91
|
+
prepare?(context: RenderingContext, instance: InstanceType): void;
|
|
92
|
+
static optimizePrepare?: boolean;
|
|
93
|
+
constructor(config?: Config);
|
|
94
|
+
init(): void;
|
|
95
|
+
protected initComponents(...args: Record<string, any>[]): void;
|
|
96
|
+
protected initHelpers(...args: Record<string, any>[]): void;
|
|
97
|
+
protected declareData(...args: Record<string, any>[]): void;
|
|
98
|
+
protected prepareCSS(_context: RenderingContext, { data }: any): void;
|
|
99
|
+
prepareData(context: RenderingContext, instance: InstanceType): void;
|
|
100
|
+
initInstance(_context: RenderingContext, _instance: InstanceType): void;
|
|
101
|
+
initState(_context: RenderingContext, _instance: InstanceType): void;
|
|
102
|
+
checkVisible(_context: RenderingContext, _instance: InstanceType, data: any): boolean;
|
|
103
|
+
explore(context: RenderingContext, instance: InstanceType, data?: any): void;
|
|
104
|
+
render(context: RenderingContext, instance: InstanceType, key: string): any;
|
|
105
|
+
update(): void;
|
|
106
|
+
applyParentStore(instance: any): void;
|
|
107
|
+
static resetCounter(): void;
|
|
108
|
+
}
|
|
109
|
+
export declare function contentAppend(result: any[], w: any, prependSpace?: boolean): boolean;
|
|
110
|
+
export declare function getContentArray(x: any): any[];
|
|
111
|
+
export declare function getContent(x: any): any;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { StructuredSelector } from "../data/StructuredSelector";
|
|
2
|
+
import { Component } from "../util/Component";
|
|
3
|
+
import { Console } from "../util/Console";
|
|
4
|
+
import { isArray } from "../util/isArray";
|
|
5
|
+
import { isDefined } from "../util/isDefined";
|
|
6
|
+
import { isString } from "../util/isString";
|
|
7
|
+
import { parseStyle } from "../util/parseStyle";
|
|
8
|
+
import { CSS } from "./CSS";
|
|
9
|
+
import { CSSHelper } from "./CSSHelper";
|
|
10
|
+
import { VDOM as vdom } from "./VDOM";
|
|
11
|
+
export const VDOM = vdom;
|
|
12
|
+
let widgetId = 100;
|
|
13
|
+
export class Widget extends Component {
|
|
14
|
+
// runtime values
|
|
15
|
+
widgetId;
|
|
16
|
+
initialized;
|
|
17
|
+
components;
|
|
18
|
+
helpers;
|
|
19
|
+
selector;
|
|
20
|
+
nameMap;
|
|
21
|
+
version;
|
|
22
|
+
static optimizePrepare;
|
|
23
|
+
constructor(config) {
|
|
24
|
+
super(config);
|
|
25
|
+
this.widgetId = widgetId++;
|
|
26
|
+
if (isArray(this.jsxSpread)) {
|
|
27
|
+
if (!this.jsxAttributes)
|
|
28
|
+
this.jsxAttributes = [];
|
|
29
|
+
this.jsxSpread.forEach((spread) => {
|
|
30
|
+
for (const key in spread) {
|
|
31
|
+
this[key] = spread[key];
|
|
32
|
+
this.jsxAttributes.push(key);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
init() {
|
|
38
|
+
if (this.styles)
|
|
39
|
+
this.style = this.styles;
|
|
40
|
+
if (this.styled)
|
|
41
|
+
this.style = parseStyle(this.style);
|
|
42
|
+
else if (this.style) {
|
|
43
|
+
Console.warn("Components that allow use of the style attribute should set styled = true on their prototype. This will be an error in future versions.");
|
|
44
|
+
this.style = parseStyle(this.style);
|
|
45
|
+
this.styled = true;
|
|
46
|
+
}
|
|
47
|
+
if (typeof this.if !== "undefined")
|
|
48
|
+
this.visible = this.if;
|
|
49
|
+
this.declareData();
|
|
50
|
+
if (this.outerLayout) {
|
|
51
|
+
if (isArray(this.outerLayout))
|
|
52
|
+
throw new Error("Only single element outer layout is supported.");
|
|
53
|
+
//TODO: better handle the case when outer layout is an array. How to get around circular dependency to PureContainer
|
|
54
|
+
this.outerLayout = Widget.create(this.outerLayout, {});
|
|
55
|
+
}
|
|
56
|
+
if (this.contentFor)
|
|
57
|
+
this.putInto = this.contentFor;
|
|
58
|
+
if (this.putInto)
|
|
59
|
+
this.isContent = true;
|
|
60
|
+
if (isString(this.CSS))
|
|
61
|
+
this.CSS = CSSHelper.get(this.CSS);
|
|
62
|
+
this.initHelpers();
|
|
63
|
+
this.initComponents();
|
|
64
|
+
this.initialized = true;
|
|
65
|
+
}
|
|
66
|
+
initComponents(...args) {
|
|
67
|
+
if (args.length > 0) {
|
|
68
|
+
this.components = Object.assign({}, ...args);
|
|
69
|
+
for (const k in this.components) {
|
|
70
|
+
if (!this.components[k])
|
|
71
|
+
delete this.components[k];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
initHelpers(...args) {
|
|
76
|
+
if (args.length > 0) {
|
|
77
|
+
this.helpers = Object.assign({}, ...args);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
declareData(...args) {
|
|
81
|
+
const options = {};
|
|
82
|
+
if (this.styled) {
|
|
83
|
+
options.class = options.className = options.style = { structured: true };
|
|
84
|
+
}
|
|
85
|
+
const props = {
|
|
86
|
+
visible: undefined,
|
|
87
|
+
mod: {
|
|
88
|
+
structured: true,
|
|
89
|
+
},
|
|
90
|
+
...options,
|
|
91
|
+
};
|
|
92
|
+
Object.assign(props, ...args);
|
|
93
|
+
this.selector = new StructuredSelector({ props: props, values: this });
|
|
94
|
+
this.nameMap = this.selector.nameMap;
|
|
95
|
+
}
|
|
96
|
+
prepareCSS(_context, { data }) {
|
|
97
|
+
data.classNames = this.CSS.expand(this.CSS.block(this.baseClass, data.mod, data.stateMods), data.class, data.className);
|
|
98
|
+
data.style = parseStyle(data.style);
|
|
99
|
+
}
|
|
100
|
+
prepareData(context, instance) {
|
|
101
|
+
if (this.styled)
|
|
102
|
+
this.prepareCSS(context, instance);
|
|
103
|
+
}
|
|
104
|
+
initInstance(_context, _instance) { }
|
|
105
|
+
initState(_context, _instance) { }
|
|
106
|
+
checkVisible(_context, _instance, data) {
|
|
107
|
+
return data.visible;
|
|
108
|
+
}
|
|
109
|
+
explore(context, instance, data) {
|
|
110
|
+
if (this.components) {
|
|
111
|
+
instance.components = {};
|
|
112
|
+
for (const cmp in this.components) {
|
|
113
|
+
const ins = instance.getChild(context, this.components[cmp], "cmp-" + cmp, instance.store);
|
|
114
|
+
if (ins.scheduleExploreIfVisible(context))
|
|
115
|
+
instance.components[cmp] = ins;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
render(context, instance, key) {
|
|
120
|
+
Console.log(this);
|
|
121
|
+
throw new Error('Widget\'s render method should be overridden. This error usually happens if with incorrect imports, i.e. import { TextField } from "cx/data". Please check the console for details about the component configuration.');
|
|
122
|
+
}
|
|
123
|
+
update() {
|
|
124
|
+
this.version = (this.version || 0) + 1;
|
|
125
|
+
}
|
|
126
|
+
applyParentStore(instance) {
|
|
127
|
+
instance.store = instance.parentStore;
|
|
128
|
+
// check when this is actually needed, perhaps this is needed only for tables and repeated elements
|
|
129
|
+
// if (instance.cached) delete instance.cached.rawData; // force prepareData to execute again
|
|
130
|
+
}
|
|
131
|
+
static resetCounter() {
|
|
132
|
+
widgetId = 100;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
Widget.prototype.visible = true;
|
|
136
|
+
Widget.prototype.memoize = true; //cache rendered content and use it if possible
|
|
137
|
+
Widget.prototype.CSS = CSS;
|
|
138
|
+
Widget.prototype.styled = false;
|
|
139
|
+
Widget.namespace = "ui.";
|
|
140
|
+
Widget.optimizePrepare = true;
|
|
141
|
+
Widget.factory = (type, _config, _more) => {
|
|
142
|
+
throw new Error(`Invalid widget type: ${type}.`);
|
|
143
|
+
};
|
|
144
|
+
export function contentAppend(result, w, prependSpace) {
|
|
145
|
+
if (w == null || w === false)
|
|
146
|
+
return false;
|
|
147
|
+
if (isArray(w))
|
|
148
|
+
w.forEach((c) => contentAppend(result, c));
|
|
149
|
+
else if (isDefined(w.content) && !w.atomic)
|
|
150
|
+
return contentAppend(result, w.content, false);
|
|
151
|
+
else {
|
|
152
|
+
if (prependSpace)
|
|
153
|
+
result.push(" ");
|
|
154
|
+
result.push(w);
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
export function getContentArray(x) {
|
|
159
|
+
let result = [];
|
|
160
|
+
contentAppend(result, x, false);
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
export function getContent(x) {
|
|
164
|
+
let result = getContentArray(x);
|
|
165
|
+
if (result.length == 0)
|
|
166
|
+
return null;
|
|
167
|
+
if (result.length == 1)
|
|
168
|
+
return result[0];
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { DataAdapter, DataAdapterRecord, DataAdapterConfig } from "./DataAdapter";
|
|
2
|
+
import { Accessor } from "../../data/getAccessor";
|
|
3
|
+
import { RenderingContext } from "../RenderingContext";
|
|
4
|
+
import { Instance } from "../Instance";
|
|
5
|
+
import { View } from "../../data/View";
|
|
6
|
+
import { Prop, Sorter, CollatorOptions } from "../Prop";
|
|
7
|
+
export interface RecordStoreCache {
|
|
8
|
+
recordStoreCache: WeakMap<any, View>;
|
|
9
|
+
cacheByKey: Record<string | number, View>;
|
|
10
|
+
recordsAccessor?: Accessor;
|
|
11
|
+
}
|
|
12
|
+
export interface ArrayAdapterConfig extends DataAdapterConfig {
|
|
13
|
+
recordsBinding?: Prop<any[]>;
|
|
14
|
+
recordsAccessor?: Accessor | string;
|
|
15
|
+
keyField?: string;
|
|
16
|
+
cacheByKeyField?: boolean;
|
|
17
|
+
sortOptions?: CollatorOptions;
|
|
18
|
+
preserveOrder?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ExtendedSorter extends Sorter {
|
|
21
|
+
comparer?: (a: any, b: any) => number;
|
|
22
|
+
sortOptions?: CollatorOptions;
|
|
23
|
+
}
|
|
24
|
+
export interface ResolvedSorter {
|
|
25
|
+
getter: (x: any) => any;
|
|
26
|
+
factor: number;
|
|
27
|
+
compare: (a: any, b: any) => number;
|
|
28
|
+
}
|
|
29
|
+
export declare class ArrayAdapter<T = any> extends DataAdapter<T> {
|
|
30
|
+
recordsAccessor: Accessor;
|
|
31
|
+
recordsBinding?: Prop<T[]>;
|
|
32
|
+
keyField: string | null;
|
|
33
|
+
cacheByKeyField: boolean;
|
|
34
|
+
sortOptions?: CollatorOptions;
|
|
35
|
+
preserveOrder?: boolean;
|
|
36
|
+
isTreeAdapter: boolean;
|
|
37
|
+
protected sorter?: (data: DataAdapterRecord<T>[]) => DataAdapterRecord<T>[];
|
|
38
|
+
constructor(config?: ArrayAdapterConfig);
|
|
39
|
+
init(): void;
|
|
40
|
+
initInstance(context: RenderingContext, instance: Instance & Partial<RecordStoreCache>): void;
|
|
41
|
+
getRecords(context: RenderingContext, instance: Instance & Partial<RecordStoreCache>, records: T[], parentStore: View): DataAdapterRecord<T>[];
|
|
42
|
+
mapRecords(context: RenderingContext, instance: Instance & Partial<RecordStoreCache>, records: T[], parentStore: View, recordsAccessor?: Accessor): DataAdapterRecord<T>[];
|
|
43
|
+
mapRecord(context: RenderingContext, instance: Instance & Partial<RecordStoreCache>, data: T, parentStore: View, recordsAccessor: Accessor | undefined, index: number): DataAdapterRecord<T>;
|
|
44
|
+
setFilter(filterFn?: (data: T) => boolean): void;
|
|
45
|
+
getComparer(sortOptions?: CollatorOptions): ((a: any, b: any) => number) | undefined;
|
|
46
|
+
buildSorter(sorters: ExtendedSorter[]): void;
|
|
47
|
+
sort(sorters?: Sorter[] | ExtendedSorter[]): void;
|
|
48
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { DataAdapter } from "./DataAdapter";
|
|
2
|
+
import { ReadOnlyDataView } from "../../data/ReadOnlyDataView";
|
|
3
|
+
import { sorter } from "../../data/comparer";
|
|
4
|
+
import { isArray } from "../../util/isArray";
|
|
5
|
+
import { ArrayElementView } from "../../data/ArrayElementView";
|
|
6
|
+
import { getAccessor } from "../../data/getAccessor";
|
|
7
|
+
import { Culture } from "../Culture";
|
|
8
|
+
import { isDefined, isObject } from "../../util";
|
|
9
|
+
export class ArrayAdapter extends DataAdapter {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super(config);
|
|
12
|
+
}
|
|
13
|
+
init() {
|
|
14
|
+
this.recordsAccessor = getAccessor(this.recordsBinding ?? this.recordsAccessor);
|
|
15
|
+
this.recordName = this.recordName?.toString() || "$record";
|
|
16
|
+
this.indexName = this.indexName?.toString() || "$index";
|
|
17
|
+
}
|
|
18
|
+
initInstance(context, instance) {
|
|
19
|
+
if (!instance.recordStoreCache) {
|
|
20
|
+
instance.recordStoreCache = new WeakMap();
|
|
21
|
+
instance.cacheByKey = {};
|
|
22
|
+
}
|
|
23
|
+
if (!instance.recordsAccessor && this.recordsAccessor) {
|
|
24
|
+
instance.recordsAccessor = this.recordsAccessor.bindInstance
|
|
25
|
+
? this.recordsAccessor.bindInstance(instance)
|
|
26
|
+
: this.recordsAccessor;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
getRecords(context, instance, records, parentStore) {
|
|
30
|
+
if (!instance.recordStoreCache) {
|
|
31
|
+
this.initInstance(context, instance);
|
|
32
|
+
}
|
|
33
|
+
return this.mapRecords(context, instance, records, parentStore, instance.recordsAccessor);
|
|
34
|
+
}
|
|
35
|
+
mapRecords(context, instance, records, parentStore, recordsAccessor) {
|
|
36
|
+
let result = [];
|
|
37
|
+
if (!instance.recordStoreCache) {
|
|
38
|
+
this.initInstance(context, instance);
|
|
39
|
+
}
|
|
40
|
+
if (isArray(records)) {
|
|
41
|
+
records.forEach((data, index) => {
|
|
42
|
+
if (this.filterFn && !this.filterFn(data))
|
|
43
|
+
return;
|
|
44
|
+
const record = this.mapRecord(context, instance, data, parentStore, recordsAccessor, index);
|
|
45
|
+
result.push(record);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (this.sorter && !this.preserveOrder) {
|
|
49
|
+
result = this.sorter(result);
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
mapRecord(context, instance, data, parentStore, recordsAccessor, index) {
|
|
54
|
+
const key = this.cacheByKeyField && this.keyField && isObject(data) ? data[this.keyField] : null;
|
|
55
|
+
let recordStore = key != null ? instance.cacheByKey[key] : instance.recordStoreCache.get(data);
|
|
56
|
+
if (recordsAccessor) {
|
|
57
|
+
if (!recordStore) {
|
|
58
|
+
recordStore = new ArrayElementView({
|
|
59
|
+
store: parentStore,
|
|
60
|
+
arrayAccessor: recordsAccessor,
|
|
61
|
+
itemIndex: index,
|
|
62
|
+
recordAlias: this.recordName,
|
|
63
|
+
indexAlias: this.indexName,
|
|
64
|
+
immutable: this.immutable,
|
|
65
|
+
sealed: this.sealed,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
recordStore.setStore(parentStore);
|
|
70
|
+
recordStore.setIndex(index);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
if (!recordStore) {
|
|
75
|
+
recordStore = new ReadOnlyDataView({
|
|
76
|
+
store: parentStore,
|
|
77
|
+
data: {
|
|
78
|
+
[this.recordName]: data,
|
|
79
|
+
[this.indexName]: index,
|
|
80
|
+
},
|
|
81
|
+
immutable: this.immutable,
|
|
82
|
+
sealed: this.sealed,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
recordStore.setStore(parentStore);
|
|
87
|
+
recordStore.setData(data);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (key != null) {
|
|
91
|
+
instance.cacheByKey[key] = recordStore;
|
|
92
|
+
}
|
|
93
|
+
else if (isObject(data)) {
|
|
94
|
+
instance.recordStoreCache.set(data, recordStore);
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
store: recordStore,
|
|
98
|
+
index: index,
|
|
99
|
+
data: data,
|
|
100
|
+
type: "data",
|
|
101
|
+
key: this.keyField && isObject(data) ? data[this.keyField] : index,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
setFilter(filterFn) {
|
|
105
|
+
this.filterFn = filterFn;
|
|
106
|
+
}
|
|
107
|
+
getComparer(sortOptions) {
|
|
108
|
+
return sortOptions ? Culture.getComparer(sortOptions) : undefined;
|
|
109
|
+
}
|
|
110
|
+
buildSorter(sorters) {
|
|
111
|
+
if (isArray(sorters) && sorters.length > 0) {
|
|
112
|
+
let dataAccessor;
|
|
113
|
+
let fieldValueMapper;
|
|
114
|
+
if (sorters.every((x) => x.field && x.value == null)) {
|
|
115
|
+
dataAccessor = (x) => x.data;
|
|
116
|
+
fieldValueMapper = (x) => ({ bind: x.field });
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
dataAccessor = (x) => x.store.getData();
|
|
120
|
+
fieldValueMapper = (x) => ({ bind: this.recordName + "." + x.field });
|
|
121
|
+
}
|
|
122
|
+
this.sorter = sorter(sorters.map((x) => {
|
|
123
|
+
const s = Object.assign({}, x);
|
|
124
|
+
if (s.field && s.value == null) {
|
|
125
|
+
s.value = fieldValueMapper(s);
|
|
126
|
+
}
|
|
127
|
+
if (!s.comparer) {
|
|
128
|
+
s.comparer = this.getComparer(isDefined(s.sortOptions) ? s.sortOptions : this.sortOptions);
|
|
129
|
+
}
|
|
130
|
+
return s;
|
|
131
|
+
}), dataAccessor);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
this.sorter = undefined;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
sort(sorters) {
|
|
138
|
+
if (sorters) {
|
|
139
|
+
this.buildSorter(sorters);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
ArrayAdapter.prototype.immutable = false;
|
|
144
|
+
ArrayAdapter.prototype.sealed = false;
|
|
145
|
+
ArrayAdapter.prototype.keyField = null;
|
|
146
|
+
ArrayAdapter.prototype.cacheByKeyField = true;
|
|
147
|
+
ArrayAdapter.prototype.isTreeAdapter = false;
|
|
148
|
+
ArrayAdapter.autoInit = true;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { RenderingContext } from "../RenderingContext";
|
|
2
|
+
import { Instance } from "../Instance";
|
|
3
|
+
import assert from "assert";
|
|
4
|
+
import { Store } from "../../data";
|
|
5
|
+
import { ArrayAdapter } from "./ArrayAdapter";
|
|
6
|
+
describe("ArrayAdapter", () => {
|
|
7
|
+
it("maps data into records", () => {
|
|
8
|
+
let adapter = new ArrayAdapter();
|
|
9
|
+
let data = [
|
|
10
|
+
{
|
|
11
|
+
id: 1,
|
|
12
|
+
text: "1",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 2,
|
|
16
|
+
text: "2",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
let store = new Store();
|
|
20
|
+
let records = adapter.mapRecords(new RenderingContext(), new Instance(null, "1", null, store), data, store);
|
|
21
|
+
assert.equal(records.length, 2);
|
|
22
|
+
assert.equal(records[0].data, records[0].store.get("$record"));
|
|
23
|
+
assert.equal(records[1].data, records[1].store.get("$record"));
|
|
24
|
+
});
|
|
25
|
+
it("can sort data", () => {
|
|
26
|
+
let adapter = new ArrayAdapter();
|
|
27
|
+
adapter.sort([{ field: "id", direction: "DESC" }]);
|
|
28
|
+
let data = [
|
|
29
|
+
{
|
|
30
|
+
id: 1,
|
|
31
|
+
text: "1",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 2,
|
|
35
|
+
text: "2",
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
let store = new Store();
|
|
39
|
+
let records = adapter.mapRecords(new RenderingContext(), new Instance(null, "1", null, store), data, store);
|
|
40
|
+
assert.equal(records.length, 2);
|
|
41
|
+
assert.equal(data[1], records[0].store.get("$record"));
|
|
42
|
+
assert.equal(data[0], records[1].store.get("$record"));
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component } from "../../util/Component";
|
|
2
|
+
import { Instance } from "../Instance";
|
|
3
|
+
import { View } from "../../data/View";
|
|
4
|
+
import { RenderingContext } from "../RenderingContext";
|
|
5
|
+
import { Sorter } from "../Prop";
|
|
6
|
+
export type DataAdapterRecordType = "data" | "group-header" | "group-footer";
|
|
7
|
+
export interface DataAdapterRecord<T = any> {
|
|
8
|
+
data: T;
|
|
9
|
+
index?: number;
|
|
10
|
+
key: string;
|
|
11
|
+
store: View;
|
|
12
|
+
type?: DataAdapterRecordType;
|
|
13
|
+
}
|
|
14
|
+
export interface DataAdapterConfig {
|
|
15
|
+
recordName?: string;
|
|
16
|
+
indexName?: string;
|
|
17
|
+
immutable?: boolean;
|
|
18
|
+
sealed?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare abstract class DataAdapter<T = any> extends Component {
|
|
21
|
+
recordName: string;
|
|
22
|
+
indexName: string;
|
|
23
|
+
immutable: boolean;
|
|
24
|
+
sealed?: boolean;
|
|
25
|
+
protected filterFn?: (data: T) => boolean;
|
|
26
|
+
constructor(config?: DataAdapterConfig);
|
|
27
|
+
abstract getRecords(context: RenderingContext, instance: Instance, records: T[], parentStore: View): DataAdapterRecord<T>[];
|
|
28
|
+
setFilter(filterFn?: (data: T) => boolean): void;
|
|
29
|
+
sort(sorters?: Sorter[]): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from "../../util/Component";
|
|
2
|
+
export class DataAdapter extends Component {
|
|
3
|
+
constructor(config) {
|
|
4
|
+
super(config);
|
|
5
|
+
}
|
|
6
|
+
setFilter(filterFn) {
|
|
7
|
+
this.filterFn = filterFn;
|
|
8
|
+
}
|
|
9
|
+
sort(sorters) { }
|
|
10
|
+
}
|
|
11
|
+
DataAdapter.prototype.recordName = "$record";
|
|
12
|
+
DataAdapter.prototype.indexName = "$index";
|
|
13
|
+
DataAdapter.prototype.immutable = false;
|