@rjsf/antd 5.11.2 → 5.12.1

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.
Files changed (124) hide show
  1. package/dist/antd.esm.js +891 -1117
  2. package/dist/antd.esm.js.map +7 -1
  3. package/dist/antd.umd.js +1184 -0
  4. package/dist/index.js +1347 -5
  5. package/dist/index.js.map +7 -0
  6. package/lib/components/DatePicker/index.d.ts +48 -0
  7. package/lib/components/DatePicker/index.js +5 -0
  8. package/lib/components/DatePicker/index.js.map +1 -0
  9. package/lib/index.d.ts +11 -0
  10. package/lib/index.js +17 -0
  11. package/lib/index.js.map +1 -0
  12. package/lib/templates/ArrayFieldItemTemplate/index.d.ts +7 -0
  13. package/lib/templates/ArrayFieldItemTemplate/index.js +21 -0
  14. package/lib/templates/ArrayFieldItemTemplate/index.js.map +1 -0
  15. package/lib/templates/ArrayFieldTemplate/index.d.ts +7 -0
  16. package/lib/templates/ArrayFieldTemplate/index.js +38 -0
  17. package/lib/templates/ArrayFieldTemplate/index.js.map +1 -0
  18. package/lib/templates/BaseInputTemplate/index.d.ts +9 -0
  19. package/lib/templates/BaseInputTemplate/index.js +31 -0
  20. package/lib/templates/BaseInputTemplate/index.js.map +1 -0
  21. package/lib/templates/DescriptionField/index.d.ts +7 -0
  22. package/lib/templates/DescriptionField/index.js +13 -0
  23. package/lib/templates/DescriptionField/index.js.map +1 -0
  24. package/lib/templates/ErrorList/index.d.ts +7 -0
  25. package/lib/templates/ErrorList/index.js +16 -0
  26. package/lib/templates/ErrorList/index.js.map +1 -0
  27. package/lib/templates/FieldErrorTemplate/index.d.ts +7 -0
  28. package/lib/templates/FieldErrorTemplate/index.js +15 -0
  29. package/lib/templates/FieldErrorTemplate/index.js.map +1 -0
  30. package/lib/templates/FieldTemplate/index.d.ts +8 -0
  31. package/lib/templates/FieldTemplate/index.js +34 -0
  32. package/lib/templates/FieldTemplate/index.js.map +1 -0
  33. package/lib/templates/IconButton/index.d.ts +10 -0
  34. package/lib/templates/IconButton/index.js +36 -0
  35. package/lib/templates/IconButton/index.js.map +1 -0
  36. package/lib/templates/ObjectFieldTemplate/index.d.ts +9 -0
  37. package/lib/templates/ObjectFieldTemplate/index.js +71 -0
  38. package/lib/templates/ObjectFieldTemplate/index.js.map +1 -0
  39. package/lib/templates/SubmitButton/index.d.ts +5 -0
  40. package/lib/templates/SubmitButton/index.js +13 -0
  41. package/lib/templates/SubmitButton/index.js.map +1 -0
  42. package/lib/templates/TitleField/index.d.ts +7 -0
  43. package/lib/templates/TitleField/index.js +34 -0
  44. package/lib/templates/TitleField/index.js.map +1 -0
  45. package/lib/templates/WrapIfAdditionalTemplate/index.d.ts +8 -0
  46. package/lib/templates/WrapIfAdditionalTemplate/index.js +34 -0
  47. package/lib/templates/WrapIfAdditionalTemplate/index.js.map +1 -0
  48. package/lib/templates/index.d.ts +4 -0
  49. package/lib/templates/index.js +36 -0
  50. package/lib/templates/index.js.map +1 -0
  51. package/lib/widgets/AltDateTimeWidget/index.d.ts +15 -0
  52. package/lib/widgets/AltDateTimeWidget/index.js +8 -0
  53. package/lib/widgets/AltDateTimeWidget/index.js.map +1 -0
  54. package/lib/widgets/AltDateWidget/index.d.ts +15 -0
  55. package/lib/widgets/AltDateWidget/index.js +89 -0
  56. package/lib/widgets/AltDateWidget/index.js.map +1 -0
  57. package/lib/widgets/CheckboxWidget/index.d.ts +8 -0
  58. package/lib/widgets/CheckboxWidget/index.js +23 -0
  59. package/lib/widgets/CheckboxWidget/index.js.map +1 -0
  60. package/lib/widgets/CheckboxesWidget/index.d.ts +8 -0
  61. package/lib/widgets/CheckboxesWidget/index.js +26 -0
  62. package/lib/widgets/CheckboxesWidget/index.js.map +1 -0
  63. package/lib/widgets/DateTimeWidget/index.d.ts +8 -0
  64. package/lib/widgets/DateTimeWidget/index.js +22 -0
  65. package/lib/widgets/DateTimeWidget/index.js.map +1 -0
  66. package/lib/widgets/DateWidget/index.d.ts +8 -0
  67. package/lib/widgets/DateWidget/index.js +22 -0
  68. package/lib/widgets/DateWidget/index.js.map +1 -0
  69. package/lib/widgets/PasswordWidget/index.d.ts +7 -0
  70. package/lib/widgets/PasswordWidget/index.js +17 -0
  71. package/lib/widgets/PasswordWidget/index.js.map +1 -0
  72. package/lib/widgets/RadioWidget/index.d.ts +8 -0
  73. package/lib/widgets/RadioWidget/index.js +19 -0
  74. package/lib/widgets/RadioWidget/index.js.map +1 -0
  75. package/lib/widgets/RangeWidget/index.d.ts +8 -0
  76. package/lib/widgets/RangeWidget/index.js +26 -0
  77. package/lib/widgets/RangeWidget/index.js.map +1 -0
  78. package/lib/widgets/SelectWidget/index.d.ts +8 -0
  79. package/lib/widgets/SelectWidget/index.js +36 -0
  80. package/lib/widgets/SelectWidget/index.js.map +1 -0
  81. package/lib/widgets/TextareaWidget/index.d.ts +7 -0
  82. package/lib/widgets/TextareaWidget/index.js +23 -0
  83. package/lib/widgets/TextareaWidget/index.js.map +1 -0
  84. package/lib/widgets/index.d.ts +4 -0
  85. package/lib/widgets/index.js +28 -0
  86. package/lib/widgets/index.js.map +1 -0
  87. package/package.json +24 -16
  88. package/src/components/DatePicker/index.ts +6 -0
  89. package/src/index.less +38 -0
  90. package/src/index.ts +33 -0
  91. package/src/templates/ArrayFieldItemTemplate/index.tsx +90 -0
  92. package/src/templates/ArrayFieldTemplate/index.tsx +132 -0
  93. package/src/templates/BaseInputTemplate/index.tsx +105 -0
  94. package/src/templates/DescriptionField/index.tsx +17 -0
  95. package/src/templates/ErrorList/index.tsx +37 -0
  96. package/src/templates/FieldErrorTemplate/index.tsx +25 -0
  97. package/src/templates/FieldTemplate/index.tsx +114 -0
  98. package/src/templates/IconButton/index.tsx +94 -0
  99. package/src/templates/ObjectFieldTemplate/index.tsx +175 -0
  100. package/src/templates/SubmitButton/index.tsx +20 -0
  101. package/src/templates/TitleField/index.tsx +57 -0
  102. package/src/templates/WrapIfAdditionalTemplate/index.tsx +124 -0
  103. package/src/templates/index.ts +43 -0
  104. package/src/widgets/AltDateTimeWidget/index.tsx +17 -0
  105. package/src/widgets/AltDateWidget/index.tsx +197 -0
  106. package/src/widgets/CheckboxWidget/index.tsx +52 -0
  107. package/src/widgets/CheckboxesWidget/index.tsx +75 -0
  108. package/src/widgets/DateTimeWidget/index.tsx +54 -0
  109. package/src/widgets/DateWidget/index.tsx +52 -0
  110. package/src/widgets/PasswordWidget/index.tsx +46 -0
  111. package/src/widgets/RadioWidget/index.tsx +73 -0
  112. package/src/widgets/RangeWidget/index.tsx +69 -0
  113. package/src/widgets/SelectWidget/index.tsx +97 -0
  114. package/src/widgets/TextareaWidget/index.tsx +67 -0
  115. package/src/widgets/index.ts +35 -0
  116. package/dist/antd.cjs.development.js +0 -1643
  117. package/dist/antd.cjs.development.js.map +0 -1
  118. package/dist/antd.cjs.production.min.js +0 -2
  119. package/dist/antd.cjs.production.min.js.map +0 -1
  120. package/dist/antd.umd.development.js +0 -1617
  121. package/dist/antd.umd.development.js.map +0 -1
  122. package/dist/antd.umd.production.min.js +0 -2
  123. package/dist/antd.umd.production.min.js.map +0 -1
  124. package/dist/index.d.ts +0 -16
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Form from 'antd/lib/form';
3
+ import { getTemplate, getUiOptions, } from '@rjsf/utils';
4
+ const VERTICAL_LABEL_COL = { span: 24 };
5
+ const VERTICAL_WRAPPER_COL = { span: 24 };
6
+ /** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
7
+ * content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.
8
+ *
9
+ * @param props - The `FieldTemplateProps` for this component
10
+ */
11
+ export default function FieldTemplate(props) {
12
+ const { children, classNames, style, description, disabled, displayLabel, errors, formContext, help, hidden, id, label, onDropPropertyClick, onKeyChange, rawErrors, rawDescription, rawHelp, readonly, registry, required, schema, uiSchema, } = props;
13
+ const { colon, labelCol = VERTICAL_LABEL_COL, wrapperCol = VERTICAL_WRAPPER_COL, wrapperStyle, descriptionLocation = 'below', } = formContext;
14
+ const uiOptions = getUiOptions(uiSchema);
15
+ const WrapIfAdditionalTemplate = getTemplate('WrapIfAdditionalTemplate', registry, uiOptions);
16
+ if (hidden) {
17
+ return _jsx("div", Object.assign({ className: 'field-hidden' }, { children: children }));
18
+ }
19
+ // check to see if there is rawDescription(string) before using description(ReactNode)
20
+ // to prevent showing a blank description area
21
+ const descriptionNode = rawDescription ? description : undefined;
22
+ const descriptionProps = {};
23
+ switch (descriptionLocation) {
24
+ case 'tooltip':
25
+ descriptionProps.tooltip = descriptionNode;
26
+ break;
27
+ case 'below':
28
+ default:
29
+ descriptionProps.extra = descriptionNode;
30
+ break;
31
+ }
32
+ return (_jsx(WrapIfAdditionalTemplate, Object.assign({ classNames: classNames, style: style, disabled: disabled, id: id, label: label, onDropPropertyClick: onDropPropertyClick, onKeyChange: onKeyChange, readonly: readonly, required: required, schema: schema, uiSchema: uiSchema, registry: registry }, { children: _jsx(Form.Item, Object.assign({ colon: colon, hasFeedback: schema.type !== 'array' && schema.type !== 'object', help: (!!rawHelp && help) || ((rawErrors === null || rawErrors === void 0 ? void 0 : rawErrors.length) ? errors : undefined), htmlFor: id, label: displayLabel && label, labelCol: labelCol, required: required, style: wrapperStyle, validateStatus: (rawErrors === null || rawErrors === void 0 ? void 0 : rawErrors.length) ? 'error' : undefined, wrapperCol: wrapperCol }, descriptionProps, { children: children })) })));
33
+ }
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/FieldTemplate/index.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,EAKL,WAAW,EACX,YAAY,GAEb,MAAM,aAAa,CAAC;AAErB,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AACxC,MAAM,oBAAoB,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AAE1C;;;;GAIG;AACH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B,EACxC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,gBAElB,KAAC,IAAI,CAAC,IAAI,kBACR,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,MAAM,CAAC,IAAI,KAAK,OAAO,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,EAChE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,EAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,EACrE,OAAO,EAAE,EAAE,EACX,KAAK,EAAE,YAAY,IAAI,KAAK,EAC5B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,YAAY,EACnB,cAAc,EAAE,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,EAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EACvD,UAAU,EAAE,UAAU,IAClB,gBAAgB,cAEnB,QAAQ,IACC,IACa,CAC5B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { ButtonProps } from 'antd/lib/button';
3
+ import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
4
+ export type AntdIconButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Omit<IconButtonProps<T, S, F>, 'type'>;
5
+ export default function IconButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: AntdIconButtonProps<T, S, F> & ButtonProps): JSX.Element;
6
+ export declare function AddButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: AntdIconButtonProps<T, S, F>): JSX.Element;
7
+ export declare function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: AntdIconButtonProps<T, S, F>): JSX.Element;
8
+ export declare function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: AntdIconButtonProps<T, S, F>): JSX.Element;
9
+ export declare function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: AntdIconButtonProps<T, S, F>): JSX.Element;
10
+ export declare function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: AntdIconButtonProps<T, S, F>): JSX.Element;
@@ -0,0 +1,36 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import Button from 'antd/lib/button';
4
+ import ArrowDownOutlined from '@ant-design/icons/ArrowDownOutlined';
5
+ import ArrowUpOutlined from '@ant-design/icons/ArrowUpOutlined';
6
+ import CopyOutlined from '@ant-design/icons/CopyOutlined';
7
+ import DeleteOutlined from '@ant-design/icons/DeleteOutlined';
8
+ import PlusCircleOutlined from '@ant-design/icons/PlusCircleOutlined';
9
+ import { getUiOptions, TranslatableString, } from '@rjsf/utils';
10
+ export default function IconButton(props) {
11
+ const { iconType = 'default', icon, uiSchema, registry } = props, otherProps = __rest(props, ["iconType", "icon", "uiSchema", "registry"]);
12
+ return _jsx(Button, Object.assign({ type: iconType, icon: icon }, otherProps));
13
+ }
14
+ export function AddButton(props) {
15
+ const { registry: { translateString }, } = props;
16
+ return (_jsx(IconButton, Object.assign({ title: translateString(TranslatableString.AddItemButton) }, props, { block: true, iconType: 'primary', icon: _jsx(PlusCircleOutlined, {}) })));
17
+ }
18
+ export function CopyButton(props) {
19
+ const { registry: { translateString }, } = props;
20
+ return _jsx(IconButton, Object.assign({ title: translateString(TranslatableString.CopyButton) }, props, { icon: _jsx(CopyOutlined, {}) }));
21
+ }
22
+ export function MoveDownButton(props) {
23
+ const { registry: { translateString }, } = props;
24
+ return (_jsx(IconButton, Object.assign({ title: translateString(TranslatableString.MoveDownButton) }, props, { icon: _jsx(ArrowDownOutlined, {}) })));
25
+ }
26
+ export function MoveUpButton(props) {
27
+ const { registry: { translateString }, } = props;
28
+ return _jsx(IconButton, Object.assign({ title: translateString(TranslatableString.MoveUpButton) }, props, { icon: _jsx(ArrowUpOutlined, {}) }));
29
+ }
30
+ export function RemoveButton(props) {
31
+ // The `block` prop is not part of the `IconButtonProps` defined in the template, so get it from the uiSchema instead
32
+ const options = getUiOptions(props.uiSchema);
33
+ const { registry: { translateString }, } = props;
34
+ return (_jsx(IconButton, Object.assign({ title: translateString(TranslatableString.RemoveButton) }, props, { danger: true, block: !!options.block, iconType: 'primary', icon: _jsx(DeleteOutlined, {}) })));
35
+ }
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/IconButton/index.tsx"],"names":[],"mappings":";;AAAA,OAAO,MAAmC,MAAM,iBAAiB,CAAC;AAClE,OAAO,iBAAiB,MAAM,qCAAqC,CAAC;AACpE,OAAO,eAAe,MAAM,mCAAmC,CAAC;AAChE,OAAO,YAAY,MAAM,gCAAgC,CAAC;AAC1D,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,kBAAkB,MAAM,sCAAsC,CAAC;AACtE,OAAO,EACL,YAAY,EAKZ,kBAAkB,GACnB,MAAM,aAAa,CAAC;AASrB,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,KAAiD;IAEjD,MAAM,EAAE,QAAQ,GAAG,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,KAAoB,KAAK,EAApB,UAAU,UAAK,KAAK,EAAzE,4CAAiE,CAAQ,CAAC;IAChF,OAAO,KAAC,MAAM,kBAAC,IAAI,EAAE,QAAsB,EAAE,IAAI,EAAE,IAAI,IAAM,UAAU,EAAI,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,SAAS,CACvB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QAAQ,EAAE,EAAE,eAAe,EAAE,GAC9B,GAAG,KAAK,CAAC;IACV,OAAO,CACL,KAAC,UAAU,kBACT,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,YAAY,CAAC,IACnD,KAAK,IACT,MAAM,QACN,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EACtB,QAAQ,EAAC,SAAS,EAClB,IAAI,EAAE,KAAC,cAAc,KAAG,IACxB,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { FormContextType, ObjectFieldTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
+ /** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
4
+ * title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
5
+ * the properties.
6
+ *
7
+ * @param props - The `ObjectFieldTemplateProps` for this component
8
+ */
9
+ export default function ObjectFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: ObjectFieldTemplateProps<T, S, F>): JSX.Element;
@@ -0,0 +1,71 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ import isObject from 'lodash/isObject';
4
+ import isNumber from 'lodash/isNumber';
5
+ import isString from 'lodash/isString';
6
+ import { canExpand, descriptionId, getTemplate, getUiOptions, titleId, } from '@rjsf/utils';
7
+ import Col from 'antd/lib/col';
8
+ import Row from 'antd/lib/row';
9
+ import { ConfigConsumer } from 'antd/lib/config-provider/context';
10
+ const DESCRIPTION_COL_STYLE = {
11
+ paddingBottom: '8px',
12
+ };
13
+ /** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
14
+ * title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
15
+ * the properties.
16
+ *
17
+ * @param props - The `ObjectFieldTemplateProps` for this component
18
+ */
19
+ export default function ObjectFieldTemplate(props) {
20
+ const { description, disabled, formContext, formData, idSchema, onAddClick, properties, readonly, required, registry, schema, title, uiSchema, } = props;
21
+ const uiOptions = getUiOptions(uiSchema);
22
+ const TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, uiOptions);
23
+ const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
24
+ // Button templates are not overridden in the uiSchema
25
+ const { ButtonTemplates: { AddButton }, } = registry.templates;
26
+ const { colSpan = 24, labelAlign = 'right', rowGutter = 24 } = formContext;
27
+ const findSchema = (element) => element.content.props.schema;
28
+ const findSchemaType = (element) => findSchema(element).type;
29
+ const findUiSchema = (element) => element.content.props.uiSchema;
30
+ const findUiSchemaField = (element) => getUiOptions(findUiSchema(element)).field;
31
+ const findUiSchemaWidget = (element) => getUiOptions(findUiSchema(element)).widget;
32
+ const calculateColSpan = (element) => {
33
+ const type = findSchemaType(element);
34
+ const field = findUiSchemaField(element);
35
+ const widget = findUiSchemaWidget(element);
36
+ const defaultColSpan = properties.length < 2 || // Single or no field in object.
37
+ type === 'object' ||
38
+ type === 'array' ||
39
+ widget === 'textarea'
40
+ ? 24
41
+ : 12;
42
+ if (isObject(colSpan)) {
43
+ const colSpanObj = colSpan;
44
+ if (isString(widget)) {
45
+ return colSpanObj[widget];
46
+ }
47
+ if (isString(field)) {
48
+ return colSpanObj[field];
49
+ }
50
+ if (isString(type)) {
51
+ return colSpanObj[type];
52
+ }
53
+ }
54
+ if (isNumber(colSpan)) {
55
+ return colSpan;
56
+ }
57
+ return defaultColSpan;
58
+ };
59
+ return (_jsx(ConfigConsumer, { children: (configProps) => {
60
+ const { getPrefixCls } = configProps;
61
+ const prefixCls = getPrefixCls('form');
62
+ const labelClsBasic = `${prefixCls}-item-label`;
63
+ const labelColClassName = classNames(labelClsBasic, labelAlign === 'left' && `${labelClsBasic}-left`
64
+ // labelCol.className,
65
+ );
66
+ return (_jsxs("fieldset", Object.assign({ id: idSchema.$id }, { children: [_jsxs(Row, Object.assign({ gutter: rowGutter }, { children: [title && (_jsx(Col, Object.assign({ className: labelColClassName, span: 24 }, { children: _jsx(TitleFieldTemplate, { id: titleId(idSchema), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry }) }))), description && (_jsx(Col, Object.assign({ span: 24, style: DESCRIPTION_COL_STYLE }, { children: _jsx(DescriptionFieldTemplate, { id: descriptionId(idSchema), description: description, schema: schema, uiSchema: uiSchema, registry: registry }) }))), properties
67
+ .filter((e) => !e.hidden)
68
+ .map((element) => (_jsx(Col, Object.assign({ span: calculateColSpan(element) }, { children: element.content }), element.name)))] })), canExpand(schema, uiSchema, formData) && (_jsx(Col, Object.assign({ span: 24 }, { children: _jsx(Row, Object.assign({ gutter: rowGutter, justify: 'end' }, { children: _jsx(Col, Object.assign({ flex: '192px' }, { children: _jsx(AddButton, { className: 'object-property-expand', disabled: disabled || readonly, onClick: onAddClick(schema), uiSchema: uiSchema, registry: registry }) })) })) })))] })));
69
+ } }));
70
+ }
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/ObjectFieldTemplate/index.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAQL,SAAS,EACT,aAAa,EACb,WAAW,EACX,YAAY,EACZ,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAuB,MAAM,kCAAkC,CAAC;AAEvF,MAAM,qBAAqB,GAAG;IAC5B,aAAa,EAAE,KAAK;CACrB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAIzC,KAAwC;IACxC,MAAM,EACJ,WAAW,EACX,QAAQ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,IACE,IACF,IACF,CACP,KACQ,CACZ,CAAC;QACJ,CAAC,GACc,CAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { FormContextType, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils';
3
+ /** The `SubmitButton` renders a button that represent the `Submit` action on a form
4
+ */
5
+ export default function SubmitButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ uiSchema }: SubmitButtonProps<T, S, F>): JSX.Element | null;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Button from 'antd/lib/button';
3
+ import { getSubmitButtonOptions } from '@rjsf/utils';
4
+ /** The `SubmitButton` renders a button that represent the `Submit` action on a form
5
+ */
6
+ export default function SubmitButton({ uiSchema }) {
7
+ const { submitText, norender, props: submitButtonProps } = getSubmitButtonOptions(uiSchema);
8
+ if (norender) {
9
+ return null;
10
+ }
11
+ return (_jsx(Button, Object.assign({ type: 'submit' }, submitButtonProps, { htmlType: 'submit' }, { children: submitText })));
12
+ }
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/SubmitButton/index.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAsB,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAoE,MAAM,aAAa,CAAC;AAEvH;GACG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAIlC,EAAE,QAAQ,EAA8B;IACxC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAC5F,IAAI,QAAQ,EAAE;QACZ,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CACL,KAAC,MAAM,kBAAC,IAAI,EAAE,QAAsB,IAAM,iBAAiB,IAAE,QAAQ,EAAC,QAAQ,gBAC3E,UAAU,IACJ,CACV,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { FormContextType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
+ /** The `TitleField` is the template to use to render the title of a field
4
+ *
5
+ * @param props - The `TitleFieldProps` for this component
6
+ */
7
+ export default function TitleField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ id, required, registry, title, }: TitleFieldProps<T, S, F>): JSX.Element | null;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ import { ConfigConsumer } from 'antd/lib/config-provider/context';
4
+ /** The `TitleField` is the template to use to render the title of a field
5
+ *
6
+ * @param props - The `TitleFieldProps` for this component
7
+ */
8
+ export default function TitleField({ id, required, registry, title, }) {
9
+ const { formContext } = registry;
10
+ const { colon = true } = formContext;
11
+ let labelChildren = title;
12
+ if (colon && typeof title === 'string' && title.trim() !== '') {
13
+ labelChildren = title.replace(/[::]\s*$/, '');
14
+ }
15
+ const handleLabelClick = () => {
16
+ if (!id) {
17
+ return;
18
+ }
19
+ const control = document.querySelector(`[id="${id}"]`);
20
+ if (control && control.focus) {
21
+ control.focus();
22
+ }
23
+ };
24
+ return title ? (_jsx(ConfigConsumer, { children: (configProps) => {
25
+ const { getPrefixCls } = configProps;
26
+ const prefixCls = getPrefixCls('form');
27
+ const labelClassName = classNames({
28
+ [`${prefixCls}-item-required`]: required,
29
+ [`${prefixCls}-item-no-colon`]: !colon,
30
+ });
31
+ return (_jsx("label", Object.assign({ className: labelClassName, htmlFor: id, onClick: handleLabelClick, title: typeof title === 'string' ? title : '' }, { children: labelChildren })));
32
+ } })) : null;
33
+ }
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/TitleField/index.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,Y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AAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,gBAE5C,aAAa,IACR,CACT,CAAC;QACJ,CAAC,GACc,CAClB,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { FormContextType, RJSFSchema, StrictRJSFSchema, WrapIfAdditionalTemplateProps } from '@rjsf/utils';
3
+ /** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
4
+ * part of an `additionalProperties` part of a schema.
5
+ *
6
+ * @param props - The `WrapIfAdditionalProps` for this component
7
+ */
8
+ export default function WrapIfAdditionalTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WrapIfAdditionalTemplateProps<T, S, F>): JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Col from 'antd/lib/col';
3
+ import Form from 'antd/lib/form';
4
+ import Input from 'antd/lib/input';
5
+ import Row from 'antd/lib/row';
6
+ import { ADDITIONAL_PROPERTY_FLAG, UI_OPTIONS_KEY, TranslatableString, } from '@rjsf/utils';
7
+ const VERTICAL_LABEL_COL = { span: 24 };
8
+ const VERTICAL_WRAPPER_COL = { span: 24 };
9
+ const INPUT_STYLE = {
10
+ width: '100%',
11
+ };
12
+ /** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
13
+ * part of an `additionalProperties` part of a schema.
14
+ *
15
+ * @param props - The `WrapIfAdditionalProps` for this component
16
+ */
17
+ export default function WrapIfAdditionalTemplate(props) {
18
+ const { children, classNames, style, disabled, id, label, onDropPropertyClick, onKeyChange, readonly, required, registry, schema, uiSchema, } = props;
19
+ const { colon, labelCol = VERTICAL_LABEL_COL, readonlyAsDisabled = true, rowGutter = 24, toolbarAlign = 'top', wrapperCol = VERTICAL_WRAPPER_COL, wrapperStyle, } = registry.formContext;
20
+ const { templates, translateString } = registry;
21
+ // Button templates are not overridden in the uiSchema
22
+ const { RemoveButton } = templates.ButtonTemplates;
23
+ const keyLabel = translateString(TranslatableString.KeyLabel, [label]);
24
+ const additional = ADDITIONAL_PROPERTY_FLAG in schema;
25
+ if (!additional) {
26
+ return (_jsx("div", Object.assign({ className: classNames, style: style }, { children: children })));
27
+ }
28
+ const handleBlur = ({ target }) => onKeyChange(target.value);
29
+ // The `block` prop is not part of the `IconButtonProps` defined in the template, so put it into the uiSchema instead
30
+ const uiOptions = uiSchema ? uiSchema[UI_OPTIONS_KEY] : {};
31
+ const buttonUiOptions = Object.assign(Object.assign({}, uiSchema), { [UI_OPTIONS_KEY]: Object.assign(Object.assign({}, uiOptions), { block: true }) });
32
+ return (_jsx("div", Object.assign({ className: classNames, style: style }, { children: _jsxs(Row, Object.assign({ align: toolbarAlign, gutter: rowGutter }, { children: [_jsx(Col, Object.assign({ className: 'form-additional', flex: '1' }, { children: _jsx("div", Object.assign({ className: 'form-group' }, { children: _jsx(Form.Item, Object.assign({ colon: colon, className: 'form-group', hasFeedback: true, htmlFor: `${id}-key`, label: keyLabel, labelCol: labelCol, required: required, style: wrapperStyle, wrapperCol: wrapperCol }, { children: _jsx(Input, { className: 'form-control', defaultValue: label, disabled: disabled || (readonlyAsDisabled && readonly), id: `${id}-key`, name: `${id}-key`, onBlur: !readonly ? handleBlur : undefined, style: INPUT_STYLE, type: 'text' }) })) })) })), _jsx(Col, Object.assign({ className: 'form-additional', flex: '1' }, { children: children })), _jsx(Col, Object.assign({ flex: '192px' }, { children: _jsx(RemoveButton, { className: 'array-item-remove', disabled: disabled || readonly, onClick: onDropPropertyClick(label), uiSchema: buttonUiOptions, registry: registry }) }))] })) })));
33
+ }
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/WrapIfAdditionalTemplate/index.tsx"],"names":[],"mappings":";AACA,OAAO,GAAG,MAAM,cAAc,CAAC;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B,EAAC,IAAI,EAAC,GAAG,gBACtC,QAAQ,IACL,EACN,KAAC,GAAG,kBAAC,IAAI,EAAC,OAAO,gBACf,KAAC,YAAY,IACX,SAAS,EAAC,mBAAmB,EAC7B,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,OAAO,EAAE,mBAAmB,CAAC,KAAK,CAAC,EACnC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,QAAQ,GAClB,IACE,KACF,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
2
+ export declare function generateTemplates<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): Partial<TemplatesType<T, S, F>>;
3
+ declare const _default: Partial<TemplatesType<any, RJSFSchema, any>>;
4
+ export default _default;
@@ -0,0 +1,36 @@
1
+ import ArrayFieldItemTemplate from './ArrayFieldItemTemplate';
2
+ import ArrayFieldTemplate from './ArrayFieldTemplate';
3
+ import BaseInputTemplate from './BaseInputTemplate';
4
+ import DescriptionField from './DescriptionField';
5
+ import ErrorList from './ErrorList';
6
+ import { AddButton, CopyButton, MoveDownButton, MoveUpButton, RemoveButton } from './IconButton';
7
+ import FieldErrorTemplate from './FieldErrorTemplate';
8
+ import FieldTemplate from './FieldTemplate';
9
+ import ObjectFieldTemplate from './ObjectFieldTemplate';
10
+ import SubmitButton from './SubmitButton';
11
+ import TitleField from './TitleField';
12
+ import WrapIfAdditionalTemplate from './WrapIfAdditionalTemplate';
13
+ export function generateTemplates() {
14
+ return {
15
+ ArrayFieldItemTemplate,
16
+ ArrayFieldTemplate,
17
+ BaseInputTemplate,
18
+ ButtonTemplates: {
19
+ AddButton,
20
+ CopyButton,
21
+ MoveDownButton,
22
+ MoveUpButton,
23
+ RemoveButton,
24
+ SubmitButton,
25
+ },
26
+ DescriptionFieldTemplate: DescriptionField,
27
+ ErrorListTemplate: ErrorList,
28
+ FieldErrorTemplate,
29
+ FieldTemplate,
30
+ ObjectFieldTemplate,
31
+ TitleFieldTemplate: TitleField,
32
+ WrapIfAdditionalTemplate,
33
+ };
34
+ }
35
+ export default generateTemplates();
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAEA,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjG,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAElE,MAAM,UAAU,iBAAiB;IAK/B,OAAO;QACL,sBAAsB;QACtB,kBAAkB;QAClB,iBAAiB;QACjB,eAAe,EAAE;YACf,SAAS;YACT,UAAU;YACV,cAAc;YACd,YAAY;YACZ,YAAY;YACZ,YAAY;SACb;QACD,wBAAwB,EAAE,gBAAgB;QAC1C,iBAAiB,EAAE,SAAS;QAC5B,kBAAkB;QAClB,aAAa;QACb,mBAAmB;QACnB,kBAAkB,EAAE,UAAU;QAC9B,wBAAwB;KACzB,CAAC;AACJ,CAAC;AAED,eAAe,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
+ declare function AltDateTimeWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): JSX.Element;
4
+ declare namespace AltDateTimeWidget {
5
+ var defaultProps: {
6
+ showTime: boolean;
7
+ autofocus: boolean;
8
+ disabled: boolean;
9
+ options: {
10
+ yearsRange: number[];
11
+ };
12
+ readonly: boolean;
13
+ };
14
+ }
15
+ export default AltDateTimeWidget;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import _AltDateWidget from '../AltDateWidget';
3
+ export default function AltDateTimeWidget(props) {
4
+ const { AltDateWidget } = props.registry.widgets;
5
+ return _jsx(AltDateWidget, Object.assign({ showTime: true }, props));
6
+ }
7
+ AltDateTimeWidget.defaultProps = Object.assign(Object.assign({}, _AltDateWidget.defaultProps), { showTime: true });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/widgets/AltDateTimeWidget/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAIvC,KAA2B;IAC3B,MAAM,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;IACjD,OAAO,KAAC,aAAa,kBAAC,QAAQ,UAAK,KAAK,EAAI,CAAC;AAC/C,CAAC;AAED,iBAAiB,CAAC,YAAY,mCACzB,cAAc,CAAC,YAAY,KAC9B,QAAQ,EAAE,IAAI,GACf,CAAC"}
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
+ declare function AltDateWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): JSX.Element;
4
+ declare namespace AltDateWidget {
5
+ var defaultProps: {
6
+ autofocus: boolean;
7
+ disabled: boolean;
8
+ options: {
9
+ yearsRange: number[];
10
+ };
11
+ readonly: boolean;
12
+ showTime: boolean;
13
+ };
14
+ }
15
+ export default AltDateWidget;
@@ -0,0 +1,89 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import Button from 'antd/lib/button';
4
+ import Col from 'antd/lib/col';
5
+ import Row from 'antd/lib/row';
6
+ import { ariaDescribedByIds, pad, parseDateString, toDateString, TranslatableString, } from '@rjsf/utils';
7
+ const rangeOptions = (start, stop) => {
8
+ const options = [];
9
+ for (let i = start; i <= stop; i++) {
10
+ options.push({ value: i, label: pad(i, 2) });
11
+ }
12
+ return options;
13
+ };
14
+ const readyForChange = (state) => {
15
+ return Object.values(state).every((value) => value !== -1);
16
+ };
17
+ function dateElementProps(state, time, yearsRange = [1900, new Date().getFullYear() + 2]) {
18
+ const { year, month, day, hour, minute, second } = state;
19
+ const data = [
20
+ {
21
+ type: 'year',
22
+ range: yearsRange,
23
+ value: year,
24
+ },
25
+ { type: 'month', range: [1, 12], value: month },
26
+ { type: 'day', range: [1, 31], value: day },
27
+ ];
28
+ if (time) {
29
+ data.push({ type: 'hour', range: [0, 23], value: hour || -1 }, { type: 'minute', range: [0, 59], value: minute || -1 }, { type: 'second', range: [0, 59], value: second || -1 });
30
+ }
31
+ return data;
32
+ }
33
+ export default function AltDateWidget(props) {
34
+ const { autofocus, disabled, formContext, id, onBlur, onChange, onFocus, options, readonly, registry, showTime, value, } = props;
35
+ const { translateString, widgets } = registry;
36
+ const { SelectWidget } = widgets;
37
+ const { rowGutter = 24 } = formContext;
38
+ const [state, setState] = useState(parseDateString(value, showTime));
39
+ useEffect(() => {
40
+ setState(parseDateString(value, showTime));
41
+ }, [showTime, value]);
42
+ const handleChange = (property, nextValue) => {
43
+ const nextState = Object.assign(Object.assign({}, state), { [property]: typeof nextValue === 'undefined' ? -1 : nextValue });
44
+ if (readyForChange(nextState)) {
45
+ onChange(toDateString(nextState, showTime));
46
+ }
47
+ else {
48
+ setState(nextState);
49
+ }
50
+ };
51
+ const handleNow = (event) => {
52
+ event.preventDefault();
53
+ if (disabled || readonly) {
54
+ return;
55
+ }
56
+ const nextState = parseDateString(new Date().toJSON(), showTime);
57
+ onChange(toDateString(nextState, showTime));
58
+ };
59
+ const handleClear = (event) => {
60
+ event.preventDefault();
61
+ if (disabled || readonly) {
62
+ return;
63
+ }
64
+ onChange(undefined);
65
+ };
66
+ const renderDateElement = (elemProps) => (_jsx(SelectWidget, { autofocus: elemProps.autofocus, className: 'form-control', disabled: elemProps.disabled, id: elemProps.id, name: elemProps.name, onBlur: elemProps.onBlur, onChange: (elemValue) => elemProps.select(elemProps.type, elemValue), onFocus: elemProps.onFocus, options: {
67
+ enumOptions: rangeOptions(elemProps.range[0], elemProps.range[1]),
68
+ }, placeholder: elemProps.type, readonly: elemProps.readonly, schema: { type: 'integer' }, value: elemProps.value, registry: registry, label: '', "aria-describedby": ariaDescribedByIds(id) }));
69
+ return (_jsxs(Row, Object.assign({ gutter: [Math.floor(rowGutter / 2), Math.floor(rowGutter / 2)] }, { children: [dateElementProps(state, showTime, options.yearsRange).map((elemProps, i) => {
70
+ const elemId = id + '_' + elemProps.type;
71
+ return (_jsx(Col, Object.assign({ flex: '88px' }, { children: renderDateElement(Object.assign(Object.assign({}, elemProps), { autofocus: autofocus && i === 0, disabled, id: elemId, name: id, onBlur,
72
+ onFocus,
73
+ readonly,
74
+ registry, select: handleChange,
75
+ // NOTE: antd components accept -1 rather than issue a warning
76
+ // like material-ui, so we need to convert -1 to undefined here.
77
+ value: elemProps.value < 0 ? undefined : elemProps.value })) }), elemId));
78
+ }), !options.hideNowButton && (_jsx(Col, Object.assign({ flex: '88px' }, { children: _jsx(Button, Object.assign({ block: true, className: 'btn-now', onClick: handleNow, type: 'primary' }, { children: translateString(TranslatableString.NowLabel) })) }))), !options.hideClearButton && (_jsx(Col, Object.assign({ flex: '88px' }, { children: _jsx(Button, Object.assign({ block: true, className: 'btn-clear', danger: true, onClick: handleClear, type: 'primary' }, { children: translateString(TranslatableString.ClearLabel) })) })))] })));
79
+ }
80
+ AltDateWidget.defaultProps = {
81
+ autofocus: false,
82
+ disabled: false,
83
+ options: {
84
+ yearsRange: [1900, new Date().getFullYear() + 2],
85
+ },
86
+ readonly: false,
87
+ showTime: false,
88
+ };
89
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/widgets/AltDateWidget/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAc,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,EACL,kBAAkB,EAClB,GAAG,EACH,eAAe,EACf,YAAY,EAMZ,kBAAkB,GAEnB,MAAM,aAAa,CAAC;AAWrB,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IACnD,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,EAAE;QAClC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC9C;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAE,EAAE;IAC3C,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC,CAAC;AAEF,SAAS,gBAAgB,CACvB,KAAiB,EACjB,IAAa,E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WAAW,EAAE,GAAG,CAAC,CAAC;KACjD;IACD,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,KAAK;CAChB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
+ /** The `CheckBoxWidget` is a widget for rendering boolean properties.
4
+ * It is typically used to represent a boolean.
5
+ *
6
+ * @param props - The `WidgetProps` for this component
7
+ */
8
+ export default function CheckboxWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Checkbox from 'antd/lib/checkbox';
3
+ import { ariaDescribedByIds, labelValue, } from '@rjsf/utils';
4
+ /** The `CheckBoxWidget` is a widget for rendering boolean properties.
5
+ * It is typically used to represent a boolean.
6
+ *
7
+ * @param props - The `WidgetProps` for this component
8
+ */
9
+ export default function CheckboxWidget(props) {
10
+ const { autofocus, disabled, formContext, id, label, hideLabel, onBlur, onChange, onFocus, readonly, value } = props;
11
+ const { readonlyAsDisabled = true } = formContext;
12
+ const handleChange = ({ target }) => onChange(target.checked);
13
+ const handleBlur = ({ target }) => onBlur(id, target.checked);
14
+ const handleFocus = ({ target }) => onFocus(id, target.checked);
15
+ // Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
16
+ // they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
17
+ const extraProps = {
18
+ onBlur: !readonly ? handleBlur : undefined,
19
+ onFocus: !readonly ? handleFocus : undefined,
20
+ };
21
+ return (_jsx(Checkbox, Object.assign({ autoFocus: autofocus, checked: typeof value === 'undefined' ? false : value, disabled: disabled || (readonlyAsDisabled && readonly), id: id, name: id, onChange: !readonly ? handleChange : undefined }, extraProps, { "aria-describedby": ariaDescribedByIds(id) }, { children: labelValue(label, hideLabel, '') })));
22
+ }
23
+ //# sourceMapping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,KAAK,EACrD,QAAQ,EAAE,QAAQ,IAAI,CAAC,kBAAkB,IAAI,QAAQ,CAAC,EACtD,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,EAAE,EACR,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,IAC1C,UAAU,wBACI,kBAAkB,CAAI,EAAE,CAAC,gBAE1C,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,IACxB,CACZ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { FormContextType, WidgetProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
+ /** The `CheckboxesWidget` is a widget for rendering checkbox groups.
4
+ * It is typically used to represent an array of enums.
5
+ *
6
+ * @param props - The `WidgetProps` for this component
7
+ */
8
+ export default function CheckboxesWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ autofocus, disabled, formContext, id, onBlur, onChange, onFocus, options, readonly, value }: WidgetProps<T, S, F>): JSX.Element | null;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import Checkbox from 'antd/lib/checkbox';
3
+ import { ariaDescribedByIds, enumOptionsIndexForValue, enumOptionsValueForIndex, optionId, } from '@rjsf/utils';
4
+ /** The `CheckboxesWidget` is a widget for rendering checkbox groups.
5
+ * It is typically used to represent an array of enums.
6
+ *
7
+ * @param props - The `WidgetProps` for this component
8
+ */
9
+ export default function CheckboxesWidget({ autofocus, disabled, formContext, id, onBlur, onChange, onFocus, options, readonly, value }) {
10
+ const { readonlyAsDisabled = true } = formContext;
11
+ const { enumOptions, enumDisabled, inline, emptyValue } = options;
12
+ const handleChange = (nextValue) => onChange(enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
13
+ const handleBlur = ({ target }) => onBlur(id, enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
14
+ const handleFocus = ({ target }) => onFocus(id, enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
15
+ // Antd's typescript definitions do not contain the following props that are actually necessary and, if provided,
16
+ // they are used, so hacking them in via by spreading `extraProps` on the component to avoid typescript errors
17
+ const extraProps = {
18
+ id,
19
+ onBlur: !readonly ? handleBlur : undefined,
20
+ onFocus: !readonly ? handleFocus : undefined,
21
+ };
22
+ const selectedIndexes = enumOptionsIndexForValue(value, enumOptions, true);
23
+ return Array.isArray(enumOptions) && enumOptions.length > 0 ? (_jsx(_Fragment, { children: _jsx(Checkbox.Group, Object.assign({ disabled: disabled || (readonlyAsDisabled && readonly), name: id, onChange: !readonly ? handleChange : undefined, value: selectedIndexes }, extraProps, { "aria-describedby": ariaDescribedByIds(id) }, { children: Array.isArray(enumOptions) &&
24
+ enumOptions.map((option, i) => (_jsxs("span", { children: [_jsx(Checkbox, Object.assign({ id: optionId(id, i), name: id, autoFocus: i === 0 ? autofocus : false, disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1, value: String(i) }, { children: option.label })), !inline && _jsx("br", {})] }, i))) })) })) : null;
25
+ }
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/widgets/CheckboxesWidget/index.tsx"],"names":[],"mappings":";AACA,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,QAAQ,GAMT,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAItC,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAwB;IACnH,MAAM,EAAE,kBAAkB,GAAG,IAAI,EAAE,GAAG,WAAgC,CAAC;IAEvE,MAAM,EA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