fx-platform-ui 0.0.13-alpha9 → 1.0.1

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.
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <div>
3
+ <Modal
4
+ ref="confirmRef"
5
+ class="pl-confirm-info"
6
+ v-bind="getProps"
7
+ @ok="handleOnOk"
8
+ @cancel="handleOnCancel"
9
+ >
10
+ <div>
11
+ <span>{{ getProps.content }}</span>
12
+ </div>
13
+ <template #footer>
14
+ <div class="pl-confirm-footer">
15
+ <div
16
+ v-if="getProps.cancelShow"
17
+ class="pl-confirm-flex pl-confirm-cancel"
18
+ >
19
+ <AButton
20
+ type="link"
21
+ style="color: #666"
22
+ v-bind="getProps.cancelButtonProps"
23
+ @click="handleOnCancel"
24
+ >{{ getProps.cancelText ?? '取消' }}</AButton
25
+ >
26
+ </div>
27
+ <div v-if="getProps.okShow" class="pl-confirm-flex pl-confirm-ok">
28
+ <AButton
29
+ type="link"
30
+ v-bind="getProps.okButtonProps"
31
+ :loading="getProps.confirmLoading"
32
+ @click="handleOnOk"
33
+ >{{ getProps.okText ?? '确定' }}</AButton
34
+ >
35
+ </div>
36
+ </div>
37
+ </template>
38
+ </Modal>
39
+ </div>
40
+ </template>
41
+ <script lang="tsx" setup>
42
+ import { computed, ref } from 'vue'
43
+ import { Modal } from 'ant-design-vue'
44
+ import { isFunction } from '../../../utils/is'
45
+ import { platConfirmProps } from './plat-confirm-props'
46
+ defineOptions({
47
+ name: 'PlConfirm'
48
+ })
49
+ const props = defineProps(platConfirmProps)
50
+ const confirmRef = ref(null)
51
+ const getProps = computed(() => props as Recordable)
52
+ const handleOnOk = async () => {
53
+ if (isFunction(props.onOk)) {
54
+ const res = await props.onOk()
55
+ if (res) {
56
+ props.close!()
57
+ }
58
+ } else {
59
+ await props.close!()
60
+ }
61
+ }
62
+ const handleOnCancel = async () => {
63
+ if (isFunction(props.onCancel)) {
64
+ const res = await props.onCancel()
65
+ if (res) {
66
+ await props.close!()
67
+ }
68
+ } else {
69
+ await props.close!()
70
+ }
71
+ }
72
+ </script>
73
+ <style lang="less">
74
+ @import 'index.module';
75
+ </style>
@@ -0,0 +1,61 @@
1
+ .pl-confirm-info {
2
+ .ant-modal-content {
3
+ border-radius: 10px;
4
+ }
5
+ .ant-modal-header {
6
+ border-radius: 10px;
7
+ border-bottom: 0;
8
+ padding: 24px 24px 0 24px;
9
+ text-align: center;
10
+ .ant-modal-title {
11
+ font-weight: 500;
12
+ font-size: 20px;
13
+ color: #222;
14
+ }
15
+ }
16
+ .ant-modal-body {
17
+ padding: 40px 24px;
18
+ font-size: 16px;
19
+ font-weight: 400;
20
+ text-align: center;
21
+ }
22
+ .ant-modal-footer {
23
+ padding: 0;
24
+ height: 58px;
25
+ .pl-confirm-footer {
26
+ display: flex;
27
+ align-items: center;
28
+ font-size: 16px;
29
+ color: #409eff;
30
+ position: relative;
31
+ height: 100%;
32
+ .pl-confirm-flex {
33
+ display: flex;
34
+ justify-content: center;
35
+ flex: 1;
36
+ }
37
+ }
38
+ .ant-btn {
39
+ font-size: 16px;
40
+ width: 100%;
41
+ height: 100%;
42
+ }
43
+ .pl-confirm-cancel:before {
44
+ position: absolute;
45
+ box-sizing: border-box;
46
+ content: ' ';
47
+ pointer-events: none;
48
+ top: -50%;
49
+ bottom: -50%;
50
+ left: 50%;
51
+ transform: scale(0.5);
52
+ border-right: 1px solid #f0f0f0;
53
+ color: #f0f0f0;
54
+ }
55
+ .pl-flex {
56
+ display: flex;
57
+ justify-content: center;
58
+ align-items: center;
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,91 @@
1
+ import { createVNode, render as vueRender } from 'vue'
2
+ import PlConfirm from './confirm.vue'
3
+ import type { PlatConfirmProps } from './plat-confirm-props'
4
+
5
+ const confirm = (props: any) => {
6
+ let confirmDialogInstance: any = null
7
+ const container = document.createDocumentFragment()
8
+ const close = (data?, args?) => {
9
+ currentConfig = {
10
+ ...currentConfig,
11
+ visible: false,
12
+ afterClose: () => {
13
+ if (typeof props.afterClose === 'function') {
14
+ props.afterClose()
15
+ }
16
+ destroy.apply(data, args)
17
+ }
18
+ }
19
+ update(currentConfig)
20
+ }
21
+ let currentConfig = {
22
+ maskClosable: false,
23
+ visible: true,
24
+ close,
25
+ type: 'info',
26
+ centered: true,
27
+ closable: false,
28
+ width: '360px',
29
+ height: '225px',
30
+ ...props
31
+ }
32
+ const destroy = (...args) => {
33
+ if (confirmDialogInstance) {
34
+ // destroy
35
+ vueRender(null, container as any)
36
+ confirmDialogInstance.component.update()
37
+ confirmDialogInstance = null
38
+ }
39
+ const triggerCancel = args.some((param) => param && param.triggerCancel)
40
+ if (props.onCancel && triggerCancel) {
41
+ props.onCancel(...args)
42
+ }
43
+ }
44
+ const update = (configUpdate: PlatConfirmProps) => {
45
+ currentConfig = {
46
+ ...currentConfig,
47
+ ...configUpdate
48
+ }
49
+ if (confirmDialogInstance) {
50
+ Object.assign(confirmDialogInstance.component.props, currentConfig)
51
+ confirmDialogInstance.component.update()
52
+ }
53
+ }
54
+ const Wrapper = (p) => {
55
+ return <PlConfirm {...p}></PlConfirm>
56
+ }
57
+ const render = (arg: PlatConfirmProps) => {
58
+ console.log(arg)
59
+ const vm = createVNode(Wrapper, { ...arg })
60
+ vm.appContext = props.parentContext || props.appContext || vm.appContext
61
+ vueRender(vm, container as any)
62
+ return vm
63
+ }
64
+ confirmDialogInstance = render(currentConfig)
65
+ return {
66
+ destroy: close,
67
+ update
68
+ }
69
+ }
70
+
71
+ const info = (props) => {
72
+ return {
73
+ okShow: true,
74
+ cancelShow: true,
75
+ ...props
76
+ }
77
+ }
78
+
79
+ // const PlConfirm = {
80
+ // info: (props) => {
81
+ // return confirm(info(props))
82
+ // }
83
+ // }
84
+
85
+ // PlConfirm.install = function (app: App) {
86
+ // app.component(Modal.name, Modal)
87
+ // return app
88
+ // }
89
+ PlConfirm.info = (props) => confirm(info(props))
90
+
91
+ export default PlConfirm
@@ -0,0 +1,39 @@
1
+ import { VNode, PropType, ExtractPropTypes } from 'vue'
2
+ import { modalProps } from 'ant-design-vue/es/modal/Modal'
3
+
4
+ export const platConfirmProps = {
5
+ ...modalProps(),
6
+ okShow: {
7
+ type: Boolean,
8
+ default: true
9
+ },
10
+ cancelShow: {
11
+ type: Boolean,
12
+ default: true
13
+ },
14
+ // 内容
15
+ content: {
16
+ type: [Object, String] as PropType<VNode | string>,
17
+ default: null
18
+ },
19
+ // 关闭函数
20
+ onCancel: {
21
+ type: Function as PropType<() => Promise<any>>
22
+ },
23
+ // 确认函数
24
+ onOk: {
25
+ type: Function as PropType<() => Promise<any>>
26
+ },
27
+ // 销毁函数
28
+ destroy: {
29
+ type: Function as PropType<(() => Promise<any>) | undefined>,
30
+ default: null
31
+ },
32
+ close: {
33
+ type: Function as PropType<() => Promise<any>>
34
+ }
35
+ }
36
+
37
+ export type PlatConfirmProps = Partial<
38
+ ExtractPropTypes<typeof platConfirmProps>
39
+ >
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="fx-editor">
3
- <!-- <editor v-model="modelValue" :init="init" :disabled="disabled"></editor>-->
3
+ <editor v-model="modelValue" :init="init" :disabled="disabled"></editor>
4
4
  </div>
5
5
  </template>
6
6
 
@@ -8,6 +8,7 @@
8
8
  import { onMounted, watch, ref } from 'vue'
9
9
  //在js中引入所需的主题和组件
10
10
  import tinymce from 'tinymce/tinymce'
11
+
11
12
  import 'tinymce/skins/content/default/content.css'
12
13
  import Editor from '@tinymce/tinymce-vue'
13
14
  import 'tinymce/themes/silver'
@@ -34,6 +35,7 @@ import 'tinymce/plugins/anchor'
34
35
  import { platEditorProps } from './plat-editor-props'
35
36
  import { platEditorEmits } from './plat-editor-emits'
36
37
  import { useEditorState } from './hook'
38
+
37
39
  defineOptions({
38
40
  name: 'PlEditor'
39
41
  })
@@ -32,7 +32,7 @@
32
32
  size="small"
33
33
  @click="toggleAdvanced"
34
34
  >
35
- <BasicArrow class="ml-1" :expand="!isAdvanced" />
35
+ <!-- <BasicArrow class="ml-1" :expand="!isAdvanced" />-->
36
36
  </AButton>
37
37
  </FormItem>
38
38
  </div>
@@ -13,7 +13,8 @@ import {
13
13
  Tree,
14
14
  Slider,
15
15
  Rate,
16
- Divider
16
+ Divider,
17
+ Textarea
17
18
  } from 'ant-design-vue'
18
19
 
19
20
  import type {
@@ -26,7 +27,8 @@ import type {
26
27
  TimePickerProps,
27
28
  TreeProps,
28
29
  TreeSelectProps,
29
- RadioGroupProps
30
+ RadioGroupProps,
31
+ TextAreaProps
30
32
  } from 'ant-design-vue'
31
33
 
32
34
  import type { RenderCallbackParams } from './form'
@@ -46,6 +48,7 @@ export type ComponentProps = (
46
48
  | TreeProps
47
49
  | TreeSelectProps
48
50
  | RadioGroupProps
51
+ | TextAreaProps
49
52
  ) & {
50
53
  /** 组件异步请求数据 */
51
54
  request?: PromiseFn<RenderCallbackParams, any>
@@ -161,7 +164,8 @@ export const componentMap = {
161
164
  RangePicker: DatePicker.RangePicker,
162
165
  WeekPicker: DatePicker.WeekPicker,
163
166
  TimePicker,
164
- Divider
167
+ Divider,
168
+ Textarea
165
169
  }
166
170
 
167
171
  export type ComponentMapType = keyof typeof componentMap
@@ -109,7 +109,7 @@ export const useTableMethods = ({
109
109
  // @ts-ignore
110
110
  Object.assign(unref(paginationRef), pagination || {})
111
111
  await fetchData(params, rest)
112
- emit('change', ...rest)
112
+ emit('handleChange', ...rest)
113
113
  }
114
114
 
115
115
  // 获取表格列key
@@ -1,3 +1,3 @@
1
- export const platTableEmits = ['change']
1
+ export const platTableEmits = ['handleChange']
2
2
 
3
3
  export type PlatTableEmits = typeof platTableEmits
package/CHANGELOG.md DELETED
@@ -1,46 +0,0 @@
1
- ---
2
- title: '更新日志'
3
- lang: zh-CN
4
- ---
5
-
6
-
7
-
8
- ## 版本日志
9
-
10
- ## [0.0.12] - 2022-11-21
11
- ### 新增
12
- * 新增 `PlEditor`组件, 添加 富文本组件 该组件可在`PLform`使用
13
- * 新增 `PlTable`组件里 `setProps`方法用来动态添加`PlTable的props`
14
-
15
- ## [0.0.11] - 2022-11-11
16
- ### 新增
17
- * 新增 `PlTable`组件, 添加 分页dom`updatePageVnode`方法
18
-
19
- ## [0.0.10] - 2022-11-10
20
- ### 修改
21
- * 修改 `PlForm`组件, 解决无法传入官方`ant-design -vue`的Form API
22
-
23
- ## [0.0.9] - 2022-11-9
24
- ### 新增
25
- * 新增 `PlTable`组件, 添加针对`table`的显示隐藏属性`tableShow`
26
-
27
- ## [0.0.8] - 2022-11-4
28
- ### 新增、修改
29
- * 新增 `PlTable`组件, 添加`pin-manager-table`案例
30
- * 新增 `PlTable`组件里`actions`,添加`componentType`,解决操作列可能是文本的情况
31
- * 修改 `PlForm`组件,表单每一项,默认不清空
32
- * 修改 `PlForm`组件,表单操作按钮"是否隐藏" `bug`
33
-
34
- ## [0.0.7] - 2022-10-28
35
- ### 修改
36
- * 修改 `PlTable` 组件,添加ref属性,获取table里所有方法
37
-
38
- ## [0.0.6] - 2022-10-25
39
- ### 新增
40
- * 新增 `PlArea` 组件
41
-
42
- ## [0.0.5] - 2022-10-14
43
- ### 新增
44
- * 新增 `PlForm`, `PlTable` 组件
45
-
46
- ...