@vipl520/dk-ui 1.0.63 → 1.0.64

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -2485,6 +2485,16 @@ var _sfc_main$19 = /* @__PURE__ */ defineComponent({
2485
2485
  }
2486
2486
  return {};
2487
2487
  });
2488
+ const draggable = computed(() => {
2489
+ let draggable2 = false;
2490
+ if (props.dialog?.draggable) {
2491
+ draggable2 = props.dialog?.draggable;
2492
+ }
2493
+ if (_formData.value?.config?.draggable !== void 0) {
2494
+ draggable2 = _formData.value?.config?.draggable;
2495
+ }
2496
+ return draggable2;
2497
+ });
2488
2498
  const isFullscreen = computed(() => {
2489
2499
  let defaultFullscreen = false;
2490
2500
  const autoFullscreen = _formData.value?.config?.autoFullscreen !== false;
@@ -2594,6 +2604,7 @@ var _sfc_main$19 = /* @__PURE__ */ defineComponent({
2594
2604
  "min-height": "200px"
2595
2605
  }, dialogProps.value, {
2596
2606
  "max-height": "auto",
2607
+ draggable: draggable.value,
2597
2608
  "append-to-body": ""
2598
2609
  }), {
2599
2610
  default: withCtx(() => [
@@ -2645,7 +2656,7 @@ var _sfc_main$19 = /* @__PURE__ */ defineComponent({
2645
2656
  ]),
2646
2657
  _: 3
2647
2658
  /* FORWARDED */
2648
- }, 16, ["modelValue", "title", "width", "default-fullscreen"])) : (openBlock(), createElementBlock("div", _hoisted_1$S, [
2659
+ }, 16, ["modelValue", "title", "width", "default-fullscreen", "draggable"])) : (openBlock(), createElementBlock("div", _hoisted_1$S, [
2649
2660
  createElementVNode(
2650
2661
  "div",
2651
2662
  {
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "dk",
5
- "version": "1.0.62",
5
+ "version": "1.0.63",
6
6
  "js-types-syntax": "typescript",
7
7
  "description-markup": "markdown",
8
8
  "contributions": {
@@ -92,6 +92,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
92
92
  }
93
93
  return {};
94
94
  });
95
+ const draggable = computed(() => {
96
+ let draggable2 = false;
97
+ if (props.dialog?.draggable) {
98
+ draggable2 = props.dialog?.draggable;
99
+ }
100
+ if (_formData.value?.config?.draggable !== void 0) {
101
+ draggable2 = _formData.value?.config?.draggable;
102
+ }
103
+ return draggable2;
104
+ });
95
105
  const isFullscreen = computed(() => {
96
106
  let defaultFullscreen = false;
97
107
  const autoFullscreen = _formData.value?.config?.autoFullscreen !== false;
@@ -201,6 +211,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
201
211
  "min-height": "200px"
202
212
  }, dialogProps.value, {
203
213
  "max-height": "auto",
214
+ draggable: draggable.value,
204
215
  "append-to-body": ""
205
216
  }), {
206
217
  default: withCtx(() => [
@@ -252,7 +263,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
252
263
  ]),
253
264
  _: 3
254
265
  /* FORWARDED */
255
- }, 16, ["modelValue", "title", "width", "default-fullscreen"])) : (openBlock(), createElementBlock("div", _hoisted_1, [
266
+ }, 16, ["modelValue", "title", "width", "default-fullscreen", "draggable"])) : (openBlock(), createElementBlock("div", _hoisted_1, [
256
267
  createElementVNode(
257
268
  "div",
258
269
  {
@@ -1 +1 @@
1
- {"version":3,"file":"form.vue2.mjs","sources":["../../../src/form/src/form.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkForm',\n});\n</script>\n<template>\n <DkDialog\n v-if=\"props.isDialog\"\n v-model=\"showDialog\"\n :title=\"_formData?.title ? _formData?.title : '表单'\"\n :width=\"dialogWidth\"\n :default-fullscreen=\"isFullscreen\"\n min-height=\"200px\"\n v-bind=\"dialogProps\"\n max-height=\"auto\"\n append-to-body\n >\n <div :style=\"dialogStyle\" class=\"dk-form p10px\">\n <FormCreate\n v-model=\"value\"\n :option=\"formConfig\"\n :rule=\"_formData.rules\"\n :handle-icon=\"false\"\n class=\"formBox\"\n @update:api=\"fApi = $event\"\n @update:value=\"value = $event\"\n />\n <div :style=\"{ marginLeft: config.form.labelWidth }\" class=\"m-t-10px\">\n <slot name=\"buttons\">\n <el-button type=\"primary\" :loading=\"buttonLoading\" @click=\"checkForm\"> 提交</el-button>\n </slot>\n </div>\n </div>\n </DkDialog>\n <div v-else>\n <div :style=\"{ minHeight }\" class=\"dk-form\">\n <FormCreate\n v-model=\"value\"\n :option=\"formConfig\"\n :rule=\"_formData.rules\"\n :handle-icon=\"false\"\n class=\"formBox\"\n @update:api=\"fApi = $event\"\n @update:value=\"value = $event\"\n />\n <div :style=\"{ marginLeft: config.form.labelWidth }\" class=\"m-t-10px\">\n <slot name=\"buttons\">\n <el-button type=\"primary\" :loading=\"buttonLoading\" @click=\"checkForm\"> 提交</el-button>\n </slot>\n </div>\n </div>\n <!-- <div v-else :style=\"{ minHeight }\"></div>-->\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { createNamespace, isArray, isObject, request } from '@vipl520/utils'\nimport formCreate from '@form-create/element-ui'\nimport { formProps } from './props'\nimport { computed, onMounted, reactive, ref, watch } from 'vue'\nimport _config from './config'\nimport { ElButton, ElMessage } from 'element-plus'\nimport { useWindowSize } from '@vueuse/core'\n\nconst [_, bem] = createNamespace('form')\n\nformCreate.register({\n name: 'help',\n init({ value }, rule) {\n // 判断value是字符串还是数组,如果是字符串则转换为数组,如果是数组则不变\n if (!isArray(value)) {\n value = [value]\n }\n rule.suffix = {\n type: 'p',\n children: value,\n class: 'form-help',\n }\n },\n})\n\n\nconst FormCreate = formCreate.$form()\n\nconst props = defineProps(formProps)\n\nconst config = reactive(_config)\nconst fApi = ref()\nconst loading = ref(true)\nconst buttonLoading = ref(false)\n\nconst showDialog = ref(false)\nconst { width } = useWindowSize()\n\nconst formConfig = computed(() => {\n const _config = config\n if (width.value < 768) {\n _config.form.labelPosition = 'top'\n _config.form.size = 'small'\n } else {\n _config.form.labelPosition = 'left'\n _config.form.size = 'default'\n }\n return { ..._config, ...props.extraConfig }\n})\nconst value = ref(null)\nconst _formData = ref(props.formData || {})\n\nconst emit = defineEmits(['submit', 'fail', 'update:modelValue'])\nwatch(\n () => props.formData,\n () => {\n _formData.value = props.formData\n },\n {\n deep: true,\n }\n)\nwatch(\n () => value.value,\n (val) => {\n emit('update:modelValue', val || {})\n }\n)\n// 弹窗宽度\nconst dialogWidth = computed(() => {\n let defaultWidth = '800px'\n const config = _formData.value?.config || {}\n if (config?.width) {\n return config?.width\n }\n if (props.dialog?.width) {\n defaultWidth = props.dialog?.width\n }\n if (config?.defaultWidth) {\n defaultWidth = config?.defaultWidth\n }\n let minWidth = 768\n // 判断是否为百分比\n if (!defaultWidth.endsWith('%')) {\n minWidth = parseInt(defaultWidth)\n }\n return width.value < minWidth ? '100%' : defaultWidth\n})\n// 弹窗内样式\nconst dialogStyle = computed(() => {\n if (_formData.value?.config?.style) {\n return _formData.value?.config?.style\n }\n if (props.dialog?.style) {\n return props.dialog?.style\n }\n return {}\n})\n// const draggable = computed(() => {\n// let draggable = false\n// if (props.dialog?.draggable) {\n// draggable = props.dialog?.draggable\n// }\n// if (_formData.value?.config?.draggable !== undefined) {\n// draggable = _formData.value?.config?.draggable\n// }\n// return draggable\n// })\n// 是否全屏\nconst isFullscreen = computed(() => {\n let defaultFullscreen = false\n const autoFullscreen = _formData.value?.config?.autoFullscreen !== false\n if (props.dialog?.width) {\n defaultFullscreen = props.dialog?.fullscreen\n }\n if (_formData.value?.config?.fullscreen) {\n defaultFullscreen = _formData.value?.config?.fullscreen\n }\n\n if (width.value < 768 && autoFullscreen) {\n defaultFullscreen = true\n }\n\n return defaultFullscreen\n})\n\nconst dialogProps = computed(() => {\n return Object.assign(props.dialog, _formData.value?.config?.dialog)\n})\nconst setFormData = (formData: any) => {\n value.value = null\n _formData.value = formData\n}\n\nconst initFormData = (formUrl?: string | object) => {\n if (!formUrl) {\n formUrl = props.formUrl\n }\n\n if (props.formData) {\n loading.value = false\n } else if (formUrl) {\n let data: {}\n if (isObject(formUrl)) {\n data = formUrl\n } else {\n data = {\n url: formUrl,\n method: 'post',\n }\n }\n request(data)\n .then((res) => {\n _formData.value = res.data\n loading.value = false\n })\n .catch((res) => {\n loading.value = false\n })\n }\n}\n\nconst checkForm = () => {\n fApi.value\n .validate()\n .then(() => {\n fApi.value\n .submit((data: any) => {\n onSubmit(data)\n })\n .catch((fail: object) => {\n ElMessage.warning(Object.values(fail)[0][0].message)\n })\n })\n .catch((fail: object) => {\n ElMessage.warning(Object.values(fail)[0][0].message)\n })\n}\n\nconst onSubmit = (data: any) => {\n if (props.isLoading) {\n buttonLoading.value = true\n }\n if (props.isSubmit) {\n request({\n url: props.path + _formData.value.action,\n method: _formData.value.method,\n data: { formData: data },\n })\n .then((res) => {\n ElMessage.success(res.msg)\n emit('submit', data, res)\n buttonLoading.value = false\n })\n .catch((res) => {\n ElMessage.error(res.msg)\n emit('fail', data, res)\n buttonLoading.value = false\n })\n } else {\n emit('submit', data)\n buttonLoading.value = false\n }\n showDialog.value = false\n}\n\nconst show = () => {\n showDialog.value = true\n}\nonMounted(() => {\n initFormData()\n})\n// 导出\ndefineExpose({\n showDialog,\n buttonLoading,\n fApi,\n value,\n show,\n checkForm,\n onSubmit,\n initFormData,\n setFormData,\n})\n</script>\n"],"names":["__MACROS_defineComponent","value","config","_config"],"mappings":";;;;;;;;;AAEA,MAA6B,cAAAA,eAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,QAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AA6DD,IAAA,MAAM,CAAC,CAAA,EAAG,GAAG,CAAA,GAAI,gBAAgB,MAAM,CAAA,CAAA;AAEvC,IAAA,UAAA,CAAW,QAAS,CAAA;AAAA,MAClB,IAAM,EAAA,MAAA;AAAA,MACN,IAAK,CAAA,EAAE,KAAAC,EAAAA,MAAAA,IAAS,IAAM,EAAA;AAEpB,QAAI,IAAA,CAAC,OAAQA,CAAAA,MAAK,CAAG,EAAA;AACnB,UAAAA,MAAAA,GAAQ,CAACA,MAAK,CAAA,CAAA;AAAA,SAChB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ACjB,MAAA,UAAA,CAAW,KAAQ,GAAA,IAAA,CAAA;AAAA,KACrB,CAAA;AACA,IAAA,SAAA,CAAU,MAAM;AACd,MAAa,YAAA,EAAA,CAAA;AAAA,KACd,CAAA,CAAA;AAED,IAAa,QAAA,CAAA;AAAA,MACX,UAAA;AAAA,MACA,aAAA;AAAA,MACA,IAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAA;AAAA,MACA,WAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"form.vue2.mjs","sources":["../../../src/form/src/form.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkForm',\n});\n</script>\n<template>\n <DkDialog\n v-if=\"props.isDialog\"\n v-model=\"showDialog\"\n :title=\"_formData?.title ? _formData?.title : '表单'\"\n :width=\"dialogWidth\"\n :default-fullscreen=\"isFullscreen\"\n min-height=\"200px\"\n v-bind=\"dialogProps\"\n max-height=\"auto\"\n :draggable=\"draggable\"\n append-to-body\n >\n <div :style=\"dialogStyle\" class=\"dk-form p10px\">\n <FormCreate\n v-model=\"value\"\n :option=\"formConfig\"\n :rule=\"_formData.rules\"\n :handle-icon=\"false\"\n class=\"formBox\"\n @update:api=\"fApi = $event\"\n @update:value=\"value = $event\"\n />\n <div :style=\"{ marginLeft: config.form.labelWidth }\" class=\"m-t-10px\">\n <slot name=\"buttons\">\n <el-button type=\"primary\" :loading=\"buttonLoading\" @click=\"checkForm\"> 提交</el-button>\n </slot>\n </div>\n </div>\n </DkDialog>\n <div v-else>\n <div :style=\"{ minHeight }\" class=\"dk-form\">\n <FormCreate\n v-model=\"value\"\n :option=\"formConfig\"\n :rule=\"_formData.rules\"\n :handle-icon=\"false\"\n class=\"formBox\"\n @update:api=\"fApi = $event\"\n @update:value=\"value = $event\"\n />\n <div :style=\"{ marginLeft: config.form.labelWidth }\" class=\"m-t-10px\">\n <slot name=\"buttons\">\n <el-button type=\"primary\" :loading=\"buttonLoading\" @click=\"checkForm\"> 提交</el-button>\n </slot>\n </div>\n </div>\n <!-- <div v-else :style=\"{ minHeight }\"></div>-->\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { createNamespace, isArray, isObject, request } from '@vipl520/utils'\nimport formCreate from '@form-create/element-ui'\nimport { formProps } from './props'\nimport { computed, onMounted, reactive, ref, watch } from 'vue'\nimport _config from './config'\nimport { ElButton, ElMessage } from 'element-plus'\nimport { useWindowSize } from '@vueuse/core'\n\nconst [_, bem] = createNamespace('form')\n\nformCreate.register({\n name: 'help',\n init({ value }, rule) {\n // 判断value是字符串还是数组,如果是字符串则转换为数组,如果是数组则不变\n if (!isArray(value)) {\n value = [value]\n }\n rule.suffix = {\n type: 'p',\n children: value,\n class: 'form-help',\n }\n },\n})\n\n\nconst FormCreate = formCreate.$form()\n\nconst props = defineProps(formProps)\n\nconst config = reactive(_config)\nconst fApi = ref()\nconst loading = ref(true)\nconst buttonLoading = ref(false)\n\nconst showDialog = ref(false)\nconst { width } = useWindowSize()\n\nconst formConfig = computed(() => {\n const _config = config\n if (width.value < 768) {\n _config.form.labelPosition = 'top'\n _config.form.size = 'small'\n } else {\n _config.form.labelPosition = 'left'\n _config.form.size = 'default'\n }\n return { ..._config, ...props.extraConfig }\n})\nconst value = ref(null)\nconst _formData = ref(props.formData || {})\n\nconst emit = defineEmits(['submit', 'fail', 'update:modelValue'])\nwatch(\n () => props.formData,\n () => {\n _formData.value = props.formData\n },\n {\n deep: true,\n }\n)\nwatch(\n () => value.value,\n (val) => {\n emit('update:modelValue', val || {})\n }\n)\n// 弹窗宽度\nconst dialogWidth = computed(() => {\n let defaultWidth = '800px'\n const config = _formData.value?.config || {}\n if (config?.width) {\n return config?.width\n }\n if (props.dialog?.width) {\n defaultWidth = props.dialog?.width\n }\n if (config?.defaultWidth) {\n defaultWidth = config?.defaultWidth\n }\n let minWidth = 768\n // 判断是否为百分比\n if (!defaultWidth.endsWith('%')) {\n minWidth = parseInt(defaultWidth)\n }\n return width.value < minWidth ? '100%' : defaultWidth\n})\n// 弹窗内样式\nconst dialogStyle = computed(() => {\n if (_formData.value?.config?.style) {\n return _formData.value?.config?.style\n }\n if (props.dialog?.style) {\n return props.dialog?.style\n }\n return {}\n})\nconst draggable = computed(() => {\n let draggable = false\n if (props.dialog?.draggable) {\n draggable = props.dialog?.draggable\n }\n if (_formData.value?.config?.draggable !== undefined) {\n draggable = _formData.value?.config?.draggable\n }\n return draggable\n})\n// 是否全屏\nconst isFullscreen = computed(() => {\n let defaultFullscreen = false\n const autoFullscreen = _formData.value?.config?.autoFullscreen !== false\n if (props.dialog?.width) {\n defaultFullscreen = props.dialog?.fullscreen\n }\n if (_formData.value?.config?.fullscreen) {\n defaultFullscreen = _formData.value?.config?.fullscreen\n }\n\n if (width.value < 768 && autoFullscreen) {\n defaultFullscreen = true\n }\n\n return defaultFullscreen\n})\n\nconst dialogProps = computed(() => {\n return Object.assign(props.dialog, _formData.value?.config?.dialog)\n})\nconst setFormData = (formData: any) => {\n value.value = null\n _formData.value = formData\n}\n\nconst initFormData = (formUrl?: string | object) => {\n if (!formUrl) {\n formUrl = props.formUrl\n }\n\n if (props.formData) {\n loading.value = false\n } else if (formUrl) {\n let data: {}\n if (isObject(formUrl)) {\n data = formUrl\n } else {\n data = {\n url: formUrl,\n method: 'post',\n }\n }\n request(data)\n .then((res) => {\n _formData.value = res.data\n loading.value = false\n })\n .catch((res) => {\n loading.value = false\n })\n }\n}\n\nconst checkForm = () => {\n fApi.value\n .validate()\n .then(() => {\n fApi.value\n .submit((data: any) => {\n onSubmit(data)\n })\n .catch((fail: object) => {\n ElMessage.warning(Object.values(fail)[0][0].message)\n })\n })\n .catch((fail: object) => {\n ElMessage.warning(Object.values(fail)[0][0].message)\n })\n}\n\nconst onSubmit = (data: any) => {\n if (props.isLoading) {\n buttonLoading.value = true\n }\n if (props.isSubmit) {\n request({\n url: props.path + _formData.value.action,\n method: _formData.value.method,\n data: { formData: data },\n })\n .then((res) => {\n ElMessage.success(res.msg)\n emit('submit', data, res)\n buttonLoading.value = false\n })\n .catch((res) => {\n ElMessage.error(res.msg)\n emit('fail', data, res)\n buttonLoading.value = false\n })\n } else {\n emit('submit', data)\n buttonLoading.value = false\n }\n showDialog.value = false\n}\n\nconst show = () => {\n showDialog.value = true\n}\nonMounted(() => {\n initFormData()\n})\n// 导出\ndefineExpose({\n showDialog,\n buttonLoading,\n fApi,\n value,\n show,\n checkForm,\n onSubmit,\n initFormData,\n setFormData,\n})\n</script>\n"],"names":["__MACROS_defineComponent","value","config","_config","draggable"],"mappings":";;;;;;;;;AAEA,MAA6B,cAAAA,eAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,QAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AA8DD,IAAA,MAAM,CAAC,CAAA,EAAG,GAAG,CAAA,GAAI,gBAAgB,MAAM,CAAA,CAAA;AAEvC,IAAA,UAAA,CAAW,QAAS,CAAA;AAAA,MAClB,IAAM,EAAA,MAAA;AAAA,MACN,IAAK,CAAA,EAAE,KAAAC,EAAAA,MAAAA,IAAS,IAAM,EAAA;AAEpB,QAAI,IAAA,CAAC,OAAQA,CAAAA,MAAK,CAAG,EAAA;AACnB,UAAAA,MAAAA,GAAQ,CAACA,MAAK,CAAA,CAAA;AAAA,SAChB;AACA,QAAA,IAAA,CAAK,MAAS,GAAA;AAAA,UACZ,IAAM,EAAA,GAAA;AAAA,UACN,QAAUA,EAAAA,MAAAA;AAAA,UACV,KAAO,EAAA,WAAA;AAAA,SACT,CAAA;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AAGD,IAAM,MAAA,UAAA,GAAa,WAAW,KAA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OACE,MAAA;AACL,QAAA,IAAA,CAAK,UAAU,IAAI,CAAA,CAAA;AACnB,QAAA,aAAA,CAAc,KAAQ,GAAA,KAAA,CAAA;AAAA,OACxB;AACA,MAAA,UAAA,CAAW,KAAQ,GAAA,KAAA,CAAA;AAAA,KACrB,CAAA;AAEA,IAAA,MAAM,OAAO,MAAM;AACjB,MAAA,UAAA,CAAW,KAAQ,GAAA,IAAA,CAAA;AAAA,KACrB,CAAA;AACA,IAAA,SAAA,CAAU,MAAM;AACd,MAAa,YAAA,EAAA,CAAA;AAAA,KACd,CAAA,CAAA;AAED,IAAa,QAAA,CAAA;AAAA,MACX,UAAA;AAAA,MACA,aAAA;AAAA,MACA,IAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAA;AAAA,MACA,WAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -11,7 +11,7 @@
11
11
  display: none;
12
12
  }
13
13
 
14
- .el-tabs__item{
14
+ .el-tabs__item {
15
15
  font-weight: 800;
16
16
  }
17
17
 
@@ -126,12 +126,11 @@
126
126
  height: calc(100vh - 240px);
127
127
 
128
128
  .el-tree-node-content {
129
- width:100%;
129
+ width: 100%;
130
130
  display: flex;
131
131
  align-items: center;
132
132
  justify-content: space-between;
133
133
  .close-rule {
134
-
135
134
  position: absolute;
136
135
  right: 0px;
137
136
  padding: 2px 10px;
@@ -145,7 +144,7 @@
145
144
  &:hover .close-rule {
146
145
  display: inline-flex;
147
146
  }
148
- ._fc-tree-node{
147
+ ._fc-tree-node {
149
148
  display: flex;
150
149
  align-items: center;
151
150
  justify-content: space-between;
@@ -154,9 +153,8 @@
154
153
  height: 26px;
155
154
  line-height: 26px;
156
155
  padding-right: 5px;
157
- ._fc-tree-icon{
156
+ ._fc-tree-icon {
158
157
  margin-right: 5px;
159
-
160
158
  }
161
159
  }
162
160
  }
@@ -236,8 +234,6 @@
236
234
  width: calc(100% - 800px);
237
235
  overflow: inherit !important;
238
236
 
239
-
240
-
241
237
  .el-tabs__nav {
242
238
  width: 100%;
243
239
  }
@@ -96,6 +96,16 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
96
96
  }
97
97
  return {};
98
98
  });
99
+ const draggable = vue.computed(() => {
100
+ let draggable2 = false;
101
+ if (props.dialog?.draggable) {
102
+ draggable2 = props.dialog?.draggable;
103
+ }
104
+ if (_formData.value?.config?.draggable !== void 0) {
105
+ draggable2 = _formData.value?.config?.draggable;
106
+ }
107
+ return draggable2;
108
+ });
99
109
  const isFullscreen = vue.computed(() => {
100
110
  let defaultFullscreen = false;
101
111
  const autoFullscreen = _formData.value?.config?.autoFullscreen !== false;
@@ -205,6 +215,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
205
215
  "min-height": "200px"
206
216
  }, dialogProps.value, {
207
217
  "max-height": "auto",
218
+ draggable: draggable.value,
208
219
  "append-to-body": ""
209
220
  }), {
210
221
  default: vue.withCtx(() => [
@@ -256,7 +267,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
256
267
  ]),
257
268
  _: 3
258
269
  /* FORWARDED */
259
- }, 16, ["modelValue", "title", "width", "default-fullscreen"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
270
+ }, 16, ["modelValue", "title", "width", "default-fullscreen", "draggable"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
260
271
  vue.createElementVNode(
261
272
  "div",
262
273
  {
@@ -1 +1 @@
1
- {"version":3,"file":"form.vue2.js","sources":["../../../src/form/src/form.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkForm',\n});\n</script>\n<template>\n <DkDialog\n v-if=\"props.isDialog\"\n v-model=\"showDialog\"\n :title=\"_formData?.title ? _formData?.title : '表单'\"\n :width=\"dialogWidth\"\n :default-fullscreen=\"isFullscreen\"\n min-height=\"200px\"\n v-bind=\"dialogProps\"\n max-height=\"auto\"\n append-to-body\n >\n <div :style=\"dialogStyle\" class=\"dk-form p10px\">\n <FormCreate\n v-model=\"value\"\n :option=\"formConfig\"\n :rule=\"_formData.rules\"\n :handle-icon=\"false\"\n class=\"formBox\"\n @update:api=\"fApi = $event\"\n @update:value=\"value = $event\"\n />\n <div :style=\"{ marginLeft: config.form.labelWidth }\" class=\"m-t-10px\">\n <slot name=\"buttons\">\n <el-button type=\"primary\" :loading=\"buttonLoading\" @click=\"checkForm\"> 提交</el-button>\n </slot>\n </div>\n </div>\n </DkDialog>\n <div v-else>\n <div :style=\"{ minHeight }\" class=\"dk-form\">\n <FormCreate\n v-model=\"value\"\n :option=\"formConfig\"\n :rule=\"_formData.rules\"\n :handle-icon=\"false\"\n class=\"formBox\"\n @update:api=\"fApi = $event\"\n @update:value=\"value = $event\"\n />\n <div :style=\"{ marginLeft: config.form.labelWidth }\" class=\"m-t-10px\">\n <slot name=\"buttons\">\n <el-button type=\"primary\" :loading=\"buttonLoading\" @click=\"checkForm\"> 提交</el-button>\n </slot>\n </div>\n </div>\n <!-- <div v-else :style=\"{ minHeight }\"></div>-->\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { createNamespace, isArray, isObject, request } from '@vipl520/utils'\nimport formCreate from '@form-create/element-ui'\nimport { formProps } from './props'\nimport { computed, onMounted, reactive, ref, watch } from 'vue'\nimport _config from './config'\nimport { ElButton, ElMessage } from 'element-plus'\nimport { useWindowSize } from '@vueuse/core'\n\nconst [_, bem] = createNamespace('form')\n\nformCreate.register({\n name: 'help',\n init({ value }, rule) {\n // 判断value是字符串还是数组,如果是字符串则转换为数组,如果是数组则不变\n if (!isArray(value)) {\n value = [value]\n }\n rule.suffix = {\n type: 'p',\n children: value,\n class: 'form-help',\n }\n },\n})\n\n\nconst FormCreate = formCreate.$form()\n\nconst props = defineProps(formProps)\n\nconst config = reactive(_config)\nconst fApi = ref()\nconst loading = ref(true)\nconst buttonLoading = ref(false)\n\nconst showDialog = ref(false)\nconst { width } = useWindowSize()\n\nconst formConfig = computed(() => {\n const _config = config\n if (width.value < 768) {\n _config.form.labelPosition = 'top'\n _config.form.size = 'small'\n } else {\n _config.form.labelPosition = 'left'\n _config.form.size = 'default'\n }\n return { ..._config, ...props.extraConfig }\n})\nconst value = ref(null)\nconst _formData = ref(props.formData || {})\n\nconst emit = defineEmits(['submit', 'fail', 'update:modelValue'])\nwatch(\n () => props.formData,\n () => {\n _formData.value = props.formData\n },\n {\n deep: true,\n }\n)\nwatch(\n () => value.value,\n (val) => {\n emit('update:modelValue', val || {})\n }\n)\n// 弹窗宽度\nconst dialogWidth = computed(() => {\n let defaultWidth = '800px'\n const config = _formData.value?.config || {}\n if (config?.width) {\n return config?.width\n }\n if (props.dialog?.width) {\n defaultWidth = props.dialog?.width\n }\n if (config?.defaultWidth) {\n defaultWidth = config?.defaultWidth\n }\n let minWidth = 768\n // 判断是否为百分比\n if (!defaultWidth.endsWith('%')) {\n minWidth = parseInt(defaultWidth)\n }\n return width.value < minWidth ? '100%' : defaultWidth\n})\n// 弹窗内样式\nconst dialogStyle = computed(() => {\n if (_formData.value?.config?.style) {\n return _formData.value?.config?.style\n }\n if (props.dialog?.style) {\n return props.dialog?.style\n }\n return {}\n})\n// const draggable = computed(() => {\n// let draggable = false\n// if (props.dialog?.draggable) {\n// draggable = props.dialog?.draggable\n// }\n// if (_formData.value?.config?.draggable !== undefined) {\n// draggable = _formData.value?.config?.draggable\n// }\n// return draggable\n// })\n// 是否全屏\nconst isFullscreen = computed(() => {\n let defaultFullscreen = false\n const autoFullscreen = _formData.value?.config?.autoFullscreen !== false\n if (props.dialog?.width) {\n defaultFullscreen = props.dialog?.fullscreen\n }\n if (_formData.value?.config?.fullscreen) {\n defaultFullscreen = _formData.value?.config?.fullscreen\n }\n\n if (width.value < 768 && autoFullscreen) {\n defaultFullscreen = true\n }\n\n return defaultFullscreen\n})\n\nconst dialogProps = computed(() => {\n return Object.assign(props.dialog, _formData.value?.config?.dialog)\n})\nconst setFormData = (formData: any) => {\n value.value = null\n _formData.value = formData\n}\n\nconst initFormData = (formUrl?: string | object) => {\n if (!formUrl) {\n formUrl = props.formUrl\n }\n\n if (props.formData) {\n loading.value = false\n } else if (formUrl) {\n let data: {}\n if (isObject(formUrl)) {\n data = formUrl\n } else {\n data = {\n url: formUrl,\n method: 'post',\n }\n }\n request(data)\n .then((res) => {\n _formData.value = res.data\n loading.value = false\n })\n .catch((res) => {\n loading.value = false\n })\n }\n}\n\nconst checkForm = () => {\n fApi.value\n .validate()\n .then(() => {\n fApi.value\n .submit((data: any) => {\n onSubmit(data)\n })\n .catch((fail: object) => {\n ElMessage.warning(Object.values(fail)[0][0].message)\n })\n })\n .catch((fail: object) => {\n ElMessage.warning(Object.values(fail)[0][0].message)\n })\n}\n\nconst onSubmit = (data: any) => {\n if (props.isLoading) {\n buttonLoading.value = true\n }\n if (props.isSubmit) {\n request({\n url: props.path + _formData.value.action,\n method: _formData.value.method,\n data: { formData: data },\n })\n .then((res) => {\n ElMessage.success(res.msg)\n emit('submit', data, res)\n buttonLoading.value = false\n })\n .catch((res) => {\n ElMessage.error(res.msg)\n emit('fail', data, res)\n buttonLoading.value = false\n })\n } else {\n emit('submit', data)\n buttonLoading.value = false\n }\n showDialog.value = false\n}\n\nconst show = () => {\n showDialog.value = true\n}\nonMounted(() => {\n initFormData()\n})\n// 导出\ndefineExpose({\n showDialog,\n buttonLoading,\n fApi,\n value,\n show,\n checkForm,\n onSubmit,\n initFormData,\n setFormData,\n})\n</script>\n"],"names":["__MACROS_defineComponent","createNamespace","value","isArray","config","reactive","_config","ref","useWindowSize","computed","watch","isObject","request","ElMessage","onMounted"],"mappings":";;;;;;;;;;;;;AAEA,MAA6B,cAAAA,mBAAyB,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,GAAQ,KAAA;AACd,UAAUA,qBAAA,CAAA,KAAA,CAAM,IAAI,GAAG,CAAA,CAAA;AACvB,UAAK,IAAA,CAAA,MAAA,EAAQ,MAAM,GAAG,CAAA,CAAA;AACtB,UAAA,aAAA,CAAc,KAAQ,GAAA,KAAA,CAAA;AAAA,SACvB,CAAA,CAAA;AAAA,OACE,MAAA;AACL,QAAA,IAAA,CAAK,UAAU,IAAI,CAAA,CAAA;AACnB,QAAA,aAAA,CAAc,KAAQ,GAAA,KAAA,CAAA;AAAA,OACxB;AACA,MAAA,UAAA,CAAW,KAAQ,GAAA,KAAA,CAAA;AAAA,KACrB,CAAA;AAEA,IAAA,MAAM,OAAO,MAAM;AACjB,MAAA,UAAA,CAAW,KAAQ,GAAA,IAAA,CAAA;AAAA,KACrB,CAAA;AACA,IAAAC,aAAA,CAAU,MAAM;AACd,MAAa,YAAA,EAAA,CAAA;AAAA,KACd,CAAA,CAAA;AAED,IAAa,QAAA,CAAA;AAAA,MACX,UAAA;AAAA,MACA,aAAA;AAAA,MACA,IAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAA;AAAA,MACA,WAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"form.vue2.js","sources":["../../../src/form/src/form.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkForm',\n});\n</script>\n<template>\n <DkDialog\n v-if=\"props.isDialog\"\n v-model=\"showDialog\"\n :title=\"_formData?.title ? _formData?.title : '表单'\"\n :width=\"dialogWidth\"\n :default-fullscreen=\"isFullscreen\"\n min-height=\"200px\"\n v-bind=\"dialogProps\"\n max-height=\"auto\"\n :draggable=\"draggable\"\n append-to-body\n >\n <div :style=\"dialogStyle\" class=\"dk-form p10px\">\n <FormCreate\n v-model=\"value\"\n :option=\"formConfig\"\n :rule=\"_formData.rules\"\n :handle-icon=\"false\"\n class=\"formBox\"\n @update:api=\"fApi = $event\"\n @update:value=\"value = $event\"\n />\n <div :style=\"{ marginLeft: config.form.labelWidth }\" class=\"m-t-10px\">\n <slot name=\"buttons\">\n <el-button type=\"primary\" :loading=\"buttonLoading\" @click=\"checkForm\"> 提交</el-button>\n </slot>\n </div>\n </div>\n </DkDialog>\n <div v-else>\n <div :style=\"{ minHeight }\" class=\"dk-form\">\n <FormCreate\n v-model=\"value\"\n :option=\"formConfig\"\n :rule=\"_formData.rules\"\n :handle-icon=\"false\"\n class=\"formBox\"\n @update:api=\"fApi = $event\"\n @update:value=\"value = $event\"\n />\n <div :style=\"{ marginLeft: config.form.labelWidth }\" class=\"m-t-10px\">\n <slot name=\"buttons\">\n <el-button type=\"primary\" :loading=\"buttonLoading\" @click=\"checkForm\"> 提交</el-button>\n </slot>\n </div>\n </div>\n <!-- <div v-else :style=\"{ minHeight }\"></div>-->\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { createNamespace, isArray, isObject, request } from '@vipl520/utils'\nimport formCreate from '@form-create/element-ui'\nimport { formProps } from './props'\nimport { computed, onMounted, reactive, ref, watch } from 'vue'\nimport _config from './config'\nimport { ElButton, ElMessage } from 'element-plus'\nimport { useWindowSize } from '@vueuse/core'\n\nconst [_, bem] = createNamespace('form')\n\nformCreate.register({\n name: 'help',\n init({ value }, rule) {\n // 判断value是字符串还是数组,如果是字符串则转换为数组,如果是数组则不变\n if (!isArray(value)) {\n value = [value]\n }\n rule.suffix = {\n type: 'p',\n children: value,\n class: 'form-help',\n }\n },\n})\n\n\nconst FormCreate = formCreate.$form()\n\nconst props = defineProps(formProps)\n\nconst config = reactive(_config)\nconst fApi = ref()\nconst loading = ref(true)\nconst buttonLoading = ref(false)\n\nconst showDialog = ref(false)\nconst { width } = useWindowSize()\n\nconst formConfig = computed(() => {\n const _config = config\n if (width.value < 768) {\n _config.form.labelPosition = 'top'\n _config.form.size = 'small'\n } else {\n _config.form.labelPosition = 'left'\n _config.form.size = 'default'\n }\n return { ..._config, ...props.extraConfig }\n})\nconst value = ref(null)\nconst _formData = ref(props.formData || {})\n\nconst emit = defineEmits(['submit', 'fail', 'update:modelValue'])\nwatch(\n () => props.formData,\n () => {\n _formData.value = props.formData\n },\n {\n deep: true,\n }\n)\nwatch(\n () => value.value,\n (val) => {\n emit('update:modelValue', val || {})\n }\n)\n// 弹窗宽度\nconst dialogWidth = computed(() => {\n let defaultWidth = '800px'\n const config = _formData.value?.config || {}\n if (config?.width) {\n return config?.width\n }\n if (props.dialog?.width) {\n defaultWidth = props.dialog?.width\n }\n if (config?.defaultWidth) {\n defaultWidth = config?.defaultWidth\n }\n let minWidth = 768\n // 判断是否为百分比\n if (!defaultWidth.endsWith('%')) {\n minWidth = parseInt(defaultWidth)\n }\n return width.value < minWidth ? '100%' : defaultWidth\n})\n// 弹窗内样式\nconst dialogStyle = computed(() => {\n if (_formData.value?.config?.style) {\n return _formData.value?.config?.style\n }\n if (props.dialog?.style) {\n return props.dialog?.style\n }\n return {}\n})\nconst draggable = computed(() => {\n let draggable = false\n if (props.dialog?.draggable) {\n draggable = props.dialog?.draggable\n }\n if (_formData.value?.config?.draggable !== undefined) {\n draggable = _formData.value?.config?.draggable\n }\n return draggable\n})\n// 是否全屏\nconst isFullscreen = computed(() => {\n let defaultFullscreen = false\n const autoFullscreen = _formData.value?.config?.autoFullscreen !== false\n if (props.dialog?.width) {\n defaultFullscreen = props.dialog?.fullscreen\n }\n if (_formData.value?.config?.fullscreen) {\n defaultFullscreen = _formData.value?.config?.fullscreen\n }\n\n if (width.value < 768 && autoFullscreen) {\n defaultFullscreen = true\n }\n\n return defaultFullscreen\n})\n\nconst dialogProps = computed(() => {\n return Object.assign(props.dialog, _formData.value?.config?.dialog)\n})\nconst setFormData = (formData: any) => {\n value.value = null\n _formData.value = formData\n}\n\nconst initFormData = (formUrl?: string | object) => {\n if (!formUrl) {\n formUrl = props.formUrl\n }\n\n if (props.formData) {\n loading.value = false\n } else if (formUrl) {\n let data: {}\n if (isObject(formUrl)) {\n data = formUrl\n } else {\n data = {\n url: formUrl,\n method: 'post',\n }\n }\n request(data)\n .then((res) => {\n _formData.value = res.data\n loading.value = false\n })\n .catch((res) => {\n loading.value = false\n })\n }\n}\n\nconst checkForm = () => {\n fApi.value\n .validate()\n .then(() => {\n fApi.value\n .submit((data: any) => {\n onSubmit(data)\n })\n .catch((fail: object) => {\n ElMessage.warning(Object.values(fail)[0][0].message)\n })\n })\n .catch((fail: object) => {\n ElMessage.warning(Object.values(fail)[0][0].message)\n })\n}\n\nconst onSubmit = (data: any) => {\n if (props.isLoading) {\n buttonLoading.value = true\n }\n if (props.isSubmit) {\n request({\n url: props.path + _formData.value.action,\n method: _formData.value.method,\n data: { formData: data },\n })\n .then((res) => {\n ElMessage.success(res.msg)\n emit('submit', data, res)\n buttonLoading.value = false\n })\n .catch((res) => {\n ElMessage.error(res.msg)\n emit('fail', data, res)\n buttonLoading.value = false\n })\n } else {\n emit('submit', data)\n buttonLoading.value = false\n }\n showDialog.value = false\n}\n\nconst show = () => {\n showDialog.value = true\n}\nonMounted(() => {\n initFormData()\n})\n// 导出\ndefineExpose({\n showDialog,\n buttonLoading,\n fApi,\n value,\n show,\n checkForm,\n onSubmit,\n initFormData,\n setFormData,\n})\n</script>\n"],"names":["__MACROS_defineComponent","createNamespace","value","isArray","config","reactive","_config","ref","useWindowSize","computed","watch","draggable","isObject","request","ElMessage","onMounted"],"mappings":";;;;;;;;;;;;;AAEA,MAA6B,cAAAA,mBAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,QAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AA8DD,IAAA,MAAM,CAAC,CAAA,EAAG,GAAG,CAAA,GAAIC,sBAA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@@ -11,7 +11,7 @@
11
11
  display: none;
12
12
  }
13
13
 
14
- .el-tabs__item{
14
+ .el-tabs__item {
15
15
  font-weight: 800;
16
16
  }
17
17
 
@@ -126,12 +126,11 @@
126
126
  height: calc(100vh - 240px);
127
127
 
128
128
  .el-tree-node-content {
129
- width:100%;
129
+ width: 100%;
130
130
  display: flex;
131
131
  align-items: center;
132
132
  justify-content: space-between;
133
133
  .close-rule {
134
-
135
134
  position: absolute;
136
135
  right: 0px;
137
136
  padding: 2px 10px;
@@ -145,7 +144,7 @@
145
144
  &:hover .close-rule {
146
145
  display: inline-flex;
147
146
  }
148
- ._fc-tree-node{
147
+ ._fc-tree-node {
149
148
  display: flex;
150
149
  align-items: center;
151
150
  justify-content: space-between;
@@ -154,9 +153,8 @@
154
153
  height: 26px;
155
154
  line-height: 26px;
156
155
  padding-right: 5px;
157
- ._fc-tree-icon{
156
+ ._fc-tree-icon {
158
157
  margin-right: 5px;
159
-
160
158
  }
161
159
  }
162
160
  }
@@ -236,8 +234,6 @@
236
234
  width: calc(100% - 800px);
237
235
  overflow: inherit !important;
238
236
 
239
-
240
-
241
237
  .el-tabs__nav {
242
238
  width: 100%;
243
239
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vipl520/dk-ui",
3
- "version": "1.0.63",
3
+ "version": "1.0.64",
4
4
  "description": "多客怪兽框架核心组件,支持diy、crud动态表格、上传组件等",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.mjs",