@oneblink/apps-react 5.3.0-beta.3 → 5.3.0-beta.4
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/dist/components/renderer/AutocompleteDropdown.js +3 -1
- package/dist/components/renderer/AutocompleteDropdown.js.map +1 -1
- package/dist/components/renderer/LookupNotification.js +2 -1
- package/dist/components/renderer/LookupNotification.js.map +1 -1
- package/dist/form-elements/FormElementABN.js +8 -4
- package/dist/form-elements/FormElementABN.js.map +1 -1
- package/dist/form-elements/FormElementBSB.js +8 -4
- package/dist/form-elements/FormElementBSB.js.map +1 -1
- package/dist/form-elements/FormElementBarcodeScanner.js +4 -2
- package/dist/form-elements/FormElementBarcodeScanner.js.map +1 -1
- package/dist/form-elements/FormElementBoolean.js +4 -1
- package/dist/form-elements/FormElementBoolean.js.map +1 -1
- package/dist/form-elements/FormElementCheckBoxes.js +4 -1
- package/dist/form-elements/FormElementCheckBoxes.js.map +1 -1
- package/dist/form-elements/FormElementDate.js +4 -1
- package/dist/form-elements/FormElementDate.js.map +1 -1
- package/dist/form-elements/FormElementDateTime.js +4 -1
- package/dist/form-elements/FormElementDateTime.js.map +1 -1
- package/dist/form-elements/FormElementEmail.js +4 -1
- package/dist/form-elements/FormElementEmail.js.map +1 -1
- package/dist/form-elements/FormElementFiles.js +4 -1
- package/dist/form-elements/FormElementFiles.js.map +1 -1
- package/dist/form-elements/FormElementLocation.js +4 -1
- package/dist/form-elements/FormElementLocation.js.map +1 -1
- package/dist/form-elements/FormElementNumber.js +4 -1
- package/dist/form-elements/FormElementNumber.js.map +1 -1
- package/dist/form-elements/FormElementRadio.js +4 -1
- package/dist/form-elements/FormElementRadio.js.map +1 -1
- package/dist/form-elements/FormElementSelect.js +4 -1
- package/dist/form-elements/FormElementSelect.js.map +1 -1
- package/dist/form-elements/FormElementTelephone.js +4 -1
- package/dist/form-elements/FormElementTelephone.js.map +1 -1
- package/dist/form-elements/FormElementText.js +3 -1
- package/dist/form-elements/FormElementText.js.map +1 -1
- package/dist/form-elements/FormElementTextarea.js +3 -1
- package/dist/form-elements/FormElementTextarea.js.map +1 -1
- package/dist/form-elements/FormElementTime.js +4 -1
- package/dist/form-elements/FormElementTime.js.map +1 -1
- package/dist/hooks/useLookupNotification.d.ts +2 -0
- package/dist/hooks/useLookupNotification.js +1 -0
- package/dist/hooks/useLookupNotification.js.map +1 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useLookupNotification.js","sourceRoot":"","sources":["../../src/hooks/useLookupNotification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"useLookupNotification.js","sourceRoot":"","sources":["../../src/hooks/useLookupNotification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAe9B,MAAM,cAAc,GAAG;IACrB,QAAQ,EAAE,KAAK;IACf,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;IAChB,uBAAuB,EAAE,KAAK;IAC9B,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,SAAS;IAC/B,WAAW,EAAE,KAAK;CACnB,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GACpC,KAAK,CAAC,aAAa,CAAiC,cAAc,CAAC,CAAA;AAErE,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,KAAc;IAC1D,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAA;IAE1E,qEAAqE;IACrE,mEAAmE;IACnE,qEAAqE;IACrE,kEAAkE;IAClE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAEvD,0EAA0E;IAC1E,yEAAyE;IACzE,qBAAqB;IACrB,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAAyB,IAAI,CAAC,CAAA;IAErE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,WAAW,KAAK,CAAC,EAAE;YACrB,OAAM;SACP;QACD,kBAAkB,CAAC,OAAO,GAAG,IAAI,eAAe,EAAE,CAAA;QAClD,QAAQ,CAAC;YACP,QAAQ,EAAE,KAAK;YACf,eAAe,EAAE,kBAAkB,CAAC,OAAO;YAC3C,qBAAqB,EAAE,KAAK;SAC7B,CAAC,CAAA;QACF,uDAAuD;QACvD,uDAAuD;QACvD,2DAA2D;QAC3D,2DAA2D;QAC3D,uDAAuD;IACzD,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;IAEjB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,eAAe,GAAG,kBAAkB,CAAC,OAAO,CAAA;QAClD,IAAI,eAAe,EAAE;YACnB,OAAO,GAAG,EAAE;gBACV,eAAe,CAAC,KAAK,EAAE,CAAA;YACzB,CAAC,CAAA;SACF;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAA;IAExB,OAAO;QACL,GAAG,KAAK;QACR,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;YAC/B,cAAc,CAAC,CAAC,kBAAkB,EAAE,EAAE,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAA;QAChE,CAAC,EAAE,EAAE,CAAC;KACP,CAAA;AACH,CAAC","sourcesContent":["import * as React from 'react'\n\nexport type LookupNotificationContextValue = {\n isLookup: boolean\n isDisabled: boolean\n isLoading: boolean\n allowLookupOnEmptyValue: boolean\n onLookup: (options: {\n newValue: unknown\n abortController: AbortController\n continueLookupOnAbort: boolean\n }) => Promise<void>\n isLookingUp: boolean\n}\n\nconst defaultContext = {\n isLookup: false,\n isDisabled: false,\n isLoading: false,\n allowLookupOnEmptyValue: false,\n onLookup: async () => undefined,\n isLookingUp: false,\n}\n\nexport const LookupNotificationContext =\n React.createContext<LookupNotificationContextValue>(defaultContext)\n\nexport default function useLookupNotification(value: unknown) {\n const { onLookup, ...state } = React.useContext(LookupNotificationContext)\n\n // We use a number to trigger the lookup function so that we can have\n // the effect below run every time the onLookup function is called.\n // We need it in an useEffect so that we can pass an abort controller\n // and have it aborted if the user clicks the lookup button again.\n const [lookupCount, setLookupCount] = React.useState(0)\n\n // We use a ref here to keep the abort controller outside of the useEffect\n // below. This way we can abort the lookup if the value changes while the\n // lookup is running.\n const abortControllerRef = React.useRef<AbortController | null>(null)\n\n React.useEffect(() => {\n if (lookupCount === 0) {\n return\n }\n abortControllerRef.current = new AbortController()\n onLookup({\n newValue: value,\n abortController: abortControllerRef.current,\n continueLookupOnAbort: false,\n })\n // Wants to use \"onLookup\" and \"value\" as dependencies,\n // however, these will change on any change made on any\n // element. Checking if \"lookupCount\" has changed is enough\n // to trigger a lookup when the correct dependencies change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [lookupCount])\n\n React.useEffect(() => {\n const abortController = abortControllerRef.current\n if (abortController) {\n return () => {\n abortController.abort()\n }\n }\n }, [value, lookupCount])\n\n return {\n ...state,\n onLookup: React.useCallback(() => {\n setLookupCount((currentLookupCount) => currentLookupCount + 1)\n }, []),\n }\n}\n"]}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@oneblink/apps-react",
|
3
3
|
"description": "Helper functions for OneBlink apps in ReactJS.",
|
4
|
-
"version": "5.3.0-beta.
|
4
|
+
"version": "5.3.0-beta.4",
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
6
6
|
"bugs": {
|
7
7
|
"url": "https://github.com/oneblink/apps-react/issues"
|