@faasjs/ant-design 0.0.3-beta.1 → 0.0.3-beta.2
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/dist/index.js +20 -20
- package/dist/index.mjs +6 -6
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -52,12 +52,12 @@ var import_react = __toESM(require("react"));
|
|
|
52
52
|
|
|
53
53
|
// src/Blank.tsx
|
|
54
54
|
var import_antd2 = require("antd");
|
|
55
|
-
var
|
|
55
|
+
var import_lodash_es2 = require("lodash-es");
|
|
56
56
|
|
|
57
57
|
// src/Config.tsx
|
|
58
58
|
var import_react2 = require("react");
|
|
59
59
|
var import_antd = require("antd");
|
|
60
|
-
var
|
|
60
|
+
var import_lodash_es = require("lodash-es");
|
|
61
61
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
62
62
|
var isZH = /^zh/i.test(navigator.language);
|
|
63
63
|
var zh = {
|
|
@@ -105,7 +105,7 @@ function ConfigProvider({
|
|
|
105
105
|
const [values, setValues] = (0, import_react2.useState)(baseConfig);
|
|
106
106
|
(0, import_react2.useEffect)(() => {
|
|
107
107
|
if (config.lang === "zh") {
|
|
108
|
-
setValues((0,
|
|
108
|
+
setValues((0, import_lodash_es.defaultsDeep)(config, {
|
|
109
109
|
lang: "zh",
|
|
110
110
|
common: zh,
|
|
111
111
|
Blank: { text: zh.blank },
|
|
@@ -130,20 +130,20 @@ function useConfigContext() {
|
|
|
130
130
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
131
131
|
function Blank(options) {
|
|
132
132
|
const { Blank: Blank2 } = useConfigContext();
|
|
133
|
-
return !options || (0,
|
|
133
|
+
return !options || (0, import_lodash_es2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Typography.Text, {
|
|
134
134
|
disabled: true,
|
|
135
135
|
children: (options == null ? void 0 : options.text) || Blank2.text
|
|
136
136
|
}) : options.value;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
// src/data.ts
|
|
140
|
-
var
|
|
140
|
+
var import_lodash_es3 = require("lodash-es");
|
|
141
141
|
var import_dayjs = __toESM(require("dayjs"));
|
|
142
142
|
function transferOptions(options) {
|
|
143
143
|
if (!options)
|
|
144
144
|
return [];
|
|
145
145
|
return options.map((item) => typeof item === "object" ? item : {
|
|
146
|
-
label: (0,
|
|
146
|
+
label: (0, import_lodash_es3.upperFirst)(item.toString()),
|
|
147
147
|
value: item
|
|
148
148
|
});
|
|
149
149
|
}
|
|
@@ -166,7 +166,7 @@ function transferValue(type, value) {
|
|
|
166
166
|
// src/Description.tsx
|
|
167
167
|
var import_icons = require("@ant-design/icons");
|
|
168
168
|
var import_antd3 = require("antd");
|
|
169
|
-
var
|
|
169
|
+
var import_lodash_es4 = require("lodash-es");
|
|
170
170
|
var import_react3 = require("react");
|
|
171
171
|
var import_react4 = require("@faasjs/react");
|
|
172
172
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -177,7 +177,7 @@ function DescriptionItemContent(props) {
|
|
|
177
177
|
var _a2, _b;
|
|
178
178
|
const propsCopy = { ...props };
|
|
179
179
|
if (!propsCopy.item.title)
|
|
180
|
-
propsCopy.item.title = (0,
|
|
180
|
+
propsCopy.item.title = (0, import_lodash_es4.upperFirst)(propsCopy.item.id);
|
|
181
181
|
if (!propsCopy.item.type)
|
|
182
182
|
propsCopy.item.type = "string";
|
|
183
183
|
if ((_a2 = propsCopy.item.options) == null ? void 0 : _a2.length) {
|
|
@@ -282,10 +282,10 @@ function Description(props) {
|
|
|
282
282
|
if (!props.faasData)
|
|
283
283
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
|
|
284
284
|
...props,
|
|
285
|
-
title: (0,
|
|
285
|
+
title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
286
286
|
children: props.items.map((item) => {
|
|
287
287
|
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
|
|
288
|
-
label: item.title || (0,
|
|
288
|
+
label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
|
|
289
289
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
|
|
290
290
|
item,
|
|
291
291
|
value: props.dataSource[item.id],
|
|
@@ -302,10 +302,10 @@ function Description(props) {
|
|
|
302
302
|
render: ({ data }) => {
|
|
303
303
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
|
|
304
304
|
...props,
|
|
305
|
-
title: (0,
|
|
305
|
+
title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
306
306
|
children: props.items.map((item) => {
|
|
307
307
|
return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
|
|
308
|
-
label: item.title || (0,
|
|
308
|
+
label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
|
|
309
309
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
|
|
310
310
|
item,
|
|
311
311
|
value: data[item.id],
|
|
@@ -356,11 +356,11 @@ var import_react8 = require("react");
|
|
|
356
356
|
var import_antd5 = require("antd");
|
|
357
357
|
var import_icons2 = require("@ant-design/icons");
|
|
358
358
|
var import_react6 = require("react");
|
|
359
|
-
var
|
|
359
|
+
var import_lodash_es5 = require("lodash-es");
|
|
360
360
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
361
361
|
function processProps(propsCopy, config) {
|
|
362
362
|
if (!propsCopy.title)
|
|
363
|
-
propsCopy.title = (0,
|
|
363
|
+
propsCopy.title = (0, import_lodash_es5.upperFirst)(propsCopy.id);
|
|
364
364
|
if (!propsCopy.label && propsCopy.label !== false)
|
|
365
365
|
propsCopy.label = propsCopy.title;
|
|
366
366
|
if (!propsCopy.name)
|
|
@@ -943,7 +943,7 @@ var import_react11 = require("react");
|
|
|
943
943
|
var import_antd10 = require("antd");
|
|
944
944
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
945
945
|
var import_icons3 = require("@ant-design/icons");
|
|
946
|
-
var
|
|
946
|
+
var import_lodash_es6 = require("lodash-es");
|
|
947
947
|
var import_react12 = require("@faasjs/react");
|
|
948
948
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
949
949
|
function processValue(item, value) {
|
|
@@ -981,7 +981,7 @@ function Table(props) {
|
|
|
981
981
|
if (!item.dataIndex)
|
|
982
982
|
item.dataIndex = item.id;
|
|
983
983
|
if (!item.title)
|
|
984
|
-
item.title = (0,
|
|
984
|
+
item.title = (0, import_lodash_es6.upperFirst)(item.id);
|
|
985
985
|
if (!item.type)
|
|
986
986
|
item.type = "string";
|
|
987
987
|
if ((_a = item.options) == null ? void 0 : _a.length) {
|
|
@@ -1173,11 +1173,11 @@ function Table(props) {
|
|
|
1173
1173
|
item.onFilter = (value, row) => {
|
|
1174
1174
|
switch (value) {
|
|
1175
1175
|
case "true":
|
|
1176
|
-
return !(0,
|
|
1176
|
+
return !(0, import_lodash_es6.isNil)(row[item.id]) && !!row[item.id];
|
|
1177
1177
|
case "false":
|
|
1178
|
-
return !(0,
|
|
1178
|
+
return !(0, import_lodash_es6.isNil)(row[item.id]) && !row[item.id];
|
|
1179
1179
|
case "empty":
|
|
1180
|
-
return (0,
|
|
1180
|
+
return (0, import_lodash_es6.isNil)(row[item.id]);
|
|
1181
1181
|
default:
|
|
1182
1182
|
return true;
|
|
1183
1183
|
}
|
|
@@ -1233,7 +1233,7 @@ function Table(props) {
|
|
|
1233
1233
|
setColumns((prev) => {
|
|
1234
1234
|
const newColumns = [...prev];
|
|
1235
1235
|
const index = newColumns.findIndex((item) => item.id === column.id);
|
|
1236
|
-
newColumns[index].filters = (0,
|
|
1236
|
+
newColumns[index].filters = (0, import_lodash_es6.uniqBy)(props.dataSource, column.id).map((v) => ({
|
|
1237
1237
|
text: v[column.id],
|
|
1238
1238
|
value: v[column.id]
|
|
1239
1239
|
}));
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
|
|
4
4
|
// src/Blank.tsx
|
|
5
5
|
import { Typography } from "antd";
|
|
6
|
-
import { isNil } from "lodash";
|
|
6
|
+
import { isNil } from "lodash-es";
|
|
7
7
|
|
|
8
8
|
// src/Config.tsx
|
|
9
9
|
import {
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
useState
|
|
14
14
|
} from "react";
|
|
15
15
|
import { ConfigProvider as AntdConfigProvider } from "antd";
|
|
16
|
-
import { defaultsDeep } from "lodash";
|
|
16
|
+
import { defaultsDeep } from "lodash-es";
|
|
17
17
|
import { jsx } from "react/jsx-runtime";
|
|
18
18
|
var isZH = /^zh/i.test(navigator.language);
|
|
19
19
|
var zh = {
|
|
@@ -93,7 +93,7 @@ function Blank(options) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
// src/data.ts
|
|
96
|
-
import { upperFirst } from "lodash";
|
|
96
|
+
import { upperFirst } from "lodash-es";
|
|
97
97
|
import dayjs from "dayjs";
|
|
98
98
|
function transferOptions(options) {
|
|
99
99
|
if (!options)
|
|
@@ -126,7 +126,7 @@ import {
|
|
|
126
126
|
Skeleton,
|
|
127
127
|
Space
|
|
128
128
|
} from "antd";
|
|
129
|
-
import { isFunction, upperFirst as upperFirst2 } from "lodash";
|
|
129
|
+
import { isFunction, upperFirst as upperFirst2 } from "lodash-es";
|
|
130
130
|
import {
|
|
131
131
|
cloneElement,
|
|
132
132
|
useEffect as useEffect2,
|
|
@@ -341,7 +341,7 @@ import {
|
|
|
341
341
|
useEffect as useEffect3,
|
|
342
342
|
useState as useState4
|
|
343
343
|
} from "react";
|
|
344
|
-
import { upperFirst as upperFirst3 } from "lodash";
|
|
344
|
+
import { upperFirst as upperFirst3 } from "lodash-es";
|
|
345
345
|
import { Fragment as Fragment2, jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
346
346
|
function processProps(propsCopy, config) {
|
|
347
347
|
if (!propsCopy.title)
|
|
@@ -946,7 +946,7 @@ import {
|
|
|
946
946
|
isNil as isNil2,
|
|
947
947
|
uniqBy,
|
|
948
948
|
upperFirst as upperFirst4
|
|
949
|
-
} from "lodash";
|
|
949
|
+
} from "lodash-es";
|
|
950
950
|
import { FaasDataWrapper as FaasDataWrapper2 } from "@faasjs/react";
|
|
951
951
|
import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
952
952
|
function processValue(item, value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "0.0.3-beta.
|
|
3
|
+
"version": "0.0.3-beta.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@ant-design/icons": "*",
|
|
27
27
|
"antd": "*",
|
|
28
|
-
"lodash": "*",
|
|
28
|
+
"lodash-es": "*",
|
|
29
29
|
"react": "*",
|
|
30
30
|
"react-dom": "*",
|
|
31
|
-
"@faasjs/react": "^0.0.3-beta.
|
|
31
|
+
"@faasjs/react": "^0.0.3-beta.2",
|
|
32
32
|
"react-router-dom": "*",
|
|
33
33
|
"dayjs": "*"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/lodash": "*",
|
|
36
|
+
"@types/lodash-es": "*",
|
|
37
37
|
"@testing-library/jest-dom": "*",
|
|
38
38
|
"@testing-library/react": "*",
|
|
39
39
|
"@testing-library/user-event": "*"
|