guestbell-forms 3.0.116 → 3.0.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/money/Money.js +2 -1
- package/build/components/money/Money.js.map +1 -1
- package/build/dist/report.html +1 -1
- package/build/validators/NumberValidator.js +3 -3
- package/build/validators/NumberValidator.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/components/money/Money.tsx +5 -0
- package/src/lib/validators/NumberValidator.ts +3 -3
@@ -163,7 +163,8 @@ class MoneyRaw extends _BaseInput.BaseInput {
|
|
163
163
|
className: 'money-input__text m-0',
|
164
164
|
number: item.value,
|
165
165
|
onNumberChange: this.onPriceChanged(index),
|
166
|
-
customValidators: this.props.customValidators
|
166
|
+
customValidators: this.props.customValidators,
|
167
|
+
validationName: this.props.validationName ? `${this.props.validationName} (${currency === null || currency === void 0 ? void 0 : currency.label})` : currency === null || currency === void 0 ? void 0 : currency.label
|
167
168
|
})), !this.props.disableDelete && this.props.prices.length > 0 && /*#__PURE__*/React.createElement(_Button.Button, _extends({}, this.props.id && {
|
168
169
|
id: this.props.id + '-remove-button-' + index.toString()
|
169
170
|
}, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Money.js","names":["React","_interopRequireWildcard","require","_Select","_Text","_InputGroup","_interopRequireDefault","_BaseInput","_Button","_withFormContext","_withThemeContext","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","_objectSpread","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","PlusIcon","props","createElement","d","defaultProps","xmlns","width","height","viewBox","defaultMoneyTranslations","defaultBaseTranslations","cannotRemoveDefaultCurrency","removePrice","addPrice","addNewCurrency","exports","MoneyRaw","BaseInput","constructor","onCurrencyChanged","index","currentCurrencies","e","newPrices","concat","prices","currency","cc","toString","onPricesChange","onTheFlightValidate","num","parts","split","isNaN","onPriceChanged","state","touched","touch","removePriceClick","price","itemIndex","required","setInvalid","getTranslations","addPriceClick","unusedCurrencies","setTimeout","_this$containerRef$cu","inputs","containerRef","current","querySelectorAll","focus","setValid","onFocus","setState","focused","onBlur","currencies","Error","isValid","errors","handleValueChangeEnabled","forcedCurrencies","c","forceSelected","missingForced","find","p","map","subscribeSelf","render","_Button$defaultProps2","translations","title","tooltip","className","inputGroupClassName","id","getValidationClass","ref","item","_currentCurrencies$","_Button$defaultProps","priceCurrency","priceIndex","retComponents","Select","values","onChange","label","Text","placeholder","number","onNumberChange","customValidators","disableDelete","Button","blank","type","onClick","buttonProps","circular","disabled","allowMultiple","renderDefaultValidation","renderLabel","Money","withThemeContext","withFormContext","_default"],"sources":["../../../src/lib/components/money/Money.tsx"],"sourcesContent":["import * as PlusIcon from 'material-design-icons/content/svg/production/ic_add_24px.svg';\r\n\r\n// Libs\r\nimport * as React from 'react';\r\n\r\n// Misc\r\nimport { Select, SelectValue } from '../select/Select';\r\nimport { Text } from '../text/Text';\r\nimport InputGroup from '../inputGroup/InputGroup';\r\nimport {\r\n BaseInputProps,\r\n BaseInputState,\r\n BaseInput,\r\n defaultBaseTranslations,\r\n} from '../base/input/BaseInput';\r\nimport { Button } from '../button/Button';\r\nimport { withFormContext } from '../form/withFormContext';\r\nimport { withThemeContext } from '../themeProvider/withThemeContext';\r\n\r\nexport interface MoneyWithCurrency {\r\n value: number | undefined;\r\n currency: SelectValue;\r\n}\r\n\r\nexport const defaultMoneyTranslations = {\r\n ...defaultBaseTranslations,\r\n cannotRemoveDefaultCurrency: 'Cannot remove default currency',\r\n removePrice: 'Remove price',\r\n addPrice: 'Add price',\r\n addNewCurrency: 'Add new currency',\r\n};\r\n\r\nexport type MoneyTranslations = Partial<typeof defaultMoneyTranslations>;\r\n\r\nexport interface MoneyProps extends BaseInputProps<never, MoneyTranslations> {\r\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\r\n onPricesChange: (prices: MoneyWithCurrency[]) => void;\r\n allowMultiple?: boolean;\r\n currencies: SelectValue[];\r\n prices: MoneyWithCurrency[];\r\n disableDelete?: boolean;\r\n}\r\n\r\nexport interface MoneyState extends BaseInputState {}\r\n\r\nexport class MoneyRaw extends BaseInput<\r\n MoneyProps,\r\n MoneyState,\r\n never,\r\n MoneyTranslations\r\n> {\r\n public static defaultProps = Object.assign({}, BaseInput.defaultProps, {\r\n type: 'money',\r\n allowMultiple: false,\r\n onChange: undefined,\r\n });\r\n\r\n constructor(props: MoneyProps) {\r\n super(props, false);\r\n if (!props.currencies || !props.currencies.length) {\r\n throw Error('No currencies supplied to money input');\r\n }\r\n this.state = Object.assign(this.state, {\r\n isValid: props.required ? props.prices.length > 0 : true,\r\n errors:\r\n props.required && props.prices.length === 0\r\n ? [this.getTranslations(defaultMoneyTranslations).required]\r\n : [],\r\n handleValueChangeEnabled: false,\r\n });\r\n const forcedCurrencies = props.currencies.filter((c) => c.forceSelected);\r\n const missingForced = forcedCurrencies.filter(\r\n (c) => !props.prices.find((p) => p.currency.value === c.value)\r\n );\r\n if (missingForced.length > 0) {\r\n props.onPricesChange(\r\n props.prices.concat(\r\n missingForced.map((c) => ({ currency: c, value: undefined }))\r\n )\r\n );\r\n }\r\n this.subscribeSelf(props);\r\n }\r\n\r\n public render() {\r\n let unusedCurrencies = this.props.currencies;\r\n const translations = this.getTranslations(defaultMoneyTranslations);\r\n return (\r\n <InputGroup\r\n title={this.props.title}\r\n tooltip={this.props.tooltip}\r\n className={this.props.inputGroupClassName}\r\n >\r\n <div\r\n {...(this.props.id && { id: this.props.id })}\r\n className={\r\n 'input__base money-input ' +\r\n this.getValidationClass() +\r\n (this.props.className ? ' ' + this.props.className : '')\r\n }\r\n ref={this.containerRef}\r\n >\r\n {this.props.prices &&\r\n this.props.prices.map((item, index) => {\r\n let currentCurrencies = this.props.currencies.filter(\r\n (c) =>\r\n this.props.prices.filter(\r\n (priceCurrency, priceIndex) =>\r\n priceIndex !== index &&\r\n priceCurrency.currency.value === c.value\r\n ).length === 0\r\n );\r\n const currency = this.props.currencies.find(\r\n (c) => c.value === item.currency.value\r\n );\r\n let retComponents = currentCurrencies.length ? (\r\n <div key={index}>\r\n {currentCurrencies.length > 1 ? (\r\n <Select\r\n {...(this.props.id && {\r\n id:\r\n this.props.id +\r\n '-currency-select-' +\r\n index.toString(),\r\n })}\r\n onFocus={this.onFocus}\r\n onBlur={this.onBlur}\r\n className={'money-input__select m-0'}\r\n values={currentCurrencies}\r\n onChange={this.onCurrencyChanged(\r\n index,\r\n currentCurrencies\r\n )}\r\n value={item.currency.value.toString()}\r\n />\r\n ) : (\r\n <span className=\"money-input__currencyLabel\">\r\n {currentCurrencies?.[0]?.label}\r\n </span>\r\n )}\r\n <Text\r\n {...(this.props.id && {\r\n id: this.props.id + '-amount-input-' + index.toString(),\r\n })}\r\n onFocus={this.onFocus}\r\n onBlur={this.onBlur}\r\n onTheFlightValidate={this.onTheFlightValidate}\r\n placeholder={'0.00'}\r\n className={'money-input__text m-0'}\r\n number={item.value}\r\n onNumberChange={this.onPriceChanged(index)}\r\n customValidators={this.props.customValidators}\r\n />\r\n {!this.props.disableDelete &&\r\n this.props.prices.length > 0 && (\r\n <Button\r\n {...(this.props.id && {\r\n id:\r\n this.props.id +\r\n '-remove-button-' +\r\n index.toString(),\r\n })}\r\n blank={true}\r\n type=\"error\"\r\n onClick={this.removePriceClick(index)}\r\n className=\"transform-rotate--45 line-height--0\"\r\n buttonProps={{\r\n ...Button.defaultProps?.buttonProps,\r\n title:\r\n currency && currency.forceSelected\r\n ? translations.cannotRemoveDefaultCurrency\r\n : translations.removePrice,\r\n }}\r\n circular={true}\r\n disabled={currency && currency.forceSelected}\r\n >\r\n <PlusIcon />\r\n </Button>\r\n )}\r\n </div>\r\n ) : null;\r\n unusedCurrencies = unusedCurrencies.filter(\r\n (c) => c.value !== item.currency.value\r\n );\r\n return retComponents;\r\n })}\r\n {(this.props.allowMultiple ||\r\n (this.props.prices && !this.props.prices.length)) &&\r\n unusedCurrencies.length ? (\r\n <Button\r\n blank={true}\r\n {...(this.props.id && {\r\n id: this.props.id + '-add-button',\r\n })}\r\n type=\"primary\"\r\n className=\"line-height--0 align-self-start\"\r\n onClick={this.addPriceClick(unusedCurrencies)}\r\n circular={true}\r\n buttonProps={{\r\n ...Button.defaultProps?.buttonProps,\r\n title:\r\n this.props.prices && this.props.prices.length === 0\r\n ? translations.addPrice\r\n : translations.addNewCurrency,\r\n }}\r\n >\r\n <PlusIcon />\r\n </Button>\r\n ) : null}\r\n <span className=\"highlight\" />\r\n <span className={'bar ' + (this.state.focused ? 'focused' : '')} />\r\n {this.renderDefaultValidation()}\r\n {this.props.label && (\r\n <label\r\n className={\r\n this.props.prices && this.props.prices ? 'label--focused' : ''\r\n }\r\n >\r\n {this.renderLabel()}\r\n </label>\r\n )}\r\n </div>\r\n </InputGroup>\r\n );\r\n }\r\n\r\n private onCurrencyChanged =\r\n (index: number, currentCurrencies: SelectValue[]) => (e) => {\r\n let newPrices: MoneyWithCurrency[] = [].concat(this.props.prices);\r\n newPrices[index].currency = currentCurrencies.filter(\r\n (cc) => cc.value.toString() === e.target.value\r\n )[0];\r\n this.props.onPricesChange(newPrices);\r\n };\r\n\r\n private onTheFlightValidate = (value: string) => {\r\n let num = Number(value);\r\n const parts = value.split('.');\r\n if (parts && parts.length > 1 && parts[parts.length - 1].length > 2) {\r\n return false;\r\n }\r\n if (!isNaN(num)) {\r\n return true;\r\n }\r\n if (num) {\r\n return false;\r\n }\r\n };\r\n\r\n private onPriceChanged = (index: number) => (value: number) => {\r\n let newPrices: MoneyWithCurrency[] = [].concat(this.props.prices);\r\n if (!isNaN(value)) {\r\n newPrices[index].value = value;\r\n }\r\n this.props.onPricesChange(newPrices);\r\n if (!this.state.touched) {\r\n this.touch();\r\n }\r\n };\r\n\r\n private removePriceClick = (index: number) => () => {\r\n const newPrices = this.props.prices.filter(\r\n (price, itemIndex) => itemIndex !== index\r\n );\r\n this.props.onPricesChange(newPrices);\r\n if (newPrices.length === 0 && this.props.required) {\r\n this.setInvalid([\r\n this.getTranslations(defaultMoneyTranslations).required,\r\n ]);\r\n }\r\n if (!this.state.touched) {\r\n this.touch();\r\n }\r\n };\r\n\r\n private addPriceClick = (unusedCurrencies: SelectValue[]) => () => {\r\n this.props.onPricesChange(\r\n this.props.prices.concat([\r\n { value: undefined, currency: unusedCurrencies[0] },\r\n ])\r\n );\r\n // we are going to focus the last input in the this.containerRef element after a timeout\r\n setTimeout(() => {\r\n const inputs = this.containerRef.current?.querySelectorAll('input');\r\n if (inputs?.length) {\r\n inputs[inputs.length - 1].focus();\r\n }\r\n }, 0);\r\n this.setValid();\r\n if (!this.state.touched) {\r\n this.touch();\r\n }\r\n };\r\n\r\n private onFocus = () => this.setState({ focused: true });\r\n\r\n private onBlur = () => this.setState({ focused: false });\r\n}\r\n\r\nexport const Money = withThemeContext<\r\n MoneyProps,\r\n InstanceType<typeof MoneyRaw>\r\n>(withFormContext<MoneyProps>(MoneyRaw), 'money');\r\n\r\nexport default Money;\r\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAMA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AAAqE,SAAAI,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,O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,KAAK,GAAG,IAAAC,kCAAgB,EAGnC,IAAAC,gCAAe,EAAa9F,QAAQ,CAAC,EAAE,OAAO,CAAC;AAACD,OAAA,CAAA6F,KAAA,GAAAA,KAAA;AAAA,IAAAG,QAAA,GAEnCH,KAAK;AAAA7F,OAAA,CAAA3E,OAAA,GAAA2K,QAAA"}
|
1
|
+
{"version":3,"file":"Money.js","names":["React","_interopRequireWildcard","require","_Select","_Text","_InputGroup","_interopRequireDefault","_BaseInput","_Button","_withFormContext","_withThemeContext","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","_objectSpread","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","PlusIcon","props","createElement","d","defaultProps","xmlns","width","height","viewBox","defaultMoneyTranslations","defaultBaseTranslations","cannotRemoveDefaultCurrency","removePrice","addPrice","addNewCurrency","exports","MoneyRaw","BaseInput","constructor","onCurrencyChanged","index","currentCurrencies","e","newPrices","concat","prices","currency","cc","toString","onPricesChange","onTheFlightValidate","num","parts","split","isNaN","onPriceChanged","state","touched","touch","removePriceClick","price","itemIndex","required","setInvalid","getTranslations","addPriceClick","unusedCurrencies","setTimeout","_this$containerRef$cu","inputs","containerRef","current","querySelectorAll","focus","setValid","onFocus","setState","focused","onBlur","currencies","Error","isValid","errors","handleValueChangeEnabled","forcedCurrencies","c","forceSelected","missingForced","find","p","map","subscribeSelf","render","_Button$defaultProps2","translations","title","tooltip","className","inputGroupClassName","id","getValidationClass","ref","item","_currentCurrencies$","_Button$defaultProps","priceCurrency","priceIndex","retComponents","Select","values","onChange","label","Text","placeholder","number","onNumberChange","customValidators","validationName","disableDelete","Button","blank","type","onClick","buttonProps","circular","disabled","allowMultiple","renderDefaultValidation","renderLabel","Money","withThemeContext","withFormContext","_default"],"sources":["../../../src/lib/components/money/Money.tsx"],"sourcesContent":["import * as PlusIcon from 'material-design-icons/content/svg/production/ic_add_24px.svg';\r\n\r\n// Libs\r\nimport * as React from 'react';\r\n\r\n// Misc\r\nimport { Select, SelectValue } from '../select/Select';\r\nimport { Text } from '../text/Text';\r\nimport InputGroup from '../inputGroup/InputGroup';\r\nimport {\r\n BaseInputProps,\r\n BaseInputState,\r\n BaseInput,\r\n defaultBaseTranslations,\r\n} from '../base/input/BaseInput';\r\nimport { Button } from '../button/Button';\r\nimport { withFormContext } from '../form/withFormContext';\r\nimport { withThemeContext } from '../themeProvider/withThemeContext';\r\n\r\nexport interface MoneyWithCurrency {\r\n value: number | undefined;\r\n currency: SelectValue;\r\n}\r\n\r\nexport const defaultMoneyTranslations = {\r\n ...defaultBaseTranslations,\r\n cannotRemoveDefaultCurrency: 'Cannot remove default currency',\r\n removePrice: 'Remove price',\r\n addPrice: 'Add price',\r\n addNewCurrency: 'Add new currency',\r\n};\r\n\r\nexport type MoneyTranslations = Partial<typeof defaultMoneyTranslations>;\r\n\r\nexport interface MoneyProps extends BaseInputProps<never, MoneyTranslations> {\r\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\r\n onPricesChange: (prices: MoneyWithCurrency[]) => void;\r\n allowMultiple?: boolean;\r\n currencies: SelectValue[];\r\n prices: MoneyWithCurrency[];\r\n disableDelete?: boolean;\r\n}\r\n\r\nexport interface MoneyState extends BaseInputState {}\r\n\r\nexport class MoneyRaw extends BaseInput<\r\n MoneyProps,\r\n MoneyState,\r\n never,\r\n MoneyTranslations\r\n> {\r\n public static defaultProps = Object.assign({}, BaseInput.defaultProps, {\r\n type: 'money',\r\n allowMultiple: false,\r\n onChange: undefined,\r\n });\r\n\r\n constructor(props: MoneyProps) {\r\n super(props, false);\r\n if (!props.currencies || !props.currencies.length) {\r\n throw Error('No currencies supplied to money input');\r\n }\r\n this.state = Object.assign(this.state, {\r\n isValid: props.required ? props.prices.length > 0 : true,\r\n errors:\r\n props.required && props.prices.length === 0\r\n ? [this.getTranslations(defaultMoneyTranslations).required]\r\n : [],\r\n handleValueChangeEnabled: false,\r\n });\r\n const forcedCurrencies = props.currencies.filter((c) => c.forceSelected);\r\n const missingForced = forcedCurrencies.filter(\r\n (c) => !props.prices.find((p) => p.currency.value === c.value)\r\n );\r\n if (missingForced.length > 0) {\r\n props.onPricesChange(\r\n props.prices.concat(\r\n missingForced.map((c) => ({ currency: c, value: undefined }))\r\n )\r\n );\r\n }\r\n this.subscribeSelf(props);\r\n }\r\n\r\n public render() {\r\n let unusedCurrencies = this.props.currencies;\r\n const translations = this.getTranslations(defaultMoneyTranslations);\r\n return (\r\n <InputGroup\r\n title={this.props.title}\r\n tooltip={this.props.tooltip}\r\n className={this.props.inputGroupClassName}\r\n >\r\n <div\r\n {...(this.props.id && { id: this.props.id })}\r\n className={\r\n 'input__base money-input ' +\r\n this.getValidationClass() +\r\n (this.props.className ? ' ' + this.props.className : '')\r\n }\r\n ref={this.containerRef}\r\n >\r\n {this.props.prices &&\r\n this.props.prices.map((item, index) => {\r\n let currentCurrencies = this.props.currencies.filter(\r\n (c) =>\r\n this.props.prices.filter(\r\n (priceCurrency, priceIndex) =>\r\n priceIndex !== index &&\r\n priceCurrency.currency.value === c.value\r\n ).length === 0\r\n );\r\n const currency = this.props.currencies.find(\r\n (c) => c.value === item.currency.value\r\n );\r\n let retComponents = currentCurrencies.length ? (\r\n <div key={index}>\r\n {currentCurrencies.length > 1 ? (\r\n <Select\r\n {...(this.props.id && {\r\n id:\r\n this.props.id +\r\n '-currency-select-' +\r\n index.toString(),\r\n })}\r\n onFocus={this.onFocus}\r\n onBlur={this.onBlur}\r\n className={'money-input__select m-0'}\r\n values={currentCurrencies}\r\n onChange={this.onCurrencyChanged(\r\n index,\r\n currentCurrencies\r\n )}\r\n value={item.currency.value.toString()}\r\n />\r\n ) : (\r\n <span className=\"money-input__currencyLabel\">\r\n {currentCurrencies?.[0]?.label}\r\n </span>\r\n )}\r\n <Text\r\n {...(this.props.id && {\r\n id: this.props.id + '-amount-input-' + index.toString(),\r\n })}\r\n onFocus={this.onFocus}\r\n onBlur={this.onBlur}\r\n onTheFlightValidate={this.onTheFlightValidate}\r\n placeholder={'0.00'}\r\n className={'money-input__text m-0'}\r\n number={item.value}\r\n onNumberChange={this.onPriceChanged(index)}\r\n customValidators={this.props.customValidators}\r\n validationName={\r\n this.props.validationName\r\n ? `${this.props.validationName} (${currency?.label})`\r\n : currency?.label\r\n }\r\n />\r\n {!this.props.disableDelete &&\r\n this.props.prices.length > 0 && (\r\n <Button\r\n {...(this.props.id && {\r\n id:\r\n this.props.id +\r\n '-remove-button-' +\r\n index.toString(),\r\n })}\r\n blank={true}\r\n type=\"error\"\r\n onClick={this.removePriceClick(index)}\r\n className=\"transform-rotate--45 line-height--0\"\r\n buttonProps={{\r\n ...Button.defaultProps?.buttonProps,\r\n title:\r\n currency && currency.forceSelected\r\n ? translations.cannotRemoveDefaultCurrency\r\n : translations.removePrice,\r\n }}\r\n circular={true}\r\n disabled={currency && currency.forceSelected}\r\n >\r\n <PlusIcon />\r\n </Button>\r\n )}\r\n </div>\r\n ) : null;\r\n unusedCurrencies = unusedCurrencies.filter(\r\n (c) => c.value !== item.currency.value\r\n );\r\n return retComponents;\r\n })}\r\n {(this.props.allowMultiple ||\r\n (this.props.prices && !this.props.prices.length)) &&\r\n unusedCurrencies.length ? (\r\n <Button\r\n blank={true}\r\n {...(this.props.id && {\r\n id: this.props.id + '-add-button',\r\n })}\r\n type=\"primary\"\r\n className=\"line-height--0 align-self-start\"\r\n onClick={this.addPriceClick(unusedCurrencies)}\r\n circular={true}\r\n buttonProps={{\r\n ...Button.defaultProps?.buttonProps,\r\n title:\r\n this.props.prices && this.props.prices.length === 0\r\n ? translations.addPrice\r\n : translations.addNewCurrency,\r\n }}\r\n >\r\n <PlusIcon />\r\n </Button>\r\n ) : null}\r\n <span className=\"highlight\" />\r\n <span className={'bar ' + (this.state.focused ? 'focused' : '')} />\r\n {this.renderDefaultValidation()}\r\n {this.props.label && (\r\n <label\r\n className={\r\n this.props.prices && this.props.prices ? 'label--focused' : ''\r\n }\r\n >\r\n {this.renderLabel()}\r\n </label>\r\n )}\r\n </div>\r\n </InputGroup>\r\n );\r\n }\r\n\r\n private onCurrencyChanged =\r\n (index: number, currentCurrencies: SelectValue[]) => (e) => {\r\n let newPrices: MoneyWithCurrency[] = [].concat(this.props.prices);\r\n newPrices[index].currency = currentCurrencies.filter(\r\n (cc) => cc.value.toString() === e.target.value\r\n )[0];\r\n this.props.onPricesChange(newPrices);\r\n };\r\n\r\n private onTheFlightValidate = (value: string) => {\r\n let num = Number(value);\r\n const parts = value.split('.');\r\n if (parts && parts.length > 1 && parts[parts.length - 1].length > 2) {\r\n return false;\r\n }\r\n if (!isNaN(num)) {\r\n return true;\r\n }\r\n if (num) {\r\n return false;\r\n }\r\n };\r\n\r\n private onPriceChanged = (index: number) => (value: number) => {\r\n let newPrices: MoneyWithCurrency[] = [].concat(this.props.prices);\r\n if (!isNaN(value)) {\r\n newPrices[index].value = value;\r\n }\r\n this.props.onPricesChange(newPrices);\r\n if (!this.state.touched) {\r\n this.touch();\r\n }\r\n };\r\n\r\n private removePriceClick = (index: number) => () => {\r\n const newPrices = this.props.prices.filter(\r\n (price, itemIndex) => itemIndex !== index\r\n );\r\n this.props.onPricesChange(newPrices);\r\n if (newPrices.length === 0 && this.props.required) {\r\n this.setInvalid([\r\n this.getTranslations(defaultMoneyTranslations).required,\r\n ]);\r\n }\r\n if (!this.state.touched) {\r\n this.touch();\r\n }\r\n };\r\n\r\n private addPriceClick = (unusedCurrencies: SelectValue[]) => () => {\r\n this.props.onPricesChange(\r\n this.props.prices.concat([\r\n { value: undefined, currency: unusedCurrencies[0] },\r\n ])\r\n );\r\n // we are going to focus the last input in the this.containerRef element after a timeout\r\n setTimeout(() => {\r\n const inputs = this.containerRef.current?.querySelectorAll('input');\r\n if (inputs?.length) {\r\n inputs[inputs.length - 1].focus();\r\n }\r\n }, 0);\r\n this.setValid();\r\n if (!this.state.touched) {\r\n this.touch();\r\n }\r\n };\r\n\r\n private onFocus = () => this.setState({ focused: true });\r\n\r\n private onBlur = () => this.setState({ focused: false });\r\n}\r\n\r\nexport const Money = withThemeContext<\r\n MoneyProps,\r\n InstanceType<typeof MoneyRaw>\r\n>(withFormContext<MoneyProps>(MoneyRaw), 'money');\r\n\r\nexport default Money;\r\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAMA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AAAqE,SAAAI,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAd,wBAAAU,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GA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3,7 @@
|
|
3
3
|
<head>
|
4
4
|
<meta charset="UTF-8"/>
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
6
|
-
<title>guestbell-forms [30 Nov 2024 at
|
6
|
+
<title>guestbell-forms [30 Nov 2024 at 17:52]</title>
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/A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YDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
|
8
8
|
|
9
9
|
<script>
|
@@ -21,15 +21,15 @@ class NumberValidator {
|
|
21
21
|
return false;
|
22
22
|
}
|
23
23
|
if (this.config.max !== undefined && num >= this.config.max) {
|
24
|
-
addError('Max: ' +
|
24
|
+
addError('Max: ' + this.config.max);
|
25
25
|
return false;
|
26
26
|
}
|
27
27
|
if (this.config.minInclusive !== undefined && num < this.config.minInclusive) {
|
28
28
|
addError('Min: ' + this.config.minInclusive);
|
29
29
|
return false;
|
30
30
|
}
|
31
|
-
if (this.config.maxInclusive !== undefined && num
|
32
|
-
addError('Max: ' +
|
31
|
+
if (this.config.maxInclusive !== undefined && num > this.config.maxInclusive) {
|
32
|
+
addError('Max: ' + this.config.maxInclusive);
|
33
33
|
return false;
|
34
34
|
}
|
35
35
|
return true;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"NumberValidator.js","names":["NumberValidator","constructor","config","arguments","length","undefined","min","max","Validate","value","isRequired","addError","num","Number","isNaN","minInclusive","maxInclusive","exports"],"sources":["../../src/lib/validators/NumberValidator.ts"],"sourcesContent":["import { IBaseValidator } from './base';\r\nexport interface NumberValidatorConfig {\r\n min?: number;\r\n max?: number;\r\n minInclusive?: number;\r\n maxInclusive?: number;\r\n}\r\n\r\nexport class NumberValidator implements IBaseValidator {\r\n private config: NumberValidatorConfig;\r\n constructor(\r\n config: NumberValidatorConfig = { min: undefined, max: undefined }\r\n ) {\r\n this.config = config;\r\n }\r\n public Validate(\r\n value: string,\r\n isRequired: boolean,\r\n addError: (error: string) => void\r\n ): boolean {\r\n let num = Number(value);\r\n if (!isNaN(num)) {\r\n if (this.config.min !== undefined && num <= this.config.min) {\r\n addError('Min: ' + this.config.min);\r\n return false;\r\n }\r\n if (this.config.max !== undefined && num >= this.config.max) {\r\n addError('Max: ' +
|
1
|
+
{"version":3,"file":"NumberValidator.js","names":["NumberValidator","constructor","config","arguments","length","undefined","min","max","Validate","value","isRequired","addError","num","Number","isNaN","minInclusive","maxInclusive","exports"],"sources":["../../src/lib/validators/NumberValidator.ts"],"sourcesContent":["import { IBaseValidator } from './base';\r\nexport interface NumberValidatorConfig {\r\n min?: number;\r\n max?: number;\r\n minInclusive?: number;\r\n maxInclusive?: number;\r\n}\r\n\r\nexport class NumberValidator implements IBaseValidator {\r\n private config: NumberValidatorConfig;\r\n constructor(\r\n config: NumberValidatorConfig = { min: undefined, max: undefined }\r\n ) {\r\n this.config = config;\r\n }\r\n public Validate(\r\n value: string,\r\n isRequired: boolean,\r\n addError: (error: string) => void\r\n ): boolean {\r\n let num = Number(value);\r\n if (!isNaN(num)) {\r\n if (this.config.min !== undefined && num <= this.config.min) {\r\n addError('Min: ' + this.config.min);\r\n return false;\r\n }\r\n if (this.config.max !== undefined && num >= this.config.max) {\r\n addError('Max: ' + this.config.max);\r\n return false;\r\n }\r\n if (\r\n this.config.minInclusive !== undefined &&\r\n num < this.config.minInclusive\r\n ) {\r\n addError('Min: ' + this.config.minInclusive);\r\n return false;\r\n }\r\n if (\r\n this.config.maxInclusive !== undefined &&\r\n num > this.config.maxInclusive\r\n ) {\r\n addError('Max: ' + this.config.maxInclusive);\r\n return false;\r\n }\r\n return true;\r\n }\r\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AACT,MAAM,CAACc,YAAY,CAAC;QAC5C,OAAO,KAAK;MACd;MACA,OAAO,IAAI;IACb;IACAL,QAAQ,CAAC,gBAAgB,CAAC;IAC1B,OAAO,KAAK;EACd;AACF;AAACM,OAAA,CAAAjB,eAAA,GAAAA,eAAA"}
|
package/package.json
CHANGED
@@ -150,6 +150,11 @@ export class MoneyRaw extends BaseInput<
|
|
150
150
|
number={item.value}
|
151
151
|
onNumberChange={this.onPriceChanged(index)}
|
152
152
|
customValidators={this.props.customValidators}
|
153
|
+
validationName={
|
154
|
+
this.props.validationName
|
155
|
+
? `${this.props.validationName} (${currency?.label})`
|
156
|
+
: currency?.label
|
157
|
+
}
|
153
158
|
/>
|
154
159
|
{!this.props.disableDelete &&
|
155
160
|
this.props.prices.length > 0 && (
|
@@ -25,7 +25,7 @@ export class NumberValidator implements IBaseValidator {
|
|
25
25
|
return false;
|
26
26
|
}
|
27
27
|
if (this.config.max !== undefined && num >= this.config.max) {
|
28
|
-
addError('Max: ' +
|
28
|
+
addError('Max: ' + this.config.max);
|
29
29
|
return false;
|
30
30
|
}
|
31
31
|
if (
|
@@ -37,9 +37,9 @@ export class NumberValidator implements IBaseValidator {
|
|
37
37
|
}
|
38
38
|
if (
|
39
39
|
this.config.maxInclusive !== undefined &&
|
40
|
-
num
|
40
|
+
num > this.config.maxInclusive
|
41
41
|
) {
|
42
|
-
addError('Max: ' +
|
42
|
+
addError('Max: ' + this.config.maxInclusive);
|
43
43
|
return false;
|
44
44
|
}
|
45
45
|
return true;
|