@pisell/materials 1.0.471 → 1.0.473
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +18 -18
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +15 -15
- package/es/components/dataSourceComponents/dataSourceForm/index.less +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/provider/hooks/useJsonPrefixPath.d.ts +4 -1
- package/es/components/dataSourceComponents/dataSourceForm/serve.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/serve.js +4 -3
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +41 -17
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +3 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.js +4 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +3 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.js +4 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceTypography/index.d.ts +10 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceTypography/index.js +15 -0
- package/es/components/dataSourceComponents/dataSourceShow/utils.d.ts +6 -0
- package/es/components/dataSourceComponents/dataSourceShow/utils.js +82 -0
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +33 -139
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +25 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +162 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/utils.d.ts +8 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/utils.js +135 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDesignMode.js +35 -39
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +20 -4
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.js +65 -11
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +17 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +105 -6
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +77 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +245 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +20 -7
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +41 -12
- package/es/components/dataSourceComponents/dataSourceTable/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/index.js +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/index.less +5 -0
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +57 -9
- package/es/components/dataSourceComponents/dataSourceWrapper/BaseWrapper.d.ts +7 -0
- package/es/components/dataSourceComponents/dataSourceWrapper/BaseWrapper.js +23 -0
- package/es/components/dataSourceComponents/dataSourceWrapper/index.d.ts +2 -4
- package/es/components/dataSourceComponents/dataSourceWrapper/index.js +17 -2
- package/es/components/dataSourceComponents/fields/Checkbox/ReadPretty.js +7 -1
- package/es/components/dataSourceComponents/fields/Checkbox/index.js +3 -1
- package/es/components/dataSourceComponents/fields/DatePicker/index.js +5 -1
- package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.js +7 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/WithMode.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/WithMode.js +5 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/index.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/index.js +5 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/index.less +14 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/type.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/type.js +1 -0
- package/es/components/dataSourceComponents/fields/Input/index.d.ts +6 -1
- package/es/components/dataSourceComponents/fields/Input/index.js +4 -0
- package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.js +5 -0
- package/es/components/dataSourceComponents/fields/Input.Email/WithMode.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/Input.Email/WithMode.js +17 -0
- package/es/components/dataSourceComponents/fields/Input.Email/index.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Input.Email/index.js +4 -0
- package/es/components/dataSourceComponents/fields/Input.Email/type.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Input.Email/type.js +1 -0
- package/es/components/dataSourceComponents/fields/Input.Json/ReadPretty.js +2 -2
- package/es/components/dataSourceComponents/fields/Input.Json/WithMode.d.ts +2 -2
- package/es/components/dataSourceComponents/fields/Input.Json/WithMode.js +41 -1
- package/es/components/dataSourceComponents/fields/Input.Json/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.js +5 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +12 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/index.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/index.js +4 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/type.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/type.js +1 -0
- package/es/components/dataSourceComponents/fields/InputNumber/index.js +5 -1
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/index.d.ts +52 -4
- package/es/components/dataSourceComponents/fields/index.js +7 -2
- package/es/components/dataSourceComponents/fields/type.d.ts +18 -0
- package/es/components/dataSourceComponents/fields/type.js +1 -0
- package/es/components/dataSourceComponents/fields/utils.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/utils.js +111 -0
- package/es/components/dataSourceComponents/hooks/useActions.js +22 -7
- package/es/components/dataSourceComponents/hooks/useComponentId.d.ts +2 -0
- package/es/components/dataSourceComponents/hooks/useComponentId.js +9 -0
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +19 -2
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceProvider.d.ts +1 -1
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +37 -27
- package/es/components/dataSourceComponents/provider/variables/VariablesContext.d.ts +3 -2
- package/es/components/dataSourceComponents/provider/variables/VariablesProvider.js +19 -13
- package/es/components/dataSourceComponents/provider/variables/utils.d.ts +2 -0
- package/es/components/dataSourceComponents/provider/variables/utils.js +9 -0
- package/es/components/filter/components/Dropdown/index.d.ts +1 -0
- package/es/components/filter/components/Dropdown/index.js +6 -2
- package/es/components/filter/components/FilterButton/index.js +5 -3
- package/es/components/filter/components/FilterButton/types.d.ts +2 -0
- package/es/components/table/Actions/index.js +16 -7
- package/es/components/table/Gallery/index.d.ts +3 -3
- package/es/components/table/Gallery/index.js +25 -7
- package/es/components/table/Gallery/index.less +1 -0
- package/es/components/table/Header/index.d.ts +10 -3
- package/es/components/table/Header/index.js +37 -11
- package/es/components/table/Header/index.less +10 -2
- package/es/components/table/Table/utils.js +4 -0
- package/es/components/table/Tabs/index.d.ts +14 -0
- package/es/components/table/Tabs/index.js +37 -0
- package/es/components/table/hooks/useTriggerValuesChange.js +3 -0
- package/es/components/table/index.js +16 -3
- package/es/components/table/types.d.ts +14 -2
- package/es/components/typography/index.d.ts +2 -2
- package/es/components/typography/index.js +4 -3
- package/es/index.d.ts +4 -0
- package/es/index.js +5 -1
- package/es/locales/en-US.d.ts +7 -0
- package/es/locales/en-US.js +16 -1
- package/es/locales/zh-CN.d.ts +7 -0
- package/es/locales/zh-CN.js +16 -1
- package/es/locales/zh-TW.d.ts +7 -0
- package/es/locales/zh-TW.js +16 -1
- package/lib/components/dataSourceComponents/dataSourceForm/index.less +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/provider/hooks/useJsonPrefixPath.d.ts +4 -1
- package/lib/components/dataSourceComponents/dataSourceForm/serve.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceForm/serve.js +3 -2
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +58 -11
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.js +38 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.js +38 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceTypography/index.d.ts +10 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceTypography/index.js +44 -0
- package/lib/components/dataSourceComponents/dataSourceShow/utils.d.ts +6 -0
- package/lib/components/dataSourceComponents/dataSourceShow/utils.js +95 -0
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +29 -90
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +25 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +176 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.d.ts +8 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.js +176 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDesignMode.js +24 -37
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +20 -4
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.js +53 -7
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +17 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +73 -3
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +77 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +236 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +20 -7
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +38 -11
- package/lib/components/dataSourceComponents/dataSourceTable/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/index.js +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/index.less +5 -0
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +57 -9
- package/lib/components/dataSourceComponents/dataSourceWrapper/BaseWrapper.d.ts +7 -0
- package/lib/components/dataSourceComponents/dataSourceWrapper/BaseWrapper.js +51 -0
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.d.ts +2 -4
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.js +14 -2
- package/lib/components/dataSourceComponents/fields/Checkbox/ReadPretty.js +3 -1
- package/lib/components/dataSourceComponents/fields/Checkbox/index.js +3 -1
- package/lib/components/dataSourceComponents/fields/DatePicker/index.js +5 -1
- package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.js +41 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/WithMode.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/WithMode.js +42 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/index.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/index.js +39 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/index.less +14 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/type.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/Input/index.d.ts +6 -1
- package/lib/components/dataSourceComponents/fields/Input/index.js +4 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.js +39 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/WithMode.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/WithMode.js +57 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/index.js +38 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/type.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/Input.Json/ReadPretty.js +2 -2
- package/lib/components/dataSourceComponents/fields/Input.Json/WithMode.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Input.Json/WithMode.js +30 -2
- package/lib/components/dataSourceComponents/fields/Input.Json/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.js +39 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +43 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/index.js +38 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/type.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/InputNumber/index.js +5 -1
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/index.d.ts +52 -4
- package/lib/components/dataSourceComponents/fields/index.js +6 -1
- package/lib/components/dataSourceComponents/fields/type.d.ts +18 -0
- package/lib/components/dataSourceComponents/fields/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/utils.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/utils.js +134 -0
- package/lib/components/dataSourceComponents/hooks/useActions.js +14 -5
- package/lib/components/dataSourceComponents/hooks/useComponentId.d.ts +2 -0
- package/lib/components/dataSourceComponents/hooks/useComponentId.js +32 -0
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +19 -2
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceProvider.d.ts +1 -1
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +29 -16
- package/lib/components/dataSourceComponents/provider/variables/VariablesContext.d.ts +3 -2
- package/lib/components/dataSourceComponents/provider/variables/VariablesProvider.js +17 -8
- package/lib/components/dataSourceComponents/provider/variables/utils.d.ts +2 -0
- package/lib/components/dataSourceComponents/provider/variables/utils.js +15 -2
- package/lib/components/filter/components/Dropdown/index.d.ts +1 -0
- package/lib/components/filter/components/Dropdown/index.js +6 -2
- package/lib/components/filter/components/FilterButton/index.js +5 -3
- package/lib/components/filter/components/FilterButton/types.d.ts +2 -0
- package/lib/components/table/Actions/index.js +18 -9
- package/lib/components/table/Gallery/index.d.ts +3 -3
- package/lib/components/table/Gallery/index.js +17 -0
- package/lib/components/table/Gallery/index.less +1 -0
- package/lib/components/table/Header/index.d.ts +10 -3
- package/lib/components/table/Header/index.js +29 -4
- package/lib/components/table/Header/index.less +10 -2
- package/lib/components/table/Table/utils.js +4 -0
- package/lib/components/table/Tabs/index.d.ts +14 -0
- package/lib/components/table/Tabs/index.js +70 -0
- package/lib/components/table/hooks/useTriggerValuesChange.js +3 -0
- package/lib/components/table/index.js +17 -2
- package/lib/components/table/types.d.ts +14 -2
- package/lib/components/typography/index.d.ts +2 -2
- package/lib/components/typography/index.js +4 -3
- package/lib/index.d.ts +4 -0
- package/lib/index.js +12 -0
- package/lib/locales/en-US.d.ts +7 -0
- package/lib/locales/en-US.js +8 -1
- package/lib/locales/zh-CN.d.ts +7 -0
- package/lib/locales/zh-CN.js +8 -1
- package/lib/locales/zh-TW.d.ts +7 -0
- package/lib/locales/zh-TW.js +8 -1
- package/lowcode/_utils/defaultSchema.ts +452 -83
- package/lowcode/_utils/type.ts +5 -0
- package/lowcode/_utils/utils.ts +1 -0
- package/lowcode/button/meta.ts +1 -2
- package/lowcode/data-source-form/constants.ts +5 -0
- package/lowcode/data-source-form/meta.ts +259 -273
- package/lowcode/data-source-form/snippets.ts +9 -0
- package/lowcode/data-source-form/utils.ts +80 -15
- package/lowcode/data-source-image/meta.ts +74 -0
- package/lowcode/data-source-image/snippets.ts +14 -0
- package/lowcode/data-source-qrcode/meta.ts +158 -0
- package/lowcode/data-source-qrcode/snippets.ts +20 -0
- package/lowcode/data-source-table/meta.ts +4577 -2285
- package/lowcode/data-source-table/snippets.ts +10 -4
- package/lowcode/data-source-table/utils.tsx +254 -0
- package/lowcode/data-source-typography/meta.ts +54 -0
- package/lowcode/data-source-typography.text/meta.ts +212 -0
- package/lowcode/data-source-typography.text/snippets.ts +12 -0
- package/lowcode/data-source-wrapper/meta.ts +243 -0
- package/lowcode/data-source-wrapper/snippets.ts +11 -0
- package/lowcode/data-source-wrapper/utils.ts +45 -0
- package/lowcode/form-item-color-picker/snippets.ts +1 -0
- package/lowcode/form-item-input/meta.ts +2 -1
- package/lowcode/form-item-input/snippets.ts +2 -1
- package/lowcode/form-item-input.email/meta.ts +284 -0
- package/lowcode/form-item-input.email/snippets.ts +35 -0
- package/lowcode/form-item-input.phone/meta.ts +295 -0
- package/lowcode/form-item-input.phone/snippets.ts +16 -0
- package/lowcode/form-item-input.text-area/meta.ts +243 -32
- package/lowcode/form-item-input.text-area/snippets.ts +2 -1
- package/lowcode/form-item-input.url/meta.ts +44 -20
- package/lowcode/form-item-input.url/snippets.ts +5 -5
- package/lowcode/table/snippets.ts +6 -0
- package/lowcode/test/meta.ts +1 -2
- package/package.json +2 -2
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/dataSourceComponents/dataSourceTable/filter/index.tsx
|
|
30
|
+
var filter_exports = {};
|
|
31
|
+
__export(filter_exports, {
|
|
32
|
+
default: () => filter_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(filter_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_ahooks = require("ahooks");
|
|
38
|
+
var import_icons = require("@ant-design/icons");
|
|
39
|
+
var import_Input = __toESM(require("../../fields/Input"));
|
|
40
|
+
var import_useDataSource = __toESM(require("../../hooks/useDataSource"));
|
|
41
|
+
var import_FilterButton = __toESM(require("../../../filter/components/FilterButton"));
|
|
42
|
+
var import_utils = require("./utils");
|
|
43
|
+
var defaultArr = [];
|
|
44
|
+
var Filter = (props) => {
|
|
45
|
+
const {
|
|
46
|
+
componentId,
|
|
47
|
+
items = defaultArr,
|
|
48
|
+
mode = "simple",
|
|
49
|
+
quickFilterMaxLength = 3,
|
|
50
|
+
sortButtonShow = false,
|
|
51
|
+
handleValuesChange,
|
|
52
|
+
search,
|
|
53
|
+
filterBy
|
|
54
|
+
} = props;
|
|
55
|
+
const [form] = import_antd.Form.useForm();
|
|
56
|
+
const { dataSource } = (0, import_useDataSource.default)();
|
|
57
|
+
const [list, setList] = (0, import_react.useState)(() => {
|
|
58
|
+
const storedOrder = (0, import_utils.getStoredFilterOrder)(componentId);
|
|
59
|
+
return storedOrder || {
|
|
60
|
+
quickFilter: [],
|
|
61
|
+
otherFilter: []
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
const filterList = (0, import_react.useMemo)(() => {
|
|
65
|
+
return items.filter((item) => !(item == null ? void 0 : item.isHidden));
|
|
66
|
+
}, [items]);
|
|
67
|
+
const filterDom = (0, import_react.useMemo)(() => {
|
|
68
|
+
return (0, import_utils.genFilterItems)(list.quickFilter, dataSource);
|
|
69
|
+
}, [list.quickFilter]);
|
|
70
|
+
(0, import_react.useEffect)(() => {
|
|
71
|
+
const storedOrder = (0, import_utils.getStoredFilterOrder)(componentId);
|
|
72
|
+
if (!storedOrder) {
|
|
73
|
+
const newList = {
|
|
74
|
+
quickFilter: filterList.slice(0, quickFilterMaxLength),
|
|
75
|
+
otherFilter: filterList.slice(quickFilterMaxLength)
|
|
76
|
+
};
|
|
77
|
+
setList(newList);
|
|
78
|
+
(0, import_utils.saveFilterOrder)(componentId, newList);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const orderedItems = {
|
|
82
|
+
quickFilter: [],
|
|
83
|
+
otherFilter: []
|
|
84
|
+
};
|
|
85
|
+
const itemMap = new Map(filterList.map((item) => [item.name, item]));
|
|
86
|
+
storedOrder.quickFilter.forEach((stored) => {
|
|
87
|
+
const item = itemMap.get(stored.name);
|
|
88
|
+
if (item) {
|
|
89
|
+
orderedItems.quickFilter.push(item);
|
|
90
|
+
itemMap.delete(stored.name);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
storedOrder.otherFilter.forEach((stored) => {
|
|
94
|
+
const item = itemMap.get(stored.name);
|
|
95
|
+
if (item) {
|
|
96
|
+
orderedItems.otherFilter.push(item);
|
|
97
|
+
itemMap.delete(stored.name);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
const remainingItems = Array.from(itemMap.values());
|
|
101
|
+
remainingItems.forEach((item) => {
|
|
102
|
+
if (orderedItems.quickFilter.length < quickFilterMaxLength) {
|
|
103
|
+
orderedItems.quickFilter.push(item);
|
|
104
|
+
} else {
|
|
105
|
+
orderedItems.otherFilter.push(item);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
if (quickFilterMaxLength && orderedItems.quickFilter.length > quickFilterMaxLength) {
|
|
109
|
+
const overflow = orderedItems.quickFilter.splice(quickFilterMaxLength);
|
|
110
|
+
orderedItems.otherFilter.unshift(...overflow);
|
|
111
|
+
}
|
|
112
|
+
setList(orderedItems);
|
|
113
|
+
(0, import_utils.saveFilterOrder)(componentId, orderedItems);
|
|
114
|
+
}, [filterList, quickFilterMaxLength, componentId]);
|
|
115
|
+
const onChange = (newVal) => {
|
|
116
|
+
setList(newVal);
|
|
117
|
+
(0, import_utils.saveFilterOrder)(componentId, newVal);
|
|
118
|
+
};
|
|
119
|
+
const renderItem = (0, import_ahooks.useMemoizedFn)((item, otherProps) => {
|
|
120
|
+
const getField = (0, import_utils.genGetField)(dataSource);
|
|
121
|
+
const field = getField(item.name);
|
|
122
|
+
const cptDom = (0, import_utils.field2Cpt)(field, item, {
|
|
123
|
+
labelCol: { span: 24 },
|
|
124
|
+
style: (style) => {
|
|
125
|
+
return {
|
|
126
|
+
...style || {},
|
|
127
|
+
width: "100%"
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
...otherProps
|
|
131
|
+
});
|
|
132
|
+
return cptDom;
|
|
133
|
+
});
|
|
134
|
+
const onValuesChange = (0, import_ahooks.useDebounceFn)(
|
|
135
|
+
(changedFields, allFields) => {
|
|
136
|
+
handleValuesChange(changedFields, allFields);
|
|
137
|
+
},
|
|
138
|
+
{ wait: 300 }
|
|
139
|
+
).run;
|
|
140
|
+
const searchDom = (0, import_react.useMemo)(() => {
|
|
141
|
+
return (search == null ? void 0 : search.show) ? /* @__PURE__ */ import_react.default.createElement(
|
|
142
|
+
import_Input.default,
|
|
143
|
+
{
|
|
144
|
+
name: search.key || "_keywords",
|
|
145
|
+
placeholder: search.placeholder,
|
|
146
|
+
renderMode: "edit",
|
|
147
|
+
prefix: /* @__PURE__ */ import_react.default.createElement(import_icons.SearchOutlined, null),
|
|
148
|
+
style: { width: 200 }
|
|
149
|
+
}
|
|
150
|
+
) : null;
|
|
151
|
+
}, [search]);
|
|
152
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
153
|
+
import_antd.Form,
|
|
154
|
+
{
|
|
155
|
+
labelCol: { span: 0 },
|
|
156
|
+
form,
|
|
157
|
+
size: "large",
|
|
158
|
+
layout: "inline",
|
|
159
|
+
className: "filter-form-wrapper",
|
|
160
|
+
onValuesChange
|
|
161
|
+
},
|
|
162
|
+
searchDom,
|
|
163
|
+
filterDom,
|
|
164
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
165
|
+
import_FilterButton.default,
|
|
166
|
+
{
|
|
167
|
+
value: list,
|
|
168
|
+
quickFilterMaxLength,
|
|
169
|
+
formFiltersPrefix: "",
|
|
170
|
+
onChange,
|
|
171
|
+
renderItem
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
var filter_default = Filter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FilterItemProps } from '../../../filter/types';
|
|
3
|
+
import { DataSourceType, Field } from '../../provider/dataSource/DataSourceContext';
|
|
4
|
+
export declare const genGetField: (dataSource?: DataSourceType) => (key: string) => Field;
|
|
5
|
+
export declare const field2Cpt: (field: Field, item: any, otherProps?: any) => React.JSX.Element | null;
|
|
6
|
+
export declare const genFilterItems: (list: FilterItemProps[], dataSource?: DataSourceType) => (React.JSX.Element | null)[];
|
|
7
|
+
export declare const getStoredFilterOrder: (componentId: string) => any;
|
|
8
|
+
export declare const saveFilterOrder: (componentId: string, order: any) => void;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/dataSourceComponents/dataSourceTable/filter/utils.tsx
|
|
30
|
+
var utils_exports = {};
|
|
31
|
+
__export(utils_exports, {
|
|
32
|
+
field2Cpt: () => field2Cpt,
|
|
33
|
+
genFilterItems: () => genFilterItems,
|
|
34
|
+
genGetField: () => genGetField,
|
|
35
|
+
getStoredFilterOrder: () => getStoredFilterOrder,
|
|
36
|
+
saveFilterOrder: () => saveFilterOrder
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(utils_exports);
|
|
39
|
+
var import_react = __toESM(require("react"));
|
|
40
|
+
var import_utils = require("@pisell/utils");
|
|
41
|
+
var import_fields = require("../../fields");
|
|
42
|
+
var genGetField = (dataSource) => {
|
|
43
|
+
const { fields = [] } = dataSource || {};
|
|
44
|
+
const fieldMap = fields.reduce((acc, field) => {
|
|
45
|
+
acc[field.name] = field;
|
|
46
|
+
return acc;
|
|
47
|
+
}, {});
|
|
48
|
+
return (key) => {
|
|
49
|
+
return fieldMap[key];
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
var fieldType2FilterMap = {
|
|
53
|
+
Checkbox: "Select",
|
|
54
|
+
ColorPicker: "Input",
|
|
55
|
+
DatePicker: "DateRangePicker",
|
|
56
|
+
Input: "Input",
|
|
57
|
+
Radio: "Select",
|
|
58
|
+
Select: "Select",
|
|
59
|
+
Percent: "Percent",
|
|
60
|
+
InputNumber: "Input",
|
|
61
|
+
"Input.JSON": "Input",
|
|
62
|
+
"Input.URL": "Input",
|
|
63
|
+
"Input.Password": "Input",
|
|
64
|
+
"Radio.Group": "Select",
|
|
65
|
+
"Checkbox.Group": "Select"
|
|
66
|
+
};
|
|
67
|
+
var getCptProps = (field, cptType, item) => {
|
|
68
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
69
|
+
let props = ((_a = field == null ? void 0 : field.uiSchema) == null ? void 0 : _a["x-component-props"]) || {};
|
|
70
|
+
props.style = {
|
|
71
|
+
...(props == null ? void 0 : props.style) || {},
|
|
72
|
+
width: "200px"
|
|
73
|
+
};
|
|
74
|
+
props.placeholder = item.label;
|
|
75
|
+
props.allowClear = true;
|
|
76
|
+
if (cptType === "Select") {
|
|
77
|
+
props.mode = "multiple";
|
|
78
|
+
}
|
|
79
|
+
if (["Select", "Radio.Group", "Checkbox.Group"].includes(
|
|
80
|
+
(_b = field == null ? void 0 : field.uiSchema) == null ? void 0 : _b["x-component"]
|
|
81
|
+
) && (((_d = (_c = field == null ? void 0 : field.uiSchema) == null ? void 0 : _c.enum) == null ? void 0 : _d.length) || 0) > 0) {
|
|
82
|
+
if (["Radio.Group", "Checkbox.Group"].includes(
|
|
83
|
+
(_e = field == null ? void 0 : field.uiSchema) == null ? void 0 : _e["x-component"]
|
|
84
|
+
)) {
|
|
85
|
+
props.direction = "horizontal";
|
|
86
|
+
}
|
|
87
|
+
props.options = (_f = field == null ? void 0 : field.uiSchema) == null ? void 0 : _f.enum;
|
|
88
|
+
}
|
|
89
|
+
if (((_g = field == null ? void 0 : field.uiSchema) == null ? void 0 : _g["x-component"]) === "ColorPicker") {
|
|
90
|
+
props.defaultValue = (_h = field == null ? void 0 : field.uiSchema) == null ? void 0 : _h.default;
|
|
91
|
+
}
|
|
92
|
+
if (cptType === "DateRangePicker") {
|
|
93
|
+
props.style = {
|
|
94
|
+
...(props == null ? void 0 : props.style) || {},
|
|
95
|
+
width: "240px"
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (((_i = field == null ? void 0 : field.uiSchema) == null ? void 0 : _i["x-component"]) === "Checkbox" && cptType === "Select") {
|
|
99
|
+
props.mode = void 0;
|
|
100
|
+
props.allowClear = true;
|
|
101
|
+
props.options = [
|
|
102
|
+
{
|
|
103
|
+
label: "是",
|
|
104
|
+
value: true
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
label: "否",
|
|
108
|
+
value: false
|
|
109
|
+
}
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
return props;
|
|
113
|
+
};
|
|
114
|
+
var field2Cpt = (field, item, otherProps) => {
|
|
115
|
+
const { isCustom, type: configType } = item;
|
|
116
|
+
const { uiSchema } = field || {};
|
|
117
|
+
const { "x-component": xComponent } = uiSchema || {};
|
|
118
|
+
let cptType = fieldType2FilterMap[xComponent];
|
|
119
|
+
if (isCustom) {
|
|
120
|
+
cptType = configType;
|
|
121
|
+
}
|
|
122
|
+
const Cpt = import_fields.formFieldMap[cptType];
|
|
123
|
+
if (!Cpt) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
const props = getCptProps(field, cptType, item);
|
|
127
|
+
const style = (0, import_utils.isFunction)(otherProps == null ? void 0 : otherProps.style) ? otherProps == null ? void 0 : otherProps.style(props.style) : (otherProps == null ? void 0 : otherProps.style) ? { ...props.style, ...otherProps == null ? void 0 : otherProps.style } : props.style;
|
|
128
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
129
|
+
Cpt,
|
|
130
|
+
{
|
|
131
|
+
...props,
|
|
132
|
+
label: item.label,
|
|
133
|
+
name: item.name || item.value,
|
|
134
|
+
...otherProps,
|
|
135
|
+
style
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
var genFilterItems = (list, dataSource) => {
|
|
140
|
+
return list.map((item) => {
|
|
141
|
+
if (!item) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
const { name } = item;
|
|
145
|
+
const getField = genGetField(dataSource);
|
|
146
|
+
const field = getField(name);
|
|
147
|
+
const cptDom = field2Cpt(field, item);
|
|
148
|
+
return cptDom;
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
var FILTER_STORAGE_KEY = "filter-setting-";
|
|
152
|
+
var getStorageKey = (componentId) => `${FILTER_STORAGE_KEY}${componentId}`;
|
|
153
|
+
var getStoredFilterOrder = (componentId) => {
|
|
154
|
+
try {
|
|
155
|
+
const stored = localStorage.getItem(getStorageKey(componentId));
|
|
156
|
+
return stored ? JSON.parse(stored) : null;
|
|
157
|
+
} catch (e) {
|
|
158
|
+
console.error("Failed to parse stored filter order:", e);
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
var saveFilterOrder = (componentId, order) => {
|
|
163
|
+
try {
|
|
164
|
+
localStorage.setItem(getStorageKey(componentId), JSON.stringify(order));
|
|
165
|
+
} catch (e) {
|
|
166
|
+
console.error("Failed to save filter order:", e);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
170
|
+
0 && (module.exports = {
|
|
171
|
+
field2Cpt,
|
|
172
|
+
genFilterItems,
|
|
173
|
+
genGetField,
|
|
174
|
+
getStoredFilterOrder,
|
|
175
|
+
saveFilterOrder
|
|
176
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const useDataSourceKey: () => {
|
|
3
|
-
dataSourceKey: string;
|
|
4
|
-
dataSourceKeyRef: import("react").MutableRefObject<string>;
|
|
3
|
+
dataSourceKey: string | undefined;
|
|
4
|
+
dataSourceKeyRef: import("react").MutableRefObject<string | undefined>;
|
|
5
5
|
};
|
|
6
6
|
export default useDataSourceKey;
|
|
@@ -38,7 +38,7 @@ var import_useDataSource = __toESM(require("../../hooks/useDataSource"));
|
|
|
38
38
|
var useDataSourceKey = () => {
|
|
39
39
|
const { dataSource } = (0, import_useDataSource.default)();
|
|
40
40
|
const dataSourceKey = (0, import_react.useMemo)(() => {
|
|
41
|
-
return (0, import_utils.isString)(dataSource) ? dataSource : dataSource == null ? void 0 : dataSource.key;
|
|
41
|
+
return (0, import_utils.isString)(dataSource) ? dataSource : (dataSource == null ? void 0 : dataSource.key) || (dataSource == null ? void 0 : dataSource.tableName);
|
|
42
42
|
}, [dataSource]);
|
|
43
43
|
const dataSourceKeyRef = (0, import_react.useRef)(dataSourceKey);
|
|
44
44
|
dataSourceKeyRef.current = dataSourceKey;
|
|
@@ -27,47 +27,34 @@ var useDesignMode = (props, { registerValueVariable, openDrawer, closeDrawer, da
|
|
|
27
27
|
const {
|
|
28
28
|
__designMode,
|
|
29
29
|
componentId,
|
|
30
|
-
|
|
31
|
-
showEditButton,
|
|
32
|
-
showAddButton
|
|
30
|
+
operation
|
|
33
31
|
} = props;
|
|
32
|
+
const { items } = operation || {};
|
|
33
|
+
const prevItemsRef = (0, import_react.useRef)([]);
|
|
34
34
|
(0, import_react.useEffect)(() => {
|
|
35
35
|
var _a;
|
|
36
|
-
if (__designMode === "design") {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
if (__designMode === "design" && (items == null ? void 0 : items.length) && ((_a = prevItemsRef.current) == null ? void 0 : _a.length)) {
|
|
37
|
+
const changedItem = items.find((item) => {
|
|
38
|
+
const prevItem = prevItemsRef.current.find((prev) => prev.key === item.key);
|
|
39
|
+
if (!prevItem)
|
|
40
|
+
return false;
|
|
41
|
+
if (item.actionType !== prevItem.actionType) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
});
|
|
46
|
+
if (changedItem) {
|
|
47
|
+
if (["view", "edit", "custom"].includes(changedItem.actionType)) {
|
|
48
|
+
registerValueVariable == null ? void 0 : registerValueVariable(componentId, {
|
|
49
|
+
currentRecord: (data == null ? void 0 : data[0]) || null
|
|
50
|
+
});
|
|
51
|
+
openDrawer(changedItem);
|
|
52
|
+
} else {
|
|
53
|
+
closeDrawer();
|
|
54
|
+
}
|
|
44
55
|
}
|
|
45
56
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var _a;
|
|
49
|
-
if (__designMode === "design") {
|
|
50
|
-
if (showEditButton) {
|
|
51
|
-
openDrawer("edit");
|
|
52
|
-
registerValueVariable == null ? void 0 : registerValueVariable(componentId, {
|
|
53
|
-
currentRecord: ((_a = data == null ? void 0 : data.data) == null ? void 0 : _a[0]) || null
|
|
54
|
-
});
|
|
55
|
-
} else {
|
|
56
|
-
closeDrawer();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}, [showEditButton, __designMode]);
|
|
60
|
-
(0, import_react.useEffect)(() => {
|
|
61
|
-
if (__designMode === "design") {
|
|
62
|
-
if (showAddButton) {
|
|
63
|
-
openDrawer("add");
|
|
64
|
-
registerValueVariable == null ? void 0 : registerValueVariable(componentId, {
|
|
65
|
-
currentRecord: null
|
|
66
|
-
});
|
|
67
|
-
} else {
|
|
68
|
-
closeDrawer();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}, [showAddButton, __designMode]);
|
|
57
|
+
prevItemsRef.current = items;
|
|
58
|
+
}, [items, __designMode]);
|
|
72
59
|
};
|
|
73
60
|
var useDesignMode_default = useDesignMode;
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { Drawer } from 'antd';
|
|
3
|
+
import { OperationItem } from '../type';
|
|
4
|
+
declare const useDrawerState: (operationContent?: {
|
|
5
|
+
[key: string]: import("react").ReactNode;
|
|
6
|
+
} | undefined) => {
|
|
3
7
|
drawerVisible: boolean;
|
|
4
8
|
setDrawerVisible: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
5
|
-
|
|
6
|
-
setDrawerType: import("react").Dispatch<import("react").SetStateAction<"add" | "edit" | "detail">>;
|
|
7
|
-
openDrawer: (type: 'detail' | 'edit' | 'add') => void;
|
|
9
|
+
openDrawer: (item: OperationItem) => void;
|
|
8
10
|
closeDrawer: () => void;
|
|
11
|
+
drawerContent: import("react").ReactNode;
|
|
12
|
+
Container: typeof Drawer | (import("react").FC<import("antd").ModalProps> & import("antd/es/modal/confirm").ModalStaticFunctions & {
|
|
13
|
+
useModal: typeof import("antd/es/modal/useModal").default;
|
|
14
|
+
destroyAll: () => void;
|
|
15
|
+
config: typeof import("antd/es/modal/confirm").modalGlobalConfig;
|
|
16
|
+
_InternalPanelDoNotUseOrYouWillBeFired: import("react").FC<import("antd/es/modal/PurePanel").PurePanelProps>;
|
|
17
|
+
});
|
|
18
|
+
containerProps: {
|
|
19
|
+
width?: undefined;
|
|
20
|
+
title?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
width: number;
|
|
23
|
+
title: string;
|
|
24
|
+
};
|
|
9
25
|
};
|
|
10
26
|
export default useDrawerState;
|
|
@@ -22,24 +22,70 @@ __export(useDrawerState_exports, {
|
|
|
22
22
|
default: () => useDrawerState_default
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(useDrawerState_exports);
|
|
25
|
+
var import_antd = require("antd");
|
|
25
26
|
var import_react = require("react");
|
|
26
|
-
var
|
|
27
|
+
var sizeMap = {
|
|
28
|
+
small: 400,
|
|
29
|
+
middle: 600,
|
|
30
|
+
large: 800
|
|
31
|
+
};
|
|
32
|
+
var useDrawerState = (operationContent) => {
|
|
27
33
|
const [drawerVisible, setDrawerVisible] = (0, import_react.useState)(false);
|
|
28
|
-
const [
|
|
29
|
-
const
|
|
34
|
+
const [item, setItem] = (0, import_react.useState)(null);
|
|
35
|
+
const timerRef = (0, import_react.useRef)();
|
|
36
|
+
(0, import_react.useEffect)(() => {
|
|
37
|
+
return () => {
|
|
38
|
+
if (timerRef.current) {
|
|
39
|
+
clearTimeout(timerRef.current);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
const openDrawer = (item2) => {
|
|
44
|
+
if (timerRef.current) {
|
|
45
|
+
clearTimeout(timerRef.current);
|
|
46
|
+
}
|
|
30
47
|
setDrawerVisible(true);
|
|
31
|
-
|
|
48
|
+
setItem(item2);
|
|
32
49
|
};
|
|
33
50
|
const closeDrawer = () => {
|
|
51
|
+
if (timerRef.current) {
|
|
52
|
+
clearTimeout(timerRef.current);
|
|
53
|
+
}
|
|
34
54
|
setDrawerVisible(false);
|
|
55
|
+
timerRef.current = setTimeout(() => {
|
|
56
|
+
setItem(null);
|
|
57
|
+
timerRef.current = void 0;
|
|
58
|
+
}, 300);
|
|
35
59
|
};
|
|
60
|
+
const drawerContent = (0, import_react.useMemo)(() => {
|
|
61
|
+
if ((item == null ? void 0 : item.key) && operationContent) {
|
|
62
|
+
return operationContent[item.key];
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}, [item, operationContent]);
|
|
66
|
+
const containerProps = (0, import_react.useMemo)(() => {
|
|
67
|
+
if (!item) {
|
|
68
|
+
return {};
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
width: sizeMap[item == null ? void 0 : item.openContentSize],
|
|
72
|
+
title: item == null ? void 0 : item.openTitle
|
|
73
|
+
};
|
|
74
|
+
}, [item]);
|
|
75
|
+
const Container = (0, import_react.useMemo)(() => {
|
|
76
|
+
if ((item == null ? void 0 : item.openMode) === "drawer") {
|
|
77
|
+
return import_antd.Drawer;
|
|
78
|
+
}
|
|
79
|
+
return import_antd.Modal;
|
|
80
|
+
}, [item == null ? void 0 : item.openMode]);
|
|
36
81
|
return {
|
|
37
82
|
drawerVisible,
|
|
38
83
|
setDrawerVisible,
|
|
39
|
-
drawerType,
|
|
40
|
-
setDrawerType,
|
|
41
84
|
openDrawer,
|
|
42
|
-
closeDrawer
|
|
85
|
+
closeDrawer,
|
|
86
|
+
drawerContent,
|
|
87
|
+
Container,
|
|
88
|
+
containerProps
|
|
43
89
|
};
|
|
44
90
|
};
|
|
45
91
|
var useDrawerState_default = useDrawerState;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Field } from '../../provider/dataSource/DataSourceContext';
|
|
1
2
|
export declare type ListResult = {
|
|
2
3
|
data: any[];
|
|
3
4
|
count: number;
|
|
@@ -6,6 +7,7 @@ export declare type ListResult = {
|
|
|
6
7
|
};
|
|
7
8
|
export declare type UseFormatParams = {
|
|
8
9
|
dataSourceKey: string;
|
|
10
|
+
fields: Field[];
|
|
9
11
|
};
|
|
10
12
|
export declare type FormatListResultParams = {
|
|
11
13
|
list: any[];
|
|
@@ -20,7 +22,21 @@ export declare type FormatListResultParams = {
|
|
|
20
22
|
pageSize: number;
|
|
21
23
|
};
|
|
22
24
|
};
|
|
23
|
-
declare
|
|
25
|
+
export declare type FilterValue = {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
};
|
|
28
|
+
export declare type FilterOperator = '$includes' | '$dateAfter' | '$dateBefore' | '$eq' | '$in' | '$isTruly' | '$and';
|
|
29
|
+
export declare type SimpleFilterValue = {
|
|
30
|
+
[key in Exclude<FilterOperator, '$and'>]?: any;
|
|
31
|
+
};
|
|
32
|
+
export declare type AndFilterValue = {
|
|
33
|
+
$and: FilterCondition[];
|
|
34
|
+
};
|
|
35
|
+
export declare type FilterConditionValue = SimpleFilterValue | AndFilterValue;
|
|
36
|
+
export declare type FilterCondition = {
|
|
37
|
+
[key: string]: FilterConditionValue;
|
|
38
|
+
} | AndFilterValue;
|
|
39
|
+
declare const useFormat: ({ dataSourceKey, fields }: UseFormatParams) => {
|
|
24
40
|
formatListResult: (res: FormatListResultParams) => ListResult;
|
|
25
41
|
formatListParams: (params: any) => any;
|
|
26
42
|
};
|