@funcho/ui 1.1.35 → 1.1.37

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.
@@ -161,6 +161,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
161
161
  });
162
162
  const tableLoading = vue.ref(false);
163
163
  const loadData = async () => {
164
+ if (props.data !== void 0) return;
164
165
  if (props.request) {
165
166
  if (tableLoading.value) {
166
167
  return;
@@ -10,6 +10,7 @@ const Dialog_vue_vue_type_script_setup_true_lang = require('../../components/Dia
10
10
  const DataTable_vue_vue_type_script_setup_true_lang = require('../DataTable/DataTable.vue.js');
11
11
  ;/* empty css */
12
12
  const index = require('../../components/Notification/index.js');
13
+ const useNamespace = require('../../hooks/use-namespace.js');
13
14
 
14
15
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
15
16
  ...{
@@ -26,12 +27,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
26
27
  showCancelButton: { type: Boolean, default: true },
27
28
  showConfirmButton: { type: Boolean, default: true },
28
29
  isPagination: { type: Boolean, default: false },
30
+ selectable: { type: Boolean, default: false },
29
31
  submitApi: { type: Function, default: void 0 },
30
32
  successMessage: { default: "提交成功!" },
31
33
  showSuccessMessage: { type: Boolean, default: true }
32
34
  },
33
35
  emits: ["submit", "cancel"],
34
36
  setup(__props, { expose: __expose, emit: __emit }) {
37
+ const ns = useNamespace.useNamespace("pro-data-table-dialog");
35
38
  const tableRef = vue.ref();
36
39
  const props = __props;
37
40
  const containerHeight = vue.computed(() => {
@@ -43,6 +46,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
43
46
  const visible = vue.ref(false);
44
47
  const emits = __emit;
45
48
  const submitting = vue.ref(false);
49
+ const confirmBtnDisabled = vue.computed(() => {
50
+ if (!props.selectable) return false;
51
+ return !tableRef.value?.selectedRows || tableRef.value.selectedRows.length === 0;
52
+ });
46
53
  const handleConfirmClick = async () => {
47
54
  try {
48
55
  const tableData = tableRef.value?.tableData;
@@ -87,7 +94,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
87
94
  modelValue: visible.value,
88
95
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
89
96
  title: __props.title,
90
- width: __props.width
97
+ width: __props.width,
98
+ class: vue.normalizeClass({
99
+ [vue.unref(ns).b()]: true,
100
+ [vue.unref(ns).is("no-body-padding-bottom")]: __props.showCancelButton || __props.showConfirmButton
101
+ })
91
102
  }, vue.createSlots({
92
103
  default: vue.withCtx(() => [
93
104
  vue.createElementVNode("div", {
@@ -96,7 +107,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
96
107
  vue.createVNode(DataTable_vue_vue_type_script_setup_true_lang.default, vue.mergeProps({
97
108
  ref_key: "tableRef",
98
109
  ref: tableRef
99
- }, _ctx.$attrs, { "is-pagination": __props.isPagination }), null, 16, ["is-pagination"])
110
+ }, _ctx.$attrs, {
111
+ "is-pagination": __props.isPagination,
112
+ selectable: __props.selectable
113
+ }), null, 16, ["is-pagination", "selectable"])
100
114
  ], 4)
101
115
  ]),
102
116
  _: 2
@@ -117,17 +131,18 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
117
131
  key: 1,
118
132
  type: "primary",
119
133
  loading: submitting.value,
134
+ disabled: confirmBtnDisabled.value,
120
135
  onClick: handleConfirmClick
121
136
  }, {
122
137
  default: vue.withCtx(() => [
123
138
  vue.createTextVNode(vue.toDisplayString(__props.confirmButtonText), 1)
124
139
  ]),
125
140
  _: 1
126
- }, 8, ["loading"])) : vue.createCommentVNode("", true)
141
+ }, 8, ["loading", "disabled"])) : vue.createCommentVNode("", true)
127
142
  ]),
128
143
  key: "0"
129
144
  } : void 0
130
- ]), 1032, ["modelValue", "title", "width"]);
145
+ ]), 1032, ["modelValue", "title", "width", "class"]);
131
146
  };
132
147
  }
133
148
  });
@@ -69,9 +69,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
69
69
  };
70
70
  const open = (data) => {
71
71
  visible.value = true;
72
- vue.nextTick(() => {
73
- formRef.value?.setValues(data || {});
74
- });
72
+ if (data) {
73
+ vue.nextTick(() => {
74
+ formRef.value?.setValues(data || {});
75
+ });
76
+ }
75
77
  };
76
78
  const handleCancelClick = () => {
77
79
  visible.value = false;
@@ -2,6 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const version = "1.1.35";
5
+ const version = "1.1.37";
6
6
 
7
7
  exports.version = version;
@@ -157,6 +157,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
157
157
  });
158
158
  const tableLoading = ref(false);
159
159
  const loadData = async () => {
160
+ if (props.data !== void 0) return;
160
161
  if (props.request) {
161
162
  if (tableLoading.value) {
162
163
  return;
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, computed, createBlock, openBlock, createSlots, withCtx, createElementVNode, normalizeStyle, createVNode, mergeProps, createCommentVNode, createTextVNode, toDisplayString } from 'vue';
1
+ import { defineComponent, ref, computed, createBlock, openBlock, normalizeClass, unref, createSlots, withCtx, createElementVNode, normalizeStyle, createVNode, mergeProps, createCommentVNode, createTextVNode, toDisplayString } from 'vue';
2
2
  import _sfc_main$3 from '../../components/Button/Button.vue.mjs';
3
3
  /* empty css */
4
4
  import _sfc_main$1 from '../../components/Dialog/Dialog.vue.mjs';
@@ -6,6 +6,7 @@ import _sfc_main$1 from '../../components/Dialog/Dialog.vue.mjs';
6
6
  import _sfc_main$2 from '../DataTable/DataTable.vue.mjs';
7
7
  /* empty css */
8
8
  import { FcNotification } from '../../components/Notification/index.mjs';
9
+ import { useNamespace } from '../../hooks/use-namespace.mjs';
9
10
 
10
11
  const _sfc_main = /* @__PURE__ */ defineComponent({
11
12
  ...{
@@ -22,12 +23,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22
23
  showCancelButton: { type: Boolean, default: true },
23
24
  showConfirmButton: { type: Boolean, default: true },
24
25
  isPagination: { type: Boolean, default: false },
26
+ selectable: { type: Boolean, default: false },
25
27
  submitApi: { type: Function, default: void 0 },
26
28
  successMessage: { default: "提交成功!" },
27
29
  showSuccessMessage: { type: Boolean, default: true }
28
30
  },
29
31
  emits: ["submit", "cancel"],
30
32
  setup(__props, { expose: __expose, emit: __emit }) {
33
+ const ns = useNamespace("pro-data-table-dialog");
31
34
  const tableRef = ref();
32
35
  const props = __props;
33
36
  const containerHeight = computed(() => {
@@ -39,6 +42,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
39
42
  const visible = ref(false);
40
43
  const emits = __emit;
41
44
  const submitting = ref(false);
45
+ const confirmBtnDisabled = computed(() => {
46
+ if (!props.selectable) return false;
47
+ return !tableRef.value?.selectedRows || tableRef.value.selectedRows.length === 0;
48
+ });
42
49
  const handleConfirmClick = async () => {
43
50
  try {
44
51
  const tableData = tableRef.value?.tableData;
@@ -83,7 +90,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
83
90
  modelValue: visible.value,
84
91
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
85
92
  title: __props.title,
86
- width: __props.width
93
+ width: __props.width,
94
+ class: normalizeClass({
95
+ [unref(ns).b()]: true,
96
+ [unref(ns).is("no-body-padding-bottom")]: __props.showCancelButton || __props.showConfirmButton
97
+ })
87
98
  }, createSlots({
88
99
  default: withCtx(() => [
89
100
  createElementVNode("div", {
@@ -92,7 +103,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
92
103
  createVNode(_sfc_main$2, mergeProps({
93
104
  ref_key: "tableRef",
94
105
  ref: tableRef
95
- }, _ctx.$attrs, { "is-pagination": __props.isPagination }), null, 16, ["is-pagination"])
106
+ }, _ctx.$attrs, {
107
+ "is-pagination": __props.isPagination,
108
+ selectable: __props.selectable
109
+ }), null, 16, ["is-pagination", "selectable"])
96
110
  ], 4)
97
111
  ]),
98
112
  _: 2
@@ -113,17 +127,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
113
127
  key: 1,
114
128
  type: "primary",
115
129
  loading: submitting.value,
130
+ disabled: confirmBtnDisabled.value,
116
131
  onClick: handleConfirmClick
117
132
  }, {
118
133
  default: withCtx(() => [
119
134
  createTextVNode(toDisplayString(__props.confirmButtonText), 1)
120
135
  ]),
121
136
  _: 1
122
- }, 8, ["loading"])) : createCommentVNode("", true)
137
+ }, 8, ["loading", "disabled"])) : createCommentVNode("", true)
123
138
  ]),
124
139
  key: "0"
125
140
  } : void 0
126
- ]), 1032, ["modelValue", "title", "width"]);
141
+ ]), 1032, ["modelValue", "title", "width", "class"]);
127
142
  };
128
143
  }
129
144
  });
@@ -65,9 +65,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
65
65
  };
66
66
  const open = (data) => {
67
67
  visible.value = true;
68
- nextTick(() => {
69
- formRef.value?.setValues(data || {});
70
- });
68
+ if (data) {
69
+ nextTick(() => {
70
+ formRef.value?.setValues(data || {});
71
+ });
72
+ }
71
73
  };
72
74
  const handleCancelClick = () => {
73
75
  visible.value = false;
@@ -1,3 +1,3 @@
1
- const version = "1.1.35";
1
+ const version = "1.1.37";
2
2
 
3
3
  export { version };
package/dist/style.css CHANGED
@@ -17302,4 +17302,6 @@ to {
17302
17302
  }
17303
17303
  .fc-mkui-pro-vertical-layout__ghost-body {
17304
17304
  flex: 1;
17305
+ }.fc-mkui-pro-data-table-dialog.is-no-body-padding-bottom .fc-ui-dialog__body {
17306
+ padding-bottom: 0;
17305
17307
  }
@@ -7,6 +7,7 @@ type __VLS_Props = {
7
7
  showCancelButton?: boolean;
8
8
  showConfirmButton?: boolean;
9
9
  isPagination?: boolean;
10
+ selectable?: boolean;
10
11
  submitApi?: (tableData: any, selectedRows: any) => Promise<{
11
12
  data: {};
12
13
  }>;
@@ -28,6 +29,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
28
29
  cancelButtonText: string;
29
30
  width: string | number;
30
31
  height: string | number;
32
+ selectable: boolean;
31
33
  isPagination: boolean;
32
34
  submitApi: (tableData: any, selectedRows: any) => Promise<{
33
35
  data: {};
@@ -8,6 +8,7 @@ export declare const FcProDataTableDialog: {
8
8
  showCancelButton?: boolean;
9
9
  showConfirmButton?: boolean;
10
10
  isPagination?: boolean;
11
+ selectable?: boolean;
11
12
  submitApi?: (tableData: any, selectedRows: any) => Promise<{
12
13
  data: {};
13
14
  }>;
@@ -28,6 +29,7 @@ export declare const FcProDataTableDialog: {
28
29
  cancelButtonText: string;
29
30
  width: string | number;
30
31
  height: string | number;
32
+ selectable: boolean;
31
33
  isPagination: boolean;
32
34
  submitApi: (tableData: any, selectedRows: any) => Promise<{
33
35
  data: {};
@@ -1620,6 +1622,7 @@ export declare const FcProDataTableDialog: {
1620
1622
  showCancelButton?: boolean;
1621
1623
  showConfirmButton?: boolean;
1622
1624
  isPagination?: boolean;
1625
+ selectable?: boolean;
1623
1626
  submitApi?: (tableData: any, selectedRows: any) => Promise<{
1624
1627
  data: {};
1625
1628
  }>;
@@ -1637,6 +1640,7 @@ export declare const FcProDataTableDialog: {
1637
1640
  cancelButtonText: string;
1638
1641
  width: string | number;
1639
1642
  height: string | number;
1643
+ selectable: boolean;
1640
1644
  isPagination: boolean;
1641
1645
  submitApi: (tableData: any, selectedRows: any) => Promise<{
1642
1646
  data: {};
@@ -1658,6 +1662,7 @@ export declare const FcProDataTableDialog: {
1658
1662
  showCancelButton?: boolean;
1659
1663
  showConfirmButton?: boolean;
1660
1664
  isPagination?: boolean;
1665
+ selectable?: boolean;
1661
1666
  submitApi?: (tableData: any, selectedRows: any) => Promise<{
1662
1667
  data: {};
1663
1668
  }>;
@@ -1678,6 +1683,7 @@ export declare const FcProDataTableDialog: {
1678
1683
  cancelButtonText: string;
1679
1684
  width: string | number;
1680
1685
  height: string | number;
1686
+ selectable: boolean;
1681
1687
  isPagination: boolean;
1682
1688
  submitApi: (tableData: any, selectedRows: any) => Promise<{
1683
1689
  data: {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funcho/ui",
3
3
  "description": "@funcho ui library",
4
- "version": "1.1.35",
4
+ "version": "1.1.37",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/esm/index.mjs",