extended-dynamic-forms 0.1.21 → 0.1.23
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/README.md +134 -70
- package/dist/ExtendedForm.d.ts +4 -0
- package/dist/WizardForm.d.ts +25 -0
- package/dist/components/arrays/ArrayFieldItemTemplate.d.ts +3 -0
- package/dist/components/arrays/ArrayFieldTemplate.d.ts +3 -0
- package/dist/components/arrays/index.d.ts +2 -0
- package/dist/components/fields/AddressField.d.ts +3 -0
- package/dist/components/fields/CurrencyField.d.ts +4 -0
- package/dist/components/fields/PhoneField.d.ts +4 -0
- package/dist/components/index.d.ts +24 -0
- package/dist/components/templates/FieldTemplate.d.ts +4 -0
- package/dist/components/templates/SubmitButton.d.ts +4 -0
- package/dist/components/templates/index.d.ts +2 -0
- package/dist/conditionals/index.d.ts +1 -0
- package/dist/conditionals/v2/createConditionalEngineHook.d.ts +3 -0
- package/dist/conditionals/v2/effects/customHandlers.d.ts +35 -0
- package/dist/conditionals/v2/engines/schemaEngineConfig.d.ts +4 -0
- package/dist/conditionals/v2/engines/uiEngineConfig.d.ts +4 -0
- package/dist/conditionals/v2/engines/validationEngineConfig.d.ts +13 -0
- package/dist/conditionals/v2/hooks/useConditionalSchema.d.ts +4 -0
- package/dist/conditionals/v2/hooks/useConditionalUi.d.ts +4 -0
- package/dist/conditionals/v2/hooks/useConditionalValidation.d.ts +4 -0
- package/dist/conditionals/v2/index.d.ts +9 -0
- package/dist/conditionals/v2/types.d.ts +47 -0
- package/dist/conditionals/v2/utils/dynamicArrayItems.d.ts +59 -0
- package/dist/conditionals/v2/utils/jsonPatch.d.ts +9 -0
- package/dist/events/FormEventContext.d.ts +19 -0
- package/dist/events/FormEventHub.d.ts +27 -0
- package/dist/events/FormEventManager.d.ts +10 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.es.js +19075 -0
- package/dist/index.umd.js +162 -0
- package/dist/layouts/index.d.ts +2 -0
- package/dist/layouts/wizard/ProgressIndicator.d.ts +10 -0
- package/dist/layouts/wizard/StepNavigation.d.ts +11 -0
- package/dist/layouts/wizard/WizardLayout.d.ts +31 -0
- package/dist/layouts/wizard/WizardNavigation.d.ts +16 -0
- package/dist/layouts/wizard/WizardObjectFieldTemplate.d.ts +4 -0
- package/dist/layouts/wizard/WizardSectionTemplate.d.ts +11 -0
- package/dist/layouts/wizard/index.d.ts +7 -0
- package/dist/types/index.d.ts +47 -0
- package/dist/utils/formDataUtils.d.ts +22 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/schemaUtils.d.ts +24 -0
- package/dist/utils/validationUtils.d.ts +26 -0
- package/dist/vanilla-entry.d.ts +204 -0
- package/dist/widgets/date/DateWidget.d.ts +4 -0
- package/dist/widgets/enhanced/EnhancedWidgets.d.ts +37 -0
- package/dist/widgets/file/FileWidget.d.ts +4 -0
- package/dist/widgets/index.d.ts +33 -0
- package/dist/widgets/input/ColorWidget.d.ts +4 -0
- package/dist/widgets/input/RangeWidget.d.ts +4 -0
- package/dist/widgets/input/RatingWidget.d.ts +4 -0
- package/examples/conditional-v2-example.tsx +2 -2
- package/examples/form-devtools-example.tsx +7 -9
- package/examples/global-ui-rules-example.tsx +34 -19
- package/package.json +8 -3
- package/dist/extended-dynamic-forms.standalone.js +0 -882
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ExtendedForm } from '../src/ExtendedForm';
|
|
3
3
|
import { RJSFSchema, UiSchema, IChangeEvent } from '@rjsf/utils';
|
|
4
|
-
import { useConditionalUi, UiRule } from '../src/conditionals/v2';
|
|
4
|
+
import { useConditionalUi, UiRule, JsonLogicRule } from '../src/conditionals/v2';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Global UI Rules Example
|
|
@@ -175,7 +175,7 @@ const globalUiRules: UiRule[] = [
|
|
|
175
175
|
// Rule 1: Show shipping address when shipping is required
|
|
176
176
|
{
|
|
177
177
|
name: 'Show shipping address when shipping required',
|
|
178
|
-
condition:
|
|
178
|
+
condition: { "===": [{ "var": "requiresShipping" }, true] } as JsonLogicRule,
|
|
179
179
|
effect: [
|
|
180
180
|
{ op: 'remove', path: '/shippingAddress/ui:widget' }
|
|
181
181
|
],
|
|
@@ -185,7 +185,7 @@ const globalUiRules: UiRule[] = [
|
|
|
185
185
|
// Rule 2: Show delivery instructions when shipping is required
|
|
186
186
|
{
|
|
187
187
|
name: 'Show delivery instructions when shipping required',
|
|
188
|
-
condition:
|
|
188
|
+
condition: { "===": [{ "var": "requiresShipping" }, true] } as JsonLogicRule,
|
|
189
189
|
effect: [
|
|
190
190
|
{ op: 'replace', path: '/deliveryInstructions/ui:widget', value: 'textarea' }
|
|
191
191
|
],
|
|
@@ -195,7 +195,7 @@ const globalUiRules: UiRule[] = [
|
|
|
195
195
|
// Rule 3: Show express shipping option when shipping is required
|
|
196
196
|
{
|
|
197
197
|
name: 'Show express shipping option when shipping required',
|
|
198
|
-
condition:
|
|
198
|
+
condition: { "===": [{ "var": "requiresShipping" }, true] } as JsonLogicRule,
|
|
199
199
|
effect: [
|
|
200
200
|
{ op: 'remove', path: '/expressShipping/ui:widget' }
|
|
201
201
|
],
|
|
@@ -205,9 +205,12 @@ const globalUiRules: UiRule[] = [
|
|
|
205
205
|
// Rule 4: Show state dropdown only for USA
|
|
206
206
|
{
|
|
207
207
|
name: 'Show state field for USA',
|
|
208
|
-
condition:
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
condition: {
|
|
209
|
+
"and": [
|
|
210
|
+
{ "===": [{ "var": "requiresShipping" }, true] },
|
|
211
|
+
{ "===": [{ "var": "shippingAddress.country" }, "USA"] }
|
|
212
|
+
]
|
|
213
|
+
} as JsonLogicRule,
|
|
211
214
|
effect: [
|
|
212
215
|
{ op: 'remove', path: '/shippingAddress/state/ui:widget' },
|
|
213
216
|
{ op: 'add', path: '/shippingAddress/province/ui:widget', value: 'hidden' },
|
|
@@ -219,9 +222,12 @@ const globalUiRules: UiRule[] = [
|
|
|
219
222
|
// Rule 5: Show province dropdown only for Canada
|
|
220
223
|
{
|
|
221
224
|
name: 'Show province field for Canada',
|
|
222
|
-
condition:
|
|
223
|
-
|
|
224
|
-
|
|
225
|
+
condition: {
|
|
226
|
+
"and": [
|
|
227
|
+
{ "===": [{ "var": "requiresShipping" }, true] },
|
|
228
|
+
{ "===": [{ "var": "shippingAddress.country" }, "Canada"] }
|
|
229
|
+
]
|
|
230
|
+
} as JsonLogicRule,
|
|
225
231
|
effect: [
|
|
226
232
|
{ op: 'add', path: '/shippingAddress/state/ui:widget', value: 'hidden' },
|
|
227
233
|
{ op: 'remove', path: '/shippingAddress/province/ui:widget' },
|
|
@@ -233,9 +239,12 @@ const globalUiRules: UiRule[] = [
|
|
|
233
239
|
// Rule 6: Show region text field for Mexico and Other
|
|
234
240
|
{
|
|
235
241
|
name: 'Show region field for Mexico and Other countries',
|
|
236
|
-
condition:
|
|
237
|
-
|
|
238
|
-
|
|
242
|
+
condition: {
|
|
243
|
+
"and": [
|
|
244
|
+
{ "===": [{ "var": "requiresShipping" }, true] },
|
|
245
|
+
{ "in": [{ "var": "shippingAddress.country" }, ["Mexico", "Other"]] }
|
|
246
|
+
]
|
|
247
|
+
} as JsonLogicRule,
|
|
239
248
|
effect: [
|
|
240
249
|
{ op: 'add', path: '/shippingAddress/state/ui:widget', value: 'hidden' },
|
|
241
250
|
{ op: 'add', path: '/shippingAddress/province/ui:widget', value: 'hidden' },
|
|
@@ -247,9 +256,12 @@ const globalUiRules: UiRule[] = [
|
|
|
247
256
|
// Rule 7: Show international details only for "Other" countries
|
|
248
257
|
{
|
|
249
258
|
name: 'Show international details for non-North American countries',
|
|
250
|
-
condition:
|
|
251
|
-
|
|
252
|
-
|
|
259
|
+
condition: {
|
|
260
|
+
"and": [
|
|
261
|
+
{ "===": [{ "var": "requiresShipping" }, true] },
|
|
262
|
+
{ "===": [{ "var": "shippingAddress.country" }, "Other"] }
|
|
263
|
+
]
|
|
264
|
+
} as JsonLogicRule,
|
|
253
265
|
effect: [
|
|
254
266
|
{ op: 'replace', path: '/shippingAddress/internationalDetails/ui:widget', value: 'textarea' }
|
|
255
267
|
],
|
|
@@ -259,9 +271,12 @@ const globalUiRules: UiRule[] = [
|
|
|
259
271
|
// Rule 8: Reorder fields to put international details at end when visible
|
|
260
272
|
{
|
|
261
273
|
name: 'Reorder fields for international shipping',
|
|
262
|
-
condition:
|
|
263
|
-
|
|
264
|
-
|
|
274
|
+
condition: {
|
|
275
|
+
"and": [
|
|
276
|
+
{ "===": [{ "var": "requiresShipping" }, true] },
|
|
277
|
+
{ "===": [{ "var": "shippingAddress.country" }, "Other"] }
|
|
278
|
+
]
|
|
279
|
+
} as JsonLogicRule,
|
|
265
280
|
effect: [
|
|
266
281
|
{
|
|
267
282
|
op: 'replace',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extended-dynamic-forms",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"description": "Extended React JSON Schema Form (RJSF) v6 with custom components, widgets, templates, layouts, and form events",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -33,10 +33,13 @@
|
|
|
33
33
|
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 10",
|
|
34
34
|
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"",
|
|
35
35
|
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"",
|
|
36
|
-
"prepublishOnly": "npm run build
|
|
36
|
+
"prepublishOnly": "npm run build",
|
|
37
37
|
"playground": "cd playground && npm install && npm run dev",
|
|
38
38
|
"playground:build": "cd playground && npm run build",
|
|
39
|
-
"serve:examples": "npx http-server examples/vanilla-js -p 8080 -o"
|
|
39
|
+
"serve:examples": "npx http-server examples/vanilla-js -p 8080 -o",
|
|
40
|
+
"setup:dev": "git clone https://github.com/rjsf-team/react-jsonschema-form ../react-jsonschema-form && cd ../react-jsonschema-form && npm install && npm run build",
|
|
41
|
+
"link:rjsf": "cd ../react-jsonschema-form/packages/core && npm link && cd ../antd && npm link && cd ../utils && npm link && cd ../validator-ajv8 && npm link",
|
|
42
|
+
"dev:install": "npm run setup:dev && npm run link:rjsf && npm install"
|
|
40
43
|
},
|
|
41
44
|
"keywords": [
|
|
42
45
|
"react",
|
|
@@ -95,8 +98,10 @@
|
|
|
95
98
|
"vitest": "^1.0.0"
|
|
96
99
|
},
|
|
97
100
|
"dependencies": {
|
|
101
|
+
"@types/json-logic-js": "^2.0.8",
|
|
98
102
|
"date-fns": "^4.1.0",
|
|
99
103
|
"dayjs": "^1.11.13",
|
|
104
|
+
"json-logic-js": "^2.0.5",
|
|
100
105
|
"json-rules-engine-simplified": "^0.2.0"
|
|
101
106
|
},
|
|
102
107
|
"type": "module"
|