react-native-nitro-input 0.4.0 → 0.4.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/CHANGELOG.md +16 -0
- package/README.md +2 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/DigitSlots.kt +143 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +6 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/InputFonts.kt +50 -5
- package/android/src/main/java/com/margelo/nitro/nitroinput/InputSizing.kt +7 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +57 -6
- package/ios/HybridNitroInputView.swift +4 -0
- package/ios/InputSizing.swift +98 -4
- package/ios/NitroInputView.swift +79 -12
- package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +2 -0
- package/lib/commonjs/src/NitroInput.js +3 -1
- package/lib/module/nitrogen/generated/shared/json/NitroInputViewConfig.json +2 -0
- package/lib/module/src/NitroInput.js +3 -1
- package/lib/typescript/src/NitroInput.d.ts +11 -0
- package/lib/typescript/src/specs/NitroInput.nitro.d.ts +4 -0
- package/lib/typescript/src/specs/NitroInputMeasure.nitro.d.ts +2 -0
- package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.cpp +18 -0
- package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/JNitroInputSizing.hpp +9 -1
- package/nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.cpp +10 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroInputViewSpec.kt +12 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputSizing.kt +12 -2
- package/nitrogen/generated/ios/c++/HybridNitroInputViewSpecSwift.hpp +12 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroInputViewComponent.mm +12 -0
- package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec_cxx.swift +22 -0
- package/nitrogen/generated/ios/swift/NitroInputSizing.swift +12 -2
- package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/NitroInputSizing.hpp +9 -1
- package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.cpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.hpp +6 -0
- package/nitrogen/generated/shared/json/NitroInputViewConfig.json +2 -0
- package/package.json +1 -1
- package/src/NitroInput.tsx +14 -0
- package/src/specs/NitroInput.nitro.ts +4 -0
- package/src/specs/NitroInputMeasure.nitro.ts +2 -0
package/ios/NitroInputView.swift
CHANGED
|
@@ -144,6 +144,10 @@ final class NitroInputView: UIView {
|
|
|
144
144
|
var suffixAlign: AffixAlign = .baseline
|
|
145
145
|
/// Points added after every glyph, as `Text`'s letterSpacing; an affix gets it in proportion to its size.
|
|
146
146
|
var letterSpacing: CGFloat = 0
|
|
147
|
+
/// The font's tabular figures rather than its proportional ones.
|
|
148
|
+
var tabularNums = true
|
|
149
|
+
/// Every digit laid out as wide as the widest, centred (`InputMetrics.bodyDigitWidths`): tabular figures for a font without them.
|
|
150
|
+
var slotDigits = false
|
|
147
151
|
/// Points between the prefix and the text, and between the text and the suffix, in place of the letter spacing there.
|
|
148
152
|
var prefixSpacing: CGFloat? = nil
|
|
149
153
|
var suffixSpacing: CGFloat? = nil
|
|
@@ -293,6 +297,9 @@ final class NitroInputView: UIView {
|
|
|
293
297
|
didSet {
|
|
294
298
|
guard alignment != oldValue else { return }
|
|
295
299
|
field.textAlignment = textAlignment(for: alignment)
|
|
300
|
+
// The new alignment is the field's paragraph style, which the slots' indent rides on.
|
|
301
|
+
applyDigitSlots()
|
|
302
|
+
syncAccessibilityPlaceholder()
|
|
296
303
|
render()
|
|
297
304
|
}
|
|
298
305
|
}
|
|
@@ -677,6 +684,8 @@ final class NitroInputView: UIView {
|
|
|
677
684
|
private struct GlyphEntry {
|
|
678
685
|
let layer: CALayer
|
|
679
686
|
let topOffset: CGFloat
|
|
687
|
+
/// A slotted digit's offset into its advance (`InputMetrics.inset`).
|
|
688
|
+
let leftInset: CGFloat
|
|
680
689
|
/// The render pass that last saw this glyph; one a pass missed has left.
|
|
681
690
|
var generation: UInt
|
|
682
691
|
/// What the layer was last given, so a frame only sets what moved: most
|
|
@@ -791,12 +800,18 @@ final class NitroInputView: UIView {
|
|
|
791
800
|
// field's own copy exists only so an empty field still has an
|
|
792
801
|
// accessibility value, hence clear.
|
|
793
802
|
let color = traits.plain ? typography.placeholderColor : UIColor.clear
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
803
|
+
// Its digits slotted like the text's, or the placeholder is narrower than
|
|
804
|
+
// the field measures it, and a typed digit moves the rest along. In the
|
|
805
|
+
// field's own attributes, which carry its alignment.
|
|
806
|
+
var slotAttributes = field.defaultTextAttributes
|
|
807
|
+
slotAttributes[.foregroundColor] = color
|
|
808
|
+
let next = placeholder.isEmpty
|
|
798
809
|
? nil
|
|
799
|
-
:
|
|
810
|
+
: fonts.metrics.slotted(placeholder, attributes: slotAttributes, lead: false)?.string
|
|
811
|
+
?? NSAttributedString(string: placeholder, attributes: [.foregroundColor: color])
|
|
812
|
+
if let current = field.attributedPlaceholder, let next, current.isEqual(to: next) { return }
|
|
813
|
+
if field.attributedPlaceholder == nil, next == nil { return }
|
|
814
|
+
field.attributedPlaceholder = next
|
|
800
815
|
}
|
|
801
816
|
|
|
802
817
|
override func didMoveToSuperview() {
|
|
@@ -844,6 +859,8 @@ final class NitroInputView: UIView {
|
|
|
844
859
|
private func applyLayoutDirection() {
|
|
845
860
|
engine.setRightToLeft(isRTL)
|
|
846
861
|
field.textAlignment = traits.plain ? textAlignment(for: alignment) : .left
|
|
862
|
+
applyDigitSlots()
|
|
863
|
+
syncAccessibilityPlaceholder()
|
|
847
864
|
if didBuildTextView {
|
|
848
865
|
textView.textAlignment = textAlignment(for: alignment)
|
|
849
866
|
applyTextViewTypography()
|
|
@@ -1313,10 +1330,49 @@ final class NitroInputView: UIView {
|
|
|
1313
1330
|
attributes[.font] = fonts.body
|
|
1314
1331
|
attributes[.foregroundColor] = traits.plain ? typography.color : UIColor.clear
|
|
1315
1332
|
field.defaultTextAttributes = attributes
|
|
1333
|
+
fieldSlotted = false
|
|
1334
|
+
applyDigitSlots()
|
|
1335
|
+
syncAccessibilityPlaceholder()
|
|
1316
1336
|
updateFieldInsets()
|
|
1317
1337
|
applyTextViewTypography()
|
|
1318
1338
|
}
|
|
1319
1339
|
|
|
1340
|
+
/// Whether the field's text carries `applyDigitSlots`' kerning.
|
|
1341
|
+
private var fieldSlotted = false
|
|
1342
|
+
|
|
1343
|
+
/// Lays the field's own digits out in the slots the overlay and the measure
|
|
1344
|
+
/// give them when the font has no tabular figures (`InputMetrics.slotted`):
|
|
1345
|
+
/// plain mode draws that text, and otherwise the caret and the selection
|
|
1346
|
+
/// follow it. Setting `attributedText` moves the selection, so it is put
|
|
1347
|
+
/// back; a composition in progress is left alone until it is committed.
|
|
1348
|
+
private func applyDigitSlots() {
|
|
1349
|
+
guard field.markedTextRange == nil else { return }
|
|
1350
|
+
let current = field.text ?? ""
|
|
1351
|
+
guard !traits.secureTextEntry, !current.isEmpty,
|
|
1352
|
+
let slotted = fonts.metrics.slotted(current, attributes: field.defaultTextAttributes, lead: false)?.string else {
|
|
1353
|
+
if fieldSlotted {
|
|
1354
|
+
// Back to one kerning for the whole text: re-setting the attributes applies them throughout.
|
|
1355
|
+
fieldSlotted = false
|
|
1356
|
+
let attributes = field.defaultTextAttributes
|
|
1357
|
+
field.defaultTextAttributes = attributes
|
|
1358
|
+
}
|
|
1359
|
+
return
|
|
1360
|
+
}
|
|
1361
|
+
if let existing = field.attributedText, existing.isEqual(to: slotted) { return }
|
|
1362
|
+
let start = field.beginningOfDocument
|
|
1363
|
+
let selection = field.selectedTextRange.map { (field.offset(from: start, to: $0.start), field.offset(from: start, to: $0.end)) }
|
|
1364
|
+
let wasSetting = isSettingText
|
|
1365
|
+
isSettingText = true
|
|
1366
|
+
field.attributedText = slotted
|
|
1367
|
+
if let (from, to) = selection,
|
|
1368
|
+
let fromPosition = field.position(from: field.beginningOfDocument, offset: from),
|
|
1369
|
+
let toPosition = field.position(from: field.beginningOfDocument, offset: to) {
|
|
1370
|
+
field.selectedTextRange = field.textRange(from: fromPosition, to: toPosition)
|
|
1371
|
+
}
|
|
1372
|
+
isSettingText = wasSetting
|
|
1373
|
+
fieldSlotted = true
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1320
1376
|
/// In reflow mode the overlay draws the prefix and suffix, so the field only
|
|
1321
1377
|
/// has to reserve the space. In `plain` mode nothing is drawing them, so the
|
|
1322
1378
|
/// field carries them itself as its left/right accessory views — UIKit insets
|
|
@@ -1582,6 +1638,8 @@ final class NitroInputView: UIView {
|
|
|
1582
1638
|
var attributes = field.defaultTextAttributes
|
|
1583
1639
|
attributes[.foregroundColor] = plain ? typography.color : UIColor.clear
|
|
1584
1640
|
field.defaultTextAttributes = attributes
|
|
1641
|
+
fieldSlotted = false
|
|
1642
|
+
applyDigitSlots()
|
|
1585
1643
|
updateFieldInsets()
|
|
1586
1644
|
// Turning plain on tore the overlay down and reset the engine, so on the
|
|
1587
1645
|
// way back it has nothing to draw until the next edit: hand it the text.
|
|
@@ -1678,6 +1736,7 @@ final class NitroInputView: UIView {
|
|
|
1678
1736
|
/// `changed` is false only for the first, unchanged application of the
|
|
1679
1737
|
/// `text` prop (the engine still needs feeding); a keystroke always changes.
|
|
1680
1738
|
private func textDidChange(caret: Int, reason: ChangeReason, changed: Bool = true) {
|
|
1739
|
+
applyDigitSlots()
|
|
1681
1740
|
feedEngine(caret: caret)
|
|
1682
1741
|
if reason != .prop {
|
|
1683
1742
|
eventCount += 1
|
|
@@ -1897,7 +1956,7 @@ final class NitroInputView: UIView {
|
|
|
1897
1956
|
return multiplier
|
|
1898
1957
|
}
|
|
1899
1958
|
|
|
1900
|
-
static func makeFont(size: CGFloat, weight: CGFloat, family: String
|
|
1959
|
+
static func makeFont(size: CGFloat, weight: CGFloat, family: String?, tabular: Bool = true) -> UIFont {
|
|
1901
1960
|
let uiWeight = uiWeight(weight)
|
|
1902
1961
|
let traits: [UIFontDescriptor.TraitKey: Any] = [.weight: uiWeight]
|
|
1903
1962
|
var base: UIFont
|
|
@@ -1910,8 +1969,11 @@ final class NitroInputView: UIView {
|
|
|
1910
1969
|
} else {
|
|
1911
1970
|
base = UIFont.systemFont(ofSize: size, weight: uiWeight)
|
|
1912
1971
|
}
|
|
1913
|
-
// Tabular digits
|
|
1914
|
-
let feature: [UIFontDescriptor.FeatureKey: Int] = [
|
|
1972
|
+
// Tabular digits, so a column keeps its width while its digit reflows, unless asked for the font's own.
|
|
1973
|
+
let feature: [UIFontDescriptor.FeatureKey: Int] = [
|
|
1974
|
+
.type: kNumberSpacingType,
|
|
1975
|
+
.selector: tabular ? kMonospacedNumbersSelector : kProportionalNumbersSelector,
|
|
1976
|
+
]
|
|
1915
1977
|
let descriptor = base.fontDescriptor.addingAttributes([.featureSettings: [feature]])
|
|
1916
1978
|
return UIFont(descriptor: descriptor, size: size)
|
|
1917
1979
|
}
|
|
@@ -1999,7 +2061,10 @@ final class NitroInputView: UIView {
|
|
|
1999
2061
|
if ghostLabel.superview !== field { field.addSubview(ghostLabel) }
|
|
2000
2062
|
var attributes = field.defaultTextAttributes
|
|
2001
2063
|
attributes[.foregroundColor] = typography.placeholderColor.resolvedColor(with: traitCollection)
|
|
2002
|
-
|
|
2064
|
+
// A first slotted digit's half-room before it moves the label instead (`InputMetrics.slotted`).
|
|
2065
|
+
let slotted = fonts.metrics.slotted(tail, attributes: attributes, lead: true)
|
|
2066
|
+
ghostLabel.attributedText = slotted?.string ?? NSAttributedString(string: tail, attributes: attributes)
|
|
2067
|
+
let lead = slotted?.lead ?? 0
|
|
2003
2068
|
let box = field.textRect(forBounds: field.bounds)
|
|
2004
2069
|
let typed = fonts.width(of: text, role: .body) + fonts.bodySpacing * CGFloat(text.unicodeScalars.count)
|
|
2005
2070
|
let tailWidth = fonts.width(of: tail, role: .body) + fonts.bodySpacing * CGFloat(tail.unicodeScalars.count)
|
|
@@ -2014,7 +2079,8 @@ final class NitroInputView: UIView {
|
|
|
2014
2079
|
let end = start + typed
|
|
2015
2080
|
// Text wider than the box scrolls inside the field; the tail has no place then.
|
|
2016
2081
|
ghostLabel.isHidden = typed > box.width
|
|
2017
|
-
ghostLabel.frame = CGRect(x: end, y: box.minY, width: min(tailWidth + 1, max(0, box.maxX - end)),
|
|
2082
|
+
ghostLabel.frame = CGRect(x: end + lead, y: box.minY, width: min(tailWidth - lead + 1, max(0, box.maxX - end - lead)),
|
|
2083
|
+
height: box.height)
|
|
2018
2084
|
}
|
|
2019
2085
|
|
|
2020
2086
|
private func contentWidth() -> CGFloat {
|
|
@@ -2177,14 +2243,15 @@ final class NitroInputView: UIView {
|
|
|
2177
2243
|
glyphLayer.bounds = CGRect(origin: .zero, size: image.size)
|
|
2178
2244
|
}
|
|
2179
2245
|
clipLayer.addSublayer(glyphLayer)
|
|
2180
|
-
glyphLayers[g.id] = GlyphEntry(layer: glyphLayer, topOffset: fonts.top(for: role, text: text, lineTop: 0),
|
|
2246
|
+
glyphLayers[g.id] = GlyphEntry(layer: glyphLayer, topOffset: fonts.top(for: role, text: text, lineTop: 0),
|
|
2247
|
+
leftInset: fonts.metrics.inset(of: text, role: role), generation: generation)
|
|
2181
2248
|
index = glyphLayers.index(forKey: g.id)!
|
|
2182
2249
|
}
|
|
2183
2250
|
let entry = glyphLayers.values[index]
|
|
2184
2251
|
let glyphLayer = entry.layer
|
|
2185
2252
|
let size = glyphLayer.bounds.size
|
|
2186
2253
|
let top = band + entry.topOffset + CGFloat(g.y) * lineHeight
|
|
2187
|
-
let position = CGPoint(x: pad + CGFloat(g.x) + size.width / 2, y: top + size.height / 2)
|
|
2254
|
+
let position = CGPoint(x: pad + CGFloat(g.x) + entry.leftInset + size.width / 2, y: top + size.height / 2)
|
|
2188
2255
|
if position != entry.position {
|
|
2189
2256
|
glyphLayer.position = position
|
|
2190
2257
|
glyphLayers.values[index].position = position
|
|
@@ -252,7 +252,7 @@ function measureSizing(sizing) {
|
|
|
252
252
|
return null;
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
exports.NitroInput = (0, react_1.forwardRef)(function NitroInput({ value, defaultValue, mode, fractionDigits, maxIntegerDigits, groupingSeparator, decimalSeparator, prefix, suffix, prefixFontSize, suffixFontSize, affixAlign, signPlacement, prefixAlign, suffixAlign, letterSpacing: letterSpacingProp, prefixSpacing, suffixSpacing, prefixOffset, suffixOffset, format, placeholder, placeholderTextColor, duration, easing, bounce, effect, fontSize: fontSizeProp, lineHeight: lineHeightProp, fontWeight: fontWeightProp, fontFamily: fontFamilyProp, color: colorProp, textAlign: textAlignProp, cursorColor, selectionColor, caretHidden, adjustsFontSizeToFit, minimumFontScale, allowFontScaling, maxFontSizeMultiplier, variant, label, labelBehavior, labelColor, labelFocusedColor, labelFontSize, strokeColor, focusedStrokeColor, strokeWidth, cornerRadius, fillColor, keyboardType, inputMode, enterKeyHint, mask, maskNotations, maskAutocomplete, maskAutoSkip, maskAffinityFormats, maskAffinityStrategy, maskTextCase, maskCharacterMap, maskSlotPlaceholder, keepPlaceholder, returnKeyType, autoCapitalize, autoCorrect, editable, multiline, numberOfLines, rows, textAlignVertical: textAlignVerticalProp, scrollEnabled, autoFocus, transition, autoWidth: autoWidthProp, submitBehavior, blurOnSubmit, secureTextEntry, keyboardAppearance, textContentType, autoComplete, enablesReturnKeyAutomatically, showSoftInputOnFocus, selectTextOnFocus, clearTextOnFocus, keyboardHandoffMs, returnKeyBar, contextMenuHidden, spellCheck, readOnly, selection, onEndEditing, onSelectionChange, onKeyPress, maxLength, transform, onChangeText, onChange, onChangeValue, onChangeMask, onFocus, onBlur, focusedValue, onSubmitEditing, onNativeRef, style, ...viewProps }, ref) {
|
|
255
|
+
exports.NitroInput = (0, react_1.forwardRef)(function NitroInput({ value, defaultValue, mode, fractionDigits, maxIntegerDigits, groupingSeparator, decimalSeparator, prefix, suffix, prefixFontSize, suffixFontSize, affixAlign, signPlacement, prefixAlign, suffixAlign, letterSpacing: letterSpacingProp, tabularNums, prefixSpacing, suffixSpacing, prefixOffset, suffixOffset, format, placeholder, placeholderTextColor, duration, easing, bounce, effect, fontSize: fontSizeProp, lineHeight: lineHeightProp, fontWeight: fontWeightProp, fontFamily: fontFamilyProp, color: colorProp, textAlign: textAlignProp, cursorColor, selectionColor, caretHidden, adjustsFontSizeToFit, minimumFontScale, allowFontScaling, maxFontSizeMultiplier, variant, label, labelBehavior, labelColor, labelFocusedColor, labelFontSize, strokeColor, focusedStrokeColor, strokeWidth, cornerRadius, fillColor, keyboardType, inputMode, enterKeyHint, mask, maskNotations, maskAutocomplete, maskAutoSkip, maskAffinityFormats, maskAffinityStrategy, maskTextCase, maskCharacterMap, maskSlotPlaceholder, keepPlaceholder, returnKeyType, autoCapitalize, autoCorrect, editable, multiline, numberOfLines, rows, textAlignVertical: textAlignVerticalProp, scrollEnabled, autoFocus, transition, autoWidth: autoWidthProp, submitBehavior, blurOnSubmit, secureTextEntry, keyboardAppearance, textContentType, autoComplete, enablesReturnKeyAutomatically, showSoftInputOnFocus, selectTextOnFocus, clearTextOnFocus, keyboardHandoffMs, returnKeyBar, contextMenuHidden, spellCheck, readOnly, selection, onEndEditing, onSelectionChange, onKeyPress, maxLength, transform, onChangeText, onChange, onChangeValue, onChangeMask, onFocus, onBlur, focusedValue, onSubmitEditing, onNativeRef, style, ...viewProps }, ref) {
|
|
256
256
|
const nativeRef = (0, react_1.useRef)(null);
|
|
257
257
|
// `keyboardHandoffMs`: hand the keyboard off while this field still has it.
|
|
258
258
|
// A layout-effect cleanup runs in React's commit, so the native call is
|
|
@@ -749,6 +749,8 @@ exports.NitroInput = (0, react_1.forwardRef)(function NitroInput({ value, defaul
|
|
|
749
749
|
textWeight: numericWeight,
|
|
750
750
|
textFamily: fontFamily ?? '',
|
|
751
751
|
textLetterSpacing: letterSpacing ?? 0,
|
|
752
|
+
tabularNums: tabularNums ?? !flat?.fontVariant?.includes('proportional-nums'),
|
|
753
|
+
slotDigits: tabularNums === true,
|
|
752
754
|
prefixSpacing: prefixSpacing ?? Infinity,
|
|
753
755
|
suffixSpacing: suffixSpacing ?? Infinity,
|
|
754
756
|
allowFontScaling: allowFontScaling ?? false,
|
|
@@ -213,7 +213,7 @@ function measureSizing(sizing) {
|
|
|
213
213
|
return null;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
export const NitroInput = forwardRef(function NitroInput({ value, defaultValue, mode, fractionDigits, maxIntegerDigits, groupingSeparator, decimalSeparator, prefix, suffix, prefixFontSize, suffixFontSize, affixAlign, signPlacement, prefixAlign, suffixAlign, letterSpacing: letterSpacingProp, prefixSpacing, suffixSpacing, prefixOffset, suffixOffset, format, placeholder, placeholderTextColor, duration, easing, bounce, effect, fontSize: fontSizeProp, lineHeight: lineHeightProp, fontWeight: fontWeightProp, fontFamily: fontFamilyProp, color: colorProp, textAlign: textAlignProp, cursorColor, selectionColor, caretHidden, adjustsFontSizeToFit, minimumFontScale, allowFontScaling, maxFontSizeMultiplier, variant, label, labelBehavior, labelColor, labelFocusedColor, labelFontSize, strokeColor, focusedStrokeColor, strokeWidth, cornerRadius, fillColor, keyboardType, inputMode, enterKeyHint, mask, maskNotations, maskAutocomplete, maskAutoSkip, maskAffinityFormats, maskAffinityStrategy, maskTextCase, maskCharacterMap, maskSlotPlaceholder, keepPlaceholder, returnKeyType, autoCapitalize, autoCorrect, editable, multiline, numberOfLines, rows, textAlignVertical: textAlignVerticalProp, scrollEnabled, autoFocus, transition, autoWidth: autoWidthProp, submitBehavior, blurOnSubmit, secureTextEntry, keyboardAppearance, textContentType, autoComplete, enablesReturnKeyAutomatically, showSoftInputOnFocus, selectTextOnFocus, clearTextOnFocus, keyboardHandoffMs, returnKeyBar, contextMenuHidden, spellCheck, readOnly, selection, onEndEditing, onSelectionChange, onKeyPress, maxLength, transform, onChangeText, onChange, onChangeValue, onChangeMask, onFocus, onBlur, focusedValue, onSubmitEditing, onNativeRef, style, ...viewProps }, ref) {
|
|
216
|
+
export const NitroInput = forwardRef(function NitroInput({ value, defaultValue, mode, fractionDigits, maxIntegerDigits, groupingSeparator, decimalSeparator, prefix, suffix, prefixFontSize, suffixFontSize, affixAlign, signPlacement, prefixAlign, suffixAlign, letterSpacing: letterSpacingProp, tabularNums, prefixSpacing, suffixSpacing, prefixOffset, suffixOffset, format, placeholder, placeholderTextColor, duration, easing, bounce, effect, fontSize: fontSizeProp, lineHeight: lineHeightProp, fontWeight: fontWeightProp, fontFamily: fontFamilyProp, color: colorProp, textAlign: textAlignProp, cursorColor, selectionColor, caretHidden, adjustsFontSizeToFit, minimumFontScale, allowFontScaling, maxFontSizeMultiplier, variant, label, labelBehavior, labelColor, labelFocusedColor, labelFontSize, strokeColor, focusedStrokeColor, strokeWidth, cornerRadius, fillColor, keyboardType, inputMode, enterKeyHint, mask, maskNotations, maskAutocomplete, maskAutoSkip, maskAffinityFormats, maskAffinityStrategy, maskTextCase, maskCharacterMap, maskSlotPlaceholder, keepPlaceholder, returnKeyType, autoCapitalize, autoCorrect, editable, multiline, numberOfLines, rows, textAlignVertical: textAlignVerticalProp, scrollEnabled, autoFocus, transition, autoWidth: autoWidthProp, submitBehavior, blurOnSubmit, secureTextEntry, keyboardAppearance, textContentType, autoComplete, enablesReturnKeyAutomatically, showSoftInputOnFocus, selectTextOnFocus, clearTextOnFocus, keyboardHandoffMs, returnKeyBar, contextMenuHidden, spellCheck, readOnly, selection, onEndEditing, onSelectionChange, onKeyPress, maxLength, transform, onChangeText, onChange, onChangeValue, onChangeMask, onFocus, onBlur, focusedValue, onSubmitEditing, onNativeRef, style, ...viewProps }, ref) {
|
|
217
217
|
const nativeRef = useRef(null);
|
|
218
218
|
// `keyboardHandoffMs`: hand the keyboard off while this field still has it.
|
|
219
219
|
// A layout-effect cleanup runs in React's commit, so the native call is
|
|
@@ -710,6 +710,8 @@ export const NitroInput = forwardRef(function NitroInput({ value, defaultValue,
|
|
|
710
710
|
textWeight: numericWeight,
|
|
711
711
|
textFamily: fontFamily ?? '',
|
|
712
712
|
textLetterSpacing: letterSpacing ?? 0,
|
|
713
|
+
tabularNums: tabularNums ?? !flat?.fontVariant?.includes('proportional-nums'),
|
|
714
|
+
slotDigits: tabularNums === true,
|
|
713
715
|
prefixSpacing: prefixSpacing ?? Infinity,
|
|
714
716
|
suffixSpacing: suffixSpacing ?? Infinity,
|
|
715
717
|
allowFontScaling: allowFontScaling ?? false,
|
|
@@ -229,6 +229,17 @@ export interface NitroInputProps extends Omit<ViewProps, 'children' | 'onFocus'
|
|
|
229
229
|
* Default: `0`.
|
|
230
230
|
*/
|
|
231
231
|
letterSpacing?: number;
|
|
232
|
+
/**
|
|
233
|
+
* Unset (the default): the font's tabular figures, where it has them (the
|
|
234
|
+
* system fonts do), at no cost. `true`: every digit as wide as the widest
|
|
235
|
+
* even in a font without them (Open Runde), laid out that wide and centred,
|
|
236
|
+
* so typing over a `keepPlaceholder` mask never moves what is still to come
|
|
237
|
+
* and an amount keeps its width as its digits change; that layout costs a
|
|
238
|
+
* little on each change. `false`: the font's proportional figures. A
|
|
239
|
+
* style's `fontVariant: ['proportional-nums']` is `false` too, as on a
|
|
240
|
+
* `TextInput`; the prop wins.
|
|
241
|
+
*/
|
|
242
|
+
tabularNums?: boolean;
|
|
232
243
|
/** Points between the prefix and the text, in place of the letter spacing there. Defaults to the letter spacing. */
|
|
233
244
|
prefixSpacing?: number;
|
|
234
245
|
/** Points between the text and the suffix, in place of the letter spacing there. Defaults to the letter spacing. */
|
|
@@ -221,6 +221,10 @@ export interface NitroInputProps extends HybridViewProps {
|
|
|
221
221
|
suffixAlign: NitroInputAffixAlign;
|
|
222
222
|
/** Points added after every glyph, like `Text`'s `letterSpacing`; an affix gets it in proportion to its size. */
|
|
223
223
|
textLetterSpacing: number;
|
|
224
|
+
/** The font's tabular figures (`tnum`) rather than its proportional ones. */
|
|
225
|
+
tabularNums: boolean;
|
|
226
|
+
/** Every digit laid out as wide as the widest, centred: tabular figures for a font without them. */
|
|
227
|
+
slotDigits: boolean;
|
|
224
228
|
/** Points between the prefix and the text, in place of the letter spacing there. Not finite: the letter spacing. */
|
|
225
229
|
prefixSpacing: number;
|
|
226
230
|
/** Points between the text and the suffix, in place of the letter spacing there. Not finite: the letter spacing. */
|
|
@@ -509,6 +509,24 @@ namespace margelo::nitro::nitroinput {
|
|
|
509
509
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* textLetterSpacing */)>("setTextLetterSpacing");
|
|
510
510
|
method(_javaPart, textLetterSpacing);
|
|
511
511
|
}
|
|
512
|
+
bool JHybridNitroInputViewSpec::getTabularNums() {
|
|
513
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("getTabularNums");
|
|
514
|
+
auto __result = method(_javaPart);
|
|
515
|
+
return static_cast<bool>(__result);
|
|
516
|
+
}
|
|
517
|
+
void JHybridNitroInputViewSpec::setTabularNums(bool tabularNums) {
|
|
518
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jboolean /* tabularNums */)>("setTabularNums");
|
|
519
|
+
method(_javaPart, tabularNums);
|
|
520
|
+
}
|
|
521
|
+
bool JHybridNitroInputViewSpec::getSlotDigits() {
|
|
522
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("getSlotDigits");
|
|
523
|
+
auto __result = method(_javaPart);
|
|
524
|
+
return static_cast<bool>(__result);
|
|
525
|
+
}
|
|
526
|
+
void JHybridNitroInputViewSpec::setSlotDigits(bool slotDigits) {
|
|
527
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jboolean /* slotDigits */)>("setSlotDigits");
|
|
528
|
+
method(_javaPart, slotDigits);
|
|
529
|
+
}
|
|
512
530
|
double JHybridNitroInputViewSpec::getPrefixSpacing() {
|
|
513
531
|
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getPrefixSpacing");
|
|
514
532
|
auto __result = method(_javaPart);
|
|
@@ -124,6 +124,10 @@ namespace margelo::nitro::nitroinput {
|
|
|
124
124
|
void setSuffixAlign(NitroInputAffixAlign suffixAlign) override;
|
|
125
125
|
double getTextLetterSpacing() override;
|
|
126
126
|
void setTextLetterSpacing(double textLetterSpacing) override;
|
|
127
|
+
bool getTabularNums() override;
|
|
128
|
+
void setTabularNums(bool tabularNums) override;
|
|
129
|
+
bool getSlotDigits() override;
|
|
130
|
+
void setSlotDigits(bool slotDigits) override;
|
|
127
131
|
double getPrefixSpacing() override;
|
|
128
132
|
void setPrefixSpacing(double prefixSpacing) override;
|
|
129
133
|
double getSuffixSpacing() override;
|
|
@@ -110,6 +110,10 @@ namespace margelo::nitro::nitroinput {
|
|
|
110
110
|
jni::local_ref<jni::JString> textFamily = this->getFieldValue(fieldTextFamily);
|
|
111
111
|
static const auto fieldTextLetterSpacing = clazz->getField<double>("textLetterSpacing");
|
|
112
112
|
double textLetterSpacing = this->getFieldValue(fieldTextLetterSpacing);
|
|
113
|
+
static const auto fieldTabularNums = clazz->getField<jboolean>("tabularNums");
|
|
114
|
+
jboolean tabularNums = this->getFieldValue(fieldTabularNums);
|
|
115
|
+
static const auto fieldSlotDigits = clazz->getField<jboolean>("slotDigits");
|
|
116
|
+
jboolean slotDigits = this->getFieldValue(fieldSlotDigits);
|
|
113
117
|
static const auto fieldPrefixSpacing = clazz->getField<double>("prefixSpacing");
|
|
114
118
|
double prefixSpacing = this->getFieldValue(fieldPrefixSpacing);
|
|
115
119
|
static const auto fieldSuffixSpacing = clazz->getField<double>("suffixSpacing");
|
|
@@ -187,6 +191,8 @@ namespace margelo::nitro::nitroinput {
|
|
|
187
191
|
textWeight,
|
|
188
192
|
textFamily->toStdString(),
|
|
189
193
|
textLetterSpacing,
|
|
194
|
+
static_cast<bool>(tabularNums),
|
|
195
|
+
static_cast<bool>(slotDigits),
|
|
190
196
|
prefixSpacing,
|
|
191
197
|
suffixSpacing,
|
|
192
198
|
static_cast<bool>(allowFontScaling),
|
|
@@ -205,7 +211,7 @@ namespace margelo::nitro::nitroinput {
|
|
|
205
211
|
*/
|
|
206
212
|
[[maybe_unused]]
|
|
207
213
|
static jni::local_ref<JNitroInputSizing::javaobject> fromCpp(const NitroInputSizing& value) {
|
|
208
|
-
using JSignature = JNitroInputSizing(jni::alias_ref<jni::JString>, jni::alias_ref<JNitroInputMode>, jboolean, jboolean, jboolean, double, double, double, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroInputSignPlacement>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<JNitroInputNotation>>, jboolean, jboolean, jni::alias_ref<jni::JArrayClass<jni::JString>>, jni::alias_ref<JNitroInputMaskAffinity>, jni::alias_ref<JNitroInputTextCase>, jni::alias_ref<jni::JArrayClass<JNitroInputCharacterMapping>>, jni::alias_ref<jni::JString>, jboolean, double, double, double, double, double, jni::alias_ref<jni::JString>, double, double, double, jboolean, double, jni::alias_ref<JNitroInputVariant>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroInputLabelBehavior>, double, double);
|
|
214
|
+
using JSignature = JNitroInputSizing(jni::alias_ref<jni::JString>, jni::alias_ref<JNitroInputMode>, jboolean, jboolean, jboolean, double, double, double, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroInputSignPlacement>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<JNitroInputNotation>>, jboolean, jboolean, jni::alias_ref<jni::JArrayClass<jni::JString>>, jni::alias_ref<JNitroInputMaskAffinity>, jni::alias_ref<JNitroInputTextCase>, jni::alias_ref<jni::JArrayClass<JNitroInputCharacterMapping>>, jni::alias_ref<jni::JString>, jboolean, double, double, double, double, double, jni::alias_ref<jni::JString>, double, jboolean, jboolean, double, double, jboolean, double, jni::alias_ref<JNitroInputVariant>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroInputLabelBehavior>, double, double);
|
|
209
215
|
static const auto clazz = javaClassStatic();
|
|
210
216
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
211
217
|
return create(
|
|
@@ -268,6 +274,8 @@ namespace margelo::nitro::nitroinput {
|
|
|
268
274
|
value.textWeight,
|
|
269
275
|
jni::make_jstring(value.textFamily),
|
|
270
276
|
value.textLetterSpacing,
|
|
277
|
+
value.tabularNums,
|
|
278
|
+
value.slotDigits,
|
|
271
279
|
value.prefixSpacing,
|
|
272
280
|
value.suffixSpacing,
|
|
273
281
|
value.allowFontScaling,
|
|
@@ -238,6 +238,16 @@ void JHybridNitroInputViewStateUpdater::updateViewProps(jni::alias_ref<jni::JCla
|
|
|
238
238
|
: !newProps->textLetterSpacing.hasSameValue(oldProps->textLetterSpacing)) {
|
|
239
239
|
hybridView->setTextLetterSpacing(newProps->textLetterSpacing.get());
|
|
240
240
|
}
|
|
241
|
+
if (oldProps == nullptr
|
|
242
|
+
? newProps->tabularNums.isProvided()
|
|
243
|
+
: !newProps->tabularNums.hasSameValue(oldProps->tabularNums)) {
|
|
244
|
+
hybridView->setTabularNums(newProps->tabularNums.get());
|
|
245
|
+
}
|
|
246
|
+
if (oldProps == nullptr
|
|
247
|
+
? newProps->slotDigits.isProvided()
|
|
248
|
+
: !newProps->slotDigits.hasSameValue(oldProps->slotDigits)) {
|
|
249
|
+
hybridView->setSlotDigits(newProps->slotDigits.get());
|
|
250
|
+
}
|
|
241
251
|
if (oldProps == nullptr
|
|
242
252
|
? newProps->prefixSpacing.isProvided()
|
|
243
253
|
: !newProps->prefixSpacing.hasSameValue(oldProps->prefixSpacing)) {
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroInputViewSpec.kt
CHANGED
|
@@ -249,6 +249,18 @@ abstract class HybridNitroInputViewSpec: HybridView() {
|
|
|
249
249
|
@set:Keep
|
|
250
250
|
abstract var textLetterSpacing: Double
|
|
251
251
|
|
|
252
|
+
@get:DoNotStrip
|
|
253
|
+
@get:Keep
|
|
254
|
+
@set:DoNotStrip
|
|
255
|
+
@set:Keep
|
|
256
|
+
abstract var tabularNums: Boolean
|
|
257
|
+
|
|
258
|
+
@get:DoNotStrip
|
|
259
|
+
@get:Keep
|
|
260
|
+
@set:DoNotStrip
|
|
261
|
+
@set:Keep
|
|
262
|
+
abstract var slotDigits: Boolean
|
|
263
|
+
|
|
252
264
|
@get:DoNotStrip
|
|
253
265
|
@get:Keep
|
|
254
266
|
@set:DoNotStrip
|
|
@@ -113,6 +113,12 @@ data class NitroInputSizing(
|
|
|
113
113
|
val textLetterSpacing: Double,
|
|
114
114
|
@DoNotStrip
|
|
115
115
|
@Keep
|
|
116
|
+
val tabularNums: Boolean,
|
|
117
|
+
@DoNotStrip
|
|
118
|
+
@Keep
|
|
119
|
+
val slotDigits: Boolean,
|
|
120
|
+
@DoNotStrip
|
|
121
|
+
@Keep
|
|
116
122
|
val prefixSpacing: Double,
|
|
117
123
|
@DoNotStrip
|
|
118
124
|
@Keep
|
|
@@ -175,6 +181,8 @@ data class NitroInputSizing(
|
|
|
175
181
|
&& Objects.deepEquals(this.textWeight, other.textWeight)
|
|
176
182
|
&& Objects.deepEquals(this.textFamily, other.textFamily)
|
|
177
183
|
&& Objects.deepEquals(this.textLetterSpacing, other.textLetterSpacing)
|
|
184
|
+
&& Objects.deepEquals(this.tabularNums, other.tabularNums)
|
|
185
|
+
&& Objects.deepEquals(this.slotDigits, other.slotDigits)
|
|
178
186
|
&& Objects.deepEquals(this.prefixSpacing, other.prefixSpacing)
|
|
179
187
|
&& Objects.deepEquals(this.suffixSpacing, other.suffixSpacing)
|
|
180
188
|
&& Objects.deepEquals(this.allowFontScaling, other.allowFontScaling)
|
|
@@ -219,6 +227,8 @@ data class NitroInputSizing(
|
|
|
219
227
|
textWeight,
|
|
220
228
|
textFamily,
|
|
221
229
|
textLetterSpacing,
|
|
230
|
+
tabularNums,
|
|
231
|
+
slotDigits,
|
|
222
232
|
prefixSpacing,
|
|
223
233
|
suffixSpacing,
|
|
224
234
|
allowFontScaling,
|
|
@@ -239,8 +249,8 @@ data class NitroInputSizing(
|
|
|
239
249
|
@Keep
|
|
240
250
|
@Suppress("unused")
|
|
241
251
|
@JvmStatic
|
|
242
|
-
private fun fromCpp(text: String, mode: NitroInputMode, plain: Boolean, multiline: Boolean, secureTextEntry: Boolean, maxLength: Double, fractionDigits: Double, maxIntegerDigits: Double, groupingSeparator: String, decimalSeparator: String, prefix: String, suffix: String, signPlacement: NitroInputSignPlacement, placeholder: String, mask: String, maskNotations: Array<NitroInputNotation>, maskAutocomplete: Boolean, maskAutoSkip: Boolean, maskAffinityFormats: Array<String>, maskAffinityStrategy: NitroInputMaskAffinity, maskTextCase: NitroInputTextCase, maskCharacterMap: Array<NitroInputCharacterMapping>, maskSlotPlaceholder: String, keepPlaceholder: Boolean, textSize: Double, textLineHeight: Double, prefixFontSize: Double, suffixFontSize: Double, textWeight: Double, textFamily: String, textLetterSpacing: Double, prefixSpacing: Double, suffixSpacing: Double, allowFontScaling: Boolean, maxFontSizeMultiplier: Double, variant: NitroInputVariant, label: String, labelBehavior: NitroInputLabelBehavior, labelFontSize: Double, cornerRadius: Double): NitroInputSizing {
|
|
243
|
-
return NitroInputSizing(text, mode, plain, multiline, secureTextEntry, maxLength, fractionDigits, maxIntegerDigits, groupingSeparator, decimalSeparator, prefix, suffix, signPlacement, placeholder, mask, maskNotations, maskAutocomplete, maskAutoSkip, maskAffinityFormats, maskAffinityStrategy, maskTextCase, maskCharacterMap, maskSlotPlaceholder, keepPlaceholder, textSize, textLineHeight, prefixFontSize, suffixFontSize, textWeight, textFamily, textLetterSpacing, prefixSpacing, suffixSpacing, allowFontScaling, maxFontSizeMultiplier, variant, label, labelBehavior, labelFontSize, cornerRadius)
|
|
252
|
+
private fun fromCpp(text: String, mode: NitroInputMode, plain: Boolean, multiline: Boolean, secureTextEntry: Boolean, maxLength: Double, fractionDigits: Double, maxIntegerDigits: Double, groupingSeparator: String, decimalSeparator: String, prefix: String, suffix: String, signPlacement: NitroInputSignPlacement, placeholder: String, mask: String, maskNotations: Array<NitroInputNotation>, maskAutocomplete: Boolean, maskAutoSkip: Boolean, maskAffinityFormats: Array<String>, maskAffinityStrategy: NitroInputMaskAffinity, maskTextCase: NitroInputTextCase, maskCharacterMap: Array<NitroInputCharacterMapping>, maskSlotPlaceholder: String, keepPlaceholder: Boolean, textSize: Double, textLineHeight: Double, prefixFontSize: Double, suffixFontSize: Double, textWeight: Double, textFamily: String, textLetterSpacing: Double, tabularNums: Boolean, slotDigits: Boolean, prefixSpacing: Double, suffixSpacing: Double, allowFontScaling: Boolean, maxFontSizeMultiplier: Double, variant: NitroInputVariant, label: String, labelBehavior: NitroInputLabelBehavior, labelFontSize: Double, cornerRadius: Double): NitroInputSizing {
|
|
253
|
+
return NitroInputSizing(text, mode, plain, multiline, secureTextEntry, maxLength, fractionDigits, maxIntegerDigits, groupingSeparator, decimalSeparator, prefix, suffix, signPlacement, placeholder, mask, maskNotations, maskAutocomplete, maskAutoSkip, maskAffinityFormats, maskAffinityStrategy, maskTextCase, maskCharacterMap, maskSlotPlaceholder, keepPlaceholder, textSize, textLineHeight, prefixFontSize, suffixFontSize, textWeight, textFamily, textLetterSpacing, tabularNums, slotDigits, prefixSpacing, suffixSpacing, allowFontScaling, maxFontSizeMultiplier, variant, label, labelBehavior, labelFontSize, cornerRadius)
|
|
244
254
|
}
|
|
245
255
|
}
|
|
246
256
|
}
|
|
@@ -359,6 +359,18 @@ namespace margelo::nitro::nitroinput {
|
|
|
359
359
|
inline void setTextLetterSpacing(double textLetterSpacing) noexcept override {
|
|
360
360
|
_swiftPart.setTextLetterSpacing(std::forward<decltype(textLetterSpacing)>(textLetterSpacing));
|
|
361
361
|
}
|
|
362
|
+
inline bool getTabularNums() noexcept override {
|
|
363
|
+
return _swiftPart.getTabularNums();
|
|
364
|
+
}
|
|
365
|
+
inline void setTabularNums(bool tabularNums) noexcept override {
|
|
366
|
+
_swiftPart.setTabularNums(std::forward<decltype(tabularNums)>(tabularNums));
|
|
367
|
+
}
|
|
368
|
+
inline bool getSlotDigits() noexcept override {
|
|
369
|
+
return _swiftPart.getSlotDigits();
|
|
370
|
+
}
|
|
371
|
+
inline void setSlotDigits(bool slotDigits) noexcept override {
|
|
372
|
+
_swiftPart.setSlotDigits(std::forward<decltype(slotDigits)>(slotDigits));
|
|
373
|
+
}
|
|
362
374
|
inline double getPrefixSpacing() noexcept override {
|
|
363
375
|
return _swiftPart.getPrefixSpacing();
|
|
364
376
|
}
|
|
@@ -320,6 +320,18 @@ using namespace margelo::nitro::nitroinput::views;
|
|
|
320
320
|
: !newViewProps.textLetterSpacing.hasSameValue(oldViewProps->textLetterSpacing)) {
|
|
321
321
|
swiftPart.setTextLetterSpacing(newViewProps.textLetterSpacing.get());
|
|
322
322
|
}
|
|
323
|
+
// tabularNums: boolean
|
|
324
|
+
if (oldViewProps == nullptr
|
|
325
|
+
? newViewProps.tabularNums.isProvided()
|
|
326
|
+
: !newViewProps.tabularNums.hasSameValue(oldViewProps->tabularNums)) {
|
|
327
|
+
swiftPart.setTabularNums(newViewProps.tabularNums.get());
|
|
328
|
+
}
|
|
329
|
+
// slotDigits: boolean
|
|
330
|
+
if (oldViewProps == nullptr
|
|
331
|
+
? newViewProps.slotDigits.isProvided()
|
|
332
|
+
: !newViewProps.slotDigits.hasSameValue(oldViewProps->slotDigits)) {
|
|
333
|
+
swiftPart.setSlotDigits(newViewProps.slotDigits.get());
|
|
334
|
+
}
|
|
323
335
|
// prefixSpacing: number
|
|
324
336
|
if (oldViewProps == nullptr
|
|
325
337
|
? newViewProps.prefixSpacing.isProvided()
|
|
@@ -47,6 +47,8 @@ public protocol HybridNitroInputViewSpec_protocol: HybridObject, HybridView {
|
|
|
47
47
|
var prefixAlign: NitroInputAffixAlign { get set }
|
|
48
48
|
var suffixAlign: NitroInputAffixAlign { get set }
|
|
49
49
|
var textLetterSpacing: Double { get set }
|
|
50
|
+
var tabularNums: Bool { get set }
|
|
51
|
+
var slotDigits: Bool { get set }
|
|
50
52
|
var prefixSpacing: Double { get set }
|
|
51
53
|
var suffixSpacing: Double { get set }
|
|
52
54
|
var prefixOffset: Double { get set }
|
|
@@ -546,6 +546,28 @@ open class HybridNitroInputViewSpec_cxx {
|
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
+
public final var tabularNums: Bool {
|
|
550
|
+
@inline(__always)
|
|
551
|
+
get {
|
|
552
|
+
return self.__implementation.tabularNums
|
|
553
|
+
}
|
|
554
|
+
@inline(__always)
|
|
555
|
+
set {
|
|
556
|
+
self.__implementation.tabularNums = newValue
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
public final var slotDigits: Bool {
|
|
561
|
+
@inline(__always)
|
|
562
|
+
get {
|
|
563
|
+
return self.__implementation.slotDigits
|
|
564
|
+
}
|
|
565
|
+
@inline(__always)
|
|
566
|
+
set {
|
|
567
|
+
self.__implementation.slotDigits = newValue
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
549
571
|
public final var prefixSpacing: Double {
|
|
550
572
|
@inline(__always)
|
|
551
573
|
get {
|
|
@@ -18,7 +18,7 @@ public extension NitroInputSizing {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroInputSizing`.
|
|
20
20
|
*/
|
|
21
|
-
init(text: String, mode: NitroInputMode, plain: Bool, multiline: Bool, secureTextEntry: Bool, maxLength: Double, fractionDigits: Double, maxIntegerDigits: Double, groupingSeparator: String, decimalSeparator: String, prefix: String, suffix: String, signPlacement: NitroInputSignPlacement, placeholder: String, mask: String, maskNotations: [NitroInputNotation], maskAutocomplete: Bool, maskAutoSkip: Bool, maskAffinityFormats: [String], maskAffinityStrategy: NitroInputMaskAffinity, maskTextCase: NitroInputTextCase, maskCharacterMap: [NitroInputCharacterMapping], maskSlotPlaceholder: String, keepPlaceholder: Bool, textSize: Double, textLineHeight: Double, prefixFontSize: Double, suffixFontSize: Double, textWeight: Double, textFamily: String, textLetterSpacing: Double, prefixSpacing: Double, suffixSpacing: Double, allowFontScaling: Bool, maxFontSizeMultiplier: Double, variant: NitroInputVariant, label: String, labelBehavior: NitroInputLabelBehavior, labelFontSize: Double, cornerRadius: Double) {
|
|
21
|
+
init(text: String, mode: NitroInputMode, plain: Bool, multiline: Bool, secureTextEntry: Bool, maxLength: Double, fractionDigits: Double, maxIntegerDigits: Double, groupingSeparator: String, decimalSeparator: String, prefix: String, suffix: String, signPlacement: NitroInputSignPlacement, placeholder: String, mask: String, maskNotations: [NitroInputNotation], maskAutocomplete: Bool, maskAutoSkip: Bool, maskAffinityFormats: [String], maskAffinityStrategy: NitroInputMaskAffinity, maskTextCase: NitroInputTextCase, maskCharacterMap: [NitroInputCharacterMapping], maskSlotPlaceholder: String, keepPlaceholder: Bool, textSize: Double, textLineHeight: Double, prefixFontSize: Double, suffixFontSize: Double, textWeight: Double, textFamily: String, textLetterSpacing: Double, tabularNums: Bool, slotDigits: Bool, prefixSpacing: Double, suffixSpacing: Double, allowFontScaling: Bool, maxFontSizeMultiplier: Double, variant: NitroInputVariant, label: String, labelBehavior: NitroInputLabelBehavior, labelFontSize: Double, cornerRadius: Double) {
|
|
22
22
|
self.init(std.string(text), mode, plain, multiline, secureTextEntry, maxLength, fractionDigits, maxIntegerDigits, std.string(groupingSeparator), std.string(decimalSeparator), std.string(prefix), std.string(suffix), signPlacement, std.string(placeholder), std.string(mask), { () -> bridge.std__vector_NitroInputNotation_ in
|
|
23
23
|
var __vector = bridge.create_std__vector_NitroInputNotation_(maskNotations.count)
|
|
24
24
|
for __item in maskNotations {
|
|
@@ -37,7 +37,7 @@ public extension NitroInputSizing {
|
|
|
37
37
|
__vector.push_back(__item)
|
|
38
38
|
}
|
|
39
39
|
return __vector
|
|
40
|
-
}(), std.string(maskSlotPlaceholder), keepPlaceholder, textSize, textLineHeight, prefixFontSize, suffixFontSize, textWeight, std.string(textFamily), textLetterSpacing, prefixSpacing, suffixSpacing, allowFontScaling, maxFontSizeMultiplier, variant, std.string(label), labelBehavior, labelFontSize, cornerRadius)
|
|
40
|
+
}(), std.string(maskSlotPlaceholder), keepPlaceholder, textSize, textLineHeight, prefixFontSize, suffixFontSize, textWeight, std.string(textFamily), textLetterSpacing, tabularNums, slotDigits, prefixSpacing, suffixSpacing, allowFontScaling, maxFontSizeMultiplier, variant, std.string(label), labelBehavior, labelFontSize, cornerRadius)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
@inline(__always)
|
|
@@ -195,6 +195,16 @@ public extension NitroInputSizing {
|
|
|
195
195
|
return self.__textLetterSpacing
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
@inline(__always)
|
|
199
|
+
var tabularNums: Bool {
|
|
200
|
+
return self.__tabularNums
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@inline(__always)
|
|
204
|
+
var slotDigits: Bool {
|
|
205
|
+
return self.__slotDigits
|
|
206
|
+
}
|
|
207
|
+
|
|
198
208
|
@inline(__always)
|
|
199
209
|
var prefixSpacing: Double {
|
|
200
210
|
return self.__prefixSpacing
|
|
@@ -88,6 +88,10 @@ namespace margelo::nitro::nitroinput {
|
|
|
88
88
|
prototype.registerHybridSetter("suffixAlign", &HybridNitroInputViewSpec::setSuffixAlign);
|
|
89
89
|
prototype.registerHybridGetter("textLetterSpacing", &HybridNitroInputViewSpec::getTextLetterSpacing);
|
|
90
90
|
prototype.registerHybridSetter("textLetterSpacing", &HybridNitroInputViewSpec::setTextLetterSpacing);
|
|
91
|
+
prototype.registerHybridGetter("tabularNums", &HybridNitroInputViewSpec::getTabularNums);
|
|
92
|
+
prototype.registerHybridSetter("tabularNums", &HybridNitroInputViewSpec::setTabularNums);
|
|
93
|
+
prototype.registerHybridGetter("slotDigits", &HybridNitroInputViewSpec::getSlotDigits);
|
|
94
|
+
prototype.registerHybridSetter("slotDigits", &HybridNitroInputViewSpec::setSlotDigits);
|
|
91
95
|
prototype.registerHybridGetter("prefixSpacing", &HybridNitroInputViewSpec::getPrefixSpacing);
|
|
92
96
|
prototype.registerHybridSetter("prefixSpacing", &HybridNitroInputViewSpec::setPrefixSpacing);
|
|
93
97
|
prototype.registerHybridGetter("suffixSpacing", &HybridNitroInputViewSpec::getSuffixSpacing);
|
|
@@ -174,6 +174,10 @@ namespace margelo::nitro::nitroinput {
|
|
|
174
174
|
virtual void setSuffixAlign(NitroInputAffixAlign suffixAlign) = 0;
|
|
175
175
|
virtual double getTextLetterSpacing() = 0;
|
|
176
176
|
virtual void setTextLetterSpacing(double textLetterSpacing) = 0;
|
|
177
|
+
virtual bool getTabularNums() = 0;
|
|
178
|
+
virtual void setTabularNums(bool tabularNums) = 0;
|
|
179
|
+
virtual bool getSlotDigits() = 0;
|
|
180
|
+
virtual void setSlotDigits(bool slotDigits) = 0;
|
|
177
181
|
virtual double getPrefixSpacing() = 0;
|
|
178
182
|
virtual void setPrefixSpacing(double prefixSpacing) = 0;
|
|
179
183
|
virtual double getSuffixSpacing() = 0;
|