[feat] v0.2.2
This commit is contained in:
parent
a139b8aef7
commit
24fbb40f0a
2
dist/button.js
vendored
2
dist/button.js
vendored
@ -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";
|
||||
export {
|
||||
E as auth,
|
||||
|
@ -21,15 +21,15 @@ import _ from "lodash";
|
||||
import axios from "axios";
|
||||
import React, { useMemo, useEffect, useRef, useState, useCallback, useContext, useLayoutEffect, useId as useId$1 } from "react";
|
||||
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 { QuestionOutlined, LoadingOutlined, createFromIconfontCN } from "@ant-design/icons";
|
||||
import cx from "classnames";
|
||||
import { P as PropTypes, N as NProgress } from "./vender-CMS8SASe.js";
|
||||
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 { flushSync } from "react-dom";
|
||||
import update from "immutability-helper";
|
||||
import { useMergedState } from "rc-util";
|
||||
import { useParams, generatePath, Navigate, createBrowserRouter } from "react-router-dom";
|
||||
const Iconfont = ({ type, className, ...props }) => {
|
||||
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)));
|
||||
let ResWs = _ResWs;
|
||||
const ResWs$1 = ResWs.getInstance(), useUpdate = () => {
|
||||
const isMouned = useRef(!0), [value, setValue] = useState(0);
|
||||
return useEffect(() => () => isMouned.current = !1, []), () => isMouned.current && flushSync(() => {
|
||||
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];
|
||||
const isMouned = useRef(!0), [, forceUpdate] = React.useReducer((x) => x + 1, 0);
|
||||
return useEffect(() => () => isMouned.current = !1, []), () => isMouned.current && forceUpdate();
|
||||
}, usePrevious = (state) => {
|
||||
const ref = useRef();
|
||||
return useEffect(() => {
|
||||
ref.current = state;
|
||||
}), ref.current;
|
||||
}, useStateWithCallback = (init) => {
|
||||
const cbRef = useRef(), [data2, setData] = useState(init);
|
||||
}, [state]), ref.current;
|
||||
}, useStateWithCallback = (initialState) => {
|
||||
const [state, setState] = useState(initialState), callbackRef = useRef(null), setStateWithCallback = useCallback((newState, callback) => {
|
||||
callbackRef.current = callback, setState(newState);
|
||||
}, []);
|
||||
return useEffect(() => {
|
||||
_.isFunction(cbRef.current) && cbRef.current(data2);
|
||||
}, [data2]), [data2, function(data3, callback) {
|
||||
cbRef.current = callback, setData(data3);
|
||||
}];
|
||||
}, useDeepEqualEffect = (effect = React.EffectCallback, deps, compare = _.isEqual) => {
|
||||
callbackRef.current && (callbackRef.current(state), callbackRef.current = null);
|
||||
}, [state]), [state, setStateWithCallback];
|
||||
}, useDeepEqualEffect = (callback = (prevDeps) => {
|
||||
}, deps, compare = _.isEqual) => {
|
||||
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") => {
|
||||
var _a;
|
||||
if (!Array.isArray(arr))
|
||||
@ -757,6 +749,7 @@ const getWidgetPropsData = (registerProps = {}, data2 = {}, fns2 = {}, defaultVa
|
||||
itemGridLayout,
|
||||
$setting,
|
||||
tabs,
|
||||
isConditionFormLayout,
|
||||
isTreeSider,
|
||||
treeSiderConfig
|
||||
}) => {
|
||||
@ -773,7 +766,7 @@ const getWidgetPropsData = (registerProps = {}, data2 = {}, fns2 = {}, defaultVa
|
||||
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__ */ 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(
|
||||
DataListToolbar,
|
||||
{
|
||||
@ -845,13 +838,14 @@ const getWidgetPropsData = (registerProps = {}, data2 = {}, fns2 = {}, defaultVa
|
||||
pageSize,
|
||||
isTreeSider,
|
||||
treeSiderConfig,
|
||||
isConditionFormLayout,
|
||||
...props
|
||||
}) => {
|
||||
const { getBase62params, onClickCallback } = useContext(DataListContext), { total, page } = getBase62params() || {};
|
||||
return /* @__PURE__ */ jsxs("div", { className: cx("ff-data-table-framework", className), children: [
|
||||
/* @__PURE__ */ jsx(DataListSider, { isTreeSider, ...treeSiderConfig }),
|
||||
/* @__PURE__ */ jsxs("div", { className: "ff-data-table-container", children: [
|
||||
/* @__PURE__ */ jsx(DataListFilter, { listCode }),
|
||||
/* @__PURE__ */ jsx(DataListFilter, { listCode, isConditionFormLayout }),
|
||||
/* @__PURE__ */ jsx(DataListToolbar, { title }),
|
||||
/* @__PURE__ */ jsx(
|
||||
DataListTable,
|
||||
@ -1012,7 +1006,7 @@ const loadDataListFieldWidget = (widget, value, record, widgetSetting, base62par
|
||||
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)));
|
||||
}, [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,
|
||||
primaryKey,
|
||||
batchOperations = [],
|
||||
@ -1020,6 +1014,7 @@ const loadDataListFieldWidget = (widget, value, record, widgetSetting, base62par
|
||||
columns = [],
|
||||
themeConfig,
|
||||
theme,
|
||||
isConditionFormLayout = !1,
|
||||
isTreeSider,
|
||||
treeSiderConfig,
|
||||
isItemGridLayout,
|
||||
@ -1028,6 +1023,7 @@ const loadDataListFieldWidget = (widget, value, record, widgetSetting, base62par
|
||||
isPaginate,
|
||||
tabs
|
||||
}, setStructure] = useState({ isItemGridLayout: !1, itemGridLayout: {} }), initData = (params) => http.list(listCode, { tab, page, total, condition, sider, keyword, ...params }).then(({
|
||||
keyword: keyword2,
|
||||
condition: condition2,
|
||||
total: total2,
|
||||
tab: tab2,
|
||||
@ -1044,7 +1040,7 @@ const loadDataListFieldWidget = (widget, value, record, widgetSetting, base62par
|
||||
tab: tab2,
|
||||
condition: condition2,
|
||||
sider,
|
||||
keyword,
|
||||
keyword: keyword2,
|
||||
itemOperationsAccess: new Map(operationsAccess)
|
||||
});
|
||||
}), isItemOperations = useHasOperationColumn(itemOperations, dataSource, itemOperationsAccess, primaryKey), isBatchOperations = useHasOperationColumn(batchOperations);
|
||||
@ -1114,7 +1110,8 @@ const loadDataListFieldWidget = (widget, value, record, widgetSetting, base62par
|
||||
dataSource,
|
||||
isItemGridLayout,
|
||||
columns,
|
||||
itemGridLayout
|
||||
itemGridLayout,
|
||||
isConditionFormLayout
|
||||
},
|
||||
className: cx("ff-data-list-helper", className),
|
||||
getBase62params,
|
||||
@ -1128,20 +1125,22 @@ const loadDataListFieldWidget = (widget, value, record, widgetSetting, base62par
|
||||
onPageSizeChange
|
||||
}
|
||||
);
|
||||
}), DataListFilter = ({ className }) => {
|
||||
}), DataListFilter = ({ className, isConditionFormLayout }) => {
|
||||
var _a, _b;
|
||||
const [structure, setStructure] = useState({}), { listCode, onKeywordChange, onConditonChange, getBase62params } = React.useContext(DataListContext), { keyword, condition } = getBase62params() || {}, [form] = Form$1.useForm();
|
||||
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 });
|
||||
}).catch(() => setStructure({}));
|
||||
}, [listCode]), useEffect(() => {
|
||||
}, [listCode, isConditionFormLayout]), useEffect(() => {
|
||||
form.setFieldsValue({ keyword, ...condition });
|
||||
}, [JSON.stringify([keyword, condition])]);
|
||||
const onReset = () => {
|
||||
const { keyword: keyword2, condition: condition2 } = getBase62params("init") || {};
|
||||
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(
|
||||
Form$1,
|
||||
{
|
||||
@ -1189,7 +1188,7 @@ DataListFilter.reservedFields = [
|
||||
}
|
||||
];
|
||||
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: [
|
||||
/* @__PURE__ */ jsx("div", { className: "ff-data-list-title", children: title }),
|
||||
/* @__PURE__ */ jsx(
|
||||
@ -1330,7 +1329,7 @@ const DataListFooter = ({ className, operations, isOperations, isPaginate, total
|
||||
}] : []),
|
||||
dataSource,
|
||||
size: "middle",
|
||||
scroll: { x: "max-content", y: divSize.height - 47 },
|
||||
scroll: { x: "max-content", y: divSize.height - 50 },
|
||||
pagination: !1,
|
||||
expandable: {
|
||||
defaultExpandAllRows: !0,
|
||||
@ -2208,7 +2207,7 @@ export {
|
||||
AppContext as Y,
|
||||
AppGlobalParamsContext as Z,
|
||||
Cache as _,
|
||||
usePropsValue as a,
|
||||
usePrevious as a,
|
||||
fn as a0,
|
||||
core as a1,
|
||||
route as a2,
|
||||
@ -2217,27 +2216,27 @@ export {
|
||||
getConfigure as a5,
|
||||
getWidgetOperationAuth as a6,
|
||||
getPhoneNumber as a7,
|
||||
usePrevious as b,
|
||||
useStateWithCallback as c,
|
||||
useDeepEqualEffect as d,
|
||||
useOptions as e,
|
||||
useSubscribeRequest as f,
|
||||
SlotRender as g,
|
||||
FFPageRender as h,
|
||||
FFPopupRender as i,
|
||||
getDefaultExpandRowKeys as j,
|
||||
GridLayout as k,
|
||||
GridLayoutWidget as l,
|
||||
DataListFilter as m,
|
||||
DataListToolbar as n,
|
||||
DataListSider as o,
|
||||
DataListFooter as p,
|
||||
DataListHelper as q,
|
||||
DataListContext as r,
|
||||
DataListTable as s,
|
||||
DataListContent as t,
|
||||
useStateWithCallback as b,
|
||||
useDeepEqualEffect as c,
|
||||
useOptions as d,
|
||||
useSubscribeRequest as e,
|
||||
SlotRender as f,
|
||||
FFPageRender as g,
|
||||
FFPopupRender as h,
|
||||
getDefaultExpandRowKeys as i,
|
||||
GridLayout as j,
|
||||
GridLayoutWidget as k,
|
||||
DataListFilter as l,
|
||||
DataListToolbar as m,
|
||||
DataListSider as n,
|
||||
DataListFooter as o,
|
||||
DataListHelper as p,
|
||||
DataListContext as q,
|
||||
DataListTable as r,
|
||||
DataListContent as s,
|
||||
DataListFramework as t,
|
||||
useUpdate as u,
|
||||
DataListFramework as v,
|
||||
DataTableFramework as v,
|
||||
loadDataListFieldWidget as w,
|
||||
useColumnsRender as x,
|
||||
useStructure as y,
|
4
dist/components.js
vendored
4
dist/components.js
vendored
@ -1,5 +1,5 @@
|
||||
import { N, i } from "./common/main-DamvcBIJ.js";
|
||||
import { N, h } from "./common/main-DHW9LhcM.js";
|
||||
export {
|
||||
N as Icon,
|
||||
i as Popup
|
||||
h as Popup
|
||||
};
|
||||
|
8
dist/container.js
vendored
8
dist/container.js
vendored
@ -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 {
|
||||
S as Context,
|
||||
h as FFPageRender,
|
||||
i as FFPopupRender,
|
||||
g as SlotRender,
|
||||
g as FFPageRender,
|
||||
h as FFPopupRender,
|
||||
f as SlotRender,
|
||||
F as default
|
||||
};
|
||||
|
22
dist/data-list.js
vendored
22
dist/data-list.js
vendored
@ -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 {
|
||||
t as DataListContent,
|
||||
r as DataListContext,
|
||||
m as DataListFilter,
|
||||
p as DataListFooter,
|
||||
v as DataListFramework,
|
||||
q as DataListHelper,
|
||||
o as DataListSider,
|
||||
s as DataListTable,
|
||||
n as DataListToolbar,
|
||||
v2 as DataTableFramework,
|
||||
s as DataListContent,
|
||||
q as DataListContext,
|
||||
l as DataListFilter,
|
||||
o as DataListFooter,
|
||||
t as DataListFramework,
|
||||
p as DataListHelper,
|
||||
n as DataListSider,
|
||||
r as DataListTable,
|
||||
m as DataListToolbar,
|
||||
v as DataTableFramework,
|
||||
D as default,
|
||||
w as loadDataListFieldWidget,
|
||||
x as useColumnsRender,
|
||||
|
2
dist/grid-layout-form.js
vendored
2
dist/grid-layout-form.js
vendored
@ -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 {
|
||||
I as GridLayoutForm,
|
||||
K as GridLayoutFormHelper,
|
||||
|
6
dist/grid-layout.js
vendored
6
dist/grid-layout.js
vendored
@ -1,6 +1,6 @@
|
||||
import { k, l, G } from "./common/main-DamvcBIJ.js";
|
||||
import { j, k, G } from "./common/main-DHW9LhcM.js";
|
||||
export {
|
||||
k as GridLayout,
|
||||
l as GridLayoutWidget,
|
||||
j as GridLayout,
|
||||
k as GridLayoutWidget,
|
||||
G as default
|
||||
};
|
||||
|
14
dist/hooks.js
vendored
14
dist/hooks.js
vendored
@ -1,14 +1,12 @@
|
||||
import "lodash";
|
||||
import "rc-field-form";
|
||||
import "react";
|
||||
import "react-dom";
|
||||
import { d, e, b, a, c, f, u } from "./common/main-DamvcBIJ.js";
|
||||
import { c, d, a, b, e, u } from "./common/main-DHW9LhcM.js";
|
||||
export {
|
||||
d as useDeepEqualEffect,
|
||||
e as useOptions,
|
||||
b as usePrevious,
|
||||
a as usePropsValue,
|
||||
c as useStateWithCallback,
|
||||
f as useSubscribeRequest,
|
||||
c as useDeepEqualEffect,
|
||||
d as useOptions,
|
||||
a as usePrevious,
|
||||
b as useStateWithCallback,
|
||||
e as useSubscribeRequest,
|
||||
u as useUpdate
|
||||
};
|
||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
@ -1,7 +1,7 @@
|
||||
import "lodash";
|
||||
import "axios";
|
||||
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";
|
||||
export {
|
||||
Z as AppGlobalParamsContext,
|
||||
|
2
dist/res-ws.js
vendored
2
dist/res-ws.js
vendored
@ -1,5 +1,5 @@
|
||||
import "lodash";
|
||||
import { R } from "./common/main-DamvcBIJ.js";
|
||||
import { R } from "./common/main-DHW9LhcM.js";
|
||||
export {
|
||||
R as default
|
||||
};
|
||||
|
2
dist/service.js
vendored
2
dist/service.js
vendored
@ -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 {
|
||||
a5 as getConfigure,
|
||||
a4 as getMenus,
|
||||
|
2
dist/style.css
vendored
2
dist/style.css
vendored
File diff suppressed because one or more lines are too long
4
dist/user.js
vendored
4
dist/user.js
vendored
@ -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";
|
||||
import "@ant-design/icons";
|
||||
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 {
|
||||
P as checkUserToken,
|
||||
Q as getUserInfo,
|
||||
|
4
dist/utils.js
vendored
4
dist/utils.js
vendored
@ -1,5 +1,5 @@
|
||||
import "lodash";
|
||||
import { j } from "./common/main-DamvcBIJ.js";
|
||||
import { i } from "./common/main-DHW9LhcM.js";
|
||||
export {
|
||||
j as getDefaultExpandRowKeys
|
||||
i as getDefaultExpandRowKeys
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ff",
|
||||
"private": true,
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.2",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"dist/"
|
||||
@ -41,6 +41,7 @@
|
||||
"rc-field-form": "^1.44.0",
|
||||
"rc-util": "^5.41.0",
|
||||
"react": "^18.2.0",
|
||||
"spark-md5": "^3.0.2",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.22.3"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user