From 2a71ecf1737560436267dac45dbb0d237a57ef12 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Fri, 13 Dec 2024 15:34:26 +0200 Subject: [PATCH 1/5] Fixes and preparation for subject field --- .../field-adapters/custom-vocabularies.ts | 2 +- package-lock.json | 195 +++++++++++++++--- package.json | 2 +- 3 files changed, 166 insertions(+), 33 deletions(-) diff --git a/client/components/planning-editor-standalone/field-adapters/custom-vocabularies.ts b/client/components/planning-editor-standalone/field-adapters/custom-vocabularies.ts index e9e3f41c9..dd1a3f65a 100644 --- a/client/components/planning-editor-standalone/field-adapters/custom-vocabularies.ts +++ b/client/components/planning-editor-standalone/field-adapters/custom-vocabularies.ts @@ -1,7 +1,7 @@ import {IDropdownConfigVocabulary, IAuthoringFieldV2, ISubject, IVocabularyItem} from 'superdesk-api'; import {superdeskApi} from '../../../superdeskApi'; -import {IFieldDefinition} from '../profile'; import {getPlanningProfileFields} from '../profile-fields'; +import {IFieldDefinition} from '../field-definitions/interfaces'; export const getCustomVocabularyFields = () => { const customVocabularyIds = getPlanningProfileFields() diff --git a/package-lock.json b/package-lock.json index 8840dc9d2..d53310fa0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,12 +28,12 @@ "dev": true }, "@babel/parser": { - "version": "7.26.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.2.tgz", - "integrity": "sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ==", + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.3.tgz", + "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", "dev": true, "requires": { - "@babel/types": "^7.26.0" + "@babel/types": "^7.26.3" } }, "@babel/runtime": { @@ -45,9 +45,9 @@ } }, "@babel/types": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.0.tgz", - "integrity": "sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==", + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.3.tgz", + "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", "dev": true, "requires": { "@babel/helper-string-parser": "^7.25.9", @@ -327,9 +327,9 @@ } }, "@types/hoist-non-react-statics": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz", - "integrity": "sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==", + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.6.tgz", + "integrity": "sha512-lPByRJUer/iN/xa4qpyL0qmL11DqNW81iU/IG1S3uvRUq4oKagz8VCxZjiWkumgt66YT3vOdDgZ0o32sGKtCEw==", "dev": true, "requires": { "@types/react": "*", @@ -1676,6 +1676,72 @@ "set-function-length": "^1.2.1" } }, + "call-bind-apply-helpers": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz", + "integrity": "sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + } + }, + "call-bound": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.2.tgz", + "integrity": "sha512-0lk0PHFe/uz0vl527fG9CgdE9WdafjDbCXvBbs+LUv000TVt2Jjhqbs4Jwm8gz070w8xXyEAxrPOMullsxXeGg==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "get-intrinsic": "^1.2.5" + }, + "dependencies": { + "call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "dev": true, + "requires": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + } + }, + "get-intrinsic": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.6.tgz", + "integrity": "sha512-qxsEs+9A+u85HhllWJJFicJfPDhRmjzoYdl64aMWW9yRIJmSyxdn8IEkuIM530/7T+lv0TIHd8L6Q/ra0tEoeA==", + "dev": true, + "requires": { + "call-bind-apply-helpers": "^1.0.1", + "dunder-proto": "^1.0.0", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "function-bind": "^1.1.2", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.0.0" + }, + "dependencies": { + "es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true + } + } + }, + "gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true + } + } + }, "caller-path": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", @@ -1738,9 +1804,9 @@ } }, "caniuse-db": { - "version": "1.0.30001686", - "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30001686.tgz", - "integrity": "sha512-VX6tiau7gOLrAGyqiyvH4pI+vI5AH3ETvyBhj6DJmhsXGXWBiYSfBD6vJEKR5tNKLVaLoia6ZmZuVFsp6ahfkw==", + "version": "1.0.30001688", + "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30001688.tgz", + "integrity": "sha512-A/Iczixdj5egZW0TNw9DYS/sqKvKDLAbLEZa5wadHzQy2q0DtCIdB7d4PAeKluWbwmE+f5orWbduaTMYcMQCag==", "dev": true }, "caseless": { @@ -3143,6 +3209,25 @@ "integrity": "sha512-xE81Y+z/muC5D5z9qWmKfxEW1XyXfsBzSbSBk2JRsoD0yzMGGHQm/0MtuqHl/EUDkaBJJLjJ2EACycoDMY/OOg==", "dev": true }, + "dunder-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.0.tgz", + "integrity": "sha512-9+Sj30DIu+4KvHqMfLUGLFYL2PkURSYMVXJyXe92nFRvlYq5hBjLEhblKB+vkd/WVlUYMWigiY07T91Fkk0+4A==", + "dev": true, + "requires": { + "call-bind-apply-helpers": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "dependencies": { + "gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true + } + } + }, "each-async": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/each-async/-/each-async-0.1.3.tgz", @@ -3194,9 +3279,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.5.68", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.68.tgz", - "integrity": "sha512-FgMdJlma0OzUYlbrtZ4AeXjKxKPk6KT8WOP8BjcqxWtlg8qyJQjRzPJzUtUn5GBg1oQ26hFs7HOOHJMYiJRnvQ==", + "version": "1.5.73", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.73.tgz", + "integrity": "sha512-8wGNxG9tAG5KhGd3eeA0o6ixhiNdgr0DcHWm85XPCphwZgD1lIEoi6t3VERayWao7SF7AAZTw6oARGJeVjH8Kg==", "dev": true }, "elliptic": { @@ -4060,9 +4145,9 @@ } }, "express": { - "version": "4.21.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.1.tgz", - "integrity": "sha512-YSFlK1Ee0/GC8QaO91tHcDxJiE/X4FbpAyQWkxAvG6AXCuR65YzK8ua6D9hvi/TzUfZMpc+BwuM1IPw8fmQBiQ==", + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", "dev": true, "requires": { "accepts": "~1.3.8", @@ -4084,7 +4169,7 @@ "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.10", + "path-to-regexp": "0.1.12", "proxy-addr": "~2.0.7", "qs": "6.13.0", "range-parser": "~1.2.1", @@ -4132,9 +4217,9 @@ } }, "path-to-regexp": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", - "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==", + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", "dev": true }, "safe-buffer": { @@ -6340,13 +6425,13 @@ } }, "is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz", + "integrity": "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==", "dev": true, "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" } }, "is-array-buffer": { @@ -7597,6 +7682,12 @@ "integrity": "sha512-4vRUvPyxdO8cWULGTh9dZWL2tZK6LDBvj+OGHBER7poH9Qdt7kXEoj20wiz4lQUbUXQZFjPbe5mVDo9nutizCw==", "dev": true }, + "math-intrinsics": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.0.0.tgz", + "integrity": "sha512-4MqMiKP90ybymYvsut0CH2g4XWbfLtmlCkXmtmdcDCxNB+mQcu1w/1+L/VD7vi/PSv7X2JYV7SCcR+jiPXnQtA==", + "dev": true + }, "math-random": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", @@ -12185,8 +12276,8 @@ } }, "superdesk-core": { - "version": "github:superdesk/superdesk-client-core#ab27e6ba44389ef0a72e2c1302dfe648c2935318", - "from": "github:superdesk/superdesk-client-core#develop", + "version": "github:thecalcc/superdesk-client-core#215f57f8e3b4bea67bdbf18b05c47fd726570b80", + "from": "github:thecalcc/superdesk-client-core#rework-dropdown-fields", "dev": true, "requires": { "@metadata/exif": "github:superdesk/exif#431066d", @@ -12283,7 +12374,7 @@ "sass-loader": "6.0.6", "shortid": "2.2.8", "style-loader": "0.20.2", - "superdesk-ui-framework": "^4.0.3", + "superdesk-ui-framework": "4.0.3", "ts-loader": "3.5.0", "typescript": "4.9.5", "uuid": "8.3.1", @@ -12368,6 +12459,48 @@ "invariant": "^2.2.4", "prop-types": "^15.5.7" } + }, + "superdesk-ui-framework": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/superdesk-ui-framework/-/superdesk-ui-framework-4.0.3.tgz", + "integrity": "sha512-LUNR1u3sK4Ayiq74hXZ5fqp7k9OK/MJogsEXJfeaJQyBWzRdbzwyYjljIXh7gJJExtDEBokLxU33IpjuXuITJA==", + "dev": true, + "requires": { + "@popperjs/core": "^2.4.0", + "@superdesk/common": "0.0.28", + "@superdesk/primereact": "^5.0.2-12", + "@superdesk/react-resizable-panels": "0.0.39", + "chart.js": "^2.9.3", + "date-fns": "2.7.0", + "popper-max-size-modifier": "^0.2.0", + "popper.js": "1.14.4", + "primeicons": "2.0.0", + "react-beautiful-dnd": "^13.0.0", + "react-id-generator": "^3.0.0", + "react-scrollspy": "^3.4.3" + }, + "dependencies": { + "@superdesk/common": { + "version": "0.0.28", + "resolved": "https://registry.npmjs.org/@superdesk/common/-/common-0.0.28.tgz", + "integrity": "sha512-EhsYMm340r3FVrakH00lLvQbxVYYTzL61J5GXI3BI2xLN2dPI3N0AJEaMGqjbt0xUpUFxE3T08OtYvIC5koZvg==", + "dev": true, + "requires": { + "date-fns": "2.7.0", + "lodash": "4.17.19", + "primereact": "^6.0.2", + "react": "16.9.0", + "react-dom": "16.9.0", + "react-sortable-hoc": "^1.11.0" + } + }, + "date-fns": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.7.0.tgz", + "integrity": "sha512-wxYp2PGoUDN5ZEACc61aOtYFvSsJUylIvCjpjDOqM1UDaKIIuMJ9fAnMYFHV3TQaDpfTVxhwNK/GiCaHKuemTA==", + "dev": true + } + } } } }, diff --git a/package.json b/package.json index 5d01bae12..b2fc4903f 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "simulant": "^0.2.2", "sinon": "^4.5.0", "superdesk-code-style": "1.5.0", - "superdesk-core": "github:superdesk/superdesk-client-core#develop", + "superdesk-core": "github:thecalcc/superdesk-client-core#rework-dropdown-fields", "superdesk-ui-framework": "^4.0.5", "ts-node": "~7.0.1", "tslint": "5.11.0", From e9761ca96eb6011006b99d53d194fcb7fa68a76c Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Fri, 13 Dec 2024 15:34:39 +0200 Subject: [PATCH 2/5] subject field implementation --- .../field-definitions/index.ts | 2 + .../field-definitions/subject.ts | 63 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 client/components/planning-editor-standalone/field-definitions/subject.ts diff --git a/client/components/planning-editor-standalone/field-definitions/index.ts b/client/components/planning-editor-standalone/field-definitions/index.ts index b71d36fe6..60b13581c 100644 --- a/client/components/planning-editor-standalone/field-definitions/index.ts +++ b/client/components/planning-editor-standalone/field-definitions/index.ts @@ -12,6 +12,7 @@ import {IFieldDefinitions, IFieldDefinition} from './interfaces'; import {getTextFieldConfig} from './text-field-config'; import {getPlaceField} from './place-field'; import {getAgendasField} from './agendas-field'; +import {getSubjectField} from './subject'; export function getFieldDefinitions(): IFieldDefinitions { const {gettext} = superdeskApi.localization; @@ -66,6 +67,7 @@ export function getFieldDefinitions(): IFieldDefinitions { }, getPlaceField(), getAgendasField(), + getSubjectField(), { fieldId: 'coverages', getField: ({id, required}) => { diff --git a/client/components/planning-editor-standalone/field-definitions/subject.ts b/client/components/planning-editor-standalone/field-definitions/subject.ts new file mode 100644 index 000000000..6281ab72f --- /dev/null +++ b/client/components/planning-editor-standalone/field-definitions/subject.ts @@ -0,0 +1,63 @@ +import { + IAuthoringFieldV2, + ISubjectCode, + IDropdownConfigManualSource, +} from 'superdesk-api'; +import {gettext} from 'core/utils'; +import {IFieldDefinition} from './interfaces'; +import {planningApi} from '../../../superdeskApi'; + +export function getSubjectField(): IFieldDefinition { + return { + fieldId: 'subject', + getField: ({id, required}) => { + const fieldConfig: IDropdownConfigManualSource = { + source: 'manual-entry', + options: (planningApi.redux.store.getState().subjects ?? []) + .map((x) => ({id: x.qcode, label: x.name, parent: x.parent})), + roundCorners: true, + type: 'text', + canSelectBranchWithChildren: true, + multiple: true, + required: required, + }; + + const fieldV2: IAuthoringFieldV2 = { + id: 'subject', + name: gettext('Subject'), + fieldType: 'dropdown', + fieldConfig: fieldConfig, + }; + + return fieldV2; + }, + storageAdapter: { + retrieveStoredValue: (item) => { + return (item.subject ?? []).map(({qcode}) => qcode); + }, + storeValue: (item, operationalValue: Array) => { + interface IStorageFormat { + qcode: string; + name: string; + parent?: string; + } + + const allSubjects: Array = (planningApi.redux.store.getState().subjects ?? []) + .filter((x) => operationalValue.includes(x.qcode)); + + return { + ...item, + subject: allSubjects.map(({qcode, name, parent}) => { + var itemToStore: IStorageFormat = {qcode, name, parent}; + + if (parent != null) { + itemToStore.parent = parent; + } + + return itemToStore; + }), + }; + }, + } + }; +} From 0a67e766ba8c6a3426feac8462e1c798323177b0 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 18 Dec 2024 13:14:49 +0200 Subject: [PATCH 3/5] Fix storage value --- .../field-definitions/subject.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/client/components/planning-editor-standalone/field-definitions/subject.ts b/client/components/planning-editor-standalone/field-definitions/subject.ts index 6281ab72f..4f9762bf4 100644 --- a/client/components/planning-editor-standalone/field-definitions/subject.ts +++ b/client/components/planning-editor-standalone/field-definitions/subject.ts @@ -36,26 +36,12 @@ export function getSubjectField(): IFieldDefinition { return (item.subject ?? []).map(({qcode}) => qcode); }, storeValue: (item, operationalValue: Array) => { - interface IStorageFormat { - qcode: string; - name: string; - parent?: string; - } - const allSubjects: Array = (planningApi.redux.store.getState().subjects ?? []) .filter((x) => operationalValue.includes(x.qcode)); return { ...item, - subject: allSubjects.map(({qcode, name, parent}) => { - var itemToStore: IStorageFormat = {qcode, name, parent}; - - if (parent != null) { - itemToStore.parent = parent; - } - - return itemToStore; - }), + subject: allSubjects, }; }, } From 0bd1b13ab0c62db040f73bf3c32012e883d03c7f Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 18 Dec 2024 13:39:51 +0200 Subject: [PATCH 4/5] Fix naming --- .../planning-editor-standalone/field-definitions/subject.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/components/planning-editor-standalone/field-definitions/subject.ts b/client/components/planning-editor-standalone/field-definitions/subject.ts index 4f9762bf4..c073b50fc 100644 --- a/client/components/planning-editor-standalone/field-definitions/subject.ts +++ b/client/components/planning-editor-standalone/field-definitions/subject.ts @@ -36,12 +36,12 @@ export function getSubjectField(): IFieldDefinition { return (item.subject ?? []).map(({qcode}) => qcode); }, storeValue: (item, operationalValue: Array) => { - const allSubjects: Array = (planningApi.redux.store.getState().subjects ?? []) + const filteredSubjects: Array = (planningApi.redux.store.getState().subjects ?? []) .filter((x) => operationalValue.includes(x.qcode)); return { ...item, - subject: allSubjects, + subject: filteredSubjects, }; }, } From 5b21cf87c75b970ddfd5bdab8b6b0fea363a3ec6 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 18 Dec 2024 13:49:13 +0200 Subject: [PATCH 5/5] Improve name --- .../planning-editor-standalone/field-definitions/subject.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/components/planning-editor-standalone/field-definitions/subject.ts b/client/components/planning-editor-standalone/field-definitions/subject.ts index c073b50fc..776c7069e 100644 --- a/client/components/planning-editor-standalone/field-definitions/subject.ts +++ b/client/components/planning-editor-standalone/field-definitions/subject.ts @@ -36,12 +36,12 @@ export function getSubjectField(): IFieldDefinition { return (item.subject ?? []).map(({qcode}) => qcode); }, storeValue: (item, operationalValue: Array) => { - const filteredSubjects: Array = (planningApi.redux.store.getState().subjects ?? []) + const subjectsFull: Array = (planningApi.redux.store.getState().subjects ?? []) .filter((x) => operationalValue.includes(x.qcode)); return { ...item, - subject: filteredSubjects, + subject: subjectsFull, }; }, }