plain-design 1.0.0-beta.126 → 1.0.0-beta.127

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plain-design",
3
- "version": "1.0.0-beta.126",
3
+ "version": "1.0.0-beta.127",
4
4
  "description": "",
5
5
  "main": "dist/plain-design.min.js",
6
6
  "module": "dist/plain-design.commonjs.min.js",
@@ -40,7 +40,7 @@
40
40
  "react-transition-group": "4.4.5"
41
41
  },
42
42
  "devDependencies": {
43
- "@peryl/react-compose": "0.0.221",
43
+ "@peryl/react-compose": "0.0.223",
44
44
  "@babel/plugin-proposal-optional-chaining": "7.21.0",
45
45
  "@babel/plugin-transform-class-properties": "7.23.3",
46
46
  "@babel/preset-env": "7.23.7",
@@ -55,6 +55,7 @@ export const useTableOptionKeyboard = AutoModule.createRegistration(({ hooks })
55
55
  staticState.clearTableEnterEvent = () => {
56
56
  el.removeEventListener('mouseenter', onEnter);
57
57
  el.removeEventListener('mouseleave', onLeave);
58
+ staticState.clearTableEnterEvent = null;
58
59
  };
59
60
 
60
61
  return staticState.clearTableEnterEvent;
@@ -70,7 +71,10 @@ export const useTableOptionKeyboard = AutoModule.createRegistration(({ hooks })
70
71
  }
71
72
  };
72
73
  document.body.addEventListener('keydown', onKeydown);
73
- staticState.clearTableKeydownEvent = () => {document.body.removeEventListener('keydown', onKeydown);};
74
+ staticState.clearTableKeydownEvent = () => {
75
+ document.body.removeEventListener('keydown', onKeydown);
76
+ staticState.clearTableKeydownEvent = null;
77
+ };
74
78
  return staticState.clearTableKeydownEvent;
75
79
  },
76
80
  };
@@ -83,6 +87,7 @@ export const useTableOptionKeyboard = AutoModule.createRegistration(({ hooks })
83
87
  onBeforeUnmount(() => {
84
88
  staticState.clearTableEnterEvent?.();
85
89
  staticState.clearTableKeydownEvent?.();
90
+ staticState.listeners.splice(0, staticState.listeners.length);
86
91
  });
87
92
 
88
93
  const on = (name: string, handler: (e: KeyboardEvent) => void) => {
@@ -1,4 +1,4 @@
1
- import {computed, designComponent, getComponentCls, mergeAttrs, PropType, reactive, useClasses, watch} from "@peryl/react-compose";
1
+ import {computed, designComponent, Fragment, getComponentCls, mergeAttrs, PropType, reactive, useClasses, watch} from "@peryl/react-compose";
2
2
  import {PlainObject} from "@peryl/utils/event";
3
3
  import {Form} from "../Form";
4
4
  import {FormItem} from "../FormItem";
@@ -95,9 +95,12 @@ export const FilterFormMultiple = designComponent({
95
95
  * @author 韦胜健
96
96
  * @date 2023.1.6 16:00
97
97
  */
98
- const usingFilterOptions = computed(() => (props.filterOptions || []).map(i => (
99
- { ...i, filterHandler: state.filterHandlerMap[FilterService.getHandlerBindKey(i)] }
100
- )));
98
+ const usingFilterOptions = computed(() => {
99
+ // console.warn('run usingFilterOptions');
100
+ return (props.filterOptions || []).map(i => (
101
+ { ...i, filterHandler: state.filterHandlerMap[FilterService.getHandlerBindKey(i)] }
102
+ ));
103
+ });
101
104
 
102
105
  /**
103
106
  * props.filterOptions变化时更新内部状态
@@ -240,7 +243,9 @@ export const FilterFormMultiple = designComponent({
240
243
  <SelectOption label={handler!.label()} val={handler!.name} key={handler!.name}/>
241
244
  ))}
242
245
  </Select>
243
- {handler.render({ formData: state.formData, option: filterOption, confirm: methods.search })}
246
+ <Fragment key={filterOption.filterHandler}>
247
+ {handler.render({ formData: state.formData, option: filterOption, confirm: methods.search })}
248
+ </Fragment>
244
249
  </InputGroup>
245
250
  </FormItem>
246
251
  );
@@ -1,4 +1,4 @@
1
- import {computed, designComponent, PropType, reactive, watch} from "@peryl/react-compose";
1
+ import {computed, designComponent, Fragment, PropType, reactive, watch} from "@peryl/react-compose";
2
2
  import {PlainObject} from "@peryl/utils/event";
3
3
  import {iFilterOption, iFilterQueryParam} from "../FilterService/utils/filter.service.utils";
4
4
  import {InputGroup} from "../InputGroup";
@@ -48,7 +48,10 @@ export const FilterFormSingle = designComponent({
48
48
  }
49
49
  };
50
50
 
51
- const state = reactive(deepcopy(props.initialState) || utils.createState({ filterOptions: props.filterOptions || [] }));
51
+ const state: iFilterFormSingleState = reactive(
52
+ deepcopy(props.initialState) ||
53
+ utils.createState({ filterOptions: props.filterOptions || [] })
54
+ );
52
55
 
53
56
  /**
54
57
  * 正在使用的目标filterOptions
@@ -146,20 +149,22 @@ export const FilterFormSingle = designComponent({
146
149
  <InputGroup style={{ width: props.width }}>
147
150
  {slots.prepend()}
148
151
  {!props.hideFieldSelector && (
149
- <Select width={90} modelValue={state.field} onUpdateModelValue={handler.onUpdateField} inputAttrs={inputAttrs}>
152
+ <Select key="field_selector" width={90} modelValue={state.field} onUpdateModelValue={handler.onUpdateField} inputAttrs={inputAttrs}>
150
153
  {(props.filterOptions || []).map((option) => (
151
154
  <SelectOption label={option.label} val={option.field} key={option.label + option.field}/>
152
155
  ))}
153
156
  </Select>
154
157
  )}
155
158
  {!props.hideHandlerSelector && (
156
- <Select width={90} modelValue={state.filterHandler} onUpdateModelValue={handler.onUpdateHandler} inputAttrs={inputAttrs}>
159
+ <Select key={state.field} width={90} modelValue={state.filterHandler} onUpdateModelValue={handler.onUpdateHandler} inputAttrs={inputAttrs}>
157
160
  {(FilterService.touch(usingFilterOption.value.filterType)).state.list.map((handler) => (
158
161
  <SelectOption label={handler.label()} val={handler.name} key={handler.name}/>
159
162
  ))}
160
163
  </Select>
161
164
  )}
162
- {FilterService.getHandler(usingFilterOption.value)!.render({ formData: state.formData, option: usingFilterOption.value, confirm: methods.search })}
165
+ <Fragment key={state.filterHandler}>
166
+ {FilterService.getHandler(usingFilterOption.value)!.render({ formData: state.formData, option: usingFilterOption.value, confirm: methods.search })}
167
+ </Fragment>
163
168
  {!props.hideSearchButton && (
164
169
  <Button label={i18n.$it('base.query').d('查询')} icon="pi-search" mode="fill" asyncHandler={methods.search}/>
165
170
  )}
@@ -34,10 +34,13 @@
34
34
  }
35
35
  }
36
36
 
37
- &.#{componentName(input)}, &.#{componentName(button)} {
38
- & + .#{componentName(input)}, & + .#{componentName(button)} {
39
- margin-left: -1px;
40
- }
37
+ &.#{componentName(input)} + .#{componentName(button)} {
38
+ margin-left: -1px;
39
+ }
40
+
41
+ &.#{componentName(button)} + .#{componentName(input)},
42
+ &.#{componentName(button)} + .#{componentName(button)} {
43
+ margin-left: -1px;
41
44
  }
42
45
  }
43
46
  }
@@ -1,4 +1,4 @@
1
- import {computed, designComponent, getComponentCls, PropType, reactive, RenderNode, useClasses} from "@peryl/react-compose";
1
+ import {computed, designComponent, getComponentCls, onBeforeUnmount, PropType, reactive, RenderNode, useClasses} from "@peryl/react-compose";
2
2
  import {eTableOperationPosition, iTableOperation, iTableOperationPermitConfig, iTableOuterOperation, iTableOuterOperationConfig, TableOperationDefaultTypeSeq} from "./PlcOperation.utils";
3
3
  import {Button} from "../../../Button";
4
4
  import {ButtonGroup} from "../../../ButtonGroup";
@@ -38,6 +38,7 @@ export const OuterOperation = designComponent({
38
38
  },
39
39
  },
40
40
  });
41
+ onBeforeUnmount(() => {state.dropdown = {} as any;});
41
42
 
42
43
  const permission = (() => {
43
44
  const { permit } = props;