@elliemae/ds-form 2.3.0-alpha.2 → 2.3.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -197,7 +197,7 @@ const handleCompletedDate = (time, date, show, INTERNAL_V2_NO_MUTATION) => {
|
|
|
197
197
|
const isTimeCompletelySet = (date, show, range) => {
|
|
198
198
|
let neededValues = [];
|
|
199
199
|
const { year, month, day } = date;
|
|
200
|
-
if (day.length < 1 || month.length < 1)
|
|
200
|
+
if (day && day.length < 1 || month && month.length < 1)
|
|
201
201
|
return false;
|
|
202
202
|
const { showYear, showMonth, showDay } = show;
|
|
203
203
|
const { yearMinRange, yearMaxRange } = range;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/DateInput/components/utils.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-params */\n/* eslint-disable complexity */\n/* eslint-disable max-lines */\nimport { addLeadingZeros, parseInt, isNaN } from '@elliemae/ds-utilities';\nimport moment from 'moment';\n\nconst currentYear = new Date().getFullYear();\n\nexport const isArrowIncrementDecrement = (key) => key === 'ArrowDown' || key === 'ArrowUp';\n\n// TODO remove and keep `true` behavior ( PUI-4141 )\nexport const setNativeValue = (element, value) => {\n if (!Object.getOwnPropertyDescriptor(element, 'value')) return;\n const valueSetter = Object.getOwnPropertyDescriptor(element, 'value').set;\n const prototype = Object.getPrototypeOf(element);\n const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, 'value').set;\n\n if (valueSetter && valueSetter !== prototypeValueSetter) {\n prototypeValueSetter.call(element, value);\n } else {\n valueSetter.call(element, value);\n }\n element.dispatchEvent(new Event('input', { bubbles: true }));\n};\n\nconst formatTimeNumber = (value, shouldAddLeadingZeros, leadingZeros) => {\n if (value === null || value === undefined) return '';\n return shouldAddLeadingZeros ? addLeadingZeros(leadingZeros)(value) : String(value);\n};\n\nexport const formatDay = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('DD') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros, 2);\n};\nexport const formatYear = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('YYYY') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros, 4);\n};\nexport const formatMonth = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('MM') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros, 2);\n};\n\nexport const parseTimeNumberFromText = (stringValue) => {\n const parsedInt = parseInt(stringValue);\n\n if (isNaN(parsedInt)) return null;\n\n return parsedInt;\n};\n\n// trigger onBlur for entire DateInput control if focus is not in day, month, year\nexport const triggerOnBlur = (blurEvent, onBlur = () => {}) => {\n const { target: currentEl = {}, relatedTarget } = blurEvent || {};\n const nextElement = currentEl.nextElementSibling;\n const { nextElementSibling } = nextElement || {};\n // relatedTarget points to the element that is currently having focus\n if (!nextElementSibling || nextElementSibling !== relatedTarget) {\n onBlur(blurEvent);\n }\n};\n\nexport const focusNextInput = (currentEl) => {\n const nextElement = currentEl.nextElementSibling;\n if (nextElement && nextElement.nextElementSibling) {\n nextElement.nextElementSibling.focus();\n }\n};\n\nexport const focusPreviousInput = (currentEl) => {\n const previousElement = currentEl.previousElementSibling;\n if (previousElement && previousElement.previousElementSibling) {\n previousElement.previousElementSibling.focus();\n }\n};\n\nexport const getValidTimeNumber = ({ min, max }, number, valueString = '', onError = () => null) => {\n if (valueString === '0' || number === 0) return null;\n if (number === undefined || number === null) return null;\n if (number > max) {\n onError();\n return max;\n }\n if (number < min) {\n onError();\n return min;\n }\n return number;\n};\n\nexport const shouldFocusNextInput = (max, number = 0, stringValue) => {\n if (stringValue.length > 1 && !stringValue.startsWith('0')) return true;\n return number * 10 > max;\n};\n\nexport const getDateValuesFromTime = (time, format) => {\n if (!time || !time.format) return {};\n const month = time.format('MM');\n const day = time.format('DD');\n const year = time.format('YYYY');\n return {\n month: formatMonth(format, month),\n day: formatDay(format, day),\n year: formatYear(format, year),\n };\n};\n\nexport const resetTimeValues = () => ({\n month: '',\n day: '',\n year: '',\n});\n\nexport const onInputFocus = (e) => {\n e.preventDefault();\n e.stopPropagation();\n e.target.select();\n};\n\nexport const getNextTimeValue = (value, target, yearMinRange, yearMaxRange, step = 1, incrementing = true) => {\n const parsedValue = parseTimeNumberFromText(value);\n let result = incrementing ? parsedValue + step : parsedValue - step;\n if (target === 'year') {\n if (result < yearMinRange) result = currentYear;\n if (result > yearMaxRange) result = currentYear;\n }\n return result;\n};\n\nexport const focusNextInputIfNeeded = (currentEl, max, number, stringValue, currentKey) => {\n if (shouldFocusNextInput(max, number, stringValue) && !isArrowIncrementDecrement(currentKey)) {\n focusNextInput(currentEl);\n }\n};\n\nexport const commonInputProps = (digits = 2, onKeyDown, placeholder) => {\n const props = {\n pattern: '[0-9]*',\n placeholder,\n type: 'text',\n onKeyDown,\n onFocus: onInputFocus,\n };\n if (digits === 4) props.placeholder = 'YYYY';\n return props;\n};\n\nexport const handleCompletedDate = (time, date, show, INTERNAL_V2_NO_MUTATION) => {\n // clone time to avoid mutation when INTERNAL_V2_NO_MUTATION is true\n const newDate = INTERNAL_V2_NO_MUTATION ? (time && moment(time)) || moment() : time || moment();\n\n const { year, month, day } = date;\n const { showYear, showMonth, showDay } = show;\n\n if (time && !year && !month && !day) return '';\n\n newDate.value = `${year}-${month}-${day}`;\n\n if (showMonth && month) newDate.month(parseInt(month - 1, 10));\n if (showDay && day) newDate.date(parseInt(day, 10));\n if (showYear && year) newDate.year(parseInt(year, 10));\n\n return newDate;\n};\n\nexport const isTimeCompletelySet = (date, show, range) => {\n let neededValues = [];\n const { year, month, day } = date;\n if (day.length < 1 || month.length < 1) return false;\n const { showYear, showMonth, showDay } = show;\n const { yearMinRange, yearMaxRange } = range;\n\n if (showMonth) neededValues = [...neededValues, month || null];\n if (showDay) neededValues = [...neededValues, day || null];\n if (showYear) neededValues = [...neededValues, year || null];\n\n const isValidYear = year < yearMaxRange && year > yearMinRange;\n\n return !neededValues.some((value) => !value) && isValidYear;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,0BAAiD;AACjD,oBAAmB;AAEnB,MAAM,cAAc,IAAI,OAAO;AAExB,MAAM,4BAA4B,CAAC,QAAQ,QAAQ,eAAe,QAAQ;AAG1E,MAAM,iBAAiB,CAAC,SAAS,UAAU;AAChD,MAAI,CAAC,OAAO,yBAAyB,SAAS;AAAU;AACxD,QAAM,cAAc,OAAO,yBAAyB,SAAS,SAAS;AACtE,QAAM,YAAY,OAAO,eAAe;AACxC,QAAM,uBAAuB,OAAO,yBAAyB,WAAW,SAAS;AAEjF,MAAI,eAAe,gBAAgB,sBAAsB;AACvD,yBAAqB,KAAK,SAAS;AAAA,SAC9B;AACL,gBAAY,KAAK,SAAS;AAAA;AAE5B,UAAQ,cAAc,IAAI,MAAM,SAAS,EAAE,SAAS;AAAA;AAGtD,MAAM,mBAAmB,CAAC,OAAO,uBAAuB,iBAAiB;AACvE,MAAI,UAAU,QAAQ,UAAU;AAAW,WAAO;AAClD,SAAO,wBAAwB,yCAAgB,cAAc,SAAS,OAAO;AAAA;AAGxE,MAAM,YAAY,CAAC,QAAQ,UAAU;AAC1C,QAAM,wBAAwB,OAAO,QAAQ,QAAQ;AACrD,SAAO,iBAAiB,OAAO,uBAAuB;AAAA;AAEjD,MAAM,aAAa,CAAC,QAAQ,UAAU;AAC3C,QAAM,wBAAwB,OAAO,QAAQ,UAAU;AACvD,SAAO,iBAAiB,OAAO,uBAAuB;AAAA;AAEjD,MAAM,cAAc,CAAC,QAAQ,UAAU;AAC5C,QAAM,wBAAwB,OAAO,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,MAAI,aAAa;AAAO,YAAQ,MAAM,kCAAS,QAAQ,GAAG;AAC1D,MAAI,WAAW;AAAK,YAAQ,KAAK,kCAAS,KAAK;AAC/C,MAAI,YAAY;AAAM,YAAQ,KAAK,kCAAS,MAAM;AAElD,SAAO;AAAA;AAGF,MAAM,sBAAsB,CAAC,MAAM,MAAM,UAAU;AACxD,MAAI,eAAe;AACnB,QAAM,EAAE,MAAM,OAAO,QAAQ;AAC7B,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-params */\n/* eslint-disable complexity */\n/* eslint-disable max-lines */\nimport { addLeadingZeros, parseInt, isNaN } from '@elliemae/ds-utilities';\nimport moment from 'moment';\n\nconst currentYear = new Date().getFullYear();\n\nexport const isArrowIncrementDecrement = (key) => key === 'ArrowDown' || key === 'ArrowUp';\n\n// TODO remove and keep `true` behavior ( PUI-4141 )\nexport const setNativeValue = (element, value) => {\n if (!Object.getOwnPropertyDescriptor(element, 'value')) return;\n const valueSetter = Object.getOwnPropertyDescriptor(element, 'value').set;\n const prototype = Object.getPrototypeOf(element);\n const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, 'value').set;\n\n if (valueSetter && valueSetter !== prototypeValueSetter) {\n prototypeValueSetter.call(element, value);\n } else {\n valueSetter.call(element, value);\n }\n element.dispatchEvent(new Event('input', { bubbles: true }));\n};\n\nconst formatTimeNumber = (value, shouldAddLeadingZeros, leadingZeros) => {\n if (value === null || value === undefined) return '';\n return shouldAddLeadingZeros ? addLeadingZeros(leadingZeros)(value) : String(value);\n};\n\nexport const formatDay = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('DD') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros, 2);\n};\nexport const formatYear = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('YYYY') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros, 4);\n};\nexport const formatMonth = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('MM') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros, 2);\n};\n\nexport const parseTimeNumberFromText = (stringValue) => {\n const parsedInt = parseInt(stringValue);\n\n if (isNaN(parsedInt)) return null;\n\n return parsedInt;\n};\n\n// trigger onBlur for entire DateInput control if focus is not in day, month, year\nexport const triggerOnBlur = (blurEvent, onBlur = () => {}) => {\n const { target: currentEl = {}, relatedTarget } = blurEvent || {};\n const nextElement = currentEl.nextElementSibling;\n const { nextElementSibling } = nextElement || {};\n // relatedTarget points to the element that is currently having focus\n if (!nextElementSibling || nextElementSibling !== relatedTarget) {\n onBlur(blurEvent);\n }\n};\n\nexport const focusNextInput = (currentEl) => {\n const nextElement = currentEl.nextElementSibling;\n if (nextElement && nextElement.nextElementSibling) {\n nextElement.nextElementSibling.focus();\n }\n};\n\nexport const focusPreviousInput = (currentEl) => {\n const previousElement = currentEl.previousElementSibling;\n if (previousElement && previousElement.previousElementSibling) {\n previousElement.previousElementSibling.focus();\n }\n};\n\nexport const getValidTimeNumber = ({ min, max }, number, valueString = '', onError = () => null) => {\n if (valueString === '0' || number === 0) return null;\n if (number === undefined || number === null) return null;\n if (number > max) {\n onError();\n return max;\n }\n if (number < min) {\n onError();\n return min;\n }\n return number;\n};\n\nexport const shouldFocusNextInput = (max, number = 0, stringValue) => {\n if (stringValue.length > 1 && !stringValue.startsWith('0')) return true;\n return number * 10 > max;\n};\n\nexport const getDateValuesFromTime = (time, format) => {\n if (!time || !time.format) return {};\n const month = time.format('MM');\n const day = time.format('DD');\n const year = time.format('YYYY');\n return {\n month: formatMonth(format, month),\n day: formatDay(format, day),\n year: formatYear(format, year),\n };\n};\n\nexport const resetTimeValues = () => ({\n month: '',\n day: '',\n year: '',\n});\n\nexport const onInputFocus = (e) => {\n e.preventDefault();\n e.stopPropagation();\n e.target.select();\n};\n\nexport const getNextTimeValue = (value, target, yearMinRange, yearMaxRange, step = 1, incrementing = true) => {\n const parsedValue = parseTimeNumberFromText(value);\n let result = incrementing ? parsedValue + step : parsedValue - step;\n if (target === 'year') {\n if (result < yearMinRange) result = currentYear;\n if (result > yearMaxRange) result = currentYear;\n }\n return result;\n};\n\nexport const focusNextInputIfNeeded = (currentEl, max, number, stringValue, currentKey) => {\n if (shouldFocusNextInput(max, number, stringValue) && !isArrowIncrementDecrement(currentKey)) {\n focusNextInput(currentEl);\n }\n};\n\nexport const commonInputProps = (digits = 2, onKeyDown, placeholder) => {\n const props = {\n pattern: '[0-9]*',\n placeholder,\n type: 'text',\n onKeyDown,\n onFocus: onInputFocus,\n };\n if (digits === 4) props.placeholder = 'YYYY';\n return props;\n};\n\nexport const handleCompletedDate = (time, date, show, INTERNAL_V2_NO_MUTATION) => {\n // clone time to avoid mutation when INTERNAL_V2_NO_MUTATION is true\n const newDate = INTERNAL_V2_NO_MUTATION ? (time && moment(time)) || moment() : time || moment();\n\n const { year, month, day } = date;\n const { showYear, showMonth, showDay } = show;\n\n if (time && !year && !month && !day) return '';\n\n newDate.value = `${year}-${month}-${day}`;\n\n if (showMonth && month) newDate.month(parseInt(month - 1, 10));\n if (showDay && day) newDate.date(parseInt(day, 10));\n if (showYear && year) newDate.year(parseInt(year, 10));\n\n return newDate;\n};\n\nexport const isTimeCompletelySet = (date, show, range) => {\n let neededValues = [];\n const { year, month, day } = date;\n if ((day && day.length < 1) || (month && month.length < 1)) return false;\n const { showYear, showMonth, showDay } = show;\n const { yearMinRange, yearMaxRange } = range;\n\n if (showMonth) neededValues = [...neededValues, month || null];\n if (showDay) neededValues = [...neededValues, day || null];\n if (showYear) neededValues = [...neededValues, year || null];\n\n const isValidYear = year < yearMaxRange && year > yearMinRange;\n\n return !neededValues.some((value) => !value) && isValidYear;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB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,IAAI,SAAS,KAAO,SAAS,MAAM,SAAS;AAAI,WAAO;AACnE,QAAM,EAAE,UAAU,WAAW,YAAY;AACzC,QAAM,EAAE,cAAc,iBAAiB;AAEvC,MAAI;AAAW,mBAAe,CAAC,GAAG,cAAc,SAAS;AACzD,MAAI;AAAS,mBAAe,CAAC,GAAG,cAAc,OAAO;AACrD,MAAI;AAAU,mBAAe,CAAC,GAAG,cAAc,QAAQ;AAEvD,QAAM,cAAc,OAAO,gBAAgB,OAAO;AAElD,SAAO,CAAC,aAAa,KAAK,CAAC,UAAU,CAAC,UAAU;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -148,7 +148,7 @@ const handleCompletedDate = (time, date, show, INTERNAL_V2_NO_MUTATION) => {
|
|
|
148
148
|
const isTimeCompletelySet = (date, show, range) => {
|
|
149
149
|
let neededValues = [];
|
|
150
150
|
const { year, month, day } = date;
|
|
151
|
-
if (day.length < 1 || month.length < 1)
|
|
151
|
+
if (day && day.length < 1 || month && month.length < 1)
|
|
152
152
|
return false;
|
|
153
153
|
const { showYear, showMonth, showDay } = show;
|
|
154
154
|
const { yearMinRange, yearMaxRange } = range;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/DateInput/components/utils.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\n/* eslint-disable complexity */\n/* eslint-disable max-lines */\nimport { addLeadingZeros, parseInt, isNaN } from '@elliemae/ds-utilities';\nimport moment from 'moment';\n\nconst currentYear = new Date().getFullYear();\n\nexport const isArrowIncrementDecrement = (key) => key === 'ArrowDown' || key === 'ArrowUp';\n\n// TODO remove and keep `true` behavior ( PUI-4141 )\nexport const setNativeValue = (element, value) => {\n if (!Object.getOwnPropertyDescriptor(element, 'value')) return;\n const valueSetter = Object.getOwnPropertyDescriptor(element, 'value').set;\n const prototype = Object.getPrototypeOf(element);\n const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, 'value').set;\n\n if (valueSetter && valueSetter !== prototypeValueSetter) {\n prototypeValueSetter.call(element, value);\n } else {\n valueSetter.call(element, value);\n }\n element.dispatchEvent(new Event('input', { bubbles: true }));\n};\n\nconst formatTimeNumber = (value, shouldAddLeadingZeros, leadingZeros) => {\n if (value === null || value === undefined) return '';\n return shouldAddLeadingZeros ? addLeadingZeros(leadingZeros)(value) : String(value);\n};\n\nexport const formatDay = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('DD') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros, 2);\n};\nexport const formatYear = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('YYYY') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros, 4);\n};\nexport const formatMonth = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('MM') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros, 2);\n};\n\nexport const parseTimeNumberFromText = (stringValue) => {\n const parsedInt = parseInt(stringValue);\n\n if (isNaN(parsedInt)) return null;\n\n return parsedInt;\n};\n\n// trigger onBlur for entire DateInput control if focus is not in day, month, year\nexport const triggerOnBlur = (blurEvent, onBlur = () => {}) => {\n const { target: currentEl = {}, relatedTarget } = blurEvent || {};\n const nextElement = currentEl.nextElementSibling;\n const { nextElementSibling } = nextElement || {};\n // relatedTarget points to the element that is currently having focus\n if (!nextElementSibling || nextElementSibling !== relatedTarget) {\n onBlur(blurEvent);\n }\n};\n\nexport const focusNextInput = (currentEl) => {\n const nextElement = currentEl.nextElementSibling;\n if (nextElement && nextElement.nextElementSibling) {\n nextElement.nextElementSibling.focus();\n }\n};\n\nexport const focusPreviousInput = (currentEl) => {\n const previousElement = currentEl.previousElementSibling;\n if (previousElement && previousElement.previousElementSibling) {\n previousElement.previousElementSibling.focus();\n }\n};\n\nexport const getValidTimeNumber = ({ min, max }, number, valueString = '', onError = () => null) => {\n if (valueString === '0' || number === 0) return null;\n if (number === undefined || number === null) return null;\n if (number > max) {\n onError();\n return max;\n }\n if (number < min) {\n onError();\n return min;\n }\n return number;\n};\n\nexport const shouldFocusNextInput = (max, number = 0, stringValue) => {\n if (stringValue.length > 1 && !stringValue.startsWith('0')) return true;\n return number * 10 > max;\n};\n\nexport const getDateValuesFromTime = (time, format) => {\n if (!time || !time.format) return {};\n const month = time.format('MM');\n const day = time.format('DD');\n const year = time.format('YYYY');\n return {\n month: formatMonth(format, month),\n day: formatDay(format, day),\n year: formatYear(format, year),\n };\n};\n\nexport const resetTimeValues = () => ({\n month: '',\n day: '',\n year: '',\n});\n\nexport const onInputFocus = (e) => {\n e.preventDefault();\n e.stopPropagation();\n e.target.select();\n};\n\nexport const getNextTimeValue = (value, target, yearMinRange, yearMaxRange, step = 1, incrementing = true) => {\n const parsedValue = parseTimeNumberFromText(value);\n let result = incrementing ? parsedValue + step : parsedValue - step;\n if (target === 'year') {\n if (result < yearMinRange) result = currentYear;\n if (result > yearMaxRange) result = currentYear;\n }\n return result;\n};\n\nexport const focusNextInputIfNeeded = (currentEl, max, number, stringValue, currentKey) => {\n if (shouldFocusNextInput(max, number, stringValue) && !isArrowIncrementDecrement(currentKey)) {\n focusNextInput(currentEl);\n }\n};\n\nexport const commonInputProps = (digits = 2, onKeyDown, placeholder) => {\n const props = {\n pattern: '[0-9]*',\n placeholder,\n type: 'text',\n onKeyDown,\n onFocus: onInputFocus,\n };\n if (digits === 4) props.placeholder = 'YYYY';\n return props;\n};\n\nexport const handleCompletedDate = (time, date, show, INTERNAL_V2_NO_MUTATION) => {\n // clone time to avoid mutation when INTERNAL_V2_NO_MUTATION is true\n const newDate = INTERNAL_V2_NO_MUTATION ? (time && moment(time)) || moment() : time || moment();\n\n const { year, month, day } = date;\n const { showYear, showMonth, showDay } = show;\n\n if (time && !year && !month && !day) return '';\n\n newDate.value = `${year}-${month}-${day}`;\n\n if (showMonth && month) newDate.month(parseInt(month - 1, 10));\n if (showDay && day) newDate.date(parseInt(day, 10));\n if (showYear && year) newDate.year(parseInt(year, 10));\n\n return newDate;\n};\n\nexport const isTimeCompletelySet = (date, show, range) => {\n let neededValues = [];\n const { year, month, day } = date;\n if (day.length < 1 || month.length < 1) return false;\n const { showYear, showMonth, showDay } = show;\n const { yearMinRange, yearMaxRange } = range;\n\n if (showMonth) neededValues = [...neededValues, month || null];\n if (showDay) neededValues = [...neededValues, day || null];\n if (showYear) neededValues = [...neededValues, year || null];\n\n const isValidYear = year < yearMaxRange && year > yearMinRange;\n\n return !neededValues.some((value) => !value) && isValidYear;\n};\n"],
|
|
5
|
-
"mappings": "AAAA;ACGA;AACA;AAEA,MAAM,cAAc,IAAI,OAAO;AAExB,MAAM,4BAA4B,CAAC,QAAQ,QAAQ,eAAe,QAAQ;AAG1E,MAAM,iBAAiB,CAAC,SAAS,UAAU;AAChD,MAAI,CAAC,OAAO,yBAAyB,SAAS;AAAU;AACxD,QAAM,cAAc,OAAO,yBAAyB,SAAS,SAAS;AACtE,QAAM,YAAY,OAAO,eAAe;AACxC,QAAM,uBAAuB,OAAO,yBAAyB,WAAW,SAAS;AAEjF,MAAI,eAAe,gBAAgB,sBAAsB;AACvD,yBAAqB,KAAK,SAAS;AAAA,SAC9B;AACL,gBAAY,KAAK,SAAS;AAAA;AAE5B,UAAQ,cAAc,IAAI,MAAM,SAAS,EAAE,SAAS;AAAA;AAGtD,MAAM,mBAAmB,CAAC,OAAO,uBAAuB,iBAAiB;AACvE,MAAI,UAAU,QAAQ,UAAU;AAAW,WAAO;AAClD,SAAO,wBAAwB,gBAAgB,cAAc,SAAS,OAAO;AAAA;AAGxE,MAAM,YAAY,CAAC,QAAQ,UAAU;AAC1C,QAAM,wBAAwB,OAAO,QAAQ,QAAQ;AACrD,SAAO,iBAAiB,OAAO,uBAAuB;AAAA;AAEjD,MAAM,aAAa,CAAC,QAAQ,UAAU;AAC3C,QAAM,wBAAwB,OAAO,QAAQ,UAAU;AACvD,SAAO,iBAAiB,O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Q,CAAC,SAAS,CAAC;AAAK,WAAO;AAE5C,UAAQ,QAAQ,GAAG,QAAQ,SAAS;AAEpC,MAAI,aAAa;AAAO,YAAQ,MAAM,SAAS,QAAQ,GAAG;AAC1D,MAAI,WAAW;AAAK,YAAQ,KAAK,SAAS,KAAK;AAC/C,MAAI,YAAY;AAAM,YAAQ,KAAK,SAAS,MAAM;AAElD,SAAO;AAAA;AAGF,MAAM,sBAAsB,CAAC,MAAM,MAAM,UAAU;AACxD,MAAI,eAAe;AACnB,QAAM,EAAE,MAAM,OAAO,QAAQ;AAC7B,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\n/* eslint-disable complexity */\n/* eslint-disable max-lines */\nimport { addLeadingZeros, parseInt, isNaN } from '@elliemae/ds-utilities';\nimport moment from 'moment';\n\nconst currentYear = new Date().getFullYear();\n\nexport const isArrowIncrementDecrement = (key) => key === 'ArrowDown' || key === 'ArrowUp';\n\n// TODO remove and keep `true` behavior ( PUI-4141 )\nexport const setNativeValue = (element, value) => {\n if (!Object.getOwnPropertyDescriptor(element, 'value')) return;\n const valueSetter = Object.getOwnPropertyDescriptor(element, 'value').set;\n const prototype = Object.getPrototypeOf(element);\n const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, 'value').set;\n\n if (valueSetter && valueSetter !== prototypeValueSetter) {\n prototypeValueSetter.call(element, value);\n } else {\n valueSetter.call(element, value);\n }\n element.dispatchEvent(new Event('input', { bubbles: true }));\n};\n\nconst formatTimeNumber = (value, shouldAddLeadingZeros, leadingZeros) => {\n if (value === null || value === undefined) return '';\n return shouldAddLeadingZeros ? addLeadingZeros(leadingZeros)(value) : String(value);\n};\n\nexport const formatDay = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('DD') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros, 2);\n};\nexport const formatYear = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('YYYY') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros, 4);\n};\nexport const formatMonth = (format, value) => {\n const shouldAddLeadingZeros = format.indexOf('MM') > -1;\n return formatTimeNumber(value, shouldAddLeadingZeros, 2);\n};\n\nexport const parseTimeNumberFromText = (stringValue) => {\n const parsedInt = parseInt(stringValue);\n\n if (isNaN(parsedInt)) return null;\n\n return parsedInt;\n};\n\n// trigger onBlur for entire DateInput control if focus is not in day, month, year\nexport const triggerOnBlur = (blurEvent, onBlur = () => {}) => {\n const { target: currentEl = {}, relatedTarget } = blurEvent || {};\n const nextElement = currentEl.nextElementSibling;\n const { nextElementSibling } = nextElement || {};\n // relatedTarget points to the element that is currently having focus\n if (!nextElementSibling || nextElementSibling !== relatedTarget) {\n onBlur(blurEvent);\n }\n};\n\nexport const focusNextInput = (currentEl) => {\n const nextElement = currentEl.nextElementSibling;\n if (nextElement && nextElement.nextElementSibling) {\n nextElement.nextElementSibling.focus();\n }\n};\n\nexport const focusPreviousInput = (currentEl) => {\n const previousElement = currentEl.previousElementSibling;\n if (previousElement && previousElement.previousElementSibling) {\n previousElement.previousElementSibling.focus();\n }\n};\n\nexport const getValidTimeNumber = ({ min, max }, number, valueString = '', onError = () => null) => {\n if (valueString === '0' || number === 0) return null;\n if (number === undefined || number === null) return null;\n if (number > max) {\n onError();\n return max;\n }\n if (number < min) {\n onError();\n return min;\n }\n return number;\n};\n\nexport const shouldFocusNextInput = (max, number = 0, stringValue) => {\n if (stringValue.length > 1 && !stringValue.startsWith('0')) return true;\n return number * 10 > max;\n};\n\nexport const getDateValuesFromTime = (time, format) => {\n if (!time || !time.format) return {};\n const month = time.format('MM');\n const day = time.format('DD');\n const year = time.format('YYYY');\n return {\n month: formatMonth(format, month),\n day: formatDay(format, day),\n year: formatYear(format, year),\n };\n};\n\nexport const resetTimeValues = () => ({\n month: '',\n day: '',\n year: '',\n});\n\nexport const onInputFocus = (e) => {\n e.preventDefault();\n e.stopPropagation();\n e.target.select();\n};\n\nexport const getNextTimeValue = (value, target, yearMinRange, yearMaxRange, step = 1, incrementing = true) => {\n const parsedValue = parseTimeNumberFromText(value);\n let result = incrementing ? parsedValue + step : parsedValue - step;\n if (target === 'year') {\n if (result < yearMinRange) result = currentYear;\n if (result > yearMaxRange) result = currentYear;\n }\n return result;\n};\n\nexport const focusNextInputIfNeeded = (currentEl, max, number, stringValue, currentKey) => {\n if (shouldFocusNextInput(max, number, stringValue) && !isArrowIncrementDecrement(currentKey)) {\n focusNextInput(currentEl);\n }\n};\n\nexport const commonInputProps = (digits = 2, onKeyDown, placeholder) => {\n const props = {\n pattern: '[0-9]*',\n placeholder,\n type: 'text',\n onKeyDown,\n onFocus: onInputFocus,\n };\n if (digits === 4) props.placeholder = 'YYYY';\n return props;\n};\n\nexport const handleCompletedDate = (time, date, show, INTERNAL_V2_NO_MUTATION) => {\n // clone time to avoid mutation when INTERNAL_V2_NO_MUTATION is true\n const newDate = INTERNAL_V2_NO_MUTATION ? (time && moment(time)) || moment() : time || moment();\n\n const { year, month, day } = date;\n const { showYear, showMonth, showDay } = show;\n\n if (time && !year && !month && !day) return '';\n\n newDate.value = `${year}-${month}-${day}`;\n\n if (showMonth && month) newDate.month(parseInt(month - 1, 10));\n if (showDay && day) newDate.date(parseInt(day, 10));\n if (showYear && year) newDate.year(parseInt(year, 10));\n\n return newDate;\n};\n\nexport const isTimeCompletelySet = (date, show, range) => {\n let neededValues = [];\n const { year, month, day } = date;\n if ((day && day.length < 1) || (month && month.length < 1)) return false;\n const { showYear, showMonth, showDay } = show;\n const { yearMinRange, yearMaxRange } = range;\n\n if (showMonth) neededValues = [...neededValues, month || null];\n if (showDay) neededValues = [...neededValues, day || null];\n if (showYear) neededValues = [...neededValues, year || null];\n\n const isValidYear = year < yearMaxRange && year > yearMinRange;\n\n return !neededValues.some((value) => !value) && isValidYear;\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACGA;AACA;AAEA,MAAM,cAAc,IAAI,OAAO;AAExB,MAAM,4BAA4B,CAAC,QAAQ,QAAQ,eAAe,QAAQ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,MAAI;AAAW,mBAAe,CAAC,GAAG,cAAc,SAAS;AACzD,MAAI;AAAS,mBAAe,CAAC,GAAG,cAAc,OAAO;AACrD,MAAI;AAAU,mBAAe,CAAC,GAAG,cAAc,QAAQ;AAEvD,QAAM,cAAc,OAAO,gBAAgB,OAAO;AAElD,SAAO,CAAC,aAAa,KAAK,CAAC,UAAU,CAAC,UAAU;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-form",
|
|
3
|
-
"version": "2.3.0-alpha.
|
|
3
|
+
"version": "2.3.0-alpha.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Form",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -932,28 +932,28 @@
|
|
|
932
932
|
"build": "node ../../scripts/build/build.js"
|
|
933
933
|
},
|
|
934
934
|
"dependencies": {
|
|
935
|
-
"@elliemae/ds-button": "2.3.0-alpha.
|
|
936
|
-
"@elliemae/ds-circular-progress-indicator": "2.3.0-alpha.
|
|
937
|
-
"@elliemae/ds-classnames": "2.3.0-alpha.
|
|
938
|
-
"@elliemae/ds-controlled-form": "2.3.0-alpha.
|
|
939
|
-
"@elliemae/ds-dropdownmenu": "2.3.0-alpha.
|
|
940
|
-
"@elliemae/ds-form": "2.3.0-alpha.
|
|
941
|
-
"@elliemae/ds-grid": "2.3.0-alpha.
|
|
942
|
-
"@elliemae/ds-icon": "2.3.0-alpha.
|
|
943
|
-
"@elliemae/ds-icons": "2.3.0-alpha.
|
|
944
|
-
"@elliemae/ds-menu": "2.3.0-alpha.
|
|
945
|
-
"@elliemae/ds-overlay": "2.3.0-alpha.
|
|
946
|
-
"@elliemae/ds-pills": "2.3.0-alpha.
|
|
947
|
-
"@elliemae/ds-popper": "2.3.0-alpha.
|
|
948
|
-
"@elliemae/ds-popperjs": "2.3.0-alpha.
|
|
949
|
-
"@elliemae/ds-props-helpers": "2.3.0-alpha.
|
|
950
|
-
"@elliemae/ds-separator": "2.3.0-alpha.
|
|
951
|
-
"@elliemae/ds-shared": "2.3.0-alpha.
|
|
952
|
-
"@elliemae/ds-system": "2.3.0-alpha.
|
|
953
|
-
"@elliemae/ds-text-wrapper": "2.3.0-alpha.
|
|
954
|
-
"@elliemae/ds-tooltip": "2.3.0-alpha.
|
|
955
|
-
"@elliemae/ds-truncated-tooltip-text": "2.3.0-alpha.
|
|
956
|
-
"@elliemae/ds-utilities": "2.3.0-alpha.
|
|
935
|
+
"@elliemae/ds-button": "2.3.0-alpha.3",
|
|
936
|
+
"@elliemae/ds-circular-progress-indicator": "2.3.0-alpha.3",
|
|
937
|
+
"@elliemae/ds-classnames": "2.3.0-alpha.3",
|
|
938
|
+
"@elliemae/ds-controlled-form": "2.3.0-alpha.3",
|
|
939
|
+
"@elliemae/ds-dropdownmenu": "2.3.0-alpha.3",
|
|
940
|
+
"@elliemae/ds-form": "2.3.0-alpha.3",
|
|
941
|
+
"@elliemae/ds-grid": "2.3.0-alpha.3",
|
|
942
|
+
"@elliemae/ds-icon": "2.3.0-alpha.3",
|
|
943
|
+
"@elliemae/ds-icons": "2.3.0-alpha.3",
|
|
944
|
+
"@elliemae/ds-menu": "2.3.0-alpha.3",
|
|
945
|
+
"@elliemae/ds-overlay": "2.3.0-alpha.3",
|
|
946
|
+
"@elliemae/ds-pills": "2.3.0-alpha.3",
|
|
947
|
+
"@elliemae/ds-popper": "2.3.0-alpha.3",
|
|
948
|
+
"@elliemae/ds-popperjs": "2.3.0-alpha.3",
|
|
949
|
+
"@elliemae/ds-props-helpers": "2.3.0-alpha.3",
|
|
950
|
+
"@elliemae/ds-separator": "2.3.0-alpha.3",
|
|
951
|
+
"@elliemae/ds-shared": "2.3.0-alpha.3",
|
|
952
|
+
"@elliemae/ds-system": "2.3.0-alpha.3",
|
|
953
|
+
"@elliemae/ds-text-wrapper": "2.3.0-alpha.3",
|
|
954
|
+
"@elliemae/ds-tooltip": "2.3.0-alpha.3",
|
|
955
|
+
"@elliemae/ds-truncated-tooltip-text": "2.3.0-alpha.3",
|
|
956
|
+
"@elliemae/ds-utilities": "2.3.0-alpha.3",
|
|
957
957
|
"memoize-one": "~5.1.1",
|
|
958
958
|
"moment": "~2.29.1",
|
|
959
959
|
"prop-types": "~15.7.2",
|