@abgov/jsonforms-components 1.23.4 → 1.24.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/index.esm.js
CHANGED
|
@@ -1625,9 +1625,9 @@ $$b({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }
|
|
|
1625
1625
|
assign: assign
|
|
1626
1626
|
});
|
|
1627
1627
|
|
|
1628
|
-
let _$
|
|
1629
|
-
_t$
|
|
1630
|
-
const FormFieldWrapper = styled.div(_t$
|
|
1628
|
+
let _$8 = t => t,
|
|
1629
|
+
_t$8;
|
|
1630
|
+
const FormFieldWrapper = styled.div(_t$8 || (_t$8 = _$8`
|
|
1631
1631
|
margin-bottom: var(--goa-space-l);
|
|
1632
1632
|
`));
|
|
1633
1633
|
|
|
@@ -2686,17 +2686,26 @@ const onChangeForNumericControl = props => {
|
|
|
2686
2686
|
}
|
|
2687
2687
|
}
|
|
2688
2688
|
};
|
|
2689
|
+
/**
|
|
2690
|
+
* Helper function to process onChange event for input enum checkboxes controls.
|
|
2691
|
+
* @param data
|
|
2692
|
+
* @param name
|
|
2693
|
+
* @param value
|
|
2694
|
+
* @returns {string[]}
|
|
2695
|
+
*/
|
|
2696
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2697
|
+
const onChangeForCheckboxData = (data, name, value) => data ? !value ? data === null || data === void 0 ? void 0 : data.filter(item => item !== name) : [...data, name] : [name];
|
|
2689
2698
|
|
|
2690
|
-
let _$
|
|
2691
|
-
_t$
|
|
2699
|
+
let _$7 = t => t,
|
|
2700
|
+
_t$7,
|
|
2692
2701
|
_t2$4;
|
|
2693
|
-
styled.div(_t$
|
|
2702
|
+
styled.div(_t$7 || (_t$7 = _$7`
|
|
2694
2703
|
height: 70vh;
|
|
2695
2704
|
overflow-y: auto;
|
|
2696
2705
|
padding-left: var(--goa-space-2xs);
|
|
2697
2706
|
padding-right: var(--goa-space-2xs);
|
|
2698
2707
|
`));
|
|
2699
|
-
const Visible = styled.div(_t2$4 || (_t2$4 = _$
|
|
2708
|
+
const Visible = styled.div(_t2$4 || (_t2$4 = _$7`
|
|
2700
2709
|
display: ${0};
|
|
2701
2710
|
`), p => p.visible ? 'initial' : 'none');
|
|
2702
2711
|
|
|
@@ -4174,6 +4183,142 @@ const BooleanRadioControl = props => jsx(GoAInputBaseControl, Object.assign({},
|
|
|
4174
4183
|
const GoABooleanRadioControlTester = rankWith(3, and(isBooleanControl, optionIs('radio', true)));
|
|
4175
4184
|
const GoABooleanRadioControl = withJsonFormsControlProps(BooleanRadioControl);
|
|
4176
4185
|
|
|
4186
|
+
var $$3 = _export;
|
|
4187
|
+
var $includes = arrayIncludes.includes;
|
|
4188
|
+
var fails$2 = fails$o;
|
|
4189
|
+
var addToUnscopables = addToUnscopables$3;
|
|
4190
|
+
|
|
4191
|
+
// FF99+ bug
|
|
4192
|
+
var BROKEN_ON_SPARSE = fails$2(function () {
|
|
4193
|
+
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
4194
|
+
return !Array(1).includes();
|
|
4195
|
+
});
|
|
4196
|
+
|
|
4197
|
+
// `Array.prototype.includes` method
|
|
4198
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
4199
|
+
$$3({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
|
4200
|
+
includes: function includes(el /* , fromIndex = 0 */) {
|
|
4201
|
+
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
4202
|
+
}
|
|
4203
|
+
});
|
|
4204
|
+
|
|
4205
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
4206
|
+
addToUnscopables('includes');
|
|
4207
|
+
|
|
4208
|
+
var isRegExp = isRegexp;
|
|
4209
|
+
|
|
4210
|
+
var $TypeError$1 = TypeError;
|
|
4211
|
+
|
|
4212
|
+
var notARegexp = function (it) {
|
|
4213
|
+
if (isRegExp(it)) {
|
|
4214
|
+
throw new $TypeError$1("The method doesn't accept regular expressions");
|
|
4215
|
+
} return it;
|
|
4216
|
+
};
|
|
4217
|
+
|
|
4218
|
+
var wellKnownSymbol = wellKnownSymbol$e;
|
|
4219
|
+
|
|
4220
|
+
var MATCH = wellKnownSymbol('match');
|
|
4221
|
+
|
|
4222
|
+
var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
4223
|
+
var regexp = /./;
|
|
4224
|
+
try {
|
|
4225
|
+
'/./'[METHOD_NAME](regexp);
|
|
4226
|
+
} catch (error1) {
|
|
4227
|
+
try {
|
|
4228
|
+
regexp[MATCH] = false;
|
|
4229
|
+
return '/./'[METHOD_NAME](regexp);
|
|
4230
|
+
} catch (error2) { /* empty */ }
|
|
4231
|
+
} return false;
|
|
4232
|
+
};
|
|
4233
|
+
|
|
4234
|
+
var $$2 = _export;
|
|
4235
|
+
var uncurryThis$1 = functionUncurryThis;
|
|
4236
|
+
var notARegExp = notARegexp;
|
|
4237
|
+
var requireObjectCoercible = requireObjectCoercible$7;
|
|
4238
|
+
var toString$1 = toString$a;
|
|
4239
|
+
var correctIsRegExpLogic = correctIsRegexpLogic;
|
|
4240
|
+
|
|
4241
|
+
var stringIndexOf = uncurryThis$1(''.indexOf);
|
|
4242
|
+
|
|
4243
|
+
// `String.prototype.includes` method
|
|
4244
|
+
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
4245
|
+
$$2({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
|
|
4246
|
+
includes: function includes(searchString /* , position = 0 */) {
|
|
4247
|
+
return !!~stringIndexOf(
|
|
4248
|
+
toString$1(requireObjectCoercible(this)),
|
|
4249
|
+
toString$1(notARegExp(searchString)),
|
|
4250
|
+
arguments.length > 1 ? arguments[1] : undefined
|
|
4251
|
+
);
|
|
4252
|
+
}
|
|
4253
|
+
});
|
|
4254
|
+
|
|
4255
|
+
let _$6 = t => t,
|
|
4256
|
+
_t$6;
|
|
4257
|
+
const Checkboxes = ({
|
|
4258
|
+
children,
|
|
4259
|
+
orientation,
|
|
4260
|
+
testId
|
|
4261
|
+
}) => {
|
|
4262
|
+
return jsx(CheckBoxGroupDiv, {
|
|
4263
|
+
"data-testid": testId,
|
|
4264
|
+
className: orientation,
|
|
4265
|
+
children: children
|
|
4266
|
+
});
|
|
4267
|
+
};
|
|
4268
|
+
const CheckBoxGroupDiv = styled.div(_t$6 || (_t$6 = _$6`
|
|
4269
|
+
.horizontal {
|
|
4270
|
+
display: flex;
|
|
4271
|
+
flex-direction: row;
|
|
4272
|
+
}
|
|
4273
|
+
|
|
4274
|
+
.vertical {
|
|
4275
|
+
display: inline-block;
|
|
4276
|
+
}
|
|
4277
|
+
`));
|
|
4278
|
+
|
|
4279
|
+
const CheckboxGroup = props => {
|
|
4280
|
+
var _a, _b;
|
|
4281
|
+
const {
|
|
4282
|
+
data,
|
|
4283
|
+
className,
|
|
4284
|
+
id,
|
|
4285
|
+
schema,
|
|
4286
|
+
uischema,
|
|
4287
|
+
path,
|
|
4288
|
+
handleChange,
|
|
4289
|
+
options,
|
|
4290
|
+
config,
|
|
4291
|
+
label,
|
|
4292
|
+
t
|
|
4293
|
+
} = props;
|
|
4294
|
+
const enumData = (schema === null || schema === void 0 ? void 0 : schema.enum) || [];
|
|
4295
|
+
const appliedUiSchemaOptions = merge({}, config, props.uischema.options, options);
|
|
4296
|
+
return jsx(Checkboxes, {
|
|
4297
|
+
orientation: ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.orientation) ? (_b = uischema.options) === null || _b === void 0 ? void 0 : _b.orientation : 'vertical',
|
|
4298
|
+
testId: `${label || id}-jsonforms-checkboxes`,
|
|
4299
|
+
children: enumData.map(enumValue => {
|
|
4300
|
+
return jsx(GoACheckbox, Object.assign({
|
|
4301
|
+
name: enumValue,
|
|
4302
|
+
checked: data ? data.includes(enumValue) : false,
|
|
4303
|
+
value: `${enumValue}`
|
|
4304
|
+
}, appliedUiSchemaOptions, {
|
|
4305
|
+
text: enumValue,
|
|
4306
|
+
testId: `${enumValue}-checkbox`,
|
|
4307
|
+
onChange: (name, value) => {
|
|
4308
|
+
handleChange(path, onChangeForCheckboxData(data, name, value));
|
|
4309
|
+
}
|
|
4310
|
+
}));
|
|
4311
|
+
})
|
|
4312
|
+
});
|
|
4313
|
+
};
|
|
4314
|
+
const EnumCheckboxControl = props => {
|
|
4315
|
+
return jsx(GoAInputBaseControl, Object.assign({}, props, {
|
|
4316
|
+
input: CheckboxGroup
|
|
4317
|
+
}));
|
|
4318
|
+
};
|
|
4319
|
+
const GoAEnumCheckboxGroupControl = withJsonFormsEnumProps(withTranslateProps(EnumCheckboxControl), true);
|
|
4320
|
+
const GoACheckoutGroupControlTester = rankWith(18, and(isEnumControl, optionIs('format', 'checkbox')));
|
|
4321
|
+
|
|
4177
4322
|
const renderLayoutElements = (elements, schema, path, enabled, renderers, cells) => {
|
|
4178
4323
|
return elements.map((child, index) => jsx("div", {
|
|
4179
4324
|
children: jsx(JsonFormsDispatch, {
|
|
@@ -4337,10 +4482,10 @@ const RightAlignmentDiv = styled.div(_t10 || (_t10 = _$4`
|
|
|
4337
4482
|
justify-content: flex-end;
|
|
4338
4483
|
`));
|
|
4339
4484
|
|
|
4340
|
-
var toString
|
|
4485
|
+
var toString = toString$a;
|
|
4341
4486
|
|
|
4342
4487
|
var normalizeStringArgument$1 = function (argument, $default) {
|
|
4343
|
-
return argument === undefined ? arguments.length < 2 ? '' : $default : toString
|
|
4488
|
+
return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
|
|
4344
4489
|
};
|
|
4345
4490
|
|
|
4346
4491
|
var isObject = isObject$b;
|
|
@@ -4354,10 +4499,10 @@ var installErrorCause$1 = function (O, options) {
|
|
|
4354
4499
|
}
|
|
4355
4500
|
};
|
|
4356
4501
|
|
|
4357
|
-
var uncurryThis
|
|
4502
|
+
var uncurryThis = functionUncurryThis;
|
|
4358
4503
|
|
|
4359
4504
|
var $Error = Error;
|
|
4360
|
-
var replace = uncurryThis
|
|
4505
|
+
var replace = uncurryThis(''.replace);
|
|
4361
4506
|
|
|
4362
4507
|
var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
|
|
4363
4508
|
// eslint-disable-next-line redos/no-vulnerable -- safe
|
|
@@ -4370,10 +4515,10 @@ var errorStackClear = function (stack, dropEntries) {
|
|
|
4370
4515
|
} return stack;
|
|
4371
4516
|
};
|
|
4372
4517
|
|
|
4373
|
-
var fails$
|
|
4518
|
+
var fails$1 = fails$o;
|
|
4374
4519
|
var createPropertyDescriptor = createPropertyDescriptor$4;
|
|
4375
4520
|
|
|
4376
|
-
var errorStackInstallable = !fails$
|
|
4521
|
+
var errorStackInstallable = !fails$1(function () {
|
|
4377
4522
|
var error = new Error('a');
|
|
4378
4523
|
if (!('stack' in error)) return true;
|
|
4379
4524
|
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
@@ -4460,7 +4605,7 @@ var wrapErrorConstructorWithCause$1 = function (FULL_NAME, wrapper, FORCED, IS_A
|
|
|
4460
4605
|
};
|
|
4461
4606
|
|
|
4462
4607
|
/* eslint-disable no-unused-vars -- required for functions `.length` */
|
|
4463
|
-
var $$
|
|
4608
|
+
var $$1 = _export;
|
|
4464
4609
|
var global$2 = global$i;
|
|
4465
4610
|
var apply = functionApply;
|
|
4466
4611
|
var wrapErrorConstructorWithCause = wrapErrorConstructorWithCause$1;
|
|
@@ -4474,14 +4619,14 @@ var FORCED$1 = new Error('e', { cause: 7 }).cause !== 7;
|
|
|
4474
4619
|
var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) {
|
|
4475
4620
|
var O = {};
|
|
4476
4621
|
O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED$1);
|
|
4477
|
-
$$
|
|
4622
|
+
$$1({ global: true, constructor: true, arity: 1, forced: FORCED$1 }, O);
|
|
4478
4623
|
};
|
|
4479
4624
|
|
|
4480
4625
|
var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
|
|
4481
4626
|
if (WebAssembly && WebAssembly[ERROR_NAME]) {
|
|
4482
4627
|
var O = {};
|
|
4483
4628
|
O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED$1);
|
|
4484
|
-
$$
|
|
4629
|
+
$$1({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED$1 }, O);
|
|
4485
4630
|
}
|
|
4486
4631
|
};
|
|
4487
4632
|
|
|
@@ -4517,75 +4662,6 @@ exportWebAssemblyErrorCauseWrapper('RuntimeError', function (init) {
|
|
|
4517
4662
|
return function RuntimeError(message) { return apply(init, this, arguments); };
|
|
4518
4663
|
});
|
|
4519
4664
|
|
|
4520
|
-
var $$2 = _export;
|
|
4521
|
-
var $includes = arrayIncludes.includes;
|
|
4522
|
-
var fails$1 = fails$o;
|
|
4523
|
-
var addToUnscopables = addToUnscopables$3;
|
|
4524
|
-
|
|
4525
|
-
// FF99+ bug
|
|
4526
|
-
var BROKEN_ON_SPARSE = fails$1(function () {
|
|
4527
|
-
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
4528
|
-
return !Array(1).includes();
|
|
4529
|
-
});
|
|
4530
|
-
|
|
4531
|
-
// `Array.prototype.includes` method
|
|
4532
|
-
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
4533
|
-
$$2({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
|
4534
|
-
includes: function includes(el /* , fromIndex = 0 */) {
|
|
4535
|
-
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
4536
|
-
}
|
|
4537
|
-
});
|
|
4538
|
-
|
|
4539
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
4540
|
-
addToUnscopables('includes');
|
|
4541
|
-
|
|
4542
|
-
var isRegExp = isRegexp;
|
|
4543
|
-
|
|
4544
|
-
var $TypeError$1 = TypeError;
|
|
4545
|
-
|
|
4546
|
-
var notARegexp = function (it) {
|
|
4547
|
-
if (isRegExp(it)) {
|
|
4548
|
-
throw new $TypeError$1("The method doesn't accept regular expressions");
|
|
4549
|
-
} return it;
|
|
4550
|
-
};
|
|
4551
|
-
|
|
4552
|
-
var wellKnownSymbol = wellKnownSymbol$e;
|
|
4553
|
-
|
|
4554
|
-
var MATCH = wellKnownSymbol('match');
|
|
4555
|
-
|
|
4556
|
-
var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
4557
|
-
var regexp = /./;
|
|
4558
|
-
try {
|
|
4559
|
-
'/./'[METHOD_NAME](regexp);
|
|
4560
|
-
} catch (error1) {
|
|
4561
|
-
try {
|
|
4562
|
-
regexp[MATCH] = false;
|
|
4563
|
-
return '/./'[METHOD_NAME](regexp);
|
|
4564
|
-
} catch (error2) { /* empty */ }
|
|
4565
|
-
} return false;
|
|
4566
|
-
};
|
|
4567
|
-
|
|
4568
|
-
var $$1 = _export;
|
|
4569
|
-
var uncurryThis = functionUncurryThis;
|
|
4570
|
-
var notARegExp = notARegexp;
|
|
4571
|
-
var requireObjectCoercible = requireObjectCoercible$7;
|
|
4572
|
-
var toString = toString$a;
|
|
4573
|
-
var correctIsRegExpLogic = correctIsRegexpLogic;
|
|
4574
|
-
|
|
4575
|
-
var stringIndexOf = uncurryThis(''.indexOf);
|
|
4576
|
-
|
|
4577
|
-
// `String.prototype.includes` method
|
|
4578
|
-
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
4579
|
-
$$1({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
|
|
4580
|
-
includes: function includes(searchString /* , position = 0 */) {
|
|
4581
|
-
return !!~stringIndexOf(
|
|
4582
|
-
toString(requireObjectCoercible(this)),
|
|
4583
|
-
toString(notARegExp(searchString)),
|
|
4584
|
-
arguments.length > 1 ? arguments[1] : undefined
|
|
4585
|
-
);
|
|
4586
|
-
}
|
|
4587
|
-
});
|
|
4588
|
-
|
|
4589
4665
|
class ContextProviderClass {
|
|
4590
4666
|
addDataByUrl(key, url, processDataFunction, token) {
|
|
4591
4667
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -6532,6 +6608,9 @@ const GoABaseRenderers = [
|
|
|
6532
6608
|
}, {
|
|
6533
6609
|
tester: GoARadioGroupControlTester,
|
|
6534
6610
|
renderer: GoAEnumRadioGroupControl
|
|
6611
|
+
}, {
|
|
6612
|
+
tester: GoACheckoutGroupControlTester,
|
|
6613
|
+
renderer: GoAEnumCheckboxGroupControl
|
|
6535
6614
|
}, {
|
|
6536
6615
|
tester: GoABooleanControlTester,
|
|
6537
6616
|
renderer: GoABooleanControl
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
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",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface CheckboxGroupProps {
|
|
3
|
+
orientation?: CheckboxGroupOrientation;
|
|
4
|
+
testId?: string;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export type CheckboxGroupOrientation = 'horizontal' | 'vertical';
|
|
8
|
+
declare const Checkboxes: ({ children, orientation, testId }: CheckboxGroupProps) => JSX.Element;
|
|
9
|
+
export default Checkboxes;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ControlProps, OwnPropsOfEnum, RankedTester } from '@jsonforms/core';
|
|
3
|
+
import { TranslateProps } from '@jsonforms/react';
|
|
4
|
+
import { WithInputProps } from './type';
|
|
5
|
+
import { WithOptionLabel } from '../../util';
|
|
6
|
+
import { EnumCellProps, WithClassname } from '@jsonforms/core';
|
|
7
|
+
type CheckboxGroupProp = EnumCellProps & WithClassname & TranslateProps & WithInputProps;
|
|
8
|
+
export declare const CheckboxGroup: (props: CheckboxGroupProp) => JSX.Element;
|
|
9
|
+
export declare const EnumCheckboxControl: (props: ControlProps & OwnPropsOfEnum & WithOptionLabel & TranslateProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const GoAEnumCheckboxGroupControl: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl & OwnPropsOfEnum>;
|
|
11
|
+
export declare const GoACheckoutGroupControlTester: RankedTester;
|
|
12
|
+
export {};
|
|
@@ -67,3 +67,11 @@ export declare const onChangeForDateTimeControl: (props: EventChangeControlProps
|
|
|
67
67
|
* @param props - EventChangeControlProps
|
|
68
68
|
*/
|
|
69
69
|
export declare const onChangeForNumericControl: (props: EventChangeControlProps) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Helper function to process onChange event for input enum checkboxes controls.
|
|
72
|
+
* @param data
|
|
73
|
+
* @param name
|
|
74
|
+
* @param value
|
|
75
|
+
* @returns {string[]}
|
|
76
|
+
*/
|
|
77
|
+
export declare const onChangeForCheckboxData: (data: any, name: string, value: string) => any;
|