onekijs-ui 0.19.22 → 0.19.23
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/properties/typings.d.ts +2 -1
- package/dist/index.js +43 -3
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +43 -3
- package/dist/index.module.js.map +1 -1
- package/package.json +3 -3
- package/src/components/alert/components/AlertComponent.tsx +1 -1
- package/src/components/properties/components/PropertiesComponent.tsx +17 -5
- package/src/components/properties/components/Property.tsx +9 -2
- package/src/components/properties/style.ts +24 -2
- package/src/components/properties/typings.ts +2 -1
- package/src/components/table/style.ts +5 -0
|
@@ -16,6 +16,7 @@ export type PropertiesProps = {
|
|
|
16
16
|
export type PropertyProps = {
|
|
17
17
|
value: ReactNode;
|
|
18
18
|
name: string;
|
|
19
|
+
help?: ReactNode;
|
|
19
20
|
ErrorBoundaryComponent?: ComponentType<PropsWithChildren<PropertyProps>>;
|
|
20
21
|
};
|
|
21
22
|
export type PropertiesContext = {
|
|
@@ -25,4 +26,4 @@ export type PropertiesContext = {
|
|
|
25
26
|
lg?: GridSize;
|
|
26
27
|
xl?: GridSize;
|
|
27
28
|
};
|
|
28
|
-
export type PropertiesList = AnonymousObject<ReactNode
|
|
29
|
+
export type PropertiesList = AnonymousObject<ReactNode | Partial<PropertyProps>>;
|
package/dist/index.js
CHANGED
|
@@ -1838,7 +1838,7 @@ const AlertComponent = ({ kind = 'info', icon = true, IconComponent, className,
|
|
|
1838
1838
|
if (IconComponent === undefined) {
|
|
1839
1839
|
IconComponent = getDefautltIconComponent(kind);
|
|
1840
1840
|
}
|
|
1841
|
-
return (React.createElement("div", { className: addClassname(`
|
|
1841
|
+
return (React.createElement("div", { className: addClassname(`o-alert o-alert-${kind}`, className) },
|
|
1842
1842
|
icon && React.createElement(IconComponent, { width: getIconSize(size), height: getIconSize(size), marginRight: '20px', marginLeft: '20px' }),
|
|
1843
1843
|
React.createElement("div", null, children)));
|
|
1844
1844
|
};
|
|
@@ -6203,13 +6203,24 @@ const Property = React.memo((props) => {
|
|
|
6203
6203
|
nameSize === undefined ? undefined : (nameSize === 12 ? 12 : 12 - nameSize);
|
|
6204
6204
|
});
|
|
6205
6205
|
return (React.createElement(Row, { className: "o-property", gapX: "10px", gapY: "0px" },
|
|
6206
|
-
React.createElement(Col, { size: nameSize, sm: context.sm, md: context.md, lg: context.lg, xl: context.xl, className: "o-property-
|
|
6206
|
+
React.createElement(Col, { size: nameSize, sm: context.sm, md: context.md, lg: context.lg, xl: context.xl, className: "o-property-key" },
|
|
6207
|
+
React.createElement("span", { className: "o-property-name" }, name),
|
|
6208
|
+
props.help && (React.createElement(Tooltip, { content: props.help, placement: "top" },
|
|
6209
|
+
React.createElement(HelpIcon, null)))),
|
|
6207
6210
|
React.createElement(Col, { size: valueSize, sm: variantValueSize.sm, md: variantValueSize.md, lg: variantValueSize.lg, xl: variantValueSize.xl, className: "o-property-value" },
|
|
6208
6211
|
ErrorBoundaryComponent && React.createElement(ErrorBoundaryComponent, { ...props }, value),
|
|
6209
6212
|
!ErrorBoundaryComponent && React.createElement(React.Fragment, null, value))));
|
|
6210
6213
|
});
|
|
6211
6214
|
Property.displayName = 'Property';
|
|
6212
6215
|
|
|
6216
|
+
const isReactNode = (value) => {
|
|
6217
|
+
if (value === null || value === undefined)
|
|
6218
|
+
return true;
|
|
6219
|
+
if (Object.keys(value).includes('value')) {
|
|
6220
|
+
return false;
|
|
6221
|
+
}
|
|
6222
|
+
return true;
|
|
6223
|
+
};
|
|
6213
6224
|
const PropertiesComponent = ({ className, properties, PropertyComponent = Property, ErrorBoundaryComponent, order = false, size, sm, md, lg, xl, }) => {
|
|
6214
6225
|
const classNames = addClassname('o-properties', className);
|
|
6215
6226
|
const keys = Object.keys(properties);
|
|
@@ -6226,7 +6237,13 @@ const PropertiesComponent = ({ className, properties, PropertyComponent = Proper
|
|
|
6226
6237
|
};
|
|
6227
6238
|
}, [size, sm, md, lg, xl]);
|
|
6228
6239
|
return (React.createElement(DefaultPropertiesContext.Provider, { value: context },
|
|
6229
|
-
React.createElement("div", { className: classNames }, keys.map((key) =>
|
|
6240
|
+
React.createElement("div", { className: classNames }, keys.map((key) => {
|
|
6241
|
+
const property = properties[key];
|
|
6242
|
+
const value = isReactNode(property) ? property : property.value;
|
|
6243
|
+
const help = isReactNode(property) ? undefined : property.help;
|
|
6244
|
+
const name = isReactNode(property) ? key : property.name ?? key;
|
|
6245
|
+
return React.createElement(PropertyComponent, { key: key, name: name, value: value, help: help, ErrorBoundaryComponent: ErrorBoundaryComponent });
|
|
6246
|
+
}))));
|
|
6230
6247
|
};
|
|
6231
6248
|
|
|
6232
6249
|
const propertiesStyle = ({ theme }) => {
|
|
@@ -6239,6 +6256,24 @@ const propertiesStyle = ({ theme }) => {
|
|
|
6239
6256
|
.o-property-name {
|
|
6240
6257
|
${fontWeight(t.fontWeight)}
|
|
6241
6258
|
}
|
|
6259
|
+
.o-property-help {
|
|
6260
|
+
${textDecoration('underline')}
|
|
6261
|
+
${textDecorationStyle('dashed')}
|
|
6262
|
+
${textUnderlineOffset('0.25rem')}
|
|
6263
|
+
${cursor('help')}
|
|
6264
|
+
}
|
|
6265
|
+
.o-property-key {
|
|
6266
|
+
${display('flex')}
|
|
6267
|
+
${alignItems('center')}
|
|
6268
|
+
}
|
|
6269
|
+
|
|
6270
|
+
.o-tooltip {
|
|
6271
|
+
${cursor('pointer')}
|
|
6272
|
+
${width(5)}
|
|
6273
|
+
${marginBottom('2px')}
|
|
6274
|
+
${color('pink')}
|
|
6275
|
+
${marginLeft('xs')}
|
|
6276
|
+
}
|
|
6242
6277
|
`;
|
|
6243
6278
|
};
|
|
6244
6279
|
|
|
@@ -9867,7 +9902,12 @@ const tableStyle = ({ theme, fit = true }) => {
|
|
|
9867
9902
|
.o-table-header-title-container {
|
|
9868
9903
|
${borderBottomWidth(0)}
|
|
9869
9904
|
${paddingBottom(0)}
|
|
9905
|
+
.o-helper-icon {
|
|
9906
|
+
${marginLeft('xs')}
|
|
9907
|
+
${marginTop('-2px')}
|
|
9908
|
+
}
|
|
9870
9909
|
}
|
|
9910
|
+
|
|
9871
9911
|
}
|
|
9872
9912
|
|
|
9873
9913
|
.o-table-header-row-title, .o-table-header-row-filter {
|