@inseefr/lunatic 2.7.3 → 2.7.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/lib/components/commons/components/combo-box/combo-box.stories.js +0 -3
- package/lib/components/commons/components/md-label/link.js +39 -34
- package/lib/components/commons/components/md-label/md-label.js +2 -2
- package/lib/components/commons/components/md-label/md-label.spec.js +71 -0
- package/lib/components/commons/components/md-label/router-link.js +29 -0
- package/lib/components/commons/components/variable-status/variable-status.js +2 -2
- package/lib/components/datepicker/html/DatepickerField.js +1 -1
- package/lib/components/datepicker/html/__snapshots__/datepicker.spec.tsx.snap +3 -0
- package/lib/components/datepicker/html/datepicker.js +7 -6
- package/lib/components/datepicker/html/datepicker.spec.js +2 -2
- package/lib/components/datepicker/lunatic-datepicker.js +4 -4
- package/lib/components/index.scss +19 -1
- package/lib/hooks/use-auto-focus.js +1 -1
- package/lib/src/components/commons/components/md-label/router-link.d.ts +6 -0
- package/lib/src/components/datepicker/html/datepicker.d.ts +1 -1
- package/lib/src/components/datepicker/lunatic-datepicker.d.ts +1 -1
- package/lib/src/components/type.d.ts +1 -1
- package/lib/src/use-lunatic/commons/variables/lunatic-variables-store.d.ts +1 -0
- package/lib/src/use-lunatic/hooks/use-page-has-response.d.ts +6 -0
- package/lib/src/use-lunatic/use-lunatic.d.ts +3 -2
- package/lib/src/utils/suggester-workers/searching/meloto-order.d.ts +2 -1
- package/lib/stories/date-picker/datepicker.stories.js +4 -4
- package/lib/stories/markdown/markdown.stories.js +32 -0
- package/lib/stories/markdown/source.json +40 -0
- package/lib/stories/suggester/suggester-workers.stories.js +36 -1
- package/lib/stories/utils/orchestrator.js +89 -49
- package/lib/stories/utils/orchestrator.scss +49 -0
- package/lib/stories/utils/referentiel.js +8 -4
- package/lib/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js +14 -9
- package/lib/use-lunatic/commons/variables/get-questionnaire-data.js +6 -1
- package/lib/use-lunatic/commons/variables/lunatic-variables-store.js +33 -9
- package/lib/use-lunatic/commons/variables/lunatic-variables-store.spec.js +44 -0
- package/lib/use-lunatic/hooks/use-page-has-response.js +87 -0
- package/lib/use-lunatic/reducer/reduce-on-init.js +1 -1
- package/lib/use-lunatic/use-lunatic.js +3 -1
- package/lib/utils/env.js +1 -1
- package/lib/utils/suggester-workers/searching/meloto-order.js +6 -5
- package/package.json +2 -2
- package/workers-release/lunatic-search-worker-0.3.0.js +1 -1
package/lib/utils/env.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.isTestEnv = isTestEnv;
|
|
|
7
7
|
function isTestEnv() {
|
|
8
8
|
try {
|
|
9
9
|
// using vitest, process.env is defined
|
|
10
|
-
return
|
|
10
|
+
return "".concat(process.env.VITEST) === 'true';
|
|
11
11
|
} catch (e) {
|
|
12
12
|
// process.env is not defined
|
|
13
13
|
// so we are not running as test so we can return false
|
|
@@ -8,16 +8,17 @@ exports.value = value;
|
|
|
8
8
|
var _prepareStringIndexation = _interopRequireDefault(require("../commons-tokenizer/prepare-string-indexation"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
10
|
function value(entity) {
|
|
11
|
+
var _suggestion$label;
|
|
11
12
|
var tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
12
13
|
var suggestion = entity.suggestion;
|
|
13
|
-
var label = suggestion.label;
|
|
14
|
-
var prepared = (0, _prepareStringIndexation["default"])(
|
|
15
|
-
if (
|
|
14
|
+
var used = (_suggestion$label = suggestion.label) !== null && _suggestion$label !== void 0 ? _suggestion$label : suggestion.id;
|
|
15
|
+
var prepared = (0, _prepareStringIndexation["default"])(used);
|
|
16
|
+
if (used && used.length) {
|
|
16
17
|
return tokens.reduce(function (score, token, i) {
|
|
17
18
|
var index = prepared.search(token);
|
|
18
19
|
if (index >= 0) {
|
|
19
|
-
var how =
|
|
20
|
-
how /=
|
|
20
|
+
var how = used.length - index;
|
|
21
|
+
how /= used.length;
|
|
21
22
|
var weight = tokens.length - i;
|
|
22
23
|
weight /= tokens.length;
|
|
23
24
|
return score + how * weight;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inseefr/lunatic",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.5",
|
|
4
4
|
"workersVersion": "0.3.0",
|
|
5
5
|
"description": "Library of questionnaire components",
|
|
6
6
|
"repository": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"react-keyboard-event-handler": "^1.5.4",
|
|
84
84
|
"react-markdown": "^8.0.3",
|
|
85
85
|
"react-number-format": "^5.1.3",
|
|
86
|
-
"react-tooltip": "^
|
|
86
|
+
"react-tooltip": "^5.23.0",
|
|
87
87
|
"remove-accents": "^0.4.2",
|
|
88
88
|
"sass": "^1.58.3",
|
|
89
89
|
"snowball": "^0.3.1",
|