plain-design 0.0.88 → 0.0.92

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": "0.0.88",
3
+ "version": "0.0.92",
4
4
  "description": "",
5
5
  "main": "dist/plain-design.min.js",
6
6
  "module": "dist/plain-design.commonjs.min.js",
@@ -21,7 +21,7 @@
21
21
  "author": "",
22
22
  "license": "ISC",
23
23
  "peerDependencies": {
24
- "plain-design-composition": "0.0.105",
24
+ "plain-design-composition": "0.0.114",
25
25
  "react": "^17.0.1",
26
26
  "react-dom": "^17.0.1"
27
27
  },
@@ -55,7 +55,6 @@
55
55
  "axios": "^0.21.1",
56
56
  "babel-plugin-import": "^1.13.3",
57
57
  "babel-plugin-syntax-jsx": "^6.18.0",
58
- "choerodon-ui": "0.8.77",
59
58
  "core-js": "^3.6.5",
60
59
  "cross-env": "^7.0.3",
61
60
  "css-loader": "^5.2.4",
@@ -66,7 +65,7 @@
66
65
  "fork-ts-checker-webpack-plugin": "^6.2.4",
67
66
  "mini-css-extract-plugin": "^1.6.2",
68
67
  "mockjs": "^1.1.0",
69
- "plain-design-composition": "0.0.105",
68
+ "plain-design-composition": "^0.0.114",
70
69
  "postcss": "^8.2.13",
71
70
  "postcss-loader": "^4.2.0",
72
71
  "qs": "^6.10.1",
@@ -1,106 +1,107 @@
1
1
  @include theme {
2
- .pl-cascade-panel {
3
- display: inline-block;
4
- height: 200px;
5
- border: solid 1px $ibc;
6
- border-radius: $popperRadius;
7
- color: $itc;
8
-
9
- & > .pl-list {
10
- height: 100%;
11
- overflow: hidden;
12
- white-space: nowrap;
13
- }
2
+ .pl-cascade-panel {
3
+ display: inline-block;
4
+ height: 200px;
5
+ border: solid 1px $ibc;
6
+ border-radius: $popperRadius;
7
+ color: $itc;
14
8
 
15
- .pl-cascade-list {
16
- width: 180px;
17
- height: 100%;
18
- padding: 6px 0;
19
- font-size: 14px;
20
- display: inline-block;
21
- vertical-align: top;
22
- overflow: hidden;
23
- box-sizing: border-box;
24
-
25
- &:not(:last-child) {
26
- border-right: solid 1px $ibc;
27
- }
9
+ & > .pl-list {
10
+ height: 100%;
11
+ overflow: hidden;
12
+ white-space: nowrap;
13
+ }
28
14
 
29
- .pl-list {
30
- overflow: hidden;
31
- }
15
+ .pl-cascade-list {
16
+ width: 180px;
17
+ height: 100%;
18
+ padding: 6px 0;
19
+ font-size: 14px;
20
+ display: inline-block;
21
+ vertical-align: top;
22
+ overflow: hidden;
23
+ box-sizing: border-box;
32
24
 
33
- .pl-cascade-item {
34
- padding: 5px 0 5px 12px;
35
- font-weight: 400;
36
- font-size: 13px;
37
- color: $itc;
38
- background-color: white;
39
- transition: all 300ms $transition;
40
- cursor: pointer;
25
+ &:not(:last-child) {
26
+ border-right: solid 1px $ibc;
27
+ }
41
28
 
42
- .pl-cascade-content {
43
- padding-right: 30px;
44
- position: relative;
29
+ .pl-list {
30
+ overflow: hidden;
31
+ }
45
32
 
46
- .pl-cascade-arrow {
47
- position: absolute;
48
- top: 0;
49
- bottom: 0;
50
- right: 0;
51
- width: 30px;
52
- display: flex;
53
- align-items: center;
54
- justify-content: center;
55
- color: $icc;
56
- }
57
- }
33
+ .pl-cascade-item {
34
+ padding: 5px 0 5px 12px;
35
+ line-height: 22px;
36
+ font-weight: 400;
37
+ font-size: 13px;
38
+ color: $itc;
39
+ background-color: white;
40
+ transition: all 300ms $transition;
41
+ cursor: pointer;
58
42
 
59
- &.pl-cascade-item-expand, &:hover {
60
- color: $ihc;
61
- background-color: $disabled;
62
- }
43
+ .pl-cascade-content {
44
+ padding-right: 30px;
45
+ position: relative;
63
46
 
64
- &.pl-cascade-item-active {
65
- color: $colorPrimary;
66
- background-color: rgba($colorPrimary, 0.1);
67
- }
47
+ .pl-cascade-arrow {
48
+ position: absolute;
49
+ top: 0;
50
+ bottom: 0;
51
+ right: 0;
52
+ width: 30px;
53
+ display: flex;
54
+ align-items: center;
55
+ justify-content: center;
56
+ color: $icc;
57
+ }
58
+ }
68
59
 
69
- &.pl-cascade-empty {
70
- display: flex;
71
- flex-direction: column;
72
- align-items: center;
73
- justify-content: center;
60
+ &.pl-cascade-item-expand, &:hover {
61
+ color: $ihc;
62
+ background-color: $disabled;
63
+ }
74
64
 
75
- padding-left: 0;
76
- font-size: 12px;
77
- color: $disabledText;
78
- background-color: transparent;
79
- cursor: auto;
65
+ &.pl-cascade-item-active {
66
+ color: $colorPrimary;
67
+ background-color: rgba($colorPrimary, 0.1);
68
+ }
80
69
 
81
- .pl-icon {
82
- margin-bottom: 8px;
83
- font-size: 20px;
84
- }
85
- }
70
+ &.pl-cascade-empty {
71
+ display: flex;
72
+ flex-direction: column;
73
+ align-items: center;
74
+ justify-content: center;
86
75
 
87
- &.pl-cascade-item-disabled {
88
- background-color: transparent;
89
- color: $disabledText;
90
- cursor: not-allowed;
91
- }
92
- }
76
+ padding-left: 0;
77
+ font-size: 12px;
78
+ color: $disabledText;
79
+ background-color: transparent;
80
+ cursor: auto;
93
81
 
94
- &.pl-cascade-filter-list {
95
- width: 360px;
96
- }
82
+ .pl-icon {
83
+ margin-bottom: 8px;
84
+ font-size: 20px;
85
+ }
97
86
  }
98
87
 
99
- .pl-loading-mask {
100
- top: 1px;
101
- bottom: 1px;
102
- left: 1px;
103
- right: 1px;
88
+ &.pl-cascade-item-disabled {
89
+ background-color: transparent;
90
+ color: $disabledText;
91
+ cursor: not-allowed;
104
92
  }
93
+ }
94
+
95
+ &.pl-cascade-filter-list {
96
+ width: 360px;
97
+ }
98
+ }
99
+
100
+ .pl-loading-mask {
101
+ top: 1px;
102
+ bottom: 1px;
103
+ left: 1px;
104
+ right: 1px;
105
105
  }
106
- }
106
+ }
107
+ }
@@ -171,19 +171,19 @@
171
171
  /*@formatter:off*/
172
172
  &.pl-transition-dialog-#{$key}-enter {
173
173
  &:before {opacity: 0;}
174
- .pl-dialog-body {transform: $value;}
174
+ .pl-dialog-body {opacity: 0;transform: $value;}
175
175
  }
176
176
  &.pl-transition-dialog-#{$key}-enter-active {
177
177
  &:before {opacity: 1;}
178
- .pl-dialog-body {transform: translate3d(0, 0, 0);}
178
+ .pl-dialog-body {opacity: 1;transform: translate3d(0, 0, 0);}
179
179
  }
180
180
  &.pl-transition-dialog-#{$key}-exit {
181
181
  &:before {opacity: 1;}
182
- .pl-dialog-body {transform: translate3d(0, 0, 0);}
182
+ .pl-dialog-body {opacity: 1;transform: translate3d(0, 0, 0);}
183
183
  }
184
184
  &.pl-transition-dialog-#{$key}-exit-active {
185
185
  &:before {opacity: 0;}
186
- .pl-dialog-body {transform: $value;}
186
+ .pl-dialog-body {opacity: 0;transform: $value;}
187
187
  }
188
188
  &.pl-transition-dialog-#{$key}-enter-active, &.pl-transition-dialog-#{$key}-exit-active {
189
189
  .pl-dialog-body {
@@ -55,7 +55,7 @@
55
55
  }
56
56
 
57
57
  .pl-dropdown-group-content {
58
- padding: 4px 8px;
58
+ padding: 4px 0;
59
59
  }
60
60
 
61
61
  &.pl-dropdown-no-title:not(:last-child) {
@@ -31,6 +31,7 @@
31
31
 
32
32
  .pl-input-custom-placeholder {
33
33
  color: $ipc;
34
+ margin-left: 6px;
34
35
  }
35
36
 
36
37
  input, textarea {
@@ -52,6 +52,7 @@
52
52
  background-color: rgba(black, 0.8);
53
53
  color: white;
54
54
  padding: 3px 6px;
55
+ line-height: initial;
55
56
  position: absolute;
56
57
  left: 50%;
57
58
  transform: translateX(-50%);
@@ -172,4 +173,4 @@
172
173
  }
173
174
  }
174
175
  }
175
- }
176
+ }
@@ -220,6 +220,10 @@ export function useTableOptionButtons({hooks, methods, command, setting, config,
220
220
 
221
221
  command.on('esc', () => methods.editMethods.cancel())
222
222
  command.on('alt+s', () => methods.editMethods.save())
223
+ command.on('up', () => methods.pageMethods.selectPrevRow())
224
+ command.on('down', () => methods.pageMethods.selectNextRow())
225
+ command.on('left', () => methods.pageMethods.prev())
226
+ command.on('right', () => methods.pageMethods.next())
223
227
 
224
228
  const outerButtons = computed(() => {
225
229
  return [...Object.values(standardButtons), ...config.buttons || []]
@@ -1,4 +1,4 @@
1
- import {eTableProEditType, iTableProDefaultConfig, iTableSortData, iTableOptionState, tTableOptionConfig, tUrlConfig} from "../createUseTableOption.utils";
1
+ import {eTableProEditType, iTableOptionState, iTableProDefaultConfig, iTableSortData, tTableOptionConfig, tUrlConfig} from "../createUseTableOption.utils";
2
2
  import {tTablePagination} from "./use.paginaiton";
3
3
  import {tTableOptionHooks} from "./use.hooks";
4
4
  import $$notice from "../../$$notice";
@@ -61,6 +61,14 @@ export function useTableOptionMethods({tableState, config, pagination, hooks, cu
61
61
  requestConfig,
62
62
  }
63
63
  },
64
+ getChangeNode: (node: TableNode) => {
65
+ const {editRow, data} = node
66
+ const changeKey = Object.keys({...editRow, ...data}).find(key => editRow[key] !== data[key])
67
+ /*if (!!changeKey) {
68
+ console.log(editRow[changeKey], data[changeKey])
69
+ }*/
70
+ return !!changeKey ? node : null
71
+ },
64
72
  }
65
73
 
66
74
  const pageMethods = useAsyncMethods((() => {
@@ -155,7 +163,36 @@ export function useTableOptionMethods({tableState, config, pagination, hooks, cu
155
163
  }
156
164
  }
157
165
 
158
- return {load, reload, queryCount, next, prev, jump,}
166
+ /*选中下一条数据*/
167
+ const selectNextRow = async () => {
168
+ const {list, currentKey} = tableState
169
+ if (list.length === 0 || !currentKey) {return}
170
+ const index = list.findIndex(i => i[config.keyField] === currentKey)
171
+ if (index === list.length - 1) {
172
+ // 当前应是选中当前页的最后一条数据了
173
+ if (pagination.pageState.hasNext) {
174
+ pageMethods.next()
175
+ }
176
+ } else {
177
+ editMethods.selectCurrent(list[index + 1][config.keyField])
178
+ }
179
+ }
180
+ /*选中上一条数据*/
181
+ const selectPrevRow = async () => {
182
+ const {list, currentKey} = tableState
183
+ if (list.length === 0 || !currentKey) {return}
184
+ const index = list.findIndex(i => i[config.keyField] === currentKey)
185
+ if (index === 0) {
186
+ // 当前应是选中当前页的第一条数据了
187
+ if (pagination.pageState.page > 0) {
188
+ pageMethods.prev()
189
+ }
190
+ } else {
191
+ editMethods.selectCurrent(list[index - 1][config.keyField])
192
+ }
193
+ }
194
+
195
+ return {load, reload, queryCount, next, prev, jump, selectNextRow, selectPrevRow}
159
196
  })())
160
197
 
161
198
  const editMethods = (() => {
@@ -352,6 +389,13 @@ export function useTableOptionMethods({tableState, config, pagination, hooks, cu
352
389
  $$message.error(`第${index + 1}条记录校验不通过,${errors[0].label}:${errors[0].message}`)
353
390
  return Promise.reject(validateResult)
354
391
  }
392
+ const changeNode = utils.getChangeNode(node)
393
+ if (!changeNode) {
394
+ // 没有改变任何字段
395
+ node.closeEdit()
396
+ await selectCurrent(node.editRow[config.keyField])
397
+ return
398
+ }
355
399
  const saveRow = await saveUpdate(node.editRow)
356
400
  node.saveEdit(saveRow)
357
401
  node.closeEdit()
@@ -396,8 +440,13 @@ export function useTableOptionMethods({tableState, config, pagination, hooks, cu
396
440
  $$message.error(`第${index + 1}条记录校验不通过,${errors[0].label}:${errors[0].message}`)
397
441
  return Promise.reject(validateResults[0])
398
442
  }
443
+ const changeNodes = updateNodes.map(node => utils.getChangeNode(node)).filter(Boolean) as TableNode[]
444
+ if (changeNodes.length === 0) {
445
+ updateNodes.forEach(node => node.cancelEdit())
446
+ return confirm.close.clear()
447
+ }
399
448
  let {request, requestConfig} = utils.getUrlConfig('batchUpdate')
400
- requestConfig.body = {rows: await Promise.all(deepcopy(updateNodes.map(node => node.editRow)).map(row => hooks.onBeforeSaveRow.exec(row)))}
449
+ requestConfig.body = {rows: await Promise.all(deepcopy(changeNodes.map(node => node.editRow)).map(row => hooks.onBeforeSaveRow.exec(row)))}
401
450
  requestConfig = await hooks.onBeforeUpdate.exec(requestConfig)
402
451
  await request!(requestConfig)
403
452
  confirm.close.clear()
@@ -3,7 +3,7 @@
3
3
  position: fixed;
4
4
 
5
5
  .pl-contextmenu-service-body {
6
- transition: all $transition 300ms;
6
+ transition: all $transition 150ms;
7
7
  transform-origin: top left;
8
8
  box-sizing: border-box;
9
9
  box-shadow: $boxshadow;