bm-admin-ui 1.0.62-alpha → 1.0.63-alpha

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.
@@ -3286,21 +3286,6 @@ var shop = {
3286
3286
  value: rule.config.isMain,
3287
3287
  hidden: !!parentRule,
3288
3288
  inject: true,
3289
- on: {
3290
- change({ api, self }, value) {
3291
- if (value) {
3292
- api.mergeRule(fieldsMap$1['effect.required'], {
3293
- value: true,
3294
- props: { disabled: true },
3295
- });
3296
- }
3297
- else {
3298
- api.mergeRule(fieldsMap$1['effect.required'], {
3299
- props: { disabled: false },
3300
- });
3301
- }
3302
- },
3303
- },
3304
3289
  },
3305
3290
  {
3306
3291
  type: 'switch',
@@ -4036,9 +4021,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4036
4021
  if (!cacheProps[rule.field]) {
4037
4022
  cacheProps[rule.field] = makePropRule(rule, parentRule);
4038
4023
  }
4024
+ flowConditionEffect(props.flowCondition);
4039
4025
  }
4040
4026
  function propChange(field, value) {
4041
4027
  setRulePropValue(field, value, activeRule.value);
4028
+ processShopProps(field, value);
4029
+ }
4030
+ function processShopProps(field, value) {
4031
+ if (activeRule.value?.config?.config.name === "shop") {
4032
+ if (field === "config.isMain") {
4033
+ const shopProps = cacheProps[activeRule.value.field];
4034
+ const requiredRule = shopProps.find(
4035
+ (rule) => rule.field === "effect.required"
4036
+ );
4037
+ if (value) {
4038
+ requiredRule.value = true;
4039
+ }
4040
+ flowConditionEffect(props.flowCondition);
4041
+ }
4042
+ }
4042
4043
  }
4043
4044
  function setRulePropValue(field, value, rule) {
4044
4045
  field.split(".").reduce((pre, cur, index, arr) => {
@@ -4161,48 +4162,53 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4161
4162
  }
4162
4163
  return pass;
4163
4164
  }
4164
- function flowConditionEffect(activeProps2, flowCondition) {
4165
+ function flowConditionEffect(flowCondition) {
4165
4166
  if (activeRule.value.config) {
4166
- const disabled = !!flowCondition[activeRule.value.field];
4167
+ const activeProps2 = cacheProps[activeRule.value.field];
4167
4168
  const ruleName = activeRule.value.config.config.name;
4168
- if (disabled) {
4169
- const requiredRule = activeProps2?.find(
4170
- (rule) => rule.field === "effect.required"
4171
- );
4172
- if (requiredRule) {
4173
- if (!requiredRule.props) {
4174
- requiredRule.props = {};
4175
- }
4176
- requiredRule.props.disabled = true;
4177
- }
4178
- if (["radio", "checkbox"].includes(ruleName)) {
4179
- const optionsRule = activeProps2?.find(
4180
- (rule) => rule.field === "options"
4181
- );
4182
- optionsRule.props.disabled = true;
4183
- }
4184
- if (ruleName === "materialType") {
4185
- const formatRule = activeProps2?.find(
4186
- (rule) => rule.field === "config.format"
4187
- );
4188
- const multipleRule = activeProps2?.find(
4189
- (rule) => rule.field === "props.multiple"
4190
- );
4191
- formatRule.props = {
4192
- disabled: true
4193
- };
4194
- multipleRule.props = {
4195
- disabled: true
4196
- };
4197
- }
4198
- if (["people", "department"].includes(ruleName)) {
4199
- const limitRule = activeProps2?.find(
4200
- (rule) => rule.field === "props.limit"
4201
- );
4202
- limitRule.props = {
4203
- disabled: true
4204
- };
4169
+ let disabled;
4170
+ if (ruleName === "shop") {
4171
+ const isMainValue = activeProps2.find(
4172
+ (rule) => rule.field === "config.isMain"
4173
+ )?.value;
4174
+ disabled = !!flowCondition[activeRule.value.field] || isMainValue;
4175
+ } else {
4176
+ disabled = !!flowCondition[activeRule.value.field];
4177
+ }
4178
+ const requiredRule = activeProps2?.find(
4179
+ (rule) => rule.field === "effect.required"
4180
+ );
4181
+ if (requiredRule) {
4182
+ if (!requiredRule.props) {
4183
+ requiredRule.props = {};
4205
4184
  }
4185
+ requiredRule.props.disabled = disabled;
4186
+ }
4187
+ if (["radio", "checkbox"].includes(ruleName)) {
4188
+ const optionsRule = activeProps2?.find((rule) => rule.field === "options");
4189
+ optionsRule.props.disabled = disabled;
4190
+ }
4191
+ if (ruleName === "materialType") {
4192
+ const formatRule = activeProps2?.find(
4193
+ (rule) => rule.field === "config.format"
4194
+ );
4195
+ const multipleRule = activeProps2?.find(
4196
+ (rule) => rule.field === "props.multiple"
4197
+ );
4198
+ formatRule.props = {
4199
+ disabled
4200
+ };
4201
+ multipleRule.props = {
4202
+ disabled
4203
+ };
4204
+ }
4205
+ if (["people", "department"].includes(ruleName)) {
4206
+ const limitRule = activeProps2?.find(
4207
+ (rule) => rule.field === "props.limit"
4208
+ );
4209
+ limitRule.props = {
4210
+ disabled
4211
+ };
4206
4212
  }
4207
4213
  }
4208
4214
  }
@@ -4222,13 +4228,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4222
4228
  immediate: true
4223
4229
  }
4224
4230
  );
4225
- watch(activeProps, (activeProps2) => {
4226
- flowConditionEffect(activeProps2, props.flowCondition);
4227
- });
4228
4231
  watch(
4229
4232
  () => props.flowCondition,
4230
4233
  (flowCondition) => {
4231
- flowConditionEffect(activeProps.value, flowCondition);
4234
+ flowConditionEffect(flowCondition);
4232
4235
  },
4233
4236
  {
4234
4237
  deep: true
@@ -3296,21 +3296,6 @@ var shop = {
3296
3296
  value: rule.config.isMain,
3297
3297
  hidden: !!parentRule,
3298
3298
  inject: true,
3299
- on: {
3300
- change({ api, self }, value) {
3301
- if (value) {
3302
- api.mergeRule(fieldsMap$1['effect.required'], {
3303
- value: true,
3304
- props: { disabled: true },
3305
- });
3306
- }
3307
- else {
3308
- api.mergeRule(fieldsMap$1['effect.required'], {
3309
- props: { disabled: false },
3310
- });
3311
- }
3312
- },
3313
- },
3314
3299
  },
3315
3300
  {
3316
3301
  type: 'switch',
@@ -4046,9 +4031,25 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4046
4031
  if (!cacheProps[rule.field]) {
4047
4032
  cacheProps[rule.field] = makePropRule(rule, parentRule);
4048
4033
  }
4034
+ flowConditionEffect(props.flowCondition);
4049
4035
  }
4050
4036
  function propChange(field, value) {
4051
4037
  setRulePropValue(field, value, activeRule.value);
4038
+ processShopProps(field, value);
4039
+ }
4040
+ function processShopProps(field, value) {
4041
+ if (activeRule.value?.config?.config.name === "shop") {
4042
+ if (field === "config.isMain") {
4043
+ const shopProps = cacheProps[activeRule.value.field];
4044
+ const requiredRule = shopProps.find(
4045
+ (rule) => rule.field === "effect.required"
4046
+ );
4047
+ if (value) {
4048
+ requiredRule.value = true;
4049
+ }
4050
+ flowConditionEffect(props.flowCondition);
4051
+ }
4052
+ }
4052
4053
  }
4053
4054
  function setRulePropValue(field, value, rule) {
4054
4055
  field.split(".").reduce((pre, cur, index, arr) => {
@@ -4171,48 +4172,53 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4171
4172
  }
4172
4173
  return pass;
4173
4174
  }
4174
- function flowConditionEffect(activeProps2, flowCondition) {
4175
+ function flowConditionEffect(flowCondition) {
4175
4176
  if (activeRule.value.config) {
4176
- const disabled = !!flowCondition[activeRule.value.field];
4177
+ const activeProps2 = cacheProps[activeRule.value.field];
4177
4178
  const ruleName = activeRule.value.config.config.name;
4178
- if (disabled) {
4179
- const requiredRule = activeProps2?.find(
4180
- (rule) => rule.field === "effect.required"
4181
- );
4182
- if (requiredRule) {
4183
- if (!requiredRule.props) {
4184
- requiredRule.props = {};
4185
- }
4186
- requiredRule.props.disabled = true;
4187
- }
4188
- if (["radio", "checkbox"].includes(ruleName)) {
4189
- const optionsRule = activeProps2?.find(
4190
- (rule) => rule.field === "options"
4191
- );
4192
- optionsRule.props.disabled = true;
4193
- }
4194
- if (ruleName === "materialType") {
4195
- const formatRule = activeProps2?.find(
4196
- (rule) => rule.field === "config.format"
4197
- );
4198
- const multipleRule = activeProps2?.find(
4199
- (rule) => rule.field === "props.multiple"
4200
- );
4201
- formatRule.props = {
4202
- disabled: true
4203
- };
4204
- multipleRule.props = {
4205
- disabled: true
4206
- };
4207
- }
4208
- if (["people", "department"].includes(ruleName)) {
4209
- const limitRule = activeProps2?.find(
4210
- (rule) => rule.field === "props.limit"
4211
- );
4212
- limitRule.props = {
4213
- disabled: true
4214
- };
4179
+ let disabled;
4180
+ if (ruleName === "shop") {
4181
+ const isMainValue = activeProps2.find(
4182
+ (rule) => rule.field === "config.isMain"
4183
+ )?.value;
4184
+ disabled = !!flowCondition[activeRule.value.field] || isMainValue;
4185
+ } else {
4186
+ disabled = !!flowCondition[activeRule.value.field];
4187
+ }
4188
+ const requiredRule = activeProps2?.find(
4189
+ (rule) => rule.field === "effect.required"
4190
+ );
4191
+ if (requiredRule) {
4192
+ if (!requiredRule.props) {
4193
+ requiredRule.props = {};
4215
4194
  }
4195
+ requiredRule.props.disabled = disabled;
4196
+ }
4197
+ if (["radio", "checkbox"].includes(ruleName)) {
4198
+ const optionsRule = activeProps2?.find((rule) => rule.field === "options");
4199
+ optionsRule.props.disabled = disabled;
4200
+ }
4201
+ if (ruleName === "materialType") {
4202
+ const formatRule = activeProps2?.find(
4203
+ (rule) => rule.field === "config.format"
4204
+ );
4205
+ const multipleRule = activeProps2?.find(
4206
+ (rule) => rule.field === "props.multiple"
4207
+ );
4208
+ formatRule.props = {
4209
+ disabled
4210
+ };
4211
+ multipleRule.props = {
4212
+ disabled
4213
+ };
4214
+ }
4215
+ if (["people", "department"].includes(ruleName)) {
4216
+ const limitRule = activeProps2?.find(
4217
+ (rule) => rule.field === "props.limit"
4218
+ );
4219
+ limitRule.props = {
4220
+ disabled
4221
+ };
4216
4222
  }
4217
4223
  }
4218
4224
  }
@@ -4232,13 +4238,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4232
4238
  immediate: true
4233
4239
  }
4234
4240
  );
4235
- vue.watch(activeProps, (activeProps2) => {
4236
- flowConditionEffect(activeProps2, props.flowCondition);
4237
- });
4238
4241
  vue.watch(
4239
4242
  () => props.flowCondition,
4240
4243
  (flowCondition) => {
4241
- flowConditionEffect(activeProps.value, flowCondition);
4244
+ flowConditionEffect(flowCondition);
4242
4245
  },
4243
4246
  {
4244
4247
  deep: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bm-admin-ui",
3
- "version": "1.0.62-alpha",
3
+ "version": "1.0.63-alpha",
4
4
  "private": false,
5
5
  "description": "An Admin Component Library for Bm",
6
6
  "license": "UNLICENSED",