@nocobase/client 0.5.0-alpha.17 → 0.5.0-alpha.21
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/lib/ClientSDK.d.ts.map +1 -1
- package/lib/ClientSDK.js.map +1 -1
- package/lib/ConfigProvider.d.ts.map +1 -1
- package/lib/ConfigProvider.js +0 -1
- package/lib/ConfigProvider.js.map +1 -1
- package/lib/components/Sortable/index.d.ts.map +1 -1
- package/lib/components/Sortable/index.js.map +1 -1
- package/lib/components/admin-layout/Collections/index.d.ts.map +1 -1
- package/lib/components/admin-layout/Collections/index.js +11 -4
- package/lib/components/admin-layout/Collections/index.js.map +1 -1
- package/lib/components/admin-layout/More.d.ts.map +1 -1
- package/lib/components/admin-layout/More.js +1 -1
- package/lib/components/admin-layout/More.js.map +1 -1
- package/lib/components/admin-layout/Permissions/MenuPermissionTable.d.ts.map +1 -1
- package/lib/components/admin-layout/Permissions/MenuPermissionTable.js.map +1 -1
- package/lib/components/admin-layout/Permissions/index.d.ts.map +1 -1
- package/lib/components/admin-layout/Permissions/index.js.map +1 -1
- package/lib/components/admin-layout/UserInfo.d.ts.map +1 -1
- package/lib/components/admin-layout/UserInfo.js.map +1 -1
- package/lib/components/admin-layout/index.d.ts.map +1 -1
- package/lib/components/admin-layout/index.js +31 -2
- package/lib/components/admin-layout/index.js.map +1 -1
- package/lib/components/admin-layout/style.less +6 -4
- package/lib/components/admin-layout/style.less.map +1 -1
- package/lib/components/router-config/index.d.ts.map +1 -1
- package/lib/components/router-config/index.js.map +1 -1
- package/lib/constate/Client.d.ts.map +1 -1
- package/lib/constate/Client.js +0 -1
- package/lib/constate/Client.js.map +1 -1
- package/lib/constate/Collections.d.ts +5 -23
- package/lib/constate/Collections.d.ts.map +1 -1
- package/lib/constate/Collections.js.map +1 -1
- package/lib/constate/DesignableSwitch.d.ts.map +1 -1
- package/lib/constate/DesignableSwitch.js.map +1 -1
- package/lib/context.d.ts +1 -1
- package/lib/context.d.ts.map +1 -1
- package/lib/context.js.map +1 -1
- package/lib/locale/en_US.d.ts.map +1 -1
- package/lib/locale/en_US.js.map +1 -1
- package/lib/locale/zh_CN.d.ts.map +1 -1
- package/lib/locale/zh_CN.js.map +1 -1
- package/lib/resource.d.ts +1 -0
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js +4 -2
- package/lib/resource.js.map +1 -1
- package/lib/schemas/action/index.d.ts.map +1 -1
- package/lib/schemas/action/index.js +24 -0
- package/lib/schemas/action/index.js.map +1 -1
- package/lib/schemas/action/style.less +3 -4
- package/lib/schemas/action/style.less.map +1 -1
- package/lib/schemas/add-new/index.d.ts.map +1 -1
- package/lib/schemas/add-new/index.js.map +1 -1
- package/lib/schemas/calendar/ActionBar.d.ts.map +1 -1
- package/lib/schemas/calendar/ActionBar.js.map +1 -1
- package/lib/schemas/calendar/designable.less +1 -1
- package/lib/schemas/calendar/designable.less.map +1 -1
- package/lib/schemas/calendar/index.d.ts.map +1 -1
- package/lib/schemas/calendar/index.js.map +1 -1
- package/lib/schemas/calendar/style2.less +1 -1
- package/lib/schemas/calendar/style2.less.map +1 -1
- package/lib/schemas/chart/G2Plot.d.ts.map +1 -1
- package/lib/schemas/chart/G2Plot.js.map +1 -1
- package/lib/schemas/color-select/index.d.ts.map +1 -1
- package/lib/schemas/color-select/index.js.map +1 -1
- package/lib/schemas/database-field/index.d.ts.map +1 -1
- package/lib/schemas/database-field/index.js.map +1 -1
- package/lib/schemas/database-field/interfaces/index.d.ts.map +1 -1
- package/lib/schemas/database-field/interfaces/index.js.map +1 -1
- package/lib/schemas/database-field/interfaces/percent.d.ts.map +1 -1
- package/lib/schemas/database-field/interfaces/percent.js.map +1 -1
- package/lib/schemas/database-field/interfaces/phone.d.ts.map +1 -1
- package/lib/schemas/database-field/interfaces/phone.js +1 -1
- package/lib/schemas/database-field/interfaces/phone.js.map +1 -1
- package/lib/schemas/database-field/interfaces/select.d.ts.map +1 -1
- package/lib/schemas/database-field/interfaces/select.js.map +1 -1
- package/lib/schemas/database-field/interfaces/subTable.d.ts.map +1 -1
- package/lib/schemas/database-field/interfaces/subTable.js +2 -1
- package/lib/schemas/database-field/interfaces/subTable.js.map +1 -1
- package/lib/schemas/database-field/style.less +1 -1
- package/lib/schemas/database-field/style.less.map +1 -1
- package/lib/schemas/date-picker/index.d.ts.map +1 -1
- package/lib/schemas/date-picker/index.js.map +1 -1
- package/lib/schemas/drag-and-drop/index.d.ts.map +1 -1
- package/lib/schemas/drag-and-drop/index.js.map +1 -1
- package/lib/schemas/filter/FilterItem.d.ts.map +1 -1
- package/lib/schemas/filter/FilterItem.js.map +1 -1
- package/lib/schemas/form/Field.DesignableBar.d.ts.map +1 -1
- package/lib/schemas/form/Field.DesignableBar.js +1 -1
- package/lib/schemas/form/Field.DesignableBar.js.map +1 -1
- package/lib/schemas/form/style.less +1 -1
- package/lib/schemas/form/style.less.map +1 -1
- package/lib/schemas/form-item/style.less +1 -1
- package/lib/schemas/form-item/style.less.map +1 -1
- package/lib/schemas/grid/style.less +1 -1
- package/lib/schemas/grid/style.less.map +1 -1
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js.map +1 -1
- package/lib/schemas/input/index.d.ts.map +1 -1
- package/lib/schemas/input/index.js.map +1 -1
- package/lib/schemas/input-number/style.less +1 -1
- package/lib/schemas/input-number/style.less.map +1 -1
- package/lib/schemas/kanban/CardDesignableBar.d.ts.map +1 -1
- package/lib/schemas/kanban/CardDesignableBar.js.map +1 -1
- package/lib/schemas/kanban/index.d.ts.map +1 -1
- package/lib/schemas/kanban/index.js.map +1 -1
- package/lib/schemas/kanban/style.less +9 -6
- package/lib/schemas/kanban/style.less.map +1 -1
- package/lib/schemas/markdown/style.less +1 -1
- package/lib/schemas/markdown/style.less.map +1 -1
- package/lib/schemas/menu/style.less +2 -2
- package/lib/schemas/menu/style.less.map +1 -1
- package/lib/schemas/page/index.d.ts.map +1 -1
- package/lib/schemas/page/index.js.map +1 -1
- package/lib/schemas/password/PasswordStrength.d.ts.map +1 -1
- package/lib/schemas/password/PasswordStrength.js.map +1 -1
- package/lib/schemas/radio/index.d.ts.map +1 -1
- package/lib/schemas/radio/index.js.map +1 -1
- package/lib/schemas/select/index.d.ts.map +1 -1
- package/lib/schemas/select/index.js.map +1 -1
- package/lib/schemas/table/SimpleDesignableBar.d.ts.map +1 -1
- package/lib/schemas/table/SimpleDesignableBar.js +8 -0
- package/lib/schemas/table/SimpleDesignableBar.js.map +1 -1
- package/lib/schemas/table/index.d.ts.map +1 -1
- package/lib/schemas/table/index.js +23 -20
- package/lib/schemas/table/index.js.map +1 -1
- package/lib/schemas/table/style.less +6 -6
- package/lib/schemas/table/style.less.map +1 -1
- package/lib/schemas/tabs/style.less +2 -3
- package/lib/schemas/tabs/style.less.map +1 -1
- package/lib/schemas/time-picker/index.d.ts.map +1 -1
- package/lib/schemas/time-picker/index.js.map +1 -1
- package/lib/schemas/tree-select/index.d.ts.map +1 -1
- package/lib/schemas/tree-select/index.js.map +1 -1
- package/lib/schemas/upload/placeholder.d.ts.map +1 -1
- package/lib/schemas/upload/placeholder.js.map +1 -1
- package/lib/schemas/upload/style.less +7 -4
- package/lib/schemas/upload/style.less.map +1 -1
- package/package.json +2 -2
package/lib/ClientSDK.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ClientSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEhE,qBAAa,SAAS;IACpB,OAAO,EAAE,GAAG,CAAC;gBAED,OAAO,KAAA;IAInB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,aAAa;IAKjE,QAAQ,CAAC,IAAI,KAAA;
|
|
1
|
+
{"version":3,"sources":["../src/ClientSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEhE,qBAAa,SAAS;IACpB,OAAO,EAAE,GAAG,CAAC;gBAED,OAAO,KAAA;IAInB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,aAAa;IAKjE,QAAQ,CAAC,IAAI,KAAA;CACd;AAED,eAAe,SAAS,CAAC","file":"ClientSDK.d.ts","sourcesContent":["import { RequestMethod, RequestOptionsInit } from 'umi-request';\n\nexport class ClientSDK {\n options: any;\n\n constructor(options) {\n this.options = options;\n }\n\n request(url: string, options?: RequestOptionsInit): RequestMethod {\n console.log('this.options.request', this.options.request);\n return this.options.request(url, options || {});\n }\n\n resource(name) {}\n}\n\nexport default ClientSDK;\n"]}
|
package/lib/ClientSDK.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ClientSDK.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IAGpB,YAAY,OAAO;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,GAAW,EAAE,OAA4B;QAC/C,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,
|
|
1
|
+
{"version":3,"sources":["../src/ClientSDK.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IAGpB,YAAY,OAAO;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,GAAW,EAAE,OAA4B;QAC/C,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,QAAQ,CAAC,IAAI,IAAG,CAAC;CAClB;AAbD,8BAaC;AAED,kBAAe,SAAS,CAAC","file":"ClientSDK.js","sourcesContent":["import { RequestMethod, RequestOptionsInit } from 'umi-request';\n\nexport class ClientSDK {\n options: any;\n\n constructor(options) {\n this.options = options;\n }\n\n request(url: string, options?: RequestOptionsInit): RequestMethod {\n console.log('this.options.request', this.options.request);\n return this.options.request(url, options || {});\n }\n\n resource(name) {}\n}\n\nexport default ClientSDK;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ConfigProvider.tsx"],"names":[],"mappings":";AAWA,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/ConfigProvider.tsx"],"names":[],"mappings":";AAWA,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,eAGxC","file":"ConfigProvider.d.ts","sourcesContent":["import React, { createContext } from 'react';\n// import { ConfigProvider as AntdConfigProvider } from 'antd';\n// import enUS from 'antd/lib/locale/en_US';\n// import zhCN from 'antd/lib/locale/zh_CN';\nimport { ClientProvider } from './constate';\n// import moment from 'moment';\n// import 'moment/locale/zh-cn';\n// moment.locale('zh-cn');\n\nconst ConfigContext = createContext<any>(null);\n\nexport function ConfigProvider(props: any) {\n const { client } = props;\n return <ClientProvider client={client}>{props.children}</ClientProvider>;\n}\n"]}
|
package/lib/ConfigProvider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ConfigProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"sources":["../src/ConfigProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA6C;AAI7C,yCAA4C;AAK5C,MAAM,aAAa,GAAG,qBAAa,CAAM,IAAI,CAAC,CAAC;AAE/C,SAAgB,cAAc,CAAC,KAAU;IACvC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,OAAO,8BAAC,yBAAc,IAAC,MAAM,EAAE,MAAM,IAAG,KAAK,CAAC,QAAQ,CAAkB,CAAC;AAC3E,CAAC;AAHD,wCAGC","file":"ConfigProvider.js","sourcesContent":["import React, { createContext } from 'react';\n// import { ConfigProvider as AntdConfigProvider } from 'antd';\n// import enUS from 'antd/lib/locale/en_US';\n// import zhCN from 'antd/lib/locale/zh_CN';\nimport { ClientProvider } from './constate';\n// import moment from 'moment';\n// import 'moment/locale/zh-cn';\n// moment.locale('zh-cn');\n\nconst ConfigContext = createContext<any>(null);\n\nexport function ConfigProvider(props: any) {\n const { client } = props;\n return <ClientProvider client={client}>{props.children}</ClientProvider>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Sortable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAoCxC,MAAM,WAAW,iBAAiB;CAAG;AAErC,eAAO,MAAM,mBAAmB,oBAAyB,CAAC;AAE1D,wBAAgB,UAAU,CAAC,KAAK,KAAA,eAiB/B;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,GAAG,CAAC;IACR,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,eAsB9C;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,GAAG,CAAC;IACR,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eA6DpD","file":"index.d.ts","sourcesContent":["import React, { useState } from 'react';\nimport {\n SortableContext,\n useSortable,\n horizontalListSortingStrategy,\n verticalListSortingStrategy,\n sortableKeyboardCoordinates,\n} from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { Menu, Table, Tabs } from 'antd';\nimport { createContext } from 'react';\nimport { useContext } from 'react';\nimport { range } from 'lodash';\nconst RowSyntheticListenerMapContext = createContext(null);\nconst CellContext = createContext(null);\nimport cls from 'classnames';\n\nimport {\n DndContext,\n DragOverlay,\n closestCenter,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n useDraggable,\n useDroppable,\n} from '@dnd-kit/core';\nimport { forwardRef } from 'react';\nimport { DragOutlined } from '@ant-design/icons';\nimport { useRef } from 'react';\n\nconst Div = forwardRef<HTMLDivElement>((props, ref) => {\n return <div ref={ref} {...props} />;\n});\n\nexport interface SortableItemProps {}\n\nexport const SortableItemContext = createContext<any>({});\n\nexport function DragHandle(props) {\n const { component, ...others } = props;\n const Icon = component || DragOutlined;\n return (\n <SortableItemContext.Consumer>\n {({ draggable, setDraggableNodeRef, attributes, listeners }) =>\n setDraggableNodeRef && (\n <Icon\n ref={setDraggableNodeRef}\n {...others}\n // {...attributes}\n {...listeners}\n />\n )\n }\n </SortableItemContext.Consumer>\n );\n}\n\nexport interface DroppableProps {\n id: any;\n data?: any;\n component?: any;\n [key: string]: any;\n}\n\nexport function Droppable(props: DroppableProps) {\n const { id, data = {}, className, component, children, ...others } = props;\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n id: `droppable-${id}`,\n data: {\n ...data,\n },\n });\n const Component = component || Div;\n return (\n <Component\n {...others}\n className={cls(className, `droppable droppable-${id}`, {\n isOver,\n })}\n ref={(el: HTMLElement) => {\n setDroppableNodeRef(el);\n }}\n >\n {children}\n </Component>\n );\n}\n\nexport interface SortableItemProps {\n id: any;\n data?: any;\n component?: any;\n draggable?: boolean;\n [key: string]: any;\n}\n\nexport function SortableItem(props: SortableItemProps) {\n const {\n id,\n data = {},\n draggable,\n className,\n component,\n children,\n disabled,\n ...others\n } = props;\n const previewRef = useRef<HTMLElement>();\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n id: `droppable-${id}`,\n data: {\n ...data,\n previewRef,\n },\n disabled,\n });\n const {\n isDragging,\n attributes,\n listeners,\n setNodeRef: setDraggableNodeRef,\n transform,\n } = useDraggable({\n id: `draggable-${id}`,\n disabled,\n data: {\n ...data,\n previewRef,\n },\n });\n if (draggable) {\n Object.assign(others, listeners);\n }\n const Component = component || Div;\n return (\n <Component\n {...others}\n // {...attributes}\n className={cls(className, `droppable droppable-${id}`, {\n isOver,\n isDragging,\n })}\n ref={(el: HTMLElement) => {\n previewRef.current = el;\n setDroppableNodeRef(el);\n // if (draggable) {\n
|
|
1
|
+
{"version":3,"sources":["../src/components/Sortable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAoCxC,MAAM,WAAW,iBAAiB;CAAG;AAErC,eAAO,MAAM,mBAAmB,oBAAyB,CAAC;AAE1D,wBAAgB,UAAU,CAAC,KAAK,KAAA,eAiB/B;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,GAAG,CAAC;IACR,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,eAsB9C;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,GAAG,CAAC;IACR,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eA6DpD","file":"index.d.ts","sourcesContent":["import React, { useState } from 'react';\nimport {\n SortableContext,\n useSortable,\n horizontalListSortingStrategy,\n verticalListSortingStrategy,\n sortableKeyboardCoordinates,\n} from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { Menu, Table, Tabs } from 'antd';\nimport { createContext } from 'react';\nimport { useContext } from 'react';\nimport { range } from 'lodash';\nconst RowSyntheticListenerMapContext = createContext(null);\nconst CellContext = createContext(null);\nimport cls from 'classnames';\n\nimport {\n DndContext,\n DragOverlay,\n closestCenter,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n useDraggable,\n useDroppable,\n} from '@dnd-kit/core';\nimport { forwardRef } from 'react';\nimport { DragOutlined } from '@ant-design/icons';\nimport { useRef } from 'react';\n\nconst Div = forwardRef<HTMLDivElement>((props, ref) => {\n return <div ref={ref} {...props} />;\n});\n\nexport interface SortableItemProps {}\n\nexport const SortableItemContext = createContext<any>({});\n\nexport function DragHandle(props) {\n const { component, ...others } = props;\n const Icon = component || DragOutlined;\n return (\n <SortableItemContext.Consumer>\n {({ draggable, setDraggableNodeRef, attributes, listeners }) =>\n setDraggableNodeRef && (\n <Icon\n ref={setDraggableNodeRef}\n {...others}\n // {...attributes}\n {...listeners}\n />\n )\n }\n </SortableItemContext.Consumer>\n );\n}\n\nexport interface DroppableProps {\n id: any;\n data?: any;\n component?: any;\n [key: string]: any;\n}\n\nexport function Droppable(props: DroppableProps) {\n const { id, data = {}, className, component, children, ...others } = props;\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n id: `droppable-${id}`,\n data: {\n ...data,\n },\n });\n const Component = component || Div;\n return (\n <Component\n {...others}\n className={cls(className, `droppable droppable-${id}`, {\n isOver,\n })}\n ref={(el: HTMLElement) => {\n setDroppableNodeRef(el);\n }}\n >\n {children}\n </Component>\n );\n}\n\nexport interface SortableItemProps {\n id: any;\n data?: any;\n component?: any;\n draggable?: boolean;\n [key: string]: any;\n}\n\nexport function SortableItem(props: SortableItemProps) {\n const {\n id,\n data = {},\n draggable,\n className,\n component,\n children,\n disabled,\n ...others\n } = props;\n const previewRef = useRef<HTMLElement>();\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n id: `droppable-${id}`,\n data: {\n ...data,\n previewRef,\n },\n disabled,\n });\n const {\n isDragging,\n attributes,\n listeners,\n setNodeRef: setDraggableNodeRef,\n transform,\n } = useDraggable({\n id: `draggable-${id}`,\n disabled,\n data: {\n ...data,\n previewRef,\n },\n });\n if (draggable) {\n Object.assign(others, listeners);\n }\n const Component = component || Div;\n return (\n <Component\n {...others}\n // {...attributes}\n className={cls(className, `droppable droppable-${id}`, {\n isOver,\n isDragging,\n })}\n ref={(el: HTMLElement) => {\n previewRef.current = el;\n setDroppableNodeRef(el);\n // if (draggable) {\n // setDraggableNodeRef(el);\n // }\n }}\n >\n <SortableItemContext.Provider\n value={{ draggable, setDraggableNodeRef, attributes, listeners }}\n >\n {children}\n </SortableItemContext.Provider>\n </Component>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Sortable/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAAwC;AAUxC,iCAAsC;AAGtC,MAAM,8BAA8B,GAAG,qBAAa,CAAC,IAAI,CAAC,CAAC;AAC3D,MAAM,WAAW,GAAG,qBAAa,CAAC,IAAI,CAAC,CAAC;AACxC,4DAA6B;AAE7B,wCAUuB;AACvB,iCAAmC;AACnC,6CAAiD;AACjD,iCAA+B;AAE/B,MAAM,GAAG,GAAG,kBAAU,CAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACpD,OAAO,qDAAK,GAAG,EAAE,GAAG,IAAM,KAAK,EAAI,CAAC;AACtC,CAAC,CAAC,CAAC;AAIU,QAAA,mBAAmB,GAAG,qBAAa,CAAM,EAAE,CAAC,CAAC;AAE1D,SAAgB,UAAU,CAAC,KAAK;IAC9B,MAAM,EAAE,SAAS,KAAgB,KAAK,EAAhB,MAAM,UAAK,KAAK,EAAhC,aAAwB,CAAQ,CAAC;IACvC,MA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,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,GAAG,mBAAY,CAAC;QAC/D,EAAE,EAAE,aAAa,EAAE,EAAE;QACrB,IAAI,kCACC,IAAI,KACP,UAAU,GACX;QACD,QAAQ;KACT,CAAC,CAAC;IACH,MAAM,EACJ,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EAAE,mBAAmB,EAC/B,SAAS,GACV,GAAG,mBAAY,CAAC;QACf,EAAE,EAAE,aAAa,EAAE,EAAE;QACrB,QAAQ;QACR,IAAI,kCACC,IAAI,KACP,UAAU,GACX;KACF,CAAC,CAAC;IACH,IAAI,SAAS,EAAE;QACb,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;KAClC;IACD,MAAM,SAAS,GAAG,SAAS,IAAI,GAAG,CAAC;IACnC,OAAO,CACL,8BAAC,SAAS,oBACJ,MAAM,IAEV,SAAS,EAAE,oBAAG,CAAC,SAAS,EAAE,uBAAuB,EAAE,EAAE,EAAE;YACrD,MAAM;YACN,UAAU;SACX,CAAC,EACF,GAAG,EAAE,CAAC,EAAe,EAAE,EAAE;YACvB,UAAU,CAAC,OAAO,GAAG,EAAE,CAAC;YACxB,mBAAmB,CAAC,EAAE,CAAC,CAAC;QAI1B,CAAC;QAED,8BAAC,2BAAmB,CAAC,QAAQ,IAC3B,KAAK,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU,EAAE,SAAS,EAAE,IAE/D,QAAQ,CACoB,CACrB,CACb,CAAC;AACJ,CAAC;AA7DD,oCA6DC","file":"index.js","sourcesContent":["import React, { useState } from 'react';\nimport {\n SortableContext,\n useSortable,\n horizontalListSortingStrategy,\n verticalListSortingStrategy,\n sortableKeyboardCoordinates,\n} from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { Menu, Table, Tabs } from 'antd';\nimport { createContext } from 'react';\nimport { useContext } from 'react';\nimport { range } from 'lodash';\nconst RowSyntheticListenerMapContext = createContext(null);\nconst CellContext = createContext(null);\nimport cls from 'classnames';\n\nimport {\n DndContext,\n DragOverlay,\n closestCenter,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n useDraggable,\n useDroppable,\n} from '@dnd-kit/core';\nimport { forwardRef } from 'react';\nimport { DragOutlined } from '@ant-design/icons';\nimport { useRef } from 'react';\n\nconst Div = forwardRef<HTMLDivElement>((props, ref) => {\n return <div ref={ref} {...props} />;\n});\n\nexport interface SortableItemProps {}\n\nexport const SortableItemContext = createContext<any>({});\n\nexport function DragHandle(props) {\n const { component, ...others } = props;\n const Icon = component || DragOutlined;\n return (\n <SortableItemContext.Consumer>\n {({ draggable, setDraggableNodeRef, attributes, listeners }) =>\n setDraggableNodeRef && (\n <Icon\n ref={setDraggableNodeRef}\n {...others}\n // {...attributes}\n {...listeners}\n />\n )\n }\n </SortableItemContext.Consumer>\n );\n}\n\nexport interface DroppableProps {\n id: any;\n data?: any;\n component?: any;\n [key: string]: any;\n}\n\nexport function Droppable(props: DroppableProps) {\n const { id, data = {}, className, component, children, ...others } = props;\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n id: `droppable-${id}`,\n data: {\n ...data,\n },\n });\n const Component = component || Div;\n return (\n <Component\n {...others}\n className={cls(className, `droppable droppable-${id}`, {\n isOver,\n })}\n ref={(el: HTMLElement) => {\n setDroppableNodeRef(el);\n }}\n >\n {children}\n </Component>\n );\n}\n\nexport interface SortableItemProps {\n id: any;\n data?: any;\n component?: any;\n draggable?: boolean;\n [key: string]: any;\n}\n\nexport function SortableItem(props: SortableItemProps) {\n const {\n id,\n data = {},\n draggable,\n className,\n component,\n children,\n disabled,\n ...others\n } = props;\n const previewRef = useRef<HTMLElement>();\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n id: `droppable-${id}`,\n data: {\n ...data,\n previewRef,\n },\n disabled,\n });\n const {\n isDragging,\n attributes,\n listeners,\n setNodeRef: setDraggableNodeRef,\n transform,\n } = useDraggable({\n id: `draggable-${id}`,\n disabled,\n data: {\n ...data,\n previewRef,\n },\n });\n if (draggable) {\n Object.assign(others, listeners);\n }\n const Component = component || Div;\n return (\n <Component\n {...others}\n // {...attributes}\n className={cls(className, `droppable droppable-${id}`, {\n isOver,\n isDragging,\n })}\n ref={(el: HTMLElement) => {\n previewRef.current = el;\n setDroppableNodeRef(el);\n // if (draggable) {\n
|
|
1
|
+
{"version":3,"sources":["../src/components/Sortable/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAAwC;AAUxC,iCAAsC;AAGtC,MAAM,8BAA8B,GAAG,qBAAa,CAAC,IAAI,CAAC,CAAC;AAC3D,MAAM,WAAW,GAAG,qBAAa,CAAC,IAAI,CAAC,CAAC;AACxC,4DAA6B;AAE7B,wCAUuB;AACvB,iCAAmC;AACnC,6CAAiD;AACjD,iCAA+B;AAE/B,MAAM,GAAG,GAAG,kBAAU,CAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACpD,OAAO,qDAAK,GAAG,EAAE,GAAG,IAAM,KAAK,EAAI,CAAC;AACtC,CAAC,CAAC,CAAC;AAIU,QAAA,mBAAmB,GAAG,qBAAa,CAAM,EAAE,CAAC,CAAC;AAE1D,SAAgB,UAAU,CAAC,KAAK;IAC9B,MAAM,EAAE,SAAS,KAAgB,KAAK,EAAhB,MAAM,UAAK,KAAK,EAAhC,aAAwB,CAAQ,CAAC;IACvC,MAAM,IAAI,GAAG,SAAS,IAAI,oBAAY,CAAC;IACvC,OAAO,CACL,8BAAC,2BAAmB,CAAC,QAAQ,QAC1B,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,CAC7D,mBAAmB,IAAI,CACrB,8BAAC,IAAI,kBACH,GAAG,EAAE,mBAAmB,IACpB,MAAM,EAEN,SAAS,EACb,CACH,CAE0B,CAChC,CAAC;AACJ,CAAC;AAjBD,gCAiBC;AASD,SAAgB,SAAS,CAA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AAI,kCACC,IAAI,KACP,UAAU,GACX;KACF,CAAC,CAAC;IACH,IAAI,SAAS,EAAE;QACb,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;KAClC;IACD,MAAM,SAAS,GAAG,SAAS,IAAI,GAAG,CAAC;IACnC,OAAO,CACL,8BAAC,SAAS,oBACJ,MAAM,IAEV,SAAS,EAAE,oBAAG,CAAC,SAAS,EAAE,uBAAuB,EAAE,EAAE,EAAE;YACrD,MAAM;YACN,UAAU;SACX,CAAC,EACF,GAAG,EAAE,CAAC,EAAe,EAAE,EAAE;YACvB,UAAU,CAAC,OAAO,GAAG,EAAE,CAAC;YACxB,mBAAmB,CAAC,EAAE,CAAC,CAAC;QAI1B,CAAC;QAED,8BAAC,2BAAmB,CAAC,QAAQ,IAC3B,KAAK,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU,EAAE,SAAS,EAAE,IAE/D,QAAQ,CACoB,CACrB,CACb,CAAC;AACJ,CAAC;AA7DD,oCA6DC","file":"index.js","sourcesContent":["import React, { useState } from 'react';\nimport {\n SortableContext,\n useSortable,\n horizontalListSortingStrategy,\n verticalListSortingStrategy,\n sortableKeyboardCoordinates,\n} from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { Menu, Table, Tabs } from 'antd';\nimport { createContext } from 'react';\nimport { useContext } from 'react';\nimport { range } from 'lodash';\nconst RowSyntheticListenerMapContext = createContext(null);\nconst CellContext = createContext(null);\nimport cls from 'classnames';\n\nimport {\n DndContext,\n DragOverlay,\n closestCenter,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n useDraggable,\n useDroppable,\n} from '@dnd-kit/core';\nimport { forwardRef } from 'react';\nimport { DragOutlined } from '@ant-design/icons';\nimport { useRef } from 'react';\n\nconst Div = forwardRef<HTMLDivElement>((props, ref) => {\n return <div ref={ref} {...props} />;\n});\n\nexport interface SortableItemProps {}\n\nexport const SortableItemContext = createContext<any>({});\n\nexport function DragHandle(props) {\n const { component, ...others } = props;\n const Icon = component || DragOutlined;\n return (\n <SortableItemContext.Consumer>\n {({ draggable, setDraggableNodeRef, attributes, listeners }) =>\n setDraggableNodeRef && (\n <Icon\n ref={setDraggableNodeRef}\n {...others}\n // {...attributes}\n {...listeners}\n />\n )\n }\n </SortableItemContext.Consumer>\n );\n}\n\nexport interface DroppableProps {\n id: any;\n data?: any;\n component?: any;\n [key: string]: any;\n}\n\nexport function Droppable(props: DroppableProps) {\n const { id, data = {}, className, component, children, ...others } = props;\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n id: `droppable-${id}`,\n data: {\n ...data,\n },\n });\n const Component = component || Div;\n return (\n <Component\n {...others}\n className={cls(className, `droppable droppable-${id}`, {\n isOver,\n })}\n ref={(el: HTMLElement) => {\n setDroppableNodeRef(el);\n }}\n >\n {children}\n </Component>\n );\n}\n\nexport interface SortableItemProps {\n id: any;\n data?: any;\n component?: any;\n draggable?: boolean;\n [key: string]: any;\n}\n\nexport function SortableItem(props: SortableItemProps) {\n const {\n id,\n data = {},\n draggable,\n className,\n component,\n children,\n disabled,\n ...others\n } = props;\n const previewRef = useRef<HTMLElement>();\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n id: `droppable-${id}`,\n data: {\n ...data,\n previewRef,\n },\n disabled,\n });\n const {\n isDragging,\n attributes,\n listeners,\n setNodeRef: setDraggableNodeRef,\n transform,\n } = useDraggable({\n id: `draggable-${id}`,\n disabled,\n data: {\n ...data,\n previewRef,\n },\n });\n if (draggable) {\n Object.assign(others, listeners);\n }\n const Component = component || Div;\n return (\n <Component\n {...others}\n // {...attributes}\n className={cls(className, `droppable droppable-${id}`, {\n isOver,\n isDragging,\n })}\n ref={(el: HTMLElement) => {\n previewRef.current = el;\n setDroppableNodeRef(el);\n // if (draggable) {\n // setDraggableNodeRef(el);\n // }\n }}\n >\n <SortableItemContext.Provider\n value={{ draggable, setDraggableNodeRef, attributes, listeners }}\n >\n {children}\n </SortableItemContext.Provider>\n </Component>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/admin-layout/Collections/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAC;AA2BxE,eAAO,MAAM,WAAW,oBAAsB,CAAC;AAitB/C,eAAO,MAAM,WAAW,mBAWvB,CAAC;AAEF,eAAe,WAAW,CAAC","file":"index.d.ts","sourcesContent":["import { SchemaRenderer } from '../../../';\nimport React, { useContext, useEffect, useMemo, useState } from 'react';\nimport { FormItem } from '@formily/antd';\nimport { action } from '@formily/reactive';\nimport {\n useCollectionContext,\n useCollectionsContext,\n} from '../../../constate/Collections';\nimport { Button, Drawer, Menu, Dropdown, Space } from 'antd';\nimport { PlusOutlined, DownOutlined } from '@ant-design/icons';\nimport cls from 'classnames';\nimport { uid, isValid, clone } from '@formily/shared';\nimport { Resource } from '../../../resource';\nimport { TableRowContext, useTable } from '../../../schemas/table';\nimport { useRequest } from 'ahooks';\nimport { VisibleContext } from '../../../context';\nimport { connect, FormProvider, observer, useForm } from '@formily/react';\nimport { DescriptionsContext } from '../../../schemas/form';\nimport { createContext } from 'react';\nimport { ISchema } from '../../../';\nimport { createForm, Field } from '@formily/core';\nimport { SchemaField } from '../../../schemas';\nimport {\n interfaces,\n options,\n} from '../../../schemas/database-field/interfaces';\nimport { useResourceRequest } from '../../../constate';\n\nexport const RoleContext = createContext(null);\n\nfunction VisibleProvider(props) {\n const ctx = useContext(TableRowContext);\n const [visible, setVisible] = useState(false);\n return (\n <VisibleContext.Provider value={[visible, setVisible]}>\n {props.children}\n </VisibleContext.Provider>\n );\n}\n\nconst useResource = () => {\n const resource = useResourceRequest('collections');\n return {\n resource,\n };\n};\n\nconst useCollectionsResource = () => {\n const descriptionsContext = useContext(DescriptionsContext);\n console.log('descriptionsContext.service', descriptionsContext.service);\n const resource = useResourceRequest('collections');\n return {\n resource,\n };\n};\n\nclass ActionPermissionResource extends Resource {\n save(options?: any) {\n console.log('ActionPermissionResource.save');\n return Promise.resolve({});\n }\n}\n\nconst useActionPermissionSubmit = () => {\n const form = useForm();\n const role = useContext(RoleContext);\n const resource = useResourceRequest({\n resourceName: 'roles',\n resourceKey: role.name,\n });\n return {\n async run() {\n await resource.save(form.values);\n console.log('useActionPermissionSubmit', form.values?.actionPermissions);\n },\n };\n};\n\nconst useActionPermissionResource = ({ onSuccess }) => {\n const role = useContext(RoleContext);\n console.log('RoleContext', role);\n // const { props } = useTable();\n const ctx = useContext(TableRowContext);\n const resource = useResourceRequest({\n resourceName: 'action_permissions',\n }, ActionPermissionResource);\n const service = useRequest(\n (params?: any) => {\n return resource.list({\n ...params,\n filter: {\n role_name: role.name,\n collection_name: ctx.record.name,\n },\n appends: ['fields'],\n });\n },\n {\n formatResult: (result) => result?.data,\n onSuccess(data) {\n console.log('actionPermissions', data);\n onSuccess({\n actionPermissions: data.map((permission) => {\n const item: any = {};\n Object.keys(permission).forEach((key) => {\n if (isValid(permission[key])) {\n item[key] = permission[key];\n }\n });\n item.fields = permission?.fields.map((field) => field.key) || [];\n return item;\n }),\n });\n },\n manual: true,\n },\n );\n const [visible] = useContext(VisibleContext);\n\n useEffect(() => {\n if (visible) {\n service.run({});\n }\n }, [visible]);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useDetailsResource = ({ onSuccess }) => {\n const { props } = useTable();\n const ctx = useContext(TableRowContext);\n const resource = useResourceRequest({\n resourceName: 'collections',\n resourceKey: ctx.record[props.rowKey],\n });\n const service = useRequest(\n (params?: any) => {\n return resource.get({ ...params });\n },\n {\n formatResult: (result) => result?.data,\n onSuccess,\n manual: true,\n },\n );\n const [visible] = useContext(VisibleContext);\n\n useEffect(() => {\n if (visible) {\n service.run({});\n }\n }, [visible]);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useFieldsResource = () => {\n const { props } = useTable();\n const ctx = useContext(TableRowContext);\n class FieldResource extends Resource {\n list(options) {\n return super.list({\n ...options,\n filter: { state: 1, collection_name: ctx.record[props.rowKey] },\n });\n }\n }\n const resource = useResourceRequest('fields', FieldResource);\n return {\n resource,\n };\n};\n\nconst fieldInterfaces = [];\nfor (const [key, schema] of interfaces) {\n fieldInterfaces.push({\n value: key,\n label: schema.title,\n });\n}\n\nconst collectionSchema: ISchema = {\n type: 'array',\n 'x-decorator': 'VisibleProvider',\n 'x-component': 'Table',\n default: [],\n 'x-component-props': {\n rowKey: 'key',\n dragSort: true,\n showIndex: true,\n refreshRequestOnChange: true,\n pagination: {\n pageSize: 100,\n },\n defaultAppends: ['uiSchema'],\n useResource: useFieldsResource,\n collectionName: 'fields',\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Table.ActionBar',\n properties: {\n [uid()]: {\n type: 'void',\n name: 'action1',\n title: '删除',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'destroy',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n [uid()]: {\n type: 'void',\n title: '添加',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'create',\n },\n 'x-component': 'CreateFieldButton',\n 'x-component-props': {\n type: 'primary',\n icon: 'PlusOutlined',\n },\n },\n },\n },\n column1: {\n type: 'void',\n title: '字段名称',\n 'x-component': 'Table.Column',\n properties: {\n 'uiSchema.title': {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column2: {\n type: 'void',\n title: '字段标识',\n 'x-component': 'Table.Column',\n properties: {\n name: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column3: {\n type: 'void',\n title: '字段类型',\n 'x-component': 'Table.Column',\n properties: {\n interface: {\n type: 'string',\n 'x-component': 'Select',\n 'x-read-pretty': true,\n // @ts-ignore\n enum: fieldInterfaces,\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '操作',\n 'x-component': 'Table.Column',\n 'x-component-props': {\n width: 160,\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Action.Group',\n 'x-component-props': {\n type: 'link',\n },\n properties: {\n [uid()]: {\n type: 'void',\n title: '编辑',\n 'x-component': 'EditFieldButton',\n 'x-component-props': {\n type: 'link',\n useAction() {\n return {\n async run() {\n alert('abc');\n },\n };\n },\n },\n 'x-action-type': 'update',\n },\n [uid()]: {\n type: 'void',\n title: '删除',\n 'x-component': 'Action',\n 'x-action-type': 'destroy',\n 'x-component-props': {\n type: 'link',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n },\n },\n },\n },\n },\n};\n\nfunction FieldConfigTitle() {\n const ctx = useContext(TableRowContext);\n return <>{`配置「${ctx.record.title}」表字段`}</>;\n}\n\nconst schema: ISchema = {\n type: 'void',\n name: 'action',\n 'x-component': 'Action',\n 'x-component-props': {\n tooltip: '数据表配置',\n className: 'nb-database-config',\n icon: 'DatabaseOutlined',\n type: 'primary',\n },\n properties: {\n modal1: {\n type: 'void',\n title: '数据表配置',\n 'x-component': 'Action.Drawer',\n properties: {\n table: {\n type: 'array',\n // 'x-decorator': 'CardItem',\n 'x-component': 'Table',\n default: [],\n 'x-component-props': {\n rowKey: 'name',\n dragSort: true,\n showIndex: true,\n refreshRequestOnChange: true,\n pagination: {\n pageSize: 100,\n },\n useResource,\n collectionName: 'collections',\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Table.ActionBar',\n properties: {\n [uid()]: {\n type: 'void',\n name: 'action1',\n title: '删除',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'destroy',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n [uid()]: {\n type: 'void',\n title: '创建数据表',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'create',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n icon: 'PlusOutlined',\n },\n properties: {\n modal: {\n type: 'void',\n title: '创建数据表',\n 'x-decorator': 'Form',\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction: '{{ Table.useTableCreateAction }}',\n },\n properties: {\n title: {\n type: 'string',\n title: '数据表名称',\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n },\n },\n },\n },\n },\n },\n },\n column1: {\n type: 'void',\n title: '数据表名称',\n 'x-component': 'Table.Column',\n properties: {\n title: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column2: {\n type: 'void',\n title: '数据表标识',\n 'x-component': 'Table.Column',\n properties: {\n name: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '操作',\n 'x-component': 'Table.Column',\n 'x-component-props': {\n width: 160,\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Action.Group',\n 'x-component-props': {\n type: 'link',\n },\n properties: {\n [uid()]: {\n type: 'void',\n title: '配置字段',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'link',\n },\n 'x-action-type': 'view',\n properties: {\n [uid()]: {\n type: 'void',\n title: <FieldConfigTitle />,\n // 'x-decorator': 'RoleProvider',\n 'x-component': 'Action.Drawer',\n 'x-component-props': {},\n properties: {\n [uid()]: collectionSchema,\n },\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '编辑',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'link',\n },\n 'x-action-type': 'update',\n properties: {\n [uid()]: {\n type: 'void',\n title: '编辑数据表',\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useResource: useDetailsResource,\n },\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction: '{{ Table.useTableUpdateAction }}',\n },\n properties: {\n title: {\n type: 'string',\n title: '数据表名称',\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n },\n },\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '删除',\n 'x-component': 'Action',\n 'x-action-type': 'destroy',\n 'x-component-props': {\n type: 'link',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n};\n\nfunction CreateFieldButton() {\n const { refresh } = useCollectionsContext();\n const ctx = useContext(TableRowContext);\n const { service } = useTable();\n const [visible, setVisible] = useState(false);\n const form = useMemo(() => createForm(), []);\n const [properties, setProperties] = useState({});\n const { collections = [], loading } = useCollectionsContext();\n const resource = useResourceRequest('fields');\n\n const loadCollections = async (field: any) => {\n return collections.map((item: any) => ({\n label: item.title,\n value: item.name,\n }));\n };\n\n const loadCollectionFields = async (field: Field) => {\n const target = field.query('....target').get('value');\n const f = field.query('....target').take();\n console.log('loadCollectionFields', f, field);\n const collection = collections?.find((item) => item.name === target);\n if (!collection) {\n return [];\n }\n return collection?.generalFields\n ?.filter((item) => item?.uiSchema?.title)\n ?.map((item) => ({\n label: item?.uiSchema?.title || item.name,\n value: item.name,\n }));\n };\n\n const menu = (\n <Menu\n onClick={(info) => {\n console.log('click', info.key);\n const schema = interfaces.get(info.key);\n form.setValues({\n ...schema.default,\n collection_name: ctx.record.name,\n key: uid(),\n name: uid(),\n interface: info.key,\n });\n setProperties(clone(schema.properties));\n setVisible(true);\n }}\n >\n {options.map(\n (option, groupIndex) =>\n option.children.length > 0 && (\n <Menu.SubMenu key={groupIndex} title={option.label}>\n {option.children.map((item) => (\n <Menu.Item style={{ minWidth: 120 }} key={item.name}>\n {item.title}\n </Menu.Item>\n ))}\n </Menu.SubMenu>\n ),\n )}\n </Menu>\n );\n return (\n <>\n <Dropdown overlay={menu} overlayClassName={'all-fields'}>\n <Button type={'primary'} icon={<PlusOutlined />}>\n 添加 <DownOutlined />\n </Button>\n </Dropdown>\n <Drawer\n title={'添加字段'}\n width={'50%'}\n visible={visible}\n onClose={() => setVisible(false)}\n footer={\n <Space style={{ float: 'right' }}>\n <Button\n onClick={() => {\n setVisible(false);\n }}\n >\n 取消\n </Button>\n <Button\n type={'primary'}\n onClick={async () => {\n await resource.save(form.values);\n setVisible(false);\n await service.refresh();\n await refresh();\n }}\n >\n 确定\n </Button>\n </Space>\n }\n >\n <FormProvider form={form}>\n <SchemaField\n scope={{\n loadCollections,\n loadCollectionFields,\n }}\n schema={{\n type: 'object',\n properties,\n }}\n />\n </FormProvider>\n </Drawer>\n </>\n );\n}\n\nfunction EditFieldButton() {\n const { refresh, findCollection } = useCollectionsContext();\n const { service } = useTable();\n const ctx = useContext(TableRowContext);\n const [visible, setVisible] = useState(false);\n const form = useMemo(() => createForm(), []);\n const schema = interfaces.get(ctx.record.interface);\n const { collections = [], loading } = useCollectionsContext();\n const resource = useResourceRequest('fields');\n\n const loadCollections = async (field: any) => {\n return collections.map((item: any) => ({\n label: item.title,\n value: item.name,\n }));\n };\n\n const loadCollectionFields = async (field: Field) => {\n const target = field.query('....target').get('value');\n const f = field.query('....target').take();\n console.log('loadCollectionFields', f, field);\n const collection = collections?.find((item) => item.name === target);\n if (!collection) {\n return [];\n }\n return collection?.generalFields\n ?.filter((item) => item?.uiSchema?.title)\n ?.map((item) => ({\n label: item?.uiSchema?.title || item.name,\n value: item.name,\n }));\n };\n return (\n <>\n <Button\n type={'link'}\n onClick={() => {\n setVisible(true);\n const collection = findCollection(ctx.record.collection_name);\n const values = collection?.generalFields?.find(\n (field) => field.key === ctx.record.key,\n );\n form.setValues(clone(values || {}));\n }}\n >\n 编辑\n </Button>\n <Drawer\n title={'编辑字段'}\n width={'50%'}\n visible={visible}\n onClose={() => setVisible(false)}\n footer={\n <Space style={{ float: 'right' }}>\n <Button\n onClick={() => {\n setVisible(false);\n }}\n >\n 取消\n </Button>\n <Button\n type={'primary'}\n onClick={async () => {\n await resource.save(form.values, {\n resourceKey: ctx.record.key,\n });\n setVisible(false);\n await service.refresh();\n await refresh();\n }}\n >\n 确定\n </Button>\n </Space>\n }\n >\n <FormProvider form={form}>\n <SchemaField\n scope={{\n loadCollections,\n loadCollectionFields,\n }}\n schema={{\n type: 'object',\n properties: clone(schema.properties),\n }}\n />\n </FormProvider>\n </Drawer>\n </>\n );\n}\n\nexport const Collections = () => {\n return (\n <SchemaRenderer\n components={{\n VisibleProvider,\n CreateFieldButton,\n EditFieldButton,\n }}\n schema={schema}\n />\n );\n};\n\nexport default Collections;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/admin-layout/Collections/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAC;AA2BxE,eAAO,MAAM,WAAW,oBAAsB,CAAC;AA8tB/C,eAAO,MAAM,WAAW,mBAWvB,CAAC;AAEF,eAAe,WAAW,CAAC","file":"index.d.ts","sourcesContent":["import { SchemaRenderer } from '../../../';\nimport React, { useContext, useEffect, useMemo, useState } from 'react';\nimport { FormItem } from '@formily/antd';\nimport { action } from '@formily/reactive';\nimport {\n useCollectionContext,\n useCollectionsContext,\n} from '../../../constate/Collections';\nimport { Button, Drawer, Menu, Dropdown, Space } from 'antd';\nimport { PlusOutlined, DownOutlined } from '@ant-design/icons';\nimport cls from 'classnames';\nimport { uid, isValid, clone } from '@formily/shared';\nimport { Resource } from '../../../resource';\nimport { TableRowContext, useTable } from '../../../schemas/table';\nimport { useRequest } from 'ahooks';\nimport { VisibleContext } from '../../../context';\nimport { connect, FormProvider, observer, useForm } from '@formily/react';\nimport { DescriptionsContext } from '../../../schemas/form';\nimport { createContext } from 'react';\nimport { ISchema } from '../../../';\nimport { createForm, Field } from '@formily/core';\nimport { SchemaField } from '../../../schemas';\nimport {\n interfaces,\n options,\n} from '../../../schemas/database-field/interfaces';\nimport { useResourceRequest } from '../../../constate';\n\nexport const RoleContext = createContext(null);\n\nfunction VisibleProvider(props) {\n const ctx = useContext(TableRowContext);\n const [visible, setVisible] = useState(false);\n return (\n <VisibleContext.Provider value={[visible, setVisible]}>\n {props.children}\n </VisibleContext.Provider>\n );\n}\n\nconst useResource = () => {\n const resource = useResourceRequest('collections');\n return {\n resource,\n };\n};\n\nconst useCollectionsResource = () => {\n const descriptionsContext = useContext(DescriptionsContext);\n console.log('descriptionsContext.service', descriptionsContext.service);\n const resource = useResourceRequest('collections');\n return {\n resource,\n };\n};\n\nclass ActionPermissionResource extends Resource {\n save(options?: any) {\n console.log('ActionPermissionResource.save');\n return Promise.resolve({});\n }\n}\n\nconst useActionPermissionSubmit = () => {\n const form = useForm();\n const role = useContext(RoleContext);\n const resource = useResourceRequest({\n resourceName: 'roles',\n resourceKey: role.name,\n });\n return {\n async run() {\n await resource.save(form.values);\n console.log('useActionPermissionSubmit', form.values?.actionPermissions);\n },\n };\n};\n\nconst useActionPermissionResource = ({ onSuccess }) => {\n const role = useContext(RoleContext);\n console.log('RoleContext', role);\n // const { props } = useTable();\n const ctx = useContext(TableRowContext);\n const resource = useResourceRequest(\n {\n resourceName: 'action_permissions',\n },\n ActionPermissionResource,\n );\n const service = useRequest(\n (params?: any) => {\n return resource.list({\n ...params,\n filter: {\n role_name: role.name,\n collection_name: ctx.record.name,\n },\n appends: ['fields'],\n });\n },\n {\n formatResult: (result) => result?.data,\n onSuccess(data) {\n console.log('actionPermissions', data);\n onSuccess({\n actionPermissions: data.map((permission) => {\n const item: any = {};\n Object.keys(permission).forEach((key) => {\n if (isValid(permission[key])) {\n item[key] = permission[key];\n }\n });\n item.fields = permission?.fields.map((field) => field.key) || [];\n return item;\n }),\n });\n },\n manual: true,\n },\n );\n const [visible] = useContext(VisibleContext);\n\n useEffect(() => {\n if (visible) {\n service.run({});\n }\n }, [visible]);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useDetailsResource = ({ onSuccess }) => {\n const { props } = useTable();\n const ctx = useContext(TableRowContext);\n const resource = useResourceRequest({\n resourceName: 'collections',\n resourceKey: ctx.record[props.rowKey],\n });\n const service = useRequest(\n (params?: any) => {\n return resource.get({ ...params });\n },\n {\n formatResult: (result) => result?.data,\n onSuccess,\n manual: true,\n },\n );\n const [visible] = useContext(VisibleContext);\n\n useEffect(() => {\n if (visible) {\n service.run({});\n }\n }, [visible]);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useFieldsResource = () => {\n const { props } = useTable();\n const ctx = useContext(TableRowContext);\n class FieldResource extends Resource {\n list(options) {\n return super.list({\n ...options,\n filter: { state: 1, collection_name: ctx.record[props.rowKey] },\n });\n }\n }\n const resource = useResourceRequest('fields', FieldResource);\n return {\n resource,\n };\n};\n\nconst fieldInterfaces = [];\nfor (const [key, schema] of interfaces) {\n fieldInterfaces.push({\n value: key,\n label: schema.title,\n disabled: schema.disabled,\n });\n}\n\nconst collectionSchema: ISchema = {\n type: 'array',\n 'x-decorator': 'VisibleProvider',\n 'x-component': 'Table',\n default: [],\n 'x-component-props': {\n rowKey: 'key',\n dragSort: true,\n showIndex: true,\n refreshRequestOnChange: true,\n pagination: {\n pageSize: 100,\n },\n defaultAppends: ['uiSchema'],\n useResource: useFieldsResource,\n collectionName: 'fields',\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Table.ActionBar',\n properties: {\n [uid()]: {\n type: 'void',\n name: 'action1',\n title: '删除',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'destroy',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n [uid()]: {\n type: 'void',\n title: '添加',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'create',\n },\n 'x-component': 'CreateFieldButton',\n 'x-component-props': {\n type: 'primary',\n icon: 'PlusOutlined',\n },\n },\n },\n },\n column1: {\n type: 'void',\n title: '字段名称',\n 'x-component': 'Table.Column',\n properties: {\n 'uiSchema.title': {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column2: {\n type: 'void',\n title: '字段标识',\n 'x-component': 'Table.Column',\n properties: {\n name: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column3: {\n type: 'void',\n title: '字段类型',\n 'x-component': 'Table.Column',\n properties: {\n interface: {\n type: 'string',\n 'x-component': 'Select',\n 'x-read-pretty': true,\n // @ts-ignore\n enum: fieldInterfaces,\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '操作',\n 'x-component': 'Table.Column',\n 'x-component-props': {\n width: 160,\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Action.Group',\n 'x-component-props': {\n type: 'link',\n },\n properties: {\n [uid()]: {\n type: 'void',\n title: '编辑',\n 'x-component': 'EditFieldButton',\n 'x-component-props': {\n type: 'link',\n useAction() {\n return {\n async run() {\n alert('abc');\n },\n };\n },\n },\n 'x-action-type': 'update',\n },\n [uid()]: {\n type: 'void',\n title: '删除',\n 'x-component': 'Action',\n 'x-action-type': 'destroy',\n 'x-component-props': {\n type: 'link',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n },\n },\n },\n },\n },\n};\n\nfunction FieldConfigTitle() {\n const ctx = useContext(TableRowContext);\n return <>{`配置「${ctx.record.title}」表字段`}</>;\n}\n\nconst schema: ISchema = {\n type: 'void',\n name: 'action',\n 'x-component': 'Action',\n 'x-component-props': {\n tooltip: '数据表配置',\n className: 'nb-database-config',\n icon: 'DatabaseOutlined',\n type: 'primary',\n },\n properties: {\n modal1: {\n type: 'void',\n title: '数据表配置',\n 'x-component': 'Action.Drawer',\n properties: {\n table: {\n type: 'array',\n // 'x-decorator': 'CardItem',\n 'x-component': 'Table',\n default: [],\n 'x-component-props': {\n rowKey: 'name',\n dragSort: true,\n showIndex: true,\n refreshRequestOnChange: true,\n pagination: {\n pageSize: 100,\n },\n useResource,\n collectionName: 'collections',\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Table.ActionBar',\n properties: {\n [uid()]: {\n type: 'void',\n name: 'action1',\n title: '删除',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'destroy',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n [uid()]: {\n type: 'void',\n title: '创建数据表',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'create',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n icon: 'PlusOutlined',\n },\n properties: {\n modal: {\n type: 'void',\n title: '创建数据表',\n 'x-decorator': 'Form',\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction: '{{ Table.useTableCreateAction }}',\n },\n properties: {\n title: {\n type: 'string',\n title: '数据表名称',\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n },\n },\n },\n },\n },\n },\n },\n column1: {\n type: 'void',\n title: '数据表名称',\n 'x-component': 'Table.Column',\n properties: {\n title: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column2: {\n type: 'void',\n title: '数据表标识',\n 'x-component': 'Table.Column',\n properties: {\n name: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '操作',\n 'x-component': 'Table.Column',\n 'x-component-props': {\n width: 160,\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Action.Group',\n 'x-component-props': {\n type: 'link',\n },\n properties: {\n [uid()]: {\n type: 'void',\n title: '配置字段',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'link',\n },\n 'x-action-type': 'view',\n properties: {\n [uid()]: {\n type: 'void',\n title: <FieldConfigTitle />,\n // 'x-decorator': 'RoleProvider',\n 'x-component': 'Action.Drawer',\n 'x-component-props': {},\n properties: {\n [uid()]: collectionSchema,\n },\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '编辑',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'link',\n },\n 'x-action-type': 'update',\n properties: {\n [uid()]: {\n type: 'void',\n title: '编辑数据表',\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useResource: useDetailsResource,\n },\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction: '{{ Table.useTableUpdateAction }}',\n },\n properties: {\n title: {\n type: 'string',\n title: '数据表名称',\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n },\n },\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '删除',\n 'x-component': 'Action',\n 'x-action-type': 'destroy',\n 'x-component-props': {\n type: 'link',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n};\n\nfunction CreateFieldButton() {\n const { refresh } = useCollectionsContext();\n const ctx = useContext(TableRowContext);\n const { service } = useTable();\n const [visible, setVisible] = useState(false);\n const form = useMemo(() => createForm(), []);\n const [properties, setProperties] = useState({});\n const { collections = [], loading } = useCollectionsContext();\n const resource = useResourceRequest('fields');\n\n const loadCollections = async (field: any) => {\n return collections.map((item: any) => ({\n label: item.title,\n value: item.name,\n }));\n };\n\n const loadCollectionFields = async (field: Field) => {\n const target = field.query('....target').get('value');\n const f = field.query('....target').take();\n console.log('loadCollectionFields', f, field);\n const collection = collections?.find((item) => item.name === target);\n if (!collection) {\n return [];\n }\n return collection?.generalFields\n ?.filter((item) => item?.uiSchema?.title)\n ?.map((item) => ({\n label: item?.uiSchema?.title || item.name,\n value: item.name,\n }));\n };\n\n const menu = (\n <Menu\n onClick={(info) => {\n console.log('click', info.key);\n const schema = interfaces.get(info.key);\n form.setValues({\n ...schema.default,\n collection_name: ctx.record.name,\n key: uid(),\n name: uid(),\n interface: info.key,\n });\n setProperties(clone(schema.properties));\n setVisible(true);\n }}\n >\n {options.map(\n (option, groupIndex) =>\n option.children.length > 0 && (\n <Menu.SubMenu key={groupIndex} title={option.label}>\n {option.children.map((item) => (\n <Menu.Item\n disabled={item.disabled}\n style={{ minWidth: 120 }}\n key={item.name}\n >\n {item.title}\n </Menu.Item>\n ))}\n </Menu.SubMenu>\n ),\n )}\n </Menu>\n );\n return (\n <>\n <Dropdown overlay={menu} overlayClassName={'all-fields'}>\n <Button type={'primary'} icon={<PlusOutlined />}>\n 添加 <DownOutlined />\n </Button>\n </Dropdown>\n <Drawer\n title={'添加字段'}\n width={'50%'}\n visible={visible}\n onClose={() => {\n setVisible(false);\n form.reset();\n }}\n footer={\n <Space style={{ float: 'right' }}>\n <Button\n onClick={async () => {\n setVisible(false);\n await form.reset();\n }}\n >\n 取消\n </Button>\n <Button\n type={'primary'}\n onClick={async () => {\n await resource.save(form.values);\n setVisible(false);\n await form.reset();\n await service.refresh();\n await refresh();\n }}\n >\n 确定\n </Button>\n </Space>\n }\n >\n <FormProvider form={form}>\n <SchemaField\n scope={{\n loadCollections,\n loadCollectionFields,\n }}\n schema={{\n type: 'object',\n properties,\n }}\n />\n </FormProvider>\n </Drawer>\n </>\n );\n}\n\nfunction EditFieldButton() {\n const { refresh, findCollection } = useCollectionsContext();\n const { service } = useTable();\n const ctx = useContext(TableRowContext);\n const [visible, setVisible] = useState(false);\n const form = useMemo(() => createForm(), []);\n const schema = interfaces.get(ctx.record.interface);\n const { collections = [], loading } = useCollectionsContext();\n const resource = useResourceRequest('fields');\n\n const loadCollections = async (field: any) => {\n return collections.map((item: any) => ({\n label: item.title,\n value: item.name,\n }));\n };\n\n const loadCollectionFields = async (field: Field) => {\n const target = field.query('....target').get('value');\n const f = field.query('....target').take();\n console.log('loadCollectionFields', f, field);\n const collection = collections?.find((item) => item.name === target);\n if (!collection) {\n return [];\n }\n return collection?.generalFields\n ?.filter((item) => item?.uiSchema?.title)\n ?.map((item) => ({\n label: item?.uiSchema?.title || item.name,\n value: item.name,\n }));\n };\n return (\n <>\n <Button\n type={'link'}\n onClick={() => {\n setVisible(true);\n const collection = findCollection(ctx.record.collection_name);\n const values = collection?.generalFields?.find(\n (field) => field.key === ctx.record.key,\n );\n form.setValues(clone(values || {}));\n }}\n >\n 编辑\n </Button>\n <Drawer\n title={'编辑字段'}\n width={'50%'}\n visible={visible}\n onClose={() => setVisible(false)}\n footer={\n <Space style={{ float: 'right' }}>\n <Button\n onClick={() => {\n setVisible(false);\n }}\n >\n 取消\n </Button>\n <Button\n type={'primary'}\n onClick={async () => {\n await resource.save(form.values, {\n resourceKey: ctx.record.key,\n });\n setVisible(false);\n await service.refresh();\n await refresh();\n }}\n >\n 确定\n </Button>\n </Space>\n }\n >\n <FormProvider form={form}>\n <SchemaField\n scope={{\n loadCollections,\n loadCollectionFields,\n }}\n schema={{\n type: 'object',\n properties: clone(schema.properties),\n }}\n />\n </FormProvider>\n </Drawer>\n </>\n );\n}\n\nexport const Collections = () => {\n return (\n <SchemaRenderer\n components={{\n VisibleProvider,\n CreateFieldButton,\n EditFieldButton,\n }}\n schema={schema}\n />\n );\n};\n\nexport default Collections;\n"]}
|
|
@@ -315,7 +315,8 @@ try {
|
|
|
315
315
|
|
|
316
316
|
fieldInterfaces.push({
|
|
317
317
|
value: key,
|
|
318
|
-
label: schema.title
|
|
318
|
+
label: schema.title,
|
|
319
|
+
disabled: schema.disabled
|
|
319
320
|
});
|
|
320
321
|
}
|
|
321
322
|
} catch (err) {
|
|
@@ -763,6 +764,7 @@ function CreateFieldButton() {
|
|
|
763
764
|
key: groupIndex,
|
|
764
765
|
title: option.label
|
|
765
766
|
}, option.children.map(item => react_1.default.createElement(antd_1.Menu.Item, {
|
|
767
|
+
disabled: item.disabled,
|
|
766
768
|
style: {
|
|
767
769
|
minWidth: 120
|
|
768
770
|
},
|
|
@@ -778,20 +780,25 @@ function CreateFieldButton() {
|
|
|
778
780
|
title: '添加字段',
|
|
779
781
|
width: '50%',
|
|
780
782
|
visible: visible,
|
|
781
|
-
onClose: () =>
|
|
783
|
+
onClose: () => {
|
|
784
|
+
setVisible(false);
|
|
785
|
+
form.reset();
|
|
786
|
+
},
|
|
782
787
|
footer: react_1.default.createElement(antd_1.Space, {
|
|
783
788
|
style: {
|
|
784
789
|
float: 'right'
|
|
785
790
|
}
|
|
786
791
|
}, react_1.default.createElement(antd_1.Button, {
|
|
787
|
-
onClick: () => {
|
|
792
|
+
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
788
793
|
setVisible(false);
|
|
789
|
-
|
|
794
|
+
yield form.reset();
|
|
795
|
+
})
|
|
790
796
|
}, "\u53D6\u6D88"), react_1.default.createElement(antd_1.Button, {
|
|
791
797
|
type: 'primary',
|
|
792
798
|
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
793
799
|
yield resource.save(form.values);
|
|
794
800
|
setVisible(false);
|
|
801
|
+
yield form.reset();
|
|
795
802
|
yield service.refresh();
|
|
796
803
|
yield refresh();
|
|
797
804
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/admin-layout/Collections/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA2C;AAC3C,+CAAwE;AAGxE,+DAGuC;AACvC,+BAA6D;AAC7D,6CAA+D;AAE/D,4CAAsD;AACtD,gDAA6C;AAC7C,kDAAmE;AACnE,mCAAoC;AACpC,8CAAkD;AAClD,0CAA0E;AAC1E,gDAA4D;AAC5D,iCAAsC;AAEtC,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,IACL,OAAO,EAAE,GAAG,EAAE;wBACZ,UAAU,CAAC,KAAK,CAAC,CAAC;oBACpB,CAAC,mBAGM;gBACT,8BAAC,aAAM,IACL,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,GAAS,EAAE;wBAClB,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;4BAC/B,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG;yBAC5B,CAAC,CAAC;wBACH,UAAU,CAAC,KAAK,CAAC,CAAC;wBAClB,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;wBACxB,MAAM,OAAO,EAAE,CAAC;oBAClB,CAAC,CAAA,mBAGM,CACH;YAGV,8BAAC,oBAAY,IAAC,IAAI,EAAE,IAAI;gBACtB,8BAAC,qBAAW,IACV,KAAK,EAAE;wBACL,eAAe;wBACf,oBAAoB;qBACrB,EACD,MAAM,EAAE;wBACN,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,cAAK,CAAC,MAAM,CAAC,UAAU,CAAC;qBACrC,GACD,CACW,CACR,CACR,CACJ,CAAC;AACJ,CAAC;AAEM,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,OAAO,CACL,8BAAC,kBAAc,IACb,UAAU,EAAE;YACV,eAAe;YACf,iBAAiB;YACjB,eAAe;SAChB,EACD,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,WAAW,eAWtB;AAEF,kBAAe,mBAAW,CAAC","file":"index.js","sourcesContent":["import { SchemaRenderer } from '../../../';\nimport React, { useContext, useEffect, useMemo, useState } from 'react';\nimport { FormItem } from '@formily/antd';\nimport { action } from '@formily/reactive';\nimport {\n useCollectionContext,\n useCollectionsContext,\n} from '../../../constate/Collections';\nimport { Button, Drawer, Menu, Dropdown, Space } from 'antd';\nimport { PlusOutlined, DownOutlined } from '@ant-design/icons';\nimport cls from 'classnames';\nimport { uid, isValid, clone } from '@formily/shared';\nimport { Resource } from '../../../resource';\nimport { TableRowContext, useTable } from '../../../schemas/table';\nimport { useRequest } from 'ahooks';\nimport { VisibleContext } from '../../../context';\nimport { connect, FormProvider, observer, useForm } from '@formily/react';\nimport { DescriptionsContext } from '../../../schemas/form';\nimport { createContext } from 'react';\nimport { ISchema } from '../../../';\nimport { createForm, Field } from '@formily/core';\nimport { SchemaField } from '../../../schemas';\nimport {\n interfaces,\n options,\n} from '../../../schemas/database-field/interfaces';\nimport { useResourceRequest } from '../../../constate';\n\nexport const RoleContext = createContext(null);\n\nfunction VisibleProvider(props) {\n const ctx = useContext(TableRowContext);\n const [visible, setVisible] = useState(false);\n return (\n <VisibleContext.Provider value={[visible, setVisible]}>\n {props.children}\n </VisibleContext.Provider>\n );\n}\n\nconst useResource = () => {\n const resource = useResourceRequest('collections');\n return {\n resource,\n };\n};\n\nconst useCollectionsResource = () => {\n const descriptionsContext = useContext(DescriptionsContext);\n console.log('descriptionsContext.service', descriptionsContext.service);\n const resource = useResourceRequest('collections');\n return {\n resource,\n };\n};\n\nclass ActionPermissionResource extends Resource {\n save(options?: any) {\n console.log('ActionPermissionResource.save');\n return Promise.resolve({});\n }\n}\n\nconst useActionPermissionSubmit = () => {\n const form = useForm();\n const role = useContext(RoleContext);\n const resource = useResourceRequest({\n resourceName: 'roles',\n resourceKey: role.name,\n });\n return {\n async run() {\n await resource.save(form.values);\n console.log('useActionPermissionSubmit', form.values?.actionPermissions);\n },\n };\n};\n\nconst useActionPermissionResource = ({ onSuccess }) => {\n const role = useContext(RoleContext);\n console.log('RoleContext', role);\n // const { props } = useTable();\n const ctx = useContext(TableRowContext);\n const resource = useResourceRequest({\n resourceName: 'action_permissions',\n }, ActionPermissionResource);\n const service = useRequest(\n (params?: any) => {\n return resource.list({\n ...params,\n filter: {\n role_name: role.name,\n collection_name: ctx.record.name,\n },\n appends: ['fields'],\n });\n },\n {\n formatResult: (result) => result?.data,\n onSuccess(data) {\n console.log('actionPermissions', data);\n onSuccess({\n actionPermissions: data.map((permission) => {\n const item: any = {};\n Object.keys(permission).forEach((key) => {\n if (isValid(permission[key])) {\n item[key] = permission[key];\n }\n });\n item.fields = permission?.fields.map((field) => field.key) || [];\n return item;\n }),\n });\n },\n manual: true,\n },\n );\n const [visible] = useContext(VisibleContext);\n\n useEffect(() => {\n if (visible) {\n service.run({});\n }\n }, [visible]);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useDetailsResource = ({ onSuccess }) => {\n const { props } = useTable();\n const ctx = useContext(TableRowContext);\n const resource = useResourceRequest({\n resourceName: 'collections',\n resourceKey: ctx.record[props.rowKey],\n });\n const service = useRequest(\n (params?: any) => {\n return resource.get({ ...params });\n },\n {\n formatResult: (result) => result?.data,\n onSuccess,\n manual: true,\n },\n );\n const [visible] = useContext(VisibleContext);\n\n useEffect(() => {\n if (visible) {\n service.run({});\n }\n }, [visible]);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useFieldsResource = () => {\n const { props } = useTable();\n const ctx = useContext(TableRowContext);\n class FieldResource extends Resource {\n list(options) {\n return super.list({\n ...options,\n filter: { state: 1, collection_name: ctx.record[props.rowKey] },\n });\n }\n }\n const resource = useResourceRequest('fields', FieldResource);\n return {\n resource,\n };\n};\n\nconst fieldInterfaces = [];\nfor (const [key, schema] of interfaces) {\n fieldInterfaces.push({\n value: key,\n label: schema.title,\n });\n}\n\nconst collectionSchema: ISchema = {\n type: 'array',\n 'x-decorator': 'VisibleProvider',\n 'x-component': 'Table',\n default: [],\n 'x-component-props': {\n rowKey: 'key',\n dragSort: true,\n showIndex: true,\n refreshRequestOnChange: true,\n pagination: {\n pageSize: 100,\n },\n defaultAppends: ['uiSchema'],\n useResource: useFieldsResource,\n collectionName: 'fields',\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Table.ActionBar',\n properties: {\n [uid()]: {\n type: 'void',\n name: 'action1',\n title: '删除',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'destroy',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n [uid()]: {\n type: 'void',\n title: '添加',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'create',\n },\n 'x-component': 'CreateFieldButton',\n 'x-component-props': {\n type: 'primary',\n icon: 'PlusOutlined',\n },\n },\n },\n },\n column1: {\n type: 'void',\n title: '字段名称',\n 'x-component': 'Table.Column',\n properties: {\n 'uiSchema.title': {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column2: {\n type: 'void',\n title: '字段标识',\n 'x-component': 'Table.Column',\n properties: {\n name: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column3: {\n type: 'void',\n title: '字段类型',\n 'x-component': 'Table.Column',\n properties: {\n interface: {\n type: 'string',\n 'x-component': 'Select',\n 'x-read-pretty': true,\n // @ts-ignore\n enum: fieldInterfaces,\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '操作',\n 'x-component': 'Table.Column',\n 'x-component-props': {\n width: 160,\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Action.Group',\n 'x-component-props': {\n type: 'link',\n },\n properties: {\n [uid()]: {\n type: 'void',\n title: '编辑',\n 'x-component': 'EditFieldButton',\n 'x-component-props': {\n type: 'link',\n useAction() {\n return {\n async run() {\n alert('abc');\n },\n };\n },\n },\n 'x-action-type': 'update',\n },\n [uid()]: {\n type: 'void',\n title: '删除',\n 'x-component': 'Action',\n 'x-action-type': 'destroy',\n 'x-component-props': {\n type: 'link',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n },\n },\n },\n },\n },\n};\n\nfunction FieldConfigTitle() {\n const ctx = useContext(TableRowContext);\n return <>{`配置「${ctx.record.title}」表字段`}</>;\n}\n\nconst schema: ISchema = {\n type: 'void',\n name: 'action',\n 'x-component': 'Action',\n 'x-component-props': {\n tooltip: '数据表配置',\n className: 'nb-database-config',\n icon: 'DatabaseOutlined',\n type: 'primary',\n },\n properties: {\n modal1: {\n type: 'void',\n title: '数据表配置',\n 'x-component': 'Action.Drawer',\n properties: {\n table: {\n type: 'array',\n // 'x-decorator': 'CardItem',\n 'x-component': 'Table',\n default: [],\n 'x-component-props': {\n rowKey: 'name',\n dragSort: true,\n showIndex: true,\n refreshRequestOnChange: true,\n pagination: {\n pageSize: 100,\n },\n useResource,\n collectionName: 'collections',\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Table.ActionBar',\n properties: {\n [uid()]: {\n type: 'void',\n name: 'action1',\n title: '删除',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'destroy',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n [uid()]: {\n type: 'void',\n title: '创建数据表',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'create',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n icon: 'PlusOutlined',\n },\n properties: {\n modal: {\n type: 'void',\n title: '创建数据表',\n 'x-decorator': 'Form',\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction: '{{ Table.useTableCreateAction }}',\n },\n properties: {\n title: {\n type: 'string',\n title: '数据表名称',\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n },\n },\n },\n },\n },\n },\n },\n column1: {\n type: 'void',\n title: '数据表名称',\n 'x-component': 'Table.Column',\n properties: {\n title: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column2: {\n type: 'void',\n title: '数据表标识',\n 'x-component': 'Table.Column',\n properties: {\n name: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '操作',\n 'x-component': 'Table.Column',\n 'x-component-props': {\n width: 160,\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Action.Group',\n 'x-component-props': {\n type: 'link',\n },\n properties: {\n [uid()]: {\n type: 'void',\n title: '配置字段',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'link',\n },\n 'x-action-type': 'view',\n properties: {\n [uid()]: {\n type: 'void',\n title: <FieldConfigTitle />,\n // 'x-decorator': 'RoleProvider',\n 'x-component': 'Action.Drawer',\n 'x-component-props': {},\n properties: {\n [uid()]: collectionSchema,\n },\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '编辑',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'link',\n },\n 'x-action-type': 'update',\n properties: {\n [uid()]: {\n type: 'void',\n title: '编辑数据表',\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useResource: useDetailsResource,\n },\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction: '{{ Table.useTableUpdateAction }}',\n },\n properties: {\n title: {\n type: 'string',\n title: '数据表名称',\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n },\n },\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '删除',\n 'x-component': 'Action',\n 'x-action-type': 'destroy',\n 'x-component-props': {\n type: 'link',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n};\n\nfunction CreateFieldButton() {\n const { refresh } = useCollectionsContext();\n const ctx = useContext(TableRowContext);\n const { service } = useTable();\n const [visible, setVisible] = useState(false);\n const form = useMemo(() => createForm(), []);\n const [properties, setProperties] = useState({});\n const { collections = [], loading } = useCollectionsContext();\n const resource = useResourceRequest('fields');\n\n const loadCollections = async (field: any) => {\n return collections.map((item: any) => ({\n label: item.title,\n value: item.name,\n }));\n };\n\n const loadCollectionFields = async (field: Field) => {\n const target = field.query('....target').get('value');\n const f = field.query('....target').take();\n console.log('loadCollectionFields', f, field);\n const collection = collections?.find((item) => item.name === target);\n if (!collection) {\n return [];\n }\n return collection?.generalFields\n ?.filter((item) => item?.uiSchema?.title)\n ?.map((item) => ({\n label: item?.uiSchema?.title || item.name,\n value: item.name,\n }));\n };\n\n const menu = (\n <Menu\n onClick={(info) => {\n console.log('click', info.key);\n const schema = interfaces.get(info.key);\n form.setValues({\n ...schema.default,\n collection_name: ctx.record.name,\n key: uid(),\n name: uid(),\n interface: info.key,\n });\n setProperties(clone(schema.properties));\n setVisible(true);\n }}\n >\n {options.map(\n (option, groupIndex) =>\n option.children.length > 0 && (\n <Menu.SubMenu key={groupIndex} title={option.label}>\n {option.children.map((item) => (\n <Menu.Item style={{ minWidth: 120 }} key={item.name}>\n {item.title}\n </Menu.Item>\n ))}\n </Menu.SubMenu>\n ),\n )}\n </Menu>\n );\n return (\n <>\n <Dropdown overlay={menu} overlayClassName={'all-fields'}>\n <Button type={'primary'} icon={<PlusOutlined />}>\n 添加 <DownOutlined />\n </Button>\n </Dropdown>\n <Drawer\n title={'添加字段'}\n width={'50%'}\n visible={visible}\n onClose={() => setVisible(false)}\n footer={\n <Space style={{ float: 'right' }}>\n <Button\n onClick={() => {\n setVisible(false);\n }}\n >\n 取消\n </Button>\n <Button\n type={'primary'}\n onClick={async () => {\n await resource.save(form.values);\n setVisible(false);\n await service.refresh();\n await refresh();\n }}\n >\n 确定\n </Button>\n </Space>\n }\n >\n <FormProvider form={form}>\n <SchemaField\n scope={{\n loadCollections,\n loadCollectionFields,\n }}\n schema={{\n type: 'object',\n properties,\n }}\n />\n </FormProvider>\n </Drawer>\n </>\n );\n}\n\nfunction EditFieldButton() {\n const { refresh, findCollection } = useCollectionsContext();\n const { service } = useTable();\n const ctx = useContext(TableRowContext);\n const [visible, setVisible] = useState(false);\n const form = useMemo(() => createForm(), []);\n const schema = interfaces.get(ctx.record.interface);\n const { collections = [], loading } = useCollectionsContext();\n const resource = useResourceRequest('fields');\n\n const loadCollections = async (field: any) => {\n return collections.map((item: any) => ({\n label: item.title,\n value: item.name,\n }));\n };\n\n const loadCollectionFields = async (field: Field) => {\n const target = field.query('....target').get('value');\n const f = field.query('....target').take();\n console.log('loadCollectionFields', f, field);\n const collection = collections?.find((item) => item.name === target);\n if (!collection) {\n return [];\n }\n return collection?.generalFields\n ?.filter((item) => item?.uiSchema?.title)\n ?.map((item) => ({\n label: item?.uiSchema?.title || item.name,\n value: item.name,\n }));\n };\n return (\n <>\n <Button\n type={'link'}\n onClick={() => {\n setVisible(true);\n const collection = findCollection(ctx.record.collection_name);\n const values = collection?.generalFields?.find(\n (field) => field.key === ctx.record.key,\n );\n form.setValues(clone(values || {}));\n }}\n >\n 编辑\n </Button>\n <Drawer\n title={'编辑字段'}\n width={'50%'}\n visible={visible}\n onClose={() => setVisible(false)}\n footer={\n <Space style={{ float: 'right' }}>\n <Button\n onClick={() => {\n setVisible(false);\n }}\n >\n 取消\n </Button>\n <Button\n type={'primary'}\n onClick={async () => {\n await resource.save(form.values, {\n resourceKey: ctx.record.key,\n });\n setVisible(false);\n await service.refresh();\n await refresh();\n }}\n >\n 确定\n </Button>\n </Space>\n }\n >\n <FormProvider form={form}>\n <SchemaField\n scope={{\n loadCollections,\n loadCollectionFields,\n }}\n schema={{\n type: 'object',\n properties: clone(schema.properties),\n }}\n />\n </FormProvider>\n </Drawer>\n </>\n );\n}\n\nexport const Collections = () => {\n return (\n <SchemaRenderer\n components={{\n VisibleProvider,\n CreateFieldButton,\n EditFieldButton,\n }}\n schema={schema}\n />\n );\n};\n\nexport default Collections;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/admin-layout/Collections/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;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eAAe;YACf,iBAAiB;YACjB,eAAe;SAChB,EACD,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,WAAW,eAWtB;AAEF,kBAAe,mBAAW,CAAC","file":"index.js","sourcesContent":["import { SchemaRenderer } from '../../../';\nimport React, { useContext, useEffect, useMemo, useState } from 'react';\nimport { FormItem } from '@formily/antd';\nimport { action } from '@formily/reactive';\nimport {\n useCollectionContext,\n useCollectionsContext,\n} from '../../../constate/Collections';\nimport { Button, Drawer, Menu, Dropdown, Space } from 'antd';\nimport { PlusOutlined, DownOutlined } from '@ant-design/icons';\nimport cls from 'classnames';\nimport { uid, isValid, clone } from '@formily/shared';\nimport { Resource } from '../../../resource';\nimport { TableRowContext, useTable } from '../../../schemas/table';\nimport { useRequest } from 'ahooks';\nimport { VisibleContext } from '../../../context';\nimport { connect, FormProvider, observer, useForm } from '@formily/react';\nimport { DescriptionsContext } from '../../../schemas/form';\nimport { createContext } from 'react';\nimport { ISchema } from '../../../';\nimport { createForm, Field } from '@formily/core';\nimport { SchemaField } from '../../../schemas';\nimport {\n interfaces,\n options,\n} from '../../../schemas/database-field/interfaces';\nimport { useResourceRequest } from '../../../constate';\n\nexport const RoleContext = createContext(null);\n\nfunction VisibleProvider(props) {\n const ctx = useContext(TableRowContext);\n const [visible, setVisible] = useState(false);\n return (\n <VisibleContext.Provider value={[visible, setVisible]}>\n {props.children}\n </VisibleContext.Provider>\n );\n}\n\nconst useResource = () => {\n const resource = useResourceRequest('collections');\n return {\n resource,\n };\n};\n\nconst useCollectionsResource = () => {\n const descriptionsContext = useContext(DescriptionsContext);\n console.log('descriptionsContext.service', descriptionsContext.service);\n const resource = useResourceRequest('collections');\n return {\n resource,\n };\n};\n\nclass ActionPermissionResource extends Resource {\n save(options?: any) {\n console.log('ActionPermissionResource.save');\n return Promise.resolve({});\n }\n}\n\nconst useActionPermissionSubmit = () => {\n const form = useForm();\n const role = useContext(RoleContext);\n const resource = useResourceRequest({\n resourceName: 'roles',\n resourceKey: role.name,\n });\n return {\n async run() {\n await resource.save(form.values);\n console.log('useActionPermissionSubmit', form.values?.actionPermissions);\n },\n };\n};\n\nconst useActionPermissionResource = ({ onSuccess }) => {\n const role = useContext(RoleContext);\n console.log('RoleContext', role);\n // const { props } = useTable();\n const ctx = useContext(TableRowContext);\n const resource = useResourceRequest(\n {\n resourceName: 'action_permissions',\n },\n ActionPermissionResource,\n );\n const service = useRequest(\n (params?: any) => {\n return resource.list({\n ...params,\n filter: {\n role_name: role.name,\n collection_name: ctx.record.name,\n },\n appends: ['fields'],\n });\n },\n {\n formatResult: (result) => result?.data,\n onSuccess(data) {\n console.log('actionPermissions', data);\n onSuccess({\n actionPermissions: data.map((permission) => {\n const item: any = {};\n Object.keys(permission).forEach((key) => {\n if (isValid(permission[key])) {\n item[key] = permission[key];\n }\n });\n item.fields = permission?.fields.map((field) => field.key) || [];\n return item;\n }),\n });\n },\n manual: true,\n },\n );\n const [visible] = useContext(VisibleContext);\n\n useEffect(() => {\n if (visible) {\n service.run({});\n }\n }, [visible]);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useDetailsResource = ({ onSuccess }) => {\n const { props } = useTable();\n const ctx = useContext(TableRowContext);\n const resource = useResourceRequest({\n resourceName: 'collections',\n resourceKey: ctx.record[props.rowKey],\n });\n const service = useRequest(\n (params?: any) => {\n return resource.get({ ...params });\n },\n {\n formatResult: (result) => result?.data,\n onSuccess,\n manual: true,\n },\n );\n const [visible] = useContext(VisibleContext);\n\n useEffect(() => {\n if (visible) {\n service.run({});\n }\n }, [visible]);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useFieldsResource = () => {\n const { props } = useTable();\n const ctx = useContext(TableRowContext);\n class FieldResource extends Resource {\n list(options) {\n return super.list({\n ...options,\n filter: { state: 1, collection_name: ctx.record[props.rowKey] },\n });\n }\n }\n const resource = useResourceRequest('fields', FieldResource);\n return {\n resource,\n };\n};\n\nconst fieldInterfaces = [];\nfor (const [key, schema] of interfaces) {\n fieldInterfaces.push({\n value: key,\n label: schema.title,\n disabled: schema.disabled,\n });\n}\n\nconst collectionSchema: ISchema = {\n type: 'array',\n 'x-decorator': 'VisibleProvider',\n 'x-component': 'Table',\n default: [],\n 'x-component-props': {\n rowKey: 'key',\n dragSort: true,\n showIndex: true,\n refreshRequestOnChange: true,\n pagination: {\n pageSize: 100,\n },\n defaultAppends: ['uiSchema'],\n useResource: useFieldsResource,\n collectionName: 'fields',\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Table.ActionBar',\n properties: {\n [uid()]: {\n type: 'void',\n name: 'action1',\n title: '删除',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'destroy',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n [uid()]: {\n type: 'void',\n title: '添加',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'create',\n },\n 'x-component': 'CreateFieldButton',\n 'x-component-props': {\n type: 'primary',\n icon: 'PlusOutlined',\n },\n },\n },\n },\n column1: {\n type: 'void',\n title: '字段名称',\n 'x-component': 'Table.Column',\n properties: {\n 'uiSchema.title': {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column2: {\n type: 'void',\n title: '字段标识',\n 'x-component': 'Table.Column',\n properties: {\n name: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column3: {\n type: 'void',\n title: '字段类型',\n 'x-component': 'Table.Column',\n properties: {\n interface: {\n type: 'string',\n 'x-component': 'Select',\n 'x-read-pretty': true,\n // @ts-ignore\n enum: fieldInterfaces,\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '操作',\n 'x-component': 'Table.Column',\n 'x-component-props': {\n width: 160,\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Action.Group',\n 'x-component-props': {\n type: 'link',\n },\n properties: {\n [uid()]: {\n type: 'void',\n title: '编辑',\n 'x-component': 'EditFieldButton',\n 'x-component-props': {\n type: 'link',\n useAction() {\n return {\n async run() {\n alert('abc');\n },\n };\n },\n },\n 'x-action-type': 'update',\n },\n [uid()]: {\n type: 'void',\n title: '删除',\n 'x-component': 'Action',\n 'x-action-type': 'destroy',\n 'x-component-props': {\n type: 'link',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n },\n },\n },\n },\n },\n};\n\nfunction FieldConfigTitle() {\n const ctx = useContext(TableRowContext);\n return <>{`配置「${ctx.record.title}」表字段`}</>;\n}\n\nconst schema: ISchema = {\n type: 'void',\n name: 'action',\n 'x-component': 'Action',\n 'x-component-props': {\n tooltip: '数据表配置',\n className: 'nb-database-config',\n icon: 'DatabaseOutlined',\n type: 'primary',\n },\n properties: {\n modal1: {\n type: 'void',\n title: '数据表配置',\n 'x-component': 'Action.Drawer',\n properties: {\n table: {\n type: 'array',\n // 'x-decorator': 'CardItem',\n 'x-component': 'Table',\n default: [],\n 'x-component-props': {\n rowKey: 'name',\n dragSort: true,\n showIndex: true,\n refreshRequestOnChange: true,\n pagination: {\n pageSize: 100,\n },\n useResource,\n collectionName: 'collections',\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Table.ActionBar',\n properties: {\n [uid()]: {\n type: 'void',\n name: 'action1',\n title: '删除',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'destroy',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n icon: 'DeleteOutlined',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n [uid()]: {\n type: 'void',\n title: '创建数据表',\n 'x-align': 'right',\n 'x-decorator': 'AddNew.Displayed',\n 'x-decorator-props': {\n displayName: 'create',\n },\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n icon: 'PlusOutlined',\n },\n properties: {\n modal: {\n type: 'void',\n title: '创建数据表',\n 'x-decorator': 'Form',\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction: '{{ Table.useTableCreateAction }}',\n },\n properties: {\n title: {\n type: 'string',\n title: '数据表名称',\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n },\n },\n },\n },\n },\n },\n },\n column1: {\n type: 'void',\n title: '数据表名称',\n 'x-component': 'Table.Column',\n properties: {\n title: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n column2: {\n type: 'void',\n title: '数据表标识',\n 'x-component': 'Table.Column',\n properties: {\n name: {\n type: 'string',\n 'x-component': 'Input',\n 'x-read-pretty': true,\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '操作',\n 'x-component': 'Table.Column',\n 'x-component-props': {\n width: 160,\n },\n properties: {\n [uid()]: {\n type: 'void',\n 'x-component': 'Action.Group',\n 'x-component-props': {\n type: 'link',\n },\n properties: {\n [uid()]: {\n type: 'void',\n title: '配置字段',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'link',\n },\n 'x-action-type': 'view',\n properties: {\n [uid()]: {\n type: 'void',\n title: <FieldConfigTitle />,\n // 'x-decorator': 'RoleProvider',\n 'x-component': 'Action.Drawer',\n 'x-component-props': {},\n properties: {\n [uid()]: collectionSchema,\n },\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '编辑',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'link',\n },\n 'x-action-type': 'update',\n properties: {\n [uid()]: {\n type: 'void',\n title: '编辑数据表',\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useResource: useDetailsResource,\n },\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction: '{{ Table.useTableUpdateAction }}',\n },\n properties: {\n title: {\n type: 'string',\n title: '数据表名称',\n 'x-component': 'Input',\n 'x-decorator': 'FormilyFormItem',\n },\n },\n },\n },\n },\n [uid()]: {\n type: 'void',\n title: '删除',\n 'x-component': 'Action',\n 'x-action-type': 'destroy',\n 'x-component-props': {\n type: 'link',\n confirm: {\n title: '删除数据',\n content: '删除后无法恢复,确定要删除吗?',\n },\n useAction: '{{ Table.useTableDestroyAction }}',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n};\n\nfunction CreateFieldButton() {\n const { refresh } = useCollectionsContext();\n const ctx = useContext(TableRowContext);\n const { service } = useTable();\n const [visible, setVisible] = useState(false);\n const form = useMemo(() => createForm(), []);\n const [properties, setProperties] = useState({});\n const { collections = [], loading } = useCollectionsContext();\n const resource = useResourceRequest('fields');\n\n const loadCollections = async (field: any) => {\n return collections.map((item: any) => ({\n label: item.title,\n value: item.name,\n }));\n };\n\n const loadCollectionFields = async (field: Field) => {\n const target = field.query('....target').get('value');\n const f = field.query('....target').take();\n console.log('loadCollectionFields', f, field);\n const collection = collections?.find((item) => item.name === target);\n if (!collection) {\n return [];\n }\n return collection?.generalFields\n ?.filter((item) => item?.uiSchema?.title)\n ?.map((item) => ({\n label: item?.uiSchema?.title || item.name,\n value: item.name,\n }));\n };\n\n const menu = (\n <Menu\n onClick={(info) => {\n console.log('click', info.key);\n const schema = interfaces.get(info.key);\n form.setValues({\n ...schema.default,\n collection_name: ctx.record.name,\n key: uid(),\n name: uid(),\n interface: info.key,\n });\n setProperties(clone(schema.properties));\n setVisible(true);\n }}\n >\n {options.map(\n (option, groupIndex) =>\n option.children.length > 0 && (\n <Menu.SubMenu key={groupIndex} title={option.label}>\n {option.children.map((item) => (\n <Menu.Item\n disabled={item.disabled}\n style={{ minWidth: 120 }}\n key={item.name}\n >\n {item.title}\n </Menu.Item>\n ))}\n </Menu.SubMenu>\n ),\n )}\n </Menu>\n );\n return (\n <>\n <Dropdown overlay={menu} overlayClassName={'all-fields'}>\n <Button type={'primary'} icon={<PlusOutlined />}>\n 添加 <DownOutlined />\n </Button>\n </Dropdown>\n <Drawer\n title={'添加字段'}\n width={'50%'}\n visible={visible}\n onClose={() => {\n setVisible(false);\n form.reset();\n }}\n footer={\n <Space style={{ float: 'right' }}>\n <Button\n onClick={async () => {\n setVisible(false);\n await form.reset();\n }}\n >\n 取消\n </Button>\n <Button\n type={'primary'}\n onClick={async () => {\n await resource.save(form.values);\n setVisible(false);\n await form.reset();\n await service.refresh();\n await refresh();\n }}\n >\n 确定\n </Button>\n </Space>\n }\n >\n <FormProvider form={form}>\n <SchemaField\n scope={{\n loadCollections,\n loadCollectionFields,\n }}\n schema={{\n type: 'object',\n properties,\n }}\n />\n </FormProvider>\n </Drawer>\n </>\n );\n}\n\nfunction EditFieldButton() {\n const { refresh, findCollection } = useCollectionsContext();\n const { service } = useTable();\n const ctx = useContext(TableRowContext);\n const [visible, setVisible] = useState(false);\n const form = useMemo(() => createForm(), []);\n const schema = interfaces.get(ctx.record.interface);\n const { collections = [], loading } = useCollectionsContext();\n const resource = useResourceRequest('fields');\n\n const loadCollections = async (field: any) => {\n return collections.map((item: any) => ({\n label: item.title,\n value: item.name,\n }));\n };\n\n const loadCollectionFields = async (field: Field) => {\n const target = field.query('....target').get('value');\n const f = field.query('....target').take();\n console.log('loadCollectionFields', f, field);\n const collection = collections?.find((item) => item.name === target);\n if (!collection) {\n return [];\n }\n return collection?.generalFields\n ?.filter((item) => item?.uiSchema?.title)\n ?.map((item) => ({\n label: item?.uiSchema?.title || item.name,\n value: item.name,\n }));\n };\n return (\n <>\n <Button\n type={'link'}\n onClick={() => {\n setVisible(true);\n const collection = findCollection(ctx.record.collection_name);\n const values = collection?.generalFields?.find(\n (field) => field.key === ctx.record.key,\n );\n form.setValues(clone(values || {}));\n }}\n >\n 编辑\n </Button>\n <Drawer\n title={'编辑字段'}\n width={'50%'}\n visible={visible}\n onClose={() => setVisible(false)}\n footer={\n <Space style={{ float: 'right' }}>\n <Button\n onClick={() => {\n setVisible(false);\n }}\n >\n 取消\n </Button>\n <Button\n type={'primary'}\n onClick={async () => {\n await resource.save(form.values, {\n resourceKey: ctx.record.key,\n });\n setVisible(false);\n await service.refresh();\n await refresh();\n }}\n >\n 确定\n </Button>\n </Space>\n }\n >\n <FormProvider form={form}>\n <SchemaField\n scope={{\n loadCollections,\n loadCollectionFields,\n }}\n schema={{\n type: 'object',\n properties: clone(schema.properties),\n }}\n />\n </FormProvider>\n </Drawer>\n </>\n );\n}\n\nexport const Collections = () => {\n return (\n <SchemaRenderer\n components={{\n VisibleProvider,\n CreateFieldButton,\n EditFieldButton,\n }}\n schema={schema}\n />\n );\n};\n\nexport default Collections;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/admin-layout/More.tsx"],"names":[],"mappings":";AA6FA,eAAO,MAAM,IAAI,mBAEhB,CAAC","file":"More.d.ts","sourcesContent":["import React, { useContext, useEffect } from 'react';\nimport { Button } from 'antd';\nimport { SchemaRenderer } from '../schema-renderer';\nimport { useForm } from '@formily/react';\nimport { useRequest } from 'ahooks';\nimport { VisibleContext } from '../../context';\nimport { ISchema } from '../../schemas';\nimport { SystemSettingsContext } from './SiteTitle';\n\nconst useResource = ({ onSuccess }) => {\n const { service, resource } = useContext(SystemSettingsContext);\n\n useEffect(() => {\n onSuccess(service.data);\n }, []);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useOkAction = () => {\n const form = useForm();\n const { service, resource } = useContext(SystemSettingsContext);\n return {\n async run() {\n console.log('system_settings.values', form.values);\n await resource.save(form.values);\n await service.mutate(form.values);\n },\n };\n};\n\nconst schema: ISchema = {\n type: 'void',\n name: 'action1',\n // title: '下拉菜单',\n 'x-component': 'Action',\n 'x-component-props': {\n className: 'nb-database-config',\n icon: 'MoreOutlined',\n type: 'primary',\n },\n properties: {\n dropdown1: {\n type: 'void',\n 'x-component': 'Action.Dropdown',\n 'x-component-props': {\n trigger: ['hover'],\n },\n properties: {\n item1: {\n type: 'void',\n title: `系统配置`,\n 'x-component': 'Menu.Action',\n
|
|
1
|
+
{"version":3,"sources":["../src/components/admin-layout/More.tsx"],"names":[],"mappings":";AA6FA,eAAO,MAAM,IAAI,mBAEhB,CAAC","file":"More.d.ts","sourcesContent":["import React, { useContext, useEffect } from 'react';\nimport { Button } from 'antd';\nimport { SchemaRenderer } from '../schema-renderer';\nimport { useForm } from '@formily/react';\nimport { useRequest } from 'ahooks';\nimport { VisibleContext } from '../../context';\nimport { ISchema } from '../../schemas';\nimport { SystemSettingsContext } from './SiteTitle';\n\nconst useResource = ({ onSuccess }) => {\n const { service, resource } = useContext(SystemSettingsContext);\n\n useEffect(() => {\n onSuccess(service.data);\n }, []);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useOkAction = () => {\n const form = useForm();\n const { service, resource } = useContext(SystemSettingsContext);\n return {\n async run() {\n console.log('system_settings.values', form.values);\n await resource.save(form.values);\n await service.mutate(form.values);\n },\n };\n};\n\nconst schema: ISchema = {\n type: 'void',\n name: 'action1',\n // title: '下拉菜单',\n 'x-component': 'Action',\n 'x-component-props': {\n className: 'nb-database-config',\n icon: 'MoreOutlined',\n type: 'primary',\n },\n properties: {\n dropdown1: {\n type: 'void',\n 'x-component': 'Action.Dropdown',\n 'x-component-props': {\n trigger: ['hover'],\n },\n properties: {\n item1: {\n type: 'void',\n title: `系统配置`,\n 'x-component': 'Menu.Action',\n 'x-component-props': {\n icon: 'SettingOutlined',\n },\n properties: {\n drawer1: {\n type: 'void',\n title: '系统配置',\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useResource,\n },\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction,\n },\n properties: {\n title: {\n type: 'string',\n title: '系统名称',\n 'x-decorator': 'FormItem',\n 'x-component': 'Input',\n },\n logo: {\n type: 'string',\n title: 'LOGO',\n 'x-decorator': 'FormItem',\n 'x-component': 'Upload.Attachment',\n 'x-component-props': {\n // accept: 'jpg,png'\n },\n },\n },\n },\n },\n },\n },\n },\n },\n};\n\nexport const More = () => {\n return <SchemaRenderer schema={schema} />;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/admin-layout/More.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqD;AAErD,wDAAoD;AACpD,0CAAyC;AAIzC,2CAAoD;AAEpD,MAAM,WAAW,GAAG,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IACpC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,kBAAU,CAAC,iCAAqB,CAAC,CAAC;IAEhE,iBAAS,CAAC,GAAG,EAAE;QACb,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,uBAAS,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,IAAI,IAAK,OAAO,EAAG;AACxE,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,GAAG,EAAE;IACvB,MAAM,IAAI,GAAG,eAAO,EAAE,CAAC;IACvB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,kBAAU,CAAC,iCAAqB,CAAC,CAAC;IAChE,OAAO;QACC,GAAG;;gBACP,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;gBACnD,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACjC,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACpC,CAAC;SAAA;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAY;IACtB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,SAAS;IAEf,aAAa,EAAE,QAAQ;IACvB,mBAAmB,EAAE;QACnB,SAAS,EAAE,oBAAoB;QAC/B,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,SAAS;KAChB;IACD,UAAU,EAAE;QACV,SAAS,EAAE;YACT,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,iBAAiB;YAChC,mBAAmB,EAAE;gBACnB,OAAO,EAAE,CAAC,OAAO,CAAC;aACnB;YACD,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,MAAM;oBACb,aAAa,EAAE,aAAa;oBAC5B,mBAAmB,EAAE;wBACnB,IAAI,EAAE,iBAAiB;qBACxB;oBACD,UAAU,EAAE;wBACV,OAAO,EAAE;4BACP,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,MAAM;4BACb,aAAa,EAAE,MAAM;4BACrB,mBAAmB,EAAE;gCACnB,WAAW;6BACZ;4BACD,aAAa,EAAE,eAAe;4BAC9B,mBAAmB,EAAE;gCACnB,WAAW;6BACZ;4BACD,UAAU,EAAE;gCACV,KAAK,EAAE;oCACL,IAAI,EAAE,QAAQ;oCACd,KAAK,EAAE,MAAM;oCACb,aAAa,EAAE,UAAU;oCACzB,aAAa,EAAE,OAAO;iCACvB;gCACD,IAAI,EAAE;oCACJ,IAAI,EAAE,QAAQ;oCACd,KAAK,EAAE,MAAM;oCACb,aAAa,EAAE,UAAU;oCACzB,aAAa,EAAE,mBAAmB;oCAClC,mBAAmB,EAAE,EAEpB;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEK,MAAM,IAAI,GAAG,GAAG,EAAE;IACvB,OAAO,8BAAC,gCAAc,IAAC,MAAM,EAAE,MAAM,GAAI,CAAC;AAC5C,CAAC,CAAC;AAFW,QAAA,IAAI,QAEf","file":"More.js","sourcesContent":["import React, { useContext, useEffect } from 'react';\nimport { Button } from 'antd';\nimport { SchemaRenderer } from '../schema-renderer';\nimport { useForm } from '@formily/react';\nimport { useRequest } from 'ahooks';\nimport { VisibleContext } from '../../context';\nimport { ISchema } from '../../schemas';\nimport { SystemSettingsContext } from './SiteTitle';\n\nconst useResource = ({ onSuccess }) => {\n const { service, resource } = useContext(SystemSettingsContext);\n\n useEffect(() => {\n onSuccess(service.data);\n }, []);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useOkAction = () => {\n const form = useForm();\n const { service, resource } = useContext(SystemSettingsContext);\n return {\n async run() {\n console.log('system_settings.values', form.values);\n await resource.save(form.values);\n await service.mutate(form.values);\n },\n };\n};\n\nconst schema: ISchema = {\n type: 'void',\n name: 'action1',\n // title: '下拉菜单',\n 'x-component': 'Action',\n 'x-component-props': {\n className: 'nb-database-config',\n icon: 'MoreOutlined',\n type: 'primary',\n },\n properties: {\n dropdown1: {\n type: 'void',\n 'x-component': 'Action.Dropdown',\n 'x-component-props': {\n trigger: ['hover'],\n },\n properties: {\n item1: {\n type: 'void',\n title: `系统配置`,\n 'x-component': 'Menu.Action',\n
|
|
1
|
+
{"version":3,"sources":["../src/components/admin-layout/More.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqD;AAErD,wDAAoD;AACpD,0CAAyC;AAIzC,2CAAoD;AAEpD,MAAM,WAAW,GAAG,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IACpC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,kBAAU,CAAC,iCAAqB,CAAC,CAAC;IAEhE,iBAAS,CAAC,GAAG,EAAE;QACb,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,uBAAS,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,IAAI,IAAK,OAAO,EAAG;AACxE,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,GAAG,EAAE;IACvB,MAAM,IAAI,GAAG,eAAO,EAAE,CAAC;IACvB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,kBAAU,CAAC,iCAA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,MAAM;oCACb,aAAa,EAAE,UAAU;oCACzB,aAAa,EAAE,mBAAmB;oCAClC,mBAAmB,EAAE,EAEpB;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEK,MAAM,IAAI,GAAG,GAAG,EAAE;IACvB,OAAO,8BAAC,gCAAc,IAAC,MAAM,EAAE,MAAM,GAAI,CAAC;AAC5C,CAAC,CAAC;AAFW,QAAA,IAAI,QAEf","file":"More.js","sourcesContent":["import React, { useContext, useEffect } from 'react';\nimport { Button } from 'antd';\nimport { SchemaRenderer } from '../schema-renderer';\nimport { useForm } from '@formily/react';\nimport { useRequest } from 'ahooks';\nimport { VisibleContext } from '../../context';\nimport { ISchema } from '../../schemas';\nimport { SystemSettingsContext } from './SiteTitle';\n\nconst useResource = ({ onSuccess }) => {\n const { service, resource } = useContext(SystemSettingsContext);\n\n useEffect(() => {\n onSuccess(service.data);\n }, []);\n\n return { resource, service, initialValues: service.data, ...service };\n};\n\nconst useOkAction = () => {\n const form = useForm();\n const { service, resource } = useContext(SystemSettingsContext);\n return {\n async run() {\n console.log('system_settings.values', form.values);\n await resource.save(form.values);\n await service.mutate(form.values);\n },\n };\n};\n\nconst schema: ISchema = {\n type: 'void',\n name: 'action1',\n // title: '下拉菜单',\n 'x-component': 'Action',\n 'x-component-props': {\n className: 'nb-database-config',\n icon: 'MoreOutlined',\n type: 'primary',\n },\n properties: {\n dropdown1: {\n type: 'void',\n 'x-component': 'Action.Dropdown',\n 'x-component-props': {\n trigger: ['hover'],\n },\n properties: {\n item1: {\n type: 'void',\n title: `系统配置`,\n 'x-component': 'Menu.Action',\n 'x-component-props': {\n icon: 'SettingOutlined',\n },\n properties: {\n drawer1: {\n type: 'void',\n title: '系统配置',\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useResource,\n },\n 'x-component': 'Action.Drawer',\n 'x-component-props': {\n useOkAction,\n },\n properties: {\n title: {\n type: 'string',\n title: '系统名称',\n 'x-decorator': 'FormItem',\n 'x-component': 'Input',\n },\n logo: {\n type: 'string',\n title: 'LOGO',\n 'x-decorator': 'FormItem',\n 'x-component': 'Upload.Attachment',\n 'x-component-props': {\n // accept: 'jpg,png'\n },\n },\n },\n },\n },\n },\n },\n },\n },\n};\n\nexport const More = () => {\n return <SchemaRenderer schema={schema} />;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/admin-layout/Permissions/MenuPermissionTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAoB1B,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"sources":["../src/components/admin-layout/Permissions/MenuPermissionTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAoB1B,eAAO,MAAM,mBAAmB,6DAiG9B,CAAC","file":"MenuPermissionTable.d.ts","sourcesContent":["import React from 'react';\nimport { observer } from '@formily/react';\nimport { Table, Checkbox, Spin } from 'antd';\nimport { useRequest } from 'ahooks';\nimport { Resource } from '../../../resource';\nimport { useContext } from 'react';\nimport { RoleContext } from '.';\nimport { useState } from 'react';\nimport { useResourceRequest } from '../../../constate';\n\nconst getKeys = (items: any[]) => {\n const keys = [];\n for (const item of items) {\n keys.push(item.key);\n const children = getKeys(item.children || []);\n keys.push(...children);\n }\n return keys;\n};\n\nexport const MenuPermissionTable = observer((props) => {\n const role = useContext(RoleContext);\n const [allUiSchemaKyes, setAllUiSchemaKyes] = useState([]);\n const [uiSchemaKyes, setUiSchemaKeys] = useState([]);\n const { data, loading } = useRequest('ui_schemas:getMenuItems', {\n formatResult: (data) => data?.data,\n onSuccess(data) {\n setAllUiSchemaKyes(getKeys(data));\n },\n });\n console.log('allUiSchemaKyes', allUiSchemaKyes);\n const resource = useResourceRequest({\n associatedName: 'roles',\n associatedKey: role.name,\n resourceName: 'ui_schemas',\n });\n useRequest(() => resource.list(), {\n formatResult: (data) => data?.data,\n onSuccess(data) {\n setUiSchemaKeys(getKeys(data));\n },\n });\n const resource2 = useResourceRequest({\n resourceName: 'roles',\n resourceKey: role.name,\n });\n if (loading) {\n return <Spin size={'large'} className={'nb-spin-center'} />;\n }\n return (\n <div>\n <Table\n loading={loading}\n dataSource={data}\n pagination={false}\n expandable={{\n defaultExpandAllRows: true,\n }}\n columns={[\n {\n title: '菜单名称',\n dataIndex: 'title',\n },\n {\n title: (\n <div>\n <Checkbox\n checked={\n allUiSchemaKyes.length > 0 &&\n allUiSchemaKyes.length === uiSchemaKyes.length\n }\n onChange={async (e) => {\n if (e.target.checked) {\n await resource2.save({\n ui_schemas: allUiSchemaKyes,\n });\n setUiSchemaKeys(allUiSchemaKyes);\n } else {\n await resource2.save({\n ui_schemas: [],\n });\n setUiSchemaKeys([]);\n }\n }}\n />{' '}\n 允许访问\n </div>\n ),\n dataIndex: 'key',\n render: (value) => {\n return (\n <Checkbox\n checked={uiSchemaKyes.includes(value)}\n onChange={async (e) => {\n setUiSchemaKeys((prevUiSchemaKeys) => {\n if (e.target.checked) {\n prevUiSchemaKeys.push(value);\n } else {\n const index = prevUiSchemaKeys.findIndex(\n (key) => key === value,\n );\n prevUiSchemaKeys.splice(index, 1);\n }\n return [...prevUiSchemaKeys];\n });\n await resource.toggle({\n resourceKey: value,\n });\n }}\n />\n );\n },\n },\n ]}\n />\n </div>\n );\n});\n"]}
|