[feat] v0.2.2

This commit is contained in:
what 2024-07-19 13:08:18 +08:00
parent a139b8aef7
commit 24fbb40f0a
15 changed files with 91 additions and 93 deletions

2
dist/button.js vendored
View File

@ -1,4 +1,4 @@
import { E, B, C } from "./common/main-DamvcBIJ.js"; import { E, B, C } from "./common/main-DHW9LhcM.js";
import "./common/vender-CMS8SASe.js"; import "./common/vender-CMS8SASe.js";
export { export {
E as auth, E as auth,

View File

@ -21,15 +21,15 @@ import _ from "lodash";
import axios from "axios"; import axios from "axios";
import React, { useMemo, useEffect, useRef, useState, useCallback, useContext, useLayoutEffect, useId as useId$1 } from "react"; import React, { useMemo, useEffect, useRef, useState, useCallback, useContext, useLayoutEffect, useId as useId$1 } from "react";
import Request from "ff-request"; import Request from "ff-request";
import SparkMD5 from "https://assets.fsdpf.net/js/esm/spark-md5@3_0_2.min.js?url"; import SparkMD5 from "spark-md5";
import { jsx, jsxs, Fragment } from "react/jsx-runtime"; import { jsx, jsxs, Fragment } from "react/jsx-runtime";
import { QuestionOutlined, LoadingOutlined, createFromIconfontCN } from "@ant-design/icons"; import { QuestionOutlined, LoadingOutlined, createFromIconfontCN } from "@ant-design/icons";
import cx from "classnames"; import cx from "classnames";
import { P as PropTypes, N as NProgress } from "./vender-CMS8SASe.js"; import { P as PropTypes, N as NProgress } from "./vender-CMS8SASe.js";
import Form, { Field, FieldContext } from "rc-field-form"; import Form, { Field, FieldContext } from "rc-field-form";
import { notification as notification$1, Drawer as Drawer$1, Modal as Modal$1, Form as Form$1, ConfigProvider, Input, Button as Button$1, Breadcrumb, Tree, Pagination, Table, Empty as Empty$1, Popconfirm, Tooltip, Popover as Popover$1 } from "antd"; import { notification as notification$1, Drawer as Drawer$1, Modal as Modal$1, Form as Form$1, ConfigProvider, Input, Button as Button$1, Breadcrumb, Tree, Pagination, Table, Empty as Empty$1, Popconfirm, Tooltip, Popover as Popover$1 } from "antd";
import { flushSync } from "react-dom";
import update from "immutability-helper"; import update from "immutability-helper";
import { useMergedState } from "rc-util";
import { useParams, generatePath, Navigate, createBrowserRouter } from "react-router-dom"; import { useParams, generatePath, Navigate, createBrowserRouter } from "react-router-dom";
const Iconfont = ({ type, className, ...props }) => { const Iconfont = ({ type, className, ...props }) => {
if (!(type != null && type.startsWith("icon-"))) if (!(type != null && type.startsWith("icon-")))
@ -193,32 +193,24 @@ const _ResWs = class _ResWs {
_instance = new WeakMap(), _oWorker = new WeakMap(), _topic = new WeakMap(), _initWorker = new WeakMap(), __privateAdd(_ResWs, _instance, null), __publicField(_ResWs, "getInstance", () => (__privateGet(_ResWs, _instance) || __privateSet(_ResWs, _instance, new _ResWs()), __privateGet(_ResWs, _instance))); _instance = new WeakMap(), _oWorker = new WeakMap(), _topic = new WeakMap(), _initWorker = new WeakMap(), __privateAdd(_ResWs, _instance, null), __publicField(_ResWs, "getInstance", () => (__privateGet(_ResWs, _instance) || __privateSet(_ResWs, _instance, new _ResWs()), __privateGet(_ResWs, _instance)));
let ResWs = _ResWs; let ResWs = _ResWs;
const ResWs$1 = ResWs.getInstance(), useUpdate = () => { const ResWs$1 = ResWs.getInstance(), useUpdate = () => {
const isMouned = useRef(!0), [value, setValue] = useState(0); const isMouned = useRef(!0), [, forceUpdate] = React.useReducer((x) => x + 1, 0);
return useEffect(() => () => isMouned.current = !1, []), () => isMouned.current && flushSync(() => { return useEffect(() => () => isMouned.current = !1, []), () => isMouned.current && forceUpdate();
setValue(value + 1);
});
}, usePropsValue = ({ value, defaultValue, onChange }) => {
const update2 = useUpdate(), stateRef = useRef(value !== void 0 ? value : defaultValue);
value !== void 0 && (stateRef.current = value);
const setState = useCallback(_.debounce((v) => {
value === void 0 && (stateRef.current = v, update2()), onChange && onChange(v);
}, 380, { leading: !0, trailing: !1 }), [value]);
return [stateRef.current, setState];
}, usePrevious = (state) => { }, usePrevious = (state) => {
const ref = useRef(); const ref = useRef();
return useEffect(() => { return useEffect(() => {
ref.current = state; ref.current = state;
}), ref.current; }, [state]), ref.current;
}, useStateWithCallback = (init) => { }, useStateWithCallback = (initialState) => {
const cbRef = useRef(), [data2, setData] = useState(init); const [state, setState] = useState(initialState), callbackRef = useRef(null), setStateWithCallback = useCallback((newState, callback) => {
callbackRef.current = callback, setState(newState);
}, []);
return useEffect(() => { return useEffect(() => {
_.isFunction(cbRef.current) && cbRef.current(data2); callbackRef.current && (callbackRef.current(state), callbackRef.current = null);
}, [data2]), [data2, function(data3, callback) { }, [state]), [state, setStateWithCallback];
cbRef.current = callback, setData(data3); }, useDeepEqualEffect = (callback = (prevDeps) => {
}]; }, deps, compare = _.isEqual) => {
}, useDeepEqualEffect = (effect = React.EffectCallback, deps, compare = _.isEqual) => {
const oldDeps = React.useRef(deps); const oldDeps = React.useRef(deps);
(!oldDeps.current || !compare(deps, oldDeps.current)) && (oldDeps.current = deps), React.useEffect(effect, [oldDeps.current]); compare(deps, oldDeps.current) || (oldDeps.current = deps), React.useEffect(callback, [oldDeps.current]);
}, transformOptions = (arr, type = "string") => { }, transformOptions = (arr, type = "string") => {
var _a; var _a;
if (!Array.isArray(arr)) if (!Array.isArray(arr))
@ -757,6 +749,7 @@ const getWidgetPropsData = (registerProps = {}, data2 = {}, fns2 = {}, defaultVa
itemGridLayout, itemGridLayout,
$setting, $setting,
tabs, tabs,
isConditionFormLayout,
isTreeSider, isTreeSider,
treeSiderConfig treeSiderConfig
}) => { }) => {
@ -773,7 +766,7 @@ const getWidgetPropsData = (registerProps = {}, data2 = {}, fns2 = {}, defaultVa
return /* @__PURE__ */ jsxs("div", { className: cx("ff-data-list-framework", className), children: [ return /* @__PURE__ */ jsxs("div", { className: cx("ff-data-list-framework", className), children: [
/* @__PURE__ */ jsx(DataListSider, { className: classNames == null ? void 0 : classNames.sider, isTreeSider, ...treeSiderConfig }), /* @__PURE__ */ jsx(DataListSider, { className: classNames == null ? void 0 : classNames.sider, isTreeSider, ...treeSiderConfig }),
/* @__PURE__ */ jsxs("div", { className: cx("ff-data-list-container", classNames == null ? void 0 : classNames.container), children: [ /* @__PURE__ */ jsxs("div", { className: cx("ff-data-list-container", classNames == null ? void 0 : classNames.container), children: [
/* @__PURE__ */ jsx(DataListFilter, { className: classNames == null ? void 0 : classNames.filter }), /* @__PURE__ */ jsx(DataListFilter, { className: classNames == null ? void 0 : classNames.filter, isConditionFormLayout }),
/* @__PURE__ */ jsx( /* @__PURE__ */ jsx(
DataListToolbar, DataListToolbar,
{ {
@ -845,13 +838,14 @@ const getWidgetPropsData = (registerProps = {}, data2 = {}, fns2 = {}, defaultVa
pageSize, pageSize,
isTreeSider, isTreeSider,
treeSiderConfig, treeSiderConfig,
isConditionFormLayout,
...props ...props
}) => { }) => {
const { getBase62params, onClickCallback } = useContext(DataListContext), { total, page } = getBase62params() || {}; const { getBase62params, onClickCallback } = useContext(DataListContext), { total, page } = getBase62params() || {};
return /* @__PURE__ */ jsxs("div", { className: cx("ff-data-table-framework", className), children: [ return /* @__PURE__ */ jsxs("div", { className: cx("ff-data-table-framework", className), children: [
/* @__PURE__ */ jsx(DataListSider, { isTreeSider, ...treeSiderConfig }), /* @__PURE__ */ jsx(DataListSider, { isTreeSider, ...treeSiderConfig }),
/* @__PURE__ */ jsxs("div", { className: "ff-data-table-container", children: [ /* @__PURE__ */ jsxs("div", { className: "ff-data-table-container", children: [
/* @__PURE__ */ jsx(DataListFilter, { listCode }), /* @__PURE__ */ jsx(DataListFilter, { listCode, isConditionFormLayout }),
/* @__PURE__ */ jsx(DataListToolbar, { title }), /* @__PURE__ */ jsx(DataListToolbar, { title }),
/* @__PURE__ */ jsx( /* @__PURE__ */ jsx(
DataListTable, DataListTable,
@ -1012,7 +1006,7 @@ const loadDataListFieldWidget = (widget, value, record, widgetSetting, base62par
const ids = dataSource.map((item) => item == null ? void 0 : item[pk]); const ids = dataSource.map((item) => item == null ? void 0 : item[pk]);
return operations.some(({ uuid }) => !uuid || !itemOperationsAccess.has(uuid) ? !0 : itemOperationsAccess.get(uuid).some((oper) => ids.includes(oper))); return operations.some(({ uuid }) => !uuid || !itemOperationsAccess.has(uuid) ? !0 : itemOperationsAccess.get(uuid).some((oper) => ids.includes(oper)));
}, [operations, dataSource, itemOperationsAccess, pk]), DataListHelper = React.forwardRef(({ listCode, base62params, className, itemClassName, theme: _theme, themeProps, classNames }, ref) => { }, [operations, dataSource, itemOperationsAccess, pk]), DataListHelper = React.forwardRef(({ listCode, base62params, className, itemClassName, theme: _theme, themeProps, classNames }, ref) => {
const [{ tab, page, total, condition, sider, keyword, dataSource, itemOperationsAccess, pageSize }, setData] = useStateWithCallback(base62params), [{ const [{ tab, page, total, condition, sider, keyword, dataSource, itemOperationsAccess, pageSize }, setData] = useState(base62params), [{
resource, resource,
primaryKey, primaryKey,
batchOperations = [], batchOperations = [],
@ -1020,6 +1014,7 @@ const loadDataListFieldWidget = (widget, value, record, widgetSetting, base62par
columns = [], columns = [],
themeConfig, themeConfig,
theme, theme,
isConditionFormLayout = !1,
isTreeSider, isTreeSider,
treeSiderConfig, treeSiderConfig,
isItemGridLayout, isItemGridLayout,
@ -1028,6 +1023,7 @@ const loadDataListFieldWidget = (widget, value, record, widgetSetting, base62par
isPaginate, isPaginate,
tabs tabs
}, setStructure] = useState({ isItemGridLayout: !1, itemGridLayout: {} }), initData = (params) => http.list(listCode, { tab, page, total, condition, sider, keyword, ...params }).then(({ }, setStructure] = useState({ isItemGridLayout: !1, itemGridLayout: {} }), initData = (params) => http.list(listCode, { tab, page, total, condition, sider, keyword, ...params }).then(({
keyword: keyword2,
condition: condition2, condition: condition2,
total: total2, total: total2,
tab: tab2, tab: tab2,
@ -1044,7 +1040,7 @@ const loadDataListFieldWidget = (widget, value, record, widgetSetting, base62par
tab: tab2, tab: tab2,
condition: condition2, condition: condition2,
sider, sider,
keyword, keyword: keyword2,
itemOperationsAccess: new Map(operationsAccess) itemOperationsAccess: new Map(operationsAccess)
}); });
}), isItemOperations = useHasOperationColumn(itemOperations, dataSource, itemOperationsAccess, primaryKey), isBatchOperations = useHasOperationColumn(batchOperations); }), isItemOperations = useHasOperationColumn(itemOperations, dataSource, itemOperationsAccess, primaryKey), isBatchOperations = useHasOperationColumn(batchOperations);
@ -1114,7 +1110,8 @@ const loadDataListFieldWidget = (widget, value, record, widgetSetting, base62par
dataSource, dataSource,
isItemGridLayout, isItemGridLayout,
columns, columns,
itemGridLayout itemGridLayout,
isConditionFormLayout
}, },
className: cx("ff-data-list-helper", className), className: cx("ff-data-list-helper", className),
getBase62params, getBase62params,
@ -1128,20 +1125,22 @@ const loadDataListFieldWidget = (widget, value, record, widgetSetting, base62par
onPageSizeChange onPageSizeChange
} }
); );
}), DataListFilter = ({ className }) => { }), DataListFilter = ({ className, isConditionFormLayout }) => {
var _a, _b; var _a, _b;
const [structure, setStructure] = useState({}), { listCode, onKeywordChange, onConditonChange, getBase62params } = React.useContext(DataListContext), { keyword, condition } = getBase62params() || {}, [form] = Form$1.useForm(); const [structure, setStructure] = useState({}), { listCode, onKeywordChange, onConditonChange, getBase62params } = React.useContext(DataListContext), { keyword, condition } = getBase62params() || {}, [form] = Form$1.useForm();
useEffect(() => { useEffect(() => {
http.get(`/api/_/${listCode}/list-condition-form-layout`).then(({ resource, marginX, marginY, rowHeight, cols, fields }) => { listCode && isConditionFormLayout && http.get(`/api/_/${listCode}/list-condition-form-layout`).then(({ resource, marginX, marginY, rowHeight, cols, fields }) => {
setStructure({ resource, itemMargin: [marginX, marginY], rowHeight, cols, fields }); setStructure({ resource, itemMargin: [marginX, marginY], rowHeight, cols, fields });
}).catch(() => setStructure({})); }).catch(() => setStructure({}));
}, [listCode]), useEffect(() => { }, [listCode, isConditionFormLayout]), useEffect(() => {
form.setFieldsValue({ keyword, ...condition }); form.setFieldsValue({ keyword, ...condition });
}, [JSON.stringify([keyword, condition])]); }, [JSON.stringify([keyword, condition])]);
const onReset = () => { const onReset = () => {
const { keyword: keyword2, condition: condition2 } = getBase62params("init") || {}; const { keyword: keyword2, condition: condition2 } = getBase62params("init") || {};
form.setFieldsValue({ keyword: keyword2, ...condition2 }); form.setFieldsValue({ keyword: keyword2, ...condition2 });
}, onSubmit = (value) => onConditonChange(value[structure == null ? void 0 : structure.resource], value.keyword), onKeywordSearch = (value) => onKeywordChange(value); }, onSubmit = (value) => onConditonChange({
[structure.resource]: value[structure.resource]
}, value.keyword), onKeywordSearch = (value) => onKeywordChange(value);
return /* @__PURE__ */ jsx("div", { className: cx("ff-data-list-filter", className), children: /* @__PURE__ */ jsx( return /* @__PURE__ */ jsx("div", { className: cx("ff-data-list-filter", className), children: /* @__PURE__ */ jsx(
Form$1, Form$1,
{ {
@ -1189,7 +1188,7 @@ DataListFilter.reservedFields = [
} }
]; ];
const DataListToolbar = ({ className, title, tabs, tab, onTabChange }) => { const DataListToolbar = ({ className, title, tabs, tab, onTabChange }) => {
const [tabValue, setTabValue] = usePropsValue({ value: tab, defaultValue: tabs == null ? void 0 : tabs[0].value, onChange: onTabChange }); const [tabValue, setTabValue] = useMergedState(tabs == null ? void 0 : tabs[0].value, { value: tab, onChange: onTabChange });
return /* @__PURE__ */ jsxs("div", { className: cx("ff-data-list-toolbar", className), children: [ return /* @__PURE__ */ jsxs("div", { className: cx("ff-data-list-toolbar", className), children: [
/* @__PURE__ */ jsx("div", { className: "ff-data-list-title", children: title }), /* @__PURE__ */ jsx("div", { className: "ff-data-list-title", children: title }),
/* @__PURE__ */ jsx( /* @__PURE__ */ jsx(
@ -1330,7 +1329,7 @@ const DataListFooter = ({ className, operations, isOperations, isPaginate, total
}] : []), }] : []),
dataSource, dataSource,
size: "middle", size: "middle",
scroll: { x: "max-content", y: divSize.height - 47 }, scroll: { x: "max-content", y: divSize.height - 50 },
pagination: !1, pagination: !1,
expandable: { expandable: {
defaultExpandAllRows: !0, defaultExpandAllRows: !0,
@ -2208,7 +2207,7 @@ export {
AppContext as Y, AppContext as Y,
AppGlobalParamsContext as Z, AppGlobalParamsContext as Z,
Cache as _, Cache as _,
usePropsValue as a, usePrevious as a,
fn as a0, fn as a0,
core as a1, core as a1,
route as a2, route as a2,
@ -2217,27 +2216,27 @@ export {
getConfigure as a5, getConfigure as a5,
getWidgetOperationAuth as a6, getWidgetOperationAuth as a6,
getPhoneNumber as a7, getPhoneNumber as a7,
usePrevious as b, useStateWithCallback as b,
useStateWithCallback as c, useDeepEqualEffect as c,
useDeepEqualEffect as d, useOptions as d,
useOptions as e, useSubscribeRequest as e,
useSubscribeRequest as f, SlotRender as f,
SlotRender as g, FFPageRender as g,
FFPageRender as h, FFPopupRender as h,
FFPopupRender as i, getDefaultExpandRowKeys as i,
getDefaultExpandRowKeys as j, GridLayout as j,
GridLayout as k, GridLayoutWidget as k,
GridLayoutWidget as l, DataListFilter as l,
DataListFilter as m, DataListToolbar as m,
DataListToolbar as n, DataListSider as n,
DataListSider as o, DataListFooter as o,
DataListFooter as p, DataListHelper as p,
DataListHelper as q, DataListContext as q,
DataListContext as r, DataListTable as r,
DataListTable as s, DataListContent as s,
DataListContent as t, DataListFramework as t,
useUpdate as u, useUpdate as u,
DataListFramework as v, DataTableFramework as v,
loadDataListFieldWidget as w, loadDataListFieldWidget as w,
useColumnsRender as x, useColumnsRender as x,
useStructure as y, useStructure as y,

4
dist/components.js vendored
View File

@ -1,5 +1,5 @@
import { N, i } from "./common/main-DamvcBIJ.js"; import { N, h } from "./common/main-DHW9LhcM.js";
export { export {
N as Icon, N as Icon,
i as Popup h as Popup
}; };

8
dist/container.js vendored
View File

@ -1,8 +1,8 @@
import { S, h, i, g, F } from "./common/main-DamvcBIJ.js"; import { S, g, h, f, F } from "./common/main-DHW9LhcM.js";
export { export {
S as Context, S as Context,
h as FFPageRender, g as FFPageRender,
i as FFPopupRender, h as FFPopupRender,
g as SlotRender, f as SlotRender,
F as default F as default
}; };

22
dist/data-list.js vendored
View File

@ -1,15 +1,15 @@
import { t, r, m, p, v, q, o, s, n, v as v2, D, w, x, z, A, y } from "./common/main-DamvcBIJ.js"; import { s, q, l, o, t, p, n, r, m, v, D, w, x, z, A, y } from "./common/main-DHW9LhcM.js";
export { export {
t as DataListContent, s as DataListContent,
r as DataListContext, q as DataListContext,
m as DataListFilter, l as DataListFilter,
p as DataListFooter, o as DataListFooter,
v as DataListFramework, t as DataListFramework,
q as DataListHelper, p as DataListHelper,
o as DataListSider, n as DataListSider,
s as DataListTable, r as DataListTable,
n as DataListToolbar, m as DataListToolbar,
v2 as DataTableFramework, v as DataTableFramework,
D as default, D as default,
w as loadDataListFieldWidget, w as loadDataListFieldWidget,
x as useColumnsRender, x as useColumnsRender,

View File

@ -1,4 +1,4 @@
import { I, K, J, H, M, L } from "./common/main-DamvcBIJ.js"; import { I, K, J, H, M, L } from "./common/main-DHW9LhcM.js";
export { export {
I as GridLayoutForm, I as GridLayoutForm,
K as GridLayoutFormHelper, K as GridLayoutFormHelper,

6
dist/grid-layout.js vendored
View File

@ -1,6 +1,6 @@
import { k, l, G } from "./common/main-DamvcBIJ.js"; import { j, k, G } from "./common/main-DHW9LhcM.js";
export { export {
k as GridLayout, j as GridLayout,
l as GridLayoutWidget, k as GridLayoutWidget,
G as default G as default
}; };

14
dist/hooks.js vendored
View File

@ -1,14 +1,12 @@
import "lodash"; import "lodash";
import "rc-field-form"; import "rc-field-form";
import "react"; import "react";
import "react-dom"; import { c, d, a, b, e, u } from "./common/main-DHW9LhcM.js";
import { d, e, b, a, c, f, u } from "./common/main-DamvcBIJ.js";
export { export {
d as useDeepEqualEffect, c as useDeepEqualEffect,
e as useOptions, d as useOptions,
b as usePrevious, a as usePrevious,
a as usePropsValue, b as useStateWithCallback,
c as useStateWithCallback, e as useSubscribeRequest,
f as useSubscribeRequest,
u as useUpdate u as useUpdate
}; };

2
dist/index.js vendored
View File

@ -1,7 +1,7 @@
import "lodash"; import "lodash";
import "axios"; import "axios";
import "react"; import "react";
import { Z, V, _, $, a1, Y, a0, W, X, a2 } from "./common/main-DamvcBIJ.js"; import { Z, V, _, $, a1, Y, a0, W, X, a2 } from "./common/main-DHW9LhcM.js";
import "ff-request"; import "ff-request";
export { export {
Z as AppGlobalParamsContext, Z as AppGlobalParamsContext,

2
dist/res-ws.js vendored
View File

@ -1,5 +1,5 @@
import "lodash"; import "lodash";
import { R } from "./common/main-DamvcBIJ.js"; import { R } from "./common/main-DHW9LhcM.js";
export { export {
R as default R as default
}; };

2
dist/service.js vendored
View File

@ -1,4 +1,4 @@
import { a5, a4, a7, a3, a6 } from "./common/main-DamvcBIJ.js"; import { a5, a4, a7, a3, a6 } from "./common/main-DHW9LhcM.js";
export { export {
a5 as getConfigure, a5 as getConfigure,
a4 as getMenus, a4 as getMenus,

2
dist/style.css vendored

File diff suppressed because one or more lines are too long

4
dist/user.js vendored
View File

@ -1,9 +1,9 @@
import "https://assets.fsdpf.net/js/esm/spark-md5@3_0_2.min.js?url"; import "spark-md5";
import "react/jsx-runtime"; import "react/jsx-runtime";
import "react"; import "react";
import "@ant-design/icons"; import "@ant-design/icons";
import "classnames"; import "classnames";
import { P, Q, O, T, U } from "./common/main-DamvcBIJ.js"; import { P, Q, O, T, U } from "./common/main-DHW9LhcM.js";
export { export {
P as checkUserToken, P as checkUserToken,
Q as getUserInfo, Q as getUserInfo,

4
dist/utils.js vendored
View File

@ -1,5 +1,5 @@
import "lodash"; import "lodash";
import { j } from "./common/main-DamvcBIJ.js"; import { i } from "./common/main-DHW9LhcM.js";
export { export {
j as getDefaultExpandRowKeys i as getDefaultExpandRowKeys
}; };

View File

@ -1,7 +1,7 @@
{ {
"name": "ff", "name": "ff",
"private": true, "private": true,
"version": "0.2.0", "version": "0.2.2",
"type": "module", "type": "module",
"files": [ "files": [
"dist/" "dist/"
@ -41,6 +41,7 @@
"rc-field-form": "^1.44.0", "rc-field-form": "^1.44.0",
"rc-util": "^5.41.0", "rc-util": "^5.41.0",
"react": "^18.2.0", "react": "^18.2.0",
"spark-md5": "^3.0.2",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-router-dom": "^6.22.3" "react-router-dom": "^6.22.3"
}, },