@abgov/jsonforms-components 1.33.0 → 1.33.2
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/index.esm.js +9 -5
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import React, { createContext, useContext, useReducer, useMemo, useEffect, useState,
|
|
2
|
+
import React, { createContext, useContext, useReducer, useMemo, useEffect, useState, useRef, useCallback } from 'react';
|
|
3
3
|
import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoARadioGroup, GoARadioItem, GoACheckbox, GoAGrid, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAModal, GoAButtonGroup, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoADetails } from '@abgov/react-components';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import axios from 'axios';
|
|
@@ -4301,12 +4301,17 @@ const Dropdown = props => {
|
|
|
4301
4301
|
const trailingIcon = isOpen ? 'chevron-up' : 'chevron-down';
|
|
4302
4302
|
const [items, setItems] = useState(props.items);
|
|
4303
4303
|
const [inputText, setInputText] = useState(selected);
|
|
4304
|
+
const prevCountRef = useRef(props.items);
|
|
4304
4305
|
useEffect(() => {
|
|
4305
4306
|
setItems(props.items);
|
|
4306
|
-
|
|
4307
|
+
prevCountRef.current = props.items;
|
|
4308
|
+
}, [isEqual(props.items, prevCountRef.current)]);
|
|
4307
4309
|
return jsxs("div", {
|
|
4308
4310
|
"data-testid": id,
|
|
4309
4311
|
children: [jsx(GoAInput, {
|
|
4312
|
+
onTrailingIconClick: () => {
|
|
4313
|
+
setIsOpen(!isOpen);
|
|
4314
|
+
},
|
|
4310
4315
|
name: `dropdown-${label}`,
|
|
4311
4316
|
width: "100%",
|
|
4312
4317
|
value: inputText,
|
|
@@ -4315,11 +4320,11 @@ const Dropdown = props => {
|
|
|
4315
4320
|
readonly: !isAutocompletion,
|
|
4316
4321
|
onChange: (name, value) => {
|
|
4317
4322
|
if (isAutocompletion) {
|
|
4318
|
-
setIsOpen(true);
|
|
4319
4323
|
const selectedItems = props.items.filter(item => {
|
|
4320
4324
|
return item.label.includes(value);
|
|
4321
4325
|
});
|
|
4322
4326
|
setItems(selectedItems);
|
|
4327
|
+
setIsOpen(true);
|
|
4323
4328
|
}
|
|
4324
4329
|
},
|
|
4325
4330
|
trailingIcon: trailingIcon,
|
|
@@ -4338,7 +4343,7 @@ const Dropdown = props => {
|
|
|
4338
4343
|
onClick: () => {
|
|
4339
4344
|
onChange(item.value);
|
|
4340
4345
|
setSelectedOption(item.value);
|
|
4341
|
-
setInputText(item.
|
|
4346
|
+
setInputText(item.label);
|
|
4342
4347
|
setIsOpen(false);
|
|
4343
4348
|
},
|
|
4344
4349
|
children: item.label
|
|
@@ -4404,7 +4409,6 @@ const EnumSelect = props => {
|
|
|
4404
4409
|
}
|
|
4405
4410
|
return newOptions.filter(option => option.value !== '');
|
|
4406
4411
|
}, [registerData, options]);
|
|
4407
|
-
console.log(mergedOptions);
|
|
4408
4412
|
useEffect(() => {
|
|
4409
4413
|
if (registerConfig) {
|
|
4410
4414
|
registerCtx === null || registerCtx === void 0 ? void 0 : registerCtx.fetchRegisterByUrl(registerConfig);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.33.
|
|
3
|
+
"version": "1.33.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
|
|
6
6
|
"repository": "https://github.com/GovAlta/adsp-monorepo",
|