@bgroup/wise-form 1.0.3 → 1.0.5
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 +1 -1
- package/package.json +23 -4
- package/postcss.config.js +6 -0
- package/src/form/styles.css +11 -37
- package/src/form/view/components/containers/index.tsx +33 -4
- package/src/form/view/components/error.tsx +0 -3
- package/src/form/view/components/field/container.tsx +1 -1
- package/src/form/view/components/field/index.tsx +42 -7
- package/src/form/view/components/rows/row-container.tsx +37 -9
- package/src/form/view/components/rows/wrapper.tsx +17 -6
- package/src/form/view/components/wrapped-form.tsx +38 -5
- package/src/form/view/hooks/use-model.ts +91 -25
- package/src/form/view/index.tsx +15 -3
- package/src/models/field.ts +504 -538
- package/tailwind.config.js +11 -0
- package/tsconfig.json +2 -0
- package/vite.config.ts +59 -0
- package/dist/components/ui/Checkbox.d.ts +0 -14
- package/dist/components/ui/Checkbox.d.ts.map +0 -1
- package/dist/components/ui/Checkbox.js +0 -43
- package/dist/components/ui/Checkbox.js.map +0 -1
- package/dist/components/ui/CheckboxGroup.d.ts +0 -15
- package/dist/components/ui/CheckboxGroup.d.ts.map +0 -1
- package/dist/components/ui/CheckboxGroup.js +0 -33
- package/dist/components/ui/CheckboxGroup.js.map +0 -1
- package/dist/components/ui/Input.d.ts +0 -14
- package/dist/components/ui/Input.d.ts.map +0 -1
- package/dist/components/ui/Input.js +0 -49
- package/dist/components/ui/Input.js.map +0 -1
- package/dist/components/ui/Radio.d.ts +0 -14
- package/dist/components/ui/Radio.d.ts.map +0 -1
- package/dist/components/ui/Radio.js +0 -43
- package/dist/components/ui/Radio.js.map +0 -1
- package/dist/components/ui/Select.d.ts +0 -18
- package/dist/components/ui/Select.d.ts.map +0 -1
- package/dist/components/ui/Select.js +0 -44
- package/dist/components/ui/Select.js.map +0 -1
- package/dist/components/ui/Textarea.d.ts +0 -13
- package/dist/components/ui/Textarea.d.ts.map +0 -1
- package/dist/components/ui/Textarea.js +0 -42
- package/dist/components/ui/Textarea.js.map +0 -1
- package/dist/components/ui/index.d.ts +0 -13
- package/dist/components/ui/index.d.ts.map +0 -1
- package/dist/components/ui/index.js +0 -7
- package/dist/components/ui/index.js.map +0 -1
- package/dist/form/index.d.ts +0 -10
- package/dist/form/index.d.ts.map +0 -1
- package/dist/form/index.js +0 -5
- package/dist/form/index.js.map +0 -1
- package/dist/form/interfaces/field-container.d.ts +0 -8
- package/dist/form/interfaces/field-container.d.ts.map +0 -1
- package/dist/form/interfaces/field-container.js +0 -2
- package/dist/form/interfaces/field-container.js.map +0 -1
- package/dist/form/interfaces/interfaces.d.ts +0 -8
- package/dist/form/interfaces/interfaces.d.ts.map +0 -1
- package/dist/form/interfaces/interfaces.js +0 -2
- package/dist/form/interfaces/interfaces.js.map +0 -1
- package/dist/form/interfaces/settings.d.ts +0 -10
- package/dist/form/interfaces/settings.d.ts.map +0 -1
- package/dist/form/interfaces/settings.js +0 -2
- package/dist/form/interfaces/settings.js.map +0 -1
- package/dist/form/interfaces/template.d.ts +0 -6
- package/dist/form/interfaces/template.d.ts.map +0 -1
- package/dist/form/interfaces/template.js +0 -2
- package/dist/form/interfaces/template.js.map +0 -1
- package/dist/form/interfaces/wise-form-specs.d.ts +0 -9
- package/dist/form/interfaces/wise-form-specs.d.ts.map +0 -1
- package/dist/form/interfaces/wise-form-specs.js +0 -2
- package/dist/form/interfaces/wise-form-specs.js.map +0 -1
- package/dist/form/view/components/containers/index.d.ts +0 -3
- package/dist/form/view/components/containers/index.d.ts.map +0 -1
- package/dist/form/view/components/containers/index.js +0 -12
- package/dist/form/view/components/containers/index.js.map +0 -1
- package/dist/form/view/components/error.d.ts +0 -5
- package/dist/form/view/components/error.d.ts.map +0 -1
- package/dist/form/view/components/error.js +0 -8
- package/dist/form/view/components/error.js.map +0 -1
- package/dist/form/view/components/field/container.d.ts +0 -5
- package/dist/form/view/components/field/container.d.ts.map +0 -1
- package/dist/form/view/components/field/container.js +0 -5
- package/dist/form/view/components/field/container.js.map +0 -1
- package/dist/form/view/components/field/index.d.ts +0 -18
- package/dist/form/view/components/field/index.d.ts.map +0 -1
- package/dist/form/view/components/field/index.js +0 -89
- package/dist/form/view/components/field/index.js.map +0 -1
- package/dist/form/view/components/field/selection.d.ts +0 -2
- package/dist/form/view/components/field/selection.d.ts.map +0 -1
- package/dist/form/view/components/field/selection.js +0 -35
- package/dist/form/view/components/field/selection.js.map +0 -1
- package/dist/form/view/components/field/use-field.d.ts +0 -4
- package/dist/form/view/components/field/use-field.d.ts.map +0 -1
- package/dist/form/view/components/field/use-field.js +0 -41
- package/dist/form/view/components/field/use-field.js.map +0 -1
- package/dist/form/view/components/rows/row-container.d.ts +0 -18
- package/dist/form/view/components/rows/row-container.d.ts.map +0 -1
- package/dist/form/view/components/rows/row-container.js +0 -89
- package/dist/form/view/components/rows/row-container.js.map +0 -1
- package/dist/form/view/components/rows/wrapper.d.ts +0 -12
- package/dist/form/view/components/rows/wrapper.d.ts.map +0 -1
- package/dist/form/view/components/rows/wrapper.js +0 -27
- package/dist/form/view/components/rows/wrapper.js.map +0 -1
- package/dist/form/view/components/wrapped-form.d.ts +0 -6
- package/dist/form/view/components/wrapped-form.d.ts.map +0 -1
- package/dist/form/view/components/wrapped-form.js +0 -26
- package/dist/form/view/components/wrapped-form.js.map +0 -1
- package/dist/form/view/context.d.ts +0 -23
- package/dist/form/view/context.d.ts.map +0 -1
- package/dist/form/view/context.js +0 -7
- package/dist/form/view/context.js.map +0 -1
- package/dist/form/view/hooks/use-model.d.ts +0 -10
- package/dist/form/view/hooks/use-model.d.ts.map +0 -1
- package/dist/form/view/hooks/use-model.js +0 -31
- package/dist/form/view/hooks/use-model.js.map +0 -1
- package/dist/form/view/hooks/use-template.d.ts +0 -14
- package/dist/form/view/hooks/use-template.d.ts.map +0 -1
- package/dist/form/view/hooks/use-template.js +0 -57
- package/dist/form/view/hooks/use-template.js.map +0 -1
- package/dist/form/view/hooks/use-types.d.ts +0 -2
- package/dist/form/view/hooks/use-types.d.ts.map +0 -1
- package/dist/form/view/hooks/use-types.js +0 -19
- package/dist/form/view/hooks/use-types.js.map +0 -1
- package/dist/form/view/index.d.ts +0 -3
- package/dist/form/view/index.d.ts.map +0 -1
- package/dist/form/view/index.js +0 -38
- package/dist/form/view/index.js.map +0 -1
- package/dist/formulas/helpers/condition-types.d.ts +0 -5
- package/dist/formulas/helpers/condition-types.d.ts.map +0 -1
- package/dist/formulas/helpers/condition-types.js +0 -5
- package/dist/formulas/helpers/condition-types.js.map +0 -1
- package/dist/formulas/helpers/evaluations.d.ts +0 -15
- package/dist/formulas/helpers/evaluations.d.ts.map +0 -1
- package/dist/formulas/helpers/evaluations.js +0 -44
- package/dist/formulas/helpers/evaluations.js.map +0 -1
- package/dist/formulas/helpers/formula.d.ts +0 -6
- package/dist/formulas/helpers/formula.d.ts.map +0 -1
- package/dist/formulas/helpers/formula.js +0 -26
- package/dist/formulas/helpers/formula.js.map +0 -1
- package/dist/formulas/helpers/lexer.d.ts +0 -10
- package/dist/formulas/helpers/lexer.d.ts.map +0 -1
- package/dist/formulas/helpers/lexer.js +0 -73
- package/dist/formulas/helpers/lexer.js.map +0 -1
- package/dist/formulas/helpers/parser.d.ts +0 -24
- package/dist/formulas/helpers/parser.d.ts.map +0 -1
- package/dist/formulas/helpers/parser.js +0 -48
- package/dist/formulas/helpers/parser.js.map +0 -1
- package/dist/formulas/helpers/token.d.ts +0 -14
- package/dist/formulas/helpers/token.d.ts.map +0 -1
- package/dist/formulas/helpers/token.js +0 -14
- package/dist/formulas/helpers/token.js.map +0 -1
- package/dist/formulas/index.d.ts +0 -59
- package/dist/formulas/index.d.ts.map +0 -1
- package/dist/formulas/index.js +0 -186
- package/dist/formulas/index.js.map +0 -1
- package/dist/formulas/types/formulas.d.ts +0 -68
- package/dist/formulas/types/formulas.d.ts.map +0 -1
- package/dist/formulas/types/formulas.js +0 -2
- package/dist/formulas/types/formulas.js.map +0 -1
- package/dist/formulas/types/index.d.ts +0 -5
- package/dist/formulas/types/index.d.ts.map +0 -1
- package/dist/formulas/types/index.js +0 -2
- package/dist/formulas/types/index.js.map +0 -1
- package/dist/formulas/variants/array-formula.d.ts +0 -24
- package/dist/formulas/variants/array-formula.d.ts.map +0 -1
- package/dist/formulas/variants/array-formula.js +0 -142
- package/dist/formulas/variants/array-formula.js.map +0 -1
- package/dist/formulas/variants/base.d.ts +0 -6
- package/dist/formulas/variants/base.d.ts.map +0 -1
- package/dist/formulas/variants/base.js +0 -3
- package/dist/formulas/variants/base.js.map +0 -1
- package/dist/formulas/variants/basic.d.ts +0 -18
- package/dist/formulas/variants/basic.d.ts.map +0 -1
- package/dist/formulas/variants/basic.js +0 -128
- package/dist/formulas/variants/basic.js.map +0 -1
- package/dist/formulas/variants/comparison.d.ts +0 -25
- package/dist/formulas/variants/comparison.d.ts.map +0 -1
- package/dist/formulas/variants/comparison.js +0 -153
- package/dist/formulas/variants/comparison.js.map +0 -1
- package/dist/formulas/variants/conditional.d.ts +0 -18
- package/dist/formulas/variants/conditional.d.ts.map +0 -1
- package/dist/formulas/variants/conditional.js +0 -183
- package/dist/formulas/variants/conditional.js.map +0 -1
- package/dist/formulas/variants/iterative-array.d.ts +0 -20
- package/dist/formulas/variants/iterative-array.d.ts.map +0 -1
- package/dist/formulas/variants/iterative-array.js +0 -155
- package/dist/formulas/variants/iterative-array.js.map +0 -1
- package/dist/formulas/variants/per-value.d.ts +0 -20
- package/dist/formulas/variants/per-value.d.ts.map +0 -1
- package/dist/formulas/variants/per-value.js +0 -154
- package/dist/formulas/variants/per-value.js.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -6
- package/dist/index.js.map +0 -1
- package/dist/models/base.d.ts +0 -55
- package/dist/models/base.d.ts.map +0 -1
- package/dist/models/base.js +0 -146
- package/dist/models/base.js.map +0 -1
- package/dist/models/callback-manager.d.ts +0 -7
- package/dist/models/callback-manager.d.ts.map +0 -1
- package/dist/models/callback-manager.js +0 -89
- package/dist/models/callback-manager.js.map +0 -1
- package/dist/models/field.d.ts +0 -121
- package/dist/models/field.d.ts.map +0 -1
- package/dist/models/field.js +0 -515
- package/dist/models/field.js.map +0 -1
- package/dist/models/index.d.ts +0 -13
- package/dist/models/index.d.ts.map +0 -1
- package/dist/models/index.js +0 -7
- package/dist/models/index.js.map +0 -1
- package/dist/models/model.d.ts +0 -37
- package/dist/models/model.d.ts.map +0 -1
- package/dist/models/model.js +0 -245
- package/dist/models/model.js.map +0 -1
- package/dist/models/plugins/base.d.ts +0 -9
- package/dist/models/plugins/base.d.ts.map +0 -1
- package/dist/models/plugins/base.js +0 -3
- package/dist/models/plugins/base.js.map +0 -1
- package/dist/models/plugins/formula.d.ts +0 -18
- package/dist/models/plugins/formula.d.ts.map +0 -1
- package/dist/models/plugins/formula.js +0 -82
- package/dist/models/plugins/formula.js.map +0 -1
- package/dist/models/plugins/index.d.ts +0 -11
- package/dist/models/plugins/index.d.ts.map +0 -1
- package/dist/models/plugins/index.js +0 -52
- package/dist/models/plugins/index.js.map +0 -1
- package/dist/models/plugins/plugins.d.ts +0 -7
- package/dist/models/plugins/plugins.d.ts.map +0 -1
- package/dist/models/plugins/plugins.js +0 -7
- package/dist/models/plugins/plugins.js.map +0 -1
- package/dist/models/types/base-wise-model.d.ts +0 -7
- package/dist/models/types/base-wise-model.d.ts.map +0 -1
- package/dist/models/types/base-wise-model.js +0 -2
- package/dist/models/types/base-wise-model.js.map +0 -1
- package/dist/models/types/callbacks.d.ts +0 -19
- package/dist/models/types/callbacks.d.ts.map +0 -1
- package/dist/models/types/callbacks.js +0 -2
- package/dist/models/types/callbacks.js.map +0 -1
- package/dist/models/types/disabled.d.ts +0 -8
- package/dist/models/types/disabled.d.ts.map +0 -1
- package/dist/models/types/disabled.js +0 -2
- package/dist/models/types/disabled.js.map +0 -1
- package/dist/models/types/form-field.d.ts +0 -25
- package/dist/models/types/form-field.d.ts.map +0 -1
- package/dist/models/types/form-field.js +0 -2
- package/dist/models/types/form-field.js.map +0 -1
- package/dist/models/types/model.d.ts +0 -13
- package/dist/models/types/model.d.ts.map +0 -1
- package/dist/models/types/model.js +0 -2
- package/dist/models/types/model.js.map +0 -1
- package/dist/models/types/plugins.d.ts +0 -13
- package/dist/models/types/plugins.d.ts.map +0 -1
- package/dist/models/types/plugins.js +0 -2
- package/dist/models/types/plugins.js.map +0 -1
- package/dist/models/types/wrapped-form-model-props.d.ts +0 -11
- package/dist/models/types/wrapped-form-model-props.d.ts.map +0 -1
- package/dist/models/types/wrapped-form-model-props.js +0 -2
- package/dist/models/types/wrapped-form-model-props.js.map +0 -1
- package/dist/models/wrapper.d.ts +0 -30
- package/dist/models/wrapper.d.ts.map +0 -1
- package/dist/models/wrapper.js +0 -213
- package/dist/models/wrapper.js.map +0 -1
- package/dist/settings/index.d.ts +0 -7
- package/dist/settings/index.d.ts.map +0 -1
- package/dist/settings/index.js +0 -26
- package/dist/settings/index.js.map +0 -1
- package/dist/utils/pending-promise.d.ts +0 -6
- package/dist/utils/pending-promise.d.ts.map +0 -1
- package/dist/utils/pending-promise.js +0 -24
- package/dist/utils/pending-promise.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/form/view/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAmB1B,MAAM,KAAK,GAAiB,EAAE,CAAC;AAC/B,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC1D,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FormModel } from '@bgroup/wise-form/models';
|
|
2
|
-
export declare function useModel(settings: any, form?: FormModel): {
|
|
3
|
-
ready: boolean;
|
|
4
|
-
model: FormModel;
|
|
5
|
-
values: Record<string, any>;
|
|
6
|
-
type: string;
|
|
7
|
-
styles: {};
|
|
8
|
-
items: any;
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=use-model.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-model.d.ts","sourceRoot":"","sources":["../../../../src/form/view/hooks/use-model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGrD,wBAAgB,QAAQ,CAAC,QAAQ,KAAA,EAAE,IAAI,CAAC,EAAE,SAAS;;;;;;;EAgClD"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FormModel } from '@bgroup/wise-form/models';
|
|
3
|
-
import { useTemplate } from './use-template';
|
|
4
|
-
export function useModel(settings, form) {
|
|
5
|
-
const [model, setModel] = React.useState(form);
|
|
6
|
-
const [ready, setReady] = React.useState(false);
|
|
7
|
-
const [values, setValues] = React.useState(form?.values || {});
|
|
8
|
-
const templateSpecs = settings ? settings : form;
|
|
9
|
-
const { type, styles, items } = useTemplate(templateSpecs, templateSpecs.gap);
|
|
10
|
-
const startup = () => {
|
|
11
|
-
setReady(false);
|
|
12
|
-
const onChange = () => {
|
|
13
|
-
setReady(form.ready);
|
|
14
|
-
setValues({ ...form.values });
|
|
15
|
-
};
|
|
16
|
-
if (!form) {
|
|
17
|
-
const properties = settings.fields.map(item => item.name);
|
|
18
|
-
const values = settings.values || {};
|
|
19
|
-
form = new FormModel(settings, { properties, ...values });
|
|
20
|
-
}
|
|
21
|
-
setModel(form);
|
|
22
|
-
form.on('change', onChange);
|
|
23
|
-
onChange();
|
|
24
|
-
return () => {
|
|
25
|
-
form.off('change', onChange);
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
React.useEffect(startup, [form?.name]);
|
|
29
|
-
return { ready, model, values, type, styles, items };
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=use-model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-model.js","sourceRoot":"","sources":["../../../../src/form/view/hooks/use-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,UAAU,QAAQ,CAAC,QAAQ,EAAE,IAAgB;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC;IAC/D,MAAM,aAAa,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IACjD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;IAC9E,MAAM,OAAO,GAAG,GAAG,EAAE;QACpB,QAAQ,CAAC,KAAK,CAAC,CAAC;QAChB,MAAM,QAAQ,GAAG,GAAG,EAAE;YACrB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/B,CAAC,CAAC;QAEF,IAAI,CAAC,IAAI,EAAE,CAAC;YACX,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1D,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;YACrC,IAAI,GAAG,IAAI,SAAS,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAE5B,QAAQ,EAAE,CAAC;QAEX,OAAO,GAAG,EAAE;YACX,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC9B,CAAC,CAAC;IACH,CAAC,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAEvC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Applies a template to create a structured layout, optionally using a gap between elements.
|
|
3
|
-
*
|
|
4
|
-
* @param template - The template to be applied. Can be an array or an object conforming to the IFormTemplate interface.
|
|
5
|
-
* @param gap - Specifies the gap between elements.
|
|
6
|
-
* The `gap` parameter is deprecated and will be removed in a future version. Use the gap property within the template object instead.
|
|
7
|
-
* @returns An object representing the structured layout with type, styles, and items.
|
|
8
|
-
*/
|
|
9
|
-
export declare function useTemplate(settings: any, gap?: any): {
|
|
10
|
-
type: string;
|
|
11
|
-
styles: {};
|
|
12
|
-
items: any;
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=use-template.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-template.d.ts","sourceRoot":"","sources":["../../../../src/form/view/hooks/use-template.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,QAAQ,KAAA,EAAE,GAAG,MAAY;;;;EAoDpD"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Applies a template to create a structured layout, optionally using a gap between elements.
|
|
3
|
-
*
|
|
4
|
-
* @param template - The template to be applied. Can be an array or an object conforming to the IFormTemplate interface.
|
|
5
|
-
* @param gap - Specifies the gap between elements.
|
|
6
|
-
* The `gap` parameter is deprecated and will be removed in a future version. Use the gap property within the template object instead.
|
|
7
|
-
* @returns An object representing the structured layout with type, styles, and items.
|
|
8
|
-
*/
|
|
9
|
-
export function useTemplate(settings, gap = undefined) {
|
|
10
|
-
if (!settings?.template)
|
|
11
|
-
throw new Error(`${settings?.name} Doesn't have a template`);
|
|
12
|
-
let template = settings?.template;
|
|
13
|
-
let structure = template;
|
|
14
|
-
let styles = {};
|
|
15
|
-
if (!template) {
|
|
16
|
-
return {
|
|
17
|
-
type: 'grid',
|
|
18
|
-
styles: {},
|
|
19
|
-
items: settings.fields.map(item => [1, '1fr']),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
if (gap) {
|
|
23
|
-
template = { structure: template, gap: gap };
|
|
24
|
-
}
|
|
25
|
-
const isArray = Array.isArray(template);
|
|
26
|
-
if (!isArray) {
|
|
27
|
-
if (typeof template !== 'object' || !template.structure || !Array.isArray(template.structure)) {
|
|
28
|
-
throw new Error('Template must be an array or an object');
|
|
29
|
-
}
|
|
30
|
-
structure = template.structure;
|
|
31
|
-
styles = template.gap ? { gap: template.gap } : {};
|
|
32
|
-
}
|
|
33
|
-
const processString = str => {
|
|
34
|
-
if (typeof str === 'number')
|
|
35
|
-
return [1, '1fr'];
|
|
36
|
-
const [num, times] = str.split('x').map(Number);
|
|
37
|
-
const tpl = times
|
|
38
|
-
? [
|
|
39
|
-
times,
|
|
40
|
-
Array(times)
|
|
41
|
-
.fill(num)
|
|
42
|
-
.reduce((acc, v) => `${acc} 1fr`, ''),
|
|
43
|
-
]
|
|
44
|
-
: [1, '1fr'];
|
|
45
|
-
return tpl;
|
|
46
|
-
};
|
|
47
|
-
return {
|
|
48
|
-
type: 'grid',
|
|
49
|
-
styles: styles,
|
|
50
|
-
items: structure.map(item => {
|
|
51
|
-
if (!Array.isArray(item))
|
|
52
|
-
return processString(item);
|
|
53
|
-
return item;
|
|
54
|
-
}),
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=use-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-template.js","sourceRoot":"","sources":["../../../../src/form/view/hooks/use-template.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,QAAQ,EAAE,GAAG,GAAG,SAAS;IACpD,IAAI,CAAC,QAAQ,EAAE,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,EAAE,IAAI,0BAA0B,CAAC,CAAC;IAEtF,IAAI,QAAQ,GAAG,QAAQ,EAAE,QAAQ,CAAC;IAClC,IAAI,SAAS,GAAG,QAAQ,CAAC;IACzB,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACf,OAAO;YACN,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;SAC9C,CAAC;IACH,CAAC;IAED,IAAI,GAAG,EAAE,CAAC;QACT,QAAQ,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAmB,CAAC;IAC/D,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,QA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,OAAO,IAAI,CAAC;QACb,CAAC,CAAC;KACF,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-types.d.ts","sourceRoot":"","sources":["../../../../src/form/view/hooks/use-types.ts"],"names":[],"mappings":"AAKA,wBAAgB,QAAQ,CAAC,KAAK,KAAA,OAc7B"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { WFSettings } from '../../../settings';
|
|
3
|
-
import { SelectionField } from '../components/field/selection';
|
|
4
|
-
import { Input, Textarea } from '../../../components/ui';
|
|
5
|
-
export function useTypes(types) {
|
|
6
|
-
return React.useMemo(() => {
|
|
7
|
-
const defaultTypes = {
|
|
8
|
-
checkbox: SelectionField,
|
|
9
|
-
radio: SelectionField,
|
|
10
|
-
select: SelectionField,
|
|
11
|
-
textarea: Textarea,
|
|
12
|
-
text: Input,
|
|
13
|
-
password: Input,
|
|
14
|
-
default: Input,
|
|
15
|
-
};
|
|
16
|
-
return { ...defaultTypes, ...WFSettings.types, ...types };
|
|
17
|
-
}, [types]);
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=use-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-types.js","sourceRoot":"","sources":["../../../../src/form/view/hooks/use-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,QAAQ,CAAC,KAAK;IAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACzB,MAAM,YAAY,GAAG;YACpB,QAAQ,EAAE,cAAc;YACxB,KAAK,EAAE,cAAc;YACrB,MAAM,EAAE,cAAc;YACtB,QAAQ,EAAE,QAAQ;YAClB,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,KAAK;SACd,CAAC;QAEF,OAAO,EAAE,GAAG,YAAY,EAAE,GAAG,UAAU,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC;IAC3D,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/form/view/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CAsC1F"}
|
package/dist/form/view/index.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useModel } from './hooks/use-model';
|
|
3
|
-
import { WiseFormContext } from './context';
|
|
4
|
-
import { useTypes } from './hooks/use-types';
|
|
5
|
-
import { Containers } from './components/containers';
|
|
6
|
-
export function WiseForm({ children, settings, types, model }) {
|
|
7
|
-
const { ready, model: instance, type, styles, items } = useModel(settings, model);
|
|
8
|
-
const formTypes = useTypes(types);
|
|
9
|
-
if (!ready)
|
|
10
|
-
return null;
|
|
11
|
-
if (!settings && !model) {
|
|
12
|
-
console.error('the form does not have settings or model defined', settings);
|
|
13
|
-
}
|
|
14
|
-
const onSubmit = (event) => {
|
|
15
|
-
event.preventDefault();
|
|
16
|
-
// Form submission can be handled via callbacks or custom handlers
|
|
17
|
-
if (instance.callbacks?.onSubmit) {
|
|
18
|
-
instance.callbacks.onSubmit({ form: instance, event });
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const value = {
|
|
22
|
-
model: instance,
|
|
23
|
-
items,
|
|
24
|
-
rows: items,
|
|
25
|
-
values: instance.values,
|
|
26
|
-
name: instance.name,
|
|
27
|
-
template: { type, styles, items },
|
|
28
|
-
formTypes,
|
|
29
|
-
};
|
|
30
|
-
return (React.createElement(WiseFormContext.Provider, { value: value },
|
|
31
|
-
React.createElement("form", { onKeyDown: (e) => {
|
|
32
|
-
if (e.key === 'Enter')
|
|
33
|
-
e.preventDefault();
|
|
34
|
-
}, className: "reactive-form-container", onSubmit: onSubmit },
|
|
35
|
-
React.createElement(Containers, null),
|
|
36
|
-
children)));
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/form/view/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,UAAU,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAkB;IAC5E,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAClF,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAExB,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,kDAAkD,EAAE,QAAQ,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,QAAQ,GAAG,CAAC,KAAsB,EAAE,EAAE;QAC3C,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,kEAAkE;QAClE,IAAI,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,CAAC;YAClC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;QACxD,CAAC;IACF,CAAC,CAAC;IAEF,MAAM,KAAK,GAAG;QACb,KAAK,EAAE,QAAQ;QACf,KAAK;QACL,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;QACjC,SAAS;KACT,CAAC;IAEF,OAAO,CACN,oBAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK;QACrC,8BAAM,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;gBACtB,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO;oBAAE,CAAC,CAAC,cAAc,EAAE,CAAC;YAC3C,CAAC,EAAE,SAAS,EAAC,yBAAyB,EAAC,QAAQ,EAAE,QAAQ;YACxD,oBAAC,UAAU,OAAG;YACb,QAAQ,CACH,CACmB,CAC3B,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"condition-types.d.ts","sourceRoot":"","sources":["../../../src/formulas/helpers/condition-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;CAG3B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"condition-types.js","sourceRoot":"","sources":["../../../src/formulas/helpers/condition-types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,KAAK,EAAE,aAAa;IACpB,IAAI,EAAE,aAAa;CACtB,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare class EvaluationsManager {
|
|
2
|
-
private static evaluations;
|
|
3
|
-
static validate(identifier: string, value: any, comparisonValue?: any): boolean;
|
|
4
|
-
/**
|
|
5
|
-
* Evalúa un arreglo de valores para ver si alguno cumple con la condición especificada.
|
|
6
|
-
* Retorna true si al menos uno de los valores cumple con la condición.
|
|
7
|
-
*/
|
|
8
|
-
static validateAny(identifier: string, values: any[], comparisonValue?: any): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Evalúa un arreglo de valores para ver si todos cumplen con la condición especificada.
|
|
11
|
-
* Retorna true solo si todos los valores cumplen con la condición.
|
|
12
|
-
*/
|
|
13
|
-
static validateAll(identifier: string, values: any[], comparisonValue?: any): boolean;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=evaluations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evaluations.d.ts","sourceRoot":"","sources":["../../../src/formulas/helpers/evaluations.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAkB;IAC9B,OAAO,CAAC,MAAM,CAAC,WAAW,CAaxB;IAEF,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG,GAAG,OAAO;IAS/E;;;KAGI;IACJ,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,eAAe,CAAC,EAAE,GAAG,GAAG,OAAO;IAOrF;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,eAAe,CAAC,EAAE,GAAG,GAAG,OAAO;CAMrF"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export class EvaluationsManager {
|
|
2
|
-
static validate(identifier, value, comparisonValue) {
|
|
3
|
-
if (!this.evaluations[identifier]) {
|
|
4
|
-
throw new Error(`Evaluation identifier "${identifier}" not recognized.`);
|
|
5
|
-
}
|
|
6
|
-
const result = this.evaluations[identifier](value, comparisonValue);
|
|
7
|
-
return result;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Evalúa un arreglo de valores para ver si alguno cumple con la condición especificada.
|
|
11
|
-
* Retorna true si al menos uno de los valores cumple con la condición.
|
|
12
|
-
*/
|
|
13
|
-
static validateAny(identifier, values, comparisonValue) {
|
|
14
|
-
if (!this.evaluations[identifier]) {
|
|
15
|
-
throw new Error(`Evaluation identifier "${identifier}" not recognized.`);
|
|
16
|
-
}
|
|
17
|
-
return values.some(value => this.evaluations[identifier](value, comparisonValue));
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Evalúa un arreglo de valores para ver si todos cumplen con la condición especificada.
|
|
21
|
-
* Retorna true solo si todos los valores cumplen con la condición.
|
|
22
|
-
*/
|
|
23
|
-
static validateAll(identifier, values, comparisonValue) {
|
|
24
|
-
if (!this.evaluations[identifier]) {
|
|
25
|
-
throw new Error(`Evaluation identifier "${identifier}" not recognized.`);
|
|
26
|
-
}
|
|
27
|
-
return values.every(value => this.evaluations[identifier](value, comparisonValue));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
EvaluationsManager.evaluations = {
|
|
31
|
-
equal: (value, comparisonValue) => value == comparisonValue,
|
|
32
|
-
lower: (value, comparisonValue) => Number(value) < Number(comparisonValue),
|
|
33
|
-
upper: (value, comparisonValue) => Number(value) > Number(comparisonValue),
|
|
34
|
-
between: (value, [min, max]) => {
|
|
35
|
-
const numValue = Number(value);
|
|
36
|
-
return numValue >= Number(min) && numValue <= Number(max);
|
|
37
|
-
},
|
|
38
|
-
different: (value, comparisonValue) => value != comparisonValue,
|
|
39
|
-
hasValue: value => ![undefined, null, '', false].includes(value),
|
|
40
|
-
empty: value => [undefined, null, '',].includes(value),
|
|
41
|
-
lessOrEqual: (value, comparisonValue) => Number(value) <= Number(comparisonValue),
|
|
42
|
-
greaterOrEqual: (value, comparisonValue) => Number(value) >= Number(comparisonValue),
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=evaluations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evaluations.js","sourceRoot":"","sources":["../../../src/formulas/helpers/evaluations.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,kBAAkB;IAgB9B,MAAM,CAAC,QAAQ,CAAC,UAAkB,EAAE,KAAU,EAAE,eAAqB;QACpE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,0BAA0B,UAAU,mBAAmB,CAAC,CAAC;QAC1E,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;QACpE,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;KAGI;IACJ,MAAM,CAAC,WAAW,CAAC,UAAkB,EAAE,MAAa,EAAE,eAAqB;QAC1E,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,0BAA0B,UAAU,mBAAmB,CAAC,CAAC;QAC1E,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC;IACnF,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,UAAkB,EAAE,MAAa,EAAE,eAAqB;QAC1E,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,0BAA0B,UAAU,mBAAmB,CAAC,CAAC;QAC1E,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC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
1
|
-
{"version":3,"file":"formula.d.ts","sourceRoot":"","sources":["../../../src/formulas/helpers/formula.ts"],"names":[],"mappings":"AAUA,qBAAa,OAAO;;gBAIP,IAAI,KAAA;IAUhB,UAAU;CACV"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _Formula_lexer, _Formula_parsers, _Formula_tokens;
|
|
7
|
-
import { Lexer } from './lexer';
|
|
8
|
-
import { Parser } from './parser';
|
|
9
|
-
export class Formula {
|
|
10
|
-
constructor(data) {
|
|
11
|
-
_Formula_lexer.set(this, new Lexer());
|
|
12
|
-
_Formula_parsers.set(this, new Map());
|
|
13
|
-
_Formula_tokens.set(this, void 0);
|
|
14
|
-
if (!data.formula)
|
|
15
|
-
throw new Error('To get a parser you must provide a formula');
|
|
16
|
-
// if (this.#parsers.has(data.formula)) return this.#parsers.get(data.formula);
|
|
17
|
-
const tokens = __classPrivateFieldGet(this, _Formula_lexer, "f").tokenize(data.formula);
|
|
18
|
-
const parser = new Parser(tokens);
|
|
19
|
-
const result = { tokens, parser, ...data };
|
|
20
|
-
__classPrivateFieldGet(this, _Formula_parsers, "f").set(data.formula, result);
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
initialize() { }
|
|
24
|
-
}
|
|
25
|
-
_Formula_lexer = new WeakMap(), _Formula_parsers = new WeakMap(), _Formula_tokens = new WeakMap();
|
|
26
|
-
//# sourceMappingURL=formula.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formula.js","sourceRoot":"","sources":["../../../src/formulas/helpers/formula.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AASlC,MAAM,OAAO,OAAO;IAInB,YAAY,IAAI;QAHhB,yBAAS,IAAI,KAAK,EAAE,EAAC;QACrB,2BAAoC,IAAI,GAAG,EAAE,EAAC;QAC9C,kCAAiB;QAEhB,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QACjF,+EAA+E;QAC/E,MAAM,MAAM,GAAG,uBAAA,IAAI,sBAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC;QAC3C,uBAAA,IAAI,wBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC;IACf,CAAC;IAED,UAAU,KAAI,CAAC;CACf"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Token } from './token';
|
|
2
|
-
export declare class Lexer {
|
|
3
|
-
private tokenRegex;
|
|
4
|
-
private flattenTokens;
|
|
5
|
-
constructor(flattenTokens?: boolean);
|
|
6
|
-
tokenize(formula: string): Token[];
|
|
7
|
-
private determineTokenType;
|
|
8
|
-
private flatten;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=lexer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lexer.d.ts","sourceRoot":"","sources":["../../../src/formulas/helpers/lexer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,qBAAa,KAAK;IACjB,OAAO,CAAC,UAAU,CAA4E;IAC9F,OAAO,CAAC,aAAa,CAAU;gBAEnB,aAAa,GAAE,OAAe;IAI1C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE;IA8ClC,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,OAAO;CAWf"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Token } from './token';
|
|
2
|
-
export class Lexer {
|
|
3
|
-
constructor(flattenTokens = false) {
|
|
4
|
-
this.tokenRegex = /\s*(\(|\)|\+|\-|\*|\/|\d+\.\d+|\d+|[A-Za-z_][A-Za-z0-9_]*)\s*/g;
|
|
5
|
-
this.flattenTokens = flattenTokens;
|
|
6
|
-
}
|
|
7
|
-
tokenize(formula) {
|
|
8
|
-
this.tokenRegex.lastIndex = 0;
|
|
9
|
-
const tokens = [];
|
|
10
|
-
const stack = [tokens]; // Stack to manage nested token lists
|
|
11
|
-
let match;
|
|
12
|
-
while ((match = this.tokenRegex.exec(formula)) !== null) {
|
|
13
|
-
const tokenValue = match[1];
|
|
14
|
-
let tokenType = this.determineTokenType(tokenValue);
|
|
15
|
-
if (tokenType === 'parenthesis') {
|
|
16
|
-
if (tokenValue === '(') {
|
|
17
|
-
if (!this.flattenTokens) {
|
|
18
|
-
// Start a new scope for tokens
|
|
19
|
-
stack.push([]);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
if (!this.flattenTokens) {
|
|
24
|
-
// End the current scope
|
|
25
|
-
const subTokens = stack.pop();
|
|
26
|
-
if (!subTokens) {
|
|
27
|
-
throw new Error('Mismatched parentheses in the formula');
|
|
28
|
-
}
|
|
29
|
-
// Create a parenthesis token with these subtokens as children
|
|
30
|
-
const parentTokens = stack[stack.length - 1];
|
|
31
|
-
parentTokens.push(new Token('parenthesis', '()', null, subTokens));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
// Add this token to the current scope
|
|
37
|
-
stack[stack.length - 1].push(new Token(tokenType, tokenValue));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (stack.length !== 1) {
|
|
41
|
-
throw new Error('Mismatched parentheses in the formula');
|
|
42
|
-
}
|
|
43
|
-
// If flattenTokens is true, flatten all tokens into a single array
|
|
44
|
-
if (this.flattenTokens) {
|
|
45
|
-
return this.flatten(tokens);
|
|
46
|
-
}
|
|
47
|
-
return tokens; // Return the outermost list of tokens
|
|
48
|
-
}
|
|
49
|
-
determineTokenType(value) {
|
|
50
|
-
const operators = {
|
|
51
|
-
'+': 'operator',
|
|
52
|
-
'-': 'operator',
|
|
53
|
-
'*': 'operator',
|
|
54
|
-
'/': 'operator',
|
|
55
|
-
'(': 'parenthesis',
|
|
56
|
-
')': 'parenthesis',
|
|
57
|
-
};
|
|
58
|
-
return operators[value] || (!isNaN(parseFloat(value)) ? 'number' : 'variable');
|
|
59
|
-
}
|
|
60
|
-
flatten(tokens) {
|
|
61
|
-
const flatList = [];
|
|
62
|
-
for (const token of tokens) {
|
|
63
|
-
if (token.type === 'parenthesis' && token.children) {
|
|
64
|
-
flatList.push(...this.flatten(token.children)); // Flatten nested tokens
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
flatList.push(token);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return flatList;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=lexer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lexer.js","sourceRoot":"","sources":["../../../src/formulas/helpers/lexer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,MAAM,OAAO,KAAK;IAIjB,YAAY,gBAAyB,KAAK;QAHlC,eAAU,GAAW,gEAAgE,CAAC;QAI7F,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACpC,CAAC;IAED,QAAQ,CAAC,OAAe;QACv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
/**
|
|
3
|
-
* The Parser class is responsible for parsing a sequence of tokens into an abstract syntax tree (AST).
|
|
4
|
-
* The tokens should be an array of objects with `type` and `value` properties.
|
|
5
|
-
*
|
|
6
|
-
* The Parser handles mathematical expressions and ensures that the tokens are in the correct order
|
|
7
|
-
* for later evaluation. It understands variables, numbers, and parentheses, and is extendable to support
|
|
8
|
-
* additional operations and precedence rules.
|
|
9
|
-
*
|
|
10
|
-
* Example usage:
|
|
11
|
-
* ```
|
|
12
|
-
* const tokens: Token[] = [...];
|
|
13
|
-
* const parser = new Parser(tokens);
|
|
14
|
-
* const ast = parser.parse();
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare class Parser {
|
|
18
|
-
private tokens;
|
|
19
|
-
private currentTokenIndex;
|
|
20
|
-
constructor(tokens: Token[]);
|
|
21
|
-
parse(): Token | undefined;
|
|
22
|
-
private parseExpression;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/formulas/helpers/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIhC;;;;;;;;;;;;;;GAcG;AACH,qBAAa,MAAM;IAClB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,iBAAiB,CAAS;gBAEtB,MAAM,EAAE,KAAK,EAAE;IAKpB,KAAK,IAAI,KAAK,GAAG,SAAS;IAIjC,OAAO,CAAC,eAAe;CAqBvB"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Parser class is responsible for parsing a sequence of tokens into an abstract syntax tree (AST).
|
|
3
|
-
* The tokens should be an array of objects with `type` and `value` properties.
|
|
4
|
-
*
|
|
5
|
-
* The Parser handles mathematical expressions and ensures that the tokens are in the correct order
|
|
6
|
-
* for later evaluation. It understands variables, numbers, and parentheses, and is extendable to support
|
|
7
|
-
* additional operations and precedence rules.
|
|
8
|
-
*
|
|
9
|
-
* Example usage:
|
|
10
|
-
* ```
|
|
11
|
-
* const tokens: Token[] = [...];
|
|
12
|
-
* const parser = new Parser(tokens);
|
|
13
|
-
* const ast = parser.parse();
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export class Parser {
|
|
17
|
-
constructor(tokens) {
|
|
18
|
-
this.tokens = tokens;
|
|
19
|
-
this.currentTokenIndex = 0;
|
|
20
|
-
}
|
|
21
|
-
parse() {
|
|
22
|
-
return this.parseExpression();
|
|
23
|
-
}
|
|
24
|
-
parseExpression() {
|
|
25
|
-
let token = this.tokens[this.currentTokenIndex];
|
|
26
|
-
if (token && token.type === 'variable') {
|
|
27
|
-
this.currentTokenIndex++;
|
|
28
|
-
return token;
|
|
29
|
-
}
|
|
30
|
-
else if (token && token.type === 'number') {
|
|
31
|
-
this.currentTokenIndex++;
|
|
32
|
-
return token;
|
|
33
|
-
}
|
|
34
|
-
else if (token && token.value === '(') {
|
|
35
|
-
this.currentTokenIndex++; // Skip '('
|
|
36
|
-
let expr = this.parseExpression(); // Parse subexpression
|
|
37
|
-
if (this.tokens[this.currentTokenIndex] && this.tokens[this.currentTokenIndex].value === ')') {
|
|
38
|
-
this.currentTokenIndex++; // Skip ')'
|
|
39
|
-
return expr;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
// TODO: Add cases for parsing different operations (like addition, multiplication etc.)
|
|
43
|
-
// TODO: Implement precedence handling for different operations
|
|
44
|
-
// This function should be extended to fully construct the AST.
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/formulas/helpers/parser.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,MAAM;IAIlB,YAAY,MAAe;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;IAC5B,CAAC;IAEM,KAAK;QACX,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;IAC/B,CAAC;IAEO,eAAe;QACtB,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAChD,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACxC,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC;QACd,CAAC;aAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7C,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC;QACd,CAAC;aAAM,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;YACzC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,WAAW;YACrC,IAAI,IAAI,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,sBAAsB;YACzD,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;gBAC9F,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,WAAW;gBACrC,OAAO,IAAI,CAAC;YACb,CAAC;QACF,CAAC;QACD,wFAAwF;QACxF,+DAA+D;QAC/D,+DAA+D;QAC/D,OAAO,SAAS,CAAC;IAClB,CAAC;CACD"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TokenType } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* The Token class now includes a stringValue property for storing the original string value
|
|
4
|
-
* of the expression inside the parentheses and an optional parent property for storing the parent token.
|
|
5
|
-
*/
|
|
6
|
-
export declare class Token {
|
|
7
|
-
type: TokenType;
|
|
8
|
-
value: string;
|
|
9
|
-
stringValue?: string;
|
|
10
|
-
children?: Token[];
|
|
11
|
-
parent?: Token;
|
|
12
|
-
constructor(type: TokenType, value: string, stringValue?: string, children?: Token[], parent?: Token);
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=token.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/formulas/helpers/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;;GAGG;AACH,qBAAa,KAAK;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,KAAK,CAAC;gBAEH,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,EAAE,KAAK;CAOpG"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Token class now includes a stringValue property for storing the original string value
|
|
3
|
-
* of the expression inside the parentheses and an optional parent property for storing the parent token.
|
|
4
|
-
*/
|
|
5
|
-
export class Token {
|
|
6
|
-
constructor(type, value, stringValue, children, parent) {
|
|
7
|
-
this.type = type;
|
|
8
|
-
this.value = value;
|
|
9
|
-
this.stringValue = stringValue;
|
|
10
|
-
this.children = children;
|
|
11
|
-
this.parent = parent;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=token.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/formulas/helpers/token.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,KAAK;IAOjB,YAAY,IAAe,EAAE,KAAa,EAAE,WAAoB,EAAE,QAAkB,EAAE,MAAc;QACnG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;CACD"}
|