cx 25.10.1 → 26.0.1
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/.mocharc.json +5 -0
- package/LICENSE-THIRD-PARTY.md +91 -91
- package/LICENSE.md +7 -7
- package/README.md +46 -46
- package/build.js +129 -0
- package/dist/charts.css +250 -250
- package/dist/charts.js +2421 -3102
- package/dist/data.js +857 -1063
- package/dist/hooks.js +48 -59
- package/dist/jsx-runtime.js +24 -0
- package/dist/manifest.js +959 -953
- package/dist/svg.js +266 -432
- package/dist/ui.js +1935 -2388
- package/dist/util.js +587 -557
- package/dist/widgets.css +6 -6
- package/dist/widgets.js +7543 -9909
- package/package.json +39 -5
- package/src/charts/Bar.scss +5 -3
- package/src/charts/Bar.ts +114 -0
- package/src/charts/BarGraph.scss +4 -3
- package/src/charts/BarGraph.tsx +145 -0
- package/src/charts/BubbleGraph.scss +5 -3
- package/src/charts/BubbleGraph.tsx +165 -0
- package/src/charts/Chart.ts +108 -0
- package/src/charts/ColorMap.ts +150 -0
- package/src/charts/Column.scss +5 -3
- package/src/charts/Column.ts +124 -0
- package/src/charts/ColumnBarBase.tsx +284 -0
- package/src/charts/ColumnBarGraphBase.tsx +229 -0
- package/src/charts/ColumnGraph.scss +5 -3
- package/src/charts/ColumnGraph.tsx +153 -0
- package/src/charts/Grid.ts +5 -0
- package/src/charts/Gridlines.scss +5 -3
- package/src/charts/Gridlines.tsx +88 -0
- package/src/charts/Legend.scss +5 -3
- package/src/charts/Legend.tsx +270 -0
- package/src/charts/LegendEntry.scss +5 -3
- package/src/charts/LegendEntry.tsx +197 -0
- package/src/charts/LineGraph.scss +4 -3
- package/src/charts/LineGraph.tsx +441 -0
- package/src/charts/Marker.scss +5 -3
- package/src/charts/Marker.tsx +483 -0
- package/src/charts/MarkerLine.scss +5 -3
- package/src/charts/MarkerLine.tsx +214 -0
- package/src/charts/MouseTracker.tsx +112 -0
- package/src/charts/Pie.ts +8 -0
- package/src/charts/PieChart.scss +5 -3
- package/src/charts/PieChart.tsx +717 -0
- package/src/charts/PieLabel.tsx +106 -0
- package/src/charts/PieLabelsContainer.ts +68 -0
- package/src/charts/Range.scss +4 -3
- package/src/charts/Range.tsx +318 -0
- package/src/charts/RangeMarker.scss +5 -3
- package/src/charts/RangeMarker.tsx +233 -0
- package/src/charts/ScatterGraph.scss +5 -3
- package/src/charts/ScatterGraph.tsx +245 -0
- package/src/charts/Swimlane.scss +5 -3
- package/src/charts/Swimlane.tsx +195 -0
- package/src/charts/Swimlanes.scss +5 -3
- package/src/charts/Swimlanes.tsx +179 -0
- package/src/charts/axis/Axis.scss +22 -22
- package/src/charts/axis/Axis.tsx +444 -0
- package/src/charts/axis/CategoryAxis.scss +5 -3
- package/src/charts/axis/CategoryAxis.tsx +313 -0
- package/src/charts/axis/NumericAxis.scss +5 -3
- package/src/charts/axis/NumericAxis.tsx +437 -0
- package/src/charts/axis/Stack.ts +61 -0
- package/src/charts/axis/TimeAxis.scss +4 -3
- package/src/charts/axis/TimeAxis.tsx +718 -0
- package/src/charts/axis/index.scss +5 -5
- package/src/charts/axis/index.ts +4 -0
- package/src/charts/axis/variables.scss +2 -2
- package/src/charts/helpers/MinMaxFinder.ts +66 -0
- package/src/charts/helpers/PointReducer.ts +135 -0
- package/src/charts/helpers/SnapPointFinder.ts +136 -0
- package/src/charts/helpers/ValueAtFinder.ts +72 -0
- package/src/charts/helpers/index.ts +4 -0
- package/src/charts/index.scss +22 -22
- package/src/charts/palette.scss +7 -5
- package/src/charts/shapes.tsx +86 -0
- package/src/charts/variables.scss +2 -1
- package/src/core.d.ts +182 -310
- package/src/data/AggregateFunction.ts +171 -0
- package/src/data/ArrayElementView.spec.ts +88 -0
- package/src/data/ArrayElementView.ts +90 -0
- package/src/data/ArrayRef.ts +35 -0
- package/src/data/AugmentedViewBase.ts +88 -0
- package/src/data/Binding.ts +104 -0
- package/src/data/ExposedRecordView.ts +95 -0
- package/src/data/ExposedValueView.ts +89 -0
- package/src/data/Expression.spec.ts +229 -0
- package/src/data/Expression.ts +233 -0
- package/src/data/Grouper.spec.ts +57 -0
- package/src/data/Grouper.ts +158 -0
- package/src/data/NestedDataView.ts +43 -0
- package/src/data/ReadOnlyDataView.ts +39 -0
- package/src/data/Ref.spec.ts +79 -0
- package/src/data/Ref.ts +104 -0
- package/src/data/Selector.ts +10 -0
- package/src/data/Store.spec.ts +22 -0
- package/src/data/Store.ts +52 -0
- package/src/data/StoreProxy.ts +19 -0
- package/src/data/StoreRef.spec.ts +24 -0
- package/src/data/StoreRef.ts +66 -0
- package/src/data/StringTemplate.spec.ts +132 -0
- package/src/data/StringTemplate.ts +93 -0
- package/src/data/StructuredSelector.spec.ts +113 -0
- package/src/data/StructuredSelector.ts +146 -0
- package/src/data/SubscribableView.ts +63 -0
- package/src/data/View.ts +289 -0
- package/src/data/ZoomIntoPropertyView.spec.ts +64 -0
- package/src/data/ZoomIntoPropertyView.ts +45 -0
- package/src/data/comparer.ts +78 -0
- package/src/data/computable.spec.ts +62 -0
- package/src/data/computable.ts +72 -0
- package/src/data/createAccessorModelProxy.ts +60 -0
- package/src/data/createStructuredSelector.spec.ts +45 -0
- package/src/data/createStructuredSelector.ts +62 -0
- package/src/data/defaultCompare.ts +15 -0
- package/src/data/diff/diffArrays.ts +49 -0
- package/src/data/diff/diffs.spec.ts +49 -0
- package/src/data/diff/index.ts +1 -0
- package/src/data/enableFatArrowExpansion.ts +6 -0
- package/src/data/getAccessor.spec.ts +11 -0
- package/src/data/getAccessor.ts +74 -0
- package/src/data/getSelector.spec.ts +43 -0
- package/src/data/getSelector.ts +66 -0
- package/src/data/index.ts +30 -0
- package/src/data/isSelector.ts +26 -0
- package/src/data/ops/append.spec.ts +28 -0
- package/src/data/ops/append.ts +5 -0
- package/src/data/ops/filter.spec.ts +35 -0
- package/src/data/ops/filter.ts +9 -0
- package/src/data/ops/findTreeNode.spec.ts +23 -0
- package/src/data/ops/findTreeNode.ts +18 -0
- package/src/data/ops/findTreePath.ts +23 -0
- package/src/data/ops/insertElement.ts +3 -0
- package/src/data/ops/merge.spec.ts +27 -0
- package/src/data/ops/merge.ts +13 -0
- package/src/data/ops/moveElement.ts +21 -0
- package/src/data/ops/removeTreeNodes.spec.ts +37 -0
- package/src/data/ops/removeTreeNodes.ts +15 -0
- package/src/data/ops/updateArray.spec.ts +69 -0
- package/src/data/ops/updateArray.ts +31 -0
- package/src/data/ops/updateTree.spec.ts +54 -0
- package/src/data/ops/updateTree.ts +23 -0
- package/src/data/test-types.ts +7 -0
- package/src/global.scss +13 -13
- package/src/hooks/createLocalStorageRef.ts +21 -0
- package/src/hooks/invokeCallback.spec.tsx +59 -0
- package/src/hooks/invokeCallback.ts +8 -0
- package/src/hooks/resolveCallback.spec.tsx +48 -0
- package/src/hooks/resolveCallback.ts +16 -0
- package/src/hooks/store.spec.tsx +67 -0
- package/src/hooks/store.ts +46 -0
- package/src/hooks/useEffect.ts +14 -0
- package/src/hooks/useInterval.ts +8 -0
- package/src/hooks/useState.ts +20 -0
- package/src/hooks/useTrigger.spec.tsx +99 -0
- package/src/hooks/useTrigger.ts +26 -0
- package/src/jsx-runtime.ts +72 -0
- package/src/locale/de-de.ts +76 -0
- package/src/locale/en-us.ts +75 -0
- package/src/locale/es-es.ts +76 -0
- package/src/locale/fr-fr.ts +76 -0
- package/src/locale/nl-nl.ts +76 -0
- package/src/locale/pt-pt.ts +76 -0
- package/src/locale/sr-latn-ba.ts +76 -0
- package/src/svg/BoundedObject.ts +101 -0
- package/src/svg/ClipRect.tsx +29 -0
- package/src/svg/Ellipse.tsx +69 -0
- package/src/svg/Line.tsx +58 -0
- package/src/svg/NonOverlappingRect.ts +26 -0
- package/src/svg/NonOverlappingRectGroup.ts +49 -0
- package/src/svg/Rectangle.tsx +91 -0
- package/src/svg/Svg.scss +5 -4
- package/src/svg/Svg.tsx +241 -0
- package/src/svg/Text.tsx +134 -0
- package/src/svg/TextualBoundedObject.ts +35 -0
- package/src/svg/index.scss +8 -8
- package/src/svg/util/Rect.ts +105 -0
- package/src/ui/CSS.ts +87 -0
- package/src/ui/CSSHelper.ts +17 -0
- package/src/ui/Container.tsx +216 -0
- package/src/ui/ContentResolver.spec.tsx +430 -0
- package/src/ui/ContentResolver.ts +124 -0
- package/src/ui/Controller.spec.tsx +566 -0
- package/src/ui/Controller.ts +189 -0
- package/src/ui/Culture.ts +159 -0
- package/src/ui/Cx.spec.tsx +208 -0
- package/src/ui/Cx.tsx +386 -0
- package/src/ui/DataProxy.spec.tsx +337 -0
- package/src/ui/DataProxy.ts +55 -0
- package/src/ui/DetachedScope.tsx +159 -0
- package/src/ui/FocusManager.ts +171 -0
- package/src/ui/Format.ts +108 -0
- package/src/ui/HoverSync.tsx +189 -0
- package/src/ui/Instance.ts +868 -0
- package/src/ui/IsolatedScope.spec.tsx +55 -0
- package/src/ui/IsolatedScope.ts +50 -0
- package/src/ui/Localization.ts +70 -0
- package/src/ui/Prop.ts +112 -0
- package/src/ui/PureContainer.spec.tsx +230 -0
- package/src/ui/PureContainer.tsx +19 -0
- package/src/ui/RenderingContext.ts +99 -0
- package/src/ui/Repeater.spec.tsx +141 -0
- package/src/ui/Repeater.ts +203 -0
- package/src/ui/Rescope.spec.tsx +199 -0
- package/src/ui/Rescope.ts +49 -0
- package/src/ui/ResizeManager.ts +31 -0
- package/src/ui/Restate.spec.tsx +418 -0
- package/src/ui/Restate.tsx +217 -0
- package/src/ui/StaticText.ts +11 -0
- package/src/ui/StructuredInstanceDataAccessor.ts +32 -0
- package/src/ui/Text.ts +30 -0
- package/src/ui/VDOM.ts +34 -0
- package/src/ui/Widget.spec.tsx +53 -0
- package/src/ui/Widget.tsx +308 -0
- package/src/ui/ZIndexManager.ts +11 -0
- package/src/ui/adapter/ArrayAdapter.spec.ts +55 -0
- package/src/ui/adapter/ArrayAdapter.ts +226 -0
- package/src/ui/adapter/DataAdapter.ts +52 -0
- package/src/ui/adapter/GroupAdapter.ts +235 -0
- package/src/ui/adapter/TreeAdapter.spec.ts +76 -0
- package/src/ui/adapter/TreeAdapter.ts +185 -0
- package/src/ui/app/History.ts +133 -0
- package/src/ui/app/Url.spec.ts +50 -0
- package/src/ui/app/Url.ts +102 -0
- package/src/ui/app/startAppLoop.tsx +74 -0
- package/src/ui/app/startHotAppLoop.ts +40 -0
- package/src/ui/batchUpdates.ts +77 -0
- package/src/ui/bind.ts +10 -0
- package/src/ui/createFunctionalComponent.spec.tsx +399 -0
- package/src/ui/createFunctionalComponent.ts +65 -0
- package/src/ui/expr.ts +44 -0
- package/src/ui/flattenProps.ts +21 -0
- package/src/ui/index.scss +2 -2
- package/src/ui/index.ts +45 -0
- package/src/ui/keyboardShortcuts.ts +40 -0
- package/src/ui/layout/Content.ts +30 -0
- package/src/ui/layout/ContentPlaceholder.spec.tsx +587 -0
- package/src/ui/layout/ContentPlaceholder.ts +133 -0
- package/src/ui/layout/FirstVisibleChildLayout.spec.tsx +195 -0
- package/src/ui/layout/FirstVisibleChildLayout.ts +60 -0
- package/src/ui/layout/LabelsLeftLayout.scss +6 -4
- package/src/ui/layout/LabelsLeftLayout.tsx +76 -0
- package/src/ui/layout/LabelsTopLayout.scss +5 -4
- package/src/ui/layout/LabelsTopLayout.tsx +156 -0
- package/src/ui/layout/UseParentLayout.ts +8 -0
- package/src/ui/layout/exploreChildren.ts +38 -0
- package/src/ui/layout/index.scss +3 -3
- package/src/ui/layout/variables.scss +2 -2
- package/src/ui/selection/KeySelection.ts +165 -0
- package/src/ui/selection/PropertySelection.ts +87 -0
- package/src/ui/selection/Selection.ts +118 -0
- package/src/ui/tpl.ts +5 -0
- package/src/ui/variables.scss +1 -1
- package/src/util/Component.spec.ts +381 -0
- package/src/util/Component.ts +296 -0
- package/src/util/Console.ts +11 -0
- package/src/util/DOM.ts +88 -0
- package/src/util/Debug.ts +71 -0
- package/src/util/Format.spec.ts +69 -0
- package/src/util/Format.ts +267 -0
- package/src/util/GlobalCacheIdentifier.ts +11 -0
- package/src/util/KeyCode.ts +21 -0
- package/src/util/SubscriberList.ts +87 -0
- package/src/util/Timing.ts +59 -0
- package/src/util/TraversalStack.spec.ts +54 -0
- package/src/util/TraversalStack.ts +48 -0
- package/src/util/addEventListenerWithOptions.ts +41 -0
- package/src/util/browserSupportsPassiveEventHandlers.ts +20 -0
- package/src/util/calculateNaturalElementHeight.ts +22 -0
- package/src/util/call-once.scss +6 -6
- package/src/util/capitalize.ts +4 -0
- package/src/util/coalesce.ts +6 -0
- package/src/util/color/hslToRgb.ts +34 -0
- package/src/util/color/parseColor.ts +173 -0
- package/src/util/color/rgbToHex.ts +15 -0
- package/src/util/color/rgbToHsl.ts +36 -0
- package/src/util/date/dateDiff.ts +9 -0
- package/src/util/date/diff.ts +13 -0
- package/src/util/date/encodeDate.ts +8 -0
- package/src/util/date/encodeDateWithTimezoneOffset.ts +19 -0
- package/src/util/date/lowerBoundCheck.ts +13 -0
- package/src/util/date/maxDate.ts +14 -0
- package/src/util/date/minDate.ts +14 -0
- package/src/util/date/monthStart.ts +8 -0
- package/src/util/date/parseDateInvariant.ts +20 -0
- package/src/util/date/sameDate.ts +11 -0
- package/src/util/date/upperBoundCheck.ts +13 -0
- package/src/util/date/zeroTime.ts +9 -0
- package/src/util/debounce.ts +26 -0
- package/src/util/dummyCallback.ts +1 -0
- package/src/util/escapeSpecialRegexCharacters.ts +8 -0
- package/src/util/eventCallbacks.ts +12 -0
- package/src/util/expandFatArrows.ts +118 -0
- package/src/util/findScrollableParent.ts +15 -0
- package/src/util/getActiveElement.ts +4 -0
- package/src/util/getParentFrameBoundingClientRect.ts +13 -0
- package/src/util/getScrollerBoundingClientRect.ts +12 -0
- package/src/util/getSearchQueryPredicate.ts +58 -0
- package/src/util/getTopLevelBoundingClientRect.ts +7 -0
- package/src/util/getVendorPrefix.ts +33 -0
- package/src/util/hasKey.ts +18 -0
- package/src/util/index.scss +10 -10
- package/src/util/index.ts +55 -0
- package/src/util/innerTextTrim.ts +10 -0
- package/src/util/isArray.ts +3 -0
- package/src/util/isDataRecord.ts +5 -0
- package/src/util/isDefined.ts +3 -0
- package/src/util/isDigit.ts +8 -0
- package/src/util/isFunction.ts +3 -0
- package/src/util/isNonEmptyArray.ts +3 -0
- package/src/util/isNumber.ts +3 -0
- package/src/util/isObject.ts +3 -0
- package/src/util/isPromise.ts +6 -0
- package/src/util/isString.ts +3 -0
- package/src/util/isTextInputElement.ts +3 -0
- package/src/util/isTouchDevice.ts +7 -0
- package/src/util/isTouchEvent.ts +64 -0
- package/src/util/isUndefined.ts +3 -0
- package/src/util/isValidIdentifierName.ts +5 -0
- package/src/util/onIdleCallback.ts +10 -0
- package/src/util/parseStyle.ts +29 -0
- package/src/util/quote.ts +6 -0
- package/src/util/reverseSlice.ts +10 -0
- package/src/util/routeAppend.ts +16 -0
- package/src/util/scrollElementIntoView.ts +40 -0
- package/src/util/scss/add-rules.scss +7 -5
- package/src/util/scss/calc.scss +12 -8
- package/src/util/scss/call-once.scss +5 -3
- package/src/util/scss/clockwise.scss +20 -18
- package/src/util/scss/colors.scss +4 -2
- package/src/util/scss/deep-get.scss +3 -1
- package/src/util/scss/deep-merge.scss +6 -3
- package/src/util/scss/divide.scss +3 -3
- package/src/util/scss/include.scss +6 -5
- package/src/util/scss/index.scss +9 -9
- package/src/util/shallowEquals.ts +43 -0
- package/src/util/test/createTestRenderer.tsx +12 -0
- package/src/util/throttle.ts +21 -0
- package/src/util/validatedDebounce.ts +23 -0
- package/src/variables.scss +217 -217
- package/src/widgets/AccessorBindings.spec.tsx +64 -66
- package/src/widgets/Button.scss +6 -4
- package/src/widgets/Button.tsx +201 -0
- package/src/widgets/Button.variables.scss +13 -10
- package/src/widgets/CxCredit.scss +6 -4
- package/src/widgets/CxCredit.tsx +46 -0
- package/src/widgets/DocumentTitle.ts +92 -0
- package/src/widgets/FlexBox.scss +7 -5
- package/src/widgets/FlexBox.tsx +169 -0
- package/src/widgets/Heading.scss +6 -4
- package/src/widgets/Heading.ts +43 -0
- package/src/widgets/HighlightedSearchText.scss +6 -4
- package/src/widgets/HighlightedSearchText.tsx +54 -0
- package/src/widgets/HtmlElement.spec.tsx +79 -0
- package/src/widgets/HtmlElement.tsx +349 -0
- package/src/widgets/Icon.scss +6 -4
- package/src/widgets/Icon.ts +78 -0
- package/src/widgets/List.scss +6 -4
- package/src/widgets/List.tsx +787 -0
- package/src/widgets/ProgressBar.scss +5 -4
- package/src/widgets/ProgressBar.tsx +66 -0
- package/src/widgets/Resizer.scss +5 -4
- package/src/widgets/Resizer.tsx +200 -0
- package/src/widgets/Sandbox.ts +103 -0
- package/src/widgets/Section.scss +5 -4
- package/src/widgets/Section.tsx +187 -0
- package/src/widgets/animations.scss +10 -10
- package/src/widgets/autoFocus.ts +9 -0
- package/src/widgets/cx.ts +63 -0
- package/src/widgets/drag-drop/DragClone.scss +6 -4
- package/src/widgets/drag-drop/DragHandle.scss +6 -4
- package/src/widgets/drag-drop/DragHandle.tsx +47 -0
- package/src/widgets/drag-drop/DragSource.scss +6 -4
- package/src/widgets/drag-drop/DragSource.tsx +238 -0
- package/src/widgets/drag-drop/DropZone.scss +6 -4
- package/src/widgets/drag-drop/DropZone.tsx +354 -0
- package/src/widgets/drag-drop/index.scss +3 -3
- package/src/widgets/drag-drop/ops.tsx +422 -0
- package/src/widgets/drag-drop/variables.scss +4 -1
- package/src/widgets/enableAllInternalDependencies.ts +11 -0
- package/src/widgets/form/Calendar.scss +8 -5
- package/src/widgets/form/Calendar.tsx +760 -0
- package/src/widgets/form/Calendar.variables.scss +63 -63
- package/src/widgets/form/Checkbox.scss +5 -3
- package/src/widgets/form/Checkbox.tsx +285 -0
- package/src/widgets/form/Checkbox.variables.scss +39 -39
- package/src/widgets/form/ColorField.scss +5 -3
- package/src/widgets/form/ColorField.tsx +491 -0
- package/src/widgets/form/ColorPicker.scss +5 -3
- package/src/widgets/form/ColorPicker.tsx +544 -0
- package/src/widgets/form/ColorPicker.variables.scss +22 -22
- package/src/widgets/form/DateField.ts +21 -0
- package/src/widgets/form/DateTimeField.scss +5 -3
- package/src/widgets/form/DateTimeField.tsx +723 -0
- package/src/widgets/form/DateTimePicker.scss +6 -4
- package/src/widgets/form/DateTimePicker.tsx +431 -0
- package/src/widgets/form/Field.scss +4 -2
- package/src/widgets/form/Field.tsx +611 -0
- package/src/widgets/form/FieldGroup.ts +10 -0
- package/src/widgets/form/FieldIcon.ts +61 -0
- package/src/widgets/form/HelpText.scss +5 -4
- package/src/widgets/form/HelpText.ts +15 -0
- package/src/widgets/form/Label.scss +5 -4
- package/src/widgets/form/Label.tsx +116 -0
- package/src/widgets/form/LabeledContainer.ts +81 -0
- package/src/widgets/form/LookupField.scss +5 -3
- package/src/widgets/form/LookupField.tsx +1326 -0
- package/src/widgets/form/MonthField.scss +4 -3
- package/src/widgets/form/MonthField.tsx +665 -0
- package/src/widgets/form/MonthPicker.scss +8 -5
- package/src/widgets/form/MonthPicker.tsx +822 -0
- package/src/widgets/form/NumberField.scss +5 -3
- package/src/widgets/form/NumberField.tsx +540 -0
- package/src/widgets/form/Radio.scss +5 -3
- package/src/widgets/form/Radio.tsx +245 -0
- package/src/widgets/form/Radio.variables.scss +45 -45
- package/src/widgets/form/Select.scss +6 -4
- package/src/widgets/form/Select.tsx +322 -0
- package/src/widgets/form/Slider.scss +6 -3
- package/src/widgets/form/Slider.tsx +461 -0
- package/src/widgets/form/Switch.scss +5 -3
- package/src/widgets/form/Switch.tsx +174 -0
- package/src/widgets/form/TextArea.scss +6 -4
- package/src/widgets/form/TextArea.tsx +229 -0
- package/src/widgets/form/TextField.scss +6 -4
- package/src/widgets/form/TextField.tsx +345 -0
- package/src/widgets/form/TimeField.ts +10 -0
- package/src/widgets/form/TimeList.tsx +94 -0
- package/src/widgets/form/UploadButton.scss +5 -3
- package/src/widgets/form/UploadButton.tsx +256 -0
- package/src/widgets/form/ValidationError.scss +4 -3
- package/src/widgets/form/ValidationError.tsx +72 -0
- package/src/widgets/form/ValidationGroup.spec.tsx +147 -0
- package/src/widgets/form/ValidationGroup.ts +141 -0
- package/src/widgets/form/Validator.ts +23 -0
- package/src/widgets/form/Wheel.scss +9 -7
- package/src/widgets/form/Wheel.tsx +315 -0
- package/src/widgets/form/index.scss +24 -24
- package/src/widgets/form/variables.scss +3 -1
- package/src/widgets/grid/Grid.scss +6 -4
- package/src/widgets/grid/Grid.tsx +4247 -0
- package/src/widgets/grid/GridCell.ts +143 -0
- package/src/widgets/grid/GridCellEditor.tsx +52 -0
- package/src/widgets/grid/GridRow.ts +302 -0
- package/src/widgets/grid/GridRowLine.ts +49 -0
- package/src/widgets/grid/Pagination.scss +5 -3
- package/src/widgets/grid/Pagination.tsx +126 -0
- package/src/widgets/grid/TreeNode.scss +6 -4
- package/src/widgets/grid/TreeNode.tsx +145 -0
- package/src/widgets/grid/createGridCellEditor.tsx +18 -0
- package/src/widgets/grid/index.scss +3 -3
- package/src/widgets/grid/index.ts +17 -0
- package/src/widgets/grid/variables.scss +8 -4
- 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.svg +187 -187
- package/src/widgets/icons/calendar.tsx +17 -0
- package/src/widgets/icons/check.tsx +13 -0
- package/src/widgets/icons/clear.svg +74 -74
- package/src/widgets/icons/clear.tsx +15 -0
- package/src/widgets/icons/close.svg +74 -74
- package/src/widgets/icons/close.tsx +20 -0
- package/src/widgets/icons/cx.tsx +38 -0
- package/src/widgets/icons/drop-down.tsx +15 -0
- package/src/widgets/icons/dropdown-arrow.svg +61 -61
- package/src/widgets/icons/file.svg +4 -4
- package/src/widgets/icons/file.tsx +13 -0
- package/src/widgets/icons/folder-open.svg +5 -5
- package/src/widgets/icons/folder-open.tsx +15 -0
- package/src/widgets/icons/folder.svg +58 -58
- package/src/widgets/icons/folder.tsx +13 -0
- package/src/widgets/icons/forward.svg +67 -67
- package/src/widgets/icons/forward.tsx +22 -0
- package/src/widgets/icons/loading.svg +4 -4
- package/src/widgets/icons/loading.tsx +24 -0
- package/src/widgets/icons/menu.tsx +17 -0
- package/src/widgets/icons/pixel-picker.tsx +18 -0
- package/src/widgets/icons/registry.ts +57 -0
- package/src/widgets/icons/search.svg +107 -107
- package/src/widgets/icons/search.tsx +13 -0
- package/src/widgets/icons/sort-asc.svg +3 -3
- package/src/widgets/icons/sort-asc.tsx +14 -0
- package/src/widgets/icons/square.tsx +18 -0
- package/src/widgets/index.d.ts +55 -55
- package/src/widgets/index.scss +16 -16
- package/src/widgets/nav/Link.scss +5 -3
- package/src/widgets/nav/Link.ts +12 -0
- package/src/widgets/nav/LinkButton.ts +176 -0
- package/src/widgets/nav/Menu.scss +7 -5
- package/src/widgets/nav/Menu.tsx +489 -0
- package/src/widgets/nav/Menu.variables.scss +3 -1
- package/src/widgets/nav/MenuItem.scss +6 -4
- package/src/widgets/nav/MenuItem.tsx +523 -0
- package/src/widgets/nav/MenuSpacer.ts +19 -0
- package/src/widgets/nav/RedirectRoute.ts +50 -0
- package/src/widgets/nav/Route.spec.tsx +24 -0
- package/src/widgets/nav/Route.ts +142 -0
- package/src/widgets/nav/Scroller.scss +5 -3
- package/src/widgets/nav/Scroller.tsx +253 -0
- package/src/widgets/nav/Submenu.ts +6 -0
- package/src/widgets/nav/Tab.scss +5 -4
- package/src/widgets/nav/Tab.ts +120 -0
- package/src/widgets/nav/Tab.variables.scss +84 -84
- package/src/widgets/nav/cover.scss +5 -4
- package/src/widgets/nav/index.scss +5 -5
- package/src/widgets/nav/variables.scss +3 -1
- package/src/widgets/overlay/ContextMenu.ts +42 -0
- package/src/widgets/overlay/Dropdown.scss +11 -9
- package/src/widgets/overlay/Dropdown.tsx +762 -0
- package/src/widgets/overlay/FlyweightTooltipTracker.ts +57 -0
- package/src/widgets/overlay/MsgBox.tsx +141 -0
- package/src/widgets/overlay/Overlay.scss +5 -3
- package/src/widgets/overlay/Overlay.tsx +942 -0
- package/src/widgets/overlay/Toast.scss +8 -7
- package/src/widgets/overlay/Toast.ts +111 -0
- package/src/widgets/overlay/Tooltip.scss +6 -4
- package/src/widgets/overlay/Tooltip.tsx +393 -0
- package/src/widgets/overlay/Window.scss +6 -4
- package/src/widgets/overlay/Window.tsx +299 -0
- package/src/widgets/overlay/Window.variables.scss +62 -62
- package/src/widgets/overlay/alerts.ts +46 -0
- package/src/widgets/overlay/captureMouse.scss +13 -13
- package/src/widgets/overlay/captureMouse.ts +195 -0
- package/src/widgets/overlay/createHotPromiseWindowFactory.ts +72 -0
- package/src/widgets/overlay/index.scss +15 -15
- package/src/widgets/overlay/index.ts +11 -0
- package/src/widgets/overlay/tooltip-ops.ts +173 -0
- package/src/widgets/overlay/variables.scss +3 -1
- package/src/widgets/variables.scss +3 -1
- package/tsconfig.compile.json +4 -0
- package/tsconfig.json +34 -0
- package/tsconfig.mocha.json +14 -0
- package/charts.d.ts +0 -1
- package/charts.js +0 -1
- package/data.d.ts +0 -1
- package/data.js +0 -1
- package/hooks.d.ts +0 -1
- package/hooks.js +0 -1
- package/index.js +0 -17
- package/locale/de-de.js +0 -75
- package/locale/en-us.js +0 -75
- package/locale/es-es.js +0 -75
- package/locale/fr-fr.js +0 -75
- package/locale/nl-nl.js +0 -75
- package/locale/pt-pt.js +0 -75
- package/locale/sr-latn-ba.js +0 -75
- package/manifest.js +0 -1
- package/src/charts/Bar.d.ts +0 -28
- package/src/charts/Bar.js +0 -90
- package/src/charts/BarGraph.d.ts +0 -15
- package/src/charts/BarGraph.js +0 -112
- package/src/charts/BubbleGraph.js +0 -93
- package/src/charts/Chart.d.ts +0 -12
- package/src/charts/Chart.js +0 -75
- package/src/charts/ColorMap.d.ts +0 -21
- package/src/charts/ColorMap.js +0 -97
- package/src/charts/Column.d.ts +0 -29
- package/src/charts/Column.js +0 -88
- package/src/charts/ColumnBarBase.d.ts +0 -64
- package/src/charts/ColumnBarBase.js +0 -176
- package/src/charts/ColumnBarGraphBase.d.ts +0 -73
- package/src/charts/ColumnBarGraphBase.js +0 -114
- package/src/charts/ColumnGraph.d.ts +0 -18
- package/src/charts/ColumnGraph.js +0 -120
- package/src/charts/Grid.js +0 -5
- package/src/charts/Gridlines.d.ts +0 -25
- package/src/charts/Gridlines.js +0 -49
- package/src/charts/Legend.d.ts +0 -45
- package/src/charts/Legend.js +0 -187
- package/src/charts/LegendEntry.d.ts +0 -54
- package/src/charts/LegendEntry.js +0 -128
- package/src/charts/LineGraph.d.ts +0 -101
- package/src/charts/LineGraph.js +0 -300
- package/src/charts/Marker.d.ts +0 -110
- package/src/charts/Marker.js +0 -311
- package/src/charts/MarkerLine.d.ts +0 -56
- package/src/charts/MarkerLine.js +0 -128
- package/src/charts/MouseTracker.d.ts +0 -17
- package/src/charts/MouseTracker.js +0 -81
- package/src/charts/Pie.js +0 -8
- package/src/charts/PieChart.d.ts +0 -92
- package/src/charts/PieChart.js +0 -530
- package/src/charts/PieLabel.d.ts +0 -26
- package/src/charts/PieLabel.js +0 -71
- package/src/charts/PieLabelsContainer.d.ts +0 -6
- package/src/charts/PieLabelsContainer.js +0 -55
- package/src/charts/Range.d.ts +0 -75
- package/src/charts/Range.js +0 -206
- package/src/charts/RangeMarker.d.ts +0 -35
- package/src/charts/RangeMarker.js +0 -159
- package/src/charts/ScatterGraph.d.ts +0 -64
- package/src/charts/ScatterGraph.js +0 -164
- package/src/charts/Swimlane.d.ts +0 -24
- package/src/charts/Swimlane.js +0 -140
- package/src/charts/Swimlanes.d.ts +0 -41
- package/src/charts/Swimlanes.js +0 -114
- package/src/charts/axis/Axis.d.ts +0 -113
- package/src/charts/axis/Axis.js +0 -288
- package/src/charts/axis/CategoryAxis.d.ts +0 -30
- package/src/charts/axis/CategoryAxis.js +0 -241
- package/src/charts/axis/NumericAxis.d.ts +0 -46
- package/src/charts/axis/NumericAxis.js +0 -351
- package/src/charts/axis/Stack.d.ts +0 -11
- package/src/charts/axis/Stack.js +0 -55
- package/src/charts/axis/TimeAxis.d.ts +0 -31
- package/src/charts/axis/TimeAxis.js +0 -611
- package/src/charts/axis/index.d.ts +0 -4
- package/src/charts/axis/index.js +0 -4
- package/src/charts/helpers/MinMaxFinder.d.ts +0 -22
- package/src/charts/helpers/MinMaxFinder.js +0 -36
- package/src/charts/helpers/PointReducer.d.ts +0 -24
- package/src/charts/helpers/PointReducer.js +0 -61
- package/src/charts/helpers/SnapPointFinder.d.ts +0 -30
- package/src/charts/helpers/SnapPointFinder.js +0 -69
- package/src/charts/helpers/ValueAtFinder.d.ts +0 -16
- package/src/charts/helpers/ValueAtFinder.js +0 -46
- package/src/charts/helpers/index.d.ts +0 -4
- package/src/charts/helpers/index.js +0 -4
- package/src/charts/index.d.ts +0 -27
- package/src/charts/shapes.d.ts +0 -23
- package/src/charts/shapes.js +0 -79
- package/src/data/AggregateFunction.d.ts +0 -20
- package/src/data/AggregateFunction.js +0 -145
- package/src/data/ArrayElementView.d.ts +0 -13
- package/src/data/ArrayElementView.js +0 -64
- package/src/data/ArrayElementView.spec.js +0 -88
- package/src/data/ArrayRef.d.ts +0 -15
- package/src/data/ArrayRef.js +0 -35
- package/src/data/AugmentedViewBase.d.ts +0 -18
- package/src/data/AugmentedViewBase.js +0 -77
- package/src/data/Binding.d.ts +0 -19
- package/src/data/Binding.js +0 -76
- package/src/data/ExposedRecordView.d.ts +0 -14
- package/src/data/ExposedRecordView.js +0 -75
- package/src/data/ExposedValueView.d.ts +0 -19
- package/src/data/ExposedValueView.js +0 -73
- package/src/data/Expression.d.ts +0 -17
- package/src/data/Expression.js +0 -229
- package/src/data/Expression.spec.js +0 -229
- package/src/data/Grouper.d.ts +0 -21
- package/src/data/Grouper.js +0 -144
- package/src/data/Grouper.spec.js +0 -57
- package/src/data/NestedDataView.d.ts +0 -19
- package/src/data/NestedDataView.js +0 -22
- package/src/data/ReadOnlyDataView.d.ts +0 -14
- package/src/data/ReadOnlyDataView.js +0 -27
- package/src/data/Ref.d.ts +0 -24
- package/src/data/Ref.js +0 -79
- package/src/data/Ref.spec.js +0 -79
- package/src/data/Store.d.ts +0 -14
- package/src/data/Store.js +0 -46
- package/src/data/Store.spec.js +0 -22
- package/src/data/StoreProxy.d.ts +0 -5
- package/src/data/StoreProxy.js +0 -17
- package/src/data/StoreRef.js +0 -54
- package/src/data/StoreRef.spec.js +0 -24
- package/src/data/StringTemplate.d.ts +0 -15
- package/src/data/StringTemplate.js +0 -92
- package/src/data/StringTemplate.spec.js +0 -132
- package/src/data/StructuredDataAccessor.d.ts +0 -7
- package/src/data/StructuredSelector.d.ts +0 -17
- package/src/data/StructuredSelector.js +0 -132
- package/src/data/StructuredSelector.spec.js +0 -113
- package/src/data/SubscribableView.d.ts +0 -11
- package/src/data/SubscribableView.js +0 -54
- package/src/data/View.d.ts +0 -155
- package/src/data/View.js +0 -182
- package/src/data/ZoomIntoPropertyView.d.ts +0 -11
- package/src/data/ZoomIntoPropertyView.js +0 -33
- package/src/data/ZoomIntoPropertyView.spec.js +0 -65
- package/src/data/comparer.d.ts +0 -7
- package/src/data/comparer.js +0 -54
- package/src/data/computable.d.ts +0 -125
- package/src/data/computable.js +0 -56
- package/src/data/computable.spec.js +0 -55
- package/src/data/createAccessorModelProxy.d.ts +0 -6
- package/src/data/createAccessorModelProxy.js +0 -43
- package/src/data/createStructuredSelector.d.ts +0 -3
- package/src/data/createStructuredSelector.js +0 -43
- package/src/data/createStructuredSelector.spec.js +0 -46
- package/src/data/defaultCompare.d.ts +0 -1
- package/src/data/defaultCompare.js +0 -15
- package/src/data/diff/diffArrays.d.ts +0 -15
- package/src/data/diff/diffArrays.js +0 -41
- package/src/data/diff/diffs.spec.js +0 -49
- package/src/data/diff/index.d.ts +0 -1
- package/src/data/diff/index.js +0 -1
- package/src/data/enableFatArrowExpansion.d.ts +0 -1
- package/src/data/enableFatArrowExpansion.js +0 -6
- package/src/data/getAccessor.d.ts +0 -9
- package/src/data/getAccessor.js +0 -61
- package/src/data/getAccessor.spec.js +0 -11
- package/src/data/getSelector.d.ts +0 -3
- package/src/data/getSelector.js +0 -49
- package/src/data/getSelector.spec.js +0 -43
- package/src/data/index.d.ts +0 -30
- package/src/data/index.js +0 -29
- package/src/data/isSelector.d.ts +0 -1
- package/src/data/isSelector.js +0 -26
- package/src/data/ops/append.d.ts +0 -1
- package/src/data/ops/append.js +0 -7
- package/src/data/ops/append.spec.js +0 -28
- package/src/data/ops/filter.d.ts +0 -1
- package/src/data/ops/filter.js +0 -8
- package/src/data/ops/filter.spec.js +0 -29
- package/src/data/ops/findTreeNode.d.ts +0 -1
- package/src/data/ops/findTreeNode.js +0 -15
- package/src/data/ops/findTreeNode.spec.js +0 -24
- package/src/data/ops/findTreePath.d.ts +0 -6
- package/src/data/ops/findTreePath.js +0 -16
- package/src/data/ops/index.d.ts +0 -10
- package/src/data/ops/insertElement.d.ts +0 -1
- package/src/data/ops/insertElement.js +0 -3
- package/src/data/ops/merge.d.ts +0 -3
- package/src/data/ops/merge.js +0 -9
- package/src/data/ops/merge.spec.js +0 -27
- package/src/data/ops/moveElement.d.ts +0 -1
- package/src/data/ops/moveElement.js +0 -14
- package/src/data/ops/removeTreeNodes.d.ts +0 -5
- package/src/data/ops/removeTreeNodes.js +0 -5
- package/src/data/ops/removeTreeNodes.spec.js +0 -28
- package/src/data/ops/updateArray.d.ts +0 -6
- package/src/data/ops/updateArray.js +0 -24
- package/src/data/ops/updateArray.spec.js +0 -38
- package/src/data/ops/updateTree.d.ts +0 -7
- package/src/data/ops/updateTree.js +0 -25
- package/src/data/ops/updateTree.spec.js +0 -36
- package/src/hooks/createLocalStorageRef.d.ts +0 -3
- package/src/hooks/createLocalStorageRef.js +0 -20
- package/src/hooks/index.js +0 -8
- package/src/hooks/invokeCallback.d.ts +0 -5
- package/src/hooks/invokeCallback.js +0 -7
- package/src/hooks/invokeCallback.spec.js +0 -53
- package/src/hooks/resolveCallback.d.ts +0 -3
- package/src/hooks/resolveCallback.js +0 -12
- package/src/hooks/resolveCallback.spec.js +0 -54
- package/src/hooks/store.d.ts +0 -8
- package/src/hooks/store.js +0 -32
- package/src/hooks/store.spec.js +0 -73
- package/src/hooks/useEffect.d.ts +0 -3
- package/src/hooks/useEffect.js +0 -15
- package/src/hooks/useInterval.d.ts +0 -1
- package/src/hooks/useInterval.js +0 -8
- package/src/hooks/useState.d.ts +0 -3
- package/src/hooks/useState.js +0 -16
- package/src/hooks/useTrigger.d.ts +0 -5
- package/src/hooks/useTrigger.js +0 -20
- package/src/hooks/useTrigger.spec.js +0 -102
- package/src/svg/BoundedObject.d.ts +0 -23
- package/src/svg/BoundedObject.js +0 -59
- package/src/svg/ClipRect.d.ts +0 -5
- package/src/svg/ClipRect.js +0 -23
- package/src/svg/Ellipse.d.ts +0 -24
- package/src/svg/Ellipse.js +0 -37
- package/src/svg/Line.d.ts +0 -21
- package/src/svg/Line.js +0 -33
- package/src/svg/NonOverlappingRect.d.ts +0 -5
- package/src/svg/NonOverlappingRect.js +0 -15
- package/src/svg/NonOverlappingRectGroup.d.ts +0 -3
- package/src/svg/NonOverlappingRectGroup.js +0 -37
- package/src/svg/Rectangle.d.ts +0 -37
- package/src/svg/Rectangle.js +0 -42
- package/src/svg/Svg.d.ts +0 -32
- package/src/svg/Svg.js +0 -177
- package/src/svg/Text.d.ts +0 -40
- package/src/svg/Text.js +0 -78
- package/src/svg/TextualBoundedObject.d.ts +0 -7
- package/src/svg/TextualBoundedObject.js +0 -28
- package/src/svg/index.d.ts +0 -11
- package/src/svg/util/Rect.d.ts +0 -41
- package/src/svg/util/Rect.js +0 -109
- package/src/svg/util/index.js +0 -1
- package/src/ui/CSS.d.ts +0 -20
- package/src/ui/CSS.js +0 -79
- package/src/ui/CSSHelper.d.ts +0 -11
- package/src/ui/CSSHelper.js +0 -18
- package/src/ui/Container.d.ts +0 -18
- package/src/ui/Container.js +0 -154
- package/src/ui/ContentResolver.d.ts +0 -12
- package/src/ui/ContentResolver.js +0 -78
- package/src/ui/Controller.d.ts +0 -182
- package/src/ui/Controller.js +0 -114
- package/src/ui/Controller.spec.js +0 -415
- package/src/ui/Culture.d.ts +0 -57
- package/src/ui/Culture.js +0 -139
- package/src/ui/Cx.d.ts +0 -18
- package/src/ui/Cx.js +0 -325
- package/src/ui/Cx.spec.js +0 -194
- package/src/ui/DataProxy.d.ts +0 -12
- package/src/ui/DataProxy.js +0 -31
- package/src/ui/DataProxy.spec.js +0 -338
- package/src/ui/DetachedScope.d.ts +0 -21
- package/src/ui/DetachedScope.js +0 -98
- package/src/ui/FocusManager.d.ts +0 -29
- package/src/ui/FocusManager.js +0 -171
- package/src/ui/Format.d.ts +0 -3
- package/src/ui/Format.js +0 -108
- package/src/ui/HoverSync.d.ts +0 -13
- package/src/ui/HoverSync.js +0 -147
- package/src/ui/Instance.d.ts +0 -72
- package/src/ui/Instance.js +0 -620
- package/src/ui/IsolatedScope.d.ts +0 -16
- package/src/ui/IsolatedScope.js +0 -30
- package/src/ui/IsolatedScope.spec.js +0 -62
- package/src/ui/Localization.d.ts +0 -17
- package/src/ui/Localization.js +0 -70
- package/src/ui/PureContainer.d.ts +0 -16
- package/src/ui/PureContainer.js +0 -7
- package/src/ui/RenderingContext.d.ts +0 -9
- package/src/ui/RenderingContext.js +0 -88
- package/src/ui/Repeater.d.ts +0 -61
- package/src/ui/Repeater.js +0 -109
- package/src/ui/Repeater.spec.js +0 -143
- package/src/ui/Rescope.d.ts +0 -10
- package/src/ui/Rescope.js +0 -35
- package/src/ui/Rescope.spec.js +0 -195
- package/src/ui/ResizeManager.d.ts +0 -10
- package/src/ui/ResizeManager.js +0 -31
- package/src/ui/Restate.d.ts +0 -21
- package/src/ui/Restate.js +0 -167
- package/src/ui/Restate.spec.js +0 -422
- package/src/ui/StaticText.d.ts +0 -8
- package/src/ui/StaticText.js +0 -9
- package/src/ui/StructuredInstanceDataAccessor.d.ts +0 -16
- package/src/ui/StructuredInstanceDataAccessor.js +0 -26
- package/src/ui/Text.d.ts +0 -10
- package/src/ui/Text.js +0 -25
- package/src/ui/VDOM.d.ts +0 -12
- package/src/ui/VDOM.js +0 -2
- package/src/ui/Widget.d.ts +0 -14
- package/src/ui/Widget.js +0 -184
- package/src/ui/ZIndexManager.d.ts +0 -7
- package/src/ui/ZIndexManager.js +0 -11
- package/src/ui/adapter/ArrayAdapter.d.ts +0 -17
- package/src/ui/adapter/ArrayAdapter.js +0 -152
- package/src/ui/adapter/ArrayAdapter.spec.js +0 -55
- package/src/ui/adapter/DataAdapter.d.ts +0 -31
- package/src/ui/adapter/DataAdapter.js +0 -15
- package/src/ui/adapter/GroupAdapter.d.ts +0 -23
- package/src/ui/adapter/GroupAdapter.js +0 -140
- package/src/ui/adapter/TreeAdapter.d.ts +0 -24
- package/src/ui/adapter/TreeAdapter.js +0 -101
- package/src/ui/adapter/TreeAdapter.spec.js +0 -67
- package/src/ui/adapter/index.js +0 -4
- package/src/ui/app/History.d.ts +0 -17
- package/src/ui/app/History.js +0 -114
- package/src/ui/app/Url.d.ts +0 -21
- package/src/ui/app/Url.js +0 -103
- package/src/ui/app/Url.spec.js +0 -51
- package/src/ui/app/index.d.ts +0 -4
- package/src/ui/app/startAppLoop.d.ts +0 -4
- package/src/ui/app/startAppLoop.js +0 -58
- package/src/ui/app/startHotAppLoop.d.ts +0 -7
- package/src/ui/app/startHotAppLoop.js +0 -25
- package/src/ui/batchUpdates.d.ts +0 -11
- package/src/ui/batchUpdates.js +0 -67
- package/src/ui/bind.d.ts +0 -4
- package/src/ui/bind.js +0 -7
- package/src/ui/createFunctionalComponent.d.ts +0 -1
- package/src/ui/createFunctionalComponent.js +0 -63
- package/src/ui/createFunctionalComponent.spec.js +0 -400
- package/src/ui/expr.d.ts +0 -24
- package/src/ui/expr.js +0 -17
- package/src/ui/flattenProps.js +0 -21
- package/src/ui/index.d.ts +0 -42
- package/src/ui/index.js +0 -44
- package/src/ui/keyboardShortcuts.d.ts +0 -5
- package/src/ui/keyboardShortcuts.js +0 -31
- package/src/ui/layout/Content.d.ts +0 -14
- package/src/ui/layout/Content.js +0 -16
- package/src/ui/layout/ContentPlaceholder.d.ts +0 -19
- package/src/ui/layout/ContentPlaceholder.js +0 -105
- package/src/ui/layout/ContentPlaceholder.spec.js +0 -579
- package/src/ui/layout/FirstVisibleChildLayout.d.ts +0 -4
- package/src/ui/layout/FirstVisibleChildLayout.js +0 -66
- package/src/ui/layout/FirstVisibleChildLayout.spec.js +0 -196
- package/src/ui/layout/LabelsLeftLayout.d.ts +0 -11
- package/src/ui/layout/LabelsLeftLayout.js +0 -59
- package/src/ui/layout/LabelsTopLayout.d.ts +0 -15
- package/src/ui/layout/LabelsTopLayout.js +0 -135
- package/src/ui/layout/UseParentLayout.d.ts +0 -4
- package/src/ui/layout/UseParentLayout.js +0 -6
- package/src/ui/layout/exploreChildren.d.ts +0 -12
- package/src/ui/layout/exploreChildren.js +0 -27
- package/src/ui/layout/index.js +0 -10
- package/src/ui/selection/KeySelection.d.ts +0 -17
- package/src/ui/selection/KeySelection.js +0 -129
- package/src/ui/selection/PropertySelection.d.ts +0 -17
- package/src/ui/selection/PropertySelection.js +0 -55
- package/src/ui/selection/Selection.d.ts +0 -27
- package/src/ui/selection/Selection.js +0 -93
- package/src/ui/selection/index.js +0 -3
- package/src/ui/tpl.d.ts +0 -3
- package/src/ui/tpl.js +0 -5
- package/src/util/Component.d.ts +0 -42
- package/src/util/Component.js +0 -108
- package/src/util/Console.d.ts +0 -4
- package/src/util/Console.js +0 -11
- package/src/util/DOM.d.ts +0 -33
- package/src/util/DOM.js +0 -72
- package/src/util/Debug.d.ts +0 -11
- package/src/util/Debug.js +0 -45
- package/src/util/Format.d.ts +0 -18
- package/src/util/Format.js +0 -270
- package/src/util/Format.spec.js +0 -69
- package/src/util/GlobalCacheIdentifier.js +0 -11
- package/src/util/GlobalCacheldentifier.d.ts +0 -7
- package/src/util/KeyCode.d.ts +0 -21
- package/src/util/KeyCode.js +0 -21
- package/src/util/SubscriberList.d.ts +0 -42
- package/src/util/SubscriberList.js +0 -58
- package/src/util/Timing.d.ts +0 -14
- package/src/util/Timing.js +0 -58
- package/src/util/TraversalStack.js +0 -43
- package/src/util/TraversalStack.spec.js +0 -47
- package/src/util/addEventListenerWithOptions.d.ts +0 -6
- package/src/util/addEventListenerWithOptions.js +0 -9
- package/src/util/browserSupportsPassiveEventHandlers.d.ts +0 -5
- package/src/util/browserSupportsPassiveEventHandlers.js +0 -18
- package/src/util/calculateNaturalElementHeight.d.ts +0 -1
- package/src/util/calculateNaturalElementHeight.js +0 -22
- package/src/util/capitalize.d.ts +0 -1
- package/src/util/capitalize.js +0 -4
- package/src/util/coalesce.d.ts +0 -1
- package/src/util/coalesce.js +0 -6
- package/src/util/color/hslToRgb.d.ts +0 -9
- package/src/util/color/hslToRgb.js +0 -27
- package/src/util/color/index.d.ts +0 -4
- package/src/util/color/parseColor.d.ts +0 -60
- package/src/util/color/parseColor.js +0 -119
- package/src/util/color/rgbToHex.d.ts +0 -9
- package/src/util/color/rgbToHex.js +0 -8
- package/src/util/color/rgbToHsl.d.ts +0 -9
- package/src/util/color/rgbToHsl.js +0 -28
- package/src/util/date/dateDiff.d.ts +0 -8
- package/src/util/date/dateDiff.js +0 -3
- package/src/util/date/diff.d.ts +0 -8
- package/src/util/date/diff.js +0 -7
- package/src/util/date/encodeDate.d.ts +0 -1
- package/src/util/date/encodeDate.js +0 -8
- package/src/util/date/encodeDateWithTimezoneOffset.d.ts +0 -1
- package/src/util/date/encodeDateWithTimezoneOffset.js +0 -19
- package/src/util/date/index.js +0 -11
- package/src/util/date/lowerBoundCheck.d.ts +0 -8
- package/src/util/date/lowerBoundCheck.js +0 -6
- package/src/util/date/maxDate.d.ts +0 -6
- package/src/util/date/maxDate.js +0 -9
- package/src/util/date/minDate.d.ts +0 -6
- package/src/util/date/minDate.js +0 -9
- package/src/util/date/monthStart.d.ts +0 -6
- package/src/util/date/monthStart.js +0 -3
- package/src/util/date/parseDateInvariant.d.ts +0 -3
- package/src/util/date/parseDateInvariant.js +0 -20
- package/src/util/date/sameDate.d.ts +0 -7
- package/src/util/date/sameDate.js +0 -5
- package/src/util/date/upperBoundCheck.d.ts +0 -8
- package/src/util/date/upperBoundCheck.js +0 -6
- package/src/util/date/zeroTime.d.ts +0 -7
- package/src/util/date/zeroTime.js +0 -3
- package/src/util/debounce.d.ts +0 -9
- package/src/util/debounce.js +0 -18
- package/src/util/dummyCallback.d.ts +0 -1
- package/src/util/dummyCallback.js +0 -1
- package/src/util/escapeSpecialRegexCharacters.d.ts +0 -7
- package/src/util/escapeSpecialRegexCharacters.js +0 -3
- package/src/util/eventCallbacks.d.ts +0 -5
- package/src/util/eventCallbacks.js +0 -2
- package/src/util/expandFatArrows.d.ts +0 -1
- package/src/util/expandFatArrows.js +0 -118
- package/src/util/findScrollableParent.d.ts +0 -1
- package/src/util/findScrollableParent.js +0 -16
- package/src/util/getActiveElement.d.ts +0 -1
- package/src/util/getActiveElement.js +0 -4
- package/src/util/getParentFrameBoundingClientRect.d.ts +0 -1
- package/src/util/getParentFrameBoundingClientRect.js +0 -21
- package/src/util/getScrollerBoundingClientRect.d.ts +0 -1
- package/src/util/getScrollerBoundingClientRect.js +0 -22
- package/src/util/getSearchQueryPredicate.d.ts +0 -1
- package/src/util/getSearchQueryPredicate.js +0 -59
- package/src/util/getTopLevelBoundingClientRect.d.ts +0 -1
- package/src/util/getTopLevelBoundingClientRect.js +0 -14
- package/src/util/getVendorPrefix.d.ts +0 -1
- package/src/util/getVendorPrefix.js +0 -26
- package/src/util/index.d.ts +0 -51
- package/src/util/index.js +0 -54
- package/src/util/innerTextTrim.d.ts +0 -7
- package/src/util/innerTextTrim.js +0 -5
- package/src/util/isArray.d.ts +0 -1
- package/src/util/isArray.js +0 -3
- package/src/util/isDefined.d.ts +0 -1
- package/src/util/isDefined.js +0 -3
- package/src/util/isDigit.d.ts +0 -7
- package/src/util/isDigit.js +0 -3
- package/src/util/isFunction.d.ts +0 -1
- package/src/util/isFunction.js +0 -3
- package/src/util/isNonEmptyArray.d.ts +0 -1
- package/src/util/isNonEmptyArray.js +0 -3
- package/src/util/isNumber.d.ts +0 -1
- package/src/util/isNumber.js +0 -3
- package/src/util/isObject.d.ts +0 -1
- package/src/util/isObject.js +0 -3
- package/src/util/isPromise.d.ts +0 -1
- package/src/util/isPromise.js +0 -6
- package/src/util/isString.d.ts +0 -1
- package/src/util/isString.js +0 -3
- package/src/util/isTextInputElement.d.ts +0 -1
- package/src/util/isTextInputElement.js +0 -3
- package/src/util/isTouchDevice.d.ts +0 -2
- package/src/util/isTouchDevice.js +0 -7
- package/src/util/isTouchEvent.d.ts +0 -4
- package/src/util/isTouchEvent.js +0 -64
- package/src/util/isUndefined.d.ts +0 -1
- package/src/util/isUndefined.js +0 -3
- package/src/util/isValidIdentifierName.d.ts +0 -1
- package/src/util/isValidIdentifierName.js +0 -5
- package/src/util/onIdleCallback.d.ts +0 -1
- package/src/util/onIdleCallback.js +0 -14
- package/src/util/parseStyle.d.ts +0 -4
- package/src/util/parseStyle.js +0 -27
- package/src/util/quote.d.ts +0 -3
- package/src/util/quote.js +0 -4
- package/src/util/reverseSlice.d.ts +0 -1
- package/src/util/reverseSlice.js +0 -10
- package/src/util/routeAppend.d.ts +0 -1
- package/src/util/routeAppend.js +0 -16
- package/src/util/scrollElementIntoView.d.ts +0 -7
- package/src/util/scrollElementIntoView.js +0 -34
- package/src/util/shallowEquals.d.ts +0 -1
- package/src/util/shallowEquals.js +0 -43
- package/src/util/throttle.d.ts +0 -9
- package/src/util/throttle.js +0 -14
- package/src/util/validatedDebounce.js +0 -19
- package/src/widgets/Button.d.ts +0 -58
- package/src/widgets/Button.js +0 -118
- package/src/widgets/CxCredit.d.ts +0 -12
- package/src/widgets/CxCredit.js +0 -32
- package/src/widgets/DocumentTitle.d.ts +0 -11
- package/src/widgets/DocumentTitle.js +0 -69
- package/src/widgets/FlexBox.d.ts +0 -69
- package/src/widgets/FlexBox.js +0 -93
- package/src/widgets/Heading.d.ts +0 -16
- package/src/widgets/Heading.js +0 -33
- package/src/widgets/HighlightedSearchText.d.ts +0 -9
- package/src/widgets/HighlightedSearchText.js +0 -36
- package/src/widgets/HtmlElement.d.ts +0 -30
- package/src/widgets/HtmlElement.js +0 -275
- package/src/widgets/HtmlElement.spec.js +0 -57
- package/src/widgets/Icon.d.ts +0 -34
- package/src/widgets/Icon.js +0 -50
- package/src/widgets/List.d.ts +0 -96
- package/src/widgets/List.js +0 -594
- package/src/widgets/ProgressBar.d.ts +0 -17
- package/src/widgets/ProgressBar.js +0 -46
- package/src/widgets/Resizer.d.ts +0 -27
- package/src/widgets/Resizer.js +0 -151
- package/src/widgets/Sandbox.d.ts +0 -18
- package/src/widgets/Sandbox.js +0 -65
- package/src/widgets/Section.d.ts +0 -52
- package/src/widgets/Section.js +0 -139
- package/src/widgets/autoFocus.d.ts +0 -1
- package/src/widgets/autoFocus.js +0 -9
- package/src/widgets/cx.d.ts +0 -2
- package/src/widgets/cx.js +0 -72
- package/src/widgets/drag-drop/DragHandle.d.ts +0 -10
- package/src/widgets/drag-drop/DragHandle.js +0 -37
- package/src/widgets/drag-drop/DragSource.d.ts +0 -45
- package/src/widgets/drag-drop/DragSource.js +0 -160
- package/src/widgets/drag-drop/DropZone.d.ts +0 -98
- package/src/widgets/drag-drop/DropZone.js +0 -214
- package/src/widgets/drag-drop/index.d.ts +0 -4
- package/src/widgets/drag-drop/ops.d.ts +0 -57
- package/src/widgets/drag-drop/ops.js +0 -344
- package/src/widgets/enableAllInternalDependencies.d.ts +0 -1
- package/src/widgets/enableAllInternalDependencies.js +0 -11
- package/src/widgets/form/Calendar.d.ts +0 -86
- package/src/widgets/form/Calendar.js +0 -618
- package/src/widgets/form/Checkbox.d.ts +0 -43
- package/src/widgets/form/Checkbox.js +0 -203
- package/src/widgets/form/ColorField.d.ts +0 -44
- package/src/widgets/form/ColorField.js +0 -397
- package/src/widgets/form/ColorPicker.d.ts +0 -23
- package/src/widgets/form/ColorPicker.js +0 -485
- package/src/widgets/form/DateField.d.ts +0 -6
- package/src/widgets/form/DateField.js +0 -12
- package/src/widgets/form/DateTimeField.d.ts +0 -89
- package/src/widgets/form/DateTimeField.js +0 -576
- package/src/widgets/form/DateTimePicker.js +0 -392
- package/src/widgets/form/Field.d.ts +0 -112
- package/src/widgets/form/Field.js +0 -446
- package/src/widgets/form/FieldGroup.d.ts +0 -6
- package/src/widgets/form/FieldGroup.js +0 -6
- package/src/widgets/form/FieldIcon.js +0 -42
- package/src/widgets/form/HelpText.d.ts +0 -10
- package/src/widgets/form/HelpText.js +0 -9
- package/src/widgets/form/Label.d.ts +0 -23
- package/src/widgets/form/Label.js +0 -89
- package/src/widgets/form/LabeledContainer.d.ts +0 -9
- package/src/widgets/form/LabeledContainer.js +0 -59
- package/src/widgets/form/LookupField.d.ts +0 -179
- package/src/widgets/form/LookupField.js +0 -1135
- package/src/widgets/form/MonthField.d.ts +0 -104
- package/src/widgets/form/MonthField.js +0 -524
- package/src/widgets/form/MonthPicker.d.ts +0 -97
- package/src/widgets/form/MonthPicker.js +0 -687
- package/src/widgets/form/NumberField.d.ts +0 -96
- package/src/widgets/form/NumberField.js +0 -459
- package/src/widgets/form/Radio.d.ts +0 -37
- package/src/widgets/form/Radio.js +0 -188
- package/src/widgets/form/Select.d.ts +0 -69
- package/src/widgets/form/Select.js +0 -269
- package/src/widgets/form/Slider.d.ts +0 -65
- package/src/widgets/form/Slider.js +0 -351
- package/src/widgets/form/Switch.d.ts +0 -38
- package/src/widgets/form/Switch.js +0 -118
- package/src/widgets/form/TextArea.d.ts +0 -17
- package/src/widgets/form/TextArea.js +0 -195
- package/src/widgets/form/TextField.d.ts +0 -78
- package/src/widgets/form/TextField.js +0 -290
- package/src/widgets/form/TimeField.d.ts +0 -6
- package/src/widgets/form/TimeField.js +0 -11
- package/src/widgets/form/TimeList.js +0 -84
- package/src/widgets/form/UploadButton.d.ts +0 -34
- package/src/widgets/form/UploadButton.js +0 -213
- package/src/widgets/form/ValidationError.d.ts +0 -10
- package/src/widgets/form/ValidationError.js +0 -44
- package/src/widgets/form/ValidationGroup.d.ts +0 -41
- package/src/widgets/form/ValidationGroup.js +0 -68
- package/src/widgets/form/ValidationGroup.spec.js +0 -148
- package/src/widgets/form/Validator.d.ts +0 -8
- package/src/widgets/form/Validator.js +0 -21
- package/src/widgets/form/Wheel.js +0 -261
- package/src/widgets/form/index.d.ts +0 -26
- package/src/widgets/grid/Grid.d.ts +0 -442
- package/src/widgets/grid/Grid.js +0 -3429
- package/src/widgets/grid/GridCell.d.ts +0 -38
- package/src/widgets/grid/GridCell.js +0 -71
- package/src/widgets/grid/GridCellEditor.js +0 -41
- package/src/widgets/grid/GridRow.js +0 -228
- package/src/widgets/grid/GridRowLine.js +0 -24
- package/src/widgets/grid/Pagination.d.ts +0 -14
- package/src/widgets/grid/Pagination.js +0 -95
- package/src/widgets/grid/TreeNode.d.ts +0 -23
- package/src/widgets/grid/TreeNode.js +0 -102
- package/src/widgets/grid/index.d.ts +0 -4
- package/src/widgets/grid/index.js +0 -15
- package/src/widgets/icons/calendar.js +0 -16
- package/src/widgets/icons/check.js +0 -12
- package/src/widgets/icons/clear.js +0 -14
- package/src/widgets/icons/close.js +0 -19
- package/src/widgets/icons/cx.js +0 -37
- package/src/widgets/icons/drop-down.js +0 -14
- package/src/widgets/icons/file.js +0 -12
- package/src/widgets/icons/folder-open.js +0 -14
- package/src/widgets/icons/folder.js +0 -12
- package/src/widgets/icons/forward.js +0 -21
- package/src/widgets/icons/loading.js +0 -23
- package/src/widgets/icons/menu.js +0 -16
- package/src/widgets/icons/pixel-picker.js +0 -17
- package/src/widgets/icons/registry.js +0 -54
- package/src/widgets/icons/search.js +0 -12
- package/src/widgets/icons/sort-asc.js +0 -13
- package/src/widgets/icons/square.js +0 -17
- package/src/widgets/nav/Link.d.ts +0 -26
- package/src/widgets/nav/Link.js +0 -8
- package/src/widgets/nav/LinkButton.d.ts +0 -34
- package/src/widgets/nav/LinkButton.js +0 -128
- package/src/widgets/nav/Menu.d.ts +0 -27
- package/src/widgets/nav/Menu.js +0 -406
- package/src/widgets/nav/MenuItem.d.ts +0 -31
- package/src/widgets/nav/MenuItem.js +0 -445
- package/src/widgets/nav/MenuSpacer.d.ts +0 -5
- package/src/widgets/nav/MenuSpacer.js +0 -13
- package/src/widgets/nav/RedirectRoute.d.ts +0 -9
- package/src/widgets/nav/RedirectRoute.js +0 -41
- package/src/widgets/nav/Route.d.ts +0 -21
- package/src/widgets/nav/Route.js +0 -102
- package/src/widgets/nav/Route.spec.js +0 -27
- package/src/widgets/nav/Scroller.d.ts +0 -17
- package/src/widgets/nav/Scroller.js +0 -214
- package/src/widgets/nav/Submenu.d.ts +0 -6
- package/src/widgets/nav/Submenu.js +0 -6
- package/src/widgets/nav/Tab.d.ts +0 -33
- package/src/widgets/nav/Tab.js +0 -82
- package/src/widgets/nav/index.d.ts +0 -10
- package/src/widgets/overlay/ContextMenu.d.ts +0 -10
- package/src/widgets/overlay/ContextMenu.js +0 -29
- package/src/widgets/overlay/Dropdown.d.ts +0 -32
- package/src/widgets/overlay/Dropdown.js +0 -612
- package/src/widgets/overlay/FlyweightTooltipTracker.d.ts +0 -8
- package/src/widgets/overlay/FlyweightTooltipTracker.js +0 -39
- package/src/widgets/overlay/MsgBox.d.ts +0 -17
- package/src/widgets/overlay/MsgBox.js +0 -116
- package/src/widgets/overlay/Overlay.d.ts +0 -73
- package/src/widgets/overlay/Overlay.js +0 -747
- package/src/widgets/overlay/Toast.d.ts +0 -30
- package/src/widgets/overlay/Toast.js +0 -93
- package/src/widgets/overlay/Tooltip.d.ts +0 -50
- package/src/widgets/overlay/Tooltip.js +0 -308
- package/src/widgets/overlay/Window.d.ts +0 -42
- package/src/widgets/overlay/Window.js +0 -202
- package/src/widgets/overlay/alerts.d.ts +0 -7
- package/src/widgets/overlay/alerts.js +0 -39
- package/src/widgets/overlay/captureMouse.d.ts +0 -54
- package/src/widgets/overlay/captureMouse.js +0 -124
- package/src/widgets/overlay/createHotPromiseWindowFactory.d.ts +0 -18
- package/src/widgets/overlay/createHotPromiseWindowFactory.js +0 -56
- package/src/widgets/overlay/index.js +0 -11
- package/src/widgets/overlay/tooltip-ops.d.ts +0 -11
- package/src/widgets/overlay/tooltip-ops.js +0 -29
- package/svg.d.ts +0 -1
- package/svg.js +0 -1
- package/ui.d.ts +0 -1
- package/ui.js +0 -1
- package/util.d.ts +0 -1
- package/util.js +0 -1
- package/widgets.d.ts +0 -1
- package/widgets.js +0 -1
- /package/src/charts/{index.js → index.ts} +0 -0
- /package/src/data/{Binding.spec.js → Binding.spec.ts} +0 -0
- /package/src/data/{View.spec.js → View.spec.ts} +0 -0
- /package/src/data/{comparer.spec.js → comparer.spec.ts} +0 -0
- /package/src/data/ops/{index.js → index.ts} +0 -0
- /package/src/hooks/{index.d.ts → index.ts} +0 -0
- /package/src/{index.js → index.ts} +0 -0
- /package/src/svg/{index.js → index.ts} +0 -0
- /package/src/svg/util/{index.d.ts → index.ts} +0 -0
- /package/src/ui/adapter/{index.d.ts → index.ts} +0 -0
- /package/src/ui/app/{index.js → index.ts} +0 -0
- /package/src/ui/layout/{index.d.ts → index.ts} +0 -0
- /package/src/ui/selection/{index.d.ts → index.ts} +0 -0
- /package/src/util/color/{index.js → index.ts} +0 -0
- /package/src/util/date/{index.d.ts → index.ts} +0 -0
- /package/src/util/date/{upperBoundCheck.spec.js → upperBoundCheck.spec.ts} +0 -0
- /package/src/util/{getSearchQueryPredicate.spec.js → getSearchQueryPredicate.spec.ts} +0 -0
- /package/src/util/{isValidIdentifierName.spec.js → isValidIdentifierName.spec.ts} +0 -0
- /package/src/util/{routeAppend.spec.js → routeAppend.spec.ts} +0 -0
- /package/src/widgets/drag-drop/{index.js → index.ts} +0 -0
- /package/src/widgets/form/{index.js → index.ts} +0 -0
- /package/src/widgets/icons/{index.js → index.ts} +0 -0
- /package/src/widgets/{index.js → index.ts} +0 -0
- /package/src/widgets/nav/{index.js → index.ts} +0 -0
|
@@ -0,0 +1,1326 @@
|
|
|
1
|
+
/**@jsxImportSource react */
|
|
2
|
+
import { Widget, VDOM, getContent } from "../../ui/Widget";
|
|
3
|
+
import { Cx } from "../../ui/Cx";
|
|
4
|
+
import { Field, getFieldTooltip, FieldInstance } from "./Field";
|
|
5
|
+
import { ReadOnlyDataView } from "../../data/ReadOnlyDataView";
|
|
6
|
+
import { HtmlElement, HtmlElementInstance } from "../HtmlElement";
|
|
7
|
+
import { Binding, BindingInput } from "../../data/Binding";
|
|
8
|
+
import { debug } from "../../util/Debug";
|
|
9
|
+
import { Dropdown, DropdownConfig } from "../overlay/Dropdown";
|
|
10
|
+
import { FocusManager } from "../../ui/FocusManager";
|
|
11
|
+
import { isFocused } from "../../util/DOM";
|
|
12
|
+
import { isTouchDevice } from "../../util/isTouchDevice";
|
|
13
|
+
import { isTouchEvent } from "../../util/isTouchEvent";
|
|
14
|
+
import {
|
|
15
|
+
tooltipParentWillReceiveProps,
|
|
16
|
+
tooltipParentWillUnmount,
|
|
17
|
+
tooltipMouseMove,
|
|
18
|
+
tooltipMouseLeave,
|
|
19
|
+
tooltipParentDidMount,
|
|
20
|
+
} from "../overlay/tooltip-ops";
|
|
21
|
+
import { stopPropagation, preventDefault } from "../../util/eventCallbacks";
|
|
22
|
+
import ClearIcon from "../icons/clear";
|
|
23
|
+
import DropdownIcon from "../icons/drop-down";
|
|
24
|
+
import { getSearchQueryPredicate } from "../../util/getSearchQueryPredicate";
|
|
25
|
+
import { KeyCode } from "../../util/KeyCode";
|
|
26
|
+
import { Localization } from "../../ui/Localization";
|
|
27
|
+
import { StringTemplate } from "../../data/StringTemplate";
|
|
28
|
+
import { Icon } from "../Icon";
|
|
29
|
+
import { isString } from "../../util/isString";
|
|
30
|
+
import { isDefined } from "../../util/isDefined";
|
|
31
|
+
import { isArray } from "../../util/isArray";
|
|
32
|
+
import { isNonEmptyArray } from "../../util/isNonEmptyArray";
|
|
33
|
+
import { addEventListenerWithOptions } from "../../util/addEventListenerWithOptions";
|
|
34
|
+
import { List } from "../List";
|
|
35
|
+
import { Selection } from "../../ui/selection/Selection";
|
|
36
|
+
import { HighlightedSearchText } from "../HighlightedSearchText";
|
|
37
|
+
import { autoFocus } from "../autoFocus";
|
|
38
|
+
import { bind } from "../../ui";
|
|
39
|
+
import { AccessorChain, isAccessorChain } from "../../data/createAccessorModelProxy";
|
|
40
|
+
import type { CxChild, RenderingContext } from "../../ui/RenderingContext";
|
|
41
|
+
import type { DropdownInstance, Instance } from "../../ui/Instance";
|
|
42
|
+
import { FieldConfig } from "./Field";
|
|
43
|
+
import { Prop, BooleanProp, StringProp, DataRecord } from "../../ui/Prop";
|
|
44
|
+
|
|
45
|
+
export interface LookupBinding {
|
|
46
|
+
local: string;
|
|
47
|
+
remote: string;
|
|
48
|
+
key?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface LookupFieldConfig extends FieldConfig {
|
|
52
|
+
multiple?: BooleanProp;
|
|
53
|
+
value?: Prop<number | string>;
|
|
54
|
+
values?: Prop<(number | string)[]>;
|
|
55
|
+
records?: Prop<Record<string, any>[]>;
|
|
56
|
+
text?: StringProp;
|
|
57
|
+
enabled?: BooleanProp;
|
|
58
|
+
placeholder?: StringProp;
|
|
59
|
+
options?: Prop<Record<string, any>[]>;
|
|
60
|
+
hideClear?: boolean;
|
|
61
|
+
showClear?: boolean;
|
|
62
|
+
alwaysShowClear?: boolean;
|
|
63
|
+
baseClass?: string;
|
|
64
|
+
itemConfig?: any;
|
|
65
|
+
bindings?: LookupBinding[];
|
|
66
|
+
queryDelay?: number;
|
|
67
|
+
minQueryLength?: number;
|
|
68
|
+
hideSearchField?: boolean;
|
|
69
|
+
minOptionsForSearchField?: number;
|
|
70
|
+
loadingText?: string;
|
|
71
|
+
queryErrorText?: string;
|
|
72
|
+
noResultsText?: string;
|
|
73
|
+
optionIdField?: string;
|
|
74
|
+
optionTextField?: string;
|
|
75
|
+
valueIdField?: string;
|
|
76
|
+
valueTextField?: string;
|
|
77
|
+
fetchAll?: boolean;
|
|
78
|
+
cacheAll?: boolean;
|
|
79
|
+
closeOnSelect?: boolean;
|
|
80
|
+
minQueryLengthMessageText?: string;
|
|
81
|
+
onQuery?:
|
|
82
|
+
| string
|
|
83
|
+
| ((
|
|
84
|
+
query: string | { query: string; page: number; pageSize: number },
|
|
85
|
+
instance: Instance,
|
|
86
|
+
) => Record<string, any>[] | Promise<Record<string, any>[]>);
|
|
87
|
+
sort?: boolean;
|
|
88
|
+
listOptions?: Record<string, any>;
|
|
89
|
+
autoOpen?: BooleanProp;
|
|
90
|
+
submitOnEnterKey?: BooleanProp;
|
|
91
|
+
submitOnDropdownEnterKey?: BooleanProp;
|
|
92
|
+
pageSize?: number;
|
|
93
|
+
infinite?: boolean;
|
|
94
|
+
quickSelectAll?: boolean;
|
|
95
|
+
onGetRecordDisplayText?: ((record: Record<string, any>, instance: Instance) => string) | null;
|
|
96
|
+
onCreateVisibleOptionsFilter?:
|
|
97
|
+
| string
|
|
98
|
+
| ((filterParams: unknown, instance: Instance) => (option: Record<string, any>) => boolean);
|
|
99
|
+
|
|
100
|
+
/** Additional configuration to be passed to the dropdown. */
|
|
101
|
+
dropdownOptions?: Partial<DropdownConfig>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export class LookupField<Config extends LookupFieldConfig = LookupFieldConfig> extends Field<Config> {
|
|
105
|
+
declare public baseClass: string;
|
|
106
|
+
declare public multiple: boolean;
|
|
107
|
+
declare public hideClear?: boolean;
|
|
108
|
+
declare public showClear: boolean;
|
|
109
|
+
declare public alwaysShowClear: boolean;
|
|
110
|
+
declare public hideSearchField: boolean;
|
|
111
|
+
declare public minOptionsForSearchField: number;
|
|
112
|
+
declare public loadingText: string;
|
|
113
|
+
declare public queryErrorText: string;
|
|
114
|
+
declare public noResultsText: string;
|
|
115
|
+
declare public optionIdField: string;
|
|
116
|
+
declare public optionTextField: string;
|
|
117
|
+
declare public valueIdField: string;
|
|
118
|
+
declare public valueTextField: string;
|
|
119
|
+
declare public fetchAll: boolean;
|
|
120
|
+
declare public cacheAll: boolean;
|
|
121
|
+
declare public closeOnSelect: boolean;
|
|
122
|
+
declare public minQueryLengthMessageText: string;
|
|
123
|
+
declare public sort?: boolean;
|
|
124
|
+
declare public listOptions?: Record<string, any> | null;
|
|
125
|
+
declare public autoOpen?: boolean;
|
|
126
|
+
declare public submitOnEnterKey?: boolean;
|
|
127
|
+
declare public submitOnDropdownEnterKey?: boolean;
|
|
128
|
+
declare public pageSize: number;
|
|
129
|
+
declare public infinite?: boolean;
|
|
130
|
+
declare public quickSelectAll?: boolean;
|
|
131
|
+
declare public queryDelay: number;
|
|
132
|
+
declare public minQueryLength: number;
|
|
133
|
+
declare public onGetRecordDisplayText?: ((record: Record<string, any>, instance: Instance) => string) | null;
|
|
134
|
+
declare public onQuery?:
|
|
135
|
+
| string
|
|
136
|
+
| ((
|
|
137
|
+
params: string | { query: string; page: number; pageSize: number },
|
|
138
|
+
instance: Instance,
|
|
139
|
+
) => Promise<Record<string, any>[]> | Record<string, any>[]);
|
|
140
|
+
declare public onCreateVisibleOptionsFilter?:
|
|
141
|
+
| string
|
|
142
|
+
| ((filterParams: unknown, instance: Instance) => (option: Record<string, any>) => boolean);
|
|
143
|
+
declare public value?: BindingInput;
|
|
144
|
+
declare public text?: BindingInput<string>;
|
|
145
|
+
declare public records?: Record<string, any>[];
|
|
146
|
+
declare public values?: unknown[];
|
|
147
|
+
declare public options?: Record<string, any>[];
|
|
148
|
+
|
|
149
|
+
declare public enabled?: boolean;
|
|
150
|
+
declare public placeholder?: string;
|
|
151
|
+
declare public readOnly?: boolean;
|
|
152
|
+
declare public dropdownOptions?: Partial<DropdownConfig>;
|
|
153
|
+
declare public bindings?: BindingConfig[];
|
|
154
|
+
declare public keyBindings?: BindingConfig[];
|
|
155
|
+
declare public itemConfig?: CxChild;
|
|
156
|
+
|
|
157
|
+
declareData(...args: Record<string, any>[]): void {
|
|
158
|
+
let additionalAttributes = this.multiple
|
|
159
|
+
? { values: undefined, records: undefined }
|
|
160
|
+
: { value: undefined, text: undefined };
|
|
161
|
+
|
|
162
|
+
super.declareData(
|
|
163
|
+
{
|
|
164
|
+
disabled: undefined,
|
|
165
|
+
enabled: undefined,
|
|
166
|
+
placeholder: undefined,
|
|
167
|
+
required: undefined,
|
|
168
|
+
options: undefined,
|
|
169
|
+
icon: undefined,
|
|
170
|
+
autoOpen: undefined,
|
|
171
|
+
readOnly: undefined,
|
|
172
|
+
filterParams: { structured: true },
|
|
173
|
+
},
|
|
174
|
+
additionalAttributes,
|
|
175
|
+
...args,
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
init(): void {
|
|
180
|
+
if (isDefined(this.hideClear)) this.showClear = !this.hideClear;
|
|
181
|
+
|
|
182
|
+
if (this.alwaysShowClear) this.showClear = true;
|
|
183
|
+
|
|
184
|
+
if (!this.bindings) {
|
|
185
|
+
let b: BindingConfig[] = [];
|
|
186
|
+
if (this.value) {
|
|
187
|
+
if (isAccessorChain(this.value)) this.value = bind(this.value);
|
|
188
|
+
if ((this.value as any).bind)
|
|
189
|
+
b.push({
|
|
190
|
+
key: true,
|
|
191
|
+
local: (this.value as any).bind,
|
|
192
|
+
remote: `$option.${this.optionIdField}`,
|
|
193
|
+
set: (this.value as any).set,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (this.text as string | AccessorChain<unknown>) {
|
|
198
|
+
if (isAccessorChain(this.text)) this.text = bind(this.text);
|
|
199
|
+
if ((this.text as any).bind)
|
|
200
|
+
b.push({
|
|
201
|
+
local: (this.text as any).bind,
|
|
202
|
+
remote: `$option.${this.optionTextField}`,
|
|
203
|
+
set: (this.text as any).set,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
this.bindings = b;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (this.bindings.length == 0 && this.multiple)
|
|
211
|
+
this.bindings = [
|
|
212
|
+
{
|
|
213
|
+
key: true,
|
|
214
|
+
local: `$value.${this.valueIdField}`,
|
|
215
|
+
remote: `$option.${this.optionIdField}`,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
local: `$value.${this.valueTextField}`,
|
|
219
|
+
remote: `$option.${this.optionTextField}`,
|
|
220
|
+
},
|
|
221
|
+
];
|
|
222
|
+
|
|
223
|
+
this.keyBindings = this.bindings.filter((b) => b.key);
|
|
224
|
+
|
|
225
|
+
if (!this.items && !this.children)
|
|
226
|
+
this.items = {
|
|
227
|
+
type: HighlightedSearchText,
|
|
228
|
+
text: { bind: `$option.${this.optionTextField}` },
|
|
229
|
+
query: { bind: "$query" },
|
|
230
|
+
} as any;
|
|
231
|
+
|
|
232
|
+
this.itemConfig = this.children || this.items;
|
|
233
|
+
|
|
234
|
+
this.items = [];
|
|
235
|
+
delete this.children;
|
|
236
|
+
|
|
237
|
+
super.init();
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
prepareData(context: RenderingContext, instance: FieldInstance<LookupField>): void {
|
|
241
|
+
let { data, store } = instance;
|
|
242
|
+
|
|
243
|
+
data.stateMods = {
|
|
244
|
+
multiple: this.multiple,
|
|
245
|
+
single: !this.multiple,
|
|
246
|
+
disabled: data.disabled,
|
|
247
|
+
readonly: data.readOnly,
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
data.visibleOptions = data.options;
|
|
251
|
+
if (this.onCreateVisibleOptionsFilter && isArray(data.options)) {
|
|
252
|
+
let filterPredicate = instance.invoke("onCreateVisibleOptionsFilter", data.filterParams, instance);
|
|
253
|
+
data.visibleOptions = data.options.filter(filterPredicate);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
data.selectedKeys = [];
|
|
257
|
+
|
|
258
|
+
if (this.multiple) {
|
|
259
|
+
if (isArray(data.values) && isArray(data.options)) {
|
|
260
|
+
data.selectedKeys = data.values.map((v) => (this.keyBindings!.length == 1 ? [v] : v));
|
|
261
|
+
let map: Record<number, Record<string, any>> = {};
|
|
262
|
+
data.options.filter(($option) => {
|
|
263
|
+
let optionKey = getOptionKey(this.keyBindings!, { $option });
|
|
264
|
+
for (let i = 0; i < data.selectedKeys.length; i++)
|
|
265
|
+
if (areKeysEqual(optionKey, data.selectedKeys[i])) {
|
|
266
|
+
map[i] = convertOption(this.bindings!, { $option });
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
data.records = [];
|
|
271
|
+
for (let i = 0; i < data.selectedKeys.length; i++) if (map[i]) data.records.push(map[i]);
|
|
272
|
+
} else if (isArray(data.records))
|
|
273
|
+
data.selectedKeys.push(
|
|
274
|
+
...data.records.map(($value) => this.keyBindings!.map((b) => Binding.get(b.local).value({ $value }))),
|
|
275
|
+
);
|
|
276
|
+
} else {
|
|
277
|
+
let dataViewData = store.getData();
|
|
278
|
+
data.selectedKeys.push(this.keyBindings!.map((b) => Binding.get(b.local).value(dataViewData)));
|
|
279
|
+
if (!this.text && isArray(data.options)) {
|
|
280
|
+
let option = data.options.find(($option) =>
|
|
281
|
+
areKeysEqual(getOptionKey(this.keyBindings!, { $option }), data.selectedKeys[0]),
|
|
282
|
+
);
|
|
283
|
+
data.text = (option && (option as any)[this.optionTextField!]) || "";
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
(instance as DropdownInstance).lastDropdown = context.lastDropdown;
|
|
288
|
+
|
|
289
|
+
super.prepareData(context, instance);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
renderInput(context: RenderingContext, instance: FieldInstance<LookupField>, key: string): React.ReactNode {
|
|
293
|
+
return (
|
|
294
|
+
<LookupComponent
|
|
295
|
+
key={key}
|
|
296
|
+
multiple={this.multiple!}
|
|
297
|
+
instance={instance}
|
|
298
|
+
itemConfig={this.itemConfig}
|
|
299
|
+
bindings={this.bindings!}
|
|
300
|
+
baseClass={this.baseClass!}
|
|
301
|
+
label={this.labelPlacement && getContent(this.renderLabel(context, instance, "label"))}
|
|
302
|
+
help={this.helpPlacement && getContent(this.renderHelp(context, instance, "help"))}
|
|
303
|
+
forceUpdate={context.forceUpdate}
|
|
304
|
+
icon={this.renderIcon(context, instance, "icon")}
|
|
305
|
+
/>
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
filterOptions(instance: Instance, options: DataRecord[], query?: string): DataRecord[] {
|
|
310
|
+
if (!query) return options;
|
|
311
|
+
let textPredicate = getSearchQueryPredicate(query);
|
|
312
|
+
return options.filter(
|
|
313
|
+
(o) => isString(o[this.optionTextField!]) && textPredicate((o as any)[this.optionTextField!] as string),
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
isEmpty(data: Record<string, any>): boolean {
|
|
318
|
+
if (this.multiple) return !isNonEmptyArray(data.values) && !isNonEmptyArray(data.records);
|
|
319
|
+
return super.isEmpty(data);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
getValidationValue(data: Record<string, any>): unknown {
|
|
323
|
+
if (this.multiple) return data.records ?? data.values;
|
|
324
|
+
return super.getValidationValue(data);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
formatValue(context: RenderingContext, instance: Instance): string | React.ReactNode {
|
|
328
|
+
if (!this.multiple) return super.formatValue(context, instance);
|
|
329
|
+
|
|
330
|
+
let { records, values, options } = instance.data;
|
|
331
|
+
if (isArray(records)) {
|
|
332
|
+
let valueTextFormatter =
|
|
333
|
+
typeof this.onGetRecordDisplayText === "function"
|
|
334
|
+
? this.onGetRecordDisplayText
|
|
335
|
+
: (record: Record<string, any>) =>
|
|
336
|
+
(record as any)[this.valueTextField!] || (record as any)[this.valueIdField!];
|
|
337
|
+
return records.map((record) => valueTextFormatter(record as any, instance));
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (isArray(values)) {
|
|
341
|
+
if (isArray(options))
|
|
342
|
+
return values
|
|
343
|
+
.map((id) => {
|
|
344
|
+
let option = options.find((o) => (o as any)[this.optionIdField!] == id);
|
|
345
|
+
return option ? (option as any)[this.valueTextField!] : id;
|
|
346
|
+
})
|
|
347
|
+
.filter(Boolean)
|
|
348
|
+
.join(", ");
|
|
349
|
+
|
|
350
|
+
return values.join(", ");
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
LookupField.prototype.baseClass = "lookupfield";
|
|
358
|
+
//LookupField.prototype.memoize = false;
|
|
359
|
+
LookupField.prototype.multiple = false;
|
|
360
|
+
LookupField.prototype.queryDelay = 150;
|
|
361
|
+
LookupField.prototype.minQueryLength = 0;
|
|
362
|
+
LookupField.prototype.hideSearchField = false;
|
|
363
|
+
LookupField.prototype.minOptionsForSearchField = 7;
|
|
364
|
+
LookupField.prototype.loadingText = "Loading...";
|
|
365
|
+
LookupField.prototype.queryErrorText = "Error occurred while querying for lookup data.";
|
|
366
|
+
LookupField.prototype.noResultsText = "No results found.";
|
|
367
|
+
LookupField.prototype.optionIdField = "id";
|
|
368
|
+
LookupField.prototype.optionTextField = "text";
|
|
369
|
+
LookupField.prototype.valueIdField = "id";
|
|
370
|
+
LookupField.prototype.valueTextField = "text";
|
|
371
|
+
LookupField.prototype.suppressErrorsUntilVisited = true;
|
|
372
|
+
LookupField.prototype.fetchAll = false;
|
|
373
|
+
LookupField.prototype.cacheAll = false;
|
|
374
|
+
LookupField.prototype.showClear = true;
|
|
375
|
+
LookupField.prototype.alwaysShowClear = false;
|
|
376
|
+
LookupField.prototype.closeOnSelect = true;
|
|
377
|
+
LookupField.prototype.minQueryLengthMessageText = "Type in at least {0} character(s).";
|
|
378
|
+
LookupField.prototype.icon = null;
|
|
379
|
+
LookupField.prototype.sort = false;
|
|
380
|
+
LookupField.prototype.listOptions = null;
|
|
381
|
+
LookupField.prototype.autoOpen = false;
|
|
382
|
+
LookupField.prototype.submitOnEnterKey = false;
|
|
383
|
+
LookupField.prototype.submitOnDropdownEnterKey = false;
|
|
384
|
+
LookupField.prototype.pageSize = 100;
|
|
385
|
+
LookupField.prototype.infinite = false;
|
|
386
|
+
LookupField.prototype.quickSelectAll = false;
|
|
387
|
+
LookupField.prototype.onGetRecordDisplayText = null;
|
|
388
|
+
|
|
389
|
+
Localization.registerPrototype("cx/widgets/LookupField", LookupField);
|
|
390
|
+
|
|
391
|
+
Widget.alias("lookupfield", LookupField);
|
|
392
|
+
|
|
393
|
+
interface BindingConfig {
|
|
394
|
+
local: string;
|
|
395
|
+
remote: string;
|
|
396
|
+
key?: boolean;
|
|
397
|
+
set?: (value: unknown, instance: Instance) => void;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function getOptionKey(bindings: BindingConfig[], data: Record<string, any>): unknown[] {
|
|
401
|
+
return bindings.filter((a) => a.key).map((b) => Binding.get(b.remote).value(data));
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
function areKeysEqual(key1: unknown[], key2: unknown[]): boolean {
|
|
405
|
+
if (!key1 || !key2 || key1.length != key2.length) return false;
|
|
406
|
+
|
|
407
|
+
for (let i = 0; i < key1.length; i++) if (key1[i] !== key2[i]) return false;
|
|
408
|
+
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
function convertOption(bindings: BindingConfig[], data: Record<string, any>): Record<string, any> {
|
|
413
|
+
let result: Record<string, any> = { $value: {} };
|
|
414
|
+
bindings.forEach((b) => {
|
|
415
|
+
let value = Binding.get(b.remote).value(data);
|
|
416
|
+
result = Binding.get(b.local).set(result, value);
|
|
417
|
+
});
|
|
418
|
+
return result.$value as Record<string, any>;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
class SelectionDelegate extends Selection {
|
|
422
|
+
delegate: (record: Record<string, any>, index: number) => boolean;
|
|
423
|
+
|
|
424
|
+
constructor({ delegate }: { delegate: (record: Record<string, any>, index: number) => boolean }) {
|
|
425
|
+
super();
|
|
426
|
+
this.delegate = delegate;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
getIsSelectedDelegate(store: unknown): (record: Record<string, any>, index: number) => boolean {
|
|
430
|
+
return (record: Record<string, any>, index: number) => this.delegate(record, index);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
select(): boolean {
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
interface LookupComponentProps {
|
|
439
|
+
instance: FieldInstance<LookupField>;
|
|
440
|
+
multiple: boolean;
|
|
441
|
+
itemConfig: unknown;
|
|
442
|
+
bindings: BindingConfig[];
|
|
443
|
+
baseClass: string;
|
|
444
|
+
label?: React.ReactNode;
|
|
445
|
+
help?: React.ReactNode;
|
|
446
|
+
forceUpdate: () => void;
|
|
447
|
+
icon?: React.ReactNode;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
interface LookupComponentState {
|
|
451
|
+
options: unknown[];
|
|
452
|
+
formatted?: string;
|
|
453
|
+
value?: string;
|
|
454
|
+
dropdownOpen: boolean;
|
|
455
|
+
focus: boolean;
|
|
456
|
+
status?: string;
|
|
457
|
+
message?: string;
|
|
458
|
+
query?: string;
|
|
459
|
+
page?: number;
|
|
460
|
+
hover?: boolean;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
class LookupComponent extends VDOM.Component<LookupComponentProps, LookupComponentState> {
|
|
464
|
+
dom: {
|
|
465
|
+
input?: HTMLDivElement | null;
|
|
466
|
+
dropdown?: HTMLDivElement | null;
|
|
467
|
+
list?: HTMLDivElement | null;
|
|
468
|
+
query?: HTMLInputElement | null;
|
|
469
|
+
} = {};
|
|
470
|
+
itemStore: ReadOnlyDataView;
|
|
471
|
+
dropdown?: Widget;
|
|
472
|
+
list?: Widget;
|
|
473
|
+
listKeyDown?: (e: React.KeyboardEvent) => void;
|
|
474
|
+
queryTimeoutId?: ReturnType<typeof setTimeout>;
|
|
475
|
+
cachedResult?: Record<string, any>[];
|
|
476
|
+
tmpCachedResult?: Record<string, any>[];
|
|
477
|
+
lastQueryId?: number;
|
|
478
|
+
lastQuery?: string;
|
|
479
|
+
extraPageLoadingBlocker?: string | false;
|
|
480
|
+
unsubscribeListOnWheel?: (() => void) | null;
|
|
481
|
+
unsubscribeListOnScroll?: (() => void) | null;
|
|
482
|
+
|
|
483
|
+
constructor(props: LookupComponentProps) {
|
|
484
|
+
super(props);
|
|
485
|
+
let { data, store } = this.props.instance;
|
|
486
|
+
this.dom = {};
|
|
487
|
+
this.state = {
|
|
488
|
+
options: [],
|
|
489
|
+
formatted: data.formatted,
|
|
490
|
+
value: data.formatted,
|
|
491
|
+
dropdownOpen: false,
|
|
492
|
+
focus: false,
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
this.itemStore = new ReadOnlyDataView({
|
|
496
|
+
store: store,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
getOptionKey(data: Record<string, any>): unknown[] {
|
|
501
|
+
return this.props.bindings.filter((a) => a.key).map((b) => Binding.get(b.remote).value(data));
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
getLocalKey(data: Record<string, any>): unknown[] {
|
|
505
|
+
return this.props.bindings.filter((a) => a.key).map((b) => Binding.get(b.local).value(data));
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
findOption(options: Record<string, any>[], key: unknown[]): number {
|
|
509
|
+
if (!key) return -1;
|
|
510
|
+
for (let i = 0; i < options.length; i++) {
|
|
511
|
+
let optionKey = this.getOptionKey({ $option: options[i] });
|
|
512
|
+
if (areKeysEqual(key, optionKey)) return i;
|
|
513
|
+
}
|
|
514
|
+
return -1;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
getDropdown(): Widget {
|
|
518
|
+
if (this.dropdown) return this.dropdown;
|
|
519
|
+
|
|
520
|
+
let { widget }: { widget: LookupField } = this.props.instance as unknown as { widget: LookupField };
|
|
521
|
+
let { lastDropdown } = this.props.instance as DropdownInstance;
|
|
522
|
+
|
|
523
|
+
this.list = Widget.create({
|
|
524
|
+
type: List,
|
|
525
|
+
sortField: widget.sort && widget.optionTextField,
|
|
526
|
+
sortDirection: "ASC",
|
|
527
|
+
mod: "dropdown",
|
|
528
|
+
scrollSelectionIntoView: true,
|
|
529
|
+
cached: widget.infinite,
|
|
530
|
+
...widget.listOptions,
|
|
531
|
+
records: bind("$options"),
|
|
532
|
+
recordName: "$option",
|
|
533
|
+
onItemClick: (e: React.MouseEvent, inst: Instance) => this.onItemClick(e, inst),
|
|
534
|
+
pipeKeyDown: (kd: (e: React.KeyboardEvent) => void) => {
|
|
535
|
+
this.listKeyDown = kd;
|
|
536
|
+
},
|
|
537
|
+
selectOnTab: true,
|
|
538
|
+
focusable: false,
|
|
539
|
+
selection: {
|
|
540
|
+
type: SelectionDelegate,
|
|
541
|
+
delegate: (data: any) =>
|
|
542
|
+
this.props.instance.data.selectedKeys.find((x: any) =>
|
|
543
|
+
areKeysEqual(x, this.getOptionKey({ $option: data })),
|
|
544
|
+
) != null,
|
|
545
|
+
},
|
|
546
|
+
children: this.props.itemConfig,
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
let dropdown = {
|
|
550
|
+
constrain: true,
|
|
551
|
+
scrollTracking: true,
|
|
552
|
+
inline: !isTouchDevice() || !!lastDropdown,
|
|
553
|
+
placementOrder: "down-right down-left up-right up-left",
|
|
554
|
+
...widget.dropdownOptions,
|
|
555
|
+
type: Dropdown,
|
|
556
|
+
relatedElement: this.dom.input,
|
|
557
|
+
renderChildren: () => this.renderDropdownContents(),
|
|
558
|
+
onFocusOut: (e: React.MouseEvent) => this.closeDropdown(e),
|
|
559
|
+
memoize: false,
|
|
560
|
+
touchFriendly: isTouchDevice(),
|
|
561
|
+
onMeasureNaturalContentSize: () => {
|
|
562
|
+
if (this.dom.dropdown && this.dom.list) {
|
|
563
|
+
return {
|
|
564
|
+
height:
|
|
565
|
+
this.dom.dropdown.offsetHeight -
|
|
566
|
+
this.dom.list.offsetHeight +
|
|
567
|
+
((this.dom.list.firstElementChild as HTMLElement)?.offsetHeight || 0),
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
onDismissAfterScroll: () => {
|
|
572
|
+
this.closeDropdown(null, true);
|
|
573
|
+
return false;
|
|
574
|
+
},
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
return (this.dropdown = Widget.create(dropdown));
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
renderDropdownContents(): React.ReactNode {
|
|
581
|
+
let content;
|
|
582
|
+
let { instance } = this.props;
|
|
583
|
+
let { data, widget }: { data: Record<string, any>; widget: LookupField } = instance as unknown as {
|
|
584
|
+
data: Record<string, any>;
|
|
585
|
+
widget: LookupField;
|
|
586
|
+
};
|
|
587
|
+
let { CSS, baseClass } = widget;
|
|
588
|
+
|
|
589
|
+
let searchVisible =
|
|
590
|
+
!widget.hideSearchField &&
|
|
591
|
+
(!isArray(data.visibleOptions) ||
|
|
592
|
+
(widget.minOptionsForSearchField && data.visibleOptions.length >= widget.minOptionsForSearchField));
|
|
593
|
+
|
|
594
|
+
if (this.state.status == "loading") {
|
|
595
|
+
content = (
|
|
596
|
+
<div key="msg" className={CSS.element(baseClass, "message", "loading")}>
|
|
597
|
+
{widget.loadingText}
|
|
598
|
+
</div>
|
|
599
|
+
);
|
|
600
|
+
} else if (this.state.status == "error") {
|
|
601
|
+
content = (
|
|
602
|
+
<div key="msg" className={CSS.element(baseClass, "message", "error")}>
|
|
603
|
+
{widget.queryErrorText}
|
|
604
|
+
</div>
|
|
605
|
+
);
|
|
606
|
+
} else if (this.state.status == "info") {
|
|
607
|
+
content = (
|
|
608
|
+
<div key="msg" className={CSS.element(baseClass, "message", "info")}>
|
|
609
|
+
{this.state.message}
|
|
610
|
+
</div>
|
|
611
|
+
);
|
|
612
|
+
} else if (this.state.options.length == 0) {
|
|
613
|
+
content = (
|
|
614
|
+
<div key="msg" className={CSS.element(baseClass, "message", "no-results")}>
|
|
615
|
+
{widget.noResultsText}
|
|
616
|
+
</div>
|
|
617
|
+
);
|
|
618
|
+
} else {
|
|
619
|
+
content = (
|
|
620
|
+
<div
|
|
621
|
+
key="msg"
|
|
622
|
+
ref={(el) => {
|
|
623
|
+
this.dom.list = el;
|
|
624
|
+
this.subscribeListOnWheel(el);
|
|
625
|
+
this.subscribeListOnScroll(el);
|
|
626
|
+
}}
|
|
627
|
+
className={CSS.element(baseClass, "scroll-container")}
|
|
628
|
+
>
|
|
629
|
+
<Cx widget={this.list} store={this.itemStore} options={{ name: "lookupfield-list" }} />
|
|
630
|
+
</div>
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
return (
|
|
635
|
+
<div
|
|
636
|
+
key="dropdown"
|
|
637
|
+
ref={(el) => {
|
|
638
|
+
this.dom.dropdown = el as HTMLDivElement;
|
|
639
|
+
}}
|
|
640
|
+
className={CSS.element(baseClass, "dropdown")}
|
|
641
|
+
tabIndex={0}
|
|
642
|
+
onFocus={(e) => this.onDropdownFocus(e)}
|
|
643
|
+
onKeyDown={(e) => this.onDropdownKeyPress(e)}
|
|
644
|
+
>
|
|
645
|
+
{searchVisible && (
|
|
646
|
+
<input
|
|
647
|
+
key="query"
|
|
648
|
+
ref={(el) => {
|
|
649
|
+
this.dom.query = el as HTMLInputElement;
|
|
650
|
+
}}
|
|
651
|
+
type="text"
|
|
652
|
+
className={CSS.element(baseClass, "query")}
|
|
653
|
+
onClick={(e) => {
|
|
654
|
+
e.preventDefault();
|
|
655
|
+
e.stopPropagation();
|
|
656
|
+
}}
|
|
657
|
+
onChange={(e) => this.query(e.target.value)}
|
|
658
|
+
onBlur={(e) => this.onQueryBlur(e)}
|
|
659
|
+
/>
|
|
660
|
+
)}
|
|
661
|
+
{content}
|
|
662
|
+
</div>
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
onListWheel(e: WheelEvent): void {
|
|
667
|
+
let { list } = this.dom;
|
|
668
|
+
if (
|
|
669
|
+
list &&
|
|
670
|
+
((list.scrollTop + list.offsetHeight == list.scrollHeight && e.deltaY > 0) ||
|
|
671
|
+
(list.scrollTop == 0 && e.deltaY < 0))
|
|
672
|
+
) {
|
|
673
|
+
e.preventDefault();
|
|
674
|
+
e.stopPropagation();
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
onListScroll(): void {
|
|
679
|
+
if (!this.dom.list) return;
|
|
680
|
+
var el = this.dom.list;
|
|
681
|
+
if (el.scrollTop > el.scrollHeight - 2 * el.offsetHeight) {
|
|
682
|
+
this.loadAdditionalOptionPages();
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
onDropdownFocus(e: React.FocusEvent): void {
|
|
687
|
+
if (this.dom.query && !isFocused(this.dom.query) && !isTouchDevice()) FocusManager.focus(this.dom.query);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
getPlaceholder(text?: string): React.ReactNode {
|
|
691
|
+
let { CSS, baseClass } = this.props.instance.widget;
|
|
692
|
+
|
|
693
|
+
if (text) return <span className={CSS.element(baseClass, "placeholder")}>{text}</span>;
|
|
694
|
+
|
|
695
|
+
return <span className={CSS.element(baseClass, "placeholder")}> </span>;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
render(): React.ReactNode {
|
|
699
|
+
let { instance, label, help, icon: iconVDOM } = this.props;
|
|
700
|
+
let { data, widget, state } = instance;
|
|
701
|
+
let { CSS, baseClass, suppressErrorsUntilVisited } = widget as LookupField;
|
|
702
|
+
|
|
703
|
+
let icon = iconVDOM && (
|
|
704
|
+
<div
|
|
705
|
+
key="icon"
|
|
706
|
+
className={CSS.element(baseClass, "left-icon")}
|
|
707
|
+
onMouseDown={preventDefault}
|
|
708
|
+
onClick={(e) => {
|
|
709
|
+
this.openDropdown(e);
|
|
710
|
+
e.stopPropagation();
|
|
711
|
+
e.preventDefault();
|
|
712
|
+
}}
|
|
713
|
+
>
|
|
714
|
+
{iconVDOM}
|
|
715
|
+
</div>
|
|
716
|
+
);
|
|
717
|
+
|
|
718
|
+
let dropdown;
|
|
719
|
+
if (this.state.dropdownOpen) {
|
|
720
|
+
this.itemStore.setData({
|
|
721
|
+
$options: this.state.options,
|
|
722
|
+
$query: this.lastQuery,
|
|
723
|
+
});
|
|
724
|
+
dropdown = (
|
|
725
|
+
<Cx widget={this.getDropdown()} store={this.itemStore} options={{ name: "lookupfield-dropdown" }} />
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
let insideButton = null;
|
|
730
|
+
let multipleEntries = this.props.multiple && isArray(data.records) && data.records.length > 1;
|
|
731
|
+
|
|
732
|
+
if (!data.readOnly) {
|
|
733
|
+
if (
|
|
734
|
+
widget.showClear &&
|
|
735
|
+
!data.disabled &&
|
|
736
|
+
!data.empty &&
|
|
737
|
+
(widget.alwaysShowClear || (!data.required && !this.props.multiple) || multipleEntries)
|
|
738
|
+
) {
|
|
739
|
+
insideButton = (
|
|
740
|
+
<div
|
|
741
|
+
key="ib"
|
|
742
|
+
onMouseDown={preventDefault}
|
|
743
|
+
onClick={(e) => (!this.props.multiple ? this.onClearClick(e) : this.onClearMultipleClick(e))}
|
|
744
|
+
className={CSS.element(baseClass, "clear")}
|
|
745
|
+
>
|
|
746
|
+
<ClearIcon className={CSS.element(baseClass, "icon")} />
|
|
747
|
+
</div>
|
|
748
|
+
);
|
|
749
|
+
} else {
|
|
750
|
+
insideButton = (
|
|
751
|
+
<div
|
|
752
|
+
key="ib"
|
|
753
|
+
className={CSS.element(baseClass, "tool")}
|
|
754
|
+
onMouseDown={preventDefault}
|
|
755
|
+
onClick={(e) => {
|
|
756
|
+
this.toggleDropdown(e, true);
|
|
757
|
+
e.stopPropagation();
|
|
758
|
+
e.preventDefault();
|
|
759
|
+
}}
|
|
760
|
+
>
|
|
761
|
+
<DropdownIcon className={CSS.element(baseClass, "icon")} />
|
|
762
|
+
</div>
|
|
763
|
+
);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
let text;
|
|
768
|
+
|
|
769
|
+
if (this.props.multiple) {
|
|
770
|
+
let readOnly = data.disabled || data.readOnly;
|
|
771
|
+
if (isNonEmptyArray(data.records)) {
|
|
772
|
+
let valueTextFormatter =
|
|
773
|
+
widget.onGetRecordDisplayText ??
|
|
774
|
+
((record: Record<string, any>) => record[widget.valueTextField] as string);
|
|
775
|
+
text = data.records.map((v, i) => (
|
|
776
|
+
<div
|
|
777
|
+
key={i}
|
|
778
|
+
className={CSS.element(baseClass, "tag", {
|
|
779
|
+
readonly: readOnly,
|
|
780
|
+
})}
|
|
781
|
+
>
|
|
782
|
+
<span className={CSS.element(baseClass, "tag-value")}>{valueTextFormatter(v, instance)}</span>
|
|
783
|
+
{!readOnly && (
|
|
784
|
+
<div
|
|
785
|
+
className={CSS.element(baseClass, "tag-clear")}
|
|
786
|
+
onMouseDown={(e) => {
|
|
787
|
+
e.preventDefault();
|
|
788
|
+
e.stopPropagation();
|
|
789
|
+
}}
|
|
790
|
+
onClick={(e) => this.onClearClick(e, v)}
|
|
791
|
+
>
|
|
792
|
+
<ClearIcon className={CSS.element(baseClass, "icon")} />
|
|
793
|
+
</div>
|
|
794
|
+
)}
|
|
795
|
+
</div>
|
|
796
|
+
));
|
|
797
|
+
} else {
|
|
798
|
+
text = this.getPlaceholder(data.placeholder);
|
|
799
|
+
}
|
|
800
|
+
} else {
|
|
801
|
+
text = !data.empty ? data.text || this.getPlaceholder() : this.getPlaceholder(data.placeholder);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
let states = {
|
|
805
|
+
visited: state.visited,
|
|
806
|
+
focus: this.state.focus || this.state.dropdownOpen,
|
|
807
|
+
icon: !!iconVDOM,
|
|
808
|
+
empty: !data.placeholder && data.empty,
|
|
809
|
+
error: data.error && (state.visited || !suppressErrorsUntilVisited || !data.empty),
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
return (
|
|
813
|
+
<div
|
|
814
|
+
className={CSS.expand(data.classNames, CSS.state(states))}
|
|
815
|
+
style={data.style}
|
|
816
|
+
onMouseDown={stopPropagation}
|
|
817
|
+
onTouchStart={stopPropagation}
|
|
818
|
+
onKeyDown={(e) => this.onKeyDown(e)}
|
|
819
|
+
>
|
|
820
|
+
<div
|
|
821
|
+
id={data.id}
|
|
822
|
+
className={CSS.expand(CSS.element(widget.baseClass, "input"), data.inputClass)}
|
|
823
|
+
style={data.inputStyle}
|
|
824
|
+
tabIndex={data.disabled ? null : data.tabIndex || 0}
|
|
825
|
+
ref={(el) => {
|
|
826
|
+
this.dom.input = el;
|
|
827
|
+
}}
|
|
828
|
+
aria-labelledby={data.id + "-label"}
|
|
829
|
+
onMouseMove={(e) => tooltipMouseMove(e, ...getFieldTooltip(this.props.instance))}
|
|
830
|
+
onMouseLeave={(e) => tooltipMouseLeave(e, ...getFieldTooltip(this.props.instance))}
|
|
831
|
+
onClick={(e) => this.onClick(e)}
|
|
832
|
+
onKeyDown={(e) => this.onInputKeyDown(e)}
|
|
833
|
+
onMouseDown={(e) => this.onMouseDown(e)}
|
|
834
|
+
onBlur={(e) => this.onBlur(e)}
|
|
835
|
+
onFocus={(e) => this.onFocus(e)}
|
|
836
|
+
>
|
|
837
|
+
{text}
|
|
838
|
+
</div>
|
|
839
|
+
{insideButton}
|
|
840
|
+
{icon}
|
|
841
|
+
{dropdown}
|
|
842
|
+
{label}
|
|
843
|
+
{help}
|
|
844
|
+
</div>
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
onMouseDown(e: React.MouseEvent): void {
|
|
849
|
+
//skip touch start to allow touch scrolling
|
|
850
|
+
if (isTouchEvent()) return;
|
|
851
|
+
e.preventDefault();
|
|
852
|
+
e.stopPropagation();
|
|
853
|
+
this.toggleDropdown(e, true);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
onClick(e: React.MouseEvent): void {
|
|
857
|
+
//mouse down will handle it for non-touch events
|
|
858
|
+
if (!isTouchEvent()) return;
|
|
859
|
+
e.preventDefault();
|
|
860
|
+
e.stopPropagation();
|
|
861
|
+
this.toggleDropdown(e, true);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
onItemClick(
|
|
865
|
+
e: React.KeyboardEvent | React.MouseEvent,
|
|
866
|
+
{ store }: { store: { getData: () => Record<string, any> } },
|
|
867
|
+
): void {
|
|
868
|
+
this.select(e, [store.getData()]);
|
|
869
|
+
if (!this.props.instance.widget.submitOnEnterKey || e.type != "keydown") e.stopPropagation();
|
|
870
|
+
if ((e as React.KeyboardEvent).keyCode != KeyCode.tab) e.preventDefault();
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
onClearClick(e: React.MouseEvent | React.KeyboardEvent, value?: Record<string, any>): void {
|
|
874
|
+
let { instance } = this.props;
|
|
875
|
+
let { data, store, widget } = instance;
|
|
876
|
+
let { keyBindings } = widget;
|
|
877
|
+
e.stopPropagation();
|
|
878
|
+
e.preventDefault();
|
|
879
|
+
if (widget.multiple) {
|
|
880
|
+
if (isArray(data.records)) {
|
|
881
|
+
let itemKey = this.getLocalKey({ $value: value });
|
|
882
|
+
let newRecords = data.records.filter((v) => !areKeysEqual(this.getLocalKey({ $value: v }), itemKey));
|
|
883
|
+
|
|
884
|
+
instance.set("records", newRecords);
|
|
885
|
+
|
|
886
|
+
let newValues = newRecords
|
|
887
|
+
.map((rec) => this.getLocalKey({ $value: rec }))
|
|
888
|
+
.map((k) => (keyBindings!.length == 1 ? k[0] : k));
|
|
889
|
+
|
|
890
|
+
instance.set("values", newValues);
|
|
891
|
+
}
|
|
892
|
+
} else {
|
|
893
|
+
this.props.bindings.forEach((b) => {
|
|
894
|
+
store.set(b.local, widget.emptyValue);
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
if (!isTouchEvent()) this.dom.input!.focus();
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
onClearMultipleClick(e: React.MouseEvent): void {
|
|
902
|
+
let { instance } = this.props;
|
|
903
|
+
instance.set("records", []);
|
|
904
|
+
instance.set("values", []);
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
select(e: React.KeyboardEvent | React.MouseEvent, itemsData: Record<string, any>[], reset?: boolean): void {
|
|
908
|
+
let { instance } = this.props;
|
|
909
|
+
let { store, data, widget } = instance;
|
|
910
|
+
let { bindings, keyBindings } = widget;
|
|
911
|
+
|
|
912
|
+
if (widget.multiple) {
|
|
913
|
+
let { selectedKeys, records } = data;
|
|
914
|
+
|
|
915
|
+
let newRecords = reset ? [] : [...(records || [])];
|
|
916
|
+
let singleSelect = itemsData.length == 1;
|
|
917
|
+
let optionKey: unknown[] | null = null;
|
|
918
|
+
if (singleSelect) optionKey = this.getOptionKey(itemsData[0]);
|
|
919
|
+
|
|
920
|
+
// deselect
|
|
921
|
+
if (singleSelect && selectedKeys.find((k: any) => areKeysEqual(optionKey!, k))) {
|
|
922
|
+
newRecords = records.filter((v: any) => !areKeysEqual(optionKey!, this.getLocalKey({ $value: v })));
|
|
923
|
+
} else {
|
|
924
|
+
itemsData.forEach((itemData) => {
|
|
925
|
+
let valueData: Record<string, any> = {
|
|
926
|
+
$value: {},
|
|
927
|
+
};
|
|
928
|
+
bindings!.forEach((b) => {
|
|
929
|
+
valueData = Binding.get(b.local).set(valueData, Binding.get(b.remote).value(itemData));
|
|
930
|
+
});
|
|
931
|
+
newRecords.push(valueData.$value as Record<string, any>);
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
instance.set("records", newRecords);
|
|
936
|
+
|
|
937
|
+
let newValues = newRecords
|
|
938
|
+
.map((rec) => this.getLocalKey({ $value: rec }))
|
|
939
|
+
.map((k) => (keyBindings!.length == 1 ? k[0] : k));
|
|
940
|
+
|
|
941
|
+
instance.set("values", newValues);
|
|
942
|
+
} else {
|
|
943
|
+
bindings!.forEach((b) => {
|
|
944
|
+
let v = Binding.get(b.remote).value(itemsData[0]);
|
|
945
|
+
if (b.set) b.set(v, instance);
|
|
946
|
+
else store.set(b.local, v);
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
if (widget.closeOnSelect) {
|
|
951
|
+
//Pressing Tab should work it's own thing. Focus will move elsewhere and the dropdown will close.
|
|
952
|
+
if ((e as React.KeyboardEvent).keyCode != KeyCode.tab) {
|
|
953
|
+
if (!isTouchEvent()) this.dom.input!.focus();
|
|
954
|
+
this.closeDropdown(e);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
if ((e as React.KeyboardEvent).keyCode == KeyCode.enter && widget.submitOnDropdownEnterKey) {
|
|
959
|
+
this.submitOnEnter(e as React.KeyboardEvent);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
onDropdownKeyPress(e: React.KeyboardEvent): void {
|
|
964
|
+
switch (e.keyCode) {
|
|
965
|
+
case KeyCode.esc:
|
|
966
|
+
this.closeDropdown(e);
|
|
967
|
+
this.dom.input!.focus();
|
|
968
|
+
break;
|
|
969
|
+
|
|
970
|
+
case KeyCode.tab:
|
|
971
|
+
// if tab needs to do a list selection, we have to first call List's handleKeyDown
|
|
972
|
+
if (this.listKeyDown) this.listKeyDown(e);
|
|
973
|
+
// if next focusable element is disabled, recalculate and update the dom before switching focus
|
|
974
|
+
this.props.forceUpdate();
|
|
975
|
+
break;
|
|
976
|
+
|
|
977
|
+
case KeyCode.a:
|
|
978
|
+
if (!e.ctrlKey) return;
|
|
979
|
+
|
|
980
|
+
let { quickSelectAll, multiple } = this.props.instance.widget;
|
|
981
|
+
if (!quickSelectAll || !multiple) return;
|
|
982
|
+
|
|
983
|
+
let optionsToSelect = this.state.options.map((o) => ({
|
|
984
|
+
$option: o,
|
|
985
|
+
}));
|
|
986
|
+
this.select(e, optionsToSelect, true);
|
|
987
|
+
e.stopPropagation();
|
|
988
|
+
e.preventDefault();
|
|
989
|
+
break;
|
|
990
|
+
|
|
991
|
+
default:
|
|
992
|
+
if (this.listKeyDown) this.listKeyDown(e);
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
onKeyDown(e: React.KeyboardEvent): void {
|
|
998
|
+
switch (e.keyCode) {
|
|
999
|
+
case KeyCode.pageDown:
|
|
1000
|
+
case KeyCode.pageUp:
|
|
1001
|
+
if (this.state.dropdownOpen) e.preventDefault();
|
|
1002
|
+
break;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
onInputKeyDown(e: React.KeyboardEvent): void {
|
|
1007
|
+
let { instance } = this.props;
|
|
1008
|
+
if (instance.widget.handleKeyDown(e, instance) === false) return;
|
|
1009
|
+
|
|
1010
|
+
switch (e.keyCode) {
|
|
1011
|
+
case KeyCode.delete:
|
|
1012
|
+
this.onClearClick(e);
|
|
1013
|
+
return;
|
|
1014
|
+
|
|
1015
|
+
case KeyCode.shift:
|
|
1016
|
+
case KeyCode.ctrl:
|
|
1017
|
+
case KeyCode.tab:
|
|
1018
|
+
case KeyCode.left:
|
|
1019
|
+
case KeyCode.right:
|
|
1020
|
+
case KeyCode.pageUp:
|
|
1021
|
+
case KeyCode.pageDown:
|
|
1022
|
+
case KeyCode.insert:
|
|
1023
|
+
case KeyCode.esc:
|
|
1024
|
+
break;
|
|
1025
|
+
|
|
1026
|
+
case KeyCode.down:
|
|
1027
|
+
this.openDropdown(e);
|
|
1028
|
+
e.stopPropagation();
|
|
1029
|
+
break;
|
|
1030
|
+
|
|
1031
|
+
case KeyCode.enter:
|
|
1032
|
+
if (this.props.instance.widget.submitOnEnterKey) {
|
|
1033
|
+
this.submitOnEnter(e);
|
|
1034
|
+
} else {
|
|
1035
|
+
this.openDropdown(e);
|
|
1036
|
+
}
|
|
1037
|
+
break;
|
|
1038
|
+
|
|
1039
|
+
default:
|
|
1040
|
+
this.openDropdown(e);
|
|
1041
|
+
break;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
onQueryBlur(e: React.FocusEvent): void {
|
|
1046
|
+
FocusManager.nudge();
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
onFocus(e: React.FocusEvent): void {
|
|
1050
|
+
let { instance } = this.props;
|
|
1051
|
+
let { widget } = instance;
|
|
1052
|
+
if (widget.trackFocus) {
|
|
1053
|
+
this.setState({
|
|
1054
|
+
focus: true,
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
if (this.props.instance.data.autoOpen) this.openDropdown(null);
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
onBlur(e: React.FocusEvent): void {
|
|
1062
|
+
if (!this.state.dropdownOpen) this.props.instance.setState({ visited: true });
|
|
1063
|
+
|
|
1064
|
+
if (this.state.focus)
|
|
1065
|
+
this.setState({
|
|
1066
|
+
focus: false,
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
toggleDropdown(e: React.KeyboardEvent | React.MouseEvent, keepFocus?: boolean): void {
|
|
1071
|
+
if (this.state.dropdownOpen) this.closeDropdown(e, keepFocus);
|
|
1072
|
+
else this.openDropdown(e);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
closeDropdown(e?: React.KeyboardEvent | React.MouseEvent | null, keepFocus?: boolean): void {
|
|
1076
|
+
if (this.state.dropdownOpen) {
|
|
1077
|
+
this.setState(
|
|
1078
|
+
{
|
|
1079
|
+
dropdownOpen: false,
|
|
1080
|
+
},
|
|
1081
|
+
() => keepFocus && this.dom.input?.focus(),
|
|
1082
|
+
);
|
|
1083
|
+
|
|
1084
|
+
this.props.instance.setState({
|
|
1085
|
+
visited: true,
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
//delete results valid only while the dropdown is open
|
|
1090
|
+
delete this.tmpCachedResult;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
openDropdown(e: React.KeyboardEvent | React.MouseEvent | null): void {
|
|
1094
|
+
let { instance } = this.props;
|
|
1095
|
+
let { data } = instance;
|
|
1096
|
+
if (!this.state.dropdownOpen && !data.disabled && !data.readOnly) {
|
|
1097
|
+
this.query("");
|
|
1098
|
+
this.setState(
|
|
1099
|
+
{
|
|
1100
|
+
dropdownOpen: true,
|
|
1101
|
+
},
|
|
1102
|
+
() => {
|
|
1103
|
+
if (this.dom.dropdown) this.dom.dropdown.focus();
|
|
1104
|
+
},
|
|
1105
|
+
);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
query(q: string): void {
|
|
1110
|
+
/*
|
|
1111
|
+
In fetchAll mode onQuery should fetch all data and after
|
|
1112
|
+
that everything is done filtering is done client-side.
|
|
1113
|
+
If cacheAll is set results are cached for the lifetime of the
|
|
1114
|
+
widget, otherwise cache is invalidated when dropdown closes.
|
|
1115
|
+
*/
|
|
1116
|
+
|
|
1117
|
+
let { instance } = this.props;
|
|
1118
|
+
let { widget, data } = instance;
|
|
1119
|
+
|
|
1120
|
+
this.lastQuery = q;
|
|
1121
|
+
|
|
1122
|
+
//do not make duplicate queries if fetchAll is enabled
|
|
1123
|
+
if (widget.fetchAll && this.state.status == "loading") return;
|
|
1124
|
+
|
|
1125
|
+
if (this.queryTimeoutId) clearTimeout(this.queryTimeoutId);
|
|
1126
|
+
|
|
1127
|
+
if (q.length < widget.minQueryLength) {
|
|
1128
|
+
this.setState({
|
|
1129
|
+
status: "info",
|
|
1130
|
+
message: StringTemplate.format(widget.minQueryLengthMessageText, widget.minQueryLength),
|
|
1131
|
+
});
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
if (isArray(data.visibleOptions)) {
|
|
1136
|
+
let results = widget.filterOptions(this.props.instance, data.visibleOptions as DataRecord[], q);
|
|
1137
|
+
this.setState({
|
|
1138
|
+
options: results,
|
|
1139
|
+
status: "loaded",
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
if (widget.onQuery) {
|
|
1144
|
+
let { queryDelay, fetchAll, cacheAll, pageSize } = widget;
|
|
1145
|
+
|
|
1146
|
+
if (fetchAll) queryDelay = 0;
|
|
1147
|
+
|
|
1148
|
+
if (!this.cachedResult) {
|
|
1149
|
+
this.setState({
|
|
1150
|
+
status: "loading",
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
this.queryTimeoutId = setTimeout(() => {
|
|
1155
|
+
delete this.queryTimeoutId;
|
|
1156
|
+
|
|
1157
|
+
let result = this.tmpCachedResult || this.cachedResult;
|
|
1158
|
+
let query = fetchAll ? "" : q;
|
|
1159
|
+
let params = !widget.infinite
|
|
1160
|
+
? query
|
|
1161
|
+
: {
|
|
1162
|
+
query,
|
|
1163
|
+
page: 1,
|
|
1164
|
+
pageSize,
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1167
|
+
if (!result) result = instance.invoke("onQuery", params, instance);
|
|
1168
|
+
|
|
1169
|
+
let queryId = (this.lastQueryId = Date.now());
|
|
1170
|
+
|
|
1171
|
+
Promise.resolve(result)
|
|
1172
|
+
.then((results) => {
|
|
1173
|
+
//discard results which do not belong to the last query
|
|
1174
|
+
if (queryId !== this.lastQueryId) return;
|
|
1175
|
+
|
|
1176
|
+
if (!isArray(results)) results = [];
|
|
1177
|
+
|
|
1178
|
+
if (fetchAll) {
|
|
1179
|
+
if (cacheAll) this.cachedResult = results;
|
|
1180
|
+
else this.tmpCachedResult = results;
|
|
1181
|
+
|
|
1182
|
+
results = widget.filterOptions(this.props.instance, results, this.lastQuery);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
this.setState(
|
|
1186
|
+
{
|
|
1187
|
+
page: 1,
|
|
1188
|
+
query,
|
|
1189
|
+
options: results,
|
|
1190
|
+
status: "loaded",
|
|
1191
|
+
},
|
|
1192
|
+
() => {
|
|
1193
|
+
if (widget.infinite) this.onListScroll();
|
|
1194
|
+
},
|
|
1195
|
+
);
|
|
1196
|
+
})
|
|
1197
|
+
.catch((err) => {
|
|
1198
|
+
this.setState({ status: "error" });
|
|
1199
|
+
debug("Lookup query error:", err);
|
|
1200
|
+
});
|
|
1201
|
+
}, queryDelay);
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
loadAdditionalOptionPages(): void {
|
|
1206
|
+
let { instance } = this.props;
|
|
1207
|
+
let { widget } = instance;
|
|
1208
|
+
if (!widget.infinite) return;
|
|
1209
|
+
|
|
1210
|
+
let { query, page, status, options } = this.state;
|
|
1211
|
+
if (!page) page = 1;
|
|
1212
|
+
|
|
1213
|
+
let blockerKey = query;
|
|
1214
|
+
|
|
1215
|
+
if (status != "loaded") return;
|
|
1216
|
+
|
|
1217
|
+
if (options.length < page * widget.pageSize) return; //some pages were not full which means we reached the end
|
|
1218
|
+
|
|
1219
|
+
if (this.extraPageLoadingBlocker === blockerKey) return;
|
|
1220
|
+
|
|
1221
|
+
this.extraPageLoadingBlocker = blockerKey;
|
|
1222
|
+
|
|
1223
|
+
let params = {
|
|
1224
|
+
page: page + 1,
|
|
1225
|
+
query,
|
|
1226
|
+
pageSize: widget.pageSize,
|
|
1227
|
+
};
|
|
1228
|
+
|
|
1229
|
+
var result = instance.invoke("onQuery", params, instance);
|
|
1230
|
+
|
|
1231
|
+
Promise.resolve(result)
|
|
1232
|
+
.then((results) => {
|
|
1233
|
+
//discard results which do not belong to the last query
|
|
1234
|
+
if (this.extraPageLoadingBlocker !== blockerKey) return;
|
|
1235
|
+
|
|
1236
|
+
this.extraPageLoadingBlocker = false;
|
|
1237
|
+
|
|
1238
|
+
if (!isArray(results)) return;
|
|
1239
|
+
|
|
1240
|
+
this.setState(
|
|
1241
|
+
{
|
|
1242
|
+
page: params.page,
|
|
1243
|
+
query,
|
|
1244
|
+
options: [...options, ...results],
|
|
1245
|
+
},
|
|
1246
|
+
() => {
|
|
1247
|
+
this.onListScroll();
|
|
1248
|
+
},
|
|
1249
|
+
);
|
|
1250
|
+
})
|
|
1251
|
+
.catch((err) => {
|
|
1252
|
+
if (this.extraPageLoadingBlocker !== blockerKey) return;
|
|
1253
|
+
this.extraPageLoadingBlocker = false;
|
|
1254
|
+
this.setState({ status: "error" });
|
|
1255
|
+
debug("Lookup query error:", err);
|
|
1256
|
+
console.error(err);
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
UNSAFE_componentWillReceiveProps(props: LookupComponentProps): void {
|
|
1261
|
+
if (this.dom.input) {
|
|
1262
|
+
tooltipParentWillReceiveProps(this.dom.input, ...getFieldTooltip(props.instance));
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
componentDidMount(): void {
|
|
1267
|
+
if (this.dom.input) {
|
|
1268
|
+
tooltipParentDidMount(this.dom.input, ...getFieldTooltip(this.props.instance));
|
|
1269
|
+
autoFocus(this.dom.input, this);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
componentDidUpdate(): void {
|
|
1274
|
+
if (this.dom.input) {
|
|
1275
|
+
autoFocus(this.dom.input, this);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
componentWillUnmount(): void {
|
|
1280
|
+
if (this.queryTimeoutId) clearTimeout(this.queryTimeoutId);
|
|
1281
|
+
tooltipParentWillUnmount(this.props.instance);
|
|
1282
|
+
this.subscribeListOnWheel(null);
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
subscribeListOnWheel(list: HTMLDivElement | null): void {
|
|
1286
|
+
if (this.unsubscribeListOnWheel) {
|
|
1287
|
+
this.unsubscribeListOnWheel();
|
|
1288
|
+
this.unsubscribeListOnWheel = null;
|
|
1289
|
+
}
|
|
1290
|
+
if (list) {
|
|
1291
|
+
this.unsubscribeListOnWheel = addEventListenerWithOptions(
|
|
1292
|
+
list,
|
|
1293
|
+
"wheel",
|
|
1294
|
+
(e) => this.onListWheel(e as WheelEvent),
|
|
1295
|
+
{
|
|
1296
|
+
passive: false,
|
|
1297
|
+
},
|
|
1298
|
+
);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
subscribeListOnScroll(list: HTMLDivElement | null): void {
|
|
1303
|
+
if (this.unsubscribeListOnScroll) {
|
|
1304
|
+
this.unsubscribeListOnScroll();
|
|
1305
|
+
this.unsubscribeListOnScroll = null;
|
|
1306
|
+
}
|
|
1307
|
+
if (list) {
|
|
1308
|
+
this.unsubscribeListOnScroll = addEventListenerWithOptions(list, "scroll", () => this.onListScroll(), {
|
|
1309
|
+
passive: false,
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
submitOnEnter(e: React.KeyboardEvent): void {
|
|
1315
|
+
let instance = this.props.instance.parent;
|
|
1316
|
+
while (instance) {
|
|
1317
|
+
let htmlInstance = instance as HtmlElementInstance;
|
|
1318
|
+
if (htmlInstance.events && htmlInstance.events.onSubmit) {
|
|
1319
|
+
htmlInstance.events.onSubmit(e, instance);
|
|
1320
|
+
break;
|
|
1321
|
+
} else {
|
|
1322
|
+
instance = instance.parent;
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
}
|