@dnb/eufemia 10.48.0 → 10.49.0
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 +19 -0
- package/cjs/components/height-animation/HeightAnimationInstance.d.ts +1 -0
- package/cjs/components/height-animation/HeightAnimationInstance.js +13 -6
- package/cjs/components/height-animation/HeightAnimationInstance.js.map +1 -1
- package/cjs/extensions/forms/DataContext/Context.d.ts +6 -4
- package/cjs/extensions/forms/DataContext/Context.js +1 -2
- package/cjs/extensions/forms/DataContext/Context.js.map +1 -1
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.d.ts +4 -0
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.js.map +1 -1
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +13 -4
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
- package/cjs/extensions/forms/DataContext/Provider/Provider.d.ts +0 -4
- package/cjs/extensions/forms/DataContext/Provider/Provider.js +27 -28
- package/cjs/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/cjs/extensions/forms/Form/Isolation/Isolation.js +5 -4
- package/cjs/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/Array.js +12 -6
- package/cjs/extensions/forms/Iterate/Array/Array.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayDocs.js +6 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayDocs.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +1 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/types.d.ts +1 -0
- package/cjs/extensions/forms/Iterate/Array/types.js.map +1 -1
- package/cjs/extensions/forms/Iterate/EditContainer/DoneButton.js +0 -1
- package/cjs/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushButton/PushButton.js +19 -7
- package/cjs/extensions/forms/Iterate/PushButton/PushButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushContainer/OpenButton.js +18 -2
- package/cjs/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +2 -1
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainerDocs.js +5 -0
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainerDocs.js.map +1 -1
- package/cjs/extensions/forms/Iterate/RemoveButton/RemoveButton.js +3 -5
- package/cjs/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Step/Step.d.ts +1 -1
- package/cjs/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/cjs/extensions/forms/hooks/useFieldProps.js +20 -14
- package/cjs/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/cjs/shared/Eufemia.d.ts +1 -1
- package/cjs/shared/Eufemia.js +2 -2
- package/cjs/shared/Eufemia.js.map +1 -1
- package/cjs/style/core/scopes.scss +1 -1
- package/cjs/style/dnb-ui-basis.css +1 -1
- package/cjs/style/dnb-ui-basis.min.css +1 -1
- package/cjs/style/dnb-ui-body.css +1 -1
- package/cjs/style/dnb-ui-body.min.css +1 -1
- package/cjs/style/dnb-ui-core.css +1 -1
- package/cjs/style/dnb-ui-core.min.css +1 -1
- package/components/height-animation/HeightAnimationInstance.d.ts +1 -0
- package/components/height-animation/HeightAnimationInstance.js +13 -6
- package/components/height-animation/HeightAnimationInstance.js.map +1 -1
- package/es/components/height-animation/HeightAnimationInstance.d.ts +1 -0
- package/es/components/height-animation/HeightAnimationInstance.js +13 -6
- package/es/components/height-animation/HeightAnimationInstance.js.map +1 -1
- package/es/extensions/forms/DataContext/Context.d.ts +6 -4
- package/es/extensions/forms/DataContext/Context.js +1 -2
- package/es/extensions/forms/DataContext/Context.js.map +1 -1
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.d.ts +4 -0
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.js.map +1 -1
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +13 -4
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
- package/es/extensions/forms/DataContext/Provider/Provider.d.ts +0 -4
- package/es/extensions/forms/DataContext/Provider/Provider.js +27 -26
- package/es/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/es/extensions/forms/Form/Isolation/Isolation.js +5 -4
- package/es/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/Array.js +14 -8
- package/es/extensions/forms/Iterate/Array/Array.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/ArrayDocs.js +6 -1
- package/es/extensions/forms/Iterate/Array/ArrayDocs.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +1 -1
- package/es/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/types.d.ts +1 -0
- package/es/extensions/forms/Iterate/Array/types.js.map +1 -1
- package/es/extensions/forms/Iterate/EditContainer/DoneButton.js +0 -1
- package/es/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
- package/es/extensions/forms/Iterate/PushButton/PushButton.js +20 -8
- package/es/extensions/forms/Iterate/PushButton/PushButton.js.map +1 -1
- package/es/extensions/forms/Iterate/PushContainer/OpenButton.js +19 -3
- package/es/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
- package/es/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +2 -1
- package/es/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
- package/es/extensions/forms/Iterate/PushContainer/PushContainerDocs.js +5 -0
- package/es/extensions/forms/Iterate/PushContainer/PushContainerDocs.js.map +1 -1
- package/es/extensions/forms/Iterate/RemoveButton/RemoveButton.js +4 -6
- package/es/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
- package/es/extensions/forms/Wizard/Step/Step.d.ts +1 -1
- package/es/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/es/extensions/forms/hooks/useFieldProps.js +20 -14
- package/es/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/es/shared/Eufemia.d.ts +1 -1
- package/es/shared/Eufemia.js +2 -2
- package/es/shared/Eufemia.js.map +1 -1
- package/es/style/core/scopes.scss +1 -1
- package/es/style/dnb-ui-basis.css +1 -1
- package/es/style/dnb-ui-basis.min.css +1 -1
- package/es/style/dnb-ui-body.css +1 -1
- package/es/style/dnb-ui-body.min.css +1 -1
- package/es/style/dnb-ui-core.css +1 -1
- package/es/style/dnb-ui-core.min.css +1 -1
- package/esm/dnb-ui-basis.min.mjs +1 -1
- package/esm/dnb-ui-components.min.mjs +1 -1
- package/esm/dnb-ui-elements.min.mjs +1 -1
- package/esm/dnb-ui-extensions.min.mjs +2 -2
- package/esm/dnb-ui-lib.min.mjs +1 -1
- package/extensions/forms/DataContext/Context.d.ts +6 -4
- package/extensions/forms/DataContext/Context.js +1 -2
- package/extensions/forms/DataContext/Context.js.map +1 -1
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.d.ts +4 -0
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.js.map +1 -1
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +13 -4
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
- package/extensions/forms/DataContext/Provider/Provider.d.ts +0 -4
- package/extensions/forms/DataContext/Provider/Provider.js +27 -26
- package/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/extensions/forms/Form/Isolation/Isolation.js +5 -4
- package/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/extensions/forms/Iterate/Array/Array.js +14 -8
- package/extensions/forms/Iterate/Array/Array.js.map +1 -1
- package/extensions/forms/Iterate/Array/ArrayDocs.js +6 -1
- package/extensions/forms/Iterate/Array/ArrayDocs.js.map +1 -1
- package/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +1 -1
- package/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
- package/extensions/forms/Iterate/Array/types.d.ts +1 -0
- package/extensions/forms/Iterate/Array/types.js.map +1 -1
- package/extensions/forms/Iterate/EditContainer/DoneButton.js +0 -1
- package/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
- package/extensions/forms/Iterate/PushButton/PushButton.js +20 -8
- package/extensions/forms/Iterate/PushButton/PushButton.js.map +1 -1
- package/extensions/forms/Iterate/PushContainer/OpenButton.js +19 -3
- package/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
- package/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +2 -1
- package/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
- package/extensions/forms/Iterate/PushContainer/PushContainerDocs.js +5 -0
- package/extensions/forms/Iterate/PushContainer/PushContainerDocs.js.map +1 -1
- package/extensions/forms/Iterate/RemoveButton/RemoveButton.js +4 -6
- package/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
- package/extensions/forms/Wizard/Step/Step.d.ts +1 -1
- package/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/extensions/forms/hooks/useFieldProps.js +20 -14
- package/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/package.json +1 -1
- package/shared/Eufemia.d.ts +1 -1
- package/shared/Eufemia.js +2 -2
- package/shared/Eufemia.js.map +1 -1
- package/style/core/scopes.scss +1 -1
- package/style/dnb-ui-basis.css +1 -1
- package/style/dnb-ui-basis.min.css +1 -1
- package/style/dnb-ui-body.css +1 -1
- package/style/dnb-ui-body.min.css +1 -1
- package/style/dnb-ui-core.css +1 -1
- package/style/dnb-ui-core.min.css +1 -1
- package/umd/dnb-ui-basis.min.js +1 -1
- package/umd/dnb-ui-components.min.js +1 -1
- package/umd/dnb-ui-elements.min.js +1 -1
- package/umd/dnb-ui-extensions.min.js +2 -2
- package/umd/dnb-ui-lib.min.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Array.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_jsonPointer","_hooks","_componentHelper","_components","_utils","_useMountEffect","_Container","_IterateItemContext","_SummaryListContext","_ValueBlockContext","_FieldBoundaryProvider","_Context","_useDataValue","_hooks2","_FieldBlock","_structuredClone","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","ArrayComponent","props","_props$value","salt","forceUpdate","useReducer","summaryListContext","useContext","SummaryListContext","valueBlockContext","ValueBlockContext","getValueByPath","useDataValue","preparedProps","useMemo","path","countPath","countPathLimit","Infinity","countPathTransform","arrayValue","countValue","parseFloat","newValue","l","index","error","defaultValue","withoutFlex","emptyValue","placeholder","containerMode","handleChange","setChanged","onChange","children","useFieldProps","useMountEffect","idsRef","useRef","isNewRef","modesRef","valueWhileClosingRef","valueCountRef","containerRef","hadPushRef","innerRefs","omitFlex","handlePathChange","DataContext","useEffect","current","getNextContainerMode","useSwitchContainerMode","arrayItems","list","map","_valueCountRef$curren","_modesRef$current$id","id","makeUniqueId","hasNewItems","isNew","_getNextContainerMode","itemContext","previousContainerMode","previous","initialContainerMode","modeOptions","options","switchContainerMode","mode","_isNewRef$current","newArrayValue","structuredClone","pointer","handlePush","element","handleRemove","keepItems","splice","fulfillRemove","_modesRef$current","_isNewRef$current2","findIndex","indexOf","restoreOriginalValue","last","flexProps","className","classnames","pickFlexContainerProps","pickSpacingProps","innerRef","WrapperElement","Fragment","Flex","Stack","createElement","itemProps","elementRef","createRef","renderChildren","elementChild","contextValue","content","Array","isArray","child","Provider","Item","tabIndex","FormStatus","top","bottom","show","Boolean","no_animation","shellSpace","getMessage","_supportsSpacingProps","_default","exports"],"sources":["../../../../../../src/extensions/forms/Iterate/Array/Array.tsx"],"sourcesContent":["import React, {\n useMemo,\n useRef,\n useEffect,\n useReducer,\n createRef,\n useContext,\n Fragment,\n} from 'react'\nimport classnames from 'classnames'\nimport pointer from 'json-pointer'\nimport { useFieldProps } from '../../hooks'\nimport { makeUniqueId } from '../../../../shared/component-helper'\nimport { Flex, FormStatus } from '../../../../components'\nimport { pickSpacingProps } from '../../../../components/flex/utils'\nimport useMountEffect from '../../../../shared/helpers/useMountEffect'\nimport {\n BasicProps as FlexContainerProps,\n Props as FlexContainerAllProps,\n pickFlexContainerProps,\n} from '../../../../components/flex/Container'\nimport IterateItemContext, {\n IterateItemContextState,\n} from '../IterateItemContext'\nimport SummaryListContext from '../../Value/SummaryList/SummaryListContext'\nimport ValueBlockContext from '../../ValueBlock/ValueBlockContext'\nimport FieldBoundaryProvider from '../../DataContext/FieldBoundary/FieldBoundaryProvider'\nimport DataContext from '../../DataContext/Context'\nimport useDataValue from '../../hooks/useDataValue'\nimport { useSwitchContainerMode } from '../hooks'\nimport { getMessage } from '../../FieldBlock'\n\nimport type { ContainerMode, ElementChild, Props, Value } from './types'\nimport type { Identifier } from '../../types'\n\n/**\n * Deprecated, as it is supported by all major browsers and Node.js >=v18\n * So its a question of time, when we will remove this polyfill\n */\nimport structuredClone from '@ungap/structured-clone'\n\nexport type * from './types'\n\nfunction ArrayComponent(props: Props) {\n const [salt, forceUpdate] = useReducer(() => ({}), {})\n\n const summaryListContext = useContext(SummaryListContext)\n const valueBlockContext = useContext(ValueBlockContext)\n\n const { getValueByPath } = useDataValue()\n const preparedProps = useMemo(() => {\n const {\n path,\n countPath,\n countPathLimit = Infinity,\n countPathTransform,\n } = props\n\n if (countPath) {\n const arrayValue = getValueByPath(path)\n let countValue = parseFloat(getValueByPath(countPath))\n if (!(countValue >= 0)) {\n countValue = 0\n }\n if (countValue > countPathLimit) {\n countValue = countPathLimit\n }\n if (arrayValue?.length !== countValue) {\n const newValue = []\n for (let i = 0, l = countValue; i < l; i++) {\n const value = arrayValue?.[i]\n newValue.push(countPathTransform?.({ value, index: i }))\n }\n\n return {\n ...props,\n value: newValue,\n }\n }\n }\n\n return props\n }, [getValueByPath, props])\n\n const {\n path,\n value: arrayValue,\n error,\n defaultValue,\n withoutFlex,\n emptyValue,\n placeholder,\n containerMode,\n handleChange,\n setChanged,\n onChange,\n children,\n } = useFieldProps(preparedProps)\n\n useMountEffect(() => {\n // To ensure the validator is called when a new item is added\n setChanged(true)\n })\n\n const idsRef = useRef<Array<Identifier>>([])\n const isNewRef = useRef<Record<string, boolean>>({})\n const modesRef = useRef<\n Record<\n Identifier,\n {\n current: ContainerMode\n previous?: ContainerMode\n options?: { omitFocusManagement?: boolean }\n }\n >\n >({})\n const valueWhileClosingRef = useRef<Value>()\n const valueCountRef = useRef(arrayValue)\n const containerRef = useRef<HTMLDivElement>()\n const hadPushRef = useRef<boolean>()\n const innerRefs = useRef<\n Record<string, React.RefObject<HTMLDivElement>>\n >({})\n\n const omitFlex = withoutFlex ?? (summaryListContext || valueBlockContext)\n\n // To support React.StrictMode, we inject the defaultValue into the data context this way.\n // The routine inside useFieldProps where updateDataValueDataContext is called, does not support React.StrictMode\n const { handlePathChange } = useContext(DataContext) || {}\n useMountEffect(() => {\n if (defaultValue) {\n handlePathChange?.(path, defaultValue)\n }\n })\n\n useEffect(() => {\n // Update inside the useEffect, to support React.StrictMode\n valueCountRef.current = arrayValue || []\n }, [arrayValue])\n\n const { getNextContainerMode } = useSwitchContainerMode()\n\n const arrayItems = useMemo(() => {\n const list = valueWhileClosingRef.current || arrayValue\n return (list ?? []).map((value, index) => {\n const id = idsRef.current[index] || makeUniqueId()\n\n const hasNewItems =\n arrayValue?.length > valueCountRef.current?.length\n\n if (!idsRef.current[index]) {\n isNewRef.current[id] = hasNewItems\n idsRef.current.push(id)\n }\n\n const isNew = isNewRef.current[id] || false\n if (!modesRef.current[id]?.current) {\n modesRef.current[id] = {\n current:\n containerMode ??\n (isNew ? getNextContainerMode() ?? 'edit' : 'auto'),\n }\n }\n\n const itemContext: IterateItemContextState = {\n id,\n path,\n value,\n index,\n arrayValue,\n containerRef,\n isNew,\n containerMode: modesRef.current[id].current,\n previousContainerMode: modesRef.current[id].previous,\n initialContainerMode: containerMode || 'auto',\n modeOptions: modesRef.current[id].options,\n switchContainerMode: (mode, options = {}) => {\n modesRef.current[id].previous = modesRef.current[id].current\n modesRef.current[id].current = mode\n modesRef.current[id].options = options\n delete isNewRef.current?.[id]\n forceUpdate()\n },\n handleChange: (path, value) => {\n const newArrayValue = structuredClone(arrayValue)\n\n // Make sure we have a new object reference,\n // else two new objects will be the same\n newArrayValue[index] = { ...newArrayValue[index] }\n\n pointer.set(newArrayValue, path, value)\n handleChange(newArrayValue)\n },\n handlePush: (element) => {\n hadPushRef.current = true\n handleChange([...(arrayValue || []), element])\n },\n handleRemove: ({ keepItems = false } = {}) => {\n if (keepItems) {\n // Add a backup as the array value while animating\n valueWhileClosingRef.current = arrayValue\n }\n\n const newArrayValue = structuredClone(arrayValue)\n newArrayValue.splice(index, 1)\n handleChange(newArrayValue)\n },\n\n // - Called after animation end\n fulfillRemove: () => {\n valueWhileClosingRef.current = null\n delete modesRef.current?.[id]\n delete isNewRef.current?.[id]\n const findIndex = idsRef.current.indexOf(id)\n idsRef.current.splice(findIndex, 1)\n forceUpdate()\n },\n\n // - Called when cancel button press\n restoreOriginalValue: (value) => {\n if (value) {\n const newArrayValue = structuredClone(arrayValue)\n newArrayValue[index] = value\n handleChange(newArrayValue)\n }\n },\n }\n\n return itemContext\n })\n\n // In order to update \"valueWhileClosingRef\" we need to have \"salt\" in the deps array\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [salt, arrayValue, path, handleChange])\n\n // - Call the onChange callback when a new element is added without calling \"handlePush\"\n useMemo(() => {\n const last = arrayItems?.[arrayItems.length - 1]\n if (last?.isNew && !hadPushRef.current) {\n onChange?.(arrayValue)\n } else {\n hadPushRef.current = false\n }\n }, [arrayValue, arrayItems, onChange])\n\n const flexProps: FlexContainerProps & {\n innerRef: FlexContainerAllProps['innerRef']\n } = {\n className: classnames(\n 'dnb-forms-iterate',\n 'dnb-forms-section',\n props?.className\n ),\n ...pickFlexContainerProps(props as FlexContainerProps),\n ...pickSpacingProps(props),\n innerRef: containerRef,\n }\n\n const WrapperElement = omitFlex ? Fragment : Flex.Stack\n\n return (\n <>\n <WrapperElement {...(omitFlex ? null : flexProps)}>\n {arrayValue === emptyValue || props?.value?.length === 0\n ? placeholder\n : arrayItems.map((itemProps) => {\n const { id, value, index } = itemProps\n const elementRef = (innerRefs.current[id] =\n innerRefs.current[id] || createRef<HTMLDivElement>())\n\n const renderChildren = (elementChild: ElementChild) => {\n return typeof elementChild === 'function'\n ? elementChild(value, index)\n : elementChild\n }\n\n const contextValue = {\n ...itemProps,\n elementRef,\n }\n\n const content = Array.isArray(children)\n ? children.map((child) => renderChildren(child))\n : renderChildren(children)\n\n if (omitFlex) {\n return (\n <IterateItemContext.Provider\n key={`element-${id}`}\n value={contextValue}\n >\n <FieldBoundaryProvider>\n {content}\n </FieldBoundaryProvider>\n </IterateItemContext.Provider>\n )\n }\n\n return (\n <Flex.Item\n className=\"dnb-forms-iterate__element\"\n tabIndex={-1}\n innerRef={elementRef}\n key={`element-${id}`}\n >\n <IterateItemContext.Provider value={contextValue}>\n <FieldBoundaryProvider>\n {content}\n </FieldBoundaryProvider>\n </IterateItemContext.Provider>\n </Flex.Item>\n )\n })}\n </WrapperElement>\n\n <FormStatus\n top={0}\n bottom={0}\n show={Boolean(error)}\n no_animation={false}\n shellSpace={{ top: true, bottom: true }}\n >\n {getMessage({ content: error })}\n </FormStatus>\n </>\n )\n}\n\nArrayComponent._supportsSpacingProps = false // disable flex support to avoid rerender, which could result in flickering\nexport default ArrayComponent\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAKA,IAAAU,mBAAA,GAAAR,sBAAA,CAAAF,OAAA;AAGA,IAAAW,mBAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,kBAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,sBAAA,GAAAX,sBAAA,CAAAF,OAAA;AACA,IAAAc,QAAA,GAAAZ,sBAAA,CAAAF,OAAA;AACA,IAAAe,aAAA,GAAAb,sBAAA,CAAAF,OAAA;AACA,IAAAgB,OAAA,GAAAhB,OAAA;AACA,IAAAiB,WAAA,GAAAjB,OAAA;AASA,IAAAkB,gBAAA,GAAAhB,sBAAA,CAAAF,OAAA;AAAqD,SAAAE,uBAAAiB,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,SAAAxB,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C,CACpB,CACZ,CAAC;AAEP;AAEA1B,cAAc,CAACwH,qBAAqB,GAAG,KAAK;AAAA,IAAAC,QAAA,GAC7BzH,cAAc;AAAA0H,OAAA,CAAAnL,OAAA,GAAAkL,QAAA"}
|
|
1
|
+
{"version":3,"file":"Array.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_jsonPointer","_hooks","_componentHelper","_components","_utils","_useMountEffect","_Container","_IterateItemContext","_SummaryListContext","_ValueBlockContext","_FieldBoundaryProvider","_Context","_useDataValue","_hooks2","_FieldBlock","_structuredClone","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","ArrayComponent","props","_props$value","salt","forceUpdate","useReducer","summaryListContext","useContext","SummaryListContext","valueBlockContext","ValueBlockContext","getValueByPath","useDataValue","preparedProps","useMemo","path","countPath","countPathLimit","Infinity","countPathTransform","arrayValue","countValue","parseFloat","newValue","l","index","required","error","defaultValue","withoutFlex","emptyValue","placeholder","containerMode","animate","handleChange","setChanged","onChange","children","useFieldProps","useMountEffect","idsRef","useRef","isNewRef","modesRef","valueWhileClosingRef","valueCountRef","containerRef","hadPushRef","innerRefs","omitFlex","handlePathChange","DataContext","useEffect","current","getNextContainerMode","useSwitchContainerMode","arrayItems","list","map","_valueCountRef$curren","_modesRef$current$id","id","makeUniqueId","hasNewItems","isNew","_getNextContainerMode","itemContext","previousContainerMode","previous","initialContainerMode","modeOptions","options","switchContainerMode","mode","_isNewRef$current","newArrayValue","structuredClone","pointer","handlePush","element","handleRemove","keepItems","splice","fulfillRemove","_modesRef$current","_isNewRef$current2","findIndex","indexOf","restoreOriginalValue","last","flexProps","className","classnames","pickFlexContainerProps","pickSpacingProps","innerRef","arrayElements","itemProps","elementRef","createRef","renderChildren","elementChild","contextValue","content","Array","isArray","child","createElement","Provider","Flex","Item","tabIndex","Stack","Fragment","HeightAnimation","FormStatus","top","bottom","show","Boolean","no_animation","shellSpace","getMessage","_supportsSpacingProps","_default","exports"],"sources":["../../../../../../src/extensions/forms/Iterate/Array/Array.tsx"],"sourcesContent":["import React, {\n useMemo,\n useRef,\n useEffect,\n useReducer,\n createRef,\n useContext,\n} from 'react'\nimport classnames from 'classnames'\nimport pointer from 'json-pointer'\nimport { useFieldProps } from '../../hooks'\nimport { makeUniqueId } from '../../../../shared/component-helper'\nimport { Flex, FormStatus, HeightAnimation } from '../../../../components'\nimport { pickSpacingProps } from '../../../../components/flex/utils'\nimport useMountEffect from '../../../../shared/helpers/useMountEffect'\nimport {\n BasicProps as FlexContainerProps,\n Props as FlexContainerAllProps,\n pickFlexContainerProps,\n} from '../../../../components/flex/Container'\nimport IterateItemContext, {\n IterateItemContextState,\n} from '../IterateItemContext'\nimport SummaryListContext from '../../Value/SummaryList/SummaryListContext'\nimport ValueBlockContext from '../../ValueBlock/ValueBlockContext'\nimport FieldBoundaryProvider from '../../DataContext/FieldBoundary/FieldBoundaryProvider'\nimport DataContext from '../../DataContext/Context'\nimport useDataValue from '../../hooks/useDataValue'\nimport { useSwitchContainerMode } from '../hooks'\nimport { getMessage } from '../../FieldBlock'\n\nimport type { ContainerMode, ElementChild, Props, Value } from './types'\nimport type { Identifier } from '../../types'\n\n/**\n * Deprecated, as it is supported by all major browsers and Node.js >=v18\n * So its a question of time, when we will remove this polyfill\n */\nimport structuredClone from '@ungap/structured-clone'\n\nexport type * from './types'\n\nfunction ArrayComponent(props: Props) {\n const [salt, forceUpdate] = useReducer(() => ({}), {})\n\n const summaryListContext = useContext(SummaryListContext)\n const valueBlockContext = useContext(ValueBlockContext)\n\n const { getValueByPath } = useDataValue()\n const preparedProps = useMemo(() => {\n const {\n path,\n countPath,\n countPathLimit = Infinity,\n countPathTransform,\n } = props\n\n if (countPath) {\n const arrayValue = getValueByPath(path)\n let countValue = parseFloat(getValueByPath(countPath))\n if (!(countValue >= 0)) {\n countValue = 0\n }\n if (countValue > countPathLimit) {\n countValue = countPathLimit\n }\n if (arrayValue?.length !== countValue) {\n const newValue = []\n for (let i = 0, l = countValue; i < l; i++) {\n const value = arrayValue?.[i]\n newValue.push(countPathTransform?.({ value, index: i }))\n }\n\n return {\n required: false,\n ...props,\n value: newValue,\n }\n }\n }\n\n return { required: false, ...props }\n }, [getValueByPath, props])\n\n const {\n path,\n value: arrayValue,\n error,\n defaultValue,\n withoutFlex,\n emptyValue,\n placeholder,\n containerMode,\n animate,\n handleChange,\n setChanged,\n onChange,\n children,\n } = useFieldProps(preparedProps)\n\n useMountEffect(() => {\n // To ensure the validator is called when a new item is added\n setChanged(true)\n })\n\n const idsRef = useRef<Array<Identifier>>([])\n const isNewRef = useRef<Record<string, boolean>>({})\n const modesRef = useRef<\n Record<\n Identifier,\n {\n current: ContainerMode\n previous?: ContainerMode\n options?: { omitFocusManagement?: boolean }\n }\n >\n >({})\n const valueWhileClosingRef = useRef<Value>()\n const valueCountRef = useRef(arrayValue)\n const containerRef = useRef<HTMLDivElement>()\n const hadPushRef = useRef<boolean>()\n const innerRefs = useRef<\n Record<string, React.RefObject<HTMLDivElement>>\n >({})\n\n const omitFlex = withoutFlex ?? (summaryListContext || valueBlockContext)\n\n // To support React.StrictMode, we inject the defaultValue into the data context this way.\n // The routine inside useFieldProps where updateDataValueDataContext is called, does not support React.StrictMode\n const { handlePathChange } = useContext(DataContext) || {}\n useMountEffect(() => {\n if (defaultValue) {\n handlePathChange?.(path, defaultValue)\n }\n })\n\n useEffect(() => {\n // Update inside the useEffect, to support React.StrictMode\n valueCountRef.current = arrayValue || []\n }, [arrayValue])\n\n const { getNextContainerMode } = useSwitchContainerMode()\n\n const arrayItems = useMemo(() => {\n const list = valueWhileClosingRef.current || arrayValue\n return (list ?? []).map((value, index) => {\n const id = idsRef.current[index] || makeUniqueId()\n\n const hasNewItems =\n arrayValue?.length > valueCountRef.current?.length\n\n if (!idsRef.current[index]) {\n isNewRef.current[id] = hasNewItems\n idsRef.current.push(id)\n }\n\n const isNew = isNewRef.current[id] || false\n if (!modesRef.current[id]?.current) {\n modesRef.current[id] = {\n current:\n containerMode ??\n (isNew ? getNextContainerMode() ?? 'edit' : 'auto'),\n }\n }\n\n const itemContext: IterateItemContextState = {\n id,\n path,\n value,\n index,\n arrayValue,\n containerRef,\n isNew,\n containerMode: modesRef.current[id].current,\n previousContainerMode: modesRef.current[id].previous,\n initialContainerMode: containerMode || 'auto',\n modeOptions: modesRef.current[id].options,\n switchContainerMode: (mode, options = {}) => {\n modesRef.current[id].previous = modesRef.current[id].current\n modesRef.current[id].current = mode\n modesRef.current[id].options = options\n delete isNewRef.current?.[id]\n forceUpdate()\n },\n handleChange: (path, value) => {\n const newArrayValue = structuredClone(arrayValue)\n\n // Make sure we have a new object reference,\n // else two new objects will be the same\n newArrayValue[index] = { ...newArrayValue[index] }\n\n pointer.set(newArrayValue, path, value)\n handleChange(newArrayValue)\n },\n handlePush: (element) => {\n hadPushRef.current = true\n handleChange([...(arrayValue || []), element])\n },\n handleRemove: ({ keepItems = false } = {}) => {\n if (keepItems) {\n // Add a backup as the array value while animating\n valueWhileClosingRef.current = arrayValue\n }\n\n const newArrayValue = structuredClone(arrayValue)\n newArrayValue.splice(index, 1)\n handleChange(newArrayValue)\n },\n\n // - Called after animation end\n fulfillRemove: () => {\n valueWhileClosingRef.current = null\n delete modesRef.current?.[id]\n delete isNewRef.current?.[id]\n const findIndex = idsRef.current.indexOf(id)\n idsRef.current.splice(findIndex, 1)\n forceUpdate()\n },\n\n // - Called when cancel button press\n restoreOriginalValue: (value) => {\n if (value) {\n const newArrayValue = structuredClone(arrayValue)\n newArrayValue[index] = value\n handleChange(newArrayValue)\n }\n },\n }\n\n return itemContext\n })\n\n // In order to update \"valueWhileClosingRef\" we need to have \"salt\" in the deps array\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [salt, arrayValue, path, handleChange])\n\n // - Call the onChange callback when a new element is added without calling \"handlePush\"\n useMemo(() => {\n const last = arrayItems?.[arrayItems.length - 1]\n if (last?.isNew && !hadPushRef.current) {\n onChange?.(arrayValue)\n } else {\n hadPushRef.current = false\n }\n }, [arrayValue, arrayItems, onChange])\n\n const flexProps: FlexContainerProps & {\n innerRef: FlexContainerAllProps['innerRef']\n } = {\n className: classnames(\n 'dnb-forms-iterate',\n 'dnb-forms-section',\n props?.className\n ),\n ...pickFlexContainerProps(props as FlexContainerProps),\n ...pickSpacingProps(props),\n innerRef: containerRef,\n }\n\n const arrayElements =\n arrayValue === emptyValue || props?.value?.length === 0\n ? placeholder\n : arrayItems.map((itemProps) => {\n const { id, value, index } = itemProps\n const elementRef = (innerRefs.current[id] =\n innerRefs.current[id] || createRef<HTMLDivElement>())\n\n const renderChildren = (elementChild: ElementChild) => {\n return typeof elementChild === 'function'\n ? elementChild(value, index)\n : elementChild\n }\n\n const contextValue = {\n ...itemProps,\n elementRef,\n }\n\n const content = Array.isArray(children)\n ? children.map((child) => renderChildren(child))\n : renderChildren(children)\n\n if (omitFlex) {\n return (\n <IterateItemContext.Provider\n key={`element-${id}`}\n value={contextValue}\n >\n <FieldBoundaryProvider>{content}</FieldBoundaryProvider>\n </IterateItemContext.Provider>\n )\n }\n\n return (\n <Flex.Item\n className=\"dnb-forms-iterate__element\"\n tabIndex={-1}\n innerRef={elementRef}\n key={`element-${id}`}\n >\n <IterateItemContext.Provider value={contextValue}>\n <FieldBoundaryProvider>{content}</FieldBoundaryProvider>\n </IterateItemContext.Provider>\n </Flex.Item>\n )\n })\n\n const content = omitFlex ? (\n arrayElements\n ) : (\n <Flex.Stack {...flexProps}>{arrayElements}</Flex.Stack>\n )\n\n return (\n <>\n {animate ? <HeightAnimation>{content}</HeightAnimation> : content}\n\n <FormStatus\n top={0}\n bottom={0}\n show={Boolean(error)}\n no_animation={false}\n shellSpace={{ top: true, bottom: true }}\n >\n {getMessage({ content: error })}\n </FormStatus>\n </>\n )\n}\n\nArrayComponent._supportsSpacingProps = true\nexport default ArrayComponent\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAKA,IAAAU,mBAAA,GAAAR,sBAAA,CAAAF,OAAA;AAGA,IAAAW,mBAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,kBAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,sBAAA,GAAAX,sBAAA,CAAAF,OAAA;AACA,IAAAc,QAAA,GAAAZ,sBAAA,CAAAF,OAAA;AACA,IAAAe,aAAA,GAAAb,sBAAA,CAAAF,OAAA;AACA,IAAAgB,OAAA,GAAAhB,OAAA;AACA,IAAAiB,WAAA,GAAAjB,OAAA;AASA,IAAAkB,gBAAA,GAAAhB,sBAAA,CAAAF,OAAA;AAAqD,SAAAE,uBAAAiB,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,GAAA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,EAAE,CAAE;IACPC,MAAM,EAAE,CAAE;IACVC,IAAI,EAAEC,OAAO,CAAC5F,KAAK,CAAE;IACrB6F,YAAY,EAAE,KAAM;IACpBC,UAAU,EAAE;MAAEL,GAAG,EAAE,IAAI;MAAEC,MAAM,EAAE;IAAK;EAAE,GAEvC,IAAAK,sBAAU,EAAC;IAAEnB,OAAO,EAAE5E;EAAM,CAAC,CACpB,CACZ,CAAC;AAEP;AAEA3B,cAAc,CAAC2H,qBAAqB,GAAG,IAAI;AAAA,IAAAC,QAAA,GAC5B5H,cAAc;AAAA6H,OAAA,CAAAtL,OAAA,GAAAqL,QAAA"}
|
|
@@ -36,6 +36,11 @@ const ArrayProperties = {
|
|
|
36
36
|
type: 'boolean',
|
|
37
37
|
status: 'optional'
|
|
38
38
|
},
|
|
39
|
+
animate: {
|
|
40
|
+
doc: 'When `true` it will animate the height of the items.',
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
status: 'optional'
|
|
43
|
+
},
|
|
39
44
|
placeholder: {
|
|
40
45
|
doc: 'Will be shown if the value or data context value is empty.',
|
|
41
46
|
type: 'React.Node',
|
|
@@ -56,7 +61,7 @@ const ArrayProperties = {
|
|
|
56
61
|
},
|
|
57
62
|
children: {
|
|
58
63
|
doc: 'React.Node or a function so you can get the current value and index.',
|
|
59
|
-
type: '
|
|
64
|
+
type: ['React.ReactNode', 'function'],
|
|
60
65
|
status: 'optional'
|
|
61
66
|
},
|
|
62
67
|
'[Flex.Stack](/uilib/layout/flex/stack/)': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayDocs.js","names":["_DataValueDocs","require","ArrayProperties","value","doc","type","status","path","countPath","countPathTransform","countPathLimit","withoutFlex","placeholder","emptyValue","validator","dataValueProperties","validateInitially","continuousValidation","containerMode","children","exports","ArrayEvents","onChange"],"sources":["../../../../../../src/extensions/forms/Iterate/Array/ArrayDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../../../shared/types'\nimport { dataValueProperties } from '../../hooks/DataValueDocs'\n\nexport const ArrayProperties: PropertiesTableProps = {\n value: {\n doc: 'The data to iterate over. Alternative you can use the `path` prop.',\n type: 'array',\n status: 'optional',\n },\n path: {\n doc: 'A path (JSON Pointer) to the array to iterate over.',\n type: 'string',\n status: 'optional',\n },\n countPath: {\n doc: 'A path (JSON Pointer) to the array length.',\n type: 'string',\n status: 'optional',\n },\n countPathTransform: {\n doc: 'Will transform the current value before it is displayed.',\n type: 'function',\n status: 'optional',\n },\n countPathLimit: {\n doc: 'Will limit the iterate amount by given \"countPathLimit\" value.',\n type: 'number',\n status: 'optional',\n },\n withoutFlex: {\n doc: 'When `true` it will omit the Flex.Stack wrapper so it can be used for tables and lists.',\n type: 'boolean',\n status: 'optional',\n },\n placeholder: {\n doc: 'Will be shown if the value or data context value is empty.',\n type: 'React.Node',\n status: 'optional',\n },\n emptyValue: {\n doc: 'Will be used to compare the value in order to show the placeholder.',\n type: 'unknown',\n status: 'optional',\n },\n validator: dataValueProperties.validator,\n validateInitially: dataValueProperties.validateInitially,\n continuousValidation: dataValueProperties.continuousValidation,\n containerMode: {\n doc: 'Defines the container mode for all nested containers. Can be `view`, `edit` or `auto`. When using `auto`, it will automatically open if there is an error in the container. When a new item is added, the item before it will change to `view` mode, if it had no validation errors. Defaults to `auto`.',\n type: 'string',\n status: 'optional',\n },\n children: {\n doc: 'React.Node or a function so you can get the current value and index.',\n type: '
|
|
1
|
+
{"version":3,"file":"ArrayDocs.js","names":["_DataValueDocs","require","ArrayProperties","value","doc","type","status","path","countPath","countPathTransform","countPathLimit","withoutFlex","animate","placeholder","emptyValue","validator","dataValueProperties","validateInitially","continuousValidation","containerMode","children","exports","ArrayEvents","onChange"],"sources":["../../../../../../src/extensions/forms/Iterate/Array/ArrayDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../../../shared/types'\nimport { dataValueProperties } from '../../hooks/DataValueDocs'\n\nexport const ArrayProperties: PropertiesTableProps = {\n value: {\n doc: 'The data to iterate over. Alternative you can use the `path` prop.',\n type: 'array',\n status: 'optional',\n },\n path: {\n doc: 'A path (JSON Pointer) to the array to iterate over.',\n type: 'string',\n status: 'optional',\n },\n countPath: {\n doc: 'A path (JSON Pointer) to the array length.',\n type: 'string',\n status: 'optional',\n },\n countPathTransform: {\n doc: 'Will transform the current value before it is displayed.',\n type: 'function',\n status: 'optional',\n },\n countPathLimit: {\n doc: 'Will limit the iterate amount by given \"countPathLimit\" value.',\n type: 'number',\n status: 'optional',\n },\n withoutFlex: {\n doc: 'When `true` it will omit the Flex.Stack wrapper so it can be used for tables and lists.',\n type: 'boolean',\n status: 'optional',\n },\n animate: {\n doc: 'When `true` it will animate the height of the items.',\n type: 'boolean',\n status: 'optional',\n },\n placeholder: {\n doc: 'Will be shown if the value or data context value is empty.',\n type: 'React.Node',\n status: 'optional',\n },\n emptyValue: {\n doc: 'Will be used to compare the value in order to show the placeholder.',\n type: 'unknown',\n status: 'optional',\n },\n validator: dataValueProperties.validator,\n validateInitially: dataValueProperties.validateInitially,\n continuousValidation: dataValueProperties.continuousValidation,\n containerMode: {\n doc: 'Defines the container mode for all nested containers. Can be `view`, `edit` or `auto`. When using `auto`, it will automatically open if there is an error in the container. When a new item is added, the item before it will change to `view` mode, if it had no validation errors. Defaults to `auto`.',\n type: 'string',\n status: 'optional',\n },\n children: {\n doc: 'React.Node or a function so you can get the current value and index.',\n type: ['React.ReactNode', 'function'],\n status: 'optional',\n },\n '[Flex.Stack](/uilib/layout/flex/stack/)': {\n doc: 'All Flex.Stack properties.',\n type: 'Various',\n status: 'optional',\n },\n}\n\nexport const ArrayEvents: PropertiesTableProps = {\n onChange: {\n doc: 'Will be called when a value of a field was changed by the user, with the data set (including the changed value) as argument.',\n type: 'function',\n status: 'optional',\n },\n}\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEO,MAAMC,eAAqC,GAAG;EACnDC,KAAK,EAAE;IACLC,GAAG,EAAE,oEAAoE;IACzEC,IAAI,EAA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F,GAAG,EAAE,4BAA4B;IACjCC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV;AACF,CAAC;AAAAe,OAAA,CAAAnB,eAAA,GAAAA,eAAA;AAEM,MAAMoB,WAAiC,GAAG;EAC/CC,QAAQ,EAAE;IACRnB,GAAG,EAAE,8HAA8H;IACnIC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV;AACF,CAAC;AAAAe,OAAA,CAAAC,WAAA,GAAAA,WAAA"}
|
|
@@ -2,7 +2,7 @@ import { Props as FlexContainerProps } from '../../../../components/flex/Contain
|
|
|
2
2
|
import { ContainerMode } from './types';
|
|
3
3
|
export type ArrayItemAreaProps = {
|
|
4
4
|
/**
|
|
5
|
-
* Defines the variant of the ViewContainer or
|
|
5
|
+
* Defines the variant of the ViewContainer, EditContainer or PushContainer. Can be `outline` or `basic`.
|
|
6
6
|
* Defaults to `outline`.
|
|
7
7
|
*/
|
|
8
8
|
variant?: 'outline' | 'basic';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayItemArea.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_components","_IterateItemContext","_ArrayItemAreaContext","_FieldBoundaryContext","_excluded","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","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","ArrayItemArea","props","forceUpdate","useReducer","mode","open","ariaLabel","onAnimationEnd","className","children","openDelay","variant","restProps","localContextRef","useRef","hasError","hasSubmitError","useContext","FieldBoundaryContext","current","IterateItemContext","nextFocusElementRef","isNew","value","containerMode","determineMode","useCallback","initialContainerMode","switchContainerMode","omitFocusManagement","useEffect","handleRemove","index","previousContainerMode","openRef","isRemoving","setOpenState","setTimeout","setFocus","state","_localContextRef$curr","modeOptions","_localContextRef$curr2","_localContextRef$curr3","_localContextRef$curr4","elementRef","focus","_nextFocusElementRef$","_nextFocusElementRef$2","handleAnimationEnd","_localContextRef$curr5","_localContextRef$curr6","fulfillRemove","handleRemoveItem","Array","from","parentElement","childNodes","at","e","keepItems","createElement","Provider","HeightAnimation","classnames","duration","keepInDOM","Flex","Stack","element","_supportsSpacingProps","_default","exports"],"sources":["../../../../../../src/extensions/forms/Iterate/Array/ArrayItemArea.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useEffect,\n useReducer,\n useRef,\n} from 'react'\nimport classnames from 'classnames'\nimport { Flex, HeightAnimation } from '../../../../components'\nimport IterateItemContext, {\n IterateItemContextState,\n} from '../IterateItemContext'\nimport ArrayItemAreaContext from './ArrayItemAreaContext'\nimport FieldBoundaryContext from '../../DataContext/FieldBoundary/FieldBoundaryContext'\nimport { Props as FlexContainerProps } from '../../../../components/flex/Container'\nimport { ContainerMode } from './types'\n\nexport type ArrayItemAreaProps = {\n /**\n * Defines the variant of the ViewContainer or EditContainer. Can be `outline`.\n * Defaults to `outline`.\n */\n variant?: 'outline' | 'basic'\n}\n\nexport type Props = {\n mode: ContainerMode\n open?: boolean | undefined\n ariaLabel?: string\n openDelay?: number\n} & ArrayItemAreaProps\n\nfunction ArrayItemArea(props: Props & FlexContainerProps) {\n const [, forceUpdate] = useReducer(() => ({}), {})\n\n const {\n mode,\n open,\n ariaLabel,\n onAnimationEnd,\n className,\n children,\n openDelay = 100,\n variant = 'outline',\n ...restProps\n } = props\n\n const localContextRef = useRef<IterateItemContextState>()\n const { hasError, hasSubmitError } =\n useContext(FieldBoundaryContext) || {}\n localContextRef.current = useContext(IterateItemContext) || {}\n const nextFocusElementRef = useRef<HTMLElement>()\n const { isNew, value } = localContextRef.current\n if (hasSubmitError || !value) {\n localContextRef.current.containerMode = 'edit'\n }\n if (localContextRef.current.containerMode === 'auto') {\n localContextRef.current.containerMode = 'view'\n }\n\n const determineMode = useCallback(() => {\n const { initialContainerMode, switchContainerMode } =\n localContextRef.current\n if (\n mode === 'edit' &&\n !hasSubmitError &&\n initialContainerMode === 'auto'\n ) {\n // - Set the container mode to \"edit\" if we have an error\n if (hasError && !isNew) {\n switchContainerMode('edit', { omitFocusManagement: true })\n }\n }\n }, [hasError, hasSubmitError, isNew, mode])\n\n useEffect(() => {\n determineMode()\n }, [determineMode])\n\n const { handleRemove, index, previousContainerMode, containerMode } =\n localContextRef.current\n\n const openRef = useRef(open ?? (containerMode === mode && !isNew))\n const isRemoving = useRef(false)\n\n const setOpenState = useCallback((open: boolean) => {\n openRef.current = open\n forceUpdate()\n }, [])\n\n useEffect(() => {\n if (!isRemoving.current) {\n // - Set the open state, if it's controlled\n if (typeof open !== 'undefined') {\n setOpenState(open)\n } else {\n // - Open the block with animation, if it's in the right mode\n if (openRef.current !== (containerMode === mode)) {\n if (isNew) {\n setTimeout(() => {\n setOpenState(containerMode === mode)\n }, openDelay) // in order to apply the animation\n } else {\n setOpenState(containerMode === mode)\n }\n }\n }\n }\n }, [containerMode, isNew, mode, open, openDelay, setOpenState])\n\n const setFocus = useCallback(\n (state) => {\n if (\n localContextRef.current.modeOptions?.omitFocusManagement !==\n true &&\n !hasSubmitError &&\n containerMode === mode && // ensure we match the correct mode\n containerMode !== previousContainerMode // ensure we have a new mode\n ) {\n if (state === 'opened') {\n localContextRef.current.elementRef?.current?.focus?.()\n } else if (state === 'closed') {\n nextFocusElementRef.current?.focus?.()\n }\n }\n },\n [containerMode, hasSubmitError, mode, previousContainerMode]\n )\n\n // - Remove the block with animation, if it's in the right mode\n const handleAnimationEnd = useCallback(\n (state) => {\n if (!openRef.current && isRemoving.current) {\n isRemoving.current = false\n localContextRef.current.fulfillRemove?.()\n }\n\n setFocus(state)\n onAnimationEnd?.(state)\n },\n [onAnimationEnd, setFocus]\n )\n\n const handleRemoveItem = useCallback(() => {\n try {\n // Because \"previousElementSibling\" did not work in Jest/JSDOM\n nextFocusElementRef.current = Array.from(\n localContextRef.current.elementRef.current.parentElement.childNodes\n ).at(index - 1) as HTMLElement\n } catch (e) {\n //\n }\n isRemoving.current = true\n handleRemove?.({ keepItems: true })\n setOpenState(false)\n }, [handleRemove, index, setOpenState])\n\n return (\n <ArrayItemAreaContext.Provider value={{ handleRemoveItem }}>\n <HeightAnimation\n className={classnames(\n 'dnb-forms-section-block',\n variant && `dnb-forms-section-block--variant-${variant}`,\n isNew && 'dnb-forms-section-block--new',\n hasSubmitError && 'dnb-forms-section-block--error',\n className\n )}\n open={openRef.current}\n onAnimationEnd={handleAnimationEnd}\n duration={450}\n keepInDOM // Ensure fields get mounted so they will sync with the data context\n >\n <Flex.Stack\n className=\"dnb-forms-section-block__inner\"\n {...restProps}\n element=\"section\"\n aria-label={ariaLabel}\n >\n {children}\n </Flex.Stack>\n </HeightAnimation>\n </ArrayItemAreaContext.Provider>\n )\n}\n\nArrayItemArea._supportsSpacingProps = true\nexport default ArrayItemArea\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAOA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAGA,IAAAK,qBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,qBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAAuF,MAAAO,SAAA;AAAA,SAAAL,uBAAAM,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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SAAS;IACjB,cAAY/D;EAAU,IAErBG,QACS,CACG,CACY,CAAC;AAEpC;AAEAT,aAAa,CAACsE,qBAAqB,GAAG,IAAI;AAAA,IAAAC,QAAA,GAC3BvE,aAAa;AAAAwE,OAAA,CAAA9G,OAAA,GAAA6G,QAAA"}
|
|
1
|
+
{"version":3,"file":"ArrayItemArea.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_components","_IterateItemContext","_ArrayItemAreaContext","_FieldBoundaryContext","_excluded","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","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","ArrayItemArea","props","forceUpdate","useReducer","mode","open","ariaLabel","onAnimationEnd","className","children","openDelay","variant","restProps","localContextRef","useRef","hasError","hasSubmitError","useContext","FieldBoundaryContext","current","IterateItemContext","nextFocusElementRef","isNew","value","containerMode","determineMode","useCallback","initialContainerMode","switchContainerMode","omitFocusManagement","useEffect","handleRemove","index","previousContainerMode","openRef","isRemoving","setOpenState","setTimeout","setFocus","state","_localContextRef$curr","modeOptions","_localContextRef$curr2","_localContextRef$curr3","_localContextRef$curr4","elementRef","focus","_nextFocusElementRef$","_nextFocusElementRef$2","handleAnimationEnd","_localContextRef$curr5","_localContextRef$curr6","fulfillRemove","handleRemoveItem","Array","from","parentElement","childNodes","at","e","keepItems","createElement","Provider","HeightAnimation","classnames","duration","keepInDOM","Flex","Stack","element","_supportsSpacingProps","_default","exports"],"sources":["../../../../../../src/extensions/forms/Iterate/Array/ArrayItemArea.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useEffect,\n useReducer,\n useRef,\n} from 'react'\nimport classnames from 'classnames'\nimport { Flex, HeightAnimation } from '../../../../components'\nimport IterateItemContext, {\n IterateItemContextState,\n} from '../IterateItemContext'\nimport ArrayItemAreaContext from './ArrayItemAreaContext'\nimport FieldBoundaryContext from '../../DataContext/FieldBoundary/FieldBoundaryContext'\nimport { Props as FlexContainerProps } from '../../../../components/flex/Container'\nimport { ContainerMode } from './types'\n\nexport type ArrayItemAreaProps = {\n /**\n * Defines the variant of the ViewContainer, EditContainer or PushContainer. Can be `outline` or `basic`.\n * Defaults to `outline`.\n */\n variant?: 'outline' | 'basic'\n}\n\nexport type Props = {\n mode: ContainerMode\n open?: boolean | undefined\n ariaLabel?: string\n openDelay?: number\n} & ArrayItemAreaProps\n\nfunction ArrayItemArea(props: Props & FlexContainerProps) {\n const [, forceUpdate] = useReducer(() => ({}), {})\n\n const {\n mode,\n open,\n ariaLabel,\n onAnimationEnd,\n className,\n children,\n openDelay = 100,\n variant = 'outline',\n ...restProps\n } = props\n\n const localContextRef = useRef<IterateItemContextState>()\n const { hasError, hasSubmitError } =\n useContext(FieldBoundaryContext) || {}\n localContextRef.current = useContext(IterateItemContext) || {}\n const nextFocusElementRef = useRef<HTMLElement>()\n const { isNew, value } = localContextRef.current\n if (hasSubmitError || !value) {\n localContextRef.current.containerMode = 'edit'\n }\n if (localContextRef.current.containerMode === 'auto') {\n localContextRef.current.containerMode = 'view'\n }\n\n const determineMode = useCallback(() => {\n const { initialContainerMode, switchContainerMode } =\n localContextRef.current\n if (\n mode === 'edit' &&\n !hasSubmitError &&\n initialContainerMode === 'auto'\n ) {\n // - Set the container mode to \"edit\" if we have an error\n if (hasError && !isNew) {\n switchContainerMode('edit', { omitFocusManagement: true })\n }\n }\n }, [hasError, hasSubmitError, isNew, mode])\n\n useEffect(() => {\n determineMode()\n }, [determineMode])\n\n const { handleRemove, index, previousContainerMode, containerMode } =\n localContextRef.current\n\n const openRef = useRef(open ?? (containerMode === mode && !isNew))\n const isRemoving = useRef(false)\n\n const setOpenState = useCallback((open: boolean) => {\n openRef.current = open\n forceUpdate()\n }, [])\n\n useEffect(() => {\n if (!isRemoving.current) {\n // - Set the open state, if it's controlled\n if (typeof open !== 'undefined') {\n setOpenState(open)\n } else {\n // - Open the block with animation, if it's in the right mode\n if (openRef.current !== (containerMode === mode)) {\n if (isNew) {\n setTimeout(() => {\n setOpenState(containerMode === mode)\n }, openDelay) // in order to apply the animation\n } else {\n setOpenState(containerMode === mode)\n }\n }\n }\n }\n }, [containerMode, isNew, mode, open, openDelay, setOpenState])\n\n const setFocus = useCallback(\n (state) => {\n if (\n localContextRef.current.modeOptions?.omitFocusManagement !==\n true &&\n !hasSubmitError &&\n containerMode === mode && // ensure we match the correct mode\n containerMode !== previousContainerMode // ensure we have a new mode\n ) {\n if (state === 'opened') {\n localContextRef.current.elementRef?.current?.focus?.()\n } else if (state === 'closed') {\n nextFocusElementRef.current?.focus?.()\n }\n }\n },\n [containerMode, hasSubmitError, mode, previousContainerMode]\n )\n\n // - Remove the block with animation, if it's in the right mode\n const handleAnimationEnd = useCallback(\n (state) => {\n if (!openRef.current && isRemoving.current) {\n isRemoving.current = false\n localContextRef.current.fulfillRemove?.()\n }\n\n setFocus(state)\n onAnimationEnd?.(state)\n },\n [onAnimationEnd, setFocus]\n )\n\n const handleRemoveItem = useCallback(() => {\n try {\n // Because \"previousElementSibling\" did not work in Jest/JSDOM\n nextFocusElementRef.current = Array.from(\n localContextRef.current.elementRef.current.parentElement.childNodes\n ).at(index - 1) as HTMLElement\n } catch (e) {\n //\n }\n isRemoving.current = true\n handleRemove?.({ keepItems: true })\n setOpenState(false)\n }, [handleRemove, index, setOpenState])\n\n return (\n <ArrayItemAreaContext.Provider value={{ handleRemoveItem }}>\n <HeightAnimation\n className={classnames(\n 'dnb-forms-section-block',\n variant && `dnb-forms-section-block--variant-${variant}`,\n isNew && 'dnb-forms-section-block--new',\n hasSubmitError && 'dnb-forms-section-block--error',\n className\n )}\n open={openRef.current}\n onAnimationEnd={handleAnimationEnd}\n duration={450}\n keepInDOM // Ensure fields get mounted so they will sync with the data context\n >\n <Flex.Stack\n className=\"dnb-forms-section-block__inner\"\n {...restProps}\n element=\"section\"\n aria-label={ariaLabel}\n >\n {children}\n </Flex.Stack>\n </HeightAnimation>\n </ArrayItemAreaContext.Provider>\n )\n}\n\nArrayItemArea._supportsSpacingProps = true\nexport default ArrayItemArea\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAOA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAGA,IAAAK,qBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,qBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAAuF,MAAAO,SAAA;AAAA,SAAAL,uBAAAM,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,SAAAb,wBAAAS,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,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAhB,G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ZA,YAAY,CAAG;MAAE6B,SAAS,EAAE;IAAK,CAAC,CAAC;IACnCxB,YAAY,CAAC,KAAK,CAAC;EACrB,CAAC,EAAE,CAACL,YAAY,EAAEC,KAAK,EAAEI,YAAY,CAAC,CAAC;EAEvC,OACEtF,MAAA,CAAAY,OAAA,CAAAmG,aAAA,CAACxG,qBAAA,CAAAK,OAAoB,CAACoG,QAAQ;IAACvC,KAAK,EAAE;MAAE8B;IAAiB;EAAE,GACzDvG,MAAA,CAAAY,OAAA,CAAAmG,aAAA,CAAC1G,WAAA,CAAA4G,eAAe;IACdvD,SAAS,EAAE,IAAAwD,mBAAU,EACnB,yBAAyB,EAIzBxD,SAAS,EAHTG,OAAO,IAAK,oCAAmCA,OAAQ,EAAC,EACxDW,KAAK,IAAI,8BAA8B,EACvCN,cAAc,IAAI,gCAEpB,CAAE;IACFX,IAAI,EAAE6B,OAAO,CAACf,OAAQ;IACtBZ,cAAc,EAAE0C,kBAAmB;IACnCgB,QAAQ,EAAE,GAAI;IACdC,SAAS;EAAA,GAETpH,MAAA,CAAAY,OAAA,CAAAmG,aAAA,CAAC1G,WAAA,CAAAgH,IAAI,CAACC,KAAK,EAAAtF,QAAA;IACT0B,SAAS,EAAC;EAAgC,GACtCI,SAAS;IACbyD,OAAO,EAAC,SAAS;IACjB,cAAY/D;EAAU,IAErBG,QACS,CACG,CACY,CAAC;AAEpC;AAEAT,aAAa,CAACsE,qBAAqB,GAAG,IAAI;AAAA,IAAAC,QAAA,GAC3BvE,aAAa;AAAAwE,OAAA,CAAA9G,OAAA,GAAA6G,QAAA"}
|
|
@@ -11,6 +11,7 @@ export type Props = Omit<FlexContainerProps, keyof Omit<React.HTMLAttributes<HTM
|
|
|
11
11
|
countPathLimit?: number;
|
|
12
12
|
validator?: Validator<Value>;
|
|
13
13
|
withoutFlex?: boolean;
|
|
14
|
+
animate?: boolean;
|
|
14
15
|
placeholder?: React.ReactNode;
|
|
15
16
|
containerMode?: ContainerMode;
|
|
16
17
|
countPathTransform?: (params: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../../src/extensions/forms/Iterate/Array/types.ts"],"sourcesContent":["import { Path, UseFieldProps, Validator } from '../../types'\nimport { Props as FlexContainerProps } from '../../../../components/flex/Container'\n\nexport type ContainerMode = 'view' | 'edit' | 'auto'\nexport type Value = Array<unknown | Record<string, unknown>>\nexport type ElementChild =\n | React.ReactNode\n | ((value: any, index: number) => React.ReactNode)\nexport type Props = Omit<\n FlexContainerProps,\n keyof Omit<React.HTMLAttributes<HTMLDivElement>, 'className'>\n> &\n Pick<\n UseFieldProps<Value, undefined | Value>,\n | 'value'\n | 'defaultValue'\n | 'emptyValue'\n | 'onChange'\n | 'validateInitially'\n | 'continuousValidation'\n > & {\n children: ElementChild | Array<ElementChild>\n path?: Path\n countPath?: Path\n countPathLimit?: number\n validator?: Validator<Value>\n withoutFlex?: boolean\n placeholder?: React.ReactNode\n containerMode?: ContainerMode\n countPathTransform?: (params: { value: any; index: number }) => any\n }\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../../src/extensions/forms/Iterate/Array/types.ts"],"sourcesContent":["import { Path, UseFieldProps, Validator } from '../../types'\nimport { Props as FlexContainerProps } from '../../../../components/flex/Container'\n\nexport type ContainerMode = 'view' | 'edit' | 'auto'\nexport type Value = Array<unknown | Record<string, unknown>>\nexport type ElementChild =\n | React.ReactNode\n | ((value: any, index: number) => React.ReactNode)\nexport type Props = Omit<\n FlexContainerProps,\n keyof Omit<React.HTMLAttributes<HTMLDivElement>, 'className'>\n> &\n Pick<\n UseFieldProps<Value, undefined | Value>,\n | 'value'\n | 'defaultValue'\n | 'emptyValue'\n | 'onChange'\n | 'validateInitially'\n | 'continuousValidation'\n > & {\n children: ElementChild | Array<ElementChild>\n path?: Path\n countPath?: Path\n countPathLimit?: number\n validator?: Validator<Value>\n withoutFlex?: boolean\n animate?: boolean\n placeholder?: React.ReactNode\n containerMode?: ContainerMode\n countPathTransform?: (params: { value: any; index: number }) => any\n }\n"],"mappings":""}
|
|
@@ -32,7 +32,6 @@ function DoneButton(props) {
|
|
|
32
32
|
const {
|
|
33
33
|
commitHandleRef
|
|
34
34
|
} = (0, _react.useContext)(_PushContainerContext.default) || {};
|
|
35
|
-
(0, _react.useContext)(_FieldBoundaryContext.default) || {};
|
|
36
35
|
const {
|
|
37
36
|
setShowError
|
|
38
37
|
} = (0, _react.useContext)(_ToolbarContext.default) || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoneButton.js","names":["_react","_interopRequireWildcard","require","_components","_useTranslation","_interopRequireDefault","_IterateItemContext","_ToolbarContext","_FieldBoundaryContext","_PushContainerContext","_icons","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","DoneButton","props","switchContainerMode","containerMode","arrayValue","index","useContext","IterateItemContext","hasError","hasVisibleError","setShowBoundaryErrors","FieldBoundaryContext","commitHandleRef","PushContainerContext","setShowError","ToolbarContext","doneButton","useTranslation","IterateEditContainer","valueBackupRef","useRef","useEffect","current","doneHandler","useCallback","_commitHandleRef$curr","createElement","Button","variant","icon","check","icon_position","on_click"],"sources":["../../../../../../src/extensions/forms/Iterate/EditContainer/DoneButton.tsx"],"sourcesContent":["import React, { useCallback, useContext, useEffect, useRef } from 'react'\nimport { Button } from '../../../../components'\nimport useTranslation from '../../hooks/useTranslation'\nimport IterateItemContext from '../IterateItemContext'\nimport ToolbarContext from '../Toolbar/ToolbarContext'\nimport FieldBoundaryContext from '../../DataContext/FieldBoundary/FieldBoundaryContext'\nimport PushContainerContext from '../PushContainer/PushContainerContext'\nimport { check } from '../../../../icons'\nimport { ButtonProps } from '../../../../components/Button'\n\ntype Props = ButtonProps\n\nexport default function DoneButton(props: Props) {\n const { switchContainerMode, containerMode, arrayValue, index } =\n useContext(IterateItemContext) || {}\n const { hasError, hasVisibleError, setShowBoundaryErrors } =\n useContext(FieldBoundaryContext) || {}\n const { commitHandleRef } = useContext(PushContainerContext) || {}\n
|
|
1
|
+
{"version":3,"file":"DoneButton.js","names":["_react","_interopRequireWildcard","require","_components","_useTranslation","_interopRequireDefault","_IterateItemContext","_ToolbarContext","_FieldBoundaryContext","_PushContainerContext","_icons","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","DoneButton","props","switchContainerMode","containerMode","arrayValue","index","useContext","IterateItemContext","hasError","hasVisibleError","setShowBoundaryErrors","FieldBoundaryContext","commitHandleRef","PushContainerContext","setShowError","ToolbarContext","doneButton","useTranslation","IterateEditContainer","valueBackupRef","useRef","useEffect","current","doneHandler","useCallback","_commitHandleRef$curr","createElement","Button","variant","icon","check","icon_position","on_click"],"sources":["../../../../../../src/extensions/forms/Iterate/EditContainer/DoneButton.tsx"],"sourcesContent":["import React, { useCallback, useContext, useEffect, useRef } from 'react'\nimport { Button } from '../../../../components'\nimport useTranslation from '../../hooks/useTranslation'\nimport IterateItemContext from '../IterateItemContext'\nimport ToolbarContext from '../Toolbar/ToolbarContext'\nimport FieldBoundaryContext from '../../DataContext/FieldBoundary/FieldBoundaryContext'\nimport PushContainerContext from '../PushContainer/PushContainerContext'\nimport { check } from '../../../../icons'\nimport { ButtonProps } from '../../../../components/Button'\n\ntype Props = ButtonProps\n\nexport default function DoneButton(props: Props) {\n const { switchContainerMode, containerMode, arrayValue, index } =\n useContext(IterateItemContext) || {}\n const { hasError, hasVisibleError, setShowBoundaryErrors } =\n useContext(FieldBoundaryContext) || {}\n const { commitHandleRef } = useContext(PushContainerContext) || {}\n const { setShowError } = useContext(ToolbarContext) || {}\n\n const { doneButton } = useTranslation().IterateEditContainer\n const valueBackupRef = useRef<unknown>()\n\n useEffect(() => {\n if (containerMode === 'edit' && !valueBackupRef.current) {\n valueBackupRef.current = arrayValue?.[index]\n }\n if (containerMode === 'view') {\n valueBackupRef.current = null\n }\n }, [arrayValue, containerMode, index])\n\n const doneHandler = useCallback(() => {\n if (hasError) {\n setShowBoundaryErrors?.(true)\n if (hasVisibleError) {\n setShowError(true)\n }\n } else {\n setShowBoundaryErrors?.(false)\n setShowError(false)\n if (commitHandleRef) {\n commitHandleRef.current?.()\n } else {\n switchContainerMode?.('view')\n }\n }\n }, [\n commitHandleRef,\n hasError,\n hasVisibleError,\n setShowBoundaryErrors,\n setShowError,\n switchContainerMode,\n ])\n\n return (\n <Button\n variant=\"tertiary\"\n icon={check}\n icon_position=\"left\"\n on_click={doneHandler}\n {...props}\n >\n {doneButton}\n </Button>\n )\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,eAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,qBAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,qBAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAyC,SAAAG,uBAAAM,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,KAAA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eAAe,EAAE;QACnBK,YAAY,CAAC,IAAI,CAAC;MACpB;IACF,CAAC,MAAM;MACLJ,qBAAqB,aAArBA,qBAAqB,uBAArBA,qBAAqB,CAAG,KAAK,CAAC;MAC9BI,YAAY,CAAC,KAAK,CAAC;MACnB,IAAIF,eAAe,EAAE;QAAA,IAAAa,qBAAA;QACnB,CAAAA,qBAAA,GAAAb,eAAe,CAACU,OAAO,cAAAG,qBAAA,uBAAvBA,qBAAA,CAAArC,IAAA,CAAAwB,eAA0B,CAAC;MAC7B,CAAC,MAAM;QACLV,mBAAmB,aAAnBA,mBAAmB,uBAAnBA,mBAAmB,CAAG,MAAM,CAAC;MAC/B;IACF;EACF,CAAC,EAAE,CACDU,eAAe,EACfJ,QAAQ,EACRC,eAAe,EACfC,qBAAqB,EACrBI,YAAY,EACZZ,mBAAmB,CACpB,CAAC;EAEF,OACE5C,MAAA,CAAAa,OAAA,CAAAuD,aAAA,CAACjE,WAAA,CAAAkE,MAAM,EAAApC,QAAA;IACLqC,OAAO,EAAC,UAAU;IAClBC,IAAI,EAAEC,YAAM;IACZC,aAAa,EAAC,MAAM;IACpBC,QAAQ,EAAET;EAAY,GAClBtB,KAAK,GAERe,UACK,CAAC;AAEb"}
|
|
@@ -14,7 +14,8 @@ var _types = require("../../types");
|
|
|
14
14
|
var _icons = require("../../../../icons");
|
|
15
15
|
var _Context = _interopRequireDefault(require("../../DataContext/Context"));
|
|
16
16
|
var _useDataValue = _interopRequireDefault(require("../../hooks/useDataValue"));
|
|
17
|
-
|
|
17
|
+
var _componentHelper = require("../../../../shared/component-helper");
|
|
18
|
+
const _excluded = ["pushValue", "className", "path", "text", "children"];
|
|
18
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -33,12 +34,13 @@ function PushButton(props) {
|
|
|
33
34
|
pushValue,
|
|
34
35
|
className,
|
|
35
36
|
path,
|
|
37
|
+
text,
|
|
36
38
|
children
|
|
37
39
|
} = props,
|
|
38
40
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
39
41
|
const buttonProps = (0, _types.omitDataValueReadWriteProps)(restProps);
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
+
const arrayValue = (0, _useDataValue.default)().getValueByPath(path);
|
|
43
|
+
if (arrayValue !== undefined && !Array.isArray(arrayValue)) {
|
|
42
44
|
throw new Error('PushButton received a non-array value');
|
|
43
45
|
}
|
|
44
46
|
const {
|
|
@@ -47,23 +49,33 @@ function PushButton(props) {
|
|
|
47
49
|
path
|
|
48
50
|
});
|
|
49
51
|
const handleClick = (0, _react.useCallback)(async () => {
|
|
50
|
-
const newValue = typeof pushValue === 'function' ? pushValue(
|
|
52
|
+
const newValue = typeof pushValue === 'function' ? pushValue(arrayValue) : pushValue;
|
|
51
53
|
if (handlePush) {
|
|
52
54
|
handlePush(newValue);
|
|
53
55
|
} else {
|
|
54
|
-
await (handlePathChange === null || handlePathChange === void 0 ? void 0 : handlePathChange(path, [...(
|
|
56
|
+
await (handlePathChange === null || handlePathChange === void 0 ? void 0 : handlePathChange(path, [...(arrayValue !== null && arrayValue !== void 0 ? arrayValue : []), newValue]));
|
|
55
57
|
}
|
|
56
58
|
setTimeout(() => {
|
|
57
59
|
setLastItemContainerMode('view');
|
|
58
60
|
}, 100);
|
|
59
|
-
}, [handlePathChange, handlePush, path, pushValue, setLastItemContainerMode,
|
|
61
|
+
}, [handlePathChange, handlePush, path, pushValue, setLastItemContainerMode, arrayValue]);
|
|
62
|
+
const content = (0, _react.useMemo)(() => {
|
|
63
|
+
if (children || text) {
|
|
64
|
+
const str = (0, _componentHelper.convertJsxToString)(children || text);
|
|
65
|
+
if (str.includes('{nextItemNo}')) {
|
|
66
|
+
const nextItemNo = ((arrayValue === null || arrayValue === void 0 ? void 0 : arrayValue.length) || 0) + 1;
|
|
67
|
+
return str.replace('{nextItemNo}', String(nextItemNo));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return children || text;
|
|
71
|
+
}, [arrayValue === null || arrayValue === void 0 ? void 0 : arrayValue.length, children, text]);
|
|
60
72
|
return _react.default.createElement(_components.Button, _extends({
|
|
61
73
|
className: (0, _classnames.default)('dnb-forms-iterate-push-button', className),
|
|
62
74
|
variant: "secondary",
|
|
63
75
|
icon: _icons.add,
|
|
64
76
|
icon_position: "left",
|
|
65
77
|
on_click: handleClick
|
|
66
|
-
}, buttonProps),
|
|
78
|
+
}, buttonProps), content);
|
|
67
79
|
}
|
|
68
80
|
PushButton._supportsSpacingProps = true;
|
|
69
81
|
var _default = PushButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushButton.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_components","_IterateItemContext","_hooks","_types","_icons","_Context","_useDataValue","_excluded","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","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","PushButton","props","handlePathChange","useContext","DataContext","iterateItemContext","IterateItemContext","handlePush","pushValue","className","path","children","restProps","buttonProps","omitDataValueReadWriteProps","
|
|
1
|
+
{"version":3,"file":"PushButton.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_components","_IterateItemContext","_hooks","_types","_icons","_Context","_useDataValue","_componentHelper","_excluded","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","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","PushButton","props","handlePathChange","useContext","DataContext","iterateItemContext","IterateItemContext","handlePush","pushValue","className","path","text","children","restProps","buttonProps","omitDataValueReadWriteProps","arrayValue","useDataValue","getValueByPath","undefined","Array","isArray","Error","setLastItemContainerMode","useSwitchContainerMode","handleClick","useCallback","newValue","setTimeout","content","useMemo","str","convertJsxToString","includes","nextItemNo","replace","String","createElement","Button","classnames","variant","icon","add","icon_position","on_click","_supportsSpacingProps","_default","exports"],"sources":["../../../../../../src/extensions/forms/Iterate/PushButton/PushButton.tsx"],"sourcesContent":["import React, { useCallback, useContext, useMemo } from 'react'\nimport classnames from 'classnames'\nimport { Button } from '../../../../components'\nimport { ButtonProps } from '../../../../components/Button'\nimport IterateItemContext from '../IterateItemContext'\nimport { useSwitchContainerMode } from '../hooks'\nimport { omitDataValueReadWriteProps, Path } from '../../types'\nimport { add } from '../../../../icons'\nimport DataContext from '../../DataContext/Context'\nimport useDataValue from '../../hooks/useDataValue'\nimport { convertJsxToString } from '../../../../shared/component-helper'\n\nexport type Props = ButtonProps & {\n path?: Path\n pushValue: unknown | ((value: unknown) => void)\n\n /**\n * Used internally\n */\n value?: unknown\n}\n\nfunction PushButton(props: Props) {\n const { handlePathChange } = useContext(DataContext) || {}\n const iterateItemContext = useContext(IterateItemContext)\n const { handlePush } = iterateItemContext ?? {}\n\n const { pushValue, className, path, text, children, ...restProps } =\n props\n const buttonProps = omitDataValueReadWriteProps(restProps)\n const arrayValue = useDataValue().getValueByPath(path)\n\n if (arrayValue !== undefined && !Array.isArray(arrayValue)) {\n throw new Error('PushButton received a non-array value')\n }\n\n const { setLastItemContainerMode } = useSwitchContainerMode({\n path,\n })\n\n const handleClick = useCallback(async () => {\n const newValue =\n typeof pushValue === 'function' ? pushValue(arrayValue) : pushValue\n\n if (handlePush) {\n // Inside an Iterate element - make the change through the Iterate component\n handlePush(newValue)\n } else {\n // If not inside an iterate, it could still manipulate a source data set through useFieldProps\n await handlePathChange?.(path, [...(arrayValue ?? []), newValue])\n }\n\n setTimeout(() => {\n setLastItemContainerMode('view')\n }, 100) // UX improvement because of the \"openDelay\"\n }, [\n handlePathChange,\n handlePush,\n path,\n pushValue,\n setLastItemContainerMode,\n arrayValue,\n ])\n\n const content = useMemo(() => {\n if (children || text) {\n const str = convertJsxToString(children || text)\n\n if (str.includes('{nextItemNo}')) {\n const nextItemNo = (arrayValue?.length || 0) + 1\n return str.replace('{nextItemNo}', String(nextItemNo))\n }\n }\n\n return children || text\n }, [arrayValue?.length, children, text])\n\n return (\n <Button\n className={classnames('dnb-forms-iterate-push-button', className)}\n variant=\"secondary\"\n icon={add}\n icon_position=\"left\"\n on_click={handleClick}\n {...buttonProps}\n >\n {content}\n </Button>\n )\n}\n\nPushButton._supportsSpacingProps = true\nexport default PushButton\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,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M,EAAAxD,QAAA;IACL2B,SAAS,EAAE,IAAA8B,mBAAU,EAAC,+BAA+B,EAAE9B,SAAS,CAAE;IAClE+B,OAAO,EAAC,WAAW;IACnBC,IAAI,EAAEC,UAAI;IACVC,aAAa,EAAC,MAAM;IACpBC,QAAQ,EAAEnB;EAAY,GAClBX,WAAW,GAEde,OACK,CAAC;AAEb;AAEA7B,UAAU,CAAC6C,qBAAqB,GAAG,IAAI;AAAA,IAAAC,QAAA,GACxB9C,UAAU;AAAA+C,OAAA,CAAArF,OAAA,GAAAoF,QAAA"}
|
|
@@ -10,7 +10,9 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _Button = _interopRequireDefault(require("../../../../components/Button"));
|
|
11
11
|
var _icons = require("../../../../icons");
|
|
12
12
|
var _IterateItemContext = _interopRequireDefault(require("../IterateItemContext"));
|
|
13
|
-
|
|
13
|
+
var _PushContainerContext = _interopRequireDefault(require("./PushContainerContext"));
|
|
14
|
+
var _componentHelper = require("../../../../shared/component-helper");
|
|
15
|
+
const _excluded = ["className", "text", "children"];
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -20,22 +22,36 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
20
22
|
function OpenButton(props) {
|
|
21
23
|
const {
|
|
22
24
|
className,
|
|
25
|
+
text,
|
|
23
26
|
children
|
|
24
27
|
} = props,
|
|
25
28
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
26
29
|
const {
|
|
27
30
|
switchContainerMode
|
|
28
31
|
} = (0, _react.useContext)(_IterateItemContext.default) || {};
|
|
32
|
+
const {
|
|
33
|
+
entries
|
|
34
|
+
} = (0, _react.useContext)(_PushContainerContext.default) || {};
|
|
29
35
|
const handleClick = (0, _react.useCallback)(() => {
|
|
30
36
|
switchContainerMode === null || switchContainerMode === void 0 ? void 0 : switchContainerMode('edit');
|
|
31
37
|
}, [switchContainerMode]);
|
|
38
|
+
const content = (0, _react.useMemo)(() => {
|
|
39
|
+
if (children || text) {
|
|
40
|
+
const str = (0, _componentHelper.convertJsxToString)(children || text);
|
|
41
|
+
if (str.includes('{nextItemNo}')) {
|
|
42
|
+
const nextItemNo = ((entries === null || entries === void 0 ? void 0 : entries.length) || 0) + 1;
|
|
43
|
+
return str.replace('{nextItemNo}', String(nextItemNo));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return children || text;
|
|
47
|
+
}, [entries === null || entries === void 0 ? void 0 : entries.length, children, text]);
|
|
32
48
|
return _react.default.createElement(_Button.default, _extends({
|
|
33
49
|
className: (0, _classnames.default)('dnb-forms-iterate-open-button', className),
|
|
34
50
|
variant: "secondary",
|
|
35
51
|
icon: _icons.add,
|
|
36
52
|
icon_position: "left",
|
|
37
53
|
on_click: handleClick
|
|
38
|
-
}, restProps),
|
|
54
|
+
}, restProps), content);
|
|
39
55
|
}
|
|
40
56
|
var _default = OpenButton;
|
|
41
57
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenButton.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Button","_icons","_IterateItemContext","_excluded","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","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","OpenButton","props","className","children","restProps","switchContainerMode","useContext","IterateItemContext","handleClick","useCallback","createElement","classnames","variant","icon","add","icon_position","on_click","_default","exports"],"sources":["../../../../../../src/extensions/forms/Iterate/PushContainer/OpenButton.tsx"],"sourcesContent":["import React, { useCallback, useContext } from 'react'\nimport classnames from 'classnames'\nimport Button, { ButtonProps } from '../../../../components/Button'\nimport { add } from '../../../../icons'\nimport IterateItemContext from '../IterateItemContext'\n\ntype Props = ButtonProps\n\nfunction OpenButton(props: Props) {\n const { className, children, ...restProps } = props\n const { switchContainerMode } = useContext(IterateItemContext) || {}\n\n const handleClick = useCallback(() => {\n switchContainerMode?.('edit')\n }, [switchContainerMode])\n\n return (\n <Button\n className={classnames('dnb-forms-iterate-open-button', className)}\n variant=\"secondary\"\n icon={add}\n icon_position=\"left\"\n on_click={handleClick}\n {...restProps}\n >\n {
|
|
1
|
+
{"version":3,"file":"OpenButton.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Button","_icons","_IterateItemContext","_PushContainerContext","_componentHelper","_excluded","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","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","OpenButton","props","className","text","children","restProps","switchContainerMode","useContext","IterateItemContext","entries","PushContainerContext","handleClick","useCallback","content","useMemo","str","convertJsxToString","includes","nextItemNo","replace","String","createElement","classnames","variant","icon","add","icon_position","on_click","_default","exports"],"sources":["../../../../../../src/extensions/forms/Iterate/PushContainer/OpenButton.tsx"],"sourcesContent":["import React, { useCallback, useContext, useMemo } from 'react'\nimport classnames from 'classnames'\nimport Button, { ButtonProps } from '../../../../components/Button'\nimport { add } from '../../../../icons'\nimport IterateItemContext from '../IterateItemContext'\nimport PushContainerContext from './PushContainerContext'\nimport { convertJsxToString } from '../../../../shared/component-helper'\n\ntype Props = ButtonProps\n\nfunction OpenButton(props: Props) {\n const { className, text, children, ...restProps } = props\n const { switchContainerMode } = useContext(IterateItemContext) || {}\n const { entries } = useContext(PushContainerContext) || {}\n\n const handleClick = useCallback(() => {\n switchContainerMode?.('edit')\n }, [switchContainerMode])\n\n const content = useMemo(() => {\n if (children || text) {\n const str = convertJsxToString(children || text)\n\n if (str.includes('{nextItemNo}')) {\n const nextItemNo = (entries?.length || 0) + 1\n return str.replace('{nextItemNo}', String(nextItemNo))\n }\n }\n\n return children || text\n }, [entries?.length, children, text])\n\n return (\n <Button\n className={classnames('dnb-forms-iterate-open-button', className)}\n variant=\"secondary\"\n icon={add}\n icon_position=\"left\"\n on_click={handleClick}\n {...restProps}\n >\n {content}\n </Button>\n )\n}\n\nexport default OpenButton\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IA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AAED,IAAI,CAAC,CAAC;EAErC,OACEtD,MAAA,CAAAa,OAAA,CAAA2D,aAAA,CAACnE,OAAA,CAAAQ,OAAM,EAAAoB,QAAA;IACLoB,SAAS,EAAE,IAAAoB,mBAAU,EAAC,+BAA+B,EAAEpB,SAAS,CAAE;IAClEqB,OAAO,EAAC,WAAW;IACnBC,IAAI,EAAEC,UAAI;IACVC,aAAa,EAAC,MAAM;IACpBC,QAAQ,EAAEhB;EAAY,GAClBN,SAAS,GAEZQ,OACK,CAAC;AAEb;AAAC,IAAAe,QAAA,GAEc5B,UAAU;AAAA6B,OAAA,CAAAnE,OAAA,GAAAkE,QAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Path } from '../../types';
|
|
3
3
|
import { SpacingProps } from '../../../../shared/types';
|
|
4
|
+
import { ArrayItemAreaProps } from '../Array/ArrayItemArea';
|
|
4
5
|
export type Props = {
|
|
5
6
|
/**
|
|
6
7
|
* The path to the array to add the new item to.
|
|
@@ -32,7 +33,7 @@ export type Props = {
|
|
|
32
33
|
*/
|
|
33
34
|
children: React.ReactNode;
|
|
34
35
|
};
|
|
35
|
-
export type AllProps = Props & SpacingProps;
|
|
36
|
+
export type AllProps = Props & SpacingProps & ArrayItemAreaProps;
|
|
36
37
|
declare function PushContainer(props: AllProps): import("react/jsx-runtime").JSX.Element;
|
|
37
38
|
declare namespace PushContainer {
|
|
38
39
|
var OpenButton: typeof import("./OpenButton").default;
|