@ramesesinc/platform-core 0.1.9 → 0.1.11
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/components/action/DeleteData.d.ts +1 -0
- package/dist/components/action/DeleteData.js +16 -5
- package/dist/components/action/LookupPage.d.ts +2 -1
- package/dist/components/action/LookupPage.js +4 -3
- package/dist/components/action/Play.d.ts +6 -0
- package/dist/components/action/Play.js +40 -0
- package/dist/components/action/ProgressBar.d.ts +8 -0
- package/dist/components/action/ProgressBar.js +146 -0
- package/dist/components/action/ViewPage.d.ts +3 -1
- package/dist/components/action/ViewPage.js +22 -10
- package/dist/components/common/UIMenu.d.ts +1 -0
- package/dist/components/common/UIMenu.js +5 -3
- package/dist/components/index.d.ts +4 -1
- package/dist/components/index.js +4 -1
- package/dist/components/input/Combo.d.ts +21 -0
- package/dist/components/input/Combo.js +137 -0
- package/dist/components/input/DateField.js +7 -14
- package/dist/components/input/Text.d.ts +5 -0
- package/dist/components/input/Text.js +42 -7
- package/dist/components/input/YearPicker.js +3 -2
- package/dist/components/list/EditableMenu.d.ts +2 -0
- package/dist/components/list/EditableMenu.js +128 -0
- package/dist/components/list/TabMenu.js +2 -2
- package/dist/components/list/TreeMenu.js +35 -13
- package/dist/components/table/DataList.d.ts +1 -1
- package/dist/components/table/DataList.js +56 -29
- package/dist/components/table/DataTable.d.ts +2 -0
- package/dist/components/table/DataTable.js +31 -22
- package/dist/components/view/FilterView.js +1 -1
- package/dist/components/view/HtmlForm.js +12 -9
- package/dist/components/view/HtmlView.js +1 -1
- package/dist/components/view/PageView.d.ts +1 -0
- package/dist/components/view/PageView.js +38 -11
- package/dist/components/view/PopupView.d.ts +1 -0
- package/dist/components/view/PopupView.js +4 -4
- package/dist/components/view/RootView.d.ts +1 -0
- package/dist/components/view/RootView.js +18 -18
- package/dist/components/view/WizardView.d.ts +1 -1
- package/dist/components/view/WizardView.js +7 -25
- package/dist/core/AuthContext.js +1 -1
- package/dist/core/DynamicComponent.d.ts +2 -1
- package/dist/core/DynamicComponent.js +24 -2
- package/dist/core/Page.d.ts +1 -0
- package/dist/core/Page.js +6 -5
- package/dist/core/PageCache.d.ts +0 -2
- package/dist/core/PageCache.js +3 -8
- package/dist/core/PageContext.d.ts +1 -0
- package/dist/core/PageContext.js +16 -2
- package/dist/core/PageViewContext.d.ts +8 -2
- package/dist/core/PageViewContext.js +155 -86
- package/dist/core/Panel.js +34 -12
- package/dist/core/StepHandler.d.ts +1 -1
- package/dist/core/StepHandler.js +58 -21
- package/dist/index.css +98 -0
- package/dist/layouts/CardLayout.d.ts +2 -2
- package/dist/layouts/CardLayout.js +3 -4
- package/dist/layouts/HPanel.d.ts +2 -2
- package/dist/layouts/HPanel.js +1 -2
- package/dist/layouts/VPanel.d.ts +2 -2
- package/dist/layouts/VPanel.js +1 -2
- package/dist/layouts/index.d.ts +2 -3
- package/dist/layouts/index.js +2 -3
- package/dist/lib/utils/ExprUtil.js +18 -29
- package/dist/lib/utils/ResourceLoader.js +19 -7
- package/dist/lib/utils/SectionProvider.js +1 -1
- package/dist/lib/utils/initResourceLoader.d.ts +2 -0
- package/dist/lib/utils/initResourceLoader.js +64 -95
- package/dist/lib/utils/nunjucks.d.ts +2 -0
- package/dist/lib/utils/nunjucks.js +8 -0
- package/dist/templates/CrudFormTemplate.js +2 -3
- package/dist/templates/DataListTemplate.js +1 -1
- package/dist/templates/WizardTemplate.d.ts +3 -0
- package/dist/templates/WizardTemplate.js +17 -10
- package/package.json +1 -1
- package/dist/components/input/Select.d.ts +0 -14
- package/dist/components/input/Select.js +0 -40
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import BorderLayout from "../layouts/BorderLayout";
|
|
3
|
-
import HPanel from "../layouts
|
|
4
|
-
import
|
|
5
|
-
import { SectionProvider } from "../lib/utils/SectionProvider";
|
|
3
|
+
import { HPanel, VPanel } from "../layouts";
|
|
4
|
+
import { SectionProvider } from "../lib";
|
|
6
5
|
const CrudFormTemplate = (props) => {
|
|
7
6
|
const sp = SectionProvider(props !== null && props !== void 0 ? props : {});
|
|
8
7
|
const getRight = () => {
|
|
@@ -9,7 +9,7 @@ const DataListTemplate = (props) => {
|
|
|
9
9
|
const getPreferredTitle = () => {
|
|
10
10
|
return title !== null && title !== void 0 ? title : pageView.getUI().getTitle();
|
|
11
11
|
};
|
|
12
|
-
const attr = { title: getPreferredTitle(), cols, data, rowsPerPage, commonActions, rowActions, toolbarActions, bulkActions, filters };
|
|
12
|
+
const attr = { title: getPreferredTitle(), cols, data, rowsPerPage, commonActions, rowActions, toolbarActions, bulkActions, filters, searchable };
|
|
13
13
|
const loadPanel = (section) => {
|
|
14
14
|
return _jsx(Panel, { content: section });
|
|
15
15
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { StepActionHandler } from "../core/StepHandler";
|
|
2
3
|
type WizardTemplateProps = {
|
|
4
|
+
title?: string;
|
|
3
5
|
component?: string;
|
|
6
|
+
componentid?: string;
|
|
4
7
|
attr?: Record<string, any>;
|
|
5
8
|
stepHandler: StepActionHandler;
|
|
6
9
|
children?: React.ReactNode;
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from "@ramesesinc/client";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
3
|
+
import React, { useEffect, useState } from "react";
|
|
4
4
|
import { useApp } from "../core/AppContext";
|
|
5
5
|
import BorderLayout from "../layouts/BorderLayout";
|
|
6
|
+
import { ResourceLoader } from "../lib/utils/ResourceLoader";
|
|
6
7
|
const WizardTemplate = (props) => {
|
|
7
|
-
const { component,
|
|
8
|
+
const { title, component, componentid, stepHandler, children } = props !== null && props !== void 0 ? props : {};
|
|
8
9
|
const [view, setView] = useState(null);
|
|
9
10
|
const { getComponentCache } = useApp();
|
|
10
11
|
const loadComponent = async () => {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
var _a;
|
|
13
|
+
if (componentid === null || componentid === void 0 ? void 0 : componentid.trim()) {
|
|
14
|
+
const comp = await getComponentCache(componentid);
|
|
15
|
+
setView(comp.template);
|
|
13
16
|
return;
|
|
14
17
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
if (component === null || component === void 0 ? void 0 : component.trim()) {
|
|
19
|
+
const Comp = ResourceLoader.getComponent(component);
|
|
20
|
+
setView(_jsx(React.Suspense, { fallback: _jsx("div", { children: "Loading..." }), children: _jsx(Comp, Object.assign({}, ((_a = props.attr) !== null && _a !== void 0 ? _a : {}))) }));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
setView(null);
|
|
19
24
|
};
|
|
20
25
|
const render = () => {
|
|
21
26
|
if (view != null) {
|
|
@@ -24,14 +29,16 @@ const WizardTemplate = (props) => {
|
|
|
24
29
|
return children;
|
|
25
30
|
};
|
|
26
31
|
useEffect(() => {
|
|
32
|
+
setView(null);
|
|
27
33
|
loadComponent();
|
|
28
|
-
}, []);
|
|
34
|
+
}, [component, componentid]);
|
|
29
35
|
const handleNext = () => {
|
|
30
36
|
stepHandler === null || stepHandler === void 0 ? void 0 : stepHandler.next();
|
|
31
37
|
};
|
|
32
38
|
const handleBack = () => {
|
|
33
39
|
stepHandler === null || stepHandler === void 0 ? void 0 : stepHandler.back();
|
|
34
40
|
};
|
|
35
|
-
|
|
41
|
+
const south = (_jsxs("div", { className: "flex justify-between gap-2 p-4 font-proxima-600", children: [_jsx("div", { className: "flex gap-2", children: (stepHandler === null || stepHandler === void 0 ? void 0 : stepHandler.hasPrev()) && (_jsx(Button, { onClick: handleBack, className: "bg-transparent text-gray-500 border-none shadow-none hover:bg-gray-100", children: "Back" })) }), _jsx("div", { className: "flex gap-2", children: (stepHandler === null || stepHandler === void 0 ? void 0 : stepHandler.hasNext()) && (_jsx(Button, { onClick: handleNext, className: "bg-primary-500 text-white hover:bg-primary-600", children: "Next" })) })] }));
|
|
42
|
+
return (_jsx(BorderLayout, { north: _jsx("div", { className: "mb-2 font-semibold text-lg", children: title }), south: south, children: render() }));
|
|
36
43
|
};
|
|
37
44
|
export default WizardTemplate;
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { UIInputProps } from "../common/UIInput";
|
|
2
|
-
type SelectOption = {
|
|
3
|
-
label: string;
|
|
4
|
-
value: string;
|
|
5
|
-
};
|
|
6
|
-
type SelectFieldProps = UIInputProps & {
|
|
7
|
-
required?: boolean;
|
|
8
|
-
immediate?: boolean;
|
|
9
|
-
options?: SelectOption[];
|
|
10
|
-
placeholder?: string;
|
|
11
|
-
onChange?: (value: string) => void;
|
|
12
|
-
};
|
|
13
|
-
declare const SelectField: (props: SelectFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export default SelectField;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useState } from "react";
|
|
3
|
-
import UIComponent from "../common/UIComponent";
|
|
4
|
-
import useUIInput from "../common/UIInput";
|
|
5
|
-
const SelectField = (props) => {
|
|
6
|
-
const { immediate = true, options = [], placeholder } = props !== null && props !== void 0 ? props : {};
|
|
7
|
-
const [focused, setFocused] = useState(false);
|
|
8
|
-
const selectRef = useRef(null);
|
|
9
|
-
const valueRef = useRef("");
|
|
10
|
-
const className = "border rounded px-2 py-1 w-full";
|
|
11
|
-
const handleFocus = () => {
|
|
12
|
-
setFocused(true);
|
|
13
|
-
};
|
|
14
|
-
const handleBlur = () => {
|
|
15
|
-
if (!immediate) {
|
|
16
|
-
setValue(selectValue);
|
|
17
|
-
}
|
|
18
|
-
setFocused(false);
|
|
19
|
-
};
|
|
20
|
-
const onRefresh = () => {
|
|
21
|
-
setSelectValue(getValue());
|
|
22
|
-
};
|
|
23
|
-
const { initialValue, getValue, setValue, binding } = useUIInput(Object.assign(Object.assign({}, props), { onRefresh }));
|
|
24
|
-
valueRef.current = initialValue !== null && initialValue !== void 0 ? initialValue : "";
|
|
25
|
-
const [selectValue, setSelectValue] = useState(valueRef.current);
|
|
26
|
-
const onChange = (e) => {
|
|
27
|
-
var _a, _b;
|
|
28
|
-
const text = (_a = e.target.value) !== null && _a !== void 0 ? _a : "";
|
|
29
|
-
if (text !== selectValue) {
|
|
30
|
-
valueRef.current = text;
|
|
31
|
-
setSelectValue(valueRef.current);
|
|
32
|
-
}
|
|
33
|
-
if (immediate) {
|
|
34
|
-
setValue(text);
|
|
35
|
-
}
|
|
36
|
-
(_b = props.onChange) === null || _b === void 0 ? void 0 : _b.call(props, text);
|
|
37
|
-
};
|
|
38
|
-
return (_jsx(UIComponent, Object.assign({}, (props !== null && props !== void 0 ? props : {}), { children: _jsxs("select", { ref: selectRef, onChange: onChange, value: selectValue, onFocus: handleFocus, onBlur: handleBlur, className: className, children: [placeholder && (_jsx("option", { value: "", disabled: true, children: placeholder })), options.map((opt) => (_jsx("option", { value: opt.value, children: opt.label }, opt.value)))] }) })));
|
|
39
|
-
};
|
|
40
|
-
export default SelectField;
|