@crystaldesign/diva-backoffice 26.5.0-beta.27 → 26.5.0-beta.29

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.
@@ -44881,6 +44881,8 @@ function ActionsForm(_ref) {
44881
44881
  var _Form$useForm = Form$2.useForm(),
44882
44882
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
44883
44883
  form = _Form$useForm2[0];
44884
+ var watchedActionType = Form$2.useWatch('actionType', form);
44885
+ var watchedFeatureNo = Form$2.useWatch('featureNo', form);
44884
44886
  var _useTranslation = useTranslation(),
44885
44887
  t = _useTranslation.t,
44886
44888
  i18n = _useTranslation.i18n;
@@ -44919,11 +44921,23 @@ function ActionsForm(_ref) {
44919
44921
  read: "".concat(idmService, "/catalogs/").concat(catalogId, "/decisions")
44920
44922
  };
44921
44923
  }, [catalogId, idmService]);
44922
- var optionsRead = useMemo(function () {
44924
+ var optionsBaseRead = useMemo(function () {
44923
44925
  return {
44924
44926
  read: "".concat(idmService, "/catalogs/").concat(catalogId, "/options")
44925
44927
  };
44926
44928
  }, [catalogId, idmService]);
44929
+
44930
+ /** When editing SET_FEATURE*, limit option reference choices to options of the selected target feature. */
44931
+ var optionsReadForOptionRef = useMemo(function () {
44932
+ var setFeature = watchedActionType === null || watchedActionType === void 0 ? void 0 : watchedActionType.startsWith('SET_FEATURE');
44933
+ var featureNo = setFeature ? toLookupScalar(watchedFeatureNo) : undefined;
44934
+ if (featureNo) {
44935
+ return {
44936
+ read: "".concat(idmService, "/catalogs/").concat(catalogId, "/options?filter=featureNos==").concat(encodeURIComponent(featureNo))
44937
+ };
44938
+ }
44939
+ return optionsBaseRead;
44940
+ }, [catalogId, idmService, optionsBaseRead, watchedActionType, watchedFeatureNo]);
44927
44941
  var allFeaturesRead = useMemo(function () {
44928
44942
  return {
44929
44943
  read: "".concat(idmService, "/catalogs/").concat(catalogId, "/allfeatures")
@@ -44980,6 +44994,11 @@ function ActionsForm(_ref) {
44980
44994
  };
44981
44995
  });
44982
44996
  }, [t]);
44997
+ var optionRefNeedsFeatureHint = useMemo(function () {
44998
+ return t("".concat(ACTIONS_FORM_I18N, ".hint.optionRefNeedsFeature"), {
44999
+ defaultValue: 'Select a feature first. Options are filtered by the chosen feature.'
45000
+ });
45001
+ }, [t]);
44983
45002
  var referenceTypeChoiceOptions = useMemo(function () {
44984
45003
  return Object.entries(REFERENCE_TYPES).map(function (_ref4) {
44985
45004
  var _ref5 = _slicedToArray(_ref4, 2),
@@ -45152,6 +45171,14 @@ function ActionsForm(_ref) {
45152
45171
  value: undefined
45153
45172
  }]);
45154
45173
  }
45174
+ } else if (fieldName === 'featureNo') {
45175
+ var at = form.getFieldValue('actionType');
45176
+ if (at !== null && at !== void 0 && at.startsWith('SET_FEATURE')) {
45177
+ form.setFields([{
45178
+ name: 'optionRefNo',
45179
+ value: undefined
45180
+ }]);
45181
+ }
45155
45182
  }
45156
45183
  }, [form]);
45157
45184
  var handleFinish = useCallback(function () {
@@ -45172,6 +45199,7 @@ function ActionsForm(_ref) {
45172
45199
  applySerializeErrors(model, ser.reason);
45173
45200
  }, [applySerializeErrors, form, onSave, t]);
45174
45201
  var renderReferenceField = useCallback(function (refType) {
45202
+ var _toLookupScalar;
45175
45203
  var fieldMap = _defineProperty(_defineProperty(_defineProperty({}, REFERENCE_TYPES.FEATURE_REF, {
45176
45204
  name: 'featureRefNo',
45177
45205
  labelKey: 'featureReference'
@@ -45192,20 +45220,23 @@ function ActionsForm(_ref) {
45192
45220
  children: /*#__PURE__*/jsx(Input$1, {})
45193
45221
  });
45194
45222
  }
45223
+ var optionRefNeedsFeature = refType === REFERENCE_TYPES.OPTION_REF && (watchedActionType === null || watchedActionType === void 0 ? void 0 : watchedActionType.startsWith('SET_FEATURE')) && !toLookupScalar(watchedFeatureNo);
45195
45224
  return /*#__PURE__*/jsx(Form$2.Item, {
45196
45225
  name: field.name,
45197
45226
  label: label,
45198
45227
  rules: requiredRules.select(field.labelKey),
45228
+ extra: optionRefNeedsFeature ? optionRefNeedsFeatureHint : undefined,
45199
45229
  children: /*#__PURE__*/jsx(LookupSelect, {
45200
45230
  mode: "single",
45201
45231
  search: true,
45202
45232
  minWidth: "100%",
45203
- apiInterface: refType === REFERENCE_TYPES.OPTION_REF ? optionsRead : allFeaturesRead,
45233
+ disabled: optionRefNeedsFeature,
45234
+ apiInterface: refType === REFERENCE_TYPES.OPTION_REF ? optionsReadForOptionRef : allFeaturesRead,
45204
45235
  selectMapping: refType === REFERENCE_TYPES.OPTION_REF ? optionSelectMapping : featureSelectMapping,
45205
45236
  useValueAsData: true
45206
- })
45237
+ }, refType === REFERENCE_TYPES.OPTION_REF ? "option-ref-".concat((_toLookupScalar = toLookupScalar(watchedFeatureNo)) !== null && _toLookupScalar !== void 0 ? _toLookupScalar : '') : undefined)
45207
45238
  });
45208
- }, [allFeaturesRead, fieldLabel, optionSelectMapping, optionsRead, featureSelectMapping, requiredRules]);
45239
+ }, [allFeaturesRead, fieldLabel, optionRefNeedsFeatureHint, optionSelectMapping, optionsReadForOptionRef, featureSelectMapping, requiredRules, watchedActionType, watchedFeatureNo]);
45209
45240
  var editingLegacySetMessage = (value === null || value === void 0 ? void 0 : value.actionType) === ACTION_TYPES.SET_MESSAGE;
45210
45241
  return /*#__PURE__*/jsxs("div", {
45211
45242
  className: formContainer,
@@ -45293,7 +45324,7 @@ function ActionsForm(_ref) {
45293
45324
  }), /*#__PURE__*/jsx(Form$2.Item, {
45294
45325
  noStyle: true,
45295
45326
  shouldUpdate: function shouldUpdate(prev, curr) {
45296
- return prev.referenceType !== curr.referenceType || prev.actionType !== curr.actionType;
45327
+ return prev.referenceType !== curr.referenceType || prev.actionType !== curr.actionType || prev.featureNo !== curr.featureNo;
45297
45328
  },
45298
45329
  children: function children(_ref7) {
45299
45330
  var getFieldValue = _ref7.getFieldValue;
@@ -1 +1 @@
1
- {"version":3,"file":"ActionsForm.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMCatalogEditor/Tables/OptionCombinations/ActionsForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAK/D,OAAO,EAOL,KAAK,YAAY,EAGlB,MAAM,gBAAgB,CAAC;AA+DxB,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,gBAAgB,qBAsX/F"}
1
+ {"version":3,"file":"ActionsForm.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMCatalogEditor/Tables/OptionCombinations/ActionsForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAK/D,OAAO,EAOL,KAAK,YAAY,EAGlB,MAAM,gBAAgB,CAAC;AA+DxB,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,gBAAgB,qBAib/F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/diva-backoffice",
3
- "version": "26.5.0-beta.27",
3
+ "version": "26.5.0-beta.29",
4
4
  "license": "COMMERCIAL",
5
5
  "devDependencies": {
6
6
  "@testing-library/jest-dom": "^6.5.0",
@@ -15,13 +15,13 @@
15
15
  "dependencies": {
16
16
  "@ant-design/icons": "6.1.0",
17
17
  "@babel/runtime": "7.24.7",
18
- "@crystaldesign/content-box": "26.5.0-beta.27",
19
- "@crystaldesign/content-item": "26.5.0-beta.27",
20
- "@crystaldesign/diva-core": "26.5.0-beta.27",
21
- "@crystaldesign/diva-utils": "26.5.0-beta.27",
22
- "@crystaldesign/media-upload": "26.5.0-beta.27",
23
- "@crystaldesign/rtf-editor": "26.5.0-beta.27",
24
- "@crystaldesign/spreadsheet": "26.5.0-beta.27",
18
+ "@crystaldesign/content-box": "26.5.0-beta.29",
19
+ "@crystaldesign/content-item": "26.5.0-beta.29",
20
+ "@crystaldesign/diva-core": "26.5.0-beta.29",
21
+ "@crystaldesign/diva-utils": "26.5.0-beta.29",
22
+ "@crystaldesign/media-upload": "26.5.0-beta.29",
23
+ "@crystaldesign/rtf-editor": "26.5.0-beta.29",
24
+ "@crystaldesign/spreadsheet": "26.5.0-beta.29",
25
25
  "@google/genai": "^1.22.0",
26
26
  "@google/model-viewer": "3.5.0",
27
27
  "ag-charts-community": "^10.1.0",
@@ -53,5 +53,5 @@
53
53
  },
54
54
  "module": "build/esm/index.js",
55
55
  "types": "./build/types/backoffice/src/index.d.ts",
56
- "gitHead": "02540e516f46d83612178cd26f1bfeb2bf18bb72"
56
+ "gitHead": "766a2ee3de855f09eccf54b4347e44510df86edf"
57
57
  }