wkjp-list-page 1.0.45 → 1.0.47

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wkjp-list-page",
3
- "version": "1.0.45",
3
+ "version": "1.0.47",
4
4
  "description": "Vue2 + ElementUI CommonListPage component",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -152,6 +152,31 @@
152
152
  :column-bind="tableColumnBind"
153
153
  :parent-scoped-slots="$scopedSlots"
154
154
  />
155
+ <el-table-column
156
+ v-else-if="col.type === 'selection'"
157
+ :key="'col-selection-' + idx"
158
+ v-bind="tableColumnBind(col)"
159
+ >
160
+ <template slot-scope="scope">
161
+ <el-tooltip
162
+ v-if="isSelectionRowDisabled(col, scope.row, scope.$index) && getSelectionDisabledTip(col, scope.row, scope.$index)"
163
+ :content="getSelectionDisabledTip(col, scope.row, scope.$index)"
164
+ placement="top"
165
+ :enterable="false"
166
+ >
167
+ <span class="common-list-page__selection-cell" @click.stop>
168
+ <el-checkbox :value="scope.isSelected" disabled></el-checkbox>
169
+ </span>
170
+ </el-tooltip>
171
+ <span v-else class="common-list-page__selection-cell" @click.stop>
172
+ <el-checkbox
173
+ :value="scope.isSelected"
174
+ :disabled="isSelectionRowDisabled(col, scope.row, scope.$index)"
175
+ @input="scope.store.commit('rowSelectedChanged', scope.row)"
176
+ ></el-checkbox>
177
+ </span>
178
+ </template>
179
+ </el-table-column>
155
180
  <el-table-column
156
181
  v-else-if="col.type !== 'slot' && isBuiltinCellColumn(col)"
157
182
  :key="'col-builtin-' + idx + '-' + col.type"
@@ -760,6 +785,17 @@ export default {
760
785
  isBuiltinCellColumn(col) {
761
786
  return col && ["selection", "index", "expand"].indexOf(col.type) !== -1;
762
787
  },
788
+ /** 复选框是否禁用:沿用列配置的 selectable(row, index) 判断,selectable 未配置则始终可选 */
789
+ isSelectionRowDisabled(col, row, index) {
790
+ if (!col || typeof col.selectable !== "function") return false;
791
+ return !col.selectable(row, index);
792
+ },
793
+ /** 复选框禁用时的悬浮提示文案:列配置 disabledTip 可为字符串,或 (row, index) => string */
794
+ getSelectionDisabledTip(col, row, index) {
795
+ if (!col || col.disabledTip == null) return "";
796
+ if (typeof col.disabledTip === "function") return col.disabledTip(row, index) || "";
797
+ return col.disabledTip;
798
+ },
763
799
  /** 复选框、展开列及 showInColumnConfig:false 不参与表头设置 */
764
800
  isConfigPanelColumn(col) {
765
801
  if (!col) return false;
@@ -990,6 +1026,7 @@ export default {
990
1026
  "_visible",
991
1027
  "_configKey",
992
1028
  "children",
1029
+ "disabledTip",
993
1030
  ];
994
1031
  var rest = {};
995
1032
  Object.keys(col || {}).forEach(function (k) {
@@ -1815,6 +1852,14 @@ export default {
1815
1852
  color: #606266;
1816
1853
  }
1817
1854
 
1855
+ .common-list-page /deep/ .common-list-page__selection-cell {
1856
+ display: inline-flex;
1857
+ }
1858
+
1859
+ .common-list-page /deep/ .common-list-page__selection-cell .el-checkbox.is-disabled {
1860
+ cursor: not-allowed;
1861
+ }
1862
+
1818
1863
  .common-list-page /deep/ .el-form.common-list-page__search-form.el-form--inline,
1819
1864
  .common-list-page /deep/ .el-form.el-form--inline.common-list-page__search-form {
1820
1865
  display: flex;
@@ -2573,4 +2618,36 @@ body.wkjp-column-dragging {
2573
2618
  body.wkjp-column-dragging .column-config-panel__item--dragging {
2574
2619
  visibility: hidden !important;
2575
2620
  }
2621
+ .column-config-trigger {
2622
+ position: relative;
2623
+ &::after {
2624
+ content: "";
2625
+ position: absolute;
2626
+ top: 2px;
2627
+ right: 2px;
2628
+ width: 6px;
2629
+ height: 6px;
2630
+ border-radius: 50%;
2631
+ background: #f56c6c;
2632
+ animation: column-config-trigger-pulse 1.6s ease-out infinite;
2633
+ }
2634
+ &:hover,
2635
+ &.is-active {
2636
+ &::after {
2637
+ display: none;
2638
+ }
2639
+ }
2640
+ }
2641
+
2642
+ @keyframes column-config-trigger-pulse {
2643
+ 0% {
2644
+ box-shadow: 0 0 0 0 rgba(245, 108, 108, 0.5);
2645
+ }
2646
+ 70% {
2647
+ box-shadow: 0 0 0 6px rgba(245, 108, 108, 0);
2648
+ }
2649
+ 100% {
2650
+ box-shadow: 0 0 0 0 rgba(245, 108, 108, 0);
2651
+ }
2652
+ }
2576
2653
  </style>